text
stringlengths 2
100k
| meta
dict |
---|---|
/**
* Copyright (c) 2010-2020 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.thing.internal.profiles;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.*;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mock;
import org.openhab.core.library.types.OnOffType;
import org.openhab.core.thing.CommonTriggerEvents;
import org.openhab.core.thing.profiles.ProfileCallback;
import org.openhab.core.thing.profiles.TriggerProfile;
import org.openhab.core.types.Command;
/**
* Tests for the system:rawbutton-on-off-switch profile
*
* @author Mark Hilbush - Initial contribution
*/
public class RawButtonOnOffSwitchProfileTest {
private @Mock ProfileCallback mockCallback;
@BeforeEach
public void setup() {
mockCallback = mock(ProfileCallback.class);
}
@Test
public void testOnOffSwitchItem() {
TriggerProfile profile = new RawButtonOnOffSwitchProfile(mockCallback);
verifyAction(profile, CommonTriggerEvents.PRESSED, OnOffType.ON);
verifyAction(profile, CommonTriggerEvents.RELEASED, OnOffType.OFF);
}
private void verifyAction(TriggerProfile profile, String trigger, Command expectation) {
reset(mockCallback);
profile.onTriggerFromHandler(trigger);
verify(mockCallback, times(1)).sendCommand(eq(expectation));
}
}
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta content="width=device-width,initial-scale=1,user-scalable=no" name="viewport">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-touch-fullscreen" content="yes">
<meta name="format-detection" content="telephone=no,address=no">
<meta name="apple-mobile-web-app-status-bar-style" content="white">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" >
<title></title>
<script>
!function(x){function w(){var v,u,t,tes,s=x.document,r=s.documentElement,a=r.getBoundingClientRect().width;if(!v&&!u){var n=!!x.navigator.appVersion.match(/AppleWebKit.*Mobile.*/);v=x.devicePixelRatio;tes=x.devicePixelRatio;v=n?v:1,u=1/v}if(a>=640){r.style.fontSize="40px"}else{if(a<=320){r.style.fontSize="20px"}else{r.style.fontSize=a/320*20+"px"}}}x.addEventListener("resize",function(){w()});w()}(window);
</script>
</head>
<body>
<div id="app"></div>
</body>
</html>
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Additionally licensed with:
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.spf4j.stackmonitor;
import java.util.Map;
import java.util.function.Function;
import java.util.function.Supplier;
import org.spf4j.base.ExecutionContext;
public final class ThreadSpecificTracingExecutionContextHandler extends TracingExecutionContexSampler {
public ThreadSpecificTracingExecutionContextHandler(
final Supplier<Iterable<Map.Entry<Thread, ExecutionContext>>> execCtxSupplier,
final Function<ExecutionContext, String> ctxToCategory) {
super(execCtxSupplier, ctxToCategory);
}
public ThreadSpecificTracingExecutionContextHandler(final int maxNrThreads,
final Supplier<Iterable<Map.Entry<Thread, ExecutionContext>>> execCtxSupplier,
final Function<ExecutionContext, String> ctxToCategory) {
super(maxNrThreads, execCtxSupplier, ctxToCategory);
}
@Override
protected int prepareThreadsAndContexts(final Iterable<Map.Entry<Thread, ExecutionContext>> currentThreads) {
int i = 0;
for (Map.Entry<Thread, ExecutionContext> entry : currentThreads) {
requestFor[i] = entry.getKey();
contexts[i++] = entry.getValue();
if (i >= requestFor.length) {
break;
}
}
return i;
}
}
| {
"pile_set_name": "Github"
} |
var imageEffectHelper = {
foreach: function image_effect_helper_foreach ( canvas, func, channel ) {
// console.log('image effect helper foreach start', canvas, func, channel) ;
if ( channel === undefined ) {
channel = -1 ; // r, g, b channels by default
}
var context = canvas.context() ;
var image = context.getImageData (0, 0, canvas.width, canvas.height) ;
var data = image.data ;
var Npel = data.length / 4 ;
var offset = 0 ;
var opacity = new Array(Npel) ;
for (var kpel = 0 ; kpel < Npel ; kpel++) {
if ( channel < 3 && data[offset + 3] === 0) {
offset += 4 ;
continue ; // skip transparent pixels if opacity channel is not specified
}
if ( channel >= 0 && channel < 4 ) {
// console.log('func(data[offset + channel])', func(data[offset + channel])) ;
data[offset + channel] = func(data[offset + channel]) ;
} else if ( channel === -1 ) {
data[offset + 0] = func(data[offset + 0]) ;
data[offset + 1] = func(data[offset + 1]) ;
data[offset + 2] = func(data[offset + 2]) ;
}
offset += 4 ;
}
context.putImageData(image, 0, 0) ;
// console.log('foreach: ', 'data', data, 'image', image, 'context', context) ;
// imageHelper.view(canvas) ;
},
opacity: function image_effect_helper_opacity ( canvas, opacity ) {
imageEffectHelper.foreach(
canvas,
function() {
return opacity ;
},
3 // opacity channel
)
},
binary_opacity_filter: function image_effect_helper_binary_opacity_filter (canvas, threshold) {
var context = canvas.context() ;
var image = context.getImageData (0, 0, canvas.width, canvas.height) ;
var data = image.data ;
var Npel = data.length / 4 ;
var offset = 0 ;
var opacity = new Array(Npel) ;
for (var kpel = 0 ; kpel < Npel ; kpel++) {
if (data[offset + 3] > 0) {
opacity[Npel] = data[offset + 3] ;
}
offset += 4 ;
}
// console.log('opacity', opacity) ;
if(threshold === undefined) {
threshold = 68 ;
}
offset = 0 ;
for (var kpel = 0 ; kpel < Npel ; kpel++) {
if (data[offset + 3] < threshold) {
data[offset + 3] = 0 ;
} else {
data[offset + 3] = 255 ;
}
offset += 4 ;
}
context.putImageData(image, 0, 0) ;
},
color_filter: function image_effect_helper_color_filter (canvas, color, strength) {
if ( strength === undefined ) {
strength = 1 ;
}
// strength goes from 0 to 1
if( strength > 1 ) {
strength = 1 ;
}
if ( strength < 0 ) {
strength = 0 ;
}
function blend(x, y, c1) {
var mixedVal = (1 - c1) * x + c1 * y ;
// console.log('blend: ', 'x, y, c1, mixedVal', x, y, c1, mixedVal) ;
return Math.round(mixedVal) ;
}
var filteredImage = imageHelper.copy(canvas) ;
for (kclr = 0 ; kclr < color.length ; kclr++) {
if(color[kclr] !== undefined) {
// console.log('color[kclr]', color[kclr], 'strength', strength) ;
imageEffectHelper.foreach( filteredImage, function(x) { return blend(x, color[kclr], strength) ; }, kclr ) ;
}
}
return filteredImage ;
// to test: imageEffectHelper.color_filter ( document.viz.item[0].image, [255, 255, 0], -1 )
},
fade: function effect_image_fade(fadeConfig, item) {
if(item === undefined) {
item = this ;
}
if(fadeConfig === undefined) {
fadeConfig = {} ;
}
if(fadeConfig.opacity === undefined) {
// console.log('fadeConfig', fadeConfig, 'item.opacity', item.opacity)
var thresh = 0.5 ;
if(item.opacity < thresh) {
fadeConfig.opacity = 1 ;
} else {
fadeConfig.opacity = 0 ;
}
}
var newTransition = imageEffectHelper.fade_transition(fadeConfig) ;
// console.log('fade', 'newTransition', newTransition, 'item', item, 'fadeConfig', fadeConfig) ;
var replacementSwitch = fadeConfig.replacementSwitch || true ;
item.add_transition(newTransition, replacementSwitch) ;
}, // end fade
fade_transition: function image_effect_helper_fade_transition(fadeConfig) {
var defaultFadeDuration = 1000 ;
if(fadeConfig.duration === undefined) {
fadeConfig.duration = defaultFadeDuration ;
}
var newTransition = $Z.transition.linear_transition_func('opacity', fadeConfig.duration)(fadeConfig.opacity) ;
if( fadeConfig.end !== undefined) {
newTransition.end = fadeConfig.end ;
}
if( fadeConfig.child !== undefined) {
newTransition.child = fadeConfig.child ;
}
if ( fadeConfig.pause !== undefined) {
newTransition.pause = fadeConfig.pause ;
}
return newTransition ;
},
fade_sequence: function image_effect_helper_fade_sequence( fadeConfig ) {
if ( fadeConfig === undefined ) {
fadeConfig = {} ;
}
var valueList = fadeConfig.valueList ;
var duration = fadeConfig.duration || 1000 ;
var value = fadeConfig.value ;
var create_fade = transitionHelper.fixed_duration_linear('opacity', duration) ;
return transitionHelper.new_sequence(value, create_fade) ;
},
explode: function effect_helper_image_explode(blocksize, duration, removeSwitch, fadeSwitch, item) {
if(item === undefined) {
item = this ;
}
if(blocksize === undefined) {
blocksize = 24 ;
}
if(duration === undefined) {
duration = 1500 ;
}
if(removeSwitch === undefined) {
removeSwitch = true ;
}
if(fadeSwitch === undefined) {
fadeSwitch = true ;
}
if(removeSwitch) {
itemHelper.remove(item) ;
}
// console.log('explode start') ;
var Nrow = Math.floor(item.image.height / blocksize) ;
var Ncol = Math.floor(item.image.width / blocksize) ;
var Nblock = Nrow * Ncol ;
var block = new Array(Nblock) ;
var sx, sy ;
var sw = blocksize ;
var sh = blocksize ;
var dx = 0 ;
var dy = 0 ;
var dw = blocksize ;
var dh = blocksize ;
var scale = 300 ;
for(var krow = 0 ; krow < Nrow ; krow++) {
for(var kcol = 0 ; kcol < Ncol ; kcol++) {
var canvas = imageHelper.create(blocksize, blocksize) ;
var context = canvas.context() ;
sx = Math.floor(kcol * blocksize / document.ratio) ;
sy = Math.floor(krow * blocksize / document.ratio) ;
context.drawImage(item.image, sx, sy, sw, sh, dx, dy, dw, dh) ;
var k = krow * Ncol + kcol ;
var xTrans = $Z.transition.rounded_linear_transition_func('x', duration)((Math.random() - 0.5) * 2 * scale + item.x + sx) ;
block[k] = Object.assign(itemHelper.setup(), {
viz: item.viz,
x: item.x + sx,
y: item.y + sy,
image: canvas,
opacity: 1,
render: drawHelper.image,
inert: true,
transition: [
xTrans,
$Z.transition.rounded_linear_transition_func('y', duration)((Math.random() - 0.5) * 2 * scale + item.y + sy),
],
}) ;
xTrans.end = transitionHelper.remove_end(block[k]) ;
if(fadeSwitch) {
imageEffectHelper.fade.call(block[k], { duration: duration }) ;
}
}
}
itemHelper.add(viz, block) ;
},
} ; | {
"pile_set_name": "Github"
} |
---
ms.technology: devops-ecosystem
title: Create service endpoints | Extensions for Azure DevOps
description: Browse through the places where your extension can extend Visual Studio Codespace for Azure DevOps and Team Foundation Server (TFS).
ms.assetid: ad0ea9de-620e-4605-8fcd-3c1443b26d8c
ms.topic: conceptual
monikerRange: '>= tfs-2017'
ms.author: chcomley
author: chcomley
ms.date: 08/05/2020
---
# Create a service endpoint
[!INCLUDE [version-tfs-2017-through-vsts](../../includes/version-tfs-2017-through-vsts.md)]
::: moniker range="<= tfs-2018"
> [!NOTE]
> _Service endpoints_ are called _service connections_ in TFS 2018 and in older versions.
> _Pipelines_ are called _definitions_ in TFS 2018 and older versions.
::: moniker-end
Service endpoints are a way for Azure DevOps and TFS to connect to external systems or services. They're a bundle of properties securely stored by Azure DevOps and TFS, which includes but isn't limited to the following properties:
- Service name
- Description
- Server URL
- Certificates or tokens
- User names and passwords
Extensions are then able to use the service endpoint to acquire the stored details to do the necessary operations on that service.
Follow this guide to create a new Service Point contribution and use it in your extension.
[!INCLUDE [extension-docs-new-sdk](../../includes/extension-docs-new-sdk.md)]
## Task overview
You can develop a service endpoint by creating an example extension for Azure DevOps or TFS that includes the following items:
- A custom service endpoint with data sources, which enables a build task or dashboard widget to call a REST endpoint on the service/server defined by the endpoint.
- A build task, which defines two properties: The service endpoint & a picklist, which has values populated from the REST endpoint data source.
> Note: Service endpoints created by users are created at the project level, not the organization level.
The steps involved in completing this task are:
- [Step 1: Creating the extension manifest file](#step1)
- [Step 2: The build task pipeline, in the task.json file](#step2)
> [!NOTE]
> This tutorial refers to the home directory for your project as "home".
<a name="step1" />
## Step 1: Create the manifest file: `vss-extension.json`
The [manifest file](./manifest.md) defines the custom endpoint and links to the task.json manifest for the build task.
In this article, the manifest file creation is separated into three parts:
- [Create the basic manifest file](#createbasic)
- [Add a custom endpoint contribution](#customendpoint)
- [Add a build task](#buildtask)
<a name="createbasic" />
### Create basic manifest file
Create a json file (`vss-extension.json`, for example) in the `home` directory of your extension.
```json
{
"manifestVersion": 1,
"id": "service-endpoint-tutorial",
"version": "0.1.1",
"name": "Sample extension that leverages a service endpoint",
"description": "A sample Azure DevOps extension which shows how to create a custom endpoint and dynamic build task parameters taking value from a REST API.",
"publisher": "francistotten",
"targets": [
{
"id": "Microsoft.VisualStudio.Services"
}
],
"files": [
{
"path": "BuildTaskFolder"
}
]
}
```
> [!NOTE]
> You need to update the `publisher` property.
> [!NOTE]
> "BuildTaskFolder" is the path where we'll eventually place our build task pipeline
<a name="customendpoint" />
### Add the custom endpoint contribution
Add the following `contributions` array underneath the `targets` array of the basic manifest content.
> [!IMPORTANT]
> Service connection parameters must be fetched by service connection ID.
```json
"contributions": [
{
"id": "service-endpoint",
"description": "Service endpoint type for Fabrikam connections",
"type": "ms.vss-endpoint.service-endpoint-type",
"targets": [ "ms.vss-endpoint.endpoint-types" ],
"properties": {
"name": "fabrikam",
"displayName": "Fabrikam server connection",
"url": {
"displayName": "Server Url",
"helpText": "Url for the Fabrikam server to connect to."
},
"dataSources": [
{
"name": "Fabrikam Projects",
"endpointUrl": "{{endpoint.url}}api/projects/index",
"resultSelector": "jsonpath:$[*].nm"
}
],
"authenticationSchemes": [
{
"type": "ms.vss-endpoint.endpoint-auth-scheme-token"
},
{
"type": "ms.vss-endpoint.endpoint-auth-scheme-basic",
"inputDescriptors": [
{
"id": "username",
"name": "Username",
"description": "Username",
"inputMode": "textbox",
"validation": {
"isRequired": false,
"dataType": "string"
}
},
{
"id": "password",
"name": "Password",
"description": "Password",
"inputMode": "passwordbox",
"isConfidential": true,
"validation": {
"isRequired": false,
"dataType": "string"
}
}
]
}
],
"helpMarkDown": "<a href=\"url-to-documentation\" target=\"_blank\"><b>Learn More</b></a>"
}
},
],
```
> [!NOTE]
> Below is what your endpoint looks like after you've packaged and published your extension. See the [Next Steps](#next-steps) section below for info on how to package and publish.
If you've successfully added the service contribution correctly, you see the Fabrikam endpoint when trying to add a new service endpoint to your organization.
<img alt= "Service endpoint picker" src="./media/service-endpoint-endpoint-picker.png" style="padding:10px;display:block;margin-left:auto;margin-right:auto">
Go ahead and create a service endpoint using the Fabrikam endpoint.
<img alt="Service endpoint setup" src="./media/service-endpoint-setup.png" style="padding:10px;display:block;margin-left:auto;margin-right:auto">
<a name="buildtask" />
### Add the build task contribution
Inside the `contributions` array from the previous step, add the following object to the end.
```json
{
"id": "build-task",
"description": "Task with a dynamic property getting data from an endpoint REST data source",
"type": "ms.vss-distributed-task.task",
"targets": [ "ms.vss-distributed-task.tasks" ],
"properties": {
"name": "BuildTaskFolder"
}
}
```
The datasource endpoint URL is computed from the url of the endpoint (or a fixed url), and some additional values.
For this tutorial, this REST call returns nothing and is meant to be replaced by any REST calls you wish to make to your service.
It's possible to use other parameters than the endpoint url for the REST URL, for instance some endpoint properties.
For instance, assuming that we had a property in the endpoint named subscriptionId, the REST URL could use it with the following syntax: $(endpoint.subscription)
<a name="step2" />
## Step 2: Create the build task: `task.json`
The `task.json` file describes your build task.
> [!NOTE]
> Take a look at the [build task reference](./integrate-build-task.md) to find the schema for the build task json file.
Create a `task.json` file in your `BuildTaskFolder` directory, if you haven't created this folder yet, do so now.
```json
{
"id": "6557a6d2-4caf-4247-99ea-5131286a8753",
"name": "build-task",
"friendlyName": "Build Task that uses the service endpoint",
"description": "Task with a dynamic property getting data from an endpoint REST data source",
"author": "francistotten",
"helpMarkDown": "Replace with markdown to show in help",
"category": "Build",
"visibility": [
"Build",
"Release"
],
"demands": [],
"version": {
"Major": "0",
"Minor": "1",
"Patch": "1"
},
"minimumAgentVersion": "1.95.0",
"instanceNameFormat": "Service Endpoint Build Task $(project)",
"inputs": [
{
"name": "FabrikamService",
"type": "connectedService:Fabrikam",
"label": "Fabrikam service/server end point",
"defaultValue": "",
"required": true,
"helpMarkDown": "Select the Fabrikam end point to use. If needed,selecton 'manage', and add a new service endpoint of type 'Fabrikam server connection'"
},
{
"name": "project",
"type": "pickList",
"label": "Fabrikam Project",
"required": true,
"helpMarkDown": "Select the name of the Fabrikam Project to analyze.",
"properties": {
"EditableOptions": "True"
}
}
],
"dataSourceBindings": [
{
"target": "project",
"endpointId": "$(FabrikamService)",
"dataSourceName": "Fabfrikam Projects"
}
],
"execution": {
"Node": {
"target": "sample.js",
"argumentFormat": ""
},
"PowerShell3": {
"target": "sample.ps1"
}
}
}
```
### task.json components
**The `FabrikamService` input object**
<br>
This field is the first of type connectedService:Fabrikam. connectedService expresses the fact that this is an endpoint type,
and Fabrikam is simply the name of the object.
**The `project` input object**
<br>
This field is second. It's a picklist
- This field is populated by a REST call.
- The values from the field "project" are taken from the "Projects" REST data source of the custom endpoint.
- Expressed in the `dataSourceBindings` array
- The target is the name of the build task field to be populated ("project")
- The endpointId is the name of the build task field containing the custom endpoint type
- The REST call is chosen by the dataSourceName
If you've added the Build Task successfully, you should now see the Build Task when adding tasks to a build pipeline
<img alt="Service endpoint build task selector" src="./media/service-endpoint-build-task-selector.png" style="padding:10px;display:block;margin-left:auto;margin-right:auto">
Once you've added the Build Task to your pipeline, confirm that it can see the Fabrikam endpoint you created.
The projects dropdown in this tutorial is blank since we aren't using a real service.
Once you replace Fabrikam with your service, replace the Projects call with your own REST api call to leverage dynamic data inside your build task
<img alt="Service endpoint build task setup" src="./media/service-endpoint-build-task-setup.png" style="padding:10px;display:block;margin-left:auto;margin-right:auto">
## Authentication Documentation
The authentication scheme in a service endpoint determines the credentials that would be used to connect to the external service. For more information and to see the following authentication schemes, see the [authentication schemes documentation](./auth-schemes.md)
- Basic authentication
- Token-based authentication
- Certificate-based authentication
- No authentication
## Next Steps
Now that you've written your extension, the next steps are to Package, Publish, and Install your extension. You can also check out the
documentation for Testing and Debugging your extension.
* [Package, publish, and install extensions](../publish/overview.md)
* [Testing and debugging extensions](/previous-versions/azure/devops/docs/extend/test/debug-in-browser)
| {
"pile_set_name": "Github"
} |
/* istanbul ignore file */
import { Helpers } from '../helpers';
export default class oAuth2ImplicitGrant {
constructor(settings = {}) {
const defaultSettings = {
oAuthData: {
redirect_uri:
window.location.origin + '/assets/auth-oauth2/callback.html',
response_type: 'id_token token',
scope: ''
},
authorizeMethod: 'GET',
logoutUrl: '',
post_logout_redirect_uri: window.location.origin + '/logout.html',
accessTokenExpiringNotificationTime: 60,
expirationCheckInterval: 5
};
const mergedSettings = Helpers.deepMerge(defaultSettings, settings);
this.settings = mergedSettings;
}
getAuthData() {
return Luigi.auth().store.getAuthData();
}
parseIdToken(token) {
const payload = token
.split('.')[1]
.replace(/-/g, '+')
.replace(/_/g, '/');
return JSON.parse(window.atob(payload));
}
userInfo() {
return new Promise((resolve, reject) => {
let authData = this.getAuthData();
const tokenInfo = this.parseIdToken(authData.idToken);
const userInfo = {
email: tokenInfo.email ? tokenInfo.email : '',
name: tokenInfo.name ? tokenInfo.name : ''
};
resolve(userInfo);
});
}
login() {
return new Promise((resolve, reject) => {
const settings = this.settings;
const generatedNonce =
(settings.nonceFn && settings.nonceFn()) || this.generateNonce();
sessionStorage.setItem('luigi.nonceValue', generatedNonce);
if (!settings.oAuthData.nonce) {
settings.oAuthData.nonce = generatedNonce;
}
const createInputElement = (name, value) => {
return Object.assign(document.createElement('input'), {
name: name,
id: name,
value: value,
type: 'hidden'
});
};
const formElem = Object.assign(document.createElement('form'), {
name: 'signIn',
id: 'signIn',
action: settings.authorizeUrl,
method: settings.authorizeMethod,
target: '_self'
});
settings.oAuthData.redirect_uri = `${Helpers.prependOrigin(
settings.oAuthData.redirect_uri
)}?storageType=${Luigi.auth().store.getStorageType()}`;
settings.oAuthData.state = btoa(
encodeURI(window.location.href) + '_luigiNonce=' + generatedNonce
);
for (const name in settings.oAuthData) {
const node = createInputElement(name, settings.oAuthData[name]);
formElem.appendChild(node.cloneNode());
}
document.getElementsByTagName('body')[0].appendChild(formElem);
setTimeout(() => {
document.querySelector('form#signIn').submit();
});
// TODO: We're not resolving the promise at any time,
// since oauth2 is redirecting off the page
// maybe it is possible to catch errors
document.querySelector('form#signIn').addEventListener('load', e => {
console.info('load, e', e, this);
});
});
}
logout(authData, authEventLogoutFn) {
const settings = this.settings;
const logouturl = `${settings.logoutUrl}?id_token_hint=${
authData.idToken
}&client_id=${
settings.oAuthData.client_id
}&post_logout_redirect_uri=${Helpers.prependOrigin(
settings.post_logout_redirect_uri
)}`;
authEventLogoutFn && authEventLogoutFn();
setTimeout(() => {
window.location.href = logouturl;
});
}
setTokenExpirationAction() {
const expirationCheckInterval = 5000;
this.expirationCheckIntervalInstance = setInterval(() => {
let authData = this.getAuthData();
if (!authData) {
return clearInterval(this.expirationCheckIntervalInstance);
}
const tokenExpirationDate =
(authData && authData.accessTokenExpirationDate) || 0;
const currentDate = new Date();
if (tokenExpirationDate - currentDate < expirationCheckInterval) {
clearInterval(this.expirationCheckIntervalInstance);
Luigi.auth().store.removeAuthData();
// TODO: check if valid (mock-auth requires it), post_logout_redirect_uri is an assumption, might not be available for all auth providers
const redirectUrl = `${
this.settings.logoutUrl
}?error=tokenExpired&post_logout_redirect_uri=${Helpers.prependOrigin(
this.settings.post_logout_redirect_uri
)}`;
Luigi.auth().handleAuthEvent(
'onAuthExpired',
this.settings,
undefined,
redirectUrl
);
}
}, expirationCheckInterval);
}
setTokenExpireSoonAction() {
const accessTokenExpiringNotificationTime =
this.settings.accessTokenExpiringNotificationTime * 1000;
const expirationCheckInterval =
this.settings.expirationCheckInterval * 1000;
let authData = this.getAuthData();
if (authData) {
this.expirationSoonCheckIntervalInstance = setInterval(() => {
const tokenExpirationDate =
(authData && authData.accessTokenExpirationDate) || 0;
const currentDate = new Date();
if (
tokenExpirationDate - currentDate.getTime() <
accessTokenExpiringNotificationTime
) {
Luigi.auth().handleAuthEvent('onAuthExpireSoon', this.settings);
clearInterval(this.expirationSoonCheckIntervalInstance);
}
}, expirationCheckInterval);
}
}
generateNonce() {
const validChars =
'0123456789ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvwxyz';
const crypto = window.crypto || window.msCrypto;
const random = Array.from(crypto.getRandomValues(new Uint8Array(20)));
return random.map(x => validChars[x % validChars.length]).join('');
}
unload() {
clearInterval(this.expirationCheckIntervalInstance);
clearInterval(this.expirationSoonCheckIntervalInstance);
}
}
| {
"pile_set_name": "Github"
} |
-- $Id: tpch03.sql 2657 2007-06-12 16:08:15Z rdempsey $
-- TPC-H/TPC-R Shipping Priority Query (Q3)
-- Functional Query Definition
-- Approved February 1998
define 1 = BUILDING
define 2 = 1995-03-15
select
l_orderkey,
sum(l_extendedprice * (1 - l_discount)) as revenue,
o_orderdate,
o_shippriority
from
customer,
orders,
lineitem
where
c_mktsegment = '&1'
and c_custkey = o_custkey
and l_orderkey = o_orderkey
and o_orderdate < date '&2'
and l_shipdate > date '&2'
group by
l_orderkey,
o_orderdate,
o_shippriority
order by
revenue desc,
o_orderdate;
| {
"pile_set_name": "Github"
} |
/**********************************************************************
* Copyright (c) 2013, 2014 Pieter Wuille *
* Distributed under the MIT software license, see the accompanying *
* file COPYING or http://www.opensource.org/licenses/mit-license.php.*
**********************************************************************/
#ifndef _SECP256K1_FIELD_REPR_
#define _SECP256K1_FIELD_REPR_
#include <stdint.h>
typedef struct {
/* X = sum(i=0..4, elem[i]*2^52) mod n */
uint64_t n[5];
#ifdef VERIFY
int magnitude;
int normalized;
#endif
} secp256k1_fe;
/* Unpacks a constant into a overlapping multi-limbed FE element. */
#define SECP256K1_FE_CONST_INNER(d7, d6, d5, d4, d3, d2, d1, d0) { \
(d0) | (((uint64_t)(d1) & 0xFFFFFUL) << 32), \
((uint64_t)(d1) >> 20) | (((uint64_t)(d2)) << 12) | (((uint64_t)(d3) & 0xFFUL) << 44), \
((uint64_t)(d3) >> 8) | (((uint64_t)(d4) & 0xFFFFFFFUL) << 24), \
((uint64_t)(d4) >> 28) | (((uint64_t)(d5)) << 4) | (((uint64_t)(d6) & 0xFFFFUL) << 36), \
((uint64_t)(d6) >> 16) | (((uint64_t)(d7)) << 16) \
}
#ifdef VERIFY
#define SECP256K1_FE_CONST(d7, d6, d5, d4, d3, d2, d1, d0) {SECP256K1_FE_CONST_INNER((d7), (d6), (d5), (d4), (d3), (d2), (d1), (d0)), 1, 1}
#else
#define SECP256K1_FE_CONST(d7, d6, d5, d4, d3, d2, d1, d0) {SECP256K1_FE_CONST_INNER((d7), (d6), (d5), (d4), (d3), (d2), (d1), (d0))}
#endif
typedef struct {
uint64_t n[4];
} secp256k1_fe_storage;
#define SECP256K1_FE_STORAGE_CONST(d7, d6, d5, d4, d3, d2, d1, d0) {{ \
(d0) | (((uint64_t)(d1)) << 32), \
(d2) | (((uint64_t)(d3)) << 32), \
(d4) | (((uint64_t)(d5)) << 32), \
(d6) | (((uint64_t)(d7)) << 32) \
}}
#endif
| {
"pile_set_name": "Github"
} |
'use strict';
module.exports = function(grunt) {
// Load grunt tasks automatically
require('load-grunt-tasks')(grunt);
// Time how long tasks take. Can help when optimizing build times
require('time-grunt')(grunt);
var config = require('./package.json');
// Define the configuration for all the tasks
grunt.initConfig({
// Load package config
pkg: config,
// Watches files for changes and runs tasks based on the changed files
watch: {
bower: {
files: ['bower.json'],
tasks: ['wiredep']
},
js: {
files: ['<%= pkg.src %>/gh-pages-src/app/**/*.js'],
tasks: ['newer:jshint:all'],
options: {
livereload: '<%= connect.options.livereload %>'
}
},
jsTest: {
files: ['<%= pkg.src %>/gh-pages-src/app/**/*.spec.js'],
tasks: ['newer:jshint:test', 'karma']
},
gruntfile: {
files: ['gruntfile.js']
},
livereload: {
options: {
livereload: '<%= connect.options.livereload %>'
},
files: [
'<%= pkg.src %>/gh-pages-src/**/*.html',
'<%= pkg.src %>/gh-pages-src/content/styles/{,*/}*.css',
'<%= pkg.src %>/gh-pages-src/content/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
]
}
},
// The actual grunt server settings
connect: {
options: {
port: 9000,
// Change this to '0.0.0.0' to access the server from outside.
hostname: 'localhost',
livereload: 35729
},
livereload: {
options: {
open: true,
middleware: function(connect) {
return [
connect.static('.tmp'),
connect().use(
'/bower_components',
connect.static('./<%= pkg.src %>/bower_components')
),
connect.static('./<%= pkg.src %>')
];
}
}
},
test: {
options: {
port: 9001,
middleware: function(connect) {
return [
connect.static('.tmp'),
connect.static('test'),
connect().use(
'/bower_components',
connect.static('./<%= pkg.src %>/bower_components')
),
connect.static('./<%= pkg.src %>')
];
}
}
},
debug: {
options: {
open: true,
base: '<%= pkg.src %>'
}
},
release: {
options: {
open: true,
base: '<%= pkg.output %>'
}
}
},
// Make sure code styles are up to par and there are no obvious mistakes
jshint: {
options: {
jshintrc: '.jshintrc',
reporter: require('jshint-stylish')
},
all: {
src: [
'gruntfile.js',
'<%= pkg.src %>/gh-pages-src/app/**/!(*spec).js'
]
},
test: {
options: {
jshintrc: '<%= pkg.test %>/.jshintrc'
},
src: ['<%= pkg.src %>/**/*.spec.js']
}
},
// Empties folders to start fresh
clean: {
release: {
files: [{
dot: true,
src: [
'.tmp',
'<%= pkg.output %>/{,*/}*',
'!<%= pkg.output %>/.git{,*/}*'
]
}]
},
server: '.tmp'
},
// Add vendor prefixed styles
autoprefixer: {
options: {
browsers: ['last 2 versions']
},
release: {
files: [{
expand: true,
cwd: '<%= pkg.output %>/content/styles/',
src: '{,*/}*.css',
dest: '<%= pkg.output %>/content/styles/'
}]
}
},
// Automatically inject Bower components into the app
wiredep: {
app: {
src: ['<%= pkg.src %>/index.html'],
ignorePath: /\.\.\//
},
test: {
devDependencies: true,
src: '<%= karma.unit.configFile %>',
ignorePath: /\.\.\//,
fileTypes: {
js: {
block: /(([\s\t]*)\/{2}\s*?bower:\s*?(\S*))(\n|\r|.)*?(\/{2}\s*endbower)/gi,
detect: {
js: /'(.*\.js)'/gi
},
replace: {
js: '\'{{filePath}}\','
}
}
}
}
},
// Renames files for browser caching purposes
filerev: {
release: {
src: [
'<%= pkg.output %>/content/scripts/{,*/}*.js',
'<%= pkg.output %>/content/styles/{,*/}*.css',
'<%= pkg.output %>/content/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
'<%= pkg.output %>/content/fonts/*',
'<%= pkg.output %>/content/json/*',
'<%= pkg.output %>/app/**/{,*/}*.html'
]
}
},
// Reads HTML for usemin blocks to enable smart builds that automatically
// concat, minify and revision files. Creates configurations in memory so
// additional tasks can operate on them
useminPrepare: {
html: '<%= pkg.src %>/index.html',
options: {
staging: '<%= pkg.output %>/src',
dest: '<%= pkg.output %>',
flow: {
html: {
steps: {
js: ['concat', 'uglifyjs'],
css: ['cssmin']
},
post: {}
}
}
}
},
// Performs rewrites based on filerev and the useminPrepare configuration
usemin: {
html: ['<%= pkg.output %>/**/*.html'],
css: ['<%= pkg.output %>/content/styles/{,*/}*.css'],
js: ['<%= pkg.output %>/**/scripts*.js'], // do not target vendor.js, target file name starts with "scripts."
json: ['<%= pkg.output %>/content/json/{,*/}*.json'],
options: {
assetsDirs: [
'<%= pkg.output %>',
'<%= pkg.output %>/content/images',
'<%= pkg.output %>/content/styles',
'<%= pkg.output %>/content/fonts',
'<%= pkg.output %>/content/json'
],
patterns: {
html: [
[
/["']([^:"']+\.(?:png|gif|jpg|jpeg|webp|svg))["']/img,
'Update HTML to reference revved images'
],
[
/([^:"']+\.(?:html))/gm,
'Update HTML to reference revved html files'
]
],
js: [
[
/["']([^:"']+\.(?:png|gif|jpg|jpeg|webp|svg))["']/img,
'Update JS to reference revved images'
],
[
/([^:"']+\.(?:html))/gm,
'Update JS to reference revved html files'
],
[
/([^:"']+\.(?:json))/gm,
'Update JS to reference revved json files'
]
],
json: [
[
/["']([^:"']+\.(?:png|gif|jpg|jpeg|webp|svg))["']/img,
'Update JSON to reference revved images'
]
]
}
}
},
concat: {
options: {
sourceMap: true
}
},
uglify: {
options: {
sourceMap: true,
compress: {},
mangle: true
}
},
imagemin: {
release: {
files: [{
expand: true,
cwd: '<%= pkg.src %>/gh-pages-src/content/images',
src: '{,*/}*.{png,jpg,jpeg,gif}',
dest: '<%= pkg.output %>/content/images'
}]
}
},
svgmin: {
release: {
files: [{
expand: true,
cwd: '<%= pkg.src %>/gh-pages-src/content/images',
src: '{,*/}*.svg',
dest: '<%= pkg.output %>/content/images'
}]
}
},
htmlmin: {
release: {
options: {
collapseWhitespace: false,
conservativeCollapse: true,
collapseBooleanAttributes: true,
removeCommentsFromCDATA: true,
removeOptionalTags: true,
removeComments: true
},
files: [{
expand: true,
cwd: '<%= pkg.output %>',
src: ['*.html', '**/*.html'],
dest: '<%= pkg.output %>'
}]
}
},
// ng-annotate tries to make the code safe for minification automatically
// by using the Angular long form for dependency injection.
ngAnnotate: {
release: {
files: [{
expand: true,
cwd: '.tmp/concat/scripts',
src: ['*.js', '!oldieshim.js'],
dest: '.tmp/concat/scripts'
}]
}
},
// replace variables in app code, matched variables should start with '@@'
replace: {
release: {
options: {
patterns: [{
match: 'version',
replacement: config.version
}, {
match: 'year',
replacement: grunt.template.today('yyyy')
}, {
match: 'debug',
replacement: 'false'
}]
},
files: [{
expand: true,
src: [
'<%= pkg.output %>/*.html',
'<%= pkg.output %>/gh-pages-src/app/**/*.html',
'<%= pkg.output %>/content/**/*.js'
]
}]
}
},
// Copies remaining files to places other tasks can use
copy: {
release: {
files: [{
expand: true,
dot: true,
cwd: '<%= pkg.src %>',
dest: '<%= pkg.output %>',
src: [
'*.{ico,png,txt,ini,xml}',
'.htaccess',
'*.html',
'gh-pages-src/app/**/{,*/}*.html',
'gh-pages-src/app/**/{,*/}*.json',
'gh-pages-src/app/**/{,*/}*.csv',
'gh-pages-src/content/images/{,*/}*.{png,jpg,jpeg,gif,webp}',
'gh-pages-src/content/fonts/*.*',
'gh-pages-src/content/json/*.*',
'gh-pages-src/vendor/**/{,*/}*.png',
'gh-pages-src/vendor/**/{,*/}*.swf'
]
}, {
expand: true,
dot: true,
flatten: true,
cwd: '<%= pkg.src %>/src/images',
dest: '<%= pkg.output %>/content/styles/images',
src: ['{,*/}*.{png,jpg,jpeg,gif,webp,cur}']
}, {
expand: true,
dot: true,
flatten: true,
cwd: '<%= pkg.src %>/bower_components',
dest: '<%= pkg.output %>/content/fonts',
src: ['**/dist/fonts/*.*']
}]
}
},
// Run some tasks in parallel to speed up the build process
concurrent: {
server: [],
test: [],
release: [
'imagemin',
'svgmin'
]
},
// Test settings
karma: {
unit: {
configFile: '<%= pkg.test %>/karma.conf.js',
singleRun: true
}
}
});
/**
* TASKS
* ------------------------------------------------------------------------------------------------------
*/
var configurations = {
debug: 'debug',
release: 'release'
};
grunt.registerTask('build', 'Build Project for Configuration', function(config) {
// Argument Validation
if (config == null || (config !== configurations.debug && config !== configurations.release)) {
grunt.log.warn('"grunt build:config": `config` is required and must be set to `debug` or `release`.');
return;
}
grunt.task.run([
'wiredep', // inject bower packages into html
//'ngconstant:' + tier // create 'app.constants' module with ENV variable
]);
if (config === configurations.release) {
grunt.task.run([
'clean:release', // clear out .tmp/ and release/ folders
'useminPrepare', // congifure usemin, targets <!-- build --> blocks in HTML
'concurrent:release', // start concurrent dist tasks (imgmin, svgmin)
'concat', // concatenate JS into new files in '.tmp'
'cssmin', // concatenate and minify CSS into new 'release' files
'uglify', // minify JS files from '.tmp' and copy to 'release'
'copy:release', // copy all remaining files to 'release' (e.g. HTML, Fonts, .htaccess, etc.)
'replace:release', // replace variables, e.g. '@@foo' with 'bar'
'filerev', // rename CSS, JS and Font files with unique hashes
'usemin', // update references in HTML with new minified, rev-ed files
'htmlmin' // minify HTML markup,
]);
}
});
grunt.registerTask('serve', 'Compile then start and connect web server', function(config) {
// Defaults
config = config || configurations.debug;
// Argument Validation
if (config !== configurations.debug && config !== configurations.release) {
grunt.log.warn('"grunt serve:config:tier": `config` is required and must be set to `debug` or `release`.');
return;
}
var tasks = [
'build:' + config
];
if (config === configurations.release) {
grunt.task.run(tasks.concat([
'connect:release:keepalive'
]));
return;
}
grunt.task.run(tasks.concat([
'clean:server',
'concurrent:server',
'connect:debug:livereload',
'watch'
]));
});
grunt.registerTask('test', [
'concurrent:test',
'newer:jshint:test',
'karma'
]);
grunt.registerTask('default', [
'newer:jshint',
'test',
'build:debug'
]);
};
| {
"pile_set_name": "Github"
} |
<?php
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
add_action( 'admin_init', 'ampforwp_welcome_screen_do_activation_redirect' );
function ampforwp_welcome_screen_do_activation_redirect() {
// Bail if no activation redirect
if ( ! get_transient( 'ampforwp_welcome_screen_activation_redirect' ) ) {
return;
}
// Delete the redirect transient
delete_transient( 'ampforwp_welcome_screen_activation_redirect' );
// Bail if activating from network, or bulk
if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
return;
}
// Redirect to welcome page
wp_safe_redirect( esc_url( add_query_arg( array( 'page' => 'amp_options&tab=1' ), admin_url( 'admin.php' ) ) ) );
exit();
}
function ampforwp_welcome_screen_content() {
?>
<div class="wrap">
<div class="clear"></div>
<div class="ampforwp-post-installtion-instructions">
<h1 class="amp_installed_heading"><?php echo esc_html__('AMP is now Installed!','accelerated-mobile-pages') ?></h1>
<div class="amp_installed_text"><p><?php echo esc_html__('Thank you so much for installing the AMPforWP plugin!','accelerated-mobile-pages') ?></p>
<p><?php echo esc_html__('Our team works really hard to deliver good user experience to you.','accelerated-mobile-pages') ?></p></div>
<div class="getstarted_wrapper">
<div class="amp_user_onboarding">
<?php if(!get_theme_support('amp-template-mode')){ ?>
<div class="amp_new_user amp_user_onboarding_choose">
<div class="amp_user_avatar"></div>
<h3><?php echo esc_html__("I'm a New User!","accelerated-mobile-pages") ?></h3>
<p><?php echo esc_html__("We have recommend you to go through AMP installation wizard which helps setup the Basic AMP and get started immediatly.","accelerated-mobile-pages") ?></p>
<a href="<?php echo esc_url(wp_nonce_url(admin_url('plugins.php?page=ampforwptourinstaller&forwp_install=1'), '_wpnonce'));?>"><?php echo esc_html__("Run Installation Wizard","accelerated-mobile-pages") ?></a>
</div>
<?php } ?>
<div class="amp_expert_user amp_user_onboarding_choose">
<div class="amp_user_avatar"></div>
<h3><?php echo esc_html__("I'm an Experienced User!","accelerated-mobile-pages") ?></h3>
<p><?php echo esc_html__("We have many settings in Options Panel to help you setup the AMP perfectly to according to your taste & needs.","accelerated-mobile-pages") ?></p>
<a href="<?php echo esc_url(admin_url('admin.php?tabid=opt-text-subsection&page=amp_options'));?>"><?php echo esc_html__("AMP Options Panel","accelerated-mobile-pages") ?></a>
</div>
<div class="clear"></div>
</div>
</div>
<div style="float:right; height: 640px;overflow:auto;">
<?php if(!get_theme_support('amp-template-mode')){ ?>
<div class="amp_expert_user amp_user_onboarding_choose">
<!--<div class="amp_user_avatar"></div>-->
<!--<h3>Change log</h3>-->
<?php require AMPFORWP_PLUGIN_DIR.'includes/change-log.php';?>
</div>
<?php } ?>
</div>
<div class="getstarted_wrapper nh-b">
<h1 style="color: #008606;font-weight: 300;margin-top: 35px;">
<i class="dashicons dashicons-editor-help" style="font-size: 34px;margin-right: 18px;margin-top: -1px;"></i><?php echo esc_html__('Need Help?','accelerated-mobile-pages') ?>
</h1>
<div class="amp_installed_text"><p><?php echo esc_html__('We\'re bunch of passionate people that are dedicated towards helping our users. We will be happy to help you!','accelerated-mobile-pages') ?></p></div>
<?php if(!get_theme_support('amp-template-mode')){ ?>
<div class="getstarted_options">
<p><b><?php echo esc_html__("Getting Started","accelerated-mobile-pages") ?></b></p>
<ul class="getstarted_ul">
<li><a href="https://ampforwp.com/tutorials/article-categories/installation-updating/" target="_blank"><?php echo esc_html__("Installation & Setup","accelerated-mobile-pages") ?></a></li>
<li><a href="https://ampforwp.com/tutorials/article-categories/settings-options/" target="_blank"><?php echo esc_html__("Settings & Options","accelerated-mobile-pages") ?></a></li>
<li><a href="https://ampforwp.com/tutorials/article-categories/setup-amp/" target="_blank"><?php echo esc_html__("Setup AMP","accelerated-mobile-pages") ?></a></li>
<li><a href="https://ampforwp.com/tutorials/article-categories/page-builder/" target="_blank"><?php echo esc_html__("Page Builder","accelerated-mobile-pages") ?></a></li>
</ul>
</div>
<div class="getstarted_options">
<p><b><?php echo esc_html__("Useful Links","accelerated-mobile-pages") ?></b></p>
<ul class="getstarted_ul">
<li><a href="https://ampforwp.com/tutorials/article-categories/extension/" target="_blank"><?php echo esc_html__("Extensions & Themes Docs","accelerated-mobile-pages") ?></a></li>
<li><a href="https://ampforwp.com/tutorials/article-categories/extending/" target="_blank"><?php echo esc_html__("Developers Docs","accelerated-mobile-pages") ?></a></li>
<li><a href="https://ampforwp.com/amp-theme-framework/" target="_blank"><?php echo esc_html__("Create a Custom Theme for AMP","accelerated-mobile-pages") ?></a></li>
<li><a href="https://ampforwp.com/tutorials/article-categories/how-to/" target="_blank"><?php echo esc_html__("General How To's","accelerated-mobile-pages") ?></a></li>
</ul>
</div>
<?php } ?>
<div class="clear"></div>
</div>
</div>
</div> <?php
}
add_action('admin_footer','ampforwp_add_welcome_styling');
function ampforwp_add_welcome_styling(){
$current = "";
$current = get_current_screen();
if(!is_object($current)){
return ;
}
if ( 'amp_page_ampforwp-welcome-page' == $current->base || 'toplevel_page_amp_options' == $current->base ) {
?>
<style>
.getstarted_wrapper{ display: inline-block; margin: 0px 0px 5px 0px; }
.nh-b{display:block;}
.getstarted_options{float: left; margin-right: 15px;
background: #fff; border: 1px solid #ddd; padding: 5px 25px 10px 23px; border-radius: 2px;}
.getstarted_links{float: right; background: #fff; border: 1px solid #ddd; padding: 10px 30px 10px 30px; border-radius: 2px; }
.ampforwp-post-installtion-instructions, .ampforwp-pre-installtion-instructions{ margin-left: 15px;margin-top: 15px;}
.getstarted_ul li{ list-style-type: decimal;
list-style-position: inside;
line-height: 23px;
font-size: 15px; }
.getstarted_options p {
font-size: 16px;
margin-top: 13px;
margin-bottom: 10px;
color: #333;
}
.getstarted_ul a {
text-decoration: none;
color: #ed1c26;
}
.getstarted_ul a:hover {
text-decoration: underline;
color: #222
}
.getstarted_ul {
margin-top: 6px;
}
a.getstarted_btn{
background: #666;
color: #fff;
padding: 9px 35px 9px 35px;
font-size: 13px;
line-height: 1;
text-decoration: none;
margin-top: 8px;
display: inline-block;}
.dashicons-warning, .dashicons-yes{
font-family: dashicons;
font-style: normal;
position: relative;
top: 1px;
font-size: 32px;
margin-right: 18px;
}
.dashicons-yes{
margin-right: 25px;
}
.dashicons-yes:before {
content: "\f147";
background: #388e3c;
color: #fff;
border-radius: 40px;
padding-right: 3px;
padding-top: 1px;
}
.ampforwp-plugin-action-buttons {
text-align:right;
margin-top: 0;
}
.ampforwp-plugin-action-buttons li {
display: inline-block;
margin-left: 1em;
}
.ampforwp-button-con {
padding-right: 15px;
}
.ampforwp-button-install {
background: none repeat scroll 0% 0% #2EA2CC !important;
border-color: #0074A2 !important;
box-shadow: 0px 1px 0px rgba(120, 200, 230, 0.5) inset, 0px 1px 0px rgba(0, 0, 0, 0.15) !important;
color: #FFF !important;
}
.ampforwp-button-install:focus {
box-shadow: 0px 0px 0px 1px #5B9DD9, 0px 0px 2px 1px rgba(30, 140, 190, 0.8) !important;
}
.ampforwp-button-install:hover {
color: #FFF !important;
background: none repeat scroll 0% 0% #5B9DD9 !important;
}
.ampforwp-button-update {
background: none repeat scroll 0% 0% #E74F34 !important;
border-color: #C52F2F !important;
box-shadow: 0px 1px 0px rgba(255, 235, 235, 0.5) inset, 0px 1px 0px rgba(0, 0, 0, 0.15) !important;
color: #FFF !important;
}
.ampforwp-button-update:focus {
box-shadow: 0px 0px 0px 1px #DA3232, 0px 0px 2px 1px rgba(255, 140, 140, 0.8) !important;
}
.ampforwp-button-update:hover {
color: #FFF !important;
background: none repeat scroll 0% 0% #DA3232 !important;
}
.drop-shadow {
position:relative;
background:#fff;
margin-bottom:40px;
}
.drop-shadow:before,
.drop-shadow:after {
content:"";
position:absolute;
z-index:-2;
} .authors{font-style: italic}
.ampforwp-custom-btn a{ font-size: 18px !important; background: #388E3C !important; border: 0px !important; border-radius: 2px !important; box-shadow: none !important; padding: 8px 20px !important; height: auto !important}
.plugin-card-top h4{margin-top: 10px;}
/*User Onboarding start*/
.amp_user_onboarding_choose {
float: left;
text-align: center;
max-width: 260px;
background: #fff;
padding: 25px 20px 25px 20px;
border-radius: 5px;
margin-right: 20px;
box-shadow: 1px 1px 5px rgba(221, 221, 221, 0.75);
transition: 0.25s all;
}
.amp_user_onboarding_choose ul{
border-bottom: 1px solid #eee;
padding-bottom: 10px;
}
.amp_user_onboarding_choose ul li{
text-align:left;
margin-bottom: 10px;
}
.amp_user_onboarding_choose:hover{
box-shadow: 1px 1px 10px rgba(212, 212, 212, 1);
}
.amp_user_onboarding_choose a {
background: #fff;
border: 1px solid #ed1c25;
color: #ed1c25;
text-decoration: none;
padding: 8px 15px;
margin-top: 5px;
font-weight: 500;
display: inline-block;
font-size: 14px;
border-radius: 30px;
transition: 0.2s all;
box-shadow: none;
}
.amp_user_onboarding_choose:hover a{
background: #ed1c25;
color: #fff;
}
.amp_user_onboarding_choose h3 {
font-size: 18px;
font-weight: 600;
}
.amp_new_user .amp_user_avatar{
background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/PjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIgdmlld0JveD0iMCAwIDUxMi4wMDIgNTEyLjAwMiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNTEyLjAwMiA1MTIuMDAyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggc3R5bGU9ImZpbGw6I0RGRTRFODsiIGQ9Ik00NTYuMTE3LDI1Ni4wMDFjMC0yLjM2MS0wLjA0NS00LjcxNS0wLjEzMS03LjA2Yy0wLjA4NS0yLjMyOSwxLjQ3My00LjM5OSwzLjcyMy01LjAwM2w0MS4wMTUtMTAuOTkxYzIuNjgzLTAuNzE5LDQuMjc2LTMuNDc3LDMuNTU3LTYuMTZsLTE4LjY1NC02OS42MjhjLTAuNzE5LTIuNjgzLTMuNDc2LTQuMjc2LTYuMTYtMy41NTdsLTQwLjk5MiwxMC45NzZjLTIuMjUyLDAuNjAzLTQuNjMtMC40MTgtNS43MjYtMi40NzZjLTQuOTYyLTkuMzIzLTEwLjYzNy0xOC4yMTEtMTYuOTYxLTI2LjU4M2MtMS40MDgtMS44NjMtMS4zMy00LjQ1NCwwLjE3MS02LjI0M2wyNy4yODgtMzIuNTI3YzEuNzg1LTIuMTI4LDEuNTA4LTUuMy0wLjYyLTcuMDg2bC01NS4yMi00Ni4zMzljLTIuMTI4LTEuNzg2LTUuMzAxLTEuNTA4LTcuMDg3LDAuNjJsLTI3LjI3NiwzMi41MDVjLTEuNDk5LDEuNzg2LTQuMDM1LDIuMzE5LTYuMTExLDEuMjU4Yy0xNC40MDktNy4zNjUtMjkuODI1LTEzLjAzLTQ1Ljk4Ny0xNi43MzljLTIuMjcyLTAuNTIxLTMuODctMi41NjEtMy44Ny00Ljg5MlYxMy42NTJjMC0yLjc3OC0yLjI1Mi01LjAzLTUuMDMtNS4wM2gtNzIuMDkxYy0yLjc3OCwwLTUuMDMsMi4yNTItNS4wMyw1LjAzdjQyLjQyNGMwLDIuMzM1LTEuNjA2LDQuMzcxLTMuODgzLDQuODkzYy0xMC4zNTksMi4zNzQtMjAuNDEzLDUuNTYtMzAuMDg2LDkuNDc1Yy0yLjE2NCwwLjg3Ni00LjY0NSwwLjEzMS01Ljk4NC0xLjc4MmwtMjQuMzM0LTM0Ljc0NGMtMS41OTQtMi4yNzUtNC43My0yLjgyOC03LjAwNS0xLjIzNUw4NC41ODEsNzQuMDM1Yy0yLjI3NiwxLjU5My0yLjgyOSw0LjczLTEuMjM1LDcuMDA2bDI0LjM2MiwzNC43OWMxLjMzNCwxLjkwNSwxLjIwNSw0LjQ5MS0wLjM1Miw2LjIxN2MtNy4wNDIsNy44MDgtMTMuNDc3LDE2LjE3My0xOS4yMzIsMjUuMDE4Yy0xLjI3MSwxLjk1NC0zLjcyOSwyLjc2Mi01LjkxOSwxLjk2NUw0Mi4zMSwxMzQuNTE0Yy0yLjYxLTAuOTUtNS40OTcsMC4zOTYtNi40NDcsMy4wMDZsLTI0LjY1Nyw2Ny43MzljLTAuOTUsMi42MSwwLjM5Niw1LjQ5NywzLjAwNiw2LjQ0N2wzOS45MDEsMTQuNTI0YzIuMTg5LDAuNzk3LDMuNTU2LDIuOTkzLDMuMjczLDUuMzA1Yy0wLjk4Myw4LjAxOS0xLjUwMywxNi4xODItMS41MDMsMjQuNDY1YzAsMi4zNjEsMC4wNDUsNC43MTUsMC4xMzEsNy4wNmMwLjA4NSwyLjMyOS0xLjQ3Myw0LjM5OS0zLjcyMyw1LjAwM2wtNDEuMDE1LDEwLjk5MWMtMi42ODMsMC43MTktNC4yNzYsMy40NzctMy41NTcsNi4xNmwxOC42NTQsNjkuNjI4YzAuNzE5LDIuNjgzLDMuNDc2LDQuMjc2LDYuMTYsMy41NTdsNDAuOTkyLTEwLjk3NmMyLjI1Mi0wLjYwMyw0LjYzLDAuNDE4LDUuNzI2LDIuNDc2YzQuOTYyLDkuMzIzLDEwLjYzNywxOC4yMTEsMTYuOTYxLDI2LjU4M2MxLjQwOCwxLjg2MywxLjMzLDQuNDU0LTAuMTcxLDYuMjQzbC0yNy4yODgsMzIuNTI3Yy0xLjc4NSwyLjEyOC0xLjUwOCw1LjMsMC42Miw3LjA4Nmw1NS4yMiw0Ni4zMzljMi4xMjgsMS43ODYsNS4zMDEsMS41MDgsNy4wODctMC42MmwyNy4yNzYtMzIuNTA1YzEuNDk5LTEuNzg2LDQuMDM1LTIuMzE5LDYuMTExLTEuMjU4YzE0LjQwOSw3LjM2NSwyOS44MjUsMTMuMDMsNDUuOTg3LDE2LjczOWMyLjI3MiwwLjUyMSwzLjg3LDIuNTYxLDMuODcsNC44OTJ2NDIuNDI0YzAsMi43NzgsMi4yNTIsNS4wMyw1LjAzLDUuMDNoNzIuMDkxYzIuNzc4LDAsNS4wMy0yLjI1Miw1LjAzLTUuMDN2LTQyLjQyNGMwLTIuMzM1LDEuNjA2LTQuMzcxLDMuODgzLTQuODkzYzEwLjM1OS0yLjM3NCwyMC40MTMtNS41NiwzMC4wODYtOS40NzVjMi4xNjQtMC44NzYsNC42NDUtMC4xMzEsNS45ODQsMS43ODJsMjQuMzM0LDM0Ljc0NGMxLjU5NCwyLjI3NSw0LjczLDIuODI4LDcuMDA1LDEuMjM1bDU5LjA1Mi00MS4zNTFjMi4yNzYtMS41OTQsMi44MjktNC43MywxLjIzNS03LjAwNmwtMjQuMzYyLTM0Ljc5Yy0xLjMzNC0xLjkwNS0xLjIwNS00LjQ5MSwwLjM1Mi02LjIxN2M3LjA0Mi03LjgwOCwxMy40NzctMTYuMTczLDE5LjIzMi0yNS4wMThjMS4yNzEtMS45NTQsMy43MjktMi43NjIsNS45MTktMS45NjVsMzkuODk0LDE0LjUxN2MyLjYxLDAuOTUsNS40OTctMC4zOTYsNi40NDctMy4wMDZsMjQuNjU3LTY3LjczOWMwLjk1LTIuNjEtMC4zOTYtNS40OTctMy4wMDYtNi40NDdsLTM5LjkwMS0xNC41MjRjLTIuMTg5LTAuNzk3LTMuNTU2LTIuOTkzLTMuMjczLTUuMzA1QzQ1NS41OTYsMjcyLjQ0Nyw0NTYuMTE3LDI2NC4yODMsNDU2LjExNywyNTYuMDAxeiBNMjU3LjExMywzODMuNTY5Yy03MS4zMzMsMC42MDgtMTI5LjI4OS01Ny4zNDgtMTI4LjY4MS0xMjguNjgxYzAuNTgyLTY4LjE4Miw1OC4yNzQtMTI1Ljg3NCwxMjYuNDU1LTEyNi40NTVjNzEuMzMzLTAuNjA4LDEyOS4yODksNTcuMzQ4LDEyOC42ODEsMTI4LjY4MUMzODIuOTg2LDMyNS4yOTYsMzI1LjI5NCwzODIuOTg4LDI1Ny4xMTMsMzgzLjU2OXoiLz48cGF0aCBzdHlsZT0iZmlsbDojQzRDQ0NFOyIgZD0iTTQ2NS44OSwyNDIuNDk4bDQyLjI2LTExLjMyYzIuNzctMC43NCw0LjQxLTMuNTksMy42Ny02LjM1bC0xOS4yMi03MS43NGMtMC43NC0yLjc3LTMuNTgtNC40MS02LjM1LTMuNjdsLTQxLjY0LDExLjE1YzIuOTYsMTQuMzgsNC41MSwyOS4yNiw0LjUxLDQ0LjUxYzAsMTIxLjQ0LTk4LjQ0LDIxOS44Ny0yMTkuODcsMjE5Ljg3Yy01NC41MiwwLTEwNC40Mi0xOS44NS0xNDIuODQtNTIuNzNjMS42LDIuMzIsMy4yNSw0LjYsNC45NSw2Ljg1YzEuNDUsMS45MiwxLjM3LDQuNTktMC4xOCw2LjQzbC0yOC4xMSwzMy41MmMtMS44NCwyLjE5LTEuNTYsNS40NiwwLjY0LDcuM2w1Ni44OSw0Ny43NWMyLjIsMS44NCw1LjQ2LDEuNTUsNy4zLTAuNjRsMjguMTEtMzMuNWMxLjU0LTEuODQsNC4xNi0yLjM4LDYuMy0xLjI5YzE0Ljg0LDcuNTksMzAuNzMsMTMuNDIsNDcuMzgsMTcuMjVjMi4zNCwwLjUzLDMuOTksMi42MywzLjk5LDUuMDR2NDMuNzFjMCwyLjg2LDIuMzIsNS4xOCw1LjE4LDUuMThoNzQuMjhjMi44NiwwLDUuMTgtMi4zMiw1LjE4LTUuMTh2LTQzLjcxYzAtMi40MSwxLjY2LTQuNTEsNC01LjA1YzEwLjY4LTIuNDQsMjEuMDQtNS43MiwzMS05Ljc2YzIuMjMtMC45LDQuNzktMC4xMyw2LjE3LDEuODRsMjUuMDcsMzUuOGMxLjY0LDIuMzQsNC44NywyLjkxLDcuMjIsMS4yN2w2MC44NC00Mi42MWMyLjM1LTEuNjQsMi45Mi00Ljg3LDEuMjgtNy4yMmwtMjUuMTEtMzUuODRjLTEuMzctMS45Ny0xLjI0LTQuNjMsMC4zNy02LjQxYzcuMjUtOC4wNCwxMy44OC0xNi42NiwxOS44MS0yNS43OGMxLjMxLTIuMDEsMy44NS0yLjg0LDYuMS0yLjAybDQxLjExLDE0Ljk2YzIuNjksMC45Nyw1LjY2LTAuNDEsNi42NC0zLjFsMjUuNDEtNjkuOGMwLjk3LTIuNjktMC40MS01LjY2LTMuMS02LjY0bC00MS4xMS0xNC45N2MtMi4yNi0wLjgyLTMuNjctMy4wOC0zLjM4LTUuNDZjMS4wMi04LjI2LDEuNTUtMTYuNjgsMS41NS0yNS4yMWMwLTIuNDMtMC4wNC00Ljg2LTAuMTMtNy4yN0M0NjEuOTcsMjQ1LjI1OCw0NjMuNTcsMjQzLjExOCw0NjUuODksMjQyLjQ5OHoiLz48Zz48cGF0aCBzdHlsZT0iZmlsbDojMDAwMTAwOyIgZD0iTTI5Mi4wNDYsNTEwLjkyOGgtNzIuMDkxYy02LjkzNCwwLTEyLjU3NS01LjY0MS0xMi41NzUtMTIuNTc1di00MC40MjdjLTE1LjE3Ny0zLjY0Mi0yOS45MzUtOS4wMTUtNDMuOTI2LTE1Ljk5MWwtMjUuOTg5LDMwLjk3MmMtMi4xNTksMi41NzMtNS4xOTEsNC4xNTEtOC41MzcsNC40NDRjLTMuMzQ0LDAuMjk0LTYuNjA2LTAuNzM1LTkuMTc5LTIuODk0bC04LjY4Mi03LjI4NGMtMy4xOTItMi42NzktMy42MDgtNy40MzgtMC45My0xMC42M2MyLjY3OC0zLjE5Myw3LjQzNy0zLjYwOSwxMC42My0wLjkzbDYuNzU1LDUuNjY4bDI1LjY1NS0zMC41NzRjMy43OS00LjUxNiwxMC4wOTItNS44MDEsMTUuMzI1LTMuMTI2YzE0LjAyOCw3LjE2OCwyOC45MTMsMTIuNTg3LDQ0LjI0LDE2LjEwNWM1LjcyOCwxLjMxNSw5LjcyOCw2LjM1MSw5LjcyOCwxMi4yNDZ2MzkuOTA4aDY3LjA2MXYtMzkuOTFjMC01Ljg5NSw0LjAwNC0xMC45MzEsOS43MzgtMTIuMjQ3YzkuODQyLTIuMjU5LDE5LjU4LTUuMzI3LDI4Ljk0Ni05LjExOWM1LjQ1Mi0yLjIwNSwxMS42MTctMC4zNzgsMTQuOTk2LDQuNDQ4bDIyLjg4NywzMi42ODZsNTQuOTMzLTM4LjQ2NWwtMjIuOTE3LTMyLjcyOGMtMy4zOC00LjgzLTIuOTk3LTExLjI0MywwLjkyOS0xNS41OThjNi43NzQtNy41MTIsMTMtMTUuNjE1LDE4LjUwNi0yNC4wODJjMy4yLTQuOTIzLDkuMjk5LTYuOTU3LDE0LjgyNi00Ljk0M2wzNy41MjgsMTMuNjU5bDIyLjkzNi02My4wMTdsLTM3LjUzMS0xMy42NmMtNS41MzEtMi4wMTMtOC44OTUtNy40ODctOC4xODItMTMuMzExYzAuOTU1LTcuODA3LDEuNDM5LTE1LjczMSwxLjQzOS0yMy41NDljMC0yLjIxNy0wLjA0MS00LjUwMi0wLjEyMy02Ljc5MWMtMC4yMDktNS44NjgsMy42Mi0xMS4wMzIsOS4zMTItMTIuNTU3bDM4LjU4Ni0xMC4zMzlsLTE3LjM1Ni02NC43NzZsLTM4LjU1NSwxMC4zM2MtNS42ODQsMS41MjItMTEuNTgtMS4wMzUtMTQuMzQtNi4yMThjLTQuNzQ3LTguOTIxLTEwLjI0LTE3LjUzLTE2LjMyNi0yNS41OWMtMy41NDQtNC42OTUtMy4zNzQtMTEuMTI2LDAuNDEzLTE1LjYzOWwyNS42NzEtMzAuNTkzbC01MS4zNzItNDMuMTA2TDM1OC44Miw4MS4yOTljLTMuNzksNC41MTYtMTAuMDkyLDUuODAxLTE1LjMyNSwzLjEyNmMtMTQuMDI4LTcuMTY4LTI4LjkxMy0xMi41ODctNDQuMjQtMTYuMTA1Yy01LjcyOC0xLjMxNS05LjcyOC02LjM1MS05LjcyOC0xMi4yNDZ2LTM5LjkxaC02Ny4wNjF2MzkuOTFjMCw1Ljg5NS00LjAwNCwxMC45MzEtOS43MzgsMTIuMjQ3Yy05Ljg0MiwyLjI1OS0xOS41OCw1LjMyNy0yOC45NDYsOS4xMTljLTUuNDUyLDIuMjA2LTExLjYxNywwLjM3OC0xNC45OTYtNC40NDhsLTIyLjg4Ny0zMi42ODZMOTAuOTY4LDc4Ljc3bDIyLjkxNywzMi43MjhjMy4zOCw0LjgzLDIuOTk3LDExLjI0My0wLjkyOSwxNS41OThjLTYuNzc0LDcuNTEyLTEzLDE1LjYxNS0xOC41MDYsMjQuMDgyYy0zLjIsNC45MjMtOS4yOTksNi45NTctMTQuODI2LDQuOTQzbC0zNy41MjgtMTMuNjU5bC0yMi45MzcsNjMuMDE5bDM3LjUzMSwxMy42NmM1LjUzMSwyLjAxNCw4Ljg5NCw3LjQ4Nyw4LjE4MiwxMy4zMTFjLTAuOTU1LDcuODA3LTEuNDM5LDE1LjczMS0xLjQzOSwyMy41NDljMCwyLjIxNywwLjA0MSw0LjUwMiwwLjEyMyw2Ljc5MWMwLjIwOSw1Ljg2OC0zLjYyLDExLjAzMi05LjMxMiwxMi41NTdsLTM4LjU4NiwxMC4zMzlsMTcuMzU2LDY0Ljc3NmwzOC41NTUtMTAuMzNjNS42ODMtMS41MjMsMTEuNTc5LDEuMDM1LDE0LjM0LDYuMjE4YzQuNzQ3LDguOTIxLDEwLjI0LDE3LjUzLDE2LjMyNiwyNS41OWMzLjU0NCw0LjY5NSwzLjM3NCwxMS4xMjYtMC40MTMsMTUuNjM5TDc2LjE1LDQxOC4xNzNsNC40NDIsMy43MjhjMy4xOTIsMi42NzgsMy42MDgsNy40MzgsMC45MywxMC42MjljLTIuNjc5LDMuMTkyLTcuNDM4LDMuNjA4LTEwLjYyOSwwLjkzbC02LjM2OS01LjM0NGMtMi41NzMtMi4xNTgtNC4xNTItNS4xOS00LjQ0NS04LjUzNnMwLjczNS02LjYwNiwyLjg5NC05LjE3OWwyNi4wMDQtMzAuOTljLTUuNjc4LTcuNjc3LTEwLjg1OS0xNS43OTYtMTUuNDMtMjQuMTg1bC0zOS4wNTgsMTAuNDY1Yy0zLjI0NCwwLjg2OS02LjYzMiwwLjQyMy05LjU0Mi0xLjI1NmMtMi45MDktMS42NzktNC45ODktNC4zOTEtNS44NTktNy42MzVMMC40MywyODcuMTYzYy0xLjc5NC02LjY5NywyLjE5NC0xMy42MDYsOC44OTEtMTUuNDAxbDM5LjA5MS0xMC40NzRjLTAuMDQ2LTEuNzgyLTAuMDctMy41NTItMC4wNy01LjI4N2MwLTcuNzU1LDAuNDQyLTE1LjYwNCwxLjMxNC0yMy4zNjJsLTM4LjAyMS0xMy44MzhjLTMuMTU3LTEuMTQ4LTUuNjc3LTMuNDU4LTcuMDk3LTYuNTAyYy0xLjQyLTMuMDQ1LTEuNTY4LTYuNDYtMC40MTktOS42MTdsMjQuNjU2LTY3Ljc0MmMxLjE0OC0zLjE1NiwzLjQ1OC01LjY3Nyw2LjUwMi03LjA5NmMzLjA0NC0xLjQyMSw2LjQ1OC0xLjU3LDkuNjE2LTAuNDJsMzguMDE5LDEzLjgzOGM1LjI3OS03Ljk0NywxMS4xNDQtMTUuNTgsMTcuNDctMjIuNzM4TDc3LjE2NSw4NS4zNjVjLTEuOTI3LTIuNzUxLTIuNjY3LTYuMDg4LTIuMDgzLTkuMzk3YzAuNTg0LTMuMzA4LDIuNDItNi4xOSw1LjE3Mi04LjExN2w1OS4wNTQtNDEuMzVjNS42ODEtMy45NzYsMTMuNTM4LTIuNTkxLDE3LjUxNCwzLjA4OGwyMy4xODQsMzMuMTFjOC44OTUtMy40OTgsMTguMDg2LTYuMzk0LDI3LjM3NS04LjYyNFYxMy42NDljMC02LjkzNCw1LjY0MS0xMi41NzUsMTIuNTc1LTEyLjU3NWg3Mi4wOTFjNi45MzQsMCwxMi41NzUsNS42NDEsMTIuNTc1LDEyLjU3NXY0MC40MjdjMTUuMTc3LDMuNjQyLDI5LjkzNSw5LjAxNSw0My45MjYsMTUuOTkxbDI1Ljk4OS0zMC45NzJjMi4xNTktMi41NzMsNS4xOTEtNC4xNTEsOC41MzctNC40NDRjMy4zNDktMC4yOTQsNi42MDYsMC43MzUsOS4xNzksMi44OTRsNTUuMjI1LDQ2LjM0YzIuNTczLDIuMTU4LDQuMTUyLDUuMTksNC40NDUsOC41MzZzLTAuNzM1LDYuNjA2LTIuODk0LDkuMTc5bC0yNi4wMDQsMzAuOTljNS42NzgsNy42NzcsMTAuODU5LDE1Ljc5NiwxNS40MywyNC4xODVsMzkuMDU4LTEwLjQ2NWMzLjI0My0wLjg2OSw2LjYzMi0wLjQyMyw5LjU0MiwxLjI1NmMyLjkwOSwxLjY3OSw0Ljk4OSw0LjM5MSw1Ljg1OSw3LjYzNWwxOC42NTksNjkuNjM2YzEuNzk0LDYuNjk3LTIuMTk0LDEzLjYwNi04Ljg5MSwxNS40MDFsLTM5LjA5MSwxMC40NzRjMC4wNDYsMS43ODIsMC4wNywzLjU1MiwwLjA3LDUuMjg3YzAsNy43NTUtMC40NDIsMTUuNjA0LTEuMzE0LDIzLjM2MmwzOC4wMjEsMTMuODM5YzMuMTU3LDEuMTQ4LDUuNjc3LDMuNDU4LDcuMDk3LDYuNTAyYzEuNDIsMy4wNDUsMS41NjgsNi40NiwwLjQxOSw5LjYxN2wtMjQuNjU2LDY3Ljc0MmMtMS4xNDgsMy4xNTYtMy40NTgsNS42NzctNi41MDIsNy4wOTZjLTMuMDQ1LDEuNDItNi40NTksMS41NjktOS42MTYsMC40MmwtMzguMDE5LTEzLjgzOGMtNS4yNzksNy45NDctMTEuMTQ0LDE1LjU4LTE3LjQ3LDIyLjczOGwyMy4yMTcsMzMuMTU3YzEuOTI3LDIuNzUxLDIuNjY3LDYuMDg4LDIuMDgzLDkuMzk3Yy0wLjU4NCwzLjMwOC0yLjQyLDYuMTktNS4xNzIsOC4xMTdsLTU5LjA1NCw0MS4zNWMtNS42ODEsMy45NzctMTMuNTM3LDIuNTkxLTE3LjUxNC0zLjA4OGwtMjMuMTg0LTMzLjExYy04Ljg5NSwzLjQ5OC0xOC4wODYsNi4zOTQtMjcuMzc1LDguNjI0djQwLjQyN0MzMDQuNjIxLDUwNS4yODcsMjk4Ljk4LDUxMC45MjgsMjkyLjA0Niw1MTAuOTI4eiIvPjxwYXRoIHN0eWxlPSJmaWxsOiMwMDAxMDA7IiBkPSJNMjI0Ljg5NSwxMzEuNDY4Yy0wLjc5NS0yLjAyNS0yLjQyNi0zLjYwOS00LjQ3NC00LjM0NGwtMzMuMzk0LTExLjk4NWMtMy45MjMtMS40MDYtOC4yNDMsMC42MzEtOS42NSw0LjU1MmMtMS40MDgsMy45MjIsMC42MzEsOC4yNDMsNC41NTMsOS42NTFsMTQuNjgsNS4yNjhjLTQ1LjkyOCwyMi40MTYtNzUuNzI1LDY5LjE3LTc1LjcyNSwxMjEuMzljMCw0OS44MjQsMjcuMjgyLDk1LjQ0OSw3MS4yLDExOS4wNzFjMS4xMzcsMC42MTIsMi4zNjEsMC45MDIsMy41NjgsMC45MDJjMi42ODcsMCw1LjI4OS0xLjQ0LDYuNjUxLTMuOTcyYzEuOTc0LTMuNjcsMC41OTktOC4yNDUtMy4wNzEtMTAuMjE5Yy0zOS4wMTktMjAuOTg3LTYzLjI1OC02MS41MjEtNjMuMjU4LTEwNS43ODJjMC00NS44MzgsMjUuODQyLTg2LjkzNSw2NS44MTQtMTA3LjExN2wtNy4zMTIsMTQuMTI0Yy0xLjkxNiwzLjctMC40NjksOC4yNTMsMy4yMzEsMTAuMTY5YzEuMTA5LDAuNTc0LDIuMjk0LDAuODQ2LDMuNDYzLDAuODQ2YzIuNzMsMCw1LjM2NS0xLjQ4Niw2LjcwNy00LjA3OGwxNi42OTctMzIuMjVDMjI1LjU3MiwxMzUuNzY0LDIyNS42OSwxMzMuNDk0LDIyNC44OTUsMTMxLjQ2OHoiLz48cGF0aCBzdHlsZT0iZmlsbDojMDAwMTAwOyIgZD0iTTI5Mi4xODYsMTI1Ljc4NmMtNC4wMTQtMS4xMTItOC4xNzMsMS4yMzgtOS4yODcsNS4yNTRjLTEuMTE0LDQuMDE2LDEuMjM5LDguMTczLDUuMjU0LDkuMjg3YzUxLjczOSwxNC4zNDksODcuODc0LDYxLjkxNiw4Ny44NzQsMTE1LjY3NGMwLDI5LjkyLTExLjA3Myw1OC41OC0zMS4xOCw4MC43MDJjLTE2Ljc3NSwxOC40NTYtMzguNjQ0LDMxLjEwNC02Mi42MzksMzYuNDUybDkuMTE0LTEzLjEwOWMyLjM3OC0zLjQyMSwxLjUzMy04LjEyMy0xLjg4OC0xMC41MDJjLTMuNDIzLTIuMzgtOC4xMjMtMS41MzMtMTAuNTAyLDEuODg4bC0yMC43MywyOS44MThjLTEuMjQyLDEuNzg3LTEuNjUyLDQuMDIyLTEuMTI1LDYuMTMzczEuOTM5LDMuODkzLDMuODc0LDQuODg2bDMxLjU2MiwxNi4yMDdjMS4xMDMsMC41NjYsMi4yOCwwLjgzNCwzLjQ0LDAuODM0YzIuNzM5LDAsNS4zODEtMS40OTYsNi43MTgtNC4xYzEuOTA0LTMuNzA3LDAuNDQyLTguMjU1LTMuMjY2LTEwLjE1OGwtMTMuOTQ1LTcuMTZjMjcuMDMyLTYuMDE2LDUxLjY2Ni0yMC4yNTYsNzAuNTU0LTQxLjAzOGMyMi42MzYtMjQuOTA1LDM1LjEwMy01Ny4xNzEsMzUuMTAzLTkwLjg1MUMzOTEuMTE3LDE5NS40ODYsMzUwLjQzNSwxNDEuOTQsMjkyLjE4NiwxMjUuNzg2eiIvPjwvZz48cGF0aCBzdHlsZT0iZmlsbDojRjRFNTk4OyIgZD0iTTI1NC4yNzMsMTI0LjU5MWwtOTEuMTE3LDE1Ny4zODdjLTIuMDU0LDMuNTQ4LDAuNTA2LDcuOTg4LDQuNjA2LDcuOTg4aDc4LjYxM2MzLjcyNiwwLDYuMjk5LDMuNzMxLDQuOTc0LDcuMjE0bC0zMi41NTgsODUuNmMtMi4xNjksNS43MDIsNS40MDIsOS45NzcsOS4xNjQsNS4xNzNsMTE5LjE4OS0xNTIuMTk1YzIuNzM2LTMuNDkzLDAuMjQ3LTguNjAzLTQuMTktOC42MDNoLTg1Ljc1NmMtMy4yMTQsMC01LjY5NS0yLjgyOC01LjI3Ny02LjAxNGwxMi4yMzMtOTMuMTlDMjY0LjkxMiwxMjIuMTgxLDI1Ny4xODgsMTE5LjU1NSwyNTQuMjczLDEyNC41OTF6Ii8+PHBhdGggc3R5bGU9ImZpbGw6I0VBQ0U4ODsiIGQ9Ik0yMjguOTgyLDM1NS45OTZsNTQuMTA4LTk5Ljc4NWMyLjE2OC0zLjk5OC0wLjcyNy04Ljg1OS01LjI3NC04Ljg1OUgyMTMuMDVjLTQuMzI2LDAtNy4yMy00LjQzOS01LjQ5Ny04LjQwMmw0Ny40NTctMTA4LjU3MWMyLjA2OS00LjczMiw5LjE4My0yLjc1Myw4LjUxMSwyLjM2N2wtMTEuNTQ4LDg3Ljk4OGMtMC40NDYsMy40LDIuMiw2LjQxNiw1LjYyOSw2LjQxNmg4NS43ODhjNC4yNjEsMCw2LjY1MSw0LjkwNyw0LjAyNCw4LjI2MmwtMTE4LjA2LDE1MC43NDljLTQuMDA2LDUuMTE1LTEyLjA2NywwLjU2NC05Ljc1OC01LjUwOGw5LjMzMS0yNC41MzdDMjI4Ljk0MywzNTYuMDc1LDIyOC45NjEsMzU2LjAzNSwyMjguOTgyLDM1NS45OTZ6Ii8+PHBhdGggc3R5bGU9ImZpbGw6IzAwMDEwMDsiIGQ9Ik0yMjMuODY4LDM5Ny42MDJjLTIuMTY0LDAtNC4zNjgtMC41NjMtNi40MjktMS43MjZjLTUuNjcyLTMuMjAyLTguMDE3LTkuNjktNS43MDItMTUuNzc5bDMxLjQxMi04Mi41ODdIMTY3Ljc2Yy00LjY1NSwwLTguODIxLTIuNDA3LTExLjE0Ny02LjQ0Yy0yLjMyNS00LjAzMi0yLjMyMS04Ljg0NSwwLjAxMS0xMi44NzNsOTEuMTE4LTE1Ny4zODdjMy4xMTMtNS4zNzYsOS4zOTUtNy43MzQsMTUuMjc3LTUuNzM1YzUuODgyLDEuOTk5LDkuNDI1LDcuNjk3LDguNjE2LDEzLjg1N2wtMTEuOTAzLDkwLjY3N2gxNS4zODFjNC4xNjcsMCw3LjU0NSwzLjM3OCw3LjU0NSw3LjU0NXMtMy4zNzgsNy41NDUtNy41NDUsNy41NDVoLTE3LjkxNWMtMy43MDQsMC03LjIyOS0xLjU5Ny05LjY3Mi00LjM4MXMtMy41NjgtNi40ODgtMy4wODYtMTAuMTZsMTAuNzg1LTgyLjE1NEwxNzEuNjE3LDI4Mi40Mmg3NC43NTdjNC4yMzEsMCw4LjE5MSwyLjA3OSwxMC41OTMsNS41NjNjMi40MDIsMy40ODMsMi45MzgsNy45MjQsMS40MzQsMTEuODc5bC0yNy4zNDUsNzEuODkzTDMzOC4zODksMjM0LjdoLTEyLjA4MmMtNC4xNjcsMC03LjU0NS0zLjM3OC03LjU0NS03LjU0NXMzLjM3OC03LjU0NSw3LjU0NS03LjU0NWgxNi42NDdjNC45NjIsMCw5LjM5NSwyLjc3MSwxMS41NjgsNy4yMzNjMi4xNzMsNC40NjEsMS42MjIsOS42Ni0xLjQzNywxMy41NjdsLTExOS4xOSwxNTIuMTk1QzIzMS4zMzcsMzk1Ljg3LDIyNy42NjQsMzk3LjYwMiwyMjMuODY4LDM5Ny42MDJ6Ii8+PGc+PC9nPjxnPjwvZz48Zz48L2c+PGc+PC9nPjxnPjwvZz48Zz48L2c+PGc+PC9nPjxnPjwvZz48Zz48L2c+PGc+PC9nPjxnPjwvZz48Zz48L2c+PGc+PC9nPjxnPjwvZz48Zz48L2c+PC9zdmc+);
}
.amp_expert_user .amp_user_avatar{
background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/PjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIgdmlld0JveD0iMCAwIDQ3MCA0NzAiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQ3MCA0NzA7IiB4bWw6c3BhY2U9InByZXNlcnZlIj48Zz48cGF0aCBzdHlsZT0iZmlsbDojQjJBRkFGOyIgZD0iTTM3OC42MDYsMzE0LjU4NmgxNVYxNi4yODVjLTguNzMsMy4wOTYtMTUsMTEuNDM3LTE1LDIxLjIxNVYzMTQuNTg2eiIvPjxyZWN0IHg9IjM3MS45MzkiIHk9IjMyOS41ODYiIHN0eWxlPSJmaWxsOiNGRjM4MkU7IiB3aWR0aD0iMjguMzMzIiBoZWlnaHQ9IjEyNS40MTQiLz48cGF0aCBzdHlsZT0iZmlsbDojNjU1RjVFOyIgZD0iTTMzOC43MjIsMzc2LjYzNmMtMy4zMzUsMi4zMjMtNy45MjcsMS41NzYtMTAuMzM4LTEuNzIzYy0xNS4wODItMjAuNjM1LTM1LjExMy0zNi43NjctNTcuNzg2LTQ3LjI1MkwxNzEuNzg3LDQ1NWgxNjIuNjUzYzQuMTQzLDAsNy41LDMuMzU3LDcuNSw3LjVoMTV2LTQ3LjkyNkMzNTIuNTc0LDQwMS4wMjUsMzQ2LjQwOSwzODguMjg1LDMzOC43MjIsMzc2LjYzNnoiLz48cGF0aCBzdHlsZT0iZmlsbDojM0YzNzM2OyIgZD0iTTE1Mi44LDQ1NWw0Ni4wNC01OS4zMzJMMTQ2LjAyMiwzMjcuNkM5Ny4yNjMsMzUwLjIxMyw2Mi43MzcsMzk4LjUwMSw1OS45MTQsNDU1SDE1Mi44eiIvPjxwYXRoIHN0eWxlPSJmaWxsOiNGRkJDOTk7IiBkPSJNMTQxLjQ4LDIxMC44NDFoMTMzLjcwNmMyLjM4Ny03LjA3MiwzLjctMTQuNjMzLDMuNy0yMi41cy0xLjMxNC0xNS40MjgtMy43LTIyLjVIMTQxLjQ4Yy0yLjM4Niw3LjA3Mi0zLjcsMTQuNjMzLTMuNywyMi41UzEzOS4wOTQsMjAzLjc2OSwxNDEuNDgsMjEwLjg0MXogTTIyMC41MzQsMTg4LjM0MWMwLTQuMTQzLDMuMzU3LTcuNSw3LjUtNy41aDE3LjI3YzQuMTQzLDAsNy41LDMuMzU3LDcuNSw3LjVzLTMuMzU3LDcuNS03LjUsNy41aC05LjkyYy0wLjY5NCwzLjQyMy0zLjcyMiw2LTcuMzUsNmMtNC4xNDMsMC03LjUtMy4zNTctNy41LTcuNVYxODguMzQxeiBNMTcxLjM2MiwxODAuODQxaDE3LjI3YzQuMTQzLDAsNy41LDMuMzU3LDcuNSw3LjV2NmMwLDQuMTQzLTMuMzU3LDcuNS03LjUsNy41Yy0zLjYyOCwwLTYuNjU1LTIuNTc3LTcuMzUtNmgtOS45MmMtNC4xNDMsMC03LjUtMy4zNTctNy41LTcuNVMxNjcuMjIsMTgwLjg0MSwxNzEuMzYyLDE4MC44NDF6Ii8+PHBhdGggc3R5bGU9ImZpbGw6IzNGMzczNjsiIGQ9Ik0xNDguNjE0LDIyNS44NDFjMTIuNTAxLDE5LjgzNywzNC41ODksMzMuMDUzLDU5LjcxOSwzMy4wNTNzNDcuMjE4LTEzLjIxNiw1OS43MTktMzMuMDUzSDE0OC42MTR6Ii8+PHBhdGggc3R5bGU9ImZpbGw6IzNGMzczNjsiIGQ9Ik0xNDguNjE0LDE1MC44NDFoMTE5LjQzOWMtMTIuNTAxLTE5LjgzNy0zNC41OS0zMy4wNTQtNTkuNzItMzMuMDU0UzE2MS4xMTUsMTMxLjAwNCwxNDguNjE0LDE1MC44NDF6Ii8+PHBhdGggc3R5bGU9ImZpbGw6IzFDMTkxODsiIGQ9Ik00MTcuNzcyLDMxNC41ODZoLTkuMTY2VjcuNWMwLTQuMTQzLTMuMzU3LTcuNS03LjUtNy41Yy0yMC42NzgsMC0zNy41LDE2LjgyMi0zNy41LDM3LjV2Mjc3LjA4NmgtOS4xNjdjLTQuMTQzLDAtNy41LDMuMzU3LTcuNSw3LjVzMy4zNTcsNy41LDcuNSw3LjVoMi41VjQ2Mi41YzAsNC4xNDMsMy4zNTcsNy41LDcuNSw3LjVoNDMuMzMzYzQuMTQzLDAsNy41LTMuMzU3LDcuNS03LjVWMzI5LjU4NmgyLjVjNC4xNDMsMCw3LjUtMy4zNTcsNy41LTcuNVM0MjEuOTE1LDMxNC41ODYsNDE3Ljc3MiwzMTQuNTg2eiBNMzkzLjYwNiwxNi4yODV2Mjk4LjMwMWgtMTVWMzcuNUMzNzguNjA2LDI3LjcyMiwzODQuODc2LDE5LjM4MSwzOTMuNjA2LDE2LjI4NXogTTM3MS45MzksMzI5LjU4NmgyOC4zMzNWNDU1aC0yOC4zMzNWMzI5LjU4NnoiLz48cGF0aCBzdHlsZT0iZmlsbDojMUMxOTE4OyIgZD0iTTMzNC40MzksNDU1SDE3MS43ODdsOTguODEyLTEyNy4zMzljMjIuNjczLDEwLjQ4NSw0Mi43MDUsMjYuNjE3LDU3Ljc4Niw0Ny4yNTJjMi40MSwzLjI5OCw3LjAwMiw0LjA0NiwxMC4zMzgsMS43MjNjMC4wNDctMC4wMzMsMC4wOTYtMC4wNiwwLjE0My0wLjA5NGMzLjM0NC0yLjQ0NCw0LjA3My03LjEzNywxLjYyOS0xMC40OGMtMTQuODgxLTIwLjM2LTM0LjU0Ny0zNy4yNTEtNTYuODcxLTQ4Ljg0NmMtMy44OTEtMi4wMjEtNy44NzItMy44NjctMTEuOTE4LTUuNTYzYy0wLjI4MS0wLjE0Mi0wLjU2OC0wLjI2Mi0wLjg1OS0wLjM2NmMtMTkuNzExLTguMTMyLTQxLjA2My0xMi4zOTMtNjIuNTEzLTEyLjM5M2MtMjEuOTg5LDAtNDIuOTczLDQuMzcxLTYyLjE0NCwxMi4yNzNjLTAuNDYyLDAuMTM4LTAuOTE0LDAuMzIyLTEuMzUxLDAuNTUzQzg2LjA3MSwzMzYuNTYxLDQ0LjcyOCwzOTQuNzkyLDQ0LjcyOCw0NjIuNWMwLDQuMTQzLDMuMzU3LDcuNSw3LjUsNy41aDI4Mi4yMTJjNC4xNDMsMCw3LjUtMy4zNTcsNy41LTcuNVMzMzguNTgyLDQ1NSwzMzQuNDM5LDQ1NXogTTE0Ni4wMjIsMzI3LjZsNTIuODE4LDY4LjA2OEwxNTIuOCw0NTVINTkuOTE0QzYyLjczNywzOTguNTAxLDk3LjI2MywzNTAuMjEzLDE0Ni4wMjIsMzI3LjZ6Ii8+PHBhdGggc3R5bGU9ImZpbGw6IzFDMTkxODsiIGQ9Ik0xMjIuNzgsMTg4LjM0MWMwLDExLjM3NywyLjI1MSwyMi4yMzQsNi4zMDEsMzIuMTczYzAuMTEyLDAuMzcsMC4yNTcsMC43MjUsMC40MjIsMS4wNjhjMTIuOTk5LDMwLjcxLDQzLjQzOSw1Mi4zMTEsNzguODMsNTIuMzExYzM1LjM5MSwwLDY1LjgzMi0yMS42MDEsNzguODMxLTUyLjMxMWMwLjE2NS0wLjM0NCwwLjMxLTAuNjk4LDAuNDIyLTEuMDY5YzQuMDUtOS45MzksNi4zMDEtMjAuNzk2LDYuMzAxLTMyLjE3M2MwLTExLjM3OC0yLjI1MS0yMi4yMzUtNi4zMDEtMzIuMTc1Yy0wLjExMi0wLjM2OS0wLjI1Ni0wLjcyMi0wLjQyMS0xLjA2NGMtMTIuOTk4LTMwLjcxMi00My40MzktNTIuMzE0LTc4LjgzMi01Mi4zMTRjLTM1LjM5MiwwLTY1LjgzMywyMS42MDMtNzguODMxLDUyLjMxNWMtMC4xNjQsMC4zNDItMC4zMDksMC42OTUtMC40MiwxLjA2NEMxMjUuMDMxLDE2Ni4xMDYsMTIyLjc4LDE3Ni45NjMsMTIyLjc4LDE4OC4zNDF6IE0yNjguMDUzLDE1MC44NDFIMTQ4LjYxNGMxMi41MDEtMTkuODM3LDM0LjU4OS0zMy4wNTQsNTkuNzE5LTMzLjA1NFMyNTUuNTUyLDEzMS4wMDQsMjY4LjA1MywxNTAuODQxeiBNMjA4LjMzMywyNTguODk0Yy0yNS4xMywwLTQ3LjIxOC0xMy4yMTYtNTkuNzE5LTMzLjA1M2gxMTkuNDM4QzI1NS41NTEsMjQ1LjY3NywyMzMuNDYzLDI1OC44OTQsMjA4LjMzMywyNTguODk0eiBNMjc1LjE4NiwxNjUuODQxYzIuMzg3LDcuMDcyLDMuNywxNC42MzMsMy43LDIyLjVzLTEuMzE0LDE1LjQyOC0zLjcsMjIuNUgxNDEuNDhjLTIuMzg2LTcuMDcyLTMuNy0xNC42MzMtMy43LTIyLjVzMS4zMTQtMTUuNDI4LDMuNy0yMi41SDI3NS4xODZ6Ii8+PHBhdGggc3R5bGU9ImZpbGw6IzFDMTkxODsiIGQ9Ik0xNzEuMzYyLDE5NS44NDFoOS45MmMwLjY5NCwzLjQyMywzLjcyMiw2LDcuMzUsNmM0LjE0MywwLDcuNS0zLjM1Nyw3LjUtNy41di02YzAtNC4xNDMtMy4zNTctNy41LTcuNS03LjVoLTE3LjI3Yy00LjE0MywwLTcuNSwzLjM1Ny03LjUsNy41UzE2Ny4yMiwxOTUuODQxLDE3MS4zNjIsMTk1Ljg0MXoiLz48cGF0aCBzdHlsZT0iZmlsbDojMUMxOTE4OyIgZD0iTTIyOC4wMzQsMjAxLjg0MWMzLjYyOCwwLDYuNjU1LTIuNTc3LDcuMzUtNmg5LjkyYzQuMTQzLDAsNy41LTMuMzU3LDcuNS03LjVzLTMuMzU3LTcuNS03LjUtNy41aC0xNy4yN2MtNC4xNDMsMC03LjUsMy4zNTctNy41LDcuNXY2QzIyMC41MzQsMTk4LjQ4MywyMjMuODkyLDIwMS44NDEsMjI4LjAzNCwyMDEuODQxeiIvPjwvZz48Zz48L2c+PGc+PC9nPjxnPjwvZz48Zz48L2c+PGc+PC9nPjxnPjwvZz48Zz48L2c+PGc+PC9nPjxnPjwvZz48Zz48L2c+PGc+PC9nPjxnPjwvZz48Zz48L2c+PGc+PC9nPjxnPjwvZz48L3N2Zz4=);
}
.amp_user_avatar {
padding: 30px;
background-repeat: no-repeat;
margin: 0 auto;
display: inline-block;
}
/*User Onboarding end*/
.amp_installed_heading{ color:#388E3C;font-weight:500;margin-top: 20px; }
.amp_installed_heading:before{
content: "";
background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PHN2ZyB3aWR0aD0iMjUycHgiIGhlaWdodD0iMjUycHgiIHZpZXdCb3g9IjAgMCAyNTIgMjUyIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPiAgICAgICAgPHRpdGxlPkNhcGFfMTwvdGl0bGU+ICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPiAgICA8ZGVmcz48L2RlZnM+ICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPiAgICAgICAgPGcgaWQ9IkFydGJvYXJkLTIiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yLjAwMDAwMCwgLTIuMDAwMDAwKSIgZmlsbD0iI0VEMUMyNCI+ICAgICAgICAgICAgPGcgaWQ9IkNhcGFfMSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMi4wMDAwMDAsIDIuMDAwMDAwKSI+ICAgICAgICAgICAgICAgIDxnIGlkPSJfeDMyXzQwLl9Qb3dlciI+ICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTI1LjYwNTYsMCBDNTYuMjMzNiwwIDAsNTYuMjMzNiAwLDEyNS42MDU2IEMwLDE5NC45NzIgNTYuMjMzNiwyNTEuMjExMiAxMjUuNjA1NiwyNTEuMjExMiBDMTk0Ljk3MjgsMjUxLjIxMTIgMjUxLjIxMTIsMTk0Ljk3MiAyNTEuMjExMiwxMjUuNjA1NiBDMjUxLjIxMTIsNTYuMjMzNiAxOTQuOTcyOCwwIDEyNS42MDU2LDAgWiBNMTI1LjYwNjAwNiwyMjguNDkwNDEyIEM2OC43ODE4MzU5LDIyOC40OTA0MTIgMjIuNzIxNiwxODIuNDIzNjI0IDIyLjcyMTYsMTI1LjYwNjAwNiBDMjIuNzIxNiw2OC43ODE4MzU5IDY4Ljc4MTgzNTksMjIuNzIxNiAxMjUuNjA2MDA2LDIyLjcyMTYgQzE4Mi40MjI4MDQsMjIuNzIxNiAyMjguNDg5NTkzLDY4Ljc4MTgzNTkgMjI4LjQ4OTU5MywxMjUuNjA2MDA2IEMyMjguNDkwNDEyLDE4Mi40MjM2MjQgMTgyLjQyMzYyNCwyMjguNDkwNDEyIDEyNS42MDYwMDYsMjI4LjQ5MDQxMiBaIE0xNjcuNzAwMjE0LDExNC43ODAxNSBMMTMzLjUxNDgzMiwxMTQuOTE4OTcxIEMxMjkuODYzNDExLDExNC45MzU3OTggMTI4LjUyMTQ3MSwxMTIuNDcwNjY4IDEzMC41MDc4NzgsMTA5LjQwNDgyIEwxNjcuMDk5NDk2LDUzLjE0NDMyNDEgQzE3MS4wNzgxOTksNDcuMDI5NDU1MiAxNzAuMTE3Mzg3LDQ2LjI1NjI2MjUgMTY0Ljk2NTg1NCw1MS40MTQ1MjYzIEw4NC41NzA2NDA2LDEzMS44MDIxNjggQzc5LjQxMDY5NDEsMTM2Ljk2MTI3MyA4MS4xNDM4NTczLDE0MS4xMjA4NjUgODguNDQxNjUyMSwxNDEuMDkxNDE4IEwxMTYuMDE0OTMyLDE0MC45Nzk1MTkgQzEyMy4zMDc2NzksMTQwLjk0OTIzMSAxMjYuMDA0MTc4LDE0NS44ODIwMTUgMTIyLjAyNjMxNiwxNTEuOTk4NTY3IEw4NS40MzYzODA4LDIwOC4yNjA3NDUgQzgzLjQ0OTEzMjUsMjExLjMxOTAyMSA4My45Mjg2OTcxLDIxMS43MTM2MSA4Ni41MTgzNDU4LDIwOS4xNDQxNTQgTDE0My45Nzc3NTMsMTUyLjA5Mjc5NyBDMTQ2LjU2MzE5NSwxNDkuNTE5OTc1IDE1MC43Mzc5MzEsMTQ1LjMzNTk4NSAxNTMuMjg5NzE5LDE0Mi43MzYyNCBMMTcxLjYzNTE2NywxMjQuMTMzMzQxIEMxNzYuNzU2NDEyLDExOC45NDM5NDggMTc0Ljk4OTU5NSwxMTQuNzQ4MTc5IDE2Ny43MDAyMTQsMTE0Ljc4MDE1IFoiIGlkPSJTaGFwZSI+PC9wYXRoPiAgICAgICAgICAgICAgICA8L2c+ICAgICAgICAgICAgPC9nPiAgICAgICAgPC9nPiAgICA8L2c+PC9zdmc+);
width: 30px;
height: 30px;
position: absolute;
display: inline-block;
background-repeat: no-repeat;
background-size: 30px;
left: 0px;
top: 10px;
}
.wrap .amp_installed_heading{
color: #333;
padding-left: 40px;
position: relative;
font-weight: 300;
}
.amp_installed_text{ margin: 10px 0px 20px 0px; max-width: 700px}
.amp_installed_text p {
margin: 0;
font-size: 18px;
font-weight: 300;
line-height: 27px;
color: #666;
}
.amp_user_onboarding_choose p{color: #444}
</style>
<?php }
} | {
"pile_set_name": "Github"
} |
/*
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include <memory>
#include <limits>
#include "api/data_channel_interface.h"
#include "rtc_base/logging.h"
#include "sdk/android/generated_peerconnection_jni/DataChannel_jni.h"
#include "sdk/android/native_api/jni/java_types.h"
#include "sdk/android/src/jni/jni_helpers.h"
#include "sdk/android/src/jni/pc/data_channel.h"
namespace webrtc {
namespace jni {
namespace {
// Adapter for a Java DataChannel$Observer presenting a C++ DataChannelObserver
// and dispatching the callback from C++ back to Java.
class DataChannelObserverJni : public DataChannelObserver {
public:
DataChannelObserverJni(JNIEnv* jni, const JavaRef<jobject>& j_observer);
~DataChannelObserverJni() override {}
void OnBufferedAmountChange(uint64_t previous_amount) override;
void OnStateChange() override;
void OnMessage(const DataBuffer& buffer) override;
private:
const ScopedJavaGlobalRef<jobject> j_observer_global_;
};
DataChannelObserverJni::DataChannelObserverJni(
JNIEnv* jni,
const JavaRef<jobject>& j_observer)
: j_observer_global_(jni, j_observer) {}
void DataChannelObserverJni::OnBufferedAmountChange(uint64_t previous_amount) {
JNIEnv* env = AttachCurrentThreadIfNeeded();
Java_Observer_onBufferedAmountChange(env, j_observer_global_,
previous_amount);
}
void DataChannelObserverJni::OnStateChange() {
JNIEnv* env = AttachCurrentThreadIfNeeded();
Java_Observer_onStateChange(env, j_observer_global_);
}
void DataChannelObserverJni::OnMessage(const DataBuffer& buffer) {
JNIEnv* env = AttachCurrentThreadIfNeeded();
ScopedJavaLocalRef<jobject> byte_buffer = NewDirectByteBuffer(
env, const_cast<char*>(buffer.data.data<char>()), buffer.data.size());
ScopedJavaLocalRef<jobject> j_buffer =
Java_Buffer_Constructor(env, byte_buffer, buffer.binary);
Java_Observer_onMessage(env, j_observer_global_, j_buffer);
}
DataChannelInterface* ExtractNativeDC(JNIEnv* jni,
const JavaParamRef<jobject>& j_dc) {
return reinterpret_cast<DataChannelInterface*>(
Java_DataChannel_getNativeDataChannel(jni, j_dc));
}
} // namespace
DataChannelInit JavaToNativeDataChannelInit(JNIEnv* env,
const JavaRef<jobject>& j_init) {
DataChannelInit init;
init.ordered = Java_Init_getOrdered(env, j_init);
init.maxRetransmitTime = Java_Init_getMaxRetransmitTimeMs(env, j_init);
init.maxRetransmits = Java_Init_getMaxRetransmits(env, j_init);
init.protocol = JavaToStdString(env, Java_Init_getProtocol(env, j_init));
init.negotiated = Java_Init_getNegotiated(env, j_init);
init.id = Java_Init_getId(env, j_init);
return init;
}
ScopedJavaLocalRef<jobject> WrapNativeDataChannel(
JNIEnv* env,
rtc::scoped_refptr<DataChannelInterface> channel) {
if (!channel)
return nullptr;
// Channel is now owned by Java object, and will be freed from there.
return Java_DataChannel_Constructor(env, jlongFromPointer(channel.release()));
}
static jlong JNI_DataChannel_RegisterObserver(
JNIEnv* jni,
const JavaParamRef<jobject>& j_dc,
const JavaParamRef<jobject>& j_observer) {
auto observer = std::make_unique<DataChannelObserverJni>(jni, j_observer);
ExtractNativeDC(jni, j_dc)->RegisterObserver(observer.get());
return jlongFromPointer(observer.release());
}
static void JNI_DataChannel_UnregisterObserver(
JNIEnv* jni,
const JavaParamRef<jobject>& j_dc,
jlong native_observer) {
ExtractNativeDC(jni, j_dc)->UnregisterObserver();
delete reinterpret_cast<DataChannelObserverJni*>(native_observer);
}
static ScopedJavaLocalRef<jstring> JNI_DataChannel_Label(
JNIEnv* jni,
const JavaParamRef<jobject>& j_dc) {
return NativeToJavaString(jni, ExtractNativeDC(jni, j_dc)->label());
}
static jint JNI_DataChannel_Id(JNIEnv* jni, const JavaParamRef<jobject>& j_dc) {
int id = ExtractNativeDC(jni, j_dc)->id();
RTC_CHECK_LE(id, std::numeric_limits<int32_t>::max())
<< "id overflowed jint!";
return static_cast<jint>(id);
}
static ScopedJavaLocalRef<jobject> JNI_DataChannel_State(
JNIEnv* jni,
const JavaParamRef<jobject>& j_dc) {
return Java_State_fromNativeIndex(jni, ExtractNativeDC(jni, j_dc)->state());
}
static jlong JNI_DataChannel_BufferedAmount(JNIEnv* jni,
const JavaParamRef<jobject>& j_dc) {
uint64_t buffered_amount = ExtractNativeDC(jni, j_dc)->buffered_amount();
RTC_CHECK_LE(buffered_amount, std::numeric_limits<int64_t>::max())
<< "buffered_amount overflowed jlong!";
return static_cast<jlong>(buffered_amount);
}
static void JNI_DataChannel_Close(JNIEnv* jni,
const JavaParamRef<jobject>& j_dc) {
ExtractNativeDC(jni, j_dc)->Close();
}
static jboolean JNI_DataChannel_Send(JNIEnv* jni,
const JavaParamRef<jobject>& j_dc,
const JavaParamRef<jbyteArray>& data,
jboolean binary) {
std::vector<int8_t> buffer = JavaToNativeByteArray(jni, data);
bool ret = ExtractNativeDC(jni, j_dc)->Send(
DataBuffer(rtc::CopyOnWriteBuffer(buffer.data(), buffer.size()), binary));
return ret;
}
} // namespace jni
} // namespace webrtc
| {
"pile_set_name": "Github"
} |
# Copyright 2019 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.
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import unittest
from dashboard.pinpoint.models.quest import run_performance_test
from dashboard.pinpoint.models.quest import run_telemetry_test
from dashboard.pinpoint.models.quest import run_vr_telemetry_test
from dashboard.pinpoint.models.quest import run_test_test
_BASE_ARGUMENTS = {
'swarming_server': 'server',
'dimensions': run_test_test.DIMENSIONS,
'browser': 'android-chromium-bundle',
}
_BROWSING_ARGUMENTS = _BASE_ARGUMENTS.copy()
_BROWSING_ARGUMENTS['benchmark'] = 'xr.browsing.static'
_CARDBOARD_ARGUMENTS = _BASE_ARGUMENTS.copy()
_CARDBOARD_ARGUMENTS['benchmark'] = 'xr.webxr.static'
_COMBINED_DEFAULT_EXTRA_ARGS = (
run_telemetry_test._DEFAULT_EXTRA_ARGS +
run_performance_test._DEFAULT_EXTRA_ARGS)
_BASE_EXTRA_ARGS = [
'--pageset-repeat',
'1',
'--browser',
'android-chromium-bundle',
] + _COMBINED_DEFAULT_EXTRA_ARGS
_BROWSING_EXTRA_ARGS = [
'--install-bundle-module', 'vr', '--remove-system-vrcore',
'--shared-prefs-file', run_vr_telemetry_test.DAYDREAM_PREFS,
'--profile-dir', run_vr_telemetry_test.ASSET_PROFILE_PATH, '--benchmarks',
'xr.browsing.static'
] + _BASE_EXTRA_ARGS
_CARDBOARD_EXTRA_ARGS = [
'--install-bundle-module', 'vr', '--remove-system-vrcore',
'--shared-prefs-file', run_vr_telemetry_test.CARDBOARD_PREFS,
'--benchmarks', 'xr.webxr.static'
] + _BASE_EXTRA_ARGS
_TELEMETRY_COMMAND = [
'luci-auth', 'context', '--', 'vpython', '../../testing/test_env.py',
'../../testing/scripts/run_performance_tests.py',
'../../tools/perf/run_benchmark'
]
_BASE_SWARMING_TAGS = {}
class AndroidFromDictTest(unittest.TestCase):
def testMinimumArgs(self):
with self.assertRaises(TypeError):
run_vr_telemetry_test.RunVrTelemetryTest.FromDict(_BASE_ARGUMENTS)
def testNonBundle(self):
with self.assertRaises(TypeError):
arguments = dict(_CARDBOARD_ARGUMENTS)
arguments['browser'] = 'android-chromium'
run_vr_telemetry_test.RunVrTelemetryTest.FromDict(arguments)
def testCardboardArgs(self):
quest = run_vr_telemetry_test.RunVrTelemetryTest.FromDict(
_CARDBOARD_ARGUMENTS)
expected = run_vr_telemetry_test.RunVrTelemetryTest(
'server', run_test_test.DIMENSIONS, _CARDBOARD_EXTRA_ARGS,
_BASE_SWARMING_TAGS, _TELEMETRY_COMMAND, 'out/Release')
self.assertEqual(quest, expected)
def testBrowsingArgs(self):
quest = run_vr_telemetry_test.RunVrTelemetryTest.FromDict(
_BROWSING_ARGUMENTS)
expected = run_vr_telemetry_test.RunVrTelemetryTest(
'server', run_test_test.DIMENSIONS, _BROWSING_EXTRA_ARGS,
_BASE_SWARMING_TAGS, _TELEMETRY_COMMAND, 'out/Release')
self.assertEqual(quest, expected)
_BASE_WINDOWS_ARGUMENTS = {
'swarming_server': 'server',
'dimensions': run_test_test.DIMENSIONS,
'browser': 'release',
'benchmark': 'xr.webxr.static',
}
_WINDOWS_EXTRA_ARGS = [
'--benchmarks',
'xr.webxr.static',
'--pageset-repeat',
'1',
'--browser',
'release',
] + _COMBINED_DEFAULT_EXTRA_ARGS
class WindowsFromDictTest(unittest.TestCase):
def testMinimumArgs(self):
quest = run_vr_telemetry_test.RunVrTelemetryTest.FromDict(
_BASE_WINDOWS_ARGUMENTS)
expected = run_vr_telemetry_test.RunVrTelemetryTest(
'server', run_test_test.DIMENSIONS, _WINDOWS_EXTRA_ARGS,
_BASE_SWARMING_TAGS, _TELEMETRY_COMMAND, 'out/Release')
self.assertEqual(quest, expected)
def testContentShell(self):
with self.assertRaises(TypeError):
arguments = dict(_BASE_WINDOWS_ARGUMENTS)
arguments['browser'] = 'content-shell-release'
run_vr_telemetry_test.RunVrTelemetryTest.FromDict(arguments)
| {
"pile_set_name": "Github"
} |
<li ng-class="{active: active, disabled: disabled}">
<a ng-click="select()" tab-heading-transclude>{{heading}}</a>
</li>
| {
"pile_set_name": "Github"
} |
// Copyright (C) 2019 tribe29 GmbH - License: GNU General Public License v2
// This file is part of Checkmk (https://checkmk.com). It is subject to the
// terms and conditions defined in the file COPYING, which is part of this
// source code package.
#ifndef DowntimeOrComment_h
#define DowntimeOrComment_h
#include "config.h" // IWYU pragma: keep
#include <ctime>
#include <string>
#include "nagios.h"
class MonitoringCore;
/* The structs for downtime and comment are so similar, that
we handle them with the same logic */
/*
typedef struct nebstruct_downtime_struct{
int type;
int flags;
int attr;
struct timeval timestamp;
int downtime_type;
char *host_name;
char *service_description;
time_t entry_time;
char *author_name;
char *comment_data;
time_t start_time;
time_t end_time;
int fixed;
unsigned long duration;
unsigned long triggered_by;
unsigned long downtime_id;
void *object_ptr; // not implemented yet
}nebstruct_downtime_data;
typedef struct nebstruct_comment_struct{
int type;
int flags;
int attr;
struct timeval timestamp;
int comment_type;
char *host_name;
char *service_description;
time_t entry_time;
char *author_name;
char *comment_data;
int persistent;
int source;
int entry_type;
int expires;
time_t expire_time;
unsigned long comment_id;
void *object_ptr; // not implemented yet
}nebstruct_comment_data;
*/
class DowntimeOrComment {
public:
int _type;
bool _is_service;
host *_host;
service *_service;
time_t _entry_time;
std::string _author_name;
std::string _comment;
unsigned long _id;
virtual ~DowntimeOrComment();
protected:
DowntimeOrComment(MonitoringCore *mc, nebstruct_downtime_struct *dt,
unsigned long id);
};
class Downtime : public DowntimeOrComment {
public:
time_t _start_time;
time_t _end_time;
int _fixed;
// TODO(sp): Wrong types, caused by TableDowntimes accessing it via
// OffsetIntColumn, should be unsigned long
int _duration;
int _triggered_by;
explicit Downtime(MonitoringCore *mc, nebstruct_downtime_struct *dt);
};
class Comment : public DowntimeOrComment {
public:
time_t _expire_time;
int _persistent;
int _source;
int _entry_type;
int _expires;
explicit Comment(MonitoringCore *mc, nebstruct_comment_struct *co);
};
#endif // DowntimeOrComment_h
| {
"pile_set_name": "Github"
} |
/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/*************************************************************
*
* MathJax/jax/output/SVG/fonts/TeX/fontdata-extra.js
*
* Adds extra stretchy characters to the TeX font data.
*
* ---------------------------------------------------------------------
*
* Copyright (c) 2011-2017 The MathJax Consortium
*
* 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.
*/
(function (SVG) {
var VERSION = "2.7.2";
var DELIMITERS = SVG.FONTDATA.DELIMITERS;
var MAIN = "MathJax_Main",
BOLD = "MathJax_Main-bold",
AMS = "MathJax_AMS",
SIZE1 = "MathJax_Size1",
SIZE4 = "MathJax_Size4";
var H = "H", V = "V";
var ARROWREP = [0x2212,MAIN,0,0,0,-.31,-.31]; // add depth for arrow extender
var DARROWREP = [0x3D,MAIN,0,0,0,0,.1]; // add depth for arrow extender
var delim = {
0x003D: // equal sign
{
dir: H, HW: [[767,MAIN]], stretch: {rep:[0x003D,MAIN]}
},
0x219E: // left two-headed arrow
{
dir: H, HW: [[1000,AMS]], stretch: {left:[0x219E,AMS], rep:ARROWREP}
},
0x21A0: // right two-headed arrow
{
dir: H, HW: [[1000,AMS]], stretch: {right:[0x21A0,AMS], rep:ARROWREP}
},
0x21A4: // left arrow from bar
{
dir: H, HW: [],
stretch: {min:1, left:[0x2190,MAIN], rep:ARROWREP, right:[0x2223,SIZE1,0,-.05,.9]}
},
0x21A5: // up arrow from bar
{
dir: V, HW: [],
stretch: {min:.6, bot:[0x22A5,BOLD,0,0,.75], ext:[0x23D0,SIZE1], top:[0x2191,SIZE1]}
},
0x21A6: // right arrow from bar
{
dir: H, HW: [[1000,MAIN]],
stretch: {left:[0x2223,SIZE1,-.09,-.05,.9], rep:ARROWREP, right:[0x2192,MAIN]}
},
0x21A7: // down arrow from bar
{
dir: V, HW: [],
stretch: {min:.6, top:[0x22A4,BOLD,0,0,.75], ext:[0x23D0,SIZE1], bot:[0x2193,SIZE1]}
},
0x21B0: // up arrow with top leftwards
{
dir: V, HW: [[722,AMS]],
stretch: {top:[0x21B0,AMS], ext:[0x23D0,SIZE1,.097]}
},
0x21B1: // up arrow with top right
{
dir: V, HW: [[722,AMS]],
stretch: {top:[0x21B1,AMS,.27], ext:[0x23D0,SIZE1]}
},
0x21BC: // left harpoon with barb up
{
dir: H, HW: [[1000,MAIN]],
stretch: {left:[0x21BC,MAIN], rep:ARROWREP}
},
0x21BD: // left harpoon with barb down
{
dir: H, HW: [[1000,MAIN]],
stretch: {left:[0x21BD,MAIN], rep:ARROWREP}
},
0x21BE: // up harpoon with barb right
{
dir: V, HW: [[888,AMS]],
stretch: {top:[0x21BE,AMS,.12,0,1.1], ext:[0x23D0,SIZE1]}
},
0x21BF: // up harpoon with barb left
{
dir: V, HW: [[888,AMS]],
stretch: {top:[0x21BF,AMS,.12,0,1.1], ext:[0x23D0,SIZE1]}
},
0x21C0: // right harpoon with barb up
{
dir: H, HW: [[1000,MAIN]],
stretch: {right:[0x21C0,MAIN], rep:ARROWREP}
},
0x21C1: // right harpoon with barb down
{
dir: H, HW: [[1000,MAIN]],
stretch: {right:[0x21C1,MAIN], rep:ARROWREP}
},
0x21C2: // down harpoon with barb right
{
dir: V, HW: [[888,AMS]],
stretch: {bot:[0x21C2,AMS,.12,0,1.1], ext:[0x23D0,SIZE1]}
},
0x21C3: // down harpoon with barb left
{
dir: V, HW: [[888,AMS]],
stretch: {bot:[0x21C3,AMS,.12,0,1.1], ext:[0x23D0,SIZE1]}
},
0x21DA: // left triple arrow
{
dir: H, HW: [[1000,AMS]],
stretch: {left:[0x21DA,AMS], rep:[0x2261,MAIN]}
},
0x21DB: // right triple arrow
{
dir: H, HW: [[1000,AMS]],
stretch: {right:[0x21DB,AMS], rep:[0x2261,MAIN]}
},
0x23B4: // top square bracket
{
dir: H, HW: [],
stretch: {min:.5, left:[0x250C,AMS,0,-.1], rep:[0x2212,MAIN,0,.325], right:[0x2510,AMS,0,-.1]}
},
0x23B5: // bottom square bracket
{
dir: H, HW: [],
stretch: {min:.5, left:[0x2514,AMS,0,.26], rep:[0x2212,MAIN,0,0,0,.25], right:[0x2518,AMS,0,.26]}
},
0x23DC: // top paren
{
dir: H, HW: [[778,AMS,0,0x2322],[100,MAIN,0,0x2322]],
stretch: {left:[0xE150,SIZE4], rep:[0xE154,SIZE4], right:[0xE151,SIZE4]}
},
0x23DD: // bottom paren
{
dir: H, HW: [[778,AMS,0,0x2323],[100,MAIN,0,0x2323]],
stretch: {left:[0xE152,SIZE4], rep:[0xE154,SIZE4], right:[0xE153,SIZE4]}
},
0x23E0: // top tortoise shell
{
dir: H, HW: [],
stretch: {min:1.25, left:[0x2CA,MAIN,-.1], rep:[0x2C9,MAIN,-.05,.13], right:[0x2CB,MAIN], fullExtenders:true}
},
0x23E1: // bottom tortoise shell
{
dir: H, HW: [],
stretch: {min:1.5, left:[0x2CB,MAIN,-.1,.1], rep:[0x2C9,MAIN,-.1], right:[0x2CA,MAIN,-.1,.1], fullExtenders:true}
},
0x2906: // leftwards double arrow from bar
{
dir: H, HW: [],
stretch: {min:1, left:[0x21D0,MAIN], rep:DARROWREP, right:[0x2223,SIZE1,0,-.1]}
},
0x2907: // rightwards double arrow from bar
{
dir: H, HW: [],
stretch: {min:.7, left:[0x22A8,AMS,0,-.12], rep:DARROWREP, right:[0x21D2,MAIN]}
},
0x294E: // left barb up right barb up harpoon
{
dir: H, HW: [],
stretch: {min:.5, left:[0x21BC,MAIN], rep:ARROWREP, right:[0x21C0,MAIN]}
},
0x294F: // up barb right down barb right harpoon
{
dir: V, HW: [],
stretch: {min:.5, top:[0x21BE,AMS,.12,0,1.1], ext:[0x23D0,SIZE1], bot:[0x21C2,AMS,.12,0,1.1]}
},
0x2950: // left barb dow right barb down harpoon
{
dir: H, HW: [],
stretch: {min:.5, left:[0x21BD,MAIN], rep:ARROWREP, right:[0x21C1,MAIN]}
},
0x2951: // up barb left down barb left harpoon
{
dir: V, HW: [],
stretch: {min:.5, top:[0x21BF,AMS,.12,0,1.1], ext:[0x23D0,SIZE1], bot:[0x21C3,AMS,.12,0,1.1]}
},
0x295A: // leftwards harpoon with barb up from bar
{
dir: H, HW: [],
stretch: {min:1, left:[0x21BC,MAIN], rep:ARROWREP, right:[0x2223,SIZE1,0,-.05,.9]}
},
0x295B: // rightwards harpoon with barb up from bar
{
dir: H, HW: [],
stretch: {min:1, left:[0x2223,SIZE1,-.05,-.05,.9], rep:ARROWREP, right:[0x21C0,MAIN]}
},
0x295C: // up harpoon with barb right from bar
{
dir: V, HW: [],
stretch: {min:.7, bot:[0x22A5,BOLD,0,0,.75], ext:[0x23D0,SIZE1], top:[0x21BE,AMS,.12,0,1.1]}
},
0x295D: // down harpoon with barb right from bar
{
dir: V, HW: [],
stretch: {min:.7, top:[0x22A4,BOLD,0,0,.75], ext:[0x23D0,SIZE1], bot:[0x21C2,AMS,.12,0,1.1]}
},
0x295E: // leftwards harpoon with barb down from bar
{
dir: H, HW: [],
stretch: {min:1, left:[0x21BD,MAIN], rep:ARROWREP, right:[0x2223,SIZE1,0,-.05,.9]}
},
0x295F: // rightwards harpoon with barb down from bar
{
dir: H, HW: [],
stretch: {min:1, left:[0x2223,SIZE1,-.05,-.05,.9], rep:ARROWREP, right:[0x21C1,MAIN]}
},
0x2960: // up harpoon with barb left from bar
{
dir: V, HW: [],
stretch: {min:.7, bot:[0x22A5,BOLD,0,0,.75], ext:[0x23D0,SIZE1], top:[0x21BF,AMS,.12,0,1.1]}
},
0x2961: // down harpoon with barb left from bar
{
dir: V, HW: [],
stretch: {min:.7, top:[0x22A4,BOLD,0,0,.75], ext:[0x23D0,SIZE1], bot:[0x21C3,AMS,.12,0,1.1]}
}
};
for (var id in delim) {if (delim.hasOwnProperty(id)) {DELIMITERS[id] = delim[id]}};
MathJax.Ajax.loadComplete(SVG.fontDir + "/fontdata-extra.js");
})(MathJax.OutputJax.SVG);
| {
"pile_set_name": "Github"
} |
/* Do not change, this code is generated from Golang structs */
export class Address {
city: string;
number: number;
country?: string;
static createFrom(source: any) {
if ('string' === typeof source) source = JSON.parse(source);
const result = new Address();
result.city = source["city"];
result.number = source["number"];
result.country = source["country"];
return result;
}
//[Address:]
/* Custom code here */
getAddressString = () => {
return this.city + " " + this.number;
}
//[end]
}
export class PersonalInfo {
hobby: string[];
pet_name: string;
static createFrom(source: any) {
if ('string' === typeof source) source = JSON.parse(source);
const result = new PersonalInfo();
result.hobby = source["hobby"];
result.pet_name = source["pet_name"];
return result;
}
//[PersonalInfo:]
getPersonalInfoString = () => {
return "pet:" + this.pet_name;
}
//[end]
}
export class Person {
name: string;
personal_info: PersonalInfo;
nicknames: string[];
addresses: Address[];
address?: Address;
metadata: {[key:string]:string};
friends: Person[];
static createFrom(source: any) {
if ('string' === typeof source) source = JSON.parse(source);
const result = new Person();
result.name = source["name"];
result.personal_info = source["personal_info"] ? PersonalInfo.createFrom(source["personal_info"]) : null;
result.nicknames = source["nicknames"];
result.addresses = source["addresses"] ? source["addresses"].map(function(element: any) { return Address.createFrom(element); }) : null;
result.address = source["address"] ? Address.createFrom(source["address"]) : null;
result.metadata = source["metadata"];
result.friends = source["friends"] ? source["friends"].map(function(element: any) { return Person.createFrom(element); }) : null;
return result;
}
//[Person:]
getInfo = () => {
return "name:" + this.name;
}
//[end]
} | {
"pile_set_name": "Github"
} |
//-----------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
// Tool: AllJoynCodeGenerator.exe
//
// This tool is located in the Windows 10 SDK and the Windows 10 AllJoyn
// Visual Studio Extension in the Visual Studio Gallery.
//
// The generated code should be packaged in a Windows 10 C++/CX Runtime
// Component which can be consumed in any UWP-supported language using
// APIs that are available in Windows.Devices.AllJoyn.
//
// Using AllJoynCodeGenerator - Invoke the following command with a valid
// Introspection XML file and a writable output directory:
// AllJoynCodeGenerator -i <INPUT XML FILE> -o <OUTPUT DIRECTORY>
// </auto-generated>
//-----------------------------------------------------------------------------
#pragma once
namespace org { namespace alljoyn { namespace Icon {
ref class IconSignals;
public interface class IIconSignals
{
};
public ref class IconSignals sealed : [Windows::Foundation::Metadata::Default] IIconSignals
{
public:
internal:
void Initialize(_In_ alljoyn_busobject busObject, _In_ alljoyn_sessionid sessionId);
private:
alljoyn_busobject m_busObject;
alljoyn_sessionid m_sessionId;
};
} } }
| {
"pile_set_name": "Github"
} |
<?php
namespace Doctrine\Tests\ORM\Functional\Ticket;
use Doctrine\Tests\Models\Quote\SimpleEntity;
require_once __DIR__ . '/../../../TestInit.php';
/**
* @group DDC-1719
*/
class DDC1719Test extends \Doctrine\Tests\OrmFunctionalTestCase
{
const CLASS_NAME = '\Doctrine\Tests\Models\Quote\SimpleEntity';
protected function setUp()
{
parent::setUp();
try {
$this->_schemaTool->createSchema(array(
$this->_em->getClassMetadata(self::CLASS_NAME),
));
} catch(\Exception $e) {
}
}
public function testCreateRetreaveUpdateDelete()
{
$e1 = new SimpleEntity('Bar 1');
$e2 = new SimpleEntity('Foo 1');
// Create
$this->_em->persist($e1);
$this->_em->persist($e2);
$this->_em->flush();
$this->_em->clear();
$e1Id = $e1->id;
$e2Id = $e2->id;
// Retreave
$e1 = $this->_em->find(self::CLASS_NAME, $e1Id);
$e2 = $this->_em->find(self::CLASS_NAME, $e2Id);
$this->assertInstanceOf(self::CLASS_NAME, $e1);
$this->assertInstanceOf(self::CLASS_NAME, $e2);
$this->assertEquals($e1Id, $e1->id);
$this->assertEquals($e2Id, $e2->id);
$this->assertEquals('Bar 1', $e1->value);
$this->assertEquals('Foo 1', $e2->value);
$e1->value = 'Bar 2';
$e2->value = 'Foo 2';
// Update
$this->_em->persist($e1);
$this->_em->persist($e2);
$this->_em->flush();
$this->assertEquals('Bar 2', $e1->value);
$this->assertEquals('Foo 2', $e2->value);
$this->assertInstanceOf(self::CLASS_NAME, $e1);
$this->assertInstanceOf(self::CLASS_NAME, $e2);
$this->assertEquals($e1Id, $e1->id);
$this->assertEquals($e2Id, $e2->id);
$this->assertEquals('Bar 2', $e1->value);
$this->assertEquals('Foo 2', $e2->value);
// Delete
$this->_em->remove($e1);
$this->_em->remove($e2);
$this->_em->flush();
$e1 = $this->_em->find(self::CLASS_NAME, $e1Id);
$e2 = $this->_em->find(self::CLASS_NAME, $e2Id);
$this->assertNull($e1);
$this->assertNull($e2);
}
} | {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8EED6297198A1D13000A4449"
BuildableName = "HBuilder.app"
BlueprintName = "HBuilder"
ReferencedContainer = "container:HBuilder-Hello.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8EED6297198A1D13000A4449"
BuildableName = "HBuilder.app"
BlueprintName = "HBuilder"
ReferencedContainer = "container:HBuilder-Hello.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8EED6297198A1D13000A4449"
BuildableName = "HBuilder.app"
BlueprintName = "HBuilder"
ReferencedContainer = "container:HBuilder-Hello.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8EED6297198A1D13000A4449"
BuildableName = "HBuilder.app"
BlueprintName = "HBuilder"
ReferencedContainer = "container:HBuilder-Hello.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
| {
"pile_set_name": "Github"
} |
/*
* ALSA driver for RME Digi96, Digi96/8 and Digi96/8 PRO/PAD/PST audio
* interfaces
*
* Copyright (c) 2000, 2001 Anders Torger <[email protected]>
*
* Thanks to Henk Hesselink <[email protected]> for the analog volume control
* code.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/module.h>
#include <sound/core.h>
#include <sound/info.h>
#include <sound/control.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/asoundef.h>
#include <sound/initval.h>
#include <asm/io.h>
/* note, two last pcis should be equal, it is not a bug */
MODULE_AUTHOR("Anders Torger <[email protected]>");
MODULE_DESCRIPTION("RME Digi96, Digi96/8, Digi96/8 PRO, Digi96/8 PST, "
"Digi96/8 PAD");
MODULE_LICENSE("GPL");
MODULE_SUPPORTED_DEVICE("{{RME,Digi96},"
"{RME,Digi96/8},"
"{RME,Digi96/8 PRO},"
"{RME,Digi96/8 PST},"
"{RME,Digi96/8 PAD}}");
static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
module_param_array(index, int, NULL, 0444);
MODULE_PARM_DESC(index, "Index value for RME Digi96 soundcard.");
module_param_array(id, charp, NULL, 0444);
MODULE_PARM_DESC(id, "ID string for RME Digi96 soundcard.");
module_param_array(enable, bool, NULL, 0444);
MODULE_PARM_DESC(enable, "Enable RME Digi96 soundcard.");
/*
* Defines for RME Digi96 series, from internal RME reference documents
* dated 12.01.00
*/
#define RME96_SPDIF_NCHANNELS 2
/* Playback and capture buffer size */
#define RME96_BUFFER_SIZE 0x10000
/* IO area size */
#define RME96_IO_SIZE 0x60000
/* IO area offsets */
#define RME96_IO_PLAY_BUFFER 0x0
#define RME96_IO_REC_BUFFER 0x10000
#define RME96_IO_CONTROL_REGISTER 0x20000
#define RME96_IO_ADDITIONAL_REG 0x20004
#define RME96_IO_CONFIRM_PLAY_IRQ 0x20008
#define RME96_IO_CONFIRM_REC_IRQ 0x2000C
#define RME96_IO_SET_PLAY_POS 0x40000
#define RME96_IO_RESET_PLAY_POS 0x4FFFC
#define RME96_IO_SET_REC_POS 0x50000
#define RME96_IO_RESET_REC_POS 0x5FFFC
#define RME96_IO_GET_PLAY_POS 0x20000
#define RME96_IO_GET_REC_POS 0x30000
/* Write control register bits */
#define RME96_WCR_START (1 << 0)
#define RME96_WCR_START_2 (1 << 1)
#define RME96_WCR_GAIN_0 (1 << 2)
#define RME96_WCR_GAIN_1 (1 << 3)
#define RME96_WCR_MODE24 (1 << 4)
#define RME96_WCR_MODE24_2 (1 << 5)
#define RME96_WCR_BM (1 << 6)
#define RME96_WCR_BM_2 (1 << 7)
#define RME96_WCR_ADAT (1 << 8)
#define RME96_WCR_FREQ_0 (1 << 9)
#define RME96_WCR_FREQ_1 (1 << 10)
#define RME96_WCR_DS (1 << 11)
#define RME96_WCR_PRO (1 << 12)
#define RME96_WCR_EMP (1 << 13)
#define RME96_WCR_SEL (1 << 14)
#define RME96_WCR_MASTER (1 << 15)
#define RME96_WCR_PD (1 << 16)
#define RME96_WCR_INP_0 (1 << 17)
#define RME96_WCR_INP_1 (1 << 18)
#define RME96_WCR_THRU_0 (1 << 19)
#define RME96_WCR_THRU_1 (1 << 20)
#define RME96_WCR_THRU_2 (1 << 21)
#define RME96_WCR_THRU_3 (1 << 22)
#define RME96_WCR_THRU_4 (1 << 23)
#define RME96_WCR_THRU_5 (1 << 24)
#define RME96_WCR_THRU_6 (1 << 25)
#define RME96_WCR_THRU_7 (1 << 26)
#define RME96_WCR_DOLBY (1 << 27)
#define RME96_WCR_MONITOR_0 (1 << 28)
#define RME96_WCR_MONITOR_1 (1 << 29)
#define RME96_WCR_ISEL (1 << 30)
#define RME96_WCR_IDIS (1 << 31)
#define RME96_WCR_BITPOS_GAIN_0 2
#define RME96_WCR_BITPOS_GAIN_1 3
#define RME96_WCR_BITPOS_FREQ_0 9
#define RME96_WCR_BITPOS_FREQ_1 10
#define RME96_WCR_BITPOS_INP_0 17
#define RME96_WCR_BITPOS_INP_1 18
#define RME96_WCR_BITPOS_MONITOR_0 28
#define RME96_WCR_BITPOS_MONITOR_1 29
/* Read control register bits */
#define RME96_RCR_AUDIO_ADDR_MASK 0xFFFF
#define RME96_RCR_IRQ_2 (1 << 16)
#define RME96_RCR_T_OUT (1 << 17)
#define RME96_RCR_DEV_ID_0 (1 << 21)
#define RME96_RCR_DEV_ID_1 (1 << 22)
#define RME96_RCR_LOCK (1 << 23)
#define RME96_RCR_VERF (1 << 26)
#define RME96_RCR_F0 (1 << 27)
#define RME96_RCR_F1 (1 << 28)
#define RME96_RCR_F2 (1 << 29)
#define RME96_RCR_AUTOSYNC (1 << 30)
#define RME96_RCR_IRQ (1 << 31)
#define RME96_RCR_BITPOS_F0 27
#define RME96_RCR_BITPOS_F1 28
#define RME96_RCR_BITPOS_F2 29
/* Additional register bits */
#define RME96_AR_WSEL (1 << 0)
#define RME96_AR_ANALOG (1 << 1)
#define RME96_AR_FREQPAD_0 (1 << 2)
#define RME96_AR_FREQPAD_1 (1 << 3)
#define RME96_AR_FREQPAD_2 (1 << 4)
#define RME96_AR_PD2 (1 << 5)
#define RME96_AR_DAC_EN (1 << 6)
#define RME96_AR_CLATCH (1 << 7)
#define RME96_AR_CCLK (1 << 8)
#define RME96_AR_CDATA (1 << 9)
#define RME96_AR_BITPOS_F0 2
#define RME96_AR_BITPOS_F1 3
#define RME96_AR_BITPOS_F2 4
/* Monitor tracks */
#define RME96_MONITOR_TRACKS_1_2 0
#define RME96_MONITOR_TRACKS_3_4 1
#define RME96_MONITOR_TRACKS_5_6 2
#define RME96_MONITOR_TRACKS_7_8 3
/* Attenuation */
#define RME96_ATTENUATION_0 0
#define RME96_ATTENUATION_6 1
#define RME96_ATTENUATION_12 2
#define RME96_ATTENUATION_18 3
/* Input types */
#define RME96_INPUT_OPTICAL 0
#define RME96_INPUT_COAXIAL 1
#define RME96_INPUT_INTERNAL 2
#define RME96_INPUT_XLR 3
#define RME96_INPUT_ANALOG 4
/* Clock modes */
#define RME96_CLOCKMODE_SLAVE 0
#define RME96_CLOCKMODE_MASTER 1
#define RME96_CLOCKMODE_WORDCLOCK 2
/* Block sizes in bytes */
#define RME96_SMALL_BLOCK_SIZE 2048
#define RME96_LARGE_BLOCK_SIZE 8192
/* Volume control */
#define RME96_AD1852_VOL_BITS 14
#define RME96_AD1855_VOL_BITS 10
struct rme96 {
spinlock_t lock;
int irq;
unsigned long port;
void __iomem *iobase;
u32 wcreg; /* cached write control register value */
u32 wcreg_spdif; /* S/PDIF setup */
u32 wcreg_spdif_stream; /* S/PDIF setup (temporary) */
u32 rcreg; /* cached read control register value */
u32 areg; /* cached additional register value */
u16 vol[2]; /* cached volume of analog output */
u8 rev; /* card revision number */
struct snd_pcm_substream *playback_substream;
struct snd_pcm_substream *capture_substream;
int playback_frlog; /* log2 of framesize */
int capture_frlog;
size_t playback_periodsize; /* in bytes, zero if not used */
size_t capture_periodsize; /* in bytes, zero if not used */
struct snd_card *card;
struct snd_pcm *spdif_pcm;
struct snd_pcm *adat_pcm;
struct pci_dev *pci;
struct snd_kcontrol *spdif_ctl;
};
static DEFINE_PCI_DEVICE_TABLE(snd_rme96_ids) = {
{ PCI_VDEVICE(XILINX, PCI_DEVICE_ID_RME_DIGI96), 0, },
{ PCI_VDEVICE(XILINX, PCI_DEVICE_ID_RME_DIGI96_8), 0, },
{ PCI_VDEVICE(XILINX, PCI_DEVICE_ID_RME_DIGI96_8_PRO), 0, },
{ PCI_VDEVICE(XILINX, PCI_DEVICE_ID_RME_DIGI96_8_PAD_OR_PST), 0, },
{ 0, }
};
MODULE_DEVICE_TABLE(pci, snd_rme96_ids);
#define RME96_ISPLAYING(rme96) ((rme96)->wcreg & RME96_WCR_START)
#define RME96_ISRECORDING(rme96) ((rme96)->wcreg & RME96_WCR_START_2)
#define RME96_HAS_ANALOG_IN(rme96) ((rme96)->pci->device == PCI_DEVICE_ID_RME_DIGI96_8_PAD_OR_PST)
#define RME96_HAS_ANALOG_OUT(rme96) ((rme96)->pci->device == PCI_DEVICE_ID_RME_DIGI96_8_PRO || \
(rme96)->pci->device == PCI_DEVICE_ID_RME_DIGI96_8_PAD_OR_PST)
#define RME96_DAC_IS_1852(rme96) (RME96_HAS_ANALOG_OUT(rme96) && (rme96)->rev >= 4)
#define RME96_DAC_IS_1855(rme96) (((rme96)->pci->device == PCI_DEVICE_ID_RME_DIGI96_8_PAD_OR_PST && (rme96)->rev < 4) || \
((rme96)->pci->device == PCI_DEVICE_ID_RME_DIGI96_8_PRO && (rme96)->rev == 2))
#define RME96_185X_MAX_OUT(rme96) ((1 << (RME96_DAC_IS_1852(rme96) ? RME96_AD1852_VOL_BITS : RME96_AD1855_VOL_BITS)) - 1)
static int
snd_rme96_playback_prepare(struct snd_pcm_substream *substream);
static int
snd_rme96_capture_prepare(struct snd_pcm_substream *substream);
static int
snd_rme96_playback_trigger(struct snd_pcm_substream *substream,
int cmd);
static int
snd_rme96_capture_trigger(struct snd_pcm_substream *substream,
int cmd);
static snd_pcm_uframes_t
snd_rme96_playback_pointer(struct snd_pcm_substream *substream);
static snd_pcm_uframes_t
snd_rme96_capture_pointer(struct snd_pcm_substream *substream);
static void __devinit
snd_rme96_proc_init(struct rme96 *rme96);
static int
snd_rme96_create_switches(struct snd_card *card,
struct rme96 *rme96);
static int
snd_rme96_getinputtype(struct rme96 *rme96);
static inline unsigned int
snd_rme96_playback_ptr(struct rme96 *rme96)
{
return (readl(rme96->iobase + RME96_IO_GET_PLAY_POS)
& RME96_RCR_AUDIO_ADDR_MASK) >> rme96->playback_frlog;
}
static inline unsigned int
snd_rme96_capture_ptr(struct rme96 *rme96)
{
return (readl(rme96->iobase + RME96_IO_GET_REC_POS)
& RME96_RCR_AUDIO_ADDR_MASK) >> rme96->capture_frlog;
}
static int
snd_rme96_playback_silence(struct snd_pcm_substream *substream,
int channel, /* not used (interleaved data) */
snd_pcm_uframes_t pos,
snd_pcm_uframes_t count)
{
struct rme96 *rme96 = snd_pcm_substream_chip(substream);
count <<= rme96->playback_frlog;
pos <<= rme96->playback_frlog;
memset_io(rme96->iobase + RME96_IO_PLAY_BUFFER + pos,
0, count);
return 0;
}
static int
snd_rme96_playback_copy(struct snd_pcm_substream *substream,
int channel, /* not used (interleaved data) */
snd_pcm_uframes_t pos,
void __user *src,
snd_pcm_uframes_t count)
{
struct rme96 *rme96 = snd_pcm_substream_chip(substream);
count <<= rme96->playback_frlog;
pos <<= rme96->playback_frlog;
copy_from_user_toio(rme96->iobase + RME96_IO_PLAY_BUFFER + pos, src,
count);
return 0;
}
static int
snd_rme96_capture_copy(struct snd_pcm_substream *substream,
int channel, /* not used (interleaved data) */
snd_pcm_uframes_t pos,
void __user *dst,
snd_pcm_uframes_t count)
{
struct rme96 *rme96 = snd_pcm_substream_chip(substream);
count <<= rme96->capture_frlog;
pos <<= rme96->capture_frlog;
copy_to_user_fromio(dst, rme96->iobase + RME96_IO_REC_BUFFER + pos,
count);
return 0;
}
/*
* Digital output capabilities (S/PDIF)
*/
static struct snd_pcm_hardware snd_rme96_playback_spdif_info =
{
.info = (SNDRV_PCM_INFO_MMAP_IOMEM |
SNDRV_PCM_INFO_MMAP_VALID |
SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_PAUSE),
.formats = (SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S32_LE),
.rates = (SNDRV_PCM_RATE_32000 |
SNDRV_PCM_RATE_44100 |
SNDRV_PCM_RATE_48000 |
SNDRV_PCM_RATE_64000 |
SNDRV_PCM_RATE_88200 |
SNDRV_PCM_RATE_96000),
.rate_min = 32000,
.rate_max = 96000,
.channels_min = 2,
.channels_max = 2,
.buffer_bytes_max = RME96_BUFFER_SIZE,
.period_bytes_min = RME96_SMALL_BLOCK_SIZE,
.period_bytes_max = RME96_LARGE_BLOCK_SIZE,
.periods_min = RME96_BUFFER_SIZE / RME96_LARGE_BLOCK_SIZE,
.periods_max = RME96_BUFFER_SIZE / RME96_SMALL_BLOCK_SIZE,
.fifo_size = 0,
};
/*
* Digital input capabilities (S/PDIF)
*/
static struct snd_pcm_hardware snd_rme96_capture_spdif_info =
{
.info = (SNDRV_PCM_INFO_MMAP_IOMEM |
SNDRV_PCM_INFO_MMAP_VALID |
SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_PAUSE),
.formats = (SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S32_LE),
.rates = (SNDRV_PCM_RATE_32000 |
SNDRV_PCM_RATE_44100 |
SNDRV_PCM_RATE_48000 |
SNDRV_PCM_RATE_64000 |
SNDRV_PCM_RATE_88200 |
SNDRV_PCM_RATE_96000),
.rate_min = 32000,
.rate_max = 96000,
.channels_min = 2,
.channels_max = 2,
.buffer_bytes_max = RME96_BUFFER_SIZE,
.period_bytes_min = RME96_SMALL_BLOCK_SIZE,
.period_bytes_max = RME96_LARGE_BLOCK_SIZE,
.periods_min = RME96_BUFFER_SIZE / RME96_LARGE_BLOCK_SIZE,
.periods_max = RME96_BUFFER_SIZE / RME96_SMALL_BLOCK_SIZE,
.fifo_size = 0,
};
/*
* Digital output capabilities (ADAT)
*/
static struct snd_pcm_hardware snd_rme96_playback_adat_info =
{
.info = (SNDRV_PCM_INFO_MMAP_IOMEM |
SNDRV_PCM_INFO_MMAP_VALID |
SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_PAUSE),
.formats = (SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S32_LE),
.rates = (SNDRV_PCM_RATE_44100 |
SNDRV_PCM_RATE_48000),
.rate_min = 44100,
.rate_max = 48000,
.channels_min = 8,
.channels_max = 8,
.buffer_bytes_max = RME96_BUFFER_SIZE,
.period_bytes_min = RME96_SMALL_BLOCK_SIZE,
.period_bytes_max = RME96_LARGE_BLOCK_SIZE,
.periods_min = RME96_BUFFER_SIZE / RME96_LARGE_BLOCK_SIZE,
.periods_max = RME96_BUFFER_SIZE / RME96_SMALL_BLOCK_SIZE,
.fifo_size = 0,
};
/*
* Digital input capabilities (ADAT)
*/
static struct snd_pcm_hardware snd_rme96_capture_adat_info =
{
.info = (SNDRV_PCM_INFO_MMAP_IOMEM |
SNDRV_PCM_INFO_MMAP_VALID |
SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_PAUSE),
.formats = (SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S32_LE),
.rates = (SNDRV_PCM_RATE_44100 |
SNDRV_PCM_RATE_48000),
.rate_min = 44100,
.rate_max = 48000,
.channels_min = 8,
.channels_max = 8,
.buffer_bytes_max = RME96_BUFFER_SIZE,
.period_bytes_min = RME96_SMALL_BLOCK_SIZE,
.period_bytes_max = RME96_LARGE_BLOCK_SIZE,
.periods_min = RME96_BUFFER_SIZE / RME96_LARGE_BLOCK_SIZE,
.periods_max = RME96_BUFFER_SIZE / RME96_SMALL_BLOCK_SIZE,
.fifo_size = 0,
};
/*
* The CDATA, CCLK and CLATCH bits can be used to write to the SPI interface
* of the AD1852 or AD1852 D/A converter on the board. CDATA must be set up
* on the falling edge of CCLK and be stable on the rising edge. The rising
* edge of CLATCH after the last data bit clocks in the whole data word.
* A fast processor could probably drive the SPI interface faster than the
* DAC can handle (3MHz for the 1855, unknown for the 1852). The udelay(1)
* limits the data rate to 500KHz and only causes a delay of 33 microsecs.
*
* NOTE: increased delay from 1 to 10, since there where problems setting
* the volume.
*/
static void
snd_rme96_write_SPI(struct rme96 *rme96, u16 val)
{
int i;
for (i = 0; i < 16; i++) {
if (val & 0x8000) {
rme96->areg |= RME96_AR_CDATA;
} else {
rme96->areg &= ~RME96_AR_CDATA;
}
rme96->areg &= ~(RME96_AR_CCLK | RME96_AR_CLATCH);
writel(rme96->areg, rme96->iobase + RME96_IO_ADDITIONAL_REG);
udelay(10);
rme96->areg |= RME96_AR_CCLK;
writel(rme96->areg, rme96->iobase + RME96_IO_ADDITIONAL_REG);
udelay(10);
val <<= 1;
}
rme96->areg &= ~(RME96_AR_CCLK | RME96_AR_CDATA);
rme96->areg |= RME96_AR_CLATCH;
writel(rme96->areg, rme96->iobase + RME96_IO_ADDITIONAL_REG);
udelay(10);
rme96->areg &= ~RME96_AR_CLATCH;
writel(rme96->areg, rme96->iobase + RME96_IO_ADDITIONAL_REG);
}
static void
snd_rme96_apply_dac_volume(struct rme96 *rme96)
{
if (RME96_DAC_IS_1852(rme96)) {
snd_rme96_write_SPI(rme96, (rme96->vol[0] << 2) | 0x0);
snd_rme96_write_SPI(rme96, (rme96->vol[1] << 2) | 0x2);
} else if (RME96_DAC_IS_1855(rme96)) {
snd_rme96_write_SPI(rme96, (rme96->vol[0] & 0x3FF) | 0x000);
snd_rme96_write_SPI(rme96, (rme96->vol[1] & 0x3FF) | 0x400);
}
}
static void
snd_rme96_reset_dac(struct rme96 *rme96)
{
writel(rme96->wcreg | RME96_WCR_PD,
rme96->iobase + RME96_IO_CONTROL_REGISTER);
writel(rme96->wcreg, rme96->iobase + RME96_IO_CONTROL_REGISTER);
}
static int
snd_rme96_getmontracks(struct rme96 *rme96)
{
return ((rme96->wcreg >> RME96_WCR_BITPOS_MONITOR_0) & 1) +
(((rme96->wcreg >> RME96_WCR_BITPOS_MONITOR_1) & 1) << 1);
}
static int
snd_rme96_setmontracks(struct rme96 *rme96,
int montracks)
{
if (montracks & 1) {
rme96->wcreg |= RME96_WCR_MONITOR_0;
} else {
rme96->wcreg &= ~RME96_WCR_MONITOR_0;
}
if (montracks & 2) {
rme96->wcreg |= RME96_WCR_MONITOR_1;
} else {
rme96->wcreg &= ~RME96_WCR_MONITOR_1;
}
writel(rme96->wcreg, rme96->iobase + RME96_IO_CONTROL_REGISTER);
return 0;
}
static int
snd_rme96_getattenuation(struct rme96 *rme96)
{
return ((rme96->wcreg >> RME96_WCR_BITPOS_GAIN_0) & 1) +
(((rme96->wcreg >> RME96_WCR_BITPOS_GAIN_1) & 1) << 1);
}
static int
snd_rme96_setattenuation(struct rme96 *rme96,
int attenuation)
{
switch (attenuation) {
case 0:
rme96->wcreg = (rme96->wcreg & ~RME96_WCR_GAIN_0) &
~RME96_WCR_GAIN_1;
break;
case 1:
rme96->wcreg = (rme96->wcreg | RME96_WCR_GAIN_0) &
~RME96_WCR_GAIN_1;
break;
case 2:
rme96->wcreg = (rme96->wcreg & ~RME96_WCR_GAIN_0) |
RME96_WCR_GAIN_1;
break;
case 3:
rme96->wcreg = (rme96->wcreg | RME96_WCR_GAIN_0) |
RME96_WCR_GAIN_1;
break;
default:
return -EINVAL;
}
writel(rme96->wcreg, rme96->iobase + RME96_IO_CONTROL_REGISTER);
return 0;
}
static int
snd_rme96_capture_getrate(struct rme96 *rme96,
int *is_adat)
{
int n, rate;
*is_adat = 0;
if (rme96->areg & RME96_AR_ANALOG) {
/* Analog input, overrides S/PDIF setting */
n = ((rme96->areg >> RME96_AR_BITPOS_F0) & 1) +
(((rme96->areg >> RME96_AR_BITPOS_F1) & 1) << 1);
switch (n) {
case 1:
rate = 32000;
break;
case 2:
rate = 44100;
break;
case 3:
rate = 48000;
break;
default:
return -1;
}
return (rme96->areg & RME96_AR_BITPOS_F2) ? rate << 1 : rate;
}
rme96->rcreg = readl(rme96->iobase + RME96_IO_CONTROL_REGISTER);
if (rme96->rcreg & RME96_RCR_LOCK) {
/* ADAT rate */
*is_adat = 1;
if (rme96->rcreg & RME96_RCR_T_OUT) {
return 48000;
}
return 44100;
}
if (rme96->rcreg & RME96_RCR_VERF) {
return -1;
}
/* S/PDIF rate */
n = ((rme96->rcreg >> RME96_RCR_BITPOS_F0) & 1) +
(((rme96->rcreg >> RME96_RCR_BITPOS_F1) & 1) << 1) +
(((rme96->rcreg >> RME96_RCR_BITPOS_F2) & 1) << 2);
switch (n) {
case 0:
if (rme96->rcreg & RME96_RCR_T_OUT) {
return 64000;
}
return -1;
case 3: return 96000;
case 4: return 88200;
case 5: return 48000;
case 6: return 44100;
case 7: return 32000;
default:
break;
}
return -1;
}
static int
snd_rme96_playback_getrate(struct rme96 *rme96)
{
int rate, dummy;
if (!(rme96->wcreg & RME96_WCR_MASTER) &&
snd_rme96_getinputtype(rme96) != RME96_INPUT_ANALOG &&
(rate = snd_rme96_capture_getrate(rme96, &dummy)) > 0)
{
/* slave clock */
return rate;
}
rate = ((rme96->wcreg >> RME96_WCR_BITPOS_FREQ_0) & 1) +
(((rme96->wcreg >> RME96_WCR_BITPOS_FREQ_1) & 1) << 1);
switch (rate) {
case 1:
rate = 32000;
break;
case 2:
rate = 44100;
break;
case 3:
rate = 48000;
break;
default:
return -1;
}
return (rme96->wcreg & RME96_WCR_DS) ? rate << 1 : rate;
}
static int
snd_rme96_playback_setrate(struct rme96 *rme96,
int rate)
{
int ds;
ds = rme96->wcreg & RME96_WCR_DS;
switch (rate) {
case 32000:
rme96->wcreg &= ~RME96_WCR_DS;
rme96->wcreg = (rme96->wcreg | RME96_WCR_FREQ_0) &
~RME96_WCR_FREQ_1;
break;
case 44100:
rme96->wcreg &= ~RME96_WCR_DS;
rme96->wcreg = (rme96->wcreg | RME96_WCR_FREQ_1) &
~RME96_WCR_FREQ_0;
break;
case 48000:
rme96->wcreg &= ~RME96_WCR_DS;
rme96->wcreg = (rme96->wcreg | RME96_WCR_FREQ_0) |
RME96_WCR_FREQ_1;
break;
case 64000:
rme96->wcreg |= RME96_WCR_DS;
rme96->wcreg = (rme96->wcreg | RME96_WCR_FREQ_0) &
~RME96_WCR_FREQ_1;
break;
case 88200:
rme96->wcreg |= RME96_WCR_DS;
rme96->wcreg = (rme96->wcreg | RME96_WCR_FREQ_1) &
~RME96_WCR_FREQ_0;
break;
case 96000:
rme96->wcreg |= RME96_WCR_DS;
rme96->wcreg = (rme96->wcreg | RME96_WCR_FREQ_0) |
RME96_WCR_FREQ_1;
break;
default:
return -EINVAL;
}
if ((!ds && rme96->wcreg & RME96_WCR_DS) ||
(ds && !(rme96->wcreg & RME96_WCR_DS)))
{
/* change to/from double-speed: reset the DAC (if available) */
snd_rme96_reset_dac(rme96);
return 1; /* need to restore volume */
} else {
writel(rme96->wcreg, rme96->iobase + RME96_IO_CONTROL_REGISTER);
return 0;
}
}
static int
snd_rme96_capture_analog_setrate(struct rme96 *rme96,
int rate)
{
switch (rate) {
case 32000:
rme96->areg = ((rme96->areg | RME96_AR_FREQPAD_0) &
~RME96_AR_FREQPAD_1) & ~RME96_AR_FREQPAD_2;
break;
case 44100:
rme96->areg = ((rme96->areg & ~RME96_AR_FREQPAD_0) |
RME96_AR_FREQPAD_1) & ~RME96_AR_FREQPAD_2;
break;
case 48000:
rme96->areg = ((rme96->areg | RME96_AR_FREQPAD_0) |
RME96_AR_FREQPAD_1) & ~RME96_AR_FREQPAD_2;
break;
case 64000:
if (rme96->rev < 4) {
return -EINVAL;
}
rme96->areg = ((rme96->areg | RME96_AR_FREQPAD_0) &
~RME96_AR_FREQPAD_1) | RME96_AR_FREQPAD_2;
break;
case 88200:
if (rme96->rev < 4) {
return -EINVAL;
}
rme96->areg = ((rme96->areg & ~RME96_AR_FREQPAD_0) |
RME96_AR_FREQPAD_1) | RME96_AR_FREQPAD_2;
break;
case 96000:
rme96->areg = ((rme96->areg | RME96_AR_FREQPAD_0) |
RME96_AR_FREQPAD_1) | RME96_AR_FREQPAD_2;
break;
default:
return -EINVAL;
}
writel(rme96->areg, rme96->iobase + RME96_IO_ADDITIONAL_REG);
return 0;
}
static int
snd_rme96_setclockmode(struct rme96 *rme96,
int mode)
{
switch (mode) {
case RME96_CLOCKMODE_SLAVE:
/* AutoSync */
rme96->wcreg &= ~RME96_WCR_MASTER;
rme96->areg &= ~RME96_AR_WSEL;
break;
case RME96_CLOCKMODE_MASTER:
/* Internal */
rme96->wcreg |= RME96_WCR_MASTER;
rme96->areg &= ~RME96_AR_WSEL;
break;
case RME96_CLOCKMODE_WORDCLOCK:
/* Word clock is a master mode */
rme96->wcreg |= RME96_WCR_MASTER;
rme96->areg |= RME96_AR_WSEL;
break;
default:
return -EINVAL;
}
writel(rme96->wcreg, rme96->iobase + RME96_IO_CONTROL_REGISTER);
writel(rme96->areg, rme96->iobase + RME96_IO_ADDITIONAL_REG);
return 0;
}
static int
snd_rme96_getclockmode(struct rme96 *rme96)
{
if (rme96->areg & RME96_AR_WSEL) {
return RME96_CLOCKMODE_WORDCLOCK;
}
return (rme96->wcreg & RME96_WCR_MASTER) ? RME96_CLOCKMODE_MASTER :
RME96_CLOCKMODE_SLAVE;
}
static int
snd_rme96_setinputtype(struct rme96 *rme96,
int type)
{
int n;
switch (type) {
case RME96_INPUT_OPTICAL:
rme96->wcreg = (rme96->wcreg & ~RME96_WCR_INP_0) &
~RME96_WCR_INP_1;
break;
case RME96_INPUT_COAXIAL:
rme96->wcreg = (rme96->wcreg | RME96_WCR_INP_0) &
~RME96_WCR_INP_1;
break;
case RME96_INPUT_INTERNAL:
rme96->wcreg = (rme96->wcreg & ~RME96_WCR_INP_0) |
RME96_WCR_INP_1;
break;
case RME96_INPUT_XLR:
if ((rme96->pci->device != PCI_DEVICE_ID_RME_DIGI96_8_PAD_OR_PST &&
rme96->pci->device != PCI_DEVICE_ID_RME_DIGI96_8_PRO) ||
(rme96->pci->device == PCI_DEVICE_ID_RME_DIGI96_8_PAD_OR_PST &&
rme96->rev > 4))
{
/* Only Digi96/8 PRO and Digi96/8 PAD supports XLR */
return -EINVAL;
}
rme96->wcreg = (rme96->wcreg | RME96_WCR_INP_0) |
RME96_WCR_INP_1;
break;
case RME96_INPUT_ANALOG:
if (!RME96_HAS_ANALOG_IN(rme96)) {
return -EINVAL;
}
rme96->areg |= RME96_AR_ANALOG;
writel(rme96->areg, rme96->iobase + RME96_IO_ADDITIONAL_REG);
if (rme96->rev < 4) {
/*
* Revision less than 004 does not support 64 and
* 88.2 kHz
*/
if (snd_rme96_capture_getrate(rme96, &n) == 88200) {
snd_rme96_capture_analog_setrate(rme96, 44100);
}
if (snd_rme96_capture_getrate(rme96, &n) == 64000) {
snd_rme96_capture_analog_setrate(rme96, 32000);
}
}
return 0;
default:
return -EINVAL;
}
if (type != RME96_INPUT_ANALOG && RME96_HAS_ANALOG_IN(rme96)) {
rme96->areg &= ~RME96_AR_ANALOG;
writel(rme96->areg, rme96->iobase + RME96_IO_ADDITIONAL_REG);
}
writel(rme96->wcreg, rme96->iobase + RME96_IO_CONTROL_REGISTER);
return 0;
}
static int
snd_rme96_getinputtype(struct rme96 *rme96)
{
if (rme96->areg & RME96_AR_ANALOG) {
return RME96_INPUT_ANALOG;
}
return ((rme96->wcreg >> RME96_WCR_BITPOS_INP_0) & 1) +
(((rme96->wcreg >> RME96_WCR_BITPOS_INP_1) & 1) << 1);
}
static void
snd_rme96_setframelog(struct rme96 *rme96,
int n_channels,
int is_playback)
{
int frlog;
if (n_channels == 2) {
frlog = 1;
} else {
/* assume 8 channels */
frlog = 3;
}
if (is_playback) {
frlog += (rme96->wcreg & RME96_WCR_MODE24) ? 2 : 1;
rme96->playback_frlog = frlog;
} else {
frlog += (rme96->wcreg & RME96_WCR_MODE24_2) ? 2 : 1;
rme96->capture_frlog = frlog;
}
}
static int
snd_rme96_playback_setformat(struct rme96 *rme96,
int format)
{
switch (format) {
case SNDRV_PCM_FORMAT_S16_LE:
rme96->wcreg &= ~RME96_WCR_MODE24;
break;
case SNDRV_PCM_FORMAT_S32_LE:
rme96->wcreg |= RME96_WCR_MODE24;
break;
default:
return -EINVAL;
}
writel(rme96->wcreg, rme96->iobase + RME96_IO_CONTROL_REGISTER);
return 0;
}
static int
snd_rme96_capture_setformat(struct rme96 *rme96,
int format)
{
switch (format) {
case SNDRV_PCM_FORMAT_S16_LE:
rme96->wcreg &= ~RME96_WCR_MODE24_2;
break;
case SNDRV_PCM_FORMAT_S32_LE:
rme96->wcreg |= RME96_WCR_MODE24_2;
break;
default:
return -EINVAL;
}
writel(rme96->wcreg, rme96->iobase + RME96_IO_CONTROL_REGISTER);
return 0;
}
static void
snd_rme96_set_period_properties(struct rme96 *rme96,
size_t period_bytes)
{
switch (period_bytes) {
case RME96_LARGE_BLOCK_SIZE:
rme96->wcreg &= ~RME96_WCR_ISEL;
break;
case RME96_SMALL_BLOCK_SIZE:
rme96->wcreg |= RME96_WCR_ISEL;
break;
default:
snd_BUG();
break;
}
rme96->wcreg &= ~RME96_WCR_IDIS;
writel(rme96->wcreg, rme96->iobase + RME96_IO_CONTROL_REGISTER);
}
static int
snd_rme96_playback_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct rme96 *rme96 = snd_pcm_substream_chip(substream);
struct snd_pcm_runtime *runtime = substream->runtime;
int err, rate, dummy;
bool apply_dac_volume = false;
runtime->dma_area = (void __force *)(rme96->iobase +
RME96_IO_PLAY_BUFFER);
runtime->dma_addr = rme96->port + RME96_IO_PLAY_BUFFER;
runtime->dma_bytes = RME96_BUFFER_SIZE;
spin_lock_irq(&rme96->lock);
if (!(rme96->wcreg & RME96_WCR_MASTER) &&
snd_rme96_getinputtype(rme96) != RME96_INPUT_ANALOG &&
(rate = snd_rme96_capture_getrate(rme96, &dummy)) > 0)
{
/* slave clock */
if ((int)params_rate(params) != rate) {
err = -EIO;
goto error;
}
} else {
err = snd_rme96_playback_setrate(rme96, params_rate(params));
if (err < 0)
goto error;
apply_dac_volume = err > 0; /* need to restore volume later? */
}
err = snd_rme96_playback_setformat(rme96, params_format(params));
if (err < 0)
goto error;
snd_rme96_setframelog(rme96, params_channels(params), 1);
if (rme96->capture_periodsize != 0) {
if (params_period_size(params) << rme96->playback_frlog !=
rme96->capture_periodsize)
{
err = -EBUSY;
goto error;
}
}
rme96->playback_periodsize =
params_period_size(params) << rme96->playback_frlog;
snd_rme96_set_period_properties(rme96, rme96->playback_periodsize);
/* S/PDIF setup */
if ((rme96->wcreg & RME96_WCR_ADAT) == 0) {
rme96->wcreg &= ~(RME96_WCR_PRO | RME96_WCR_DOLBY | RME96_WCR_EMP);
writel(rme96->wcreg |= rme96->wcreg_spdif_stream, rme96->iobase + RME96_IO_CONTROL_REGISTER);
}
err = 0;
error:
spin_unlock_irq(&rme96->lock);
if (apply_dac_volume) {
usleep_range(3000, 10000);
snd_rme96_apply_dac_volume(rme96);
}
return err;
}
static int
snd_rme96_capture_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct rme96 *rme96 = snd_pcm_substream_chip(substream);
struct snd_pcm_runtime *runtime = substream->runtime;
int err, isadat, rate;
runtime->dma_area = (void __force *)(rme96->iobase +
RME96_IO_REC_BUFFER);
runtime->dma_addr = rme96->port + RME96_IO_REC_BUFFER;
runtime->dma_bytes = RME96_BUFFER_SIZE;
spin_lock_irq(&rme96->lock);
if ((err = snd_rme96_capture_setformat(rme96, params_format(params))) < 0) {
spin_unlock_irq(&rme96->lock);
return err;
}
if (snd_rme96_getinputtype(rme96) == RME96_INPUT_ANALOG) {
if ((err = snd_rme96_capture_analog_setrate(rme96,
params_rate(params))) < 0)
{
spin_unlock_irq(&rme96->lock);
return err;
}
} else if ((rate = snd_rme96_capture_getrate(rme96, &isadat)) > 0) {
if ((int)params_rate(params) != rate) {
spin_unlock_irq(&rme96->lock);
return -EIO;
}
if ((isadat && runtime->hw.channels_min == 2) ||
(!isadat && runtime->hw.channels_min == 8))
{
spin_unlock_irq(&rme96->lock);
return -EIO;
}
}
snd_rme96_setframelog(rme96, params_channels(params), 0);
if (rme96->playback_periodsize != 0) {
if (params_period_size(params) << rme96->capture_frlog !=
rme96->playback_periodsize)
{
spin_unlock_irq(&rme96->lock);
return -EBUSY;
}
}
rme96->capture_periodsize =
params_period_size(params) << rme96->capture_frlog;
snd_rme96_set_period_properties(rme96, rme96->capture_periodsize);
spin_unlock_irq(&rme96->lock);
return 0;
}
static void
snd_rme96_playback_start(struct rme96 *rme96,
int from_pause)
{
if (!from_pause) {
writel(0, rme96->iobase + RME96_IO_RESET_PLAY_POS);
}
rme96->wcreg |= RME96_WCR_START;
writel(rme96->wcreg, rme96->iobase + RME96_IO_CONTROL_REGISTER);
}
static void
snd_rme96_capture_start(struct rme96 *rme96,
int from_pause)
{
if (!from_pause) {
writel(0, rme96->iobase + RME96_IO_RESET_REC_POS);
}
rme96->wcreg |= RME96_WCR_START_2;
writel(rme96->wcreg, rme96->iobase + RME96_IO_CONTROL_REGISTER);
}
static void
snd_rme96_playback_stop(struct rme96 *rme96)
{
/*
* Check if there is an unconfirmed IRQ, if so confirm it, or else
* the hardware will not stop generating interrupts
*/
rme96->rcreg = readl(rme96->iobase + RME96_IO_CONTROL_REGISTER);
if (rme96->rcreg & RME96_RCR_IRQ) {
writel(0, rme96->iobase + RME96_IO_CONFIRM_PLAY_IRQ);
}
rme96->wcreg &= ~RME96_WCR_START;
writel(rme96->wcreg, rme96->iobase + RME96_IO_CONTROL_REGISTER);
}
static void
snd_rme96_capture_stop(struct rme96 *rme96)
{
rme96->rcreg = readl(rme96->iobase + RME96_IO_CONTROL_REGISTER);
if (rme96->rcreg & RME96_RCR_IRQ_2) {
writel(0, rme96->iobase + RME96_IO_CONFIRM_REC_IRQ);
}
rme96->wcreg &= ~RME96_WCR_START_2;
writel(rme96->wcreg, rme96->iobase + RME96_IO_CONTROL_REGISTER);
}
static irqreturn_t
snd_rme96_interrupt(int irq,
void *dev_id)
{
struct rme96 *rme96 = (struct rme96 *)dev_id;
rme96->rcreg = readl(rme96->iobase + RME96_IO_CONTROL_REGISTER);
/* fastpath out, to ease interrupt sharing */
if (!((rme96->rcreg & RME96_RCR_IRQ) ||
(rme96->rcreg & RME96_RCR_IRQ_2)))
{
return IRQ_NONE;
}
if (rme96->rcreg & RME96_RCR_IRQ) {
/* playback */
snd_pcm_period_elapsed(rme96->playback_substream);
writel(0, rme96->iobase + RME96_IO_CONFIRM_PLAY_IRQ);
}
if (rme96->rcreg & RME96_RCR_IRQ_2) {
/* capture */
snd_pcm_period_elapsed(rme96->capture_substream);
writel(0, rme96->iobase + RME96_IO_CONFIRM_REC_IRQ);
}
return IRQ_HANDLED;
}
static unsigned int period_bytes[] = { RME96_SMALL_BLOCK_SIZE, RME96_LARGE_BLOCK_SIZE };
static struct snd_pcm_hw_constraint_list hw_constraints_period_bytes = {
.count = ARRAY_SIZE(period_bytes),
.list = period_bytes,
.mask = 0
};
static void
rme96_set_buffer_size_constraint(struct rme96 *rme96,
struct snd_pcm_runtime *runtime)
{
unsigned int size;
snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
RME96_BUFFER_SIZE, RME96_BUFFER_SIZE);
if ((size = rme96->playback_periodsize) != 0 ||
(size = rme96->capture_periodsize) != 0)
snd_pcm_hw_constraint_minmax(runtime,
SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
size, size);
else
snd_pcm_hw_constraint_list(runtime, 0,
SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
&hw_constraints_period_bytes);
}
static int
snd_rme96_playback_spdif_open(struct snd_pcm_substream *substream)
{
int rate, dummy;
struct rme96 *rme96 = snd_pcm_substream_chip(substream);
struct snd_pcm_runtime *runtime = substream->runtime;
spin_lock_irq(&rme96->lock);
if (rme96->playback_substream != NULL) {
spin_unlock_irq(&rme96->lock);
return -EBUSY;
}
rme96->wcreg &= ~RME96_WCR_ADAT;
writel(rme96->wcreg, rme96->iobase + RME96_IO_CONTROL_REGISTER);
rme96->playback_substream = substream;
spin_unlock_irq(&rme96->lock);
runtime->hw = snd_rme96_playback_spdif_info;
if (!(rme96->wcreg & RME96_WCR_MASTER) &&
snd_rme96_getinputtype(rme96) != RME96_INPUT_ANALOG &&
(rate = snd_rme96_capture_getrate(rme96, &dummy)) > 0)
{
/* slave clock */
runtime->hw.rates = snd_pcm_rate_to_rate_bit(rate);
runtime->hw.rate_min = rate;
runtime->hw.rate_max = rate;
}
rme96_set_buffer_size_constraint(rme96, runtime);
rme96->wcreg_spdif_stream = rme96->wcreg_spdif;
rme96->spdif_ctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE;
snd_ctl_notify(rme96->card, SNDRV_CTL_EVENT_MASK_VALUE |
SNDRV_CTL_EVENT_MASK_INFO, &rme96->spdif_ctl->id);
return 0;
}
static int
snd_rme96_capture_spdif_open(struct snd_pcm_substream *substream)
{
int isadat, rate;
struct rme96 *rme96 = snd_pcm_substream_chip(substream);
struct snd_pcm_runtime *runtime = substream->runtime;
runtime->hw = snd_rme96_capture_spdif_info;
if (snd_rme96_getinputtype(rme96) != RME96_INPUT_ANALOG &&
(rate = snd_rme96_capture_getrate(rme96, &isadat)) > 0)
{
if (isadat) {
return -EIO;
}
runtime->hw.rates = snd_pcm_rate_to_rate_bit(rate);
runtime->hw.rate_min = rate;
runtime->hw.rate_max = rate;
}
spin_lock_irq(&rme96->lock);
if (rme96->capture_substream != NULL) {
spin_unlock_irq(&rme96->lock);
return -EBUSY;
}
rme96->capture_substream = substream;
spin_unlock_irq(&rme96->lock);
rme96_set_buffer_size_constraint(rme96, runtime);
return 0;
}
static int
snd_rme96_playback_adat_open(struct snd_pcm_substream *substream)
{
int rate, dummy;
struct rme96 *rme96 = snd_pcm_substream_chip(substream);
struct snd_pcm_runtime *runtime = substream->runtime;
spin_lock_irq(&rme96->lock);
if (rme96->playback_substream != NULL) {
spin_unlock_irq(&rme96->lock);
return -EBUSY;
}
rme96->wcreg |= RME96_WCR_ADAT;
writel(rme96->wcreg, rme96->iobase + RME96_IO_CONTROL_REGISTER);
rme96->playback_substream = substream;
spin_unlock_irq(&rme96->lock);
runtime->hw = snd_rme96_playback_adat_info;
if (!(rme96->wcreg & RME96_WCR_MASTER) &&
snd_rme96_getinputtype(rme96) != RME96_INPUT_ANALOG &&
(rate = snd_rme96_capture_getrate(rme96, &dummy)) > 0)
{
/* slave clock */
runtime->hw.rates = snd_pcm_rate_to_rate_bit(rate);
runtime->hw.rate_min = rate;
runtime->hw.rate_max = rate;
}
rme96_set_buffer_size_constraint(rme96, runtime);
return 0;
}
static int
snd_rme96_capture_adat_open(struct snd_pcm_substream *substream)
{
int isadat, rate;
struct rme96 *rme96 = snd_pcm_substream_chip(substream);
struct snd_pcm_runtime *runtime = substream->runtime;
runtime->hw = snd_rme96_capture_adat_info;
if (snd_rme96_getinputtype(rme96) == RME96_INPUT_ANALOG) {
/* makes no sense to use analog input. Note that analog
expension cards AEB4/8-I are RME96_INPUT_INTERNAL */
return -EIO;
}
if ((rate = snd_rme96_capture_getrate(rme96, &isadat)) > 0) {
if (!isadat) {
return -EIO;
}
runtime->hw.rates = snd_pcm_rate_to_rate_bit(rate);
runtime->hw.rate_min = rate;
runtime->hw.rate_max = rate;
}
spin_lock_irq(&rme96->lock);
if (rme96->capture_substream != NULL) {
spin_unlock_irq(&rme96->lock);
return -EBUSY;
}
rme96->capture_substream = substream;
spin_unlock_irq(&rme96->lock);
rme96_set_buffer_size_constraint(rme96, runtime);
return 0;
}
static int
snd_rme96_playback_close(struct snd_pcm_substream *substream)
{
struct rme96 *rme96 = snd_pcm_substream_chip(substream);
int spdif = 0;
spin_lock_irq(&rme96->lock);
if (RME96_ISPLAYING(rme96)) {
snd_rme96_playback_stop(rme96);
}
rme96->playback_substream = NULL;
rme96->playback_periodsize = 0;
spdif = (rme96->wcreg & RME96_WCR_ADAT) == 0;
spin_unlock_irq(&rme96->lock);
if (spdif) {
rme96->spdif_ctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE;
snd_ctl_notify(rme96->card, SNDRV_CTL_EVENT_MASK_VALUE |
SNDRV_CTL_EVENT_MASK_INFO, &rme96->spdif_ctl->id);
}
return 0;
}
static int
snd_rme96_capture_close(struct snd_pcm_substream *substream)
{
struct rme96 *rme96 = snd_pcm_substream_chip(substream);
spin_lock_irq(&rme96->lock);
if (RME96_ISRECORDING(rme96)) {
snd_rme96_capture_stop(rme96);
}
rme96->capture_substream = NULL;
rme96->capture_periodsize = 0;
spin_unlock_irq(&rme96->lock);
return 0;
}
static int
snd_rme96_playback_prepare(struct snd_pcm_substream *substream)
{
struct rme96 *rme96 = snd_pcm_substream_chip(substream);
spin_lock_irq(&rme96->lock);
if (RME96_ISPLAYING(rme96)) {
snd_rme96_playback_stop(rme96);
}
writel(0, rme96->iobase + RME96_IO_RESET_PLAY_POS);
spin_unlock_irq(&rme96->lock);
return 0;
}
static int
snd_rme96_capture_prepare(struct snd_pcm_substream *substream)
{
struct rme96 *rme96 = snd_pcm_substream_chip(substream);
spin_lock_irq(&rme96->lock);
if (RME96_ISRECORDING(rme96)) {
snd_rme96_capture_stop(rme96);
}
writel(0, rme96->iobase + RME96_IO_RESET_REC_POS);
spin_unlock_irq(&rme96->lock);
return 0;
}
static int
snd_rme96_playback_trigger(struct snd_pcm_substream *substream,
int cmd)
{
struct rme96 *rme96 = snd_pcm_substream_chip(substream);
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
if (!RME96_ISPLAYING(rme96)) {
if (substream != rme96->playback_substream) {
return -EBUSY;
}
snd_rme96_playback_start(rme96, 0);
}
break;
case SNDRV_PCM_TRIGGER_STOP:
if (RME96_ISPLAYING(rme96)) {
if (substream != rme96->playback_substream) {
return -EBUSY;
}
snd_rme96_playback_stop(rme96);
}
break;
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
if (RME96_ISPLAYING(rme96)) {
snd_rme96_playback_stop(rme96);
}
break;
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
if (!RME96_ISPLAYING(rme96)) {
snd_rme96_playback_start(rme96, 1);
}
break;
default:
return -EINVAL;
}
return 0;
}
static int
snd_rme96_capture_trigger(struct snd_pcm_substream *substream,
int cmd)
{
struct rme96 *rme96 = snd_pcm_substream_chip(substream);
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
if (!RME96_ISRECORDING(rme96)) {
if (substream != rme96->capture_substream) {
return -EBUSY;
}
snd_rme96_capture_start(rme96, 0);
}
break;
case SNDRV_PCM_TRIGGER_STOP:
if (RME96_ISRECORDING(rme96)) {
if (substream != rme96->capture_substream) {
return -EBUSY;
}
snd_rme96_capture_stop(rme96);
}
break;
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
if (RME96_ISRECORDING(rme96)) {
snd_rme96_capture_stop(rme96);
}
break;
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
if (!RME96_ISRECORDING(rme96)) {
snd_rme96_capture_start(rme96, 1);
}
break;
default:
return -EINVAL;
}
return 0;
}
static snd_pcm_uframes_t
snd_rme96_playback_pointer(struct snd_pcm_substream *substream)
{
struct rme96 *rme96 = snd_pcm_substream_chip(substream);
return snd_rme96_playback_ptr(rme96);
}
static snd_pcm_uframes_t
snd_rme96_capture_pointer(struct snd_pcm_substream *substream)
{
struct rme96 *rme96 = snd_pcm_substream_chip(substream);
return snd_rme96_capture_ptr(rme96);
}
static struct snd_pcm_ops snd_rme96_playback_spdif_ops = {
.open = snd_rme96_playback_spdif_open,
.close = snd_rme96_playback_close,
.ioctl = snd_pcm_lib_ioctl,
.hw_params = snd_rme96_playback_hw_params,
.prepare = snd_rme96_playback_prepare,
.trigger = snd_rme96_playback_trigger,
.pointer = snd_rme96_playback_pointer,
.copy = snd_rme96_playback_copy,
.silence = snd_rme96_playback_silence,
.mmap = snd_pcm_lib_mmap_iomem,
};
static struct snd_pcm_ops snd_rme96_capture_spdif_ops = {
.open = snd_rme96_capture_spdif_open,
.close = snd_rme96_capture_close,
.ioctl = snd_pcm_lib_ioctl,
.hw_params = snd_rme96_capture_hw_params,
.prepare = snd_rme96_capture_prepare,
.trigger = snd_rme96_capture_trigger,
.pointer = snd_rme96_capture_pointer,
.copy = snd_rme96_capture_copy,
.mmap = snd_pcm_lib_mmap_iomem,
};
static struct snd_pcm_ops snd_rme96_playback_adat_ops = {
.open = snd_rme96_playback_adat_open,
.close = snd_rme96_playback_close,
.ioctl = snd_pcm_lib_ioctl,
.hw_params = snd_rme96_playback_hw_params,
.prepare = snd_rme96_playback_prepare,
.trigger = snd_rme96_playback_trigger,
.pointer = snd_rme96_playback_pointer,
.copy = snd_rme96_playback_copy,
.silence = snd_rme96_playback_silence,
.mmap = snd_pcm_lib_mmap_iomem,
};
static struct snd_pcm_ops snd_rme96_capture_adat_ops = {
.open = snd_rme96_capture_adat_open,
.close = snd_rme96_capture_close,
.ioctl = snd_pcm_lib_ioctl,
.hw_params = snd_rme96_capture_hw_params,
.prepare = snd_rme96_capture_prepare,
.trigger = snd_rme96_capture_trigger,
.pointer = snd_rme96_capture_pointer,
.copy = snd_rme96_capture_copy,
.mmap = snd_pcm_lib_mmap_iomem,
};
static void
snd_rme96_free(void *private_data)
{
struct rme96 *rme96 = (struct rme96 *)private_data;
if (rme96 == NULL) {
return;
}
if (rme96->irq >= 0) {
snd_rme96_playback_stop(rme96);
snd_rme96_capture_stop(rme96);
rme96->areg &= ~RME96_AR_DAC_EN;
writel(rme96->areg, rme96->iobase + RME96_IO_ADDITIONAL_REG);
free_irq(rme96->irq, (void *)rme96);
rme96->irq = -1;
}
if (rme96->iobase) {
iounmap(rme96->iobase);
rme96->iobase = NULL;
}
if (rme96->port) {
pci_release_regions(rme96->pci);
rme96->port = 0;
}
pci_disable_device(rme96->pci);
}
static void
snd_rme96_free_spdif_pcm(struct snd_pcm *pcm)
{
struct rme96 *rme96 = pcm->private_data;
rme96->spdif_pcm = NULL;
}
static void
snd_rme96_free_adat_pcm(struct snd_pcm *pcm)
{
struct rme96 *rme96 = pcm->private_data;
rme96->adat_pcm = NULL;
}
static int __devinit
snd_rme96_create(struct rme96 *rme96)
{
struct pci_dev *pci = rme96->pci;
int err;
rme96->irq = -1;
spin_lock_init(&rme96->lock);
if ((err = pci_enable_device(pci)) < 0)
return err;
if ((err = pci_request_regions(pci, "RME96")) < 0)
return err;
rme96->port = pci_resource_start(rme96->pci, 0);
rme96->iobase = ioremap_nocache(rme96->port, RME96_IO_SIZE);
if (!rme96->iobase) {
snd_printk(KERN_ERR "unable to remap memory region 0x%lx-0x%lx\n", rme96->port, rme96->port + RME96_IO_SIZE - 1);
return -ENOMEM;
}
if (request_irq(pci->irq, snd_rme96_interrupt, IRQF_SHARED,
KBUILD_MODNAME, rme96)) {
snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
return -EBUSY;
}
rme96->irq = pci->irq;
/* read the card's revision number */
pci_read_config_byte(pci, 8, &rme96->rev);
/* set up ALSA pcm device for S/PDIF */
if ((err = snd_pcm_new(rme96->card, "Digi96 IEC958", 0,
1, 1, &rme96->spdif_pcm)) < 0)
{
return err;
}
rme96->spdif_pcm->private_data = rme96;
rme96->spdif_pcm->private_free = snd_rme96_free_spdif_pcm;
strcpy(rme96->spdif_pcm->name, "Digi96 IEC958");
snd_pcm_set_ops(rme96->spdif_pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_rme96_playback_spdif_ops);
snd_pcm_set_ops(rme96->spdif_pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_rme96_capture_spdif_ops);
rme96->spdif_pcm->info_flags = 0;
/* set up ALSA pcm device for ADAT */
if (pci->device == PCI_DEVICE_ID_RME_DIGI96) {
/* ADAT is not available on the base model */
rme96->adat_pcm = NULL;
} else {
if ((err = snd_pcm_new(rme96->card, "Digi96 ADAT", 1,
1, 1, &rme96->adat_pcm)) < 0)
{
return err;
}
rme96->adat_pcm->private_data = rme96;
rme96->adat_pcm->private_free = snd_rme96_free_adat_pcm;
strcpy(rme96->adat_pcm->name, "Digi96 ADAT");
snd_pcm_set_ops(rme96->adat_pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_rme96_playback_adat_ops);
snd_pcm_set_ops(rme96->adat_pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_rme96_capture_adat_ops);
rme96->adat_pcm->info_flags = 0;
}
rme96->playback_periodsize = 0;
rme96->capture_periodsize = 0;
/* make sure playback/capture is stopped, if by some reason active */
snd_rme96_playback_stop(rme96);
snd_rme96_capture_stop(rme96);
/* set default values in registers */
rme96->wcreg =
RME96_WCR_FREQ_1 | /* set 44.1 kHz playback */
RME96_WCR_SEL | /* normal playback */
RME96_WCR_MASTER | /* set to master clock mode */
RME96_WCR_INP_0; /* set coaxial input */
rme96->areg = RME96_AR_FREQPAD_1; /* set 44.1 kHz analog capture */
writel(rme96->wcreg, rme96->iobase + RME96_IO_CONTROL_REGISTER);
writel(rme96->areg, rme96->iobase + RME96_IO_ADDITIONAL_REG);
/* reset the ADC */
writel(rme96->areg | RME96_AR_PD2,
rme96->iobase + RME96_IO_ADDITIONAL_REG);
writel(rme96->areg, rme96->iobase + RME96_IO_ADDITIONAL_REG);
/* reset and enable the DAC (order is important). */
snd_rme96_reset_dac(rme96);
rme96->areg |= RME96_AR_DAC_EN;
writel(rme96->areg, rme96->iobase + RME96_IO_ADDITIONAL_REG);
/* reset playback and record buffer pointers */
writel(0, rme96->iobase + RME96_IO_RESET_PLAY_POS);
writel(0, rme96->iobase + RME96_IO_RESET_REC_POS);
/* reset volume */
rme96->vol[0] = rme96->vol[1] = 0;
if (RME96_HAS_ANALOG_OUT(rme96)) {
snd_rme96_apply_dac_volume(rme96);
}
/* init switch interface */
if ((err = snd_rme96_create_switches(rme96->card, rme96)) < 0) {
return err;
}
/* init proc interface */
snd_rme96_proc_init(rme96);
return 0;
}
/*
* proc interface
*/
static void
snd_rme96_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
{
int n;
struct rme96 *rme96 = entry->private_data;
rme96->rcreg = readl(rme96->iobase + RME96_IO_CONTROL_REGISTER);
snd_iprintf(buffer, rme96->card->longname);
snd_iprintf(buffer, " (index #%d)\n", rme96->card->number + 1);
snd_iprintf(buffer, "\nGeneral settings\n");
if (rme96->wcreg & RME96_WCR_IDIS) {
snd_iprintf(buffer, " period size: N/A (interrupts "
"disabled)\n");
} else if (rme96->wcreg & RME96_WCR_ISEL) {
snd_iprintf(buffer, " period size: 2048 bytes\n");
} else {
snd_iprintf(buffer, " period size: 8192 bytes\n");
}
snd_iprintf(buffer, "\nInput settings\n");
switch (snd_rme96_getinputtype(rme96)) {
case RME96_INPUT_OPTICAL:
snd_iprintf(buffer, " input: optical");
break;
case RME96_INPUT_COAXIAL:
snd_iprintf(buffer, " input: coaxial");
break;
case RME96_INPUT_INTERNAL:
snd_iprintf(buffer, " input: internal");
break;
case RME96_INPUT_XLR:
snd_iprintf(buffer, " input: XLR");
break;
case RME96_INPUT_ANALOG:
snd_iprintf(buffer, " input: analog");
break;
}
if (snd_rme96_capture_getrate(rme96, &n) < 0) {
snd_iprintf(buffer, "\n sample rate: no valid signal\n");
} else {
if (n) {
snd_iprintf(buffer, " (8 channels)\n");
} else {
snd_iprintf(buffer, " (2 channels)\n");
}
snd_iprintf(buffer, " sample rate: %d Hz\n",
snd_rme96_capture_getrate(rme96, &n));
}
if (rme96->wcreg & RME96_WCR_MODE24_2) {
snd_iprintf(buffer, " sample format: 24 bit\n");
} else {
snd_iprintf(buffer, " sample format: 16 bit\n");
}
snd_iprintf(buffer, "\nOutput settings\n");
if (rme96->wcreg & RME96_WCR_SEL) {
snd_iprintf(buffer, " output signal: normal playback\n");
} else {
snd_iprintf(buffer, " output signal: same as input\n");
}
snd_iprintf(buffer, " sample rate: %d Hz\n",
snd_rme96_playback_getrate(rme96));
if (rme96->wcreg & RME96_WCR_MODE24) {
snd_iprintf(buffer, " sample format: 24 bit\n");
} else {
snd_iprintf(buffer, " sample format: 16 bit\n");
}
if (rme96->areg & RME96_AR_WSEL) {
snd_iprintf(buffer, " sample clock source: word clock\n");
} else if (rme96->wcreg & RME96_WCR_MASTER) {
snd_iprintf(buffer, " sample clock source: internal\n");
} else if (snd_rme96_getinputtype(rme96) == RME96_INPUT_ANALOG) {
snd_iprintf(buffer, " sample clock source: autosync (internal anyway due to analog input setting)\n");
} else if (snd_rme96_capture_getrate(rme96, &n) < 0) {
snd_iprintf(buffer, " sample clock source: autosync (internal anyway due to no valid signal)\n");
} else {
snd_iprintf(buffer, " sample clock source: autosync\n");
}
if (rme96->wcreg & RME96_WCR_PRO) {
snd_iprintf(buffer, " format: AES/EBU (professional)\n");
} else {
snd_iprintf(buffer, " format: IEC958 (consumer)\n");
}
if (rme96->wcreg & RME96_WCR_EMP) {
snd_iprintf(buffer, " emphasis: on\n");
} else {
snd_iprintf(buffer, " emphasis: off\n");
}
if (rme96->wcreg & RME96_WCR_DOLBY) {
snd_iprintf(buffer, " non-audio (dolby): on\n");
} else {
snd_iprintf(buffer, " non-audio (dolby): off\n");
}
if (RME96_HAS_ANALOG_IN(rme96)) {
snd_iprintf(buffer, "\nAnalog output settings\n");
switch (snd_rme96_getmontracks(rme96)) {
case RME96_MONITOR_TRACKS_1_2:
snd_iprintf(buffer, " monitored ADAT tracks: 1+2\n");
break;
case RME96_MONITOR_TRACKS_3_4:
snd_iprintf(buffer, " monitored ADAT tracks: 3+4\n");
break;
case RME96_MONITOR_TRACKS_5_6:
snd_iprintf(buffer, " monitored ADAT tracks: 5+6\n");
break;
case RME96_MONITOR_TRACKS_7_8:
snd_iprintf(buffer, " monitored ADAT tracks: 7+8\n");
break;
}
switch (snd_rme96_getattenuation(rme96)) {
case RME96_ATTENUATION_0:
snd_iprintf(buffer, " attenuation: 0 dB\n");
break;
case RME96_ATTENUATION_6:
snd_iprintf(buffer, " attenuation: -6 dB\n");
break;
case RME96_ATTENUATION_12:
snd_iprintf(buffer, " attenuation: -12 dB\n");
break;
case RME96_ATTENUATION_18:
snd_iprintf(buffer, " attenuation: -18 dB\n");
break;
}
snd_iprintf(buffer, " volume left: %u\n", rme96->vol[0]);
snd_iprintf(buffer, " volume right: %u\n", rme96->vol[1]);
}
}
static void __devinit
snd_rme96_proc_init(struct rme96 *rme96)
{
struct snd_info_entry *entry;
if (! snd_card_proc_new(rme96->card, "rme96", &entry))
snd_info_set_text_ops(entry, rme96, snd_rme96_proc_read);
}
/*
* control interface
*/
#define snd_rme96_info_loopback_control snd_ctl_boolean_mono_info
static int
snd_rme96_get_loopback_control(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct rme96 *rme96 = snd_kcontrol_chip(kcontrol);
spin_lock_irq(&rme96->lock);
ucontrol->value.integer.value[0] = rme96->wcreg & RME96_WCR_SEL ? 0 : 1;
spin_unlock_irq(&rme96->lock);
return 0;
}
static int
snd_rme96_put_loopback_control(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct rme96 *rme96 = snd_kcontrol_chip(kcontrol);
unsigned int val;
int change;
val = ucontrol->value.integer.value[0] ? 0 : RME96_WCR_SEL;
spin_lock_irq(&rme96->lock);
val = (rme96->wcreg & ~RME96_WCR_SEL) | val;
change = val != rme96->wcreg;
rme96->wcreg = val;
writel(val, rme96->iobase + RME96_IO_CONTROL_REGISTER);
spin_unlock_irq(&rme96->lock);
return change;
}
static int
snd_rme96_info_inputtype_control(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{
static char *_texts[5] = { "Optical", "Coaxial", "Internal", "XLR", "Analog" };
struct rme96 *rme96 = snd_kcontrol_chip(kcontrol);
char *texts[5] = { _texts[0], _texts[1], _texts[2], _texts[3], _texts[4] };
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
uinfo->count = 1;
switch (rme96->pci->device) {
case PCI_DEVICE_ID_RME_DIGI96:
case PCI_DEVICE_ID_RME_DIGI96_8:
uinfo->value.enumerated.items = 3;
break;
case PCI_DEVICE_ID_RME_DIGI96_8_PRO:
uinfo->value.enumerated.items = 4;
break;
case PCI_DEVICE_ID_RME_DIGI96_8_PAD_OR_PST:
if (rme96->rev > 4) {
/* PST */
uinfo->value.enumerated.items = 4;
texts[3] = _texts[4]; /* Analog instead of XLR */
} else {
/* PAD */
uinfo->value.enumerated.items = 5;
}
break;
default:
snd_BUG();
break;
}
if (uinfo->value.enumerated.item > uinfo->value.enumerated.items - 1) {
uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
}
strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
return 0;
}
static int
snd_rme96_get_inputtype_control(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct rme96 *rme96 = snd_kcontrol_chip(kcontrol);
unsigned int items = 3;
spin_lock_irq(&rme96->lock);
ucontrol->value.enumerated.item[0] = snd_rme96_getinputtype(rme96);
switch (rme96->pci->device) {
case PCI_DEVICE_ID_RME_DIGI96:
case PCI_DEVICE_ID_RME_DIGI96_8:
items = 3;
break;
case PCI_DEVICE_ID_RME_DIGI96_8_PRO:
items = 4;
break;
case PCI_DEVICE_ID_RME_DIGI96_8_PAD_OR_PST:
if (rme96->rev > 4) {
/* for handling PST case, (INPUT_ANALOG is moved to INPUT_XLR */
if (ucontrol->value.enumerated.item[0] == RME96_INPUT_ANALOG) {
ucontrol->value.enumerated.item[0] = RME96_INPUT_XLR;
}
items = 4;
} else {
items = 5;
}
break;
default:
snd_BUG();
break;
}
if (ucontrol->value.enumerated.item[0] >= items) {
ucontrol->value.enumerated.item[0] = items - 1;
}
spin_unlock_irq(&rme96->lock);
return 0;
}
static int
snd_rme96_put_inputtype_control(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct rme96 *rme96 = snd_kcontrol_chip(kcontrol);
unsigned int val;
int change, items = 3;
switch (rme96->pci->device) {
case PCI_DEVICE_ID_RME_DIGI96:
case PCI_DEVICE_ID_RME_DIGI96_8:
items = 3;
break;
case PCI_DEVICE_ID_RME_DIGI96_8_PRO:
items = 4;
break;
case PCI_DEVICE_ID_RME_DIGI96_8_PAD_OR_PST:
if (rme96->rev > 4) {
items = 4;
} else {
items = 5;
}
break;
default:
snd_BUG();
break;
}
val = ucontrol->value.enumerated.item[0] % items;
/* special case for PST */
if (rme96->pci->device == PCI_DEVICE_ID_RME_DIGI96_8_PAD_OR_PST && rme96->rev > 4) {
if (val == RME96_INPUT_XLR) {
val = RME96_INPUT_ANALOG;
}
}
spin_lock_irq(&rme96->lock);
change = (int)val != snd_rme96_getinputtype(rme96);
snd_rme96_setinputtype(rme96, val);
spin_unlock_irq(&rme96->lock);
return change;
}
static int
snd_rme96_info_clockmode_control(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{
static char *texts[3] = { "AutoSync", "Internal", "Word" };
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
uinfo->count = 1;
uinfo->value.enumerated.items = 3;
if (uinfo->value.enumerated.item > 2) {
uinfo->value.enumerated.item = 2;
}
strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
return 0;
}
static int
snd_rme96_get_clockmode_control(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct rme96 *rme96 = snd_kcontrol_chip(kcontrol);
spin_lock_irq(&rme96->lock);
ucontrol->value.enumerated.item[0] = snd_rme96_getclockmode(rme96);
spin_unlock_irq(&rme96->lock);
return 0;
}
static int
snd_rme96_put_clockmode_control(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct rme96 *rme96 = snd_kcontrol_chip(kcontrol);
unsigned int val;
int change;
val = ucontrol->value.enumerated.item[0] % 3;
spin_lock_irq(&rme96->lock);
change = (int)val != snd_rme96_getclockmode(rme96);
snd_rme96_setclockmode(rme96, val);
spin_unlock_irq(&rme96->lock);
return change;
}
static int
snd_rme96_info_attenuation_control(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{
static char *texts[4] = { "0 dB", "-6 dB", "-12 dB", "-18 dB" };
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
uinfo->count = 1;
uinfo->value.enumerated.items = 4;
if (uinfo->value.enumerated.item > 3) {
uinfo->value.enumerated.item = 3;
}
strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
return 0;
}
static int
snd_rme96_get_attenuation_control(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct rme96 *rme96 = snd_kcontrol_chip(kcontrol);
spin_lock_irq(&rme96->lock);
ucontrol->value.enumerated.item[0] = snd_rme96_getattenuation(rme96);
spin_unlock_irq(&rme96->lock);
return 0;
}
static int
snd_rme96_put_attenuation_control(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct rme96 *rme96 = snd_kcontrol_chip(kcontrol);
unsigned int val;
int change;
val = ucontrol->value.enumerated.item[0] % 4;
spin_lock_irq(&rme96->lock);
change = (int)val != snd_rme96_getattenuation(rme96);
snd_rme96_setattenuation(rme96, val);
spin_unlock_irq(&rme96->lock);
return change;
}
static int
snd_rme96_info_montracks_control(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{
static char *texts[4] = { "1+2", "3+4", "5+6", "7+8" };
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
uinfo->count = 1;
uinfo->value.enumerated.items = 4;
if (uinfo->value.enumerated.item > 3) {
uinfo->value.enumerated.item = 3;
}
strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
return 0;
}
static int
snd_rme96_get_montracks_control(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct rme96 *rme96 = snd_kcontrol_chip(kcontrol);
spin_lock_irq(&rme96->lock);
ucontrol->value.enumerated.item[0] = snd_rme96_getmontracks(rme96);
spin_unlock_irq(&rme96->lock);
return 0;
}
static int
snd_rme96_put_montracks_control(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct rme96 *rme96 = snd_kcontrol_chip(kcontrol);
unsigned int val;
int change;
val = ucontrol->value.enumerated.item[0] % 4;
spin_lock_irq(&rme96->lock);
change = (int)val != snd_rme96_getmontracks(rme96);
snd_rme96_setmontracks(rme96, val);
spin_unlock_irq(&rme96->lock);
return change;
}
static u32 snd_rme96_convert_from_aes(struct snd_aes_iec958 *aes)
{
u32 val = 0;
val |= (aes->status[0] & IEC958_AES0_PROFESSIONAL) ? RME96_WCR_PRO : 0;
val |= (aes->status[0] & IEC958_AES0_NONAUDIO) ? RME96_WCR_DOLBY : 0;
if (val & RME96_WCR_PRO)
val |= (aes->status[0] & IEC958_AES0_PRO_EMPHASIS_5015) ? RME96_WCR_EMP : 0;
else
val |= (aes->status[0] & IEC958_AES0_CON_EMPHASIS_5015) ? RME96_WCR_EMP : 0;
return val;
}
static void snd_rme96_convert_to_aes(struct snd_aes_iec958 *aes, u32 val)
{
aes->status[0] = ((val & RME96_WCR_PRO) ? IEC958_AES0_PROFESSIONAL : 0) |
((val & RME96_WCR_DOLBY) ? IEC958_AES0_NONAUDIO : 0);
if (val & RME96_WCR_PRO)
aes->status[0] |= (val & RME96_WCR_EMP) ? IEC958_AES0_PRO_EMPHASIS_5015 : 0;
else
aes->status[0] |= (val & RME96_WCR_EMP) ? IEC958_AES0_CON_EMPHASIS_5015 : 0;
}
static int snd_rme96_control_spdif_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{
uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
uinfo->count = 1;
return 0;
}
static int snd_rme96_control_spdif_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct rme96 *rme96 = snd_kcontrol_chip(kcontrol);
snd_rme96_convert_to_aes(&ucontrol->value.iec958, rme96->wcreg_spdif);
return 0;
}
static int snd_rme96_control_spdif_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct rme96 *rme96 = snd_kcontrol_chip(kcontrol);
int change;
u32 val;
val = snd_rme96_convert_from_aes(&ucontrol->value.iec958);
spin_lock_irq(&rme96->lock);
change = val != rme96->wcreg_spdif;
rme96->wcreg_spdif = val;
spin_unlock_irq(&rme96->lock);
return change;
}
static int snd_rme96_control_spdif_stream_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{
uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
uinfo->count = 1;
return 0;
}
static int snd_rme96_control_spdif_stream_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct rme96 *rme96 = snd_kcontrol_chip(kcontrol);
snd_rme96_convert_to_aes(&ucontrol->value.iec958, rme96->wcreg_spdif_stream);
return 0;
}
static int snd_rme96_control_spdif_stream_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct rme96 *rme96 = snd_kcontrol_chip(kcontrol);
int change;
u32 val;
val = snd_rme96_convert_from_aes(&ucontrol->value.iec958);
spin_lock_irq(&rme96->lock);
change = val != rme96->wcreg_spdif_stream;
rme96->wcreg_spdif_stream = val;
rme96->wcreg &= ~(RME96_WCR_PRO | RME96_WCR_DOLBY | RME96_WCR_EMP);
rme96->wcreg |= val;
writel(rme96->wcreg, rme96->iobase + RME96_IO_CONTROL_REGISTER);
spin_unlock_irq(&rme96->lock);
return change;
}
static int snd_rme96_control_spdif_mask_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{
uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
uinfo->count = 1;
return 0;
}
static int snd_rme96_control_spdif_mask_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
ucontrol->value.iec958.status[0] = kcontrol->private_value;
return 0;
}
static int
snd_rme96_dac_volume_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{
struct rme96 *rme96 = snd_kcontrol_chip(kcontrol);
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = 2;
uinfo->value.integer.min = 0;
uinfo->value.integer.max = RME96_185X_MAX_OUT(rme96);
return 0;
}
static int
snd_rme96_dac_volume_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *u)
{
struct rme96 *rme96 = snd_kcontrol_chip(kcontrol);
spin_lock_irq(&rme96->lock);
u->value.integer.value[0] = rme96->vol[0];
u->value.integer.value[1] = rme96->vol[1];
spin_unlock_irq(&rme96->lock);
return 0;
}
static int
snd_rme96_dac_volume_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *u)
{
struct rme96 *rme96 = snd_kcontrol_chip(kcontrol);
int change = 0;
unsigned int vol, maxvol;
if (!RME96_HAS_ANALOG_OUT(rme96))
return -EINVAL;
maxvol = RME96_185X_MAX_OUT(rme96);
spin_lock_irq(&rme96->lock);
vol = u->value.integer.value[0];
if (vol != rme96->vol[0] && vol <= maxvol) {
rme96->vol[0] = vol;
change = 1;
}
vol = u->value.integer.value[1];
if (vol != rme96->vol[1] && vol <= maxvol) {
rme96->vol[1] = vol;
change = 1;
}
if (change)
snd_rme96_apply_dac_volume(rme96);
spin_unlock_irq(&rme96->lock);
return change;
}
static struct snd_kcontrol_new snd_rme96_controls[] = {
{
.iface = SNDRV_CTL_ELEM_IFACE_PCM,
.name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT),
.info = snd_rme96_control_spdif_info,
.get = snd_rme96_control_spdif_get,
.put = snd_rme96_control_spdif_put
},
{
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_INACTIVE,
.iface = SNDRV_CTL_ELEM_IFACE_PCM,
.name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PCM_STREAM),
.info = snd_rme96_control_spdif_stream_info,
.get = snd_rme96_control_spdif_stream_get,
.put = snd_rme96_control_spdif_stream_put
},
{
.access = SNDRV_CTL_ELEM_ACCESS_READ,
.iface = SNDRV_CTL_ELEM_IFACE_PCM,
.name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK),
.info = snd_rme96_control_spdif_mask_info,
.get = snd_rme96_control_spdif_mask_get,
.private_value = IEC958_AES0_NONAUDIO |
IEC958_AES0_PROFESSIONAL |
IEC958_AES0_CON_EMPHASIS
},
{
.access = SNDRV_CTL_ELEM_ACCESS_READ,
.iface = SNDRV_CTL_ELEM_IFACE_PCM,
.name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PRO_MASK),
.info = snd_rme96_control_spdif_mask_info,
.get = snd_rme96_control_spdif_mask_get,
.private_value = IEC958_AES0_NONAUDIO |
IEC958_AES0_PROFESSIONAL |
IEC958_AES0_PRO_EMPHASIS
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Input Connector",
.info = snd_rme96_info_inputtype_control,
.get = snd_rme96_get_inputtype_control,
.put = snd_rme96_put_inputtype_control
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Loopback Input",
.info = snd_rme96_info_loopback_control,
.get = snd_rme96_get_loopback_control,
.put = snd_rme96_put_loopback_control
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Sample Clock Source",
.info = snd_rme96_info_clockmode_control,
.get = snd_rme96_get_clockmode_control,
.put = snd_rme96_put_clockmode_control
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Monitor Tracks",
.info = snd_rme96_info_montracks_control,
.get = snd_rme96_get_montracks_control,
.put = snd_rme96_put_montracks_control
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Attenuation",
.info = snd_rme96_info_attenuation_control,
.get = snd_rme96_get_attenuation_control,
.put = snd_rme96_put_attenuation_control
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "DAC Playback Volume",
.info = snd_rme96_dac_volume_info,
.get = snd_rme96_dac_volume_get,
.put = snd_rme96_dac_volume_put
}
};
static int
snd_rme96_create_switches(struct snd_card *card,
struct rme96 *rme96)
{
int idx, err;
struct snd_kcontrol *kctl;
for (idx = 0; idx < 7; idx++) {
if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_rme96_controls[idx], rme96))) < 0)
return err;
if (idx == 1) /* IEC958 (S/PDIF) Stream */
rme96->spdif_ctl = kctl;
}
if (RME96_HAS_ANALOG_OUT(rme96)) {
for (idx = 7; idx < 10; idx++)
if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_rme96_controls[idx], rme96))) < 0)
return err;
}
return 0;
}
/*
* Card initialisation
*/
static void snd_rme96_card_free(struct snd_card *card)
{
snd_rme96_free(card->private_data);
}
static int __devinit
snd_rme96_probe(struct pci_dev *pci,
const struct pci_device_id *pci_id)
{
static int dev;
struct rme96 *rme96;
struct snd_card *card;
int err;
u8 val;
if (dev >= SNDRV_CARDS) {
return -ENODEV;
}
if (!enable[dev]) {
dev++;
return -ENOENT;
}
err = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct rme96), &card);
if (err < 0)
return err;
card->private_free = snd_rme96_card_free;
rme96 = card->private_data;
rme96->card = card;
rme96->pci = pci;
snd_card_set_dev(card, &pci->dev);
if ((err = snd_rme96_create(rme96)) < 0) {
snd_card_free(card);
return err;
}
strcpy(card->driver, "Digi96");
switch (rme96->pci->device) {
case PCI_DEVICE_ID_RME_DIGI96:
strcpy(card->shortname, "RME Digi96");
break;
case PCI_DEVICE_ID_RME_DIGI96_8:
strcpy(card->shortname, "RME Digi96/8");
break;
case PCI_DEVICE_ID_RME_DIGI96_8_PRO:
strcpy(card->shortname, "RME Digi96/8 PRO");
break;
case PCI_DEVICE_ID_RME_DIGI96_8_PAD_OR_PST:
pci_read_config_byte(rme96->pci, 8, &val);
if (val < 5) {
strcpy(card->shortname, "RME Digi96/8 PAD");
} else {
strcpy(card->shortname, "RME Digi96/8 PST");
}
break;
}
sprintf(card->longname, "%s at 0x%lx, irq %d", card->shortname,
rme96->port, rme96->irq);
if ((err = snd_card_register(card)) < 0) {
snd_card_free(card);
return err;
}
pci_set_drvdata(pci, card);
dev++;
return 0;
}
static void __devexit snd_rme96_remove(struct pci_dev *pci)
{
snd_card_free(pci_get_drvdata(pci));
pci_set_drvdata(pci, NULL);
}
static struct pci_driver driver = {
.name = KBUILD_MODNAME,
.id_table = snd_rme96_ids,
.probe = snd_rme96_probe,
.remove = __devexit_p(snd_rme96_remove),
};
static int __init alsa_card_rme96_init(void)
{
return pci_register_driver(&driver);
}
static void __exit alsa_card_rme96_exit(void)
{
pci_unregister_driver(&driver);
}
module_init(alsa_card_rme96_init)
module_exit(alsa_card_rme96_exit)
| {
"pile_set_name": "Github"
} |
OPTS = -DFFMPEG -DRESAMPLE -DGPIO -DUSE_SSL
CPPFLAGS = -I/usr/local/include -I/usr/local/include/portaudio2
LDFLAGS = -L/usr/local/lib /usr/local/lib/libportaudio.a -lm
include Makefile
| {
"pile_set_name": "Github"
} |
#region File Description
//-----------------------------------------------------------------------------
// Accelerometer.cs
//
// Microsoft XNA Community Game Platform
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#endregion
#region Using Statements
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
#endregion
namespace AccelerometerSample
{
/// <summary>
/// A static encapsulation of accelerometer input to provide games with a polling-based
/// accelerometer system.
/// </summary>
public static class Accelerometer
{
#if WINDOWS_PHONE
// the accelerometer sensor on the device
private static Microsoft.Devices.Sensors.Accelerometer accelerometer = new Microsoft.Devices.Sensors.Accelerometer();
#endif
// we want to prevent the Accelerometer from being initialized twice.
private static bool isInitialized = false;
// we need an object for locking because the ReadingChanged event is fired
// on a different thread than our game
private static object threadLock = new object();
// we use this to keep the last known value from the accelerometer callback
private static Vector3 nextValue = new Vector3();
// whether or not the accelerometer is active
private static bool isActive = false;
/// <summary>
/// Initializes the Accelerometer for the current game. This method can only be called once per game.
/// </summary>
public static void Initialize()
{
// make sure we don't initialize the Accelerometer twice
if (isInitialized)
{
throw new InvalidOperationException("Initialize can only be called once");
}
#if WINDOWS_PHONE
// try to start the sensor only on devices, catching the exception if it fails
if (Microsoft.Devices.Environment.DeviceType == Microsoft.Devices.DeviceType.Device)
{
try
{
accelerometer.ReadingChanged += new EventHandler<Microsoft.Devices.Sensors.AccelerometerReadingEventArgs>(sensor_ReadingChanged);
accelerometer.Start();
isActive = true;
}
catch (Microsoft.Devices.Sensors.AccelerometerFailedException)
{
isActive = false;
}
}
else
{
// we always return isActive on emulator because we use the arrow
// keys for simulation which is always available.
isActive = true;
}
#endif
// remember that we are initialized
isInitialized = true;
}
#if WINDOWS_PHONE
private static void sensor_ReadingChanged(object sender, Microsoft.Devices.Sensors.AccelerometerReadingEventArgs e)
{
// store the accelerometer value in our variable to be used on the next Update
lock (threadLock)
{
nextValue = new Vector3((float)e.X, (float)e.Y, (float)e.Z);
}
}
#endif
/// <summary>
/// Gets the current state of the accelerometer.
/// </summary>
/// <returns>A new AccelerometerState with the current state of the accelerometer.</returns>
public static AccelerometerState GetState()
{
// make sure we've initialized the Accelerometer before we try to get the state
if (!isInitialized)
{
throw new InvalidOperationException("You must Initialize before you can call GetState");
}
// create a new value for our state
Vector3 stateValue = new Vector3();
// if the accelerometer is active
if (isActive)
{
if (Microsoft.Devices.Environment.DeviceType == Microsoft.Devices.DeviceType.Device)
{
// if we're on device, we'll just grab our latest reading from the accelerometer
lock (threadLock)
{
stateValue = nextValue;
}
}
else
{
// if we're in the emulator, we'll generate a fake acceleration value using the arrow keys
// press the pause/break key to toggle keyboard input for the emulator
KeyboardState keyboardState = Keyboard.GetState();
stateValue.Z = -1;
if (keyboardState.IsKeyDown(Keys.Left))
stateValue.X--;
if (keyboardState.IsKeyDown(Keys.Right))
stateValue.X++;
if (keyboardState.IsKeyDown(Keys.Up))
stateValue.Y++;
if (keyboardState.IsKeyDown(Keys.Down))
stateValue.Y--;
stateValue.Normalize();
}
}
return new AccelerometerState(stateValue, isActive);
}
}
/// <summary>
/// An encapsulation of the accelerometer's current state.
/// </summary>
public struct AccelerometerState
{
/// <summary>
/// Gets the accelerometer's current value in G-force.
/// </summary>
public Vector3 Acceleration { get; private set; }
/// <summary>
/// Gets whether or not the accelerometer is active and running.
/// </summary>
public bool IsActive { get; private set; }
/// <summary>
/// Initializes a new AccelerometerState.
/// </summary>
/// <param name="acceleration">The current acceleration (in G-force) of the accelerometer.</param>
/// <param name="isActive">Whether or not the accelerometer is active.</param>
public AccelerometerState(Vector3 acceleration, bool isActive)
: this()
{
Acceleration = acceleration;
IsActive = isActive;
}
/// <summary>
/// Returns a string containing the values of the Acceleration and IsActive properties.
/// </summary>
/// <returns>A new string describing the state.</returns>
public override string ToString()
{
return string.Format("Acceleration: {0}, IsActive: {1}", Acceleration, IsActive);
}
}
}
| {
"pile_set_name": "Github"
} |
'use strict';
module.exports = require('es5-ext/object/primitive-set')('key',
'value', 'key+value');
| {
"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_131) on Fri Mar 16 17:44:00 CET 2018 -->
<title>Constant Field Values (restring 1.0.0 API)</title>
<meta name="date" content="2018-03-16">
<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="Constant Field Values (restring 1.0.0 API)";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= 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="com/ice/restring/package-summary.html">Package</a></li>
<li>Class</li>
<li><a href="overview-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>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="index.html?constant-values.html" target="_top">Frames</a></li>
<li><a href="constant-values.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>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h1 title="Constant Field Values" class="title">Constant Field Values</h1>
<h2 title="Contents">Contents</h2>
</div>
<!-- ======= 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="com/ice/restring/package-summary.html">Package</a></li>
<li>Class</li>
<li><a href="overview-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>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="index.html?constant-values.html" target="_top">Frames</a></li>
<li><a href="constant-values.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>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| {
"pile_set_name": "Github"
} |
---
id: library
title: Library
sidebar_label: Library
---
## SaveTracks
> Save one or more tracks to the current user’s “Your Music” library.
**Parameters**
|Name|Description|Example|
|--------------|-------------------------|-------------------------|
|ids| A list of the Spotify IDs | `new List<String> { "3Hvu1pq89D4R0lyPBoujSv" }`
Returns a `ErrorResponse` which just contains a possible error. (`response.HasError()` and `response.Error`)
**Usage**
```csharp
ErrorResponse response = _spotify.SaveTracks(new List<string> { "3Hvu1pq89D4R0lyPBoujSv" });
if(!response.HasError())
Console.WriteLine("success");
```
---
## SaveTrack
> Save one track to the current user’s “Your Music” library.
**Parameters**
|Name|Description|Example|
|--------------|-------------------------|-------------------------|
|id| A Spotify ID | `"3Hvu1pq89D4R0lyPBoujSv"`
Returns a `ErrorResponse` which just contains a possible error. (`response.HasError()` and `response.Error`)
**Usage**
```csharp
ErrorResponse response = _spotify.SaveTrack("3Hvu1pq89D4R0lyPBoujSv");
if(!response.HasError())
Console.WriteLine("success");
```
---
## GetSavedTracks
> Get a list of the songs saved in the current Spotify user’s “Your Music” library.
**Parameters**
|Name|Description|Example|
|--------------|-------------------------|-------------------------|
|[limit]| The maximum number of objects to return. Default: 20. Minimum: 1. Maximum: 50. | `20`
|[offset]| The index of the first object to return. Default: 0 (i.e., the first object) | `0`
|[market]| An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking. | `DE`
Returns a `Paging<SavedTrack>**, **SavedTrack` contains 2 properties, `DateTime AddedAt` and `FullTrack Track`
**Usage**
```csharp
Paging<SavedTrack> savedTracks = _spotify.GetSavedTracks();
savedTracks.Items.ForEach(track => Console.WriteLine(track.Track.Name));
```
---
## RemoveSavedTracks
> Remove one or more tracks from the current user’s “Your Music” library.
**Parameters**
|Name|Description|Example|
|--------------|-------------------------|-------------------------|
|ids| A list of the Spotify IDs. | `new List<String> { "3Hvu1pq89D4R0lyPBoujSv" }`
Returns a `ErrorResponse` which just contains a possible error. (`response.HasError()` and `response.Error`)
**Usage**
```csharp
ErrorResponse response = _spotify.RemoveSavedTracks(new List<string> { "3Hvu1pq89D4R0lyPBoujSv" });
if(!response.HasError())
Console.WriteLine("success");
```
---
## CheckSavedTracks
> Check if one or more tracks is already saved in the current Spotify user’s “Your Music” library.
**Parameters**
|Name|Description|Example|
|--------------|-------------------------|-------------------------|
|ids| A list of the Spotify IDs. | `new List<String> { "3Hvu1pq89D4R0lyPBoujSv" }`
Returns a `ListResponse<bool>` which contains a property, `List<bool> List`
**Usage**
```csharp
ListResponse<bool> tracksSaved = _spotify.CheckSavedTracks(new List<String> { "3Hvu1pq89D4R0lyPBoujSv" });
if(tracksSaved.List[0])
Console.WriteLine("The track is in your library!");
```
---
## SaveAlbums
> Save one or more albums to the current user’s “Your Music” library.
**Parameters**
|Name|Description|Example|
|--------------|-------------------------|-------------------------|
|ids| A list of the Spotify IDs | `new List<String> { "1cq06d0kTUnFmJHixz1RaF" }`
Returns a `ErrorResponse` which just contains a possible error. (`response.HasError()` and `response.Error`)
**Usage**
```csharp
ErrorResponse response = _spotify.SaveAlbums(new List<string> { "1cq06d0kTUnFmJHixz1RaF" });
if(!response.HasError())
Console.WriteLine("success");
```
---
## SaveAlbum
> Save one album to the current user’s “Your Music” library.
**Parameters**
|Name|Description|Example|
|--------------|-------------------------|-------------------------|
|id| A Spotify ID | `"1cq06d0kTUnFmJHixz1RaF"`
Returns a `ErrorResponse` which just contains a possible error. (`response.HasError()` and `response.Error`)
**Usage**
```csharp
ErrorResponse response = _spotify.SaveAlbum("1cq06d0kTUnFmJHixz1RaF");
if(!response.HasError())
Console.WriteLine("success");
```
---
## GetSavedAlbums
> Get a list of the albums saved in the current Spotify user’s “Your Music” library.
**Parameters**
|Name|Description|Example|
|--------------|-------------------------|-------------------------|
|[limit]| The maximum number of objects to return. Default: 20. Minimum: 1. Maximum: 50. | `20`
|[offset]| The index of the first object to return. Default: 0 (i.e., the first object) | `0`
|[market]| An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking. | `DE`
Returns a `Paging<SavedAlbum>`, **SavedAlbum** contains 2 properties, `DateTime AddedAt` and `FullAlbum Album`
**Usage**
```csharp
Paging<SavedAlbum> savedAlbums = _spotify.GetSavedAlbums();
savedAlbums.Items.ForEach(album => Console.WriteLine(album.Album.Name));
```
---
## RemoveSavedAlbums
> Remove one or more albums from the current user’s “Your Music” library.
**Parameters**
|Name|Description|Example|
|--------------|-------------------------|-------------------------|
|ids| A list of the Spotify IDs. | `new List<String> { "1cq06d0kTUnFmJHixz1RaF" }`
Returns a `ErrorResponse` which just contains a possible error. (`response.HasError()` and `response.Error`)
**Usage**
```csharp
ErrorResponse response = _spotify.RemoveSavedAlbums(new List<string> { "1cq06d0kTUnFmJHixz1RaF" });
if(!response.HasError())
Console.WriteLine("success");
```
---
## CheckSavedAlbums
> Check if one or more albums is already saved in the current Spotify user’s “Your Music” library.
**Parameters**
|Name|Description|Example|
|--------------|-------------------------|-------------------------|
|ids| A list of the Spotify IDs. | `new List<String> { "1cq06d0kTUnFmJHixz1RaF" }`
Returns a `ListResponse<bool>` which contains a property, `List<bool> List`
**Usage**
```csharp
ListResponse<bool> albumsSaved = _spotify.CheckSavedAlbums(new List<String> { "1cq06d0kTUnFmJHixz1RaF" });
if(albumsSaved.List[0])
Console.WriteLine("The album is in your library!");
```
---
| {
"pile_set_name": "Github"
} |
import * as React from 'react';
import { CircularProgress, LoaderContainer } from './Loader.style';
interface Props {
color?: string;
margin?: string;
padding?: string;
minHeight?: string;
}
const Loader: React.FunctionComponent<Props> = props => {
const { color, margin, padding, minHeight } = props;
return (
<LoaderContainer color={color} margin={margin} padding={padding} minHeight={minHeight}>
<CircularProgress><div /><div /><div /><div /></CircularProgress>
</LoaderContainer>
);
};
export default Loader;
| {
"pile_set_name": "Github"
} |
@font-face {
font-family: 'layout';
src:url('fonts/icon.eot?-danfjo');
src:url('fonts/icon.eot?#iefix-danfjo') format('embedded-opentype'),
url('fonts/icon.woff?-danfjo') format('woff'),
url('fonts/icon.ttf?-danfjo') format('truetype'),
url('fonts/icon.svg?-danfjo#icon') format('svg');
font-weight: normal;
font-style: normal;
}
[class^="icon-"], [class*=" icon-"] {
font-family: 'layout';
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
/* Better Font Rendering =========== */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-searchfolder:before {
content: "\e602";
}
.icon-forms:before {
content: "\e606";
}
.icon-html:before {
content: "\e607";
}
.icon-settings:before {
content: "\e60c";
}
.icon-sort:before {
content: "\e600";
}
.icon-remove:before {
content: "\e604";
}
.icon-edit:before {
content: "\e605";
}
.icon-templates:before {
content: "\e608";
}
.icon-filter:before {
content: "\e609";
}
.icon-join:before {
content: "\e60a";
}
.icon-split:before {
content: "\e601";
}
.add-new-item {
cursor: pointer;
text-align: center;
border: 3px dashed #cfcfcf;
height: 50px;
margin: 20px 4px;
}
.add-new-item:hover {
background-color: #e7e7e7;
border: 3px dashed #a3a3a3;
}
.add-new-item .dashicons.dashicons-plus {
color: #cfcfcf;
font-size: 28px;
line-height: 54px;
}
.add-new-item:hover .dashicons.dashicons-plus {
color: #a3a3a3;
}
.column-tools i {
background: #FFFFFF;
border: 2px solid #EFEFEF;
color: #636363;
border-radius: 100%;
display: inline-block;
height: 20px;
margin: 9px 0 0;
padding: 1px;
text-align: center;
width: 20px;
}
.column-split,.column-join,.column-remove,.column-sort {
position: absolute;
top: -20px;
cursor: pointer;
display:block;
width:10px;
text-align: center;
}
.column-sort.column-tools {
width: 25px;
right: 0;
}
.column-config.column-tools {
left: -20px;
position: absolute;
top: 29%;
}
.column-config.column-tools i {
border: 2px solid #CFCFCF;
height: 23px;
padding: 3px;
width: 23px;
}
.column-sort .icon-edit {
margin-right: 15px;
}
.column-sort .icon-sort{
right:0;
cursor: all-scroll;
}
.column-sort .icon-edit{
left:0;
cursor: pointer;
}
.column-tools .icon-join {
margin-left: -6px;
}
.column-tools .icon-split{
margin-left: -5px;
}
.column-tools .dashicons.dashicons-leftright {
font-size: 17px;
padding: 0;
margin-left: -5px;
}
.dashicons.dashicons-menu.drag-handle.sort-handle {
font-size: 14px;
cursor: all-scroll;
}
.layout-grid .row-drop-helper {
background: #e7e7e7;
min-height: 110px;
margin: 20px 2px 0;
}
.layout-grid-tools {
background: #f5f5f5;
margin: -6px -12px 6px;
padding: 12px;
border-bottom: 1px solid #EEEEEE;
}
.mailer-control-panel .caldera-config-group .caldera-config-field{
max-width: 400px;
}
.layout-grid .layout-column {
background-color: #FFF;
border: 0 solid #DDDDDD;
border-radius: 2px;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
margin: 15px 3px 0;
min-height: 50px;
padding: 12px 0;
position: relative;
}
.column-fieldinsert .dashicons.dashicons-admin-generic,
.column-fieldinsert .dashicons.dashicons-plus-alt {
background: none repeat scroll 0 0 #EFEFEF;
color: #6C6C6C;
font-size: 13px;
margin-top: -3px;
padding: 2px;
}
.column-fieldinsert.column-tools ,
.column-fieldinsert.column-tools {
bottom: -10px;
left: 50%;
margin-left: -10px;
position: absolute;
cursor: pointer;
}
.row.active .layout-column.column-container {
border-radius: 4px;
box-shadow: 0 3px 10px 7px rgba(0, 0, 0, 0.1);
padding: 5px;
}
.inner-row-level .layout-column {
background: none repeat scroll 0 0 #E8E8E8;
}
.layout-column > .button{
width: 100%;
}
.template-element {
-o-box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
background: none repeat scroll 0 0 #FAFAFA;
border: 1px solid #CFCFCF;
border-radius: 2px;
cursor: pointer;
display: block;
font-size: 13px;
height: 28px;
line-height: 26px;
margin: 0 0 -1px;
padding: 0 10px 1px;
text-decoration: none;
white-space: nowrap;
overflow: hidden;
}
.template-element{
overflow: hidden;
cursor: default;
}
.layout-template-tray {
max-height: 450px;
overflow: auto;
}
.layout-template-tray .template-element{
width: 100%;
margin-bottom: 5px;
}
.layout-column .template-element:hover {
min-width: 260px;
position: relative;
z-index: 501;
}
.template-element.ui-draggable-dragging{
width: 200px;
}
.column-merge{
background: rgba(0, 0, 0, 0.1);
cursor: col-resize;
height: 100%;
margin: 0;
position: absolute;
width: 8px;
z-index: 100;
border-radius: 2px;
top: 0;
left: -12px;
z-index: 98;
}
.column-merge.dragging{
background: rgba(0, 0, 0, 0.5);
}
.column-merge.ui-draggable-dragging{
background: rgba(0, 0, 0, 0);
opacity: 0;
}
.layout-grid .row.sizing{
cursor: all-scroll;
}
.layout-grid .layout-form-field:hover {
min-width: 250px;
position: relative;
z-index: 100;
}
.layout-grid .row.sizing .layout-form-field:hover {
min-width: 0;
}
.layout-grid .layout-form-field:hover .dashicons-admin-page,
.layout-grid .layout-form-field:hover .icon-edit {
cursor: pointer;
display: block !important;
}
.layout-grid .layout-form-field.button-primary .icon-edit {
display: none !important;
}
.mini-mode .preview-caldera-config-group {
padding: 0 5px;
}
.mini-mode .preview-caldera-config-field{
display: none;
}
.mini-mode .layout-form-field {
padding: 0 5px;
}
.mini-mode .layout-form-field .icon-edit{
top: 4px;
right: 9px;
}
.mini-mode .field_preview {
min-height: 31px;
}
.mini-mode .layout-column {
margin-top: 8px;
}
.layout-template-tray .template-element,
.layout-grid-tools .template-element{
cursor: move;
}
.layout-grid .container-button{
height: auto;
overflow: hidden;
}
.layout-grid .template-element:hover{
overflow: visible;
position: relative;
}
.layout-grid .template-element{
width: 100%;
clear: both;
}
.layout-grid .query-container {
min-height: 50px;
padding: 5px 0 12px;
white-space: normal;
}
.template-element:active,
.container-button {
background: none repeat scroll 0 0 #F7F7F7;
border-color: #CCCCCC;
box-shadow: 0 1px 0 #FFFFFF inset, 0 1px 0 rgba(0, 0, 0, 0.08);
color: #555555;
vertical-align: top;
}
.settings-panel {
display: none;
margin: 2px -10px 5px;
padding: 7px 6px;
}
.caldera-condition-group {
background: none repeat scroll 0 0 #FFFFFF;
border: 1px solid #DFDFDF;
margin-bottom: 24px;
padding: 6px;
position: relative;
}
.caldera-condition-lines {
clear: both;
margin-bottom: 8px;
}
.caldera-condition-line{
margin-top: 6px;
}
.caldera-condition-line-label{
display: inline;
}
.caldera-condition-group-label {
line-height: 0;
position: absolute;
top: -14px;
}
.caldera-condition-group:first-child .caldera-condition-group-label,
.caldera-condition-line:first-child .caldera-condition-line-label{
display: none;
}
.caldera-editor-field-config-wrapper .caldera-conditional-field-value {
display: inline-block;
margin: 12px 12px 0 0;
position: relative;
}
.caldera-editor-field-config-wrapper .caldera-conditional-value-field {
max-width: 263px !important;
width: 263px !important;
}
.caldera-editor-field-config-wrapper .button.remove-conditional-line.pull-right {
margin-top: -12px;
}
.icn-code.magic-tag-init {
background: none repeat scroll 0 0 #f9f9f9;
border-bottom: 1px solid #ddd;
border-left: 1px solid #ddd;
cursor: pointer;
opacity: 0.5;
padding: 7px 6px 6px;
position: absolute;
right: 1px;
top: 2px;
}
.icn-code.magic-tag-init:hover {
color: #404040;
opacity: 1;
}
.magic-tag-enabled {
padding-right: 26px;
line-height: 20px;
}
textarea.magic-tag-enabled {
resize: vertical;
}
.settings-panel.settings-core{ display: block;}
.layout-new-form-field .drag-handle,
.layout-form-field .drag-handle {
cursor: move;
overflow: hidden;
text-overflow: ellipsis;
}
.settings-panel-row {
margin: 5px -6px 0;
padding: 6px 8px 1px;
}
.settings-panel-row select{
max-width: 130px;
}
.container-button.edit-open {
min-width: 100%;
overflow: visible;
position: relative;
width: auto;
z-index: 101;
}
.template-element.ui-draggable-dragging{
z-index: 1000;
}
.layout-form-field.ui-sortable-placeholder {
background-color: #f8f8f8;
border-bottom: 1px dashed #dedede;
border-top: 1px dashed #dedede;
visibility: visible !important;
min-height: 50px;
}
.ui-sortable-helper{overflow: hidden;}
.layout-grid article,.layout-grid aside,.layout-grid details,.layout-grid figcaption,.layout-grid figure,.layout-grid footer,.layout-grid header,.layout-grid hgroup,.layout-grid main,.layout-grid nav,.layout-grid section,.layout-grid summary{display:block;}
.layout-grid audio,.layout-grid canvas,.layout-grid video{display:inline-block;}
.layout-grid audio:not([controls]){display:none;height:0;}
.layout-grid [hidden],.layout-grid template{display:none;}
.layout-grid html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;}
.layout-grid body{margin:0;}
.layout-grid a{background:transparent;}
.layout-grid a:focus{outline:thin dotted;}
.layout-grid a:active,.layout-grid a:hover{outline:0;}
.layout-grid h1{font-size:2em;margin:0.67em 0;}
.layout-grid abbr[title]{border-bottom:1px dotted;}
.layout-grid b,.layout-grid strong{font-weight:bold;}
.layout-grid dfn{font-style:italic;}
.layout-grid hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0;}
.layout-grid mark{background:#ff0;color:#000;}
.layout-grid code,.layout-grid kbd,.layout-grid pre,.layout-grid samp{font-family:monospace, serif;font-size:1em;}
.layout-grid pre{white-space:pre-wrap;}
.layout-grid q{quotes:"\201C" "\201D" "\2018" "\2019";}
.layout-grid small{font-size:80%;}
.layout-grid sub,.layout-grid sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline;}
.layout-grid sup{top:-0.5em;}
.layout-grid sub{bottom:-0.25em;}
.layout-grid img{border:0;}
.layout-grid svg:not(:root){overflow:hidden;}
.layout-grid figure{margin:0;}
.layout-grid fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em;}
.layout-grid legend{border:0;padding:0;}
.layout-grid button,.layout-grid input,.layout-grid select,.layout-grid textarea{font-family:inherit;font-size:100%;margin:0;}
.layout-grid button,.layout-grid input{line-height:normal;}
.layout-grid button,.layout-grid select{text-transform:none;}
.layout-grid button,.layout-grid html input[type="button"],.layout-grid input[type="reset"],.layout-grid input[type="submit"]{-webkit-appearance:button;cursor:pointer;}
.layout-grid button[disabled],.layout-grid html input[disabled]{cursor:default;}
.layout-grid input[type="checkbox"],.layout-grid input[type="radio"]{box-sizing:border-box;padding:0;}
.layout-grid input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;}
.layout-grid input[type="search"]::-webkit-search-cancel-button,.layout-grid input[type="search"]::-webkit-search-decoration{-webkit-appearance:none;}
.layout-grid button::-moz-focus-inner,.layout-grid input::-moz-focus-inner{border:0;padding:0;}
.layout-grid textarea{overflow:auto;vertical-align:top;}
.layout-grid table{border-collapse:collapse;border-spacing:0;}
.layout-grid *,.layout-grid *:before,.layout-grid *:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;}
.layout-grid html{font-size:62.5%;-webkit-tap-highlight-color:rgba(0, 0, 0, 0);}
.layout-grid body{font-family:"Open Sans",Arial,Verdana,sans-serif;font-size:14px;line-height:1.5;color:#505050;background-color:#e5e5e5;}
.layout-grid input,.layout-grid button,.layout-grid select,.layout-grid textarea{font-family:inherit;font-size:inherit;line-height:inherit;}
.layout-grid a{color:#7f857d;text-decoration:none;}.layout-grid a:hover,.layout-grid a:focus{color:#595e58;text-decoration:underline;}
.layout-grid a:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px;}
.layout-grid img{vertical-align:middle;}
.layout-grid .img-responsive{display:block;max-width:100%;height:auto;}
.layout-grid .img-rounded{border-radius:3px;}
.layout-grid .img-thumbnail{padding:4px;line-height:1.5;background-color:#ffffff;border:1px solid #dddddd;border-radius:2px;-webkit-transition:all 0.2s ease-in-out;transition:all 0.2s ease-in-out;display:inline-block;max-width:100%;height:auto;}
.layout-grid .img-circle{border-radius:50%;}
.layout-grid hr{margin-top:21px;margin-bottom:21px;border:0;border-top:1px solid #ccd0d2;}
.layout-grid .sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0, 0, 0, 0);border:0;}
.layout-grid .container{margin-right:auto;margin-left:auto;padding-left:5px;padding-right:5px;}.layout-grid .container:before,.layout-grid .container:after{content:" ";display:table;}
.layout-grid .container:after{clear:both;}
.layout-grid .container:before,.layout-grid .container:after{content:" ";display:table;}
.layout-grid .container:after{clear:both;}
.layout-grid .row{margin-left:-5px;margin-right:-5px;}.layout-grid .row:before,.layout-grid .row:after{content:" ";display:table;}
.layout-grid .row:after{clear:both;}
.layout-grid .row:before,.layout-grid .row:after{content:" ";display:table;}
.layout-grid .row:after{clear:both;}
.layout-grid .col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12{position:relative;min-height:1px;padding-left:5px;padding-right:5px;}
.layout-grid .col-xs-1, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9, .col-xs-10, .col-xs-11{float:left;}
.layout-grid .col-xs-12{width:100%;}
.layout-grid .col-xs-11{width:91.66666666666666%;}
.layout-grid .col-xs-10{width:83.33333333333334%;}
.layout-grid .col-xs-9{width:75%;}
.layout-grid .col-xs-8{width:66.66666666666666%;}
.layout-grid .col-xs-7{width:58.333333333333336%;}
.layout-grid .col-xs-6{width:50%;}
.layout-grid .col-xs-5{width:41.66666666666667%;}
.layout-grid .col-xs-4{width:33.33333333333333%;}
.layout-grid .col-xs-3{width:25%;}
.layout-grid .col-xs-2{width:16.666666666666664%;}
.layout-grid .col-xs-1{width:8.333333333333332%;}
.layout-grid .col-xs-pull-12{right:100%;}
.layout-grid .col-xs-pull-11{right:91.66666666666666%;}
.layout-grid .col-xs-pull-10{right:83.33333333333334%;}
.layout-grid .col-xs-pull-9{right:75%;}
.layout-grid .col-xs-pull-8{right:66.66666666666666%;}
.layout-grid .col-xs-pull-7{right:58.333333333333336%;}
.layout-grid .col-xs-pull-6{right:50%;}
.layout-grid .col-xs-pull-5{right:41.66666666666667%;}
.layout-grid .col-xs-pull-4{right:33.33333333333333%;}
.layout-grid .col-xs-pull-3{right:25%;}
.layout-grid .col-xs-pull-2{right:16.666666666666664%;}
.layout-grid .col-xs-pull-1{right:8.333333333333332%;}
.layout-grid .col-xs-pull-0{right:0%;}
.layout-grid .col-xs-push-12{left:100%;}
.layout-grid .col-xs-push-11{left:91.66666666666666%;}
.layout-grid .col-xs-push-10{left:83.33333333333334%;}
.layout-grid .col-xs-push-9{left:75%;}
.layout-grid .col-xs-push-8{left:66.66666666666666%;}
.layout-grid .col-xs-push-7{left:58.333333333333336%;}
.layout-grid .col-xs-push-6{left:50%;}
.layout-grid .col-xs-push-5{left:41.66666666666667%;}
.layout-grid .col-xs-push-4{left:33.33333333333333%;}
.layout-grid .col-xs-push-3{left:25%;}
.layout-grid .col-xs-push-2{left:16.666666666666664%;}
.layout-grid .col-xs-push-1{left:8.333333333333332%;}
.layout-grid .col-xs-push-0{left:0%;}
.layout-grid .col-xs-offset-12{margin-left:100%;}
.layout-grid .col-xs-offset-11{margin-left:91.66666666666666%;}
.layout-grid .col-xs-offset-10{margin-left:83.33333333333334%;}
.layout-grid .col-xs-offset-9{margin-left:75%;}
.layout-grid .col-xs-offset-8{margin-left:66.66666666666666%;}
.layout-grid .col-xs-offset-7{margin-left:58.333333333333336%;}
.layout-grid .col-xs-offset-6{margin-left:50%;}
.layout-grid .col-xs-offset-5{margin-left:41.66666666666667%;}
.layout-grid .col-xs-offset-4{margin-left:33.33333333333333%;}
.layout-grid .col-xs-offset-3{margin-left:25%;}
.layout-grid .col-xs-offset-2{margin-left:16.666666666666664%;}
.layout-grid .col-xs-offset-1{margin-left:8.333333333333332%;}
.layout-grid .col-xs-offset-0{margin-left:0%;}
@media (min-width:768px){.layout-grid .container{width:730px;} .layout-grid .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11{float:left;} .layout-grid .col-sm-12{width:100%;} .layout-grid .col-sm-11{width:91.66666666666666%;} .layout-grid .col-sm-10{width:83.33333333333334%;} .layout-grid .col-sm-9{width:75%;} .layout-grid .col-sm-8{width:66.66666666666666%;} .layout-grid .col-sm-7{width:58.333333333333336%;} .layout-grid .col-sm-6{width:50%;} .layout-grid .col-sm-5{width:41.66666666666667%;} .layout-grid .col-sm-4{width:33.33333333333333%;} .layout-grid .col-sm-3{width:25%;} .layout-grid .col-sm-2{width:16.666666666666664%;} .layout-grid .col-sm-1{width:8.333333333333332%;} .layout-grid .col-sm-pull-12{right:100%;} .layout-grid .col-sm-pull-11{right:91.66666666666666%;} .layout-grid .col-sm-pull-10{right:83.33333333333334%;} .layout-grid .col-sm-pull-9{right:75%;} .layout-grid .col-sm-pull-8{right:66.66666666666666%;} .layout-grid .col-sm-pull-7{right:58.333333333333336%;} .layout-grid .col-sm-pull-6{right:50%;} .layout-grid .col-sm-pull-5{right:41.66666666666667%;} .layout-grid .col-sm-pull-4{right:33.33333333333333%;} .layout-grid .col-sm-pull-3{right:25%;} .layout-grid .col-sm-pull-2{right:16.666666666666664%;} .layout-grid .col-sm-pull-1{right:8.333333333333332%;} .layout-grid .col-sm-pull-0{right:0%;} .layout-grid .col-sm-push-12{left:100%;} .layout-grid .col-sm-push-11{left:91.66666666666666%;} .layout-grid .col-sm-push-10{left:83.33333333333334%;} .layout-grid .col-sm-push-9{left:75%;} .layout-grid .col-sm-push-8{left:66.66666666666666%;} .layout-grid .col-sm-push-7{left:58.333333333333336%;} .layout-grid .col-sm-push-6{left:50%;} .layout-grid .col-sm-push-5{left:41.66666666666667%;} .layout-grid .col-sm-push-4{left:33.33333333333333%;} .layout-grid .col-sm-push-3{left:25%;} .layout-grid .col-sm-push-2{left:16.666666666666664%;} .layout-grid .col-sm-push-1{left:8.333333333333332%;} .layout-grid .col-sm-push-0{left:0%;} .layout-grid .col-sm-offset-12{margin-left:100%;} .layout-grid .col-sm-offset-11{margin-left:91.66666666666666%;} .layout-grid .col-sm-offset-10{margin-left:83.33333333333334%;} .layout-grid .col-sm-offset-9{margin-left:75%;} .layout-grid .col-sm-offset-8{margin-left:66.66666666666666%;} .layout-grid .col-sm-offset-7{margin-left:58.333333333333336%;} .layout-grid .col-sm-offset-6{margin-left:50%;} .layout-grid .col-sm-offset-5{margin-left:41.66666666666667%;} .layout-grid .col-sm-offset-4{margin-left:33.33333333333333%;} .layout-grid .col-sm-offset-3{margin-left:25%;} .layout-grid .col-sm-offset-2{margin-left:16.666666666666664%;} .layout-grid .col-sm-offset-1{margin-left:8.333333333333332%;} .layout-grid .col-sm-offset-0{margin-left:0%;}}@media (min-width:992px){.layout-grid .container{width:950px;} .layout-grid .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11{float:left;} .layout-grid .col-md-12{width:100%;} .layout-grid .col-md-11{width:91.66666666666666%;} .layout-grid .col-md-10{width:83.33333333333334%;} .layout-grid .col-md-9{width:75%;} .layout-grid .col-md-8{width:66.66666666666666%;} .layout-grid .col-md-7{width:58.333333333333336%;} .layout-grid .col-md-6{width:50%;} .layout-grid .col-md-5{width:41.66666666666667%;} .layout-grid .col-md-4{width:33.33333333333333%;} .layout-grid .col-md-3{width:25%;} .layout-grid .col-md-2{width:16.666666666666664%;} .layout-grid .col-md-1{width:8.333333333333332%;} .layout-grid .col-md-pull-12{right:100%;} .layout-grid .col-md-pull-11{right:91.66666666666666%;} .layout-grid .col-md-pull-10{right:83.33333333333334%;} .layout-grid .col-md-pull-9{right:75%;} .layout-grid .col-md-pull-8{right:66.66666666666666%;} .layout-grid .col-md-pull-7{right:58.333333333333336%;} .layout-grid .col-md-pull-6{right:50%;} .layout-grid .col-md-pull-5{right:41.66666666666667%;} .layout-grid .col-md-pull-4{right:33.33333333333333%;} .layout-grid .col-md-pull-3{right:25%;} .layout-grid .col-md-pull-2{right:16.666666666666664%;} .layout-grid .col-md-pull-1{right:8.333333333333332%;} .layout-grid .col-md-pull-0{right:0%;} .layout-grid .col-md-push-12{left:100%;} .layout-grid .col-md-push-11{left:91.66666666666666%;} .layout-grid .col-md-push-10{left:83.33333333333334%;} .layout-grid .col-md-push-9{left:75%;} .layout-grid .col-md-push-8{left:66.66666666666666%;} .layout-grid .col-md-push-7{left:58.333333333333336%;} .layout-grid .col-md-push-6{left:50%;} .layout-grid .col-md-push-5{left:41.66666666666667%;} .layout-grid .col-md-push-4{left:33.33333333333333%;} .layout-grid .col-md-push-3{left:25%;} .layout-grid .col-md-push-2{left:16.666666666666664%;} .layout-grid .col-md-push-1{left:8.333333333333332%;} .layout-grid .col-md-push-0{left:0%;} .layout-grid .col-md-offset-12{margin-left:100%;} .layout-grid .col-md-offset-11{margin-left:91.66666666666666%;} .layout-grid .col-md-offset-10{margin-left:83.33333333333334%;} .layout-grid .col-md-offset-9{margin-left:75%;} .layout-grid .col-md-offset-8{margin-left:66.66666666666666%;} .layout-grid .col-md-offset-7{margin-left:58.333333333333336%;} .layout-grid .col-md-offset-6{margin-left:50%;} .layout-grid .col-md-offset-5{margin-left:41.66666666666667%;} .layout-grid .col-md-offset-4{margin-left:33.33333333333333%;} .layout-grid .col-md-offset-3{margin-left:25%;} .layout-grid .col-md-offset-2{margin-left:16.666666666666664%;} .layout-grid .col-md-offset-1{margin-left:8.333333333333332%;} .layout-grid .col-md-offset-0{margin-left:0%;}}@media (min-width:1200px){.layout-grid .container{width:1150px;} .layout-grid .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11{float:left;} .layout-grid .col-lg-12{width:100%;} .layout-grid .col-lg-11{width:91.66666666666666%;} .layout-grid .col-lg-10{width:83.33333333333334%;} .layout-grid .col-lg-9{width:75%;} .layout-grid .col-lg-8{width:66.66666666666666%;} .layout-grid .col-lg-7{width:58.333333333333336%;} .layout-grid .col-lg-6{width:50%;} .layout-grid .col-lg-5{width:41.66666666666667%;} .layout-grid .col-lg-4{width:33.33333333333333%;} .layout-grid .col-lg-3{width:25%;} .layout-grid .col-lg-2{width:16.666666666666664%;} .layout-grid .col-lg-1{width:8.333333333333332%;} .layout-grid .col-lg-pull-12{right:100%;} .layout-grid .col-lg-pull-11{right:91.66666666666666%;} .layout-grid .col-lg-pull-10{right:83.33333333333334%;} .layout-grid .col-lg-pull-9{right:75%;} .layout-grid .col-lg-pull-8{right:66.66666666666666%;} .layout-grid .col-lg-pull-7{right:58.333333333333336%;} .layout-grid .col-lg-pull-6{right:50%;} .layout-grid .col-lg-pull-5{right:41.66666666666667%;} .layout-grid .col-lg-pull-4{right:33.33333333333333%;} .layout-grid .col-lg-pull-3{right:25%;} .layout-grid .col-lg-pull-2{right:16.666666666666664%;} .layout-grid .col-lg-pull-1{right:8.333333333333332%;} .layout-grid .col-lg-pull-0{right:0%;} .layout-grid .col-lg-push-12{left:100%;} .layout-grid .col-lg-push-11{left:91.66666666666666%;} .layout-grid .col-lg-push-10{left:83.33333333333334%;} .layout-grid .col-lg-push-9{left:75%;} .layout-grid .col-lg-push-8{left:66.66666666666666%;} .layout-grid .col-lg-push-7{left:58.333333333333336%;} .layout-grid .col-lg-push-6{left:50%;} .layout-grid .col-lg-push-5{left:41.66666666666667%;} .layout-grid .col-lg-push-4{left:33.33333333333333%;} .layout-grid .col-lg-push-3{left:25%;} .layout-grid .col-lg-push-2{left:16.666666666666664%;} .layout-grid .col-lg-push-1{left:8.333333333333332%;} .layout-grid .col-lg-push-0{left:0%;} .layout-grid .col-lg-offset-12{margin-left:100%;} .layout-grid .col-lg-offset-11{margin-left:91.66666666666666%;} .layout-grid .col-lg-offset-10{margin-left:83.33333333333334%;} .layout-grid .col-lg-offset-9{margin-left:75%;} .layout-grid .col-lg-offset-8{margin-left:66.66666666666666%;} .layout-grid .col-lg-offset-7{margin-left:58.333333333333336%;} .layout-grid .col-lg-offset-6{margin-left:50%;} .layout-grid .col-lg-offset-5{margin-left:41.66666666666667%;} .layout-grid .col-lg-offset-4{margin-left:33.33333333333333%;} .layout-grid .col-lg-offset-3{margin-left:25%;} .layout-grid .col-lg-offset-2{margin-left:16.666666666666664%;} .layout-grid .col-lg-offset-1{margin-left:8.333333333333332%;} .layout-grid .col-lg-offset-0{margin-left:0%;}}.layout-grid .clearfix:before,.layout-grid .clearfix:after{content:" ";display:table;}
.layout-grid .clearfix:after{clear:both;}
.layout-grid .center-block{display:block;margin-left:auto;margin-right:auto;}
.layout-grid .pull-right{float:right !important;}
.layout-grid .pull-left{float:left !important;}
.layout-grid .hide{display:none !important;}
.layout-grid .show{display:block !important;}
.layout-grid .invisible{visibility:hidden;}
.layout-grid .text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0;}
.layout-grid .hidden{display:none !important;visibility:hidden !important;}
.layout-grid .affix{position:fixed;}
@-ms-viewport{width:device-width;}.layout-grid .visible-xs,tr.layout-grid .visible-xs,th.layout-grid .visible-xs,td.layout-grid .visible-xs{display:none !important;}
@media (max-width:767px){.layout-grid .visible-xs{display:block !important;}tr.layout-grid .visible-xs{display:table-row !important;} th.layout-grid .visible-xs,td.layout-grid .visible-xs{display:table-cell !important;}}@media (min-width:768px) and (max-width:991px){.layout-grid .visible-xs.visible-sm{display:block !important;}tr.layout-grid .visible-xs.visible-sm{display:table-row !important;} th.layout-grid .visible-xs.visible-sm,td.layout-grid .visible-xs.visible-sm{display:table-cell !important;}}
@media (min-width:992px) and (max-width:1199px){.layout-grid .visible-xs.visible-md{display:block !important;}tr.layout-grid .visible-xs.visible-md{display:table-row !important;} th.layout-grid .visible-xs.visible-md,td.layout-grid .visible-xs.visible-md{display:table-cell !important;}}
@media (min-width:1200px){.layout-grid .visible-xs.visible-lg{display:block !important;}tr.layout-grid .visible-xs.visible-lg{display:table-row !important;} th.layout-grid .visible-xs.visible-lg,td.layout-grid .visible-xs.visible-lg{display:table-cell !important;}}
.layout-grid .visible-sm,tr.layout-grid .visible-sm,th.layout-grid .visible-sm,td.layout-grid .visible-sm{display:none !important;}
@media (max-width:767px){.layout-grid .visible-sm.visible-xs{display:block !important;}tr.layout-grid .visible-sm.visible-xs{display:table-row !important;} th.layout-grid .visible-sm.visible-xs,td.layout-grid .visible-sm.visible-xs{display:table-cell !important;}}
@media (min-width:768px) and (max-width:991px){.layout-grid .visible-sm{display:block !important;}tr.layout-grid .visible-sm{display:table-row !important;} th.layout-grid .visible-sm,td.layout-grid .visible-sm{display:table-cell !important;}}@media (min-width:992px) and (max-width:1199px){.layout-grid .visible-sm.visible-md{display:block !important;}tr.layout-grid .visible-sm.visible-md{display:table-row !important;} th.layout-grid .visible-sm.visible-md,td.layout-grid .visible-sm.visible-md{display:table-cell !important;}}
@media (min-width:1200px){.layout-grid .visible-sm.visible-lg{display:block !important;}tr.layout-grid .visible-sm.visible-lg{display:table-row !important;} th.layout-grid .visible-sm.visible-lg,td.layout-grid .visible-sm.visible-lg{display:table-cell !important;}}
.layout-grid .visible-md,tr.layout-grid .visible-md,th.layout-grid .visible-md,td.layout-grid .visible-md{display:none !important;}
@media (max-width:767px){.layout-grid .visible-md.visible-xs{display:block !important;}tr.layout-grid .visible-md.visible-xs{display:table-row !important;} th.layout-grid .visible-md.visible-xs,td.layout-grid .visible-md.visible-xs{display:table-cell !important;}}
@media (min-width:768px) and (max-width:991px){.layout-grid .visible-md.visible-sm{display:block !important;}tr.layout-grid .visible-md.visible-sm{display:table-row !important;} th.layout-grid .visible-md.visible-sm,td.layout-grid .visible-md.visible-sm{display:table-cell !important;}}
@media (min-width:992px) and (max-width:1199px){.layout-grid .visible-md{display:block !important;}tr.layout-grid .visible-md{display:table-row !important;} th.layout-grid .visible-md,td.layout-grid .visible-md{display:table-cell !important;}}@media (min-width:1200px){.layout-grid .visible-md.visible-lg{display:block !important;}tr.layout-grid .visible-md.visible-lg{display:table-row !important;} th.layout-grid .visible-md.visible-lg,td.layout-grid .visible-md.visible-lg{display:table-cell !important;}}
.layout-grid .visible-lg,tr.layout-grid .visible-lg,th.layout-grid .visible-lg,td.layout-grid .visible-lg{display:none !important;}
@media (max-width:767px){.layout-grid .visible-lg.visible-xs{display:block !important;}tr.layout-grid .visible-lg.visible-xs{display:table-row !important;} th.layout-grid .visible-lg.visible-xs,td.layout-grid .visible-lg.visible-xs{display:table-cell !important;}}
@media (min-width:768px) and (max-width:991px){.layout-grid .visible-lg.visible-sm{display:block !important;}tr.layout-grid .visible-lg.visible-sm{display:table-row !important;} th.layout-grid .visible-lg.visible-sm,td.layout-grid .visible-lg.visible-sm{display:table-cell !important;}}
@media (min-width:992px) and (max-width:1199px){.layout-grid .visible-lg.visible-md{display:block !important;}tr.layout-grid .visible-lg.visible-md{display:table-row !important;} th.layout-grid .visible-lg.visible-md,td.layout-grid .visible-lg.visible-md{display:table-cell !important;}}
@media (min-width:1200px){.layout-grid .visible-lg{display:block !important;}tr.layout-grid .visible-lg{display:table-row !important;} th.layout-grid .visible-lg,td.layout-grid .visible-lg{display:table-cell !important;}}
.layout-grid .hidden-xs{display:block !important;}tr.layout-grid .hidden-xs{display:table-row !important;}
th.layout-grid .hidden-xs,td.layout-grid .hidden-xs{display:table-cell !important;}
@media (max-width:767px){.layout-grid .hidden-xs,tr.layout-grid .hidden-xs,th.layout-grid .hidden-xs,td.layout-grid .hidden-xs{display:none !important;}}@media (min-width:768px) and (max-width:991px){.layout-grid .hidden-xs.hidden-sm,tr.layout-grid .hidden-xs.hidden-sm,th.layout-grid .hidden-xs.hidden-sm,td.layout-grid .hidden-xs.hidden-sm{display:none !important;}}
@media (min-width:992px) and (max-width:1199px){.layout-grid .hidden-xs.hidden-md,tr.layout-grid .hidden-xs.hidden-md,th.layout-grid .hidden-xs.hidden-md,td.layout-grid .hidden-xs.hidden-md{display:none !important;}}
@media (min-width:1200px){.layout-grid .hidden-xs.hidden-lg,tr.layout-grid .hidden-xs.hidden-lg,th.layout-grid .hidden-xs.hidden-lg,td.layout-grid .hidden-xs.hidden-lg{display:none !important;}}
.layout-grid .hidden-sm{display:block !important;}tr.layout-grid .hidden-sm{display:table-row !important;}
th.layout-grid .hidden-sm,td.layout-grid .hidden-sm{display:table-cell !important;}
@media (max-width:767px){.layout-grid .hidden-sm.hidden-xs,tr.layout-grid .hidden-sm.hidden-xs,th.layout-grid .hidden-sm.hidden-xs,td.layout-grid .hidden-sm.hidden-xs{display:none !important;}}
@media (min-width:768px) and (max-width:991px){.layout-grid .hidden-sm,tr.layout-grid .hidden-sm,th.layout-grid .hidden-sm,td.layout-grid .hidden-sm{display:none !important;}}@media (min-width:992px) and (max-width:1199px){.layout-grid .hidden-sm.hidden-md,tr.layout-grid .hidden-sm.hidden-md,th.layout-grid .hidden-sm.hidden-md,td.layout-grid .hidden-sm.hidden-md{display:none !important;}}
@media (min-width:1200px){.layout-grid .hidden-sm.hidden-lg,tr.layout-grid .hidden-sm.hidden-lg,th.layout-grid .hidden-sm.hidden-lg,td.layout-grid .hidden-sm.hidden-lg{display:none !important;}}
.layout-grid .hidden-md{display:block !important;}tr.layout-grid .hidden-md{display:table-row !important;}
th.layout-grid .hidden-md,td.layout-grid .hidden-md{display:table-cell !important;}
@media (max-width:767px){.layout-grid .hidden-md.hidden-xs,tr.layout-grid .hidden-md.hidden-xs,th.layout-grid .hidden-md.hidden-xs,td.layout-grid .hidden-md.hidden-xs{display:none !important;}}
@media (min-width:768px) and (max-width:991px){.layout-grid .hidden-md.hidden-sm,tr.layout-grid .hidden-md.hidden-sm,th.layout-grid .hidden-md.hidden-sm,td.layout-grid .hidden-md.hidden-sm{display:none !important;}}
@media (min-width:992px) and (max-width:1199px){.layout-grid .hidden-md,tr.layout-grid .hidden-md,th.layout-grid .hidden-md,td.layout-grid .hidden-md{display:none !important;}}@media (min-width:1200px){.layout-grid .hidden-md.hidden-lg,tr.layout-grid .hidden-md.hidden-lg,th.layout-grid .hidden-md.hidden-lg,td.layout-grid .hidden-md.hidden-lg{display:none !important;}}
.layout-grid .hidden-lg{display:block !important;}tr.layout-grid .hidden-lg{display:table-row !important;}
th.layout-grid .hidden-lg,td.layout-grid .hidden-lg{display:table-cell !important;}
@media (max-width:767px){.layout-grid .hidden-lg.hidden-xs,tr.layout-grid .hidden-lg.hidden-xs,th.layout-grid .hidden-lg.hidden-xs,td.layout-grid .hidden-lg.hidden-xs{display:none !important;}}
@media (min-width:768px) and (max-width:991px){.layout-grid .hidden-lg.hidden-sm,tr.layout-grid .hidden-lg.hidden-sm,th.layout-grid .hidden-lg.hidden-sm,td.layout-grid .hidden-lg.hidden-sm{display:none !important;}}
@media (min-width:992px) and (max-width:1199px){.layout-grid .hidden-lg.hidden-md,tr.layout-grid .hidden-lg.hidden-md,th.layout-grid .hidden-lg.hidden-md,td.layout-grid .hidden-lg.hidden-md{display:none !important;}}
@media (min-width:1200px){.layout-grid .hidden-lg,tr.layout-grid .hidden-lg,th.layout-grid .hidden-lg,td.layout-grid .hidden-lg{display:none !important;}}
.layout-grid .visible-print,tr.layout-grid .visible-print,th.layout-grid .visible-print,td.layout-grid .visible-print{display:none !important;}
@media print{.layout-grid .visible-print{display:block !important;}tr.layout-grid .visible-print{display:table-row !important;} th.layout-grid .visible-print,td.layout-grid .visible-print{display:table-cell !important;} .layout-grid .hidden-print,tr.layout-grid .hidden-print,th.layout-grid .hidden-print,td.layout-grid .hidden-print{display:none !important;}}
| {
"pile_set_name": "Github"
} |
#ifndef BOOST_SERIALIZATION_NVP_HPP
#define BOOST_SERIALIZATION_NVP_HPP
// MS compatible compilers support #pragma once
#if defined(_MSC_VER)
# pragma once
#endif
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// nvp.hpp: interface for serialization system.
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for updates, documentation, and revision history.
#include <utility>
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/serialization/level.hpp>
#include <boost/serialization/tracking.hpp>
#include <boost/serialization/split_member.hpp>
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/traits.hpp>
#include <boost/serialization/wrapper.hpp>
namespace boost {
namespace serialization {
template<class T>
struct nvp :
public std::pair<const char *, T *>,
public wrapper_traits<const nvp< T > >
{
//private:
nvp(const nvp & rhs) :
std::pair<const char *, T *>(rhs.first, rhs.second)
{}
public:
explicit nvp(const char * name_, T & t) :
// note: added _ to suppress useless gcc warning
std::pair<const char *, T *>(name_, & t)
{}
const char * name() const {
return this->first;
}
T & value() const {
return *(this->second);
}
const T & const_value() const {
return *(this->second);
}
template<class Archive>
void save(
Archive & ar,
const unsigned int /* file_version */
) const {
ar.operator<<(const_value());
}
template<class Archive>
void load(
Archive & ar,
const unsigned int /* file_version */
){
ar.operator>>(value());
}
BOOST_SERIALIZATION_SPLIT_MEMBER()
};
template<class T>
inline
const nvp< T > make_nvp(const char * name, T & t){
return nvp< T >(name, t);
}
// to maintain efficiency and portability, we want to assign
// specific serialization traits to all instances of this wrappers.
// we can't strait forward method below as it depends upon
// Partial Template Specialization and doing so would mean that wrappers
// wouldn't be treated the same on different platforms. This would
// break archive portability. Leave this here as reminder not to use it !!!
template <class T>
struct implementation_level<nvp< T > >
{
typedef mpl::integral_c_tag tag;
typedef mpl::int_<object_serializable> type;
BOOST_STATIC_CONSTANT(int, value = implementation_level::type::value);
};
// nvp objects are generally created on the stack and are never tracked
template<class T>
struct tracking_level<nvp< T > >
{
typedef mpl::integral_c_tag tag;
typedef mpl::int_<track_never> type;
BOOST_STATIC_CONSTANT(int, value = tracking_level::type::value);
};
} // seralization
} // boost
#include <boost/preprocessor/stringize.hpp>
#define BOOST_SERIALIZATION_NVP(name) \
boost::serialization::make_nvp(BOOST_PP_STRINGIZE(name), name)
/**/
#define BOOST_SERIALIZATION_BASE_OBJECT_NVP(name) \
boost::serialization::make_nvp( \
BOOST_PP_STRINGIZE(name), \
boost::serialization::base_object<name >(*this) \
)
/**/
#endif // BOOST_SERIALIZATION_NVP_HPP
| {
"pile_set_name": "Github"
} |
// Copyright (c) 2019 IoTeX Foundation
// This is an alpha (internal) release and is not suitable for production. This source code is provided 'as is' and no
// warranties are given as to title or non-infringement, merchantability or fitness for purpose and, to the extent
// permitted by law, all liability for your use of the code is disclaimed. This source code is governed by Apache
// License 2.0 that can be found in the LICENSE file.
package consensusfsm
import (
"time"
"github.com/iotexproject/iotex-core/config"
)
type (
// ConsensusConfig defines a set of time durations used in fsm
ConsensusConfig interface {
EventChanSize() uint
UnmatchedEventTTL(uint64) time.Duration
UnmatchedEventInterval(uint64) time.Duration
AcceptBlockTTL(uint64) time.Duration
AcceptProposalEndorsementTTL(uint64) time.Duration
AcceptLockEndorsementTTL(uint64) time.Duration
CommitTTL(uint64) time.Duration
BlockInterval(uint64) time.Duration
Delay(uint64) time.Duration
}
// config implements ConsensusConfig
consensusCfg struct {
cfg config.ConsensusTiming
hu config.HeightUpgrade
blockInterval time.Duration
delay time.Duration
}
)
// NewConsensusConfig creates a ConsensusConfig out of config.
func NewConsensusConfig(cfg config.Config) ConsensusConfig {
return &consensusCfg{
cfg.Consensus.RollDPoS.FSM,
config.NewHeightUpgrade(&cfg.Genesis),
cfg.Genesis.Blockchain.BlockInterval,
cfg.Consensus.RollDPoS.Delay,
}
}
func (c *consensusCfg) EventChanSize() uint {
return c.cfg.EventChanSize
}
func (c *consensusCfg) UnmatchedEventTTL(height uint64) time.Duration {
if c.hu.IsPost(config.Dardanelles, height) {
return config.DardanellesUnmatchedEventTTL
}
return c.cfg.UnmatchedEventTTL
}
func (c *consensusCfg) UnmatchedEventInterval(height uint64) time.Duration {
if c.hu.IsPost(config.Dardanelles, height) {
return config.DardanellesUnmatchedEventInterval
}
return c.cfg.UnmatchedEventInterval
}
func (c *consensusCfg) AcceptBlockTTL(height uint64) time.Duration {
if c.hu.IsPost(config.Dardanelles, height) {
return config.DardanellesAcceptBlockTTL
}
return c.cfg.AcceptBlockTTL
}
func (c *consensusCfg) AcceptProposalEndorsementTTL(height uint64) time.Duration {
if c.hu.IsPost(config.Dardanelles, height) {
return config.DardanellesAcceptProposalEndorsementTTL
}
return c.cfg.AcceptProposalEndorsementTTL
}
func (c *consensusCfg) AcceptLockEndorsementTTL(height uint64) time.Duration {
if c.hu.IsPost(config.Dardanelles, height) {
return config.DardanellesAcceptLockEndorsementTTL
}
return c.cfg.AcceptLockEndorsementTTL
}
func (c *consensusCfg) CommitTTL(height uint64) time.Duration {
if c.hu.IsPost(config.Dardanelles, height) {
return config.DardanellesCommitTTL
}
return c.cfg.CommitTTL
}
func (c *consensusCfg) BlockInterval(height uint64) time.Duration {
if c.hu.IsPost(config.Dardanelles, height) {
return config.DardanellesBlockInterval
}
return c.blockInterval
}
func (c *consensusCfg) Delay(height uint64) time.Duration {
if c.hu.IsPost(config.Dardanelles, height) {
return config.DardanellesDelay
}
return c.delay
}
| {
"pile_set_name": "Github"
} |
# Copyright (C) 2008-2018 Lorenzo Caminiti
# Distributed under the Boost Software License, Version 1.0 (see accompanying
# file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt).
# See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html
# Usage: bjam [OPTION]... DIR[-CPP_FILE_NAME]
# Build and run Boost.Contract tests and examples.
#
# Options (common to BJam):
# toolset=msvc,gcc,clang,... specify compiler
# cxxstd=03,11,14,17,... specify C++ standard version
# most tests and example use C++11 features
# (lambda, variadic macros, etc.), delete
# "bin.v2/project-cache.jam" to clear previous
# feature checks
# link=shared,static build Boost.Contract as shared (default) or static
# library, this has no effect if `bc_hdr=only`
# Options (specific to this lib):
# bc_hdr=lib,only if `only` then do not build Boost.Contract as library
# and use it as header-only instead (`lib` by default)
# bc_no=all_yes,
# y,r,x,s,e,k,yr,yx,ys,ye,yk,rx,rs,re,rk,xs,xe,xk,se,sk,ek,yrx,yrs,yre,yrk,yxs,yxe,yxk,yse,ysk,yek,rxs,rxe,rxk,rse,rsk,rek,xse,xsk,xek,sek,yrxs,yrxe,yrxk,yrse,yrsk,yrek,yxse,yxsk,yxek,ysek,rxse,rxsk,rxek,rsek,xsek,yrxse,yrxsk,yrxek,yrsek,yxsek,rxsek,yrxsek
# `all_yes` (default) turns off no contract, following
# turn off specific contracts and can be combined wit each
# other (only in the listed order) to disable multiple
# contracts at once:
# y entry invariant
# r preconditions
# x exit invariant
# s postconditions
# e exception guarantees
# k implementation checks
#
# Examples (on Linux-based bash):
# Build just "test/public_function/smoke.cpp" and "example/introduction.cpp":
# [test]$ bjam cxxstd=11 public_function-smoke
# [example]$ bjam cxxstd=11 features-introduction
# Build all tests with all linkages (incl header-only) on multiple compilers:
# [test]$ bjam cxxstd=11 -q toolset=msvc,gcc,clang link=static,header
# [test]$ bjam cxxstd=11 -q toolset=msvc,gcc,clang bc_hdr=only
# Build all tests with no postconditions and exception guarantees first, and
# then again with no class invariants at exit:
# [test]$ time bjam cxxstd=11 -q bc_no=se,x
# Build most all test combinations (for shared and static lib, use bc_hdr=only
# instead of link=... for header-only combinations) but takes forever...:
# [test]$ rm -f ../../../bin.v2/project-cache.jam ; bjam cxxstd=11 -q toolset=msvc,gcc,clang link=shared,static bc_no=all_yes,y,r,x,s,e,k,yr,yx,ys,ye,yk,rx,rs,re,rk,xs,xe,xk,se,sk,ek,yrx,yrs,yre,yrk,yxs,yxe,yxk,yse,ysk,yek,rxs,rxe,rxk,rse,rsk,rek,xse,xsk,xek,sek,yrxs,yrxe,yrxk,yrse,yrsk,yrek,yxse,yxsk,yxek,ysek,rxse,rxsk,rxek,rsek,xsek,yrxse,yrxsk,yrxek,yrsek,yxsek,rxsek,yrxsek > 00.out ; echo $?
import boost_contract_no ;
import feature ;
import testing ;
import ../../config/checks/config : requires ;
# Iff "no", link to boost_contract (else, no lib build so don't link to it).
feature.feature bc_hdr : lib only :
composite propagated link-incompatible ;
# This is boost_contract_no=all_yes,pre,pre_post,...
feature.feature bc_no : all_yes [ boost_contract_no.combinations ] :
composite propagated link-incompatible ;
for local comb in [ boost_contract_no.combinations ] {
feature.compose <bc_no>$(comb) :
[ boost_contract_no.defs_$(comb) ] ;
}
module boost_contract_build {
rule project_requirements ( subdir ) {
return
<bc_hdr>lib:<library>../build//boost_contract
<include>$(subdir)
;
}
# Most tests and examples require lambdas (even if lib technically does not).
# Also C++11 variadic macros are usually required (for OLDOF, BASES, etc.) but
# Boost.Config check for variadic macros is less stringent than Boost.PP's
# chec (so Boost.PP check done also in code directly when strictly needed).
cxx11_requirements = [ requires cxx11_lambdas cxx11_variadic_macros ] ;
rule subdir-compile-fail ( subdir : cpp_fname cpp_files * : requirements * ) {
compile-fail $(subdir)/$(cpp_fname).cpp $(cpp_files)
: [ project_requirements $(subdir) ] $(requirements)
: $(subdir)-$(cpp_fname)
;
}
rule subdir-run ( subdir : cpp_fname cpp_files * : requirements * ) {
run $(subdir)/$(cpp_fname).cpp $(cpp_files) : : : [ project_requirements
$(subdir) ] $(requirements) : $(subdir)-$(cpp_fname) ;
}
rule subdir-lib ( subdir : cpp_fname cpp_files * : requirements * ) {
lib $(subdir)-$(cpp_fname) : $(subdir)/$(cpp_fname).cpp $(cpp_files) :
[ project_requirements $(subdir) ] $(requirements) ;
}
rule subdir-compile-fail-cxx11 ( subdir : cpp_fname cpp_files * :
requirements * ) {
subdir-compile-fail $(subdir) : $(cpp_fname) $(cpp_files) :
$(cxx11_requirements) $(requirements) ;
}
rule subdir-run-cxx11 ( subdir : cpp_fname cpp_files * : requirements * ) {
subdir-run $(subdir) : $(cpp_fname) $(cpp_files) : $(cxx11_requirements)
$(requirements) ;
}
rule subdir-lib-cxx11 ( subdir : cpp_fname cpp_files * : requirements * ) {
subdir-lib $(subdir) : $(cpp_fname) $(cpp_files) : $(cxx11_requirements)
$(requirements) ;
}
} # module
| {
"pile_set_name": "Github"
} |
"use strict";
exports.__esModule = true;
exports.Flow = exports.Pure = exports.Generated = exports.User = exports.Var = exports.BlockScoped = exports.Referenced = exports.Scope = exports.Expression = exports.Statement = exports.BindingIdentifier = exports.ReferencedMemberExpression = exports.ReferencedIdentifier = undefined;
var _babelTypes = require("babel-types");
var t = _interopRequireWildcard(_babelTypes);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
var ReferencedIdentifier = exports.ReferencedIdentifier = {
types: ["Identifier", "JSXIdentifier"],
checkPath: function checkPath(_ref, opts) {
var node = _ref.node,
parent = _ref.parent;
if (!t.isIdentifier(node, opts) && !t.isJSXMemberExpression(parent, opts)) {
if (t.isJSXIdentifier(node, opts)) {
if (_babelTypes.react.isCompatTag(node.name)) return false;
} else {
return false;
}
}
return t.isReferenced(node, parent);
}
};
var ReferencedMemberExpression = exports.ReferencedMemberExpression = {
types: ["MemberExpression"],
checkPath: function checkPath(_ref2) {
var node = _ref2.node,
parent = _ref2.parent;
return t.isMemberExpression(node) && t.isReferenced(node, parent);
}
};
var BindingIdentifier = exports.BindingIdentifier = {
types: ["Identifier"],
checkPath: function checkPath(_ref3) {
var node = _ref3.node,
parent = _ref3.parent;
return t.isIdentifier(node) && t.isBinding(node, parent);
}
};
var Statement = exports.Statement = {
types: ["Statement"],
checkPath: function checkPath(_ref4) {
var node = _ref4.node,
parent = _ref4.parent;
if (t.isStatement(node)) {
if (t.isVariableDeclaration(node)) {
if (t.isForXStatement(parent, { left: node })) return false;
if (t.isForStatement(parent, { init: node })) return false;
}
return true;
} else {
return false;
}
}
};
var Expression = exports.Expression = {
types: ["Expression"],
checkPath: function checkPath(path) {
if (path.isIdentifier()) {
return path.isReferencedIdentifier();
} else {
return t.isExpression(path.node);
}
}
};
var Scope = exports.Scope = {
types: ["Scopable"],
checkPath: function checkPath(path) {
return t.isScope(path.node, path.parent);
}
};
var Referenced = exports.Referenced = {
checkPath: function checkPath(path) {
return t.isReferenced(path.node, path.parent);
}
};
var BlockScoped = exports.BlockScoped = {
checkPath: function checkPath(path) {
return t.isBlockScoped(path.node);
}
};
var Var = exports.Var = {
types: ["VariableDeclaration"],
checkPath: function checkPath(path) {
return t.isVar(path.node);
}
};
var User = exports.User = {
checkPath: function checkPath(path) {
return path.node && !!path.node.loc;
}
};
var Generated = exports.Generated = {
checkPath: function checkPath(path) {
return !path.isUser();
}
};
var Pure = exports.Pure = {
checkPath: function checkPath(path, opts) {
return path.scope.isPure(path.node, opts);
}
};
var Flow = exports.Flow = {
types: ["Flow", "ImportDeclaration", "ExportDeclaration", "ImportSpecifier"],
checkPath: function checkPath(_ref5) {
var node = _ref5.node;
if (t.isFlow(node)) {
return true;
} else if (t.isImportDeclaration(node)) {
return node.importKind === "type" || node.importKind === "typeof";
} else if (t.isExportDeclaration(node)) {
return node.exportKind === "type";
} else if (t.isImportSpecifier(node)) {
return node.importKind === "type" || node.importKind === "typeof";
} else {
return false;
}
}
}; | {
"pile_set_name": "Github"
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.4.2_18) on Thu Jul 31 15:03:53 GMT+01:00 2008 -->
<TITLE>
AFPPageSetupElement (Apache FOP 0.95 API)
</TITLE>
<META NAME="keywords" CONTENT="org.apache.fop.render.afp.extensions.AFPPageSetupElement class">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="AFPPageSetupElement (Apache FOP 0.95 API)";
}
</SCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/AFPPageSetupElement.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
fop 0.95</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../org/apache/fop/render/afp/extensions/AFPPageSetup.html" title="class in org.apache.fop.render.afp.extensions"><B>PREV CLASS</B></A>
NEXT CLASS</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html" target="_top"><B>FRAMES</B></A>
<A HREF="AFPPageSetupElement.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: <A HREF="#nested_classes_inherited_from_class_org.apache.fop.fo.FONode">NESTED</A> | <A HREF="#fields_inherited_from_class_org.apache.fop.fo.FONode">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
org.apache.fop.render.afp.extensions</FONT>
<BR>
Class AFPPageSetupElement</H2>
<PRE>
java.lang.Object
<IMG SRC="../../../../../../resources/inherit.gif" ALT="extended by"><A HREF="../../../../../../org/apache/fop/fo/FONode.html" title="class in org.apache.fop.fo">org.apache.fop.fo.FONode</A>
<IMG SRC="../../../../../../resources/inherit.gif" ALT="extended by"><A HREF="../../../../../../org/apache/fop/render/afp/extensions/AbstractAFPExtensionObject.html" title="class in org.apache.fop.render.afp.extensions">org.apache.fop.render.afp.extensions.AbstractAFPExtensionObject</A>
<IMG SRC="../../../../../../resources/inherit.gif" ALT="extended by"><B>org.apache.fop.render.afp.extensions.AFPPageSetupElement</B>
</PRE>
<DL>
<DT><B>All Implemented Interfaces:</B> <DD>java.lang.Cloneable</DD>
</DL>
<HR>
<DL>
<DT>public class <B>AFPPageSetupElement</B><DT>extends <A HREF="../../../../../../org/apache/fop/render/afp/extensions/AbstractAFPExtensionObject.html" title="class in org.apache.fop.render.afp.extensions">AbstractAFPExtensionObject</A></DL>
<P>
Extension element for fox:ps-page-setup-code.
<P>
<P>
<HR>
<P>
<!-- ======== NESTED CLASS SUMMARY ======== -->
<A NAME="nested_class_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Nested Class Summary</B></FONT></TD>
</TR>
</TABLE>
<A NAME="nested_classes_inherited_from_class_org.apache.fop.fo.FONode"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Nested classes inherited from class org.apache.fop.fo.<A HREF="../../../../../../org/apache/fop/fo/FONode.html" title="class in org.apache.fop.fo">FONode</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../../../../org/apache/fop/fo/FONode.FONodeIterator.html" title="interface in org.apache.fop.fo">FONode.FONodeIterator</A></CODE></TD>
</TR>
</TABLE>
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Field Summary</B></FONT></TD>
</TR>
</TABLE>
<A NAME="fields_inherited_from_class_org.apache.fop.fo.FONode"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Fields inherited from class org.apache.fop.fo.<A HREF="../../../../../../org/apache/fop/fo/FONode.html" title="class in org.apache.fop.fo">FONode</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../../../../org/apache/fop/fo/FONode.html#FO_URI">FO_URI</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#FOX_URI">FOX_URI</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#locator">locator</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#log">log</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#parent">parent</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#siblings">siblings</A></CODE></TD>
</TR>
</TABLE>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../../org/apache/fop/render/afp/extensions/AFPPageSetupElement.html#AFPPageSetupElement(org.apache.fop.fo.FONode)">AFPPageSetupElement</A></B>(<A HREF="../../../../../../org/apache/fop/fo/FONode.html" title="class in org.apache.fop.fo">FONode</A> parent)</CODE>
<BR>
Main constructor</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Method Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/fop/render/afp/extensions/AFPPageSetupElement.html#startOfNode()">startOfNode</A></B>()</CODE>
<BR>
Called after processNode() is called. Subclasses can do additional processing.</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_org.apache.fop.render.afp.extensions.AbstractAFPExtensionObject"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class org.apache.fop.render.afp.extensions.<A HREF="../../../../../../org/apache/fop/render/afp/extensions/AbstractAFPExtensionObject.html" title="class in org.apache.fop.render.afp.extensions">AbstractAFPExtensionObject</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../../../../org/apache/fop/render/afp/extensions/AbstractAFPExtensionObject.html#addCharacters(char[], int, int, org.apache.fop.fo.PropertyList, org.xml.sax.Locator)">addCharacters</A>, <A HREF="../../../../../../org/apache/fop/render/afp/extensions/AbstractAFPExtensionObject.html#endOfNode()">endOfNode</A>, <A HREF="../../../../../../org/apache/fop/render/afp/extensions/AbstractAFPExtensionObject.html#getExtensionAttachment()">getExtensionAttachment</A>, <A HREF="../../../../../../org/apache/fop/render/afp/extensions/AbstractAFPExtensionObject.html#getLocalName()">getLocalName</A>, <A HREF="../../../../../../org/apache/fop/render/afp/extensions/AbstractAFPExtensionObject.html#getNamespaceURI()">getNamespaceURI</A>, <A HREF="../../../../../../org/apache/fop/render/afp/extensions/AbstractAFPExtensionObject.html#getNormalNamespacePrefix()">getNormalNamespacePrefix</A>, <A HREF="../../../../../../org/apache/fop/render/afp/extensions/AbstractAFPExtensionObject.html#processNode(java.lang.String, org.xml.sax.Locator, org.xml.sax.Attributes, org.apache.fop.fo.PropertyList)">processNode</A>, <A HREF="../../../../../../org/apache/fop/render/afp/extensions/AbstractAFPExtensionObject.html#validateChildNode(org.xml.sax.Locator, java.lang.String, java.lang.String)">validateChildNode</A></CODE></TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_org.apache.fop.fo.FONode"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class org.apache.fop.fo.<A HREF="../../../../../../org/apache/fop/fo/FONode.html" title="class in org.apache.fop.fo">FONode</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../../../../org/apache/fop/fo/FONode.html#addChildNode(org.apache.fop.fo.FONode)">addChildNode</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#attachSiblings(org.apache.fop.fo.FONode, org.apache.fop.fo.FONode)">attachSiblings</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#attributeError(java.lang.String)">attributeError</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#attributeWarning(java.lang.String)">attributeWarning</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#bind(org.apache.fop.fo.PropertyList)">bind</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#canHaveMarkers()">canHaveMarkers</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#charIterator()">charIterator</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#clone()">clone</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#clone(org.apache.fop.fo.FONode, boolean)">clone</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#createPropertyList(org.apache.fop.fo.PropertyList, org.apache.fop.fo.FOEventHandler)">createPropertyList</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#decorateWithContextInfo(java.lang.String, org.apache.fop.fo.FONode)">decorateWithContextInfo</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#errorText(org.xml.sax.Locator)">errorText</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#gatherContextInfo()">gatherContextInfo</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#getChildNodes()">getChildNodes</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#getChildNodes(org.apache.fop.fo.FONode)">getChildNodes</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#getContentHandlerFactory()">getContentHandlerFactory</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#getContextInfo()">getContextInfo</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#getFOEventHandler()">getFOEventHandler</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#getLocator()">getLocator</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#getLocatorString(org.xml.sax.Locator)">getLocatorString</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#getLogger()">getLogger</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#getName()">getName</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#getName(java.lang.String)">getName</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#getNameId()">getNameId</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#getNodeString(java.lang.String, java.lang.String)">getNodeString</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#getParent()">getParent</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#getRoot()">getRoot</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#getUserAgent()">getUserAgent</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#inMarker()">inMarker</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#invalidChildError(org.xml.sax.Locator, java.lang.String, java.lang.String)">invalidChildError</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#invalidChildError(org.xml.sax.Locator, java.lang.String, java.lang.String, java.lang.String)">invalidChildError</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#missingChildElementError(java.lang.String)">missingChildElementError</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#missingPropertyError(java.lang.String)">missingPropertyError</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#nodesOutOfOrderError(org.xml.sax.Locator, java.lang.String, java.lang.String)">nodesOutOfOrderError</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#removeChild(org.apache.fop.fo.FONode)">removeChild</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#setLocator(org.xml.sax.Locator)">setLocator</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#tooManyNodesError(org.xml.sax.Locator, java.lang.String)">tooManyNodesError</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#tooManyNodesError(org.xml.sax.Locator, java.lang.String, java.lang.String)">tooManyNodesError</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#validateChildNode(org.apache.fop.fo.FONode, org.xml.sax.Locator, java.lang.String, java.lang.String)">validateChildNode</A>, <A HREF="../../../../../../org/apache/fop/fo/FONode.html#warningText(org.xml.sax.Locator)">warningText</A></CODE></TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class java.lang.Object</B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
<P>
<!-- ============ FIELD DETAIL =========== -->
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="AFPPageSetupElement(org.apache.fop.fo.FONode)"><!-- --></A><H3>
AFPPageSetupElement</H3>
<PRE>
public <B>AFPPageSetupElement</B>(<A HREF="../../../../../../org/apache/fop/fo/FONode.html" title="class in org.apache.fop.fo">FONode</A> parent)</PRE>
<DL>
<DD>Main constructor
<P>
<DT><B>Parameters:</B><DD><CODE>parent</CODE> - parent FO node</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="startOfNode()"><!-- --></A><H3>
startOfNode</H3>
<PRE>
protected void <B>startOfNode</B>()
throws <A HREF="../../../../../../org/apache/fop/apps/FOPException.html" title="class in org.apache.fop.apps">FOPException</A></PRE>
<DL>
<DD>Called after processNode() is called. Subclasses can do additional processing.
<P>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../../../../../org/apache/fop/fo/FONode.html#startOfNode()">startOfNode</A></CODE> in class <CODE><A HREF="../../../../../../org/apache/fop/fo/FONode.html" title="class in org.apache.fop.fo">FONode</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../../org/apache/fop/apps/FOPException.html" title="class in org.apache.fop.apps">FOPException</A></CODE> - if there's a problem during processing</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/AFPPageSetupElement.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
fop 0.95</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../org/apache/fop/render/afp/extensions/AFPPageSetup.html" title="class in org.apache.fop.render.afp.extensions"><B>PREV CLASS</B></A>
NEXT CLASS</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html" target="_top"><B>FRAMES</B></A>
<A HREF="AFPPageSetupElement.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: <A HREF="#nested_classes_inherited_from_class_org.apache.fop.fo.FONode">NESTED</A> | <A HREF="#fields_inherited_from_class_org.apache.fop.fo.FONode">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.
</BODY>
</HTML>
| {
"pile_set_name": "Github"
} |
config BR2_PACKAGE_PYTHON_MBSTRDECODER
bool "python-mbstrdecoder"
help
multi-byte character string decoder.
https://github.com/thombashi/mbstrdecoder
| {
"pile_set_name": "Github"
} |
version https://git-lfs.github.com/spec/v1
oid sha256:5bda9a4c196d8b99687aabb4f1f8b1b3b70b71005c3c83c14072e1f431f1c52f
size 2359392
| {
"pile_set_name": "Github"
} |
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package unix
const (
R_OK = 0x4
W_OK = 0x2
X_OK = 0x1
)
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="common_color">#ff5f00</color>
</resources> | {
"pile_set_name": "Github"
} |
// This file was procedurally generated from the following sources:
// - src/dstr-binding/obj-ptrn-prop-id.case
// - src/dstr-binding/default/func-decl-dflt.template
/*---
description: Binding as specified via property name and identifier (function declaration (default parameter))
esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
features: [destructuring-binding, default-parameters]
flags: [generated]
info: |
FunctionDeclaration :
function BindingIdentifier ( FormalParameters ) { FunctionBody }
[...]
3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
scope, strict).
[...]
9.2.1 [[Call]] ( thisArgument, argumentsList)
[...]
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
[...]
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
[...]
9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
[...]
23. Let iteratorRecord be Record {[[iterator]]:
CreateListIterator(argumentsList), [[done]]: false}.
24. If hasDuplicates is true, then
[...]
25. Else,
b. Let formalStatus be IteratorBindingInitialization for formals with
iteratorRecord and env as arguments.
[...]
13.3.3.7 Runtime Semantics: KeyedBindingInitialization
SingleNameBinding : BindingIdentifier Initializeropt
[...]
8. Return InitializeReferencedBinding(lhs, v).
---*/
var callCount = 0;
function f({ x: y } = { x: 23 }) {
assert.sameValue(y, 23);
assert.throws(ReferenceError, function() {
x;
});
callCount = callCount + 1;
};
f();
assert.sameValue(callCount, 1, 'function invoked exactly once');
| {
"pile_set_name": "Github"
} |
export { foo };
export { bar as foo };
| {
"pile_set_name": "Github"
} |
;; Multiplication patterns for TI C6X.
;; This file is processed by genmult.sh to produce two variants of each
;; pattern, a normal one and a real_mult variant for modulo scheduling.
;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
;; Contributed by Bernd Schmidt <[email protected]>
;; Contributed by CodeSourcery.
;;
;; This file is part of GCC.
;;
;; GCC is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;;
;; GCC 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 GCC; see the file COPYING3. If not see
;; <http://www.gnu.org/licenses/>.
;; -------------------------------------------------------------------------
;; Miscellaneous insns that execute on the M units
;; -------------------------------------------------------------------------
(define_insn "rotlsi3_VARIANT_"
[(_SET_ _OBRK_(match_operand:SI 0 "_DESTOPERAND_" "=_A_,_B_,_A_,_B_")
(rotate:SI (match_operand:SI 1 "register_operand" "a,b,?b,?a")
(match_operand:SI 2 "reg_or_ucst5_operand" "aIu5,bIu5,aIu5,bIu5"))_CBRK_)]
"TARGET_INSNS_64"
"%|%.\\trotl\\t%$\\t%1, %2, %_MODk_0"
[(set_attr "units" "m")
(set_attr "type" "mpy2")
(set_attr "cross" "n,n,y,y")])
(define_insn "bitrevsi2_VARIANT_"
[(_SET_ _OBRK_(match_operand:SI 0 "_DESTOPERAND_" "=_A_,_A_,_B_,_B_")
(unspec:SI [(match_operand:SI 1 "register_operand" "a,?b,b,?a")]
UNSPEC_BITREV)_CBRK_)]
"TARGET_INSNS_64"
"%|%.\\tbitr\\t%$\\t%1, %_MODk_0"
[(set_attr "units" "m")
(set_attr "type" "mpy2")
(set_attr "cross" "n,y,n,y")])
;; Vector average.
(define_insn "avgv2hi3_VARIANT_"
[(_SET_ _OBRK_(match_operand:_MV2HI 0 "_DESTOPERAND_" "=_A_,_B_,_A_,_B_")
(unspec:V2HI [(match_operand:V2HI 1 "register_operand" "a,b,?b,?a")
(match_operand:V2HI 2 "register_operand" "a,b,a,b")] UNSPEC_AVG)_CBRK_)]
"TARGET_INSNS_64"
"%|%.\\tavg2\\t%$\\t%1, %2, %_MODk_0"
[(set_attr "units" "m")
(set_attr "type" "mpy2")
(set_attr "cross" "n,n,y,y")])
(define_insn "uavgv4qi3_VARIANT_"
[(_SET_ _OBRK_(match_operand:_MV4QI 0 "_DESTOPERAND_" "=_A_,_B_,_A_,_B_")
(unspec:V4QI [(match_operand:V4QI 1 "register_operand" "a,b,?b,?a")
(match_operand:V4QI 2 "register_operand" "a,b,a,b")] UNSPEC_AVG)_CBRK_)]
"TARGET_INSNS_64"
"%|%.\\tavgu4\\t%$\\t%1, %2, %_MODk_0"
[(set_attr "units" "m")
(set_attr "type" "mpy2")
(set_attr "cross" "n,n,y,y")])
;; -------------------------------------------------------------------------
;; Multiplication
;; -------------------------------------------------------------------------
(define_insn "mulhi3_VARIANT_"
[(_SET_ _OBRK_(match_operand:HI 0 "_DESTOPERAND_" "=_A_,_B_,_A_,_B_")
(mult:HI (match_operand:HI 1 "register_operand" "a,b,?b,?a")
(match_operand:HI 2 "reg_or_scst5_operand" "aIs5,bIs5,aIs5,bIs5"))_CBRK_)]
""
"%|%.\\tmpy\\t%$\\t%2, %1, %_MODk_0"
[(set_attr "type" "mpy2")
(set_attr "units" "m")
(set_attr "op_pattern" "sxs")
(set_attr "cross" "n,n,y,y")])
(define_insn "mulhisi3_const_VARIANT_"
[(_SET_ _OBRK_(match_operand:SI 0 "_DESTOPERAND_" "=_A_,_B_,_A__B_")
(mult:SI (sign_extend:SI
(match_operand:HI 1 "register_operand" "a,b,?ab"))
(match_operand:HI 2 "scst5_operand" "Is5,Is5,Is5"))_CBRK_)]
""
"%|%.\\tmpy\\t%$\\t%2, %1, %_MODk_0"
[(set_attr "type" "mpy2")
(set_attr "units" "m")
(set_attr "cross" "n,n,y")])
(define_insn "*mulhisi3_insn_VARIANT_"
[(_SET_ _OBRK_(match_operand:SI 0 "_DESTOPERAND_" "=_A_,_B_,_A_,_B_")
(mult:SI (sign_extend:SI
(match_operand:HI 1 "register_operand" "%a,b,?a,?b"))
(sign_extend:SI
(match_operand:HI 2 "reg_or_scst5_operand" "a,b,b,a")))_CBRK_)]
""
"%|%.\\tmpy\\t%$\\t%1, %2, %_MODk_0"
[(set_attr "type" "mpy2")
(set_attr "units" "m")
(set_attr "op_pattern" "ssx")
(set_attr "cross" "n,n,y,y")])
(define_insn "mulhisi3_lh_VARIANT_"
[(_SET_ _OBRK_(match_operand:SI 0 "_DESTOPERAND_" "=_A_,_B_,_A_,_B_")
(mult:SI (sign_extend:SI
(match_operand:HI 1 "register_operand" "a,b,?a,?b"))
(ashiftrt:SI
(match_operand:SI 2 "register_operand" "a,b,b,a")
(const_int 16)))_CBRK_)]
""
"%|%.\\tmpylh\\t%$\\t%1, %2, %_MODk_0"
[(set_attr "type" "mpy2")
(set_attr "units" "m")
(set_attr "cross" "n,n,y,y")])
(define_insn "mulhisi3_hl_VARIANT_"
[(_SET_ _OBRK_(match_operand:SI 0 "_DESTOPERAND_" "=_A_,_B_,_A_,_B_")
(mult:SI (ashiftrt:SI
(match_operand:SI 1 "register_operand" "a,b,?a,?b")
(const_int 16))
(sign_extend:SI
(match_operand:HI 2 "register_operand" "a,b,b,a")))_CBRK_)]
""
"%|%.\\tmpyhl\\t%$\\t%1, %2, %_MODk_0"
[(set_attr "type" "mpy2")
(set_attr "units" "m")
(set_attr "cross" "n,n,y,y")])
(define_insn "mulhisi3_hh_VARIANT_"
[(_SET_ _OBRK_(match_operand:SI 0 "_DESTOPERAND_" "=_A_,_B_,_A_,_B_")
(mult:SI (ashiftrt:SI
(match_operand:SI 1 "register_operand" "%a,b,?a,?b")
(const_int 16))
(ashiftrt:SI
(match_operand:SI 2 "register_operand" "a,b,b,a")
(const_int 16)))_CBRK_)]
""
"%|%.\\tmpyh\\t%$\\t%1, %2, %_MODk_0"
[(set_attr "type" "mpy2")
(set_attr "units" "m")
(set_attr "cross" "n,n,y,y")])
(define_insn "umulhisi3_VARIANT_"
[(_SET_ _OBRK_(match_operand:SI 0 "_DESTOPERAND_" "=_A_,_B_,_A_,_B_")
(mult:SI (zero_extend:SI
(match_operand:HI 1 "register_operand" "%a,b,?a,?b"))
(zero_extend:SI
(match_operand:HI 2 "register_operand" "a,b,b,a")))_CBRK_)]
""
"%|%.\\tmpyu\\t%$\\t%1, %2, %_MODk_0"
[(set_attr "type" "mpy2")
(set_attr "units" "m")
(set_attr "cross" "n,n,y,y")])
(define_insn "umulhisi3_lh_VARIANT_"
[(_SET_ _OBRK_(match_operand:SI 0 "_DESTOPERAND_" "=_A_,_B_,_A_,_B_")
(mult:SI (zero_extend:SI
(match_operand:HI 1 "register_operand" "a,b,?a,?b"))
(lshiftrt:SI
(match_operand:SI 2 "register_operand" "a,b,b,a")
(const_int 16)))_CBRK_)]
""
"%|%.\\tmpylhu\\t%$\\t%1, %2, %_MODk_0"
[(set_attr "type" "mpy2")
(set_attr "units" "m")
(set_attr "cross" "n,n,y,y")])
(define_insn "umulhisi3_hl_VARIANT_"
[(_SET_ _OBRK_(match_operand:SI 0 "_DESTOPERAND_" "=_A_,_B_,_A_,_B_")
(mult:SI (lshiftrt:SI
(match_operand:SI 1 "register_operand" "a,b,?a,?b")
(const_int 16))
(zero_extend:SI
(match_operand:HI 2 "register_operand" "a,b,b,a")))_CBRK_)]
""
"%|%.\\tmpyhlu\\t%$\\t%1, %2, %_MODk_0"
[(set_attr "type" "mpy2")
(set_attr "units" "m")
(set_attr "cross" "n,n,y,y")])
(define_insn "umulhisi3_hh_VARIANT_"
[(_SET_ _OBRK_(match_operand:SI 0 "_DESTOPERAND_" "=_A_,_B_,_A_,_B_")
(mult:SI (lshiftrt:SI
(match_operand:SI 1 "register_operand" "%a,b,?a,?b")
(const_int 16))
(lshiftrt:SI
(match_operand:SI 2 "register_operand" "a,b,b,a")
(const_int 16)))_CBRK_)]
""
"%|%.\\tmpyhu\\t%$\\t%1, %2, %_MODk_0"
[(set_attr "type" "mpy2")
(set_attr "units" "m")
(set_attr "cross" "n,n,y,y")])
(define_insn "usmulhisi3_const_VARIANT_"
[(_SET_ _OBRK_(match_operand:SI 0 "_DESTOPERAND_" "=_A_,_B_,_A__B_")
(mult:SI (zero_extend:SI
(match_operand:HI 1 "register_operand" "a,b,?ab"))
(match_operand:SI 2 "scst5_operand" "Is5,Is5,Is5"))_CBRK_)]
""
"%|%.\\tmpysu\\t%$\\t%2, %1, %_MODk_0"
[(set_attr "type" "mpy2")
(set_attr "units" "m")
(set_attr "cross" "n,n,y")])
(define_insn "*usmulhisi3_insn_VARIANT_"
[(_SET_ _OBRK_(match_operand:SI 0 "_DESTOPERAND_" "=_A_,_B_,_A_,_B_")
(mult:SI (zero_extend:SI
(match_operand:HI 1 "register_operand" "a,b,?a,?b"))
(sign_extend:SI
(match_operand:HI 2 "reg_or_scst5_operand" "aIs5,bIs5,bIs5,aIs5")))_CBRK_)]
""
"%|%.\\tmpyus\\t%$\\t%1, %2, %_MODk_0"
[(set_attr "type" "mpy2")
(set_attr "units" "m")
(set_attr "cross" "n,n,y,y")])
(define_insn "usmulhisi3_lh_VARIANT_"
[(_SET_ _OBRK_(match_operand:SI 0 "_DESTOPERAND_" "=_A_,_B_,_A_,_B_")
(mult:SI (zero_extend:SI
(match_operand:HI 1 "register_operand" "a,b,?a,?b"))
(ashiftrt:SI
(match_operand:SI 2 "register_operand" "a,b,b,a")
(const_int 16)))_CBRK_)]
""
"%|%.\\tmpyluhs\\t%$\\t%1, %2, %_MODk_0"
[(set_attr "type" "mpy2")
(set_attr "units" "m")
(set_attr "cross" "n,n,y,y")])
(define_insn "usmulhisi3_hl_VARIANT_"
[(_SET_ _OBRK_(match_operand:SI 0 "_DESTOPERAND_" "=_A_,_B_,_A_,_B_")
(mult:SI (lshiftrt:SI
(match_operand:SI 1 "register_operand" "a,b,?a,?b")
(const_int 16))
(sign_extend:SI
(match_operand:HI 2 "register_operand" "a,b,b,a")))_CBRK_)]
""
"%|%.\\tmpyhuls\\t%$\\t%1, %2, %_MODk_0"
[(set_attr "type" "mpy2")
(set_attr "units" "m")
(set_attr "cross" "n,n,y,y")])
(define_insn "usmulhisi3_hh_VARIANT_"
[(_SET_ _OBRK_(match_operand:SI 0 "_DESTOPERAND_" "=_A_,_B_,_A_,_B_")
(mult:SI (lshiftrt:SI
(match_operand:SI 1 "register_operand" "a,b,?a,?b")
(const_int 16))
(ashiftrt:SI
(match_operand:SI 2 "register_operand" "a,b,b,a")
(const_int 16)))_CBRK_)]
""
"%|%.\\tmpyhus\\t%$\\t%1, %2, %_MODk_0"
[(set_attr "type" "mpy2")
(set_attr "units" "m")
(set_attr "cross" "n,n,y,y")])
(define_insn "mulsi3_insn_VARIANT_"
[(_SET_ _OBRK_(match_operand:SI 0 "_DESTOPERAND_" "=_A_,_B_,_A_,_B_")
(mult:SI (match_operand:SI 1 "register_operand" "%a,b,?a,?b")
(match_operand:SI 2 "register_operand" "a,b,b,a"))_CBRK_)]
"TARGET_MPY32"
"%|%.\\tmpy32\\t%$\\t%1, %2, %_MODk_0"
[(set_attr "type" "mpy4")
(set_attr "units" "m")
(set_attr "cross" "n,n,y,y")])
(define_insn "<u>mulsidi3_VARIANT_"
[(_SET_ _OBRK_(match_operand:DI 0 "_DESTOPERAND_" "=_A_,_B_,_A_,_B_")
(mult:DI (any_ext:DI
(match_operand:SI 1 "register_operand" "%a,b,?a,?b"))
(any_ext:DI
(match_operand:SI 2 "register_operand" "a,b,b,a")))_CBRK_)]
"TARGET_MPY32"
"%|%.\\tmpy32<u>\\t%$\\t%1, %2, %_MODK_0"
[(set_attr "type" "mpy4")
(set_attr "units" "m")
(set_attr "cross" "n,n,y,y")])
(define_insn "usmulsidi3_VARIANT_"
[(_SET_ _OBRK_(match_operand:DI 0 "_DESTOPERAND_" "=_A_,_B_,_A_,_B_")
(mult:DI (zero_extend:DI
(match_operand:SI 1 "register_operand" "a,b,?a,?b"))
(sign_extend:DI
(match_operand:SI 2 "register_operand" "a,b,b,a")))_CBRK_)]
"TARGET_MPY32"
"%|%.\\tmpy32us\\t%$\\t%1, %2, %_MODK_0"
[(set_attr "type" "mpy4")
(set_attr "units" "m")
(set_attr "cross" "n,n,y,y")])
;; Widening vector multiply and dot product
(define_insn "mulv2hiv2si3_VARIANT_"
[(_SET_ _OBRK_(match_operand:V2SI 0 "_DESTOPERAND_" "=_A_,_B_,_A_,_B_")
(mult:V2SI
(sign_extend:V2SI (match_operand:V2HI 1 "register_operand" "a,b,a,b"))
(sign_extend:V2SI (match_operand:V2HI 2 "register_operand" "a,b,?b,?a")))_CBRK_)]
"TARGET_INSNS_64"
"%|%.\\tmpy2\\t%$\\t%1, %2, %_MODk_0"
[(set_attr "type" "mpy4")
(set_attr "units" "m")
(set_attr "cross" "n,n,y,y")])
(define_insn "umulv4qiv4hi3_VARIANT_"
[(_SET_ _OBRK_(match_operand:V4HI 0 "_DESTOPERAND_" "=_A_,_B_,_A_,_B_")
(mult:V4HI
(zero_extend:V4HI (match_operand:V4QI 1 "register_operand" "a,b,a,b"))
(zero_extend:V4HI (match_operand:V4QI 2 "register_operand" "a,b,?b,?a")))_CBRK_)]
"TARGET_INSNS_64"
"%|%.\\tmpyu4\\t%$\\t%1, %2, %_MODk_0"
[(set_attr "type" "mpy4")
(set_attr "units" "m")
(set_attr "cross" "n,n,y,y")])
(define_insn "usmulv4qiv4hi3_VARIANT_"
[(_SET_ _OBRK_(match_operand:V4HI 0 "_DESTOPERAND_" "=_A_,_B_,_A_,_B_")
(mult:V4HI
(zero_extend:V4HI (match_operand:V4QI 1 "register_operand" "a,b,?b,?a"))
(sign_extend:V4HI (match_operand:V4QI 2 "register_operand" "a,b,a,b")))_CBRK_)]
"TARGET_INSNS_64"
"%|%.\\tmpyus4\\t%$\\t%1, %2, %_MODk_0"
[(set_attr "type" "mpy4")
(set_attr "units" "m")
(set_attr "cross" "n,n,y,y")])
(define_insn "dotv2hi_VARIANT_"
[(_SET_ _OBRK_(match_operand:SI 0 "_DESTOPERAND_" "=_A_,_B_,_A_,_B_")
(plus:SI
(mult:SI
(sign_extend:SI
(vec_select:HI
(match_operand:V2HI 1 "register_operand" "a,b,a,b")
(parallel [(const_int 0)])))
(sign_extend:SI
(vec_select:HI
(match_operand:V2HI 2 "register_operand" "a,b,?b,?a")
(parallel [(const_int 0)]))))
(mult:SI
(sign_extend:SI
(vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
(sign_extend:SI
(vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))_CBRK_)]
"TARGET_INSNS_64"
"%|%.\\tdotp2\\t%$\\t%1, %2, %_MODk_0"
[(set_attr "type" "mpy4")
(set_attr "units" "m")
(set_attr "cross" "n,n,y,y")])
;; Fractional multiply
(define_insn "mulv2hqv2sq3_VARIANT_"
[(_SET_ _OBRK_(match_operand:_MV2SQ 0 "_DESTOPERAND_" "=_A_,_B_,_A_,_B_")
(ss_mult:V2SQ
(fract_convert:V2SQ
(match_operand:V2HQ 1 "register_operand" "%a,b,?a,?b"))
(fract_convert:V2SQ
(match_operand:V2HQ 2 "register_operand" "a,b,b,a")))_CBRK_)]
""
"%|%.\\tsmpy2\\t%$\\t%1, %2, %_MODk_0"
[(set_attr "type" "mpy4")
(set_attr "units" "m")
(set_attr "cross" "n,n,y,y")])
(define_insn "mulhqsq3_VARIANT_"
[(_SET_ _OBRK_(match_operand:_MSQ 0 "_DESTOPERAND_" "=_A_,_B_,_A_,_B_")
(ss_mult:SQ
(fract_convert:SQ
(match_operand:HQ 1 "register_operand" "%a,b,?a,?b"))
(fract_convert:SQ
(match_operand:HQ 2 "register_operand" "a,b,b,a")))_CBRK_)]
""
"%|%.\\tsmpy\\t%$\\t%1, %2, %_MODk_0"
[(set_attr "type" "mpy2")
(set_attr "units" "m")
(set_attr "cross" "n,n,y,y")])
(define_insn "mulhqsq3_lh_VARIANT_"
[(_SET_ _OBRK_(match_operand:_MSQ 0 "_DESTOPERAND_" "=_A_,_B_,_A_,_B_")
(ss_mult:SQ
(fract_convert:SQ
(match_operand:HQ 1 "register_operand" "a,b,?a,?b"))
(fract_convert:SQ
(truncate:HQ (match_operand:SQ 2 "register_operand" "a,b,b,a"))))_CBRK_)]
""
"%|%.\\tsmpylh\\t%$\\t%1, %2, %_MODk_0"
[(set_attr "type" "mpy2")
(set_attr "units" "m")
(set_attr "cross" "n,n,y,y")])
(define_insn "mulhqsq3_hl_VARIANT_"
[(_SET_ _OBRK_(match_operand:_MSQ 0 "_DESTOPERAND_" "=_A_,_B_,_A_,_B_")
(ss_mult:SQ
(fract_convert:SQ
(truncate:HQ (match_operand:SQ 1 "register_operand" "a,b,b,a")))
(fract_convert:SQ
(match_operand:HQ 2 "register_operand" "a,b,b,a")))_CBRK_)]
""
"%|%.\\tsmpyhl\\t%$\\t%1, %2, %_MODk_0"
[(set_attr "type" "mpy2")
(set_attr "units" "m")
(set_attr "cross" "n,n,y,y")])
(define_insn "mulhqsq3_hh_VARIANT_"
[(_SET_ _OBRK_(match_operand:_MSQ 0 "_DESTOPERAND_" "=_A_,_B_,_A_,_B_")
(ss_mult:SQ
(fract_convert:SQ
(truncate:HQ (match_operand:SQ 1 "register_operand" "a,b,b,a")))
(fract_convert:SQ
(truncate:HQ (match_operand:SQ 2 "register_operand" "a,b,b,a"))))_CBRK_)]
""
"%|%.\\tsmpyh\\t%$\\t%1, %2, %_MODk_0"
[(set_attr "type" "mpy2")
(set_attr "units" "m")
(set_attr "cross" "n,n,y,y")])
| {
"pile_set_name": "Github"
} |
#
# Copyright (C) 2011-2020 Intel Corporation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Intel Corporation nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#
TOP_DIR = ../../..
include $(TOP_DIR)/buildenv.mk
LAUNCH_VERSION:= $(shell awk '$$2 ~ /LAUNCH_VERSION/ { print substr($$3, 2, length($$3) - 2); }' $(COMMON_DIR)/inc/internal/se_version.h)
EPID_VERSION:= $(shell awk '$$2 ~ /EPID_VERSION/ { print substr($$3, 2, length($$3) - 2); }' $(COMMON_DIR)/inc/internal/se_version.h)
QUOTE_EX_VERSION:= $(shell awk '$$2 ~ /QUOTE_EX_VERSION/ { print substr($$3, 2, length($$3) - 2); }' $(COMMON_DIR)/inc/internal/se_version.h)
IPC_COMMON_DIR := $(TOP_DIR)/psw/ae/aesm_service/source/core/ipc
IPC_COMMON_SRC_DIR := $(IPC_COMMON_DIR)
IPC_COMMON_INC_DIR := $(IPC_COMMON_DIR)
IPC_COMMON_PROTO_DIR := $(IPC_COMMON_DIR)
UAE_WRAPPER_DIR := ../uae_wrapper
UAE_SRC_DIR := $(UAE_WRAPPER_DIR)/src
UAE_INC_DIR := $(UAE_WRAPPER_DIR)/inc
AE_COMMON_DIR := $(LINUX_PSW_DIR)/ae/common
INCLUDE += -I.
INCLUDE += -I$(COMMON_DIR) \
-I$(COMMON_DIR)/inc \
-I$(COMMON_DIR)/inc/internal \
INCLUDE += -I$(LINUX_PSW_DIR)/ae/common \
-I$(LINUX_PSW_DIR)/ae/inc \
-I$(LINUX_PSW_DIR)/ae/inc/internal \
-I$(SGX_HEADER_DIR)
INCLUDE += -I$(LINUX_EXTERNAL_DIR)/epid-sdk \
-I$(IPC_COMMON_INC_DIR) \
-I$(UAE_INC_DIR) \
-I$(IPC_COMMON_PROTO_DIR) \
-I$(LINUX_PSW_DIR)/ae/aesm_service/source \
-I$(LINUX_PSW_DIR)/ae/aesm_service/source/common
CXXFLAGS += -fPIC -Werror -Wno-unused-parameter -g -DPROTOBUF_INLINE_NOT_IN_HEADERS=0
EXTERNAL_LIB += -lprotobuf
vpath %.cpp .. $(COMMON_DIR)/src $(IPC_COMMON_SRC_DIR) $(IPC_COMMON_PROTO_DIR) $(UAE_SRC_DIR) $(AE_COMMON_DIR)
vpath %.c $(COMMON_DIR)/src
C_SRC := se_trace.c
IPC_SRC := AEGetQuoteResponse.cpp \
AEInitQuoteRequest.cpp \
AEInitQuoteResponse.cpp \
AEReportAttestationRequest.cpp \
AEReportAttestationResponse.cpp \
AECheckUpdateStatusRequest.cpp \
AECheckUpdateStatusResponse.cpp \
ProtobufSerializer.cpp \
AEGetLaunchTokenRequest.cpp \
AEGetWhiteListSizeRequest.cpp \
AEGetWhiteListSizeResponse.cpp \
AEGetWhiteListRequest.cpp \
AEGetWhiteListResponse.cpp \
AESGXGetExtendedEpidGroupIdRequest.cpp \
AESGXGetExtendedEpidGroupIdResponse.cpp \
AESGXSwitchExtendedEpidGroupRequest.cpp \
AESGXSwitchExtendedEpidGroupResponse.cpp \
AESGXRegisterRequest.cpp \
AESGXRegisterResponse.cpp \
SocketTransporter.cpp \
AEGetLaunchTokenResponse.cpp \
UnixCommunicationSocket.cpp \
AEGetQuoteRequest.cpp \
UnixSocketFactory.cpp \
NonBlockingUnixCommunicationSocket.cpp \
NonBlockingUnixSocketFactory.cpp \
AESelectAttKeyIDRequest.cpp \
AESelectAttKeyIDResponse.cpp \
AEInitQuoteExRequest.cpp \
AEInitQuoteExResponse.cpp \
AEGetQuoteExRequest.cpp \
AEGetQuoteExResponse.cpp \
AEGetQuoteSizeExRequest.cpp \
AEGetQuoteSizeExResponse.cpp \
AEGetSupportedAttKeyIDNumRequest.cpp \
AEGetSupportedAttKeyIDNumResponse.cpp \
AEGetSupportedAttKeyIDsRequest.cpp \
AEGetSupportedAttKeyIDsResponse.cpp
PROTOBUF_SRC := messages.pb.cc
SRC := AEServicesImpl.cpp \
AEServicesProvider.cpp \
uae_api.cpp \
se_sig_rl.cpp \
sgx_uae_service.cpp \
uae_service_assert.cpp
LEGACY_SRC := legacy_uae_service.cpp \
uae_service_version.cpp
OBJ := $(C_SRC:.c=.o) $(SRC:.cpp=.o) $(IPC_SRC:.cpp=.o) $(PROTOBUF_SRC:.cc=.o)
LEGACY_OBJ := $(LEGACY_SRC:.cpp=.o)
LDUFLAGS:= -pthread $(COMMON_LDFLAGS)
LIBNAME := libsgx_epid.so libsgx_launch.so libsgx_quote_ex.so
ifndef DEBUG
LIBNAME_DEBUG = $(LIBNAME:.so=.so.debug)
endif
LEGACY_LIBNAME = libsgx_uae_service.so
LEGACY_LIBNAME_DEBUG = libsgx_uae_service.so.debug
.PHONY: all
all: install_lib
.PHONY: install_lib
install_lib: $(LIBNAME) $(LIBNAME_DEBUG) $(LEGACY_LIBNAME) $(LEGACY_LIBNAME_DEBUG) | $(BUILD_DIR)
@$(foreach lib,$(LIBNAME),$(CP) $(lib) $|;)
@$(CP) $(LEGACY_LIBNAME) $|
ifndef DEBUG
@$(foreach lib,$(LIBNAME_DEBUG),$(CP) $(lib) $|;)
@$(CP) $(LEGACY_LIBNAME_DEBUG) $|
endif
libsgx_%.so: $(OBJ) %_version.o
$(CXX) $(CXXFLAGS) $^ -shared $(LDUFLAGS) -Wl,--version-script=$(@:.so=.lds) -Wl,--gc-sections $(EXTERNAL_LIB) -Wl,-soname=$@.$(call SPLIT_VERSION,$($(shell echo $(@:libsgx_%.so=%_version)|tr a-z A-Z)),1) -o $@
%.so.debug: %.so
ifndef DEBUG
((test -f $@) ||( \
$(CP) $< $<.orig &&\
$(OBJCOPY) --only-keep-debug $< $@ &&\
$(STRIP) -g $< &&\
$(OBJCOPY) --add-gnu-debuglink=$@ $< ))
endif
$(LEGACY_LIBNAME): $(LEGACY_OBJ)
$(CXX) $(CXXFLAGS) $^ -shared $(LDUFLAGS) -ldl -Wl,--version-script=uae_service.lds -Wl,--gc-sections -Wl,-soname=$@ -o $@
$(LEGACY_LIBNAME_DEBUG): $(LEGACY_LIBNAME)
((test -f $(LEGACY_LIBNAME_DEBUG)) || $(MAKE) separate_debug_info)
.PHONY: separate_debug_info
separate_debug_info:
ifndef DEBUG
$(CP) $(LEGACY_LIBNAME) $(LEGACY_LIBNAME).orig
$(OBJCOPY) --only-keep-debug $(LEGACY_LIBNAME) $(LEGACY_LIBNAME_DEBUG)
$(STRIP) -g $(LEGACY_LIBNAME)
$(OBJCOPY) --add-gnu-debuglink=$(LEGACY_LIBNAME_DEBUG) $(LEGACY_LIBNAME)
endif
$(IPC_SRC:.cpp=.o) : $(IPC_COMMON_PROTO_DIR)/messages.pb.cc
AEServicesImpl.o : $(IPC_COMMON_PROTO_DIR)/messages.pb.cc
messages.pb.o : $(IPC_COMMON_PROTO_DIR)/messages.pb.cc
$(CXX) $(filter-out -Wshadow -Wredundant-decls, $(CXXFLAGS)) -Wno-array-bounds -Wno-conversion -c $< -o $@
%.o :%.cpp
$(CXX) $(CXXFLAGS) -Wno-deprecated-declarations $(INCLUDE) -c $< -o $@
%.o: %.c
$(CC) $(CFLAGS) $(INCLUDE) -Werror -fPIC -c $< -o $@
$(BUILD_DIR):
@$(MKDIR) $@
$(IPC_COMMON_PROTO_DIR)/messages.pb.cc: $(IPC_COMMON_PROTO_DIR)/messages.proto
$(MAKE) -C $(IPC_COMMON_PROTO_DIR)
.PHONY: clean
clean:
$(MAKE) -C $(IPC_COMMON_PROTO_DIR) clean
@$(RM) $(OBJ) $(LEGACY_OBJ) *.orig
@$(RM) $(LIBNAME) $(addprefix $(BUILD_DIR)/,$(LIBNAME))
@$(RM) $(LIBNAME_DEBUG) $(addprefix $(BUILD_DIR)/,$(LIBNAME_DEBUG))
@$(RM) $(LEGACY_LIBNAME) $(BUILD_DIR)/$(LEGACY_LIBNAME)
@$(RM) $(LEGACY_LIBNAME_DEBUG) $(BUILD_DIR)/$(LEGACY_LIBNAME_DEBUG)
.PHONY: rebuild
rebuild:
$(MAKE) clean
$(MAKE) all
| {
"pile_set_name": "Github"
} |
{
"suicideNonConst_d0g0v0" : {
"blocks" : [
{
"blockHeaderPremine" : {
"difficulty" : "0x020000",
"gasLimit" : "0x0f4240",
"timestamp" : "0x03e8",
"updatePoW" : "1"
},
"transactions" : [
{
"data" : "0x",
"gasLimit" : "0x061a80",
"gasPrice" : "0x01",
"nonce" : "0x00",
"r" : "0xc1760cf96cfbbc2756850ffd2ff8078543d42da5fd0327619c642b2c8055d5a6",
"s" : "0x66715427a6eca6698235668ae3ee160dbe4f96df97ce96f2d1193a112a15ebb6",
"to" : "0x095e7baea6a6c7c4c2dfeb977efac326af552d87",
"v" : "0x1c",
"value" : "0x00"
}
],
"uncleHeaders" : [
]
}
],
"expect" : [
{
"network" : "Byzantium",
"result" : {
"0x095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
}
}
},
{
"network" : "Constantinople",
"result" : {
"0x095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
}
}
},
{
"network" : "ConstantinopleFix",
"result" : {
"0x095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
}
}
}
],
"genesisBlockHeader" : {
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"coinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"difficulty" : "131072",
"extraData" : "0x42",
"gasLimit" : "0x0f4240",
"gasUsed" : "0",
"mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"nonce" : "0x0102030405060708",
"number" : "0",
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
"timestamp" : "0x03b6",
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
},
"pre" : {
"0x095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
"balance" : "0x00",
"code" : "0x73095e7baea6a6c7c4c2dfeb977efac326af552d8731ff",
"nonce" : "0x00",
"storage" : {
}
},
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "0x0de0b6b3a7640000",
"code" : "",
"nonce" : "0x00",
"storage" : {
}
}
},
"sealEngine" : "NoProof"
}
} | {
"pile_set_name": "Github"
} |
package three_sum
import (
"testing"
)
func TestThreeSum(t *testing.T) {
}
| {
"pile_set_name": "Github"
} |
ALTER TABLE `locales_npc_text`
ADD COLUMN `Text8_0_loc1` LONGTEXT NULL AFTER `Text7_1_loc11`,
ADD COLUMN `Text8_0_loc2` LONGTEXT NULL AFTER `Text8_0_loc1`,
ADD COLUMN `Text8_0_loc3` LONGTEXT NULL AFTER `Text8_0_loc2`,
ADD COLUMN `Text8_0_loc4` LONGTEXT NULL AFTER `Text8_0_loc3`,
ADD COLUMN `Text8_0_loc5` LONGTEXT NULL AFTER `Text8_0_loc4`,
ADD COLUMN `Text8_0_loc6` LONGTEXT NULL AFTER `Text8_0_loc5`,
ADD COLUMN `Text8_0_loc7` LONGTEXT NULL AFTER `Text8_0_loc6`,
ADD COLUMN `Text8_0_loc8` LONGTEXT NULL AFTER `Text8_0_loc7`,
ADD COLUMN `Text8_0_loc9` LONGTEXT NULL AFTER `Text8_0_loc8`,
ADD COLUMN `Text8_0_loc10` LONGTEXT NULL AFTER `Text8_0_loc9`,
ADD COLUMN `Text8_0_loc11` LONGTEXT NULL AFTER `Text8_0_loc10`,
ADD COLUMN `Text8_1_loc1` LONGTEXT NULL AFTER `Text8_0_loc11`,
ADD COLUMN `Text8_1_loc2` LONGTEXT NULL AFTER `Text8_1_loc1`,
ADD COLUMN `Text8_1_loc3` LONGTEXT NULL AFTER `Text8_1_loc2`,
ADD COLUMN `Text8_1_loc4` LONGTEXT NULL AFTER `Text8_1_loc3`,
ADD COLUMN `Text8_1_loc5` LONGTEXT NULL AFTER `Text8_1_loc4`,
ADD COLUMN `Text8_1_loc6` LONGTEXT NULL AFTER `Text8_1_loc5`,
ADD COLUMN `Text8_1_loc7` LONGTEXT NULL AFTER `Text8_1_loc6`,
ADD COLUMN `Text8_1_loc8` LONGTEXT NULL AFTER `Text8_1_loc7`,
ADD COLUMN `Text8_1_loc9` LONGTEXT NULL AFTER `Text8_1_loc8`,
ADD COLUMN `Text8_1_loc10` LONGTEXT NULL AFTER `Text8_1_loc9`,
ADD COLUMN `Text8_1_loc11` LONGTEXT NULL AFTER `Text8_1_loc10`,
ADD COLUMN `Text9_0_loc1` LONGTEXT NULL AFTER `Text8_1_loc11`,
ADD COLUMN `Text9_0_loc2` LONGTEXT NULL AFTER `Text9_0_loc1`,
ADD COLUMN `Text9_0_loc3` LONGTEXT NULL AFTER `Text9_0_loc2`,
ADD COLUMN `Text9_0_loc4` LONGTEXT NULL AFTER `Text9_0_loc3`,
ADD COLUMN `Text9_0_loc5` LONGTEXT NULL AFTER `Text9_0_loc4`,
ADD COLUMN `Text9_0_loc6` LONGTEXT NULL AFTER `Text9_0_loc5`,
ADD COLUMN `Text9_0_loc7` LONGTEXT NULL AFTER `Text9_0_loc6`,
ADD COLUMN `Text9_0_loc8` LONGTEXT NULL AFTER `Text9_0_loc7`,
ADD COLUMN `Text9_0_loc9` LONGTEXT NULL AFTER `Text9_0_loc8`,
ADD COLUMN `Text9_0_loc10` LONGTEXT NULL AFTER `Text9_0_loc9`,
ADD COLUMN `Text9_0_loc11` LONGTEXT NULL AFTER `Text9_0_loc10`,
ADD COLUMN `Text9_1_loc1` LONGTEXT NULL AFTER `Text9_0_loc11`,
ADD COLUMN `Text9_1_loc2` LONGTEXT NULL AFTER `Text9_1_loc1`,
ADD COLUMN `Text9_1_loc3` LONGTEXT NULL AFTER `Text9_1_loc2`,
ADD COLUMN `Text9_1_loc4` LONGTEXT NULL AFTER `Text9_1_loc3`,
ADD COLUMN `Text9_1_loc5` LONGTEXT NULL AFTER `Text9_1_loc4`,
ADD COLUMN `Text9_1_loc6` LONGTEXT NULL AFTER `Text9_1_loc5`,
ADD COLUMN `Text9_1_loc7` LONGTEXT NULL AFTER `Text9_1_loc6`,
ADD COLUMN `Text9_1_loc8` LONGTEXT NULL AFTER `Text9_1_loc7`,
ADD COLUMN `Text9_1_loc9` LONGTEXT NULL AFTER `Text9_1_loc8`,
ADD COLUMN `Text9_1_loc10` LONGTEXT NULL AFTER `Text9_1_loc9`,
ADD COLUMN `Text9_1_loc11` LONGTEXT NULL AFTER `Text9_1_loc10`,
ADD COLUMN `Text10_0_loc1` LONGTEXT NULL AFTER `Text9_1_loc11`,
ADD COLUMN `Text10_0_loc2` LONGTEXT NULL AFTER `Text10_0_loc1`,
ADD COLUMN `Text10_0_loc3` LONGTEXT NULL AFTER `Text10_0_loc2`,
ADD COLUMN `Text10_0_loc4` LONGTEXT NULL AFTER `Text10_0_loc3`,
ADD COLUMN `Text10_0_loc5` LONGTEXT NULL AFTER `Text10_0_loc4`,
ADD COLUMN `Text10_0_loc6` LONGTEXT NULL AFTER `Text10_0_loc5`,
ADD COLUMN `Text10_0_loc7` LONGTEXT NULL AFTER `Text10_0_loc6`,
ADD COLUMN `Text10_0_loc8` LONGTEXT NULL AFTER `Text10_0_loc7`,
ADD COLUMN `Text10_0_loc9` LONGTEXT NULL AFTER `Text10_0_loc8`,
ADD COLUMN `Text10_0_loc10` LONGTEXT NULL AFTER `Text10_0_loc9`,
ADD COLUMN `Text10_0_loc11` LONGTEXT NULL AFTER `Text10_0_loc10`,
ADD COLUMN `Text10_1_loc1` LONGTEXT NULL AFTER `Text10_0_loc11`,
ADD COLUMN `Text10_1_loc2` LONGTEXT NULL AFTER `Text10_1_loc1`,
ADD COLUMN `Text10_1_loc3` LONGTEXT NULL AFTER `Text10_1_loc2`,
ADD COLUMN `Text10_1_loc4` LONGTEXT NULL AFTER `Text10_1_loc3`,
ADD COLUMN `Text10_1_loc5` LONGTEXT NULL AFTER `Text10_1_loc4`,
ADD COLUMN `Text10_1_loc6` LONGTEXT NULL AFTER `Text10_1_loc5`,
ADD COLUMN `Text10_1_loc7` LONGTEXT NULL AFTER `Text10_1_loc6`,
ADD COLUMN `Text10_1_loc8` LONGTEXT NULL AFTER `Text10_1_loc7`,
ADD COLUMN `Text10_1_loc9` LONGTEXT NULL AFTER `Text10_1_loc8`,
ADD COLUMN `Text10_1_loc10` LONGTEXT NULL AFTER `Text10_1_loc9`,
ADD COLUMN `Text10_1_loc11` LONGTEXT NULL AFTER `Text10_1_loc10`,
ADD COLUMN `Text11_0_loc1` LONGTEXT NULL AFTER `Text10_1_loc11`,
ADD COLUMN `Text11_0_loc2` LONGTEXT NULL AFTER `Text11_0_loc1`,
ADD COLUMN `Text11_0_loc3` LONGTEXT NULL AFTER `Text11_0_loc2`,
ADD COLUMN `Text11_0_loc4` LONGTEXT NULL AFTER `Text11_0_loc3`,
ADD COLUMN `Text11_0_loc5` LONGTEXT NULL AFTER `Text11_0_loc4`,
ADD COLUMN `Text11_0_loc6` LONGTEXT NULL AFTER `Text11_0_loc5`,
ADD COLUMN `Text11_0_loc7` LONGTEXT NULL AFTER `Text11_0_loc6`,
ADD COLUMN `Text11_0_loc8` LONGTEXT NULL AFTER `Text11_0_loc7`,
ADD COLUMN `Text11_0_loc9` LONGTEXT NULL AFTER `Text11_0_loc8`,
ADD COLUMN `Text11_0_loc10` LONGTEXT NULL AFTER `Text11_0_loc9`,
ADD COLUMN `Text11_0_loc11` LONGTEXT NULL AFTER `Text11_0_loc10`,
ADD COLUMN `Text11_1_loc1` LONGTEXT NULL AFTER `Text11_0_loc11`,
ADD COLUMN `Text11_1_loc2` LONGTEXT NULL AFTER `Text11_1_loc1`,
ADD COLUMN `Text11_1_loc3` LONGTEXT NULL AFTER `Text11_1_loc2`,
ADD COLUMN `Text11_1_loc4` LONGTEXT NULL AFTER `Text11_1_loc3`,
ADD COLUMN `Text11_1_loc5` LONGTEXT NULL AFTER `Text11_1_loc4`,
ADD COLUMN `Text11_1_loc6` LONGTEXT NULL AFTER `Text11_1_loc5`,
ADD COLUMN `Text11_1_loc7` LONGTEXT NULL AFTER `Text11_1_loc6`,
ADD COLUMN `Text11_1_loc8` LONGTEXT NULL AFTER `Text11_1_loc7`,
ADD COLUMN `Text11_1_loc9` LONGTEXT NULL AFTER `Text11_1_loc8`,
ADD COLUMN `Text11_1_loc10` LONGTEXT NULL AFTER `Text11_1_loc9`,
ADD COLUMN `Text11_1_loc11` LONGTEXT NULL AFTER `Text11_1_loc10`;
| {
"pile_set_name": "Github"
} |
package org.protege.owlapi.inference.orphan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
/**
* This class encapsulates a relation, <i>r: X → X</i>. Its purpose is to calculate the set of terminal
* elements of the transitive closure of the relation r. We will define the notion of a terminal
* element below.
* <p>
* The transitive closure of <i>r</i> is an ordering and we denote it as ≤ (e.g. ∀ x∀ y∈ r(x). x≤ y).
* There is a natural
* equivalence relation defined by
* <center>
* x ≈ y ⇔ x ≤ y and y ≤ x.
* </center>
* An element x in X is said to be terminal if for all y with
* <center>
* y ∈ r(x)
* </center>
* we have x ≈ y. This is different from the more natural definition that x is terminal if for all y with
* <center>
* x ≤ y
* </center>
* we have x ≈ y. So for instance in the case where we have
* <center>
* r(x) = {y}, r(y) = {x, z}
* </center>
* x would be terminal by the first definition but not by the second defintion. Conversations with
* users revealed that the second more natural definition of terminal was not what the
* user wanted to see.
* <p>
* We want to use the algorithm in this class in an incremental fashion so at any given time so this routine
* contain state that includes the current set of all terminal elements. The algorithm calculates whether an
* element x in X is terminal as follows:
* <ol>
* <li> it recursively generates all paths <i>x, x<sub>1</sub>, x<sub>2</sub>, x<sub>3</sub>, ...</i>
* where <i>x<sub>i+1</sub> ∈ r(x<sub>i</sub>)</i> and
* <i>x<sub>i</sub> ≠ x<sub>j</sub></i> for <i>i≠ j</i>. It is an assumption of the algorithm that
* these paths won't be that long.
* When the path
* <center><i>
* x, x<sub>1</sub>, ..., x<sub>n</sub>
* </i></center>
* cannot be extended any further it looks at all <i>x<sub>i</sub> ∈ r(x<sub>n</sub></i>) and generates the
* assertion that
* <center><i>
* x<sub>i</sub>, x<sub>i+1</sub>, ..., x<sub>n</sub>
* </i></center>
* are equivalent.
* </li>
* <li> Once all the paths with a given prefix
* <center><i>
* x, x<sub>1</sub>, ..., x<sub>i</sub>
* </i></center>
* have been found, we know that we have calculated all the nodes that are equivalent to x<sub>i</sub>.
* We can therefore apply the following logic:
* <ol>
* <li> If there are no <i>y ∈ r(x<sub>i</sub>)</i> then <i>x<sub>i</sub></i> is terminal.
* <li> If any <i>y ∈ r(x<sub>i</sub>)</i> is in a different equivalence class
* than <i>x<sub>i</sub></i> then <i>x<sub>i</sub></i> is non-terminal.
* <li> If all <i>y ∈ r(x<sub>i</sub>)</i> are in the same equivalence class
* as <i>x<sub>i</sub></i> then <i>x<sub>i</sub></i> can be marked as terminal.
* </ol>
* </ol>
* @author Timothy Redmond
*
*/
public class TerminalElementFinder<X extends Comparable<? super X>> {
private static Logger logger = LoggerFactory.getLogger(TerminalElementFinder.class);
private Relation<X> r;
private Set<X> terminalElements = new HashSet<>();
private EquivalenceRelation<X> equivalence = new EquivalenceRelation<>();
private Set<X> equivalenceAlreadyCalculated = new HashSet<>();
public TerminalElementFinder(Relation<X> r) {
this.r = r;
}
public void findTerminalElements(Set<X> candidates) {
clear();
appendTerminalElements(candidates);
finish();
}
public void clear() {
terminalElements = new HashSet<>();
equivalence.clear();
}
/*
* don't call this when the order relation has changed. This only adds
* elements to the terminal elements. Instead form the unison of the current
* terminal elements and the new candidates and call findTerminalElements again.
*/
public void appendTerminalElements(Set<X> candidates) {
equivalenceAlreadyCalculated.clear();
for (X candidate : candidates) {
if (logger.isDebugEnabled()) {
logger.debug("calling build equivs at {} with null path ", candidate);
}
buildEquivalenceMapping(candidate, null);
if (logger.isDebugEnabled()) {
logger.debug("Call to build equivs completed at {}", candidate);
equivalence.logEquivalences(logger);
}
}
equivalenceAlreadyCalculated.clear();
}
public void finish() {
equivalence.clear();
}
public Set<X> getTerminalElements() {
return Collections.unmodifiableSet(terminalElements);
}
private void buildEquivalenceMapping(X x, Path<X> p) {
if (equivalenceAlreadyCalculated.contains(x)) {
return;
}
if (p != null && p.contains(x)) {
equivalence.merge(p.getLoop(x));
if (logger.isDebugEnabled()) {
logger.debug("Found loop");
logLoop(p, x);
}
return;
}
Collection<X> relatedToX = r.getR(x);
if (relatedToX == null || relatedToX.isEmpty()) {
terminalElements.add(x);
equivalenceAlreadyCalculated.add(x);
return;
}
Path<X> newPath = new Path<>(p, x);
for (X y : relatedToX) {
if (logger.isDebugEnabled()) {
logger.debug("calling build equivs at {} with path ", y );
logPath(newPath);
}
buildEquivalenceMapping(y, newPath);
if (logger.isDebugEnabled()) {
logger.debug("Call to build equivs completed at {}", y);
equivalence.logEquivalences(logger);
}
}
boolean terminal = true;
for (X y: relatedToX) {
if (!equivalence.equivalent(x, y)) {
terminal = false;
break;
}
}
if (terminal) {
terminalElements.add(x);
}
equivalenceAlreadyCalculated.add(x);
}
public boolean removeTerminalElement(X x) {
return terminalElements.remove(x);
}
public void addRelation(X x, X y) {
if (!terminalElements.contains(x)) {
return;
}
Set<X> candidates = new HashSet<>(terminalElements);
candidates.add(y);
findTerminalElements(candidates);
}
public void removeRelation(X x, X y) {
Set<X> candidates = new HashSet<>(terminalElements);
candidates.add(x);
findTerminalElements(candidates);
}
private void logPath(Path<X> p) {
if (logger.isDebugEnabled()) {
logger.debug("Path Trace");
for (Path<X> point = p; point != null; point = point.getNext()) {
logger.debug("Pathelement = {}", point.getObject());
}
}
}
private void logLoop(Path<X> p, X x) {
if (logger.isDebugEnabled()) {
logger.debug("Loop:" );
logger.debug("Pathelement = {}", x);
for (Path<X> point = p; !point.getObject().equals(x); point = point.getNext()) {
logger.debug("Pathelement = {}", point.getObject());
}
logger.debug("Pathelement = {}", x);
}
}
}
| {
"pile_set_name": "Github"
} |
var/global/list/del_profiling = list()
var/global/list/gdel_profiling = list()
var/global/list/ghdel_profiling = list()
#define HOLYWATER_DURATION 8 MINUTES
/atom
var/ghost_read = 1 // All ghosts can read
var/ghost_write = 0 // Only aghosts can write
var/blessed=0 // Chaplain did his thing. (set by bless() proc, which is called by holywater)
var/flags = FPRINT
var/flow_flags = 0
var/list/fingerprints
var/list/fingerprintshidden
var/fingerprintslast = null
var/fingerprintslastTS = null
var/list/blood_DNA
var/blood_color
var/had_blood //Something was bloody at some point.
var/germ_level = 0 // The higher the germ level, the more germ on the atom.
var/penetration_dampening = 5 //drains some of a projectile's penetration power whenever it goes through the atom
///Chemistry.
var/datum/reagents/reagents = null
//var/chem_is_open_container = 0
// replaced by OPENCONTAINER flags and atom/proc/is_open_container()
///Chemistry.
var/list/beams
var/labeled //Stupid and ugly way to do it, but the alternative would probably require rewriting everywhere a name is read.
var/min_harm_label = 0 //Minimum langth of harm-label to be effective. 0 means it cannot be harm-labeled. If any label should work, set this to 1 or 2.
var/harm_labeled = 0 //Length of current harm-label. 0 if it doesn't have one.
var/list/harm_label_examine //Messages that appears when examining the item if it is harm-labeled. Message in position 1 is if it is harm-labeled but the label is too short to work, while message in position 2 is if the harm-label works.
//var/harm_label_icon_state //Makes sense to have this, but I can't sprite. May be added later.
var/list/last_beamchecks // timings for beam checks.
var/ignoreinvert = 0
var/timestopped
appearance_flags = TILE_BOUND|LONG_GLIDE
var/slowdown_modifier //modified on how fast a person can move over the tile we are on, see turf.dm for more info
/// Last name used to calculate a color for the chatmessage overlays
var/chat_color_name
/// Last color calculated for the the chatmessage overlays
var/chat_color
/// A luminescence-shifted value of the last color calculated for chatmessage overlays
var/chat_color_darkened
/// The chat color var, without alpha.
var/chat_color_hover
/atom/proc/beam_connect(var/obj/effect/beam/B)
if(!last_beamchecks)
last_beamchecks = list()
if(!beams)
beams = list()
if(!(B in beams))
beams.Add(B)
return 1
/atom/proc/beam_disconnect(var/obj/effect/beam/B)
if (beams)
beams.Remove(B)
/atom/proc/apply_beam_damage(var/obj/effect/beam/B)
return 1
/atom/proc/handle_beams()
return 1
/atom/variable_edited(variable_name, old_value, new_value)
.=..()
switch(variable_name)
if("light_color")
set_light(l_color = new_value)
return 1
if("light_range")
set_light(new_value)
return 1
if("light_power")
set_light(l_power = new_value)
if("contents")
if(islist(new_value))
if(length(new_value) == 0) //empty list
return 0 //Replace the contents list with an empty list, nullspacing everything
else
//If the new value is a list with objects, don't nullspace the old objects, and merge the two lists together peacefully
contents.Add(new_value)
return 1
/atom/proc/shake(var/xy, var/intensity, mob/user) //Zth. SHAKE IT. Vending machines' kick uses this
var/old_pixel_x = pixel_x
var/old_pixel_y = pixel_y
switch(xy)
if(1)
src.pixel_x += rand(-intensity, intensity) * PIXEL_MULTIPLIER
if(2)
src.pixel_y += rand(-intensity, intensity) * PIXEL_MULTIPLIER
if(3)
src.pixel_x += rand(-intensity, intensity) * PIXEL_MULTIPLIER
src.pixel_y += rand(-intensity, intensity) * PIXEL_MULTIPLIER
spawn(2)
src.pixel_x = old_pixel_x
src.pixel_y = old_pixel_y
// NOTE FROM AMATEUR CODER WHO STRUGGLED WITH RUNTIMES
// throw_impact is called multiple times when an item is thrown: see /atom/movable/proc/hit_check at atoms_movable.dm
// Do NOT delete an item as part of its throw_impact unless you've checked the hit_atom is a turf, as that's effectively the last time throw_impact is called in a single throw.
// Otherwise, shit will runtime in the subsequent throw_impact calls.
/atom/proc/throw_impact(atom/hit_atom, var/speed, mob/user)
if(istype(hit_atom,/mob/living))
var/mob/living/M = hit_atom
M.hitby(src,speed,src.dir)
log_attack("<font color='red'>[hit_atom] ([M ? M.ckey : "what"]) was hit by [src] thrown by [user] ([user ? user.ckey : "what"])</font>")
else if(isobj(hit_atom))
var/obj/O = hit_atom
if(!O.anchored)
O.set_glide_size(0)
step(O, src.dir)
O.hitby(src,speed)
else if(isturf(hit_atom) && !istype(src,/obj/mecha))//heavy mechs don't just bounce off walls, also it can fuck up rocket dashes
var/turf/T = hit_atom
if(T.density)
spawn(2)
step(src, turn(src.dir, 180))
if(istype(src,/mob/living))
var/mob/living/M = src
M.take_organ_damage(10)
/atom/Destroy()
if(reagents)
qdel(reagents)
reagents = null
if(density)
densityChanged()
// Idea by ChuckTheSheep to make the object even more unreferencable.
invisibility = 101
if(istype(beams, /list) && beams.len)
beams.len = 0
/*if(istype(beams) && beams.len)
for(var/obj/effect/beam/B in beams)
if(B && B.target == src)
B.target = null
if(B.master && B.master.target == src)
B.master.target = null
beams.len = 0
*/
..()
/atom/proc/assume_air(datum/gas_mixture/giver)
return null
/atom/proc/remove_air(amount)
return null
/atom/proc/return_air()
if(loc)
return loc.return_air()
else
return null
/atom/proc/check_eye(user as mob)
if (istype(user, /mob/living/silicon/ai)) // WHYYYY
return 1
return
/atom/proc/on_reagent_change()
return
// This proc is intended to be called by `to_bump` whenever a movable
// object bumps into this atom.
/atom/proc/Bumped(atom/movable/AM)
return
/atom/proc/setDensity(var/density)
if (density == src.density)
return FALSE // No need to invoke the event when we're not doing any actual change
src.density = density
densityChanged()
/atom/proc/densityChanged()
lazy_invoke_event(/lazy_event/on_density_change, list("atom" = src))
if(beams && beams.len) // If beams is not a list something bad happened and we want to have a runtime to lynch whomever is responsible.
beams.len = 0
if(!isturf(src))
var/turf/T = get_turf(src)
if(T)
T.densityChanged()
/atom/proc/bumped_by_firebird(var/obj/structure/bed/chair/vehicle/firebird/F)
return Bumped(F)
// Convenience proc to see if a container is open for chemistry handling
// returns true if open
// false if closed
/atom/proc/is_open_container()
return flags & OPENCONTAINER
// For when we want an open container that doesn't show its reagents on examine
/atom/proc/hide_own_reagents()
return FALSE
// As a rule of thumb, should smoke be able to pop out from inside this object?
// Currently only used for chemical reactions, see Chemistry-Recipes.dm
/atom/proc/is_airtight()
return 0
/*//Convenience proc to see whether a container can be accessed in a certain way.
/atom/proc/can_subract_container()
return flags & EXTRACT_CONTAINER
/atom/proc/can_add_container()
return flags & INSERT_CONTAINER
*/
/atom/proc/allow_drop()
return 1
/atom/proc/HasProximity(atom/movable/AM as mob|obj) //IF you want to use this, the atom must have the PROXMOVE flag, and the moving atom must also have the PROXMOVE flag currently to help with lag
return
/atom/proc/emp_act(var/severity)
set waitfor = FALSE
return
/atom/proc/kick_act(mob/living/carbon/human/user) //Called when this atom is kicked. If returns 1, normal click action will be performed after calling this (so attack_hand() in most cases)
return 1
/atom/proc/bite_act(mob/living/carbon/human/user) //Called when this atom is bitten. If returns 1, same as kick_act()
return 1
/atom/proc/bullet_act(var/obj/item/projectile/Proj)
return 0
/atom/proc/in_contents_of(container)//can take class or object instance as argument
if(ispath(container))
if(istype(src.loc, container))
return 1
else if(src in container)
return 1
return
/atom/proc/recursive_in_contents_of(var/atom/container, var/atom/searching_for = src)
if(isturf(searching_for))
return FALSE
if(loc == container)
return TRUE
return recursive_in_contents_of(container, src.loc)
/atom/proc/projectile_check()
return
//Override this to have source respond differently to visible_messages said by an atom A
/atom/proc/on_see(var/message, var/blind_message, var/drugged_message, var/blind_drugged_message, atom/A)
/*
* atom/proc/search_contents_for(path,list/filter_path=null)
* Recursevly searches all atom contens (including contents contents and so on).
*
* ARGS: path - search atom contents for atoms of this type
* list/filter_path - if set, contents of atoms not of types in this list are excluded from search.
*
* RETURNS: list of found atoms
*/
/atom/proc/search_contents_for(path,list/filter_path=null)
var/list/found = list()
for(var/atom/A in src)
if(istype(A, path))
found += A
if(filter_path)
var/pass = 0
for(var/type in filter_path)
pass |= istype(A, type)
if(!pass)
continue
if(A.contents.len)
found += A.search_contents_for(path,filter_path)
return found
/*
* atom/proc/contains_atom_from_list(var/list/L)
* Basically same as above but it takes a list of paths (like list(/mob/living/,/obj/machinery/something,...))
* RETURNS: a found atom
*/
/atom/proc/contains_atom_from_list(var/list/L)
for(var/atom/A in src)
for(var/T in L)
if(istype(A,T))
return A
if(A.contents.len)
var/atom/R = A.contains_atom_from_list(L)
if(R)
return R
return 0
/*
Beam code by Gunbuddy
Beam() proc will only allow one beam to come from a source at a time. Attempting to call it more than
once at a time per source will cause graphical errors.
Also, the icon used for the beam will have to be vertical and 32x32.
The math involved assumes that the icon is vertical to begin with so unless you want to adjust the math,
its easier to just keep the beam vertical.
*/
/atom/proc/Beam(atom/BeamTarget,icon_state="b_beam",icon='icons/effects/beam.dmi',time=50, maxdistance=10)
//BeamTarget represents the target for the beam, basically just means the other end.
//Time is the duration to draw the beam
//Icon is obviously which icon to use for the beam, default is beam.dmi
//Icon_state is what icon state is used. Default is b_beam which is a blue beam.
//Maxdistance is the longest range the beam will persist before it gives up.
var/EndTime=world.time+time
var/broken = 0
var/obj/item/projectile/beam/lightning/light = new /obj/item/projectile/beam/lightning
while(BeamTarget&&world.time<EndTime&&get_dist(src,BeamTarget)<maxdistance&&z==BeamTarget.z)
//If the BeamTarget gets deleted, the time expires, or the BeamTarget gets out
//of range or to another z-level, then the beam will stop. Otherwise it will
//continue to draw.
//dir=get_dir(src,BeamTarget) //Causes the source of the beam to rotate to continuosly face the BeamTarget.
for(var/obj/effect/overlay/beam/O in orange(10,src)) //This section erases the previously drawn beam because I found it was easier to
if(O.BeamSource==src) //just draw another instance of the beam instead of trying to manipulate all the
qdel(O) //pieces to a new orientation.
var/Angle=round(Get_Angle(src,BeamTarget))
var/icon/I=new(icon,icon_state)
I.Turn(Angle)
var/DX=(WORLD_ICON_SIZE*BeamTarget.x+BeamTarget.pixel_x)-(WORLD_ICON_SIZE*x+pixel_x)
var/DY=(WORLD_ICON_SIZE*BeamTarget.y+BeamTarget.pixel_y)-(WORLD_ICON_SIZE*y+pixel_y)
var/N=0
var/length=round(sqrt((DX)**2+(DY)**2))
for(N,N<length,N+=WORLD_ICON_SIZE)
var/obj/effect/overlay/beam/X=new /obj/effect/overlay/beam(loc)
X.BeamSource=src
if(N+WORLD_ICON_SIZE>length)
var/icon/II=new(icon,icon_state)
II.DrawBox(null,1,(length-N),WORLD_ICON_SIZE,WORLD_ICON_SIZE)
II.Turn(Angle)
X.icon=II
else
X.icon=I
var/Pixel_x=round(sin(Angle)+WORLD_ICON_SIZE*sin(Angle)*(N+WORLD_ICON_SIZE/2)/WORLD_ICON_SIZE)
var/Pixel_y=round(cos(Angle)+WORLD_ICON_SIZE*cos(Angle)*(N+WORLD_ICON_SIZE/2)/WORLD_ICON_SIZE)
if(DX==0)
Pixel_x=0
if(DY==0)
Pixel_y=0
if(Pixel_x>WORLD_ICON_SIZE)
for(var/a=0, a<=Pixel_x,a+=WORLD_ICON_SIZE)
X.x++
Pixel_x-=WORLD_ICON_SIZE
if(Pixel_x<-WORLD_ICON_SIZE)
for(var/a=0, a>=Pixel_x,a-=WORLD_ICON_SIZE)
X.x--
Pixel_x+=WORLD_ICON_SIZE
if(Pixel_y>WORLD_ICON_SIZE)
for(var/a=0, a<=Pixel_y,a+=WORLD_ICON_SIZE)
X.y++
Pixel_y-=WORLD_ICON_SIZE
if(Pixel_y<-WORLD_ICON_SIZE)
for(var/a=0, a>=Pixel_y,a-=WORLD_ICON_SIZE)
X.y--
Pixel_y+=WORLD_ICON_SIZE
X.pixel_x=Pixel_x
X.pixel_y=Pixel_y
var/turf/TT = get_turf(X.loc)
if(TT.density)
qdel(X)
break
for(var/obj/O in TT)
if(!O.Cross(light))
broken = 1
break
else if(O.density)
broken = 1
break
if(broken)
qdel(X)
break
sleep(3) //Changing this to a lower value will cause the beam to follow more smoothly with movement, but it will also be more laggy.
//I've found that 3 ticks provided a nice balance for my use.
for(var/obj/effect/overlay/beam/O in orange(10,src)) if(O.BeamSource==src) qdel(O)
//Woo hoo. Overtime
//All atoms
/atom/proc/examine(mob/user, var/size = "", var/show_name = TRUE, var/show_icon = TRUE)
//This reformat names to get a/an properly working on item descriptions when they are bloody
var/f_name = "\a [src]."
if(src.blood_DNA && src.blood_DNA.len)
if(gender == PLURAL)
f_name = "some "
else
f_name = "a "
f_name += "<span class='danger'>blood-stained</span> [name]!"
if(show_name)
to_chat(user, "[show_icon ? bicon(src) : ""] That's [f_name]" + size)
if(desc)
to_chat(user, desc)
if(reagents && is_open_container() && !ismob(src) && !hide_own_reagents()) //is_open_container() isn't really the right proc for this, but w/e
if(get_dist(user,src) > 3)
to_chat(user, "<span class='info'>You can't make out the contents.</span>")
else
reagents.get_examine(user)
if(on_fire)
user.simple_message("<span class='danger'>OH SHIT! IT'S ON FIRE!</span>",\
"<span class='info'>It's on fire, man.</span>")
if(min_harm_label && harm_labeled)
if(harm_labeled < min_harm_label)
to_chat(user, harm_label_examine[1])
else
to_chat(user, harm_label_examine[2])
var/obj/item/device/camera_bug/bug = locate() in src
if(bug)
var/this_turf = get_turf(src)
var/user_turf = get_turf(user)
var/distance = get_dist(this_turf, user_turf)
if(Adjacent(user))
to_chat(user, "<a href='?src=\ref[src];bug=\ref[bug]'>There's something hidden in there.</a>")
else if(isobserver(user) || prob(100 / (distance + 2)))
to_chat(user, "There's something hidden in there.")
/atom/Topic(href, href_list)
. = ..()
if(.)
return
var/obj/item/device/camera_bug/bug = locate(href_list["bug"])
if(istype(bug))
. = 1
if(isAdminGhost(usr))
bug.removed(null, null, FALSE)
if(ishuman(usr) && !usr.incapacitated() && Adjacent(usr) && usr.dexterity_check())
bug.removed(usr)
/atom/proc/relaymove()
return
// Try to override a mob's eastface(), westface() etc. (CTRL+RIGHTARROW, CTRL+LEFTARROW). Return 1 if successful, which blocks the mob's own eastface() etc.
// Called first on the mob's loc (turf, locker, mech), then on whatever the mob is buckled to, if anything.
/atom/proc/relayface()
return
// Severity is actually "distance".
// 1 is pretty much just del(src).
// 2 is moderate damage.
// 3 is light damage.
//
// child is set to the child object that exploded, if available.
/atom/proc/ex_act(var/severity, var/child=null)
return
/atom/proc/mech_drill_act(var/severity, var/child=null)
return ex_act(severity, child)
/atom/proc/can_mech_drill()
return acidable()
/atom/proc/blob_act(destroy = 0,var/obj/effect/blob/source = null)
//DEBUG to_chat(pick(player_list),"blob_act() on [src] ([src.type])")
if(flags & INVULNERABLE)
return
if (source)
anim(target = loc, a_icon = source.icon, flick_anim = "blob_act", sleeptime = 15, direction = get_dir(source, src), lay = BLOB_SPORE_LAYER, plane = BLOB_PLANE)
else
anim(target = loc, a_icon = 'icons/mob/blob/blob.dmi', flick_anim = "blob_act", sleeptime = 15, lay = BLOB_SPORE_LAYER, plane = BLOB_PLANE)
return
/atom/proc/singularity_act()
return
//Called when a shuttle collides with an atom
/atom/proc/shuttle_act(var/datum/shuttle/S)
return
//Called on every object in a shuttle which rotates
/atom/proc/shuttle_rotate(var/angle)
src.dir = turn(src.dir, -angle)
if(canSmoothWith()) //Smooth the smoothable
spawn //Usually when this is called right after an atom is moved. Not having this "spawn" here will cause this atom to look for its neighbours BEFORE they have finished moving, causing bad stuff.
relativewall()
relativewall_neighbours()
if(pixel_x || pixel_y)
var/cosine = cos(angle)
var/sine = sin(angle)
var/newX = (cosine * pixel_x) + (sine * pixel_y)
var/newY = -(sine * pixel_x) + (cosine* pixel_y)
pixel_x = newX
pixel_y = newY
/atom/proc/singularity_pull()
return
/atom/proc/emag_act()
return
/atom/proc/supermatter_act(atom/source, severity)
qdel(src)
return 1
// Returns TRUE if it's been handled, children should return if parent has already handled
/atom/proc/hitby(var/atom/movable/AM)
. = isobserver(AM)
/atom/proc/add_hiddenprint(mob/M as mob)
if(isnull(M))
return
if(isnull(M.key))
return
if (!(flags & FPRINT))
return
if((fingerprintslastTS == time_stamp()) && (fingerprintslast == M.key)) //otherwise holding arrow on airlocks spams fingerprints onto it
return
if (ishuman(M))
var/mob/living/carbon/human/H = M
if (!istype(H.dna, /datum/dna))
return 0
if (H.gloves)
fingerprintshidden += text("\[[time_stamp()]\] (Wearing gloves). Real name: [], Key: []",H.real_name, H.key)
fingerprintslast = H.key
fingerprintslastTS = time_stamp()
return 0
if (!( src.fingerprints ))
fingerprintshidden += text("\[[time_stamp()]\] Real name: [], Key: []",H.real_name, H.key)
fingerprintslast = H.key
fingerprintslastTS = time_stamp()
return 1
else
var/ghost = ""
if (isobserver(M))
ghost = isAdminGhost(M) ? "ADMINGHOST" : "GHOST"
fingerprintshidden += text("\[[time_stamp()]\] [ghost ? "([ghost])" : ""] Real name: [], Key: []",M.real_name, M.key)
fingerprintslast = M.key
fingerprintslastTS = time_stamp()
return
/atom/proc/add_fingerprint(mob/living/M as mob)
if(isnull(M))
return
if(isAI(M))
return
if(isnull(M.key))
return
if (!(flags & FPRINT))
return
if((fingerprintslastTS == time_stamp()) && (fingerprintslast == M.key)) //otherwise holding arrow on airlocks spams fingerprints onto it
return
if (ishuman(M))
//Add the list if it does not exist.
if(!fingerprintshidden)
fingerprintshidden = list()
//Fibers~
add_fibers(M)
//He has no prints!
if (M_FINGERPRINTS in M.mutations)
fingerprintshidden += "\[[time_stamp()]\] (Has no fingerprints) Real name: [M.real_name], Key: [M.key]"
fingerprintslast = M.key
fingerprintslastTS = time_stamp()
return 0 //Now, lets get to the dirty work.
//First, make sure their DNA makes sense.
var/mob/living/carbon/human/H = M
if (!istype(H.dna, /datum/dna) || !H.dna.uni_identity || (length(H.dna.uni_identity) != 32))
if(!istype(H.dna, /datum/dna))
H.dna = new /datum/dna(null)
H.dna.real_name = H.real_name
H.dna.flavor_text = H.flavor_text
H.check_dna()
//Now, deal with gloves.
if (H.gloves && H.gloves != src)
fingerprintshidden += text("\[[time_stamp()]\] (Wearing gloves). Real name: [], Key: []", H.real_name, H.key)
fingerprintslast = H.key
fingerprintslastTS = time_stamp()
H.gloves.add_fingerprint(M)
//Deal with gloves the pass finger/palm prints.
if(H.gloves != src)
if(prob(75) && istype(H.gloves, /obj/item/clothing/gloves/latex))
return 0
else if(H.gloves && !istype(H.gloves, /obj/item/clothing/gloves/latex))
return 0
//More adminstuffz
var/ghost = ""
if (isobserver(M))
ghost = isAdminGhost(M) ? "ADMINGHOST" : "GHOST"
fingerprintshidden += text("\[[time_stamp()]\] [ghost ? "([ghost]) " : ""]Real name: [], Key: []", M.real_name, M.key)
fingerprintslast = M.key
fingerprintslastTS = time_stamp()
//Make the list if it does not exist.
if(!fingerprints)
fingerprints = list()
//Hash this shit.
var/full_print = md5(H.dna.uni_identity)
// Add the fingerprints
fingerprints[full_print] = full_print
return 1
else
//Smudge up dem prints some
if(fingerprintslast != M.key)
fingerprintshidden += text("\[[time_stamp()]\] Real name: [], Key: []", M.real_name, M.key)
fingerprintslast = M.key
fingerprintslastTS = time_stamp()
//Cleaning up shit.
if(fingerprints && !fingerprints.len)
fingerprints = null
return
/atom/proc/transfer_fingerprints_to(var/atom/A)
if(!istype(A.fingerprints,/list))
A.fingerprints = list()
if(!istype(A.fingerprintshidden,/list))
A.fingerprintshidden = list()
//skytodo
//A.fingerprints |= fingerprints //detective
//A.fingerprintshidden |= fingerprintshidden //admin
if(fingerprints)
A.fingerprints |= fingerprints.Copy() //detective
if(fingerprintshidden && istype(fingerprintshidden))
A.fingerprintshidden |= fingerprintshidden.Copy() //admin A.fingerprintslast = fingerprintslast
//Atomic level procs to be used elsewhere.
/atom/proc/apply_luminol(var/atom/A)
return had_blood
/atom/proc/clear_luminol(var/atom/A)
return had_blood
//returns 1 if made bloody, returns 0 otherwise
/atom/proc/add_blood(var/mob/living/carbon/human/M)
.=TRUE
if(!M)//if the blood is of non-human source
if(!blood_DNA || !istype(blood_DNA, /list))
blood_DNA = list()
blood_color = DEFAULT_BLOOD
had_blood = TRUE
return TRUE
if (!( istype(M, /mob/living/carbon/human) ))
return FALSE
if (!istype(M.dna, /datum/dna))
M.dna = new /datum/dna(null)
M.dna.real_name = M.real_name
M.check_dna()
if (!( src.flags & FPRINT))
return FALSE
if(!blood_DNA || !istype(blood_DNA, /list)) //if our list of DNA doesn't exist yet (or isn't a list) initialise it.
blood_DNA = list()
blood_color = DEFAULT_BLOOD
if (M.species)
blood_color = M.species.blood_color
return TRUE
//this proc exists specifically for cases where the mob that originated the blood (aka the "donor") might not exist anymore, leading to bugs galore
/atom/proc/add_blood_from_data(var/list/blood_data)
if (!( istype(blood_data) ))
return FALSE
if (!( src.flags & FPRINT))
return FALSE
if(!istype(blood_DNA, /list)) //if our list of DNA doesn't exist yet (or isn't a list) initialise it.
blood_DNA = list()
blood_color = blood_data["blood_colour"]
return TRUE
/atom/proc/add_vomit_floor(mob/living/carbon/M, toxvomit = 0, active = 0, steal_reagents_from_mob = 1)
if( istype(src, /turf/simulated) )
var/obj/effect/decal/cleanable/vomit/this
if(active)
this = new /obj/effect/decal/cleanable/vomit/active(src)
else
this = new /obj/effect/decal/cleanable/vomit(src)
if (M)
this.virus2 += virus_copylist(M.virus2)
// Make toxins vomit look different
if(toxvomit)
this.icon_state = "vomittox_[pick(1,4)]"
if(active && steal_reagents_from_mob && M && M.reagents)
M.reagents.trans_to(this, M.reagents.total_volume * 0.1)
/atom/proc/clean_blood()
src.germ_level = 0
if(istype(blood_DNA, /list))
//del(blood_DNA)
blood_DNA.len = 0
return 1
if(istype(had_blood,/obj/effect/decal/cleanable/blueglow))
clear_luminol()
/atom/proc/get_global_map_pos()
if(!islist(global_map) || isemptylist(global_map))
return
var/cur_x = null
var/cur_y = null
var/list/y_arr = null
for(cur_x=1,cur_x<=global_map.len,cur_x++)
y_arr = global_map[cur_x]
cur_y = y_arr.Find(src.z)
if(cur_y)
break
// to_chat(world, "X = [cur_x]; Y = [cur_y]")
if(cur_x && cur_y)
return list("x"=cur_x,"y"=cur_y)
else
return 0
/atom/movable/proc/checkpass(passflag)
return pass_flags&passflag
/datum/proc/setGender(gend = FEMALE)
if(!("gender" in vars))
CRASH("Oh shit you stupid nigger the [src] doesn't have a gender variable.")
if(ishuman(src))
ASSERT(gend != PLURAL && gend != NEUTER)
src:gender = gend
/atom/setGender(gend = FEMALE)
gender = gend
/mob/living/carbon/human/setGender(gend = FEMALE)
if(species.gender) //species-level gender override
gend = species.gender
else if(gend == PLURAL || gend == NEUTER || (gend != FEMALE && gend != MALE))
CRASH("SOMEBODY SET A BAD GENDER ON [src] [gend]")
// var/old_gender = src.gender
src.gender = gend
// testing("Set [src]'s gender to [gend], old gender [old_gender] previous gender [prev_gender]")
/atom/proc/mop_act(obj/item/weapon/mop/M, mob/user)
return 0
/atom/proc/change_area(var/area/oldarea, var/area/newarea)
change_area_name(oldarea.name, newarea.name)
/atom/proc/change_area_name(var/oldname, var/newname)
name = replacetext(name,oldname,newname)
//Called in /spell/aoe_turf/boo/cast() (code/modules/mob/dead/observer/spells.dm)
/atom/proc/spook(mob/dead/observer/ghost, var/log_this = FALSE)
if(!can_spook())
return 0
if(log_this)
investigation_log(I_GHOST, "|| was Boo!'d by [key_name(ghost)][ghost.locked_to ? ", who was haunting [ghost.locked_to]" : ""]")
return 1
/atom/proc/can_spook(var/msg = 1)
if(blessed)
if(msg)
to_chat(usr, "Your hand goes right through \the [src]... Is that some holy water dripping from it?")
return FALSE
return TRUE
//Called on holy_water's reaction_obj()
/atom/proc/bless()
blessed = 1
/atom/proc/update_icon()
/atom/proc/acidable()
return 0
/atom/proc/isacidhardened()
return FALSE
/atom/proc/get_inaccuracy(var/atom/target, var/spread, var/obj/mecha/chassis)
var/turf/curloc = get_turf(src)
var/turf/targloc = get_turf(target)
var/list/turf/shot_spread = list()
for(var/turf/T in trange(min(spread, max(0, get_dist(curloc, targloc)-1)), targloc))
if(chassis)
var/dir_to_targ = get_dir(chassis, T)
if(dir_to_targ && !(dir_to_targ & chassis.dir))
continue
shot_spread += T
var/turf/newtarget = pick(shot_spread)
if(newtarget == targloc)
return target
return newtarget
/atom/proc/animationBolt(var/mob/firer)
return
//Called when loaded by the map loader
/atom/proc/spawned_by_map_element(datum/map_element/ME, list/objects)
return
/atom/proc/toggle_timeless()
flags ^= TIMELESS
return flags & TIMELESS
/atom/proc/is_visible()
if(invisibility || alpha <= 1)
return FALSE
else
return TRUE
/atom/proc/get_last_player_touched() //returns a reference to the mob of the ckey that last touched the atom
for(var/client/C in clients)
if(uppertext(C.ckey) == uppertext(fingerprintslast))
return C.mob
/atom/proc/initialize()
flags |= ATOM_INITIALIZED
/atom/proc/get_cell()
return
/atom/proc/on_syringe_injection(var/mob/user, var/obj/item/weapon/reagent_containers/syringe/tool)
if(!reagents)
return INJECTION_RESULT_FAIL
if(reagents.is_full())
to_chat(user, "<span class='warning'>\The [src] is full.</span>")
return INJECTION_RESULT_FAIL
return INJECTION_RESULT_SUCCESS
/atom/proc/is_hot()
return
/atom/proc/thermal_energy_transfer()
return
/atom/proc/suitable_colony()
return FALSE
//Used for map persistence. Returns an associative list with some of our most pertinent variables. This list will be used ad-hoc by our relevant map_persistence_type datum to reconstruct this atom from scratch.
/atom/proc/atom2mapsave()
. = list()
.["x"] = x
.["y"] = y
.["z"] = z
.["type"] = type
.["pixel_x"] = pixel_x
.["pixel_y"] = pixel_y
.["dir"] = dir
.["icon_state"] = icon_state
.["color"] = color
.["age"] = getPersistenceAge() + 1
//We were just created using nothing but this associative list's ["x"], ["y"], ["z"] and ["type"]. OK, what else?
/atom/proc/post_mapsave2atom(var/list/L)
return
//Behold, my shitty attempt at an interface in DM. Or at least skimping on 1 atom-level variable so I don't get blamed for wasting RAM.
/atom/proc/getPersistenceAge()
return 1
/atom/proc/setPersistenceAge()
return
| {
"pile_set_name": "Github"
} |
INCLUDE_DIRECTORIES(
${BULLET_PHYSICS_SOURCE_DIR}/src
${VECTOR_MATH_INCLUDE}
)
ADD_LIBRARY(BulletMultiThreaded
PlatformDefinitions.h
PpuAddressSpace.h
SpuFakeDma.cpp
SpuFakeDma.h
SpuDoubleBuffer.h
SpuLibspe2Support.cpp
SpuLibspe2Support.h
btThreadSupportInterface.cpp
btThreadSupportInterface.h
Win32ThreadSupport.cpp
Win32ThreadSupport.h
PosixThreadSupport.cpp
PosixThreadSupport.h
SequentialThreadSupport.cpp
SequentialThreadSupport.h
SpuSampleTaskProcess.h
SpuSampleTaskProcess.cpp
SpuCollisionObjectWrapper.cpp
SpuCollisionObjectWrapper.h
SpuCollisionTaskProcess.h
SpuCollisionTaskProcess.cpp
SpuGatheringCollisionDispatcher.h
SpuGatheringCollisionDispatcher.cpp
SpuContactManifoldCollisionAlgorithm.cpp
SpuContactManifoldCollisionAlgorithm.h
btParallelConstraintSolver.cpp
btParallelConstraintSolver.h
SpuNarrowPhaseCollisionTask/Box.h
SpuNarrowPhaseCollisionTask/boxBoxDistance.cpp
SpuNarrowPhaseCollisionTask/boxBoxDistance.h
# SPURS_PEGatherScatterTask/SpuPEGatherScatterTask.cpp
# SPURS_PEGatherScatterTask/SpuPEGatherScatterTask.h
# SpuPEGatherScatterTaskProcess.cpp
# SpuPEGatherScatterTaskProcess.h
SpuNarrowPhaseCollisionTask/SpuContactResult.cpp
SpuNarrowPhaseCollisionTask/SpuContactResult.h
SpuNarrowPhaseCollisionTask/SpuMinkowskiPenetrationDepthSolver.cpp
SpuNarrowPhaseCollisionTask/SpuMinkowskiPenetrationDepthSolver.h
SpuNarrowPhaseCollisionTask/SpuConvexPenetrationDepthSolver.h
SpuNarrowPhaseCollisionTask/SpuPreferredPenetrationDirections.h
SpuNarrowPhaseCollisionTask/SpuGatheringCollisionTask.cpp
SpuNarrowPhaseCollisionTask/SpuGatheringCollisionTask.h
SpuNarrowPhaseCollisionTask/SpuCollisionShapes.cpp
SpuNarrowPhaseCollisionTask/SpuCollisionShapes.h
#Some GPU related stuff, mainly CUDA and perhaps OpenCL
btGpu3DGridBroadphase.cpp
btGpu3DGridBroadphase.h
btGpu3DGridBroadphaseSharedCode.h
btGpu3DGridBroadphaseSharedDefs.h
btGpu3DGridBroadphaseSharedTypes.h
btGpuDefines.h
btGpuUtilsSharedCode.h
btGpuUtilsSharedDefs.h
)
SET_TARGET_PROPERTIES(BulletMultiThreaded PROPERTIES VERSION ${BULLET_VERSION})
SET_TARGET_PROPERTIES(BulletMultiThreaded PROPERTIES SOVERSION ${BULLET_VERSION})
SUBDIRS(GpuSoftBodySolvers)
IF (BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES(BulletMultiThreaded BulletDynamics BulletCollision)
ENDIF (BUILD_SHARED_LIBS)
IF (INSTALL_LIBS)
IF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES)
#INSTALL of other files requires CMake 2.6
IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5)
# IF(INSTALL_EXTRA_LIBS)
IF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
INSTALL(TARGETS BulletMultiThreaded DESTINATION .)
ELSE (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
INSTALL(TARGETS BulletMultiThreaded DESTINATION lib)
INSTALL(DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR} DESTINATION ${INCLUDE_INSTALL_DIR} FILES_MATCHING
PATTERN "*.h" PATTERN ".svn" EXCLUDE PATTERN "CMakeFiles" EXCLUDE)
ENDIF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
# ENDIF (INSTALL_EXTRA_LIBS)
ENDIF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5)
ENDIF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES)
ENDIF (INSTALL_LIBS)
| {
"pile_set_name": "Github"
} |
<div>
Controls when Hudson starts and stops the slave.
<dl>
<dt><b>
Keep this slave on-line as much as possible
</b></dt>
<dd>
This is the default and normal setting.
In this mode, Hudson uses tries to keep the slave on-line.
If Hudson can start the slave without user assistance, it will periodically
attempt to restart the slave if it is unavailable.
Hudson will not take the slave off-line.
</dd>
<dt><b>
Take this slave on-line and off-line at specific times
</b></dt>
<dd>
In this mode, Hudson will keep the slave on-line according to the configured schedule.
If Hudson can start the slave without user assistance, it will periodically
attempt to start the slave if it is unavailable during an on-line window.
During an off-line window, the slave will only be taken off-line if there are no active
jobs running on the slave.
</dd>
<dt><b>
Take this slave on-line when in demand and off-line when idle
</b></dt>
<dd>
In this mode, if Hudson can launch the slave without user assistance, it will periodically
attempt to launch the slave while there are unexecuted jobs which meet the following criteria:
<ul>
<li>They have been in the queue for at least the specified startup demand period</li>
<li>They can execute on this slave</li>
</ul>
The slave will be taken off-line if:
<ul>
<li>There are no active jobs running on the slave</li>
<li>The slave has been idle for at least the specified idle period</li>
</ul>
</dd>
</dl>
</div> | {
"pile_set_name": "Github"
} |
import React, { PureComponent } from 'react';
import classNames from 'classnames';
import { hot } from 'react-hot-loader';
import { connect } from 'react-redux';
import { Tooltip } from '@grafana/ui';
import { PanelPlugin, PanelPluginMeta } from '@grafana/data';
import { AngularComponent, config } from '@grafana/runtime';
import { e2e } from '@grafana/e2e';
import { QueriesTab } from './QueriesTab';
import VisualizationTab from './VisualizationTab';
import { GeneralTab } from './GeneralTab';
import { AlertTab } from '../../alerting/AlertTab';
import { PanelModel } from '../state/PanelModel';
import { DashboardModel } from '../state/DashboardModel';
import { StoreState } from '../../../types';
import { panelEditorCleanUp, PanelEditorTab, PanelEditorTabIds } from './state/reducers';
import { changePanelEditorTab, refreshPanelEditor } from './state/actions';
import { getActiveTabAndTabs } from './state/selectors';
interface PanelEditorProps {
panel: PanelModel;
dashboard: DashboardModel;
plugin: PanelPlugin;
angularPanel?: AngularComponent;
onPluginTypeChange: (newType: PanelPluginMeta) => void;
activeTab: PanelEditorTabIds;
tabs: PanelEditorTab[];
refreshPanelEditor: typeof refreshPanelEditor;
panelEditorCleanUp: typeof panelEditorCleanUp;
changePanelEditorTab: typeof changePanelEditorTab;
}
class UnConnectedPanelEditor extends PureComponent<PanelEditorProps> {
constructor(props: PanelEditorProps) {
super(props);
}
componentDidMount(): void {
this.refreshFromState();
}
componentWillUnmount(): void {
const { panelEditorCleanUp } = this.props;
panelEditorCleanUp();
}
refreshFromState = (meta?: PanelPluginMeta) => {
const { refreshPanelEditor, plugin } = this.props;
meta = meta || plugin.meta;
refreshPanelEditor({
hasQueriesTab: !meta.skipDataQuery,
usesGraphPlugin: meta.id === 'graph',
alertingEnabled: config.alertingEnabled,
});
};
onChangeTab = (tab: PanelEditorTab) => {
const { changePanelEditorTab } = this.props;
// Angular Query Components can potentially refresh the PanelModel
// onBlur so this makes sure we change tab after that
setTimeout(() => changePanelEditorTab(tab), 10);
};
onPluginTypeChange = (newType: PanelPluginMeta) => {
const { onPluginTypeChange } = this.props;
onPluginTypeChange(newType);
this.refreshFromState(newType);
};
renderCurrentTab(activeTab: string) {
const { panel, dashboard, plugin, angularPanel } = this.props;
switch (activeTab) {
case 'advanced':
return <GeneralTab panel={panel} />;
case 'queries':
return <QueriesTab panel={panel} dashboard={dashboard} />;
case 'alert':
return <AlertTab angularPanel={angularPanel} dashboard={dashboard} panel={panel} />;
case 'visualization':
return (
<VisualizationTab
panel={panel}
dashboard={dashboard}
plugin={plugin}
onPluginTypeChange={this.onPluginTypeChange}
angularPanel={angularPanel}
/>
);
default:
return null;
}
}
render() {
const { activeTab, tabs } = this.props;
return (
<div className="panel-editor-container__editor">
<div className="panel-editor-tabs">
{tabs.map(tab => {
return <TabItem tab={tab} activeTab={activeTab} onClick={this.onChangeTab} key={tab.id} />;
})}
</div>
<div className="panel-editor__right">{this.renderCurrentTab(activeTab)}</div>
</div>
);
}
}
export const mapStateToProps = (state: StoreState) => getActiveTabAndTabs(state.location, state.panelEditor);
const mapDispatchToProps = { refreshPanelEditor, panelEditorCleanUp, changePanelEditorTab };
export const PanelEditor = hot(module)(connect(mapStateToProps, mapDispatchToProps)(UnConnectedPanelEditor));
interface TabItemParams {
tab: PanelEditorTab;
activeTab: string;
onClick: (tab: PanelEditorTab) => void;
}
function TabItem({ tab, activeTab, onClick }: TabItemParams) {
const tabClasses = classNames({
'panel-editor-tabs__link': true,
active: activeTab === tab.id,
});
return (
<div className="panel-editor-tabs__item" onClick={() => onClick(tab)}>
<a className={tabClasses} aria-label={e2e.pages.Dashboard.Panels.EditPanel.selectors.tabItems(tab.text)}>
<Tooltip content={`${tab.text}`} placement="auto">
<i className={`gicon gicon-${tab.id}${activeTab === tab.id ? '-active' : ''}`} />
</Tooltip>
</a>
</div>
);
}
| {
"pile_set_name": "Github"
} |
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
# https://openapi-generator.tech
# Do not edit the class manually.
defmodule OpenapiPetstore.Model.Name do
@moduledoc """
Model for testing model name same as property name
"""
@derive [Poison.Encoder]
defstruct [
:"name",
:"snake_case",
:"property",
:"123Number"
]
@type t :: %__MODULE__{
:"name" => integer(),
:"snake_case" => integer() | nil,
:"property" => String.t | nil,
:"123Number" => integer() | nil
}
end
defimpl Poison.Decoder, for: OpenapiPetstore.Model.Name do
def decode(value, _options) do
value
end
end
| {
"pile_set_name": "Github"
} |
{
"api_console_project_id": "619683526622",
"app": {
"launch": {
"local_path": "main.html"
}
},
"container": "GOOGLE_DRIVE",
"default_locale": "en_US",
"description": "__MSG_appDesc__",
"icons": {
"128": "icon_128.png",
"16": "icon_16.png"
},
"key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDJhLK6fk/BWTEvJhywpk7jDe4A2r0bGXGOLZW4/AdBp3IiD9o9nx4YjLAtv0tIPxi7MvFd/GUUbQBwHT5wQWONJj1z/0Rc2qBkiJA0yqXh42p0snuA8dCfdlhOLsp7/XTMEwAVasjV5hC4awl78eKfJYlZ+8fM/UldLWJ/51iBQwIDAQAB",
"manifest_version": 2,
"name": "__MSG_appName__",
"offline_enabled": true,
"update_url": "https://clients2.google.com/service/update2/crx",
"version": "0.9"
}
| {
"pile_set_name": "Github"
} |
GL_NV_pixel_data_range
http://www.opengl.org/registry/specs/NV/pixel_data_range.txt
GL_NV_pixel_data_range
GL_WRITE_PIXEL_DATA_RANGE_NV 0x8878
GL_READ_PIXEL_DATA_RANGE_NV 0x8879
GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV 0x887A
GL_READ_PIXEL_DATA_RANGE_LENGTH_NV 0x887B
GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV 0x887C
GL_READ_PIXEL_DATA_RANGE_POINTER_NV 0x887D
void glFlushPixelDataRangeNV (GLenum target)
void glPixelDataRangeNV (GLenum target, GLsizei length, void *pointer)
| {
"pile_set_name": "Github"
} |
StartChar: uni01D5
Encoding: 600 469 519
Width: 654
VWidth: 0
LayerCount: 2
Fore
Refer: 498 772 N 1 0 0 1 564 345 2
Refer: 138 220 N 1 0 0 1 0 0 3
Validated: 1
EndChar
| {
"pile_set_name": "Github"
} |
package com.gentics.mesh.core.rest.admin.cluster;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import com.gentics.mesh.core.rest.common.RestModel;
public class ClusterServerConfig implements RestModel {
@JsonProperty(required = true)
@JsonPropertyDescription("Name of the server.")
private String name;
@JsonProperty(required = false)
@JsonPropertyDescription("Role of the server which can be MASTER or REPLICA.")
private ServerRole role;
public ClusterServerConfig() {
}
public String getName() {
return name;
}
public ClusterServerConfig setName(String name) {
this.name = name;
return this;
}
public ClusterServerConfig setRole(ServerRole restRole) {
this.role = restRole;
return this;
}
public ServerRole getRole() {
return role;
}
}
| {
"pile_set_name": "Github"
} |
<?php
/**
* This source file is part of the open source project
* ExpressionEngine (https://expressionengine.com)
*
* @link https://expressionengine.com/
* @copyright Copyright (c) 2003-2019, EllisLab Corp. (https://ellislab.com)
* @license https://expressionengine.com/license Licensed under Apache License, Version 2.0
*/
namespace EllisLab\ExpressionEngine\Updater\Version_4_1_2;
/**
* Update
*/
class Updater {
var $version_suffix = '';
/**
* Do Update
*
* @return TRUE
*/
public function do_update()
{
$steps = new \ProgressIterator(
array(
'warnAboutContentReservedWord',
'addMissingNotificationTemplates'
)
);
foreach ($steps as $k => $v)
{
$this->$v();
}
return TRUE;
}
private function warnAboutContentReservedWord()
{
$content_check = ee('Model')->get('ChannelField')
->filter('field_name', 'content')
->count();
if ($content_check)
{
ee()->update_notices->setVersion('4.1.2');
ee()->update_notices->header('"content" is now a reserved word and will conflict with your Fluid Fields');
ee()->update_notices->item(' Please rename your Channel Field(s) and update your templates accordingly.');
}
}
private function addMissingNotificationTemplates()
{
$sites = ee('Model')->get('Site')->all();
$email_templates = ee('Model')->get('SpecialtyTemplate')
->filter('template_name', 'email_changed_notification')
->all()
->indexBy('site_id');
$password_templates = ee('Model')->get('SpecialtyTemplate')
->filter('template_name', 'password_changed_notification')
->all()
->indexBy('site_id');
$email_template_data = $email_templates[1]->getValues();
$password_template_data = $password_templates[1]->getValues();
unset($email_template_data['template_id']);
unset($password_template_data['template_id']);
foreach ($sites as $site)
{
if ( ! array_key_exists($site->site_id, $email_templates))
{
$email_template_data['site_id'] = $site->site_id;
ee('Model')->make('SpecialtyTemplate', $email_template_data)->save();
}
if ( ! array_key_exists($site->site_id, $password_templates))
{
$password_template_data['site_id'] = $site->site_id;
ee('Model')->make('SpecialtyTemplate', $password_template_data)->save();
}
}
}
}
// EOF
| {
"pile_set_name": "Github"
} |
package io.jenkins.blueocean.blueocean_github_pipeline;
import com.cloudbees.hudson.plugins.folder.AbstractFolderProperty;
import com.cloudbees.hudson.plugins.folder.AbstractFolderPropertyDescriptor;
import com.cloudbees.plugins.credentials.domains.Domain;
import com.github.tomakehurst.wiremock.client.MappingBuilder;
import com.github.tomakehurst.wiremock.client.WireMock;
import com.github.tomakehurst.wiremock.common.FileSource;
import com.github.tomakehurst.wiremock.common.SingleRootFileSource;
import com.github.tomakehurst.wiremock.extension.Parameters;
import com.github.tomakehurst.wiremock.extension.ResponseTransformer;
import com.github.tomakehurst.wiremock.http.Request;
import com.github.tomakehurst.wiremock.http.Response;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
import com.github.tomakehurst.wiremock.stubbing.StubMapping;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import com.mashape.unirest.http.exceptions.UnirestException;
import hudson.model.User;
import hudson.util.DescribableList;
import io.jenkins.blueocean.rest.factory.organization.OrganizationFactory;
import io.jenkins.blueocean.rest.impl.pipeline.PipelineBaseTest;
import io.jenkins.blueocean.rest.impl.pipeline.credential.BlueOceanCredentialsProvider;
import jenkins.branch.MultiBranchProject;
import jenkins.branch.OrganizationFolder;
import jenkins.scm.api.SCMSource;
import org.jenkinsci.plugins.github_branch_source.GitHubSCMSource;
import org.junit.After;
import org.junit.Rule;
import org.junit.runner.RunWith;
import org.kohsuke.stapler.Stapler;
import org.kohsuke.stapler.StaplerRequest;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
import static org.junit.Assert.assertEquals;
import static org.powermock.api.mockito.PowerMockito.*;
/**
* @author Vivek Pandey
*/
@RunWith(PowerMockRunner.class)
@PrepareForTest({Stapler.class, OrganizationFolder.class})
@PowerMockIgnore({"javax.crypto.*", "javax.security.*", "javax.net.ssl.*", "com.sun.org.apache.xerces.*", "com.sun.org.apache.xalan.*", "javax.xml.*", "org.xml.*", "org.w3c.dom.*"})
public abstract class GithubMockBase extends PipelineBaseTest {
// By default the wiremock tests will run without proxy
// The tests will use only the stubbed data and will fail if requests are made for missing data.
// You can use the proxy while writing and debugging tests.
private final static boolean useProxy = !System.getProperty("test.wiremock.useProxy", "false").equals("false");
protected String githubApiUrl;
protected User user;
protected String accessToken = "12345";
@Rule
public WireMockRule githubApi = new WireMockRule(wireMockConfig().
dynamicPort().dynamicHttpsPort()
.usingFilesUnderClasspath("api")
.extensions(
new ResponseTransformer() {
@Override
public Response transform(Request request, Response response, FileSource files,
Parameters parameters) {
if ("application/json"
.equals(response.getHeaders().getContentTypeHeader().mimeTypePart())) {
return Response.Builder.like(response)
.but()
.body(response.getBodyAsString()
.replace("https://api.github.com/",
"http://localhost:" + githubApi.port() + "/")
)
.build();
}
return response;
}
@Override
public String getName() {
return "url-rewrite";
}
})
);
private final List<StubMapping> perTestStubMappings = new ArrayList<>();
@Override
public void setup() throws Exception {
super.setup();
//setup github api mock with WireMock
new File("src/test/resources/api/mappings").mkdirs();
new File("src/test/resources/api/__files").mkdirs();
githubApi.enableRecordMappings(new SingleRootFileSource("src/test/resources/api/mappings"),
new SingleRootFileSource("src/test/resources/api/__files"));
if (useProxy) {
githubApi.stubFor(
WireMock.get(urlMatching(".*"))
.atPriority(10)
.willReturn(aResponse().proxiedFrom("https://api.github.com/")));
}
this.user = login("vivek", "Vivek Pandey", "[email protected]");
this.githubApiUrl = String.format("http://localhost:%s",githubApi.port());
this.crumb = getCrumb( j.jenkins );
}
@After
public void tearDown() {
if (!perTestStubMappings.isEmpty()) {
for (StubMapping mapping : perTestStubMappings) {
githubApi.removeStub(mapping);
}
perTestStubMappings.clear();
}
}
static String getOrgName() {
return OrganizationFactory.getInstance().list().iterator().next().getName();
}
protected String createGithubCredential() throws UnirestException {
return createGithubCredential(this.user);
}
protected String createGithubCredential(User user) throws UnirestException {
Map r = new RequestBuilder(baseUrl)
.data(ImmutableMap.of("accessToken", accessToken))
.status(200)
.jwtToken(getJwtToken(j.jenkins, user.getId(), user.getId()))
.crumb( this.crumb )
.put("/organizations/" + getOrgName() + "/scm/github/validate/?apiUrl="+githubApiUrl)
.build(Map.class);
String credentialId = (String) r.get("credentialId");
assertEquals(GithubScm.ID, credentialId);
return credentialId;
}
protected String createGithubEnterpriseCredential() throws UnirestException {
return createGithubEnterpriseCredential(this.user);
}
protected String createGithubEnterpriseCredential(User user) throws UnirestException {
Map r = new RequestBuilder(baseUrl)
.data(ImmutableMap.of("accessToken", accessToken))
.status(200)
.jwtToken(getJwtToken(j.jenkins, user.getId(), user.getId()))
.crumb( this.crumb )
.put("/organizations/" + getOrgName() + "/scm/github-enterprise/validate/?apiUrl="+githubApiUrl)
.build(Map.class);
String credentialId = (String) r.get("credentialId");
assertEquals(GithubCredentialUtils.computeCredentialId(null, GithubEnterpriseScm.ID, githubApiUrl), credentialId);
return credentialId;
}
/**
* Add a StubMapping to Wiremock corresponding to the supplied builder.
* Any mappings added will automatically be removed when @After fires.
* @param builder
*/
protected void addPerTestStub(MappingBuilder builder) {
StubMapping mapping = githubApi.stubFor(builder);
perTestStubMappings.add(mapping);
}
protected MultiBranchProject mockMbp(String credentialId,User user, String credentialDomainName){
MultiBranchProject mbp = mock(MultiBranchProject.class);
when(mbp.getName()).thenReturn("PR-demo");
when(mbp.getParent()).thenReturn(j.jenkins);
GitHubSCMSource scmSource = mock(GitHubSCMSource.class);
when(scmSource.getApiUri()).thenReturn(githubApiUrl);
when(scmSource.getCredentialsId()).thenReturn(credentialId);
when(scmSource.getRepoOwner()).thenReturn("cloudbeers");
when(scmSource.getRepository()).thenReturn("PR-demo");
when(mbp.getSCMSources()).thenReturn(Lists.<SCMSource>newArrayList(scmSource));
BlueOceanCredentialsProvider.FolderPropertyImpl folderProperty = mock(BlueOceanCredentialsProvider.FolderPropertyImpl.class);
DescribableList<AbstractFolderProperty<?>,AbstractFolderPropertyDescriptor> mbpProperties = new DescribableList<AbstractFolderProperty<?>,AbstractFolderPropertyDescriptor>(mbp);
mbpProperties.add(new BlueOceanCredentialsProvider.FolderPropertyImpl(
user.getId(), credentialId,
BlueOceanCredentialsProvider.createDomain(githubApiUrl)
));
Domain domain = mock(Domain.class);
when(domain.getName()).thenReturn(credentialDomainName);
when(folderProperty.getDomain()).thenReturn(domain);
when(mbp.getProperties()).thenReturn(mbpProperties);
return mbp;
}
protected StaplerRequest mockStapler(){
mockStatic(Stapler.class);
StaplerRequest staplerRequest = mock(StaplerRequest.class);
when(Stapler.getCurrentRequest()).thenReturn(staplerRequest);
when(staplerRequest.getRequestURI()).thenReturn("http://localhost:8080/jenkins/blue/rest/");
when(staplerRequest.getParameter("path")).thenReturn("Jenkinsfile");
when(staplerRequest.getParameter("repo")).thenReturn("PR-demo");
return staplerRequest;
}
}
| {
"pile_set_name": "Github"
} |
<?php
/**
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
*
* TeamsTabConfiguration File
* PHP version 7
*
* @category Library
* @package Microsoft.Graph
* @copyright © Microsoft Corporation. All rights reserved.
* @license https://opensource.org/licenses/MIT MIT License
* @link https://graph.microsoft.com
*/
namespace Microsoft\Graph\Model;
/**
* TeamsTabConfiguration class
*
* @category Model
* @package Microsoft.Graph
* @copyright © Microsoft Corporation. All rights reserved.
* @license https://opensource.org/licenses/MIT MIT License
* @link https://graph.microsoft.com
*/
class TeamsTabConfiguration extends Entity
{
/**
* Gets the contentUrl
* Url used for rendering tab contents in Teams. Required.
*
* @return string The contentUrl
*/
public function getContentUrl()
{
if (array_key_exists("contentUrl", $this->_propDict)) {
return $this->_propDict["contentUrl"];
} else {
return null;
}
}
/**
* Sets the contentUrl
* Url used for rendering tab contents in Teams. Required.
*
* @param string $val The value of the contentUrl
*
* @return TeamsTabConfiguration
*/
public function setContentUrl($val)
{
$this->_propDict["contentUrl"] = $val;
return $this;
}
/**
* Gets the entityId
* Identifier for the entity hosted by the tab provider.
*
* @return string The entityId
*/
public function getEntityId()
{
if (array_key_exists("entityId", $this->_propDict)) {
return $this->_propDict["entityId"];
} else {
return null;
}
}
/**
* Sets the entityId
* Identifier for the entity hosted by the tab provider.
*
* @param string $val The value of the entityId
*
* @return TeamsTabConfiguration
*/
public function setEntityId($val)
{
$this->_propDict["entityId"] = $val;
return $this;
}
/**
* Gets the removeUrl
* Url called by Teams client when a Tab is removed using the Teams Client.
*
* @return string The removeUrl
*/
public function getRemoveUrl()
{
if (array_key_exists("removeUrl", $this->_propDict)) {
return $this->_propDict["removeUrl"];
} else {
return null;
}
}
/**
* Sets the removeUrl
* Url called by Teams client when a Tab is removed using the Teams Client.
*
* @param string $val The value of the removeUrl
*
* @return TeamsTabConfiguration
*/
public function setRemoveUrl($val)
{
$this->_propDict["removeUrl"] = $val;
return $this;
}
/**
* Gets the websiteUrl
* Url for showing tab contents outside of Teams.
*
* @return string The websiteUrl
*/
public function getWebsiteUrl()
{
if (array_key_exists("websiteUrl", $this->_propDict)) {
return $this->_propDict["websiteUrl"];
} else {
return null;
}
}
/**
* Sets the websiteUrl
* Url for showing tab contents outside of Teams.
*
* @param string $val The value of the websiteUrl
*
* @return TeamsTabConfiguration
*/
public function setWebsiteUrl($val)
{
$this->_propDict["websiteUrl"] = $val;
return $this;
}
}
| {
"pile_set_name": "Github"
} |
/* Dia -- a diagram creation/manipulation program
* Copyright (C) 1998 Alexander Larsson
*
* filedlg.c: some dialogs for saving/loading/exporting files.
* Copyright (C) 1999 James Henstridge
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include <gtk/gtk.h>
#include "intl.h"
#include "filter.h"
#include "dia_dirs.h"
#include "persistence.h"
#include "display.h"
#include "message.h"
#include "layer-editor/layer_dialog.h"
#include "load_save.h"
#include "preferences.h"
#include "interface.h"
#include "recent_files.h"
#include "confirm.h"
#include "diacontext.h"
#include "filedlg.h"
static GtkWidget *opendlg = NULL;
static GtkWidget *savedlg = NULL;
static GtkWidget *exportdlg = NULL;
static void
toggle_compress_callback(GtkWidget *widget)
{
/* Changes prefs exactly when the user toggles the setting, i.e.
* the setting really remembers what the user chose last time, but
* lets diagrams of the opposite kind stay that way unless the user
* intervenes.
*/
prefs.new_diagram.compress_save =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
}
/**
* ifilter_by_index:
* @index: the index of the #DiaImportFilter to get
* @filename: filename to guess a filter for
*
* Given an import filter index and optionally a filename for fallback
* return the import filter to use
*
* Since: dawn-of-time
*/
static DiaImportFilter *
ifilter_by_index (int index, const char* filename)
{
DiaImportFilter *ifilter = NULL;
if (index >= 0)
ifilter = g_list_nth_data (filter_get_import_filters(), index);
else if (filename) /* fallback, should not happen */
ifilter = filter_guess_import_filter(filename);
return ifilter;
}
typedef void* (* FilterGuessFunc) (const gchar* filename);
/**
* matching_extensions_filter:
* @fi: the #GtkFileFilterInfo
* @data: the filter function
*
* Respond to the file chooser filter facility, that is match
* the extension of a given filename to the selected filter
*
* Since: dawn-of-time
*/
static gboolean
matching_extensions_filter (const GtkFileFilterInfo* fi,
gpointer data)
{
FilterGuessFunc guess_func = (FilterGuessFunc) data;
g_assert (guess_func);
if (!fi->filename)
return 0; /* filter it, IMO should not happen --hb */
if (guess_func (fi->filename))
return 1;
return 0;
}
/**
* diagram_removed:
* @dia: the #Diagram
* @dialog: the dialogue
*
* React on the diagram::removed signal by destroying the dialog
*
* This function isn't used cause it conflicts with the pattern introduced:
* instead of destroying the dialog with the diagram, the dialog is keeping
* a refernce to it. As a result we could access the diagram even when the
* display of it is gone ...
*/
#if 0
static void
diagram_removed (Diagram* dia, GtkWidget* dialog)
{
g_return_if_fail (DIA_IS_DIAGRAM (dia));
g_return_if_fail (GTK_IS_WIDGET (dialog));
gtk_widget_destroy (dialog);
}
#endif
static GtkFileFilter *
build_gtk_file_filter_from_index (int index)
{
DiaImportFilter *ifilter = NULL;
GtkFileFilter *filter = NULL;
ifilter = g_list_nth_data (filter_get_import_filters(), index-1);
if (ifilter) {
GString *pattern = g_string_new ("*.");
int i = 0;
filter = gtk_file_filter_new ();
while (ifilter->extensions[i] != NULL) {
if (i != 0)
g_string_append (pattern, "|*.");
g_string_append (pattern, ifilter->extensions[i]);
++i;
}
gtk_file_filter_set_name (filter, _("Supported Formats"));
gtk_file_filter_add_pattern (filter, pattern->str);
g_string_free (pattern, TRUE);
} else {
/* match the other selections extension */
filter = gtk_file_filter_new ();
gtk_file_filter_set_name (filter, _("Supported Formats"));
gtk_file_filter_add_custom (filter, GTK_FILE_FILTER_FILENAME,
matching_extensions_filter, filter_guess_import_filter, NULL);
}
return filter;
}
static void
import_adapt_extension_callback(GtkWidget *widget)
{
int index = gtk_combo_box_get_active (GTK_COMBO_BOX(widget));
GtkFileFilter *former = NULL;
GSList *list, *elem;
list = gtk_file_chooser_list_filters (GTK_FILE_CHOOSER (opendlg));
for (elem = list; elem != NULL; elem = g_slist_next (elem))
if (strcmp (_("Supported Formats"), gtk_file_filter_get_name (GTK_FILE_FILTER(elem->data))) == 0)
former = GTK_FILE_FILTER(elem->data);
g_slist_free (list);
if (former) {
/* replace the previous filter */
GtkFileFilter *filter = build_gtk_file_filter_from_index (index);
gtk_file_chooser_remove_filter (GTK_FILE_CHOOSER (opendlg), former);
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (opendlg), filter);
gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (opendlg), filter);
}
}
/**
* create_open_menu:
*
* Create the combobox menu to select Import Filter options
*
* Since: dawn-of-time
*/
static GtkWidget *
create_open_menu (void)
{
GtkWidget *menu;
GList *tmp;
menu = gtk_combo_box_text_new ();
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(menu), _("By extension"));
for (tmp = filter_get_import_filters(); tmp != NULL; tmp = tmp->next) {
DiaImportFilter *ifilter = tmp->data;
gchar *filter_label;
if (!ifilter)
continue;
filter_label = filter_get_import_filter_label(ifilter);
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(menu), filter_label);
g_clear_pointer (&filter_label, g_free);
}
g_signal_connect (G_OBJECT (menu), "changed",
G_CALLBACK (import_adapt_extension_callback), NULL);
return menu;
}
/**
* file_open_response_callback:
* @fs: the #GtkFileChooser
* @response: the response
* @user_data: the user data
*
* Respond to the user finishing the Open Dialog either accept or cancel/destroy
*
* Since: dawn-of-time
*/
static void
file_open_response_callback (GtkWidget *fs,
int response,
gpointer user_data)
{
char *filename;
Diagram *diagram = NULL;
if (response == GTK_RESPONSE_ACCEPT) {
int index = gtk_combo_box_get_active (GTK_COMBO_BOX (user_data));
if (index >= 0) /* remember it */
persistence_set_integer ("import-filter", index);
filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(fs));
diagram = diagram_load(filename, ifilter_by_index (index - 1, filename));
g_clear_pointer (&filename, g_free);
if (diagram != NULL) {
diagram_update_extents(diagram);
layer_dialog_set_diagram(diagram);
if (diagram->displays == NULL) {
/* GSList *displays = diagram->displays;
GSList *displays_head = displays;
diagram->displays = NULL;
for (; displays != NULL; displays = g_slist_next(displays)) {
DDisplay *loaded_display = (DDisplay *)displays->data;
copy_display(loaded_display);
g_clear_pointer (&loaded_display, g_free);
}
g_slist_free(displays_head);
} else {
*/
new_display(diagram);
}
}
}
gtk_widget_destroy(opendlg);
}
/**
* file_open_callback:
* @action: the #GtkAction
*
* Handle menu click File/Open
*
* This is either with or without diagram
*
* Since: dawn-of-time
*/
void
file_open_callback (GtkAction *action)
{
if (!opendlg) {
DDisplay *ddisp;
Diagram *dia = NULL;
GtkWindow *parent_window;
gchar *filename = NULL;
/* FIXME: we should not use ddisp_active but instead get the current diagram
* from caller. Thus we could offer the option to "load into" if invoked by
* <Display/File/Open. It wouldn't make any sense if invoked by
* <Toolbox>/File/Open ...
*/
ddisp = ddisplay_active();
if (ddisp) {
dia = ddisp->diagram;
parent_window = GTK_WINDOW(ddisp->shell);
} else {
parent_window = GTK_WINDOW(interface_get_toolbox_shell());
}
persistence_register_integer ("import-filter", 0);
opendlg = gtk_file_chooser_dialog_new (_("Open Diagram"),
parent_window,
GTK_FILE_CHOOSER_ACTION_OPEN,
_("_Cancel"), GTK_RESPONSE_CANCEL,
_("_Open"), GTK_RESPONSE_ACCEPT,
NULL);
/* is activating gvfs really that easy - at least it works for samba shares*/
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER(opendlg), FALSE);
gtk_dialog_set_default_response(GTK_DIALOG(opendlg), GTK_RESPONSE_ACCEPT);
gtk_window_set_role(GTK_WINDOW(opendlg), "open_diagram");
if (dia && dia->filename) {
filename = g_filename_from_utf8 (dia->filename, -1, NULL, NULL, NULL);
}
if (filename != NULL) {
char *fnabs = g_canonicalize_filename (filename, NULL);
if (fnabs) {
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (opendlg), fnabs);
}
g_clear_pointer (&fnabs, g_free);
g_clear_pointer (&filename, g_free);
}
g_signal_connect (G_OBJECT (opendlg), "destroy",
G_CALLBACK (gtk_widget_destroyed), &opendlg);
} else {
gtk_widget_set_sensitive (opendlg, TRUE);
if (gtk_widget_get_visible (opendlg))
return;
}
if (!gtk_file_chooser_get_extra_widget (GTK_FILE_CHOOSER (opendlg))) {
GtkWidget *hbox, *label, *omenu, *options;
GtkFileFilter* filter;
options = gtk_frame_new(_("Open Options"));
gtk_frame_set_shadow_type(GTK_FRAME(options), GTK_SHADOW_ETCHED_IN);
hbox = gtk_hbox_new(FALSE, 1);
gtk_container_set_border_width(GTK_CONTAINER(hbox), 5);
gtk_container_add(GTK_CONTAINER(options), hbox);
gtk_widget_show(hbox);
label = gtk_label_new (_("Determine file type:"));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
gtk_widget_show (label);
omenu = create_open_menu();
gtk_box_pack_start(GTK_BOX(hbox), omenu, TRUE, TRUE, 0);
gtk_widget_show(omenu);
gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER(opendlg),
options);
gtk_widget_show(options);
g_signal_connect(G_OBJECT(opendlg), "response",
G_CALLBACK(file_open_response_callback), omenu);
/* set up the gtk file (name) filters */
/* 0 = by extension */
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (opendlg),
build_gtk_file_filter_from_index (0));
filter = gtk_file_filter_new ();
gtk_file_filter_set_name (filter, _("All Files"));
gtk_file_filter_add_pattern (filter, "*");
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (opendlg), filter);
gtk_combo_box_set_active (GTK_COMBO_BOX (omenu), persistence_get_integer ("import-filter"));
}
gtk_widget_show(opendlg);
}
/**
* file_save_as_response_callback:
* @fs: the #GtkFileChooser
* @response: the response
* @user_data: the user data
*
* Respond to a button press (also destroy) in the save as dialog.
*
* Since: dawn-of-time
*/
static void
file_save_as_response_callback (GtkWidget *fs,
int response,
gpointer user_data)
{
DiaContext *ctx = NULL;
GFile *file = NULL;
Diagram *dia;
if (response == GTK_RESPONSE_ACCEPT) {
dia = g_object_get_data (G_OBJECT (fs), "user_data");
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (fs));
if (!file) {
/* Not getting a filename looks like a contract violation in Gtk+ to me.
* Still Dia would be crashing (bug #651949) - instead simply go back to the dialog. */
gtk_window_present (GTK_WINDOW (fs));
return;
}
dia->data->is_compressed =
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (user_data));
diagram_update_extents (dia);
ctx = dia_context_new (_("Save As"));
dia_diagram_set_file (dia, file);
dia_context_set_filename (ctx, g_file_peek_path (file));
if (diagram_save (dia, g_file_peek_path (file), ctx)) {
recent_file_history_add (g_file_peek_path (file));
}
dia_context_release (ctx);
g_clear_object (&file);
}
/* if we have our own reference, drop it before destroy */
g_object_set_data (G_OBJECT (fs), "user_data", NULL);
/* if we destroy it gtk_dialog_run wont give the response */
if (!g_object_get_data (G_OBJECT (fs), "dont-destroy")) {
gtk_widget_destroy (GTK_WIDGET (fs));
}
}
static GtkWidget *file_save_as_dialog_prepare (Diagram *dia, DDisplay *ddisp);
/**
* file_save_as_callback:
* @action: the #GtkAction
*
* Respond to the File/Save As.. menu
*
* We have only one file save dialog at a time. So if the dialog alread exists
* and the user tries to Save as once more only the diagram refernced will
* change. Maybe we should also indicate the refernced diagram in the dialog.
*
* Since: dawn-of-time
*/
void
file_save_as_callback (GtkAction *action)
{
DDisplay *ddisp;
Diagram *dia;
GtkWidget *dlg;
ddisp = ddisplay_active ();
if (!ddisp) return;
dia = ddisp->diagram;
dlg = file_save_as_dialog_prepare (dia, ddisp);
gtk_widget_show (dlg);
}
gboolean
file_save_as(Diagram *dia, DDisplay *ddisp)
{
GtkWidget *dlg;
gint response;
dlg = file_save_as_dialog_prepare(dia, ddisp);
/* if we destroy it gtk_dialog_run wont give the response */
g_object_set_data (G_OBJECT(dlg), "dont-destroy", GINT_TO_POINTER (1));
response = gtk_dialog_run(GTK_DIALOG(dlg));
gtk_widget_destroy(GTK_WIDGET(dlg));
return (GTK_RESPONSE_ACCEPT == response);
}
static GtkWidget *
file_save_as_dialog_prepare (Diagram *dia, DDisplay *ddisp)
{
char *filename = NULL;
if (!savedlg) {
GtkWidget *compressbutton;
savedlg = gtk_file_chooser_dialog_new (_("Save Diagram"),
GTK_WINDOW (ddisp->shell),
GTK_FILE_CHOOSER_ACTION_SAVE,
_("_Cancel"), GTK_RESPONSE_CANCEL,
_("_Save"), GTK_RESPONSE_ACCEPT,
NULL);
/* vfs saving is as easy - if you see 'bad file descriptor' there is
* something wrong with the permissions of the share ;) */
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (savedlg), FALSE);
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (savedlg), TRUE);
gtk_window_set_role (GTK_WINDOW (savedlg), "save_diagram");
/* Need better way to make it a reasonable size. Isn't there some*/
/* standard look for them (or is that just Gnome?)*/
compressbutton = gtk_check_button_new_with_label (_("Compress diagram files"));
gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (savedlg),
compressbutton);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (compressbutton),
dia->data->is_compressed);
g_signal_connect (G_OBJECT (compressbutton),
"toggled",
G_CALLBACK (toggle_compress_callback),
NULL);
gtk_widget_show (compressbutton);
gtk_widget_set_tooltip_text (compressbutton,
_("Compression reduces file size to less than 1/10th "
"size and speeds up loading and saving. Some text "
"programs cannot manipulate compressed files."));
g_signal_connect (GTK_FILE_CHOOSER (savedlg),
"response",
G_CALLBACK (file_save_as_response_callback),
compressbutton);
g_signal_connect (G_OBJECT (savedlg),
"destroy",
G_CALLBACK (gtk_widget_destroyed),
&savedlg);
} else {
GtkWidget *compressbutton = gtk_file_chooser_get_extra_widget(GTK_FILE_CHOOSER(savedlg));
gtk_widget_set_sensitive(savedlg, TRUE);
g_signal_handlers_block_by_func(G_OBJECT(compressbutton), toggle_compress_callback, NULL);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(compressbutton),
dia->data->is_compressed);
g_signal_handlers_unblock_by_func(G_OBJECT(compressbutton), toggle_compress_callback, NULL);
if (gtk_widget_get_visible (savedlg)) {
/* keep a refernce to the diagram */
g_object_set_data_full (G_OBJECT (savedlg),
"user_data",
g_object_ref (dia),
g_object_unref);
gtk_window_present (GTK_WINDOW (savedlg));
return savedlg;
}
}
if (dia && dia->filename) {
filename = g_filename_from_utf8 (dia->filename, -1, NULL, NULL, NULL);
}
if (filename != NULL) {
char *fnabs = g_canonicalize_filename (filename, NULL);
if (fnabs) {
char *base = g_path_get_basename (dia->filename);
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (savedlg), fnabs);
/* FileChooser api insist on exiting files for set_filename */
/* ... and does not use filename encoding on this one. */
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (savedlg), base);
g_clear_pointer (&base, g_free);
}
g_clear_pointer (&fnabs, g_free);
g_clear_pointer (&filename, g_free);
}
g_object_set_data_full (G_OBJECT (savedlg),
"user_data",
g_object_ref (dia),
g_object_unref);
return savedlg;
}
/*
* file_save_callback:
* @action: the #GtkAction
*
* Respond to the File/Save menu entry.
*
* Delegates to Save As if there is no filename set yet.
*
* Since: dawn-of-time
*/
void
file_save_callback (GtkAction *action)
{
Diagram *diagram;
diagram = ddisplay_active_diagram ();
if (!diagram) return;
if (diagram->unsaved) {
file_save_as_callback (action);
} else {
char *filename = g_filename_from_utf8 (diagram->filename,
-1,
NULL,
NULL,
NULL);
DiaContext *ctx = dia_context_new (_("Save"));
diagram_update_extents (diagram);
if (diagram_save (diagram, filename, ctx)) {
recent_file_history_add (filename);
}
g_clear_pointer (&filename, g_free);
dia_context_release (ctx);
}
}
/*
* efilter_by_index:
* @index: filter index
* @ext: (out): the extension of the output
*
* Given an export filter index return the export filter to use
*/
static DiaExportFilter *
efilter_by_index (int index, const char **ext)
{
DiaExportFilter *efilter = NULL;
/* the index in the selection list *is* the index of the filter,
* filters supporing multiple formats are multiple times in the list */
if (index >= 0) {
efilter = g_list_nth_data (filter_get_export_filters(), index);
if (efilter) {
if (ext) {
*ext = efilter->extensions[0];
}
return efilter;
} else {
/* getting here means invalid index */
g_warning ("efilter_by_index() index=%d out of range", index);
}
}
return efilter;
}
/**
* export_adapt_extension:
* @name: the filename
* @index: the index of the filter
*
* Adapt the filename to the export filter index
*
* Since: dawn-of-time
*/
static void
export_adapt_extension (const char* name, int index)
{
const gchar* ext = NULL;
DiaExportFilter *efilter = efilter_by_index (index, &ext);
gchar *basename = g_path_get_basename (name);
gchar *utf8_name = NULL;
if (!efilter || !ext)
utf8_name = g_filename_to_utf8 (basename, -1, NULL, NULL, NULL);
else {
const gchar *last_dot = strrchr(basename, '.');
GString *s = g_string_new(basename);
if (last_dot)
g_string_truncate(s, last_dot-basename);
g_string_append(s, ".");
g_string_append(s, ext);
utf8_name = g_filename_to_utf8 (s->str, -1, NULL, NULL, NULL);
g_string_free (s, TRUE);
}
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (exportdlg), utf8_name);
g_clear_pointer (&utf8_name, g_free);
g_clear_pointer (&basename, g_free);
}
static void
export_adapt_extension_callback(GtkWidget *widget)
{
int index = gtk_combo_box_get_active (GTK_COMBO_BOX(widget));
gchar *name = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(exportdlg));
if (name && index > 0) /* Ignore "By Extension" */
export_adapt_extension (name, index - 1);
g_clear_pointer (&name, g_free);
}
/**
* create_export_menu:
*
* Create a new "option menu" for the export options
*/
static GtkWidget *
create_export_menu (void)
{
GtkWidget *menu;
GList *tmp;
menu = gtk_combo_box_text_new ();
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (menu), _("By extension"));
for (tmp = filter_get_export_filters (); tmp != NULL; tmp = tmp->next) {
DiaExportFilter *ef = tmp->data;
gchar *filter_label;
if (!ef)
continue;
filter_label = filter_get_export_filter_label (ef);
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(menu), filter_label);
g_clear_pointer (&filter_label, g_free);
}
g_signal_connect (G_OBJECT (menu), "changed",
G_CALLBACK (export_adapt_extension_callback), NULL);
return menu;
}
/**
* file_export_response_callback:
* @fs: the #GtkFileChooser
* @response: the response
* @user_data: the user data
*
* A button hit in the Export Dialog
*
* Since: dawn-of-time
*/
static void
file_export_response_callback (GtkWidget *fs,
int response,
gpointer user_data)
{
char *filename;
Diagram *dia;
DiaExportFilter *ef;
dia = g_object_get_data (G_OBJECT (fs), "user_data");
g_return_if_fail (dia);
if (response == GTK_RESPONSE_ACCEPT) {
int index;
diagram_update_extents(dia);
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(fs));
index = gtk_combo_box_get_active (GTK_COMBO_BOX(user_data));
if (index >= 0) {
persistence_set_integer ("export-filter", index);
}
ef = efilter_by_index (index - 1, NULL);
if (!ef) {
ef = filter_guess_export_filter (filename);
}
if (ef) {
DiaContext *ctx = dia_context_new (_("Export"));
g_object_ref (dia->data);
dia_context_set_filename (ctx, filename);
ef->export_func (dia->data,
ctx,
filename,
dia->filename,
ef->user_data);
g_object_unref (dia->data);
dia_context_release (ctx);
} else {
message_error (_("Could not determine which export filter\n"
"to use to save '%s'"),
dia_message_filename (filename));
}
g_clear_pointer (&filename, g_free);
}
g_clear_object (&dia); /* drop our diagram reference */
gtk_widget_destroy (exportdlg);
}
/**
* file_export_callback:
* @action: the #GtkAction
*
* React to `<Display>/File/Export`
*
* Since: dawn-of-time
*/
void
file_export_callback (GtkAction *action)
{
DDisplay *ddisp;
Diagram *dia;
char *filename = NULL;
ddisp = ddisplay_active ();
if (!ddisp) {
return;
}
dia = ddisp->diagram;
if (!confirm_export_size (dia,
GTK_WINDOW (ddisp->shell),
CONFIRM_MEMORY | CONFIRM_PAGES))
return;
if (!exportdlg) {
persistence_register_integer ("export-filter", 0);
exportdlg = gtk_file_chooser_dialog_new (_("Export Diagram"),
GTK_WINDOW (ddisp->shell),
GTK_FILE_CHOOSER_ACTION_SAVE,
_("_Cancel"), GTK_RESPONSE_CANCEL,
_("_Save"), GTK_RESPONSE_ACCEPT,
NULL);
/* export via vfs gives: Permission denied - but only if you do not
* have write permissions ;) */
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (exportdlg), FALSE);
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (savedlg), TRUE);
gtk_window_set_role (GTK_WINDOW (exportdlg), "export_diagram");
g_signal_connect (G_OBJECT (exportdlg),
"destroy",
G_CALLBACK (gtk_widget_destroyed),
&exportdlg);
}
if (!gtk_file_chooser_get_extra_widget (GTK_FILE_CHOOSER (exportdlg))) {
GtkWidget *hbox, *label, *omenu, *options;
GtkFileFilter* filter;
options = gtk_frame_new (_("Export Options"));
gtk_frame_set_shadow_type (GTK_FRAME (options), GTK_SHADOW_ETCHED_IN);
hbox = gtk_hbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
gtk_container_add (GTK_CONTAINER (options), hbox);
gtk_widget_show (hbox);
label = gtk_label_new (_("Determine file type:"));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
gtk_widget_show (label);
omenu = create_export_menu ();
gtk_box_pack_start (GTK_BOX (hbox), omenu, TRUE, TRUE, 0);
gtk_widget_show (omenu);
g_object_set_data (G_OBJECT (exportdlg), "export-menu", omenu);
gtk_widget_show (options);
gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (exportdlg), options);
/* set up file filters */
filter = gtk_file_filter_new ();
gtk_file_filter_set_name (filter, _("All Files"));
gtk_file_filter_add_pattern (filter, "*");
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (exportdlg), filter);
/* match the other selections extension */
filter = gtk_file_filter_new ();
gtk_file_filter_set_name (filter, _("Supported Formats"));
gtk_file_filter_add_custom (filter,
GTK_FILE_FILTER_FILENAME,
matching_extensions_filter,
filter_guess_export_filter,
NULL);
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (exportdlg), filter);
gtk_combo_box_set_active (GTK_COMBO_BOX (omenu),
persistence_get_integer ("export-filter"));
g_signal_connect (GTK_FILE_CHOOSER (exportdlg),
"response",
G_CALLBACK (file_export_response_callback),
omenu);
}
g_object_set_data_full (G_OBJECT (exportdlg),
"user_data",
g_object_ref (dia),
g_object_unref);
gtk_widget_set_sensitive (exportdlg, TRUE);
if (dia && dia->filename) {
filename = g_filename_from_utf8 (dia->filename, -1, NULL, NULL, NULL);
}
if (filename != NULL) {
char* fnabs = g_canonicalize_filename (filename, NULL);
if (fnabs) {
char *folder = g_path_get_dirname (fnabs);
char *basename = g_path_get_basename (fnabs);
/* can't use gtk_file_chooser_set_filename for various reasons, see e.g. bug #305850 */
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER(exportdlg), folder);
export_adapt_extension (basename, persistence_get_integer ("export-filter") - 1);
g_clear_pointer (&folder, g_free);
g_clear_pointer (&basename, g_free);
}
g_clear_pointer (&fnabs, g_free);
g_clear_pointer (&filename, g_free);
}
gtk_widget_show (exportdlg);
}
| {
"pile_set_name": "Github"
} |
#------------------------------------------------------------------------------
#
# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
# Module Name:
#
# WriteDr3.S
#
# Abstract:
#
# AsmWriteDr3 function
#
# Notes:
#
#------------------------------------------------------------------------------
#include <EdkIIGlueBase.h>
#------------------------------------------------------------------------------
# UINTN
# EFIAPI
# AsmWriteDr3 (
# UINTN Value
# );
#------------------------------------------------------------------------------
.globl ASM_PFX(AsmWriteDr3)
ASM_PFX(AsmWriteDr3):
mov %rcx, %dr3
mov %rcx, %rax
ret
| {
"pile_set_name": "Github"
} |
//
// SidebarSplitViewController.m
// SplitViewApp
//
// Created by Alexey Yakovenko on 7/6/20.
//
#import "SidebarSplitViewController.h"
#import "SidebarSplitViewItem.h"
@interface SidebarSplitViewController ()
@property IBOutlet NSViewController* sidebarViewController;
@property IBOutlet NSViewController* bodyViewController;
@property IBOutlet NSSplitView* splitView;
@property (nonatomic) id trackingItem;
@end
@implementation SidebarSplitViewController
@dynamic splitView ;
- (void)viewDidLoad {
self.splitView.wantsLayer = YES;
NSSplitViewItem* sidebarItem = [SidebarSplitViewItem splitViewItemWithViewController:self.sidebarViewController];
sidebarItem.canCollapse = YES;
[self insertSplitViewItem:sidebarItem atIndex:0];
NSSplitViewItem* bodyItem = [NSSplitViewItem splitViewItemWithViewController:self.bodyViewController];
bodyItem.canCollapse = NO;
[self insertSplitViewItem:bodyItem atIndex:1];
#if 0 // FIXME: broken in Big Sur beta4
#if defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101600
if (@available(macOS 10.16, *)) {
self.trackingItem = [NSTrackingSeparatorToolbarItem trackingSeparatorToolbarItemWithIdentifier:NSToolbarSidebarTrackingSeparatorItemIdentifier splitView:self.splitView dividerIndex:0];
[self.view.window.toolbar insertItemWithItemIdentifier:NSToolbarSidebarTrackingSeparatorItemIdentifier atIndex:1];
}
#endif
#endif
[super viewDidLoad];
self.splitView.autosaveName = @"MainWindowSplitView";
}
@end
| {
"pile_set_name": "Github"
} |
/**
Class that helps to manage keyboard input.
Code by Rob Kleffner, 2011
*/
Enjine.Keys = {
A: 65,
B: 66,
C: 67,
D: 68,
E: 69,
F: 70,
G: 71,
H: 72,
I: 73,
J: 74,
K: 75,
L: 76,
M: 77,
N: 78,
O: 79,
P: 80,
Q: 81,
R: 82,
S: 83,
T: 84,
U: 85,
V: 86,
W: 87,
X: 88,
Y: 89,
Z: 80,
Left: 37,
Up: 38,
Right: 39,
Down: 40
};
Enjine.KeyboardInput = {
Pressed: new Array(),
Initialize: function() {
var self = this;
document.onkeydown = function(event) { self.KeyDownEvent(event); }
document.onkeyup = function(event) { self.KeyUpEvent(event); }
},
IsKeyDown: function(key) {
if (this.Pressed[key] != null)
return this.Pressed[key];
return false;
},
KeyDownEvent: function(event) {
this.Pressed[event.keyCode] = true;
this.PreventScrolling(event);
},
KeyUpEvent: function(event) {
this.Pressed[event.keyCode] = false;
this.PreventScrolling(event);
},
PreventScrolling: function(event) {
// 37: left, 38: up, 39: right, 40: down
if(event.keyCode >= 37 && event.keyCode <= 40){
event.preventDefault();
}
}
};
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "110A8A8214E9A30B0013AC07"
BuildableName = "RSSParser_Sample.app"
BlueprintName = "RSSParser_Sample"
ReferencedContainer = "container:RSSParser_Sample.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "113DA6A418452BF4005700B7"
BuildableName = "Tests.xctest"
BlueprintName = "Tests"
ReferencedContainer = "container:RSSParser_Sample.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "110A8A8214E9A30B0013AC07"
BuildableName = "RSSParser_Sample.app"
BlueprintName = "RSSParser_Sample"
ReferencedContainer = "container:RSSParser_Sample.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "110A8A8214E9A30B0013AC07"
BuildableName = "RSSParser_Sample.app"
BlueprintName = "RSSParser_Sample"
ReferencedContainer = "container:RSSParser_Sample.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "110A8A8214E9A30B0013AC07"
BuildableName = "RSSParser_Sample.app"
BlueprintName = "RSSParser_Sample"
ReferencedContainer = "container:RSSParser_Sample.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
| {
"pile_set_name": "Github"
} |
// -*- C++ -*-
// Copyright (C) 2005-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, 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
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file rb_tree_map_/rb_tree_.hpp
* Contains an implementation for Red Black trees.
*/
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <utility>
#include <vector>
#include <assert.h>
#include <debug/debug.h>
namespace __gnu_pbds
{
namespace detail
{
#define PB_DS_CLASS_T_DEC \
template<typename Key, typename Mapped, typename Cmp_Fn, \
typename Node_And_It_Traits, typename _Alloc>
#ifdef PB_DS_DATA_TRUE_INDICATOR
# define PB_DS_RB_TREE_NAME rb_tree_map
# define PB_DS_RB_TREE_BASE_NAME bin_search_tree_map
#endif
#ifdef PB_DS_DATA_FALSE_INDICATOR
# define PB_DS_RB_TREE_NAME rb_tree_set
# define PB_DS_RB_TREE_BASE_NAME bin_search_tree_set
#endif
#define PB_DS_CLASS_C_DEC \
PB_DS_RB_TREE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>
#define PB_DS_RB_TREE_BASE \
PB_DS_RB_TREE_BASE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>
/**
* @brief Red-Black tree.
* @ingroup branch-detail
*
* This implementation uses an idea from the SGI STL (using a
* @a header node which is needed for efficient iteration).
*/
template<typename Key,
typename Mapped,
typename Cmp_Fn,
typename Node_And_It_Traits,
typename _Alloc>
class PB_DS_RB_TREE_NAME : public PB_DS_RB_TREE_BASE
{
private:
typedef PB_DS_RB_TREE_BASE base_type;
typedef typename base_type::node_pointer node_pointer;
public:
typedef rb_tree_tag container_category;
typedef Cmp_Fn cmp_fn;
typedef _Alloc allocator_type;
typedef typename _Alloc::size_type size_type;
typedef typename _Alloc::difference_type difference_type;
typedef typename base_type::key_type key_type;
typedef typename base_type::key_pointer key_pointer;
typedef typename base_type::key_const_pointer key_const_pointer;
typedef typename base_type::key_reference key_reference;
typedef typename base_type::key_const_reference key_const_reference;
typedef typename base_type::mapped_type mapped_type;
typedef typename base_type::mapped_pointer mapped_pointer;
typedef typename base_type::mapped_const_pointer mapped_const_pointer;
typedef typename base_type::mapped_reference mapped_reference;
typedef typename base_type::mapped_const_reference mapped_const_reference;
typedef typename base_type::value_type value_type;
typedef typename base_type::pointer pointer;
typedef typename base_type::const_pointer const_pointer;
typedef typename base_type::reference reference;
typedef typename base_type::const_reference const_reference;
typedef typename base_type::point_iterator point_iterator;
typedef typename base_type::const_iterator point_const_iterator;
typedef typename base_type::iterator iterator;
typedef typename base_type::const_iterator const_iterator;
typedef typename base_type::reverse_iterator reverse_iterator;
typedef typename base_type::const_reverse_iterator const_reverse_iterator;
typedef typename base_type::node_update node_update;
PB_DS_RB_TREE_NAME();
PB_DS_RB_TREE_NAME(const Cmp_Fn&);
PB_DS_RB_TREE_NAME(const Cmp_Fn&, const node_update&);
PB_DS_RB_TREE_NAME(const PB_DS_CLASS_C_DEC&);
void
swap(PB_DS_CLASS_C_DEC&);
template<typename It>
void
copy_from_range(It, It);
inline std::pair<point_iterator, bool>
insert(const_reference);
inline mapped_reference
operator[](key_const_reference r_key)
{
#ifdef PB_DS_DATA_TRUE_INDICATOR
_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
std::pair<point_iterator, bool> ins_pair =
base_type::insert_leaf(value_type(r_key, mapped_type()));
if (ins_pair.second == true)
{
ins_pair.first.m_p_nd->m_red = true;
_GLIBCXX_DEBUG_ONLY(this->structure_only_assert_valid(__FILE__, __LINE__);)
insert_fixup(ins_pair.first.m_p_nd);
}
_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
return ins_pair.first.m_p_nd->m_value.second;
#else
insert(r_key);
return base_type::s_null_type;
#endif
}
inline bool
erase(key_const_reference);
inline iterator
erase(iterator);
inline reverse_iterator
erase(reverse_iterator);
template<typename Pred>
inline size_type
erase_if(Pred);
void
join(PB_DS_CLASS_C_DEC&);
void
split(key_const_reference, PB_DS_CLASS_C_DEC&);
private:
#ifdef _GLIBCXX_DEBUG
void
assert_valid(const char*, int) const;
size_type
assert_node_consistent(const node_pointer, const char*, int) const;
#endif
inline static bool
is_effectively_black(const node_pointer);
void
initialize();
void
insert_fixup(node_pointer);
void
erase_node(node_pointer);
void
remove_node(node_pointer);
void
remove_fixup(node_pointer, node_pointer);
void
split_imp(node_pointer, PB_DS_CLASS_C_DEC&);
inline node_pointer
split_min();
std::pair<node_pointer, node_pointer>
split_min_imp();
void
join_imp(node_pointer, node_pointer);
std::pair<node_pointer, node_pointer>
find_join_pos_right(node_pointer, size_type, size_type);
std::pair<node_pointer, node_pointer>
find_join_pos_left(node_pointer, size_type, size_type);
inline size_type
black_height(node_pointer);
void
split_at_node(node_pointer, PB_DS_CLASS_C_DEC&);
};
#define PB_DS_STRUCT_ONLY_ASSERT_VALID(X) \
_GLIBCXX_DEBUG_ONLY(X.structure_only_assert_valid(__FILE__, __LINE__);)
#include <ext/pb_ds/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp>
#include <ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp>
#include <ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp>
#include <ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp>
#include <ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp>
#include <ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp>
#undef PB_DS_STRUCT_ONLY_ASSERT_VALID
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_CLASS_C_DEC
#undef PB_DS_RB_TREE_NAME
#undef PB_DS_RB_TREE_BASE_NAME
#undef PB_DS_RB_TREE_BASE
} // namespace detail
} // namespace __gnu_pbds
| {
"pile_set_name": "Github"
} |
CREATE TRIGGER APPLICATION_DELETE BEFORE DELETE ON APPLICATION
FOR EACH ROW BEGIN
DELETE FROM APP_CACHE_VIEW WHERE APP_UID = OLD.APP_UID;
END | {
"pile_set_name": "Github"
} |
= Integration SPI
:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
:page-partial:
The integration SPIs allow the framework to automate the exchange of data between bounded contexts automatically.
TIP: see also the xref:mappings:ROOT:about.adoc[Bounded Context Mappings] catalogue.
.Integration SPI
[cols="2m,4a,2a",options="header"]
|===
|API
|Description
|Implementation
|xref:refguide:applib-svc:CommandDtoProcessorService.adoc.adoc[CommandDtoProcessorService]
|SPI to support representation of commands as XML over REST, in particular to support master/slave replay of commands.
|
* xref:extensions:command-log:about.adoc[Command Log +
(in Extensions catalog)]
|xref:refguide:applib-svc:CommandExecutorService.adoc.adoc[CommandExecutorService]
|Internal service used to execute commands.
One use case is to replay commands from a primary onto a secondary (see xref:extensions:command-replay:about.adoc[Command Replay] ; another is in support of async commands (using
xref:refguide:applib-svc:WrapperFactory.adoc[`WrapperFactory`] ).
|
* xref:core:runtime-services:about.adoc[Core Runtime Services]
|xref:refguide:applib-svc:CommandServiceListener.adoc.adoc[CommandServiceListener]
|SPI to allow commands to be processed on completion.
The xref:extensions:command-log:about.adoc[Command Log] extension implements the SPI in order to persists commands for audit or replay.
|
* xref:core:runtime-services:about.adoc[Core Runtime Services]
|xref:refguide:applib-svc:PublisherService.adoc[PublisherService]
|Publish any action invocations/property edits and changed objects, typically for interchange with an external system in a different bounded context.
|
* `PublisherServiceLogging` (in applib)
* xref:mappings:outbox-publisher:about.adoc[Outbox Publisher] (in Mappings catalogue)
|===
| {
"pile_set_name": "Github"
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_45) on Sun Sep 08 19:26:29 EDT 2013 -->
<TITLE>
Signature (JHOVE Documentation)
</TITLE>
<META NAME="date" CONTENT="2013-09-08">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Signature (JHOVE Documentation)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../edu/harvard/hul/ois/jhove/RFC1766Lang.html" title="class in edu.harvard.hul.ois.jhove"><B>PREV CLASS</B></A>
<A HREF="../../../../../edu/harvard/hul/ois/jhove/SignatureType.html" title="class in edu.harvard.hul.ois.jhove"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?edu/harvard/hul/ois/jhove/Signature.html" target="_top"><B>FRAMES</B></A>
<A HREF="Signature.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
edu.harvard.hul.ois.jhove</FONT>
<BR>
Class Signature</H2>
<PRE>
java.lang.Object
<IMG SRC="../../../../../resources/inherit.gif" ALT="extended by "><B>edu.harvard.hul.ois.jhove.Signature</B>
</PRE>
<DL>
<DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../../../../edu/harvard/hul/ois/jhove/ExternalSignature.html" title="class in edu.harvard.hul.ois.jhove">ExternalSignature</A>, <A HREF="../../../../../edu/harvard/hul/ois/jhove/InternalSignature.html" title="class in edu.harvard.hul.ois.jhove">InternalSignature</A></DD>
</DL>
<HR>
<DL>
<DT><PRE>public abstract class <B>Signature</B><DT>extends java.lang.Object</DL>
</PRE>
<P>
This class encapsulates information about format signatures,
both internal and external.
The value of a Signature may be either a String or a byte array
(stored as an int array to avoid signed byte problems).
<P>
<P>
<HR>
<P>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected </CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../edu/harvard/hul/ois/jhove/Signature.html#Signature(int[], edu.harvard.hul.ois.jhove.SignatureType, edu.harvard.hul.ois.jhove.SignatureUseType)">Signature</A></B>(int[] value,
<A HREF="../../../../../edu/harvard/hul/ois/jhove/SignatureType.html" title="class in edu.harvard.hul.ois.jhove">SignatureType</A> type,
<A HREF="../../../../../edu/harvard/hul/ois/jhove/SignatureUseType.html" title="class in edu.harvard.hul.ois.jhove">SignatureUseType</A> use)</CODE>
<BR>
A Signature cannot be created directly; this constructor
can be called as the superclass constructor from a subclass.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected </CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../edu/harvard/hul/ois/jhove/Signature.html#Signature(int[], edu.harvard.hul.ois.jhove.SignatureType, edu.harvard.hul.ois.jhove.SignatureUseType, java.lang.String)">Signature</A></B>(int[] value,
<A HREF="../../../../../edu/harvard/hul/ois/jhove/SignatureType.html" title="class in edu.harvard.hul.ois.jhove">SignatureType</A> type,
<A HREF="../../../../../edu/harvard/hul/ois/jhove/SignatureUseType.html" title="class in edu.harvard.hul.ois.jhove">SignatureUseType</A> use,
java.lang.String note)</CODE>
<BR>
A Signature cannot be created directly; this constructor
can be called as the superclass constructor from a subclass.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected </CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../edu/harvard/hul/ois/jhove/Signature.html#Signature(java.lang.String, edu.harvard.hul.ois.jhove.SignatureType, edu.harvard.hul.ois.jhove.SignatureUseType)">Signature</A></B>(java.lang.String value,
<A HREF="../../../../../edu/harvard/hul/ois/jhove/SignatureType.html" title="class in edu.harvard.hul.ois.jhove">SignatureType</A> type,
<A HREF="../../../../../edu/harvard/hul/ois/jhove/SignatureUseType.html" title="class in edu.harvard.hul.ois.jhove">SignatureUseType</A> use)</CODE>
<BR>
A Signature cannot be created directly; this constructor
can be called as the superclass constructor from a subclass.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected </CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../edu/harvard/hul/ois/jhove/Signature.html#Signature(java.lang.String, edu.harvard.hul.ois.jhove.SignatureType, edu.harvard.hul.ois.jhove.SignatureUseType, java.lang.String)">Signature</A></B>(java.lang.String value,
<A HREF="../../../../../edu/harvard/hul/ois/jhove/SignatureType.html" title="class in edu.harvard.hul.ois.jhove">SignatureType</A> type,
<A HREF="../../../../../edu/harvard/hul/ois/jhove/SignatureUseType.html" title="class in edu.harvard.hul.ois.jhove">SignatureUseType</A> use,
java.lang.String note)</CODE>
<BR>
A Signature cannot be created directly; this constructor
can be called as the superclass constructor from a subclass.</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../edu/harvard/hul/ois/jhove/Signature.html#getNote()">getNote</A></B>()</CODE>
<BR>
Returns the note specified for this Signature, or null
if no note was specified.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../edu/harvard/hul/ois/jhove/SignatureType.html" title="class in edu.harvard.hul.ois.jhove">SignatureType</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../edu/harvard/hul/ois/jhove/Signature.html#getType()">getType</A></B>()</CODE>
<BR>
Returns the type of this Signature</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../edu/harvard/hul/ois/jhove/SignatureUseType.html" title="class in edu.harvard.hul.ois.jhove">SignatureUseType</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../edu/harvard/hul/ois/jhove/Signature.html#getUse()">getUse</A></B>()</CODE>
<BR>
Returns the use requirement for this Signature</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../edu/harvard/hul/ois/jhove/Signature.html#getValue()">getValue</A></B>()</CODE>
<BR>
Returns the byte array value for this Signature.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../edu/harvard/hul/ois/jhove/Signature.html#getValueHexString()">getValueHexString</A></B>()</CODE>
<BR>
Returns the value of this Signature as a hexadecimal string.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../edu/harvard/hul/ois/jhove/Signature.html#getValueString()">getValueString</A></B>()</CODE>
<BR>
Returns the string value of this Signature.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../edu/harvard/hul/ois/jhove/Signature.html#isStringValue()">isStringValue</A></B>()</CODE>
<BR>
Returns true if this Signature's value was provided as a
String, false if as an array.</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
<P>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="Signature(java.lang.String, edu.harvard.hul.ois.jhove.SignatureType, edu.harvard.hul.ois.jhove.SignatureUseType)"><!-- --></A><H3>
Signature</H3>
<PRE>
protected <B>Signature</B>(java.lang.String value,
<A HREF="../../../../../edu/harvard/hul/ois/jhove/SignatureType.html" title="class in edu.harvard.hul.ois.jhove">SignatureType</A> type,
<A HREF="../../../../../edu/harvard/hul/ois/jhove/SignatureUseType.html" title="class in edu.harvard.hul.ois.jhove">SignatureUseType</A> use)</PRE>
<DL>
<DD>A Signature cannot be created directly; this constructor
can be called as the superclass constructor from a subclass.
This constructor uses a String value.
<P>
</DL>
<HR>
<A NAME="Signature(int[], edu.harvard.hul.ois.jhove.SignatureType, edu.harvard.hul.ois.jhove.SignatureUseType)"><!-- --></A><H3>
Signature</H3>
<PRE>
protected <B>Signature</B>(int[] value,
<A HREF="../../../../../edu/harvard/hul/ois/jhove/SignatureType.html" title="class in edu.harvard.hul.ois.jhove">SignatureType</A> type,
<A HREF="../../../../../edu/harvard/hul/ois/jhove/SignatureUseType.html" title="class in edu.harvard.hul.ois.jhove">SignatureUseType</A> use)</PRE>
<DL>
<DD>A Signature cannot be created directly; this constructor
can be called as the superclass constructor from a subclass.
This constructor uses a byte array (stored as an int array) value.
<P>
</DL>
<HR>
<A NAME="Signature(java.lang.String, edu.harvard.hul.ois.jhove.SignatureType, edu.harvard.hul.ois.jhove.SignatureUseType, java.lang.String)"><!-- --></A><H3>
Signature</H3>
<PRE>
protected <B>Signature</B>(java.lang.String value,
<A HREF="../../../../../edu/harvard/hul/ois/jhove/SignatureType.html" title="class in edu.harvard.hul.ois.jhove">SignatureType</A> type,
<A HREF="../../../../../edu/harvard/hul/ois/jhove/SignatureUseType.html" title="class in edu.harvard.hul.ois.jhove">SignatureUseType</A> use,
java.lang.String note)</PRE>
<DL>
<DD>A Signature cannot be created directly; this constructor
can be called as the superclass constructor from a subclass.
This constructor uses a String value and allows specification
of a note.
<P>
</DL>
<HR>
<A NAME="Signature(int[], edu.harvard.hul.ois.jhove.SignatureType, edu.harvard.hul.ois.jhove.SignatureUseType, java.lang.String)"><!-- --></A><H3>
Signature</H3>
<PRE>
protected <B>Signature</B>(int[] value,
<A HREF="../../../../../edu/harvard/hul/ois/jhove/SignatureType.html" title="class in edu.harvard.hul.ois.jhove">SignatureType</A> type,
<A HREF="../../../../../edu/harvard/hul/ois/jhove/SignatureUseType.html" title="class in edu.harvard.hul.ois.jhove">SignatureUseType</A> use,
java.lang.String note)</PRE>
<DL>
<DD>A Signature cannot be created directly; this constructor
can be called as the superclass constructor from a subclass.
This constructor uses a byte array (stored as an int array) value
and allows specification of a note.
<P>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="getType()"><!-- --></A><H3>
getType</H3>
<PRE>
public <A HREF="../../../../../edu/harvard/hul/ois/jhove/SignatureType.html" title="class in edu.harvard.hul.ois.jhove">SignatureType</A> <B>getType</B>()</PRE>
<DL>
<DD>Returns the type of this Signature
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="getUse()"><!-- --></A><H3>
getUse</H3>
<PRE>
public <A HREF="../../../../../edu/harvard/hul/ois/jhove/SignatureUseType.html" title="class in edu.harvard.hul.ois.jhove">SignatureUseType</A> <B>getUse</B>()</PRE>
<DL>
<DD>Returns the use requirement for this Signature
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="getValue()"><!-- --></A><H3>
getValue</H3>
<PRE>
public int[] <B>getValue</B>()</PRE>
<DL>
<DD>Returns the byte array value for this Signature.
If this Signature was constructed from a String, it
returns the characters of the String as the bytes of
the array.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="getNote()"><!-- --></A><H3>
getNote</H3>
<PRE>
public java.lang.String <B>getNote</B>()</PRE>
<DL>
<DD>Returns the note specified for this Signature, or null
if no note was specified.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="isStringValue()"><!-- --></A><H3>
isStringValue</H3>
<PRE>
public boolean <B>isStringValue</B>()</PRE>
<DL>
<DD>Returns true if this Signature's value was provided as a
String, false if as an array.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="getValueString()"><!-- --></A><H3>
getValueString</H3>
<PRE>
public java.lang.String <B>getValueString</B>()</PRE>
<DL>
<DD>Returns the string value of this Signature. Returns null
if this Signature was constructed with an array.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="getValueHexString()"><!-- --></A><H3>
getValueHexString</H3>
<PRE>
public java.lang.String <B>getValueHexString</B>()</PRE>
<DL>
<DD>Returns the value of this Signature as a hexadecimal string.
The length of the string is twice the length of the array
or string from which this Signature was created, and all
alphabetic characters are lower case.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../edu/harvard/hul/ois/jhove/RFC1766Lang.html" title="class in edu.harvard.hul.ois.jhove"><B>PREV CLASS</B></A>
<A HREF="../../../../../edu/harvard/hul/ois/jhove/SignatureType.html" title="class in edu.harvard.hul.ois.jhove"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?edu/harvard/hul/ois/jhove/Signature.html" target="_top"><B>FRAMES</B></A>
<A HREF="Signature.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
</BODY>
</HTML>
| {
"pile_set_name": "Github"
} |
/*
This file is part of the iText (R) project.
Copyright (c) 1998-2020 iText Group NV
Authors: Bruno Lowagie, Paulo Soares, et al.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License version 3
as published by the Free Software Foundation with the addition of the
following permission added to Section 15 as permitted in Section 7(a):
FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY
ITEXT GROUP. ITEXT GROUP DISCLAIMS THE WARRANTY OF NON INFRINGEMENT
OF THIRD PARTY RIGHTS
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program; if not, see http://www.gnu.org/licenses or write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA, 02110-1301 USA, or download the license from the following URL:
http://itextpdf.com/terms-of-use/
The interactive user interfaces in modified source and object code versions
of this program must display Appropriate Legal Notices, as required under
Section 5 of the GNU Affero General Public License.
In accordance with Section 7(b) of the GNU Affero General Public License,
a covered work must retain the producer line in every PDF that is created
or manipulated using iText.
You can be released from the requirements of the license by purchasing
a commercial license. Buying such a license is mandatory as soon as you
develop commercial activities involving the iText software without
disclosing the source code of your own applications.
These activities include: offering paid services to customers as an ASP,
serving PDFs on the fly in a web application, shipping iText with a closed
source product.
For more information, please contact iText Software Corp. at this
address: [email protected]
*/
package com.itextpdf.kernel.pdf.tagutils;
import com.itextpdf.io.LogMessageConstant;
import com.itextpdf.kernel.PdfException;
import com.itextpdf.kernel.pdf.PdfArray;
import com.itextpdf.kernel.pdf.PdfDictionary;
import com.itextpdf.kernel.pdf.PdfDocument;
import com.itextpdf.kernel.pdf.PdfIndirectReference;
import com.itextpdf.kernel.pdf.PdfName;
import com.itextpdf.kernel.pdf.PdfNumber;
import com.itextpdf.kernel.pdf.PdfPage;
import com.itextpdf.kernel.pdf.PdfVersion;
import com.itextpdf.kernel.pdf.annot.PdfAnnotation;
import com.itextpdf.kernel.pdf.tagging.IStructureNode;
import com.itextpdf.kernel.pdf.tagging.PdfMcr;
import com.itextpdf.kernel.pdf.tagging.PdfNamespace;
import com.itextpdf.kernel.pdf.tagging.PdfObjRef;
import com.itextpdf.kernel.pdf.tagging.PdfStructElem;
import com.itextpdf.kernel.pdf.tagging.PdfStructTreeRoot;
import com.itextpdf.kernel.pdf.tagging.StandardNamespaces;
import com.itextpdf.kernel.pdf.tagging.StandardRoles;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* {@code TagStructureContext} class is used to track necessary information of document's tag structure.
* It is also used to make some global modifications of the tag tree like removing or flushing page tags, however
* these two methods and also others are called automatically and are for the most part for internal usage.
* <br>
* There shall be only one instance of this class per {@code PdfDocument}. To obtain instance of this class use
* {@link PdfDocument#getTagStructureContext()}.
*/
public class TagStructureContext {
private static final Set<String> allowedRootTagRoles = new HashSet<>();
static {
allowedRootTagRoles.add(StandardRoles.DOCUMENT);
allowedRootTagRoles.add(StandardRoles.PART);
allowedRootTagRoles.add(StandardRoles.ART);
allowedRootTagRoles.add(StandardRoles.SECT);
allowedRootTagRoles.add(StandardRoles.DIV);
}
private PdfDocument document;
private PdfStructElem rootTagElement;
protected TagTreePointer autoTaggingPointer;
private PdfVersion tagStructureTargetVersion;
private boolean forbidUnknownRoles;
private WaitingTagsManager waitingTagsManager;
private Set<PdfDictionary> namespaces;
private Map<String, PdfNamespace> nameToNamespace;
private PdfNamespace documentDefaultNamespace;
/**
* Do not use this constructor, instead use {@link PdfDocument#getTagStructureContext()}
* method.
* <br>
* Creates {@code TagStructureContext} for document. There shall be only one instance of this
* class per {@code PdfDocument}.
* @param document the document which tag structure will be manipulated with this class.
*/
public TagStructureContext(PdfDocument document) {
this(document, document.getPdfVersion());
}
/**
* Do not use this constructor, instead use {@link PdfDocument#getTagStructureContext()}
* method.
* <p>
* Creates {@code TagStructureContext} for document. There shall be only one instance of this
* class per {@code PdfDocument}.
* @param document the document which tag structure will be manipulated with this class.
* @param tagStructureTargetVersion the version of the pdf standard to which the tag structure shall adhere.
*/
public TagStructureContext(PdfDocument document, PdfVersion tagStructureTargetVersion) {
this.document = document;
if (!document.isTagged()) {
throw new PdfException(PdfException.MustBeATaggedDocument);
}
waitingTagsManager = new WaitingTagsManager();
namespaces = new LinkedHashSet<>();
nameToNamespace = new HashMap<>();
this.tagStructureTargetVersion = tagStructureTargetVersion;
forbidUnknownRoles = true;
if (targetTagStructureVersionIs2()) {
initRegisteredNamespaces();
setNamespaceForNewTagsBasedOnExistingRoot();
}
}
/**
* If forbidUnknownRoles is set to true, then if you would try to add new tag which has not a standard role and
* it's role is not mapped through RoleMap, an exception will be raised.
* Default value - true.
* @param forbidUnknownRoles new value of the flag
* @return current {@link TagStructureContext} instance.
*/
public TagStructureContext setForbidUnknownRoles(boolean forbidUnknownRoles) {
this.forbidUnknownRoles = forbidUnknownRoles;
return this;
}
public PdfVersion getTagStructureTargetVersion() {
return tagStructureTargetVersion;
}
/**
* All tagging logic performed by iText automatically (along with addition of content, annotations etc)
* uses {@link TagTreePointer} returned by this method to manipulate the tag structure.
* Typically it points at the root tag. This pointer also could be used to tweak auto tagging process
* (e.g. move this pointer to the Section tag, which would result in placing all automatically tagged content
* under Section tag).
* @return the {@code TagTreePointer} which is used for all automatic tagging of the document.
*/
public TagTreePointer getAutoTaggingPointer() {
if (autoTaggingPointer == null) {
autoTaggingPointer = new TagTreePointer(document);
}
return autoTaggingPointer;
}
/**
* Gets {@link WaitingTagsManager} for the current document. It allows to mark tags as waiting,
* which would indicate that they are incomplete and are not ready to be flushed.
* @return document's {@link WaitingTagsManager} class instance.
*/
public WaitingTagsManager getWaitingTagsManager() {
return waitingTagsManager;
}
/**
* A namespace that is used as a default value for the tagging for any new {@link TagTreePointer} created
* (including the pointer returned by {@link #getAutoTaggingPointer()}, which implies that automatically
* created tag structure will be in this namespace by default).
* <p>
* By default, this value is defined based on the PDF document version and the existing tag structure inside
* a document. For the new empty PDF 2.0 documents this namespace is set to {@link StandardNamespaces#PDF_2_0}.
* <p>
* This value has meaning only for the PDF documents of version <b>2.0 and higher</b>.
* @return a {@link PdfNamespace} which is used as a default value for the document tagging.
*/
public PdfNamespace getDocumentDefaultNamespace() {
return documentDefaultNamespace;
}
/**
* Sets a namespace that will be used as a default value for the tagging for any new {@link TagTreePointer} created.
* See {@link #getDocumentDefaultNamespace()} for more info.
* <p>
* Be careful when changing this property value. It is most recommended to do it right after the {@link PdfDocument} was
* created, before any content was added. Changing this value after any content was added might result in the mingled
* tag structure from the namespaces point of view. So in order to maintain the document consistent but in the namespace
* different from default, set this value before any modifications to the document were made and before
* {@link #getAutoTaggingPointer()} method was called for the first time.
* <p>
* This value has meaning only for the PDF documents of version <b>2.0 and higher</b>.
*
* @param namespace a {@link PdfNamespace} which is to be used as a default value for the document tagging.
* @return current {@link TagStructureContext} instance.
*/
public TagStructureContext setDocumentDefaultNamespace(PdfNamespace namespace) {
this.documentDefaultNamespace = namespace;
return this;
}
/**
* This method defines a recommended way to obtain {@link PdfNamespace} class instances.
* <p>
* Returns either a wrapper over an already existing namespace dictionary in the document or over a new one
* if such namespace wasn't encountered before. Calling this method is considered as encountering a namespace,
* i.e. two sequential calls on this method will return the same namespace instance (which is not true in general case
* of two method calls, for instance if several namespace instances with the same name are created via
* {@link PdfNamespace} constructors and set to the elements of the tag structure, then the last encountered one
* will be returned by this method). However encountered namespaces will not be added to the document's structure tree root
* {@link PdfName#Namespaces /Namespaces} array unless they were set to the certain element of the tag structure.
*
* @param namespaceName a {@link String} defining the namespace name (conventionally a uniform resource identifier, or URI).
* @return {@link PdfNamespace} wrapper over either already existing namespace object or over the new one.
*/
public PdfNamespace fetchNamespace(String namespaceName) {
PdfNamespace ns = nameToNamespace.get(namespaceName);
if (ns == null) {
ns = new PdfNamespace(namespaceName);
nameToNamespace.put(namespaceName, ns);
}
return ns;
}
/**
* Gets an instance of the {@link IRoleMappingResolver} corresponding to the current tag structure target version.
* This method implies that role is in the default standard structure namespace.
* @param role a role in the default standard structure namespace which mapping is to be resolved.
* @return a {@link IRoleMappingResolver} instance, with the giving role as current.
*/
public IRoleMappingResolver getRoleMappingResolver(String role) {
return getRoleMappingResolver(role, null);
}
/**
* Gets an instance of the {@link IRoleMappingResolver} corresponding to the current tag structure target version.
* @param role a role in the given namespace which mapping is to be resolved.
* @param namespace a {@link PdfNamespace} which this role belongs to.
* @return a {@link IRoleMappingResolver} instance, with the giving role in the given {@link PdfNamespace} as current.
*/
public IRoleMappingResolver getRoleMappingResolver(String role, PdfNamespace namespace) {
if (targetTagStructureVersionIs2()) {
return new RoleMappingResolverPdf2(role, namespace, getDocument());
} else {
return new RoleMappingResolver(role, getDocument());
}
}
/**
* Checks if the given role and namespace are specified to be obligatory mapped to the standard structure namespace
* in order to be a valid role in the Tagged PDF.
* @param role a role in the given namespace which mapping necessity is to be checked.
* @param namespace a {@link PdfNamespace} which this role belongs to, null value refers to the default standard
* structure namespace.
* @return true, if the given role in the given namespace is either mapped to the standard structure role or doesn't
* have to; otherwise false.
*/
public boolean checkIfRoleShallBeMappedToStandardRole(String role, PdfNamespace namespace) {
return resolveMappingToStandardOrDomainSpecificRole(role, namespace) != null;
}
/**
* Gets an instance of the {@link IRoleMappingResolver} which is already in the "resolved" state: it returns
* role in the standard or domain-specific namespace for the {@link IRoleMappingResolver#getRole()} and {@link IRoleMappingResolver#getNamespace()}
* methods calls which correspond to the mapping of the given role; or null if the given role is not mapped to the standard or domain-specific one.
* @param role a role in the given namespace which mapping is to be resolved.
* @param namespace a {@link PdfNamespace} which this role belongs to.
* @return an instance of the {@link IRoleMappingResolver} which returns false
* for the {@link IRoleMappingResolver#currentRoleShallBeMappedToStandard()} method call; if mapping cannot be resolved
* to this state, this method returns null, which means that the given role
* in the specified namespace is not mapped to the standard role in the standard namespace.
*/
public IRoleMappingResolver resolveMappingToStandardOrDomainSpecificRole(String role, PdfNamespace namespace) {
IRoleMappingResolver mappingResolver = getRoleMappingResolver(role, namespace);
mappingResolver.resolveNextMapping();
int i = 0;
// reasonably large arbitrary number that will help to avoid a possible infinite loop
int maxIters = 100;
while (mappingResolver.currentRoleShallBeMappedToStandard()) {
if (++i > maxIters) {
Logger logger = LoggerFactory.getLogger(TagStructureContext.class);
logger.error(composeTooMuchTransitiveMappingsException(role, namespace));
return null;
}
if (!mappingResolver.resolveNextMapping()) {
return null;
}
}
return mappingResolver;
}
/**
* Removes annotation content item from the tag structure.
* If annotation is not added to the document or is not tagged, nothing will happen.
*
* @param annotation the {@link PdfAnnotation} that will be removed from the tag structure
* @return {@link TagTreePointer} instance which points at annotation tag parent if annotation was removed,
* otherwise returns null
*/
public TagTreePointer removeAnnotationTag(PdfAnnotation annotation) {
PdfStructElem structElem = null;
PdfDictionary annotDic = annotation.getPdfObject();
PdfNumber structParentIndex = (PdfNumber) annotDic.get(PdfName.StructParent);
if (structParentIndex != null) {
PdfObjRef objRef = document.getStructTreeRoot().findObjRefByStructParentIndex(annotDic.getAsDictionary(PdfName.P), structParentIndex.intValue());
if (objRef != null) {
PdfStructElem parent = (PdfStructElem) objRef.getParent();
parent.removeKid(objRef);
structElem = parent;
}
}
annotDic.remove(PdfName.StructParent);
annotDic.setModified();
if (structElem != null) {
return new TagTreePointer(document).setCurrentStructElem(structElem);
}
return null;
}
/**
* Removes content item from the tag structure.
* <br>
* Nothing happens if there is no such mcid on given page.
* @param page page, which contains this content item
* @param mcid marked content id of this content item
* @return {@code TagTreePointer} which points at the parent of the removed content item, or null if there is no
* such mcid on given page.
*/
public TagTreePointer removeContentItem(PdfPage page, int mcid) {
PdfMcr mcr = document.getStructTreeRoot().findMcrByMcid(page.getPdfObject(), mcid);
if (mcr == null) {
return null;
}
PdfStructElem parent = (PdfStructElem) mcr.getParent();
parent.removeKid(mcr);
return new TagTreePointer(document).setCurrentStructElem(parent);
}
/**
* Removes all tags that belong only to this page. The logic which defines if tag belongs to the page is described
* at {@link #flushPageTags(PdfPage)}.
*
* @param page page that defines which tags are to be removed
* @return current {@link TagStructureContext} instance
*/
public TagStructureContext removePageTags(PdfPage page) {
PdfStructTreeRoot structTreeRoot = document.getStructTreeRoot();
Collection<PdfMcr> pageMcrs = structTreeRoot.getPageMarkedContentReferences(page);
if (pageMcrs != null) {
// We create a copy here, because pageMcrs is backed by the internal collection which is changed when mcrs are removed.
List<PdfMcr> mcrsList = new ArrayList<>(pageMcrs);
for (PdfMcr mcr : mcrsList) {
removePageTagFromParent(mcr, mcr.getParent());
}
}
return this;
}
/**
* Flushes the tags which are considered to belong to the given page.
* The logic that defines if the given tag (structure element) belongs to the page is the following:
* if all the marked content references (dictionary or number references), that are the
* descendants of the given structure element, belong to the current page - the tag is considered
* to belong to the page. If tag has descendants from several pages - it is flushed, if all other pages except the
* current one are flushed.
*
* <br><br>
* If some of the page's tags have waiting state (see {@link WaitingTagsManager} these tags are considered
* as not yet finished ones, and they and their children won't be flushed.
*
* @param page a page which tags will be flushed
* @return current {@link TagStructureContext} instance
*/
public TagStructureContext flushPageTags(PdfPage page) {
PdfStructTreeRoot structTreeRoot = document.getStructTreeRoot();
Collection<PdfMcr> pageMcrs = structTreeRoot.getPageMarkedContentReferences(page);
if (pageMcrs != null) {
for (PdfMcr mcr : pageMcrs) {
PdfStructElem parent = (PdfStructElem) mcr.getParent();
flushParentIfBelongsToPage(parent, page);
}
}
return this;
}
/**
* Transforms root tags in a way that complies with the tagged PDF specification.
* Depending on PDF version behaviour may differ.
*
* <br>
* ISO 32000-1 (PDF 1.7 and lower)
* 14.8.4.2 Grouping Elements
*
* <br>
* "In a tagged PDF document, the structure tree shall contain a single top-level element; that is,
* the structure tree root (identified by the StructTreeRoot entry in the document catalogue) shall
* have only one child in its K (kids) array. If the PDF file contains a complete document, the structure
* type Document should be used for this top-level element in the logical structure hierarchy. If the file
* contains a well-formed document fragment, one of the structure types Part, Art, Sect, or Div may be used instead."
*
* <br>
* For PDF 2.0 and higher root tag is allowed to have only the Document role.
*/
public void normalizeDocumentRootTag() {
// in this method we could deal with existing document, so we don't won't to throw exceptions here
boolean forbid = forbidUnknownRoles;
forbidUnknownRoles = false;
List<IStructureNode> rootKids = document.getStructTreeRoot().getKids();
IRoleMappingResolver mapping = null;
if (rootKids.size() > 0) {
PdfStructElem firstKid = (PdfStructElem) rootKids.get(0);
mapping = resolveMappingToStandardOrDomainSpecificRole(firstKid.getRole().getValue(), firstKid.getNamespace());
}
if (rootKids.size() == 1
&& mapping != null && mapping.currentRoleIsStandard()
&& isRoleAllowedToBeRoot(mapping.getRole())) {
rootTagElement = (PdfStructElem) rootKids.get(0);
} else {
document.getStructTreeRoot().getPdfObject().remove(PdfName.K);
rootTagElement = new RootTagNormalizer(this, rootTagElement, document).makeSingleStandardRootTag(rootKids);
}
forbidUnknownRoles = forbid;
}
/**
* A utility method that prepares the current instance of the {@link TagStructureContext} for
* the closing of document. Essentially it flushes all the "hanging" information to the document.
*/
public void prepareToDocumentClosing() {
waitingTagsManager.removeAllWaitingStates();
actualizeNamespacesInStructTreeRoot();
}
/**
* Gets {@link PdfStructElem} at which {@link TagTreePointer} points.
* <p>
* NOTE: Be aware that {@link PdfStructElem} is a low level class, use it carefully,
* especially in conjunction with high level {@link TagTreePointer} and {@link TagStructureContext} classes.
*
* @param pointer a {@link TagTreePointer} which points at desired {@link PdfStructElem}.
* @return a {@link PdfStructElem} at which given {@link TagTreePointer} points.
*/
public PdfStructElem getPointerStructElem(TagTreePointer pointer) {
return pointer.getCurrentStructElem();
}
/**
* Creates a new {@link TagTreePointer} which points at given {@link PdfStructElem}.
* @param structElem a {@link PdfStructElem} for which {@link TagTreePointer} will be created.
* @return a new {@link TagTreePointer}.
*/
public TagTreePointer createPointerForStructElem(PdfStructElem structElem) {
return new TagTreePointer(structElem, document);
}
PdfStructElem getRootTag() {
if (rootTagElement == null) {
normalizeDocumentRootTag();
}
return rootTagElement;
}
PdfDocument getDocument() {
return document;
}
void ensureNamespaceRegistered(PdfNamespace namespace) {
if (namespace != null) {
PdfDictionary namespaceObj = namespace.getPdfObject();
if (!namespaces.contains(namespaceObj)) {
namespaces.add(namespaceObj);
}
nameToNamespace.put(namespace.getNamespaceName(), namespace);
}
}
void throwExceptionIfRoleIsInvalid(AccessibilityProperties properties, PdfNamespace pointerCurrentNamespace) {
PdfNamespace namespace = properties.getNamespace();
if (namespace == null) {
namespace = pointerCurrentNamespace;
}
throwExceptionIfRoleIsInvalid(properties.getRole(), namespace);
}
void throwExceptionIfRoleIsInvalid(String role, PdfNamespace namespace) {
if (!checkIfRoleShallBeMappedToStandardRole(role, namespace)) {
String exMessage = composeInvalidRoleException(role, namespace);
if (forbidUnknownRoles) {
throw new PdfException(exMessage);
} else {
Logger logger = LoggerFactory.getLogger(TagStructureContext.class);
logger.warn(exMessage);
}
}
}
boolean targetTagStructureVersionIs2() {
return PdfVersion.PDF_2_0.compareTo(tagStructureTargetVersion) <= 0;
}
void flushParentIfBelongsToPage(PdfStructElem parent, PdfPage currentPage) {
if (parent.isFlushed() || waitingTagsManager.getObjForStructDict(parent.getPdfObject()) != null
|| parent.getParent() instanceof PdfStructTreeRoot) {
return;
}
List<IStructureNode> kids = parent.getKids();
boolean readyToBeFlushed = true;
for (IStructureNode kid : kids) {
if (kid instanceof PdfMcr) {
PdfDictionary kidPage = ((PdfMcr) kid).getPageObject();
if (!kidPage.isFlushed() && (currentPage == null || !kidPage.equals(currentPage.getPdfObject()))) {
readyToBeFlushed = false;
break;
}
} else if (kid instanceof PdfStructElem) {
// If kid is structElem and was already flushed then in kids list there will be null for it instead of
// PdfStructElement. And therefore if we get into this if-clause it means that some StructElem wasn't flushed.
readyToBeFlushed = false;
break;
}
}
if (readyToBeFlushed) {
IStructureNode parentsParent = parent.getParent();
parent.flush();
if (parentsParent instanceof PdfStructElem) {
flushParentIfBelongsToPage((PdfStructElem)parentsParent, currentPage);
}
}
}
private boolean isRoleAllowedToBeRoot(String role) {
if (targetTagStructureVersionIs2()) {
return StandardRoles.DOCUMENT.equals(role);
} else {
return allowedRootTagRoles.contains(role);
}
}
private void setNamespaceForNewTagsBasedOnExistingRoot() {
List<IStructureNode> rootKids = document.getStructTreeRoot().getKids();
if (rootKids.size() > 0) {
PdfStructElem firstKid = (PdfStructElem) rootKids.get(0);
IRoleMappingResolver resolvedMapping = resolveMappingToStandardOrDomainSpecificRole(firstKid.getRole().getValue(), firstKid.getNamespace());
if (resolvedMapping == null || !resolvedMapping.currentRoleIsStandard()) {
Logger logger = LoggerFactory.getLogger(TagStructureContext.class);
String nsStr;
if (firstKid.getNamespace() != null) {
nsStr = firstKid.getNamespace().getNamespaceName();
} else {
nsStr = StandardNamespaces.getDefault();
}
logger.warn(MessageFormat.format(LogMessageConstant.EXISTING_TAG_STRUCTURE_ROOT_IS_NOT_STANDARD, firstKid.getRole().getValue(), nsStr));
}
if (resolvedMapping == null || !StandardNamespaces.PDF_1_7.equals(resolvedMapping.getNamespace().getNamespaceName())) {
documentDefaultNamespace = fetchNamespace(StandardNamespaces.PDF_2_0);
}
} else {
documentDefaultNamespace = fetchNamespace(StandardNamespaces.PDF_2_0);
}
}
private String composeInvalidRoleException(String role, PdfNamespace namespace) {
return composeExceptionBasedOnNamespacePresence(role, namespace,
PdfException.RoleIsNotMappedToAnyStandardRole, PdfException.RoleInNamespaceIsNotMappedToAnyStandardRole);
}
private String composeTooMuchTransitiveMappingsException(String role, PdfNamespace namespace) {
return composeExceptionBasedOnNamespacePresence(role, namespace,
LogMessageConstant.CANNOT_RESOLVE_ROLE_TOO_MUCH_TRANSITIVE_MAPPINGS,
LogMessageConstant.CANNOT_RESOLVE_ROLE_IN_NAMESPACE_TOO_MUCH_TRANSITIVE_MAPPINGS);
}
private void initRegisteredNamespaces() {
PdfStructTreeRoot structTreeRoot = document.getStructTreeRoot();
for (PdfNamespace namespace : structTreeRoot.getNamespaces()) {
namespaces.add(namespace.getPdfObject());
nameToNamespace.put(namespace.getNamespaceName(), namespace);
}
}
private void actualizeNamespacesInStructTreeRoot() {
if (namespaces.size() > 0) {
PdfStructTreeRoot structTreeRoot = getDocument().getStructTreeRoot();
PdfArray rootNamespaces = structTreeRoot.getNamespacesObject();
Set<PdfDictionary> newNamespaces = new LinkedHashSet<>(namespaces);
for (int i = 0; i < rootNamespaces.size(); ++i) {
newNamespaces.remove(rootNamespaces.getAsDictionary(i));
}
for (PdfDictionary newNs : newNamespaces) {
rootNamespaces.add(newNs);
}
if (!newNamespaces.isEmpty()) {
structTreeRoot.setModified();
}
}
}
private void removePageTagFromParent(IStructureNode pageTag, IStructureNode parent) {
if (parent instanceof PdfStructElem) {
PdfStructElem structParent = (PdfStructElem) parent;
if (!structParent.isFlushed()) {
structParent.removeKid(pageTag);
PdfDictionary parentStructDict = structParent.getPdfObject();
if (waitingTagsManager.getObjForStructDict(parentStructDict) == null && parent.getKids().size() == 0
&& !(structParent.getParent() instanceof PdfStructTreeRoot)) {
removePageTagFromParent(structParent, parent.getParent());
PdfIndirectReference indRef = parentStructDict.getIndirectReference();
if (indRef != null) {
// TODO how about possible references to structure element from refs or structure destination for instance?
indRef.setFree();
}
}
} else {
if (pageTag instanceof PdfMcr) {
throw new PdfException(PdfException.CannotRemoveTagBecauseItsParentIsFlushed);
}
}
} else {
// it is StructTreeRoot
// should never happen as we always should have only one root tag and we don't remove it
}
}
private String composeExceptionBasedOnNamespacePresence(String role, PdfNamespace namespace, String withoutNsEx, String withNsEx) {
if (namespace == null) {
return MessageFormat.format(withoutNsEx, role);
} else {
String nsName = namespace.getNamespaceName();
PdfIndirectReference ref = namespace.getPdfObject().getIndirectReference();
if (ref != null) {
nsName = nsName + " (" +
Integer.toString(ref.getObjNumber()) + " " + Integer.toString(ref.getGenNumber()) +
" obj)";
}
return MessageFormat.format(withNsEx, role, nsName);
}
}
}
| {
"pile_set_name": "Github"
} |
/**
******************************************************************************
* File Name : stm32f0xx_hal_msp.c
* Description : This file provides code for the MSP Initialization
* and de-Initialization codes.
******************************************************************************
* This notice applies to any and all portions of this file
* that are not between comment pairs USER CODE BEGIN and
* USER CODE END. Other portions of this file, whether
* inserted by the user or by software development tools
* are owned by their respective copyright owners.
*
* Copyright (c) 2019 STMicroelectronics International N.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted, provided that the following conditions are met:
*
* 1. Redistribution of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of other
* contributors to this software may be used to endorse or promote products
* derived from this software without specific written permission.
* 4. This software, including modifications and/or derivative works of this
* software, must execute solely and exclusively on microcontroller or
* microprocessor devices manufactured by or for STMicroelectronics.
* 5. Redistribution and use of this software other than as permitted under
* this license is void and will automatically terminate your rights under
* this license.
*
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "stm32f0xx_hal.h"
extern void _Error_Handler(char *, int);
/* USER CODE BEGIN 0 */
/* USER CODE END 0 */
void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim);
/**
* Initializes the Global MSP.
*/
void HAL_MspInit(void)
{
/* USER CODE BEGIN MspInit 0 */
/* USER CODE END MspInit 0 */
__HAL_RCC_SYSCFG_CLK_ENABLE();
__HAL_RCC_PWR_CLK_ENABLE();
/* System interrupt init*/
/* SVC_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SVC_IRQn, 0, 0);
/* PendSV_IRQn interrupt configuration */
HAL_NVIC_SetPriority(PendSV_IRQn, 0, 0);
/* SysTick_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
__HAL_REMAP_PIN_ENABLE(HAL_REMAP_PA11_PA12);
/* USER CODE BEGIN MspInit 1 */
/* USER CODE END MspInit 1 */
}
void HAL_SPI_MspInit(SPI_HandleTypeDef* hspi)
{
GPIO_InitTypeDef GPIO_InitStruct;
if(hspi->Instance==SPI1)
{
/* USER CODE BEGIN SPI1_MspInit 0 */
/* USER CODE END SPI1_MspInit 0 */
/* Peripheral clock enable */
__HAL_RCC_SPI1_CLK_ENABLE();
/**SPI1 GPIO Configuration
PA5 ------> SPI1_SCK
PA6 ------> SPI1_MISO
PA7 ------> SPI1_MOSI
*/
GPIO_InitStruct.Pin = GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF0_SPI1;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/* USER CODE BEGIN SPI1_MspInit 1 */
/* USER CODE END SPI1_MspInit 1 */
}
}
void HAL_SPI_MspDeInit(SPI_HandleTypeDef* hspi)
{
if(hspi->Instance==SPI1)
{
/* USER CODE BEGIN SPI1_MspDeInit 0 */
/* USER CODE END SPI1_MspDeInit 0 */
/* Peripheral clock disable */
__HAL_RCC_SPI1_CLK_DISABLE();
/**SPI1 GPIO Configuration
PA5 ------> SPI1_SCK
PA6 ------> SPI1_MISO
PA7 ------> SPI1_MOSI
*/
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7);
/* USER CODE BEGIN SPI1_MspDeInit 1 */
/* USER CODE END SPI1_MspDeInit 1 */
}
}
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* htim_base)
{
if(htim_base->Instance==TIM14)
{
/* USER CODE BEGIN TIM14_MspInit 0 */
/* USER CODE END TIM14_MspInit 0 */
/* Peripheral clock enable */
__HAL_RCC_TIM14_CLK_ENABLE();
/* USER CODE BEGIN TIM14_MspInit 1 */
/* USER CODE END TIM14_MspInit 1 */
}
else if(htim_base->Instance==TIM17)
{
/* USER CODE BEGIN TIM17_MspInit 0 */
/* USER CODE END TIM17_MspInit 0 */
/* Peripheral clock enable */
__HAL_RCC_TIM17_CLK_ENABLE();
/* TIM17 interrupt Init */
HAL_NVIC_SetPriority(TIM17_IRQn, 1, 0);
HAL_NVIC_EnableIRQ(TIM17_IRQn);
/* USER CODE BEGIN TIM17_MspInit 1 */
/* USER CODE END TIM17_MspInit 1 */
}
}
void HAL_TIM_MspPostInit(TIM_HandleTypeDef* htim)
{
GPIO_InitTypeDef GPIO_InitStruct;
if(htim->Instance==TIM14)
{
/* USER CODE BEGIN TIM14_MspPostInit 0 */
/* USER CODE END TIM14_MspPostInit 0 */
/**TIM14 GPIO Configuration
PA4 ------> TIM14_CH1
*/
GPIO_InitStruct.Pin = GPIO_PIN_4;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF4_TIM14;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/* USER CODE BEGIN TIM14_MspPostInit 1 */
/* USER CODE END TIM14_MspPostInit 1 */
}
}
void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* htim_base)
{
if(htim_base->Instance==TIM14)
{
/* USER CODE BEGIN TIM14_MspDeInit 0 */
/* USER CODE END TIM14_MspDeInit 0 */
/* Peripheral clock disable */
__HAL_RCC_TIM14_CLK_DISABLE();
/* USER CODE BEGIN TIM14_MspDeInit 1 */
/* USER CODE END TIM14_MspDeInit 1 */
}
else if(htim_base->Instance==TIM17)
{
/* USER CODE BEGIN TIM17_MspDeInit 0 */
/* USER CODE END TIM17_MspDeInit 0 */
/* Peripheral clock disable */
__HAL_RCC_TIM17_CLK_DISABLE();
/* TIM17 interrupt DeInit */
HAL_NVIC_DisableIRQ(TIM17_IRQn);
/* USER CODE BEGIN TIM17_MspDeInit 1 */
/* USER CODE END TIM17_MspDeInit 1 */
}
}
void HAL_UART_MspInit(UART_HandleTypeDef* huart)
{
GPIO_InitTypeDef GPIO_InitStruct;
if(huart->Instance==USART2)
{
/* USER CODE BEGIN USART2_MspInit 0 */
/* USER CODE END USART2_MspInit 0 */
/* Peripheral clock enable */
__HAL_RCC_USART2_CLK_ENABLE();
/**USART2 GPIO Configuration
PA2 ------> USART2_TX
*/
GPIO_InitStruct.Pin = GPIO_PIN_2;
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF1_USART2;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/* USER CODE BEGIN USART2_MspInit 1 */
/* USER CODE END USART2_MspInit 1 */
}
}
void HAL_UART_MspDeInit(UART_HandleTypeDef* huart)
{
if(huart->Instance==USART2)
{
/* USER CODE BEGIN USART2_MspDeInit 0 */
/* USER CODE END USART2_MspDeInit 0 */
/* Peripheral clock disable */
__HAL_RCC_USART2_CLK_DISABLE();
/**USART2 GPIO Configuration
PA2 ------> USART2_TX
*/
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_2);
/* USER CODE BEGIN USART2_MspDeInit 1 */
/* USER CODE END USART2_MspDeInit 1 */
}
}
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
| {
"pile_set_name": "Github"
} |
#ifndef QTSCRIPTSHELL_QXMLCONTENTHANDLER_H
#define QTSCRIPTSHELL_QXMLCONTENTHANDLER_H
#include <qxml.h>
#include <QtScript/qscriptvalue.h>
#include <__package_shared.h>
class QtScriptShell_QXmlContentHandler : public QXmlContentHandler
{
public:
QtScriptShell_QXmlContentHandler();
~QtScriptShell_QXmlContentHandler();
bool characters(const QString& ch);
bool endDocument();
bool endElement(const QString& namespaceURI, const QString& localName, const QString& qName);
bool endPrefixMapping(const QString& prefix);
QString errorString() const;
bool ignorableWhitespace(const QString& ch);
bool processingInstruction(const QString& target, const QString& data);
void setDocumentLocator(QXmlLocator* locator);
bool skippedEntity(const QString& name);
bool startDocument();
bool startElement(const QString& namespaceURI, const QString& localName, const QString& qName, const QXmlAttributes& atts);
bool startPrefixMapping(const QString& prefix, const QString& uri);
QScriptValue __qtscript_self;
};
#endif // QTSCRIPTSHELL_QXMLCONTENTHANDLER_H
| {
"pile_set_name": "Github"
} |
# ZTE / Vodafone K4201
TargetVendor=0x19d2
TargetProduct=0x0017
StandardEject=1
| {
"pile_set_name": "Github"
} |
# reduce learning rate after 120 epochs (60000 iters) by factor 0f 10
# then another factor of 10 after 10 more epochs (5000 iters)
# The train/test net protocol buffer definition
net: "examples/cifar10/cifar10_full_train_test.prototxt"
# test_iter specifies how many forward passes the test should carry out.
# In the case of CIFAR10, we have test batch size 100 and 100 test iterations,
# covering the full 10,000 testing images.
test_iter: 100
# Carry out testing every 1000 training iterations.
test_interval: 1000
# The base learning rate, momentum and the weight decay of the network.
base_lr: 0.001
momentum: 0.9
weight_decay: 0.004
# The learning rate policy
lr_policy: "fixed"
# Display every 200 iterations
display: 200
# The maximum number of iterations
max_iter: 60000
# snapshot intermediate results
snapshot: 10000
snapshot_format: HDF5
snapshot_prefix: "examples/cifar10/cifar10_full"
# solver mode: CPU or GPU
solver_mode: GPU
| {
"pile_set_name": "Github"
} |
module com.networknt.audit {
exports com.networknt.audit;
requires com.networknt.config;
requires com.networknt.handler;
requires com.networknt.utility;
requires com.networknt.mask;
requires com.fasterxml.jackson.core;
requires org.slf4j;
requires java.logging;
} | {
"pile_set_name": "Github"
} |
/*
Copyright 2017 The Nuclio 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 prometheuspush
import (
"time"
"github.com/nuclio/nuclio/pkg/processor"
"github.com/nuclio/nuclio/pkg/processor/metricsink"
"github.com/nuclio/nuclio/pkg/processor/metricsink/prometheus"
"github.com/nuclio/errors"
"github.com/nuclio/logger"
prometheusclient "github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/push"
)
type MetricSink struct {
*metricsink.AbstractMetricSink
configuration *Configuration
metricRegistry *prometheusclient.Registry
gatherers []prometheus.Gatherer
}
func newMetricSink(parentLogger logger.Logger,
processorConfiguration *processor.Configuration,
configuration *Configuration,
metricProvider metricsink.MetricProvider) (*MetricSink, error) {
loggerInstance := parentLogger.GetChild(configuration.Name)
newAbstractMetricSink, err := metricsink.NewAbstractMetricSink(loggerInstance,
"promethuesPush",
configuration.Name,
metricProvider)
if err != nil {
return nil, errors.Wrap(err, "Failed to create abstract metric sink")
}
newMetricPusher := &MetricSink{
AbstractMetricSink: newAbstractMetricSink,
configuration: configuration,
metricRegistry: prometheusclient.NewRegistry(),
}
// create a bunch of prometheus metrics which we will populate periodically
if err := newMetricPusher.createGatherers(metricProvider); err != nil {
return nil, errors.Wrap(err, "Failed to create gatherers")
}
newMetricPusher.Logger.InfoWith("Created",
"jobName", configuration.JobName,
"instanceName", configuration.InstanceName,
"pushGatewayURL", configuration.URL,
"pushInterval", configuration.Interval)
return newMetricPusher, nil
}
func (ms *MetricSink) Start() error {
if !*ms.configuration.Enabled {
ms.Logger.DebugWith("Disabled, not starting")
return nil
}
// push in the background
go ms.pushPeriodically()
return nil
}
func (ms *MetricSink) pushPeriodically() {
// set when stop() is called and channel is closed
done := false
defer close(ms.StoppedChannel)
ms.Logger.DebugWith("Pushing periodically",
"interval", ms.configuration.parsedInterval,
"target", ms.configuration.URL)
for !done {
select {
case <-time.After(ms.configuration.parsedInterval):
// gather the metrics from the triggers - this will update the metrics
// from counters internally held by triggers and their child objects
if err := ms.gather(); err != nil {
ms.Logger.WarnWith("Failed to gather metrics", "err", err)
continue
}
// Add is used here rather than Put to not delete a
// previously pushed success timestamp in case of a failure of this backup.
if err := push.New(ms.configuration.URL, ms.configuration.JobName).Gatherer(ms.metricRegistry).Add(); err != nil {
ms.Logger.WarnWith("Failed to push metrics", "err", err)
}
case <-ms.StopChannel:
done = true
}
}
}
func (ms *MetricSink) createGatherers(metricProvider metricsink.MetricProvider) error {
for _, trigger := range metricProvider.GetTriggers() {
// create a gatherer for the trigger
triggerGatherer, err := prometheus.NewTriggerGatherer(ms.configuration.InstanceName,
trigger,
ms.Logger,
ms.metricRegistry)
if err != nil {
return errors.Wrap(err, "Failed to create trigger gatherer")
}
ms.gatherers = append(ms.gatherers, triggerGatherer)
// now add workers
for _, worker := range trigger.GetWorkers() {
workerGatherer, err := prometheus.NewWorkerGatherer(ms.configuration.InstanceName,
trigger,
ms.Logger,
worker,
ms.metricRegistry)
if err != nil {
return errors.Wrap(err, "Failed to create worker gatherer")
}
ms.gatherers = append(ms.gatherers, workerGatherer)
}
}
return nil
}
func (ms *MetricSink) gather() error {
for _, gatherer := range ms.gatherers {
if err := gatherer.Gather(); err != nil {
return err
}
}
return nil
}
| {
"pile_set_name": "Github"
} |
package burp;
/*
* @(#)IBurpExtender.java
*
* Copyright PortSwigger Ltd. All rights reserved.
*
* This code may be used to extend the functionality of Burp Suite and Burp
* Suite Professional, provided that this usage does not violate the
* license terms for those products.
*/
/**
* This interface allows third-party code to extend Burp Suite's functionality.
*
* Implementations must be called BurpExtender, in the package burp,
* must be declared public, and must provide a default (public, no-argument)
* constructor. On startup, Burp Suite searches its classpath for the class
* burp.BurpExtender, and attempts to dynamically load and instantiate this
* class. The <code>IBurpExtender</code> methods implemented will then be
* dynamically invoked as appropriate.<p>
*
* Partial implementations are acceptable. The class will be used provided at
* least one of the interface's methods is implemented.<p>
*
* To make use of the interface, create a class called BurpExtender, in the
* package burp, which implements one or more methods of the interface, and
* place this into the application's classpath at startup. For example, if
* Burp Suite is loaded from burp.jar, and BurpProxyExtender.jar contains the
* class burp.BurpExtender, use the following command to launch Burp Suite and
* load the IBurpExtender implementation:<p>
*
* <PRE> java -classpath burp.jar;BurpProxyExtender.jar burp.StartBurp</PRE>
*
* (On Linux-based platforms, use a colon character instead of the semi-colon
* as the classpath separator.)
*/
public interface IBurpExtender
{
/**
* This method is invoked immediately after the implementation's constructor
* to pass any command-line arguments that were passed to Burp Suite on
* startup. It allows implementations to control aspects of their behaviour
* at runtime by defining their own command-line arguments.
*
* @param args The command-line arguments passed to Burp Suite on startup.
*/
public void setCommandLineArgs(String[] args);
/**
* This method is invoked by Burp Proxy whenever a client request or server
* response is received. It allows implementations to perform logging
* functions, modify the message, specify an action (intercept, drop, etc.)
* and perform any other arbitrary processing.
*
* @param messageReference An identifier which is unique to a single
* request/response pair. This can be used to correlate details of requests
* and responses and perform processing on the response message accordingly.
* @param messageIsRequest Flags whether the message is a client request or
* a server response.
* @param remoteHost The hostname of the remote HTTP server.
* @param remotePort The port of the remote HTTP server.
* @param serviceIsHttps Flags whether the protocol is HTTPS or HTTP.
* @param httpMethod The method verb used in the client request.
* @param url The requested URL.
* @param resourceType The filetype of the requested resource, or a
* zero-length string if the resource has no filetype.
* @param statusCode The HTTP status code returned by the server. This value
* is <code>null</code> for request messages.
* @param responseContentType The content-type string returned by the
* server. This value is <code>null</code> for request messages.
* @param message The full HTTP message.
* @param action An array containing a single integer, allowing the
* implementation to communicate back to Burp Proxy a non-default
* interception action for the message. The default value is
* <code>ACTION_FOLLOW_RULES</code>. Set <code>action[0]</code> to one of
* the other possible values to perform a different action.
* @return Implementations should return either (a) the same object received
* in the <code>message</code> paramater, or (b) a different object
* containing a modified message.
*/
public byte[] processProxyMessage(
int messageReference,
boolean messageIsRequest,
String remoteHost,
int remotePort,
boolean serviceIsHttps,
String httpMethod,
String url,
String resourceType,
String statusCode,
String responseContentType,
byte[] message,
int[] action);
/**
* Causes Burp Proxy to follow the current interception rules to determine
* the appropriate action to take for the message.
*/
public final static int ACTION_FOLLOW_RULES = 0;
/**
* Causes Burp Proxy to present the message to the user for manual
* review or modification.
*/
public final static int ACTION_DO_INTERCEPT = 1;
/**
* Causes Burp Proxy to forward the message to the remote server or client.
*/
public final static int ACTION_DONT_INTERCEPT = 2;
/**
* Causes Burp Proxy to drop the message and close the client connection.
*/
public final static int ACTION_DROP = 3;
/**
* Causes Burp Proxy to follow the current interception rules to determine
* the appropriate action to take for the message, and then make a second
* call to processProxyMessage.
*/
public final static int ACTION_FOLLOW_RULES_AND_REHOOK = 0x10;
/**
* Causes Burp Proxy to present the message to the user for manual
* review or modification, and then make a second call to
* processProxyMessage.
*/
public final static int ACTION_DO_INTERCEPT_AND_REHOOK = 0x11;
/**
* Causes Burp Proxy to skip user interception, and then make a second call
* to processProxyMessage.
*/
public final static int ACTION_DONT_INTERCEPT_AND_REHOOK = 0x12;
/**
* This method is invoked on startup. It registers an instance of the
* <code>IBurpExtenderCallbacks</code> interface, providing methods that
* may be invoked by the implementation to perform various actions.
*
* The call to registerExtenderCallbacks need not return, and
* implementations may use the invoking thread for any purpose.<p>
*
* @param callbacks An implementation of the
* <code>IBurpExtenderCallbacks</code> interface.
*/
public void registerExtenderCallbacks(burp.IBurpExtenderCallbacks callbacks);
/**
* This method is invoked immediately before Burp Suite exits.
* It allows implementations to carry out any clean-up actions necessary
* (e.g. flushing log files or closing database resources).
*/
public void applicationClosing();
/**
* This method is invoked whenever any of Burp's tools makes an HTTP request
* or receives a response. It allows extensions to intercept and modify the
* HTTP traffic of all Burp tools. For each request, the method is invoked
* after the request has been fully processed by the invoking tool and is
* about to be made on the network. For each response, the method is invoked
* after the response has been received from the network and before any
* processing is performed by the invoking tool.
*
* @param toolName The name of the Burp tool which is making the request.
* @param messageIsRequest Indicates whether the message is a request or
* response.
* @param messageInfo Details of the HTTP message.
*/
public void processHttpMessage(
String toolName,
boolean messageIsRequest,
IHttpRequestResponse messageInfo);
/**
* This method is invoked whenever Burp Scanner discovers a new, unique
* issue, and can be used to perform customised reporting or logging of issues.
*
* @param issue Details of the new scan issue.
*/
public void newScanIssue(IScanIssue issue);
}
| {
"pile_set_name": "Github"
} |
<?php
class Danslo_ApiImport_Model_Image extends Varien_Image
{
/**
* Destruct
*/
public function __destruct()
{
$adpater = $this->_getAdapter();
if ($adpater instanceof Varien_Image_Adapter_Gd2) {
$adpater->destruct();
}
}
} | {
"pile_set_name": "Github"
} |
Prism.languages.haxe = Prism.languages.extend('clike', {
// Strings can be multi-line
'string': {
pattern: /(["'])(?:(?!\1)[^\\]|\\[\s\S])*\1/,
greedy: true,
inside: {
'interpolation': {
pattern: /(^|[^\\])\$(?:\w+|\{[^}]+\})/,
lookbehind: true,
inside: {
'interpolation': {
pattern: /^\$\w*/,
alias: 'variable'
}
// See rest below
}
}
}
},
// The final look-ahead prevents highlighting of keywords if expressions such as "haxe.macro.Expr"
'keyword': /\bthis\b|\b(?:abstract|as|break|case|cast|catch|class|continue|default|do|dynamic|else|enum|extends|extern|from|for|function|if|implements|import|in|inline|interface|macro|new|null|override|public|private|return|static|super|switch|throw|to|try|typedef|using|var|while)(?!\.)\b/,
'operator': /\.{3}|\+\+?|-[->]?|[=!]=?|&&?|\|\|?|<[<=]?|>[>=]?|[*\/%~^]/
});
Prism.languages.insertBefore('haxe', 'class-name', {
'regex': {
pattern: /~\/(?:[^\/\\\r\n]|\\.)+\/[igmsu]*/,
greedy: true
}
});
Prism.languages.insertBefore('haxe', 'keyword', {
'preprocessor': {
pattern: /#\w+/,
alias: 'builtin'
},
'metadata': {
pattern: /@:?\w+/,
alias: 'symbol'
},
'reification': {
pattern: /\$(?:\w+|(?=\{))/,
alias: 'variable'
}
});
Prism.languages.haxe['string'].inside['interpolation'].inside.rest = Prism.languages.haxe;
delete Prism.languages.haxe['class-name']; | {
"pile_set_name": "Github"
} |
/* Localized versions of Info.plist keys */
| {
"pile_set_name": "Github"
} |
// Override for host defined _OSI to handle "Darwin"...
// In config ACPI, OSID renamed XSID
// Find: 4F534944
// Replace: 58534944
// TgtBridge:no
//
// In config ACPI, _OSI renamed XOSI
// Find: 5F4F5349
// Replace: 584F5349
// TgtBridge:no
// Search "_OSI" in Method (_INI....
#ifndef NO_DEFINITIONBLOCK
DefinitionBlock("", "SSDT", 2, "hack", "XOSI", 0)
{
#endif
Method(XOSI, 1)
{
Local0 = Package()
{
"Windows", // generic Windows query
"Windows 2001", // Windows XP
"Windows 2001 SP1", // Windows XP SP1
"Windows 2001 SP2", // Windows XP SP2
"Windows 2001.1", // Windows Server 2003
"Windows 2001.1 SP1", // Windows Server 2003 SP1
"Windows 2006", // Windows Vista
"Windows 2006 SP1", // Windows Vista SP1
"Windows 2006.1", // Windows Server 2008
"Windows 2009", // Windows 7/Windows Server 2008 R2
}
Return (Ones != Match(Local0, MEQ, Arg0, MTR, 0, 0))
}
#ifndef NO_DEFINITIONBLOCK
}
#endif
//EOF | {
"pile_set_name": "Github"
} |
/* Generated by RuntimeBrowser
Image: /System/Library/PrivateFrameworks/CallHistory.framework/CallHistory
*/
@interface NotificationSender : NSObject {
NSString * _name;
NSDictionary * _userInfo;
}
@property (readonly) NSString *name;
@property (retain) NSDictionary *userInfo;
- (void).cxx_destruct;
- (void)dealloc;
- (id)initWithName:(id)arg1;
- (id)name;
- (void)setUserInfo:(id)arg1;
- (id)userInfo;
@end
| {
"pile_set_name": "Github"
} |
////////////////////////////////////////////////////////////////////////////////
//
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
//Theme variables (Flat/No Flat - Dark/Light - Primary/Secondary/Emphasized Color
$flat: false
$dark: false
$emphasized-color: $violet | {
"pile_set_name": "Github"
} |
#include "dm.h"
/*
* The kobject release method must not be placed in the module itself,
* otherwise we are subject to module unload races.
*
* The release method is called when the last reference to the kobject is
* dropped. It may be called by any other kernel code that drops the last
* reference.
*
* The release method suffers from module unload race. We may prevent the
* module from being unloaded at the start of the release method (using
* increased module reference count or synchronizing against the release
* method), however there is no way to prevent the module from being
* unloaded at the end of the release method.
*
* If this code were placed in the dm module, the following race may
* happen:
* 1. Some other process takes a reference to dm kobject
* 2. The user issues ioctl function to unload the dm device
* 3. dm_sysfs_exit calls kobject_put, however the object is not released
* because of the other reference taken at step 1
* 4. dm_sysfs_exit waits on the completion
* 5. The other process that took the reference in step 1 drops it,
* dm_kobject_release is called from this process
* 6. dm_kobject_release calls complete()
* 7. a reschedule happens before dm_kobject_release returns
* 8. dm_sysfs_exit continues, the dm device is unloaded, module reference
* count is decremented
* 9. The user unloads the dm module
* 10. The other process that was rescheduled in step 7 continues to run,
* it is now executing code in unloaded module, so it crashes
*
* Note that if the process that takes the foreign reference to dm kobject
* has a low priority and the system is sufficiently loaded with
* higher-priority processes that prevent the low-priority process from
* being scheduled long enough, this bug may really happen.
*
* In order to fix this module unload race, we place the release method
* into a helper code that is compiled directly into the kernel.
*/
void dm_kobject_release(struct kobject *kobj)
{
complete(dm_get_completion_from_kobject(kobj));
}
EXPORT_SYMBOL(dm_kobject_release);
| {
"pile_set_name": "Github"
} |
/*
* jdapistd.c
*
* Copyright (C) 1994-1996, Thomas G. Lane.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
* This file contains application interface code for the decompression half
* of the JPEG library. These are the "standard" API routines that are
* used in the normal full-decompression case. They are not used by a
* transcoding-only application. Note that if an application links in
* jpeg_start_decompress, it will end up linking in the entire decompressor.
* We thus must separate this file from jdapimin.c to avoid linking the
* whole decompression library into a transcoder.
*/
#define JPEG_INTERNALS
#include "jinclude.h"
#include "jpeglib.h"
/* Forward declarations */
LOCAL(boolean) output_pass_setup JPP((j_decompress_ptr cinfo));
/*
* Decompression initialization.
* jpeg_read_header must be completed before calling this.
*
* If a multipass operating mode was selected, this will do all but the
* last pass, and thus may take a great deal of time.
*
* Returns FALSE if suspended. The return value need be inspected only if
* a suspending data source is used.
*/
GLOBAL(boolean)
jpeg_start_decompress (j_decompress_ptr cinfo)
{
if (cinfo->global_state == DSTATE_READY) {
/* First call: initialize master control, select active modules */
jinit_master_decompress(cinfo);
if (cinfo->buffered_image) {
/* No more work here; expecting jpeg_start_output next */
cinfo->global_state = DSTATE_BUFIMAGE;
return TRUE;
}
cinfo->global_state = DSTATE_PRELOAD;
}
if (cinfo->global_state == DSTATE_PRELOAD) {
/* If file has multiple scans, absorb them all into the coef buffer */
if (cinfo->inputctl->has_multiple_scans) {
#ifdef D_MULTISCAN_FILES_SUPPORTED
for (;;) {
int retcode;
/* Call progress monitor hook if present */
if (cinfo->progress != NULL)
(*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
/* Absorb some more input */
retcode = (*cinfo->inputctl->consume_input) (cinfo);
if (retcode == JPEG_SUSPENDED)
return FALSE;
if (retcode == JPEG_REACHED_EOI)
break;
/* Advance progress counter if appropriate */
if (cinfo->progress != NULL &&
(retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) {
if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) {
/* jdmaster underestimated number of scans; ratchet up one scan */
cinfo->progress->pass_limit += (long) cinfo->total_iMCU_rows;
}
}
}
#else
ERREXIT(cinfo, JERR_NOT_COMPILED);
#endif /* D_MULTISCAN_FILES_SUPPORTED */
}
cinfo->output_scan_number = cinfo->input_scan_number;
} else if (cinfo->global_state != DSTATE_PRESCAN)
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
/* Perform any dummy output passes, and set up for the final pass */
return output_pass_setup(cinfo);
}
/*
* Set up for an output pass, and perform any dummy pass(es) needed.
* Common subroutine for jpeg_start_decompress and jpeg_start_output.
* Entry: global_state = DSTATE_PRESCAN only if previously suspended.
* Exit: If done, returns TRUE and sets global_state for proper output mode.
* If suspended, returns FALSE and sets global_state = DSTATE_PRESCAN.
*/
LOCAL(boolean)
output_pass_setup (j_decompress_ptr cinfo)
{
if (cinfo->global_state != DSTATE_PRESCAN) {
/* First call: do pass setup */
(*cinfo->master->prepare_for_output_pass) (cinfo);
cinfo->output_scanline = 0;
cinfo->global_state = DSTATE_PRESCAN;
}
/* Loop over any required dummy passes */
while (cinfo->master->is_dummy_pass) {
#ifdef QUANT_2PASS_SUPPORTED
/* Crank through the dummy pass */
while (cinfo->output_scanline < cinfo->output_height) {
JDIMENSION last_scanline;
/* Call progress monitor hook if present */
if (cinfo->progress != NULL) {
cinfo->progress->pass_counter = (long) cinfo->output_scanline;
cinfo->progress->pass_limit = (long) cinfo->output_height;
(*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
}
/* Process some data */
last_scanline = cinfo->output_scanline;
(*cinfo->main->process_data) (cinfo, (JSAMPARRAY) NULL,
&cinfo->output_scanline, (JDIMENSION) 0);
if (cinfo->output_scanline == last_scanline)
return FALSE; /* No progress made, must suspend */
}
/* Finish up dummy pass, and set up for another one */
(*cinfo->master->finish_output_pass) (cinfo);
(*cinfo->master->prepare_for_output_pass) (cinfo);
cinfo->output_scanline = 0;
#else
ERREXIT(cinfo, JERR_NOT_COMPILED);
#endif /* QUANT_2PASS_SUPPORTED */
}
/* Ready for application to drive output pass through
* jpeg_read_scanlines or jpeg_read_raw_data.
*/
cinfo->global_state = cinfo->raw_data_out ? DSTATE_RAW_OK : DSTATE_SCANNING;
return TRUE;
}
/*
* Read some scanlines of data from the JPEG decompressor.
*
* The return value will be the number of lines actually read.
* This may be less than the number requested in several cases,
* including bottom of image, data source suspension, and operating
* modes that emit multiple scanlines at a time.
*
* Note: we warn about excess calls to jpeg_read_scanlines() since
* this likely signals an application programmer error. However,
* an oversize buffer (max_lines > scanlines remaining) is not an error.
*/
GLOBAL(JDIMENSION)
jpeg_read_scanlines (j_decompress_ptr cinfo, JSAMPARRAY scanlines,
JDIMENSION max_lines)
{
JDIMENSION row_ctr;
if (cinfo->global_state != DSTATE_SCANNING)
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
if (cinfo->output_scanline >= cinfo->output_height) {
WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
return 0;
}
/* Call progress monitor hook if present */
if (cinfo->progress != NULL) {
cinfo->progress->pass_counter = (long) cinfo->output_scanline;
cinfo->progress->pass_limit = (long) cinfo->output_height;
(*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
}
/* Process some data */
row_ctr = 0;
(*cinfo->main->process_data) (cinfo, scanlines, &row_ctr, max_lines);
cinfo->output_scanline += row_ctr;
return row_ctr;
}
/*
* Alternate entry point to read raw data.
* Processes exactly one iMCU row per call, unless suspended.
*/
GLOBAL(JDIMENSION)
jpeg_read_raw_data (j_decompress_ptr cinfo, JSAMPIMAGE data,
JDIMENSION max_lines)
{
JDIMENSION lines_per_iMCU_row;
if (cinfo->global_state != DSTATE_RAW_OK)
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
if (cinfo->output_scanline >= cinfo->output_height) {
WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
return 0;
}
/* Call progress monitor hook if present */
if (cinfo->progress != NULL) {
cinfo->progress->pass_counter = (long) cinfo->output_scanline;
cinfo->progress->pass_limit = (long) cinfo->output_height;
(*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
}
/* Verify that at least one iMCU row can be returned. */
lines_per_iMCU_row = cinfo->max_v_samp_factor * cinfo->min_DCT_scaled_size;
if (max_lines < lines_per_iMCU_row)
ERREXIT(cinfo, JERR_BUFFER_SIZE);
/* Decompress directly into user's buffer. */
if (! (*cinfo->coef->decompress_data) (cinfo, data))
return 0; /* suspension forced, can do nothing more */
/* OK, we processed one iMCU row. */
cinfo->output_scanline += lines_per_iMCU_row;
return lines_per_iMCU_row;
}
/* Additional entry points for buffered-image mode. */
#ifdef D_MULTISCAN_FILES_SUPPORTED
/*
* Initialize for an output pass in buffered-image mode.
*/
GLOBAL(boolean)
jpeg_start_output (j_decompress_ptr cinfo, int scan_number)
{
if (cinfo->global_state != DSTATE_BUFIMAGE &&
cinfo->global_state != DSTATE_PRESCAN)
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
/* Limit scan number to valid range */
if (scan_number <= 0)
scan_number = 1;
if (cinfo->inputctl->eoi_reached &&
scan_number > cinfo->input_scan_number)
scan_number = cinfo->input_scan_number;
cinfo->output_scan_number = scan_number;
/* Perform any dummy output passes, and set up for the real pass */
return output_pass_setup(cinfo);
}
/*
* Finish up after an output pass in buffered-image mode.
*
* Returns FALSE if suspended. The return value need be inspected only if
* a suspending data source is used.
*/
GLOBAL(boolean)
jpeg_finish_output (j_decompress_ptr cinfo)
{
if ((cinfo->global_state == DSTATE_SCANNING ||
cinfo->global_state == DSTATE_RAW_OK) && cinfo->buffered_image) {
/* Terminate this pass. */
/* We do not require the whole pass to have been completed. */
(*cinfo->master->finish_output_pass) (cinfo);
cinfo->global_state = DSTATE_BUFPOST;
} else if (cinfo->global_state != DSTATE_BUFPOST) {
/* BUFPOST = repeat call after a suspension, anything else is error */
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
}
/* Read markers looking for SOS or EOI */
while (cinfo->input_scan_number <= cinfo->output_scan_number &&
! cinfo->inputctl->eoi_reached) {
if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
return FALSE; /* Suspend, come back later */
}
cinfo->global_state = DSTATE_BUFIMAGE;
return TRUE;
}
#endif /* D_MULTISCAN_FILES_SUPPORTED */
| {
"pile_set_name": "Github"
} |
{
"name": "eve-raphael",
"description": "Simple custom events",
"main": "./eve.js",
"authors": [
"Tomas Alabes (http://tomasalabes.me)"
],
"license": "MIT",
"homepage": "https://github.com/tomasAlabes/eve",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
]
}
| {
"pile_set_name": "Github"
} |
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _LINUX_MSDOS_FS_H
#define _LINUX_MSDOS_FS_H
#include <uapi/linux/msdos_fs.h>
/* media of boot sector */
static inline int fat_valid_media(u8 media)
{
return 0xf8 <= media || media == 0xf0;
}
#endif /* !_LINUX_MSDOS_FS_H */
| {
"pile_set_name": "Github"
} |
/* eslint-disable jsx-a11y/click-events-have-key-events */
/**
* External dependencies
*/
import React from 'react';
import PureRenderMixin from 'react-pure-render/mixin';
import createReactClass from 'create-react-class';
/**
* Internal dependencies
*/
import ButtonGroup from 'components/button-group';
import Button from 'components/button';
import Card from 'components/card';
import Gridicon from 'components/gridicon';
const Buttons = createReactClass( {
displayName: 'ButtonGroup',
mixins: [ PureRenderMixin ],
getInitialState: function () {
return {
compact: false,
};
},
toggleButtons: function () {
this.setState( { compact: ! this.state.compact } );
},
render: function () {
return (
<div>
<a
className="docs__design-toggle button"
role="button"
tabIndex={ 0 }
onClick={ this.toggleButtons }
>
{ this.state.compact ? 'Normal Buttons' : 'Compact Buttons' }
</a>
<Card>
<div className="docs__design-button-row">
<ButtonGroup>
<Button compact={ this.state.compact }>Do thing</Button>
<Button compact={ this.state.compact }>Do another thing</Button>
</ButtonGroup>
</div>
<div className="docs__design-button-row">
<ButtonGroup>
<Button compact={ this.state.compact }>Button one</Button>
<Button compact={ this.state.compact }>Button two</Button>
<Button compact={ this.state.compact } scary>
Button Three
</Button>
</ButtonGroup>
</div>
<div className="docs__design-button-row">
<ButtonGroup>
<Button compact={ this.state.compact }>
<Gridicon icon="add-image" />
</Button>
<Button compact={ this.state.compact }>
<Gridicon icon="heart" />
</Button>
<Button compact={ this.state.compact }>
<Gridicon icon="briefcase" />
</Button>
<Button compact={ this.state.compact }>
<Gridicon icon="history" />
</Button>
</ButtonGroup>
</div>
<div className="docs__design-button-row">
<ButtonGroup>
<Button primary compact={ this.state.compact }>
Publish
</Button>
<Button primary compact={ this.state.compact }>
<Gridicon icon="calendar" />
</Button>
</ButtonGroup>
</div>
</Card>
</div>
);
},
} );
export default Buttons;
| {
"pile_set_name": "Github"
} |
var tagName = config.tagName,
attrName = config.attrName;
matches.forEach(function(m)
{
// Create a zero-width start tag right before the address
var startTag = addStartTag(tagName, m[0][1], 0);
startTag.setAttribute(attrName, m[0][0]);
// Create a zero-width end tag right after the address
var endTag = addEndTag(tagName, m[0][1] + m[0][0].length, 0);
// Pair the tags together
startTag.pairWith(endTag);
}); | {
"pile_set_name": "Github"
} |
// SPDX-License-Identifier: GPL-2.0
/*
* Counter driver for the ACCES 104-QUAD-8
* Copyright (C) 2016 William Breathitt Gray
*
* This driver supports the ACCES 104-QUAD-8 and ACCES 104-QUAD-4.
*/
#include <linux/bitops.h>
#include <linux/counter.h>
#include <linux/device.h>
#include <linux/errno.h>
#include <linux/iio/iio.h>
#include <linux/iio/types.h>
#include <linux/io.h>
#include <linux/ioport.h>
#include <linux/isa.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/types.h>
#define QUAD8_EXTENT 32
static unsigned int base[max_num_isa_dev(QUAD8_EXTENT)];
static unsigned int num_quad8;
module_param_array(base, uint, &num_quad8, 0);
MODULE_PARM_DESC(base, "ACCES 104-QUAD-8 base addresses");
#define QUAD8_NUM_COUNTERS 8
/**
* struct quad8_iio - IIO device private data structure
* @counter: instance of the counter_device
* @preset: array of preset values
* @count_mode: array of count mode configurations
* @quadrature_mode: array of quadrature mode configurations
* @quadrature_scale: array of quadrature mode scale configurations
* @ab_enable: array of A and B inputs enable configurations
* @preset_enable: array of set_to_preset_on_index attribute configurations
* @synchronous_mode: array of index function synchronous mode configurations
* @index_polarity: array of index function polarity configurations
* @base: base port address of the IIO device
*/
struct quad8_iio {
struct mutex lock;
struct counter_device counter;
unsigned int preset[QUAD8_NUM_COUNTERS];
unsigned int count_mode[QUAD8_NUM_COUNTERS];
unsigned int quadrature_mode[QUAD8_NUM_COUNTERS];
unsigned int quadrature_scale[QUAD8_NUM_COUNTERS];
unsigned int ab_enable[QUAD8_NUM_COUNTERS];
unsigned int preset_enable[QUAD8_NUM_COUNTERS];
unsigned int synchronous_mode[QUAD8_NUM_COUNTERS];
unsigned int index_polarity[QUAD8_NUM_COUNTERS];
unsigned int base;
};
#define QUAD8_REG_CHAN_OP 0x11
#define QUAD8_REG_INDEX_INPUT_LEVELS 0x16
/* Borrow Toggle flip-flop */
#define QUAD8_FLAG_BT BIT(0)
/* Carry Toggle flip-flop */
#define QUAD8_FLAG_CT BIT(1)
/* Error flag */
#define QUAD8_FLAG_E BIT(4)
/* Up/Down flag */
#define QUAD8_FLAG_UD BIT(5)
/* Reset and Load Signal Decoders */
#define QUAD8_CTR_RLD 0x00
/* Counter Mode Register */
#define QUAD8_CTR_CMR 0x20
/* Input / Output Control Register */
#define QUAD8_CTR_IOR 0x40
/* Index Control Register */
#define QUAD8_CTR_IDR 0x60
/* Reset Byte Pointer (three byte data pointer) */
#define QUAD8_RLD_RESET_BP 0x01
/* Reset Counter */
#define QUAD8_RLD_RESET_CNTR 0x02
/* Reset Borrow Toggle, Carry Toggle, Compare Toggle, and Sign flags */
#define QUAD8_RLD_RESET_FLAGS 0x04
/* Reset Error flag */
#define QUAD8_RLD_RESET_E 0x06
/* Preset Register to Counter */
#define QUAD8_RLD_PRESET_CNTR 0x08
/* Transfer Counter to Output Latch */
#define QUAD8_RLD_CNTR_OUT 0x10
#define QUAD8_CHAN_OP_ENABLE_COUNTERS 0x00
#define QUAD8_CHAN_OP_RESET_COUNTERS 0x01
#define QUAD8_CMR_QUADRATURE_X1 0x08
#define QUAD8_CMR_QUADRATURE_X2 0x10
#define QUAD8_CMR_QUADRATURE_X4 0x18
static int quad8_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan, int *val, int *val2, long mask)
{
struct quad8_iio *const priv = iio_priv(indio_dev);
const int base_offset = priv->base + 2 * chan->channel;
unsigned int flags;
unsigned int borrow;
unsigned int carry;
int i;
switch (mask) {
case IIO_CHAN_INFO_RAW:
if (chan->type == IIO_INDEX) {
*val = !!(inb(priv->base + QUAD8_REG_INDEX_INPUT_LEVELS)
& BIT(chan->channel));
return IIO_VAL_INT;
}
flags = inb(base_offset + 1);
borrow = flags & QUAD8_FLAG_BT;
carry = !!(flags & QUAD8_FLAG_CT);
/* Borrow XOR Carry effectively doubles count range */
*val = (borrow ^ carry) << 24;
mutex_lock(&priv->lock);
/* Reset Byte Pointer; transfer Counter to Output Latch */
outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP | QUAD8_RLD_CNTR_OUT,
base_offset + 1);
for (i = 0; i < 3; i++)
*val |= (unsigned int)inb(base_offset) << (8 * i);
mutex_unlock(&priv->lock);
return IIO_VAL_INT;
case IIO_CHAN_INFO_ENABLE:
*val = priv->ab_enable[chan->channel];
return IIO_VAL_INT;
case IIO_CHAN_INFO_SCALE:
*val = 1;
*val2 = priv->quadrature_scale[chan->channel];
return IIO_VAL_FRACTIONAL_LOG2;
}
return -EINVAL;
}
static int quad8_write_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan, int val, int val2, long mask)
{
struct quad8_iio *const priv = iio_priv(indio_dev);
const int base_offset = priv->base + 2 * chan->channel;
int i;
unsigned int ior_cfg;
switch (mask) {
case IIO_CHAN_INFO_RAW:
if (chan->type == IIO_INDEX)
return -EINVAL;
/* Only 24-bit values are supported */
if ((unsigned int)val > 0xFFFFFF)
return -EINVAL;
mutex_lock(&priv->lock);
/* Reset Byte Pointer */
outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP, base_offset + 1);
/* Counter can only be set via Preset Register */
for (i = 0; i < 3; i++)
outb(val >> (8 * i), base_offset);
/* Transfer Preset Register to Counter */
outb(QUAD8_CTR_RLD | QUAD8_RLD_PRESET_CNTR, base_offset + 1);
/* Reset Byte Pointer */
outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP, base_offset + 1);
/* Set Preset Register back to original value */
val = priv->preset[chan->channel];
for (i = 0; i < 3; i++)
outb(val >> (8 * i), base_offset);
/* Reset Borrow, Carry, Compare, and Sign flags */
outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_FLAGS, base_offset + 1);
/* Reset Error flag */
outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_E, base_offset + 1);
mutex_unlock(&priv->lock);
return 0;
case IIO_CHAN_INFO_ENABLE:
/* only boolean values accepted */
if (val < 0 || val > 1)
return -EINVAL;
mutex_lock(&priv->lock);
priv->ab_enable[chan->channel] = val;
ior_cfg = val | priv->preset_enable[chan->channel] << 1;
/* Load I/O control configuration */
outb(QUAD8_CTR_IOR | ior_cfg, base_offset + 1);
mutex_unlock(&priv->lock);
return 0;
case IIO_CHAN_INFO_SCALE:
mutex_lock(&priv->lock);
/* Quadrature scaling only available in quadrature mode */
if (!priv->quadrature_mode[chan->channel] &&
(val2 || val != 1)) {
mutex_unlock(&priv->lock);
return -EINVAL;
}
/* Only three gain states (1, 0.5, 0.25) */
if (val == 1 && !val2)
priv->quadrature_scale[chan->channel] = 0;
else if (!val)
switch (val2) {
case 500000:
priv->quadrature_scale[chan->channel] = 1;
break;
case 250000:
priv->quadrature_scale[chan->channel] = 2;
break;
default:
mutex_unlock(&priv->lock);
return -EINVAL;
}
else {
mutex_unlock(&priv->lock);
return -EINVAL;
}
mutex_unlock(&priv->lock);
return 0;
}
return -EINVAL;
}
static const struct iio_info quad8_info = {
.read_raw = quad8_read_raw,
.write_raw = quad8_write_raw
};
static ssize_t quad8_read_preset(struct iio_dev *indio_dev, uintptr_t private,
const struct iio_chan_spec *chan, char *buf)
{
const struct quad8_iio *const priv = iio_priv(indio_dev);
return snprintf(buf, PAGE_SIZE, "%u\n", priv->preset[chan->channel]);
}
static ssize_t quad8_write_preset(struct iio_dev *indio_dev, uintptr_t private,
const struct iio_chan_spec *chan, const char *buf, size_t len)
{
struct quad8_iio *const priv = iio_priv(indio_dev);
const int base_offset = priv->base + 2 * chan->channel;
unsigned int preset;
int ret;
int i;
ret = kstrtouint(buf, 0, &preset);
if (ret)
return ret;
/* Only 24-bit values are supported */
if (preset > 0xFFFFFF)
return -EINVAL;
mutex_lock(&priv->lock);
priv->preset[chan->channel] = preset;
/* Reset Byte Pointer */
outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP, base_offset + 1);
/* Set Preset Register */
for (i = 0; i < 3; i++)
outb(preset >> (8 * i), base_offset);
mutex_unlock(&priv->lock);
return len;
}
static ssize_t quad8_read_set_to_preset_on_index(struct iio_dev *indio_dev,
uintptr_t private, const struct iio_chan_spec *chan, char *buf)
{
const struct quad8_iio *const priv = iio_priv(indio_dev);
return snprintf(buf, PAGE_SIZE, "%u\n",
!priv->preset_enable[chan->channel]);
}
static ssize_t quad8_write_set_to_preset_on_index(struct iio_dev *indio_dev,
uintptr_t private, const struct iio_chan_spec *chan, const char *buf,
size_t len)
{
struct quad8_iio *const priv = iio_priv(indio_dev);
const int base_offset = priv->base + 2 * chan->channel + 1;
bool preset_enable;
int ret;
unsigned int ior_cfg;
ret = kstrtobool(buf, &preset_enable);
if (ret)
return ret;
/* Preset enable is active low in Input/Output Control register */
preset_enable = !preset_enable;
mutex_lock(&priv->lock);
priv->preset_enable[chan->channel] = preset_enable;
ior_cfg = priv->ab_enable[chan->channel] |
(unsigned int)preset_enable << 1;
/* Load I/O control configuration to Input / Output Control Register */
outb(QUAD8_CTR_IOR | ior_cfg, base_offset);
mutex_unlock(&priv->lock);
return len;
}
static const char *const quad8_noise_error_states[] = {
"No excessive noise is present at the count inputs",
"Excessive noise is present at the count inputs"
};
static int quad8_get_noise_error(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan)
{
struct quad8_iio *const priv = iio_priv(indio_dev);
const int base_offset = priv->base + 2 * chan->channel + 1;
return !!(inb(base_offset) & QUAD8_FLAG_E);
}
static const struct iio_enum quad8_noise_error_enum = {
.items = quad8_noise_error_states,
.num_items = ARRAY_SIZE(quad8_noise_error_states),
.get = quad8_get_noise_error
};
static const char *const quad8_count_direction_states[] = {
"down",
"up"
};
static int quad8_get_count_direction(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan)
{
struct quad8_iio *const priv = iio_priv(indio_dev);
const int base_offset = priv->base + 2 * chan->channel + 1;
return !!(inb(base_offset) & QUAD8_FLAG_UD);
}
static const struct iio_enum quad8_count_direction_enum = {
.items = quad8_count_direction_states,
.num_items = ARRAY_SIZE(quad8_count_direction_states),
.get = quad8_get_count_direction
};
static const char *const quad8_count_modes[] = {
"normal",
"range limit",
"non-recycle",
"modulo-n"
};
static int quad8_set_count_mode(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan, unsigned int cnt_mode)
{
struct quad8_iio *const priv = iio_priv(indio_dev);
unsigned int mode_cfg = cnt_mode << 1;
const int base_offset = priv->base + 2 * chan->channel + 1;
mutex_lock(&priv->lock);
priv->count_mode[chan->channel] = cnt_mode;
/* Add quadrature mode configuration */
if (priv->quadrature_mode[chan->channel])
mode_cfg |= (priv->quadrature_scale[chan->channel] + 1) << 3;
/* Load mode configuration to Counter Mode Register */
outb(QUAD8_CTR_CMR | mode_cfg, base_offset);
mutex_unlock(&priv->lock);
return 0;
}
static int quad8_get_count_mode(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan)
{
const struct quad8_iio *const priv = iio_priv(indio_dev);
return priv->count_mode[chan->channel];
}
static const struct iio_enum quad8_count_mode_enum = {
.items = quad8_count_modes,
.num_items = ARRAY_SIZE(quad8_count_modes),
.set = quad8_set_count_mode,
.get = quad8_get_count_mode
};
static const char *const quad8_synchronous_modes[] = {
"non-synchronous",
"synchronous"
};
static int quad8_set_synchronous_mode(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan, unsigned int synchronous_mode)
{
struct quad8_iio *const priv = iio_priv(indio_dev);
const int base_offset = priv->base + 2 * chan->channel + 1;
unsigned int idr_cfg = synchronous_mode;
mutex_lock(&priv->lock);
idr_cfg |= priv->index_polarity[chan->channel] << 1;
/* Index function must be non-synchronous in non-quadrature mode */
if (synchronous_mode && !priv->quadrature_mode[chan->channel]) {
mutex_unlock(&priv->lock);
return -EINVAL;
}
priv->synchronous_mode[chan->channel] = synchronous_mode;
/* Load Index Control configuration to Index Control Register */
outb(QUAD8_CTR_IDR | idr_cfg, base_offset);
mutex_unlock(&priv->lock);
return 0;
}
static int quad8_get_synchronous_mode(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan)
{
const struct quad8_iio *const priv = iio_priv(indio_dev);
return priv->synchronous_mode[chan->channel];
}
static const struct iio_enum quad8_synchronous_mode_enum = {
.items = quad8_synchronous_modes,
.num_items = ARRAY_SIZE(quad8_synchronous_modes),
.set = quad8_set_synchronous_mode,
.get = quad8_get_synchronous_mode
};
static const char *const quad8_quadrature_modes[] = {
"non-quadrature",
"quadrature"
};
static int quad8_set_quadrature_mode(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan, unsigned int quadrature_mode)
{
struct quad8_iio *const priv = iio_priv(indio_dev);
const int base_offset = priv->base + 2 * chan->channel + 1;
unsigned int mode_cfg;
mutex_lock(&priv->lock);
mode_cfg = priv->count_mode[chan->channel] << 1;
if (quadrature_mode)
mode_cfg |= (priv->quadrature_scale[chan->channel] + 1) << 3;
else {
/* Quadrature scaling only available in quadrature mode */
priv->quadrature_scale[chan->channel] = 0;
/* Synchronous function not supported in non-quadrature mode */
if (priv->synchronous_mode[chan->channel])
quad8_set_synchronous_mode(indio_dev, chan, 0);
}
priv->quadrature_mode[chan->channel] = quadrature_mode;
/* Load mode configuration to Counter Mode Register */
outb(QUAD8_CTR_CMR | mode_cfg, base_offset);
mutex_unlock(&priv->lock);
return 0;
}
static int quad8_get_quadrature_mode(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan)
{
const struct quad8_iio *const priv = iio_priv(indio_dev);
return priv->quadrature_mode[chan->channel];
}
static const struct iio_enum quad8_quadrature_mode_enum = {
.items = quad8_quadrature_modes,
.num_items = ARRAY_SIZE(quad8_quadrature_modes),
.set = quad8_set_quadrature_mode,
.get = quad8_get_quadrature_mode
};
static const char *const quad8_index_polarity_modes[] = {
"negative",
"positive"
};
static int quad8_set_index_polarity(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan, unsigned int index_polarity)
{
struct quad8_iio *const priv = iio_priv(indio_dev);
const int base_offset = priv->base + 2 * chan->channel + 1;
unsigned int idr_cfg = index_polarity << 1;
mutex_lock(&priv->lock);
idr_cfg |= priv->synchronous_mode[chan->channel];
priv->index_polarity[chan->channel] = index_polarity;
/* Load Index Control configuration to Index Control Register */
outb(QUAD8_CTR_IDR | idr_cfg, base_offset);
mutex_unlock(&priv->lock);
return 0;
}
static int quad8_get_index_polarity(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan)
{
const struct quad8_iio *const priv = iio_priv(indio_dev);
return priv->index_polarity[chan->channel];
}
static const struct iio_enum quad8_index_polarity_enum = {
.items = quad8_index_polarity_modes,
.num_items = ARRAY_SIZE(quad8_index_polarity_modes),
.set = quad8_set_index_polarity,
.get = quad8_get_index_polarity
};
static const struct iio_chan_spec_ext_info quad8_count_ext_info[] = {
{
.name = "preset",
.shared = IIO_SEPARATE,
.read = quad8_read_preset,
.write = quad8_write_preset
},
{
.name = "set_to_preset_on_index",
.shared = IIO_SEPARATE,
.read = quad8_read_set_to_preset_on_index,
.write = quad8_write_set_to_preset_on_index
},
IIO_ENUM("noise_error", IIO_SEPARATE, &quad8_noise_error_enum),
IIO_ENUM_AVAILABLE("noise_error", &quad8_noise_error_enum),
IIO_ENUM("count_direction", IIO_SEPARATE, &quad8_count_direction_enum),
IIO_ENUM_AVAILABLE("count_direction", &quad8_count_direction_enum),
IIO_ENUM("count_mode", IIO_SEPARATE, &quad8_count_mode_enum),
IIO_ENUM_AVAILABLE("count_mode", &quad8_count_mode_enum),
IIO_ENUM("quadrature_mode", IIO_SEPARATE, &quad8_quadrature_mode_enum),
IIO_ENUM_AVAILABLE("quadrature_mode", &quad8_quadrature_mode_enum),
{}
};
static const struct iio_chan_spec_ext_info quad8_index_ext_info[] = {
IIO_ENUM("synchronous_mode", IIO_SEPARATE,
&quad8_synchronous_mode_enum),
IIO_ENUM_AVAILABLE("synchronous_mode", &quad8_synchronous_mode_enum),
IIO_ENUM("index_polarity", IIO_SEPARATE, &quad8_index_polarity_enum),
IIO_ENUM_AVAILABLE("index_polarity", &quad8_index_polarity_enum),
{}
};
#define QUAD8_COUNT_CHAN(_chan) { \
.type = IIO_COUNT, \
.channel = (_chan), \
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
BIT(IIO_CHAN_INFO_ENABLE) | BIT(IIO_CHAN_INFO_SCALE), \
.ext_info = quad8_count_ext_info, \
.indexed = 1 \
}
#define QUAD8_INDEX_CHAN(_chan) { \
.type = IIO_INDEX, \
.channel = (_chan), \
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
.ext_info = quad8_index_ext_info, \
.indexed = 1 \
}
static const struct iio_chan_spec quad8_channels[] = {
QUAD8_COUNT_CHAN(0), QUAD8_INDEX_CHAN(0),
QUAD8_COUNT_CHAN(1), QUAD8_INDEX_CHAN(1),
QUAD8_COUNT_CHAN(2), QUAD8_INDEX_CHAN(2),
QUAD8_COUNT_CHAN(3), QUAD8_INDEX_CHAN(3),
QUAD8_COUNT_CHAN(4), QUAD8_INDEX_CHAN(4),
QUAD8_COUNT_CHAN(5), QUAD8_INDEX_CHAN(5),
QUAD8_COUNT_CHAN(6), QUAD8_INDEX_CHAN(6),
QUAD8_COUNT_CHAN(7), QUAD8_INDEX_CHAN(7)
};
static int quad8_signal_read(struct counter_device *counter,
struct counter_signal *signal, struct counter_signal_read_value *val)
{
const struct quad8_iio *const priv = counter->priv;
unsigned int state;
enum counter_signal_level level;
/* Only Index signal levels can be read */
if (signal->id < 16)
return -EINVAL;
state = inb(priv->base + QUAD8_REG_INDEX_INPUT_LEVELS)
& BIT(signal->id - 16);
level = (state) ? COUNTER_SIGNAL_LEVEL_HIGH : COUNTER_SIGNAL_LEVEL_LOW;
counter_signal_read_value_set(val, COUNTER_SIGNAL_LEVEL, &level);
return 0;
}
static int quad8_count_read(struct counter_device *counter,
struct counter_count *count, struct counter_count_read_value *val)
{
struct quad8_iio *const priv = counter->priv;
const int base_offset = priv->base + 2 * count->id;
unsigned int flags;
unsigned int borrow;
unsigned int carry;
unsigned long position;
int i;
flags = inb(base_offset + 1);
borrow = flags & QUAD8_FLAG_BT;
carry = !!(flags & QUAD8_FLAG_CT);
/* Borrow XOR Carry effectively doubles count range */
position = (unsigned long)(borrow ^ carry) << 24;
mutex_lock(&priv->lock);
/* Reset Byte Pointer; transfer Counter to Output Latch */
outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP | QUAD8_RLD_CNTR_OUT,
base_offset + 1);
for (i = 0; i < 3; i++)
position |= (unsigned long)inb(base_offset) << (8 * i);
counter_count_read_value_set(val, COUNTER_COUNT_POSITION, &position);
mutex_unlock(&priv->lock);
return 0;
}
static int quad8_count_write(struct counter_device *counter,
struct counter_count *count, struct counter_count_write_value *val)
{
struct quad8_iio *const priv = counter->priv;
const int base_offset = priv->base + 2 * count->id;
int err;
unsigned long position;
int i;
err = counter_count_write_value_get(&position, COUNTER_COUNT_POSITION,
val);
if (err)
return err;
/* Only 24-bit values are supported */
if (position > 0xFFFFFF)
return -EINVAL;
mutex_lock(&priv->lock);
/* Reset Byte Pointer */
outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP, base_offset + 1);
/* Counter can only be set via Preset Register */
for (i = 0; i < 3; i++)
outb(position >> (8 * i), base_offset);
/* Transfer Preset Register to Counter */
outb(QUAD8_CTR_RLD | QUAD8_RLD_PRESET_CNTR, base_offset + 1);
/* Reset Byte Pointer */
outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP, base_offset + 1);
/* Set Preset Register back to original value */
position = priv->preset[count->id];
for (i = 0; i < 3; i++)
outb(position >> (8 * i), base_offset);
/* Reset Borrow, Carry, Compare, and Sign flags */
outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_FLAGS, base_offset + 1);
/* Reset Error flag */
outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_E, base_offset + 1);
mutex_unlock(&priv->lock);
return 0;
}
enum quad8_count_function {
QUAD8_COUNT_FUNCTION_PULSE_DIRECTION = 0,
QUAD8_COUNT_FUNCTION_QUADRATURE_X1,
QUAD8_COUNT_FUNCTION_QUADRATURE_X2,
QUAD8_COUNT_FUNCTION_QUADRATURE_X4
};
static enum counter_count_function quad8_count_functions_list[] = {
[QUAD8_COUNT_FUNCTION_PULSE_DIRECTION] = COUNTER_COUNT_FUNCTION_PULSE_DIRECTION,
[QUAD8_COUNT_FUNCTION_QUADRATURE_X1] = COUNTER_COUNT_FUNCTION_QUADRATURE_X1_A,
[QUAD8_COUNT_FUNCTION_QUADRATURE_X2] = COUNTER_COUNT_FUNCTION_QUADRATURE_X2_A,
[QUAD8_COUNT_FUNCTION_QUADRATURE_X4] = COUNTER_COUNT_FUNCTION_QUADRATURE_X4
};
static int quad8_function_get(struct counter_device *counter,
struct counter_count *count, size_t *function)
{
struct quad8_iio *const priv = counter->priv;
const int id = count->id;
mutex_lock(&priv->lock);
if (priv->quadrature_mode[id])
switch (priv->quadrature_scale[id]) {
case 0:
*function = QUAD8_COUNT_FUNCTION_QUADRATURE_X1;
break;
case 1:
*function = QUAD8_COUNT_FUNCTION_QUADRATURE_X2;
break;
case 2:
*function = QUAD8_COUNT_FUNCTION_QUADRATURE_X4;
break;
}
else
*function = QUAD8_COUNT_FUNCTION_PULSE_DIRECTION;
mutex_unlock(&priv->lock);
return 0;
}
static int quad8_function_set(struct counter_device *counter,
struct counter_count *count, size_t function)
{
struct quad8_iio *const priv = counter->priv;
const int id = count->id;
unsigned int *const quadrature_mode = priv->quadrature_mode + id;
unsigned int *const scale = priv->quadrature_scale + id;
unsigned int *const synchronous_mode = priv->synchronous_mode + id;
const int base_offset = priv->base + 2 * id + 1;
unsigned int mode_cfg;
unsigned int idr_cfg;
mutex_lock(&priv->lock);
mode_cfg = priv->count_mode[id] << 1;
idr_cfg = priv->index_polarity[id] << 1;
if (function == QUAD8_COUNT_FUNCTION_PULSE_DIRECTION) {
*quadrature_mode = 0;
/* Quadrature scaling only available in quadrature mode */
*scale = 0;
/* Synchronous function not supported in non-quadrature mode */
if (*synchronous_mode) {
*synchronous_mode = 0;
/* Disable synchronous function mode */
outb(QUAD8_CTR_IDR | idr_cfg, base_offset);
}
} else {
*quadrature_mode = 1;
switch (function) {
case QUAD8_COUNT_FUNCTION_QUADRATURE_X1:
*scale = 0;
mode_cfg |= QUAD8_CMR_QUADRATURE_X1;
break;
case QUAD8_COUNT_FUNCTION_QUADRATURE_X2:
*scale = 1;
mode_cfg |= QUAD8_CMR_QUADRATURE_X2;
break;
case QUAD8_COUNT_FUNCTION_QUADRATURE_X4:
*scale = 2;
mode_cfg |= QUAD8_CMR_QUADRATURE_X4;
break;
}
}
/* Load mode configuration to Counter Mode Register */
outb(QUAD8_CTR_CMR | mode_cfg, base_offset);
mutex_unlock(&priv->lock);
return 0;
}
static void quad8_direction_get(struct counter_device *counter,
struct counter_count *count, enum counter_count_direction *direction)
{
const struct quad8_iio *const priv = counter->priv;
unsigned int ud_flag;
const unsigned int flag_addr = priv->base + 2 * count->id + 1;
/* U/D flag: nonzero = up, zero = down */
ud_flag = inb(flag_addr) & QUAD8_FLAG_UD;
*direction = (ud_flag) ? COUNTER_COUNT_DIRECTION_FORWARD :
COUNTER_COUNT_DIRECTION_BACKWARD;
}
enum quad8_synapse_action {
QUAD8_SYNAPSE_ACTION_NONE = 0,
QUAD8_SYNAPSE_ACTION_RISING_EDGE,
QUAD8_SYNAPSE_ACTION_FALLING_EDGE,
QUAD8_SYNAPSE_ACTION_BOTH_EDGES
};
static enum counter_synapse_action quad8_index_actions_list[] = {
[QUAD8_SYNAPSE_ACTION_NONE] = COUNTER_SYNAPSE_ACTION_NONE,
[QUAD8_SYNAPSE_ACTION_RISING_EDGE] = COUNTER_SYNAPSE_ACTION_RISING_EDGE
};
static enum counter_synapse_action quad8_synapse_actions_list[] = {
[QUAD8_SYNAPSE_ACTION_NONE] = COUNTER_SYNAPSE_ACTION_NONE,
[QUAD8_SYNAPSE_ACTION_RISING_EDGE] = COUNTER_SYNAPSE_ACTION_RISING_EDGE,
[QUAD8_SYNAPSE_ACTION_FALLING_EDGE] = COUNTER_SYNAPSE_ACTION_FALLING_EDGE,
[QUAD8_SYNAPSE_ACTION_BOTH_EDGES] = COUNTER_SYNAPSE_ACTION_BOTH_EDGES
};
static int quad8_action_get(struct counter_device *counter,
struct counter_count *count, struct counter_synapse *synapse,
size_t *action)
{
struct quad8_iio *const priv = counter->priv;
int err;
size_t function = 0;
const size_t signal_a_id = count->synapses[0].signal->id;
enum counter_count_direction direction;
/* Handle Index signals */
if (synapse->signal->id >= 16) {
if (priv->preset_enable[count->id])
*action = QUAD8_SYNAPSE_ACTION_RISING_EDGE;
else
*action = QUAD8_SYNAPSE_ACTION_NONE;
return 0;
}
err = quad8_function_get(counter, count, &function);
if (err)
return err;
/* Default action mode */
*action = QUAD8_SYNAPSE_ACTION_NONE;
/* Determine action mode based on current count function mode */
switch (function) {
case QUAD8_COUNT_FUNCTION_PULSE_DIRECTION:
if (synapse->signal->id == signal_a_id)
*action = QUAD8_SYNAPSE_ACTION_RISING_EDGE;
break;
case QUAD8_COUNT_FUNCTION_QUADRATURE_X1:
if (synapse->signal->id == signal_a_id) {
quad8_direction_get(counter, count, &direction);
if (direction == COUNTER_COUNT_DIRECTION_FORWARD)
*action = QUAD8_SYNAPSE_ACTION_RISING_EDGE;
else
*action = QUAD8_SYNAPSE_ACTION_FALLING_EDGE;
}
break;
case QUAD8_COUNT_FUNCTION_QUADRATURE_X2:
if (synapse->signal->id == signal_a_id)
*action = QUAD8_SYNAPSE_ACTION_BOTH_EDGES;
break;
case QUAD8_COUNT_FUNCTION_QUADRATURE_X4:
*action = QUAD8_SYNAPSE_ACTION_BOTH_EDGES;
break;
}
return 0;
}
static const struct counter_ops quad8_ops = {
.signal_read = quad8_signal_read,
.count_read = quad8_count_read,
.count_write = quad8_count_write,
.function_get = quad8_function_get,
.function_set = quad8_function_set,
.action_get = quad8_action_get
};
static int quad8_index_polarity_get(struct counter_device *counter,
struct counter_signal *signal, size_t *index_polarity)
{
const struct quad8_iio *const priv = counter->priv;
const size_t channel_id = signal->id - 16;
*index_polarity = priv->index_polarity[channel_id];
return 0;
}
static int quad8_index_polarity_set(struct counter_device *counter,
struct counter_signal *signal, size_t index_polarity)
{
struct quad8_iio *const priv = counter->priv;
const size_t channel_id = signal->id - 16;
const int base_offset = priv->base + 2 * channel_id + 1;
unsigned int idr_cfg = index_polarity << 1;
mutex_lock(&priv->lock);
idr_cfg |= priv->synchronous_mode[channel_id];
priv->index_polarity[channel_id] = index_polarity;
/* Load Index Control configuration to Index Control Register */
outb(QUAD8_CTR_IDR | idr_cfg, base_offset);
mutex_unlock(&priv->lock);
return 0;
}
static struct counter_signal_enum_ext quad8_index_pol_enum = {
.items = quad8_index_polarity_modes,
.num_items = ARRAY_SIZE(quad8_index_polarity_modes),
.get = quad8_index_polarity_get,
.set = quad8_index_polarity_set
};
static int quad8_synchronous_mode_get(struct counter_device *counter,
struct counter_signal *signal, size_t *synchronous_mode)
{
const struct quad8_iio *const priv = counter->priv;
const size_t channel_id = signal->id - 16;
*synchronous_mode = priv->synchronous_mode[channel_id];
return 0;
}
static int quad8_synchronous_mode_set(struct counter_device *counter,
struct counter_signal *signal, size_t synchronous_mode)
{
struct quad8_iio *const priv = counter->priv;
const size_t channel_id = signal->id - 16;
const int base_offset = priv->base + 2 * channel_id + 1;
unsigned int idr_cfg = synchronous_mode;
mutex_lock(&priv->lock);
idr_cfg |= priv->index_polarity[channel_id] << 1;
/* Index function must be non-synchronous in non-quadrature mode */
if (synchronous_mode && !priv->quadrature_mode[channel_id]) {
mutex_unlock(&priv->lock);
return -EINVAL;
}
priv->synchronous_mode[channel_id] = synchronous_mode;
/* Load Index Control configuration to Index Control Register */
outb(QUAD8_CTR_IDR | idr_cfg, base_offset);
mutex_unlock(&priv->lock);
return 0;
}
static struct counter_signal_enum_ext quad8_syn_mode_enum = {
.items = quad8_synchronous_modes,
.num_items = ARRAY_SIZE(quad8_synchronous_modes),
.get = quad8_synchronous_mode_get,
.set = quad8_synchronous_mode_set
};
static ssize_t quad8_count_floor_read(struct counter_device *counter,
struct counter_count *count, void *private, char *buf)
{
/* Only a floor of 0 is supported */
return sprintf(buf, "0\n");
}
static int quad8_count_mode_get(struct counter_device *counter,
struct counter_count *count, size_t *cnt_mode)
{
const struct quad8_iio *const priv = counter->priv;
/* Map 104-QUAD-8 count mode to Generic Counter count mode */
switch (priv->count_mode[count->id]) {
case 0:
*cnt_mode = COUNTER_COUNT_MODE_NORMAL;
break;
case 1:
*cnt_mode = COUNTER_COUNT_MODE_RANGE_LIMIT;
break;
case 2:
*cnt_mode = COUNTER_COUNT_MODE_NON_RECYCLE;
break;
case 3:
*cnt_mode = COUNTER_COUNT_MODE_MODULO_N;
break;
}
return 0;
}
static int quad8_count_mode_set(struct counter_device *counter,
struct counter_count *count, size_t cnt_mode)
{
struct quad8_iio *const priv = counter->priv;
unsigned int mode_cfg;
const int base_offset = priv->base + 2 * count->id + 1;
/* Map Generic Counter count mode to 104-QUAD-8 count mode */
switch (cnt_mode) {
case COUNTER_COUNT_MODE_NORMAL:
cnt_mode = 0;
break;
case COUNTER_COUNT_MODE_RANGE_LIMIT:
cnt_mode = 1;
break;
case COUNTER_COUNT_MODE_NON_RECYCLE:
cnt_mode = 2;
break;
case COUNTER_COUNT_MODE_MODULO_N:
cnt_mode = 3;
break;
}
mutex_lock(&priv->lock);
priv->count_mode[count->id] = cnt_mode;
/* Set count mode configuration value */
mode_cfg = cnt_mode << 1;
/* Add quadrature mode configuration */
if (priv->quadrature_mode[count->id])
mode_cfg |= (priv->quadrature_scale[count->id] + 1) << 3;
/* Load mode configuration to Counter Mode Register */
outb(QUAD8_CTR_CMR | mode_cfg, base_offset);
mutex_unlock(&priv->lock);
return 0;
}
static struct counter_count_enum_ext quad8_cnt_mode_enum = {
.items = counter_count_mode_str,
.num_items = ARRAY_SIZE(counter_count_mode_str),
.get = quad8_count_mode_get,
.set = quad8_count_mode_set
};
static ssize_t quad8_count_direction_read(struct counter_device *counter,
struct counter_count *count, void *priv, char *buf)
{
enum counter_count_direction dir;
quad8_direction_get(counter, count, &dir);
return sprintf(buf, "%s\n", counter_count_direction_str[dir]);
}
static ssize_t quad8_count_enable_read(struct counter_device *counter,
struct counter_count *count, void *private, char *buf)
{
const struct quad8_iio *const priv = counter->priv;
return sprintf(buf, "%u\n", priv->ab_enable[count->id]);
}
static ssize_t quad8_count_enable_write(struct counter_device *counter,
struct counter_count *count, void *private, const char *buf, size_t len)
{
struct quad8_iio *const priv = counter->priv;
const int base_offset = priv->base + 2 * count->id;
int err;
bool ab_enable;
unsigned int ior_cfg;
err = kstrtobool(buf, &ab_enable);
if (err)
return err;
mutex_lock(&priv->lock);
priv->ab_enable[count->id] = ab_enable;
ior_cfg = ab_enable | priv->preset_enable[count->id] << 1;
/* Load I/O control configuration */
outb(QUAD8_CTR_IOR | ior_cfg, base_offset + 1);
mutex_unlock(&priv->lock);
return len;
}
static int quad8_error_noise_get(struct counter_device *counter,
struct counter_count *count, size_t *noise_error)
{
const struct quad8_iio *const priv = counter->priv;
const int base_offset = priv->base + 2 * count->id + 1;
*noise_error = !!(inb(base_offset) & QUAD8_FLAG_E);
return 0;
}
static struct counter_count_enum_ext quad8_error_noise_enum = {
.items = quad8_noise_error_states,
.num_items = ARRAY_SIZE(quad8_noise_error_states),
.get = quad8_error_noise_get
};
static ssize_t quad8_count_preset_read(struct counter_device *counter,
struct counter_count *count, void *private, char *buf)
{
const struct quad8_iio *const priv = counter->priv;
return sprintf(buf, "%u\n", priv->preset[count->id]);
}
static void quad8_preset_register_set(struct quad8_iio *quad8iio, int id,
unsigned int preset)
{
const unsigned int base_offset = quad8iio->base + 2 * id;
int i;
quad8iio->preset[id] = preset;
/* Reset Byte Pointer */
outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP, base_offset + 1);
/* Set Preset Register */
for (i = 0; i < 3; i++)
outb(preset >> (8 * i), base_offset);
}
static ssize_t quad8_count_preset_write(struct counter_device *counter,
struct counter_count *count, void *private, const char *buf, size_t len)
{
struct quad8_iio *const priv = counter->priv;
unsigned int preset;
int ret;
ret = kstrtouint(buf, 0, &preset);
if (ret)
return ret;
/* Only 24-bit values are supported */
if (preset > 0xFFFFFF)
return -EINVAL;
mutex_lock(&priv->lock);
quad8_preset_register_set(priv, count->id, preset);
mutex_unlock(&priv->lock);
return len;
}
static ssize_t quad8_count_ceiling_read(struct counter_device *counter,
struct counter_count *count, void *private, char *buf)
{
struct quad8_iio *const priv = counter->priv;
mutex_lock(&priv->lock);
/* Range Limit and Modulo-N count modes use preset value as ceiling */
switch (priv->count_mode[count->id]) {
case 1:
case 3:
mutex_unlock(&priv->lock);
return sprintf(buf, "%u\n", priv->preset[count->id]);
}
mutex_unlock(&priv->lock);
/* By default 0x1FFFFFF (25 bits unsigned) is maximum count */
return sprintf(buf, "33554431\n");
}
static ssize_t quad8_count_ceiling_write(struct counter_device *counter,
struct counter_count *count, void *private, const char *buf, size_t len)
{
struct quad8_iio *const priv = counter->priv;
unsigned int ceiling;
int ret;
ret = kstrtouint(buf, 0, &ceiling);
if (ret)
return ret;
/* Only 24-bit values are supported */
if (ceiling > 0xFFFFFF)
return -EINVAL;
mutex_lock(&priv->lock);
/* Range Limit and Modulo-N count modes use preset value as ceiling */
switch (priv->count_mode[count->id]) {
case 1:
case 3:
quad8_preset_register_set(priv, count->id, ceiling);
break;
}
mutex_unlock(&priv->lock);
return len;
}
static ssize_t quad8_count_preset_enable_read(struct counter_device *counter,
struct counter_count *count, void *private, char *buf)
{
const struct quad8_iio *const priv = counter->priv;
return sprintf(buf, "%u\n", !priv->preset_enable[count->id]);
}
static ssize_t quad8_count_preset_enable_write(struct counter_device *counter,
struct counter_count *count, void *private, const char *buf, size_t len)
{
struct quad8_iio *const priv = counter->priv;
const int base_offset = priv->base + 2 * count->id + 1;
bool preset_enable;
int ret;
unsigned int ior_cfg;
ret = kstrtobool(buf, &preset_enable);
if (ret)
return ret;
/* Preset enable is active low in Input/Output Control register */
preset_enable = !preset_enable;
mutex_lock(&priv->lock);
priv->preset_enable[count->id] = preset_enable;
ior_cfg = priv->ab_enable[count->id] | (unsigned int)preset_enable << 1;
/* Load I/O control configuration to Input / Output Control Register */
outb(QUAD8_CTR_IOR | ior_cfg, base_offset);
mutex_unlock(&priv->lock);
return len;
}
static const struct counter_signal_ext quad8_index_ext[] = {
COUNTER_SIGNAL_ENUM("index_polarity", &quad8_index_pol_enum),
COUNTER_SIGNAL_ENUM_AVAILABLE("index_polarity", &quad8_index_pol_enum),
COUNTER_SIGNAL_ENUM("synchronous_mode", &quad8_syn_mode_enum),
COUNTER_SIGNAL_ENUM_AVAILABLE("synchronous_mode", &quad8_syn_mode_enum)
};
#define QUAD8_QUAD_SIGNAL(_id, _name) { \
.id = (_id), \
.name = (_name) \
}
#define QUAD8_INDEX_SIGNAL(_id, _name) { \
.id = (_id), \
.name = (_name), \
.ext = quad8_index_ext, \
.num_ext = ARRAY_SIZE(quad8_index_ext) \
}
static struct counter_signal quad8_signals[] = {
QUAD8_QUAD_SIGNAL(0, "Channel 1 Quadrature A"),
QUAD8_QUAD_SIGNAL(1, "Channel 1 Quadrature B"),
QUAD8_QUAD_SIGNAL(2, "Channel 2 Quadrature A"),
QUAD8_QUAD_SIGNAL(3, "Channel 2 Quadrature B"),
QUAD8_QUAD_SIGNAL(4, "Channel 3 Quadrature A"),
QUAD8_QUAD_SIGNAL(5, "Channel 3 Quadrature B"),
QUAD8_QUAD_SIGNAL(6, "Channel 4 Quadrature A"),
QUAD8_QUAD_SIGNAL(7, "Channel 4 Quadrature B"),
QUAD8_QUAD_SIGNAL(8, "Channel 5 Quadrature A"),
QUAD8_QUAD_SIGNAL(9, "Channel 5 Quadrature B"),
QUAD8_QUAD_SIGNAL(10, "Channel 6 Quadrature A"),
QUAD8_QUAD_SIGNAL(11, "Channel 6 Quadrature B"),
QUAD8_QUAD_SIGNAL(12, "Channel 7 Quadrature A"),
QUAD8_QUAD_SIGNAL(13, "Channel 7 Quadrature B"),
QUAD8_QUAD_SIGNAL(14, "Channel 8 Quadrature A"),
QUAD8_QUAD_SIGNAL(15, "Channel 8 Quadrature B"),
QUAD8_INDEX_SIGNAL(16, "Channel 1 Index"),
QUAD8_INDEX_SIGNAL(17, "Channel 2 Index"),
QUAD8_INDEX_SIGNAL(18, "Channel 3 Index"),
QUAD8_INDEX_SIGNAL(19, "Channel 4 Index"),
QUAD8_INDEX_SIGNAL(20, "Channel 5 Index"),
QUAD8_INDEX_SIGNAL(21, "Channel 6 Index"),
QUAD8_INDEX_SIGNAL(22, "Channel 7 Index"),
QUAD8_INDEX_SIGNAL(23, "Channel 8 Index")
};
#define QUAD8_COUNT_SYNAPSES(_id) { \
{ \
.actions_list = quad8_synapse_actions_list, \
.num_actions = ARRAY_SIZE(quad8_synapse_actions_list), \
.signal = quad8_signals + 2 * (_id) \
}, \
{ \
.actions_list = quad8_synapse_actions_list, \
.num_actions = ARRAY_SIZE(quad8_synapse_actions_list), \
.signal = quad8_signals + 2 * (_id) + 1 \
}, \
{ \
.actions_list = quad8_index_actions_list, \
.num_actions = ARRAY_SIZE(quad8_index_actions_list), \
.signal = quad8_signals + 2 * (_id) + 16 \
} \
}
static struct counter_synapse quad8_count_synapses[][3] = {
QUAD8_COUNT_SYNAPSES(0), QUAD8_COUNT_SYNAPSES(1),
QUAD8_COUNT_SYNAPSES(2), QUAD8_COUNT_SYNAPSES(3),
QUAD8_COUNT_SYNAPSES(4), QUAD8_COUNT_SYNAPSES(5),
QUAD8_COUNT_SYNAPSES(6), QUAD8_COUNT_SYNAPSES(7)
};
static const struct counter_count_ext quad8_count_ext[] = {
{
.name = "ceiling",
.read = quad8_count_ceiling_read,
.write = quad8_count_ceiling_write
},
{
.name = "floor",
.read = quad8_count_floor_read
},
COUNTER_COUNT_ENUM("count_mode", &quad8_cnt_mode_enum),
COUNTER_COUNT_ENUM_AVAILABLE("count_mode", &quad8_cnt_mode_enum),
{
.name = "direction",
.read = quad8_count_direction_read
},
{
.name = "enable",
.read = quad8_count_enable_read,
.write = quad8_count_enable_write
},
COUNTER_COUNT_ENUM("error_noise", &quad8_error_noise_enum),
COUNTER_COUNT_ENUM_AVAILABLE("error_noise", &quad8_error_noise_enum),
{
.name = "preset",
.read = quad8_count_preset_read,
.write = quad8_count_preset_write
},
{
.name = "preset_enable",
.read = quad8_count_preset_enable_read,
.write = quad8_count_preset_enable_write
}
};
#define QUAD8_COUNT(_id, _cntname) { \
.id = (_id), \
.name = (_cntname), \
.functions_list = quad8_count_functions_list, \
.num_functions = ARRAY_SIZE(quad8_count_functions_list), \
.synapses = quad8_count_synapses[(_id)], \
.num_synapses = 2, \
.ext = quad8_count_ext, \
.num_ext = ARRAY_SIZE(quad8_count_ext) \
}
static struct counter_count quad8_counts[] = {
QUAD8_COUNT(0, "Channel 1 Count"),
QUAD8_COUNT(1, "Channel 2 Count"),
QUAD8_COUNT(2, "Channel 3 Count"),
QUAD8_COUNT(3, "Channel 4 Count"),
QUAD8_COUNT(4, "Channel 5 Count"),
QUAD8_COUNT(5, "Channel 6 Count"),
QUAD8_COUNT(6, "Channel 7 Count"),
QUAD8_COUNT(7, "Channel 8 Count")
};
static int quad8_probe(struct device *dev, unsigned int id)
{
struct iio_dev *indio_dev;
struct quad8_iio *quad8iio;
int i, j;
unsigned int base_offset;
int err;
if (!devm_request_region(dev, base[id], QUAD8_EXTENT, dev_name(dev))) {
dev_err(dev, "Unable to lock port addresses (0x%X-0x%X)\n",
base[id], base[id] + QUAD8_EXTENT);
return -EBUSY;
}
/* Allocate IIO device; this also allocates driver data structure */
indio_dev = devm_iio_device_alloc(dev, sizeof(*quad8iio));
if (!indio_dev)
return -ENOMEM;
/* Initialize IIO device */
indio_dev->info = &quad8_info;
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->num_channels = ARRAY_SIZE(quad8_channels);
indio_dev->channels = quad8_channels;
indio_dev->name = dev_name(dev);
indio_dev->dev.parent = dev;
/* Initialize Counter device and driver data */
quad8iio = iio_priv(indio_dev);
quad8iio->counter.name = dev_name(dev);
quad8iio->counter.parent = dev;
quad8iio->counter.ops = &quad8_ops;
quad8iio->counter.counts = quad8_counts;
quad8iio->counter.num_counts = ARRAY_SIZE(quad8_counts);
quad8iio->counter.signals = quad8_signals;
quad8iio->counter.num_signals = ARRAY_SIZE(quad8_signals);
quad8iio->counter.priv = quad8iio;
quad8iio->base = base[id];
/* Initialize mutex */
mutex_init(&quad8iio->lock);
/* Reset all counters and disable interrupt function */
outb(QUAD8_CHAN_OP_RESET_COUNTERS, base[id] + QUAD8_REG_CHAN_OP);
/* Set initial configuration for all counters */
for (i = 0; i < QUAD8_NUM_COUNTERS; i++) {
base_offset = base[id] + 2 * i;
/* Reset Byte Pointer */
outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP, base_offset + 1);
/* Reset Preset Register */
for (j = 0; j < 3; j++)
outb(0x00, base_offset);
/* Reset Borrow, Carry, Compare, and Sign flags */
outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_FLAGS, base_offset + 1);
/* Reset Error flag */
outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_E, base_offset + 1);
/* Binary encoding; Normal count; non-quadrature mode */
outb(QUAD8_CTR_CMR, base_offset + 1);
/* Disable A and B inputs; preset on index; FLG1 as Carry */
outb(QUAD8_CTR_IOR, base_offset + 1);
/* Disable index function; negative index polarity */
outb(QUAD8_CTR_IDR, base_offset + 1);
}
/* Enable all counters */
outb(QUAD8_CHAN_OP_ENABLE_COUNTERS, base[id] + QUAD8_REG_CHAN_OP);
/* Register IIO device */
err = devm_iio_device_register(dev, indio_dev);
if (err)
return err;
/* Register Counter device */
return devm_counter_register(dev, &quad8iio->counter);
}
static struct isa_driver quad8_driver = {
.probe = quad8_probe,
.driver = {
.name = "104-quad-8"
}
};
module_isa_driver(quad8_driver, num_quad8);
MODULE_AUTHOR("William Breathitt Gray <[email protected]>");
MODULE_DESCRIPTION("ACCES 104-QUAD-8 IIO driver");
MODULE_LICENSE("GPL v2");
| {
"pile_set_name": "Github"
} |
package terminal
import (
"os"
"unicode"
)
type RuneReader struct {
Input *os.File
state runeReaderState
}
func NewRuneReader(input *os.File) *RuneReader {
return &RuneReader{
Input: input,
state: newRuneReaderState(input),
}
}
func (rr *RuneReader) ReadLine(mask rune) ([]rune, error) {
line := []rune{}
// we only care about horizontal displacements from the origin so start counting at 0
index := 0
for {
// wait for some input
r, _, err := rr.ReadRune()
if err != nil {
return line, err
}
// if the user pressed enter or some other newline/termination like ctrl+d
if r == '\r' || r == '\n' || r == KeyEndTransmission {
// go to the beginning of the next line
Print("\r\n")
// we're done processing the input
return line, nil
}
// if the user interrupts (ie with ctrl+c)
if r == KeyInterrupt {
// go to the beginning of the next line
Print("\r\n")
// we're done processing the input, and treat interrupt like an error
return line, InterruptErr
}
// allow for backspace/delete editing of inputs
if r == KeyBackspace || r == KeyDelete {
// and we're not at the beginning of the line
if index > 0 && len(line) > 0 {
// if we are at the end of the word
if index == len(line) {
// just remove the last letter from the internal representation
line = line[:len(line)-1]
// go back one
CursorBack(1)
// clear the rest of the line
EraseLine(ERASE_LINE_END)
} else {
// we need to remove a character from the middle of the word
// remove the current index from the list
line = append(line[:index-1], line[index:]...)
// go back one space so we can clear the rest
CursorBack(1)
// clear the rest of the line
EraseLine(ERASE_LINE_END)
// print what comes after
Print(string(line[index-1:]))
// leave the cursor where the user left it
CursorBack(len(line) - index + 1)
}
// decrement the index
index--
} else {
// otherwise the user pressed backspace while at the beginning of the line
soundBell()
}
// we're done processing this key
continue
}
// if the left arrow is pressed
if r == KeyArrowLeft {
// and we have space to the left
if index > 0 {
// move the cursor to the left
CursorBack(1)
// decrement the index
index--
} else {
// otherwise we are at the beginning of where we started reading lines
// sound the bell
soundBell()
}
// we're done processing this key press
continue
}
// if the right arrow is pressed
if r == KeyArrowRight {
// and we have space to the right of the word
if index < len(line) {
// move the cursor to the right
CursorForward(1)
// increment the index
index++
} else {
// otherwise we are at the end of the word and can't go past
// sound the bell
soundBell()
}
// we're done processing this key press
continue
}
// if the letter is another escape sequence
if unicode.IsControl(r) {
// ignore it
continue
}
// the user pressed a regular key
// if we are at the end of the line
if index == len(line) {
// just append the character at the end of the line
line = append(line, r)
// increment the location counter
index++
// if we don't need to mask the input
if mask == 0 {
// just print the character the user pressed
Printf("%c", r)
} else {
// otherwise print the mask we were given
Printf("%c", mask)
}
} else {
// we are in the middle of the word so we need to insert the character the user pressed
line = append(line[:index], append([]rune{r}, line[index:]...)...)
// visually insert the character by deleting the rest of the line
EraseLine(ERASE_LINE_END)
// print the rest of the word after
for _, char := range line[index:] {
// if we don't need to mask the input
if mask == 0 {
// just print the character the user pressed
Printf("%c", char)
} else {
// otherwise print the mask we were given
Printf("%c", mask)
}
}
// leave the cursor where the user left it
CursorBack(len(line) - index - 1)
// accommodate the new letter in our counter
index++
}
}
}
| {
"pile_set_name": "Github"
} |
<!--
~ Copyright 2016 Google Inc. All Rights Reserved.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<resources>>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style>
</resources>
| {
"pile_set_name": "Github"
} |
# Doxyfile 1.6.1
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project
#
# All text after a hash (#) is considered a comment and will be ignored
# The format is:
# TAG = value [value, ...]
# For lists items can also be appended using:
# TAG += value [value, ...]
# Values that contain spaces should be placed between quotes (" ")
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
# This tag specifies the encoding used for all characters in the config file
# that follow. The default is UTF-8 which is also the encoding used for all
# text before the first occurrence of this tag. Doxygen uses libiconv (or the
# iconv built into libc) for the transcoding. See
# http://www.gnu.org/software/libiconv for the list of possible encodings.
DOXYFILE_ENCODING = UTF-8
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
# by quotes) that should identify the project.
PROJECT_NAME = MBProgressHUD
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = 0.3
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
# If a relative path is entered, it will be relative to the location
# where doxygen was started. If left blank the current directory will be used.
OUTPUT_DIRECTORY = ../doc
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
# 4096 sub-directories (in 2 levels) under the output directory of each output
# format and will distribute the generated files over these directories.
# Enabling this option can be useful when feeding doxygen a huge amount of
# source files, where putting all generated files in the same directory would
# otherwise cause performance problems for the file system.
CREATE_SUBDIRS = NO
# The OUTPUT_LANGUAGE tag is used to specify the language in which all
# documentation generated by doxygen is written. Doxygen will use this
# information to generate all constant output in the proper language.
# The default language is English, other supported languages are:
# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
OUTPUT_LANGUAGE = English
# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
# include brief member descriptions after the members that are listed in
# the file and class documentation (similar to JavaDoc).
# Set to NO to disable this.
BRIEF_MEMBER_DESC = YES
# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
# the brief description of a member or function before the detailed description.
# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
# brief descriptions will be completely suppressed.
REPEAT_BRIEF = YES
# This tag implements a quasi-intelligent brief description abbreviator
# that is used to form the text in various listings. Each string
# in this list, if found as the leading text of the brief description, will be
# stripped from the text and the result after processing the whole list, is
# used as the annotated text. Otherwise, the brief description is used as-is.
# If left blank, the following values are used ("$name" is automatically
# replaced with the name of the entity): "The $name class" "The $name widget"
# "The $name file" "is" "provides" "specifies" "contains"
# "represents" "a" "an" "the"
ABBREVIATE_BRIEF = "The $name class" \
"The $name widget" \
"The $name file" \
is \
provides \
specifies \
contains \
represents \
a \
an \
the
# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
# Doxygen will generate a detailed section even if there is only a brief
# description.
ALWAYS_DETAILED_SEC = NO
# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
# inherited members of a class in the documentation of that class as if those
# members were ordinary class members. Constructors, destructors and assignment
# operators of the base classes will not be shown.
INLINE_INHERITED_MEMB = NO
# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
# path before files name in the file list and in the header files. If set
# to NO the shortest path that makes the file name unique will be used.
FULL_PATH_NAMES = YES
# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
# can be used to strip a user-defined part of the path. Stripping is
# only done if one of the specified strings matches the left-hand part of
# the path. The tag can be used to show relative paths in the file list.
# If left blank the directory from which doxygen is run is used as the
# path to strip.
STRIP_FROM_PATH =
# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
# the path mentioned in the documentation of a class, which tells
# the reader which header file to include in order to use a class.
# If left blank only the name of the header file containing the class
# definition is used. Otherwise one should specify the include paths that
# are normally passed to the compiler using the -I flag.
STRIP_FROM_INC_PATH =
# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
# (but less readable) file names. This can be useful is your file systems
# doesn't support long names like on DOS, Mac, or CD-ROM.
SHORT_NAMES = NO
# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
# will interpret the first line (until the first dot) of a JavaDoc-style
# comment as the brief description. If set to NO, the JavaDoc
# comments will behave just like regular Qt-style comments
# (thus requiring an explicit @brief command for a brief description.)
JAVADOC_AUTOBRIEF = YES
# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
# interpret the first line (until the first dot) of a Qt-style
# comment as the brief description. If set to NO, the comments
# will behave just like regular Qt-style comments (thus requiring
# an explicit \brief command for a brief description.)
QT_AUTOBRIEF = NO
# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
# treat a multi-line C++ special comment block (i.e. a block of //! or ///
# comments) as a brief description. This used to be the default behaviour.
# The new default is to treat a multi-line C++ comment block as a detailed
# description. Set this tag to YES if you prefer the old behaviour instead.
MULTILINE_CPP_IS_BRIEF = NO
# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
# member inherits the documentation from any documented member that it
# re-implements.
INHERIT_DOCS = YES
# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
# a new page for each member. If set to NO, the documentation of a member will
# be part of the file/class/namespace that contains it.
SEPARATE_MEMBER_PAGES = NO
# The TAB_SIZE tag can be used to set the number of spaces in a tab.
# Doxygen uses this value to replace tabs by spaces in code fragments.
TAB_SIZE = 8
# This tag can be used to specify a number of aliases that acts
# as commands in the documentation. An alias has the form "name=value".
# For example adding "sideeffect=\par Side Effects:\n" will allow you to
# put the command \sideeffect (or @sideeffect) in the documentation, which
# will result in a user-defined paragraph with heading "Side Effects:".
# You can put \n's in the value part of an alias to insert newlines.
ALIASES =
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
# sources only. Doxygen will then generate output that is more tailored for C.
# For instance, some of the names that are used will be different. The list
# of all members will be omitted, etc.
OPTIMIZE_OUTPUT_FOR_C = NO
# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
# sources only. Doxygen will then generate output that is more tailored for
# Java. For instance, namespaces will be presented as packages, qualified
# scopes will look different, etc.
OPTIMIZE_OUTPUT_JAVA = NO
# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
# sources only. Doxygen will then generate output that is more tailored for
# Fortran.
OPTIMIZE_FOR_FORTRAN = NO
# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
# sources. Doxygen will then generate output that is tailored for
# VHDL.
OPTIMIZE_OUTPUT_VHDL = NO
# Doxygen selects the parser to use depending on the extension of the files it parses.
# With this tag you can assign which parser to use for a given extension.
# Doxygen has a built-in mapping, but you can override or extend it using this tag.
# The format is ext=language, where ext is a file extension, and language is one of
# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
# use: inc=Fortran f=C. Note that for custom extensions you also need to set
# FILE_PATTERNS otherwise the files are not read by doxygen.
EXTENSION_MAPPING =
# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
# to include (a tag file for) the STL sources as input, then you should
# set this tag to YES in order to let doxygen match functions declarations and
# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
# func(std::string) {}). This also make the inheritance and collaboration
# diagrams that involve STL classes more complete and accurate.
BUILTIN_STL_SUPPORT = NO
# If you use Microsoft's C++/CLI language, you should set this option to YES to
# enable parsing support.
CPP_CLI_SUPPORT = NO
# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
# Doxygen will parse them like normal C++ but will assume all classes use public
# instead of private inheritance when no explicit protection keyword is present.
SIP_SUPPORT = NO
# For Microsoft's IDL there are propget and propput attributes to indicate getter
# and setter methods for a property. Setting this option to YES (the default)
# will make doxygen to replace the get and set methods by a property in the
# documentation. This will only work if the methods are indeed getting or
# setting a simple type. If this is not the case, or you want to show the
# methods anyway, you should set this option to NO.
IDL_PROPERTY_SUPPORT = YES
# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
# tag is set to YES, then doxygen will reuse the documentation of the first
# member in the group (if any) for the other members of the group. By default
# all members of a group must be documented explicitly.
DISTRIBUTE_GROUP_DOC = NO
# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
# the same type (for instance a group of public functions) to be put as a
# subgroup of that type (e.g. under the Public Functions section). Set it to
# NO to prevent subgrouping. Alternatively, this can be done per class using
# the \nosubgrouping command.
SUBGROUPING = YES
# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
# is documented as struct, union, or enum with the name of the typedef. So
# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
# with name TypeT. When disabled the typedef will appear as a member of a file,
# namespace, or class. And the struct will be named TypeS. This can typically
# be useful for C code in case the coding convention dictates that all compound
# types are typedef'ed and only the typedef is referenced, never the tag name.
TYPEDEF_HIDES_STRUCT = NO
# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
# determine which symbols to keep in memory and which to flush to disk.
# When the cache is full, less often used symbols will be written to disk.
# For small to medium size projects (<1000 input files) the default value is
# probably good enough. For larger projects a too small cache size can cause
# doxygen to be busy swapping symbols to and from disk most of the time
# causing a significant performance penality.
# If the system has enough physical memory increasing the cache will improve the
# performance by keeping more symbols in memory. Note that the value works on
# a logarithmic scale so increasing the size by one will rougly double the
# memory usage. The cache size is given by this formula:
# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
# corresponding to a cache size of 2^16 = 65536 symbols
SYMBOL_CACHE_SIZE = 0
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
# documentation are documented, even if no documentation was available.
# Private class members and static file members will be hidden unless
# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
EXTRACT_ALL = NO
# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
# will be included in the documentation.
EXTRACT_PRIVATE = NO
# If the EXTRACT_STATIC tag is set to YES all static members of a file
# will be included in the documentation.
EXTRACT_STATIC = NO
# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
# defined locally in source files will be included in the documentation.
# If set to NO only classes defined in header files are included.
EXTRACT_LOCAL_CLASSES = YES
# This flag is only useful for Objective-C code. When set to YES local
# methods, which are defined in the implementation section but not in
# the interface are included in the documentation.
# If set to NO (the default) only methods in the interface are included.
EXTRACT_LOCAL_METHODS = NO
# If this flag is set to YES, the members of anonymous namespaces will be
# extracted and appear in the documentation as a namespace called
# 'anonymous_namespace{file}', where file will be replaced with the base
# name of the file that contains the anonymous namespace. By default
# anonymous namespace are hidden.
EXTRACT_ANON_NSPACES = NO
# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
# undocumented members of documented classes, files or namespaces.
# If set to NO (the default) these members will be included in the
# various overviews, but no documentation section is generated.
# This option has no effect if EXTRACT_ALL is enabled.
HIDE_UNDOC_MEMBERS = NO
# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
# undocumented classes that are normally visible in the class hierarchy.
# If set to NO (the default) these classes will be included in the various
# overviews. This option has no effect if EXTRACT_ALL is enabled.
HIDE_UNDOC_CLASSES = NO
# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
# friend (class|struct|union) declarations.
# If set to NO (the default) these declarations will be included in the
# documentation.
HIDE_FRIEND_COMPOUNDS = NO
# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
# documentation blocks found inside the body of a function.
# If set to NO (the default) these blocks will be appended to the
# function's detailed documentation block.
HIDE_IN_BODY_DOCS = NO
# The INTERNAL_DOCS tag determines if documentation
# that is typed after a \internal command is included. If the tag is set
# to NO (the default) then the documentation will be excluded.
# Set it to YES to include the internal documentation.
INTERNAL_DOCS = NO
# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
# file names in lower-case letters. If set to YES upper-case letters are also
# allowed. This is useful if you have classes or files whose names only differ
# in case and if your file system supports case sensitive file names. Windows
# and Mac users are advised to set this option to NO.
CASE_SENSE_NAMES = NO
# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
# will show members with their full class and namespace scopes in the
# documentation. If set to YES the scope will be hidden.
HIDE_SCOPE_NAMES = NO
# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
# will put a list of the files that are included by a file in the documentation
# of that file.
SHOW_INCLUDE_FILES = YES
# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
# is inserted in the documentation for inline members.
INLINE_INFO = YES
# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
# will sort the (detailed) documentation of file and class members
# alphabetically by member name. If set to NO the members will appear in
# declaration order.
SORT_MEMBER_DOCS = YES
# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
# brief documentation of file, namespace and class members alphabetically
# by member name. If set to NO (the default) the members will appear in
# declaration order.
SORT_BRIEF_DOCS = NO
# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen
# will sort the (brief and detailed) documentation of class members so that
# constructors and destructors are listed first. If set to NO (the default)
# the constructors will appear in the respective orders defined by
# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS.
# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO
# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
SORT_MEMBERS_CTORS_1ST = NO
# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
# hierarchy of group names into alphabetical order. If set to NO (the default)
# the group names will appear in their defined order.
SORT_GROUP_NAMES = NO
# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
# sorted by fully-qualified names, including namespaces. If set to
# NO (the default), the class list will be sorted only by class name,
# not including the namespace part.
# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
# Note: This option applies only to the class list, not to the
# alphabetical list.
SORT_BY_SCOPE_NAME = NO
# The GENERATE_TODOLIST tag can be used to enable (YES) or
# disable (NO) the todo list. This list is created by putting \todo
# commands in the documentation.
GENERATE_TODOLIST = YES
# The GENERATE_TESTLIST tag can be used to enable (YES) or
# disable (NO) the test list. This list is created by putting \test
# commands in the documentation.
GENERATE_TESTLIST = YES
# The GENERATE_BUGLIST tag can be used to enable (YES) or
# disable (NO) the bug list. This list is created by putting \bug
# commands in the documentation.
GENERATE_BUGLIST = YES
# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
# disable (NO) the deprecated list. This list is created by putting
# \deprecated commands in the documentation.
GENERATE_DEPRECATEDLIST= YES
# The ENABLED_SECTIONS tag can be used to enable conditional
# documentation sections, marked by \if sectionname ... \endif.
ENABLED_SECTIONS =
# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
# the initial value of a variable or define consists of for it to appear in
# the documentation. If the initializer consists of more lines than specified
# here it will be hidden. Use a value of 0 to hide initializers completely.
# The appearance of the initializer of individual variables and defines in the
# documentation can be controlled using \showinitializer or \hideinitializer
# command in the documentation regardless of this setting.
MAX_INITIALIZER_LINES = 30
# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
# at the bottom of the documentation of classes and structs. If set to YES the
# list will mention the files that were used to generate the documentation.
SHOW_USED_FILES = YES
# If the sources in your project are distributed over multiple directories
# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
# in the documentation. The default is NO.
SHOW_DIRECTORIES = NO
# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
# This will remove the Files entry from the Quick Index and from the
# Folder Tree View (if specified). The default is YES.
SHOW_FILES = YES
# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
# Namespaces page. This will remove the Namespaces entry from the Quick Index
# and from the Folder Tree View (if specified). The default is YES.
SHOW_NAMESPACES = YES
# The FILE_VERSION_FILTER tag can be used to specify a program or script that
# doxygen should invoke to get the current version for each file (typically from
# the version control system). Doxygen will invoke the program by executing (via
# popen()) the command <command> <input-file>, where <command> is the value of
# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
# provided by doxygen. Whatever the program writes to standard output
# is used as the file version. See the manual for examples.
FILE_VERSION_FILTER =
# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
# doxygen. The layout file controls the global structure of the generated output files
# in an output format independent way. The create the layout file that represents
# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
# file name after the option, if omitted DoxygenLayout.xml will be used as the name
# of the layout file.
LAYOUT_FILE =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
# The QUIET tag can be used to turn on/off the messages that are generated
# by doxygen. Possible values are YES and NO. If left blank NO is used.
QUIET = NO
# The WARNINGS tag can be used to turn on/off the warning messages that are
# generated by doxygen. Possible values are YES and NO. If left blank
# NO is used.
WARNINGS = YES
# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
# automatically be disabled.
WARN_IF_UNDOCUMENTED = YES
# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
# potential errors in the documentation, such as not documenting some
# parameters in a documented function, or documenting parameters that
# don't exist or using markup commands wrongly.
WARN_IF_DOC_ERROR = YES
# This WARN_NO_PARAMDOC option can be abled to get warnings for
# functions that are documented, but have no documentation for their parameters
# or return value. If set to NO (the default) doxygen will only warn about
# wrong or incomplete parameter documentation, but not about the absence of
# documentation.
WARN_NO_PARAMDOC = NO
# The WARN_FORMAT tag determines the format of the warning messages that
# doxygen can produce. The string should contain the $file, $line, and $text
# tags, which will be replaced by the file and line number from which the
# warning originated and the warning text. Optionally the format may contain
# $version, which will be replaced by the version of the file (if it could
# be obtained via FILE_VERSION_FILTER)
WARN_FORMAT = "$file:$line: $text"
# The WARN_LOGFILE tag can be used to specify a file to which warning
# and error messages should be written. If left blank the output is written
# to stderr.
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
# The INPUT tag can be used to specify the files and/or directories that contain
# documented source files. You may enter file names like "myfile.cpp" or
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
INPUT = ../MBProgressHUD.h ../MBProgressHUD.m Classes
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
# also the default input encoding. Doxygen uses libiconv (or the iconv built
# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
# the list of possible encodings.
INPUT_ENCODING = UTF-8
# If the value of the INPUT tag contains directories, you can use the
# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
# and *.h) to filter out the source-files in the directories. If left
# blank the following patterns are tested:
# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
FILE_PATTERNS = *.c \
*.cc \
*.cxx \
*.cpp \
*.c++ \
*.d \
*.java \
*.ii \
*.ixx \
*.ipp \
*.i++ \
*.inl \
*.h \
*.hh \
*.hxx \
*.hpp \
*.h++ \
*.idl \
*.odl \
*.cs \
*.php \
*.php3 \
*.inc \
*.m \
*.mm \
*.dox \
*.py \
*.f90 \
*.f \
*.vhd \
*.vhdl
# The RECURSIVE tag can be used to turn specify whether or not subdirectories
# should be searched for input files as well. Possible values are YES and NO.
# If left blank NO is used.
RECURSIVE = NO
# The EXCLUDE tag can be used to specify files and/or directories that should
# excluded from the INPUT source files. This way you can easily exclude a
# subdirectory from a directory tree whose root is specified with the INPUT tag.
EXCLUDE =
# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
# directories that are symbolic links (a Unix filesystem feature) are excluded
# from the input.
EXCLUDE_SYMLINKS = NO
# If the value of the INPUT tag contains directories, you can use the
# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
# certain files from those directories. Note that the wildcards are matched
# against the file with absolute path, so to exclude all test directories
# for example use the pattern */test/*
EXCLUDE_PATTERNS =
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the
# output. The symbol name can be a fully qualified name, a word, or if the
# wildcard * is used, a substring. Examples: ANamespace, AClass,
# AClass::ANamespace, ANamespace::*Test
EXCLUDE_SYMBOLS =
# The EXAMPLE_PATH tag can be used to specify one or more files or
# directories that contain example code fragments that are included (see
# the \include command).
EXAMPLE_PATH =
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
# and *.h) to filter out the source-files in the directories. If left
# blank all files are included.
EXAMPLE_PATTERNS = *
# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
# searched for input files to be used with the \include or \dontinclude
# commands irrespective of the value of the RECURSIVE tag.
# Possible values are YES and NO. If left blank NO is used.
EXAMPLE_RECURSIVE = NO
# The IMAGE_PATH tag can be used to specify one or more files or
# directories that contain image that are included in the documentation (see
# the \image command).
IMAGE_PATH =
# The INPUT_FILTER tag can be used to specify a program that doxygen should
# invoke to filter for each input file. Doxygen will invoke the filter program
# by executing (via popen()) the command <filter> <input-file>, where <filter>
# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
# input file. Doxygen will then use the output that the filter program writes
# to standard output. If FILTER_PATTERNS is specified, this tag will be
# ignored.
INPUT_FILTER =
# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
# basis. Doxygen will compare the file name with each pattern and apply the
# filter if there is a match. The filters are a list of the form:
# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
# is applied to all files.
FILTER_PATTERNS =
# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
# INPUT_FILTER) will be used to filter the input files when producing source
# files to browse (i.e. when SOURCE_BROWSER is set to YES).
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
# If the SOURCE_BROWSER tag is set to YES then a list of source files will
# be generated. Documented entities will be cross-referenced with these sources.
# Note: To get rid of all source code in the generated output, make sure also
# VERBATIM_HEADERS is set to NO.
SOURCE_BROWSER = NO
# Setting the INLINE_SOURCES tag to YES will include the body
# of functions and classes directly in the documentation.
INLINE_SOURCES = NO
# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
# doxygen to hide any special comment blocks from generated source code
# fragments. Normal C and C++ comments will always remain visible.
STRIP_CODE_COMMENTS = YES
# If the REFERENCED_BY_RELATION tag is set to YES
# then for each documented function all documented
# functions referencing it will be listed.
REFERENCED_BY_RELATION = NO
# If the REFERENCES_RELATION tag is set to YES
# then for each documented function all documented entities
# called/used by that function will be listed.
REFERENCES_RELATION = NO
# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
# link to the source code. Otherwise they will link to the documentation.
REFERENCES_LINK_SOURCE = YES
# If the USE_HTAGS tag is set to YES then the references to source code
# will point to the HTML generated by the htags(1) tool instead of doxygen
# built-in source browser. The htags tool is part of GNU's global source
# tagging system (see http://www.gnu.org/software/global/global.html). You
# will need version 4.8.6 or higher.
USE_HTAGS = NO
# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
# will generate a verbatim copy of the header file for each class for
# which an include is specified. Set to NO to disable this.
VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
# of all compounds will be generated. Enable this if the project
# contains a lot of classes, structs, unions or interfaces.
ALPHABETICAL_INDEX = NO
# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
# in which this list will be split (can be a number in the range [1..20])
COLS_IN_ALPHA_INDEX = 5
# In case all classes in a project start with a common prefix, all
# classes will be put under the same header in the alphabetical index.
# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
# should be ignored while generating the index headers.
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
# generate HTML output.
GENERATE_HTML = YES
# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `html' will be used as the default path.
HTML_OUTPUT = html
# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
# doxygen will generate files with .html extension.
HTML_FILE_EXTENSION = .html
# The HTML_HEADER tag can be used to specify a personal HTML header for
# each generated HTML page. If it is left blank doxygen will generate a
# standard header.
HTML_HEADER =
# The HTML_FOOTER tag can be used to specify a personal HTML footer for
# each generated HTML page. If it is left blank doxygen will generate a
# standard footer.
HTML_FOOTER =
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
# style sheet that is used by each HTML page. It can be used to
# fine-tune the look of the HTML output. If the tag is left blank doxygen
# will generate a default style sheet. Note that doxygen will try to copy
# the style sheet file to the HTML output directory, so don't put your own
# stylesheet in the HTML output directory as well, or it will be erased!
HTML_STYLESHEET =
# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
# files or namespaces will be aligned in HTML using tables. If set to
# NO a bullet list will be used.
HTML_ALIGN_MEMBERS = YES
# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
# documentation will contain sections that can be hidden and shown after the
# page has loaded. For this to work a browser that supports
# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
HTML_DYNAMIC_SECTIONS = NO
# If the GENERATE_DOCSET tag is set to YES, additional index files
# will be generated that can be used as input for Apple's Xcode 3
# integrated development environment, introduced with OSX 10.5 (Leopard).
# To create a documentation set, doxygen will generate a Makefile in the
# HTML output directory. Running make will produce the docset in that
# directory and running "make install" will install the docset in
# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
# it at startup.
# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
GENERATE_DOCSET = YES
# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
# feed. A documentation feed provides an umbrella under which multiple
# documentation sets from a single provider (such as a company or product suite)
# can be grouped.
DOCSET_FEEDNAME = "Doxygen generated docs"
# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
# should uniquely identify the documentation set bundle. This should be a
# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
# will append .docset to the name.
DOCSET_BUNDLE_ID = org.doxygen.Project
# If the GENERATE_HTMLHELP tag is set to YES, additional index files
# will be generated that can be used as input for tools like the
# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
# of the generated HTML documentation.
GENERATE_HTMLHELP = NO
# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
# be used to specify the file name of the resulting .chm file. You
# can add a path in front of the file if the result should not be
# written to the html output directory.
CHM_FILE =
# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
# be used to specify the location (absolute path including file name) of
# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
# the HTML help compiler on the generated index.hhp.
HHC_LOCATION =
# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
# controls if a separate .chi index file is generated (YES) or that
# it should be included in the master .chm file (NO).
GENERATE_CHI = NO
# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
# is used to encode HtmlHelp index (hhk), content (hhc) and project file
# content.
CHM_INDEX_ENCODING =
# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
# controls whether a binary table of contents is generated (YES) or a
# normal table of contents (NO) in the .chm file.
BINARY_TOC = NO
# The TOC_EXPAND flag can be set to YES to add extra items for group members
# to the contents of the HTML help documentation and to the tree view.
TOC_EXPAND = NO
# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
# are set, an additional index file will be generated that can be used as input for
# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
# HTML documentation.
GENERATE_QHP = NO
# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
# be used to specify the file name of the resulting .qch file.
# The path specified is relative to the HTML output folder.
QCH_FILE =
# The QHP_NAMESPACE tag specifies the namespace to use when generating
# Qt Help Project output. For more information please see
# http://doc.trolltech.com/qthelpproject.html#namespace
QHP_NAMESPACE =
# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
# Qt Help Project output. For more information please see
# http://doc.trolltech.com/qthelpproject.html#virtual-folders
QHP_VIRTUAL_FOLDER = doc
# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
# For more information please see
# http://doc.trolltech.com/qthelpproject.html#custom-filters
QHP_CUST_FILTER_NAME =
# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
QHP_CUST_FILTER_ATTRS =
# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
# filter section matches.
# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
QHP_SECT_FILTER_ATTRS =
# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
# be used to specify the location of Qt's qhelpgenerator.
# If non-empty doxygen will try to run qhelpgenerator on the generated
# .qhp file.
QHG_LOCATION =
# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
# top of each HTML page. The value NO (the default) enables the index and
# the value YES disables it.
DISABLE_INDEX = NO
# This tag can be used to set the number of enum values (range [1..20])
# that doxygen will group on one line in the generated HTML documentation.
ENUM_VALUES_PER_LINE = 4
# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
# structure should be generated to display hierarchical information.
# If the tag value is set to YES, a side panel will be generated
# containing a tree-like index structure (just like the one that
# is generated for HTML Help). For this to work a browser that supports
# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
# Windows users are probably better off using the HTML help feature.
GENERATE_TREEVIEW = NO
# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
# and Class Hierarchy pages using a tree view instead of an ordered list.
USE_INLINE_TREES = NO
# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
# used to set the initial width (in pixels) of the frame in which the tree
# is shown.
TREEVIEW_WIDTH = 250
# Use this tag to change the font size of Latex formulas included
# as images in the HTML documentation. The default is 10. Note that
# when you change the font size after a successful doxygen run you need
# to manually remove any form_*.png images from the HTML output directory
# to force them to be regenerated.
FORMULA_FONTSIZE = 10
# When the SEARCHENGINE tag is enable doxygen will generate a search box
# for the HTML output. The underlying search engine uses javascript
# and DHTML and should work on any modern browser. Note that when using
# HTML help (GENERATE_HTMLHELP) or Qt help (GENERATE_QHP)
# there is already a search function so this one should typically
# be disabled.
SEARCHENGINE = NO
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
# generate Latex output.
GENERATE_LATEX = YES
# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `latex' will be used as the default path.
LATEX_OUTPUT = latex
# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
# invoked. If left blank `latex' will be used as the default command name.
LATEX_CMD_NAME = latex
# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
# generate index for LaTeX. If left blank `makeindex' will be used as the
# default command name.
MAKEINDEX_CMD_NAME = makeindex
# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
# LaTeX documents. This may be useful for small projects and may help to
# save some trees in general.
COMPACT_LATEX = NO
# The PAPER_TYPE tag can be used to set the paper type that is used
# by the printer. Possible values are: a4, a4wide, letter, legal and
# executive. If left blank a4wide will be used.
PAPER_TYPE = a4wide
# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
# packages that should be included in the LaTeX output.
EXTRA_PACKAGES =
# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
# the generated latex document. The header should contain everything until
# the first chapter. If it is left blank doxygen will generate a
# standard header. Notice: only use this tag if you know what you are doing!
LATEX_HEADER =
# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
# is prepared for conversion to pdf (using ps2pdf). The pdf file will
# contain links (just like the HTML output) instead of page references
# This makes the output suitable for online browsing using a pdf viewer.
PDF_HYPERLINKS = YES
# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
# plain latex in the generated Makefile. Set this option to YES to get a
# higher quality PDF documentation.
USE_PDFLATEX = YES
# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
# command to the generated LaTeX files. This will instruct LaTeX to keep
# running if errors occur, instead of asking the user for help.
# This option is also used when generating formulas in HTML.
LATEX_BATCHMODE = NO
# If LATEX_HIDE_INDICES is set to YES then doxygen will not
# include the index chapters (such as File Index, Compound Index, etc.)
# in the output.
LATEX_HIDE_INDICES = NO
# If LATEX_SOURCE_CODE is set to YES then doxygen will include
# source code with syntax highlighting in the LaTeX output.
# Note that which sources are shown also depends on other settings
# such as SOURCE_BROWSER.
LATEX_SOURCE_CODE = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
# The RTF output is optimized for Word 97 and may not look very pretty with
# other RTF readers or editors.
GENERATE_RTF = NO
# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `rtf' will be used as the default path.
RTF_OUTPUT = rtf
# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
# RTF documents. This may be useful for small projects and may help to
# save some trees in general.
COMPACT_RTF = NO
# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
# will contain hyperlink fields. The RTF file will
# contain links (just like the HTML output) instead of page references.
# This makes the output suitable for online browsing using WORD or other
# programs which support those fields.
# Note: wordpad (write) and others do not support links.
RTF_HYPERLINKS = NO
# Load stylesheet definitions from file. Syntax is similar to doxygen's
# config file, i.e. a series of assignments. You only have to provide
# replacements, missing definitions are set to their default value.
RTF_STYLESHEET_FILE =
# Set optional variables used in the generation of an rtf document.
# Syntax is similar to doxygen's config file.
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
# generate man pages
GENERATE_MAN = NO
# The MAN_OUTPUT tag is used to specify where the man pages will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `man' will be used as the default path.
MAN_OUTPUT = man
# The MAN_EXTENSION tag determines the extension that is added to
# the generated man pages (default is the subroutine's section .3)
MAN_EXTENSION = .3
# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
# then it will generate one additional man file for each entity
# documented in the real man page(s). These additional files
# only source the real man page, but without them the man command
# would be unable to find the correct page. The default is NO.
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
# If the GENERATE_XML tag is set to YES Doxygen will
# generate an XML file that captures the structure of
# the code including all documentation.
GENERATE_XML = NO
# The XML_OUTPUT tag is used to specify where the XML pages will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `xml' will be used as the default path.
XML_OUTPUT = xml
# The XML_SCHEMA tag can be used to specify an XML schema,
# which can be used by a validating XML parser to check the
# syntax of the XML files.
XML_SCHEMA =
# The XML_DTD tag can be used to specify an XML DTD,
# which can be used by a validating XML parser to check the
# syntax of the XML files.
XML_DTD =
# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
# dump the program listings (including syntax highlighting
# and cross-referencing information) to the XML output. Note that
# enabling this will significantly increase the size of the XML output.
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
# generate an AutoGen Definitions (see autogen.sf.net) file
# that captures the structure of the code including all
# documentation. Note that this feature is still experimental
# and incomplete at the moment.
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
# If the GENERATE_PERLMOD tag is set to YES Doxygen will
# generate a Perl module file that captures the structure of
# the code including all documentation. Note that this
# feature is still experimental and incomplete at the
# moment.
GENERATE_PERLMOD = NO
# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
# the necessary Makefile rules, Perl scripts and LaTeX code to be able
# to generate PDF and DVI output from the Perl module output.
PERLMOD_LATEX = NO
# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
# nicely formatted so it can be parsed by a human reader. This is useful
# if you want to understand what is going on. On the other hand, if this
# tag is set to NO the size of the Perl module output will be much smaller
# and Perl will parse it just the same.
PERLMOD_PRETTY = YES
# The names of the make variables in the generated doxyrules.make file
# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
# This is useful so different doxyrules.make files included by the same
# Makefile don't overwrite each other's variables.
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
# evaluate all C-preprocessor directives found in the sources and include
# files.
ENABLE_PREPROCESSING = YES
# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
# names in the source code. If set to NO (the default) only conditional
# compilation will be performed. Macro expansion can be done in a controlled
# way by setting EXPAND_ONLY_PREDEF to YES.
MACRO_EXPANSION = NO
# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
# then the macro expansion is limited to the macros specified with the
# PREDEFINED and EXPAND_AS_DEFINED tags.
EXPAND_ONLY_PREDEF = NO
# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
# in the INCLUDE_PATH (see below) will be search if a #include is found.
SEARCH_INCLUDES = YES
# The INCLUDE_PATH tag can be used to specify one or more directories that
# contain include files that are not input files but should be processed by
# the preprocessor.
INCLUDE_PATH =
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
# patterns (like *.h and *.hpp) to filter out the header-files in the
# directories. If left blank, the patterns specified with FILE_PATTERNS will
# be used.
INCLUDE_FILE_PATTERNS =
# The PREDEFINED tag can be used to specify one or more macro names that
# are defined before the preprocessor is started (similar to the -D option of
# gcc). The argument of the tag is a list of macros of the form: name
# or name=definition (no spaces). If the definition and the = are
# omitted =1 is assumed. To prevent a macro definition from being
# undefined via #undef or recursively expanded use the := operator
# instead of the = operator.
PREDEFINED =
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
# this tag can be used to specify a list of macro names that should be expanded.
# The macro definition that is found in the sources will be used.
# Use the PREDEFINED tag if you want to use a different macro definition.
EXPAND_AS_DEFINED =
# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
# doxygen's preprocessor will remove all function-like macros that are alone
# on a line, have an all uppercase name, and do not end with a semicolon. Such
# function macros are typically used for boiler-plate code, and will confuse
# the parser if not removed.
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references
#---------------------------------------------------------------------------
# The TAGFILES option can be used to specify one or more tagfiles.
# Optionally an initial location of the external documentation
# can be added for each tagfile. The format of a tag file without
# this location is as follows:
# TAGFILES = file1 file2 ...
# Adding location for the tag files is done as follows:
# TAGFILES = file1=loc1 "file2 = loc2" ...
# where "loc1" and "loc2" can be relative or absolute paths or
# URLs. If a location is present for each tag, the installdox tool
# does not have to be run to correct the links.
# Note that each tag file must have a unique name
# (where the name does NOT include the path)
# If a tag file is not located in the directory in which doxygen
# is run, you must also specify the path to the tagfile here.
TAGFILES =
# When a file name is specified after GENERATE_TAGFILE, doxygen will create
# a tag file that is based on the input files it reads.
GENERATE_TAGFILE =
# If the ALLEXTERNALS tag is set to YES all external classes will be listed
# in the class index. If set to NO only the inherited external classes
# will be listed.
ALLEXTERNALS = NO
# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
# in the modules index. If set to NO, only the current project's groups will
# be listed.
EXTERNAL_GROUPS = YES
# The PERL_PATH should be the absolute path and name of the perl script
# interpreter (i.e. the result of `which perl').
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
# or super classes. Setting the tag to NO turns the diagrams off. Note that
# this option is superseded by the HAVE_DOT option below. This is only a
# fallback. It is recommended to install and use dot, since it yields more
# powerful graphs.
CLASS_DIAGRAMS = YES
# You can define message sequence charts within doxygen comments using the \msc
# command. Doxygen will then run the mscgen tool (see
# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
# documentation. The MSCGEN_PATH tag allows you to specify the directory where
# the mscgen tool resides. If left empty the tool is assumed to be found in the
# default search path.
MSCGEN_PATH =
# If set to YES, the inheritance and collaboration graphs will hide
# inheritance and usage relations if the target is undocumented
# or is not a class.
HIDE_UNDOC_RELATIONS = YES
# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
# available from the path. This tool is part of Graphviz, a graph visualization
# toolkit from AT&T and Lucent Bell Labs. The other options in this section
# have no effect if this option is set to NO (the default)
HAVE_DOT = NO
# By default doxygen will write a font called FreeSans.ttf to the output
# directory and reference it in all dot files that doxygen generates. This
# font does not include all possible unicode characters however, so when you need
# these (or just want a differently looking font) you can specify the font name
# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
# which can be done by putting it in a standard location or by setting the
# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
# containing the font.
DOT_FONTNAME = FreeSans
# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
# The default size is 10pt.
DOT_FONTSIZE = 10
# By default doxygen will tell dot to use the output directory to look for the
# FreeSans.ttf font (which doxygen will put there itself). If you specify a
# different font using DOT_FONTNAME you can set the path where dot
# can find it using this tag.
DOT_FONTPATH =
# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
# will generate a graph for each documented class showing the direct and
# indirect inheritance relations. Setting this tag to YES will force the
# the CLASS_DIAGRAMS tag to NO.
CLASS_GRAPH = YES
# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
# will generate a graph for each documented class showing the direct and
# indirect implementation dependencies (inheritance, containment, and
# class references variables) of the class with other documented classes.
COLLABORATION_GRAPH = YES
# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
# will generate a graph for groups, showing the direct groups dependencies
GROUP_GRAPHS = YES
# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
# collaboration diagrams in a style similar to the OMG's Unified Modeling
# Language.
UML_LOOK = NO
# If set to YES, the inheritance and collaboration graphs will show the
# relations between templates and their instances.
TEMPLATE_RELATIONS = NO
# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
# tags are set to YES then doxygen will generate a graph for each documented
# file showing the direct and indirect include dependencies of the file with
# other documented files.
INCLUDE_GRAPH = YES
# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
# documented header file showing the documented files that directly or
# indirectly include this file.
INCLUDED_BY_GRAPH = YES
# If the CALL_GRAPH and HAVE_DOT options are set to YES then
# doxygen will generate a call dependency graph for every global function
# or class method. Note that enabling this option will significantly increase
# the time of a run. So in most cases it will be better to enable call graphs
# for selected functions only using the \callgraph command.
CALL_GRAPH = NO
# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
# doxygen will generate a caller dependency graph for every global function
# or class method. Note that enabling this option will significantly increase
# the time of a run. So in most cases it will be better to enable caller
# graphs for selected functions only using the \callergraph command.
CALLER_GRAPH = NO
# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
# will graphical hierarchy of all classes instead of a textual one.
GRAPHICAL_HIERARCHY = YES
# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
# then doxygen will show the dependencies a directory has on other directories
# in a graphical way. The dependency relations are determined by the #include
# relations between the files in the directories.
DIRECTORY_GRAPH = YES
# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
# generated by dot. Possible values are png, jpg, or gif
# If left blank png will be used.
DOT_IMAGE_FORMAT = png
# The tag DOT_PATH can be used to specify the path where the dot tool can be
# found. If left blank, it is assumed the dot tool can be found in the path.
DOT_PATH =
# The DOTFILE_DIRS tag can be used to specify one or more directories that
# contain dot files that are included in the documentation (see the
# \dotfile command).
DOTFILE_DIRS =
# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
# nodes that will be shown in the graph. If the number of nodes in a graph
# becomes larger than this value, doxygen will truncate the graph, which is
# visualized by representing a node as a red box. Note that doxygen if the
# number of direct children of the root node in a graph is already larger than
# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
DOT_GRAPH_MAX_NODES = 50
# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
# graphs generated by dot. A depth value of 3 means that only nodes reachable
# from the root by following a path via at most 3 edges will be shown. Nodes
# that lay further from the root node will be omitted. Note that setting this
# option to 1 or 2 may greatly reduce the computation time needed for large
# code bases. Also note that the size of a graph can be further restricted by
# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
MAX_DOT_GRAPH_DEPTH = 0
# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
# background. This is disabled by default, because dot on Windows does not
# seem to support this out of the box. Warning: Depending on the platform used,
# enabling this option may lead to badly anti-aliased labels on the edges of
# a graph (i.e. they become hard to read).
DOT_TRANSPARENT = NO
# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
# files in one run (i.e. multiple -o and -T options on the command line). This
# makes dot run faster, but since only newer versions of dot (>1.8.10)
# support this, this feature is disabled by default.
DOT_MULTI_TARGETS = NO
# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
# generate a legend page explaining the meaning of the various boxes and
# arrows in the dot generated graphs.
GENERATE_LEGEND = YES
# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
# remove the intermediate dot files that are used to generate
# the various graphs.
DOT_CLEANUP = YES
| {
"pile_set_name": "Github"
} |
{
"network": [
[
"probeNetwork - default - end",
1,
84942
],
[
"probeNetwork - default - start",
0,
0
]
],
"gfx": [
[
"probeGFX - default - end",
2,
12,
27,
1,
[
150144,
150144
],
[
406,
406
],
[
3744,
3744
]
]
]
} | {
"pile_set_name": "Github"
} |
register_shims_scalar <- function(env) {
env_bind(env,
sample = strict_sample,
diag = strict_diag
)
}
#' Strict behaviour for functions with special scalar behaviour
#'
#' [sample()] and [diag()] behave differently depending on whether their
#' first argument is a scalar or a function. These shims throw an error
#' when given a scalar to force you to pick a safer alternative.
#'
#' @param x,size,replace,prob,nrow,ncol Passed on to [sample()] and [diag()]
#' @export
#' @examples
#' lax({
#' sample(5:3)
#' sample(5:4)
#' sample(5:5)
#'
#' diag(5:3)
#' diag(5:4)
#' diag(5:5)
#' })
#'
#' \dontrun{
#' sample(5:5)
#' diag(5)
#' }
strict_sample <- function(x, size = length(x), replace = FALSE, prob = NULL) {
if (length(x) == 1) {
strict_abort(
"`sample()` has surprising behaviour when `x` is a scalar.\n",
"Use `sample.int()` instead.",
help = "strict_sample"
)
} else {
sample(
x = x,
size = size,
replace = replace,
prob = prob
)
}
}
#' @export
#' @rdname strict_sample
strict_diag <- function(x = 1, nrow, ncol) {
if (length(x) == 1) {
strict_abort(
"`diag()` has surprising behaviour when `x` is a scalar.\n",
"Use `diag(rep(1, x))` instead.",
help = "strict_diag"
)
} else {
base::diag(x = x, nrow = nrow, ncol = ncol)
}
}
| {
"pile_set_name": "Github"
} |
// Like the compiler, the static analyzer treats some functions differently if
// they come from a system header -- for example, it is assumed that system
// functions do not arbitrarily free() their parameters, and that some bugs
// found in system headers cannot be fixed by the user and should be
// suppressed.
#pragma clang system_header
typedef __typeof(sizeof(int)) size_t;
void *malloc(size_t);
void *calloc(size_t, size_t);
void free(void *);
#if __OBJC__
#import "system-header-simulator-objc.h"
@interface Wrapper : NSData
- (id)initWithBytesNoCopy:(void *)bytes length:(NSUInteger)len;
@end
@implementation Wrapper
- (id)initWithBytesNoCopy:(void *)bytes length:(NSUInteger)len {
return [self initWithBytesNoCopy:bytes length:len freeWhenDone:1]; // no-warning
}
@end
@interface CustomData : NSData
+ (id)somethingNoCopy:(char *)bytes;
+ (id)somethingNoCopy:(void *)bytes length:(NSUInteger)length freeWhenDone:(BOOL)freeBuffer;
+ (id)something:(char *)bytes freeWhenDone:(BOOL)freeBuffer;
@end
#endif
| {
"pile_set_name": "Github"
} |
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
if ! grep -e "^127\.0\.1\.1.*`hostname`.*" /etc/hosts > /dev/null ; then
echo "127.0.1.1 `hostname`" >> /etc/hosts
fi
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Dialog example - jQuery Mobile Demos</title>
<link rel="stylesheet" href="../css/themes/default/jquery.mobile-1.4.5.min.css">
<link rel="stylesheet" href="../_assets/css/jqm-demos.css">
<link rel="shortcut icon" href="../favicon.ico">
<script src="../js/jquery.js"></script>
<script src="../_assets/js/index.js"></script>
<script src="../js/jquery.mobile-1.4.5.min.js"></script>
</head>
<body>
<div data-role="page" data-corners="false" data-dialog="true">
<div data-role="header">
<h1>Dialog</h1>
</div>
<div role="main" class="ui-content">
<h1>No rounded corners</h1>
<p>This is a regular page, styled as a dialog. To create a dialog, just link to a normal page and include a transition and <code>data-rel="dialog"</code> attribute.</p>
<a href="index.html" data-rel="back" class="ui-btn ui-shadow ui-corner-all ui-btn-b">Ok, I get it</a>
</div>
</div>
</body>
</html>
| {
"pile_set_name": "Github"
} |
/**
* Cookie.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
(function() {
var each = tinymce.each;
/**
* This class contains simple cookie manangement functions.
*
* @class tinymce.util.Cookie
* @static
* @example
* // Gets a cookie from the browser
* console.debug(tinymce.util.Cookie.get('mycookie'));
*
* // Gets a hash table cookie from the browser and takes out the x parameter from it
* console.debug(tinymce.util.Cookie.getHash('mycookie').x);
*
* // Sets a hash table cookie to the browser
* tinymce.util.Cookie.setHash({x : '1', y : '2'});
*/
tinymce.create('static tinymce.util.Cookie', {
/**
* Parses the specified query string into an name/value object.
*
* @method getHash
* @param {String} n String to parse into a n Hashtable object.
* @return {Object} Name/Value object with items parsed from querystring.
*/
getHash : function(n) {
var v = this.get(n), h;
if (v) {
each(v.split('&'), function(v) {
v = v.split('=');
h = h || {};
h[unescape(v[0])] = unescape(v[1]);
});
}
return h;
},
/**
* Sets a hashtable name/value object to a cookie.
*
* @method setHash
* @param {String} n Name of the cookie.
* @param {Object} v Hashtable object to set as cookie.
* @param {Date} e Optional date object for the expiration of the cookie.
* @param {String} p Optional path to restrict the cookie to.
* @param {String} d Optional domain to restrict the cookie to.
* @param {String} s Is the cookie secure or not.
*/
setHash : function(n, v, e, p, d, s) {
var o = '';
each(v, function(v, k) {
o += (!o ? '' : '&') + escape(k) + '=' + escape(v);
});
this.set(n, o, e, p, d, s);
},
/**
* Gets the raw data of a cookie by name.
*
* @method get
* @param {String} n Name of cookie to retrive.
* @return {String} Cookie data string.
*/
get : function(n) {
var c = document.cookie, e, p = n + "=", b;
// Strict mode
if (!c)
return;
b = c.indexOf("; " + p);
if (b == -1) {
b = c.indexOf(p);
if (b !== 0)
return null;
} else
b += 2;
e = c.indexOf(";", b);
if (e == -1)
e = c.length;
return unescape(c.substring(b + p.length, e));
},
/**
* Sets a raw cookie string.
*
* @method set
* @param {String} n Name of the cookie.
* @param {String} v Raw cookie data.
* @param {Date} e Optional date object for the expiration of the cookie.
* @param {String} p Optional path to restrict the cookie to.
* @param {String} d Optional domain to restrict the cookie to.
* @param {String} s Is the cookie secure or not.
*/
set : function(n, v, e, p, d, s) {
document.cookie = n + "=" + escape(v) +
((e) ? "; expires=" + e.toGMTString() : "") +
((p) ? "; path=" + escape(p) : "") +
((d) ? "; domain=" + d : "") +
((s) ? "; secure" : "");
},
/**
* Removes/deletes a cookie by name.
*
* @method remove
* @param {String} name Cookie name to remove/delete.
* @param {Strong} path Optional path to remove the cookie from.
* @param {Strong} domain Optional domain to restrict the cookie to.
*/
remove : function(name, path, domain) {
var date = new Date();
date.setTime(date.getTime() - 1000);
this.set(name, '', date, path, domain);
}
});
})();
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<xs:schema elementFormDefault="qualified" version="1.0"
targetNamespace="http://foo.com/bar"
xmlns:tns="http://foo.com/bar"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="mail">
<xs:complexType>
<xs:sequence>
<xs:element name="subject" type="xs:string"/>
<xs:element name="body" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
| {
"pile_set_name": "Github"
} |
// Text truncate
// Requires inline-block or block for proper styling
@mixin text-truncate() {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
| {
"pile_set_name": "Github"
} |
azure.mgmt.eventhub.v2017_04_01 package
=======================================
Submodules
----------
.. toctree::
azure.mgmt.eventhub.v2017_04_01.models
azure.mgmt.eventhub.v2017_04_01.operations
Module contents
---------------
.. automodule:: azure.mgmt.eventhub.v2017_04_01
:members:
:undoc-members:
:show-inheritance:
| {
"pile_set_name": "Github"
} |
// Copyright 2017 Google Inc.
// Copyright 2020 The Open GEE Contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#include "PacketFileAdaptingTraverser.h"
#include <khstl.h>
#include <khException.h>
#include <packetfile/packetfile.h>
#include <packetfile/packetindex.h>
namespace geindex {
template <class TypedBucket>
PacketFileAdaptingTraverserBase<TypedBucket>::PacketFileAdaptingTraverserBase(
geFilePool &file_pool,
const std::string &merge_source_name,
TypedEntry::TypeEnum type,
std::uint32_t version,
std::uint32_t channel,
const std::string packetfile) :
AdaptingTraverserBase<TypedBucket>(merge_source_name, type),
packet_index_reader_(
TransferOwnership(
new PacketIndexReader(file_pool,
PacketFile::IndexFilename(packetfile)))),
version_(version),
channel_(channel),
have_current_(false)
{
ReadNext();
if (!have_current_) {
QString warn(kh::tr("%1 is empty").arg(packetfile));
notify(NFY_WARN, "%s", warn.latin1());
}
}
template <class TypedBucket>
PacketFileAdaptingTraverserBase<TypedBucket>::~PacketFileAdaptingTraverserBase(void) {
// here in cpp so packetfile.h doesn't have to be included in the header
}
template <class TypedBucket>
bool PacketFileAdaptingTraverserBase<TypedBucket>::Advance() {
ReadNext();
return have_current_;
}
template <class TypedBucket>
void PacketFileAdaptingTraverserBase<TypedBucket>::Close() {
have_current_ = false;
packet_index_reader_.clear();
}
// specialization for AllInfoBucket
template <>
void PacketFileAdaptingTraverserBase<AllInfoBucket>::ReadNext(void) {
PacketIndexEntry entry;
have_current_ = packet_index_reader_->ReadNext(&entry);
if (have_current_) {
curr_merge_entry_ =
MergeEntry(entry.qt_path(),
makevec1(EntryType(ExternalDataAddress(entry.position(),
0 /* file num */,
entry.record_size()),
version_, channel_,
entry.extra(),
type_)));
}
}
// specialization for UnifiedBucket
template <>
void PacketFileAdaptingTraverserBase<UnifiedBucket>::ReadNext(void) {
PacketIndexEntry entry;
have_current_ = packet_index_reader_->ReadNext(&entry);
if (have_current_) {
curr_merge_entry_ =
MergeEntry(entry.qt_path(),
makevec1(EntryType(ExternalDataAddress(entry.position(),
0 /* file num */,
entry.record_size()),
version_, channel_,
type_)));
}
}
// ****************************************************************************
// *** Explicit instantiations
// ****************************************************************************
template class PacketFileAdaptingTraverserBase<UnifiedBucket>;
template class PacketFileAdaptingTraverserBase<AllInfoBucket>;
} // namespace geindex
| {
"pile_set_name": "Github"
} |
#!/usr/bin/env python
#
# OpenSlide, a library for reading whole slide image files
#
# Copyright (c) 2012-2015 Carnegie Mellon University
# Copyright (c) 2015-2016 Benjamin Gilbert
# All rights reserved.
#
# OpenSlide 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, version 2.1.
#
# OpenSlide 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 OpenSlide. If not, see
# <http://www.gnu.org/licenses/>.
#
from ConfigParser import RawConfigParser
from contextlib import closing, contextmanager
import filecmp
import fnmatch
from hashlib import sha256
import inspect
import os
import re
import requests
import shlex
from shutil import copytree, rmtree
import socket
import struct
import subprocess
import sys
import tarfile
from tempfile import mkdtemp, TemporaryFile, NamedTemporaryFile
import textwrap
from time import time as curtime
from urlparse import urljoin
import yaml
from zipfile import ZipFile
TESTDATA_URL = 'http://openslide.cs.cmu.edu/download/openslide-testdata/'
VALGRIND_SUPPRESSIONS = '!!SRCDIR!!/valgrind.supp'
CASEROOT = '!!SRCDIR!!/cases'
SLIDELIST = '!!SRCDIR!!/cases/slides.yaml'
MOSAICLIST = '!!SRCDIR!!/cases/mosaic.ini'
WORKROOT = '!!BUILDDIR!!/_slidedata'
PRISTINE = '!!BUILDDIR!!/_slidedata/_pristine'
FEATURES = set('!!FEATURES!!'.split())
TESTCONF = 'config.yaml'
GREEN = '\033[1;32m'
BLUE = '\033[1;34m'
RED = '\033[1;31m'
RESET = '\033[1;0m'
_commands = []
_command_funcs = {}
SKIP = object()
if '!!CYGWIN_CROSS_TEST!!':
import ctypes
_cygwin = ctypes.CDLL('cygwin1.dll', use_errno=True)
_cygwin_conv_path = _cygwin.cygwin_conv_path
_cygwin_conv_path.argtypes = [ctypes.c_uint, ctypes.c_void_p,
ctypes.c_void_p, ctypes.c_size_t]
_cygwin_conv_path.restype = ctypes.c_ssize_t
def native_path(path):
flags = 0x100 # CCP_POSIX_TO_WIN_A | CCP_RELATIVE
size = _cygwin_conv_path(flags, path, None, 0)
if size == -1:
raise OSError(ctypes.get_errno(), "Couldn't convert path")
buf = ctypes.create_string_buffer(size)
if _cygwin_conv_path(flags, path, buf, size) == -1:
raise OSError(ctypes.get_errno(), "Couldn't convert path")
return buf.value
def symlink(src, dst):
if not os.path.isabs(src):
src = os.path.abspath(os.path.join(os.path.dirname(dst), src))
subprocess.check_call(['!!BUILDDIR!!/symlink', native_path(src),
native_path(dst)])
else:
native_path = lambda p: p
symlink = os.symlink
class ConnectionInterrupted(Exception):
pass
def _command(f):
'''Decorator to mark the function as a user command.'''
_commands.append(f.func_name)
_command_funcs[f.func_name] = f
return f
def _color(color, str):
'''Return str, wrapped in the specified ANSI color escape sequence.'''
return color + str + RESET
def _list_tests(pattern='*'):
'''Return a list of test names matching the specified pattern.'''
return [name for name in sorted(os.listdir(CASEROOT))
if fnmatch.fnmatch(name, pattern)
and os.path.exists(os.path.join(CASEROOT, name, TESTCONF))]
def _list_slide_files(slide):
'''List relative paths of files within a slide. slide is e.g.
"Mirax/CMU-1.zip".'''
def walk(basedir):
files = []
for name in os.listdir(basedir):
path = os.path.join(basedir, name)
if os.path.isdir(path):
files.extend(os.path.join(name, p) for p in walk(path))
else:
files.append(name)
return files
return walk(os.path.join(PRISTINE, slide))
def _load_test_config(testname):
'''Parse and return the config.yaml for the specified test.'''
with open(os.path.join(CASEROOT, testname, TESTCONF)) as fh:
return yaml.safe_load(fh)
def _features_available(conf):
'''Return True if the features required by the test configuration
are available in this build.'''
for feature in conf.get('requires', []):
if feature not in FEATURES:
return False
return True
def _is_bigtiff(path):
'''Return True if the specified file is a BigTIFF.'''
try:
with open(path, 'rb') as fh:
# Check endianness
sig = fh.read(2)
if sig == 'II':
fmt = '<'
elif sig == 'MM':
fmt = '>'
else:
return False
# Check magic number
fmt += 'H'
magic = struct.unpack(fmt, fh.read(struct.calcsize(fmt)))[0]
return magic == 43
except IOError:
return False
def _launch_test(test, slidefile, valgrind=False, extra_checks=True,
testdir=None, debug=[], args=[], **kwargs):
'''Start the specified test from the testdir directory against the
specified slide, running under Valgrind if requested. If extra_checks
is False, turn off debug instrumentation that would invalidate benchmark
results. debug options are passed in OPENSLIDE_DEBUG. args are
appended to the command line. kwargs are passed to the Popen
constructor. Return the Popen instance.'''
if testdir is None:
testdir = '!!BUILDDIR!!'
env = os.environ.copy()
env.update(
G_MESSAGES_DEBUG='',
OPENSLIDE_DEBUG=','.join(debug),
GIO_USE_VFS='local',
)
if extra_checks:
env.update(
G_DEBUG='gc-friendly',
G_SLICE='always-malloc',
MALLOC_CHECK_='1',
)
args = [os.path.join(testdir, test), native_path(slidefile)] + args
if valgrind:
args = [os.path.join(testdir, '../libtool'), '--mode=execute',
'valgrind', '--quiet', '--error-exitcode=3',
'--suppressions=' + VALGRIND_SUPPRESSIONS,
'--leak-check=full', '--num-callers=30'] + args
elif extra_checks:
# debug-blocks retains pointers to freed slices, so don't use it
# with Valgrind
env['G_SLICE'] += ',debug-blocks'
return subprocess.Popen(args, env=env, **kwargs)
def _try_open_slide(slidefile, valgrind=False, testdir=None, debug=[],
vendor=SKIP, properties={}, regions=[]):
'''Try opening the specified slide file, under Valgrind if specified,
using the test program in the testdir directory. Return None on
success, error message on failure. vendor is the vendor string that
should be returned by openslide_detect_vendor(), None for NULL, or SKIP
to omit the test. properties is a map of slide properties and their
expected values. regions is a list of region tuples (x, y, level, w,
h). debug is a list of OPENSLIDE_DEBUG options.'''
args = []
if vendor is not SKIP:
args.extend(['-n', 'none' if vendor is None else vendor])
for k, v in properties.iteritems():
args.extend(['-p', '='.join([k, (v or '')])])
for region in regions:
args.extend(['-r', ' '.join(str(d) for d in region)])
proc = _launch_test('try_open', slidefile, valgrind=valgrind, args=args,
testdir=testdir, debug=debug, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
out, err = proc.communicate()
if out or err or proc.returncode > 0:
return (out + err).strip()
elif proc.returncode:
return 'Exited with status %d' % proc.returncode
else:
return None
def _try_extended(slidefile, valgrind=False, testdir=None):
'''Run the extended test program against the specified slide file, under
Valgrind if specified, using the test program in the testdir directory.
Return None on success, error message on failure.'''
proc = _launch_test('extended', slidefile, valgrind=valgrind,
testdir=testdir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = proc.communicate()
if out or err:
return (out + err).strip()
elif proc.returncode:
return 'Exited with status %d' % proc.returncode
else:
return None
def _download(url, name, fh):
'''Download the specified URL, write to the specified file handle, and
return the SHA-256 of the data. Raise ConnectionInterrupted on timeout
or short read.'''
print 'Fetching %s...\r' % name,
sys.stdout.flush()
r = requests.get(url, stream=True, timeout=120)
r.raise_for_status()
cur = 0
last_update = 0
size = int(r.headers['Content-Length'])
hash = sha256()
try:
for chunk in r.iter_content(128 << 10):
fh.write(chunk)
hash.update(chunk)
cur += len(chunk)
now = curtime()
if now - last_update >= 1:
print 'Fetching %s (%d/%d MB)...\r' % (name, cur >> 20,
size >> 20),
sys.stdout.flush()
last_update = now
if cur != size:
raise ConnectionInterrupted
except (ConnectionInterrupted,
requests.exceptions.Timeout,
socket.timeout):
print '%-79s' % ('Failure fetching %s (%d/%d MB)' % (name,
cur >> 20, size >> 20))
raise ConnectionInterrupted
else:
print '%-79s' % ('Fetched %s (%d MB)' % (name, size >> 20))
return hash.hexdigest()
def _fetch_one(slide):
'''Download and unpack the base slide if we don't already have it.'''
destpath = os.path.join(PRISTINE, slide)
if os.path.exists(destpath):
return
with open(SLIDELIST) as fh:
slides = yaml.safe_load(fh)
if slide not in slides:
raise ValueError('%s not in %s' % (slide, SLIDELIST))
filename = os.path.basename(slide)
url = urljoin(TESTDATA_URL, slide)
is_zip = os.path.splitext(filename)[1] == '.zip'
os.makedirs(destpath)
try:
if is_zip:
dest = TemporaryFile()
else:
dest = open(os.path.join(destpath, filename), 'wb')
with dest:
for retries_remaining in range(4, -1, -1):
try:
digest = _download(url, slide, dest)
except ConnectionInterrupted:
if retries_remaining == 0:
raise
else:
print 'Retrying...'
dest.seek(0)
dest.truncate()
else:
break
if digest != slides[slide]:
raise ValueError('Hash mismatch: %s' % slide)
if is_zip:
print 'Unpacking %s...' % slide
with closing(ZipFile(dest)) as zf:
zf.extractall(path=destpath)
except:
rmtree(destpath, ignore_errors=True)
raise
@_command
def create(slide, testname):
'''Create a new test case with the specified name and base slide (e.g.
"Mirax/CMU-1.zip").'''
srcpath = os.path.join(PRISTINE, slide)
testpath = os.path.join(CASEROOT, testname)
destpath = os.path.join(testpath, 'slide')
if os.path.exists(testpath):
raise ValueError('A test with that name already exists')
_fetch_one(slide)
print 'Creating test %s for %s' % (testname, slide)
for relpath in _list_slide_files(slide):
curpath = os.path.join(srcpath, relpath)
if _try_open_slide(curpath) is None:
slidefile = relpath
slidepath = curpath
break
else:
raise IOError('Could not locate readable slide file')
query = _launch_test('query', slidepath, args=['-n'],
stdout=subprocess.PIPE)
vendor, _ = query.communicate()
if query.returncode:
raise IOError('Could not query slide vendor')
vendor = vendor.strip() or None
os.mkdir(testpath)
copytree(srcpath, destpath)
conf = {
'success': False,
'error': '^$',
'base': slide,
'slide': slidefile,
'vendor': vendor,
}
if _is_bigtiff(slidepath):
conf['requires'] = ['libtiff-4']
with open(os.path.join(testpath, TESTCONF), 'w') as fh:
yaml.safe_dump(conf, fh, default_flow_style=False)
@_command
def pack(testname):
'''Pack a newly-created test case for checkin.'''
if not os.path.exists(os.path.join(CASEROOT, testname, TESTCONF)):
raise ValueError('Test does not exist')
print 'Packing %s...' % testname
conf = _load_test_config(testname)
slide = conf['base']
total_size = 0
for relpath in _list_slide_files(slide):
origpath = os.path.join(PRISTINE, slide, relpath)
newpath = os.path.join(CASEROOT, testname, 'slide', relpath)
deltapath = os.path.join(CASEROOT, testname,
os.path.basename(relpath) + '.xdelta')
whiteoutpath = os.path.join(CASEROOT, testname,
os.path.basename(relpath) + '.whiteout')
for path in deltapath, whiteoutpath:
if os.path.exists(path):
raise IOError('%s already exists' % path)
if os.path.exists(newpath):
if not filecmp.cmp(origpath, newpath, shallow=False):
subprocess.check_call(['xdelta3', 'encode', '-9', '-W',
'16777216', '-S', 'none', '-s', origpath, newpath,
deltapath])
total_size += os.stat(deltapath).st_size
else:
open(whiteoutpath, 'w').close()
rmtree(os.path.join(CASEROOT, testname, 'slide'))
total_size_kb = total_size >> 10
if total_size_kb:
print 'Delta: %d KB' % total_size_kb
else:
print 'Delta: %d bytes' % total_size
def _run_generator(command_str, inpath, outpath):
'''Run the specified generator pipeline.'''
cmds = command_str.split('|')
procs = []
fin = []
fout = []
try:
fin.append(None)
for _ in range(len(cmds) - 1):
pipe_r, pipe_w = os.pipe()
fout.append(pipe_w)
fin.append(pipe_r)
fout.append(None)
for i, cmd in enumerate(cmds):
proc = subprocess.Popen([a % {'in': inpath, 'out': outpath}
for a in shlex.split(cmd)],
stdin=fin[i], stdout=fout[i], close_fds=True)
procs.append(proc)
finally:
for fh in fout + fin:
if fh is not None:
os.close(fh)
returncode = 0
for proc in procs:
proc.wait()
returncode = returncode or proc.returncode
if returncode:
raise IOError('Generator returned exit status %d' % returncode)
def _unpack_one(testname):
'''Unpack the specified test.'''
conf = _load_test_config(testname)
slide = conf['base']
renames = conf.get('rename', {})
generators = conf.get('generate', {})
printed = False
_fetch_one(slide)
for relpath in _list_slide_files(slide):
origpath = os.path.join(PRISTINE, slide, relpath)
newpath = os.path.join(WORKROOT, testname,
renames.get(os.path.basename(relpath), relpath))
deltapath = os.path.join(CASEROOT, testname,
os.path.basename(relpath) + '.xdelta')
whiteoutpath = os.path.join(CASEROOT, testname,
os.path.basename(relpath) + '.whiteout')
if not os.path.exists(newpath) and not os.path.exists(whiteoutpath):
if not printed:
print 'Unpacking %s...' % testname
printed = True
newdir = os.path.dirname(newpath)
if not os.path.exists(newdir):
os.makedirs(newdir)
generator = generators.get(os.path.basename(relpath))
if generator:
_run_generator(generator, origpath, newpath)
elif os.path.exists(deltapath):
subprocess.check_call(['xdelta3', 'decode', '-s',
origpath, deltapath, newpath])
else:
src = os.path.relpath(origpath, os.path.dirname(newpath))
symlink(src, newpath)
@_command
def unpack(pattern='*'):
'''Unpack all tests matching the specified pattern.'''
for testname in _list_tests(pattern):
_unpack_one(testname)
def _run_one(testname, valgrind=False, xfail=False, testdir=None):
'''Run the specified test, under Valgrind if specified. Also execute
extended tests against cases which 1) are marked primary, 2) are expected
to succeed, and 3) do in fact succeed. If xfail is specified, invert
the sense of the result.'''
conf = _load_test_config(testname)
if not _features_available(conf):
print _color(BLUE, '%s: skipped' % testname)
return True
slidefile = os.path.join(WORKROOT, testname, conf['slide'])
result = _try_open_slide(slidefile, valgrind, testdir,
vendor=conf.get('vendor', None),
properties=conf.get('properties', {}),
regions=conf.get('regions', []),
debug=conf.get('debug', []))
msg = _color(GREEN, '%s: OK' % testname)
ok = True
if result is None and not conf['success']:
msg = _color(RED, '%s: unexpected success' % testname)
ok = False
elif result is not None and conf['success']:
msg = _color(RED, '%s: unexpected failure: %s' % (testname, result))
ok = False
elif result is not None and not re.search(conf['error'], result):
msg = _color(RED, '%s: incorrect error: %s' % (testname, result))
ok = False
elif conf.get('primary', False) and conf['success']:
result = _try_extended(slidefile, valgrind, testdir)
if result:
msg = _color(RED, '%s: extended test failed: %s' % (testname,
result))
ok = False
if xfail:
ok = not ok
if ok:
msg = _color(BLUE, '%s: failed as expected' % testname)
else:
msg = _color(RED, '%s: expected to fail, but passed' % testname)
print msg
return ok
def _run_all(pattern='*', valgrind=False, xfail=None, testdir=None):
'''Run all tests matching the specified pattern, under Valgrind if
specified. xfail specifies a list of tests which are expected to fail.
Return the number of tests producing unexpected results.'''
tests = _list_tests(pattern)
for testname in tests:
_unpack_one(testname)
failed = 0
xfail = set(xfail or [])
for testname in tests:
if not _run_one(testname, valgrind, testname in xfail, testdir):
failed += 1
print '\nFailed: %d/%d' % (failed, len(tests))
return failed
@_command
def run(pattern='*'):
'''Unpack and run all tests matching the specified pattern. Ignore
failures of test cases listed in the comma-separated
OPENSLIDE_TEST_XFAIL environment variable.'''
xfail = os.environ.get('OPENSLIDE_TEST_XFAIL')
xfail = xfail.split(',') if xfail else []
if _run_all(pattern, xfail=xfail):
sys.exit(1)
@contextmanager
def _rebuild(configure_args):
'''Context manager: rebuild the source with the specified CFLAGS and
yield to the caller to do profiling.'''
# To minimize collateral damage, unpack the dist tarball into a temp
# directory and build there.
top_builddir = os.path.dirname('!!BUILDDIR!!')
prevdir = os.getcwd()
# Make tarball
os.chdir(top_builddir)
subprocess.check_call(['make', 'dist-gzip'])
os.chdir(prevdir)
tarpath = os.path.join(top_builddir, 'openslide-!!VERSION!!.tar.gz')
# Unpack and remove the tarball
tempdir = mkdtemp(prefix='build-', dir=prevdir)
os.chdir(tempdir)
tarfile.open(tarpath, 'r:gz').extractall()
os.unlink(tarpath)
os.chdir('openslide-!!VERSION!!')
# Build with specified CFLAGS
subprocess.check_call(['./configure'] + configure_args)
subprocess.check_call(['make'])
# Let the caller run, passing it the directory we came from.
# Intentionally don't clean up tempdir on exception.
yield prevdir
# Remove temporary directory
os.chdir(prevdir)
rmtree(tempdir)
@_command
def coverage(outfile):
'''Unpack and run all tests and write coverage report to outfile.'''
with _rebuild(['CFLAGS=-O0 -g -fprofile-arcs -ftest-coverage']) as basedir:
# Run tests
_run_all(testdir='test')
# Generate coverage reports
for dirpath, dirnames, filenames in os.walk('src'):
paths = [os.path.join(dirpath, name)
for name in fnmatch.filter(sorted(filenames), '*.gcda')]
if paths:
subprocess.check_call(['gcov', '-o', dirpath] + paths)
# Record unexecuted lines
proc = subprocess.Popen(['grep', '-FC', '2', '#####'] +
fnmatch.filter(sorted(os.listdir('.')), '*.gcov'),
stdout=subprocess.PIPE)
report, _ = proc.communicate()
if proc.returncode:
raise IOError('Process returned exit status %d' % proc.returncode)
report = '\n'.join(l.replace('.c.gcov', '.c', 1)
for l in report.split('\n'))
with open(os.path.join(basedir, outfile), 'w') as fh:
fh.write(report)
@_command
def valgrind(pattern='*'):
'''Unpack and Valgrind all tests matching the specified pattern.
Ignore failures of test cases listed in the OPENSLIDE_VALGRIND_XFAIL
environment variable.'''
xfail = os.environ.get('OPENSLIDE_VALGRIND_XFAIL')
xfail = xfail.split(',') if xfail else []
if _run_all(pattern, valgrind=True, xfail=xfail):
sys.exit(1)
@_command
def mosaic(outfile):
'''Produce a mosaic image of slide data from various formats.'''
cfg = RawConfigParser()
cfg.optionxform = str
cfg.read(MOSAICLIST)
for section in cfg.sections():
_fetch_one(cfg.get(section, 'base'))
subprocess.check_call([os.path.join('!!BUILDDIR!!', 'mosaic'),
native_path(PRISTINE), native_path(MOSAICLIST),
native_path(outfile)])
def _successful_primary_tests(pattern='*'):
'''Yield testname and slide path for each successful primary test.'''
for testname in _list_tests(pattern):
conf = _load_test_config(testname)
if (not conf.get('primary', False) or not conf['success']
or not _features_available(conf)):
continue
_unpack_one(testname)
slidefile = os.path.join(WORKROOT, testname, conf['slide'])
yield testname, slidefile
@_command
def time(pattern='*'):
'''Time openslide_open() for all successful primary tests matching the
specified pattern.'''
for testname, slidefile in _successful_primary_tests(pattern):
proc = _launch_test('try_open', slidefile, args=['-t'],
extra_checks=False, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
out, err = proc.communicate()
if proc.returncode or err:
out = 'failed'
print '%-40s %10s' % (testname, out.strip())
@_command
def profile(pattern='*', level=0):
'''Profile openslide_read_region() on the specified level for all
successful primary tests matching the specified pattern.'''
env = os.environ.copy()
env.update(
G_MESSAGES_DEBUG='',
OPENSLIDE_DEBUG='performance',
)
line = '#' * 79
for testname, slidefile in _successful_primary_tests(pattern):
print '%s\n# %s\n%s\n' % (line, testname, line)
with NamedTemporaryFile(prefix='openslide-callgrind-') as fh:
args = ['!!BUILDDIR!!/../libtool', '--mode=execute',
'valgrind', '--quiet', '--error-exitcode=3',
'--tool=callgrind', '--callgrind-out-file=' + fh.name,
'--instr-atstart=no',
'!!BUILDDIR!!/profile', slidefile, str(level)]
if subprocess.call(args, env=env) == 0:
subprocess.check_call(['callgrind_annotate',
'--threshold=80', fh.name])
@_command
def exports():
'''Report exported or hidden symbols with improper names.'''
def get_symbols(basedir):
proc = subprocess.Popen(['objdump', '-T',
os.path.join(basedir, 'src', '.libs', 'libopenslide.so')],
stdout=subprocess.PIPE)
out, _ = proc.communicate()
if proc.returncode:
raise IOError('objdump returned exit status %d' % proc.returncode)
for line in out.splitlines():
words = line.split()
if len(words) < 3:
continue
if words[1] != 'g':
# Not a global symbol
continue
yield words[-1]
# Magic ELF symbols
ignore_symbols = set(['__bss_start', '_edata', '_end', '_fini', '_init'])
# Check exported symbols
exported_symbols = set(get_symbols('..')) - ignore_symbols
bad_exported = set(symbol for symbol in exported_symbols
if not symbol.startswith('openslide_'))
# Check hidden symbols
with _rebuild(['gl_cv_cc_visibility=no']):
hidden_symbols = (set(get_symbols('.')) - exported_symbols -
ignore_symbols)
bad_hidden = set(symbol for symbol in hidden_symbols
if not symbol.startswith('_openslide_')
and symbol != 'openslide_cairo_read_region') # legacy
# Report
for symbol in sorted(bad_exported):
print >>sys.stderr, 'Badly-named exported symbol:', symbol
for symbol in sorted(bad_hidden):
print >>sys.stderr, 'Badly-named hidden symbol:', symbol
if bad_exported or bad_hidden:
sys.exit(1)
@_command
def clean(pattern='*'):
'''Delete temporary slide data for tests matching the specified pattern.'''
for testname in _list_tests(pattern):
path = os.path.join(WORKROOT, testname)
if os.path.exists(path):
rmtree(path)
def _get_arglist(f):
'''Return two lists of argument names for the specified function: the
mandatory arguments and the optional ones.'''
args, _va, _kw, defs = inspect.getargspec(f)
if defs:
optcount = len(defs)
return args[:-optcount], args[-optcount:]
else:
return args, []
def _usage():
'''Print usage message and exit.'''
wrapper = textwrap.TextWrapper(width=76, initial_indent=' ' * 8,
subsequent_indent=' ' * 8)
print 'Usage:'
for name in _commands:
f = _command_funcs[name]
args, optargs = _get_arglist(f)
argspecs = ['<%s>' % a for a in args] + ['[%s]' % a for a in optargs]
print ' %s %s' % (name, ' '.join(argspecs))
print wrapper.fill(f.__doc__ or 'Undocumented.')
print
sys.exit(2)
def _main():
try:
cmd = sys.argv[1]
except IndexError:
_usage()
try:
f = _command_funcs[cmd]
except KeyError:
_usage()
args, optargs = _get_arglist(f)
argc = len(sys.argv) - 2
if argc < len(args) or argc > len(args) + len(optargs):
_usage()
f(*sys.argv[2:])
if __name__ == '__main__':
_main()
| {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.