text
stringlengths 2
99.9k
| meta
dict |
---|---|
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
#ifndef __javax_imageio_event_IIOWriteProgressListener__
#define __javax_imageio_event_IIOWriteProgressListener__
#pragma interface
#include <java/lang/Object.h>
extern "Java"
{
namespace javax
{
namespace imageio
{
class ImageWriter;
namespace event
{
class IIOWriteProgressListener;
}
}
}
}
class javax::imageio::event::IIOWriteProgressListener : public ::java::lang::Object
{
public:
virtual void imageComplete(::javax::imageio::ImageWriter *) = 0;
virtual void imageProgress(::javax::imageio::ImageWriter *, jfloat) = 0;
virtual void imageStarted(::javax::imageio::ImageWriter *, jint) = 0;
virtual void thumbnailComplete(::javax::imageio::ImageWriter *) = 0;
virtual void thumbnailProgress(::javax::imageio::ImageWriter *, jfloat) = 0;
virtual void thumbnailStarted(::javax::imageio::ImageWriter *, jint, jint) = 0;
virtual void writeAborted(::javax::imageio::ImageWriter *) = 0;
static ::java::lang::Class class$;
} __attribute__ ((java_interface));
#endif // __javax_imageio_event_IIOWriteProgressListener__
| {
"pile_set_name": "Github"
} |
<?php
class y {
function raiseError($error)
{
$this->graph = new Image_GraphViz(
true,
array(
'fontname' => 'Verdana',
'fontsize' => 12.0,
//'fontcolor' => 'gray5',
'rankdir' => 'LR', // left-to-right
)
);
if (PEAR::isError($error)) {
$error = $error->getMessage();
}
trigger_error($error, E_USER_WARNING);
return Console_Getopt::getopt2($argv, $short_options);
}
}
?> | {
"pile_set_name": "Github"
} |
/*
Copyright 2018 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package defaultconfig
const (
nameReferenceFieldSpecs = `
nameReference:
- kind: Deployment
fieldSpecs:
- path: spec/scaleTargetRef/name
kind: HorizontalPodAutoscaler
- kind: ReplicationController
fieldSpecs:
- path: spec/scaleTargetRef/name
kind: HorizontalPodAutoscaler
- kind: ReplicaSet
fieldSpecs:
- path: spec/scaleTargetRef/name
kind: HorizontalPodAutoscaler
- kind: ConfigMap
version: v1
fieldSpecs:
- path: spec/volumes/configMap/name
version: v1
kind: Pod
- path: spec/containers/env/valueFrom/configMapKeyRef/name
version: v1
kind: Pod
- path: spec/initContainers/env/valueFrom/configMapKeyRef/name
version: v1
kind: Pod
- path: spec/containers/envFrom/configMapRef/name
version: v1
kind: Pod
- path: spec/initContainers/envFrom/configMapRef/name
version: v1
kind: Pod
- path: spec/template/spec/volumes/configMap/name
kind: Deployment
- path: spec/template/spec/containers/env/valueFrom/configMapKeyRef/name
kind: Deployment
- path: spec/template/spec/initContainers/env/valueFrom/configMapKeyRef/name
kind: Deployment
- path: spec/template/spec/containers/envFrom/configMapRef/name
kind: Deployment
- path: spec/template/spec/initContainers/envFrom/configMapRef/name
kind: Deployment
- path: spec/template/spec/volumes/projected/sources/configMap/name
kind: Deployment
- path: spec/template/spec/volumes/configMap/name
kind: ReplicaSet
- path: spec/template/spec/containers/env/valueFrom/configMapKeyRef/name
kind: ReplicaSet
- path: spec/template/spec/initContainers/env/valueFrom/configMapKeyRef/name
kind: ReplicaSet
- path: spec/template/spec/containers/envFrom/configMapRef/name
kind: ReplicaSet
- path: spec/template/spec/initContainers/envFrom/configMapRef/name
kind: ReplicaSet
- path: spec/template/spec/volumes/configMap/name
kind: DaemonSet
- path: spec/template/spec/containers/env/valueFrom/configMapKeyRef/name
kind: DaemonSet
- path: spec/template/spec/initContainers/env/valueFrom/configMapKeyRef/name
kind: DaemonSet
- path: spec/template/spec/containers/envFrom/configMapRef/name
kind: DaemonSet
- path: spec/template/spec/initContainers/envFrom/configMapRef/name
kind: DaemonSet
- path: spec/template/spec/volumes/configMap/name
kind: StatefulSet
- path: spec/template/spec/containers/env/valueFrom/configMapKeyRef/name
kind: StatefulSet
- path: spec/template/spec/initContainers/env/valueFrom/configMapKeyRef/name
kind: StatefulSet
- path: spec/template/spec/containers/envFrom/configMapRef/name
kind: StatefulSet
- path: spec/template/spec/initContainers/envFrom/configMapRef/name
kind: StatefulSet
- path: spec/template/spec/volumes/projected/sources/configMap/name
kind: StatefulSet
- path: spec/template/spec/volumes/configMap/name
kind: Job
- path: spec/template/spec/containers/env/valueFrom/configMapKeyRef/name
kind: Job
- path: spec/template/spec/initContainers/env/valueFrom/configMapKeyRef/name
kind: Job
- path: spec/template/spec/containers/envFrom/configMapRef/name
kind: Job
- path: spec/template/spec/initContainers/envFrom/configMapRef/name
kind: Job
- path: spec/jobTemplate/spec/template/spec/volumes/configMap/name
kind: CronJob
- path: spec/jobTemplate/spec/template/spec/containers/env/valueFrom/configMapKeyRef/name
kind: CronJob
- path: spec/jobTemplate/spec/template/spec/initContainers/env/valueFrom/configMapKeyRef/name
kind: CronJob
- path: spec/jobTemplate/spec/template/spec/containers/envFrom/configMapRef/name
kind: CronJob
- path: spec/jobTemplate/spec/template/spec/initContainers/envFrom/configmapRef/name
kind: CronJob
- kind: Secret
version: v1
fieldSpecs:
- path: spec/volumes/secret/secretName
version: v1
kind: Pod
- path: spec/containers/env/valueFrom/secretKeyRef/name
version: v1
kind: Pod
- path: spec/initContainers/env/valueFrom/secretKeyRef/name
version: v1
kind: Pod
- path: spec/containers/envFrom/secretRef/name
version: v1
kind: Pod
- path: spec/initContainers/envFrom/secretRef/name
version: v1
kind: Pod
- path: spec/imagePullSecrets/name
version: v1
kind: Pod
- path: spec/template/spec/volumes/secret/secretName
kind: Deployment
- path: spec/template/spec/containers/env/valueFrom/secretKeyRef/name
kind: Deployment
- path: spec/template/spec/initContainers/env/valueFrom/secretKeyRef/name
kind: Deployment
- path: spec/template/spec/containers/envFrom/secretRef/name
kind: Deployment
- path: spec/template/spec/initContainers/envFrom/secretRef/name
kind: Deployment
- path: spec/template/spec/imagePullSecrets/name
kind: Deployment
- path: spec/template/spec/volumes/projected/sources/secret/name
kind: Deployment
- path: spec/template/spec/volumes/secret/secretName
kind: ReplicaSet
- path: spec/template/spec/containers/env/valueFrom/secretKeyRef/name
kind: ReplicaSet
- path: spec/template/spec/initContainers/env/valueFrom/secretKeyRef/name
kind: ReplicaSet
- path: spec/template/spec/containers/envFrom/secretRef/name
kind: ReplicaSet
- path: spec/template/spec/initContainers/envFrom/secretRef/name
kind: ReplicaSet
- path: spec/template/spec/imagePullSecrets/name
kind: ReplicaSet
- path: spec/template/spec/volumes/secret/secretName
kind: DaemonSet
- path: spec/template/spec/containers/env/valueFrom/secretKeyRef/name
kind: DaemonSet
- path: spec/template/spec/initContainers/env/valueFrom/secretKeyRef/name
kind: DaemonSet
- path: spec/template/spec/containers/envFrom/secretRef/name
kind: DaemonSet
- path: spec/template/spec/initContainers/envFrom/secretRef/name
kind: DaemonSet
- path: spec/template/spec/imagePullSecrets/name
kind: DaemonSet
- path: spec/template/spec/volumes/secret/secretName
kind: StatefulSet
- path: spec/template/spec/containers/env/valueFrom/secretKeyRef/name
kind: StatefulSet
- path: spec/template/spec/initContainers/env/valueFrom/secretKeyRef/name
kind: StatefulSet
- path: spec/template/spec/containers/envFrom/secretRef/name
kind: StatefulSet
- path: spec/template/spec/initContainers/envFrom/secretRef/name
kind: StatefulSet
- path: spec/template/spec/imagePullSecrets/name
kind: StatefulSet
- path: spec/template/spec/volumes/projected/sources/secret/name
kind: StatefulSet
- path: spec/template/spec/volumes/secret/secretName
kind: Job
- path: spec/template/spec/containers/env/valueFrom/secretKeyRef/name
kind: Job
- path: spec/template/spec/initContainers/env/valueFrom/secretKeyRef/name
kind: Job
- path: spec/template/spec/containers/envFrom/secretRef/name
kind: Job
- path: spec/template/spec/initContainers/envFrom/secretRef/name
kind: Job
- path: spec/template/spec/imagePullSecrets/name
kind: Job
- path: spec/jobTemplate/spec/template/spec/volumes/secret/secretName
kind: CronJob
- path: spec/jobTemplate/spec/template/spec/containers/env/valueFrom/secretKeyRef/name
kind: CronJob
- path: spec/jobTemplate/spec/template/spec/initContainers/env/valueFrom/secretKeyRef/name
kind: CronJob
- path: spec/jobTemplate/spec/template/spec/containers/envFrom/secretRef/name
kind: CronJob
- path: spec/jobTemplate/spec/template/spec/initContainers/envFrom/secretRef/name
kind: CronJob
- path: spec/jobTemplate/spec/template/spec/imagePullSecrets/name
kind: CronJob
- path: spec/tls/secretName
kind: Ingress
- path: metadata/annotations/ingress.kubernetes.io\/auth-secret
kind: Ingress
- path: metadata/annotations/nginx.ingress.kubernetes.io\/auth-secret
kind: Ingress
- path: imagePullSecrets/name
kind: ServiceAccount
- path: parameters/secretName
kind: StorageClass
- path: parameters/adminSecretName
kind: StorageClass
- path: parameters/userSecretName
kind: StorageClass
- path: parameters/secretRef
kind: StorageClass
- path: rules/resourceNames
kind: Role
- path: rules/resourceNames
kind: ClusterRole
- kind: Service
version: v1
fieldSpecs:
- path: spec/serviceName
kind: StatefulSet
group: apps
- path: spec/rules/http/paths/backend/serviceName
kind: Ingress
- path: spec/backend/serviceName
kind: Ingress
- path: spec/service/name
kind: APIService
group: apiregistration.k8s.io
- kind: Role
group: rbac.authorization.k8s.io
fieldSpecs:
- path: roleRef/name
kind: RoleBinding
group: rbac.authorization.k8s.io
- kind: ClusterRole
group: rbac.authorization.k8s.io
fieldSpecs:
- path: roleRef/name
kind: RoleBinding
group: rbac.authorization.k8s.io
- path: roleRef/name
kind: ClusterRoleBinding
group: rbac.authorization.k8s.io
- kind: ServiceAccount
version: v1
fieldSpecs:
- path: subjects/name
kind: RoleBinding
group: rbac.authorization.k8s.io
- path: subjects/name
kind: ClusterRoleBinding
group: rbac.authorization.k8s.io
- path: spec/serviceAccountName
kind: Pod
- path: spec/template/spec/serviceAccountName
kind: StatefulSet
- path: spec/template/spec/serviceAccountName
kind: Deployment
- path: spec/template/spec/serviceAccountName
kind: ReplicationController
- path: spec/jobTemplate/spec/template/spec/serviceAccountName
kind: CronJob
- path: spec/template/spec/serviceAccountName
kind: job
- path: spec/template/spec/serviceAccountName
kind: DaemonSet
- kind: PersistentVolumeClaim
version: v1
fieldSpecs:
- path: spec/volumes/persistentVolumeClaim/claimName
kind: Pod
- path: spec/template/spec/volumes/persistentVolumeClaim/claimName
kind: StatefulSet
- path: spec/template/spec/volumes/persistentVolumeClaim/claimName
kind: Deployment
- path: spec/template/spec/volumes/persistentVolumeClaim/claimName
kind: ReplicationController
- path: spec/jobTemplate/spec/template/spec/volumes/persistentVolumeClaim/claimName
kind: CronJob
- path: spec/template/spec/volumes/persistentVolumeClaim/claimName
kind: Job
- path: spec/template/spec/volumes/persistentVolumeClaim/claimName
kind: DaemonSet
- kind: PersistentVolume
version: v1
fieldSpecs:
- path: spec/volumeName
kind: PersistentVolumeClaim
`
)
| {
"pile_set_name": "Github"
} |
/*
* Copyright (C) 2014 The Async HBase Authors. All rights reserved.
* This file is part of Async HBase.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* - Neither the name of the StumbleUpon 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 HOLDER 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.
*/
package org.hbase.async;
import com.google.protobuf.ByteString;
import org.jboss.netty.buffer.ChannelBuffer;
import org.hbase.async.generated.ComparatorPB;
/**
* A binary comparator used in comparison filters. Compares byte arrays
* lexicographically.
* @since 1.6
*/
public final class BinaryComparator extends FilterComparator {
private static final byte[] NAME =
Bytes.UTF8("org.apache.hadoop.hbase.filter.BinaryComparator");
private static final byte CODE = 47;
private final byte[] value;
public BinaryComparator(byte[] value) {
this.value = value;
}
public byte[] value() {
return value.clone();
}
@Override
byte[] name() {
return NAME;
}
@Override
ComparatorPB.Comparator toProtobuf() {
ByteString byte_string = ComparatorPB
.BinaryComparator
.newBuilder()
.setComparable(
ComparatorPB
.ByteArrayComparable
.newBuilder()
.setValue(Bytes.wrap(value)))
.build()
.toByteString();
return super.toProtobuf(byte_string);
}
@Override
void serializeOld(ChannelBuffer buf) {
super.serializeOld(buf); // super.predictSerializedSize()
// Write class code
buf.writeByte(CODE); // 1
// Write value
HBaseRpc.writeByteArray(buf, value); // 3 + value.length
}
@Override
int predictSerializedSize() {
return 1 + 3 + value.length;
}
@Override
public String toString() {
return String.format("%s(%s)",
getClass().getSimpleName(),
Bytes.pretty(value));
}
}
| {
"pile_set_name": "Github"
} |
PROG_ROOT = ../..
AM_CFLAGS = -g -DTEST_FUNCTION -I${PROG_ROOT}/ -I${PROG_ROOT}/${PBS_MACH} --coverage
lib_LTLIBRARIES = libdisruc.la
AM_LDFLAGS = @CHECK_LIBS@ ${lib_LTLIBRARIES}
check_PROGRAMS = test_disruc
libdisruc_la_SOURCES = scaffolding.c ${PROG_ROOT}/disruc.c
libdisruc_la_LDFLAGS = @CHECK_LIBS@ -shared -lgcov
test_disruc_SOURCES = test_disruc.c
check_SCRIPTS = ${PROG_ROOT}/../../test/coverage_run.sh
TESTS = ${check_PROGRAMS} ${check_SCRIPTS}
CLEANFILES = *.gcno *.gcda *.gcov core *.lo
| {
"pile_set_name": "Github"
} |
[Rank]
S. Cæciliæ Virginis et Martyris;;Duplex;;3;;vide C6
[Rank1570]
S. Cæciliæ Virginis et Martyris;;Semiduplex;;2;;vide C6
[Rule]
vide C6;
Gloria
[Introitus]
!Ps 118:46-47
v. Je parlais de vos préceptes devant les rois, et je n’en avais pas de confusion. Et je méditais sur vos commandements, car je les aime.
!Ps 118:1
Heureux ceux qui sont immaculés dans la voie ; qui marchent dans la loi du Seigneur.
&Gloria
v. Je parlais de vos préceptes devant les rois, et je n’en avais pas de confusion. Et je méditais sur vos commandements, car je les aime.
[Oratio]
Ô Dieu, qui nous réjouissez par la solennité annuelle de la bienheureuse Cécile, votre Vierge et Martyre, daignez nous faire la grâce d’imiter par une vie sainte, les exemples de celle à qui nous rendons aujourd’hui nos hommages.
$Per Dominum
[Lectio]
Léctio libri Sapiéntiæ.
!Eccli 51:13-17
Seigneur mon Dieu, vous avez exalté mon habitation sur la terre, et j’ai prié pour être délivré de la mort qui se précipitait sur moi. J’ai invoqué le Seigneur, père de mon Seigneur, afin qu’il ne m’abandonnât point au jour de ma tribulation, et sans défense au jour des superbes. Je louerai sans cesse votre nom, et je le glorifierai dans mes actions de grâces, parce que ma prière a été exaucée, et que vous m’avez délivré de la perdition, et que vous m’avez sauvé dans un temps d’injustice. C’est pourquoi je vous rendrai grâce, et je chanterai vos louanges, et je bénirai le nom du Seigneur.
[Graduale]
!Ps 44:11; 44:12
Écoutez, ma fille, voyez et prêtez l’oreille, car le roi s’est épris de votre beauté.
V.Ps 44:5
Avec votre gloire et votre majesté, avancez, marchez victorieusement et régnez. Alléluia, alléluia.
!Matt 25:4; 25:6
Cinq vierges sages prirent de l’huile dans leurs vases avec leurs lampes ; mais au milieu de la nuit, un cri se fit entendre : Voici l’époux qui vient ; allez au-devant du Christ votre Seigneur. Alléluia.
[Evangelium]
Sequéntia ++ sancti Evangélii secúndum Matthǽum.
!Matt 25:1-13
En ce temps-là, Jésus dit à ses disciples cette parabole : Le royaume des cieux sera semblable à dix vierges qui, ayant pris leurs lampes, allèrent au-devant de l’époux et de l’épouse. Or, cinq d’entre elles étaient folles, et cinq étaient sages. Les cinq folles, ayant pris leur lampe, ne prirent pas d’huile avec elles ; mais les sages prirent de l’huile dans leurs vases avec leurs lampes. L’époux tardant à venir, elles s’assoupirent toutes, et s’endormirent. Mais, au milieu de la nuit, un cri se fit entendre : Voici l’époux qui vient ; allez au-devant de lui. Alors toutes ces vierges se levèrent, et préparèrent leurs lampes. Mais les folles dirent aux sages : Donnez-nous de votre huile, car nos lampes s’éteignent. Les sages leur répondirent : De peur qu’il n’y en ait pas assez pour nous et pour vous, allez plutôt chez ceux qui en vendent, et achetez-en pour vous. Mais pendant qu’elles allaient en acheter, l’époux vint, et celles qui étaient prêtes entrèrent avec lui aux noces, et la porte fut fermée. Enfin les autres vierges viennent aussi, en disant : Seigneur, Seigneur, ouvrez-nous. Mais il leur répondit : En vérité, je vous le dis, je ne vous connais point. Veillez donc, parce que vous ne savez ni le jour ni l’heure.
[Offertorium]
!Ps 44:15; 44:16
Des vierges seront amenées au roi après vous ; vos compagnes seront présentées au milieu de la joie et de l’allégresse. On les conduira au temple du roi.
[Secreta]
Nous vous en supplions, Seigneur, faites que votre bienheureuse Vierge et Martyre Cécile intercédant pour nous, cette hostie de propitiation et de louange nous rende toujours dignes de votre miséricorde.
$Per Dominum
[Communio]
!Ps 118:78; 118:80
Que les superbes soient confondus, pour m’avoir maltraité injustement ; mais moi, je m’exercerai dans vos commandements et dans vos lois, afin que je ne sois pas confondu.
[Postcommunio]
Vous avez, Seigneur, nourri votre famille de dons sacrés ; ranimez-nous toujours, s’il vous plaît, grâce à l’intervention de la sainte dont nous célébrons la fête.
$Per Dominum
| {
"pile_set_name": "Github"
} |
/*
Copyright (C) 2020 Accurics, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cli
import (
"testing"
)
func TestRun(t *testing.T) {
table := []struct {
name string
iacType string
iacVersion string
cloudType string
iacFilePath string
iacDirPath string
configFile string
configOnly bool
stdOut string
want string
wantErr error
}{
{
name: "normal terraform run",
cloudType: "terraform",
iacDirPath: "testdata/run-test",
},
{
name: "normal k8s run",
cloudType: "k8s",
iacDirPath: "testdata/run-test",
},
{
name: "config-only flag terraform",
cloudType: "terraform",
iacFilePath: "testdata/run-test/config-only.tf",
configOnly: true,
},
{
name: "config-only flag k8s",
cloudType: "k8s",
iacFilePath: "testdata/run-test/config-only.yaml",
configOnly: true,
},
}
for _, tt := range table {
t.Run(tt.name, func(t *testing.T) {
Run(tt.iacType, tt.iacVersion, tt.cloudType, tt.iacFilePath, tt.iacDirPath, tt.configFile, "", "", tt.configOnly)
})
}
}
| {
"pile_set_name": "Github"
} |
use std::any::Any;
use std::any::TypeId;
trait Private<P, R> {
fn call(&self, p: P, r: R);
}
pub trait Public: Private<
//~^ ERROR private trait `Private<<Self as Public>::P, <Self as Public>::R>` in public interface
<Self as Public>::P,
<Self as Public>::R
> {
type P;
type R;
fn call_inner(&self);
}
fn main() {}
| {
"pile_set_name": "Github"
} |
package org.widok
import scala.collection.mutable
import org.scalajs.dom
import org.scalajs.dom.ext.KeyCode
import pl.metastack.metarx._
import org.widok.bindings._
object Widget {
object List {
trait Item[V] extends Widget[V] { self: V =>
}
}
trait List[V] extends Widget[V] { self: V =>
}
object Input {
trait Text[V] extends Widget[V] { self: V =>
val rendered: dom.html.Input
/** Produce current value after every key press. */
lazy val value = PtrVar[String](
keyUp | paste | blur | change, rendered.value, rendered.value = _)
/** Produce current value after enter was pressed. */
lazy val enterValue = PtrVar[String](
keyUp.filter(_.keyCode == KeyCode.Enter),
rendered.value, rendered.value = _)
def bind(ch: Channel[String]) = { value.bind(ch); self }
def subscribe(ch: ReadChannel[String]) = { value.subscribe(ch); self }
def attach(f: String => Unit) = { value.attach(f); self }
def bindEnter(ch: Channel[String]) = { enterValue.bind(ch); self }
def subscribeEnter(ch: ReadChannel[String]) = { enterValue.subscribe(ch); self }
def attachEnter(f: String => Unit) = { enterValue.attach(f); self }
}
trait Checkbox[V] extends Widget[V] { self: V =>
val rendered: dom.html.Input
lazy val checked = PtrVar[Boolean](change,
rendered.checked, rendered.checked = _)
def bind(ch: Channel[Boolean]) = { checked.bind(ch); self }
def subscribe(ch: ReadChannel[Boolean]) = { checked.subscribe(ch); self }
def attach(f: Boolean => Unit) = { checked.attach(f); self }
}
trait Select[V] extends Widget[V] { self: V =>
private var optDefault = Option.empty[HTML.Input.Select.Option]
/* All manually added elements will be ignored by bind() */
def default(caption: String) = {
assert(optDefault.isEmpty, "default() can only be used once")
assert(!rendered.hasChildNodes(), "DOM modified externally")
val opt = HTML.Input.Select.Option(caption)
rendered.appendChild(opt.rendered)
optDefault = Some(opt)
self
}
def bind[T, X <: List.Item[X]](buf: DeltaBuffer[T],
f: T => HTML.Input.Select.Option,
selection: Channel[Option[T]]) =
{
import Buffer.Delta
import Buffer.Position
def selected(): dom.raw.HTMLOptionElement = {
val castRendered = rendered.asInstanceOf[dom.html.Select]
castRendered.options(castRendered.selectedIndex)
}
val mapping = mutable.Map.empty[T, HTML.Input.Select.Option]
def onSelect(select: Option[T]) {
val node: Option[HTML.Input.Select.Option] =
if (select.isDefined) mapping.get(select.get)
else if (optDefault.nonEmpty) optDefault
else None
node.foreach(_.attribute("selected", ""))
}
buf.changes.attach {
case Delta.Insert(Position.Head(), element) =>
mapping += element -> f(element)
if (optDefault.isEmpty)
rendered.insertBefore(
mapping(element).rendered,
rendered.firstChild)
else
rendered.insertBefore(
mapping(element).rendered,
optDefault.get.rendered)
// TODO Flush only if selection was invalidated by Remove() or Clear()
selection.flush(onSelect)
case Delta.Insert(Position.Last(), element) =>
mapping += element -> f(element)
rendered.appendChild(mapping(element).rendered)
selection.flush(onSelect)
case Delta.Insert(Position.Before(reference), element) =>
mapping += element -> f(element)
rendered.insertBefore(
mapping(element).rendered,
mapping(reference).rendered)
selection.flush(onSelect)
case Delta.Insert(Position.After(reference), element) =>
mapping += element -> f(element)
DOM.insertAfter(rendered,
mapping(reference).rendered,
mapping(element).rendered)
selection.flush(onSelect)
case Delta.Replace(reference, element) =>
mapping += element -> f(element)
rendered.replaceChild(
mapping(element).rendered,
mapping(reference).rendered)
mapping -= reference
case Delta.Remove(element) =>
rendered.removeChild(mapping(element).rendered)
mapping -= element
case Delta.Clear() =>
mapping.foreach { case (_, value) =>
rendered.removeChild(value.rendered) }
mapping.clear()
}
val obs = selection.attach(onSelect)
change.attach { e =>
val m = mapping.find(_._2.rendered == selected())
selection.produce(m.map(_._1), obs)
}
self
}
}
}
trait Container[V] extends Widget[V] { self: V =>
def subscribe[T <: String](value: ReadChannel[T]) = {
value.attach(cur => rendered.textContent = cur.toString)
self
}
/** Subscribe raw HTML. */
def raw[T](value: ReadChannel[String]) = {
value.attach(rendered.innerHTML = _)
self
}
}
}
object DOMChannel {
def variable[T](set: T => Unit) = {
val opt = Opt[T]()
opt.values.attach(set)
opt
}
/* TODO As an optimisation, f(null) should be called when all children
* are detached from the channel. If a child gets added, then the callback
* handler needs to get reinitialised again.
*/
def event(f: (dom.Event => Unit) => Unit): Channel[dom.Event] = {
val ev = Channel[dom.Event]()
f((e: dom.Event) => ev.produce(e))
ev
}
def dragEvent(f: (dom.DragEvent => Unit) => Unit): Channel[dom.DragEvent] = {
val ev = Channel[dom.DragEvent]()
f((e: dom.DragEvent) => ev.produce(e))
ev
}
def keyboardEvent(f: (dom.KeyboardEvent => Unit) => Unit): Channel[dom.KeyboardEvent] = {
val ev = Channel[dom.KeyboardEvent]()
f((e: dom.KeyboardEvent) => ev.produce(e))
ev
}
def mouseEvent(f: (dom.MouseEvent => Unit) => Unit): Channel[dom.MouseEvent] = {
val ev = Channel[dom.MouseEvent]()
f((e: dom.MouseEvent) => ev.produce(e))
ev
}
def touchEvent(rendered: dom.html.Element, id: String): Channel[dom.TouchEvent] = {
val ev = Channel[dom.TouchEvent]()
rendered.addEventListener(id,
(e: dom.Event) => ev.produce(e.asInstanceOf[dom.TouchEvent]),
useCapture = false)
ev
}
}
trait View {
def render(parent: dom.Node, offset: dom.Node)
}
case class Inline(contents: Widget[_]*) extends View {
def render(parent: dom.Node, offset: dom.Node) {
contents.foreach(_.render(parent, parent.lastChild))
}
}
case class PlaceholderWidget[T <: Widget[_]](value: ReadChannel[T]) extends View {
def render(parent: dom.Node, offset: dom.Node) {
var node = DOM.createNullElement()
DOM.insertAfter(parent, offset, node)
value.attach { cur =>
parent.replaceChild(cur.rendered, node)
node = cur.rendered
}
}
}
case class PlaceholderOptWidget[T <: Option[Widget[_]]](value: ReadChannel[T]) extends View {
def render(parent: dom.Node, offset: dom.Node) {
var node = DOM.createNullElement()
DOM.insertAfter(parent, offset, node)
value.attach { (t: Option[Widget[_]]) =>
t match {
case Some(widget) =>
parent.replaceChild(widget.rendered, node)
node = widget.rendered
case None =>
val empty = DOM.createNullElement()
parent.replaceChild(empty, node)
node = empty
}
}
}
}
trait Length
object Length {
case class Pixel(value: Double) extends Length { override def toString = s"${value}px" }
case class Element(value: Double) extends Length { override def toString = s"${value}em" }
case class Percentage(value: Double) extends Length { override def toString = s"${value * 100}%" }
}
case class CSSStyle(style: dom.css.StyleDeclaration) {
lazy val display: Opt[String] = DOMChannel.variable(style.display = _)
lazy val visibility: Opt[String] = DOMChannel.variable(style.visibility = _)
lazy val cursor: Opt[HTML.Cursor] = DOMChannel.variable(v => style.cursor = v.toString)
lazy val height: Opt[Length] = DOMChannel.variable(v => style.height = v.toString)
lazy val width: Opt[Length] = DOMChannel.variable(v => style.width = v.toString)
lazy val float: Opt[HTML.Floating] = DOMChannel.variable(v => style.cssFloat = v.toString)
lazy val clear: Opt[HTML.Clear] = DOMChannel.variable(v => style.clear = v.toString)
lazy val overflow: Opt[HTML.Overflow] = DOMChannel.variable(v => style.overflow = v.toString)
}
trait Node extends View {
val rendered: dom.html.Element
def render(parent: dom.Node, offset: dom.Node) {
DOM.insertAfter(parent, offset, rendered)
}
lazy val click = DOMChannel.mouseEvent(rendered.onclick = _)
lazy val doubleClick = DOMChannel.mouseEvent(rendered.ondblclick = _)
lazy val mouseLeave = DOMChannel.mouseEvent(rendered.onmouseleave = _)
lazy val mouseEnter = DOMChannel.mouseEvent(rendered.onmouseenter = _)
lazy val mouseOut = DOMChannel.mouseEvent(rendered.onmouseout = _)
lazy val mouseUp = DOMChannel.mouseEvent(rendered.onmouseup = _)
lazy val mouseOver = DOMChannel.mouseEvent(rendered.onmouseover = _)
lazy val mouseDown = DOMChannel.mouseEvent(rendered.onmousedown = _)
lazy val mouseMove = DOMChannel.mouseEvent(rendered.onmousemove = _)
lazy val contextMenu = DOMChannel.mouseEvent(rendered.oncontextmenu = _)
lazy val paste = DOMChannel.dragEvent(rendered.onpaste = _)
lazy val drag = DOMChannel.dragEvent(rendered.ondrag = _)
lazy val dragStart = DOMChannel.dragEvent(rendered.ondragstart = _)
lazy val dragEnd = DOMChannel.dragEvent(rendered.ondragend = _)
lazy val dragEnter = DOMChannel.dragEvent(rendered.ondragenter = _)
lazy val dragOver = DOMChannel.dragEvent(rendered.ondragover = _)
lazy val dragLeave = DOMChannel.dragEvent(rendered.ondragleave = _)
lazy val drop = DOMChannel.dragEvent(rendered.ondrop = _)
lazy val keyUp = DOMChannel.keyboardEvent(rendered.onkeyup = _)
lazy val keyDown = DOMChannel.keyboardEvent(rendered.onkeydown = _)
lazy val keyPress = DOMChannel.keyboardEvent(rendered.onkeypress = _)
lazy val touchStart = DOMChannel.touchEvent(rendered, "touchstart")
lazy val touchMove = DOMChannel.touchEvent(rendered, "touchmove")
lazy val touchEnd = DOMChannel.touchEvent(rendered, "touchend")
lazy val change = DOMChannel.event(rendered.onchange = _)
lazy val blur = DOMChannel.event(rendered.onblur = _)
lazy val nodeId: Opt[String] = DOMChannel.variable(rendered.id = _)
lazy val submit = DOMChannel.event(rendered.onsubmit = _)
lazy val className = {
val buf = Buffer[String]()
buf.toSeq.attach { tags =>
assert(tags.forall(!_.contains(" ")), s"A tag in '$tags' contains spaces")
rendered.className = tags.mkString(" ")
}
buf
}
lazy val style = CSSStyle(rendered.style)
lazy val attributes = {
val dict = Dict[String, String]()
dict.changes.attach {
case Dict.Delta.Insert(k, v) => rendered.setAttribute(k, v)
case Dict.Delta.Update(k, v) => rendered.setAttribute(k, v)
case Dict.Delta.Remove(k) => rendered.removeAttribute(k)
case Dict.Delta.Clear() => rendered.removeAttribute()
}
dict
}
}
object Node {
def apply(node: dom.html.Element): Node =
new Node {
val rendered = node
}
}
/**
* Convenience trait to use the channels from [[Node]] with chained function
* calls.
*/
trait Widget[T] extends Node { self: T =>
def onClick(f: dom.MouseEvent => Unit) = { click.attach(f); self }
def onDoubleClick(f: dom.MouseEvent => Unit) = { doubleClick.attach(f); self }
def onMouseLeave(f: dom.MouseEvent => Unit) = { mouseLeave.attach(f); self }
def onMouseEnter(f: dom.MouseEvent => Unit) = { mouseEnter.attach(f); self }
def onMouseOut(f: dom.MouseEvent => Unit) = { mouseOut.attach(f); self }
def onMouseUp(f: dom.MouseEvent => Unit) = { mouseUp.attach(f); self }
def onMouseOver(f: dom.MouseEvent => Unit) = { mouseOver.attach(f); self }
def onMouseDown(f: dom.MouseEvent => Unit) = { mouseDown.attach(f); self }
def onMouseMove(f: dom.MouseEvent => Unit) = { mouseMove.attach(f); self }
def onContextMenu(f: dom.MouseEvent => Unit) = { contextMenu.attach(f); self }
def onPaste(f: dom.DragEvent => Unit) = { paste.attach(f); self }
def onDrag(f: dom.DragEvent => Unit) = { drag.attach(f); self }
def onDragStart(f: dom.DragEvent => Unit) = { dragStart.attach(f); self }
def onDragEnd(f: dom.DragEvent => Unit) = { dragEnd.attach(f); self }
def onDragEnter(f: dom.DragEvent => Unit) = { dragEnter.attach(f); self }
def onDragOver(f: dom.DragEvent => Unit) = { dragOver.attach(f); self }
def onDragLeave(f: dom.DragEvent => Unit) = { dragLeave.attach(f); self }
def onDrop(f: dom.DragEvent => Unit) = { drop.attach(f); self }
def onKeyUp(f: dom.KeyboardEvent => Unit) = { keyUp.attach(f); self }
def onKeyDown(f: dom.KeyboardEvent => Unit) = { keyDown.attach(f); self }
def onKeyPress(f: dom.KeyboardEvent => Unit) = { keyPress.attach(f); self }
def onTouchStart(f: dom.TouchEvent => Unit) = { touchStart.attach(f); self }
def onTouchMove(f: dom.TouchEvent => Unit) = { touchMove.attach(f); self }
def onTouchEnd(f: dom.TouchEvent => Unit) = { touchEnd.attach(f); self }
def onSubmit(f: dom.Event => Unit) = { submit.attach(f); self }
def onChange(f: dom.Event => Unit) = { change.attach(f); self }
def focus(): T = { rendered.focus(); this }
def id(value: String): T = { nodeId := Some(value); self }
def id(value: ReadChannel[String]): T = { nodeId.subscribe(value.map(Some(_))); self }
def css(cssTags: String*): T = {
cssTags.filterNot(className.get.contains).foreach(className.append)
self
}
def css(tags: ReadChannel[Seq[String]]): T = {
tags.attach(className.set)
self
}
def cssState(state: Boolean, cssTags: String*): T = {
if (state) cssTags.filterNot(className.get.contains).foreach(className.append)
else cssTags.filter(className.get.contains).foreach(className.remove)
self
}
def cssState(state: ReadChannel[Boolean], cssTags: String*): T = {
state.attach(value => cssState(value, cssTags: _*))
self
}
def attribute(key: String, value: String): T = {
attributes.insertOrUpdate(key, value)
self
}
def attribute(key: String, value: ReadChannel[String]): T = {
value.attach(attributes.insertOrUpdate(key, _))
self
}
def attributeOpt(key: String, value: ReadPartialChannel[String]): T = {
value.attach {
case None => attributes.removeIfExists(key)
case Some(v) => attributes.insertOrUpdate(key, v)
}
self
}
def tabIndex(value: Int): T = attribute("tabindex", value.toString)
def tabIndex(value: ReadChannel[Int]): T = { value.attach(tabIndex(_)); self }
def title(value: String): T = attribute("title", value)
def title(value: ReadChannel[String]): T = attribute("title", value)
def cursor(cursor: HTML.Cursor): T = { style.cursor := Some(cursor); self }
def cursor(cursor: ReadChannel[HTML.Cursor]): T = {
style.cursor.subscribe(cursor.map(Some(_)))
self
}
def height(height: Length): T = { style.height := Some(height); self }
def height(height: ReadChannel[Length]): T = {
style.height.subscribe(height.map(Some(_)))
self
}
def width(width: Length): T = { style.width := Some(width); self }
def width(width: ReadChannel[Length]): T = {
style.width.subscribe(width.map(Some(_)))
self
}
def overflow(value: HTML.Overflow): T = { style.overflow := Some(value); self }
def overflow(value: ReadChannel[HTML.Overflow]): T = {
style.overflow << value.map(Some(_))
self
}
def float(value: HTML.Floating): T = { style.float:= Some(value); self }
def float(value: ReadChannel[HTML.Floating]): T = {
style.float << value.map(Some(_))
self
}
def clear(value: HTML.Clear): T = { style.clear := Some(value); self }
def clear(value: ReadChannel[HTML.Clear]): T = {
style.clear << value.map(Some(_))
self
}
def show(value: Boolean): T = {
style.display := Some(if (value) "" else "none")
self
}
def show(value: ReadChannel[Boolean]): T = {
value.attach(show(_))
self
}
def hide(value: Boolean): T = {
style.display := Some(if (value) "none" else "")
self
}
def hide(value: ReadChannel[Boolean]): T = {
value.attach(hide(_))
self
}
def visible(value: Boolean): T = {
style.visibility := Some(if (value) "visible" else "hidden")
self
}
def visible(value: ReadChannel[Boolean]): T = {
value.attach(visible(_))
self
}
def invisible(value: Boolean): T = {
style.visibility := Some(if (value) "hidden" else "visible")
self
}
def invisible(value: ReadChannel[Boolean]): T = {
value.attach(invisible(_))
self
}
def enabled(value: Boolean): T = {
if (value) attributes.removeIfExists("disabled")
else attributes.insertOrUpdate("disabled", "")
self
}
def enabled(value: ReadChannel[Boolean]): T = {
value.attach(enabled(_))
self
}
/** Coordinates relative to the padding box of offsetParent */
def relativeCoordinates =
Coordinates(
width = rendered.offsetWidth,
height = rendered.offsetHeight,
top = rendered.offsetTop,
left = rendered.offsetLeft)
/** Adds child widget */
def append(widget: Widget[_]) {
rendered.appendChild(widget.rendered)
}
/** Removes child widget */
def remove(widget: Widget[_]) {
rendered.removeChild(widget.rendered)
}
// TODO Overloading the two operators leads to a regression in the JavaScript
// test cases.
// def +=(widget: Widget[_]) = append(widget)
// def -=(widget: Widget[_]) = remove(widget)
}
| {
"pile_set_name": "Github"
} |
topics:
- binary-numbers
age-groups: age-groups.yaml
| {
"pile_set_name": "Github"
} |
[EOver False (EIdentifier "BASE") (EIdentifier "over"),ESymbol Rel "=",EOver False (EOver False (EIdentifier "BASE") (EIdentifier "over")) (EPhantom (EIdentifier "over"))]
| {
"pile_set_name": "Github"
} |
# -*- coding: utf-8 -*-
"""
The Pygments reStructuredText directive
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This fragment is a Docutils_ 0.5 directive that renders source code
(to HTML only, currently) via Pygments.
To use it, adjust the options below and copy the code into a module
that you import on initialization. The code then automatically
registers a ``sourcecode`` directive that you can use instead of
normal code blocks like this::
.. sourcecode:: python
My code goes here.
If you want to have different code styles, e.g. one with line numbers
and one without, add formatters with their names in the VARIANTS dict
below. You can invoke them instead of the DEFAULT one by using a
directive option::
.. sourcecode:: python
:linenos:
My code goes here.
Look at the `directive documentation`_ to get all the gory details.
.. _Docutils: https://docutils.sourceforge.io/
.. _directive documentation:
https://docutils.sourceforge.io/docs/howto/rst-directives.html
:copyright: Copyright 2006-2020 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
# Options
# ~~~~~~~
# Set to True if you want inline CSS styles instead of classes
INLINESTYLES = False
from pygments.formatters import HtmlFormatter
# The default formatter
DEFAULT = HtmlFormatter(noclasses=INLINESTYLES)
# Add name -> formatter pairs for every variant you want to use
VARIANTS = {
# 'linenos': HtmlFormatter(noclasses=INLINESTYLES, linenos=True),
}
from docutils import nodes
from docutils.parsers.rst import directives, Directive
from pygments import highlight
from pygments.lexers import get_lexer_by_name, TextLexer
class Pygments(Directive):
""" Source code syntax hightlighting.
"""
required_arguments = 1
optional_arguments = 0
final_argument_whitespace = True
option_spec = {key: directives.flag for key in VARIANTS}
has_content = True
def run(self):
self.assert_has_content()
try:
lexer = get_lexer_by_name(self.arguments[0])
except ValueError:
# no lexer found - use the text one instead of an exception
lexer = TextLexer()
# take an arbitrary option if more than one is given
formatter = self.options and VARIANTS[list(self.options)[0]] or DEFAULT
parsed = highlight('\n'.join(self.content), lexer, formatter)
return [nodes.raw('', parsed, format='html')]
directives.register_directive('sourcecode', Pygments)
| {
"pile_set_name": "Github"
} |
<template class="task-template">
<section id="ex-links-file-manager-section" class="section js-section u-category-native-ui">
<header class="section-header">
<div class="section-wrapper">
<h1>
<svg class="section-icon"><use xlink:href="assets/img/icons.svg#icon-native-ui"></use></svg>
Open external links and the file manager
</h1>
<h3>The <code>Electron.Shell</code> in Electron.NET allows you to access certain native elements like the file manager and default web browser.</h3>
<p>This module works in both the main and renderer process.</p>
<p>You find the sample source code in <code>Controllers\ShellController.cs</code>.</p>
</div>
</header>
<div class="demo">
<div class="demo-wrapper">
<button id="open-file-manager-demo-toggle" class="js-container-target demo-toggle-button">
Open Path in File Manager
<div class="demo-meta u-avoid-clicks">Supports: Win, macOS, Linux <span class="demo-meta-divider">|</span> Process: Both</div>
</button>
<div class="demo-box">
<div class="demo-controls">
<button class="demo-button" id="open-file-manager">View Demo</button>
</div>
<p>This demonstrates using the <code>Electron.Shell</code> to open the system file manager at a particular location.</p>
<p>Clicking the demo button will open your file manager at the root.</p>
<h5>Main Process (C#)</h5>
<pre><code class="csharp">string path = await Electron.App.GetPathAsync(PathName.home);
await Electron.Shell.ShowItemInFolderAsync(path);</code></pre>
</div>
</div>
</div>
<div class="demo">
<div class="demo-wrapper">
<button id="open-ex-links-demo-toggle" class="js-container-target demo-toggle-button">
Open External Links
<div class="demo-meta u-avoid-clicks">Supports: Win, macOS, Linux <span class="demo-meta-divider">|</span> Process: Both</div>
</button>
<div class="demo-box">
<div class="demo-controls">
<button class="demo-button" id="open-ex-links">View Demo</button>
</div>
<p>If you do not want your app to open website links <em>within</em> the app, you can use the <code>Electron.Shell</code> to open them externally. When clicked, the links will open outside of your app and in the user's default web browser.</p>
<p>When the demo button is clicked, the electron website will open in your browser.<p>
<h5>Main Process (C#)</h5>
<pre><code class="csharp">await Electron.Shell.OpenExternalAsync("https://github.com/ElectronNET");</code></pre>
</div>
</div>
</div>
<script>
(function(){
const { ipcRenderer } = require("electron");
document.getElementById("open-file-manager").addEventListener("click", () => {
ipcRenderer.send("open-file-manager");
});
document.getElementById("open-ex-links").addEventListener("click", () => {
ipcRenderer.send("open-ex-links");
});
}());
</script>
</section>
</template>
| {
"pile_set_name": "Github"
} |
// Copyright 2014 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum 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 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
package p2p
import (
"crypto/ecdsa"
"errors"
"math/rand"
"net"
"reflect"
"testing"
"time"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto/sha3"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/p2p/discover"
)
func init() {
// log.Root().SetHandler(log.LvlFilterHandler(log.LvlError, log.StreamHandler(os.Stderr, log.TerminalFormat(false))))
}
type testTransport struct {
id discover.NodeID
*rlpx
closeErr error
}
func newTestTransport(id discover.NodeID, fd net.Conn) transport {
wrapped := newRLPX(fd).(*rlpx)
wrapped.rw = newRLPXFrameRW(fd, secrets{
MAC: zero16,
AES: zero16,
IngressMAC: sha3.NewKeccak256(),
EgressMAC: sha3.NewKeccak256(),
})
return &testTransport{id: id, rlpx: wrapped}
}
func (c *testTransport) doEncHandshake(prv *ecdsa.PrivateKey, dialDest *discover.Node) (discover.NodeID, error) {
return c.id, nil
}
func (c *testTransport) doProtoHandshake(our *protoHandshake) (*protoHandshake, error) {
return &protoHandshake{ID: c.id, Name: "test"}, nil
}
func (c *testTransport) close(err error) {
c.rlpx.fd.Close()
c.closeErr = err
}
func startTestServer(t *testing.T, id discover.NodeID, pf func(*Peer)) *Server {
config := Config{
Name: "test",
MaxPeers: 10,
ListenAddr: "127.0.0.1:0",
PrivateKey: newkey(),
}
server := &Server{
Config: config,
newPeerHook: pf,
newTransport: func(fd net.Conn) transport { return newTestTransport(id, fd) },
}
if err := server.Start(); err != nil {
t.Fatalf("Could not start server: %v", err)
}
return server
}
func TestServerListen(t *testing.T) {
// start the test server
connected := make(chan *Peer)
remid := randomID()
srv := startTestServer(t, remid, func(p *Peer) {
if p.ID() != remid {
t.Error("peer func called with wrong node id")
}
if p == nil {
t.Error("peer func called with nil conn")
}
connected <- p
})
defer close(connected)
defer srv.Stop()
// dial the test server
conn, err := net.DialTimeout("tcp", srv.ListenAddr, 5*time.Second)
if err != nil {
t.Fatalf("could not dial: %v", err)
}
defer conn.Close()
select {
case peer := <-connected:
if peer.LocalAddr().String() != conn.RemoteAddr().String() {
t.Errorf("peer started with wrong conn: got %v, want %v",
peer.LocalAddr(), conn.RemoteAddr())
}
peers := srv.Peers()
if !reflect.DeepEqual(peers, []*Peer{peer}) {
t.Errorf("Peers mismatch: got %v, want %v", peers, []*Peer{peer})
}
case <-time.After(1 * time.Second):
t.Error("server did not accept within one second")
}
}
func TestServerDial(t *testing.T) {
// run a one-shot TCP server to handle the connection.
listener, err := net.Listen("tcp", "127.0.0.1:0")
if err != nil {
t.Fatalf("could not setup listener: %v", err)
}
defer listener.Close()
accepted := make(chan net.Conn)
go func() {
conn, err := listener.Accept()
if err != nil {
t.Error("accept error:", err)
return
}
accepted <- conn
}()
// start the server
connected := make(chan *Peer)
remid := randomID()
srv := startTestServer(t, remid, func(p *Peer) { connected <- p })
defer close(connected)
defer srv.Stop()
// tell the server to connect
tcpAddr := listener.Addr().(*net.TCPAddr)
srv.AddPeer(&discover.Node{ID: remid, IP: tcpAddr.IP, TCP: uint16(tcpAddr.Port)})
select {
case conn := <-accepted:
defer conn.Close()
select {
case peer := <-connected:
if peer.ID() != remid {
t.Errorf("peer has wrong id")
}
if peer.Name() != "test" {
t.Errorf("peer has wrong name")
}
if peer.RemoteAddr().String() != conn.LocalAddr().String() {
t.Errorf("peer started with wrong conn: got %v, want %v",
peer.RemoteAddr(), conn.LocalAddr())
}
peers := srv.Peers()
if !reflect.DeepEqual(peers, []*Peer{peer}) {
t.Errorf("Peers mismatch: got %v, want %v", peers, []*Peer{peer})
}
case <-time.After(1 * time.Second):
t.Error("server did not launch peer within one second")
}
case <-time.After(1 * time.Second):
t.Error("server did not connect within one second")
}
}
// This test checks that tasks generated by dialstate are
// actually executed and taskdone is called for them.
func TestServerTaskScheduling(t *testing.T) {
var (
done = make(chan *testTask)
quit, returned = make(chan struct{}), make(chan struct{})
tc = 0
tg = taskgen{
newFunc: func(running int, peers map[discover.NodeID]*Peer) []task {
tc++
return []task{&testTask{index: tc - 1}}
},
doneFunc: func(t task) {
select {
case done <- t.(*testTask):
case <-quit:
}
},
}
)
// The Server in this test isn't actually running
// because we're only interested in what run does.
srv := &Server{
Config: Config{MaxPeers: 10},
quit: make(chan struct{}),
ntab: fakeTable{},
running: true,
log: log.New(),
}
srv.loopWG.Add(1)
go func() {
srv.run(tg)
close(returned)
}()
var gotdone []*testTask
for i := 0; i < 100; i++ {
gotdone = append(gotdone, <-done)
}
for i, task := range gotdone {
if task.index != i {
t.Errorf("task %d has wrong index, got %d", i, task.index)
break
}
if !task.called {
t.Errorf("task %d was not called", i)
break
}
}
close(quit)
srv.Stop()
select {
case <-returned:
case <-time.After(500 * time.Millisecond):
t.Error("Server.run did not return within 500ms")
}
}
// This test checks that Server doesn't drop tasks,
// even if newTasks returns more than the maximum number of tasks.
func TestServerManyTasks(t *testing.T) {
alltasks := make([]task, 300)
for i := range alltasks {
alltasks[i] = &testTask{index: i}
}
var (
srv = &Server{
quit: make(chan struct{}),
ntab: fakeTable{},
running: true,
log: log.New(),
}
done = make(chan *testTask)
start, end = 0, 0
)
defer srv.Stop()
srv.loopWG.Add(1)
go srv.run(taskgen{
newFunc: func(running int, peers map[discover.NodeID]*Peer) []task {
start, end = end, end+maxActiveDialTasks+10
if end > len(alltasks) {
end = len(alltasks)
}
return alltasks[start:end]
},
doneFunc: func(tt task) {
done <- tt.(*testTask)
},
})
doneset := make(map[int]bool)
timeout := time.After(2 * time.Second)
for len(doneset) < len(alltasks) {
select {
case tt := <-done:
if doneset[tt.index] {
t.Errorf("task %d got done more than once", tt.index)
} else {
doneset[tt.index] = true
}
case <-timeout:
t.Errorf("%d of %d tasks got done within 2s", len(doneset), len(alltasks))
for i := 0; i < len(alltasks); i++ {
if !doneset[i] {
t.Logf("task %d not done", i)
}
}
return
}
}
}
type taskgen struct {
newFunc func(running int, peers map[discover.NodeID]*Peer) []task
doneFunc func(task)
}
func (tg taskgen) newTasks(running int, peers map[discover.NodeID]*Peer, now time.Time) []task {
return tg.newFunc(running, peers)
}
func (tg taskgen) taskDone(t task, now time.Time) {
tg.doneFunc(t)
}
func (tg taskgen) addStatic(*discover.Node) {
}
func (tg taskgen) removeStatic(*discover.Node) {
}
type testTask struct {
index int
called bool
}
func (t *testTask) Do(srv *Server) {
t.called = true
}
// This test checks that connections are disconnected
// just after the encryption handshake when the server is
// at capacity. Trusted connections should still be accepted.
func TestServerAtCap(t *testing.T) {
trustedID := randomID()
srv := &Server{
Config: Config{
PrivateKey: newkey(),
MaxPeers: 10,
NoDial: true,
TrustedNodes: []*discover.Node{{ID: trustedID}},
},
}
if err := srv.Start(); err != nil {
t.Fatalf("could not start: %v", err)
}
defer srv.Stop()
newconn := func(id discover.NodeID) *conn {
fd, _ := net.Pipe()
tx := newTestTransport(id, fd)
return &conn{fd: fd, transport: tx, flags: inboundConn, id: id, cont: make(chan error)}
}
// Inject a few connections to fill up the peer set.
for i := 0; i < 10; i++ {
c := newconn(randomID())
if err := srv.checkpoint(c, srv.addpeer); err != nil {
t.Fatalf("could not add conn %d: %v", i, err)
}
}
// Try inserting a non-trusted connection.
c := newconn(randomID())
if err := srv.checkpoint(c, srv.posthandshake); err != DiscTooManyPeers {
t.Error("wrong error for insert:", err)
}
// Try inserting a trusted connection.
c = newconn(trustedID)
if err := srv.checkpoint(c, srv.posthandshake); err != nil {
t.Error("unexpected error for trusted conn @posthandshake:", err)
}
if !c.is(trustedConn) {
t.Error("Server did not set trusted flag")
}
}
func TestServerSetupConn(t *testing.T) {
id := randomID()
srvkey := newkey()
srvid := discover.PubkeyID(&srvkey.PublicKey)
tests := []struct {
dontstart bool
tt *setupTransport
flags connFlag
dialDest *discover.Node
wantCloseErr error
wantCalls string
}{
{
dontstart: true,
tt: &setupTransport{id: id},
wantCalls: "close,",
wantCloseErr: errServerStopped,
},
{
tt: &setupTransport{id: id, encHandshakeErr: errors.New("read error")},
flags: inboundConn,
wantCalls: "doEncHandshake,close,",
wantCloseErr: errors.New("read error"),
},
{
tt: &setupTransport{id: id},
dialDest: &discover.Node{ID: randomID()},
flags: dynDialedConn,
wantCalls: "doEncHandshake,close,",
wantCloseErr: DiscUnexpectedIdentity,
},
{
tt: &setupTransport{id: id, phs: &protoHandshake{ID: randomID()}},
dialDest: &discover.Node{ID: id},
flags: dynDialedConn,
wantCalls: "doEncHandshake,doProtoHandshake,close,",
wantCloseErr: DiscUnexpectedIdentity,
},
{
tt: &setupTransport{id: id, protoHandshakeErr: errors.New("foo")},
dialDest: &discover.Node{ID: id},
flags: dynDialedConn,
wantCalls: "doEncHandshake,doProtoHandshake,close,",
wantCloseErr: errors.New("foo"),
},
{
tt: &setupTransport{id: srvid, phs: &protoHandshake{ID: srvid}},
flags: inboundConn,
wantCalls: "doEncHandshake,close,",
wantCloseErr: DiscSelf,
},
{
tt: &setupTransport{id: id, phs: &protoHandshake{ID: id}},
flags: inboundConn,
wantCalls: "doEncHandshake,doProtoHandshake,close,",
wantCloseErr: DiscUselessPeer,
},
}
for i, test := range tests {
srv := &Server{
Config: Config{
PrivateKey: srvkey,
MaxPeers: 10,
NoDial: true,
Protocols: []Protocol{discard},
},
newTransport: func(fd net.Conn) transport { return test.tt },
log: log.New(),
}
if !test.dontstart {
if err := srv.Start(); err != nil {
t.Fatalf("couldn't start server: %v", err)
}
}
p1, _ := net.Pipe()
srv.SetupConn(p1, test.flags, test.dialDest)
if !reflect.DeepEqual(test.tt.closeErr, test.wantCloseErr) {
t.Errorf("test %d: close error mismatch: got %q, want %q", i, test.tt.closeErr, test.wantCloseErr)
}
if test.tt.calls != test.wantCalls {
t.Errorf("test %d: calls mismatch: got %q, want %q", i, test.tt.calls, test.wantCalls)
}
}
}
type setupTransport struct {
id discover.NodeID
encHandshakeErr error
phs *protoHandshake
protoHandshakeErr error
calls string
closeErr error
}
func (c *setupTransport) doEncHandshake(prv *ecdsa.PrivateKey, dialDest *discover.Node) (discover.NodeID, error) {
c.calls += "doEncHandshake,"
return c.id, c.encHandshakeErr
}
func (c *setupTransport) doProtoHandshake(our *protoHandshake) (*protoHandshake, error) {
c.calls += "doProtoHandshake,"
if c.protoHandshakeErr != nil {
return nil, c.protoHandshakeErr
}
return c.phs, nil
}
func (c *setupTransport) close(err error) {
c.calls += "close,"
c.closeErr = err
}
// setupConn shouldn't write to/read from the connection.
func (c *setupTransport) WriteMsg(Msg) error {
panic("WriteMsg called on setupTransport")
}
func (c *setupTransport) ReadMsg() (Msg, error) {
panic("ReadMsg called on setupTransport")
}
func newkey() *ecdsa.PrivateKey {
key, err := crypto.GenerateKey()
if err != nil {
panic("couldn't generate key: " + err.Error())
}
return key
}
func randomID() (id discover.NodeID) {
for i := range id {
id[i] = byte(rand.Intn(255))
}
return id
}
| {
"pile_set_name": "Github"
} |
/**
* 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.binding.innogysmarthome.internal.client.entity.device;
import static org.openhab.binding.innogysmarthome.internal.InnogyBindingConstants.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.openhab.binding.innogysmarthome.internal.client.entity.capability.Capability;
import org.openhab.binding.innogysmarthome.internal.client.entity.location.Location;
import org.openhab.binding.innogysmarthome.internal.client.entity.message.Message;
import com.google.gson.annotations.SerializedName;
/**
* Defines the structure of a {@link Device}.
*
* @author Oliver Kuhl - Initial contribution
*/
public class Device {
public static final String DEVICE_MANUFACTURER_RWE = "RWE";
public static final String DEVICE_MANUFACTURER_INNOGY = "innogy";
protected static final String PROTOCOL_ID_COSIP = "Cosip";
protected static final String PROTOCOL_ID_VIRTUAL = "Virtual";
protected static final String PROTOCOL_ID_WMBUS = "wMBus";
public static final List<String> EMPTY_CAPABILITY_LINK_LIST = new ArrayList<>();
/**
* Unique id for the device, always available in model.
*/
private String id;
/**
* Identifier of the manufacturer, always available in model
*/
private String manufacturer;
/**
* Version number of the device for the domain model.
*
* If the functionality of the device changes, the version must
* be increased to indicate that there are new or changed attributes
* of the device. Always available in model.
*/
private String version;
/**
* Defines the product, which is used as an identifier for selecting the
* right add-in to support the functionality of the device.
* Remark: one add-in can support multiple devices, e.g.
* core.RWE, which supports all RWE hardware devices (also referred to as core devices).
* Always available in model.
*/
private String product;
/**
* Device number or id like SGTIN given by the manufacturer. Optional.
*/
private String serialnumber;
/**
* Specifies the type of the device, which is defined by the manufacturer. The triple of device type, manufacturer
* and the version must be unique.
* Always available in model.
*/
private String type;
private DeviceConfig config;
/**
* Contains a list of the device capabilities.
*
* Optional.
*/
@SerializedName("capabilities")
private List<String> capabilityLinkList;
private HashMap<String, Capability> capabilityMap;
private DeviceState deviceState;
/**
* The tag container can contain any number of properties for grouping of the devices in the client, e.g. category
* of device like “security related”. The tags can be freely chosen by the client and will not be considered by the
* system for any business logic.
*
* Optional.
*/
// @Key("tags")
// private List<Property> tagList;
/**
* The location contains the link to the location of the device. Optional.
*/
@SerializedName("location")
private String locationLink;
private transient Location location;
private List<Message> messageList;
private boolean lowBattery;
/**
* Stores the message id, that contains the low battery state. This is needed to identify the device, when the
* message
* with that id is deleted (thus low battery state is false again).
*/
private String lowBatteryMessageId;
/**
* Stores, if the {@link Device} is battery powered.
*/
private boolean batteryPowered = false;
/**
* @return the id
*/
public String getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(String id) {
this.id = id;
}
/**
* @return the manufacturer
*/
public String getManufacturer() {
return manufacturer;
}
/**
* @param manufacturer the manufacturer to set
*/
public void setManufacturer(String manufacturer) {
this.manufacturer = manufacturer;
}
/**
* @return the version
*/
public String getVersion() {
return version;
}
/**
* @param version the version to set
*/
public void setVersion(String version) {
this.version = version;
}
/**
* @return the product
*/
public String getProduct() {
return product;
}
/**
* @param product the product to set
*/
public void setProduct(String product) {
this.product = product;
}
/**
* @return the serialnumber
*/
public String getSerialnumber() {
return serialnumber;
}
/**
* @param serialnumber the serialnumber to set
*/
public void setSerialnumber(String serialnumber) {
this.serialnumber = serialnumber;
}
/**
* Returns true, if the {@link Device} has a serial number.
*
* @return
*/
public boolean hasSerialNumber() {
return (serialnumber != null && serialnumber != "");
}
/**
* @return the type
*/
public String getType() {
return type;
}
/**
* @param type the type to set
*/
public void setType(String type) {
this.type = type;
}
/**
* @return the config
*/
public DeviceConfig getConfig() {
return config;
}
/**
* @param config the config to set
*/
public void setConfig(DeviceConfig config) {
this.config = config;
}
/**
* Returns the {@link DeviceState}. Only available, if device has a state. Better check with
* {@link Device#hasDeviceState()} first!
*
* @return the entityState or null
*/
public DeviceState getDeviceState() {
return deviceState;
}
/**
* @param deviceState the deviceState to set
*/
public void setDeviceState(DeviceState deviceState) {
this.deviceState = deviceState;
}
/**
* Returns, if the {@link Device} has a state. Not all {@link Device}s have a state.
*
* @return
*/
public boolean hasDeviceState() {
return deviceState != null;
}
/**
* @return the capabilityList
*/
public List<String> getCapabilityLinkList() {
if (capabilityLinkList != null) {
return capabilityLinkList;
} else {
return EMPTY_CAPABILITY_LINK_LIST;
}
}
/**
* @param capabilityList the capabilityList to set
*/
public void setCapabilityList(List<String> capabilityList) {
this.capabilityLinkList = capabilityList;
}
/**
* @param capabilityMap the capabilityMap to set
*/
public void setCapabilityMap(HashMap<String, Capability> capabilityMap) {
this.capabilityMap = capabilityMap;
}
/**
* @return the capabilityMap
*/
public HashMap<String, Capability> getCapabilityMap() {
return this.capabilityMap;
}
/**
* Returns the {@link Capability} with the given id.
*
* @param id
* @return
*/
public Capability getCapabilityWithId(String id) {
return this.capabilityMap.get(id);
}
/**
* @return the locationLink
*/
public String getLocationLink() {
return locationLink;
}
/**
* @param locationList the locationList to set
*/
public void setLocation(String locationLink) {
this.locationLink = locationLink;
}
/**
* Returns the id of the {@link Location}
*
* @return
*/
public String getLocationId() {
if (locationLink != null) {
return locationLink.replace("/location/", "");
}
return null;
}
/**
* Returns the {@link Location} of the {@link Device}. Better check with {@link Device#hasLocation()} first, as not
* all devices have one.
*
* @return the location
*/
public Location getLocation() {
return location;
}
/**
* @param location the location to set
*/
public void setLocation(Location location) {
this.location = location;
}
/**
* Returns, if the {@link Device} has a {@link Location}. Not all devices have a {@link Location}...
*
* @return boolean true, if a {@link Location} is set, else false
*/
public boolean hasLocation() {
return location != null;
}
/**
* @return the messageList
*/
public List<Message> getMessageList() {
return messageList;
}
/**
* @param messageList the messageList to set
*/
public void setMessageList(List<Message> messageList) {
this.messageList = messageList;
for (final Message m : messageList) {
setLowBattery(Message.TYPE_DEVICE_LOW_BATTERY.equals(m.getType()));
setReachable(!Message.TYPE_DEVICE_UNREACHABLE.equals(m.getType()));
}
}
/**
* Sets if the {@link Device} is reachable;
*
* @param isReachable
*/
public void setReachable(boolean isReachable) {
if (getDeviceState().hasIsReachableState()) {
getDeviceState().setReachable(isReachable);
}
}
/**
* Returns if the {@link Device} is reachable.
*
* @return
*/
public boolean isReachable() {
return getDeviceState().getState().getIsReachable().getValue();
}
/**
* Sets the low battery state for the {@link Device}.
*
* @param hasLowBattery
*/
public void setLowBattery(boolean hasLowBattery) {
this.lowBattery = hasLowBattery;
}
/**
* Returns true if the {@link Device} has a low battery warning. Only available on battery devices.
*
* @return
*/
public boolean hasLowBattery() {
return lowBattery;
}
public String getLowBatteryMessageId() {
return this.lowBatteryMessageId;
}
public void setLowBatteryMessageId(String messageId) {
this.lowBatteryMessageId = messageId;
}
/**
* Returns true, if the {@link Device} is battery powered.
*
* @return
*/
public boolean isBatteryPowered() {
return batteryPowered;
}
/**
* Sets if the device is battery powered.
*
* @param hasBattery
*/
public void setIsBatteryPowered(boolean hasBattery) {
batteryPowered = hasBattery;
}
/**
* Returns true, if the {@link Device} has {@link Message}s.
*
* @return
*/
public boolean hasMessages() {
return (messageList != null && !messageList.isEmpty());
}
/**
* Returns true if the device is a controller (SHC).
*
* @return
*/
public boolean isController() {
return DEVICE_SHC.equals(type) || DEVICE_SHCA.equals(type);
}
/**
* Returns true, if the device is made by RWE.
*
* @return
*/
public boolean isRWEDevice() {
return DEVICE_MANUFACTURER_RWE.equals(manufacturer);
}
/**
* Returns true, if the device is made by innogy.
*
* @return
*/
public boolean isInnogyDevice() {
return DEVICE_MANUFACTURER_INNOGY.equals(manufacturer);
}
/**
* Returns true, if the {@link Device} is a virtual device (e.g. a VariableActuator).
*
* @return
*/
public boolean isVirtualDevice() {
return PROTOCOL_ID_VIRTUAL.equals(getConfig().getProtocolId());
}
/**
* Returns true, if the {@link Device} is a radio device.
*
* @return
*/
public boolean isRadioDevice() {
return PROTOCOL_ID_COSIP.equals(getConfig().getProtocolId())
|| PROTOCOL_ID_WMBUS.equals(getConfig().getProtocolId());
}
/**
* Returns true, if the {@link Device} is a CoSip device.
*
* @return
*/
public boolean isCoSipDevice() {
return PROTOCOL_ID_COSIP.equals(getConfig().getProtocolId());
}
/**
* Returns true, if the {@link Device} is a W-Mbus device.
*
* @return
*/
public boolean isWMBusDevice() {
return PROTOCOL_ID_WMBUS.equals(getConfig().getProtocolId());
}
@Override
public String toString() {
final String string = "Device [" + "id=" + getId() + " manufacturer=" + getManufacturer() + " version="
+ getVersion() + " product=" + getProduct() + " serialnumber=" + getSerialnumber() + " type="
+ getType() + " name=" + getConfig().getName() + "]";
return string;
}
}
| {
"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="de">
<head>
<!-- Generated by javadoc (1.8.0_151) on Sat Feb 09 19:59:29 CET 2019 -->
<title>CannotFindArbitraryException (documentation 1.1.0 API)</title>
<meta name="date" content="2019-02-09">
<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="CannotFindArbitraryException (documentation 1.1.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="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../net/jqwik/api/Assume.html" title="class in net.jqwik.api"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../net/jqwik/api/Combinators.html" title="class in net.jqwik.api"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?net/jqwik/api/CannotFindArbitraryException.html" target="_top">Frames</a></li>
<li><a href="CannotFindArbitraryException.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li><a href="#constructor.summary">Constr</a> | </li>
<li><a href="#methods.inherited.from.class.java.lang.Throwable">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor.detail">Constr</a> | </li>
<li>Method</li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">net.jqwik.api</div>
<h2 title="Class CannotFindArbitraryException" class="title">Class CannotFindArbitraryException</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>java.lang.Throwable</li>
<li>
<ul class="inheritance">
<li>java.lang.Exception</li>
<li>
<ul class="inheritance">
<li>java.lang.RuntimeException</li>
<li>
<ul class="inheritance">
<li><a href="../../../net/jqwik/api/JqwikException.html" title="class in net.jqwik.api">net.jqwik.api.JqwikException</a></li>
<li>
<ul class="inheritance">
<li>net.jqwik.api.CannotFindArbitraryException</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd>java.io.Serializable</dd>
</dl>
<hr>
<br>
<pre>@API(status=MAINTAINED,
since="1.0")
public class <span class="typeNameLabel">CannotFindArbitraryException</span>
extends <a href="../../../net/jqwik/api/JqwikException.html" title="class in net.jqwik.api">JqwikException</a></pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../serialized-form.html#net.jqwik.api.CannotFindArbitraryException">Serialized Form</a></dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../net/jqwik/api/CannotFindArbitraryException.html#CannotFindArbitraryException-net.jqwik.api.providers.TypeUsage-">CannotFindArbitraryException</a></span>(<a href="../../../net/jqwik/api/providers/TypeUsage.html" title="interface in net.jqwik.api.providers">TypeUsage</a> typeUsage)</code> </td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../net/jqwik/api/CannotFindArbitraryException.html#CannotFindArbitraryException-net.jqwik.api.providers.TypeUsage-net.jqwik.api.ForAll-">CannotFindArbitraryException</a></span>(<a href="../../../net/jqwik/api/providers/TypeUsage.html" title="interface in net.jqwik.api.providers">TypeUsage</a> typeUsage,
<a href="../../../net/jqwik/api/ForAll.html" title="annotation in net.jqwik.api">ForAll</a> forAll)</code> </td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Throwable">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Throwable</h3>
<code>addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString</code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="CannotFindArbitraryException-net.jqwik.api.providers.TypeUsage-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>CannotFindArbitraryException</h4>
<pre>public CannotFindArbitraryException(<a href="../../../net/jqwik/api/providers/TypeUsage.html" title="interface in net.jqwik.api.providers">TypeUsage</a> typeUsage)</pre>
</li>
</ul>
<a name="CannotFindArbitraryException-net.jqwik.api.providers.TypeUsage-net.jqwik.api.ForAll-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>CannotFindArbitraryException</h4>
<pre>public CannotFindArbitraryException(<a href="../../../net/jqwik/api/providers/TypeUsage.html" title="interface in net.jqwik.api.providers">TypeUsage</a> typeUsage,
<a href="../../../net/jqwik/api/ForAll.html" title="annotation in net.jqwik.api">ForAll</a> forAll)</pre>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../net/jqwik/api/Assume.html" title="class in net.jqwik.api"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../net/jqwik/api/Combinators.html" title="class in net.jqwik.api"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?net/jqwik/api/CannotFindArbitraryException.html" target="_top">Frames</a></li>
<li><a href="CannotFindArbitraryException.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li><a href="#constructor.summary">Constr</a> | </li>
<li><a href="#methods.inherited.from.class.java.lang.Throwable">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor.detail">Constr</a> | </li>
<li>Method</li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<translate
android:duration="@integer/default_animation_duration"
android:fromXDelta="0%"
android:fromYDelta="0%"
android:toXDelta="-100%"
android:toYDelta="0%" />
</set> | {
"pile_set_name": "Github"
} |
/*
* Copyright 2014 Freescale Semiconductor, Inc.
*
* SPDX-License-Identifier: GPL-2.0+
*/
/*
* T1024/T1023 RDB board configuration file
*/
#ifndef __T1024RDB_H
#define __T1024RDB_H
/* High Level Configuration Options */
#define CONFIG_SYS_BOOK3E_HV /* Category E.HV supported */
#define CONFIG_MP /* support multiple processors */
#define CONFIG_ENABLE_36BIT_PHYS
#ifdef CONFIG_PHYS_64BIT
#define CONFIG_ADDR_MAP 1
#define CONFIG_SYS_NUM_ADDR_MAP 64 /* number of TLB1 entries */
#endif
#define CONFIG_SYS_FSL_CPC /* Corenet Platform Cache */
#define CONFIG_SYS_NUM_CPC CONFIG_SYS_NUM_DDR_CTLRS
#define CONFIG_ENV_OVERWRITE
/* support deep sleep */
#ifdef CONFIG_ARCH_T1024
#define CONFIG_DEEP_SLEEP
#endif
#ifdef CONFIG_RAMBOOT_PBL
#define CONFIG_SYS_FSL_PBL_PBI board/freescale/t102xrdb/t1024_pbi.cfg
#define CONFIG_SPL_FLUSH_IMAGE
#define CONFIG_SPL_TARGET "u-boot-with-spl.bin"
#define CONFIG_SYS_TEXT_BASE 0x30001000
#define CONFIG_SPL_TEXT_BASE 0xFFFD8000
#define CONFIG_SPL_PAD_TO 0x40000
#define CONFIG_SPL_MAX_SIZE 0x28000
#define RESET_VECTOR_OFFSET 0x27FFC
#define BOOT_PAGE_OFFSET 0x27000
#ifdef CONFIG_SPL_BUILD
#define CONFIG_SPL_SKIP_RELOCATE
#define CONFIG_SPL_COMMON_INIT_DDR
#define CONFIG_SYS_CCSR_DO_NOT_RELOCATE
#endif
#ifdef CONFIG_NAND
#define CONFIG_SYS_NAND_U_BOOT_SIZE (768 << 10)
#define CONFIG_SYS_NAND_U_BOOT_DST 0x30000000
#define CONFIG_SYS_NAND_U_BOOT_START 0x30000000
#define CONFIG_SYS_NAND_U_BOOT_OFFS (256 << 10)
#define CONFIG_SYS_LDSCRIPT "arch/powerpc/cpu/mpc85xx/u-boot-nand.lds"
#if defined(CONFIG_TARGET_T1024RDB)
#define CONFIG_SYS_FSL_PBL_RCW board/freescale/t102xrdb/t1024_nand_rcw.cfg
#elif defined(CONFIG_TARGET_T1023RDB)
#define CONFIG_SYS_FSL_PBL_RCW board/freescale/t102xrdb/t1023_nand_rcw.cfg
#endif
#define CONFIG_SPL_NAND_BOOT
#endif
#ifdef CONFIG_SPIFLASH
#define CONFIG_RESET_VECTOR_ADDRESS 0x30000FFC
#define CONFIG_SPL_SPI_FLASH_MINIMAL
#define CONFIG_SYS_SPI_FLASH_U_BOOT_SIZE (768 << 10)
#define CONFIG_SYS_SPI_FLASH_U_BOOT_DST (0x30000000)
#define CONFIG_SYS_SPI_FLASH_U_BOOT_START (0x30000000)
#define CONFIG_SYS_SPI_FLASH_U_BOOT_OFFS (256 << 10)
#define CONFIG_SYS_LDSCRIPT "arch/powerpc/cpu/mpc85xx/u-boot.lds"
#ifndef CONFIG_SPL_BUILD
#define CONFIG_SYS_MPC85XX_NO_RESETVEC
#endif
#if defined(CONFIG_TARGET_T1024RDB)
#define CONFIG_SYS_FSL_PBL_RCW board/freescale/t102xrdb/t1024_spi_rcw.cfg
#elif defined(CONFIG_TARGET_T1023RDB)
#define CONFIG_SYS_FSL_PBL_RCW board/freescale/t102xrdb/t1023_spi_rcw.cfg
#endif
#define CONFIG_SPL_SPI_BOOT
#endif
#ifdef CONFIG_SDCARD
#define CONFIG_RESET_VECTOR_ADDRESS 0x30000FFC
#define CONFIG_SPL_MMC_MINIMAL
#define CONFIG_SYS_MMC_U_BOOT_SIZE (768 << 10)
#define CONFIG_SYS_MMC_U_BOOT_DST (0x30000000)
#define CONFIG_SYS_MMC_U_BOOT_START (0x30000000)
#define CONFIG_SYS_MMC_U_BOOT_OFFS (260 << 10)
#define CONFIG_SYS_LDSCRIPT "arch/powerpc/cpu/mpc85xx/u-boot.lds"
#ifndef CONFIG_SPL_BUILD
#define CONFIG_SYS_MPC85XX_NO_RESETVEC
#endif
#if defined(CONFIG_TARGET_T1024RDB)
#define CONFIG_SYS_FSL_PBL_RCW board/freescale/t102xrdb/t1024_sd_rcw.cfg
#elif defined(CONFIG_TARGET_T1023RDB)
#define CONFIG_SYS_FSL_PBL_RCW board/freescale/t102xrdb/t1023_sd_rcw.cfg
#endif
#define CONFIG_SPL_MMC_BOOT
#endif
#endif /* CONFIG_RAMBOOT_PBL */
#ifndef CONFIG_SYS_TEXT_BASE
#define CONFIG_SYS_TEXT_BASE 0xeff40000
#endif
#ifndef CONFIG_RESET_VECTOR_ADDRESS
#define CONFIG_RESET_VECTOR_ADDRESS 0xeffffffc
#endif
#ifdef CONFIG_MTD_NOR_FLASH
#define CONFIG_FLASH_CFI_DRIVER
#define CONFIG_SYS_FLASH_CFI
#define CONFIG_SYS_FLASH_USE_BUFFER_WRITE
#endif
/* PCIe Boot - Master */
#define CONFIG_SRIO_PCIE_BOOT_MASTER
/*
* for slave u-boot IMAGE instored in master memory space,
* PHYS must be aligned based on the SIZE
*/
#define CONFIG_SRIO_PCIE_BOOT_IMAGE_MEM_BUS1 0xfff00000ull
#define CONFIG_SRIO_PCIE_BOOT_IMAGE_SIZE 0x100000 /* 1M */
#ifdef CONFIG_PHYS_64BIT
#define CONFIG_SRIO_PCIE_BOOT_IMAGE_MEM_PHYS 0xfef200000ull
#define CONFIG_SRIO_PCIE_BOOT_IMAGE_MEM_BUS2 0x3fff00000ull
#else
#define CONFIG_SRIO_PCIE_BOOT_IMAGE_MEM_PHYS 0xef200000
#define CONFIG_SRIO_PCIE_BOOT_IMAGE_MEM_BUS2 0xfff00000
#endif
/*
* for slave UCODE and ENV instored in master memory space,
* PHYS must be aligned based on the SIZE
*/
#ifdef CONFIG_PHYS_64BIT
#define CONFIG_SRIO_PCIE_BOOT_UCODE_ENV_MEM_PHYS 0xfef100000ull
#define CONFIG_SRIO_PCIE_BOOT_UCODE_ENV_MEM_BUS 0x3ffe00000ull
#else
#define CONFIG_SRIO_PCIE_BOOT_UCODE_ENV_MEM_PHYS 0xef100000
#define CONFIG_SRIO_PCIE_BOOT_UCODE_ENV_MEM_BUS 0xffe00000
#endif
#define CONFIG_SRIO_PCIE_BOOT_UCODE_ENV_SIZE 0x40000 /* 256K */
/* slave core release by master*/
#define CONFIG_SRIO_PCIE_BOOT_BRR_OFFSET 0xe00e4
#define CONFIG_SRIO_PCIE_BOOT_RELEASE_MASK 0x00000001 /* release core 0 */
/* PCIe Boot - Slave */
#ifdef CONFIG_SRIO_PCIE_BOOT_SLAVE
#define CONFIG_SYS_SRIO_PCIE_BOOT_UCODE_ENV_ADDR 0xFFE00000
#define CONFIG_SYS_SRIO_PCIE_BOOT_UCODE_ENV_ADDR_PHYS \
(0x300000000ull | CONFIG_SYS_SRIO_PCIE_BOOT_UCODE_ENV_ADDR)
/* Set 1M boot space for PCIe boot */
#define CONFIG_SYS_SRIO_PCIE_BOOT_SLAVE_ADDR (CONFIG_SYS_TEXT_BASE & 0xfff00000)
#define CONFIG_SYS_SRIO_PCIE_BOOT_SLAVE_ADDR_PHYS \
(0x300000000ull | CONFIG_SYS_SRIO_PCIE_BOOT_SLAVE_ADDR)
#define CONFIG_RESET_VECTOR_ADDRESS 0xfffffffc
#endif
#if defined(CONFIG_SPIFLASH)
#define CONFIG_SYS_EXTRA_ENV_RELOC
#define CONFIG_ENV_SPI_BUS 0
#define CONFIG_ENV_SPI_CS 0
#define CONFIG_ENV_SPI_MAX_HZ 10000000
#define CONFIG_ENV_SPI_MODE 0
#define CONFIG_ENV_SIZE 0x2000 /* 8KB */
#define CONFIG_ENV_OFFSET 0x100000 /* 1MB */
#if defined(CONFIG_TARGET_T1024RDB)
#define CONFIG_ENV_SECT_SIZE 0x10000
#elif defined(CONFIG_TARGET_T1023RDB)
#define CONFIG_ENV_SECT_SIZE 0x40000
#endif
#elif defined(CONFIG_SDCARD)
#define CONFIG_SYS_EXTRA_ENV_RELOC
#define CONFIG_SYS_MMC_ENV_DEV 0
#define CONFIG_ENV_SIZE 0x2000
#define CONFIG_ENV_OFFSET (512 * 0x800)
#elif defined(CONFIG_NAND)
#define CONFIG_SYS_EXTRA_ENV_RELOC
#define CONFIG_ENV_SIZE 0x2000
#if defined(CONFIG_TARGET_T1024RDB)
#define CONFIG_ENV_OFFSET (2 * CONFIG_SYS_NAND_BLOCK_SIZE)
#elif defined(CONFIG_TARGET_T1023RDB)
#define CONFIG_ENV_OFFSET (10 * CONFIG_SYS_NAND_BLOCK_SIZE)
#endif
#elif defined(CONFIG_SRIO_PCIE_BOOT_SLAVE)
#define CONFIG_ENV_ADDR 0xffe20000
#define CONFIG_ENV_SIZE 0x2000
#elif defined(CONFIG_ENV_IS_NOWHERE)
#define CONFIG_ENV_SIZE 0x2000
#else
#define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE - CONFIG_ENV_SECT_SIZE)
#define CONFIG_ENV_SIZE 0x2000
#define CONFIG_ENV_SECT_SIZE 0x20000 /* 128K (one sector) */
#endif
#ifndef __ASSEMBLY__
unsigned long get_board_sys_clk(void);
unsigned long get_board_ddr_clk(void);
#endif
#define CONFIG_SYS_CLK_FREQ 100000000
#define CONFIG_DDR_CLK_FREQ 100000000
/*
* These can be toggled for performance analysis, otherwise use default.
*/
#define CONFIG_SYS_CACHE_STASHING
#define CONFIG_BACKSIDE_L2_CACHE
#define CONFIG_SYS_INIT_L2CSR0 L2CSR0_L2E
#define CONFIG_BTB /* toggle branch predition */
#define CONFIG_DDR_ECC
#ifdef CONFIG_DDR_ECC
#define CONFIG_ECC_INIT_VIA_DDRCONTROLLER
#define CONFIG_MEM_INIT_VALUE 0xdeadbeef
#endif
#define CONFIG_SYS_MEMTEST_START 0x00200000 /* memtest works on */
#define CONFIG_SYS_MEMTEST_END 0x00400000
#define CONFIG_SYS_ALT_MEMTEST
/*
* Config the L3 Cache as L3 SRAM
*/
#define CONFIG_SYS_INIT_L3_ADDR 0xFFFC0000
#define CONFIG_SYS_L3_SIZE (256 << 10)
#define CONFIG_SPL_GD_ADDR (CONFIG_SYS_INIT_L3_ADDR + 32 * 1024)
#ifdef CONFIG_RAMBOOT_PBL
#define CONFIG_ENV_ADDR (CONFIG_SPL_GD_ADDR + 4 * 1024)
#endif
#define CONFIG_SPL_RELOC_MALLOC_ADDR (CONFIG_SPL_GD_ADDR + 12 * 1024)
#define CONFIG_SPL_RELOC_MALLOC_SIZE (30 << 10)
#define CONFIG_SPL_RELOC_STACK (CONFIG_SPL_GD_ADDR + 64 * 1024)
#define CONFIG_SPL_RELOC_STACK_SIZE (22 << 10)
#ifdef CONFIG_PHYS_64BIT
#define CONFIG_SYS_DCSRBAR 0xf0000000
#define CONFIG_SYS_DCSRBAR_PHYS 0xf00000000ull
#endif
/* EEPROM */
#define CONFIG_ID_EEPROM
#define CONFIG_SYS_I2C_EEPROM_NXID
#define CONFIG_SYS_EEPROM_BUS_NUM 0
#define CONFIG_SYS_I2C_EEPROM_ADDR 0x50
#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 3
#define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 5
/*
* DDR Setup
*/
#define CONFIG_VERY_BIG_RAM
#define CONFIG_SYS_DDR_SDRAM_BASE 0x00000000
#define CONFIG_SYS_SDRAM_BASE CONFIG_SYS_DDR_SDRAM_BASE
#define CONFIG_DIMM_SLOTS_PER_CTLR 1
#define CONFIG_CHIP_SELECTS_PER_CTRL (4 * CONFIG_DIMM_SLOTS_PER_CTLR)
#define CONFIG_FSL_DDR_INTERACTIVE
#if defined(CONFIG_TARGET_T1024RDB)
#define CONFIG_DDR_SPD
#define CONFIG_SYS_SPD_BUS_NUM 0
#define SPD_EEPROM_ADDRESS 0x51
#define CONFIG_SYS_SDRAM_SIZE 4096 /* for fixed parameter use */
#elif defined(CONFIG_TARGET_T1023RDB)
#define CONFIG_SYS_DDR_RAW_TIMING
#define CONFIG_SYS_SDRAM_SIZE 2048
#endif
/*
* IFC Definitions
*/
#define CONFIG_SYS_FLASH_BASE 0xe8000000
#ifdef CONFIG_PHYS_64BIT
#define CONFIG_SYS_FLASH_BASE_PHYS (0xf00000000ull | CONFIG_SYS_FLASH_BASE)
#else
#define CONFIG_SYS_FLASH_BASE_PHYS CONFIG_SYS_FLASH_BASE
#endif
#define CONFIG_SYS_NOR0_CSPR_EXT (0xf)
#define CONFIG_SYS_NOR0_CSPR (CSPR_PHYS_ADDR(CONFIG_SYS_FLASH_BASE_PHYS) | \
CSPR_PORT_SIZE_16 | \
CSPR_MSEL_NOR | \
CSPR_V)
#define CONFIG_SYS_NOR_AMASK IFC_AMASK(128*1024*1024)
/* NOR Flash Timing Params */
#if defined(CONFIG_TARGET_T1024RDB)
#define CONFIG_SYS_NOR_CSOR CSOR_NAND_TRHZ_80
#elif defined(CONFIG_TARGET_T1023RDB)
#define CONFIG_SYS_NOR_CSOR (CSOR_NOR_ADM_SHIFT(0) | \
CSOR_NAND_TRHZ_80 | CSOR_NOR_ADM_SHFT_MODE_EN)
#endif
#define CONFIG_SYS_NOR_FTIM0 (FTIM0_NOR_TACSE(0x4) | \
FTIM0_NOR_TEADC(0x5) | \
FTIM0_NOR_TEAHC(0x5))
#define CONFIG_SYS_NOR_FTIM1 (FTIM1_NOR_TACO(0x35) | \
FTIM1_NOR_TRAD_NOR(0x1A) |\
FTIM1_NOR_TSEQRAD_NOR(0x13))
#define CONFIG_SYS_NOR_FTIM2 (FTIM2_NOR_TCS(0x4) | \
FTIM2_NOR_TCH(0x4) | \
FTIM2_NOR_TWPH(0x0E) | \
FTIM2_NOR_TWP(0x1c))
#define CONFIG_SYS_NOR_FTIM3 0x0
#define CONFIG_SYS_FLASH_QUIET_TEST
#define CONFIG_FLASH_SHOW_PROGRESS 45 /* count down from 45/5: 9..1 */
#define CONFIG_SYS_MAX_FLASH_BANKS 1 /* number of banks */
#define CONFIG_SYS_MAX_FLASH_SECT 1024 /* sectors per device */
#define CONFIG_SYS_FLASH_ERASE_TOUT 60000 /* Flash Erase Timeout (ms) */
#define CONFIG_SYS_FLASH_WRITE_TOUT 500 /* Flash Write Timeout (ms) */
#define CONFIG_SYS_FLASH_EMPTY_INFO
#define CONFIG_SYS_FLASH_BANKS_LIST {CONFIG_SYS_FLASH_BASE_PHYS}
#ifdef CONFIG_TARGET_T1024RDB
/* CPLD on IFC */
#define CONFIG_SYS_CPLD_BASE 0xffdf0000
#define CONFIG_SYS_CPLD_BASE_PHYS (0xf00000000ull | CONFIG_SYS_CPLD_BASE)
#define CONFIG_SYS_CSPR2_EXT (0xf)
#define CONFIG_SYS_CSPR2 (CSPR_PHYS_ADDR(CONFIG_SYS_CPLD_BASE) \
| CSPR_PORT_SIZE_8 \
| CSPR_MSEL_GPCM \
| CSPR_V)
#define CONFIG_SYS_AMASK2 IFC_AMASK(64*1024)
#define CONFIG_SYS_CSOR2 0x0
/* CPLD Timing parameters for IFC CS2 */
#define CONFIG_SYS_CS2_FTIM0 (FTIM0_GPCM_TACSE(0x0e) | \
FTIM0_GPCM_TEADC(0x0e) | \
FTIM0_GPCM_TEAHC(0x0e))
#define CONFIG_SYS_CS2_FTIM1 (FTIM1_GPCM_TACO(0x0e) | \
FTIM1_GPCM_TRAD(0x1f))
#define CONFIG_SYS_CS2_FTIM2 (FTIM2_GPCM_TCS(0x0e) | \
FTIM2_GPCM_TCH(0x8) | \
FTIM2_GPCM_TWP(0x1f))
#define CONFIG_SYS_CS2_FTIM3 0x0
#endif
/* NAND Flash on IFC */
#define CONFIG_NAND_FSL_IFC
#define CONFIG_SYS_NAND_BASE 0xff800000
#ifdef CONFIG_PHYS_64BIT
#define CONFIG_SYS_NAND_BASE_PHYS (0xf00000000ull | CONFIG_SYS_NAND_BASE)
#else
#define CONFIG_SYS_NAND_BASE_PHYS CONFIG_SYS_NAND_BASE
#endif
#define CONFIG_SYS_NAND_CSPR_EXT (0xf)
#define CONFIG_SYS_NAND_CSPR (CSPR_PHYS_ADDR(CONFIG_SYS_NAND_BASE_PHYS) \
| CSPR_PORT_SIZE_8 /* Port Size = 8 bit */ \
| CSPR_MSEL_NAND /* MSEL = NAND */ \
| CSPR_V)
#define CONFIG_SYS_NAND_AMASK IFC_AMASK(64*1024)
#if defined(CONFIG_TARGET_T1024RDB)
#define CONFIG_SYS_NAND_CSOR (CSOR_NAND_ECC_ENC_EN /* ECC on encode */ \
| CSOR_NAND_ECC_DEC_EN /* ECC on decode */ \
| CSOR_NAND_ECC_MODE_4 /* 4-bit ECC */ \
| CSOR_NAND_RAL_3 /* RAL = 3Byes */ \
| CSOR_NAND_PGS_4K /* Page Size = 4K */ \
| CSOR_NAND_SPRZ_224 /* Spare size = 224 */ \
| CSOR_NAND_PB(64)) /*Pages Per Block = 64*/
#define CONFIG_SYS_NAND_BLOCK_SIZE (512 * 1024)
#elif defined(CONFIG_TARGET_T1023RDB)
#define CONFIG_SYS_NAND_CSOR (CSOR_NAND_ECC_ENC_EN /* ECC on encode */ \
| CSOR_NAND_ECC_DEC_EN /* ECC on decode */ \
| CSOR_NAND_ECC_MODE_4 /* 4-bit ECC */ \
| CSOR_NAND_RAL_3 /* RAL 3Bytes */ \
| CSOR_NAND_PGS_2K /* Page Size = 2K */ \
| CSOR_NAND_SPRZ_128 /* Spare size = 128 */ \
| CSOR_NAND_PB(64)) /*Pages Per Block = 64*/
#define CONFIG_SYS_NAND_BLOCK_SIZE (128 * 1024)
#endif
#define CONFIG_SYS_NAND_ONFI_DETECTION
/* ONFI NAND Flash mode0 Timing Params */
#define CONFIG_SYS_NAND_FTIM0 (FTIM0_NAND_TCCST(0x07) | \
FTIM0_NAND_TWP(0x18) | \
FTIM0_NAND_TWCHT(0x07) | \
FTIM0_NAND_TWH(0x0a))
#define CONFIG_SYS_NAND_FTIM1 (FTIM1_NAND_TADLE(0x32) | \
FTIM1_NAND_TWBE(0x39) | \
FTIM1_NAND_TRR(0x0e) | \
FTIM1_NAND_TRP(0x18))
#define CONFIG_SYS_NAND_FTIM2 (FTIM2_NAND_TRAD(0x0f) | \
FTIM2_NAND_TREH(0x0a) | \
FTIM2_NAND_TWHRE(0x1e))
#define CONFIG_SYS_NAND_FTIM3 0x0
#define CONFIG_SYS_NAND_DDR_LAW 11
#define CONFIG_SYS_NAND_BASE_LIST { CONFIG_SYS_NAND_BASE }
#define CONFIG_SYS_MAX_NAND_DEVICE 1
#if defined(CONFIG_NAND)
#define CONFIG_SYS_CSPR0_EXT CONFIG_SYS_NAND_CSPR_EXT
#define CONFIG_SYS_CSPR0 CONFIG_SYS_NAND_CSPR
#define CONFIG_SYS_AMASK0 CONFIG_SYS_NAND_AMASK
#define CONFIG_SYS_CSOR0 CONFIG_SYS_NAND_CSOR
#define CONFIG_SYS_CS0_FTIM0 CONFIG_SYS_NAND_FTIM0
#define CONFIG_SYS_CS0_FTIM1 CONFIG_SYS_NAND_FTIM1
#define CONFIG_SYS_CS0_FTIM2 CONFIG_SYS_NAND_FTIM2
#define CONFIG_SYS_CS0_FTIM3 CONFIG_SYS_NAND_FTIM3
#define CONFIG_SYS_CSPR1_EXT CONFIG_SYS_NOR0_CSPR_EXT
#define CONFIG_SYS_CSPR1 CONFIG_SYS_NOR0_CSPR
#define CONFIG_SYS_AMASK1 CONFIG_SYS_NOR_AMASK
#define CONFIG_SYS_CSOR1 CONFIG_SYS_NOR_CSOR
#define CONFIG_SYS_CS1_FTIM0 CONFIG_SYS_NOR_FTIM0
#define CONFIG_SYS_CS1_FTIM1 CONFIG_SYS_NOR_FTIM1
#define CONFIG_SYS_CS1_FTIM2 CONFIG_SYS_NOR_FTIM2
#define CONFIG_SYS_CS1_FTIM3 CONFIG_SYS_NOR_FTIM3
#else
#define CONFIG_SYS_CSPR0_EXT CONFIG_SYS_NOR0_CSPR_EXT
#define CONFIG_SYS_CSPR0 CONFIG_SYS_NOR0_CSPR
#define CONFIG_SYS_AMASK0 CONFIG_SYS_NOR_AMASK
#define CONFIG_SYS_CSOR0 CONFIG_SYS_NOR_CSOR
#define CONFIG_SYS_CS0_FTIM0 CONFIG_SYS_NOR_FTIM0
#define CONFIG_SYS_CS0_FTIM1 CONFIG_SYS_NOR_FTIM1
#define CONFIG_SYS_CS0_FTIM2 CONFIG_SYS_NOR_FTIM2
#define CONFIG_SYS_CS0_FTIM3 CONFIG_SYS_NOR_FTIM3
#define CONFIG_SYS_CSPR1_EXT CONFIG_SYS_NAND_CSPR_EXT
#define CONFIG_SYS_CSPR1 CONFIG_SYS_NAND_CSPR
#define CONFIG_SYS_AMASK1 CONFIG_SYS_NAND_AMASK
#define CONFIG_SYS_CSOR1 CONFIG_SYS_NAND_CSOR
#define CONFIG_SYS_CS1_FTIM0 CONFIG_SYS_NAND_FTIM0
#define CONFIG_SYS_CS1_FTIM1 CONFIG_SYS_NAND_FTIM1
#define CONFIG_SYS_CS1_FTIM2 CONFIG_SYS_NAND_FTIM2
#define CONFIG_SYS_CS1_FTIM3 CONFIG_SYS_NAND_FTIM3
#endif
#ifdef CONFIG_SPL_BUILD
#define CONFIG_SYS_MONITOR_BASE CONFIG_SPL_TEXT_BASE
#else
#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE
#endif
#if defined(CONFIG_RAMBOOT_PBL)
#define CONFIG_SYS_RAMBOOT
#endif
#define CONFIG_BOARD_EARLY_INIT_R
#define CONFIG_MISC_INIT_R
#define CONFIG_HWCONFIG
/* define to use L1 as initial stack */
#define CONFIG_L1_INIT_RAM
#define CONFIG_SYS_INIT_RAM_LOCK
#define CONFIG_SYS_INIT_RAM_ADDR 0xfdd00000 /* Initial L1 address */
#ifdef CONFIG_PHYS_64BIT
#define CONFIG_SYS_INIT_RAM_ADDR_PHYS_HIGH 0xf
#define CONFIG_SYS_INIT_RAM_ADDR_PHYS_LOW 0xfe03c000
/* The assembler doesn't like typecast */
#define CONFIG_SYS_INIT_RAM_ADDR_PHYS \
((CONFIG_SYS_INIT_RAM_ADDR_PHYS_HIGH * 1ull << 32) | \
CONFIG_SYS_INIT_RAM_ADDR_PHYS_LOW)
#else
#define CONFIG_SYS_INIT_RAM_ADDR_PHYS 0xfe03c000 /* Initial L1 address */
#define CONFIG_SYS_INIT_RAM_ADDR_PHYS_HIGH 0
#define CONFIG_SYS_INIT_RAM_ADDR_PHYS_LOW CONFIG_SYS_INIT_RAM_ADDR_PHYS
#endif
#define CONFIG_SYS_INIT_RAM_SIZE 0x00004000
#define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_INIT_RAM_SIZE - \
GENERATED_GBL_DATA_SIZE)
#define CONFIG_SYS_INIT_SP_OFFSET CONFIG_SYS_GBL_DATA_OFFSET
#define CONFIG_SYS_MONITOR_LEN (768 * 1024)
#define CONFIG_SYS_MALLOC_LEN (10 * 1024 * 1024)
/* Serial Port */
#define CONFIG_CONS_INDEX 1
#define CONFIG_SYS_NS16550_SERIAL
#define CONFIG_SYS_NS16550_REG_SIZE 1
#define CONFIG_SYS_NS16550_CLK (get_bus_freq(0)/2)
#define CONFIG_SYS_BAUDRATE_TABLE \
{300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200}
#define CONFIG_SYS_NS16550_COM1 (CONFIG_SYS_CCSRBAR+0x11C500)
#define CONFIG_SYS_NS16550_COM2 (CONFIG_SYS_CCSRBAR+0x11C600)
#define CONFIG_SYS_NS16550_COM3 (CONFIG_SYS_CCSRBAR+0x11D500)
#define CONFIG_SYS_NS16550_COM4 (CONFIG_SYS_CCSRBAR+0x11D600)
/* Video */
#undef CONFIG_FSL_DIU_FB /* RDB doesn't support DIU */
#ifdef CONFIG_FSL_DIU_FB
#define CONFIG_SYS_DIU_ADDR (CONFIG_SYS_CCSRBAR + 0x180000)
#define CONFIG_VIDEO_LOGO
#define CONFIG_VIDEO_BMP_LOGO
#define CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS
/*
* With CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS, flash I/O is really slow, so
* disable empty flash sector detection, which is I/O-intensive.
*/
#undef CONFIG_SYS_FLASH_EMPTY_INFO
#endif
/* I2C */
#define CONFIG_SYS_I2C
#define CONFIG_SYS_I2C_FSL /* Use FSL common I2C driver */
#define CONFIG_SYS_FSL_I2C_SPEED 50000 /* I2C speed in Hz */
#define CONFIG_SYS_FSL_I2C_SLAVE 0x7F
#define CONFIG_SYS_FSL_I2C2_SPEED 50000 /* I2C speed in Hz */
#define CONFIG_SYS_FSL_I2C2_SLAVE 0x7F
#define CONFIG_SYS_FSL_I2C_OFFSET 0x118000
#define CONFIG_SYS_FSL_I2C2_OFFSET 0x118100
#define I2C_PCA6408_BUS_NUM 1
#define I2C_PCA6408_ADDR 0x20
/* I2C bus multiplexer */
#define I2C_MUX_CH_DEFAULT 0x8
/*
* RTC configuration
*/
#define RTC
#define CONFIG_RTC_DS1337 1
#define CONFIG_SYS_I2C_RTC_ADDR 0x68
/*
* eSPI - Enhanced SPI
*/
#define CONFIG_SPI_FLASH_BAR
#define CONFIG_SF_DEFAULT_SPEED 10000000
#define CONFIG_SF_DEFAULT_MODE 0
/*
* General PCIe
* Memory space is mapped 1-1, but I/O space must start from 0.
*/
#define CONFIG_PCIE1 /* PCIE controller 1 */
#define CONFIG_PCIE2 /* PCIE controller 2 */
#define CONFIG_PCIE3 /* PCIE controller 3 */
#ifdef CONFIG_ARCH_T1040
#define CONFIG_PCIE4 /* PCIE controller 4 */
#endif
#define CONFIG_FSL_PCI_INIT /* Use common FSL init code */
#define CONFIG_SYS_PCI_64BIT /* enable 64-bit PCI resources */
#define CONFIG_PCI_INDIRECT_BRIDGE
#ifdef CONFIG_PCI
/* controller 1, direct to uli, tgtid 3, Base address 20000 */
#ifdef CONFIG_PCIE1
#define CONFIG_SYS_PCIE1_MEM_VIRT 0x80000000
#ifdef CONFIG_PHYS_64BIT
#define CONFIG_SYS_PCIE1_MEM_BUS 0xe0000000
#define CONFIG_SYS_PCIE1_MEM_PHYS 0xc00000000ull
#else
#define CONFIG_SYS_PCIE1_MEM_BUS 0x80000000
#define CONFIG_SYS_PCIE1_MEM_PHYS 0x80000000
#endif
#define CONFIG_SYS_PCIE1_MEM_SIZE 0x10000000 /* 256M */
#define CONFIG_SYS_PCIE1_IO_VIRT 0xf8000000
#define CONFIG_SYS_PCIE1_IO_BUS 0x00000000
#ifdef CONFIG_PHYS_64BIT
#define CONFIG_SYS_PCIE1_IO_PHYS 0xff8000000ull
#else
#define CONFIG_SYS_PCIE1_IO_PHYS 0xf8000000
#endif
#define CONFIG_SYS_PCIE1_IO_SIZE 0x00010000 /* 64k */
#endif
/* controller 2, Slot 2, tgtid 2, Base address 201000 */
#ifdef CONFIG_PCIE2
#define CONFIG_SYS_PCIE2_MEM_VIRT 0x90000000
#ifdef CONFIG_PHYS_64BIT
#define CONFIG_SYS_PCIE2_MEM_BUS 0xe0000000
#define CONFIG_SYS_PCIE2_MEM_PHYS 0xc10000000ull
#else
#define CONFIG_SYS_PCIE2_MEM_BUS 0x90000000
#define CONFIG_SYS_PCIE2_MEM_PHYS 0x90000000
#endif
#define CONFIG_SYS_PCIE2_MEM_SIZE 0x10000000 /* 256M */
#define CONFIG_SYS_PCIE2_IO_VIRT 0xf8010000
#define CONFIG_SYS_PCIE2_IO_BUS 0x00000000
#ifdef CONFIG_PHYS_64BIT
#define CONFIG_SYS_PCIE2_IO_PHYS 0xff8010000ull
#else
#define CONFIG_SYS_PCIE2_IO_PHYS 0xf8010000
#endif
#define CONFIG_SYS_PCIE2_IO_SIZE 0x00010000 /* 64k */
#endif
/* controller 3, Slot 1, tgtid 1, Base address 202000 */
#ifdef CONFIG_PCIE3
#define CONFIG_SYS_PCIE3_MEM_VIRT 0xa0000000
#ifdef CONFIG_PHYS_64BIT
#define CONFIG_SYS_PCIE3_MEM_BUS 0xe0000000
#define CONFIG_SYS_PCIE3_MEM_PHYS 0xc20000000ull
#else
#define CONFIG_SYS_PCIE3_MEM_BUS 0xa0000000
#define CONFIG_SYS_PCIE3_MEM_PHYS 0xa0000000
#endif
#define CONFIG_SYS_PCIE3_MEM_SIZE 0x10000000 /* 256M */
#define CONFIG_SYS_PCIE3_IO_VIRT 0xf8020000
#define CONFIG_SYS_PCIE3_IO_BUS 0x00000000
#ifdef CONFIG_PHYS_64BIT
#define CONFIG_SYS_PCIE3_IO_PHYS 0xff8020000ull
#else
#define CONFIG_SYS_PCIE3_IO_PHYS 0xf8020000
#endif
#define CONFIG_SYS_PCIE3_IO_SIZE 0x00010000 /* 64k */
#endif
/* controller 4, Base address 203000, to be removed */
#ifdef CONFIG_PCIE4
#define CONFIG_SYS_PCIE4_MEM_VIRT 0xb0000000
#ifdef CONFIG_PHYS_64BIT
#define CONFIG_SYS_PCIE4_MEM_BUS 0xe0000000
#define CONFIG_SYS_PCIE4_MEM_PHYS 0xc30000000ull
#else
#define CONFIG_SYS_PCIE4_MEM_BUS 0xb0000000
#define CONFIG_SYS_PCIE4_MEM_PHYS 0xb0000000
#endif
#define CONFIG_SYS_PCIE4_MEM_SIZE 0x10000000 /* 256M */
#define CONFIG_SYS_PCIE4_IO_VIRT 0xf8030000
#define CONFIG_SYS_PCIE4_IO_BUS 0x00000000
#ifdef CONFIG_PHYS_64BIT
#define CONFIG_SYS_PCIE4_IO_PHYS 0xff8030000ull
#else
#define CONFIG_SYS_PCIE4_IO_PHYS 0xf8030000
#endif
#define CONFIG_SYS_PCIE4_IO_SIZE 0x00010000 /* 64k */
#endif
#define CONFIG_PCI_SCAN_SHOW /* show pci devices on startup */
#endif /* CONFIG_PCI */
/*
* USB
*/
#define CONFIG_HAS_FSL_DR_USB
#ifdef CONFIG_HAS_FSL_DR_USB
#define CONFIG_USB_EHCI_FSL
#define CONFIG_EHCI_HCD_INIT_AFTER_RESET
#endif
/*
* SDHC
*/
#ifdef CONFIG_MMC
#define CONFIG_FSL_ESDHC
#define CONFIG_SYS_FSL_ESDHC_ADDR CONFIG_SYS_MPC85xx_ESDHC_ADDR
#endif
/* Qman/Bman */
#ifndef CONFIG_NOBQFMAN
#define CONFIG_SYS_DPAA_QBMAN /* Support Q/Bman */
#define CONFIG_SYS_BMAN_NUM_PORTALS 10
#define CONFIG_SYS_BMAN_MEM_BASE 0xf4000000
#ifdef CONFIG_PHYS_64BIT
#define CONFIG_SYS_BMAN_MEM_PHYS 0xff4000000ull
#else
#define CONFIG_SYS_BMAN_MEM_PHYS CONFIG_SYS_BMAN_MEM_BASE
#endif
#define CONFIG_SYS_BMAN_MEM_SIZE 0x02000000
#define CONFIG_SYS_BMAN_SP_CENA_SIZE 0x4000
#define CONFIG_SYS_BMAN_SP_CINH_SIZE 0x1000
#define CONFIG_SYS_BMAN_CENA_BASE CONFIG_SYS_BMAN_MEM_BASE
#define CONFIG_SYS_BMAN_CENA_SIZE (CONFIG_SYS_BMAN_MEM_SIZE >> 1)
#define CONFIG_SYS_BMAN_CINH_BASE (CONFIG_SYS_BMAN_MEM_BASE + \
CONFIG_SYS_BMAN_CENA_SIZE)
#define CONFIG_SYS_BMAN_CINH_SIZE (CONFIG_SYS_BMAN_MEM_SIZE >> 1)
#define CONFIG_SYS_BMAN_SWP_ISDR_REG 0xE08
#define CONFIG_SYS_QMAN_NUM_PORTALS 10
#define CONFIG_SYS_QMAN_MEM_BASE 0xf6000000
#ifdef CONFIG_PHYS_64BIT
#define CONFIG_SYS_QMAN_MEM_PHYS 0xff6000000ull
#else
#define CONFIG_SYS_QMAN_MEM_PHYS CONFIG_SYS_QMAN_MEM_BASE
#endif
#define CONFIG_SYS_QMAN_MEM_SIZE 0x02000000
#define CONFIG_SYS_QMAN_SP_CENA_SIZE 0x4000
#define CONFIG_SYS_QMAN_SP_CINH_SIZE 0x1000
#define CONFIG_SYS_QMAN_CENA_BASE CONFIG_SYS_QMAN_MEM_BASE
#define CONFIG_SYS_QMAN_CENA_SIZE (CONFIG_SYS_QMAN_MEM_SIZE >> 1)
#define CONFIG_SYS_QMAN_CINH_BASE (CONFIG_SYS_QMAN_MEM_BASE + \
CONFIG_SYS_QMAN_CENA_SIZE)
#define CONFIG_SYS_QMAN_CINH_SIZE (CONFIG_SYS_QMAN_MEM_SIZE >> 1)
#define CONFIG_SYS_QMAN_SWP_ISDR_REG 0xE08
#define CONFIG_SYS_DPAA_FMAN
#ifdef CONFIG_TARGET_T1024RDB
#define CONFIG_QE
#define CONFIG_U_QE
#endif
/* Default address of microcode for the Linux FMan driver */
#if defined(CONFIG_SPIFLASH)
/*
* env is stored at 0x100000, sector size is 0x10000, ucode is stored after
* env, so we got 0x110000.
*/
#define CONFIG_SYS_QE_FW_IN_SPIFLASH
#define CONFIG_SYS_FMAN_FW_ADDR 0x110000
#define CONFIG_SYS_QE_FW_ADDR 0x130000
#elif defined(CONFIG_SDCARD)
/*
* PBL SD boot image should stored at 0x1000(8 blocks), the size of the image is
* about 1MB (2048 blocks), Env is stored after the image, and the env size is
* 0x2000 (16 blocks), 8 + 2048 + 16 = 2072, enlarge it to 2080(0x820).
*/
#define CONFIG_SYS_QE_FMAN_FW_IN_MMC
#define CONFIG_SYS_FMAN_FW_ADDR (512 * 0x820)
#define CONFIG_SYS_QE_FW_ADDR (512 * 0x920)
#elif defined(CONFIG_NAND)
#define CONFIG_SYS_QE_FMAN_FW_IN_NAND
#if defined(CONFIG_TARGET_T1024RDB)
#define CONFIG_SYS_FMAN_FW_ADDR (3 * CONFIG_SYS_NAND_BLOCK_SIZE)
#define CONFIG_SYS_QE_FW_ADDR (4 * CONFIG_SYS_NAND_BLOCK_SIZE)
#elif defined(CONFIG_TARGET_T1023RDB)
#define CONFIG_SYS_FMAN_FW_ADDR (11 * CONFIG_SYS_NAND_BLOCK_SIZE)
#define CONFIG_SYS_QE_FW_ADDR (12 * CONFIG_SYS_NAND_BLOCK_SIZE)
#endif
#elif defined(CONFIG_SRIO_PCIE_BOOT_SLAVE)
/*
* Slave has no ucode locally, it can fetch this from remote. When implementing
* in two corenet boards, slave's ucode could be stored in master's memory
* space, the address can be mapped from slave TLB->slave LAW->
* slave SRIO or PCIE outbound window->master inbound window->
* master LAW->the ucode address in master's memory space.
*/
#define CONFIG_SYS_QE_FMAN_FW_IN_REMOTE
#define CONFIG_SYS_FMAN_FW_ADDR 0xFFE00000
#else
#define CONFIG_SYS_QE_FMAN_FW_IN_NOR
#define CONFIG_SYS_FMAN_FW_ADDR 0xEFF00000
#define CONFIG_SYS_QE_FW_ADDR 0xEFE00000
#endif
#define CONFIG_SYS_QE_FMAN_FW_LENGTH 0x10000
#define CONFIG_SYS_FDT_PAD (0x3000 + CONFIG_SYS_QE_FMAN_FW_LENGTH)
#endif /* CONFIG_NOBQFMAN */
#ifdef CONFIG_SYS_DPAA_FMAN
#define CONFIG_FMAN_ENET
#define CONFIG_PHYLIB_10G
#define CONFIG_PHY_REALTEK
#define CONFIG_PHY_AQUANTIA
#if defined(CONFIG_TARGET_T1024RDB)
#define RGMII_PHY1_ADDR 0x2
#define RGMII_PHY2_ADDR 0x6
#define SGMII_AQR_PHY_ADDR 0x2
#define FM1_10GEC1_PHY_ADDR 0x1
#elif defined(CONFIG_TARGET_T1023RDB)
#define RGMII_PHY1_ADDR 0x1
#define SGMII_RTK_PHY_ADDR 0x3
#define SGMII_AQR_PHY_ADDR 0x2
#endif
#endif
#ifdef CONFIG_FMAN_ENET
#define CONFIG_MII /* MII PHY management */
#define CONFIG_ETHPRIME "FM1@DTSEC4"
#endif
/*
* Dynamic MTD Partition support with mtdparts
*/
#ifdef CONFIG_MTD_NOR_FLASH
#define CONFIG_FLASH_CFI_MTD
#define MTDIDS_DEFAULT "nor0=fe8000000.nor,nand0=fff800000.flash," \
"spi0=spife110000.1"
#define MTDPARTS_DEFAULT "mtdparts=fe8000000.nor:1m(uboot),5m(kernel)," \
"128k(dtb),96m(fs),-(user);fff800000.flash:1m(uboot)," \
"5m(kernel),128k(dtb),96m(fs),-(user);spife110000.0:" \
"1m(uboot),5m(kernel),128k(dtb),-(user)"
#endif
/*
* Environment
*/
#define CONFIG_LOADS_ECHO /* echo on for serial download */
#define CONFIG_SYS_LOADS_BAUD_CHANGE /* allow baudrate change */
/*
* Miscellaneous configurable options
*/
#define CONFIG_SYS_LONGHELP /* undef to save memory */
#define CONFIG_CMDLINE_EDITING /* Command-line editing */
#define CONFIG_AUTO_COMPLETE /* add autocompletion support */
#define CONFIG_SYS_LOAD_ADDR 0x2000000 /* default load address */
/*
* For booting Linux, the board info and command line data
* have to be in the first 64 MB of memory, since this is
* the maximum mapped by the Linux kernel during initialization.
*/
#define CONFIG_SYS_BOOTMAPSZ (64 << 20) /* Initial map for Linux*/
#define CONFIG_SYS_BOOTM_LEN (64 << 20) /* Increase max gunzip size */
#ifdef CONFIG_CMD_KGDB
#define CONFIG_KGDB_BAUDRATE 230400 /* speed to run kgdb serial port */
#endif
/*
* Environment Configuration
*/
#define CONFIG_ROOTPATH "/opt/nfsroot"
#define CONFIG_BOOTFILE "uImage"
#define CONFIG_UBOOTPATH u-boot.bin /* U-Boot image on TFTP server */
#define CONFIG_LOADADDR 1000000 /* default location for tftp, bootm */
#define __USB_PHY_TYPE utmi
#ifdef CONFIG_ARCH_T1024
#define CONFIG_BOARDNAME t1024rdb
#define BANK_INTLV cs0_cs1
#else
#define CONFIG_BOARDNAME t1023rdb
#define BANK_INTLV null
#endif
#define CONFIG_EXTRA_ENV_SETTINGS \
"hwconfig=fsl_ddr:ctlr_intlv=cacheline," \
"bank_intlv=" __stringify(BANK_INTLV) "\0" \
"usb1:dr_mode=host,phy_type=" __stringify(__USB_PHY_TYPE) "\0" \
"ramdiskfile=" __stringify(CONFIG_BOARDNAME) "/ramdisk.uboot\0" \
"fdtfile=" __stringify(CONFIG_BOARDNAME) "/" \
__stringify(CONFIG_BOARDNAME) ".dtb\0" \
"uboot=" __stringify(CONFIG_UBOOTPATH) "\0" \
"ubootaddr=" __stringify(CONFIG_SYS_TEXT_BASE) "\0" \
"bootargs=root=/dev/ram rw console=ttyS0,115200\0" \
"netdev=eth0\0" \
"tftpflash=tftpboot $loadaddr $uboot && " \
"protect off $ubootaddr +$filesize && " \
"erase $ubootaddr +$filesize && " \
"cp.b $loadaddr $ubootaddr $filesize && " \
"protect on $ubootaddr +$filesize && " \
"cmp.b $loadaddr $ubootaddr $filesize\0" \
"consoledev=ttyS0\0" \
"ramdiskaddr=2000000\0" \
"fdtaddr=1e00000\0" \
"bdev=sda3\0"
#define CONFIG_LINUX \
"setenv bootargs root=/dev/ram rw " \
"console=$consoledev,$baudrate $othbootargs;" \
"setenv ramdiskaddr 0x02000000;" \
"setenv fdtaddr 0x00c00000;" \
"setenv loadaddr 0x1000000;" \
"bootm $loadaddr $ramdiskaddr $fdtaddr"
#define CONFIG_NFSBOOTCOMMAND \
"setenv bootargs root=/dev/nfs rw " \
"nfsroot=$serverip:$rootpath " \
"ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname:$netdev:off " \
"console=$consoledev,$baudrate $othbootargs;" \
"tftp $loadaddr $bootfile;" \
"tftp $fdtaddr $fdtfile;" \
"bootm $loadaddr - $fdtaddr"
#define CONFIG_BOOTCOMMAND CONFIG_LINUX
#include <asm/fsl_secure_boot.h>
#endif /* __T1024RDB_H */
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2012-2018 The Android Money Manager Ex Project Team
~
~ This program is free software; you can redistribute it and/or
~ modify it under the terms of the GNU General Public License
~ as published by the Free Software Foundation; either version 3
~ of the License, or (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:initialLayout="@layout/widget_account_bills"
android:minHeight="180dp"
android:minWidth="250dp"
android:resizeMode="vertical"
android:updatePeriodMillis="180000"
android:previewImage="@drawable/drawable_widget_account_bills"
android:widgetCategory="keyguard|home_screen">
</appwidget-provider>
| {
"pile_set_name": "Github"
} |
SET(Open_BLAS_INCLUDE_SEARCH_PATHS
/usr/include
/usr/include/openblas
/usr/include/openblas-base
/usr/local/include
/usr/local/include/openblas
/usr/local/include/openblas-base
/opt/OpenBLAS/include
$ENV{OpenBLAS_HOME}
$ENV{OpenBLAS_HOME}/include
)
SET(Open_BLAS_LIB_SEARCH_PATHS
/lib/
/lib/openblas-base
/lib64/
/usr/lib
/usr/lib/openblas-base
/usr/lib64
/usr/local/lib
/usr/local/lib64
/opt/OpenBLAS/lib
$ENV{OpenBLAS}cd
$ENV{OpenBLAS}/lib
$ENV{OpenBLAS_HOME}
$ENV{OpenBLAS_HOME}/lib
)
FIND_PATH(OpenBLAS_INCLUDE_DIR NAMES cblas.h PATHS ${Open_BLAS_INCLUDE_SEARCH_PATHS})
FIND_LIBRARY(OpenBLAS_LIB NAMES openblas PATHS ${Open_BLAS_LIB_SEARCH_PATHS})
SET(OpenBLAS_FOUND ON)
# Check include files
IF(NOT OpenBLAS_INCLUDE_DIR)
SET(OpenBLAS_FOUND OFF)
MESSAGE(STATUS "Could not find OpenBLAS include. Turning OpenBLAS_FOUND off")
ENDIF()
# Check libraries
IF(NOT OpenBLAS_LIB)
SET(OpenBLAS_FOUND OFF)
MESSAGE(STATUS "Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off")
ENDIF()
IF (OpenBLAS_FOUND)
IF (NOT OpenBLAS_FIND_QUIETLY)
MESSAGE(STATUS "Found OpenBLAS libraries: ${OpenBLAS_LIB}")
MESSAGE(STATUS "Found OpenBLAS include: ${OpenBLAS_INCLUDE_DIR}")
ENDIF (NOT OpenBLAS_FIND_QUIETLY)
ELSE (OpenBLAS_FOUND)
IF (OpenBLAS_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find OpenBLAS")
ENDIF (OpenBLAS_FIND_REQUIRED)
ENDIF (OpenBLAS_FOUND)
MARK_AS_ADVANCED(
OpenBLAS_INCLUDE_DIR
OpenBLAS_LIB
OpenBLAS
)
| {
"pile_set_name": "Github"
} |
# FlowBinding SwipeRefreshLayout
This module provides bindings for the **AndroidX SwipeRefreshLayout** library.
## Transitive Dependency
`androidx.swiperefreshlayout:swiperefreshlayout`
## Download
```groovy
implementation "io.github.reactivecircus.flowbinding:flowbinding-swiperefreshlayout:${flowbinding_version}"
```
## Available Bindings
```kotlin
fun SwipeRefreshLayout.refreshes(): Flow<Unit>
```
| {
"pile_set_name": "Github"
} |
/*
* SNOOPY LOGGER
*
* File: tsrm.c
*
* Copyright (c) 2015 Bostjan Skufca <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, 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.
*/
/*
* Includes order: from local to global
*/
#define _XOPEN_SOURCE 700 // Required by pthread_mutex_setattr
#include "tsrm.h"
#include "snoopy.h"
#include "configuration.h"
#include "inputdatastorage.h"
#include "lib/liblcthw/src/list.h"
#include <pthread.h>
/*
* Global variables
*/
pthread_once_t snoopy_tsrm_init_onceControl = PTHREAD_ONCE_INIT;
pthread_mutex_t snoopy_tsrm_threadRepo_mutex;
pthread_mutexattr_t snoopy_tsrm_threadRepo_mutexAttr;
List snoopy_tsrm_threadRepo_data = {
.first = NULL,
.last = NULL,
.count = 0,
};
List *snoopy_tsrm_threadRepo = &snoopy_tsrm_threadRepo_data;
/*
* Non-exported function prototypes
*/
void snoopy_tsrm_init ();
int snoopy_tsrm_doesThreadRepoEntryExist (snoopy_tsrm_threadId_t threadId);
snoopy_tsrm_threadId_t snoopy_tsrm_getCurrentThreadId ();
ListNode* snoopy_tsrm_getCurrentThreadRepoEntry ();
snoopy_tsrm_threadData_t* snoopy_tsrm_getCurrentThreadData ();
snoopy_tsrm_threadData_t* snoopy_tsrm_createNewThreadData (snoopy_tsrm_threadId_t threadId);
/*
* snoopy_tsrm_ctor
*
* Description:
* Initialize threadRepo list.
*
* Params:
* (none)
*
* Return:
* void
*/
void snoopy_tsrm_ctor ()
{
snoopy_tsrm_threadId_t curTid;
snoopy_tsrm_threadData_t *tData;
// Initialize threading support
pthread_once(&snoopy_tsrm_init_onceControl, snoopy_tsrm_init);
// Get my thread id - before mutex, no need for mutex here
curTid = snoopy_tsrm_getCurrentThreadId();
// Mutex START
pthread_mutex_lock(&snoopy_tsrm_threadRepo_mutex);
// Create my entry if it does not exist
if (SNOOPY_FALSE == snoopy_tsrm_doesThreadRepoEntryExist(curTid)) {
tData = snoopy_tsrm_createNewThreadData(curTid);
List_push(snoopy_tsrm_threadRepo, tData);
}
// Mutex END
pthread_mutex_unlock(&snoopy_tsrm_threadRepo_mutex);
}
/*
* snoopy_tsrm_dtor
*
* Description:
* Removes own entry from threadRepo, or removes threadRepo altogether.
*
* Params:
* (none)
*
* Return:
* void
*/
void snoopy_tsrm_dtor ()
{
ListNode *tRepoEntry;
snoopy_tsrm_threadData_t *tData;
// Get my thread data structure
tRepoEntry = snoopy_tsrm_getCurrentThreadRepoEntry();
if (NULL == tRepoEntry) {
// This is an error condition, but let's not free NULLs below
return;
}
// Mutex START
pthread_mutex_lock(&snoopy_tsrm_threadRepo_mutex);
// Remove from repo
tData = List_remove(snoopy_tsrm_threadRepo, tRepoEntry);
// Mutex END
pthread_mutex_unlock(&snoopy_tsrm_threadRepo_mutex);
// Free the results AFTER my node has been removed from repo
free(tData->inputdatastorage);
free(tData->configuration);
free(tData);
return;
}
/*
* snoopy_tsrm_init
*
* Description:
* Initialize threading subsystem. This function should be run
* only once, by only one thread.
*
* Params:
* (none)
*
* Return:
* void
*/
void snoopy_tsrm_init ()
{
// Initialize threadRepo mutex
pthread_mutexattr_init (&snoopy_tsrm_threadRepo_mutexAttr);
pthread_mutexattr_settype(&snoopy_tsrm_threadRepo_mutexAttr, PTHREAD_MUTEX_RECURSIVE);
pthread_mutex_init (&snoopy_tsrm_threadRepo_mutex, &snoopy_tsrm_threadRepo_mutexAttr);
}
/*
* snoopy_tsrm_doesThreadRepoEntryExist
*
* Description:
* Check if thread with id threadId already has an entry in Snoopy's thread
* repository.
*
* Params:
* snoopy_tsrm_threadId_t: Thread ID to look for
*
* Return:
* int: SNOOPY_TRUE if yes, SNOOPY_FALSE if not
*/
int snoopy_tsrm_doesThreadRepoEntryExist (snoopy_tsrm_threadId_t threadId)
{
snoopy_tsrm_threadData_t *tData;
int retVal = SNOOPY_FALSE;
// Mutex START
pthread_mutex_lock(&snoopy_tsrm_threadRepo_mutex);
LIST_FOREACH(snoopy_tsrm_threadRepo, first, next, cur) {
if (NULL == cur->value) {
continue;
}
tData = cur->value;
if (0 != pthread_equal(threadId, tData->threadId)) {
/* Thread ID matches */
retVal = SNOOPY_TRUE;
goto FOUND;
}
}
FOUND:
// Mutex END
pthread_mutex_unlock(&snoopy_tsrm_threadRepo_mutex);
return retVal;
}
/*
* snoopy_tsrm_createNewThreadData
*
* Description:
* Mallocs space and creates new thread data structure, for given thread ID.
*
* Params:
* snoopy_tsrm_threadId_t: Thread ID to create entry for
*
* Return:
* snoopy_tsrm_threadData_t*: Pointer to newly-created threadData structure
*/
snoopy_tsrm_threadData_t* snoopy_tsrm_createNewThreadData (snoopy_tsrm_threadId_t threadId)
{
snoopy_tsrm_threadData_t *tData;
// Allocte storage memory for new threadData structure
tData = malloc(sizeof(snoopy_tsrm_threadData_t));
tData->configuration = malloc(sizeof(snoopy_configuration_t));
tData->inputdatastorage = malloc(sizeof(snoopy_inputdatastorage_t));
// Store thread ID
tData->threadId = threadId;
// Initialize empty values
snoopy_configuration_setUninitialized (tData->configuration);
snoopy_inputdatastorage_setUninitialized(tData->inputdatastorage);
return tData;
}
/*
* snoopy_tsrm_getCurrentThreadId
*
* Description:
* Retrieve id of current thread
*
* Params:
* (none)
*
* Return:
* snoopy_tsrm_threadId_t: Current thread id
*/
snoopy_tsrm_threadId_t snoopy_tsrm_getCurrentThreadId ()
{
return pthread_self();
}
/*
* snoopy_tsrm_getCurrentThreadRepoEntry
*
* Description:
* Retrieve pointer to threadRepo list node structure of current thread.
*
* Params:
* (none)
*
* Return:
* ListNode*: Current threadRepo entry, or null if it does not exist
*/
ListNode* snoopy_tsrm_getCurrentThreadRepoEntry ()
{
snoopy_tsrm_threadId_t myThreadId;
ListNode *tRepoEntry = NULL;
snoopy_tsrm_threadData_t *tData;
// This is the thread ID we are looking for
myThreadId = snoopy_tsrm_getCurrentThreadId();
// Mutex START
pthread_mutex_lock(&snoopy_tsrm_threadRepo_mutex);
LIST_FOREACH(snoopy_tsrm_threadRepo, first, next, cur) {
// This should not happen, but maybe, just maybe, there is another thread
// that is just creating new entry.
if (NULL == cur->value) {
continue;
}
tData = cur->value;
if (0 != pthread_equal(myThreadId, tData->threadId)) {
tRepoEntry = cur;
goto FOUND;
}
}
FOUND:
// Mutex END
pthread_mutex_unlock(&snoopy_tsrm_threadRepo_mutex);
// Return
return tRepoEntry;
}
/*
* snoopy_tsrm_getCurrentThreadData
*
* Description:
* Retrieve pointer to thread data structure of current thread. Creates
* a new repo entry if it does not exist.
*
* Params:
* (none)
*
* Return:
* snoopy_tsrm_threadData_t: Current threadRepo list entry, or NULL
*/
snoopy_tsrm_threadData_t* snoopy_tsrm_getCurrentThreadData ()
{
ListNode *tRepoEntry;
tRepoEntry = snoopy_tsrm_getCurrentThreadRepoEntry();
if (NULL == tRepoEntry) {
return NULL;
}
return tRepoEntry->value;
}
/*
* snoopy_tsrm_get_configuration()
*
* Description:
* Retrieve configuration array pointer for current thread.
* This function is to be consumed by the rest of Snoopy.
*
* Params:
* (none)
*
* Return:
* snoopy_configuration_t*: Pointer to thread-specific Snoopy configuration data structure
*/
snoopy_configuration_t* snoopy_tsrm_get_configuration ()
{
snoopy_tsrm_threadData_t *tData;
tData = snoopy_tsrm_getCurrentThreadData();
return tData->configuration;
}
/*
* snoopy_tsrm_get_inputdatastorage()
*
* Description:
* Retrieve input data storage array pointer for current thread.
* This function is to be consumed by the rest of Snoopy.
*
* Params:
* (none)
*
* Return:
* snoopy_inputdatastorage_t*: Pointer to thread-specific input data storage structure
*/
snoopy_inputdatastorage_t* snoopy_tsrm_get_inputdatastorage ()
{
snoopy_tsrm_threadData_t *tData;
tData = snoopy_tsrm_getCurrentThreadData();
return tData->inputdatastorage;
}
/*
* snoopy_tsrm_get_threadCount()
*
* Description:
* Retrieves number of currently configured threads.
*
* Params:
* (none)
*
* Return:
* snoopy_inputdatastorage_t*: Pointer to thread-specific input data storage structure
*/
int snoopy_tsrm_get_threadCount ()
{
int threadCount;
// Mutex START
pthread_mutex_lock(&snoopy_tsrm_threadRepo_mutex);
// Get count
threadCount = snoopy_tsrm_threadRepo->count;
// Mutex END
pthread_mutex_unlock(&snoopy_tsrm_threadRepo_mutex);
return threadCount;
}
| {
"pile_set_name": "Github"
} |
; PR957
; RUN: opt < %s -simplifycfg -S | FileCheck %s
; CHECK-NOT: select
@G = extern_weak global i32
define i32 @test(i32 %tmp) {
cond_false179:
%tmp181 = icmp eq i32 %tmp, 0 ; <i1> [#uses=1]
br i1 %tmp181, label %cond_true182, label %cond_next185
cond_true182: ; preds = %cond_false179
br label %cond_next185
cond_next185: ; preds = %cond_true182, %cond_false179
%d0.3 = phi i32 [ udiv (i32 1, i32 ptrtoint (i32* @G to i32)), %cond_true182 ], [ %tmp, %cond_false179 ] ; <i32> [#uses=1]
ret i32 %d0.3
}
define i32 @test2(i32 %tmp) {
cond_false179:
%tmp181 = icmp eq i32 %tmp, 0 ; <i1> [#uses=1]
br i1 %tmp181, label %cond_true182, label %cond_next185
cond_true182: ; preds = %cond_false179
br label %cond_next185
cond_next185: ; preds = %cond_true182, %cond_false179
%d0.3 = phi i32 [ udiv (i32 1, i32 ptrtoint (i32* @G to i32)), %cond_true182 ], [ %tmp, %cond_false179 ] ; <i32> [#uses=1]
call i32 @test( i32 4 ) ; <i32>:0 [#uses=0]
ret i32 %d0.3
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.tencentcloudapi.cfs.v20190719.models;
import com.tencentcloudapi.common.AbstractModel;
import com.google.gson.annotations.SerializedName;
import com.google.gson.annotations.Expose;
import java.util.HashMap;
public class DeleteCfsFileSystemResponse extends AbstractModel{
/**
* 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
@SerializedName("RequestId")
@Expose
private String RequestId;
/**
* Get 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
* @return RequestId 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public String getRequestId() {
return this.RequestId;
}
/**
* Set 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
* @param RequestId 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public void setRequestId(String RequestId) {
this.RequestId = RequestId;
}
/**
* Internal implementation, normal users should not use it.
*/
public void toMap(HashMap<String, String> map, String prefix) {
this.setParamSimple(map, prefix + "RequestId", this.RequestId);
}
}
| {
"pile_set_name": "Github"
} |
package action
import (
"fmt"
"path/filepath"
"strings"
"github.com/Masterminds/glide/cache"
"github.com/Masterminds/glide/cfg"
"github.com/Masterminds/glide/godep"
"github.com/Masterminds/glide/msg"
gpath "github.com/Masterminds/glide/path"
"github.com/Masterminds/glide/repo"
"github.com/Masterminds/glide/util"
"github.com/Masterminds/semver"
)
// Get fetches one or more dependencies and installs.
//
// This includes resolving dependency resolution and re-generating the lock file.
func Get(names []string, installer *repo.Installer, insecure, skipRecursive, stripVendor, nonInteract, testDeps bool) {
cache.SystemLock()
base := gpath.Basepath()
EnsureGopath()
EnsureVendorDir()
conf := EnsureConfig()
glidefile, err := gpath.Glide()
if err != nil {
msg.Die("Could not find Glide file: %s", err)
}
// Add the packages to the config.
if count, err2 := addPkgsToConfig(conf, names, insecure, nonInteract, testDeps); err2 != nil {
msg.Die("Failed to get new packages: %s", err2)
} else if count == 0 {
msg.Warn("Nothing to do")
return
}
// Fetch the new packages. Can't resolve versions via installer.Update if
// get is called while the vendor/ directory is empty so we checkout
// everything.
err = installer.Checkout(conf)
if err != nil {
msg.Die("Failed to checkout packages: %s", err)
}
// Prior to resolving dependencies we need to start working with a clone
// of the conf because we'll be making real changes to it.
confcopy := conf.Clone()
if !skipRecursive {
// Get all repos and update them.
// TODO: Can we streamline this in any way? The reason that we update all
// of the dependencies is that we need to re-negotiate versions. For example,
// if an existing dependency has the constraint >1.0 and this new package
// adds the constraint <2.0, then this may re-resolve the existing dependency
// to be between 1.0 and 2.0. But changing that dependency may then result
// in that dependency's dependencies changing... so we sorta do the whole
// thing to be safe.
err = installer.Update(confcopy)
if err != nil {
msg.Die("Could not update packages: %s", err)
}
}
// Set Reference
if err := repo.SetReference(confcopy, installer.ResolveTest); err != nil {
msg.Err("Failed to set references: %s", err)
}
err = installer.Export(confcopy)
if err != nil {
msg.Die("Unable to export dependencies to vendor directory: %s", err)
}
// Write YAML
if err := conf.WriteFile(glidefile); err != nil {
msg.Die("Failed to write glide YAML file: %s", err)
}
if !skipRecursive {
// Write lock
if stripVendor {
confcopy = godep.RemoveGodepSubpackages(confcopy)
}
writeLock(conf, confcopy, base)
} else {
msg.Warn("Skipping lockfile generation because full dependency tree is not being calculated")
}
if stripVendor {
msg.Info("Removing nested vendor and Godeps/_workspace directories...")
err := gpath.StripVendor()
if err != nil {
msg.Err("Unable to strip vendor directories: %s", err)
}
}
}
func writeLock(conf, confcopy *cfg.Config, base string) {
hash, err := conf.Hash()
if err != nil {
msg.Die("Failed to generate config hash. Unable to generate lock file.")
}
lock, err := cfg.NewLockfile(confcopy.Imports, confcopy.DevImports, hash)
if err != nil {
msg.Die("Failed to generate lock file: %s", err)
}
if err := lock.WriteFile(filepath.Join(base, gpath.LockFile)); err != nil {
msg.Die("Failed to write glide lock file: %s", err)
}
}
// addPkgsToConfig adds the given packages to the config file.
//
// Along the way it:
// - ensures that this package is not in the ignore list
// - checks to see if this is already in the dependency list.
// - splits version of of package name and adds the version attribute
// - separates repo from packages
// - sets up insecure repo URLs where necessary
// - generates a list of subpackages
func addPkgsToConfig(conf *cfg.Config, names []string, insecure, nonInteract, testDeps bool) (int, error) {
if len(names) == 1 {
msg.Info("Preparing to install %d package.", len(names))
} else {
msg.Info("Preparing to install %d packages.", len(names))
}
numAdded := 0
for _, name := range names {
var version string
parts := strings.Split(name, "#")
if len(parts) > 1 {
name = parts[0]
version = parts[1]
}
msg.Info("Attempting to get package %s", name)
root, subpkg := util.NormalizeName(name)
if len(root) == 0 {
return 0, fmt.Errorf("Package name is required for %q.", name)
}
if conf.HasDependency(root) {
var moved bool
var dep *cfg.Dependency
// Move from DevImports to Imports
if !testDeps && !conf.Imports.Has(root) && conf.DevImports.Has(root) {
dep = conf.DevImports.Get(root)
conf.Imports = append(conf.Imports, dep)
conf.DevImports = conf.DevImports.Remove(root)
moved = true
numAdded++
msg.Info("--> Moving %s from testImport to import", root)
} else if testDeps && conf.Imports.Has(root) {
msg.Warn("--> Test dependency %s already listed as import", root)
}
// Check if the subpackage is present.
if subpkg != "" {
if dep == nil {
dep = conf.Imports.Get(root)
if dep == nil && testDeps {
dep = conf.DevImports.Get(root)
}
}
if dep.HasSubpackage(subpkg) {
if !moved {
msg.Warn("--> Package %q is already in glide.yaml. Skipping", name)
}
} else {
dep.Subpackages = append(dep.Subpackages, subpkg)
msg.Info("--> Adding sub-package %s to existing import %s", subpkg, root)
numAdded++
}
} else if !moved {
msg.Warn("--> Package %q is already in glide.yaml. Skipping", root)
}
continue
}
if conf.HasIgnore(root) {
msg.Warn("--> Package %q is set to be ignored in glide.yaml. Skipping", root)
continue
}
dep := &cfg.Dependency{
Name: root,
}
// When retriving from an insecure location set the repo to the
// insecure location.
if insecure {
dep.Repository = "http://" + root
}
if version != "" {
dep.Reference = version
} else if !nonInteract {
getWizard(dep)
}
if len(subpkg) > 0 {
dep.Subpackages = []string{subpkg}
}
if dep.Reference != "" {
msg.Info("--> Adding %s to your configuration with the version %s", dep.Name, dep.Reference)
} else {
msg.Info("--> Adding %s to your configuration", dep.Name)
}
if testDeps {
conf.DevImports = append(conf.DevImports, dep)
} else {
conf.Imports = append(conf.Imports, dep)
}
numAdded++
}
return numAdded, nil
}
func getWizard(dep *cfg.Dependency) {
remote := dep.Remote()
// Lookup dependency info and store in cache.
msg.Info("--> Gathering release information for %s", dep.Name)
wizardFindVersions(dep)
memlatest := cache.MemLatest(remote)
if memlatest != "" {
dres := wizardAskLatest(memlatest, dep)
if dres {
dep.Reference = memlatest
sv, err := semver.NewVersion(dep.Reference)
if err == nil {
res := wizardAskRange(sv, dep)
if res == "m" {
dep.Reference = "^" + sv.String()
} else if res == "p" {
dep.Reference = "~" + sv.String()
}
}
}
}
}
| {
"pile_set_name": "Github"
} |
ENV["RAILS_ENV"] = "test"
require File.join(File.dirname(__FILE__), "/../../../../config/environment")
require 'spec/rails'
require 'i18n_backend_database'
Spec::Runner.configure do |config|
config.use_transactional_fixtures = true
config.use_instantiated_fixtures = false
config.after(:each) do
Locale.reset_default_locale
I18n.locale = "en"
I18n.default_locale = "en"
I18n.backend.cache_store.clear
end
end
| {
"pile_set_name": "Github"
} |
package matchers
import (
"fmt"
"regexp"
"github.com/onsi/gomega/format"
)
type MatchRegexpMatcher struct {
Regexp string
Args []interface{}
}
func (matcher *MatchRegexpMatcher) Match(actual interface{}) (success bool, err error) {
actualString, ok := toString(actual)
if !ok {
return false, fmt.Errorf("RegExp matcher requires a string or stringer.\nGot:%s", format.Object(actual, 1))
}
match, err := regexp.Match(matcher.regexp(), []byte(actualString))
if err != nil {
return false, fmt.Errorf("RegExp match failed to compile with error:\n\t%s", err.Error())
}
return match, nil
}
func (matcher *MatchRegexpMatcher) FailureMessage(actual interface{}) (message string) {
return format.Message(actual, "to match regular expression", matcher.regexp())
}
func (matcher *MatchRegexpMatcher) NegatedFailureMessage(actual interface{}) (message string) {
return format.Message(actual, "not to match regular expression", matcher.regexp())
}
func (matcher *MatchRegexpMatcher) regexp() string {
re := matcher.Regexp
if len(matcher.Args) > 0 {
re = fmt.Sprintf(matcher.Regexp, matcher.Args...)
}
return re
}
| {
"pile_set_name": "Github"
} |
<table class="table table-striped table-bordered">
<caption style="font-size: 20px">{!! $caption !!} (worker id:{!! $WORKER_ID !!})</caption>
<tr>
@foreach($columns as $col)
<th>{!! $col !!}</th>
@endforeach
</tr>
@forelse($data as $item)
<tr>
@if(is_object($item))
@foreach($columns as $col)
<td>
{!! \LaravelFly\FrontEnd\Controllers\InfoController::renderValue( $item->$col) !!}
</td>
@endforeach
@else
{{--array, but not hash array --}}
@foreach($item as $v)
<td>
{!! \LaravelFly\FrontEnd\Controllers\InfoController::renderValue($v) !!}
</td>
@endforeach
@endif
</tr>
@empty
<tr>
<td>(no data)</td>
</tr>
@endforelse
</table>
| {
"pile_set_name": "Github"
} |
CONFIG_PPC=y
CONFIG_SECURE_BOOT=y
CONFIG_MPC85xx=y
CONFIG_TARGET_P1010RDB_PA=y
# CONFIG_SYS_MALLOC_F is not set
CONFIG_FIT=y
CONFIG_FIT_VERBOSE=y
CONFIG_OF_BOARD_SETUP=y
CONFIG_OF_STDOUT_VIA_ALIAS=y
CONFIG_SYS_EXTRA_OPTIONS="NAND_SECBOOT"
CONFIG_BOOTDELAY=10
CONFIG_SYS_CONSOLE_IS_IN_ENV=y
CONFIG_BOARD_EARLY_INIT_F=y
CONFIG_HUSH_PARSER=y
CONFIG_CMD_MMC=y
CONFIG_CMD_SF=y
CONFIG_CMD_I2C=y
CONFIG_CMD_USB=y
CONFIG_CMD_MII=y
CONFIG_CMD_PING=y
CONFIG_CMD_DATE=y
CONFIG_CMD_EXT2=y
CONFIG_CMD_FAT=y
CONFIG_DM=y
CONFIG_MTD_NOR_FLASH=y
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_SPANSION=y
CONFIG_NETDEVICES=y
CONFIG_E1000=y
CONFIG_SYS_NS16550=y
CONFIG_FSL_ESPI=y
CONFIG_USB=y
CONFIG_USB_STORAGE=y
CONFIG_RSA=y
CONFIG_SPL_RSA=y
CONFIG_RSA_SOFTWARE_EXP=y
CONFIG_OF_LIBFDT=y
| {
"pile_set_name": "Github"
} |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Image-to-text implementation based on http://arxiv.org/abs/1411.4555.
"Show and Tell: A Neural Image Caption Generator"
Oriol Vinyals, Alexander Toshev, Samy Bengio, Dumitru Erhan
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from im2txt.ops import image_embedding
from im2txt.ops import image_processing
from im2txt.ops import inputs as input_ops
class ShowAndTellModel(object):
"""Image-to-text implementation based on http://arxiv.org/abs/1411.4555.
"Show and Tell: A Neural Image Caption Generator"
Oriol Vinyals, Alexander Toshev, Samy Bengio, Dumitru Erhan
"""
def __init__(self, config, mode, train_inception=False):
"""Basic setup.
Args:
config: Object containing configuration parameters.
mode: "train", "eval" or "inference".
train_inception: Whether the inception submodel variables are trainable.
"""
assert mode in ["train", "eval", "inference"]
self.config = config
self.mode = mode
self.train_inception = train_inception
# Reader for the input data.
self.reader = tf.TFRecordReader()
# To match the "Show and Tell" paper we initialize all variables with a
# random uniform initializer.
self.initializer = tf.random_uniform_initializer(
minval=-self.config.initializer_scale,
maxval=self.config.initializer_scale)
# A float32 Tensor with shape [batch_size, height, width, channels].
self.images = None
# An int32 Tensor with shape [batch_size, padded_length].
self.input_seqs = None
# An int32 Tensor with shape [batch_size, padded_length].
self.target_seqs = None
# An int32 0/1 Tensor with shape [batch_size, padded_length].
self.input_mask = None
# A float32 Tensor with shape [batch_size, embedding_size].
self.image_embeddings = None
# A float32 Tensor with shape [batch_size, padded_length, embedding_size].
self.seq_embeddings = None
# A float32 scalar Tensor; the total loss for the trainer to optimize.
self.total_loss = None
# A float32 Tensor with shape [batch_size * padded_length].
self.target_cross_entropy_losses = None
# A float32 Tensor with shape [batch_size * padded_length].
self.target_cross_entropy_loss_weights = None
# Collection of variables from the inception submodel.
self.inception_variables = []
# Function to restore the inception submodel from checkpoint.
self.init_fn = None
# Global step Tensor.
self.global_step = None
def is_training(self):
"""Returns true if the model is built for training mode."""
return self.mode == "train"
def process_image(self, encoded_image, thread_id=0):
"""Decodes and processes an image string.
Args:
encoded_image: A scalar string Tensor; the encoded image.
thread_id: Preprocessing thread id used to select the ordering of color
distortions.
Returns:
A float32 Tensor of shape [height, width, 3]; the processed image.
"""
return image_processing.process_image(encoded_image,
is_training=self.is_training(),
height=self.config.image_height,
width=self.config.image_width,
thread_id=thread_id,
image_format=self.config.image_format)
def build_inputs(self):
"""Input prefetching, preprocessing and batching.
Outputs:
self.images
self.input_seqs
self.target_seqs (training and eval only)
self.input_mask (training and eval only)
"""
if self.mode == "inference":
# In inference mode, images and inputs are fed via placeholders.
image_feed = tf.placeholder(dtype=tf.string, shape=[], name="image_feed")
input_feed = tf.placeholder(dtype=tf.int64,
shape=[None], # batch_size
name="input_feed")
# Process image and insert batch dimensions.
images = tf.expand_dims(self.process_image(image_feed), 0)
input_seqs = tf.expand_dims(input_feed, 1)
# No target sequences or input mask in inference mode.
target_seqs = None
input_mask = None
else:
# Prefetch serialized SequenceExample protos.
input_queue = input_ops.prefetch_input_data(
self.reader,
self.config.input_file_pattern,
is_training=self.is_training(),
batch_size=self.config.batch_size,
values_per_shard=self.config.values_per_input_shard,
input_queue_capacity_factor=self.config.input_queue_capacity_factor,
num_reader_threads=self.config.num_input_reader_threads)
# Image processing and random distortion. Split across multiple threads
# with each thread applying a slightly different distortion.
assert self.config.num_preprocess_threads % 2 == 0
images_and_captions = []
for thread_id in range(self.config.num_preprocess_threads):
serialized_sequence_example = input_queue.dequeue()
encoded_image, caption = input_ops.parse_sequence_example(
serialized_sequence_example,
image_feature=self.config.image_feature_name,
caption_feature=self.config.caption_feature_name)
image = self.process_image(encoded_image, thread_id=thread_id)
images_and_captions.append([image, caption])
# Batch inputs.
queue_capacity = (2 * self.config.num_preprocess_threads *
self.config.batch_size)
images, input_seqs, target_seqs, input_mask = (
input_ops.batch_with_dynamic_pad(images_and_captions,
batch_size=self.config.batch_size,
queue_capacity=queue_capacity))
self.images = images
self.input_seqs = input_seqs
self.target_seqs = target_seqs
self.input_mask = input_mask
def build_image_embeddings(self):
"""Builds the image model subgraph and generates image embeddings.
Inputs:
self.images
Outputs:
self.image_embeddings
"""
inception_output = image_embedding.inception_v3(
self.images,
trainable=self.train_inception,
is_training=self.is_training())
self.inception_variables = tf.get_collection(
tf.GraphKeys.GLOBAL_VARIABLES, scope="InceptionV3")
# Map inception output into embedding space.
with tf.variable_scope("image_embedding") as scope:
image_embeddings = tf.contrib.layers.fully_connected(
inputs=inception_output,
num_outputs=self.config.embedding_size,
activation_fn=None,
weights_initializer=self.initializer,
biases_initializer=None,
scope=scope)
# Save the embedding size in the graph.
tf.constant(self.config.embedding_size, name="embedding_size")
self.image_embeddings = image_embeddings
def build_seq_embeddings(self):
"""Builds the input sequence embeddings.
Inputs:
self.input_seqs
Outputs:
self.seq_embeddings
"""
with tf.variable_scope("seq_embedding"), tf.device("/cpu:0"):
embedding_map = tf.get_variable(
name="map",
shape=[self.config.vocab_size, self.config.embedding_size],
initializer=self.initializer)
seq_embeddings = tf.nn.embedding_lookup(embedding_map, self.input_seqs)
self.seq_embeddings = seq_embeddings
def build_model(self):
"""Builds the model.
Inputs:
self.image_embeddings
self.seq_embeddings
self.target_seqs (training and eval only)
self.input_mask (training and eval only)
Outputs:
self.total_loss (training and eval only)
self.target_cross_entropy_losses (training and eval only)
self.target_cross_entropy_loss_weights (training and eval only)
"""
# This LSTM cell has biases and outputs tanh(new_c) * sigmoid(o), but the
# modified LSTM in the "Show and Tell" paper has no biases and outputs
# new_c * sigmoid(o).
lstm_cell = tf.contrib.rnn.BasicLSTMCell(
num_units=self.config.num_lstm_units, state_is_tuple=True)
if self.mode == "train":
lstm_cell = tf.contrib.rnn.DropoutWrapper(
lstm_cell,
input_keep_prob=self.config.lstm_dropout_keep_prob,
output_keep_prob=self.config.lstm_dropout_keep_prob)
with tf.variable_scope("lstm", initializer=self.initializer) as lstm_scope:
# Feed the image embeddings to set the initial LSTM state.
zero_state = lstm_cell.zero_state(
batch_size=self.image_embeddings.get_shape()[0], dtype=tf.float32)
_, initial_state = lstm_cell(self.image_embeddings, zero_state)
# Allow the LSTM variables to be reused.
lstm_scope.reuse_variables()
if self.mode == "inference":
# In inference mode, use concatenated states for convenient feeding and
# fetching.
tf.concat(axis=1, values=initial_state, name="initial_state")
# Placeholder for feeding a batch of concatenated states.
state_feed = tf.placeholder(dtype=tf.float32,
shape=[None, sum(lstm_cell.state_size)],
name="state_feed")
state_tuple = tf.split(value=state_feed, num_or_size_splits=2, axis=1)
# Run a single LSTM step.
lstm_outputs, state_tuple = lstm_cell(
inputs=tf.squeeze(self.seq_embeddings, axis=[1]),
state=state_tuple)
# Concatentate the resulting state.
tf.concat(axis=1, values=state_tuple, name="state")
else:
# Run the batch of sequence embeddings through the LSTM.
sequence_length = tf.reduce_sum(self.input_mask, 1)
lstm_outputs, _ = tf.nn.dynamic_rnn(cell=lstm_cell,
inputs=self.seq_embeddings,
sequence_length=sequence_length,
initial_state=initial_state,
dtype=tf.float32,
scope=lstm_scope)
# Stack batches vertically.
lstm_outputs = tf.reshape(lstm_outputs, [-1, lstm_cell.output_size])
with tf.variable_scope("logits") as logits_scope:
logits = tf.contrib.layers.fully_connected(
inputs=lstm_outputs,
num_outputs=self.config.vocab_size,
activation_fn=None,
weights_initializer=self.initializer,
scope=logits_scope)
if self.mode == "inference":
tf.nn.softmax(logits, name="softmax")
else:
targets = tf.reshape(self.target_seqs, [-1])
weights = tf.to_float(tf.reshape(self.input_mask, [-1]))
# Compute losses.
losses = tf.nn.sparse_softmax_cross_entropy_with_logits(labels=targets,
logits=logits)
batch_loss = tf.div(tf.reduce_sum(tf.multiply(losses, weights)),
tf.reduce_sum(weights),
name="batch_loss")
tf.losses.add_loss(batch_loss)
total_loss = tf.losses.get_total_loss()
# Add summaries.
tf.summary.scalar("losses/batch_loss", batch_loss)
tf.summary.scalar("losses/total_loss", total_loss)
for var in tf.trainable_variables():
tf.summary.histogram("parameters/" + var.op.name, var)
self.total_loss = total_loss
self.target_cross_entropy_losses = losses # Used in evaluation.
self.target_cross_entropy_loss_weights = weights # Used in evaluation.
def setup_inception_initializer(self):
"""Sets up the function to restore inception variables from checkpoint."""
if self.mode != "inference":
# Restore inception variables only.
saver = tf.train.Saver(self.inception_variables)
def restore_fn(sess):
tf.logging.info("Restoring Inception variables from checkpoint file %s",
self.config.inception_checkpoint_file)
saver.restore(sess, self.config.inception_checkpoint_file)
self.init_fn = restore_fn
def setup_global_step(self):
"""Sets up the global step Tensor."""
global_step = tf.Variable(
initial_value=0,
name="global_step",
trainable=False,
collections=[tf.GraphKeys.GLOBAL_STEP, tf.GraphKeys.GLOBAL_VARIABLES])
self.global_step = global_step
def build(self):
"""Creates all ops for training and evaluation."""
self.build_inputs()
self.build_image_embeddings()
self.build_seq_embeddings()
self.build_model()
self.setup_inception_initializer()
self.setup_global_step()
| {
"pile_set_name": "Github"
} |
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace ExCSS
{
internal sealed class RuleList : IRuleList
{
private readonly StylesheetNode _parent;
internal RuleList(StylesheetNode parent)
{
_parent = parent;
}
public Rule this[int index] => Nodes.GetItemByIndex(index);
IRule IRuleList.this[int index] => this[index];
public bool HasDeclarativeRules => Nodes.Any(IsDeclarativeRule);
public IEnumerable<Rule> Nodes => _parent.Children.OfType<Rule>();
public int Length => Nodes.Count();
private static bool IsDeclarativeRule(Rule rule)
{
var type = rule.Type;
return (type != RuleType.Import) && (type != RuleType.Charset) && (type != RuleType.Namespace);
}
internal void RemoveAt(int index)
{
if ((index < 0) || (index >= Length))
{
throw new ParseException("Invalid index");
}
var rule = this[index];
if ((rule.Type == RuleType.Namespace) && HasDeclarativeRules)
{
throw new ParseException("Cannot remove namespace or declarative rules");
}
Remove(rule);
}
internal void Remove(Rule rule)
{
if (rule != null)
_parent.RemoveChild(rule);
}
internal void Insert(int index, Rule rule)
{
if (rule == null)
{
throw new ParseException("Rule argument cannot be null");
}
if (rule.Type == RuleType.Charset)
{
throw new ParseException("Cannot insert Charset rule");
}
if ((index > Length) || (index < 0))
{
throw new ParseException("Invalid index");
}
if ((rule.Type == RuleType.Namespace) && HasDeclarativeRules)
{
throw new ParseException("Cannot insert namespace or declarative rules");
}
if (index == Length)
{
_parent.AppendChild(rule);
}
else
{
_parent.InsertBefore(this[index], rule);
}
}
internal void Add(Rule rule)
{
if (rule != null)
{
_parent.AppendChild(rule);
}
}
public IEnumerator<IRule> GetEnumerator()
{
return Nodes.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
} | {
"pile_set_name": "Github"
} |
require_relative "spec_helper"
describe "change list items" do
let(:filename) { "list_items.md" }
["*", "+", "-"].each do |symbol|
it "should change from simple list (#{symbol}) to check list unchecked" do
given_content "#{symbol} item" do |source|
vim.command "call markdown#SwitchStatus()"
vim.write
expect(File.read(source)).to eql("#{symbol} [ ] item\n")
end
end
it "should change from check list unchecked (#{symbol}) to check list checked" do
given_content "#{symbol} [ ] item" do |source|
vim.command "call markdown#SwitchStatus()"
vim.write
expect(File.read(source)).to eql("#{symbol} [x] item\n")
end
end
it "should change from check list checked (#{symbol}) to simple list" do
given_content "#{symbol} [x] item" do |source|
vim.command "call markdown#SwitchStatus()"
vim.write
expect(File.read(source)).to eql("#{symbol} item\n")
end
end
end
end
| {
"pile_set_name": "Github"
} |
///////////////////////////////////////////////////////////////////////////
// FILE: stdexcept.h/stdexcept (Standard exception classes)
//
// =========================================================================
//
// Open Watcom Project
//
// Copyright (c) 2002-2010 Open Watcom Contributors. All Rights Reserved.
// Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
//
// This file is automatically generated. Do not edit directly.
//
// =========================================================================
//
// Description: This header is part of the C++ standard library. It
// defines various exception classes based on exception.
///////////////////////////////////////////////////////////////////////////
#ifndef _STDEXCEPT_INCLUDED
#define _STDEXCEPT_INCLUDED
#ifndef _ENABLE_AUTODEPEND
#pragma read_only_file;
#endif
#ifndef __cplusplus
#error This header file requires C++
#endif
#ifndef _COMDEF_H_INCLUDED
#include <_comdef.h>
#endif
#ifndef __STRDEF_H_INCLUDED
#include <_strdef.h>
#endif
#ifndef _EXCEPTION_INCLUDED
#include <exceptio>
#endif
namespace std {
namespace _ow {
class _WPRTLINK str_exception : public exception {
string message;
public:
str_exception( const string &what_arg ) _WCTHROWS()
: message( what_arg ) { }
virtual const char *what( ) const _WCTHROWS()
{ return message.c_str( ); }
};
}
class _WPRTLINK logic_error : public _ow::str_exception {
public:
logic_error( const string &what_arg ) _WCTHROWS()
: _ow::str_exception( what_arg ) { }
};
class _WPRTLINK domain_error : public logic_error {
public:
domain_error( const string &what_arg ) _WCTHROWS()
: logic_error( what_arg ) { }
};
class _WPRTLINK invalid_argument : public logic_error {
public:
invalid_argument( const string &what_arg ) _WCTHROWS()
: logic_error( what_arg ) { }
};
class _WPRTLINK length_error : public logic_error {
public:
length_error( const string &what_arg ) _WCTHROWS()
: logic_error( what_arg ) { }
};
class _WPRTLINK out_of_range : public logic_error {
public:
out_of_range( const string &what_arg ) _WCTHROWS()
: logic_error( what_arg ) { }
};
class _WPRTLINK runtime_error : public _ow::str_exception {
public:
runtime_error( const string &what_arg ) _WCTHROWS()
: _ow::str_exception( what_arg ) { }
};
class _WPRTLINK range_error : public runtime_error {
public:
range_error( const string &what_arg ) _WCTHROWS()
: runtime_error( what_arg ) { }
};
class _WPRTLINK overflow_error : public runtime_error {
public:
overflow_error( const string &what_arg ) _WCTHROWS()
: runtime_error( what_arg ) { }
};
class _WPRTLINK underflow_error : public runtime_error {
public:
underflow_error( const string &what_arg ) _WCTHROWS()
: runtime_error( what_arg ) { }
};
} // namespace std
#endif
| {
"pile_set_name": "Github"
} |
begin 664 test_extract.cpio.lz
M3%I)4`$,`!@-WP1@-Q'(^*Q-D212U[L*A<:!06P]0K\@K:>(KG5Y_+@YGVBQ
MA8<Z$FB#EOKSX1^WYC\$\UM9*<XI<J$:$'^B>;_>8N3MLP="$0SJ#QKYB?@8
G]@'$$7\&W^T*+9?6B=?__M$G@$T%>HL``@```````($`````````
`
end
| {
"pile_set_name": "Github"
} |
; RUN: opt < %s -instcombine | llvm-dis
; PR3826
define void @0(<4 x i16>*, <4 x i16>*) {
%3 = alloca <4 x i16>* ; <<4 x i16>**> [#uses=1]
%4 = load <4 x i16>* null, align 1 ; <<4 x i16>> [#uses=1]
%5 = ashr <4 x i16> %4, <i16 5, i16 5, i16 5, i16 5> ; <<4 x i16>> [#uses=1]
%6 = load <4 x i16>** %3 ; <<4 x i16>*> [#uses=1]
store <4 x i16> %5, <4 x i16>* %6, align 1
ret void
}
| {
"pile_set_name": "Github"
} |
/*=============================================================================
Copyright (c) 2001-2007 Joel de Guzman
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
template <
typename RT
, typename T0 , typename T1
, typename A0 , typename A1
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
2
, RT
, RT(*)(T0 , T1)
>
, A0 , A1
>::type const
bind(
RT(*f)(T0 , T1)
, A0 const& a0 , A1 const& a1
)
{
typedef detail::function_ptr<
2
, RT
, RT(*)(T0 , T1)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1
>::make(
fp_type(f)
, a0 , a1
);
}
template <
typename RT
, typename T0 , typename T1 , typename T2
, typename A0 , typename A1 , typename A2
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
3
, RT
, RT(*)(T0 , T1 , T2)
>
, A0 , A1 , A2
>::type const
bind(
RT(*f)(T0 , T1 , T2)
, A0 const& a0 , A1 const& a1 , A2 const& a2
)
{
typedef detail::function_ptr<
3
, RT
, RT(*)(T0 , T1 , T2)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1 , A2
>::make(
fp_type(f)
, a0 , a1 , a2
);
}
template <
typename RT
, typename T0 , typename T1 , typename T2 , typename T3
, typename A0 , typename A1 , typename A2 , typename A3
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
4
, RT
, RT(*)(T0 , T1 , T2 , T3)
>
, A0 , A1 , A2 , A3
>::type const
bind(
RT(*f)(T0 , T1 , T2 , T3)
, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3
)
{
typedef detail::function_ptr<
4
, RT
, RT(*)(T0 , T1 , T2 , T3)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1 , A2 , A3
>::make(
fp_type(f)
, a0 , a1 , a2 , a3
);
}
template <
typename RT
, typename T0 , typename T1 , typename T2 , typename T3 , typename T4
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
5
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4)
>
, A0 , A1 , A2 , A3 , A4
>::type const
bind(
RT(*f)(T0 , T1 , T2 , T3 , T4)
, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4
)
{
typedef detail::function_ptr<
5
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1 , A2 , A3 , A4
>::make(
fp_type(f)
, a0 , a1 , a2 , a3 , a4
);
}
template <
typename RT
, typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
6
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5)
>
, A0 , A1 , A2 , A3 , A4 , A5
>::type const
bind(
RT(*f)(T0 , T1 , T2 , T3 , T4 , T5)
, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5
)
{
typedef detail::function_ptr<
6
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1 , A2 , A3 , A4 , A5
>::make(
fp_type(f)
, a0 , a1 , a2 , a3 , a4 , a5
);
}
template <
typename RT
, typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
7
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6)
>
, A0 , A1 , A2 , A3 , A4 , A5 , A6
>::type const
bind(
RT(*f)(T0 , T1 , T2 , T3 , T4 , T5 , T6)
, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6
)
{
typedef detail::function_ptr<
7
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1 , A2 , A3 , A4 , A5 , A6
>::make(
fp_type(f)
, a0 , a1 , a2 , a3 , a4 , a5 , a6
);
}
template <
typename RT
, typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
8
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7)
>
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7
>::type const
bind(
RT(*f)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7)
, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7
)
{
typedef detail::function_ptr<
8
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7
>::make(
fp_type(f)
, a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7
);
}
template <
typename RT
, typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
9
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8)
>
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8
>::type const
bind(
RT(*f)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8)
, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8
)
{
typedef detail::function_ptr<
9
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8
>::make(
fp_type(f)
, a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8
);
}
template <
typename RT
, typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
10
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9)
>
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9
>::type const
bind(
RT(*f)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9)
, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9
)
{
typedef detail::function_ptr<
10
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9
>::make(
fp_type(f)
, a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9
);
}
template <
typename RT
, typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
11
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10)
>
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10
>::type const
bind(
RT(*f)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10)
, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10
)
{
typedef detail::function_ptr<
11
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10
>::make(
fp_type(f)
, a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10
);
}
template <
typename RT
, typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
12
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11)
>
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11
>::type const
bind(
RT(*f)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11)
, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11
)
{
typedef detail::function_ptr<
12
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11
>::make(
fp_type(f)
, a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11
);
}
template <
typename RT
, typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
13
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12)
>
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12
>::type const
bind(
RT(*f)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12)
, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12
)
{
typedef detail::function_ptr<
13
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12
>::make(
fp_type(f)
, a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12
);
}
template <
typename RT
, typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
14
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13)
>
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13
>::type const
bind(
RT(*f)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13)
, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13
)
{
typedef detail::function_ptr<
14
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13
>::make(
fp_type(f)
, a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13
);
}
template <
typename RT
, typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
15
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14)
>
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14
>::type const
bind(
RT(*f)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14)
, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14
)
{
typedef detail::function_ptr<
15
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14
>::make(
fp_type(f)
, a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14
);
}
template <
typename RT
, typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
16
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15)
>
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15
>::type const
bind(
RT(*f)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15)
, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15
)
{
typedef detail::function_ptr<
16
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15
>::make(
fp_type(f)
, a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15
);
}
template <
typename RT
, typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
17
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16)
>
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16
>::type const
bind(
RT(*f)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16)
, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15 , A16 const& a16
)
{
typedef detail::function_ptr<
17
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16
>::make(
fp_type(f)
, a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16
);
}
template <
typename RT
, typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
18
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17)
>
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17
>::type const
bind(
RT(*f)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17)
, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15 , A16 const& a16 , A17 const& a17
)
{
typedef detail::function_ptr<
18
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17
>::make(
fp_type(f)
, a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17
);
}
template <
typename RT
, typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
19
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18)
>
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18
>::type const
bind(
RT(*f)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18)
, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15 , A16 const& a16 , A17 const& a17 , A18 const& a18
)
{
typedef detail::function_ptr<
19
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18
>::make(
fp_type(f)
, a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18
);
}
template <
typename RT
, typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
20
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19)
>
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19
>::type const
bind(
RT(*f)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19)
, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15 , A16 const& a16 , A17 const& a17 , A18 const& a18 , A19 const& a19
)
{
typedef detail::function_ptr<
20
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19
>::make(
fp_type(f)
, a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19
);
}
template <
typename RT
, typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
21
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20)
>
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20
>::type const
bind(
RT(*f)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20)
, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15 , A16 const& a16 , A17 const& a17 , A18 const& a18 , A19 const& a19 , A20 const& a20
)
{
typedef detail::function_ptr<
21
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20
>::make(
fp_type(f)
, a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20
);
}
template <
typename RT
, typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20 , typename A21
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
22
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21)
>
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21
>::type const
bind(
RT(*f)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21)
, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15 , A16 const& a16 , A17 const& a17 , A18 const& a18 , A19 const& a19 , A20 const& a20 , A21 const& a21
)
{
typedef detail::function_ptr<
22
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21
>::make(
fp_type(f)
, a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20 , a21
);
}
template <
typename RT
, typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20 , typename A21 , typename A22
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
23
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22)
>
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22
>::type const
bind(
RT(*f)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22)
, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15 , A16 const& a16 , A17 const& a17 , A18 const& a18 , A19 const& a19 , A20 const& a20 , A21 const& a21 , A22 const& a22
)
{
typedef detail::function_ptr<
23
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22
>::make(
fp_type(f)
, a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20 , a21 , a22
);
}
template <
typename RT
, typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20 , typename A21 , typename A22 , typename A23
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
24
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23)
>
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23
>::type const
bind(
RT(*f)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23)
, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15 , A16 const& a16 , A17 const& a17 , A18 const& a18 , A19 const& a19 , A20 const& a20 , A21 const& a21 , A22 const& a22 , A23 const& a23
)
{
typedef detail::function_ptr<
24
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23
>::make(
fp_type(f)
, a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20 , a21 , a22 , a23
);
}
template <
typename RT
, typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20 , typename A21 , typename A22 , typename A23 , typename A24
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
25
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24)
>
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24
>::type const
bind(
RT(*f)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24)
, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15 , A16 const& a16 , A17 const& a17 , A18 const& a18 , A19 const& a19 , A20 const& a20 , A21 const& a21 , A22 const& a22 , A23 const& a23 , A24 const& a24
)
{
typedef detail::function_ptr<
25
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24
>::make(
fp_type(f)
, a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20 , a21 , a22 , a23 , a24
);
}
template <
typename RT
, typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20 , typename A21 , typename A22 , typename A23 , typename A24 , typename A25
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
26
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25)
>
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25
>::type const
bind(
RT(*f)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25)
, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15 , A16 const& a16 , A17 const& a17 , A18 const& a18 , A19 const& a19 , A20 const& a20 , A21 const& a21 , A22 const& a22 , A23 const& a23 , A24 const& a24 , A25 const& a25
)
{
typedef detail::function_ptr<
26
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25
>::make(
fp_type(f)
, a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20 , a21 , a22 , a23 , a24 , a25
);
}
template <
typename RT
, typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20 , typename A21 , typename A22 , typename A23 , typename A24 , typename A25 , typename A26
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
27
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26)
>
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25 , A26
>::type const
bind(
RT(*f)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26)
, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15 , A16 const& a16 , A17 const& a17 , A18 const& a18 , A19 const& a19 , A20 const& a20 , A21 const& a21 , A22 const& a22 , A23 const& a23 , A24 const& a24 , A25 const& a25 , A26 const& a26
)
{
typedef detail::function_ptr<
27
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25 , A26
>::make(
fp_type(f)
, a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20 , a21 , a22 , a23 , a24 , a25 , a26
);
}
template <
typename RT
, typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20 , typename A21 , typename A22 , typename A23 , typename A24 , typename A25 , typename A26 , typename A27
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
28
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27)
>
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25 , A26 , A27
>::type const
bind(
RT(*f)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27)
, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15 , A16 const& a16 , A17 const& a17 , A18 const& a18 , A19 const& a19 , A20 const& a20 , A21 const& a21 , A22 const& a22 , A23 const& a23 , A24 const& a24 , A25 const& a25 , A26 const& a26 , A27 const& a27
)
{
typedef detail::function_ptr<
28
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25 , A26 , A27
>::make(
fp_type(f)
, a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20 , a21 , a22 , a23 , a24 , a25 , a26 , a27
);
}
template <
typename RT
, typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20 , typename A21 , typename A22 , typename A23 , typename A24 , typename A25 , typename A26 , typename A27 , typename A28
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
29
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28)
>
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25 , A26 , A27 , A28
>::type const
bind(
RT(*f)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28)
, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15 , A16 const& a16 , A17 const& a17 , A18 const& a18 , A19 const& a19 , A20 const& a20 , A21 const& a21 , A22 const& a22 , A23 const& a23 , A24 const& a24 , A25 const& a25 , A26 const& a26 , A27 const& a27 , A28 const& a28
)
{
typedef detail::function_ptr<
29
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25 , A26 , A27 , A28
>::make(
fp_type(f)
, a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20 , a21 , a22 , a23 , a24 , a25 , a26 , a27 , a28
);
}
template <
typename RT
, typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20 , typename A21 , typename A22 , typename A23 , typename A24 , typename A25 , typename A26 , typename A27 , typename A28 , typename A29
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
30
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29)
>
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25 , A26 , A27 , A28 , A29
>::type const
bind(
RT(*f)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29)
, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15 , A16 const& a16 , A17 const& a17 , A18 const& a18 , A19 const& a19 , A20 const& a20 , A21 const& a21 , A22 const& a22 , A23 const& a23 , A24 const& a24 , A25 const& a25 , A26 const& a26 , A27 const& a27 , A28 const& a28 , A29 const& a29
)
{
typedef detail::function_ptr<
30
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25 , A26 , A27 , A28 , A29
>::make(
fp_type(f)
, a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20 , a21 , a22 , a23 , a24 , a25 , a26 , a27 , a28 , a29
);
}
template <
typename RT
, typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20 , typename A21 , typename A22 , typename A23 , typename A24 , typename A25 , typename A26 , typename A27 , typename A28 , typename A29 , typename A30
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
31
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30)
>
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25 , A26 , A27 , A28 , A29 , A30
>::type const
bind(
RT(*f)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30)
, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15 , A16 const& a16 , A17 const& a17 , A18 const& a18 , A19 const& a19 , A20 const& a20 , A21 const& a21 , A22 const& a22 , A23 const& a23 , A24 const& a24 , A25 const& a25 , A26 const& a26 , A27 const& a27 , A28 const& a28 , A29 const& a29 , A30 const& a30
)
{
typedef detail::function_ptr<
31
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25 , A26 , A27 , A28 , A29 , A30
>::make(
fp_type(f)
, a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20 , a21 , a22 , a23 , a24 , a25 , a26 , a27 , a28 , a29 , a30
);
}
template <
typename RT
, typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20 , typename A21 , typename A22 , typename A23 , typename A24 , typename A25 , typename A26 , typename A27 , typename A28 , typename A29 , typename A30 , typename A31
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
32
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31)
>
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25 , A26 , A27 , A28 , A29 , A30 , A31
>::type const
bind(
RT(*f)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31)
, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15 , A16 const& a16 , A17 const& a17 , A18 const& a18 , A19 const& a19 , A20 const& a20 , A21 const& a21 , A22 const& a22 , A23 const& a23 , A24 const& a24 , A25 const& a25 , A26 const& a26 , A27 const& a27 , A28 const& a28 , A29 const& a29 , A30 const& a30 , A31 const& a31
)
{
typedef detail::function_ptr<
32
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25 , A26 , A27 , A28 , A29 , A30 , A31
>::make(
fp_type(f)
, a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20 , a21 , a22 , a23 , a24 , a25 , a26 , a27 , a28 , a29 , a30 , a31
);
}
template <
typename RT
, typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20 , typename A21 , typename A22 , typename A23 , typename A24 , typename A25 , typename A26 , typename A27 , typename A28 , typename A29 , typename A30 , typename A31 , typename A32
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
33
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32)
>
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25 , A26 , A27 , A28 , A29 , A30 , A31 , A32
>::type const
bind(
RT(*f)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32)
, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15 , A16 const& a16 , A17 const& a17 , A18 const& a18 , A19 const& a19 , A20 const& a20 , A21 const& a21 , A22 const& a22 , A23 const& a23 , A24 const& a24 , A25 const& a25 , A26 const& a26 , A27 const& a27 , A28 const& a28 , A29 const& a29 , A30 const& a30 , A31 const& a31 , A32 const& a32
)
{
typedef detail::function_ptr<
33
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25 , A26 , A27 , A28 , A29 , A30 , A31 , A32
>::make(
fp_type(f)
, a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20 , a21 , a22 , a23 , a24 , a25 , a26 , a27 , a28 , a29 , a30 , a31 , a32
);
}
template <
typename RT
, typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20 , typename A21 , typename A22 , typename A23 , typename A24 , typename A25 , typename A26 , typename A27 , typename A28 , typename A29 , typename A30 , typename A31 , typename A32 , typename A33
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
34
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33)
>
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25 , A26 , A27 , A28 , A29 , A30 , A31 , A32 , A33
>::type const
bind(
RT(*f)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33)
, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15 , A16 const& a16 , A17 const& a17 , A18 const& a18 , A19 const& a19 , A20 const& a20 , A21 const& a21 , A22 const& a22 , A23 const& a23 , A24 const& a24 , A25 const& a25 , A26 const& a26 , A27 const& a27 , A28 const& a28 , A29 const& a29 , A30 const& a30 , A31 const& a31 , A32 const& a32 , A33 const& a33
)
{
typedef detail::function_ptr<
34
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25 , A26 , A27 , A28 , A29 , A30 , A31 , A32 , A33
>::make(
fp_type(f)
, a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20 , a21 , a22 , a23 , a24 , a25 , a26 , a27 , a28 , a29 , a30 , a31 , a32 , a33
);
}
template <
typename RT
, typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20 , typename A21 , typename A22 , typename A23 , typename A24 , typename A25 , typename A26 , typename A27 , typename A28 , typename A29 , typename A30 , typename A31 , typename A32 , typename A33 , typename A34
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
35
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34)
>
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25 , A26 , A27 , A28 , A29 , A30 , A31 , A32 , A33 , A34
>::type const
bind(
RT(*f)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34)
, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15 , A16 const& a16 , A17 const& a17 , A18 const& a18 , A19 const& a19 , A20 const& a20 , A21 const& a21 , A22 const& a22 , A23 const& a23 , A24 const& a24 , A25 const& a25 , A26 const& a26 , A27 const& a27 , A28 const& a28 , A29 const& a29 , A30 const& a30 , A31 const& a31 , A32 const& a32 , A33 const& a33 , A34 const& a34
)
{
typedef detail::function_ptr<
35
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25 , A26 , A27 , A28 , A29 , A30 , A31 , A32 , A33 , A34
>::make(
fp_type(f)
, a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20 , a21 , a22 , a23 , a24 , a25 , a26 , a27 , a28 , a29 , a30 , a31 , a32 , a33 , a34
);
}
template <
typename RT
, typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20 , typename A21 , typename A22 , typename A23 , typename A24 , typename A25 , typename A26 , typename A27 , typename A28 , typename A29 , typename A30 , typename A31 , typename A32 , typename A33 , typename A34 , typename A35
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
36
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35)
>
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25 , A26 , A27 , A28 , A29 , A30 , A31 , A32 , A33 , A34 , A35
>::type const
bind(
RT(*f)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35)
, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15 , A16 const& a16 , A17 const& a17 , A18 const& a18 , A19 const& a19 , A20 const& a20 , A21 const& a21 , A22 const& a22 , A23 const& a23 , A24 const& a24 , A25 const& a25 , A26 const& a26 , A27 const& a27 , A28 const& a28 , A29 const& a29 , A30 const& a30 , A31 const& a31 , A32 const& a32 , A33 const& a33 , A34 const& a34 , A35 const& a35
)
{
typedef detail::function_ptr<
36
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25 , A26 , A27 , A28 , A29 , A30 , A31 , A32 , A33 , A34 , A35
>::make(
fp_type(f)
, a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20 , a21 , a22 , a23 , a24 , a25 , a26 , a27 , a28 , a29 , a30 , a31 , a32 , a33 , a34 , a35
);
}
template <
typename RT
, typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20 , typename A21 , typename A22 , typename A23 , typename A24 , typename A25 , typename A26 , typename A27 , typename A28 , typename A29 , typename A30 , typename A31 , typename A32 , typename A33 , typename A34 , typename A35 , typename A36
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
37
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36)
>
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25 , A26 , A27 , A28 , A29 , A30 , A31 , A32 , A33 , A34 , A35 , A36
>::type const
bind(
RT(*f)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36)
, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15 , A16 const& a16 , A17 const& a17 , A18 const& a18 , A19 const& a19 , A20 const& a20 , A21 const& a21 , A22 const& a22 , A23 const& a23 , A24 const& a24 , A25 const& a25 , A26 const& a26 , A27 const& a27 , A28 const& a28 , A29 const& a29 , A30 const& a30 , A31 const& a31 , A32 const& a32 , A33 const& a33 , A34 const& a34 , A35 const& a35 , A36 const& a36
)
{
typedef detail::function_ptr<
37
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25 , A26 , A27 , A28 , A29 , A30 , A31 , A32 , A33 , A34 , A35 , A36
>::make(
fp_type(f)
, a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20 , a21 , a22 , a23 , a24 , a25 , a26 , a27 , a28 , a29 , a30 , a31 , a32 , a33 , a34 , a35 , a36
);
}
template <
typename RT
, typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20 , typename A21 , typename A22 , typename A23 , typename A24 , typename A25 , typename A26 , typename A27 , typename A28 , typename A29 , typename A30 , typename A31 , typename A32 , typename A33 , typename A34 , typename A35 , typename A36 , typename A37
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
38
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37)
>
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25 , A26 , A27 , A28 , A29 , A30 , A31 , A32 , A33 , A34 , A35 , A36 , A37
>::type const
bind(
RT(*f)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37)
, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15 , A16 const& a16 , A17 const& a17 , A18 const& a18 , A19 const& a19 , A20 const& a20 , A21 const& a21 , A22 const& a22 , A23 const& a23 , A24 const& a24 , A25 const& a25 , A26 const& a26 , A27 const& a27 , A28 const& a28 , A29 const& a29 , A30 const& a30 , A31 const& a31 , A32 const& a32 , A33 const& a33 , A34 const& a34 , A35 const& a35 , A36 const& a36 , A37 const& a37
)
{
typedef detail::function_ptr<
38
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25 , A26 , A27 , A28 , A29 , A30 , A31 , A32 , A33 , A34 , A35 , A36 , A37
>::make(
fp_type(f)
, a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20 , a21 , a22 , a23 , a24 , a25 , a26 , a27 , a28 , a29 , a30 , a31 , a32 , a33 , a34 , a35 , a36 , a37
);
}
template <
typename RT
, typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20 , typename A21 , typename A22 , typename A23 , typename A24 , typename A25 , typename A26 , typename A27 , typename A28 , typename A29 , typename A30 , typename A31 , typename A32 , typename A33 , typename A34 , typename A35 , typename A36 , typename A37 , typename A38
>
inline
typename detail::expression::function_eval<
detail::function_ptr<
39
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38)
>
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25 , A26 , A27 , A28 , A29 , A30 , A31 , A32 , A33 , A34 , A35 , A36 , A37 , A38
>::type const
bind(
RT(*f)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38)
, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9 , A10 const& a10 , A11 const& a11 , A12 const& a12 , A13 const& a13 , A14 const& a14 , A15 const& a15 , A16 const& a16 , A17 const& a17 , A18 const& a18 , A19 const& a19 , A20 const& a20 , A21 const& a21 , A22 const& a22 , A23 const& a23 , A24 const& a24 , A25 const& a25 , A26 const& a26 , A27 const& a27 , A28 const& a28 , A29 const& a29 , A30 const& a30 , A31 const& a31 , A32 const& a32 , A33 const& a33 , A34 const& a34 , A35 const& a35 , A36 const& a36 , A37 const& a37 , A38 const& a38
)
{
typedef detail::function_ptr<
39
, RT
, RT(*)(T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38)
> fp_type;
return
detail::expression::function_eval<
fp_type
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , A11 , A12 , A13 , A14 , A15 , A16 , A17 , A18 , A19 , A20 , A21 , A22 , A23 , A24 , A25 , A26 , A27 , A28 , A29 , A30 , A31 , A32 , A33 , A34 , A35 , A36 , A37 , A38
>::make(
fp_type(f)
, a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20 , a21 , a22 , a23 , a24 , a25 , a26 , a27 , a28 , a29 , a30 , a31 , a32 , a33 , a34 , a35 , a36 , a37 , a38
);
}
| {
"pile_set_name": "Github"
} |
import { affinityType } from './../constants/Config';
import * as ActionType from '../constants/ActionType';
import {
RootState,
WorkloadEdit,
MountItem,
LimitItem,
HealthCheckItem,
WorkloadLabel,
HpaMetrics,
VolumeItem,
ContainerItem,
ImagePullSecrets,
ServiceEdit,
ContainerEnv
} from '../models';
import { cloneDeep } from '../../common/utils';
import { workloadEditActions } from './workloadEditActions';
import { validateServiceActions } from './validateServiceActions';
import { AffinityRule, CronMetrics } from '../models/WorkloadEdit';
import { t, Trans } from '@tencent/tea-app/lib/i18n';
import { TappGrayUpdateEditItem } from '../models/ResourceDetailState';
type GetState = () => RootState;
export const validateWorkloadActions = {
/** 校验 workload名称是否正确 */
_validateWorkloadName(name: string) {
let reg = /^[a-z]([-a-z0-9]*[a-z0-9])?$/,
status = 0,
message = '';
// 验证workload名称
if (!name) {
status = 2;
message = t('Workload名称不能为空');
} else if (name.length > 63) {
status = 2;
message = t('Workload名称不能超过63个字符');
} else if (!reg.test(name)) {
status = 2;
message = t('Workload名称格式不正确');
} else {
status = 1;
message = '';
}
return { status, message };
},
validateWorkloadName() {
return async (dispatch, getState: GetState) => {
let { workloadName } = getState().subRoot.workloadEdit;
const result = await validateWorkloadActions._validateWorkloadName(workloadName);
dispatch({
type: ActionType.WV_WorkloadName,
payload: result
});
};
},
/** 校验执行策略是否正确 */
_validateCronSchedule(schedule: string) {
// cronjob的规则 * * * * * 分别代表 minute(0-59)、 hour(0-23)、 day(1-31)、 month(1-12)、 day of week(0-6)
let status = 0,
message = '',
reg = /^(\*|([0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9])|\*\/([0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9])) (\*|([0-9]|1[0-9]|2[0-3])|\*\/([0-9]|1[0-9]|2[0-3])) (\*|([1-9]|1[0-9]|2[0-9]|3[0-1])|\*\/([1-9]|1[0-9]|2[0-9]|3[0-1])) (\*|([1-9]|1[0-2])|\*\/([1-9]|1[0-2])) (\*|([0-6])|\*\/([0-6]))$/;
if (!schedule) {
status = 2;
message = t('执行策略不能为空');
} else if (!reg.test(schedule)) {
status = 2;
message = t('执行策略格式不正确');
} else {
status = 1;
message = '';
}
return { status, message };
},
validateCronSchedule() {
return async (dispatch, getState: GetState) => {
let { cronSchedule } = getState().subRoot.workloadEdit;
const result = validateWorkloadActions._validateCronSchedule(cronSchedule);
dispatch({
type: ActionType.WV_CronSchedule,
payload: result
});
};
},
/** 校验重复次数是否正确 */
_validateJobCompletion(completion: number) {
let status = 0,
message = '',
reg = /^\d+$/;
if (completion < 1) {
status = 2;
message = t('执行次数至少为1');
} else if (!reg.test(completion + '')) {
status = 2;
message = t('格式不正确,只能为数值');
} else {
status = 1;
message = '';
}
return { status, message };
},
validateJobCompletion() {
return async (dispatch, getState: GetState) => {
let { completion } = getState().subRoot.workloadEdit;
const result = validateWorkloadActions._validateJobCompletion(+completion);
dispatch({
type: ActionType.WV_Completion,
payload: result
});
};
},
/** 校验job并行度 */
_validateJobParallel(parallel: number) {
let status = 0,
message = '',
reg = /^\d+$/;
if (parallel < 1) {
status = 2;
message = t('Job并行度至少为1');
} else if (!reg.test(parallel + '')) {
status = 2;
message = t('格式不正确,只能为数值');
} else {
status = 1;
message = '';
}
return { status, message };
},
validateJobParallel() {
return async (dispatch, getState: GetState) => {
let { parallelism } = getState().subRoot.workloadEdit;
const result = validateWorkloadActions._validateJobParallel(+parallelism);
dispatch({
type: ActionType.WV_Parallelism,
payload: result
});
};
},
/** 校验 workload 描述 */
_validateWorkloadDesp(desp: string) {
let status = 0,
message = '';
// 验证ingress描述
if (desp && desp.length > 1000) {
status = 2;
message = t('Workload描述不能超过1000个字符');
} else {
status = 1;
message = '';
}
return { status, message };
},
validateWorkloadDesp() {
return async (dispatch, getState: GetState) => {
let { description } = getState().subRoot.workloadEdit;
const result = validateWorkloadActions._validateWorkloadDesp(description);
dispatch({
type: ActionType.WV_Description,
payload: result
});
};
},
/** 校验标签是否正确 */
_validateWorkloadLabelKey(name: string, labels: WorkloadLabel[]) {
// label 支持 [A-Z0-9a-z]开头和结尾,中间还可以有 -_.
let reg = /^[A-Za-z0-9][-A-Za-z0-9_\./]*?[A-Za-z0-9]$/,
status = 0,
message = '';
// 验证label
if (!name) {
status = 2;
message = t('Key不能为空');
} else if (!reg.test(name)) {
status = 2;
message = t('Key格式不正确');
} else if (labels.filter(label => label.labelKey === name).length > 1) {
status = 2;
message = t('Key名称不能重复');
} else {
status = 1;
message = '';
}
return { status, message };
},
validateWorkloadLabelKey(name: string, labelId: string) {
return async (dispatch, getState: GetState) => {
let labels: WorkloadLabel[] = cloneDeep(getState().subRoot.workloadEdit.workloadLabels),
labelIndex = labels.findIndex(x => x.id === labelId),
result = validateWorkloadActions._validateWorkloadLabelKey(name, labels);
labels[labelIndex]['v_labelKey'] = result;
dispatch({
type: ActionType.W_WorkloadLabels,
payload: labels
});
};
},
_validateAllWorkloadLabelKey(labels: WorkloadLabel[]) {
let result = true;
labels.forEach(label => {
result = result && validateWorkloadActions._validateWorkloadLabelKey(label.labelKey, labels).status === 1;
});
return result;
},
validateAllWorkloadLabelKey() {
return async (dispatch, getState: GetState) => {
getState().subRoot.workloadEdit.workloadLabels.forEach(label => {
dispatch(validateWorkloadActions.validateWorkloadLabelKey(label.labelKey, label.id + ''));
});
};
},
/** 校验标签的key是否正确 */
_validateWorkloadLabelValue(value: string) {
let status = 0,
message = '',
reg = /^[a-z]([-a-z0-9]*[a-z0-9])?$/;
// 验证label
if (!value) {
status = 2;
message = t('Value不能为空');
} else if (!reg.test(value)) {
status = 2;
message = t('格式不正确');
} else {
status = 1;
message = '';
}
return { status, message };
},
validateWorkloadLabelValue(value: string, labelId: string) {
return async (dispatch, getState: GetState) => {
let labels: WorkloadLabel[] = cloneDeep(getState().subRoot.workloadEdit.workloadLabels),
labelIndex = labels.findIndex(x => x.id === labelId),
result = validateWorkloadActions._validateWorkloadLabelValue(value);
labels[labelIndex]['v_labelValue'] = result;
dispatch({
type: ActionType.W_WorkloadLabels,
payload: labels
});
};
},
_validateAllWorkloadLabelValue(labels: WorkloadLabel[]) {
let result = true;
labels.forEach(label => {
result = result && validateWorkloadActions._validateWorkloadLabelKey(label.labelKey, labels).status === 1;
});
return result;
},
validateAllWorkloadLabelValue() {
return async (dispatch, getState: GetState) => {
getState().subRoot.workloadEdit.workloadLabels.forEach(label => {
dispatch(validateWorkloadActions.validateWorkloadLabelValue(label.labelValue, label.id + ''));
});
};
},
/** 校验annotations的key、value是否正确 */
_validateWorkloadAnnotationsKey(name: string, annotations: WorkloadLabel[]) {
let status = 0,
message = '',
reg = /^([A-Za-z0-9][-A-Za-z0-9_\.\/]*)?[A-Za-z0-9]$/;
// 验证key
if (!name) {
status = 2;
message = t('Key不能为空');
} else if (!reg.test(name)) {
status = 2;
message = t('Key格式不正确');
} else if (annotations.filter(annotataion => annotataion.labelKey === name).length > 1) {
status = 2;
message = t('Key名称不能重复');
} else {
status = 1;
message = '';
}
return { status, message };
},
validateWorkloadAnnotationsKey(value: string, aId: string) {
return async (dispatch: Redux.Dispatch, getState: GetState) => {
let annotations: WorkloadLabel[] = cloneDeep(getState().subRoot.workloadEdit.workloadAnnotations),
aIndex = annotations.findIndex(x => x.id === aId),
result = validateWorkloadActions._validateWorkloadAnnotationsKey(value, annotations);
annotations[aIndex]['v_labelKey'] = result;
dispatch({
type: ActionType.W_WorkloadAnnotations,
payload: annotations
});
};
},
_validateAllWorkloadAnnotationsKey(annotations: WorkloadLabel[]) {
let result = true;
annotations.forEach(annotation => {
result =
result &&
validateWorkloadActions._validateWorkloadAnnotationsKey(annotation.labelKey, annotations).status === 1;
});
return result;
},
validateAllWorkloadAnnotationsKey() {
return async (dispatch: Redux.Dispatch, getState: GetState) => {
getState().subRoot.workloadEdit.workloadAnnotations.forEach(annotation => {
dispatch(validateWorkloadActions.validateWorkloadAnnotationsKey(annotation.labelKey, annotation.id + ''));
});
};
},
/** 校验annotations的value是否正确 */
_validateWorkloadAnnotationsValue(value: string) {
let status = 0,
message = '';
// reg = /^([A-Za-z0-9][-A-Za-z0-9_\.]*)?[A-Za-z0-9]$/;
// 验证key
if (!value) {
status = 2;
message = t('Value不能为空');
// } else if (!reg.test(value)) {
// status = 2;
// message = t('Value格式不正确');
} else {
status = 1;
message = '';
}
return { status, message };
},
validateWorkloadAnnotationsValue(value: string, aId: string) {
return async (dispatch: Redux.Dispatch, getState: GetState) => {
let annotations: WorkloadLabel[] = cloneDeep(getState().subRoot.workloadEdit.workloadAnnotations),
aIndex = annotations.findIndex(x => x.id === aId),
result = validateWorkloadActions._validateWorkloadAnnotationsValue(value);
annotations[aIndex]['v_labelValue'] = result;
dispatch({
type: ActionType.W_WorkloadAnnotations,
payload: annotations
});
};
},
_validateAllWorkloadAnnotationsValue(annotations: WorkloadLabel[]) {
let result = true;
annotations.forEach(annotation => {
result = result && validateWorkloadActions._validateWorkloadAnnotationsValue(annotation.labelValue).status === 1;
});
return result;
},
validateAllWorkloadAnnotationsValue() {
return async (dispatch: Redux.Dispatch, getState: GetState) => {
getState().subRoot.workloadEdit.workloadAnnotations.forEach(annotation => {
dispatch(validateWorkloadActions.validateWorkloadAnnotationsValue(annotation.labelValue, annotation.id + ''));
});
};
},
/** 校验命名空间 */
_validateNamespace(namespace: string) {
let status = 0,
message = '';
// 验证命名空间的选择
if (!namespace) {
status = 2;
message = t('命名空间不能为空');
} else {
status = 1;
message = '';
}
return { status, message };
},
validateNamespace() {
return async (dispatch, getState: GetState) => {
let { namespace } = getState().subRoot.workloadEdit;
const result = validateWorkloadActions._validateNamespace(namespace);
dispatch({
type: ActionType.WV_Namespace,
payload: result
});
};
},
/** 校验数据卷的名称 */
_validateVolumeName(name: string, volumes: VolumeItem[]) {
let reg = /^[a-z0-9]([-a-z0-9]*[a-z0-9])?$/,
status = 0,
message = '';
if (!name) {
status = 2;
message = t('请填写数据卷名称');
} else if (name.length > 63) {
status = 2;
message = t('数据卷名称不能超过63个字符');
} else if (!reg.test(name)) {
status = 2;
message = t('只能包含小写字母、数字及分隔符("-"),且不能以分隔符开头或结尾');
} else if (name && volumes.filter(vol => vol.name === name).length > 1) {
status = 2;
message = t('数据卷名称不能重复');
} else {
status = 1;
message = '';
}
return { status, message };
},
validateVolumeName(name: string, vId: string) {
return async (dispatch, getState: GetState) => {
let volumes: VolumeItem[] = cloneDeep(getState().subRoot.workloadEdit.volumes),
vIndex = volumes.findIndex(vol => vol.id === vId),
result = validateWorkloadActions._validateVolumeName(name, volumes);
volumes[vIndex]['v_name'] = result;
dispatch({
type: ActionType.W_UpdateVolumes,
payload: volumes
});
};
},
_validateAllVolumeName(volumes: VolumeItem[]) {
let result = true;
volumes.forEach(volume => {
result = result && validateWorkloadActions._validateVolumeName(volume.name, volumes).status === 1;
});
return result;
},
validateAllVolumeName() {
return async (dispatch, getState: GetState) => {
let volumes = getState().subRoot.workloadEdit.volumes;
volumes.forEach(volume => {
dispatch(validateWorkloadActions.validateVolumeName(volume.name, volume.id + ''));
});
};
},
/** 校验pvc的相关选择 */
_validateVolumePvc(pvcName: string, volumes: VolumeItem[]) {
let status = 0,
message = '';
if (!pvcName) {
status = 2;
message = t('请选择pvc');
} else if (volumes.filter(vol => vol.volumeType === 'pvc' && vol.pvcSelection === pvcName).length > 1) {
status = 2;
message = t('pvc不可重复');
} else {
status = 1;
message = '';
}
return { status, message };
},
validateVolumePvc(pvcName: string, vId: string) {
return async (dispatch, getState: GetState) => {
let volumes: VolumeItem[] = cloneDeep(getState().subRoot.workloadEdit.volumes),
vIndex = volumes.findIndex(vol => vol.id === vId),
result = validateWorkloadActions._validateVolumePvc(pvcName, volumes);
volumes[vIndex]['v_pvcSelection'] = result;
dispatch({
type: ActionType.W_UpdateVolumes,
payload: volumes
});
};
},
_validateAllPvcSelection(volumes: VolumeItem[]) {
let result = true;
volumes.forEach(volume => {
if (volume.volumeType === 'pvc') {
result = result && validateWorkloadActions._validateVolumePvc(volume.pvcSelection, volumes).status === 1;
}
});
return result;
},
validateAllPvcSelection() {
return async (dispatch, getState: GetState) => {
let volumes = getState().subRoot.workloadEdit.volumes;
volumes.forEach(volume => {
volume.volumeType === 'pvc' &&
dispatch(validateWorkloadActions.validateVolumePvc(volume.pvcSelection, volume.id + ''));
});
};
},
/** 校验数据卷 nfs路径 */
_validateNfsPath(path: string, vId: string, volumes: VolumeItem[]) {
let volume = volumes.find(vol => vol.id === vId);
let reg = /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?):\/(?:[a-zA-Z0-9-_.]+\/?)*$/,
status = 0,
message = '';
if (volume.volumeType === 'nfsDisk') {
if (path) {
if (!reg.test(path)) {
status = 2;
message = t('NFS路径格式不正确');
} else if (volumes.filter(vol => vol.nfsPath === path && vol.volumeType === 'nfsDisk').length > 1) {
status = 2;
message = t('NFS路径称不可重复');
} else {
status = 1;
message = '';
}
} else {
status = 2;
message = t('NFS路径不能为空');
}
} else {
status = 1;
message = '';
}
return { status, message };
},
validateNfsPath(path: string, vId: string) {
return async (dispatch, getState: GetState) => {
let volumes: VolumeItem[] = cloneDeep(getState().subRoot.workloadEdit.volumes),
vIndex = volumes.findIndex(v => v.id === vId),
result = validateWorkloadActions._validateNfsPath(path, vId, volumes);
volumes[vIndex]['v_nfsPath'] = result;
dispatch({
type: ActionType.W_UpdateVolumes,
payload: volumes
});
};
},
_validateAllNfsPath(volumes: VolumeItem[]) {
let result = true;
volumes.forEach(volume => {
result = result && validateWorkloadActions._validateNfsPath(volume.nfsPath, volume.id + '', volumes).status === 1;
});
return result;
},
validateAllNfsPath() {
return async (dispatch, getState: GetState) => {
let volumes = getState().subRoot.workloadEdit.volumes;
volumes.forEach(volume => {
dispatch(validateWorkloadActions.validateNfsPath(volume.nfsPath, volume.id + ''));
});
};
},
/** 校验hostPath是否正确 */
_validateHostPath(path: string) {
let status = 0,
message = '',
reg = /^\/[\/\w-_\.]*$/;
if (!path) {
status = 2;
message = t('HostPath路径不能为空');
} else if (!reg.test(path)) {
status = 2;
message = t('HostPath格式不正确');
} else {
status = 1;
message = '';
}
return { status, message };
},
validateHostPath(path: string, vId: string) {
return async (dispatch, getState: GetState) => {
let volumes: VolumeItem[] = cloneDeep(getState().subRoot.workloadEdit.volumes),
vIndex = volumes.findIndex(v => v.id === vId),
result = validateWorkloadActions._validateHostPath(path);
volumes[vIndex]['v_hostPath'] = result;
dispatch({
type: ActionType.W_UpdateVolumes,
payload: volumes
});
};
},
_validateAllHostPath(volumes: VolumeItem[]) {
let result = true;
volumes.forEach(volume => {
if (volume.volumeType === 'hostPath') {
result = result && validateWorkloadActions._validateHostPath(volume.hostPath).status === 1;
}
});
return result;
},
validateAllHosPath() {
return async (dispatch, getState: GetState) => {
let volumes = getState().subRoot.workloadEdit.volumes;
volumes.forEach(volume => {
volume.volumeType === 'hostPath' &&
dispatch(validateWorkloadActions.validateHostPath(volume.hostPath, volume.id + ''));
});
};
},
_validateAllVolumeIsMounted(volumes: VolumeItem[], containers: ContainerItem[]) {
let allIsMounted = true,
validateVolumes = {};
// 已经挂载的数据卷的名称数组
let mounts: MountItem[] = [];
containers.forEach(c => {
mounts.push(...c.mounts);
});
let mountsName = mounts.map(m => m.volume);
volumes.forEach(v => {
let isMounted = !!mountsName.find(m => m === v.name);
allIsMounted = allIsMounted && isMounted;
validateVolumes[v.id + ''] = isMounted;
});
return { allIsMounted, validateVolumes };
},
validateAllVolumeIsMounted() {
return async (dispatch, getState: GetState) => {
let { volumes, containers } = getState().subRoot.workloadEdit;
let result = validateWorkloadActions._validateAllVolumeIsMounted(volumes, containers);
// 更新全部是否ok的标志
dispatch({
type: ActionType.W_IsAllVolumeIsMounted,
payload: result.allIsMounted
});
// 更新每一个挂在项的校验状态
let newVolumes: VolumeItem[] = cloneDeep(volumes),
validateVolumes = result.validateVolumes;
newVolumes.forEach(v => {
v['isMounted'] = validateVolumes[v.id + ''];
});
dispatch({
type: ActionType.W_UpdateVolumes,
payload: newVolumes
});
};
},
/** 判断是否可以新增数据卷,对数据卷中的属性状态进行相关的判断 */
_canAddVolume(volumes: VolumeItem[]) {
let result = true;
volumes.forEach(volume => {
result = result && validateWorkloadActions._validateVolumeName(volume.name, volumes).status === 1;
if (volume.volumeType === 'pvc') {
result = result && validateWorkloadActions._validateVolumePvc(volume.pvcSelection, volumes).status === 1;
} else if (volume.volumeType === 'hostPath') {
result = result && validateWorkloadActions._validateHostPath(volume.hostPath).status === 1;
}
});
return result;
},
/** 校验容器名称是否正确 */
_validateContainerName(name: string, containers: ContainerItem[]) {
let reg = /^[a-z0-9]([-a-z0-9]*[a-z0-9])?$/,
status = 0,
message = '';
// 验证容器服务名称
if (!name) {
status = 2;
message = t('容器名称不能为空');
} else if (containers.filter(c => c.name === name).length > 1) {
status = 2;
message = t('容器名称不能重复');
} else if (name.length > 63) {
status = 2;
message = t('容器名称不能超过63个字符');
} else if (!reg.test(name)) {
status = 2;
message = t('容器名称格式不正确');
} else {
status = 1;
message = '';
}
return { status, message };
},
validateContainerName(name: string, cKey: string) {
return async (dispatch, getState: GetState) => {
let containers: ContainerItem[] = cloneDeep(getState().subRoot.workloadEdit.containers),
cIndex = containers.findIndex(item => item.id === cKey),
result = validateWorkloadActions._validateContainerName(name, containers);
containers[cIndex]['v_name'] = result;
dispatch({
type: ActionType.W_UpdateContainers,
payload: containers
});
};
},
validateAllContainerName() {
return async (dispatch, getState: GetState) => {
let containers: ContainerItem[] = getState().subRoot.workloadEdit.containers;
containers.forEach(container => {
dispatch(validateWorkloadActions.validateContainerName(container.name, container.id + ''));
});
};
},
/** 校验镜像名称是否合法 */
_validateRegistrySelection(registry: string) {
let status = 2,
message = '';
// 验证容器的镜像
if (!registry) {
status = 2;
message = t('镜像不能为空');
} else {
status = 1;
message = '';
}
return { status, message };
},
validateRegistrySelection(registry: string, cKey: string) {
return async (dispatch, getState: GetState) => {
let containers: ContainerItem[] = cloneDeep(getState().subRoot.workloadEdit.containers),
cIndex = containers.findIndex(c => c.id === cKey),
result = validateWorkloadActions._validateRegistrySelection(registry);
containers[cIndex]['v_registry'] = result;
dispatch({
type: ActionType.W_UpdateContainers,
payload: containers
});
};
},
validateGrayUpdateRegistrySelection(index_out: number, index_in: number, imageName: string) {
return async (dispatch, getState: GetState) => {
let { editTappGrayUpdate } = getState().subRoot.resourceDetailState;
let target: TappGrayUpdateEditItem[] = cloneDeep(editTappGrayUpdate);
target[index_out].containers[index_in].v_imageName = validateWorkloadActions._validateRegistrySelection(
imageName
);
dispatch({
type: ActionType.W_TappGrayUpdate,
payload: target
});
};
},
validateGrayUpdate() {
return async (dispatch, getState: GetState) => {
let { editTappGrayUpdate } = getState().subRoot.resourceDetailState;
editTappGrayUpdate.forEach((item, index_out) => {
item.containers.forEach((container, index_in) => {
dispatch(
validateWorkloadActions.validateGrayUpdateRegistrySelection(index_out, index_in, container.imageName)
);
});
});
};
},
/** 校验数据卷挂在是否正确 */
_validateVolumeMount(volumeName: string, mId: string, mounts: MountItem[], volumes: VolumeItem[]) {
let mount = mounts.find(m => m.id === mId),
status = 0,
message = '';
if (!volumeName && mount.mountPath) {
status = 2;
message = t('请选择数据卷');
} else if (!volumes.find(v => v.name === volumeName)) {
status = 2;
message = t('数据卷不存在');
} else {
status = 1;
message = '';
}
return { status, message };
},
validateVolumeMount(volumeName: string, cId: string, mId: string) {
return async (dispatch, getState: GetState) => {
let { containers, volumes } = getState().subRoot.workloadEdit;
let newContainers: ContainerItem[] = cloneDeep(containers),
cIndex = newContainers.findIndex(c => c.id === cId),
mIndex = newContainers[cIndex]['mounts'].findIndex(m => m.id === mId),
result = validateWorkloadActions._validateVolumeMount(
volumeName,
mId,
newContainers[cIndex]['mounts'],
volumes
);
newContainers[cIndex]['mounts'][mIndex]['v_volume'] = result;
dispatch({
type: ActionType.W_UpdateContainers,
payload: newContainers
});
};
},
_validateAllVolumeMount(mounts: MountItem[], volumes: VolumeItem[]) {
let result = true;
mounts.forEach(m => {
if (m.mountPath) {
result =
result && validateWorkloadActions._validateVolumeMount(m.volume, m.id + '', mounts, volumes).status === 1;
}
});
return result;
},
validateAllVolumeMount(container: ContainerItem) {
return async (dispatch, getState: GetState) => {
container.mounts.forEach(mount => {
if (mount.mountPath) {
dispatch(validateWorkloadActions.validateVolumeMount(mount.volume, container.id + '', mount.id + ''));
}
});
};
},
/** 校验挂载的挂载路径 */
_validateVolumeMountPath(mountPath: string, mId: string, mounts: MountItem[]) {
let mount = mounts.find(m => m.id === mId);
let status = 0,
message = '',
reg = /:/;
if (!mountPath && mount.volume) {
status = 2;
message = t('请输入目标路径');
} else if (reg.test(mountPath)) {
status = 2;
message = t('目标路径不可包含 ":" ');
} else if (mountPath && mounts.filter(m => m.mountPath === mountPath).length > 1) {
status = 2;
message = t('目标路径不可重复');
} else {
status = 1;
message = '';
}
return { status, message };
},
validateVolumeMountPath(mountPath: string, cId: string, mId: string) {
return async (dispatch, getState: GetState) => {
let { containers, volumes } = getState().subRoot.workloadEdit;
let newContainers: ContainerItem[] = cloneDeep(containers),
cIndex = newContainers.findIndex(c => c.id === cId),
mIndex = newContainers[cIndex]['mounts'].findIndex(m => m.id === mId),
result = validateWorkloadActions._validateVolumeMountPath(mountPath, mId, newContainers[cIndex]['mounts']);
newContainers[cIndex]['mounts'][mIndex]['v_mountPath'] = result;
dispatch({
type: ActionType.W_UpdateContainers,
payload: newContainers
});
};
},
_validateAllVolumeMountPath(mounts: MountItem[]) {
let result = true;
mounts.forEach(mount => {
if (mount.volume) {
result =
result &&
validateWorkloadActions._validateVolumeMountPath(mount.mountPath, mount.id + '', mounts).status === 1;
}
});
return result;
},
validateAllVolumeMountPath(container: ContainerItem) {
return async (dispatch, getState: GetState) => {
container.mounts.forEach(item => {
if (item.volume) {
dispatch(validateWorkloadActions.validateVolumeMountPath(item.mountPath, container.id + '', item.id + ''));
}
});
};
},
/** 校验容器 CPU限制 */
_validateCpuLimit(cpu: number, type: string, cpuLimit: LimitItem[]) {
let reg = /^\d+(\.\d{1,3})?$/,
status = 0,
message = '';
// 验证CPU限制
if (isNaN(cpu)) {
status = 2;
message = t('数据格式不正确,CPU限制只能是小数,且只能精确到0.01');
} else if (!cpu) {
status = 1;
message = '';
} else if (!reg.test(cpu + '')) {
status = 2;
message = t('数据格式不正确,CPU限制只能是小数,且只能精确到0.01');
} else if (cpu < 0.01) {
status = 2;
message = t('CPU限制最小为0.01');
} else {
if (type === 'limit') {
status = 1;
message = '';
} else {
let limit = cpuLimit.find(cpu => cpu.type === 'limit');
if (!limit || (limit && cpu - +limit.value <= 0) || !limit.value) {
status = 1;
message = '';
} else {
status = 2;
message = t('request限制不能超过limit限制');
}
}
}
return { status, message };
},
validateCpuLimit(cpu: string, cId: string, cpuId: string) {
return async (dispatch, getState: GetState) => {
let containers: ContainerItem[] = cloneDeep(getState().subRoot.workloadEdit.containers),
cIndex = containers.findIndex(c => c.id === cId),
cpuLimit = containers[cIndex].cpuLimit,
cpuIndex = cpuLimit.findIndex(c => c.id === cpuId),
result = validateWorkloadActions._validateCpuLimit(+cpu, cpuLimit[cpuIndex].type, cpuLimit);
containers[cIndex]['cpuLimit'][cpuIndex]['v_value'] = result;
dispatch({
type: ActionType.W_UpdateContainers,
payload: containers
});
};
},
_validateAllCpuLimit(cpuLimit: LimitItem[]) {
let result = true;
cpuLimit.forEach(item => {
result = result && validateWorkloadActions._validateCpuLimit(+item.value, item.type, cpuLimit).status === 1;
});
return result;
},
validateAllCpuLimit(container: ContainerItem) {
return async (dispatch, getState: GetState) => {
container.cpuLimit.forEach(item => {
dispatch(validateWorkloadActions.validateCpuLimit(item.value, container.id + '', item.id + ''));
});
};
},
/** 校验容器 mem限制 */
_validateMemLimit(mem: number, type: string, memLimit: LimitItem[]) {
let reg = /^\d+?$/,
status = 0,
message = '';
// 验证内存限制
if (isNaN(mem)) {
status = 2;
message = t('只能输入正整数');
} else if (!mem) {
status = 1;
message = '';
} else if (!reg.test(mem + '')) {
status = 2;
message = t('只能输入正整数');
} else {
if (type === 'limit') {
if (mem >= 4) {
status = 1;
message = '';
} else {
status = 2;
message = t('limit限制要大于等于4Mib');
}
} else {
let limit = memLimit[1];
if (mem > 0) {
if ((limit && limit.value === '') || (limit && mem - +limit.value <= 0)) {
status = 1;
message = '';
} else {
status = 2;
message = t('request限制不能超过limit限制');
}
} else {
status = 2;
message = t('request限制要大于等于1Mib');
}
}
}
return { status, message };
},
/** 校验容器 Gpu限制 */
_validateGpuCoreLimit(gpuCore: number) {
let reg1 = /^\d+(\.\d{1,1})?$/,
reg2 = /^\d+?$/,
status = 0,
message = '';
// 验证内存限制
if (isNaN(gpuCore)) {
status = 2;
message = t('gpu限制只能填写0.1-1或者1的正整数倍');
} else if (!gpuCore && gpuCore !== 0) {
status = 2;
message = t('gpu限制不能为空');
} else if (!reg1.test(gpuCore + '')) {
status = 2;
message = t('gpu限制只能填写0.1-1或者1的正整数倍');
} else {
if (gpuCore >= 1 && !reg2.test(gpuCore + '')) {
status = 2;
message = t('gpu限制只能填写0.1-1或者1的正整数倍');
} else {
status = 1;
message = '';
}
}
return { status, message };
},
validateGpuCoreLimit(gpuCore: string, cId: string) {
return async (dispatch, getState: GetState) => {
let containers: ContainerItem[] = cloneDeep(getState().subRoot.workloadEdit.containers),
cIndex = containers.findIndex(c => c.id === cId),
result = validateWorkloadActions._validateGpuCoreLimit(+gpuCore);
containers[cIndex].v_gpuCore = result;
dispatch({
type: ActionType.W_UpdateContainers,
payload: containers
});
};
},
/** 校验容器 GpuMem限制 */
_validateGpuMemLimit(gpuMem: number) {
let reg = /^\d+?$/,
status = 0,
message = '';
// 验证内存限制
if (isNaN(gpuMem)) {
status = 2;
message = t('只能输入正整数');
} else if (!gpuMem && gpuMem !== 0) {
status = 2;
message = t('GPU显存不能为空');
} else if (!reg.test(gpuMem + '')) {
status = 2;
message = t('只能输入正整数');
} else {
status = 1;
message = '';
}
return { status, message };
},
validateGpuMemLimit(gpuMem: string, cId: string) {
return async (dispatch, getState: GetState) => {
let containers: ContainerItem[] = cloneDeep(getState().subRoot.workloadEdit.containers),
cIndex = containers.findIndex(c => c.id === cId),
result = validateWorkloadActions._validateGpuMemLimit(+gpuMem);
containers[cIndex].v_gpuMem = result;
dispatch({
type: ActionType.W_UpdateContainers,
payload: containers
});
};
},
validateMemLimit(mem: string, cId: string, mId: string) {
return async (dispatch, getState: GetState) => {
let containers: ContainerItem[] = cloneDeep(getState().subRoot.workloadEdit.containers),
cIndex = containers.findIndex(c => c.id === cId),
memLimit = containers[cIndex].memLimit,
mIndex = memLimit.findIndex(m => m.id === mId),
result = validateWorkloadActions._validateMemLimit(+mem, memLimit[mIndex].type, memLimit);
containers[cIndex]['memLimit'][mIndex]['v_value'] = result;
dispatch({
type: ActionType.W_UpdateContainers,
payload: containers
});
};
},
_validateAllMemLimit(memLimit: LimitItem[]) {
let result = true;
memLimit.forEach(item => {
result = result && validateWorkloadActions._validateMemLimit(+item.value, item.type, memLimit).status === 1;
});
return result;
},
validateAllMemLimit(container: ContainerItem) {
return async (dispatch, getState: GetState) => {
container.memLimit.forEach(item => {
dispatch(validateWorkloadActions.validateMemLimit(item.value, container.id + '', item.id + ''));
});
};
},
/** 校验容器的 环境变量是否正确 */
_validateEnvName(name: string, envs: ContainerEnv.ItemWithId[]) {
let reg = /^[A-Za-z][-A-Za-z0-9_\.]*$/,
status = 0,
message = '';
if (!name) {
status = 2;
message = t('环境变量名称不能为空');
} else if (!reg.test(name)) {
status = 2;
message = t('环境变量名称格式不对');
} else if (name && envs.filter(e => e.name === name).length > 1) {
status = 2;
message = t('环境变量不可重复');
} else {
status = 1;
message = '';
}
return { status, message };
},
validateEnvName(name: string, cId: string, eId: string) {
return async (dispatch: Redux.Dispatch, getState: GetState) => {
let containers: ContainerItem[] = cloneDeep(getState().subRoot.workloadEdit.containers),
cIndex = containers.findIndex(c => c.id === cId),
envs: ContainerEnv.ItemWithId[] = containers[cIndex].envItems,
eIndex = envs.findIndex(e => e.id === eId),
result = validateWorkloadActions._validateEnvName(name, envs);
containers[cIndex]['envItems'][eIndex]['v_name'] = result;
dispatch({
type: ActionType.W_UpdateContainers,
payload: containers
});
};
},
_validateAllEnvName(envs: ContainerEnv.ItemWithId[]) {
let result = true;
envs.forEach(e => {
result = result && validateWorkloadActions._validateEnvName(e.name, envs).status === 1;
});
return result;
},
validateAllEnvName(container: ContainerItem) {
return async (dispatch: Redux.Dispatch, getState: GetState) => {
container.envItems.forEach(e => {
dispatch(validateWorkloadActions.validateEnvName(e.name, container.id + '', e.id + ''));
});
};
},
/** 校验envItem的内容是否正确 */
_validateNewEnvItemValue(value: string) {
let status = 1,
message = '';
if (!value) {
status = 2;
message = t('请选择下拉项');
}
return { status, message };
},
validateNewEnvItemValue(keyNames: (keyof ContainerEnv.Item)[], cId: string, eId: string) {
return async (dispatch: Redux.Dispatch, getState: GetState) => {
let containers: ContainerItem[] = cloneDeep(getState().subRoot.workloadEdit.containers),
cIndex = containers.findIndex(c => c.id === cId),
newEnvItems: ContainerEnv.ItemWithId[] = containers[cIndex]['envItems'],
vIndex = newEnvItems.findIndex(e => e.id === eId);
keyNames.forEach(keyName => {
let result = validateWorkloadActions._validateNewEnvItemValue(newEnvItems[vIndex][keyName] as string);
containers[cIndex]['envItems'][vIndex][`v_${keyName}`] = result;
});
dispatch({
type: ActionType.W_UpdateContainers,
payload: containers
});
};
},
/** 校验所有的EnvItem */
_validateAllNewEnvItemValue(envItems: ContainerEnv.ItemWithId[]) {
let result = true;
envItems.forEach(envItem => {
if (envItem.type === ContainerEnv.EnvTypeEnum.ConfigMapRef) {
result =
result &&
validateWorkloadActions._validateNewEnvItemValue(envItem.configMapName).status === 1 &&
validateWorkloadActions._validateNewEnvItemValue(envItem.configMapDataKey).status === 1;
} else if (envItem.type === ContainerEnv.EnvTypeEnum.SecretKeyRef) {
result =
result &&
validateWorkloadActions._validateNewEnvItemValue(envItem.secretName).status === 1 &&
validateWorkloadActions._validateNewEnvItemValue(envItem.secretDataKey).status === 1;
}
});
return result;
},
validateAllNewEnvItemValue(container: ContainerItem) {
return async (dispatch: Redux.Dispatch, getState: GetState) => {
container.envItems.forEach(envItem => {
let cId = container.id + '';
let eId = envItem.id + '';
if (envItem.type === ContainerEnv.EnvTypeEnum.ConfigMapRef) {
dispatch(validateWorkloadActions.validateNewEnvItemValue(['configMapName', 'configMapDataKey'], cId, eId));
} else if (envItem.type === ContainerEnv.EnvTypeEnum.SecretKeyRef) {
dispatch(validateWorkloadActions.validateNewEnvItemValue(['secretName', 'secretDataKey'], cId, eId));
}
});
};
},
/** 校验容器的工作/日志目录设置 */
_validateDir(dir: string, errorMessage: string) {
let reg = /^\/(?:[a-zA-Z0-9-_.]+\/?)*$/,
status = 0,
message = '';
if (dir && !reg.test(dir)) {
status = 2;
message = errorMessage;
// message = t('工作目录格式不正确');
} else {
status = 1;
message = '';
}
return { status, message };
},
_validateWorkingDir(dir: string) {
return this._validateDir(dir, t('工作目录格式不正确'));
},
_validateLogDir(dir: string) {
return this._validateDir(dir, t('日志目录格式不正确'));
},
validateDir(dir: string, cId: string, v_key: string, errorMessage: string) {
return async (dispatch, getState: GetState) => {
let containers: ContainerItem[] = cloneDeep(getState().subRoot.workloadEdit.containers),
cIndex = containers.findIndex(c => c.id === cId),
result = validateWorkloadActions._validateDir(dir, errorMessage);
containers[cIndex][v_key] = result;
dispatch({
type: ActionType.W_UpdateContainers,
payload: containers
});
};
},
validateWorkingDir(dir: string, cId: string) {
return this.validateDir(dir, cId, 'v_workingDir', t('工作目录格式不正确'));
},
validateLogDir(dir: string, cId: string) {
return this.validateDir(dir, cId, 'v_logDir', t('日志目录格式不正确'));
},
/** 校验容器的健康检查的端口 */
_validateHealthPort(port: string) {
let reg = /^\d+$/,
status = 0,
message = '';
if (!port) {
status = 2;
message = t('检查端口不能为空');
} else if (!reg.test(port)) {
status = 2;
message = t('检查端口格式有误');
} else if (+port - 0 < 1 || +port - 0 > 65535) {
status = 2;
message = t('检查端口范围必须在1~65535之间');
} else {
status = 1;
message = '';
}
return { status, message };
},
validateHealthPort(cKey: string, hType: string) {
return async (dispatch, getState: GetState) => {
let containers: ContainerItem[] = cloneDeep(getState().subRoot.workloadEdit.containers),
cIndex = containers.findIndex(c => c.id === cKey),
result = validateWorkloadActions._validateHealthPort(containers[cIndex]['healthCheck'][hType]['port']);
containers[cIndex]['healthCheck'][hType]['v_port'] = result;
dispatch({
type: ActionType.W_UpdateContainers,
payload: containers
});
};
},
/** 校验容器的健康执行命令 */
_validateHealthCmd(cmd: string) {
let status = 0,
message = '';
if (!cmd) {
status = 2;
message = t('执行命令不能为空');
} else {
status = 1;
message = '';
}
return { status, message };
},
validateHealthCmd(cKey: string, hType: string) {
return async (dispatch, getState: GetState) => {
let containers: ContainerItem[] = cloneDeep(getState().subRoot.workloadEdit.containers),
cIndex = containers.findIndex(c => c.id === cKey),
result = validateWorkloadActions._validateHealthCmd(containers[cIndex]['healthCheck'][hType]['cmd']);
containers[cIndex]['healthCheck'][hType]['v_cmd'] = result;
dispatch({
type: ActionType.W_UpdateContainers,
payload: containers
});
};
},
/** 校验容器启动延时时间 */
_validateHealthDelayTime(delayTime: number) {
let reg = /^\d+$/,
status = 0,
message = '';
if (!delayTime && delayTime !== 0) {
status = 2;
message = t('启动延时不能为空');
} else if (!reg.test(delayTime + '')) {
status = 2;
message = t('启动延时格式有误');
} else if (delayTime - 0 < 0 || delayTime - 0 > 60) {
status = 2;
message = t('启动延时范围必须在0~60s之间');
} else {
status = 1;
message = '';
}
return { status, message };
},
validateHealthDelayTime(cKey: string, hType: string) {
return async (dispatch, getState: GetState) => {
let containers: ContainerItem[] = cloneDeep(getState().subRoot.workloadEdit.containers),
cIndex = containers.findIndex(c => c.id === cKey),
result = validateWorkloadActions._validateHealthDelayTime(
+containers[cIndex]['healthCheck'][hType]['delayTime']
);
containers[cIndex]['healthCheck'][hType]['v_delayTime'] = result;
dispatch({
type: ActionType.W_UpdateContainers,
payload: containers
});
};
},
/** 校验容器的响应延迟时间 */
_validateHealthTimeOut(timeOut: number) {
let reg = /^\d+$/,
status = 0,
message = '';
if (!timeOut && timeOut !== 0) {
status = 2;
message = t('响应超时不能为空');
} else if (!reg.test(timeOut + '')) {
status = 2;
message = t('响应超时格式有误');
} else if (timeOut - 0 < 2 || timeOut - 0 > 60) {
status = 2;
message = t('响应超时范围必须在2~60s之间');
} else {
status = 1;
message = '';
}
return { status, message };
},
validateHealthTimeOut(cKey: string, hType: string) {
return async (dispatch, getState: GetState) => {
let containers: ContainerItem[] = cloneDeep(getState().subRoot.workloadEdit.containers),
cIndex = containers.findIndex(c => c.id === cKey),
result = validateWorkloadActions._validateHealthTimeOut(+containers[cIndex]['healthCheck'][hType]['timeOut']);
containers[cIndex]['healthCheck'][hType]['v_timeOut'] = result;
dispatch({
type: ActionType.W_UpdateContainers,
payload: containers
});
};
},
/** 容器的间隔时间 */
_validateHealthIntervalTime(intervalTime: number, timeOut: number) {
let reg = /^\d+$/,
status = 0,
message = '';
if (!intervalTime && intervalTime !== 0) {
status = 2;
message = t('间隔时间不能为空');
} else if (!reg.test(intervalTime + '')) {
status = 2;
message = t('间隔时间格式有误');
} else if (intervalTime - 0 <= timeOut || intervalTime - 0 > 300) {
status = 2;
message = t('间隔时间范围必须大于响应超时,并不超过300s');
} else {
status = 1;
message = '';
}
return { status, message };
},
validateHealthIntervalTime(cKey: string, hType: string) {
return async (dispatch, getState: GetState) => {
let containers: ContainerItem[] = cloneDeep(getState().subRoot.workloadEdit.containers),
cIndex = containers.findIndex(c => c.id === cKey),
result = validateWorkloadActions._validateHealthIntervalTime(
+containers[cIndex]['healthCheck'][hType]['intervalTime'],
+containers[cIndex]['healthCheck'][hType]['timeOut']
);
containers[cIndex]['healthCheck'][hType]['v_intervalTime'] = result;
dispatch({
type: ActionType.W_UpdateContainers,
payload: containers
});
};
},
/** 校验容器的健康阈值 */
_validateHealthThreshold(healthThreshold: number) {
let reg = /^\d+$/,
status = 0,
message = '';
if (!healthThreshold && healthThreshold !== 0) {
status = 2;
message = t('健康阈值不能为空');
} else if (!reg.test(healthThreshold + '')) {
status = 2;
message = t('健康阈值格式有误');
} else if (healthThreshold - 0 < 1 || healthThreshold - 0 > 10) {
status = 2;
message = t('健康阈值范围必须在1~10之间');
} else {
status = 1;
message = '';
}
return { status, message };
},
validateHealthThreshold(cKey: string, hType: string) {
return async (dispatch, getState: GetState) => {
let containers: ContainerItem[] = cloneDeep(getState().subRoot.workloadEdit.containers),
cIndex = containers.findIndex(c => c.id === cKey),
result = validateWorkloadActions._validateHealthThreshold(
+containers[cIndex]['healthCheck'][hType]['healthThreshold']
);
containers[cIndex]['healthCheck'][hType]['v_healthThreshold'] = result;
dispatch({
type: ActionType.W_UpdateContainers,
payload: containers
});
};
},
/** 校验容器的不健康阈值 */
_validateUnhealthThreshold(unhealthThreshold: number) {
let reg = /^\d+$/,
status = 0,
message = '';
if (!unhealthThreshold && unhealthThreshold !== 0) {
status = 2;
message = t('不健康阈值不能为空');
} else if (!reg.test(unhealthThreshold + '')) {
status = 2;
message = t('不健康阈值格式有误');
} else if (unhealthThreshold - 0 < 1 || unhealthThreshold - 0 > 10) {
status = 2;
message = t('不健康阈值范围必须在1~10之间');
} else {
status = 1;
message = '';
}
return { status, message };
},
validateUnHealthThreshold(cKey: string, hType: string) {
return async (dispatch, getState: GetState) => {
let containers: ContainerItem[] = cloneDeep(getState().subRoot.workloadEdit.containers),
cIndex = containers.findIndex(c => c.id === cKey),
result = validateWorkloadActions._validateUnhealthThreshold(
+containers[cIndex]['healthCheck'][hType]['unhealthThreshold']
);
containers[cIndex]['healthCheck'][hType]['v_unhealthThreshold'] = result;
dispatch({
type: ActionType.W_UpdateContainers,
payload: containers
});
};
},
/** 校验健康检查 */
_validateHealthCheck(check: HealthCheckItem) {
let result = true;
result =
result &&
validateWorkloadActions._validateHealthDelayTime(check.delayTime).status === 1 &&
validateWorkloadActions._validateHealthTimeOut(check.timeOut).status === 1 &&
validateWorkloadActions._validateHealthIntervalTime(check.intervalTime, check.timeOut).status === 1 &&
validateWorkloadActions._validateHealthThreshold(check.healthThreshold).status === 1 &&
validateWorkloadActions._validateUnhealthThreshold(check.unhealthThreshold).status === 1;
if (check.checkMethod === 'methodCmd') {
result = result && validateWorkloadActions._validateHealthCmd(check.cmd).status === 1;
} else {
result = result && validateWorkloadActions._validateHealthPort(check.port).status === 1;
}
return result;
},
validateHealthCheck(container: ContainerItem, hType: string) {
return async (dispatch, getState: GetState) => {
let cKey = container.id + '';
dispatch(validateWorkloadActions.validateHealthPort(cKey, hType));
dispatch(validateWorkloadActions.validateHealthDelayTime(cKey, hType));
dispatch(validateWorkloadActions.validateHealthTimeOut(cKey, hType));
dispatch(validateWorkloadActions.validateHealthIntervalTime(cKey, hType));
dispatch(validateWorkloadActions.validateHealthCmd(cKey, hType));
dispatch(validateWorkloadActions.validateHealthThreshold(cKey, hType));
dispatch(validateWorkloadActions.validateUnHealthThreshold(cKey, hType));
};
},
/** 判断是否能新增容器 */
_canAddContainer(container: ContainerItem, volumes: VolumeItem[]) {
let state =
container.v_name.status === 2 ||
container.v_registry.status === 2 ||
container.v_workingDir.status === 2 ||
container.v_arg.status === 2 ||
container.v_cmd.status === 2;
// 如果有数据卷,则判断是有已经都挂载了
if (volumes.length) {
container.mounts.forEach(mount => {
state = state || mount.v_mountPath.status === 2 || mount.v_volume.status === 2;
});
}
// 判断cpu/内存限制的推荐值
container.cpuLimit.forEach(limit => {
state = state || limit.v_value.status === 2;
});
container.memLimit.forEach(limit => {
state = state || limit.v_value.status === 2;
});
// 如果有环境变量,则判断环境变量是否ok
if (container.envItems.length) {
container.envItems.forEach(env => {
state =
state ||
env.v_name.status === 2 ||
env.v_configMapName.status === 2 ||
env.v_configMapDataKey.status === 2 ||
env.v_secretName.status === 2 ||
env.v_secretDataKey.status === 2;
});
}
// 如果有健康检查,则校验健康检查
if (container.healthCheck.isOpenLiveCheck) {
let liveCheck = container.healthCheck.liveCheck;
state =
state ||
liveCheck.v_port.status === 2 ||
liveCheck.v_delayTime.status === 2 ||
liveCheck.v_timeOut.status === 2 ||
liveCheck.v_intervalTime.status === 2 ||
liveCheck.v_healthThreshold.status === 2 ||
liveCheck.v_unhealthThreshold.status === 2;
}
if (container.healthCheck.isOpenReadyCheck) {
let readyCheck = container.healthCheck.readyCheck;
state =
state ||
readyCheck.v_port.status === 2 ||
readyCheck.v_delayTime.status === 2 ||
readyCheck.v_timeOut.status === 2 ||
readyCheck.v_intervalTime.status === 2 ||
readyCheck.v_healthThreshold.status === 2 ||
readyCheck.v_unhealthThreshold.status === 2;
}
return !state && !!container.name && !!container.registry;
},
/** 校验容器的所有参数是否已经全部ok */
_validateContainer(container: ContainerItem, volumes: VolumeItem[], containers: ContainerItem[]) {
let result = true;
result =
result &&
validateWorkloadActions._validateContainerName(container.name, containers).status === 1 &&
validateWorkloadActions._validateRegistrySelection(container.registry).status === 1 &&
validateWorkloadActions._validateGpuCoreLimit(+container.gpuCore).status === 1 &&
validateWorkloadActions._validateGpuMemLimit(+container.gpuMem).status === 1 &&
validateWorkloadActions._validateAllCpuLimit(container.cpuLimit) &&
validateWorkloadActions._validateAllMemLimit(container.memLimit) &&
validateWorkloadActions._validateWorkingDir(container.workingDir).status === 1;
if (container.envItems.length) {
result =
result &&
validateWorkloadActions._validateAllEnvName(container.envItems) &&
validateWorkloadActions._validateAllNewEnvItemValue(container.envItems);
}
// 校验挂载业务
let filters = volumes.filter(v => {
// 判断当前的挂载项是否还存在,是否已经被删除
return v.name;
});
if (filters.length) {
if (container.mounts.length) {
result =
result &&
validateWorkloadActions._validateAllVolumeMountPath(container.mounts) &&
validateWorkloadActions._validateAllVolumeMount(container.mounts, volumes);
}
}
// 校验健康检查
if (container.healthCheck.isOpenLiveCheck) {
result = result && validateWorkloadActions._validateHealthCheck(container.healthCheck.liveCheck);
}
if (container.healthCheck.isOpenReadyCheck) {
result = result && validateWorkloadActions._validateHealthCheck(container.healthCheck.readyCheck);
}
return result;
},
validateContainer(container: ContainerItem) {
return async (dispatch, getState: GetState) => {
if (container) {
let isHealthCheckOk = true;
let cKey = container.id + '';
dispatch(validateWorkloadActions.validateContainerName(container.name, cKey));
dispatch(validateWorkloadActions.validateRegistrySelection(container.registry, cKey));
dispatch(validateWorkloadActions.validateAllCpuLimit(container));
dispatch(validateWorkloadActions.validateGpuCoreLimit(container.gpuCore + '', cKey));
dispatch(validateWorkloadActions.validateGpuMemLimit(container.gpuMem + '', cKey));
dispatch(validateWorkloadActions.validateAllMemLimit(container));
dispatch(validateWorkloadActions.validateWorkingDir(container.workingDir, cKey));
dispatch(validateWorkloadActions.validateLogDir(container.logDir, cKey));
// 校验环境变量是否都ok
if (container.envItems.length) {
dispatch(validateWorkloadActions.validateAllEnvName(container));
dispatch(validateWorkloadActions.validateAllNewEnvItemValue(container));
}
// 校验挂载项是否都ok
if (container.mounts.length) {
dispatch(validateWorkloadActions.validateAllVolumeMount(container));
dispatch(validateWorkloadActions.validateAllVolumeMountPath(container));
}
// 校验健康检查
if (container.healthCheck.isOpenLiveCheck) {
dispatch(validateWorkloadActions.validateHealthCheck(container, 'liveCheck'));
isHealthCheckOk =
isHealthCheckOk && validateWorkloadActions._validateHealthCheck(container.healthCheck.liveCheck);
}
if (container.healthCheck.isOpenReadyCheck) {
dispatch(validateWorkloadActions.validateHealthCheck(container, 'readyCheck'));
isHealthCheckOk =
isHealthCheckOk && validateWorkloadActions._validateHealthCheck(container.healthCheck.readyCheck);
}
// 这里对高级设置的内容进行检查,如果有错误,则需要展开告诉用户,高级设置当中存在错误
if (
validateWorkloadActions._validateWorkingDir(container.workingDir).status === 2 ||
isHealthCheckOk === false
) {
dispatch(workloadEditActions.modifyAdvancedSettingValidate(true, cKey));
} else {
dispatch(workloadEditActions.modifyAdvancedSettingValidate(false, cKey));
}
}
};
},
/** 校验hpa触发策略的类型是否正确 */
_validateHpaType(type: string, metricArr: HpaMetrics[]) {
let status = 0,
message = '';
if (metricArr.filter(item => item.type === type).length > 1) {
status = 2;
message = t('触发策略不可重复');
} else if (type === 'cpuUtilization' && metricArr.find(item => item.type === 'cpuAverage')) {
status = 2;
message = t('CPU利用率和CPU使用量不可同时设置');
} else if (type === 'cpuAverage' && metricArr.find(item => item.type === 'cpuUtilization')) {
status = 2;
message = t('CPU利用率和CPU使用量不可同时设置');
} else if (type === 'memoryUtilization' && metricArr.find(item => item.type === 'memoryAverage')) {
status = 2;
message = t('内存利用率和内存使用量不可同时设置');
} else if (type === 'memoryAverage' && metricArr.find(item => item.type === 'memoryUtilization')) {
status = 2;
message = t('内存利用率和内存使用量不可同时设置');
} else {
status = 1;
message = '';
}
return { status, message };
},
validateHpaType(type: string, mId: string) {
return async (dispatch, getState: GetState) => {
let metricArr: HpaMetrics[] = cloneDeep(getState().subRoot.workloadEdit.metrics),
result = validateWorkloadActions._validateHpaType(type, metricArr),
mIndex = metricArr.findIndex(item => item.id === mId);
metricArr[mIndex]['v_type'] = result;
dispatch({
type: ActionType.W_UpdateMetrics,
payload: metricArr
});
};
},
_valdiateAllHpaType(metricArr: HpaMetrics[]) {
let result = true;
metricArr.forEach(item => {
result = result && validateWorkloadActions._validateHpaType(item.type, metricArr).status === 1;
});
return result;
},
validateAllHpaType() {
return async (dispatch, getState: GetState) => {
getState().subRoot.workloadEdit.metrics.forEach(item => {
dispatch(validateWorkloadActions.validateHpaType(item.type, item.id + ''));
});
};
},
/** 校验阈值是否正确 */
_validateHpaValue(value: string, type: string, containers: ContainerItem[]) {
let status = 0,
message = '',
reg = /^\d+|\d+\.\d+$/;
if (!value) {
status = 2;
message = t('阈值不能为空');
} else if (!reg.test(value)) {
status = 2;
message = t('阈值必须要数值');
} else if (+value < 0) {
status = 2;
message = t('阈值须大于等于0');
} else if (
type === 'cpuUtilization' &&
containers.filter(container => container.cpuLimit.find(item => item.type === 'request').value === '').length > 0
) {
status = 2;
message = t('设置CPU利用率需要设置CPU Request');
} else if (
type === 'memoryUtilization' &&
containers.filter(container => container.memLimit.find(item => item.type === 'request').value === '').length > 0
) {
status = 2;
message = t('设置内存利用率需要设置内存 Request');
} else {
status = 1;
message = '';
}
return { status, message };
},
validateHpaValue(value: string, mId: string) {
return async (dispatch, getState: GetState) => {
let { containers, metrics } = getState().subRoot.workloadEdit;
let metricArr: HpaMetrics[] = cloneDeep(metrics),
mIndex = metricArr.findIndex(item => item.id === mId),
result = validateWorkloadActions._validateHpaValue(value, metricArr[mIndex].type, containers);
metricArr[mIndex]['v_value'] = result;
dispatch({
type: ActionType.W_UpdateMetrics,
payload: metricArr
});
};
},
_validateAllHpaValue(metricArr: HpaMetrics[], containers: ContainerItem[]) {
let result = true;
metricArr.forEach(item => {
result = result && validateWorkloadActions._validateHpaValue(item.value, item.type, containers).status === 1;
});
return result;
},
validateAllHpaValue() {
return async (dispatch, getState: GetState) => {
getState().subRoot.workloadEdit.metrics.forEach(item => {
dispatch(validateWorkloadActions.validateHpaValue(item.value, item.id + ''));
});
};
},
/** 校验最小实例数 */
_validateMinReplicas(replicas: string) {
let status = 0,
message = '',
reg = /^\d+$/;
if (!replicas) {
status = 2;
message = t('实例数不能为空');
} else if (!reg.test(replicas)) {
status = 2;
message = t('实例数必须为整数');
} else if (+replicas < 1) {
status = 2;
message = t('实例数最小为1');
} else {
status = 1;
message = '';
}
return { status, message };
},
validateMinReplicas() {
return async (dispatch, getState: GetState) => {
let { minReplicas } = getState().subRoot.workloadEdit,
result = validateWorkloadActions._validateMinReplicas(minReplicas);
dispatch({
type: ActionType.WV_MinReplicas,
payload: result
});
};
},
/** 校验最大实例数 */
_validateMaxReplicas(replicas: string, min: string) {
let status = 0,
message = '',
reg = /^\d+$/;
if (!replicas) {
status = 2;
message = t('实例数不能为空');
} else if (!reg.test(replicas)) {
status = 2;
message = t('实例数必须为整数');
} else if (min && +replicas < +min) {
status = 2;
message = t('最大实例数需大于最小实例数');
} else {
status = 1;
message = '';
}
return { status, message };
},
validateMaxReplicas() {
return async (dispatch, getState: GetState) => {
let { maxReplicas, minReplicas } = getState().subRoot.workloadEdit,
result = validateWorkloadActions._validateMaxReplicas(maxReplicas, minReplicas);
dispatch({
type: ActionType.WV_MaxReplicas,
payload: result
});
};
},
/** 校验cronHpa的crontab是否正确 */
validateCronTab(mId: string) {
return async (dispatch: Redux.Dispatch, getState: GetState) => {
let metricArr: CronMetrics[] = cloneDeep(getState().subRoot.workloadEdit.cronMetrics),
mIndex = metricArr.findIndex(item => item.id === mId),
result = validateWorkloadActions._validateCronSchedule(metricArr[mIndex].crontab);
metricArr[mIndex]['v_crontab'] = result;
dispatch({
type: ActionType.W_UpdateCronMetrics,
payload: metricArr
});
};
},
validateAllCronTab() {
return async (dispatch: Redux.Dispatch, getState: GetState) => {
getState().subRoot.workloadEdit.cronMetrics.forEach(item => {
dispatch(validateWorkloadActions.validateCronTab(item.id + ''));
});
};
},
/** 校验cronHpa的目标实例数是否正确 */
_validateCronTargetReplicas(replicas: string) {
let status = 1,
message = '',
reg = /\d+/;
if (!replicas) {
status = 2;
message = t('目标实例数不能为空');
} else if (!reg.test(replicas)) {
status = 2;
message = t('目标实例数只能为整数');
} else if (+replicas < 0) {
status = 2;
message = t('目标实例数需大于等于0');
}
return { status, message };
},
validateCronTargetReplicas(mId: string) {
return async (dispatch: Redux.Dispatch, getState: GetState) => {
let metricArr: CronMetrics[] = cloneDeep(getState().subRoot.workloadEdit.cronMetrics),
mIndex = metricArr.findIndex(item => item.id === mId),
result = validateWorkloadActions._validateCronTargetReplicas(metricArr[mIndex].targetReplicas);
metricArr[mIndex]['v_targetReplicas'] = result;
dispatch({
type: ActionType.W_UpdateCronMetrics,
payload: metricArr
});
};
},
validateAllCronTargetReplicas() {
return async (dispatch: Redux.Dispatch, getState: GetState) => {
getState().subRoot.workloadEdit.cronMetrics.forEach(item => {
dispatch(validateWorkloadActions.validateCronTargetReplicas(item.id + ''));
});
};
},
/** 校验当前的imagePullSecrets */
_validateImagePullSecret(secretName, list: ImagePullSecrets[]) {
let status = 0,
message = '';
if (!secretName) {
status = 2;
message = t('请选择dockercfg类型的Secret');
} else if (list.filter(item => item.secretName === secretName).length > 1) {
status = 2;
message = t('不可选择相同的Secret');
} else {
status = 1;
message = '';
}
return { status, message };
},
validateImagePullSecret(secretName: string, sId: string) {
return async (dispatch, getState: GetState) => {
let newList: ImagePullSecrets[] = cloneDeep(getState().subRoot.workloadEdit.imagePullSecrets),
sIndex = newList.findIndex(item => item.id === sId),
result = validateWorkloadActions._validateImagePullSecret(secretName, newList);
newList[sIndex]['v_secretName'] = result;
dispatch({
type: ActionType.ImagePullSecrets,
payload: newList
});
};
},
/** 校验整个workload表单是否正确 */
_validateWorkloadEdit(workloadEdit: WorkloadEdit, serviceEdit: ServiceEdit) {
let result = true;
result =
result &&
validateWorkloadActions._validateWorkloadName(workloadEdit.workloadName).status === 1 &&
validateWorkloadActions._validateWorkloadDesp(workloadEdit.description).status === 1 &&
validateWorkloadActions._validateAllWorkloadLabelValue(workloadEdit.workloadLabels) &&
validateWorkloadActions._validateAllWorkloadLabelKey(workloadEdit.workloadLabels) &&
validateWorkloadActions._validateNamespace(workloadEdit.namespace).status === 1 &&
validateWorkloadActions._validateAllVolumeName(workloadEdit.volumes) &&
validateWorkloadActions._validateAllPvcSelection(workloadEdit.volumes) &&
validateWorkloadActions._validateAllNfsPath(workloadEdit.volumes) &&
validateWorkloadActions._validateAllHostPath(workloadEdit.volumes) &&
validateWorkloadActions._validateAllVolumeIsMounted(workloadEdit.volumes, workloadEdit.containers).allIsMounted;
if (workloadEdit.workloadAnnotations.length) {
result =
result &&
validateWorkloadActions._validateAllWorkloadAnnotationsKey(workloadEdit.workloadAnnotations) &&
validateWorkloadActions._validateAllWorkloadAnnotationsValue(workloadEdit.workloadAnnotations);
}
workloadEdit.containers.forEach(c => {
result = result && validateWorkloadActions._validateContainer(c, workloadEdit.volumes, workloadEdit.containers);
});
// 判断当前的workload的类型
let isCronJob = workloadEdit.workloadType === 'cronjob',
isJob = workloadEdit.workloadType === 'job',
isDeployment = workloadEdit.workloadType === 'deployment',
isStatefulset = workloadEdit.workloadType === 'statefulset',
isTapp = workloadEdit.workloadType === 'tapp';
// workloadType是 cronjob,则需要校验执行策略
if (isCronJob) {
result = result && validateWorkloadActions._validateCronSchedule(workloadEdit.cronSchedule).status === 1;
}
// workloadType为 cronjob 或者 job的时候,需要校验 重复次数 和 并行数
if (isCronJob || isJob) {
result =
result &&
validateWorkloadActions._validateJobCompletion(+workloadEdit.completion).status === 1 &&
validateWorkloadActions._validateJobParallel(+workloadEdit.parallelism).status === 1;
}
// 如果当前是deployment 并且实例更新方式为autoScale
if ((isDeployment || isTapp) && workloadEdit.scaleType === 'autoScale') {
result =
result &&
validateWorkloadActions._valdiateAllHpaType(workloadEdit.metrics) &&
validateWorkloadActions._validateAllHpaValue(workloadEdit.metrics, workloadEdit.containers) &&
validateWorkloadActions._validateMinReplicas(workloadEdit.minReplicas).status === 1 &&
validateWorkloadActions._validateMaxReplicas(workloadEdit.maxReplicas, workloadEdit.minReplicas).status === 1;
}
// 这里是同时创建服务的时候,需要校验Service相关的信息
if ((isDeployment || isStatefulset) && workloadEdit.isCreateService) {
result = result && validateServiceActions._validateUpdateServiceAccessEdit(serviceEdit);
}
//如果设置了节点亲和性
if (workloadEdit.nodeAffinityType === affinityType.rule) {
result = result && validateWorkloadActions._validateAllNodeAffinityRule(workloadEdit.nodeAffinityRule);
} else if (workloadEdit.nodeAffinityType === affinityType.node) {
result = result && workloadEdit.computer.selections.length !== 0;
}
return result;
},
validateWorkloadEdit() {
return async (dispatch, getState: GetState) => {
let { subRoot } = getState(),
{ workloadEdit } = subRoot,
{ containers, workloadType, isCreateService, workloadAnnotations } = workloadEdit;
dispatch(validateWorkloadActions.validateWorkloadName());
dispatch(validateWorkloadActions.validateWorkloadDesp());
dispatch(validateWorkloadActions.validateAllWorkloadLabelKey());
dispatch(validateWorkloadActions.validateAllWorkloadLabelValue());
dispatch(validateWorkloadActions.validateNamespace());
// 校验workloadAnnotataions
if (workloadAnnotations.length) {
dispatch(validateWorkloadActions.validateAllWorkloadAnnotationsKey());
dispatch(validateWorkloadActions.validateAllWorkloadAnnotationsValue());
}
// 数据卷的相关校验
dispatch(validateWorkloadActions.validateAllVolumeName());
dispatch(validateWorkloadActions.validateAllNfsPath());
dispatch(validateWorkloadActions.validateAllHosPath());
dispatch(validateWorkloadActions.validateAllPvcSelection());
dispatch(validateWorkloadActions.validateAllVolumeIsMounted());
// 校验容器的编辑是否都正确
containers.forEach(c => {
dispatch(validateWorkloadActions.validateContainer(c));
});
// 判断当前的workload的类型
let isCronJob = workloadType === 'cronjob',
isJob = workloadType === 'job',
isDeployment = workloadEdit.workloadType === 'deployment',
isStatefulset = workloadEdit.workloadType === 'statefulset',
isTapp = workloadEdit.workloadType === 'tapp';
// workloadType是 cronjob,则需要校验执行策略
if (isCronJob) {
dispatch(validateWorkloadActions.validateCronSchedule());
}
// workloadType为 cronjob 或者 job的时候,需要校验 重复次数 和 并行数
if (isCronJob || isJob) {
dispatch(validateWorkloadActions.validateJobCompletion());
dispatch(validateWorkloadActions.validateJobParallel());
}
// 如果当前是deployment或者Tapp 并且实例更新方式为autoScale
if ((isDeployment || isTapp) && workloadEdit.scaleType === 'autoScale') {
dispatch(validateWorkloadActions.validateAllHpaType());
dispatch(validateWorkloadActions.validateAllHpaValue());
dispatch(validateWorkloadActions.validateMinReplicas());
dispatch(validateWorkloadActions.validateMaxReplicas());
}
// 这里是同时创建服务的时候,需要校验Service相关的信息
if ((isDeployment || isStatefulset || isTapp) && isCreateService) {
dispatch(validateServiceActions.validateUpdateServiceAccessEdit());
}
if (workloadEdit.nodeAffinityType === affinityType.rule) {
dispatch(validateWorkloadActions.validateAllNodeAffinityRule());
} else if (workloadEdit.nodeAffinityType === affinityType.node) {
dispatch(validateWorkloadActions.validateNodeAffinitySelector());
}
};
},
/** ========================== start 这里是 更新镜像相关的校验 =================================== */
_validateMinReadySeconds(seconds: string) {
let status = 0,
message = '',
reg = /^\d+$/;
if (!seconds) {
status = 2;
message = t('更新间隔不能为空值');
} else if (!reg.test(seconds)) {
status = 2;
message = t('更新间隔必须为自然数');
} else {
status = 1;
message = '';
}
return { status, message };
},
validateMinReadySeconds() {
return async (dispatch, getState: GetState) => {
let { minReadySeconds } = getState().subRoot.workloadEdit,
result = validateWorkloadActions._validateMinReadySeconds(minReadySeconds);
dispatch({
type: ActionType.WV_MinReadySeconds,
payload: result
});
};
},
/** 校验批量的大小 */
_validateBatchSize(size: string) {
let status = 0,
message = '',
reg = /^(100|[1-9]?\d(\.\d\d?\d?)?)%$|^\d+$/;
if (!reg.test(size)) {
status = 2;
message = t('数值格式不正确,必须为0、正整数或者正百分数');
} else {
status = 1;
message = '';
}
return { status, message };
},
validateBatchSize() {
return async (dispatch, getState: GetState) => {
let { batchSize } = getState().subRoot.workloadEdit,
result = validateWorkloadActions._validateBatchSize(batchSize);
dispatch({
type: ActionType.WV_BatchSize,
payload: result
});
};
},
/** 校验maxSurge */
validateMaxSurge() {
return async (dispatch, getState: GetState) => {
let { maxSurge } = getState().subRoot.workloadEdit,
result = validateWorkloadActions._validateBatchSize(maxSurge);
dispatch({
type: ActionType.WV_MaxSurge,
payload: result
});
};
},
/** 校验 maxUnavailable */
validateMaxUnavaiable(noZero?: boolean) {
return async (dispatch, getState: GetState) => {
let { maxUnavailable, workloadType } = getState().subRoot.workloadEdit;
let isTapp = workloadType === 'tapp';
let result;
if (isTapp) {
result = validateWorkloadActions._validateMaxUnavaiableForTapp(maxUnavailable, noZero);
} else {
result = validateWorkloadActions._validateBatchSize(maxUnavailable);
}
dispatch({
type: ActionType.WV_MaxUnavailable,
payload: result
});
};
},
_validateMaxUnavaiableForTapp(size: string, noZero?: boolean) {
let reg = /^\d+$/,
status = 0,
message = '';
if (!size) {
status = 2;
message = '数值不能为空';
} else if (noZero && (size === '0' || !reg.test(size))) {
status = 2;
message = '数值不正确,必须为正整数';
} else if (!reg.test(size)) {
status = 2;
message = '数值格式不正确,必须为0或者正整数';
} else {
status = 1;
message = '';
}
return { status, message };
},
/** 校验 partition的合法性 */
validatePartition() {
return async (dispatch, getState: GetState) => {
let { partition } = getState().subRoot.workloadEdit,
result = validateWorkloadActions._validateBatchSize(partition);
dispatch({
type: ActionType.WV_Partition,
payload: result
});
};
},
/** 校验更新的所有选项是否合法 */
_validateUpdateRegistryEdit(workloadEdit: WorkloadEdit) {
let {
minReadySeconds,
resourceUpdateType,
workloadType,
partition,
rollingUpdateStrategy,
maxSurge,
maxUnavailable,
batchSize,
containers
} = workloadEdit;
let result = true;
if (resourceUpdateType === 'RollingUpdate') {
// 只有statefulset没有 minReadySeconds
if (workloadType !== 'statefulset') {
result = result && validateWorkloadActions._validateMinReadySeconds(minReadySeconds).status === 1;
}
if (workloadType === 'deployment') {
if (rollingUpdateStrategy === 'userDefined') {
result =
result &&
validateWorkloadActions._validateBatchSize(maxSurge).status === 1 &&
validateWorkloadActions._validateBatchSize(maxUnavailable).status === 1;
} else {
result = result && validateWorkloadActions._validateBatchSize(batchSize).status === 1;
}
} else if (workloadType === 'statefulset') {
result = result && validateWorkloadActions._validateBatchSize(partition).status === 1;
}
}
if (workloadType === 'tapp') {
result = result && validateWorkloadActions._validateMaxUnavaiableForTapp(maxUnavailable, true).status === 1;
}
containers.forEach(container => {
result = result && validateWorkloadActions._validateRegistrySelection(container.registry).status === 1;
});
return result;
},
validateUpdateRegistryEdit() {
return async (dispatch, getState: GetState) => {
let { rollingUpdateStrategy, resourceUpdateType, containers, workloadType } = getState().subRoot.workloadEdit;
let isStatefulset = workloadType === 'statefulset';
let isTapp = workloadType === 'tapp';
if (resourceUpdateType === 'RollingUpdate') {
!isStatefulset && dispatch(validateWorkloadActions.validateMinReadySeconds());
// 如果当前滚动更新资源为deployment
if (workloadType === 'deployment') {
if (rollingUpdateStrategy === 'userDefined') {
dispatch(validateWorkloadActions.validateMaxSurge());
dispatch(validateWorkloadActions.validateMaxUnavaiable());
} else {
dispatch(validateWorkloadActions.validateBatchSize());
}
} else if (workloadType === 'statefulset') {
dispatch(validateWorkloadActions.validatePartition());
}
}
if (isTapp) {
dispatch(validateWorkloadActions.validateMaxUnavaiable(true));
}
containers.forEach(container => {
dispatch(validateWorkloadActions.validateRegistrySelection(container.registry, container.id + ''));
});
};
},
/** ========================== end 这里是 更新镜像相关的校验 =================================== */
/** ========================== start 这里是 更新实例数量相关 的校验 =================================== */
_validatePodNumEdit(workloadEdit: WorkloadEdit) {
let result = true;
if (workloadEdit.scaleType === 'autoScale') {
result =
result &&
validateWorkloadActions._valdiateAllHpaType(workloadEdit.metrics) &&
validateWorkloadActions._validateAllHpaValue(workloadEdit.metrics, workloadEdit.containers) &&
validateWorkloadActions._validateMinReplicas(workloadEdit.minReplicas).status === 1 &&
validateWorkloadActions._validateMaxReplicas(workloadEdit.maxReplicas, workloadEdit.minReplicas).status === 1;
}
return result;
},
validatePodNumEdit() {
return async (dispatch, getState: GetState) => {
let { scaleType } = getState().subRoot.workloadEdit;
// 只有hpa的东西需要校验
if (scaleType === 'autoScale') {
dispatch(validateWorkloadActions.validateAllHpaType());
dispatch(validateWorkloadActions.validateAllHpaValue());
dispatch(validateWorkloadActions.validateMinReplicas());
dispatch(validateWorkloadActions.validateMaxReplicas());
}
};
},
/** ========================== end 这里是 更新实例数量 的校验 =================================== */
/** ========================== start 这里是 校验node节点亲和性规则相关的校验 =================================== */
_validateNodeAffinityRuleKey(key: string) {
let reg = /^([A-Za-z0-9][-A-Za-z0-9_./]*)?[A-Za-z0-9]$/,
status = 0,
message = '';
if (!key) {
status = 2;
message = t('标签名不能为空');
} else if (key.length > 63) {
status = 2;
message = t('标签名长度不能超过63个字符');
} else if (!reg.test(key)) {
status = 2;
message = t('标签格式不正确');
} else {
status = 1;
message = '';
}
return { status, message };
},
_validateNodeAffinityRuleValue(value: string, operator: string) {
let reg = /^([A-Za-z0-9][-A-Za-z0-9_./]*)?[A-Za-z0-9]$/,
regNum = /^[0-9]*$/,
status = 0,
message = '';
if (operator !== 'Exists' && operator !== 'DoesNotExist') {
if (!value) {
status = 2;
message = t('自定义规则不能为空');
} else {
let valueArray = value.split(';');
if (operator === 'Lt' || operator === 'Gt') {
if (valueArray.length !== 1) {
status = 2;
message = t('Gt和Lt操作符只支持一个value值');
} else {
if (!regNum.test(valueArray[0])) {
status = 2;
message = t('Gt和Lt操作符value值格式必须为数字');
} else {
status = 1;
message = '';
}
}
} else {
for (let i = 0; i < valueArray.length; ++i) {
if (!valueArray[i]) {
status = 2;
message = t('标签名不能为空');
} else if (valueArray[i].length > 63) {
status = 2;
message = t('标签名长度不能超过63个字符');
} else if (!reg.test(valueArray[i])) {
status = 2;
message = t('标签格式不正确');
} else {
status = 1;
message = '';
}
if (status === 2) {
break;
}
}
}
}
} else {
status = 1;
message = '';
}
return { status, message };
},
validateNodeAffinityRuleKey(type: string, id: string) {
return async (dispatch, getState: GetState) => {
let { nodeAffinityRule } = getState().subRoot.workloadEdit,
requiredExecution = cloneDeep(nodeAffinityRule.requiredExecution),
preferredExecution = cloneDeep(nodeAffinityRule.preferredExecution),
result;
if (type === 'preferred') {
let preferredMatchExpressions = preferredExecution[0].preference.matchExpressions,
index = preferredMatchExpressions.findIndex(e => e.id === id);
result = validateWorkloadActions._validateNodeAffinityRuleKey(preferredMatchExpressions[index].key);
preferredExecution[0].preference.matchExpressions[index].v_key = result;
} else if (type === 'required') {
let requiredMatchExpressions = requiredExecution[0].matchExpressions,
index = requiredMatchExpressions.findIndex(e => e.id === id);
result = validateWorkloadActions._validateNodeAffinityRuleKey(requiredMatchExpressions[index].key);
requiredExecution[0].matchExpressions[index].v_key = result;
}
dispatch({
type: ActionType.W_UpdateNodeAffinityRule,
payload: Object.assign({}, nodeAffinityRule, {
requiredExecution,
preferredExecution
})
});
};
},
validateNodeAffinityRuleValue(type: string, id: string) {
return async (dispatch, getState: GetState) => {
let { nodeAffinityRule } = getState().subRoot.workloadEdit,
requiredExecution = cloneDeep(nodeAffinityRule.requiredExecution),
preferredExecution = cloneDeep(nodeAffinityRule.preferredExecution),
result;
if (type === 'preferred') {
let preferredMatchExpressions = preferredExecution[0].preference.matchExpressions,
index = preferredMatchExpressions.findIndex(e => e.id === id);
result = validateWorkloadActions._validateNodeAffinityRuleValue(
preferredMatchExpressions[index].values,
preferredMatchExpressions[index].operator
);
preferredExecution[0].preference.matchExpressions[index].v_values = result;
} else if (type === 'required') {
let requiredMatchExpressions = requiredExecution[0].matchExpressions,
index = requiredMatchExpressions.findIndex(e => e.id === id);
result = validateWorkloadActions._validateNodeAffinityRuleValue(
requiredMatchExpressions[index].values,
requiredMatchExpressions[index].operator
);
requiredExecution[0].matchExpressions[index].v_values = result;
}
dispatch({
type: ActionType.W_UpdateNodeAffinityRule,
payload: Object.assign({}, nodeAffinityRule, {
requiredExecution,
preferredExecution
})
});
};
},
validateAllNodeAffinityRule() {
return async (dispatch, getState: GetState) => {
let { nodeAffinityRule } = getState().subRoot.workloadEdit,
{ requiredExecution, preferredExecution } = nodeAffinityRule;
requiredExecution[0].matchExpressions.forEach(rule => {
dispatch(validateWorkloadActions.validateNodeAffinityRuleKey('required', rule.id + ''));
dispatch(validateWorkloadActions.validateNodeAffinityRuleValue('required', rule.id + ''));
});
preferredExecution[0].preference.matchExpressions.forEach(rule => {
dispatch(validateWorkloadActions.validateNodeAffinityRuleKey('preferred', rule.id + ''));
dispatch(validateWorkloadActions.validateNodeAffinityRuleValue('preferred', rule.id + ''));
});
};
},
_validateAllNodeAffinityRule(nodeAffinityRule: AffinityRule) {
let { requiredExecution, preferredExecution } = nodeAffinityRule;
let result = true;
requiredExecution[0].matchExpressions.forEach(rule => {
result =
result &&
validateWorkloadActions._validateNodeAffinityRuleKey(rule.key).status === 1 &&
validateWorkloadActions._validateNodeAffinityRuleValue(rule.values, rule.operator).status === 1;
});
preferredExecution[0].preference.matchExpressions.forEach(rule => {
result =
result &&
validateWorkloadActions._validateNodeAffinityRuleKey(rule.key).status === 1 &&
validateWorkloadActions._validateNodeAffinityRuleValue(rule.values, rule.operator).status === 1;
});
return result;
},
validateNodeAffinitySelector() {
return async (dispatch, getState: GetState) => {
let { computer } = getState().subRoot.workloadEdit;
let status = 0,
message = '';
if (computer.selections.length === 0) {
status = 2;
message = t('选择节点不能为空');
} else {
status = 1;
message = '';
}
dispatch({
type: ActionType.WV_NodeSelector,
payload: {
status,
message
}
});
};
}
/** ========================== end 这里是 校验node节点亲和性规则相关的校验 =================================== */
};
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2011-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.springframework.data.hadoop.configuration;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.util.GenericOptionsParser;
import org.springframework.core.io.Resource;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
/**
* Reusable utility class for common {@link Configuration} operations.
*
* @author Costin Leau
*/
public abstract class ConfigurationUtils {
/**
* Adds the specified properties to the given {@link Configuration} object.
*
* @param configuration configuration to manipulate. Should not be null.
* @param properties properties to add to the configuration. May be null.
*/
public static void addProperties(Configuration configuration, Properties properties) {
Assert.notNull(configuration, "A non-null configuration is required");
if (properties != null) {
Enumeration<?> props = properties.propertyNames();
while (props.hasMoreElements()) {
String key = props.nextElement().toString();
configuration.set(key, properties.getProperty(key));
}
}
}
/**
* Creates a new {@link Configuration} based on the given arguments.
*
* @param original initial configuration to read from. May be null.
* @param properties properties object to add to the newly created configuration. May be null.
* @return newly created configuration based on the input parameters.
*/
public static Configuration createFrom(Configuration original, Properties properties) {
Configuration cfg = null;
if (original != null) {
if ("org.apache.hadoop.mapred.JobConf".equals(original.getClass().getName())) {
cfg = JobConfUtils.createFrom(original, properties);
} else {
cfg = new Configuration(original);
addProperties(cfg, properties);
}
}
else {
cfg = new Configuration();
addProperties(cfg, properties);
}
return cfg;
}
/**
* Returns a static {@link Properties} copy of the given configuration.
*
* @param configuration Hadoop configuration
* @return properties
*/
public static Properties asProperties(Configuration configuration) {
Properties props = new Properties();
if (configuration != null) {
for (Map.Entry<String, String> entry : configuration) {
props.setProperty(entry.getKey(), entry.getValue());
}
}
return props;
}
/**
* Creates a new {@link Configuration} by merging the given configurations.
* Ordering is important - the second configuration overriding values in the first.
*
* @param one configuration to read from. May be null.
* @param two configuration to read from. May be null.
* @return the result of merging the two configurations.
*/
public static Configuration merge(Configuration one, Configuration two) {
if (one == null) {
if (two == null) {
return new Configuration();
}
return new Configuration(two);
}
Configuration c = new Configuration(one);
if (two == null) {
return c;
}
for (Map.Entry<String, String> entry : two) {
c.set(entry.getKey(), entry.getValue());
}
return c;
}
public static void addLibs(Configuration configuration, Resource... libs) {
addResource(configuration, libs, "-libjars");
}
public static void addFiles(Configuration configuration, Resource... files) {
addResource(configuration, files, "-files");
}
public static void addArchives(Configuration configuration, Resource... archives) {
addResource(configuration, archives, "-archives");
}
private static void addResource(Configuration cfg, Resource[] args, String name) {
Assert.notNull(cfg, "a non-null configuration is required");
List<String> list = new ArrayList<String>();
try {
if (!ObjectUtils.isEmpty(args)) {
int count = args.length;
list.add(name);
StringBuilder sb = new StringBuilder();
for (Resource res : args) {
sb.append(res.getURI().toString());
if (--count > 0) {
sb.append(",");
}
}
list.add(sb.toString());
}
new GenericOptionsParser(cfg, list.toArray(new String[list.size()]));
} catch (IOException ex) {
throw new IllegalStateException(ex);
}
}
} | {
"pile_set_name": "Github"
} |
package com.coolweather.coolweatherjetpack.ui
import androidx.lifecycle.ViewModelProviders
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.coolweather.coolweatherjetpack.R
import com.coolweather.coolweatherjetpack.util.InjectorUtil
import com.coolweather.coolweatherjetpack.ui.weather.WeatherActivity
import android.content.Intent
import androidx.appcompat.app.AlertDialog
import com.coolweather.coolweatherjetpack.ui.area.ChooseAreaFragment
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val viewModel = ViewModelProviders.of(this, InjectorUtil.getMainModelFactory()).get(MainViewModel::class.java)
if (viewModel.isWeatherCached()) {
val intent = Intent(this, WeatherActivity::class.java)
startActivity(intent)
finish()
} else {
supportFragmentManager.beginTransaction().replace(R.id.container, ChooseAreaFragment()).commit()
}
}
}
| {
"pile_set_name": "Github"
} |
// Copyright 2018 the V8 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.
#ifndef V8_OBJECTS_API_CALLBACKS_INL_H_
#define V8_OBJECTS_API_CALLBACKS_INL_H_
#include "src/objects/api-callbacks.h"
#include "src/heap/heap-write-barrier-inl.h"
#include "src/heap/heap-write-barrier.h"
#include "src/objects/foreign-inl.h"
#include "src/objects/js-objects-inl.h"
#include "src/objects/name.h"
#include "src/objects/templates.h"
#include "torque-generated/class-definitions-inl.h"
// Has to be the last include (doesn't have include guards):
#include "src/objects/object-macros.h"
namespace v8 {
namespace internal {
TQ_OBJECT_CONSTRUCTORS_IMPL(AccessCheckInfo)
TQ_OBJECT_CONSTRUCTORS_IMPL(AccessorInfo)
TQ_OBJECT_CONSTRUCTORS_IMPL(InterceptorInfo)
TQ_OBJECT_CONSTRUCTORS_IMPL(CallHandlerInfo)
ACCESSORS_CHECKED2(AccessorInfo, getter, Object, kGetterOffset, true,
Foreign::IsNormalized(value))
ACCESSORS_CHECKED2(AccessorInfo, setter, Object, kSetterOffset, true,
Foreign::IsNormalized(value))
bool AccessorInfo::has_getter() {
bool result = getter() != Smi::zero();
DCHECK_EQ(result,
getter() != Smi::zero() &&
Foreign::cast(getter()).foreign_address() != kNullAddress);
return result;
}
bool AccessorInfo::has_setter() {
bool result = setter() != Smi::zero();
DCHECK_EQ(result,
setter() != Smi::zero() &&
Foreign::cast(setter()).foreign_address() != kNullAddress);
return result;
}
BIT_FIELD_ACCESSORS(AccessorInfo, flags, all_can_read,
AccessorInfo::AllCanReadBit)
BIT_FIELD_ACCESSORS(AccessorInfo, flags, all_can_write,
AccessorInfo::AllCanWriteBit)
BIT_FIELD_ACCESSORS(AccessorInfo, flags, is_special_data_property,
AccessorInfo::IsSpecialDataPropertyBit)
BIT_FIELD_ACCESSORS(AccessorInfo, flags, replace_on_access,
AccessorInfo::ReplaceOnAccessBit)
BIT_FIELD_ACCESSORS(AccessorInfo, flags, is_sloppy, AccessorInfo::IsSloppyBit)
BIT_FIELD_ACCESSORS(AccessorInfo, flags, getter_side_effect_type,
AccessorInfo::GetterSideEffectTypeBits)
SideEffectType AccessorInfo::setter_side_effect_type() const {
return SetterSideEffectTypeBits::decode(flags());
}
void AccessorInfo::set_setter_side_effect_type(SideEffectType value) {
// We do not support describing setters as having no side effect, since
// calling set accessors must go through a store bytecode. Store bytecodes
// support checking receivers for temporary objects, but still expect
// the receiver to be written to.
CHECK_NE(value, SideEffectType::kHasNoSideEffect);
set_flags(SetterSideEffectTypeBits::update(flags(), value));
}
BIT_FIELD_ACCESSORS(AccessorInfo, flags, initial_property_attributes,
AccessorInfo::InitialAttributesBits)
bool AccessorInfo::IsCompatibleReceiver(Object receiver) {
if (!HasExpectedReceiverType()) return true;
if (!receiver.IsJSObject()) return false;
return FunctionTemplateInfo::cast(expected_receiver_type())
.IsTemplateFor(JSObject::cast(receiver).map());
}
bool AccessorInfo::HasExpectedReceiverType() {
return expected_receiver_type().IsFunctionTemplateInfo();
}
BOOL_ACCESSORS(InterceptorInfo, flags, can_intercept_symbols,
CanInterceptSymbolsBit::kShift)
BOOL_ACCESSORS(InterceptorInfo, flags, all_can_read, AllCanReadBit::kShift)
BOOL_ACCESSORS(InterceptorInfo, flags, non_masking, NonMaskingBit::kShift)
BOOL_ACCESSORS(InterceptorInfo, flags, is_named, NamedBit::kShift)
BOOL_ACCESSORS(InterceptorInfo, flags, has_no_side_effect,
HasNoSideEffectBit::kShift)
bool CallHandlerInfo::IsSideEffectFreeCallHandlerInfo() const {
ReadOnlyRoots roots = GetReadOnlyRoots();
DCHECK(map() == roots.side_effect_call_handler_info_map() ||
map() == roots.side_effect_free_call_handler_info_map() ||
map() == roots.next_call_side_effect_free_call_handler_info_map());
return map() == roots.side_effect_free_call_handler_info_map();
}
bool CallHandlerInfo::IsSideEffectCallHandlerInfo() const {
ReadOnlyRoots roots = GetReadOnlyRoots();
DCHECK(map() == roots.side_effect_call_handler_info_map() ||
map() == roots.side_effect_free_call_handler_info_map() ||
map() == roots.next_call_side_effect_free_call_handler_info_map());
return map() == roots.side_effect_call_handler_info_map();
}
void CallHandlerInfo::SetNextCallHasNoSideEffect() {
set_map(
GetReadOnlyRoots().next_call_side_effect_free_call_handler_info_map());
}
bool CallHandlerInfo::NextCallHasNoSideEffect() {
ReadOnlyRoots roots = GetReadOnlyRoots();
if (map() == roots.next_call_side_effect_free_call_handler_info_map()) {
set_map(roots.side_effect_call_handler_info_map());
return true;
}
return false;
}
} // namespace internal
} // namespace v8
#include "src/objects/object-macros-undef.h"
#endif // V8_OBJECTS_API_CALLBACKS_INL_H_
| {
"pile_set_name": "Github"
} |
// <copyright>
// Copyright by the Spark Development Network
//
// Licensed under the Rock Community License (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.rockrms.com/license
//
// 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.
// </copyright>
//
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using Rock.Data;
using Rock.Model;
using Rock.Reporting;
using Rock.Web.Cache;
namespace Rock.Utility
{
/// <summary>
/// Expression Helper Methods
/// </summary>
public static class ExpressionHelper
{
/// <summary>
/// Gets a filter expression for an entity property value.
/// </summary>
/// <param name="filterValues">The filter values.</param>
/// <param name="parameterExpression">The parameter expression.</param>
/// <param name="propertyName">Name of the property.</param>
/// <param name="propertyType">Type of the property.</param>
/// <returns></returns>
public static Expression PropertyFilterExpression( List<string> filterValues, Expression parameterExpression, string propertyName, Type propertyType )
{
/* 2020-08-17 MDP
* If it isn't fully configured we won't filter. We can detect if the filter isn't configured by..
*
* 1) There are less than 2 filterValues
* 2) A comparisonType isn't specified ("0" means not specified)
* 3) Except of in the case of IsBlank or IsNotBlank, a "CompareTo null" (filterValues[1]) value means the filter value isn't specified
*
* If we have any of the above cases, we'll return Expression.Const(true), which means we won't filter on this)
*/
if ( filterValues.Count < 2 )
{
// if PropertyFilter needs at least 2 parameters. If it doesn't, don't filter
return Expression.Constant( true );
}
string comparisonValue = filterValues[0];
if ( comparisonValue == "0" )
{
// if the comparison as a string is "0", that means no comparison type is specified (comparisonType enum starts at 1)
return Expression.Constant( true );
}
var type = propertyType;
bool isNullableType = type.IsGenericType && type.GetGenericTypeDefinition() == typeof( Nullable<> );
if ( isNullableType )
{
type = Nullable.GetUnderlyingType( type );
}
object value = ConvertValueToPropertyType( filterValues[1], type, isNullableType );
ComparisonType comparisonType = comparisonValue.ConvertToEnum<ComparisonType>( ComparisonType.EqualTo );
bool valueNotNeeded = ( ComparisonType.IsBlank | ComparisonType.IsNotBlank ).HasFlag( comparisonType );
if ( value != null || valueNotNeeded )
{
// a valid value is specified or we are doing a NotBlank/IsNotBlank, so build an filter expression
MemberExpression propertyExpression = Expression.Property( parameterExpression, propertyName );
ConstantExpression constantExpression = value != null ? Expression.Constant( value, type ) : null;
return ComparisonHelper.ComparisonExpression( comparisonType, propertyExpression, constantExpression );
}
else
{
// if Property Filter isn't fully configured (for example "Birthday(int) greaterThan null"), don't filter the results
return Expression.Constant( true );
}
}
/// <summary>
/// Converts the type of the value to property.
/// </summary>
/// <param name="value">The value.</param>
/// <param name="propertyType">Type of the property.</param>
/// <param name="isNullableType">if set to <c>true</c> [is nullable type].</param>
/// <returns></returns>
public static object ConvertValueToPropertyType( string value, Type propertyType, bool isNullableType )
{
if ( propertyType == typeof( string ) )
{
return value;
}
if ( propertyType == typeof( Guid ) )
{
return value.AsGuid();
}
if ( string.IsNullOrWhiteSpace( value ) && isNullableType )
{
return null;
}
if ( propertyType.IsEnum )
{
return Enum.Parse( propertyType, value );
}
if ( propertyType == typeof( TimeSpan ) )
{
return value.AsTimeSpan();
}
if ( propertyType == typeof( int ) )
{
return value.AsIntegerOrNull();
}
return Convert.ChangeType( value, propertyType );
}
/// <summary>
/// Apply the value to the comparison expression and return the result.
/// </summary>
/// <param name="attributeValueParameterExpression">The attribute value parameter expression.</param>
/// <param name="comparisonExpression">The comparison expression.</param>
/// <param name="value">The value.</param>
/// <returns>
/// <c>true</c> if the comparison expression result in a true result; otherwise, <c>false</c>.
/// </returns>
private static bool IsComparedToValue( ParameterExpression attributeValueParameterExpression, Expression comparisonExpression, string value )
{
// Creates a dummy attribute value that uses the default value
AttributeValue attributeValue = AttributeValue.CreateNonPersistedAttributeValue( value );
// Assign the dummy attribute to the comparison expression
Expression assignExpr = Expression.Assign( attributeValueParameterExpression, Expression.Constant( attributeValue ) );
BlockExpression blockExpr = Expression.Block(
new ParameterExpression[] { attributeValueParameterExpression },
assignExpr,
comparisonExpression
);
// Execute the comparison expression
return Expression.Lambda<Func<bool>>( blockExpr ).Compile()();
}
/// <summary>
/// Builds an expression for an attribute field
/// </summary>
/// <param name="serviceInstance">The service instance.</param>
/// <param name="parameterExpression">The parameter expression.</param>
/// <param name="entityField">The entity field.</param>
/// <param name="values">The filter parameter values: FieldName, <see cref="ComparisonType">Comparison Type</see>, (optional) Comparison Value(s)</param>
/// <returns></returns>
public static Expression GetAttributeExpression( IService serviceInstance, ParameterExpression parameterExpression, EntityField entityField, List<string> values )
{
if ( !values.Any() )
{
// if no filter parameter values where specified, don't filter
return new NoAttributeFilterExpression();
}
var service = new AttributeValueService( ( RockContext ) serviceInstance.Context );
var attributeValues = service.Queryable().Where( v =>
v.EntityId.HasValue );
AttributeCache attributeCache = null;
if ( entityField.AttributeGuid.HasValue )
{
attributeCache = AttributeCache.Get( entityField.AttributeGuid.Value );
var attributeId = attributeCache != null ? attributeCache.Id : 0;
attributeValues = attributeValues.Where( v => v.AttributeId == attributeId );
}
else
{
attributeValues = attributeValues.Where( v => v.Attribute.Key == entityField.Name && v.Attribute.FieldTypeId == entityField.FieldType.Id );
}
ParameterExpression attributeValueParameterExpression = Expression.Parameter( typeof( AttributeValue ), "v" );
// Determine the appropriate comparison type to use for this Expression.
// Attribute Value records only exist for Entities that have a value specified for the Attribute.
// Therefore, if the specified comparison works by excluding certain values we must invert our filter logic:
// first we find the Attribute Values that match those values and then we exclude the associated Entities from the result set.
ComparisonType? comparisonType = ComparisonType.EqualTo;
ComparisonType? evaluatedComparisonType = comparisonType;
// If Values.Count >= 2, then Values[0] is ComparisonType, and Values[1] is a CompareToValue. Otherwise, Values[0] is a CompareToValue (for example, a SingleSelect attribute)
if ( values.Count >= 2 )
{
comparisonType = values[0].ConvertToEnumOrNull<ComparisonType>();
switch ( comparisonType )
{
case ComparisonType.DoesNotContain:
evaluatedComparisonType = ComparisonType.Contains;
break;
case ComparisonType.IsBlank:
evaluatedComparisonType = ComparisonType.IsNotBlank;
break;
case ComparisonType.LessThan:
evaluatedComparisonType = ComparisonType.GreaterThanOrEqualTo;
break;
case ComparisonType.LessThanOrEqualTo:
evaluatedComparisonType = ComparisonType.GreaterThan;
break;
case ComparisonType.NotEqualTo:
evaluatedComparisonType = ComparisonType.EqualTo;
break;
default:
evaluatedComparisonType = comparisonType;
break;
}
values[0] = evaluatedComparisonType.ToString();
}
var filterExpression = entityField.FieldType.Field.AttributeFilterExpression( entityField.FieldConfig, values, attributeValueParameterExpression );
if ( filterExpression != null )
{
if ( filterExpression is NoAttributeFilterExpression )
{
// Special Case: If AttributeFilterExpression returns NoAttributeFilterExpression, just return the NoAttributeFilterExpression.
// For example, If this is a CampusFieldType and they didn't pick any campus, we don't want to do any filtering for this DataFilter.
return filterExpression;
}
else
{
attributeValues = attributeValues.Where( attributeValueParameterExpression, filterExpression, null );
}
}
else
{
// AttributeFilterExpression returned NULL ( the FieldType didn't specify any additional filter on AttributeValue),
// ideally the FieldType should have returned a NoAttributeFilterExpression, but just in case, don't filter
System.Diagnostics.Debug.WriteLine( $"Unexpected NULL result from FieldType.Field.AttributeFilterExpression for { entityField.FieldType }" );
return new NoAttributeFilterExpression();
}
IQueryable<int> ids = attributeValues.Select( v => v.EntityId.Value );
MemberExpression propertyExpression = Expression.Property( parameterExpression, "Id" );
ConstantExpression idsExpression = Expression.Constant( ids.AsQueryable(), typeof( IQueryable<int> ) );
Expression expression = Expression.Call( typeof( Queryable ), "Contains", new Type[] { typeof( int ) }, idsExpression, propertyExpression );
if ( attributeCache != null )
{
// Test the default value against the expression filter. If it pass, then we can include all the attribute values with no value.
var comparedToDefault = IsComparedToValue( attributeValueParameterExpression, filterExpression, attributeCache.DefaultValue );
if ( comparedToDefault )
{
var allAttributeValueIds = service.Queryable().Where( v => v.Attribute.Id == attributeCache.Id && v.EntityId.HasValue && !string.IsNullOrEmpty( v.Value ) ).Select( a => a.EntityId.Value );
ConstantExpression allIdsExpression = Expression.Constant( allAttributeValueIds.AsQueryable(), typeof( IQueryable<int> ) );
Expression notContainsExpression = Expression.Not( Expression.Call( typeof( Queryable ), "Contains", new Type[] { typeof( int ) }, allIdsExpression, propertyExpression ) );
expression = Expression.Or( expression, notContainsExpression );
}
// If there is an EntityTypeQualifierColumn/Value on this attribute, also narrow down the entity query to the ones with matching QualifierColumn/Value
if ( attributeCache.EntityTypeQualifierColumn.IsNotNullOrWhiteSpace() && attributeCache.EntityTypeQualifierValue.IsNotNullOrWhiteSpace() )
{
Expression qualifierParameterExpression = null;
PropertyInfo qualifierColumnProperty = parameterExpression.Type.GetProperty( attributeCache.EntityTypeQualifierColumn );
// make sure the QualifierColumn is an actual mapped property on the Entity
if ( qualifierColumnProperty != null && qualifierColumnProperty.GetCustomAttribute<NotMappedAttribute>() == null )
{
qualifierParameterExpression = parameterExpression;
}
else
{
if ( attributeCache.EntityTypeQualifierColumn == "GroupTypeId" && parameterExpression.Type == typeof( Rock.Model.GroupMember ) )
{
// Special Case for GroupMember with Qualifier of 'GroupTypeId' (which is really Group.GroupTypeId)
qualifierParameterExpression = Expression.Property( parameterExpression, "Group" );
}
else if ( attributeCache.EntityTypeQualifierColumn == "RegistrationTemplateId" && parameterExpression.Type == typeof( Rock.Model.RegistrationRegistrant ) )
{
// Special Case for RegistrationRegistrant with Qualifier of 'RegistrationTemplateId' (which is really Registration.RegistrationInstance.RegistrationTemplateId)
qualifierParameterExpression = Expression.Property( parameterExpression, "Registration" );
qualifierParameterExpression = Expression.Property( qualifierParameterExpression, "RegistrationInstance" );
}
else
{
// Unable to determine how the EntityTypeQualiferColumn relates to the Entity. Probably will be OK, but spit out a debug message
System.Diagnostics.Debug.WriteLine( $"Unable to determine how the EntityTypeQualiferColumn {attributeCache.EntityTypeQualifierColumn} relates to entity {parameterExpression.Type} on attribute {attributeCache.Name}:{attributeCache.Guid}" );
}
}
if ( qualifierParameterExpression != null )
{
// if we figured out the EntityQualifierColumn/Value expression, apply it
// This would effectively add something like 'WHERE [GroupTypeId] = 10' to the WHERE clause
MemberExpression entityQualiferColumnExpression = Expression.Property( qualifierParameterExpression, attributeCache.EntityTypeQualifierColumn );
object entityTypeQualifierValueAsType = Convert.ChangeType( attributeCache.EntityTypeQualifierValue, entityQualiferColumnExpression.Type );
Expression entityQualiferColumnEqualExpression = Expression.Equal( entityQualiferColumnExpression, Expression.Constant( entityTypeQualifierValueAsType, entityQualiferColumnExpression.Type ) );
// If the qualifier Column is GroupTypeId, we'll have to do an OR clause of all the GroupTypes that inherit from this
// This would effectively add something like 'WHERE ([GroupTypeId] = 10) OR ([GroupTypeId] = 12) OR ([GroupTypeId] = 17)' to the WHERE clause
if ( attributeCache.EntityTypeQualifierColumn == "GroupTypeId" && attributeCache.EntityTypeQualifierValue.AsIntegerOrNull().HasValue )
{
var qualifierGroupTypeId = attributeCache.EntityTypeQualifierValue.AsInteger();
List<int> inheritedGroupTypeIds = null;
using (var rockContext = new RockContext() )
{
var groupType = new GroupTypeService( rockContext ).Get( qualifierGroupTypeId );
inheritedGroupTypeIds = groupType.GetAllDependentGroupTypeIds( rockContext );
}
if ( inheritedGroupTypeIds != null )
{
foreach ( var inheritedGroupTypeId in inheritedGroupTypeIds )
{
Expression inheritedEntityQualiferColumnEqualExpression = Expression.Equal( entityQualiferColumnExpression, Expression.Constant( inheritedGroupTypeId ) );
entityQualiferColumnEqualExpression = Expression.Or( entityQualiferColumnEqualExpression, inheritedEntityQualiferColumnEqualExpression );
}
}
}
expression = Expression.And( entityQualiferColumnEqualExpression, expression );
}
}
}
// If we have used an inverted comparison type for the evaluation, invert the Expression so that it excludes the matching Entities.
if ( comparisonType != evaluatedComparisonType )
{
return Expression.Not( expression );
}
else
{
return expression;
}
}
}
}
| {
"pile_set_name": "Github"
} |
package org.triplea.debug.error.reporting;
import java.util.logging.LogRecord;
import javax.annotation.Nonnull;
import lombok.Builder;
import lombok.Value;
import org.triplea.debug.console.window.DebugUtils;
/** Value object representing data gathered from user and an underlying error. */
@Value
@Builder
class ErrorReportRequestParams {
@Nonnull private final String userDescription;
private final String mapName;
@Builder.Default @Nonnull private final String memoryStatistics = DebugUtils.getMemory();
@Nonnull private final LogRecord logRecord;
}
| {
"pile_set_name": "Github"
} |
namespace JetBrains.Diagnostics
{
public enum LoggingLevel
{
/// <summary>
/// Do not use it in logging. Only in config to disable logging.
/// </summary>
OFF = 0,
/// <summary>
/// For errors that lead to application failure
/// </summary>
FATAL = 1,
/// <summary>
/// For errors that must be shown in Exception Browser
/// </summary>
ERROR = 2,
/// <summary>
/// Suspicious situations but not errors
/// </summary>
WARN = 3,
/// <summary>
/// Regular level for important events
/// </summary>
INFO = 4,
/// <summary>
/// Additional info for debugging
/// </summary>
VERBOSE = 5,
/// <summary>
/// Methods & callstacks tracing, more than verbose
/// </summary>
TRACE = 6
}
public static class LoggingLevelEx
{
public static bool IsSeriousError(this LoggingLevel level)
{
return level == LoggingLevel.FATAL || level == LoggingLevel.ERROR;
}
public static LoggingLevel AtLeast(this LoggingLevel? level, LoggingLevel least)
{
if (level == null || level.Value < least) return least;
return level.Value;
}
}
} | {
"pile_set_name": "Github"
} |
# Number
An integer number.
### @parent blocks/language
A *Number* is an integer such as `42` or `-42`. More precisely, a *Number* is a signed 32-bit integer (two's complement).
### Declare a number variable
You can assign a number to a variable:
#### #declareexample
```block
let num = 42;
```
### Arithmetic operators
The following arithmetic operators work on numbers and return a [Number](/types/number):
* addition: `1 + 3`
* subtraction: `1 - 3 `
* multiplication: `3 * 2`
* integer division: `7 / 3`
* modulo is available through the [math library](/blocks/math)
### Relational operators
The following relational operators work on numbers and return a [Boolean](/blocks/logic/boolean):
* equality: `(3 + 1) = 4`
* inequality: `3 != 4`
* less or equal than: `3 <= 4`
* less than: `3 < 4`
* greater or equal than : `4 >= 3`
* greater than: `4 > 3`
## #print
### Functions that return a number
Some functions return a number, which you can store in a variable.
### #functionreturnexample
```block
let abs = Math.abs(-42);
```
### Math functions
The [math library](/blocks/math) includes math related functions. For example, the `min` function returns the minimum value of two input parameters `x` and `y`:
```block
let lowest = Math.min(-42, 1000);
```
### See also
[math](/blocks/math), [var](/blocks/variables/var), [Boolean](/blocks/logic/boolean)
| {
"pile_set_name": "Github"
} |
---
id: version-6.26.3-babel-helper-define-map
title: babel-helper-define-map
sidebar_label: babel-helper-define-map
original_id: babel-helper-define-map
---
TODO
| {
"pile_set_name": "Github"
} |
/*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package com.google.androidstudiopoet.models
sealed class Repository {
data class Named(val name: String): Repository()
data class Remote(val url: String): Repository()
} | {
"pile_set_name": "Github"
} |
#include <string.h>
#include <stdint.h>
static char *twobyte_strstr(const unsigned char *h, const unsigned char *n)
{
uint16_t nw = n[0]<<8 | n[1], hw = h[0]<<8 | h[1];
for (h++; *h && hw != nw; hw = hw<<8 | *++h);
return *h ? (char *)h-1 : 0;
}
static char *threebyte_strstr(const unsigned char *h, const unsigned char *n)
{
uint32_t nw = n[0]<<24 | n[1]<<16 | n[2]<<8;
uint32_t hw = h[0]<<24 | h[1]<<16 | h[2]<<8;
for (h+=2; *h && hw != nw; hw = (hw|*++h)<<8);
return *h ? (char *)h-2 : 0;
}
static char *fourbyte_strstr(const unsigned char *h, const unsigned char *n)
{
uint32_t nw = n[0]<<24 | n[1]<<16 | n[2]<<8 | n[3];
uint32_t hw = h[0]<<24 | h[1]<<16 | h[2]<<8 | h[3];
for (h+=3; *h && hw != nw; hw = hw<<8 | *++h);
return *h ? (char *)h-3 : 0;
}
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define BITOP(a,b,op) \
((a)[(size_t)(b)/(8*sizeof *(a))] op (size_t)1<<((size_t)(b)%(8*sizeof *(a))))
static char *twoway_strstr(const unsigned char *h, const unsigned char *n)
{
const unsigned char *z;
size_t l, ip, jp, k, p, ms, p0, mem, mem0;
size_t byteset[32 / sizeof(size_t)] = { 0 };
size_t shift[256];
/* Computing length of needle and fill shift table */
for (l=0; n[l] && h[l]; l++)
BITOP(byteset, n[l], |=), shift[n[l]] = l+1;
if (n[l]) return 0; /* hit the end of h */
/* Compute maximal suffix */
ip = -1; jp = 0; k = p = 1;
while (jp+k<l) {
if (n[ip+k] == n[jp+k]) {
if (k == p) {
jp += p;
k = 1;
} else k++;
} else if (n[ip+k] > n[jp+k]) {
jp += k;
k = 1;
p = jp - ip;
} else {
ip = jp++;
k = p = 1;
}
}
ms = ip;
p0 = p;
/* And with the opposite comparison */
ip = -1; jp = 0; k = p = 1;
while (jp+k<l) {
if (n[ip+k] == n[jp+k]) {
if (k == p) {
jp += p;
k = 1;
} else k++;
} else if (n[ip+k] < n[jp+k]) {
jp += k;
k = 1;
p = jp - ip;
} else {
ip = jp++;
k = p = 1;
}
}
if (ip+1 > ms+1) ms = ip;
else p = p0;
/* Periodic needle? */
if (memcmp(n, n+p, ms+1)) {
mem0 = 0;
p = MAX(ms, l-ms-1) + 1;
} else mem0 = l-p;
mem = 0;
/* Initialize incremental end-of-haystack pointer */
z = h;
/* Search loop */
for (;;) {
/* Update incremental end-of-haystack pointer */
if (z-h < l) {
/* Fast estimate for MIN(l,63) */
size_t grow = l | 63;
const unsigned char *z2 = memchr(z, 0, grow);
if (z2) {
z = z2;
if (z-h < l) return 0;
} else z += grow;
}
/* Check last byte first; advance by shift on mismatch */
if (BITOP(byteset, h[l-1], &)) {
k = l-shift[h[l-1]];
//printf("adv by %zu (on %c) at [%s] (%zu;l=%zu)\n", k, h[l-1], h, shift[h[l-1]], l);
if (k) {
if (mem0 && mem && k < p) k = l-p;
h += k;
mem = 0;
continue;
}
} else {
h += l;
mem = 0;
continue;
}
/* Compare right half */
for (k=MAX(ms+1,mem); n[k] && n[k] == h[k]; k++);
if (n[k]) {
h += k-ms;
mem = 0;
continue;
}
/* Compare left half */
for (k=ms+1; k>mem && n[k-1] == h[k-1]; k--);
if (k <= mem) return (char *)h;
h += p;
mem = mem0;
}
}
char *strstr(const char *h, const char *n)
{
/* Return immediately on empty needle */
if (!n[0]) return (char *)h;
/* Use faster algorithms for short needles */
h = strchr(h, *n);
if (!h || !n[1]) return (char *)h;
if (!h[1]) return 0;
if (!n[2]) return twobyte_strstr((void *)h, (void *)n);
if (!h[2]) return 0;
if (!n[3]) return threebyte_strstr((void *)h, (void *)n);
if (!h[3]) return 0;
if (!n[4]) return fourbyte_strstr((void *)h, (void *)n);
return twoway_strstr((void *)h, (void *)n);
}
| {
"pile_set_name": "Github"
} |
// SPDX-License-Identifier: GPL-2.0
#include <stdio.h>
int main(void)
{
printf("Hello World!\n");
return 0;
}
| {
"pile_set_name": "Github"
} |
/*****************************************************************
* Copyright (c) 2011, 2015 Texas Instruments and others
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Winnie Lai (Texas Instruments) - Individual Element Number Format (Bug 202556)
*****************************************************************/
package org.eclipse.cdt.tests.dsf.vm;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IPersistableElement;
/**
* Test persistable for junit test cases. This is used along with element format
* test cases, and can be extended to support other persistable properties
* contained in PresentationContext, e.g. type cast/cast as array.
*/
class TestPersistable implements IPersistableElement, IAdaptable {
HashMap<String, String> map = new HashMap<>();
@Override
public void saveState(IMemento memento) {
HashMap<String, String> clone = null;
synchronized (map) {
clone = new HashMap<>(map);
}
Iterator<Entry<String, String>> it = clone.entrySet().iterator();
while (it.hasNext()) {
Entry<String, String> entry = it.next();
IMemento value = memento.createChild("variable", entry.getKey());
value.putString("format", entry.getValue());
}
}
void restore(IMemento memento) {
IMemento[] list = memento.getChildren("variable");
HashMap<String, String> clone = new HashMap<>();
for (int i = 0; i < list.length; i++) {
clone.put(list[i].getID(), list[i].getString("format"));
}
synchronized (map) {
map.clear();
map.putAll(clone);
}
}
String getFormat(String key) {
if (key == null)
return null;
synchronized (map) {
return map.get(key);
}
}
void setFormat(String key, String format) {
synchronized (map) {
if (format == null) {
map.remove(key);
} else {
map.put(key, format);
}
}
}
@Override
public String getFactoryId() {
return TestPersistableFactory.factoryId;
}
@Override
public Object getAdapter(Class adapter) {
if (adapter.isInstance(this)) {
return this;
}
return null;
}
}
| {
"pile_set_name": "Github"
} |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j F Y'
TIME_FORMAT = 'g:i:s A'
# DATETIME_FORMAT =
# YEAR_MONTH_FORMAT =
MONTH_DAY_FORMAT = 'j F'
SHORT_DATE_FORMAT = 'd-m-Y'
# SHORT_DATETIME_FORMAT =
# FIRST_DAY_OF_WEEK =
# The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
# DATE_INPUT_FORMATS =
# TIME_INPUT_FORMATS =
# DATETIME_INPUT_FORMATS =
DECIMAL_SEPARATOR = '.'
THOUSAND_SEPARATOR = ','
# NUMBER_GROUPING =
| {
"pile_set_name": "Github"
} |
#!/bin/bash
# git clone https://github.com/topdown/VVV-Dashboard.git dashboard ; dashboard/bin/_install.sh
echo "...copying dashboard into default/"
cp -v ./dashboard-custom.php ../dashboard-custom.php
echo "VVV Dashboard install complete"
| {
"pile_set_name": "Github"
} |
package org.hisp.dhis.dashboard;
/*
* Copyright (c) 2004-2020, University of Oslo
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Neither the name of the HISP project nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL 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.
*/
/**
* @author Lars Helge Overland
*/
public enum DashboardItemType
{
VISUALIZATION, CHART, EVENT_CHART, MAP, REPORT_TABLE,
EVENT_REPORT, USERS, REPORTS,
RESOURCES, TEXT, MESSAGES, APP
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8" ?>
<ldml>
<identity>
<version number="$Revision: 1.51 $"/>
<generation date="$Date: 2009/05/05 23:06:40 $"/>
<language type="so"/>
<territory type="DJ"/>
</identity>
</ldml>
| {
"pile_set_name": "Github"
} |
// cmMod.hpp (L)
#pragma once
#error "cmMod.hpp in incL must not be included"
| {
"pile_set_name": "Github"
} |
#!/bin/sh
# This script adds a Mac OS Launch Daemon, which runs every time the
# machine is booted. The daemon will re-detect the attached network
# interfaces. If this is not done, network devices may not work.
PLIST=/Library/LaunchDaemons/com.github.timsutton.osx-vm-templates.detectnewhardware.plist
cat <<EOF > "${PLIST}"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.github.timsutton.osx-vm-templates.detectnewhardware</string>
<key>ProgramArguments</key>
<array>
<string>/usr/sbin/networksetup</string>
<string>-detectnewhardware</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
EOF
# These should be already be set as follows, but since they're required
# in order to load properly, we set them explicitly.
/bin/chmod 644 "${PLIST}"
/usr/sbin/chown root:wheel "${PLIST}"
| {
"pile_set_name": "Github"
} |
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2013, 2014 Damien P. George
* Copyright (c) 2014 Paul Sokolovsky
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef MICROPY_INCLUDED_PY_BC_H
#define MICROPY_INCLUDED_PY_BC_H
#include "py/runtime.h"
#include "py/objfun.h"
// bytecode layout:
//
// func signature : var uint
// contains six values interleaved bit-wise as: xSSSSEAA [xFSSKAED repeated]
// x = extension another byte follows
// S = n_state - 1 number of entries in Python value stack
// E = n_exc_stack number of entries in exception stack
// F = scope_flags four bits of flags, MP_SCOPE_FLAG_xxx
// A = n_pos_args number of arguments this function takes
// K = n_kwonly_args number of keyword-only arguments this function takes
// D = n_def_pos_args number of default positional arguments
//
// prelude size : var uint
// contains two values interleaved bit-wise as: xIIIIIIC repeated
// x = extension another byte follows
// I = n_info number of bytes in source info section
// C = n_cells number of bytes/cells in closure section
//
// source info section:
// simple_name : var qstr
// source_file : var qstr
// <line number info>
//
// closure section:
// local_num0 : byte
// ... : byte
// local_numN : byte N = n_cells-1
//
// <word alignment padding> only needed if bytecode contains pointers
//
// <bytecode>
//
//
// constant table layout:
//
// argname0 : obj (qstr)
// ... : obj (qstr)
// argnameN : obj (qstr) N = num_pos_args + num_kwonly_args
// const0 : obj
// constN : obj
#define MP_BC_PRELUDE_SIG_ENCODE(S, E, scope, out_byte, out_env) \
do { \
/*// Get values to store in prelude */ \
size_t F = scope->scope_flags & MP_SCOPE_FLAG_ALL_SIG; \
size_t A = scope->num_pos_args; \
size_t K = scope->num_kwonly_args; \
size_t D = scope->num_def_pos_args; \
\
/* Adjust S to shrink range, to compress better */ \
S -= 1; \
\
/* Encode prelude */ \
/* xSSSSEAA */ \
uint8_t z = (S & 0xf) << 3 | (E & 1) << 2 | (A & 3); \
S >>= 4; \
E >>= 1; \
A >>= 2; \
while (S | E | F | A | K | D) { \
out_byte(out_env, 0x80 | z); \
/* xFSSKAED */ \
z = (F & 1) << 6 | (S & 3) << 4 | (K & 1) << 3 \
| (A & 1) << 2 | (E & 1) << 1 | (D & 1); \
S >>= 2; \
E >>= 1; \
F >>= 1; \
A >>= 1; \
K >>= 1; \
D >>= 1; \
} \
out_byte(out_env, z); \
} while (0)
#define MP_BC_PRELUDE_SIG_DECODE_INTO(ip, S, E, F, A, K, D) \
do { \
uint8_t z = *(ip)++; \
/* xSSSSEAA */ \
S = (z >> 3) & 0xf; \
E = (z >> 2) & 0x1; \
F = 0; \
A = z & 0x3; \
K = 0; \
D = 0; \
for (unsigned n = 0; z & 0x80; ++n) { \
z = *(ip)++; \
/* xFSSKAED */ \
S |= (z & 0x30) << (2 * n); \
E |= (z & 0x02) << n; \
F |= ((z & 0x40) >> 6) << n; \
A |= (z & 0x4) << n; \
K |= ((z & 0x08) >> 3) << n; \
D |= (z & 0x1) << n; \
} \
S += 1; \
} while (0)
#define MP_BC_PRELUDE_SIG_DECODE(ip) \
size_t n_state, n_exc_stack, scope_flags, n_pos_args, n_kwonly_args, n_def_pos_args; \
MP_BC_PRELUDE_SIG_DECODE_INTO(ip, n_state, n_exc_stack, scope_flags, n_pos_args, n_kwonly_args, n_def_pos_args)
#define MP_BC_PRELUDE_SIZE_ENCODE(I, C, out_byte, out_env) \
do { \
/* Encode bit-wise as: xIIIIIIC */ \
uint8_t z = 0; \
do { \
z = (I & 0x3f) << 1 | (C & 1); \
C >>= 1; \
I >>= 6; \
if (C | I) { \
z |= 0x80; \
} \
out_byte(out_env, z); \
} while (C | I); \
} while (0)
#define MP_BC_PRELUDE_SIZE_DECODE_INTO(ip, I, C) \
do { \
uint8_t z; \
C = 0; \
I = 0; \
for (unsigned n = 0;; ++n) { \
z = *(ip)++; \
/* xIIIIIIC */ \
C |= (z & 1) << n; \
I |= ((z & 0x7e) >> 1) << (6 * n); \
if (!(z & 0x80)) { \
break; \
} \
} \
} while (0)
#define MP_BC_PRELUDE_SIZE_DECODE(ip) \
size_t n_info, n_cell; \
MP_BC_PRELUDE_SIZE_DECODE_INTO(ip, n_info, n_cell)
// Sentinel value for mp_code_state_t.exc_sp_idx
#define MP_CODE_STATE_EXC_SP_IDX_SENTINEL ((uint16_t)-1)
// To convert mp_code_state_t.exc_sp_idx to/from a pointer to mp_exc_stack_t
#define MP_CODE_STATE_EXC_SP_IDX_FROM_PTR(exc_stack, exc_sp) ((exc_sp) + 1 - (exc_stack))
#define MP_CODE_STATE_EXC_SP_IDX_TO_PTR(exc_stack, exc_sp_idx) ((exc_stack) + (exc_sp_idx) - 1)
typedef struct _mp_bytecode_prelude_t {
uint n_state;
uint n_exc_stack;
uint scope_flags;
uint n_pos_args;
uint n_kwonly_args;
uint n_def_pos_args;
qstr qstr_block_name;
qstr qstr_source_file;
const byte *line_info;
const byte *opcodes;
} mp_bytecode_prelude_t;
// Exception stack entry
typedef struct _mp_exc_stack_t {
const byte *handler;
// bit 0 is currently unused
// bit 1 is whether the opcode was SETUP_WITH or SETUP_FINALLY
mp_obj_t *val_sp;
// Saved exception
mp_obj_base_t *prev_exc;
} mp_exc_stack_t;
typedef struct _mp_code_state_t {
// The fun_bc entry points to the underlying function object that is being executed.
// It is needed to access the start of bytecode and the const_table.
// It is also needed to prevent the GC from reclaiming the bytecode during execution,
// because the ip pointer below will always point to the interior of the bytecode.
mp_obj_fun_bc_t *fun_bc;
const byte *ip;
mp_obj_t *sp;
uint16_t n_state;
uint16_t exc_sp_idx;
mp_obj_dict_t *old_globals;
#if MICROPY_STACKLESS
struct _mp_code_state_t *prev;
#endif
#if MICROPY_PY_SYS_SETTRACE
struct _mp_code_state_t *prev_state;
struct _mp_obj_frame_t *frame;
#endif
// Variable-length
mp_obj_t state[0];
// Variable-length, never accessed by name, only as (void*)(state + n_state)
//mp_exc_stack_t exc_state[0];
} mp_code_state_t;
mp_uint_t mp_decode_uint(const byte **ptr);
mp_uint_t mp_decode_uint_value(const byte *ptr);
const byte *mp_decode_uint_skip(const byte *ptr);
mp_vm_return_kind_t mp_execute_bytecode(mp_code_state_t *code_state, volatile mp_obj_t inject_exc);
mp_code_state_t *mp_obj_fun_bc_prepare_codestate(mp_obj_t func, size_t n_args, size_t n_kw, const mp_obj_t *args);
void mp_setup_code_state(mp_code_state_t *code_state, size_t n_args, size_t n_kw, const mp_obj_t *args);
void mp_bytecode_print(const void *descr, const byte *code, mp_uint_t len, const mp_uint_t *const_table);
void mp_bytecode_print2(const byte *code, size_t len, const mp_uint_t *const_table);
const byte *mp_bytecode_print_str(const byte *ip);
#define mp_bytecode_print_inst(code, const_table) mp_bytecode_print2(code, 1, const_table)
// Helper macros to access pointer with least significant bits holding flags
#define MP_TAGPTR_PTR(x) ((void*)((uintptr_t)(x) & ~((uintptr_t)3)))
#define MP_TAGPTR_TAG0(x) ((uintptr_t)(x) & 1)
#define MP_TAGPTR_TAG1(x) ((uintptr_t)(x) & 2)
#define MP_TAGPTR_MAKE(ptr, tag) ((void*)((uintptr_t)(ptr) | (tag)))
#if MICROPY_PERSISTENT_CODE_LOAD || MICROPY_PERSISTENT_CODE_SAVE
uint mp_opcode_format(const byte *ip, size_t *opcode_size, bool count_var_uint);
#endif
static inline size_t mp_bytecode_get_source_line(const byte *line_info, size_t bc_offset) {
size_t source_line = 1;
size_t c;
while ((c = *line_info)) {
size_t b, l;
if ((c & 0x80) == 0) {
// 0b0LLBBBBB encoding
b = c & 0x1f;
l = c >> 5;
line_info += 1;
} else {
// 0b1LLLBBBB 0bLLLLLLLL encoding (l's LSB in second byte)
b = c & 0xf;
l = ((c << 4) & 0x700) | line_info[1];
line_info += 2;
}
if (bc_offset >= b) {
bc_offset -= b;
source_line += l;
} else {
// found source line corresponding to bytecode offset
break;
}
}
return source_line;
}
#endif // MICROPY_INCLUDED_PY_BC_H
| {
"pile_set_name": "Github"
} |
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/states/SFN_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/states/model/ActivityListItem.h>
#include <utility>
namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;
namespace Utils
{
namespace Json
{
class JsonValue;
} // namespace Json
} // namespace Utils
namespace SFN
{
namespace Model
{
class AWS_SFN_API ListActivitiesResult
{
public:
ListActivitiesResult();
ListActivitiesResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
ListActivitiesResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
/**
* <p>The list of activities.</p>
*/
inline const Aws::Vector<ActivityListItem>& GetActivities() const{ return m_activities; }
/**
* <p>The list of activities.</p>
*/
inline void SetActivities(const Aws::Vector<ActivityListItem>& value) { m_activities = value; }
/**
* <p>The list of activities.</p>
*/
inline void SetActivities(Aws::Vector<ActivityListItem>&& value) { m_activities = std::move(value); }
/**
* <p>The list of activities.</p>
*/
inline ListActivitiesResult& WithActivities(const Aws::Vector<ActivityListItem>& value) { SetActivities(value); return *this;}
/**
* <p>The list of activities.</p>
*/
inline ListActivitiesResult& WithActivities(Aws::Vector<ActivityListItem>&& value) { SetActivities(std::move(value)); return *this;}
/**
* <p>The list of activities.</p>
*/
inline ListActivitiesResult& AddActivities(const ActivityListItem& value) { m_activities.push_back(value); return *this; }
/**
* <p>The list of activities.</p>
*/
inline ListActivitiesResult& AddActivities(ActivityListItem&& value) { m_activities.push_back(std::move(value)); return *this; }
/**
* <p>If <code>nextToken</code> is returned, there are more results available. The
* value of <code>nextToken</code> is a unique pagination token for each page. Make
* the call again using the returned token to retrieve the next page. Keep all
* other arguments unchanged. Each pagination token expires after 24 hours. Using
* an expired pagination token will return an <i>HTTP 400 InvalidToken</i>
* error.</p>
*/
inline const Aws::String& GetNextToken() const{ return m_nextToken; }
/**
* <p>If <code>nextToken</code> is returned, there are more results available. The
* value of <code>nextToken</code> is a unique pagination token for each page. Make
* the call again using the returned token to retrieve the next page. Keep all
* other arguments unchanged. Each pagination token expires after 24 hours. Using
* an expired pagination token will return an <i>HTTP 400 InvalidToken</i>
* error.</p>
*/
inline void SetNextToken(const Aws::String& value) { m_nextToken = value; }
/**
* <p>If <code>nextToken</code> is returned, there are more results available. The
* value of <code>nextToken</code> is a unique pagination token for each page. Make
* the call again using the returned token to retrieve the next page. Keep all
* other arguments unchanged. Each pagination token expires after 24 hours. Using
* an expired pagination token will return an <i>HTTP 400 InvalidToken</i>
* error.</p>
*/
inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); }
/**
* <p>If <code>nextToken</code> is returned, there are more results available. The
* value of <code>nextToken</code> is a unique pagination token for each page. Make
* the call again using the returned token to retrieve the next page. Keep all
* other arguments unchanged. Each pagination token expires after 24 hours. Using
* an expired pagination token will return an <i>HTTP 400 InvalidToken</i>
* error.</p>
*/
inline void SetNextToken(const char* value) { m_nextToken.assign(value); }
/**
* <p>If <code>nextToken</code> is returned, there are more results available. The
* value of <code>nextToken</code> is a unique pagination token for each page. Make
* the call again using the returned token to retrieve the next page. Keep all
* other arguments unchanged. Each pagination token expires after 24 hours. Using
* an expired pagination token will return an <i>HTTP 400 InvalidToken</i>
* error.</p>
*/
inline ListActivitiesResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;}
/**
* <p>If <code>nextToken</code> is returned, there are more results available. The
* value of <code>nextToken</code> is a unique pagination token for each page. Make
* the call again using the returned token to retrieve the next page. Keep all
* other arguments unchanged. Each pagination token expires after 24 hours. Using
* an expired pagination token will return an <i>HTTP 400 InvalidToken</i>
* error.</p>
*/
inline ListActivitiesResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;}
/**
* <p>If <code>nextToken</code> is returned, there are more results available. The
* value of <code>nextToken</code> is a unique pagination token for each page. Make
* the call again using the returned token to retrieve the next page. Keep all
* other arguments unchanged. Each pagination token expires after 24 hours. Using
* an expired pagination token will return an <i>HTTP 400 InvalidToken</i>
* error.</p>
*/
inline ListActivitiesResult& WithNextToken(const char* value) { SetNextToken(value); return *this;}
private:
Aws::Vector<ActivityListItem> m_activities;
Aws::String m_nextToken;
};
} // namespace Model
} // namespace SFN
} // namespace Aws
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<padding android:top="1dp"
android:bottom="1dp"
android:right="1dp"
android:left="1dp"/>
<solid android:color="#12000000"/>
<corners
android:radius="2dp" />
</shape>
</item>
<item >
<shape android:shape="rectangle">
<solid android:color="#E6FF4444" />
<corners android:radius="2dp" />
</shape>
</item>
</layer-list> | {
"pile_set_name": "Github"
} |
// Copyright 2012-present Oliver Eilhard. All rights reserved.
// Use of this source code is governed by a MIT-license.
// See http://olivere.mit-license.org/license.txt for details.
package elastic
// CardinalityAggregation is a single-value metrics aggregation that
// calculates an approximate count of distinct values.
// Values can be extracted either from specific fields in the document
// or generated by a script.
// See: https://www.elastic.co/guide/en/elasticsearch/reference/6.2/search-aggregations-metrics-cardinality-aggregation.html
type CardinalityAggregation struct {
field string
script *Script
format string
missing interface{}
subAggregations map[string]Aggregation
meta map[string]interface{}
precisionThreshold *int64
rehash *bool
}
func NewCardinalityAggregation() *CardinalityAggregation {
return &CardinalityAggregation{
subAggregations: make(map[string]Aggregation),
}
}
func (a *CardinalityAggregation) Field(field string) *CardinalityAggregation {
a.field = field
return a
}
func (a *CardinalityAggregation) Script(script *Script) *CardinalityAggregation {
a.script = script
return a
}
func (a *CardinalityAggregation) Format(format string) *CardinalityAggregation {
a.format = format
return a
}
func (a *CardinalityAggregation) Missing(missing interface{}) *CardinalityAggregation {
a.missing = missing
return a
}
func (a *CardinalityAggregation) SubAggregation(name string, subAggregation Aggregation) *CardinalityAggregation {
a.subAggregations[name] = subAggregation
return a
}
// Meta sets the meta data to be included in the aggregation response.
func (a *CardinalityAggregation) Meta(metaData map[string]interface{}) *CardinalityAggregation {
a.meta = metaData
return a
}
func (a *CardinalityAggregation) PrecisionThreshold(threshold int64) *CardinalityAggregation {
a.precisionThreshold = &threshold
return a
}
func (a *CardinalityAggregation) Rehash(rehash bool) *CardinalityAggregation {
a.rehash = &rehash
return a
}
func (a *CardinalityAggregation) Source() (interface{}, error) {
// Example:
// {
// "aggs" : {
// "author_count" : {
// "cardinality" : { "field" : "author" }
// }
// }
// }
// This method returns only the "cardinality" : { "field" : "author" } part.
source := make(map[string]interface{})
opts := make(map[string]interface{})
source["cardinality"] = opts
// ValuesSourceAggregationBuilder
if a.field != "" {
opts["field"] = a.field
}
if a.script != nil {
src, err := a.script.Source()
if err != nil {
return nil, err
}
opts["script"] = src
}
if a.missing != nil {
opts["missing"] = a.missing
}
if a.format != "" {
opts["format"] = a.format
}
if a.precisionThreshold != nil {
opts["precision_threshold"] = *a.precisionThreshold
}
if a.rehash != nil {
opts["rehash"] = *a.rehash
}
// AggregationBuilder (SubAggregations)
if len(a.subAggregations) > 0 {
aggsMap := make(map[string]interface{})
source["aggregations"] = aggsMap
for name, aggregate := range a.subAggregations {
src, err := aggregate.Source()
if err != nil {
return nil, err
}
aggsMap[name] = src
}
}
// Add Meta data if available
if len(a.meta) > 0 {
source["meta"] = a.meta
}
return source, nil
}
| {
"pile_set_name": "Github"
} |
import sys
import pandas as pd
import numpy as np
from sklearn.preprocessing import Binarizer, MaxAbsScaler, MinMaxScaler
from sklearn.preprocessing import Normalizer, PolynomialFeatures, RobustScaler, StandardScaler
from sklearn.decomposition import FastICA, PCA
from sklearn.kernel_approximation import RBFSampler, Nystroem
from sklearn.cluster import FeatureAgglomeration
from sklearn.feature_selection import SelectFwe, SelectPercentile, VarianceThreshold
from sklearn.feature_selection import SelectFromModel, RFE
from sklearn.ensemble import ExtraTreesClassifier
from sklearn.naive_bayes import MultinomialNB
from evaluate_model import evaluate_model
dataset = sys.argv[1]
num_param_combinations = int(sys.argv[2])
random_seed = int(sys.argv[3])
preprocessor_num = int(sys.argv[4])
np.random.seed(random_seed)
preprocessor_list = [Binarizer, MaxAbsScaler, MinMaxScaler, Normalizer,
PolynomialFeatures, RobustScaler, StandardScaler,
FastICA, PCA, RBFSampler, Nystroem, FeatureAgglomeration,
SelectFwe, SelectPercentile, VarianceThreshold,
SelectFromModel, RFE]
chosen_preprocessor = preprocessor_list[preprocessor_num]
pipeline_components = [chosen_preprocessor, MultinomialNB]
pipeline_parameters = {}
alpha_values = np.random.uniform(low=0., high=10., size=num_param_combinations)
fit_prior_values = np.random.choice([True, False], size=num_param_combinations)
all_param_combinations = zip(alpha_values, fit_prior_values)
pipeline_parameters[MultinomialNB] = \
[{'alpha': alpha, 'fit_prior': fit_prior}
for (alpha, fit_prior) in all_param_combinations]
if chosen_preprocessor is SelectFromModel:
pipeline_parameters[SelectFromModel] = [{'estimator': ExtraTreesClassifier(n_estimators=100, random_state=324089)}]
elif chosen_preprocessor is RFE:
pipeline_parameters[RFE] = [{'estimator': ExtraTreesClassifier(n_estimators=100, random_state=324089)}]
evaluate_model(dataset, pipeline_components, pipeline_parameters)
| {
"pile_set_name": "Github"
} |
/*
* Copyright (C) the Wine project
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/*
* Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
* other than GPL or LGPL is available it will apply instead, Oracle elects to use only
* the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
* a choice of LGPL license versions is made available with the language indicating
* that LGPLv2 or any later version may be used, or where a choice of which version
* of the LGPL is applied is otherwise unspecified.
*/
#ifndef __WINE_WINDOWS_H
#define __WINE_WINDOWS_H
#if defined(_MSC_VER) && (_MSC_VER >= 800) && !defined(__cplusplus)
/* TYPE_ALIGNMENT generates this - move it outside the warning push/pop scope. */
# pragma warning(disable:4116)
#endif
#ifndef _INC_WINDOWS
#define _INC_WINDOWS
#if defined(RC_INVOKED) && !defined(NOWINRES)
#include <winresrc.h>
#else /* RC_INVOKED && !NOWINRES */
/* All the basic includes */
#include <excpt.h>
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <wingdi.h>
#include <winuser.h>
#include <winnls.h>
#include <wincon.h>
#include <winver.h>
#include <winreg.h>
#include <winnetwk.h>
/* Not so essential ones */
#ifndef __WINESRC__
#ifndef WIN32_LEAN_AND_MEAN
#include <cderr.h>
#include <dde.h>
#include <ddeml.h>
#include <dlgs.h>
#include <lzexpand.h>
#include <mmsystem.h>
#include <nb30.h>
#include <rpc.h>
#include <shellapi.h>
#include <winperf.h>
#ifndef WINE_NOWINSOCK
#include <winsock.h>
#endif /* WINE_NOWINSOCK */
#ifndef NOCRYPT
#include <wincrypt.h>
/* #include <winefs.h> */
#include <winscard.h>
#endif /* !NOCRYPT */
#ifndef NOGDI
#include <winspool.h>
#ifdef INC_OLE1
/* #include <ole.h> */
#else
#include <ole2.h>
#endif
#include <commdlg.h>
#endif /* !NOGDI */
#endif /* !WIN32_LEAN_AND_MEAN */
/* #include <stralign.h> */
#ifdef INC_OLE2
#include <ole2.h>
#endif /* INC_OLE2 */
#ifndef NOSERVICE
#include <winsvc.h>
#endif /* !NOSERVICE */
#ifndef NOMCX
#include <mcx.h>
#endif /* !NOMCX */
#ifndef NOIMM
#include <imm.h>
#endif /* !NOIMM */
#endif /* __WINESRC__ */
#endif /* RC_INVOKED && !NOWINRES */
#endif /* _INC_WINDOWS */
#endif /* __WINE_WINDOWS_H */
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{BE590159-A052-49A9-94EF-4568E88B78E6}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>EventDoubleClick</RootNamespace>
<AssemblyName>EventDoubleClick</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject>EventDoubleClick.App</StartupObject>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="Telerik.Windows.Controls">
<HintPath>$(TELERIKWPFDIR)\Binaries.NoXaml\WPF40\Telerik.Windows.Controls.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Controls.GanttView">
<HintPath>$(TELERIKWPFDIR)\Binaries.NoXaml\WPF40\Telerik.Windows.Controls.GanttView.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Scheduling.Core">
<HintPath>$(TELERIKWPFDIR)\Binaries.NoXaml\WPF40\Telerik.Windows.Scheduling.Core.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Themes.Office_Black">
<HintPath>$(TELERIKWPFDIR)\Binaries.NoXaml\WPF40\Telerik.Windows.Themes.Office_Black.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Example.xaml.cs">
<DependentUpon>Example.xaml</DependentUpon>
</Compile>
<Compile Include="GanttDoubleClickExtension.cs" />
<Compile Include="ViewModel.cs" />
<Page Include="Example.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<Resource Include="Readme.md" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project> | {
"pile_set_name": "Github"
} |
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2007 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source,
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
// SPDX - License - Identifier: GPL - 3.0 +
#pragma once
#include "MantidKernel/SingletonHolder.h"
#include <memory>
#include <QList>
#include <QMap>
#include <QString>
namespace Mantid {
namespace API {
class IAlgorithm;
using IAlgorithm_sptr = std::shared_ptr<IAlgorithm>;
} // namespace API
} // namespace Mantid
struct PropertyData {
PropertyData(const QString &nm, const QString &vl) : name(nm), value(vl) {}
QString name;
QString value;
};
/** @class InputHistory
Keeps history of Mantid-related user input, such as algorithm parameters, etc.
@author Roman Tolchenov, Tessella Support Services plc
@date 15/10/2008
*/
class InputHistoryImpl {
public:
InputHistoryImpl(const InputHistoryImpl &) = delete;
InputHistoryImpl &operator=(const InputHistoryImpl &) = delete;
void updateAlgorithm(const Mantid::API::IAlgorithm_sptr &alg);
/// The name:value map of non-default properties with which algorithm algName
/// was called last time.
QMap<QString, QString> algorithmProperties(const QString &algName);
/// Returns the value of property propNameif it has been recorded for
/// algorithm algName.
QString algorithmProperty(const QString &algName, const QString &propName);
/// Replaces the value of a recorded property.
void updateAlgorithmProperty(const QString &algName, const QString &propName,
const QString &propValue);
/// Saves the properties.
void save();
/// Returns the directory name from a full file path.
static QString getDirectoryFromFilePath(const QString &filePath);
/// Returns the short file name (without extension) from a full file path.
static QString getNameOnlyFromFilePath(const QString &filePath);
private:
friend struct Mantid::Kernel::CreateUsingNew<InputHistoryImpl>;
/// Private Constructor
InputHistoryImpl();
/// Private Destructor
virtual ~InputHistoryImpl() = default;
/// For debugging
// cppcheck-suppress unusedPrivateFunction
void printAll();
/// Keeps algorithm parameters.
QMap<QString, QList<PropertyData>> m_history;
};
using InputHistory = Mantid::Kernel::SingletonHolder<InputHistoryImpl>;
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- NOTE: single shape with color selector fails on lower Androids -->
<item android:state_focused="true">
<shape>
<corners android:radius="?corners_medium"/>
<solid android:color="?attr/colorBgLight"/>
</shape>
</item>
<item>
<shape>
<corners android:radius="?corners_medium"/>
<solid android:color="?attr/colorBgPrimaryAlpha"/>
</shape>
</item>
</selector>
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2011-2012 Amazon Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://aws.amazon.com/apache2.0
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
* OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and
* limitations under the License.
*/
package com.amazonaws.eclipse.datatools.enablement.simpledb.ui.editor;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IPersistableElement;
import com.amazonaws.eclipse.core.AwsToolkitCore;
/**
* Editor input for the custom query editor
*/
public class DomainEditorInput implements IEditorInput {
private final String domainName;
private final String accountId;
String getAccountId() {
return this.accountId;
}
String getDomainName() {
return this.domainName;
}
public DomainEditorInput(final String domainName, final String accountId) {
super();
this.domainName = domainName;
this.accountId = accountId;
}
@Override
@SuppressWarnings("rawtypes")
public Object getAdapter(final Class adapter) {
return null;
}
@Override
public boolean exists() {
return true;
}
@Override
public ImageDescriptor getImageDescriptor() {
return AwsToolkitCore.getDefault().getImageRegistry().getDescriptor(AwsToolkitCore.IMAGE_TABLE);
}
@Override
public String getName() {
return this.domainName;
}
@Override
public IPersistableElement getPersistable() {
return null;
}
@Override
public String getToolTipText() {
return "Amazon SimpleDB Query Editor - " + this.domainName;
}
}
| {
"pile_set_name": "Github"
} |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build !gccgo
#include "textflag.h"
//
// System call support for AMD64, FreeBSD
//
// Just jump to package syscall's implementation for all these functions.
// The runtime may know about them.
TEXT ·Syscall(SB),NOSPLIT,$0-56
JMP syscall·Syscall(SB)
TEXT ·Syscall6(SB),NOSPLIT,$0-80
JMP syscall·Syscall6(SB)
TEXT ·Syscall9(SB),NOSPLIT,$0-104
JMP syscall·Syscall9(SB)
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
JMP syscall·RawSyscall(SB)
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
JMP syscall·RawSyscall6(SB)
| {
"pile_set_name": "Github"
} |
From 63563ee0e65c1d2ae9aa0ae5530035605fed0f1c Mon Sep 17 00:00:00 2001
From: Mart Raudsepp <[email protected]>
Date: Sun, 1 Sep 2019 20:34:44 +0300
Subject: [PATCH] Revert "schemas: change default monospaced and document
fonts"
This reverts commit 965062de47f5171727c1e4f7f0aac2ad40e3484a.
It is not GNOME business to override distribution choices for default
monospace and document font.
---
schemas/org.gnome.desktop.interface.gschema.xml.in | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/schemas/org.gnome.desktop.interface.gschema.xml.in b/schemas/org.gnome.desktop.interface.gschema.xml.in
index 22ef50d..1713f25 100644
--- a/schemas/org.gnome.desktop.interface.gschema.xml.in
+++ b/schemas/org.gnome.desktop.interface.gschema.xml.in
@@ -149,14 +149,14 @@
</description>
</key>
<key name="document-font-name" type="s">
- <default>'Cantarell 11'</default>
+ <default>'Sans 11'</default>
<summary>Document font</summary>
<description>
Name of the default font used for reading documents.
</description>
</key>
<key name="monospace-font-name" type="s">
- <default>'Source Code Pro 10'</default>
+ <default>'Monospace 11'</default>
<summary>Monospace font</summary>
<description>
Name of a monospaced (fixed-width) font for use in locations like
--
2.20.1
| {
"pile_set_name": "Github"
} |
using System.Collections.Generic;
using Amazon.CDK;
using Amazon.CDK.AWS.APIGatewayv2;
using Amazon.CDK.AWS.DynamoDB;
using Amazon.CDK.AWS.Lambda;
namespace TheSimpleWebservice
{
public class TheSimpleWebserviceStack : Stack
{
internal TheSimpleWebserviceStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
{
//DynamoDB Table
var table = new Table(this, "Hits", new TableProps
{
PartitionKey = new Attribute
{
Name = "path",
Type = AttributeType.STRING
}
});
// defines an AWS Lambda resource
var dynamoLambda = new Function(this, "DynamoLambdaHandler", new FunctionProps
{
Runtime = Runtime.NODEJS_12_X, // execution environment
Code = Code.FromAsset("lambda-fns"), //code loaded from the "lambda" directory
Handler = "lambda.handler", //code loaded from the "lambda" directory
Environment = new Dictionary<string, string>
{
{ "HITS_TABLE_NAME", table.TableName }
}
});
// grant the lambda role read/write permissions to our table
table.GrantReadWriteData(dynamoLambda);
// defines an API Gateway Http API resource backed by our "dynamoLambda" function.
var api = new HttpApi(this, "Endpoint", new HttpApiProps
{
DefaultIntegration = new LambdaProxyIntegration(new LambdaProxyIntegrationProps
{
Handler = dynamoLambda
})
});
new CfnOutput(this, "HTTP API Url", new CfnOutputProps
{
Value = api.Url ?? "Something went wrong with the deploy"
});
}
}
}
| {
"pile_set_name": "Github"
} |
-- Dragonbone Condor
UPDATE `creature` SET `spawndist`=0, `MovementType`=0 WHERE `guid` IN (106595,106596,106597,106598,106603,106604,106605,106607,106608,106626,106629,106631,106643,106646,106658,106663,106665,106668,106669,106675,106676,106679,106680,106681,106682,106683,106684,106685,106686,106687,106688,106692,106693,106696,106702,106703,106706,106722,106723,106724,106726,106727,106728,106733,106737,106741,106749,106755,106757,131072);
UPDATE `creature` SET `position_z`=72.130 WHERE `guid`=106631;
UPDATE `creature` SET `position_z`=72.902 WHERE `guid`=106675;
UPDATE `creature` SET `position_z`=69.505 WHERE `guid`=131072;
/* Carrion Condor
* All these have unitfieldbyte1=1 which means sitting. Obviously that makes no sense when they are moving randomly within their spawndist. They should be sitting on the pillars in Borean Tundra.
* There are some that are spawned very close to dead Taunka. From retail I know they should be flying directly on top of them not moving so I changed them, too. */
UPDATE `creature` SET `spawndist`=0, `MovementType`=0 WHERE `guid` IN (101804,101805,101806,101807,101808,101809,101810,101814,101815,101818,101819,101820,101823,101824,101825,101832,101834,101836,101837,101838,101839,101842,101845,101849,101850,101856,101859,101860,101862,101866,101872,101876,101877,101890,101921,101923);
-- Courier Lanson: The npc should be sleeping on the bed instead of just standing there.
DELETE FROM `creature_template_addon` WHERE `entry`=27060;
INSERT INTO `creature_template_addon` (`entry`,`path_id`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES
(27060,0,0,3,0,0,'');
| {
"pile_set_name": "Github"
} |
require 'p4'
p4 = P4.P4()
p4.user = "MyUser"
p4.password = "MyOldPassword"
p4:connect()
p4:run_password("MyOldPassword", "MyNewPassword")
-- p4.password is automatically updated with the encoded password
| {
"pile_set_name": "Github"
} |
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert
#ifndef MAME_FORMATS_IPF_DSK_H
#define MAME_FORMATS_IPF_DSK_H
#pragma once
#include "flopimg.h"
#include <vector>
class ipf_format : public floppy_image_format_t
{
public:
ipf_format();
virtual int identify(io_generic *io, uint32_t form_factor) override;
virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
virtual const char *name() const override;
virtual const char *description() const override;
virtual const char *extensions() const override;
virtual bool supports_save() const override;
private:
struct track_info {
uint32_t cylinder, head, type;
uint32_t sigtype, process, reserved[3];
uint32_t size_bytes, size_cells;
uint32_t index_bytes, index_cells;
uint32_t datasize_cells, gapsize_cells;
uint32_t block_count, weak_bits;
uint32_t data_size_bits;
bool info_set;
const uint8_t *data;
uint32_t data_size;
};
track_info *tinfos;
uint32_t tcount;
uint32_t type, release, revision;
uint32_t encoder_type, encoder_revision, origin;
uint32_t min_cylinder, max_cylinder, min_head, max_head;
uint32_t credit_day, credit_time;
uint32_t platform[4], extra[5];
uint32_t crc32r(const uint8_t *data, uint32_t size);
bool parse_info(const uint8_t *info);
bool parse_imge(const uint8_t *imge);
bool parse_data(const uint8_t *data, uint32_t &pos, uint32_t max_extra_size);
bool scan_one_tag(std::vector<uint8_t> &data, uint32_t &pos, uint8_t *&tag, uint32_t &tsize);
bool scan_all_tags(std::vector<uint8_t> &data);
static uint32_t r32(const uint8_t *p);
static uint32_t rb(const uint8_t *&p, int count);
track_info *get_index(uint32_t idx);
void track_write_raw(std::vector<uint32_t>::iterator &tpos, const uint8_t *data, uint32_t cells, bool &context);
void track_write_mfm(std::vector<uint32_t>::iterator &tpos, const uint8_t *data, uint32_t start_offset, uint32_t patlen, uint32_t cells, bool &context);
void track_write_weak(std::vector<uint32_t>::iterator &tpos, uint32_t cells);
bool generate_block_data(const uint8_t *data, const uint8_t *dlimit, std::vector<uint32_t>::iterator tpos, std::vector<uint32_t>::iterator tlimit, bool &context);
bool gap_description_to_reserved_size(const uint8_t *&data, const uint8_t *dlimit, uint32_t &res_size);
bool generate_gap_from_description(const uint8_t *&data, const uint8_t *dlimit, std::vector<uint32_t>::iterator tpos, uint32_t size, bool pre, bool &context);
bool generate_block_gap_0(uint32_t gap_cells, uint8_t pattern, uint32_t &spos, uint32_t ipos, std::vector<uint32_t>::iterator &tpos, bool &context);
bool generate_block_gap_1(uint32_t gap_cells, uint32_t &spos, uint32_t ipos, const uint8_t *data, const uint8_t *dlimit, std::vector<uint32_t>::iterator &tpos, bool &context);
bool generate_block_gap_2(uint32_t gap_cells, uint32_t &spos, uint32_t ipos, const uint8_t *data, const uint8_t *dlimit, std::vector<uint32_t>::iterator &tpos, bool &context);
bool generate_block_gap_3(uint32_t gap_cells, uint32_t &spos, uint32_t ipos, const uint8_t *data, const uint8_t *dlimit, std::vector<uint32_t>::iterator &tpos, bool &context);
bool generate_block_gap(uint32_t gap_type, uint32_t gap_cells, uint8_t pattern, uint32_t &spos, uint32_t ipos, const uint8_t *data, const uint8_t *dlimit, std::vector<uint32_t>::iterator tpos, bool &context);
bool generate_block(track_info *t, uint32_t idx, uint32_t ipos, std::vector<uint32_t> &track, uint32_t &pos, uint32_t &dpos, uint32_t &gpos, uint32_t &spos, bool &context);
uint32_t block_compute_real_size(track_info *t);
void timing_set(std::vector<uint32_t> &track, uint32_t start, uint32_t end, uint32_t time);
bool generate_timings(track_info *t, std::vector<uint32_t> &track, const std::vector<uint32_t> &data_pos, const std::vector<uint32_t> &gap_pos);
void rotate(std::vector<uint32_t> &track, uint32_t offset, uint32_t size);
void mark_track_splice(std::vector<uint32_t> &track, uint32_t offset, uint32_t size);
bool generate_track(track_info *t, floppy_image *image);
bool generate_tracks(floppy_image *image);
bool parse(std::vector<uint8_t> &data, floppy_image *image);
};
extern const floppy_format_type FLOPPY_IPF_FORMAT;
#endif // MAME_FORMATS_IPF_DSK_H
| {
"pile_set_name": "Github"
} |
(function (factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery'], factory);
} else if (typeof module === 'object' && typeof module.exports === 'object') {
factory(require('jquery'));
} else {
factory(jQuery);
}
}(function (jQuery) {
// Galician
jQuery.timeago.settings.strings["gl"] = {
prefixAgo: "hai",
prefixFromNow: "dentro de",
suffixAgo: "",
suffixFromNow: "",
seconds: "menos dun minuto",
minute: "un minuto",
minutes: "uns %d minutos",
hour: "unha hora",
hours: "%d horas",
day: "un día",
days: "%d días",
month: "un mes",
months: "%d meses",
year: "un ano",
years: "%d anos"
};
}));
| {
"pile_set_name": "Github"
} |
// Copyright 2012-present Oliver Eilhard. All rights reserved.
// Use of this source code is governed by a MIT-license.
// See http://olivere.mit-license.org/license.txt for details.
package elastic
import (
"context"
"fmt"
"net/url"
"gopkg.in/olivere/elastic.v5/uritemplates"
)
// IndexService adds or updates a typed JSON document in a specified index,
// making it searchable.
//
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/docs-index_.html
// for details.
type IndexService struct {
client *Client
pretty bool
id string
index string
typ string
parent string
routing string
timeout string
timestamp string
ttl string
version interface{}
opType string
versionType string
refresh string
waitForActiveShards string
pipeline string
bodyJson interface{}
bodyString string
}
// NewIndexService creates a new IndexService.
func NewIndexService(client *Client) *IndexService {
return &IndexService{
client: client,
}
}
// Id is the document ID.
func (s *IndexService) Id(id string) *IndexService {
s.id = id
return s
}
// Index is the name of the index.
func (s *IndexService) Index(index string) *IndexService {
s.index = index
return s
}
// Type is the type of the document.
func (s *IndexService) Type(typ string) *IndexService {
s.typ = typ
return s
}
// WaitForActiveShards sets the number of shard copies that must be active
// before proceeding with the index operation. Defaults to 1, meaning the
// primary shard only. Set to `all` for all shard copies, otherwise set to
// any non-negative value less than or equal to the total number of copies
// for the shard (number of replicas + 1).
func (s *IndexService) WaitForActiveShards(waitForActiveShards string) *IndexService {
s.waitForActiveShards = waitForActiveShards
return s
}
// Pipeline specifies the pipeline id to preprocess incoming documents with.
func (s *IndexService) Pipeline(pipeline string) *IndexService {
s.pipeline = pipeline
return s
}
// Refresh the index after performing the operation.
func (s *IndexService) Refresh(refresh string) *IndexService {
s.refresh = refresh
return s
}
// Ttl is an expiration time for the document.
func (s *IndexService) Ttl(ttl string) *IndexService {
s.ttl = ttl
return s
}
// TTL is an expiration time for the document (alias for Ttl).
func (s *IndexService) TTL(ttl string) *IndexService {
s.ttl = ttl
return s
}
// Version is an explicit version number for concurrency control.
func (s *IndexService) Version(version interface{}) *IndexService {
s.version = version
return s
}
// OpType is an explicit operation type, i.e. "create" or "index" (default).
func (s *IndexService) OpType(opType string) *IndexService {
s.opType = opType
return s
}
// Parent is the ID of the parent document.
func (s *IndexService) Parent(parent string) *IndexService {
s.parent = parent
return s
}
// Routing is a specific routing value.
func (s *IndexService) Routing(routing string) *IndexService {
s.routing = routing
return s
}
// Timeout is an explicit operation timeout.
func (s *IndexService) Timeout(timeout string) *IndexService {
s.timeout = timeout
return s
}
// Timestamp is an explicit timestamp for the document.
func (s *IndexService) Timestamp(timestamp string) *IndexService {
s.timestamp = timestamp
return s
}
// VersionType is a specific version type.
func (s *IndexService) VersionType(versionType string) *IndexService {
s.versionType = versionType
return s
}
// Pretty indicates that the JSON response be indented and human readable.
func (s *IndexService) Pretty(pretty bool) *IndexService {
s.pretty = pretty
return s
}
// BodyJson is the document as a serializable JSON interface.
func (s *IndexService) BodyJson(body interface{}) *IndexService {
s.bodyJson = body
return s
}
// BodyString is the document encoded as a string.
func (s *IndexService) BodyString(body string) *IndexService {
s.bodyString = body
return s
}
// buildURL builds the URL for the operation.
func (s *IndexService) buildURL() (string, string, url.Values, error) {
var err error
var method, path string
if s.id != "" {
// Create document with manual id
method = "PUT"
path, err = uritemplates.Expand("/{index}/{type}/{id}", map[string]string{
"id": s.id,
"index": s.index,
"type": s.typ,
})
} else {
// Automatic ID generation
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/docs-index_.html#index-creation
method = "POST"
path, err = uritemplates.Expand("/{index}/{type}/", map[string]string{
"index": s.index,
"type": s.typ,
})
}
if err != nil {
return "", "", url.Values{}, err
}
// Add query string parameters
params := url.Values{}
if s.pretty {
params.Set("pretty", "1")
}
if s.waitForActiveShards != "" {
params.Set("wait_for_active_shards", s.waitForActiveShards)
}
if s.refresh != "" {
params.Set("refresh", s.refresh)
}
if s.opType != "" {
params.Set("op_type", s.opType)
}
if s.parent != "" {
params.Set("parent", s.parent)
}
if s.pipeline != "" {
params.Set("pipeline", s.pipeline)
}
if s.routing != "" {
params.Set("routing", s.routing)
}
if s.timeout != "" {
params.Set("timeout", s.timeout)
}
if s.timestamp != "" {
params.Set("timestamp", s.timestamp)
}
if s.ttl != "" {
params.Set("ttl", s.ttl)
}
if s.version != nil {
params.Set("version", fmt.Sprintf("%v", s.version))
}
if s.versionType != "" {
params.Set("version_type", s.versionType)
}
return method, path, params, nil
}
// Validate checks if the operation is valid.
func (s *IndexService) Validate() error {
var invalid []string
if s.index == "" {
invalid = append(invalid, "Index")
}
if s.typ == "" {
invalid = append(invalid, "Type")
}
if s.bodyString == "" && s.bodyJson == nil {
invalid = append(invalid, "BodyJson")
}
if len(invalid) > 0 {
return fmt.Errorf("missing required fields: %v", invalid)
}
return nil
}
// Do executes the operation.
func (s *IndexService) Do(ctx context.Context) (*IndexResponse, error) {
// Check pre-conditions
if err := s.Validate(); err != nil {
return nil, err
}
// Get URL for request
method, path, params, err := s.buildURL()
if err != nil {
return nil, err
}
// Setup HTTP request body
var body interface{}
if s.bodyJson != nil {
body = s.bodyJson
} else {
body = s.bodyString
}
// Get HTTP response
res, err := s.client.PerformRequest(ctx, method, path, params, body)
if err != nil {
return nil, err
}
// Return operation response
ret := new(IndexResponse)
if err := s.client.decoder.Decode(res.Body, ret); err != nil {
return nil, err
}
return ret, nil
}
// IndexResponse is the result of indexing a document in Elasticsearch.
type IndexResponse struct {
// TODO _shards { total, failed, successful }
Index string `json:"_index"`
Type string `json:"_type"`
Id string `json:"_id"`
Version int `json:"_version"`
Created bool `json:"created"`
}
| {
"pile_set_name": "Github"
} |
var ApiInterface = require('../../src/proxy/apiInterface');
var Consumer = require('../../src/consumer');
describe("proxy/APIInterface", function() {
var emit, reg, api;
beforeEach(function() {
var iface = {
'test': {'type': 'method', 'value': ['string'], 'ret': 'string'},
'ev': {'type': 'event', 'value': 'string'},
'co': {'type': 'constant', 'value': '12'}
};
emit = jasmine.createSpy('emit');
var onMsg = function(obj, r) {
reg = r;
};
api = new ApiInterface(iface, onMsg, emit);
});
it("Creates an object looking like an interface.", function(done) {
expect(typeof(api.test)).toEqual('function');
expect(typeof(api.on)).toEqual('function');
expect(api.co).toEqual('12');
expect(emit).toHaveBeenCalledWith({
'type': 'construct',
'text': [],
'binary': []
});
var promise = api.test('hi');
expect(emit).toHaveBeenCalledWith({
action: 'method',
type: 'test',
reqId: 0,
text: ['hi'],
binary: []
});
var spy = jasmine.createSpy('ret');
promise.then(function(response) {
spy();
expect(response).toEqual('boo!');;
done();
});
expect(spy).not.toHaveBeenCalled();
reg('message', {
type: 'method',
reqId: 0,
text: 'boo!',
binary: []
});
});
it("Allows reckless calls.", function() {
expect(typeof(api.test.reckless)).toEqual('function');
var voidReturn = api.test.reckless('hi');
expect(voidReturn).toBe(undefined);
expect(emit).toHaveBeenCalledWith({
action: 'method',
type: 'test',
reqId: null,
text: ['hi'],
binary: []
});
});
it("Delivers constructor arguments.", function(done) {
var iface = {
'constructor': {value: ['string']}
};
var onMsg = function(obj, r) {
reg = r;
};
var callback = function(msg) {
expect(msg).toEqual({
'type': 'construct',
'text': ['my param'],
'binary': []
});
done();
};
var debug = {};
var apimaker = ApiInterface.bind({}, iface, onMsg, callback, debug);
var api = new apimaker('my param');
});
it("Doesn't encapuslate constructor args as an array.", function(done) {
var iface = {
'constructor': {value: ['object']}
};
var onMsg = function(obj, r) {
reg = r;
};
var callback = function(msg) {
expect(msg).toEqual({
'type': 'construct',
'text': [{'test':'hi'}],
'binary': []
});
done();
};
var debug = {};
var apimaker = ApiInterface.bind({}, iface, onMsg, callback, debug);
var api = new apimaker({'test':'hi'});
});
it("Rejects methods on failure.", function(done) {
var promise = api.test('hi'),
spy = jasmine.createSpy('fail');
promise.catch(function (err) {
expect(err).toEqual('Error Occured');
done();
});
reg('message', {
type: 'method',
reqId: 0,
text: 'errval',
error: 'Error Occured'
});
});
it("delivers events", function() {
var cb = jasmine.createSpy('cb');
api.on('ev', cb);
expect(cb).not.toHaveBeenCalled();
reg('message', {
'type': 'event',
'name': 'ev',
'text': 'boo!',
'binary': []
});
expect(cb).toHaveBeenCalledWith('boo!');
});
});
afterEach(function() {
var frames = document.getElementsByTagName('iframe');
for (var i = 0; i < frames.length; i++) {
frames[i].parentNode.removeChild(frames[i]);
}
});
describe("Consumer.recursiveFreezeObject", function() {
it("Freezes objects", function () {
var obj = {
a: 1,
b: {
c: 2
}
};
var frozen = Consumer.recursiveFreezeObject(obj);
frozen.a = 5;
frozen.b = 5;
frozen.c = 5;
expect(frozen.a).toEqual(1);
expect(frozen.b.c).toEqual(2);
});
});
describe("Consumer.conform", function() {
var debug = {
error: function() {}
};
it("Conforms Simple values to templates", function() {
var blob = new Blob(['hi']);
var template = {
'p1': 'string',
'p2': 'number',
'p3': 'boolean',
'p4': 'object',
'p5': 'blob',
'p6': 'buffer',
'p8': 'proxy',
'p9': ['array', 'string'],
'p10': ['string', 'number'],
'p11': {'a': 'string', 'b': 'number'}
};
var correct = {
'p1': 'hi',
'p2': 12,
'p3': true,
'p4': {'x': 12, 'y': 43},
'p5': 0,
'p6': 1,
'p8': ['app', 'flow', 'id'],
'p9': ['string', 'string2', 'string3'],
'p10': ['test', 12],
'p11': {'a': 'hi', 'b': 12}
};
var conformed = Consumer.conform(template, correct,
[blob, new ArrayBuffer(2)], false);
correct['p5'] = conformed['p5'];
correct['p6'] = conformed['p6'];
expect(conformed).toEqual(correct);
var incorrect = {
'p0': 'test',
'p1': 12,
'p2': '12',
'p3': 'hello',
'p4': [1,2,3],
'p6': 'str',
'p8': function() {},
'p9': [1, {}],
'p10': [true, false, true],
'p11': []
};
conformed = Consumer.conform(template, incorrect, [0, blob, blob], false);
expect(conformed).toEqual({
'p1': '12',
'p2': 12,
'p3': false,
'p4': [1,2,3],
'p6': conformed.p6,
'p8': conformed.p8,
'p9': ['1', '[object Object]'],
'p10': ['true', 0],
'p11': {}
});
});
it("conforms simple arguments", function() {
expect(Consumer.conform("string", "mystring", [], false, debug)).toEqual("mystring");
expect(Consumer.conform("number", "mystring", [], false, debug)).toEqual(jasmine.any(Number));
expect(Consumer.conform("boolean", "mystring", [], false, debug)).toEqual(false);
expect(Consumer.conform("", "mystring", [], false, debug)).toEqual(undefined);
expect(Consumer.conform(["string", "number"], ["test", 0], [], false, debug))
.toEqual(["test", 0]);
expect(Consumer.conform("number", 0, [], false, debug)).toEqual(0);
});
it("conforms complex arguments", function() {
expect(Consumer.conform({"key":"string"}, {"key":"good", "other":"bad"},[], false)).
toEqual({"key":"good"});
expect(Consumer.conform(["string"], ["test", 12],[], false)).toEqual(["test"]);
expect(Consumer.conform(["array", "string"], ["test", 12],[], false)).toEqual(["test", "12"]);
expect(Consumer.conform("object", {"simple":"string"},[], false)).toEqual({"simple": "string"});
//expect(fdom.proxy.conform.bind({}, "object", function() {},[], false)).toThrow();
expect(Consumer.conform("object", function() {},[], false, debug)).not.toBeDefined();
});
it("conforms nulls", function() {
expect(Consumer.conform({"key": "string"}, {"key": null}, [], false)).
toEqual({"key": null});
expect(Consumer.conform("object", null, [], false)).toEqual(null);
expect(Consumer.conform({"key": "string"}, {"key": undefined}, [], false)).
toEqual({});
expect(Consumer.conform(["string", "string", "string", "string"],
[null, undefined, null, 0], [], false)).
toEqual([null, undefined, null, "0"]);
expect(Consumer.conform("object", undefined, [], false)).toEqual(undefined);
});
it("conforms binary arguments", function() {
// TODO: test Blob support (API is nonstandard between Node and Browsers)
/*
* var blob = new Blob(["test"]);
* expect(conform("blob", blob)).toEqual(blob);
* expect(conform("blob", "string")).toEqual(jasmine.any(Blob));
*/
var buffer = new ArrayBuffer(4);
var externals = [];
expect(Consumer.conform("buffer", buffer, externals, true, debug)).toEqual(0);
expect(externals.length).toEqual(1);
expect(Consumer.conform("buffer", 0, ["string"], false, debug)).toEqual(jasmine.any(ArrayBuffer));
expect(Consumer.conform("buffer", 0, externals, false, debug)).toEqual(buffer);
});
});
| {
"pile_set_name": "Github"
} |
#!/bin/bash
#set -x # DEBUG
# launch the unit tests suite.
# run this script like this: ./Scripts/test.sh [build_dir]
# if no build_dir is specified, ./build is assumed to be the default
# build directory
build_dir="build"
if [ "$#" -eq 1 ]; then
build_dir=$1
fi
RDBASE=$PWD
PYTHONPATH=$RDBASE
LD_LIBRARY_PATH=$RDBASE/lib:$LD_LIBRARY_PATH
# run tests in parallel
nprocs=`getconf _NPROCESSORS_ONLN`
cd $build_dir && ctest --output-on-failure -j ${nprocs}
| {
"pile_set_name": "Github"
} |
/**
* Copyright (c) 2015 SUSE LLC
*
* This software is licensed to you under the GNU General Public License,
* version 2 (GPLv2). There is NO WARRANTY for this software, express or
* implied, including the implied warranties of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
* along with this software; if not, see
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
*
* Red Hat trademarks are not licensed under GPLv2. No permission is
* granted to use or replicate Red Hat trademarks that are incorporated
* in this software or its documentation.
*/
package com.redhat.rhn.domain.state;
import java.util.Arrays;
import java.util.Optional;
/**
* Available package states, matches the content of DB table "susePackageStateType".
*/
public enum PackageStates {
INSTALLED(0), REMOVED(1), PURGED(2);
/** This ID corresponds to the id column in the database */
private final int ID;
PackageStates(int id) {
ID = id;
}
/**
* Return the id.
*
* @return the id
*/
public int id() {
return ID;
}
/**
* Get enum value for a given ID.
*
* @param id the ID
* @return enum value or empty if the given id is invalid
*/
public static Optional<PackageStates> byId(int id) {
return Arrays.asList(PackageStates.values()).stream()
.filter(state -> state.ID == id).findFirst();
}
/**
* Indicate for a given state if a version constraint is required.
*
* @param packageState the package state
* @return true if a version constraint is required, otherwise false
*/
public static boolean requiresVersionConstraint(PackageStates packageState) {
switch (packageState) {
case INSTALLED: return true;
default: return false;
}
}
}
| {
"pile_set_name": "Github"
} |
#ifndef __GK104_FIFO_CHAN_H__
#define __GK104_FIFO_CHAN_H__
#define gk104_fifo_chan(p) container_of((p), struct gk104_fifo_chan, base)
#include "chan.h"
#include "gk104.h"
struct gk104_fifo_chan {
struct nvkm_fifo_chan base;
struct gk104_fifo *fifo;
int engine;
struct list_head head;
bool killed;
struct nvkm_gpuobj *pgd;
struct nvkm_vm *vm;
struct {
struct nvkm_gpuobj *inst;
struct nvkm_vma vma;
} engn[NVKM_SUBDEV_NR];
};
int gk104_fifo_gpfifo_new(struct nvkm_fifo *, const struct nvkm_oclass *,
void *data, u32 size, struct nvkm_object **);
extern const struct nvkm_fifo_chan_oclass gk104_fifo_gpfifo_oclass;
extern const struct nvkm_fifo_chan_oclass gm204_fifo_gpfifo_oclass;
#endif
| {
"pile_set_name": "Github"
} |
<RCC>
<qresource prefix="/org.mitk.gui.qt.common">
<file>times.svg</file>
</qresource>
</RCC>
| {
"pile_set_name": "Github"
} |
#pragma once
#include "SyscallIndexHelper.h"
class CSyscallHelper
{
public:
CSyscallHelper();
~CSyscallHelper();
bool BuildSyscalls();
ULONG_PTR BuildSyscall(DWORD dwIdx, LPDWORD pdwHash);
NTSTATUS NtSuspendProcess(HANDLE);
NTSTATUS NtWriteVirtualMemory(HANDLE, PVOID, CONST VOID *, SIZE_T, PSIZE_T);
NTSTATUS NtProtectVirtualMemory(HANDLE, PVOID *, SIZE_T *, ULONG, PULONG);
private:
std::shared_ptr <CSyscallIndexHelper> m_pSyscallIndexHelper;
DWORD m_dwNtSuspendProcessIndex;
DWORD m_dwNtWriteVirtualMemoryIndex;
DWORD m_dwNtProtectVirtualMemoryIndex;
};
| {
"pile_set_name": "Github"
} |
/****************************************************************************
Copyright (C) 2002-2014 Gilles Debunne. All rights reserved.
This file is part of the QGLViewer library version 2.6.3.
http://www.libqglviewer.com - [email protected]
This file may be used under the terms of the GNU General Public License
versions 2.0 or 3.0 as published by the Free Software Foundation and
appearing in the LICENSE file included in the packaging of this file.
In addition, as a special exception, Gilles Debunne gives you certain
additional rights, described in the file GPL_EXCEPTION in this package.
libQGLViewer uses dual licensing. Commercial/proprietary software must
purchase a libQGLViewer Commercial License.
This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*****************************************************************************/
#ifndef QGLVIEWER_VEC_H
#define QGLVIEWER_VEC_H
#include <math.h>
#include <iostream>
# include <QDomElement>
// Included by all files as vec.h is at the end of the include hierarchy
#include "config.h" // Specific configuration options.
namespace qglviewer {
/*! \brief The Vec class represents 3D positions and 3D vectors.
\class Vec vec.h QGLViewer/vec.h
Vec is used as a parameter and return type by many methods of the library. It provides classical
algebraic computational methods and is compatible with OpenGL:
\code
// Draws a point located at 3.0 OpenGL units in front of the camera
Vec pos = camera()->position() + 3.0 * camera()->viewDirection();
glBegin(GL_POINTS);
glVertex3fv(pos);
glEnd();
\endcode
This makes of Vec a good candidate for representing positions and vectors in your programs. Since
it is part of the \c qglviewer namespace, specify \c qglviewer::Vec or use the qglviewer
namespace:
\code
using namespace qglviewer;
\endcode
<h3>Interface with other vector classes</h3>
Vec implements a universal explicit converter, based on the \c [] \c operator.
Everywhere a \c const \c Vec& argument is expected, you can use your own vector type
instead, as long as it implements this operator (see the Vec(const C& c) documentation).
See also the Quaternion and the Frame documentations.
\nosubgrouping */
class QGLVIEWER_EXPORT Vec
{
// If your compiler complains the "The class "qglviewer::Vec" has no member "x"."
// Add your architecture Q_OS_XXXX flag (see qglobal.h) in this list.
#if defined (Q_OS_IRIX) || defined (Q_OS_AIX) || defined (Q_OS_HPUX)
# define QGLVIEWER_UNION_NOT_SUPPORTED
#endif
public:
/*! The internal data representation is public. One can use v.x, v.y, v.z. See also operator[](). */
#if defined (DOXYGEN) || defined (QGLVIEWER_UNION_NOT_SUPPORTED)
qreal x, y, z;
#else
union
{
struct { qreal x, y, z; };
qreal v_[3];
};
#endif
/*! @name Setting the value */
//@{
/*! Default constructor. Value is set to (0,0,0). */
Vec() : x(0.0), y(0.0), z(0.0) {}
/*! Standard constructor with the x, y and z values. */
Vec(qreal X, qreal Y, qreal Z) : x(X), y(Y), z(Z) {}
/*! Universal explicit converter from any class to Vec. You can use your own vector class everywhere
a \c const \c Vec& parameter is required, as long as it implements the \c operator[ ]:
\code
class MyVec
{
// ...
qreal operator[](int i) const { returns x, y or z when i=0, 1 or 2; }
}
MyVec v(...);
camera()->setPosition(v);
\endcode
Note that standard vector types (STL, \c qreal[3], ...) implement this operator and can hence
be used in place of Vec. See also operator const qreal*() .*/
template <class C>
explicit Vec(const C& c) : x(c[0]), y(c[1]), z(c[2]) {}
// Should NOT be explicit to prevent conflicts with operator<<.
// ! Copy constructor
// Vec(const Vec& v) : x(v.x), y(v.y), z(v.z) {}
/*! Equal operator. */
Vec& operator=(const Vec& v)
{
x = v.x; y = v.y; z = v.z;
return *this;
}
/*! Set the current value. May be faster than using operator=() with a temporary Vec(x,y,z). */
void setValue(qreal X, qreal Y, qreal Z)
{ x=X; y=Y; z=Z; }
// Universal equal operator which allows the use of any type in place of Vec,
// as long as the [] operator is implemented (v[0]=v.x, v[1]=v.y, v[2]=v.z).
// template <class C>
// Vec& operator=(const C& c)
// {
// x=c[0]; y=c[1]; z=c[2];
// return *this;
// }
//@}
/*! @name Accessing the value */
//@{
/*! Bracket operator, with a constant return value. \p i must range in [0..2]. */
qreal operator[](int i) const {
#ifdef QGLVIEWER_UNION_NOT_SUPPORTED
return (&x)[i];
#else
return v_[i];
#endif
}
/*! Bracket operator returning an l-value. \p i must range in [0..2]. */
qreal& operator[](int i) {
#ifdef QGLVIEWER_UNION_NOT_SUPPORTED
return (&x)[i];
#else
return v_[i];
#endif
}
#ifndef DOXYGEN
/*! This method is deprecated since version 2.0. Use operator const double* instead. */
const double* address() const { qWarning("Vec::address() is deprecated, use operator const double* instead."); return operator const double*(); }
#endif
/*! Conversion operator returning the memory address of the vector.
Very convenient to pass a Vec pointer as a parameter to \c GLdouble OpenGL functions:
\code
Vec pos, normal;
glNormal3dv(normal);
glVertex3dv(pos);
\endcode */
operator const double*() const {
#ifdef QGLVIEWER_UNION_NOT_SUPPORTED
return &x;
#else
return v_;
#endif
}
/*! Non const conversion operator returning the memory address of the vector.
Useful to pass a Vec to a method that requires and fills a \c double*, as provided by certain libraries. */
operator double*() {
#ifdef QGLVIEWER_UNION_NOT_SUPPORTED
return &x;
#else
return v_;
#endif
}
/*! Conversion operator returning the memory address of the vector.
Very convenient to pass a Vec pointer as a \c float parameter to OpenGL functions:
\code
Vec pos, normal;
glNormal3fv(normal);
glVertex3fv(pos);
\endcode
\note The returned float array is a static shared by all \c Vec instances. */
operator const float*() const {
static float* const result = new float[3];
result[0] = (float)x;
result[1] = (float)y;
result[2] = (float)z;
return result;
}
//@}
/*! @name Algebraic computations */
//@{
/*! Returns the sum of the two vectors. */
friend Vec operator+(const Vec &a, const Vec &b)
{
return Vec(a.x+b.x, a.y+b.y, a.z+b.z);
}
/*! Returns the difference of the two vectors. */
friend Vec operator-(const Vec &a, const Vec &b)
{
return Vec(a.x-b.x, a.y-b.y, a.z-b.z);
}
/*! Unary minus operator. */
friend Vec operator-(const Vec &a)
{
return Vec(-a.x, -a.y, -a.z);
}
/*! Returns the product of the vector with a scalar. */
friend Vec operator*(const Vec &a, qreal k)
{
return Vec(a.x*k, a.y*k, a.z*k);
}
/*! Returns the product of a scalar with the vector. */
friend Vec operator*(qreal k, const Vec &a)
{
return a*k;
}
/*! Returns the division of the vector with a scalar.
Too small \p k values are \e not tested (unless the library was compiled with the "debug" Qt \c
CONFIG flag) and may result in \c NaN values. */
friend Vec operator/(const Vec &a, qreal k)
{
#ifndef QT_NO_DEBUG
if (fabs(k) < 1.0E-10)
qWarning("Vec::operator / : dividing by a null value (%f)", k);
#endif
return Vec(a.x/k, a.y/k, a.z/k);
}
/*! Returns \c true only when the two vector are not equal (see operator==()). */
friend bool operator!=(const Vec &a, const Vec &b)
{
return !(a==b);
}
/*! Returns \c true when the squaredNorm() of the difference vector is lower than 1E-10. */
friend bool operator==(const Vec &a, const Vec &b)
{
const qreal epsilon = 1.0E-10;
return (a-b).squaredNorm() < epsilon;
}
/*! Adds \p a to the vector. */
Vec& operator+=(const Vec &a)
{
x += a.x; y += a.y; z += a.z;
return *this;
}
/*! Subtracts \p a to the vector. */
Vec& operator-=(const Vec &a)
{
x -= a.x; y -= a.y; z -= a.z;
return *this;
}
/*! Multiply the vector by a scalar \p k. */
Vec& operator*=(qreal k)
{
x *= k; y *= k; z *= k;
return *this;
}
/*! Divides the vector by a scalar \p k.
An absolute \p k value lower than 1E-10 will print a warning if the library was compiled with the
"debug" Qt \c CONFIG flag. Otherwise, no test is performed for efficiency reasons. */
Vec& operator/=(qreal k)
{
#ifndef QT_NO_DEBUG
if (fabs(k)<1.0E-10)
qWarning("Vec::operator /= : dividing by a null value (%f)", k);
#endif
x /= k; y /= k; z /= k;
return *this;
}
/*! Dot product of the two Vec. */
friend qreal operator*(const Vec &a, const Vec &b)
{
return a.x*b.x + a.y*b.y + a.z*b.z;
}
/*! Cross product of the two vectors. Same as cross(). */
friend Vec operator^(const Vec &a, const Vec &b)
{
return cross(a,b);
}
/*! Cross product of the two Vec. Mind the order ! */
friend Vec cross(const Vec &a, const Vec &b)
{
return Vec(a.y*b.z - a.z*b.y,
a.z*b.x - a.x*b.z,
a.x*b.y - a.y*b.x);
}
Vec orthogonalVec() const;
//@}
/*! @name Norm of the vector */
//@{
#ifndef DOXYGEN
/*! This method is deprecated since version 2.0. Use squaredNorm() instead. */
qreal sqNorm() const { return x*x + y*y + z*z; }
#endif
/*! Returns the \e squared norm of the Vec. */
qreal squaredNorm() const { return x*x + y*y + z*z; }
/*! Returns the norm of the vector. */
qreal norm() const { return sqrt(x*x + y*y + z*z); }
/*! Normalizes the Vec and returns its original norm.
Normalizing a null vector will result in \c NaN values. */
qreal normalize()
{
const qreal n = norm();
#ifndef QT_NO_DEBUG
if (n < 1.0E-10)
qWarning("Vec::normalize: normalizing a null vector (norm=%f)", n);
#endif
*this /= n;
return n;
}
/*! Returns a unitary (normalized) \e representation of the vector. The original Vec is not modified. */
Vec unit() const
{
Vec v = *this;
v.normalize();
return v;
}
//@}
/*! @name Projection */
//@{
void projectOnAxis(const Vec& direction);
void projectOnPlane(const Vec& normal);
//@}
/*! @name XML representation */
//@{
explicit Vec(const QDomElement& element);
QDomElement domElement(const QString& name, QDomDocument& document) const;
void initFromDOMElement(const QDomElement& element);
//@}
#ifdef DOXYGEN
/*! @name Output stream */
//@{
/*! Output stream operator. Enables debugging code like:
\code
Vec pos(...);
cout << "Position=" << pos << endl;
\endcode */
std::ostream& operator<<(std::ostream& o, const qglviewer::Vec&);
//@}
#endif
};
} // namespace
std::ostream& operator<<(std::ostream& o, const qglviewer::Vec&);
#endif // QGLVIEWER_VEC_H
| {
"pile_set_name": "Github"
} |
Then the Queen left off, quite out of breath, and said to Alice, 'Have
you seen the Mock Turtle yet?'
'No,' said Alice. 'I don't even know what a Mock Turtle is.'
'It's the thing Mock Turtle Soup is made from,' said the Queen.
'I never saw one, or heard of one,' said Alice.
'Come on, then,' said the Queen, 'and he shall tell you his history,'
| {
"pile_set_name": "Github"
} |
/*
* ALSA driver for ICEnsemble VT1724 (Envy24HT)
*
* Lowlevel functions for Terratec Aureon cards
*
* Copyright (c) 2003 Takashi Iwai <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* NOTES:
*
* - we reuse the struct snd_akm4xxx record for storing the wm8770 codec data.
* both wm and akm codecs are pretty similar, so we can integrate
* both controls in the future, once if wm codecs are reused in
* many boards.
*
* - DAC digital volumes are not implemented in the mixer.
* if they show better response than DAC analog volumes, we can use them
* instead.
*
* Lowlevel functions for AudioTrak Prodigy 7.1 (and possibly 192) cards
* Copyright (c) 2003 Dimitromanolakis Apostolos <[email protected]>
*
* version 0.82: Stable / not all features work yet (no communication with AC97 secondary)
* added 64x/128x oversampling switch (should be 64x only for 96khz)
* fixed some recording labels (still need to check the rest)
* recording is working probably thanks to correct wm8770 initialization
*
* version 0.5: Initial release:
* working: analog output, mixer, headphone amplifier switch
* not working: prety much everything else, at least i could verify that
* we have no digital output, no capture, pretty bad clicks and poops
* on mixer switch and other coll stuff.
*/
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/mutex.h>
#include <sound/core.h>
#include "ice1712.h"
#include "envy24ht.h"
#include "aureon.h"
#include <sound/tlv.h>
/* AC97 register cache for Aureon */
struct aureon_spec {
unsigned short stac9744[64];
unsigned int cs8415_mux;
unsigned short master[2];
unsigned short vol[8];
unsigned char pca9554_out;
};
/* WM8770 registers */
#define WM_DAC_ATTEN 0x00 /* DAC1-8 analog attenuation */
#define WM_DAC_MASTER_ATTEN 0x08 /* DAC master analog attenuation */
#define WM_DAC_DIG_ATTEN 0x09 /* DAC1-8 digital attenuation */
#define WM_DAC_DIG_MASTER_ATTEN 0x11 /* DAC master digital attenuation */
#define WM_PHASE_SWAP 0x12 /* DAC phase */
#define WM_DAC_CTRL1 0x13 /* DAC control bits */
#define WM_MUTE 0x14 /* mute controls */
#define WM_DAC_CTRL2 0x15 /* de-emphasis and zefo-flag */
#define WM_INT_CTRL 0x16 /* interface control */
#define WM_MASTER 0x17 /* master clock and mode */
#define WM_POWERDOWN 0x18 /* power-down controls */
#define WM_ADC_GAIN 0x19 /* ADC gain L(19)/R(1a) */
#define WM_ADC_MUX 0x1b /* input MUX */
#define WM_OUT_MUX1 0x1c /* output MUX */
#define WM_OUT_MUX2 0x1e /* output MUX */
#define WM_RESET 0x1f /* software reset */
/* CS8415A registers */
#define CS8415_CTRL1 0x01
#define CS8415_CTRL2 0x02
#define CS8415_QSUB 0x14
#define CS8415_RATIO 0x1E
#define CS8415_C_BUFFER 0x20
#define CS8415_ID 0x7F
/* PCA9554 registers */
#define PCA9554_DEV 0x40 /* I2C device address */
#define PCA9554_IN 0x00 /* input port */
#define PCA9554_OUT 0x01 /* output port */
#define PCA9554_INVERT 0x02 /* input invert */
#define PCA9554_DIR 0x03 /* port directions */
/*
* Aureon Universe additional controls using PCA9554
*/
/*
* Send data to pca9554
*/
static void aureon_pca9554_write(struct snd_ice1712 *ice, unsigned char reg,
unsigned char data)
{
unsigned int tmp;
int i, j;
unsigned char dev = PCA9554_DEV; /* ID 0100000, write */
unsigned char val = 0;
tmp = snd_ice1712_gpio_read(ice);
snd_ice1712_gpio_set_mask(ice, ~(AUREON_SPI_MOSI|AUREON_SPI_CLK|
AUREON_WM_RW|AUREON_WM_CS|
AUREON_CS8415_CS));
tmp |= AUREON_WM_RW;
tmp |= AUREON_CS8415_CS | AUREON_WM_CS; /* disable SPI devices */
tmp &= ~AUREON_SPI_MOSI;
tmp &= ~AUREON_SPI_CLK;
snd_ice1712_gpio_write(ice, tmp);
udelay(50);
/*
* send i2c stop condition and start condition
* to obtain sane state
*/
tmp |= AUREON_SPI_CLK;
snd_ice1712_gpio_write(ice, tmp);
udelay(50);
tmp |= AUREON_SPI_MOSI;
snd_ice1712_gpio_write(ice, tmp);
udelay(100);
tmp &= ~AUREON_SPI_MOSI;
snd_ice1712_gpio_write(ice, tmp);
udelay(50);
tmp &= ~AUREON_SPI_CLK;
snd_ice1712_gpio_write(ice, tmp);
udelay(100);
/*
* send device address, command and value,
* skipping ack cycles in between
*/
for (j = 0; j < 3; j++) {
switch (j) {
case 0:
val = dev;
break;
case 1:
val = reg;
break;
case 2:
val = data;
break;
}
for (i = 7; i >= 0; i--) {
tmp &= ~AUREON_SPI_CLK;
snd_ice1712_gpio_write(ice, tmp);
udelay(40);
if (val & (1 << i))
tmp |= AUREON_SPI_MOSI;
else
tmp &= ~AUREON_SPI_MOSI;
snd_ice1712_gpio_write(ice, tmp);
udelay(40);
tmp |= AUREON_SPI_CLK;
snd_ice1712_gpio_write(ice, tmp);
udelay(40);
}
tmp &= ~AUREON_SPI_CLK;
snd_ice1712_gpio_write(ice, tmp);
udelay(40);
tmp |= AUREON_SPI_CLK;
snd_ice1712_gpio_write(ice, tmp);
udelay(40);
tmp &= ~AUREON_SPI_CLK;
snd_ice1712_gpio_write(ice, tmp);
udelay(40);
}
tmp &= ~AUREON_SPI_CLK;
snd_ice1712_gpio_write(ice, tmp);
udelay(40);
tmp &= ~AUREON_SPI_MOSI;
snd_ice1712_gpio_write(ice, tmp);
udelay(40);
tmp |= AUREON_SPI_CLK;
snd_ice1712_gpio_write(ice, tmp);
udelay(50);
tmp |= AUREON_SPI_MOSI;
snd_ice1712_gpio_write(ice, tmp);
udelay(100);
}
static int aureon_universe_inmux_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{
static const char * const texts[3] =
{"Internal Aux", "Wavetable", "Rear Line-In"};
return snd_ctl_enum_info(uinfo, 1, 3, texts);
}
static int aureon_universe_inmux_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
struct aureon_spec *spec = ice->spec;
ucontrol->value.enumerated.item[0] = spec->pca9554_out;
return 0;
}
static int aureon_universe_inmux_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
struct aureon_spec *spec = ice->spec;
unsigned char oval, nval;
int change;
nval = ucontrol->value.enumerated.item[0];
if (nval >= 3)
return -EINVAL;
snd_ice1712_save_gpio_status(ice);
oval = spec->pca9554_out;
change = (oval != nval);
if (change) {
aureon_pca9554_write(ice, PCA9554_OUT, nval);
spec->pca9554_out = nval;
}
snd_ice1712_restore_gpio_status(ice);
return change;
}
static void aureon_ac97_write(struct snd_ice1712 *ice, unsigned short reg,
unsigned short val)
{
struct aureon_spec *spec = ice->spec;
unsigned int tmp;
/* Send address to XILINX chip */
tmp = (snd_ice1712_gpio_read(ice) & ~0xFF) | (reg & 0x7F);
snd_ice1712_gpio_write(ice, tmp);
udelay(10);
tmp |= AUREON_AC97_ADDR;
snd_ice1712_gpio_write(ice, tmp);
udelay(10);
tmp &= ~AUREON_AC97_ADDR;
snd_ice1712_gpio_write(ice, tmp);
udelay(10);
/* Send low-order byte to XILINX chip */
tmp &= ~AUREON_AC97_DATA_MASK;
tmp |= val & AUREON_AC97_DATA_MASK;
snd_ice1712_gpio_write(ice, tmp);
udelay(10);
tmp |= AUREON_AC97_DATA_LOW;
snd_ice1712_gpio_write(ice, tmp);
udelay(10);
tmp &= ~AUREON_AC97_DATA_LOW;
snd_ice1712_gpio_write(ice, tmp);
udelay(10);
/* Send high-order byte to XILINX chip */
tmp &= ~AUREON_AC97_DATA_MASK;
tmp |= (val >> 8) & AUREON_AC97_DATA_MASK;
snd_ice1712_gpio_write(ice, tmp);
udelay(10);
tmp |= AUREON_AC97_DATA_HIGH;
snd_ice1712_gpio_write(ice, tmp);
udelay(10);
tmp &= ~AUREON_AC97_DATA_HIGH;
snd_ice1712_gpio_write(ice, tmp);
udelay(10);
/* Instruct XILINX chip to parse the data to the STAC9744 chip */
tmp |= AUREON_AC97_COMMIT;
snd_ice1712_gpio_write(ice, tmp);
udelay(10);
tmp &= ~AUREON_AC97_COMMIT;
snd_ice1712_gpio_write(ice, tmp);
udelay(10);
/* Store the data in out private buffer */
spec->stac9744[(reg & 0x7F) >> 1] = val;
}
static unsigned short aureon_ac97_read(struct snd_ice1712 *ice, unsigned short reg)
{
struct aureon_spec *spec = ice->spec;
return spec->stac9744[(reg & 0x7F) >> 1];
}
/*
* Initialize STAC9744 chip
*/
static int aureon_ac97_init(struct snd_ice1712 *ice)
{
struct aureon_spec *spec = ice->spec;
int i;
static const unsigned short ac97_defaults[] = {
0x00, 0x9640,
0x02, 0x8000,
0x04, 0x8000,
0x06, 0x8000,
0x0C, 0x8008,
0x0E, 0x8008,
0x10, 0x8808,
0x12, 0x8808,
0x14, 0x8808,
0x16, 0x8808,
0x18, 0x8808,
0x1C, 0x8000,
0x26, 0x000F,
0x28, 0x0201,
0x2C, 0xBB80,
0x32, 0xBB80,
0x7C, 0x8384,
0x7E, 0x7644,
(unsigned short)-1
};
unsigned int tmp;
/* Cold reset */
tmp = (snd_ice1712_gpio_read(ice) | AUREON_AC97_RESET) & ~AUREON_AC97_DATA_MASK;
snd_ice1712_gpio_write(ice, tmp);
udelay(3);
tmp &= ~AUREON_AC97_RESET;
snd_ice1712_gpio_write(ice, tmp);
udelay(3);
tmp |= AUREON_AC97_RESET;
snd_ice1712_gpio_write(ice, tmp);
udelay(3);
memset(&spec->stac9744, 0, sizeof(spec->stac9744));
for (i = 0; ac97_defaults[i] != (unsigned short)-1; i += 2)
spec->stac9744[(ac97_defaults[i]) >> 1] = ac97_defaults[i+1];
/* Unmute AC'97 master volume permanently - muting is done by WM8770 */
aureon_ac97_write(ice, AC97_MASTER, 0x0000);
return 0;
}
#define AUREON_AC97_STEREO 0x80
/*
* AC'97 volume controls
*/
static int aureon_ac97_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = kcontrol->private_value & AUREON_AC97_STEREO ? 2 : 1;
uinfo->value.integer.min = 0;
uinfo->value.integer.max = 31;
return 0;
}
static int aureon_ac97_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
unsigned short vol;
mutex_lock(&ice->gpio_mutex);
vol = aureon_ac97_read(ice, kcontrol->private_value & 0x7F);
ucontrol->value.integer.value[0] = 0x1F - (vol & 0x1F);
if (kcontrol->private_value & AUREON_AC97_STEREO)
ucontrol->value.integer.value[1] = 0x1F - ((vol >> 8) & 0x1F);
mutex_unlock(&ice->gpio_mutex);
return 0;
}
static int aureon_ac97_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
unsigned short ovol, nvol;
int change;
snd_ice1712_save_gpio_status(ice);
ovol = aureon_ac97_read(ice, kcontrol->private_value & 0x7F);
nvol = (0x1F - ucontrol->value.integer.value[0]) & 0x001F;
if (kcontrol->private_value & AUREON_AC97_STEREO)
nvol |= ((0x1F - ucontrol->value.integer.value[1]) << 8) & 0x1F00;
nvol |= ovol & ~0x1F1F;
change = (ovol != nvol);
if (change)
aureon_ac97_write(ice, kcontrol->private_value & 0x7F, nvol);
snd_ice1712_restore_gpio_status(ice);
return change;
}
/*
* AC'97 mute controls
*/
#define aureon_ac97_mute_info snd_ctl_boolean_mono_info
static int aureon_ac97_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
mutex_lock(&ice->gpio_mutex);
ucontrol->value.integer.value[0] = aureon_ac97_read(ice,
kcontrol->private_value & 0x7F) & 0x8000 ? 0 : 1;
mutex_unlock(&ice->gpio_mutex);
return 0;
}
static int aureon_ac97_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
unsigned short ovol, nvol;
int change;
snd_ice1712_save_gpio_status(ice);
ovol = aureon_ac97_read(ice, kcontrol->private_value & 0x7F);
nvol = (ucontrol->value.integer.value[0] ? 0x0000 : 0x8000) | (ovol & ~0x8000);
change = (ovol != nvol);
if (change)
aureon_ac97_write(ice, kcontrol->private_value & 0x7F, nvol);
snd_ice1712_restore_gpio_status(ice);
return change;
}
/*
* AC'97 mute controls
*/
#define aureon_ac97_micboost_info snd_ctl_boolean_mono_info
static int aureon_ac97_micboost_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
mutex_lock(&ice->gpio_mutex);
ucontrol->value.integer.value[0] = aureon_ac97_read(ice, AC97_MIC) & 0x0020 ? 0 : 1;
mutex_unlock(&ice->gpio_mutex);
return 0;
}
static int aureon_ac97_micboost_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
unsigned short ovol, nvol;
int change;
snd_ice1712_save_gpio_status(ice);
ovol = aureon_ac97_read(ice, AC97_MIC);
nvol = (ucontrol->value.integer.value[0] ? 0x0000 : 0x0020) | (ovol & ~0x0020);
change = (ovol != nvol);
if (change)
aureon_ac97_write(ice, AC97_MIC, nvol);
snd_ice1712_restore_gpio_status(ice);
return change;
}
/*
* write data in the SPI mode
*/
static void aureon_spi_write(struct snd_ice1712 *ice, unsigned int cs, unsigned int data, int bits)
{
unsigned int tmp;
int i;
unsigned int mosi, clk;
tmp = snd_ice1712_gpio_read(ice);
if (ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71LT ||
ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71XT) {
snd_ice1712_gpio_set_mask(ice, ~(PRODIGY_SPI_MOSI|PRODIGY_SPI_CLK|PRODIGY_WM_CS));
mosi = PRODIGY_SPI_MOSI;
clk = PRODIGY_SPI_CLK;
} else {
snd_ice1712_gpio_set_mask(ice, ~(AUREON_WM_RW|AUREON_SPI_MOSI|AUREON_SPI_CLK|
AUREON_WM_CS|AUREON_CS8415_CS));
mosi = AUREON_SPI_MOSI;
clk = AUREON_SPI_CLK;
tmp |= AUREON_WM_RW;
}
tmp &= ~cs;
snd_ice1712_gpio_write(ice, tmp);
udelay(1);
for (i = bits - 1; i >= 0; i--) {
tmp &= ~clk;
snd_ice1712_gpio_write(ice, tmp);
udelay(1);
if (data & (1 << i))
tmp |= mosi;
else
tmp &= ~mosi;
snd_ice1712_gpio_write(ice, tmp);
udelay(1);
tmp |= clk;
snd_ice1712_gpio_write(ice, tmp);
udelay(1);
}
tmp &= ~clk;
tmp |= cs;
snd_ice1712_gpio_write(ice, tmp);
udelay(1);
tmp |= clk;
snd_ice1712_gpio_write(ice, tmp);
udelay(1);
}
/*
* Read data in SPI mode
*/
static void aureon_spi_read(struct snd_ice1712 *ice, unsigned int cs,
unsigned int data, int bits, unsigned char *buffer, int size)
{
int i, j;
unsigned int tmp;
tmp = (snd_ice1712_gpio_read(ice) & ~AUREON_SPI_CLK) | AUREON_CS8415_CS|AUREON_WM_CS;
snd_ice1712_gpio_write(ice, tmp);
tmp &= ~cs;
snd_ice1712_gpio_write(ice, tmp);
udelay(1);
for (i = bits-1; i >= 0; i--) {
if (data & (1 << i))
tmp |= AUREON_SPI_MOSI;
else
tmp &= ~AUREON_SPI_MOSI;
snd_ice1712_gpio_write(ice, tmp);
udelay(1);
tmp |= AUREON_SPI_CLK;
snd_ice1712_gpio_write(ice, tmp);
udelay(1);
tmp &= ~AUREON_SPI_CLK;
snd_ice1712_gpio_write(ice, tmp);
udelay(1);
}
for (j = 0; j < size; j++) {
unsigned char outdata = 0;
for (i = 7; i >= 0; i--) {
tmp = snd_ice1712_gpio_read(ice);
outdata <<= 1;
outdata |= (tmp & AUREON_SPI_MISO) ? 1 : 0;
udelay(1);
tmp |= AUREON_SPI_CLK;
snd_ice1712_gpio_write(ice, tmp);
udelay(1);
tmp &= ~AUREON_SPI_CLK;
snd_ice1712_gpio_write(ice, tmp);
udelay(1);
}
buffer[j] = outdata;
}
tmp |= cs;
snd_ice1712_gpio_write(ice, tmp);
}
static unsigned char aureon_cs8415_get(struct snd_ice1712 *ice, int reg)
{
unsigned char val;
aureon_spi_write(ice, AUREON_CS8415_CS, 0x2000 | reg, 16);
aureon_spi_read(ice, AUREON_CS8415_CS, 0x21, 8, &val, 1);
return val;
}
static void aureon_cs8415_read(struct snd_ice1712 *ice, int reg,
unsigned char *buffer, int size)
{
aureon_spi_write(ice, AUREON_CS8415_CS, 0x2000 | reg, 16);
aureon_spi_read(ice, AUREON_CS8415_CS, 0x21, 8, buffer, size);
}
static void aureon_cs8415_put(struct snd_ice1712 *ice, int reg,
unsigned char val)
{
aureon_spi_write(ice, AUREON_CS8415_CS, 0x200000 | (reg << 8) | val, 24);
}
/*
* get the current register value of WM codec
*/
static unsigned short wm_get(struct snd_ice1712 *ice, int reg)
{
reg <<= 1;
return ((unsigned short)ice->akm[0].images[reg] << 8) |
ice->akm[0].images[reg + 1];
}
/*
* set the register value of WM codec
*/
static void wm_put_nocache(struct snd_ice1712 *ice, int reg, unsigned short val)
{
aureon_spi_write(ice,
((ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71LT ||
ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71XT) ?
PRODIGY_WM_CS : AUREON_WM_CS),
(reg << 9) | (val & 0x1ff), 16);
}
/*
* set the register value of WM codec and remember it
*/
static void wm_put(struct snd_ice1712 *ice, int reg, unsigned short val)
{
wm_put_nocache(ice, reg, val);
reg <<= 1;
ice->akm[0].images[reg] = val >> 8;
ice->akm[0].images[reg + 1] = val;
}
/*
*/
#define aureon_mono_bool_info snd_ctl_boolean_mono_info
/*
* AC'97 master playback mute controls (Mute on WM8770 chip)
*/
#define aureon_ac97_mmute_info snd_ctl_boolean_mono_info
static int aureon_ac97_mmute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
mutex_lock(&ice->gpio_mutex);
ucontrol->value.integer.value[0] = (wm_get(ice, WM_OUT_MUX1) >> 1) & 0x01;
mutex_unlock(&ice->gpio_mutex);
return 0;
}
static int aureon_ac97_mmute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
unsigned short ovol, nvol;
int change;
snd_ice1712_save_gpio_status(ice);
ovol = wm_get(ice, WM_OUT_MUX1);
nvol = (ovol & ~0x02) | (ucontrol->value.integer.value[0] ? 0x02 : 0x00);
change = (ovol != nvol);
if (change)
wm_put(ice, WM_OUT_MUX1, nvol);
snd_ice1712_restore_gpio_status(ice);
return change;
}
static const DECLARE_TLV_DB_SCALE(db_scale_wm_dac, -10000, 100, 1);
static const DECLARE_TLV_DB_SCALE(db_scale_wm_pcm, -6400, 50, 1);
static const DECLARE_TLV_DB_SCALE(db_scale_wm_adc, -1200, 100, 0);
static const DECLARE_TLV_DB_SCALE(db_scale_ac97_master, -4650, 150, 0);
static const DECLARE_TLV_DB_SCALE(db_scale_ac97_gain, -3450, 150, 0);
#define WM_VOL_MAX 100
#define WM_VOL_CNT 101 /* 0dB .. -100dB */
#define WM_VOL_MUTE 0x8000
static void wm_set_vol(struct snd_ice1712 *ice, unsigned int index, unsigned short vol, unsigned short master)
{
unsigned char nvol;
if ((master & WM_VOL_MUTE) || (vol & WM_VOL_MUTE)) {
nvol = 0;
} else {
nvol = ((vol % WM_VOL_CNT) * (master % WM_VOL_CNT)) /
WM_VOL_MAX;
nvol += 0x1b;
}
wm_put(ice, index, nvol);
wm_put_nocache(ice, index, 0x180 | nvol);
}
/*
* DAC mute control
*/
#define wm_pcm_mute_info snd_ctl_boolean_mono_info
static int wm_pcm_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
mutex_lock(&ice->gpio_mutex);
ucontrol->value.integer.value[0] = (wm_get(ice, WM_MUTE) & 0x10) ? 0 : 1;
mutex_unlock(&ice->gpio_mutex);
return 0;
}
static int wm_pcm_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
unsigned short nval, oval;
int change;
snd_ice1712_save_gpio_status(ice);
oval = wm_get(ice, WM_MUTE);
nval = (oval & ~0x10) | (ucontrol->value.integer.value[0] ? 0 : 0x10);
change = (oval != nval);
if (change)
wm_put(ice, WM_MUTE, nval);
snd_ice1712_restore_gpio_status(ice);
return change;
}
/*
* Master volume attenuation mixer control
*/
static int wm_master_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = 2;
uinfo->value.integer.min = 0;
uinfo->value.integer.max = WM_VOL_MAX;
return 0;
}
static int wm_master_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
struct aureon_spec *spec = ice->spec;
int i;
for (i = 0; i < 2; i++)
ucontrol->value.integer.value[i] =
spec->master[i] & ~WM_VOL_MUTE;
return 0;
}
static int wm_master_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
struct aureon_spec *spec = ice->spec;
int ch, change = 0;
snd_ice1712_save_gpio_status(ice);
for (ch = 0; ch < 2; ch++) {
unsigned int vol = ucontrol->value.integer.value[ch];
if (vol > WM_VOL_MAX)
vol = WM_VOL_MAX;
vol |= spec->master[ch] & WM_VOL_MUTE;
if (vol != spec->master[ch]) {
int dac;
spec->master[ch] = vol;
for (dac = 0; dac < ice->num_total_dacs; dac += 2)
wm_set_vol(ice, WM_DAC_ATTEN + dac + ch,
spec->vol[dac + ch],
spec->master[ch]);
change = 1;
}
}
snd_ice1712_restore_gpio_status(ice);
return change;
}
/*
* DAC volume attenuation mixer control
*/
static int wm_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{
int voices = kcontrol->private_value >> 8;
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = voices;
uinfo->value.integer.min = 0; /* mute (-101dB) */
uinfo->value.integer.max = WM_VOL_MAX; /* 0dB */
return 0;
}
static int wm_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
struct aureon_spec *spec = ice->spec;
int i, ofs, voices;
voices = kcontrol->private_value >> 8;
ofs = kcontrol->private_value & 0xff;
for (i = 0; i < voices; i++)
ucontrol->value.integer.value[i] =
spec->vol[ofs+i] & ~WM_VOL_MUTE;
return 0;
}
static int wm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
struct aureon_spec *spec = ice->spec;
int i, idx, ofs, voices;
int change = 0;
voices = kcontrol->private_value >> 8;
ofs = kcontrol->private_value & 0xff;
snd_ice1712_save_gpio_status(ice);
for (i = 0; i < voices; i++) {
unsigned int vol = ucontrol->value.integer.value[i];
if (vol > WM_VOL_MAX)
vol = WM_VOL_MAX;
vol |= spec->vol[ofs+i] & WM_VOL_MUTE;
if (vol != spec->vol[ofs+i]) {
spec->vol[ofs+i] = vol;
idx = WM_DAC_ATTEN + ofs + i;
wm_set_vol(ice, idx, spec->vol[ofs + i],
spec->master[i]);
change = 1;
}
}
snd_ice1712_restore_gpio_status(ice);
return change;
}
/*
* WM8770 mute control
*/
static int wm_mute_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{
uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
uinfo->count = kcontrol->private_value >> 8;
uinfo->value.integer.min = 0;
uinfo->value.integer.max = 1;
return 0;
}
static int wm_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
struct aureon_spec *spec = ice->spec;
int voices, ofs, i;
voices = kcontrol->private_value >> 8;
ofs = kcontrol->private_value & 0xFF;
for (i = 0; i < voices; i++)
ucontrol->value.integer.value[i] =
(spec->vol[ofs + i] & WM_VOL_MUTE) ? 0 : 1;
return 0;
}
static int wm_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
struct aureon_spec *spec = ice->spec;
int change = 0, voices, ofs, i;
voices = kcontrol->private_value >> 8;
ofs = kcontrol->private_value & 0xFF;
snd_ice1712_save_gpio_status(ice);
for (i = 0; i < voices; i++) {
int val = (spec->vol[ofs + i] & WM_VOL_MUTE) ? 0 : 1;
if (ucontrol->value.integer.value[i] != val) {
spec->vol[ofs + i] &= ~WM_VOL_MUTE;
spec->vol[ofs + i] |=
ucontrol->value.integer.value[i] ? 0 : WM_VOL_MUTE;
wm_set_vol(ice, ofs + i, spec->vol[ofs + i],
spec->master[i]);
change = 1;
}
}
snd_ice1712_restore_gpio_status(ice);
return change;
}
/*
* WM8770 master mute control
*/
#define wm_master_mute_info snd_ctl_boolean_stereo_info
static int wm_master_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
struct aureon_spec *spec = ice->spec;
ucontrol->value.integer.value[0] =
(spec->master[0] & WM_VOL_MUTE) ? 0 : 1;
ucontrol->value.integer.value[1] =
(spec->master[1] & WM_VOL_MUTE) ? 0 : 1;
return 0;
}
static int wm_master_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
struct aureon_spec *spec = ice->spec;
int change = 0, i;
snd_ice1712_save_gpio_status(ice);
for (i = 0; i < 2; i++) {
int val = (spec->master[i] & WM_VOL_MUTE) ? 0 : 1;
if (ucontrol->value.integer.value[i] != val) {
int dac;
spec->master[i] &= ~WM_VOL_MUTE;
spec->master[i] |=
ucontrol->value.integer.value[i] ? 0 : WM_VOL_MUTE;
for (dac = 0; dac < ice->num_total_dacs; dac += 2)
wm_set_vol(ice, WM_DAC_ATTEN + dac + i,
spec->vol[dac + i],
spec->master[i]);
change = 1;
}
}
snd_ice1712_restore_gpio_status(ice);
return change;
}
/* digital master volume */
#define PCM_0dB 0xff
#define PCM_RES 128 /* -64dB */
#define PCM_MIN (PCM_0dB - PCM_RES)
static int wm_pcm_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = 1;
uinfo->value.integer.min = 0; /* mute (-64dB) */
uinfo->value.integer.max = PCM_RES; /* 0dB */
return 0;
}
static int wm_pcm_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
unsigned short val;
mutex_lock(&ice->gpio_mutex);
val = wm_get(ice, WM_DAC_DIG_MASTER_ATTEN) & 0xff;
val = val > PCM_MIN ? (val - PCM_MIN) : 0;
ucontrol->value.integer.value[0] = val;
mutex_unlock(&ice->gpio_mutex);
return 0;
}
static int wm_pcm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
unsigned short ovol, nvol;
int change = 0;
nvol = ucontrol->value.integer.value[0];
if (nvol > PCM_RES)
return -EINVAL;
snd_ice1712_save_gpio_status(ice);
nvol = (nvol ? (nvol + PCM_MIN) : 0) & 0xff;
ovol = wm_get(ice, WM_DAC_DIG_MASTER_ATTEN) & 0xff;
if (ovol != nvol) {
wm_put(ice, WM_DAC_DIG_MASTER_ATTEN, nvol); /* prelatch */
wm_put_nocache(ice, WM_DAC_DIG_MASTER_ATTEN, nvol | 0x100); /* update */
change = 1;
}
snd_ice1712_restore_gpio_status(ice);
return change;
}
/*
* ADC mute control
*/
#define wm_adc_mute_info snd_ctl_boolean_stereo_info
static int wm_adc_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
unsigned short val;
int i;
mutex_lock(&ice->gpio_mutex);
for (i = 0; i < 2; i++) {
val = wm_get(ice, WM_ADC_GAIN + i);
ucontrol->value.integer.value[i] = ~val>>5 & 0x1;
}
mutex_unlock(&ice->gpio_mutex);
return 0;
}
static int wm_adc_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
unsigned short new, old;
int i, change = 0;
snd_ice1712_save_gpio_status(ice);
for (i = 0; i < 2; i++) {
old = wm_get(ice, WM_ADC_GAIN + i);
new = (~ucontrol->value.integer.value[i]<<5&0x20) | (old&~0x20);
if (new != old) {
wm_put(ice, WM_ADC_GAIN + i, new);
change = 1;
}
}
snd_ice1712_restore_gpio_status(ice);
return change;
}
/*
* ADC gain mixer control
*/
static int wm_adc_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = 2;
uinfo->value.integer.min = 0; /* -12dB */
uinfo->value.integer.max = 0x1f; /* 19dB */
return 0;
}
static int wm_adc_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
int i, idx;
unsigned short vol;
mutex_lock(&ice->gpio_mutex);
for (i = 0; i < 2; i++) {
idx = WM_ADC_GAIN + i;
vol = wm_get(ice, idx) & 0x1f;
ucontrol->value.integer.value[i] = vol;
}
mutex_unlock(&ice->gpio_mutex);
return 0;
}
static int wm_adc_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
int i, idx;
unsigned short ovol, nvol;
int change = 0;
snd_ice1712_save_gpio_status(ice);
for (i = 0; i < 2; i++) {
idx = WM_ADC_GAIN + i;
nvol = ucontrol->value.integer.value[i] & 0x1f;
ovol = wm_get(ice, idx);
if ((ovol & 0x1f) != nvol) {
wm_put(ice, idx, nvol | (ovol & ~0x1f));
change = 1;
}
}
snd_ice1712_restore_gpio_status(ice);
return change;
}
/*
* ADC input mux mixer control
*/
static int wm_adc_mux_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{
static const char * const texts[] = {
"CD", /* AIN1 */
"Aux", /* AIN2 */
"Line", /* AIN3 */
"Mic", /* AIN4 */
"AC97" /* AIN5 */
};
static const char * const universe_texts[] = {
"Aux1", /* AIN1 */
"CD", /* AIN2 */
"Phono", /* AIN3 */
"Line", /* AIN4 */
"Aux2", /* AIN5 */
"Mic", /* AIN6 */
"Aux3", /* AIN7 */
"AC97" /* AIN8 */
};
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
if (ice->eeprom.subvendor == VT1724_SUBDEVICE_AUREON71_UNIVERSE)
return snd_ctl_enum_info(uinfo, 2, 8, universe_texts);
else
return snd_ctl_enum_info(uinfo, 2, 5, texts);
}
static int wm_adc_mux_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
unsigned short val;
mutex_lock(&ice->gpio_mutex);
val = wm_get(ice, WM_ADC_MUX);
ucontrol->value.enumerated.item[0] = val & 7;
ucontrol->value.enumerated.item[1] = (val >> 4) & 7;
mutex_unlock(&ice->gpio_mutex);
return 0;
}
static int wm_adc_mux_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
unsigned short oval, nval;
int change;
snd_ice1712_save_gpio_status(ice);
oval = wm_get(ice, WM_ADC_MUX);
nval = oval & ~0x77;
nval |= ucontrol->value.enumerated.item[0] & 7;
nval |= (ucontrol->value.enumerated.item[1] & 7) << 4;
change = (oval != nval);
if (change)
wm_put(ice, WM_ADC_MUX, nval);
snd_ice1712_restore_gpio_status(ice);
return change;
}
/*
* CS8415 Input mux
*/
static int aureon_cs8415_mux_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
static const char * const aureon_texts[] = {
"CD", /* RXP0 */
"Optical" /* RXP1 */
};
static const char * const prodigy_texts[] = {
"CD",
"Coax"
};
if (ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71)
return snd_ctl_enum_info(uinfo, 1, 2, prodigy_texts);
else
return snd_ctl_enum_info(uinfo, 1, 2, aureon_texts);
}
static int aureon_cs8415_mux_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
struct aureon_spec *spec = ice->spec;
/* snd_ice1712_save_gpio_status(ice); */
/* val = aureon_cs8415_get(ice, CS8415_CTRL2); */
ucontrol->value.enumerated.item[0] = spec->cs8415_mux;
/* snd_ice1712_restore_gpio_status(ice); */
return 0;
}
static int aureon_cs8415_mux_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
struct aureon_spec *spec = ice->spec;
unsigned short oval, nval;
int change;
snd_ice1712_save_gpio_status(ice);
oval = aureon_cs8415_get(ice, CS8415_CTRL2);
nval = oval & ~0x07;
nval |= ucontrol->value.enumerated.item[0] & 7;
change = (oval != nval);
if (change)
aureon_cs8415_put(ice, CS8415_CTRL2, nval);
snd_ice1712_restore_gpio_status(ice);
spec->cs8415_mux = ucontrol->value.enumerated.item[0];
return change;
}
static int aureon_cs8415_rate_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = 1;
uinfo->value.integer.min = 0;
uinfo->value.integer.max = 192000;
return 0;
}
static int aureon_cs8415_rate_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
unsigned char ratio;
ratio = aureon_cs8415_get(ice, CS8415_RATIO);
ucontrol->value.integer.value[0] = (int)((unsigned int)ratio * 750);
return 0;
}
/*
* CS8415A Mute
*/
#define aureon_cs8415_mute_info snd_ctl_boolean_mono_info
static int aureon_cs8415_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
snd_ice1712_save_gpio_status(ice);
ucontrol->value.integer.value[0] = (aureon_cs8415_get(ice, CS8415_CTRL1) & 0x20) ? 0 : 1;
snd_ice1712_restore_gpio_status(ice);
return 0;
}
static int aureon_cs8415_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
unsigned char oval, nval;
int change;
snd_ice1712_save_gpio_status(ice);
oval = aureon_cs8415_get(ice, CS8415_CTRL1);
if (ucontrol->value.integer.value[0])
nval = oval & ~0x20;
else
nval = oval | 0x20;
change = (oval != nval);
if (change)
aureon_cs8415_put(ice, CS8415_CTRL1, nval);
snd_ice1712_restore_gpio_status(ice);
return change;
}
/*
* CS8415A Q-Sub info
*/
static int aureon_cs8415_qsub_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{
uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES;
uinfo->count = 10;
return 0;
}
static int aureon_cs8415_qsub_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
snd_ice1712_save_gpio_status(ice);
aureon_cs8415_read(ice, CS8415_QSUB, ucontrol->value.bytes.data, 10);
snd_ice1712_restore_gpio_status(ice);
return 0;
}
static int aureon_cs8415_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 aureon_cs8415_mask_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
memset(ucontrol->value.iec958.status, 0xFF, 24);
return 0;
}
static int aureon_cs8415_spdif_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
snd_ice1712_save_gpio_status(ice);
aureon_cs8415_read(ice, CS8415_C_BUFFER, ucontrol->value.iec958.status, 24);
snd_ice1712_restore_gpio_status(ice);
return 0;
}
/*
* Headphone Amplifier
*/
static int aureon_set_headphone_amp(struct snd_ice1712 *ice, int enable)
{
unsigned int tmp, tmp2;
tmp2 = tmp = snd_ice1712_gpio_read(ice);
if (enable)
if (ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71LT &&
ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71XT)
tmp |= AUREON_HP_SEL;
else
tmp |= PRODIGY_HP_SEL;
else
if (ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71LT &&
ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71XT)
tmp &= ~AUREON_HP_SEL;
else
tmp &= ~PRODIGY_HP_SEL;
if (tmp != tmp2) {
snd_ice1712_gpio_write(ice, tmp);
return 1;
}
return 0;
}
static int aureon_get_headphone_amp(struct snd_ice1712 *ice)
{
unsigned int tmp = snd_ice1712_gpio_read(ice);
return (tmp & AUREON_HP_SEL) != 0;
}
#define aureon_hpamp_info snd_ctl_boolean_mono_info
static int aureon_hpamp_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
ucontrol->value.integer.value[0] = aureon_get_headphone_amp(ice);
return 0;
}
static int aureon_hpamp_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
return aureon_set_headphone_amp(ice, ucontrol->value.integer.value[0]);
}
/*
* Deemphasis
*/
#define aureon_deemp_info snd_ctl_boolean_mono_info
static int aureon_deemp_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
ucontrol->value.integer.value[0] = (wm_get(ice, WM_DAC_CTRL2) & 0xf) == 0xf;
return 0;
}
static int aureon_deemp_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
int temp, temp2;
temp2 = temp = wm_get(ice, WM_DAC_CTRL2);
if (ucontrol->value.integer.value[0])
temp |= 0xf;
else
temp &= ~0xf;
if (temp != temp2) {
wm_put(ice, WM_DAC_CTRL2, temp);
return 1;
}
return 0;
}
/*
* ADC Oversampling
*/
static int aureon_oversampling_info(struct snd_kcontrol *k, struct snd_ctl_elem_info *uinfo)
{
static const char * const texts[2] = { "128x", "64x" };
return snd_ctl_enum_info(uinfo, 1, 2, texts);
}
static int aureon_oversampling_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
ucontrol->value.enumerated.item[0] = (wm_get(ice, WM_MASTER) & 0x8) == 0x8;
return 0;
}
static int aureon_oversampling_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
int temp, temp2;
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
temp2 = temp = wm_get(ice, WM_MASTER);
if (ucontrol->value.enumerated.item[0])
temp |= 0x8;
else
temp &= ~0x8;
if (temp != temp2) {
wm_put(ice, WM_MASTER, temp);
return 1;
}
return 0;
}
/*
* mixers
*/
static struct snd_kcontrol_new aureon_dac_controls[] = {
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Master Playback Switch",
.info = wm_master_mute_info,
.get = wm_master_mute_get,
.put = wm_master_mute_put
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
SNDRV_CTL_ELEM_ACCESS_TLV_READ),
.name = "Master Playback Volume",
.info = wm_master_vol_info,
.get = wm_master_vol_get,
.put = wm_master_vol_put,
.tlv = { .p = db_scale_wm_dac }
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Front Playback Switch",
.info = wm_mute_info,
.get = wm_mute_get,
.put = wm_mute_put,
.private_value = (2 << 8) | 0
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
SNDRV_CTL_ELEM_ACCESS_TLV_READ),
.name = "Front Playback Volume",
.info = wm_vol_info,
.get = wm_vol_get,
.put = wm_vol_put,
.private_value = (2 << 8) | 0,
.tlv = { .p = db_scale_wm_dac }
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Rear Playback Switch",
.info = wm_mute_info,
.get = wm_mute_get,
.put = wm_mute_put,
.private_value = (2 << 8) | 2
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
SNDRV_CTL_ELEM_ACCESS_TLV_READ),
.name = "Rear Playback Volume",
.info = wm_vol_info,
.get = wm_vol_get,
.put = wm_vol_put,
.private_value = (2 << 8) | 2,
.tlv = { .p = db_scale_wm_dac }
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Center Playback Switch",
.info = wm_mute_info,
.get = wm_mute_get,
.put = wm_mute_put,
.private_value = (1 << 8) | 4
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
SNDRV_CTL_ELEM_ACCESS_TLV_READ),
.name = "Center Playback Volume",
.info = wm_vol_info,
.get = wm_vol_get,
.put = wm_vol_put,
.private_value = (1 << 8) | 4,
.tlv = { .p = db_scale_wm_dac }
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "LFE Playback Switch",
.info = wm_mute_info,
.get = wm_mute_get,
.put = wm_mute_put,
.private_value = (1 << 8) | 5
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
SNDRV_CTL_ELEM_ACCESS_TLV_READ),
.name = "LFE Playback Volume",
.info = wm_vol_info,
.get = wm_vol_get,
.put = wm_vol_put,
.private_value = (1 << 8) | 5,
.tlv = { .p = db_scale_wm_dac }
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Side Playback Switch",
.info = wm_mute_info,
.get = wm_mute_get,
.put = wm_mute_put,
.private_value = (2 << 8) | 6
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
SNDRV_CTL_ELEM_ACCESS_TLV_READ),
.name = "Side Playback Volume",
.info = wm_vol_info,
.get = wm_vol_get,
.put = wm_vol_put,
.private_value = (2 << 8) | 6,
.tlv = { .p = db_scale_wm_dac }
}
};
static struct snd_kcontrol_new wm_controls[] = {
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "PCM Playback Switch",
.info = wm_pcm_mute_info,
.get = wm_pcm_mute_get,
.put = wm_pcm_mute_put
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
SNDRV_CTL_ELEM_ACCESS_TLV_READ),
.name = "PCM Playback Volume",
.info = wm_pcm_vol_info,
.get = wm_pcm_vol_get,
.put = wm_pcm_vol_put,
.tlv = { .p = db_scale_wm_pcm }
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Capture Switch",
.info = wm_adc_mute_info,
.get = wm_adc_mute_get,
.put = wm_adc_mute_put,
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
SNDRV_CTL_ELEM_ACCESS_TLV_READ),
.name = "Capture Volume",
.info = wm_adc_vol_info,
.get = wm_adc_vol_get,
.put = wm_adc_vol_put,
.tlv = { .p = db_scale_wm_adc }
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Capture Source",
.info = wm_adc_mux_info,
.get = wm_adc_mux_get,
.put = wm_adc_mux_put,
.private_value = 5
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "External Amplifier",
.info = aureon_hpamp_info,
.get = aureon_hpamp_get,
.put = aureon_hpamp_put
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "DAC Deemphasis Switch",
.info = aureon_deemp_info,
.get = aureon_deemp_get,
.put = aureon_deemp_put
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "ADC Oversampling",
.info = aureon_oversampling_info,
.get = aureon_oversampling_get,
.put = aureon_oversampling_put
}
};
static struct snd_kcontrol_new ac97_controls[] = {
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "AC97 Playback Switch",
.info = aureon_ac97_mmute_info,
.get = aureon_ac97_mmute_get,
.put = aureon_ac97_mmute_put,
.private_value = AC97_MASTER
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
SNDRV_CTL_ELEM_ACCESS_TLV_READ),
.name = "AC97 Playback Volume",
.info = aureon_ac97_vol_info,
.get = aureon_ac97_vol_get,
.put = aureon_ac97_vol_put,
.private_value = AC97_MASTER|AUREON_AC97_STEREO,
.tlv = { .p = db_scale_ac97_master }
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "CD Playback Switch",
.info = aureon_ac97_mute_info,
.get = aureon_ac97_mute_get,
.put = aureon_ac97_mute_put,
.private_value = AC97_CD
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
SNDRV_CTL_ELEM_ACCESS_TLV_READ),
.name = "CD Playback Volume",
.info = aureon_ac97_vol_info,
.get = aureon_ac97_vol_get,
.put = aureon_ac97_vol_put,
.private_value = AC97_CD|AUREON_AC97_STEREO,
.tlv = { .p = db_scale_ac97_gain }
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Aux Playback Switch",
.info = aureon_ac97_mute_info,
.get = aureon_ac97_mute_get,
.put = aureon_ac97_mute_put,
.private_value = AC97_AUX,
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
SNDRV_CTL_ELEM_ACCESS_TLV_READ),
.name = "Aux Playback Volume",
.info = aureon_ac97_vol_info,
.get = aureon_ac97_vol_get,
.put = aureon_ac97_vol_put,
.private_value = AC97_AUX|AUREON_AC97_STEREO,
.tlv = { .p = db_scale_ac97_gain }
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Line Playback Switch",
.info = aureon_ac97_mute_info,
.get = aureon_ac97_mute_get,
.put = aureon_ac97_mute_put,
.private_value = AC97_LINE
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
SNDRV_CTL_ELEM_ACCESS_TLV_READ),
.name = "Line Playback Volume",
.info = aureon_ac97_vol_info,
.get = aureon_ac97_vol_get,
.put = aureon_ac97_vol_put,
.private_value = AC97_LINE|AUREON_AC97_STEREO,
.tlv = { .p = db_scale_ac97_gain }
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Mic Playback Switch",
.info = aureon_ac97_mute_info,
.get = aureon_ac97_mute_get,
.put = aureon_ac97_mute_put,
.private_value = AC97_MIC
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
SNDRV_CTL_ELEM_ACCESS_TLV_READ),
.name = "Mic Playback Volume",
.info = aureon_ac97_vol_info,
.get = aureon_ac97_vol_get,
.put = aureon_ac97_vol_put,
.private_value = AC97_MIC,
.tlv = { .p = db_scale_ac97_gain }
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Mic Boost (+20dB)",
.info = aureon_ac97_micboost_info,
.get = aureon_ac97_micboost_get,
.put = aureon_ac97_micboost_put
}
};
static struct snd_kcontrol_new universe_ac97_controls[] = {
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "AC97 Playback Switch",
.info = aureon_ac97_mmute_info,
.get = aureon_ac97_mmute_get,
.put = aureon_ac97_mmute_put,
.private_value = AC97_MASTER
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
SNDRV_CTL_ELEM_ACCESS_TLV_READ),
.name = "AC97 Playback Volume",
.info = aureon_ac97_vol_info,
.get = aureon_ac97_vol_get,
.put = aureon_ac97_vol_put,
.private_value = AC97_MASTER|AUREON_AC97_STEREO,
.tlv = { .p = db_scale_ac97_master }
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "CD Playback Switch",
.info = aureon_ac97_mute_info,
.get = aureon_ac97_mute_get,
.put = aureon_ac97_mute_put,
.private_value = AC97_AUX
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
SNDRV_CTL_ELEM_ACCESS_TLV_READ),
.name = "CD Playback Volume",
.info = aureon_ac97_vol_info,
.get = aureon_ac97_vol_get,
.put = aureon_ac97_vol_put,
.private_value = AC97_AUX|AUREON_AC97_STEREO,
.tlv = { .p = db_scale_ac97_gain }
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Phono Playback Switch",
.info = aureon_ac97_mute_info,
.get = aureon_ac97_mute_get,
.put = aureon_ac97_mute_put,
.private_value = AC97_CD
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
SNDRV_CTL_ELEM_ACCESS_TLV_READ),
.name = "Phono Playback Volume",
.info = aureon_ac97_vol_info,
.get = aureon_ac97_vol_get,
.put = aureon_ac97_vol_put,
.private_value = AC97_CD|AUREON_AC97_STEREO,
.tlv = { .p = db_scale_ac97_gain }
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Line Playback Switch",
.info = aureon_ac97_mute_info,
.get = aureon_ac97_mute_get,
.put = aureon_ac97_mute_put,
.private_value = AC97_LINE
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
SNDRV_CTL_ELEM_ACCESS_TLV_READ),
.name = "Line Playback Volume",
.info = aureon_ac97_vol_info,
.get = aureon_ac97_vol_get,
.put = aureon_ac97_vol_put,
.private_value = AC97_LINE|AUREON_AC97_STEREO,
.tlv = { .p = db_scale_ac97_gain }
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Mic Playback Switch",
.info = aureon_ac97_mute_info,
.get = aureon_ac97_mute_get,
.put = aureon_ac97_mute_put,
.private_value = AC97_MIC
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
SNDRV_CTL_ELEM_ACCESS_TLV_READ),
.name = "Mic Playback Volume",
.info = aureon_ac97_vol_info,
.get = aureon_ac97_vol_get,
.put = aureon_ac97_vol_put,
.private_value = AC97_MIC,
.tlv = { .p = db_scale_ac97_gain }
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Mic Boost (+20dB)",
.info = aureon_ac97_micboost_info,
.get = aureon_ac97_micboost_get,
.put = aureon_ac97_micboost_put
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Aux Playback Switch",
.info = aureon_ac97_mute_info,
.get = aureon_ac97_mute_get,
.put = aureon_ac97_mute_put,
.private_value = AC97_VIDEO,
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
SNDRV_CTL_ELEM_ACCESS_TLV_READ),
.name = "Aux Playback Volume",
.info = aureon_ac97_vol_info,
.get = aureon_ac97_vol_get,
.put = aureon_ac97_vol_put,
.private_value = AC97_VIDEO|AUREON_AC97_STEREO,
.tlv = { .p = db_scale_ac97_gain }
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Aux Source",
.info = aureon_universe_inmux_info,
.get = aureon_universe_inmux_get,
.put = aureon_universe_inmux_put
}
};
static struct snd_kcontrol_new cs8415_controls[] = {
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = SNDRV_CTL_NAME_IEC958("", CAPTURE, SWITCH),
.info = aureon_cs8415_mute_info,
.get = aureon_cs8415_mute_get,
.put = aureon_cs8415_mute_put
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = SNDRV_CTL_NAME_IEC958("", CAPTURE, NONE) "Source",
.info = aureon_cs8415_mux_info,
.get = aureon_cs8415_mux_get,
.put = aureon_cs8415_mux_put,
},
{
.iface = SNDRV_CTL_ELEM_IFACE_PCM,
.name = SNDRV_CTL_NAME_IEC958("Q-subcode ", CAPTURE, DEFAULT),
.access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
.info = aureon_cs8415_qsub_info,
.get = aureon_cs8415_qsub_get,
},
{
.iface = SNDRV_CTL_ELEM_IFACE_PCM,
.name = SNDRV_CTL_NAME_IEC958("", CAPTURE, MASK),
.access = SNDRV_CTL_ELEM_ACCESS_READ,
.info = aureon_cs8415_spdif_info,
.get = aureon_cs8415_mask_get
},
{
.iface = SNDRV_CTL_ELEM_IFACE_PCM,
.name = SNDRV_CTL_NAME_IEC958("", CAPTURE, DEFAULT),
.access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
.info = aureon_cs8415_spdif_info,
.get = aureon_cs8415_spdif_get
},
{
.iface = SNDRV_CTL_ELEM_IFACE_PCM,
.name = SNDRV_CTL_NAME_IEC958("", CAPTURE, NONE) "Rate",
.access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
.info = aureon_cs8415_rate_info,
.get = aureon_cs8415_rate_get
}
};
static int aureon_add_controls(struct snd_ice1712 *ice)
{
unsigned int i, counts;
int err;
counts = ARRAY_SIZE(aureon_dac_controls);
if (ice->eeprom.subvendor == VT1724_SUBDEVICE_AUREON51_SKY)
counts -= 2; /* no side */
for (i = 0; i < counts; i++) {
err = snd_ctl_add(ice->card, snd_ctl_new1(&aureon_dac_controls[i], ice));
if (err < 0)
return err;
}
for (i = 0; i < ARRAY_SIZE(wm_controls); i++) {
err = snd_ctl_add(ice->card, snd_ctl_new1(&wm_controls[i], ice));
if (err < 0)
return err;
}
if (ice->eeprom.subvendor == VT1724_SUBDEVICE_AUREON71_UNIVERSE) {
for (i = 0; i < ARRAY_SIZE(universe_ac97_controls); i++) {
err = snd_ctl_add(ice->card, snd_ctl_new1(&universe_ac97_controls[i], ice));
if (err < 0)
return err;
}
} else if (ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71LT &&
ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71XT) {
for (i = 0; i < ARRAY_SIZE(ac97_controls); i++) {
err = snd_ctl_add(ice->card, snd_ctl_new1(&ac97_controls[i], ice));
if (err < 0)
return err;
}
}
if (ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71LT &&
ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71XT) {
unsigned char id;
snd_ice1712_save_gpio_status(ice);
id = aureon_cs8415_get(ice, CS8415_ID);
if (id != 0x41)
dev_info(ice->card->dev,
"No CS8415 chip. Skipping CS8415 controls.\n");
else if ((id & 0x0F) != 0x01)
dev_info(ice->card->dev,
"Detected unsupported CS8415 rev. (%c)\n",
(char)((id & 0x0F) + 'A' - 1));
else {
for (i = 0; i < ARRAY_SIZE(cs8415_controls); i++) {
struct snd_kcontrol *kctl;
err = snd_ctl_add(ice->card, (kctl = snd_ctl_new1(&cs8415_controls[i], ice)));
if (err < 0)
return err;
if (i > 1)
kctl->id.device = ice->pcm->device;
}
}
snd_ice1712_restore_gpio_status(ice);
}
return 0;
}
/*
* reset the chip
*/
static int aureon_reset(struct snd_ice1712 *ice)
{
static const unsigned short wm_inits_aureon[] = {
/* These come first to reduce init pop noise */
0x1b, 0x044, /* ADC Mux (AC'97 source) */
0x1c, 0x00B, /* Out Mux1 (VOUT1 = DAC+AUX, VOUT2 = DAC) */
0x1d, 0x009, /* Out Mux2 (VOUT2 = DAC, VOUT3 = DAC) */
0x18, 0x000, /* All power-up */
0x16, 0x122, /* I2S, normal polarity, 24bit */
0x17, 0x022, /* 256fs, slave mode */
0x00, 0, /* DAC1 analog mute */
0x01, 0, /* DAC2 analog mute */
0x02, 0, /* DAC3 analog mute */
0x03, 0, /* DAC4 analog mute */
0x04, 0, /* DAC5 analog mute */
0x05, 0, /* DAC6 analog mute */
0x06, 0, /* DAC7 analog mute */
0x07, 0, /* DAC8 analog mute */
0x08, 0x100, /* master analog mute */
0x09, 0xff, /* DAC1 digital full */
0x0a, 0xff, /* DAC2 digital full */
0x0b, 0xff, /* DAC3 digital full */
0x0c, 0xff, /* DAC4 digital full */
0x0d, 0xff, /* DAC5 digital full */
0x0e, 0xff, /* DAC6 digital full */
0x0f, 0xff, /* DAC7 digital full */
0x10, 0xff, /* DAC8 digital full */
0x11, 0x1ff, /* master digital full */
0x12, 0x000, /* phase normal */
0x13, 0x090, /* unmute DAC L/R */
0x14, 0x000, /* all unmute */
0x15, 0x000, /* no deemphasis, no ZFLG */
0x19, 0x000, /* -12dB ADC/L */
0x1a, 0x000, /* -12dB ADC/R */
(unsigned short)-1
};
static const unsigned short wm_inits_prodigy[] = {
/* These come first to reduce init pop noise */
0x1b, 0x000, /* ADC Mux */
0x1c, 0x009, /* Out Mux1 */
0x1d, 0x009, /* Out Mux2 */
0x18, 0x000, /* All power-up */
0x16, 0x022, /* I2S, normal polarity, 24bit, high-pass on */
0x17, 0x006, /* 128fs, slave mode */
0x00, 0, /* DAC1 analog mute */
0x01, 0, /* DAC2 analog mute */
0x02, 0, /* DAC3 analog mute */
0x03, 0, /* DAC4 analog mute */
0x04, 0, /* DAC5 analog mute */
0x05, 0, /* DAC6 analog mute */
0x06, 0, /* DAC7 analog mute */
0x07, 0, /* DAC8 analog mute */
0x08, 0x100, /* master analog mute */
0x09, 0x7f, /* DAC1 digital full */
0x0a, 0x7f, /* DAC2 digital full */
0x0b, 0x7f, /* DAC3 digital full */
0x0c, 0x7f, /* DAC4 digital full */
0x0d, 0x7f, /* DAC5 digital full */
0x0e, 0x7f, /* DAC6 digital full */
0x0f, 0x7f, /* DAC7 digital full */
0x10, 0x7f, /* DAC8 digital full */
0x11, 0x1FF, /* master digital full */
0x12, 0x000, /* phase normal */
0x13, 0x090, /* unmute DAC L/R */
0x14, 0x000, /* all unmute */
0x15, 0x000, /* no deemphasis, no ZFLG */
0x19, 0x000, /* -12dB ADC/L */
0x1a, 0x000, /* -12dB ADC/R */
(unsigned short)-1
};
static const unsigned short cs_inits[] = {
0x0441, /* RUN */
0x0180, /* no mute, OMCK output on RMCK pin */
0x0201, /* S/PDIF source on RXP1 */
0x0605, /* slave, 24bit, MSB on second OSCLK, SDOUT for right channel when OLRCK is high */
(unsigned short)-1
};
unsigned int tmp;
const unsigned short *p;
int err;
struct aureon_spec *spec = ice->spec;
err = aureon_ac97_init(ice);
if (err != 0)
return err;
snd_ice1712_gpio_set_dir(ice, 0x5fffff); /* fix this for the time being */
/* reset the wm codec as the SPI mode */
snd_ice1712_save_gpio_status(ice);
snd_ice1712_gpio_set_mask(ice, ~(AUREON_WM_RESET|AUREON_WM_CS|AUREON_CS8415_CS|AUREON_HP_SEL));
tmp = snd_ice1712_gpio_read(ice);
tmp &= ~AUREON_WM_RESET;
snd_ice1712_gpio_write(ice, tmp);
udelay(1);
tmp |= AUREON_WM_CS | AUREON_CS8415_CS;
snd_ice1712_gpio_write(ice, tmp);
udelay(1);
tmp |= AUREON_WM_RESET;
snd_ice1712_gpio_write(ice, tmp);
udelay(1);
/* initialize WM8770 codec */
if (ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71 ||
ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71LT ||
ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71XT)
p = wm_inits_prodigy;
else
p = wm_inits_aureon;
for (; *p != (unsigned short)-1; p += 2)
wm_put(ice, p[0], p[1]);
/* initialize CS8415A codec */
if (ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71LT &&
ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71XT) {
for (p = cs_inits; *p != (unsigned short)-1; p++)
aureon_spi_write(ice, AUREON_CS8415_CS, *p | 0x200000, 24);
spec->cs8415_mux = 1;
aureon_set_headphone_amp(ice, 1);
}
snd_ice1712_restore_gpio_status(ice);
/* initialize PCA9554 pin directions & set default input */
aureon_pca9554_write(ice, PCA9554_DIR, 0x00);
aureon_pca9554_write(ice, PCA9554_OUT, 0x00); /* internal AUX */
return 0;
}
/*
* suspend/resume
*/
#ifdef CONFIG_PM_SLEEP
static int aureon_resume(struct snd_ice1712 *ice)
{
struct aureon_spec *spec = ice->spec;
int err, i;
err = aureon_reset(ice);
if (err != 0)
return err;
/* workaround for poking volume with alsamixer after resume:
* just set stored volume again */
for (i = 0; i < ice->num_total_dacs; i++)
wm_set_vol(ice, i, spec->vol[i], spec->master[i % 2]);
return 0;
}
#endif
/*
* initialize the chip
*/
static int aureon_init(struct snd_ice1712 *ice)
{
struct aureon_spec *spec;
int i, err;
spec = kzalloc(sizeof(*spec), GFP_KERNEL);
if (!spec)
return -ENOMEM;
ice->spec = spec;
if (ice->eeprom.subvendor == VT1724_SUBDEVICE_AUREON51_SKY) {
ice->num_total_dacs = 6;
ice->num_total_adcs = 2;
} else {
/* aureon 7.1 and prodigy 7.1 */
ice->num_total_dacs = 8;
ice->num_total_adcs = 2;
}
/* to remember the register values of CS8415 */
ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL);
if (!ice->akm)
return -ENOMEM;
ice->akm_codecs = 1;
err = aureon_reset(ice);
if (err != 0)
return err;
spec->master[0] = WM_VOL_MUTE;
spec->master[1] = WM_VOL_MUTE;
for (i = 0; i < ice->num_total_dacs; i++) {
spec->vol[i] = WM_VOL_MUTE;
wm_set_vol(ice, i, spec->vol[i], spec->master[i % 2]);
}
#ifdef CONFIG_PM_SLEEP
ice->pm_resume = aureon_resume;
ice->pm_suspend_enabled = 1;
#endif
return 0;
}
/*
* Aureon boards don't provide the EEPROM data except for the vendor IDs.
* hence the driver needs to sets up it properly.
*/
static unsigned char aureon51_eeprom[] = {
[ICE_EEP2_SYSCONF] = 0x0a, /* clock 512, spdif-in/ADC, 3DACs */
[ICE_EEP2_ACLINK] = 0x80, /* I2S */
[ICE_EEP2_I2S] = 0xfc, /* vol, 96k, 24bit, 192k */
[ICE_EEP2_SPDIF] = 0xc3, /* out-en, out-int, spdif-in */
[ICE_EEP2_GPIO_DIR] = 0xff,
[ICE_EEP2_GPIO_DIR1] = 0xff,
[ICE_EEP2_GPIO_DIR2] = 0x5f,
[ICE_EEP2_GPIO_MASK] = 0x00,
[ICE_EEP2_GPIO_MASK1] = 0x00,
[ICE_EEP2_GPIO_MASK2] = 0x00,
[ICE_EEP2_GPIO_STATE] = 0x00,
[ICE_EEP2_GPIO_STATE1] = 0x00,
[ICE_EEP2_GPIO_STATE2] = 0x00,
};
static unsigned char aureon71_eeprom[] = {
[ICE_EEP2_SYSCONF] = 0x0b, /* clock 512, spdif-in/ADC, 4DACs */
[ICE_EEP2_ACLINK] = 0x80, /* I2S */
[ICE_EEP2_I2S] = 0xfc, /* vol, 96k, 24bit, 192k */
[ICE_EEP2_SPDIF] = 0xc3, /* out-en, out-int, spdif-in */
[ICE_EEP2_GPIO_DIR] = 0xff,
[ICE_EEP2_GPIO_DIR1] = 0xff,
[ICE_EEP2_GPIO_DIR2] = 0x5f,
[ICE_EEP2_GPIO_MASK] = 0x00,
[ICE_EEP2_GPIO_MASK1] = 0x00,
[ICE_EEP2_GPIO_MASK2] = 0x00,
[ICE_EEP2_GPIO_STATE] = 0x00,
[ICE_EEP2_GPIO_STATE1] = 0x00,
[ICE_EEP2_GPIO_STATE2] = 0x00,
};
#define prodigy71_eeprom aureon71_eeprom
static unsigned char aureon71_universe_eeprom[] = {
[ICE_EEP2_SYSCONF] = 0x2b, /* clock 512, mpu401, spdif-in/ADC,
* 4DACs
*/
[ICE_EEP2_ACLINK] = 0x80, /* I2S */
[ICE_EEP2_I2S] = 0xfc, /* vol, 96k, 24bit, 192k */
[ICE_EEP2_SPDIF] = 0xc3, /* out-en, out-int, spdif-in */
[ICE_EEP2_GPIO_DIR] = 0xff,
[ICE_EEP2_GPIO_DIR1] = 0xff,
[ICE_EEP2_GPIO_DIR2] = 0x5f,
[ICE_EEP2_GPIO_MASK] = 0x00,
[ICE_EEP2_GPIO_MASK1] = 0x00,
[ICE_EEP2_GPIO_MASK2] = 0x00,
[ICE_EEP2_GPIO_STATE] = 0x00,
[ICE_EEP2_GPIO_STATE1] = 0x00,
[ICE_EEP2_GPIO_STATE2] = 0x00,
};
static unsigned char prodigy71lt_eeprom[] = {
[ICE_EEP2_SYSCONF] = 0x4b, /* clock 384, spdif-in/ADC, 4DACs */
[ICE_EEP2_ACLINK] = 0x80, /* I2S */
[ICE_EEP2_I2S] = 0xfc, /* vol, 96k, 24bit, 192k */
[ICE_EEP2_SPDIF] = 0xc3, /* out-en, out-int, spdif-in */
[ICE_EEP2_GPIO_DIR] = 0xff,
[ICE_EEP2_GPIO_DIR1] = 0xff,
[ICE_EEP2_GPIO_DIR2] = 0x5f,
[ICE_EEP2_GPIO_MASK] = 0x00,
[ICE_EEP2_GPIO_MASK1] = 0x00,
[ICE_EEP2_GPIO_MASK2] = 0x00,
[ICE_EEP2_GPIO_STATE] = 0x00,
[ICE_EEP2_GPIO_STATE1] = 0x00,
[ICE_EEP2_GPIO_STATE2] = 0x00,
};
#define prodigy71xt_eeprom prodigy71lt_eeprom
/* entry point */
struct snd_ice1712_card_info snd_vt1724_aureon_cards[] = {
{
.subvendor = VT1724_SUBDEVICE_AUREON51_SKY,
.name = "Terratec Aureon 5.1-Sky",
.model = "aureon51",
.chip_init = aureon_init,
.build_controls = aureon_add_controls,
.eeprom_size = sizeof(aureon51_eeprom),
.eeprom_data = aureon51_eeprom,
.driver = "Aureon51",
},
{
.subvendor = VT1724_SUBDEVICE_AUREON71_SPACE,
.name = "Terratec Aureon 7.1-Space",
.model = "aureon71",
.chip_init = aureon_init,
.build_controls = aureon_add_controls,
.eeprom_size = sizeof(aureon71_eeprom),
.eeprom_data = aureon71_eeprom,
.driver = "Aureon71",
},
{
.subvendor = VT1724_SUBDEVICE_AUREON71_UNIVERSE,
.name = "Terratec Aureon 7.1-Universe",
.model = "universe",
.chip_init = aureon_init,
.build_controls = aureon_add_controls,
.eeprom_size = sizeof(aureon71_universe_eeprom),
.eeprom_data = aureon71_universe_eeprom,
.driver = "Aureon71Univ", /* keep in 15 letters */
},
{
.subvendor = VT1724_SUBDEVICE_PRODIGY71,
.name = "Audiotrak Prodigy 7.1",
.model = "prodigy71",
.chip_init = aureon_init,
.build_controls = aureon_add_controls,
.eeprom_size = sizeof(prodigy71_eeprom),
.eeprom_data = prodigy71_eeprom,
.driver = "Prodigy71", /* should be identical with Aureon71 */
},
{
.subvendor = VT1724_SUBDEVICE_PRODIGY71LT,
.name = "Audiotrak Prodigy 7.1 LT",
.model = "prodigy71lt",
.chip_init = aureon_init,
.build_controls = aureon_add_controls,
.eeprom_size = sizeof(prodigy71lt_eeprom),
.eeprom_data = prodigy71lt_eeprom,
.driver = "Prodigy71LT",
},
{
.subvendor = VT1724_SUBDEVICE_PRODIGY71XT,
.name = "Audiotrak Prodigy 7.1 XT",
.model = "prodigy71xt",
.chip_init = aureon_init,
.build_controls = aureon_add_controls,
.eeprom_size = sizeof(prodigy71xt_eeprom),
.eeprom_data = prodigy71xt_eeprom,
.driver = "Prodigy71LT",
},
{ } /* terminator */
};
| {
"pile_set_name": "Github"
} |
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include <spirv/spirv.h>
_CLC_OVERLOAD _CLC_DEF void __spirv_GroupWaitEvents(unsigned int scope,
int num_events,
event_t *event_list) {
__spirv_ControlBarrier(scope, Workgroup, SequentiallyConsistent);
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
-0 | {
"pile_set_name": "Github"
} |
/*
* Copyright 2006-2009, 2017, 2020 United States Government, as represented by the
* Administrator of the National Aeronautics and Space Administration.
* All rights reserved.
*
* The NASA World Wind Java (WWJ) platform is 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.
*
* NASA World Wind Java (WWJ) also contains the following 3rd party Open Source
* software:
*
* Jackson Parser – Licensed under Apache 2.0
* GDAL – Licensed under MIT
* JOGL – Licensed under Berkeley Software Distribution (BSD)
* Gluegen – Licensed under Berkeley Software Distribution (BSD)
*
* A complete listing of 3rd Party software notices and licenses included in
* NASA World Wind Java (WWJ) can be found in the WorldWindJava-v2.2 3rd-party
* notices and licenses PDF found in code directory.
*/
package gov.nasa.worldwind.ogc.wcs;
import gov.nasa.worldwind.avlist.*;
import gov.nasa.worldwind.geom.Sector;
import gov.nasa.worldwind.ogc.wcs.wcs100.*;
import gov.nasa.worldwind.terrain.WCSElevationModel;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import javax.xml.stream.XMLStreamException;
import java.io.File;
import static org.junit.Assert.*;
@RunWith(JUnit4.class)
public class WCSElevationModelCreationTest
{
@Test
public void test001()
{
WCSElevationModel elevationModel = this.createWCSElevationModel(
new WCS100Capabilities("testData/WCS/WCSCapabilities003.xml"),
new WCS100DescribeCoverage("testData/WCS/WCSDescribeCoverage001.xml"));
assertEquals("Incorrect number of levels", 5, elevationModel.getLevels().getNumLevels());
double bestResolution = elevationModel.getBestResolution(Sector.FULL_SPHERE) * 180.0 / Math.PI;
assertTrue("Incorrect best resolution", bestResolution > 0.0083 && bestResolution < 0.0084);
assertEquals("Min elevation incorrect", -11000.0, elevationModel.getMinElevation(), 0.0);
assertEquals("Max elevation incorrect", 8850.0, elevationModel.getMaxElevation(), 0.0);
assertEquals("Incorrect dataset name", "WW:NASA_SRTM30_900m_Tiled",
elevationModel.getLevels().getFirstLevel().getDataset());
assertEquals("Incorrect format suffix", ".tif",
elevationModel.getLevels().getFirstLevel().getFormatSuffix());
assertEquals("Incorrect cache name",
"worldwind26.arc.nasa.gov" + File.separator + "_wms2" + File.separator + "WW_NASA_SRTM30_900m_Tiled",
elevationModel.getLevels().getFirstLevel().getCacheName());
}
@Test
public void testRestoreState()
{
WCSElevationModel origElevationModel = this.createWCSElevationModel(
new WCS100Capabilities("testData/WCS/WCSCapabilities003.xml"),
new WCS100DescribeCoverage("testData/WCS/WCSDescribeCoverage001.xml"));
String restorableState = origElevationModel.getRestorableState();
WCSElevationModel newElevationModel = new WCSElevationModel(restorableState);
assertEquals("Incorrect number of levels",
origElevationModel.getLevels().getNumLevels(),
newElevationModel.getLevels().getNumLevels());
double epsilon = 0.0001;
double origBestResolution = origElevationModel.getBestResolution(Sector.FULL_SPHERE);
double newBestResolution = newElevationModel.getBestResolution(Sector.FULL_SPHERE);
assertTrue("Incorrect best resolution", Math.abs(origBestResolution - newBestResolution) < epsilon);
assertEquals("Min elevation incorrect", origElevationModel.getMinElevation(),
newElevationModel.getMinElevation(), 0.0);
assertEquals("Max elevation incorrect", origElevationModel.getMaxElevation(),
newElevationModel.getMaxElevation(), 0.0);
assertEquals("Incorrect dataset name",
origElevationModel.getLevels().getFirstLevel().getDataset(),
newElevationModel.getLevels().getFirstLevel().getDataset());
assertEquals("Incorrect format suffix",
origElevationModel.getLevels().getFirstLevel().getFormatSuffix(),
newElevationModel.getLevels().getFirstLevel().getFormatSuffix());
assertEquals("Incorrect cache name",
origElevationModel.getLevels().getFirstLevel().getCacheName(),
newElevationModel.getLevels().getFirstLevel().getCacheName());
}
private WCSElevationModel createWCSElevationModel(WCS100Capabilities caps, WCS100DescribeCoverage coverage)
{
try
{
caps.parse();
coverage.parse();
}
catch (XMLStreamException e)
{
e.printStackTrace();
}
AVList params = new AVListImpl();
params.setValue(AVKey.DOCUMENT, coverage);
return new WCSElevationModel(caps, params);
}
}
| {
"pile_set_name": "Github"
} |
cue def -e '#Foo' x.cue
cmp stdout expect-stdout
-- expect-stdout --
#_def
#_def: {
x: int
body?: {
a: int
b?: string
}
}
-- x.cue --
package example
#Foo: {
x: int
body?: {
a: int
b?: string
}
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this file,
- You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!--
XUL Widget Test for preferences window with onsyncfrompreference
This test ensures that onsyncfrompreference handlers are called after all the
values of the corresponding preference element have been set correctly
-->
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
class="prefwindow"
title="preferences window"
width="300" height="300"
windowtype="test:preferences"
onload="onLoad()">
<dialog>
<script type="application/javascript" src="chrome://global/content/preferencesBindings.js"/>
<script type="application/javascript">
<![CDATA[
Preferences.addAll([
{ id: "tests.onsyncfrompreference.pref1", type: "int" },
{ id: "tests.onsyncfrompreference.pref2", type: "int" },
{ id: "tests.onsyncfrompreference.pref3", type: "int" },
]);
function onLoad() {
Preferences.addSyncFromPrefListener(document.getElementById("check1"),
() => window.arguments[0]());
Preferences.addSyncFromPrefListener(document.getElementById("check2"),
() => window.arguments[0]());
Preferences.addSyncFromPrefListener(document.getElementById("check3"),
() => window.arguments[0]());
Preferences.addSyncToPrefListener(document.getElementById("check1"),
() => 1);
Preferences.addSyncToPrefListener(document.getElementById("check2"),
() => 1);
Preferences.addSyncToPrefListener(document.getElementById("check3"),
() => 1);
}
]]>
</script>
<vbox id="sample_pane" class="prefpane" label="Sample Prefpane">
</vbox>
<label>Test Prefpane</label>
<checkbox id="check1" label="Label1"
preference="tests.onsyncfrompreference.pref1"/>
<checkbox id="check2" label="Label2"
preference="tests.onsyncfrompreference.pref2"/>
<checkbox id="check3" label="Label3"
preference="tests.onsyncfrompreference.pref3"/>
</dialog>
</window>
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2014 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
*/
#include <drm/amdgpu_drm.h>
#include "amdgpu.h"
#include "atom.h"
#include "atombios_encoders.h"
#include "amdgpu_pll.h"
#include <asm/div64.h>
#include <linux/gcd.h>
/**
* amdgpu_pll_reduce_ratio - fractional number reduction
*
* @nom: nominator
* @den: denominator
* @nom_min: minimum value for nominator
* @den_min: minimum value for denominator
*
* Find the greatest common divisor and apply it on both nominator and
* denominator, but make nominator and denominator are at least as large
* as their minimum values.
*/
static void amdgpu_pll_reduce_ratio(unsigned *nom, unsigned *den,
unsigned nom_min, unsigned den_min)
{
unsigned tmp;
/* reduce the numbers to a simpler ratio */
tmp = gcd(*nom, *den);
*nom /= tmp;
*den /= tmp;
/* make sure nominator is large enough */
if (*nom < nom_min) {
tmp = DIV_ROUND_UP(nom_min, *nom);
*nom *= tmp;
*den *= tmp;
}
/* make sure the denominator is large enough */
if (*den < den_min) {
tmp = DIV_ROUND_UP(den_min, *den);
*nom *= tmp;
*den *= tmp;
}
}
/**
* amdgpu_pll_get_fb_ref_div - feedback and ref divider calculation
*
* @nom: nominator
* @den: denominator
* @post_div: post divider
* @fb_div_max: feedback divider maximum
* @ref_div_max: reference divider maximum
* @fb_div: resulting feedback divider
* @ref_div: resulting reference divider
*
* Calculate feedback and reference divider for a given post divider. Makes
* sure we stay within the limits.
*/
static void amdgpu_pll_get_fb_ref_div(unsigned nom, unsigned den, unsigned post_div,
unsigned fb_div_max, unsigned ref_div_max,
unsigned *fb_div, unsigned *ref_div)
{
/* limit reference * post divider to a maximum */
ref_div_max = min(128 / post_div, ref_div_max);
/* get matching reference and feedback divider */
*ref_div = min(max(DIV_ROUND_CLOSEST(den, post_div), 1u), ref_div_max);
*fb_div = DIV_ROUND_CLOSEST(nom * *ref_div * post_div, den);
/* limit fb divider to its maximum */
if (*fb_div > fb_div_max) {
*ref_div = DIV_ROUND_CLOSEST(*ref_div * fb_div_max, *fb_div);
*fb_div = fb_div_max;
}
}
/**
* amdgpu_pll_compute - compute PLL paramaters
*
* @pll: information about the PLL
* @dot_clock_p: resulting pixel clock
* fb_div_p: resulting feedback divider
* frac_fb_div_p: fractional part of the feedback divider
* ref_div_p: resulting reference divider
* post_div_p: resulting reference divider
*
* Try to calculate the PLL parameters to generate the given frequency:
* dot_clock = (ref_freq * feedback_div) / (ref_div * post_div)
*/
void amdgpu_pll_compute(struct amdgpu_pll *pll,
u32 freq,
u32 *dot_clock_p,
u32 *fb_div_p,
u32 *frac_fb_div_p,
u32 *ref_div_p,
u32 *post_div_p)
{
unsigned target_clock = pll->flags & AMDGPU_PLL_USE_FRAC_FB_DIV ?
freq : freq / 10;
unsigned fb_div_min, fb_div_max, fb_div;
unsigned post_div_min, post_div_max, post_div;
unsigned ref_div_min, ref_div_max, ref_div;
unsigned post_div_best, diff_best;
unsigned nom, den;
/* determine allowed feedback divider range */
fb_div_min = pll->min_feedback_div;
fb_div_max = pll->max_feedback_div;
if (pll->flags & AMDGPU_PLL_USE_FRAC_FB_DIV) {
fb_div_min *= 10;
fb_div_max *= 10;
}
/* determine allowed ref divider range */
if (pll->flags & AMDGPU_PLL_USE_REF_DIV)
ref_div_min = pll->reference_div;
else
ref_div_min = pll->min_ref_div;
if (pll->flags & AMDGPU_PLL_USE_FRAC_FB_DIV &&
pll->flags & AMDGPU_PLL_USE_REF_DIV)
ref_div_max = pll->reference_div;
else
ref_div_max = pll->max_ref_div;
/* determine allowed post divider range */
if (pll->flags & AMDGPU_PLL_USE_POST_DIV) {
post_div_min = pll->post_div;
post_div_max = pll->post_div;
} else {
unsigned vco_min, vco_max;
if (pll->flags & AMDGPU_PLL_IS_LCD) {
vco_min = pll->lcd_pll_out_min;
vco_max = pll->lcd_pll_out_max;
} else {
vco_min = pll->pll_out_min;
vco_max = pll->pll_out_max;
}
if (pll->flags & AMDGPU_PLL_USE_FRAC_FB_DIV) {
vco_min *= 10;
vco_max *= 10;
}
post_div_min = vco_min / target_clock;
if ((target_clock * post_div_min) < vco_min)
++post_div_min;
if (post_div_min < pll->min_post_div)
post_div_min = pll->min_post_div;
post_div_max = vco_max / target_clock;
if ((target_clock * post_div_max) > vco_max)
--post_div_max;
if (post_div_max > pll->max_post_div)
post_div_max = pll->max_post_div;
}
/* represent the searched ratio as fractional number */
nom = target_clock;
den = pll->reference_freq;
/* reduce the numbers to a simpler ratio */
amdgpu_pll_reduce_ratio(&nom, &den, fb_div_min, post_div_min);
/* now search for a post divider */
if (pll->flags & AMDGPU_PLL_PREFER_MINM_OVER_MAXP)
post_div_best = post_div_min;
else
post_div_best = post_div_max;
diff_best = ~0;
for (post_div = post_div_min; post_div <= post_div_max; ++post_div) {
unsigned diff;
amdgpu_pll_get_fb_ref_div(nom, den, post_div, fb_div_max,
ref_div_max, &fb_div, &ref_div);
diff = abs(target_clock - (pll->reference_freq * fb_div) /
(ref_div * post_div));
if (diff < diff_best || (diff == diff_best &&
!(pll->flags & AMDGPU_PLL_PREFER_MINM_OVER_MAXP))) {
post_div_best = post_div;
diff_best = diff;
}
}
post_div = post_div_best;
/* get the feedback and reference divider for the optimal value */
amdgpu_pll_get_fb_ref_div(nom, den, post_div, fb_div_max, ref_div_max,
&fb_div, &ref_div);
/* reduce the numbers to a simpler ratio once more */
/* this also makes sure that the reference divider is large enough */
amdgpu_pll_reduce_ratio(&fb_div, &ref_div, fb_div_min, ref_div_min);
/* avoid high jitter with small fractional dividers */
if (pll->flags & AMDGPU_PLL_USE_FRAC_FB_DIV && (fb_div % 10)) {
fb_div_min = max(fb_div_min, (9 - (fb_div % 10)) * 20 + 60);
if (fb_div < fb_div_min) {
unsigned tmp = DIV_ROUND_UP(fb_div_min, fb_div);
fb_div *= tmp;
ref_div *= tmp;
}
}
/* and finally save the result */
if (pll->flags & AMDGPU_PLL_USE_FRAC_FB_DIV) {
*fb_div_p = fb_div / 10;
*frac_fb_div_p = fb_div % 10;
} else {
*fb_div_p = fb_div;
*frac_fb_div_p = 0;
}
*dot_clock_p = ((pll->reference_freq * *fb_div_p * 10) +
(pll->reference_freq * *frac_fb_div_p)) /
(ref_div * post_div * 10);
*ref_div_p = ref_div;
*post_div_p = post_div;
DRM_DEBUG_KMS("%d - %d, pll dividers - fb: %d.%d ref: %d, post %d\n",
freq, *dot_clock_p * 10, *fb_div_p, *frac_fb_div_p,
ref_div, post_div);
}
/**
* amdgpu_pll_get_use_mask - look up a mask of which pplls are in use
*
* @crtc: drm crtc
*
* Returns the mask of which PPLLs (Pixel PLLs) are in use.
*/
u32 amdgpu_pll_get_use_mask(struct drm_crtc *crtc)
{
struct drm_device *dev = crtc->dev;
struct drm_crtc *test_crtc;
struct amdgpu_crtc *test_amdgpu_crtc;
u32 pll_in_use = 0;
list_for_each_entry(test_crtc, &dev->mode_config.crtc_list, head) {
if (crtc == test_crtc)
continue;
test_amdgpu_crtc = to_amdgpu_crtc(test_crtc);
if (test_amdgpu_crtc->pll_id != ATOM_PPLL_INVALID)
pll_in_use |= (1 << test_amdgpu_crtc->pll_id);
}
return pll_in_use;
}
/**
* amdgpu_pll_get_shared_dp_ppll - return the PPLL used by another crtc for DP
*
* @crtc: drm crtc
*
* Returns the PPLL (Pixel PLL) used by another crtc/encoder which is
* also in DP mode. For DP, a single PPLL can be used for all DP
* crtcs/encoders.
*/
int amdgpu_pll_get_shared_dp_ppll(struct drm_crtc *crtc)
{
struct drm_device *dev = crtc->dev;
struct drm_crtc *test_crtc;
struct amdgpu_crtc *test_amdgpu_crtc;
list_for_each_entry(test_crtc, &dev->mode_config.crtc_list, head) {
if (crtc == test_crtc)
continue;
test_amdgpu_crtc = to_amdgpu_crtc(test_crtc);
if (test_amdgpu_crtc->encoder &&
ENCODER_MODE_IS_DP(amdgpu_atombios_encoder_get_encoder_mode(test_amdgpu_crtc->encoder))) {
/* for DP use the same PLL for all */
if (test_amdgpu_crtc->pll_id != ATOM_PPLL_INVALID)
return test_amdgpu_crtc->pll_id;
}
}
return ATOM_PPLL_INVALID;
}
/**
* amdgpu_pll_get_shared_nondp_ppll - return the PPLL used by another non-DP crtc
*
* @crtc: drm crtc
* @encoder: drm encoder
*
* Returns the PPLL (Pixel PLL) used by another non-DP crtc/encoder which can
* be shared (i.e., same clock).
*/
int amdgpu_pll_get_shared_nondp_ppll(struct drm_crtc *crtc)
{
struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
struct drm_device *dev = crtc->dev;
struct drm_crtc *test_crtc;
struct amdgpu_crtc *test_amdgpu_crtc;
u32 adjusted_clock, test_adjusted_clock;
adjusted_clock = amdgpu_crtc->adjusted_clock;
if (adjusted_clock == 0)
return ATOM_PPLL_INVALID;
list_for_each_entry(test_crtc, &dev->mode_config.crtc_list, head) {
if (crtc == test_crtc)
continue;
test_amdgpu_crtc = to_amdgpu_crtc(test_crtc);
if (test_amdgpu_crtc->encoder &&
!ENCODER_MODE_IS_DP(amdgpu_atombios_encoder_get_encoder_mode(test_amdgpu_crtc->encoder))) {
/* check if we are already driving this connector with another crtc */
if (test_amdgpu_crtc->connector == amdgpu_crtc->connector) {
/* if we are, return that pll */
if (test_amdgpu_crtc->pll_id != ATOM_PPLL_INVALID)
return test_amdgpu_crtc->pll_id;
}
/* for non-DP check the clock */
test_adjusted_clock = test_amdgpu_crtc->adjusted_clock;
if ((crtc->mode.clock == test_crtc->mode.clock) &&
(adjusted_clock == test_adjusted_clock) &&
(amdgpu_crtc->ss_enabled == test_amdgpu_crtc->ss_enabled) &&
(test_amdgpu_crtc->pll_id != ATOM_PPLL_INVALID))
return test_amdgpu_crtc->pll_id;
}
}
return ATOM_PPLL_INVALID;
}
| {
"pile_set_name": "Github"
} |
// Messages
.message-variant(@background; @icon-color) {
background-color: @background;
color: @text-color;
.@{ns}message-icon-wrapper > .@{ns}icon,
.@{ns}message-btn-close {
color: @icon-color;
}
}
| {
"pile_set_name": "Github"
} |
/*
This file is part of Darling.
Copyright (C) 2019 Lubos Dolezel
Darling is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Darling 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 Darling. If not, see <http://www.gnu.org/licenses/>.
*/
#include <Foundation/Foundation.h>
@interface SKPaymentQueue : NSObject
@end
| {
"pile_set_name": "Github"
} |
@charset "UTF-8";
body {
font: 20px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif;
padding: 60px 50px;
}
#mocha ul, #mocha li {
margin: 0;
padding: 0;
}
#mocha ul {
list-style: none;
}
#mocha h1, #mocha h2 {
margin: 0;
}
#mocha h1 {
margin-top: 15px;
font-size: 1em;
font-weight: 200;
}
#mocha h1 a {
text-decoration: none;
color: inherit;
}
#mocha h1 a:hover {
text-decoration: underline;
}
#mocha .suite .suite h1 {
margin-top: 0;
font-size: .8em;
}
#mocha h2 {
font-size: 12px;
font-weight: normal;
cursor: pointer;
}
#mocha .suite {
margin-left: 15px;
}
#mocha .test {
margin-left: 15px;
}
#mocha .test:hover h2::after {
position: relative;
top: 0;
right: -10px;
content: '(view source)';
font-size: 12px;
font-family: arial;
color: #888;
}
#mocha .test.pending:hover h2::after {
content: '(pending)';
font-family: arial;
}
#mocha .test.pass.medium .duration {
background: #C09853;
}
#mocha .test.pass.slow .duration {
background: #B94A48;
}
#mocha .test.pass::before {
content: '✓';
font-size: 12px;
display: block;
float: left;
margin-right: 5px;
color: #00d6b2;
}
#mocha .test.pass .duration {
font-size: 9px;
margin-left: 5px;
padding: 2px 5px;
color: white;
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
-moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
-ms-border-radius: 5px;
-o-border-radius: 5px;
border-radius: 5px;
}
#mocha .test.pass.fast .duration {
display: none;
}
#mocha .test.pending {
color: #0b97c4;
}
#mocha .test.pending::before {
content: '◦';
color: #0b97c4;
}
#mocha .test.fail {
color: #c00;
}
#mocha .test.fail pre {
color: black;
}
#mocha .test.fail::before {
content: '✖';
font-size: 12px;
display: block;
float: left;
margin-right: 5px;
color: #c00;
}
#mocha .test pre.error {
color: #c00;
}
#mocha .test pre {
display: inline-block;
font: 12px/1.5 monaco, monospace;
margin: 5px;
padding: 15px;
border: 1px solid #eee;
border-bottom-color: #ddd;
-webkit-border-radius: 3px;
-webkit-box-shadow: 0 1px 3px #eee;
}
#report.pass .test.fail {
display: none;
}
#report.fail .test.pass {
display: none;
}
#error {
color: #c00;
font-size: 1.5 em;
font-weight: 100;
letter-spacing: 1px;
}
#stats {
position: fixed;
top: 15px;
right: 10px;
font-size: 12px;
margin: 0;
color: #888;
}
#stats .progress {
float: right;
padding-top: 0;
}
#stats em {
color: black;
}
#stats a {
text-decoration: none;
color: inherit;
}
#stats a:hover {
border-bottom: 1px solid #eee;
}
#stats li {
display: inline-block;
margin: 0 5px;
list-style: none;
padding-top: 11px;
}
code .comment { color: #ddd }
code .init { color: #2F6FAD }
code .string { color: #5890AD }
code .keyword { color: #8A6343 }
code .number { color: #2F6FAD }
| {
"pile_set_name": "Github"
} |
using Test
using MPI
using ClimateMachine.Mesh.Topologies
function main()
MPI.Init()
comm = MPI.COMM_WORLD
crank = MPI.Comm_rank(comm)
csize = MPI.Comm_size(comm)
@assert csize == 2
topology = StackedBrickTopology(
comm,
(1:4, 5:8, 9:12),
periodicity = (false, true, false),
boundary = ((1, 2), (3, 4), (5, 6)),
)
elems = topology.elems
realelems = topology.realelems
ghostelems = topology.ghostelems
sendelems = topology.sendelems
elemtocoord = topology.elemtocoord
elemtoelem = topology.elemtoelem
elemtoface = topology.elemtoface
elemtoordr = topology.elemtoordr
elemtobndy = topology.elemtobndy
nabrtorank = topology.nabrtorank
nabrtorecv = topology.nabrtorecv
nabrtosend = topology.nabrtosend
globalelemtoface = [
1 1 1 2 2 2 2 2 2 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2
4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
5 6 6 5 6 6 5 6 6 5 6 6 5 6 6 5 6 6 5 6 6 5 6 6 5 6 6
5 5 6 5 5 6 5 5 6 5 5 6 5 5 6 5 5 6 5 5 6 5 5 6 5 5 6
]
globalelemtoordr = ones(Int, size(globalelemtoface))
globalelemtocoord = Array{Int}(undef, 3, 8, 27)
globalelemtocoord[:, :, 1] =
[1 2 1 2 1 2 1 2; 5 5 6 6 5 5 6 6; 9 9 9 9 10 10 10 10]
globalelemtocoord[:, :, 2] =
[1 2 1 2 1 2 1 2; 5 5 6 6 5 5 6 6; 10 10 10 10 11 11 11 11]
globalelemtocoord[:, :, 3] =
[1 2 1 2 1 2 1 2; 5 5 6 6 5 5 6 6; 11 11 11 11 12 12 12 12]
globalelemtocoord[:, :, 4] =
[2 3 2 3 2 3 2 3; 5 5 6 6 5 5 6 6; 9 9 9 9 10 10 10 10]
globalelemtocoord[:, :, 5] =
[2 3 2 3 2 3 2 3; 5 5 6 6 5 5 6 6; 10 10 10 10 11 11 11 11]
globalelemtocoord[:, :, 6] =
[2 3 2 3 2 3 2 3; 5 5 6 6 5 5 6 6; 11 11 11 11 12 12 12 12]
globalelemtocoord[:, :, 7] =
[2 3 2 3 2 3 2 3; 6 6 7 7 6 6 7 7; 9 9 9 9 10 10 10 10]
globalelemtocoord[:, :, 8] =
[2 3 2 3 2 3 2 3; 6 6 7 7 6 6 7 7; 10 10 10 10 11 11 11 11]
globalelemtocoord[:, :, 9] =
[2 3 2 3 2 3 2 3; 6 6 7 7 6 6 7 7; 11 11 11 11 12 12 12 12]
globalelemtocoord[:, :, 10] =
[1 2 1 2 1 2 1 2; 6 6 7 7 6 6 7 7; 9 9 9 9 10 10 10 10]
globalelemtocoord[:, :, 11] =
[1 2 1 2 1 2 1 2; 6 6 7 7 6 6 7 7; 10 10 10 10 11 11 11 11]
globalelemtocoord[:, :, 12] =
[1 2 1 2 1 2 1 2; 6 6 7 7 6 6 7 7; 11 11 11 11 12 12 12 12]
globalelemtocoord[:, :, 13] =
[1 2 1 2 1 2 1 2; 7 7 8 8 7 7 8 8; 9 9 9 9 10 10 10 10]
globalelemtocoord[:, :, 14] =
[1 2 1 2 1 2 1 2; 7 7 8 8 7 7 8 8; 10 10 10 10 11 11 11 11]
globalelemtocoord[:, :, 15] =
[1 2 1 2 1 2 1 2; 7 7 8 8 7 7 8 8; 11 11 11 11 12 12 12 12]
globalelemtocoord[:, :, 16] =
[2 3 2 3 2 3 2 3; 7 7 8 8 7 7 8 8; 9 9 9 9 10 10 10 10]
globalelemtocoord[:, :, 17] =
[2 3 2 3 2 3 2 3; 7 7 8 8 7 7 8 8; 10 10 10 10 11 11 11 11]
globalelemtocoord[:, :, 18] =
[2 3 2 3 2 3 2 3; 7 7 8 8 7 7 8 8; 11 11 11 11 12 12 12 12]
globalelemtocoord[:, :, 19] =
[3 4 3 4 3 4 3 4; 7 7 8 8 7 7 8 8; 9 9 9 9 10 10 10 10]
globalelemtocoord[:, :, 20] =
[3 4 3 4 3 4 3 4; 7 7 8 8 7 7 8 8; 10 10 10 10 11 11 11 11]
globalelemtocoord[:, :, 21] =
[3 4 3 4 3 4 3 4; 7 7 8 8 7 7 8 8; 11 11 11 11 12 12 12 12]
globalelemtocoord[:, :, 22] =
[3 4 3 4 3 4 3 4; 6 6 7 7 6 6 7 7; 9 9 9 9 10 10 10 10]
globalelemtocoord[:, :, 23] =
[3 4 3 4 3 4 3 4; 6 6 7 7 6 6 7 7; 10 10 10 10 11 11 11 11]
globalelemtocoord[:, :, 24] =
[3 4 3 4 3 4 3 4; 6 6 7 7 6 6 7 7; 11 11 11 11 12 12 12 12]
globalelemtocoord[:, :, 25] =
[3 4 3 4 3 4 3 4; 5 5 6 6 5 5 6 6; 9 9 9 9 10 10 10 10]
globalelemtocoord[:, :, 26] =
[3 4 3 4 3 4 3 4; 5 5 6 6 5 5 6 6; 10 10 10 10 11 11 11 11]
globalelemtocoord[:, :, 27] =
[3 4 3 4 3 4 3 4; 5 5 6 6 5 5 6 6; 11 11 11 11 12 12 12 12]
globalelemtobndy = [
1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 2 2 2 2 2 2 2
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5 0 0 5 0 0 5 0 0 5 0 0 5 0 0 5 0 0 5 0 0 5 0 0 5 0 0
0 0 6 0 0 6 0 0 6 0 0 6 0 0 6 0 0 6 0 0 6 0 0 6 0 0 6
]
if crank == 0
nrealelem = 12
globalelems = [
1,
2,
3, # 1
4,
5,
6, # 2
7,
8,
9, # 3
10,
11,
12, # 4
13,
14,
15, # 5
16,
17,
18, # 6
22,
23,
24, # 8
25,
26,
27,
] # 9
elemtoelem_expect = [
1 2 3 1 2 3 10 11 12 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
4 5 6 22 23 24 19 20 21 7 8 9 13 14 15 16 17 18 19 20 21 22 23 24
13 14 15 16 17 18 4 5 6 1 2 3 13 14 15 16 17 18 19 20 21 22 23 24
10 11 12 7 8 9 16 17 18 13 14 15 13 14 15 16 17 18 19 20 21 22 23 24
1 1 2 4 4 5 7 7 8 10 10 11 13 14 15 16 17 18 19 20 21 22 23 24
2 3 3 5 6 6 8 9 9 11 12 12 13 14 15 16 17 18 19 20 21 22 23 24
]
nabrtorank_expect = [1]
nabrtorecv_expect = UnitRange{Int}[1:12]
nabrtosend_expect = UnitRange{Int}[1:12]
elseif crank == 1
nrealelem = 15
globalelems = [
13,
14,
15, # 5
16,
17,
18, # 6
19,
20,
21, # 7
22,
23,
24, # 8
25,
26,
27, # 9
1,
2,
3, # 1
4,
5,
6, # 2
7,
8,
9, # 3
10,
11,
12,
] # 4
elemtoelem_expect = [
1 2 3 1 2 3 4 5 6 22 23 24 19 20 21 16 17 18 19 20 21 22 23 24 25 26 27
4 5 6 7 8 9 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
25 26 27 22 23 24 10 11 12 13 14 15 7 8 9 16 17 18 19 20 21 22 23 24 25 26 27
16 17 18 19 20 21 13 14 15 7 8 9 10 11 12 16 17 18 19 20 21 22 23 24 25 26 27
1 1 2 4 4 5 7 7 8 10 10 11 13 13 14 16 17 18 19 20 21 22 23 24 25 26 27
2 3 3 5 6 6 8 9 9 11 12 12 14 15 15 16 17 18 19 20 21 22 23 24 25 26 27
]
nabrtorank_expect = [0]
nabrtorecv_expect = UnitRange{Int}[1:12]
nabrtosend_expect = UnitRange{Int}[1:12]
end
@test elems == 1:length(globalelems)
@test realelems == 1:nrealelem
@test ghostelems == (nrealelem + 1):length(globalelems)
@test elemtocoord == globalelemtocoord[:, :, globalelems]
@test elemtoface[:, realelems] ==
globalelemtoface[:, globalelems[realelems]]
@test elemtoelem == elemtoelem_expect
@test elemtobndy == globalelemtobndy[:, globalelems]
@test elemtoordr == ones(eltype(elemtoordr), size(elemtoordr))
@test nabrtorank == nabrtorank_expect
@test nabrtorecv == nabrtorecv_expect
@test nabrtosend == nabrtosend_expect
@test collect(realelems) ==
sort(union(topology.exteriorelems, topology.interiorelems))
@test unique(sort(sendelems)) == topology.exteriorelems
@test length(intersect(topology.exteriorelems, topology.interiorelems)) == 0
end
main()
| {
"pile_set_name": "Github"
} |
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_calendar_agenda_24_outlined.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
} | {
"pile_set_name": "Github"
} |
# any line that begins with a '#' is discarded as a comment
# payload commandline
<-action <list|pick|configure|disable>>
Action to perform on payload
[-type <payload_type>]
The type of payload (level3, level4)
[-level3]
Level3 only.
[-level4]
Level4 only.
[-arch <arch>]
The payload architecture
[-i386]
Use i386 arch only.
[-x64]
Use x64 only.
[-os <os>]
The payload OS (deprecated and ignored)
[-bintype <type>]
The binary type (sharedlib, exe)
[-sharedlib]
DLL types.
[-exe]
EXE types.
[-tcp]
TCP PC
[-http]
HTTP PC
[-extra <extraInfo>]
Extra payload information
[-verbose]
Print additional information
[-utilityburst]
Configure with utilityburst support
REJECT: -appcompat -winsockhelperapi -generic
[-appcompat]
Configure with appcompat support (FREEPARKING)
REJECT: -utilityburst -winsockhelperapi -generic
[-winsockhelperapi]
Configure with winsockhelperapi support
REJECT: -utilityburst -appcompat -generic
[-generic]
Configure without specific persistence support (i.e. appinit or exe)
REJECT: -utilityburst -appcompat -winsockhelperapi
[-driver <name>]
Sets the driver name
[-process <name>]
Sets the process name
[-info <name>]
Sets the extra info area
[-file <file>]
The payload file for the -disable option
[-calladdr [iparg]]
Set the callback address. Omit iparg to set default.
[-callport [dstport1] [srcport1] [dstport2] [srcport2] [dstport3] [srcport3] [dstport4] [srcport4] [dstport5] [srcport5]]
Set the callback port(s). Omit any ports to set all defaults. Every DEST port must have a SRC port (which may be 0).
[-exename [name]]
Set the "exe name in version information". Omit name to retain default.
[-fire]
Update the Windows firewall when listening
[-nofire]
Do not update the Windows firewall when listening
[-tls]
Use TLS (HTTPS) for comms (HTTP-PC only).
[-notls]
Use HTTP for comms (HTTP-PC only).
[-imm]
Configure for immediate callback
[-noimm]
Do not do immediate callback
[-key <name>]
Set the key name (e.g. Default).
[-listen [start] [stop]]
PC should listen. Omit suboption(s), to retain defaults. If specifying start must also specify stop.
[-loops <numloops>]
Number of listening loops.
[-ldur <seconds>]
Duration per loop.
[-laddr <iparg>]
Bind address for listening.
[-lport [port1] [port2] [port3] [port4] [port5] [port6]]
Set the listening port(s). Omit any ports to set all defaults.
[-nolisten]
PC should not listen (TCP-PC only)
[-pcid [id]]
Set the PC ID. Up to 64 bits, can use 0x prefix to set as hex. Omit idarg to set default (0).
[-pcp]
Set the proxy connection parameters. Omit suboption(s), to retain defaults (HTTP-PC only).
[-maxdata <numbytes>]
The maximum data in an HTTP or TLS session.
[-failwait <seconds>]
For HTTP, the number of seconds to wait after a failed session to retry. Does not apply to TLS.
[-sendwait <seconds>]
For HTTP, the number of seconds to wait after a completed session until starting the next session. Does not apply to TLS.
[-maxfail <numfails>]
The number of consecutive failures after which to stop attempting to communicate to the LP.
[-proxyaddr <iparg>]
Set the proxy address.
[-proxyport <port>]
Set the proxy port.
[-proxyuser <name>]
Set the username to the proxy.
[-proxypass [password]]
Set the password to the proxy.
[-qdel]
Enable quick-deletion (Level3 EXE only)
[-noqdel]
Disable quick-deletion (Level3 EXE only)
[-wind]
Allow PC to create a window (DLL only)
[-nowind]
Do not allow PC to create a window (DLL only)
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\programs\x509\cert_write.c" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="mbedTLS.vcxproj">
<Project>{46cf2d25-6a36-4189-b59c-e4815388e554}</Project>
<LinkLibraryDependencies>true</LinkLibraryDependencies>
</ProjectReference>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{35E52E46-3BA9-4361-41D3-53663C2E9B8A}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>cert_write</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IntDir>$(Configuration)\$(TargetName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<IntDir>$(Configuration)\$(TargetName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<IntDir>$(Configuration)\$(TargetName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<IntDir>$(Configuration)\$(TargetName)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>
../../include;../../3rdparty/everest/include/;../../3rdparty/everest/include/everest;../../3rdparty/everest/include/everest/vs2010;../../3rdparty/everest/include/everest/kremlib;../../tests/include </AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>Debug</AdditionalLibraryDirectories>
</Link>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>
../../include;../../3rdparty/everest/include/;../../3rdparty/everest/include/everest;../../3rdparty/everest/include/everest/vs2010;../../3rdparty/everest/include/everest/kremlib;../../tests/include </AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>Debug</AdditionalLibraryDirectories>
</Link>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>
../../include;../../3rdparty/everest/include/;../../3rdparty/everest/include/everest;../../3rdparty/everest/include/everest/vs2010;../../3rdparty/everest/include/everest/kremlib;../../tests/include </AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalLibraryDirectories>Release</AdditionalLibraryDirectories>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>
../../include;../../3rdparty/everest/include/;../../3rdparty/everest/include/everest;../../3rdparty/everest/include/everest/vs2010;../../3rdparty/everest/include/everest/kremlib;../../tests/include </AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalLibraryDirectories>Release</AdditionalLibraryDirectories>
<AdditionalDependencies>%(AdditionalDependencies);</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
| {
"pile_set_name": "Github"
} |
module.exports = {
environments: {
bar: { globals: { bar: true } }
}
};
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2004-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
#include "IPHeaderV4.h"
#include <folly/io/Cursor.h>
#include "fboss/agent/FbossError.h"
#include "fboss/agent/PortStats.h"
#include "fboss/agent/SwSwitch.h"
#include "fboss/agent/SwitchStats.h"
using folly::io::Cursor;
namespace facebook::fboss {
void IPHeaderV4::parse(SwSwitch* sw, PortID port, Cursor* cursor) {
auto len = cursor->pullAtMost(&hdr_[0], sizeof(hdr_));
if (len != sizeof(hdr_)) {
sw->portStats(port)->ipv4TooSmall();
throw FbossError(
"Too small packet. Get ",
cursor->length(),
" bytes. Minimum ",
sizeof(hdr_),
" bytes");
}
if (getVersion() != 4) {
sw->portStats(port)->ipv4WrongVer();
throw FbossError("Wrong IPv4 version number (", getVersion(), " vs 4)");
}
// TODO: other sanity checks (i.e. packet length, checksum...)
}
} // namespace facebook::fboss
| {
"pile_set_name": "Github"
} |
namespace Nancy.Tests.Unit.Helpers
{
using Nancy.Helpers;
using Xunit;
using Xunit.Extensions;
public class HttpUtilityFixture
{
[Fact]
public void ParseQueryString_respects_case_insensitive_setting()
{
// Given
StaticConfiguration.CaseSensitive = false;
var query = "key=value";
// When
var collection = HttpUtility.ParseQueryString(query);
// Then
collection["key"].ShouldEqual("value");
collection["KEY"].ShouldEqual("value");
}
[Fact]
public void ParseQueryString_respects_case_sensitive_setting()
{
// Given
StaticConfiguration.CaseSensitive = true;
var query = "key=value";
// When
var collection = HttpUtility.ParseQueryString(query);
// Then
collection["key"].ShouldEqual("value");
collection["KEY"].ShouldBeNull();
}
[Fact]
public void ParseQueryString_handles_duplicate_keys_when_case_insensitive()
{
// Given
StaticConfiguration.CaseSensitive = false;
var query = "key=value&key=value&KEY=VALUE";
// When
var collection = HttpUtility.ParseQueryString(query);
// Then
collection["key"].ShouldEqual("value,value,VALUE");
collection["KEY"].ShouldEqual("value,value,VALUE");
}
[Fact]
public void ParseQueryString_handles_duplicate_keys_when_case_sensitive()
{
// Given
StaticConfiguration.CaseSensitive = true;
var query = "key=value&key=value&KEY=VALUE";
// When
var collection = HttpUtility.ParseQueryString(query);
// Then
collection["key"].ShouldEqual("value,value");
collection["KEY"].ShouldEqual("VALUE");
}
[Fact]
public void ParseQueryString_explicit_case_insensitivity_overrides_global_setting()
{
// Given
StaticConfiguration.CaseSensitive = true;
var query = "key=value";
// When
var collection = HttpUtility.ParseQueryString(query, caseSensitive: false);
// Then
collection["key"].ShouldEqual("value");
collection["KEY"].ShouldEqual("value");
}
[Fact]
public void ParseQueryString_explicit_case_sensitivity_overrides_global_setting()
{
// Given
StaticConfiguration.CaseSensitive = false;
var query = "key=value";
// When
var collection = HttpUtility.ParseQueryString(query, caseSensitive: true);
// Then
collection["key"].ShouldEqual("value");
collection["KEY"].ShouldBeNull();
}
[Fact]
public void ParseQueryString_handles_keys_without_values()
{
// Given
var query = "key1&key2";
// When
var collection = HttpUtility.ParseQueryString(query);
// Then
collection["key1"].ShouldEqual("key1");
collection["key2"].ShouldEqual("key2");
}
[Fact]
public void ParseQueryString_handles_duplicate_keys_when_one_has_no_value()
{
// Given
var query = "key&key=value";
// When
var collection = HttpUtility.ParseQueryString(query);
// Then
collection["key"].ShouldEqual("key,value");
}
[Fact]
public void ParseQueryString_handles_duplicate_keys_when_they_have_no_values()
{
// Given
var query = "key&key";
// When
var collection = HttpUtility.ParseQueryString(query);
// Then
collection["key"].ShouldEqual("key,key");
}
[Theory]
[InlineData("/a/a&/b&/c")]
[InlineData("/build/app-transitions-css/app-transitions-css-min.css&/build/widget-base/assets/skins/sam/widget-base.css&/build/scrollview-base/assets/skins/sam/scrollview-base.css&/build/scrollview-scrollbars/assets/skins/sam/scrollview-scrollbars.css&/build/widget-stack/assets/skins/sam/widget-stack.css&/build/overlay/assets/skins/sam/overlay.css&/build/console/assets/skins/sam/console.css")]
public void ParseQueryString_handles_irregular_yui_format(string query)
{
Assert.DoesNotThrow(() =>
{
var collection = HttpUtility.ParseQueryString(query);
collection.ShouldNotBeNull();
});
}
}
} | {
"pile_set_name": "Github"
} |
# 1.7 变量和声明
这将是美好的开始和结束,通过写下`x = 4`,我们查看变量,可以说声明了一个变量并赋值,但是很不幸,go语言变量声明和赋值比这更复杂。通过学习一些简单的示例开始学习变量声明和赋值。然后在下一章,当我们创建并使用结构体时,我们会深入学习。尽管如此,你需要花一些时间去适应。
你可能会惊讶,为什么会如此复杂,让我们以一些例子开始学习。
在go中最直接的方式去声明变量并赋值也是最繁琐的:
```go
package main
import (
"fmt"
)
func main() {
var power int
power = 9000
fmt.Printf("It's over %d\n", power)
}
```
在这里我们声明了一个`int`型变量`power`。默认情况下,go会给`power`赋一个`0`值。整型赋`0`,布尔型赋`false`,字符串型赋`""`等。然后,我们将`9000`赋值给变量`power`。我们也可以将2行代码合并成一行:
`var power int = 9000`
虽然需要输入很多。go有一种方便简洁的变量声明操作符:`:=`,go可以推断变量的类型:
`power := 9000`
这里有一个简洁的写法,通过函数也能正常工作:
```go
func main() {
power := getPower()
}
func getPower() int {
return 9001
}
```
这里需要谨记,`:=`用于声明一个变量并给变量赋值。为什么会这样?因为一个变量不能被声明2次(不在相同的代码范围)。如果你试着运行下面代码,你将会得到一个错误信息。
```go
func main() {
power := 9000
fmt.Printf("It's over %d\n", power)
// COMPILER ERROR:
// no new variables on left side of :=
power := 9001
fmt.Printf("It's also over %d\n", power)
}
```
编译器会提示`:=`左边不是一个新变量。这意味着当我们第一次声明变量时,我们使用`:=`。但是在随后的赋值,我们要使用`=`。这有很多意义,但这也随时提醒着你何时该使用`:=`和`=`。
如果你仔细阅读错误信息,你将发现有多个变量。因为go支持多个变量同时赋值(使用`=`或者`:=`):
```go
func main() {
name, power := "Goku", 9000
fmt.Printf("%s's power is over %d\n", name, power)
}
```
另外,如果一个变量是新变量也可以使用`:=`进行赋值。例如:
```go
func main() {
power := 1000
fmt.Printf("default power is %d\n", power)
name, power := "Goku", 9000
fmt.Printf("%s's power is over %d\n", name, power)
}
```
尽管变量`power`使用了`:=`,但是编译器不会在第2次使用`:=`时报错,因为这里有一个变量`name`,这是一个新的变量,允许使用`:=`。但是你不能改变`power`的类型。它已经被声明成一个整型,只能赋值整数。
现在,需要知道的最后一件事是,类似包导入,go程序中不能存在未使用的变量,例如:
```go
func main() {
name, power := "Goku", 1000
fmt.Printf("default power is %d\n", power)
}
```
这段代码不能编译,因为变量`name`已经声明,但是没有被使用。类似未使用的导入包,可能这会让你有点失望,但是总的来看,我认为这是为了让代码更加的简洁和具有可读性。
接下来不在介绍关于变量的声明和赋值相关内容了。现在,你只需要记住使用`var NAME TYPE`声明一个变量,并且变量的初始值为它相应类型的零值,使用`NAME := VALUE`声明一个变量并赋值,使用`NAME = VALUE`去给已经声明过的变量赋值。
## 链接
- [目录](directory.md)
- 上一节:[导入包](1.6.md)
- 下一节:[函数声明](1.8.md) | {
"pile_set_name": "Github"
} |
/*******************************************************************************
* Copyright 2012-2019 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file.
* This file 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.
* *****************************************************************************
*
* AWS Tools for Windows (TM) PowerShell (TM)
*
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using System.Text;
using Amazon.PowerShell.Common;
using Amazon.Runtime;
using Amazon.SageMaker;
using Amazon.SageMaker.Model;
namespace Amazon.PowerShell.Cmdlets.SM
{
/// <summary>
/// Returns information about a transform job.
/// </summary>
[Cmdlet("Get", "SMTransformJob")]
[OutputType("Amazon.SageMaker.Model.DescribeTransformJobResponse")]
[AWSCmdlet("Calls the Amazon SageMaker Service DescribeTransformJob API operation.", Operation = new[] {"DescribeTransformJob"}, SelectReturnType = typeof(Amazon.SageMaker.Model.DescribeTransformJobResponse))]
[AWSCmdletOutput("Amazon.SageMaker.Model.DescribeTransformJobResponse",
"This cmdlet returns an Amazon.SageMaker.Model.DescribeTransformJobResponse object containing multiple properties. The object can also be referenced from properties attached to the cmdlet entry in the $AWSHistory stack."
)]
public partial class GetSMTransformJobCmdlet : AmazonSageMakerClientCmdlet, IExecutor
{
#region Parameter TransformJobName
/// <summary>
/// <para>
/// <para>The name of the transform job that you want to view details of.</para>
/// </para>
/// </summary>
#if !MODULAR
[System.Management.Automation.Parameter(Position = 0, ValueFromPipelineByPropertyName = true, ValueFromPipeline = true)]
#else
[System.Management.Automation.Parameter(Position = 0, ValueFromPipelineByPropertyName = true, ValueFromPipeline = true, Mandatory = true)]
[System.Management.Automation.AllowEmptyString]
[System.Management.Automation.AllowNull]
#endif
[Amazon.PowerShell.Common.AWSRequiredParameter]
public System.String TransformJobName { get; set; }
#endregion
#region Parameter Select
/// <summary>
/// Use the -Select parameter to control the cmdlet output. The default value is '*'.
/// Specifying -Select '*' will result in the cmdlet returning the whole service response (Amazon.SageMaker.Model.DescribeTransformJobResponse).
/// Specifying the name of a property of type Amazon.SageMaker.Model.DescribeTransformJobResponse will result in that property being returned.
/// Specifying -Select '^ParameterName' will result in the cmdlet returning the selected cmdlet parameter value.
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public string Select { get; set; } = "*";
#endregion
#region Parameter PassThru
/// <summary>
/// Changes the cmdlet behavior to return the value passed to the TransformJobName parameter.
/// The -PassThru parameter is deprecated, use -Select '^TransformJobName' instead. This parameter will be removed in a future version.
/// </summary>
[System.Obsolete("The -PassThru parameter is deprecated, use -Select '^TransformJobName' instead. This parameter will be removed in a future version.")]
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public SwitchParameter PassThru { get; set; }
#endregion
protected override void ProcessRecord()
{
base.ProcessRecord();
var context = new CmdletContext();
// allow for manipulation of parameters prior to loading into context
PreExecutionContextLoad(context);
#pragma warning disable CS0618, CS0612 //A class member was marked with the Obsolete attribute
if (ParameterWasBound(nameof(this.Select)))
{
context.Select = CreateSelectDelegate<Amazon.SageMaker.Model.DescribeTransformJobResponse, GetSMTransformJobCmdlet>(Select) ??
throw new System.ArgumentException("Invalid value for -Select parameter.", nameof(this.Select));
if (this.PassThru.IsPresent)
{
throw new System.ArgumentException("-PassThru cannot be used when -Select is specified.", nameof(this.Select));
}
}
else if (this.PassThru.IsPresent)
{
context.Select = (response, cmdlet) => this.TransformJobName;
}
#pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
context.TransformJobName = this.TransformJobName;
#if MODULAR
if (this.TransformJobName == null && ParameterWasBound(nameof(this.TransformJobName)))
{
WriteWarning("You are passing $null as a value for parameter TransformJobName which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues.");
}
#endif
// allow further manipulation of loaded context prior to processing
PostExecutionContextLoad(context);
var output = Execute(context) as CmdletOutput;
ProcessOutput(output);
}
#region IExecutor Members
public object Execute(ExecutorContext context)
{
var cmdletContext = context as CmdletContext;
// create request
var request = new Amazon.SageMaker.Model.DescribeTransformJobRequest();
if (cmdletContext.TransformJobName != null)
{
request.TransformJobName = cmdletContext.TransformJobName;
}
CmdletOutput output;
// issue call
var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint);
try
{
var response = CallAWSServiceOperation(client, request);
object pipelineOutput = null;
pipelineOutput = cmdletContext.Select(response, this);
output = new CmdletOutput
{
PipelineOutput = pipelineOutput,
ServiceResponse = response
};
}
catch (Exception e)
{
output = new CmdletOutput { ErrorResponse = e };
}
return output;
}
public ExecutorContext CreateContext()
{
return new CmdletContext();
}
#endregion
#region AWS Service Operation Call
private Amazon.SageMaker.Model.DescribeTransformJobResponse CallAWSServiceOperation(IAmazonSageMaker client, Amazon.SageMaker.Model.DescribeTransformJobRequest request)
{
Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon SageMaker Service", "DescribeTransformJob");
try
{
#if DESKTOP
return client.DescribeTransformJob(request);
#elif CORECLR
return client.DescribeTransformJobAsync(request).GetAwaiter().GetResult();
#else
#error "Unknown build edition"
#endif
}
catch (AmazonServiceException exc)
{
var webException = exc.InnerException as System.Net.WebException;
if (webException != null)
{
throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
}
throw;
}
}
#endregion
internal partial class CmdletContext : ExecutorContext
{
public System.String TransformJobName { get; set; }
public System.Func<Amazon.SageMaker.Model.DescribeTransformJobResponse, GetSMTransformJobCmdlet, object> Select { get; set; } =
(response, cmdlet) => response;
}
}
}
| {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.