text
stringlengths 2
100k
| meta
dict |
---|---|
"""
**WARNING**
This demo might not work as expected and some documented features might be
missing.
-------------------------------------------------------------------------------
Demonstrate the CSVListEditor class.
This editor allows the user to enter a *single* line of input text, containing
comma-separated values (or another separator may be specified). Your program
specifies an element Trait type of Int, Float, Str, Enum, or Range.
"""
# Issue related to the demo warning: enthought/traitsui#913
from traits.api import (
HasTraits, List, Int, Float, Enum, Range, Str, Button, Property
)
from traitsui.api import (
View, Item, Label, Heading, VGroup, HGroup, UItem, spring, TextEditor,
CSVListEditor
)
class CSVListEditorDemo(HasTraits):
list1 = List(Int)
list2 = List(Float)
list3 = List(Str, maxlen=3)
list4 = List(Enum('red', 'green', 'blue', 2, 3))
list5 = List(Range(low=0.0, high=10.0))
# 'low' and 'high' are used to demonstrate lists containing dynamic ranges.
low = Float(0.0)
high = Float(1.0)
list6 = List(Range(low=-1.0, high='high'))
list7 = List(Range(low='low', high='high'))
pop1 = Button("Pop from first list")
sort1 = Button("Sort first list")
# This will be str(self.list1).
list1str = Property(Str, depends_on='list1')
traits_view = View(
HGroup(
# This VGroup forms the column of CSVListEditor examples.
VGroup(
Item(
'list1',
label="List(Int)",
editor=CSVListEditor(ignore_trailing_sep=False),
tooltip='options: ignore_trailing_sep=False'
),
Item(
'list1',
label="List(Int)",
style='readonly',
editor=CSVListEditor()
),
Item(
'list2',
label="List(Float)",
editor=CSVListEditor(enter_set=True, auto_set=False),
tooltip='options: enter_set=True, auto_set=False'
),
Item(
'list3',
label="List(Str, maxlen=3)",
editor=CSVListEditor()
),
Item(
'list4',
label="List(Enum('red', 'green', 'blue', 2, 3))",
editor=CSVListEditor(sep=None),
tooltip='options: sep=None'
),
Item(
'list5',
label="List(Range(low=0.0, high=10.0))",
editor=CSVListEditor()
),
Item(
'list6',
label="List(Range(low=-1.0, high='high'))",
editor=CSVListEditor()
),
Item(
'list7',
label="List(Range(low='low', high='high'))",
editor=CSVListEditor()
),
springy=True,
),
# This VGroup forms the right column; it will display the
# Python str representation of the lists.
VGroup(
UItem('list1str', editor=TextEditor(),
enabled_when='False', width=240),
UItem('list1str', editor=TextEditor(),
enabled_when='False', width=240),
UItem('list2', editor=TextEditor(),
enabled_when='False', width=240),
UItem('list3', editor=TextEditor(),
enabled_when='False', width=240),
UItem('list4', editor=TextEditor(),
enabled_when='False', width=240),
UItem('list5', editor=TextEditor(),
enabled_when='False', width=240),
UItem('list6', editor=TextEditor(),
enabled_when='False', width=240),
UItem('list7', editor=TextEditor(),
enabled_when='False', width=240),
),
),
'_',
HGroup('low', 'high', spring, UItem('pop1'), UItem('sort1')),
Heading("Notes"),
Label("Hover over a list to see which editor options are set, "
"if any."),
Label("The editor of the first list, List(Int), uses "
"ignore_trailing_sep=False, so a trailing comma is "
"an error."),
Label("The second list is a read-only view of the first list."),
Label("The editor of the List(Float) example has enter_set=True "
"and auto_set=False; press Enter to validate."),
Label("The List(Str) example will accept at most 3 elements."),
Label("The editor of the List(Enum(...)) example uses sep=None, "
"i.e. whitespace acts as a separator."),
Label("The last three List(Range(...)) examples take neither, one or "
"both of their limits from the Low and High fields below."),
width=720,
title="CSVListEditor Demonstration",
)
def _list1_default(self):
return [1, 4, 0, 10]
def _get_list1str(self):
return str(self.list1)
def _pop1_fired(self):
if len(self.list1) > 0:
x = self.list1.pop()
print(x)
def _sort1_fired(self):
self.list1.sort()
if __name__ == "__main__":
demo = CSVListEditorDemo()
demo.configure_traits()
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/tv_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="18sp"
android:text="返回" />
<WebView
android:id="@+id/wv_test"
android:layout_width="match_parent"
android:layout_height="match_parent"></WebView>
</LinearLayout> | {
"pile_set_name": "Github"
} |
# frozen_string_literal: true
module Api
module V1
class InventoryStatusItemSerializer < ActiveModel::Serializer
type :inventory_status_items
attributes :status, :icon
end
end
end
| {
"pile_set_name": "Github"
} |
julia 0.3
Compat 0.4.9
GZip 0.2.16
StatsBase 0.6.15 0.9.0
LightXML 0.1.10
Docile 0.5.3
| {
"pile_set_name": "Github"
} |
!
! A multiply routine rewritten by NickH
!
!
!
! Revision Log
! ------------
! $Log: intmul.S,v $
! Revision 1.1 1994/10/04 16:50:54 jont
! new file
!
! Revision 1.5 1994/09/13 14:20:54 nickb
! Rewrite this routine to be called directly from ML, not through
! C as before (huge speedups seen).
!
! Revision 1.4 1994/07/06 13:38:02 nickh
! Asm and C name prefixes differ according to OS.
!
! Revision 1.3 1994/07/04 12:18:31 nickh
! Fix comment prefix in log.
!
! Revision 1.2 1994/06/09 14:30:37 nickh
! new file
!
! Revision 1.1 1994/06/09 10:55:09 nickh
! new file
!
!
!
#include "naming.h"
.text
.align 4
.global C_NAME(mach_int_mul)
C_NAME(mach_int_mul):
/* We are passed an ML pair containing the multiplier and mutiplicand
as ML ints. We untag the multiplier, so that the product is the
correct ML product. We case on the multiplier to choose how many
multiply steps to do (according to whether there are 4, 8, 12, 16, or
more significant bits). We do the multiply steps, then extract the
result and test for overflow. We avoid using the closure register
o1. The multiplication corrupts registers o4 and o5, so we have to
clear those on the way out. */
ld [%o0+3],%o2 /* get cdr of arg into o2 */
ld [%o0-1],%o0 /* get car of arg into o0 */
sra %o0, 2, %o0 /* shift multiplier by 2 */
mov %o0, %y /* do the multiply.... */
andncc %o0, 0xf, %o4
be mul_4_bits_only /* 4 bits */
sethi %hi(0xffff0000), %o5
andncc %o0, 0xff, %o4
be,a mul_8_bits_only /* 8 bits */
mulscc %o4, %o2, %o4
andncc %o0, 0xfff, %o4
be,a mul_12_bits_only /* 12 bits */
mulscc %o4, %o2, %o4
andcc %o0, %o5, %o4
be,a mul_16_bits_only /* 16 bits */
mulscc %o4, %o2, %o4
andcc %g0, %g0, %o4 /* clear o4 and the flags */
mulscc %o4, %o2, %o4 /* a full set of multiply steps ... */
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %g0, %o4
tst %o0
rd %y, %o0 /* get low bits out of y */
bge mul_non_neg_multiplier /* if multiplier negative ... */
tst %o0
sub %o4, %o2, %o4 /* ... subtract multiplicand from high bits */
mul_non_neg_multiplier:
bge,a mul_pos_result+4/* if low bits positive, go to pos_result */
addcc %o4, %g0, %g0 /* set zero flag if the high word is zero */
mul_neg_result: /* otherwise result is negative */
cmp %o4, -1 /* if high word not -1 ... */
bnz mach_int_mul_overflow /* ... overflow */
mov %g0, %o4 /* otherwise return clearing o4/o5 */
retl
mov %g0, %o5
mul_8_bits_only: /* get here having done one multiply step */
mulscc %o4, %o2, %o4 /* 8 more multiply steps */
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %g0, %o4
rd %y, %o5 /* get result out of y and o4 */
sll %o4, 8, %o0
srl %o5, 0x18, %o5
orcc %o5, %o0, %o0
bge mul_pos_result /* if low bits positive */
sra %o4, 0x18, %o4
cmp %o4, -1 /* if high word not -1 ... */
bnz mach_int_mul_overflow /* ... overflow */
mov %g0, %o4 /* otherwise return clearing o4/o5 */
retl
mov %g0, %o5
mul_12_bits_only: /* get here having done one multiply step */
mulscc %o4, %o2, %o4 /* 12 more multiply steps */
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %g0, %o4
rd %y, %o5 /* get result out of y and o4 */
sll %o4, 0xc, %o0
srl %o5, 0x14, %o5
orcc %o5, %o0, %o0
bge mul_pos_result /* if low bits +ve, result +ve */
sra %o4, 0x14, %o4
cmp %o4, -1 /* if high word not -1 ... */
bnz mach_int_mul_overflow /* ... overflow */
mov %g0, %o4 /* otherwise return clearing o4/o5 */
retl
mov %g0, %o5
mul_16_bits_only: /* get here having done one multiply step */
mulscc %o4, %o2, %o4 /* 16 more multiply steps */
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %g0, %o4
rd %y, %o5 /* get result out of y and o4 */
sll %o4, 0x10, %o0
srl %o5, 0x10, %o5
orcc %o5, %o0, %o0
bge mul_pos_result /* if low bits +ve, result +ve */
sra %o4, 0x10, %o4
cmp %o4, -1 /* if high word not -1 ... */
bnz mach_int_mul_overflow /* ... overflow */
mov %g0, %o4 /* otherwise return clearing o4/o5 */
retl
mov %g0, %o5
mul_4_bits_only:
mulscc %o4, %o2, %o4 /* do 5 multiply steps */
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %o2, %o4
mulscc %o4, %g0, %o4
rd %y, %o5 /* get result out of y and o4 */
sll %o4, 4, %o0
srl %o5, 0x1c, %o5
orcc %o5, %o0, %o0
bl mul_neg_result /* if low bits negative, result is negative */
sra %o4, 0x1c, %o4
mul_pos_result:
addcc %o4, %g0, %g0 /* if high word is not zero ... */
bnz,a mach_int_mul_overflow /* ... overflow */
mov %g0, %o4
retl /* otherwise, clear o5 and return */
mov %g0, %o5
mach_int_mul_overflow:
sethi %hi(C_NAME(perv_exn_ref_prod)), %o5
or %o5, %lo(C_NAME(perv_exn_ref_prod)), %o5
ld [%o5], %o4 /* perv_exn_ref_prod */
call C_NAME(ml_raise_leaf) /* raise the exception */
ld [%o4 + 9], %o0 /* DEREF(perv_exn_ref_prod) */
| {
"pile_set_name": "Github"
} |
using NUnit.Framework;
using ServiceStack.DataAnnotations;
using ServiceStack.Text;
namespace ServiceStack.OrmLite.Tests.Issues
{
public class DistinctColumn
{
public int Id { get; set; }
public int Foo { get; set; }
public int Bar { get; set; }
}
public class DistinctJoinColumn
{
public int Id { get; set; }
public int DistinctColumnId { get; set; }
public string Name { get; set; }
}
[Alias("t1")]
class TableWithAliases
{
public int Id { get; set; }
[Alias("n1")]
public string Name { get; set; }
[Alias("n2")]
public string Name1 { get; set; }
[Alias("n3")]
public string Name2 { get; set; }
}
[TestFixtureOrmLite]
public class SelectDistinctTests : OrmLiteProvidersTestBase
{
public SelectDistinctTests(DialectContext context) : base(context) {}
[Test]
public void Can_Select_Multiple_Distinct_Columns()
{
using (var db = OpenDbConnection())
{
db.DropAndCreateTable<DistinctColumn>();
db.DropAndCreateTable<DistinctJoinColumn>();
db.InsertAll(new[] {
new DistinctColumn { Id = 1, Foo = 1, Bar = 42 },
new DistinctColumn { Id = 2, Foo = 2, Bar = 55 },
});
db.InsertAll(new[] {
new DistinctJoinColumn { DistinctColumnId = 1, Name = "Foo", Id = 1 },
new DistinctJoinColumn { DistinctColumnId = 1, Name = "Foo", Id = 2 },
new DistinctJoinColumn { DistinctColumnId = 2, Name = "Bar", Id = 3 },
});
var q = db.From<DistinctColumn>()
.Join<DistinctJoinColumn>()
.SelectDistinct(dt => new { dt.Bar, dt.Foo });
var result = db.Select(q);
db.GetLastSql().Print();
Assert.That(result.Count, Is.EqualTo(2));
}
}
[Test]
public void Does_select_alias_in_custom_select()
{
using (var db = OpenDbConnection())
{
db.DropAndCreateTable<TableWithAliases>();
for (var i = 1; i <= 5; i++)
{
db.Insert(new TableWithAliases { Id = i, Name = "foo" + i, Name1 = "bar" + i, Name2 = "qux" + i });
}
var uniqueTrackNames = db.ColumnDistinct<string>(
db.From<TableWithAliases>().Select(x => x.Name));
Assert.That(uniqueTrackNames, Is.EquivalentTo(new []
{
"foo1",
"foo2",
"foo3",
"foo4",
"foo5",
}));
}
}
}
} | {
"pile_set_name": "Github"
} |
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Compile Include="**\*.cs" />
</ItemGroup>
</Project>
| {
"pile_set_name": "Github"
} |
# Tumo Blog
> Tumo Blog 是一个简洁美观的博客系统,基于SpringBoot2.X + Vue.js。
 [](https://github.com/TyCoding/tumo/stargazers) 
[Tumo](https://github.com/TyCoding/tumo) 是一款基于SpringBoot2.x构建的博客系统。[Tumo](https://github.com/TyCoding/tumo) 系统具有简洁、规范的代码设计,借助Vue.js、Thymeleaf构建传统单体架构项目;与此同时,[Tumo-Vue](https://github.com/TyCoding/tumo-vue) 前后端分离架构的系统也应运而生。两款项目采用相同的后端逻辑实现,区别在于前者采用了单体架构,而后者使用Vue2.x实现前后端分离架构。两者的结合更好的帮助开发者熟悉SpringBoot框架快速开发并学习项目如何从单体架构过度到前后端分离架构。
- 在线预览:[http://tumo.tycoding.cn/](http://tumo.tycoding.cn/)
- 后台地址:[http://tumo.tycoding.cn/login](http://tumo.tycoding.cn/login)
- 开发文档:[http://docs.tumo.tycoding.cn/#/](http://docs.tumo.tycoding.cn/#/)
## 单体版本
本前后端分离版本和单体版本采用了相同的后端逻辑实现,是你**从单体架构过度到前后端分离架构**的最佳实践。
项目源码:[https://github.com/TyCoding/tumo](https://github.com/TyCoding/tumo) 希望大家star、fork支持。
## 技术选型
| Name | Version | Env | Version |
| -- | -- | -- | -- |
| SpringBoot | 2.3.1.RELEASE | JDK | 1.8 |
| Mybatis | 2.1.3 | MySQL | 5.7 |
| Spring-Shiro | 1.5.2 | IDEA | 2020.1 |
## 文档
> 如果有需要提供该项目技术支持的小伙伴加QQ:2783903379 进该项目的交流群(不免费,门槛:10元)。
手摸手教你SpringBoot项目实战。
项目开发、使用文档请移步:[http://docs.tumo.tycoding.cn](http://docs.tumo.tycoding.cn)
文档将在我的公众号 **程序员涂陌** 第一时间发布,请持续关注!
| 程序员涂陌 |
| ----------------------------------------------------------- |
|  |
## 请喝果汁
| Alipay | WechatPay |
| ---------------------------------------------------------- | ---------------------------------------------------------- |
|  |  |
## 预览
















## 交流
QQGroup:671017003
WeChatGroup: 关注公众号查看
## 联系我
- [Blog@TyCoding's blog](http://www.tycoding.cn)
- [GitHub@TyCoding](https://github.com/TyCoding)
| {
"pile_set_name": "Github"
} |
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.10.
.TH ELEMENTS-CLI "1" "May 2019" "elements-cli v0.17.0.1" "User Commands"
.SH NAME
elements-cli \- manual page for elements-cli v0.17.0.1
.SH SYNOPSIS
.B elements-cli
[\fI\,options\/\fR] \fI\,<command> \/\fR[\fI\,params\/\fR] \fI\,Send command to Elements Core\/\fR
.br
.B elements-cli
[\fI\,options\/\fR] \fI\,-named <command> \/\fR[\fI\,name=value\/\fR]... \fI\,Send command to Elements Core (with named arguments)\/\fR
.br
.B elements-cli
[\fI\,options\/\fR] \fI\,help List commands\/\fR
.br
.B elements-cli
[\fI\,options\/\fR] \fI\,help <command> Get help for a command\/\fR
.SH DESCRIPTION
Elements Core RPC client version v0.17.0.1\-dirty
.SH OPTIONS
.HP
\-?
.IP
Print this help message and exit
.HP
\fB\-conf=\fR<file>
.IP
Specify configuration file. Relative paths will be prefixed by datadir
location. (default: elements.conf)
.HP
\fB\-datadir=\fR<dir>
.IP
Specify data directory
.HP
\fB\-getinfo\fR
.IP
Get general information from the remote server. Note that unlike
server\-side RPC calls, the results of \fB\-getinfo\fR is the result of
multiple non\-atomic requests. Some entries in the result may
represent results from different states (e.g. wallet balance may
be as of a different block from the chain state reported)
.HP
\fB\-named\fR
.IP
Pass named instead of positional arguments (default: false)
.HP
\fB\-rpcclienttimeout=\fR<n>
.IP
Timeout in seconds during HTTP requests, or 0 for no timeout. (default:
900)
.HP
\fB\-rpcconnect=\fR<ip>
.IP
Send commands to node running on <ip> (default: 127.0.0.1)
.HP
\fB\-rpccookiefile=\fR<loc>
.IP
Location of the auth cookie. Relative paths will be prefixed by a
net\-specific datadir location. (default: data dir)
.HP
\fB\-rpcpassword=\fR<pw>
.IP
Password for JSON\-RPC connections
.HP
\fB\-rpcport=\fR<port>
.IP
Connect to JSON\-RPC on <port> (default: 8332, testnet: 18332, regtest:
18443)
.HP
\fB\-rpcuser=\fR<user>
.IP
Username for JSON\-RPC connections
.HP
\fB\-rpcwait\fR
.IP
Wait for RPC server to start
.HP
\fB\-rpcwallet=\fR<walletname>
.IP
Send RPC for non\-default wallet on RPC server (needs to exactly match
corresponding \fB\-wallet\fR option passed to the daemon). This changes
the RPC endpoint used, e.g.
http://127.0.0.1:8332/wallet/<walletname>
.HP
\fB\-stdin\fR
.IP
Read extra arguments from standard input, one per line until EOF/Ctrl\-D
(recommended for sensitive information such as passphrases). When
combined with \fB\-stdinrpcpass\fR, the first line from standard input
is used for the RPC password.
.HP
\fB\-stdinrpcpass\fR
.IP
Read RPC password from standard input as a single line. When combined
with \fB\-stdin\fR, the first line from standard input is used for the
RPC password.
.HP
\fB\-version\fR
.IP
Print version and exit
.PP
Chain selection options:
.HP
\fB\-chain=\fR<chain>
.IP
Use the chain <chain> (default: main). Reserved values: main, test,
regtest
.HP
\fB\-con_blockheightinheader\fR
.IP
Whether the chain includes the block height directly in the header, for
easier validation of block height in low\-resource environments.
(default: true)
.HP
\fB\-con_has_parent_chain\fR
.IP
Whether or not there is a parent chain.
.HP
\fB\-con_max_block_sig_size\fR
.IP
Max allowed witness data for the signed block header.
.HP
\fB\-con_parent_chain_signblockscript\fR
.IP
Whether parent chain uses pow or signed blocks. If the parent chain uses
signed blocks, the challenge (scriptPubKey) script. If not, an
empty string. (default: empty script [ie parent uses pow])
.HP
\fB\-con_parentpowlimit\fR
.IP
The proof\-of\-work limit value for the parent chain.
.HP
\fB\-con_signed_blocks\fR
.IP
Signed blockchain. Uses input of `\-signblockscript` to define what
signatures are necessary to solve it.
.HP
\fB\-fedpegscript\fR
.IP
The script for the federated peg.
.HP
\fB\-parentgenesisblockhash\fR
.IP
The genesis blockhash of the parent chain.
.HP
\fB\-signblockscript\fR
.IP
Signed blockchain enumberance. Only active when `\-con_signed_blocks` set
to true.
.HP
\fB\-testnet\fR
.IP
Use the test chain
.PP
Elements Options:
.HP
\fB\-con_blocksubsidy\fR
.IP
Defines the amount of block subsidy to start with, at genesis block, in
satoshis.
.HP
\fB\-con_connect_coinbase\fR
.IP
Connect outputs in genesis block to utxo database.
.HP
\fB\-con_csv_deploy_start\fR
.IP
Starting height for CSV deployment. (default: \fB\-1\fR, which means ACTIVE
from genesis)
.HP
\fB\-con_elementsmode\fR
.TP
Use Elements\-like instead of Core\-like witness encoding.
This is
.IP
required for CA/CT. (default: true)
.HP
\fB\-con_mandatorycoinbase\fR
.IP
All non\-zero valued coinbase outputs must go to this scriptPubKey, if
set.
.HP
\fB\-enforce_pak\fR
.IP
Causes standardness checks to enforce Pegout Authorization Key(PAK)
validation, and miner to include PAK commitments when configured.
Can not be set when acceptnonstdtx is set to true.
.HP
\fB\-multi_data_permitted\fR
.IP
Allow relay of multiple OP_RETURN outputs. (default: true)
.HP
\fB\-pak\fR
.IP
Entries in the PAK list. Order of entries matter.
.SH COPYRIGHT
Copyright (C) 2009-2019 The Elements Project developers
Copyright (C) 2009-2019 The Bitcoin Core developers
Please contribute if you find Elements Core useful. Visit
<https://bitcoincore.org> for further information about the software.
The source code is available from <https://github.com/bitcoin/bitcoin>.
This is experimental software.
Distributed under the MIT software license, see the accompanying file COPYING
or <https://opensource.org/licenses/MIT>
This product includes software developed by the OpenSSL Project for use in the
OpenSSL Toolkit <https://www.openssl.org> and cryptographic software written by
Eric Young and UPnP software written by Thomas Bernard.
| {
"pile_set_name": "Github"
} |
({
"field-dayperiod": "cadran",
"field-minute": "minute",
"eraNames": [
"avant Jésus-Christ",
"après Jésus-Christ"
],
"field-weekday": "jour de la semaine",
"days-standAlone-wide": [
"dimanche",
"lundi",
"mardi",
"mercredi",
"jeudi",
"vendredi",
"samedi"
],
"months-standAlone-narrow": [
"J",
"F",
"M",
"A",
"M",
"J",
"J",
"A",
"S",
"O",
"N",
"D"
],
"field-era": "ère",
"field-hour": "heure",
"quarters-standAlone-abbr": [
"T1",
"T2",
"T3",
"T4"
],
"timeFormat-full": "HH:mm:ss v",
"months-standAlone-abbr": [
"janv.",
"févr.",
"mars",
"avr.",
"mai",
"juin",
"juil.",
"août",
"sept.",
"oct.",
"nov.",
"déc."
],
"days-standAlone-narrow": [
"D",
"L",
"M",
"M",
"J",
"V",
"S"
],
"eraAbbr": [
"av. J.-C.",
"ap. J.-C."
],
"dateFormat-long": "d MMMM yyyy",
"timeFormat-medium": "HH:mm:ss",
"field-zone": "fuseau horaire",
"dateFormat-medium": "d MMM yyyy",
"quarters-standAlone-wide": [
"1er trimestre",
"2e trimestre",
"3e trimestre",
"4e trimestre"
],
"dateTimeFormat": "{1} {0}",
"field-year": "année",
"quarters-standAlone-narrow": [
"1",
"2",
"3",
"4"
],
"field-week": "semaine",
"months-standAlone-wide": [
"janvier",
"février",
"mars",
"avril",
"mai",
"juin",
"juillet",
"août",
"septembre",
"octobre",
"novembre",
"décembre"
],
"timeFormat-long": "HH:mm:ss z",
"months-format-abbr": [
"janv.",
"févr.",
"mars",
"avr.",
"mai",
"juin",
"juil.",
"août",
"sept.",
"oct.",
"nov.",
"déc."
],
"timeFormat-short": "HH:mm",
"field-month": "mois",
"quarters-format-abbr": [
"T1",
"T2",
"T3",
"T4"
],
"days-format-abbr": [
"dim.",
"lun.",
"mar.",
"mer.",
"jeu.",
"ven.",
"sam."
],
"pm": "PM",
"days-format-narrow": [
"D",
"L",
"M",
"M",
"J",
"V",
"S"
],
"field-second": "seconde",
"field-day": "jour",
"months-format-narrow": [
"J",
"F",
"M",
"A",
"M",
"J",
"J",
"A",
"S",
"O",
"N",
"D"
],
"am": "AM",
"days-standAlone-abbr": [
"dim.",
"lun.",
"mar.",
"mer.",
"jeu.",
"ven.",
"sam."
],
"dateFormat-short": "dd/MM/yy",
"dateFormat-full": "EEEE d MMMM yyyy",
"months-format-wide": [
"janvier",
"février",
"mars",
"avril",
"mai",
"juin",
"juillet",
"août",
"septembre",
"octobre",
"novembre",
"décembre"
],
"dateTimeAvailableFormats": [
"HH:mm",
"HH:mm:ss",
"H:mm",
"L",
"EEE d/M",
"LLL",
"E d MMM",
"EEE d MMMM",
"d MMMM",
"d MMM",
"dd MMM",
"d/MM",
"dd/MM",
"d/M",
"d",
"HH:mm",
"HH:mm:ss",
"mm:ss",
"mm:ss",
"yyyy",
"M/yyyy",
"EEE d/M/yyyy",
"MMM yyyy",
"EEE d MMM yyyy",
"MMMM yyyy",
"'T'Q yyyy",
"QQQ yyyy",
"MM/yy",
"MMM yy",
"EEE d MMM yy",
"d MMM yy",
"'T'Q yy",
"QQQQ yy",
"MMMM yyyy"
],
"quarters-format-wide": [
"1er trimestre",
"2e trimestre",
"3e trimestre",
"4e trimestre"
],
"days-format-wide": [
"dimanche",
"lundi",
"mardi",
"mercredi",
"jeudi",
"vendredi",
"samedi"
],
"eraNarrow": [
"av. J.-C.",
"ap. J.-C."
]
}) | {
"pile_set_name": "Github"
} |
/*
* svghelper.c - helper functions for outputting svg
*
* (C) Copyright 2009 Intel Corporation
*
* Authors:
* Arjan van de Ven <[email protected]>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; version 2
* of the License.
*/
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include "svghelper.h"
static u64 first_time, last_time;
static u64 turbo_frequency, max_freq;
#define SLOT_MULT 30.0
#define SLOT_HEIGHT 25.0
int svg_page_width = 1000;
#define MIN_TEXT_SIZE 0.01
static u64 total_height;
static FILE *svgfile;
static double cpu2slot(int cpu)
{
return 2 * cpu + 1;
}
static double cpu2y(int cpu)
{
return cpu2slot(cpu) * SLOT_MULT;
}
static double time2pixels(u64 __time)
{
double X;
X = 1.0 * svg_page_width * (__time - first_time) / (last_time - first_time);
return X;
}
/*
* Round text sizes so that the svg viewer only needs a discrete
* number of renderings of the font
*/
static double round_text_size(double size)
{
int loop = 100;
double target = 10.0;
if (size >= 10.0)
return size;
while (loop--) {
if (size >= target)
return target;
target = target / 2.0;
}
return size;
}
void open_svg(const char *filename, int cpus, int rows, u64 start, u64 end)
{
int new_width;
svgfile = fopen(filename, "w");
if (!svgfile) {
fprintf(stderr, "Cannot open %s for output\n", filename);
return;
}
first_time = start;
first_time = first_time / 100000000 * 100000000;
last_time = end;
/*
* if the recording is short, we default to a width of 1000, but
* for longer recordings we want at least 200 units of width per second
*/
new_width = (last_time - first_time) / 5000000;
if (new_width > svg_page_width)
svg_page_width = new_width;
total_height = (1 + rows + cpu2slot(cpus)) * SLOT_MULT;
fprintf(svgfile, "<?xml version=\"1.0\" standalone=\"no\"?> \n");
fprintf(svgfile, "<svg width=\"%i\" height=\"%" PRIu64 "\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n", svg_page_width, total_height);
fprintf(svgfile, "<defs>\n <style type=\"text/css\">\n <![CDATA[\n");
fprintf(svgfile, " rect { stroke-width: 1; }\n");
fprintf(svgfile, " rect.process { fill:rgb(180,180,180); fill-opacity:0.9; stroke-width:1; stroke:rgb( 0, 0, 0); } \n");
fprintf(svgfile, " rect.process2 { fill:rgb(180,180,180); fill-opacity:0.9; stroke-width:0; stroke:rgb( 0, 0, 0); } \n");
fprintf(svgfile, " rect.sample { fill:rgb( 0, 0,255); fill-opacity:0.8; stroke-width:0; stroke:rgb( 0, 0, 0); } \n");
fprintf(svgfile, " rect.blocked { fill:rgb(255, 0, 0); fill-opacity:0.5; stroke-width:0; stroke:rgb( 0, 0, 0); } \n");
fprintf(svgfile, " rect.waiting { fill:rgb(224,214, 0); fill-opacity:0.8; stroke-width:0; stroke:rgb( 0, 0, 0); } \n");
fprintf(svgfile, " rect.WAITING { fill:rgb(255,214, 48); fill-opacity:0.6; stroke-width:0; stroke:rgb( 0, 0, 0); } \n");
fprintf(svgfile, " rect.cpu { fill:rgb(192,192,192); fill-opacity:0.2; stroke-width:0.5; stroke:rgb(128,128,128); } \n");
fprintf(svgfile, " rect.pstate { fill:rgb(128,128,128); fill-opacity:0.8; stroke-width:0; } \n");
fprintf(svgfile, " rect.c1 { fill:rgb(255,214,214); fill-opacity:0.5; stroke-width:0; } \n");
fprintf(svgfile, " rect.c2 { fill:rgb(255,172,172); fill-opacity:0.5; stroke-width:0; } \n");
fprintf(svgfile, " rect.c3 { fill:rgb(255,130,130); fill-opacity:0.5; stroke-width:0; } \n");
fprintf(svgfile, " rect.c4 { fill:rgb(255, 88, 88); fill-opacity:0.5; stroke-width:0; } \n");
fprintf(svgfile, " rect.c5 { fill:rgb(255, 44, 44); fill-opacity:0.5; stroke-width:0; } \n");
fprintf(svgfile, " rect.c6 { fill:rgb(255, 0, 0); fill-opacity:0.5; stroke-width:0; } \n");
fprintf(svgfile, " line.pstate { stroke:rgb(255,255, 0); stroke-opacity:0.8; stroke-width:2; } \n");
fprintf(svgfile, " ]]>\n </style>\n</defs>\n");
}
void svg_box(int Yslot, u64 start, u64 end, const char *type)
{
if (!svgfile)
return;
fprintf(svgfile, "<rect x=\"%4.8f\" width=\"%4.8f\" y=\"%4.1f\" height=\"%4.1f\" class=\"%s\"/>\n",
time2pixels(start), time2pixels(end)-time2pixels(start), Yslot * SLOT_MULT, SLOT_HEIGHT, type);
}
void svg_sample(int Yslot, int cpu, u64 start, u64 end)
{
double text_size;
if (!svgfile)
return;
fprintf(svgfile, "<rect x=\"%4.8f\" width=\"%4.8f\" y=\"%4.1f\" height=\"%4.1f\" class=\"sample\"/>\n",
time2pixels(start), time2pixels(end)-time2pixels(start), Yslot * SLOT_MULT, SLOT_HEIGHT);
text_size = (time2pixels(end)-time2pixels(start));
if (cpu > 9)
text_size = text_size/2;
if (text_size > 1.25)
text_size = 1.25;
text_size = round_text_size(text_size);
if (text_size > MIN_TEXT_SIZE)
fprintf(svgfile, "<text x=\"%1.8f\" y=\"%1.8f\" font-size=\"%1.8fpt\">%i</text>\n",
time2pixels(start), Yslot * SLOT_MULT + SLOT_HEIGHT - 1, text_size, cpu + 1);
}
static char *time_to_string(u64 duration)
{
static char text[80];
text[0] = 0;
if (duration < 1000) /* less than 1 usec */
return text;
if (duration < 1000 * 1000) { /* less than 1 msec */
sprintf(text, "%4.1f us", duration / 1000.0);
return text;
}
sprintf(text, "%4.1f ms", duration / 1000.0 / 1000);
return text;
}
void svg_waiting(int Yslot, u64 start, u64 end)
{
char *text;
const char *style;
double font_size;
if (!svgfile)
return;
style = "waiting";
if (end-start > 10 * 1000000) /* 10 msec */
style = "WAITING";
text = time_to_string(end-start);
font_size = 1.0 * (time2pixels(end)-time2pixels(start));
if (font_size > 3)
font_size = 3;
font_size = round_text_size(font_size);
fprintf(svgfile, "<g transform=\"translate(%4.8f,%4.8f)\">\n", time2pixels(start), Yslot * SLOT_MULT);
fprintf(svgfile, "<rect x=\"0\" width=\"%4.8f\" y=\"0\" height=\"%4.1f\" class=\"%s\"/>\n",
time2pixels(end)-time2pixels(start), SLOT_HEIGHT, style);
if (font_size > MIN_TEXT_SIZE)
fprintf(svgfile, "<text transform=\"rotate(90)\" font-size=\"%1.8fpt\"> %s</text>\n",
font_size, text);
fprintf(svgfile, "</g>\n");
}
static char *cpu_model(void)
{
static char cpu_m[255];
char buf[256];
FILE *file;
cpu_m[0] = 0;
/* CPU type */
file = fopen("/proc/cpuinfo", "r");
if (file) {
while (fgets(buf, 255, file)) {
if (strstr(buf, "model name")) {
strncpy(cpu_m, &buf[13], 255);
break;
}
}
fclose(file);
}
/* CPU type */
file = fopen("/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies", "r");
if (file) {
while (fgets(buf, 255, file)) {
unsigned int freq;
freq = strtoull(buf, NULL, 10);
if (freq > max_freq)
max_freq = freq;
}
fclose(file);
}
return cpu_m;
}
void svg_cpu_box(int cpu, u64 __max_freq, u64 __turbo_freq)
{
char cpu_string[80];
if (!svgfile)
return;
max_freq = __max_freq;
turbo_frequency = __turbo_freq;
fprintf(svgfile, "<rect x=\"%4.8f\" width=\"%4.8f\" y=\"%4.1f\" height=\"%4.1f\" class=\"cpu\"/>\n",
time2pixels(first_time),
time2pixels(last_time)-time2pixels(first_time),
cpu2y(cpu), SLOT_MULT+SLOT_HEIGHT);
sprintf(cpu_string, "CPU %i", (int)cpu+1);
fprintf(svgfile, "<text x=\"%4.8f\" y=\"%4.8f\">%s</text>\n",
10+time2pixels(first_time), cpu2y(cpu) + SLOT_HEIGHT/2, cpu_string);
fprintf(svgfile, "<text transform=\"translate(%4.8f,%4.8f)\" font-size=\"1.25pt\">%s</text>\n",
10+time2pixels(first_time), cpu2y(cpu) + SLOT_MULT + SLOT_HEIGHT - 4, cpu_model());
}
void svg_process(int cpu, u64 start, u64 end, const char *type, const char *name)
{
double width;
if (!svgfile)
return;
fprintf(svgfile, "<g transform=\"translate(%4.8f,%4.8f)\">\n", time2pixels(start), cpu2y(cpu));
fprintf(svgfile, "<rect x=\"0\" width=\"%4.8f\" y=\"0\" height=\"%4.1f\" class=\"%s\"/>\n",
time2pixels(end)-time2pixels(start), SLOT_MULT+SLOT_HEIGHT, type);
width = time2pixels(end)-time2pixels(start);
if (width > 6)
width = 6;
width = round_text_size(width);
if (width > MIN_TEXT_SIZE)
fprintf(svgfile, "<text transform=\"rotate(90)\" font-size=\"%3.8fpt\">%s</text>\n",
width, name);
fprintf(svgfile, "</g>\n");
}
void svg_cstate(int cpu, u64 start, u64 end, int type)
{
double width;
char style[128];
if (!svgfile)
return;
if (type > 6)
type = 6;
sprintf(style, "c%i", type);
fprintf(svgfile, "<rect class=\"%s\" x=\"%4.8f\" width=\"%4.8f\" y=\"%4.1f\" height=\"%4.1f\"/>\n",
style,
time2pixels(start), time2pixels(end)-time2pixels(start),
cpu2y(cpu), SLOT_MULT+SLOT_HEIGHT);
width = (time2pixels(end)-time2pixels(start))/2.0;
if (width > 6)
width = 6;
width = round_text_size(width);
if (width > MIN_TEXT_SIZE)
fprintf(svgfile, "<text x=\"%4.8f\" y=\"%4.8f\" font-size=\"%3.8fpt\">C%i</text>\n",
time2pixels(start), cpu2y(cpu)+width, width, type);
}
static char *HzToHuman(unsigned long hz)
{
static char buffer[1024];
unsigned long long Hz;
memset(buffer, 0, 1024);
Hz = hz;
/* default: just put the Number in */
sprintf(buffer, "%9lli", Hz);
if (Hz > 1000)
sprintf(buffer, " %6lli Mhz", (Hz+500)/1000);
if (Hz > 1500000)
sprintf(buffer, " %6.2f Ghz", (Hz+5000.0)/1000000);
if (Hz == turbo_frequency)
sprintf(buffer, "Turbo");
return buffer;
}
void svg_pstate(int cpu, u64 start, u64 end, u64 freq)
{
double height = 0;
if (!svgfile)
return;
if (max_freq)
height = freq * 1.0 / max_freq * (SLOT_HEIGHT + SLOT_MULT);
height = 1 + cpu2y(cpu) + SLOT_MULT + SLOT_HEIGHT - height;
fprintf(svgfile, "<line x1=\"%4.8f\" x2=\"%4.8f\" y1=\"%4.1f\" y2=\"%4.1f\" class=\"pstate\"/>\n",
time2pixels(start), time2pixels(end), height, height);
fprintf(svgfile, "<text x=\"%4.8f\" y=\"%4.8f\" font-size=\"0.25pt\">%s</text>\n",
time2pixels(start), height+0.9, HzToHuman(freq));
}
void svg_partial_wakeline(u64 start, int row1, char *desc1, int row2, char *desc2)
{
double height;
if (!svgfile)
return;
if (row1 < row2) {
if (row1) {
fprintf(svgfile, "<line x1=\"%4.8f\" y1=\"%4.2f\" x2=\"%4.8f\" y2=\"%4.2f\" style=\"stroke:rgb(32,255,32);stroke-width:0.009\"/>\n",
time2pixels(start), row1 * SLOT_MULT + SLOT_HEIGHT, time2pixels(start), row1 * SLOT_MULT + SLOT_HEIGHT + SLOT_MULT/32);
if (desc2)
fprintf(svgfile, "<g transform=\"translate(%4.8f,%4.8f)\"><text transform=\"rotate(90)\" font-size=\"0.02pt\">%s ></text></g>\n",
time2pixels(start), row1 * SLOT_MULT + SLOT_HEIGHT + SLOT_HEIGHT/48, desc2);
}
if (row2) {
fprintf(svgfile, "<line x1=\"%4.8f\" y1=\"%4.2f\" x2=\"%4.8f\" y2=\"%4.2f\" style=\"stroke:rgb(32,255,32);stroke-width:0.009\"/>\n",
time2pixels(start), row2 * SLOT_MULT - SLOT_MULT/32, time2pixels(start), row2 * SLOT_MULT);
if (desc1)
fprintf(svgfile, "<g transform=\"translate(%4.8f,%4.8f)\"><text transform=\"rotate(90)\" font-size=\"0.02pt\">%s ></text></g>\n",
time2pixels(start), row2 * SLOT_MULT - SLOT_MULT/32, desc1);
}
} else {
if (row2) {
fprintf(svgfile, "<line x1=\"%4.8f\" y1=\"%4.2f\" x2=\"%4.8f\" y2=\"%4.2f\" style=\"stroke:rgb(32,255,32);stroke-width:0.009\"/>\n",
time2pixels(start), row2 * SLOT_MULT + SLOT_HEIGHT, time2pixels(start), row2 * SLOT_MULT + SLOT_HEIGHT + SLOT_MULT/32);
if (desc1)
fprintf(svgfile, "<g transform=\"translate(%4.8f,%4.8f)\"><text transform=\"rotate(90)\" font-size=\"0.02pt\">%s <</text></g>\n",
time2pixels(start), row2 * SLOT_MULT + SLOT_HEIGHT + SLOT_MULT/48, desc1);
}
if (row1) {
fprintf(svgfile, "<line x1=\"%4.8f\" y1=\"%4.2f\" x2=\"%4.8f\" y2=\"%4.2f\" style=\"stroke:rgb(32,255,32);stroke-width:0.009\"/>\n",
time2pixels(start), row1 * SLOT_MULT - SLOT_MULT/32, time2pixels(start), row1 * SLOT_MULT);
if (desc2)
fprintf(svgfile, "<g transform=\"translate(%4.8f,%4.8f)\"><text transform=\"rotate(90)\" font-size=\"0.02pt\">%s <</text></g>\n",
time2pixels(start), row1 * SLOT_MULT - SLOT_HEIGHT/32, desc2);
}
}
height = row1 * SLOT_MULT;
if (row2 > row1)
height += SLOT_HEIGHT;
if (row1)
fprintf(svgfile, "<circle cx=\"%4.8f\" cy=\"%4.2f\" r = \"0.01\" style=\"fill:rgb(32,255,32)\"/>\n",
time2pixels(start), height);
}
void svg_wakeline(u64 start, int row1, int row2)
{
double height;
if (!svgfile)
return;
if (row1 < row2)
fprintf(svgfile, "<line x1=\"%4.8f\" y1=\"%4.2f\" x2=\"%4.8f\" y2=\"%4.2f\" style=\"stroke:rgb(32,255,32);stroke-width:0.009\"/>\n",
time2pixels(start), row1 * SLOT_MULT + SLOT_HEIGHT, time2pixels(start), row2 * SLOT_MULT);
else
fprintf(svgfile, "<line x1=\"%4.8f\" y1=\"%4.2f\" x2=\"%4.8f\" y2=\"%4.2f\" style=\"stroke:rgb(32,255,32);stroke-width:0.009\"/>\n",
time2pixels(start), row2 * SLOT_MULT + SLOT_HEIGHT, time2pixels(start), row1 * SLOT_MULT);
height = row1 * SLOT_MULT;
if (row2 > row1)
height += SLOT_HEIGHT;
fprintf(svgfile, "<circle cx=\"%4.8f\" cy=\"%4.2f\" r = \"0.01\" style=\"fill:rgb(32,255,32)\"/>\n",
time2pixels(start), height);
}
void svg_interrupt(u64 start, int row)
{
if (!svgfile)
return;
fprintf(svgfile, "<circle cx=\"%4.8f\" cy=\"%4.2f\" r = \"0.01\" style=\"fill:rgb(255,128,128)\"/>\n",
time2pixels(start), row * SLOT_MULT);
fprintf(svgfile, "<circle cx=\"%4.8f\" cy=\"%4.2f\" r = \"0.01\" style=\"fill:rgb(255,128,128)\"/>\n",
time2pixels(start), row * SLOT_MULT + SLOT_HEIGHT);
}
void svg_text(int Yslot, u64 start, const char *text)
{
if (!svgfile)
return;
fprintf(svgfile, "<text x=\"%4.8f\" y=\"%4.8f\">%s</text>\n",
time2pixels(start), Yslot * SLOT_MULT+SLOT_HEIGHT/2, text);
}
static void svg_legenda_box(int X, const char *text, const char *style)
{
double boxsize;
boxsize = SLOT_HEIGHT / 2;
fprintf(svgfile, "<rect x=\"%i\" width=\"%4.8f\" y=\"0\" height=\"%4.1f\" class=\"%s\"/>\n",
X, boxsize, boxsize, style);
fprintf(svgfile, "<text transform=\"translate(%4.8f, %4.8f)\" font-size=\"%4.8fpt\">%s</text>\n",
X + boxsize + 5, boxsize, 0.8 * boxsize, text);
}
void svg_legenda(void)
{
if (!svgfile)
return;
svg_legenda_box(0, "Running", "sample");
svg_legenda_box(100, "Idle","c1");
svg_legenda_box(200, "Deeper Idle", "c3");
svg_legenda_box(350, "Deepest Idle", "c6");
svg_legenda_box(550, "Sleeping", "process2");
svg_legenda_box(650, "Waiting for cpu", "waiting");
svg_legenda_box(800, "Blocked on IO", "blocked");
}
void svg_time_grid(void)
{
u64 i;
if (!svgfile)
return;
i = first_time;
while (i < last_time) {
int color = 220;
double thickness = 0.075;
if ((i % 100000000) == 0) {
thickness = 0.5;
color = 192;
}
if ((i % 1000000000) == 0) {
thickness = 2.0;
color = 128;
}
fprintf(svgfile, "<line x1=\"%4.8f\" y1=\"%4.2f\" x2=\"%4.8f\" y2=\"%" PRIu64 "\" style=\"stroke:rgb(%i,%i,%i);stroke-width:%1.3f\"/>\n",
time2pixels(i), SLOT_MULT/2, time2pixels(i), total_height, color, color, color, thickness);
i += 10000000;
}
}
void svg_close(void)
{
if (svgfile) {
fprintf(svgfile, "</svg>\n");
fclose(svgfile);
svgfile = NULL;
}
}
| {
"pile_set_name": "Github"
} |
#region License
//
// MIT License
//
// CoiniumServ - Crypto Currency Mining Pool Server Software
// Copyright (C) 2013 - 2017, CoiniumServ Project
// Hüseyin Uslu, shalafiraistlin at gmail dot com
// https://github.com/bonesoul/CoiniumServ
//
// 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.
//
#endregion
using System;
using System.Collections.Generic;
using CoiniumServ.Daemon.Converters;
using Newtonsoft.Json;
namespace CoiniumServ.Daemon.Responses
{
public class Block
{
public string Hash { get; set; }
public Int32 Confirmations { get; set; }
public Int32 Size { get; set; }
public Int32 Height { get; set; }
public Int32 Version { get; set; }
/// <summary>
/// Every transaction has a hash associated with it. In a block, all of the transaction hashes in the block are themselves hashed (sometimes several times -- the exact process is complex), and the result is the Merkle root. In other words, the Merkle root is the hash of all the hashes of all the transactions in the block. The Merkle root is included in the block header. With this scheme, it is possible to securely verify that a transaction has been accepted by the network (and get the number of confirmations) by downloading just the tiny block headers and Merkle tree -- downloading the entire block chain is unnecessary.
/// </summary>
public string MerkleRoot { get; set; }
public List<string> Tx { get; set; }
[JsonConverter(typeof(TimeConverter))]
public Int32 Time { get; set; }
public UInt32 Nonce { get; set; }
public string Bits { get; set; }
public double Difficulty { get; set; }
public string NextBlockHash { get; set; }
}
}
| {
"pile_set_name": "Github"
} |
<?xml version='1.0' encoding='utf-8'?>
<section xmlns="https://code.dccouncil.us/schemas/dc-library" xmlns:codified="https://code.dccouncil.us/schemas/codified" xmlns:codify="https://code.dccouncil.us/schemas/codify" xmlns:xi="http://www.w3.org/2001/XInclude" containing-doc="D.C. Code">
<num>4-753.03</num>
<heading>Grace period for establishing residency.</heading>
<text>An individual or family seeking shelter during severe weather conditions may be afforded a 3-day grace period to establish District residency.</text>
<annotations>
<annotation doc="D.C. Law 16-35" type="History" path="§8a">Oct. 22, 2005, D.C. Law 16-35, § 8a</annotation>
<annotation doc="D.C. Law 18-367" type="History">as added Apr. 8, 2011, D.C. Law 18-367, § 2(d), 58 DCR 987</annotation>
<annotation type="Emergency Legislation">For temporary (90 day) addition of section, see § 5102 of Fiscal Year 2013 Budget Support Congressional Review Emergency Act of 2012 (D.C. Act 19-413, July 25, 2012, 59 DCR 9290).</annotation>
<annotation type="Emergency Legislation">For temporary (90 day) addition of section, see § 5102 of Fiscal Year 2013 Budget Support Emergency Act of 2012 (D.C. Act 19-383, June 19, 2012, 59 DCR 7764).</annotation>
</annotations>
</section>
| {
"pile_set_name": "Github"
} |
body .layer-ext-lists .layui-layer-title{
font-family: Microsoft YaHei;
font-size: 24px;
height: 80px;
}
| {
"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
struct S<T where g: d
if true {
class b: P
protocol P {
{
}
struct A : S
| {
"pile_set_name": "Github"
} |
// moment.js language configuration
// language : malayalam (ml)
// author : Floyd Pink : https://github.com/floydpink
(function (factory) {
if (typeof define === 'function' && define.amd) {
define(['moment'], factory); // AMD
} else if (typeof exports === 'object') {
module.exports = factory(require('../moment')); // Node
} else {
factory(window.moment); // Browser global
}
}(function (moment) {
return moment.lang('ml', {
months : 'ജനുവരി_ഫെബ്രുവരി_മാർച്ച്_ഏപ്രിൽ_മേയ്_ജൂൺ_ജൂലൈ_ഓഗസ്റ്റ്_സെപ്റ്റംബർ_ഒക്ടോബർ_നവംബർ_ഡിസംബർ'.split("_"),
monthsShort : 'ജനു._ഫെബ്രു._മാർ._ഏപ്രി._മേയ്_ജൂൺ_ജൂലൈ._ഓഗ._സെപ്റ്റ._ഒക്ടോ._നവം._ഡിസം.'.split("_"),
weekdays : 'ഞായറാഴ്ച_തിങ്കളാഴ്ച_ചൊവ്വാഴ്ച_ബുധനാഴ്ച_വ്യാഴാഴ്ച_വെള്ളിയാഴ്ച_ശനിയാഴ്ച'.split("_"),
weekdaysShort : 'ഞായർ_തിങ്കൾ_ചൊവ്വ_ബുധൻ_വ്യാഴം_വെള്ളി_ശനി'.split("_"),
weekdaysMin : 'ഞാ_തി_ചൊ_ബു_വ്യാ_വെ_ശ'.split("_"),
longDateFormat : {
LT : "A h:mm -നു",
L : "DD/MM/YYYY",
LL : "D MMMM YYYY",
LLL : "D MMMM YYYY, LT",
LLLL : "dddd, D MMMM YYYY, LT"
},
calendar : {
sameDay : '[ഇന്ന്] LT',
nextDay : '[നാളെ] LT',
nextWeek : 'dddd, LT',
lastDay : '[ഇന്നലെ] LT',
lastWeek : '[കഴിഞ്ഞ] dddd, LT',
sameElse : 'L'
},
relativeTime : {
future : "%s കഴിഞ്ഞ്",
past : "%s മുൻപ്",
s : "അൽപ നിമിഷങ്ങൾ",
m : "ഒരു മിനിറ്റ്",
mm : "%d മിനിറ്റ്",
h : "ഒരു മണിക്കൂർ",
hh : "%d മണിക്കൂർ",
d : "ഒരു ദിവസം",
dd : "%d ദിവസം",
M : "ഒരു മാസം",
MM : "%d മാസം",
y : "ഒരു വർഷം",
yy : "%d വർഷം"
},
meridiem : function (hour, minute, isLower) {
if (hour < 4) {
return "രാത്രി";
} else if (hour < 12) {
return "രാവിലെ";
} else if (hour < 17) {
return "ഉച്ച കഴിഞ്ഞ്";
} else if (hour < 20) {
return "വൈകുന്നേരം";
} else {
return "രാത്രി";
}
}
});
}));
| {
"pile_set_name": "Github"
} |
/* Copyright Airship and Contributors */
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/**
* A UAProximityRegion defines a proximity region with an identifier, major and minor.
*/
@interface UAProximityRegion : NSObject
///---------------------------------------------------------------------------------------
/// @name Proximity Region Properties
///---------------------------------------------------------------------------------------
/**
* The proximity region's latitude in degress.
*/
@property (nonatomic, strong, nullable) NSNumber *latitude;
/**
* The proximity region's longitude in degrees.
*/
@property (nonatomic, strong, nullable) NSNumber *longitude;
/**
* The proximity region's received signal strength indication in dBm.
*/
@property (nonatomic, strong, nullable) NSNumber *RSSI;
///---------------------------------------------------------------------------------------
/// @name Proximity Region Factory
///---------------------------------------------------------------------------------------
/**
* Factory method for creating a proximity region.
*
* @param proximityID The ID of the proximity region.
* @param major The major.
* @param minor The minor.
*
* @return Proximity region object or `nil` if error occurs.
*/
+ (nullable instancetype)proximityRegionWithID:(NSString *)proximityID
major:(NSNumber *)major
minor:(NSNumber *)minor;
@end
NS_ASSUME_NONNULL_END
| {
"pile_set_name": "Github"
} |
#
# Copyright 2020 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# 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 apps::vtom::restapi::mode::jobstatus;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use centreon::plugins::misc;
use centreon::plugins::statefile;
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
sub custom_status_output {
my ($self, %options) = @_;
my $msg = 'status : ' . $self->{result_values}->{status};
if ($self->{result_values}->{information} ne '') {
$msg .= ' [information: ' . $self->{result_values}->{information} . ']';
}
return $msg;
}
sub custom_status_calc {
my ($self, %options) = @_;
$self->{result_values}->{status} = $options{new_datas}->{$self->{instance} . '_status'};
$self->{result_values}->{name} = $options{new_datas}->{$self->{instance} . '_name'};
$self->{result_values}->{environment} = $options{new_datas}->{$self->{instance} . '_environment'};
$self->{result_values}->{application} = $options{new_datas}->{$self->{instance} . '_application'};
$self->{result_values}->{exit_code} = $options{new_datas}->{$self->{instance} . '_exit_code'};
$self->{result_values}->{family} = $options{new_datas}->{$self->{instance} . '_family'};
$self->{result_values}->{information} = $options{new_datas}->{$self->{instance} . '_information'};
return 0;
}
sub custom_long_output {
my ($self, %options) = @_;
my $msg = 'started since : ' . centreon::plugins::misc::change_seconds(value => $self->{result_values}->{elapsed});
return $msg;
}
sub custom_long_calc {
my ($self, %options) = @_;
$self->{result_values}->{status} = $options{new_datas}->{$self->{instance} . '_status'};
$self->{result_values}->{name} = $options{new_datas}->{$self->{instance} . '_name'};
$self->{result_values}->{environment} = $options{new_datas}->{$self->{instance} . '_environment'};
$self->{result_values}->{application} = $options{new_datas}->{$self->{instance} . '_application'};
$self->{result_values}->{elapsed} = $options{new_datas}->{$self->{instance} . '_elapsed'};
$self->{result_values}->{family} = $options{new_datas}->{$self->{instance} . '_family'};
return -11 if ($self->{result_values}->{status} !~ /Running/i);
return 0;
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'global', type => 0, cb_prefix_output => 'prefix_global_output', },
{ name => 'job', type => 1, cb_prefix_output => 'prefix_job_output', message_multiple => 'All jobs are ok', , skipped_code => { -11 => 1 } },
];
$self->{maps_counters}->{job} = [
{ label => 'status', threshold => 0, set => {
key_values => [ { name => 'status' }, { name => 'name' }, { name => 'environment' },
{ name => 'application' }, { name => 'exit_code' }, { name => 'family' }, { name => 'information' } ],
closure_custom_calc => $self->can('custom_status_calc'),
closure_custom_output => $self->can('custom_status_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => \&catalog_status_threshold,
}
},
{ label => 'long', threshold => 0, set => {
key_values => [ { name => 'status' }, { name => 'name' }, { name => 'environment' },
{ name => 'application' }, { name => 'elapsed' }, { name => 'family' } ],
closure_custom_calc => $self->can('custom_long_calc'),
closure_custom_output => $self->can('custom_long_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => \&catalog_status_threshold,
}
},
];
$self->{maps_counters}->{global} = [
{ label => 'total-error', set => {
key_values => [ { name => 'error' }, { name => 'total' } ],
output_template => 'Error : %s',
perfdatas => [
{ label => 'total_error', value => 'error', template => '%s',
min => 0, max => 'total' },
],
}
},
{ label => 'total-running', set => {
key_values => [ { name => 'running' }, { name => 'total' } ],
output_template => 'Running : %s',
perfdatas => [
{ label => 'total_running', value => 'running', template => '%s',
min => 0, max => 'total' },
],
}
},
{ label => 'total-unplanned', set => {
key_values => [ { name => 'unplanned' }, { name => 'total' } ],
output_template => 'Unplanned : %s',
perfdatas => [
{ label => 'total_unplanned', value => 'unplanned', template => '%s',
min => 0, max => 'total' },
],
}
},
{ label => 'total-finished', set => {
key_values => [ { name => 'finished' }, { name => 'total' } ],
output_template => 'Finished : %s',
perfdatas => [
{ label => 'total_finished', value => 'finished', template => '%s',
min => 0, max => 'total' },
],
}
},
{ label => 'total-coming', set => {
key_values => [ { name => 'coming' }, { name => 'total' } ],
output_template => 'Coming : %s',
perfdatas => [
{ label => 'total_coming', value => 'coming', template => '%s',
min => 0, max => 'total' },
],
}
},
];
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$options{options}->add_options(arguments =>
{
"filter-application:s" => { name => 'filter_application' },
"filter-environment:s" => { name => 'filter_environment' },
"filter-name:s" => { name => 'filter_name' },
"filter-family:s" => { name => 'filter_family' },
"warning-status:s" => { name => 'warning_status' },
"critical-status:s" => { name => 'critical_status', default => '%{status} =~ /Error/i' },
"warning-long:s" => { name => 'warning_long' },
"critical-long:s" => { name => 'critical_long' },
"reload-cache-time:s" => { name => 'reload_cache_time', default => 180 },
});
$self->{statefile_cache_app} = centreon::plugins::statefile->new(%options);
$self->{statefile_cache_env} = centreon::plugins::statefile->new(%options);
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
$self->{statefile_cache_app}->check_options(%options);
$self->{statefile_cache_env}->check_options(%options);
$self->change_macros(macros => ['warning_status', 'critical_status', 'warning_long', 'critical_long']);
}
sub prefix_global_output {
my ($self, %options) = @_;
return "Total Job ";
}
sub prefix_job_output {
my ($self, %options) = @_;
return "job '" . $options{instance_value}->{environment} . '/' . $options{instance_value}->{application} . '/' . $options{instance_value}->{name} . "' ";
}
my %mapping_job_status = (
R => 'Running',
U => 'Unplanned',
F => 'Finished',
W => 'Coming',
E => 'Error',
);
sub manage_selection {
my ($self, %options) = @_;
my $environments = $options{custom}->cache_environment(statefile => $self->{statefile_cache_env},
reload_cache_time => $self->{option_results}->{reload_cache_time});
my $applications = $options{custom}->cache_application(statefile => $self->{statefile_cache_app},
reload_cache_time => $self->{option_results}->{reload_cache_time});
$self->{job} = {};
$self->{global} = { total => 0, running => 0, unplanned => 0, finished => 0, coming => 0, error => 0 };
my $path = '/api/job/getAll';
if (defined($self->{option_results}->{filter_application}) && $self->{option_results}->{filter_application} ne '') {
$path = '/api/job/list?applicationName=' . $self->{option_results}->{filter_application};
}
if (defined($self->{option_results}->{filter_environment}) && $self->{option_results}->{filter_environment} ne '') {
$path = '/api/job/list?environmentName=' . $self->{option_results}->{filter_environment};
}
my $result = $options{custom}->get(path => $path);
my $entries = defined($result->{result}) && ref($result->{result}) eq 'ARRAY' ?
$result->{result} : (defined($result->{result}->{rows}) ?
$result->{result}->{rows} : []);
my $current_time = time();
foreach my $entry (@{$entries}) {
my $application_sid = defined($entry->{applicationSId}) ? $entry->{applicationSId} :
(defined($entry->{appSId}) ? $entry->{appSId} : undef);
my $application = defined($application_sid) && defined($applications->{$application_sid}) ?
$applications->{$application_sid}->{name} : 'unknown';
my $environment = defined($application_sid) && defined($applications->{$application_sid}) && defined($environments->{$applications->{$application_sid}->{envSId}}) ?
$environments->{$applications->{$application_sid}->{envSId}} : 'unknown';
my $display = $environment . '/' . $application . '/' . $entry->{name};
if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
$display !~ /$self->{option_results}->{filter_name}/) {
$self->{output}->output_add(long_msg => "skipping '" . $display . "': no matching filter.", debug => 1);
next;
}
my $family = defined($entry->{family}) ? $entry->{family} : '-';
if (defined($self->{option_results}->{filter_family}) && $self->{option_results}->{filter_family} ne '' &&
$family !~ /$self->{option_results}->{filter_family}/) {
$self->{output}->output_add(long_msg => "skipping '" . $family . "': no matching filter.", debug => 1);
next;
}
my $information = defined($entry->{information}) ? $entry->{information} : '';
$information =~ s/\|/-/msg;
$self->{global}->{total} += 1;
$self->{global}->{lc($mapping_job_status{$entry->{status}})} += 1;
$self->{job}->{$entry->{id}} = {
name => $entry->{name},
status => $mapping_job_status{$entry->{status}}, information => $information,
exit_code => defined($entry->{retcode}) ? $entry->{retcode} : '-',
family => $family, application => $application, environment => $environment,
elapsed => defined($entry->{timeBegin}) ? ( $current_time - $entry->{timeBegin}) : undef,
};
}
if (scalar(keys %{$self->{job}}) <= 0) {
$self->{output}->add_option_msg(short_msg => "No job found.");
$self->{output}->option_exit();
}
}
1;
__END__
=head1 MODE
Check job status.
=over 8
=item B<--filter-environment>
Filter environment name (cannot be a regexp).
=item B<--filter-application>
Filter application name (cannot be a regexp).
=item B<--filter-name>
Filter name (can be a regexp).
=item B<--filter-family>
Filter family (can be a regexp).
=item B<--filter-counters>
Only display some counters (regexp can be used).
Example: --filter-counters='^total-error$'
=item B<--warning-*>
Threshold warning.
Can be: 'total-error', 'total-running', 'total-unplanned',
'total-finished', 'total-coming'.
=item B<--critical-*>
Threshold critical.
Can be: 'total-error', 'total-running', 'total-unplanned',
'total-finished', 'total-coming'.
=item B<--warning-status>
Set warning threshold for status (Default: -)
Can used special variables like: %{name}, %{status},
%{exit_code}, %{family}, %{information}, %{environment}, %{application}
=item B<--critical-status>
Set critical threshold for status (Default: '%{exit_code} =~ /Error/i').
Can used special variables like: %{name}, %{status},
%{exit_code}, %{family}, %{information}, %{environment}, %{application}
=item B<--warning-long>
Set warning threshold for long jobs (Default: none)
Can used special variables like: %{name}, %{status}, %{elapsed},
%{family}, %{environment}, %{application}
=item B<--critical-long>
Set critical threshold for long jobs (Default: none).
Can used special variables like: %{name}, %{status}, %{elapsed},
%{family}, %{environment}, %{application}
=item B<--reload-cache-time>
Time in seconds before reloading cache file (default: 180).
=back
=cut
| {
"pile_set_name": "Github"
} |
//
// insta_gridTests.swift
// insta-gridTests
//
// Created by Astemir Eleev on 18/04/2018.
// Copyright © 2018 Astemir Eleev. All rights reserved.
//
import XCTest
@testable import insta_grid
class insta_gridTests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}
}
| {
"pile_set_name": "Github"
} |
{
"1.28.0": {
"data": "February 2015",
"notes": []
}
} | {
"pile_set_name": "Github"
} |
#ifndef PQCLEAN_NTRULPR653_CLEAN_CRYPTO_VERIFY_1025_H
#define PQCLEAN_NTRULPR653_CLEAN_CRYPTO_VERIFY_1025_H
#include <stdint.h>
#define PQCLEAN_NTRULPR653_CLEAN_crypto_verify_1025_BYTES 1025
int PQCLEAN_NTRULPR653_CLEAN_crypto_verify_1025(const unsigned char *x, const unsigned char *y);
#endif
| {
"pile_set_name": "Github"
} |
/*
* Copyright (C) Narf Industries <[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.
*/
#ifndef CHAR_H
#define CHAR_H 1
/**
* Determine if a char is non-printable (not letter, digit, symbol)
*
* @param ch Char to test
* @return TRUE if non-printable, else FALSE
*/
unsigned int cgc_is_non_printable(unsigned char ch);
/**
* Determine if a char is printable (letter, digit, symbol)
*
* @param ch Char to test
* @return TRUE if printable, else FALSE
*/
unsigned int cgc_is_printable(unsigned char ch);
/**
* Determine if a char is letter
*
* @param ch Char to test
* @return TRUE if letter, else FALSE
*/
unsigned int cgc_is_letter(unsigned char ch);
/**
* Determine if a char is digit
*
* @param ch Char to test
* @return TRUE if digit, else FALSE
*/
unsigned int cgc_is_digit(unsigned char ch);
/**
* Determine if a char is symbol
*
* @param ch Char to test
* @return TRUE if symbol, else FALSE
*/
unsigned int cgc_is_symbol(unsigned char ch);
/**
* Determine if a char is upper case letter
*
* @param ch Char to test
* @return TRUE if upper, else FALSE
*/
unsigned int cgc_is_upper(unsigned char ch);
/**
* Determine if a char is lower case letter
*
* @param ch Char to test
* @return TRUE if lower, else FALSE
*/
unsigned int cgc_is_lower(unsigned char ch);
/**
* Determine if a char is white-space token
*
* @param ch Char to test
* @return TRUE if white-space, else FALSE
*/
unsigned int cgc_is_white_space(unsigned char ch);
#endif | {
"pile_set_name": "Github"
} |
<html><head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="Start" href="index.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Index of module types" rel=Appendix href="index_module_types.html">
<link title="Arg_helper" rel="Chapter" href="Arg_helper.html">
<link title="Ast_helper" rel="Chapter" href="Ast_helper.html">
<link title="Ast_invariants" rel="Chapter" href="Ast_invariants.html">
<link title="Ast_iterator" rel="Chapter" href="Ast_iterator.html">
<link title="Ast_mapper" rel="Chapter" href="Ast_mapper.html">
<link title="Asttypes" rel="Chapter" href="Asttypes.html">
<link title="Attr_helper" rel="Chapter" href="Attr_helper.html">
<link title="Build_path_prefix_map" rel="Chapter" href="Build_path_prefix_map.html">
<link title="Builtin_attributes" rel="Chapter" href="Builtin_attributes.html">
<link title="CamlinternalMenhirLib" rel="Chapter" href="CamlinternalMenhirLib.html">
<link title="Ccomp" rel="Chapter" href="Ccomp.html">
<link title="Clflags" rel="Chapter" href="Clflags.html">
<link title="Compiler_libs" rel="Chapter" href="Compiler_libs.html">
<link title="Config" rel="Chapter" href="Config.html">
<link title="Consistbl" rel="Chapter" href="Consistbl.html">
<link title="Depend" rel="Chapter" href="Depend.html">
<link title="Docstrings" rel="Chapter" href="Docstrings.html">
<link title="Domainstate" rel="Chapter" href="Domainstate.html">
<link title="Identifiable" rel="Chapter" href="Identifiable.html">
<link title="Int_replace_polymorphic_compare" rel="Chapter" href="Int_replace_polymorphic_compare.html">
<link title="Lexer" rel="Chapter" href="Lexer.html">
<link title="Load_path" rel="Chapter" href="Load_path.html">
<link title="Location" rel="Chapter" href="Location.html">
<link title="Longident" rel="Chapter" href="Longident.html">
<link title="Misc" rel="Chapter" href="Misc.html">
<link title="Numbers" rel="Chapter" href="Numbers.html">
<link title="Parse" rel="Chapter" href="Parse.html">
<link title="Parser" rel="Chapter" href="Parser.html">
<link title="Parsetree" rel="Chapter" href="Parsetree.html">
<link title="Pparse" rel="Chapter" href="Pparse.html">
<link title="Pprintast" rel="Chapter" href="Pprintast.html">
<link title="Printast" rel="Chapter" href="Printast.html">
<link title="Profile" rel="Chapter" href="Profile.html">
<link title="Strongly_connected_components" rel="Chapter" href="Strongly_connected_components.html">
<link title="Syntaxerr" rel="Chapter" href="Syntaxerr.html">
<link title="Targetint" rel="Chapter" href="Targetint.html">
<link title="Terminfo" rel="Chapter" href="Terminfo.html">
<link title="Warnings" rel="Chapter" href="Warnings.html"><title>Strongly_connected_components</title>
</head>
<body>
<code class="code"><span class="keyword">sig</span><br>
<span class="keyword">module</span> <span class="keyword">type</span> <span class="constructor">S</span> =<br>
<span class="keyword">sig</span><br>
<span class="keyword">module</span> <span class="constructor">Id</span> : <span class="constructor">Identifiable</span>.<span class="constructor">S</span><br>
<span class="keyword">type</span> directed_graph = <span class="constructor">Id</span>.<span class="constructor">Set</span>.t <span class="constructor">Id</span>.<span class="constructor">Map</span>.t<br>
<span class="keyword">type</span> component = <span class="constructor">Has_loop</span> <span class="keyword">of</span> <span class="constructor">Id</span>.t list <span class="keywordsign">|</span> <span class="constructor">No_loop</span> <span class="keyword">of</span> <span class="constructor">Id</span>.t<br>
<span class="keyword">val</span> connected_components_sorted_from_roots_to_leaf :<br>
<span class="constructor">Strongly_connected_components</span>.<span class="constructor">S</span>.directed_graph <span class="keywordsign">-></span><br>
<span class="constructor">Strongly_connected_components</span>.<span class="constructor">S</span>.component array<br>
<span class="keyword">val</span> component_graph :<br>
<span class="constructor">Strongly_connected_components</span>.<span class="constructor">S</span>.directed_graph <span class="keywordsign">-></span><br>
(<span class="constructor">Strongly_connected_components</span>.<span class="constructor">S</span>.component * int list) array<br>
<span class="keyword">end</span><br>
<span class="keyword">module</span> <span class="constructor">Make</span> :<br>
<span class="keyword">functor</span> (<span class="constructor">Id</span> : <span class="constructor">Identifiable</span>.<span class="constructor">S</span>) <span class="keywordsign">-></span><br>
<span class="keyword">sig</span><br>
<span class="keyword">type</span> directed_graph = <span class="constructor">Id</span>.<span class="constructor">Set</span>.t <span class="constructor">Id</span>.<span class="constructor">Map</span>.t<br>
<span class="keyword">type</span> component = <span class="constructor">Has_loop</span> <span class="keyword">of</span> <span class="constructor">Id</span>.t list <span class="keywordsign">|</span> <span class="constructor">No_loop</span> <span class="keyword">of</span> <span class="constructor">Id</span>.t<br>
<span class="keyword">val</span> connected_components_sorted_from_roots_to_leaf :<br>
directed_graph <span class="keywordsign">-></span> component array<br>
<span class="keyword">val</span> component_graph : directed_graph <span class="keywordsign">-></span> (component * int list) array<br>
<span class="keyword">end</span><br>
<span class="keyword">end</span></code></body></html>
| {
"pile_set_name": "Github"
} |
13
0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 1 1
0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 1 0 0 0 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 0 0 0 0
0 0 0 0 1 0 0 0 1 0 0 0 0
0 1 0 0 0 0 1 1 0 0 0 0 1
0 0 0 0 0 0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 0 1 0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 1 1 0 0 0
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2014, Peter Thorson. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the WebSocket++ Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL PETER THORSON BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef WEBSOCKETPP_MESSAGE_BUFFER_ALLOC_HPP
#define WEBSOCKETPP_MESSAGE_BUFFER_ALLOC_HPP
#include <websocketpp/common/memory.hpp>
#include <websocketpp/frame.hpp>
namespace websocketpp {
namespace message_buffer {
namespace alloc {
/// A connection message manager that allocates a new message for each
/// request.
template <typename message>
class con_msg_manager
: public lib::enable_shared_from_this<con_msg_manager<message> >
{
public:
typedef con_msg_manager<message> type;
typedef lib::shared_ptr<con_msg_manager> ptr;
typedef lib::weak_ptr<con_msg_manager> weak_ptr;
typedef typename message::ptr message_ptr;
/// Get an empty message buffer
/**
* @return A shared pointer to an empty new message
*/
message_ptr get_message() {
return message_ptr(lib::make_shared<message>(type::shared_from_this()));
}
/// Get a message buffer with specified size and opcode
/**
* @param op The opcode to use
* @param size Minimum size in bytes to request for the message payload.
*
* @return A shared pointer to a new message with specified size.
*/
message_ptr get_message(frame::opcode::value op,size_t size) {
return message_ptr(lib::make_shared<message>(type::shared_from_this(),op,size));
}
/// Recycle a message
/**
* This method shouldn't be called. If it is, return false to indicate an
* error. The rest of the method recycle chain should notice this and free
* the memory.
*
* @param msg The message to be recycled.
*
* @return true if the message was successfully recycled, false otherwse.
*/
bool recycle(message *) {
return false;
}
};
/// An endpoint message manager that allocates a new manager for each
/// connection.
template <typename con_msg_manager>
class endpoint_msg_manager {
public:
typedef typename con_msg_manager::ptr con_msg_man_ptr;
/// Get a pointer to a connection message manager
/**
* @return A pointer to the requested connection message manager.
*/
con_msg_man_ptr get_manager() const {
return con_msg_man_ptr(lib::make_shared<con_msg_manager>());
}
};
} // namespace alloc
} // namespace message_buffer
} // namespace websocketpp
#endif // WEBSOCKETPP_MESSAGE_BUFFER_ALLOC_HPP
| {
"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>Ansi 0 Color</key>
<dict>
<key>Color Space</key>
<string>sRGB</string>
<key>Blue Component</key>
<real>0.19215686274509805</real>
<key>Green Component</key>
<real>0.1607843137254902</real>
<key>Red Component</key>
<real>0.19607843137254902</real>
</dict>
<key>Ansi 1 Color</key>
<dict>
<key>Color Space</key>
<string>sRGB</string>
<key>Blue Component</key>
<real>0.2980392156862745</real>
<key>Green Component</key>
<real>0.27450980392156865</real>
<key>Red Component</key>
<real>0.8666666666666667</real>
</dict>
<key>Ansi 10 Color</key>
<dict>
<key>Color Space</key>
<string>sRGB</string>
<key>Blue Component</key>
<real>0.24313725490196078</real>
<key>Green Component</key>
<real>0.7568627450980392</real>
<key>Red Component</key>
<real>0.5607843137254902</real>
</dict>
<key>Ansi 11 Color</key>
<dict>
<key>Color Space</key>
<string>sRGB</string>
<key>Blue Component</key>
<real>0.34901960784313724</real>
<key>Green Component</key>
<real>0.8</real>
<key>Red Component</key>
<real>0.9921568627450981</real>
</dict>
<key>Ansi 12 Color</key>
<dict>
<key>Color Space</key>
<string>sRGB</string>
<key>Blue Component</key>
<real>0.7490196078431373</real>
<key>Green Component</key>
<real>0.5647058823529412</real>
<key>Red Component</key>
<real>0.07058823529411765</real>
</dict>
<key>Ansi 13 Color</key>
<dict>
<key>Color Space</key>
<string>sRGB</string>
<key>Blue Component</key>
<real>0.48627450980392156</real>
<key>Green Component</key>
<real>0.3686274509803922</real>
<key>Red Component</key>
<real>0.7843137254901961</real>
</dict>
<key>Ansi 14 Color</key>
<dict>
<key>Color Space</key>
<string>sRGB</string>
<key>Blue Component</key>
<real>0.5764705882352941</real>
<key>Green Component</key>
<real>0.6078431372549019</real>
<key>Red Component</key>
<real>0.0784313725490196</real>
</dict>
<key>Ansi 15 Color</key>
<dict>
<key>Color Space</key>
<string>sRGB</string>
<key>Blue Component</key>
<real>1.0</real>
<key>Green Component</key>
<real>1.0</real>
<key>Red Component</key>
<real>1.0</real>
</dict>
<key>Ansi 2 Color</key>
<dict>
<key>Color Space</key>
<string>sRGB</string>
<key>Blue Component</key>
<real>0.24313725490196078</real>
<key>Green Component</key>
<real>0.7568627450980392</real>
<key>Red Component</key>
<real>0.5607843137254902</real>
</dict>
<key>Ansi 3 Color</key>
<dict>
<key>Color Space</key>
<string>sRGB</string>
<key>Blue Component</key>
<real>0.34901960784313724</real>
<key>Green Component</key>
<real>0.8</real>
<key>Red Component</key>
<real>0.9921568627450981</real>
</dict>
<key>Ansi 4 Color</key>
<dict>
<key>Color Space</key>
<string>sRGB</string>
<key>Blue Component</key>
<real>0.7490196078431373</real>
<key>Green Component</key>
<real>0.5647058823529412</real>
<key>Red Component</key>
<real>0.07058823529411765</real>
</dict>
<key>Ansi 5 Color</key>
<dict>
<key>Color Space</key>
<string>sRGB</string>
<key>Blue Component</key>
<real>0.48627450980392156</real>
<key>Green Component</key>
<real>0.3686274509803922</real>
<key>Red Component</key>
<real>0.7843137254901961</real>
</dict>
<key>Ansi 6 Color</key>
<dict>
<key>Color Space</key>
<string>sRGB</string>
<key>Blue Component</key>
<real>0.5764705882352941</real>
<key>Green Component</key>
<real>0.6078431372549019</real>
<key>Red Component</key>
<real>0.0784313725490196</real>
</dict>
<key>Ansi 7 Color</key>
<dict>
<key>Color Space</key>
<string>sRGB</string>
<key>Blue Component</key>
<real>0.7215686274509804</real>
<key>Green Component</key>
<real>0.7098039215686275</real>
<key>Red Component</key>
<real>0.7254901960784313</real>
</dict>
<key>Ansi 8 Color</key>
<dict>
<key>Color Space</key>
<string>sRGB</string>
<key>Blue Component</key>
<real>0.4745098039215686</real>
<key>Green Component</key>
<real>0.45098039215686275</real>
<key>Red Component</key>
<real>0.4745098039215686</real>
</dict>
<key>Ansi 9 Color</key>
<dict>
<key>Color Space</key>
<string>sRGB</string>
<key>Blue Component</key>
<real>0.2980392156862745</real>
<key>Green Component</key>
<real>0.27450980392156865</real>
<key>Red Component</key>
<real>0.8666666666666667</real>
</dict>
<key>Background Color</key>
<dict>
<key>Color Space</key>
<string>sRGB</string>
<key>Blue Component</key>
<real>1.0</real>
<key>Green Component</key>
<real>1.0</real>
<key>Red Component</key>
<real>1.0</real>
</dict>
<key>Bold Color</key>
<dict>
<key>Color Space</key>
<string>sRGB</string>
<key>Blue Component</key>
<real>0.3568627450980392</real>
<key>Green Component</key>
<real>0.32941176470588235</real>
<key>Red Component</key>
<real>0.3607843137254902</real>
</dict>
<key>Cursor Color</key>
<dict>
<key>Color Space</key>
<string>sRGB</string>
<key>Blue Component</key>
<real>0.3568627450980392</real>
<key>Green Component</key>
<real>0.32941176470588235</real>
<key>Red Component</key>
<real>0.3607843137254902</real>
</dict>
<key>Cursor Text Color</key>
<dict>
<key>Color Space</key>
<string>sRGB</string>
<key>Blue Component</key>
<real>1.0</real>
<key>Green Component</key>
<real>1.0</real>
<key>Red Component</key>
<real>1.0</real>
</dict>
<key>Foreground Color</key>
<dict>
<key>Color Space</key>
<string>sRGB</string>
<key>Blue Component</key>
<real>0.3568627450980392</real>
<key>Green Component</key>
<real>0.32941176470588235</real>
<key>Red Component</key>
<real>0.3607843137254902</real>
</dict>
<key>Selected Text Color</key>
<dict>
<key>Color Space</key>
<string>sRGB</string>
<key>Blue Component</key>
<real>0.3568627450980392</real>
<key>Green Component</key>
<real>0.32941176470588235</real>
<key>Red Component</key>
<real>0.3607843137254902</real>
</dict>
<key>Selection Color</key>
<dict>
<key>Color Space</key>
<string>sRGB</string>
<key>Blue Component</key>
<real>0.7215686274509804</real>
<key>Green Component</key>
<real>0.7098039215686275</real>
<key>Red Component</key>
<real>0.7254901960784313</real>
</dict>
</dict>
</plist>
| {
"pile_set_name": "Github"
} |
/**
* @file read_config_file.c
*/
/* Copyright (C) 2017-2020 by Arjan van Vught mailto:[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.
*/
#include <stdio.h>
#include <stdbool.h>
#include <stddef.h>
#include <assert.h>
#include <c/read_config_file.h>
bool read_config_file(const char *file_name, funcptr pfi) {
char buffer[128];
unsigned i;
FILE *fp;
assert(file_name != NULL);
assert(pfi != NULL);
fp = fopen(file_name, "r");
if (fp != NULL) {
for (;;) {
if (fgets(buffer, (int) sizeof(buffer) - 1, fp) != buffer) {
break; /* Error or end of file */
}
if (buffer[0] >= 'a') {
char *q = (char*) buffer;
for (i = 0; (i < sizeof(buffer) - 1) && (*q != '\0'); i++) {
if ((*q == '\r') || (*q == '\n')) {
*q = '\0';
}
q++;
}
pfi((const char*) buffer);
}
}
fclose(fp);
} else {
return false;
}
return true;
}
| {
"pile_set_name": "Github"
} |
package com.takusemba.jethub.api
import com.takusemba.jethub.api.response.RepositoryResponse
import com.takusemba.jethub.model.Repo
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.withContext
import retrofit2.Retrofit
import retrofit2.http.GET
import retrofit2.http.Path
/**
* Repository API client
*/
class RepoApiClient(retrofit: Retrofit) : RepoApi {
interface Service {
@GET("repos/{owner}/{repo}")
suspend fun getRepo(
@Path("owner") owner: String,
@Path("repo") repo: String
): RepositoryResponse
}
private val service = retrofit.create(Service::class.java)
override suspend fun getRepo(owner: String, repo: String): Repo {
return withContext(IO) {
service.getRepo(owner, repo).toModel()
}
}
}
| {
"pile_set_name": "Github"
} |
package net.hockeyapp.android;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
/**
* LICENSE INFORMATION
*
* Copyright (c) 2009 nullwire aps
*
* 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.
*
* Contributors:
* Mads Kristiansen, [email protected]
* Glen Humphrey
* Evan Charlton
* Peter Hewitt
* Thomas Dohmke, [email protected]
**/
public class Constants {
// Since the exception handler doesn't have access to the context,
// or anything really, the library prepares these values for when
// the handler needs them.
public static String FILES_PATH = null;
public static String APP_VERSION = null;
public static String APP_PACKAGE = null;
public static String ANDROID_VERSION = null;
public static String PHONE_MODEL = null;
public static String PHONE_MANUFACTURER = null;
public static String TAG = "HockeyApp";
public static void loadFromContext(Context context) {
Constants.ANDROID_VERSION = android.os.Build.VERSION.RELEASE;
Constants.PHONE_MODEL = android.os.Build.MODEL;
Constants.PHONE_MANUFACTURER = android.os.Build.MANUFACTURER;
PackageManager packageManager = context.getPackageManager();
try {
PackageInfo packageInfo = packageManager.getPackageInfo(context.getPackageName(), 0);
Constants.APP_VERSION = "" + packageInfo.versionCode;
Constants.APP_PACKAGE = packageInfo.packageName;
Constants.FILES_PATH = context.getFilesDir().getAbsolutePath();
}
catch (NameNotFoundException e) {
e.printStackTrace();
}
}
} | {
"pile_set_name": "Github"
} |
from ... import types
from ...charts.chart import ThreeAxisChart
from ...options import InitOpts
class Bar3D(ThreeAxisChart):
"""
<<< 3D Bar-Chart >>>
"""
def __init__(self, init_opts: types.Init = InitOpts()):
super().__init__(init_opts)
self._3d_chart_type = "bar3D"
| {
"pile_set_name": "Github"
} |
#define IPC_STAT 0x102
| {
"pile_set_name": "Github"
} |
/**
* @license AngularJS v1.5.0-build.4555+sha.0dfc1df
* (c) 2010-2016 Google, Inc. http://angularjs.org
* License: MIT
*/
(function(window, angular, undefined) {'use strict';
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Any commits to this file should be reviewed with security in mind. *
* Changes to this file can potentially create security vulnerabilities. *
* An approval from 2 Core members with history of modifying *
* this file is required. *
* *
* Does the change somehow allow for arbitrary javascript to be executed? *
* Or allows for someone to change the prototype of built-in objects? *
* Or gives undesired access to variables likes document or window? *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
var $sanitizeMinErr = angular.$$minErr('$sanitize');
/**
* @ngdoc module
* @name ngSanitize
* @description
*
* # ngSanitize
*
* The `ngSanitize` module provides functionality to sanitize HTML.
*
*
* <div doc-module-components="ngSanitize"></div>
*
* See {@link ngSanitize.$sanitize `$sanitize`} for usage.
*/
/**
* @ngdoc service
* @name $sanitize
* @kind function
*
* @description
* Sanitizes an html string by stripping all potentially dangerous tokens.
*
* The input is sanitized by parsing the HTML into tokens. All safe tokens (from a whitelist) are
* then serialized back to properly escaped html string. This means that no unsafe input can make
* it into the returned string.
*
* The whitelist for URL sanitization of attribute values is configured using the functions
* `aHrefSanitizationWhitelist` and `imgSrcSanitizationWhitelist` of {@link ng.$compileProvider
* `$compileProvider`}.
*
* The input may also contain SVG markup if this is enabled via {@link $sanitizeProvider}.
*
* @param {string} html HTML input.
* @returns {string} Sanitized HTML.
*
* @example
<example module="sanitizeExample" deps="angular-sanitize.js">
<file name="index.html">
<script>
angular.module('sanitizeExample', ['ngSanitize'])
.controller('ExampleController', ['$scope', '$sce', function($scope, $sce) {
$scope.snippet =
'<p style="color:blue">an html\n' +
'<em onmouseover="this.textContent=\'PWN3D!\'">click here</em>\n' +
'snippet</p>';
$scope.deliberatelyTrustDangerousSnippet = function() {
return $sce.trustAsHtml($scope.snippet);
};
}]);
</script>
<div ng-controller="ExampleController">
Snippet: <textarea ng-model="snippet" cols="60" rows="3"></textarea>
<table>
<tr>
<td>Directive</td>
<td>How</td>
<td>Source</td>
<td>Rendered</td>
</tr>
<tr id="bind-html-with-sanitize">
<td>ng-bind-html</td>
<td>Automatically uses $sanitize</td>
<td><pre><div ng-bind-html="snippet"><br/></div></pre></td>
<td><div ng-bind-html="snippet"></div></td>
</tr>
<tr id="bind-html-with-trust">
<td>ng-bind-html</td>
<td>Bypass $sanitize by explicitly trusting the dangerous value</td>
<td>
<pre><div ng-bind-html="deliberatelyTrustDangerousSnippet()">
</div></pre>
</td>
<td><div ng-bind-html="deliberatelyTrustDangerousSnippet()"></div></td>
</tr>
<tr id="bind-default">
<td>ng-bind</td>
<td>Automatically escapes</td>
<td><pre><div ng-bind="snippet"><br/></div></pre></td>
<td><div ng-bind="snippet"></div></td>
</tr>
</table>
</div>
</file>
<file name="protractor.js" type="protractor">
it('should sanitize the html snippet by default', function() {
expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()).
toBe('<p>an html\n<em>click here</em>\nsnippet</p>');
});
it('should inline raw snippet if bound to a trusted value', function() {
expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).
toBe("<p style=\"color:blue\">an html\n" +
"<em onmouseover=\"this.textContent='PWN3D!'\">click here</em>\n" +
"snippet</p>");
});
it('should escape snippet without any filter', function() {
expect(element(by.css('#bind-default div')).getInnerHtml()).
toBe("<p style=\"color:blue\">an html\n" +
"<em onmouseover=\"this.textContent='PWN3D!'\">click here</em>\n" +
"snippet</p>");
});
it('should update', function() {
element(by.model('snippet')).clear();
element(by.model('snippet')).sendKeys('new <b onclick="alert(1)">text</b>');
expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()).
toBe('new <b>text</b>');
expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).toBe(
'new <b onclick="alert(1)">text</b>');
expect(element(by.css('#bind-default div')).getInnerHtml()).toBe(
"new <b onclick=\"alert(1)\">text</b>");
});
</file>
</example>
*/
/**
* @ngdoc provider
* @name $sanitizeProvider
*
* @description
* Creates and configures {@link $sanitize} instance.
*/
function $SanitizeProvider() {
var svgEnabled = false;
this.$get = ['$$sanitizeUri', function($$sanitizeUri) {
if (svgEnabled) {
angular.extend(validElements, svgElements);
}
return function(html) {
var buf = [];
htmlParser(html, htmlSanitizeWriter(buf, function(uri, isImage) {
return !/^unsafe:/.test($$sanitizeUri(uri, isImage));
}));
return buf.join('');
};
}];
/**
* @ngdoc method
* @name $sanitizeProvider#enableSvg
* @kind function
*
* @description
* Enables a subset of svg to be supported by the sanitizer.
*
* <div class="alert alert-warning">
* <p>By enabling this setting without taking other precautions, you might expose your
* application to click-hijacking attacks. In these attacks, sanitized svg elements could be positioned
* outside of the containing element and be rendered over other elements on the page (e.g. a login
* link). Such behavior can then result in phishing incidents.</p>
*
* <p>To protect against these, explicitly setup `overflow: hidden` css rule for all potential svg
* tags within the sanitized content:</p>
*
* <br>
*
* <pre><code>
* .rootOfTheIncludedContent svg {
* overflow: hidden !important;
* }
* </code></pre>
* </div>
*
* @param {boolean=} regexp New regexp to whitelist urls with.
* @returns {boolean|ng.$sanitizeProvider} Returns the currently configured value if called
* without an argument or self for chaining otherwise.
*/
this.enableSvg = function(enableSvg) {
if (angular.isDefined(enableSvg)) {
svgEnabled = enableSvg;
return this;
} else {
return svgEnabled;
}
};
}
function sanitizeText(chars) {
var buf = [];
var writer = htmlSanitizeWriter(buf, angular.noop);
writer.chars(chars);
return buf.join('');
}
// Regular Expressions for parsing tags and attributes
var SURROGATE_PAIR_REGEXP = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g,
// Match everything outside of normal chars and " (quote character)
NON_ALPHANUMERIC_REGEXP = /([^\#-~ |!])/g;
// Good source of info about elements and attributes
// http://dev.w3.org/html5/spec/Overview.html#semantics
// http://simon.html5.org/html-elements
// Safe Void Elements - HTML5
// http://dev.w3.org/html5/spec/Overview.html#void-elements
var voidElements = toMap("area,br,col,hr,img,wbr");
// Elements that you can, intentionally, leave open (and which close themselves)
// http://dev.w3.org/html5/spec/Overview.html#optional-tags
var optionalEndTagBlockElements = toMap("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"),
optionalEndTagInlineElements = toMap("rp,rt"),
optionalEndTagElements = angular.extend({},
optionalEndTagInlineElements,
optionalEndTagBlockElements);
// Safe Block Elements - HTML5
var blockElements = angular.extend({}, optionalEndTagBlockElements, toMap("address,article," +
"aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5," +
"h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,section,table,ul"));
// Inline Elements - HTML5
var inlineElements = angular.extend({}, optionalEndTagInlineElements, toMap("a,abbr,acronym,b," +
"bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s," +
"samp,small,span,strike,strong,sub,sup,time,tt,u,var"));
// SVG Elements
// https://wiki.whatwg.org/wiki/Sanitization_rules#svg_Elements
// Note: the elements animate,animateColor,animateMotion,animateTransform,set are intentionally omitted.
// They can potentially allow for arbitrary javascript to be executed. See #11290
var svgElements = toMap("circle,defs,desc,ellipse,font-face,font-face-name,font-face-src,g,glyph," +
"hkern,image,linearGradient,line,marker,metadata,missing-glyph,mpath,path,polygon,polyline," +
"radialGradient,rect,stop,svg,switch,text,title,tspan");
// Blocked Elements (will be stripped)
var blockedElements = toMap("script,style");
var validElements = angular.extend({},
voidElements,
blockElements,
inlineElements,
optionalEndTagElements);
//Attributes that have href and hence need to be sanitized
var uriAttrs = toMap("background,cite,href,longdesc,src,xlink:href");
var htmlAttrs = toMap('abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,' +
'color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,' +
'ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,' +
'scope,scrolling,shape,size,span,start,summary,tabindex,target,title,type,' +
'valign,value,vspace,width');
// SVG attributes (without "id" and "name" attributes)
// https://wiki.whatwg.org/wiki/Sanitization_rules#svg_Attributes
var svgAttrs = toMap('accent-height,accumulate,additive,alphabetic,arabic-form,ascent,' +
'baseProfile,bbox,begin,by,calcMode,cap-height,class,color,color-rendering,content,' +
'cx,cy,d,dx,dy,descent,display,dur,end,fill,fill-rule,font-family,font-size,font-stretch,' +
'font-style,font-variant,font-weight,from,fx,fy,g1,g2,glyph-name,gradientUnits,hanging,' +
'height,horiz-adv-x,horiz-origin-x,ideographic,k,keyPoints,keySplines,keyTimes,lang,' +
'marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mathematical,' +
'max,min,offset,opacity,orient,origin,overline-position,overline-thickness,panose-1,' +
'path,pathLength,points,preserveAspectRatio,r,refX,refY,repeatCount,repeatDur,' +
'requiredExtensions,requiredFeatures,restart,rotate,rx,ry,slope,stemh,stemv,stop-color,' +
'stop-opacity,strikethrough-position,strikethrough-thickness,stroke,stroke-dasharray,' +
'stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,' +
'stroke-width,systemLanguage,target,text-anchor,to,transform,type,u1,u2,underline-position,' +
'underline-thickness,unicode,unicode-range,units-per-em,values,version,viewBox,visibility,' +
'width,widths,x,x-height,x1,x2,xlink:actuate,xlink:arcrole,xlink:role,xlink:show,xlink:title,' +
'xlink:type,xml:base,xml:lang,xml:space,xmlns,xmlns:xlink,y,y1,y2,zoomAndPan', true);
var validAttrs = angular.extend({},
uriAttrs,
svgAttrs,
htmlAttrs);
function toMap(str, lowercaseKeys) {
var obj = {}, items = str.split(','), i;
for (i = 0; i < items.length; i++) {
obj[lowercaseKeys ? angular.lowercase(items[i]) : items[i]] = true;
}
return obj;
}
var inertBodyElement;
(function(window) {
var doc;
if (window.document && window.document.implementation) {
doc = window.document.implementation.createHTMLDocument("inert");
} else {
throw $sanitizeMinErr('noinert', "Can't create an inert html document");
}
var docElement = doc.documentElement || doc.getDocumentElement();
var bodyElements = docElement.getElementsByTagName('body');
// usually there should be only one body element in the document, but IE doesn't have any, so we need to create one
if (bodyElements.length === 1) {
inertBodyElement = bodyElements[0];
} else {
var html = doc.createElement('html');
inertBodyElement = doc.createElement('body');
html.appendChild(inertBodyElement);
doc.appendChild(html);
}
})(window);
/**
* @example
* htmlParser(htmlString, {
* start: function(tag, attrs) {},
* end: function(tag) {},
* chars: function(text) {},
* comment: function(text) {}
* });
*
* @param {string} html string
* @param {object} handler
*/
function htmlParser(html, handler) {
if (html === null || html === undefined) {
html = '';
} else if (typeof html !== 'string') {
html = '' + html;
}
inertBodyElement.innerHTML = html;
//mXSS protection
var mXSSAttempts = 5;
do {
if (mXSSAttempts === 0) {
throw $sanitizeMinErr('uinput', "Failed to sanitize html because the input is unstable");
}
mXSSAttempts--;
// strip custom-namespaced attributes on IE<=11
if (document.documentMode <= 11) {
stripCustomNsAttrs(inertBodyElement);
}
html = inertBodyElement.innerHTML; //trigger mXSS
inertBodyElement.innerHTML = html;
} while (html !== inertBodyElement.innerHTML);
var node = inertBodyElement.firstChild;
while (node) {
switch (node.nodeType) {
case 1: // ELEMENT_NODE
handler.start(node.nodeName.toLowerCase(), attrToMap(node.attributes));
break;
case 3: // TEXT NODE
handler.chars(node.textContent);
break;
}
var nextNode;
if (!(nextNode = node.firstChild)) {
if (node.nodeType == 1) {
handler.end(node.nodeName.toLowerCase());
}
nextNode = node.nextSibling;
if (!nextNode) {
while (nextNode == null) {
node = node.parentNode;
if (node === inertBodyElement) break;
nextNode = node.nextSibling;
if (node.nodeType == 1) {
handler.end(node.nodeName.toLowerCase());
}
}
}
}
node = nextNode;
}
while (node = inertBodyElement.firstChild) {
inertBodyElement.removeChild(node);
}
}
function attrToMap(attrs) {
var map = {};
for (var i = 0, ii = attrs.length; i < ii; i++) {
var attr = attrs[i];
map[attr.name] = attr.value;
}
return map;
}
/**
* Escapes all potentially dangerous characters, so that the
* resulting string can be safely inserted into attribute or
* element text.
* @param value
* @returns {string} escaped text
*/
function encodeEntities(value) {
return value.
replace(/&/g, '&').
replace(SURROGATE_PAIR_REGEXP, function(value) {
var hi = value.charCodeAt(0);
var low = value.charCodeAt(1);
return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';';
}).
replace(NON_ALPHANUMERIC_REGEXP, function(value) {
return '&#' + value.charCodeAt(0) + ';';
}).
replace(/</g, '<').
replace(/>/g, '>');
}
/**
* create an HTML/XML writer which writes to buffer
* @param {Array} buf use buf.join('') to get out sanitized html string
* @returns {object} in the form of {
* start: function(tag, attrs) {},
* end: function(tag) {},
* chars: function(text) {},
* comment: function(text) {}
* }
*/
function htmlSanitizeWriter(buf, uriValidator) {
var ignoreCurrentElement = false;
var out = angular.bind(buf, buf.push);
return {
start: function(tag, attrs) {
tag = angular.lowercase(tag);
if (!ignoreCurrentElement && blockedElements[tag]) {
ignoreCurrentElement = tag;
}
if (!ignoreCurrentElement && validElements[tag] === true) {
out('<');
out(tag);
angular.forEach(attrs, function(value, key) {
var lkey=angular.lowercase(key);
var isImage = (tag === 'img' && lkey === 'src') || (lkey === 'background');
if (validAttrs[lkey] === true &&
(uriAttrs[lkey] !== true || uriValidator(value, isImage))) {
out(' ');
out(key);
out('="');
out(encodeEntities(value));
out('"');
}
});
out('>');
}
},
end: function(tag) {
tag = angular.lowercase(tag);
if (!ignoreCurrentElement && validElements[tag] === true && voidElements[tag] !== true) {
out('</');
out(tag);
out('>');
}
if (tag == ignoreCurrentElement) {
ignoreCurrentElement = false;
}
},
chars: function(chars) {
if (!ignoreCurrentElement) {
out(encodeEntities(chars));
}
}
};
}
/**
* When IE9-11 comes across an unknown namespaced attribute e.g. 'xlink:foo' it adds 'xmlns:ns1' attribute to declare
* ns1 namespace and prefixes the attribute with 'ns1' (e.g. 'ns1:xlink:foo'). This is undesirable since we don't want
* to allow any of these custom attributes. This method strips them all.
*
* @param node Root element to process
*/
function stripCustomNsAttrs(node) {
if (node.nodeType === Node.ELEMENT_NODE) {
var attrs = node.attributes;
for (var i = 0, l = attrs.length; i < l; i++) {
var attrNode = attrs[i];
var attrName = attrNode.name.toLowerCase();
if (attrName === 'xmlns:ns1' || attrName.indexOf('ns1:') === 0) {
node.removeAttributeNode(attrNode);
i--;
l--;
}
}
}
var nextNode = node.firstChild;
if (nextNode) {
stripCustomNsAttrs(nextNode);
}
nextNode = node.nextSibling;
if (nextNode) {
stripCustomNsAttrs(nextNode);
}
}
// define ngSanitize module and register $sanitize service
angular.module('ngSanitize', []).provider('$sanitize', $SanitizeProvider);
/* global sanitizeText: false */
/**
* @ngdoc filter
* @name linky
* @kind function
*
* @description
* Finds links in text input and turns them into html links. Supports `http/https/ftp/mailto` and
* plain email address links.
*
* Requires the {@link ngSanitize `ngSanitize`} module to be installed.
*
* @param {string} text Input text.
* @param {string} target Window (`_blank|_self|_parent|_top`) or named frame to open links in.
* @param {object|function(url)} [attributes] Add custom attributes to the link element.
*
* Can be one of:
*
* - `object`: A map of attributes
* - `function`: Takes the url as a parameter and returns a map of attributes
*
* If the map of attributes contains a value for `target`, it overrides the value of
* the target parameter.
*
*
* @returns {string} Html-linkified and {@link $sanitize sanitized} text.
*
* @usage
<span ng-bind-html="linky_expression | linky"></span>
*
* @example
<example module="linkyExample" deps="angular-sanitize.js">
<file name="index.html">
<div ng-controller="ExampleController">
Snippet: <textarea ng-model="snippet" cols="60" rows="3"></textarea>
<table>
<tr>
<th>Filter</th>
<th>Source</th>
<th>Rendered</th>
</tr>
<tr id="linky-filter">
<td>linky filter</td>
<td>
<pre><div ng-bind-html="snippet | linky"><br></div></pre>
</td>
<td>
<div ng-bind-html="snippet | linky"></div>
</td>
</tr>
<tr id="linky-target">
<td>linky target</td>
<td>
<pre><div ng-bind-html="snippetWithSingleURL | linky:'_blank'"><br></div></pre>
</td>
<td>
<div ng-bind-html="snippetWithSingleURL | linky:'_blank'"></div>
</td>
</tr>
<tr id="linky-custom-attributes">
<td>linky custom attributes</td>
<td>
<pre><div ng-bind-html="snippetWithSingleURL | linky:'_self':{rel: 'nofollow'}"><br></div></pre>
</td>
<td>
<div ng-bind-html="snippetWithSingleURL | linky:'_self':{rel: 'nofollow'}"></div>
</td>
</tr>
<tr id="escaped-html">
<td>no filter</td>
<td><pre><div ng-bind="snippet"><br></div></pre></td>
<td><div ng-bind="snippet"></div></td>
</tr>
</table>
</file>
<file name="script.js">
angular.module('linkyExample', ['ngSanitize'])
.controller('ExampleController', ['$scope', function($scope) {
$scope.snippet =
'Pretty text with some links:\n'+
'http://angularjs.org/,\n'+
'mailto:[email protected],\n'+
'[email protected],\n'+
'and one more: ftp://127.0.0.1/.';
$scope.snippetWithSingleURL = 'http://angularjs.org/';
}]);
</file>
<file name="protractor.js" type="protractor">
it('should linkify the snippet with urls', function() {
expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).
toBe('Pretty text with some links: http://angularjs.org/, [email protected], ' +
'[email protected], and one more: ftp://127.0.0.1/.');
expect(element.all(by.css('#linky-filter a')).count()).toEqual(4);
});
it('should not linkify snippet without the linky filter', function() {
expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText()).
toBe('Pretty text with some links: http://angularjs.org/, mailto:[email protected], ' +
'[email protected], and one more: ftp://127.0.0.1/.');
expect(element.all(by.css('#escaped-html a')).count()).toEqual(0);
});
it('should update', function() {
element(by.model('snippet')).clear();
element(by.model('snippet')).sendKeys('new http://link.');
expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).
toBe('new http://link.');
expect(element.all(by.css('#linky-filter a')).count()).toEqual(1);
expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText())
.toBe('new http://link.');
});
it('should work with the target property', function() {
expect(element(by.id('linky-target')).
element(by.binding("snippetWithSingleURL | linky:'_blank'")).getText()).
toBe('http://angularjs.org/');
expect(element(by.css('#linky-target a')).getAttribute('target')).toEqual('_blank');
});
it('should optionally add custom attributes', function() {
expect(element(by.id('linky-custom-attributes')).
element(by.binding("snippetWithSingleURL | linky:'_self':{rel: 'nofollow'}")).getText()).
toBe('http://angularjs.org/');
expect(element(by.css('#linky-custom-attributes a')).getAttribute('rel')).toEqual('nofollow');
});
</file>
</example>
*/
angular.module('ngSanitize').filter('linky', ['$sanitize', function($sanitize) {
var LINKY_URL_REGEXP =
/((ftp|https?):\/\/|(www\.)|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"\u201d\u2019]/i,
MAILTO_REGEXP = /^mailto:/i;
var linkyMinErr = angular.$$minErr('linky');
var isString = angular.isString;
return function(text, target, attributes) {
if (text == null || text === '') return text;
if (!isString(text)) throw linkyMinErr('notstring', 'Expected string but received: {0}', text);
var match;
var raw = text;
var html = [];
var url;
var i;
while ((match = raw.match(LINKY_URL_REGEXP))) {
// We can not end in these as they are sometimes found at the end of the sentence
url = match[0];
// if we did not match ftp/http/www/mailto then assume mailto
if (!match[2] && !match[4]) {
url = (match[3] ? 'http://' : 'mailto:') + url;
}
i = match.index;
addText(raw.substr(0, i));
addLink(url, match[0].replace(MAILTO_REGEXP, ''));
raw = raw.substring(i + match[0].length);
}
addText(raw);
return $sanitize(html.join(''));
function addText(text) {
if (!text) {
return;
}
html.push(sanitizeText(text));
}
function addLink(url, text) {
var key;
html.push('<a ');
if (angular.isFunction(attributes)) {
attributes = attributes(url);
}
if (angular.isObject(attributes)) {
for (key in attributes) {
html.push(key + '="' + attributes[key] + '" ');
}
} else {
attributes = {};
}
if (angular.isDefined(target) && !('target' in attributes)) {
html.push('target="',
target,
'" ');
}
html.push('href="',
url.replace(/"/g, '"'),
'">');
addText(text);
html.push('</a>');
}
};
}]);
})(window, window.angular);
| {
"pile_set_name": "Github"
} |
/**
* Copyright (c) 2009 Carnegie Mellon University.
* 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.
*
* For more about this software visit:
*
* http://www.graphlab.ml.cmu.edu
*
*/
#ifndef GRAPHLAB_SERIALIZABLE
#define GRAPHLAB_SERIALIZABLE
#include <boost/concept/assert.hpp>
#include <boost/concept/requires.hpp>
#include <boost/concept_check.hpp>
#include <sstream>
#include <graphlab/serialization/serialize.hpp>
namespace graphlab {
/**
* \brief Concept checks if a type T is serializable.
*
* This is a concept checking class for boost::concept and can be
* used to enforce that a type T is \ref sec_serializable, assignable and
* default constructible.
*
* \tparam T The type to test for serializability.
*/
template <typename T>
class Serializable : boost::Assignable<T>, boost::DefaultConstructible<T> {
public:
BOOST_CONCEPT_USAGE(Serializable) {
std::stringstream strm;
oarchive oarc(strm);
iarchive iarc(strm);
const T const_t = T();
T t = T();
// A compiler error on these lines implies that your type is not
// serializable. See the documentaiton on how to make
// serializable type.
oarc << const_t;
iarc >> t;
}
};
} // namespace graphlab
#endif
| {
"pile_set_name": "Github"
} |
<h1>Superdog Inc.</h1>
| {
"pile_set_name": "Github"
} |
# `no_std` Support
Proptest has partial support for being used in `no_std` contexts.
You will need a nightly compiler version. In your `Cargo.toml`, adjust the
Proptest dependency to look something like this:
```toml
[dev-dependencies.proptest]
version = "proptestVersion"
# Opt out of the `std` feature
default-features = false
# alloc: Use the `alloc` crate directly. Proptest has a hard requirement on
# memory allocation, so either this or `std` is needed.
# unstable: Enable use of nightly-only compiler features.
features = ["alloc", "unstable"]
```
Some APIs are not available in the `no_std` build. This includes functionality
which necessarily needs `std` such as failure persistence and forking, as well
as features depending on other crates which do not support `no_std` usage, such
as regex support.
The `no_std` build may not have access to an entropy source (one exception are
x86-64 machines that support rdrand, in this case the library can be compiled
with the `hardware-rng` feature to get random numbers). If no entropy source is
available, every `TestRunner` (i.e., every `#[test]` when using the `proptest!`
macro) uses a single hard-coded seed. For complex inputs, it may be a good idea
to increase the number of test cases to compensate. The hard-coded seed is not
contractually guaranteed and may change between Proptest releases without
notice.
To see an accurate representation of what APIs are available in a `no_std`
environment, refer to [the rustdocs for the `no_std`
build](https://altsysrq.github.io/rustdoc/proptest-nostd/latest/proptest/)
instead of the usual reference.
| {
"pile_set_name": "Github"
} |
static const unsigned char map_windows_1254[] = {
0x00, 0x00, 0x00, 0x00, 0x20, 0xac, 0xff, 0xff, 0x20, 0x1a, 0x01, 0x92,
0x20, 0x1e, 0x20, 0x26, 0x20, 0x20, 0x20, 0x21, 0x02, 0xc6, 0x20, 0x30,
0x01, 0x60, 0x20, 0x39, 0x01, 0x52, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0x20, 0x18, 0x20, 0x19, 0x20, 0x1c, 0x20, 0x1d, 0x20, 0x22,
0x20, 0x13, 0x20, 0x14, 0x02, 0xdc, 0x21, 0x22, 0x01, 0x61, 0x20, 0x3a,
0x01, 0x53, 0xff, 0xff, 0xff, 0xff, 0x01, 0x78, 0x00, 0xa0, 0x00, 0xa1,
0x00, 0xa2, 0x00, 0xa3, 0x00, 0xa4, 0x00, 0xa5, 0x00, 0xa6, 0x00, 0xa7,
0x00, 0xa8, 0x00, 0xa9, 0x00, 0xaa, 0x00, 0xab, 0x00, 0xac, 0x00, 0xad,
0x00, 0xae, 0x00, 0xaf, 0x00, 0xb0, 0x00, 0xb1, 0x00, 0xb2, 0x00, 0xb3,
0x00, 0xb4, 0x00, 0xb5, 0x00, 0xb6, 0x00, 0xb7, 0x00, 0xb8, 0x00, 0xb9,
0x00, 0xba, 0x00, 0xbb, 0x00, 0xbc, 0x00, 0xbd, 0x00, 0xbe, 0x00, 0xbf,
0x00, 0xc0, 0x00, 0xc1, 0x00, 0xc2, 0x00, 0xc3, 0x00, 0xc4, 0x00, 0xc5,
0x00, 0xc6, 0x00, 0xc7, 0x00, 0xc8, 0x00, 0xc9, 0x00, 0xca, 0x00, 0xcb,
0x00, 0xcc, 0x00, 0xcd, 0x00, 0xce, 0x00, 0xcf, 0x01, 0x1e, 0x00, 0xd1,
0x00, 0xd2, 0x00, 0xd3, 0x00, 0xd4, 0x00, 0xd5, 0x00, 0xd6, 0x00, 0xd7,
0x00, 0xd8, 0x00, 0xd9, 0x00, 0xda, 0x00, 0xdb, 0x00, 0xdc, 0x01, 0x30,
0x01, 0x5e, 0x00, 0xdf, 0x00, 0xe0, 0x00, 0xe1, 0x00, 0xe2, 0x00, 0xe3,
0x00, 0xe4, 0x00, 0xe5, 0x00, 0xe6, 0x00, 0xe7, 0x00, 0xe8, 0x00, 0xe9,
0x00, 0xea, 0x00, 0xeb, 0x00, 0xec, 0x00, 0xed, 0x00, 0xee, 0x00, 0xef,
0x01, 0x1f, 0x00, 0xf1, 0x00, 0xf2, 0x00, 0xf3, 0x00, 0xf4, 0x00, 0xf5,
0x00, 0xf6, 0x00, 0xf7, 0x00, 0xf8, 0x00, 0xf9, 0x00, 0xfa, 0x00, 0xfb,
0x00, 0xfc, 0x01, 0x31, 0x01, 0x5f, 0x00, 0xff
};
| {
"pile_set_name": "Github"
} |
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Ui\DataProvider\Modifier;
/**
* @api
* @since 100.1.0
*/
interface ModifierInterface
{
/**
* @param array $data
* @return array
* @since 100.1.0
*/
public function modifyData(array $data);
/**
* @param array $meta
* @return array
* @since 100.1.0
*/
public function modifyMeta(array $meta);
}
| {
"pile_set_name": "Github"
} |
// Copyright 2013 The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package model
import (
"encoding/json"
"fmt"
"regexp"
"strings"
"unicode/utf8"
)
const (
// AlertNameLabel is the name of the label containing the an alert's name.
AlertNameLabel = "alertname"
// ExportedLabelPrefix is the prefix to prepend to the label names present in
// exported metrics if a label of the same name is added by the server.
ExportedLabelPrefix = "exported_"
// MetricNameLabel is the label name indicating the metric name of a
// timeseries.
MetricNameLabel = "__name__"
// SchemeLabel is the name of the label that holds the scheme on which to
// scrape a target.
SchemeLabel = "__scheme__"
// AddressLabel is the name of the label that holds the address of
// a scrape target.
AddressLabel = "__address__"
// MetricsPathLabel is the name of the label that holds the path on which to
// scrape a target.
MetricsPathLabel = "__metrics_path__"
// ReservedLabelPrefix is a prefix which is not legal in user-supplied
// label names.
ReservedLabelPrefix = "__"
// MetaLabelPrefix is a prefix for labels that provide meta information.
// Labels with this prefix are used for intermediate label processing and
// will not be attached to time series.
MetaLabelPrefix = "__meta_"
// TmpLabelPrefix is a prefix for temporary labels as part of relabelling.
// Labels with this prefix are used for intermediate label processing and
// will not be attached to time series. This is reserved for use in
// Prometheus configuration files by users.
TmpLabelPrefix = "__tmp_"
// ParamLabelPrefix is a prefix for labels that provide URL parameters
// used to scrape a target.
ParamLabelPrefix = "__param_"
// JobLabel is the label name indicating the job from which a timeseries
// was scraped.
JobLabel = "job"
// InstanceLabel is the label name used for the instance label.
InstanceLabel = "instance"
// BucketLabel is used for the label that defines the upper bound of a
// bucket of a histogram ("le" -> "less or equal").
BucketLabel = "le"
// QuantileLabel is used for the label that defines the quantile in a
// summary.
QuantileLabel = "quantile"
)
// LabelNameRE is a regular expression matching valid label names. Note that the
// IsValid method of LabelName performs the same check but faster than a match
// with this regular expression.
var LabelNameRE = regexp.MustCompile("^[a-zA-Z_][a-zA-Z0-9_]*$")
// A LabelName is a key for a LabelSet or Metric. It has a value associated
// therewith.
type LabelName string
// IsValid is true iff the label name matches the pattern of LabelNameRE. This
// method, however, does not use LabelNameRE for the check but a much faster
// hardcoded implementation.
func (ln LabelName) IsValid() bool {
if len(ln) == 0 {
return false
}
for i, b := range ln {
if !((b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || b == '_' || (b >= '0' && b <= '9' && i > 0)) {
return false
}
}
return true
}
// UnmarshalYAML implements the yaml.Unmarshaler interface.
func (ln *LabelName) UnmarshalYAML(unmarshal func(interface{}) error) error {
var s string
if err := unmarshal(&s); err != nil {
return err
}
if !LabelName(s).IsValid() {
return fmt.Errorf("%q is not a valid label name", s)
}
*ln = LabelName(s)
return nil
}
// UnmarshalJSON implements the json.Unmarshaler interface.
func (ln *LabelName) UnmarshalJSON(b []byte) error {
var s string
if err := json.Unmarshal(b, &s); err != nil {
return err
}
if !LabelName(s).IsValid() {
return fmt.Errorf("%q is not a valid label name", s)
}
*ln = LabelName(s)
return nil
}
// LabelNames is a sortable LabelName slice. In implements sort.Interface.
type LabelNames []LabelName
func (l LabelNames) Len() int {
return len(l)
}
func (l LabelNames) Less(i, j int) bool {
return l[i] < l[j]
}
func (l LabelNames) Swap(i, j int) {
l[i], l[j] = l[j], l[i]
}
func (l LabelNames) String() string {
labelStrings := make([]string, 0, len(l))
for _, label := range l {
labelStrings = append(labelStrings, string(label))
}
return strings.Join(labelStrings, ", ")
}
// A LabelValue is an associated value for a LabelName.
type LabelValue string
// IsValid returns true iff the string is a valid UTF8.
func (lv LabelValue) IsValid() bool {
return utf8.ValidString(string(lv))
}
// LabelValues is a sortable LabelValue slice. It implements sort.Interface.
type LabelValues []LabelValue
func (l LabelValues) Len() int {
return len(l)
}
func (l LabelValues) Less(i, j int) bool {
return string(l[i]) < string(l[j])
}
func (l LabelValues) Swap(i, j int) {
l[i], l[j] = l[j], l[i]
}
// LabelPair pairs a name with a value.
type LabelPair struct {
Name LabelName
Value LabelValue
}
// LabelPairs is a sortable slice of LabelPair pointers. It implements
// sort.Interface.
type LabelPairs []*LabelPair
func (l LabelPairs) Len() int {
return len(l)
}
func (l LabelPairs) Less(i, j int) bool {
switch {
case l[i].Name > l[j].Name:
return false
case l[i].Name < l[j].Name:
return true
case l[i].Value > l[j].Value:
return false
case l[i].Value < l[j].Value:
return true
default:
return false
}
}
func (l LabelPairs) Swap(i, j int) {
l[i], l[j] = l[j], l[i]
}
| {
"pile_set_name": "Github"
} |
(ns com.fulcrologic.fulcro.algorithms.do-not-use
"Some misc. utility functions. These are primarily meant for internal use, and are subject to
relocation and removal in the future.
You have been warned. Changes to this ns (or its complete removal)
will not be considered breaking changes to the library, and no mention of said changes
will even appear in the changelog."
(:require
[taoensso.timbre :as log]
[clojure.string :as str]
[edn-query-language.core :as eql]
#?@(:cljs [[goog.object :as gobj]
[goog.crypt :as crypt]
[goog.crypt.base64 :as b64]])
[clojure.spec.alpha :as s]
[clojure.string :as str])
#?(:clj (:import
[clojure.lang Atom]
[java.util Base64]
[java.nio.charset StandardCharsets])))
(defn atom? [a] (instance? Atom a))
(defn join-entry [expr]
(let [[k v] (if (seq? expr)
(ffirst expr)
(first expr))]
[(if (list? k) (first k) k) v]))
(defn join? [x]
#?(:cljs {:tag boolean})
(let [x (if (seq? x) (first x) x)]
(map? x)))
(defn recursion?
#?(:cljs {:tag boolean})
[x]
(or #?(:clj (= '... x)
:cljs (symbol-identical? '... x))
(number? x)))
(defn union?
#?(:cljs {:tag boolean})
[expr]
(let [expr (cond-> expr (seq? expr) first)]
(and (map? expr)
(map? (-> expr first second)))))
(defn join-key [expr]
(cond
(map? expr) (let [k (ffirst expr)]
(if (list? k)
(first k)
(ffirst expr)))
(seq? expr) (join-key (first expr))
:else expr))
(defn join-value [join]
(second (join-entry join)))
(defn mutation-join? [expr]
(and (join? expr) (symbol? (join-key expr))))
(defn now
"Returns current time in ms."
[]
#?(:clj (java.util.Date.)
:cljs (js/Date.)))
(defn deep-merge
"Merges nested maps without overwriting existing keys."
[& xs]
(if (every? map? xs)
(apply merge-with deep-merge xs)
(last xs)))
(defn conform! [spec x]
(let [rt (s/conform spec x)]
(when (s/invalid? rt)
(throw (ex-info (s/explain-str spec x)
(s/explain-data spec x))))
rt))
(defn destructured-keys
"Calculates the keys that are being extracted in a legal map destructuring expression.
- `m`: A map containing legal CLJ destructurings, like `{:keys [a] x :x ::keys [y]}`
Returns a set of all keywords that are destructured in the map.
Example:
```
(destructured-keys {:a/keys [v] sym :other-key}) => #{:a/v :other-key}
```
"
[m]
(let [regular-destructurings (reduce
(fn [acc k]
(if (and (keyword? k) (= "keys" (name k)))
(let [simple-syms (get m k)
included-ns (namespace k)
source-keys (into #{}
(map (fn [s]
(cond
included-ns (keyword included-ns (name s))
(and (keyword? s) (namespace s)) s
(namespace s) (keyword (namespace s) (name s))
:else (keyword s))))
simple-syms)]
(into acc source-keys))
acc))
#{}
(keys m))
symbol-destructrings (reduce
(fn [acc k]
(if (symbol? k)
(conj acc (get m k))
acc))
#{}
(keys m))]
(into regular-destructurings symbol-destructrings)))
#?(:cljs
(defn char-code
"Convert char to int"
[c]
(cond
(number? c) c
(and (string? c) (== (.-length c) 1)) (.charCodeAt c 0)
:else (throw (js/Error. "Argument to char must be a character or number")))))
(defn base64-encode
"Encode a string to UTF-8 and encode the result to base 64"
[str]
#?(:clj (.encodeToString (Base64/getEncoder) (.getBytes str "UTF-8"))
:cljs (let [bytes (crypt/stringToUtf8ByteArray (clj->js str))] ;; First convert our JavaScript string from UCS-2/UTF-16 to UTF-8 bytes
(b64/encodeString (str/join "" (map char bytes)))))) ;; base64 encode that byte array to a string
(defn base64-decode
[str]
#?(:clj (String. (.decode (Base64/getDecoder) ^String str) (StandardCharsets/UTF_8))
:cljs (let [bytes (map char-code (vec (b64/decodeString str)))] ;; b64/decodeString produces essentially a byte array
(crypt/utf8ByteArrayToString (clj->js bytes))))) ;; Convert the byte array to a valid JavaScript string (either UCS-2 or UTF-16)
(defn ast->query
"Workaround for bug in EQL 0.0.9 and earlier"
[ast]
(as-> (eql/ast->expr ast true) <>
(if (vector? <>)
<>
[<>])))
| {
"pile_set_name": "Github"
} |
package net.ttddyy.dsproxy;
import net.ttddyy.dsproxy.listener.DataSourceQueryCountListener;
import net.ttddyy.dsproxy.listener.SingleQueryCountHolder;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicReference;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
/**
* @author Tadaya Tsuyukubo
*/
public class DataSourceQueryCountListenerTest {
private QueryInfo queryInfo;
private List<QueryInfo> queryInfoList;
private ExecutionInfo executionInfo;
private DataSourceQueryCountListener listener;
@Before
public void setUp() {
queryInfo = mock(QueryInfo.class);
queryInfoList = new ArrayList<QueryInfo>();
queryInfoList.add(queryInfo);
executionInfo = mock(ExecutionInfo.class);
given(executionInfo.getDataSourceName()).willReturn("testDS");
given(executionInfo.getElapsedTime()).willReturn(123L);
given(executionInfo.getStatementType()).willReturn(StatementType.STATEMENT);
listener = new DataSourceQueryCountListener();
}
@After
public void tearDown() {
QueryCountHolder.clear();
}
@Test
public void testSelect() {
given(queryInfo.getQuery()).willReturn("select * from emp");
listener.afterQuery(executionInfo, queryInfoList);
verifyQueryCount(1, 0, 0, 0, 0);
}
@Test
public void testInsert() {
given(queryInfo.getQuery()).willReturn("insert into emp (id) values (1)");
listener.afterQuery(executionInfo, queryInfoList);
verifyQueryCount(0, 1, 0, 0, 0);
}
@Test
public void testUpdate() {
given(queryInfo.getQuery()).willReturn("update emp set id = 1");
listener.afterQuery(executionInfo, queryInfoList);
verifyQueryCount(0, 0, 1, 0, 0);
}
@Test
public void testDelete() {
given(queryInfo.getQuery()).willReturn("delete * from emp");
listener.afterQuery(executionInfo, queryInfoList);
verifyQueryCount(0, 0, 0, 1, 0);
}
@Test
public void testOther() {
given(queryInfo.getQuery()).willReturn("create table aa(...)");
listener.afterQuery(executionInfo, queryInfoList);
verifyQueryCount(0, 0, 0, 0, 1);
}
private void verifyQueryCount(int select, int insert, int update, int delete, int other) {
QueryCount queryCount = QueryCountHolder.get("testDS");
assertThat(queryCount).isNotNull().isInstanceOf(QueryCount.class);
assertThat(queryCount.getTime()).as("total time").isEqualTo(123L);
assertThat(queryCount.getSelect()).as("num of select").isEqualTo(select);
assertThat(queryCount.getInsert()).as("num of insert").isEqualTo(insert);
assertThat(queryCount.getUpdate()).as("num of update").isEqualTo(update);
assertThat(queryCount.getDelete()).as("num of delete").isEqualTo(delete);
assertThat(queryCount.getOther()).as("num of other").isEqualTo(other);
}
@Test
public void statement() {
given(queryInfo.getQuery()).willReturn("foo");
given(executionInfo.getStatementType()).willReturn(StatementType.STATEMENT);
listener.afterQuery(executionInfo, queryInfoList);
verifyStatementTypeCount(1, 0, 0);
}
@Test
public void prepared() {
given(queryInfo.getQuery()).willReturn("foo");
given(executionInfo.getStatementType()).willReturn(StatementType.PREPARED);
listener.afterQuery(executionInfo, queryInfoList);
verifyStatementTypeCount(0, 1, 0);
}
@Test
public void callable() {
given(queryInfo.getQuery()).willReturn("foo");
given(executionInfo.getStatementType()).willReturn(StatementType.CALLABLE);
listener.afterQuery(executionInfo, queryInfoList);
verifyStatementTypeCount(0, 0, 1);
}
private void verifyStatementTypeCount(int statement, int prepared, int callable) {
QueryCount queryCount = QueryCountHolder.get("testDS");
assertThat(queryCount).isNotNull().isInstanceOf(QueryCount.class);
assertThat(queryCount.getStatement()).as("num of statement").isEqualTo(statement);
assertThat(queryCount.getPrepared()).as("num of prepared").isEqualTo(prepared);
assertThat(queryCount.getCallable()).as("num of callable").isEqualTo(callable);
}
@Test
public void threadLocalHolderStrategy() throws Exception {
// perform on main thread
QueryInfo queryInfo = mock(QueryInfo.class);
given(queryInfo.getQuery()).willReturn("insert into emp (id) values (1)");
// use default strategy
listener.afterQuery(executionInfo, Collections.singletonList(queryInfo));
// perform on separate thread
final CountDownLatch latch = new CountDownLatch(1);
final AtomicReference<Throwable> failureInThread = new AtomicReference<Throwable>();
Runnable threadA = new Runnable() {
@Override
public void run() {
QueryInfo queryInfo = mock(QueryInfo.class);
given(queryInfo.getQuery()).willReturn("select * from emp");
listener.afterQuery(executionInfo, Collections.singletonList(queryInfo));
// verify count within thread
try {
QueryCount queryCount = QueryCountHolder.get("testDS");
assertThat(queryCount).isNotNull().isInstanceOf(QueryCount.class);
assertThat(queryCount.getSelect()).as("num of select").isEqualTo(1);
assertThat(queryCount.getInsert()).as("num of insert").isEqualTo(0);
assertThat(queryCount.getTotal()).as("num of queries").isEqualTo(1);
} catch (Throwable e) {
failureInThread.set(e);
}
latch.countDown();
}
};
new Thread(threadA).start();
latch.await();
if (failureInThread.get() != null) {
throw new RuntimeException("Verification failure in separate thread", failureInThread.get());
}
// verify count in main thread
QueryCount queryCount = QueryCountHolder.get("testDS");
assertThat(queryCount).isNotNull().isInstanceOf(QueryCount.class);
assertThat(queryCount.getSelect()).as("num of select").isEqualTo(0);
assertThat(queryCount.getInsert()).as("num of insert").isEqualTo(1);
assertThat(queryCount.getTotal()).as("num of queries").isEqualTo(1);
}
@Test
public void instanceHolderStrategy() throws Exception {
// set query count holder strategy
listener.setQueryCountStrategy(new SingleQueryCountHolder());
// perform on main thread
QueryInfo queryInfo = mock(QueryInfo.class);
given(queryInfo.getQuery()).willReturn("insert into emp (id) values (1)");
listener.afterQuery(executionInfo, Collections.singletonList(queryInfo));
// perform on separate thread
final CountDownLatch latch = new CountDownLatch(1);
final AtomicReference<Throwable> failureInThread = new AtomicReference<Throwable>();
final AtomicReference<QueryCount> queryCountFromHolderInDifferentThread = new AtomicReference<QueryCount>();
Runnable threadA = new Runnable() {
@Override
public void run() {
QueryInfo queryInfo = mock(QueryInfo.class);
given(queryInfo.getQuery()).willReturn("select * from emp");
listener.afterQuery(executionInfo, Collections.singletonList(queryInfo));
// verify count within thread
try {
QueryCount queryCountFromThreadLocal = QueryCountHolder.get("testDS");
queryCountFromHolderInDifferentThread.set(queryCountFromThreadLocal);
QueryCount queryCount = listener.getQueryCountStrategy().getOrCreateQueryCount("testDS");
assertThat(queryCount).isNotNull().isInstanceOf(QueryCount.class);
assertThat(queryCount.getSelect()).as("num of select").isEqualTo(1);
assertThat(queryCount.getInsert()).as("num of insert").isEqualTo(1);
assertThat(queryCount.getTotal()).as("num of queries").isEqualTo(2);
} catch (Throwable e) {
failureInThread.set(e);
}
latch.countDown();
}
};
new Thread(threadA).start();
latch.await();
if (failureInThread.get() != null) {
throw new RuntimeException("Verification failure in separate thread", failureInThread.get());
}
// verify count in main thread
QueryCount queryCount = listener.getQueryCountStrategy().getOrCreateQueryCount("testDS");
assertThat(queryCount).isNotNull().isInstanceOf(QueryCount.class);
assertThat(queryCount.getSelect()).as("num of select").isEqualTo(1);
assertThat(queryCount.getInsert()).as("num of insert").isEqualTo(1);
assertThat(queryCount.getTotal()).as("num of queries").isEqualTo(2);
// verify QueryCountHolder.get() performed in separate thread
QueryCount queryCountFromThreadLocal = queryCountFromHolderInDifferentThread.get();
assertThat(queryCountFromThreadLocal)
.as("QueryCountHolder should be populated in separate thread")
.isNotNull()
.isSameAs(queryCount);
}
}
| {
"pile_set_name": "Github"
} |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
// Slim Highlighting for CodeMirror copyright (c) HicknHack Software Gmbh
(function() {
var mode = CodeMirror.getMode({tabSize: 4, indentUnit: 2}, "slim");
function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
// Requires at least one media query
MT("elementName",
"[tag h1] Hey There");
MT("oneElementPerLine",
"[tag h1] Hey There .h2");
MT("idShortcut",
"[attribute&def #test] Hey There");
MT("tagWithIdShortcuts",
"[tag h1][attribute&def #test] Hey There");
MT("classShortcut",
"[attribute&qualifier .hello] Hey There");
MT("tagWithIdAndClassShortcuts",
"[tag h1][attribute&def #test][attribute&qualifier .hello] Hey There");
MT("docType",
"[keyword doctype] xml");
MT("comment",
"[comment / Hello WORLD]");
MT("notComment",
"[tag h1] This is not a / comment ");
MT("attributes",
"[tag a]([attribute title]=[string \"test\"]) [attribute href]=[string \"link\"]}");
MT("multiLineAttributes",
"[tag a]([attribute title]=[string \"test\"]",
" ) [attribute href]=[string \"link\"]}");
MT("htmlCode",
"[tag&bracket <][tag h1][tag&bracket >]Title[tag&bracket </][tag h1][tag&bracket >]");
MT("rubyBlock",
"[operator&special =][variable-2 @item]");
MT("selectorRubyBlock",
"[tag a][attribute&qualifier .test][operator&special =] [variable-2 @item]");
MT("nestedRubyBlock",
"[tag a]",
" [operator&special =][variable puts] [string \"test\"]");
MT("multilinePlaintext",
"[tag p]",
" | Hello,",
" World");
MT("multilineRuby",
"[tag p]",
" [comment /# this is a comment]",
" [comment and this is a comment too]",
" | Date/Time",
" [operator&special -] [variable now] [operator =] [tag DateTime][operator .][property now]",
" [tag strong][operator&special =] [variable now]",
" [operator&special -] [keyword if] [variable now] [operator >] [tag DateTime][operator .][property parse]([string \"December 31, 2006\"])",
" [operator&special =][string \"Happy\"]",
" [operator&special =][string \"Belated\"]",
" [operator&special =][string \"Birthday\"]");
MT("multilineComment",
"[comment /]",
" [comment Multiline]",
" [comment Comment]");
MT("hamlAfterRubyTag",
"[attribute&qualifier .block]",
" [tag strong][operator&special =] [variable now]",
" [attribute&qualifier .test]",
" [operator&special =][variable now]",
" [attribute&qualifier .right]");
MT("stretchedRuby",
"[operator&special =] [variable puts] [string \"Hello\"],",
" [string \"World\"]");
MT("interpolationInHashAttribute",
"[tag div]{[attribute id] = [string \"]#{[variable test]}[string _]#{[variable ting]}[string \"]} test");
MT("interpolationInHTMLAttribute",
"[tag div]([attribute title]=[string \"]#{[variable test]}[string _]#{[variable ting]()}[string \"]) Test");
})();
| {
"pile_set_name": "Github"
} |
class AddTypeToDashboards < ActiveRecord::Migration
def up
add_column :dashboards, :dashboard_type, :string, null: false
execute """
ALTER TABLE dashboards ADD CONSTRAINT valid_dashboard_type_on_dashboards
CHECK (
(
provider = 'slack' AND (
dashboard_type = 'bots-installed' OR
dashboard_type = 'bots-uninstalled' OR
dashboard_type = 'new-users' OR
dashboard_type = 'messages' OR
dashboard_type = 'messages-to-bot' OR
dashboard_type = 'messages-from-bot' OR
dashboard_type = 'custom'
)
) OR
(
provider = 'facebook' AND (
dashboard_type = 'new-users' OR
dashboard_type = 'messages-to-bot' OR
dashboard_type = 'messages-from-bot' OR
dashboard_type = 'custom'
)
) OR
(
provider = 'kik' AND (
dashboard_type = 'new-users' OR
dashboard_type = 'messages-to-bot' OR
dashboard_type = 'messages-from-bot' OR
dashboard_type = 'custom'
)
) OR (
provider = 'telegram'
)
)
"""
end
def down
remove_column :dashboards, :dashboard_type
end
end
| {
"pile_set_name": "Github"
} |
// SPDX-License-Identifier: GPL-2.0-or-later
/* X.509 certificate parser
*
* Copyright (C) 2012 Red Hat, Inc. All Rights Reserved.
* Written by David Howells ([email protected])
*/
#define pr_fmt(fmt) "X.509: "fmt
#include <linux/kernel.h>
#include <linux/export.h>
#include <linux/slab.h>
#include <linux/err.h>
#include <linux/oid_registry.h>
#include <crypto/public_key.h>
#include "x509_parser.h"
#include "x509.asn1.h"
#include "x509_akid.asn1.h"
struct x509_parse_context {
struct x509_certificate *cert; /* Certificate being constructed */
unsigned long data; /* Start of data */
const void *cert_start; /* Start of cert content */
const void *key; /* Key data */
size_t key_size; /* Size of key data */
const void *params; /* Key parameters */
size_t params_size; /* Size of key parameters */
enum OID key_algo; /* Public key algorithm */
enum OID last_oid; /* Last OID encountered */
enum OID algo_oid; /* Algorithm OID */
unsigned char nr_mpi; /* Number of MPIs stored */
u8 o_size; /* Size of organizationName (O) */
u8 cn_size; /* Size of commonName (CN) */
u8 email_size; /* Size of emailAddress */
u16 o_offset; /* Offset of organizationName (O) */
u16 cn_offset; /* Offset of commonName (CN) */
u16 email_offset; /* Offset of emailAddress */
unsigned raw_akid_size;
const void *raw_akid; /* Raw authorityKeyId in ASN.1 */
const void *akid_raw_issuer; /* Raw directoryName in authorityKeyId */
unsigned akid_raw_issuer_size;
};
/*
* Free an X.509 certificate
*/
void x509_free_certificate(struct x509_certificate *cert)
{
if (cert) {
public_key_free(cert->pub);
public_key_signature_free(cert->sig);
kfree(cert->issuer);
kfree(cert->subject);
kfree(cert->id);
kfree(cert->skid);
kfree(cert);
}
}
EXPORT_SYMBOL_GPL(x509_free_certificate);
/*
* Parse an X.509 certificate
*/
struct x509_certificate *x509_cert_parse(const void *data, size_t datalen)
{
struct x509_certificate *cert;
struct x509_parse_context *ctx;
struct asymmetric_key_id *kid;
long ret;
ret = -ENOMEM;
cert = kzalloc(sizeof(struct x509_certificate), GFP_KERNEL);
if (!cert)
goto error_no_cert;
cert->pub = kzalloc(sizeof(struct public_key), GFP_KERNEL);
if (!cert->pub)
goto error_no_ctx;
cert->sig = kzalloc(sizeof(struct public_key_signature), GFP_KERNEL);
if (!cert->sig)
goto error_no_ctx;
ctx = kzalloc(sizeof(struct x509_parse_context), GFP_KERNEL);
if (!ctx)
goto error_no_ctx;
ctx->cert = cert;
ctx->data = (unsigned long)data;
/* Attempt to decode the certificate */
ret = asn1_ber_decoder(&x509_decoder, ctx, data, datalen);
if (ret < 0)
goto error_decode;
/* Decode the AuthorityKeyIdentifier */
if (ctx->raw_akid) {
pr_devel("AKID: %u %*phN\n",
ctx->raw_akid_size, ctx->raw_akid_size, ctx->raw_akid);
ret = asn1_ber_decoder(&x509_akid_decoder, ctx,
ctx->raw_akid, ctx->raw_akid_size);
if (ret < 0) {
pr_warn("Couldn't decode AuthKeyIdentifier\n");
goto error_decode;
}
}
ret = -ENOMEM;
cert->pub->key = kmemdup(ctx->key, ctx->key_size, GFP_KERNEL);
if (!cert->pub->key)
goto error_decode;
cert->pub->keylen = ctx->key_size;
cert->pub->params = kmemdup(ctx->params, ctx->params_size, GFP_KERNEL);
if (!cert->pub->params)
goto error_decode;
cert->pub->paramlen = ctx->params_size;
cert->pub->algo = ctx->key_algo;
/* Grab the signature bits */
ret = x509_get_sig_params(cert);
if (ret < 0)
goto error_decode;
/* Generate cert issuer + serial number key ID */
kid = asymmetric_key_generate_id(cert->raw_serial,
cert->raw_serial_size,
cert->raw_issuer,
cert->raw_issuer_size);
if (IS_ERR(kid)) {
ret = PTR_ERR(kid);
goto error_decode;
}
cert->id = kid;
/* Detect self-signed certificates */
ret = x509_check_for_self_signed(cert);
if (ret < 0)
goto error_decode;
kfree(ctx);
return cert;
error_decode:
kfree(ctx);
error_no_ctx:
x509_free_certificate(cert);
error_no_cert:
return ERR_PTR(ret);
}
EXPORT_SYMBOL_GPL(x509_cert_parse);
/*
* Note an OID when we find one for later processing when we know how
* to interpret it.
*/
int x509_note_OID(void *context, size_t hdrlen,
unsigned char tag,
const void *value, size_t vlen)
{
struct x509_parse_context *ctx = context;
ctx->last_oid = look_up_OID(value, vlen);
if (ctx->last_oid == OID__NR) {
char buffer[50];
sprint_oid(value, vlen, buffer, sizeof(buffer));
pr_debug("Unknown OID: [%lu] %s\n",
(unsigned long)value - ctx->data, buffer);
}
return 0;
}
/*
* Save the position of the TBS data so that we can check the signature over it
* later.
*/
int x509_note_tbs_certificate(void *context, size_t hdrlen,
unsigned char tag,
const void *value, size_t vlen)
{
struct x509_parse_context *ctx = context;
pr_debug("x509_note_tbs_certificate(,%zu,%02x,%ld,%zu)!\n",
hdrlen, tag, (unsigned long)value - ctx->data, vlen);
ctx->cert->tbs = value - hdrlen;
ctx->cert->tbs_size = vlen + hdrlen;
return 0;
}
/*
* Record the public key algorithm
*/
int x509_note_pkey_algo(void *context, size_t hdrlen,
unsigned char tag,
const void *value, size_t vlen)
{
struct x509_parse_context *ctx = context;
pr_debug("PubKey Algo: %u\n", ctx->last_oid);
switch (ctx->last_oid) {
case OID_md2WithRSAEncryption:
case OID_md3WithRSAEncryption:
default:
return -ENOPKG; /* Unsupported combination */
case OID_md4WithRSAEncryption:
ctx->cert->sig->hash_algo = "md4";
goto rsa_pkcs1;
case OID_sha1WithRSAEncryption:
ctx->cert->sig->hash_algo = "sha1";
goto rsa_pkcs1;
case OID_sha256WithRSAEncryption:
ctx->cert->sig->hash_algo = "sha256";
goto rsa_pkcs1;
case OID_sha384WithRSAEncryption:
ctx->cert->sig->hash_algo = "sha384";
goto rsa_pkcs1;
case OID_sha512WithRSAEncryption:
ctx->cert->sig->hash_algo = "sha512";
goto rsa_pkcs1;
case OID_sha224WithRSAEncryption:
ctx->cert->sig->hash_algo = "sha224";
goto rsa_pkcs1;
case OID_gost2012Signature256:
ctx->cert->sig->hash_algo = "streebog256";
goto ecrdsa;
case OID_gost2012Signature512:
ctx->cert->sig->hash_algo = "streebog512";
goto ecrdsa;
}
rsa_pkcs1:
ctx->cert->sig->pkey_algo = "rsa";
ctx->cert->sig->encoding = "pkcs1";
ctx->algo_oid = ctx->last_oid;
return 0;
ecrdsa:
ctx->cert->sig->pkey_algo = "ecrdsa";
ctx->cert->sig->encoding = "raw";
ctx->algo_oid = ctx->last_oid;
return 0;
}
/*
* Note the whereabouts and type of the signature.
*/
int x509_note_signature(void *context, size_t hdrlen,
unsigned char tag,
const void *value, size_t vlen)
{
struct x509_parse_context *ctx = context;
pr_debug("Signature type: %u size %zu\n", ctx->last_oid, vlen);
if (ctx->last_oid != ctx->algo_oid) {
pr_warn("Got cert with pkey (%u) and sig (%u) algorithm OIDs\n",
ctx->algo_oid, ctx->last_oid);
return -EINVAL;
}
if (strcmp(ctx->cert->sig->pkey_algo, "rsa") == 0 ||
strcmp(ctx->cert->sig->pkey_algo, "ecrdsa") == 0) {
/* Discard the BIT STRING metadata */
if (vlen < 1 || *(const u8 *)value != 0)
return -EBADMSG;
value++;
vlen--;
}
ctx->cert->raw_sig = value;
ctx->cert->raw_sig_size = vlen;
return 0;
}
/*
* Note the certificate serial number
*/
int x509_note_serial(void *context, size_t hdrlen,
unsigned char tag,
const void *value, size_t vlen)
{
struct x509_parse_context *ctx = context;
ctx->cert->raw_serial = value;
ctx->cert->raw_serial_size = vlen;
return 0;
}
/*
* Note some of the name segments from which we'll fabricate a name.
*/
int x509_extract_name_segment(void *context, size_t hdrlen,
unsigned char tag,
const void *value, size_t vlen)
{
struct x509_parse_context *ctx = context;
switch (ctx->last_oid) {
case OID_commonName:
ctx->cn_size = vlen;
ctx->cn_offset = (unsigned long)value - ctx->data;
break;
case OID_organizationName:
ctx->o_size = vlen;
ctx->o_offset = (unsigned long)value - ctx->data;
break;
case OID_email_address:
ctx->email_size = vlen;
ctx->email_offset = (unsigned long)value - ctx->data;
break;
default:
break;
}
return 0;
}
/*
* Fabricate and save the issuer and subject names
*/
static int x509_fabricate_name(struct x509_parse_context *ctx, size_t hdrlen,
unsigned char tag,
char **_name, size_t vlen)
{
const void *name, *data = (const void *)ctx->data;
size_t namesize;
char *buffer;
if (*_name)
return -EINVAL;
/* Empty name string if no material */
if (!ctx->cn_size && !ctx->o_size && !ctx->email_size) {
buffer = kmalloc(1, GFP_KERNEL);
if (!buffer)
return -ENOMEM;
buffer[0] = 0;
goto done;
}
if (ctx->cn_size && ctx->o_size) {
/* Consider combining O and CN, but use only the CN if it is
* prefixed by the O, or a significant portion thereof.
*/
namesize = ctx->cn_size;
name = data + ctx->cn_offset;
if (ctx->cn_size >= ctx->o_size &&
memcmp(data + ctx->cn_offset, data + ctx->o_offset,
ctx->o_size) == 0)
goto single_component;
if (ctx->cn_size >= 7 &&
ctx->o_size >= 7 &&
memcmp(data + ctx->cn_offset, data + ctx->o_offset, 7) == 0)
goto single_component;
buffer = kmalloc(ctx->o_size + 2 + ctx->cn_size + 1,
GFP_KERNEL);
if (!buffer)
return -ENOMEM;
memcpy(buffer,
data + ctx->o_offset, ctx->o_size);
buffer[ctx->o_size + 0] = ':';
buffer[ctx->o_size + 1] = ' ';
memcpy(buffer + ctx->o_size + 2,
data + ctx->cn_offset, ctx->cn_size);
buffer[ctx->o_size + 2 + ctx->cn_size] = 0;
goto done;
} else if (ctx->cn_size) {
namesize = ctx->cn_size;
name = data + ctx->cn_offset;
} else if (ctx->o_size) {
namesize = ctx->o_size;
name = data + ctx->o_offset;
} else {
namesize = ctx->email_size;
name = data + ctx->email_offset;
}
single_component:
buffer = kmalloc(namesize + 1, GFP_KERNEL);
if (!buffer)
return -ENOMEM;
memcpy(buffer, name, namesize);
buffer[namesize] = 0;
done:
*_name = buffer;
ctx->cn_size = 0;
ctx->o_size = 0;
ctx->email_size = 0;
return 0;
}
int x509_note_issuer(void *context, size_t hdrlen,
unsigned char tag,
const void *value, size_t vlen)
{
struct x509_parse_context *ctx = context;
ctx->cert->raw_issuer = value;
ctx->cert->raw_issuer_size = vlen;
return x509_fabricate_name(ctx, hdrlen, tag, &ctx->cert->issuer, vlen);
}
int x509_note_subject(void *context, size_t hdrlen,
unsigned char tag,
const void *value, size_t vlen)
{
struct x509_parse_context *ctx = context;
ctx->cert->raw_subject = value;
ctx->cert->raw_subject_size = vlen;
return x509_fabricate_name(ctx, hdrlen, tag, &ctx->cert->subject, vlen);
}
/*
* Extract the parameters for the public key
*/
int x509_note_params(void *context, size_t hdrlen,
unsigned char tag,
const void *value, size_t vlen)
{
struct x509_parse_context *ctx = context;
/*
* AlgorithmIdentifier is used three times in the x509, we should skip
* first and ignore third, using second one which is after subject and
* before subjectPublicKey.
*/
if (!ctx->cert->raw_subject || ctx->key)
return 0;
ctx->params = value - hdrlen;
ctx->params_size = vlen + hdrlen;
return 0;
}
/*
* Extract the data for the public key algorithm
*/
int x509_extract_key_data(void *context, size_t hdrlen,
unsigned char tag,
const void *value, size_t vlen)
{
struct x509_parse_context *ctx = context;
ctx->key_algo = ctx->last_oid;
if (ctx->last_oid == OID_rsaEncryption)
ctx->cert->pub->pkey_algo = "rsa";
else if (ctx->last_oid == OID_gost2012PKey256 ||
ctx->last_oid == OID_gost2012PKey512)
ctx->cert->pub->pkey_algo = "ecrdsa";
else
return -ENOPKG;
/* Discard the BIT STRING metadata */
if (vlen < 1 || *(const u8 *)value != 0)
return -EBADMSG;
ctx->key = value + 1;
ctx->key_size = vlen - 1;
return 0;
}
/* The keyIdentifier in AuthorityKeyIdentifier SEQUENCE is tag(CONT,PRIM,0) */
#define SEQ_TAG_KEYID (ASN1_CONT << 6)
/*
* Process certificate extensions that are used to qualify the certificate.
*/
int x509_process_extension(void *context, size_t hdrlen,
unsigned char tag,
const void *value, size_t vlen)
{
struct x509_parse_context *ctx = context;
struct asymmetric_key_id *kid;
const unsigned char *v = value;
pr_debug("Extension: %u\n", ctx->last_oid);
if (ctx->last_oid == OID_subjectKeyIdentifier) {
/* Get hold of the key fingerprint */
if (ctx->cert->skid || vlen < 3)
return -EBADMSG;
if (v[0] != ASN1_OTS || v[1] != vlen - 2)
return -EBADMSG;
v += 2;
vlen -= 2;
ctx->cert->raw_skid_size = vlen;
ctx->cert->raw_skid = v;
kid = asymmetric_key_generate_id(v, vlen, "", 0);
if (IS_ERR(kid))
return PTR_ERR(kid);
ctx->cert->skid = kid;
pr_debug("subjkeyid %*phN\n", kid->len, kid->data);
return 0;
}
if (ctx->last_oid == OID_authorityKeyIdentifier) {
/* Get hold of the CA key fingerprint */
ctx->raw_akid = v;
ctx->raw_akid_size = vlen;
return 0;
}
return 0;
}
/**
* x509_decode_time - Decode an X.509 time ASN.1 object
* @_t: The time to fill in
* @hdrlen: The length of the object header
* @tag: The object tag
* @value: The object value
* @vlen: The size of the object value
*
* Decode an ASN.1 universal time or generalised time field into a struct the
* kernel can handle and check it for validity. The time is decoded thus:
*
* [RFC5280 §4.1.2.5]
* CAs conforming to this profile MUST always encode certificate validity
* dates through the year 2049 as UTCTime; certificate validity dates in
* 2050 or later MUST be encoded as GeneralizedTime. Conforming
* applications MUST be able to process validity dates that are encoded in
* either UTCTime or GeneralizedTime.
*/
int x509_decode_time(time64_t *_t, size_t hdrlen,
unsigned char tag,
const unsigned char *value, size_t vlen)
{
static const unsigned char month_lengths[] = { 31, 28, 31, 30, 31, 30,
31, 31, 30, 31, 30, 31 };
const unsigned char *p = value;
unsigned year, mon, day, hour, min, sec, mon_len;
#define dec2bin(X) ({ unsigned char x = (X) - '0'; if (x > 9) goto invalid_time; x; })
#define DD2bin(P) ({ unsigned x = dec2bin(P[0]) * 10 + dec2bin(P[1]); P += 2; x; })
if (tag == ASN1_UNITIM) {
/* UTCTime: YYMMDDHHMMSSZ */
if (vlen != 13)
goto unsupported_time;
year = DD2bin(p);
if (year >= 50)
year += 1900;
else
year += 2000;
} else if (tag == ASN1_GENTIM) {
/* GenTime: YYYYMMDDHHMMSSZ */
if (vlen != 15)
goto unsupported_time;
year = DD2bin(p) * 100 + DD2bin(p);
if (year >= 1950 && year <= 2049)
goto invalid_time;
} else {
goto unsupported_time;
}
mon = DD2bin(p);
day = DD2bin(p);
hour = DD2bin(p);
min = DD2bin(p);
sec = DD2bin(p);
if (*p != 'Z')
goto unsupported_time;
if (year < 1970 ||
mon < 1 || mon > 12)
goto invalid_time;
mon_len = month_lengths[mon - 1];
if (mon == 2) {
if (year % 4 == 0) {
mon_len = 29;
if (year % 100 == 0) {
mon_len = 28;
if (year % 400 == 0)
mon_len = 29;
}
}
}
if (day < 1 || day > mon_len ||
hour > 24 || /* ISO 8601 permits 24:00:00 as midnight tomorrow */
min > 59 ||
sec > 60) /* ISO 8601 permits leap seconds [X.680 46.3] */
goto invalid_time;
*_t = mktime64(year, mon, day, hour, min, sec);
return 0;
unsupported_time:
pr_debug("Got unsupported time [tag %02x]: '%*phN'\n",
tag, (int)vlen, value);
return -EBADMSG;
invalid_time:
pr_debug("Got invalid time [tag %02x]: '%*phN'\n",
tag, (int)vlen, value);
return -EBADMSG;
}
EXPORT_SYMBOL_GPL(x509_decode_time);
int x509_note_not_before(void *context, size_t hdrlen,
unsigned char tag,
const void *value, size_t vlen)
{
struct x509_parse_context *ctx = context;
return x509_decode_time(&ctx->cert->valid_from, hdrlen, tag, value, vlen);
}
int x509_note_not_after(void *context, size_t hdrlen,
unsigned char tag,
const void *value, size_t vlen)
{
struct x509_parse_context *ctx = context;
return x509_decode_time(&ctx->cert->valid_to, hdrlen, tag, value, vlen);
}
/*
* Note a key identifier-based AuthorityKeyIdentifier
*/
int x509_akid_note_kid(void *context, size_t hdrlen,
unsigned char tag,
const void *value, size_t vlen)
{
struct x509_parse_context *ctx = context;
struct asymmetric_key_id *kid;
pr_debug("AKID: keyid: %*phN\n", (int)vlen, value);
if (ctx->cert->sig->auth_ids[1])
return 0;
kid = asymmetric_key_generate_id(value, vlen, "", 0);
if (IS_ERR(kid))
return PTR_ERR(kid);
pr_debug("authkeyid %*phN\n", kid->len, kid->data);
ctx->cert->sig->auth_ids[1] = kid;
return 0;
}
/*
* Note a directoryName in an AuthorityKeyIdentifier
*/
int x509_akid_note_name(void *context, size_t hdrlen,
unsigned char tag,
const void *value, size_t vlen)
{
struct x509_parse_context *ctx = context;
pr_debug("AKID: name: %*phN\n", (int)vlen, value);
ctx->akid_raw_issuer = value;
ctx->akid_raw_issuer_size = vlen;
return 0;
}
/*
* Note a serial number in an AuthorityKeyIdentifier
*/
int x509_akid_note_serial(void *context, size_t hdrlen,
unsigned char tag,
const void *value, size_t vlen)
{
struct x509_parse_context *ctx = context;
struct asymmetric_key_id *kid;
pr_debug("AKID: serial: %*phN\n", (int)vlen, value);
if (!ctx->akid_raw_issuer || ctx->cert->sig->auth_ids[0])
return 0;
kid = asymmetric_key_generate_id(value,
vlen,
ctx->akid_raw_issuer,
ctx->akid_raw_issuer_size);
if (IS_ERR(kid))
return PTR_ERR(kid);
pr_debug("authkeyid %*phN\n", kid->len, kid->data);
ctx->cert->sig->auth_ids[0] = kid;
return 0;
}
| {
"pile_set_name": "Github"
} |
@import 'logcat-variables.less';
@import '/static/global/less/global-variables.less';
@import '/static/global/less/global-base.less';
@import '/static/global/less/page-panel.less';
.logcat-pagecontent-container
{
.page-content-container();
}
.logcat-panel-nonbackground
{
.page-panel(none);
}
.logcat-panel-head-nonbackground
{
.page-panel-head(none,1px solid @listitem_border_color);
}
.logcat-panel-body-nonbackground
{
.page-panel-body(none,none);
}
.logcat-panel-footer-nonbackground
{
.page-panel-footer(none);
}
.logcat-panel-head-danger
{
.page-panel-head(none,1px solid red);
color:red;
}
| {
"pile_set_name": "Github"
} |
/*!
* \file main.c
*
* \brief Radio sensitivity test
*
* \remark When LED1 stops blinking LoRa packets aren't received any more and
* the sensitivity level has been reached.
* By reading the RF generator output power we can estimate the board
* sensitivity
*
* \copyright Revised BSD License, see section \ref LICENSE.
*
* \code
* ______ _
* / _____) _ | |
* ( (____ _____ ____ _| |_ _____ ____| |__
* \____ \| ___ | (_ _) ___ |/ ___) _ \
* _____) ) ____| | | || |_| ____( (___| | | |
* (______/|_____)_|_|_| \__)_____)\____)_| |_|
* (C)2013-2017 Semtech
*
* \endcode
*
* \author Miguel Luis ( Semtech )
*
* \author Gregory Cristian ( Semtech )
*/
#include "board.h"
#include "gpio.h"
#include "timer.h"
#include "radio.h"
#if defined( REGION_AS923 )
#define RF_FREQUENCY 923000000 // Hz
#elif defined( REGION_AU915 )
#define RF_FREQUENCY 915000000 // Hz
#elif defined( REGION_CN779 )
#define RF_FREQUENCY 779000000 // Hz
#elif defined( REGION_EU868 )
#define RF_FREQUENCY 868000000 // Hz
#elif defined( REGION_KR920 )
#define RF_FREQUENCY 920000000 // Hz
#elif defined( REGION_IN865 )
#define RF_FREQUENCY 865000000 // Hz
#elif defined( REGION_US915 )
#define RF_FREQUENCY 915000000 // Hz
#elif defined( REGION_RU864 )
#define RF_FREQUENCY 864000000 // Hz
#else
#error "Please define a frequency band in the compiler options."
#endif
#if defined( USE_MODEM_LORA )
#define LORA_BANDWIDTH 0 // [0: 125 kHz,
// 1: 250 kHz,
// 2: 500 kHz,
// 3: Reserved]
#define LORA_SPREADING_FACTOR 10 // [SF7..SF12]
#define LORA_CODINGRATE 1 // [1: 4/5,
// 2: 4/6,
// 3: 4/7,
// 4: 4/8]
#define LORA_SYMBOL_TIMEOUT 5 // Symbols
#define LORA_PREAMBLE_LENGTH 8 // Same for Tx and Rx
#define LORA_FIX_LENGTH_PAYLOAD_ON false
#define LORA_IQ_INVERSION_ON false
#elif defined( USE_MODEM_FSK )
#define FSK_DATARATE 50000 // bps
#define FSK_BANDWIDTH 50000 // Hz
#define FSK_AFC_BANDWIDTH 83333 // Hz
#define FSK_PREAMBLE_LENGTH 5 // Same for Tx and Rx
#define FSK_FIX_LENGTH_PAYLOAD_ON false
#else
#error "Please define a modem in the compiler options."
#endif
/*!
* Radio events function pointer
*/
static RadioEvents_t RadioEvents;
/*!
* LED GPIO pins objects
*/
extern Gpio_t Led4;
/*!
* \brief Function to be executed on Radio Rx Done event
*/
void OnRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr );
/*!
* Main application entry point.
*/
int main( void )
{
// Target board initialization
BoardInitMcu( );
BoardInitPeriph( );
// Radio initialization
RadioEvents.RxDone = OnRxDone;
Radio.Init( &RadioEvents );
Radio.SetChannel( RF_FREQUENCY );
#if defined( USE_MODEM_LORA )
Radio.SetRxConfig( MODEM_LORA, LORA_BANDWIDTH, LORA_SPREADING_FACTOR,
LORA_CODINGRATE, 0, LORA_PREAMBLE_LENGTH,
LORA_SYMBOL_TIMEOUT, LORA_FIX_LENGTH_PAYLOAD_ON,
0, true, 0, 0, LORA_IQ_INVERSION_ON, true );
Radio.SetMaxPayloadLength( MODEM_LORA, 255 );
#elif defined( USE_MODEM_FSK )
Radio.SetRxConfig( MODEM_FSK, FSK_BANDWIDTH, FSK_DATARATE,
0, FSK_AFC_BANDWIDTH, FSK_PREAMBLE_LENGTH,
0, FSK_FIX_LENGTH_PAYLOAD_ON, 0, true,
0, 0, false, true );
Radio.SetMaxPayloadLength( MODEM_FSK, 255 );
#else
#error "Please define a frequency band in the compiler options."
#endif
Radio.Rx( 0 ); // Continuous Rx
while( 1 )
{
BoardLowPowerHandler( );
}
}
void OnRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr )
{
static uint8_t ledState = 1;
// Toggle LED 4
ledState ^= 1;
GpioWrite( &Led4, ledState );
}
| {
"pile_set_name": "Github"
} |
// Copyright 2016 Ismael Jimenez Martinez. 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.
// Source project : https://github.com/ismaelJimenez/cpp.leastsq
// Adapted to be used with google benchmark
#ifndef COMPLEXITY_H_
#define COMPLEXITY_H_
#include <string>
#include <vector>
#include "benchmark/benchmark.h"
namespace benchmark {
// Return a vector containing the bigO and RMS information for the specified
// list of reports. If 'reports.size() < 2' an empty vector is returned.
std::vector<BenchmarkReporter::Run> ComputeBigO(
const std::vector<BenchmarkReporter::Run>& reports);
// This data structure will contain the result returned by MinimalLeastSq
// - coef : Estimated coeficient for the high-order term as
// interpolated from data.
// - rms : Normalized Root Mean Squared Error.
// - complexity : Scalability form (e.g. oN, oNLogN). In case a scalability
// form has been provided to MinimalLeastSq this will return
// the same value. In case BigO::oAuto has been selected, this
// parameter will return the best fitting curve detected.
struct LeastSq {
LeastSq() : coef(0.0), rms(0.0), complexity(oNone) {}
double coef;
double rms;
BigO complexity;
};
// Function to return an string for the calculated complexity
std::string GetBigOString(BigO complexity);
} // end namespace benchmark
#endif // COMPLEXITY_H_
| {
"pile_set_name": "Github"
} |
/*=============================================================================
Copyright (c) 2011 Hartmut Kaiser
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(BOOST_PHOENIX_PREPROCESSED_BIND_FUNCTION_OBJECT_HPP)
#define BOOST_PHOENIX_PREPROCESSED_BIND_FUNCTION_OBJECT_HPP
#if BOOST_PHOENIX_LIMIT <= 10
#include <boost/phoenix/bind/detail/cpp03/preprocessed/bind_function_object_10.hpp>
#elif BOOST_PHOENIX_LIMIT <= 20
#include <boost/phoenix/bind/detail/cpp03/preprocessed/bind_function_object_20.hpp>
#elif BOOST_PHOENIX_LIMIT <= 30
#include <boost/phoenix/bind/detail/cpp03/preprocessed/bind_function_object_30.hpp>
#elif BOOST_PHOENIX_LIMIT <= 40
#include <boost/phoenix/bind/detail/cpp03/preprocessed/bind_function_object_40.hpp>
#elif BOOST_PHOENIX_LIMIT <= 50
#include <boost/phoenix/bind/detail/cpp03/preprocessed/bind_function_object_50.hpp>
#else
#error "BOOST_PHOENIX_LIMIT out of bounds for preprocessed headers"
#endif
#endif
| {
"pile_set_name": "Github"
} |
// Package assert provides a set of comprehensive testing tools for use with the normal Go testing system.
//
// Example Usage
//
// The following is a complete example using assert in a standard test function:
// import (
// "testing"
// "github.com/stretchr/testify/assert"
// )
//
// func TestSomething(t *testing.T) {
//
// var a string = "Hello"
// var b string = "Hello"
//
// assert.Equal(t, a, b, "The two words should be the same.")
//
// }
//
// if you assert many times, use the format below:
//
// import (
// "testing"
// "github.com/stretchr/testify/assert"
// )
//
// func TestSomething(t *testing.T) {
// assert := assert.New(t)
//
// var a string = "Hello"
// var b string = "Hello"
//
// assert.Equal(a, b, "The two words should be the same.")
// }
//
// Assertions
//
// Assertions allow you to easily write test code, and are global funcs in the `assert` package.
// All assertion functions take, as the first argument, the `*testing.T` object provided by the
// testing framework. This allows the assertion funcs to write the failings and other details to
// the correct place.
//
// Every assertion function also takes an optional string message as the final argument,
// allowing custom error messages to be appended to the message the assertion method outputs.
package assert
| {
"pile_set_name": "Github"
} |
/*
* Copyright (C) 2016 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.errai.ui.test.basic.client.res;
import javax.inject.Inject;
import org.jboss.errai.common.client.dom.Span;
import org.jboss.errai.ui.shared.api.annotations.DataField;
import org.jboss.errai.ui.shared.api.annotations.Templated;
/**
*
* @author Max Barkley <[email protected]>
*/
@Templated(value = "less-styled-template.html", stylesheet = "/org/jboss/errai/ui/test/basic/client/res/less-style.less")
public class LessStyledComponentAbsolute {
@Inject
@DataField
public Span styled;
}
| {
"pile_set_name": "Github"
} |
#ifndef LIBC_H
#define LIBC_H
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
struct __locale_map;
struct __locale_struct {
const struct __locale_map *cat[6];
};
struct tls_module {
struct tls_module *next;
void *image;
size_t len, size, align, offset;
};
struct __libc {
int can_do_threads;
int threaded;
int secure;
volatile int threads_minus_1;
size_t *auxv;
struct tls_module *tls_head;
size_t tls_size, tls_align, tls_cnt;
size_t page_size;
struct __locale_struct global_locale;
};
#ifndef PAGE_SIZE
#define PAGE_SIZE libc.page_size
#endif
extern hidden struct __libc __libc;
#define libc __libc
hidden void __init_libc(char **, char *);
hidden void __init_tls(size_t *);
hidden void __init_ssp(void *);
hidden void __libc_start_init(void);
hidden void __funcs_on_exit(void);
hidden void __funcs_on_quick_exit(void);
hidden void __libc_exit_fini(void);
hidden void __fork_handler(int);
extern hidden size_t __hwcap;
extern hidden size_t __sysinfo;
extern char *__progname, *__progname_full;
extern hidden const char __libc_version[];
hidden void __synccall(void (*)(void *), void *);
hidden int __setxid(int, int, int, int);
#endif
| {
"pile_set_name": "Github"
} |
package org.orienteer.core.component.visualizer;
import com.orientechnologies.orient.core.metadata.schema.OProperty;
import com.orientechnologies.orient.core.metadata.schema.OType;
import com.orientechnologies.orient.core.record.impl.ODocument;
import org.apache.wicket.Component;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.orienteer.core.component.editor.SqlEditorPanel;
import org.orienteer.core.component.property.DisplayMode;
/**
* Visualizer for SQL code editor
*/
public class SqlCodeVisualizer extends AbstractSimpleVisualizer {
public static final String NAME = "sql";
public SqlCodeVisualizer() {
super(NAME, false, OType.STRING);
}
@Override
@SuppressWarnings("unchecked")
public <V> Component createComponent(String id, DisplayMode mode, IModel<ODocument> documentModel,
IModel<OProperty> propertyModel, IModel<V> valueModel) {
return new SqlEditorPanel(id, (IModel<String>) valueModel, Model.of(mode));
}
}
| {
"pile_set_name": "Github"
} |
/*(*
*
* Copyright (c) 2001-2003,
* George C. Necula <[email protected]>
* Scott McPeak <[email protected]>
* Wes Weimer <[email protected]>
* Ben Liblit <[email protected]>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. The names of the contributors may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
**)
(**
** 1.0 3.22.99 Hugues Cassé First version.
** 2.0 George Necula 12/12/00: Practically complete rewrite.
*)
*/
%{
open Cabs
open Cabshelper
module E = Errormsg
let parse_error msg : unit = (* sm: c++-mode highlight hack: -> ' <- *)
E.parse_error msg
let print = print_string
(* unit -> string option *)
(*
let getComments () =
match !comments with
[] -> None
| _ ->
let r = Some(String.concat "\n" (List.rev !comments)) in
comments := [];
r
*)
let cabslu = {lineno = -10;
filename = "cabs loc unknown";
byteno = -10;
ident = 0;}
(* cabsloc -> cabsloc *)
(*
let handleLoc l =
l.clcomment <- getComments();
l
*)
(*
** Expression building
*)
let smooth_expression lst =
match lst with
[] -> NOTHING
| [expr] -> expr
| _ -> COMMA (lst)
let currentFunctionName = ref "<outside any function>"
let announceFunctionName ((n, decl, _, _):name) =
!Lexerhack.add_identifier n;
(* Start a context that includes the parameter names and the whole body.
* Will pop when we finish parsing the function body *)
!Lexerhack.push_context ();
(* Go through all the parameter names and mark them as identifiers *)
let rec findProto = function
PROTO (d, args, _) when isJUSTBASE d ->
List.iter (fun (_, (an, _, _, _)) -> !Lexerhack.add_identifier an) args
| PROTO (d, _, _) -> findProto d
| PARENTYPE (_, d, _) -> findProto d
| PTR (_, d) -> findProto d
| ARRAY (d, _, _) -> findProto d
| _ -> parse_error "Cannot find the prototype in a function definition";
raise Parsing.Parse_error
and isJUSTBASE = function
JUSTBASE -> true
| PARENTYPE (_, d, _) -> isJUSTBASE d
| _ -> false
in
findProto decl;
currentFunctionName := n
let applyPointer (ptspecs: attribute list list) (dt: decl_type)
: decl_type =
(* Outer specification first *)
let rec loop = function
[] -> dt
| attrs :: rest -> PTR(attrs, loop rest)
in
loop ptspecs
let doDeclaration (loc: cabsloc) (specs: spec_elem list) (nl: init_name list) : definition =
if isTypedef specs then begin
(* Tell the lexer about the new type names *)
List.iter (fun ((n, _, _, _), _) -> !Lexerhack.add_type n) nl;
TYPEDEF ((specs, List.map (fun (n, _) -> n) nl), loc)
end else
if nl = [] then
ONLYTYPEDEF (specs, loc)
else begin
(* Tell the lexer about the new variable names *)
List.iter (fun ((n, _, _, _), _) -> !Lexerhack.add_identifier n) nl;
DECDEF ((specs, nl), loc)
end
let doFunctionDef (loc: cabsloc)
(lend: cabsloc)
(specs: spec_elem list)
(n: name)
(b: block) : definition =
let fname = (specs, n) in
FUNDEF (fname, b, loc, lend)
let doOldParDecl (names: string list)
((pardefs: name_group list), (isva: bool))
: single_name list * bool =
let findOneName n =
(* Search in pardefs for the definition for this parameter *)
let rec loopGroups = function
[] -> ([SpecType Tint], (n, JUSTBASE, [], cabslu))
| (specs, names) :: restgroups ->
let rec loopNames = function
[] -> loopGroups restgroups
| ((n',_, _, _) as sn) :: _ when n' = n -> (specs, sn)
| _ :: restnames -> loopNames restnames
in
loopNames names
in
loopGroups pardefs
in
let args = List.map findOneName names in
(args, isva)
let checkConnective (s : string) : unit =
begin
(* checking this means I could possibly have more connectives, with *)
(* different meaning *)
if (s <> "to") then (
parse_error "transformer connective must be 'to'";
raise Parsing.Parse_error
)
else ()
end
let int64_to_char value =
if (compare value (Int64.of_int 255) > 0) || (compare value Int64.zero < 0) then
begin
let msg = Printf.sprintf "cparser:intlist_to_string: character 0x%Lx too big" value in
parse_error msg;
raise Parsing.Parse_error
end
else
Char.chr (Int64.to_int value)
(* takes a not-nul-terminated list, and converts it to a string. *)
let rec intlist_to_string (str: int64 list):string =
match str with
[] -> "" (* add nul-termination *)
| value::rest ->
let this_char = int64_to_char value in
(String.make 1 this_char) ^ (intlist_to_string rest)
let fst3 (result, _, _) = result
let snd3 (_, result, _) = result
let trd3 (_, _, result) = result
(*
transform: __builtin_offsetof(type, member)
into : (size_t) (&(type * ) 0)->member
*)
let transformOffsetOf (speclist, dtype) member =
let rec addPointer = function
| JUSTBASE ->
PTR([], JUSTBASE)
| PARENTYPE (attrs1, dtype, attrs2) ->
PARENTYPE (attrs1, addPointer dtype, attrs2)
| ARRAY (dtype, attrs, expr) ->
ARRAY (addPointer dtype, attrs, expr)
| PTR (attrs, dtype) ->
PTR (attrs, addPointer dtype)
| PROTO (dtype, names, variadic) ->
PROTO (addPointer dtype, names, variadic)
in
let nullType = (speclist, addPointer dtype) in
let nullExpr = CONSTANT (CONST_INT "0") in
let castExpr = CAST (nullType, SINGLE_INIT nullExpr) in
let rec replaceBase = function
| VARIABLE field ->
MEMBEROFPTR (castExpr, field)
| MEMBEROF (base, field) ->
MEMBEROF (replaceBase base, field)
| INDEX (base, index) ->
INDEX (replaceBase base, index)
| _ ->
parse_error "malformed offset expression in __builtin_offsetof";
raise Parsing.Parse_error
in
let memberExpr = replaceBase member in
let addrExpr = UNARY (ADDROF, memberExpr) in
(* slight cheat: hard-coded assumption that size_t == unsigned int *)
let sizeofType = [SpecType Tunsigned], JUSTBASE in
let resultExpr = CAST (sizeofType, SINGLE_INIT addrExpr) in
resultExpr
%}
%token <string * Cabs.cabsloc> IDENT
%token <string * Cabs.cabsloc> QUALIFIER
%token <int64 list * Cabs.cabsloc> CST_CHAR
%token <int64 list * Cabs.cabsloc> CST_WCHAR
%token <string * Cabs.cabsloc> CST_INT
%token <string * Cabs.cabsloc> CST_FLOAT
%token <string * Cabs.cabsloc> NAMED_TYPE
/* Each character is its own list element, and the terminating nul is not
included in this list. */
%token <int64 list * Cabs.cabsloc> CST_STRING
%token <int64 list * Cabs.cabsloc> CST_WSTRING
%token EOF
%token<Cabs.cabsloc> CHAR INT BOOL DOUBLE FLOAT VOID INT64 INT32
%token<Cabs.cabsloc> ENUM STRUCT TYPEDEF UNION
%token<Cabs.cabsloc> SIGNED UNSIGNED LONG SHORT
%token<Cabs.cabsloc> VOLATILE EXTERN STATIC CONST RESTRICT AUTO REGISTER
%token<Cabs.cabsloc> THREAD
%token<Cabs.cabsloc> SIZEOF ALIGNOF
%token EQ PLUS_EQ MINUS_EQ STAR_EQ SLASH_EQ PERCENT_EQ
%token AND_EQ PIPE_EQ CIRC_EQ INF_INF_EQ SUP_SUP_EQ
%token ARROW DOT
%token EQ_EQ EXCLAM_EQ INF SUP INF_EQ SUP_EQ
%token<Cabs.cabsloc> PLUS MINUS STAR
%token SLASH PERCENT
%token<Cabs.cabsloc> TILDE AND
%token PIPE CIRC
%token<Cabs.cabsloc> EXCLAM AND_AND
%token PIPE_PIPE
%token INF_INF SUP_SUP
%token<Cabs.cabsloc> PLUS_PLUS MINUS_MINUS
%token RPAREN
%token<Cabs.cabsloc> LPAREN RBRACE
%token<Cabs.cabsloc> LBRACE
%token LBRACKET RBRACKET
%token COLON
%token<Cabs.cabsloc> SEMICOLON
%token COMMA ELLIPSIS QUEST
%token<Cabs.cabsloc> BREAK CONTINUE GOTO RETURN
%token<Cabs.cabsloc> SWITCH CASE DEFAULT
%token<Cabs.cabsloc> WHILE DO FOR
%token<Cabs.cabsloc> IF TRY EXCEPT FINALLY
%token ELSE
%token<Cabs.cabsloc> ATTRIBUTE INLINE ASM TYPEOF FUNCTION__ PRETTY_FUNCTION__
%token LABEL__
%token<Cabs.cabsloc> BUILTIN_VA_ARG ATTRIBUTE_USED
%token BUILTIN_VA_LIST
%token BLOCKATTRIBUTE
%token<Cabs.cabsloc> BUILTIN_TYPES_COMPAT BUILTIN_OFFSETOF
%token<Cabs.cabsloc> DECLSPEC
%token<string * Cabs.cabsloc> MSASM MSATTR
%token<string * Cabs.cabsloc> PRAGMA_LINE
%token<Cabs.cabsloc> PRAGMA
%token PRAGMA_EOL
/* sm: cabs tree transformation specification keywords */
%token<Cabs.cabsloc> AT_TRANSFORM AT_TRANSFORMEXPR AT_SPECIFIER AT_EXPR
%token AT_NAME
/* operator precedence */
%nonassoc IF
%nonassoc ELSE
%left COMMA
%right EQ PLUS_EQ MINUS_EQ STAR_EQ SLASH_EQ PERCENT_EQ
AND_EQ PIPE_EQ CIRC_EQ INF_INF_EQ SUP_SUP_EQ
%right QUEST COLON
%left PIPE_PIPE
%left AND_AND
%left PIPE
%left CIRC
%left AND
%left EQ_EQ EXCLAM_EQ
%left INF SUP INF_EQ SUP_EQ
%left INF_INF SUP_SUP
%left PLUS MINUS
%left STAR SLASH PERCENT CONST RESTRICT VOLATILE
%right EXCLAM TILDE PLUS_PLUS MINUS_MINUS CAST RPAREN ADDROF SIZEOF ALIGNOF
%left LBRACKET
%left DOT ARROW LPAREN LBRACE
%right NAMED_TYPE /* We'll use this to handle redefinitions of
* NAMED_TYPE as variables */
%left IDENT
/* Non-terminals informations */
%start interpret file
%type <Cabs.definition list> file interpret globals
%type <Cabs.definition> global
%type <Cabs.attribute list> attributes attributes_with_asm asmattr
%type <Cabs.statement> statement
%type <Cabs.constant * cabsloc> constant
%type <string * cabsloc> string_constant
%type <Cabs.expression * cabsloc> expression
%type <Cabs.expression> opt_expression
%type <Cabs.init_expression> init_expression
%type <Cabs.expression list * cabsloc> comma_expression
%type <Cabs.expression list * cabsloc> paren_comma_expression
%type <Cabs.expression list> arguments
%type <Cabs.expression list> bracket_comma_expression
%type <int64 list Queue.t * cabsloc> string_list
%type <int64 list * cabsloc> wstring_list
%type <Cabs.initwhat * Cabs.init_expression> initializer
%type <(Cabs.initwhat * Cabs.init_expression) list> initializer_list
%type <Cabs.initwhat> init_designators init_designators_opt
%type <spec_elem list * cabsloc> decl_spec_list
%type <typeSpecifier * cabsloc> type_spec
%type <Cabs.field_group list> struct_decl_list
%type <Cabs.name> old_proto_decl
%type <Cabs.single_name> parameter_decl
%type <Cabs.enum_item> enumerator
%type <Cabs.enum_item list> enum_list
%type <Cabs.definition> declaration function_def
%type <cabsloc * spec_elem list * name> function_def_start
%type <Cabs.spec_elem list * Cabs.decl_type> type_name
%type <Cabs.block * cabsloc * cabsloc> block
%type <Cabs.statement list> block_element_list
%type <string list> local_labels local_label_names
%type <string list> old_parameter_list_ne
%type <Cabs.init_name> init_declarator
%type <Cabs.init_name list> init_declarator_list
%type <Cabs.name> declarator
%type <Cabs.name * expression option> field_decl
%type <(Cabs.name * expression option) list> field_decl_list
%type <string * Cabs.decl_type> direct_decl
%type <Cabs.decl_type> abs_direct_decl abs_direct_decl_opt
%type <Cabs.decl_type * Cabs.attribute list> abstract_decl
/* (* Each element is a "* <type_quals_opt>". *) */
%type <attribute list list * cabsloc> pointer pointer_opt
%type <Cabs.cabsloc> location
%type <Cabs.spec_elem * cabsloc> cvspec
%%
interpret:
file EOF {$1}
;
file: globals {$1}
;
globals:
/* empty */ { [] }
| global globals { $1 :: $2 }
| SEMICOLON globals { $2 }
;
location:
/* empty */ { currentLoc () } %prec IDENT
/*** Global Definition ***/
global:
| declaration { $1 }
| function_def { $1 }
/*(* Some C header files ar shared with the C++ compiler and have linkage
* specification *)*/
| EXTERN string_constant declaration { LINKAGE (fst $2, (*handleLoc*) (snd $2), [ $3 ]) }
| EXTERN string_constant LBRACE globals RBRACE
{ LINKAGE (fst $2, (*handleLoc*) (snd $2), $4) }
| ASM LPAREN string_constant RPAREN SEMICOLON
{ GLOBASM (fst $3, (*handleLoc*) $1) }
| pragma { $1 }
/* (* Old-style function prototype. This should be somewhere else, like in
* "declaration". For now we keep it at global scope only because in local
* scope it looks too much like a function call *) */
| IDENT LPAREN old_parameter_list_ne RPAREN old_pardef_list SEMICOLON
{ (* Convert pardecl to new style *)
let pardecl, isva = doOldParDecl $3 $5 in
(* Make the function declarator *)
doDeclaration ((*handleLoc*) (snd $1)) []
[((fst $1, PROTO(JUSTBASE, pardecl,isva), [], cabslu),
NO_INIT)]
}
/* (* Old style function prototype, but without any arguments *) */
| IDENT LPAREN RPAREN SEMICOLON
{ (* Make the function declarator *)
doDeclaration ((*handleLoc*)(snd $1)) []
[((fst $1, PROTO(JUSTBASE,[],false), [], cabslu),
NO_INIT)]
}
/* transformer for a toplevel construct */
| AT_TRANSFORM LBRACE global RBRACE IDENT/*to*/ LBRACE globals RBRACE {
checkConnective(fst $5);
TRANSFORMER($3, $7, $1)
}
/* transformer for an expression */
| AT_TRANSFORMEXPR LBRACE expression RBRACE IDENT/*to*/ LBRACE expression RBRACE {
checkConnective(fst $5);
EXPRTRANSFORMER(fst $3, fst $7, $1)
}
| location error SEMICOLON { PRAGMA (VARIABLE "parse_error", $1) }
;
id_or_typename:
IDENT {fst $1}
| NAMED_TYPE {fst $1}
| AT_NAME LPAREN IDENT RPAREN { "@name(" ^ fst $3 ^ ")" } /* pattern variable name */
;
maybecomma:
/* empty */ { () }
| COMMA { () }
;
/* *** Expressions *** */
primary_expression: /*(* 6.5.1. *)*/
| IDENT
{VARIABLE (fst $1), snd $1}
| constant
{CONSTANT (fst $1), snd $1}
| paren_comma_expression
{PAREN (smooth_expression (fst $1)), snd $1}
| LPAREN block RPAREN
{ GNU_BODY (fst3 $2), $1 }
/*(* Next is Scott's transformer *)*/
| AT_EXPR LPAREN IDENT RPAREN /* expression pattern variable */
{ EXPR_PATTERN(fst $3), $1 }
;
postfix_expression: /*(* 6.5.2 *)*/
| primary_expression
{ $1 }
| postfix_expression bracket_comma_expression
{INDEX (fst $1, smooth_expression $2), snd $1}
| postfix_expression LPAREN arguments RPAREN
{CALL (fst $1, $3), snd $1}
| BUILTIN_VA_ARG LPAREN expression COMMA type_name RPAREN
{ let b, d = $5 in
CALL (VARIABLE "__builtin_va_arg",
[fst $3; TYPE_SIZEOF (b, d)]), $1 }
| BUILTIN_TYPES_COMPAT LPAREN type_name COMMA type_name RPAREN
{ let b1,d1 = $3 in
let b2,d2 = $5 in
CALL (VARIABLE "__builtin_types_compatible_p",
[TYPE_SIZEOF(b1,d1); TYPE_SIZEOF(b2,d2)]), $1 }
| BUILTIN_OFFSETOF LPAREN type_name COMMA offsetof_member_designator RPAREN
{ transformOffsetOf $3 $5, $1 }
| postfix_expression DOT id_or_typename
{MEMBEROF (fst $1, $3), snd $1}
| postfix_expression ARROW id_or_typename
{MEMBEROFPTR (fst $1, $3), snd $1}
| postfix_expression PLUS_PLUS
{UNARY (POSINCR, fst $1), snd $1}
| postfix_expression MINUS_MINUS
{UNARY (POSDECR, fst $1), snd $1}
/* (* We handle GCC constructor expressions *) */
| LPAREN type_name RPAREN LBRACE initializer_list_opt RBRACE
{ CAST($2, COMPOUND_INIT $5), $1 }
;
offsetof_member_designator: /* GCC extension for __builtin_offsetof */
| id_or_typename
{ VARIABLE ($1) }
| offsetof_member_designator DOT IDENT
{ MEMBEROF ($1, fst $3) }
| offsetof_member_designator bracket_comma_expression
{ INDEX ($1, smooth_expression $2) }
;
unary_expression: /*(* 6.5.3 *)*/
| postfix_expression
{ $1 }
| PLUS_PLUS unary_expression
{UNARY (PREINCR, fst $2), $1}
| MINUS_MINUS unary_expression
{UNARY (PREDECR, fst $2), $1}
| SIZEOF unary_expression
{EXPR_SIZEOF (fst $2), $1}
| SIZEOF LPAREN type_name RPAREN
{let b, d = $3 in TYPE_SIZEOF (b, d), $1}
| ALIGNOF unary_expression
{EXPR_ALIGNOF (fst $2), $1}
| ALIGNOF LPAREN type_name RPAREN
{let b, d = $3 in TYPE_ALIGNOF (b, d), $1}
| PLUS cast_expression
{UNARY (PLUS, fst $2), $1}
| MINUS cast_expression
{UNARY (MINUS, fst $2), $1}
| STAR cast_expression
{UNARY (MEMOF, fst $2), $1}
| AND cast_expression
{UNARY (ADDROF, fst $2), $1}
| EXCLAM cast_expression
{UNARY (NOT, fst $2), $1}
| TILDE cast_expression
{UNARY (BNOT, fst $2), $1}
| AND_AND IDENT { LABELADDR (fst $2), $1 }
;
cast_expression: /*(* 6.5.4 *)*/
| unary_expression
{ $1 }
| LPAREN type_name RPAREN cast_expression
{ CAST($2, SINGLE_INIT (fst $4)), $1 }
;
multiplicative_expression: /*(* 6.5.5 *)*/
| cast_expression
{ $1 }
| multiplicative_expression STAR cast_expression
{BINARY(MUL, fst $1, fst $3), snd $1}
| multiplicative_expression SLASH cast_expression
{BINARY(DIV, fst $1, fst $3), snd $1}
| multiplicative_expression PERCENT cast_expression
{BINARY(MOD, fst $1, fst $3), snd $1}
;
additive_expression: /*(* 6.5.6 *)*/
| multiplicative_expression
{ $1 }
| additive_expression PLUS multiplicative_expression
{BINARY(ADD, fst $1, fst $3), snd $1}
| additive_expression MINUS multiplicative_expression
{BINARY(SUB, fst $1, fst $3), snd $1}
;
shift_expression: /*(* 6.5.7 *)*/
| additive_expression
{ $1 }
| shift_expression INF_INF additive_expression
{BINARY(SHL, fst $1, fst $3), snd $1}
| shift_expression SUP_SUP additive_expression
{BINARY(SHR, fst $1, fst $3), snd $1}
;
relational_expression: /*(* 6.5.8 *)*/
| shift_expression
{ $1 }
| relational_expression INF shift_expression
{BINARY(LT, fst $1, fst $3), snd $1}
| relational_expression SUP shift_expression
{BINARY(GT, fst $1, fst $3), snd $1}
| relational_expression INF_EQ shift_expression
{BINARY(LE, fst $1, fst $3), snd $1}
| relational_expression SUP_EQ shift_expression
{BINARY(GE, fst $1, fst $3), snd $1}
;
equality_expression: /*(* 6.5.9 *)*/
| relational_expression
{ $1 }
| equality_expression EQ_EQ relational_expression
{BINARY(EQ, fst $1, fst $3), snd $1}
| equality_expression EXCLAM_EQ relational_expression
{BINARY(NE, fst $1, fst $3), snd $1}
;
bitwise_and_expression: /*(* 6.5.10 *)*/
| equality_expression
{ $1 }
| bitwise_and_expression AND equality_expression
{BINARY(BAND, fst $1, fst $3), snd $1}
;
bitwise_xor_expression: /*(* 6.5.11 *)*/
| bitwise_and_expression
{ $1 }
| bitwise_xor_expression CIRC bitwise_and_expression
{BINARY(XOR, fst $1, fst $3), snd $1}
;
bitwise_or_expression: /*(* 6.5.12 *)*/
| bitwise_xor_expression
{ $1 }
| bitwise_or_expression PIPE bitwise_xor_expression
{BINARY(BOR, fst $1, fst $3), snd $1}
;
logical_and_expression: /*(* 6.5.13 *)*/
| bitwise_or_expression
{ $1 }
| logical_and_expression AND_AND bitwise_or_expression
{BINARY(AND, fst $1, fst $3), snd $1}
;
logical_or_expression: /*(* 6.5.14 *)*/
| logical_and_expression
{ $1 }
| logical_or_expression PIPE_PIPE logical_and_expression
{BINARY(OR, fst $1, fst $3), snd $1}
;
conditional_expression: /*(* 6.5.15 *)*/
| logical_or_expression
{ $1 }
| logical_or_expression QUEST opt_expression COLON conditional_expression
{QUESTION (fst $1, $3, fst $5), snd $1}
;
/*(* The C spec says that left-hand sides of assignment expressions are unary
* expressions. GCC allows cast expressions in there ! *)*/
assignment_expression: /*(* 6.5.16 *)*/
| conditional_expression
{ $1 }
| cast_expression EQ assignment_expression
{BINARY(ASSIGN, fst $1, fst $3), snd $1}
| cast_expression PLUS_EQ assignment_expression
{BINARY(ADD_ASSIGN, fst $1, fst $3), snd $1}
| cast_expression MINUS_EQ assignment_expression
{BINARY(SUB_ASSIGN, fst $1, fst $3), snd $1}
| cast_expression STAR_EQ assignment_expression
{BINARY(MUL_ASSIGN, fst $1, fst $3), snd $1}
| cast_expression SLASH_EQ assignment_expression
{BINARY(DIV_ASSIGN, fst $1, fst $3), snd $1}
| cast_expression PERCENT_EQ assignment_expression
{BINARY(MOD_ASSIGN, fst $1, fst $3), snd $1}
| cast_expression AND_EQ assignment_expression
{BINARY(BAND_ASSIGN, fst $1, fst $3), snd $1}
| cast_expression PIPE_EQ assignment_expression
{BINARY(BOR_ASSIGN, fst $1, fst $3), snd $1}
| cast_expression CIRC_EQ assignment_expression
{BINARY(XOR_ASSIGN, fst $1, fst $3), snd $1}
| cast_expression INF_INF_EQ assignment_expression
{BINARY(SHL_ASSIGN, fst $1, fst $3), snd $1}
| cast_expression SUP_SUP_EQ assignment_expression
{BINARY(SHR_ASSIGN, fst $1, fst $3), snd $1}
;
expression: /*(* 6.5.17 *)*/
assignment_expression
{ $1 }
;
constant:
CST_INT {CONST_INT (fst $1), snd $1}
| CST_FLOAT {CONST_FLOAT (fst $1), snd $1}
| CST_CHAR {CONST_CHAR (fst $1), snd $1}
| CST_WCHAR {CONST_WCHAR (fst $1), snd $1}
| string_constant {CONST_STRING (fst $1), snd $1}
| wstring_list {CONST_WSTRING (fst $1), snd $1}
;
string_constant:
/* Now that we know this constant isn't part of a wstring, convert it
back to a string for easy viewing. */
string_list {
let queue, location = $1 in
let buffer = Buffer.create (Queue.length queue) in
Queue.iter
(List.iter
(fun value ->
let char = int64_to_char value in
Buffer.add_char buffer char))
queue;
Buffer.contents buffer, location
}
;
one_string_constant:
/* Don't concat multiple strings. For asm templates. */
CST_STRING {intlist_to_string (fst $1) }
;
string_list:
one_string {
let queue = Queue.create () in
Queue.add (fst $1) queue;
queue, snd $1
}
| string_list one_string {
Queue.add (fst $2) (fst $1);
$1
}
;
wstring_list:
CST_WSTRING { $1 }
| wstring_list one_string { (fst $1) @ (fst $2), snd $1 }
| wstring_list CST_WSTRING { (fst $1) @ (fst $2), snd $1 }
/* Only the first string in the list needs an L, so L"a" "b" is the same
* as L"ab" or L"a" L"b". */
one_string:
CST_STRING {$1}
| FUNCTION__ {(Cabshelper.explodeStringToInts
!currentFunctionName), $1}
| PRETTY_FUNCTION__ {(Cabshelper.explodeStringToInts
!currentFunctionName), $1}
;
init_expression:
expression { SINGLE_INIT (fst $1) }
| LBRACE initializer_list_opt RBRACE
{ COMPOUND_INIT $2}
initializer_list: /* ISO 6.7.8. Allow a trailing COMMA */
initializer { [$1] }
| initializer COMMA initializer_list_opt { $1 :: $3 }
;
initializer_list_opt:
/* empty */ { [] }
| initializer_list { $1 }
;
initializer:
init_designators eq_opt init_expression { ($1, $3) }
| gcc_init_designators init_expression { ($1, $2) }
| init_expression { (NEXT_INIT, $1) }
;
eq_opt:
EQ { () }
/*(* GCC allows missing = *)*/
| /*(* empty *)*/ { () }
;
init_designators:
DOT id_or_typename init_designators_opt { INFIELD_INIT($2, $3) }
| LBRACKET expression RBRACKET init_designators_opt
{ ATINDEX_INIT(fst $2, $4) }
| LBRACKET expression ELLIPSIS expression RBRACKET
{ ATINDEXRANGE_INIT(fst $2, fst $4) }
;
init_designators_opt:
/* empty */ { NEXT_INIT }
| init_designators { $1 }
;
gcc_init_designators: /*(* GCC supports these strange things *)*/
id_or_typename COLON { INFIELD_INIT($1, NEXT_INIT) }
;
arguments:
/* empty */ { [] }
| comma_expression { fst $1 }
;
opt_expression:
/* empty */
{NOTHING}
| comma_expression
{smooth_expression (fst $1)}
;
comma_expression:
expression {[fst $1], snd $1}
| expression COMMA comma_expression { fst $1 :: fst $3, snd $1 }
| error COMMA comma_expression { $3 }
;
comma_expression_opt:
/* empty */ { NOTHING }
| comma_expression { smooth_expression (fst $1) }
;
paren_comma_expression:
LPAREN comma_expression RPAREN { $2 }
| LPAREN error RPAREN { [], $1 }
;
bracket_comma_expression:
LBRACKET comma_expression RBRACKET { fst $2 }
| LBRACKET error RBRACKET { [] }
;
/*** statements ***/
block: /* ISO 6.8.2 */
block_begin local_labels block_attrs block_element_list RBRACE
{!Lexerhack.pop_context();
{ blabels = $2;
battrs = $3;
bstmts = $4 },
$1, $5
}
| error location RBRACE { { blabels = [];
battrs = [];
bstmts = [] },
$2, $3
}
;
block_begin:
LBRACE {!Lexerhack.push_context (); $1}
;
block_attrs:
/* empty */ { [] }
| BLOCKATTRIBUTE paren_attr_list_ne
{ [("__blockattribute__", $2)] }
;
/* statements and declarations in a block, in any order (for C99 support) */
block_element_list:
/* empty */ { [] }
| declaration block_element_list { DEFINITION($1) :: $2 }
| statement block_element_list { $1 :: $2 }
/*(* GCC accepts a label at the end of a block *)*/
| IDENT COLON { [ LABEL (fst $1, NOP (snd $1),
snd $1)] }
| pragma block_element_list { $2 }
;
local_labels:
/* empty */ { [] }
| LABEL__ local_label_names SEMICOLON local_labels { $2 @ $4 }
;
local_label_names:
IDENT { [ fst $1 ] }
| IDENT COMMA local_label_names { fst $1 :: $3 }
;
statement:
SEMICOLON {NOP ((*handleLoc*) $1) }
| comma_expression SEMICOLON
{COMPUTATION (smooth_expression (fst $1), (*handleLoc*)(snd $1))}
| block {BLOCK (fst3 $1, (*handleLoc*)(snd3 $1))}
| IF paren_comma_expression statement %prec IF
{IF (smooth_expression (fst $2), $3, NOP $1, $1)}
| IF paren_comma_expression statement ELSE statement
{IF (smooth_expression (fst $2), $3, $5, (*handleLoc*) $1)}
| SWITCH paren_comma_expression statement
{SWITCH (smooth_expression (fst $2), $3, (*handleLoc*) $1)}
| WHILE paren_comma_expression statement
{WHILE (smooth_expression (fst $2), $3, (*handleLoc*) $1)}
| DO statement WHILE paren_comma_expression SEMICOLON
{DOWHILE (smooth_expression (fst $4), $2, (*handleLoc*) $1)}
| FOR LPAREN for_clause opt_expression
SEMICOLON opt_expression RPAREN statement
{FOR ($3, $4, $6, $8, (*handleLoc*) $1)}
| IDENT COLON attribute_nocv_list statement
{(* The only attribute that should appear here
is "unused". For now, we drop this on the
floor, since unused labels are usually
removed anyways by Rmtmps. *)
LABEL (fst $1, $4, (snd $1))}
| CASE expression COLON statement
{CASE (fst $2, $4, (*handleLoc*) $1)}
| CASE expression ELLIPSIS expression COLON statement
{CASERANGE (fst $2, fst $4, $6, (*handleLoc*) $1)}
| DEFAULT COLON
{DEFAULT (NOP $1, (*handleLoc*) $1)}
| RETURN SEMICOLON {RETURN (NOTHING, (*handleLoc*) $1)}
| RETURN comma_expression SEMICOLON
{RETURN (smooth_expression (fst $2), (*handleLoc*) $1)}
| BREAK SEMICOLON {BREAK ((*handleLoc*) $1)}
| CONTINUE SEMICOLON {CONTINUE ((*handleLoc*) $1)}
| GOTO IDENT SEMICOLON
{GOTO (fst $2, (*handleLoc*) $1)}
| GOTO STAR comma_expression SEMICOLON
{ COMPGOTO (smooth_expression (fst $3), (*handleLoc*) $1) }
| ASM asmattr LPAREN asmtemplate asmoutputs RPAREN SEMICOLON
{ ASM ($2, $4, $5, (*handleLoc*) $1) }
| MSASM { ASM ([], [fst $1], None, (*handleLoc*)(snd $1))}
| TRY block EXCEPT paren_comma_expression block
{ let b, _, _ = $2 in
let h, _, _ = $5 in
if not !Cprint.msvcMode then
parse_error "try/except in GCC code";
TRY_EXCEPT (b, COMMA (fst $4), h, (*handleLoc*) $1) }
| TRY block FINALLY block
{ let b, _, _ = $2 in
let h, _, _ = $4 in
if not !Cprint.msvcMode then
parse_error "try/finally in GCC code";
TRY_FINALLY (b, h, (*handleLoc*) $1) }
| error location SEMICOLON { (NOP $2)}
;
for_clause:
opt_expression SEMICOLON { FC_EXP $1 }
| declaration { FC_DECL $1 }
;
declaration: /* ISO 6.7.*/
decl_spec_list init_declarator_list SEMICOLON
{ doDeclaration ((*handleLoc*)(snd $1)) (fst $1) $2 }
| decl_spec_list SEMICOLON
{ doDeclaration ((*handleLoc*)(snd $1)) (fst $1) [] }
;
init_declarator_list: /* ISO 6.7 */
init_declarator { [$1] }
| init_declarator COMMA init_declarator_list { $1 :: $3 }
;
init_declarator: /* ISO 6.7 */
declarator { ($1, NO_INIT) }
| declarator EQ init_expression
{ ($1, $3) }
;
decl_spec_list: /* ISO 6.7 */
/* ISO 6.7.1 */
| TYPEDEF decl_spec_list_opt { SpecTypedef :: $2, $1 }
| EXTERN decl_spec_list_opt { SpecStorage EXTERN :: $2, $1 }
| STATIC decl_spec_list_opt { SpecStorage STATIC :: $2, $1 }
| AUTO decl_spec_list_opt { SpecStorage AUTO :: $2, $1 }
| REGISTER decl_spec_list_opt { SpecStorage REGISTER :: $2, $1}
/* ISO 6.7.2 */
| type_spec decl_spec_list_opt_no_named { SpecType (fst $1) :: $2, snd $1 }
/* ISO 6.7.4 */
| INLINE decl_spec_list_opt { SpecInline :: $2, $1 }
| cvspec decl_spec_list_opt { (fst $1) :: $2, snd $1 }
| attribute_nocv decl_spec_list_opt { SpecAttr (fst $1) :: $2, snd $1 }
/* specifier pattern variable (must be last in spec list) */
| AT_SPECIFIER LPAREN IDENT RPAREN { [ SpecPattern(fst $3) ], $1 }
;
/* (* In most cases if we see a NAMED_TYPE we must shift it. Thus we declare
* NAMED_TYPE to have right associativity *) */
decl_spec_list_opt:
/* empty */ { [] } %prec NAMED_TYPE
| decl_spec_list { fst $1 }
;
/* (* We add this separate rule to handle the special case when an appearance
* of NAMED_TYPE should not be considered as part of the specifiers but as
* part of the declarator. IDENT has higher precedence than NAMED_TYPE *)
*/
decl_spec_list_opt_no_named:
/* empty */ { [] } %prec IDENT
| decl_spec_list { fst $1 }
;
type_spec: /* ISO 6.7.2 */
VOID { Tvoid, $1}
| CHAR { Tchar, $1 }
| BOOL { Tbool, $1 }
| SHORT { Tshort, $1 }
| INT { Tint, $1 }
| LONG { Tlong, $1 }
| INT64 { Tint64, $1 }
| FLOAT { Tfloat, $1 }
| DOUBLE { Tdouble, $1 }
| SIGNED { Tsigned, $1 }
| UNSIGNED { Tunsigned, $1 }
| STRUCT id_or_typename
{ Tstruct ($2, None, []), $1 }
| STRUCT just_attributes id_or_typename
{ Tstruct ($3, None, $2), $1 }
| STRUCT id_or_typename LBRACE struct_decl_list RBRACE
{ Tstruct ($2, Some $4, []), $1 }
| STRUCT LBRACE struct_decl_list RBRACE
{ Tstruct ("", Some $3, []), $1 }
| STRUCT just_attributes id_or_typename LBRACE struct_decl_list RBRACE
{ Tstruct ($3, Some $5, $2), $1 }
| STRUCT just_attributes LBRACE struct_decl_list RBRACE
{ Tstruct ("", Some $4, $2), $1 }
| UNION id_or_typename
{ Tunion ($2, None, []), $1 }
| UNION id_or_typename LBRACE struct_decl_list RBRACE
{ Tunion ($2, Some $4, []), $1 }
| UNION LBRACE struct_decl_list RBRACE
{ Tunion ("", Some $3, []), $1 }
| UNION just_attributes id_or_typename LBRACE struct_decl_list RBRACE
{ Tunion ($3, Some $5, $2), $1 }
| UNION just_attributes LBRACE struct_decl_list RBRACE
{ Tunion ("", Some $4, $2), $1 }
| ENUM id_or_typename
{ Tenum ($2, None, []), $1 }
| ENUM id_or_typename LBRACE enum_list maybecomma RBRACE
{ Tenum ($2, Some $4, []), $1 }
| ENUM LBRACE enum_list maybecomma RBRACE
{ Tenum ("", Some $3, []), $1 }
| ENUM just_attributes id_or_typename LBRACE enum_list maybecomma RBRACE
{ Tenum ($3, Some $5, $2), $1 }
| ENUM just_attributes LBRACE enum_list maybecomma RBRACE
{ Tenum ("", Some $4, $2), $1 }
| NAMED_TYPE { Tnamed (fst $1), snd $1 }
| TYPEOF LPAREN expression RPAREN { TtypeofE (fst $3), $1 }
| TYPEOF LPAREN type_name RPAREN { let s, d = $3 in
TtypeofT (s, d), $1 }
;
struct_decl_list: /* (* ISO 6.7.2. Except that we allow empty structs. We
* also allow missing field names. *)
*/
/* empty */ { [] }
| decl_spec_list SEMICOLON struct_decl_list
{ (fst $1,
[(missingFieldDecl, None)]) :: $3 }
/*(* GCC allows extra semicolons *)*/
| SEMICOLON struct_decl_list
{ $2 }
| decl_spec_list field_decl_list SEMICOLON struct_decl_list
{ (fst $1, $2)
:: $4 }
/*(* MSVC allows pragmas in strange places *)*/
| pragma struct_decl_list { $2 }
| error SEMICOLON struct_decl_list
{ $3 }
;
field_decl_list: /* (* ISO 6.7.2 *) */
field_decl { [$1] }
| field_decl COMMA field_decl_list { $1 :: $3 }
;
field_decl: /* (* ISO 6.7.2. Except that we allow unnamed fields. *) */
| declarator { ($1, None) }
| declarator COLON expression attributes
{ let (n,decl,al,loc) = $1 in
let al' = al @ $4 in
((n,decl,al',loc), Some (fst $3)) }
| COLON expression { (missingFieldDecl, Some (fst $2)) }
;
enum_list: /* (* ISO 6.7.2.2 *) */
enumerator {[$1]}
| enum_list COMMA enumerator {$1 @ [$3]}
| enum_list COMMA error { $1 }
;
enumerator:
IDENT {(fst $1, NOTHING, snd $1)}
| IDENT EQ expression {(fst $1, fst $3, snd $1)}
;
declarator: /* (* ISO 6.7.5. Plus Microsoft declarators.*) */
pointer_opt direct_decl attributes_with_asm
{ let (n, decl) = $2 in
(n, applyPointer (fst $1) decl, $3, (snd $1)) }
;
direct_decl: /* (* ISO 6.7.5 *) */
/* (* We want to be able to redefine named
* types as variable names *) */
| id_or_typename { ($1, JUSTBASE) }
| LPAREN attributes declarator RPAREN
{ let (n,decl,al,loc) = $3 in
(n, PARENTYPE($2,decl,al)) }
| direct_decl LBRACKET attributes comma_expression_opt RBRACKET
{ let (n, decl) = $1 in
(n, ARRAY(decl, $3, $4)) }
| direct_decl LBRACKET attributes error RBRACKET
{ let (n, decl) = $1 in
(n, ARRAY(decl, $3, NOTHING)) }
| direct_decl parameter_list_startscope rest_par_list RPAREN
{ let (n, decl) = $1 in
let (params, isva) = $3 in
!Lexerhack.pop_context ();
(n, PROTO(decl, params, isva))
}
;
parameter_list_startscope:
LPAREN { !Lexerhack.push_context () }
;
rest_par_list:
| /* empty */ { ([], false) }
| parameter_decl rest_par_list1 { let (params, isva) = $2 in
($1 :: params, isva)
}
;
rest_par_list1:
/* empty */ { ([], false) }
| COMMA ELLIPSIS { ([], true) }
| COMMA parameter_decl rest_par_list1 { let (params, isva) = $3 in
($2 :: params, isva)
}
;
parameter_decl: /* (* ISO 6.7.5 *) */
decl_spec_list declarator { (fst $1, $2) }
| decl_spec_list abstract_decl { let d, a = $2 in
(fst $1, ("", d, a, cabslu)) }
| decl_spec_list { (fst $1, ("", JUSTBASE, [], cabslu)) }
| LPAREN parameter_decl RPAREN { $2 }
;
/* (* Old style prototypes. Like a declarator *) */
old_proto_decl:
pointer_opt direct_old_proto_decl { let (n, decl, a) = $2 in
(n, applyPointer (fst $1) decl,
a, snd $1)
}
;
direct_old_proto_decl:
direct_decl LPAREN old_parameter_list_ne RPAREN old_pardef_list
{ let par_decl, isva = doOldParDecl $3 $5 in
let n, decl = $1 in
(n, PROTO(decl, par_decl, isva), [])
}
| direct_decl LPAREN RPAREN
{ let n, decl = $1 in
(n, PROTO(decl, [], false), [])
}
/* (* appears sometimesm but generates a shift-reduce conflict. *)
| LPAREN STAR direct_decl LPAREN old_parameter_list_ne RPAREN RPAREN LPAREN RPAREN old_pardef_list
{ let par_decl, isva
= doOldParDecl $5 $10 in
let n, decl = $3 in
(n, PROTO(decl, par_decl, isva), [])
}
*/
;
old_parameter_list_ne:
| IDENT { [fst $1] }
| IDENT COMMA old_parameter_list_ne { let rest = $3 in
(fst $1 :: rest) }
;
old_pardef_list:
/* empty */ { ([], false) }
| decl_spec_list old_pardef SEMICOLON ELLIPSIS
{ ([(fst $1, $2)], true) }
| decl_spec_list old_pardef SEMICOLON old_pardef_list
{ let rest, isva = $4 in
((fst $1, $2) :: rest, isva)
}
;
old_pardef:
declarator { [$1] }
| declarator COMMA old_pardef { $1 :: $3 }
| error { [] }
;
pointer: /* (* ISO 6.7.5 *) */
STAR attributes pointer_opt { $2 :: fst $3, $1 }
;
pointer_opt:
/**/ { let l = currentLoc () in
([], l) }
| pointer { $1 }
;
type_name: /* (* ISO 6.7.6 *) */
decl_spec_list abstract_decl { let d, a = $2 in
if a <> [] then begin
parse_error "attributes in type name";
raise Parsing.Parse_error
end;
(fst $1, d)
}
| decl_spec_list { (fst $1, JUSTBASE) }
;
abstract_decl: /* (* ISO 6.7.6. *) */
pointer_opt abs_direct_decl attributes { applyPointer (fst $1) $2, $3 }
| pointer { applyPointer (fst $1) JUSTBASE, [] }
;
abs_direct_decl: /* (* ISO 6.7.6. We do not support optional declarator for
* functions. Plus Microsoft attributes. See the
* discussion for declarator. *) */
| LPAREN attributes abstract_decl RPAREN
{ let d, a = $3 in
PARENTYPE ($2, d, a)
}
| LPAREN error RPAREN
{ JUSTBASE }
| abs_direct_decl_opt LBRACKET comma_expression_opt RBRACKET
{ ARRAY($1, [], $3) }
/*(* The next should be abs_direct_decl_opt but we get conflicts *)*/
| abs_direct_decl parameter_list_startscope rest_par_list RPAREN
{ let (params, isva) = $3 in
!Lexerhack.pop_context ();
PROTO ($1, params, isva)
}
;
abs_direct_decl_opt:
abs_direct_decl { $1 }
| /* empty */ { JUSTBASE }
;
function_def: /* (* ISO 6.9.1 *) */
function_def_start block
{ let (loc, specs, decl) = $1 in
currentFunctionName := "<__FUNCTION__ used outside any functions>";
!Lexerhack.pop_context (); (* The context pushed by
* announceFunctionName *)
doFunctionDef ((*handleLoc*) loc) (trd3 $2) specs decl (fst3 $2)
}
function_def_start: /* (* ISO 6.9.1 *) */
decl_spec_list declarator
{ announceFunctionName $2;
(snd $1, fst $1, $2)
}
/* (* Old-style function prototype *) */
| decl_spec_list old_proto_decl
{ announceFunctionName $2;
(snd $1, fst $1, $2)
}
/* (* New-style function that does not have a return type *) */
| IDENT parameter_list_startscope rest_par_list RPAREN
{ let (params, isva) = $3 in
let fdec =
(fst $1, PROTO(JUSTBASE, params, isva), [], snd $1) in
announceFunctionName fdec;
(* Default is int type *)
let defSpec = [SpecType Tint] in
(snd $1, defSpec, fdec)
}
/* (* No return type and old-style parameter list *) */
| IDENT LPAREN old_parameter_list_ne RPAREN old_pardef_list
{ (* Convert pardecl to new style *)
let pardecl, isva = doOldParDecl $3 $5 in
(* Make the function declarator *)
let fdec = (fst $1,
PROTO(JUSTBASE, pardecl,isva),
[], snd $1) in
announceFunctionName fdec;
(* Default is int type *)
let defSpec = [SpecType Tint] in
(snd $1, defSpec, fdec)
}
/* (* No return type and no parameters *) */
| IDENT LPAREN RPAREN
{ (* Make the function declarator *)
let fdec = (fst $1,
PROTO(JUSTBASE, [], false),
[], snd $1) in
announceFunctionName fdec;
(* Default is int type *)
let defSpec = [SpecType Tint] in
(snd $1, defSpec, fdec)
}
;
/* const/volatile as type specifier elements */
cvspec:
CONST { SpecCV(CV_CONST), $1 }
| VOLATILE { SpecCV(CV_VOLATILE), $1 }
| RESTRICT { SpecCV(CV_RESTRICT), $1 }
;
/*** GCC attributes ***/
attributes:
/* empty */ { []}
| attribute attributes { fst $1 :: $2 }
;
/* (* In some contexts we can have an inline assembly to specify the name to
* be used for a global. We treat this as a name attribute *) */
attributes_with_asm:
/* empty */ { [] }
| attribute attributes_with_asm { fst $1 :: $2 }
| ASM LPAREN string_constant RPAREN attributes
{ ("__asm__",
[CONSTANT(CONST_STRING (fst $3))]) :: $5 }
;
/* things like __attribute__, but no const/volatile */
attribute_nocv:
ATTRIBUTE LPAREN paren_attr_list RPAREN
{ ("__attribute__", $3), $1 }
/*(*
| ATTRIBUTE_USED { ("__attribute__",
[ VARIABLE "used" ]), $1 }
*)*/
| DECLSPEC paren_attr_list_ne { ("__declspec", $2), $1 }
| MSATTR { (fst $1, []), snd $1 }
/* ISO 6.7.3 */
| THREAD { ("__thread",[]), $1 }
| QUALIFIER {("__attribute__",[VARIABLE(fst $1)]),snd $1}
;
attribute_nocv_list:
/* empty */ { []}
| attribute_nocv attribute_nocv_list { fst $1 :: $2 }
;
/* __attribute__ plus const/volatile */
attribute:
attribute_nocv { $1 }
| CONST { ("const", []), $1 }
| RESTRICT { ("restrict",[]), $1 }
| VOLATILE { ("volatile",[]), $1 }
;
/* (* sm: I need something that just includes __attribute__ and nothing more,
* to support them appearing between the 'struct' keyword and the type name.
* Actually, a declspec can appear there as well (on MSVC) *) */
just_attribute:
ATTRIBUTE LPAREN paren_attr_list RPAREN
{ ("__attribute__", $3) }
| DECLSPEC paren_attr_list_ne { ("__declspec", $2) }
;
/* this can't be empty, b/c I folded that possibility into the calling
* productions to avoid some S/R conflicts */
just_attributes:
just_attribute { [$1] }
| just_attribute just_attributes { $1 :: $2 }
;
/** (* PRAGMAS and ATTRIBUTES *) ***/
pragma:
| PRAGMA attr PRAGMA_EOL { PRAGMA ($2, $1) }
| PRAGMA attr SEMICOLON PRAGMA_EOL { PRAGMA ($2, $1) }
| PRAGMA_LINE { PRAGMA (VARIABLE (fst $1),
snd $1) }
;
/* (* We want to allow certain strange things that occur in pragmas, so we
* cannot use directly the language of expressions *) */
primary_attr:
IDENT { VARIABLE (fst $1) }
/*(* The NAMED_TYPE here creates conflicts with IDENT *)*/
| NAMED_TYPE { VARIABLE (fst $1) }
| LPAREN attr RPAREN { $2 }
| IDENT IDENT { CALL(VARIABLE (fst $1), [VARIABLE (fst $2)]) }
| CST_INT { CONSTANT(CONST_INT (fst $1)) }
| string_constant { CONSTANT(CONST_STRING (fst $1)) }
/*(* Const when it appears in
* attribute lists, is translated
* to aconst *)*/
| CONST { VARIABLE "aconst" }
| IDENT COLON CST_INT { VARIABLE (fst $1 ^ ":" ^ fst $3) }
/*(* The following rule conflicts with the ? : attributes. We give it a very
* low priority *)*/
| CST_INT COLON CST_INT { VARIABLE (fst $1 ^ ":" ^ fst $3) }
| DEFAULT COLON CST_INT { VARIABLE ("default:" ^ fst $3) }
/*(** GCC allows this as an
* attribute for functions,
* synonim for noreturn **)*/
| VOLATILE { VARIABLE ("__noreturn__") }
;
postfix_attr:
primary_attr { $1 }
/* (* use a VARIABLE "" so that the
* parentheses are printed *) */
| IDENT LPAREN RPAREN { CALL(VARIABLE (fst $1), [VARIABLE ""]) }
| IDENT paren_attr_list_ne { CALL(VARIABLE (fst $1), $2) }
| postfix_attr ARROW id_or_typename {MEMBEROFPTR ($1, $3)}
| postfix_attr DOT id_or_typename {MEMBEROF ($1, $3)}
| postfix_attr LBRACKET attr RBRACKET {INDEX ($1, $3) }
;
/*(* Since in attributes we use both IDENT and NAMED_TYPE as indentifiers,
* that leads to conflicts for SIZEOF and ALIGNOF. In those cases we require
* that their arguments be expressions, not attributes *)*/
unary_attr:
postfix_attr { $1 }
| SIZEOF unary_expression {EXPR_SIZEOF (fst $2) }
| SIZEOF LPAREN type_name RPAREN
{let b, d = $3 in TYPE_SIZEOF (b, d)}
| ALIGNOF unary_expression {EXPR_ALIGNOF (fst $2) }
| ALIGNOF LPAREN type_name RPAREN {let b, d = $3 in TYPE_ALIGNOF (b, d)}
| PLUS cast_attr {UNARY (PLUS, $2)}
| MINUS cast_attr {UNARY (MINUS, $2)}
| STAR cast_attr {UNARY (MEMOF, $2)}
| AND cast_attr
{UNARY (ADDROF, $2)}
| EXCLAM cast_attr {UNARY (NOT, $2)}
| TILDE cast_attr {UNARY (BNOT, $2)}
;
cast_attr:
unary_attr { $1 }
;
multiplicative_attr:
cast_attr { $1 }
| multiplicative_attr STAR cast_attr {BINARY(MUL ,$1 , $3)}
| multiplicative_attr SLASH cast_attr {BINARY(DIV ,$1 , $3)}
| multiplicative_attr PERCENT cast_attr {BINARY(MOD ,$1 , $3)}
;
additive_attr:
multiplicative_attr { $1 }
| additive_attr PLUS multiplicative_attr {BINARY(ADD ,$1 , $3)}
| additive_attr MINUS multiplicative_attr {BINARY(SUB ,$1 , $3)}
;
shift_attr:
additive_attr { $1 }
| shift_attr INF_INF additive_attr {BINARY(SHL ,$1 , $3)}
| shift_attr SUP_SUP additive_attr {BINARY(SHR ,$1 , $3)}
;
relational_attr:
shift_attr { $1 }
| relational_attr INF shift_attr {BINARY(LT ,$1 , $3)}
| relational_attr SUP shift_attr {BINARY(GT ,$1 , $3)}
| relational_attr INF_EQ shift_attr {BINARY(LE ,$1 , $3)}
| relational_attr SUP_EQ shift_attr {BINARY(GE ,$1 , $3)}
;
equality_attr:
relational_attr { $1 }
| equality_attr EQ_EQ relational_attr {BINARY(EQ ,$1 , $3)}
| equality_attr EXCLAM_EQ relational_attr {BINARY(NE ,$1 , $3)}
;
bitwise_and_attr:
equality_attr { $1 }
| bitwise_and_attr AND equality_attr {BINARY(BAND ,$1 , $3)}
;
bitwise_xor_attr:
bitwise_and_attr { $1 }
| bitwise_xor_attr CIRC bitwise_and_attr {BINARY(XOR ,$1 , $3)}
;
bitwise_or_attr:
bitwise_xor_attr { $1 }
| bitwise_or_attr PIPE bitwise_xor_attr {BINARY(BOR ,$1 , $3)}
;
logical_and_attr:
bitwise_or_attr { $1 }
| logical_and_attr AND_AND bitwise_or_attr {BINARY(AND ,$1 , $3)}
;
logical_or_attr:
logical_and_attr { $1 }
| logical_or_attr PIPE_PIPE logical_and_attr {BINARY(OR ,$1 , $3)}
;
conditional_attr:
logical_or_attr { $1 }
/* This is in conflict for now */
| logical_or_attr QUEST conditional_attr COLON conditional_attr
{ QUESTION($1, $3, $5) }
attr: conditional_attr { $1 }
;
attr_list_ne:
| attr { [$1] }
| attr COMMA attr_list_ne { $1 :: $3 }
| error COMMA attr_list_ne { $3 }
;
attr_list:
/* empty */ { [] }
| attr_list_ne { $1 }
;
paren_attr_list_ne:
LPAREN attr_list_ne RPAREN { $2 }
| LPAREN error RPAREN { [] }
;
paren_attr_list:
LPAREN attr_list RPAREN { $2 }
| LPAREN error RPAREN { [] }
;
/*** GCC ASM instructions ***/
asmattr:
/* empty */ { [] }
| VOLATILE asmattr { ("volatile", []) :: $2 }
| CONST asmattr { ("const", []) :: $2 }
;
asmtemplate:
one_string_constant { [$1] }
| one_string_constant asmtemplate { $1 :: $2 }
;
asmoutputs:
/* empty */ { None }
| COLON asmoperands asminputs
{ let (ins, clobs) = $3 in
Some {aoutputs = $2; ainputs = ins; aclobbers = clobs} }
;
asmoperands:
/* empty */ { [] }
| asmoperandsne { List.rev $1 }
;
asmoperandsne:
asmoperand { [$1] }
| asmoperandsne COMMA asmoperand { $3 :: $1 }
;
asmoperand:
asmopname string_constant LPAREN expression RPAREN { ($1, fst $2, fst $4) }
| asmopname string_constant LPAREN error RPAREN { ($1, fst $2, NOTHING ) }
;
asminputs:
/* empty */ { ([], []) }
| COLON asmoperands asmclobber
{ ($2, $3) }
;
asmopname:
/* empty */ { None }
| LBRACKET IDENT RBRACKET { Some (fst $2) }
;
asmclobber:
/* empty */ { [] }
| COLON asmcloberlst_ne { $2 }
;
asmcloberlst_ne:
one_string_constant { [$1] }
| one_string_constant COMMA asmcloberlst_ne { $1 :: $3 }
;
%%
| {
"pile_set_name": "Github"
} |
/**
* Copyright (C) 2014-2016 Open Whisper Systems
*
* Licensed according to the LICENSE file in this repository.
*/
package org.whispersystems.signalservice.api.messages.multidevice;
import org.whispersystems.libsignal.util.guava.Optional;
import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentStream;
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
public class DeviceContact {
private final SignalServiceAddress address;
private final Optional<String> name;
private final Optional<SignalServiceAttachmentStream> avatar;
private final Optional<String> color;
private final Optional<VerifiedMessage> verified;
private final Optional<byte[]> profileKey;
private final boolean blocked;
private final Optional<Integer> expirationTimer;
public DeviceContact(SignalServiceAddress address, Optional<String> name,
Optional<SignalServiceAttachmentStream> avatar,
Optional<String> color,
Optional<VerifiedMessage> verified,
Optional<byte[]> profileKey,
boolean blocked,
Optional<Integer> expirationTimer)
{
this.address = address;
this.name = name;
this.avatar = avatar;
this.color = color;
this.verified = verified;
this.profileKey = profileKey;
this.blocked = blocked;
this.expirationTimer = expirationTimer;
}
public Optional<SignalServiceAttachmentStream> getAvatar() {
return avatar;
}
public Optional<String> getName() {
return name;
}
public SignalServiceAddress getAddress() {
return address;
}
public Optional<String> getColor() {
return color;
}
public Optional<VerifiedMessage> getVerified() {
return verified;
}
public Optional<byte[]> getProfileKey() {
return profileKey;
}
public boolean isBlocked() {
return blocked;
}
public Optional<Integer> getExpirationTimer() {
return expirationTimer;
}
}
| {
"pile_set_name": "Github"
} |
# Version Control
Version control in Snowstorm allows us to record different versions of content through time and to use branches to organise that content.
## Branches
Branches allow for segregation of terminology content. They can be used to develop multiple content projects in parallel, to hold multiple release versions of SNOMED CT
or even to hold many versions of many extensions in a single terminology server.
Branches have a hierarchical structure. The root branch is called MAIN. The MAIN branch may have many children and those children may have many children.
The breadth and depth of branching is not limited.
Example branch hierarchy:
```
MAIN
- 2019-01-31
- 2018-07-31
- ProjectA
- Task1
- Task2
- ProjectB
- Task1
- Task2
```
## Timeline
Each branch has a timeline. It starts when the branch is created. Every time content is changed on a branch a new version of the branch is created.
The content of a branch can change in many ways including RF2 importing, content authoring or branch merge operations.
Every branch has a property called _**head**_, this is the date when the latest version of that branch was created.
## Branch contents
When a branch is created all content which exists on the specified parent branch at that point in time is visible on the child branch.
The content of the parent is not copied to the child branch.
Every branch has a property called _**base**_ timestamp.
```
```
The content on each branch is accessed using the branch path. | {
"pile_set_name": "Github"
} |
//
// ViewController.swift
// Conditionally Extending a Protocol
//
// Created by Vandad on 6/26/15.
// Copyright © 2015 Pixolity. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
| {
"pile_set_name": "Github"
} |
---
title: Storage Engine
menu:
influxdb_010:
weight: 70
parent: concepts
---
The 0.9 line of InfluxDB used BoltDB as the underlying storage engine.
This writeup is about the experimental version of the Time Structured Merge Tree storage engine that was released in 0.9.5.
There may be small discrepancies between the current implementation of TSM and this document.
<a href="https://influxdata.com/blog/new-storage-engine-time-structured-merge-tree/" target="_">See the blog post announcement about the storage engine here</a>.
## The new InfluxDB storage engine: from LSM Tree to B+Tree and back again to create the Time Structured Merge Tree
The properties of the time series data use case make it challenging for many existing storage engines.
Over the course of InfluxDB’s development we’ve tried a few of the more popular options.
We started with LevelDB, an engine based on LSM Trees, which are optimized for write throughput.
After that we tried BoltDB, an engine based on a memory mapped B+Tree, which is optimized for reads.
Finally, we ended up building our own storage engine that is similar in many ways to LSM Trees.
With our new storage engine we were able to achieve up to a 45x reduction in disk space usage from our B+Tree setup with even greater write throughput and compression than what we saw with LevelDB and its variants.
Using batched writes, we were able to insert more than 300,000 points per second on a c3.8xlarge instance in AWS.
This post will cover the details of that evolution and end with an in-depth look at our new storage engine and its inner workings.
### Properties of Time Series Data
The workload of time series data is quite different from normal database workloads.
There are a number of factors that conspire to make it very difficult to get it to scale and perform well:
* Billions of individual data points
* High write throughput
* High read throughput
* Large deletes to free up disk space
* Mostly an insert/append workload, very few updates
The first and most obvious problem is one of scale.
In DevOps, for instance, you can collect hundreds of millions or billions of unique data points every day.
To prove out the numbers, let’s say we have 200 VMs or servers running, with each server collecting an average of 100 measurements every 10 seconds.
Given there are 86,400 seconds in a day, a single measurement will generate 8,640 points in a day, per server.
That gives us a total of 200 * 100 * 8,640 = 172,800,000 individual data points per day.
We find similar or larger numbers in sensor data use cases.
The volume of data means that the write throughput can be very high.
We regularly get requests for setups than can handle hundreds of thousands of writes per second.
I’ve talked to some larger companies that will only consider systems that can handle millions of writes per second.
At the same time, time series data can be a high read throughput use case.
It’s true that if you’re tracking 700,000 unique metrics or time series, you can’t hope to visualize all of them, which is what leads many people to think that you don’t actually read most of the data that goes into the database.
However, other than dashboards that people have up on their screens, there are automated systems for monitoring or combining the large volume of time series data with other types of data.
Inside InfluxDB, we have aggregates that can get calculated on the fly that can combine tens of thousands of time series into a single view.
Each one of those queries does a read on each data point, which means that for InfluxDB, the read throughput is often many times higher than the write throughput.
Given that time series is a mostly an append only workload, you might think that it’s possible to get great performance on a B+Tree.
Appends in the keyspace are efficient and you can achieve greater than 100,000 per second.
However, we have those appends happening in individual time series.
So the inserts end up looking more like random inserts than append only inserts.
One of the biggest problems we found with time series data is that it’s very common to delete all data after it gets past a certain age.
The common pattern here is that you’ll have high precision data that is kept for a short period of time like a few hours or a few weeks.
You’ll then downsample and aggregate that data into lower precision, which you’ll keep around for much longer.
The naive implementation would be to simply delete each record once it gets past its expiration time.
However, that means that once you’re up to your window of retention, you’ll be doing just as many deletes as you do writes, which is something most storage engines aren’t designed for.
Let’s dig into the details of the two types of storage engines we tried and how these properties had a significant impact on our performance.
### LevelDB and Log Structured Merge Trees
Two years ago when we started InfluxDB, we picked LevelDB as the storage engine because it was what we used for time series data storage for the product that was the precursor to InfluxDB.
We knew that it had great properties for write throughput and everything seemed to just work.
LevelDB is an implementation of a Log Structured Merge Tree (or LSM Tree) that was built as an open source project at Google.
It exposes an API for a key/value store where the key space is sorted.
This last part is important for time series data as it would allow us to quickly go through ranges of time as long as the timestamp was in the key.
LSM Trees are based on a log that takes writes and two structures known as Mem Tables and SSTables.
These tables represent the sorted keyspace.
SSTables are read only files that continuously get replaced by other SSTables that merge inserts and updates into the keyspace.
The two biggest advantages that LevelDB had for us were high write throughput and built in compression.
However, as we learned more about what people needed with time series data, we encountered a few insurmountable challenges.
The first problem we had was that LevelDB doesn’t support hot backups.
If you want to do a safe backup of the database, you have to close it and then copy it.
The LevelDB variants RocksDB and HyperLevelDB fix this problem so we could have moved to them, but there was another problem that was more pressing that we didn’t think could be solved with either of them.
We needed to give our users a way to automatically manage the data retention of their time series data.
That meant that we’d have to do very large scale deletes.
In LSM Trees a delete is as expensive, if not more so, than a write.
A delete will write a new record known as a tombstone.
After that queries will merge the result set with any tombstones to clear out the deletes.
Later, a compaction will run that will remove the tombstone and the underlying record from the SSTable file.
To get around doing deletes, we split data across what we call shards, which are contiguous blocks of time.
Shards would typically hold either a day or 7 days worth of data.
Each shard mapped to an underlying LevelDB.
This meant that we could drop an entire day of data by just closing out the database and removing the underlying files.
Users of RocksDB may at this point bring up a feature called ColumnFamilies.
When putting time series data into Rocks, it’s common to split blocks of time into column families and then drop those when their time is up.
It’s the same general idea that you create a separate area where you can just drop files instead of updating any indexes when you delete a large block of old data.
Dropping a column family is a very efficient operation.
However, column families are a fairly new feature and we had another use case for shards.
Organizing data into shards meant that it could be moved within a cluster without having to examine billions of keys.
At the time of this writing I don’t think it’s possible to move a column family in one RocksDB to another.
Old shards are typically cold for writes so moving them around would be cheap and easy and we’d have the added benefit of having a spot in the keyspace that is cold for writes so it would be easier to do consistency checks later.
The organization of data into shards worked great for a little while until a large amount of data went into InfluxDB.
For our users that had 6 months or a year of data in large databases, they would run out of file handles.
LevelDB splits the data out over many small files.
Having dozens or hundreds of these databases open in a single process ended up creating a big problem.
It’s not something we found with a large number of users, but for anyone that was stressing the database to its limits, they were hitting this problem and we had no fix for it.
There were simply too many file handles open.
### BoltDB and mmap B+Trees
After struggling with LevelDB and its variants for a year we decided to move over to BoltDB, a pure Golang database heavily inspired by LMDB, a mmap B+Tree database written in C.
It has the same API semantics as LevelDB: a key value store where the keyspace is ordered.
Many of our users were surprised about this move after we posted some early testing results of the LevelDB variants vs.
LMDB (a mmap B+Tree) that showed RocksDB as the best performer.
However, there were other considerations that went into this decision outside of the pure write performance.
At this point our most important goal was to get to something stable that could be run in production and backed up.
BoltDB also had the advantage of being written in pure Go, which simplified our build chain immensely and made it easy to build for other OSes and platforms like Windows and ARM.
The biggest win for us was that BoltDB used a single file as the database.
At this point our most common source of bug reports were from people running out of file handles.
Bolt solved the hot backup problem, made it easy to move a shard from one server to another, and the file limit problems all at the same time.
We were willing to take a hit on write throughput if it meant that we’d have a system that was more reliable and stable that we could build on.
Our reasoning was that for anyone pushing really big write loads, they’d be running a cluster anyway.
We released versions 0.9.0 to 0.9.2 based on BoltDB.
From a development perspective it was delightful.
Clean API, fast and easy to build in our Go project, and reliable.
However, after running for a while we found a big problem with write throughput falling over.
After the database got to a certain size (over a few GB) writes would start spiking IOPS.
Some of our users were able to get past this by putting it on big hardware with near unlimited IOPS.
However, most of our users are on VMs with limited resources in the cloud.
We had to figure out a way to reduce the impact of writing a bunch of points into hundreds of thousands of series at a time.
With the 0.9.3 and 0.9.4 releases our plan was to put a write ahead log in front of Bolt.
That way we could reduce the number of random insertions into the keyspace.
Instead, we’d buffer up multiple writes at once that were next to each other and then flush them.
However, that only served to delay the problem.
High IOPS still became an issue and it showed up very quickly for anyone operating at even moderate work loads.
However, my experience building the first WAL implementation in front of Bolt gave me the confidence I needed that the write problem could be solved.
The performance of the WAL itself was fantastic, the index simply couldn’t keep up.
At this point I started thinking again about how we could create something similar to an LSM Tree that could keep up with our write load.
### The new InfluxDB storage engine and LSM refined
The new InfluxDB storage engine looks very similar to a LSM Tree.
It has a write ahead log, a collection of data files which are read-only indexes similar in structure to SSTables in an LSM Tree, and a few other files that keep compressed metadata.
InfluxDB will create a shard for each block of time.
For example, if you have a retention policy with an unlimited duration, shards will get created for each 7 day block of time.
Each of these shards maps to an underlying storage engine database.
Each of these databases has its own WAL, compressed metadata that describe which series are in the index, and the index data files.
We’ll dig into each of these parts of the storage engine.
#### The Write Ahead Log
The WAL is organized as a bunch of files that look like _000001.wal.
The file numbers are monotonically increasing.
When a file reaches 2MB in size, it is closed and a new one is opened.
There is a single write lock into the WAL that keeps many goroutines from trying to write to the file at once.
The lock is only obtained to write the already serialized and compressed bytes to the file.
When a write comes in with points and optionally new series and fields defined, they are serialized, compressed using Snappy, and written to a WAL file.
The file is fsync’d and the data added to an in memory index before a success is returned.
This means that batching points together will be required to achieve high throughput performance.
Each entry in the WAL follows a TLV standard with a single byte representing what the type of entry it is (points, new fields, new series, or delete), a 4 byte uint32 for the length of the compressed block, and then the compressed block.
It’s possible to disable the persistence of the WAL, instead relying on a regular flush to the index.
This would result in the best possible performance at the cost of opening up a window of data loss for unflushed writes.
The WAL keeps an in memory cache of all data points that are written to it.
The points are organized by the key, which is the measurement, tagset, and unique field.
Each field is kept as its own time ordered range.
The data isn’t compressed while in memory.
Queries to the storage engine will merge data from the WAL with data from the index.
The cache uses a read-write lock to enable many goroutines to access the cache.
When a query happens a copy of the data is made from the cache to be processed by the query engine.
This way writes that come in while a query is happening won’t change the result.
Deletes sent to the WAL will clear out the cache for the given key, persist in the WAL file and tell the index to keep a tombstone in memory.
The WAL exposes a few controls for flush behavior.
The two most important controls are the memory limits.
There is a lower bound, which will trigger a flush to the index.
There is also an upper bound limit at which the WAL will start rejecting writes.
This is useful if the index gets backed up flushing and we need to apply back pressure to clients writing data.
It also ensures that we can keep from running out of memory if the WAL gets too big.
The checks for memory thresholds occur on every write.
The other flush controls are time based.
The idle flush will have the WAL flush to the index if it hasn’t received a write within a given amount of time.
The second control is to have the WAL periodically flush even when taking writes.
For instance if you disabled persistence and set this to 30 seconds, you would have a 30 second window of potential data loss.
Finally, the WAL is fully flushed on startup.
If it was particularly backed up this could cause the startup time to take a bit.
#### Data Files (like SSTables)
The storage index is a collection of read-only index files that get memory mapped.
The structure of these files looks very similar to an SSTable in LevelDB or other LSM Tree variants.
Each file has a structure that looks like this:

The magic number at the beginning identifies the file as a data file for the PD1 storage engine.
We’ll go into the details of the data and index blocks in a bit.
The min time and max time are nanosecond epochs of the minimum and maximum timestamps of the points in any of the data blocks of the file.
Finally, the file ends with a uint32 of the number of series contained in the data file.
The structure of each data block looks like this:

The ID is the identifier for the series and field.
IDs are generated by taking the fnv64-a hash of the series key (measurement name + tagset) and the field name.
We’ll discuss how we handle ID hash collisions later in this doc.
The compressed block uses a compression scheme depending on the type of the field.
Details on compression are covered later, but for now it’s important to know that the first 8 bytes of every compressed block has the minimum timestamp for all values in the block.
By default, up to 1000 values are encoded in a block.
The data blocks are always arranged in sorted order by the IDs and if there are multiple blocks for a given ID in a single file, those blocks will be arranged by time.
The timestamps for values in the blocks for the same ID are increasing and non-overlapping.
The index block in a data file looks like this:

The index block contains all the IDs that have data blocks in the file and the position of their first block.
All IDs are in sorted order, which is important later for finding the starting position of an ID’s block.
Note that the starting position is a uint32 value, which means that data files are limited in size to a maximum of 4GB.
#### Writes to the Index
The storage index keeps a collection of data files.
These files have non-overlapping time ranges.
The index keeps a mapping in memory of the memory mapped data files that exist and their min and max times.
The files are kept in a sorted array by their time.
The first thing that happens when the WAL flushes a block of writes to the index is mapping the keys of the series and fields that have values to their unique ID.
Most IDs should simply be the fnv64-a hash of the series key and the field name.
However, we need to ensure that we keep track of any collisions.
The index keeps a file called "names" that keeps a compressed JSON map of key to ID.
When a flush happens we ensure that any of the keys coming in have an ID in the map that is equal to the fnv64-a hash.
If it is present in the map and the same we move on.
If it isn’t present in the map, we add it.
If the ID is taken already, we keep track of the collision.
If there are any new keys, we marshall, compress and write a new names file.
The old file is removed once the new one has been written and closed.
If there are any collisions, we write those into a collisions file.
This is read on startup of the index so collisions can be kept in memory.
We’ll talk more about how collisions are handled later.
This name decoding scheme is fairly inefficient since we’re marshaling this entire map on every WAL flush.
The alternative is to keep it in memory, but that is also expensive as there are many indexes (one per shard) in a running InfluxDB process.
We could also just keep the map in memory while a given shard is hot for writes (i.e.
its time range is current for now).
In testing the cost of decoding and rewriting the names file hasn’t been a big problem and the simplicity of the scheme makes it a bit easier to work with.
We’ve been testing up to 500k unique keys at this point.
After the ID resolution is done the write will be broken up by the time of the individual data points.
If no data file exists for any of the time ranges, a new one will be created and written.
If a data file already exists for the given time range and it is less than a configurable size (5MB by default), then the data file will be read in and the new values merged with it and a new data file will be created.
While this new file is getting written, all queries will hit the old data file and continue to use the WAL cache, which won’t be cleared until the write to the index is confirmed.
Once the new file is written, the engine will obtain a write lock to replace the old data file with the new data file in the in memory index, remove the old file from the filesystem and then return success back to the WAL.
We’ll talk about how recovery is handled in a later section of this document.
Because of this structure, multiple ranges of time can be written simultaneously, which enables us to perform compactions on old time ranges while still accepting writes for current time ranges.
We’ll cover the details of compaction in a later section.
Writes will only block reads during the window of time that the in-memory sorted list of data files is modified (an operation that takes less than a few microseconds).
The index is optimized for the append only workload that is most common in InfluxDB usage.
It’s possible to update old data points, but that operation can be expensive because data files will need to be rewritten.
However, historical backfill when initially setting up a database is very efficient and has a workload that looks like filling in new data as long as the backfill is done in time ascending order.
Even during normal operation, data files continually get rewritten as the WAL flushes to the index.
However, the data files are generally small at that point so the cost of rewriting them is negligible.
Later, compactions will combine older data files into larger ones.
#### Compaction
In the background the index continually checks for old data files that can be combined together.
By default, any files with a time older than 30 minutes will be combined together.
The process is the same as during a write, a new file is created, the two data files are read in together and the merged stream of sorted IDs and blocks are written out as they are read from the two files.
Once the new file is written, the index obtains the write lock to modify the collection of data files and removes the older two files.
The compaction process will only attempt to compact data files that are less than a configurable size (500MB by default and up to a max of 1GB).
#### Updates
Updates are held first in the WAL.
If there are a number of updates to the same range, ideally the WAL will buffer them together before it gets flushed to the index.
The index will simply rewrite the data file that contains the updated data.
If the updates are to a recent block of time, the updates will be relatively inexpensive.
#### Deletes
Deletes are handled in two phases.
First, when the WAL gets a delete it will persist it in the log, clear its cache of that series, and tell the index to keep an in-memory tombstone of the delete.
When a query comes into the index, it will check it against any of the in-memory tombstones and act accordingly.
Later, when the WAL flushes to the index, it will include the delete and any data points that came into the series after the delete.
The index will handle the delete first by rewriting any data files that contain that series to remove them.
Then it will persist any new data (for this series or any others), remove the tombstone from memory and return success to the WAL.
#### Metadata
Metadata for all the series and fields in the shard are kept in 2 files named "names" and "fields".
These two files contain a single Snappy compressed block of the serialized JSON of any names or fields in the shard.
This means that any flush from the WAL that contains either new fields or series, will force the old file to be read in, decompressed, marshalled, merged with the new series and a new file to be written.
Because the WAL buffers these new definitions, the cost is generally negligible.
However, as the number of series in a shard gets very high it can become expensive.
We’ve tested up to 500k unique series and this scheme still works well.
#### Seeking and Reading a Series
When a seek comes into the storage engine, it is a seek to a given time associated with a specific series key and field.
First, we do a binary search on the data files to find the file that has a time range that matches the time we’re seeking to.
Once we have the data file we need to find the position in the file for the block that contains the given time.
First, we check the collisions map to see if this seek is to an ID that doesn’t match up with the hash ID.
If it’s not there, we do a fnv64-a hash against the series key and field name to get its ID.
Now that we have the ID we check the end of the file for the series count.
Remember that it’s memory mapped so this should be fast.
Now that we know the count of the series, we know which byte positions in the file contain the index of IDs to starting position.
We’ll now do a binary search against the section of the index to find the ID and its position.
Remember that the index is sorted by increasing IDs.
This operation is very efficient and the index for a data file is in the memory map.
Now that we have the starting position we can look at the first block’s timestamp and the next block’s timestamp.
We traverse the blocks until we find the one that matches up with the timestamp we’re seeking to.
This means we’re making jumps in the file by the length of the compressed blocks.
In practice, a shard will have the data for a day or 7 days.
For people with regular time series that sample every 10 seconds, they’ll have data files that contain either 8,640 data points (1 day) for each series or that times 7.
That means that at most we’ll end up making 56 jumps to the last block.
In practice it’s likely that 7 days of data would be split across multiple data files, reducing the number of blocks for a given series in a file.
Once we’ve found the matching block, we decompress it and go to the specific point.
As the query engine traverses the series by getting subsequent points, we go through that block, then decompress the next one, then jump to the next data file, until we ultimately reach the end of the shard.
#### Compression
Each block is compressed to reduce storage space and disk IO when querying.
A block contains the timestamps and values for a given series and field.
Each block has one byte header, followed by the compressed timestamps and then the compressed values.
The timestamps and values are stored separately as two compressed parts using different encodings depending on the data type and its shape.
Storing them independently allows timestamp encoding to be used with different field types more easily.
It also allows for different encodings to be used depending on the type of the data.
For example, some points may be able to use run-length encoding whereas other may not.
Each value type also contains a 1 byte header indicating the type of compression for the remaining bytes.
The four high bits store the compression type and the four low bits are used by the encoder if needed.

Timestamp encoding is adaptive and based on the structure of the timestamps that are encoded.
It uses a combination of delta encoding, scaling and compression using simple8b, run-length encoding as well as falling back to no compression if needed.
Timestamp resolution can be as granular as a nanosecond and, uncompressed, require 8 bytes to store.
During encoding, the values are first delta-encoded.
The first value is the starting timestamp and subsequent values are the differences from the prior value.
This usually converts the values into much smaller integers that are easier to compress.
Many timestamps are also monotonically increasing and fall on even boundaries of time such as every 10s.
When timestamps have this structure, they are scaled by the largest common divisor that Zis also a factor of 10.
This has the effect of converting very large integer deltas into smaller ones that compress even better.
Using these adjusted values, if all the deltas are the same, the time range is stored using run-length encoding.
If run-length encoding is not possible and all values are less than 1 << 60 - 1 (~36.5 yrs in nanosecond resolution), then the timestamps are encoded using the simple8b encoding which is a 64bit word-aligned integer encoding.
This encoding packs up multiple integers into a single 64bit word.
If any value exceeds the maximum values, the deltas are stored uncompressed using 8 bytes each for the block.
Future encodings will use a patched scheme such as Patched Frame-Of-Reference (PFOR) to handle outlier more effectively.
Floats are encoded using an implementation of the Facebook Gorilla paper.
This encoding XORs consecutive values together which produces a small result when the values are close together.
The delta is then stored using control bits to indicate how many leading and trailing zero are in the XOR value.
Our version removes the timestamp encoding, as described in paper, and only encodes the float values.
Integer encoding uses two different strategies depending on the range of values in the uncompressed data.
Encoded values are first encoded using zig zag encoding which is also used for signed integers in Google Protocol Buffers.
This interleaves positive and negative integers across a range of positive integers.
For example, [-2,-1,0,1] becomes [3,1,0,2].
See https://developers.google.com/protocol-buffers/docs/encoding#signed-integers for more information.
If all the zig zag encoded values less than 1 << 60 - 1, they are compressed using the simple8b encoding.
If any values is larger than the maximum value, then values are stored uncompressed in the block.
Booleans are encoded using a simple bit packing strategy where each boolean uses 1 bit.
The number of booleans encoded is stored using variable-byte encoding at the beginning of the block.
Strings are encoding using Snappy compression.
Each string is packed next each other in order and compressed as one larger block.
| {
"pile_set_name": "Github"
} |
.. currentmodule:: PyQt5.QtCore
QXmlStreamEntityResolver
------------------------
.. class:: QXmlStreamEntityResolver
`C++ documentation <https://doc.qt.io/qt-5/qxmlstreamentityresolver.html>`_
| {
"pile_set_name": "Github"
} |
# Specta
A light-weight TDD / BDD framework for Objective-C.
### Status
[](https://travis-ci.org/specta/specta)
[](https://coveralls.io/r/specta/specta)
## FEATURES
* An Objective-C RSpec-like BDD DSL
* Quick and easy set up
* Built on top of XCTest
* Excellent Xcode integration
## SCREENSHOT

## SETUP
Use [CocoaPods](http://github.com/CocoaPods/CocoaPods), [Carthage](https://github.com/carthage/carthage) or [Set up manually](#setting-up-manually)
### CocoaPods
1. Add Specta to your project's `Podfile`:
```ruby
target :MyApp do
# your app dependencies
end
target :MyAppTests do
pod 'Specta', '~> 0.5'
# pod 'Expecta', '~> 0.3' # expecta matchers
# pod 'OCMock', '~> 2.2' # OCMock
# pod 'OCHamcrest', '~> 3.0' # hamcrest matchers
# pod 'OCMockito', '~> 1.0' # OCMock
# pod 'LRMocky', '~> 0.9' # LRMocky
end
```
2. Run `pod update` or `pod install` in your project directory.
### Carthage
1. Add Specta to your project's `Cartfile.private`
```
github "specta/specta" ~> 0.5
```
2. Run `carthage update` in your project directory
3. Drag the appropriate `Specta.framework` for your platform (located in Carthage/Build/) into your application’s Xcode project, and add it to your test target(s).
4. If you are building for iOS, a new `Run Script Phase` must be added to copy the framework. The instructions can be found on [Carthage's getting started instructions](https://github.com/carthage/carthage#getting-started)
### SETTING UP MANUALLY
1. Clone from Github.
2. Run `rake` in project root to build.
3. Add a "Cocoa/Cocoa Touch Unit Testing Bundle" target if you don't already have one.
4. Copy and add all header files in `Products` folder to the Test target in your Xcode project.
5. For **OS X projects**, copy and add `Specta.framework` in `Products/osx` folder to the test target in your Xcode project.
For **iOS projects**, copy and add `Specta.framework` in `Products/ios` folder to the test target in your Xcode project.
You can alternatively use `libSpecta.a`, if you prefer to add it as a static library for your project. (iOS 7 and below require this)
6. Add `-ObjC` and `-all_load` to the "Other Linker Flags" build setting for the test target in your Xcode project.
7. If you encounter linking issues with `_llvm_*` symbols, ensure your target's "Generate Test Coverage Files" and "Instrument Program Flow" build settings are set to `Yes`.
## EXAMPLE
```objective-c
#import <Specta/Specta.h> // #import "Specta.h" if you're using libSpecta.a
SharedExamplesBegin(MySharedExamples)
// Global shared examples are shared across all spec files.
sharedExamplesFor(@"foo", ^(NSDictionary *data) {
__block id bar = nil;
beforeEach(^{
bar = data[@"bar"];
});
it(@"should not be nil", ^{
XCTAssertNotNil(bar);
});
});
SharedExamplesEnd
SpecBegin(Thing)
describe(@"Thing", ^{
sharedExamplesFor(@"another shared behavior", ^(NSDictionary *data) {
// Locally defined shared examples can override global shared examples within its scope.
});
beforeAll(^{
// This is run once and only once before all of the examples
// in this group and before any beforeEach blocks.
});
beforeEach(^{
// This is run before each example.
});
it(@"should do stuff", ^{
// This is an example block. Place your assertions here.
});
it(@"should do some stuff asynchronously", ^{
waitUntil(^(DoneCallback done) {
// Async example blocks need to invoke done() callback.
done();
});
});
itShouldBehaveLike(@"a shared behavior", @{@"key" : @"obj"});
itShouldBehaveLike(@"another shared behavior", ^{
// Use a block that returns a dictionary if you need the context to be evaluated lazily,
// e.g. to use an object prepared in a beforeEach block.
return @{@"key" : @"obj"};
});
describe(@"Nested examples", ^{
it(@"should do even more stuff", ^{
// ...
});
});
pending(@"pending example");
pending(@"another pending example", ^{
// ...
});
afterEach(^{
// This is run after each example.
});
afterAll(^{
// This is run once and only once after all of the examples
// in this group and after any afterEach blocks.
});
});
SpecEnd
```
* `beforeEach` and `afterEach` are also aliased as `before` and `after` respectively.
* `describe` is also aliased as `context`.
* `it` is also aliased as `example` and `specify`.
* `itShouldBehaveLike` is also aliased as `itBehavesLike`.
* Use `pending` or prepend `x` to `describe`, `context`, `example`, `it`, and `specify` to mark examples or groups as pending.
* Use `^(DoneCallback done)` as shown in the example above to make examples wait for completion. `done()` callback needs to be invoked to let Specta know that your test is complete. The default timeout is 10.0 seconds but this can be changed by calling the function `setAsyncSpecTimeout(NSTimeInterval timeout)`.
* `(before|after)(Each/All)` also accept `^(DoneCallback done)`s.
* Do `#define SPT_CEDAR_SYNTAX` before importing Specta if you prefer to write `SPEC_BEGIN` and `SPEC_END` instead of `SpecBegin` and `SpecEnd`.
* Prepend `f` to your `describe`, `context`, `example`, `it`, and `specify` to set focus on examples or groups. When specs are focused, all unfocused specs are skipped.
* To use original XCTest reporter, set an environment variable named `SPECTA_REPORTER_CLASS` to `SPTXCTestReporter` in your test scheme.
* Set an environment variable `SPECTA_NO_SHUFFLE` with value `1` to disable test shuffling.
* Set an environment variable `SPECTA_SEED` to specify the random seed for test shuffling.
Standard XCTest matchers such as `XCTAssertEqualObjects` and `XCTAssertNil` work, but you probably want to add a nicer matcher framework - [Expecta](http://github.com/specta/expecta/) to your setup. Or if you really prefer, [OCHamcrest](https://github.com/jonreid/OCHamcrest) works fine too. Also, add a mocking framework: [OCMock](http://ocmock.org/).
## RUNNING TESTS IN COMMAND LINE
* Run `rake test` in the cloned folder.
## CONTRIBUTION GUIDELINES
* Please use only spaces and indent 2 spaces at a time.
* Please prefix instance variable names with a single underscore (`_`).
* Please prefix custom classes and functions defined in the global scope with `SPT`.
## LICENSE
Copyright (c) 2012-2015 [Specta Team](https://github.com/specta?tab=members). This software is licensed under the [MIT License](http://github.com/specta/specta/raw/master/LICENSE).
| {
"pile_set_name": "Github"
} |
/* Copyright (C) 2013 Webyog Inc
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 "PreferenceCommunity.h"
#include "EditorFont.h"
#include "CommonHelper.h"
extern PGLOBALS pGlobals;
/* Applies all the changes or current values to the .ini file */
void
PreferencesCommunity::Apply()
{
if(m_ispreferenceapplied)
return;
SaveGeneralPreferences(m_hwnd, GENERALPREF_PAGE);
SaveFontPreferences(m_hwnd, FONT_PAGE);
SaveOthersPreferences(m_hwnd, OTHERS_PAGE);
EnumChildWindows(pGlobals->m_hwndclient, EnumChildProc, (LPARAM)this);
m_ispreferenceapplied = wyTrue;
return;
}
void
PreferencesCommunity::RestoreAllDefaults()
{
m_isrestorealldefaults = wyTrue;//user clicked RestoreAllTabs button
SetGenPrefDefaultAllTabValues(m_hwnd, GENERALPREF_PAGE); //Setting General pref dialogue with default values
SetFontPrefDefAllTabValues(m_hwnd, FONT_PAGE);//Setting Font pref dialogue with default values
SetOthersPrefDefaultAllTabValues(m_hwnd, OTHERS_PAGE);//Setting Others pref dialogue with default values
return;
}
//Disabling all the Enterprise-Powertools tab controls
void
PreferencesCommunity::EnterprisePrefHandleWmInitDialog(HWND hwnd)
{
HWND hwndacgrp = NULL;
wyInt32 publicid[] = { IDC_PTGROUP, IDC_ACGROUP, IDC_DEFTABGROUP, IDC_AUTOCOMPLETE,
IDC_AUTOCOMPLETEHELP, IDC_AUTOCOMPLETEREBUILD,
IDC_AUTOCOMPLETESHOWTOOLTIP, IDC_TAGDIRGROUP,
IDC_AUTOCOMPLETETAGSDIR, IDC_DIRSEL, IDC_CONFIRMONSDCLOSE,
IDC_POWERTOOLSRESTOREALL, IDC_POWERTOOLSRESTORETAB, IDC_PQA,
IDC_PQAEXPLAIN, IDC_PQAEXPLAINEXT, IDC_PQAPROF,
IDC_PQAADVISOR, IDC_PQASTATUS};
wyInt32 count = sizeof(publicid)/ sizeof(publicid[0]);
if(m_startpage == AC_PAGE)
HandlerToSetWindowPos(hwnd);
EnableOrDisable(hwnd, publicid, count , wyFalse);
//Power Tools Gropbox handle
hwndacgrp = GetDlgItem(hwnd, IDC_PTGROUP);
//Sets the Groupbox options
SendMessage(hwndacgrp, WM_SETTEXT, 0, (LPARAM)COMMMUNITY_POWERTOOLS);
}
void
PreferencesCommunity::EntPrefHandleWmCommand(HWND hwnd, WPARAM wParam)
{
}
void
PreferencesCommunity::FormatterPrefHandleWmNotify(HWND hwnd, LPARAM lParam)
{
LPNMHDR lpnm = (LPNMHDR)lParam;
wyString dirstr;
switch (lpnm->code)
{
case PSN_SETACTIVE:
dirstr.SetAs(m_directory);
m_hwnd = hwnd;
pGlobals->m_prefpersist=FORMATTER_PAGE;
wyIni::IniWriteInt(GENERALPREFA, "PrefPersist", FORMATTER_PAGE, dirstr.GetString());
break;
case PSN_APPLY: //user pressed the OK button.
Apply();
break;
}
}
void
PreferencesCommunity::ACPrefHandleWmNotify(HWND hwnd, LPARAM lParam)
{
LPNMHDR lpnm = (LPNMHDR)lParam;
wyString dirstr;
switch (lpnm->code)
{
case PSN_SETACTIVE:
dirstr.SetAs(m_directory);
m_hwnd = hwnd;
pGlobals->m_prefpersist=AC_PAGE;
wyIni::IniWriteInt(GENERALPREFA, "PrefPersist", AC_PAGE, dirstr.GetString());
break;
case PSN_APPLY: //user pressed the OK button.
Apply();
break;
}
}
//Disabling all Enterprise-Formtter tab controls
void
PreferencesCommunity::FormatterPrefHandleWmInitDialog(HWND hwnd)
{
HWND hwndacgrp = NULL;
HWND hwndpreview = NULL;
wyInt32 publicid[] = { IDC_OPTIONSGROUP, IDC_TABCOLLIST, IDC_LINEBRK,
IDC_PREVIEWGROUP, IDC_STACKED, IDC_BEFORECOMMA,
IDC_AFTERCOMMA, IDC_NOTSTACKED,
IDC_INDENT, IDC_INDENTATION, IDC_SPACES, IDC_FORMATTERPREVIEW,
IDC_FORMATTERRESTOREALL, IDC_FORMATTERRESTORETAB };
wyInt32 count = sizeof(publicid)/ sizeof(publicid[0]);
if(m_startpage == FORMATTER_PAGE)
HandlerToSetWindowPos(hwnd);
hwndpreview = GetDlgItem(hwnd, IDC_FORMATTERPREVIEW);
//setting editor properties
SetPreviewEditor(hwnd);
//Setting a query to preview window
SendMessage(hwndpreview, SCI_SETTEXT, 0, (LPARAM)FORMATTER_PREVIEW);
EnableOrDisable(hwnd, publicid, count , wyFalse);
//Formatter Groupbox
hwndacgrp = GetDlgItem(hwnd, IDC_OPTIONSGROUP);
//Sets the Groupbox caption
SendMessage(hwndacgrp, WM_SETTEXT, 0, (LPARAM)COMMUNITY_FORMATTER);
}
void
PreferencesCommunity::FormatterPrefHandleWmCommand(HWND hwnd, WPARAM wParam)
{
} | {
"pile_set_name": "Github"
} |
/*
[auto_generated]
boost/numeric/odeint/stepper/detail/adams_moulton_call_algebra.hpp
[begin_description]
Algebra caller for the Adams Moulton method.
[end_description]
Copyright 2011-2012 Karsten Ahnert
Copyright 2011 Mario Mulansky
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)
*/
#ifndef BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_MOULTON_CALL_ALGEBRA_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_MOULTON_CALL_ALGEBRA_HPP_INCLUDED
#include <boost/assert.hpp>
namespace boost {
namespace numeric {
namespace odeint {
namespace detail {
template< size_t Step , class Algebra , class Operations >
struct adams_moulton_call_algebra;
template< class Algebra , class Operations >
struct adams_moulton_call_algebra< 1 , Algebra , Operations >
{
template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time >
void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , Time dt ) const
{
typedef typename Coefficients::value_type value_type;
algebra.for_each3( out , in , dxdt , typename Operations::template scale_sum2< value_type , Time >( 1.0 , dt * coef[0] ) );
}
};
template< class Algebra , class Operations >
struct adams_moulton_call_algebra< 2 , Algebra , Operations >
{
template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time >
void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , Time dt ) const
{
typedef typename Coefficients::value_type value_type;
algebra.for_each4( out , in , dxdt , steps[0].m_v ,
typename Operations::template scale_sum3< value_type , Time , Time >( 1.0 , dt * coef[0] , dt * coef[1] ) );
}
};
template< class Algebra , class Operations >
struct adams_moulton_call_algebra< 3 , Algebra , Operations >
{
template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time >
void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , Time dt ) const
{
typedef typename Coefficients::value_type value_type;
algebra.for_each5( out , in , dxdt , steps[0].m_v , steps[1].m_v ,
typename Operations::template scale_sum4< value_type , Time , Time >( 1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] ) );
}
};
template< class Algebra , class Operations >
struct adams_moulton_call_algebra< 4 , Algebra , Operations >
{
template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time >
void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , Time dt ) const
{
typedef typename Coefficients::value_type value_type;
algebra.for_each6( out , in , dxdt , steps[0].m_v , steps[1].m_v , steps[2].m_v ,
typename Operations::template scale_sum5< value_type , Time , Time , Time >(
1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] ) );
}
};
template< class Algebra , class Operations >
struct adams_moulton_call_algebra< 5 , Algebra , Operations >
{
template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time >
void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , Time dt ) const
{
typedef typename Coefficients::value_type value_type;
algebra.for_each7( out , in , dxdt , steps[0].m_v , steps[1].m_v , steps[2].m_v , steps[3].m_v ,
typename Operations::template scale_sum6< value_type , Time , Time , Time , Time >(
1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] , dt * coef[4] ) );
}
};
template< class Algebra , class Operations >
struct adams_moulton_call_algebra< 6 , Algebra , Operations >
{
template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time >
void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , Time dt ) const
{
typedef typename Coefficients::value_type value_type;
algebra.for_each8( out , in , dxdt , steps[0].m_v , steps[1].m_v , steps[2].m_v , steps[3].m_v , steps[4].m_v ,
typename Operations::template scale_sum7< value_type , Time , Time , Time , Time , Time >(
1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] , dt * coef[4] , dt * coef[5] ) );
}
};
template< class Algebra , class Operations >
struct adams_moulton_call_algebra< 7 , Algebra , Operations >
{
template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time >
void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , Time dt ) const
{
typedef typename Coefficients::value_type value_type;
algebra.for_each9( out , in , dxdt , steps[0].m_v , steps[1].m_v , steps[2].m_v , steps[3].m_v , steps[4].m_v , steps[5].m_v ,
typename Operations::template scale_sum8< value_type , Time , Time , Time , Time , Time , Time >(
1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] , dt * coef[4] , dt * coef[5] , dt * coef[6] ) );
}
};
template< class Algebra , class Operations >
struct adams_moulton_call_algebra< 8 , Algebra , Operations >
{
template< class StateIn , class StateOut , class DerivIn , class StepStorage , class Coefficients , class Time >
void operator()( Algebra &algebra , const StateIn &in , StateOut &out , const DerivIn &dxdt , const StepStorage &steps , const Coefficients &coef , Time dt ) const
{
typedef typename Coefficients::value_type value_type;
algebra.for_each10( out , in , dxdt , steps[0].m_v , steps[1].m_v , steps[2].m_v , steps[3].m_v , steps[4].m_v , steps[5].m_v , steps[6].m_v ,
typename Operations::template scale_sum9< value_type , Time , Time , Time , Time , Time , Time , Time >(
1.0 , dt * coef[0] , dt * coef[1] , dt * coef[2] , dt * coef[3] , dt * coef[4] , dt * coef[5] , dt * coef[6] , dt * coef[7] ) );
}
};
} // detail
} // odeint
} // numeric
} // boost
#endif // BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_MOULTON_CALL_ALGEBRA_HPP_INCLUDED
| {
"pile_set_name": "Github"
} |
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
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.
| {
"pile_set_name": "Github"
} |
<html>
<head>
<script type="text/tiscript">
function self.ready()
{
const items = ["apple","orange","lime","lemon","pear","banan","kiwi","pineapple"];
function* forward()
{
for( var i = 0; i < items.length; ++i )
yield items[i];
}
function* backward()
{
for( var i = items.length - 1; i >=0 ; --i )
yield items[i];
}
function* step()
{
var i = 0;
while( i < items.length ) {
var n = yield items[i];
debug log: n;
i += n || 1;
}
}
var ol = self.select("ol#forward");
for(var item in forward())
ol.append([li: item]);
ol = self.select("ol#backward");
for(var item in backward())
ol.append([li: item]);
ol = self.select("ol#step");
var iterator = step();
while(var item = iterator.next(2))
ol.append([li:item]);
}
</script>
</head>
<body>
Fruits, forward:
<ol #forward />
Fruits, backward:
<ol #backward />
Fruits, odd (iterator.next() test):
<ol #step />
</body>
</html> | {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2008-2011 Atheros Communications Inc.
*
* 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 THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "common.h"
#define FUDGE 2
/* Calculate the modulo of a 64 bit TSF snapshot with a TU divisor */
static u32 ath9k_mod_tsf64_tu(u64 tsf, u32 div_tu)
{
u32 tsf_mod, tsf_hi, tsf_lo, mod_hi, mod_lo;
tsf_mod = tsf & (BIT(10) - 1);
tsf_hi = tsf >> 32;
tsf_lo = ((u32) tsf) >> 10;
mod_hi = tsf_hi % div_tu;
mod_lo = ((mod_hi << 22) + tsf_lo) % div_tu;
return (mod_lo << 10) | tsf_mod;
}
static u32 ath9k_get_next_tbtt(struct ath_hw *ah, u64 tsf,
unsigned int interval)
{
unsigned int offset;
tsf += TU_TO_USEC(FUDGE + ah->config.sw_beacon_response_time);
offset = ath9k_mod_tsf64_tu(tsf, interval);
return (u32) tsf + TU_TO_USEC(interval) - offset;
}
/*
* This sets up the beacon timers according to the timestamp of the last
* received beacon and the current TSF, configures PCF and DTIM
* handling, programs the sleep registers so the hardware will wakeup in
* time to receive beacons, and configures the beacon miss handling so
* we'll receive a BMISS interrupt when we stop seeing beacons from the AP
* we've associated with.
*/
int ath9k_cmn_beacon_config_sta(struct ath_hw *ah,
struct ath_beacon_config *conf,
struct ath9k_beacon_state *bs)
{
struct ath_common *common = ath9k_hw_common(ah);
int dtim_intval;
u64 tsf;
/* No need to configure beacon if we are not associated */
if (!test_bit(ATH_OP_PRIM_STA_VIF, &common->op_flags)) {
ath_dbg(common, BEACON,
"STA is not yet associated..skipping beacon config\n");
return -EPERM;
}
memset(bs, 0, sizeof(*bs));
conf->intval = conf->beacon_interval;
/*
* Setup dtim parameters according to
* last beacon we received (which may be none).
*/
dtim_intval = conf->intval * conf->dtim_period;
/*
* Pull nexttbtt forward to reflect the current
* TSF and calculate dtim state for the result.
*/
tsf = ath9k_hw_gettsf64(ah);
conf->nexttbtt = ath9k_get_next_tbtt(ah, tsf, conf->intval);
bs->bs_intval = TU_TO_USEC(conf->intval);
bs->bs_dtimperiod = conf->dtim_period * bs->bs_intval;
bs->bs_nexttbtt = conf->nexttbtt;
bs->bs_nextdtim = conf->nexttbtt;
if (conf->dtim_period > 1)
bs->bs_nextdtim = ath9k_get_next_tbtt(ah, tsf, dtim_intval);
/*
* Calculate the number of consecutive beacons to miss* before taking
* a BMISS interrupt. The configuration is specified in TU so we only
* need calculate based on the beacon interval. Note that we clamp the
* result to at most 15 beacons.
*/
bs->bs_bmissthreshold = DIV_ROUND_UP(conf->bmiss_timeout, conf->intval);
if (bs->bs_bmissthreshold > 15)
bs->bs_bmissthreshold = 15;
else if (bs->bs_bmissthreshold <= 0)
bs->bs_bmissthreshold = 1;
/*
* Calculate sleep duration. The configuration is given in ms.
* We ensure a multiple of the beacon period is used. Also, if the sleep
* duration is greater than the DTIM period then it makes senses
* to make it a multiple of that.
*
* XXX fixed at 100ms
*/
bs->bs_sleepduration = TU_TO_USEC(roundup(IEEE80211_MS_TO_TU(100),
conf->intval));
if (bs->bs_sleepduration > bs->bs_dtimperiod)
bs->bs_sleepduration = bs->bs_dtimperiod;
/* TSF out of range threshold fixed at 1 second */
bs->bs_tsfoor_threshold = ATH9K_TSFOOR_THRESHOLD;
ath_dbg(common, BEACON, "bmiss: %u sleep: %u\n",
bs->bs_bmissthreshold, bs->bs_sleepduration);
return 0;
}
EXPORT_SYMBOL(ath9k_cmn_beacon_config_sta);
void ath9k_cmn_beacon_config_adhoc(struct ath_hw *ah,
struct ath_beacon_config *conf)
{
struct ath_common *common = ath9k_hw_common(ah);
conf->intval = TU_TO_USEC(conf->beacon_interval);
if (conf->ibss_creator)
conf->nexttbtt = conf->intval;
else
conf->nexttbtt = ath9k_get_next_tbtt(ah, ath9k_hw_gettsf64(ah),
conf->beacon_interval);
if (conf->enable_beacon)
ah->imask |= ATH9K_INT_SWBA;
else
ah->imask &= ~ATH9K_INT_SWBA;
ath_dbg(common, BEACON,
"IBSS (%s) nexttbtt: %u intval: %u conf_intval: %u\n",
(conf->enable_beacon) ? "Enable" : "Disable",
conf->nexttbtt, conf->intval, conf->beacon_interval);
}
EXPORT_SYMBOL(ath9k_cmn_beacon_config_adhoc);
/*
* For multi-bss ap support beacons are either staggered evenly over N slots or
* burst together. For the former arrange for the SWBA to be delivered for each
* slot. Slots that are not occupied will generate nothing.
*/
void ath9k_cmn_beacon_config_ap(struct ath_hw *ah,
struct ath_beacon_config *conf,
unsigned int bc_buf)
{
struct ath_common *common = ath9k_hw_common(ah);
/* NB: the beacon interval is kept internally in TU's */
conf->intval = TU_TO_USEC(conf->beacon_interval);
conf->intval /= bc_buf;
conf->nexttbtt = ath9k_get_next_tbtt(ah, ath9k_hw_gettsf64(ah),
conf->beacon_interval);
if (conf->enable_beacon)
ah->imask |= ATH9K_INT_SWBA;
else
ah->imask &= ~ATH9K_INT_SWBA;
ath_dbg(common, BEACON,
"AP (%s) nexttbtt: %u intval: %u conf_intval: %u\n",
(conf->enable_beacon) ? "Enable" : "Disable",
conf->nexttbtt, conf->intval, conf->beacon_interval);
}
EXPORT_SYMBOL(ath9k_cmn_beacon_config_ap);
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Aurelia</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<base href="/">
</head>
<body>
<app></app>
</body>
</html>
| {
"pile_set_name": "Github"
} |
package ch06.ex1_7_TheLetFunction
fun sendEmailTo(email: String) {
println("Sending email to $email")
}
fun main(args: Array<String>) {
var email: String? = "[email protected]"
email?.let { sendEmailTo(it) }
email = null
email?.let { sendEmailTo(it) }
}
| {
"pile_set_name": "Github"
} |
##
# This file is part of WhatWeb and may be subject to
# redistribution and commercial restrictions. Please see the WhatWeb
# web site for more information on licensing and terms of use.
# https://www.morningstarsecurity.com/research/whatweb
##
Plugin.define do
name "Timesheet-NG"
authors [
"Brendan Coles <[email protected]>", # 2010-11-08
]
version "0.1"
description "Timesheet NG is a free Open Source online time tracking application. Focusing on ease of use, Timesheet NG allows multiple employees and contractors to track and log their time spent on multiple projects."
website "http://www.timesheetng.org/"
# 13 for "Username" "Timesheet Login" inurl:login ext:php
# Dorks #
dorks [
'"Username" "Timesheet Login" inurl:login ext:php'
]
matches [
# Default form spacer image hash
{ :md5=>"df3e567d6f16d040326c7a0ea29a4f41", :url=>"images/spacer.gif" },
# HTML Comment
{ :text=>"<!-- include the timesheet face up until the heading start section -->" },
# Default Form HTML
{ :text=>'<td><img class="login_image" src="images/spacer.gif"></td>' },
# Default meta description
{ :text=>'<META name="description" content="Timesheet Next Gen">' },
]
end
| {
"pile_set_name": "Github"
} |
/*
* Copyright (C) 2013 Google 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:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_HTML_FORMS_COLOR_CHOOSER_CLIENT_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_HTML_FORMS_COLOR_CHOOSER_CLIENT_H_
#include "third_party/blink/public/mojom/choosers/color_chooser.mojom-blink-forward.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/platform/geometry/int_rect.h"
#include "third_party/blink/renderer/platform/graphics/color.h"
#include "third_party/blink/renderer/platform/heap/handle.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"
namespace blink {
class Element;
class CORE_EXPORT ColorChooserClient : public GarbageCollectedMixin {
public:
virtual ~ColorChooserClient();
void Trace(Visitor* visitor) override {}
virtual void DidChooseColor(const Color&) = 0;
virtual void DidEndChooser() = 0;
virtual Element& OwnerElement() const = 0;
virtual IntRect ElementRectRelativeToViewport() const = 0;
virtual Color CurrentColor() = 0;
virtual bool ShouldShowSuggestions() const = 0;
virtual Vector<mojom::blink::ColorSuggestionPtr> Suggestions() const = 0;
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_HTML_FORMS_COLOR_CHOOSER_CLIENT_H_
| {
"pile_set_name": "Github"
} |
fileFormatVersion: 2
guid: 3d8bf2d1eeb7662418cfe7ff53223bfc
timeCreated: 1450555650
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
| {
"pile_set_name": "Github"
} |
{
"initiator": {
"role": "guest",
"party_id": 10000
},
"job_parameters": {
"work_mode": 0
},
"role": {
"guest": [
10000
],
"host": [
10000
]
},
"role_parameters": {
"guest": {
"args": {
"data": {
"train_data": [
{
"name": "vehicle_scale_hetero_guest",
"namespace": "experiment"
}
],
"eval_data": [
{
"name": "vehicle_scale_hetero_guest",
"namespace": "experiment"
}
]
}
},
"dataio_0": {
"with_label": [
true
],
"label_name": [
"y"
],
"label_type": [
"int"
],
"output_format": [
"dense"
]
}
},
"host": {
"args": {
"data": {
"train_data": [
{
"name": "vehicle_scale_hetero_host",
"namespace": "experiment"
}
],
"eval_data": [
{
"name": "vehicle_scale_hetero_host",
"namespace": "experiment"
}
]
}
},
"dataio_0": {
"with_label": [
false
],
"output_format": [
"dense"
]
}
}
},
"algorithm_parameters": {
"secureboost_0": {
"task_type": "classification",
"learning_rate": 0.1,
"num_trees": 5,
"subsample_feature_rate": 1,
"n_iter_no_change": false,
"tol": 0.0001,
"bin_num": 50,
"objective_param": {
"objective": "cross_entropy"
},
"encrypt_param": {
"method": "paillier"
},
"predict_param": {
"with_proba": true,
"threshold": 0.5
}
},
"evaluation_0": {
"eval_type": "multi"
}
}
}
| {
"pile_set_name": "Github"
} |
#!/usr/bin/env bash
curPath=$(pwd)
for dir in $(ls); do
if [ -d ${curPath}/${dir} ]; then
eval "unzip dummy_data_copy.zip"
eval "mv dummy_data/xcopa-master/data/et/ dummy_data/xcopa-master/data/${dir}"
eval "mv dummy_data/xcopa-master/data/${dir}/test.et.jsonl dummy_data/xcopa-master/data/${dir}/test.${dir}.jsonl"
eval "mv dummy_data/xcopa-master/data/${dir}/val.et.jsonl dummy_data/xcopa-master/data/${dir}/val.${dir}.jsonl"
eval "zip -r dummy_data.zip dummy_data"
eval "cp dummy_data.zip ${curPath}/${dir}/1.0.0/dummy_data.zip"
eval "rm dummy_data.zip"
eval "rm -r dummy_data"
fi
done
| {
"pile_set_name": "Github"
} |
// (C) Copyright Gennadiy Rozental 2005-2008.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
// File : $RCSfile$
//
// Version : $Revision$
//
// Description : global framework level forward declaration
// ***************************************************************************
#ifndef BOOST_RT_FWD_HPP_062604GER
#define BOOST_RT_FWD_HPP_062604GER
// Boost.Runtime.Parameter
#include <boost/test/utils/runtime/config.hpp>
// Boost
#include <boost/shared_ptr.hpp>
namespace boost {
namespace BOOST_RT_PARAM_NAMESPACE {
class parameter;
class argument;
typedef shared_ptr<argument> argument_ptr;
typedef shared_ptr<argument const> const_argument_ptr;
template<typename T> class value_interpreter;
template<typename T> class typed_argument;
} // namespace BOOST_RT_PARAM_NAMESPACE
} // namespace boost
#endif // BOOST_RT_FWD_HPP_062604GER
| {
"pile_set_name": "Github"
} |
package com.cg.baseproject.algorithm.conversions;
import java.util.Scanner;
/**
* This class converts Decimal numbers to Octal Numbers
*
* @author Unknown
*
*/
class Decimal_Octal
{
/**
* Main Method
*
* @param args Command line Arguments
*/
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
int n,k,d,s=0,c=0;
System.out.print("Decimal number: ");
n=sc.nextInt();
k=n;
while(k!=0)
{
d=k%8;
s+=d*(int)Math.pow(10,c++);
k/=8;
}
System.out.println("Octal equivalent:"+s);
sc.close();
}
}
| {
"pile_set_name": "Github"
} |
import * as path from 'path';
import { promisify } from 'util';
import { createReadStream, createWriteStream, promises as fs } from 'fs';
import mkdirp = require('mkdirp');
import * as rimraf from 'rimraf';
export function copyFile(fromFilename: string, toFilename: string): Promise<void> {
return new Promise<void>((resolve, reject) => {
const readStream = createReadStream(fromFilename);
const writeStream = createWriteStream(toFilename);
readStream.on('error', reject);
writeStream.on('error', reject);
readStream.pipe(writeStream);
readStream.on('end', resolve);
});
}
export const deleteDir = promisify(rimraf);
export const mkdir = mkdirp;
export async function writeFile(fileName: string, content: string) {
await mkdirp(path.dirname(fileName));
await fs.writeFile(fileName, content, 'utf8');
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "gc/shared/oopStorage.hpp"
#include "oops/access.inline.hpp"
#include "oops/oop.hpp"
#include "oops/weakHandle.inline.hpp"
#include "utilities/debug.hpp"
#include "utilities/ostream.hpp"
WeakHandle::WeakHandle(OopStorage* storage, Handle obj) :
WeakHandle(storage, obj()) {}
WeakHandle::WeakHandle(OopStorage* storage, oop obj) :
_obj(storage->allocate()) {
assert(obj != NULL, "no need to create weak null oop");
if (_obj == NULL) {
vm_exit_out_of_memory(sizeof(oop*), OOM_MALLOC_ERROR,
"Unable to create new weak oop handle in OopStorage %s",
storage->name());
}
NativeAccess<ON_PHANTOM_OOP_REF>::oop_store(_obj, obj);
}
void WeakHandle::release(OopStorage* storage) const {
// Only release if the pointer to the object has been created.
if (_obj != NULL) {
// Clear the WeakHandle. For race in creating ClassLoaderData, we can release this
// WeakHandle before it is cleared by GC.
NativeAccess<ON_PHANTOM_OOP_REF>::oop_store(_obj, (oop)NULL);
storage->release(_obj);
}
}
WeakHandle WeakHandle::from_raw(oop* raw) {
assert(raw != NULL, "can't create from raw with NULL value");
return WeakHandle(raw);
}
void WeakHandle::print() const { print_on(tty); }
void WeakHandle::print_on(outputStream* st) const {
st->print("WeakHandle: " PTR_FORMAT, p2i(peek()));
}
| {
"pile_set_name": "Github"
} |
geotrellis.store.cassandra.CassandraCollectionLayerProvider
| {
"pile_set_name": "Github"
} |
<?xml version='1.0' encoding='utf-8'?>
<section xmlns="https://code.dccouncil.us/schemas/dc-library" xmlns:codified="https://code.dccouncil.us/schemas/codified" xmlns:codify="https://code.dccouncil.us/schemas/codify" xmlns:xi="http://www.w3.org/2001/XInclude" containing-doc="D.C. Code">
<num>47-2853.172</num>
<heading>Eligibility requirements.</heading>
<text>An applicant for licensure as a real estate broker shall establish to the satisfaction of the Board of Real Estate that the applicant:</text>
<para>
<num>(1)</num>
<text>Is able to read, write, and understand the English language;</text>
</para>
<para>
<num>(2)</num>
<text>Is a high school graduate or the holder of a high school equivalency certificate;</text>
</para>
<para>
<num>(3)</num>
<text>Has successfully completed a course of study prescribed by the Board at a school approved by the Board;</text>
</para>
<para>
<num>(4)</num>
<text>Has passed an examination or examinations given by or under direction of the Board or has passed any other examination acceptable to the Board;</text>
</para>
<para>
<num>(5)</num>
<text>Has not had an application for a real estate license denied, for reasons other than failure to pass the required examination or examinations, in the District or elsewhere within one year prior to the date on which the application is filed;</text>
</para>
<para>
<num>(6)</num>
<text>Has not had a real estate license suspended in the District or elsewhere, which suspension is still in effect on the date on which the application is filed; and</text>
</para>
<para>
<num>(7)</num>
<text>Has not had a real estate license revoked in the District or elsewhere within 3 years prior to the date on which his or her application is filed.</text>
</para>
<annotations>
<annotation doc="D.C. Law 12-261" type="History">Apr. 20, 1999, D.C. Law 12-261, § 1002, 46 DCR 3142</annotation>
<annotation type="Prior Codifications">1981 Ed., § 47-2853.172.</annotation>
</annotations>
</section>
| {
"pile_set_name": "Github"
} |
// Copyright 2019 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 storage
import (
"context"
"errors"
"fmt"
"time"
"google.golang.org/api/iterator"
raw "google.golang.org/api/storage/v1"
)
// HMACState is the state of the HMAC key.
type HMACState string
const (
// Active is the status for an active key that can be used to sign
// requests.
Active HMACState = "ACTIVE"
// Inactive is the status for an inactive key thus requests signed by
// this key will be denied.
Inactive HMACState = "INACTIVE"
// Deleted is the status for a key that is deleted.
// Once in this state the key cannot key cannot be recovered
// and does not count towards key limits. Deleted keys will be cleaned
// up later.
Deleted HMACState = "DELETED"
)
// HMACKey is the representation of a Google Cloud Storage HMAC key.
//
// HMAC keys are used to authenticate signed access to objects. To enable HMAC key
// authentication, please visit https://cloud.google.com/storage/docs/migrating.
//
// This type is EXPERIMENTAL and subject to change or removal without notice.
type HMACKey struct {
// The HMAC's secret key.
Secret string
// AccessID is the ID of the HMAC key.
AccessID string
// Etag is the HTTP/1.1 Entity tag.
Etag string
// ID is the ID of the HMAC key, including the ProjectID and AccessID.
ID string
// ProjectID is the ID of the project that owns the
// service account to which the key authenticates.
ProjectID string
// ServiceAccountEmail is the email address
// of the key's associated service account.
ServiceAccountEmail string
// CreatedTime is the creation time of the HMAC key.
CreatedTime time.Time
// UpdatedTime is the last modification time of the HMAC key metadata.
UpdatedTime time.Time
// State is the state of the HMAC key.
// It can be one of StateActive, StateInactive or StateDeleted.
State HMACState
}
// HMACKeyHandle helps provide access and management for HMAC keys.
//
// This type is EXPERIMENTAL and subject to change or removal without notice.
type HMACKeyHandle struct {
projectID string
accessID string
raw *raw.ProjectsHmacKeysService
}
// HMACKeyHandle creates a handle that will be used for HMACKey operations.
//
// This method is EXPERIMENTAL and subject to change or removal without notice.
func (c *Client) HMACKeyHandle(projectID, accessID string) *HMACKeyHandle {
return &HMACKeyHandle{
projectID: projectID,
accessID: accessID,
raw: raw.NewProjectsHmacKeysService(c.raw),
}
}
// Get invokes an RPC to retrieve the HMAC key referenced by the
// HMACKeyHandle's accessID.
//
// This method is EXPERIMENTAL and subject to change or removal without notice.
func (hkh *HMACKeyHandle) Get(ctx context.Context) (*HMACKey, error) {
call := hkh.raw.Get(hkh.projectID, hkh.accessID)
setClientHeader(call.Header())
var metadata *raw.HmacKeyMetadata
var err error
err = runWithRetry(ctx, func() error {
metadata, err = call.Context(ctx).Do()
return err
})
if err != nil {
return nil, err
}
hkPb := &raw.HmacKey{
Metadata: metadata,
}
return pbHmacKeyToHMACKey(hkPb, false)
}
// Delete invokes an RPC to delete the key referenced by accessID, on Google Cloud Storage.
// Only inactive HMAC keys can be deleted.
// After deletion, a key cannot be used to authenticate requests.
//
// This method is EXPERIMENTAL and subject to change or removal without notice.
func (hkh *HMACKeyHandle) Delete(ctx context.Context) error {
delCall := hkh.raw.Delete(hkh.projectID, hkh.accessID)
setClientHeader(delCall.Header())
return runWithRetry(ctx, func() error {
return delCall.Context(ctx).Do()
})
}
func pbHmacKeyToHMACKey(pb *raw.HmacKey, updatedTimeCanBeNil bool) (*HMACKey, error) {
pbmd := pb.Metadata
if pbmd == nil {
return nil, errors.New("field Metadata cannot be nil")
}
createdTime, err := time.Parse(time.RFC3339, pbmd.TimeCreated)
if err != nil {
return nil, fmt.Errorf("field CreatedTime: %v", err)
}
updatedTime, err := time.Parse(time.RFC3339, pbmd.Updated)
if err != nil && !updatedTimeCanBeNil {
return nil, fmt.Errorf("field UpdatedTime: %v", err)
}
hmk := &HMACKey{
AccessID: pbmd.AccessId,
Secret: pb.Secret,
Etag: pbmd.Etag,
ID: pbmd.Id,
State: HMACState(pbmd.State),
ProjectID: pbmd.ProjectId,
CreatedTime: createdTime,
UpdatedTime: updatedTime,
ServiceAccountEmail: pbmd.ServiceAccountEmail,
}
return hmk, nil
}
// CreateHMACKey invokes an RPC for Google Cloud Storage to create a new HMACKey.
//
// This method is EXPERIMENTAL and subject to change or removal without notice.
func (c *Client) CreateHMACKey(ctx context.Context, projectID, serviceAccountEmail string) (*HMACKey, error) {
if projectID == "" {
return nil, errors.New("storage: expecting a non-blank projectID")
}
if serviceAccountEmail == "" {
return nil, errors.New("storage: expecting a non-blank service account email")
}
svc := raw.NewProjectsHmacKeysService(c.raw)
call := svc.Create(projectID, serviceAccountEmail)
setClientHeader(call.Header())
var hkPb *raw.HmacKey
var err error
err = runWithRetry(ctx, func() error {
hkPb, err = call.Context(ctx).Do()
return err
})
if err != nil {
return nil, err
}
return pbHmacKeyToHMACKey(hkPb, true)
}
// HMACKeyAttrsToUpdate defines the attributes of an HMACKey that will be updated.
//
// This type is EXPERIMENTAL and subject to change or removal without notice.
type HMACKeyAttrsToUpdate struct {
// State is required and must be either StateActive or StateInactive.
State HMACState
// Etag is an optional field and it is the HTTP/1.1 Entity tag.
Etag string
}
// Update mutates the HMACKey referred to by accessID.
//
// This method is EXPERIMENTAL and subject to change or removal without notice.
func (h *HMACKeyHandle) Update(ctx context.Context, au HMACKeyAttrsToUpdate) (*HMACKey, error) {
if au.State != Active && au.State != Inactive {
return nil, fmt.Errorf("storage: invalid state %q for update, must be either %q or %q", au.State, Active, Inactive)
}
call := h.raw.Update(h.projectID, h.accessID, &raw.HmacKeyMetadata{
Etag: au.Etag,
State: string(au.State),
})
setClientHeader(call.Header())
var metadata *raw.HmacKeyMetadata
var err error
err = runWithRetry(ctx, func() error {
metadata, err = call.Context(ctx).Do()
return err
})
if err != nil {
return nil, err
}
hkPb := &raw.HmacKey{
Metadata: metadata,
}
return pbHmacKeyToHMACKey(hkPb, false)
}
// An HMACKeysIterator is an iterator over HMACKeys.
//
// This type is EXPERIMENTAL and subject to change or removal without notice.
type HMACKeysIterator struct {
ctx context.Context
raw *raw.ProjectsHmacKeysService
projectID string
hmacKeys []*HMACKey
pageInfo *iterator.PageInfo
nextFunc func() error
index int
}
// ListHMACKeys returns an iterator for listing HMACKeys.
//
// This method is EXPERIMENTAL and subject to change or removal without notice.
func (c *Client) ListHMACKeys(ctx context.Context, projectID string) *HMACKeysIterator {
it := &HMACKeysIterator{
ctx: ctx,
raw: raw.NewProjectsHmacKeysService(c.raw),
projectID: projectID,
}
it.pageInfo, it.nextFunc = iterator.NewPageInfo(
it.fetch,
func() int { return len(it.hmacKeys) - it.index },
func() interface{} {
prev := it.hmacKeys
it.hmacKeys = it.hmacKeys[:0]
it.index = 0
return prev
})
return it
}
// Next returns the next result. Its second return value is iterator.Done if
// there are no more results. Once Next returns iterator.Done, all subsequent
// calls will return iterator.Done.
//
// This method is EXPERIMENTAL and subject to change or removal without notice.
func (it *HMACKeysIterator) Next() (*HMACKey, error) {
if err := it.nextFunc(); err != nil {
return nil, err
}
key := it.hmacKeys[it.index]
it.index++
return key, nil
}
// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
//
// This method is EXPERIMENTAL and subject to change or removal without notice.
func (it *HMACKeysIterator) PageInfo() *iterator.PageInfo { return it.pageInfo }
func (it *HMACKeysIterator) fetch(pageSize int, pageToken string) (token string, err error) {
call := it.raw.List(it.projectID)
setClientHeader(call.Header())
call = call.PageToken(pageToken)
// By default we'll also show deleted keys and then
// let users filter on their own.
call = call.ShowDeletedKeys(true)
if pageSize > 0 {
call = call.MaxResults(int64(pageSize))
}
ctx := it.ctx
var resp *raw.HmacKeysMetadata
err = runWithRetry(it.ctx, func() error {
resp, err = call.Context(ctx).Do()
return err
})
if err != nil {
return "", err
}
for _, metadata := range resp.Items {
hkPb := &raw.HmacKey{
Metadata: metadata,
}
hkey, err := pbHmacKeyToHMACKey(hkPb, true)
if err != nil {
return "", err
}
it.hmacKeys = append(it.hmacKeys, hkey)
}
return resp.NextPageToken, nil
}
| {
"pile_set_name": "Github"
} |
/// Copyright (c) 2009 Microsoft Corporation
///
/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
/// that the following conditions are met:
/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
/// the following disclaimer.
/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
/// the following disclaimer in the documentation and/or other materials provided with the distribution.
/// * Neither the name of Microsoft nor the names of its contributors may be used to
/// endorse or promote products derived from this software without specific prior written permission.
///
/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
ES5Harness.registerTest({
id: "15.4.4.15-4-10",
path: "TestCases/chapter15/15.4/15.4.4/15.4.4.15/15.4.4.15-4-10.js",
description: "Array.prototype.lastIndexOf - 'length' is a number of value -6e-1",
test: function testcase() {
var targetObj = [];
var obj = { 0: targetObj, 100: targetObj, length: -6e-1 };
return Array.prototype.lastIndexOf.call(obj, targetObj) === -1;
},
precondition: function prereq() {
return fnExists(Array.prototype.lastIndexOf);
}
});
| {
"pile_set_name": "Github"
} |
//-----------------------------------------------------------------------------
// Copyright (c) 2013 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "console/consoleTypes.h"
#include "console/console.h"
#include "graphics/gBitmap.h"
#include "graphics/TextureManager.h"
#include "io/resource/resourceManager.h"
#include "platform/event.h"
#include "graphics/dgl.h"
#include "gui/guiArrayCtrl.h"
#include "gui/containers/guiScrollCtrl.h"
#include "gui/guiDefaultControlRender.h"
IMPLEMENT_CONOBJECT(GuiScrollCtrl);
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- //
GuiScrollCtrl::GuiScrollCtrl()
{
mBounds.extent.set(200,200);
mChildMargin.set(0,0);
mBorderThickness = 1;
mScrollBarThickness = 16;
mScrollBarArrowBtnLength = 16;
mScrollBarDragTolerance = 130;
stateDepressed = false;
curHitRegion = None;
mWillFirstRespond = true;
mUseConstantHeightThumb = false;
mIsContainer = true;
mForceVScrollBar = ScrollBarAlwaysOn;
mForceHScrollBar = ScrollBarAlwaysOn;
}
static EnumTable::Enums scrollBarEnums[] =
{
{ GuiScrollCtrl::ScrollBarAlwaysOn, "alwaysOn" },
{ GuiScrollCtrl::ScrollBarAlwaysOff, "alwaysOff" },
{ GuiScrollCtrl::ScrollBarDynamic, "dynamic" },
};
static EnumTable gScrollBarTable(3, &scrollBarEnums[0]);
ConsoleMethod(GuiScrollCtrl, scrollToTop, void, 2, 2, "() Use the scrollToTop method to scroll the scroll control to the top of the child content area.\n"
"@return No return value.\n"
"@sa scrollToBottom")
{
object->scrollTo( 0, 0 );
}
ConsoleMethod(GuiScrollCtrl, scrollToBottom, void, 2, 2, "() Use the scrollToBottom method to scroll the scroll control to the bottom of the child content area.\n"
"@return No return value.\n"
"@sa scrollToTop")
{
object->scrollTo( 0, 0x7FFFFFFF );
}
ConsoleMethod(GuiScrollCtrl, setScrollPosition, void, 4, 4, "(x, y) - scrolls the scroll control to the specified position.")
{
object->scrollTo(dAtoi(argv[2]), dAtoi(argv[3]));
}
ConsoleMethod(GuiScrollCtrl, getScrollPositionX, S32, 2, 2, "() - get the current x scroll position of the scroll control.")
{
return object->getChildRelPos().x;
}
ConsoleMethod(GuiScrollCtrl, getScrollPositionY, S32, 2, 2, "() - get the current y scroll position of the scroll control.")
{
return object->getChildRelPos().y;
}
ConsoleMethod(GuiScrollCtrl, computeSizes, void, 2, 2, "() - refresh all the contents in this scroll container.")
{
return object->computeSizes();
}
ConsoleMethod(GuiScrollCtrl, getUseScrollEvents, bool, 2, 2, "() - get the current scroll callback state of the scroll control.")
{
return object->getUseScrollEvents();
}
ConsoleMethod(GuiScrollCtrl, setUseScrollEvents, void, 3, 3, "() - set the scroll callback state of the scroll control.")
{
object->setUseScrollEvents(dAtoi(argv[2]));
}
void GuiScrollCtrl::initPersistFields()
{
Parent::initPersistFields();
addField("willFirstRespond", TypeBool, Offset(mWillFirstRespond, GuiScrollCtrl));
addField("hScrollBar", TypeEnum, Offset(mForceHScrollBar, GuiScrollCtrl), 1, &gScrollBarTable);
addField("vScrollBar", TypeEnum, Offset(mForceVScrollBar, GuiScrollCtrl), 1, &gScrollBarTable);
addField("constantThumbHeight", TypeBool, Offset(mUseConstantHeightThumb, GuiScrollCtrl));
addField("childMargin", TypePoint2I, Offset(mChildMargin, GuiScrollCtrl));
}
void GuiScrollCtrl::resize(const Point2I &newPos, const Point2I &newExt)
{
Parent::resize(newPos, newExt);
computeSizes();
}
void GuiScrollCtrl::childResized(GuiControl *child)
{
Parent::childResized(child);
computeSizes();
}
bool GuiScrollCtrl::onWake()
{
if (! Parent::onWake())
return false;
mTextureHandle = mProfile->mTextureHandle;
mTextureHandle.setFilter(GL_NEAREST);
bool result;
result = mProfile->constructBitmapArray() >= BmpStates * BmpCount;
//AssertFatal(result, "Failed to create the bitmap array");
if (!result)
Con::warnf("Failed to create the bitmap array for %s", mProfile->mBitmapName);
mBitmapBounds = mProfile->mBitmapArrayRects.address();
//init
mBaseThumbSize = mBitmapBounds[BmpStates * BmpVThumbTopCap].extent.y +
mBitmapBounds[BmpStates * BmpVThumbBottomCap].extent.y;
mScrollBarThickness = mBitmapBounds[BmpStates * BmpVPage].extent.x;
mScrollBarArrowBtnLength = mBitmapBounds[BmpStates * BmpUp].extent.y;
computeSizes();
return true;
}
void GuiScrollCtrl::onSleep()
{
Parent::onSleep();
mTextureHandle = NULL;
}
bool GuiScrollCtrl::calcChildExtents()
{
// right now the scroll control really only deals well with a single
// child control for its content
if (!size())
return false;
GuiControl *ctrl = (GuiControl *) front();
mChildExt = ctrl->mBounds.extent;
mChildPos = ctrl->mBounds.point;
return true;
}
RectI lastVisRect;
void GuiScrollCtrl::scrollRectVisible(RectI rect)
{
// rect is passed in virtual client space
if(rect.extent.x > mContentExt.x)
rect.extent.x = mContentExt.x;
if(rect.extent.y > mContentExt.y)
rect.extent.y = mContentExt.y;
// Determine the points bounding the requested rectangle
Point2I rectUpperLeft = rect.point;
Point2I rectLowerRight = rect.point + rect.extent;
lastVisRect = rect;
// Determine the points bounding the actual visible area...
Point2I visUpperLeft = mChildRelPos;
Point2I visLowerRight = mChildRelPos + mContentExt;
Point2I delta(0,0);
// We basically try to make sure that first the top left of the given
// rect is visible, and if it is, then that the bottom right is visible.
// Make sure the rectangle is visible along the X axis...
if(rectUpperLeft.x < visUpperLeft.x)
delta.x = rectUpperLeft.x - visUpperLeft.x;
else if(rectLowerRight.x > visLowerRight.x)
delta.x = rectLowerRight.x - visLowerRight.x;
// Make sure the rectangle is visible along the Y axis...
if(rectUpperLeft.y < visUpperLeft.y)
delta.y = rectUpperLeft.y - visUpperLeft.y;
else if(rectLowerRight.y > visLowerRight.y)
delta.y = rectLowerRight.y - visLowerRight.y;
// If we had any changes, scroll, otherwise don't.
if(delta.x || delta.y)
scrollDelta(delta.x, delta.y);
}
void GuiScrollCtrl::addObject(SimObject *object)
{
Parent::addObject(object);
computeSizes();
}
GuiControl* GuiScrollCtrl::findHitControl(const Point2I &pt, S32 initialLayer)
{
if(pt.x < mProfile->mBorderThickness || pt.y < mProfile->mBorderThickness)
return this;
if(pt.x >= mBounds.extent.x - mProfile->mBorderThickness - (mHasVScrollBar ? mScrollBarThickness : 0) ||
pt.y >= mBounds.extent.y - mProfile->mBorderThickness - (mHasHScrollBar ? mScrollBarThickness : 0))
return this;
return Parent::findHitControl(pt, initialLayer);
}
void GuiScrollCtrl::computeSizes()
{
S32 thickness = (mProfile ? mProfile->mBorderThickness : 1);
Point2I borderExtent(thickness, thickness);
mContentPos = borderExtent + mChildMargin;
mContentExt = mBounds.extent - (mChildMargin * 2)
- (borderExtent * 2);
Point2I childLowerRight;
mHBarEnabled = false;
mVBarEnabled = false;
mHasVScrollBar = (mForceVScrollBar == ScrollBarAlwaysOn);
mHasHScrollBar = (mForceHScrollBar == ScrollBarAlwaysOn);
setUpdate();
if (calcChildExtents())
{
childLowerRight = mChildPos + mChildExt;
if (mHasVScrollBar)
mContentExt.x -= mScrollBarThickness;
if (mHasHScrollBar)
mContentExt.y -= mScrollBarThickness;
if (mChildExt.x > mContentExt.x && (mForceHScrollBar == ScrollBarDynamic))
{
mHasHScrollBar = true;
mContentExt.y -= mScrollBarThickness;
}
if (mChildExt.y > mContentExt.y && (mForceVScrollBar == ScrollBarDynamic))
{
mHasVScrollBar = true;
mContentExt.x -= mScrollBarThickness;
// If Extent X Changed, check Horiz Scrollbar.
if (mChildExt.x > mContentExt.x && !mHasHScrollBar && (mForceHScrollBar == ScrollBarDynamic))
{
mHasHScrollBar = true;
mContentExt.y -= mScrollBarThickness;
}
}
Point2I contentLowerRight = mContentPos + mContentExt;
// see if the child controls need to be repositioned (null space in control)
Point2I delta(0,0);
if (mChildPos.x > mContentPos.x)
delta.x = mContentPos.x - mChildPos.x;
else if (contentLowerRight.x > childLowerRight.x)
{
S32 diff = contentLowerRight.x - childLowerRight.x;
delta.x = getMin(mContentPos.x - mChildPos.x, diff);
}
//reposition the children if the child extent > the scroll content extent
if (mChildPos.y > mContentPos.y)
delta.y = mContentPos.y - mChildPos.y;
else if (contentLowerRight.y > childLowerRight.y)
{
S32 diff = contentLowerRight.y - childLowerRight.y;
delta.y = getMin(mContentPos.y - mChildPos.y, diff);
}
// apply the deltas to the children...
if (delta.x || delta.y)
{
SimGroup::iterator i;
for(i = begin(); i != end();i++)
{
GuiControl *ctrl = (GuiControl *) (*i);
ctrl->mBounds.point += delta;
}
mChildPos += delta;
childLowerRight += delta;
}
// enable needed scroll bars
if (mChildExt.x > mContentExt.x)
mHBarEnabled = true;
if (mChildExt.y > mContentExt.y)
mVBarEnabled = true;
mChildRelPos = mContentPos - mChildPos;
}
// build all the rectangles and such...
calcScrollRects();
calcThumbs();
}
void GuiScrollCtrl::calcScrollRects(void)
{
S32 thickness = ( mProfile ? mProfile->mBorderThickness : 1 );
if (mHasHScrollBar)
{
mLeftArrowRect.set(thickness,
mBounds.extent.y - thickness - mScrollBarThickness - 1,
mScrollBarArrowBtnLength,
mScrollBarThickness);
mRightArrowRect.set(mBounds.extent.x - thickness - (mHasVScrollBar ? mScrollBarThickness : 0) - mScrollBarArrowBtnLength,
mBounds.extent.y - thickness - mScrollBarThickness - 1,
mScrollBarArrowBtnLength,
mScrollBarThickness);
mHTrackRect.set(mLeftArrowRect.point.x + mLeftArrowRect.extent.x,
mLeftArrowRect.point.y,
mRightArrowRect.point.x - (mLeftArrowRect.point.x + mLeftArrowRect.extent.x),
mScrollBarThickness);
}
if (mHasVScrollBar)
{
mUpArrowRect.set(mBounds.extent.x - thickness - mScrollBarThickness,
thickness,
mScrollBarThickness,
mScrollBarArrowBtnLength);
mDownArrowRect.set(mBounds.extent.x - thickness - mScrollBarThickness,
mBounds.extent.y - thickness - mScrollBarArrowBtnLength - (mHasHScrollBar ? ( mScrollBarThickness + 1 ) : 0),
mScrollBarThickness,
mScrollBarArrowBtnLength);
mVTrackRect.set(mUpArrowRect.point.x,
mUpArrowRect.point.y + mUpArrowRect.extent.y,
mScrollBarThickness,
mDownArrowRect.point.y - (mUpArrowRect.point.y + mUpArrowRect.extent.y) );
}
}
void GuiScrollCtrl::calcThumbs()
{
if (mHBarEnabled)
{
U32 trackSize = mHTrackRect.len_x();
if (mUseConstantHeightThumb)
mHThumbSize = mBaseThumbSize;
else
mHThumbSize = getMax(mBaseThumbSize, S32((mContentExt.x * trackSize) / mChildExt.x));
mHThumbPos = mHTrackRect.point.x + (mChildRelPos.x * (trackSize - mHThumbSize)) / (mChildExt.x - mContentExt.x);
}
if (mVBarEnabled)
{
U32 trackSize = mVTrackRect.len_y();
if (mUseConstantHeightThumb)
mVThumbSize = mBaseThumbSize;
else
mVThumbSize = getMax(mBaseThumbSize, S32((mContentExt.y * trackSize) / mChildExt.y));
mVThumbPos = mVTrackRect.point.y + (mChildRelPos.y * (trackSize - mVThumbSize)) / (mChildExt.y - mContentExt.y);
}
}
void GuiScrollCtrl::scrollDelta(S32 deltaX, S32 deltaY)
{
scrollTo(mChildRelPos.x + deltaX, mChildRelPos.y + deltaY);
}
void GuiScrollCtrl::scrollTo(S32 x, S32 y)
{
if(!size())
return;
// keep scroll start state
Point2I startPoint = mChildPos;
Point2I startPointRel = mChildRelPos;
setUpdate();
if (x > mChildExt.x - mContentExt.x)
x = mChildExt.x - mContentExt.x;
if (x < 0)
x = 0;
if (y > mChildExt.y - mContentExt.y)
y = mChildExt.y - mContentExt.y;
if (y < 0)
y = 0;
Point2I delta(x - mChildRelPos.x, y - mChildRelPos.y);
mChildRelPos += delta;
mChildPos -= delta;
for(SimSet::iterator i = begin(); i != end();i++)
{
GuiControl *ctrl = (GuiControl *) (*i);
ctrl->mBounds.point -= delta;
}
calcThumbs();
// Execute callback
if (mUseScrollEvents)
{
char buf[4][32];
dSprintf(buf[0], 32, "%d %d", startPoint.x, startPoint.y);
dSprintf(buf[1], 32, "%d %d", startPointRel.x, startPointRel.y);
dSprintf(buf[2], 32, "%d %d", mChildPos.x, mChildPos.y);
dSprintf(buf[3], 32, "%d %d", mChildRelPos.x, mChildRelPos.y);
Con::executef(this, 5, "onScroll", buf[0], buf[1], buf[2], buf[3]);
}
}
GuiScrollCtrl::Region GuiScrollCtrl::findHitRegion(const Point2I &pt)
{
if (mVBarEnabled && mHasVScrollBar)
{
if (mUpArrowRect.pointInRect(pt))
return UpArrow;
else if (mDownArrowRect.pointInRect(pt))
return DownArrow;
else if (mVTrackRect.pointInRect(pt))
{
if (pt.y < mVThumbPos)
return UpPage;
else if (pt.y < mVThumbPos + mVThumbSize)
return VertThumb;
else
return DownPage;
}
}
if (mHBarEnabled && mHasHScrollBar)
{
if (mLeftArrowRect.pointInRect(pt))
return LeftArrow;
else if (mRightArrowRect.pointInRect(pt))
return RightArrow;
else if (mHTrackRect.pointInRect(pt))
{
if (pt.x < mHThumbPos)
return LeftPage;
else if (pt.x < mHThumbPos + mHThumbSize)
return HorizThumb;
else
return RightPage;
}
}
return None;
}
bool GuiScrollCtrl::wantsTabListMembership()
{
return true;
}
bool GuiScrollCtrl::loseFirstResponder()
{
setUpdate();
return true;
}
bool GuiScrollCtrl::becomeFirstResponder()
{
setUpdate();
return mWillFirstRespond;
}
bool GuiScrollCtrl::onKeyDown(const GuiEvent &event)
{
if (mWillFirstRespond)
{
switch (event.keyCode)
{
case KEY_RIGHT:
scrollByRegion(RightArrow);
return true;
case KEY_LEFT:
scrollByRegion(LeftArrow);
return true;
case KEY_DOWN:
scrollByRegion(DownArrow);
return true;
case KEY_UP:
scrollByRegion(UpArrow);
return true;
case KEY_PAGE_UP:
scrollByRegion(UpPage);
return true;
case KEY_PAGE_DOWN:
scrollByRegion(DownPage);
return true;
}
}
return Parent::onKeyDown(event);
}
void GuiScrollCtrl::onMouseDown(const GuiEvent &event)
{
mouseLock();
setUpdate();
Point2I curMousePos = globalToLocalCoord(event.mousePoint);
curHitRegion = findHitRegion(curMousePos);
stateDepressed = true;
// Set a 0.5 second delay before we start scrolling
mLastUpdated = Platform::getVirtualMilliseconds() + 500;
scrollByRegion(curHitRegion);
if (curHitRegion == VertThumb)
{
mChildRelPosAnchor = mChildRelPos;
mThumbMouseDelta = curMousePos.y - mVThumbPos;
}
else if (curHitRegion == HorizThumb)
{
mChildRelPosAnchor = mChildRelPos;
mThumbMouseDelta = curMousePos.x - mHThumbPos;
}
}
void GuiScrollCtrl::onMouseUp(const GuiEvent &)
{
mouseUnlock();
setUpdate();
curHitRegion = None;
stateDepressed = false;
}
void GuiScrollCtrl::onMouseDragged(const GuiEvent &event)
{
Point2I curMousePos = globalToLocalCoord(event.mousePoint);
setUpdate();
if ( (curHitRegion != VertThumb) && (curHitRegion != HorizThumb) )
{
Region hit = findHitRegion(curMousePos);
if (hit != curHitRegion)
stateDepressed = false;
else
stateDepressed = true;
return;
}
// ok... if the mouse is 'near' the scroll bar, scroll with it
// otherwise, snap back to the previous position.
if (curHitRegion == VertThumb)
{
if (curMousePos.x >= mVTrackRect.point.x - mScrollBarDragTolerance &&
curMousePos.x <= mVTrackRect.point.x + mVTrackRect.extent.x - 1 + mScrollBarDragTolerance &&
curMousePos.y >= mVTrackRect.point.y - mScrollBarDragTolerance &&
curMousePos.y <= mVTrackRect.point.y + mVTrackRect.extent.y - 1 + mScrollBarDragTolerance)
{
S32 newVThumbPos = curMousePos.y - mThumbMouseDelta;
if(newVThumbPos != mVThumbPos)
{
S32 newVPos = (newVThumbPos - mVTrackRect.point.y) *
(mChildExt.y - mContentExt.y) /
(mVTrackRect.extent.y - mVThumbSize);
scrollTo(mChildRelPosAnchor.x, newVPos);
}
}
else
scrollTo(mChildRelPosAnchor.x, mChildRelPosAnchor.y);
}
else if (curHitRegion == HorizThumb)
{
if (curMousePos.x >= mHTrackRect.point.x - mScrollBarDragTolerance &&
curMousePos.x <= mHTrackRect.point.x + mHTrackRect.extent.x - 1 + mScrollBarDragTolerance &&
curMousePos.y >= mHTrackRect.point.y - mScrollBarDragTolerance &&
curMousePos.y <= mHTrackRect.point.y + mHTrackRect.extent.y - 1 + mScrollBarDragTolerance)
{
S32 newHThumbPos = curMousePos.x - mThumbMouseDelta;
if(newHThumbPos != mHThumbPos)
{
S32 newHPos = (newHThumbPos - mHTrackRect.point.x) *
(mChildExt.x - mContentExt.x) /
(mHTrackRect.extent.x - mHThumbSize);
scrollTo(newHPos, mChildRelPosAnchor.y);
}
}
else
scrollTo(mChildRelPosAnchor.x, mChildRelPosAnchor.y);
}
}
bool GuiScrollCtrl::onMouseWheelUp(const GuiEvent &event)
{
if ( !mAwake || !mVisible )
return( false );
Point2I previousPos = mChildPos;
scrollByRegion((event.modifier & SI_CTRL) ? UpPage : UpArrow);
// Tell the kids that the mouse moved (relatively):
iterator itr;
for ( itr = begin(); itr != end(); itr++ )
{
GuiControl* grandKid = static_cast<GuiControl*>( *itr );
grandKid->onMouseMove( event );
}
// If no scrolling happened (already at the top), pass it on to the parent.
GuiControl* parent = getParent();
if (parent && (previousPos == mChildPos))
return parent->onMouseWheelUp(event);
return true;
}
bool GuiScrollCtrl::onMouseWheelDown(const GuiEvent &event)
{
if ( !mAwake || !mVisible )
return( false );
Point2I previousPos = mChildPos;
scrollByRegion((event.modifier & SI_CTRL) ? DownPage : DownArrow);
// Tell the kids that the mouse moved (relatively):
iterator itr;
for ( itr = begin(); itr != end(); itr++ )
{
GuiControl* grandKid = static_cast<GuiControl *>( *itr );
grandKid->onMouseMove( event );
}
// If no scrolling happened (already at the bottom), pass it on to the parent.
GuiControl* parent = getParent();
if (parent && (previousPos == mChildPos))
return parent->onMouseWheelDown(event);
return true;
}
void GuiScrollCtrl::onPreRender()
{
Parent::onPreRender();
// Short circuit if not depressed to save cycles
if( stateDepressed != true )
return;
//default to one second, though it shouldn't be necessary
U32 timeThreshold = 1000;
// We don't want to scroll by pages at an interval the same as when we're scrolling
// using the arrow buttons, so adjust accordingly.
switch( curHitRegion )
{
case UpPage:
case DownPage:
case LeftPage:
case RightPage:
timeThreshold = 200;
break;
case UpArrow:
case DownArrow:
case LeftArrow:
case RightArrow:
timeThreshold = 20;
break;
default:
// Neither a button or a page, don't scroll (shouldn't get here)
return;
break;
};
S32 timeElapsed = Platform::getVirtualMilliseconds() - mLastUpdated;
if ( ( timeElapsed > 0 ) && ( timeElapsed > (S32)timeThreshold ) )
{
mLastUpdated = Platform::getVirtualMilliseconds();
scrollByRegion(curHitRegion);
}
}
void GuiScrollCtrl::scrollByRegion(Region reg)
{
setUpdate();
if(!size())
return;
GuiControl *content = (GuiControl *) front();
U32 rowHeight, columnWidth;
U32 pageHeight, pageWidth;
content->getScrollLineSizes(&rowHeight, &columnWidth);
if(rowHeight >= (U32)mContentExt.y)
pageHeight = 1;
else
pageHeight = mContentExt.y - rowHeight;
if(columnWidth >= (U32)mContentExt.x)
pageWidth = 1;
else
pageWidth = mContentExt.x - columnWidth;
if (mVBarEnabled)
{
switch(reg)
{
case UpPage:
scrollDelta(0, -(S32)pageHeight);
break;
case DownPage:
scrollDelta(0, pageHeight);
break;
case UpArrow:
scrollDelta(0, -(S32)rowHeight);
break;
case DownArrow:
scrollDelta(0, rowHeight);
break;
case LeftArrow:
case RightArrow:
case LeftPage:
case RightPage:
case VertThumb:
case HorizThumb:
case None:
{
//Con::errorf("Unhandled case in GuiScrollCtrl::scrollByRegion");
}
}
}
if (mHBarEnabled)
{
switch(reg)
{
case LeftPage:
scrollDelta(-(S32)pageWidth, 0);
break;
case RightPage:
scrollDelta(pageWidth, 0);
break;
case LeftArrow:
scrollDelta(-(S32)columnWidth, 0);
break;
case RightArrow:
scrollDelta(columnWidth, 0);
break;
case UpArrow:
case DownArrow:
case UpPage:
case DownPage:
case VertThumb:
case HorizThumb:
case None:
{
//Con::errorf("Unhandled case in GuiScrollCtrl::scrollByRegion");
break;
}
}
}
}
void GuiScrollCtrl::onRender(Point2I offset, const RectI &updateRect)
{
RectI r(offset.x, offset.y, mBounds.extent.x, mBounds.extent.y);
if (mProfile->mOpaque)
dglDrawRectFill(r, mProfile->mFillColor);
if (mProfile->mBorder)
renderFilledBorder(r, mProfile);
// draw scroll bars
if (mHasVScrollBar)
drawVScrollBar(offset);
if (mHasHScrollBar)
drawHScrollBar(offset);
//draw the scroll corner
if (mHasVScrollBar && mHasHScrollBar)
drawScrollCorner(offset);
// draw content controls
// create a rect to intersect with the updateRect
RectI contentRect(mContentPos.x + offset.x, mContentPos.y + offset.y, mContentExt.x, mContentExt.y);
if(contentRect.intersect(updateRect))
renderChildControls(offset, contentRect);
// Finally draw the last vis rect (debug aid, BJG)
//RectI renderRect = lastVisRect;
//renderRect.point += mContentPos + offset;
//dglSetClipRect(r);
//dglDrawRect(renderRect, ColorI(0, 255, 0));
}
void GuiScrollCtrl::drawBorder( const Point2I &offset, bool /*isFirstResponder*/ )
{
}
void GuiScrollCtrl::drawVScrollBar(const Point2I &offset)
{
Point2I pos = offset + mUpArrowRect.point;
S32 bitmap = (mVBarEnabled ? ((curHitRegion == UpArrow && stateDepressed) ?
BmpStates * BmpUp + BmpHilite : BmpStates * BmpUp) : BmpStates * BmpUp + BmpDisabled);
dglClearBitmapModulation();
dglDrawBitmapSR(mTextureHandle, pos, mBitmapBounds[bitmap]);
pos.y += mScrollBarArrowBtnLength;
S32 end;
if (mVBarEnabled)
end = mVThumbPos + offset.y;
else
end = mDownArrowRect.point.y + offset.y;
bitmap = (mVBarEnabled ? ((curHitRegion == DownPage && stateDepressed) ?
BmpStates * BmpVPage + BmpHilite : BmpStates * BmpVPage) : BmpStates * BmpVPage + BmpDisabled);
if (end > pos.y)
{
dglClearBitmapModulation();
dglDrawBitmapStretchSR(mTextureHandle, RectI(pos, Point2I(mBitmapBounds[bitmap].extent.x, end - pos.y)), mBitmapBounds[bitmap]);
}
pos.y = end;
if (mVBarEnabled)
{
bool thumbSelected = (curHitRegion == VertThumb && stateDepressed);
S32 ttop = (thumbSelected ? BmpStates * BmpVThumbTopCap + BmpHilite : BmpStates * BmpVThumbTopCap);
S32 tmid = (thumbSelected ? BmpStates * BmpVThumb + BmpHilite : BmpStates * BmpVThumb);
S32 tbot = (thumbSelected ? BmpStates * BmpVThumbBottomCap + BmpHilite : BmpStates * BmpVThumbBottomCap);
// draw the thumb
dglClearBitmapModulation();
dglDrawBitmapSR(mTextureHandle, pos, mBitmapBounds[ttop]);
pos.y += mBitmapBounds[ttop].extent.y;
end = mVThumbPos + mVThumbSize - mBitmapBounds[tbot].extent.y + offset.y;
if (end > pos.y)
{
dglClearBitmapModulation();
dglDrawBitmapStretchSR(mTextureHandle, RectI(pos, Point2I(mBitmapBounds[tmid].extent.x, end - pos.y)), mBitmapBounds[tmid]);
}
pos.y = end;
dglClearBitmapModulation();
dglDrawBitmapSR(mTextureHandle, pos, mBitmapBounds[tbot]);
pos.y += mBitmapBounds[tbot].extent.y;
end = mVTrackRect.point.y + mVTrackRect.extent.y - 1 + offset.y;
bitmap = (curHitRegion == DownPage && stateDepressed) ? BmpStates * BmpVPage + BmpHilite : BmpStates * BmpVPage;
if (end > pos.y)
{
dglClearBitmapModulation();
dglDrawBitmapStretchSR(mTextureHandle, RectI(pos, Point2I(mBitmapBounds[bitmap].extent.x, end - pos.y)), mBitmapBounds[bitmap]);
}
pos.y = end;
}
bitmap = (mVBarEnabled ? ((curHitRegion == DownArrow && stateDepressed ) ?
BmpStates * BmpDown + BmpHilite : BmpStates * BmpDown) : BmpStates * BmpDown + BmpDisabled);
dglClearBitmapModulation();
dglDrawBitmapSR(mTextureHandle, pos, mBitmapBounds[bitmap]);
}
void GuiScrollCtrl::drawHScrollBar(const Point2I &offset)
{
S32 bitmap;
//draw the left arrow
bitmap = (mHBarEnabled ? ((curHitRegion == LeftArrow && stateDepressed) ?
BmpStates * BmpLeft + BmpHilite : BmpStates * BmpLeft) : BmpStates * BmpLeft + BmpDisabled);
Point2I pos = offset;
pos += mLeftArrowRect.point;
dglClearBitmapModulation();
dglDrawBitmapSR(mTextureHandle, pos, mBitmapBounds[bitmap]);
pos.x += mLeftArrowRect.extent.x;
//draw the left page
S32 end;
if (mHBarEnabled)
end = mHThumbPos + offset.x;
else
end = mRightArrowRect.point.x + offset.x;
bitmap = (mHBarEnabled ? ((curHitRegion == LeftPage && stateDepressed) ?
BmpStates * BmpHPage + BmpHilite : BmpStates * BmpHPage) : BmpStates * BmpHPage + BmpDisabled);
if (end > pos.x)
{
dglClearBitmapModulation();
dglDrawBitmapStretchSR(mTextureHandle, RectI(pos, Point2I(end - pos.x, mBitmapBounds[bitmap].extent.y)), mBitmapBounds[bitmap]);
}
pos.x = end;
//draw the thumb and the rightPage
if (mHBarEnabled)
{
bool thumbSelected = (curHitRegion == HorizThumb && stateDepressed);
S32 ttop = (thumbSelected ? BmpStates * BmpHThumbLeftCap + BmpHilite : BmpStates * BmpHThumbLeftCap );
S32 tmid = (thumbSelected ? BmpStates * BmpHThumb + BmpHilite : BmpStates * BmpHThumb);
S32 tbot = (thumbSelected ? BmpStates * BmpHThumbRightCap + BmpHilite : BmpStates * BmpHThumbRightCap);
// draw the thumb
dglClearBitmapModulation();
dglDrawBitmapSR(mTextureHandle, pos, mBitmapBounds[ttop]);
pos.x += mBitmapBounds[ttop].extent.x;
end = mHThumbPos + mHThumbSize - mBitmapBounds[tbot].extent.x + offset.x;
if (end > pos.x)
{
dglClearBitmapModulation();
dglDrawBitmapStretchSR(mTextureHandle, RectI(pos, Point2I(end - pos.x, mBitmapBounds[tmid].extent.y)), mBitmapBounds[tmid]);
}
pos.x = end;
dglClearBitmapModulation();
dglDrawBitmapSR(mTextureHandle, pos, mBitmapBounds[tbot]);
pos.x += mBitmapBounds[tbot].extent.x;
end = mHTrackRect.point.x + mHTrackRect.extent.x - 1 + offset.x;
bitmap = ((curHitRegion == RightPage && stateDepressed) ? BmpStates * BmpHPage + BmpHilite : BmpStates * BmpHPage);
if (end > pos.x)
{
dglClearBitmapModulation();
dglDrawBitmapStretchSR(mTextureHandle, RectI(pos, Point2I(end - pos.x, mBitmapBounds[bitmap].extent.y)), mBitmapBounds[bitmap]);
}
pos.x = end;
}
bitmap = (mHBarEnabled ? ((curHitRegion == RightArrow && stateDepressed) ?
BmpStates * BmpRight + BmpHilite : BmpStates * BmpRight) : BmpStates * BmpRight + BmpDisabled);
dglClearBitmapModulation();
dglDrawBitmapSR(mTextureHandle, pos, mBitmapBounds[bitmap]);
}
void GuiScrollCtrl::drawScrollCorner(const Point2I &offset)
{
Point2I pos = offset;
pos.x += mRightArrowRect.point.x + mRightArrowRect.extent.x;
pos.y += mRightArrowRect.point.y;
dglClearBitmapModulation();
dglDrawBitmapSR(mTextureHandle, pos, mBitmapBounds[BmpStates * BmpResize]);
}
void GuiScrollCtrl::autoScroll(Region reg)
{
scrollByRegion(reg);
}
| {
"pile_set_name": "Github"
} |
/*
* JBoss, Home of Professional Open Source
* Copyright 2006, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags.
* See the copyright.txt in the distribution for a full listing
* of individual contributors.
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
* of the GNU Lesser General Public License, v. 2.1.
* This program is distributed in the hope that it will be useful, but WITHOUT A
* 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,
* v.2.1 along with this distribution; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
* (C) 2005-2006,
* @author JBoss Inc.
*/
/*
* Copyright (C) 2004,
*
* Arjuna Technologies Ltd,
* Newcastle upon Tyne,
* Tyne and Wear,
* UK.
*
* $Id: Performance.java 2342 2006-03-30 13:06:17Z $
*/
package com.hp.mwtests.ts.jts.local.synchronizations;
import static org.junit.Assert.fail;
import io.narayana.perf.Measurement;
import io.narayana.perf.Worker;
import org.junit.Assert;
import org.junit.Test;
import org.omg.CORBA.SystemException;
import org.omg.CORBA.UserException;
import org.omg.CosTransactions.*;
import org.omg.CORBA.ORBPackage.InvalidName;
import com.arjuna.ats.internal.jts.ORBManager;
import com.arjuna.ats.jts.OTSManager;
import com.arjuna.orbportability.OA;
import com.arjuna.orbportability.ORB;
import com.arjuna.orbportability.RootOA;
import com.hp.mwtests.ts.jts.orbspecific.resources.demosync;
public class Performance
{
@Test
public void test() throws Exception
{
int maxTestTime = 0;
int numberOfCalls = 1000;
int warmUpCount = 0;
int numberOfThreads = 1;
int batchSize = numberOfCalls;
Measurement measurement = new Measurement.Builder(getClass().getName() + "_test1")
.maxTestTime(0L).numberOfCalls(numberOfCalls)
.numberOfThreads(numberOfThreads).batchSize(batchSize)
.numberOfWarmupCalls(warmUpCount).build().measure(worker, worker);
Assert.assertEquals(0, measurement.getNumberOfErrors());
Assert.assertFalse(measurement.getInfo(), measurement.shouldFail());
System.out.printf("%s%n", measurement.getInfo());
System.out.println("Average time for empty transaction = " + measurement.getTotalMillis() / (float) numberOfCalls);
System.out.printf("TPS: %f%n", measurement.getThroughput());
}
Worker<Void> worker = new Worker<Void>() {
ORB myORB = null;
RootOA myOA = null;
org.omg.CosTransactions.Current current;
demosync sync = null;
private void initCorba() {
myORB = ORB.getInstance("test");
myOA = OA.getRootOA(myORB);
myORB.initORB(new String[] {}, null);
try {
myOA.initOA();
} catch (InvalidName invalidName) {
fail(invalidName.getMessage());
}
ORBManager.setORB(myORB);
ORBManager.setPOA(myOA);
}
@Override
public void init() {
initCorba();
current = OTSManager.get_current();
sync = new demosync(false);
}
@Override
public void fini() {
myOA.shutdownObject(sync);
myOA.destroy();
myORB.shutdown();
}
@Override
public Void doWork(Void context, int batchSize, Measurement<Void> measurement) {
for (int i = 0; i < batchSize; i++)
{
try {
current.begin();
Control myControl = current.get_control();
Coordinator coord = myControl.get_coordinator();
coord.register_synchronization(sync.getReference());
current.commit(true);
} catch (UserException e) {
if (measurement.getNumberOfErrors() == 0)
e.printStackTrace();
measurement.incrementErrorCount();
fail("Caught UserException: "+e);
} catch (SystemException e) {
if (measurement.getNumberOfErrors() == 0)
e.printStackTrace();
measurement.incrementErrorCount();
fail("Caught SystemException: " + e);
}
}
return context;
}
@Override
public void finishWork(Measurement<Void> measurement) {
}
};
}
| {
"pile_set_name": "Github"
} |
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 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. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS 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.
description(
"This tests that function inlining in the DFG JIT doesn't get confused by constants being reused between inliner and inlinee."
);
function foo(a, b) {
if (b)
return a + 4;
return b + 5;
}
function bar(a, b) {
return foo(a, b) + 5;
}
for (var i = 0; i < 1000; ++i)
bar(i, i + 1);
shouldBe("bar(6, 0)", "10");
shouldBe("bar(6, 1)", "15");
shouldBe("bar(6, false)", "10");
shouldBe("bar(6, true)", "15");
| {
"pile_set_name": "Github"
} |
const expect = require('chai').expect;
import Canvas from '../../src/canvas';
const dom = document.createElement('div');
document.body.appendChild(dom);
dom.id = 'c1';
describe('#407', () => {
const canvas = new Canvas({
container: dom,
width: 400,
height: 400,
});
it('bbox calculation should be correct for container', () => {
// case 1: child is a empty group
const group1 = canvas.addGroup();
group1.addGroup();
expect(group1.getBBox()).eqls({
x: 0,
y: 0,
minX: 0,
minY: 0,
maxX: 0,
maxY: 0,
width: 0,
height: 0,
});
// case 2: all child's visible are false
const group2 = canvas.addGroup();
group2.addShape('circle', {
visible: false,
attrs: {
x: 100,
y: 100,
r: 50,
lineWidth: 5,
fill: 'red',
stroke: 'blue',
},
});
expect(group2.getBBox()).eqls({
x: 0,
y: 0,
minX: 0,
minY: 0,
maxX: 0,
maxY: 0,
width: 0,
height: 0,
});
// case 3: not all child's visible are false
const group3 = canvas.addGroup();
group3.addShape('rect', {
visible: false,
attrs: {
x: 50,
y: 50,
width: 60,
height: 60,
fill: 'red',
},
});
group3.addShape('rect', {
attrs: {
x: 100,
y: 100,
width: 10,
height: 10,
fill: 'red',
},
});
expect(group3.getBBox()).eqls({
x: 100,
y: 100,
minX: 100,
minY: 100,
maxX: 110,
maxY: 110,
width: 10,
height: 10,
});
// case 4: a child is empty group and another child is not
const group = canvas.addGroup();
const subGroup1 = group.addGroup();
const subGroup2 = group.addGroup();
subGroup2.attr('matrix', [1, 0, 0, 0, 1, 0, 100, 100, 1]);
subGroup2.addShape('rect', {
attrs: {
fill: 'red',
stroke: 'blue',
lineWidth: 1,
height: 100,
width: 150,
x: -75,
y: -50,
},
});
expect(subGroup1.getBBox()).eqls({
x: 0,
y: 0,
minX: 0,
minY: 0,
maxX: 0,
maxY: 0,
width: 0,
height: 0,
});
expect(subGroup2.getBBox()).eqls({
x: -75.5,
y: -50.5,
minX: -75.5,
minY: -50.5,
maxX: 75.5,
maxY: 50.5,
width: 151,
height: 101,
});
expect(group.getBBox()).eqls({
x: -75.5,
y: -50.5,
minX: -75.5,
minY: -50.5,
maxX: 75.5,
maxY: 50.5,
width: 151,
height: 101,
});
expect(group.getCanvasBBox()).eqls({
x: 24.5,
y: 49.5,
minX: 24.5,
minY: 49.5,
maxX: 175.5,
maxY: 150.5,
width: 151,
height: 101,
});
});
});
| {
"pile_set_name": "Github"
} |
from django.db import models
class School(models.Model):
name = models.CharField(max_length=100)
class Parent(models.Model):
name = models.CharField(max_length=100)
class Child(models.Model):
mother = models.ForeignKey(Parent, models.CASCADE, related_name='mothers_children')
father = models.ForeignKey(Parent, models.CASCADE, related_name='fathers_children')
school = models.ForeignKey(School, models.CASCADE)
name = models.CharField(max_length=100)
class Poet(models.Model):
name = models.CharField(max_length=100)
def __str__(self):
return self.name
class Poem(models.Model):
poet = models.ForeignKey(Poet, models.CASCADE)
name = models.CharField(max_length=100)
class Meta:
unique_together = ('poet', 'name')
def __str__(self):
return self.name
| {
"pile_set_name": "Github"
} |
UWP-044 - Adeptly Adaptive Challenge
Note: Even if you're fast and you don't make mistakes, this should take at least 45 miutes, more likely, 90 minutes. Don't get discouraged if it takes you 4 hours or more! Keep struggling!!!
We'll (sort of) re-create a previous challenge, but adding in some adaptive resizing elements.
Specific Requirements
=====================
1. You'll create the beginning of a fake News app. Each news item will contain an image, headline, subhead and dateline. There will be two navigation items in the SplitView: Financial and Food. Use techiques discussed previously to create this. Selecting each of the navigation items will change the news items to display only those Financial items versus only those Food items.
2. NewsItem class that contains the definition for a NewsItem class with the following properties:
Id
Category
Headline
Subhead
DateLine
Image
3. You'll probably need another class that serves as a Factory / Manager style class to create instances of NewsItem and populates properties with Lorem Ipsum text and returns them as a collection of NewsItem suitable for data binding. I used object initilizer syntax to do this.
Note: Use fake Lorem Ipsum text for the Headline, Subhead, DateLine.
Note: The Category should be either "Food" or "Financial". I use a string (lazy) but you could use an enum for this.
Note: For Image, use the path of the food and financial images. I.e.,: Assets/Food2.png
Note: When a user requests code from this Factory / Manager class, be sure to filter by Category.
Note: I provide a helper method of the Factory / Manager class that contains the data you'll need for the app. (See below.)
4. See screen shots. You only need one page: MainPage.xaml. You will filter the list of news items based on the Category property of the NewsItem class, adding / removing items from the collection that your GridView will bind to.
5. Each NewsItem should be 200 wide x 275 tall when in a narrow state, and 400 wide x 400 tall when in a wide state (900 min window width). In the narrow state, the Headline should be 18 point and 26 point in the wide state.
6. Hide the AutoSuggestBox when the width is less than 400.
General
========
7. Margins are usually 20, sometimes 10.
8. Fonts are usually 18. Make the page title (of the hamburger nav) bold.
9. Light gray background is "LightGray".
10. You'll need some Segoe MDL2 Assets ...
 (Home)
 (Star)
 (Hamburger)
Use these images as your guide: UWP-044-A.png through UWP-044-C.png
Remember: Try to solve this without my help!
Also: Only watch enough of the solution video to get unstuck.
If you do solve it without my help, you should watch the entire solution video to see a different approach.
=========================
private static List<NewsItem> getNewsItems()
{
var items = new List<NewsItem>();
items.Add(new NewsItem() { Id = 1, Category = "Financial", Headline = "Lorem Ipsum", Subhead = "doro sit amet", DateLine = "Nunc tristique nec", Image = "Assets/Financial1.png" });
items.Add(new NewsItem() { Id = 2, Category = "Financial", Headline = "Etiam ac felis viverra", Subhead = "vulputate nisl ac, aliquet nisi", DateLine = "tortor porttitor, eu fermentum ante congue", Image = "Assets/Financial2.png" });
items.Add(new NewsItem() { Id = 3, Category = "Financial", Headline = "Integer sed turpis erat", Subhead = "Sed quis hendrerit lorem, quis interdum dolor", DateLine = "in viverra metus facilisis sed", Image = "Assets/Financial3.png" });
items.Add(new NewsItem() { Id = 4, Category = "Financial", Headline = "Proin sem neque", Subhead = "aliquet quis ipsum tincidunt", DateLine = "Integer eleifend", Image = "Assets/Financial4.png" }); items.Add(new NewsItem() { Id = 5, Category = "Financial", Headline = "Mauris bibendum non leo vitae tempor", Subhead = "In nisl tortor, eleifend sed ipsum eget", DateLine = "Curabitur dictum augue vitae elementum ultrices", Image = "Assets/Financial5.png" });
items.Add(new NewsItem() { Id = 6, Category = "Food", Headline = "Lorem ipsum", Subhead = "dolor sit amet", DateLine = "Nunc tristique nec", Image = "Assets/Food1.png" });
items.Add(new NewsItem() { Id = 7, Category = "Food", Headline = "Etiam ac felis viverra", Subhead = "vulputate nisl ac, aliquet nisi", DateLine = "tortor porttitor, eu fermentum ante congue", Image = "Assets/Food2.png" });
items.Add(new NewsItem() { Id = 8, Category = "Food", Headline = "Integer sed turpis erat", Subhead = "Sed quis hendrerit lorem, quis interdum dolor", DateLine = "in viverra metus facilisis sed", Image = "Assets/Food3.png" });
items.Add(new NewsItem() { Id = 9, Category = "Food", Headline = "Proin sem neque", Subhead = "aliquet quis ipsum tincidunt", DateLine = "Integer eleifend", Image = "Assets/Food4.png" });
items.Add(new NewsItem() { Id = 10, Category = "Food", Headline = "Mauris bibendum non leo vitae tempor", Subhead = "In nisl tortor, eleifend sed ipsum eget", DateLine = "Curabitur dictum augue vitae elementum ultrices", Image = "Assets/Food5.png" });
return items;
} | {
"pile_set_name": "Github"
} |
driverClassName=com.mysql.jdbc.Driver
initialSize=5
maxActive=15
minIdle=5
maxWait=60000
timeBetweenEvictionRunsMillis=60000
minEvictableIdleTimeMillis=300000
testWhileIdle=true
validationQuery=select 1
testOnBorrow=false
testOnReturn=false
maxOpenPreparedStatements=20
removeAbandoned=false
removeAbandonedTimeout=180000 | {
"pile_set_name": "Github"
} |
module.exports = (req, res)=>{
res.send({index: true})
} | {
"pile_set_name": "Github"
} |
# Video inspired from the kernel on Kaggle here:
# https://www.kaggle.com/residentmario/creating-reading-and-writing-reference
# The data for this video can be downloaded here:
# https://www.kaggle.com/zynicide/wine-reviews
# pip install pandas
import pandas as pd
"""
There are two core objects in pandas:
the DataFrame and the Series.
"""
### DataFrame ###
"""
A DataFrame is a table. It contains an array of
individual entries, each of which has a certain value.
Each entry corresponds with a row (or record) and a column.
For example, consider the following simple DataFrame:
"""
print(pd.DataFrame({'Yes': [50, 21], 'No': [131, 2]}))
"""
DataFrame entries are not limited to integers. For instance,
here's a DataFrame whose values are str strings:
"""
print(pd.DataFrame({'Bob': ['I liked it.', 'It was awful.'], 'Sue': ['Pretty good.', 'Bland.']}))
"""
The dictionary-list constructor assigns values to the
column labels, but just uses an ascending count from 0
(0, 1, 2, 3, ...) for the row labels. Sometimes this
is OK, but oftentimes we will want to assign these
labels ourselves.
The list of row labels used in a DataFrame is known as
an Index. We can assign values to it by using an index
parameter in our constructor:
"""
print(pd.DataFrame({'Bob': ['I liked it.', 'It was awful.'],
'Sue': ['Pretty good.', 'Bland.']},
index=['Product A', 'Product B']))
### Series ###
"""
A Series, by contrast, is a sequence of data values.
If a DataFrame is a table, a Series is a list. And in
fact you can create one with nothing more than a list:
"""
print(pd.Series([1, 2, 3, 4, 5]))
"""
A Series is, in essence, a single column of a DataFrame.
So you can assign column values to the Series the same way
as before, using an index parameter. However, a Series do
not have a column name, it only has one overall name:
"""
print(pd.Series([30, 35, 40], index=['2015 Sales', '2016 Sales', '2017 Sales'], name='Product A'))
| {
"pile_set_name": "Github"
} |
landscapeNoiseOctaves = 1
landscapeNoiseLacunarity = 0.1
landscapeNoiseFrequency = 0.005
landscapeNoiseGain = 0.6
caveNoiseOctaves = 1
caveNoiseLacunarity = 0.1
caveNoiseFrequency = 0.02
caveNoiseGain = 0.1
caveDensityThreshold = 0.80
mountainNoiseOctaves = 2
mountainNoiseLacunarity = 0.3
mountainNoiseFrequency = 0.00075
mountainNoiseGain = 0.5
| {
"pile_set_name": "Github"
} |
// Copyright (c) 2003 Institute of Transport,
// Railway Construction and Operation,
// University of Hanover, Germany
//
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <qobject.h>
class TestA : public QObject
{
Q_OBJECT
public:
TestA();
// Needed to suppress 'unused variable' varning.
void do_something() { }
};
| {
"pile_set_name": "Github"
} |
// This file was GENERATED by command:
// pump.py gtest-param-test.h.pump
// DO NOT EDIT BY HAND!!!
// Copyright 2008, Google 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:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Macros and functions for implementing parameterized tests
// in Google C++ Testing and Mocking Framework (Google Test)
//
// This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
//
// GOOGLETEST_CM0001 DO NOT DELETE
#ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
#define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
// Value-parameterized tests allow you to test your code with different
// parameters without writing multiple copies of the same test.
//
// Here is how you use value-parameterized tests:
#if 0
// To write value-parameterized tests, first you should define a fixture
// class. It is usually derived from testing::TestWithParam<T> (see below for
// another inheritance scheme that's sometimes useful in more complicated
// class hierarchies), where the type of your parameter values.
// TestWithParam<T> is itself derived from testing::Test. T can be any
// copyable type. If it's a raw pointer, you are responsible for managing the
// lifespan of the pointed values.
class FooTest : public ::testing::TestWithParam<const char*> {
// You can implement all the usual class fixture members here.
};
// Then, use the TEST_P macro to define as many parameterized tests
// for this fixture as you want. The _P suffix is for "parameterized"
// or "pattern", whichever you prefer to think.
TEST_P(FooTest, DoesBlah) {
// Inside a test, access the test parameter with the GetParam() method
// of the TestWithParam<T> class:
EXPECT_TRUE(foo.Blah(GetParam()));
...
}
TEST_P(FooTest, HasBlahBlah) {
...
}
// Finally, you can use INSTANTIATE_TEST_CASE_P to instantiate the test
// case with any set of parameters you want. Google Test defines a number
// of functions for generating test parameters. They return what we call
// (surprise!) parameter generators. Here is a summary of them, which
// are all in the testing namespace:
//
//
// Range(begin, end [, step]) - Yields values {begin, begin+step,
// begin+step+step, ...}. The values do not
// include end. step defaults to 1.
// Values(v1, v2, ..., vN) - Yields values {v1, v2, ..., vN}.
// ValuesIn(container) - Yields values from a C-style array, an STL
// ValuesIn(begin,end) container, or an iterator range [begin, end).
// Bool() - Yields sequence {false, true}.
// Combine(g1, g2, ..., gN) - Yields all combinations (the Cartesian product
// for the math savvy) of the values generated
// by the N generators.
//
// For more details, see comments at the definitions of these functions below
// in this file.
//
// The following statement will instantiate tests from the FooTest test case
// each with parameter values "meeny", "miny", and "moe".
INSTANTIATE_TEST_CASE_P(InstantiationName,
FooTest,
Values("meeny", "miny", "moe"));
// To distinguish different instances of the pattern, (yes, you
// can instantiate it more then once) the first argument to the
// INSTANTIATE_TEST_CASE_P macro is a prefix that will be added to the
// actual test case name. Remember to pick unique prefixes for different
// instantiations. The tests from the instantiation above will have
// these names:
//
// * InstantiationName/FooTest.DoesBlah/0 for "meeny"
// * InstantiationName/FooTest.DoesBlah/1 for "miny"
// * InstantiationName/FooTest.DoesBlah/2 for "moe"
// * InstantiationName/FooTest.HasBlahBlah/0 for "meeny"
// * InstantiationName/FooTest.HasBlahBlah/1 for "miny"
// * InstantiationName/FooTest.HasBlahBlah/2 for "moe"
//
// You can use these names in --gtest_filter.
//
// This statement will instantiate all tests from FooTest again, each
// with parameter values "cat" and "dog":
const char* pets[] = {"cat", "dog"};
INSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest, ValuesIn(pets));
// The tests from the instantiation above will have these names:
//
// * AnotherInstantiationName/FooTest.DoesBlah/0 for "cat"
// * AnotherInstantiationName/FooTest.DoesBlah/1 for "dog"
// * AnotherInstantiationName/FooTest.HasBlahBlah/0 for "cat"
// * AnotherInstantiationName/FooTest.HasBlahBlah/1 for "dog"
//
// Please note that INSTANTIATE_TEST_CASE_P will instantiate all tests
// in the given test case, whether their definitions come before or
// AFTER the INSTANTIATE_TEST_CASE_P statement.
//
// Please also note that generator expressions (including parameters to the
// generators) are evaluated in InitGoogleTest(), after main() has started.
// This allows the user on one hand, to adjust generator parameters in order
// to dynamically determine a set of tests to run and on the other hand,
// give the user a chance to inspect the generated tests with Google Test
// reflection API before RUN_ALL_TESTS() is executed.
//
// You can see samples/sample7_unittest.cc and samples/sample8_unittest.cc
// for more examples.
//
// In the future, we plan to publish the API for defining new parameter
// generators. But for now this interface remains part of the internal
// implementation and is subject to change.
//
//
// A parameterized test fixture must be derived from testing::Test and from
// testing::WithParamInterface<T>, where T is the type of the parameter
// values. Inheriting from TestWithParam<T> satisfies that requirement because
// TestWithParam<T> inherits from both Test and WithParamInterface. In more
// complicated hierarchies, however, it is occasionally useful to inherit
// separately from Test and WithParamInterface. For example:
class BaseTest : public ::testing::Test {
// You can inherit all the usual members for a non-parameterized test
// fixture here.
};
class DerivedTest : public BaseTest, public ::testing::WithParamInterface<int> {
// The usual test fixture members go here too.
};
TEST_F(BaseTest, HasFoo) {
// This is an ordinary non-parameterized test.
}
TEST_P(DerivedTest, DoesBlah) {
// GetParam works just the same here as if you inherit from TestWithParam.
EXPECT_TRUE(foo.Blah(GetParam()));
}
#endif // 0
#include "gtest/internal/gtest-port.h"
#if !GTEST_OS_SYMBIAN
# include <utility>
#endif
#include "gtest/internal/gtest-internal.h"
#include "gtest/internal/gtest-param-util.h"
#include "gtest/internal/gtest-param-util-generated.h"
namespace testing {
// Functions producing parameter generators.
//
// Google Test uses these generators to produce parameters for value-
// parameterized tests. When a parameterized test case is instantiated
// with a particular generator, Google Test creates and runs tests
// for each element in the sequence produced by the generator.
//
// In the following sample, tests from test case FooTest are instantiated
// each three times with parameter values 3, 5, and 8:
//
// class FooTest : public TestWithParam<int> { ... };
//
// TEST_P(FooTest, TestThis) {
// }
// TEST_P(FooTest, TestThat) {
// }
// INSTANTIATE_TEST_CASE_P(TestSequence, FooTest, Values(3, 5, 8));
//
// Range() returns generators providing sequences of values in a range.
//
// Synopsis:
// Range(start, end)
// - returns a generator producing a sequence of values {start, start+1,
// start+2, ..., }.
// Range(start, end, step)
// - returns a generator producing a sequence of values {start, start+step,
// start+step+step, ..., }.
// Notes:
// * The generated sequences never include end. For example, Range(1, 5)
// returns a generator producing a sequence {1, 2, 3, 4}. Range(1, 9, 2)
// returns a generator producing {1, 3, 5, 7}.
// * start and end must have the same type. That type may be any integral or
// floating-point type or a user defined type satisfying these conditions:
// * It must be assignable (have operator=() defined).
// * It must have operator+() (operator+(int-compatible type) for
// two-operand version).
// * It must have operator<() defined.
// Elements in the resulting sequences will also have that type.
// * Condition start < end must be satisfied in order for resulting sequences
// to contain any elements.
//
template <typename T, typename IncrementT>
internal::ParamGenerator<T> Range(T start, T end, IncrementT step) {
return internal::ParamGenerator<T>(
new internal::RangeGenerator<T, IncrementT>(start, end, step));
}
template <typename T>
internal::ParamGenerator<T> Range(T start, T end) {
return Range(start, end, 1);
}
// ValuesIn() function allows generation of tests with parameters coming from
// a container.
//
// Synopsis:
// ValuesIn(const T (&array)[N])
// - returns a generator producing sequences with elements from
// a C-style array.
// ValuesIn(const Container& container)
// - returns a generator producing sequences with elements from
// an STL-style container.
// ValuesIn(Iterator begin, Iterator end)
// - returns a generator producing sequences with elements from
// a range [begin, end) defined by a pair of STL-style iterators. These
// iterators can also be plain C pointers.
//
// Please note that ValuesIn copies the values from the containers
// passed in and keeps them to generate tests in RUN_ALL_TESTS().
//
// Examples:
//
// This instantiates tests from test case StringTest
// each with C-string values of "foo", "bar", and "baz":
//
// const char* strings[] = {"foo", "bar", "baz"};
// INSTANTIATE_TEST_CASE_P(StringSequence, StringTest, ValuesIn(strings));
//
// This instantiates tests from test case StlStringTest
// each with STL strings with values "a" and "b":
//
// ::std::vector< ::std::string> GetParameterStrings() {
// ::std::vector< ::std::string> v;
// v.push_back("a");
// v.push_back("b");
// return v;
// }
//
// INSTANTIATE_TEST_CASE_P(CharSequence,
// StlStringTest,
// ValuesIn(GetParameterStrings()));
//
//
// This will also instantiate tests from CharTest
// each with parameter values 'a' and 'b':
//
// ::std::list<char> GetParameterChars() {
// ::std::list<char> list;
// list.push_back('a');
// list.push_back('b');
// return list;
// }
// ::std::list<char> l = GetParameterChars();
// INSTANTIATE_TEST_CASE_P(CharSequence2,
// CharTest,
// ValuesIn(l.begin(), l.end()));
//
template <typename ForwardIterator>
internal::ParamGenerator<
typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type>
ValuesIn(ForwardIterator begin, ForwardIterator end) {
typedef typename ::testing::internal::IteratorTraits<ForwardIterator>
::value_type ParamType;
return internal::ParamGenerator<ParamType>(
new internal::ValuesInIteratorRangeGenerator<ParamType>(begin, end));
}
template <typename T, size_t N>
internal::ParamGenerator<T> ValuesIn(const T (&array)[N]) {
return ValuesIn(array, array + N);
}
template <class Container>
internal::ParamGenerator<typename Container::value_type> ValuesIn(
const Container& container) {
return ValuesIn(container.begin(), container.end());
}
// Values() allows generating tests from explicitly specified list of
// parameters.
//
// Synopsis:
// Values(T v1, T v2, ..., T vN)
// - returns a generator producing sequences with elements v1, v2, ..., vN.
//
// For example, this instantiates tests from test case BarTest each
// with values "one", "two", and "three":
//
// INSTANTIATE_TEST_CASE_P(NumSequence, BarTest, Values("one", "two", "three"));
//
// This instantiates tests from test case BazTest each with values 1, 2, 3.5.
// The exact type of values will depend on the type of parameter in BazTest.
//
// INSTANTIATE_TEST_CASE_P(FloatingNumbers, BazTest, Values(1, 2, 3.5));
//
// Currently, Values() supports from 1 to 50 parameters.
//
template <typename T1>
internal::ValueArray1<T1> Values(T1 v1) {
return internal::ValueArray1<T1>(v1);
}
template <typename T1, typename T2>
internal::ValueArray2<T1, T2> Values(T1 v1, T2 v2) {
return internal::ValueArray2<T1, T2>(v1, v2);
}
template <typename T1, typename T2, typename T3>
internal::ValueArray3<T1, T2, T3> Values(T1 v1, T2 v2, T3 v3) {
return internal::ValueArray3<T1, T2, T3>(v1, v2, v3);
}
template <typename T1, typename T2, typename T3, typename T4>
internal::ValueArray4<T1, T2, T3, T4> Values(T1 v1, T2 v2, T3 v3, T4 v4) {
return internal::ValueArray4<T1, T2, T3, T4>(v1, v2, v3, v4);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5>
internal::ValueArray5<T1, T2, T3, T4, T5> Values(T1 v1, T2 v2, T3 v3, T4 v4,
T5 v5) {
return internal::ValueArray5<T1, T2, T3, T4, T5>(v1, v2, v3, v4, v5);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6>
internal::ValueArray6<T1, T2, T3, T4, T5, T6> Values(T1 v1, T2 v2, T3 v3,
T4 v4, T5 v5, T6 v6) {
return internal::ValueArray6<T1, T2, T3, T4, T5, T6>(v1, v2, v3, v4, v5, v6);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7>
internal::ValueArray7<T1, T2, T3, T4, T5, T6, T7> Values(T1 v1, T2 v2, T3 v3,
T4 v4, T5 v5, T6 v6, T7 v7) {
return internal::ValueArray7<T1, T2, T3, T4, T5, T6, T7>(v1, v2, v3, v4, v5,
v6, v7);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8>
internal::ValueArray8<T1, T2, T3, T4, T5, T6, T7, T8> Values(T1 v1, T2 v2,
T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8) {
return internal::ValueArray8<T1, T2, T3, T4, T5, T6, T7, T8>(v1, v2, v3, v4,
v5, v6, v7, v8);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9>
internal::ValueArray9<T1, T2, T3, T4, T5, T6, T7, T8, T9> Values(T1 v1, T2 v2,
T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9) {
return internal::ValueArray9<T1, T2, T3, T4, T5, T6, T7, T8, T9>(v1, v2, v3,
v4, v5, v6, v7, v8, v9);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10>
internal::ValueArray10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> Values(T1 v1,
T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10) {
return internal::ValueArray10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(v1,
v2, v3, v4, v5, v6, v7, v8, v9, v10);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11>
internal::ValueArray11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,
T11> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
T10 v10, T11 v11) {
return internal::ValueArray11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,
T11>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12>
internal::ValueArray12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
T10 v10, T11 v11, T12 v12) {
return internal::ValueArray12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13>
internal::ValueArray13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
T13> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
T10 v10, T11 v11, T12 v12, T13 v13) {
return internal::ValueArray13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14>
internal::ValueArray14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
T10 v10, T11 v11, T12 v12, T13 v13, T14 v14) {
return internal::ValueArray14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13, T14>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,
v14);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14, typename T15>
internal::ValueArray15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15) {
return internal::ValueArray15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13, T14, T15>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,
v13, v14, v15);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14, typename T15,
typename T16>
internal::ValueArray16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
T16 v16) {
return internal::ValueArray16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13, T14, T15, T16>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
v12, v13, v14, v15, v16);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14, typename T15,
typename T16, typename T17>
internal::ValueArray17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
T16 v16, T17 v17) {
return internal::ValueArray17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13, T14, T15, T16, T17>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,
v11, v12, v13, v14, v15, v16, v17);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14, typename T15,
typename T16, typename T17, typename T18>
internal::ValueArray18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,
T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
T16 v16, T17 v17, T18 v18) {
return internal::ValueArray18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13, T14, T15, T16, T17, T18>(v1, v2, v3, v4, v5, v6, v7, v8, v9,
v10, v11, v12, v13, v14, v15, v16, v17, v18);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14, typename T15,
typename T16, typename T17, typename T18, typename T19>
internal::ValueArray19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,
T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,
T15 v15, T16 v16, T17 v17, T18 v18, T19 v19) {
return internal::ValueArray19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13, T14, T15, T16, T17, T18, T19>(v1, v2, v3, v4, v5, v6, v7, v8,
v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14, typename T15,
typename T16, typename T17, typename T18, typename T19, typename T20>
internal::ValueArray20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19, T20> Values(T1 v1, T2 v2, T3 v3, T4 v4,
T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20) {
return internal::ValueArray20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13, T14, T15, T16, T17, T18, T19, T20>(v1, v2, v3, v4, v5, v6, v7,
v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14, typename T15,
typename T16, typename T17, typename T18, typename T19, typename T20,
typename T21>
internal::ValueArray21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19, T20, T21> Values(T1 v1, T2 v2, T3 v3, T4 v4,
T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21) {
return internal::ValueArray21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13, T14, T15, T16, T17, T18, T19, T20, T21>(v1, v2, v3, v4, v5, v6,
v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14, typename T15,
typename T16, typename T17, typename T18, typename T19, typename T20,
typename T21, typename T22>
internal::ValueArray22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19, T20, T21, T22> Values(T1 v1, T2 v2, T3 v3,
T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
T21 v21, T22 v22) {
return internal::ValueArray22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22>(v1, v2, v3, v4,
v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
v20, v21, v22);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14, typename T15,
typename T16, typename T17, typename T18, typename T19, typename T20,
typename T21, typename T22, typename T23>
internal::ValueArray23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> Values(T1 v1, T2 v2,
T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
T21 v21, T22 v22, T23 v23) {
return internal::ValueArray23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23>(v1, v2, v3,
v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
v20, v21, v22, v23);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14, typename T15,
typename T16, typename T17, typename T18, typename T19, typename T20,
typename T21, typename T22, typename T23, typename T24>
internal::ValueArray24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> Values(T1 v1, T2 v2,
T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
T21 v21, T22 v22, T23 v23, T24 v24) {
return internal::ValueArray24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24>(v1, v2,
v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18,
v19, v20, v21, v22, v23, v24);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14, typename T15,
typename T16, typename T17, typename T18, typename T19, typename T20,
typename T21, typename T22, typename T23, typename T24, typename T25>
internal::ValueArray25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Values(T1 v1,
T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11,
T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19,
T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25) {
return internal::ValueArray25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25>(v1,
v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17,
v18, v19, v20, v21, v22, v23, v24, v25);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14, typename T15,
typename T16, typename T17, typename T18, typename T19, typename T20,
typename T21, typename T22, typename T23, typename T24, typename T25,
typename T26>
internal::ValueArray26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
T26> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
T26 v26) {
return internal::ValueArray26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
T26>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15,
v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14, typename T15,
typename T16, typename T17, typename T18, typename T19, typename T20,
typename T21, typename T22, typename T23, typename T24, typename T25,
typename T26, typename T27>
internal::ValueArray27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26,
T27> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
T26 v26, T27 v27) {
return internal::ValueArray27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
T26, T27>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14,
v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14, typename T15,
typename T16, typename T17, typename T18, typename T19, typename T20,
typename T21, typename T22, typename T23, typename T24, typename T25,
typename T26, typename T27, typename T28>
internal::ValueArray28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27,
T28> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
T26 v26, T27 v27, T28 v28) {
return internal::ValueArray28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
T26, T27, T28>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,
v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27,
v28);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14, typename T15,
typename T16, typename T17, typename T18, typename T19, typename T20,
typename T21, typename T22, typename T23, typename T24, typename T25,
typename T26, typename T27, typename T28, typename T29>
internal::ValueArray29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
T29> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
T26 v26, T27 v27, T28 v28, T29 v29) {
return internal::ValueArray29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
T26, T27, T28, T29>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,
v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26,
v27, v28, v29);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14, typename T15,
typename T16, typename T17, typename T18, typename T19, typename T20,
typename T21, typename T22, typename T23, typename T24, typename T25,
typename T26, typename T27, typename T28, typename T29, typename T30>
internal::ValueArray30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
T29, T30> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,
T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,
T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30) {
return internal::ValueArray30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
T26, T27, T28, T29, T30>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25,
v26, v27, v28, v29, v30);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14, typename T15,
typename T16, typename T17, typename T18, typename T19, typename T20,
typename T21, typename T22, typename T23, typename T24, typename T25,
typename T26, typename T27, typename T28, typename T29, typename T30,
typename T31>
internal::ValueArray31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
T29, T30, T31> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31) {
return internal::ValueArray31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
T26, T27, T28, T29, T30, T31>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,
v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24,
v25, v26, v27, v28, v29, v30, v31);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14, typename T15,
typename T16, typename T17, typename T18, typename T19, typename T20,
typename T21, typename T22, typename T23, typename T24, typename T25,
typename T26, typename T27, typename T28, typename T29, typename T30,
typename T31, typename T32>
internal::ValueArray32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
T29, T30, T31, T32> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
T32 v32) {
return internal::ValueArray32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
T26, T27, T28, T29, T30, T31, T32>(v1, v2, v3, v4, v5, v6, v7, v8, v9,
v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
v24, v25, v26, v27, v28, v29, v30, v31, v32);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14, typename T15,
typename T16, typename T17, typename T18, typename T19, typename T20,
typename T21, typename T22, typename T23, typename T24, typename T25,
typename T26, typename T27, typename T28, typename T29, typename T30,
typename T31, typename T32, typename T33>
internal::ValueArray33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
T29, T30, T31, T32, T33> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,
T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
T32 v32, T33 v33) {
return internal::ValueArray33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
T26, T27, T28, T29, T30, T31, T32, T33>(v1, v2, v3, v4, v5, v6, v7, v8,
v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
v24, v25, v26, v27, v28, v29, v30, v31, v32, v33);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14, typename T15,
typename T16, typename T17, typename T18, typename T19, typename T20,
typename T21, typename T22, typename T23, typename T24, typename T25,
typename T26, typename T27, typename T28, typename T29, typename T30,
typename T31, typename T32, typename T33, typename T34>
internal::ValueArray34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
T29, T30, T31, T32, T33, T34> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,
T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,
T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22,
T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30,
T31 v31, T32 v32, T33 v33, T34 v34) {
return internal::ValueArray34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
T26, T27, T28, T29, T30, T31, T32, T33, T34>(v1, v2, v3, v4, v5, v6, v7,
v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22,
v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14, typename T15,
typename T16, typename T17, typename T18, typename T19, typename T20,
typename T21, typename T22, typename T23, typename T24, typename T25,
typename T26, typename T27, typename T28, typename T29, typename T30,
typename T31, typename T32, typename T33, typename T34, typename T35>
internal::ValueArray35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
T29, T30, T31, T32, T33, T34, T35> Values(T1 v1, T2 v2, T3 v3, T4 v4,
T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,
T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,
T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35) {
return internal::ValueArray35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
T26, T27, T28, T29, T30, T31, T32, T33, T34, T35>(v1, v2, v3, v4, v5, v6,
v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21,
v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14, typename T15,
typename T16, typename T17, typename T18, typename T19, typename T20,
typename T21, typename T22, typename T23, typename T24, typename T25,
typename T26, typename T27, typename T28, typename T29, typename T30,
typename T31, typename T32, typename T33, typename T34, typename T35,
typename T36>
internal::ValueArray36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
T29, T30, T31, T32, T33, T34, T35, T36> Values(T1 v1, T2 v2, T3 v3, T4 v4,
T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,
T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,
T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36) {
return internal::ValueArray36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36>(v1, v2, v3, v4,
v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,
v34, v35, v36);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14, typename T15,
typename T16, typename T17, typename T18, typename T19, typename T20,
typename T21, typename T22, typename T23, typename T24, typename T25,
typename T26, typename T27, typename T28, typename T29, typename T30,
typename T31, typename T32, typename T33, typename T34, typename T35,
typename T36, typename T37>
internal::ValueArray37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
T29, T30, T31, T32, T33, T34, T35, T36, T37> Values(T1 v1, T2 v2, T3 v3,
T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,
T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,
T37 v37) {
return internal::ValueArray37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37>(v1, v2, v3,
v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,
v34, v35, v36, v37);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14, typename T15,
typename T16, typename T17, typename T18, typename T19, typename T20,
typename T21, typename T22, typename T23, typename T24, typename T25,
typename T26, typename T27, typename T28, typename T29, typename T30,
typename T31, typename T32, typename T33, typename T34, typename T35,
typename T36, typename T37, typename T38>
internal::ValueArray38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> Values(T1 v1, T2 v2,
T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,
T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,
T37 v37, T38 v38) {
return internal::ValueArray38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38>(v1, v2,
v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18,
v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32,
v33, v34, v35, v36, v37, v38);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14, typename T15,
typename T16, typename T17, typename T18, typename T19, typename T20,
typename T21, typename T22, typename T23, typename T24, typename T25,
typename T26, typename T27, typename T28, typename T29, typename T30,
typename T31, typename T32, typename T33, typename T34, typename T35,
typename T36, typename T37, typename T38, typename T39>
internal::ValueArray39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Values(T1 v1, T2 v2,
T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12,
T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20,
T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28,
T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36,
T37 v37, T38 v38, T39 v39) {
return internal::ValueArray39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39>(v1,
v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17,
v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31,
v32, v33, v34, v35, v36, v37, v38, v39);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14, typename T15,
typename T16, typename T17, typename T18, typename T19, typename T20,
typename T21, typename T22, typename T23, typename T24, typename T25,
typename T26, typename T27, typename T28, typename T29, typename T30,
typename T31, typename T32, typename T33, typename T34, typename T35,
typename T36, typename T37, typename T38, typename T39, typename T40>
internal::ValueArray40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Values(T1 v1,
T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11,
T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19,
T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27,
T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35,
T36 v36, T37 v37, T38 v38, T39 v39, T40 v40) {
return internal::ValueArray40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
T40>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15,
v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29,
v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14, typename T15,
typename T16, typename T17, typename T18, typename T19, typename T20,
typename T21, typename T22, typename T23, typename T24, typename T25,
typename T26, typename T27, typename T28, typename T29, typename T30,
typename T31, typename T32, typename T33, typename T34, typename T35,
typename T36, typename T37, typename T38, typename T39, typename T40,
typename T41>
internal::ValueArray41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40,
T41> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41) {
return internal::ValueArray41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
T40, T41>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14,
v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28,
v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14, typename T15,
typename T16, typename T17, typename T18, typename T19, typename T20,
typename T21, typename T22, typename T23, typename T24, typename T25,
typename T26, typename T27, typename T28, typename T29, typename T30,
typename T31, typename T32, typename T33, typename T34, typename T35,
typename T36, typename T37, typename T38, typename T39, typename T40,
typename T41, typename T42>
internal::ValueArray42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41,
T42> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
T42 v42) {
return internal::ValueArray42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
T40, T41, T42>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,
v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27,
v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41,
v42);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14, typename T15,
typename T16, typename T17, typename T18, typename T19, typename T20,
typename T21, typename T22, typename T23, typename T24, typename T25,
typename T26, typename T27, typename T28, typename T29, typename T30,
typename T31, typename T32, typename T33, typename T34, typename T35,
typename T36, typename T37, typename T38, typename T39, typename T40,
typename T41, typename T42, typename T43>
internal::ValueArray43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42,
T43> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
T42 v42, T43 v43) {
return internal::ValueArray43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
T40, T41, T42, T43>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12,
v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26,
v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40,
v41, v42, v43);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14, typename T15,
typename T16, typename T17, typename T18, typename T19, typename T20,
typename T21, typename T22, typename T23, typename T24, typename T25,
typename T26, typename T27, typename T28, typename T29, typename T30,
typename T31, typename T32, typename T33, typename T34, typename T35,
typename T36, typename T37, typename T38, typename T39, typename T40,
typename T41, typename T42, typename T43, typename T44>
internal::ValueArray44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
T44> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9,
T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17,
T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25,
T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33,
T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41,
T42 v42, T43 v43, T44 v44) {
return internal::ValueArray44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
T40, T41, T42, T43, T44>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25,
v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39,
v40, v41, v42, v43, v44);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14, typename T15,
typename T16, typename T17, typename T18, typename T19, typename T20,
typename T21, typename T22, typename T23, typename T24, typename T25,
typename T26, typename T27, typename T28, typename T29, typename T30,
typename T31, typename T32, typename T33, typename T34, typename T35,
typename T36, typename T37, typename T38, typename T39, typename T40,
typename T41, typename T42, typename T43, typename T44, typename T45>
internal::ValueArray45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
T44, T45> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8,
T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16,
T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24,
T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32,
T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40,
T41 v41, T42 v42, T43 v43, T44 v44, T45 v45) {
return internal::ValueArray45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
T40, T41, T42, T43, T44, T45>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10,
v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24,
v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38,
v39, v40, v41, v42, v43, v44, v45);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14, typename T15,
typename T16, typename T17, typename T18, typename T19, typename T20,
typename T21, typename T22, typename T23, typename T24, typename T25,
typename T26, typename T27, typename T28, typename T29, typename T30,
typename T31, typename T32, typename T33, typename T34, typename T35,
typename T36, typename T37, typename T38, typename T39, typename T40,
typename T41, typename T42, typename T43, typename T44, typename T45,
typename T46>
internal::ValueArray46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
T44, T45, T46> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,
T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46) {
return internal::ValueArray46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
T40, T41, T42, T43, T44, T45, T46>(v1, v2, v3, v4, v5, v6, v7, v8, v9,
v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37,
v38, v39, v40, v41, v42, v43, v44, v45, v46);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14, typename T15,
typename T16, typename T17, typename T18, typename T19, typename T20,
typename T21, typename T22, typename T23, typename T24, typename T25,
typename T26, typename T27, typename T28, typename T29, typename T30,
typename T31, typename T32, typename T33, typename T34, typename T35,
typename T36, typename T37, typename T38, typename T39, typename T40,
typename T41, typename T42, typename T43, typename T44, typename T45,
typename T46, typename T47>
internal::ValueArray47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
T44, T45, T46, T47> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7,
T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,
T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47) {
return internal::ValueArray47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
T40, T41, T42, T43, T44, T45, T46, T47>(v1, v2, v3, v4, v5, v6, v7, v8,
v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23,
v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37,
v38, v39, v40, v41, v42, v43, v44, v45, v46, v47);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14, typename T15,
typename T16, typename T17, typename T18, typename T19, typename T20,
typename T21, typename T22, typename T23, typename T24, typename T25,
typename T26, typename T27, typename T28, typename T29, typename T30,
typename T31, typename T32, typename T33, typename T34, typename T35,
typename T36, typename T37, typename T38, typename T39, typename T40,
typename T41, typename T42, typename T43, typename T44, typename T45,
typename T46, typename T47, typename T48>
internal::ValueArray48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
T44, T45, T46, T47, T48> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6,
T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15,
T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23,
T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31,
T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39,
T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47,
T48 v48) {
return internal::ValueArray48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
T40, T41, T42, T43, T44, T45, T46, T47, T48>(v1, v2, v3, v4, v5, v6, v7,
v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22,
v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36,
v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14, typename T15,
typename T16, typename T17, typename T18, typename T19, typename T20,
typename T21, typename T22, typename T23, typename T24, typename T25,
typename T26, typename T27, typename T28, typename T29, typename T30,
typename T31, typename T32, typename T33, typename T34, typename T35,
typename T36, typename T37, typename T38, typename T39, typename T40,
typename T41, typename T42, typename T43, typename T44, typename T45,
typename T46, typename T47, typename T48, typename T49>
internal::ValueArray49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
T44, T45, T46, T47, T48, T49> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5,
T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14,
T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22,
T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30,
T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38,
T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46,
T47 v47, T48 v48, T49 v49) {
return internal::ValueArray49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
T40, T41, T42, T43, T44, T45, T46, T47, T48, T49>(v1, v2, v3, v4, v5, v6,
v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21,
v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35,
v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49);
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14, typename T15,
typename T16, typename T17, typename T18, typename T19, typename T20,
typename T21, typename T22, typename T23, typename T24, typename T25,
typename T26, typename T27, typename T28, typename T29, typename T30,
typename T31, typename T32, typename T33, typename T34, typename T35,
typename T36, typename T37, typename T38, typename T39, typename T40,
typename T41, typename T42, typename T43, typename T44, typename T45,
typename T46, typename T47, typename T48, typename T49, typename T50>
internal::ValueArray50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28,
T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43,
T44, T45, T46, T47, T48, T49, T50> Values(T1 v1, T2 v2, T3 v3, T4 v4,
T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13,
T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21,
T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29,
T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37,
T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45,
T46 v46, T47 v47, T48 v48, T49 v49, T50 v50) {
return internal::ValueArray50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25,
T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39,
T40, T41, T42, T43, T44, T45, T46, T47, T48, T49, T50>(v1, v2, v3, v4,
v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19,
v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33,
v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47,
v48, v49, v50);
}
// Bool() allows generating tests with parameters in a set of (false, true).
//
// Synopsis:
// Bool()
// - returns a generator producing sequences with elements {false, true}.
//
// It is useful when testing code that depends on Boolean flags. Combinations
// of multiple flags can be tested when several Bool()'s are combined using
// Combine() function.
//
// In the following example all tests in the test case FlagDependentTest
// will be instantiated twice with parameters false and true.
//
// class FlagDependentTest : public testing::TestWithParam<bool> {
// virtual void SetUp() {
// external_flag = GetParam();
// }
// }
// INSTANTIATE_TEST_CASE_P(BoolSequence, FlagDependentTest, Bool());
//
inline internal::ParamGenerator<bool> Bool() {
return Values(false, true);
}
# if GTEST_HAS_COMBINE
// Combine() allows the user to combine two or more sequences to produce
// values of a Cartesian product of those sequences' elements.
//
// Synopsis:
// Combine(gen1, gen2, ..., genN)
// - returns a generator producing sequences with elements coming from
// the Cartesian product of elements from the sequences generated by
// gen1, gen2, ..., genN. The sequence elements will have a type of
// tuple<T1, T2, ..., TN> where T1, T2, ..., TN are the types
// of elements from sequences produces by gen1, gen2, ..., genN.
//
// Combine can have up to 10 arguments. This number is currently limited
// by the maximum number of elements in the tuple implementation used by Google
// Test.
//
// Example:
//
// This will instantiate tests in test case AnimalTest each one with
// the parameter values tuple("cat", BLACK), tuple("cat", WHITE),
// tuple("dog", BLACK), and tuple("dog", WHITE):
//
// enum Color { BLACK, GRAY, WHITE };
// class AnimalTest
// : public testing::TestWithParam<tuple<const char*, Color> > {...};
//
// TEST_P(AnimalTest, AnimalLooksNice) {...}
//
// INSTANTIATE_TEST_CASE_P(AnimalVariations, AnimalTest,
// Combine(Values("cat", "dog"),
// Values(BLACK, WHITE)));
//
// This will instantiate tests in FlagDependentTest with all variations of two
// Boolean flags:
//
// class FlagDependentTest
// : public testing::TestWithParam<tuple<bool, bool> > {
// virtual void SetUp() {
// // Assigns external_flag_1 and external_flag_2 values from the tuple.
// tie(external_flag_1, external_flag_2) = GetParam();
// }
// };
//
// TEST_P(FlagDependentTest, TestFeature1) {
// // Test your code using external_flag_1 and external_flag_2 here.
// }
// INSTANTIATE_TEST_CASE_P(TwoBoolSequence, FlagDependentTest,
// Combine(Bool(), Bool()));
//
template <typename Generator1, typename Generator2>
internal::CartesianProductHolder2<Generator1, Generator2> Combine(
const Generator1& g1, const Generator2& g2) {
return internal::CartesianProductHolder2<Generator1, Generator2>(
g1, g2);
}
template <typename Generator1, typename Generator2, typename Generator3>
internal::CartesianProductHolder3<Generator1, Generator2, Generator3> Combine(
const Generator1& g1, const Generator2& g2, const Generator3& g3) {
return internal::CartesianProductHolder3<Generator1, Generator2, Generator3>(
g1, g2, g3);
}
template <typename Generator1, typename Generator2, typename Generator3,
typename Generator4>
internal::CartesianProductHolder4<Generator1, Generator2, Generator3,
Generator4> Combine(
const Generator1& g1, const Generator2& g2, const Generator3& g3,
const Generator4& g4) {
return internal::CartesianProductHolder4<Generator1, Generator2, Generator3,
Generator4>(
g1, g2, g3, g4);
}
template <typename Generator1, typename Generator2, typename Generator3,
typename Generator4, typename Generator5>
internal::CartesianProductHolder5<Generator1, Generator2, Generator3,
Generator4, Generator5> Combine(
const Generator1& g1, const Generator2& g2, const Generator3& g3,
const Generator4& g4, const Generator5& g5) {
return internal::CartesianProductHolder5<Generator1, Generator2, Generator3,
Generator4, Generator5>(
g1, g2, g3, g4, g5);
}
template <typename Generator1, typename Generator2, typename Generator3,
typename Generator4, typename Generator5, typename Generator6>
internal::CartesianProductHolder6<Generator1, Generator2, Generator3,
Generator4, Generator5, Generator6> Combine(
const Generator1& g1, const Generator2& g2, const Generator3& g3,
const Generator4& g4, const Generator5& g5, const Generator6& g6) {
return internal::CartesianProductHolder6<Generator1, Generator2, Generator3,
Generator4, Generator5, Generator6>(
g1, g2, g3, g4, g5, g6);
}
template <typename Generator1, typename Generator2, typename Generator3,
typename Generator4, typename Generator5, typename Generator6,
typename Generator7>
internal::CartesianProductHolder7<Generator1, Generator2, Generator3,
Generator4, Generator5, Generator6, Generator7> Combine(
const Generator1& g1, const Generator2& g2, const Generator3& g3,
const Generator4& g4, const Generator5& g5, const Generator6& g6,
const Generator7& g7) {
return internal::CartesianProductHolder7<Generator1, Generator2, Generator3,
Generator4, Generator5, Generator6, Generator7>(
g1, g2, g3, g4, g5, g6, g7);
}
template <typename Generator1, typename Generator2, typename Generator3,
typename Generator4, typename Generator5, typename Generator6,
typename Generator7, typename Generator8>
internal::CartesianProductHolder8<Generator1, Generator2, Generator3,
Generator4, Generator5, Generator6, Generator7, Generator8> Combine(
const Generator1& g1, const Generator2& g2, const Generator3& g3,
const Generator4& g4, const Generator5& g5, const Generator6& g6,
const Generator7& g7, const Generator8& g8) {
return internal::CartesianProductHolder8<Generator1, Generator2, Generator3,
Generator4, Generator5, Generator6, Generator7, Generator8>(
g1, g2, g3, g4, g5, g6, g7, g8);
}
template <typename Generator1, typename Generator2, typename Generator3,
typename Generator4, typename Generator5, typename Generator6,
typename Generator7, typename Generator8, typename Generator9>
internal::CartesianProductHolder9<Generator1, Generator2, Generator3,
Generator4, Generator5, Generator6, Generator7, Generator8,
Generator9> Combine(
const Generator1& g1, const Generator2& g2, const Generator3& g3,
const Generator4& g4, const Generator5& g5, const Generator6& g6,
const Generator7& g7, const Generator8& g8, const Generator9& g9) {
return internal::CartesianProductHolder9<Generator1, Generator2, Generator3,
Generator4, Generator5, Generator6, Generator7, Generator8, Generator9>(
g1, g2, g3, g4, g5, g6, g7, g8, g9);
}
template <typename Generator1, typename Generator2, typename Generator3,
typename Generator4, typename Generator5, typename Generator6,
typename Generator7, typename Generator8, typename Generator9,
typename Generator10>
internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
Generator4, Generator5, Generator6, Generator7, Generator8, Generator9,
Generator10> Combine(
const Generator1& g1, const Generator2& g2, const Generator3& g3,
const Generator4& g4, const Generator5& g5, const Generator6& g6,
const Generator7& g7, const Generator8& g8, const Generator9& g9,
const Generator10& g10) {
return internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
Generator4, Generator5, Generator6, Generator7, Generator8, Generator9,
Generator10>(
g1, g2, g3, g4, g5, g6, g7, g8, g9, g10);
}
# endif // GTEST_HAS_COMBINE
# define TEST_P(test_case_name, test_name) \
class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
: public test_case_name { \
public: \
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {} \
virtual void TestBody(); \
private: \
static int AddToRegistry() { \
::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
GetTestCasePatternHolder<test_case_name>(\
#test_case_name, \
::testing::internal::CodeLocation(\
__FILE__, __LINE__))->AddTestPattern(\
GTEST_STRINGIFY_(test_case_name), \
GTEST_STRINGIFY_(test_name), \
new ::testing::internal::TestMetaFactory< \
GTEST_TEST_CLASS_NAME_(\
test_case_name, test_name)>()); \
return 0; \
} \
static int gtest_registering_dummy_ GTEST_ATTRIBUTE_UNUSED_; \
GTEST_DISALLOW_COPY_AND_ASSIGN_(\
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)); \
}; \
int GTEST_TEST_CLASS_NAME_(test_case_name, \
test_name)::gtest_registering_dummy_ = \
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
// The optional last argument to INSTANTIATE_TEST_CASE_P allows the user
// to specify a function or functor that generates custom test name suffixes
// based on the test parameters. The function should accept one argument of
// type testing::TestParamInfo<class ParamType>, and return std::string.
//
// testing::PrintToStringParamName is a builtin test suffix generator that
// returns the value of testing::PrintToString(GetParam()).
//
// Note: test names must be non-empty, unique, and may only contain ASCII
// alphanumeric characters or underscore. Because PrintToString adds quotes
// to std::string and C strings, it won't work for these types.
# define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator, ...) \
static ::testing::internal::ParamGenerator<test_case_name::ParamType> \
gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \
static ::std::string gtest_##prefix##test_case_name##_EvalGenerateName_( \
const ::testing::TestParamInfo<test_case_name::ParamType>& info) { \
return ::testing::internal::GetParamNameGen<test_case_name::ParamType> \
(__VA_ARGS__)(info); \
} \
static int gtest_##prefix##test_case_name##_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \
::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
GetTestCasePatternHolder<test_case_name>(\
#test_case_name, \
::testing::internal::CodeLocation(\
__FILE__, __LINE__))->AddTestCaseInstantiation(\
#prefix, \
>est_##prefix##test_case_name##_EvalGenerator_, \
>est_##prefix##test_case_name##_EvalGenerateName_, \
__FILE__, __LINE__)
} // namespace testing
#endif // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<meta charset="utf-8">
<style>
path {
stroke: #fff;
}
circle {
fill: white;
}
</style>
<body>
<script src="../../d3.js"></script>
<script>
var width = 500, height = 500;
var color=d3.scale.category10();
var data = [ [ 100, 100 ], [ 140, 200 ], [ 140, 180 ], [ 130, 170 ],[ 230, 60 ],[ 90, 220 ], [ 200, 200 ]];
var voronoi = d3.geom.voronoi();
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
var path = svg.append("g")
.selectAll("path")
.data(voronoi(data))
.enter().append("path")
.attr("fill", function(d, i) {
return color(i);
})
.attr("d", function(d,i){
return "M" + d.join("L") + "Z";
});
svg.selectAll("circle")
.data(data)
.enter()
.append("circle")
.attr("transform", function(d) {
return "translate(" + d + ")";
})
.attr("r", 2);
</script> | {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>홈</title>
<link rel="stylesheet" href="../assets/css/layout.css">
<link rel="stylesheet" href="../assets/css/button-hit.css">
</head>
<body>
<div class="ds-size">
<div class="banner">
<img src="../assets/images/manual-home.png">
</div>
<div class="bottom-screen">
<img class="twilightLogo" src="../assets/images/twilight.png">
<div class="ds-margin">
<div class="section-title">버튼 조작</div>
<div class="section-body">
<div class="button-action-group">
<span class="button-action font upDown"></span>
<span class="button-action-text">정보를 위아래로 스크롤 합니다.</span>
</div>
<hr>
<div class="button-action-group">
<span class="button-action font leftRight"></span>
<span class="button-action-text">이전 / 다음 페이지</span>
</div>
<hr>
<div class="button-action-group">
<span class="button-action font buttonB"></span>
<span class="button-action-text">Go to the page you previously looked at</span>
</div>
<hr>
<div class="button-action-group">
<span class="button-action">START</span>
<span class="button-action-text">설명서 닫기</span>
</div>
</div>
<div class="section-title">터치 조작</div>
<div class="section-body">
<div class="button-action-group">
<span class="button-action"><img src="../assets/images/up_down.png"></span>
<span class="button-action-text">정보를 위아래로 스크롤 합니다.</span>
</div>
<hr>
<div class="button-action-group">
<span class="button-action"><img src="../assets/images/tap.png"></span>
<span class="button-action-text">페이지를 방문하려면 링크를 터치합니다.</span>
</div>
</div>
<div class="section-title">테마 정보</div>
<div class="section-body">
<p>TWiLight Menu++는 사용자가 선택할 수 있는 6개의 테마를 가지고있습니다. These are alternative menus which all have different designs, some of them having completely separate navigational styles.</p>
<div class="grid-container-3">
<div class="grid-item">
<img src="../assets/images/dsicon.png"><br>
닌텐도 DSi
</div>
<div class="grid-item">
<img src="../assets/images/3dsicon.png"><br>
닌텐도 3DS
</div>
<div class="grid-item">
<img src="../assets/images/hblicon.png"><br>
홈브류 런처
</div>
<div class="grid-item">
<img src="../assets/images/akicon.png"><br>
Wood UI
</div>
<div class="grid-item">
<img src="../assets/images/r4icon.png"><br>
Original R4
</div>
<div class="grid-item">
<img src="../assets/images/saturnLogo.png"><br>
세가 새턴
</div>
</div>
</div>
<div class="section-title">Game Loaders</div>
<div class="section-body">
<p>TWiLight Menu++, as the name implies, is just a menu. It doesn't actually launch the ROMs itself. Here's a manual page for each ROM loader we have.</p>
<div class="grid-container-2">
<div class="grid-item">
<img src="../assets/images/ndsbicon.png"><br>
nds-bootstrap
</div>
<div class="grid-item">
<img src="../assets/images/gbaicon.png"><br>
GBARunner2
</div>
</div>
</div>
<div class="section-title">Other worthwhile pages</div>
<div class="section-body">
<div class="grid-container-2">
<div class="grid-item">
<img src="../assets/images/chaticon.png"><br>
채팅
</div>
<div class="grid-item">
<img src="../assets/images/settingsicon.png"><br>
Settings
</div>
<div class="grid-item">
<img src="../assets/images/nightlies-icon.png"><br>
Nightlies
</div>
<div class="grid-item">
<img src="../assets/images/cheatsicon.png"><br>
Cheats
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html> | {
"pile_set_name": "Github"
} |
/*=============================================================================
Library: CTK
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================================================*/
#include "ctkPluginFrameworkDebug_p.h"
#include "ctkPluginFrameworkDebugOptions_p.h"
#include "ctkPluginFrameworkProperties_p.h"
static QString CTK_OSGI = "org.commontk.pluginfw";
QString ctkPluginFrameworkDebug::OPTION_DEBUG_GENERAL = CTK_OSGI + "/debug";
QString ctkPluginFrameworkDebug::OPTION_DEBUG_FRAMEWORK = CTK_OSGI + "/debug/framework";
QString ctkPluginFrameworkDebug::OPTION_DEBUG_ERRORS = CTK_OSGI + "/debug/errors";
QString ctkPluginFrameworkDebug::OPTION_DEBUG_HOOKS = CTK_OSGI + "/debug/hooks";
QString ctkPluginFrameworkDebug::OPTION_DEBUG_LAZY_ACTIVATION = CTK_OSGI + "/debug/lazy_activation";
QString ctkPluginFrameworkDebug::OPTION_DEBUG_LDAP = CTK_OSGI + "/debug/ldap";
QString ctkPluginFrameworkDebug::OPTION_DEBUG_SERVICE_REFERENCE = CTK_OSGI + "/debug/service_reference";
QString ctkPluginFrameworkDebug::OPTION_DEBUG_STARTLEVEL = CTK_OSGI + "/debug/startlevel";
QString ctkPluginFrameworkDebug::OPTION_DEBUG_URL = CTK_OSGI + "/debug/url";
QString ctkPluginFrameworkDebug::OPTION_DEBUG_RESOLVE = CTK_OSGI + "/debug/resolve";
//----------------------------------------------------------------------------
ctkPluginFrameworkDebug::ctkPluginFrameworkDebug()
{
ctkPluginFrameworkDebugOptions* dbgOptions = ctkPluginFrameworkDebugOptions::getDefault();
if (dbgOptions != NULL)
{
enabled = dbgOptions->isDebugEnabled();
errors = dbgOptions->getBooleanOption(OPTION_DEBUG_ERRORS, false);
framework = dbgOptions->getBooleanOption(OPTION_DEBUG_FRAMEWORK, false);
hooks = dbgOptions->getBooleanOption(OPTION_DEBUG_HOOKS, false);
lazy_activation = dbgOptions->getBooleanOption(OPTION_DEBUG_LAZY_ACTIVATION, false);
ldap = dbgOptions->getBooleanOption(OPTION_DEBUG_LDAP, false);
service_reference = dbgOptions->getBooleanOption(OPTION_DEBUG_SERVICE_REFERENCE, false);
startlevel = dbgOptions->getBooleanOption(OPTION_DEBUG_STARTLEVEL, false);
url = dbgOptions->getBooleanOption(OPTION_DEBUG_URL, false);
resolve = dbgOptions->getBooleanOption(OPTION_DEBUG_RESOLVE, false);
}
}
| {
"pile_set_name": "Github"
} |
package com.tencent.mm.plugin.appbrand.ipc;
import com.tencent.matrix.trace.core.AppMethodBeat;
public final class AppBrandTaskInToolsProxyUI extends AppBrandTaskProxyUI {
public void onWindowFocusChanged(boolean z) {
super.onWindowFocusChanged(z);
AppMethodBeat.at(this, z);
}
}
| {
"pile_set_name": "Github"
} |
from django.conf.urls import url
from tokenapi.views import token, token_new
urlpatterns = [
url(r'^new.json$', token_new, name='api_token_new'),
url(r'^(?P<token>.{24})/(?P<user>\d+).json$', token, name='api_token'),
]
| {
"pile_set_name": "Github"
} |
@prefix p: <http://a.example/s>.
{p: <http://a.example/p> <http://a.example/o> .}
<http://example/graph> {p: <http://a.example/p> <http://a.example/o> .}
| {
"pile_set_name": "Github"
} |
>Mycoplasma_agalactiae_5632_FP671138_gi|290752859|emb|CBH40834.1|
MSGKLLVPKIRFKEFTNAWEQEKLGNFGTSTGGSSIENFFNNNGKYKVISIGSFSEDNTYNDQGLRIDYS
PFIKDKILKKDNIVMILNDKSSEAKILGKALLIEKDDEFVYNQRVQKIDINKDRFLSKFIFTLLNSNSRE
KITLLAQGNTQIYVNWSSISSIEYLIPNLEEQSQISSLFSHLDSLITLHQRKLSSLKNLKNRLLDKMFCD
EKSQFPSIRFKEFTNAWEQWKARGILLPYRQKNDKNLTLISYSVSNKEGFVDQKEFFDEGGKAVYADKKN
SLIISFDTFAYNPSRINVGSIALFKNTINGLVSPIYEVFKVSANSNPDFIYLWFKSECFNKIVANNSNKS
VRDTLNLKQFEDNLLNLPVLQEQNKIAKLFSSLDSLITLHQRKLNSLKNIKNTLLEKMFV
| {
"pile_set_name": "Github"
} |
# Copyright (C) Extensible Service Proxy Authors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
runtime: nodejs
env: flex
api_version: 1
service: default
resources:
cpu: 1
memory_gb: 1.3
disk_size_gb: 10
manual_scaling:
instances: 1
# Hard code the service name and config_id
endpoints_api_service:
name: "${MY_PROJECT_ID}.appspot.com"
config_id: "2017-07-12r0"
beta_settings:
allow_ssh: true
${CUSTOM_IMAGE}
liveness_check:
path: "/liveness_check"
readiness_check:
path: "/readiness_check"
skip_files:
- ^(.*/)?#.*#$
- ^(.*/)?.*~$
- ^(.*/)?.*\.py[co]$
- ^(.*/)?.*/RCS/.*$
- ^(.*/)?\..*$
- ^(.*/)?.*/node_modules/.*$
| {
"pile_set_name": "Github"
} |
# Blender v2.82 (sub 7) OBJ File: 'Rock1.blend'
# www.blender.org
mtllib rock1.mtl
o Cube
v 0.896930 1.078061 -0.116701
v 0.736314 -1.066762 -0.076033
v -1.052088 -0.954513 -0.064600
v -0.692441 0.835835 -0.114299
v 1.303753 1.023542 1.083753
v 0.444005 -1.513821 1.032712
v -1.019775 -1.105961 1.174950
v -0.681862 1.481573 1.180458
v 1.045407 0.147996 -0.157597
v 0.067265 0.783522 -0.072713
v 1.200361 1.221685 0.538245
v -0.154563 -1.228987 -0.114500
v 1.155268 -1.381585 0.478039
v -1.094633 0.118459 -0.254018
v -1.648060 -0.853586 0.452009
v -1.185727 1.133555 0.481559
v 0.975431 -0.047895 1.246558
v 0.105258 1.585067 1.126820
v -0.344848 -1.730000 1.152380
v -1.177093 -0.009798 1.303243
v -0.015789 0.060242 -0.312706
v 0.046107 0.253730 1.351565
v 1.175182 -0.169032 0.692469
v 0.260077 -1.365451 0.452640
v -1.648881 0.064031 0.429819
v -0.199824 1.536424 0.336820
v 1.008866 -0.470257 -0.126459
v -0.321458 0.702046 -0.060305
v 1.385825 1.181814 0.807576
v -0.537873 -1.154378 -0.057997
v 0.936321 -1.426494 0.677546
v -0.862364 0.537108 -0.219203
v -1.281588 -1.218077 0.883991
v -0.974527 1.431442 0.926074
v 0.808457 -0.902078 1.346412
v -0.174992 1.801163 1.147173
v -0.610285 -1.327881 1.147948
v -1.356023 0.716849 1.245036
v 1.042022 0.637866 -0.190494
v 0.468949 1.026806 -0.142859
v 1.081272 1.287556 0.175115
v 0.243586 -1.191072 -0.141476
v 1.014587 -1.312948 0.183491
v -1.155731 -0.459469 -0.217847
v -1.571341 -0.770709 0.110279
v -1.063276 1.015607 0.074521
v 1.231954 0.594471 1.216866
v 0.770454 1.299703 1.122192
v -0.065279 -1.796044 1.102928
v -1.176430 -0.646380 1.281231
v -0.476225 0.037390 -0.274043
v 0.480423 0.111060 -0.312115
v 0.172793 0.532460 -0.188473
v -0.106274 -0.595963 -0.274351
v -0.198010 -0.630818 1.360380
v 0.062998 0.994314 1.276304
v 0.611501 0.290780 1.352344
v -0.603343 0.011276 1.343584
v 1.267461 -1.008356 0.630730
v 1.267107 0.689727 0.600208
v 1.268899 0.063884 0.241091
v 1.050912 -0.197512 1.068502
v -1.043570 -1.289593 0.402928
v 0.667029 -1.448684 0.439932
v -0.135120 -1.505020 0.156677
v -0.066870 -1.602193 0.652060
v -1.759897 0.724614 0.319614
v -1.646483 -0.459024 0.462612
v -1.548443 0.255587 -0.153801
v -1.483055 -0.045330 1.068517
v -0.775458 1.402503 0.497559
v 0.556317 1.496503 0.449266
v 0.153226 1.832230 0.839249
v -0.180515 1.233899 0.060946
v -0.630920 -0.592326 -0.226328
v -0.677921 -0.698183 1.329703
v 1.115930 -0.980967 1.067893
v -0.944509 -1.392342 0.743625
v -1.719440 0.699776 0.916506
v -0.751048 1.123006 0.149059
v -0.359688 0.596748 -0.219676
v 0.548058 0.657622 -0.284113
v 0.383454 -0.533170 -0.298149
v 0.342781 -0.863692 1.370886
v 0.801564 0.716665 1.333314
v -0.544178 0.889409 1.290048
v 1.347667 -0.746821 0.189763
v 1.323792 0.856060 0.127379
v 1.423543 0.707035 0.897206
v -0.706694 -1.346937 0.190636
v 0.494274 -1.399456 0.153436
v 0.524189 -1.410453 0.691410
v -1.346437 0.808084 -0.078697
v -1.550380 -0.487642 0.033513
v -1.434319 -0.746778 1.017100
v -0.263198 1.716774 0.916780
v 0.802037 1.528586 0.850318
v 0.512712 1.198383 0.114694
vt 0.137636 0.563411
vt 0.082613 0.506661
vt 0.152906 0.498683
vt 0.155028 0.344089
vt 0.155630 0.402329
vt 0.099783 0.387655
vt 0.896175 0.282885
vt 0.794976 0.248970
vt 0.870663 0.174892
vt 0.944083 0.694636
vt 0.916733 0.604517
vt 0.949240 0.587705
vt 0.369246 0.000842
vt 0.460672 0.063535
vt 0.336809 0.082005
vt 0.485748 0.254952
vt 0.481603 0.323059
vt 0.447322 0.276247
vt 0.215363 0.578539
vt 0.270084 0.523882
vt 0.276846 0.583529
vt 0.226456 0.694739
vt 0.266533 0.646047
vt 0.288525 0.695621
vt 0.060049 0.668982
vt 0.140662 0.629249
vt 0.149628 0.688747
vt 0.046020 0.277128
vt 0.042023 0.402498
vt 0.011393 0.383384
vt 0.226136 0.127633
vt 0.116225 0.149680
vt 0.133867 0.094672
vt 0.335575 0.267841
vt 0.206193 0.274302
vt 0.273683 0.187557
vt 0.422948 0.654063
vt 0.477461 0.726331
vt 0.404599 0.713241
vt 0.529375 0.479105
vt 0.439840 0.553878
vt 0.422729 0.459207
vt 0.672331 0.787452
vt 0.731678 0.707183
vt 0.744126 0.814485
vt 0.006598 0.482318
vt 0.090851 0.431859
vt 0.016271 0.536299
vt 0.857058 0.070133
vt 0.818683 0.137473
vt 0.786060 0.070157
vt 0.720806 0.251159
vt 0.758736 0.168010
vt 0.829103 0.182611
vt 0.348488 0.225548
vt 0.408067 0.318081
vt 0.834672 0.401576
vt 0.758928 0.488146
vt 0.747834 0.361119
vt 0.844101 0.700647
vt 0.766456 0.640000
vt 0.853441 0.628842
vt 0.491069 0.166304
vt 0.554998 0.057463
vt 0.642437 0.169965
vt 0.608937 0.072162
vt 0.661203 0.071636
vt 0.628288 0.255903
vt 0.560004 0.310321
vt 0.556413 0.271543
vt 0.223692 0.502410
vt 0.220811 0.635843
vt 0.058285 0.569867
vt 0.115533 0.299946
vt 0.165692 0.199396
vt 0.258354 0.321530
vt 0.934356 0.187628
vt 0.907061 0.133559
vt 0.539575 0.580737
vt 0.617335 0.678426
vt 0.520455 0.684734
vt 0.622627 0.581780
vt 0.672331 0.661064
vt 0.869574 0.490922
vt 0.939564 0.506329
vt 0.744126 0.821215
vt 0.791426 0.711743
vt 0.791582 0.866218
vt 0.999879 0.706758
vt 1.000000 0.606532
vt 0.431026 0.176751
vt 0.672331 0.596657
vt 0.677773 0.459778
vt 0.674914 0.687648
vt 0.565426 0.199969
vt 0.387737 0.801509
vt 0.336920 0.785916
vt 0.384519 0.726331
vt 0.506205 0.350977
vt 0.512673 0.310590
vt 0.619708 0.321108
vt 0.559475 0.342029
vt 0.324683 0.722893
vt 0.320949 0.673747
vt 0.218381 0.752553
vt 0.278588 0.749240
vt 0.143231 0.752483
vt 0.069266 0.722735
vt 0.808347 0.361119
vt 0.854473 0.349296
vt 0.056221 0.145884
vt 0.000000 0.241327
vt 0.085645 0.065345
vt 0.116277 0.014773
vt 0.187902 0.035191
vt 0.316518 0.068429
vt 0.273048 0.064123
vt 0.336809 0.140426
vt 0.336809 0.674909
vt 0.340137 0.610197
vt 0.339988 0.536299
vt 0.336833 0.476818
vt 0.353162 0.419686
vt 0.517650 0.412671
vt 0.429528 0.400325
vt 0.604166 0.482239
vt 0.586459 0.423461
vt 0.646477 0.441109
vt 0.000000 0.608449
vt 0.053708 0.620010
vt 0.736508 0.092307
vt 0.012308 0.682984
vt 0.913859 0.076969
vt 0.855242 0.125920
vt 0.448079 0.354288
vt 0.232244 0.440506
vt 0.685316 0.388716
vt 0.130148 0.436240
vt 0.867108 0.417288
vt 0.821728 0.494375
vt 0.905653 0.682602
vt 0.489191 0.000000
vt 0.563922 0.000091
vt 0.582099 0.007382
vt 0.207942 0.000000
vt 0.579472 0.365264
vt 0.639569 0.392860
vt 0.693822 0.237100
vt 0.693981 0.150197
vt 0.668575 0.311882
vt 0.206316 0.378186
vt 0.683844 0.711964
vt 0.054401 0.402498
vt 0.693981 0.268226
vt 0.766741 0.707183
vt 0.662917 0.562066
vt 0.752056 0.707183
vt 0.336809 0.833560
vt 0.609960 0.361119
vt 0.670954 0.491413
vt 0.694133 0.143704
vt 0.019832 0.742597
vt 0.291247 0.454530
vt 0.293309 0.025246
vt 0.477201 0.361119
vn -0.0796 -0.1933 -0.9779
vn -0.3201 -0.5230 -0.7899
vn -0.2771 -0.2120 -0.9371
vn -0.0711 -0.1584 0.9848
vn -0.3451 -0.4751 0.8094
vn -0.3559 -0.4008 0.8442
vn 0.7746 -0.2971 0.5582
vn 0.4023 -0.8029 0.4399
vn 0.3900 -0.8845 0.2557
vn -0.6231 -0.7258 0.2915
vn -0.4088 -0.9120 0.0325
vn -0.4539 0.2292 0.8610
vn -0.5716 0.8077 0.1441
vn -0.8850 0.2854 0.3677
vn -0.1928 0.6932 -0.6945
vn 0.0979 0.5738 -0.8131
vn -0.2362 0.8031 -0.5470
vn -0.0570 0.0203 -0.9981
vn -0.0716 0.2246 -0.9718
vn 0.0461 0.4416 -0.8960
vn 0.0987 0.0367 -0.9944
vn -0.1115 0.2644 -0.9579
vn -0.0450 0.1710 -0.9842
vn 0.1037 -0.5063 -0.8561
vn -0.0700 -0.1560 -0.9853
vn 0.1192 -0.1395 -0.9830
vn 0.0425 -0.1706 0.9844
vn -0.3217 -0.8017 0.5038
vn 0.1152 -0.9330 0.3408
vn 0.0342 0.1730 0.9843
vn 0.1034 0.0072 0.9946
vn 0.1487 0.1511 0.9773
vn -0.0517 0.0276 0.9983
vn -0.0450 0.1196 0.9918
vn 0.9208 -0.1228 -0.3701
vn 0.6692 -0.7426 0.0250
vn 0.4377 -0.6741 -0.5950
vn 0.9820 -0.0315 -0.1864
vn 0.9827 -0.0417 -0.1804
vn 0.9183 0.1931 -0.3456
vn 0.6265 -0.0523 0.7776
vn 0.8902 -0.1271 0.4374
vn 0.9953 -0.0874 0.0411
vn -0.4311 -0.8576 -0.2804
vn -0.7423 -0.3693 -0.5591
vn -0.2406 -0.9239 -0.2975
vn 0.1145 -0.9080 -0.4030
vn 0.0598 -0.9883 -0.1403
vn -0.1155 -0.9883 -0.0996
vn 0.0297 -0.8456 -0.5329
vn 0.0609 -0.9814 -0.1822
vn -0.8922 0.3967 -0.2156
vn -0.3926 0.5675 -0.7237
vn -0.7945 -0.1467 -0.5893
vn -0.9937 -0.1122 -0.0037
vn -0.6686 0.0363 -0.7427
vn -0.4112 -0.1772 0.8941
vn -0.8157 -0.0997 0.5698
vn -0.7978 -0.2365 0.5545
vn -0.4000 0.8137 -0.4217
vn -0.2571 0.9580 -0.1272
vn 0.2356 0.8450 -0.4800
vn 0.0997 0.9913 0.0862
vn 0.4401 0.8779 0.1887
vn -0.0526 0.7426 -0.6677
vn -0.1146 0.4102 -0.9047
vn -0.0712 0.4951 -0.8659
vn -0.1237 0.0419 -0.9914
vn -0.0293 0.0791 -0.9964
vn -0.1957 -0.5088 -0.8383
vn -0.0556 -0.0828 0.9950
vn -0.0124 0.0552 0.9984
vn -0.3327 -0.0140 0.9429
vn 0.9409 -0.2248 0.2531
vn 0.9736 -0.0545 0.2216
vn 0.3573 -0.2334 0.9043
vn -0.9120 -0.4097 -0.0152
vn -0.5351 0.7972 -0.2795
vn -0.1291 0.8077 -0.5752
vn 0.0138 0.6475 -0.7619
vn -0.2665 0.6169 -0.7405
vn 0.2340 0.5620 -0.7933
vn 0.5922 -0.0725 -0.8025
vn 0.4834 0.0847 -0.8713
vn 0.5176 -0.1045 -0.8492
vn 0.3116 -0.4087 -0.8578
vn 0.5473 -0.1313 0.8266
vn 0.6389 0.3576 0.6811
vn 0.2576 0.5254 0.8109
vn 0.1259 0.9135 0.3867
vn 0.2369 0.5509 0.8003
vn -0.3230 0.6040 0.7285
vn 0.7469 0.6276 -0.2194
vn 0.4762 0.7765 -0.4125
vn 0.8630 0.5050 -0.0144
vn -0.1175 -0.5004 -0.8578
vn -0.0014 -0.9969 -0.0779
vn -0.9983 -0.0163 0.0552
usemtl Material
s 1
f 75/1/1 3/2/2 44/3/3
f 76/4/4 7/5/5 37/6/6
f 77/7/7 6/8/8 31/9/9
f 37/10/6 33/11/10 78/12/11
f 38/13/12 34/14/13 79/15/14
f 80/16/15 4/17/16 46/18/17
f 51/19/18 32/20/19 81/21/20
f 52/22/21 53/23/22 82/24/23
f 42/25/24 54/26/25 83/27/26
f 84/28/27 19/29/28 49/30/29
f 56/31/30 57/32/31 85/33/32
f 38/34/12 58/35/33 86/36/34
f 87/37/35 13/38/36 43/39/37
f 60/40/38 61/41/39 88/42/40
f 47/43/41 62/44/42 89/45/43
f 63/46/44 45/47/45 90/48/46
f 91/49/47 24/50/48 65/51/49
f 49/52/29 66/53/50 92/54/51
f 67/55/52 46/18/17 93/56/53
f 94/57/54 25/58/55 69/59/56
f 50/60/57 70/61/58 95/62/59
f 71/63/60 34/14/13 96/64/61
f 72/65/62 73/66/63 97/67/64
f 98/68/65 10/69/66 74/70/67
f 51/19/18 44/3/3 14/71/68
f 54/26/25 51/19/18 21/72/69
f 54/26/25 30/73/70 75/1/1
f 55/74/71 37/6/6 19/29/28
f 58/35/33 55/74/71 22/75/72
f 20/76/73 76/4/4 58/35/33
f 59/77/74 31/9/9 13/78/36
f 23/79/75 77/80/7 59/81/74
f 62/82/42 35/83/76 77/80/7
f 78/12/11 15/84/77 63/85/44
f 66/86/50 63/87/44 24/88/48
f 19/89/28 78/12/11 66/90/50
f 79/15/14 16/91/78 67/55/52
f 25/58/55 79/92/14 67/93/52
f 70/61/58 38/94/12 79/92/14
f 80/16/15 16/91/78 71/63/60
f 26/95/79 80/16/15 71/63/60
f 74/96/67 28/97/80 80/98/15
f 81/99/20 4/17/16 28/100/80
f 10/69/66 81/99/20 28/100/80
f 21/72/69 81/21/20 53/23/22
f 40/101/81 53/102/22 10/69/66
f 1/103/82 82/24/23 40/104/81
f 9/105/83 82/24/23 39/106/84
f 83/27/26 21/72/69 52/22/21
f 27/107/85 52/22/21 9/105/83
f 2/108/86 83/27/26 27/107/85
f 84/109/27 6/8/8 35/110/76
f 17/111/87 84/28/27 35/112/76
f 22/75/72 84/28/27 57/32/31
f 47/113/41 57/32/31 17/111/87
f 5/114/88 85/33/32 47/113/41
f 48/115/89 56/31/30 85/33/32
f 86/36/34 22/75/72 56/31/30
f 36/116/90 56/31/30 18/117/91
f 8/118/92 86/36/34 36/116/90
f 87/37/35 2/119/86 27/120/85
f 61/41/39 27/120/85 9/121/83
f 23/79/75 87/37/35 61/41/39
f 88/42/40 9/121/83 39/122/84
f 1/123/82 88/42/40 39/122/84
f 11/124/93 88/42/40 41/125/94
f 89/126/43 23/79/75 60/40/38
f 29/127/95 60/40/38 11/124/93
f 5/128/88 89/126/43 29/127/95
f 90/48/46 3/2/2 30/73/70
f 65/129/49 30/73/70 12/130/96
f 24/50/48 90/131/46 65/51/49
f 42/25/24 65/129/49 12/130/96
f 2/108/86 91/132/47 42/25/24
f 43/133/37 64/134/97 91/49/47
f 92/54/51 24/50/48 64/134/97
f 31/9/9 64/134/97 13/78/36
f 6/8/8 92/54/51 31/9/9
f 93/56/53 4/17/16 32/135/19
f 69/136/56 32/20/19 14/71/68
f 69/59/56 67/93/52 93/137/53
f 44/3/3 69/136/56 14/71/68
f 3/2/2 94/138/54 44/3/3
f 45/139/45 68/140/98 94/57/54
f 68/140/98 70/61/58 25/58/55
f 15/84/77 95/62/59 68/140/98
f 7/141/5 95/62/59 33/11/10
f 96/64/61 8/142/92 36/143/90
f 18/144/91 96/64/61 36/143/90
f 26/95/79 96/64/61 73/66/63
f 97/145/64 18/117/91 48/115/89
f 5/128/88 97/146/64 48/147/89
f 11/124/93 97/146/64 29/127/95
f 98/68/65 26/95/79 72/65/62
f 41/148/94 72/65/62 11/149/93
f 1/150/82 98/68/65 41/148/94
f 75/1/1 30/73/70 3/2/2
f 76/4/4 50/151/57 7/5/5
f 77/7/7 35/110/76 6/8/8
f 37/10/6 7/141/5 33/11/10
f 38/13/12 8/142/92 34/14/13
f 80/16/15 28/100/80 4/17/16
f 51/19/18 14/71/68 32/20/19
f 52/22/21 21/72/69 53/23/22
f 42/25/24 12/130/96 54/26/25
f 84/28/27 55/74/71 19/29/28
f 56/31/30 22/75/72 57/32/31
f 38/34/12 20/76/73 58/35/33
f 87/37/35 59/81/74 13/38/36
f 60/40/38 23/79/75 61/41/39
f 47/43/41 17/152/87 62/44/42
f 63/46/44 15/153/77 45/47/45
f 91/49/47 64/134/97 24/50/48
f 49/52/29 19/154/28 66/53/50
f 67/55/52 16/91/78 46/18/17
f 94/57/54 68/140/98 25/58/55
f 50/60/57 20/155/73 70/61/58
f 71/63/60 16/91/78 34/14/13
f 72/65/62 26/95/79 73/66/63
f 98/68/65 40/101/81 10/69/66
f 51/19/18 75/1/1 44/3/3
f 54/26/25 75/1/1 51/19/18
f 54/26/25 12/130/96 30/73/70
f 55/74/71 76/4/4 37/6/6
f 58/35/33 76/4/4 55/74/71
f 20/76/73 50/151/57 76/4/4
f 59/77/74 77/7/7 31/9/9
f 23/79/75 62/82/42 77/80/7
f 62/82/42 17/156/87 35/83/76
f 78/12/11 33/11/10 15/84/77
f 66/86/50 78/157/11 63/87/44
f 19/89/28 37/10/6 78/12/11
f 79/15/14 34/14/13 16/91/78
f 25/58/55 70/61/58 79/92/14
f 70/61/58 20/155/73 38/94/12
f 80/16/15 46/18/17 16/91/78
f 26/95/79 74/70/67 80/16/15
f 74/96/67 10/158/66 28/97/80
f 81/99/20 32/135/19 4/17/16
f 10/69/66 53/102/22 81/99/20
f 21/72/69 51/19/18 81/21/20
f 40/101/81 82/159/23 53/102/22
f 1/103/82 39/106/84 82/24/23
f 9/105/83 52/22/21 82/24/23
f 83/27/26 54/26/25 21/72/69
f 27/107/85 83/27/26 52/22/21
f 2/108/86 42/25/24 83/27/26
f 84/109/27 49/52/29 6/8/8
f 17/111/87 57/32/31 84/28/27
f 22/75/72 55/74/71 84/28/27
f 47/113/41 85/33/32 57/32/31
f 5/114/88 48/115/89 85/33/32
f 48/115/89 18/117/91 56/31/30
f 86/36/34 58/35/33 22/75/72
f 36/116/90 86/36/34 56/31/30
f 8/118/92 38/34/12 86/36/34
f 87/37/35 43/39/37 2/119/86
f 61/41/39 87/37/35 27/120/85
f 23/79/75 59/81/74 87/37/35
f 88/42/40 61/41/39 9/121/83
f 1/123/82 41/125/94 88/42/40
f 11/124/93 60/40/38 88/42/40
f 89/126/43 62/82/42 23/79/75
f 29/127/95 89/126/43 60/40/38
f 5/128/88 47/160/41 89/126/43
f 90/48/46 45/47/45 3/2/2
f 65/129/49 90/48/46 30/73/70
f 24/50/48 63/161/44 90/131/46
f 42/25/24 91/132/47 65/129/49
f 2/108/86 43/162/37 91/132/47
f 43/133/37 13/78/36 64/134/97
f 92/54/51 66/53/50 24/50/48
f 31/9/9 92/54/51 64/134/97
f 6/8/8 49/52/29 92/54/51
f 93/56/53 46/18/17 4/17/16
f 69/136/56 93/163/53 32/20/19
f 69/59/56 25/58/55 67/93/52
f 44/3/3 94/138/54 69/136/56
f 3/2/2 45/47/45 94/138/54
f 45/139/45 15/84/77 68/140/98
f 68/140/98 95/62/59 70/61/58
f 15/84/77 33/11/10 95/62/59
f 7/141/5 50/60/57 95/62/59
f 96/64/61 34/14/13 8/142/92
f 18/144/91 73/66/63 96/64/61
f 26/95/79 71/63/60 96/64/61
f 97/145/64 73/164/63 18/117/91
f 5/128/88 29/127/95 97/146/64
f 11/124/93 72/165/62 97/146/64
f 98/68/65 74/70/67 26/95/79
f 41/148/94 98/68/65 72/65/62
f 1/150/82 40/101/81 98/68/65
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<size android:width="2dp" />
<solid android:color="@color/grey_achievements_invite_friends_sub"/>
</shape> | {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.