text
stringlengths 2
99.9k
| meta
dict |
---|---|
---
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
keywords: powershell,cmdlet
Locale: en-US
Module Name: Microsoft.PowerShell.Utility
ms.date: 09/25/2020
online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/out-string?view=powershell-6&WT.mc_id=ps-gethelp
schema: 2.0.0
title: Out-String
---
# Out-String
## SYNOPSIS
Sends objects to the host as a series of strings.
## SYNTAX
### NoNewLineFormatting (Default)
```
Out-String [-Width <Int32>] [-NoNewline] [-InputObject <PSObject>] [<CommonParameters>]
```
### StreamFormatting
```
Out-String [-Stream] [-Width <Int32>] [-InputObject <PSObject>] [<CommonParameters>]
```
## DESCRIPTION
The `Out-String` cmdlet converts the objects that PowerShell manages into an array of strings. By
default, `Out-String` accumulates the strings and returns them as a single string, but you can use
the **Stream** parameter to direct `Out-String` to return one string at a time. This cmdlet lets you
search and manipulate string output as you would in traditional shells when object manipulation is
less convenient.
## EXAMPLES
### Example 1: Output text to the console as a string
This example sends a file's contents to the `Out-String` cmdlet and displays it in the PowerShell
console.
```powershell
Get-Content -Path C:\Test\Testfile.txt | Out-String
```
`Get-Content` sends the contents of the `Testfile.txt` file down the pipeline. Each line of the file
has its own properties. `Out-String` converts the objects into an array of strings and then displays
the contents as one string in the PowerShell console.
> [!NOTE]
> To compare the differences about how `Get-Content` and `Out-String` display the properties:
>
> `Get-Content -Path C:\Test\Testfile.txt | Select-Object -Property *`
>
> `Get-Content -Path C:\Test\Testfile.txt | Out-String | Select-Object -Property *`
### Example 2: Get the current culture and convert the data to strings
This example gets the regional settings for the current user and converts the object data to
strings.
```powershell
$C = Get-Culture | Select-Object -Property *
Out-String -InputObject $C -Width 100
```
The `$C` variable stores a **Selected.System.Globalization.CultureInfo** object. The object is the
result of `Get-Culture` sending output down the pipeline to `Select-Object`. The **Property**
parameter uses an asterisk (`*`) wildcard to specify all properties are contained in the object.
`Out-String` uses the **InputObject** parameter to specify the **CultureInfo** object stored in the
`$C` variable. The objects in `$C` are converted to a string.
> [!NOTE]
> To view the `Out-String` array, store the output to a variable and use an array index to view the
> elements. For more information about the array index, see
> [about_Arrays](../microsoft.powershell.core/about/about_arrays.md).
>
> `$str = Out-String -InputObject $C -Width 100`
### Example 3: Working with objects
This example demonstrates the difference between working with objects and working with strings. The
command displays an alias that includes the text **gcm**, the alias for `Get-Command`.
```powershell
Get-Alias | Out-String -Stream | Select-String -Pattern "gcm"
```
```Output
Alias gcm -> Get-Command
```
`Get-Alias` gets the **System.Management.Automation.AliasInfo** objects, one for each alias, and
sends the objects down the pipeline. `Out-String` uses the **Stream** parameter to convert each
object to a string rather concatenating all the objects into a single string. The **System.String**
objects are sent down the pipeline and `Select-String` uses the **Pattern** parameter to find
matches for the text **gcm**.
> [!NOTE]
> If you omit the **Stream** parameter, the command displays all the aliases because `Select-String`
> finds the text **gcm** in the single string that `Out-String` returns.
### Example 4: Using the NoNewLine parameter
This example shows how the **NoNewLine** parameter removes new lines that are created by the
PowerShell formatter. New lines that are part of the string objects created with `Out-String` aren't
removed.
The example uses a special character (`` `n ``) to create a new line. For more information, see
[about_Special_Characters](../microsoft.powershell.core/about/about_special_characters.md).
```
PS> "a", "b`n", "c", "d" | Out-String
a
b
c
d
PS> "a", "b`n", "c", "d" | Out-String -NoNewline
ab
cd
PS> @{key='value'} | Out-String
Name Value
---- -----
key value
PS> @{key='value'} | Out-String -NoNewLine
Name Value---- -----key value
```
A string of characters is sent down the pipeline to `Out-String`. The default formatter displays the
output that includes new lines. The `` "b`n" `` includes the new line special character. When the
**NoNewline** parameter is used, the new lines created by the formatter are removed. But, the new
line created with the special character is preserved.
The key/value pair is an example of how `Out-String` uses the default formatter to add new lines.
When the **NoNewline** parameter is used, the new lines created by the formatter are removed.
## PARAMETERS
### -InputObject
Specifies the objects to be written to a string. Enter a variable that contains the objects, or type
a command or expression that gets the objects.
```yaml
Type: System.Management.Automation.PSObject
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
```
### -NoNewline
Removes all newlines from output generated by the PowerShell formatter. Newlines that are part of
the string objects are preserved.
This parameter was introduced in PowerShell 6.0.
```yaml
Type: System.Management.Automation.SwitchParameter
Parameter Sets: NoNewLineFormatting
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
```
### -Stream
Indicates that the cmdlet sends a separate string for each object. By default, the strings for each
object are accumulated and sent as a single string.
```yaml
Type: System.Management.Automation.SwitchParameter
Parameter Sets: StreamFormatting
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
```
### -Width
Specifies the number of characters in each line of output. Any additional characters are wrapped to
the next line. The **Width** parameter applies only to objects that are being formatted. If you omit
this parameter, the width is determined by the characteristics of the host program. The default
value for the PowerShell console is 80 characters.
```yaml
Type: System.Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose,
-WarningAction, and -WarningVariable. For more information, see
[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
### System.Management.Automation.PSObject
You can send objects down the pipeline to `Out-String`.
## OUTPUTS
### System.String
`Out-String` returns the string that it creates from the input object.
## NOTES
The cmdlets that contain the `Out` verb don't format objects. The `Out` cmdlets send objects to the
formatter for the specified display destination.
The `Out` cmdlets don't have parameters that accept names or file paths. To send the output of a
PowerShell command to an `Out` cmdlet, use the pipeline. Or, you can store data in a variable and
use the **InputObject** parameter to pass the data to the cmdlet.
## RELATED LINKS
[Out-Default](../Microsoft.PowerShell.Core/Out-Default.md)
[Out-File](Out-File.md)
[Out-Host](../Microsoft.PowerShell.Core/Out-Host.md)
[Out-Null](../Microsoft.PowerShell.Core/Out-Null.md)
| {
"pile_set_name": "Github"
} |
---
# 直接回复
hi|你好|nihao: 'hi, I am robot'
# 随机回复一个
hello:
- 你好
- fine
- how are you
test:
- Roger that!
# YAML可能会把微信的表情符解析为数组,引号引起来比较保险
- "收到你的测试消息了!嘻嘻..[可爱]"
# 回复多行文本,只需在冒号后面加上竖线(|)
帮助: |
帮助这个事情,
说起来也不容易,
我也不知道怎么跟你解释,
发送 help 试试看呢
# 匹配组替换
/key (.*)/i: '你输入的匹配关键词是:{1}, \{1}replaced'
# 可以是一个rule配置,如果没有pattern,自动使用key
yaml:
name: 'test_yaml_object'
handler: '这是一个yaml的object配置'
| {
"pile_set_name": "Github"
} |
package io.gitlab.arturbosch.detekt.core.util
import io.gitlab.arturbosch.detekt.api.PropertiesAware
import io.gitlab.arturbosch.detekt.api.UnstableApi
import io.gitlab.arturbosch.detekt.api.getOrNull
import java.time.Duration
import java.util.EnumMap
import java.util.LinkedList
class PerformanceMonitor {
enum class Phase {
LoadConfig,
CreateSettings,
ValidateConfig,
Parsing,
Binding,
LoadingExtensions,
Analyzer,
Reporting,
}
data class Entry(val phase: Phase, val duration: Duration)
private val finished: MutableList<Entry> = LinkedList()
private val started: MutableMap<Phase, StartMillis> = EnumMap(Phase::class.java)
fun allFinished(): List<Entry> = finished
fun start(phase: Phase) {
started[phase] = System.currentTimeMillis()
}
fun finish(phase: Phase) {
val start = requireNotNull(started[phase])
val end = System.currentTimeMillis()
finished.add(Entry(phase, Duration.ofMillis(end - start)))
}
fun <R> measure(phase: Phase, block: () -> R): R {
start(phase)
val result = block()
finish(phase)
return result
}
}
typealias StartMillis = Long
internal const val MONITOR_PROPERTY_KEY = "detekt.core.monitor"
@OptIn(UnstableApi::class)
internal fun PropertiesAware.getOrCreateMonitor(): PerformanceMonitor {
var monitor = getOrNull<PerformanceMonitor>(MONITOR_PROPERTY_KEY)
if (monitor == null) {
monitor = PerformanceMonitor()
register(MONITOR_PROPERTY_KEY, monitor)
}
return monitor
}
| {
"pile_set_name": "Github"
} |
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace StarkPlatform.Compiler.Ergon.Logging
{
internal class DiagnosticLog : IEnumerable<DiagnosticLogItem>
{
private readonly List<DiagnosticLogItem> _items;
public int Count => _items.Count;
public DiagnosticLogItem this[int index] => _items[index];
public bool IsEmpty => _items.Count == 0;
public bool HasFailure =>
_items.Any(i => i.Kind == WorkspaceDiagnosticKind.Failure);
public DiagnosticLog()
=> _items = new List<DiagnosticLogItem>();
public IEnumerator<DiagnosticLogItem> GetEnumerator()
=> _items.GetEnumerator();
IEnumerator IEnumerable.GetEnumerator()
=> GetEnumerator();
public void Add(DiagnosticLogItem item)
{
if (item == null)
{
throw new ArgumentNullException(nameof(item));
}
_items.Add(item);
}
public void Add(string message, string projectFilePath, WorkspaceDiagnosticKind kind = WorkspaceDiagnosticKind.Failure)
=> _items.Add(new DiagnosticLogItem(kind, message, projectFilePath));
public void Add(Exception exception, string projectFilePath, WorkspaceDiagnosticKind kind = WorkspaceDiagnosticKind.Failure)
=> _items.Add(new DiagnosticLogItem(kind, exception.Message, projectFilePath));
}
}
| {
"pile_set_name": "Github"
} |
mixin post(post, index)
article.post
header.post__head
time.post__time(datetime = date_xml(post.date))
= date(post.date, theme.date_format)
h1.post__title: a(href = config.root + post.path)
= post.title
if index != 'archive'
if post.img
a.post__image(href = config.root + post.path): img(src = post.img, alt = 'featured-image')
div.post__main.echo
if post.excerpt && index == 'index'
!= post.excerpt
else
!= post.content
footer.post__foot.u-cf
if post.tags && post.tags.length
ul.post__tag.u-fl
-post.tags.forEach(function(tag){
li.post__tag__item: a.post__tag__link(href = config.root + tag.path)
= tag.name
- })
if post.excerpt && index == 'index'
a.post__more.u-fr(href = config.root + post.path + '#more')= theme.excerpt_link
else
a.post__foot-link.u-fr(href = config.root + post.path + '#disqus_thread')= theme.comment_link | {
"pile_set_name": "Github"
} |
/*
* This file contains an ECC algorithm that detects and corrects 1 bit
* errors in a 256 byte block of data.
*
* drivers/mtd/nand/nand_ecc.c
*
* Copyright © 2008 Koninklijke Philips Electronics NV.
* Author: Frans Meulenbroeks
*
* Completely replaces the previous ECC implementation which was written by:
* Steven J. Hill ([email protected])
* Thomas Gleixner ([email protected])
*
* Information on how this algorithm works and how it was developed
* can be found in Documentation/mtd/nand_ecc.txt
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 or (at your option) any
* later version.
*
* This file 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 file; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*
*/
/*
* The STANDALONE macro is useful when running the code outside the kernel
* e.g. when running the code in a testbed or a benchmark program.
* When STANDALONE is used, the module related macros are commented out
* as well as the linux include files.
* Instead a private definition of mtd_info is given to satisfy the compiler
* (the code does not use mtd_info, so the code does not care)
*/
#ifndef STANDALONE
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/nand.h>
#include <linux/mtd/nand_ecc.h>
#include <asm/byteorder.h>
#else
#include <stdint.h>
struct mtd_info;
#define EXPORT_SYMBOL(x) /* x */
#define MODULE_LICENSE(x) /* x */
#define MODULE_AUTHOR(x) /* x */
#define MODULE_DESCRIPTION(x) /* x */
#define printk printf
#define KERN_ERR ""
#endif
/*
* invparity is a 256 byte table that contains the odd parity
* for each byte. So if the number of bits in a byte is even,
* the array element is 1, and when the number of bits is odd
* the array eleemnt is 0.
*/
static const char invparity[256] = {
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1
};
/*
* bitsperbyte contains the number of bits per byte
* this is only used for testing and repairing parity
* (a precalculated value slightly improves performance)
*/
static const char bitsperbyte[256] = {
0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8,
};
/*
* addressbits is a lookup table to filter out the bits from the xor-ed
* ecc data that identify the faulty location.
* this is only used for repairing parity
* see the comments in nand_correct_data for more details
*/
static const char addressbits[256] = {
0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01,
0x02, 0x02, 0x03, 0x03, 0x02, 0x02, 0x03, 0x03,
0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01,
0x02, 0x02, 0x03, 0x03, 0x02, 0x02, 0x03, 0x03,
0x04, 0x04, 0x05, 0x05, 0x04, 0x04, 0x05, 0x05,
0x06, 0x06, 0x07, 0x07, 0x06, 0x06, 0x07, 0x07,
0x04, 0x04, 0x05, 0x05, 0x04, 0x04, 0x05, 0x05,
0x06, 0x06, 0x07, 0x07, 0x06, 0x06, 0x07, 0x07,
0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01,
0x02, 0x02, 0x03, 0x03, 0x02, 0x02, 0x03, 0x03,
0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01,
0x02, 0x02, 0x03, 0x03, 0x02, 0x02, 0x03, 0x03,
0x04, 0x04, 0x05, 0x05, 0x04, 0x04, 0x05, 0x05,
0x06, 0x06, 0x07, 0x07, 0x06, 0x06, 0x07, 0x07,
0x04, 0x04, 0x05, 0x05, 0x04, 0x04, 0x05, 0x05,
0x06, 0x06, 0x07, 0x07, 0x06, 0x06, 0x07, 0x07,
0x08, 0x08, 0x09, 0x09, 0x08, 0x08, 0x09, 0x09,
0x0a, 0x0a, 0x0b, 0x0b, 0x0a, 0x0a, 0x0b, 0x0b,
0x08, 0x08, 0x09, 0x09, 0x08, 0x08, 0x09, 0x09,
0x0a, 0x0a, 0x0b, 0x0b, 0x0a, 0x0a, 0x0b, 0x0b,
0x0c, 0x0c, 0x0d, 0x0d, 0x0c, 0x0c, 0x0d, 0x0d,
0x0e, 0x0e, 0x0f, 0x0f, 0x0e, 0x0e, 0x0f, 0x0f,
0x0c, 0x0c, 0x0d, 0x0d, 0x0c, 0x0c, 0x0d, 0x0d,
0x0e, 0x0e, 0x0f, 0x0f, 0x0e, 0x0e, 0x0f, 0x0f,
0x08, 0x08, 0x09, 0x09, 0x08, 0x08, 0x09, 0x09,
0x0a, 0x0a, 0x0b, 0x0b, 0x0a, 0x0a, 0x0b, 0x0b,
0x08, 0x08, 0x09, 0x09, 0x08, 0x08, 0x09, 0x09,
0x0a, 0x0a, 0x0b, 0x0b, 0x0a, 0x0a, 0x0b, 0x0b,
0x0c, 0x0c, 0x0d, 0x0d, 0x0c, 0x0c, 0x0d, 0x0d,
0x0e, 0x0e, 0x0f, 0x0f, 0x0e, 0x0e, 0x0f, 0x0f,
0x0c, 0x0c, 0x0d, 0x0d, 0x0c, 0x0c, 0x0d, 0x0d,
0x0e, 0x0e, 0x0f, 0x0f, 0x0e, 0x0e, 0x0f, 0x0f
};
/**
* nand_calculate_ecc - [NAND Interface] Calculate 3-byte ECC for 256/512-byte
* block
* @mtd: MTD block structure
* @buf: input buffer with raw data
* @code: output buffer with ECC
*/
int nand_calculate_ecc(struct mtd_info *mtd, const unsigned char *buf,
unsigned char *code)
{
int i;
const uint32_t *bp = (uint32_t *)buf;
/* 256 or 512 bytes/ecc */
const uint32_t eccsize_mult =
(((struct nand_chip *)mtd->priv)->ecc.size) >> 8;
uint32_t cur; /* current value in buffer */
/* rp0..rp15..rp17 are the various accumulated parities (per byte) */
uint32_t rp0, rp1, rp2, rp3, rp4, rp5, rp6, rp7;
uint32_t rp8, rp9, rp10, rp11, rp12, rp13, rp14, rp15, rp16;
uint32_t uninitialized_var(rp17); /* to make compiler happy */
uint32_t par; /* the cumulative parity for all data */
uint32_t tmppar; /* the cumulative parity for this iteration;
for rp12, rp14 and rp16 at the end of the
loop */
par = 0;
rp4 = 0;
rp6 = 0;
rp8 = 0;
rp10 = 0;
rp12 = 0;
rp14 = 0;
rp16 = 0;
/*
* The loop is unrolled a number of times;
* This avoids if statements to decide on which rp value to update
* Also we process the data by longwords.
* Note: passing unaligned data might give a performance penalty.
* It is assumed that the buffers are aligned.
* tmppar is the cumulative sum of this iteration.
* needed for calculating rp12, rp14, rp16 and par
* also used as a performance improvement for rp6, rp8 and rp10
*/
for (i = 0; i < eccsize_mult << 2; i++) {
cur = *bp++;
tmppar = cur;
rp4 ^= cur;
cur = *bp++;
tmppar ^= cur;
rp6 ^= tmppar;
cur = *bp++;
tmppar ^= cur;
rp4 ^= cur;
cur = *bp++;
tmppar ^= cur;
rp8 ^= tmppar;
cur = *bp++;
tmppar ^= cur;
rp4 ^= cur;
rp6 ^= cur;
cur = *bp++;
tmppar ^= cur;
rp6 ^= cur;
cur = *bp++;
tmppar ^= cur;
rp4 ^= cur;
cur = *bp++;
tmppar ^= cur;
rp10 ^= tmppar;
cur = *bp++;
tmppar ^= cur;
rp4 ^= cur;
rp6 ^= cur;
rp8 ^= cur;
cur = *bp++;
tmppar ^= cur;
rp6 ^= cur;
rp8 ^= cur;
cur = *bp++;
tmppar ^= cur;
rp4 ^= cur;
rp8 ^= cur;
cur = *bp++;
tmppar ^= cur;
rp8 ^= cur;
cur = *bp++;
tmppar ^= cur;
rp4 ^= cur;
rp6 ^= cur;
cur = *bp++;
tmppar ^= cur;
rp6 ^= cur;
cur = *bp++;
tmppar ^= cur;
rp4 ^= cur;
cur = *bp++;
tmppar ^= cur;
par ^= tmppar;
if ((i & 0x1) == 0)
rp12 ^= tmppar;
if ((i & 0x2) == 0)
rp14 ^= tmppar;
if (eccsize_mult == 2 && (i & 0x4) == 0)
rp16 ^= tmppar;
}
/*
* handle the fact that we use longword operations
* we'll bring rp4..rp14..rp16 back to single byte entities by
* shifting and xoring first fold the upper and lower 16 bits,
* then the upper and lower 8 bits.
*/
rp4 ^= (rp4 >> 16);
rp4 ^= (rp4 >> 8);
rp4 &= 0xff;
rp6 ^= (rp6 >> 16);
rp6 ^= (rp6 >> 8);
rp6 &= 0xff;
rp8 ^= (rp8 >> 16);
rp8 ^= (rp8 >> 8);
rp8 &= 0xff;
rp10 ^= (rp10 >> 16);
rp10 ^= (rp10 >> 8);
rp10 &= 0xff;
rp12 ^= (rp12 >> 16);
rp12 ^= (rp12 >> 8);
rp12 &= 0xff;
rp14 ^= (rp14 >> 16);
rp14 ^= (rp14 >> 8);
rp14 &= 0xff;
if (eccsize_mult == 2) {
rp16 ^= (rp16 >> 16);
rp16 ^= (rp16 >> 8);
rp16 &= 0xff;
}
/*
* we also need to calculate the row parity for rp0..rp3
* This is present in par, because par is now
* rp3 rp3 rp2 rp2 in little endian and
* rp2 rp2 rp3 rp3 in big endian
* as well as
* rp1 rp0 rp1 rp0 in little endian and
* rp0 rp1 rp0 rp1 in big endian
* First calculate rp2 and rp3
*/
#ifdef __BIG_ENDIAN
rp2 = (par >> 16);
rp2 ^= (rp2 >> 8);
rp2 &= 0xff;
rp3 = par & 0xffff;
rp3 ^= (rp3 >> 8);
rp3 &= 0xff;
#else
rp3 = (par >> 16);
rp3 ^= (rp3 >> 8);
rp3 &= 0xff;
rp2 = par & 0xffff;
rp2 ^= (rp2 >> 8);
rp2 &= 0xff;
#endif
/* reduce par to 16 bits then calculate rp1 and rp0 */
par ^= (par >> 16);
#ifdef __BIG_ENDIAN
rp0 = (par >> 8) & 0xff;
rp1 = (par & 0xff);
#else
rp1 = (par >> 8) & 0xff;
rp0 = (par & 0xff);
#endif
/* finally reduce par to 8 bits */
par ^= (par >> 8);
par &= 0xff;
/*
* and calculate rp5..rp15..rp17
* note that par = rp4 ^ rp5 and due to the commutative property
* of the ^ operator we can say:
* rp5 = (par ^ rp4);
* The & 0xff seems superfluous, but benchmarking learned that
* leaving it out gives slightly worse results. No idea why, probably
* it has to do with the way the pipeline in pentium is organized.
*/
rp5 = (par ^ rp4) & 0xff;
rp7 = (par ^ rp6) & 0xff;
rp9 = (par ^ rp8) & 0xff;
rp11 = (par ^ rp10) & 0xff;
rp13 = (par ^ rp12) & 0xff;
rp15 = (par ^ rp14) & 0xff;
if (eccsize_mult == 2)
rp17 = (par ^ rp16) & 0xff;
/*
* Finally calculate the ecc bits.
* Again here it might seem that there are performance optimisations
* possible, but benchmarks showed that on the system this is developed
* the code below is the fastest
*/
#ifdef CONFIG_MTD_NAND_ECC_SMC
code[0] =
(invparity[rp7] << 7) |
(invparity[rp6] << 6) |
(invparity[rp5] << 5) |
(invparity[rp4] << 4) |
(invparity[rp3] << 3) |
(invparity[rp2] << 2) |
(invparity[rp1] << 1) |
(invparity[rp0]);
code[1] =
(invparity[rp15] << 7) |
(invparity[rp14] << 6) |
(invparity[rp13] << 5) |
(invparity[rp12] << 4) |
(invparity[rp11] << 3) |
(invparity[rp10] << 2) |
(invparity[rp9] << 1) |
(invparity[rp8]);
#else
code[1] =
(invparity[rp7] << 7) |
(invparity[rp6] << 6) |
(invparity[rp5] << 5) |
(invparity[rp4] << 4) |
(invparity[rp3] << 3) |
(invparity[rp2] << 2) |
(invparity[rp1] << 1) |
(invparity[rp0]);
code[0] =
(invparity[rp15] << 7) |
(invparity[rp14] << 6) |
(invparity[rp13] << 5) |
(invparity[rp12] << 4) |
(invparity[rp11] << 3) |
(invparity[rp10] << 2) |
(invparity[rp9] << 1) |
(invparity[rp8]);
#endif
if (eccsize_mult == 1)
code[2] =
(invparity[par & 0xf0] << 7) |
(invparity[par & 0x0f] << 6) |
(invparity[par & 0xcc] << 5) |
(invparity[par & 0x33] << 4) |
(invparity[par & 0xaa] << 3) |
(invparity[par & 0x55] << 2) |
3;
else
code[2] =
(invparity[par & 0xf0] << 7) |
(invparity[par & 0x0f] << 6) |
(invparity[par & 0xcc] << 5) |
(invparity[par & 0x33] << 4) |
(invparity[par & 0xaa] << 3) |
(invparity[par & 0x55] << 2) |
(invparity[rp17] << 1) |
(invparity[rp16] << 0);
return 0;
}
EXPORT_SYMBOL(nand_calculate_ecc);
/**
* __nand_correct_data - [NAND Interface] Detect and correct bit error(s)
* @buf: raw data read from the chip
* @read_ecc: ECC from the chip
* @calc_ecc: the ECC calculated from raw data
* @eccsize: data bytes per ecc step (256 or 512)
*
* Detect and correct a 1 bit error for eccsize byte block
*/
int __nand_correct_data(unsigned char *buf,
unsigned char *read_ecc, unsigned char *calc_ecc,
unsigned int eccsize)
{
unsigned char b0, b1, b2, bit_addr;
unsigned int byte_addr;
/* 256 or 512 bytes/ecc */
const uint32_t eccsize_mult = eccsize >> 8;
/*
* b0 to b2 indicate which bit is faulty (if any)
* we might need the xor result more than once,
* so keep them in a local var
*/
#ifdef CONFIG_MTD_NAND_ECC_SMC
b0 = read_ecc[0] ^ calc_ecc[0];
b1 = read_ecc[1] ^ calc_ecc[1];
#else
b0 = read_ecc[1] ^ calc_ecc[1];
b1 = read_ecc[0] ^ calc_ecc[0];
#endif
b2 = read_ecc[2] ^ calc_ecc[2];
/* check if there are any bitfaults */
/* repeated if statements are slightly more efficient than switch ... */
/* ordered in order of likelihood */
if ((b0 | b1 | b2) == 0)
return 0; /* no error */
if ((((b0 ^ (b0 >> 1)) & 0x55) == 0x55) &&
(((b1 ^ (b1 >> 1)) & 0x55) == 0x55) &&
((eccsize_mult == 1 && ((b2 ^ (b2 >> 1)) & 0x54) == 0x54) ||
(eccsize_mult == 2 && ((b2 ^ (b2 >> 1)) & 0x55) == 0x55))) {
/* single bit error */
/*
* rp17/rp15/13/11/9/7/5/3/1 indicate which byte is the faulty
* byte, cp 5/3/1 indicate the faulty bit.
* A lookup table (called addressbits) is used to filter
* the bits from the byte they are in.
* A marginal optimisation is possible by having three
* different lookup tables.
* One as we have now (for b0), one for b2
* (that would avoid the >> 1), and one for b1 (with all values
* << 4). However it was felt that introducing two more tables
* hardly justify the gain.
*
* The b2 shift is there to get rid of the lowest two bits.
* We could also do addressbits[b2] >> 1 but for the
* performace it does not make any difference
*/
if (eccsize_mult == 1)
byte_addr = (addressbits[b1] << 4) + addressbits[b0];
else
byte_addr = (addressbits[b2 & 0x3] << 8) +
(addressbits[b1] << 4) + addressbits[b0];
bit_addr = addressbits[b2 >> 2];
/* flip the bit */
buf[byte_addr] ^= (1 << bit_addr);
return 1;
}
/* count nr of bits; use table lookup, faster than calculating it */
if ((bitsperbyte[b0] + bitsperbyte[b1] + bitsperbyte[b2]) == 1)
return 1; /* error in ecc data; no action needed */
printk(KERN_ERR "uncorrectable error : ");
return -1;
}
EXPORT_SYMBOL(__nand_correct_data);
/**
* nand_correct_data - [NAND Interface] Detect and correct bit error(s)
* @mtd: MTD block structure
* @buf: raw data read from the chip
* @read_ecc: ECC from the chip
* @calc_ecc: the ECC calculated from raw data
*
* Detect and correct a 1 bit error for 256/512 byte block
*/
int nand_correct_data(struct mtd_info *mtd, unsigned char *buf,
unsigned char *read_ecc, unsigned char *calc_ecc)
{
return __nand_correct_data(buf, read_ecc, calc_ecc,
((struct nand_chip *)mtd->priv)->ecc.size);
}
EXPORT_SYMBOL(nand_correct_data);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Frans Meulenbroeks <[email protected]>");
MODULE_DESCRIPTION("Generic NAND ECC support");
| {
"pile_set_name": "Github"
} |
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace OpenMcdf.Extensions.OLEProperties
{
public class DictionaryEntry
{
private const int CP_WINUNICODE = 0x04B0;
int codePage;
public DictionaryEntry(int codePage)
{
this.codePage = codePage;
}
public uint PropertyIdentifier { get; set; }
public int Length { get; set; }
public String Name { get { return GetName(); } }
private byte[] nameBytes;
public void Read(BinaryReader br)
{
PropertyIdentifier = br.ReadUInt32();
Length = br.ReadInt32();
if (codePage != CP_WINUNICODE)
{
nameBytes = br.ReadBytes(Length);
}
else
{
nameBytes = br.ReadBytes(Length << 2);
int m = Length % 4;
if (m > 0)
br.ReadBytes(m);
}
}
public void Write(BinaryWriter bw)
{
bw.Write(PropertyIdentifier);
bw.Write(Length);
bw.Write(nameBytes);
//if (codePage == CP_WINUNICODE)
// int m = Length % 4;
//if (m > 0)
// for (int i = 0; i < m; i++)
// bw.Write((byte)m);
}
private string GetName()
{
return Encoding.GetEncoding(this.codePage).GetString(nameBytes);
}
}
}
| {
"pile_set_name": "Github"
} |
/*=============================================================================
Copyright (c) 2001-2013 Joel de Guzman
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(FUSION_DEQUE_TIE_01272013_1401)
#define FUSION_DEQUE_TIE_01272013_1401
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/container/deque/deque.hpp>
#if !defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
# include <boost/fusion/container/generation/detail/pp_deque_tie.hpp>
#else
///////////////////////////////////////////////////////////////////////////////
// C++11 variadic interface
///////////////////////////////////////////////////////////////////////////////
#include <boost/fusion/support/detail/as_fusion_element.hpp>
namespace boost { namespace fusion
{
struct void_;
namespace result_of
{
template <typename ...T>
struct deque_tie
{
typedef deque<T&...> type;
};
}
template <typename ...T>
BOOST_FUSION_GPU_ENABLED
inline deque<T&...>
deque_tie(T&... arg)
{
return deque<T&...>(arg...);
}
}}
#endif
#endif
| {
"pile_set_name": "Github"
} |
package testsupport.matchers;
import com.jnape.palatable.lambda.adt.These;
import com.jnape.palatable.lambda.adt.hlist.Tuple2;
import com.jnape.palatable.lambda.functor.builtin.State;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
import static com.jnape.palatable.lambda.adt.These.a;
import static com.jnape.palatable.lambda.adt.These.b;
import static com.jnape.palatable.lambda.adt.These.both;
import static com.jnape.palatable.lambda.io.IO.io;
import static org.hamcrest.Matchers.equalTo;
public final class StateMatcher<S, A> extends TypeSafeMatcher<State<S, A>> {
private final S initialState;
private final These<Matcher<? super A>, Matcher<? super S>> matchers;
private StateMatcher(S initialState, These<Matcher<? super A>, Matcher<? super S>> matchers) {
this.initialState = initialState;
this.matchers = matchers;
}
@Override
protected boolean matchesSafely(State<S, A> item) {
Tuple2<A, S> ran = item.run(initialState);
return matchers.match(a -> a.matches(ran._1()),
b -> b.matches(ran._2()),
ab -> ab._1().matches(ran._1()) && ab._2().matches(ran._2()));
}
@Override
public void describeTo(Description description) {
matchers.match(a -> io(() -> a.describeTo(description.appendText("Value matching "))),
b -> io(() -> b.describeTo(description.appendText("State matching "))),
ab -> io(() -> {
description.appendText("Value matching: ");
ab._1().describeTo(description);
description.appendText(" and state matching: ");
ab._2().describeTo(description);
}))
.unsafePerformIO();
}
@Override
protected void describeMismatchSafely(State<S, A> item, Description mismatchDescription) {
Tuple2<A, S> ran = item.run(initialState);
matchers.match(a -> io(() -> {
mismatchDescription.appendText("value matching ");
a.describeMismatch(ran._1(), mismatchDescription);
}),
b -> io(() -> {
mismatchDescription.appendText("state matching ");
b.describeMismatch(ran._2(), mismatchDescription);
}),
ab -> io(() -> {
mismatchDescription.appendText("value matching: ");
ab._1().describeMismatch(ran._1(), mismatchDescription);
mismatchDescription.appendText(" and state matching: ");
ab._2().describeMismatch(ran._2(), mismatchDescription);
}))
.unsafePerformIO();
}
public static <S, A> StateMatcher<S, A> whenRunWith(S initialState, Matcher<? super A> valueMatcher,
Matcher<? super S> stateMatcher) {
return new StateMatcher<>(initialState, both(valueMatcher, stateMatcher));
}
public static <S, A> StateMatcher<S, A> whenRun(S initialState, A value, S state) {
return whenRunWith(initialState, equalTo(value), equalTo(state));
}
public static <S, A> StateMatcher<S, A> whenExecutedWith(S initialState, Matcher<? super S> stateMatcher) {
return new StateMatcher<>(initialState, b(stateMatcher));
}
public static <S, A> StateMatcher<S, A> whenExecuted(S initialState, S state) {
return whenExecutedWith(initialState, equalTo(state));
}
public static <S, A> StateMatcher<S, A> whenEvaluatedWith(S initialState, Matcher<? super A> valueMatcher) {
return new StateMatcher<>(initialState, a(valueMatcher));
}
public static <S, A> StateMatcher<S, A> whenEvaluated(S initialState, A value) {
return whenEvaluatedWith(initialState, equalTo(value));
}
}
| {
"pile_set_name": "Github"
} |
/* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_COMPILER_XLA_STATUS_MACROS_H_
#define TENSORFLOW_COMPILER_XLA_STATUS_MACROS_H_
#include <memory>
#include <ostream> // NOLINT
#include <string>
#include <vector>
#include "tensorflow/compiler/xla/statusor.h"
#include "tensorflow/compiler/xla/types.h"
#include "tensorflow/core/lib/core/status.h"
#include "tensorflow/core/platform/logging.h"
#include "tensorflow/core/platform/macros.h"
namespace xla {
namespace status_macros {
// This is a useful error message when encountering XLA Compiler errors that
// could be handled with the non-strict AutoJit mode.
extern const char kPossibleAutoJitAlternative[];
// Stream object used to collect error messages in MAKE_ERROR macros
// or append error messages with APPEND_ERROR. It accepts any
// arguments with operator<< to build an error string, and then has an
// implicit cast operator to Status, which converts the
// logged string to a Status object and returns it, after logging the
// error. At least one call to operator<< is required; a compile time
// error will be generated if none are given. Errors will only be
// logged by default for certain status codes, as defined in
// IsLoggedByDefault. This class will give ERROR errors if you don't
// retrieve a Status exactly once before destruction.
//
// The class converts into an intermediate wrapper object
// MakeErrorStreamWithOutput to check that the error stream gets at least one
// item of input.
class MakeErrorStream {
public:
// Wrapper around MakeErrorStream that only allows for output. This
// is created as output of the first operator<< call on
// MakeErrorStream. The bare MakeErrorStream does not have a
// Status operator. The net effect of that is that you
// have to call operator<< at least once or else you'll get a
// compile time error.
class MakeErrorStreamWithOutput {
public:
explicit MakeErrorStreamWithOutput(MakeErrorStream* error_stream)
: wrapped_error_stream_(error_stream) {}
template <typename T>
MakeErrorStreamWithOutput& operator<<(const T& value) {
*wrapped_error_stream_ << value;
return *this;
}
// Implicit cast operators to Status and StatusOr.
// Exactly one of these must be called exactly once before destruction.
operator Status() { return wrapped_error_stream_->GetStatus(); }
template <typename T>
operator xla::StatusOr<T>() {
return wrapped_error_stream_->GetStatus();
}
private:
MakeErrorStream* wrapped_error_stream_;
TF_DISALLOW_COPY_AND_ASSIGN(MakeErrorStreamWithOutput);
};
// When starting from an existing error status, this determines whether we'll
// append or prepend to that status's error message.
enum PriorMessageHandling { kAppendToPriorMessage, kPrependToPriorMessage };
// Make an error with the given code.
template <typename ERROR_CODE_TYPE>
MakeErrorStream(const char* file, int line, ERROR_CODE_TYPE code)
: impl_(new Impl(file, line, code, this, true)) {}
template <typename T>
MakeErrorStreamWithOutput& operator<<(const T& value) {
CheckNotDone();
impl_->stream_ << value;
return impl_->make_error_stream_with_output_wrapper_;
}
// When this message is logged (see with_logging()), include the stack trace.
MakeErrorStream& with_log_stack_trace() {
impl_->should_log_stack_trace_ = true;
return *this;
}
// Adds RET_CHECK failure text to error message.
MakeErrorStreamWithOutput& add_ret_check_failure(const char* condition) {
return *this << "RET_CHECK failure (" << impl_->file_ << ":" << impl_->line_
<< ") " << condition << " ";
}
private:
class Impl {
public:
Impl(const char* file, int line, tensorflow::error::Code code,
MakeErrorStream* error_stream, bool is_logged_by_default = true);
Impl(const Status& status, PriorMessageHandling prior_message_handling,
const char* file, int line, MakeErrorStream* error_stream);
~Impl();
// This must be called exactly once before destruction.
Status GetStatus();
void CheckNotDone() const;
private:
const char* file_;
int line_;
tensorflow::error::Code code_;
PriorMessageHandling prior_message_handling_ = kAppendToPriorMessage;
string prior_message_;
bool is_done_; // true after Status object has been returned
std::ostringstream stream_;
bool should_log_;
int log_severity_;
bool should_log_stack_trace_;
// Wrapper around the MakeErrorStream object that has a
// Status conversion. The first << operator called on
// MakeErrorStream will return this object, and only this object
// can implicitly convert to Status. The net effect of
// this is that you'll get a compile time error if you call
// MAKE_ERROR etc. without adding any output.
MakeErrorStreamWithOutput make_error_stream_with_output_wrapper_;
friend class MakeErrorStream;
TF_DISALLOW_COPY_AND_ASSIGN(Impl);
};
void CheckNotDone() const;
// Returns the status. Used by MakeErrorStreamWithOutput.
Status GetStatus() const { return impl_->GetStatus(); }
// Store the actual data on the heap to reduce stack frame sizes.
std::unique_ptr<Impl> impl_;
TF_DISALLOW_COPY_AND_ASSIGN(MakeErrorStream);
};
// Provides a conversion to bool so that it can be used inside an if statement
// that declares a variable.
class StatusAdaptorForMacros {
public:
explicit StatusAdaptorForMacros(Status status) : status_(std::move(status)) {}
StatusAdaptorForMacros(const StatusAdaptorForMacros&) = delete;
StatusAdaptorForMacros& operator=(const StatusAdaptorForMacros&) = delete;
explicit operator bool() const { return TF_PREDICT_TRUE(status_.ok()); }
Status&& Consume() { return std::move(status_); }
private:
Status status_;
};
} // namespace status_macros
} // namespace xla
#define TF_RET_CHECK(condition) \
while (TF_PREDICT_FALSE(!(condition))) \
return xla::status_macros::MakeErrorStream(__FILE__, __LINE__, \
tensorflow::error::INTERNAL) \
.with_log_stack_trace() \
.add_ret_check_failure(#condition)
#endif // TENSORFLOW_COMPILER_XLA_STATUS_MACROS_H_
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 1999-2007 Apple Inc. All Rights Reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this
* file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
#ifdef __i386__
#include <mach/vm_param.h>
.text
.private_extern __a1a2_tramphead
.private_extern __a1a2_firsttramp
.private_extern __a1a2_nexttramp
.private_extern __a1a2_trampend
.align PAGE_SHIFT
__a1a2_tramphead:
popl %eax
andl $0xFFFFFFF8, %eax
subl $ PAGE_SIZE, %eax
movl 4(%esp), %ecx // self -> ecx
movl %ecx, 8(%esp) // ecx -> _cmd
movl (%eax), %ecx // blockPtr -> ecx
movl %ecx, 4(%esp) // ecx -> self
jmp *12(%ecx) // tail to block->invoke
.macro TrampolineEntry
call __a1a2_tramphead
nop
nop
nop
.endmacro
.align 5
__a1a2_firsttramp:
TrampolineEntry
__a1a2_nexttramp: // used to calculate size of each trampoline
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
TrampolineEntry
__a1a2_trampend:
#endif
| {
"pile_set_name": "Github"
} |
# Invalid query.
# =============
# This query cannot be run because of the following problems:
# * It contains a constraint type that can only be used internally (PathConstraintLoop)
| {
"pile_set_name": "Github"
} |
// Boost.Units - A C++ library for zero-overhead dimensional analysis and
// unit/quantity manipulation and conversion
//
// Copyright (C) 2003-2008 Matthias Christian Schabel
// Copyright (C) 2007-2008 Steven Watanabe
//
// 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_UNIT_SYSTEMS_METRIC_ANGSTROM_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_METRIC_ANGSTROM_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/units_fwd.hpp>
#include <boost/units/base_units/si/meter.hpp>
namespace boost {
namespace units {
namespace metric {
typedef scaled_base_unit<boost::units::si::meter_base_unit, scale<10, static_rational<-10> > > angstrom_base_unit;
}
template<>
struct base_unit_info<metric::angstrom_base_unit> {
static const char* name() { return("angstrom"); }
static const char* symbol() { return("A"); }
};
}
}
#endif // BOOST_UNIT_SYSTEMS_METRIC_ANGSTROM_HPP_INCLUDED
| {
"pile_set_name": "Github"
} |
# Event 518 - AudCaptureStream_StartStream
###### Version: 0
## Description
None
## Data Dictionary
|Standard Name|Field Name|Type|Description|Sample Value|
|---|---|---|---|---|
|TBD|object|Pointer|None|`None`|
|TBD|m_bEngineStarted|Boolean|None|`None`|
|TBD|hResult|UInt32|None|`None`|
## Tags
* etw_level_Informational
* etw_opcode_Stop
* etw_task_AudCaptureStream_StartStream | {
"pile_set_name": "Github"
} |
/*********************************************************************
* Filename: arcfour_test.c
* Author: Brad Conte (brad AT bradconte.com)
* Copyright:
* Disclaimer: This code is presented "as is" without any guarantees.
* Details: Performs known-answer tests on the corresponding ARCFOUR
implementation. These tests do not encompass the full
range of available test vectors, however, if the tests
pass it is very, very likely that the code is correct
and was compiled properly. This code also serves as
example usage of the functions.
*********************************************************************/
/*************************** HEADER FILES ***************************/
#include <stdio.h>
#include <memory.h>
#include "arcfour.h"
/*********************** FUNCTION DEFINITIONS ***********************/
int rc4_test()
{
BYTE state[256];
BYTE key[3][10] = {{"Key"}, {"Wiki"}, {"Secret"}};
BYTE stream[3][10] = {{0xEB,0x9F,0x77,0x81,0xB7,0x34,0xCA,0x72,0xA7,0x19},
{0x60,0x44,0xdb,0x6d,0x41,0xb7},
{0x04,0xd4,0x6b,0x05,0x3c,0xa8,0x7b,0x59}};
int stream_len[3] = {10,6,8};
BYTE buf[1024];
int idx;
int pass = 1;
// Only test the output stream. Note that the state can be reused.
for (idx = 0; idx < 3; idx++) {
arcfour_key_setup(state, key[idx], strlen(key[idx]));
arcfour_generate_stream(state, buf, stream_len[idx]);
pass = pass && !memcmp(stream[idx], buf, stream_len[idx]);
}
return(pass);
}
int main()
{
printf("ARCFOUR tests: %s\n", rc4_test() ? "SUCCEEDED" : "FAILED");
return(0);
}
| {
"pile_set_name": "Github"
} |
{% if status == "ok" %}
<div class="pf-c-alert pf-m-success pf-m-inline pf-m-fit-content">
<div class="pf-c-alert__icon" title="Task completed successfully">
<i class="fas fa-check-circle" aria-hidden="true"></i>
<p> {{ status | upper }}</p>
</div>
</div>
{% elif status == "failed" or status == "unreachable" %}
<div class="pf-c-alert pf-m-danger pf-m-inline pf-m-fit-content">
<div class="pf-c-alert__icon" title="Task completed with errors">
<i class="fas fa-exclamation-circle" aria-hidden="true"></i>
<p> {{ status | upper }}</p>
</div>
</div>
{% elif status == "ignored" %}
<div class="pf-c-alert pf-m-inline pf-m-fit-content">
<div class="pf-c-alert__icon" title="Task failed but errors were ignored">
<i class="fas fa-volume-mute" aria-hidden="true"></i>
<p> {{ status | upper }}</p>
</div>
</div>
{% elif status == "skipped" %}
<div class="pf-c-alert pf-m-inline pf-m-fit-content">
<div class="pf-c-alert__icon" title="Task was skipped">
<i class="fas fa-forward" aria-hidden="true"></i>
<p> {{ status | upper }}</p>
</div>
</div>
{% elif status == "changed" %}
<div class="pf-c-alert pf-m-warning pf-m-inline pf-m-fit-content">
<div class="pf-c-alert__icon" title="Task completed with changes">
<i class="fas fa-sync-alt" aria-hidden="true"></i>
<p> {{ status | upper }}</p>
</div>
</div>
{% else %}
<div class="pf-c-alert pf-m-warning pf-m-inline pf-m-fit-content">
<div class="pf-c-alert__icon" title="Task status is unknown">
<i class="fas fa-question-circle" aria-hidden="true"></i> {{ status | upper }}
<p> {{ status | upper }}</p>
</div>
</div>
{% endif %}
| {
"pile_set_name": "Github"
} |
import React from 'react';
import { shallow } from 'enzyme';
import { User } from 'src/core/users';
import UserCard from './user-card';
describe('views', () => {
describe('UserCard', () => {
let props;
let user;
beforeEach(() => {
user = new User({
id: 123,
followingsCount: 20,
followersCount: 40,
likesCount: 60,
trackCount: 80,
username: 'username'
});
props = {user};
});
function getWrapper() {
return shallow(
<UserCard {...props} />
);
}
it('should display username', () => {
expect(getWrapper().find('h1').text()).toBe(user.username);
});
it('should display trackCount label linked to user-tracks route', () => {
let label = getWrapper().find('.user-stats__label').at(0);
expect(label.prop('to')).toBe(`/users/${user.id}/tracks`);
});
it('should display FormattedInteger for trackCount', () => {
let formattedInteger = getWrapper().find('FormattedInteger').at(0);
expect(formattedInteger.prop('value')).toBe(user.trackCount);
});
it('should display likesCount label linked to user-likes route', () => {
let label = getWrapper().find('.user-stats__label').at(1);
expect(label.prop('to')).toBe(`/users/${user.id}/likes`);
});
it('should display FormattedInteger for likesCount', () => {
let formattedInteger = getWrapper().find('FormattedInteger').at(1);
expect(formattedInteger.prop('value')).toBe(user.likesCount);
});
it('should display followersCount label', () => {
let label = getWrapper().find('.user-stats__label').at(2);
expect(label.length).toBe(1);
});
it('should display FormattedInteger for followersCount', () => {
let formattedInteger = getWrapper().find('FormattedInteger').at(2);
expect(formattedInteger.prop('value')).toBe(user.followersCount);
});
it('should display followingsCount label', () => {
let label = getWrapper().find('.user-stats__label').at(3);
expect(label.length).toBe(1);
});
it('should display FormattedInteger for followingsCount', () => {
let formattedInteger = getWrapper().find('FormattedInteger').at(3);
expect(formattedInteger.prop('value')).toBe(user.followingsCount);
});
});
});
| {
"pile_set_name": "Github"
} |
//
// Generated by class-dump 3.5 (64 bit) (Debug version compiled Sep 17 2017 16:24:48).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard.
//
@class CBottleContact;
@protocol IBottleContactMgrExt
@optional
- (void)onNewBottleContact:(CBottleContact *)arg1;
- (void)onSyncBottleContactEnd;
- (void)onModifyBottleContact:(CBottleContact *)arg1;
@end
| {
"pile_set_name": "Github"
} |
sr:
seeds:
settings:
official_level_1_name: Званична позиција 1
official_level_2_name: Званична позиција 2
official_level_3_name: Званична позиција 3
official_level_4_name: Званична позиција 4
official_level_5_name: Званична позиција 5
geozones:
north_district: Северни дистрикт
west_district: Западни дистрикт
east_district: Источни дистрикт
central_district: Централни дистрикт
organizations:
human_rights: Људска Права
neighborhood_association: Комшијско удружење
categories:
associations: Удружење
culture: Култура
sports: Спортови
social_rights: Социјална Права
economy: Економија
employment: Запосленост
equity: Једнакост
sustainability: Одрживост
participation: Партиципација
mobility: Мобилност
media: Медији
health: Здравље
transparency: Транспарентност
security_emergencies: Сигурност и Хитни случајеви
environment: Околина
budgets:
budget: Партиципативни буџет
currency: '€'
groups:
all_city: Цео Град
districts: Дистрикти
valuator_groups:
culture_and_sports: Култура & Спортови
gender_and_diversity: Пол & Политика разлике
urban_development: Одрживи Урбани Развој
equity_and_employment: Једнакост & Запосленост
statuses:
studying_project: Проучавање пројекта
bidding: Лицитирање
executing_project: Извршавање пројекта
executed: Извршено
polls:
current_poll: "Тренутно Гласање"
current_poll_geozone_restricted: "Тренутно гласање ограничено по географској зони"
recounting_poll: "Пребројавање гласова"
expired_poll_without_stats: "Гласање истекло без статистике и резултата"
expired_poll_with_stats: "Гласање истекло са статистиком и резултатима"
| {
"pile_set_name": "Github"
} |
package com.escodro.search.model
/**
* UI representation of Task results.
*/
internal data class TaskSearch(
val id: Long = 0,
val completed: Boolean,
val title: String,
val categoryColor: Int?,
val isRepeating: Boolean
)
| {
"pile_set_name": "Github"
} |
{
"_from": "mkdirp@~0.5.1",
"_id": "[email protected]",
"_integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
"_location": "/mkdirp",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "mkdirp@~0.5.1",
"name": "mkdirp",
"escapedName": "mkdirp",
"rawSpec": "~0.5.1",
"saveSpec": null,
"fetchSpec": "~0.5.1"
},
"_requiredBy": [
"/",
"/cacache",
"/cmd-shim",
"/fstream",
"/move-concurrently",
"/move-concurrently/copy-concurrently",
"/node-gyp",
"/pacote/tar-fs",
"/standard/eslint",
"/standard/eslint/file-entry-cache/flat-cache/write",
"/tacks",
"/update-notifier/configstore"
],
"_resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"_shasum": "30057438eac6cf7f8c4767f38648d6697d75c903",
"_shrinkwrap": null,
"_spec": "mkdirp@~0.5.1",
"_where": "/Users/zkat/Documents/code/npm",
"author": {
"name": "James Halliday",
"email": "[email protected]",
"url": "http://substack.net"
},
"bin": {
"mkdirp": "bin/cmd.js"
},
"bugs": {
"url": "https://github.com/substack/node-mkdirp/issues"
},
"bundleDependencies": false,
"dependencies": {
"minimist": "0.0.8"
},
"deprecated": false,
"description": "Recursively mkdir, like `mkdir -p`",
"devDependencies": {
"mock-fs": "2 >=2.7.0",
"tap": "1"
},
"homepage": "https://github.com/substack/node-mkdirp#readme",
"keywords": [
"mkdir",
"directory"
],
"license": "MIT",
"main": "index.js",
"name": "mkdirp",
"optionalDependencies": {},
"peerDependencies": {},
"repository": {
"type": "git",
"url": "git+https://github.com/substack/node-mkdirp.git"
},
"scripts": {
"test": "tap test/*.js"
},
"version": "0.5.1"
}
| {
"pile_set_name": "Github"
} |
/*
tests/nested.cpp -- tests nested arrays and other fancy scalar types
Enoki is a C++ template library that enables transparent vectorization
of numerical kernels using SIMD instruction sets available on current
processor architectures.
Copyright (c) 2019 Wenzel Jakob <[email protected]>
All rights reserved. Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.
*/
#include "test.h"
ENOKI_TEST(test01_string) { /* Arrays can be instantiated for all sorts of types */
Array<std::string, 2> v1("Hello ", " How are ");
Array<std::string, 2> v2("world!", "you?");
assert(v1.x() == "Hello ");
assert(to_string(v1) == "[Hello , How are ]");
assert(to_string(v1 + v2) == "[Hello world!, How are you?]");
assert(hsum(v1 + v2) == "Hello world! How are you?");
assert(hsum(v1 + std::string("you!")) == "Hello you! How are you!");
}
ENOKI_TEST(test02_float_array) {
/* Value initialization */
Array<float, 4> a(1.f);
assert(to_string(a) == "[1, 1, 1, 1]");
/* Value initialization */
Array<float, 4> b(1.f, 2.f, 3.f, 4.f);
assert(to_string(b) == "[1, 2, 3, 4]");
assert(b.x() == 1.f && b.y() == 2.f && b.z() == 3.f && b.w() == 4.f);
/* Copy initialization */
Array<float, 4> c(b);
assert(to_string(c) == "[1, 2, 3, 4]");
/* Operations involving scalars (left) */
assert(to_string(c + 1.f) == "[2, 3, 4, 5]");
/* Operations involving scalars (right) */
assert(to_string(1.f + c) == "[2, 3, 4, 5]");
/* Binary operations */
assert(to_string(c + c) == "[2, 4, 6, 8]");
}
ENOKI_TEST(test03_floatref_array) {
float tmp1 = 1.f;
Array<float, 4> tmp2(1.f, 2.f, 3.f, 4.f);
/* Value initialization */
Array<float&, 4> a(tmp1, tmp1, tmp1, tmp1);
assert(to_string(a) == "[1, 1, 1, 1]");
a.x() = 2.f;
assert(to_string(a) == "[2, 2, 2, 2]");
/* Reference an existing array */
Array<float&, 4> b(tmp2);
assert(to_string(b) == "[1, 2, 3, 4]");
assert(to_string(a + b) == "[3, 4, 5, 6]");
/* .. and reference it once more */
Array<float&, 4> c(b);
/* Convert back into a regular array */
Array<float, 4> d(c);
assert(to_string(d) == "[1, 2, 3, 4]");
/* Operations involving scalars (left) */
assert(to_string(c + 1.f) == "[2, 3, 4, 5]");
/* Operations involving scalars (right) */
assert(to_string(1.f + c) == "[2, 3, 4, 5]");
/* Binary operations */
assert(to_string(c + c) == "[2, 4, 6, 8]");
assert(to_string(d + c) == "[2, 4, 6, 8]");
assert(to_string(c + d) == "[2, 4, 6, 8]");
c += c; c += d; c += 1.f;
assert(to_string(c) == "[4, 7, 10, 13]");
}
ENOKI_TEST(test04_array_of_arrays) {
using Vector4f = Array<float, 4>;
using Vector4fP = Array<Vector4f, 2>;
Vector4f a(1, 2, 3, 4);
Vector4f b(1, 1, 1, 1);
Vector4fP c(a, b);
assert(to_string(c) == "[[1, 1],\n [2, 1],\n [3, 1],\n [4, 1]]");
assert(to_string(c + c) == "[[2, 2],\n [4, 2],\n [6, 2],\n [8, 2]]");
assert(to_string(c + c.x()) == "[[2, 2],\n [4, 3],\n [6, 4],\n [8, 5]]");
assert(to_string(c + 1.f) == "[[2, 2],\n [3, 2],\n [4, 2],\n [5, 2]]");
assert(to_string(1.f + c) == "[[2, 2],\n [3, 2],\n [4, 2],\n [5, 2]]");
assert((std::is_same<value_t<Vector4fP>, Vector4f>::value));
assert((std::is_same<scalar_t<Vector4fP>, float>::value));
}
ENOKI_TEST(test05_mask_types) {
assert((std::is_same<mask_t<bool>, bool>::value));
assert((std::is_same<value_t<float>, float>::value));
assert((std::is_same<value_t<Array<float, 1>>, float>::value));
}
ENOKI_TEST(test06_nested_reductions) {
using FloatP = Array<float, 16>;
using IntP = Array<int, 16>;
using Vector3fP = Array<FloatP, 3>;
auto my_all = [](Vector3fP x) { return all(x > 4.f); };
auto my_none = [](Vector3fP x) { return none(x > 4.f); };
auto my_any = [](Vector3fP x) { return any(x > 4.f); };
auto my_count = [](Vector3fP x) { return count(x > 4.f); };
auto my_all_nested = [](Vector3fP x) { return all_nested(x > 4.f); };
auto my_none_nested = [](Vector3fP x) { return none_nested(x > 4.f); };
auto my_any_nested = [](Vector3fP x) { return any_nested(x > 4.f); };
auto my_count_nested = [](Vector3fP x) { return count_nested(x > 4.f); };
auto data =
Vector3fP(arange<FloatP>() + 0.f, arange<FloatP>() + 1.f,
arange<FloatP>() + 2.f);
auto to_string = [](auto value) {
std::ostringstream oss;
detail::print(oss, value, false, shape(value));
return oss.str();
};
auto str = [&](auto x) {
return to_string(select(reinterpret_array<mask_t<IntP>>(x), IntP(1), IntP(0)));
};
assert(str(my_all(data)) == "[0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]");
assert(str(my_none(data)) == "[1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]");
assert(str(my_any(data)) == "[0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]");
assert(to_string(my_count(data)) == "[0, 0, 0, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]");
assert(!my_all_nested(data));
assert(!my_none_nested(data));
assert(my_any_nested(data));
assert(my_count_nested(data) == 36);
}
| {
"pile_set_name": "Github"
} |
var fs = require("fs");
exports.FILES = [
"../lib/utils.js",
"../lib/ast.js",
"../lib/parse.js",
"../lib/transform.js",
"../lib/scope.js",
"../lib/output.js",
"../lib/compress.js",
"../lib/sourcemap.js",
"../lib/mozilla-ast.js",
"../lib/propmangle.js",
"../lib/minify.js",
"./exports.js",
].map(function(file) {
return require.resolve(file);
});
new Function("MOZ_SourceMap", "exports", function() {
var code = exports.FILES.map(function(file) {
return fs.readFileSync(file, "utf8");
});
code.push("exports.describe_ast = " + describe_ast.toString());
return code.join("\n\n");
}())(require("source-map"), exports);
function describe_ast() {
var out = OutputStream({ beautify: true });
function doitem(ctor) {
out.print("AST_" + ctor.TYPE);
var props = ctor.SELF_PROPS.filter(function(prop) {
return !/^\$/.test(prop);
});
if (props.length > 0) {
out.space();
out.with_parens(function() {
props.forEach(function(prop, i) {
if (i) out.space();
out.print(prop);
});
});
}
if (ctor.documentation) {
out.space();
out.print_string(ctor.documentation);
}
if (ctor.SUBCLASSES.length > 0) {
out.space();
out.with_block(function() {
ctor.SUBCLASSES.forEach(function(ctor, i) {
out.indent();
doitem(ctor);
out.newline();
});
});
}
};
doitem(AST_Node);
return out + "\n";
}
function infer_options(options) {
var result = exports.minify("", options);
return result.error && result.error.defs;
}
exports.default_options = function() {
var defs = {};
Object.keys(infer_options({ 0: 0 })).forEach(function(component) {
var options = {};
options[component] = { 0: 0 };
if (options = infer_options(options)) {
defs[component] = options;
}
});
return defs;
};
| {
"pile_set_name": "Github"
} |
[
{
"name": "Distrito Federal",
"code": "MX-DIF",
"subdivision": "federal district"
},
{
"name": "Aguascalientes",
"code": "MX-AGU",
"subdivision": "state"
},
{
"name": "Baja California",
"code": "MX-BCN",
"subdivision": "state"
},
{
"name": "Baja California Sur",
"code": "MX-BCS",
"subdivision": "state"
},
{
"name": "Campeche",
"code": "MX-CAM",
"subdivision": "state"
},
{
"name": "Chiapas",
"code": "MX-CHP",
"subdivision": "state"
},
{
"name": "Chihuahua",
"code": "MX-CHH",
"subdivision": "state"
},
{
"name": "Coahuila",
"code": "MX-COA",
"subdivision": "state"
},
{
"name": "Colima",
"code": "MX-COL",
"subdivision": "state"
},
{
"name": "Durango",
"code": "MX-DUR",
"subdivision": "state"
},
{
"name": "Guanajuato",
"code": "MX-GUA",
"subdivision": "state"
},
{
"name": "Guerrero",
"code": "MX-GRO",
"subdivision": "state"
},
{
"name": "Hidalgo",
"code": "MX-HID",
"subdivision": "state"
},
{
"name": "Jalisco",
"code": "MX-JAL",
"subdivision": "state"
},
{
"name": "Michoacán",
"code": "MX-MIC",
"subdivision": "state"
},
{
"name": "Morelos",
"code": "MX-MOR",
"subdivision": "state"
},
{
"name": "México",
"code": "MX-MEX",
"subdivision": "state"
},
{
"name": "Nayarit",
"code": "MX-NAY",
"subdivision": "state"
},
{
"name": "Nuevo León",
"code": "MX-NLE",
"subdivision": "state"
},
{
"name": "Oaxaca",
"code": "MX-OAX",
"subdivision": "state"
},
{
"name": "Puebla",
"code": "MX-PUE",
"subdivision": "state"
},
{
"name": "Querétaro",
"code": "MX-QUE",
"subdivision": "state"
},
{
"name": "Quintana Roo",
"code": "MX-ROO",
"subdivision": "state"
},
{
"name": "San Luis Potosí",
"code": "MX-SLP",
"subdivision": "state"
},
{
"name": "Sinaloa",
"code": "MX-SIN",
"subdivision": "state"
},
{
"name": "Sonora",
"code": "MX-SON",
"subdivision": "state"
},
{
"name": "Tabasco",
"code": "MX-TAB",
"subdivision": "state"
},
{
"name": "Tamaulipas",
"code": "MX-TAM",
"subdivision": "state"
},
{
"name": "Tlaxcala",
"code": "MX-TLA",
"subdivision": "state"
},
{
"name": "Veracruz",
"code": "MX-VER",
"subdivision": "state"
},
{
"name": "Yucatán",
"code": "MX-YUC",
"subdivision": "state"
},
{
"name": "Zacatecas",
"code": "MX-ZAC",
"subdivision": "state"
}
] | {
"pile_set_name": "Github"
} |
using System;
using System.Text;
using Xunit;
namespace SpanJson.Tests.Generated
{
public partial class UInt64Tests
{
[Fact]
public void SerializeDeserializeOverflowUtf8()
{
// ulong.MaxValue+1
Assert.Throws<OverflowException>(() => JsonSerializer.Generic.Utf8.Deserialize<UInt64>(Encoding.UTF8.GetBytes("18446744073709551616")));
}
[Fact]
public void SerializeDeserializeOverflowUtf16()
{
// ulong.MaxValue+1
Assert.Throws<OverflowException>(() => JsonSerializer.Generic.Utf16.Deserialize<UInt64>("18446744073709551616"));
}
}
}
| {
"pile_set_name": "Github"
} |
/*
Copyright 2014 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package runtime
import (
"fmt"
"io"
"reflect"
"k8s.io/apimachinery/pkg/conversion"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/errors"
)
// unsafeObjectConvertor implements ObjectConvertor using the unsafe conversion path.
type unsafeObjectConvertor struct {
*Scheme
}
var _ ObjectConvertor = unsafeObjectConvertor{}
// ConvertToVersion converts in to the provided outVersion without copying the input first, which
// is only safe if the output object is not mutated or reused.
func (c unsafeObjectConvertor) ConvertToVersion(in Object, outVersion GroupVersioner) (Object, error) {
return c.Scheme.UnsafeConvertToVersion(in, outVersion)
}
// UnsafeObjectConvertor performs object conversion without copying the object structure,
// for use when the converted object will not be reused or mutated. Primarily for use within
// versioned codecs, which use the external object for serialization but do not return it.
func UnsafeObjectConvertor(scheme *Scheme) ObjectConvertor {
return unsafeObjectConvertor{scheme}
}
// SetField puts the value of src, into fieldName, which must be a member of v.
// The value of src must be assignable to the field.
func SetField(src interface{}, v reflect.Value, fieldName string) error {
field := v.FieldByName(fieldName)
if !field.IsValid() {
return fmt.Errorf("couldn't find %v field in %T", fieldName, v.Interface())
}
srcValue := reflect.ValueOf(src)
if srcValue.Type().AssignableTo(field.Type()) {
field.Set(srcValue)
return nil
}
if srcValue.Type().ConvertibleTo(field.Type()) {
field.Set(srcValue.Convert(field.Type()))
return nil
}
return fmt.Errorf("couldn't assign/convert %v to %v", srcValue.Type(), field.Type())
}
// Field puts the value of fieldName, which must be a member of v, into dest,
// which must be a variable to which this field's value can be assigned.
func Field(v reflect.Value, fieldName string, dest interface{}) error {
field := v.FieldByName(fieldName)
if !field.IsValid() {
return fmt.Errorf("couldn't find %v field in %T", fieldName, v.Interface())
}
destValue, err := conversion.EnforcePtr(dest)
if err != nil {
return err
}
if field.Type().AssignableTo(destValue.Type()) {
destValue.Set(field)
return nil
}
if field.Type().ConvertibleTo(destValue.Type()) {
destValue.Set(field.Convert(destValue.Type()))
return nil
}
return fmt.Errorf("couldn't assign/convert %v to %v", field.Type(), destValue.Type())
}
// FieldPtr puts the address of fieldName, which must be a member of v,
// into dest, which must be an address of a variable to which this field's
// address can be assigned.
func FieldPtr(v reflect.Value, fieldName string, dest interface{}) error {
field := v.FieldByName(fieldName)
if !field.IsValid() {
return fmt.Errorf("couldn't find %v field in %T", fieldName, v.Interface())
}
v, err := conversion.EnforcePtr(dest)
if err != nil {
return err
}
field = field.Addr()
if field.Type().AssignableTo(v.Type()) {
v.Set(field)
return nil
}
if field.Type().ConvertibleTo(v.Type()) {
v.Set(field.Convert(v.Type()))
return nil
}
return fmt.Errorf("couldn't assign/convert %v to %v", field.Type(), v.Type())
}
// EncodeList ensures that each object in an array is converted to a Unknown{} in serialized form.
// TODO: accept a content type.
func EncodeList(e Encoder, objects []Object) error {
var errs []error
for i := range objects {
data, err := Encode(e, objects[i])
if err != nil {
errs = append(errs, err)
continue
}
// TODO: Set ContentEncoding and ContentType.
objects[i] = &Unknown{Raw: data}
}
return errors.NewAggregate(errs)
}
func decodeListItem(obj *Unknown, decoders []Decoder) (Object, error) {
for _, decoder := range decoders {
// TODO: Decode based on ContentType.
obj, err := Decode(decoder, obj.Raw)
if err != nil {
if IsNotRegisteredError(err) {
continue
}
return nil, err
}
return obj, nil
}
// could not decode, so leave the object as Unknown, but give the decoders the
// chance to set Unknown.TypeMeta if it is available.
for _, decoder := range decoders {
if err := DecodeInto(decoder, obj.Raw, obj); err == nil {
return obj, nil
}
}
return obj, nil
}
// DecodeList alters the list in place, attempting to decode any objects found in
// the list that have the Unknown type. Any errors that occur are returned
// after the entire list is processed. Decoders are tried in order.
func DecodeList(objects []Object, decoders ...Decoder) []error {
errs := []error(nil)
for i, obj := range objects {
switch t := obj.(type) {
case *Unknown:
decoded, err := decodeListItem(t, decoders)
if err != nil {
errs = append(errs, err)
break
}
objects[i] = decoded
}
}
return errs
}
// MultiObjectTyper returns the types of objects across multiple schemes in order.
type MultiObjectTyper []ObjectTyper
var _ ObjectTyper = MultiObjectTyper{}
func (m MultiObjectTyper) ObjectKinds(obj Object) (gvks []schema.GroupVersionKind, unversionedType bool, err error) {
for _, t := range m {
gvks, unversionedType, err = t.ObjectKinds(obj)
if err == nil {
return
}
}
return
}
func (m MultiObjectTyper) Recognizes(gvk schema.GroupVersionKind) bool {
for _, t := range m {
if t.Recognizes(gvk) {
return true
}
}
return false
}
// SetZeroValue would set the object of objPtr to zero value of its type.
func SetZeroValue(objPtr Object) error {
v, err := conversion.EnforcePtr(objPtr)
if err != nil {
return err
}
v.Set(reflect.Zero(v.Type()))
return nil
}
// DefaultFramer is valid for any stream that can read objects serially without
// any separation in the stream.
var DefaultFramer = defaultFramer{}
type defaultFramer struct{}
func (defaultFramer) NewFrameReader(r io.ReadCloser) io.ReadCloser { return r }
func (defaultFramer) NewFrameWriter(w io.Writer) io.Writer { return w }
// WithVersionEncoder serializes an object and ensures the GVK is set.
type WithVersionEncoder struct {
Version GroupVersioner
Encoder
ObjectTyper
}
// Encode does not do conversion. It sets the gvk during serialization.
func (e WithVersionEncoder) Encode(obj Object, stream io.Writer) error {
gvks, _, err := e.ObjectTyper.ObjectKinds(obj)
if err != nil {
if IsNotRegisteredError(err) {
return e.Encoder.Encode(obj, stream)
}
return err
}
kind := obj.GetObjectKind()
oldGVK := kind.GroupVersionKind()
gvk := gvks[0]
if e.Version != nil {
preferredGVK, ok := e.Version.KindForGroupVersionKinds(gvks)
if ok {
gvk = preferredGVK
}
}
kind.SetGroupVersionKind(gvk)
err = e.Encoder.Encode(obj, stream)
kind.SetGroupVersionKind(oldGVK)
return err
}
// WithoutVersionDecoder clears the group version kind of a deserialized object.
type WithoutVersionDecoder struct {
Decoder
}
// Decode does not do conversion. It removes the gvk during deserialization.
func (d WithoutVersionDecoder) Decode(data []byte, defaults *schema.GroupVersionKind, into Object) (Object, *schema.GroupVersionKind, error) {
obj, gvk, err := d.Decoder.Decode(data, defaults, into)
if obj != nil {
kind := obj.GetObjectKind()
// clearing the gvk is just a convention of a codec
kind.SetGroupVersionKind(schema.GroupVersionKind{})
}
return obj, gvk, err
}
| {
"pile_set_name": "Github"
} |
// Unity C# reference source
// Copyright (c) Unity Technologies. For terms of use, see
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
using UnityEngine;
namespace TreeEditor
{
public class TreeVertex
{
public Vector3 pos;
public Vector3 nor;
public Vector4 tangent = new Vector4(1, 0, 0, 1);
public Vector2 uv0;
public Vector2 uv1 = new Vector2(0, 0);
public Color color = new Color(0, 0, 0, 1);
public bool flag = false;
//
// Pack animation properties in color and uv1 channel
//
public void SetAnimationProperties(float primaryFactor, float secondaryFactor, float edgeFactor, float phase)
{
color.r = phase;
color.g = edgeFactor;
uv1.x = primaryFactor;
uv1.y = secondaryFactor;
}
public void SetAmbientOcclusion(float ao)
{
color.a = ao;
// scale animation props
}
public void Lerp4(TreeVertex[] tv, Vector2 factor)
{
pos = Vector3.Lerp(
Vector3.Lerp(tv[1].pos, tv[2].pos, factor.x),
Vector3.Lerp(tv[0].pos, tv[3].pos, factor.x),
factor.y);
nor = Vector3.Lerp(
Vector3.Lerp(tv[1].nor, tv[2].nor, factor.x),
Vector3.Lerp(tv[0].nor, tv[3].nor, factor.x),
factor.y).normalized;
tangent = Vector4.Lerp(
Vector4.Lerp(tv[1].tangent, tv[2].tangent, factor.x),
Vector4.Lerp(tv[0].tangent, tv[3].tangent, factor.x),
factor.y);
Vector3 tangentNormalized = (new Vector3(tangent.x, tangent.y, tangent.z));
tangentNormalized.Normalize();
tangent.x = tangentNormalized.x;
tangent.y = tangentNormalized.y;
tangent.z = tangentNormalized.z;
color = Color.Lerp(
Color.Lerp(tv[1].color, tv[2].color, factor.x),
Color.Lerp(tv[0].color, tv[3].color, factor.x),
factor.y);
}
}
}
| {
"pile_set_name": "Github"
} |
// (C) Copyright John Maddock 2001 - 2003.
// (C) Copyright David Abrahams 2002 - 2003.
// (C) Copyright Aleksey Gurtovoy 2002.
// 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)
// See http://www.boost.org for most recent version.
// CodeGear C++ compiler setup:
#if !defined( BOOST_WITH_CODEGEAR_WARNINGS )
// these warnings occur frequently in optimized template code
# pragma warn -8004 // var assigned value, but never used
# pragma warn -8008 // condition always true/false
# pragma warn -8066 // dead code can never execute
# pragma warn -8104 // static members with ctors not threadsafe
# pragma warn -8105 // reference member in class without ctors
#endif
//
// versions check:
// last known and checked version is 0x621
#if (__CODEGEARC__ > 0x621)
# if defined(BOOST_ASSERT_CONFIG)
# error "Unknown compiler version - please run the configure tests and report the results"
# else
# pragma message( "Unknown compiler version - please run the configure tests and report the results")
# endif
#endif
// CodeGear C++ Builder 2009
#if (__CODEGEARC__ <= 0x613)
# define BOOST_NO_INTEGRAL_INT64_T
# define BOOST_NO_DEPENDENT_NESTED_DERIVATIONS
# define BOOST_NO_PRIVATE_IN_AGGREGATE
# define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE
// we shouldn't really need this - but too many things choke
// without it, this needs more investigation:
# define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
# define BOOST_SP_NO_SP_CONVERTIBLE
#endif
// CodeGear C++ Builder 2010
#if (__CODEGEARC__ <= 0x621)
# define BOOST_NO_TYPENAME_WITH_CTOR // Cannot use typename keyword when making temporaries of a dependant type
# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
# define BOOST_NO_NESTED_FRIENDSHIP // TC1 gives nested classes access rights as any other member
# define BOOST_NO_USING_TEMPLATE
# define BOOST_NO_TWO_PHASE_NAME_LOOKUP
// Temporary hack, until specific MPL preprocessed headers are generated
# define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
// CodeGear has not yet completely implemented value-initialization, for
// example for array types, as I reported in 2010: Embarcadero Report 83751,
// "Value-initialization: arrays should have each element value-initialized",
// http://qc.embarcadero.com/wc/qcmain.aspx?d=83751
// Last checked version: Embarcadero C++ 6.21
// See also: http://www.boost.org/libs/utility/value_init.htm#compiler_issues
// (Niels Dekker, LKEB, April 2010)
# define BOOST_NO_COMPLETE_VALUE_INITIALIZATION
# if defined(NDEBUG) && defined(__cplusplus)
// fix broken <cstring> so that Boost.test works:
# include <cstring>
# undef strcmp
# endif
// fix broken errno declaration:
# include <errno.h>
# ifndef errno
# define errno errno
# endif
#endif
// Reportedly, #pragma once is supported since C++ Builder 2010
#if (__CODEGEARC__ >= 0x620)
# define BOOST_HAS_PRAGMA_ONCE
#endif
//
// C++0x macros:
//
#if (__CODEGEARC__ <= 0x620)
#define BOOST_NO_CXX11_STATIC_ASSERT
#else
#define BOOST_HAS_STATIC_ASSERT
#endif
#define BOOST_HAS_CHAR16_T
#define BOOST_HAS_CHAR32_T
#define BOOST_HAS_LONG_LONG
// #define BOOST_HAS_ALIGNOF
#define BOOST_HAS_DECLTYPE
#define BOOST_HAS_EXPLICIT_CONVERSION_OPS
// #define BOOST_HAS_RVALUE_REFS
#define BOOST_HAS_SCOPED_ENUM
// #define BOOST_HAS_STATIC_ASSERT
#define BOOST_HAS_STD_TYPE_TRAITS
#define BOOST_NO_CXX11_AUTO_DECLARATIONS
#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
#define BOOST_NO_CXX11_CONSTEXPR
#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
#define BOOST_NO_CXX11_DELETED_FUNCTIONS
#define BOOST_NO_CXX11_EXTERN_TEMPLATE
#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
#define BOOST_NO_CXX11_LAMBDAS
#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
#define BOOST_NO_CXX11_NOEXCEPT
#define BOOST_NO_CXX11_NULLPTR
#define BOOST_NO_CXX11_RANGE_BASED_FOR
#define BOOST_NO_CXX11_RAW_LITERALS
#define BOOST_NO_CXX11_RVALUE_REFERENCES
#define BOOST_NO_SFINAE_EXPR
#define BOOST_NO_CXX11_TEMPLATE_ALIASES
#define BOOST_NO_CXX11_UNICODE_LITERALS
#define BOOST_NO_CXX11_VARIADIC_TEMPLATES
#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
#define BOOST_NO_CXX11_USER_DEFINED_LITERALS
#define BOOST_NO_CXX11_ALIGNAS
#define BOOST_NO_CXX11_TRAILING_RESULT_TYPES
#define BOOST_NO_CXX11_INLINE_NAMESPACES
#define BOOST_NO_CXX11_REF_QUALIFIERS
#define BOOST_NO_CXX11_FINAL
// C++ 14:
#if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304)
# define BOOST_NO_CXX14_AGGREGATE_NSDMI
#endif
#if !defined(__cpp_binary_literals) || (__cpp_binary_literals < 201304)
# define BOOST_NO_CXX14_BINARY_LITERALS
#endif
#if !defined(__cpp_constexpr) || (__cpp_constexpr < 201304)
# define BOOST_NO_CXX14_CONSTEXPR
#endif
#if !defined(__cpp_decltype_auto) || (__cpp_decltype_auto < 201304)
# define BOOST_NO_CXX14_DECLTYPE_AUTO
#endif
#if (__cplusplus < 201304) // There's no SD6 check for this....
# define BOOST_NO_CXX14_DIGIT_SEPARATORS
#endif
#if !defined(__cpp_generic_lambdas) || (__cpp_generic_lambdas < 201304)
# define BOOST_NO_CXX14_GENERIC_LAMBDAS
#endif
#if !defined(__cpp_init_captures) || (__cpp_init_captures < 201304)
# define BOOST_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES
#endif
#if !defined(__cpp_return_type_deduction) || (__cpp_return_type_deduction < 201304)
# define BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION
#endif
#if !defined(__cpp_variable_templates) || (__cpp_variable_templates < 201304)
# define BOOST_NO_CXX14_VARIABLE_TEMPLATES
#endif
//
// TR1 macros:
//
#define BOOST_HAS_TR1_HASH
#define BOOST_HAS_TR1_TYPE_TRAITS
#define BOOST_HAS_TR1_UNORDERED_MAP
#define BOOST_HAS_TR1_UNORDERED_SET
#define BOOST_HAS_MACRO_USE_FACET
#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
// On non-Win32 platforms let the platform config figure this out:
#ifdef _WIN32
# define BOOST_HAS_STDINT_H
#endif
//
// __int64:
//
#if !defined(__STRICT_ANSI__)
# define BOOST_HAS_MS_INT64
#endif
//
// check for exception handling support:
//
#if !defined(_CPPUNWIND) && !defined(BOOST_CPPUNWIND) && !defined(__EXCEPTIONS) && !defined(BOOST_NO_EXCEPTIONS)
# define BOOST_NO_EXCEPTIONS
#endif
//
// all versions have a <dirent.h>:
//
#if !defined(__STRICT_ANSI__)
# define BOOST_HAS_DIRENT_H
#endif
//
// all versions support __declspec:
//
#if defined(__STRICT_ANSI__)
// config/platform/win32.hpp will define BOOST_SYMBOL_EXPORT, etc., unless already defined
# define BOOST_SYMBOL_EXPORT
#endif
//
// ABI fixing headers:
//
#ifndef BOOST_ABI_PREFIX
# define BOOST_ABI_PREFIX "boost/config/abi/borland_prefix.hpp"
#endif
#ifndef BOOST_ABI_SUFFIX
# define BOOST_ABI_SUFFIX "boost/config/abi/borland_suffix.hpp"
#endif
//
// Disable Win32 support in ANSI mode:
//
# pragma defineonoption BOOST_DISABLE_WIN32 -A
//
// MSVC compatibility mode does some nasty things:
// TODO: look up if this doesn't apply to the whole 12xx range
//
#if defined(_MSC_VER) && (_MSC_VER <= 1200)
# define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
# define BOOST_NO_VOID_RETURNS
#endif
#define BOOST_COMPILER "CodeGear C++ version " BOOST_STRINGIZE(__CODEGEARC__)
| {
"pile_set_name": "Github"
} |
/*******************************************************************************
* Copyright 2016-2019 Francesco Benincasa ([email protected])
*
* 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 sqlite.feature.rx.persistence;
import com.abubusoft.kripton.android.annotation.BindSqlDelete;
import com.abubusoft.kripton.android.annotation.BindSqlInsert;
import com.abubusoft.kripton.android.annotation.BindSqlSelect;
import com.abubusoft.kripton.android.sqlite.ConflictAlgorithmType;
// TODO: Auto-generated Javadoc
/**
* The Interface AbstractDao.
*
* @param <E> the element type
*/
public interface AbstractDao<E> {
/**
* Insert.
*
* @param bean the bean
* @return the int
*/
@BindSqlInsert(conflictAlgorithm = ConflictAlgorithmType.REPLACE)
int insert(E bean);
/**
* Select by id.
*
* @param id the id
* @return the e
*/
@BindSqlSelect(where = "id = ${id}")
E selectById(long id);
/**
* Delete by id.
*
* @param id the id
* @return true, if successful
*/
@BindSqlDelete(where ="id = ${id}")
boolean deleteById(long id);
/**
* Update by id.
*
* @param bean the bean
* @return true, if successful
*/
@BindSqlDelete(where ="id = ${bean.id}")
boolean updateById(E bean);
}
| {
"pile_set_name": "Github"
} |
#ifndef TOUCH_TO_STRETCH_H
#define TOUCH_TO_STRETCH_H
#ifdef __cplusplus
extern "C" {
#endif
#include "STTypes.h"
typedef void STPrivData;
typedef struct RunParameter_s
{
int VoiceChangeFlag;
int sample_rate;
int channel_number;
float tempoDelta;//'t=xx'[-60.0 60.0]
float pitchDelta;//'p=xx'[-95.0 5000.0]
float rateDelta;//'r=xx'[-95.0 5000.0]
int quick;//'q','-quick'
int noAntiAlias;//'n','-naa'
float goalBPM;//'b','bpm=xx'
int detectBPM;//'b,'bpm=xx'
int speech;//'s','-speech'
}RunParameters;
typedef enum SetParam_{
ALL,
TEMPO,
PITCH,
VPS,
}SetParam;
void RunParameters_RunParameters(RunParameters *params);
void RunParameters_checkLimits(RunParameters *params);
void setupSoundTouch(STPrivData* priv_data, const RunParameters *params, SetParam para);
//void processSoundTouch( FILE *inFile, FILE *outFile, const RunParameters *params);
int processSoundTouch( SAMPLETYPE *inbufer, SAMPLETYPE *outbuffer, int nSamples,STPrivData* priv_data);
void* SouchTouchInit();
void SouchTouchDestroy(STPrivData* priv_data);
#ifdef __cplusplus
}
#endif
#endif//TOUCH_TO_STRETCH_H
| {
"pile_set_name": "Github"
} |
SUMMARY="A Just-In-Time Compiler (JIT) for the Lua programming language"
DESCRIPTION="Lua is a powerful, dynamic and light-weight programming \
language. It may be embedded or used as a general-purpose, stand-alone \
language. LuaJIT is a Just-In-Time Compiler (JIT) for it."
HOMEPAGE="https://luajit.org/luajit.html"
COPYRIGHT="2005-2015 Mike Pall"
LICENSE="MIT"
REVISION="2"
SOURCE_URI="https://luajit.org/download/LuaJIT-2.1.0-beta3.tar.gz"
CHECKSUM_SHA256="1ad2e34b111c802f9d0cdf019e986909123237a28c746b21295b63c9e785d9c3"
SOURCE_DIR="LuaJIT-2.1.0-beta3"
ARCHITECTURES="x86 !x86_64 !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
luajit$secondaryArchSuffix = $portVersion
cmd:luajit$secondaryArchSuffix
cmd:luajit_${portVersion/\~/_}$secondaryArchSuffix
lib:libluajit_5.1$secondaryArchSuffix = $portVersion compat >= 2
"
REQUIRES="
haiku$secondaryArchSuffix
"
PROVIDES_devel="
luajit${secondaryArchSuffix}_devel = $portVersion
devel:libluajit_5.1$secondaryArchSuffix = $portVersion compat >= 2
"
REQUIRES_devel="
luajit$secondaryArchSuffix == $portVersion base
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
"
BUILD_PREREQUIRES="
cmd:gcc$secondaryArchSuffix
cmd:make
"
BUILD()
{
# Use amalg target as recommended on luajit homepage to get better performance
make $jobArgs amalg PREFIX=$prefix
}
INSTALL()
{
make install PREFIX=$prefix INSTALL_LIB="$libDir" INSTALL_BIN="$binDir" \
INSTALL_INC="$includeDir" INSTALL_SHARE="$dataDir" \
INSTALL_MAN="$manDir/man1" INSTALL_LMOD="$dataDir/lua/5.1"
ln -sr $libDir/libluajit-5.1.so.2.1.0 $libDir/libluajit-5.1.so.2
# the pkg-config is for 5.1 compat
mkdir -p $libDir/pkgconfig
cp etc/luajit.pc $libDir/pkgconfig/luajit.pc
prepareInstalledDevelLib libluajit-5.1
fixPkgconfig
packageEntries devel $developDir
}
| {
"pile_set_name": "Github"
} |
register_checker("Username_Checker")
begin
require "levenshtein"
rescue LoadError
# catch error and prodive feedback on installing gem
puts "\nError: levenshtein gem not installed\n"
puts "\t use: \"gem install levenshtein-ffi\" to install the required gem\n\n"
exit
end
class Username_Checker < Checker
def initialize
super
@exact_matches_name = []
@lev_matches_name = []
@lev_total_name = 0
@lev_tolerance = 3
@ignore_cap = false
@description = "Compare usernames to passwords."
@cli_params = [
['--username.lev_tolerance', GetoptLong::REQUIRED_ARGUMENT],
['--username.ignore_cap', GetoptLong::NO_ARGUMENT]
]
end
def parse_params opts
opts.each do |opt, arg|
case opt
when '--username.ignore_cap'
@ignore_cap = true
when '--username.lev_tolerance'
if arg =~ /^[0-9]*$/
@lev_tolerance = arg.to_i
if @lev_tolerance <= 0
puts"\nUsername Checker: Please enter a positive distance\n\n"
exit 1
end
else
puts"\nUsername Checker: Invalid Levenshtein tolerance\n\n"
exit 1
end
end
end
end
def check_it (password, value)
puts "Checking #{value} against #{password}" if @verbose
if password == value
puts "Exact match" if @verbose
return {"distance" => 0, "value" => value, "password" => password}
else
dist = Levenshtein.distance(password, value)
puts "Lev distance #{dist}#" if @verbose
return {"distance" => dist, "value" => value, "password" => password}
end
return nil
end
def process_word (password, extras)
if extras.has_key?("username")
username = extras['username']
res = check_it(password, username)
unless res.nil?
if res['distance'] == 0
data = {"name" => username}
unless @exact_matches_name.include? data
@exact_matches_name << data
end
else
@lev_total_name += res["distance"]
if res["distance"] <= @lev_tolerance and not (@lev_matches_name.include? res)
@lev_matches_name << res
end
end
end
end
@total_words_processed += 1
end
def get_results()
ret_str = "Username Checker\n"
ret_str << "================\n\n"
ret_str << "Exact Matches\n"
ret_str << "-------------\n"
if @exact_matches_name.count > 0
ret_str << "Total: #{@exact_matches_name.count.to_s} Unique\n\n"
# Need to sort this then have it obey the cap_at value (if not ignored)
if @ignore_cap
@cap_at = @exact_matches_name.count
end
@exact_matches_name.sort{|a,b| (a['name'] <=> b['name'])}[0, @cap_at].each do |match|
ret_str << "#{match['name']}\n"
end
else
ret_str << "No Exact Matches\n"
end
ret_str << "\nLevenshtein Results\n"
ret_str << "-------------------\n"
lev_average = (@lev_total_name.to_f / @total_words_processed).round(2)
ret_str << "Average distance #{lev_average}\n"
ret_str << "\nClose Matches\n"
ret_str << "-------------\n"
if @ignore_cap
@cap_at = @lev_matches_name.count
end
if @lev_matches_name.count > 0
ret_str << "Total: #{@lev_matches_name.count.to_s} Unique\n\n"
@lev_matches_name.sort{|a,b| (a['distance'] <=> b['distance'])}[0, @cap_at].each do |user_pass|
ret_str << "D: #{user_pass['distance']} U: #{user_pass['value']} P: #{user_pass['password']}\n"
end
else
ret_str << "No matches within supplied tolerance\n"
end
return ret_str
end
end
| {
"pile_set_name": "Github"
} |
// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("WiX Toolset Dependency Extension")]
[assembly: AssemblyDescription("WiX Toolset Dependency Extension")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
| {
"pile_set_name": "Github"
} |
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "result", Namespace = "")]
public class SearchResult
{
[DataMember(Name = "id")]
public string Id { get; set; }
[DataMember(Name = "score")]
public float Score { get; set; }
[DataMember(Name = "fieldCount")]
public int FieldCount => Values?.Count ?? 0;
[DataMember(Name = "values")]
public IReadOnlyDictionary<string, string> Values { get; set; }
}
}
| {
"pile_set_name": "Github"
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
namespace NSwag.Demo.Web.Controllers
{
public class BodyParameter
{
public string Foo { get; set; }
public string Bar { get; set; }
}
public class BodyInputController : ApiController
{
[HttpPost]
public void ObjectBody(BodyParameter body)
{
}
[HttpPost]
public void ArrayBody(BodyParameter[] body)
{
}
[HttpPost]
public void DictionaryBody(Dictionary<string, BodyParameter> body)
{
}
}
} | {
"pile_set_name": "Github"
} |
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
// This source code is licensed under both the GPLv2 (found in the
// COPYING file in the root directory) and Apache 2.0 License
// (found in the LICENSE.Apache file in the root directory).
//
// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. See the AUTHORS file for names of contributors.
#ifdef ROCKSDB_LIB_IO_POSIX
#include "env/io_posix.h"
#include <errno.h>
#include <fcntl.h>
#include <algorithm>
#if defined(OS_LINUX)
#include <linux/fs.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#ifdef OS_LINUX
#include <sys/statfs.h>
#include <sys/syscall.h>
#include <sys/sysmacros.h>
#endif
#include "env/posix_logger.h"
#include "monitoring/iostats_context_imp.h"
#include "port/port.h"
#include "rocksdb/slice.h"
#include "util/coding.h"
#include "util/string_util.h"
#include "util/sync_point.h"
#if defined(OS_LINUX) && !defined(F_SET_RW_HINT)
#define F_LINUX_SPECIFIC_BASE 1024
#define F_SET_RW_HINT (F_LINUX_SPECIFIC_BASE + 12)
#endif
namespace rocksdb {
// A wrapper for fadvise, if the platform doesn't support fadvise,
// it will simply return 0.
int Fadvise(int fd, off_t offset, size_t len, int advice) {
#ifdef OS_LINUX
return posix_fadvise(fd, offset, len, advice);
#else
(void)fd;
(void)offset;
(void)len;
(void)advice;
return 0; // simply do nothing.
#endif
}
namespace {
size_t GetLogicalBufferSize(int __attribute__((__unused__)) fd) {
#ifdef OS_LINUX
struct stat buf;
int result = fstat(fd, &buf);
if (result == -1) {
return kDefaultPageSize;
}
if (major(buf.st_dev) == 0) {
// Unnamed devices (e.g. non-device mounts), reserved as null device number.
// These don't have an entry in /sys/dev/block/. Return a sensible default.
return kDefaultPageSize;
}
// Reading queue/logical_block_size does not require special permissions.
const int kBufferSize = 100;
char path[kBufferSize];
char real_path[PATH_MAX + 1];
snprintf(path, kBufferSize, "/sys/dev/block/%u:%u", major(buf.st_dev),
minor(buf.st_dev));
if (realpath(path, real_path) == nullptr) {
return kDefaultPageSize;
}
std::string device_dir(real_path);
if (!device_dir.empty() && device_dir.back() == '/') {
device_dir.pop_back();
}
// NOTE: sda3 and nvme0n1p1 do not have a `queue/` subdir, only the parent sda
// and nvme0n1 have it.
// $ ls -al '/sys/dev/block/8:3'
// lrwxrwxrwx. 1 root root 0 Jun 26 01:38 /sys/dev/block/8:3 ->
// ../../block/sda/sda3
// $ ls -al '/sys/dev/block/259:4'
// lrwxrwxrwx 1 root root 0 Jan 31 16:04 /sys/dev/block/259:4 ->
// ../../devices/pci0000:17/0000:17:00.0/0000:18:00.0/nvme/nvme0/nvme0n1/nvme0n1p1
size_t parent_end = device_dir.rfind('/', device_dir.length() - 1);
if (parent_end == std::string::npos) {
return kDefaultPageSize;
}
size_t parent_begin = device_dir.rfind('/', parent_end - 1);
if (parent_begin == std::string::npos) {
return kDefaultPageSize;
}
std::string parent =
device_dir.substr(parent_begin + 1, parent_end - parent_begin - 1);
std::string child = device_dir.substr(parent_end + 1, std::string::npos);
if (parent != "block" &&
(child.compare(0, 4, "nvme") || child.find('p') != std::string::npos)) {
device_dir = device_dir.substr(0, parent_end);
}
std::string fname = device_dir + "/queue/logical_block_size";
FILE* fp;
size_t size = 0;
fp = fopen(fname.c_str(), "r");
if (fp != nullptr) {
char* line = nullptr;
size_t len = 0;
if (getline(&line, &len, fp) != -1) {
sscanf(line, "%zu", &size);
}
free(line);
fclose(fp);
}
if (size != 0 && (size & (size - 1)) == 0) {
return size;
}
#endif
return kDefaultPageSize;
}
} // namespace
/*
* DirectIOHelper
*/
#ifndef NDEBUG
namespace {
bool IsSectorAligned(const size_t off, size_t sector_size) {
return off % sector_size == 0;
}
bool IsSectorAligned(const void* ptr, size_t sector_size) {
return uintptr_t(ptr) % sector_size == 0;
}
}
#endif
/*
* PosixSequentialFile
*/
PosixSequentialFile::PosixSequentialFile(const std::string& fname, FILE* file,
int fd, const EnvOptions& options)
: filename_(fname),
file_(file),
fd_(fd),
use_direct_io_(options.use_direct_reads),
logical_sector_size_(GetLogicalBufferSize(fd_)) {
assert(!options.use_direct_reads || !options.use_mmap_reads);
}
PosixSequentialFile::~PosixSequentialFile() {
if (!use_direct_io()) {
assert(file_);
fclose(file_);
} else {
assert(fd_);
close(fd_);
}
}
Status PosixSequentialFile::Read(size_t n, Slice* result, char* scratch) {
assert(result != nullptr && !use_direct_io());
Status s;
size_t r = 0;
do {
r = fread_unlocked(scratch, 1, n, file_);
} while (r == 0 && ferror(file_) && errno == EINTR);
*result = Slice(scratch, r);
if (r < n) {
if (feof(file_)) {
// We leave status as ok if we hit the end of the file
// We also clear the error so that the reads can continue
// if a new data is written to the file
clearerr(file_);
} else {
// A partial read with an error: return a non-ok status
s = IOError("While reading file sequentially", filename_, errno);
}
}
return s;
}
Status PosixSequentialFile::PositionedRead(uint64_t offset, size_t n,
Slice* result, char* scratch) {
assert(use_direct_io());
assert(IsSectorAligned(offset, GetRequiredBufferAlignment()));
assert(IsSectorAligned(n, GetRequiredBufferAlignment()));
assert(IsSectorAligned(scratch, GetRequiredBufferAlignment()));
Status s;
ssize_t r = -1;
size_t left = n;
char* ptr = scratch;
while (left > 0) {
r = pread(fd_, ptr, left, static_cast<off_t>(offset));
if (r <= 0) {
if (r == -1 && errno == EINTR) {
continue;
}
break;
}
ptr += r;
offset += r;
left -= r;
if (r % static_cast<ssize_t>(GetRequiredBufferAlignment()) != 0) {
// Bytes reads don't fill sectors. Should only happen at the end
// of the file.
break;
}
}
if (r < 0) {
// An error: return a non-ok status
s = IOError(
"While pread " + ToString(n) + " bytes from offset " + ToString(offset),
filename_, errno);
}
*result = Slice(scratch, (r < 0) ? 0 : n - left);
return s;
}
Status PosixSequentialFile::Skip(uint64_t n) {
if (fseek(file_, static_cast<long int>(n), SEEK_CUR)) {
return IOError("While fseek to skip " + ToString(n) + " bytes", filename_,
errno);
}
return Status::OK();
}
Status PosixSequentialFile::InvalidateCache(size_t offset, size_t length) {
#ifndef OS_LINUX
(void)offset;
(void)length;
return Status::OK();
#else
if (!use_direct_io()) {
// free OS pages
int ret = Fadvise(fd_, offset, length, POSIX_FADV_DONTNEED);
if (ret != 0) {
return IOError("While fadvise NotNeeded offset " + ToString(offset) +
" len " + ToString(length),
filename_, errno);
}
}
return Status::OK();
#endif
}
/*
* PosixRandomAccessFile
*/
#if defined(OS_LINUX)
size_t PosixHelper::GetUniqueIdFromFile(int fd, char* id, size_t max_size) {
if (max_size < kMaxVarint64Length * 3) {
return 0;
}
struct stat buf;
int result = fstat(fd, &buf);
assert(result != -1);
if (result == -1) {
return 0;
}
long version = 0;
result = ioctl(fd, FS_IOC_GETVERSION, &version);
TEST_SYNC_POINT_CALLBACK("GetUniqueIdFromFile:FS_IOC_GETVERSION", &result);
if (result == -1) {
return 0;
}
uint64_t uversion = (uint64_t)version;
char* rid = id;
rid = EncodeVarint64(rid, buf.st_dev);
rid = EncodeVarint64(rid, buf.st_ino);
rid = EncodeVarint64(rid, uversion);
assert(rid >= id);
return static_cast<size_t>(rid - id);
}
#endif
#if defined(OS_MACOSX) || defined(OS_AIX)
size_t PosixHelper::GetUniqueIdFromFile(int fd, char* id, size_t max_size) {
if (max_size < kMaxVarint64Length * 3) {
return 0;
}
struct stat buf;
int result = fstat(fd, &buf);
if (result == -1) {
return 0;
}
char* rid = id;
rid = EncodeVarint64(rid, buf.st_dev);
rid = EncodeVarint64(rid, buf.st_ino);
rid = EncodeVarint64(rid, buf.st_gen);
assert(rid >= id);
return static_cast<size_t>(rid - id);
}
#endif
/*
* PosixRandomAccessFile
*
* pread() based random-access
*/
PosixRandomAccessFile::PosixRandomAccessFile(const std::string& fname, int fd,
const EnvOptions& options)
: filename_(fname),
fd_(fd),
use_direct_io_(options.use_direct_reads),
logical_sector_size_(GetLogicalBufferSize(fd_)) {
assert(!options.use_direct_reads || !options.use_mmap_reads);
assert(!options.use_mmap_reads || sizeof(void*) < 8);
}
PosixRandomAccessFile::~PosixRandomAccessFile() { close(fd_); }
Status PosixRandomAccessFile::Read(uint64_t offset, size_t n, Slice* result,
char* scratch) const {
if (use_direct_io()) {
assert(IsSectorAligned(offset, GetRequiredBufferAlignment()));
assert(IsSectorAligned(n, GetRequiredBufferAlignment()));
assert(IsSectorAligned(scratch, GetRequiredBufferAlignment()));
}
Status s;
ssize_t r = -1;
size_t left = n;
char* ptr = scratch;
while (left > 0) {
r = pread(fd_, ptr, left, static_cast<off_t>(offset));
if (r <= 0) {
if (r == -1 && errno == EINTR) {
continue;
}
break;
}
ptr += r;
offset += r;
left -= r;
if (use_direct_io() &&
r % static_cast<ssize_t>(GetRequiredBufferAlignment()) != 0) {
// Bytes reads don't fill sectors. Should only happen at the end
// of the file.
break;
}
}
if (r < 0) {
// An error: return a non-ok status
s = IOError(
"While pread offset " + ToString(offset) + " len " + ToString(n),
filename_, errno);
}
*result = Slice(scratch, (r < 0) ? 0 : n - left);
return s;
}
Status PosixRandomAccessFile::Prefetch(uint64_t offset, size_t n) {
Status s;
if (!use_direct_io()) {
ssize_t r = 0;
#ifdef OS_LINUX
r = readahead(fd_, offset, n);
#endif
#ifdef OS_MACOSX
radvisory advice;
advice.ra_offset = static_cast<off_t>(offset);
advice.ra_count = static_cast<int>(n);
r = fcntl(fd_, F_RDADVISE, &advice);
#endif
if (r == -1) {
s = IOError("While prefetching offset " + ToString(offset) + " len " +
ToString(n),
filename_, errno);
}
}
return s;
}
#if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_AIX)
size_t PosixRandomAccessFile::GetUniqueId(char* id, size_t max_size) const {
return PosixHelper::GetUniqueIdFromFile(fd_, id, max_size);
}
#endif
void PosixRandomAccessFile::Hint(AccessPattern pattern) {
if (use_direct_io()) {
return;
}
switch (pattern) {
case NORMAL:
Fadvise(fd_, 0, 0, POSIX_FADV_NORMAL);
break;
case RANDOM:
Fadvise(fd_, 0, 0, POSIX_FADV_RANDOM);
break;
case SEQUENTIAL:
Fadvise(fd_, 0, 0, POSIX_FADV_SEQUENTIAL);
break;
case WILLNEED:
Fadvise(fd_, 0, 0, POSIX_FADV_WILLNEED);
break;
case DONTNEED:
Fadvise(fd_, 0, 0, POSIX_FADV_DONTNEED);
break;
default:
assert(false);
break;
}
}
Status PosixRandomAccessFile::InvalidateCache(size_t offset, size_t length) {
if (use_direct_io()) {
return Status::OK();
}
#ifndef OS_LINUX
(void)offset;
(void)length;
return Status::OK();
#else
// free OS pages
int ret = Fadvise(fd_, offset, length, POSIX_FADV_DONTNEED);
if (ret == 0) {
return Status::OK();
}
return IOError("While fadvise NotNeeded offset " + ToString(offset) +
" len " + ToString(length),
filename_, errno);
#endif
}
/*
* PosixMmapReadableFile
*
* mmap() based random-access
*/
// base[0,length-1] contains the mmapped contents of the file.
PosixMmapReadableFile::PosixMmapReadableFile(const int fd,
const std::string& fname,
void* base, size_t length,
const EnvOptions& options)
: fd_(fd), filename_(fname), mmapped_region_(base), length_(length) {
#ifdef NDEBUG
(void)options;
#endif
fd_ = fd_ + 0; // suppress the warning for used variables
assert(options.use_mmap_reads);
assert(!options.use_direct_reads);
}
PosixMmapReadableFile::~PosixMmapReadableFile() {
int ret = munmap(mmapped_region_, length_);
if (ret != 0) {
fprintf(stdout, "failed to munmap %p length %" ROCKSDB_PRIszt " \n",
mmapped_region_, length_);
}
close(fd_);
}
Status PosixMmapReadableFile::Read(uint64_t offset, size_t n, Slice* result,
char* /*scratch*/) const {
Status s;
if (offset > length_) {
*result = Slice();
return IOError("While mmap read offset " + ToString(offset) +
" larger than file length " + ToString(length_),
filename_, EINVAL);
} else if (offset + n > length_) {
n = static_cast<size_t>(length_ - offset);
}
*result = Slice(reinterpret_cast<char*>(mmapped_region_) + offset, n);
return s;
}
Status PosixMmapReadableFile::InvalidateCache(size_t offset, size_t length) {
#ifndef OS_LINUX
(void)offset;
(void)length;
return Status::OK();
#else
// free OS pages
int ret = Fadvise(fd_, offset, length, POSIX_FADV_DONTNEED);
if (ret == 0) {
return Status::OK();
}
return IOError("While fadvise not needed. Offset " + ToString(offset) +
" len" + ToString(length),
filename_, errno);
#endif
}
/*
* PosixMmapFile
*
* We preallocate up to an extra megabyte and use memcpy to append new
* data to the file. This is safe since we either properly close the
* file before reading from it, or for log files, the reading code
* knows enough to skip zero suffixes.
*/
Status PosixMmapFile::UnmapCurrentRegion() {
TEST_KILL_RANDOM("PosixMmapFile::UnmapCurrentRegion:0", rocksdb_kill_odds);
if (base_ != nullptr) {
int munmap_status = munmap(base_, limit_ - base_);
if (munmap_status != 0) {
return IOError("While munmap", filename_, munmap_status);
}
file_offset_ += limit_ - base_;
base_ = nullptr;
limit_ = nullptr;
last_sync_ = nullptr;
dst_ = nullptr;
// Increase the amount we map the next time, but capped at 1MB
if (map_size_ < (1 << 20)) {
map_size_ *= 2;
}
}
return Status::OK();
}
Status PosixMmapFile::MapNewRegion() {
#ifdef ROCKSDB_FALLOCATE_PRESENT
assert(base_ == nullptr);
TEST_KILL_RANDOM("PosixMmapFile::UnmapCurrentRegion:0", rocksdb_kill_odds);
// we can't fallocate with FALLOC_FL_KEEP_SIZE here
if (allow_fallocate_) {
IOSTATS_TIMER_GUARD(allocate_nanos);
int alloc_status = fallocate(fd_, 0, file_offset_, map_size_);
if (alloc_status != 0) {
// fallback to posix_fallocate
alloc_status = posix_fallocate(fd_, file_offset_, map_size_);
}
if (alloc_status != 0) {
return Status::IOError("Error allocating space to file : " + filename_ +
"Error : " + strerror(alloc_status));
}
}
TEST_KILL_RANDOM("PosixMmapFile::Append:1", rocksdb_kill_odds);
void* ptr = mmap(nullptr, map_size_, PROT_READ | PROT_WRITE, MAP_SHARED, fd_,
file_offset_);
if (ptr == MAP_FAILED) {
return Status::IOError("MMap failed on " + filename_);
}
TEST_KILL_RANDOM("PosixMmapFile::Append:2", rocksdb_kill_odds);
base_ = reinterpret_cast<char*>(ptr);
limit_ = base_ + map_size_;
dst_ = base_;
last_sync_ = base_;
return Status::OK();
#else
return Status::NotSupported("This platform doesn't support fallocate()");
#endif
}
Status PosixMmapFile::Msync() {
if (dst_ == last_sync_) {
return Status::OK();
}
// Find the beginnings of the pages that contain the first and last
// bytes to be synced.
size_t p1 = TruncateToPageBoundary(last_sync_ - base_);
size_t p2 = TruncateToPageBoundary(dst_ - base_ - 1);
last_sync_ = dst_;
TEST_KILL_RANDOM("PosixMmapFile::Msync:0", rocksdb_kill_odds);
if (msync(base_ + p1, p2 - p1 + page_size_, MS_SYNC) < 0) {
return IOError("While msync", filename_, errno);
}
return Status::OK();
}
PosixMmapFile::PosixMmapFile(const std::string& fname, int fd, size_t page_size,
const EnvOptions& options)
: filename_(fname),
fd_(fd),
page_size_(page_size),
map_size_(Roundup(65536, page_size)),
base_(nullptr),
limit_(nullptr),
dst_(nullptr),
last_sync_(nullptr),
file_offset_(0) {
#ifdef ROCKSDB_FALLOCATE_PRESENT
allow_fallocate_ = options.allow_fallocate;
fallocate_with_keep_size_ = options.fallocate_with_keep_size;
#else
(void)options;
#endif
assert((page_size & (page_size - 1)) == 0);
assert(options.use_mmap_writes);
assert(!options.use_direct_writes);
}
PosixMmapFile::~PosixMmapFile() {
if (fd_ >= 0) {
PosixMmapFile::Close();
}
}
Status PosixMmapFile::Append(const Slice& data) {
const char* src = data.data();
size_t left = data.size();
while (left > 0) {
assert(base_ <= dst_);
assert(dst_ <= limit_);
size_t avail = limit_ - dst_;
if (avail == 0) {
Status s = UnmapCurrentRegion();
if (!s.ok()) {
return s;
}
s = MapNewRegion();
if (!s.ok()) {
return s;
}
TEST_KILL_RANDOM("PosixMmapFile::Append:0", rocksdb_kill_odds);
}
size_t n = (left <= avail) ? left : avail;
assert(dst_);
memcpy(dst_, src, n);
dst_ += n;
src += n;
left -= n;
}
return Status::OK();
}
Status PosixMmapFile::Close() {
Status s;
size_t unused = limit_ - dst_;
s = UnmapCurrentRegion();
if (!s.ok()) {
s = IOError("While closing mmapped file", filename_, errno);
} else if (unused > 0) {
// Trim the extra space at the end of the file
if (ftruncate(fd_, file_offset_ - unused) < 0) {
s = IOError("While ftruncating mmaped file", filename_, errno);
}
}
if (close(fd_) < 0) {
if (s.ok()) {
s = IOError("While closing mmapped file", filename_, errno);
}
}
fd_ = -1;
base_ = nullptr;
limit_ = nullptr;
return s;
}
Status PosixMmapFile::Flush() { return Status::OK(); }
Status PosixMmapFile::Sync() {
if (fdatasync(fd_) < 0) {
return IOError("While fdatasync mmapped file", filename_, errno);
}
return Msync();
}
/**
* Flush data as well as metadata to stable storage.
*/
Status PosixMmapFile::Fsync() {
if (fsync(fd_) < 0) {
return IOError("While fsync mmaped file", filename_, errno);
}
return Msync();
}
/**
* Get the size of valid data in the file. This will not match the
* size that is returned from the filesystem because we use mmap
* to extend file by map_size every time.
*/
uint64_t PosixMmapFile::GetFileSize() {
size_t used = dst_ - base_;
return file_offset_ + used;
}
Status PosixMmapFile::InvalidateCache(size_t offset, size_t length) {
#ifndef OS_LINUX
(void)offset;
(void)length;
return Status::OK();
#else
// free OS pages
int ret = Fadvise(fd_, offset, length, POSIX_FADV_DONTNEED);
if (ret == 0) {
return Status::OK();
}
return IOError("While fadvise NotNeeded mmapped file", filename_, errno);
#endif
}
#ifdef ROCKSDB_FALLOCATE_PRESENT
Status PosixMmapFile::Allocate(uint64_t offset, uint64_t len) {
assert(offset <= std::numeric_limits<off_t>::max());
assert(len <= std::numeric_limits<off_t>::max());
TEST_KILL_RANDOM("PosixMmapFile::Allocate:0", rocksdb_kill_odds);
int alloc_status = 0;
if (allow_fallocate_) {
alloc_status = fallocate(
fd_, fallocate_with_keep_size_ ? FALLOC_FL_KEEP_SIZE : 0,
static_cast<off_t>(offset), static_cast<off_t>(len));
}
if (alloc_status == 0) {
return Status::OK();
} else {
return IOError(
"While fallocate offset " + ToString(offset) + " len " + ToString(len),
filename_, errno);
}
}
#endif
/*
* PosixWritableFile
*
* Use posix write to write data to a file.
*/
PosixWritableFile::PosixWritableFile(const std::string& fname, int fd,
const EnvOptions& options)
: filename_(fname),
use_direct_io_(options.use_direct_writes),
fd_(fd),
filesize_(0),
logical_sector_size_(GetLogicalBufferSize(fd_)) {
#ifdef ROCKSDB_FALLOCATE_PRESENT
allow_fallocate_ = options.allow_fallocate;
fallocate_with_keep_size_ = options.fallocate_with_keep_size;
#endif
assert(!options.use_mmap_writes);
}
PosixWritableFile::~PosixWritableFile() {
if (fd_ >= 0) {
PosixWritableFile::Close();
}
}
Status PosixWritableFile::Append(const Slice& data) {
if (use_direct_io()) {
assert(IsSectorAligned(data.size(), GetRequiredBufferAlignment()));
assert(IsSectorAligned(data.data(), GetRequiredBufferAlignment()));
}
const char* src = data.data();
size_t left = data.size();
while (left != 0) {
ssize_t done = write(fd_, src, left);
if (done < 0) {
if (errno == EINTR) {
continue;
}
return IOError("While appending to file", filename_, errno);
}
left -= done;
src += done;
}
filesize_ += data.size();
return Status::OK();
}
Status PosixWritableFile::PositionedAppend(const Slice& data, uint64_t offset) {
if (use_direct_io()) {
assert(IsSectorAligned(offset, GetRequiredBufferAlignment()));
assert(IsSectorAligned(data.size(), GetRequiredBufferAlignment()));
assert(IsSectorAligned(data.data(), GetRequiredBufferAlignment()));
}
assert(offset <= std::numeric_limits<off_t>::max());
const char* src = data.data();
size_t left = data.size();
while (left != 0) {
ssize_t done = pwrite(fd_, src, left, static_cast<off_t>(offset));
if (done < 0) {
if (errno == EINTR) {
continue;
}
return IOError("While pwrite to file at offset " + ToString(offset),
filename_, errno);
}
left -= done;
offset += done;
src += done;
}
filesize_ = offset;
return Status::OK();
}
Status PosixWritableFile::Truncate(uint64_t size) {
Status s;
int r = ftruncate(fd_, size);
if (r < 0) {
s = IOError("While ftruncate file to size " + ToString(size), filename_,
errno);
} else {
filesize_ = size;
}
return s;
}
Status PosixWritableFile::Close() {
Status s;
size_t block_size;
size_t last_allocated_block;
GetPreallocationStatus(&block_size, &last_allocated_block);
if (last_allocated_block > 0) {
// trim the extra space preallocated at the end of the file
// NOTE(ljin): we probably don't want to surface failure as an IOError,
// but it will be nice to log these errors.
int dummy __attribute__((__unused__));
dummy = ftruncate(fd_, filesize_);
#if defined(ROCKSDB_FALLOCATE_PRESENT) && !defined(TRAVIS)
// in some file systems, ftruncate only trims trailing space if the
// new file size is smaller than the current size. Calling fallocate
// with FALLOC_FL_PUNCH_HOLE flag to explicitly release these unused
// blocks. FALLOC_FL_PUNCH_HOLE is supported on at least the following
// filesystems:
// XFS (since Linux 2.6.38)
// ext4 (since Linux 3.0)
// Btrfs (since Linux 3.7)
// tmpfs (since Linux 3.5)
// We ignore error since failure of this operation does not affect
// correctness.
// TRAVIS - this code does not work on TRAVIS filesystems.
// the FALLOC_FL_KEEP_SIZE option is expected to not change the size
// of the file, but it does. Simple strace report will show that.
// While we work with Travis-CI team to figure out if this is a
// quirk of Docker/AUFS, we will comment this out.
struct stat file_stats;
int result = fstat(fd_, &file_stats);
// After ftruncate, we check whether ftruncate has the correct behavior.
// If not, we should hack it with FALLOC_FL_PUNCH_HOLE
if (result == 0 &&
(file_stats.st_size + file_stats.st_blksize - 1) /
file_stats.st_blksize !=
file_stats.st_blocks / (file_stats.st_blksize / 512)) {
IOSTATS_TIMER_GUARD(allocate_nanos);
if (allow_fallocate_) {
fallocate(fd_, FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE, filesize_,
block_size * last_allocated_block - filesize_);
}
}
#endif
}
if (close(fd_) < 0) {
s = IOError("While closing file after writing", filename_, errno);
}
fd_ = -1;
return s;
}
// write out the cached data to the OS cache
Status PosixWritableFile::Flush() { return Status::OK(); }
Status PosixWritableFile::Sync() {
if (fdatasync(fd_) < 0) {
return IOError("While fdatasync", filename_, errno);
}
return Status::OK();
}
Status PosixWritableFile::Fsync() {
if (fsync(fd_) < 0) {
return IOError("While fsync", filename_, errno);
}
return Status::OK();
}
bool PosixWritableFile::IsSyncThreadSafe() const { return true; }
uint64_t PosixWritableFile::GetFileSize() { return filesize_; }
void PosixWritableFile::SetWriteLifeTimeHint(Env::WriteLifeTimeHint hint) {
#ifdef OS_LINUX
// Suppress Valgrind "Unimplemented functionality" error.
#ifndef ROCKSDB_VALGRIND_RUN
if (hint == write_hint_) {
return;
}
if (fcntl(fd_, F_SET_RW_HINT, &hint) == 0) {
write_hint_ = hint;
}
#else
(void)hint;
#endif // ROCKSDB_VALGRIND_RUN
#else
(void)hint;
#endif // OS_LINUX
}
Status PosixWritableFile::InvalidateCache(size_t offset, size_t length) {
if (use_direct_io()) {
return Status::OK();
}
#ifndef OS_LINUX
(void)offset;
(void)length;
return Status::OK();
#else
// free OS pages
int ret = Fadvise(fd_, offset, length, POSIX_FADV_DONTNEED);
if (ret == 0) {
return Status::OK();
}
return IOError("While fadvise NotNeeded", filename_, errno);
#endif
}
#ifdef ROCKSDB_FALLOCATE_PRESENT
Status PosixWritableFile::Allocate(uint64_t offset, uint64_t len) {
assert(offset <= std::numeric_limits<off_t>::max());
assert(len <= std::numeric_limits<off_t>::max());
TEST_KILL_RANDOM("PosixWritableFile::Allocate:0", rocksdb_kill_odds);
IOSTATS_TIMER_GUARD(allocate_nanos);
int alloc_status = 0;
if (allow_fallocate_) {
alloc_status = fallocate(
fd_, fallocate_with_keep_size_ ? FALLOC_FL_KEEP_SIZE : 0,
static_cast<off_t>(offset), static_cast<off_t>(len));
}
if (alloc_status == 0) {
return Status::OK();
} else {
return IOError(
"While fallocate offset " + ToString(offset) + " len " + ToString(len),
filename_, errno);
}
}
#endif
#ifdef ROCKSDB_RANGESYNC_PRESENT
Status PosixWritableFile::RangeSync(uint64_t offset, uint64_t nbytes) {
assert(offset <= std::numeric_limits<off_t>::max());
assert(nbytes <= std::numeric_limits<off_t>::max());
if (sync_file_range(fd_, static_cast<off_t>(offset),
static_cast<off_t>(nbytes), SYNC_FILE_RANGE_WRITE) == 0) {
return Status::OK();
} else {
return IOError("While sync_file_range offset " + ToString(offset) +
" bytes " + ToString(nbytes),
filename_, errno);
}
}
#endif
#ifdef OS_LINUX
size_t PosixWritableFile::GetUniqueId(char* id, size_t max_size) const {
return PosixHelper::GetUniqueIdFromFile(fd_, id, max_size);
}
#endif
/*
* PosixRandomRWFile
*/
PosixRandomRWFile::PosixRandomRWFile(const std::string& fname, int fd,
const EnvOptions& /*options*/)
: filename_(fname), fd_(fd) {}
PosixRandomRWFile::~PosixRandomRWFile() {
if (fd_ >= 0) {
Close();
}
}
Status PosixRandomRWFile::Write(uint64_t offset, const Slice& data) {
const char* src = data.data();
size_t left = data.size();
while (left != 0) {
ssize_t done = pwrite(fd_, src, left, offset);
if (done < 0) {
// error while writing to file
if (errno == EINTR) {
// write was interrupted, try again.
continue;
}
return IOError(
"While write random read/write file at offset " + ToString(offset),
filename_, errno);
}
// Wrote `done` bytes
left -= done;
offset += done;
src += done;
}
return Status::OK();
}
Status PosixRandomRWFile::Read(uint64_t offset, size_t n, Slice* result,
char* scratch) const {
size_t left = n;
char* ptr = scratch;
while (left > 0) {
ssize_t done = pread(fd_, ptr, left, offset);
if (done < 0) {
// error while reading from file
if (errno == EINTR) {
// read was interrupted, try again.
continue;
}
return IOError("While reading random read/write file offset " +
ToString(offset) + " len " + ToString(n),
filename_, errno);
} else if (done == 0) {
// Nothing more to read
break;
}
// Read `done` bytes
ptr += done;
offset += done;
left -= done;
}
*result = Slice(scratch, n - left);
return Status::OK();
}
Status PosixRandomRWFile::Flush() { return Status::OK(); }
Status PosixRandomRWFile::Sync() {
if (fdatasync(fd_) < 0) {
return IOError("While fdatasync random read/write file", filename_, errno);
}
return Status::OK();
}
Status PosixRandomRWFile::Fsync() {
if (fsync(fd_) < 0) {
return IOError("While fsync random read/write file", filename_, errno);
}
return Status::OK();
}
Status PosixRandomRWFile::Close() {
if (close(fd_) < 0) {
return IOError("While close random read/write file", filename_, errno);
}
fd_ = -1;
return Status::OK();
}
PosixMemoryMappedFileBuffer::~PosixMemoryMappedFileBuffer() {
// TODO should have error handling though not much we can do...
munmap(this->base_, length_);
}
/*
* PosixDirectory
*/
PosixDirectory::~PosixDirectory() { close(fd_); }
Status PosixDirectory::Fsync() {
#ifndef OS_AIX
if (fsync(fd_) == -1) {
return IOError("While fsync", "a directory", errno);
}
#endif
return Status::OK();
}
} // namespace rocksdb
#endif
| {
"pile_set_name": "Github"
} |
Starting session. Type 'help' for a list of commands.
> t verbose
### verbose printing set to: false
> b main
### set breakpoint id: '0' method: 'main' bytecode index: '0'
> r
main @42
> s
main @a1
> s
a1 lazy initializer @1
> s
a1 lazy initializer @new A(1)
> s
A initializer @x
> s
A initializer @this.x = x
> s
a1 lazy initializer @new A(1)
> s
main @a1.x
> s
main @x
> s
main @a1.x + x
> s
main @a2
> s
a2 lazy initializer @1
> s
a2 lazy initializer @new A(1)
> s
A initializer @x
> s
A initializer @this.x = x
> s
a2 lazy initializer @new A(1)
> s
main @a2.x
> s
main @a1.x + x + a2.x
> s
### process terminated
| {
"pile_set_name": "Github"
} |
<!doctype html>
<html class="default no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>IOAuth1Client | xero-node</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../assets/css/main.css">
<link rel="stylesheet" href="../assets/css/style.css">
</head>
<body>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-index="../assets/js/search.js" data-base="..">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search">Search</label>
<input id="tsd-search-field" type="text" />
</div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="../index.html" class="title">Xero Node.JS SDK Documentation</a>
</div>
<div class="table-cell" id="tsd-widgets">
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container">
<ul class="tsd-breadcrumb">
<li>
<a href="../index.html">xero-node</a>
</li>
</ul>
<h1>Interface: IOAuth1Client</h1>
</div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-8 col-content">
<section class="tsd-panel tsd-comment">
<div class="tsd-comment tsd-typography">
</div>
</section>
<section class="tsd-panel tsd-hierarchy">
<h3>Hierarchy</h3>
<ul class="tsd-hierarchy">
<li>
<span class="target">IOAuth1Client</span>
<ul class="tsd-hierarchy">
<li>
<a href="ioauth1httpclient.html" class="tsd-signature-type">IOAuth1HttpClient</a>
</li>
</ul>
</li>
</ul>
</section>
<section class="tsd-panel-group tsd-index-group">
<h2>Index</h2>
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section ">
<h3>Properties</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="ioauth1client.html#agent" class="tsd-kind-icon">agent</a></li>
</ul>
</section>
<section class="tsd-index-section ">
<h3>Methods</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-method tsd-parent-kind-interface"><a href="ioauth1client.html#buildauthoriseurl" class="tsd-kind-icon">build<wbr>Authorise<wbr>Url</a></li>
<li class="tsd-kind-method tsd-parent-kind-interface"><a href="ioauth1client.html#getrequesttoken" class="tsd-kind-icon">get<wbr>Request<wbr>Token</a></li>
<li class="tsd-kind-method tsd-parent-kind-interface"><a href="ioauth1client.html#refreshaccesstoken" class="tsd-kind-icon">refresh<wbr>Access<wbr>Token</a></li>
<li class="tsd-kind-method tsd-parent-kind-interface"><a href="ioauth1client.html#swaprequesttokenforaccesstoken" class="tsd-kind-icon">swap<wbr>Request<wbr>Tokenfor<wbr>Access<wbr>Token</a></li>
</ul>
</section>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Properties</h2>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="agent" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagOptional">Optional</span> agent</h3>
<div class="tsd-signature tsd-kind-icon">agent<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Agent</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/XeroAPI/xero-node/blob/67fb1a7/src/internals/OAuth1HttpClient.ts#L41">internals/OAuth1HttpClient.ts:41</a></li>
</ul>
</aside>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Methods</h2>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface">
<a name="buildauthoriseurl" class="tsd-anchor"></a>
<h3>build<wbr>Authorise<wbr>Url</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-interface">
<li class="tsd-signature tsd-kind-icon">build<wbr>Authorise<wbr>Url<span class="tsd-signature-symbol">(</span>requestToken<span class="tsd-signature-symbol">: </span><a href="requesttoken.html" class="tsd-signature-type">RequestToken</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/XeroAPI/xero-node/blob/67fb1a7/src/internals/OAuth1HttpClient.ts#L43">internals/OAuth1HttpClient.ts:43</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>requestToken: <a href="requesttoken.html" class="tsd-signature-type">RequestToken</a></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface">
<a name="getrequesttoken" class="tsd-anchor"></a>
<h3>get<wbr>Request<wbr>Token</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-interface">
<li class="tsd-signature tsd-kind-icon">get<wbr>Request<wbr>Token<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="requesttoken.html" class="tsd-signature-type">RequestToken</a><span class="tsd-signature-symbol">></span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/XeroAPI/xero-node/blob/67fb1a7/src/internals/OAuth1HttpClient.ts#L42">internals/OAuth1HttpClient.ts:42</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="requesttoken.html" class="tsd-signature-type">RequestToken</a><span class="tsd-signature-symbol">></span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface">
<a name="refreshaccesstoken" class="tsd-anchor"></a>
<h3>refresh<wbr>Access<wbr>Token</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-interface">
<li class="tsd-signature tsd-kind-icon">refresh<wbr>Access<wbr>Token<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="accesstoken.html" class="tsd-signature-type">AccessToken</a><span class="tsd-signature-symbol">></span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/XeroAPI/xero-node/blob/67fb1a7/src/internals/OAuth1HttpClient.ts#L45">internals/OAuth1HttpClient.ts:45</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="accesstoken.html" class="tsd-signature-type">AccessToken</a><span class="tsd-signature-symbol">></span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface">
<a name="swaprequesttokenforaccesstoken" class="tsd-anchor"></a>
<h3>swap<wbr>Request<wbr>Tokenfor<wbr>Access<wbr>Token</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-interface">
<li class="tsd-signature tsd-kind-icon">swap<wbr>Request<wbr>Tokenfor<wbr>Access<wbr>Token<span class="tsd-signature-symbol">(</span>requestToken<span class="tsd-signature-symbol">: </span><a href="requesttoken.html" class="tsd-signature-type">RequestToken</a>, oauth_verifier<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="accesstoken.html" class="tsd-signature-type">AccessToken</a><span class="tsd-signature-symbol">></span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/XeroAPI/xero-node/blob/67fb1a7/src/internals/OAuth1HttpClient.ts#L44">internals/OAuth1HttpClient.ts:44</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>requestToken: <a href="requesttoken.html" class="tsd-signature-type">RequestToken</a></h5>
</li>
<li>
<h5>oauth_verifier: <span class="tsd-signature-type">string</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="accesstoken.html" class="tsd-signature-type">AccessToken</a><span class="tsd-signature-symbol">></span></h4>
</li>
</ul>
</section>
</section>
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation primary">
<ul>
</ul>
</nav>
<nav class="tsd-navigation secondary menu-sticky">
<ul class="before-current">
</ul>
<ul class="current">
<li class="current tsd-kind-interface tsd-is-private">
<a href="ioauth1client.html" class="tsd-kind-icon">IOAuth1<wbr>Client</a>
<ul>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="ioauth1client.html#agent" class="tsd-kind-icon">agent</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-interface">
<a href="ioauth1client.html#buildauthoriseurl" class="tsd-kind-icon">build<wbr>Authorise<wbr>Url</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-interface">
<a href="ioauth1client.html#getrequesttoken" class="tsd-kind-icon">get<wbr>Request<wbr>Token</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-interface">
<a href="ioauth1client.html#refreshaccesstoken" class="tsd-kind-icon">refresh<wbr>Access<wbr>Token</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-interface">
<a href="ioauth1client.html#swaprequesttokenforaccesstoken" class="tsd-kind-icon">swap<wbr>Request<wbr>Tokenfor<wbr>Access<wbr>Token</a>
</li>
</ul>
</li>
</ul>
<ul class="after-current">
</ul>
</nav>
</div>
</div>
</div>
<footer class="with-border-bottom">
<div class="container">
<h2>Legend</h2>
<div class="tsd-legend-group">
<ul class="tsd-legend">
<li class="tsd-kind-module"><span class="tsd-kind-icon">Module</span></li>
<li class="tsd-kind-object-literal"><span class="tsd-kind-icon">Object literal</span></li>
<li class="tsd-kind-variable"><span class="tsd-kind-icon">Variable</span></li>
<li class="tsd-kind-function"><span class="tsd-kind-icon">Function</span></li>
<li class="tsd-kind-function tsd-has-type-parameter"><span class="tsd-kind-icon">Function with type parameter</span></li>
<li class="tsd-kind-index-signature"><span class="tsd-kind-icon">Index signature</span></li>
<li class="tsd-kind-type-alias"><span class="tsd-kind-icon">Type alias</span></li>
<li class="tsd-kind-type-alias tsd-has-type-parameter"><span class="tsd-kind-icon">Type alias with type parameter</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-enum"><span class="tsd-kind-icon">Enumeration</span></li>
<li class="tsd-kind-enum-member"><span class="tsd-kind-icon">Enumeration member</span></li>
<li class="tsd-kind-property tsd-parent-kind-enum"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-enum"><span class="tsd-kind-icon">Method</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li>
<li class="tsd-kind-interface tsd-has-type-parameter"><span class="tsd-kind-icon">Interface with type parameter</span></li>
<li class="tsd-kind-constructor tsd-parent-kind-interface"><span class="tsd-kind-icon">Constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">Method</span></li>
<li class="tsd-kind-index-signature tsd-parent-kind-interface"><span class="tsd-kind-icon">Index signature</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li>
<li class="tsd-kind-class tsd-has-type-parameter"><span class="tsd-kind-icon">Class with type parameter</span></li>
<li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><span class="tsd-kind-icon">Accessor</span></li>
<li class="tsd-kind-index-signature tsd-parent-kind-class"><span class="tsd-kind-icon">Index signature</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited accessor</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected accessor</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private accessor</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static property</span></li>
<li class="tsd-kind-call-signature tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static method</span></li>
</ul>
</div>
</div>
</footer>
<div class="container tsd-generator">
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p>
</div>
<div class="overlay"></div>
<script src="../assets/js/main.js"></script>
<script>if (location.protocol == 'file:') document.write('<script src="../assets/js/search.js"><' + '/script>');</script>
</body>
</html> | {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<CodeLite_Project Name="24_PartialBlending" InternalType="Console" Version="10.0.0">
<Plugins>
<Plugin Name="qmake">
<![CDATA[00020001N0005Debug0000000000000001N0007Release000000000000]]>
</Plugin>
</Plugins>
<Description/>
<Dependencies/>
<VirtualDirectory Name="src">
<File Name="../../src/24_PartialBlending/24_PartialBlending.cpp" ExcludeProjConfig=""/>
</VirtualDirectory>
<Dependencies Name="Debug">
<Project Name="OS"/>
<Project Name="Renderer"/>
<Project Name="SpirVTools"/>
<Project Name="gainput"/>
<Project Name="ozz_base"/>
<Project Name="ozz_animation"/>
<Project Name="EASTL"/>
</Dependencies>
<Dependencies Name="Release">
<Project Name="ozz_base"/>
<Project Name="ozz_animation"/>
<Project Name="OS"/>
<Project Name="Renderer"/>
<Project Name="SpirVTools"/>
<Project Name="gainput"/>
<Project Name="EASTL"/>
</Dependencies>
<Settings Type="Executable">
<GlobalSettings>
<Compiler Options="" C_Options="" Assembler="">
<IncludePath Value="$(WorkspacePath)/../../../Common_3/ThirdParty/OpenSource/ozz-animation/include"/>
</Compiler>
<Linker Options=""/>
<ResourceCompiler Options=""/>
</GlobalSettings>
<Configuration Name="Debug" CompilerType="GCC" DebuggerType="GNU gdb debugger" Type="Executable" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="prepend" BuildResWithGlobalSettings="append">
<Compiler Options="-g;-O0;-std=c++14;-Wall;-Wno-unknown-pragmas;-msse4.1; " C_Options="-g;-O0;-Wall" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0">
<IncludePath Value="."/>
<IncludePath Value="$(ProjectPath)/../.."/>
<Preprocessor Value="VULKAN"/>
<Preprocessor Value="_DEBUG"/>
<Preprocessor Value="USE_MEMORY_TRACKING"/>
</Compiler>
<Linker Options="-ldl;-pthread;-lXrandr;" Required="yes">
<LibraryPath Value="$(ProjectPath)/../gainput/Debug/"/>
<LibraryPath Value="$(ProjectPath)/../ozz_base/Debug/"/>
<LibraryPath Value="$(ProjectPath)/../ozz_animation/Debug/"/>
<LibraryPath Value="$(ProjectPath)/../OSBase/Debug/"/>
<LibraryPath Value="$(ProjectPath)/../Renderer/Debug/"/>
<LibraryPath Value="$(ProjectPath)/../SpirVTools/Debug/"/>
<LibraryPath Value="$(ProjectPath)/../../../../Common_3/ThirdParty/OpenSource/EASTL/Linux/Debug/"/>
<Library Value="libRenderer.a"/>
<Library Value="libOS.a"/>
<Library Value="libX11.a"/>
<Library Value="libSpirVTools.a"/>
<Library Value="libvulkan.so"/>
<Library Value="libgainput.a"/>
<Library Value="libozz_animation.a"/>
<Library Value="libozz_base.a"/>
<Library Value="libEASTL.a"/>
</Linker>
<ResourceCompiler Options="" Required="no"/>
<General OutputFile="$(IntermediateDirectory)/$(ProjectName)" IntermediateDirectory="./Debug" Command="./$(ProjectName)" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/>
<BuildSystem Name="Default"/>
<Environment EnvVarSetName="<Use Defaults>" DbgSetName="<Use Defaults>">
<![CDATA[]]>
</Environment>
<Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath="" IsExtended="no">
<DebuggerSearchPaths/>
<PostConnectCommands/>
<StartupCommands/>
</Debugger>
<PreBuild/>
<PostBuild>
<Command Enabled="no"># Src</Command>
<Command Enabled="yes">rsync -u -r $(WorkspacePath)/../../../Middleware_3/UI/Shaders/Vulkan/ $(ProjectPath)/$(ConfigurationName)/Shaders/</Command>
<Command Enabled="yes">rsync -u -r $(WorkspacePath)/../../../Middleware_3/Text/Shaders/Vulkan/ $(ProjectPath)/$(ConfigurationName)/Shaders/</Command>
<Command Enabled="yes">rsync -u -r $(WorkspacePath)/../src/$(ProjectName)/Shaders/Vulkan/ $(ProjectPath)/$(ConfigurationName)/Shaders/</Command>
<Command Enabled="yes">rsync -u -r $(WorkspacePath)/../src/$(ProjectName)/GPUCfg/ $(ProjectPath)/$(ConfigurationName)/GPUCfg/</Command>
<Command Enabled="no"># Animations</Command>
<Command Enabled="yes">rsync -u -r $(WorkspacePath)/../UnitTestResources/Animation/ $(ProjectPath)/$(ConfigurationName)/Animation/</Command>
<Command Enabled="no"># Fonts</Command>
<Command Enabled="yes">rsync -u -r $(WorkspacePath)/../UnitTestResources/Fonts/ $(ProjectPath)/$(ConfigurationName)/Fonts/</Command>
</PostBuild>
<CustomBuild Enabled="no">
<RebuildCommand/>
<CleanCommand/>
<BuildCommand/>
<PreprocessFileCommand/>
<SingleFileCommand/>
<MakefileGenerationCommand/>
<ThirdPartyToolName>None</ThirdPartyToolName>
<WorkingDirectory/>
</CustomBuild>
<AdditionalRules>
<CustomPostBuild/>
<CustomPreBuild/>
</AdditionalRules>
<Completion EnableCpp11="no" EnableCpp14="no">
<ClangCmpFlagsC/>
<ClangCmpFlags/>
<ClangPP/>
<SearchPaths/>
</Completion>
</Configuration>
<Configuration Name="Release" CompilerType="GCC" DebuggerType="GNU gdb debugger" Type="Executable" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="prepend" BuildResWithGlobalSettings="append">
<Compiler Options="-g;-O2;-std=c++14;-Wall;-Wno-unknown-pragmas;-msse4.1; " C_Options="-g;-O2;-Wall" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0">
<IncludePath Value="."/>
<IncludePath Value="$(ProjectPath)/../.."/>
<Preprocessor Value="VULKAN"/>
<Preprocessor Value="NDEBUG"/>
</Compiler>
<Linker Options="-ldl;-pthread;-lXrandr;" Required="yes">
<LibraryPath Value="$(ProjectPath)/../gainput/Release/"/>
<LibraryPath Value="$(ProjectPath)/../ozz_base/Release/"/>
<LibraryPath Value="$(ProjectPath)/../ozz_animation/Release/"/>
<LibraryPath Value="$(ProjectPath)/../OSBase/Release/"/>
<LibraryPath Value="$(ProjectPath)/../Renderer/Release/"/>
<LibraryPath Value="$(ProjectPath)/../SpirVTools/Release/"/>
<LibraryPath Value="$(ProjectPath)/../../../../Common_3/ThirdParty/OpenSource/EASTL/Linux/Release/"/>
<Library Value="libOS.a"/>
<Library Value="libozz_animation.a"/>
<Library Value="libozz_base.a"/>
<Library Value="libRenderer.a"/>
<Library Value="libOS.a"/>
<Library Value="libX11.a"/>
<Library Value="libSpirVTools.a"/>
<Library Value="libvulkan.so"/>
<Library Value="libgainput.a"/>
<Library Value="libEASTL.a"/>
</Linker>
<ResourceCompiler Options="" Required="no"/>
<General OutputFile="$(IntermediateDirectory)/$(ProjectName)" IntermediateDirectory="./Release" Command="./$(ProjectName)" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/>
<BuildSystem Name="Default"/>
<Environment EnvVarSetName="<Use Defaults>" DbgSetName="<Use Defaults>">
<![CDATA[]]>
</Environment>
<Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath="" IsExtended="no">
<DebuggerSearchPaths/>
<PostConnectCommands/>
<StartupCommands/>
</Debugger>
<PreBuild/>
<PostBuild>
<Command Enabled="no"># Src</Command>
<Command Enabled="yes">rsync -u -r $(WorkspacePath)/../../../Middleware_3/UI/Shaders/Vulkan/ $(ProjectPath)/$(ConfigurationName)/Shaders/</Command>
<Command Enabled="yes">rsync -u -r $(WorkspacePath)/../../../Middleware_3/Text/Shaders/Vulkan/ $(ProjectPath)/$(ConfigurationName)/Shaders/</Command>
<Command Enabled="yes">rsync -u -r $(WorkspacePath)/../src/$(ProjectName)/Shaders/Vulkan/ $(ProjectPath)/$(ConfigurationName)/Shaders/</Command>
<Command Enabled="yes">rsync -u -r $(WorkspacePath)/../src/$(ProjectName)/GPUCfg/ $(ProjectPath)/$(ConfigurationName)/GPUCfg/</Command>
<Command Enabled="no"># Animations</Command>
<Command Enabled="yes">rsync -u -r $(WorkspacePath)/../UnitTestResources/Animation/ $(ProjectPath)/$(ConfigurationName)/Animation/</Command>
<Command Enabled="no"># Fonts</Command>
<Command Enabled="yes">rsync -u -r $(WorkspacePath)/../UnitTestResources/Fonts/ $(ProjectPath)/$(ConfigurationName)/Fonts/</Command>
</PostBuild>
<CustomBuild Enabled="no">
<RebuildCommand/>
<CleanCommand/>
<BuildCommand/>
<PreprocessFileCommand/>
<SingleFileCommand/>
<MakefileGenerationCommand/>
<ThirdPartyToolName>None</ThirdPartyToolName>
<WorkingDirectory/>
</CustomBuild>
<AdditionalRules>
<CustomPostBuild/>
<CustomPreBuild/>
</AdditionalRules>
<Completion EnableCpp11="no" EnableCpp14="no">
<ClangCmpFlagsC/>
<ClangCmpFlags/>
<ClangPP/>
<SearchPaths/>
</Completion>
</Configuration>
</Settings>
</CodeLite_Project>
| {
"pile_set_name": "Github"
} |
{
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "3.13.1",
"releaseDate": "2020-07-28",
"license": "MIT",
"compatible": "3.13.1",
"notes": ""
} | {
"pile_set_name": "Github"
} |
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1
import (
v1 "k8s.io/api/authentication/v1"
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
"k8s.io/client-go/kubernetes/scheme"
rest "k8s.io/client-go/rest"
)
type AuthenticationV1Interface interface {
RESTClient() rest.Interface
TokenReviewsGetter
}
// AuthenticationV1Client is used to interact with features provided by the authentication.k8s.io group.
type AuthenticationV1Client struct {
restClient rest.Interface
}
func (c *AuthenticationV1Client) TokenReviews() TokenReviewInterface {
return newTokenReviews(c)
}
// NewForConfig creates a new AuthenticationV1Client for the given config.
func NewForConfig(c *rest.Config) (*AuthenticationV1Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := rest.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &AuthenticationV1Client{client}, nil
}
// NewForConfigOrDie creates a new AuthenticationV1Client for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *AuthenticationV1Client {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
}
// New creates a new AuthenticationV1Client for the given RESTClient.
func New(c rest.Interface) *AuthenticationV1Client {
return &AuthenticationV1Client{c}
}
func setConfigDefaults(config *rest.Config) error {
gv := v1.SchemeGroupVersion
config.GroupVersion = &gv
config.APIPath = "/apis"
config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs}
if config.UserAgent == "" {
config.UserAgent = rest.DefaultKubernetesUserAgent()
}
return nil
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *AuthenticationV1Client) RESTClient() rest.Interface {
if c == nil {
return nil
}
return c.restClient
}
| {
"pile_set_name": "Github"
} |
require 'singleton'
require 'set'
module CouchFoo
module Observing # :nodoc:
def self.included(base)
base.extend ClassMethods
end
module ClassMethods
# Activates the observers assigned. Examples:
#
# # Calls PersonObserver.instance
# CouchFoo::Base.observers = :person_observer
#
# # Calls Cacher.instance and GarbageCollector.instance
# CouchFoo::Base.observers = :cacher, :garbage_collector
#
# # Same as above, just using explicit class references
# CouchFoo::Base.observers = Cacher, GarbageCollector
#
# Note: Setting this does not instantiate the observers yet. +instantiate_observers+ is
# called during startup, and before each development request.
def observers=(*observers)
@observers = observers.flatten
end
# Gets the current observers.
def observers
@observers ||= []
end
# Instantiate the global Couch Foo observers.
def instantiate_observers
return if @observers.blank?
@observers.each do |observer|
if observer.respond_to?(:to_sym) # Symbol or String
observer.to_s.camelize.constantize.instance
elsif observer.respond_to?(:instance)
observer.instance
else
raise ArgumentError, "#{observer} must be a lowercase, underscored class name (or an instance of the class itself) responding to the instance method. Example: Person.observers = :big_brother # calls BigBrother.instance"
end
end
end
protected
# Notify observers when the observed class is subclassed.
def inherited(subclass)
super
changed
notify_observers :observed_class_inherited, subclass
end
end
end
# Observer classes respond to lifecycle callbacks to implement trigger-like
# behavior outside the original class. This is a great way to reduce the
# clutter that normally comes when the model class is burdened with
# functionality that doesn't pertain to the core responsibility of the
# class. Example:
#
# class CommentObserver < CouchFoo::Observer
# def after_save(comment)
# Notifications.deliver_comment("[email protected]", "New comment was posted", comment)
# end
# end
#
# This Observer sends an email when a Comment#save is finished.
#
# class ContactObserver < CouchFoo::Observer
# def after_create(contact)
# contact.logger.info('New contact added!')
# end
#
# def after_destroy(contact)
# contact.logger.warn("Contact with an id of #{contact.id} was destroyed!")
# end
# end
#
# This Observer uses logger to log when specific callbacks are triggered.
#
# == Observing a class that can't be inferred
#
# Observers will by default be mapped to the class with which they share a name. So CommentObserver will
# be tied to observing Comment, ProductManagerObserver to ProductManager, and so on. If you want to name
# your observer differently than the class you're interested in observing, you can use the Observer.observe
# class method which takes either the concrete class (Product) or a symbol for that class (:product):
#
# class AuditObserver < CouchFoo::Observer
# observe :account
#
# def after_update(account)
# AuditTrail.new(account, "UPDATED")
# end
# end
#
# If the audit observer needs to watch more than one kind of object, this can be specified with multiple arguments:
#
# class AuditObserver < CouchFoo::Observer
# observe :account, :balance
#
# def after_update(record)
# AuditTrail.new(record, "UPDATED")
# end
# end
#
# The AuditObserver will now act on both updates to Account and Balance by treating them both as records.
#
# == Available callback methods
#
# The observer can implement callback methods for each of the methods described in the Callbacks module.
#
# == Storing Observers in Rails
#
# If you're using Couch Foo within Rails, observer classes are usually stored in app/models with the
# naming convention of app/models/audit_observer.rb.
#
# == Configuration
# In order to activate an observer, list it in the <tt>config.couch_foo.observers</tt> configuration setting
# in your <tt>config/environment.rb</tt> file.
#
# config.couch_foo.observers = :comment_observer, :signup_observer
#
# Observers will not be invoked unless you define these in your application configuration.
#
# == Loading
#
# Observers register themselves in the model class they observe, since it is the class that
# notifies them of events when they occur. As a side-effect, when an observer is loaded its
# corresponding model class is loaded.
#
# Up to (and including) Rails 2.0.2 observers were instantiated between plugins and
# application initializers. Now observers are loaded after application initializers,
# so observed models can make use of extensions.
#
# If by any chance you are using observed models in the initialization you can still
# load their observers by calling <tt>ModelObserver.instance</tt> before. Observers are
# singletons and that call instantiates and registers them.
class Observer
include Singleton
class << self
# Attaches the observer to the supplied model classes.
def observe(*models)
models.flatten!
models.collect! { |model| model.is_a?(Symbol) ? model.to_s.camelize.constantize : model }
define_method(:observed_classes) { Set.new(models) }
end
# The class observed by default is inferred from the observer's class name:
# assert_equal Person, PersonObserver.observed_class
def observed_class
if observed_class_name = name[/(.*)Observer/, 1]
observed_class_name.constantize
else
nil
end
end
end
# Start observing the declared classes and their subclasses.
def initialize
Set.new(observed_classes + observed_subclasses).each { |klass| add_observer! klass }
end
# Send observed_method(object) if the method exists.
def update(observed_method, object) #:nodoc:
send(observed_method, object) if respond_to?(observed_method)
end
# Special method sent by the observed class when it is inherited.
# Passes the new subclass.
def observed_class_inherited(subclass) #:nodoc:
self.class.observe(observed_classes + [subclass])
add_observer!(subclass)
end
protected
def observed_classes
Set.new([self.class.observed_class].compact.flatten)
end
def observed_subclasses
observed_classes.sum([]) { |klass| klass.send(:subclasses) }
end
def add_observer!(klass)
klass.add_observer(self)
if respond_to?(:after_find) && !klass.method_defined?(:after_find)
klass.class_eval 'def after_find() end'
end
end
end
end | {
"pile_set_name": "Github"
} |
#include <json/writer.h>
#include <utility>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <sstream>
#include <iomanip>
#if _MSC_VER >= 1400 // VC++ 8.0
#pragma warning( disable : 4996 ) // disable warning about strdup being deprecated.
#endif
namespace Json {
static bool isControlCharacter(char ch)
{
return ch > 0 && ch <= 0x1F;
}
static bool containsControlCharacter( const char* str )
{
while ( *str )
{
if ( isControlCharacter( *(str++) ) )
return true;
}
return false;
}
static void uintToString( unsigned int value,
char *¤t )
{
*--current = 0;
do
{
*--current = (value % 10) + '0';
value /= 10;
}
while ( value != 0 );
}
std::string valueToString( Int value )
{
char buffer[32];
char *current = buffer + sizeof(buffer);
bool isNegative = value < 0;
if ( isNegative )
value = -value;
uintToString( UInt(value), current );
if ( isNegative )
*--current = '-';
assert( current >= buffer );
return current;
}
std::string valueToString( UInt value )
{
char buffer[32];
char *current = buffer + sizeof(buffer);
uintToString( value, current );
assert( current >= buffer );
return current;
}
std::string valueToString( double value )
{
char buffer[32];
#if defined(_MSC_VER) && defined(__STDC_SECURE_LIB__) // Use secure version with visual studio 2005 to avoid warning.
sprintf_s(buffer, sizeof(buffer), "%#.16g", value);
#else
sprintf(buffer, "%#.16g", value);
#endif
char* ch = buffer + strlen(buffer) - 1;
if (*ch != '0') return buffer; // nothing to truncate, so save time
while(ch > buffer && *ch == '0'){
--ch;
}
char* last_nonzero = ch;
while(ch >= buffer){
switch(*ch){
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
--ch;
continue;
case '.':
// Truncate zeroes to save bytes in output, but keep one.
*(last_nonzero+2) = '\0';
return buffer;
default:
return buffer;
}
}
return buffer;
}
std::string valueToString( bool value )
{
return value ? "true" : "false";
}
std::string valueToQuotedString( const char *value )
{
// Not sure how to handle unicode...
if (strpbrk(value, "\"\\\b\f\n\r\t") == NULL && !containsControlCharacter( value ))
return std::string("\"") + value + "\"";
// We have to walk value and escape any special characters.
// Appending to std::string is not efficient, but this should be rare.
// (Note: forward slashes are *not* rare, but I am not escaping them.)
unsigned maxsize = strlen(value)*2 + 3; // allescaped+quotes+NULL
std::string result;
result.reserve(maxsize); // to avoid lots of mallocs
result += "\"";
for (const char* c=value; *c != 0; ++c)
{
switch(*c)
{
case '\"':
result += "\\\"";
break;
case '\\':
result += "\\\\";
break;
case '\b':
result += "\\b";
break;
case '\f':
result += "\\f";
break;
case '\n':
result += "\\n";
break;
case '\r':
result += "\\r";
break;
case '\t':
result += "\\t";
break;
//case '/':
// Even though \/ is considered a legal escape in JSON, a bare
// slash is also legal, so I see no reason to escape it.
// (I hope I am not misunderstanding something.
// blep notes: actually escaping \/ may be useful in javascript to avoid </
// sequence.
// Should add a flag to allow this compatibility mode and prevent this
// sequence from occurring.
default:
if ( isControlCharacter( *c ) )
{
std::ostringstream oss;
oss << "\\u" << std::hex << std::uppercase << std::setfill('0') << std::setw(4) << static_cast<int>(*c);
result += oss.str();
}
else
{
result += *c;
}
break;
}
}
result += "\"";
return result;
}
// Class Writer
// //////////////////////////////////////////////////////////////////
Writer::~Writer()
{
}
// Class FastWriter
// //////////////////////////////////////////////////////////////////
FastWriter::FastWriter()
: yamlCompatiblityEnabled_( false )
{
}
void
FastWriter::enableYAMLCompatibility()
{
yamlCompatiblityEnabled_ = true;
}
std::string
FastWriter::write( const Value &root )
{
document_ = "";
writeValue( root );
document_ += "\n";
return document_;
}
void
FastWriter::writeValue( const Value &value )
{
switch ( value.type() )
{
case nullValue:
document_ += "null";
break;
case intValue:
document_ += valueToString( value.asInt() );
break;
case uintValue:
document_ += valueToString( value.asUInt() );
break;
case realValue:
document_ += valueToString( value.asDouble() );
break;
case stringValue:
document_ += valueToQuotedString( value.asCString() );
break;
case booleanValue:
document_ += valueToString( value.asBool() );
break;
case arrayValue:
{
document_ += "[";
int size = value.size();
for ( int index =0; index < size; ++index )
{
if ( index > 0 )
document_ += ",";
writeValue( value[index] );
}
document_ += "]";
}
break;
case objectValue:
{
Value::Members members( value.getMemberNames() );
document_ += "{";
for ( Value::Members::iterator it = members.begin();
it != members.end();
++it )
{
const std::string &name = *it;
if ( it != members.begin() )
document_ += ",";
document_ += valueToQuotedString( name.c_str() );
document_ += yamlCompatiblityEnabled_ ? ": "
: ":";
writeValue( value[name] );
}
document_ += "}";
}
break;
}
}
// Class StyledWriter
// //////////////////////////////////////////////////////////////////
StyledWriter::StyledWriter()
: rightMargin_( 74 )
, indentSize_( 3 )
{
}
std::string
StyledWriter::write( const Value &root )
{
document_ = "";
addChildValues_ = false;
indentString_ = "";
writeCommentBeforeValue( root );
writeValue( root );
writeCommentAfterValueOnSameLine( root );
document_ += "\n";
return document_;
}
void
StyledWriter::writeValue( const Value &value )
{
switch ( value.type() )
{
case nullValue:
pushValue( "null" );
break;
case intValue:
pushValue( valueToString( value.asInt() ) );
break;
case uintValue:
pushValue( valueToString( value.asUInt() ) );
break;
case realValue:
pushValue( valueToString( value.asDouble() ) );
break;
case stringValue:
pushValue( valueToQuotedString( value.asCString() ) );
break;
case booleanValue:
pushValue( valueToString( value.asBool() ) );
break;
case arrayValue:
writeArrayValue( value);
break;
case objectValue:
{
Value::Members members( value.getMemberNames() );
if ( members.empty() )
pushValue( "{}" );
else
{
writeWithIndent( "{" );
indent();
Value::Members::iterator it = members.begin();
while ( true )
{
const std::string &name = *it;
const Value &childValue = value[name];
writeCommentBeforeValue( childValue );
writeWithIndent( valueToQuotedString( name.c_str() ) );
document_ += " : ";
writeValue( childValue );
if ( ++it == members.end() )
{
writeCommentAfterValueOnSameLine( childValue );
break;
}
document_ += ",";
writeCommentAfterValueOnSameLine( childValue );
}
unindent();
writeWithIndent( "}" );
}
}
break;
}
}
void
StyledWriter::writeArrayValue( const Value &value )
{
unsigned size = value.size();
if ( size == 0 )
pushValue( "[]" );
else
{
bool isArrayMultiLine = isMultineArray( value );
if ( isArrayMultiLine )
{
writeWithIndent( "[" );
indent();
bool hasChildValue = !childValues_.empty();
unsigned index =0;
while ( true )
{
const Value &childValue = value[index];
writeCommentBeforeValue( childValue );
if ( hasChildValue )
writeWithIndent( childValues_[index] );
else
{
writeIndent();
writeValue( childValue );
}
if ( ++index == size )
{
writeCommentAfterValueOnSameLine( childValue );
break;
}
document_ += ",";
writeCommentAfterValueOnSameLine( childValue );
}
unindent();
writeWithIndent( "]" );
}
else // output on a single line
{
assert( childValues_.size() == size );
document_ += "[ ";
for ( unsigned index =0; index < size; ++index )
{
if ( index > 0 )
document_ += ", ";
document_ += childValues_[index];
}
document_ += " ]";
}
}
}
bool
StyledWriter::isMultineArray( const Value &value )
{
int size = value.size();
bool isMultiLine = size*3 >= rightMargin_ ;
childValues_.clear();
for ( int index =0; index < size && !isMultiLine; ++index )
{
const Value &childValue = value[index];
isMultiLine = isMultiLine ||
( (childValue.isArray() || childValue.isObject()) &&
childValue.size() > 0 );
}
if ( !isMultiLine ) // check if line length > max line length
{
childValues_.reserve( size );
addChildValues_ = true;
int lineLength = 4 + (size-1)*2; // '[ ' + ', '*n + ' ]'
for ( int index =0; index < size && !isMultiLine; ++index )
{
writeValue( value[index] );
lineLength += int( childValues_[index].length() );
isMultiLine = isMultiLine && hasCommentForValue( value[index] );
}
addChildValues_ = false;
isMultiLine = isMultiLine || lineLength >= rightMargin_;
}
return isMultiLine;
}
void
StyledWriter::pushValue( const std::string &value )
{
if ( addChildValues_ )
childValues_.push_back( value );
else
document_ += value;
}
void
StyledWriter::writeIndent()
{
if ( !document_.empty() )
{
char last = document_[document_.length()-1];
if ( last == ' ' ) // already indented
return;
if ( last != '\n' ) // Comments may add new-line
document_ += '\n';
}
document_ += indentString_;
}
void
StyledWriter::writeWithIndent( const std::string &value )
{
writeIndent();
document_ += value;
}
void
StyledWriter::indent()
{
indentString_ += std::string( indentSize_, ' ' );
}
void
StyledWriter::unindent()
{
assert( int(indentString_.size()) >= indentSize_ );
indentString_.resize( indentString_.size() - indentSize_ );
}
void
StyledWriter::writeCommentBeforeValue( const Value &root )
{
if ( !root.hasComment( commentBefore ) )
return;
document_ += normalizeEOL( root.getComment( commentBefore ) );
document_ += "\n";
}
void
StyledWriter::writeCommentAfterValueOnSameLine( const Value &root )
{
if ( root.hasComment( commentAfterOnSameLine ) )
document_ += " " + normalizeEOL( root.getComment( commentAfterOnSameLine ) );
if ( root.hasComment( commentAfter ) )
{
document_ += "\n";
document_ += normalizeEOL( root.getComment( commentAfter ) );
document_ += "\n";
}
}
bool
StyledWriter::hasCommentForValue( const Value &value )
{
return value.hasComment( commentBefore )
|| value.hasComment( commentAfterOnSameLine )
|| value.hasComment( commentAfter );
}
std::string
StyledWriter::normalizeEOL( const std::string &text )
{
std::string normalized;
normalized.reserve( text.length() );
const char *begin = text.c_str();
const char *end = begin + text.length();
const char *current = begin;
while ( current != end )
{
char c = *current++;
if ( c == '\r' ) // mac or dos EOL
{
if ( *current == '\n' ) // convert dos EOL
++current;
normalized += '\n';
}
else // handle unix EOL & other char
normalized += c;
}
return normalized;
}
// Class StyledStreamWriter
// //////////////////////////////////////////////////////////////////
StyledStreamWriter::StyledStreamWriter( std::string indentation )
: document_(NULL)
, rightMargin_( 74 )
, indentation_( indentation )
{
}
void
StyledStreamWriter::write( std::ostream &out, const Value &root )
{
document_ = &out;
addChildValues_ = false;
indentString_ = "";
writeCommentBeforeValue( root );
writeValue( root );
writeCommentAfterValueOnSameLine( root );
*document_ << "\n";
document_ = NULL; // Forget the stream, for safety.
}
void
StyledStreamWriter::writeValue( const Value &value )
{
switch ( value.type() )
{
case nullValue:
pushValue( "null" );
break;
case intValue:
pushValue( valueToString( value.asInt() ) );
break;
case uintValue:
pushValue( valueToString( value.asUInt() ) );
break;
case realValue:
pushValue( valueToString( value.asDouble() ) );
break;
case stringValue:
pushValue( valueToQuotedString( value.asCString() ) );
break;
case booleanValue:
pushValue( valueToString( value.asBool() ) );
break;
case arrayValue:
writeArrayValue( value);
break;
case objectValue:
{
Value::Members members( value.getMemberNames() );
if ( members.empty() )
pushValue( "{}" );
else
{
writeWithIndent( "{" );
indent();
Value::Members::iterator it = members.begin();
while ( true )
{
const std::string &name = *it;
const Value &childValue = value[name];
writeCommentBeforeValue( childValue );
writeWithIndent( valueToQuotedString( name.c_str() ) );
*document_ << " : ";
writeValue( childValue );
if ( ++it == members.end() )
{
writeCommentAfterValueOnSameLine( childValue );
break;
}
*document_ << ",";
writeCommentAfterValueOnSameLine( childValue );
}
unindent();
writeWithIndent( "}" );
}
}
break;
}
}
void
StyledStreamWriter::writeArrayValue( const Value &value )
{
unsigned size = value.size();
if ( size == 0 )
pushValue( "[]" );
else
{
bool isArrayMultiLine = isMultineArray( value );
if ( isArrayMultiLine )
{
writeWithIndent( "[" );
indent();
bool hasChildValue = !childValues_.empty();
unsigned index =0;
while ( true )
{
const Value &childValue = value[index];
writeCommentBeforeValue( childValue );
if ( hasChildValue )
writeWithIndent( childValues_[index] );
else
{
writeIndent();
writeValue( childValue );
}
if ( ++index == size )
{
writeCommentAfterValueOnSameLine( childValue );
break;
}
*document_ << ",";
writeCommentAfterValueOnSameLine( childValue );
}
unindent();
writeWithIndent( "]" );
}
else // output on a single line
{
assert( childValues_.size() == size );
*document_ << "[ ";
for ( unsigned index =0; index < size; ++index )
{
if ( index > 0 )
*document_ << ", ";
*document_ << childValues_[index];
}
*document_ << " ]";
}
}
}
bool
StyledStreamWriter::isMultineArray( const Value &value )
{
int size = value.size();
bool isMultiLine = size*3 >= rightMargin_ ;
childValues_.clear();
for ( int index =0; index < size && !isMultiLine; ++index )
{
const Value &childValue = value[index];
isMultiLine = isMultiLine ||
( (childValue.isArray() || childValue.isObject()) &&
childValue.size() > 0 );
}
if ( !isMultiLine ) // check if line length > max line length
{
childValues_.reserve( size );
addChildValues_ = true;
int lineLength = 4 + (size-1)*2; // '[ ' + ', '*n + ' ]'
for ( int index =0; index < size && !isMultiLine; ++index )
{
writeValue( value[index] );
lineLength += int( childValues_[index].length() );
isMultiLine = isMultiLine && hasCommentForValue( value[index] );
}
addChildValues_ = false;
isMultiLine = isMultiLine || lineLength >= rightMargin_;
}
return isMultiLine;
}
void
StyledStreamWriter::pushValue( const std::string &value )
{
if ( addChildValues_ )
childValues_.push_back( value );
else
*document_ << value;
}
void
StyledStreamWriter::writeIndent()
{
/*
Some comments in this method would have been nice. ;-)
if ( !document_.empty() )
{
char last = document_[document_.length()-1];
if ( last == ' ' ) // already indented
return;
if ( last != '\n' ) // Comments may add new-line
*document_ << '\n';
}
*/
*document_ << '\n' << indentString_;
}
void
StyledStreamWriter::writeWithIndent( const std::string &value )
{
writeIndent();
*document_ << value;
}
void
StyledStreamWriter::indent()
{
indentString_ += indentation_;
}
void
StyledStreamWriter::unindent()
{
assert( indentString_.size() >= indentation_.size() );
indentString_.resize( indentString_.size() - indentation_.size() );
}
void
StyledStreamWriter::writeCommentBeforeValue( const Value &root )
{
if ( !root.hasComment( commentBefore ) )
return;
*document_ << normalizeEOL( root.getComment( commentBefore ) );
*document_ << "\n";
}
void
StyledStreamWriter::writeCommentAfterValueOnSameLine( const Value &root )
{
if ( root.hasComment( commentAfterOnSameLine ) )
*document_ << " " + normalizeEOL( root.getComment( commentAfterOnSameLine ) );
if ( root.hasComment( commentAfter ) )
{
*document_ << "\n";
*document_ << normalizeEOL( root.getComment( commentAfter ) );
*document_ << "\n";
}
}
bool
StyledStreamWriter::hasCommentForValue( const Value &value )
{
return value.hasComment( commentBefore )
|| value.hasComment( commentAfterOnSameLine )
|| value.hasComment( commentAfter );
}
std::string
StyledStreamWriter::normalizeEOL( const std::string &text )
{
std::string normalized;
normalized.reserve( text.length() );
const char *begin = text.c_str();
const char *end = begin + text.length();
const char *current = begin;
while ( current != end )
{
char c = *current++;
if ( c == '\r' ) // mac or dos EOL
{
if ( *current == '\n' ) // convert dos EOL
++current;
normalized += '\n';
}
else // handle unix EOL & other char
normalized += c;
}
return normalized;
}
std::ostream& operator<<( std::ostream &sout, const Value &root )
{
Json::StyledStreamWriter writer;
writer.write(sout, root);
return sout;
}
} // namespace Json
| {
"pile_set_name": "Github"
} |
/*
* Platform Bus device to support dynamic Sysbus devices
*
* Copyright (C) 2014 Freescale Semiconductor, Inc. All rights reserved.
*
* Author: Alexander Graf, <[email protected]>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#include "qemu/osdep.h"
#include "hw/platform-bus.h"
#include "qemu/error-report.h"
#include "sysemu/sysemu.h"
/*
* Returns the PlatformBus IRQ number for a SysBusDevice irq number or -1 if
* the IRQ is not mapped on this Platform bus.
*/
int platform_bus_get_irqn(PlatformBusDevice *pbus, SysBusDevice *sbdev,
int n)
{
qemu_irq sbirq = sysbus_get_connected_irq(sbdev, n);
int i;
for (i = 0; i < pbus->num_irqs; i++) {
if (pbus->irqs[i] == sbirq) {
return i;
}
}
/* IRQ not mapped on platform bus */
return -1;
}
/*
* Returns the PlatformBus MMIO region offset for Region n of a SysBusDevice or
* -1 if the region is not mapped on this Platform bus.
*/
hwaddr platform_bus_get_mmio_addr(PlatformBusDevice *pbus, SysBusDevice *sbdev,
int n)
{
MemoryRegion *pbus_mr = &pbus->mmio;
MemoryRegion *sbdev_mr = sysbus_mmio_get_region(sbdev, n);
Object *pbus_mr_obj = OBJECT(pbus_mr);
Object *parent_mr;
if (!memory_region_is_mapped(sbdev_mr)) {
/* Region is not mapped? */
return -1;
}
parent_mr = object_property_get_link(OBJECT(sbdev_mr), "container", NULL);
assert(parent_mr);
if (parent_mr != pbus_mr_obj) {
/* MMIO region is not mapped on platform bus */
return -1;
}
return object_property_get_uint(OBJECT(sbdev_mr), "addr", NULL);
}
static void platform_bus_count_irqs(SysBusDevice *sbdev, void *opaque)
{
PlatformBusDevice *pbus = opaque;
qemu_irq sbirq;
int n, i;
for (n = 0; ; n++) {
if (!sysbus_has_irq(sbdev, n)) {
break;
}
sbirq = sysbus_get_connected_irq(sbdev, n);
for (i = 0; i < pbus->num_irqs; i++) {
if (pbus->irqs[i] == sbirq) {
bitmap_set(pbus->used_irqs, i, 1);
break;
}
}
}
}
/*
* Loop through all sysbus devices and look for unassigned IRQ lines as well as
* unassociated MMIO regions. Connect them to the platform bus if available.
*/
static void plaform_bus_refresh_irqs(PlatformBusDevice *pbus)
{
bitmap_zero(pbus->used_irqs, pbus->num_irqs);
foreach_dynamic_sysbus_device(platform_bus_count_irqs, pbus);
}
static void platform_bus_map_irq(PlatformBusDevice *pbus, SysBusDevice *sbdev,
int n)
{
int max_irqs = pbus->num_irqs;
int irqn;
if (sysbus_is_irq_connected(sbdev, n)) {
/* IRQ is already mapped, nothing to do */
return;
}
irqn = find_first_zero_bit(pbus->used_irqs, max_irqs);
if (irqn >= max_irqs) {
error_report("Platform Bus: Can not fit IRQ line");
exit(1);
}
set_bit(irqn, pbus->used_irqs);
sysbus_connect_irq(sbdev, n, pbus->irqs[irqn]);
}
static void platform_bus_map_mmio(PlatformBusDevice *pbus, SysBusDevice *sbdev,
int n)
{
MemoryRegion *sbdev_mr = sysbus_mmio_get_region(sbdev, n);
uint64_t size = memory_region_size(sbdev_mr);
uint64_t alignment = (1ULL << (63 - clz64(size + size - 1)));
uint64_t off;
bool found_region = false;
if (memory_region_is_mapped(sbdev_mr)) {
/* Region is already mapped, nothing to do */
return;
}
/*
* Look for empty space in the MMIO space that is naturally aligned with
* the target device's memory region
*/
for (off = 0; off < pbus->mmio_size; off += alignment) {
if (!memory_region_find(&pbus->mmio, off, size).mr) {
found_region = true;
break;
}
}
if (!found_region) {
error_report("Platform Bus: Can not fit MMIO region of size %"PRIx64,
size);
exit(1);
}
/* Map the device's region into our Platform Bus MMIO space */
memory_region_add_subregion(&pbus->mmio, off, sbdev_mr);
}
/*
* Look for unassigned IRQ lines as well as unassociated MMIO regions.
* Connect them to the platform bus if available.
*/
void platform_bus_link_device(PlatformBusDevice *pbus, SysBusDevice *sbdev)
{
int i;
for (i = 0; sysbus_has_irq(sbdev, i); i++) {
platform_bus_map_irq(pbus, sbdev, i);
}
for (i = 0; sysbus_has_mmio(sbdev, i); i++) {
platform_bus_map_mmio(pbus, sbdev, i);
}
}
static void platform_bus_realize(DeviceState *dev, Error **errp)
{
PlatformBusDevice *pbus;
SysBusDevice *d;
int i;
d = SYS_BUS_DEVICE(dev);
pbus = PLATFORM_BUS_DEVICE(dev);
memory_region_init(&pbus->mmio, NULL, "platform bus", pbus->mmio_size);
sysbus_init_mmio(d, &pbus->mmio);
pbus->used_irqs = bitmap_new(pbus->num_irqs);
pbus->irqs = g_new0(qemu_irq, pbus->num_irqs);
for (i = 0; i < pbus->num_irqs; i++) {
sysbus_init_irq(d, &pbus->irqs[i]);
}
/* some devices might be initialized before so update used IRQs map */
plaform_bus_refresh_irqs(pbus);
}
static Property platform_bus_properties[] = {
DEFINE_PROP_UINT32("num_irqs", PlatformBusDevice, num_irqs, 0),
DEFINE_PROP_UINT32("mmio_size", PlatformBusDevice, mmio_size, 0),
DEFINE_PROP_END_OF_LIST()
};
static void platform_bus_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
dc->realize = platform_bus_realize;
dc->props = platform_bus_properties;
}
static const TypeInfo platform_bus_info = {
.name = TYPE_PLATFORM_BUS_DEVICE,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(PlatformBusDevice),
.class_init = platform_bus_class_init,
};
static void platform_bus_register_types(void)
{
type_register_static(&platform_bus_info);
}
type_init(platform_bus_register_types)
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2018 NAVER Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.navercorp.pinpoint.collector.receiver.thrift.tcp;
import com.navercorp.pinpoint.collector.receiver.DispatchHandler;
import com.navercorp.pinpoint.thrift.io.DeserializerFactory;
import com.navercorp.pinpoint.thrift.io.HeaderTBaseDeserializer;
import com.navercorp.pinpoint.thrift.io.HeaderTBaseDeserializerFactory;
import com.navercorp.pinpoint.thrift.io.HeaderTBaseSerializer;
import com.navercorp.pinpoint.thrift.io.HeaderTBaseSerializerFactory;
import com.navercorp.pinpoint.thrift.io.SerializerFactory;
import com.navercorp.pinpoint.thrift.io.ThreadLocalHeaderTBaseDeserializerFactory;
import com.navercorp.pinpoint.thrift.io.ThreadLocalHeaderTBaseSerializerFactory;
import java.util.Objects;
/**
* @author Woonduk Kang(emeroad)
*/
public class DefaultTCPPacketHandlerFactory implements TCPPacketHandlerFactory {
private static final int DEFAULT_UDP_STREAM_MAX_SIZE = HeaderTBaseSerializerFactory.DEFAULT_UDP_STREAM_MAX_SIZE;
private SerializerFactory<HeaderTBaseSerializer> serializerFactory;
private DeserializerFactory<HeaderTBaseDeserializer> deserializerFactory;
public DefaultTCPPacketHandlerFactory() {
}
public void setSerializerFactory(SerializerFactory<HeaderTBaseSerializer> serializerFactory) {
this.serializerFactory = serializerFactory;
}
public void setDeserializerFactory(DeserializerFactory<HeaderTBaseDeserializer> deserializerFactory) {
this.deserializerFactory = deserializerFactory;
}
private DeserializerFactory<HeaderTBaseDeserializer> defaultDeserializerFactory() {
final DeserializerFactory<HeaderTBaseDeserializer> deserializerFactory = new HeaderTBaseDeserializerFactory();
return new ThreadLocalHeaderTBaseDeserializerFactory<>(deserializerFactory);
}
private SerializerFactory<HeaderTBaseSerializer> defaultSerializerFactory() {
final SerializerFactory<HeaderTBaseSerializer> serializerFactory = new HeaderTBaseSerializerFactory(true, DEFAULT_UDP_STREAM_MAX_SIZE);
return new ThreadLocalHeaderTBaseSerializerFactory<>(serializerFactory);
}
@Override
public TCPPacketHandler build(DispatchHandler dispatchHandler) {
Objects.requireNonNull(dispatchHandler, "dispatchHandler");
SerializerFactory<HeaderTBaseSerializer> serializerFactory = this.serializerFactory;
if (serializerFactory == null) {
serializerFactory = defaultSerializerFactory();
}
DeserializerFactory<HeaderTBaseDeserializer> deserializerFactory = this.deserializerFactory;
if (deserializerFactory == null) {
deserializerFactory = defaultDeserializerFactory();
}
return new DefaultTCPPacketHandler(dispatchHandler, serializerFactory, deserializerFactory);
}
}
| {
"pile_set_name": "Github"
} |
local ProviderBase = import(".ProviderBase")
local ProviderAndroid = class("ProviderAndroid", ProviderBase)
local SDK_CLASS_NAME = "com.quick2dx.sdk.UmengUpdateSDK"
function ProviderAndroid:init()
local ok = luaj.callStaticMethod(SDK_CLASS_NAME, "init")
if not ok then
printError("cc.update.ProviderAndroid:init() - call init failed.")
return false
end
return true
end
function ProviderAndroid:addListener()
luaj.callStaticMethod(SDK_CLASS_NAME, "addScriptListener", {handler(self, self.callback_)})
end
function ProviderAndroid:removeListener()
luaj.callStaticMethod(SDK_CLASS_NAME, "removeScriptListener")
end
function ProviderAndroid:update()
local ok = luaj.callStaticMethod(SDK_CLASS_NAME, "update")
if not ok then
printError("cc.update.ProviderAndroid:update() - call update failed.")
return false
end
return true
end
function ProviderAndroid:forceUpdate()
local ok = luaj.callStaticMethod(SDK_CLASS_NAME, "forceUpdate")
if not ok then
printError("cc.update.ProviderAndroid:forceUpdate() - call forceUpdate failed.")
return false
end
return true
end
function ProviderAndroid:silentUpdate()
local ok = luaj.callStaticMethod(SDK_CLASS_NAME, "silentUpdate")
if not ok then
printError("cc.update.ProviderAndroid:silentUpdate() - call silentUpdate failed.")
return false
end
return true
end
return ProviderAndroid
| {
"pile_set_name": "Github"
} |
# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set
# CONFIG_ARM_ERRATA_643719 is not set
# CONFIG_ARM_LPAE is not set
CONFIG_HARDEN_BRANCH_PREDICTOR=y
# CONFIG_MACH_SUN6I is not set
# CONFIG_MACH_SUN7I is not set
# CONFIG_MACH_SUN8I is not set
# CONFIG_MACH_SUN9I is not set
CONFIG_PGTABLE_LEVELS=2
# CONFIG_PHYS_ADDR_T_64BIT is not set
# CONFIG_PINCTRL_SUN6I_A31 is not set
# CONFIG_PINCTRL_SUN6I_A31S is not set
# CONFIG_PINCTRL_SUN6I_A31_R is not set
# CONFIG_PINCTRL_SUN7I_A20 is not set
# CONFIG_PINCTRL_SUN8I_A23 is not set
# CONFIG_PINCTRL_SUN8I_A23_R is not set
# CONFIG_PINCTRL_SUN8I_A33 is not set
# CONFIG_PINCTRL_SUN8I_A83T is not set
# CONFIG_PINCTRL_SUN8I_H3 is not set
# CONFIG_PINCTRL_SUN8I_H3_R is not set
# CONFIG_PINCTRL_SUN9I_A80 is not set
# CONFIG_PINCTRL_SUN9I_A80_R is not set
| {
"pile_set_name": "Github"
} |
//
// Navs
// --------------------------------------------------
// Base class
// --------------------------------------------------
.nav {
margin-bottom: 0;
padding-left: 0; // Override default ul/ol
list-style: none;
&:extend(.clearfix all);
> li {
position: relative;
display: block;
> a {
position: relative;
display: block;
padding: @nav-link-padding;
&:hover,
&:focus {
text-decoration: none;
background-color: @nav-link-hover-bg;
}
}
// Disabled state sets text to gray and nukes hover/tab effects
&.disabled > a {
color: @nav-disabled-link-color;
&:hover,
&:focus {
color: @nav-disabled-link-hover-color;
text-decoration: none;
background-color: transparent;
cursor: not-allowed;
}
}
}
// Open dropdowns
.open > a {
&,
&:hover,
&:focus {
background-color: @nav-link-hover-bg;
border-color: @link-color;
}
}
// Nav dividers (deprecated with v3.0.1)
//
// This should have been removed in v3 with the dropping of `.nav-list`, but
// we missed it. We don't currently support this anywhere, but in the interest
// of maintaining backward compatibility in case you use it, it's deprecated.
.nav-divider {
.nav-divider();
}
// Prevent IE8 from misplacing imgs
//
// See https://github.com/h5bp/html5-boilerplate/issues/984#issuecomment-3985989
> li > a > img {
max-width: none;
}
}
// Tabs
// -------------------------
// Give the tabs something to sit on
.nav-tabs {
border-bottom: 1px solid @nav-tabs-border-color;
> li {
float: left;
// Make the list-items overlay the bottom border
margin-bottom: -1px;
// Actual tabs (as links)
> a {
margin-right: 2px;
line-height: @line-height-base;
border: 1px solid transparent;
border-radius: @border-radius-base @border-radius-base 0 0;
&:hover {
border-color: @nav-tabs-link-hover-border-color @nav-tabs-link-hover-border-color @nav-tabs-border-color;
}
}
// Active state, and its :hover to override normal :hover
&.active > a {
&,
&:hover,
&:focus {
color: @nav-tabs-active-link-hover-color;
background-color: @nav-tabs-active-link-hover-bg;
border: 1px solid @nav-tabs-active-link-hover-border-color;
border-bottom-color: transparent;
cursor: default;
}
}
}
// pulling this in mainly for less shorthand
&.nav-justified {
.nav-justified();
.nav-tabs-justified();
}
}
// Pills
// -------------------------
.nav-pills {
> li {
float: left;
// Links rendered as pills
> a {
border-radius: @nav-pills-border-radius;
}
+ li {
margin-left: 2px;
}
// Active state
&.active > a {
&,
&:hover,
&:focus {
color: @nav-pills-active-link-hover-color;
background-color: @nav-pills-active-link-hover-bg;
}
}
}
}
// Stacked pills
.nav-stacked {
> li {
float: none;
+ li {
margin-top: 2px;
margin-left: 0; // no need for this gap between nav items
}
}
}
// Nav variations
// --------------------------------------------------
// Justified nav links
// -------------------------
.nav-justified {
width: 100%;
> li {
float: none;
> a {
text-align: center;
margin-bottom: 5px;
}
}
> .dropdown .dropdown-menu {
top: auto;
left: auto;
}
@media (min-width: @screen-sm-min) {
> li {
display: table-cell;
width: 1%;
> a {
margin-bottom: 0;
}
}
}
}
// Move borders to anchors instead of bottom of list
//
// Mixin for adding on top the shared `.nav-justified` styles for our tabs
.nav-tabs-justified {
border-bottom: 0;
> li > a {
// Override margin from .nav-tabs
margin-right: 0;
border-radius: @border-radius-base;
}
> .active > a,
> .active > a:hover,
> .active > a:focus {
border: 1px solid @nav-tabs-justified-link-border-color;
}
@media (min-width: @screen-sm-min) {
> li > a {
border-bottom: 1px solid @nav-tabs-justified-link-border-color;
border-radius: @border-radius-base @border-radius-base 0 0;
}
> .active > a,
> .active > a:hover,
> .active > a:focus {
border-bottom-color: @nav-tabs-justified-active-link-border-color;
}
}
}
// Tabbable tabs
// -------------------------
// Hide tabbable panes to start, show them when `.active`
.tab-content {
> .tab-pane {
display: none;
}
> .active {
display: block;
}
}
// Dropdowns
// -------------------------
// Specific dropdowns
.nav-tabs .dropdown-menu {
// make dropdown border overlap tab border
margin-top: -1px;
// Remove the top rounded corners here since there is a hard edge above the menu
.border-top-radius(0);
}
| {
"pile_set_name": "Github"
} |
import React, { Component } from "react";
import PropTypes from "prop-types";
import { Link } from "react-router-dom";
import styled from "styled-components";
import { showMenu } from "../layout/ContextMenu";
import { MenuButton } from "../inputs/Button";
import StylableContextMenuTrigger from "./StylableContextMenuTrigger";
import { EllipsisV } from "styled-icons/fa-solid/EllipsisV";
function collectMenuProps({ project }) {
return { project };
}
const StyledProjectGridItem = styled(Link)`
display: flex;
flex-direction: column;
height: 220px;
border-radius: 6px;
background-color: ${props => props.theme.toolbar};
text-decoration: none;
border: 1px solid transparent;
&:hover {
color: inherit;
border-color: ${props => props.theme.selected};
}
`;
const StyledContextMenuTrigger = styled(StylableContextMenuTrigger)`
display: flex;
flex-direction: column;
flex: 1;
border-top-left-radius: inherit;
border-top-right-radius: inherit;
`;
const TitleContainer = styled.div`
display: flex;
height: 50px;
align-items: center;
padding: 0 16px;
h3 {
font-size: 16px;
}
button {
margin-left: auto;
svg {
width: 1em;
height: 1em;
}
}
`;
const ThumbnailContainer = styled.div`
display: flex;
flex: 1 0 auto;
justify-content: center;
align-items: stretch;
background-color: ${props => props.theme.panel};
overflow: hidden;
border-top-left-radius: inherit;
border-top-right-radius: inherit;
`;
const Thumbnail = styled.div`
display: flex;
flex: 1;
background-size: cover;
background-position: 50%;
background-repeat: no-repeat;
background-image: url(${props => props.src});
`;
const Col = styled.div`
display: flex;
flex-direction: column;
p {
color: ${props => props.theme.text2};
}
`;
export default class ProjectGridItem extends Component {
static propTypes = {
contextMenuId: PropTypes.string,
project: PropTypes.object.isRequired
};
onShowMenu = event => {
event.preventDefault();
event.stopPropagation();
const x = event.clientX || (event.touches && event.touches[0].pageX);
const y = event.clientY || (event.touches && event.touches[0].pageY);
showMenu({
position: { x, y },
target: event.currentTarget,
id: this.props.contextMenuId,
data: {
project: this.props.project
}
});
};
render() {
const { project, contextMenuId } = this.props;
const creatorAttribution = project.attributions && project.attributions.creator;
const content = (
<>
<ThumbnailContainer>{project.thumbnail_url && <Thumbnail src={project.thumbnail_url} />}</ThumbnailContainer>
<TitleContainer>
<Col>
<h3>{project.name}</h3>
{creatorAttribution && <p>{creatorAttribution}</p>}
</Col>
{contextMenuId && (
<MenuButton onClick={this.onShowMenu}>
<EllipsisV />
</MenuButton>
)}
</TitleContainer>
</>
);
if (contextMenuId) {
return (
<StyledProjectGridItem to={project.url}>
<StyledContextMenuTrigger id={contextMenuId} project={project} collect={collectMenuProps} holdToDisplay={-1}>
{content}
</StyledContextMenuTrigger>
</StyledProjectGridItem>
);
} else {
return <StyledProjectGridItem to={project.url}>{content}</StyledProjectGridItem>;
}
}
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.20706</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{A124952A-117C-46F4-9F00-A468024FBF35}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>
</RootNamespace>
<AssemblyName>OptionsPage.UnitTests</AssemblyName>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
<OptionStrict>On</OptionStrict>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>.\bin\Debug\</OutputPath>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<WarningsAsErrors>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036</WarningsAsErrors>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>false</DebugSymbols>
<Optimize>true</Optimize>
<OutputPath>.\bin\Release\</OutputPath>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<WarningsAsErrors>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036</WarningsAsErrors>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.OLE.Interop" />
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
<Reference Include="Microsoft.VisualStudio.Shell.9.0" />
<Reference Include="Microsoft.VisualStudio.Shell.Interop" />
<Reference Include="Microsoft.VisualStudio.Shell.Interop.8.0" />
<Reference Include="Microsoft.VisualStudio.Shell.Interop.9.0" />
<Reference Include="Microsoft.VSSDK.UnitTestLibrary" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="OptionsCompositeControlTest.vb" />
<Compile Include="OptionsPageCustomTest.vb" />
<Compile Include="OptionsPageGeneralTest.vb" />
<Compile Include="OptionsPagePackageTest.vb" />
<Compile Include="MockServiceProvider.vb" />
<Compile Include="Properties\AssemblyInfo.vb" />
<Compile Include="VSCodeGenAccessors.vb" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OptionsPageVB.vbproj">
<Project>{D50E281B-0159-4C5A-BE6C-FBC8F6D213F4}</Project>
<Name>OptionsPage</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Service Include="{B4F97281-0DBD-4835-9ED8-7DFB966E87FF}" />
</ItemGroup>
<ItemGroup>
<Folder Include="My Project\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.Targets" />
</Project> | {
"pile_set_name": "Github"
} |
// Package oauth implements a oAuth 1.0a client.
package oauth
| {
"pile_set_name": "Github"
} |
fileFormatVersion: 2
guid: cc823bbddcf8841f98a732b2ccec6166
timeCreated: 1447702103
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
| {
"pile_set_name": "Github"
} |
exports.store = {
mixinCallback: function() {
const Store = require('../store')
Store.addExceptionType(function RecordNotFoundError(Model) {
Error.apply(this)
this.message = "Can't find any record for " + Model.definition.modelName
})
}
}
/*
* MODEL
*/
exports.model = {
/**
* When called, it will throw an error if the resultset is empty
* @class Model
* @method expectResult
*
* @see Model.get
*
* @return {Model}
*/
expectResult: function() {
var self = this.chain()
self.setInternal('expectResult', true)
return self
}
}
/*
* DEFINITION
*/
exports.definition = {
mixinCallback: function() {
const Store = require('../store')
this.afterFind(function(data) {
var expectResult = this.getInternal('expectResult')
if (expectResult && (!data.result || data.result.length === 0)) {
return Promise.reject(new Store.RecordNotFoundError(this))
}
}, 10)
}
}
| {
"pile_set_name": "Github"
} |
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = onlyOnce;
function onlyOnce(fn) {
return function () {
if (fn === null) throw new Error("Callback was already called.");
var callFn = fn;
fn = null;
callFn.apply(this, arguments);
};
}
module.exports = exports["default"]; | {
"pile_set_name": "Github"
} |
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.5
bos/algorithm/CMakeFiles/algorithm.dir/algo_base64.o
../bos/algorithm/../../Examples/Test/bos_config/b_config.h
../bos/algorithm/../core/inc/b_common.h
../bos/algorithm/../modules/inc/b_mod_log.h
../bos/algorithm/inc/algo_base64.h
/home/r/Desktop/BabyOS/bos/algorithm/algo_base64.c
bos/algorithm/CMakeFiles/algorithm.dir/algo_gps.o
../bos/algorithm/inc/algo_gps.h
../bos/algorithm/inc/algo_kalman.h
../bos/algorithm/inc/algo_matrix.h
/home/r/Desktop/BabyOS/bos/algorithm/algo_gps.c
bos/algorithm/CMakeFiles/algorithm.dir/algo_hmac_sha1.o
../bos/algorithm/../../Examples/Test/bos_config/b_config.h
../bos/algorithm/../core/inc/b_common.h
../bos/algorithm/../modules/inc/b_mod_log.h
../bos/algorithm/inc/algo_hmac_sha1.h
/home/r/Desktop/BabyOS/bos/algorithm/algo_hmac_sha1.c
bos/algorithm/CMakeFiles/algorithm.dir/algo_kalman.o
../bos/algorithm/inc/algo_kalman.h
../bos/algorithm/inc/algo_matrix.h
/home/r/Desktop/BabyOS/bos/algorithm/algo_kalman.c
bos/algorithm/CMakeFiles/algorithm.dir/algo_matrix.o
../bos/algorithm/inc/algo_matrix.h
/home/r/Desktop/BabyOS/bos/algorithm/algo_matrix.c
bos/algorithm/CMakeFiles/algorithm.dir/algo_sort.o
../bos/algorithm/../../Examples/Test/bos_config/b_config.h
../bos/algorithm/../core/inc/b_common.h
../bos/algorithm/../modules/inc/b_mod_log.h
../bos/algorithm/inc/algo_sort.h
/home/r/Desktop/BabyOS/bos/algorithm/algo_sort.c
bos/algorithm/CMakeFiles/algorithm.dir/algo_speedpid.o
../bos/algorithm/inc/algo_speedpid.h
/home/r/Desktop/BabyOS/bos/algorithm/algo_speedpid.c
| {
"pile_set_name": "Github"
} |
{ stdenv, lib, fetchFromGitHub, buildGoModule, libnotify, makeWrapper, pcsclite, pinentry_mac, pkgconfig, darwin }:
buildGoModule rec {
pname = "yubikey-agent";
version = "0.1.3";
src = fetchFromGitHub {
owner = "FiloSottile";
repo = pname;
rev = "v${version}";
sha256 = "07gix5wrakn4z846zhvl66lzwx58djrfnn6m8v7vc69l9jr3kihr";
};
buildInputs =
lib.optional stdenv.isLinux (lib.getDev pcsclite)
++ lib.optional stdenv.isDarwin (darwin.apple_sdk.frameworks.PCSC);
nativeBuildInputs = [ makeWrapper pkgconfig ];
# pull in go-piv/piv-go#75
# once go-piv/piv-go#75 is merged and released, we should
# use the released version (and push upstream to do the same)
patches = [ ./use-piv-go-75.patch ];
postPatch = lib.optionalString stdenv.isLinux ''
substituteInPlace main.go --replace 'notify-send' ${libnotify}/bin/notify-send
'';
vendorSha256 = "128mlsagj3im6h0p0ndhzk29ya47g19im9dldx3nmddf2jlccj2h";
doCheck = false;
subPackages = [ "." ];
# On macOS, there isn't a choice of pinentry program, so let's
# ensure the nixpkgs-provided one is available
postInstall = lib.optionalString stdenv.isDarwin ''
wrapProgram $out/bin/yubikey-agent --suffix PATH : $(dirname ${pinentry_mac}/${pinentry_mac.binaryPath})
''
# Note: in the next release, upstream provides
# contrib/systemd/user/yubikey-agent.service, which we should use
# instead
# See https://github.com/FiloSottile/yubikey-agent/pull/43
+ lib.optionalString stdenv.isLinux ''
mkdir -p $out/lib/systemd/user
substitute ${./yubikey-agent.service} $out/lib/systemd/user/yubikey-agent.service \
--replace 'ExecStart=yubikey-agent' "ExecStart=$out/bin/yubikey-agent"
'';
meta = with lib; {
description = "A seamless ssh-agent for YubiKeys";
license = licenses.bsd3;
homepage = "https://filippo.io/yubikey-agent";
maintainers = with lib.maintainers; [ philandstuff rawkode ];
platforms = platforms.darwin ++ platforms.linux;
};
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.ddmlib;
import com.android.annotations.NonNull;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
public class ByteBufferUtil {
@NonNull
public static ByteBuffer mapFile(@NonNull File f, long offset, @NonNull ByteOrder byteOrder) throws IOException {
FileInputStream dataFile = new FileInputStream(f);
try {
FileChannel fc = dataFile.getChannel();
MappedByteBuffer buffer = fc.map(FileChannel.MapMode.READ_ONLY, offset, f.length() - offset);
buffer.order(byteOrder);
return buffer;
} finally {
dataFile.close(); // this *also* closes the associated channel, fc
}
}
@NonNull
public static String getString(@NonNull ByteBuffer buf, int len) {
char[] data = new char[len];
for (int i = 0; i < len; i++)
data[i] = buf.getChar();
return new String(data);
}
public static void putString(@NonNull ByteBuffer buf, @NonNull String str) {
int len = str.length();
for (int i = 0; i < len; i++)
buf.putChar(str.charAt(i));
}
}
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>OpenNSL API Guide and Reference Manual: include/opennsl/l2X.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen_brcm.css" rel="stylesheet" type="text/css" />
<link href="tabs_brcm.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">OpenNSL API Guide and Reference Manual
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.2 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Welcome</span></a></li>
<li><a href="pages.html"><span>OpenNSL Documentation</span></a></li>
<li><a href="modules.html"><span>API Reference</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_1ef4272f53c39789ce5afb3d17b42872.html">opennsl</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">l2X.h</div> </div>
</div><!--header-->
<div class="contents">
<a href="l2X_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> </div>
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">/*****************************************************************************</span></div>
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment"> * </span></div>
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment"> * This software is governed by the Broadcom Advanced Switch APIs license.</span></div>
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"> * This license is set out in the</span></div>
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> * https://github.com/Broadcom-Switch/OpenNSL/Legal/LICENSE-Adv file.</span></div>
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"> * </span></div>
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment"> * Copyright 2015-2016 Broadcom Corporation. All rights reserved.</span></div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment"> * </span></div>
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment"> ***************************************************************************/</span></div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="preprocessor">#ifndef __OPENNSL_L2X_H__</span></div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="preprocessor"></span><span class="preprocessor">#define __OPENNSL_L2X_H__</span></div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="preprocessor"></span></div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="preprocessor">#include <<a class="code" href="opennsl_2types_8h.html">opennsl/types.h</a>></span></div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span> </div>
<div class="line"><a name="l00021"></a><span class="lineno"><a class="code" href="group__l2.html#gaf9428658416d9baf54548d5a3a31bc8d"> 21</a></span> <span class="preprocessor">#define OPENNSL_L2_LEARN_LIMIT_SYSTEM 0x00000001 </span></div>
<div class="line"><a name="l00023"></a><span class="lineno"><a class="code" href="structopennsl__l2__learn__limit__s.html"> 23</a></span> <span class="preprocessor">typedef struct opennsl_l2_learn_limit_s {</span></div>
<div class="line"><a name="l00024"></a><span class="lineno"><a class="code" href="structopennsl__l2__learn__limit__s.html#a8210826064e25b4fe0343c028711314b"> 24</a></span> <span class="preprocessor"></span> <a class="code" href="sal_2types_8h.html#a1134b580f8da4de94ca6b1de4d37975e">uint32</a> flags; </div>
<div class="line"><a name="l00026"></a><span class="lineno"><a class="code" href="structopennsl__l2__learn__limit__s.html#a712c52144cea0851989338049d399d4c"> 26</a></span>  <span class="keywordtype">int</span> limit; </div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span> } <a class="code" href="group__l2.html#gaa72880fb68ad0992ebf025dc8b4c99eb" title="L2 learn limit structure.">opennsl_l2_learn_limit_t</a>;</div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span> <span class="comment">/* __doxy_func_body_end__ */</span></div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span> </div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span> <span class="comment">/***************************************************************************/</span></div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span> <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="group__l2.html#ga2b1399eb02adb21f08a2d9aed8b86e3e" title="Initialize an L2 learn limit structure.">opennsl_l2_learn_limit_t_init</a>(</div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  <a class="code" href="structopennsl__l2__learn__limit__s.html" title="L2 learn limit structure.">opennsl_l2_learn_limit_t</a> *limit) <a class="code" href="commdefs_8h.html#ae4b46fd67f240eb74299c3cc714368f1">LIB_DLL_EXPORTED</a> ;</div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span> </div>
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span> <span class="comment">/***************************************************************************/</span></div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="group__l2.html#ga9f4bdec18827c69ffd22f33e5258b901" title="Set/Get L2 addresses learn limit.">opennsl_l2_learn_limit_set</a>(</div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  <span class="keywordtype">int</span> unit, </div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  <a class="code" href="structopennsl__l2__learn__limit__s.html" title="L2 learn limit structure.">opennsl_l2_learn_limit_t</a> *limit) <a class="code" href="commdefs_8h.html#ae4b46fd67f240eb74299c3cc714368f1">LIB_DLL_EXPORTED</a> ;</div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span> </div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span> <span class="comment">/***************************************************************************/</span></div>
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="group__l2.html#gaf9bc593fb78f7c7e89d3e4dfb5809e2b" title="Set/Get L2 addresses learn limit.">opennsl_l2_learn_limit_get</a>(</div>
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>  <span class="keywordtype">int</span> unit, </div>
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>  <a class="code" href="structopennsl__l2__learn__limit__s.html" title="L2 learn limit structure.">opennsl_l2_learn_limit_t</a> *limit) <a class="code" href="commdefs_8h.html#ae4b46fd67f240eb74299c3cc714368f1">LIB_DLL_EXPORTED</a> ;</div>
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span> </div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span> <span class="preprocessor">#endif </span><span class="comment">/* __OPENNSL_L2X_H__ */</span><span class="preprocessor"></span></div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span> <span class="preprocessor"></span></div>
</div><!-- fragment --></div><!-- contents -->
<!-- HTML footer for doxygen 1.8.5-->
<!-- start footer part -->
<!--BEGIN GENERATE_TREEVIEW -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<hr>
<p>
<table class="footer-brcm">
<tr>
<td class="footer-brcm"><img src="BRCM_Red+Black_noTag_RGB.png" align=left></td>
<td class="footer-brcm"><small><b>© 2016-17 by Broadcom Limited. All rights reserved.</b></small>
<div class="footer-brcm"><small>Broadcom Limited reserves the right to make changes without further notice to any products or data herein to improve reliability, function, or design.
Information furnished by Broadcom Limited is believed to be accurate and reliable. However, Broadcom Limited does not assume any liability arising
out of the application or use of this information, nor the application or use of any product or circuit described herein, neither does it convey any license
under its patent rights nor the rights of others. </small>
</div>
</td>
</tr>
</table>
</p>
</div>
<!--END GENERATE_TREEVIEW-->
</body>
</html>
| {
"pile_set_name": "Github"
} |
/*
* Copyright 1998-2000 Sun Microsystems, Inc. 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. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package javax.swing.text.html;
import javax.swing.text.*;
import java.awt.*;
/**
* This is the view associated with the html tag NOFRAMES.
* This view has been written to ignore the contents of the
* NOFRAMES tag. The contents of the tag will only be visible
* when the JTextComponent the view is contained in is editable.
*
* @author Sunita Mani
*/
class NoFramesView extends BlockView {
/**
* Creates a new view that represents an
* html box. This can be used for a number
* of elements. By default this view is not
* visible.
*
* @param elem the element to create a view for
* @param axis either View.X_AXIS or View.Y_AXIS
*/
public NoFramesView(Element elem, int axis) {
super(elem, axis);
visible = false;
}
/**
* If this view is not visible, then it returns.
* Otherwise it invokes the superclass.
*
* @param g the rendering surface to use
* @param allocation the allocated region to render into
* @see #isVisible
* @see text.ParagraphView#paint
*/
public void paint(Graphics g, Shape allocation) {
Container host = getContainer();
if (host != null &&
visible != ((JTextComponent)host).isEditable()) {
visible = ((JTextComponent)host).isEditable();
}
if (!isVisible()) {
return;
}
super.paint(g, allocation);
}
/**
* Determines if the JTextComponent that the view
* is contained in is editable. If so, then this
* view and all its child views are visible.
* Once this has been determined, the superclass
* is invoked to continue processing.
*
* @param p the parent View.
* @see BlockView#setParent
*/
public void setParent(View p) {
if (p != null) {
Container host = p.getContainer();
if (host != null) {
visible = ((JTextComponent)host).isEditable();
}
}
super.setParent(p);
}
/**
* Returns a true/false value that represents
* whether the view is visible or not.
*/
public boolean isVisible() {
return visible;
}
/**
* Do nothing if the view is not visible, otherwise
* invoke the superclass to perform layout.
*/
protected void layout(int width, int height) {
if (!isVisible()) {
return;
}
super.layout(width, height);
}
/**
* Determines the preferred span for this view. Returns
* 0 if the view is not visible, otherwise it calls the
* superclass method to get the preferred span.
* axis.
*
* @param axis may be either View.X_AXIS or View.Y_AXIS
* @return the span the view would like to be rendered into;
* typically the view is told to render into the span
* that is returned, although there is no guarantee;
* the parent may choose to resize or break the view
* @see text.ParagraphView#getPreferredSpan
*/
public float getPreferredSpan(int axis) {
if (!visible) {
return 0;
}
return super.getPreferredSpan(axis);
}
/**
* Determines the minimum span for this view along an
* axis. Returns 0 if the view is not visible, otherwise
* it calls the superclass method to get the minimum span.
*
* @param axis may be either <code>View.X_AXIS</code> or
* <code>View.Y_AXIS</code>
* @return the minimum span the view can be rendered into
* @see text.ParagraphView#getMinimumSpan
*/
public float getMinimumSpan(int axis) {
if (!visible) {
return 0;
}
return super.getMinimumSpan(axis);
}
/**
* Determines the maximum span for this view along an
* axis. Returns 0 if the view is not visible, otherwise
* it calls the superclass method ot get the maximum span.
*
* @param axis may be either <code>View.X_AXIS</code> or
* <code>View.Y_AXIS</code>
* @return the maximum span the view can be rendered into
* @see text.ParagraphView#getMaximumSpan
*/
public float getMaximumSpan(int axis) {
if (!visible) {
return 0;
}
return super.getMaximumSpan(axis);
}
boolean visible;
}
| {
"pile_set_name": "Github"
} |
# coding=utf-8
# Copyright 2018 The HuggingFace Inc. team.
#
# 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.
"""Tokenization classes for DistilBERT."""
from __future__ import absolute_import, division, print_function, unicode_literals
import collections
import logging
import os
import unicodedata
from io import open
from .tokenization_bert import BertTokenizer
logger = logging.getLogger(__name__)
VOCAB_FILES_NAMES = {'vocab_file': 'vocab.txt'}
PRETRAINED_VOCAB_FILES_MAP = {
'vocab_file':
{
'distilbert-base-uncased': "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-uncased-vocab.txt",
'distilbert-base-uncased-distilled-squad': "https://s3.amazonaws.com/models.huggingface.co/bert/bert-large-uncased-vocab.txt",
}
}
PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {
'distilbert-base-uncased': 512,
'distilbert-base-uncased-distilled-squad': 512,
}
class DistilBertTokenizer(BertTokenizer):
r"""
Constructs a DistilBertTokenizer.
:class:`~transformers.DistilBertTokenizer` is identical to BertTokenizer and runs end-to-end tokenization: punctuation splitting + wordpiece
Args:
vocab_file: Path to a one-wordpiece-per-line vocabulary file
do_lower_case: Whether to lower case the input. Only has an effect when do_wordpiece_only=False
do_basic_tokenize: Whether to do basic tokenization before wordpiece.
max_len: An artificial maximum length to truncate tokenized sequences to; Effective maximum length is always the
minimum of this value (if specified) and the underlying BERT model's sequence length.
never_split: List of tokens which will never be split during tokenization. Only has an effect when
do_wordpiece_only=False
"""
vocab_files_names = VOCAB_FILES_NAMES
pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
| {
"pile_set_name": "Github"
} |
$aui-progress-color: rgba(#fff, .3);
.aui-progress {
&.aui-theme-light {
background: $aui-progress-color;
}
}
| {
"pile_set_name": "Github"
} |
//! These prelude re-exports are a set of exports that are commonly used from
//! within the library.
//!
//! These are not publicly re-exported to the end user, and must stay as a
//! private module.
pub type JsonMap = Map<String, Value>;
pub use crate::error::{Error, Result};
pub use serde_json::{Map, Number, Value};
pub use std::result::Result as StdResult;
#[cfg(feature = "client")]
pub use crate::client::ClientError;
| {
"pile_set_name": "Github"
} |
class Outer {
class Nested
}
fun Outer.<caret>
// INVOCATION_COUNT: 0
// EXIST: Nested
// NOTHING_ELSE | {
"pile_set_name": "Github"
} |
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "net/ssl/signed_certificate_timestamp_and_status.h"
#include "net/cert/signed_certificate_timestamp.h"
namespace net {
SignedCertificateTimestampAndStatus::SignedCertificateTimestampAndStatus(
const scoped_refptr<ct::SignedCertificateTimestamp>& sct,
const ct::SCTVerifyStatus status)
: sct(sct), status(status) {}
SignedCertificateTimestampAndStatus::~SignedCertificateTimestampAndStatus() {}
} // namespace net
| {
"pile_set_name": "Github"
} |
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="edu.vuum.mocca"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:uiOptions="splitActionBarWhenNarrow">
<activity
android:name=".ThreadedDownloadsActivity"
android:label="@string/title_activity_threadeddownloads" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
| {
"pile_set_name": "Github"
} |
TIMESTAMP = 1593628564
SHA256 (simdjson-simdjson-v0.4.6_GH0.tar.gz) = 2e6e708a5973eef7442ab19b3fe76bdd791cdc9b67020ca1190e00832517808b
SIZE (simdjson-simdjson-v0.4.6_GH0.tar.gz) = 4119406
| {
"pile_set_name": "Github"
} |
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Drawing.Text;
namespace Svg
{
/// <summary>
/// Convenience wrapper around a graphics object
/// </summary>
public sealed class SvgRenderer : ISvgRenderer, IGraphicsProvider
{
private readonly Graphics _innerGraphics;
private readonly bool _disposable;
private readonly Image _image;
private readonly Stack<ISvgBoundable> _boundables = new Stack<ISvgBoundable>();
public void SetBoundable(ISvgBoundable boundable)
{
_boundables.Push(boundable);
}
public ISvgBoundable GetBoundable()
{
return _boundables.Count > 0 ? _boundables.Peek() : null;
}
public ISvgBoundable PopBoundable()
{
return _boundables.Pop();
}
public float DpiY
{
get { return _innerGraphics.DpiY; }
}
/// <summary>
/// Initializes a new instance of the <see cref="ISvgRenderer"/> class.
/// </summary>
private SvgRenderer(Graphics graphics, bool disposable = true)
{
_innerGraphics = graphics;
_disposable = disposable;
}
private SvgRenderer(Graphics graphics, Image image)
: this(graphics)
{
_image = image;
}
public void DrawImage(Image image, RectangleF destRect, RectangleF srcRect, GraphicsUnit graphicsUnit)
{
_innerGraphics.DrawImage(image, destRect, srcRect, graphicsUnit);
}
public void DrawImage(Image image, RectangleF destRect, RectangleF srcRect, GraphicsUnit graphicsUnit, float opacity)
{
using (var attributes = new ImageAttributes())
{
var matrix = new ColorMatrix { Matrix33 = opacity };
attributes.SetColorMatrix(matrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
var points = new[]
{
destRect.Location,
new PointF(destRect.X + destRect.Width, destRect.Y),
new PointF(destRect.X, destRect.Y + destRect.Height)
};
_innerGraphics.DrawImage(image, points, srcRect, graphicsUnit, attributes);
}
}
public void DrawImageUnscaled(Image image, Point location)
{
_innerGraphics.DrawImageUnscaled(image, location);
}
public void DrawPath(Pen pen, GraphicsPath path)
{
_innerGraphics.DrawPath(pen, path);
}
public void FillPath(Brush brush, GraphicsPath path)
{
_innerGraphics.FillPath(brush, path);
}
public Region GetClip()
{
return _innerGraphics.Clip;
}
public void RotateTransform(float fAngle, MatrixOrder order = MatrixOrder.Append)
{
_innerGraphics.RotateTransform(fAngle, order);
}
public void ScaleTransform(float sx, float sy, MatrixOrder order = MatrixOrder.Append)
{
_innerGraphics.ScaleTransform(sx, sy, order);
}
public void SetClip(Region region, CombineMode combineMode = CombineMode.Replace)
{
_innerGraphics.SetClip(region, combineMode);
}
public void TranslateTransform(float dx, float dy, MatrixOrder order = MatrixOrder.Append)
{
_innerGraphics.TranslateTransform(dx, dy, order);
}
public SmoothingMode SmoothingMode
{
get { return _innerGraphics.SmoothingMode; }
set { _innerGraphics.SmoothingMode = value; }
}
public Matrix Transform
{
get { return _innerGraphics.Transform; }
set { _innerGraphics.Transform = value; }
}
public void Dispose()
{
if (_disposable)
_innerGraphics.Dispose();
if (_image != null)
_image.Dispose();
}
Graphics IGraphicsProvider.GetGraphics()
{
return _innerGraphics;
}
private static Graphics CreateGraphics(Image image)
{
var g = Graphics.FromImage(image);
g.PixelOffsetMode = PixelOffsetMode.Half;
g.CompositingQuality = CompositingQuality.HighQuality;
g.TextRenderingHint = TextRenderingHint.AntiAlias;
g.TextContrast = 1;
return g;
}
/// <summary>
/// Creates a new <see cref="ISvgRenderer"/> from the specified <see cref="Image"/>.
/// </summary>
/// <param name="image"><see cref="Image"/> from which to create the new <see cref="ISvgRenderer"/>.</param>
public static ISvgRenderer FromImage(Image image)
{
var g = CreateGraphics(image);
return new SvgRenderer(g);
}
/// <summary>
/// Creates a new <see cref="ISvgRenderer"/> from the specified <see cref="Graphics"/>.
/// </summary>
/// <param name="graphics">The <see cref="Graphics"/> to create the renderer from.</param>
public static ISvgRenderer FromGraphics(Graphics graphics)
{
return new SvgRenderer(graphics, false);
}
public static ISvgRenderer FromNull()
{
var img = new Bitmap(1, 1);
var g = CreateGraphics(img);
return new SvgRenderer(g, img);
}
}
}
| {
"pile_set_name": "Github"
} |
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html">
<!--
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
The contents of this file are subject to the terms of either the GNU
General Public License Version 2 only ("GPL") or the Common Development
and Distribution License("CDDL") (collectively, the "License"). You
may not use this file except in compliance with the License. You can
obtain a copy of the License at
https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
or packager/legal/LICENSE.txt. See the License for the specific
language governing permissions and limitations under the License.
When distributing the software, include this License Header Notice in each
file and include the License file at packager/legal/LICENSE.txt.
GPL Classpath Exception:
Oracle designates this particular file as subject to the "Classpath"
exception as provided by Oracle in the GPL Version 2 section of the License
file that accompanied this code.
Modifications:
If applicable, add the following below the License Header, with the fields
enclosed by brackets [] replaced by your own identifying information:
"Portions Copyright [year] [name of copyright owner]"
Contributor(s):
If you wish your version of this file to be governed by only the CDDL or
only the GPL Version 2, indicate your decision by adding "[Contributor]
elects to include this software in this distribution under the [CDDL or GPL
Version 2] license." If you don't indicate a single choice of license, a
recipient has the option to distribute your version of this file under
either the CDDL, the GPL Version 2 or to extend the choice of license to
its licensees as provided above. However, if you add GPL Version 2 code
and therefore, elected the GPL Version 2 license, then the option applies
only if the new code is made subject to such option by the copyright
holder.
-->
<body>
<ui:composition template="/templates/issue2997-template.xhtml">
<ui:define name="content">
Page 01 in the flow
<p id="beanMessage">#{issue2997Bean.name}</p>
<h:form prependId="false">
<h:commandButton action="page02" value="page02" id="page02" />
</h:form>
</ui:define>
</ui:composition>
</body>
</html>
| {
"pile_set_name": "Github"
} |
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE122_Heap_Based_Buffer_Overflow__c_dest_char_cpy_52b.c
Label Definition File: CWE122_Heap_Based_Buffer_Overflow__c_dest.label.xml
Template File: sources-sink-52b.tmpl.c
*/
/*
* @description
* CWE: 122 Heap Based Buffer Overflow
* BadSource: Allocate using malloc() and set data pointer to a small buffer
* GoodSource: Allocate using malloc() and set data pointer to a large buffer
* Sink: cpy
* BadSink : Copy string to data using strcpy
* Flow Variant: 52 Data flow: data passed as an argument from one function to another to another in three different source files
*
* */
#include "std_testcase.h"
#include <wchar.h>
/* all the sinks are the same, we just want to know where the hit originated if a tool flags one */
#ifndef OMITBAD
/* bad function declaration */
void CWE122_Heap_Based_Buffer_Overflow__c_dest_char_cpy_52c_badSink(char * data);
void CWE122_Heap_Based_Buffer_Overflow__c_dest_char_cpy_52b_badSink(char * data)
{
CWE122_Heap_Based_Buffer_Overflow__c_dest_char_cpy_52c_badSink(data);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* good function declaration */
void CWE122_Heap_Based_Buffer_Overflow__c_dest_char_cpy_52c_goodG2BSink(char * data);
/* goodG2B uses the GoodSource with the BadSink */
void CWE122_Heap_Based_Buffer_Overflow__c_dest_char_cpy_52b_goodG2BSink(char * data)
{
CWE122_Heap_Based_Buffer_Overflow__c_dest_char_cpy_52c_goodG2BSink(data);
}
#endif /* OMITGOOD */
| {
"pile_set_name": "Github"
} |
/*******************************************************************************
* Copyright 2014 GeoData <[email protected]>
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*******************************************************************************/
/**
* @file ctb-export.cpp
* @brief The terrain export tool
*
* This tool takes a terrain file with associated tile coordinate information
* and converts it to a GeoTiff using the height information within the tile.
*/
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <string>
#include "gdal_priv.h"
#include "commander.hpp"
#include "config.hpp"
#include "CTBException.hpp"
#include "TerrainTile.hpp"
#include "GlobalGeodetic.hpp"
using namespace std;
using namespace ctb;
/// Handle the terrain export CLI options
class TerrainExport : public Command {
public:
TerrainExport(const char *name, const char *version) :
Command(name, version),
inputFilename(NULL),
outputFilename(NULL),
zoom(0),
tx(0),
ty(0)
{}
static void
setInputFilename(command_t *command) {
TerrainExport *self = static_cast<TerrainExport *>(Command::self(command));
self->inputFilename = command->arg;
self->membersSet |= TT_INPUT;
}
static void
setOutputFilename(command_t *command) {
TerrainExport *self = static_cast<TerrainExport *>(Command::self(command));
self->outputFilename = command->arg;
self->membersSet |= TT_OUTPUT;
}
static void
setZoomLevel(command_t *command) {
TerrainExport *self = static_cast<TerrainExport *>(Command::self(command));
self->zoom = atoi(command->arg);
self->membersSet |= TT_ZOOM;
}
static void
setTileX(command_t *command) {
TerrainExport *self = static_cast<TerrainExport *>(Command::self(command));
self->tx = atoi(command->arg);
self->membersSet |= TT_TX;
}
static void
setTileY(command_t *command) {
TerrainExport *self = static_cast<TerrainExport *>(Command::self(command));
self->ty = atoi(command->arg);
self->membersSet |= TT_TY;
}
void
check() const {
bool failed = false;
if ((membersSet & TT_INPUT) != TT_INPUT) {
cerr << " Error: The input filename must be specified" << endl;
failed = true;
}
if ((membersSet & TT_OUTPUT) != TT_OUTPUT) {
cerr << " Error: The output filename must be specified" << endl;
failed = true;
}
if ((membersSet & TT_ZOOM) != TT_ZOOM) {
cerr << " Error: The zoom level be specified" << endl;
failed = true;
}
if ((membersSet & TT_TX) != TT_TX) {
cerr << " Error: The X tile coordinate must be specified" << endl;
failed = true;
}
if ((membersSet & TT_TY) != TT_TY) {
cerr << " Error: The Y tile coordinate must be specified" << endl;
failed = true;
}
if (failed) {
help(); // print help and exit
}
}
const char *inputFilename;
const char *outputFilename;
i_zoom zoom;
i_tile tx, ty;
private:
char membersSet;
enum members {
TT_INPUT = 1, // 2^0, bit 0
TT_OUTPUT = 2, // 2^1, bit 1
TT_ZOOM = 4, // 2^2, bit 2
TT_TX = 8, // 2^3, bit 3
TT_TY = 16 // 2^4, bit 4
};
};
/// Convert the terrain to the geotiff
void
terrain2tiff(TerrainTile &terrain, const char *filename) {
GDALDatasetH hTileDS = terrain.heightsToRaster();
GDALDatasetH hDstDS;
GDALDriverH hDriver = GDALGetDriverByName("GTiff");
hDstDS = GDALCreateCopy( hDriver, filename, hTileDS, FALSE,
NULL, NULL, NULL );
if( hDstDS != NULL )
GDALClose( hDstDS );
GDALClose( hTileDS );
}
int
main(int argc, char *argv[]) {
// Setup the command interface
TerrainExport command = TerrainExport(argv[0], version.cstr);
command.setUsage("-i TERRAIN_FILE -z ZOOM_LEVEL -x TILE_X -y TILE_Y -o OUTPUT_FILE ");
command.option("-i", "--input-filename <filename>", "the terrain tile file to convert", TerrainExport::setInputFilename);
command.option("-z", "--zoom-level <int>", "the zoom level represented by the tile", TerrainExport::setZoomLevel);
command.option("-x", "--tile-x <int>", "the tile x coordinate", TerrainExport::setTileX);
command.option("-y", "--tile-y <int>", "the tile y coordinate", TerrainExport::setTileY);
command.option("-o", "--output-filename <filename>", "the output file to create", TerrainExport::setOutputFilename);
// Parse and check the arguments
command.parse(argc, argv);
command.check();
GDALAllRegister();
// Instantiate an appropriate terrain tile
const TileCoordinate coord(command.zoom, command.tx, command.ty);
TerrainTile terrain(coord);
// Read the data into the tile from the filesystem
try {
terrain.readFile(command.inputFilename);
} catch (CTBException &e) {
cerr << "Error: " << e.what() << endl;
}
cout << "Creating " << command.outputFilename << " using zoom " << command.zoom << " from tile " << command.tx << "," << command.ty << endl;
// Write the data to tiff
terrain2tiff(terrain, command.outputFilename);
return 0;
}
| {
"pile_set_name": "Github"
} |
// +build !windows
package mousetrap
// StartedByExplorer returns true if the program was invoked by the user
// double-clicking on the executable from explorer.exe
//
// It is conservative and returns false if any of the internal calls fail.
// It does not guarantee that the program was run from a terminal. It only can tell you
// whether it was launched from explorer.exe
//
// On non-Windows platforms, it always returns false.
func StartedByExplorer() bool {
return false
}
| {
"pile_set_name": "Github"
} |
<?php
class T {
function name() { return "T"; }
}
class S {
function name() { return "S"; }
}
$obj1 = new T();
$obj2 = new S();
$obj3 = clone $obj1;
$obj4 = clone $obj2;
echo $obj3->name(), "\n"; // prints "T"
echo $obj4->name(), "\n"; // prints "S"
?>
| {
"pile_set_name": "Github"
} |
[preset00]
fRating=2.000000
fGammaAdj=1.000000
fDecay=0.950000
fVideoEchoZoom=0.999609
fVideoEchoAlpha=0.500000
nVideoEchoOrientation=3
nWaveMode=3
bAdditiveWaves=0
bWaveDots=0
bWaveThick=0
bModWaveAlphaByVolume=0
bMaximizeWaveColor=1
bTexWrap=1
bDarkenCenter=0
bRedBlueStereo=0
bBrighten=0
bDarken=0
bSolarize=0
bInvert=0
fWaveAlpha=4.099998
fWaveScale=0.438652
fWaveSmoothing=0.630000
fWaveParam=0.000000
fModWaveAlphaStart=0.710000
fModWaveAlphaEnd=1.300000
fWarpAnimSpeed=1.000000
fWarpScale=1.331000
fZoomExponent=1.000157
fShader=0.000000
zoom=1.010404
rot=0.000000
cx=0.500000
cy=0.500000
dx=0.000000
dy=0.000000
warp=0.010000
sx=0.999944
sy=0.999904
wave_r=1.000000
wave_g=1.000000
wave_b=1.000000
wave_x=0.500000
wave_y=0.500000
ob_size=0.049900
ob_r=0.110000
ob_g=1.000000
ob_b=0.000000
ob_a=0.000000
ib_size=0.055000
ib_r=0.250000
ib_g=0.250000
ib_b=0.250000
ib_a=1.000000
nMotionVectorsX=1.280000
nMotionVectorsY=48.000000
mv_dx=0.000000
mv_dy=0.000000
mv_l=0.500000
mv_r=1.000000
mv_g=1.000000
mv_b=0.000000
mv_a=0.000000
per_frame_1=vol_att=bass_att+treb_Att+mid_att;
per_frame_2=bass_thresh = above(bass_att,bass_thresh)*2 + (1-above(bass_att,bass_thresh))*((bass_thresh-1.4)*0.85+1.4);
per_frame_3=treb_thresh = above(treb_att,treb_thresh)*2 + (1-above(treb_att,treb_thresh))*((treb_thresh-1.5)*0.75+1.5);
per_frame_4=mid_thresh=above(mid_att,mid_thresh)*2+
per_frame_5=(1-above(mid_att,mid_thresh))*((mid_thresh-1.5)*0.75+1.5);
per_frame_6=vol_thresh=bass_thresh+treb_thresh+mid_thresh;
per_frame_7=treb_effect=max(max(treb,treb_Att),react);
per_frame_8=bass_effect=max(max(Bass,bass_Att),react);
per_frame_9=mid_effect=max(max(mid,mid_att),react);
per_frame_10=vol_effect=bass_effect+treb_effect+mid_effect;
per_frame_11=normal=5;
per_frame_12=more=bass_effect;
per_frame_13=less=7;
per_frame_14=react=less;
per_frame_15=new_bass=if(above(Bass,bass_effect),bass&bass_att,bass_effect+bass_thresh);
per_frame_16=new_treb=if(above(treb,treb_effect),treb&treb_att,treb_Effect+treb_thresh);
per_frame_17=new_mid=if(above(mid,mid_effect),mid&mid_Att,mid_effect+mid_thresh);
per_frame_18=new_vol=new_bass+new_treb+new_mid+.04;
per_frame_19=change=bnot(1);
per_frame_20=q1=new_bass;
per_frame_21=q2=new_treb;
per_frame_22=q3=new_mid;
per_frame_23=q4=new_vol;
per_frame_24=q5=if(above(q2,q3),above(q1,q3),-above(q1,q3));
per_frame_25=q6=if(above(q1,q3),above(q2,q4),-above(q2,q3));
per_frame_26=q7=if(above(q5,q6),q5,-q6);;
per_frame_27=q8=if(above(q6,q7),q6,-q7);;
per_frame_28=ib_r=q3-.2*sin(q2);
per_frame_29=ib_b=q3+.2*sin(q1);
per_frame_30=ib_g=q3-1*sin(q2);
per_frame_31=wave_r=.2*sin(Q3);
per_frame_32=wave_b=.6*sin(Q1);
per_frame_33=wave_g=.7*sin(Q2);
per_pixel_1=zoom=if(above(q1-q3,q6-q7),if(above(q2,q1),if(above(pow(x,q1-q5),pow(y,q1-q6)),zoom*sin(rad+1*sin(q1)*sin(q4)),zoom
per_pixel_2=*sin(Rad-.2)+1)-rad*sin(q6+rad-x-q6)+x*sin(above(q7,q6)*sin(Q7))+.2*sin(x*sin(q8)),1.20
per_pixel_3=*sin(pow(x,y)*sin(Q4))),1+rad-.2*sin(q4-x))-(rad&rad*sin(q4));
per_pixel_4=
per_pixel_5=rot=if(above(q3,q5),if(above(q5,.5),if(above(q7,q6),if(Above(q1,q2),rot*sin(Rad-.2*ang+x),-rot*Sin(rad+x-tan(ang)-cos(x*q3))+.2
per_pixel_6=-x)*band(rad-zoom,rad+zoom),-.2*Sin(rad-ang-x)),0*sin(rad-.2)*zoom)*sin(q1-q2),rot&rad-1*x);
per_pixel_7=
per_pixel_8=
| {
"pile_set_name": "Github"
} |
{
"name" : "terraformer",
"version" : "1.0.3",
"main" : "terraformer.min.js",
"ignore" : ["docs", "examples", "spec", "versions", "source", "Gemfile", "config.rb"]
} | {
"pile_set_name": "Github"
} |
---
title: "SortableType element (ManagedPropertyInfo complexType) (SPS15XSDSearchSet2)"
manager: arnek
ms.date: 3/9/2015
ms.audience: ITPro
ms.topic: article
ms.prod: sharepoint
localization_priority: Normal
ms.assetid: 33368f36-17b6-04bf-bf0f-cf74e214e9d4
description: "Last modified: March 09, 2015"
---
# SortableType element (ManagedPropertyInfo complexType) (SPS15XSDSearchSet2)
## Element information
|||
|:-----|:-----|
|**Element type** <br/> |tns:SortableType <br/> |
|**Namespace** <br/> |http://schemas.datacontract.org/2004/07/Microsoft.Office.Server.Search.Administration <br/> |
|**Schema file** <br/> |schema_Microsoft.Office.Server.Search.Administration.xsd <br/> |
## Definition
```XML
<xs:element name="SortableType" type="tns:SortableType" minOccurs="0"></xs:element>
```
## Elements and attributes
If the schema defines specific requirements, such as **sequence**, **minOccurs**, **maxOccurs**, and **choice**, see the definition section.
### Parent elements
None.
### Child elements
None.
### Attributes
None.
| {
"pile_set_name": "Github"
} |
// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
import 'package:observatory/service_io.dart';
import 'package:test/test.dart';
import 'test_helper.dart';
Future getFlagValue(VM vm, String flagName) async {
var result = await vm.invokeRpcNoUpgrade('getFlagList', {});
expect(result['type'], equals('FlagList'));
final flags = result['flags'];
for (final flag in flags) {
if (flag['name'] == flagName) {
return flag['valueAsString'];
}
}
}
var tests = <VMTest>[
(VM vm) async {
var result = await vm.invokeRpcNoUpgrade('getFlagList', {});
expect(result['type'], equals('FlagList'));
// TODO(turnidge): Make this test a bit beefier.
},
// Modify a flag which does not exist.
(VM vm) async {
var params = {
'name': 'does_not_really_exist',
'value': 'true',
};
var result = await vm.invokeRpcNoUpgrade('setFlag', params);
expect(result['type'], equals('Error'));
expect(result['message'], equals('Cannot set flag: flag not found'));
},
// Modify a flag with the wrong value type.
(VM vm) async {
var params = {
'name': 'pause_isolates_on_start',
'value': 'not-a-boolean',
};
var result = await vm.invokeRpcNoUpgrade('setFlag', params);
expect(result['type'], equals('Error'));
expect(result['message'], equals('Cannot set flag: invalid value'));
},
// Modify a flag with the right value type.
(VM vm) async {
var params = {
'name': 'pause_isolates_on_start',
'value': 'false',
};
var result = await vm.invokeRpcNoUpgrade('setFlag', params);
expect(result['type'], equals('Success'));
},
// Modify a flag which cannot be set at runtime.
(VM vm) async {
var params = {
'name': 'random_seed',
'value': '42',
};
var result = await vm.invokeRpcNoUpgrade('setFlag', params);
expect(result['type'], equals('Error'));
expect(
result['message'], equals('Cannot set flag: cannot change at runtime'));
},
// Modify the profile_period at runtime.
(VM vm) async {
final kProfilePeriod = 'profile_period';
final kValue = 100;
expect(await getFlagValue(vm, kProfilePeriod), '1000');
final params = {
'name': '$kProfilePeriod',
'value': '$kValue',
};
final completer = Completer();
final stream = await vm.getEventStream(VM.kVMStream);
var subscription;
subscription = stream.listen((ServiceEvent event) {
if (event.kind == ServiceEvent.kVMFlagUpdate) {
expect(event.owner.type, 'VM');
expect(event.flag, kProfilePeriod);
expect(event.newValue, kValue.toString());
subscription.cancel();
completer.complete();
}
});
final result = await vm.invokeRpcNoUpgrade('setFlag', params);
expect(result['type'], equals('Success'));
await completer.future;
expect(await getFlagValue(vm, kProfilePeriod), kValue.toString());
},
// Start and stop the profiler at runtime.
(VM vm) async {
final kProfiler = 'profiler';
if (await getFlagValue(vm, kProfiler) == 'false') {
// Either in release or product modes and the profiler is disabled.
return;
}
final params = {
'name': kProfiler,
'value': 'false',
};
var result = await vm.invokeRpcNoUpgrade('setFlag', params);
expect(result['type'], equals('Success'));
expect(await getFlagValue(vm, kProfiler), 'false');
try {
// Arbitrary RPC which checks whether or not the profiler is enabled.
await vm.isolates.first.invokeRpcNoUpgrade('getCpuSamples', {});
fail('Profiler is disabled and request should fail');
} on ServerRpcException catch (_) {/* Expected */}
// Clear CPU samples.
result = await vm.isolates.first.invokeRpcNoUpgrade('clearCpuSamples', {});
expect(result['type'], equals('Success'));
params['value'] = 'true';
result = await vm.invokeRpcNoUpgrade('setFlag', params);
expect(result['type'], equals('Success'));
expect(await getFlagValue(vm, kProfiler), 'true');
try {
// Arbitrary RPC which checks whether or not the profiler is enabled.
result = await vm.isolates.first.invokeRpcNoUpgrade('getCpuSamples', {});
} on ServerRpcException catch (e) {
fail('Profiler is enabled and request should succeed. Error:\n$e');
}
},
];
main(args) async => runVMTests(args, tests);
| {
"pile_set_name": "Github"
} |
<!---
DO NOT EDIT !
This file was generated automatically from 'src/mako/api/README.md.mako'
DO NOT EDIT !
-->
The `google-prediction1d6` library allows access to all features of the *Google prediction* service.
This documentation was generated from *prediction* crate version *1.0.14+20160511*, where *20160511* is the exact revision of the *prediction:v1.6* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.14*.
Everything else about the *prediction* *v1d6* API can be found at the
[official documentation site](https://developers.google.com/prediction/docs/developer-guide).
# Features
Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-prediction1d6/1.0.14+20160511/google_prediction1d6/struct.Prediction.html) ...
* hostedmodels
* [*predict*](https://docs.rs/google-prediction1d6/1.0.14+20160511/google_prediction1d6/struct.HostedmodelPredictCall.html)
* trainedmodels
* [*analyze*](https://docs.rs/google-prediction1d6/1.0.14+20160511/google_prediction1d6/struct.TrainedmodelAnalyzeCall.html), [*delete*](https://docs.rs/google-prediction1d6/1.0.14+20160511/google_prediction1d6/struct.TrainedmodelDeleteCall.html), [*get*](https://docs.rs/google-prediction1d6/1.0.14+20160511/google_prediction1d6/struct.TrainedmodelGetCall.html), [*insert*](https://docs.rs/google-prediction1d6/1.0.14+20160511/google_prediction1d6/struct.TrainedmodelInsertCall.html), [*list*](https://docs.rs/google-prediction1d6/1.0.14+20160511/google_prediction1d6/struct.TrainedmodelListCall.html), [*predict*](https://docs.rs/google-prediction1d6/1.0.14+20160511/google_prediction1d6/struct.TrainedmodelPredictCall.html) and [*update*](https://docs.rs/google-prediction1d6/1.0.14+20160511/google_prediction1d6/struct.TrainedmodelUpdateCall.html)
# Structure of this Library
The API is structured into the following primary items:
* **[Hub](https://docs.rs/google-prediction1d6/1.0.14+20160511/google_prediction1d6/struct.Prediction.html)**
* a central object to maintain state and allow accessing all *Activities*
* creates [*Method Builders*](https://docs.rs/google-prediction1d6/1.0.14+20160511/google_prediction1d6/trait.MethodsBuilder.html) which in turn
allow access to individual [*Call Builders*](https://docs.rs/google-prediction1d6/1.0.14+20160511/google_prediction1d6/trait.CallBuilder.html)
* **[Resources](https://docs.rs/google-prediction1d6/1.0.14+20160511/google_prediction1d6/trait.Resource.html)**
* primary types that you can apply *Activities* to
* a collection of properties and *Parts*
* **[Parts](https://docs.rs/google-prediction1d6/1.0.14+20160511/google_prediction1d6/trait.Part.html)**
* a collection of properties
* never directly used in *Activities*
* **[Activities](https://docs.rs/google-prediction1d6/1.0.14+20160511/google_prediction1d6/trait.CallBuilder.html)**
* operations to apply to *Resources*
All *structures* are marked with applicable traits to further categorize them and ease browsing.
Generally speaking, you can invoke *Activities* like this:
```Rust,ignore
let r = hub.resource().activity(...).doit()
```
Or specifically ...
```ignore
let r = hub.trainedmodels().insert(...).doit()
let r = hub.trainedmodels().get(...).doit()
let r = hub.trainedmodels().update(...).doit()
```
The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities`
supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be
specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired.
The `doit()` method performs the actual communication with the server and returns the respective result.
# Usage
## Setting up your Project
To use this library, you would put the following lines into your `Cargo.toml` file:
```toml
[dependencies]
google-prediction1d6 = "*"
# This project intentionally uses an old version of Hyper. See
# https://github.com/Byron/google-apis-rs/issues/173 for more
# information.
hyper = "^0.10"
hyper-rustls = "^0.6"
serde = "^1.0"
serde_json = "^1.0"
yup-oauth2 = "^1.0"
```
## A complete example
```Rust
extern crate hyper;
extern crate hyper_rustls;
extern crate yup_oauth2 as oauth2;
extern crate google_prediction1d6 as prediction1d6;
use prediction1d6::Update;
use prediction1d6::{Result, Error};
use std::default::Default;
use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
use prediction1d6::Prediction;
// Get an ApplicationSecret instance by some means. It contains the `client_id` and
// `client_secret`, among other things.
let secret: ApplicationSecret = Default::default();
// Instantiate the authenticator. It will choose a suitable authentication flow for you,
// unless you replace `None` with the desired Flow.
// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
// retrieve them from storage.
let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
<MemoryStorage as Default>::default(), None);
let mut hub = Prediction::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth);
// As the method needs a request, you would usually fill it with the desired information
// into the respective structure. Some of the parts shown here might not be applicable !
// Values shown here are possibly random and not representative !
let mut req = Update::default();
// You can configure optional parameters by calling the respective setters at will, and
// execute the final call using `doit()`.
// Values shown here are possibly random and not representative !
let result = hub.trainedmodels().update(req, "project", "id")
.doit();
match result {
Err(e) => match e {
// The Error enum provides details about what exactly happened.
// You can also just use its `Debug`, `Display` or `Error` traits
Error::HttpError(_)
|Error::MissingAPIKey
|Error::MissingToken(_)
|Error::Cancelled
|Error::UploadSizeLimitExceeded(_, _)
|Error::Failure(_)
|Error::BadRequest(_)
|Error::FieldClash(_)
|Error::JsonDecodeError(_, _) => println!("{}", e),
},
Ok(res) => println!("Success: {:?}", res),
}
```
## Handling Errors
All errors produced by the system are provided either as [Result](https://docs.rs/google-prediction1d6/1.0.14+20160511/google_prediction1d6/enum.Result.html) enumeration as return value of
the doit() methods, or handed as possibly intermediate results to either the
[Hub Delegate](https://docs.rs/google-prediction1d6/1.0.14+20160511/google_prediction1d6/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
makes the system potentially resilient to all kinds of errors.
## Uploads and Downloads
If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-prediction1d6/1.0.14+20160511/google_prediction1d6/enum.Result.html), should be
read by you to obtain the media.
If such a method also supports a [Response Result](https://docs.rs/google-prediction1d6/1.0.14+20160511/google_prediction1d6/trait.ResponseResult.html), it will return that by default.
You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making
this call: `.param("alt", "media")`.
Methods supporting uploads can do so using up to 2 different protocols:
*simple* and *resumable*. The distinctiveness of each is represented by customized
`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
## Customization and Callbacks
You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-prediction1d6/1.0.14+20160511/google_prediction1d6/trait.Delegate.html) to the
[Method Builder](https://docs.rs/google-prediction1d6/1.0.14+20160511/google_prediction1d6/trait.CallBuilder.html) before making the final `doit()` call.
Respective methods will be called to provide progress information, as well as determine whether the system should
retry on failure.
The [delegate trait](https://docs.rs/google-prediction1d6/1.0.14+20160511/google_prediction1d6/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort.
## Optional Parts in Server-Requests
All structures provided by this library are made to be [encodable](https://docs.rs/google-prediction1d6/1.0.14+20160511/google_prediction1d6/trait.RequestValue.html) and
[decodable](https://docs.rs/google-prediction1d6/1.0.14+20160511/google_prediction1d6/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses
are valid.
Most optionals are are considered [Parts](https://docs.rs/google-prediction1d6/1.0.14+20160511/google_prediction1d6/trait.Part.html) which are identifiable by name, which will be sent to
the server to indicate either the set parts of the request or the desired parts in the response.
## Builder Arguments
Using [method builders](https://docs.rs/google-prediction1d6/1.0.14+20160511/google_prediction1d6/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods.
These will always take a single argument, for which the following statements are true.
* [PODs][wiki-pod] are handed by copy
* strings are passed as `&str`
* [request values](https://docs.rs/google-prediction1d6/1.0.14+20160511/google_prediction1d6/trait.RequestValue.html) are moved
Arguments will always be copied or cloned into the builder, to make them independent of their original life times.
[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure
[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
[google-go-api]: https://github.com/google/google-api-go-client
# License
The **prediction1d6** library was generated by Sebastian Thiel, and is placed
under the *MIT* license.
You can read the full text at the repository's [license file][repo-license].
[repo-license]: https://github.com/Byron/google-apis-rsblob/master/LICENSE.md
| {
"pile_set_name": "Github"
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_181) on Tue Jul 07 00:34:29 BST 2020 -->
<title>RecyclerCollectionComponent</title>
<meta name="date" content="2020-07-07">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="RecyclerCollectionComponent";
}
}
catch(err) {
}
//-->
var methods = {"i0":10,"i1":9,"i2":9,"i3":10,"i4":10,"i5":9,"i6":10,"i7":10,"i8":10,"i9":9,"i10":10,"i11":10,"i12":10,"i13":9,"i14":9,"i15":9,"i16":41,"i17":9,"i18":9,"i19":9,"i20":9,"i21":41,"i22":10,"i23":10,"i24":9,"i25":9,"i26":9};
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"],32:["t6","Deprecated Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- @generated -->
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../com/facebook/litho/sections/widget/RecyclerBinderConfiguration.Builder.html" title="class in com.facebook.litho.sections.widget"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.Builder.html" title="class in com.facebook.litho.sections.widget"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?com/facebook/litho/sections/widget/RecyclerCollectionComponent.html" target="_top">Frames</a></li>
<li><a href="RecyclerCollectionComponent.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li><a href="#nested.class.summary">Nested</a> | </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">com.facebook.litho.sections.widget</div>
<h2 title="Class RecyclerCollectionComponent" class="title">Class RecyclerCollectionComponent</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="https://d.android.com/reference/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li><a href="../../../../../com/facebook/litho/ComponentLifecycle.html" title="class in com.facebook.litho">com.facebook.litho.ComponentLifecycle</a></li>
<li>
<ul class="inheritance">
<li><a href="../../../../../com/facebook/litho/Component.html" title="class in com.facebook.litho">com.facebook.litho.Component</a></li>
<li>
<ul class="inheritance">
<li>com.facebook.litho.sections.widget.RecyclerCollectionComponent</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><a href="../../../../../com/facebook/litho/Equivalence.html" title="interface in com.facebook.litho">Equivalence</a><<a href="../../../../../com/facebook/litho/Component.html" title="class in com.facebook.litho">Component</a>>, <a href="../../../../../com/facebook/litho/EventDispatcher.html" title="interface in com.facebook.litho">EventDispatcher</a>, <a href="../../../../../com/facebook/litho/EventTriggerTarget.html" title="interface in com.facebook.litho">EventTriggerTarget</a>, <a href="../../../../../com/facebook/litho/HasEventDispatcher.html" title="interface in com.facebook.litho">HasEventDispatcher</a>, <a href="../../../../../com/facebook/litho/HasEventTrigger.html" title="interface in com.facebook.litho">HasEventTrigger</a>, <a href="https://d.android.com/reference/java/lang/Cloneable.html?is-external=true" title="class or interface in java.lang">Cloneable</a></dd>
</dl>
<hr>
<br>
<pre>public final class <span class="typeNameLabel">RecyclerCollectionComponent</span>
extends <a href="../../../../../com/facebook/litho/Component.html" title="class in com.facebook.litho">Component</a></pre>
<div class="block">A <a href="../../../../../com/facebook/litho/Component.html" title="class in com.facebook.litho"><code>Component</code></a> that renders a <code>Recycler</code> backed by a <a href="../../../../../com/facebook/litho/sections/Section.html" title="class in com.facebook.litho.sections"><code>Section</code></a> tree. See <a
href="https://fblitho.com/docs/recycler-collection-component">recycler-collection-component</a>
for details.
<p>This <a href="../../../../../com/facebook/litho/Component.html" title="class in com.facebook.litho"><code>Component</code></a> handles the loading events from the <a href="../../../../../com/facebook/litho/sections/Section.html" title="class in com.facebook.litho.sections"><code>Section</code></a> hierarchy and shows
the appropriate error,loading or empty <a href="../../../../../com/facebook/litho/Component.html" title="class in com.facebook.litho"><code>Component</code></a> passed in as props. If either the empty
or the error components are not passed in and the <a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.html" title="class in com.facebook.litho.sections.widget"><code>RecyclerCollectionComponent</code></a> is in one
of these states it will simply not render anything.
<p>The <a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.html" title="class in com.facebook.litho.sections.widget"><code>RecyclerCollectionComponent</code></a> also exposes a <a href="../../../../../com/facebook/litho/sections/LoadEventsHandler.html" title="interface in com.facebook.litho.sections"><code>LoadEventsHandler</code></a> and a <code>OnScrollListener</code> as <a href="../../../../../com/facebook/litho/annotations/Prop.html" title="annotation in com.facebook.litho.annotations"><code>Prop</code></a>s so its users can receive events about the state of the loading
and about the state of the <code>Recycler</code> scrolling.
<p>clipToPadding, clipChildren, itemDecoration, scrollBarStyle, horizontalPadding,
verticalPadding and recyclerViewId <a href="../../../../../com/facebook/litho/annotations/Prop.html" title="annotation in com.facebook.litho.annotations"><code>Prop</code></a>s will be directly applied to the <code>Recycler</code>
component.
<p>The <a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionEventsController.html" title="class in com.facebook.litho.sections.widget"><code>RecyclerCollectionEventsController</code></a> <a href="../../../../../com/facebook/litho/annotations/Prop.html" title="annotation in com.facebook.litho.annotations"><code>Prop</code></a> is a way to send commands to the
<code>RecyclerCollectionComponentSpec</code>, such as scrollTo(position) and refresh().
<p>To trigger scrolling from the Section use <code>SectionLifecycle#requestFocus(SectionContext,
int)</code>. See <a
href="https://fblitho.com/docs/communicating-with-the-ui#scrolling-requestfocus">communicating-with-the-ui</a>
for details.
<p></div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><code>com.facebook.litho.sections.widget.RecyclerCollectionComponentSpec</code></dd>
<div class="details">
<ul class="blockList">
<li class="blockList">
<a name="Required-detail"><!----></a>
<h3>Required Props</h3>
<ul class="blockList">
<li class="blockList">
<a name="prop-section"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>section</h4>
<dl>
<dt>Type:</dt>
<dd>com.facebook.litho.sections.Section</dt>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<a name="Optional-detail"><!----></a>
<h3>Optional Props</h3>
<ul class="blockList">
<li class="blockList">
<a name="prop-asyncPropUpdates"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>asyncPropUpdates</h4>
<dl>
<dt>Type:</dt>
<dd>boolean</dt>
</dl>
</li>
</ul>
<a name="prop-asyncStateUpdates"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>asyncStateUpdates</h4>
<dl>
<dt>Type:</dt>
<dd>boolean</dt>
</dl>
</li>
</ul>
<a name="prop-bottomPadding"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>bottomPadding</h4>
<dl>
<dt>Type:</dt>
<dd>int</dt>
</dl>
</li>
</ul>
<a name="prop-canMeasureRecycler"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>canMeasureRecycler</h4>
<dl>
<dt>Type:</dt>
<dd>boolean</dt>
</dl>
</li>
</ul>
<a name="prop-clipChildren"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>clipChildren</h4>
<dl>
<dt>Type:</dt>
<dd>boolean</dt>
</dl>
</li>
</ul>
<a name="prop-clipToPadding"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>clipToPadding</h4>
<dl>
<dt>Type:</dt>
<dd>boolean</dt>
</dl>
</li>
</ul>
<a name="prop-disablePTR"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>disablePTR</h4>
<dl>
<dt>Type:</dt>
<dd>boolean</dt>
</dl>
</li>
</ul>
<a name="prop-emptyComponent"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>emptyComponent</h4>
<dl>
<dt>Type:</dt>
<dd>com.facebook.litho.Component</dt>
</dl>
</li>
</ul>
<a name="prop-errorComponent"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>errorComponent</h4>
<dl>
<dt>Type:</dt>
<dd>com.facebook.litho.Component</dt>
</dl>
</li>
</ul>
<a name="prop-eventsController"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>eventsController</h4>
<dl>
<dt>Type:</dt>
<dd>com.facebook.litho.sections.widget.RecyclerCollectionEventsController</dt>
</dl>
</li>
</ul>
<a name="prop-fadingEdgeLength"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>fadingEdgeLength</h4>
<dl>
<dt>Type:</dt>
<dd>int</dt>
</dl>
</li>
</ul>
<a name="prop-forceSyncStateUpdates"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>forceSyncStateUpdates</h4>
<dl>
<dt>Type:</dt>
<dd>boolean</dt>
</dl>
</li>
</ul>
<a name="prop-horizontalFadingEdgeEnabled"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>horizontalFadingEdgeEnabled</h4>
<dl>
<dt>Type:</dt>
<dd>boolean</dt>
</dl>
</li>
</ul>
<a name="prop-ignoreLoadingUpdates"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>ignoreLoadingUpdates</h4>
<dl>
<dt>Type:</dt>
<dd>boolean</dt>
</dl>
</li>
</ul>
<a name="prop-incrementalMount"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>incrementalMount</h4>
<dl>
<dt>Type:</dt>
<dd>boolean</dt>
</dl>
</li>
</ul>
<a name="prop-itemAnimator"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>itemAnimator</h4>
This prop defines the animations that take place on items as changes are made. To remove change animation use {@link NoUpdateItemAnimator}. To completely disable all animations use {@link NotAnimatedItemAnimator}.
<dl>
<dt>Type:</dt>
<dd>androidx.recyclerview.widget.RecyclerView.ItemAnimator</dt>
</dl>
</li>
</ul>
<a name="prop-itemDecoration"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>itemDecoration</h4>
<dl>
<dt>Type:</dt>
<dd>androidx.recyclerview.widget.RecyclerView.ItemDecoration</dt>
</dl>
</li>
</ul>
<a name="prop-leftPadding"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>leftPadding</h4>
<dl>
<dt>Type:</dt>
<dd>int</dt>
</dl>
</li>
</ul>
<a name="prop-loadEventsHandler"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>loadEventsHandler</h4>
<dl>
<dt>Type:</dt>
<dd>com.facebook.litho.sections.LoadEventsHandler</dt>
</dl>
</li>
</ul>
<a name="prop-loadingComponent"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>loadingComponent</h4>
<dl>
<dt>Type:</dt>
<dd>com.facebook.litho.Component</dt>
</dl>
</li>
</ul>
<a name="prop-nestedScrollingEnabled"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>nestedScrollingEnabled</h4>
<dl>
<dt>Type:</dt>
<dd>boolean</dt>
</dl>
</li>
</ul>
<a name="prop-onScrollListeners"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>onScrollListeners</h4>
<dl>
<dt>Type:</dt>
<dd>java.util.List<androidx.recyclerview.widget.RecyclerView.OnScrollListener></dt>
</dl>
</li>
</ul>
<a name="prop-overScrollMode"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>overScrollMode</h4>
<dl>
<dt>Type:</dt>
<dd>int</dt>
</dl>
</li>
</ul>
<a name="prop-recyclerConfiguration"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>recyclerConfiguration</h4>
<dl>
<dt>Type:</dt>
<dd>com.facebook.litho.sections.widget.RecyclerConfiguration</dt>
</dl>
</li>
</ul>
<a name="prop-recyclerTouchEventHandler"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>recyclerTouchEventHandler</h4>
<dl>
<dt>Type:</dt>
<dd>com.facebook.litho.EventHandler<com.facebook.litho.TouchEvent></dt>
</dl>
</li>
</ul>
<a name="prop-recyclerViewId"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>recyclerViewId</h4>
<dl>
<dt>Type:</dt>
<dd>int</dt>
</dl>
</li>
</ul>
<a name="prop-refreshProgressBarBackgroundColor"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>refreshProgressBarBackgroundColor</h4>
<dl>
<dt>Type:</dt>
<dd>java.lang.Integer</dt>
</dl>
</li>
</ul>
<a name="prop-refreshProgressBarColor"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>refreshProgressBarColor</h4>
<dl>
<dt>Type:</dt>
<dd>int</dt>
</dl>
</li>
</ul>
<a name="prop-rightPadding"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>rightPadding</h4>
<dl>
<dt>Type:</dt>
<dd>int</dt>
</dl>
</li>
</ul>
<a name="prop-scrollBarStyle"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>scrollBarStyle</h4>
<dl>
<dt>Type:</dt>
<dd>int</dt>
</dl>
</li>
</ul>
<a name="prop-sectionTreeTag"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>sectionTreeTag</h4>
<dl>
<dt>Type:</dt>
<dd>java.lang.String</dt>
</dl>
</li>
</ul>
<a name="prop-setRootAsync"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>setRootAsync</h4>
<dl>
<dt>Type:</dt>
<dd>boolean</dt>
</dl>
</li>
</ul>
<a name="prop-startupLogger"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>startupLogger</h4>
<dl>
<dt>Type:</dt>
<dd>com.facebook.litho.LithoStartupLogger</dt>
</dl>
</li>
</ul>
<a name="prop-stickyHeaderControllerFactory"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>stickyHeaderControllerFactory</h4>
<dl>
<dt>Type:</dt>
<dd>com.facebook.litho.widget.StickyHeaderControllerFactory</dt>
</dl>
</li>
</ul>
<a name="prop-topPadding"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>topPadding</h4>
<dl>
<dt>Type:</dt>
<dd>int</dt>
</dl>
</li>
</ul>
<a name="prop-touchInterceptor"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>touchInterceptor</h4>
<dl>
<dt>Type:</dt>
<dd>com.facebook.litho.widget.LithoRecylerView.TouchInterceptor</dt>
</dl>
</li>
</ul>
<a name="prop-verticalFadingEdgeEnabled"><!----></a>
<ul class="blockList">
<li class="blockList">
<h4>verticalFadingEdgeEnabled</h4>
<dl>
<dt>Type:</dt>
<dd>boolean</dt>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="nested.class.summary">
<!-- -->
</a>
<h3>Nested Class Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Nested Class Summary table, listing nested classes, and an explanation">
<caption><span>Nested Classes</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Class and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static class </code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.Builder.html" title="class in com.facebook.litho.sections.widget">RecyclerCollectionComponent.Builder</a></span></code> </td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="nested.classes.inherited.from.class.com.facebook.litho.Component">
<!-- -->
</a>
<h3>Nested classes/interfaces inherited from class com.facebook.litho.<a href="../../../../../com/facebook/litho/Component.html" title="class in com.facebook.litho">Component</a></h3>
<code><a href="../../../../../com/facebook/litho/Component.ContainerBuilder.html" title="class in com.facebook.litho">Component.ContainerBuilder</a><<a href="../../../../../com/facebook/litho/Component.ContainerBuilder.html" title="type parameter in Component.ContainerBuilder">T</a> extends <a href="../../../../../com/facebook/litho/Component.ContainerBuilder.html" title="class in com.facebook.litho">Component.ContainerBuilder</a><<a href="../../../../../com/facebook/litho/Component.ContainerBuilder.html" title="type parameter in Component.ContainerBuilder">T</a>>></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="nested.classes.inherited.from.class.com.facebook.litho.ComponentLifecycle">
<!-- -->
</a>
<h3>Nested classes/interfaces inherited from class com.facebook.litho.<a href="../../../../../com/facebook/litho/ComponentLifecycle.html" title="class in com.facebook.litho">ComponentLifecycle</a></h3>
<code><a href="../../../../../com/facebook/litho/ComponentLifecycle.MountType.html" title="enum in com.facebook.litho">ComponentLifecycle.MountType</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.RenderData.html" title="interface in com.facebook.litho">ComponentLifecycle.RenderData</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.TransitionContainer.html" title="interface in com.facebook.litho">ComponentLifecycle.TransitionContainer</a></code></li>
</ul>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span><span id="t6" class="tableTab"><span><a href="javascript:show(32);">Deprecated Methods</a></span><span class="tabEnd"> </span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code><a href="https://d.android.com/reference/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.html#acceptTriggerEvent-com.facebook.litho.EventTrigger-java.lang.Object-java.lang.Object:A-">acceptTriggerEvent</a></span>(<a href="../../../../../com/facebook/litho/EventTrigger.html" title="class in com.facebook.litho">EventTrigger</a> eventTrigger,
<a href="https://d.android.com/reference/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> eventState,
<a href="https://d.android.com/reference/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>[] params)</code> </td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>static <a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.Builder.html" title="class in com.facebook.litho.sections.widget">RecyclerCollectionComponent.Builder</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.html#create-com.facebook.litho.ComponentContext-">create</a></span>(<a href="../../../../../com/facebook/litho/ComponentContext.html" title="class in com.facebook.litho">ComponentContext</a> context)</code> </td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>static <a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.Builder.html" title="class in com.facebook.litho.sections.widget">RecyclerCollectionComponent.Builder</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.html#create-com.facebook.litho.ComponentContext-int-int-">create</a></span>(<a href="../../../../../com/facebook/litho/ComponentContext.html" title="class in com.facebook.litho">ComponentContext</a> context,
int defStyleAttr,
int defStyleRes)</code> </td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>protected void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.html#createInitialState-com.facebook.litho.ComponentContext-">createInitialState</a></span>(<a href="../../../../../com/facebook/litho/ComponentContext.html" title="class in com.facebook.litho">ComponentContext</a> c)</code> </td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code><a href="https://d.android.com/reference/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.html#dispatchOnEvent-com.facebook.litho.EventHandler-java.lang.Object-">dispatchOnEvent</a></span>(<a href="../../../../../com/facebook/litho/EventHandler.html" title="class in com.facebook.litho">EventHandler</a> eventHandler,
<a href="https://d.android.com/reference/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> eventState)</code> </td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>static <a href="../../../../../com/facebook/litho/EventHandler.html" title="class in com.facebook.litho">EventHandler</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.html#getPTRRefreshEventHandler-com.facebook.litho.ComponentContext-">getPTRRefreshEventHandler</a></span>(<a href="../../../../../com/facebook/litho/ComponentContext.html" title="class in com.facebook.litho">ComponentContext</a> context)</code> </td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>protected <a href="../../../../../com/facebook/litho/StateContainer.html" title="class in com.facebook.litho">StateContainer</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.html#getStateContainer--">getStateContainer</a></span>()</code> </td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>protected boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.html#hasAttachDetachCallback--">hasAttachDetachCallback</a></span>()</code> </td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>protected boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.html#hasState--">hasState</a></span>()</code> </td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>protected static void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.html#lazyUpdateHasSetSectionTreeRoot-com.facebook.litho.ComponentContext-boolean-">lazyUpdateHasSetSectionTreeRoot</a></span>(<a href="../../../../../com/facebook/litho/ComponentContext.html" title="class in com.facebook.litho">ComponentContext</a> c,
boolean lazyUpdateValue)</code> </td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code><a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.html" title="class in com.facebook.litho.sections.widget">RecyclerCollectionComponent</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.html#makeShallowCopy--">makeShallowCopy</a></span>()</code> </td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>protected <a href="../../../../../com/facebook/litho/Component.html" title="class in com.facebook.litho">Component</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.html#onCreateLayout-com.facebook.litho.ComponentContext-">onCreateLayout</a></span>(<a href="../../../../../com/facebook/litho/ComponentContext.html" title="class in com.facebook.litho">ComponentContext</a> c)</code>
<div class="block">Generate a tree of <a href="../../../../../com/facebook/litho/ComponentLayout.html" title="interface in com.facebook.litho"><code>ComponentLayout</code></a> representing the layout structure of the <a href="../../../../../com/facebook/litho/Component.html" title="class in com.facebook.litho"><code>Component</code></a> and its sub-components.</div>
</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code>protected void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.html#onDetached-com.facebook.litho.ComponentContext-">onDetached</a></span>(<a href="../../../../../com/facebook/litho/ComponentContext.html" title="class in com.facebook.litho">ComponentContext</a> c)</code>
<div class="block">Called when the component is detached from the <a href="../../../../../com/facebook/litho/ComponentTree.html" title="class in com.facebook.litho"><code>ComponentTree</code></a>.</div>
</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.html#onRecyclerConfigChanged-com.facebook.litho.ComponentContext-com.facebook.litho.Handle-int-">onRecyclerConfigChanged</a></span>(<a href="../../../../../com/facebook/litho/ComponentContext.html" title="class in com.facebook.litho">ComponentContext</a> c,
<a href="../../../../../com/facebook/litho/Handle.html" title="class in com.facebook.litho">Handle</a> handle,
int commitPolicy)</code> </td>
</tr>
<tr id="i14" class="altColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.html#onRecyclerConfigChanged-com.facebook.litho.ComponentContext-java.lang.String-int-">onRecyclerConfigChanged</a></span>(<a href="../../../../../com/facebook/litho/ComponentContext.html" title="class in com.facebook.litho">ComponentContext</a> c,
<a href="https://d.android.com/reference/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
int commitPolicy)</code> </td>
</tr>
<tr id="i15" class="rowColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.html#onRecyclerConfigChanged-com.facebook.litho.EventTrigger-int-">onRecyclerConfigChanged</a></span>(<a href="../../../../../com/facebook/litho/EventTrigger.html" title="class in com.facebook.litho">EventTrigger</a> trigger,
int commitPolicy)</code> </td>
</tr>
<tr id="i16" class="altColor">
<td class="colFirst"><code>static <a href="../../../../../com/facebook/litho/EventTrigger.html" title="class in com.facebook.litho">EventTrigger</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.html#onRecyclerConfigChangedTrigger-com.facebook.litho.ComponentContext-java.lang.String-">onRecyclerConfigChangedTrigger</a></span>(<a href="../../../../../com/facebook/litho/ComponentContext.html" title="class in com.facebook.litho">ComponentContext</a> c,
<a href="https://d.android.com/reference/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)</code>
<div class="block"><span class="deprecatedLabel">Deprecated.</span> </div>
</td>
</tr>
<tr id="i17" class="rowColor">
<td class="colFirst"><code>static <a href="../../../../../com/facebook/litho/EventHandler.html" title="class in com.facebook.litho">EventHandler</a><<a href="../../../../../com/facebook/litho/widget/PTRRefreshEvent.html" title="class in com.facebook.litho.widget">PTRRefreshEvent</a>></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.html#onRefresh-com.facebook.litho.ComponentContext-com.facebook.litho.sections.SectionTree-">onRefresh</a></span>(<a href="../../../../../com/facebook/litho/ComponentContext.html" title="class in com.facebook.litho">ComponentContext</a> c,
<a href="../../../../../com/facebook/litho/sections/SectionTree.html" title="class in com.facebook.litho.sections">SectionTree</a> sectionTree)</code> </td>
</tr>
<tr id="i18" class="altColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.html#onScroll-com.facebook.litho.ComponentContext-com.facebook.litho.Handle-int-boolean-">onScroll</a></span>(<a href="../../../../../com/facebook/litho/ComponentContext.html" title="class in com.facebook.litho">ComponentContext</a> c,
<a href="../../../../../com/facebook/litho/Handle.html" title="class in com.facebook.litho">Handle</a> handle,
int position,
boolean animate)</code> </td>
</tr>
<tr id="i19" class="rowColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.html#onScroll-com.facebook.litho.ComponentContext-java.lang.String-int-boolean-">onScroll</a></span>(<a href="../../../../../com/facebook/litho/ComponentContext.html" title="class in com.facebook.litho">ComponentContext</a> c,
<a href="https://d.android.com/reference/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
int position,
boolean animate)</code> </td>
</tr>
<tr id="i20" class="altColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.html#onScroll-com.facebook.litho.EventTrigger-int-boolean-">onScroll</a></span>(<a href="../../../../../com/facebook/litho/EventTrigger.html" title="class in com.facebook.litho">EventTrigger</a> trigger,
int position,
boolean animate)</code> </td>
</tr>
<tr id="i21" class="rowColor">
<td class="colFirst"><code>static <a href="../../../../../com/facebook/litho/EventTrigger.html" title="class in com.facebook.litho">EventTrigger</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.html#onScrollTrigger-com.facebook.litho.ComponentContext-java.lang.String-">onScrollTrigger</a></span>(<a href="../../../../../com/facebook/litho/ComponentContext.html" title="class in com.facebook.litho">ComponentContext</a> c,
<a href="https://d.android.com/reference/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)</code>
<div class="block"><span class="deprecatedLabel">Deprecated.</span> </div>
</td>
</tr>
<tr id="i22" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.html#recordEventTrigger-com.facebook.litho.EventTriggersContainer-">recordEventTrigger</a></span>(<a href="../../../../../com/facebook/litho/EventTriggersContainer.html" title="class in com.facebook.litho">EventTriggersContainer</a> container)</code> </td>
</tr>
<tr id="i23" class="rowColor">
<td class="colFirst"><code>protected void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.html#transferState-com.facebook.litho.StateContainer-com.facebook.litho.StateContainer-">transferState</a></span>(<a href="../../../../../com/facebook/litho/StateContainer.html" title="class in com.facebook.litho">StateContainer</a> _prevStateContainer,
<a href="../../../../../com/facebook/litho/StateContainer.html" title="class in com.facebook.litho">StateContainer</a> _nextStateContainer)</code>
<div class="block">Call this to transfer the <a href="../../../../../com/facebook/litho/annotations/State.html" title="annotation in com.facebook.litho.annotations"><code>State</code></a> annotated values between
two <a href="../../../../../com/facebook/litho/Component.html" title="class in com.facebook.litho"><code>Component</code></a> with the same global scope.</div>
</td>
</tr>
<tr id="i24" class="altColor">
<td class="colFirst"><code>protected static void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.html#updateLoadingState-com.facebook.litho.ComponentContext-RecyclerCollectionComponentSpec.LoadingState-">updateLoadingState</a></span>(<a href="../../../../../com/facebook/litho/ComponentContext.html" title="class in com.facebook.litho">ComponentContext</a> c,
RecyclerCollectionComponentSpec.LoadingState currentLoadingState)</code> </td>
</tr>
<tr id="i25" class="rowColor">
<td class="colFirst"><code>protected static void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.html#updateLoadingStateAsync-com.facebook.litho.ComponentContext-RecyclerCollectionComponentSpec.LoadingState-">updateLoadingStateAsync</a></span>(<a href="../../../../../com/facebook/litho/ComponentContext.html" title="class in com.facebook.litho">ComponentContext</a> c,
RecyclerCollectionComponentSpec.LoadingState currentLoadingState)</code> </td>
</tr>
<tr id="i26" class="altColor">
<td class="colFirst"><code>protected static void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.html#updateLoadingStateSync-com.facebook.litho.ComponentContext-RecyclerCollectionComponentSpec.LoadingState-">updateLoadingStateSync</a></span>(<a href="../../../../../com/facebook/litho/ComponentContext.html" title="class in com.facebook.litho">ComponentContext</a> c,
RecyclerCollectionComponentSpec.LoadingState currentLoadingState)</code> </td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.com.facebook.litho.Component">
<!-- -->
</a>
<h3>Methods inherited from class com.facebook.litho.<a href="../../../../../com/facebook/litho/Component.html" title="class in com.facebook.litho">Component</a></h3>
<code><a href="../../../../../com/facebook/litho/Component.html#bindDynamicProp-int-java.lang.Object-java.lang.Object-">bindDynamicProp</a>, <a href="../../../../../com/facebook/litho/Component.html#canResolve--">canResolve</a>, <a href="../../../../../com/facebook/litho/Component.html#clearCachedLayout-com.facebook.litho.ComponentContext-">clearCachedLayout</a>, <a href="../../../../../com/facebook/litho/Component.html#copyInterStageImpl-com.facebook.litho.Component-">copyInterStageImpl</a>, <a href="../../../../../com/facebook/litho/Component.html#getCommonProps--">getCommonProps</a>, <a href="../../../../../com/facebook/litho/Component.html#getDynamicProps--">getDynamicProps</a>, <a href="../../../../../com/facebook/litho/Component.html#getEventDispatcher--">getEventDispatcher</a>, <a href="../../../../../com/facebook/litho/Component.html#getHandle--">getHandle</a>, <a href="../../../../../com/facebook/litho/Component.html#getId--">getId</a>, <a href="../../../../../com/facebook/litho/Component.html#getKey--">getKey</a>, <a href="../../../../../com/facebook/litho/Component.html#getScopedContext--">getScopedContext</a>, <a href="../../../../../com/facebook/litho/Component.html#getSimpleName--">getSimpleName</a>, <a href="../../../../../com/facebook/litho/Component.html#getSimpleNameDelegate--">getSimpleNameDelegate</a>, <a href="../../../../../com/facebook/litho/Component.html#hasBackgroundSet--">hasBackgroundSet</a>, <a href="../../../../../com/facebook/litho/Component.html#hasClickHandlerSet--">hasClickHandlerSet</a>, <a href="../../../../../com/facebook/litho/Component.html#isEquivalentTo-com.facebook.litho.Component-">isEquivalentTo</a>, <a href="../../../../../com/facebook/litho/Component.html#measure-com.facebook.litho.ComponentContext-int-int-com.facebook.litho.Size-">measure</a>, <a href="../../../../../com/facebook/litho/Component.html#measureMightNotCacheInternalNode-com.facebook.litho.ComponentContext-int-int-com.facebook.litho.Size-">measureMightNotCacheInternalNode</a>, <a href="../../../../../com/facebook/litho/Component.html#registerWorkingRange-java.lang.String-com.facebook.litho.WorkingRange-com.facebook.litho.Component-">registerWorkingRange</a>, <a href="../../../../../com/facebook/litho/Component.html#retrieveValue-com.facebook.litho.DynamicValue-">retrieveValue</a>, <a href="../../../../../com/facebook/litho/Component.html#setScopedContext-com.facebook.litho.ComponentContext-">setScopedContext</a>, <a href="../../../../../com/facebook/litho/Component.html#updateInternalChildState-com.facebook.litho.ComponentContext-">updateInternalChildState</a>, <a href="../../../../../com/facebook/litho/Component.html#willRender-com.facebook.litho.ComponentContext-com.facebook.litho.Component-">willRender</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.com.facebook.litho.ComponentLifecycle">
<!-- -->
</a>
<h3>Methods inherited from class com.facebook.litho.<a href="../../../../../com/facebook/litho/ComponentLifecycle.html" title="class in com.facebook.litho">ComponentLifecycle</a></h3>
<code><a href="../../../../../com/facebook/litho/ComponentLifecycle.html#applyPreviousRenderData-com.facebook.litho.ComponentLifecycle.RenderData-">applyPreviousRenderData</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#callsShouldUpdateOnMount--">callsShouldUpdateOnMount</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#canMeasure--">canMeasure</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#canPreallocate--">canPreallocate</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#createMountContent-Context-">createMountContent</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#dispatchErrorEvent-com.facebook.litho.ComponentContext-com.facebook.litho.ErrorEvent-">dispatchErrorEvent</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#dispatchErrorEvent-com.facebook.litho.ComponentContext-java.lang.Exception-">dispatchErrorEvent</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#dispatchOnEnteredRange-java.lang.String-">dispatchOnEnteredRange</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#dispatchOnExitedRange-java.lang.String-">dispatchOnExitedRange</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#getEventTrigger-com.facebook.litho.ComponentContext-int-com.facebook.litho.Handle-">getEventTrigger</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#getEventTrigger-com.facebook.litho.ComponentContext-int-java.lang.String-">getEventTrigger</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#getExtraAccessibilityNodeAt-int-int-">getExtraAccessibilityNodeAt</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#getExtraAccessibilityNodesCount--">getExtraAccessibilityNodesCount</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#getMountType--">getMountType</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#getTreePropsForChildren-com.facebook.litho.ComponentContext-com.facebook.litho.TreeProps-">getTreePropsForChildren</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#hasChildLithoViews--">hasChildLithoViews</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#implementsAccessibility--">implementsAccessibility</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#implementsExtraAccessibilityNodes--">implementsExtraAccessibilityNodes</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#isLayoutSpecWithSizeSpecCheck--">isLayoutSpecWithSizeSpecCheck</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#isMountSizeDependent--">isMountSizeDependent</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#isPureRender--">isPureRender</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#needsPreviousRenderData--">needsPreviousRenderData</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#newEventHandler-java.lang.Class-java.lang.String-com.facebook.litho.ComponentContext-int-java.lang.Object:A-">newEventHandler</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#newEventTrigger-com.facebook.litho.ComponentContext-java.lang.String-int-com.facebook.litho.Handle-">newEventTrigger</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#onAttached-com.facebook.litho.ComponentContext-">onAttached</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#onBind-com.facebook.litho.ComponentContext-java.lang.Object-">onBind</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#onBoundsDefined-com.facebook.litho.ComponentContext-com.facebook.litho.ComponentLayout-">onBoundsDefined</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#onCreateLayoutWithSizeSpec-com.facebook.litho.ComponentContext-int-int-">onCreateLayoutWithSizeSpec</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#onCreateMountContent-Context-">onCreateMountContent</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#onCreateMountContentPool--">onCreateMountContentPool</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#onCreateTransition-com.facebook.litho.ComponentContext-">onCreateTransition</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#onError-com.facebook.litho.ComponentContext-java.lang.Exception-">onError</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#onLoadStyle-com.facebook.litho.ComponentContext-">onLoadStyle</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#onMeasure-com.facebook.litho.ComponentContext-com.facebook.litho.ComponentLayout-int-int-com.facebook.litho.Size-">onMeasure</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#onMeasureBaseline-com.facebook.litho.ComponentContext-int-int-">onMeasureBaseline</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#onMount-com.facebook.litho.ComponentContext-java.lang.Object-">onMount</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#onPopulateAccessibilityNode-View-AccessibilityNodeInfoCompat-">onPopulateAccessibilityNode</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#onPopulateExtraAccessibilityNode-AccessibilityNodeInfoCompat-int-int-int-">onPopulateExtraAccessibilityNode</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#onPrepare-com.facebook.litho.ComponentContext-">onPrepare</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#onShouldCreateLayoutWithNewSizeSpec-com.facebook.litho.ComponentContext-int-int-">onShouldCreateLayoutWithNewSizeSpec</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#onUnbind-com.facebook.litho.ComponentContext-java.lang.Object-">onUnbind</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#onUnmount-com.facebook.litho.ComponentContext-java.lang.Object-">onUnmount</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#poolSize--">poolSize</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#populateTreeProps-com.facebook.litho.TreeProps-">populateTreeProps</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#recordRenderData-com.facebook.litho.ComponentLifecycle.RenderData-">recordRenderData</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#resolve-com.facebook.litho.ComponentContext-">resolve</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#shouldAlwaysRemeasure--">shouldAlwaysRemeasure</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#shouldUpdate-com.facebook.litho.Component-com.facebook.litho.Component-">shouldUpdate</a>, <a href="../../../../../com/facebook/litho/ComponentLifecycle.html#shouldUseGlobalPool--">shouldUseGlobalPool</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.<a href="https://d.android.com/reference/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
<code><a href="https://d.android.com/reference/java/lang/Object.html?is-external=true#clone--" title="class or interface in java.lang">clone</a>, <a href="https://d.android.com/reference/java/lang/Object.html?is-external=true#equals-java.lang.Object-" title="class or interface in java.lang">equals</a>, <a href="https://d.android.com/reference/java/lang/Object.html?is-external=true#finalize--" title="class or interface in java.lang">finalize</a>, <a href="https://d.android.com/reference/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="https://d.android.com/reference/java/lang/Object.html?is-external=true#hashCode--" title="class or interface in java.lang">hashCode</a>, <a href="https://d.android.com/reference/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="https://d.android.com/reference/java/lang/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="https://d.android.com/reference/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang">toString</a>, <a href="https://d.android.com/reference/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="https://d.android.com/reference/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="https://d.android.com/reference/java/lang/Object.html?is-external=true#wait-long-int-" title="class or interface in java.lang">wait</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="getStateContainer--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getStateContainer</h4>
<pre>protected <a href="../../../../../com/facebook/litho/StateContainer.html" title="class in com.facebook.litho">StateContainer</a> getStateContainer()</pre>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="../../../../../com/facebook/litho/Component.html#getStateContainer--">getStateContainer</a></code> in class <code><a href="../../../../../com/facebook/litho/Component.html" title="class in com.facebook.litho">Component</a></code></dd>
</dl>
</li>
</ul>
<a name="makeShallowCopy--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>makeShallowCopy</h4>
<pre>public <a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.html" title="class in com.facebook.litho.sections.widget">RecyclerCollectionComponent</a> makeShallowCopy()</pre>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="../../../../../com/facebook/litho/Component.html#makeShallowCopy--">makeShallowCopy</a></code> in class <code><a href="../../../../../com/facebook/litho/Component.html" title="class in com.facebook.litho">Component</a></code></dd>
</dl>
</li>
</ul>
<a name="onCreateLayout-com.facebook.litho.ComponentContext-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>onCreateLayout</h4>
<pre>protected <a href="../../../../../com/facebook/litho/Component.html" title="class in com.facebook.litho">Component</a> onCreateLayout(<a href="../../../../../com/facebook/litho/ComponentContext.html" title="class in com.facebook.litho">ComponentContext</a> c)</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../../../../../com/facebook/litho/ComponentLifecycle.html#onCreateLayout-com.facebook.litho.ComponentContext-">ComponentLifecycle</a></code></span></div>
<div class="block">Generate a tree of <a href="../../../../../com/facebook/litho/ComponentLayout.html" title="interface in com.facebook.litho"><code>ComponentLayout</code></a> representing the layout structure of the <a href="../../../../../com/facebook/litho/Component.html" title="class in com.facebook.litho"><code>Component</code></a> and its sub-components.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="../../../../../com/facebook/litho/ComponentLifecycle.html#onCreateLayout-com.facebook.litho.ComponentContext-">onCreateLayout</a></code> in class <code><a href="../../../../../com/facebook/litho/ComponentLifecycle.html" title="class in com.facebook.litho">ComponentLifecycle</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>c</code> - The <a href="../../../../../com/facebook/litho/ComponentContext.html" title="class in com.facebook.litho"><code>ComponentContext</code></a> to build a <a href="../../../../../com/facebook/litho/ComponentLayout.html" title="interface in com.facebook.litho"><code>ComponentLayout</code></a> tree.</dd>
</dl>
</li>
</ul>
<a name="createInitialState-com.facebook.litho.ComponentContext-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createInitialState</h4>
<pre>protected void createInitialState(<a href="../../../../../com/facebook/litho/ComponentContext.html" title="class in com.facebook.litho">ComponentContext</a> c)</pre>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="../../../../../com/facebook/litho/ComponentLifecycle.html#createInitialState-com.facebook.litho.ComponentContext-">createInitialState</a></code> in class <code><a href="../../../../../com/facebook/litho/ComponentLifecycle.html" title="class in com.facebook.litho">ComponentLifecycle</a></code></dd>
</dl>
</li>
</ul>
<a name="onDetached-com.facebook.litho.ComponentContext-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>onDetached</h4>
<pre>protected void onDetached(<a href="../../../../../com/facebook/litho/ComponentContext.html" title="class in com.facebook.litho">ComponentContext</a> c)</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../../../../../com/facebook/litho/ComponentLifecycle.html#onDetached-com.facebook.litho.ComponentContext-">ComponentLifecycle</a></code></span></div>
<div class="block">Called when the component is detached from the <a href="../../../../../com/facebook/litho/ComponentTree.html" title="class in com.facebook.litho"><code>ComponentTree</code></a>.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="../../../../../com/facebook/litho/ComponentLifecycle.html#onDetached-com.facebook.litho.ComponentContext-">onDetached</a></code> in class <code><a href="../../../../../com/facebook/litho/ComponentLifecycle.html" title="class in com.facebook.litho">ComponentLifecycle</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>c</code> - The <a href="../../../../../com/facebook/litho/ComponentContext.html" title="class in com.facebook.litho"><code>ComponentContext</code></a> the Component was constructed with.</dd>
</dl>
</li>
</ul>
<a name="hasAttachDetachCallback--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>hasAttachDetachCallback</h4>
<pre>protected boolean hasAttachDetachCallback()</pre>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="../../../../../com/facebook/litho/ComponentLifecycle.html#hasAttachDetachCallback--">hasAttachDetachCallback</a></code> in class <code><a href="../../../../../com/facebook/litho/ComponentLifecycle.html" title="class in com.facebook.litho">ComponentLifecycle</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true if the component implements <a href="../../../../../com/facebook/litho/annotations/OnAttached.html" title="annotation in com.facebook.litho.annotations"><code>OnAttached</code></a> or <a href="../../../../../com/facebook/litho/annotations/OnDetached.html" title="annotation in com.facebook.litho.annotations"><code>OnDetached</code></a> delegate
methods.</dd>
</dl>
</li>
</ul>
<a name="getPTRRefreshEventHandler-com.facebook.litho.ComponentContext-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getPTRRefreshEventHandler</h4>
<pre>public static <a href="../../../../../com/facebook/litho/EventHandler.html" title="class in com.facebook.litho">EventHandler</a> getPTRRefreshEventHandler(<a href="../../../../../com/facebook/litho/ComponentContext.html" title="class in com.facebook.litho">ComponentContext</a> context)</pre>
</li>
</ul>
<a name="onRefresh-com.facebook.litho.ComponentContext-com.facebook.litho.sections.SectionTree-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>onRefresh</h4>
<pre>public static <a href="../../../../../com/facebook/litho/EventHandler.html" title="class in com.facebook.litho">EventHandler</a><<a href="../../../../../com/facebook/litho/widget/PTRRefreshEvent.html" title="class in com.facebook.litho.widget">PTRRefreshEvent</a>> onRefresh(<a href="../../../../../com/facebook/litho/ComponentContext.html" title="class in com.facebook.litho">ComponentContext</a> c,
<a href="../../../../../com/facebook/litho/sections/SectionTree.html" title="class in com.facebook.litho.sections">SectionTree</a> sectionTree)</pre>
</li>
</ul>
<a name="dispatchOnEvent-com.facebook.litho.EventHandler-java.lang.Object-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>dispatchOnEvent</h4>
<pre>public <a href="https://d.android.com/reference/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> dispatchOnEvent(<a href="../../../../../com/facebook/litho/EventHandler.html" title="class in com.facebook.litho">EventHandler</a> eventHandler,
<a href="https://d.android.com/reference/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> eventState)</pre>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../../com/facebook/litho/EventDispatcher.html#dispatchOnEvent-com.facebook.litho.EventHandler-java.lang.Object-">dispatchOnEvent</a></code> in interface <code><a href="../../../../../com/facebook/litho/EventDispatcher.html" title="interface in com.facebook.litho">EventDispatcher</a></code></dd>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="../../../../../com/facebook/litho/ComponentLifecycle.html#dispatchOnEvent-com.facebook.litho.EventHandler-java.lang.Object-">dispatchOnEvent</a></code> in class <code><a href="../../../../../com/facebook/litho/ComponentLifecycle.html" title="class in com.facebook.litho">ComponentLifecycle</a></code></dd>
</dl>
</li>
</ul>
<a name="onScrollTrigger-com.facebook.litho.ComponentContext-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>onScrollTrigger</h4>
<pre><a href="https://d.android.com/reference/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</a>
public static <a href="../../../../../com/facebook/litho/EventTrigger.html" title="class in com.facebook.litho">EventTrigger</a> onScrollTrigger(<a href="../../../../../com/facebook/litho/ComponentContext.html" title="class in com.facebook.litho">ComponentContext</a> c,
<a href="https://d.android.com/reference/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)</pre>
<div class="block"><span class="deprecatedLabel">Deprecated.</span> </div>
</li>
</ul>
<a name="onRecyclerConfigChangedTrigger-com.facebook.litho.ComponentContext-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>onRecyclerConfigChangedTrigger</h4>
<pre><a href="https://d.android.com/reference/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</a>
public static <a href="../../../../../com/facebook/litho/EventTrigger.html" title="class in com.facebook.litho">EventTrigger</a> onRecyclerConfigChangedTrigger(<a href="../../../../../com/facebook/litho/ComponentContext.html" title="class in com.facebook.litho">ComponentContext</a> c,
<a href="https://d.android.com/reference/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)</pre>
<div class="block"><span class="deprecatedLabel">Deprecated.</span> </div>
</li>
</ul>
<a name="onScroll-com.facebook.litho.ComponentContext-com.facebook.litho.Handle-int-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>onScroll</h4>
<pre>public static void onScroll(<a href="../../../../../com/facebook/litho/ComponentContext.html" title="class in com.facebook.litho">ComponentContext</a> c,
<a href="../../../../../com/facebook/litho/Handle.html" title="class in com.facebook.litho">Handle</a> handle,
int position,
boolean animate)</pre>
</li>
</ul>
<a name="onScroll-com.facebook.litho.ComponentContext-java.lang.String-int-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>onScroll</h4>
<pre>public static void onScroll(<a href="../../../../../com/facebook/litho/ComponentContext.html" title="class in com.facebook.litho">ComponentContext</a> c,
<a href="https://d.android.com/reference/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
int position,
boolean animate)</pre>
</li>
</ul>
<a name="onScroll-com.facebook.litho.EventTrigger-int-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>onScroll</h4>
<pre>public static void onScroll(<a href="../../../../../com/facebook/litho/EventTrigger.html" title="class in com.facebook.litho">EventTrigger</a> trigger,
int position,
boolean animate)</pre>
</li>
</ul>
<a name="onRecyclerConfigChanged-com.facebook.litho.ComponentContext-com.facebook.litho.Handle-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>onRecyclerConfigChanged</h4>
<pre>public static void onRecyclerConfigChanged(<a href="../../../../../com/facebook/litho/ComponentContext.html" title="class in com.facebook.litho">ComponentContext</a> c,
<a href="../../../../../com/facebook/litho/Handle.html" title="class in com.facebook.litho">Handle</a> handle,
int commitPolicy)</pre>
</li>
</ul>
<a name="onRecyclerConfigChanged-com.facebook.litho.ComponentContext-java.lang.String-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>onRecyclerConfigChanged</h4>
<pre>public static void onRecyclerConfigChanged(<a href="../../../../../com/facebook/litho/ComponentContext.html" title="class in com.facebook.litho">ComponentContext</a> c,
<a href="https://d.android.com/reference/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
int commitPolicy)</pre>
</li>
</ul>
<a name="onRecyclerConfigChanged-com.facebook.litho.EventTrigger-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>onRecyclerConfigChanged</h4>
<pre>public static void onRecyclerConfigChanged(<a href="../../../../../com/facebook/litho/EventTrigger.html" title="class in com.facebook.litho">EventTrigger</a> trigger,
int commitPolicy)</pre>
</li>
</ul>
<a name="acceptTriggerEvent-com.facebook.litho.EventTrigger-java.lang.Object-java.lang.Object:A-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>acceptTriggerEvent</h4>
<pre>public <a href="https://d.android.com/reference/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> acceptTriggerEvent(<a href="../../../../../com/facebook/litho/EventTrigger.html" title="class in com.facebook.litho">EventTrigger</a> eventTrigger,
<a href="https://d.android.com/reference/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> eventState,
<a href="https://d.android.com/reference/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>[] params)</pre>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../../com/facebook/litho/EventTriggerTarget.html#acceptTriggerEvent-com.facebook.litho.EventTrigger-java.lang.Object-java.lang.Object:A-">acceptTriggerEvent</a></code> in interface <code><a href="../../../../../com/facebook/litho/EventTriggerTarget.html" title="interface in com.facebook.litho">EventTriggerTarget</a></code></dd>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="../../../../../com/facebook/litho/ComponentLifecycle.html#acceptTriggerEvent-com.facebook.litho.EventTrigger-java.lang.Object-java.lang.Object:A-">acceptTriggerEvent</a></code> in class <code><a href="../../../../../com/facebook/litho/ComponentLifecycle.html" title="class in com.facebook.litho">ComponentLifecycle</a></code></dd>
</dl>
</li>
</ul>
<a name="recordEventTrigger-com.facebook.litho.EventTriggersContainer-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>recordEventTrigger</h4>
<pre>public void recordEventTrigger(<a href="../../../../../com/facebook/litho/EventTriggersContainer.html" title="class in com.facebook.litho">EventTriggersContainer</a> container)</pre>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../../com/facebook/litho/HasEventTrigger.html#recordEventTrigger-com.facebook.litho.EventTriggersContainer-">recordEventTrigger</a></code> in interface <code><a href="../../../../../com/facebook/litho/HasEventTrigger.html" title="interface in com.facebook.litho">HasEventTrigger</a></code></dd>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="../../../../../com/facebook/litho/Component.html#recordEventTrigger-com.facebook.litho.EventTriggersContainer-">recordEventTrigger</a></code> in class <code><a href="../../../../../com/facebook/litho/Component.html" title="class in com.facebook.litho">Component</a></code></dd>
</dl>
</li>
</ul>
<a name="hasState--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>hasState</h4>
<pre>protected boolean hasState()</pre>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="../../../../../com/facebook/litho/ComponentLifecycle.html#hasState--">hasState</a></code> in class <code><a href="../../../../../com/facebook/litho/ComponentLifecycle.html" title="class in com.facebook.litho">ComponentLifecycle</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true if the Component is using state, false otherwise.</dd>
</dl>
</li>
</ul>
<a name="transferState-com.facebook.litho.StateContainer-com.facebook.litho.StateContainer-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>transferState</h4>
<pre>protected void transferState(<a href="../../../../../com/facebook/litho/StateContainer.html" title="class in com.facebook.litho">StateContainer</a> _prevStateContainer,
<a href="../../../../../com/facebook/litho/StateContainer.html" title="class in com.facebook.litho">StateContainer</a> _nextStateContainer)</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../../../../../com/facebook/litho/ComponentLifecycle.html#transferState-com.facebook.litho.StateContainer-com.facebook.litho.StateContainer-">ComponentLifecycle</a></code></span></div>
<div class="block">Call this to transfer the <a href="../../../../../com/facebook/litho/annotations/State.html" title="annotation in com.facebook.litho.annotations"><code>State</code></a> annotated values between
two <a href="../../../../../com/facebook/litho/Component.html" title="class in com.facebook.litho"><code>Component</code></a> with the same global scope.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="../../../../../com/facebook/litho/ComponentLifecycle.html#transferState-com.facebook.litho.StateContainer-com.facebook.litho.StateContainer-">transferState</a></code> in class <code><a href="../../../../../com/facebook/litho/ComponentLifecycle.html" title="class in com.facebook.litho">ComponentLifecycle</a></code></dd>
</dl>
</li>
</ul>
<a name="updateLoadingState-com.facebook.litho.ComponentContext-RecyclerCollectionComponentSpec.LoadingState-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>updateLoadingState</h4>
<pre>protected static void updateLoadingState(<a href="../../../../../com/facebook/litho/ComponentContext.html" title="class in com.facebook.litho">ComponentContext</a> c,
RecyclerCollectionComponentSpec.LoadingState currentLoadingState)</pre>
</li>
</ul>
<a name="updateLoadingStateAsync-com.facebook.litho.ComponentContext-RecyclerCollectionComponentSpec.LoadingState-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>updateLoadingStateAsync</h4>
<pre>protected static void updateLoadingStateAsync(<a href="../../../../../com/facebook/litho/ComponentContext.html" title="class in com.facebook.litho">ComponentContext</a> c,
RecyclerCollectionComponentSpec.LoadingState currentLoadingState)</pre>
</li>
</ul>
<a name="updateLoadingStateSync-com.facebook.litho.ComponentContext-RecyclerCollectionComponentSpec.LoadingState-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>updateLoadingStateSync</h4>
<pre>protected static void updateLoadingStateSync(<a href="../../../../../com/facebook/litho/ComponentContext.html" title="class in com.facebook.litho">ComponentContext</a> c,
RecyclerCollectionComponentSpec.LoadingState currentLoadingState)</pre>
</li>
</ul>
<a name="lazyUpdateHasSetSectionTreeRoot-com.facebook.litho.ComponentContext-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>lazyUpdateHasSetSectionTreeRoot</h4>
<pre>protected static void lazyUpdateHasSetSectionTreeRoot(<a href="../../../../../com/facebook/litho/ComponentContext.html" title="class in com.facebook.litho">ComponentContext</a> c,
boolean lazyUpdateValue)</pre>
</li>
</ul>
<a name="create-com.facebook.litho.ComponentContext-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>create</h4>
<pre>public static <a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.Builder.html" title="class in com.facebook.litho.sections.widget">RecyclerCollectionComponent.Builder</a> create(<a href="../../../../../com/facebook/litho/ComponentContext.html" title="class in com.facebook.litho">ComponentContext</a> context)</pre>
</li>
</ul>
<a name="create-com.facebook.litho.ComponentContext-int-int-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>create</h4>
<pre>public static <a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.Builder.html" title="class in com.facebook.litho.sections.widget">RecyclerCollectionComponent.Builder</a> create(<a href="../../../../../com/facebook/litho/ComponentContext.html" title="class in com.facebook.litho">ComponentContext</a> context,
int defStyleAttr,
int defStyleRes)</pre>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../com/facebook/litho/sections/widget/RecyclerBinderConfiguration.Builder.html" title="class in com.facebook.litho.sections.widget"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../../../com/facebook/litho/sections/widget/RecyclerCollectionComponent.Builder.html" title="class in com.facebook.litho.sections.widget"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?com/facebook/litho/sections/widget/RecyclerCollectionComponent.html" target="_top">Frames</a></li>
<li><a href="RecyclerCollectionComponent.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li><a href="#nested.class.summary">Nested</a> | </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2017 Google, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.netflix.spinnaker.halyard.cli.command.v1.admin;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
import com.netflix.spinnaker.halyard.cli.command.v1.DeprecatedCommand;
import com.netflix.spinnaker.halyard.cli.command.v1.NestableCommand;
import com.netflix.spinnaker.halyard.cli.services.v1.Daemon;
import com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler;
import java.util.ArrayList;
import java.util.List;
import lombok.AccessLevel;
import lombok.Getter;
@Parameters(separators = "=")
public class PublishLatestCommand extends NestableCommand implements DeprecatedCommand {
@Getter(AccessLevel.PUBLIC)
private String commandName = "latest";
@Getter(AccessLevel.PUBLIC)
private String shortDescription =
"Publish the latest version of Spinnaker to the global versions.yml tracking file.";
@Getter(AccessLevel.PUBLIC)
private String deprecatedWarning = "Please use `hal admin publish latest-spinnaker` instead.";
@Override
public String getMainParameter() {
return "version";
}
@Parameter(description = "The latest version of Spinnaker to record.", arity = 1)
List<String> versions = new ArrayList<>();
public String getVersion() {
switch (versions.size()) {
case 0:
throw new IllegalArgumentException("No version supplied.");
case 1:
return versions.get(0);
default:
throw new IllegalArgumentException("More than one version supplied");
}
}
@Override
protected void executeThis() {
new OperationHandler<Void>()
.setFailureMesssage("Failed to publish your version.")
.setSuccessMessage("Successfully published your version.")
.setOperation(Daemon.publishLatestSpinnaker(getVersion()))
.get();
}
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2011 - 2012 Samsung Electronics Co., Ltd.
* http://www.samsung.com
*
* Samsung EXYNOS5 SoC series G-Scaler driver
*
* 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.
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/bug.h>
#include <linux/interrupt.h>
#include <linux/workqueue.h>
#include <linux/device.h>
#include <linux/platform_device.h>
#include <linux/list.h>
#include <linux/io.h>
#include <linux/slab.h>
#include <linux/clk.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <media/v4l2-ioctl.h>
#include "gsc-core.h"
static const struct gsc_fmt gsc_formats[] = {
{
.name = "RGB565",
.pixelformat = V4L2_PIX_FMT_RGB565X,
.depth = { 16 },
.color = GSC_RGB,
.num_planes = 1,
.num_comp = 1,
}, {
.name = "BGRX-8-8-8-8, 32 bpp",
.pixelformat = V4L2_PIX_FMT_BGR32,
.depth = { 32 },
.color = GSC_RGB,
.num_planes = 1,
.num_comp = 1,
}, {
.name = "YUV 4:2:2 packed, YCbYCr",
.pixelformat = V4L2_PIX_FMT_YUYV,
.depth = { 16 },
.color = GSC_YUV422,
.yorder = GSC_LSB_Y,
.corder = GSC_CBCR,
.num_planes = 1,
.num_comp = 1,
.mbus_code = MEDIA_BUS_FMT_YUYV8_2X8,
}, {
.name = "YUV 4:2:2 packed, CbYCrY",
.pixelformat = V4L2_PIX_FMT_UYVY,
.depth = { 16 },
.color = GSC_YUV422,
.yorder = GSC_LSB_C,
.corder = GSC_CBCR,
.num_planes = 1,
.num_comp = 1,
.mbus_code = MEDIA_BUS_FMT_UYVY8_2X8,
}, {
.name = "YUV 4:2:2 packed, CrYCbY",
.pixelformat = V4L2_PIX_FMT_VYUY,
.depth = { 16 },
.color = GSC_YUV422,
.yorder = GSC_LSB_C,
.corder = GSC_CRCB,
.num_planes = 1,
.num_comp = 1,
.mbus_code = MEDIA_BUS_FMT_VYUY8_2X8,
}, {
.name = "YUV 4:2:2 packed, YCrYCb",
.pixelformat = V4L2_PIX_FMT_YVYU,
.depth = { 16 },
.color = GSC_YUV422,
.yorder = GSC_LSB_Y,
.corder = GSC_CRCB,
.num_planes = 1,
.num_comp = 1,
.mbus_code = MEDIA_BUS_FMT_YVYU8_2X8,
}, {
.name = "YUV 4:4:4 planar, YCbYCr",
.pixelformat = V4L2_PIX_FMT_YUV32,
.depth = { 32 },
.color = GSC_YUV444,
.yorder = GSC_LSB_Y,
.corder = GSC_CBCR,
.num_planes = 1,
.num_comp = 1,
}, {
.name = "YUV 4:2:2 planar, Y/Cb/Cr",
.pixelformat = V4L2_PIX_FMT_YUV422P,
.depth = { 16 },
.color = GSC_YUV422,
.yorder = GSC_LSB_Y,
.corder = GSC_CBCR,
.num_planes = 1,
.num_comp = 3,
}, {
.name = "YUV 4:2:2 planar, Y/CbCr",
.pixelformat = V4L2_PIX_FMT_NV16,
.depth = { 16 },
.color = GSC_YUV422,
.yorder = GSC_LSB_Y,
.corder = GSC_CBCR,
.num_planes = 1,
.num_comp = 2,
}, {
.name = "YUV 4:2:2 planar, Y/CrCb",
.pixelformat = V4L2_PIX_FMT_NV61,
.depth = { 16 },
.color = GSC_YUV422,
.yorder = GSC_LSB_Y,
.corder = GSC_CRCB,
.num_planes = 1,
.num_comp = 2,
}, {
.name = "YUV 4:2:0 planar, YCbCr",
.pixelformat = V4L2_PIX_FMT_YUV420,
.depth = { 12 },
.color = GSC_YUV420,
.yorder = GSC_LSB_Y,
.corder = GSC_CBCR,
.num_planes = 1,
.num_comp = 3,
}, {
.name = "YUV 4:2:0 planar, YCrCb",
.pixelformat = V4L2_PIX_FMT_YVU420,
.depth = { 12 },
.color = GSC_YUV420,
.yorder = GSC_LSB_Y,
.corder = GSC_CRCB,
.num_planes = 1,
.num_comp = 3,
}, {
.name = "YUV 4:2:0 planar, Y/CbCr",
.pixelformat = V4L2_PIX_FMT_NV12,
.depth = { 12 },
.color = GSC_YUV420,
.yorder = GSC_LSB_Y,
.corder = GSC_CBCR,
.num_planes = 1,
.num_comp = 2,
}, {
.name = "YUV 4:2:0 planar, Y/CrCb",
.pixelformat = V4L2_PIX_FMT_NV21,
.depth = { 12 },
.color = GSC_YUV420,
.yorder = GSC_LSB_Y,
.corder = GSC_CRCB,
.num_planes = 1,
.num_comp = 2,
}, {
.name = "YUV 4:2:0 non-contig. 2p, Y/CbCr",
.pixelformat = V4L2_PIX_FMT_NV12M,
.depth = { 8, 4 },
.color = GSC_YUV420,
.yorder = GSC_LSB_Y,
.corder = GSC_CBCR,
.num_planes = 2,
.num_comp = 2,
}, {
.name = "YUV 4:2:0 non-contig. 3p, Y/Cb/Cr",
.pixelformat = V4L2_PIX_FMT_YUV420M,
.depth = { 8, 2, 2 },
.color = GSC_YUV420,
.yorder = GSC_LSB_Y,
.corder = GSC_CBCR,
.num_planes = 3,
.num_comp = 3,
}, {
.name = "YUV 4:2:0 non-contig. 3p, Y/Cr/Cb",
.pixelformat = V4L2_PIX_FMT_YVU420M,
.depth = { 8, 2, 2 },
.color = GSC_YUV420,
.yorder = GSC_LSB_Y,
.corder = GSC_CRCB,
.num_planes = 3,
.num_comp = 3,
}, {
.name = "YUV 4:2:0 n.c. 2p, Y/CbCr tiled",
.pixelformat = V4L2_PIX_FMT_NV12MT_16X16,
.depth = { 8, 4 },
.color = GSC_YUV420,
.yorder = GSC_LSB_Y,
.corder = GSC_CBCR,
.num_planes = 2,
.num_comp = 2,
}
};
const struct gsc_fmt *get_format(int index)
{
if (index >= ARRAY_SIZE(gsc_formats))
return NULL;
return (struct gsc_fmt *)&gsc_formats[index];
}
const struct gsc_fmt *find_fmt(u32 *pixelformat, u32 *mbus_code, u32 index)
{
const struct gsc_fmt *fmt, *def_fmt = NULL;
unsigned int i;
if (index >= ARRAY_SIZE(gsc_formats))
return NULL;
for (i = 0; i < ARRAY_SIZE(gsc_formats); ++i) {
fmt = get_format(i);
if (pixelformat && fmt->pixelformat == *pixelformat)
return fmt;
if (mbus_code && fmt->mbus_code == *mbus_code)
return fmt;
if (index == i)
def_fmt = fmt;
}
return def_fmt;
}
void gsc_set_frame_size(struct gsc_frame *frame, int width, int height)
{
frame->f_width = width;
frame->f_height = height;
frame->crop.width = width;
frame->crop.height = height;
frame->crop.left = 0;
frame->crop.top = 0;
}
int gsc_cal_prescaler_ratio(struct gsc_variant *var, u32 src, u32 dst,
u32 *ratio)
{
if ((dst > src) || (dst >= src / var->poly_sc_down_max)) {
*ratio = 1;
return 0;
}
if ((src / var->poly_sc_down_max / var->pre_sc_down_max) > dst) {
pr_err("Exceeded maximum downscaling ratio (1/16))");
return -EINVAL;
}
*ratio = (dst > (src / 8)) ? 2 : 4;
return 0;
}
void gsc_get_prescaler_shfactor(u32 hratio, u32 vratio, u32 *sh)
{
if (hratio == 4 && vratio == 4)
*sh = 4;
else if ((hratio == 4 && vratio == 2) ||
(hratio == 2 && vratio == 4))
*sh = 3;
else if ((hratio == 4 && vratio == 1) ||
(hratio == 1 && vratio == 4) ||
(hratio == 2 && vratio == 2))
*sh = 2;
else if (hratio == 1 && vratio == 1)
*sh = 0;
else
*sh = 1;
}
void gsc_check_src_scale_info(struct gsc_variant *var,
struct gsc_frame *s_frame, u32 *wratio,
u32 tx, u32 ty, u32 *hratio)
{
int remainder = 0, walign, halign;
if (is_yuv420(s_frame->fmt->color)) {
walign = GSC_SC_ALIGN_4;
halign = GSC_SC_ALIGN_4;
} else if (is_yuv422(s_frame->fmt->color)) {
walign = GSC_SC_ALIGN_4;
halign = GSC_SC_ALIGN_2;
} else {
walign = GSC_SC_ALIGN_2;
halign = GSC_SC_ALIGN_2;
}
remainder = s_frame->crop.width % (*wratio * walign);
if (remainder) {
s_frame->crop.width -= remainder;
gsc_cal_prescaler_ratio(var, s_frame->crop.width, tx, wratio);
pr_info("cropped src width size is recalculated from %d to %d",
s_frame->crop.width + remainder, s_frame->crop.width);
}
remainder = s_frame->crop.height % (*hratio * halign);
if (remainder) {
s_frame->crop.height -= remainder;
gsc_cal_prescaler_ratio(var, s_frame->crop.height, ty, hratio);
pr_info("cropped src height size is recalculated from %d to %d",
s_frame->crop.height + remainder, s_frame->crop.height);
}
}
int gsc_enum_fmt_mplane(struct v4l2_fmtdesc *f)
{
const struct gsc_fmt *fmt;
fmt = find_fmt(NULL, NULL, f->index);
if (!fmt)
return -EINVAL;
strlcpy(f->description, fmt->name, sizeof(f->description));
f->pixelformat = fmt->pixelformat;
return 0;
}
static int get_plane_info(struct gsc_frame *frm, u32 addr, u32 *index, u32 *ret_addr)
{
if (frm->addr.y == addr) {
*index = 0;
*ret_addr = frm->addr.y;
} else if (frm->addr.cb == addr) {
*index = 1;
*ret_addr = frm->addr.cb;
} else if (frm->addr.cr == addr) {
*index = 2;
*ret_addr = frm->addr.cr;
} else {
pr_err("Plane address is wrong");
return -EINVAL;
}
return 0;
}
void gsc_set_prefbuf(struct gsc_dev *gsc, struct gsc_frame *frm)
{
u32 f_chk_addr, f_chk_len, s_chk_addr, s_chk_len;
f_chk_addr = f_chk_len = s_chk_addr = s_chk_len = 0;
f_chk_addr = frm->addr.y;
f_chk_len = frm->payload[0];
if (frm->fmt->num_planes == 2) {
s_chk_addr = frm->addr.cb;
s_chk_len = frm->payload[1];
} else if (frm->fmt->num_planes == 3) {
u32 low_addr, low_plane, mid_addr, mid_plane;
u32 high_addr, high_plane;
u32 t_min, t_max;
t_min = min3(frm->addr.y, frm->addr.cb, frm->addr.cr);
if (get_plane_info(frm, t_min, &low_plane, &low_addr))
return;
t_max = max3(frm->addr.y, frm->addr.cb, frm->addr.cr);
if (get_plane_info(frm, t_max, &high_plane, &high_addr))
return;
mid_plane = 3 - (low_plane + high_plane);
if (mid_plane == 0)
mid_addr = frm->addr.y;
else if (mid_plane == 1)
mid_addr = frm->addr.cb;
else if (mid_plane == 2)
mid_addr = frm->addr.cr;
else
return;
f_chk_addr = low_addr;
if (mid_addr + frm->payload[mid_plane] - low_addr >
high_addr + frm->payload[high_plane] - mid_addr) {
f_chk_len = frm->payload[low_plane];
s_chk_addr = mid_addr;
s_chk_len = high_addr +
frm->payload[high_plane] - mid_addr;
} else {
f_chk_len = mid_addr +
frm->payload[mid_plane] - low_addr;
s_chk_addr = high_addr;
s_chk_len = frm->payload[high_plane];
}
}
pr_debug("f_addr = 0x%08x, f_len = %d, s_addr = 0x%08x, s_len = %d\n",
f_chk_addr, f_chk_len, s_chk_addr, s_chk_len);
}
int gsc_try_fmt_mplane(struct gsc_ctx *ctx, struct v4l2_format *f)
{
struct gsc_dev *gsc = ctx->gsc_dev;
struct gsc_variant *variant = gsc->variant;
struct v4l2_pix_format_mplane *pix_mp = &f->fmt.pix_mp;
const struct gsc_fmt *fmt;
u32 max_w, max_h, mod_x, mod_y;
u32 min_w, min_h, tmp_w, tmp_h;
int i;
pr_debug("user put w: %d, h: %d", pix_mp->width, pix_mp->height);
fmt = find_fmt(&pix_mp->pixelformat, NULL, 0);
if (!fmt) {
pr_err("pixelformat format (0x%X) invalid\n",
pix_mp->pixelformat);
return -EINVAL;
}
if (pix_mp->field == V4L2_FIELD_ANY)
pix_mp->field = V4L2_FIELD_NONE;
else if (pix_mp->field != V4L2_FIELD_NONE) {
pr_debug("Not supported field order(%d)\n", pix_mp->field);
return -EINVAL;
}
max_w = variant->pix_max->target_rot_dis_w;
max_h = variant->pix_max->target_rot_dis_h;
mod_x = ffs(variant->pix_align->org_w) - 1;
if (is_yuv420(fmt->color))
mod_y = ffs(variant->pix_align->org_h) - 1;
else
mod_y = ffs(variant->pix_align->org_h) - 2;
if (V4L2_TYPE_IS_OUTPUT(f->type)) {
min_w = variant->pix_min->org_w;
min_h = variant->pix_min->org_h;
} else {
min_w = variant->pix_min->target_rot_dis_w;
min_h = variant->pix_min->target_rot_dis_h;
}
pr_debug("mod_x: %d, mod_y: %d, max_w: %d, max_h = %d",
mod_x, mod_y, max_w, max_h);
/* To check if image size is modified to adjust parameter against
hardware abilities */
tmp_w = pix_mp->width;
tmp_h = pix_mp->height;
v4l_bound_align_image(&pix_mp->width, min_w, max_w, mod_x,
&pix_mp->height, min_h, max_h, mod_y, 0);
if (tmp_w != pix_mp->width || tmp_h != pix_mp->height)
pr_debug("Image size has been modified from %dx%d to %dx%d\n",
tmp_w, tmp_h, pix_mp->width, pix_mp->height);
pix_mp->num_planes = fmt->num_planes;
if (pix_mp->width >= 1280) /* HD */
pix_mp->colorspace = V4L2_COLORSPACE_REC709;
else /* SD */
pix_mp->colorspace = V4L2_COLORSPACE_SMPTE170M;
for (i = 0; i < pix_mp->num_planes; ++i) {
struct v4l2_plane_pix_format *plane_fmt = &pix_mp->plane_fmt[i];
u32 bpl = plane_fmt->bytesperline;
if (fmt->num_comp == 1 && /* Packed */
(bpl == 0 || (bpl * 8 / fmt->depth[i]) < pix_mp->width))
bpl = pix_mp->width * fmt->depth[i] / 8;
if (fmt->num_comp > 1 && /* Planar */
(bpl == 0 || bpl < pix_mp->width))
bpl = pix_mp->width;
if (i != 0 && fmt->num_comp == 3)
bpl /= 2;
plane_fmt->bytesperline = bpl;
plane_fmt->sizeimage = max(pix_mp->width * pix_mp->height *
fmt->depth[i] / 8,
plane_fmt->sizeimage);
pr_debug("[%d]: bpl: %d, sizeimage: %d",
i, bpl, pix_mp->plane_fmt[i].sizeimage);
}
return 0;
}
int gsc_g_fmt_mplane(struct gsc_ctx *ctx, struct v4l2_format *f)
{
struct gsc_frame *frame;
struct v4l2_pix_format_mplane *pix_mp;
int i;
frame = ctx_get_frame(ctx, f->type);
if (IS_ERR(frame))
return PTR_ERR(frame);
pix_mp = &f->fmt.pix_mp;
pix_mp->width = frame->f_width;
pix_mp->height = frame->f_height;
pix_mp->field = V4L2_FIELD_NONE;
pix_mp->pixelformat = frame->fmt->pixelformat;
pix_mp->colorspace = V4L2_COLORSPACE_REC709;
pix_mp->num_planes = frame->fmt->num_planes;
for (i = 0; i < pix_mp->num_planes; ++i) {
pix_mp->plane_fmt[i].bytesperline = (frame->f_width *
frame->fmt->depth[i]) / 8;
pix_mp->plane_fmt[i].sizeimage =
pix_mp->plane_fmt[i].bytesperline * frame->f_height;
}
return 0;
}
void gsc_check_crop_change(u32 tmp_w, u32 tmp_h, u32 *w, u32 *h)
{
if (tmp_w != *w || tmp_h != *h) {
pr_info("Cropped size has been modified from %dx%d to %dx%d",
*w, *h, tmp_w, tmp_h);
*w = tmp_w;
*h = tmp_h;
}
}
int gsc_g_crop(struct gsc_ctx *ctx, struct v4l2_crop *cr)
{
struct gsc_frame *frame;
frame = ctx_get_frame(ctx, cr->type);
if (IS_ERR(frame))
return PTR_ERR(frame);
cr->c = frame->crop;
return 0;
}
int gsc_try_crop(struct gsc_ctx *ctx, struct v4l2_crop *cr)
{
struct gsc_frame *f;
struct gsc_dev *gsc = ctx->gsc_dev;
struct gsc_variant *variant = gsc->variant;
u32 mod_x = 0, mod_y = 0, tmp_w, tmp_h;
u32 min_w, min_h, max_w, max_h;
if (cr->c.top < 0 || cr->c.left < 0) {
pr_err("doesn't support negative values for top & left\n");
return -EINVAL;
}
pr_debug("user put w: %d, h: %d", cr->c.width, cr->c.height);
if (cr->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
f = &ctx->d_frame;
else if (cr->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
f = &ctx->s_frame;
else
return -EINVAL;
max_w = f->f_width;
max_h = f->f_height;
tmp_w = cr->c.width;
tmp_h = cr->c.height;
if (V4L2_TYPE_IS_OUTPUT(cr->type)) {
if ((is_yuv422(f->fmt->color) && f->fmt->num_comp == 1) ||
is_rgb(f->fmt->color))
min_w = 32;
else
min_w = 64;
if ((is_yuv422(f->fmt->color) && f->fmt->num_comp == 3) ||
is_yuv420(f->fmt->color))
min_h = 32;
else
min_h = 16;
} else {
if (is_yuv420(f->fmt->color) || is_yuv422(f->fmt->color))
mod_x = ffs(variant->pix_align->target_w) - 1;
if (is_yuv420(f->fmt->color))
mod_y = ffs(variant->pix_align->target_h) - 1;
if (ctx->gsc_ctrls.rotate->val == 90 ||
ctx->gsc_ctrls.rotate->val == 270) {
max_w = f->f_height;
max_h = f->f_width;
min_w = variant->pix_min->target_rot_en_w;
min_h = variant->pix_min->target_rot_en_h;
tmp_w = cr->c.height;
tmp_h = cr->c.width;
} else {
min_w = variant->pix_min->target_rot_dis_w;
min_h = variant->pix_min->target_rot_dis_h;
}
}
pr_debug("mod_x: %d, mod_y: %d, min_w: %d, min_h = %d",
mod_x, mod_y, min_w, min_h);
pr_debug("tmp_w : %d, tmp_h : %d", tmp_w, tmp_h);
v4l_bound_align_image(&tmp_w, min_w, max_w, mod_x,
&tmp_h, min_h, max_h, mod_y, 0);
if (!V4L2_TYPE_IS_OUTPUT(cr->type) &&
(ctx->gsc_ctrls.rotate->val == 90 ||
ctx->gsc_ctrls.rotate->val == 270))
gsc_check_crop_change(tmp_h, tmp_w,
&cr->c.width, &cr->c.height);
else
gsc_check_crop_change(tmp_w, tmp_h,
&cr->c.width, &cr->c.height);
/* adjust left/top if cropping rectangle is out of bounds */
/* Need to add code to algin left value with 2's multiple */
if (cr->c.left + tmp_w > max_w)
cr->c.left = max_w - tmp_w;
if (cr->c.top + tmp_h > max_h)
cr->c.top = max_h - tmp_h;
if ((is_yuv420(f->fmt->color) || is_yuv422(f->fmt->color)) &&
cr->c.left & 1)
cr->c.left -= 1;
pr_debug("Aligned l:%d, t:%d, w:%d, h:%d, f_w: %d, f_h: %d",
cr->c.left, cr->c.top, cr->c.width, cr->c.height, max_w, max_h);
return 0;
}
int gsc_check_scaler_ratio(struct gsc_variant *var, int sw, int sh, int dw,
int dh, int rot, int out_path)
{
int tmp_w, tmp_h, sc_down_max;
if (out_path == GSC_DMA)
sc_down_max = var->sc_down_max;
else
sc_down_max = var->local_sc_down;
if (rot == 90 || rot == 270) {
tmp_w = dh;
tmp_h = dw;
} else {
tmp_w = dw;
tmp_h = dh;
}
if ((sw / tmp_w) > sc_down_max ||
(sh / tmp_h) > sc_down_max ||
(tmp_w / sw) > var->sc_up_max ||
(tmp_h / sh) > var->sc_up_max)
return -EINVAL;
return 0;
}
int gsc_set_scaler_info(struct gsc_ctx *ctx)
{
struct gsc_scaler *sc = &ctx->scaler;
struct gsc_frame *s_frame = &ctx->s_frame;
struct gsc_frame *d_frame = &ctx->d_frame;
struct gsc_variant *variant = ctx->gsc_dev->variant;
struct device *dev = &ctx->gsc_dev->pdev->dev;
int tx, ty;
int ret;
ret = gsc_check_scaler_ratio(variant, s_frame->crop.width,
s_frame->crop.height, d_frame->crop.width, d_frame->crop.height,
ctx->gsc_ctrls.rotate->val, ctx->out_path);
if (ret) {
pr_err("out of scaler range");
return ret;
}
if (ctx->gsc_ctrls.rotate->val == 90 ||
ctx->gsc_ctrls.rotate->val == 270) {
ty = d_frame->crop.width;
tx = d_frame->crop.height;
} else {
tx = d_frame->crop.width;
ty = d_frame->crop.height;
}
if (tx <= 0 || ty <= 0) {
dev_err(dev, "Invalid target size: %dx%d", tx, ty);
return -EINVAL;
}
ret = gsc_cal_prescaler_ratio(variant, s_frame->crop.width,
tx, &sc->pre_hratio);
if (ret) {
pr_err("Horizontal scale ratio is out of range");
return ret;
}
ret = gsc_cal_prescaler_ratio(variant, s_frame->crop.height,
ty, &sc->pre_vratio);
if (ret) {
pr_err("Vertical scale ratio is out of range");
return ret;
}
gsc_check_src_scale_info(variant, s_frame, &sc->pre_hratio,
tx, ty, &sc->pre_vratio);
gsc_get_prescaler_shfactor(sc->pre_hratio, sc->pre_vratio,
&sc->pre_shfactor);
sc->main_hratio = (s_frame->crop.width << 16) / tx;
sc->main_vratio = (s_frame->crop.height << 16) / ty;
pr_debug("scaler input/output size : sx = %d, sy = %d, tx = %d, ty = %d",
s_frame->crop.width, s_frame->crop.height, tx, ty);
pr_debug("scaler ratio info : pre_shfactor : %d, pre_h : %d",
sc->pre_shfactor, sc->pre_hratio);
pr_debug("pre_v :%d, main_h : %d, main_v : %d",
sc->pre_vratio, sc->main_hratio, sc->main_vratio);
return 0;
}
static int __gsc_s_ctrl(struct gsc_ctx *ctx, struct v4l2_ctrl *ctrl)
{
struct gsc_dev *gsc = ctx->gsc_dev;
struct gsc_variant *variant = gsc->variant;
unsigned int flags = GSC_DST_FMT | GSC_SRC_FMT;
int ret = 0;
if (ctrl->flags & V4L2_CTRL_FLAG_INACTIVE)
return 0;
switch (ctrl->id) {
case V4L2_CID_HFLIP:
ctx->hflip = ctrl->val;
break;
case V4L2_CID_VFLIP:
ctx->vflip = ctrl->val;
break;
case V4L2_CID_ROTATE:
if ((ctx->state & flags) == flags) {
ret = gsc_check_scaler_ratio(variant,
ctx->s_frame.crop.width,
ctx->s_frame.crop.height,
ctx->d_frame.crop.width,
ctx->d_frame.crop.height,
ctx->gsc_ctrls.rotate->val,
ctx->out_path);
if (ret)
return -EINVAL;
}
ctx->rotation = ctrl->val;
break;
case V4L2_CID_ALPHA_COMPONENT:
ctx->d_frame.alpha = ctrl->val;
break;
}
ctx->state |= GSC_PARAMS;
return 0;
}
static int gsc_s_ctrl(struct v4l2_ctrl *ctrl)
{
struct gsc_ctx *ctx = ctrl_to_ctx(ctrl);
unsigned long flags;
int ret;
spin_lock_irqsave(&ctx->gsc_dev->slock, flags);
ret = __gsc_s_ctrl(ctx, ctrl);
spin_unlock_irqrestore(&ctx->gsc_dev->slock, flags);
return ret;
}
static const struct v4l2_ctrl_ops gsc_ctrl_ops = {
.s_ctrl = gsc_s_ctrl,
};
int gsc_ctrls_create(struct gsc_ctx *ctx)
{
if (ctx->ctrls_rdy) {
pr_err("Control handler of this context was created already");
return 0;
}
v4l2_ctrl_handler_init(&ctx->ctrl_handler, GSC_MAX_CTRL_NUM);
ctx->gsc_ctrls.rotate = v4l2_ctrl_new_std(&ctx->ctrl_handler,
&gsc_ctrl_ops, V4L2_CID_ROTATE, 0, 270, 90, 0);
ctx->gsc_ctrls.hflip = v4l2_ctrl_new_std(&ctx->ctrl_handler,
&gsc_ctrl_ops, V4L2_CID_HFLIP, 0, 1, 1, 0);
ctx->gsc_ctrls.vflip = v4l2_ctrl_new_std(&ctx->ctrl_handler,
&gsc_ctrl_ops, V4L2_CID_VFLIP, 0, 1, 1, 0);
ctx->gsc_ctrls.global_alpha = v4l2_ctrl_new_std(&ctx->ctrl_handler,
&gsc_ctrl_ops, V4L2_CID_ALPHA_COMPONENT, 0, 255, 1, 0);
ctx->ctrls_rdy = ctx->ctrl_handler.error == 0;
if (ctx->ctrl_handler.error) {
int err = ctx->ctrl_handler.error;
v4l2_ctrl_handler_free(&ctx->ctrl_handler);
pr_err("Failed to create G-Scaler control handlers");
return err;
}
return 0;
}
void gsc_ctrls_delete(struct gsc_ctx *ctx)
{
if (ctx->ctrls_rdy) {
v4l2_ctrl_handler_free(&ctx->ctrl_handler);
ctx->ctrls_rdy = false;
}
}
/* The color format (num_comp, num_planes) must be already configured. */
int gsc_prepare_addr(struct gsc_ctx *ctx, struct vb2_buffer *vb,
struct gsc_frame *frame, struct gsc_addr *addr)
{
int ret = 0;
u32 pix_size;
if ((vb == NULL) || (frame == NULL))
return -EINVAL;
pix_size = frame->f_width * frame->f_height;
pr_debug("num_planes= %d, num_comp= %d, pix_size= %d",
frame->fmt->num_planes, frame->fmt->num_comp, pix_size);
addr->y = vb2_dma_contig_plane_dma_addr(vb, 0);
if (frame->fmt->num_planes == 1) {
switch (frame->fmt->num_comp) {
case 1:
addr->cb = 0;
addr->cr = 0;
break;
case 2:
/* decompose Y into Y/Cb */
addr->cb = (dma_addr_t)(addr->y + pix_size);
addr->cr = 0;
break;
case 3:
/* decompose Y into Y/Cb/Cr */
addr->cb = (dma_addr_t)(addr->y + pix_size);
if (GSC_YUV420 == frame->fmt->color)
addr->cr = (dma_addr_t)(addr->cb
+ (pix_size >> 2));
else /* 422 */
addr->cr = (dma_addr_t)(addr->cb
+ (pix_size >> 1));
break;
default:
pr_err("Invalid the number of color planes");
return -EINVAL;
}
} else {
if (frame->fmt->num_planes >= 2)
addr->cb = vb2_dma_contig_plane_dma_addr(vb, 1);
if (frame->fmt->num_planes == 3)
addr->cr = vb2_dma_contig_plane_dma_addr(vb, 2);
}
if ((frame->fmt->pixelformat == V4L2_PIX_FMT_VYUY) ||
(frame->fmt->pixelformat == V4L2_PIX_FMT_YVYU) ||
(frame->fmt->pixelformat == V4L2_PIX_FMT_YVU420) ||
(frame->fmt->pixelformat == V4L2_PIX_FMT_YVU420M))
swap(addr->cb, addr->cr);
pr_debug("ADDR: y= %pad cb= %pad cr= %pad ret= %d",
&addr->y, &addr->cb, &addr->cr, ret);
return ret;
}
static irqreturn_t gsc_irq_handler(int irq, void *priv)
{
struct gsc_dev *gsc = priv;
struct gsc_ctx *ctx;
int gsc_irq;
gsc_irq = gsc_hw_get_irq_status(gsc);
gsc_hw_clear_irq(gsc, gsc_irq);
if (gsc_irq == GSC_IRQ_OVERRUN) {
pr_err("Local path input over-run interrupt has occurred!\n");
return IRQ_HANDLED;
}
spin_lock(&gsc->slock);
if (test_and_clear_bit(ST_M2M_PEND, &gsc->state)) {
gsc_hw_enable_control(gsc, false);
if (test_and_clear_bit(ST_M2M_SUSPENDING, &gsc->state)) {
set_bit(ST_M2M_SUSPENDED, &gsc->state);
wake_up(&gsc->irq_queue);
goto isr_unlock;
}
ctx = v4l2_m2m_get_curr_priv(gsc->m2m.m2m_dev);
if (!ctx || !ctx->m2m_ctx)
goto isr_unlock;
spin_unlock(&gsc->slock);
gsc_m2m_job_finish(ctx, VB2_BUF_STATE_DONE);
/* wake_up job_abort, stop_streaming */
if (ctx->state & GSC_CTX_STOP_REQ) {
ctx->state &= ~GSC_CTX_STOP_REQ;
wake_up(&gsc->irq_queue);
}
return IRQ_HANDLED;
}
isr_unlock:
spin_unlock(&gsc->slock);
return IRQ_HANDLED;
}
static struct gsc_pix_max gsc_v_100_max = {
.org_scaler_bypass_w = 8192,
.org_scaler_bypass_h = 8192,
.org_scaler_input_w = 4800,
.org_scaler_input_h = 3344,
.real_rot_dis_w = 4800,
.real_rot_dis_h = 3344,
.real_rot_en_w = 2047,
.real_rot_en_h = 2047,
.target_rot_dis_w = 4800,
.target_rot_dis_h = 3344,
.target_rot_en_w = 2016,
.target_rot_en_h = 2016,
};
static struct gsc_pix_min gsc_v_100_min = {
.org_w = 64,
.org_h = 32,
.real_w = 64,
.real_h = 32,
.target_rot_dis_w = 64,
.target_rot_dis_h = 32,
.target_rot_en_w = 32,
.target_rot_en_h = 16,
};
static struct gsc_pix_align gsc_v_100_align = {
.org_h = 16,
.org_w = 16, /* yuv420 : 16, others : 8 */
.offset_h = 2, /* yuv420/422 : 2, others : 1 */
.real_w = 16, /* yuv420/422 : 4~16, others : 2~8 */
.real_h = 16, /* yuv420 : 4~16, others : 1 */
.target_w = 2, /* yuv420/422 : 2, others : 1 */
.target_h = 2, /* yuv420 : 2, others : 1 */
};
static struct gsc_variant gsc_v_100_variant = {
.pix_max = &gsc_v_100_max,
.pix_min = &gsc_v_100_min,
.pix_align = &gsc_v_100_align,
.in_buf_cnt = 32,
.out_buf_cnt = 32,
.sc_up_max = 8,
.sc_down_max = 16,
.poly_sc_down_max = 4,
.pre_sc_down_max = 4,
.local_sc_down = 2,
};
static struct gsc_driverdata gsc_v_100_drvdata = {
.variant = {
[0] = &gsc_v_100_variant,
[1] = &gsc_v_100_variant,
[2] = &gsc_v_100_variant,
[3] = &gsc_v_100_variant,
},
.num_entities = 4,
.clk_names = { "gscl" },
.num_clocks = 1,
};
static struct gsc_driverdata gsc_5433_drvdata = {
.variant = {
[0] = &gsc_v_100_variant,
[1] = &gsc_v_100_variant,
[2] = &gsc_v_100_variant,
},
.num_entities = 3,
.clk_names = { "pclk", "aclk", "aclk_xiu", "aclk_gsclbend" },
.num_clocks = 4,
};
static const struct of_device_id exynos_gsc_match[] = {
{
.compatible = "samsung,exynos5-gsc",
.data = &gsc_v_100_drvdata,
},
{
.compatible = "samsung,exynos5433-gsc",
.data = &gsc_5433_drvdata,
},
{},
};
MODULE_DEVICE_TABLE(of, exynos_gsc_match);
static int gsc_probe(struct platform_device *pdev)
{
struct gsc_dev *gsc;
struct resource *res;
struct device *dev = &pdev->dev;
const struct gsc_driverdata *drv_data = of_device_get_match_data(dev);
int ret;
int i;
gsc = devm_kzalloc(dev, sizeof(struct gsc_dev), GFP_KERNEL);
if (!gsc)
return -ENOMEM;
ret = of_alias_get_id(pdev->dev.of_node, "gsc");
if (ret < 0)
return ret;
gsc->id = ret;
if (gsc->id >= drv_data->num_entities) {
dev_err(dev, "Invalid platform device id: %d\n", gsc->id);
return -EINVAL;
}
gsc->num_clocks = drv_data->num_clocks;
gsc->variant = drv_data->variant[gsc->id];
gsc->pdev = pdev;
init_waitqueue_head(&gsc->irq_queue);
spin_lock_init(&gsc->slock);
mutex_init(&gsc->lock);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
gsc->regs = devm_ioremap_resource(dev, res);
if (IS_ERR(gsc->regs))
return PTR_ERR(gsc->regs);
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (!res) {
dev_err(dev, "failed to get IRQ resource\n");
return -ENXIO;
}
for (i = 0; i < gsc->num_clocks; i++) {
gsc->clock[i] = devm_clk_get(dev, drv_data->clk_names[i]);
if (IS_ERR(gsc->clock[i])) {
dev_err(dev, "failed to get clock: %s\n",
drv_data->clk_names[i]);
return PTR_ERR(gsc->clock[i]);
}
}
for (i = 0; i < gsc->num_clocks; i++) {
ret = clk_prepare_enable(gsc->clock[i]);
if (ret) {
dev_err(dev, "clock prepare failed for clock: %s\n",
drv_data->clk_names[i]);
while (--i >= 0)
clk_disable_unprepare(gsc->clock[i]);
return ret;
}
}
ret = devm_request_irq(dev, res->start, gsc_irq_handler,
0, pdev->name, gsc);
if (ret) {
dev_err(dev, "failed to install irq (%d)\n", ret);
goto err_clk;
}
ret = v4l2_device_register(dev, &gsc->v4l2_dev);
if (ret)
goto err_clk;
ret = gsc_register_m2m_device(gsc);
if (ret)
goto err_v4l2;
platform_set_drvdata(pdev, gsc);
gsc_hw_set_sw_reset(gsc);
gsc_wait_reset(gsc);
vb2_dma_contig_set_max_seg_size(dev, DMA_BIT_MASK(32));
dev_dbg(dev, "gsc-%d registered successfully\n", gsc->id);
pm_runtime_set_active(dev);
pm_runtime_enable(dev);
return 0;
err_v4l2:
v4l2_device_unregister(&gsc->v4l2_dev);
err_clk:
for (i = gsc->num_clocks - 1; i >= 0; i--)
clk_disable_unprepare(gsc->clock[i]);
return ret;
}
static int gsc_remove(struct platform_device *pdev)
{
struct gsc_dev *gsc = platform_get_drvdata(pdev);
int i;
pm_runtime_get_sync(&pdev->dev);
gsc_unregister_m2m_device(gsc);
v4l2_device_unregister(&gsc->v4l2_dev);
vb2_dma_contig_clear_max_seg_size(&pdev->dev);
for (i = 0; i < gsc->num_clocks; i++)
clk_disable_unprepare(gsc->clock[i]);
pm_runtime_put_noidle(&pdev->dev);
pm_runtime_disable(&pdev->dev);
dev_dbg(&pdev->dev, "%s driver unloaded\n", pdev->name);
return 0;
}
#ifdef CONFIG_PM
static int gsc_m2m_suspend(struct gsc_dev *gsc)
{
unsigned long flags;
int timeout;
spin_lock_irqsave(&gsc->slock, flags);
if (!gsc_m2m_pending(gsc)) {
spin_unlock_irqrestore(&gsc->slock, flags);
return 0;
}
clear_bit(ST_M2M_SUSPENDED, &gsc->state);
set_bit(ST_M2M_SUSPENDING, &gsc->state);
spin_unlock_irqrestore(&gsc->slock, flags);
timeout = wait_event_timeout(gsc->irq_queue,
test_bit(ST_M2M_SUSPENDED, &gsc->state),
GSC_SHUTDOWN_TIMEOUT);
clear_bit(ST_M2M_SUSPENDING, &gsc->state);
return timeout == 0 ? -EAGAIN : 0;
}
static void gsc_m2m_resume(struct gsc_dev *gsc)
{
struct gsc_ctx *ctx;
unsigned long flags;
spin_lock_irqsave(&gsc->slock, flags);
/* Clear for full H/W setup in first run after resume */
ctx = gsc->m2m.ctx;
gsc->m2m.ctx = NULL;
spin_unlock_irqrestore(&gsc->slock, flags);
if (test_and_clear_bit(ST_M2M_SUSPENDED, &gsc->state))
gsc_m2m_job_finish(ctx, VB2_BUF_STATE_ERROR);
}
static int gsc_runtime_resume(struct device *dev)
{
struct gsc_dev *gsc = dev_get_drvdata(dev);
int ret = 0;
int i;
pr_debug("gsc%d: state: 0x%lx\n", gsc->id, gsc->state);
for (i = 0; i < gsc->num_clocks; i++) {
ret = clk_prepare_enable(gsc->clock[i]);
if (ret) {
while (--i >= 0)
clk_disable_unprepare(gsc->clock[i]);
return ret;
}
}
gsc_hw_set_sw_reset(gsc);
gsc_wait_reset(gsc);
gsc_m2m_resume(gsc);
return 0;
}
static int gsc_runtime_suspend(struct device *dev)
{
struct gsc_dev *gsc = dev_get_drvdata(dev);
int ret = 0;
int i;
ret = gsc_m2m_suspend(gsc);
if (ret)
return ret;
for (i = gsc->num_clocks - 1; i >= 0; i--)
clk_disable_unprepare(gsc->clock[i]);
pr_debug("gsc%d: state: 0x%lx\n", gsc->id, gsc->state);
return ret;
}
#endif
static const struct dev_pm_ops gsc_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
pm_runtime_force_resume)
SET_RUNTIME_PM_OPS(gsc_runtime_suspend, gsc_runtime_resume, NULL)
};
static struct platform_driver gsc_driver = {
.probe = gsc_probe,
.remove = gsc_remove,
.driver = {
.name = GSC_MODULE_NAME,
.pm = &gsc_pm_ops,
.of_match_table = exynos_gsc_match,
}
};
module_platform_driver(gsc_driver);
MODULE_AUTHOR("Hyunwong Kim <[email protected]>");
MODULE_DESCRIPTION("Samsung EXYNOS5 Soc series G-Scaler driver");
MODULE_LICENSE("GPL");
| {
"pile_set_name": "Github"
} |
(***********************************************************************)
(* *)
(* OCaml *)
(* *)
(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
(* *)
(* Copyright 1996 Institut National de Recherche en Informatique et *)
(* en Automatique. All rights reserved. This file is distributed *)
(* under the terms of the GNU Library General Public License, with *)
(* the special exception on linking described in file ../LICENSE. *)
(* *)
(***********************************************************************)
[@@@warnerror "+55"]
(** balanced tree based on stdlib distribution *)
type 'a t0 =
| Empty
| Leaf of 'a
| Node of { l : 'a t0 ; v : 'a ; r : 'a t0 ; h : int }
let empty = Empty
let [@inline] height = function
| Empty -> 0
| Leaf _ -> 1
| Node {h} -> h
let [@inline] calc_height a b =
(if a >= b then a else b) + 1
(*
Invariants:
1. {[ l < v < r]}
2. l and r balanced
3. [height l] - [height r] <= 2
*)
let [@inline] unsafe_node v l r h =
Node{l;v;r; h }
let [@inline] unsafe_node_maybe_leaf v l r h =
if h = 1 then Leaf v
else Node{l;v;r; h }
let [@inline] singleton x = Leaf x
let [@inline] unsafe_two_elements x v =
unsafe_node v (singleton x) empty 2
type 'a t = 'a t0 = private
| Empty
| Leaf of 'a
| Node of { l : 'a t0 ; v : 'a ; r : 'a t0 ; h : int }
(* Smallest and greatest element of a set *)
let rec min_exn = function
| Empty -> raise Not_found
| Leaf v -> v
| Node{l; v} ->
match l with
| Empty -> v
| Leaf _
| Node _ -> min_exn l
let [@inline] is_empty = function Empty -> true | _ -> false
let rec cardinal_aux acc = function
| Empty -> acc
| Leaf _ -> acc + 1
| Node {l;r} ->
cardinal_aux (cardinal_aux (acc + 1) r ) l
let cardinal s = cardinal_aux 0 s
let rec elements_aux accu = function
| Empty -> accu
| Leaf v -> v :: accu
| Node{l; v; r} -> elements_aux (v :: elements_aux accu r) l
let elements s =
elements_aux [] s
let choose = min_exn
let rec iter x f = match x with
| Empty -> ()
| Leaf v -> f v
| Node {l; v; r} -> iter l f ; f v; iter r f
let rec fold s accu f =
match s with
| Empty -> accu
| Leaf v -> f v accu
| Node{l; v; r} -> fold r (f v (fold l accu f)) f
let rec for_all x p = match x with
| Empty -> true
| Leaf v -> p v
| Node{l; v; r} -> p v && for_all l p && for_all r p
let rec exists x p = match x with
| Empty -> false
| Leaf v -> p v
| Node {l; v; r} -> p v || exists l p || exists r p
exception Height_invariant_broken
exception Height_diff_borken
let rec check_height_and_diff =
function
| Empty -> 0
| Leaf _ -> 1
| Node{l;r;h} ->
let hl = check_height_and_diff l in
let hr = check_height_and_diff r in
if h <> calc_height hl hr then raise Height_invariant_broken
else
let diff = (abs (hl - hr)) in
if diff > 2 then raise Height_diff_borken
else h
let check tree =
ignore (check_height_and_diff tree)
(* Same as create, but performs one step of rebalancing if necessary.
Invariants:
1. {[ l < v < r ]}
2. l and r balanced
3. | height l - height r | <= 3.
Proof by indunction
Lemma: the height of [bal l v r] will bounded by [max l r] + 1
*)
let bal l v r : _ t =
let hl = height l in
let hr = height r in
if hl > hr + 2 then
let [@warning "-8"] Node ({l=ll;r= lr} as l) = l in
let hll = height ll in
let hlr = height lr in
if hll >= hlr then
let hnode = calc_height hlr hr in
unsafe_node l.v
ll
(unsafe_node_maybe_leaf v lr r hnode )
(calc_height hll hnode)
else
let [@warning "-8"] Node ({l = lrl; r = lrr } as lr) = lr in
let hlrl = height lrl in
let hlrr = height lrr in
let hlnode = calc_height hll hlrl in
let hrnode = calc_height hlrr hr in
unsafe_node lr.v
(unsafe_node_maybe_leaf l.v ll lrl hlnode)
(unsafe_node_maybe_leaf v lrr r hrnode)
(calc_height hlnode hrnode)
else if hr > hl + 2 then begin
let [@warning "-8"] Node ({l=rl; r=rr} as r) = r in
let hrr = height rr in
let hrl = height rl in
if hrr >= hrl then
let hnode = calc_height hl hrl in
unsafe_node r.v
(unsafe_node_maybe_leaf v l rl hnode)
rr
(calc_height hnode hrr )
else begin
let [@warning "-8"] Node ({l = rll ; r = rlr } as rl) = rl in
let hrll = height rll in
let hrlr = height rlr in
let hlnode = (calc_height hl hrll) in
let hrnode = (calc_height hrlr hrr) in
unsafe_node rl.v
(unsafe_node_maybe_leaf v l rll hlnode)
(unsafe_node_maybe_leaf r.v rlr rr hrnode)
(calc_height hlnode hrnode)
end
end else
unsafe_node_maybe_leaf v l r (calc_height hl hr)
let rec remove_min_elt = function
Empty -> invalid_arg "Set.remove_min_elt"
| Leaf _ -> empty
| Node{l=Empty; r} -> r
| Node{l; v; r} -> bal (remove_min_elt l) v r
(*
All elements of l must precede the elements of r.
Assume | height l - height r | <= 2.
weak form of [concat]
*)
let internal_merge l r =
match (l, r) with
| (Empty, t) -> t
| (t, Empty) -> t
| (_, _) -> bal l (min_exn r) (remove_min_elt r)
(* Beware: those two functions assume that the added v is *strictly*
smaller (or bigger) than all the present elements in the tree; it
does not test for equality with the current min (or max) element.
Indeed, they are only used during the "join" operation which
respects this precondition.
*)
let rec add_min v = function
| Empty -> singleton v
| Leaf x -> unsafe_two_elements v x
| Node n ->
bal (add_min v n.l) n.v n.r
let rec add_max v = function
| Empty -> singleton v
| Leaf x -> unsafe_two_elements x v
| Node n ->
bal n.l n.v (add_max v n.r)
(**
Invariants:
1. l < v < r
2. l and r are balanced
Proof by induction
The height of output will be ~~ (max (height l) (height r) + 2)
Also use the lemma from [bal]
*)
let rec internal_join l v r =
match (l, r) with
(Empty, _) -> add_min v r
| (_, Empty) -> add_max v l
| Leaf lv, Node {h = rh} ->
if rh > 3 then
add_min lv (add_min v r ) (* FIXME: could inlined *)
else unsafe_node v l r (rh + 1)
| Leaf _, Leaf _ ->
unsafe_node v l r 2
| Node {h = lh}, Leaf rv ->
if lh > 3 then
add_max rv (add_max v l)
else unsafe_node v l r (lh + 1)
| (Node{l=ll;v= lv;r= lr;h= lh}, Node {l=rl; v=rv; r=rr; h=rh}) ->
if lh > rh + 2 then
(* proof by induction:
now [height of ll] is [lh - 1]
*)
bal ll lv (internal_join lr v r)
else
if rh > lh + 2 then bal (internal_join l v rl) rv rr
else unsafe_node v l r (calc_height lh rh)
(*
Required Invariants:
[t1] < [t2]
*)
let internal_concat t1 t2 =
match (t1, t2) with
| (Empty, t) -> t
| (t, Empty) -> t
| (_, _) -> internal_join t1 (min_exn t2) (remove_min_elt t2)
let rec partition x p = match x with
| Empty -> (empty, empty)
| Leaf v -> let pv = p v in if pv then x, empty else empty, x
| Node{l; v; r} ->
(* call [p] in the expected left-to-right order *)
let (lt, lf) = partition l p in
let pv = p v in
let (rt, rf) = partition r p in
if pv
then (internal_join lt v rt, internal_concat lf rf)
else (internal_concat lt rt, internal_join lf v rf)
let of_sorted_array l =
let rec sub start n l =
if n = 0 then empty else
if n = 1 then
let x0 = Array.unsafe_get l start in
singleton x0
else if n = 2 then
let x0 = Array.unsafe_get l start in
let x1 = Array.unsafe_get l (start + 1) in
unsafe_node x1 (singleton x0) empty 2 else
if n = 3 then
let x0 = Array.unsafe_get l start in
let x1 = Array.unsafe_get l (start + 1) in
let x2 = Array.unsafe_get l (start + 2) in
unsafe_node x1 (singleton x0) (singleton x2) 2
else
let nl = n / 2 in
let left = sub start nl l in
let mid = start + nl in
let v = Array.unsafe_get l mid in
let right = sub (mid + 1) (n - nl - 1) l in
unsafe_node v left right (calc_height (height left) (height right))
in
sub 0 (Array.length l) l
let is_ordered ~cmp tree =
let rec is_ordered_min_max tree =
match tree with
| Empty -> `Empty
| Leaf v -> `V (v,v)
| Node {l;v;r} ->
begin match is_ordered_min_max l with
| `No -> `No
| `Empty ->
begin match is_ordered_min_max r with
| `No -> `No
| `Empty -> `V (v,v)
| `V(l,r) ->
if cmp v l < 0 then
`V(v,r)
else
`No
end
| `V(min_v,max_v)->
begin match is_ordered_min_max r with
| `No -> `No
| `Empty ->
if cmp max_v v < 0 then
`V(min_v,v)
else
`No
| `V(min_v_r, max_v_r) ->
if cmp max_v min_v_r < 0 then
`V(min_v,max_v_r)
else `No
end
end in
is_ordered_min_max tree <> `No
let invariant ~cmp t =
check t ;
is_ordered ~cmp t
module type S = sig
type elt
type t
val empty: t
val is_empty: t -> bool
val iter: t -> (elt -> unit) -> unit
val fold: t -> 'a -> (elt -> 'a -> 'a) -> 'a
val for_all: t -> (elt -> bool) -> bool
val exists: t -> (elt -> bool) -> bool
val singleton: elt -> t
val cardinal: t -> int
val elements: t -> elt list
val choose: t -> elt
val mem: t -> elt -> bool
val add: t -> elt -> t
val remove: t -> elt -> t
val union: t -> t -> t
val inter: t -> t -> t
val diff: t -> t -> t
val of_list: elt list -> t
val of_sorted_array : elt array -> t
val invariant : t -> bool
val print : Format.formatter -> t -> unit
end
| {
"pile_set_name": "Github"
} |
# HAR Schema [![version][npm-version]][npm-url] [![License][npm-license]][license-url]
> JSON Schema for HTTP Archive ([HAR][spec]).
[![Build Status][travis-image]][travis-url]
[![Downloads][npm-downloads]][npm-url]
[![Code Climate][codeclimate-quality]][codeclimate-url]
[![Coverage Status][codeclimate-coverage]][codeclimate-url]
[![Dependency Status][dependencyci-image]][dependencyci-url]
[![Dependencies][david-image]][david-url]
## Install
```bash
npm install --only=production --save har-schema
```
## Usage
Compatible with any [JSON Schema validation tool][validator].
----
> :copyright: [ahmadnassri.com](https://www.ahmadnassri.com/) ·
> License: [ISC][license-url] ·
> Github: [@ahmadnassri](https://github.com/ahmadnassri) ·
> Twitter: [@ahmadnassri](https://twitter.com/ahmadnassri)
[license-url]: http://choosealicense.com/licenses/isc/
[travis-url]: https://travis-ci.org/ahmadnassri/har-schema
[travis-image]: https://img.shields.io/travis/ahmadnassri/har-schema.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/har-schema
[npm-license]: https://img.shields.io/npm/l/har-schema.svg?style=flat-square
[npm-version]: https://img.shields.io/npm/v/har-schema.svg?style=flat-square
[npm-downloads]: https://img.shields.io/npm/dm/har-schema.svg?style=flat-square
[codeclimate-url]: https://codeclimate.com/github/ahmadnassri/har-schema
[codeclimate-quality]: https://img.shields.io/codeclimate/github/ahmadnassri/har-schema.svg?style=flat-square
[codeclimate-coverage]: https://img.shields.io/codeclimate/coverage/github/ahmadnassri/har-schema.svg?style=flat-square
[david-url]: https://david-dm.org/ahmadnassri/har-schema
[david-image]: https://img.shields.io/david/ahmadnassri/har-schema.svg?style=flat-square
[dependencyci-url]: https://dependencyci.com/github/ahmadnassri/har-schema
[dependencyci-image]: https://dependencyci.com/github/ahmadnassri/har-schema/badge?style=flat-square
[spec]: https://github.com/ahmadnassri/har-spec/blob/master/versions/1.2.md
[validator]: https://github.com/ahmadnassri/har-validator
| {
"pile_set_name": "Github"
} |
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
namespace Pulumi.Aws.WafV2.Outputs
{
[OutputType]
public sealed class RuleGroupRuleStatementNotStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchAllQueryArguments
{
[OutputConstructor]
private RuleGroupRuleStatementNotStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchAllQueryArguments()
{
}
}
}
| {
"pile_set_name": "Github"
} |
# Microsoft-Windows-RemoteDesktopServices-SessionServices ETW events
## Description
This page contains the list of events for Microsoft-Windows-RemoteDesktopServices-SessionServices, as collected by the Event Tracing for Windows.
## Sub Data Sets
|events|Version|Description|Tags|
|---|---|---|---|
|[1](events/event-1.md)|0|None|etw_level_Informational, etw_opcode_Changesessionresolution, etw_task_Displaycontrol|
|[2](events/event-2.md)|0|None|etw_level_Error, etw_opcode_Changesessionresolution, etw_task_Displaycontrol|
| {
"pile_set_name": "Github"
} |
/* -*- coding: utf-8 -*-
* ----------------------------------------------------------------------
* Copyright © 2013, RedJack, LLC.
* All rights reserved.
*
* Please see the COPYING file in this distribution for license details.
* ----------------------------------------------------------------------
*/
#include <string.h>
#include <stdio.h>
#include "libcork/core/types.h"
#include "libcork/core/u128.h"
/* From http://stackoverflow.com/questions/8023414/how-to-convert-a-128-bit-integer-to-a-decimal-ascii-string-in-c */
const char *
cork_u128_to_decimal(char *dest, cork_u128 val)
{
uint32_t n[4];
char *s = dest;
char *p = dest;
unsigned int i;
/* This algorithm assumes that n[3] is the MSW. */
n[3] = cork_u128_be32(val, 0);
n[2] = cork_u128_be32(val, 1);
n[1] = cork_u128_be32(val, 2);
n[0] = cork_u128_be32(val, 3);
memset(s, '0', CORK_U128_DECIMAL_LENGTH - 1);
s[CORK_U128_DECIMAL_LENGTH - 1] = '\0';
for (i = 0; i < 128; i++) {
unsigned int j;
unsigned int carry;
carry = (n[3] >= 0x80000000);
/* Shift n[] left, doubling it */
n[3] = ((n[3] << 1) & 0xFFFFFFFF) + (n[2] >= 0x80000000);
n[2] = ((n[2] << 1) & 0xFFFFFFFF) + (n[1] >= 0x80000000);
n[1] = ((n[1] << 1) & 0xFFFFFFFF) + (n[0] >= 0x80000000);
n[0] = ((n[0] << 1) & 0xFFFFFFFF);
/* Add s[] to itself in decimal, doubling it */
for (j = CORK_U128_DECIMAL_LENGTH - 1; j-- > 0; ) {
s[j] += s[j] - '0' + carry;
carry = (s[j] > '9');
if (carry) {
s[j] -= 10;
}
}
}
while ((p[0] == '0') && (p < &s[CORK_U128_DECIMAL_LENGTH - 2])) {
p++;
}
return p;
}
const char *
cork_u128_to_hex(char *buf, cork_u128 val)
{
uint64_t hi = val._.be64.hi;
uint64_t lo = val._.be64.lo;
if (hi == 0) {
snprintf(buf, CORK_U128_HEX_LENGTH, "%" PRIx64, lo);
} else {
snprintf(buf, CORK_U128_HEX_LENGTH, "%" PRIx64 "%016" PRIx64, hi, lo);
}
return buf;
}
const char *
cork_u128_to_padded_hex(char *buf, cork_u128 val)
{
uint64_t hi = val._.be64.hi;
uint64_t lo = val._.be64.lo;
snprintf(buf, CORK_U128_HEX_LENGTH, "%016" PRIx64 "%016" PRIx64, hi, lo);
return buf;
}
| {
"pile_set_name": "Github"
} |
/*
* /MathJax/jax/input/AsciiMath/config.js
*
* Copyright (c) 2012 Design Science, Inc.
*
* Part of the MathJax library.
* See http://www.mathjax.org for details.
*
* Licensed under the Apache License, Version 2.0;
* you may not use this file except in compliance with the License.
*
* http://www.apache.org/licenses/LICENSE-2.0
*/
MathJax.InputJax.AsciiMath=MathJax.InputJax({id:"AsciiMath",version:"2.1",directory:MathJax.InputJax.directory+"/AsciiMath",extensionDir:MathJax.InputJax.extensionDir+"/AsciiMath",config:{displaystyle:true,decimal:"."}});MathJax.InputJax.AsciiMath.Register("math/asciimath");MathJax.InputJax.AsciiMath.loadComplete("config.js");
| {
"pile_set_name": "Github"
} |
// Copyright 2015 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included..
#pragma once
#include "core/hle/service/cam/cam.h"
namespace Service::CAM {
class CAM_U final : public Module::Interface {
public:
explicit CAM_U(std::shared_ptr<Module> cam);
private:
SERVICE_SERIALIZATION(CAM_U, cam, Module)
};
} // namespace Service::CAM
BOOST_CLASS_EXPORT_KEY(Service::CAM::CAM_U)
BOOST_SERIALIZATION_CONSTRUCT(Service::CAM::CAM_U)
| {
"pile_set_name": "Github"
} |
//#include "stddef.h"
#include <sys/types.h>
typedef __darwin_ptrdiff_t ptrdiff_t;
typedef __darwin_wint_t wint_t;
| {
"pile_set_name": "Github"
} |
---
letter: n
---
{% include letter.html %}
| {
"pile_set_name": "Github"
} |
/* tslint:disable */
/**
* This is an autogenerated file created by the Stencil compiler.
* It contains typing information for all components that exist in this project.
*/
import './stencil.core';
export namespace Components {
interface SvgLoader {
'color': string;
'url': string;
'width': string;
}
interface SvgLoaderAttributes extends StencilHTMLAttributes {
'color'?: string;
'url'?: string;
'width'?: string;
}
}
declare global {
interface StencilElementInterfaces {
'SvgLoader': Components.SvgLoader;
}
interface StencilIntrinsicElements {
'svg-loader': Components.SvgLoaderAttributes;
}
interface HTMLSvgLoaderElement extends Components.SvgLoader, HTMLStencilElement {}
var HTMLSvgLoaderElement: {
prototype: HTMLSvgLoaderElement;
new (): HTMLSvgLoaderElement;
};
interface HTMLElementTagNameMap {
'svg-loader': HTMLSvgLoaderElement
}
interface ElementTagNameMap {
'svg-loader': HTMLSvgLoaderElement;
}
}
| {
"pile_set_name": "Github"
} |
{$M 6400000}
program ural1099_5_5;
const maxn=300;
randtime=5;
tttime=5;
var n,ans:longint;
p,q,my,ansy:array[1..maxn]of longint;
map:array[1..maxn,1..maxn]of boolean;
u:array[1..maxn]of boolean;
procedure swap(var x,y:longint);
var t:longint;
begin
t:=x;x:=y;y:=t;
end;
procedure inputint;
var a,b:longint;
begin
readln(n);
while not(eof) do
begin
readln(a,b);
map[a,b]:=true;
map[b,a]:=true;
end;
end;
function aug(x:longint):boolean;
var i:longint;
begin
u[x]:=true;
for i:=1 to n do
if not(u[q[i]]) then
if map[x,q[i]] then
begin
u[q[i]]:=true;
if (my[q[i]]=0)or(aug(my[q[i]])) then
begin
my[q[i]]:=x;
my[x]:=q[i];
aug:=true;
exit;
end;
end;
aug:=false;
end;
procedure updata(tmp:longint);
var i:longint;
begin
ans:=tmp;
for i:=1 to n do ansy[i]:=my[i];
end;
procedure workans;
var i,tmp,j,k,ttt:longint;
begin
fillchar(my,sizeof(my),0);
tmp:=0;
for i:=1 to n do
if my[p[i]]=0 then
for ttt:=1 to tttime do
begin
fillchar(u,sizeof(u),0);
if aug(p[i]) then begin inc(tmp);break end
else
for j:=1 to n do
begin
k:=j+random(n-j+1);
swap(q[j],q[k]);
end;
end;
if tmp>ans then updata(tmp);
end;
procedure work;
var i,j,time:longint;
begin
for i:=1 to n do
begin
p[i]:=i;
q[i]:=i;
end;
for time:=1 to randtime do
begin
for i:=1 to n do
begin
j:=i+random(n-i+1);
swap(q[i],q[j]);
j:=i+random(n-i+1);
swap(p[i],p[j]);
end;
workans;
end;
end;
procedure outputint;
var i:longint;
begin
writeln(ans*2);
for i:=1 to n do
if ansy[i]>i then writeln(i,' ',ansy[i]);
end;
begin
randomize;
inputint;
work;
outputint;
end.
| {
"pile_set_name": "Github"
} |
# PLPlayerKit 1.2.6 to 1.2.7 API Differences
## General Headers
```
PLPlayerTypeDefines.h
```
- *Add* type `PLVideoPlayerState`
- *Add* const `extern NSString * const PLMovidParameterAutoPlayEnable;`
```
PLVideoPlayerController.h
```
- *Modified* protocol ```PLVideoPlayerControllerDelegate```
- *Add* method ```- (void)videoPlayerController:(PLVideoPlayerController *)controller playerStateDidChange:(PLVideoPlayerState)state;```
- *Add* method ```- (void)videoPlayerControllerDecoderHasBeenReady:(PLVideoPlayerController *)controller;```
- *Add* property ```@property (nonatomic, assign, readonly) PLVideoPlayerState playerState;```
| {
"pile_set_name": "Github"
} |
package raft
// LogType describes various types of log entries.
type LogType uint8
const (
// LogCommand is applied to a user FSM.
LogCommand LogType = iota
// LogNoop is used to assert leadership.
LogNoop
// LogAddPeer is used to add a new peer.
LogAddPeer
// LogRemovePeer is used to remove an existing peer.
LogRemovePeer
// LogBarrier is used to ensure all preceding operations have been
// applied to the FSM. It is similar to LogNoop, but instead of returning
// once committed, it only returns once the FSM manager acks it. Otherwise
// it is possible there are operations committed but not yet applied to
// the FSM.
LogBarrier
)
// Log entries are replicated to all members of the Raft cluster
// and form the heart of the replicated state machine.
type Log struct {
Index uint64
Term uint64
Type LogType
Data []byte
// peer is not exported since it is not transmitted, only used
// internally to construct the Data field.
peer string
}
// LogStore is used to provide an interface for storing
// and retrieving logs in a durable fashion.
type LogStore interface {
// Returns the first index written. 0 for no entries.
FirstIndex() (uint64, error)
// Returns the last index written. 0 for no entries.
LastIndex() (uint64, error)
// Gets a log entry at a given index.
GetLog(index uint64, log *Log) error
// Stores a log entry.
StoreLog(log *Log) error
// Stores multiple log entries.
StoreLogs(logs []*Log) error
// Deletes a range of log entries. The range is inclusive.
DeleteRange(min, max uint64) error
}
| {
"pile_set_name": "Github"
} |
// Code generated by pigeon; DO NOT EDIT.
package errorpos
import (
"bytes"
"errors"
"fmt"
"io"
"io/ioutil"
"math"
"os"
"sort"
"strconv"
"strings"
"sync"
"unicode"
"unicode/utf8"
)
var g = &grammar{
rules: []*rule{
{
name: "Input",
pos: position{line: 5, col: 1, offset: 22},
expr: &seqExpr{
pos: position{line: 5, col: 9, offset: 32},
exprs: []interface{}{
&ruleRefExpr{
pos: position{line: 5, col: 9, offset: 32},
name: "_",
},
&choiceExpr{
pos: position{line: 5, col: 12, offset: 35},
alternatives: []interface{}{
&ruleRefExpr{
pos: position{line: 5, col: 12, offset: 35},
name: "case01",
},
&ruleRefExpr{
pos: position{line: 5, col: 21, offset: 44},
name: "case02",
},
&ruleRefExpr{
pos: position{line: 5, col: 30, offset: 53},
name: "case03",
},
&ruleRefExpr{
pos: position{line: 5, col: 39, offset: 62},
name: "case04",
},
&ruleRefExpr{
pos: position{line: 5, col: 48, offset: 71},
name: "case05",
},
&ruleRefExpr{
pos: position{line: 5, col: 57, offset: 80},
name: "case06",
},
&ruleRefExpr{
pos: position{line: 5, col: 66, offset: 89},
name: "case07",
},
&ruleRefExpr{
pos: position{line: 5, col: 75, offset: 98},
name: "case08",
},
&ruleRefExpr{
pos: position{line: 5, col: 84, offset: 107},
name: "case09",
},
&ruleRefExpr{
pos: position{line: 5, col: 93, offset: 116},
name: "case10",
},
&ruleRefExpr{
pos: position{line: 5, col: 102, offset: 125},
name: "case11",
},
},
},
&ruleRefExpr{
pos: position{line: 5, col: 110, offset: 133},
name: "EOF",
},
},
},
},
{
name: "case01",
pos: position{line: 7, col: 1, offset: 138},
expr: &seqExpr{
pos: position{line: 7, col: 10, offset: 149},
exprs: []interface{}{
&litMatcher{
pos: position{line: 7, col: 10, offset: 149},
val: "case01",
ignoreCase: false,
want: "\"case01\"",
},
&ruleRefExpr{
pos: position{line: 7, col: 19, offset: 158},
name: "_",
},
&oneOrMoreExpr{
pos: position{line: 7, col: 21, offset: 160},
expr: &seqExpr{
pos: position{line: 7, col: 22, offset: 161},
exprs: []interface{}{
&choiceExpr{
pos: position{line: 7, col: 23, offset: 162},
alternatives: []interface{}{
&ruleRefExpr{
pos: position{line: 7, col: 23, offset: 162},
name: "increment",
},
&ruleRefExpr{
pos: position{line: 7, col: 35, offset: 174},
name: "decrement",
},
&ruleRefExpr{
pos: position{line: 7, col: 47, offset: 186},
name: "zero",
},
},
},
&ruleRefExpr{
pos: position{line: 7, col: 53, offset: 192},
name: "_",
},
},
},
},
},
},
},
{
name: "case02",
pos: position{line: 8, col: 1, offset: 197},
expr: &seqExpr{
pos: position{line: 8, col: 10, offset: 208},
exprs: []interface{}{
&litMatcher{
pos: position{line: 8, col: 10, offset: 208},
val: "case02",
ignoreCase: false,
want: "\"case02\"",
},
&ruleRefExpr{
pos: position{line: 8, col: 19, offset: 217},
name: "__",
},
&oneOrMoreExpr{
pos: position{line: 8, col: 22, offset: 220},
expr: &charClassMatcher{
pos: position{line: 8, col: 22, offset: 220},
val: "[^abc]",
chars: []rune{'a', 'b', 'c'},
ignoreCase: false,
inverted: true,
},
},
},
},
},
{
name: "case03",
pos: position{line: 9, col: 1, offset: 228},
expr: &seqExpr{
pos: position{line: 9, col: 10, offset: 239},
exprs: []interface{}{
&litMatcher{
pos: position{line: 9, col: 10, offset: 239},
val: "case03",
ignoreCase: false,
want: "\"case03\"",
},
&ruleRefExpr{
pos: position{line: 9, col: 19, offset: 248},
name: "__",
},
&zeroOrOneExpr{
pos: position{line: 9, col: 22, offset: 251},
expr: &litMatcher{
pos: position{line: 9, col: 22, offset: 251},
val: "x",
ignoreCase: false,
want: "\"x\"",
},
},
&charClassMatcher{
pos: position{line: 9, col: 27, offset: 256},
val: "[0-9]",
ranges: []rune{'0', '9'},
ignoreCase: false,
inverted: false,
},
},
},
},
{
name: "case04",
pos: position{line: 10, col: 1, offset: 262},
expr: &seqExpr{
pos: position{line: 10, col: 10, offset: 273},
exprs: []interface{}{
&litMatcher{
pos: position{line: 10, col: 10, offset: 273},
val: "case04",
ignoreCase: false,
want: "\"case04\"",
},
&ruleRefExpr{
pos: position{line: 10, col: 19, offset: 282},
name: "__",
},
&charClassMatcher{
pos: position{line: 10, col: 22, offset: 285},
val: "[\\x30-\\x39]",
ranges: []rune{'0', '9'},
ignoreCase: false,
inverted: false,
},
&charClassMatcher{
pos: position{line: 10, col: 34, offset: 297},
val: "[^\\x30-\\x39]",
ranges: []rune{'0', '9'},
ignoreCase: false,
inverted: true,
},
&charClassMatcher{
pos: position{line: 10, col: 47, offset: 310},
val: "[\\pN]",
classes: []*unicode.RangeTable{rangeTable("N")},
ignoreCase: false,
inverted: false,
},
&charClassMatcher{
pos: position{line: 10, col: 53, offset: 316},
val: "[^\\pN]",
classes: []*unicode.RangeTable{rangeTable("N")},
ignoreCase: false,
inverted: true,
},
},
},
},
{
name: "case05",
pos: position{line: 11, col: 1, offset: 323},
expr: &seqExpr{
pos: position{line: 11, col: 10, offset: 334},
exprs: []interface{}{
&litMatcher{
pos: position{line: 11, col: 10, offset: 334},
val: "case05",
ignoreCase: false,
want: "\"case05\"",
},
&ruleRefExpr{
pos: position{line: 11, col: 19, offset: 343},
name: "__",
},
¬Expr{
pos: position{line: 11, col: 22, offset: 346},
expr: &litMatcher{
pos: position{line: 11, col: 23, offset: 347},
val: "not",
ignoreCase: false,
want: "\"not\"",
},
},
&litMatcher{
pos: position{line: 11, col: 29, offset: 353},
val: "yes",
ignoreCase: false,
want: "\"yes\"",
},
},
},
},
{
name: "case06",
pos: position{line: 12, col: 1, offset: 359},
expr: &seqExpr{
pos: position{line: 12, col: 10, offset: 370},
exprs: []interface{}{
&litMatcher{
pos: position{line: 12, col: 10, offset: 370},
val: "case06",
ignoreCase: false,
want: "\"case06\"",
},
&ruleRefExpr{
pos: position{line: 12, col: 19, offset: 379},
name: "__",
},
¬Expr{
pos: position{line: 12, col: 22, offset: 382},
expr: &charClassMatcher{
pos: position{line: 12, col: 23, offset: 383},
val: "[0-9]",
ranges: []rune{'0', '9'},
ignoreCase: false,
inverted: false,
},
},
&litMatcher{
pos: position{line: 12, col: 29, offset: 389},
val: "x",
ignoreCase: false,
want: "\"x\"",
},
},
},
},
{
name: "case07",
pos: position{line: 13, col: 1, offset: 393},
expr: &seqExpr{
pos: position{line: 13, col: 10, offset: 404},
exprs: []interface{}{
&litMatcher{
pos: position{line: 13, col: 10, offset: 404},
val: "case07",
ignoreCase: false,
want: "\"case07\"",
},
&ruleRefExpr{
pos: position{line: 13, col: 19, offset: 413},
name: "__",
},
¬Expr{
pos: position{line: 13, col: 22, offset: 416},
expr: &choiceExpr{
pos: position{line: 13, col: 24, offset: 418},
alternatives: []interface{}{
&litMatcher{
pos: position{line: 13, col: 24, offset: 418},
val: "abc",
ignoreCase: true,
want: "\"abc\"i",
},
&charClassMatcher{
pos: position{line: 13, col: 33, offset: 427},
val: "[a-c]i",
ranges: []rune{'a', 'c'},
ignoreCase: true,
inverted: false,
},
&charClassMatcher{
pos: position{line: 13, col: 42, offset: 436},
val: "[\\pL]",
classes: []*unicode.RangeTable{rangeTable("L")},
ignoreCase: false,
inverted: false,
},
},
},
},
&charClassMatcher{
pos: position{line: 13, col: 49, offset: 443},
val: "[0-9]",
ranges: []rune{'0', '9'},
ignoreCase: false,
inverted: false,
},
},
},
},
{
name: "case08",
pos: position{line: 14, col: 1, offset: 449},
expr: &seqExpr{
pos: position{line: 14, col: 10, offset: 460},
exprs: []interface{}{
&litMatcher{
pos: position{line: 14, col: 10, offset: 460},
val: "case08",
ignoreCase: false,
want: "\"case08\"",
},
&ruleRefExpr{
pos: position{line: 14, col: 19, offset: 469},
name: "__",
},
&andExpr{
pos: position{line: 14, col: 22, offset: 472},
expr: &litMatcher{
pos: position{line: 14, col: 23, offset: 473},
val: "a",
ignoreCase: true,
want: "\"a\"i",
},
},
&anyMatcher{
line: 14, col: 28, offset: 478,
},
},
},
},
{
name: "case09",
pos: position{line: 15, col: 1, offset: 480},
expr: &seqExpr{
pos: position{line: 15, col: 10, offset: 491},
exprs: []interface{}{
&litMatcher{
pos: position{line: 15, col: 10, offset: 491},
val: "case09",
ignoreCase: false,
want: "\"case09\"",
},
&ruleRefExpr{
pos: position{line: 15, col: 19, offset: 500},
name: "__",
},
&andExpr{
pos: position{line: 15, col: 22, offset: 503},
expr: &charClassMatcher{
pos: position{line: 15, col: 23, offset: 504},
val: "[0-9]",
ranges: []rune{'0', '9'},
ignoreCase: false,
inverted: false,
},
},
&anyMatcher{
line: 15, col: 29, offset: 510,
},
},
},
},
{
name: "case10",
pos: position{line: 16, col: 1, offset: 512},
expr: &seqExpr{
pos: position{line: 16, col: 10, offset: 523},
exprs: []interface{}{
&litMatcher{
pos: position{line: 16, col: 10, offset: 523},
val: "case10",
ignoreCase: false,
want: "\"case10\"",
},
&ruleRefExpr{
pos: position{line: 16, col: 19, offset: 532},
name: "__",
},
&andExpr{
pos: position{line: 16, col: 22, offset: 535},
expr: &choiceExpr{
pos: position{line: 16, col: 24, offset: 537},
alternatives: []interface{}{
&litMatcher{
pos: position{line: 16, col: 24, offset: 537},
val: "0",
ignoreCase: false,
want: "\"0\"",
},
&charClassMatcher{
pos: position{line: 16, col: 30, offset: 543},
val: "[012]",
chars: []rune{'0', '1', '2'},
ignoreCase: false,
inverted: false,
},
&charClassMatcher{
pos: position{line: 16, col: 38, offset: 551},
val: "[3-9]",
ranges: []rune{'3', '9'},
ignoreCase: false,
inverted: false,
},
&charClassMatcher{
pos: position{line: 16, col: 46, offset: 559},
val: "[\\pN]",
classes: []*unicode.RangeTable{rangeTable("N")},
ignoreCase: false,
inverted: false,
},
},
},
},
&anyMatcher{
line: 16, col: 53, offset: 566,
},
},
},
},
{
name: "case11",
pos: position{line: 17, col: 1, offset: 568},
expr: &seqExpr{
pos: position{line: 17, col: 10, offset: 579},
exprs: []interface{}{
&litMatcher{
pos: position{line: 17, col: 10, offset: 579},
val: "case11",
ignoreCase: false,
want: "\"case11\"",
},
&ruleRefExpr{
pos: position{line: 17, col: 19, offset: 588},
name: "__",
},
¬Expr{
pos: position{line: 17, col: 22, offset: 591},
expr: ¬Expr{
pos: position{line: 17, col: 24, offset: 593},
expr: &litMatcher{
pos: position{line: 17, col: 26, offset: 595},
val: "a",
ignoreCase: false,
want: "\"a\"",
},
},
},
&litMatcher{
pos: position{line: 17, col: 32, offset: 601},
val: "a",
ignoreCase: false,
want: "\"a\"",
},
},
},
},
{
name: "increment",
pos: position{line: 19, col: 1, offset: 606},
expr: &litMatcher{
pos: position{line: 19, col: 13, offset: 620},
val: "inc",
ignoreCase: false,
want: "\"inc\"",
},
},
{
name: "decrement",
pos: position{line: 20, col: 1, offset: 626},
expr: &litMatcher{
pos: position{line: 20, col: 13, offset: 640},
val: "dec",
ignoreCase: false,
want: "\"dec\"",
},
},
{
name: "zero",
pos: position{line: 21, col: 1, offset: 646},
expr: &litMatcher{
pos: position{line: 21, col: 8, offset: 655},
val: "zero",
ignoreCase: false,
want: "\"zero\"",
},
},
{
name: "oneOrMore",
pos: position{line: 22, col: 1, offset: 662},
expr: &litMatcher{
pos: position{line: 22, col: 13, offset: 676},
val: "oneOrMore",
ignoreCase: false,
want: "\"oneOrMore\"",
},
},
{
name: "_",
pos: position{line: 23, col: 1, offset: 688},
expr: &zeroOrMoreExpr{
pos: position{line: 23, col: 5, offset: 694},
expr: &charClassMatcher{
pos: position{line: 23, col: 5, offset: 694},
val: "[ \\t\\n\\r]",
chars: []rune{' ', '\t', '\n', '\r'},
ignoreCase: false,
inverted: false,
},
},
},
{
name: "__",
pos: position{line: 24, col: 1, offset: 705},
expr: &charClassMatcher{
pos: position{line: 24, col: 6, offset: 712},
val: "[ ]",
chars: []rune{' '},
ignoreCase: false,
inverted: false,
},
},
{
name: "EOF",
pos: position{line: 25, col: 1, offset: 716},
expr: ¬Expr{
pos: position{line: 25, col: 7, offset: 724},
expr: &anyMatcher{
line: 25, col: 8, offset: 725,
},
},
},
},
}
var (
// errNoRule is returned when the grammar to parse has no rule.
errNoRule = errors.New("grammar has no rule")
// errInvalidEntrypoint is returned when the specified entrypoint rule
// does not exit.
errInvalidEntrypoint = errors.New("invalid entrypoint")
// errInvalidEncoding is returned when the source is not properly
// utf8-encoded.
errInvalidEncoding = errors.New("invalid encoding")
// errMaxExprCnt is used to signal that the maximum number of
// expressions have been parsed.
errMaxExprCnt = errors.New("max number of expresssions parsed")
)
// Option is a function that can set an option on the parser. It returns
// the previous setting as an Option.
type Option func(*parser) Option
// MaxExpressions creates an Option to stop parsing after the provided
// number of expressions have been parsed, if the value is 0 then the parser will
// parse for as many steps as needed (possibly an infinite number).
//
// The default for maxExprCnt is 0.
func MaxExpressions(maxExprCnt uint64) Option {
return func(p *parser) Option {
oldMaxExprCnt := p.maxExprCnt
p.maxExprCnt = maxExprCnt
return MaxExpressions(oldMaxExprCnt)
}
}
// Entrypoint creates an Option to set the rule name to use as entrypoint.
// The rule name must have been specified in the -alternate-entrypoints
// if generating the parser with the -optimize-grammar flag, otherwise
// it may have been optimized out. Passing an empty string sets the
// entrypoint to the first rule in the grammar.
//
// The default is to start parsing at the first rule in the grammar.
func Entrypoint(ruleName string) Option {
return func(p *parser) Option {
oldEntrypoint := p.entrypoint
p.entrypoint = ruleName
if ruleName == "" {
p.entrypoint = g.rules[0].name
}
return Entrypoint(oldEntrypoint)
}
}
// Statistics adds a user provided Stats struct to the parser to allow
// the user to process the results after the parsing has finished.
// Also the key for the "no match" counter is set.
//
// Example usage:
//
// input := "input"
// stats := Stats{}
// _, err := Parse("input-file", []byte(input), Statistics(&stats, "no match"))
// if err != nil {
// log.Panicln(err)
// }
// b, err := json.MarshalIndent(stats.ChoiceAltCnt, "", " ")
// if err != nil {
// log.Panicln(err)
// }
// fmt.Println(string(b))
//
func Statistics(stats *Stats, choiceNoMatch string) Option {
return func(p *parser) Option {
oldStats := p.Stats
p.Stats = stats
oldChoiceNoMatch := p.choiceNoMatch
p.choiceNoMatch = choiceNoMatch
if p.Stats.ChoiceAltCnt == nil {
p.Stats.ChoiceAltCnt = make(map[string]map[string]int)
}
return Statistics(oldStats, oldChoiceNoMatch)
}
}
// Debug creates an Option to set the debug flag to b. When set to true,
// debugging information is printed to stdout while parsing.
//
// The default is false.
func Debug(b bool) Option {
return func(p *parser) Option {
old := p.debug
p.debug = b
return Debug(old)
}
}
// Memoize creates an Option to set the memoize flag to b. When set to true,
// the parser will cache all results so each expression is evaluated only
// once. This guarantees linear parsing time even for pathological cases,
// at the expense of more memory and slower times for typical cases.
//
// The default is false.
func Memoize(b bool) Option {
return func(p *parser) Option {
old := p.memoize
p.memoize = b
return Memoize(old)
}
}
// AllowInvalidUTF8 creates an Option to allow invalid UTF-8 bytes.
// Every invalid UTF-8 byte is treated as a utf8.RuneError (U+FFFD)
// by character class matchers and is matched by the any matcher.
// The returned matched value, c.text and c.offset are NOT affected.
//
// The default is false.
func AllowInvalidUTF8(b bool) Option {
return func(p *parser) Option {
old := p.allowInvalidUTF8
p.allowInvalidUTF8 = b
return AllowInvalidUTF8(old)
}
}
// Recover creates an Option to set the recover flag to b. When set to
// true, this causes the parser to recover from panics and convert it
// to an error. Setting it to false can be useful while debugging to
// access the full stack trace.
//
// The default is true.
func Recover(b bool) Option {
return func(p *parser) Option {
old := p.recover
p.recover = b
return Recover(old)
}
}
// GlobalStore creates an Option to set a key to a certain value in
// the globalStore.
func GlobalStore(key string, value interface{}) Option {
return func(p *parser) Option {
old := p.cur.globalStore[key]
p.cur.globalStore[key] = value
return GlobalStore(key, old)
}
}
// InitState creates an Option to set a key to a certain value in
// the global "state" store.
func InitState(key string, value interface{}) Option {
return func(p *parser) Option {
old := p.cur.state[key]
p.cur.state[key] = value
return InitState(key, old)
}
}
// ParseFile parses the file identified by filename.
func ParseFile(filename string, opts ...Option) (i interface{}, err error) { // nolint: deadcode
f, err := os.Open(filename)
if err != nil {
return nil, err
}
defer func() {
if closeErr := f.Close(); closeErr != nil {
err = closeErr
}
}()
return ParseReader(filename, f, opts...)
}
// ParseReader parses the data from r using filename as information in the
// error messages.
func ParseReader(filename string, r io.Reader, opts ...Option) (interface{}, error) { // nolint: deadcode
b, err := ioutil.ReadAll(r)
if err != nil {
return nil, err
}
return Parse(filename, b, opts...)
}
// Parse parses the data from b using filename as information in the
// error messages.
func Parse(filename string, b []byte, opts ...Option) (interface{}, error) {
return newParser(filename, b, opts...).parse(g)
}
// position records a position in the text.
type position struct {
line, col, offset int
}
func (p position) String() string {
return strconv.Itoa(p.line) + ":" + strconv.Itoa(p.col) + " [" + strconv.Itoa(p.offset) + "]"
}
// savepoint stores all state required to go back to this point in the
// parser.
type savepoint struct {
position
rn rune
w int
}
type current struct {
pos position // start position of the match
text []byte // raw text of the match
// state is a store for arbitrary key,value pairs that the user wants to be
// tied to the backtracking of the parser.
// This is always rolled back if a parsing rule fails.
state storeDict
// globalStore is a general store for the user to store arbitrary key-value
// pairs that they need to manage and that they do not want tied to the
// backtracking of the parser. This is only modified by the user and never
// rolled back by the parser. It is always up to the user to keep this in a
// consistent state.
globalStore storeDict
}
type storeDict map[string]interface{}
// the AST types...
// nolint: structcheck
type grammar struct {
pos position
rules []*rule
}
// nolint: structcheck
type rule struct {
pos position
name string
displayName string
expr interface{}
}
// nolint: structcheck
type choiceExpr struct {
pos position
alternatives []interface{}
}
// nolint: structcheck
type actionExpr struct {
pos position
expr interface{}
run func(*parser) (interface{}, error)
}
// nolint: structcheck
type recoveryExpr struct {
pos position
expr interface{}
recoverExpr interface{}
failureLabel []string
}
// nolint: structcheck
type seqExpr struct {
pos position
exprs []interface{}
}
// nolint: structcheck
type throwExpr struct {
pos position
label string
}
// nolint: structcheck
type labeledExpr struct {
pos position
label string
expr interface{}
}
// nolint: structcheck
type expr struct {
pos position
expr interface{}
}
type andExpr expr // nolint: structcheck
type notExpr expr // nolint: structcheck
type zeroOrOneExpr expr // nolint: structcheck
type zeroOrMoreExpr expr // nolint: structcheck
type oneOrMoreExpr expr // nolint: structcheck
// nolint: structcheck
type ruleRefExpr struct {
pos position
name string
}
// nolint: structcheck
type stateCodeExpr struct {
pos position
run func(*parser) error
}
// nolint: structcheck
type andCodeExpr struct {
pos position
run func(*parser) (bool, error)
}
// nolint: structcheck
type notCodeExpr struct {
pos position
run func(*parser) (bool, error)
}
// nolint: structcheck
type litMatcher struct {
pos position
val string
ignoreCase bool
want string
}
// nolint: structcheck
type charClassMatcher struct {
pos position
val string
basicLatinChars [128]bool
chars []rune
ranges []rune
classes []*unicode.RangeTable
ignoreCase bool
inverted bool
}
type anyMatcher position // nolint: structcheck
// errList cumulates the errors found by the parser.
type errList []error
func (e *errList) add(err error) {
*e = append(*e, err)
}
func (e errList) err() error {
if len(e) == 0 {
return nil
}
e.dedupe()
return e
}
func (e *errList) dedupe() {
var cleaned []error
set := make(map[string]bool)
for _, err := range *e {
if msg := err.Error(); !set[msg] {
set[msg] = true
cleaned = append(cleaned, err)
}
}
*e = cleaned
}
func (e errList) Error() string {
switch len(e) {
case 0:
return ""
case 1:
return e[0].Error()
default:
var buf bytes.Buffer
for i, err := range e {
if i > 0 {
buf.WriteRune('\n')
}
buf.WriteString(err.Error())
}
return buf.String()
}
}
// parserError wraps an error with a prefix indicating the rule in which
// the error occurred. The original error is stored in the Inner field.
type parserError struct {
Inner error
pos position
prefix string
expected []string
}
// Error returns the error message.
func (p *parserError) Error() string {
return p.prefix + ": " + p.Inner.Error()
}
// newParser creates a parser with the specified input source and options.
func newParser(filename string, b []byte, opts ...Option) *parser {
stats := Stats{
ChoiceAltCnt: make(map[string]map[string]int),
}
p := &parser{
filename: filename,
errs: new(errList),
data: b,
pt: savepoint{position: position{line: 1}},
recover: true,
cur: current{
state: make(storeDict),
globalStore: make(storeDict),
},
maxFailPos: position{col: 1, line: 1},
maxFailExpected: make([]string, 0, 20),
Stats: &stats,
// start rule is rule [0] unless an alternate entrypoint is specified
entrypoint: g.rules[0].name,
}
p.setOptions(opts)
if p.maxExprCnt == 0 {
p.maxExprCnt = math.MaxUint64
}
return p
}
// setOptions applies the options to the parser.
func (p *parser) setOptions(opts []Option) {
for _, opt := range opts {
opt(p)
}
}
// nolint: structcheck,deadcode
type resultTuple struct {
v interface{}
b bool
end savepoint
}
// nolint: varcheck
const choiceNoMatch = -1
// Stats stores some statistics, gathered during parsing
type Stats struct {
// ExprCnt counts the number of expressions processed during parsing
// This value is compared to the maximum number of expressions allowed
// (set by the MaxExpressions option).
ExprCnt uint64
// ChoiceAltCnt is used to count for each ordered choice expression,
// which alternative is used how may times.
// These numbers allow to optimize the order of the ordered choice expression
// to increase the performance of the parser
//
// The outer key of ChoiceAltCnt is composed of the name of the rule as well
// as the line and the column of the ordered choice.
// The inner key of ChoiceAltCnt is the number (one-based) of the matching alternative.
// For each alternative the number of matches are counted. If an ordered choice does not
// match, a special counter is incremented. The name of this counter is set with
// the parser option Statistics.
// For an alternative to be included in ChoiceAltCnt, it has to match at least once.
ChoiceAltCnt map[string]map[string]int
}
// nolint: structcheck,maligned
type parser struct {
filename string
pt savepoint
cur current
data []byte
errs *errList
depth int
recover bool
debug bool
memoize bool
// memoization table for the packrat algorithm:
// map[offset in source] map[expression or rule] {value, match}
memo map[int]map[interface{}]resultTuple
// rules table, maps the rule identifier to the rule node
rules map[string]*rule
// variables stack, map of label to value
vstack []map[string]interface{}
// rule stack, allows identification of the current rule in errors
rstack []*rule
// parse fail
maxFailPos position
maxFailExpected []string
maxFailInvertExpected bool
// max number of expressions to be parsed
maxExprCnt uint64
// entrypoint for the parser
entrypoint string
allowInvalidUTF8 bool
*Stats
choiceNoMatch string
// recovery expression stack, keeps track of the currently available recovery expression, these are traversed in reverse
recoveryStack []map[string]interface{}
}
// push a variable set on the vstack.
func (p *parser) pushV() {
if cap(p.vstack) == len(p.vstack) {
// create new empty slot in the stack
p.vstack = append(p.vstack, nil)
} else {
// slice to 1 more
p.vstack = p.vstack[:len(p.vstack)+1]
}
// get the last args set
m := p.vstack[len(p.vstack)-1]
if m != nil && len(m) == 0 {
// empty map, all good
return
}
m = make(map[string]interface{})
p.vstack[len(p.vstack)-1] = m
}
// pop a variable set from the vstack.
func (p *parser) popV() {
// if the map is not empty, clear it
m := p.vstack[len(p.vstack)-1]
if len(m) > 0 {
// GC that map
p.vstack[len(p.vstack)-1] = nil
}
p.vstack = p.vstack[:len(p.vstack)-1]
}
// push a recovery expression with its labels to the recoveryStack
func (p *parser) pushRecovery(labels []string, expr interface{}) {
if cap(p.recoveryStack) == len(p.recoveryStack) {
// create new empty slot in the stack
p.recoveryStack = append(p.recoveryStack, nil)
} else {
// slice to 1 more
p.recoveryStack = p.recoveryStack[:len(p.recoveryStack)+1]
}
m := make(map[string]interface{}, len(labels))
for _, fl := range labels {
m[fl] = expr
}
p.recoveryStack[len(p.recoveryStack)-1] = m
}
// pop a recovery expression from the recoveryStack
func (p *parser) popRecovery() {
// GC that map
p.recoveryStack[len(p.recoveryStack)-1] = nil
p.recoveryStack = p.recoveryStack[:len(p.recoveryStack)-1]
}
func (p *parser) print(prefix, s string) string {
if !p.debug {
return s
}
fmt.Printf("%s %d:%d:%d: %s [%#U]\n",
prefix, p.pt.line, p.pt.col, p.pt.offset, s, p.pt.rn)
return s
}
func (p *parser) in(s string) string {
p.depth++
return p.print(strings.Repeat(" ", p.depth)+">", s)
}
func (p *parser) out(s string) string {
p.depth--
return p.print(strings.Repeat(" ", p.depth)+"<", s)
}
func (p *parser) addErr(err error) {
p.addErrAt(err, p.pt.position, []string{})
}
func (p *parser) addErrAt(err error, pos position, expected []string) {
var buf bytes.Buffer
if p.filename != "" {
buf.WriteString(p.filename)
}
if buf.Len() > 0 {
buf.WriteString(":")
}
buf.WriteString(fmt.Sprintf("%d:%d (%d)", pos.line, pos.col, pos.offset))
if len(p.rstack) > 0 {
if buf.Len() > 0 {
buf.WriteString(": ")
}
rule := p.rstack[len(p.rstack)-1]
if rule.displayName != "" {
buf.WriteString("rule " + rule.displayName)
} else {
buf.WriteString("rule " + rule.name)
}
}
pe := &parserError{Inner: err, pos: pos, prefix: buf.String(), expected: expected}
p.errs.add(pe)
}
func (p *parser) failAt(fail bool, pos position, want string) {
// process fail if parsing fails and not inverted or parsing succeeds and invert is set
if fail == p.maxFailInvertExpected {
if pos.offset < p.maxFailPos.offset {
return
}
if pos.offset > p.maxFailPos.offset {
p.maxFailPos = pos
p.maxFailExpected = p.maxFailExpected[:0]
}
if p.maxFailInvertExpected {
want = "!" + want
}
p.maxFailExpected = append(p.maxFailExpected, want)
}
}
// read advances the parser to the next rune.
func (p *parser) read() {
p.pt.offset += p.pt.w
rn, n := utf8.DecodeRune(p.data[p.pt.offset:])
p.pt.rn = rn
p.pt.w = n
p.pt.col++
if rn == '\n' {
p.pt.line++
p.pt.col = 0
}
if rn == utf8.RuneError && n == 1 { // see utf8.DecodeRune
if !p.allowInvalidUTF8 {
p.addErr(errInvalidEncoding)
}
}
}
// restore parser position to the savepoint pt.
func (p *parser) restore(pt savepoint) {
if p.debug {
defer p.out(p.in("restore"))
}
if pt.offset == p.pt.offset {
return
}
p.pt = pt
}
// Cloner is implemented by any value that has a Clone method, which returns a
// copy of the value. This is mainly used for types which are not passed by
// value (e.g map, slice, chan) or structs that contain such types.
//
// This is used in conjunction with the global state feature to create proper
// copies of the state to allow the parser to properly restore the state in
// the case of backtracking.
type Cloner interface {
Clone() interface{}
}
var statePool = &sync.Pool{
New: func() interface{} { return make(storeDict) },
}
func (sd storeDict) Discard() {
for k := range sd {
delete(sd, k)
}
statePool.Put(sd)
}
// clone and return parser current state.
func (p *parser) cloneState() storeDict {
if p.debug {
defer p.out(p.in("cloneState"))
}
state := statePool.Get().(storeDict)
for k, v := range p.cur.state {
if c, ok := v.(Cloner); ok {
state[k] = c.Clone()
} else {
state[k] = v
}
}
return state
}
// restore parser current state to the state storeDict.
// every restoreState should applied only one time for every cloned state
func (p *parser) restoreState(state storeDict) {
if p.debug {
defer p.out(p.in("restoreState"))
}
p.cur.state.Discard()
p.cur.state = state
}
// get the slice of bytes from the savepoint start to the current position.
func (p *parser) sliceFrom(start savepoint) []byte {
return p.data[start.position.offset:p.pt.position.offset]
}
func (p *parser) getMemoized(node interface{}) (resultTuple, bool) {
if len(p.memo) == 0 {
return resultTuple{}, false
}
m := p.memo[p.pt.offset]
if len(m) == 0 {
return resultTuple{}, false
}
res, ok := m[node]
return res, ok
}
func (p *parser) setMemoized(pt savepoint, node interface{}, tuple resultTuple) {
if p.memo == nil {
p.memo = make(map[int]map[interface{}]resultTuple)
}
m := p.memo[pt.offset]
if m == nil {
m = make(map[interface{}]resultTuple)
p.memo[pt.offset] = m
}
m[node] = tuple
}
func (p *parser) buildRulesTable(g *grammar) {
p.rules = make(map[string]*rule, len(g.rules))
for _, r := range g.rules {
p.rules[r.name] = r
}
}
// nolint: gocyclo
func (p *parser) parse(g *grammar) (val interface{}, err error) {
if len(g.rules) == 0 {
p.addErr(errNoRule)
return nil, p.errs.err()
}
// TODO : not super critical but this could be generated
p.buildRulesTable(g)
if p.recover {
// panic can be used in action code to stop parsing immediately
// and return the panic as an error.
defer func() {
if e := recover(); e != nil {
if p.debug {
defer p.out(p.in("panic handler"))
}
val = nil
switch e := e.(type) {
case error:
p.addErr(e)
default:
p.addErr(fmt.Errorf("%v", e))
}
err = p.errs.err()
}
}()
}
startRule, ok := p.rules[p.entrypoint]
if !ok {
p.addErr(errInvalidEntrypoint)
return nil, p.errs.err()
}
p.read() // advance to first rune
val, ok = p.parseRule(startRule)
if !ok {
if len(*p.errs) == 0 {
// If parsing fails, but no errors have been recorded, the expected values
// for the farthest parser position are returned as error.
maxFailExpectedMap := make(map[string]struct{}, len(p.maxFailExpected))
for _, v := range p.maxFailExpected {
maxFailExpectedMap[v] = struct{}{}
}
expected := make([]string, 0, len(maxFailExpectedMap))
eof := false
if _, ok := maxFailExpectedMap["!."]; ok {
delete(maxFailExpectedMap, "!.")
eof = true
}
for k := range maxFailExpectedMap {
expected = append(expected, k)
}
sort.Strings(expected)
if eof {
expected = append(expected, "EOF")
}
p.addErrAt(errors.New("no match found, expected: "+listJoin(expected, ", ", "or")), p.maxFailPos, expected)
}
return nil, p.errs.err()
}
return val, p.errs.err()
}
func listJoin(list []string, sep string, lastSep string) string {
switch len(list) {
case 0:
return ""
case 1:
return list[0]
default:
return strings.Join(list[:len(list)-1], sep) + " " + lastSep + " " + list[len(list)-1]
}
}
func (p *parser) parseRule(rule *rule) (interface{}, bool) {
if p.debug {
defer p.out(p.in("parseRule " + rule.name))
}
if p.memoize {
res, ok := p.getMemoized(rule)
if ok {
p.restore(res.end)
return res.v, res.b
}
}
start := p.pt
p.rstack = append(p.rstack, rule)
p.pushV()
val, ok := p.parseExpr(rule.expr)
p.popV()
p.rstack = p.rstack[:len(p.rstack)-1]
if ok && p.debug {
p.print(strings.Repeat(" ", p.depth)+"MATCH", string(p.sliceFrom(start)))
}
if p.memoize {
p.setMemoized(start, rule, resultTuple{val, ok, p.pt})
}
return val, ok
}
// nolint: gocyclo
func (p *parser) parseExpr(expr interface{}) (interface{}, bool) {
var pt savepoint
if p.memoize {
res, ok := p.getMemoized(expr)
if ok {
p.restore(res.end)
return res.v, res.b
}
pt = p.pt
}
p.ExprCnt++
if p.ExprCnt > p.maxExprCnt {
panic(errMaxExprCnt)
}
var val interface{}
var ok bool
switch expr := expr.(type) {
case *actionExpr:
val, ok = p.parseActionExpr(expr)
case *andCodeExpr:
val, ok = p.parseAndCodeExpr(expr)
case *andExpr:
val, ok = p.parseAndExpr(expr)
case *anyMatcher:
val, ok = p.parseAnyMatcher(expr)
case *charClassMatcher:
val, ok = p.parseCharClassMatcher(expr)
case *choiceExpr:
val, ok = p.parseChoiceExpr(expr)
case *labeledExpr:
val, ok = p.parseLabeledExpr(expr)
case *litMatcher:
val, ok = p.parseLitMatcher(expr)
case *notCodeExpr:
val, ok = p.parseNotCodeExpr(expr)
case *notExpr:
val, ok = p.parseNotExpr(expr)
case *oneOrMoreExpr:
val, ok = p.parseOneOrMoreExpr(expr)
case *recoveryExpr:
val, ok = p.parseRecoveryExpr(expr)
case *ruleRefExpr:
val, ok = p.parseRuleRefExpr(expr)
case *seqExpr:
val, ok = p.parseSeqExpr(expr)
case *stateCodeExpr:
val, ok = p.parseStateCodeExpr(expr)
case *throwExpr:
val, ok = p.parseThrowExpr(expr)
case *zeroOrMoreExpr:
val, ok = p.parseZeroOrMoreExpr(expr)
case *zeroOrOneExpr:
val, ok = p.parseZeroOrOneExpr(expr)
default:
panic(fmt.Sprintf("unknown expression type %T", expr))
}
if p.memoize {
p.setMemoized(pt, expr, resultTuple{val, ok, p.pt})
}
return val, ok
}
func (p *parser) parseActionExpr(act *actionExpr) (interface{}, bool) {
if p.debug {
defer p.out(p.in("parseActionExpr"))
}
start := p.pt
val, ok := p.parseExpr(act.expr)
if ok {
p.cur.pos = start.position
p.cur.text = p.sliceFrom(start)
state := p.cloneState()
actVal, err := act.run(p)
if err != nil {
p.addErrAt(err, start.position, []string{})
}
p.restoreState(state)
val = actVal
}
if ok && p.debug {
p.print(strings.Repeat(" ", p.depth)+"MATCH", string(p.sliceFrom(start)))
}
return val, ok
}
func (p *parser) parseAndCodeExpr(and *andCodeExpr) (interface{}, bool) {
if p.debug {
defer p.out(p.in("parseAndCodeExpr"))
}
state := p.cloneState()
ok, err := and.run(p)
if err != nil {
p.addErr(err)
}
p.restoreState(state)
return nil, ok
}
func (p *parser) parseAndExpr(and *andExpr) (interface{}, bool) {
if p.debug {
defer p.out(p.in("parseAndExpr"))
}
pt := p.pt
state := p.cloneState()
p.pushV()
_, ok := p.parseExpr(and.expr)
p.popV()
p.restoreState(state)
p.restore(pt)
return nil, ok
}
func (p *parser) parseAnyMatcher(any *anyMatcher) (interface{}, bool) {
if p.debug {
defer p.out(p.in("parseAnyMatcher"))
}
if p.pt.rn == utf8.RuneError && p.pt.w == 0 {
// EOF - see utf8.DecodeRune
p.failAt(false, p.pt.position, ".")
return nil, false
}
start := p.pt
p.read()
p.failAt(true, start.position, ".")
return p.sliceFrom(start), true
}
// nolint: gocyclo
func (p *parser) parseCharClassMatcher(chr *charClassMatcher) (interface{}, bool) {
if p.debug {
defer p.out(p.in("parseCharClassMatcher"))
}
cur := p.pt.rn
start := p.pt
// can't match EOF
if cur == utf8.RuneError && p.pt.w == 0 { // see utf8.DecodeRune
p.failAt(false, start.position, chr.val)
return nil, false
}
if chr.ignoreCase {
cur = unicode.ToLower(cur)
}
// try to match in the list of available chars
for _, rn := range chr.chars {
if rn == cur {
if chr.inverted {
p.failAt(false, start.position, chr.val)
return nil, false
}
p.read()
p.failAt(true, start.position, chr.val)
return p.sliceFrom(start), true
}
}
// try to match in the list of ranges
for i := 0; i < len(chr.ranges); i += 2 {
if cur >= chr.ranges[i] && cur <= chr.ranges[i+1] {
if chr.inverted {
p.failAt(false, start.position, chr.val)
return nil, false
}
p.read()
p.failAt(true, start.position, chr.val)
return p.sliceFrom(start), true
}
}
// try to match in the list of Unicode classes
for _, cl := range chr.classes {
if unicode.Is(cl, cur) {
if chr.inverted {
p.failAt(false, start.position, chr.val)
return nil, false
}
p.read()
p.failAt(true, start.position, chr.val)
return p.sliceFrom(start), true
}
}
if chr.inverted {
p.read()
p.failAt(true, start.position, chr.val)
return p.sliceFrom(start), true
}
p.failAt(false, start.position, chr.val)
return nil, false
}
func (p *parser) incChoiceAltCnt(ch *choiceExpr, altI int) {
choiceIdent := fmt.Sprintf("%s %d:%d", p.rstack[len(p.rstack)-1].name, ch.pos.line, ch.pos.col)
m := p.ChoiceAltCnt[choiceIdent]
if m == nil {
m = make(map[string]int)
p.ChoiceAltCnt[choiceIdent] = m
}
// We increment altI by 1, so the keys do not start at 0
alt := strconv.Itoa(altI + 1)
if altI == choiceNoMatch {
alt = p.choiceNoMatch
}
m[alt]++
}
func (p *parser) parseChoiceExpr(ch *choiceExpr) (interface{}, bool) {
if p.debug {
defer p.out(p.in("parseChoiceExpr"))
}
for altI, alt := range ch.alternatives {
// dummy assignment to prevent compile error if optimized
_ = altI
state := p.cloneState()
p.pushV()
val, ok := p.parseExpr(alt)
p.popV()
if ok {
p.incChoiceAltCnt(ch, altI)
return val, ok
}
p.restoreState(state)
}
p.incChoiceAltCnt(ch, choiceNoMatch)
return nil, false
}
func (p *parser) parseLabeledExpr(lab *labeledExpr) (interface{}, bool) {
if p.debug {
defer p.out(p.in("parseLabeledExpr"))
}
p.pushV()
val, ok := p.parseExpr(lab.expr)
p.popV()
if ok && lab.label != "" {
m := p.vstack[len(p.vstack)-1]
m[lab.label] = val
}
return val, ok
}
func (p *parser) parseLitMatcher(lit *litMatcher) (interface{}, bool) {
if p.debug {
defer p.out(p.in("parseLitMatcher"))
}
start := p.pt
for _, want := range lit.val {
cur := p.pt.rn
if lit.ignoreCase {
cur = unicode.ToLower(cur)
}
if cur != want {
p.failAt(false, start.position, lit.want)
p.restore(start)
return nil, false
}
p.read()
}
p.failAt(true, start.position, lit.want)
return p.sliceFrom(start), true
}
func (p *parser) parseNotCodeExpr(not *notCodeExpr) (interface{}, bool) {
if p.debug {
defer p.out(p.in("parseNotCodeExpr"))
}
state := p.cloneState()
ok, err := not.run(p)
if err != nil {
p.addErr(err)
}
p.restoreState(state)
return nil, !ok
}
func (p *parser) parseNotExpr(not *notExpr) (interface{}, bool) {
if p.debug {
defer p.out(p.in("parseNotExpr"))
}
pt := p.pt
state := p.cloneState()
p.pushV()
p.maxFailInvertExpected = !p.maxFailInvertExpected
_, ok := p.parseExpr(not.expr)
p.maxFailInvertExpected = !p.maxFailInvertExpected
p.popV()
p.restoreState(state)
p.restore(pt)
return nil, !ok
}
func (p *parser) parseOneOrMoreExpr(expr *oneOrMoreExpr) (interface{}, bool) {
if p.debug {
defer p.out(p.in("parseOneOrMoreExpr"))
}
var vals []interface{}
for {
p.pushV()
val, ok := p.parseExpr(expr.expr)
p.popV()
if !ok {
if len(vals) == 0 {
// did not match once, no match
return nil, false
}
return vals, true
}
vals = append(vals, val)
}
}
func (p *parser) parseRecoveryExpr(recover *recoveryExpr) (interface{}, bool) {
if p.debug {
defer p.out(p.in("parseRecoveryExpr (" + strings.Join(recover.failureLabel, ",") + ")"))
}
p.pushRecovery(recover.failureLabel, recover.recoverExpr)
val, ok := p.parseExpr(recover.expr)
p.popRecovery()
return val, ok
}
func (p *parser) parseRuleRefExpr(ref *ruleRefExpr) (interface{}, bool) {
if p.debug {
defer p.out(p.in("parseRuleRefExpr " + ref.name))
}
if ref.name == "" {
panic(fmt.Sprintf("%s: invalid rule: missing name", ref.pos))
}
rule := p.rules[ref.name]
if rule == nil {
p.addErr(fmt.Errorf("undefined rule: %s", ref.name))
return nil, false
}
return p.parseRule(rule)
}
func (p *parser) parseSeqExpr(seq *seqExpr) (interface{}, bool) {
if p.debug {
defer p.out(p.in("parseSeqExpr"))
}
vals := make([]interface{}, 0, len(seq.exprs))
pt := p.pt
state := p.cloneState()
for _, expr := range seq.exprs {
val, ok := p.parseExpr(expr)
if !ok {
p.restoreState(state)
p.restore(pt)
return nil, false
}
vals = append(vals, val)
}
return vals, true
}
func (p *parser) parseStateCodeExpr(state *stateCodeExpr) (interface{}, bool) {
if p.debug {
defer p.out(p.in("parseStateCodeExpr"))
}
err := state.run(p)
if err != nil {
p.addErr(err)
}
return nil, true
}
func (p *parser) parseThrowExpr(expr *throwExpr) (interface{}, bool) {
if p.debug {
defer p.out(p.in("parseThrowExpr"))
}
for i := len(p.recoveryStack) - 1; i >= 0; i-- {
if recoverExpr, ok := p.recoveryStack[i][expr.label]; ok {
if val, ok := p.parseExpr(recoverExpr); ok {
return val, ok
}
}
}
return nil, false
}
func (p *parser) parseZeroOrMoreExpr(expr *zeroOrMoreExpr) (interface{}, bool) {
if p.debug {
defer p.out(p.in("parseZeroOrMoreExpr"))
}
var vals []interface{}
for {
p.pushV()
val, ok := p.parseExpr(expr.expr)
p.popV()
if !ok {
return vals, true
}
vals = append(vals, val)
}
}
func (p *parser) parseZeroOrOneExpr(expr *zeroOrOneExpr) (interface{}, bool) {
if p.debug {
defer p.out(p.in("parseZeroOrOneExpr"))
}
p.pushV()
val, _ := p.parseExpr(expr.expr)
p.popV()
// whether it matched or not, consider it a match
return val, true
}
func rangeTable(class string) *unicode.RangeTable {
if rt, ok := unicode.Categories[class]; ok {
return rt
}
if rt, ok := unicode.Properties[class]; ok {
return rt
}
if rt, ok := unicode.Scripts[class]; ok {
return rt
}
// cannot happen
panic(fmt.Sprintf("invalid Unicode class: %s", class))
}
| {
"pile_set_name": "Github"
} |
{
"name": "@loaders.gl/basis",
"version": "2.3.0-beta.2",
"description": "Framework-independent loader for the basis universal format",
"license": "MIT",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/visgl/loaders.gl"
},
"keywords": [
"webgl",
"loader",
"3d",
"texture",
"basis"
],
"main": "dist/es5/index.js",
"module": "dist/esm/index.js",
"esnext": "dist/es6/index.js",
"sideEffects": false,
"files": [
"src",
"dist",
"bin",
"README.md"
],
"scripts": {
"pre-build": "npm run copy-libs && npm run build-worker && npm run build-bundle && npm run build-bundle -- --env.dev",
"copy-libs": "cp -rf ./src/libs ./dist/libs",
"build-bundle": "webpack --display=minimal --config ../../scripts/bundle.config.js",
"build-worker": "webpack --entry ./src/workers/basis-loader.worker.js --output ./dist/basis-loader.worker.js --config ../../scripts/worker-webpack-config.js"
},
"dependencies": {
"@loaders.gl/core": "2.3.0-beta.2",
"@loaders.gl/loader-utils": "2.3.0-beta.2",
"texture-compressor": "^1.0.2"
}
}
| {
"pile_set_name": "Github"
} |
{% load i18n %}{% trans "Low disk space!" %}
| {
"pile_set_name": "Github"
} |
#
# Copyright (C) 2005-2019 CS Systemes d'Information (CS SI)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# 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.
#
set(TEST_DRIVER otbTestDriver
--add-before-env PYTHONPATH ${CMAKE_BINARY_DIR}/${OTB_INSTALL_PYTHON_DIR}
--add-before-env OTB_APPLICATION_PATH $<TARGET_FILE_DIR:otbapp_Smoothing> )
if(WIN32)
# on windows, loading the module _otbApplication requires the otbossimplugins*.dll
# which is in the 'bin/<CMAKE_BUILD_TYPE>' folder
set(TEST_DRIVER ${TEST_DRIVER}
--add-before-env PATH $<TARGET_FILE_DIR:OTBCommon>)
endif(WIN32)
add_test( NAME pyTvSmoothing
COMMAND ${TEST_DRIVER} Execute
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/PythonTestDriver.py
PythonSmoothingTest
${OTB_DATA_ROOT}/Input/ToulouseExtract_WithGeom.tif
${TEMP}/pyTvSmoothing_ )
add_test( NAME pyTvRescale
COMMAND ${TEST_DRIVER} Execute
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/PythonTestDriver.py
PythonRescaleTest
${OTB_DATA_ROOT}/Input/ToulouseExtract_WithGeom.tif
${TEMP}/pyTvRescale)
add_test( NAME pyTvHyperspectralUnmixingUCLS
COMMAND ${TEST_DRIVER} Execute
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/PythonTestDriver.py
PythonHyperspectralUnmixing1
${OTB_DATA_ROOT}/Input/Hyperspectral/synthetic/hsi_cube.tif
${TEMP}/pyTvHyperspectralUnmixing_ucls.tif
${OTB_DATA_ROOT}/Input/Hyperspectral/synthetic/endmembers.tif
ucls
)
add_test( NAME pyTvBug804
COMMAND ${TEST_DRIVER} Execute
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/PythonTestDriver.py
Bug804
)
add_test( NAME pyTvBug823
COMMAND ${TEST_DRIVER} Execute
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/PythonTestDriver.py
Bug823
)
add_test( NAME pyTvBug736
COMMAND ${TEST_DRIVER}
--compare-image ${NOTOL}
${BASELINE}/apTvRIRadiometricVegetationIndices.tif
${TEMP}/pyTvBug736Output.tif
Execute
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/PythonTestDriver.py
Bug736
${OTB_DATA_ROOT}/Input/veryverySmallFSATSW.tif
${TEMP}/pyTvBug736Output.tif
)
add_test( NAME pyTvBug1899
COMMAND ${TEST_DRIVER}
Execute
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/PythonTestDriver.py
Bug1899
${OTB_DATA_ROOT}/Input/veryverySmallFSATSW.tif
${TEMP}/pyTvBug1899Output.tif
)
add_test( NAME pyTvBandMathOutXML
COMMAND ${TEST_DRIVER} Execute
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/PythonTestDriver.py
PythonOutXMLTest
${OTB_DATA_ROOT}/Input/verySmallFSATSW_r.tif
${OTB_DATA_ROOT}/Input/verySmallFSATSW_nir.tif
${OTB_DATA_ROOT}/Input/verySmallFSATSW.tif
${TEMP}/pyTvBandMathOutXML.tif
${TEMP}/pyTvBandMathOutXML.xml
)
add_test( NAME pyTvBandMathInXML
COMMAND ${TEST_DRIVER} Execute
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/PythonTestDriver.py
PythonInXMLTest
${TEMP}/pyTvBandMathOutXML.xml
${TEMP}/pyTvBandMathInXML.tif
)
set_tests_properties(pyTvBandMathInXML PROPERTIES DEPENDS pyTvBandMathOutXML)
if ( NUMPY_FOUND )
add_test( NAME pyTvNumpyIO
COMMAND ${TEST_DRIVER} Execute
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/PythonTestDriver.py
PythonNumpyTest
${OTB_DATA_ROOT}/Input/ROI_QB_MUL_1_SVN_CLASS_MULTI.png
${TEMP}/pyTvNumpyIO_SmoothingOut.png )
add_test( NAME pyTvImageInterface
COMMAND ${TEST_DRIVER} Execute
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/PythonTestDriver.py
PythonImageInterface
${OTB_DATA_ROOT}/Input/QB_Toulouse_Ortho_XS.tif
)
endif()
add_test( NAME pyTvNewStyleParameters
COMMAND ${TEST_DRIVER} Execute
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/PythonTestDriver.py
PythonNewStyleParametersTest
${OTB_DATA_ROOT}/Input/sensor_stereo_left.tif
${TEMP}/pyTvNewStyleParametersTest.tif
${OTB_DATA_ROOT}/Input/apTvUtSmoothingTest_OutXML.xml)
add_test( NAME pyTvNewStyleParametersInstantiateAll
COMMAND ${TEST_DRIVER} Execute
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/PythonTestDriver.py
PythonNewStyleParametersInstantiateAllTest
)
add_test( NAME pyTvConnectApplications
COMMAND ${TEST_DRIVER} Execute
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/PythonTestDriver.py
PythonConnectApplications
${OTB_DATA_ROOT}/Input/poupees.tif
${TEMP}/pyTvConnectApplicationsOutput.tif)
add_test( NAME pyTvBug1498
COMMAND ${TEST_DRIVER} Execute
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/PythonTestDriver.py
Bug823
${OTB_DATA_ROOT}/Input/poupees.tif
${TEMP}/Bu1498-output.tif)
add_test( NAME pyTvParametersDict
COMMAND ${TEST_DRIVER} Execute
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/PythonTestDriver.py
PythonParametersDict
${OTB_DATA_ROOT}/Input/poupees.tif)
add_test( NAME pyTvNoUpdateParameter
COMMAND ${TEST_DRIVER} Execute
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/PythonTestDriver.py
PythonNoUpdateParameter
${OTB_DATA_ROOT}/Input/poupees.tif
${OTB_DATA_ROOT}/Input/training/training.shp
)
| {
"pile_set_name": "Github"
} |
fileFormatVersion: 2
guid: ecfdf595daa6a42459762b3e034b9053
timeCreated: 1427019985
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
| {
"pile_set_name": "Github"
} |
using System;
using System.Collections.Generic;
using NHapi.Base.Log;
using NHapi.Model.V24.Group;
using NHapi.Model.V24.Segment;
using NHapi.Model.V24.Datatype;
using NHapi.Base;
using NHapi.Base.Parser;
using NHapi.Base.Model;
namespace NHapi.Model.V24.Message
{
///<summary>
/// Represents a DOC_T12 message structure (see chapter [AAA]). This structure contains the
/// following elements:
///<ol>
///<li>0: MSH (Message Header) </li>
///<li>1: MSA (Message Acknowledgment) </li>
///<li>2: ERR (Error) optional </li>
///<li>3: QAK (Query Acknowledgment) optional </li>
///<li>4: QRD (Original-Style Query Definition) </li>
///<li>5: DOC_T12_RESULT (a Group object) repeating</li>
///<li>6: DSC (Continuation Pointer) optional </li>
///</ol>
///</summary>
[Serializable]
public class DOC_T12 : AbstractMessage {
///<summary>
/// Creates a new DOC_T12 Group with custom IModelClassFactory.
///</summary>
public DOC_T12(IModelClassFactory factory) : base(factory){
init(factory);
}
///<summary>
/// Creates a new DOC_T12 Group with DefaultModelClassFactory.
///</summary>
public DOC_T12() : base(new DefaultModelClassFactory()) {
init(new DefaultModelClassFactory());
}
///<summary>
/// initalize method for DOC_T12. This does the segment setup for the message.
///</summary>
private void init(IModelClassFactory factory) {
try {
this.add(typeof(MSH), true, false);
this.add(typeof(MSA), true, false);
this.add(typeof(ERR), false, false);
this.add(typeof(QAK), false, false);
this.add(typeof(QRD), true, false);
this.add(typeof(DOC_T12_RESULT), true, true);
this.add(typeof(DSC), false, false);
} catch(HL7Exception e) {
HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error creating DOC_T12 - this is probably a bug in the source code generator.", e);
}
}
public override string Version
{
get{
return Constants.VERSION;
}
}
///<summary>
/// Returns MSH (Message Header) - creates it if necessary
///</summary>
public MSH MSH {
get{
MSH ret = null;
try {
ret = (MSH)this.GetStructure("MSH");
} catch(HL7Exception e) {
HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
}
///<summary>
/// Returns MSA (Message Acknowledgment) - creates it if necessary
///</summary>
public MSA MSA {
get{
MSA ret = null;
try {
ret = (MSA)this.GetStructure("MSA");
} catch(HL7Exception e) {
HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
}
///<summary>
/// Returns ERR (Error) - creates it if necessary
///</summary>
public ERR ERR {
get{
ERR ret = null;
try {
ret = (ERR)this.GetStructure("ERR");
} catch(HL7Exception e) {
HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
}
///<summary>
/// Returns QAK (Query Acknowledgment) - creates it if necessary
///</summary>
public QAK QAK {
get{
QAK ret = null;
try {
ret = (QAK)this.GetStructure("QAK");
} catch(HL7Exception e) {
HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
}
///<summary>
/// Returns QRD (Original-Style Query Definition) - creates it if necessary
///</summary>
public QRD QRD {
get{
QRD ret = null;
try {
ret = (QRD)this.GetStructure("QRD");
} catch(HL7Exception e) {
HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
}
///<summary>
/// Returns first repetition of DOC_T12_RESULT (a Group object) - creates it if necessary
///</summary>
public DOC_T12_RESULT GetRESULT() {
DOC_T12_RESULT ret = null;
try {
ret = (DOC_T12_RESULT)this.GetStructure("RESULT");
} catch(HL7Exception e) {
HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
///<summary>
///Returns a specific repetition of DOC_T12_RESULT
/// * (a Group object) - creates it if necessary
/// throws HL7Exception if the repetition requested is more than one
/// greater than the number of existing repetitions.
///</summary>
public DOC_T12_RESULT GetRESULT(int rep) {
return (DOC_T12_RESULT)this.GetStructure("RESULT", rep);
}
/**
* Returns the number of existing repetitions of DOC_T12_RESULT
*/
public int RESULTRepetitionsUsed {
get{
int reps = -1;
try {
reps = this.GetAll("RESULT").Length;
} catch (HL7Exception e) {
string message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
HapiLogFactory.GetHapiLog(GetType()).Error(message, e);
throw new System.Exception(message);
}
return reps;
}
}
/**
* Enumerate over the DOC_T12_RESULT results
*/
public IEnumerable<DOC_T12_RESULT> RESULTs
{
get
{
for (int rep = 0; rep < RESULTRepetitionsUsed; rep++)
{
yield return (DOC_T12_RESULT)this.GetStructure("RESULT", rep);
}
}
}
///<summary>
///Adds a new DOC_T12_RESULT
///</summary>
public DOC_T12_RESULT AddRESULT()
{
return this.AddStructure("RESULT") as DOC_T12_RESULT;
}
///<summary>
///Removes the given DOC_T12_RESULT
///</summary>
public void RemoveRESULT(DOC_T12_RESULT toRemove)
{
this.RemoveStructure("RESULT", toRemove);
}
///<summary>
///Removes the DOC_T12_RESULT at the given index
///</summary>
public void RemoveRESULTAt(int index)
{
this.RemoveRepetition("RESULT", index);
}
///<summary>
/// Returns DSC (Continuation Pointer) - creates it if necessary
///</summary>
public DSC DSC {
get{
DSC ret = null;
try {
ret = (DSC)this.GetStructure("DSC");
} catch(HL7Exception e) {
HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
}
}
}
| {
"pile_set_name": "Github"
} |
msgid ""
msgstr ""
"Project-Id-Version: CakePHP Testsuite\n"
"POT-Creation-Date: 2008-05-15 02:51-0700\n"
"PO-Revision-Date: \n"
"Last-Translator: CakePHP I18N & I10N Team <[email protected]>\n"
"Language-Team: CakePHP I18N & I10N Team <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2;\n"
"X-Poedit-Language: Three Forms of Plurals\n"
"X-Poedit-SourceCharset: utf-8\n"
msgid "Plural Rule 1"
msgstr "Plural Rule 3 (translated)"
msgid "%d = 1"
msgid_plural "%d = 0 or > 1"
msgstr[0] "%d ends 1 but not 11 (translated)"
msgstr[1] "%d everything else (translated)"
msgstr[2] "%d = 0 (translated)"
#~ msgid "Plural-Forms 1"
#~ msgstr "Plural-Forms 1 (translated)"
| {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.