code
stringlengths 3
1.01M
| repo_name
stringlengths 5
116
| path
stringlengths 3
311
| language
stringclasses 30
values | license
stringclasses 15
values | size
int64 3
1.01M
|
|---|---|---|---|---|---|
/*
* Licensed to CRATE Technology GmbH ("Crate") under one or more contributor
* license agreements. See the NOTICE file distributed with this work for
* additional information regarding copyright ownership. Crate licenses
* this file to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may
* obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* However, if you have executed another commercial license agreement
* with Crate these terms will supersede the license and you may use the
* software solely pursuant to the terms of the relevant commercial agreement.
*/
package io.crate.operation.scalar.cast;
import com.google.common.collect.ImmutableList;
import io.crate.metadata.FunctionIdent;
import io.crate.operation.Input;
import io.crate.operation.scalar.AbstractScalarFunctionsTest;
import io.crate.planner.symbol.Function;
import io.crate.planner.symbol.Literal;
import io.crate.planner.symbol.Reference;
import io.crate.planner.symbol.Symbol;
import io.crate.testing.TestingHelpers;
import io.crate.types.ArrayType;
import io.crate.types.DataType;
import io.crate.types.DataTypes;
import org.apache.lucene.util.BytesRef;
import org.hamcrest.Matchers;
import org.junit.Test;
import java.util.Arrays;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsInstanceOf.instanceOf;
public class ToLongArrayFunctionTest extends AbstractScalarFunctionsTest {
@Test
public void testArrayDifferentTypesToInt() throws Exception {
Object[] expected = new Long[] { 10L, 20L, 30L };
Object[] actual;
actual = eval(new String[]{"10", "20", "30"}, DataTypes.STRING);
assertThat(actual, is(expected));
actual = eval(new BytesRef[]{new BytesRef("10"), new BytesRef("20"), new BytesRef("30")}, DataTypes.STRING);
assertThat(actual, is(expected));
actual = eval(new Integer[] { 10, 20, 30 }, DataTypes.INTEGER);
assertThat(actual, is(expected));
}
@Test
public void testListDifferentTypesToInt() throws Exception {
Object[] expected = new Long[] { 10L, 20L, 30L };
Object[] actual;
actual = eval(Arrays.asList("10", "20", "30"), DataTypes.STRING);
assertThat(actual, is(expected));
actual = eval(Arrays.asList(new BytesRef("10"), new BytesRef("20"), new BytesRef("30")), DataTypes.STRING);
assertThat(actual, is(expected));
actual = eval(Arrays.asList( 10, 20, 30 ), DataTypes.INTEGER);
assertThat(actual, is(expected));
}
@Test
public void testInvalidValueToInt() throws Exception {
expectedException.expect(NumberFormatException.class);
expectedException.expectMessage("For input string: \"foobar\"");
eval(Arrays.asList("foobar", "20", "30"), DataTypes.STRING);
}
@Test
public void testWithNullValueToInt() throws Exception {
Object[] expected = new Long[] { 10L, null, 30L };
Object[] actual;
actual = eval(Arrays.asList("10", null, "30"), DataTypes.STRING);
assertThat(actual, is(expected));
}
@Test
public void testNormalizeWithReference() throws Exception {
final DataType arrayType = new ArrayType(DataTypes.STRING);
ToArrayFunction impl = (ToArrayFunction) functions.get(
new FunctionIdent(CastFunctionResolver.FunctionNames.TO_LONG_ARRAY, ImmutableList.of(arrayType)));
Reference foo = TestingHelpers.createReference("foo", arrayType);
Symbol symbol = impl.normalizeSymbol(new Function(impl.info(), Arrays.<Symbol>asList(foo)));
assertThat(symbol, instanceOf(Function.class));
}
@Test
public void testNullToInt() throws Exception {
assertThat(eval(null, DataTypes.LONG), Matchers.nullValue());
assertThat(eval(null, DataTypes.STRING), Matchers.nullValue());
}
private Object[] eval(final Object objects, DataType innerType) {
final DataType arrayType = new ArrayType(innerType);
ToArrayFunction impl = (ToArrayFunction) functions.get(
new FunctionIdent(CastFunctionResolver.FunctionNames.TO_LONG_ARRAY, ImmutableList.of(arrayType)));
Literal input = new Literal() {
@Override
public Object value() {
return objects;
}
@Override
public DataType valueType() {
return arrayType;
}
};
Symbol normalized = impl.normalizeSymbol(new Function(impl.info(), Arrays.<Symbol>asList(input)));
Object[] values = impl.evaluate(new Input[]{input});
assertThat(values, is(((Input) normalized).value()));
return values;
}
}
|
gmrodrigues/crate
|
sql/src/test/java/io/crate/operation/scalar/cast/ToLongArrayFunctionTest.java
|
Java
|
apache-2.0
| 5,117
|
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _lodash = require('lodash');
var _lodash2 = _interopRequireDefault(_lodash);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = function (identifierNode, context) {
if (_lodash2.default.has(identifierNode, 'name')) {
return identifierNode.name;
}
if (_lodash2.default.has(identifierNode, 'left.name')) {
return identifierNode.left.name;
}
if (_lodash2.default.has(identifierNode, 'key.name')) {
return identifierNode.key.name;
}
if (identifierNode.type === 'RestElement') {
return identifierNode.argument.name;
}
if (identifierNode.type === 'ObjectTypeProperty') {
var tokenIndex = void 0;
tokenIndex = 0;
if (identifierNode.static) {
tokenIndex++;
}
if (identifierNode.variance) {
tokenIndex++;
}
if (identifierNode.kind === 'set' || identifierNode.kind === 'get') {
tokenIndex++;
}
return context.getSourceCode().getFirstToken(identifierNode, tokenIndex).value;
}
if (identifierNode.type === 'ObjectTypeIndexer') {
var _tokenIndex = void 0;
_tokenIndex = 0;
if (identifierNode.static) {
_tokenIndex++;
}
if (identifierNode.variance) {
_tokenIndex++;
}
_tokenIndex++;
var id = context.getSourceCode().getFirstToken(identifierNode, _tokenIndex);
var colonOrBrace = context.getSourceCode().getTokenAfter(id);
if (colonOrBrace.value === ':') {
return id.value;
} else {
return null;
}
}
if (identifierNode.type === 'FunctionTypeParam') {
return context.getSourceCode().getFirstToken(identifierNode).value;
}
if (identifierNode.type === 'ObjectPattern' || identifierNode.type === 'ArrayPattern') {
var text = context.getSourceCode().getText(identifierNode);
if (identifierNode.typeAnnotation) {
return text.replace(context.getSourceCode().getText(identifierNode.typeAnnotation), '').trim();
} else {
return text;
}
}
if (_lodash2.default.get(identifierNode, 'left.type') === 'ObjectPattern') {
return context.getSourceCode().getText(identifierNode.left);
}
return null;
};
module.exports = exports.default;
|
GoogleCloudPlatform/prometheus-engine
|
third_party/prometheus_ui/base/web/ui/react-app/node_modules/react-scripts/node_modules/eslint-plugin-flowtype/dist/utilities/getParameterName.js
|
JavaScript
|
apache-2.0
| 2,290
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ignite.internal.commandline;
import org.apache.ignite.internal.client.GridClientConfiguration;
import org.apache.ignite.internal.commandline.cache.CacheArguments;
import org.apache.ignite.internal.visor.tx.VisorTxTaskArg;
/**
* Bean with all parsed and validated arguments.
*/
public class Arguments {
/** Command. */
private Command cmd;
/** Host. */
private String host;
/** Port. */
private String port;
/** User. */
private String user;
/** Password. */
private String pwd;
/** Force option is used for auto confirmation. */
private boolean autoConfirmation;
/**
* Action for baseline command.
*/
private String baselineAct;
/**
* Arguments for baseline command.
*/
private String baselineArgs;
/** Transaction arguments. */
private final VisorTxTaskArg txArg;
/**
* Arguments for --cache subcommand.
*/
private CacheArguments cacheArgs;
/**
* Action for WAL command.
*/
private String walAct;
/**
* Arguments for WAL command.
*/
private String walArgs;
/** Ping timeout for grid client. See {@link GridClientConfiguration#pingTimeout}.*/
private long pingTimeout;
/** Ping interval for grid client. See {@link GridClientConfiguration#pingInterval}.*/
private long pingInterval;
/**
* @param cmd Command.
* @param host Host.
* @param port Port.
* @param user User.
* @param pwd Password.
* @param baselineAct Baseline action.
* @param baselineArgs Baseline args.
* @param txArg TX arg.
* @param cacheArgs --cache subcommand arguments.
* @param walAct WAL action.
* @param walArgs WAL args.
* @param pingTimeout Ping timeout. See {@link GridClientConfiguration#pingTimeout}.
* @param pingInterval Ping interval. See {@link GridClientConfiguration#pingInterval}.
* @param autoConfirmation Auto confirmation flag.
*/
public Arguments(Command cmd, String host, String port, String user, String pwd, String baselineAct,
String baselineArgs, VisorTxTaskArg txArg, CacheArguments cacheArgs, String walAct, String walArgs,
Long pingTimeout, Long pingInterval, boolean autoConfirmation) {
this.cmd = cmd;
this.host = host;
this.port = port;
this.user = user;
this.pwd = pwd;
this.baselineAct = baselineAct;
this.baselineArgs = baselineArgs;
this.txArg = txArg;
this.cacheArgs = cacheArgs;
this.walAct = walAct;
this.walArgs = walArgs;
this.pingTimeout = pingTimeout;
this.pingInterval = pingInterval;
this.autoConfirmation = autoConfirmation;
}
/**
* @return command
*/
public Command command() {
return cmd;
}
/**
* @return host name
*/
public String host() {
return host;
}
/**
* @return port number
*/
public String port() {
return port;
}
/**
* @return user name
*/
public String user() {
return user;
}
/**
* @return password
*/
public String password() {
return pwd;
}
/**
* @return baseline action
*/
public String baselineAction() {
return baselineAct;
}
/**
* @return baseline arguments
*/
public String baselineArguments() {
return baselineArgs;
}
/**
* @return Transaction arguments.
*/
public VisorTxTaskArg transactionArguments() {
return txArg;
}
/**
* @return Arguments for --cache subcommand.
*/
public CacheArguments cacheArgs() {
return cacheArgs;
}
/**
* @return WAL action.
*/
public String walAction() {
return walAct;
}
/**
* @return WAL arguments.
*/
public String walArguments() {
return walArgs;
}
/**
* See {@link GridClientConfiguration#pingTimeout}.
*
* @return Ping timeout.
*/
public long pingTimeout() {
return pingTimeout;
}
/**
* See {@link GridClientConfiguration#pingInterval}.
*
* @return Ping interval.
*/
public long pingInterval() {
return pingInterval;
}
/**
* @return Auto confirmation option.
*/
public boolean autoConfirmation() {
return autoConfirmation;
}
}
|
alexzaitzev/ignite
|
modules/core/src/main/java/org/apache/ignite/internal/commandline/Arguments.java
|
Java
|
apache-2.0
| 5,289
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/appstream/AppStream_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
namespace Aws
{
namespace AppStream
{
namespace Model
{
enum class UsageReportExecutionErrorCode
{
NOT_SET,
RESOURCE_NOT_FOUND,
ACCESS_DENIED,
INTERNAL_SERVICE_ERROR
};
namespace UsageReportExecutionErrorCodeMapper
{
AWS_APPSTREAM_API UsageReportExecutionErrorCode GetUsageReportExecutionErrorCodeForName(const Aws::String& name);
AWS_APPSTREAM_API Aws::String GetNameForUsageReportExecutionErrorCode(UsageReportExecutionErrorCode value);
} // namespace UsageReportExecutionErrorCodeMapper
} // namespace Model
} // namespace AppStream
} // namespace Aws
|
aws/aws-sdk-cpp
|
aws-cpp-sdk-appstream/include/aws/appstream/model/UsageReportExecutionErrorCode.h
|
C
|
apache-2.0
| 809
|
package com.xxmassdeveloper.mpchartexample.fragments;
import android.graphics.Typeface;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.components.Legend;
import com.github.mikephil.charting.components.XAxis;
import com.github.mikephil.charting.components.YAxis;
import com.xxmassdeveloper.mpchartexample.R;
public class ComplexityFragment extends SimpleFragment {
public static Fragment newInstance() {
return new ComplexityFragment();
}
private LineChart mChart;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.frag_simple_line, container, false);
mChart = (LineChart) v.findViewById(R.id.lineChart1);
mChart.getDescription().setEnabled(false);
mChart.setDrawGridBackground(false);
mChart.setData(getComplexity());
mChart.animateX(3000);
Typeface tf = Typeface.createFromAsset(getActivity().getAssets(),"OpenSans-Light.ttf");
Legend l = mChart.getLegend();
l.setTypeface(tf);
YAxis leftAxis = mChart.getAxisLeft();
leftAxis.setTypeface(tf);
mChart.getAxisRight().setEnabled(false);
XAxis xAxis = mChart.getXAxis();
xAxis.setEnabled(false);
return v;
}
}
|
xsingHu/xs-android-architecture
|
study-view/xs-MPAndroidChartDemo/MPChartExample/src/com/xxmassdeveloper/mpchartexample/fragments/ComplexityFragment.java
|
Java
|
apache-2.0
| 1,590
|
/*
* Copyright 2000-2013 JetBrains s.r.o.
*
* 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.intellij.openapi.externalSystem.settings;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import java.util.Set;
/**
* Defines callback for external system settings change.
* <p/>
* Implementations of this interface are not obliged to be thread-safe.
*
* @author Denis Zhdanov
* @param <S> target project setting type
*/
public interface ExternalSystemSettingsListener<S extends ExternalProjectSettings> {
/**
* This method is present here only because IJ platform doesn't has corresponding messaging set up for 'project rename' event.
*
* @param oldName old project name
* @param newName new project name
*/
void onProjectRenamed(@NotNull String oldName, @NotNull String newName);
void onProjectsLinked(@NotNull Collection<S> settings);
void onProjectsUnlinked(@NotNull Set<String> linkedProjectPaths);
void onUseAutoImportChange(boolean currentValue, @NotNull String linkedProjectPath);
/**
* External system settings changes might affect project structure, e.g. switching from one external system version to another
* one can trigger new binaries usage (different external system versions might use different file system directories
* for holding dependencies).
* <p/>
* So, we might want to refresh project structure on external system setting change. However, there is a possible case that more
* than one significant setting is changed during single editing session (e.g. a user opens external system settings, changes linked
* project path and 'use auto-import' and then presses 'Ok'.). We don't want to trigger two refreshes then. That's why
* it's possible to indicate that settings are changed in bulk now.
* <p/>
* {@link #onBulkChangeEnd()} is expected to be called at the 'finally' section which starts just after the call to
* current method.
*/
void onBulkChangeStart();
/**
* @see #onBulkChangeStart()
*/
void onBulkChangeEnd();
}
|
mdanielwork/intellij-community
|
platform/external-system-api/src/com/intellij/openapi/externalSystem/settings/ExternalSystemSettingsListener.java
|
Java
|
apache-2.0
| 2,582
|
// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple x86_64-unknown-unknown -emit-llvm %s -fexceptions -fcxx-exceptions -o - -fsanitize-address-use-after-scope | FileCheck %s --check-prefix=CHECK --check-prefix=LIFETIME
// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s
// RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -debug-info-kind=line-tables-only -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=TERM_DEBUG
// RUN: %clang_cc1 -main-file-name for_codegen.cpp %s -o - -emit-llvm -fprofile-instrument=clang -fprofile-instrument-path=for_codegen-test.profraw | FileCheck %s --check-prefix=PROF-INSTR-PATH
// RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -triple x86_64-unknown-unknown -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck --check-prefix SIMD-ONLY0 %s
// RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s
// RUN: %clang_cc1 -fopenmp-simd -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s
// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp-simd -fexceptions -fcxx-exceptions -debug-info-kind=line-tables-only -x c++ -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s
// RUN: %clang_cc1 -main-file-name for_codegen.cpp %s -o - -emit-llvm -fprofile-instrument=clang -fprofile-instrument-path=for_codegen-test.profraw | FileCheck --check-prefix SIMD-ONLY0 %s
// SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
//
// expected-no-diagnostics
#ifndef HEADER
#define HEADER
// PROF-INSTR-PATH: constant [25 x i8] c"for_codegen-test.profraw\00"
// CHECK: [[IDENT_T_TY:%.+]] = type { i32, i32, i32, i32, i8* }
// CHECK-DAG: [[IMPLICIT_BARRIER_LOC:@.+]] = private unnamed_addr global %{{.+}} { i32 0, i32 66, i32 0, i32 0, i8*
// CHECK-DAG: [[LOOP_LOC:@.+]] = private unnamed_addr global %{{.+}} { i32 0, i32 514, i32 0, i32 0, i8*
// CHECK-DAG: [[I:@.+]] = global i8 1,
// CHECK-DAG: [[J:@.+]] = global i8 2,
// CHECK-DAG: [[K:@.+]] = global i8 3,
// CHECK-LABEL: loop_with_counter_collapse
void loop_with_counter_collapse() {
// LIFETIME: call void @llvm.lifetime.end
// LIFETIME: call void @llvm.lifetime.end
// CHECK: call void @__kmpc_for_static_init_8(%struct.ident_t* @
// CHECK: call void @__kmpc_for_static_fini(%struct.ident_t* @
// LIFETIME: call void @llvm.lifetime.end
// LIFETIME: call void @llvm.lifetime.end
// LIFETIME: call void @llvm.lifetime.end
// LIFETIME: call void @llvm.lifetime.end
// LIFETIME: call void @llvm.lifetime.end
// LIFETIME: call void @llvm.lifetime.end
// LIFETIME: call void @llvm.lifetime.end
// LIFETIME: call void @llvm.lifetime.end
// LIFETIME: call void @llvm.lifetime.end
#pragma omp for collapse(2)
for (int i = 0; i < 4; i++) {
for (int j = i; j < 4; j++) {
}
}
}
// CHECK-LABEL: define {{.*void}} @{{.*}}without_schedule_clause{{.*}}(float* {{.+}}, float* {{.+}}, float* {{.+}}, float* {{.+}})
void without_schedule_clause(float *a, float *b, float *c, float *d) {
// CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEFAULT_LOC:[@%].+]])
#pragma omp for nowait
// CHECK: call void @__kmpc_for_static_init_4([[IDENT_T_TY]]* [[LOOP_LOC]], i32 [[GTID]], i32 34, i32* [[IS_LAST:%[^,]+]], i32* [[OMP_LB:%[^,]+]], i32* [[OMP_UB:%[^,]+]], i32* [[OMP_ST:%[^,]+]], i32 1, i32 1)
// UB = min(UB, GlobalUB)
// CHECK-NEXT: [[UB:%.+]] = load i32, i32* [[OMP_UB]]
// CHECK-NEXT: [[UBCMP:%.+]] = icmp sgt i32 [[UB]], 4571423
// CHECK-NEXT: br i1 [[UBCMP]], label [[UB_TRUE:%[^,]+]], label [[UB_FALSE:%[^,]+]]
// CHECK: [[UBRESULT:%.+]] = phi i32 [ 4571423, [[UB_TRUE]] ], [ [[UBVAL:%[^,]+]], [[UB_FALSE]] ]
// CHECK-NEXT: store i32 [[UBRESULT]], i32* [[OMP_UB]]
// CHECK-NEXT: [[LB:%.+]] = load i32, i32* [[OMP_LB]]
// CHECK-NEXT: store i32 [[LB]], i32* [[OMP_IV:[^,]+]]
// Loop header
// CHECK: [[IV:%.+]] = load i32, i32* [[OMP_IV]]
// CHECK-NEXT: [[UB:%.+]] = load i32, i32* [[OMP_UB]]
// CHECK-NEXT: [[CMP:%.+]] = icmp sle i32 [[IV]], [[UB]]
// CHECK-NEXT: br i1 [[CMP]], label %[[LOOP1_BODY:[^,]+]], label %[[LOOP1_END:[^,]+]]
for (int i = 33; i < 32000000; i += 7) {
// CHECK: [[LOOP1_BODY]]
// Start of body: calculate i from IV:
// CHECK: [[IV1_1:%.+]] = load i32, i32* [[OMP_IV]]
// CHECK-NEXT: [[CALC_I_1:%.+]] = mul nsw i32 [[IV1_1]], 7
// CHECK-NEXT: [[CALC_I_2:%.+]] = add nsw i32 33, [[CALC_I_1]]
// CHECK-NEXT: store i32 [[CALC_I_2]], i32* [[LC_I:.+]]
// ... loop body ...
// End of body: store into a[i]:
// CHECK: store float [[RESULT:%.+]], float* {{%.+}}
// CHECK-NOT: !llvm.access.group
a[i] = b[i] * c[i] * d[i];
// CHECK: [[IV1_2:%.+]] = load i32, i32* [[OMP_IV]]{{.*}}
// CHECK-NEXT: [[ADD1_2:%.+]] = add nsw i32 [[IV1_2]], 1
// CHECK-NEXT: store i32 [[ADD1_2]], i32* [[OMP_IV]]
// CHECK-NEXT: br label %{{.+}}
}
// CHECK: [[LOOP1_END]]
// CHECK: call void @__kmpc_for_static_fini([[IDENT_T_TY]]* [[LOOP_LOC]], i32 [[GTID]])
// CHECK-NOT: __kmpc_barrier
// CHECK: ret void
}
// CHECK-LABEL: define {{.*void}} @{{.*}}static_not_chunked{{.*}}(float* {{.+}}, float* {{.+}}, float* {{.+}}, float* {{.+}})
void static_not_chunked(float *a, float *b, float *c, float *d) {
// CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEFAULT_LOC:[@%].+]])
#pragma omp for schedule(static)
// CHECK: call void @__kmpc_for_static_init_4([[IDENT_T_TY]]* [[LOOP_LOC]], i32 [[GTID]], i32 34, i32* [[IS_LAST:%[^,]+]], i32* [[OMP_LB:%[^,]+]], i32* [[OMP_UB:%[^,]+]], i32* [[OMP_ST:%[^,]+]], i32 1, i32 1)
// UB = min(UB, GlobalUB)
// CHECK-NEXT: [[UB:%.+]] = load i32, i32* [[OMP_UB]]
// CHECK-NEXT: [[UBCMP:%.+]] = icmp sgt i32 [[UB]], 4571423
// CHECK-NEXT: br i1 [[UBCMP]], label [[UB_TRUE:%[^,]+]], label [[UB_FALSE:%[^,]+]]
// CHECK: [[UBRESULT:%.+]] = phi i32 [ 4571423, [[UB_TRUE]] ], [ [[UBVAL:%[^,]+]], [[UB_FALSE]] ]
// CHECK-NEXT: store i32 [[UBRESULT]], i32* [[OMP_UB]]
// CHECK-NEXT: [[LB:%.+]] = load i32, i32* [[OMP_LB]]
// CHECK-NEXT: store i32 [[LB]], i32* [[OMP_IV:[^,]+]]
// Loop header
// CHECK: [[IV:%.+]] = load i32, i32* [[OMP_IV]]
// CHECK-NEXT: [[UB:%.+]] = load i32, i32* [[OMP_UB]]
// CHECK-NEXT: [[CMP:%.+]] = icmp sle i32 [[IV]], [[UB]]
// CHECK-NEXT: br i1 [[CMP]], label %[[LOOP1_BODY:[^,]+]], label %[[LOOP1_END:[^,]+]]
for (int i = 32000000; i > 33; i += -7) {
// CHECK: [[LOOP1_BODY]]
// Start of body: calculate i from IV:
// CHECK: [[IV1_1:%.+]] = load i32, i32* [[OMP_IV]]
// CHECK-NEXT: [[CALC_I_1:%.+]] = mul nsw i32 [[IV1_1]], 7
// CHECK-NEXT: [[CALC_I_2:%.+]] = sub nsw i32 32000000, [[CALC_I_1]]
// CHECK-NEXT: store i32 [[CALC_I_2]], i32* [[LC_I:.+]]
// ... loop body ...
// End of body: store into a[i]:
// CHECK: store float [[RESULT:%.+]], float* {{%.+}}
// CHECK-NOT: !llvm.access.group
a[i] = b[i] * c[i] * d[i];
// CHECK: [[IV1_2:%.+]] = load i32, i32* [[OMP_IV]]{{.*}}
// CHECK-NEXT: [[ADD1_2:%.+]] = add nsw i32 [[IV1_2]], 1
// CHECK-NEXT: store i32 [[ADD1_2]], i32* [[OMP_IV]]
// CHECK-NEXT: br label %{{.+}}
}
// CHECK: [[LOOP1_END]]
// CHECK: call void @__kmpc_for_static_fini([[IDENT_T_TY]]* [[LOOP_LOC]], i32 [[GTID]])
// CHECK: call {{.+}} @__kmpc_barrier([[IDENT_T_TY]]* [[IMPLICIT_BARRIER_LOC]], i32 [[GTID]])
// CHECK: ret void
}
// CHECK-LABEL: define {{.*void}} @{{.*}}static_chunked{{.*}}(float* {{.+}}, float* {{.+}}, float* {{.+}}, float* {{.+}})
void static_chunked(float *a, float *b, float *c, float *d) {
// CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEFAULT_LOC:[@%].+]])
#pragma omp for schedule(monotonic: static, 5)
// CHECK: call void @__kmpc_for_static_init_4u([[IDENT_T_TY]]* [[LOOP_LOC]], i32 [[GTID]], i32 536870945, i32* [[IS_LAST:%[^,]+]], i32* [[OMP_LB:%[^,]+]], i32* [[OMP_UB:%[^,]+]], i32* [[OMP_ST:%[^,]+]], i32 1, i32 5)
// UB = min(UB, GlobalUB)
// CHECK: [[UB:%.+]] = load i32, i32* [[OMP_UB]]
// CHECK-NEXT: [[UBCMP:%.+]] = icmp ugt i32 [[UB]], 16908288
// CHECK-NEXT: br i1 [[UBCMP]], label [[UB_TRUE:%[^,]+]], label [[UB_FALSE:%[^,]+]]
// CHECK: [[UBRESULT:%.+]] = phi i32 [ 16908288, [[UB_TRUE]] ], [ [[UBVAL:%[^,]+]], [[UB_FALSE]] ]
// CHECK-NEXT: store i32 [[UBRESULT]], i32* [[OMP_UB]]
// CHECK-NEXT: [[LB:%.+]] = load i32, i32* [[OMP_LB]]
// CHECK-NEXT: store i32 [[LB]], i32* [[OMP_IV:[^,]+]]
// Outer loop header
// CHECK: [[O_IV:%.+]] = load i32, i32* [[OMP_IV]]
// CHECK-NEXT: [[O_UB:%.+]] = load i32, i32* [[OMP_UB]]
// CHECK-NEXT: [[O_CMP:%.+]] = icmp ule i32 [[O_IV]], [[O_UB]]
// CHECK-NEXT: br i1 [[O_CMP]], label %[[O_LOOP1_BODY:[^,]+]], label %[[O_LOOP1_END:[^,]+]]
// Loop header
// CHECK: [[O_LOOP1_BODY]]
// CHECK: [[IV:%.+]] = load i32, i32* [[OMP_IV]]
// CHECK-NEXT: [[UB:%.+]] = load i32, i32* [[OMP_UB]]
// CHECK-NEXT: [[CMP:%.+]] = icmp ule i32 [[IV]], [[UB]]
// CHECK-NEXT: br i1 [[CMP]], label %[[LOOP1_BODY:[^,]+]], label %[[LOOP1_END:[^,]+]]
for (unsigned i = 131071; i <= 2147483647; i += 127) {
// CHECK: [[LOOP1_BODY]]
// Start of body: calculate i from IV:
// CHECK: [[IV1_1:%.+]] = load i32, i32* [[OMP_IV]]
// CHECK-NEXT: [[CALC_I_1:%.+]] = mul i32 [[IV1_1]], 127
// CHECK-NEXT: [[CALC_I_2:%.+]] = add i32 131071, [[CALC_I_1]]
// CHECK-NEXT: store i32 [[CALC_I_2]], i32* [[LC_I:.+]]
// ... loop body ...
// End of body: store into a[i]:
// CHECK: store float [[RESULT:%.+]], float* {{%.+}}
// CHECK-NOT: !llvm.access.group
a[i] = b[i] * c[i] * d[i];
// CHECK: [[IV1_2:%.+]] = load i32, i32* [[OMP_IV]]{{.*}}
// CHECK-NEXT: [[ADD1_2:%.+]] = add i32 [[IV1_2]], 1
// CHECK-NEXT: store i32 [[ADD1_2]], i32* [[OMP_IV]]
// CHECK-NEXT: br label %{{.+}}
}
// CHECK: [[LOOP1_END]]
// Update the counters, adding stride
// CHECK: [[LB:%.+]] = load i32, i32* [[OMP_LB]]
// CHECK-NEXT: [[ST:%.+]] = load i32, i32* [[OMP_ST]]
// CHECK-NEXT: [[ADD_LB:%.+]] = add i32 [[LB]], [[ST]]
// CHECK-NEXT: store i32 [[ADD_LB]], i32* [[OMP_LB]]
// CHECK-NEXT: [[UB:%.+]] = load i32, i32* [[OMP_UB]]
// CHECK-NEXT: [[ST:%.+]] = load i32, i32* [[OMP_ST]]
// CHECK-NEXT: [[ADD_UB:%.+]] = add i32 [[UB]], [[ST]]
// CHECK-NEXT: store i32 [[ADD_UB]], i32* [[OMP_UB]]
// CHECK: [[O_LOOP1_END]]
// CHECK: call void @__kmpc_for_static_fini([[IDENT_T_TY]]* [[LOOP_LOC]], i32 [[GTID]])
// CHECK: call {{.+}} @__kmpc_barrier([[IDENT_T_TY]]* [[IMPLICIT_BARRIER_LOC]], i32 [[GTID]])
// CHECK: ret void
}
// CHECK-LABEL: define {{.*void}} @{{.*}}dynamic1{{.*}}(float* {{.+}}, float* {{.+}}, float* {{.+}}, float* {{.+}})
void dynamic1(float *a, float *b, float *c, float *d) {
// CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEFAULT_LOC:[@%].+]])
#pragma omp for schedule(nonmonotonic: dynamic)
// CHECK: call void @__kmpc_dispatch_init_8u([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]], i32 1073741859, i64 0, i64 16908287, i64 1, i64 1)
//
// CHECK: [[HASWORK:%.+]] = call i32 @__kmpc_dispatch_next_8u([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]], i32* [[OMP_ISLAST:%[^,]+]], i64* [[OMP_LB:%[^,]+]], i64* [[OMP_UB:%[^,]+]], i64* [[OMP_ST:%[^,]+]])
// CHECK-NEXT: [[O_CMP:%.+]] = icmp ne i32 [[HASWORK]], 0
// CHECK-NEXT: br i1 [[O_CMP]], label %[[O_LOOP1_BODY:[^,]+]], label %[[O_LOOP1_END:[^,]+]]
// Loop header
// CHECK: [[O_LOOP1_BODY]]
// CHECK: [[LB:%.+]] = load i64, i64* [[OMP_LB]]
// CHECK-NEXT: store i64 [[LB]], i64* [[OMP_IV:[^,]+]]
// CHECK: [[IV:%.+]] = load i64, i64* [[OMP_IV]]
// CHECK-NEXT: [[UB:%.+]] = load i64, i64* [[OMP_UB]]
// CHECK-NEXT: [[BOUND:%.+]] = add i64 [[UB]], 1
// CHECK-NEXT: [[CMP:%.+]] = icmp ult i64 [[IV]], [[BOUND]]
// CHECK-NEXT: br i1 [[CMP]], label %[[LOOP1_BODY:[^,]+]], label %[[LOOP1_END:[^,]+]]
for (unsigned long long i = 131071; i < 2147483647; i += 127) {
// CHECK: [[LOOP1_BODY]]
// Start of body: calculate i from IV:
// CHECK: [[IV1_1:%.+]] = load i64, i64* [[OMP_IV]]
// CHECK-NEXT: [[CALC_I_1:%.+]] = mul i64 [[IV1_1]], 127
// CHECK-NEXT: [[CALC_I_2:%.+]] = add i64 131071, [[CALC_I_1]]
// CHECK-NEXT: store i64 [[CALC_I_2]], i64* [[LC_I:.+]]
// ... loop body ...
// End of body: store into a[i]:
// CHECK: store float [[RESULT:%.+]], float* {{%.+}}!llvm.access.group
a[i] = b[i] * c[i] * d[i];
// CHECK: [[IV1_2:%.+]] = load i64, i64* [[OMP_IV]]{{.*}}
// CHECK-NEXT: [[ADD1_2:%.+]] = add i64 [[IV1_2]], 1
// CHECK-NEXT: store i64 [[ADD1_2]], i64* [[OMP_IV]]
// CHECK-NEXT: br label %{{.+}}
}
// CHECK: [[LOOP1_END]]
// CHECK: [[O_LOOP1_END]]
// CHECK: call {{.+}} @__kmpc_barrier([[IDENT_T_TY]]* [[IMPLICIT_BARRIER_LOC]], i32 [[GTID]])
// CHECK: ret void
}
// CHECK-LABEL: define {{.*void}} @{{.*}}guided7{{.*}}(float* {{.+}}, float* {{.+}}, float* {{.+}}, float* {{.+}})
void guided7(float *a, float *b, float *c, float *d) {
// CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEFAULT_LOC:[@%].+]])
#pragma omp for schedule(guided, 7)
// CHECK: call void @__kmpc_dispatch_init_8u([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]], i32 36, i64 0, i64 16908287, i64 1, i64 7)
//
// CHECK: [[HASWORK:%.+]] = call i32 @__kmpc_dispatch_next_8u([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]], i32* [[OMP_ISLAST:%[^,]+]], i64* [[OMP_LB:%[^,]+]], i64* [[OMP_UB:%[^,]+]], i64* [[OMP_ST:%[^,]+]])
// CHECK-NEXT: [[O_CMP:%.+]] = icmp ne i32 [[HASWORK]], 0
// CHECK-NEXT: br i1 [[O_CMP]], label %[[O_LOOP1_BODY:[^,]+]], label %[[O_LOOP1_END:[^,]+]]
// Loop header
// CHECK: [[O_LOOP1_BODY]]
// CHECK: [[LB:%.+]] = load i64, i64* [[OMP_LB]]
// CHECK-NEXT: store i64 [[LB]], i64* [[OMP_IV:[^,]+]]
// CHECK: [[IV:%.+]] = load i64, i64* [[OMP_IV]]
// CHECK-NEXT: [[UB:%.+]] = load i64, i64* [[OMP_UB]]
// CHECK-NEXT: [[BOUND:%.+]] = add i64 [[UB]], 1
// CHECK-NEXT: [[CMP:%.+]] = icmp ult i64 [[IV]], [[BOUND]]
// CHECK-NEXT: br i1 [[CMP]], label %[[LOOP1_BODY:[^,]+]], label %[[LOOP1_END:[^,]+]]
for (unsigned long long i = 131071; i < 2147483647; i += 127) {
// CHECK: [[LOOP1_BODY]]
// Start of body: calculate i from IV:
// CHECK: [[IV1_1:%.+]] = load i64, i64* [[OMP_IV]]
// CHECK-NEXT: [[CALC_I_1:%.+]] = mul i64 [[IV1_1]], 127
// CHECK-NEXT: [[CALC_I_2:%.+]] = add i64 131071, [[CALC_I_1]]
// CHECK-NEXT: store i64 [[CALC_I_2]], i64* [[LC_I:.+]]
// ... loop body ...
// End of body: store into a[i]:
// CHECK: store float [[RESULT:%.+]], float* {{%.+}}!llvm.access.group
a[i] = b[i] * c[i] * d[i];
// CHECK: [[IV1_2:%.+]] = load i64, i64* [[OMP_IV]]{{.*}}
// CHECK-NEXT: [[ADD1_2:%.+]] = add i64 [[IV1_2]], 1
// CHECK-NEXT: store i64 [[ADD1_2]], i64* [[OMP_IV]]
// CHECK-NEXT: br label %{{.+}}
}
// CHECK: [[LOOP1_END]]
// CHECK: [[O_LOOP1_END]]
// CHECK: call {{.+}} @__kmpc_barrier([[IDENT_T_TY]]* [[IMPLICIT_BARRIER_LOC]], i32 [[GTID]])
// CHECK: ret void
}
// CHECK-LABEL: define {{.*void}} @{{.*}}test_auto{{.*}}(float* {{.+}}, float* {{.+}}, float* {{.+}}, float* {{.+}})
void test_auto(float *a, float *b, float *c, float *d) {
unsigned int x = 0;
unsigned int y = 0;
// CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEFAULT_LOC:[@%].+]])
#pragma omp for schedule(auto) collapse(2)
// CHECK: call void @__kmpc_dispatch_init_8([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]], i32 38, i64 0, i64 [[LAST_ITER:%[^,]+]], i64 1, i64 1)
//
// CHECK: [[HASWORK:%.+]] = call i32 @__kmpc_dispatch_next_8([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]], i32* [[OMP_ISLAST:%[^,]+]], i64* [[OMP_LB:%[^,]+]], i64* [[OMP_UB:%[^,]+]], i64* [[OMP_ST:%[^,]+]])
// CHECK-NEXT: [[O_CMP:%.+]] = icmp ne i32 [[HASWORK]], 0
// CHECK-NEXT: br i1 [[O_CMP]], label %[[O_LOOP1_BODY:[^,]+]], label %[[O_LOOP1_END:[^,]+]]
// Loop header
// CHECK: [[O_LOOP1_BODY]]
// CHECK: [[LB:%.+]] = load i64, i64* [[OMP_LB]]
// CHECK-NEXT: store i64 [[LB]], i64* [[OMP_IV:[^,]+]]
// CHECK: [[IV:%.+]] = load i64, i64* [[OMP_IV]]
// CHECK-NEXT: [[UB:%.+]] = load i64, i64* [[OMP_UB]]
// CHECK-NEXT: [[CMP:%.+]] = icmp sle i64 [[IV]], [[UB]]
// CHECK-NEXT: br i1 [[CMP]], label %[[LOOP1_BODY:[^,]+]], label %[[LOOP1_END:[^,]+]]
// FIXME: When the iteration count of some nested loop is not a known constant,
// we should pre-calculate it, like we do for the total number of iterations!
for (char i = static_cast<char>(y); i <= '9'; ++i)
for (x = 11; x > 0; --x) {
// CHECK: [[LOOP1_BODY]]
// Start of body: indices are calculated from IV:
// CHECK: store i8 {{%[^,]+}}, i8* {{%[^,]+}}
// CHECK: store i32 {{%[^,]+}}, i32* {{%[^,]+}}
// ... loop body ...
// End of body: store into a[i]:
// CHECK: store float [[RESULT:%.+]], float* {{%.+}}
// CHECK-NOT: !llvm.access.group
a[i] = b[i] * c[i] * d[i];
// CHECK: [[IV1_2:%.+]] = load i64, i64* [[OMP_IV]]{{.*}}
// CHECK-NEXT: [[ADD1_2:%.+]] = add nsw i64 [[IV1_2]], 1
// CHECK-NEXT: store i64 [[ADD1_2]], i64* [[OMP_IV]]
// CHECK-NEXT: br label %{{.+}}
}
// CHECK: [[LOOP1_END]]
// CHECK: [[O_LOOP1_END]]
// CHECK: call {{.+}} @__kmpc_barrier([[IDENT_T_TY]]* [[IMPLICIT_BARRIER_LOC]], i32 [[GTID]])
// CHECK: ret void
}
// CHECK-LABEL: define {{.*void}} @{{.*}}runtime{{.*}}(float* {{.+}}, float* {{.+}}, float* {{.+}}, float* {{.+}})
void runtime(float *a, float *b, float *c, float *d) {
int x = 0;
// CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEFAULT_LOC:[@%].+]])
#pragma omp for collapse(2) schedule(runtime)
// CHECK: call void @__kmpc_dispatch_init_4([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]], i32 37, i32 0, i32 199, i32 1, i32 1)
//
// CHECK: [[HASWORK:%.+]] = call i32 @__kmpc_dispatch_next_4([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]], i32* [[OMP_ISLAST:%[^,]+]], i32* [[OMP_LB:%[^,]+]], i32* [[OMP_UB:%[^,]+]], i32* [[OMP_ST:%[^,]+]])
// CHECK-NEXT: [[O_CMP:%.+]] = icmp ne i32 [[HASWORK]], 0
// CHECK-NEXT: br i1 [[O_CMP]], label %[[O_LOOP1_BODY:[^,]+]], label %[[O_LOOP1_END:[^,]+]]
// Loop header
// CHECK: [[O_LOOP1_BODY]]
// CHECK: [[LB:%.+]] = load i32, i32* [[OMP_LB]]
// CHECK-NEXT: store i32 [[LB]], i32* [[OMP_IV:[^,]+]]
// CHECK: [[IV:%.+]] = load i32, i32* [[OMP_IV]]
// CHECK-NEXT: [[UB:%.+]] = load i32, i32* [[OMP_UB]]
// CHECK-NEXT: [[CMP:%.+]] = icmp sle i32 [[IV]], [[UB]]
// CHECK-NEXT: br i1 [[CMP]], label %[[LOOP1_BODY:[^,]+]], label %[[LOOP1_END:[^,]+]]
for (unsigned char i = '0' ; i <= '9'; ++i)
for (x = -10; x < 10; ++x) {
// CHECK: [[LOOP1_BODY]]
// Start of body: indices are calculated from IV:
// CHECK: store i8 {{%[^,]+}}, i8* {{%[^,]+}}
// CHECK: store i32 {{%[^,]+}}, i32* {{%[^,]+}}
// ... loop body ...
// End of body: store into a[i]:
// CHECK: store float [[RESULT:%.+]], float* {{%.+}}
// CHECK-NOT: !llvm.access.group
a[i] = b[i] * c[i] * d[i];
// CHECK: [[IV1_2:%.+]] = load i32, i32* [[OMP_IV]]{{.*}}
// CHECK-NEXT: [[ADD1_2:%.+]] = add nsw i32 [[IV1_2]], 1
// CHECK-NEXT: store i32 [[ADD1_2]], i32* [[OMP_IV]]
// CHECK-NEXT: br label %{{.+}}
}
// CHECK: [[LOOP1_END]]
// CHECK: [[O_LOOP1_END]]
// CHECK: call {{.+}} @__kmpc_barrier([[IDENT_T_TY]]* [[IMPLICIT_BARRIER_LOC]], i32 [[GTID]])
// CHECK: ret void
}
// CHECK-LABEL: test_precond
void test_precond() {
// CHECK: [[A_ADDR:%.+]] = alloca i8,
// CHECK: [[I_ADDR:%.+]] = alloca i8,
// CHECK: [[CAP:%.+]] = alloca i8,
char a = 0;
// CHECK: store i8 0,
// CHECK: store i32
// CHECK: store i8
// CHECK: [[A:%.+]] = load i8, i8* [[CAP]],
// CHECK: [[CONV:%.+]] = sext i8 [[A]] to i32
// CHECK: [[CMP:%.+]] = icmp slt i32 [[CONV]], 10
// CHECK: br i1 [[CMP]], label %[[PRECOND_THEN:[^,]+]], label %[[PRECOND_END:[^,]+]]
// CHECK: [[PRECOND_THEN]]
// CHECK: call void @__kmpc_for_static_init_4
#pragma omp for
for(char i = a; i < 10; ++i);
// CHECK: call void @__kmpc_for_static_fini
// CHECK: [[PRECOND_END]]
}
// TERM_DEBUG-LABEL: foo
int foo() {return 0;};
// TERM_DEBUG-LABEL: parallel_for
void parallel_for(float *a) {
#pragma omp parallel
#pragma omp for schedule(static, 5)
// TERM_DEBUG-NOT: __kmpc_global_thread_num
// TERM_DEBUG: call void @__kmpc_for_static_init_4u({{.+}}), !dbg [[DBG_LOC:![0-9]+]]
// TERM_DEBUG: invoke i32 {{.*}}foo{{.*}}()
// TERM_DEBUG: unwind label %[[TERM_LPAD:.+]],
// TERM_DEBUG-NOT: __kmpc_global_thread_num
// TERM_DEBUG: call void @__kmpc_for_static_fini({{.+}}), !dbg [[DBG_LOC]]
// TERM_DEBUG: call {{.+}} @__kmpc_barrier({{.+}}), !dbg [[DBG_LOC]]
// TERM_DEBUG: [[TERM_LPAD]]
// TERM_DEBUG: call void @__clang_call_terminate
// TERM_DEBUG: unreachable
for (unsigned i = 131071; i <= 2147483647; i += 127)
a[i] += foo();
}
// Check source line corresponds to "#pragma omp for schedule(static, 5)" above:
// TERM_DEBUG: [[DBG_LOC]] = !DILocation(line: [[@LINE-15]],
char i = 1, j = 2, k = 3;
// CHECK-LABEL: for_with_global_lcv
void for_with_global_lcv() {
// CHECK: alloca i8,
// CHECK: [[I_ADDR:%.+]] = alloca i8,
// CHECK: alloca i8,
// CHECK: [[J_ADDR:%.+]] = alloca i8,
// CHECK: call void @__kmpc_for_static_init_4(
// CHECK-NOT: [[I]]
// CHECK: store i8 %{{.+}}, i8* [[I_ADDR]]
// CHECK-NOT: [[I]]
// CHECK: [[I_VAL:%.+]] = load i8, i8* [[I_ADDR]],
// CHECK-NOT: [[I]]
// CHECK: store i8 [[I_VAL]], i8* [[K]]
// CHECK-NOT: [[I]]
// CHECK: call void @__kmpc_for_static_fini(
// CHECK: call void @__kmpc_barrier(
#pragma omp for
for (i = 0; i < 2; ++i) {
k = i;
}
// CHECK: call void @__kmpc_for_static_init_4(
// CHECK-NOT: [[J]]
// CHECK: store i8 %{{.+}}, i8* [[J_ADDR]]
// CHECK-NOT: [[J]]
// CHECK: [[J_VAL:%.+]] = load i8, i8* [[J_ADDR]],
// CHECK-NOT: [[J]]
// CHECK: store i8 [[J_VAL]], i8* [[K]]
// CHECK-NOT: [[J]]
// CHECK: call void @__kmpc_for_static_fini(
#pragma omp for collapse(2)
for (int i = 0; i < 2; ++i)
for (j = 0; j < 2; ++j) {
k = i;
k = j;
}
char &cnt = i;
#pragma omp for
for (cnt = 0; cnt < 2; ++cnt)
k = cnt;
}
// CHECK-LABEL: for_with_references
void for_with_references() {
// CHECK: [[I:%.+]] = alloca i8,
// CHECK: [[CNT:%.+]] = alloca i8*,
// CHECK: [[CNT_PRIV:%.+]] = alloca i8,
// CHECK: call void @__kmpc_for_static_init_4(
// CHECK-NOT: load i8, i8* [[CNT]],
// CHECK: call void @__kmpc_for_static_fini(
char i = 0;
char &cnt = i;
#pragma omp for
for (cnt = 0; cnt < 2; ++cnt)
k = cnt;
}
struct Bool {
Bool(bool b) : b(b) {}
operator bool() const { return b; }
const bool b;
};
template <typename T>
struct It {
It() : p(0) {}
It(const It &, int = 0) ;
template <typename U>
It(U &, int = 0) ;
It &operator=(const It &);
It &operator=(It &);
~It() {}
It(T *p) : p(p) {}
operator T *&() { return p; }
operator T *() const { return p; }
T *operator->() const { return p; }
It &operator++() { ++p; return *this; }
It &operator--() { --p; return *this; }
It &operator+=(unsigned n) { p += n; return *this; }
It &operator-=(unsigned n) { p -= n; return *this; }
T *p;
};
template <typename T>
It<T> operator+(It<T> a, typename It<T>::difference_type n) { return a.p + n; }
template <typename T>
It<T> operator+(typename It<T>::difference_type n, It<T> a) { return a.p + n; }
template <typename T>
It<T> operator-(It<T> a, typename It<T>::difference_type n) { return a.p - n; }
typedef Bool BoolType;
template <typename T>
BoolType operator<(It<T> a, It<T> b) { return a.p < b.p; }
void loop_with_It(It<char> begin, It<char> end) {
#pragma omp for
for (It<char> it = begin; it < end; ++it) {
*it = 0;
}
}
// CHECK-LABEL: loop_with_It
// CHECK: call i32 @__kmpc_global_thread_num(
// CHECK: call void @__kmpc_for_static_init_8(
// CHECK: call void @__kmpc_for_static_fini(
void loop_with_It_plus(It<char> begin, It<char> end) {
#pragma omp for
for (It<char> it = begin; it < end; it+=1u) {
*it = 0;
}
}
// CHECK-LABEL: loop_with_It_plus
// CHECK: call i32 @__kmpc_global_thread_num(
// CHECK: call void @__kmpc_for_static_init_8(
// CHECK: call void @__kmpc_for_static_fini(
void loop_with_stmt_expr() {
#pragma omp for
for (int i = __extension__({float b = 0;b; }); i < __extension__({double c = 1;c; }); i += __extension__({char d = 1; d; }))
;
}
// CHECK-LABEL: loop_with_stmt_expr
// CHECK: call i32 @__kmpc_global_thread_num(
// CHECK: call void @__kmpc_for_static_init_4(
// CHECK: call void @__kmpc_for_static_fini(
// CHECK-LABEL: fint
// CHECK: call {{.*}}i32 {{.*}}ftemplate
// CHECK: ret i32
// CHECK: load i16, i16*
// CHECK: store i16 %
// CHECK: call void {{.+}}@__kmpc_fork_call(
// CHECK: call void @__kmpc_for_static_init_4(
template <typename T>
T ftemplate() {
short aa = 0;
#pragma omp parallel for schedule(static, aa)
for (int i = 0; i < 100; i++) {
}
return T();
}
int fint(void) { return ftemplate<int>(); }
#endif // HEADER
|
apple/swift-clang
|
test/OpenMP/for_codegen.cpp
|
C++
|
apache-2.0
| 24,690
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ignite.internal.processors.cache.datastructures;
import java.util.ArrayList;
import java.util.List;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteAtomicSequence;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.configuration.AtomicConfiguration;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
/**
*/
public class IgniteSequenceInternalCleanupTest extends GridCommonAbstractTest {
/** */
public static final int GRIDS_CNT = 5;
/** */
public static final int SEQ_RESERVE = 50_000;
/** */
public static final int CACHES_CNT = 10;
/** */
protected static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setClientMode("client".equals(igniteInstanceName));
cfg.setMetricsUpdateFrequency(10);
cfg.setActiveOnStart(false);
TcpDiscoverySpi spi = new TcpDiscoverySpi();
spi.setIpFinder(ipFinder);
cfg.setDiscoverySpi(spi);
AtomicConfiguration atomicCfg = atomicConfiguration();
assertNotNull(atomicCfg);
cfg.setAtomicConfiguration(atomicCfg);
List<CacheConfiguration> cacheCfg = new ArrayList<>();
for (int i = 0; i < CACHES_CNT; i++) {
cacheCfg.add(new CacheConfiguration("test" + i).
setStatisticsEnabled(true).
setCacheMode(PARTITIONED).
setAtomicityMode(TRANSACTIONAL).
setAffinity(new RendezvousAffinityFunction(false, 16)));
}
cfg.setCacheConfiguration(cacheCfg.toArray(new CacheConfiguration[cacheCfg.size()]));
return cfg;
}
/** {@inheritDoc} */
protected AtomicConfiguration atomicConfiguration() {
AtomicConfiguration cfg = new AtomicConfiguration();
cfg.setCacheMode(PARTITIONED);
cfg.setBackups(1);
cfg.setAtomicSequenceReserveSize(SEQ_RESERVE);
return cfg;
}
/** */
public void testDeactivate() throws Exception {
try {
Ignite ignite = startGridsMultiThreaded(GRIDS_CNT);
ignite.cache("test0").put(0, 0);
int id = 0;
for (Ignite ig : G.allGrids()) {
IgniteAtomicSequence seq = ig.atomicSequence("testSeq", 0, true);
long id0 = seq.getAndIncrement();
assertEquals(id0, id);
id += SEQ_RESERVE;
}
doSleep(1000);
long puts = ignite.cache("test0").metrics().getCachePuts();
assertEquals(1, puts);
grid(GRIDS_CNT - 1).cluster().active(false);
ignite.cluster().active(true);
long putsAfter = ignite.cache("test0").metrics().getCachePuts();
assertEquals(0, putsAfter);
}
finally {
stopAllGrids();
}
}
/** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
cleanPersistenceDir();
}
/** {@inheritDoc} */
@Override protected void beforeTest() throws Exception {
cleanPersistenceDir();
}
}
|
alexzaitzev/ignite
|
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteSequenceInternalCleanupTest.java
|
Java
|
apache-2.0
| 4,696
|
// preprocessed version of 'boost/mpl/vector/vector10.hpp' header
// see the original for copyright information
namespace boost {
namespace mpl {
template<
typename T0
>
struct vector1
: vector_node<
1
, T0
, vector0< >
>
{
};
template<
typename T0, typename T1
>
struct vector2
: vector_node<
2
, T0
, vector1<T1>
>
{
};
template<
typename T0, typename T1, typename T2
>
struct vector3
: vector_node<
3
, T0
, vector2< T1,T2 >
>
{
};
template<
typename T0, typename T1, typename T2, typename T3
>
struct vector4
: vector_node<
4
, T0
, vector3< T1,T2,T3 >
>
{
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
>
struct vector5
: vector_node<
5
, T0
, vector4< T1,T2,T3,T4 >
>
{
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5
>
struct vector6
: vector_node<
6
, T0
, vector5< T1,T2,T3,T4,T5 >
>
{
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6
>
struct vector7
: vector_node<
7
, T0
, vector6< T1,T2,T3,T4,T5,T6 >
>
{
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7
>
struct vector8
: vector_node<
8
, T0
, vector7< T1,T2,T3,T4,T5,T6,T7 >
>
{
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8
>
struct vector9
: vector_node<
9
, T0
, vector8< T1,T2,T3,T4,T5,T6,T7,T8 >
>
{
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
>
struct vector10
: vector_node<
10
, T0
, vector9< T1,T2,T3,T4,T5,T6,T7,T8,T9 >
>
{
};
} // namespace mpl
} // namespace boost
|
OLR-xray/OLR-3.0
|
src/3rd party/boost/boost/mpl/vector/aux_/preprocessed/typeof_based/vector10.hpp
|
C++
|
apache-2.0
| 2,235
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" >
<title>New Zealand 2013
- Proposal</title>
<meta name="author" content="John Willis" >
<link rel="alternate" type="application/rss+xml" title="devopsdays RSS Feed" href="http://www.devopsdays.org/feed/" >
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('jquery', '1.3.2');
</script>
<!---This is a combined jAmpersand, jqwindont , jPullquote -->
<script type="text/javascript" src="/js/devops.js"></script>
<!--- Blueprint CSS Framework Screen + Fancytype-Screen + jedi.css -->
<link rel="stylesheet" href="/css/devops.min.css" type="text/css" media="screen, projection">
<link rel="stylesheet" href="/css/blueprint/print.css" type="text/css" media="print">
<!--[if IE]>
<link rel="stylesheet" href="/css/blueprint/ie.css" type="text/css" media="screen, projection">
<![endif]-->
</head>
<body onload="initialize()">
<div class="container ">
<div class="span-24 last" id="header">
<div class="span-16 first">
<img src="/images/devopsdays-banner.png" title="devopsdays banner" width="801" height="115" alt="devopdays banner" ><br>
</div>
<div class="span-8 last">
</div>
</div>
<div class="span-24 last">
<div class="span-15 first">
<div id="headermenu">
<table >
<tr>
<td>
<a href="/"><img alt="home" title="home" src="/images/home.png"></a>
<a href="/">Home</a>
</td>
<td>
<a href="/contact/"><img alt="contact" title="contact" src="/images/contact.png"></a>
<a href="/contact/">Contact</a>
</td>
<td>
<a href="/events/"><img alt="events" title="events" src="/images/events.png"></a>
<a href="/events/">Events</a>
</td>
<td>
<a href="/presentations/"><img alt="presentations" title="presentations" src="/images/presentations.png"></a>
<a href="/presentations/">Presentations</a>
</td>
<td>
<a href="/blog/"><img alt="blog" title="blog" src="/images/blog.png"></a>
<a href="/blog/">Blog</a>
</td>
</tr>
</table>
</div>
</div>
<div class="span-8 last">
</div>
<div class="span-24 last" id="title">
<div class="span-15 first">
<h1>New Zealand 2013
- Proposal </h1>
</div>
<div class="span-8 last">
</div>
<h1>Gold sponsors</h1>
</div>
<div class="span-15 ">
<div class="span-15 last ">
<div class="submenu">
<h3>
<a href="/events/2013-newzealand/">welcome</a>
<a href="/events/2013-newzealand/propose">propose</a>
<a href="/events/2013-newzealand/program">program</a>
<a href="/events/2013-newzealand/registration">register</a>
<a href="/events/2013-newzealand/location">location</a>
<a href="/events/2013-newzealand/sponsor">sponsor</a>
<a href="/events/2013-newzealand/contact">contact</a>
</h3>
</div>
Back to <a href='..'>proposals overview</a> - <a href='../../program'>program</a>
<hr>
<h3>What is a Devops?</h3>
<p><strong>Abstract:</strong></p>
<p>This is the second most asked question today in IT. Obviously behind “What is a Cloud?”. Most people who have been following the Devops movement for the past three years would agree it really doesn’t or maybe shouldn’t even have a definition. For example “What is Agile?” doesn’t really have a simple answer. A general consensus of like minded Devops followers might agree with Adam Jacob’s, (founder of Opscode), definition of “It’s a cultural and professional movement”. That’s it. However, in this session we are going to try and expand on the ideas behind the Devops movement. We will attempt to discuss the “Why” of Devops. Why does it exist, what is it’s history, what are some of it’s patterns and also look at some practitioning examples. We will start by looking at some of the roots of the movement breaking down it’s history. We will take a deeper look at the following influences:</p>
<ul>
<li>Lean Manufacturing</li>
<li>Lean Startup</li>
<li>Agile and Agile Infrastructure</li>
<li>Continuous Delivery</li>
<li>Web Scale</li>
</ul>
<p>We will look at some of the direct and indirect influences of twentieth century management scientist like Deming, Goldratt and Ohno. We will also will look at taxonomy that has been used to try and identify certain patterns of Devops called CAMS.</p>
<ul>
<li>Culture</li>
<li>Automation</li>
<li>Measurement</li>
<li>Sharing</li>
</ul>
<p>And finally we will end up with a look at some successful Devops style companies who have been capturing the mindshare of this movement. Companies like:</p>
<ul>
<li>Etsy</li>
<li>Github</li>
<li>Netflix</li>
</ul>
<p>The audience for this presentation is for anyone who wants to ask or has already asked the question “What is Devops?”.</p>
<p><strong> Prerequisite Knowledge:</strong></p>
<p>None - this session is suitable for all levels of experience.</p>
<p><strong> Learning Outcomes:</strong></p>
<ul>
<li>Setup a good first presentation for the Devops track</li>
<li>Understand the influences behind the Devops movement</li>
<li>Understand a loose taxonomy for Devops (CAMS)</li>
<li>Understand how successful some organizations are operating in a Devops style</li>
</ul>
<p><strong>Speaker:</strong></p>
<p>John Willis (<a href="https://twitter.com/botchagalupe">@botchagalupe</a>)</p>
</div>
<div class="span-15 first last">
<script type="text/javascript">
// var disqus_developer = 1;
</script>
<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_shortname = 'devopsdays';
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
<a href="http://disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a>
<hr>
</div>
</div>
<div class="span-8 last">
<div class="span-8 last">
<a href='http://www.enstratus.com/'><img border=0 alt='enStratus' title='enStratus' width=100px height=100px src='/events/2013-newzealand/logos/enstratus.png'></a>
<a href='http://www.hw-ops.com/'><img border=0 alt='Heavy Water Software' title='Heavy Water Software' width=100px height=100px src='/events/2013-newzealand/logos/heavywater.png'></a>
<a href='http://www.neo4j.org/'><img border=0 alt='Neo4j' title='Neo4j' width=100px height=100px src='/events/2013-newzealand/logos/neo4j.png'></a>
<a href='https://puppetlabs.com/'><img border=0 alt='Puppet Labs' title='Puppet Labs' width=100px height=100px src='/events/2013-newzealand/logos/puppetlabs.png'></a>
<h1>Supporters</h1>
<a href='http://www.xero.com/'><img border=0 alt='Xero' title='Xero' width=100px height=100px src='/events/2013-newzealand/logos/xero.png'></a>
</div>
<div class="span-8 last">
</div>
</div>
</div>
</div>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-9713393-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>
|
benjohnson77/devopsdays-web
|
static/events/2013-newzealand/proposals/WhatIsaDevops/index.html
|
HTML
|
apache-2.0
| 7,765
|
/******************************************************************************
* Copyright 2018 The Apollo 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.
*****************************************************************************/
#include <memory>
#include <string>
#include <thread>
#include <vector>
#include "gtest/gtest.h"
#include "cyber/common/global_data.h"
#include "cyber/common/util.h"
#include "cyber/init.h"
#include "cyber/proto/unit_test.pb.h"
#include "cyber/transport/receiver/shm_receiver.h"
#include "cyber/transport/transmitter/shm_transmitter.h"
#include "cyber/transport/transport.h"
namespace apollo {
namespace cyber {
namespace transport {
class ShmTransceiverTest : public ::testing::Test {
protected:
using TransmitterPtr = std::shared_ptr<Transmitter<proto::UnitTest>>;
using ReceiverPtr = std::shared_ptr<Receiver<proto::UnitTest>>;
ShmTransceiverTest() : channel_name_("shm_channel") {}
virtual ~ShmTransceiverTest() {}
virtual void SetUp() {
RoleAttributes attr;
attr.set_host_name(common::GlobalData::Instance()->HostName());
attr.set_host_ip(common::GlobalData::Instance()->HostIp());
attr.set_channel_name(channel_name_);
attr.set_channel_id(common::Hash(channel_name_));
transmitter_a_ = std::make_shared<ShmTransmitter<proto::UnitTest>>(attr);
transmitter_b_ = std::make_shared<ShmTransmitter<proto::UnitTest>>(attr);
transmitter_a_->Enable();
transmitter_b_->Enable();
}
virtual void TearDown() {
transmitter_a_ = nullptr;
transmitter_b_ = nullptr;
}
std::string channel_name_;
TransmitterPtr transmitter_a_ = nullptr;
TransmitterPtr transmitter_b_ = nullptr;
};
TEST_F(ShmTransceiverTest, constructor) {
RoleAttributes attr;
TransmitterPtr transmitter =
std::make_shared<ShmTransmitter<proto::UnitTest>>(attr);
ReceiverPtr receiver =
std::make_shared<ShmReceiver<proto::UnitTest>>(attr, nullptr);
EXPECT_EQ(transmitter->seq_num(), 0);
auto& transmitter_id = transmitter->id();
auto& receiver_id = receiver->id();
EXPECT_NE(transmitter_id.ToString(), receiver_id.ToString());
}
TEST_F(ShmTransceiverTest, enable_and_disable) {
// repeated call
transmitter_a_->Enable();
std::vector<proto::UnitTest> msgs;
RoleAttributes attr;
attr.set_channel_name(channel_name_);
attr.set_channel_id(common::Hash(channel_name_));
ReceiverPtr receiver = std::make_shared<ShmReceiver<proto::UnitTest>>(
attr, [&msgs](const std::shared_ptr<proto::UnitTest>& msg,
const MessageInfo& msg_info, const RoleAttributes& attr) {
(void)msg_info;
(void)attr;
msgs.emplace_back(*msg);
});
receiver->Enable();
// repeated call
receiver->Enable();
ReceiverPtr receiver_null_cb =
std::make_shared<ShmReceiver<proto::UnitTest>>(attr, nullptr);
receiver_null_cb->Enable();
auto msg = std::make_shared<proto::UnitTest>();
msg->set_class_name("ShmTransceiverTest");
msg->set_case_name("enable_and_disable");
EXPECT_TRUE(transmitter_a_->Transmit(msg));
std::this_thread::sleep_for(std::chrono::milliseconds(100));
EXPECT_EQ(msgs.size(), 1);
EXPECT_TRUE(transmitter_b_->Transmit(msg));
std::this_thread::sleep_for(std::chrono::milliseconds(100));
EXPECT_EQ(msgs.size(), 2);
for (auto& item : msgs) {
EXPECT_EQ(item.class_name(), "ShmTransceiverTest");
EXPECT_EQ(item.case_name(), "enable_and_disable");
}
transmitter_b_->Disable(receiver->attributes());
EXPECT_FALSE(transmitter_b_->Transmit(msg));
transmitter_b_->Enable(receiver->attributes());
auto& transmitter_b_attr = transmitter_b_->attributes();
receiver->Disable();
receiver->Enable(transmitter_b_attr);
msgs.clear();
EXPECT_TRUE(transmitter_a_->Transmit(msg));
std::this_thread::sleep_for(std::chrono::milliseconds(100));
EXPECT_EQ(msgs.size(), 0);
EXPECT_TRUE(transmitter_b_->Transmit(msg));
std::this_thread::sleep_for(std::chrono::milliseconds(100));
EXPECT_EQ(msgs.size(), 1);
for (auto& item : msgs) {
EXPECT_EQ(item.class_name(), "ShmTransceiverTest");
EXPECT_EQ(item.case_name(), "enable_and_disable");
}
receiver->Disable(transmitter_b_attr);
msgs.clear();
EXPECT_TRUE(transmitter_b_->Transmit(msg));
std::this_thread::sleep_for(std::chrono::milliseconds(100));
EXPECT_EQ(msgs.size(), 0);
}
} // namespace transport
} // namespace cyber
} // namespace apollo
int main(int argc, char** argv) {
testing::InitGoogleTest(&argc, argv);
apollo::cyber::Init(argv[0]);
apollo::cyber::transport::Transport::Instance();
auto res = RUN_ALL_TESTS();
apollo::cyber::transport::Transport::Instance()->Shutdown();
return res;
}
|
xiaoxq/apollo
|
cyber/transport/transceiver/shm_transceiver_test.cc
|
C++
|
apache-2.0
| 5,224
|
/*
* Copyright 2014 NAVER Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.navercorp.pinpoint.plugin.cassandra.interceptor;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.Host;
import com.navercorp.pinpoint.bootstrap.context.DatabaseInfo;
import com.navercorp.pinpoint.bootstrap.context.MethodDescriptor;
import com.navercorp.pinpoint.bootstrap.context.SpanEventRecorder;
import com.navercorp.pinpoint.bootstrap.context.TraceContext;
import com.navercorp.pinpoint.bootstrap.interceptor.SpanEventSimpleAroundInterceptorForPlugin;
import com.navercorp.pinpoint.bootstrap.plugin.jdbc.DatabaseInfoAccessor;
import com.navercorp.pinpoint.bootstrap.plugin.jdbc.DefaultDatabaseInfo;
import com.navercorp.pinpoint.bootstrap.plugin.jdbc.UnKnownDatabaseInfo;
import com.navercorp.pinpoint.bootstrap.util.InterceptorUtils;
import com.navercorp.pinpoint.common.plugin.util.HostAndPort;
import com.navercorp.pinpoint.plugin.cassandra.CassandraConstants;
/**
* @author dawidmalina
*/
public class CassandraDriverConnectInterceptor extends SpanEventSimpleAroundInterceptorForPlugin {
private final boolean recordConnection;
public CassandraDriverConnectInterceptor(TraceContext context, MethodDescriptor descriptor) {
this(context, descriptor, true);
}
public CassandraDriverConnectInterceptor(TraceContext context, MethodDescriptor descriptor,
boolean recordConnection) {
super(context, descriptor);
this.recordConnection = recordConnection;
}
@Override
protected void logBeforeInterceptor(Object target, Object[] args) {
// Must not log args because it contains a password
logger.beforeInterceptor(target, null);
}
@Override
protected void doInBeforeTrace(SpanEventRecorder recorder, Object target, Object[] args) {
}
@Override
protected void logAfterInterceptor(Object target, Object[] args, Object result, Throwable throwable) {
logger.afterInterceptor(target, null, result, throwable);
}
@Override
protected void prepareAfterTrace(Object target, Object[] args, Object result, Throwable throwable) {
final boolean success = InterceptorUtils.isSuccess(throwable);
// Must not check if current transaction is trace target or not. Connection can be made by other thread.
final List<String> hostList = getHostList(target);
if (args == null) {
return;
}
final String keyspace = (String) args[0];
DatabaseInfo databaseInfo = createDatabaseInfo(keyspace, hostList);
if (success) {
if (recordConnection) {
if (result instanceof DatabaseInfoAccessor) {
((DatabaseInfoAccessor) result)._$PINPOINT$_setDatabaseInfo(databaseInfo);
}
}
}
}
private List<String> getHostList(Object target) {
if (!(target instanceof Cluster)) {
return Collections.emptyList();
}
final Cluster cluster = (Cluster) target;
final Set<Host> hosts = cluster.getMetadata().getAllHosts();
final int port = cluster.getConfiguration().getProtocolOptions().getPort();
final List<String> hostList = new ArrayList<>();
for (Host host : hosts) {
final String hostAddress = HostAndPort.toHostAndPortString(host.getAddress().getHostAddress(), port);
hostList.add(hostAddress);
}
return hostList;
}
@Override
protected void doInAfterTrace(SpanEventRecorder recorder, Object target, Object[] args, Object result,
Throwable throwable) {
if (recordConnection) {
DatabaseInfo databaseInfo;
if (result instanceof DatabaseInfoAccessor) {
databaseInfo = ((DatabaseInfoAccessor) result)._$PINPOINT$_getDatabaseInfo();
} else {
databaseInfo = null;
}
if (databaseInfo == null) {
databaseInfo = UnKnownDatabaseInfo.INSTANCE;
}
// Count database connect too because it's very heavy operation
recorder.recordServiceType(databaseInfo.getType());
recorder.recordEndPoint(databaseInfo.getMultipleHost());
recorder.recordDestinationId(databaseInfo.getDatabaseId());
}
recorder.recordApi(methodDescriptor);
recorder.recordException(throwable);
}
private DatabaseInfo createDatabaseInfo(String keyspace, List<String> hostList) {
if (keyspace == null) {
return UnKnownDatabaseInfo.INSTANCE;
}
DatabaseInfo databaseInfo = new DefaultDatabaseInfo(CassandraConstants.CASSANDRA, CassandraConstants.CASSANDRA_EXECUTE_QUERY,
null, null, hostList, keyspace);
if (isDebug) {
logger.debug("parse DatabaseInfo:{}", databaseInfo);
}
return databaseInfo;
}
}
|
emeroad/pinpoint
|
plugins/cassandra/src/main/java/com/navercorp/pinpoint/plugin/cassandra/interceptor/CassandraDriverConnectInterceptor.java
|
Java
|
apache-2.0
| 5,580
|
/******************************************************************************
* Copyright 2018 The Apollo 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.
*****************************************************************************/
/**
* @file
* @brief This file provides several unit tests for the class "NaviPlanner".
*/
#include "modules/planning/planner/navi/navi_planner.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "modules/common/vehicle_state/vehicle_state_provider.h"
#include "modules/localization/common/localization_gflags.h"
#include "modules/planning/common/planning_gflags.h"
namespace apollo {
namespace planning {
// TODO(all): Add your unit test code here according to the Google Unit Testing
// Specification.
TEST(NaviPlannerTest, ComputeTrajectory) {}
TEST(NaviPlannerTest, ErrorTest) {}
} // namespace planning
} // namespace apollo
|
xiaoxq/apollo
|
modules/planning/planner/navi/navi_planner_test.cc
|
C++
|
apache-2.0
| 1,424
|
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (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.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Rhino code, released
* May 6, 1999.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1997-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Norris Boyd
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Public License (the "GPL"), in which case the
* provisions of the GPL are applicable instead of those above.
* If you wish to allow use of your version of this file only
* under the terms of the GPL and not to allow others to use your
* version of this file under the NPL, indicate your decision by
* deleting the provisions above and replace them with the notice
* and other provisions required by the GPL. If you do not delete
* the provisions above, a recipient may use your version of this
* file under either the NPL or the GPL.
*/
package com.google.gwt.dev.js.rhino;
/**
* This class allows the creation of nodes, and follows the Factory pattern.
*
* @see Node
*/
public class IRFactory {
public IRFactory(TokenStream ts) {
this.ts = ts;
}
/**
* Script (for associating file/url names with toplevel scripts.)
*/
public Object createScript(Object body, String sourceName,
int baseLineno, int endLineno, Object source)
{
Node result = new Node(TokenStream.SCRIPT);
Node children = ((Node) body).getFirstChild();
if (children != null)
result.addChildrenToBack(children);
result.putProp(Node.SOURCENAME_PROP, sourceName);
result.putIntProp(Node.BASE_LINENO_PROP, baseLineno);
result.putIntProp(Node.END_LINENO_PROP, endLineno);
if (source != null)
result.putProp(Node.SOURCE_PROP, source);
return result;
}
/**
* Leaf
*/
public Object createLeaf(int nodeType) {
return new Node(nodeType);
}
public Object createLeaf(int nodeType, int nodeOp) {
return new Node(nodeType, nodeOp);
}
public int getLeafType(Object leaf) {
Node n = (Node) leaf;
return n.getType();
}
/**
* Statement leaf nodes.
*/
public Object createSwitch(int lineno) {
return new Node(TokenStream.SWITCH, lineno);
}
public Object createVariables(int lineno) {
return new Node(TokenStream.VAR, lineno);
}
public Object createExprStatement(Object expr, int lineno) {
return new Node(TokenStream.EXPRSTMT, (Node) expr, lineno);
}
/**
* Name
*/
public Object createName(String name) {
return Node.newString(TokenStream.NAME, name);
}
/**
* String (for literals)
*/
public Object createString(String string) {
return Node.newString(string);
}
/**
* Number (for literals)
*/
public Object createNumber(int number) {
return Node.newNumber(number);
}
public Object createNumber(double number) {
return Node.newNumber(number);
}
/**
* Catch clause of try/catch/finally
* @param varName the name of the variable to bind to the exception
* @param catchCond the condition under which to catch the exception.
* May be null if no condition is given.
* @param stmts the statements in the catch clause
* @param lineno the starting line number of the catch clause
*/
public Object createCatch(String varName, Object catchCond, Object stmts,
int lineno)
{
if (catchCond == null) {
catchCond = new Node(TokenStream.PRIMARY, TokenStream.TRUE);
}
return new Node(TokenStream.CATCH, (Node)createName(varName),
(Node)catchCond, (Node)stmts, lineno);
}
/**
* Throw
*/
public Object createThrow(Object expr, int lineno) {
return new Node(TokenStream.THROW, (Node)expr, lineno);
}
/**
* Return
*/
public Object createReturn(Object expr, int lineno) {
return expr == null
? new Node(TokenStream.RETURN, lineno)
: new Node(TokenStream.RETURN, (Node)expr, lineno);
}
/**
* Label
*/
public Object createLabel(String label, int lineno) {
Node result = new Node(TokenStream.LABEL, lineno);
Node name = Node.newString(TokenStream.NAME, label);
result.addChildToBack(name);
return result;
}
/**
* Break (possibly labeled)
*/
public Object createBreak(String label, int lineno) {
Node result = new Node(TokenStream.BREAK, lineno);
if (label == null) {
return result;
} else {
Node name = Node.newString(TokenStream.NAME, label);
result.addChildToBack(name);
return result;
}
}
/**
* Continue (possibly labeled)
*/
public Object createContinue(String label, int lineno) {
Node result = new Node(TokenStream.CONTINUE, lineno);
if (label == null) {
return result;
} else {
Node name = Node.newString(TokenStream.NAME, label);
result.addChildToBack(name);
return result;
}
}
/**
* debugger
*/
public Object createDebugger(int lineno) {
Node result = new Node(TokenStream.DEBUGGER, lineno);
return result;
}
/**
* Statement block
* Creates the empty statement block
* Must make subsequent calls to add statements to the node
*/
public Object createBlock(int lineno) {
return new Node(TokenStream.BLOCK, lineno);
}
public Object createFunction(String name, Object args, Object statements,
String sourceName, int baseLineno,
int endLineno, Object source,
boolean isExpr)
{
Node f = new Node(TokenStream.FUNCTION,
Node.newString(TokenStream.NAME,
name == null ? "" : name),
(Node)args, (Node)statements, baseLineno);
f.putProp(Node.SOURCENAME_PROP, sourceName);
f.putIntProp(Node.BASE_LINENO_PROP, baseLineno);
f.putIntProp(Node.END_LINENO_PROP, endLineno);
if (source != null)
f.putProp(Node.SOURCE_PROP, source);
return f;
}
/**
* Add a child to the back of the given node. This function
* breaks the Factory abstraction, but it removes a requirement
* from implementors of Node.
*/
public void addChildToBack(Object parent, Object child) {
((Node)parent).addChildToBack((Node)child);
}
/**
* While
*/
public Object createWhile(Object cond, Object body, int lineno) {
return new Node(TokenStream.WHILE, (Node)cond, (Node)body, lineno);
}
/**
* DoWhile
*/
public Object createDoWhile(Object body, Object cond, int lineno) {
return new Node(TokenStream.DO, (Node)body, (Node)cond, lineno);
}
/**
* For
*/
public Object createFor(Object init, Object test, Object incr,
Object body, int lineno)
{
return new Node(TokenStream.FOR, (Node)init, (Node)test, (Node)incr,
(Node)body);
}
/**
* For .. In
*
*/
public Object createForIn(Object lhs, Object obj, Object body, int lineno) {
return new Node(TokenStream.FOR, (Node)lhs, (Node)obj, (Node)body);
}
/**
* Try/Catch/Finally
*/
public Object createTryCatchFinally(Object tryblock, Object catchblocks,
Object finallyblock, int lineno)
{
if (finallyblock == null) {
return new Node(TokenStream.TRY, (Node)tryblock, (Node)catchblocks);
}
return new Node(TokenStream.TRY, (Node)tryblock,
(Node)catchblocks, (Node)finallyblock);
}
/**
* Throw, Return, Label, Break and Continue are defined in ASTFactory.
*/
/**
* With
*/
public Object createWith(Object obj, Object body, int lineno) {
return new Node(TokenStream.WITH, (Node)obj, (Node)body, lineno);
}
/**
* Array Literal
*/
public Object createArrayLiteral(Object obj) {
return obj;
}
/**
* Object Literals
*/
public Object createObjectLiteral(Object obj) {
return obj;
}
/**
* Regular expressions
*/
public Object createRegExp(String string, String flags) {
return flags.length() == 0
? new Node(TokenStream.REGEXP,
Node.newString(string))
: new Node(TokenStream.REGEXP,
Node.newString(string),
Node.newString(flags));
}
/**
* If statement
*/
public Object createIf(Object cond, Object ifTrue, Object ifFalse,
int lineno)
{
if (ifFalse == null)
return new Node(TokenStream.IF, (Node)cond, (Node)ifTrue, lineno);
return new Node(TokenStream.IF, (Node)cond, (Node)ifTrue, (Node)ifFalse, lineno);
}
public Object createTernary(Object cond, Object ifTrue, Object ifFalse) {
return new Node(TokenStream.HOOK,
(Node)cond, (Node)ifTrue, (Node)ifFalse);
}
/**
* Unary
*/
public Object createUnary(int nodeType, Object child) {
Node childNode = (Node) child;
return new Node(nodeType, childNode);
}
public Object createUnary(int nodeType, int nodeOp, Object child) {
return new Node(nodeType, (Node)child, nodeOp);
}
/**
* Binary
*/
public Object createBinary(int nodeType, Object left, Object right) {
Node temp;
switch (nodeType) {
case TokenStream.DOT:
nodeType = TokenStream.GETPROP;
Node idNode = (Node) right;
idNode.setType(TokenStream.STRING);
String id = idNode.getString();
if (id.equals("__proto__") || id.equals("__parent__")) {
Node result = new Node(nodeType, (Node) left);
result.putProp(Node.SPECIAL_PROP_PROP, id);
return result;
}
break;
case TokenStream.LB:
// OPT: could optimize to GETPROP iff string can't be a number
nodeType = TokenStream.GETELEM;
break;
}
return new Node(nodeType, (Node)left, (Node)right);
}
public Object createBinary(int nodeType, int nodeOp, Object left,
Object right)
{
if (nodeType == TokenStream.ASSIGN) {
return createAssignment(nodeOp, (Node) left, (Node) right,
null, false);
}
return new Node(nodeType, (Node) left, (Node) right, nodeOp);
}
public Object createAssignment(int nodeOp, Node left, Node right,
Class convert, boolean postfix)
{
int nodeType = left.getType();
switch (nodeType) {
case TokenStream.NAME:
case TokenStream.GETPROP:
case TokenStream.GETELEM:
break;
default:
// TODO: This should be a ReferenceError--but that's a runtime
// exception. Should we compile an exception into the code?
reportError("msg.bad.lhs.assign");
}
return new Node(TokenStream.ASSIGN, left, right, nodeOp);
}
private void reportError(String msgResource) {
String message = Context.getMessage0(msgResource);
ts.reportSyntaxError(message, null);
}
// Only needed to get file/line information. Could create an interface
// that TokenStream implements if we want to make the connection less
// direct.
private TokenStream ts;
}
|
vovagrechka/fucking-everything
|
phizdets/phizdetsc/src/com/google/gwt/dev/js/rhino/IRFactory.java
|
Java
|
apache-2.0
| 12,742
|
#!/bin/bash
errors=0
OUTPUT=$(mktemp)
trap "{ rm -rf $OUTPUT; exit $?; }" SIGINT SIGTERM EXIT
# Verify that the ZEROVM_ROOT var is set:
if [ -z "${ZEROVM_ROOT}" ]; then
echo "Error: ZEROVM_ROOT variable is not set"
exit 1
fi
cd $ZEROVM_ROOT/tests/functional/include
make -s clean all
for i in $(find $ZEROVM_ROOT/tests -mindepth 1 -type d); do
cd $i
if [ -x ./test.sh ]; then
./test.sh | tee "${OUTPUT}"
# check for and count failures
if [[ "$?" -ne 0 || $(grep "failed" "${OUTPUT}") ]]; then
errors=$(($errors + 1))
fi
fi
done
if [ $errors -gt 0 ]; then
# If any of the tests failed,
# make sure we don't falsely return a 0 exit status
echo "There were $errors errors"
exit 1
fi
|
zerovm/zerovm
|
ftests.sh
|
Shell
|
apache-2.0
| 765
|
# coding=utf-8
from django_sae.contrib.tasks.cron import OperationView
from django_sae.contrib.tasks.operations import TaskOperationMixin
class OperationViewMock(OperationView):
def get_operation(self, request):
return [TaskOperationMixin() for _ in range(0, 3)]
|
zl352773277/django-sae
|
django_sae/contrib/tasks/tests/views.py
|
Python
|
apache-2.0
| 276
|
<?php
/**
* PHP Version 5
*
* @category Amazon
* @package MarketplaceWebServiceOrders
* @copyright Copyright 2008-2009 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* @link http://aws.amazon.com
* @license http://aws.amazon.com/apache2.0 Apache License, Version 2.0
* @version 2011-01-01
*/
/*******************************************************************************
*
* Marketplace Web Service Orders PHP5 Library
* Generated: Fri Jan 21 18:53:17 UTC 2011
*
*/
/**
* @see MarketplaceWebServiceOrders_Model
*/
require_once ('MarketplaceWebServiceOrders/Model.php');
private valueField;
/**
* MarketplaceWebServiceOrders_Model_MaxResults
*
* Properties:
* <ul>
*
*
* </ul>
*/
class MarketplaceWebServiceOrders_Model_MaxResults extends MarketplaceWebServiceOrders_Model
{
/**
* Construct new MarketplaceWebServiceOrders_Model_MaxResults
*
* @param mixed $data DOMElement or Associative Array to construct from.
*
* Valid properties:
* <ul>
*
*
* </ul>
*/
public function __construct($data = null)
{
$this->_fields = array (
);
parent::__construct($data);
}
/**
* Gets the value of the Value property.
*
* @return Value
*/
public function getValue()
{
return $this->_value;
}
/**
* Sets the value of the Value property.
*
* @param Value
* @return void
*/
public function setValue($value)
{
$this->_Value = $value;
return;
}
/**
* Checks if Value property is set
*
* @return bool true if Value property is set
*/
public function isSetValue()
{
return !is_null($this->_value);
}
}
|
ivory883/amazon-mws-php-fork
|
src/MarketplaceWebServiceOrders/Model/MaxResults.php
|
PHP
|
apache-2.0
| 1,720
|
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
/* $Source: src/usr/diag/prdf/common/framework/resolution/xspprdFlagResolution.C $ */
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2012,2015 */
/* [+] International Business Machines Corp. */
/* */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
/* you may not use this file except in compliance with the License. */
/* You may obtain a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
/* implied. See the License for the specific language governing */
/* permissions and limitations under the License. */
/* */
/* IBM_PROLOG_END_TAG */
// Module Description **************************************************
//
// Description:
//
// End Module Description **********************************************
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#define xspprdFlagResolution_C
#include <xspprdFlagResolution.h>
#include <iipServiceDataCollector.h>
#undef xspprdFlagResolution_C
namespace PRDF
{
//---------------------------------------------------------------------
// Member Function Specifications
//---------------------------------------------------------------------
int32_t FlagResolution::Resolve(STEP_CODE_DATA_STRUCT & error)
{
uint32_t rc = SUCCESS;
error.service_data->setFlag(xFlag);
return rc;
}
} // end namespace PRDF
|
Over-enthusiastic/hostboot
|
src/usr/diag/prdf/common/framework/resolution/xspprdFlagResolution.C
|
C++
|
apache-2.0
| 2,687
|
/*
* ContentModuleParserTest.java
* JUnit based test
*
* Created on February 2, 2005, 3:35 PM
*/
package com.rometools.modules.content;
import java.io.File;
import java.util.List;
import com.rometools.modules.AbstractTestCase;
import com.rometools.modules.content.ContentItem;
import com.rometools.modules.content.ContentModule;
import com.rometools.rome.feed.synd.SyndEntry;
import com.rometools.rome.feed.synd.SyndFeed;
import com.rometools.rome.io.SyndFeedInput;
import com.rometools.rome.io.XmlReader;
/**
*
* @author <a href="mailto:cooper@screaming-penguin.com">Robert Cooper</a>
*/
public class ContentModuleParserTest extends AbstractTestCase {
public ContentModuleParserTest(final String testName) {
super(testName);
}
@Override
protected void setUp() throws java.lang.Exception {
}
@Override
protected void tearDown() throws java.lang.Exception {
}
public static junit.framework.Test suite() {
final junit.framework.TestSuite suite = new junit.framework.TestSuite(ContentModuleParserTest.class);
return suite;
}
/**
* Test of parse method, of class com.rometools.rome.feed.module.content.ContentModuleParser.
* It will test through the whole ROME framework.
*/
public void testParse() throws Exception {
final SyndFeedInput input = new SyndFeedInput();
final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("xml/test-rdf.xml")).toURI().toURL()));
final SyndEntry entry = feed.getEntries().get(0);
final ContentModule module = (ContentModule) entry.getModule(ContentModule.URI);
final List<ContentItem> items = module.getContentItems();
for (int i = 0; i < items.size(); i++) {
// FIXME
// final ContentItem item = ContentModuleImplTest.contentItems.get(i);
// assertEquals (item , items.get(i));
}
}
}
|
icyerasor/rome-modules
|
src/test/java/com/rometools/modules/content/ContentModuleParserTest.java
|
Java
|
apache-2.0
| 1,930
|
import os
import yaml
from google.cloud import storage
from google.oauth2 import service_account
from .storage import Storage
class GcsStorage(Storage):
def __init__(self, bucket, path, project=None, json_path=None):
if bucket is None:
raise ValueError('Bucket must be supplied to GCS storage')
if path is None:
path = 'spinbot/cache'
self.path = path
if json_path is not None:
json_path = os.path.expanduser(json_path)
credentials = service_account.Credentials.from_service_account_file(json_path)
if credentials.requires_scopes:
credentials = credentials.with_scopes(['https://www.googleapis.com/auth/devstorage.read_write'])
self.client = storage.Client(project=project, credentials=credentials)
else:
self.client = storage.Client()
if self.client.lookup_bucket(bucket) is None:
self.client.create_bucket(bucket)
self.bucket = self.client.get_bucket(bucket)
super().__init__()
def store(self, key, val):
b = self.bucket.get_blob(self.path)
contents = '{}'
if b:
contents = b.download_as_string()
else:
b = self.bucket.blob(self.path)
props = yaml.safe_load(contents)
if props is None:
props = {}
props[key] = val
b.upload_from_string(yaml.safe_dump(props))
def load(self, key):
b = self.bucket.get_blob(self.path)
contents = '{}'
if b:
contents = b.download_as_string()
else:
b = self.bucket.blob(self.path)
props = yaml.safe_load(contents)
if props is None:
props = {}
return props.get(key)
|
skim1420/spinnaker
|
spinbot/storage/gcs_storage.py
|
Python
|
apache-2.0
| 1,786
|
## Usage of objectives
An objective function (or loss function, or optimization score function) is one of the two parameters required to compile a model:
**Scala:**
```scala
model.compile(loss = "mean_squared_error", optimizer = "sgd")
```
**Python:**
```python
model.compile(loss='mean_squared_error', optimizer='sgd')
```
**Scala:**
```scala
model.compile(loss = MeanSquaredError(sizeAverage = true), optimizer = "sgd")
```
**Python:**
```python
model.compile(loss=MeanSquaredError(size_average=True), optimizer='sgd')
```
---
## Available objectives
### MeanSquaredError
The mean squared error criterion e.g. input: a, target: b, total elements: n
```
loss(a, b) = 1/n * sum(|a_i - b_i|^2)
```
**Scala:**
```scala
loss = MeanSquaredError(sizeAverage = true)
```
Parameters:
* `sizeAverage` a boolean indicating whether to divide the sum of squared error by n.
Default: true
**Python:**
```python
loss = MeanSquaredError(size_average=True)
```
Parameters:
* `size_average` a boolean indicating whether to divide the sum of squared error by n.
Default: True
### MeanAbsoluteError
Measures the mean absolute value of the element-wise difference between input and target
**Scala:**
```scala
loss = MeanAbsoluteError(sizeAverage = true)
```
Parameters:
* `sizeAverage` a boolean indicating whether to divide the sum of squared error by n.
Default: true
**Python:**
```python
loss = MeanAbsoluteError(size_average=True)
```
Parameters:
* `size_average` a boolean indicating whether to divide the sum of squared error by n.
Default: True
### BinaryCrossEntropy
Also known as logloss.
**Scala:**
```scala
loss = BinaryCrossEntropy(weights = null, sizeAverage = true)
```
Parameters:
* `weights` A tensor assigning weight to each of the classes
* `sizeAverage` whether to divide the sequence length. Default is true.
**Python:**
```python
loss = BinaryCrossEntropy(weights=None, size_average=True)
```
Parameters:
* `weights` A tensor assigning weight to each of the classes
* `size_average` whether to divide the sequence length. Default is True.
### SparseCategoricalCrossEntropy
A loss often used in multi-class classification problems with SoftMax as the last layer of the neural network. By default, input(y_pred) is supposed to be probabilities of each class, and target(y_true) is supposed to be the class label starting from 0.
**Scala:**
```scala
loss = SparseCategoricalCrossEntropy(logProbAsInput = false, zeroBasedLabel = true, weights = null, sizeAverage = true, paddingValue = -1)
```
Parameters:
* `logProbAsInput` Boolean. Whether to accept log-probabilities or probabilities as input. Default is false and inputs should be probabilities.
* `zeroBasedLabel` Boolean. Whether target labels start from 0. Default is true. If false, labels start from 1.
* `weights` Tensor. Weights of each class if you have an unbalanced training set. Default is null.
* `sizeAverage` Boolean. Whether losses are averaged over observations for each mini-batch. Default is true. If false, the losses are instead summed for each mini-batch.
* `paddingValue` Integer. If the target is set to this value, the training process will skip this sample. In other words, the forward process will return zero output and the backward process will also return zero gradInput. Default is -1.
**Python:**
```python
loss = SparseCategoricalCrossEntropy(log_prob_as_input=False, zero_based_label=True, weights=None, size_average=True, padding_value=-1)
```
Parameters:
* `log_prob_as_input` Boolean. Whether to accept log-probabilities or probabilities as input. Default is false and inputs should be probabilities.
* `zero_based_label` Boolean. Whether target labels start from 0. Default is true. If false, labels start from 1.
* `weights` A Numpy array. Weights of each class if you have an unbalanced training set. Default is None.
* `size_average` Boolean. Whether losses are averaged over observations for each mini-batch. Default is True. If False, the losses are instead summed for each mini-batch.
* `padding_value` Integer. If the target is set to this value, the training process will skip this sample. In other words, the forward process will return zero output and the backward process will also return zero gradInput. Default is -1.
### MeanAbsolutePercentageError
Compute mean absolute percentage error for intput and target
**Scala:**
```scala
loss = MeanAbsolutePercentageError()
```
Parameters:
* `sizeAverage` a boolean indicating whether to divide the sum of squared error by n.
Default: true
**Python:**
```python
loss = MeanAbsolutePercentageError()
```
Parameters:
* `size_average` a boolean indicating whether to divide the sum of squared error by n.
Default: True
### MeanSquaredLogarithmicError
Compute mean squared logarithmic error for input and target
**Scala:**
```scala
loss = MeanSquaredLogarithmicError()
```
**Python:**
```python
loss = MeanSquaredLogarithmicError()
```
### CategoricalCrossEntropy
This is same with cross entropy criterion, except the target tensor is a
one-hot tensor.
**Scala:**
```scala
loss = CategoricalCrossEntropy()
```
**Python:**
```python
loss = CategoricalCrossEntropy()
```
### Hinge
Creates a criterion that optimizes a two-class classification hinge loss (margin-based loss) between input x (a Tensor of dimension 1) and output y.
**Scala:**
```scala
loss = Hinge(margin = 1.0, sizeAverage = true)
```
Parameters:
* `margin` if unspecified, is by default 1.
* `sizeAverage` whether to average the loss, is by default true
**Python:**
```python
loss = Hinge(margin=1.0, size_average=True)
```
Parameters:
* `margin` if unspecified, is by default 1.
* `size_average` whether to average the loss, is by default True
### RankHinge
Hinge loss for pairwise ranking problems.
**Scala:**
```scala
loss = RankHinge(margin = 1.0)
```
Parameters:
* `margin` if unspecified, is by default 1.
**Python:**
```python
loss = RankHinge(margin=1.0)
```
Parameters:
* `margin` if unspecified, is by default 1.
### SquaredHinge
Creates a criterion that optimizes a two-class classification squared hinge loss (margin-based loss) between input x (a Tensor of dimension 1) and output y.
**Scala:**
```scala
loss = SquaredHinge(margin = 1.0, sizeAverage = true)
```
Parameters:
* `margin` if unspecified, is by default 1.
* `sizeAverage` whether to average the loss, is by default true
**Python:**
```python
loss = SquaredHinge(margin=1.0, size_average=True)
```
Parameters:
* `margin` if unspecified, is by default 1.
* `size_average` whether to average the loss, is by default True
### Poisson
Compute Poisson error for intput and target
**Scala:**
```scala
loss = Poisson()
```
**Python:**
```python
loss = Poisson()
```
### CosineProximity
Computes the negative of the mean cosine proximity between predictions and targets.
**Scala:**
```scala
loss = CosineProximity()
```
**Python:**
```python
loss = CosineProximity()
```
### KullbackLeiblerDivergence
Loss calculated as:
```
y_true = K.clip(y_true, K.epsilon(), 1)
y_pred = K.clip(y_pred, K.epsilon(), 1)
```
and output K.sum(y_true * K.log(y_true / y_pred), axis=-1)
**Scala:**
```scala
loss = KullbackLeiblerDivergence()
```
**Python:**
```python
loss = KullbackLeiblerDivergence()
```
|
intel-analytics/analytics-zoo
|
docs/docs/KerasStyleAPIGuide/Optimization/objectives.md
|
Markdown
|
apache-2.0
| 7,752
|
// TODO: remove from `core-js@4`
require('../../../modules/esnext.string.match-all');
var parent = require('../../../stable/string/virtual/match-all');
module.exports = parent;
|
cloudfoundry-community/asp.net5-buildpack
|
fixtures/node_apps/angular_dotnet/ClientApp/node_modules/core-js/features/string/virtual/match-all.js
|
JavaScript
|
apache-2.0
| 179
|
// Copyright © 2016 Google. All rights reserved.
@import GoogleMobileAds;
@import UIKit;
@interface MDIBannerViewController : UIViewController
/// Designated initializer. Initializes a new instance with ad size.
- (instancetype)initWithAdSize:(GADAdSize)size NS_DESIGNATED_INITIALIZER;
/// Unavailable.
- (instancetype)initWithCoder:(NSCoder *)aDecoder NS_UNAVAILABLE;
/// Unavailable.
- (instancetype)initWithNibName:(NSString *)nibNameOrNil
bundle:(NSBundle *)nibBundleOrNil NS_UNAVAILABLE;
/// Unavailable.
- (instancetype)init NS_UNAVAILABLE;
@end
|
InMobi/sdk-partners-code
|
partner-adapter-codes/admob/AdMob-Adapter-iOS-master/AdMob-iOSTestApp/TestApp/TestApp/MDIBannerViewController.h
|
C
|
apache-2.0
| 585
|
<div>
<h3>第二十章</h3>
<p>1厥后、摩押人、亚扪人、及米乌尼人、来攻约沙法、</p>
<p>2或告约沙法曰、有群众自海外亚兰来攻尔、今在哈洗逊他玛、即隐基底、</p>
<p>3约沙法惧、决意寻求耶和华、于犹大全地、宣告禁食、</p>
<p>4犹大人自诸邑而来、会集寻求耶和华、</p>
<p>5约沙法立于犹大及耶路撒冷会中、在耶和华室之新院前、</p>
<p>6曰、我列祖之上帝耶和华欤、尔非天上上帝乎、尔非治万民诸国乎、尔手有能有力、无人能御尔也、</p>
<p>7我上帝欤、斯土居民、尔非逐于尔民以色列前、以此地锡予尔友亚伯拉罕之裔、至于永久乎、</p>
<p>8彼乃居之、为尔名而建圣所、</p>
<p>9曰、灾害若临于我、或锋刃惩罚、或疫疠饥馑、缘尔名在此室、我则立于此室与尔之前、因遇难而吁尔、尔必垂听、而施救援、</p>
<p>10试观亚扪人、摩押人、及西珥山人、即以色列族出埃及时、尔所禁侵其境、使转离之、不加翦灭者、</p>
<p>11今彼若何报我、乃来逐我、出尔所赐为业之地、</p>
<p>12我上帝欤、尔不惩之乎、我侪无力御此攻我之众、不知所为、我目惟尔是望、</p>
<p>13犹大人众、与其妻室、子女孩提、咸立于耶和华前、</p>
<p>14耶和华之神于会中、感利未人亚萨裔、玛探雅玄孙、耶利曾孙、比拿雅孙、撒迦利雅子雅哈悉、</p>
<p>15乃曰、犹大人众、耶路撒冷居民、约沙法王、尔其听之、耶和华告尔云、勿缘斯众、畏葸恐惶、盖此战不在尔、乃在上帝也、</p>
<p>16明日彼众由洗斯阪而上、尔可下而迎之、必遇之于谷口、耶鲁伊勒野前、</p>
<p>17尔无庸战、当列陈而立、观耶和华之救援、犹大与耶路撒冷人欤、勿畏葸、勿恐惶、明日出而御之、盖耶和华与尔偕焉、</p>
<p>18约沙法俯首面地、犹大人众、与耶路撒冷居民、俯伏于耶和华前、而崇拜之、</p>
<p>19哥辖可拉二族之利未人起立、颂赞以色列之上帝耶和华、其声甚大、</p>
<p>20翌日、民众夙兴、往提哥亚野、出时、约沙法立而言曰、犹大人与耶路撒冷居民欤、宜听我言、信尔之上帝耶和华、则必坚立、信其先知、则必亨通、</p>
<p>21约沙法既与民议、遂立人讴歌耶和华、衣圣服行于军前曰、当称谢耶和华、以其慈惠永存、</p>
<p>22甫讴歌颂赞时、耶和华发伏兵、以敌来攻犹大之亚扪人、摩押人、及西珥山人、俱为所击、</p>
<p>23盖亚扪人、摩押人、起攻西珥山人、杀而灭之、既歼西珥人、则自相残杀、</p>
<p>24犹大人至旷野戍楼、以望群众、见尸仆地、无一逃者、</p>
<p>25约沙法与民来取敌人之物、在尸中得货财珍宝甚多、剥尸所得、过于所能负荷、取之三日、物多故也、</p>
<p>26越至四日、集于比拉迦谷、颂赞耶和华、故其地名曰比拉迦谷、至于今日、</p>
<p>27约沙法率犹大与耶路撒冷人、欢然而归耶路撒冷、因耶和华使之胜敌而喜也、</p>
<p>28鸣琴鼓瑟吹角、至耶路撒冷、诣耶和华室、</p>
<p>29列邦诸族闻耶和华击以色列人之敌、无不畏惧上帝、</p>
<p>30约沙法之国平康、以其上帝锡之四境绥安也、○</p>
<p>31约沙法为犹大王、即位时、年三十有五、在耶路撒冷为王、历二十五年、其母名阿苏巴、示利希女也、</p>
<p>32约沙法循其父亚撒之道、不偏离之、行耶和华所悦、</p>
<p>33惟崇邱未废、民未决志归其列祖之上帝、</p>
<p>34约沙法其余事迹之始末、俱载于哈拿尼子耶户书、入于以色列列王纪、○</p>
<p>35此后、犹大王约沙法、与以色列王亚哈谢联盟、亚哈谢行恶特甚、</p>
<p>36约沙法与之协和、造舟于以旬迦别、欲往他施、</p>
<p>37玛利沙人多大瓦子以利以谢、向约沙法预言曰、因尔与亚哈谢联盟、耶和华必毁尔之所造、于是舟破、不能往他施、</p>
</div>
|
yighu/wenli
|
wenliandroid/unpacked/assets/www/chapter471.html
|
HTML
|
apache-2.0
| 4,160
|
/************************************************************************************
Filename : VRTouchPadGestureDetector.java
Content :
Created :
Authors :
Copyright : Copyright 2014 Oculus VR, Inc. All Rights reserved.
Licensed under the Oculus VR SDK License Version 3.0 (the "License");
you may not use the Oculus VR SDK except in compliance with the License,
which is provided at the time of installation or download, or which
otherwise accompanies this software in either electronic or hard copy form.
You may obtain a copy of the License at
http://www.oculusvr.com/licenses/LICENSE-3.0
Unless required by applicable law or agreed to in writing, the Oculus VR SDK
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.gearvrf.immersivepedia.util;
import android.content.Context;
import android.os.Handler;
import android.view.GestureDetector;
import android.view.GestureDetector.OnDoubleTapListener;
import android.view.GestureDetector.OnGestureListener;
import android.view.MotionEvent;
import android.view.View;
/**
* Detects various gestures and events using the supplied {@link MotionEvent}s.
* The {@link OnGestureListener} callback will notify users when a particular
* motion event has occurred. This class should only be used with
* {@link MotionEvent}s reported via touch (don't use for trackball events). To
* use this class:
* <ul>
* <li>Create an instance of the {@code VRTouchPadGestureDetector} for your
* {@link View}
* <li>In the {@link View#onTouchEvent(MotionEvent)} method ensure you call
* {@link #onTouchEvent(MotionEvent)}. The methods defined in your callback will
* be executed when the events occur.
* </ul>
*/
@SuppressWarnings("deprecation")
public class VRTouchPadGestureDetector extends Object implements
OnGestureListener, OnDoubleTapListener {
private static final int SWIPE_MIN_DISTANCE = 80;
private static final int ONTAP_MIN_DISTANCE = 0;
public enum SwipeDirection {
Backward, Forward, Down, Up, Ignore
}
GestureDetector gestureDetector;
VRTouchPadGestureDetector.OnTouchPadGestureListener gestureListener;
VRTouchPadGestureDetector.OnTouchPadDoubleTapListener doubleTapListener;
/**
* The listener that is used to notify when gestures occur.
*/
public interface OnTouchPadGestureListener {
/**
* Notified when a tap occurs with the up {@link MotionEvent} that
* triggered it.
*
* @param e The up motion event that completed the first tap
* @return true if the event is consumed, else false
*/
boolean onSingleTap(MotionEvent e);
/**
* Notified when a long press occurs with the initial on down
* {@link MotionEvent} that triggered it.
*
* @param e The initial on down motion event that started the longpress.
*/
void onLongPress(MotionEvent e);
/**
* Notified when a swipe occurs.
*
* @param e1 The first down motion event that started the fling.
* @param swipeDirection The direction of swipe.
* @param velocityX The velocity of this fling measured in pixels per
* second along the x axis.
* @param velocityY The velocity of this fling measured in pixels per
* second along the y axis.
* @return true if the event is consumed, else false
*/
boolean onSwipe(MotionEvent e, SwipeDirection swipeDirection,
float velocityX, float velocityY);
}
/**
* The listener that is used to notify when a double-tap or a confirmed
* single-tap occur.
*/
public interface OnTouchPadDoubleTapListener {
/**
* Notified when a single-tap occurs.
*
* @param e The down motion event of the single-tap.
* @return true if the event is consumed, else false
*/
boolean onSingleTapConfirmed(MotionEvent e);
/**
* Notified when a double-tap occurs.
*
* @param e The down motion event of the first tap of the double-tap.
* @return true if the event is consumed, else false
*/
boolean onDoubleTap(MotionEvent e);
}
@SuppressWarnings("deprecation")
public VRTouchPadGestureDetector(
VRTouchPadGestureDetector.OnTouchPadGestureListener listener) {
gestureDetector = new GestureDetector(this);
gestureListener = listener;
}
public VRTouchPadGestureDetector(Context context,
VRTouchPadGestureDetector.OnTouchPadGestureListener listener) {
gestureDetector = new GestureDetector(context, this);
gestureListener = listener;
}
public VRTouchPadGestureDetector(Context context,
VRTouchPadGestureDetector.OnTouchPadGestureListener listener,
Handler handler) {
gestureDetector = new GestureDetector(context, this, handler);
gestureListener = listener;
}
public void setOnDoubleTapListener(
VRTouchPadGestureDetector.OnTouchPadDoubleTapListener onDoubleTapListener) {
doubleTapListener = onDoubleTapListener;
}
// OnGestureListener
@Override
public boolean onDown(MotionEvent arg0) {
return false;
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
float velocityY) {
if (gestureDetector == null)
return false;
double distance = Math.sqrt(Math.pow(e2.getX() - e1.getX(), 2)
+ Math.pow(e2.getY() - e1.getY(), 2));
if (distance > SWIPE_MIN_DISTANCE) {
try {
double deltaY = e2.getY() - e1.getY();
double deltaX = e2.getX() - e1.getX();
double angle = Math.toDegrees(Math.atan2(deltaY, deltaX)) + 180 + 45;
if (angle > 360)
angle -= 360;
if (angle < 90) {
return gestureListener.onSwipe(e1, SwipeDirection.Forward,
velocityX, velocityY);
} else if (angle < 180) {
return gestureListener.onSwipe(e1, SwipeDirection.Up,
velocityX, velocityY);
} else if (angle < 270) {
return gestureListener.onSwipe(e1, SwipeDirection.Backward,
velocityX, velocityY);
} else {
return gestureListener.onSwipe(e1, SwipeDirection.Down,
velocityX, velocityY);
}
} catch (Exception e) {
// Ignore
}
} else if (distance >= ONTAP_MIN_DISTANCE) {
/*
* The gesture listener filters out dirty taps that look like swipes
* altogether. This reduces usability as it's hard to get a clean
* tap on the tracker
*/
gestureListener.onSingleTap(e1);
return true;
}
return false;
}
@Override
public void onLongPress(MotionEvent arg0) {
if (gestureListener != null) {
gestureListener.onLongPress(arg0);
}
}
@Override
public boolean onScroll(MotionEvent arg0, MotionEvent arg1, float arg2,
float arg3) {
return false;
}
@Override
public boolean onSingleTapUp(MotionEvent arg0) {
if (gestureListener != null) {
return gestureListener.onSingleTap(arg0);
}
return false;
}
/**
* Analyzes the given motion event and if applicable triggers the
* appropriate callbacks on the {@link OnGestureListener} supplied.
*
* @param ev The current motion event.
* @return true if the {@link OnGestureListener} consumed the event, else
* false.
*/
public boolean onTouchEvent(MotionEvent ev) {
return gestureDetector.onTouchEvent(ev);
}
@Override
public boolean onDoubleTap(MotionEvent arg0) {
if (doubleTapListener != null) {
return doubleTapListener.onDoubleTap(arg0);
}
return false;
}
@Override
public boolean onDoubleTapEvent(MotionEvent arg0) {
return false;
}
@Override
public boolean onSingleTapConfirmed(MotionEvent arg0) {
if (doubleTapListener != null) {
return doubleTapListener.onSingleTapConfirmed(arg0);
}
return false;
}
@Override
public void onShowPress(MotionEvent e) {
}
}
|
nathan-almeida/GearVRf
|
GVRf/Sample/gvrf_immersivepedia/src/org/gearvrf/immersivepedia/util/VRTouchPadGestureDetector.java
|
Java
|
apache-2.0
| 8,923
|
<html>
<head>
<title>Docs For Class Wsdl</title>
<link rel="stylesheet" type="text/css" href="../media/style.css">
</head>
<body>
<table border="0" cellspacing="0" cellpadding="0" height="48" width="100%">
<tr>
<td class="header_top">default</td>
</tr>
<tr><td class="header_line"><img src="../media/empty.png" width="1" height="1" border="0" alt="" /></td></tr>
<tr>
<td class="header_menu">
[ <a href="../classtrees_default.html" class="menu">class tree: default</a> ]
[ <a href="../elementindex_default.html" class="menu">index: default</a> ]
[ <a href="../elementindex.html" class="menu">all elements</a> ]
</td>
</tr>
<tr><td class="header_line"><img src="../media/empty.png" width="1" height="1" border="0" alt="" /></td></tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr valign="top">
<td width="200" class="menu">
<div id="todolist">
<p><a href="../todolist.html">Todo List</a></p>
</div>
<b>Packages:</b><br />
<a href="../li_default.html">default</a><br />
<br /><br />
<b>Files:</b><br />
<div class="package">
<a href="../default/_mikebevz---xsd2php---wsdl---AbstractWsdl.php.html"> AbstractWsdl.php
</a><br>
<a href="../default/_mikebevz---xsd2php---wsdl---AbstractWsdlFactory.php.html"> AbstractWsdlFactory.php
</a><br>
<a href="../default/_mikebevz---xsd2php---Bind.php.html"> Bind.php
</a><br>
<a href="../default/_mikebevz---xsd2php---Common.php.html"> Common.php
</a><br>
<a href="../default/_mikebevz---xsd2php---wsdl---IWsdl.php.html"> IWsdl.php
</a><br>
<a href="../default/_legko.php.html"> legko.php
</a><br>
<a href="../default/_mikebevz---xsd2php---LegkoXML.php.html"> LegkoXML.php
</a><br>
<a href="../default/_mikebevz---xsd2php---NullLogger.php.html"> NullLogger.php
</a><br>
<a href="../default/_mikebevz---xsd2php---Php2Xml.php.html"> Php2Xml.php
</a><br>
<a href="../default/_mikebevz---xsd2php---PHPClass.php.html"> PHPClass.php
</a><br>
<a href="../default/_mikebevz---xsd2php---SoapServer.php.html"> SoapServer.php
</a><br>
<a href="../default/_mikebevz---xsd2php---Wsdl.php.html"> Wsdl.php
</a><br>
<a href="../default/_mikebevz---xsd2php---wsdl---WsdlFactory.php.html"> WsdlFactory.php
</a><br>
<a href="../default/_mikebevz---xsd2php---wsdl---Wsdl_1_1.php.html"> Wsdl_1_1.php
</a><br>
<a href="../default/_mikebevz---xsd2php---wsdl---Wsdl_2_0.php.html"> Wsdl_2_0.php
</a><br>
<a href="../default/_mikebevz---xsd2php---Xsd2Php.php.html"> Xsd2Php.php
</a><br>
</div><br />
<b>Interfaces:</b><br />
<div class="package">
<a href="../default/IWsdl.html">IWsdl</a><br />
</div>
<b>Classes:</b><br />
<div class="package">
<a href="../default/AbstractWsdl.html">AbstractWsdl</a><br />
<a href="../default/AbstractWsdlFactory.html">AbstractWsdlFactory</a><br />
<a href="../default/Bind.html">Bind</a><br />
<a href="../default/Common.html">Common</a><br />
<a href="../default/LegkoTool.html">LegkoTool</a><br />
<a href="../default/LegkoXML.html">LegkoXML</a><br />
<a href="../default/NullLogger.html">NullLogger</a><br />
<a href="../default/Php2Xml.html">Php2Xml</a><br />
<a href="../default/PHPClass.html">PHPClass</a><br />
<a href="../default/SoapServer.html">SoapServer</a><br />
<a href="../default/Wsdl.html">Wsdl</a><br />
<a href="../default/WsdlFactory.html">WsdlFactory</a><br />
<a href="../default/Wsdl_1_1.html">Wsdl_1_1</a><br />
<a href="../default/Wsdl_2_0.html">Wsdl_2_0</a><br />
<a href="../default/Xsd2Php.html">Xsd2Php</a><br />
</div>
</td>
<td>
<table cellpadding="10" cellspacing="0" width="100%" border="0"><tr><td valign="top">
<h1>Class: Wsdl</h1>
Source Location: /mikebevz/xsd2php/Wsdl.php<br /><br />
<table width="100%" border="0">
<tr><td valign="top">
<h3><a href="#class_details">Class Overview</a></h3>
<pre><a href="../default/Common.html">Common</a>
|
--Wsdl</pre><br />
<div class="description">Common data</div><br /><br />
<h4>Author(s):</h4>
<ul>
<li>Mike Bevz <<a href="mailto:myb@mikebevz.com">myb@mikebevz.com</a>></li>
</ul>
<h4>Version:</h4>
<ul>
<li>0.0.1</li>
</ul>
</td>
<td valign="top">
<h3><a href="#class_vars">Variables</a></h3>
<ul>
<li><a href="../default/Wsdl.html#var$binding">$binding</a></li>
<li><a href="../default/Wsdl.html#var$bindingNameSuffix">$bindingNameSuffix</a></li>
<li><a href="../default/Wsdl.html#var$class">$class</a></li>
<li><a href="../default/Wsdl.html#var$importedNamespaces">$importedNamespaces</a></li>
<li><a href="../default/Wsdl.html#var$location">$location</a></li>
<li><a href="../default/Wsdl.html#var$portNameSuffix">$portNameSuffix</a></li>
<li><a href="../default/Wsdl.html#var$portType">$portType</a></li>
<li><a href="../default/Wsdl.html#var$publicPath">$publicPath</a></li>
<li><a href="../default/Wsdl.html#var$publicUrl">$publicUrl</a></li>
<li><a href="../default/Wsdl.html#var$refl">$refl</a></li>
<li><a href="../default/Wsdl.html#var$requestSuffix">$requestSuffix</a></li>
<li><a href="../default/Wsdl.html#var$responseSuffix">$responseSuffix</a></li>
<li><a href="../default/Wsdl.html#var$schemasPath">$schemasPath</a></li>
<li><a href="../default/Wsdl.html#var$serviceNameSuffix">$serviceNameSuffix</a></li>
<li><a href="../default/Wsdl.html#var$soapBindingStyle">$soapBindingStyle</a></li>
<li><a href="../default/Wsdl.html#var$soapBindingTransport">$soapBindingTransport</a></li>
<li><a href="../default/Wsdl.html#var$targetNsPrefix">$targetNsPrefix</a></li>
<li><a href="../default/Wsdl.html#var$wsdl">$wsdl</a></li>
<li><a href="../default/Wsdl.html#var$xmlSchemaPreffix">$xmlSchemaPreffix</a></li>
</ul>
</td>
<td valign="top">
<h3><a href="#class_methods">Methods</a></h3>
<ul>
<li><a href="../default/Wsdl.html#method__construct">__construct</a></li>
<li><a href="../default/Wsdl.html#methodaddBindingOperations">addBindingOperations</a></li>
<li><a href="../default/Wsdl.html#methodaddBindings">addBindings</a></li>
<li><a href="../default/Wsdl.html#methodaddImportToSchema">addImportToSchema</a></li>
<li><a href="../default/Wsdl.html#methodaddMessages">addMessages</a></li>
<li><a href="../default/Wsdl.html#methodaddPortOperations">addPortOperations</a></li>
<li><a href="../default/Wsdl.html#methodaddPortType">addPortType</a></li>
<li><a href="../default/Wsdl.html#methodaddServices">addServices</a></li>
<li><a href="../default/Wsdl.html#methodaddType">addType</a></li>
<li><a href="../default/Wsdl.html#methodaddTypes">addTypes</a></li>
<li><a href="../default/Wsdl.html#methodcomposeUrl">composeUrl</a></li>
<li><a href="../default/Wsdl.html#methodcopyToPublic">copyToPublic</a></li>
<li><a href="../default/Wsdl.html#methodgetBaseNsName">getBaseNsName</a></li>
<li><a href="../default/Wsdl.html#methodgetBindingName">getBindingName</a></li>
<li><a href="../default/Wsdl.html#methodgetBindingTypeName">getBindingTypeName</a></li>
<li><a href="../default/Wsdl.html#methodgetClassMethods">getClassMethods</a></li>
<li><a href="../default/Wsdl.html#methodgetClassNamespace">getClassNamespace</a></li>
<li><a href="../default/Wsdl.html#methodgetDebug">getDebug</a></li>
<li><a href="../default/Wsdl.html#methodgetLocation">getLocation</a></li>
<li><a href="../default/Wsdl.html#methodgetMethodIO">getMethodIO</a></li>
<li><a href="../default/Wsdl.html#methodgetNamespaceName">getNamespaceName</a></li>
<li><a href="../default/Wsdl.html#methodgetPortName">getPortName</a></li>
<li><a href="../default/Wsdl.html#methodgetPublicPath">getPublicPath</a></li>
<li><a href="../default/Wsdl.html#methodgetPublicUrl">getPublicUrl</a></li>
<li><a href="../default/Wsdl.html#methodgetSchemaLocation">getSchemaLocation</a></li>
<li><a href="../default/Wsdl.html#methodgetSchemasPath">getSchemasPath</a></li>
<li><a href="../default/Wsdl.html#methodgetServiceName">getServiceName</a></li>
<li><a href="../default/Wsdl.html#methodgetShortName">getShortName</a></li>
<li><a href="../default/Wsdl.html#methodgetSoapBindingStyle">getSoapBindingStyle</a></li>
<li><a href="../default/Wsdl.html#methodgetSoapBindingTransport">getSoapBindingTransport</a></li>
<li><a href="../default/Wsdl.html#methodgetTypeName">getTypeName</a></li>
<li><a href="../default/Wsdl.html#methodgetWsdl">getWsdl</a></li>
<li><a href="../default/Wsdl.html#methodimportsToAbsUrl">importsToAbsUrl</a></li>
<li><a href="../default/Wsdl.html#methodisLocalType">isLocalType</a></li>
<li><a href="../default/Wsdl.html#methodisTargetNamespaceEqualsTo">isTargetNamespaceEqualsTo</a></li>
<li><a href="../default/Wsdl.html#methodnamespaceToUrn">namespaceToUrn</a></li>
<li><a href="../default/Wsdl.html#methodsetDebug">setDebug</a></li>
<li><a href="../default/Wsdl.html#methodsetLocation">setLocation</a></li>
<li><a href="../default/Wsdl.html#methodsetPublicPath">setPublicPath</a></li>
<li><a href="../default/Wsdl.html#methodsetPublicUrl">setPublicUrl</a></li>
<li><a href="../default/Wsdl.html#methodsetSchemasPath">setSchemasPath</a></li>
<li><a href="../default/Wsdl.html#methodsetSoapBindingStyle">setSoapBindingStyle</a></li>
<li><a href="../default/Wsdl.html#methodsetSoapBindingTransport">setSoapBindingTransport</a></li>
</ul>
</td>
</tr></table>
<hr />
<table width="100%" border="0"><tr>
<td valign="top">
<h3>Inherited Variables</h3>
<div class="tags">
<h4>Class: <a href="../default/Common.html">Common</a></h4>
<dl>
<dt>
<a href="../default/Common.html#var$basicTypes">Common::$basicTypes</a>
</dt>
<dd>
</dd>
<dt>
<a href="../default/Common.html#var$debug">Common::$debug</a>
</dt>
<dd>
</dd>
<dt>
<a href="../default/Common.html#var$dom">Common::$dom</a>
</dt>
<dd>
</dd>
<dt>
<a href="../default/Common.html#var$lastNsKey">Common::$lastNsKey</a>
</dt>
<dd>
</dd>
<dt>
<a href="../default/Common.html#var$namespaces">Common::$namespaces</a>
</dt>
<dd>
</dd>
<dt>
<a href="../default/Common.html#var$phpTypes">Common::$phpTypes</a>
</dt>
<dd>
</dd>
<dt>
<a href="../default/Common.html#var$reservedWords">Common::$reservedWords</a>
</dt>
<dd>
</dd>
</dl>
</div>
</td>
<td valign="top">
<h3>Inherited Methods</h3>
<div class="tags">
<h4>Class: <a href="../default/Common.html">Common</a></h4>
<dl>
<dt>
<a href="../default/Common.html#methodgetDocNamespaces">Common::getDocNamespaces()</a>
</dt>
<dd>
</dd>
<dt>
<a href="../default/Common.html#methodgetNsCode">Common::getNsCode()</a>
</dt>
<dd>
</dd>
<dt>
<a href="../default/Common.html#methodisQName">Common::isQName()</a>
</dt>
<dd>
</dd>
<dt>
<a href="../default/Common.html#methodnormalizeType">Common::normalizeType()</a>
</dt>
<dd>
Convert XMLSchema data type to PHP data type
</dd>
<dt>
<a href="../default/Common.html#methodparseDocComments">Common::parseDocComments()</a>
</dt>
<dd>
Parse Doc comments
</dd>
<dt>
<a href="../default/Common.html#methodparseParamDocs">Common::parseParamDocs()</a>
</dt>
<dd>
</dd>
<dt>
<a href="../default/Common.html#methodparseQName">Common::parseQName()</a>
</dt>
<dd>
</dd>
<dt>
<a href="../default/Common.html#methodparseReturnDocs">Common::parseReturnDocs()</a>
</dt>
<dd>
</dd>
<dt>
<a href="../default/Common.html#methodphpTypeToSoap">Common::phpTypeToSoap()</a>
</dt>
<dd>
</dd>
<dt>
<a href="../default/Common.html#methodresolveNamespace">Common::resolveNamespace()</a>
</dt>
<dd>
Resolve short namespace to long, or return the same code if not found
</dd>
<dt>
<a href="../default/Common.html#methodurnToPhpName">Common::urnToPhpName()</a>
</dt>
<dd>
</dd>
</dl>
</div>
</td>
</tr></table>
<hr />
<a name="class_details"></a>
<h3>Class Details</h3>
<div class="tags">
[line 14]<br />
Common data<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>author:</b> </td><td>Mike Bevz <<a href="mailto:myb@mikebevz.com">myb@mikebevz.com</a>></td>
</tr>
<tr>
<td><b>version:</b> </td><td>0.0.1</td>
</tr>
</table>
</div>
</div><br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div><br />
<hr />
<a name="class_vars"></a>
<h3>Class Variables</h3>
<div class="tags">
<a name="var$binding"></a>
<p></p>
<h4>$binding = <span class="value"></span></h4>
<p>[line 58]</p>
Binding<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>private</td>
</tr>
</table>
</div>
<br />
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>Type:</b> </td>
<td>DomNode</td>
</tr>
</table>
</div><br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div><br />
<a name="var$bindingNameSuffix"></a>
<p></p>
<h4>$bindingNameSuffix = <span class="value"> "_Binding"</span></h4>
<p>[line 93]</p>
Suffix for generated binding tag name<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>private</td>
</tr>
</table>
</div>
<br />
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>Type:</b> </td>
<td>unknown_type</td>
</tr>
</table>
</div><br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div><br />
<a name="var$class"></a>
<p></p>
<h4>$class = <span class="value"></span></h4>
<p>[line 21]</p>
Service class to be exposed<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>private</td>
</tr>
</table>
</div>
<br />
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>Type:</b> </td>
<td>object</td>
</tr>
</table>
</div><br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div><br />
<a name="var$importedNamespaces"></a>
<p></p>
<h4>$importedNamespaces = <span class="value">array()</span></h4>
<p>[line 126]</p>
Namespaces already imported to XML Schema<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>private</td>
</tr>
</table>
</div>
<br />
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>Type:</b> </td>
<td>array</td>
</tr>
</table>
</div><br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div><br />
<a name="var$location"></a>
<p></p>
<h4>$location = <span class="value"></span></h4>
<p>[line 65]</p>
Service location<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>private</td>
</tr>
</table>
</div>
<br />
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>Type:</b> </td>
<td>string</td>
</tr>
</table>
</div><br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div><br />
<a name="var$portNameSuffix"></a>
<p></p>
<h4>$portNameSuffix = <span class="value"> "_Port"</span></h4>
<p>[line 88]</p>
Suffix for generated port tag name<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>private</td>
</tr>
</table>
</div>
<br />
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>Type:</b> </td>
<td>string</td>
</tr>
</table>
</div><br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div><br />
<a name="var$portType"></a>
<p></p>
<h4>$portType = <span class="value"></span></h4>
<p>[line 52]</p>
Port type<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>private</td>
</tr>
</table>
</div>
<br />
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>Type:</b> </td>
<td>DomNode</td>
</tr>
</table>
</div><br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div><br />
<a name="var$publicPath"></a>
<p></p>
<h4>$publicPath = <span class="value"> null</span></h4>
<p>[line 118]</p>
Path to publicly accessable folder to store imported/included schemas<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>private</td>
</tr>
</table>
</div>
<br />
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>Type:</b> </td>
<td>string</td>
</tr>
</table>
</div><br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div><br />
<a name="var$publicUrl"></a>
<p></p>
<h4>$publicUrl = <span class="value"> null</span></h4>
<p>[line 120]</p>
<br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>private</td>
</tr>
</table>
</div>
<br />
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>Type:</b> </td>
<td>mixed</td>
</tr>
</table>
</div><br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div><br />
<a name="var$refl"></a>
<p></p>
<h4>$refl = <span class="value"></span></h4>
<p>[line 34]</p>
Reflection of the $class<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>private</td>
</tr>
</table>
</div>
<br />
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>Type:</b> </td>
<td>\ReflectionClass</td>
</tr>
</table>
</div><br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div><br />
<a name="var$requestSuffix"></a>
<p></p>
<h4>$requestSuffix = <span class="value"> "Request"</span></h4>
<p>[line 105]</p>
Request<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>private</td>
</tr>
</table>
</div>
<br />
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>Type:</b> </td>
<td>unknown_type</td>
</tr>
</table>
</div><br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div><br />
<a name="var$responseSuffix"></a>
<p></p>
<h4>$responseSuffix = <span class="value"> "Response"</span></h4>
<p>[line 99]</p>
Response items suffix<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>private</td>
</tr>
</table>
</div>
<br />
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>Type:</b> </td>
<td>string</td>
</tr>
</table>
</div><br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div><br />
<a name="var$schemasPath"></a>
<p></p>
<h4>$schemasPath = <span class="value"> null</span></h4>
<p>[line 111]</p>
Path to schema to be imported/included in XSD<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>private</td>
</tr>
</table>
</div>
<br />
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>Type:</b> </td>
<td>string</td>
</tr>
</table>
</div><br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div><br />
<a name="var$serviceNameSuffix"></a>
<p></p>
<h4>$serviceNameSuffix = <span class="value"> "_Service"</span></h4>
<p>[line 82]</p>
Suffix for generated service tag name<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>private</td>
</tr>
</table>
</div>
<br />
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>Type:</b> </td>
<td>string</td>
</tr>
</table>
</div><br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div><br />
<a name="var$soapBindingStyle"></a>
<p></p>
<h4>$soapBindingStyle = <span class="value"> "document"</span></h4>
<p>[line 40]</p>
Soap binding style: rpc|document<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>private</td>
</tr>
</table>
</div>
<br />
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>Type:</b> </td>
<td>string</td>
</tr>
</table>
</div><br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div><br />
<a name="var$soapBindingTransport"></a>
<p></p>
<h4>$soapBindingTransport = <span class="value"> "http://schemas.xmlsoap.org/soap/http"</span></h4>
<p>[line 46]</p>
Soap binding transport: which transport of SOAP this binding corresponds to<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>private</td>
</tr>
</table>
</div>
<br />
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>Type:</b> </td>
<td>string</td>
</tr>
</table>
</div><br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div><br />
<a name="var$targetNsPrefix"></a>
<p></p>
<h4>$targetNsPrefix = <span class="value"> "tns"</span></h4>
<p>[line 71]</p>
Prefix of target namespace<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>private</td>
</tr>
</table>
</div>
<br />
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>Type:</b> </td>
<td>string</td>
</tr>
</table>
</div><br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div><br />
<a name="var$wsdl"></a>
<p></p>
<h4>$wsdl = <span class="value"></span></h4>
<p>[line 28]</p>
Instance of Zend_Soap_Wsdl<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>todo:</b> </td><td>consider replace this class - it's not that useful</td>
</tr>
<tr>
<td><b>access:</b> </td><td>private</td>
</tr>
</table>
</div>
<br />
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>Type:</b> </td>
<td>com\mikebevz\xsd2php\wsdl\AbstractWsdl</td>
</tr>
</table>
</div><br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div><br />
<a name="var$xmlSchemaPreffix"></a>
<p></p>
<h4>$xmlSchemaPreffix = <span class="value"> "xsd"</span></h4>
<p>[line 77]</p>
Prefix for XML Schema namespace<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>private</td>
</tr>
</table>
</div>
<br />
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>Type:</b> </td>
<td>string</td>
</tr>
</table>
</div><br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div><br />
</div><br />
<hr />
<a name="class_methods"></a>
<h3>Class Methods</h3>
<div class="tags">
<hr />
<a name="method__construct"></a>
<h3>constructor __construct <span class="smalllinenumber">[line 136]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>void __construct(
[string|object
$class = null])</code>
</td></tr></table>
</td></tr></table><br />
Creates new wsdl for the $class given<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>public</td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string|object </td>
<td><b>$class</b> </td>
<td></td>
</tr>
</table>
</div><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodaddBindingOperations"></a>
<h3>method addBindingOperations <span class="smalllinenumber">[line 281]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>void addBindingOperations(
)</code>
</td></tr></table>
</td></tr></table><br />
Add operations to binding<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>public</td>
</tr>
</table>
</div>
<br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodaddBindings"></a>
<h3>method addBindings <span class="smalllinenumber">[line 205]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>DomNode addBindings(
)</code>
</td></tr></table>
</td></tr></table><br />
Add bindings to WSDL<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>return:</b> </td><td>Binding node</td>
</tr>
<tr>
<td><b>access:</b> </td><td>private</td>
</tr>
</table>
</div>
<br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodaddImportToSchema"></a>
<h3>method addImportToSchema <span class="smalllinenumber">[line 523]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>void addImportToSchema(
string
$namespace, string
$code)</code>
</td></tr></table>
</td></tr></table><br />
Add xsd:import tag to XML schema before any childs added<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>private</td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string </td>
<td><b>$namespace</b> </td>
<td>Namespace URI</td>
</tr>
<tr>
<td class="type">string </td>
<td><b>$code</b> </td>
<td>Shortcut for namespace, fx, ns0. Returned by getNsCode()</td>
</tr>
</table>
</div><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodaddMessages"></a>
<h3>method addMessages <span class="smalllinenumber">[line 369]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>void addMessages(
array
$messages)</code>
</td></tr></table>
</td></tr></table><br />
Add SOAP messages<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>throws:</b> </td><td>RuntimeException If</td>
</tr>
<tr>
<td><b>throws:</b> </td><td>RuntimeException If method does not have any inputs/outputs</td>
</tr>
<tr>
<td><b>access:</b> </td><td>public</td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">array </td>
<td><b>$messages</b> </td>
<td>Messages to add</td>
</tr>
</table>
</div><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodaddPortOperations"></a>
<h3>method addPortOperations <span class="smalllinenumber">[line 310]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>void addPortOperations(
)</code>
</td></tr></table>
</td></tr></table><br />
Add Port operations<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>private</td>
</tr>
</table>
</div>
<br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodaddPortType"></a>
<h3>method addPortType <span class="smalllinenumber">[line 230]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>DOMNode addPortType(
)</code>
</td></tr></table>
</td></tr></table><br />
Add port type<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>return:</b> </td><td>portType node</td>
</tr>
<tr>
<td><b>access:</b> </td><td>private</td>
</tr>
</table>
</div>
<br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodaddServices"></a>
<h3>method addServices <span class="smalllinenumber">[line 485]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>void addServices(
)</code>
</td></tr></table>
</td></tr></table><br />
Add SOAP Service<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>private</td>
</tr>
</table>
</div>
<br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodaddType"></a>
<h3>method addType <span class="smalllinenumber">[line 783]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>string addType(
string
$type)</code>
</td></tr></table>
</td></tr></table><br />
<br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>todo:</b> </td><td>Check this method</td>
</tr>
<tr>
<td><b>access:</b> </td><td>private</td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string </td>
<td><b>$type</b> </td>
<td>Data type</td>
</tr>
</table>
</div><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodaddTypes"></a>
<h3>method addTypes <span class="smalllinenumber">[line 242]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>void addTypes(
)</code>
</td></tr></table>
</td></tr></table><br />
Add XML Schema types<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>public</td>
</tr>
</table>
</div>
<br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodcomposeUrl"></a>
<h3>method composeUrl <span class="smalllinenumber">[line 610]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>string composeUrl(
array
$parts)</code>
</td></tr></table>
</td></tr></table><br />
Compose URL of kind schema://host:port<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>return:</b> </td><td>URL</td>
</tr>
<tr>
<td><b>access:</b> </td><td>public</td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">array </td>
<td><b>$parts</b> </td>
<td></td>
</tr>
</table>
</div><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodcopyToPublic"></a>
<h3>method copyToPublic <span class="smalllinenumber">[line 640]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>string copyToPublic(
string
$path, [boolean
$overwrite = false])</code>
</td></tr></table>
</td></tr></table><br />
Copy given file to publicSchemaPath<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>return:</b> </td><td>Path to new file</td>
</tr>
<tr>
<td><b>throws:</b> </td><td>RuntimeException If file cannot be copied</td>
</tr>
<tr>
<td><b>access:</b> </td><td>public</td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string </td>
<td><b>$path</b> </td>
<td>Path to file</td>
</tr>
<tr>
<td class="type">boolean </td>
<td><b>$overwrite</b> </td>
<td>Overwrite file if it exists? default false</td>
</tr>
</table>
</div><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodgetBaseNsName"></a>
<h3>method getBaseNsName <span class="smalllinenumber">[line 739]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>string getBaseNsName(
string
$ns)</code>
</td></tr></table>
</td></tr></table><br />
Get base name from URI<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>return:</b> </td><td>Base name</td>
</tr>
<tr>
<td><b>access:</b> </td><td>public</td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string </td>
<td><b>$ns</b> </td>
<td>URI</td>
</tr>
</table>
</div><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodgetBindingName"></a>
<h3>method getBindingName <span class="smalllinenumber">[line 809]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>void getBindingName(
)</code>
</td></tr></table>
</td></tr></table><br />
Get binding element name<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>private</td>
</tr>
</table>
</div>
<br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodgetBindingTypeName"></a>
<h3>method getBindingTypeName <span class="smalllinenumber">[line 221]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>string getBindingTypeName(
)</code>
</td></tr></table>
</td></tr></table><br />
Get binding type name<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>private</td>
</tr>
</table>
</div>
<br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodgetClassMethods"></a>
<h3>method getClassMethods <span class="smalllinenumber">[line 444]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>array<ReflectionMethod> getClassMethods(
)</code>
</td></tr></table>
</td></tr></table><br />
Get service class public methods<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>private</td>
</tr>
</table>
</div>
<br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodgetClassNamespace"></a>
<h3>method getClassNamespace <span class="smalllinenumber">[line 752]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>string getClassNamespace(
string
$class)</code>
</td></tr></table>
</td></tr></table><br />
Return class XML namespace taken from @xmlNamespace doc<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>return:</b> </td><td>XML namespace</td>
</tr>
<tr>
<td><b>throws:</b> </td><td>RuntimeException If namespace cannot be found in class DocBlock</td>
</tr>
<tr>
<td><b>access:</b> </td><td>public</td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string </td>
<td><b>$class</b> </td>
<td>Class name</td>
</tr>
</table>
</div><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodgetDebug"></a>
<h3>method getDebug <span class="smalllinenumber">[line 884]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>the getDebug(
)</code>
</td></tr></table>
</td></tr></table><br />
<br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>public</td>
</tr>
</table>
</div>
<br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodgetLocation"></a>
<h3>method getLocation <span class="smalllinenumber">[line 819]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>string getLocation(
)</code>
</td></tr></table>
</td></tr></table><br />
Get SOAP service location (service->port->address->location)<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>public</td>
</tr>
</table>
</div>
<br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodgetMethodIO"></a>
<h3>method getMethodIO <span class="smalllinenumber">[line 455]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>array getMethodIO(
string
$method)</code>
</td></tr></table>
</td></tr></table><br />
Return method input/output<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>private</td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string </td>
<td><b>$method</b> </td>
<td>Method name</td>
</tr>
</table>
</div><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodgetNamespaceName"></a>
<h3>method getNamespaceName <span class="smalllinenumber">[line 471]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>void getNamespaceName(
$class)</code>
</td></tr></table>
</td></tr></table><br />
<br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>private</td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type"> </td>
<td><b>$class</b> </td>
<td></td>
</tr>
</table>
</div><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodgetPortName"></a>
<h3>method getPortName <span class="smalllinenumber">[line 467]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>string getPortName(
)</code>
</td></tr></table>
</td></tr></table><br />
Get port name<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>private</td>
</tr>
</table>
</div>
<br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodgetPublicPath"></a>
<h3>method getPublicPath <span class="smalllinenumber">[line 899]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>the getPublicPath(
)</code>
</td></tr></table>
</td></tr></table><br />
<br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>public</td>
</tr>
</table>
</div>
<br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodgetPublicUrl"></a>
<h3>method getPublicUrl <span class="smalllinenumber">[line 914]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>the getPublicUrl(
)</code>
</td></tr></table>
</td></tr></table><br />
<br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>public</td>
</tr>
</table>
</div>
<br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodgetSchemaLocation"></a>
<h3>method getSchemaLocation <span class="smalllinenumber">[line 665]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>string getSchemaLocation(
string
$ns)</code>
</td></tr></table>
</td></tr></table><br />
Get path to schema in schemasPath with targetNamespace = $ns<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>return:</b> </td><td>absolut path to schema file</td>
</tr>
<tr>
<td><b>throws:</b> </td><td>RuntimeException If SchemaPath is not specified</td>
</tr>
<tr>
<td><b>throws:</b> </td><td>RuntimeException If Public folder is not specified</td>
</tr>
<tr>
<td><b>throws:</b> </td><td>RuntimeException If SchemaPath is not readable</td>
</tr>
<tr>
<td><b>throws:</b> </td><td>RuntimeException If namespace cannot be found in SchemaPath</td>
</tr>
<tr>
<td><b>throws:</b> </td><td>RuntimeException If PublicPath is not writable</td>
</tr>
<tr>
<td><b>access:</b> </td><td>public</td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string </td>
<td><b>$ns</b> </td>
<td>Namespace to match</td>
</tr>
</table>
</div><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodgetSchemasPath"></a>
<h3>method getSchemasPath <span class="smalllinenumber">[line 869]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>the getSchemasPath(
)</code>
</td></tr></table>
</td></tr></table><br />
<br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>public</td>
</tr>
</table>
</div>
<br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodgetServiceName"></a>
<h3>method getServiceName <span class="smalllinenumber">[line 798]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>string getServiceName(
)</code>
</td></tr></table>
</td></tr></table><br />
Get service element name<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>private</td>
</tr>
</table>
</div>
<br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodgetShortName"></a>
<h3>method getShortName <span class="smalllinenumber">[line 769]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>string getShortName(
string
$longName)</code>
</td></tr></table>
</td></tr></table><br />
Get class name without namespace<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>return:</b> </td><td>Class base name</td>
</tr>
<tr>
<td><b>access:</b> </td><td>private</td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string </td>
<td><b>$longName</b> </td>
<td>Class full name</td>
</tr>
</table>
</div><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodgetSoapBindingStyle"></a>
<h3>method getSoapBindingStyle <span class="smalllinenumber">[line 836]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>string getSoapBindingStyle(
)</code>
</td></tr></table>
</td></tr></table><br />
Get SOAP binding style<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>public</td>
</tr>
</table>
</div>
<br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodgetSoapBindingTransport"></a>
<h3>method getSoapBindingTransport <span class="smalllinenumber">[line 853]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>string getSoapBindingTransport(
)</code>
</td></tr></table>
</td></tr></table><br />
Get SOAP binding transport<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>return:</b> </td><td>the $soapBindingTransport</td>
</tr>
<tr>
<td><b>access:</b> </td><td>public</td>
</tr>
</table>
</div>
<br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodgetTypeName"></a>
<h3>method getTypeName <span class="smalllinenumber">[line 496]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>string getTypeName(
string
$type)</code>
</td></tr></table>
</td></tr></table><br />
Get QName style for given type<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>throws:</b> </td><td>RuntimeException If class of type cannot be found</td>
</tr>
<tr>
<td><b>access:</b> </td><td>private</td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string </td>
<td><b>$type</b> </td>
<td>Type name</td>
</tr>
</table>
</div><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodgetWsdl"></a>
<h3>method getWsdl <span class="smalllinenumber">[line 153]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>string getWsdl(
[string|object
$class = null])</code>
</td></tr></table>
</td></tr></table><br />
Ger WSDL file contents<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>throws:</b> </td><td>RuntimeException If class not defined</td>
</tr>
<tr>
<td><b>throws:</b> </td><td>RuntimeException If given class is neither class nor string</td>
</tr>
<tr>
<td><b>throws:</b> </td><td>RuntimeException If given class is not found, ie was not included before</td>
</tr>
<tr>
<td><b>access:</b> </td><td>public</td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string|object </td>
<td><b>$class</b> </td>
<td></td>
</tr>
</table>
</div><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodimportsToAbsUrl"></a>
<h3>method importsToAbsUrl <span class="smalllinenumber">[line 572]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>string importsToAbsUrl(
string
$schemaPath, [
$relPath = ''])</code>
</td></tr></table>
</td></tr></table><br />
Convert relative paths in XMLSchema's imports and includes to URLs using $location<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>return:</b> </td><td>URL of the schema</td>
</tr>
<tr>
<td><b>access:</b> </td><td>public</td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string </td>
<td><b>$schemaPath</b> </td>
<td>Absolute path to XML Schema file</td>
</tr>
<tr>
<td class="type"> </td>
<td><b>$relPath</b> </td>
<td></td>
</tr>
</table>
</div><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodisLocalType"></a>
<h3>method isLocalType <span class="smalllinenumber">[line 344]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>boolean isLocalType(
string
$type)</code>
</td></tr></table>
</td></tr></table><br />
Return true if given type is local, false in case the type is not from xsd or tns namespaces<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>public</td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string </td>
<td><b>$type</b> </td>
<td>QName type name</td>
</tr>
</table>
</div><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodisTargetNamespaceEqualsTo"></a>
<h3>method isTargetNamespaceEqualsTo <span class="smalllinenumber">[line 713]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>boolean isTargetNamespaceEqualsTo(
string
$schema, string
$ns)</code>
</td></tr></table>
</td></tr></table><br />
Check if $schema XML Schema file belongs to $ns<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>public</td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string </td>
<td><b>$schema</b> </td>
<td>Path to XML Schema file</td>
</tr>
<tr>
<td class="type">string </td>
<td><b>$ns</b> </td>
<td>Target namespace to match</td>
</tr>
</table>
</div><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodnamespaceToUrn"></a>
<h3>method namespaceToUrn <span class="smalllinenumber">[line 475]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>void namespaceToUrn(
$namespace)</code>
</td></tr></table>
</td></tr></table><br />
<br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>private</td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type"> </td>
<td><b>$namespace</b> </td>
<td></td>
</tr>
</table>
</div><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodsetDebug"></a>
<h3>method setDebug <span class="smalllinenumber">[line 892]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>void setDebug(
$debug
$debug)</code>
</td></tr></table>
</td></tr></table><br />
<br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>public</td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">$debug </td>
<td><b>$debug</b> </td>
<td>the $debug to set</td>
</tr>
</table>
</div><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodsetLocation"></a>
<h3>method setLocation <span class="smalllinenumber">[line 827]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>void setLocation(
$location
$location)</code>
</td></tr></table>
</td></tr></table><br />
<br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>public</td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">$location </td>
<td><b>$location</b> </td>
<td>the $location to set</td>
</tr>
</table>
</div><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodsetPublicPath"></a>
<h3>method setPublicPath <span class="smalllinenumber">[line 907]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>void setPublicPath(
$publicPath
$publicPath)</code>
</td></tr></table>
</td></tr></table><br />
<br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>public</td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">$publicPath </td>
<td><b>$publicPath</b> </td>
<td>the $publicPath to set</td>
</tr>
</table>
</div><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodsetPublicUrl"></a>
<h3>method setPublicUrl <span class="smalllinenumber">[line 922]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>void setPublicUrl(
$publicUrl
$publicUrl)</code>
</td></tr></table>
</td></tr></table><br />
<br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>public</td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">$publicUrl </td>
<td><b>$publicUrl</b> </td>
<td>the $publicUrl to set</td>
</tr>
</table>
</div><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodsetSchemasPath"></a>
<h3>method setSchemasPath <span class="smalllinenumber">[line 877]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>void setSchemasPath(
$schemasPath
$schemasPath)</code>
</td></tr></table>
</td></tr></table><br />
<br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>public</td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">$schemasPath </td>
<td><b>$schemasPath</b> </td>
<td>the $schemasPath to set</td>
</tr>
</table>
</div><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodsetSoapBindingStyle"></a>
<h3>method setSoapBindingStyle <span class="smalllinenumber">[line 844]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>void setSoapBindingStyle(
$soapBindingStyle
$soapBindingStyle)</code>
</td></tr></table>
</td></tr></table><br />
<br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>public</td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">$soapBindingStyle </td>
<td><b>$soapBindingStyle</b> </td>
<td>the $soapBindingStyle to set</td>
</tr>
</table>
</div><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodsetSoapBindingTransport"></a>
<h3>method setSoapBindingTransport <span class="smalllinenumber">[line 861]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>void setSoapBindingTransport(
$soapBindingTransport
$soapBindingTransport)</code>
</td></tr></table>
</td></tr></table><br />
<br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>access:</b> </td><td>public</td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">$soapBindingTransport </td>
<td><b>$soapBindingTransport</b> </td>
<td>the $soapBindingTransport to set</td>
</tr>
</table>
</div><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
</div><br />
<div class="credit">
<hr />
Documentation generated on Tue, 01 Feb 2011 22:29:29 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>
</tr>
</table>
</body>
</html>
|
intuit/QuickBooks-V3-PHP-SDK
|
src/XSD2PHP/docs/default/Wsdl.html
|
HTML
|
apache-2.0
| 67,292
|
# Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import os
import ssl
from oslo.config import cfg
from volt.openstack.common.gettextutils import _
ssl_opts = [
cfg.StrOpt('ca_file',
default=None,
help="CA certificate file to use to verify "
"connecting clients."),
cfg.StrOpt('cert_file',
default=None,
help="Certificate file to use when starting "
"the server securely."),
cfg.StrOpt('key_file',
default=None,
help="Private key file to use when starting "
"the server securely."),
]
CONF = cfg.CONF
CONF.register_opts(ssl_opts, "ssl")
def is_enabled():
cert_file = CONF.ssl.cert_file
key_file = CONF.ssl.key_file
ca_file = CONF.ssl.ca_file
use_ssl = cert_file or key_file
if cert_file and not os.path.exists(cert_file):
raise RuntimeError(_("Unable to find cert_file : %s") % cert_file)
if ca_file and not os.path.exists(ca_file):
raise RuntimeError(_("Unable to find ca_file : %s") % ca_file)
if key_file and not os.path.exists(key_file):
raise RuntimeError(_("Unable to find key_file : %s") % key_file)
if use_ssl and (not cert_file or not key_file):
raise RuntimeError(_("When running server in SSL mode, you must "
"specify both a cert_file and key_file "
"option value in your configuration file"))
return use_ssl
def wrap(sock):
ssl_kwargs = {
'server_side': True,
'certfile': CONF.ssl.cert_file,
'keyfile': CONF.ssl.key_file,
'cert_reqs': ssl.CERT_NONE,
}
if CONF.ssl.ca_file:
ssl_kwargs['ca_certs'] = CONF.ssl.ca_file
ssl_kwargs['cert_reqs'] = ssl.CERT_REQUIRED
return ssl.wrap_socket(sock, **ssl_kwargs)
_SSL_PROTOCOLS = {
"tlsv1": ssl.PROTOCOL_TLSv1,
"sslv23": ssl.PROTOCOL_SSLv23,
"sslv3": ssl.PROTOCOL_SSLv3
}
try:
_SSL_PROTOCOLS["sslv2"] = ssl.PROTOCOL_SSLv2
except AttributeError:
pass
def validate_ssl_version(version):
key = version.lower()
try:
return _SSL_PROTOCOLS[key]
except KeyError:
raise RuntimeError(_("Invalid SSL version : %s") % version)
|
zhangwenyu/packages
|
volt/volt/openstack/common/sslutils.py
|
Python
|
apache-2.0
| 2,842
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package javax.batch.operations;
public class JobExecutionIsRunningException extends BatchRuntimeException {
private static final long serialVersionUID = 1L;
public JobExecutionIsRunningException() {
// no-op
}
public JobExecutionIsRunningException(final String message) {
super(message);
}
public JobExecutionIsRunningException(final Throwable cause) {
super(cause);
}
public JobExecutionIsRunningException(final String message, final Throwable cause) {
super(message, cause);
}
}
|
salyh/javamailspec
|
geronimo-jbatch_1.0_spec/src/main/java/javax/batch/operations/JobExecutionIsRunningException.java
|
Java
|
apache-2.0
| 1,344
|
"""Support to serve the Home Assistant API as WSGI application."""
from __future__ import annotations
from ipaddress import ip_network
import logging
import os
import ssl
from typing import Any, Final, Optional, TypedDict, cast
from aiohttp import web
from aiohttp.typedefs import StrOrURL
from aiohttp.web_exceptions import HTTPMovedPermanently, HTTPRedirection
import voluptuous as vol
from homeassistant.components.network import async_get_source_ip
from homeassistant.const import EVENT_HOMEASSISTANT_STOP, SERVER_PORT
from homeassistant.core import Event, HomeAssistant
from homeassistant.helpers import storage
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.typing import ConfigType
from homeassistant.loader import bind_hass
from homeassistant.setup import async_start_setup, async_when_setup_or_start
from homeassistant.util import ssl as ssl_util
from .auth import setup_auth
from .ban import setup_bans
from .const import KEY_AUTHENTICATED, KEY_HASS, KEY_HASS_USER # noqa: F401
from .cors import setup_cors
from .forwarded import async_setup_forwarded
from .request_context import current_request, setup_request_context
from .security_filter import setup_security_filter
from .static import CACHE_HEADERS, CachingStaticResource
from .view import HomeAssistantView
from .web_runner import HomeAssistantTCPSite
DOMAIN: Final = "http"
CONF_SERVER_HOST: Final = "server_host"
CONF_SERVER_PORT: Final = "server_port"
CONF_BASE_URL: Final = "base_url"
CONF_SSL_CERTIFICATE: Final = "ssl_certificate"
CONF_SSL_PEER_CERTIFICATE: Final = "ssl_peer_certificate"
CONF_SSL_KEY: Final = "ssl_key"
CONF_CORS_ORIGINS: Final = "cors_allowed_origins"
CONF_USE_X_FORWARDED_FOR: Final = "use_x_forwarded_for"
CONF_TRUSTED_PROXIES: Final = "trusted_proxies"
CONF_LOGIN_ATTEMPTS_THRESHOLD: Final = "login_attempts_threshold"
CONF_IP_BAN_ENABLED: Final = "ip_ban_enabled"
CONF_SSL_PROFILE: Final = "ssl_profile"
SSL_MODERN: Final = "modern"
SSL_INTERMEDIATE: Final = "intermediate"
_LOGGER: Final = logging.getLogger(__name__)
DEFAULT_DEVELOPMENT: Final = "0"
# Cast to be able to load custom cards.
# My to be able to check url and version info.
DEFAULT_CORS: Final[list[str]] = ["https://cast.home-assistant.io"]
NO_LOGIN_ATTEMPT_THRESHOLD: Final = -1
MAX_CLIENT_SIZE: Final = 1024 ** 2 * 16
STORAGE_KEY: Final = DOMAIN
STORAGE_VERSION: Final = 1
SAVE_DELAY: Final = 180
HTTP_SCHEMA: Final = vol.All(
cv.deprecated(CONF_BASE_URL),
vol.Schema(
{
vol.Optional(CONF_SERVER_HOST): vol.All(
cv.ensure_list, vol.Length(min=1), [cv.string]
),
vol.Optional(CONF_SERVER_PORT, default=SERVER_PORT): cv.port,
vol.Optional(CONF_BASE_URL): cv.string,
vol.Optional(CONF_SSL_CERTIFICATE): cv.isfile,
vol.Optional(CONF_SSL_PEER_CERTIFICATE): cv.isfile,
vol.Optional(CONF_SSL_KEY): cv.isfile,
vol.Optional(CONF_CORS_ORIGINS, default=DEFAULT_CORS): vol.All(
cv.ensure_list, [cv.string]
),
vol.Inclusive(CONF_USE_X_FORWARDED_FOR, "proxy"): cv.boolean,
vol.Inclusive(CONF_TRUSTED_PROXIES, "proxy"): vol.All(
cv.ensure_list, [ip_network]
),
vol.Optional(
CONF_LOGIN_ATTEMPTS_THRESHOLD, default=NO_LOGIN_ATTEMPT_THRESHOLD
): vol.Any(cv.positive_int, NO_LOGIN_ATTEMPT_THRESHOLD),
vol.Optional(CONF_IP_BAN_ENABLED, default=True): cv.boolean,
vol.Optional(CONF_SSL_PROFILE, default=SSL_MODERN): vol.In(
[SSL_INTERMEDIATE, SSL_MODERN]
),
}
),
)
CONFIG_SCHEMA: Final = vol.Schema({DOMAIN: HTTP_SCHEMA}, extra=vol.ALLOW_EXTRA)
class ConfData(TypedDict, total=False):
"""Typed dict for config data."""
server_host: list[str]
server_port: int
base_url: str
ssl_certificate: str
ssl_peer_certificate: str
ssl_key: str
cors_allowed_origins: list[str]
use_x_forwarded_for: bool
trusted_proxies: list[str]
login_attempts_threshold: int
ip_ban_enabled: bool
ssl_profile: str
@bind_hass
async def async_get_last_config(hass: HomeAssistant) -> dict | None:
"""Return the last known working config."""
store = storage.Store(hass, STORAGE_VERSION, STORAGE_KEY)
return cast(Optional[dict], await store.async_load())
class ApiConfig:
"""Configuration settings for API server."""
def __init__(
self,
local_ip: str,
host: str,
port: int,
use_ssl: bool,
) -> None:
"""Initialize a new API config object."""
self.local_ip = local_ip
self.host = host
self.port = port
self.use_ssl = use_ssl
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the HTTP API and debug interface."""
conf: ConfData | None = config.get(DOMAIN)
if conf is None:
conf = cast(ConfData, HTTP_SCHEMA({}))
server_host = conf.get(CONF_SERVER_HOST)
server_port = conf[CONF_SERVER_PORT]
ssl_certificate = conf.get(CONF_SSL_CERTIFICATE)
ssl_peer_certificate = conf.get(CONF_SSL_PEER_CERTIFICATE)
ssl_key = conf.get(CONF_SSL_KEY)
cors_origins = conf[CONF_CORS_ORIGINS]
use_x_forwarded_for = conf.get(CONF_USE_X_FORWARDED_FOR, False)
trusted_proxies = conf.get(CONF_TRUSTED_PROXIES) or []
is_ban_enabled = conf[CONF_IP_BAN_ENABLED]
login_threshold = conf[CONF_LOGIN_ATTEMPTS_THRESHOLD]
ssl_profile = conf[CONF_SSL_PROFILE]
server = HomeAssistantHTTP(
hass,
server_host=server_host,
server_port=server_port,
ssl_certificate=ssl_certificate,
ssl_peer_certificate=ssl_peer_certificate,
ssl_key=ssl_key,
cors_origins=cors_origins,
use_x_forwarded_for=use_x_forwarded_for,
trusted_proxies=trusted_proxies,
login_threshold=login_threshold,
is_ban_enabled=is_ban_enabled,
ssl_profile=ssl_profile,
)
async def stop_server(event: Event) -> None:
"""Stop the server."""
await server.stop()
async def start_server(*_: Any) -> None:
"""Start the server."""
with async_start_setup(hass, ["http"]):
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, stop_server)
# We already checked it's not None.
assert conf is not None
await start_http_server_and_save_config(hass, dict(conf), server)
async_when_setup_or_start(hass, "frontend", start_server)
hass.http = server
local_ip = await async_get_source_ip(hass)
host = local_ip
if server_host is not None:
# Assume the first server host name provided as API host
host = server_host[0]
hass.config.api = ApiConfig(
local_ip, host, server_port, ssl_certificate is not None
)
return True
class HomeAssistantHTTP:
"""HTTP server for Home Assistant."""
def __init__(
self,
hass: HomeAssistant,
ssl_certificate: str | None,
ssl_peer_certificate: str | None,
ssl_key: str | None,
server_host: list[str] | None,
server_port: int,
cors_origins: list[str],
use_x_forwarded_for: bool,
trusted_proxies: list[str],
login_threshold: int,
is_ban_enabled: bool,
ssl_profile: str,
) -> None:
"""Initialize the HTTP Home Assistant server."""
app = self.app = web.Application(
middlewares=[], client_max_size=MAX_CLIENT_SIZE
)
app[KEY_HASS] = hass
# Order matters, security filters middle ware needs to go first,
# forwarded middleware needs to go second.
setup_security_filter(app)
async_setup_forwarded(app, use_x_forwarded_for, trusted_proxies)
setup_request_context(app, current_request)
if is_ban_enabled:
setup_bans(hass, app, login_threshold)
setup_auth(hass, app)
setup_cors(app, cors_origins)
self.hass = hass
self.ssl_certificate = ssl_certificate
self.ssl_peer_certificate = ssl_peer_certificate
self.ssl_key = ssl_key
self.server_host = server_host
self.server_port = server_port
self.trusted_proxies = trusted_proxies
self.is_ban_enabled = is_ban_enabled
self.ssl_profile = ssl_profile
self._handler = None
self.runner: web.AppRunner | None = None
self.site: HomeAssistantTCPSite | None = None
def register_view(self, view: HomeAssistantView) -> None:
"""Register a view with the WSGI server.
The view argument must be a class that inherits from HomeAssistantView.
It is optional to instantiate it before registering; this method will
handle it either way.
"""
if isinstance(view, type):
# Instantiate the view, if needed
view = view()
if not hasattr(view, "url"):
class_name = view.__class__.__name__
raise AttributeError(f'{class_name} missing required attribute "url"')
if not hasattr(view, "name"):
class_name = view.__class__.__name__
raise AttributeError(f'{class_name} missing required attribute "name"')
view.register(self.app, self.app.router)
def register_redirect(
self,
url: str,
redirect_to: StrOrURL,
*,
redirect_exc: type[HTTPRedirection] = HTTPMovedPermanently,
) -> None:
"""Register a redirect with the server.
If given this must be either a string or callable. In case of a
callable it's called with the url adapter that triggered the match and
the values of the URL as keyword arguments and has to return the target
for the redirect, otherwise it has to be a string with placeholders in
rule syntax.
"""
async def redirect(request: web.Request) -> web.StreamResponse:
"""Redirect to location."""
# Should be instance of aiohttp.web_exceptions._HTTPMove.
raise redirect_exc(redirect_to) # type: ignore[arg-type,misc]
self.app["allow_configured_cors"](
self.app.router.add_route("GET", url, redirect)
)
def register_static_path(
self, url_path: str, path: str, cache_headers: bool = True
) -> None:
"""Register a folder or file to serve as a static path."""
if os.path.isdir(path):
if cache_headers:
resource: CachingStaticResource | web.StaticResource = (
CachingStaticResource(url_path, path)
)
else:
resource = web.StaticResource(url_path, path)
self.app.router.register_resource(resource)
self.app["allow_configured_cors"](resource)
return
async def serve_file(request: web.Request) -> web.FileResponse:
"""Serve file from disk."""
if cache_headers:
return web.FileResponse(path, headers=CACHE_HEADERS)
return web.FileResponse(path)
self.app["allow_configured_cors"](
self.app.router.add_route("GET", url_path, serve_file)
)
async def start(self) -> None:
"""Start the aiohttp server."""
context: ssl.SSLContext | None
if self.ssl_certificate:
try:
if self.ssl_profile == SSL_INTERMEDIATE:
context = ssl_util.server_context_intermediate()
else:
context = ssl_util.server_context_modern()
await self.hass.async_add_executor_job(
context.load_cert_chain, self.ssl_certificate, self.ssl_key
)
except OSError as error:
_LOGGER.error(
"Could not read SSL certificate from %s: %s",
self.ssl_certificate,
error,
)
return
if self.ssl_peer_certificate:
context.verify_mode = ssl.CERT_REQUIRED
await self.hass.async_add_executor_job(
context.load_verify_locations, self.ssl_peer_certificate
)
else:
context = None
# Aiohttp freezes apps after start so that no changes can be made.
# However in Home Assistant components can be discovered after boot.
# This will now raise a RunTimeError.
# To work around this we now prevent the router from getting frozen
# pylint: disable=protected-access
self.app._router.freeze = lambda: None # type: ignore[assignment]
self.runner = web.AppRunner(self.app)
await self.runner.setup()
self.site = HomeAssistantTCPSite(
self.runner, self.server_host, self.server_port, ssl_context=context
)
try:
await self.site.start()
except OSError as error:
_LOGGER.error(
"Failed to create HTTP server at port %d: %s", self.server_port, error
)
_LOGGER.info("Now listening on port %d", self.server_port)
async def stop(self) -> None:
"""Stop the aiohttp server."""
if self.site is not None:
await self.site.stop()
if self.runner is not None:
await self.runner.cleanup()
async def start_http_server_and_save_config(
hass: HomeAssistant, conf: dict, server: HomeAssistantHTTP
) -> None:
"""Startup the http server and save the config."""
await server.start()
# If we are set up successful, we store the HTTP settings for safe mode.
store = storage.Store(hass, STORAGE_VERSION, STORAGE_KEY)
if CONF_TRUSTED_PROXIES in conf:
conf[CONF_TRUSTED_PROXIES] = [
str(ip.network_address) for ip in conf[CONF_TRUSTED_PROXIES]
]
store.async_delay_save(lambda: conf, SAVE_DELAY)
|
mezz64/home-assistant
|
homeassistant/components/http/__init__.py
|
Python
|
apache-2.0
| 14,018
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*!
* Copyright (c) 2018 by Contributors
* \file np_nonzero_op.cc
*/
#include "np_nonzero_op-inl.h"
namespace mxnet {
namespace op {
bool NonzeroType(const nnvm::NodeAttrs& attrs,
std::vector<int> *in_attrs,
std::vector<int> *out_attrs) {
CHECK_EQ(in_attrs->size(), 1);
CHECK_EQ(out_attrs->size(), 1);
// Output must be int64.
TYPE_ASSIGN_CHECK(*out_attrs, 0, mshadow::kInt64);
return out_attrs->at(0) != -1;
}
#define MAXDIM 5
bool NonzeroStorageType(const nnvm::NodeAttrs& attrs,
const int dev_mask,
DispatchMode* dispatch_mode,
std::vector<int> *in_attrs,
std::vector<int> *out_attrs) {
CHECK_EQ(in_attrs->size(), 1);
CHECK_EQ(out_attrs->size(), 1);
for (int &attr : *in_attrs) {
CHECK_EQ(attr, kDefaultStorage) << "Only default storage is supported";
}
for (int &attr : *out_attrs) {
attr = kDefaultStorage;
}
*dispatch_mode = DispatchMode::kFComputeEx;
return true;
}
void NonzeroForwardCPU(const nnvm::NodeAttrs& attrs,
const OpContext &ctx,
const std::vector<NDArray> &inputs,
const std::vector<OpReqType> &req,
const std::vector<NDArray> &outputs) {
CHECK_EQ(inputs.size(), 1U);
CHECK_EQ(outputs.size(), 1U);
const NDArray &in = inputs[0];
const NDArray &out = outputs[0];
CHECK_LE(in.shape().ndim(), MAXDIM) << "ndim of input cannot larger than " << MAXDIM;
// 0-dim
if (0 == in.shape().ndim()) {
MSHADOW_TYPE_SWITCH(in.dtype(), DType, {
DType* in_dptr = in.data().dptr<DType>();
if (*in_dptr) {
mxnet::TShape s(2, 1);
const_cast<NDArray &>(out).Init(s);
*(out.data().dptr<int64_t>()) = 0;
} else {
mxnet::TShape s(2, 1);
s[0] = 0;
const_cast<NDArray &>(out).Init(s);
}
});
return;
}
size_t in_size = in.shape().Size();
// 0-shape
if (0 == in_size) {
mxnet::TShape s(2, in.shape().ndim());
s[0] = 0;
const_cast<NDArray &>(out).Init(s);
return;
}
std::vector<int32_t> prefix_sum(in_size, 0);
size_t valid_num = 0;
// Calculate prefix sum
MSHADOW_TYPE_SWITCH_WITH_BOOL(in.dtype(), DType, {
DType* in_dptr = in.data().dptr<DType>();
for (size_t i = 0; i < in_size; i++) {
prefix_sum[i] = (i == 0) ? 0 : prefix_sum[i - 1];
prefix_sum[i] += (in_dptr[i]) ? 1 : 0;
}
});
valid_num = prefix_sum[in_size - 1];
// set the output shape forcefully
mxnet::TShape s(2, in.shape().ndim());
s[0] = valid_num;
const_cast<NDArray &>(out).Init(s);
// get the shape from the input
MXNET_NDIM_SWITCH(in.shape().ndim(), ndim, {
mshadow::Shape<ndim> shape = in.shape().get<ndim>();
mshadow::Stream<cpu> *stream = ctx.get_stream<cpu>();
mxnet_op::Kernel<NonzeroForwardKernel, cpu>::Launch(
stream, in_size, out.data().dptr<int64_t>(), prefix_sum.data(), shape);
})
}
NNVM_REGISTER_OP(_npx_nonzero)
.add_alias("_npi_nonzero")
.set_num_inputs(1)
.set_num_outputs(1)
.set_attr<nnvm::FListInputNames>("FListInputNames",
[](const NodeAttrs& attrs) {
return std::vector<std::string>{"x"};
})
.set_attr<nnvm::FInferType>("FInferType", NonzeroType)
.set_attr<FComputeEx>("FComputeEx<cpu>", NonzeroForwardCPU)
.set_attr<FInferStorageType>("FInferStorageType", NonzeroStorageType)
.set_attr<nnvm::FGradient>("FGradient", MakeZeroGradNodes)
.add_argument("x", "NDArray-or-Symbol", "The input array.");
} // namespace op
} // namespace mxnet
|
larroy/mxnet
|
src/operator/numpy/np_nonzero_op.cc
|
C++
|
apache-2.0
| 4,390
|
//===-- DataFlowSanitizer.cpp - dynamic data flow analysis ----------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
/// \file
/// This file is a part of DataFlowSanitizer, a generalised dynamic data flow
/// analysis.
///
/// Unlike other Sanitizer tools, this tool is not designed to detect a specific
/// class of bugs on its own. Instead, it provides a generic dynamic data flow
/// analysis framework to be used by clients to help detect application-specific
/// issues within their own code.
///
/// The analysis is based on automatic propagation of data flow labels (also
/// known as taint labels) through a program as it performs computation. Each
/// byte of application memory is backed by two bytes of shadow memory which
/// hold the label. On Linux/x86_64, memory is laid out as follows:
///
/// +--------------------+ 0x800000000000 (top of memory)
/// | application memory |
/// +--------------------+ 0x700000008000 (kAppAddr)
/// | |
/// | unused |
/// | |
/// +--------------------+ 0x200200000000 (kUnusedAddr)
/// | union table |
/// +--------------------+ 0x200000000000 (kUnionTableAddr)
/// | shadow memory |
/// +--------------------+ 0x000000010000 (kShadowAddr)
/// | reserved by kernel |
/// +--------------------+ 0x000000000000
///
/// To derive a shadow memory address from an application memory address,
/// bits 44-46 are cleared to bring the address into the range
/// [0x000000008000,0x100000000000). Then the address is shifted left by 1 to
/// account for the double byte representation of shadow labels and move the
/// address into the shadow memory range. See the function
/// DataFlowSanitizer::getShadowAddress below.
///
/// For more information, please refer to the design document:
/// http://clang.llvm.org/docs/DataFlowSanitizerDesign.html
#include "llvm/Transforms/Instrumentation.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/Triple.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/InstVisitor.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/MDBuilder.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Value.h"
#include "llvm/Pass.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/SpecialCaseList.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Utils/Local.h"
#include <algorithm>
#include <iterator>
#include <set>
#include <utility>
using namespace llvm;
// The -dfsan-preserve-alignment flag controls whether this pass assumes that
// alignment requirements provided by the input IR are correct. For example,
// if the input IR contains a load with alignment 8, this flag will cause
// the shadow load to have alignment 16. This flag is disabled by default as
// we have unfortunately encountered too much code (including Clang itself;
// see PR14291) which performs misaligned access.
static cl::opt<bool> ClPreserveAlignment(
"dfsan-preserve-alignment",
cl::desc("respect alignment requirements provided by input IR"), cl::Hidden,
cl::init(false));
// The ABI list file controls how shadow parameters are passed. The pass treats
// every function labelled "uninstrumented" in the ABI list file as conforming
// to the "native" (i.e. unsanitized) ABI. Unless the ABI list contains
// additional annotations for those functions, a call to one of those functions
// will produce a warning message, as the labelling behaviour of the function is
// unknown. The other supported annotations are "functional" and "discard",
// which are described below under DataFlowSanitizer::WrapperKind.
static cl::opt<std::string> ClABIListFile(
"dfsan-abilist",
cl::desc("File listing native ABI functions and how the pass treats them"),
cl::Hidden);
// Controls whether the pass uses IA_Args or IA_TLS as the ABI for instrumented
// functions (see DataFlowSanitizer::InstrumentedABI below).
static cl::opt<bool> ClArgsABI(
"dfsan-args-abi",
cl::desc("Use the argument ABI rather than the TLS ABI"),
cl::Hidden);
// Controls whether the pass includes or ignores the labels of pointers in load
// instructions.
static cl::opt<bool> ClCombinePointerLabelsOnLoad(
"dfsan-combine-pointer-labels-on-load",
cl::desc("Combine the label of the pointer with the label of the data when "
"loading from memory."),
cl::Hidden, cl::init(true));
// Controls whether the pass includes or ignores the labels of pointers in
// stores instructions.
static cl::opt<bool> ClCombinePointerLabelsOnStore(
"dfsan-combine-pointer-labels-on-store",
cl::desc("Combine the label of the pointer with the label of the data when "
"storing in memory."),
cl::Hidden, cl::init(false));
static cl::opt<bool> ClDebugNonzeroLabels(
"dfsan-debug-nonzero-labels",
cl::desc("Insert calls to __dfsan_nonzero_label on observing a parameter, "
"load or return with a nonzero label"),
cl::Hidden);
namespace {
StringRef GetGlobalTypeString(const GlobalValue &G) {
// Types of GlobalVariables are always pointer types.
Type *GType = G.getType()->getElementType();
// For now we support blacklisting struct types only.
if (StructType *SGType = dyn_cast<StructType>(GType)) {
if (!SGType->isLiteral())
return SGType->getName();
}
return "<unknown type>";
}
class DFSanABIList {
std::unique_ptr<SpecialCaseList> SCL;
public:
DFSanABIList(std::unique_ptr<SpecialCaseList> SCL) : SCL(std::move(SCL)) {}
/// Returns whether either this function or its source file are listed in the
/// given category.
bool isIn(const Function &F, StringRef Category) const {
return isIn(*F.getParent(), Category) ||
SCL->inSection("fun", F.getName(), Category);
}
/// Returns whether this global alias is listed in the given category.
///
/// If GA aliases a function, the alias's name is matched as a function name
/// would be. Similarly, aliases of globals are matched like globals.
bool isIn(const GlobalAlias &GA, StringRef Category) const {
if (isIn(*GA.getParent(), Category))
return true;
if (isa<FunctionType>(GA.getType()->getElementType()))
return SCL->inSection("fun", GA.getName(), Category);
return SCL->inSection("global", GA.getName(), Category) ||
SCL->inSection("type", GetGlobalTypeString(GA), Category);
}
/// Returns whether this module is listed in the given category.
bool isIn(const Module &M, StringRef Category) const {
return SCL->inSection("src", M.getModuleIdentifier(), Category);
}
};
class DataFlowSanitizer : public ModulePass {
friend struct DFSanFunction;
friend class DFSanVisitor;
enum {
ShadowWidth = 16
};
/// Which ABI should be used for instrumented functions?
enum InstrumentedABI {
/// Argument and return value labels are passed through additional
/// arguments and by modifying the return type.
IA_Args,
/// Argument and return value labels are passed through TLS variables
/// __dfsan_arg_tls and __dfsan_retval_tls.
IA_TLS
};
/// How should calls to uninstrumented functions be handled?
enum WrapperKind {
/// This function is present in an uninstrumented form but we don't know
/// how it should be handled. Print a warning and call the function anyway.
/// Don't label the return value.
WK_Warning,
/// This function does not write to (user-accessible) memory, and its return
/// value is unlabelled.
WK_Discard,
/// This function does not write to (user-accessible) memory, and the label
/// of its return value is the union of the label of its arguments.
WK_Functional,
/// Instead of calling the function, a custom wrapper __dfsw_F is called,
/// where F is the name of the function. This function may wrap the
/// original function or provide its own implementation. This is similar to
/// the IA_Args ABI, except that IA_Args uses a struct return type to
/// pass the return value shadow in a register, while WK_Custom uses an
/// extra pointer argument to return the shadow. This allows the wrapped
/// form of the function type to be expressed in C.
WK_Custom
};
const DataLayout *DL;
Module *Mod;
LLVMContext *Ctx;
IntegerType *ShadowTy;
PointerType *ShadowPtrTy;
IntegerType *IntptrTy;
ConstantInt *ZeroShadow;
ConstantInt *ShadowPtrMask;
ConstantInt *ShadowPtrMul;
Constant *ArgTLS;
Constant *RetvalTLS;
void *(*GetArgTLSPtr)();
void *(*GetRetvalTLSPtr)();
Constant *GetArgTLS;
Constant *GetRetvalTLS;
FunctionType *DFSanUnionFnTy;
FunctionType *DFSanUnionLoadFnTy;
FunctionType *DFSanUnimplementedFnTy;
FunctionType *DFSanSetLabelFnTy;
FunctionType *DFSanNonzeroLabelFnTy;
FunctionType *DFSanVarargWrapperFnTy;
Constant *DFSanUnionFn;
Constant *DFSanCheckedUnionFn;
Constant *DFSanUnionLoadFn;
Constant *DFSanUnimplementedFn;
Constant *DFSanSetLabelFn;
Constant *DFSanNonzeroLabelFn;
Constant *DFSanVarargWrapperFn;
MDNode *ColdCallWeights;
DFSanABIList ABIList;
DenseMap<Value *, Function *> UnwrappedFnMap;
AttributeSet ReadOnlyNoneAttrs;
DenseMap<const Function *, DISubprogram> FunctionDIs;
Value *getShadowAddress(Value *Addr, Instruction *Pos);
bool isInstrumented(const Function *F);
bool isInstrumented(const GlobalAlias *GA);
FunctionType *getArgsFunctionType(FunctionType *T);
FunctionType *getTrampolineFunctionType(FunctionType *T);
FunctionType *getCustomFunctionType(FunctionType *T);
InstrumentedABI getInstrumentedABI();
WrapperKind getWrapperKind(Function *F);
void addGlobalNamePrefix(GlobalValue *GV);
Function *buildWrapperFunction(Function *F, StringRef NewFName,
GlobalValue::LinkageTypes NewFLink,
FunctionType *NewFT);
Constant *getOrBuildTrampolineFunction(FunctionType *FT, StringRef FName);
public:
DataFlowSanitizer(StringRef ABIListFile = StringRef(),
void *(*getArgTLS)() = nullptr,
void *(*getRetValTLS)() = nullptr);
static char ID;
bool doInitialization(Module &M) override;
bool runOnModule(Module &M) override;
};
struct DFSanFunction {
DataFlowSanitizer &DFS;
Function *F;
DominatorTree DT;
DataFlowSanitizer::InstrumentedABI IA;
bool IsNativeABI;
Value *ArgTLSPtr;
Value *RetvalTLSPtr;
AllocaInst *LabelReturnAlloca;
DenseMap<Value *, Value *> ValShadowMap;
DenseMap<AllocaInst *, AllocaInst *> AllocaShadowMap;
std::vector<std::pair<PHINode *, PHINode *> > PHIFixups;
DenseSet<Instruction *> SkipInsts;
std::vector<Value *> NonZeroChecks;
bool AvoidNewBlocks;
struct CachedCombinedShadow {
BasicBlock *Block;
Value *Shadow;
};
DenseMap<std::pair<Value *, Value *>, CachedCombinedShadow>
CachedCombinedShadows;
DenseMap<Value *, std::set<Value *>> ShadowElements;
DFSanFunction(DataFlowSanitizer &DFS, Function *F, bool IsNativeABI)
: DFS(DFS), F(F), IA(DFS.getInstrumentedABI()),
IsNativeABI(IsNativeABI), ArgTLSPtr(nullptr), RetvalTLSPtr(nullptr),
LabelReturnAlloca(nullptr) {
DT.recalculate(*F);
// FIXME: Need to track down the register allocator issue which causes poor
// performance in pathological cases with large numbers of basic blocks.
AvoidNewBlocks = F->size() > 1000;
}
Value *getArgTLSPtr();
Value *getArgTLS(unsigned Index, Instruction *Pos);
Value *getRetvalTLS();
Value *getShadow(Value *V);
void setShadow(Instruction *I, Value *Shadow);
Value *combineShadows(Value *V1, Value *V2, Instruction *Pos);
Value *combineOperandShadows(Instruction *Inst);
Value *loadShadow(Value *ShadowAddr, uint64_t Size, uint64_t Align,
Instruction *Pos);
void storeShadow(Value *Addr, uint64_t Size, uint64_t Align, Value *Shadow,
Instruction *Pos);
};
class DFSanVisitor : public InstVisitor<DFSanVisitor> {
public:
DFSanFunction &DFSF;
DFSanVisitor(DFSanFunction &DFSF) : DFSF(DFSF) {}
void visitOperandShadowInst(Instruction &I);
void visitBinaryOperator(BinaryOperator &BO);
void visitCastInst(CastInst &CI);
void visitCmpInst(CmpInst &CI);
void visitGetElementPtrInst(GetElementPtrInst &GEPI);
void visitLoadInst(LoadInst &LI);
void visitStoreInst(StoreInst &SI);
void visitReturnInst(ReturnInst &RI);
void visitCallSite(CallSite CS);
void visitPHINode(PHINode &PN);
void visitExtractElementInst(ExtractElementInst &I);
void visitInsertElementInst(InsertElementInst &I);
void visitShuffleVectorInst(ShuffleVectorInst &I);
void visitExtractValueInst(ExtractValueInst &I);
void visitInsertValueInst(InsertValueInst &I);
void visitAllocaInst(AllocaInst &I);
void visitSelectInst(SelectInst &I);
void visitMemSetInst(MemSetInst &I);
void visitMemTransferInst(MemTransferInst &I);
};
}
char DataFlowSanitizer::ID;
INITIALIZE_PASS(DataFlowSanitizer, "dfsan",
"DataFlowSanitizer: dynamic data flow analysis.", false, false)
ModulePass *llvm::createDataFlowSanitizerPass(StringRef ABIListFile,
void *(*getArgTLS)(),
void *(*getRetValTLS)()) {
return new DataFlowSanitizer(ABIListFile, getArgTLS, getRetValTLS);
}
DataFlowSanitizer::DataFlowSanitizer(StringRef ABIListFile,
void *(*getArgTLS)(),
void *(*getRetValTLS)())
: ModulePass(ID), GetArgTLSPtr(getArgTLS), GetRetvalTLSPtr(getRetValTLS),
ABIList(SpecialCaseList::createOrDie(ABIListFile.empty() ? ClABIListFile
: ABIListFile)) {
}
FunctionType *DataFlowSanitizer::getArgsFunctionType(FunctionType *T) {
llvm::SmallVector<Type *, 4> ArgTypes;
std::copy(T->param_begin(), T->param_end(), std::back_inserter(ArgTypes));
for (unsigned i = 0, e = T->getNumParams(); i != e; ++i)
ArgTypes.push_back(ShadowTy);
if (T->isVarArg())
ArgTypes.push_back(ShadowPtrTy);
Type *RetType = T->getReturnType();
if (!RetType->isVoidTy())
RetType = StructType::get(RetType, ShadowTy, (Type *)nullptr);
return FunctionType::get(RetType, ArgTypes, T->isVarArg());
}
FunctionType *DataFlowSanitizer::getTrampolineFunctionType(FunctionType *T) {
assert(!T->isVarArg());
llvm::SmallVector<Type *, 4> ArgTypes;
ArgTypes.push_back(T->getPointerTo());
std::copy(T->param_begin(), T->param_end(), std::back_inserter(ArgTypes));
for (unsigned i = 0, e = T->getNumParams(); i != e; ++i)
ArgTypes.push_back(ShadowTy);
Type *RetType = T->getReturnType();
if (!RetType->isVoidTy())
ArgTypes.push_back(ShadowPtrTy);
return FunctionType::get(T->getReturnType(), ArgTypes, false);
}
FunctionType *DataFlowSanitizer::getCustomFunctionType(FunctionType *T) {
llvm::SmallVector<Type *, 4> ArgTypes;
for (FunctionType::param_iterator i = T->param_begin(), e = T->param_end();
i != e; ++i) {
FunctionType *FT;
if (isa<PointerType>(*i) && (FT = dyn_cast<FunctionType>(cast<PointerType>(
*i)->getElementType()))) {
ArgTypes.push_back(getTrampolineFunctionType(FT)->getPointerTo());
ArgTypes.push_back(Type::getInt8PtrTy(*Ctx));
} else {
ArgTypes.push_back(*i);
}
}
for (unsigned i = 0, e = T->getNumParams(); i != e; ++i)
ArgTypes.push_back(ShadowTy);
if (T->isVarArg())
ArgTypes.push_back(ShadowPtrTy);
Type *RetType = T->getReturnType();
if (!RetType->isVoidTy())
ArgTypes.push_back(ShadowPtrTy);
return FunctionType::get(T->getReturnType(), ArgTypes, T->isVarArg());
}
bool DataFlowSanitizer::doInitialization(Module &M) {
llvm::Triple TargetTriple(M.getTargetTriple());
bool IsX86_64 = TargetTriple.getArch() == llvm::Triple::x86_64;
bool IsMIPS64 = TargetTriple.getArch() == llvm::Triple::mips64 ||
TargetTriple.getArch() == llvm::Triple::mips64el;
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
if (!DLP)
report_fatal_error("data layout missing");
DL = &DLP->getDataLayout();
Mod = &M;
Ctx = &M.getContext();
ShadowTy = IntegerType::get(*Ctx, ShadowWidth);
ShadowPtrTy = PointerType::getUnqual(ShadowTy);
IntptrTy = DL->getIntPtrType(*Ctx);
ZeroShadow = ConstantInt::getSigned(ShadowTy, 0);
ShadowPtrMul = ConstantInt::getSigned(IntptrTy, ShadowWidth / 8);
if (IsX86_64)
ShadowPtrMask = ConstantInt::getSigned(IntptrTy, ~0x700000000000LL);
else if (IsMIPS64)
ShadowPtrMask = ConstantInt::getSigned(IntptrTy, ~0xF000000000LL);
else
report_fatal_error("unsupported triple");
Type *DFSanUnionArgs[2] = { ShadowTy, ShadowTy };
DFSanUnionFnTy =
FunctionType::get(ShadowTy, DFSanUnionArgs, /*isVarArg=*/ false);
Type *DFSanUnionLoadArgs[2] = { ShadowPtrTy, IntptrTy };
DFSanUnionLoadFnTy =
FunctionType::get(ShadowTy, DFSanUnionLoadArgs, /*isVarArg=*/ false);
DFSanUnimplementedFnTy = FunctionType::get(
Type::getVoidTy(*Ctx), Type::getInt8PtrTy(*Ctx), /*isVarArg=*/false);
Type *DFSanSetLabelArgs[3] = { ShadowTy, Type::getInt8PtrTy(*Ctx), IntptrTy };
DFSanSetLabelFnTy = FunctionType::get(Type::getVoidTy(*Ctx),
DFSanSetLabelArgs, /*isVarArg=*/false);
DFSanNonzeroLabelFnTy = FunctionType::get(
Type::getVoidTy(*Ctx), None, /*isVarArg=*/false);
DFSanVarargWrapperFnTy = FunctionType::get(
Type::getVoidTy(*Ctx), Type::getInt8PtrTy(*Ctx), /*isVarArg=*/false);
if (GetArgTLSPtr) {
Type *ArgTLSTy = ArrayType::get(ShadowTy, 64);
ArgTLS = nullptr;
GetArgTLS = ConstantExpr::getIntToPtr(
ConstantInt::get(IntptrTy, uintptr_t(GetArgTLSPtr)),
PointerType::getUnqual(
FunctionType::get(PointerType::getUnqual(ArgTLSTy),
(Type *)nullptr)));
}
if (GetRetvalTLSPtr) {
RetvalTLS = nullptr;
GetRetvalTLS = ConstantExpr::getIntToPtr(
ConstantInt::get(IntptrTy, uintptr_t(GetRetvalTLSPtr)),
PointerType::getUnqual(
FunctionType::get(PointerType::getUnqual(ShadowTy),
(Type *)nullptr)));
}
ColdCallWeights = MDBuilder(*Ctx).createBranchWeights(1, 1000);
return true;
}
bool DataFlowSanitizer::isInstrumented(const Function *F) {
return !ABIList.isIn(*F, "uninstrumented");
}
bool DataFlowSanitizer::isInstrumented(const GlobalAlias *GA) {
return !ABIList.isIn(*GA, "uninstrumented");
}
DataFlowSanitizer::InstrumentedABI DataFlowSanitizer::getInstrumentedABI() {
return ClArgsABI ? IA_Args : IA_TLS;
}
DataFlowSanitizer::WrapperKind DataFlowSanitizer::getWrapperKind(Function *F) {
if (ABIList.isIn(*F, "functional"))
return WK_Functional;
if (ABIList.isIn(*F, "discard"))
return WK_Discard;
if (ABIList.isIn(*F, "custom"))
return WK_Custom;
return WK_Warning;
}
void DataFlowSanitizer::addGlobalNamePrefix(GlobalValue *GV) {
std::string GVName = GV->getName(), Prefix = "dfs$";
GV->setName(Prefix + GVName);
// Try to change the name of the function in module inline asm. We only do
// this for specific asm directives, currently only ".symver", to try to avoid
// corrupting asm which happens to contain the symbol name as a substring.
// Note that the substitution for .symver assumes that the versioned symbol
// also has an instrumented name.
std::string Asm = GV->getParent()->getModuleInlineAsm();
std::string SearchStr = ".symver " + GVName + ",";
size_t Pos = Asm.find(SearchStr);
if (Pos != std::string::npos) {
Asm.replace(Pos, SearchStr.size(),
".symver " + Prefix + GVName + "," + Prefix);
GV->getParent()->setModuleInlineAsm(Asm);
}
}
Function *
DataFlowSanitizer::buildWrapperFunction(Function *F, StringRef NewFName,
GlobalValue::LinkageTypes NewFLink,
FunctionType *NewFT) {
FunctionType *FT = F->getFunctionType();
Function *NewF = Function::Create(NewFT, NewFLink, NewFName,
F->getParent());
NewF->copyAttributesFrom(F);
NewF->removeAttributes(
AttributeSet::ReturnIndex,
AttributeFuncs::typeIncompatible(NewFT->getReturnType(),
AttributeSet::ReturnIndex));
BasicBlock *BB = BasicBlock::Create(*Ctx, "entry", NewF);
if (F->isVarArg()) {
NewF->removeAttributes(
AttributeSet::FunctionIndex,
AttributeSet().addAttribute(*Ctx, AttributeSet::FunctionIndex,
"split-stack"));
CallInst::Create(DFSanVarargWrapperFn,
IRBuilder<>(BB).CreateGlobalStringPtr(F->getName()), "",
BB);
new UnreachableInst(*Ctx, BB);
} else {
std::vector<Value *> Args;
unsigned n = FT->getNumParams();
for (Function::arg_iterator ai = NewF->arg_begin(); n != 0; ++ai, --n)
Args.push_back(&*ai);
CallInst *CI = CallInst::Create(F, Args, "", BB);
if (FT->getReturnType()->isVoidTy())
ReturnInst::Create(*Ctx, BB);
else
ReturnInst::Create(*Ctx, CI, BB);
}
return NewF;
}
Constant *DataFlowSanitizer::getOrBuildTrampolineFunction(FunctionType *FT,
StringRef FName) {
FunctionType *FTT = getTrampolineFunctionType(FT);
Constant *C = Mod->getOrInsertFunction(FName, FTT);
Function *F = dyn_cast<Function>(C);
if (F && F->isDeclaration()) {
F->setLinkage(GlobalValue::LinkOnceODRLinkage);
BasicBlock *BB = BasicBlock::Create(*Ctx, "entry", F);
std::vector<Value *> Args;
Function::arg_iterator AI = F->arg_begin(); ++AI;
for (unsigned N = FT->getNumParams(); N != 0; ++AI, --N)
Args.push_back(&*AI);
CallInst *CI =
CallInst::Create(&F->getArgumentList().front(), Args, "", BB);
ReturnInst *RI;
if (FT->getReturnType()->isVoidTy())
RI = ReturnInst::Create(*Ctx, BB);
else
RI = ReturnInst::Create(*Ctx, CI, BB);
DFSanFunction DFSF(*this, F, /*IsNativeABI=*/true);
Function::arg_iterator ValAI = F->arg_begin(), ShadowAI = AI; ++ValAI;
for (unsigned N = FT->getNumParams(); N != 0; ++ValAI, ++ShadowAI, --N)
DFSF.ValShadowMap[ValAI] = ShadowAI;
DFSanVisitor(DFSF).visitCallInst(*CI);
if (!FT->getReturnType()->isVoidTy())
new StoreInst(DFSF.getShadow(RI->getReturnValue()),
&F->getArgumentList().back(), RI);
}
return C;
}
bool DataFlowSanitizer::runOnModule(Module &M) {
if (!DL)
return false;
if (ABIList.isIn(M, "skip"))
return false;
FunctionDIs = makeSubprogramMap(M);
if (!GetArgTLSPtr) {
Type *ArgTLSTy = ArrayType::get(ShadowTy, 64);
ArgTLS = Mod->getOrInsertGlobal("__dfsan_arg_tls", ArgTLSTy);
if (GlobalVariable *G = dyn_cast<GlobalVariable>(ArgTLS))
G->setThreadLocalMode(GlobalVariable::InitialExecTLSModel);
}
if (!GetRetvalTLSPtr) {
RetvalTLS = Mod->getOrInsertGlobal("__dfsan_retval_tls", ShadowTy);
if (GlobalVariable *G = dyn_cast<GlobalVariable>(RetvalTLS))
G->setThreadLocalMode(GlobalVariable::InitialExecTLSModel);
}
DFSanUnionFn = Mod->getOrInsertFunction("__dfsan_union", DFSanUnionFnTy);
if (Function *F = dyn_cast<Function>(DFSanUnionFn)) {
F->addAttribute(AttributeSet::FunctionIndex, Attribute::NoUnwind);
F->addAttribute(AttributeSet::FunctionIndex, Attribute::ReadNone);
F->addAttribute(AttributeSet::ReturnIndex, Attribute::ZExt);
F->addAttribute(1, Attribute::ZExt);
F->addAttribute(2, Attribute::ZExt);
}
DFSanCheckedUnionFn = Mod->getOrInsertFunction("dfsan_union", DFSanUnionFnTy);
if (Function *F = dyn_cast<Function>(DFSanCheckedUnionFn)) {
F->addAttribute(AttributeSet::FunctionIndex, Attribute::NoUnwind);
F->addAttribute(AttributeSet::FunctionIndex, Attribute::ReadNone);
F->addAttribute(AttributeSet::ReturnIndex, Attribute::ZExt);
F->addAttribute(1, Attribute::ZExt);
F->addAttribute(2, Attribute::ZExt);
}
DFSanUnionLoadFn =
Mod->getOrInsertFunction("__dfsan_union_load", DFSanUnionLoadFnTy);
if (Function *F = dyn_cast<Function>(DFSanUnionLoadFn)) {
F->addAttribute(AttributeSet::FunctionIndex, Attribute::NoUnwind);
F->addAttribute(AttributeSet::FunctionIndex, Attribute::ReadOnly);
F->addAttribute(AttributeSet::ReturnIndex, Attribute::ZExt);
}
DFSanUnimplementedFn =
Mod->getOrInsertFunction("__dfsan_unimplemented", DFSanUnimplementedFnTy);
DFSanSetLabelFn =
Mod->getOrInsertFunction("__dfsan_set_label", DFSanSetLabelFnTy);
if (Function *F = dyn_cast<Function>(DFSanSetLabelFn)) {
F->addAttribute(1, Attribute::ZExt);
}
DFSanNonzeroLabelFn =
Mod->getOrInsertFunction("__dfsan_nonzero_label", DFSanNonzeroLabelFnTy);
DFSanVarargWrapperFn = Mod->getOrInsertFunction("__dfsan_vararg_wrapper",
DFSanVarargWrapperFnTy);
std::vector<Function *> FnsToInstrument;
llvm::SmallPtrSet<Function *, 2> FnsWithNativeABI;
for (Module::iterator i = M.begin(), e = M.end(); i != e; ++i) {
if (!i->isIntrinsic() &&
i != DFSanUnionFn &&
i != DFSanCheckedUnionFn &&
i != DFSanUnionLoadFn &&
i != DFSanUnimplementedFn &&
i != DFSanSetLabelFn &&
i != DFSanNonzeroLabelFn &&
i != DFSanVarargWrapperFn)
FnsToInstrument.push_back(&*i);
}
// Give function aliases prefixes when necessary, and build wrappers where the
// instrumentedness is inconsistent.
for (Module::alias_iterator i = M.alias_begin(), e = M.alias_end(); i != e;) {
GlobalAlias *GA = &*i;
++i;
// Don't stop on weak. We assume people aren't playing games with the
// instrumentedness of overridden weak aliases.
if (auto F = dyn_cast<Function>(GA->getBaseObject())) {
bool GAInst = isInstrumented(GA), FInst = isInstrumented(F);
if (GAInst && FInst) {
addGlobalNamePrefix(GA);
} else if (GAInst != FInst) {
// Non-instrumented alias of an instrumented function, or vice versa.
// Replace the alias with a native-ABI wrapper of the aliasee. The pass
// below will take care of instrumenting it.
Function *NewF =
buildWrapperFunction(F, "", GA->getLinkage(), F->getFunctionType());
GA->replaceAllUsesWith(ConstantExpr::getBitCast(NewF, GA->getType()));
NewF->takeName(GA);
GA->eraseFromParent();
FnsToInstrument.push_back(NewF);
}
}
}
AttrBuilder B;
B.addAttribute(Attribute::ReadOnly).addAttribute(Attribute::ReadNone);
ReadOnlyNoneAttrs = AttributeSet::get(*Ctx, AttributeSet::FunctionIndex, B);
// First, change the ABI of every function in the module. ABI-listed
// functions keep their original ABI and get a wrapper function.
for (std::vector<Function *>::iterator i = FnsToInstrument.begin(),
e = FnsToInstrument.end();
i != e; ++i) {
Function &F = **i;
FunctionType *FT = F.getFunctionType();
bool IsZeroArgsVoidRet = (FT->getNumParams() == 0 && !FT->isVarArg() &&
FT->getReturnType()->isVoidTy());
if (isInstrumented(&F)) {
// Instrumented functions get a 'dfs$' prefix. This allows us to more
// easily identify cases of mismatching ABIs.
if (getInstrumentedABI() == IA_Args && !IsZeroArgsVoidRet) {
FunctionType *NewFT = getArgsFunctionType(FT);
Function *NewF = Function::Create(NewFT, F.getLinkage(), "", &M);
NewF->copyAttributesFrom(&F);
NewF->removeAttributes(
AttributeSet::ReturnIndex,
AttributeFuncs::typeIncompatible(NewFT->getReturnType(),
AttributeSet::ReturnIndex));
for (Function::arg_iterator FArg = F.arg_begin(),
NewFArg = NewF->arg_begin(),
FArgEnd = F.arg_end();
FArg != FArgEnd; ++FArg, ++NewFArg) {
FArg->replaceAllUsesWith(NewFArg);
}
NewF->getBasicBlockList().splice(NewF->begin(), F.getBasicBlockList());
for (Function::user_iterator UI = F.user_begin(), UE = F.user_end();
UI != UE;) {
BlockAddress *BA = dyn_cast<BlockAddress>(*UI);
++UI;
if (BA) {
BA->replaceAllUsesWith(
BlockAddress::get(NewF, BA->getBasicBlock()));
delete BA;
}
}
F.replaceAllUsesWith(
ConstantExpr::getBitCast(NewF, PointerType::getUnqual(FT)));
NewF->takeName(&F);
F.eraseFromParent();
*i = NewF;
addGlobalNamePrefix(NewF);
} else {
addGlobalNamePrefix(&F);
}
} else if (!IsZeroArgsVoidRet || getWrapperKind(&F) == WK_Custom) {
// Build a wrapper function for F. The wrapper simply calls F, and is
// added to FnsToInstrument so that any instrumentation according to its
// WrapperKind is done in the second pass below.
FunctionType *NewFT = getInstrumentedABI() == IA_Args
? getArgsFunctionType(FT)
: FT;
Function *NewF = buildWrapperFunction(
&F, std::string("dfsw$") + std::string(F.getName()),
GlobalValue::LinkOnceODRLinkage, NewFT);
if (getInstrumentedABI() == IA_TLS)
NewF->removeAttributes(AttributeSet::FunctionIndex, ReadOnlyNoneAttrs);
Value *WrappedFnCst =
ConstantExpr::getBitCast(NewF, PointerType::getUnqual(FT));
F.replaceAllUsesWith(WrappedFnCst);
// Patch the pointer to LLVM function in debug info descriptor.
auto DI = FunctionDIs.find(&F);
if (DI != FunctionDIs.end())
DI->second.replaceFunction(&F);
UnwrappedFnMap[WrappedFnCst] = &F;
*i = NewF;
if (!F.isDeclaration()) {
// This function is probably defining an interposition of an
// uninstrumented function and hence needs to keep the original ABI.
// But any functions it may call need to use the instrumented ABI, so
// we instrument it in a mode which preserves the original ABI.
FnsWithNativeABI.insert(&F);
// This code needs to rebuild the iterators, as they may be invalidated
// by the push_back, taking care that the new range does not include
// any functions added by this code.
size_t N = i - FnsToInstrument.begin(),
Count = e - FnsToInstrument.begin();
FnsToInstrument.push_back(&F);
i = FnsToInstrument.begin() + N;
e = FnsToInstrument.begin() + Count;
}
// Hopefully, nobody will try to indirectly call a vararg
// function... yet.
} else if (FT->isVarArg()) {
UnwrappedFnMap[&F] = &F;
*i = nullptr;
}
}
for (std::vector<Function *>::iterator i = FnsToInstrument.begin(),
e = FnsToInstrument.end();
i != e; ++i) {
if (!*i || (*i)->isDeclaration())
continue;
removeUnreachableBlocks(**i);
DFSanFunction DFSF(*this, *i, FnsWithNativeABI.count(*i));
// DFSanVisitor may create new basic blocks, which confuses df_iterator.
// Build a copy of the list before iterating over it.
llvm::SmallVector<BasicBlock *, 4> BBList(
depth_first(&(*i)->getEntryBlock()));
for (llvm::SmallVector<BasicBlock *, 4>::iterator i = BBList.begin(),
e = BBList.end();
i != e; ++i) {
Instruction *Inst = &(*i)->front();
while (1) {
// DFSanVisitor may split the current basic block, changing the current
// instruction's next pointer and moving the next instruction to the
// tail block from which we should continue.
Instruction *Next = Inst->getNextNode();
// DFSanVisitor may delete Inst, so keep track of whether it was a
// terminator.
bool IsTerminator = isa<TerminatorInst>(Inst);
if (!DFSF.SkipInsts.count(Inst))
DFSanVisitor(DFSF).visit(Inst);
if (IsTerminator)
break;
Inst = Next;
}
}
// We will not necessarily be able to compute the shadow for every phi node
// until we have visited every block. Therefore, the code that handles phi
// nodes adds them to the PHIFixups list so that they can be properly
// handled here.
for (std::vector<std::pair<PHINode *, PHINode *> >::iterator
i = DFSF.PHIFixups.begin(),
e = DFSF.PHIFixups.end();
i != e; ++i) {
for (unsigned val = 0, n = i->first->getNumIncomingValues(); val != n;
++val) {
i->second->setIncomingValue(
val, DFSF.getShadow(i->first->getIncomingValue(val)));
}
}
// -dfsan-debug-nonzero-labels will split the CFG in all kinds of crazy
// places (i.e. instructions in basic blocks we haven't even begun visiting
// yet). To make our life easier, do this work in a pass after the main
// instrumentation.
if (ClDebugNonzeroLabels) {
for (Value *V : DFSF.NonZeroChecks) {
Instruction *Pos;
if (Instruction *I = dyn_cast<Instruction>(V))
Pos = I->getNextNode();
else
Pos = DFSF.F->getEntryBlock().begin();
while (isa<PHINode>(Pos) || isa<AllocaInst>(Pos))
Pos = Pos->getNextNode();
IRBuilder<> IRB(Pos);
Value *Ne = IRB.CreateICmpNE(V, DFSF.DFS.ZeroShadow);
BranchInst *BI = cast<BranchInst>(SplitBlockAndInsertIfThen(
Ne, Pos, /*Unreachable=*/false, ColdCallWeights));
IRBuilder<> ThenIRB(BI);
ThenIRB.CreateCall(DFSF.DFS.DFSanNonzeroLabelFn);
}
}
}
return false;
}
Value *DFSanFunction::getArgTLSPtr() {
if (ArgTLSPtr)
return ArgTLSPtr;
if (DFS.ArgTLS)
return ArgTLSPtr = DFS.ArgTLS;
IRBuilder<> IRB(F->getEntryBlock().begin());
return ArgTLSPtr = IRB.CreateCall(DFS.GetArgTLS);
}
Value *DFSanFunction::getRetvalTLS() {
if (RetvalTLSPtr)
return RetvalTLSPtr;
if (DFS.RetvalTLS)
return RetvalTLSPtr = DFS.RetvalTLS;
IRBuilder<> IRB(F->getEntryBlock().begin());
return RetvalTLSPtr = IRB.CreateCall(DFS.GetRetvalTLS);
}
Value *DFSanFunction::getArgTLS(unsigned Idx, Instruction *Pos) {
IRBuilder<> IRB(Pos);
return IRB.CreateConstGEP2_64(getArgTLSPtr(), 0, Idx);
}
Value *DFSanFunction::getShadow(Value *V) {
if (!isa<Argument>(V) && !isa<Instruction>(V))
return DFS.ZeroShadow;
Value *&Shadow = ValShadowMap[V];
if (!Shadow) {
if (Argument *A = dyn_cast<Argument>(V)) {
if (IsNativeABI)
return DFS.ZeroShadow;
switch (IA) {
case DataFlowSanitizer::IA_TLS: {
Value *ArgTLSPtr = getArgTLSPtr();
Instruction *ArgTLSPos =
DFS.ArgTLS ? &*F->getEntryBlock().begin()
: cast<Instruction>(ArgTLSPtr)->getNextNode();
IRBuilder<> IRB(ArgTLSPos);
Shadow = IRB.CreateLoad(getArgTLS(A->getArgNo(), ArgTLSPos));
break;
}
case DataFlowSanitizer::IA_Args: {
unsigned ArgIdx = A->getArgNo() + F->getArgumentList().size() / 2;
Function::arg_iterator i = F->arg_begin();
while (ArgIdx--)
++i;
Shadow = i;
assert(Shadow->getType() == DFS.ShadowTy);
break;
}
}
NonZeroChecks.push_back(Shadow);
} else {
Shadow = DFS.ZeroShadow;
}
}
return Shadow;
}
void DFSanFunction::setShadow(Instruction *I, Value *Shadow) {
assert(!ValShadowMap.count(I));
assert(Shadow->getType() == DFS.ShadowTy);
ValShadowMap[I] = Shadow;
}
Value *DataFlowSanitizer::getShadowAddress(Value *Addr, Instruction *Pos) {
assert(Addr != RetvalTLS && "Reinstrumenting?");
IRBuilder<> IRB(Pos);
return IRB.CreateIntToPtr(
IRB.CreateMul(
IRB.CreateAnd(IRB.CreatePtrToInt(Addr, IntptrTy), ShadowPtrMask),
ShadowPtrMul),
ShadowPtrTy);
}
// Generates IR to compute the union of the two given shadows, inserting it
// before Pos. Returns the computed union Value.
Value *DFSanFunction::combineShadows(Value *V1, Value *V2, Instruction *Pos) {
if (V1 == DFS.ZeroShadow)
return V2;
if (V2 == DFS.ZeroShadow)
return V1;
if (V1 == V2)
return V1;
auto V1Elems = ShadowElements.find(V1);
auto V2Elems = ShadowElements.find(V2);
if (V1Elems != ShadowElements.end() && V2Elems != ShadowElements.end()) {
if (std::includes(V1Elems->second.begin(), V1Elems->second.end(),
V2Elems->second.begin(), V2Elems->second.end())) {
return V1;
} else if (std::includes(V2Elems->second.begin(), V2Elems->second.end(),
V1Elems->second.begin(), V1Elems->second.end())) {
return V2;
}
} else if (V1Elems != ShadowElements.end()) {
if (V1Elems->second.count(V2))
return V1;
} else if (V2Elems != ShadowElements.end()) {
if (V2Elems->second.count(V1))
return V2;
}
auto Key = std::make_pair(V1, V2);
if (V1 > V2)
std::swap(Key.first, Key.second);
CachedCombinedShadow &CCS = CachedCombinedShadows[Key];
if (CCS.Block && DT.dominates(CCS.Block, Pos->getParent()))
return CCS.Shadow;
IRBuilder<> IRB(Pos);
if (AvoidNewBlocks) {
CallInst *Call = IRB.CreateCall2(DFS.DFSanCheckedUnionFn, V1, V2);
Call->addAttribute(AttributeSet::ReturnIndex, Attribute::ZExt);
Call->addAttribute(1, Attribute::ZExt);
Call->addAttribute(2, Attribute::ZExt);
CCS.Block = Pos->getParent();
CCS.Shadow = Call;
} else {
BasicBlock *Head = Pos->getParent();
Value *Ne = IRB.CreateICmpNE(V1, V2);
BranchInst *BI = cast<BranchInst>(SplitBlockAndInsertIfThen(
Ne, Pos, /*Unreachable=*/false, DFS.ColdCallWeights, &DT));
IRBuilder<> ThenIRB(BI);
CallInst *Call = ThenIRB.CreateCall2(DFS.DFSanUnionFn, V1, V2);
Call->addAttribute(AttributeSet::ReturnIndex, Attribute::ZExt);
Call->addAttribute(1, Attribute::ZExt);
Call->addAttribute(2, Attribute::ZExt);
BasicBlock *Tail = BI->getSuccessor(0);
PHINode *Phi = PHINode::Create(DFS.ShadowTy, 2, "", Tail->begin());
Phi->addIncoming(Call, Call->getParent());
Phi->addIncoming(V1, Head);
CCS.Block = Tail;
CCS.Shadow = Phi;
}
std::set<Value *> UnionElems;
if (V1Elems != ShadowElements.end()) {
UnionElems = V1Elems->second;
} else {
UnionElems.insert(V1);
}
if (V2Elems != ShadowElements.end()) {
UnionElems.insert(V2Elems->second.begin(), V2Elems->second.end());
} else {
UnionElems.insert(V2);
}
ShadowElements[CCS.Shadow] = std::move(UnionElems);
return CCS.Shadow;
}
// A convenience function which folds the shadows of each of the operands
// of the provided instruction Inst, inserting the IR before Inst. Returns
// the computed union Value.
Value *DFSanFunction::combineOperandShadows(Instruction *Inst) {
if (Inst->getNumOperands() == 0)
return DFS.ZeroShadow;
Value *Shadow = getShadow(Inst->getOperand(0));
for (unsigned i = 1, n = Inst->getNumOperands(); i != n; ++i) {
Shadow = combineShadows(Shadow, getShadow(Inst->getOperand(i)), Inst);
}
return Shadow;
}
void DFSanVisitor::visitOperandShadowInst(Instruction &I) {
Value *CombinedShadow = DFSF.combineOperandShadows(&I);
DFSF.setShadow(&I, CombinedShadow);
}
// Generates IR to load shadow corresponding to bytes [Addr, Addr+Size), where
// Addr has alignment Align, and take the union of each of those shadows.
Value *DFSanFunction::loadShadow(Value *Addr, uint64_t Size, uint64_t Align,
Instruction *Pos) {
if (AllocaInst *AI = dyn_cast<AllocaInst>(Addr)) {
llvm::DenseMap<AllocaInst *, AllocaInst *>::iterator i =
AllocaShadowMap.find(AI);
if (i != AllocaShadowMap.end()) {
IRBuilder<> IRB(Pos);
return IRB.CreateLoad(i->second);
}
}
uint64_t ShadowAlign = Align * DFS.ShadowWidth / 8;
SmallVector<Value *, 2> Objs;
GetUnderlyingObjects(Addr, Objs, DFS.DL);
bool AllConstants = true;
for (SmallVector<Value *, 2>::iterator i = Objs.begin(), e = Objs.end();
i != e; ++i) {
if (isa<Function>(*i) || isa<BlockAddress>(*i))
continue;
if (isa<GlobalVariable>(*i) && cast<GlobalVariable>(*i)->isConstant())
continue;
AllConstants = false;
break;
}
if (AllConstants)
return DFS.ZeroShadow;
Value *ShadowAddr = DFS.getShadowAddress(Addr, Pos);
switch (Size) {
case 0:
return DFS.ZeroShadow;
case 1: {
LoadInst *LI = new LoadInst(ShadowAddr, "", Pos);
LI->setAlignment(ShadowAlign);
return LI;
}
case 2: {
IRBuilder<> IRB(Pos);
Value *ShadowAddr1 =
IRB.CreateGEP(ShadowAddr, ConstantInt::get(DFS.IntptrTy, 1));
return combineShadows(IRB.CreateAlignedLoad(ShadowAddr, ShadowAlign),
IRB.CreateAlignedLoad(ShadowAddr1, ShadowAlign), Pos);
}
}
if (!AvoidNewBlocks && Size % (64 / DFS.ShadowWidth) == 0) {
// Fast path for the common case where each byte has identical shadow: load
// shadow 64 bits at a time, fall out to a __dfsan_union_load call if any
// shadow is non-equal.
BasicBlock *FallbackBB = BasicBlock::Create(*DFS.Ctx, "", F);
IRBuilder<> FallbackIRB(FallbackBB);
CallInst *FallbackCall = FallbackIRB.CreateCall2(
DFS.DFSanUnionLoadFn, ShadowAddr, ConstantInt::get(DFS.IntptrTy, Size));
FallbackCall->addAttribute(AttributeSet::ReturnIndex, Attribute::ZExt);
// Compare each of the shadows stored in the loaded 64 bits to each other,
// by computing (WideShadow rotl ShadowWidth) == WideShadow.
IRBuilder<> IRB(Pos);
Value *WideAddr =
IRB.CreateBitCast(ShadowAddr, Type::getInt64PtrTy(*DFS.Ctx));
Value *WideShadow = IRB.CreateAlignedLoad(WideAddr, ShadowAlign);
Value *TruncShadow = IRB.CreateTrunc(WideShadow, DFS.ShadowTy);
Value *ShlShadow = IRB.CreateShl(WideShadow, DFS.ShadowWidth);
Value *ShrShadow = IRB.CreateLShr(WideShadow, 64 - DFS.ShadowWidth);
Value *RotShadow = IRB.CreateOr(ShlShadow, ShrShadow);
Value *ShadowsEq = IRB.CreateICmpEQ(WideShadow, RotShadow);
BasicBlock *Head = Pos->getParent();
BasicBlock *Tail = Head->splitBasicBlock(Pos);
if (DomTreeNode *OldNode = DT.getNode(Head)) {
std::vector<DomTreeNode *> Children(OldNode->begin(), OldNode->end());
DomTreeNode *NewNode = DT.addNewBlock(Tail, Head);
for (auto Child : Children)
DT.changeImmediateDominator(Child, NewNode);
}
// In the following code LastBr will refer to the previous basic block's
// conditional branch instruction, whose true successor is fixed up to point
// to the next block during the loop below or to the tail after the final
// iteration.
BranchInst *LastBr = BranchInst::Create(FallbackBB, FallbackBB, ShadowsEq);
ReplaceInstWithInst(Head->getTerminator(), LastBr);
DT.addNewBlock(FallbackBB, Head);
for (uint64_t Ofs = 64 / DFS.ShadowWidth; Ofs != Size;
Ofs += 64 / DFS.ShadowWidth) {
BasicBlock *NextBB = BasicBlock::Create(*DFS.Ctx, "", F);
DT.addNewBlock(NextBB, LastBr->getParent());
IRBuilder<> NextIRB(NextBB);
WideAddr = NextIRB.CreateGEP(WideAddr, ConstantInt::get(DFS.IntptrTy, 1));
Value *NextWideShadow = NextIRB.CreateAlignedLoad(WideAddr, ShadowAlign);
ShadowsEq = NextIRB.CreateICmpEQ(WideShadow, NextWideShadow);
LastBr->setSuccessor(0, NextBB);
LastBr = NextIRB.CreateCondBr(ShadowsEq, FallbackBB, FallbackBB);
}
LastBr->setSuccessor(0, Tail);
FallbackIRB.CreateBr(Tail);
PHINode *Shadow = PHINode::Create(DFS.ShadowTy, 2, "", &Tail->front());
Shadow->addIncoming(FallbackCall, FallbackBB);
Shadow->addIncoming(TruncShadow, LastBr->getParent());
return Shadow;
}
IRBuilder<> IRB(Pos);
CallInst *FallbackCall = IRB.CreateCall2(
DFS.DFSanUnionLoadFn, ShadowAddr, ConstantInt::get(DFS.IntptrTy, Size));
FallbackCall->addAttribute(AttributeSet::ReturnIndex, Attribute::ZExt);
return FallbackCall;
}
void DFSanVisitor::visitLoadInst(LoadInst &LI) {
uint64_t Size = DFSF.DFS.DL->getTypeStoreSize(LI.getType());
if (Size == 0) {
DFSF.setShadow(&LI, DFSF.DFS.ZeroShadow);
return;
}
uint64_t Align;
if (ClPreserveAlignment) {
Align = LI.getAlignment();
if (Align == 0)
Align = DFSF.DFS.DL->getABITypeAlignment(LI.getType());
} else {
Align = 1;
}
IRBuilder<> IRB(&LI);
Value *Shadow = DFSF.loadShadow(LI.getPointerOperand(), Size, Align, &LI);
if (ClCombinePointerLabelsOnLoad) {
Value *PtrShadow = DFSF.getShadow(LI.getPointerOperand());
Shadow = DFSF.combineShadows(Shadow, PtrShadow, &LI);
}
if (Shadow != DFSF.DFS.ZeroShadow)
DFSF.NonZeroChecks.push_back(Shadow);
DFSF.setShadow(&LI, Shadow);
}
void DFSanFunction::storeShadow(Value *Addr, uint64_t Size, uint64_t Align,
Value *Shadow, Instruction *Pos) {
if (AllocaInst *AI = dyn_cast<AllocaInst>(Addr)) {
llvm::DenseMap<AllocaInst *, AllocaInst *>::iterator i =
AllocaShadowMap.find(AI);
if (i != AllocaShadowMap.end()) {
IRBuilder<> IRB(Pos);
IRB.CreateStore(Shadow, i->second);
return;
}
}
uint64_t ShadowAlign = Align * DFS.ShadowWidth / 8;
IRBuilder<> IRB(Pos);
Value *ShadowAddr = DFS.getShadowAddress(Addr, Pos);
if (Shadow == DFS.ZeroShadow) {
IntegerType *ShadowTy = IntegerType::get(*DFS.Ctx, Size * DFS.ShadowWidth);
Value *ExtZeroShadow = ConstantInt::get(ShadowTy, 0);
Value *ExtShadowAddr =
IRB.CreateBitCast(ShadowAddr, PointerType::getUnqual(ShadowTy));
IRB.CreateAlignedStore(ExtZeroShadow, ExtShadowAddr, ShadowAlign);
return;
}
const unsigned ShadowVecSize = 128 / DFS.ShadowWidth;
uint64_t Offset = 0;
if (Size >= ShadowVecSize) {
VectorType *ShadowVecTy = VectorType::get(DFS.ShadowTy, ShadowVecSize);
Value *ShadowVec = UndefValue::get(ShadowVecTy);
for (unsigned i = 0; i != ShadowVecSize; ++i) {
ShadowVec = IRB.CreateInsertElement(
ShadowVec, Shadow, ConstantInt::get(Type::getInt32Ty(*DFS.Ctx), i));
}
Value *ShadowVecAddr =
IRB.CreateBitCast(ShadowAddr, PointerType::getUnqual(ShadowVecTy));
do {
Value *CurShadowVecAddr = IRB.CreateConstGEP1_32(ShadowVecAddr, Offset);
IRB.CreateAlignedStore(ShadowVec, CurShadowVecAddr, ShadowAlign);
Size -= ShadowVecSize;
++Offset;
} while (Size >= ShadowVecSize);
Offset *= ShadowVecSize;
}
while (Size > 0) {
Value *CurShadowAddr = IRB.CreateConstGEP1_32(ShadowAddr, Offset);
IRB.CreateAlignedStore(Shadow, CurShadowAddr, ShadowAlign);
--Size;
++Offset;
}
}
void DFSanVisitor::visitStoreInst(StoreInst &SI) {
uint64_t Size =
DFSF.DFS.DL->getTypeStoreSize(SI.getValueOperand()->getType());
if (Size == 0)
return;
uint64_t Align;
if (ClPreserveAlignment) {
Align = SI.getAlignment();
if (Align == 0)
Align = DFSF.DFS.DL->getABITypeAlignment(SI.getValueOperand()->getType());
} else {
Align = 1;
}
Value* Shadow = DFSF.getShadow(SI.getValueOperand());
if (ClCombinePointerLabelsOnStore) {
Value *PtrShadow = DFSF.getShadow(SI.getPointerOperand());
Shadow = DFSF.combineShadows(Shadow, PtrShadow, &SI);
}
DFSF.storeShadow(SI.getPointerOperand(), Size, Align, Shadow, &SI);
}
void DFSanVisitor::visitBinaryOperator(BinaryOperator &BO) {
visitOperandShadowInst(BO);
}
void DFSanVisitor::visitCastInst(CastInst &CI) { visitOperandShadowInst(CI); }
void DFSanVisitor::visitCmpInst(CmpInst &CI) { visitOperandShadowInst(CI); }
void DFSanVisitor::visitGetElementPtrInst(GetElementPtrInst &GEPI) {
visitOperandShadowInst(GEPI);
}
void DFSanVisitor::visitExtractElementInst(ExtractElementInst &I) {
visitOperandShadowInst(I);
}
void DFSanVisitor::visitInsertElementInst(InsertElementInst &I) {
visitOperandShadowInst(I);
}
void DFSanVisitor::visitShuffleVectorInst(ShuffleVectorInst &I) {
visitOperandShadowInst(I);
}
void DFSanVisitor::visitExtractValueInst(ExtractValueInst &I) {
visitOperandShadowInst(I);
}
void DFSanVisitor::visitInsertValueInst(InsertValueInst &I) {
visitOperandShadowInst(I);
}
void DFSanVisitor::visitAllocaInst(AllocaInst &I) {
bool AllLoadsStores = true;
for (User *U : I.users()) {
if (isa<LoadInst>(U))
continue;
if (StoreInst *SI = dyn_cast<StoreInst>(U)) {
if (SI->getPointerOperand() == &I)
continue;
}
AllLoadsStores = false;
break;
}
if (AllLoadsStores) {
IRBuilder<> IRB(&I);
DFSF.AllocaShadowMap[&I] = IRB.CreateAlloca(DFSF.DFS.ShadowTy);
}
DFSF.setShadow(&I, DFSF.DFS.ZeroShadow);
}
void DFSanVisitor::visitSelectInst(SelectInst &I) {
Value *CondShadow = DFSF.getShadow(I.getCondition());
Value *TrueShadow = DFSF.getShadow(I.getTrueValue());
Value *FalseShadow = DFSF.getShadow(I.getFalseValue());
if (isa<VectorType>(I.getCondition()->getType())) {
DFSF.setShadow(
&I,
DFSF.combineShadows(
CondShadow, DFSF.combineShadows(TrueShadow, FalseShadow, &I), &I));
} else {
Value *ShadowSel;
if (TrueShadow == FalseShadow) {
ShadowSel = TrueShadow;
} else {
ShadowSel =
SelectInst::Create(I.getCondition(), TrueShadow, FalseShadow, "", &I);
}
DFSF.setShadow(&I, DFSF.combineShadows(CondShadow, ShadowSel, &I));
}
}
void DFSanVisitor::visitMemSetInst(MemSetInst &I) {
IRBuilder<> IRB(&I);
Value *ValShadow = DFSF.getShadow(I.getValue());
IRB.CreateCall3(
DFSF.DFS.DFSanSetLabelFn, ValShadow,
IRB.CreateBitCast(I.getDest(), Type::getInt8PtrTy(*DFSF.DFS.Ctx)),
IRB.CreateZExtOrTrunc(I.getLength(), DFSF.DFS.IntptrTy));
}
void DFSanVisitor::visitMemTransferInst(MemTransferInst &I) {
IRBuilder<> IRB(&I);
Value *DestShadow = DFSF.DFS.getShadowAddress(I.getDest(), &I);
Value *SrcShadow = DFSF.DFS.getShadowAddress(I.getSource(), &I);
Value *LenShadow = IRB.CreateMul(
I.getLength(),
ConstantInt::get(I.getLength()->getType(), DFSF.DFS.ShadowWidth / 8));
Value *AlignShadow;
if (ClPreserveAlignment) {
AlignShadow = IRB.CreateMul(I.getAlignmentCst(),
ConstantInt::get(I.getAlignmentCst()->getType(),
DFSF.DFS.ShadowWidth / 8));
} else {
AlignShadow = ConstantInt::get(I.getAlignmentCst()->getType(),
DFSF.DFS.ShadowWidth / 8);
}
Type *Int8Ptr = Type::getInt8PtrTy(*DFSF.DFS.Ctx);
DestShadow = IRB.CreateBitCast(DestShadow, Int8Ptr);
SrcShadow = IRB.CreateBitCast(SrcShadow, Int8Ptr);
IRB.CreateCall5(I.getCalledValue(), DestShadow, SrcShadow, LenShadow,
AlignShadow, I.getVolatileCst());
}
void DFSanVisitor::visitReturnInst(ReturnInst &RI) {
if (!DFSF.IsNativeABI && RI.getReturnValue()) {
switch (DFSF.IA) {
case DataFlowSanitizer::IA_TLS: {
Value *S = DFSF.getShadow(RI.getReturnValue());
IRBuilder<> IRB(&RI);
IRB.CreateStore(S, DFSF.getRetvalTLS());
break;
}
case DataFlowSanitizer::IA_Args: {
IRBuilder<> IRB(&RI);
Type *RT = DFSF.F->getFunctionType()->getReturnType();
Value *InsVal =
IRB.CreateInsertValue(UndefValue::get(RT), RI.getReturnValue(), 0);
Value *InsShadow =
IRB.CreateInsertValue(InsVal, DFSF.getShadow(RI.getReturnValue()), 1);
RI.setOperand(0, InsShadow);
break;
}
}
}
}
void DFSanVisitor::visitCallSite(CallSite CS) {
Function *F = CS.getCalledFunction();
if ((F && F->isIntrinsic()) || isa<InlineAsm>(CS.getCalledValue())) {
visitOperandShadowInst(*CS.getInstruction());
return;
}
// Calls to this function are synthesized in wrappers, and we shouldn't
// instrument them.
if (F == DFSF.DFS.DFSanVarargWrapperFn)
return;
assert(!(cast<FunctionType>(
CS.getCalledValue()->getType()->getPointerElementType())->isVarArg() &&
dyn_cast<InvokeInst>(CS.getInstruction())));
IRBuilder<> IRB(CS.getInstruction());
DenseMap<Value *, Function *>::iterator i =
DFSF.DFS.UnwrappedFnMap.find(CS.getCalledValue());
if (i != DFSF.DFS.UnwrappedFnMap.end()) {
Function *F = i->second;
switch (DFSF.DFS.getWrapperKind(F)) {
case DataFlowSanitizer::WK_Warning: {
CS.setCalledFunction(F);
IRB.CreateCall(DFSF.DFS.DFSanUnimplementedFn,
IRB.CreateGlobalStringPtr(F->getName()));
DFSF.setShadow(CS.getInstruction(), DFSF.DFS.ZeroShadow);
return;
}
case DataFlowSanitizer::WK_Discard: {
CS.setCalledFunction(F);
DFSF.setShadow(CS.getInstruction(), DFSF.DFS.ZeroShadow);
return;
}
case DataFlowSanitizer::WK_Functional: {
CS.setCalledFunction(F);
visitOperandShadowInst(*CS.getInstruction());
return;
}
case DataFlowSanitizer::WK_Custom: {
// Don't try to handle invokes of custom functions, it's too complicated.
// Instead, invoke the dfsw$ wrapper, which will in turn call the __dfsw_
// wrapper.
if (CallInst *CI = dyn_cast<CallInst>(CS.getInstruction())) {
FunctionType *FT = F->getFunctionType();
FunctionType *CustomFT = DFSF.DFS.getCustomFunctionType(FT);
std::string CustomFName = "__dfsw_";
CustomFName += F->getName();
Constant *CustomF =
DFSF.DFS.Mod->getOrInsertFunction(CustomFName, CustomFT);
if (Function *CustomFn = dyn_cast<Function>(CustomF)) {
CustomFn->copyAttributesFrom(F);
// Custom functions returning non-void will write to the return label.
if (!FT->getReturnType()->isVoidTy()) {
CustomFn->removeAttributes(AttributeSet::FunctionIndex,
DFSF.DFS.ReadOnlyNoneAttrs);
}
}
std::vector<Value *> Args;
CallSite::arg_iterator i = CS.arg_begin();
for (unsigned n = FT->getNumParams(); n != 0; ++i, --n) {
Type *T = (*i)->getType();
FunctionType *ParamFT;
if (isa<PointerType>(T) &&
(ParamFT = dyn_cast<FunctionType>(
cast<PointerType>(T)->getElementType()))) {
std::string TName = "dfst";
TName += utostr(FT->getNumParams() - n);
TName += "$";
TName += F->getName();
Constant *T = DFSF.DFS.getOrBuildTrampolineFunction(ParamFT, TName);
Args.push_back(T);
Args.push_back(
IRB.CreateBitCast(*i, Type::getInt8PtrTy(*DFSF.DFS.Ctx)));
} else {
Args.push_back(*i);
}
}
i = CS.arg_begin();
for (unsigned n = FT->getNumParams(); n != 0; ++i, --n)
Args.push_back(DFSF.getShadow(*i));
if (FT->isVarArg()) {
auto LabelVAAlloca =
new AllocaInst(ArrayType::get(DFSF.DFS.ShadowTy,
CS.arg_size() - FT->getNumParams()),
"labelva", DFSF.F->getEntryBlock().begin());
for (unsigned n = 0; i != CS.arg_end(); ++i, ++n) {
auto LabelVAPtr = IRB.CreateStructGEP(LabelVAAlloca, n);
IRB.CreateStore(DFSF.getShadow(*i), LabelVAPtr);
}
Args.push_back(IRB.CreateStructGEP(LabelVAAlloca, 0));
}
if (!FT->getReturnType()->isVoidTy()) {
if (!DFSF.LabelReturnAlloca) {
DFSF.LabelReturnAlloca =
new AllocaInst(DFSF.DFS.ShadowTy, "labelreturn",
DFSF.F->getEntryBlock().begin());
}
Args.push_back(DFSF.LabelReturnAlloca);
}
for (i = CS.arg_begin() + FT->getNumParams(); i != CS.arg_end(); ++i)
Args.push_back(*i);
CallInst *CustomCI = IRB.CreateCall(CustomF, Args);
CustomCI->setCallingConv(CI->getCallingConv());
CustomCI->setAttributes(CI->getAttributes());
if (!FT->getReturnType()->isVoidTy()) {
LoadInst *LabelLoad = IRB.CreateLoad(DFSF.LabelReturnAlloca);
DFSF.setShadow(CustomCI, LabelLoad);
}
CI->replaceAllUsesWith(CustomCI);
CI->eraseFromParent();
return;
}
break;
}
}
}
FunctionType *FT = cast<FunctionType>(
CS.getCalledValue()->getType()->getPointerElementType());
if (DFSF.DFS.getInstrumentedABI() == DataFlowSanitizer::IA_TLS) {
for (unsigned i = 0, n = FT->getNumParams(); i != n; ++i) {
IRB.CreateStore(DFSF.getShadow(CS.getArgument(i)),
DFSF.getArgTLS(i, CS.getInstruction()));
}
}
Instruction *Next = nullptr;
if (!CS.getType()->isVoidTy()) {
if (InvokeInst *II = dyn_cast<InvokeInst>(CS.getInstruction())) {
if (II->getNormalDest()->getSinglePredecessor()) {
Next = II->getNormalDest()->begin();
} else {
BasicBlock *NewBB =
SplitEdge(II->getParent(), II->getNormalDest(), &DFSF.DFS);
Next = NewBB->begin();
}
} else {
Next = CS->getNextNode();
}
if (DFSF.DFS.getInstrumentedABI() == DataFlowSanitizer::IA_TLS) {
IRBuilder<> NextIRB(Next);
LoadInst *LI = NextIRB.CreateLoad(DFSF.getRetvalTLS());
DFSF.SkipInsts.insert(LI);
DFSF.setShadow(CS.getInstruction(), LI);
DFSF.NonZeroChecks.push_back(LI);
}
}
// Do all instrumentation for IA_Args down here to defer tampering with the
// CFG in a way that SplitEdge may be able to detect.
if (DFSF.DFS.getInstrumentedABI() == DataFlowSanitizer::IA_Args) {
FunctionType *NewFT = DFSF.DFS.getArgsFunctionType(FT);
Value *Func =
IRB.CreateBitCast(CS.getCalledValue(), PointerType::getUnqual(NewFT));
std::vector<Value *> Args;
CallSite::arg_iterator i = CS.arg_begin(), e = CS.arg_end();
for (unsigned n = FT->getNumParams(); n != 0; ++i, --n)
Args.push_back(*i);
i = CS.arg_begin();
for (unsigned n = FT->getNumParams(); n != 0; ++i, --n)
Args.push_back(DFSF.getShadow(*i));
if (FT->isVarArg()) {
unsigned VarArgSize = CS.arg_size() - FT->getNumParams();
ArrayType *VarArgArrayTy = ArrayType::get(DFSF.DFS.ShadowTy, VarArgSize);
AllocaInst *VarArgShadow =
new AllocaInst(VarArgArrayTy, "", DFSF.F->getEntryBlock().begin());
Args.push_back(IRB.CreateConstGEP2_32(VarArgShadow, 0, 0));
for (unsigned n = 0; i != e; ++i, ++n) {
IRB.CreateStore(DFSF.getShadow(*i),
IRB.CreateConstGEP2_32(VarArgShadow, 0, n));
Args.push_back(*i);
}
}
CallSite NewCS;
if (InvokeInst *II = dyn_cast<InvokeInst>(CS.getInstruction())) {
NewCS = IRB.CreateInvoke(Func, II->getNormalDest(), II->getUnwindDest(),
Args);
} else {
NewCS = IRB.CreateCall(Func, Args);
}
NewCS.setCallingConv(CS.getCallingConv());
NewCS.setAttributes(CS.getAttributes().removeAttributes(
*DFSF.DFS.Ctx, AttributeSet::ReturnIndex,
AttributeFuncs::typeIncompatible(NewCS.getInstruction()->getType(),
AttributeSet::ReturnIndex)));
if (Next) {
ExtractValueInst *ExVal =
ExtractValueInst::Create(NewCS.getInstruction(), 0, "", Next);
DFSF.SkipInsts.insert(ExVal);
ExtractValueInst *ExShadow =
ExtractValueInst::Create(NewCS.getInstruction(), 1, "", Next);
DFSF.SkipInsts.insert(ExShadow);
DFSF.setShadow(ExVal, ExShadow);
DFSF.NonZeroChecks.push_back(ExShadow);
CS.getInstruction()->replaceAllUsesWith(ExVal);
}
CS.getInstruction()->eraseFromParent();
}
}
void DFSanVisitor::visitPHINode(PHINode &PN) {
PHINode *ShadowPN =
PHINode::Create(DFSF.DFS.ShadowTy, PN.getNumIncomingValues(), "", &PN);
// Give the shadow phi node valid predecessors to fool SplitEdge into working.
Value *UndefShadow = UndefValue::get(DFSF.DFS.ShadowTy);
for (PHINode::block_iterator i = PN.block_begin(), e = PN.block_end(); i != e;
++i) {
ShadowPN->addIncoming(UndefShadow, *i);
}
DFSF.PHIFixups.push_back(std::make_pair(&PN, ShadowPN));
DFSF.setShadow(&PN, ShadowPN);
}
|
Fairly/opencor
|
src/plugins/thirdParty/LLVM/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
|
C++
|
apache-2.0
| 60,864
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.cloudml.zen.ml.neuralNetwork
import java.util.Random
import breeze.linalg.{Axis => brzAxis, DenseMatrix => BDM, DenseVector => BDV, max => brzMax, sum => brzSum}
import NNUtil._
import com.github.cloudml.zen.ml.util.Logging
private[ml] trait Layer extends Serializable {
def weight: BDM[Double]
def bias: BDV[Double]
def numIn: Int = weight.cols
def numOut: Int = weight.rows
def layerType: String
protected lazy val rand: Random = new Random()
def setSeed(seed: Long): Unit = {
rand.setSeed(seed)
}
def forward(input: BDM[Double]): BDM[Double] = {
val batchSize = input.cols
val output: BDM[Double] = weight * input
for (i <- 0 until batchSize) {
output(::, i) :+= bias
}
computeNeuron(output)
output
}
def backward(input: BDM[Double], delta: BDM[Double]): (BDM[Double], BDV[Double]) = {
val gradWeight: BDM[Double] = delta * input.t
val gradBias = brzSum(delta, brzAxis._1)
(gradWeight, gradBias)
}
def outputError(output: BDM[Double], label: BDM[Double]): BDM[Double] = {
val delta: BDM[Double] = output - label
computeNeuronPrimitive(delta, output)
delta
}
def previousError(
input: BDM[Double],
previousLayer: Layer,
currentDelta: BDM[Double]): BDM[Double] = {
val preDelta = weight.t * currentDelta
previousLayer.computeNeuronPrimitive(preDelta, input)
preDelta
}
def computeNeuron(temp: BDM[Double]): Unit
def computeNeuronPrimitive(temp: BDM[Double], output: BDM[Double]): Unit
protected[ml] def sample(out: BDM[Double]): BDM[Double] = out
override def equals(other: Any): Boolean = other match {
case l: Layer =>
layerType == l.layerType && weight == l.weight && bias == l.bias
case _ =>
false
}
override def hashCode: Int = {
import com.google.common.base.Objects
Objects.hashCode(layerType, weight, bias)
}
}
private[ml] class SigmoidLayer(
val weight: BDM[Double],
val bias: BDV[Double]) extends Layer with Logging {
def this(numIn: Int, numOut: Int) {
this(initUniformDistWeight(numIn, numOut, 4D * math.sqrt(6D / (numIn + numOut))),
initializeBias(numOut))
}
override def layerType: String = "Sigmoid"
override def computeNeuron(temp: BDM[Double]): Unit = {
for (i <- 0 until temp.rows) {
for (j <- 0 until temp.cols) {
temp(i, j) = sigmoid(temp(i, j))
}
}
}
override def computeNeuronPrimitive(
temp: BDM[Double],
output: BDM[Double]): Unit = {
for (i <- 0 until temp.rows) {
for (j <- 0 until temp.cols) {
temp(i, j) = temp(i, j) * sigmoidPrimitive(output(i, j))
}
}
}
protected[ml] override def sample(input: BDM[Double]): BDM[Double] = {
input.map(v => if (rand.nextDouble() < v) 1D else 0D)
}
}
private[ml] class TanhLayer(
val weight: BDM[Double],
val bias: BDV[Double]) extends Layer with Logging {
def this(numIn: Int, numOut: Int) {
this(initUniformDistWeight(numIn, numOut, math.sqrt(6D / (numIn + numOut))),
initializeBias(numOut))
}
override def layerType: String = "Tanh"
override def computeNeuron(temp: BDM[Double]): Unit = {
for (i <- 0 until temp.rows) {
for (y <- 0 until temp.cols) {
temp(i, y) = tanh(temp(i, y))
}
}
}
def computeNeuronPrimitive(
temp: BDM[Double],
output: BDM[Double]): Unit = {
for (i <- 0 until temp.rows) {
for (y <- 0 until temp.cols) {
temp(i, y) = temp(i, y) * tanhPrimitive(output(i, y))
}
}
}
protected[ml] override def sample(input: BDM[Double]): BDM[Double] = {
input.map(v => if (rand.nextDouble() < v) 1D else 0D)
}
}
private[ml] class SoftMaxLayer(
val weight: BDM[Double],
val bias: BDV[Double]) extends Layer with Logging {
def this(numIn: Int, numOut: Int) {
this(initializeWeight(numIn, numOut), initializeBias(numOut))
}
override def layerType: String = "SoftMax"
override def computeNeuron(temp: BDM[Double]): Unit = {
val brzTemp = temp
for (col <- 0 until brzTemp.cols) {
softMax(brzTemp(::, col))
}
}
def softMax(temp: BDV[Double]): Unit = {
// val max = brzMax(temp)
var sum = 0D
for (i <- 0 until temp.length) {
// temp(i) = Math.exp(temp(i) - max)
temp(i) = Math.exp(temp(i))
sum += temp(i)
}
temp :/= sum
}
override def computeNeuronPrimitive(
temp: BDM[Double],
output: BDM[Double]): Unit = {
// See: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.49.6403
// for (i <- 0 until temp.numRows) {
// for (j <- 0 until temp.numCols) {
// temp(i, j) = temp(i, j) * softMaxPrimitive(output(i, j))
// }
// }
}
override protected[ml] def sample(out: BDM[Double]): BDM[Double] = {
val brzOut = out
for (j <- 0 until brzOut.cols) {
val v = brzOut(::, j)
var sum = 0D
var index = 0
var find = false
val s = rand.nextDouble()
while (!find && index < v.length) {
sum += v(index)
if (sum >= s) {
find = true
} else {
index += 1
}
}
v :*= 0D
index = if (find) index else index - 1
v(index) = 1
}
out
}
}
private[ml] class NoisyReLULayer(
val weight: BDM[Double],
val bias: BDV[Double]) extends Layer with Logging {
def this(numIn: Int, numOut: Int) {
this(initUniformDistWeight(numIn, numOut, 0D, 0.01),
initializeBias(numOut))
}
override def layerType: String = "NoisyReLU"
private def nReLu(tmp: BDM[Double]): Unit = {
for (i <- 0 until tmp.rows) {
for (j <- 0 until tmp.cols) {
val v = tmp(i, j)
val sd = sigmoid(v)
val x = v + sd * rand.nextGaussian()
tmp(i, j) = math.max(0, x)
}
}
}
override def computeNeuron(temp: BDM[Double]): Unit = {
nReLu(temp)
}
override def computeNeuronPrimitive(
temp: BDM[Double],
output: BDM[Double]): Unit = {
for (i <- 0 until temp.rows) {
for (j <- 0 until temp.cols)
if (output(i, j) <= 0) {
temp(i, j) = 0
}
}
}
}
private[ml] class ReLuLayer(
val weight: BDM[Double],
val bias: BDV[Double]) extends Layer with Logging {
def this(numIn: Int, numOut: Int) {
this(initUniformDistWeight(numIn, numOut, 0.0, 0.01),
initializeBias(numOut))
}
override def layerType: String = "ReLu"
private def relu(tmp: BDM[Double]): Unit = {
for (i <- 0 until tmp.rows) {
for (j <- 0 until tmp.cols) {
tmp(i, j) = math.max(0, tmp(i, j))
}
}
}
override def computeNeuron(temp: BDM[Double]): Unit = {
relu(temp)
}
override def computeNeuronPrimitive(temp: BDM[Double], output: BDM[Double]): Unit = {
for (i <- 0 until temp.rows) {
for (j <- 0 until temp.cols)
if (output(i, j) <= 0) {
temp(i, j) = 0
}
}
}
override protected[ml] def sample(input: BDM[Double]): BDM[Double] = {
input.map { v =>
val sd = sigmoid(v, 32)
val x = v + sd * rand.nextGaussian()
math.max(0, x)
}
}
}
private[ml] class SoftPlusLayer(
val weight: BDM[Double],
val bias: BDV[Double]) extends Layer with Logging {
def this(numIn: Int, numOut: Int) {
this(initUniformDistWeight(numIn, numOut, 0D, 0.01),
initializeBias(numOut))
}
override def layerType: String = "SoftPlus"
override def computeNeuron(temp: BDM[Double]): Unit = {
for (i <- 0 until temp.rows) {
for (j <- 0 until temp.cols) {
temp(i, j) = softplus(temp(i, j))
}
}
}
override def computeNeuronPrimitive(temp: BDM[Double], output: BDM[Double]): Unit = {
for (i <- 0 until temp.rows) {
for (j <- 0 until temp.cols) {
temp(i, j) *= softplusPrimitive(output(i, j))
}
}
}
override protected[ml] def sample(input: BDM[Double]): BDM[Double] = {
input.map { v =>
val sd = sigmoid(v)
val x = v + sd * rand.nextGaussian()
// val rng = new NormalDistribution(rand, 0, sd + 1e-23, 1e-9)
// val x = v + rng.sample()
math.max(0, x)
}
}
}
private[ml] class IdentityLayer(
val weight: BDM[Double],
val bias: BDV[Double]) extends Layer with Logging {
def this(numIn: Int, numOut: Int) {
this(initUniformDistWeight(numIn, numOut, 0D, 0.01),
initializeBias(numOut))
}
override def layerType: String = "Identity"
override def computeNeuron(tmp: BDM[Double]): Unit = {}
override def computeNeuronPrimitive(temp: BDM[Double], output: BDM[Double]): Unit = {}
override protected[ml] def sample(input: BDM[Double]): BDM[Double] = {
input.map(v => v + rand.nextGaussian())
}
}
private[ml] object Layer {
def initializeLayer(weight: BDM[Double], bias: BDV[Double], layerType: String): Layer = {
layerType match {
case "SoftPlus" =>
new SoftPlusLayer(weight, bias)
case "ReLu" =>
new ReLuLayer(weight, bias)
case "NoisyReLU" =>
new NoisyReLULayer(weight, bias)
case "SoftMax" =>
new SoftMaxLayer(weight, bias)
case "Tanh" =>
new TanhLayer(weight, bias)
case "Sigmoid" =>
new SigmoidLayer(weight, bias)
case "Identity" =>
new IdentityLayer(weight, bias)
case _ =>
throw new IllegalArgumentException("layerType is not correct")
}
}
}
|
witgo/zen
|
ml/src/main/scala/com/github/cloudml/zen/ml/neuralNetwork/Layer.scala
|
Scala
|
apache-2.0
| 10,167
|
/*
* #%L
* SparkCommerce Framework
* %%
* Copyright (C) 2009 - 2013 Spark Commerce
* %%
* 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.
* #L%
*/
package org.sparkcommerce.core.order.service.manipulation;
import org.sparkcommerce.core.offer.service.discount.domain.PromotableOrderItem;
import org.sparkcommerce.core.order.domain.OrderItem;
import java.util.ArrayList;
import java.util.List;
public class OrderItemSplitContainer {
protected OrderItem key;
protected List<PromotableOrderItem> splitItems = new ArrayList<PromotableOrderItem>();
public OrderItem getKey() {
return key;
}
public void setKey(OrderItem key) {
this.key = key;
}
public List<PromotableOrderItem> getSplitItems() {
return splitItems;
}
public void setSplitItems(List<PromotableOrderItem> splitItems) {
this.splitItems = splitItems;
}
}
|
akdasari/SparkCore
|
spark-framework/src/main/java/org/sparkcommerce/core/order/service/manipulation/OrderItemSplitContainer.java
|
Java
|
apache-2.0
| 1,428
|
#pragma checksum "C:\Users\kkrok\documents\visual studio 2015\Projects\inzChatApp\inzChatApp\dolacz.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "6610DC8FD0898BC304E0799F78CF22F7"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace inzChatApp
{
partial class dolacz : global::Windows.UI.Xaml.Controls.Page
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks"," 14.0.0.0")]
private global::Windows.UI.Xaml.Controls.ListView lista;
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks"," 14.0.0.0")]
private bool _contentLoaded;
/// <summary>
/// InitializeComponent()
/// </summary>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks"," 14.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public void InitializeComponent()
{
if (_contentLoaded)
return;
_contentLoaded = true;
global::System.Uri resourceLocator = new global::System.Uri("ms-appx:///dolacz.xaml");
global::Windows.UI.Xaml.Application.LoadComponent(this, resourceLocator, global::Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);
}
}
}
|
panpingusiowy/CzaterV0.1.0
|
obj/x86/Release/dolacz.g.i.cs
|
C#
|
apache-2.0
| 1,719
|
---
copyright:
years: 2015,2016
---
{:new_window: target=_"blank"}
{:shortdesc: .shortdesc}
{:screen:.screen}
{:codeblock:.codeblock}
# Introduzione a {{site.data.keyword.iotrtinsights_full}}
{: #gettingstartedtemplate}
*Ultimo aggiornamento: 11 febbraio 2016*
Con {{site.data.keyword.iotrtinsights_full}} su Bluemix ({{site.data.keyword.iotrtinsights_short}}), puoi eseguire delle analisi sui dati in tempo reale dai tuoi dispositivi Internet delle cose (IoT) e avere informazioni approfondite sul loro stato di integrità e sullo stato complessivo delle tue operazioni.
{:shortdesc}
Prima di potere iniziare a usare {{site.data.keyword.iotrtinsights_short}} devi configurare il servizio {{site.data.keyword.iot_full}} ({{site.data.keyword.iot_short}}) per connettere il tuo motore di analisi ai tuoi dispositivi. Puoi utilizzare un servizio {{site.data.keyword.iot_short}} oppure crearne uno nuovo. Per essere rapidamente operativo, puoi distribuire l'applicazione telefonica Internet delle cose (IoT) e il suo servizio {{site.data.keyword.iot_short}} associato alla tua organizzazione.
Per essere rapidamente operativo con questo servizio, attieniti alla seguente procedura:
1. Distribuisci il servizio {{site.data.keyword.iotrtinsights_short}} alla tua organizzazione Bluemix.
1. Dal dashboard del tuo account Bluemix, fai clic su **Utilizza servizi o API**.
2. Individua la sezione Internet delle cose del catalogo servizi e seleziona **{{site.data.keyword.iotrtinsights_short}}**.
3. Nella pagina {{site.data.keyword.iotrtinsights_short}}, verifica le selezioni Aggiungi servizio:
- Spazio - verifica che stai distribuendo il servizio nello stesso spazio in cui hai distribuito il servizio {{site.data.keyword.iot_short}}.
- Applicazione - lascia senza binding.
- Nome servizio - facoltativamente, modifica il nome servizio in qualcosa facile da ricordare. Questo nome viene visualizzato nel tile di {{site.data.keyword.iotrtinsights_short}} IoT nel dashboard Bluemix.
- Piano selezionato - seleziona Gratuito oppure un piano di acquisto adatto per le tue esigenze.
> **Importante:** con il piano {{site.data.keyword.iotrtinsights_short}} gratuito, puoi distribuire solo una singola istanza del servizio per organizzazione.
4. Fai clic su **Utilizza** per distribuire {{site.data.keyword.iotrtinsights_short}} ai tuoi servizi Bluemix.
2. Facoltativo: utilizza il tuo telefono come un dispositivo IoT con {{site.data.keyword.iotrtinsights_short}} IoT.
Utilizza l'applicazione telefonica Internet delle cose (IoT) per configurare rapidamente il tuo smartphone perché funga da dispositivo IoT che puoi utilizzare per verificare il
tuo ambiente {{site.data.keyword.iotrtinsights_short}} e iniziare a definire un'analisi in tempo reale sui dati. Per ulteriori informazioni sull'applicazione telefonica Internet delle cose (IoT), vedi il progetto relativo all'[applicazione telefonica Internet delle cose (IoT)](https://github.com/ibm-messaging/IoT-html5-phone).
Per creare l'applicazione e connettere il tuo telefono a {{site.data.keyword.iot_full}}:
1. Fai clic sul pulsante in basso per avviare il processo di distribuzione:
[(images/deploy_to_bluemix.png "Icona Distribuisci a Bluemix")]
> **Nota:** la distribuzione dell'applicazione telefonica Internet delle cose (IoT) distribuisce anche un servizio {{site.data.keyword.iot_short}} (*iot-phone-iotf-service*) che si associa automaticamente all'applicazione telefonica. Aggiungi questo {{site.data.keyword.iot_short}} come un'origine dati per testare l'applicazione telefonica Internet delle cose (IoT). Crea anche un servizio Cloudant NoSQL DB (*iot-phone-cloudant-cloudantNoSQLDB*) che viene utilizzato dall'applicazione.
2. Fai clic su **Approva** se ti viene richiesto di autoapprovare l'accesso per il servizio IBM Single Sign On Service (OAuth Consent).
>**Suggerimento:** se non hai un account Bluemix, puoi registrati per attivare la tua versione di prova di Bluemix.
2. Modifica il campo NOME APPLICAZIONE in qualcosa facile da ricordare; lo indicheremo come *applicazione telefonica* nel resto di queste istruzioni. Questo nome sarà visualizzato in un tile di applicazione nel tuo dashboard Bluemix e fa parte dell'URL che utilizzerai quando connetterai il tuo telefono a {{site.data.keyword.iot_short}}.
2. Fai clic su **Distribuisci**.
2. Dopo che il processo di distribuzione è stato completato ed è stato presentato un messaggio che indica che l'operazione ha avuto esito positivo, torna al tuo dashboard Bluemix.
Il tile *applicazione telefonica* e il tile *iot-phone-iotf-service* sono aggiunti al tuo account.
1. Dal dashboard Bluemix, fai clic sul tile *applicazione telefonica*.
2. Dal tuo telefono, apri un browser e vai all'URL rotte visualizzato sotto il nome applicazione. Quando ti viene richiesto, immetti un ID dispositivo a tua scelta per identificare il tuo telefono come un dispositivo nei dashboard {{site.data.keyword.iot_short}} e {{site.data.keyword.iotrtinsights_short}} IoT.
3. Fai clic su **Connetti** per connettere l tuo telefono a {{site.data.keyword.iot_short}} *iot-phone-iotf-service*.
Questa vista viene aggiornata per visualizzare i dati inviati dal tuo telefono al tuo {{site.data.keyword.iot_short}}.
2. Crea e configura un servizio Internet delle cose (IoT).
> **Suggerimento:** se hai distribuito l'applicazione telefonica Internet delle cose (IoT), *iot-phone-iotf-service* è già stato creato e puoi tralasciare questo passo.
1. Accedi all'organizzazione Bluemix e seleziona lo spazio dove desideri distribuire {{site.data.keyword.iotrtinsights_short}}IoT.
2. Dal dashboard Bluemix, fai clic su **Utilizza servizi o API**.
3. Individua la sezione Internet delle cose del catalogo servizi e seleziona **Internet delle cose**.
4. Nella pagina {{site.data.keyword.iot_full}}, verifica le selezioni Aggiungi servizio e fai clic su **Utilizza** per aggiungere {{site.data.keyword.iot_short}} ai tuoi servizi Bluemix.
Dopo che il servizio {{site.data.keyword.iot_short}} è stato distribuito, vieni indirizzato alla pagina di gestione dei servizi.
3. Individua le chiavi API di connessione.
Se hai creato un nuovo servizio {{site.data.keyword.iot_short}}, devi ora creare le chiavi API per connettere i due servizi. Se stai utilizzando un servizio esistente, puoi utilizzare le chiavi esistenti.
1. Dal dashboard Bluemix, fai clic sul tile Internet delle cose.
>**Nota:** se stati utilizzando l'applicazione telefonica Internet delle cose (IoT), fai clic sul tile *iot-phone-iotf-service*.
1. Fai clic su **Avvia dashboard** per aprire il dashboard {{site.data.keyword.iot_full}}.
2. Passa a **Accedi > Chiavi API**.
3. Fai clic su **Genera chiave API**.
3. Annota la chiave API, il token di autenticazione e l'ID organizzazione visualizzati nella parte superiore del dashboard {{site.data.keyword.iot_short}}. Utilizzerai tali informazioni in {{site.data.keyword.iotrtinsights_short}} IoT per connettere i servizi.
4. Connetti il tuo servizio {{site.data.keyword.iot_short}} e il servizio {{site.data.keyword.iotrtinsights_short}} IoT.
1. Dal dashboard Bluemix, fai clic sul tile {{site.data.keyword.iotrtinsights_short}} IoT.
2. Nella pagina del servizio, fai clic su **Aggiungi una origine dati**.
2. Nella pagina Gestisci origini dati della console {{site.data.keyword.iotrtinsights_short}}, fai clic su **Aggiungi nuova origine dati**.
3. Dai un nome descrittivo all'origine dati e fornisci le seguenti informazioni che avevi raccolto in precedenza:
- ID organizzazione
- Chiave API
- Token di autenticazione
4. Fai clic su  per creare l'origine dati e connetterti a essa.
4. Inizia usando {{site.data.keyword.iotrtinsights_short}}.
Puoi ora iniziare a usare {{site.data.keyword.iotrtinsights_short}} aggiungendo utenti, connettendo i tuoi dispositivi, configurando i dashboard per visualizzare i dati dispositivo pertinenti e impostando avvisi.
>**Selezionando la tua istanza di {{site.data.keyword.iotrtinsights_short}}:** se ti è stato concesso l'accesso ad eventuali istanze di {{site.data.keyword.iotrtinsights_short}} aggiuntive come un operatore o un amministratore, puoi rapidamente passare dall'una all'altra di tali istanze. Nella console {{site.data.keyword.iotrtinsights_short}}, fai clic sul tuo nome utente e seleziona l'istanza a cui vuoi accedere.
# link correlati
## esempi
* [Applicazione telefonica Internet delle cose (IoT)](https://github.com/ibm-messaging/IoT-html5-phone)
* [Ricette Internet delle cose developerWorks](https://developer.ibm.com/recipes/)
* [Creazione di applicazioni con l'applicazione starter Internet delle cose](https://www.ng.bluemix.net/docs/starters/IoT/iot500.html#iot500)
## api
* [Documentazione API](https://iotrti-prod.mam.ibmserviceengage.com/apidoc/)
## generale
* [Informazioni su](iotrtinsights_overview.html)
* [Novità nei servizi Bluemix](http://www.ng.bluemix.net/docs/whatsnew/index.html#services_category)
* [Introduzione a {{site.data.keyword.iot_full}}](https://www.ng.bluemix.net/docs/services/IoT/index.html)
* [Risposte dW su IBM developerWorks](https://developer.ibm.com/answers/topics/iot-real-time/)
|
jergirl/MCAProd
|
services/nl/it/iotrtinsights/index.md
|
Markdown
|
apache-2.0
| 9,429
|
/**
* @license Copyright 2017 The Lighthouse 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.
*/
'use strict';
/**
* @fileoverview Ensures <img> elements have alternate text or a role of none or presentation.
* See base class in axe-audit.js for audit() implementation.
*/
const AxeAudit = require('./axe-audit.js');
const i18n = require('../../lib/i18n/i18n.js');
const UIStrings = {
/** Title of an accesibility audit that evaluates if all image elements have the alt HTML attribute to describe their contents. This title is descriptive of the successful state and is shown to users when no user action is required. */
title: 'Image elements have `[alt]` attributes',
/** Title of an accesibility audit that evaluates if all image elements have the alt HTML attribute to describe their contents. This title is descriptive of the failing state and is shown to users when there is a failure that needs to be addressed. */
failureTitle: 'Image elements do not have `[alt]` attributes',
/** Description of a Lighthouse audit that tells the user *why* they should try to pass. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
description: 'Informative elements should aim for short, descriptive alternate text. ' +
'Decorative elements can be ignored with an empty alt attribute. ' +
'[Learn more](https://web.dev/image-alt/).',
};
const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);
class ImageAlt extends AxeAudit {
/**
* @return {LH.Audit.Meta}
*/
static get meta() {
return {
id: 'image-alt',
title: str_(UIStrings.title),
failureTitle: str_(UIStrings.failureTitle),
description: str_(UIStrings.description),
requiredArtifacts: ['Accessibility'],
};
}
}
module.exports = ImageAlt;
module.exports.UIStrings = UIStrings;
|
GoogleChrome/lighthouse
|
lighthouse-core/audits/accessibility/image-alt.js
|
JavaScript
|
apache-2.0
| 2,432
|
/**
* Copyright 2008 Matthew Hillsdon
*
* 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 net.hillsdon.reviki.vc.impl;
import java.io.InputStream;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import net.hillsdon.reviki.vc.AttachmentHistory;
import net.hillsdon.reviki.vc.ChangeInfo;
import net.hillsdon.reviki.vc.ContentTypedSink;
import net.hillsdon.reviki.vc.InterveningCommitException;
import net.hillsdon.reviki.vc.PageInfo;
import net.hillsdon.reviki.vc.SimpleAttachmentHistory;
import net.hillsdon.reviki.vc.VersionedPageInfo;
import net.hillsdon.reviki.vc.PageReference;
import net.hillsdon.reviki.vc.PageStore;
import net.hillsdon.reviki.vc.PageStoreAuthenticationException;
import net.hillsdon.reviki.vc.PageStoreException;
import net.hillsdon.reviki.vc.PageStoreInvalidException;
/**
* Delegates all functionality to given delegate. Subclass to alter behaviour.
*
* @author mth
*/
public abstract class AbstractDelegatingPageStore extends AbstractPageStore {
/**
* @return The delegate to use. This is called for each delegation.
*/
protected abstract PageStore getDelegate();
/**
* With bonus null check.
*
* @return The page store.
*/
private PageStore getDelegateInternal() {
PageStore delegate = getDelegate();
if (delegate == null) {
throw new IllegalStateException("No delegate available!");
}
return delegate;
}
public VersionedPageInfo get(final PageReference ref, final long revision) throws PageStoreException {
return getDelegateInternal().get(ref, revision);
}
public Set<PageReference> list() throws PageStoreException {
return getDelegateInternal().list();
}
public List<ChangeInfo> recentChanges(final long limit) throws PageStoreException {
return getDelegateInternal().recentChanges(limit);
}
public long set(final PageInfo page, final String lockToken, final long baseRevision, final String commitMessage) throws InterveningCommitException, PageStoreException {
return getDelegateInternal().set(page, lockToken, baseRevision, commitMessage);
}
public long deleteAttachment(PageReference ref, String attachmentName, long baseRevision, String commitMessage) throws PageStoreAuthenticationException, PageStoreException {
return getDelegateInternal().deleteAttachment(ref, attachmentName, baseRevision, commitMessage);
}
public VersionedPageInfo tryToLock(final PageReference ref) throws PageStoreException {
return getDelegateInternal().tryToLock(ref);
}
public void unlock(final PageReference ref, final String lockToken) throws PageStoreException {
getDelegateInternal().unlock(ref, lockToken);
}
public List<ChangeInfo> history(final PageReference ref) throws PageStoreException {
return getDelegateInternal().history(ref);
}
public void attach(final PageReference page, final String storeName, final long baseRevision, final InputStream in, final String commitMessage) throws PageStoreException {
getDelegateInternal().attach(page, storeName, baseRevision, in, commitMessage);
}
public Collection<? extends SimpleAttachmentHistory> listAttachments(final PageReference ref) throws PageStoreException {
return getDelegateInternal().listAttachments(ref);
}
public Collection<AttachmentHistory> attachments(final PageReference ref) throws PageStoreException {
return getDelegateInternal().attachments(ref);
}
public void attachment(final PageReference ref, final String attachment, final long revision, final ContentTypedSink sink) throws PageStoreException {
getDelegateInternal().attachment(ref, attachment, revision, sink);
}
public byte[] attachmentBytes(final PageReference ref, final String attachment, final long revision) throws PageStoreException {
return getDelegateInternal().attachmentBytes(ref, attachment, revision);
}
public Collection<PageReference> getChangedBetween(final long start, final long end) throws PageStoreException {
return getDelegateInternal().getChangedBetween(start, end);
}
public long getLatestRevision() throws PageStoreAuthenticationException, PageStoreException {
return getDelegateInternal().getLatestRevision();
}
public long copy(final PageReference from, final long fromRevision, final PageReference to, final String commitMessage) throws PageStoreException {
return getDelegateInternal().copy(from, fromRevision, to, commitMessage);
}
public long rename(final PageReference from, final PageReference to, final long baseRevision, final String commitMessage) throws InterveningCommitException, PageStoreException {
return getDelegateInternal().rename(from, to, baseRevision, commitMessage);
}
public void assertValid() throws PageStoreInvalidException, PageStoreAuthenticationException {
getDelegateInternal().assertValid();
}
public String getWiki() throws PageStoreException {
return getDelegateInternal().getWiki();
}
public Collection<PageInfo> getPages(final Collection<PageReference> paths, final long revision) throws PageStoreException {
return getDelegateInternal().getPages(paths, revision);
}
}
|
CoreFiling/reviki
|
wiki-src/net/hillsdon/reviki/vc/impl/AbstractDelegatingPageStore.java
|
Java
|
apache-2.0
| 5,668
|
/*
* Copyright 2015 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.gradle.api.internal.plugins;
import org.gradle.util.internal.TextUtil;
public class WindowsStartScriptGenerator extends DefaultTemplateBasedStartScriptGenerator {
public WindowsStartScriptGenerator() {
super(
TextUtil.getWindowsLineSeparator(),
StartScriptTemplateBindingFactory.windows(),
utf8ClassPathResource(UnixStartScriptGenerator.class, "windowsStartScript.txt")
);
}
}
|
gradle/gradle
|
subprojects/plugins/src/main/java/org/gradle/api/internal/plugins/WindowsStartScriptGenerator.java
|
Java
|
apache-2.0
| 1,080
|
/*
* Copyright 2010-2016 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.
*/
package com.amazonaws.services.elasticbeanstalk.model;
import java.io.Serializable;
/**
* <p>
* Describes the properties of an application version.
* </p>
*/
public class ApplicationVersionDescription implements Serializable, Cloneable {
/**
* <p>
* The name of the application associated with this release.
* </p>
*/
private String applicationName;
/**
* <p>
* The description of this application version.
* </p>
*/
private String description;
/**
* <p>
* A label uniquely identifying the version for the associated application.
* </p>
*/
private String versionLabel;
/**
* <p>
* The location where the source bundle is located for this version.
* </p>
*/
private S3Location sourceBundle;
/**
* <p>
* The creation date of the application version.
* </p>
*/
private java.util.Date dateCreated;
/**
* <p>
* The last modified date of the application version.
* </p>
*/
private java.util.Date dateUpdated;
/**
* <p>
* The processing status of the application version.
* </p>
*/
private String status;
/**
* <p>
* The name of the application associated with this release.
* </p>
*
* @param applicationName
* The name of the application associated with this release.
*/
public void setApplicationName(String applicationName) {
this.applicationName = applicationName;
}
/**
* <p>
* The name of the application associated with this release.
* </p>
*
* @return The name of the application associated with this release.
*/
public String getApplicationName() {
return this.applicationName;
}
/**
* <p>
* The name of the application associated with this release.
* </p>
*
* @param applicationName
* The name of the application associated with this release.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public ApplicationVersionDescription withApplicationName(
String applicationName) {
setApplicationName(applicationName);
return this;
}
/**
* <p>
* The description of this application version.
* </p>
*
* @param description
* The description of this application version.
*/
public void setDescription(String description) {
this.description = description;
}
/**
* <p>
* The description of this application version.
* </p>
*
* @return The description of this application version.
*/
public String getDescription() {
return this.description;
}
/**
* <p>
* The description of this application version.
* </p>
*
* @param description
* The description of this application version.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public ApplicationVersionDescription withDescription(String description) {
setDescription(description);
return this;
}
/**
* <p>
* A label uniquely identifying the version for the associated application.
* </p>
*
* @param versionLabel
* A label uniquely identifying the version for the associated
* application.
*/
public void setVersionLabel(String versionLabel) {
this.versionLabel = versionLabel;
}
/**
* <p>
* A label uniquely identifying the version for the associated application.
* </p>
*
* @return A label uniquely identifying the version for the associated
* application.
*/
public String getVersionLabel() {
return this.versionLabel;
}
/**
* <p>
* A label uniquely identifying the version for the associated application.
* </p>
*
* @param versionLabel
* A label uniquely identifying the version for the associated
* application.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public ApplicationVersionDescription withVersionLabel(String versionLabel) {
setVersionLabel(versionLabel);
return this;
}
/**
* <p>
* The location where the source bundle is located for this version.
* </p>
*
* @param sourceBundle
* The location where the source bundle is located for this version.
*/
public void setSourceBundle(S3Location sourceBundle) {
this.sourceBundle = sourceBundle;
}
/**
* <p>
* The location where the source bundle is located for this version.
* </p>
*
* @return The location where the source bundle is located for this version.
*/
public S3Location getSourceBundle() {
return this.sourceBundle;
}
/**
* <p>
* The location where the source bundle is located for this version.
* </p>
*
* @param sourceBundle
* The location where the source bundle is located for this version.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public ApplicationVersionDescription withSourceBundle(
S3Location sourceBundle) {
setSourceBundle(sourceBundle);
return this;
}
/**
* <p>
* The creation date of the application version.
* </p>
*
* @param dateCreated
* The creation date of the application version.
*/
public void setDateCreated(java.util.Date dateCreated) {
this.dateCreated = dateCreated;
}
/**
* <p>
* The creation date of the application version.
* </p>
*
* @return The creation date of the application version.
*/
public java.util.Date getDateCreated() {
return this.dateCreated;
}
/**
* <p>
* The creation date of the application version.
* </p>
*
* @param dateCreated
* The creation date of the application version.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public ApplicationVersionDescription withDateCreated(
java.util.Date dateCreated) {
setDateCreated(dateCreated);
return this;
}
/**
* <p>
* The last modified date of the application version.
* </p>
*
* @param dateUpdated
* The last modified date of the application version.
*/
public void setDateUpdated(java.util.Date dateUpdated) {
this.dateUpdated = dateUpdated;
}
/**
* <p>
* The last modified date of the application version.
* </p>
*
* @return The last modified date of the application version.
*/
public java.util.Date getDateUpdated() {
return this.dateUpdated;
}
/**
* <p>
* The last modified date of the application version.
* </p>
*
* @param dateUpdated
* The last modified date of the application version.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public ApplicationVersionDescription withDateUpdated(
java.util.Date dateUpdated) {
setDateUpdated(dateUpdated);
return this;
}
/**
* <p>
* The processing status of the application version.
* </p>
*
* @param status
* The processing status of the application version.
* @see ApplicationVersionStatus
*/
public void setStatus(String status) {
this.status = status;
}
/**
* <p>
* The processing status of the application version.
* </p>
*
* @return The processing status of the application version.
* @see ApplicationVersionStatus
*/
public String getStatus() {
return this.status;
}
/**
* <p>
* The processing status of the application version.
* </p>
*
* @param status
* The processing status of the application version.
* @return Returns a reference to this object so that method calls can be
* chained together.
* @see ApplicationVersionStatus
*/
public ApplicationVersionDescription withStatus(String status) {
setStatus(status);
return this;
}
/**
* <p>
* The processing status of the application version.
* </p>
*
* @param status
* The processing status of the application version.
* @see ApplicationVersionStatus
*/
public void setStatus(ApplicationVersionStatus status) {
this.status = status.toString();
}
/**
* <p>
* The processing status of the application version.
* </p>
*
* @param status
* The processing status of the application version.
* @return Returns a reference to this object so that method calls can be
* chained together.
* @see ApplicationVersionStatus
*/
public ApplicationVersionDescription withStatus(
ApplicationVersionStatus status) {
setStatus(status);
return this;
}
/**
* Returns a string representation of this object; useful for testing and
* debugging.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getApplicationName() != null)
sb.append("ApplicationName: " + getApplicationName() + ",");
if (getDescription() != null)
sb.append("Description: " + getDescription() + ",");
if (getVersionLabel() != null)
sb.append("VersionLabel: " + getVersionLabel() + ",");
if (getSourceBundle() != null)
sb.append("SourceBundle: " + getSourceBundle() + ",");
if (getDateCreated() != null)
sb.append("DateCreated: " + getDateCreated() + ",");
if (getDateUpdated() != null)
sb.append("DateUpdated: " + getDateUpdated() + ",");
if (getStatus() != null)
sb.append("Status: " + getStatus());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof ApplicationVersionDescription == false)
return false;
ApplicationVersionDescription other = (ApplicationVersionDescription) obj;
if (other.getApplicationName() == null
^ this.getApplicationName() == null)
return false;
if (other.getApplicationName() != null
&& other.getApplicationName().equals(this.getApplicationName()) == false)
return false;
if (other.getDescription() == null ^ this.getDescription() == null)
return false;
if (other.getDescription() != null
&& other.getDescription().equals(this.getDescription()) == false)
return false;
if (other.getVersionLabel() == null ^ this.getVersionLabel() == null)
return false;
if (other.getVersionLabel() != null
&& other.getVersionLabel().equals(this.getVersionLabel()) == false)
return false;
if (other.getSourceBundle() == null ^ this.getSourceBundle() == null)
return false;
if (other.getSourceBundle() != null
&& other.getSourceBundle().equals(this.getSourceBundle()) == false)
return false;
if (other.getDateCreated() == null ^ this.getDateCreated() == null)
return false;
if (other.getDateCreated() != null
&& other.getDateCreated().equals(this.getDateCreated()) == false)
return false;
if (other.getDateUpdated() == null ^ this.getDateUpdated() == null)
return false;
if (other.getDateUpdated() != null
&& other.getDateUpdated().equals(this.getDateUpdated()) == false)
return false;
if (other.getStatus() == null ^ this.getStatus() == null)
return false;
if (other.getStatus() != null
&& other.getStatus().equals(this.getStatus()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime
* hashCode
+ ((getApplicationName() == null) ? 0 : getApplicationName()
.hashCode());
hashCode = prime
* hashCode
+ ((getDescription() == null) ? 0 : getDescription().hashCode());
hashCode = prime
* hashCode
+ ((getVersionLabel() == null) ? 0 : getVersionLabel()
.hashCode());
hashCode = prime
* hashCode
+ ((getSourceBundle() == null) ? 0 : getSourceBundle()
.hashCode());
hashCode = prime
* hashCode
+ ((getDateCreated() == null) ? 0 : getDateCreated().hashCode());
hashCode = prime
* hashCode
+ ((getDateUpdated() == null) ? 0 : getDateUpdated().hashCode());
hashCode = prime * hashCode
+ ((getStatus() == null) ? 0 : getStatus().hashCode());
return hashCode;
}
@Override
public ApplicationVersionDescription clone() {
try {
return (ApplicationVersionDescription) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException(
"Got a CloneNotSupportedException from Object.clone() "
+ "even though we're Cloneable!", e);
}
}
}
|
flofreud/aws-sdk-java
|
aws-java-sdk-elasticbeanstalk/src/main/java/com/amazonaws/services/elasticbeanstalk/model/ApplicationVersionDescription.java
|
Java
|
apache-2.0
| 14,874
|
/*
* -----------------------------------------------------------------------\
* SilverWare
*
* Copyright (C) 2010 - 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 io.silverware.demos.devconf.mqtt;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
/**
* These routes wire the individual components together. Actions go to actions topic, then to business rules engine (Drools), resulting commands go to the
* commands queue. Also, Drools can send status updates to the mobile phone. Weather sensor is periodically checked (pull model) and the corresponding actions
* are placed in the actions topic.
*
* @author <a href="mailto:marvenec@gmail.com">Martin Večeřa</a>
*/
public class IntegrationRoutes extends RouteBuilder {
@Override
public void configure() throws Exception {
final String iotHost = System.getProperty("iot.host", "10.40.2.210:8282");
final String iotMqttHost = System.getProperty("iot.mqtt.host", "10.40.2.210:1883");
final String mqttHost = System.getProperty("mqtt.host", "10.40.3.60:1883");
final String mobileHost = System.getProperty("mobile.host", "0.0.0.0:8283");
// First, we need to start consumers from "direct" to avoid warnings while Camel processes exchange
// creates a new action
from("direct:actions").marshal().serialization().to("mqtt:outActions?publishTopicName=ih/message/actions&userName=mqtt&password=mqtt&host=tcp://" + mqttHost);
// creates a new command
from("direct:commands").marshal().serialization().to("mqtt:outCommands?publishTopicName=ih/message/commands&userName=mqtt&password=mqtt&host=tcp://" + mqttHost);
// sends an update message to the mobile phone
from("direct:mobile").to("mqtt:outMobile?publishTopicName=ih/message/mobile&userName=mqtt&password=mqtt&host=tcp://" + mqttHost);
// process weather
from("direct:weather").bean("weatherMicroservice", "processWeather");
// process rfid
from("direct:rfid").bean("weatherMicroservice", "processRfid");
// expose REST API for the mobile phone to be able to send actions
from("jetty:http://" + mobileHost + "/mobile").setBody().simple("${in.header.button}").bean("mobileGatewayMicroservice", "mobileAction");
// periodically check Intelligent Home's REST interface to obtain weather status, process the status as an action
//from("timer://foo?period=5000").setHeader(Exchange.HTTP_METHOD, constant("GET")).to("jetty:http://" + iotHost + "/sensorData").to("direct:weather");
// comment out the previous route and enable the following one for debugging purposes
// from("timer://foo?period=5000").setBody().constant("{ \"temperature\" : 23, \"humidity\" : 42, ").to("direct:weather");
// Append the following to the previous route to get debug output
// .setBody().simple("Weather: ${body}").to("stream:out");
// process actions in Drools
from("mqtt:inActions?subscribeTopicName=ih/message/actions&userName=mqtt&password=mqtt&host=tcp://" + mqttHost).unmarshal().serialization().bean("droolsMicroservice", "processAction");
// read weather from a topic deployed in the home
from("mqtt:inWeather?subscribeTopicName=ih/message/weather&userName=mqtt&password=mqtt&host=tcp://" + iotMqttHost).to("direct:weather");
// read RFID tags from a topic deployed in the home
from("mqtt:inRfid?subscribeTopicName=ih/message/rfidTags&userName=mqtt&password=mqtt&host=tcp://" + iotMqttHost).to("direct:rfid");
}
}
|
px3/SilverWare-Demos
|
demos/devconf-2016/gateway/app/src/main/java/io/silverware/demos/devconf/mqtt/IntegrationRoutes.java
|
Java
|
apache-2.0
| 4,183
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ignite.testsuites;
import junit.framework.TestSuite;
import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsContinuousRestartTestWithSharedGroupAndIndexes;
import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsRecoveryAfterFileCorruptionTest;
import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsTaskCancelingTest;
import org.apache.ignite.internal.processors.cache.persistence.db.IgnitePdsPageEvictionDuringPartitionClearTest;
import org.apache.ignite.internal.processors.cache.persistence.db.IgnitePdsTransactionsHangTest;
import org.apache.ignite.internal.processors.cache.persistence.file.FileDownloaderTest;
/**
*
*/
public class IgnitePdsTestSuite4 extends TestSuite {
/**
* @return Suite.
*/
public static TestSuite suite() {
TestSuite suite = new TestSuite("Ignite Persistent Store Test Suite 4");
addRealPageStoreTestsNotForDirectIo(suite);
suite.addTestSuite(FileDownloaderTest.class);
suite.addTestSuite(IgnitePdsTaskCancelingTest.class);
return suite;
}
/**
* Fills {@code suite} with PDS test subset, which operates with real page store, but requires long time to execute.
*
* @param suite suite to add tests into.
*/
private static void addRealPageStoreTestsNotForDirectIo(TestSuite suite) {
suite.addTestSuite(IgnitePdsTransactionsHangTest.class);
suite.addTestSuite(IgnitePdsPageEvictionDuringPartitionClearTest.class);
// Rebalancing test
suite.addTestSuite(IgnitePdsContinuousRestartTestWithSharedGroupAndIndexes.class);
// Integrity test.
suite.addTestSuite(IgnitePdsRecoveryAfterFileCorruptionTest.class);
}
}
|
alexzaitzev/ignite
|
modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite4.java
|
Java
|
apache-2.0
| 2,561
|
/*
* Copyright 2015 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.guvnor.m2repo.utils;
/**
* Utilities to validate file being uploaded to Guvnor's M2 Repository
*/
public class FileNameUtilities {
private FileNameUtilities() {
}
/**
* Is the file valid; i.e. either a JAR, KJAR or pom.xml file.
* @param fileName
* @return true if the file is either a JAR, KJAR or pom.xml file.
*/
public static boolean isValid(final String fileName) {
return isJar(fileName) || isKJar(fileName) || isPom(fileName);
}
/**
* Is the file a JAR file. File names ending with ".jar" are considered valid JAR files.
* @param fileName
* @return true if the file is a JAR file
*/
public static boolean isJar(final String fileName) {
return endsWith(fileName,
".jar");
}
/**
* Is the file a KJAR file. File names ending with ".kjar" are considered valid KJAR files.
* It should be noted KJAR is not a recognised file extension; however it appears some Users
* are confusing talk of KJARS in Drools' documentation with a file extension and therefore,
* in the absence of any clarification from the Drools Core developers, we include such suffix.
* See https://bugzilla.redhat.com/show_bug.cgi?id=1201154 for examples.
* @param fileName
* @return true if the file is a KJAR file
*/
public static boolean isKJar(final String fileName) {
return endsWith(fileName,
".kjar");
}
/**
* Is the file a pom.xml file
* @param fileName
* @return true if the file is a pom.xml file
*/
public static boolean isPom(final String fileName) {
return endsWith(fileName,
"pom.xml");
}
/**
* Returns whether or not the provided path points to a .pom file.
* @param path path to the file
* @return true if the path points to a .pom file, otherwise false.
*/
public static boolean isDeployedPom(final String path) {
return endsWith(path,
".pom");
}
/**
* Returns whether or not the provided path ends in the provided suffix.
* @param path path to the file
* @param suffix the suffix to check
* @return true if the path ends in the provided suffix, otherwise false.
*/
private static boolean endsWith(final String path,
final String suffix) {
return path != null && !path.trim().isEmpty() && path.toLowerCase().endsWith(suffix);
}
}
|
karreiro/uberfire
|
uberfire-m2repo-editor/uberfire-m2repo-editor-api/src/main/java/org/guvnor/m2repo/utils/FileNameUtilities.java
|
Java
|
apache-2.0
| 3,166
|
<?php
namespace Phine\Phar\Tests;
use Phine\Phar\File\Reader;
use Phine\Phar\Signature;
use Phine\Phar\Signature\Algorithm\AlgorithmInterface;
use Phine\Phar\Signature\Algorithm\SHA1;
use Phine\Phar\Test\Algorithm;
use Phine\Test\Property;
use Phine\Test\Temp;
use PHPUnit_Framework_TestCase as TestCase;
/**
* Tests the methods in the {@link Signature} class.
*
* @author Kevin Herrera <kevin@herrera.io>
*/
class SignatureTest extends TestCase
{
/**
* The test file being read.
*
* @var string
*/
private $file;
/**
* The actual signature hash.
*
* @var string
*/
private $hash;
/**
* The signature instance being tested.
*
* @var Signature
*/
private $signature;
/**
* The temporary file manager.
*
* @var Temp
*/
private $temp;
/**
* Make sure we can add an algorithm to use.
*/
public function testAddAlgorithm()
{
$algorithm = new SHA1();
$this->signature->addAlgorithm($algorithm);
$algorithms = Property::get($this->signature, 'algorithms');
$this->assertSame(
$algorithm,
$algorithms[spl_object_hash($algorithm)],
'Make sure the algorithm is added.'
);
}
/**
* Make sure that we can create an instance of Signature. We should be
* able to use a string file path or instance of Reader, and all included
* algorithms should be registered.
*/
public function testCreate()
{
$signature = Signature::create($this->file);
/** @var AlgorithmInterface[] $algorithms */
$algorithms = Property::get($signature, 'algorithms');
/** @var Reader $reader */
$reader = Property::get($signature, 'reader');
$this->assertEquals(
$this->file,
$reader->getFile(),
'Make sure we get back the file path we put in.'
);
$expected = array(
'Phine\\Phar\\Signature\\Algorithm\\MD5',
'Phine\\Phar\\Signature\\Algorithm\\SHA1',
'Phine\\Phar\\Signature\\Algorithm\\SHA256',
'Phine\\Phar\\Signature\\Algorithm\\SHA512',
);
if (extension_loaded('openssl')) {
$expected[] = 'Phine\\Phar\\Signature\\Algorithm\\OpenSSL';
}
foreach ($expected as $algorithm) {
$this->assertInstanceOf(
$algorithm,
array_shift($algorithms),
'Make sure the algorithm is registered.'
);
}
}
/**
* Make sure that we can the algorithm used for the signature.
*/
public function testGetAlgorithm()
{
$this->assertInstanceOf(
'Phine\\Phar\\Test\\Algorithm',
$this->signature->getAlgorithm(),
'Make sure the CRC32 algorithm is returned.'
);
}
/**
* Make sure an exception is thrown if the file is not signed.
*/
public function testGetAlgorithmNotSigned()
{
file_put_contents($this->file, 'This file is not signed.');
$this->setExpectedException(
'Phine\\Phar\\Exception\\SignatureException',
'The archive "' . $this->file . '" is not signed.'
);
$this->signature->getAlgorithm();
}
/**
* Make sure an exception is thrown if the algorithm is not recognized.
*/
public function testGetAlgorithmNotRecognized()
{
Property::set($this->signature, 'algorithms', array());
$this->setExpectedException(
'Phine\\Phar\\Exception\\SignatureException',
'The algorithm for the archive "' . $this->file . '" is not supported.'
);
$this->signature->getAlgorithm();
}
/**
* Make sure that we can read the signature from the archive.
*/
public function testGetHash()
{
$this->assertSame(
array(
'hash' => $this->hash,
'hash_type' => 'CRC32'
),
$this->signature->getHash(),
'Make sure we can read the signature.'
);
}
/**
* Make sure that we can verify the signature of the archive.
*/
public function testIsValid()
{
$this->assertTrue(
$this->signature->isValid(),
'Make sure the archive is verified.'
);
}
/**
* Creates a test file for reading and verifying.
*/
protected function setUp()
{
$this->temp = new Temp();
$this->file = $this->temp->createFile();
$this->hash = strtoupper(hash('crc32', 'This is the test content.'));
file_put_contents(
$this->file,
sprintf(
'%s%s%s%s',
'This is the test content.',
pack('H*', $this->hash),
pack('V', 0x11),
'GBMB'
)
);
$this->signature = new Signature(new Reader($this->file));
Property::set($this->signature, 'algorithms', array(new Algorithm()));
}
/**
* Creates the test file.
*/
protected function tearDown()
{
$this->temp->purgePaths();
}
}
|
milagro-docs/docs.milagro.io-english
|
vendor/phine/phar/src/tests/Phine/Phar/Tests/SignatureTest.php
|
PHP
|
apache-2.0
| 5,245
|
<?php
require ('core/init.php');
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="css/style.css" >
<title>Activate</title>
</head>
<body>
<div id="container">
<ul>
<li><a href="index.php">Home</a></li>
<li><a href="register.php">Register</a></li>
<li><a href="login.php">Login</a></li>
</ul>
<h1>Activate your account</h1>
<?php
if (isset($_GET['success']) === true && empty ($_GET['success']) === true) {
?>
<h3>Thank you, we've activated your account. You're free to log in!</h3>
<?php
} else if (isset ($_GET['email'], $_GET['email_code']) === true) {
$email =trim($_GET['email']);
$email_code =trim($_GET['email_code']);
if ($users->email_exists($email) === false) {
$errors[] = 'Sorry, we couldn\'t find that email address.';
} else if ($users->activate($email, $email_code) === false) {
$errors[] = 'Sorry, we couldn\'t activate your account.';
}
if(empty($errors) === false){
echo '<p>' . implode('</p><p>', $errors) . '</p>';
} else {
header('Location: activate.php?success');
exit();
}
} else {
header('Location: index.php');
exit();
}
?>
</div>
</body>
</html>
|
code-for-india/cfihacathon-rickshaw
|
cfihacathon-rickshaw/activate.php
|
PHP
|
apache-2.0
| 1,474
|
package com.alibaba.json.bvt.bug;
import junit.framework.TestCase;
import org.junit.Assert;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONType;
import com.alibaba.fastjson.serializer.SerializerFeature;
public class Issue101 extends TestCase {
public void test_for_issure() throws Exception {
VO vo = new VO();
vo.a = new Object();
vo.b = vo.a;
vo.c = vo.a;
String text = JSON.toJSONString(vo);
Assert.assertEquals("{\"a\":{},\"b\":{},\"c\":{}}", text);
}
@JSONType(serialzeFeatures=SerializerFeature.DisableCircularReferenceDetect)
public static class VO {
private Object a;
private Object b;
private Object c;
public Object getA() {
return a;
}
public void setA(Object a) {
this.a = a;
}
public Object getB() {
return b;
}
public void setB(Object b) {
this.b = b;
}
public Object getC() {
return c;
}
public void setC(Object c) {
this.c = c;
}
}
}
|
alibaba/fastjson
|
src/test/java/com/alibaba/json/bvt/bug/Issue101.java
|
Java
|
apache-2.0
| 1,163
|
+++
Title = "Baron Schwartz"
Twitter = "xaprb"
image = "baron-schwartz.jpg"
type = "speaker"
linktitle = "baron-schwartz"
+++
Baron Schwartz is the founder and CTO of VividCortex. He's a performance and scalability expert who participates in various database, open source, DevOps, and distributed systems communities. He has helped build and scale many large, high-traffic services for Fortune 1000 clients. He has written several books, including O'Reilly's best-selling *High Performance MySQL* and *DevOps for the Database*.
|
gomex/devopsdays-web
|
content/events/2019-chicago/speakers/baron-schwartz.md
|
Markdown
|
apache-2.0
| 530
|
/*
*
* Copyright 2019 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#import <GRPCClient/GRPCInterceptor.h>
#import <GRPCClient/GRPCTransport.h>
NS_ASSUME_NONNULL_BEGIN
/**
* Private interfaces of the transport registry.
*/
@interface GRPCTransportRegistry (Private)
/**
* Get a transport implementation's factory by its transport id. If the transport id was not
* registered with the registry, the default transport factory (core + secure) is returned. If the
* default transport does not exist, an exception is thrown.
*/
- (id<GRPCTransportFactory>)getTransportFactoryWithID:(GRPCTransportID)transportID;
@end
/**
* GRPCTransportManager is a helper class to forward messages between the last interceptor and the
* transport instance.
*
* All methods except the initializer of the class can only be called on the manager's dispatch
* queue. Since the manager's dispatch queue is the same as the transport's dispatch queue, it is
* also safe to call the manager's methods in the corresponding transport instance's methods that
* implement GRPCInterceptorInterface.
*
* When a transport instance is shutting down, it must call -shutDown method of its associated
* transport manager for proper clean-up.
*/
@interface GRPCTransportManager : NSObject<GRPCInterceptorInterface>
- (instancetype)initWithTransportID:(GRPCTransportID)transportID
previousInterceptor:(id<GRPCResponseHandler>)previousInterceptor;
/**
* Notify the manager that the transport has shut down and the manager should release references to
* its response handler and stop forwarding requests/responses.
*/
- (void)shutDown;
/** Forward initial metadata to the previous interceptor in the interceptor chain */
- (void)forwardPreviousInterceptorWithInitialMetadata:(nullable NSDictionary *)initialMetadata;
/** Forward a received message to the previous interceptor in the interceptor chain */
- (void)forwardPreviousInterceptorWithData:(nullable id)data;
/** Forward call close and trailing metadata to the previous interceptor in the interceptor chain */
- (void)forwardPreviousInterceptorCloseWithTrailingMetadata:
(nullable NSDictionary *)trailingMetadata
error:(nullable NSError *)error;
/** Forward write completion to the previous interceptor in the interceptor chain */
- (void)forwardPreviousInterceptorDidWriteData;
@end
NS_ASSUME_NONNULL_END
|
pszemus/grpc
|
src/objective-c/GRPCClient/private/GRPCTransport+Private.h
|
C
|
apache-2.0
| 2,970
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.rave.portal.model.conversion;
import org.apache.rave.model.ApplicationData;
import org.apache.rave.portal.model.JpaApplicationData;
import org.apache.rave.portal.model.impl.ApplicationDataImpl;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.HashMap;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.assertThat;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:test-dataContext.xml", "classpath:test-applicationContext.xml"})
public class JpaApplicationDataConverterTest {
@Autowired
private JpaApplicationDataConverter applicationDataConverter;
@Test
public void noConversion() {
ApplicationData applicationData = new JpaApplicationData();
assertThat(applicationDataConverter.convert(applicationData), is(sameInstance(applicationData)));
}
@Test
public void nullConversion() {
ApplicationData applicationData = null;
assertThat(applicationDataConverter.convert(applicationData), is(nullValue()));
}
@Test
public void newApplicationData() {
ApplicationData applicationData = new ApplicationDataImpl();
applicationData.setId("1");
applicationData.setAppUrl("url");
applicationData.setData(new HashMap<String, Object>());
applicationData.setUserId("userid");
JpaApplicationData converted = applicationDataConverter.convert(applicationData);
assertThat(converted, is(not(sameInstance(applicationData))));
assertThat(converted, is(instanceOf(JpaApplicationData.class)));
assertThat(converted.getId(), is(equalTo(applicationData.getId())));
assertThat(converted.getEntityId().toString(), is(equalTo(applicationData.getId())));
assertThat(converted.getAppUrl(), is(equalTo(applicationData.getAppUrl())));
assertThat(converted.getData(), is(equalTo(applicationData.getData())));
assertThat(converted.getUserId(), is(equalTo(applicationData.getUserId())));
}
}
|
svn2github/rave
|
rave-components/rave-jpa/src/test/java/org/apache/rave/portal/model/conversion/JpaApplicationDataConverterTest.java
|
Java
|
apache-2.0
| 3,115
|
// Copyright 2015 The Cockroach 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. See the AUTHORS file
// for names of contributors.
//
// Author: XisiHuang (cockhuangxh@163.com)
package sql
import (
"fmt"
"github.com/cockroachdb/cockroach/client"
"github.com/cockroachdb/cockroach/sql/parser"
"github.com/cockroachdb/cockroach/sql/privilege"
)
// DropTable drops a table.
// Privileges: DROP on table.
// Notes: postgres allows only the table owner to DROP a table.
// mysql requires the DROP privilege on the table.
func (p *planner) DropTable(n *parser.DropTable) (planNode, error) {
// TODO(XisiHuang): should do truncate and delete descriptor in
// the same txn
for i, tableQualifiedName := range n.Names {
if err := tableQualifiedName.NormalizeTableName(p.session.Database); err != nil {
return nil, err
}
dbDesc, err := p.getDatabaseDesc(tableQualifiedName.Database())
if err != nil {
return nil, err
}
tbKey := tableKey{dbDesc.ID, tableQualifiedName.Table()}
nameKey := tbKey.Key()
gr, err := p.txn.Get(nameKey)
if err != nil {
return nil, err
}
if !gr.Exists() {
if n.IfExists {
// Noop.
continue
}
// Key does not exist, but we want it to: error out.
return nil, fmt.Errorf("table %q does not exist", tbKey.Name())
}
tableDesc := TableDescriptor{}
descKey := MakeDescMetadataKey(ID(gr.ValueInt()))
if err := p.txn.GetProto(descKey, &tableDesc); err != nil {
return nil, err
}
if err := tableDesc.Validate(); err != nil {
return nil, err
}
if err := p.checkPrivilege(&tableDesc, privilege.DROP); err != nil {
return nil, err
}
if _, err = p.Truncate(&parser.Truncate{Tables: n.Names[i : i+1]}); err != nil {
return nil, err
}
// Delete table descriptor
b := &client.Batch{}
b.Del(descKey)
b.Del(nameKey)
err = p.txn.Run(b)
if err != nil {
return nil, err
}
}
return &valuesNode{}, nil
}
// DropDatabase drops a database.
// Privileges: DROP on database.
// Notes: postgres allows only the database owner to DROP a database.
// mysql requires the DROP privileges on the database.
// TODO(XisiHuang): our DROP DATABASE is like the postgres DROP SCHEMA
// (cockroach database == postgres schema). the postgres default of not
// dropping the schema if there are dependent objects is more sensible
// (see the RESTRICT and CASCADE options).
func (p *planner) DropDatabase(n *parser.DropDatabase) (planNode, error) {
if n.Name == "" {
return nil, errEmptyDatabaseName
}
nameKey := MakeNameMetadataKey(RootNamespaceID, string(n.Name))
gr, err := p.txn.Get(nameKey)
if err != nil {
return nil, err
}
if !gr.Exists() {
if n.IfExists {
// Noop.
return &valuesNode{}, nil
}
return nil, fmt.Errorf("database %q does not exist", n.Name)
}
descKey := MakeDescMetadataKey(ID(gr.ValueInt()))
desc := DatabaseDescriptor{}
if err := p.txn.GetProto(descKey, &desc); err != nil {
return nil, err
}
if err := desc.Validate(); err != nil {
return nil, err
}
if err := p.checkPrivilege(&desc, privilege.DROP); err != nil {
return nil, err
}
tbNames, err := p.getTableNames(&desc)
if err != nil {
return nil, err
}
if _, err := p.DropTable(&parser.DropTable{Names: tbNames}); err != nil {
return nil, err
}
b := &client.Batch{}
b.Del(descKey)
b.Del(nameKey)
if err := p.txn.Run(b); err != nil {
return nil, err
}
return &valuesNode{}, nil
}
|
mbonaci/cockroach
|
sql/drop.go
|
GO
|
apache-2.0
| 3,949
|
/*
* Copyright (C) 2010-2014 Hamburg Sud and the contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.aludratest.codecheck.rule.pmd.uimap;
import org.aludratest.codecheck.rule.pmd.AbstractUtilityClassRule;
import org.aludratest.service.gui.web.uimap.UIMapUtility;
/**
* See <code>src/main/resources/pmd-rules-aludra.xml</code> or the project Site
* for rule description.
*
* @author falbrech
*
*/
public class UIMapUtilityClassStructure extends AbstractUtilityClassRule {
@Override
protected Class<?> getUtilityBaseClass() {
return UIMapUtility.class;
}
}
|
vbergmann/aludratest
|
src/main/java/org/aludratest/codecheck/rule/pmd/uimap/UIMapUtilityClassStructure.java
|
Java
|
apache-2.0
| 1,120
|
# `tomcat:9.0.59-jre8-openjdk-buster`
## Docker Metadata
- Image ID: `sha256:640e97682eca638ff00bd02759ed0b3463defe502da5d8cffe821008e7e20a5c`
- Created: `2022-03-02T11:23:39.529836884Z`
- Virtual Size: ~ 288.39 Mb
(total size of all layers on-disk)
- Arch: `linux`/`amd64`
- Command: `["catalina.sh","run"]`
- Environment:
- `PATH=/usr/local/tomcat/bin:/usr/local/openjdk-8/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin`
- `JAVA_HOME=/usr/local/openjdk-8`
- `LANG=C.UTF-8`
- `JAVA_VERSION=8u322`
- `CATALINA_HOME=/usr/local/tomcat`
- `TOMCAT_NATIVE_LIBDIR=/usr/local/tomcat/native-jni-lib`
- `LD_LIBRARY_PATH=/usr/local/tomcat/native-jni-lib`
- `GPG_KEYS=48F8E69F6390C9F25CFEDCD268248959359E722B A9C5DF4D22E99998D9875A5110C01C5A2F6059E7 DCFD35E0BF8CA7344752DE8B6FB21E8933C60243`
- `TOMCAT_MAJOR=9`
- `TOMCAT_VERSION=9.0.59`
- `TOMCAT_SHA512=74902b522abda04afb2be24d7410d4d93966d20fd07dde8f03bb281cdc714866f648babe1ff1ae85d663774779235f1cb9d701d5ce8884052f1f5efca7b62c68`
## `dpkg` (`.deb`-based packages)
### `dpkg` source package: `acl=2.2.53-4`
Binary Packages:
- `libacl1:amd64=2.2.53-4`
Licenses: (parsed from: `/usr/share/doc/libacl1/copyright`)
- `GPL-2`
- `GPL-2+`
- `LGPL-2+`
- `LGPL-2.1`
Source:
```console
$ apt-get source -qq --print-uris acl=2.2.53-4
'http://deb.debian.org/debian/pool/main/a/acl/acl_2.2.53-4.dsc' acl_2.2.53-4.dsc 2330 SHA256:532eb4029659db74e6625adc2bd277144f33c92cb0603272d61693b069896a85
'http://deb.debian.org/debian/pool/main/a/acl/acl_2.2.53.orig.tar.gz' acl_2.2.53.orig.tar.gz 524300 SHA256:06be9865c6f418d851ff4494e12406568353b891ffe1f596b34693c387af26c7
'http://deb.debian.org/debian/pool/main/a/acl/acl_2.2.53.orig.tar.gz.asc' acl_2.2.53.orig.tar.gz.asc 833 SHA256:06849bece0b56a6a7269173abe101cff223bb9346d74027a3cd5ff80914abf4b
'http://deb.debian.org/debian/pool/main/a/acl/acl_2.2.53-4.debian.tar.xz' acl_2.2.53-4.debian.tar.xz 18572 SHA256:3e6571adea4886a9549bdc2323d5c55ee8f7dafb6a204513111d5943d2776dd8
```
Other potentially useful URLs:
- https://sources.debian.net/src/acl/2.2.53-4/ (for browsing the source)
- https://sources.debian.net/src/acl/2.2.53-4/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/acl/2.2.53-4/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `adduser=3.118`
Binary Packages:
- `adduser=3.118`
Licenses: (parsed from: `/usr/share/doc/adduser/copyright`)
- `GPL-2`
Source:
```console
$ apt-get source -qq --print-uris adduser=3.118
'http://deb.debian.org/debian/pool/main/a/adduser/adduser_3.118.dsc' adduser_3.118.dsc 1670 SHA256:fc79bc37fcf5e5700546c78a80670bb7b34836d012595b343fe2304cac82917d
'http://deb.debian.org/debian/pool/main/a/adduser/adduser_3.118.tar.xz' adduser_3.118.tar.xz 212280 SHA256:3e9eea661c9aac6b2c791bfcc1de3a9c6a422d45c8f3d38ed417737ed3166ffc
```
Other potentially useful URLs:
- https://sources.debian.net/src/adduser/3.118/ (for browsing the source)
- https://sources.debian.net/src/adduser/3.118/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/adduser/3.118/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `apr=1.6.5-1`
Binary Packages:
- `libapr1:amd64=1.6.5-1+b1`
Licenses: (parsed from: `/usr/share/doc/libapr1/copyright`)
- `Apache-2.0`
Source:
```console
$ apt-get source -qq --print-uris apr=1.6.5-1
'http://deb.debian.org/debian/pool/main/a/apr/apr_1.6.5-1.dsc' apr_1.6.5-1.dsc 2296 SHA256:80c471107d7f90ab5de012e4211559f4f6852ca2b7fd6911f06420aa66d27ec0
'http://deb.debian.org/debian/pool/main/a/apr/apr_1.6.5.orig.tar.bz2' apr_1.6.5.orig.tar.bz2 855393 SHA256:a67ca9fcf9c4ff59bce7f428a323c8b5e18667fdea7b0ebad47d194371b0a105
'http://deb.debian.org/debian/pool/main/a/apr/apr_1.6.5.orig.tar.bz2.asc' apr_1.6.5.orig.tar.bz2.asc 801 SHA256:9beff0bb06f4cbbb006176af93258d946d33b7fb54aac13a4c90cfba1cfd0c88
'http://deb.debian.org/debian/pool/main/a/apr/apr_1.6.5-1.debian.tar.xz' apr_1.6.5-1.debian.tar.xz 213168 SHA256:cb03a6ad0b8c525c67744e7d3f7c52af446e73bd6d4eeb6fd4622677df60db2b
```
Other potentially useful URLs:
- https://sources.debian.net/src/apr/1.6.5-1/ (for browsing the source)
- https://sources.debian.net/src/apr/1.6.5-1/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/apr/1.6.5-1/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `apt=1.8.2.3`
Binary Packages:
- `apt=1.8.2.3`
- `libapt-pkg5.0:amd64=1.8.2.3`
Licenses: (parsed from: `/usr/share/doc/apt/copyright`, `/usr/share/doc/libapt-pkg5.0/copyright`)
- `GPL-2`
- `GPLv2+`
Source:
```console
$ apt-get source -qq --print-uris apt=1.8.2.3
'http://deb.debian.org/debian/pool/main/a/apt/apt_1.8.2.3.dsc' apt_1.8.2.3.dsc 2774 SHA256:03ed672edefe4badbb2c7b32332293403bb03feb2ea0777c0846939a2fcb8bba
'http://deb.debian.org/debian/pool/main/a/apt/apt_1.8.2.3.tar.xz' apt_1.8.2.3.tar.xz 2191868 SHA256:c21c9b18c4a26bc183432cb49b919af073862954f1ae8a204096b0a68c946d3b
```
Other potentially useful URLs:
- https://sources.debian.net/src/apt/1.8.2.3/ (for browsing the source)
- https://sources.debian.net/src/apt/1.8.2.3/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/apt/1.8.2.3/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `attr=1:2.4.48-4`
Binary Packages:
- `libattr1:amd64=1:2.4.48-4`
Licenses: (parsed from: `/usr/share/doc/libattr1/copyright`)
- `GPL-2`
- `GPL-2+`
- `LGPL-2+`
- `LGPL-2.1`
Source:
```console
$ apt-get source -qq --print-uris attr=1:2.4.48-4
'http://deb.debian.org/debian/pool/main/a/attr/attr_2.4.48-4.dsc' attr_2.4.48-4.dsc 2427 SHA256:e53c076f39f1be4186704c94bd32276fa4661a587c360d8da25a5c3abe40cb29
'http://deb.debian.org/debian/pool/main/a/attr/attr_2.4.48.orig.tar.gz' attr_2.4.48.orig.tar.gz 467840 SHA256:5ead72b358ec709ed00bbf7a9eaef1654baad937c001c044fe8b74c57f5324e7
'http://deb.debian.org/debian/pool/main/a/attr/attr_2.4.48.orig.tar.gz.asc' attr_2.4.48.orig.tar.gz.asc 833 SHA256:5d23c2c83cc13d170f1c209f48d0efa1fc46d16487b790e9996c5206dcfe0395
'http://deb.debian.org/debian/pool/main/a/attr/attr_2.4.48-4.debian.tar.xz' attr_2.4.48-4.debian.tar.xz 22388 SHA256:a491d226fb3b47aa65997406009893a4cc0628e2ffffe0d411179652dfeb6935
```
Other potentially useful URLs:
- https://sources.debian.net/src/attr/1:2.4.48-4/ (for browsing the source)
- https://sources.debian.net/src/attr/1:2.4.48-4/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/attr/1:2.4.48-4/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `audit=1:2.8.4-3`
Binary Packages:
- `libaudit-common=1:2.8.4-3`
- `libaudit1:amd64=1:2.8.4-3`
Licenses: (parsed from: `/usr/share/doc/libaudit-common/copyright`, `/usr/share/doc/libaudit1/copyright`)
- `GPL-1`
- `GPL-2`
- `LGPL-2.1`
Source:
```console
$ apt-get source -qq --print-uris audit=1:2.8.4-3
'http://deb.debian.org/debian/pool/main/a/audit/audit_2.8.4-3.dsc' audit_2.8.4-3.dsc 2483 SHA256:101fd82f4c7af2f8753060b494ac46204b0eee1ffe5d1e113a493b99571af186
'http://deb.debian.org/debian/pool/main/a/audit/audit_2.8.4.orig.tar.gz' audit_2.8.4.orig.tar.gz 1123889 SHA256:a410694d09fc5708d980a61a5abcb9633a591364f1ecc7e97ad5daef9c898c38
'http://deb.debian.org/debian/pool/main/a/audit/audit_2.8.4-3.debian.tar.xz' audit_2.8.4-3.debian.tar.xz 16712 SHA256:2b4b16cf58c3a6180d380bd4ad1d30a38fa22826ca3c1233c5298138427e29d0
```
Other potentially useful URLs:
- https://sources.debian.net/src/audit/1:2.8.4-3/ (for browsing the source)
- https://sources.debian.net/src/audit/1:2.8.4-3/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/audit/1:2.8.4-3/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `base-files=10.3+deb10u11`
Binary Packages:
- `base-files=10.3+deb10u11`
Licenses: (parsed from: `/usr/share/doc/base-files/copyright`)
- `GPL`
Source:
```console
$ apt-get source -qq --print-uris base-files=10.3+deb10u11
'http://deb.debian.org/debian/pool/main/b/base-files/base-files_10.3%2bdeb10u11.dsc' base-files_10.3+deb10u11.dsc 1107 SHA256:c330a188675075328a715fe1d3ace68ed366293dbd002ead99e17215debab4ee
'http://deb.debian.org/debian/pool/main/b/base-files/base-files_10.3%2bdeb10u11.tar.xz' base-files_10.3+deb10u11.tar.xz 65496 SHA256:8b3071976d9d896c0fa3b2481d81c69c7d627ab9f13eee848bddc8ed4f446794
```
Other potentially useful URLs:
- https://sources.debian.net/src/base-files/10.3+deb10u11/ (for browsing the source)
- https://sources.debian.net/src/base-files/10.3+deb10u11/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/base-files/10.3+deb10u11/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `base-passwd=3.5.46`
Binary Packages:
- `base-passwd=3.5.46`
Licenses: (parsed from: `/usr/share/doc/base-passwd/copyright`)
- `GPL-2`
- `PD`
Source:
```console
$ apt-get source -qq --print-uris base-passwd=3.5.46
'http://deb.debian.org/debian/pool/main/b/base-passwd/base-passwd_3.5.46.dsc' base-passwd_3.5.46.dsc 1651 SHA256:98b5d79c9f06e05e9f41013f8fee48b08d0ffe398653b6f8bbd93c1ae1f24bd4
'http://deb.debian.org/debian/pool/main/b/base-passwd/base-passwd_3.5.46.tar.xz' base-passwd_3.5.46.tar.xz 52780 SHA256:da15e380557b5a00cdc14018e3da6cbeaaadc786f2c3cb5b8f1fb4acc150b3da
```
Other potentially useful URLs:
- https://sources.debian.net/src/base-passwd/3.5.46/ (for browsing the source)
- https://sources.debian.net/src/base-passwd/3.5.46/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/base-passwd/3.5.46/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `bash=5.0-4`
Binary Packages:
- `bash=5.0-4`
Licenses: (parsed from: `/usr/share/doc/bash/copyright`)
- `GPL-3`
Source:
```console
$ apt-get source -qq --print-uris bash=5.0-4
'http://deb.debian.org/debian/pool/main/b/bash/bash_5.0-4.dsc' bash_5.0-4.dsc 2305 SHA256:fe746c72de6e61866a0ed4e21a5b9d154966a8684ec3bdf5bacc70d5351f6282
'http://deb.debian.org/debian/pool/main/b/bash/bash_5.0.orig.tar.xz' bash_5.0.orig.tar.xz 5554808 SHA256:893858ba233d65bda38039e99dd96a4102b2f6a2d5e6c1c546e0794a60beed97
'http://deb.debian.org/debian/pool/main/b/bash/bash_5.0-4.debian.tar.xz' bash_5.0-4.debian.tar.xz 91884 SHA256:1e33dff5dd8604fa4205a1746828063cd96a1e635355f3626b54fef155b8c4e5
```
Other potentially useful URLs:
- https://sources.debian.net/src/bash/5.0-4/ (for browsing the source)
- https://sources.debian.net/src/bash/5.0-4/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/bash/5.0-4/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `bzip2=1.0.6-9.2~deb10u1`
Binary Packages:
- `bzip2=1.0.6-9.2~deb10u1`
- `libbz2-1.0:amd64=1.0.6-9.2~deb10u1`
Licenses: (parsed from: `/usr/share/doc/bzip2/copyright`, `/usr/share/doc/libbz2-1.0/copyright`)
- `BSD-variant`
- `GPL-2`
Source:
```console
$ apt-get source -qq --print-uris bzip2=1.0.6-9.2~deb10u1
'http://deb.debian.org/debian/pool/main/b/bzip2/bzip2_1.0.6-9.2%7edeb10u1.dsc' bzip2_1.0.6-9.2~deb10u1.dsc 2380 SHA256:f518d7c599e1028002a739bd9123fa23767d74e1c5cf1d05f36eb7de9fc25b5c
'http://deb.debian.org/debian/pool/main/b/bzip2/bzip2_1.0.6.orig.tar.bz2' bzip2_1.0.6.orig.tar.bz2 708737 SHA256:d70a9ccd8bdf47e302d96c69fecd54925f45d9c7b966bb4ef5f56b770960afa7
'http://deb.debian.org/debian/pool/main/b/bzip2/bzip2_1.0.6-9.2%7edeb10u1.debian.tar.bz2' bzip2_1.0.6-9.2~deb10u1.debian.tar.bz2 27542 SHA256:44900f7371503fe35ea7d3aa5b8ab8c677300be9b0d5277838d0c874be9c8541
```
Other potentially useful URLs:
- https://sources.debian.net/src/bzip2/1.0.6-9.2~deb10u1/ (for browsing the source)
- https://sources.debian.net/src/bzip2/1.0.6-9.2~deb10u1/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/bzip2/1.0.6-9.2~deb10u1/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `ca-certificates=20200601~deb10u2`
Binary Packages:
- `ca-certificates=20200601~deb10u2`
Licenses: (parsed from: `/usr/share/doc/ca-certificates/copyright`)
- `GPL-2`
- `GPL-2+`
- `MPL-2.0`
Source:
```console
$ apt-get source -qq --print-uris ca-certificates=20200601~deb10u2
'http://deb.debian.org/debian/pool/main/c/ca-certificates/ca-certificates_20200601%7edeb10u2.dsc' ca-certificates_20200601~deb10u2.dsc 1907 SHA256:b89cbd8c235e131ee10cb85a9bd4b3e429874c1e0577c5ed35121f8590d4d029
'http://deb.debian.org/debian/pool/main/c/ca-certificates/ca-certificates_20200601%7edeb10u2.tar.xz' ca-certificates_20200601~deb10u2.tar.xz 245804 SHA256:13ffd04d36230309ff383ad4ccbefb1852b1483f0ac3da75b4979906933ba5e8
```
Other potentially useful URLs:
- https://sources.debian.net/src/ca-certificates/20200601~deb10u2/ (for browsing the source)
- https://sources.debian.net/src/ca-certificates/20200601~deb10u2/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/ca-certificates/20200601~deb10u2/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `cdebconf=0.249`
Binary Packages:
- `libdebconfclient0:amd64=0.249`
**WARNING:** unable to detect licenses! (package likely not compliant with DEP-5)
If source is available (seen below), check the contents of `debian/copyright` within it.
Source:
```console
$ apt-get source -qq --print-uris cdebconf=0.249
'http://deb.debian.org/debian/pool/main/c/cdebconf/cdebconf_0.249.dsc' cdebconf_0.249.dsc 2783 SHA256:6a0061589add058e5130e9be20ea45056701fd71ac0d26defd9a8c53758486f1
'http://deb.debian.org/debian/pool/main/c/cdebconf/cdebconf_0.249.tar.xz' cdebconf_0.249.tar.xz 275256 SHA256:f7211ab20bfde7a0726cd566fd004b08e7ee358d238e35ea215f4fe0b3883b3e
```
Other potentially useful URLs:
- https://sources.debian.net/src/cdebconf/0.249/ (for browsing the source)
- https://sources.debian.net/src/cdebconf/0.249/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/cdebconf/0.249/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `coreutils=8.30-3`
Binary Packages:
- `coreutils=8.30-3`
Licenses: (parsed from: `/usr/share/doc/coreutils/copyright`)
- `GPL-3`
Source:
```console
$ apt-get source -qq --print-uris coreutils=8.30-3
'http://deb.debian.org/debian/pool/main/c/coreutils/coreutils_8.30-3.dsc' coreutils_8.30-3.dsc 1861 SHA256:106031a57a2ab2ba46b61083035e2ccb438c85a2b3506a8198b67868dde1546d
'http://deb.debian.org/debian/pool/main/c/coreutils/coreutils_8.30.orig.tar.xz' coreutils_8.30.orig.tar.xz 5359532 SHA256:e831b3a86091496cdba720411f9748de81507798f6130adeaef872d206e1b057
'http://deb.debian.org/debian/pool/main/c/coreutils/coreutils_8.30-3.debian.tar.xz' coreutils_8.30-3.debian.tar.xz 32808 SHA256:9179d45fb51d07a8743c4d58464459330eb6d4b489d59641d70c3bd9f579b694
```
Other potentially useful URLs:
- https://sources.debian.net/src/coreutils/8.30-3/ (for browsing the source)
- https://sources.debian.net/src/coreutils/8.30-3/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/coreutils/8.30-3/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `curl=7.64.0-4+deb10u2`
Binary Packages:
- `curl=7.64.0-4+deb10u2`
- `libcurl4:amd64=7.64.0-4+deb10u2`
Licenses: (parsed from: `/usr/share/doc/curl/copyright`, `/usr/share/doc/libcurl4/copyright`)
- `BSD-3-Clause`
- `BSD-4-Clause`
- `ISC`
- `curl`
- `other`
- `public-domain`
Source:
```console
$ apt-get source -qq --print-uris curl=7.64.0-4+deb10u2
'http://deb.debian.org/debian/pool/main/c/curl/curl_7.64.0-4%2bdeb10u2.dsc' curl_7.64.0-4+deb10u2.dsc 2719 SHA256:3cc585f4c22c0c001527f5f26f5a6154a86d1df9752aa118bf7d8e892ec4fac2
'http://deb.debian.org/debian/pool/main/c/curl/curl_7.64.0.orig.tar.gz' curl_7.64.0.orig.tar.gz 4032645 SHA256:cb90d2eb74d4e358c1ed1489f8e3af96b50ea4374ad71f143fa4595e998d81b5
'http://deb.debian.org/debian/pool/main/c/curl/curl_7.64.0-4%2bdeb10u2.debian.tar.xz' curl_7.64.0-4+deb10u2.debian.tar.xz 43572 SHA256:6b7f793e0cd41e2ccb49301ad4e58c83282f46be7c9415c9280164834efd0e52
```
Other potentially useful URLs:
- https://sources.debian.net/src/curl/7.64.0-4+deb10u2/ (for browsing the source)
- https://sources.debian.net/src/curl/7.64.0-4+deb10u2/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/curl/7.64.0-4+deb10u2/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `cyrus-sasl2=2.1.27+dfsg-1+deb10u2`
Binary Packages:
- `libsasl2-2:amd64=2.1.27+dfsg-1+deb10u2`
- `libsasl2-modules-db:amd64=2.1.27+dfsg-1+deb10u2`
Licenses: (parsed from: `/usr/share/doc/libsasl2-2/copyright`, `/usr/share/doc/libsasl2-modules-db/copyright`)
- `BSD-4-clause`
- `GPL-3`
- `GPL-3+`
Source:
```console
$ apt-get source -qq --print-uris cyrus-sasl2=2.1.27+dfsg-1+deb10u2
'http://security.debian.org/debian-security/pool/updates/main/c/cyrus-sasl2/cyrus-sasl2_2.1.27%2bdfsg-1%2bdeb10u2.dsc' cyrus-sasl2_2.1.27+dfsg-1+deb10u2.dsc 3583 SHA256:64f060b2e272069c2a6f89025d586c08855179dc03425b55848c2e6bb3e5f85e
'http://security.debian.org/debian-security/pool/updates/main/c/cyrus-sasl2/cyrus-sasl2_2.1.27%2bdfsg.orig.tar.xz' cyrus-sasl2_2.1.27+dfsg.orig.tar.xz 2058596 SHA256:108b0c691c423837264f05abb559ea76c3dfdd91246555e8abe87c129a6e37cd
'http://security.debian.org/debian-security/pool/updates/main/c/cyrus-sasl2/cyrus-sasl2_2.1.27%2bdfsg-1%2bdeb10u2.debian.tar.xz' cyrus-sasl2_2.1.27+dfsg-1+deb10u2.debian.tar.xz 101064 SHA256:43296455617072928e3c409b3a40b08e98ad335b98fd40fc2a0d921bab72cf97
```
Other potentially useful URLs:
- https://sources.debian.net/src/cyrus-sasl2/2.1.27+dfsg-1+deb10u2/ (for browsing the source)
- https://sources.debian.net/src/cyrus-sasl2/2.1.27+dfsg-1+deb10u2/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/cyrus-sasl2/2.1.27+dfsg-1+deb10u2/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `dash=0.5.10.2-5`
Binary Packages:
- `dash=0.5.10.2-5`
Licenses: (parsed from: `/usr/share/doc/dash/copyright`)
- `GPL`
Source:
```console
$ apt-get source -qq --print-uris dash=0.5.10.2-5
'http://deb.debian.org/debian/pool/main/d/dash/dash_0.5.10.2-5.dsc' dash_0.5.10.2-5.dsc 1756 SHA256:6255cf35f61df5122637856ad0912986de1c20875177932de1c971b7bbbbd848
'http://deb.debian.org/debian/pool/main/d/dash/dash_0.5.10.2.orig.tar.gz' dash_0.5.10.2.orig.tar.gz 225196 SHA256:3c663919dc5c66ec991da14c7cf7e0be8ad00f3db73986a987c118862b5f6071
'http://deb.debian.org/debian/pool/main/d/dash/dash_0.5.10.2-5.debian.tar.xz' dash_0.5.10.2-5.debian.tar.xz 41804 SHA256:fabf27bd78778b151143ed598a6b65019cfce5dd087d9693b848346459951d24
```
Other potentially useful URLs:
- https://sources.debian.net/src/dash/0.5.10.2-5/ (for browsing the source)
- https://sources.debian.net/src/dash/0.5.10.2-5/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/dash/0.5.10.2-5/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `db5.3=5.3.28+dfsg1-0.5`
Binary Packages:
- `libdb5.3:amd64=5.3.28+dfsg1-0.5`
**WARNING:** unable to detect licenses! (package likely not compliant with DEP-5)
If source is available (seen below), check the contents of `debian/copyright` within it.
Source:
```console
$ apt-get source -qq --print-uris db5.3=5.3.28+dfsg1-0.5
'http://deb.debian.org/debian/pool/main/d/db5.3/db5.3_5.3.28%2bdfsg1-0.5.dsc' db5.3_5.3.28+dfsg1-0.5.dsc 2804 SHA256:600ef735e47273c7e8de0a9bbbf2d6f31cb1d2851117f94776d7952588c0ecc4
'http://deb.debian.org/debian/pool/main/d/db5.3/db5.3_5.3.28%2bdfsg1.orig.tar.xz' db5.3_5.3.28+dfsg1.orig.tar.xz 19723860 SHA256:b19bf3dd8ce74b95a7b215be9a7c8489e8e8f18da60d64d6340a06e75f497749
'http://deb.debian.org/debian/pool/main/d/db5.3/db5.3_5.3.28%2bdfsg1-0.5.debian.tar.xz' db5.3_5.3.28+dfsg1-0.5.debian.tar.xz 29128 SHA256:682c1736c1b5f3afbd90cf24e085a0437821ae595dc54aeef8c09ddd1c3d05fe
```
Other potentially useful URLs:
- https://sources.debian.net/src/db5.3/5.3.28+dfsg1-0.5/ (for browsing the source)
- https://sources.debian.net/src/db5.3/5.3.28+dfsg1-0.5/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/db5.3/5.3.28+dfsg1-0.5/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `debconf=1.5.71+deb10u1`
Binary Packages:
- `debconf=1.5.71+deb10u1`
Licenses: (parsed from: `/usr/share/doc/debconf/copyright`)
- `BSD-2-clause`
Source:
```console
$ apt-get source -qq --print-uris debconf=1.5.71+deb10u1
'http://deb.debian.org/debian/pool/main/d/debconf/debconf_1.5.71%2bdeb10u1.dsc' debconf_1.5.71+deb10u1.dsc 2199 SHA256:9bad49c9ec67cfe5b516813a8643e8c22d89434fee6947c16c27ab5cbb99c7d5
'http://deb.debian.org/debian/pool/main/d/debconf/debconf_1.5.71%2bdeb10u1.tar.xz' debconf_1.5.71+deb10u1.tar.xz 570832 SHA256:cfa00cb4ac50919b8a1e3a9190a06a248e83e3f0362fa70e49237a3a2686dc61
```
Other potentially useful URLs:
- https://sources.debian.net/src/debconf/1.5.71+deb10u1/ (for browsing the source)
- https://sources.debian.net/src/debconf/1.5.71+deb10u1/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/debconf/1.5.71+deb10u1/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `debian-archive-keyring=2019.1+deb10u1`
Binary Packages:
- `debian-archive-keyring=2019.1+deb10u1`
Licenses: (parsed from: `/usr/share/doc/debian-archive-keyring/copyright`)
- `GPL`
Source:
```console
$ apt-get source -qq --print-uris debian-archive-keyring=2019.1+deb10u1
'http://deb.debian.org/debian/pool/main/d/debian-archive-keyring/debian-archive-keyring_2019.1%2bdeb10u1.dsc' debian-archive-keyring_2019.1+deb10u1.dsc 1878 SHA256:5e331767f3b49a6da251e0723604ac953496536965dfddc1d527d23d028f0de0
'http://deb.debian.org/debian/pool/main/d/debian-archive-keyring/debian-archive-keyring_2019.1%2bdeb10u1.tar.xz' debian-archive-keyring_2019.1+deb10u1.tar.xz 149144 SHA256:ffb63bc54d67f3d9125ebbb7298fdf3be1d18a6df1816d5ae96f1cf0f141eb39
```
Other potentially useful URLs:
- https://sources.debian.net/src/debian-archive-keyring/2019.1+deb10u1/ (for browsing the source)
- https://sources.debian.net/src/debian-archive-keyring/2019.1+deb10u1/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/debian-archive-keyring/2019.1+deb10u1/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `debianutils=4.8.6.1`
Binary Packages:
- `debianutils=4.8.6.1`
Licenses: (parsed from: `/usr/share/doc/debianutils/copyright`)
- `GPL`
Source:
```console
$ apt-get source -qq --print-uris debianutils=4.8.6.1
'http://deb.debian.org/debian/pool/main/d/debianutils/debianutils_4.8.6.1.dsc' debianutils_4.8.6.1.dsc 1625 SHA256:fa869200410510cdefc85c89755d21ac054836a18b6916aedeba472e4b0567bb
'http://deb.debian.org/debian/pool/main/d/debianutils/debianutils_4.8.6.1.tar.xz' debianutils_4.8.6.1.tar.xz 156604 SHA256:099f1e8a7278b26145a2ba2dda84c4118403bfab38c8d7070a6235a7ffcb55ed
```
Other potentially useful URLs:
- https://sources.debian.net/src/debianutils/4.8.6.1/ (for browsing the source)
- https://sources.debian.net/src/debianutils/4.8.6.1/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/debianutils/4.8.6.1/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `diffutils=1:3.7-3`
Binary Packages:
- `diffutils=1:3.7-3`
Licenses: (parsed from: `/usr/share/doc/diffutils/copyright`)
- `GFDL`
- `GPL`
Source:
```console
$ apt-get source -qq --print-uris diffutils=1:3.7-3
'http://deb.debian.org/debian/pool/main/d/diffutils/diffutils_3.7-3.dsc' diffutils_3.7-3.dsc 1453 SHA256:99dee94cec05454a65a9cb542bea1720dbd4c511d13f9784c9e3741e76a9b9ba
'http://deb.debian.org/debian/pool/main/d/diffutils/diffutils_3.7.orig.tar.xz' diffutils_3.7.orig.tar.xz 1448828 SHA256:b3a7a6221c3dc916085f0d205abf6b8e1ba443d4dd965118da364a1dc1cb3a26
'http://deb.debian.org/debian/pool/main/d/diffutils/diffutils_3.7-3.debian.tar.xz' diffutils_3.7-3.debian.tar.xz 11116 SHA256:a455228f12283b5f3c0165db4ab9b12071adc37fb9dd50dcb5e1b8851c524f1f
```
Other potentially useful URLs:
- https://sources.debian.net/src/diffutils/1:3.7-3/ (for browsing the source)
- https://sources.debian.net/src/diffutils/1:3.7-3/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/diffutils/1:3.7-3/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `dpkg=1.19.7`
Binary Packages:
- `dpkg=1.19.7`
Licenses: (parsed from: `/usr/share/doc/dpkg/copyright`)
- `BSD-2-clause`
- `GPL-2`
- `GPL-2+`
- `public-domain-md5`
- `public-domain-s-s-d`
Source:
```console
$ apt-get source -qq --print-uris dpkg=1.19.7
'http://deb.debian.org/debian/pool/main/d/dpkg/dpkg_1.19.7.dsc' dpkg_1.19.7.dsc 2103 SHA256:098b285d5fc7add8972e5b2b3678027bba3f3fe01962e5176db2fbff33bbd8e3
'http://deb.debian.org/debian/pool/main/d/dpkg/dpkg_1.19.7.tar.xz' dpkg_1.19.7.tar.xz 4716724 SHA256:4c27fededf620c0aa522fff1a48577ba08144445341257502e7730f2b1a296e8
```
Other potentially useful URLs:
- https://sources.debian.net/src/dpkg/1.19.7/ (for browsing the source)
- https://sources.debian.net/src/dpkg/1.19.7/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/dpkg/1.19.7/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `e2fsprogs=1.44.5-1+deb10u3`
Binary Packages:
- `e2fsprogs=1.44.5-1+deb10u3`
- `libcom-err2:amd64=1.44.5-1+deb10u3`
- `libext2fs2:amd64=1.44.5-1+deb10u3`
- `libss2:amd64=1.44.5-1+deb10u3`
Licenses: (parsed from: `/usr/share/doc/e2fsprogs/copyright`, `/usr/share/doc/libcom-err2/copyright`, `/usr/share/doc/libext2fs2/copyright`, `/usr/share/doc/libss2/copyright`)
- `GPL-2`
- `LGPL-2`
Source:
```console
$ apt-get source -qq --print-uris e2fsprogs=1.44.5-1+deb10u3
'http://deb.debian.org/debian/pool/main/e/e2fsprogs/e2fsprogs_1.44.5-1%2bdeb10u3.dsc' e2fsprogs_1.44.5-1+deb10u3.dsc 2903 SHA256:acdc31d6fd491f9db97aabc96340559d8492b98e3549df32d8369690e03058dc
'http://deb.debian.org/debian/pool/main/e/e2fsprogs/e2fsprogs_1.44.5.orig.tar.gz' e2fsprogs_1.44.5.orig.tar.gz 7619237 SHA256:2e211fae27ef74d5af4a4e40b10b8df7f87c655933bd171aab4889bfc4e6d1cc
'http://deb.debian.org/debian/pool/main/e/e2fsprogs/e2fsprogs_1.44.5.orig.tar.gz.asc' e2fsprogs_1.44.5.orig.tar.gz.asc 488 SHA256:c0e3e4e51f46c005890963b005015b784b2f19e291a16a15681b9906528f557e
'http://deb.debian.org/debian/pool/main/e/e2fsprogs/e2fsprogs_1.44.5-1%2bdeb10u3.debian.tar.xz' e2fsprogs_1.44.5-1+deb10u3.debian.tar.xz 82412 SHA256:0114857448922a218613f369f665f03f1b1435004c9d79ce5ee1a8a8a6cec53f
```
Other potentially useful URLs:
- https://sources.debian.net/src/e2fsprogs/1.44.5-1+deb10u3/ (for browsing the source)
- https://sources.debian.net/src/e2fsprogs/1.44.5-1+deb10u3/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/e2fsprogs/1.44.5-1+deb10u3/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `elfutils=0.176-1.1`
Binary Packages:
- `libelf1:amd64=0.176-1.1`
Licenses: (parsed from: `/usr/share/doc/libelf1/copyright`)
- `GPL-2`
- `GPL-3`
- `LGPL-`
Source:
```console
$ apt-get source -qq --print-uris elfutils=0.176-1.1
'http://deb.debian.org/debian/pool/main/e/elfutils/elfutils_0.176-1.1.dsc' elfutils_0.176-1.1.dsc 2584 SHA256:6d9fa4741e921f58a3e291def1f92a87bed888db15e73d6e29d46fc48b5f615a
'http://deb.debian.org/debian/pool/main/e/elfutils/elfutils_0.176.orig.tar.bz2' elfutils_0.176.orig.tar.bz2 8646075 SHA256:eb5747c371b0af0f71e86215a5ebb88728533c3a104a43d4231963f308cd1023
'http://deb.debian.org/debian/pool/main/e/elfutils/elfutils_0.176.orig.tar.bz2.asc' elfutils_0.176.orig.tar.bz2.asc 455 SHA256:51474b579b25fc799de0777e241c83605427d2903f8d28524ef6af42f75931fd
'http://deb.debian.org/debian/pool/main/e/elfutils/elfutils_0.176-1.1.debian.tar.xz' elfutils_0.176-1.1.debian.tar.xz 31644 SHA256:06d7057e744d3a6138cf43d30237e2b327b6bfe3041a9a4b210414429c1267f1
```
Other potentially useful URLs:
- https://sources.debian.net/src/elfutils/0.176-1.1/ (for browsing the source)
- https://sources.debian.net/src/elfutils/0.176-1.1/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/elfutils/0.176-1.1/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `expat=2.2.6-2+deb10u3`
Binary Packages:
- `libexpat1:amd64=2.2.6-2+deb10u3`
Licenses: (parsed from: `/usr/share/doc/libexpat1/copyright`)
- `MIT`
Source:
```console
$ apt-get source -qq --print-uris expat=2.2.6-2+deb10u3
'http://security.debian.org/debian-security/pool/updates/main/e/expat/expat_2.2.6-2%2bdeb10u3.dsc' expat_2.2.6-2+deb10u3.dsc 2136 SHA256:2b58ea166b515d88311e65047aaa81b701a3a4581fbb56e5dd76933a86883a93
'http://security.debian.org/debian-security/pool/updates/main/e/expat/expat_2.2.6.orig.tar.gz' expat_2.2.6.orig.tar.gz 8275473 SHA256:574499cba22a599393e28d99ecfa1e7fc85be7d6651d543045244d5b561cb7ff
'http://security.debian.org/debian-security/pool/updates/main/e/expat/expat_2.2.6-2%2bdeb10u3.debian.tar.xz' expat_2.2.6-2+deb10u3.debian.tar.xz 25028 SHA256:99ccca69578e5bfff55b0fd5d21bf24ca2eda1a9e2f5a10610bc27409ca3f1b0
```
Other potentially useful URLs:
- https://sources.debian.net/src/expat/2.2.6-2+deb10u3/ (for browsing the source)
- https://sources.debian.net/src/expat/2.2.6-2+deb10u3/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/expat/2.2.6-2+deb10u3/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `findutils=4.6.0+git+20190209-2`
Binary Packages:
- `findutils=4.6.0+git+20190209-2`
Licenses: (parsed from: `/usr/share/doc/findutils/copyright`)
- `GFDL-1.3`
- `GPL-3`
Source:
```console
$ apt-get source -qq --print-uris findutils=4.6.0+git+20190209-2
'http://deb.debian.org/debian/pool/main/f/findutils/findutils_4.6.0%2bgit%2b20190209-2.dsc' findutils_4.6.0+git+20190209-2.dsc 2137 SHA256:e09430f44f976ee0e51e3226543247668b4ef88c05d14a84ed2d5a6f1bd07421
'http://deb.debian.org/debian/pool/main/f/findutils/findutils_4.6.0%2bgit%2b20190209.orig.tar.xz' findutils_4.6.0+git+20190209.orig.tar.xz 1893084 SHA256:6832b3f6ddc0e2718795e6732ea40cc5309b948505f55fb9935919d6aaac7e9d
'http://deb.debian.org/debian/pool/main/f/findutils/findutils_4.6.0%2bgit%2b20190209-2.debian.tar.xz' findutils_4.6.0+git+20190209-2.debian.tar.xz 26628 SHA256:d6f4c6fedc27cf5d616c9fbf41a46b8fb8b078f1f21045b484419b145037e849
```
Other potentially useful URLs:
- https://sources.debian.net/src/findutils/4.6.0+git+20190209-2/ (for browsing the source)
- https://sources.debian.net/src/findutils/4.6.0+git+20190209-2/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/findutils/4.6.0+git+20190209-2/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `fontconfig=2.13.1-2`
Binary Packages:
- `fontconfig=2.13.1-2`
- `fontconfig-config=2.13.1-2`
- `libfontconfig1:amd64=2.13.1-2`
**WARNING:** unable to detect licenses! (package likely not compliant with DEP-5)
If source is available (seen below), check the contents of `debian/copyright` within it.
Source:
```console
$ apt-get source -qq --print-uris fontconfig=2.13.1-2
'http://deb.debian.org/debian/pool/main/f/fontconfig/fontconfig_2.13.1-2.dsc' fontconfig_2.13.1-2.dsc 2185 SHA256:4c9ee914941b8f129ab54a13ecc889eb3165588bf4a7b3ae049226c7972ac486
'http://deb.debian.org/debian/pool/main/f/fontconfig/fontconfig_2.13.1.orig.tar.bz2' fontconfig_2.13.1.orig.tar.bz2 1723639 SHA256:f655dd2a986d7aa97e052261b36aa67b0a64989496361eca8d604e6414006741
'http://deb.debian.org/debian/pool/main/f/fontconfig/fontconfig_2.13.1-2.debian.tar.xz' fontconfig_2.13.1-2.debian.tar.xz 53600 SHA256:9da208343c570b2e8d48c6c8b4cf49b0647ae334df505b2ec6a171e73453e498
```
Other potentially useful URLs:
- https://sources.debian.net/src/fontconfig/2.13.1-2/ (for browsing the source)
- https://sources.debian.net/src/fontconfig/2.13.1-2/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/fontconfig/2.13.1-2/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `fonts-dejavu=2.37-1`
Binary Packages:
- `fonts-dejavu-core=2.37-1`
Licenses: (parsed from: `/usr/share/doc/fonts-dejavu-core/copyright`)
- `GPL-2`
- `GPL-2+`
- `bitstream-vera`
Source:
```console
$ apt-get source -qq --print-uris fonts-dejavu=2.37-1
'http://deb.debian.org/debian/pool/main/f/fonts-dejavu/fonts-dejavu_2.37-1.dsc' fonts-dejavu_2.37-1.dsc 2575 SHA256:f35ff7b2c8dbfda6564c9dedf088ba06cc6d279fdd8e7cccbd1ae08ded1bb71c
'http://deb.debian.org/debian/pool/main/f/fonts-dejavu/fonts-dejavu_2.37.orig.tar.bz2' fonts-dejavu_2.37.orig.tar.bz2 12050109 SHA256:4b21c5203f792343d5e90ab1cb0cf07e99887218abe3d83cd9a98cea9085e799
'http://deb.debian.org/debian/pool/main/f/fonts-dejavu/fonts-dejavu_2.37-1.debian.tar.xz' fonts-dejavu_2.37-1.debian.tar.xz 10424 SHA256:5105cdbfc086f4a83ab6871eb39cc904bf02aa52762402b7cacf33d0938122f7
```
Other potentially useful URLs:
- https://sources.debian.net/src/fonts-dejavu/2.37-1/ (for browsing the source)
- https://sources.debian.net/src/fonts-dejavu/2.37-1/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/fonts-dejavu/2.37-1/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `freetype=2.9.1-3+deb10u2`
Binary Packages:
- `libfreetype6:amd64=2.9.1-3+deb10u2`
Licenses: (parsed from: `/usr/share/doc/libfreetype6/copyright`)
- `BSD-3-Clause`
- `Catharon-OSL`
- `FSFUL`
- `FSFULLR`
- `FTL`
- `GPL-2`
- `GPL-2+`
- `GPL-3`
- `GPL-3+`
- `MIT`
- `OpenGroup-BSD-like`
- `Permissive`
- `Public-Domain`
- `Zlib`
Source:
```console
$ apt-get source -qq --print-uris freetype=2.9.1-3+deb10u2
'http://deb.debian.org/debian/pool/main/f/freetype/freetype_2.9.1-3%2bdeb10u2.dsc' freetype_2.9.1-3+deb10u2.dsc 3845 SHA256:374330a49a699ec8dc4fff06b3270ae4d236d5b68a1258d60512f6edc9ddd1d1
'http://deb.debian.org/debian/pool/main/f/freetype/freetype_2.9.1.orig-ft2demos.tar.gz' freetype_2.9.1.orig-ft2demos.tar.gz 294850 SHA256:3d440aad3481285c7455f1593577e375c9d5792c800bbaba68d46fd75130fab9
'http://deb.debian.org/debian/pool/main/f/freetype/freetype_2.9.1.orig-ft2demos.tar.gz.asc' freetype_2.9.1.orig-ft2demos.tar.gz.asc 359 SHA256:665b8357378dc715fbac964d05cdcc2a2f7fd1e9d7918a27bf50f4d0a17f0d30
'http://deb.debian.org/debian/pool/main/f/freetype/freetype_2.9.1.orig-ft2docs.tar.gz' freetype_2.9.1.orig-ft2docs.tar.gz 2123920 SHA256:f57c1297f5ad2ad4764f491317fa0f548bd307c4513185d4a0602412e83b1dc9
'http://deb.debian.org/debian/pool/main/f/freetype/freetype_2.9.1.orig-ft2docs.tar.gz.asc' freetype_2.9.1.orig-ft2docs.tar.gz.asc 359 SHA256:c4c674db43603f719018716970569d1722d0de46fa94757eb7f39266d72cdbd1
'http://deb.debian.org/debian/pool/main/f/freetype/freetype_2.9.1.orig.tar.gz' freetype_2.9.1.orig.tar.gz 2533956 SHA256:ec391504e55498adceb30baceebd147a6e963f636eb617424bcfc47a169898ce
'http://deb.debian.org/debian/pool/main/f/freetype/freetype_2.9.1.orig.tar.gz.asc' freetype_2.9.1.orig.tar.gz.asc 359 SHA256:2c2c5ae3b3838053b94366639e802b18bc4761003ea15ce73402d276baec424d
'http://deb.debian.org/debian/pool/main/f/freetype/freetype_2.9.1-3%2bdeb10u2.debian.tar.xz' freetype_2.9.1-3+deb10u2.debian.tar.xz 112652 SHA256:0fdd4dc35e232a9dc09450fc0b961e0642c6a54135abea53be64991f26d31cc6
```
Other potentially useful URLs:
- https://sources.debian.net/src/freetype/2.9.1-3+deb10u2/ (for browsing the source)
- https://sources.debian.net/src/freetype/2.9.1-3+deb10u2/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/freetype/2.9.1-3+deb10u2/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `gcc-8=8.3.0-6`
Binary Packages:
- `gcc-8-base:amd64=8.3.0-6`
- `libgcc1:amd64=1:8.3.0-6`
- `libstdc++6:amd64=8.3.0-6`
Licenses: (parsed from: `/usr/share/doc/gcc-8-base/copyright`, `/usr/share/doc/libgcc1/copyright`, `/usr/share/doc/libstdc++6/copyright`)
- `Artistic`
- `GFDL-1.2`
- `GPL`
- `GPL-2`
- `GPL-3`
- `LGPL`
Source:
```console
$ apt-get source -qq --print-uris gcc-8=8.3.0-6
'http://deb.debian.org/debian/pool/main/g/gcc-8/gcc-8_8.3.0-6.dsc' gcc-8_8.3.0-6.dsc 32433 SHA256:3b380579af74f1a325a07cc5798f8bff5206f0820fcac5bf64ff2bbd0466867d
'http://deb.debian.org/debian/pool/main/g/gcc-8/gcc-8_8.3.0.orig.tar.gz' gcc-8_8.3.0.orig.tar.gz 87764363 SHA256:ee3fd608f66e5737f20cf71b176cfbf58f7c1d190ad6def33d57610cdae8eac2
'http://deb.debian.org/debian/pool/main/g/gcc-8/gcc-8_8.3.0-6.diff.gz' gcc-8_8.3.0-6.diff.gz 704334 SHA256:211e5e1022e115abbcb9eeb39cf4bf84958c4e8469c0cbe430569947a04c5415
```
Other potentially useful URLs:
- https://sources.debian.net/src/gcc-8/8.3.0-6/ (for browsing the source)
- https://sources.debian.net/src/gcc-8/8.3.0-6/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/gcc-8/8.3.0-6/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `glibc=2.28-10`
Binary Packages:
- `libc-bin=2.28-10`
- `libc6:amd64=2.28-10`
Licenses: (parsed from: `/usr/share/doc/libc-bin/copyright`, `/usr/share/doc/libc6/copyright`)
- `GPL-2`
- `LGPL-2.1`
Source:
```console
$ apt-get source -qq --print-uris glibc=2.28-10
'http://deb.debian.org/debian/pool/main/g/glibc/glibc_2.28-10.dsc' glibc_2.28-10.dsc 8889 SHA256:9f21ef7002d51a32b46aafb9ca604427cf28c49495ecbf97e44740f53619ce69
'http://deb.debian.org/debian/pool/main/g/glibc/glibc_2.28.orig.tar.xz' glibc_2.28.orig.tar.xz 17061292 SHA256:53d3c1c7bff0fb25d4c7874bf13435dc44a71fd7dd5ffc9bfdcb513cdfc36854
'http://deb.debian.org/debian/pool/main/g/glibc/glibc_2.28-10.debian.tar.xz' glibc_2.28-10.debian.tar.xz 885796 SHA256:08ca414d8428a252ea357661631885ff72e47afa0663e3811167cc0897dbb042
```
Other potentially useful URLs:
- https://sources.debian.net/src/glibc/2.28-10/ (for browsing the source)
- https://sources.debian.net/src/glibc/2.28-10/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/glibc/2.28-10/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `gmp=2:6.1.2+dfsg-4`
Binary Packages:
- `libgmp10:amd64=2:6.1.2+dfsg-4`
Licenses: (parsed from: `/usr/share/doc/libgmp10/copyright`)
- `GPL`
- `GPL-2`
- `GPL-3`
- `LGPL-3`
Source:
```console
$ apt-get source -qq --print-uris gmp=2:6.1.2+dfsg-4
'http://deb.debian.org/debian/pool/main/g/gmp/gmp_6.1.2%2bdfsg-4.dsc' gmp_6.1.2+dfsg-4.dsc 2123 SHA256:5e9c98e1636344bf0c84710ee564ee6032d6a9db26aa5d29857d65b2a979877c
'http://deb.debian.org/debian/pool/main/g/gmp/gmp_6.1.2%2bdfsg.orig.tar.xz' gmp_6.1.2+dfsg.orig.tar.xz 1804424 SHA256:18016f718f621e7641ddd4e57f8e140391c5183252e5998263ffff59198a65b7
'http://deb.debian.org/debian/pool/main/g/gmp/gmp_6.1.2%2bdfsg-4.debian.tar.xz' gmp_6.1.2+dfsg-4.debian.tar.xz 21416 SHA256:cb25b080d915d9e5a641920f0471b4deb5368af739c7675d887cf290c2cffbe2
```
Other potentially useful URLs:
- https://sources.debian.net/src/gmp/2:6.1.2+dfsg-4/ (for browsing the source)
- https://sources.debian.net/src/gmp/2:6.1.2+dfsg-4/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/gmp/2:6.1.2+dfsg-4/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `gnupg2=2.2.12-1+deb10u1`
Binary Packages:
- `dirmngr=2.2.12-1+deb10u1`
- `gnupg=2.2.12-1+deb10u1`
- `gnupg-l10n=2.2.12-1+deb10u1`
- `gnupg-utils=2.2.12-1+deb10u1`
- `gpg=2.2.12-1+deb10u1`
- `gpg-agent=2.2.12-1+deb10u1`
- `gpg-wks-client=2.2.12-1+deb10u1`
- `gpg-wks-server=2.2.12-1+deb10u1`
- `gpgconf=2.2.12-1+deb10u1`
- `gpgsm=2.2.12-1+deb10u1`
- `gpgv=2.2.12-1+deb10u1`
Licenses: (parsed from: `/usr/share/doc/dirmngr/copyright`, `/usr/share/doc/gnupg/copyright`, `/usr/share/doc/gnupg-l10n/copyright`, `/usr/share/doc/gnupg-utils/copyright`, `/usr/share/doc/gpg/copyright`, `/usr/share/doc/gpg-agent/copyright`, `/usr/share/doc/gpg-wks-client/copyright`, `/usr/share/doc/gpg-wks-server/copyright`, `/usr/share/doc/gpgconf/copyright`, `/usr/share/doc/gpgsm/copyright`, `/usr/share/doc/gpgv/copyright`)
- `BSD-3-clause`
- `CC0-1.0`
- `Expat`
- `GPL-3`
- `GPL-3+`
- `LGPL-2.1`
- `LGPL-2.1+`
- `LGPL-3`
- `LGPL-3+`
- `RFC-Reference`
- `TinySCHEME`
- `permissive`
Source:
```console
$ apt-get source -qq --print-uris gnupg2=2.2.12-1+deb10u1
'http://deb.debian.org/debian/pool/main/g/gnupg2/gnupg2_2.2.12-1%2bdeb10u1.dsc' gnupg2_2.2.12-1+deb10u1.dsc 3261 SHA256:2e1ca8d194593c151228f6b54da51ccd0b17036a532c7724bfcab17594c886ed
'http://deb.debian.org/debian/pool/main/g/gnupg2/gnupg2_2.2.12.orig.tar.bz2' gnupg2_2.2.12.orig.tar.bz2 6682303 SHA256:db030f8b4c98640e91300d36d516f1f4f8fe09514a94ea9fc7411ee1a34082cb
'http://deb.debian.org/debian/pool/main/g/gnupg2/gnupg2_2.2.12.orig.tar.bz2.asc' gnupg2_2.2.12.orig.tar.bz2.asc 3204 SHA256:97c8dc25c4c2fe9a39b2ffd81b65b6f3dc4ad359c9a81ca4bb9b4bdeb6167c60
'http://deb.debian.org/debian/pool/main/g/gnupg2/gnupg2_2.2.12-1%2bdeb10u1.debian.tar.xz' gnupg2_2.2.12-1+deb10u1.debian.tar.xz 123224 SHA256:f8cd4f8a2b63208fd05ae433dc9cb11d2483a72ef057cfe5fcfe2385b7c63f38
```
Other potentially useful URLs:
- https://sources.debian.net/src/gnupg2/2.2.12-1+deb10u1/ (for browsing the source)
- https://sources.debian.net/src/gnupg2/2.2.12-1+deb10u1/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/gnupg2/2.2.12-1+deb10u1/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `gnutls28=3.6.7-4+deb10u7`
Binary Packages:
- `libgnutls30:amd64=3.6.7-4+deb10u7`
Licenses: (parsed from: `/usr/share/doc/libgnutls30/copyright`)
- `Apache-2.0`
- `CC0 license`
- `GFDL-1.3`
- `GPL`
- `GPL-3`
- `GPLv3+`
- `LGPL`
- `LGPL-3`
- `LGPLv3+_or_GPLv2+`
- `The MIT License (MIT)`
- `The main library is licensed under GNU Lesser`
Source:
```console
$ apt-get source -qq --print-uris gnutls28=3.6.7-4+deb10u7
'http://deb.debian.org/debian/pool/main/g/gnutls28/gnutls28_3.6.7-4%2bdeb10u7.dsc' gnutls28_3.6.7-4+deb10u7.dsc 3354 SHA256:dac5aff80109fa5e05f4ab1cb5d402ee9caeefebaa12daf034bcdd7e614af6b2
'http://deb.debian.org/debian/pool/main/g/gnutls28/gnutls28_3.6.7.orig.tar.xz' gnutls28_3.6.7.orig.tar.xz 8153728 SHA256:5b3409ad5aaf239808730d1ee12fdcd148c0be00262c7edf157af655a8a188e2
'http://deb.debian.org/debian/pool/main/g/gnutls28/gnutls28_3.6.7.orig.tar.xz.asc' gnutls28_3.6.7.orig.tar.xz.asc 534 SHA256:a14d0a7b9295b65ae797a70f8e765024a2e363dca03d008bfce0aec2b3f292b0
'http://deb.debian.org/debian/pool/main/g/gnutls28/gnutls28_3.6.7-4%2bdeb10u7.debian.tar.xz' gnutls28_3.6.7-4+deb10u7.debian.tar.xz 94000 SHA256:4f399badd85387e1dd42c811e16d10c4c22196e57142a7325ec44c52b3c6a168
```
Other potentially useful URLs:
- https://sources.debian.net/src/gnutls28/3.6.7-4+deb10u7/ (for browsing the source)
- https://sources.debian.net/src/gnutls28/3.6.7-4+deb10u7/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/gnutls28/3.6.7-4+deb10u7/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `grep=3.3-1`
Binary Packages:
- `grep=3.3-1`
Licenses: (parsed from: `/usr/share/doc/grep/copyright`)
- `GPL-3`
- `GPL-3+`
Source:
```console
$ apt-get source -qq --print-uris grep=3.3-1
'http://deb.debian.org/debian/pool/main/g/grep/grep_3.3-1.dsc' grep_3.3-1.dsc 2038 SHA256:4a019e5634f0a3a15715140fe8639af4cff0f2f7af8cee9b95b0607740ba9b25
'http://deb.debian.org/debian/pool/main/g/grep/grep_3.3.orig.tar.xz' grep_3.3.orig.tar.xz 1473056 SHA256:b960541c499619efd6afe1fa795402e4733c8e11ebf9fafccc0bb4bccdc5b514
'http://deb.debian.org/debian/pool/main/g/grep/grep_3.3-1.debian.tar.xz' grep_3.3-1.debian.tar.xz 104280 SHA256:2cea85fdfe3c70855019c3d9ed9346363137bf3f9931103d9b38514828c8989f
```
Other potentially useful URLs:
- https://sources.debian.net/src/grep/3.3-1/ (for browsing the source)
- https://sources.debian.net/src/grep/3.3-1/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/grep/3.3-1/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `gzip=1.9-3`
Binary Packages:
- `gzip=1.9-3`
Licenses: (parsed from: `/usr/share/doc/gzip/copyright`)
- `GPL`
Source:
```console
$ apt-get source -qq --print-uris gzip=1.9-3
'http://deb.debian.org/debian/pool/main/g/gzip/gzip_1.9-3.dsc' gzip_1.9-3.dsc 1960 SHA256:fb4702653d4d5475db22dc5cb054b7321b9dc2ca2067540e31d9460bc11246c2
'http://deb.debian.org/debian/pool/main/g/gzip/gzip_1.9.orig.tar.gz' gzip_1.9.orig.tar.gz 1181937 SHA256:5d2d3a3432ef32f24cdb060d278834507b481a75adeca18850c73592f778f6ad
'http://deb.debian.org/debian/pool/main/g/gzip/gzip_1.9-3.debian.tar.xz' gzip_1.9-3.debian.tar.xz 14420 SHA256:45996a08643cad9339a30606c9f523984b2f421c6d58e5949471efab75c1ac52
```
Other potentially useful URLs:
- https://sources.debian.net/src/gzip/1.9-3/ (for browsing the source)
- https://sources.debian.net/src/gzip/1.9-3/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/gzip/1.9-3/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `hostname=3.21`
Binary Packages:
- `hostname=3.21`
Licenses: (parsed from: `/usr/share/doc/hostname/copyright`)
- `GPL-2`
Source:
```console
$ apt-get source -qq --print-uris hostname=3.21
'http://deb.debian.org/debian/pool/main/h/hostname/hostname_3.21.dsc' hostname_3.21.dsc 1398 SHA256:8e61f35d7b3e57833d6110ee22a95af6b12e159bf41a5b659e63b21d01e83121
'http://deb.debian.org/debian/pool/main/h/hostname/hostname_3.21.tar.gz' hostname_3.21.tar.gz 13467 SHA256:566193a99f97a58f80b1537efe207c798bb88436c31c7dfc6dd4471d888a4a4f
```
Other potentially useful URLs:
- https://sources.debian.net/src/hostname/3.21/ (for browsing the source)
- https://sources.debian.net/src/hostname/3.21/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/hostname/3.21/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `init-system-helpers=1.56+nmu1`
Binary Packages:
- `init-system-helpers=1.56+nmu1`
Licenses: (parsed from: `/usr/share/doc/init-system-helpers/copyright`)
- `BSD-3-clause`
- `GPL-2`
- `GPL-2+`
Source:
```console
$ apt-get source -qq --print-uris init-system-helpers=1.56+nmu1
'http://deb.debian.org/debian/pool/main/i/init-system-helpers/init-system-helpers_1.56%2bnmu1.dsc' init-system-helpers_1.56+nmu1.dsc 1945 SHA256:96f7d1c696faf801eb5990223b2782dedaf4092efb9b0dcc13d038b91dbb1a51
'http://deb.debian.org/debian/pool/main/i/init-system-helpers/init-system-helpers_1.56%2bnmu1.tar.xz' init-system-helpers_1.56+nmu1.tar.xz 40488 SHA256:ecb5b9a0dbf0b7e83ef41bfc15bf9d41868642d4d5f817a0962aa1b980a56368
```
Other potentially useful URLs:
- https://sources.debian.net/src/init-system-helpers/1.56+nmu1/ (for browsing the source)
- https://sources.debian.net/src/init-system-helpers/1.56+nmu1/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/init-system-helpers/1.56+nmu1/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `iproute2=4.20.0-2+deb10u1`
Binary Packages:
- `iproute2=4.20.0-2+deb10u1`
Licenses: (parsed from: `/usr/share/doc/iproute2/copyright`)
- `GPL-2`
Source:
```console
$ apt-get source -qq --print-uris iproute2=4.20.0-2+deb10u1
'http://deb.debian.org/debian/pool/main/i/iproute2/iproute2_4.20.0-2%2bdeb10u1.dsc' iproute2_4.20.0-2+deb10u1.dsc 1929 SHA256:5d7968a3a021bfdfcf546af5e8fc905aea66d6b5adc923e8d187baddffc4e91f
'http://deb.debian.org/debian/pool/main/i/iproute2/iproute2_4.20.0.orig.tar.xz' iproute2_4.20.0.orig.tar.xz 707016 SHA256:c8adaa6a40f888476b23acb283cfa30c0dd55f07b5aa20663ed5ba2ef1f6fda8
'http://deb.debian.org/debian/pool/main/i/iproute2/iproute2_4.20.0-2%2bdeb10u1.debian.tar.xz' iproute2_4.20.0-2+deb10u1.debian.tar.xz 146688 SHA256:d01f9c4b17519156cc0aadd5103cb38e928ceb3e86efb6b6e7479358794658e3
```
Other potentially useful URLs:
- https://sources.debian.net/src/iproute2/4.20.0-2+deb10u1/ (for browsing the source)
- https://sources.debian.net/src/iproute2/4.20.0-2+deb10u1/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/iproute2/4.20.0-2+deb10u1/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `iptables=1.8.2-4`
Binary Packages:
- `libxtables12:amd64=1.8.2-4`
Licenses: (parsed from: `/usr/share/doc/libxtables12/copyright`)
- `Artistic-2`
- `GPL-2`
- `GPL-2+`
- `custom`
Source:
```console
$ apt-get source -qq --print-uris iptables=1.8.2-4
'http://deb.debian.org/debian/pool/main/i/iptables/iptables_1.8.2-4.dsc' iptables_1.8.2-4.dsc 2699 SHA256:926c91a00c449d7999e5d86e7471ea0591d8fd6633aca3649925aa2fea04273a
'http://deb.debian.org/debian/pool/main/i/iptables/iptables_1.8.2.orig.tar.bz2' iptables_1.8.2.orig.tar.bz2 679858 SHA256:a3778b50ed1a3256f9ca975de82c2204e508001fc2471238c8c97f3d1c4c12af
'http://deb.debian.org/debian/pool/main/i/iptables/iptables_1.8.2-4.debian.tar.xz' iptables_1.8.2-4.debian.tar.xz 65300 SHA256:e6562e368ed7bff8378c1a31ca0d283f15be3a4c68165786dfaa38cc5e9e9e09
```
Other potentially useful URLs:
- https://sources.debian.net/src/iptables/1.8.2-4/ (for browsing the source)
- https://sources.debian.net/src/iptables/1.8.2-4/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/iptables/1.8.2-4/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `iputils=3:20180629-2+deb10u2`
Binary Packages:
- `iputils-ping=3:20180629-2+deb10u2`
Licenses: (parsed from: `/usr/share/doc/iputils-ping/copyright`)
- `GPL`
Source:
```console
$ apt-get source -qq --print-uris iputils=3:20180629-2+deb10u2
'http://deb.debian.org/debian/pool/main/i/iputils/iputils_20180629-2%2bdeb10u2.dsc' iputils_20180629-2+deb10u2.dsc 2125 SHA256:e13bc2f1cc3e306f3075d6fafc48e5615081b5b5a3b05a4679e5b4440b8c962b
'http://deb.debian.org/debian/pool/main/i/iputils/iputils_20180629.orig.tar.bz2' iputils_20180629.orig.tar.bz2 157943 SHA256:1a54fe72d67ac00dae328ddb1952110ee5310ccecbfcb97cbb26d4dedc73fe6d
'http://deb.debian.org/debian/pool/main/i/iputils/iputils_20180629-2%2bdeb10u2.debian.tar.xz' iputils_20180629-2+deb10u2.debian.tar.xz 14144 SHA256:67453f496c473e4b33938bf63b522cf7289242443b9f69243cbdcfb95175b2bb
```
Other potentially useful URLs:
- https://sources.debian.net/src/iputils/3:20180629-2+deb10u2/ (for browsing the source)
- https://sources.debian.net/src/iputils/3:20180629-2+deb10u2/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/iputils/3:20180629-2+deb10u2/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `keyutils=1.6-6`
Binary Packages:
- `libkeyutils1:amd64=1.6-6`
Licenses: (parsed from: `/usr/share/doc/libkeyutils1/copyright`)
- `GPL-2`
- `GPL-2+`
- `LGPL-2`
- `LGPL-2+`
Source:
```console
$ apt-get source -qq --print-uris keyutils=1.6-6
'http://deb.debian.org/debian/pool/main/k/keyutils/keyutils_1.6-6.dsc' keyutils_1.6-6.dsc 2062 SHA256:1da6a0f50759b4eefe210e351558a854e28d312213d5528792af6938f106f183
'http://deb.debian.org/debian/pool/main/k/keyutils/keyutils_1.6.orig.tar.bz2' keyutils_1.6.orig.tar.bz2 93973 SHA256:d3aef20cec0005c0fa6b4be40079885567473185b1a57b629b030e67942c7115
'http://deb.debian.org/debian/pool/main/k/keyutils/keyutils_1.6-6.debian.tar.xz' keyutils_1.6-6.debian.tar.xz 12828 SHA256:063876d3733337aad5e632b013bb8fd85bef85b2285ba7d6c8ab5ac7492ca245
```
Other potentially useful URLs:
- https://sources.debian.net/src/keyutils/1.6-6/ (for browsing the source)
- https://sources.debian.net/src/keyutils/1.6-6/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/keyutils/1.6-6/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `krb5=1.17-3+deb10u3`
Binary Packages:
- `libgssapi-krb5-2:amd64=1.17-3+deb10u3`
- `libk5crypto3:amd64=1.17-3+deb10u3`
- `libkrb5-3:amd64=1.17-3+deb10u3`
- `libkrb5support0:amd64=1.17-3+deb10u3`
Licenses: (parsed from: `/usr/share/doc/libgssapi-krb5-2/copyright`, `/usr/share/doc/libk5crypto3/copyright`, `/usr/share/doc/libkrb5-3/copyright`, `/usr/share/doc/libkrb5support0/copyright`)
- `GPL-2`
Source:
```console
$ apt-get source -qq --print-uris krb5=1.17-3+deb10u3
'http://deb.debian.org/debian/pool/main/k/krb5/krb5_1.17-3%2bdeb10u3.dsc' krb5_1.17-3+deb10u3.dsc 2968 SHA256:002bf39a1c8d410c5acbf20294d31a1ed620e207d589c75e13a568fddd6295ce
'http://deb.debian.org/debian/pool/main/k/krb5/krb5_1.17.orig.tar.gz' krb5_1.17.orig.tar.gz 8761763 SHA256:5a6e2284a53de5702d3dc2be3b9339c963f9b5397d3fbbc53beb249380a781f5
'http://deb.debian.org/debian/pool/main/k/krb5/krb5_1.17-3%2bdeb10u3.debian.tar.xz' krb5_1.17-3+deb10u3.debian.tar.xz 103168 SHA256:12d8d480d5fa1dcec99c8ce0d5e3f249da94ab959829d83ca5ff09376349b1e3
```
Other potentially useful URLs:
- https://sources.debian.net/src/krb5/1.17-3+deb10u3/ (for browsing the source)
- https://sources.debian.net/src/krb5/1.17-3+deb10u3/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/krb5/1.17-3+deb10u3/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `libassuan=2.5.2-1`
Binary Packages:
- `libassuan0:amd64=2.5.2-1`
Licenses: (parsed from: `/usr/share/doc/libassuan0/copyright`)
- `GAP`
- `GAP~FSF`
- `GPL-2`
- `GPL-2+`
- `GPL-2+ with libtool exception`
- `GPL-3`
- `GPL-3+`
- `LGPL-2.1`
- `LGPL-2.1+`
- `LGPL-3`
- `LGPL-3+`
Source:
```console
$ apt-get source -qq --print-uris libassuan=2.5.2-1
'http://deb.debian.org/debian/pool/main/liba/libassuan/libassuan_2.5.2-1.dsc' libassuan_2.5.2-1.dsc 1925 SHA256:534810315ca014673a3cc55a63e393ac02c434a4c51d0aff85c7edbcd60fb6e2
'http://deb.debian.org/debian/pool/main/liba/libassuan/libassuan_2.5.2.orig.tar.bz2' libassuan_2.5.2.orig.tar.bz2 570676 SHA256:986b1bf277e375f7a960450fbb8ffbd45294d06598916ad4ebf79aee0cb788e7
'http://deb.debian.org/debian/pool/main/liba/libassuan/libassuan_2.5.2.orig.tar.bz2.asc' libassuan_2.5.2.orig.tar.bz2.asc 1602 SHA256:b518440a68e4a1177f48c75637d9b4016f1a7c4bc46b820dda120a2d63af77ed
'http://deb.debian.org/debian/pool/main/liba/libassuan/libassuan_2.5.2-1.debian.tar.xz' libassuan_2.5.2-1.debian.tar.xz 11168 SHA256:69c1a189a718b289150cd194b9f558d8b2d190e371c6451e26a89b213f4b54f2
```
Other potentially useful URLs:
- https://sources.debian.net/src/libassuan/2.5.2-1/ (for browsing the source)
- https://sources.debian.net/src/libassuan/2.5.2-1/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/libassuan/2.5.2-1/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `libcap-ng=0.7.9-2`
Binary Packages:
- `libcap-ng0:amd64=0.7.9-2`
Licenses: (parsed from: `/usr/share/doc/libcap-ng0/copyright`)
- `GPL-2`
- `GPL-3`
- `LGPL-2.1`
Source:
```console
$ apt-get source -qq --print-uris libcap-ng=0.7.9-2
'http://deb.debian.org/debian/pool/main/libc/libcap-ng/libcap-ng_0.7.9-2.dsc' libcap-ng_0.7.9-2.dsc 1912 SHA256:e787ebb86a7c9fdcfe429c20f2b17528d084917a34b5efc0022619e1e11572a4
'http://deb.debian.org/debian/pool/main/libc/libcap-ng/libcap-ng_0.7.9.orig.tar.gz' libcap-ng_0.7.9.orig.tar.gz 449038 SHA256:4a1532bcf3731aade40936f6d6a586ed5a66ca4c7455e1338d1f6c3e09221328
'http://deb.debian.org/debian/pool/main/libc/libcap-ng/libcap-ng_0.7.9-2.debian.tar.xz' libcap-ng_0.7.9-2.debian.tar.xz 6220 SHA256:1ce4d5f7ee041b01f254e9d12ae86fef563566871bc457579c70b058b071ae22
```
Other potentially useful URLs:
- https://sources.debian.net/src/libcap-ng/0.7.9-2/ (for browsing the source)
- https://sources.debian.net/src/libcap-ng/0.7.9-2/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/libcap-ng/0.7.9-2/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `libcap2=1:2.25-2`
Binary Packages:
- `libcap2:amd64=1:2.25-2`
- `libcap2-bin=1:2.25-2`
Licenses: (parsed from: `/usr/share/doc/libcap2/copyright`, `/usr/share/doc/libcap2-bin/copyright`)
- `BSD-3-clause`
- `GPL-2`
- `GPL-2+`
Source:
```console
$ apt-get source -qq --print-uris libcap2=1:2.25-2
'http://deb.debian.org/debian/pool/main/libc/libcap2/libcap2_2.25-2.dsc' libcap2_2.25-2.dsc 2196 SHA256:28adc8b721b5a3151afdddc2081149473ec07f362777e25bfc29b3b96ec432f8
'http://deb.debian.org/debian/pool/main/libc/libcap2/libcap2_2.25.orig.tar.xz' libcap2_2.25.orig.tar.xz 63672 SHA256:693c8ac51e983ee678205571ef272439d83afe62dd8e424ea14ad9790bc35162
'http://deb.debian.org/debian/pool/main/libc/libcap2/libcap2_2.25-2.debian.tar.xz' libcap2_2.25-2.debian.tar.xz 24876 SHA256:2581cdcaa27cf7e50b8e9f402a8b35ebbf78dd2697fb96bf78f411cd11110a82
```
Other potentially useful URLs:
- https://sources.debian.net/src/libcap2/1:2.25-2/ (for browsing the source)
- https://sources.debian.net/src/libcap2/1:2.25-2/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/libcap2/1:2.25-2/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `libffi=3.2.1-9`
Binary Packages:
- `libffi6:amd64=3.2.1-9`
Licenses: (parsed from: `/usr/share/doc/libffi6/copyright`)
- `GPL`
Source:
```console
$ apt-get source -qq --print-uris libffi=3.2.1-9
'http://deb.debian.org/debian/pool/main/libf/libffi/libffi_3.2.1-9.dsc' libffi_3.2.1-9.dsc 2000 SHA256:28beaed76f2ce4c6a3ce1527eb07534c8ef4bf624a42c803fea045c416f8faa5
'http://deb.debian.org/debian/pool/main/libf/libffi/libffi_3.2.1.orig.tar.gz' libffi_3.2.1.orig.tar.gz 940837 SHA256:d06ebb8e1d9a22d19e38d63fdb83954253f39bedc5d46232a05645685722ca37
'http://deb.debian.org/debian/pool/main/libf/libffi/libffi_3.2.1-9.debian.tar.xz' libffi_3.2.1-9.debian.tar.xz 17148 SHA256:26e3cfd358733832da251778bc615a42b908d7779cf8b8d7fc2bdee4660bbbce
```
Other potentially useful URLs:
- https://sources.debian.net/src/libffi/3.2.1-9/ (for browsing the source)
- https://sources.debian.net/src/libffi/3.2.1-9/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/libffi/3.2.1-9/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `libgcrypt20=1.8.4-5+deb10u1`
Binary Packages:
- `libgcrypt20:amd64=1.8.4-5+deb10u1`
Licenses: (parsed from: `/usr/share/doc/libgcrypt20/copyright`)
- `GPL-2`
- `LGPL`
Source:
```console
$ apt-get source -qq --print-uris libgcrypt20=1.8.4-5+deb10u1
'http://deb.debian.org/debian/pool/main/libg/libgcrypt20/libgcrypt20_1.8.4-5%2bdeb10u1.dsc' libgcrypt20_1.8.4-5+deb10u1.dsc 2838 SHA256:b81da28242d5516fdd74449a48c67ab11f247070acfb11156d04e19a06cb0e63
'http://deb.debian.org/debian/pool/main/libg/libgcrypt20/libgcrypt20_1.8.4.orig.tar.bz2' libgcrypt20_1.8.4.orig.tar.bz2 2990108 SHA256:f638143a0672628fde0cad745e9b14deb85dffb175709cacc1f4fe24b93f2227
'http://deb.debian.org/debian/pool/main/libg/libgcrypt20/libgcrypt20_1.8.4.orig.tar.bz2.asc' libgcrypt20_1.8.4.orig.tar.bz2.asc 534 SHA256:97df94317ad273cffce4e78ad34ad0664819b44496f6528818a4298a691209a3
'http://deb.debian.org/debian/pool/main/libg/libgcrypt20/libgcrypt20_1.8.4-5%2bdeb10u1.debian.tar.xz' libgcrypt20_1.8.4-5+deb10u1.debian.tar.xz 30712 SHA256:5ab932db1f9c2c9e5d3e86266d020a492bbae845367982a0c7d5ec78abf55027
```
Other potentially useful URLs:
- https://sources.debian.net/src/libgcrypt20/1.8.4-5+deb10u1/ (for browsing the source)
- https://sources.debian.net/src/libgcrypt20/1.8.4-5+deb10u1/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/libgcrypt20/1.8.4-5+deb10u1/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `libgpg-error=1.35-1`
Binary Packages:
- `libgpg-error0:amd64=1.35-1`
Licenses: (parsed from: `/usr/share/doc/libgpg-error0/copyright`)
- `BSD-3-clause`
- `GPL-3`
- `GPL-3+`
- `LGPL-2.1`
- `LGPL-2.1+`
- `g10-permissive`
Source:
```console
$ apt-get source -qq --print-uris libgpg-error=1.35-1
'http://deb.debian.org/debian/pool/main/libg/libgpg-error/libgpg-error_1.35-1.dsc' libgpg-error_1.35-1.dsc 2155 SHA256:1d5e455ea385f522a0cf39510291945d42b95fafc8a1f05537cef3863c1d6c16
'http://deb.debian.org/debian/pool/main/libg/libgpg-error/libgpg-error_1.35.orig.tar.bz2' libgpg-error_1.35.orig.tar.bz2 918408 SHA256:cbd5ee62a8a8c88d48c158fff4fc9ead4132aacd1b4a56eb791f9f997d07e067
'http://deb.debian.org/debian/pool/main/libg/libgpg-error/libgpg-error_1.35.orig.tar.bz2.asc' libgpg-error_1.35.orig.tar.bz2.asc 534 SHA256:f6bfdc64a84245437c443f83faea85407d051d0487550515a4a279573589944d
'http://deb.debian.org/debian/pool/main/libg/libgpg-error/libgpg-error_1.35-1.debian.tar.xz' libgpg-error_1.35-1.debian.tar.xz 16056 SHA256:e600a34c09e6a3e8ec63d6145f4a11b16d92dc0ddeff1ba94cba08a8fecf0b66
```
Other potentially useful URLs:
- https://sources.debian.net/src/libgpg-error/1.35-1/ (for browsing the source)
- https://sources.debian.net/src/libgpg-error/1.35-1/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/libgpg-error/1.35-1/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `libidn2=2.0.5-1+deb10u1`
Binary Packages:
- `libidn2-0:amd64=2.0.5-1+deb10u1`
Licenses: (parsed from: `/usr/share/doc/libidn2-0/copyright`)
- `GPL-2`
- `GPL-2+`
- `GPL-3`
- `GPL-3+`
- `LGPL-3`
- `LGPL-3+`
- `Unicode`
Source:
```console
$ apt-get source -qq --print-uris libidn2=2.0.5-1+deb10u1
'http://deb.debian.org/debian/pool/main/libi/libidn2/libidn2_2.0.5-1%2bdeb10u1.dsc' libidn2_2.0.5-1+deb10u1.dsc 2501 SHA256:6c4eac5dc85983e4cf37ee8deea5e23cfb9e1620f7a94a858726676c8858b498
'http://deb.debian.org/debian/pool/main/libi/libidn2/libidn2_2.0.5.orig.tar.gz' libidn2_2.0.5.orig.tar.gz 2091929 SHA256:53f69170886f1fa6fa5b332439c7a77a7d22626a82ef17e2c1224858bb4ca2b8
'http://deb.debian.org/debian/pool/main/libi/libidn2/libidn2_2.0.5-1%2bdeb10u1.debian.tar.xz' libidn2_2.0.5-1+deb10u1.debian.tar.xz 10286540 SHA256:37cfdc06e4e2f03e932af5bb309cbe94f8466f8b347aa34fa7c1e03a425556b2
```
Other potentially useful URLs:
- https://sources.debian.net/src/libidn2/2.0.5-1+deb10u1/ (for browsing the source)
- https://sources.debian.net/src/libidn2/2.0.5-1+deb10u1/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/libidn2/2.0.5-1+deb10u1/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `libksba=1.3.5-2`
Binary Packages:
- `libksba8:amd64=1.3.5-2`
Licenses: (parsed from: `/usr/share/doc/libksba8/copyright`)
- `GPL-3`
Source:
```console
$ apt-get source -qq --print-uris libksba=1.3.5-2
'http://deb.debian.org/debian/pool/main/libk/libksba/libksba_1.3.5-2.dsc' libksba_1.3.5-2.dsc 2526 SHA256:4fd08fd129f97ab1df86c220b88b7b2c6e4e04aa90bfd3ae364d18022256bef8
'http://deb.debian.org/debian/pool/main/libk/libksba/libksba_1.3.5.orig.tar.bz2' libksba_1.3.5.orig.tar.bz2 620649 SHA256:41444fd7a6ff73a79ad9728f985e71c9ba8cd3e5e53358e70d5f066d35c1a340
'http://deb.debian.org/debian/pool/main/libk/libksba/libksba_1.3.5.orig.tar.bz2.asc' libksba_1.3.5.orig.tar.bz2.asc 287 SHA256:a954b03144ee882c838853da24fd7b6868b78df72a18c71079217d968698a76f
'http://deb.debian.org/debian/pool/main/libk/libksba/libksba_1.3.5-2.debian.tar.xz' libksba_1.3.5-2.debian.tar.xz 13852 SHA256:98c985bff973be1aecc702fa15887ff1e5b8de481d1dc3e99423a587754eaabd
```
Other potentially useful URLs:
- https://sources.debian.net/src/libksba/1.3.5-2/ (for browsing the source)
- https://sources.debian.net/src/libksba/1.3.5-2/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/libksba/1.3.5-2/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `libmnl=1.0.4-2`
Binary Packages:
- `libmnl0:amd64=1.0.4-2`
Licenses: (parsed from: `/usr/share/doc/libmnl0/copyright`)
- `GPL-2`
- `GPL-2+`
- `LGPL-2.1`
Source:
```console
$ apt-get source -qq --print-uris libmnl=1.0.4-2
'http://deb.debian.org/debian/pool/main/libm/libmnl/libmnl_1.0.4-2.dsc' libmnl_1.0.4-2.dsc 1994 SHA256:131106bb7eb4a94fa8e8c135f92c38068d0b42681f166eb159137f171c568630
'http://deb.debian.org/debian/pool/main/libm/libmnl/libmnl_1.0.4.orig.tar.bz2' libmnl_1.0.4.orig.tar.bz2 301270 SHA256:171f89699f286a5854b72b91d06e8f8e3683064c5901fb09d954a9ab6f551f81
'http://deb.debian.org/debian/pool/main/libm/libmnl/libmnl_1.0.4-2.debian.tar.xz' libmnl_1.0.4-2.debian.tar.xz 7512 SHA256:208d62777081ffe6d7dffde0d7370cefb03fe0a6a0486a1b50f6b7b8e9a5b068
```
Other potentially useful URLs:
- https://sources.debian.net/src/libmnl/1.0.4-2/ (for browsing the source)
- https://sources.debian.net/src/libmnl/1.0.4-2/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/libmnl/1.0.4-2/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `libpng1.6=1.6.36-6`
Binary Packages:
- `libpng16-16:amd64=1.6.36-6`
Licenses: (parsed from: `/usr/share/doc/libpng16-16/copyright`)
- `Apache-2.0`
- `BSD-3-clause`
- `BSD-like-with-advertising-clause`
- `GPL-2`
- `GPL-2+`
- `expat`
- `libpng`
- `libpng OR Apache-2.0 OR BSD-3-clause`
Source:
```console
$ apt-get source -qq --print-uris libpng1.6=1.6.36-6
'http://deb.debian.org/debian/pool/main/libp/libpng1.6/libpng1.6_1.6.36-6.dsc' libpng1.6_1.6.36-6.dsc 2219 SHA256:54400844c4631a09ee96f3d3cd1907da7fd4ba053b5d66dc93d9c334d520bc16
'http://deb.debian.org/debian/pool/main/libp/libpng1.6/libpng1.6_1.6.36.orig.tar.xz' libpng1.6_1.6.36.orig.tar.xz 1012544 SHA256:eceb924c1fa6b79172fdfd008d335f0e59172a86a66481e09d4089df872aa319
'http://deb.debian.org/debian/pool/main/libp/libpng1.6/libpng1.6_1.6.36-6.debian.tar.xz' libpng1.6_1.6.36-6.debian.tar.xz 38376 SHA256:69751c1d45b319237144f536385a6cc05c8d852d83170d7f7f322474e04b94b0
```
Other potentially useful URLs:
- https://sources.debian.net/src/libpng1.6/1.6.36-6/ (for browsing the source)
- https://sources.debian.net/src/libpng1.6/1.6.36-6/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/libpng1.6/1.6.36-6/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `libpsl=0.20.2-2`
Binary Packages:
- `libpsl5:amd64=0.20.2-2`
Licenses: (parsed from: `/usr/share/doc/libpsl5/copyright`)
- `Chromium`
- `MIT`
Source:
```console
$ apt-get source -qq --print-uris libpsl=0.20.2-2
'http://deb.debian.org/debian/pool/main/libp/libpsl/libpsl_0.20.2-2.dsc' libpsl_0.20.2-2.dsc 1637 SHA256:ae401852522d748f1222b91734bc5bd7c6db0de843dd675adc180f2a1884c94d
'http://deb.debian.org/debian/pool/main/libp/libpsl/libpsl_0.20.2.orig.tar.gz' libpsl_0.20.2.orig.tar.gz 8590430 SHA256:94d2b5e00e9aa761ae7efbaa67edc00d5298487ed9706eb4789e349012993c31
'http://deb.debian.org/debian/pool/main/libp/libpsl/libpsl_0.20.2-2.debian.tar.xz' libpsl_0.20.2-2.debian.tar.xz 9920 SHA256:1f008454fdb973964202020fb700d5028e001b7eaa4e77eeab8ebc99b749ea51
```
Other potentially useful URLs:
- https://sources.debian.net/src/libpsl/0.20.2-2/ (for browsing the source)
- https://sources.debian.net/src/libpsl/0.20.2-2/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/libpsl/0.20.2-2/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `libseccomp=2.3.3-4`
Binary Packages:
- `libseccomp2:amd64=2.3.3-4`
Licenses: (parsed from: `/usr/share/doc/libseccomp2/copyright`)
- `LGPL-2.1`
Source:
```console
$ apt-get source -qq --print-uris libseccomp=2.3.3-4
'http://deb.debian.org/debian/pool/main/libs/libseccomp/libseccomp_2.3.3-4.dsc' libseccomp_2.3.3-4.dsc 2500 SHA256:1443086c253ffacdad635aeb27a37b21958119833782290ae868b897eb9f6ab0
'http://deb.debian.org/debian/pool/main/libs/libseccomp/libseccomp_2.3.3.orig.tar.gz' libseccomp_2.3.3.orig.tar.gz 564546 SHA256:7fc28f4294cc72e61c529bedf97e705c3acf9c479a8f1a3028d4cd2ca9f3b155
'http://deb.debian.org/debian/pool/main/libs/libseccomp/libseccomp_2.3.3-4.debian.tar.xz' libseccomp_2.3.3-4.debian.tar.xz 12104 SHA256:deab2e069e145bf31d0a5569ad3adb2b94217623e02a25d4c9fa0d298073769e
```
Other potentially useful URLs:
- https://sources.debian.net/src/libseccomp/2.3.3-4/ (for browsing the source)
- https://sources.debian.net/src/libseccomp/2.3.3-4/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/libseccomp/2.3.3-4/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `libselinux=2.8-1`
Binary Packages:
- `libselinux1:amd64=2.8-1+b1`
Licenses: (parsed from: `/usr/share/doc/libselinux1/copyright`)
- `GPL-2`
- `LGPL-2.1`
Source:
```console
$ apt-get source -qq --print-uris libselinux=2.8-1
'http://deb.debian.org/debian/pool/main/libs/libselinux/libselinux_2.8-1.dsc' libselinux_2.8-1.dsc 2347 SHA256:0f08d64f4488312a8e8b7ffb12771cd385560752473a2e585449edc27223c129
'http://deb.debian.org/debian/pool/main/libs/libselinux/libselinux_2.8.orig.tar.gz' libselinux_2.8.orig.tar.gz 187759 SHA256:31db96ec7643ce10912b3c3f98506a08a9116dcfe151855fd349c3fda96187e1
'http://deb.debian.org/debian/pool/main/libs/libselinux/libselinux_2.8-1.debian.tar.xz' libselinux_2.8-1.debian.tar.xz 23052 SHA256:a0b150e870a3da7e1d7b0fec7c1a5ae6988a0985e545c69cfe8fe05363c5bf64
```
Other potentially useful URLs:
- https://sources.debian.net/src/libselinux/2.8-1/ (for browsing the source)
- https://sources.debian.net/src/libselinux/2.8-1/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/libselinux/2.8-1/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `libsemanage=2.8-2`
Binary Packages:
- `libsemanage-common=2.8-2`
- `libsemanage1:amd64=2.8-2`
Licenses: (parsed from: `/usr/share/doc/libsemanage-common/copyright`, `/usr/share/doc/libsemanage1/copyright`)
- `GPL`
- `LGPL`
Source:
```console
$ apt-get source -qq --print-uris libsemanage=2.8-2
'http://deb.debian.org/debian/pool/main/libs/libsemanage/libsemanage_2.8-2.dsc' libsemanage_2.8-2.dsc 2434 SHA256:f7cbe0594c098808a449804a357159bec4db54389df0319c2b5306b10ec2e707
'http://deb.debian.org/debian/pool/main/libs/libsemanage/libsemanage_2.8.orig.tar.gz' libsemanage_2.8.orig.tar.gz 154200 SHA256:1c0de8d2c51e5460926c21e371105c84a39087dfd8f8e9f0cc1d017e4cbea8e2
'http://deb.debian.org/debian/pool/main/libs/libsemanage/libsemanage_2.8-2.debian.tar.xz' libsemanage_2.8-2.debian.tar.xz 17756 SHA256:02315ffeb2b0a24b7c3bc8fa0c0e1e217e4a7b284bb88f64b0bf613e76d125e2
```
Other potentially useful URLs:
- https://sources.debian.net/src/libsemanage/2.8-2/ (for browsing the source)
- https://sources.debian.net/src/libsemanage/2.8-2/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/libsemanage/2.8-2/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `libsepol=2.8-1`
Binary Packages:
- `libsepol1:amd64=2.8-1`
Licenses: (parsed from: `/usr/share/doc/libsepol1/copyright`)
- `GPL`
- `LGPL`
Source:
```console
$ apt-get source -qq --print-uris libsepol=2.8-1
'http://deb.debian.org/debian/pool/main/libs/libsepol/libsepol_2.8-1.dsc' libsepol_2.8-1.dsc 1792 SHA256:37b0b79ab0f7533c194272809ccb3f3c5ff788536f66254c0d405e2e8b2b270e
'http://deb.debian.org/debian/pool/main/libs/libsepol/libsepol_2.8.orig.tar.gz' libsepol_2.8.orig.tar.gz 473384 SHA256:3ad6916a8352bef0bad49acc8037a5f5b48c56f94e4cb4e1959ca475fa9d24d6
'http://deb.debian.org/debian/pool/main/libs/libsepol/libsepol_2.8-1.debian.tar.xz' libsepol_2.8-1.debian.tar.xz 14076 SHA256:7b8d0b47396c96830754db2e5b679d294486aeffd93cfd21ac68202031374a00
```
Other potentially useful URLs:
- https://sources.debian.net/src/libsepol/2.8-1/ (for browsing the source)
- https://sources.debian.net/src/libsepol/2.8-1/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/libsepol/2.8-1/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `libssh2=1.8.0-2.1`
Binary Packages:
- `libssh2-1:amd64=1.8.0-2.1`
Licenses: (parsed from: `/usr/share/doc/libssh2-1/copyright`)
- `BSD3`
Source:
```console
$ apt-get source -qq --print-uris libssh2=1.8.0-2.1
'http://deb.debian.org/debian/pool/main/libs/libssh2/libssh2_1.8.0-2.1.dsc' libssh2_1.8.0-2.1.dsc 1958 SHA256:33f070a4a32db5d3952457986d8f80c9cf874dd144d81f5bce062171564b35d9
'http://deb.debian.org/debian/pool/main/libs/libssh2/libssh2_1.8.0.orig.tar.gz' libssh2_1.8.0.orig.tar.gz 846989 SHA256:4382d33de790b28f862e53ed59ffbd65f3def7a06e8b6e9ca1b6f70453b4d5e0
'http://deb.debian.org/debian/pool/main/libs/libssh2/libssh2_1.8.0-2.1.debian.tar.xz' libssh2_1.8.0-2.1.debian.tar.xz 13988 SHA256:e3c34166cddaba7f2162132ef4f4bdc1490c499ee6610bde81f773adef43489e
```
Other potentially useful URLs:
- https://sources.debian.net/src/libssh2/1.8.0-2.1/ (for browsing the source)
- https://sources.debian.net/src/libssh2/1.8.0-2.1/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/libssh2/1.8.0-2.1/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `libtasn1-6=4.13-3`
Binary Packages:
- `libtasn1-6:amd64=4.13-3`
Licenses: (parsed from: `/usr/share/doc/libtasn1-6/copyright`)
- `GFDL-1.3`
- `GPL-3`
- `LGPL`
- `LGPL-2.1`
Source:
```console
$ apt-get source -qq --print-uris libtasn1-6=4.13-3
'http://deb.debian.org/debian/pool/main/libt/libtasn1-6/libtasn1-6_4.13-3.dsc' libtasn1-6_4.13-3.dsc 2574 SHA256:15a984daba0bc64819a1203cd28a1e869a30e0edde227237e4cdcfbc86131227
'http://deb.debian.org/debian/pool/main/libt/libtasn1-6/libtasn1-6_4.13.orig.tar.gz' libtasn1-6_4.13.orig.tar.gz 1891703 SHA256:7e528e8c317ddd156230c4e31d082cd13e7ddeb7a54824be82632209550c8cca
'http://deb.debian.org/debian/pool/main/libt/libtasn1-6/libtasn1-6_4.13.orig.tar.gz.asc' libtasn1-6_4.13.orig.tar.gz.asc 774 SHA256:90261376528edf44831d1369847088cc2fb48669860d343961daca42e674b226
'http://deb.debian.org/debian/pool/main/libt/libtasn1-6/libtasn1-6_4.13-3.debian.tar.xz' libtasn1-6_4.13-3.debian.tar.xz 63384 SHA256:1428c31d3d900d8fa1946fc29d9d2839c73c7a4c0ebff7a2571c134aef53c310
```
Other potentially useful URLs:
- https://sources.debian.net/src/libtasn1-6/4.13-3/ (for browsing the source)
- https://sources.debian.net/src/libtasn1-6/4.13-3/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/libtasn1-6/4.13-3/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `libunistring=0.9.10-1`
Binary Packages:
- `libunistring2:amd64=0.9.10-1`
Licenses: (parsed from: `/usr/share/doc/libunistring2/copyright`)
- `FreeSoftware`
- `GFDL-1.2`
- `GFDL-1.2+`
- `GPL-2`
- `GPL-2+`
- `GPL-2+ with distribution exception`
- `GPL-3`
- `GPL-3+`
- `LGPL-3`
- `LGPL-3+`
- `MIT`
Source:
```console
$ apt-get source -qq --print-uris libunistring=0.9.10-1
'http://deb.debian.org/debian/pool/main/libu/libunistring/libunistring_0.9.10-1.dsc' libunistring_0.9.10-1.dsc 2206 SHA256:2118b96b1125399556bd95b8917cd559c4e9afe8d85861b01435f9635cefcdf2
'http://deb.debian.org/debian/pool/main/libu/libunistring/libunistring_0.9.10.orig.tar.xz' libunistring_0.9.10.orig.tar.xz 2051320 SHA256:eb8fb2c3e4b6e2d336608377050892b54c3c983b646c561836550863003c05d7
'http://deb.debian.org/debian/pool/main/libu/libunistring/libunistring_0.9.10.orig.tar.xz.asc' libunistring_0.9.10.orig.tar.xz.asc 1310 SHA256:e1606f691034fa21b00e08269622743547c16d21cca6c8a64156b4774a49e78e
'http://deb.debian.org/debian/pool/main/libu/libunistring/libunistring_0.9.10-1.debian.tar.xz' libunistring_0.9.10-1.debian.tar.xz 40328 SHA256:dd4d07437e6332003e702aa2f56911a21091ac6f10d0cdc17aaaaa8e29ad63b7
```
Other potentially useful URLs:
- https://sources.debian.net/src/libunistring/0.9.10-1/ (for browsing the source)
- https://sources.debian.net/src/libunistring/0.9.10-1/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/libunistring/0.9.10-1/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `libzstd=1.3.8+dfsg-3+deb10u2`
Binary Packages:
- `libzstd1:amd64=1.3.8+dfsg-3+deb10u2`
Licenses: (parsed from: `/usr/share/doc/libzstd1/copyright`)
- `BSD-3-clause`
- `Expat`
- `GPL-2`
- `GPL-2+`
- `zlib`
Source:
```console
$ apt-get source -qq --print-uris libzstd=1.3.8+dfsg-3+deb10u2
'http://deb.debian.org/debian/pool/main/libz/libzstd/libzstd_1.3.8%2bdfsg-3%2bdeb10u2.dsc' libzstd_1.3.8+dfsg-3+deb10u2.dsc 1947 SHA256:572fae1c7dc9bace3b9f7fcdeabf30dd1d00d0462e319ccec7b58b0adbf7dc85
'http://deb.debian.org/debian/pool/main/libz/libzstd/libzstd_1.3.8%2bdfsg.orig.tar.xz' libzstd_1.3.8+dfsg.orig.tar.xz 1299276 SHA256:03851f2c26ffbf1d43633df3f98966f3c62e698e91ef4dc90523915bc934e5f7
'http://deb.debian.org/debian/pool/main/libz/libzstd/libzstd_1.3.8%2bdfsg-3%2bdeb10u2.debian.tar.xz' libzstd_1.3.8+dfsg-3+deb10u2.debian.tar.xz 11648 SHA256:1f107f6cdc3bf46fb2aebf9c5c997ed2a125ac2fb1d28e939da857d5b061079e
```
Other potentially useful URLs:
- https://sources.debian.net/src/libzstd/1.3.8+dfsg-3+deb10u2/ (for browsing the source)
- https://sources.debian.net/src/libzstd/1.3.8+dfsg-3+deb10u2/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/libzstd/1.3.8+dfsg-3+deb10u2/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `lsb=10.2019051400`
Binary Packages:
- `lsb-base=10.2019051400`
Licenses: (parsed from: `/usr/share/doc/lsb-base/copyright`)
- `BSD-3-clause`
- `GPL-2`
Source:
```console
$ apt-get source -qq --print-uris lsb=10.2019051400
'http://deb.debian.org/debian/pool/main/l/lsb/lsb_10.2019051400.dsc' lsb_10.2019051400.dsc 1695 SHA256:79be4b76a50edb2e2f0fb0f2301d74aa36be7e4ed1aedc2cb92e0ca93a97e194
'http://deb.debian.org/debian/pool/main/l/lsb/lsb_10.2019051400.tar.xz' lsb_10.2019051400.tar.xz 42204 SHA256:e134c5780b70e3aac9d175e70bee4eb187e01bc02bb0d4e8a9b19dc52aabd557
```
Other potentially useful URLs:
- https://sources.debian.net/src/lsb/10.2019051400/ (for browsing the source)
- https://sources.debian.net/src/lsb/10.2019051400/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/lsb/10.2019051400/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `lz4=1.8.3-1+deb10u1`
Binary Packages:
- `liblz4-1:amd64=1.8.3-1+deb10u1`
Licenses: (parsed from: `/usr/share/doc/liblz4-1/copyright`)
- `BSD-2-clause`
- `GPL-2`
- `GPL-2+`
Source:
```console
$ apt-get source -qq --print-uris lz4=1.8.3-1+deb10u1
'http://deb.debian.org/debian/pool/main/l/lz4/lz4_1.8.3-1%2bdeb10u1.dsc' lz4_1.8.3-1+deb10u1.dsc 2119 SHA256:22a32d93f1e1525efd33e80b8c8ffb9ad74b5baf441aa3534e875523d9b5eb93
'http://deb.debian.org/debian/pool/main/l/lz4/lz4_1.8.3.orig.tar.gz' lz4_1.8.3.orig.tar.gz 327897 SHA256:33af5936ac06536805f9745e0b6d61da606a1f8b4cc5c04dd3cbaca3b9b4fc43
'http://deb.debian.org/debian/pool/main/l/lz4/lz4_1.8.3-1%2bdeb10u1.debian.tar.xz' lz4_1.8.3-1+deb10u1.debian.tar.xz 12068 SHA256:6d9896c90c93f312af743b2c6ea1b62ba8defe8696acf7a009bed03b012db60a
```
Other potentially useful URLs:
- https://sources.debian.net/src/lz4/1.8.3-1+deb10u1/ (for browsing the source)
- https://sources.debian.net/src/lz4/1.8.3-1+deb10u1/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/lz4/1.8.3-1+deb10u1/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `mawk=1.3.3-17`
Binary Packages:
- `mawk=1.3.3-17+b3`
Licenses: (parsed from: `/usr/share/doc/mawk/copyright`)
- `GPL-2`
Source:
```console
$ apt-get source -qq --print-uris mawk=1.3.3-17
'http://deb.debian.org/debian/pool/main/m/mawk/mawk_1.3.3-17.dsc' mawk_1.3.3-17.dsc 1801 SHA256:f98ce6e153e8ac1faf8165bbf77447a4279313f1c18f6bfeec0c5ce35e4b9c03
'http://deb.debian.org/debian/pool/main/m/mawk/mawk_1.3.3.orig.tar.gz' mawk_1.3.3.orig.tar.gz 209942 SHA256:32649c46063d4ef0777a12ae6e9a26bcc920833d54e1abca7edb8d37481e7485
'http://deb.debian.org/debian/pool/main/m/mawk/mawk_1.3.3-17.diff.gz' mawk_1.3.3-17.diff.gz 63506 SHA256:13cb66b6eb5ee654d5626621d5ef476ede6b0bebac18ce765516de810e58490c
```
Other potentially useful URLs:
- https://sources.debian.net/src/mawk/1.3.3-17/ (for browsing the source)
- https://sources.debian.net/src/mawk/1.3.3-17/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/mawk/1.3.3-17/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `ncurses=6.1+20181013-2+deb10u2`
Binary Packages:
- `libncursesw6:amd64=6.1+20181013-2+deb10u2`
- `libtinfo6:amd64=6.1+20181013-2+deb10u2`
- `ncurses-base=6.1+20181013-2+deb10u2`
- `ncurses-bin=6.1+20181013-2+deb10u2`
**WARNING:** unable to detect licenses! (package likely not compliant with DEP-5)
If source is available (seen below), check the contents of `debian/copyright` within it.
Source:
```console
$ apt-get source -qq --print-uris ncurses=6.1+20181013-2+deb10u2
'http://deb.debian.org/debian/pool/main/n/ncurses/ncurses_6.1%2b20181013-2%2bdeb10u2.dsc' ncurses_6.1+20181013-2+deb10u2.dsc 4179 SHA256:8318631ff3298951a93d6dd6c20bd47c9e5fdaaf30578d541bd6404bdd5317ea
'http://deb.debian.org/debian/pool/main/n/ncurses/ncurses_6.1%2b20181013.orig.tar.gz' ncurses_6.1+20181013.orig.tar.gz 3411288 SHA256:aeb1d098ee90b39a763b57b00da19ff5bbb573dea077f98fbd85d59444bb3b59
'http://deb.debian.org/debian/pool/main/n/ncurses/ncurses_6.1%2b20181013.orig.tar.gz.asc' ncurses_6.1+20181013.orig.tar.gz.asc 251 SHA256:865931406e519909a4d0ab87b14d0c6d3ebccb7b3e0dac5c6095f0dfce5e14cf
'http://deb.debian.org/debian/pool/main/n/ncurses/ncurses_6.1%2b20181013-2%2bdeb10u2.debian.tar.xz' ncurses_6.1+20181013-2+deb10u2.debian.tar.xz 61664 SHA256:4574ec11ce2577e76f30f8d40cc2a9ebf94d8208f47247021da88b7b09e77df9
```
Other potentially useful URLs:
- https://sources.debian.net/src/ncurses/6.1+20181013-2+deb10u2/ (for browsing the source)
- https://sources.debian.net/src/ncurses/6.1+20181013-2+deb10u2/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/ncurses/6.1+20181013-2+deb10u2/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `netbase=5.6`
Binary Packages:
- `netbase=5.6`
Licenses: (parsed from: `/usr/share/doc/netbase/copyright`)
- `GPL-2`
Source:
```console
$ apt-get source -qq --print-uris netbase=5.6
'http://deb.debian.org/debian/pool/main/n/netbase/netbase_5.6.dsc' netbase_5.6.dsc 1306 SHA256:fea82cc64b508a8f5ff3a16dfadce1660468d0a347df5c0ff56a2caaa57668a6
'http://deb.debian.org/debian/pool/main/n/netbase/netbase_5.6.tar.xz' netbase_5.6.tar.xz 31684 SHA256:5d93a099deb28869b7306e914700fafbd293b55bdb5df05a5aa6effd0af5930c
```
Other potentially useful URLs:
- https://sources.debian.net/src/netbase/5.6/ (for browsing the source)
- https://sources.debian.net/src/netbase/5.6/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/netbase/5.6/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `nettle=3.4.1-1+deb10u1`
Binary Packages:
- `libhogweed4:amd64=3.4.1-1+deb10u1`
- `libnettle6:amd64=3.4.1-1+deb10u1`
Licenses: (parsed from: `/usr/share/doc/libhogweed4/copyright`, `/usr/share/doc/libnettle6/copyright`)
- `GAP`
- `GPL`
- `GPL-2`
- `GPL-2+`
- `GPL-2+ with Autoconf exception`
- `LGPL`
- `LGPL-2`
- `LGPL-2+`
- `LGPL-2.1+`
- `other`
- `public-domain`
Source:
```console
$ apt-get source -qq --print-uris nettle=3.4.1-1+deb10u1
'http://deb.debian.org/debian/pool/main/n/nettle/nettle_3.4.1-1%2bdeb10u1.dsc' nettle_3.4.1-1+deb10u1.dsc 2290 SHA256:b38c9a78ae0732a94d06dbc811479f6ee8357bd47604dfa92f0d0801b148eebc
'http://deb.debian.org/debian/pool/main/n/nettle/nettle_3.4.1.orig.tar.gz' nettle_3.4.1.orig.tar.gz 1947053 SHA256:f941cf1535cd5d1819be5ccae5babef01f6db611f9b5a777bae9c7604b8a92ad
'http://deb.debian.org/debian/pool/main/n/nettle/nettle_3.4.1.orig.tar.gz.asc' nettle_3.4.1.orig.tar.gz.asc 2476 SHA256:07b265366b46bc67950da3f34687235eaa85c45b326e42bb7c9b58830b651d28
'http://deb.debian.org/debian/pool/main/n/nettle/nettle_3.4.1-1%2bdeb10u1.debian.tar.xz' nettle_3.4.1-1+deb10u1.debian.tar.xz 26508 SHA256:b847de5ccd50b9bc0aa56dd7fe750c224683174676dde69c86f62bece52ff4ba
```
Other potentially useful URLs:
- https://sources.debian.net/src/nettle/3.4.1-1+deb10u1/ (for browsing the source)
- https://sources.debian.net/src/nettle/3.4.1-1+deb10u1/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/nettle/3.4.1-1+deb10u1/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `nghttp2=1.36.0-2+deb10u1`
Binary Packages:
- `libnghttp2-14:amd64=1.36.0-2+deb10u1`
Licenses: (parsed from: `/usr/share/doc/libnghttp2-14/copyright`)
- `BSD-2-clause`
- `Expat`
- `GPL-3`
- `GPL-3+ with autoconf exception`
- `MIT`
- `SIL-OFL-1.1`
- `all-permissive`
Source:
```console
$ apt-get source -qq --print-uris nghttp2=1.36.0-2+deb10u1
'http://deb.debian.org/debian/pool/main/n/nghttp2/nghttp2_1.36.0-2%2bdeb10u1.dsc' nghttp2_1.36.0-2+deb10u1.dsc 2601 SHA256:3712e7cbb20d1b43f8f7a9c5408b79bd80e4c3c0cb2d4ad68062d367b1715fd6
'http://deb.debian.org/debian/pool/main/n/nghttp2/nghttp2_1.36.0.orig.tar.bz2' nghttp2_1.36.0.orig.tar.bz2 1919021 SHA256:16a734d7414062911e23989e243ca76e7722cb3c60273723e3e3ae4c21e71ceb
'http://deb.debian.org/debian/pool/main/n/nghttp2/nghttp2_1.36.0-2%2bdeb10u1.debian.tar.xz' nghttp2_1.36.0-2+deb10u1.debian.tar.xz 13132 SHA256:f4fb4dd2385d158efba2ec3d3ce1b13c24ecb05c75f353f370f7cb0f080c7537
```
Other potentially useful URLs:
- https://sources.debian.net/src/nghttp2/1.36.0-2+deb10u1/ (for browsing the source)
- https://sources.debian.net/src/nghttp2/1.36.0-2+deb10u1/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/nghttp2/1.36.0-2+deb10u1/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `npth=1.6-1`
Binary Packages:
- `libnpth0:amd64=1.6-1`
Licenses: (parsed from: `/usr/share/doc/libnpth0/copyright`)
- `LGPL-2.1`
- `LGPL-2.1+`
Source:
```console
$ apt-get source -qq --print-uris npth=1.6-1
'http://deb.debian.org/debian/pool/main/n/npth/npth_1.6-1.dsc' npth_1.6-1.dsc 1925 SHA256:2c327ce494f702482e79ed620445cba303c4449dd0768fecee3ee7d5ade2544a
'http://deb.debian.org/debian/pool/main/n/npth/npth_1.6.orig.tar.bz2' npth_1.6.orig.tar.bz2 300486 SHA256:1393abd9adcf0762d34798dc34fdcf4d0d22a8410721e76f1e3afcd1daa4e2d1
'http://deb.debian.org/debian/pool/main/n/npth/npth_1.6-1.debian.tar.xz' npth_1.6-1.debian.tar.xz 10532 SHA256:d312d4a3cf1d082e2f2cf3ea752c41d34f7e120f77a941c6c1680e6093834353
```
Other potentially useful URLs:
- https://sources.debian.net/src/npth/1.6-1/ (for browsing the source)
- https://sources.debian.net/src/npth/1.6-1/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/npth/1.6-1/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `openldap=2.4.47+dfsg-3+deb10u6`
Binary Packages:
- `libldap-2.4-2:amd64=2.4.47+dfsg-3+deb10u6`
- `libldap-common=2.4.47+dfsg-3+deb10u6`
**WARNING:** unable to detect licenses! (package likely not compliant with DEP-5)
If source is available (seen below), check the contents of `debian/copyright` within it.
Source:
```console
$ apt-get source -qq --print-uris openldap=2.4.47+dfsg-3+deb10u6
'http://deb.debian.org/debian/pool/main/o/openldap/openldap_2.4.47%2bdfsg-3%2bdeb10u6.dsc' openldap_2.4.47+dfsg-3+deb10u6.dsc 3022 SHA256:14f48c8d0ffddaaf51edf064d9abe90d6f7466c710d6e78c520db48998eaebb0
'http://deb.debian.org/debian/pool/main/o/openldap/openldap_2.4.47%2bdfsg.orig.tar.gz' openldap_2.4.47+dfsg.orig.tar.gz 4872293 SHA256:8f1ac7a4be7dd8ef158361efbfe16509756d3d9b396f5f378c3cf5c727807651
'http://deb.debian.org/debian/pool/main/o/openldap/openldap_2.4.47%2bdfsg-3%2bdeb10u6.debian.tar.xz' openldap_2.4.47+dfsg-3+deb10u6.debian.tar.xz 173600 SHA256:d21ccc7d2fc3b38dd68e8f4dd73bcff51d377e4ad47e6372ea4f806729856b79
```
Other potentially useful URLs:
- https://sources.debian.net/src/openldap/2.4.47+dfsg-3+deb10u6/ (for browsing the source)
- https://sources.debian.net/src/openldap/2.4.47+dfsg-3+deb10u6/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/openldap/2.4.47+dfsg-3+deb10u6/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `openssl=1.1.1d-0+deb10u7`
Binary Packages:
- `libssl1.1:amd64=1.1.1d-0+deb10u7`
- `openssl=1.1.1d-0+deb10u7`
**WARNING:** unable to detect licenses! (package likely not compliant with DEP-5)
If source is available (seen below), check the contents of `debian/copyright` within it.
Source:
```console
$ apt-get source -qq --print-uris openssl=1.1.1d-0+deb10u7
'http://deb.debian.org/debian/pool/main/o/openssl/openssl_1.1.1d-0%2bdeb10u7.dsc' openssl_1.1.1d-0+deb10u7.dsc 2649 SHA256:1cb63c67aedf26f139124e4a9ec5d51fa036948df3964805070da7b816b14581
'http://deb.debian.org/debian/pool/main/o/openssl/openssl_1.1.1d.orig.tar.gz' openssl_1.1.1d.orig.tar.gz 8845861 SHA256:1e3a91bc1f9dfce01af26026f856e064eab4c8ee0a8f457b5ae30b40b8b711f2
'http://deb.debian.org/debian/pool/main/o/openssl/openssl_1.1.1d.orig.tar.gz.asc' openssl_1.1.1d.orig.tar.gz.asc 488 SHA256:f3fd3299a79421fffd51d35f62636b8e987dab1d3033d93a19d7685868e15395
'http://deb.debian.org/debian/pool/main/o/openssl/openssl_1.1.1d-0%2bdeb10u7.debian.tar.xz' openssl_1.1.1d-0+deb10u7.debian.tar.xz 109236 SHA256:8a84cb76bf14a6725ee6b56d76335adadc639513d7c15b24b041fbb5f80cf053
```
Other potentially useful URLs:
- https://sources.debian.net/src/openssl/1.1.1d-0+deb10u7/ (for browsing the source)
- https://sources.debian.net/src/openssl/1.1.1d-0+deb10u7/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/openssl/1.1.1d-0+deb10u7/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `p11-kit=0.23.15-2+deb10u1`
Binary Packages:
- `libp11-kit0:amd64=0.23.15-2+deb10u1`
- `p11-kit=0.23.15-2+deb10u1`
- `p11-kit-modules:amd64=0.23.15-2+deb10u1`
Licenses: (parsed from: `/usr/share/doc/libp11-kit0/copyright`, `/usr/share/doc/p11-kit/copyright`, `/usr/share/doc/p11-kit-modules/copyright`)
- `BSD-3-Clause`
- `ISC`
- `ISC+IBM`
- `permissive-like-automake-output`
- `same-as-rest-of-p11kit`
Source:
```console
$ apt-get source -qq --print-uris p11-kit=0.23.15-2+deb10u1
'http://deb.debian.org/debian/pool/main/p/p11-kit/p11-kit_0.23.15-2%2bdeb10u1.dsc' p11-kit_0.23.15-2+deb10u1.dsc 2607 SHA256:d0c7215905c92f521b7b5a4dd98e2ad85abd40a05430dcf2a17dcc3e21f96389
'http://deb.debian.org/debian/pool/main/p/p11-kit/p11-kit_0.23.15.orig.tar.gz' p11-kit_0.23.15.orig.tar.gz 1276733 SHA256:f7c139a0c77a1f0012619003e542060ba8f94799a0ef463026db390680e4d798
'http://deb.debian.org/debian/pool/main/p/p11-kit/p11-kit_0.23.15.orig.tar.gz.asc' p11-kit_0.23.15.orig.tar.gz.asc 879 SHA256:e28bd948178e2f91e18fbb4387d7b6532aa44eb92ac4c67a6485bc9cd9c79db8
'http://deb.debian.org/debian/pool/main/p/p11-kit/p11-kit_0.23.15-2%2bdeb10u1.debian.tar.xz' p11-kit_0.23.15-2+deb10u1.debian.tar.xz 25496 SHA256:9f90af175ef68fdb3aca71f22074fa1860f88a820e29e1290ee51d606c53b572
```
Other potentially useful URLs:
- https://sources.debian.net/src/p11-kit/0.23.15-2+deb10u1/ (for browsing the source)
- https://sources.debian.net/src/p11-kit/0.23.15-2+deb10u1/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/p11-kit/0.23.15-2+deb10u1/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `pam=1.3.1-5`
Binary Packages:
- `libpam-modules:amd64=1.3.1-5`
- `libpam-modules-bin=1.3.1-5`
- `libpam-runtime=1.3.1-5`
- `libpam0g:amd64=1.3.1-5`
Licenses: (parsed from: `/usr/share/doc/libpam-modules/copyright`, `/usr/share/doc/libpam-modules-bin/copyright`, `/usr/share/doc/libpam-runtime/copyright`, `/usr/share/doc/libpam0g/copyright`)
- `GPL`
Source:
```console
$ apt-get source -qq --print-uris pam=1.3.1-5
'http://deb.debian.org/debian/pool/main/p/pam/pam_1.3.1-5.dsc' pam_1.3.1-5.dsc 2648 SHA256:6be33a9db415ff3e474a10d1a0c41fca3dbe90ae8c9ddd9a4a997892b11d67ab
'http://deb.debian.org/debian/pool/main/p/pam/pam_1.3.1.orig.tar.xz' pam_1.3.1.orig.tar.xz 912332 SHA256:eff47a4ecd833fbf18de9686632a70ee8d0794b79aecb217ebd0ce11db4cd0db
'http://deb.debian.org/debian/pool/main/p/pam/pam_1.3.1-5.debian.tar.xz' pam_1.3.1-5.debian.tar.xz 114384 SHA256:be2c2b27efd6bea02f9d102d7d8c58374557beb7245b2a9d75ecc829e9449f62
```
Other potentially useful URLs:
- https://sources.debian.net/src/pam/1.3.1-5/ (for browsing the source)
- https://sources.debian.net/src/pam/1.3.1-5/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/pam/1.3.1-5/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `pcre2=10.32-5`
Binary Packages:
- `libpcre2-8-0:amd64=10.32-5`
**WARNING:** unable to detect licenses! (package likely not compliant with DEP-5)
If source is available (seen below), check the contents of `debian/copyright` within it.
Source:
```console
$ apt-get source -qq --print-uris pcre2=10.32-5
'http://deb.debian.org/debian/pool/main/p/pcre2/pcre2_10.32-5.dsc' pcre2_10.32-5.dsc 2342 SHA256:df327f59608e018603b138cf5a557fe5febfa5f24281152d68f3a52ba542d504
'http://deb.debian.org/debian/pool/main/p/pcre2/pcre2_10.32.orig.tar.gz' pcre2_10.32.orig.tar.gz 2169349 SHA256:9ca9be72e1a04f22be308323caa8c06ebd0c51efe99ee11278186cafbc4fe3af
'http://deb.debian.org/debian/pool/main/p/pcre2/pcre2_10.32-5.diff.gz' pcre2_10.32-5.diff.gz 5187 SHA256:bfe23d2661bf5727a10a1c1e49660c35afc0a4ad1c151bdcefb7c5a52e71e685
```
Other potentially useful URLs:
- https://sources.debian.net/src/pcre2/10.32-5/ (for browsing the source)
- https://sources.debian.net/src/pcre2/10.32-5/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/pcre2/10.32-5/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `pcre3=2:8.39-12`
Binary Packages:
- `libpcre3:amd64=2:8.39-12`
**WARNING:** unable to detect licenses! (package likely not compliant with DEP-5)
If source is available (seen below), check the contents of `debian/copyright` within it.
Source:
```console
$ apt-get source -qq --print-uris pcre3=2:8.39-12
'http://deb.debian.org/debian/pool/main/p/pcre3/pcre3_8.39-12.dsc' pcre3_8.39-12.dsc 2226 SHA256:7660921533f286d211bc129318327041ceb80d3d21e91c1ae7c10f284342c5e0
'http://deb.debian.org/debian/pool/main/p/pcre3/pcre3_8.39.orig.tar.bz2' pcre3_8.39.orig.tar.bz2 1560758 SHA256:b858099f82483031ee02092711689e7245586ada49e534a06e678b8ea9549e8b
'http://deb.debian.org/debian/pool/main/p/pcre3/pcre3_8.39-12.debian.tar.gz' pcre3_8.39-12.debian.tar.gz 26509 SHA256:ee193ddee446f0bdb966fca5987ef871da7a528a473304285619988102371c4c
```
Other potentially useful URLs:
- https://sources.debian.net/src/pcre3/2:8.39-12/ (for browsing the source)
- https://sources.debian.net/src/pcre3/2:8.39-12/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/pcre3/2:8.39-12/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `perl=5.28.1-6+deb10u1`
Binary Packages:
- `perl-base=5.28.1-6+deb10u1`
Licenses: (parsed from: `/usr/share/doc/perl-base/copyright`)
- `Artistic`
- `Artistic,`
- `Artistic-2`
- `Artistic-dist`
- `BSD-3-clause`
- `BSD-3-clause-GENERIC`
- `BSD-3-clause-with-weird-numbering`
- `BSD-4-clause-POWERDOG`
- `BZIP`
- `CC0-1.0`
- `DONT-CHANGE-THE-GPL`
- `Expat`
- `GPL-1`
- `GPL-1+`
- `GPL-2`
- `GPL-2+`
- `GPL-3+-WITH-BISON-EXCEPTION`
- `HSIEH-BSD`
- `HSIEH-DERIVATIVE`
- `LGPL-2.1`
- `REGCOMP`
- `REGCOMP,`
- `RRA-KEEP-THIS-NOTICE`
- `S2P`
- `SDBM-PUBLIC-DOMAIN`
- `TEXT-TABS`
- `Unicode`
- `ZLIB`
Source:
```console
$ apt-get source -qq --print-uris perl=5.28.1-6+deb10u1
'http://deb.debian.org/debian/pool/main/p/perl/perl_5.28.1-6%2bdeb10u1.dsc' perl_5.28.1-6+deb10u1.dsc 2863 SHA256:a680d97001398640c249fc6bae6124fe59eb465b044f03fb4148b22152895785
'http://deb.debian.org/debian/pool/main/p/perl/perl_5.28.1.orig-regen-configure.tar.xz' perl_5.28.1.orig-regen-configure.tar.xz 411944 SHA256:5873b81af4514d3910ab1a8267b15ff8c0e2100dbae4edfd10b65ef72cd31ef8
'http://deb.debian.org/debian/pool/main/p/perl/perl_5.28.1.orig.tar.xz' perl_5.28.1.orig.tar.xz 12372080 SHA256:fea7162d4cca940a387f0587b93f6737d884bf74d8a9d7cfd978bc12cd0b202d
'http://deb.debian.org/debian/pool/main/p/perl/perl_5.28.1-6%2bdeb10u1.debian.tar.xz' perl_5.28.1-6+deb10u1.debian.tar.xz 185004 SHA256:e531c2d8c85b28b34c2122175a8e8f6cfe56b8a0708972fc4beae9876549d815
```
Other potentially useful URLs:
- https://sources.debian.net/src/perl/5.28.1-6+deb10u1/ (for browsing the source)
- https://sources.debian.net/src/perl/5.28.1-6+deb10u1/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/perl/5.28.1-6+deb10u1/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `pinentry=1.1.0-2`
Binary Packages:
- `pinentry-curses=1.1.0-2`
Licenses: (parsed from: `/usr/share/doc/pinentry-curses/copyright`)
- `GPL-2`
- `GPL-2+`
- `LGPL-3`
- `LGPL-3+`
- `X11`
Source:
```console
$ apt-get source -qq --print-uris pinentry=1.1.0-2
'http://deb.debian.org/debian/pool/main/p/pinentry/pinentry_1.1.0-2.dsc' pinentry_1.1.0-2.dsc 2055 SHA256:a3f157d367217eb91581d9fc53f23205794c7572894497a04d4d91eb6d5aff06
'http://deb.debian.org/debian/pool/main/p/pinentry/pinentry_1.1.0.orig.tar.bz2' pinentry_1.1.0.orig.tar.bz2 467702 SHA256:68076686fa724a290ea49cdf0d1c0c1500907d1b759a3bcbfbec0293e8f56570
'http://deb.debian.org/debian/pool/main/p/pinentry/pinentry_1.1.0-2.debian.tar.xz' pinentry_1.1.0-2.debian.tar.xz 16480 SHA256:b09437607c63c620bb581fe14080e897b5fb8210d08611b18b751efead7776da
```
Other potentially useful URLs:
- https://sources.debian.net/src/pinentry/1.1.0-2/ (for browsing the source)
- https://sources.debian.net/src/pinentry/1.1.0-2/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/pinentry/1.1.0-2/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `readline=7.0-5`
Binary Packages:
- `libreadline7:amd64=7.0-5`
- `readline-common=7.0-5`
Licenses: (parsed from: `/usr/share/doc/libreadline7/copyright`, `/usr/share/doc/readline-common/copyright`)
- `GFDL`
- `GPL-3`
Source:
```console
$ apt-get source -qq --print-uris readline=7.0-5
'http://deb.debian.org/debian/pool/main/r/readline/readline_7.0-5.dsc' readline_7.0-5.dsc 2419 SHA256:4a804235e91ced3b957b0772101ca3992f5ad051e6540b8c41a1f98a06e84033
'http://deb.debian.org/debian/pool/main/r/readline/readline_7.0.orig.tar.gz' readline_7.0.orig.tar.gz 2910016 SHA256:750d437185286f40a369e1e4f4764eda932b9459b5ec9a731628393dd3d32334
'http://deb.debian.org/debian/pool/main/r/readline/readline_7.0-5.debian.tar.xz' readline_7.0-5.debian.tar.xz 29992 SHA256:5c1cc7396a670ce7e6e4c0bc36e8d3067b7642bea5b30fc3ff22bf8e65d2ee80
```
Other potentially useful URLs:
- https://sources.debian.net/src/readline/7.0-5/ (for browsing the source)
- https://sources.debian.net/src/readline/7.0-5/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/readline/7.0-5/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `rtmpdump=2.4+20151223.gitfa8646d.1-2`
Binary Packages:
- `librtmp1:amd64=2.4+20151223.gitfa8646d.1-2`
Licenses: (parsed from: `/usr/share/doc/librtmp1/copyright`)
- `GPL-2`
- `LGPL-2.1`
Source:
```console
$ apt-get source -qq --print-uris rtmpdump=2.4+20151223.gitfa8646d.1-2
'http://deb.debian.org/debian/pool/main/r/rtmpdump/rtmpdump_2.4%2b20151223.gitfa8646d.1-2.dsc' rtmpdump_2.4+20151223.gitfa8646d.1-2.dsc 2299 SHA256:a296819cd2ab5880b67ad963ef0867cb10e462f4403e52565aa863eb05bb1370
'http://deb.debian.org/debian/pool/main/r/rtmpdump/rtmpdump_2.4%2b20151223.gitfa8646d.1.orig.tar.gz' rtmpdump_2.4+20151223.gitfa8646d.1.orig.tar.gz 142213 SHA256:5c032f5c8cc2937eb55a81a94effdfed3b0a0304b6376147b86f951e225e3ab5
'http://deb.debian.org/debian/pool/main/r/rtmpdump/rtmpdump_2.4%2b20151223.gitfa8646d.1-2.debian.tar.xz' rtmpdump_2.4+20151223.gitfa8646d.1-2.debian.tar.xz 8096 SHA256:26d47de07d16285e4ca55b0828cbbf1ba35e671f9b3500a87e301fe755d26882
```
Other potentially useful URLs:
- https://sources.debian.net/src/rtmpdump/2.4+20151223.gitfa8646d.1-2/ (for browsing the source)
- https://sources.debian.net/src/rtmpdump/2.4+20151223.gitfa8646d.1-2/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/rtmpdump/2.4+20151223.gitfa8646d.1-2/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `sed=4.7-1`
Binary Packages:
- `sed=4.7-1`
Licenses: (parsed from: `/usr/share/doc/sed/copyright`)
- `GPL-3`
Source:
```console
$ apt-get source -qq --print-uris sed=4.7-1
'http://deb.debian.org/debian/pool/main/s/sed/sed_4.7-1.dsc' sed_4.7-1.dsc 1880 SHA256:dd0e8daed987929920f7729771f9c7a5b48d094923aaf686efd2ab19db776108
'http://deb.debian.org/debian/pool/main/s/sed/sed_4.7.orig.tar.xz' sed_4.7.orig.tar.xz 1298316 SHA256:2885768cd0a29ff8d58a6280a270ff161f6a3deb5690b2be6c49f46d4c67bd6a
'http://deb.debian.org/debian/pool/main/s/sed/sed_4.7-1.debian.tar.xz' sed_4.7-1.debian.tar.xz 59824 SHA256:a2ab8d50807fd2242f86d6c6257399e790445ab6f8932f7f487d34361b4fc483
```
Other potentially useful URLs:
- https://sources.debian.net/src/sed/4.7-1/ (for browsing the source)
- https://sources.debian.net/src/sed/4.7-1/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/sed/4.7-1/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `sensible-utils=0.0.12`
Binary Packages:
- `sensible-utils=0.0.12`
Licenses: (parsed from: `/usr/share/doc/sensible-utils/copyright`)
- `All-permissive`
- `GPL-2`
- `GPL-2+`
- `configure`
- `installsh`
Source:
```console
$ apt-get source -qq --print-uris sensible-utils=0.0.12
'http://deb.debian.org/debian/pool/main/s/sensible-utils/sensible-utils_0.0.12.dsc' sensible-utils_0.0.12.dsc 1732 SHA256:1b62cc5f7561b3f5692a6edaec942e2e97e8368dabff8c865867d428eecb1221
'http://deb.debian.org/debian/pool/main/s/sensible-utils/sensible-utils_0.0.12.tar.xz' sensible-utils_0.0.12.tar.xz 62152 SHA256:99ba2ebf8c57447c69d426b99b84ff9dc817be0bc4988ec6890a14558c529e2e
```
Other potentially useful URLs:
- https://sources.debian.net/src/sensible-utils/0.0.12/ (for browsing the source)
- https://sources.debian.net/src/sensible-utils/0.0.12/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/sensible-utils/0.0.12/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `shadow=1:4.5-1.1`
Binary Packages:
- `login=1:4.5-1.1`
- `passwd=1:4.5-1.1`
Licenses: (parsed from: `/usr/share/doc/login/copyright`, `/usr/share/doc/passwd/copyright`)
- `GPL-2`
Source:
```console
$ apt-get source -qq --print-uris shadow=1:4.5-1.1
'http://deb.debian.org/debian/pool/main/s/shadow/shadow_4.5-1.1.dsc' shadow_4.5-1.1.dsc 2319 SHA256:75993dc19ccc4d5c404831d2dab021a03eaa39216b518d596b639d8f2ea4e98b
'http://deb.debian.org/debian/pool/main/s/shadow/shadow_4.5.orig.tar.xz' shadow_4.5.orig.tar.xz 1344524 SHA256:22b0952dc944b163e2370bb911b11ca275fc80ad024267cf21e496b28c23d500
'http://deb.debian.org/debian/pool/main/s/shadow/shadow_4.5-1.1.debian.tar.xz' shadow_4.5-1.1.debian.tar.xz 462960 SHA256:3bb16bbf5d9a255d7333932ae99815d65c1c8e86127e5016809d4ba55c499538
```
Other potentially useful URLs:
- https://sources.debian.net/src/shadow/1:4.5-1.1/ (for browsing the source)
- https://sources.debian.net/src/shadow/1:4.5-1.1/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/shadow/1:4.5-1.1/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `sqlite3=3.27.2-3+deb10u1`
Binary Packages:
- `libsqlite3-0:amd64=3.27.2-3+deb10u1`
Licenses: (parsed from: `/usr/share/doc/libsqlite3-0/copyright`)
- `GPL-2`
- `GPL-2+`
- `public-domain`
Source:
```console
$ apt-get source -qq --print-uris sqlite3=3.27.2-3+deb10u1
'http://deb.debian.org/debian/pool/main/s/sqlite3/sqlite3_3.27.2-3%2bdeb10u1.dsc' sqlite3_3.27.2-3+deb10u1.dsc 2430 SHA256:6faf359c70d0618558056d6dee9f05ea810ff57aebb141ac28129c17e685cf1b
'http://deb.debian.org/debian/pool/main/s/sqlite3/sqlite3_3.27.2.orig-www.tar.xz' sqlite3_3.27.2.orig-www.tar.xz 5602752 SHA256:b50bea0e1974b33bcb2cec4c29fcdeecd8f960020ce0310b15fb123938844bee
'http://deb.debian.org/debian/pool/main/s/sqlite3/sqlite3_3.27.2.orig.tar.xz' sqlite3_3.27.2.orig.tar.xz 6844832 SHA256:6cb1606bbc38270739d256b5ab1cf94dccf5b2a3b4cbceb0545aac76f6ef40f2
'http://deb.debian.org/debian/pool/main/s/sqlite3/sqlite3_3.27.2-3%2bdeb10u1.debian.tar.xz' sqlite3_3.27.2-3+deb10u1.debian.tar.xz 38844 SHA256:ccabd6cc3d05887f2dd239065f3c3063f766e9e187804a89f04cbcbdb49a6b7e
```
Other potentially useful URLs:
- https://sources.debian.net/src/sqlite3/3.27.2-3+deb10u1/ (for browsing the source)
- https://sources.debian.net/src/sqlite3/3.27.2-3+deb10u1/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/sqlite3/3.27.2-3+deb10u1/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `systemd=241-7~deb10u8`
Binary Packages:
- `libsystemd0:amd64=241-7~deb10u8`
- `libudev1:amd64=241-7~deb10u8`
Licenses: (parsed from: `/usr/share/doc/libsystemd0/copyright`, `/usr/share/doc/libudev1/copyright`)
- `CC0-1.0`
- `Expat`
- `GPL-2`
- `GPL-2+`
- `LGPL-2.1`
- `LGPL-2.1+`
- `public-domain`
Source:
```console
$ apt-get source -qq --print-uris systemd=241-7~deb10u8
'http://deb.debian.org/debian/pool/main/s/systemd/systemd_241-7%7edeb10u8.dsc' systemd_241-7~deb10u8.dsc 5101 SHA256:925ac30011dee81ab0e418f27515db2ddead0fa609b34eb7815cee7861c5a561
'http://deb.debian.org/debian/pool/main/s/systemd/systemd_241.orig.tar.gz' systemd_241.orig.tar.gz 7640538 SHA256:b2561a8e1d10a2c248253f0dda31a85dd6d69f2b54177de55e02cd1d2778316e
'http://deb.debian.org/debian/pool/main/s/systemd/systemd_241-7%7edeb10u8.debian.tar.xz' systemd_241-7~deb10u8.debian.tar.xz 182616 SHA256:6f5419d06f917a0565a55b9c9e7b9b55c094623a32b722f24431c20f7b48491b
```
Other potentially useful URLs:
- https://sources.debian.net/src/systemd/241-7~deb10u8/ (for browsing the source)
- https://sources.debian.net/src/systemd/241-7~deb10u8/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/systemd/241-7~deb10u8/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `sysvinit=2.93-8`
Binary Packages:
- `sysvinit-utils=2.93-8`
Licenses: (parsed from: `/usr/share/doc/sysvinit-utils/copyright`)
- `GPL-2`
- `GPL-2+`
Source:
```console
$ apt-get source -qq --print-uris sysvinit=2.93-8
'http://deb.debian.org/debian/pool/main/s/sysvinit/sysvinit_2.93-8.dsc' sysvinit_2.93-8.dsc 2657 SHA256:84aa66bfa1c7963c179da26c015468d489b39bde19c85096b4d3e261e5fc043d
'http://deb.debian.org/debian/pool/main/s/sysvinit/sysvinit_2.93.orig.tar.xz' sysvinit_2.93.orig.tar.xz 117580 SHA256:472d460e233d981488509a167125a82925c8c9aba6b5608cb22598fdf326a8ff
'http://deb.debian.org/debian/pool/main/s/sysvinit/sysvinit_2.93.orig.tar.xz.asc' sysvinit_2.93.orig.tar.xz.asc 1076 SHA256:cf2b374a96276a16e3ef07ad2be596420f0d8d77227aad3144d7ab4ea165a4af
'http://deb.debian.org/debian/pool/main/s/sysvinit/sysvinit_2.93-8.debian.tar.xz' sysvinit_2.93-8.debian.tar.xz 127136 SHA256:2db2ae46048acf743445545151cbc0bc5530eca1f2eec51df3175d8ab26edfa6
```
Other potentially useful URLs:
- https://sources.debian.net/src/sysvinit/2.93-8/ (for browsing the source)
- https://sources.debian.net/src/sysvinit/2.93-8/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/sysvinit/2.93-8/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `tar=1.30+dfsg-6`
Binary Packages:
- `tar=1.30+dfsg-6`
Licenses: (parsed from: `/usr/share/doc/tar/copyright`)
- `GPL-2`
- `GPL-3`
Source:
```console
$ apt-get source -qq --print-uris tar=1.30+dfsg-6
'http://deb.debian.org/debian/pool/main/t/tar/tar_1.30%2bdfsg-6.dsc' tar_1.30+dfsg-6.dsc 1995 SHA256:1515951c8a2fc9a43e822efd82d9043cdec4bec47ddca9e7f1311c73e6b00d0c
'http://deb.debian.org/debian/pool/main/t/tar/tar_1.30%2bdfsg.orig.tar.xz' tar_1.30+dfsg.orig.tar.xz 1883220 SHA256:c02f3747ffe02017878303dde8b78e79cd220364c5e8048cf92320232e38912d
'http://deb.debian.org/debian/pool/main/t/tar/tar_1.30%2bdfsg-6.debian.tar.xz' tar_1.30+dfsg-6.debian.tar.xz 22124 SHA256:b7caae6287992536353413e7a9b21301b29c32066bb6f36b7190074af9dd5c50
```
Other potentially useful URLs:
- https://sources.debian.net/src/tar/1.30+dfsg-6/ (for browsing the source)
- https://sources.debian.net/src/tar/1.30+dfsg-6/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/tar/1.30+dfsg-6/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `tzdata=2021a-0+deb10u3`
Binary Packages:
- `tzdata=2021a-0+deb10u3`
**WARNING:** unable to detect licenses! (package likely not compliant with DEP-5)
If source is available (seen below), check the contents of `debian/copyright` within it.
Source:
```console
$ apt-get source -qq --print-uris tzdata=2021a-0+deb10u3
'http://deb.debian.org/debian/pool/main/t/tzdata/tzdata_2021a-0%2bdeb10u3.dsc' tzdata_2021a-0+deb10u3.dsc 2264 SHA256:1730f7a8a2ac3ac3c9db9dc7ddd3074343a7846988c515d55f046be527a00834
'http://deb.debian.org/debian/pool/main/t/tzdata/tzdata_2021a.orig.tar.gz' tzdata_2021a.orig.tar.gz 411892 SHA256:39e7d2ba08c68cbaefc8de3227aab0dec2521be8042cf56855f7dc3a9fb14e08
'http://deb.debian.org/debian/pool/main/t/tzdata/tzdata_2021a.orig.tar.gz.asc' tzdata_2021a.orig.tar.gz.asc 833 SHA256:9dc5f54674166f4ffbc2d4485e656227430ab5f39c9006e6ed9986281117f058
'http://deb.debian.org/debian/pool/main/t/tzdata/tzdata_2021a-0%2bdeb10u3.debian.tar.xz' tzdata_2021a-0+deb10u3.debian.tar.xz 109800 SHA256:aa09186f2ceb3d4b7ec9e7575ba51a3c1b4894e0669e1125c4cae1eafec73808
```
Other potentially useful URLs:
- https://sources.debian.net/src/tzdata/2021a-0+deb10u3/ (for browsing the source)
- https://sources.debian.net/src/tzdata/2021a-0+deb10u3/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/tzdata/2021a-0+deb10u3/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `ucf=3.0038+nmu1`
Binary Packages:
- `ucf=3.0038+nmu1`
Licenses: (parsed from: `/usr/share/doc/ucf/copyright`)
- `GPL-2`
Source:
```console
$ apt-get source -qq --print-uris ucf=3.0038+nmu1
'http://deb.debian.org/debian/pool/main/u/ucf/ucf_3.0038%2bnmu1.dsc' ucf_3.0038+nmu1.dsc 1420 SHA256:89b6f921a30e04a946f62e6996be7c16f2f7c383d20783cd4704b502c6d5b125
'http://deb.debian.org/debian/pool/main/u/ucf/ucf_3.0038%2bnmu1.tar.xz' ucf_3.0038+nmu1.tar.xz 65860 SHA256:d00bc3dd8d2f91317f52b5352fe129023c72babad55bc0dd4ece7b34183c7436
```
Other potentially useful URLs:
- https://sources.debian.net/src/ucf/3.0038+nmu1/ (for browsing the source)
- https://sources.debian.net/src/ucf/3.0038+nmu1/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/ucf/3.0038+nmu1/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `unzip=6.0-23+deb10u2`
Binary Packages:
- `unzip=6.0-23+deb10u2`
**WARNING:** unable to detect licenses! (package likely not compliant with DEP-5)
If source is available (seen below), check the contents of `debian/copyright` within it.
Source:
```console
$ apt-get source -qq --print-uris unzip=6.0-23+deb10u2
'http://deb.debian.org/debian/pool/main/u/unzip/unzip_6.0-23%2bdeb10u2.dsc' unzip_6.0-23+deb10u2.dsc 1376 SHA256:fc4136ce6d11c858b163f538cd6c7608477dee0531775ca1ed9d6081cb6f9595
'http://deb.debian.org/debian/pool/main/u/unzip/unzip_6.0.orig.tar.gz' unzip_6.0.orig.tar.gz 1376845 SHA256:036d96991646d0449ed0aa952e4fbe21b476ce994abc276e49d30e686708bd37
'http://deb.debian.org/debian/pool/main/u/unzip/unzip_6.0-23%2bdeb10u2.debian.tar.xz' unzip_6.0-23+deb10u2.debian.tar.xz 23508 SHA256:15d8bfbd70d6e497ad743c0c710ebb4e212767ac6c9453e19b3aa1ab80a7d25c
```
Other potentially useful URLs:
- https://sources.debian.net/src/unzip/6.0-23+deb10u2/ (for browsing the source)
- https://sources.debian.net/src/unzip/6.0-23+deb10u2/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/unzip/6.0-23+deb10u2/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `util-linux=2.33.1-0.1`
Binary Packages:
- `bsdutils=1:2.33.1-0.1`
- `fdisk=2.33.1-0.1`
- `libblkid1:amd64=2.33.1-0.1`
- `libfdisk1:amd64=2.33.1-0.1`
- `libmount1:amd64=2.33.1-0.1`
- `libsmartcols1:amd64=2.33.1-0.1`
- `libuuid1:amd64=2.33.1-0.1`
- `mount=2.33.1-0.1`
- `util-linux=2.33.1-0.1`
Licenses: (parsed from: `/usr/share/doc/bsdutils/copyright`, `/usr/share/doc/fdisk/copyright`, `/usr/share/doc/libblkid1/copyright`, `/usr/share/doc/libfdisk1/copyright`, `/usr/share/doc/libmount1/copyright`, `/usr/share/doc/libsmartcols1/copyright`, `/usr/share/doc/libuuid1/copyright`, `/usr/share/doc/mount/copyright`, `/usr/share/doc/util-linux/copyright`)
- `BSD-2-clause`
- `BSD-3-clause`
- `BSD-4-clause`
- `GPL-2`
- `GPL-2+`
- `GPL-3`
- `GPL-3+`
- `LGPL`
- `LGPL-2`
- `LGPL-2+`
- `LGPL-2.1`
- `LGPL-2.1+`
- `LGPL-3`
- `LGPL-3+`
- `MIT`
- `public-domain`
Source:
```console
$ apt-get source -qq --print-uris util-linux=2.33.1-0.1
'http://deb.debian.org/debian/pool/main/u/util-linux/util-linux_2.33.1-0.1.dsc' util-linux_2.33.1-0.1.dsc 3988 SHA256:b5ee1ff0a8de37c3e4d7c0c29b7571b30ba4bea1d37e55e3d1dac3a3cbc50827
'http://deb.debian.org/debian/pool/main/u/util-linux/util-linux_2.33.1.orig.tar.xz' util-linux_2.33.1.orig.tar.xz 4650936 SHA256:c14bd9f3b6e1792b90db87696e87ec643f9d63efa0a424f092a5a6b2f2dbef21
'http://deb.debian.org/debian/pool/main/u/util-linux/util-linux_2.33.1-0.1.debian.tar.xz' util-linux_2.33.1-0.1.debian.tar.xz 81780 SHA256:07bfeb8298fab559dec2091463cab343785853bcae6c92c0806b7639e105913a
```
Other potentially useful URLs:
- https://sources.debian.net/src/util-linux/2.33.1-0.1/ (for browsing the source)
- https://sources.debian.net/src/util-linux/2.33.1-0.1/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/util-linux/2.33.1-0.1/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `wget=1.20.1-1.1`
Binary Packages:
- `wget=1.20.1-1.1`
Licenses: (parsed from: `/usr/share/doc/wget/copyright`)
- `GFDL-1.2`
- `GPL-3`
Source:
```console
$ apt-get source -qq --print-uris wget=1.20.1-1.1
'http://deb.debian.org/debian/pool/main/w/wget/wget_1.20.1-1.1.dsc' wget_1.20.1-1.1.dsc 2092 SHA256:b193fdf37cc33955e366ae1fdb6df5425d13769d9e131c52382ae132ad931261
'http://deb.debian.org/debian/pool/main/w/wget/wget_1.20.1.orig.tar.gz' wget_1.20.1.orig.tar.gz 4392853 SHA256:b783b390cb571c837b392857945f5a1f00ec6b043177cc42abb8ee1b542ee1b3
'http://deb.debian.org/debian/pool/main/w/wget/wget_1.20.1-1.1.debian.tar.xz' wget_1.20.1-1.1.debian.tar.xz 60872 SHA256:7eee4b6b9394a495888d1fc0db951c6b3bd883ca522a11df3433732dc116001e
```
Other potentially useful URLs:
- https://sources.debian.net/src/wget/1.20.1-1.1/ (for browsing the source)
- https://sources.debian.net/src/wget/1.20.1-1.1/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/wget/1.20.1-1.1/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `xz-utils=5.2.4-1`
Binary Packages:
- `liblzma5:amd64=5.2.4-1`
- `xz-utils=5.2.4-1`
Licenses: (parsed from: `/usr/share/doc/liblzma5/copyright`, `/usr/share/doc/xz-utils/copyright`)
- `Autoconf`
- `GPL-2`
- `GPL-2+`
- `GPL-3`
- `LGPL-2`
- `LGPL-2.1`
- `LGPL-2.1+`
- `PD`
- `PD-debian`
- `config-h`
- `noderivs`
- `none`
- `permissive-fsf`
- `permissive-nowarranty`
- `probably-PD`
Source:
```console
$ apt-get source -qq --print-uris xz-utils=5.2.4-1
'http://deb.debian.org/debian/pool/main/x/xz-utils/xz-utils_5.2.4-1.dsc' xz-utils_5.2.4-1.dsc 2518 SHA256:b1572c4efb3c8ebf6f0e044b70e1e0451c919a99d3f80be03b624a54dd7ea593
'http://deb.debian.org/debian/pool/main/x/xz-utils/xz-utils_5.2.4.orig.tar.xz' xz-utils_5.2.4.orig.tar.xz 1053868 SHA256:9717ae363760dedf573dad241420c5fea86256b65bc21d2cf71b2b12f0544f4b
'http://deb.debian.org/debian/pool/main/x/xz-utils/xz-utils_5.2.4.orig.tar.xz.asc' xz-utils_5.2.4.orig.tar.xz.asc 879 SHA256:88290c1deeaf674ae2a4821f4373fe0e4cc2a94199eae6dcc26df1e70cc15303
'http://deb.debian.org/debian/pool/main/x/xz-utils/xz-utils_5.2.4-1.debian.tar.xz' xz-utils_5.2.4-1.debian.tar.xz 135296 SHA256:d37b558444b76e88a69601df008cf1c0343c58cb7765b7bbb2099b0a19619361
```
Other potentially useful URLs:
- https://sources.debian.net/src/xz-utils/5.2.4-1/ (for browsing the source)
- https://sources.debian.net/src/xz-utils/5.2.4-1/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/xz-utils/5.2.4-1/ (for access to the source package after it no longer exists in the archive)
### `dpkg` source package: `zlib=1:1.2.11.dfsg-1`
Binary Packages:
- `zlib1g:amd64=1:1.2.11.dfsg-1`
Licenses: (parsed from: `/usr/share/doc/zlib1g/copyright`)
- `Zlib`
Source:
```console
$ apt-get source -qq --print-uris zlib=1:1.2.11.dfsg-1
'http://deb.debian.org/debian/pool/main/z/zlib/zlib_1.2.11.dfsg-1.dsc' zlib_1.2.11.dfsg-1.dsc 2266 SHA256:bf21ab4d60cb836725162f5072884596e781a2f4974182af1868f546306eb8c8
'http://deb.debian.org/debian/pool/main/z/zlib/zlib_1.2.11.dfsg.orig.tar.gz' zlib_1.2.11.dfsg.orig.tar.gz 370248 SHA256:80c481411a4fe8463aeb8270149a0e80bb9eaf7da44132b6e16f2b5af01bc899
'http://deb.debian.org/debian/pool/main/z/zlib/zlib_1.2.11.dfsg-1.debian.tar.xz' zlib_1.2.11.dfsg-1.debian.tar.xz 18956 SHA256:00b95b629fbe9a5181f8ba1ceddedf627aba1ab42e47f5916be8a41deb54098a
```
Other potentially useful URLs:
- https://sources.debian.net/src/zlib/1:1.2.11.dfsg-1/ (for browsing the source)
- https://sources.debian.net/src/zlib/1:1.2.11.dfsg-1/debian/copyright/ (for direct copyright/license information)
- http://snapshot.debian.org/package/zlib/1:1.2.11.dfsg-1/ (for access to the source package after it no longer exists in the archive)
|
docker-library/repo-info
|
repos/tomcat/local/9.0.59-jre8-openjdk-buster.md
|
Markdown
|
apache-2.0
| 121,052
|
export const cschDocs = {
name: 'csch',
category: 'Trigonometry',
syntax: [
'csch(x)'
],
description: 'Compute the hyperbolic cosecant of x in radians. Defined as 1/sinh(x)',
examples: [
'csch(2)',
'1 / sinh(2)'
],
seealso: [
'sech',
'coth',
'sinh'
]
}
|
FSMaxB/mathjs
|
src/expression/embeddedDocs/function/trigonometry/csch.js
|
JavaScript
|
apache-2.0
| 295
|
// Copyright (C) 2013 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.server.change;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.expectLastCall;
import static org.easymock.EasyMock.replay;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import com.google.gerrit.common.changes.Side;
import com.google.gerrit.extensions.registration.DynamicMap;
import com.google.gerrit.extensions.restapi.IdString;
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
import com.google.gerrit.extensions.restapi.RestReadView;
import com.google.gerrit.extensions.restapi.RestView;
import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.CommentRange;
import com.google.gerrit.reviewdb.client.Patch;
import com.google.gerrit.reviewdb.client.PatchLineComment;
import com.google.gerrit.reviewdb.client.PatchLineComment.Status;
import com.google.gerrit.reviewdb.client.PatchSet;
import com.google.gerrit.reviewdb.server.PatchLineCommentAccess;
import com.google.gerrit.reviewdb.server.ReviewDb;
import com.google.gerrit.server.account.AccountInfo;
import com.google.gerrit.server.util.TimeUtil;
import com.google.gwtorm.server.ListResultSet;
import com.google.gwtorm.server.ResultSet;
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.TypeLiteral;
import org.easymock.IAnswer;
import org.junit.Before;
import org.junit.Test;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
public class CommentsTest {
private Injector injector;
private RevisionResource revRes1;
private RevisionResource revRes2;
private PatchLineComment plc1;
private PatchLineComment plc2;
private PatchLineComment plc3;
@Before
public void setUp() throws Exception {
@SuppressWarnings("unchecked")
final DynamicMap<RestView<CommentResource>> views =
createMock(DynamicMap.class);
final TypeLiteral<DynamicMap<RestView<CommentResource>>> viewsType =
new TypeLiteral<DynamicMap<RestView<CommentResource>>>() {};
final AccountInfo.Loader.Factory alf =
createMock(AccountInfo.Loader.Factory.class);
final ReviewDb db = createMock(ReviewDb.class);
AbstractModule mod = new AbstractModule() {
@Override
protected void configure() {
bind(viewsType).toInstance(views);
bind(AccountInfo.Loader.Factory.class).toInstance(alf);
bind(ReviewDb.class).toInstance(db);
}};
Account.Id account1 = new Account.Id(1);
Account.Id account2 = new Account.Id(2);
AccountInfo.Loader accountLoader = createMock(AccountInfo.Loader.class);
accountLoader.fill();
expectLastCall().anyTimes();
expect(accountLoader.get(account1))
.andReturn(new AccountInfo(account1)).anyTimes();
expect(accountLoader.get(account2))
.andReturn(new AccountInfo(account2)).anyTimes();
expect(alf.create(true)).andReturn(accountLoader).anyTimes();
replay(accountLoader, alf);
revRes1 = createMock(RevisionResource.class);
revRes2 = createMock(RevisionResource.class);
PatchLineCommentAccess plca = createMock(PatchLineCommentAccess.class);
expect(db.patchComments()).andReturn(plca).anyTimes();
Change.Id changeId = new Change.Id(123);
PatchSet.Id psId1 = new PatchSet.Id(changeId, 1);
PatchSet ps1 = new PatchSet(psId1);
expect(revRes1.getPatchSet()).andReturn(ps1).anyTimes();
PatchSet.Id psId2 = new PatchSet.Id(changeId, 2);
PatchSet ps2 = new PatchSet(psId2);
expect(revRes2.getPatchSet()).andReturn(ps2);
long timeBase = TimeUtil.nowMs();
plc1 = newPatchLineComment(psId1, "Comment1", null,
"FileOne.txt", Side.REVISION, 1, account1, timeBase,
"First Comment", new CommentRange(1, 2, 3, 4));
plc2 = newPatchLineComment(psId1, "Comment2", "Comment1",
"FileOne.txt", Side.REVISION, 1, account2, timeBase + 1000,
"Reply to First Comment", new CommentRange(1, 2, 3, 4));
plc3 = newPatchLineComment(psId1, "Comment3", "Comment1",
"FileOne.txt", Side.PARENT, 1, account1, timeBase + 2000,
"First Parent Comment", new CommentRange(1, 2, 3, 4));
expect(plca.publishedByPatchSet(psId1))
.andAnswer(results(plc1, plc2, plc3)).anyTimes();
expect(plca.publishedByPatchSet(psId2))
.andAnswer(results()).anyTimes();
replay(db, revRes1, revRes2, plca);
injector = Guice.createInjector(mod);
}
@Test
public void testListComments() throws Exception {
// test ListComments for patch set 1
assertListComments(injector, revRes1, ImmutableMap.of(
"FileOne.txt", Lists.newArrayList(plc3, plc1, plc2)));
// test ListComments for patch set 2
assertListComments(injector, revRes2,
Collections.<String, ArrayList<PatchLineComment>>emptyMap());
}
@Test
public void testGetComment() throws Exception {
// test GetComment for existing comment
assertGetComment(injector, revRes1, plc1, plc1.getKey().get());
// test GetComment for non-existent comment
assertGetComment(injector, revRes1, null, "BadComment");
}
private static IAnswer<ResultSet<PatchLineComment>> results(
final PatchLineComment... comments) {
return new IAnswer<ResultSet<PatchLineComment>>() {
@Override
public ResultSet<PatchLineComment> answer() throws Throwable {
return new ListResultSet<PatchLineComment>(Lists.newArrayList(comments));
}};
}
private static void assertGetComment(Injector inj, RevisionResource res,
PatchLineComment expected, String uuid) throws Exception {
GetComment getComment = inj.getInstance(GetComment.class);
Comments comments = inj.getInstance(Comments.class);
try {
CommentResource commentRes = comments.parse(res, IdString.fromUrl(uuid));
if (expected == null) {
fail("Expected no comment");
}
CommentInfo actual = getComment.apply(commentRes);
assertComment(expected, actual);
} catch (ResourceNotFoundException e) {
if (expected != null) {
fail("Expected to find comment");
}
}
}
private static void assertListComments(Injector inj, RevisionResource res,
Map<String, ArrayList<PatchLineComment>> expected) throws Exception {
Comments comments = inj.getInstance(Comments.class);
RestReadView<RevisionResource> listView =
(RestReadView<RevisionResource>) comments.list();
@SuppressWarnings("unchecked")
Map<String, List<CommentInfo>> actual =
(Map<String, List<CommentInfo>>) listView.apply(res);
assertNotNull(actual);
assertEquals(expected.size(), actual.size());
assertEquals(expected.keySet(), actual.keySet());
for (Map.Entry<String, ArrayList<PatchLineComment>> entry : expected.entrySet()) {
List<PatchLineComment> expectedComments = entry.getValue();
List<CommentInfo> actualComments = actual.get(entry.getKey());
assertNotNull(actualComments);
assertEquals(expectedComments.size(), actualComments.size());
for (int i = 0; i < expectedComments.size(); i++) {
assertComment(expectedComments.get(i), actualComments.get(i));
}
}
}
private static void assertComment(PatchLineComment plc, CommentInfo ci) {
assertEquals(plc.getKey().get(), ci.id);
assertEquals(plc.getParentUuid(), ci.inReplyTo);
assertEquals("gerritcodereview#comment", ci.kind);
assertEquals(plc.getMessage(), ci.message);
assertNotNull(ci.author);
assertEquals(plc.getAuthor(), ci.author._id);
assertEquals(plc.getLine(), (int) ci.line);
assertEquals(plc.getSide() == 0 ? Side.PARENT : Side.REVISION,
Objects.firstNonNull(ci.side, Side.REVISION));
assertEquals(plc.getWrittenOn(), ci.updated);
assertEquals(plc.getRange(), ci.range);
}
private static PatchLineComment newPatchLineComment(PatchSet.Id psId,
String uuid, String inReplyToUuid, String filename, Side side, int line,
Account.Id authorId, long millis, String message, CommentRange range) {
Patch.Key p = new Patch.Key(psId, filename);
PatchLineComment.Key id = new PatchLineComment.Key(p, uuid);
PatchLineComment plc =
new PatchLineComment(id, line, authorId, inReplyToUuid, TimeUtil.nowTs());
plc.setMessage(message);
plc.setRange(range);
plc.setSide(side == Side.PARENT ? (short) 0 : (short) 1);
plc.setStatus(Status.PUBLISHED);
plc.setWrittenOn(new Timestamp(millis));
return plc;
}
}
|
bootstraponline-archive/gerrit-mirror
|
gerrit-server/src/test/java/com/google/gerrit/server/change/CommentsTest.java
|
Java
|
apache-2.0
| 9,449
|
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* 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.intellij.util.containers;
import com.intellij.util.ConcurrencyUtil;
import gnu.trove.TObjectHashingStrategy;
import org.jetbrains.annotations.NotNull;
import java.io.IOException;
import java.io.Serializable;
import java.util.*;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.locks.ReentrantLock;
// added hashing strategy argument
// added cacheOrGet convenience method
// changed DEFAULT_SEGMENTS to 2 from 16
public class ConcurrentHashMap<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V>, Serializable, TObjectHashingStrategy<K> {
private static final long serialVersionUID = 7249069246763182397L;
/*
* The basic strategy is to subdivide the table among Segments,
* each of which itself is a concurrently readable hash table.
*/
/* ---------------- Constants -------------- */
/**
* The default initial number of table slots for this table.
* Used when not otherwise specified in constructor.
*/
static int DEFAULT_INITIAL_CAPACITY = 16;
/**
* The maximum capacity, used if a higher value is implicitly
* specified by either of the constructors with arguments. MUST
* be a power of two <= 1<<30 to ensure that entries are indexible
* using ints.
*/
static final int MAXIMUM_CAPACITY = 1 << 30;
/**
* The default load factor for this table. Used when not
* otherwise specified in constructor.
*/
public static final float DEFAULT_LOAD_FACTOR = 0.75f;
/**
* The default number of concurrency control segments.
**/
static final int DEFAULT_SEGMENTS = Math.min(2, Runtime.getRuntime().availableProcessors()); // CHANGED FROM 16
/**
* The maximum number of segments to allow; used to bound
* constructor arguments.
*/
static final int MAX_SEGMENTS = 1 << 16; // slightly conservative
/**
* Number of unsynchronized retries in size and containsValue
* methods before resorting to locking. This is used to avoid
* unbounded retries if tables undergo continuous modification
* which would make it impossible to obtain an accurate result.
*/
static final int RETRIES_BEFORE_LOCK = 2;
/* ---------------- Fields -------------- */
/**
* Mask value for indexing into segments. The upper bits of a
* key's hash code are used to choose the segment.
**/
final int segmentMask;
/**
* Shift value for indexing within segments.
**/
final int segmentShift;
/**
* The segments, each of which is a specialized hash table
*/
final Segment[] segments;
transient Set<K> keySet;
transient Set<Entry<K,V>> entrySet;
transient Collection<V> values;
private final TObjectHashingStrategy<K> myHashingStrategy;
/* ---------------- Small Utilities -------------- */
/**
* Returns the segment that should be used for key with given hash
* @param hash the hash code for the key
* @return the segment
*/
final Segment<K,V> segmentFor(int hash) {
return segments[(hash >>> segmentShift) & segmentMask];
}
/* ---------------- Inner Classes -------------- */
/**
* ConcurrentHashMap list entry. Note that this is never exported
* out as a user-visible Map.Entry.
*
* Because the value field is volatile, not final, it is legal wrt
* the Java Memory Model for an unsynchronized reader to see null
* instead of initial value when read via a data race. Although a
* reordering leading to this is not likely to ever actually
* occur, the Segment.readValueUnderLock method is used as a
* backup in case a null (pre-initialized) value is ever seen in
* an unsynchronized access method.
*/
static final class HashEntry<K,V> {
final K key;
final int hash;
volatile V value;
final HashEntry<K,V> next;
HashEntry(K key, int hash, HashEntry<K,V> next, V value) {
this.key = key;
this.hash = hash;
this.next = next;
this.value = value;
}
}
/**
* Segments are specialized versions of hash tables. This
* subclasses from ReentrantLock opportunistically, just to
* simplify some locking and avoid separate construction.
**/
static final class Segment<K,V> extends ReentrantLock implements Serializable {
/*
* Segments maintain a table of entry lists that are ALWAYS
* kept in a consistent state, so can be read without locking.
* Next fields of nodes are immutable (final). All list
* additions are performed at the front of each bin. This
* makes it easy to check changes, and also fast to traverse.
* When nodes would otherwise be changed, new nodes are
* created to replace them. This works well for hash tables
* since the bin lists tend to be short. (The average length
* is less than two for the default load factor threshold.)
*
* Read operations can thus proceed without locking, but rely
* on selected uses of volatiles to ensure that completed
* write operations performed by other threads are
* noticed. For most purposes, the "count" field, tracking the
* number of elements, serves as that volatile variable
* ensuring visibility. This is convenient because this field
* needs to be read in many read operations anyway:
*
* - All (unsynchronized) read operations must first read the
* "count" field, and should not look at table entries if
* it is 0.
*
* - All (synchronized) write operations should write to
* the "count" field after structurally changing any bin.
* The operations must not take any action that could even
* momentarily cause a concurrent read operation to see
* inconsistent data. This is made easier by the nature of
* the read operations in Map. For example, no operation
* can reveal that the table has grown but the threshold
* has not yet been updated, so there are no atomicity
* requirements for this with respect to reads.
*
* As a guide, all critical volatile reads and writes to the
* count field are marked in code comments.
*/
private static final long serialVersionUID = 2249069246763182397L;
/**
* The number of elements in this segment's region.
**/
transient volatile int count;
/**
* Number of updates that alter the size of the table. This is
* used during bulk-read methods to make sure they see a
* consistent snapshot: If modCounts change during a traversal
* of segments computing size or checking containsValue, then
* we might have an inconsistent view of state so (usually)
* must retry.
*/
transient int modCount;
/**
* The table is rehashed when its size exceeds this threshold.
* (The value of this field is always (int)(capacity *
* loadFactor).)
*/
transient int threshold;
/**
* The per-segment table. Declared as a raw type, casted
* to HashEntry<K,V> on each use.
*/
transient volatile HashEntry[] table;
/**
* The load factor for the hash table. Even though this value
* is same for all segments, it is replicated to avoid needing
* links to outer object.
* @serial
*/
final float loadFactor;
private final TObjectHashingStrategy<K> myHashingStrategy;
Segment(int initialCapacity, float lf, TObjectHashingStrategy<K> hashingStrategy) {
loadFactor = lf;
myHashingStrategy = hashingStrategy;
setTable(new HashEntry[initialCapacity]);
}
/**
* Set table to new HashEntry array.
* Call only while holding lock or in constructor.
**/
void setTable(HashEntry[] newTable) {
threshold = (int)(newTable.length * loadFactor);
table = newTable;
}
/**
* Return properly casted first entry of bin for given hash
*/
HashEntry<K,V> getFirst(int hash) {
HashEntry[] tab = table;
return (HashEntry<K,V>) tab[hash & (tab.length - 1)];
}
/**
* Read value field of an entry under lock. Called if value
* field ever appears to be null. This is possible only if a
* compiler happens to reorder a HashEntry initialization with
* its table assignment, which is legal under memory model
* but is not known to ever occur.
*/
V readValueUnderLock(HashEntry<K,V> e) {
lock();
try {
return e.value;
} finally {
unlock();
}
}
/* Specialized implementations of map methods */
V get(K key, int hash) {
if (count != 0) { // read-volatile
HashEntry<K,V> e = getFirst(hash);
while (e != null) {
if (e.hash == hash && myHashingStrategy.equals(key,e.key)) {
V v = e.value;
if (v != null)
return v;
return readValueUnderLock(e); // recheck
}
e = e.next;
}
}
return null;
}
boolean containsKey(K key, int hash) {
if (count != 0) { // read-volatile
HashEntry<K,V> e = getFirst(hash);
while (e != null) {
if (e.hash == hash && myHashingStrategy.equals(key,e.key))
return true;
e = e.next;
}
}
return false;
}
boolean containsValue(Object value) {
if (count != 0) { // read-volatile
HashEntry[] tab = table;
int len = tab.length;
for (int i = 0 ; i < len; i++) {
for (HashEntry<K,V> e = (HashEntry<K,V>)tab[i];
e != null ;
e = e.next) {
V v = e.value;
if (v == null) // recheck
v = readValueUnderLock(e);
if (value.equals(v))
return true;
}
}
}
return false;
}
boolean replace(K key, int hash, V oldValue, V newValue) {
lock();
try {
HashEntry<K,V> e = getFirst(hash);
while (e != null && (e.hash != hash || !myHashingStrategy.equals(key,e.key)))
e = e.next;
boolean replaced = false;
if (e != null && oldValue.equals(e.value)) {
replaced = true;
e.value = newValue;
}
return replaced;
} finally {
unlock();
}
}
V replace(K key, int hash, V newValue) {
lock();
try {
HashEntry<K,V> e = getFirst(hash);
while (e != null && (e.hash != hash || !myHashingStrategy.equals(key,e.key)))
e = e.next;
V oldValue = null;
if (e != null) {
oldValue = e.value;
e.value = newValue;
}
return oldValue;
} finally {
unlock();
}
}
V put(K key, int hash, V value, boolean onlyIfAbsent) {
lock();
try {
int c = count;
if (c++ > threshold) // ensure capacity
rehash();
HashEntry[] tab = table;
int index = hash & (tab.length - 1);
HashEntry<K,V> first = (HashEntry<K,V>) tab[index];
HashEntry<K,V> e = first;
while (e != null && (e.hash != hash || !myHashingStrategy.equals(key,e.key)))
e = e.next;
V oldValue;
if (e != null) {
oldValue = e.value;
if (!onlyIfAbsent)
e.value = value;
}
else {
oldValue = null;
++modCount;
tab[index] = new HashEntry<K,V>(key, hash, first, value);
count = c; // write-volatile
}
return oldValue;
} finally {
unlock();
}
}
void rehash() {
HashEntry[] oldTable = table;
int oldCapacity = oldTable.length;
if (oldCapacity >= MAXIMUM_CAPACITY)
return;
/*
* Reclassify nodes in each list to new Map. Because we are
* using power-of-two expansion, the elements from each bin
* must either stay at same index, or move with a power of two
* offset. We eliminate unnecessary node creation by catching
* cases where old nodes can be reused because their next
* fields won't change. Statistically, at the default
* threshold, only about one-sixth of them need cloning when
* a table doubles. The nodes they replace will be garbage
* collectable as soon as they are no longer referenced by any
* reader thread that may be in the midst of traversing table
* right now.
*/
HashEntry[] newTable = new HashEntry[oldCapacity << 1];
threshold = (int)(newTable.length * loadFactor);
int sizeMask = newTable.length - 1;
for (int i = 0; i < oldCapacity ; i++) {
// We need to guarantee that any existing reads of old Map can
// proceed. So we cannot yet null out each bin.
HashEntry<K,V> e = (HashEntry<K,V>)oldTable[i];
if (e != null) {
HashEntry<K,V> next = e.next;
int idx = e.hash & sizeMask;
// Single node on list
if (next == null)
newTable[idx] = e;
else {
// Reuse trailing consecutive sequence at same slot
HashEntry<K,V> lastRun = e;
int lastIdx = idx;
for (HashEntry<K,V> last = next;
last != null;
last = last.next) {
int k = last.hash & sizeMask;
if (k != lastIdx) {
lastIdx = k;
lastRun = last;
}
}
newTable[lastIdx] = lastRun;
// Clone all remaining nodes
for (HashEntry<K,V> p = e; p != lastRun; p = p.next) {
int k = p.hash & sizeMask;
HashEntry<K,V> n = (HashEntry<K,V>)newTable[k];
newTable[k] = new HashEntry<K,V>(p.key, p.hash,
n, p.value);
}
}
}
}
table = newTable;
}
/**
* Remove; match on key only if value null, else match both.
*/
V remove(K key, int hash, Object value) {
lock();
try {
int c = count - 1;
HashEntry[] tab = table;
int index = hash & (tab.length - 1);
HashEntry<K,V> first = (HashEntry<K,V>)tab[index];
HashEntry<K,V> e = first;
while (e != null && (e.hash != hash || !myHashingStrategy.equals(key,e.key)))
e = e.next;
V oldValue = null;
if (e != null) {
V v = e.value;
if (value == null || value.equals(v)) {
oldValue = v;
// All entries following removed node can stay
// in list, but all preceding ones need to be
// cloned.
++modCount;
HashEntry<K,V> newFirst = e.next;
for (HashEntry<K,V> p = first; p != e; p = p.next)
newFirst = new HashEntry<K,V>(p.key, p.hash,
newFirst, p.value);
tab[index] = newFirst;
count = c; // write-volatile
}
}
return oldValue;
} finally {
unlock();
}
}
void clear() {
if (count != 0) {
lock();
try {
HashEntry[] tab = table;
for (int i = 0; i < tab.length ; i++)
tab[i] = null;
++modCount;
count = 0; // write-volatile
} finally {
unlock();
}
}
}
}
/* ---------------- Public operations -------------- */
public ConcurrentHashMap(TObjectHashingStrategy<K> hashingStrategy) {
this(DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR, DEFAULT_SEGMENTS,hashingStrategy);
}
/**
* Creates a new, empty map with the specified initial
* capacity, load factor, and concurrency level.
*
* @param initialCapacity the initial capacity. The implementation
* performs internal sizing to accommodate this many elements.
* @param loadFactor the load factor threshold, used to control resizing.
* Resizing may be performed when the average number of elements per
* bin exceeds this threshold.
* @param concurrencyLevel the estimated number of concurrently
* updating threads. The implementation performs internal sizing
* to try to accommodate this many threads.
* @throws IllegalArgumentException if the initial capacity is
* negative or the load factor or concurrencyLevel are
* nonpositive.
*/
public ConcurrentHashMap(int initialCapacity,
float loadFactor, int concurrencyLevel) {
this(initialCapacity,loadFactor, concurrencyLevel,null);
}
public ConcurrentHashMap(int initialCapacity, float loadFactor, int concurrencyLevel, TObjectHashingStrategy<K> hashingStrategy) {
if (!(loadFactor > 0) || initialCapacity < 0 || concurrencyLevel <= 0)
throw new IllegalArgumentException();
if (concurrencyLevel > MAX_SEGMENTS)
concurrencyLevel = MAX_SEGMENTS;
// Find power-of-two sizes best matching arguments
int sshift = 0;
int ssize = 1;
while (ssize < concurrencyLevel) {
++sshift;
ssize <<= 1;
}
segmentShift = 12; // the middle of the hash is much more random that its HSB. Especially when we use TObjectHashingStrategy.CANONICAl as a hash provider
segmentMask = ssize - 1;
segments = new Segment[ssize];
if (initialCapacity > MAXIMUM_CAPACITY)
initialCapacity = MAXIMUM_CAPACITY;
int c = initialCapacity / ssize;
if (c * ssize < initialCapacity)
++c;
int cap = 1;
while (cap < c)
cap <<= 1;
hashingStrategy = hashingStrategy == null ? this : hashingStrategy;
for (int i = 0; i < segments.length; ++i)
segments[i] = new Segment<K,V>(cap, loadFactor,hashingStrategy);
myHashingStrategy = hashingStrategy;
}
/**
* Creates a new, empty map with the specified initial
* capacity, and with default load factor and concurrencyLevel.
*
* @param initialCapacity the initial capacity. The implementation
* performs internal sizing to accommodate this many elements.
* @throws IllegalArgumentException if the initial capacity of
* elements is negative.
*/
public ConcurrentHashMap(int initialCapacity) {
this(initialCapacity, DEFAULT_LOAD_FACTOR, DEFAULT_SEGMENTS);
}
/**
* Creates a new, empty map with a default initial capacity,
* load factor, and concurrencyLevel.
*/
public ConcurrentHashMap() {
this(DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR, DEFAULT_SEGMENTS);
}
/**
* Creates a new map with the same mappings as the given map. The
* map is created with a capacity of twice the number of mappings in
* the given map or 11 (whichever is greater), and a default load factor
* and concurrencyLevel.
* @param t the map
*/
public ConcurrentHashMap(Map<? extends K, ? extends V> t) {
this(Math.max((int) (t.size() / DEFAULT_LOAD_FACTOR) + 1,
11),
DEFAULT_LOAD_FACTOR, DEFAULT_SEGMENTS);
putAll(t);
}
// inherit Map javadoc
@Override
public boolean isEmpty() {
final Segment[] segments = this.segments;
/*
* We keep track of per-segment modCounts to avoid ABA
* problems in which an element in one segment was added and
* in another removed during traversal, in which case the
* table was never actually empty at any point. Note the
* similar use of modCounts in the size() and containsValue()
* methods, which are the only other methods also susceptible
* to ABA problems.
*/
int[] mc = new int[segments.length];
int mcsum = 0;
for (int i = 0; i < segments.length; ++i) {
if (segments[i].count != 0)
return false;
else
mcsum += mc[i] = segments[i].modCount;
}
// If mcsum happens to be zero, then we know we got a snapshot
// before any modifications at all were made. This is
// probably common enough to bother tracking.
if (mcsum != 0) {
for (int i = 0; i < segments.length; ++i) {
if (segments[i].count != 0 ||
mc[i] != segments[i].modCount)
return false;
}
}
return true;
}
// inherit Map javadoc
@Override
public int size() {
final Segment[] segments = this.segments;
long sum = 0;
long check = 0;
int[] mc = new int[segments.length];
// Try a few times to get accurate count. On failure due to
// continuous async changes in table, resort to locking.
for (int k = 0; k < RETRIES_BEFORE_LOCK; ++k) {
check = 0;
sum = 0;
int mcsum = 0;
for (int i = 0; i < segments.length; ++i) {
sum += segments[i].count;
mcsum += mc[i] = segments[i].modCount;
}
if (mcsum != 0) {
for (int i = 0; i < segments.length; ++i) {
check += segments[i].count;
if (mc[i] != segments[i].modCount) {
check = -1; // force retry
break;
}
}
}
if (check == sum)
break;
}
if (check != sum) { // Resort to locking all segments
sum = 0;
for (Segment segment : segments) segment.lock();
for (Segment segment : segments) sum += segment.count;
for (Segment segment : segments) segment.unlock();
}
return sum > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int)sum;
}
/**
* Returns the value to which the specified key is mapped in this table.
*
* @param key a key in the table.
* @return the value to which the key is mapped in this table;
* <tt>null</tt> if the key is not mapped to any value in
* this table.
* @throws NullPointerException if the key is
* <tt>null</tt>.
*/
@Override
public V get(Object key) {
int hash = myHashingStrategy.computeHashCode((K)key); // throws NullPointerException if key null
return segmentFor(hash).get((K)key, hash);
}
/**
* Tests if the specified object is a key in this table.
*
* @param key possible key.
* @return <tt>true</tt> if and only if the specified object
* is a key in this table, as determined by the
* <tt>equals</tt> method; <tt>false</tt> otherwise.
* @throws NullPointerException if the key is
* <tt>null</tt>.
*/
@Override
public boolean containsKey(Object key) {
int hash = myHashingStrategy.computeHashCode((K)key); // throws NullPointerException if key null
return segmentFor(hash).containsKey((K)key, hash);
}
/**
* Returns <tt>true</tt> if this map maps one or more keys to the
* specified value. Note: This method requires a full internal
* traversal of the hash table, and so is much slower than
* method <tt>containsKey</tt>.
*
* @param value value whose presence in this map is to be tested.
* @return <tt>true</tt> if this map maps one or more keys to the
* specified value.
* @throws NullPointerException if the value is <tt>null</tt>.
*/
@Override
public boolean containsValue(@NotNull Object value) {
// See explanation of modCount use above
final Segment[] segments = this.segments;
int[] mc = new int[segments.length];
// Try a few times without locking
for (int k = 0; k < RETRIES_BEFORE_LOCK; ++k) {
int sum = 0;
int mcsum = 0;
for (int i = 0; i < segments.length; ++i) {
int c = segments[i].count;
mcsum += mc[i] = segments[i].modCount;
if (segments[i].containsValue(value))
return true;
}
boolean cleanSweep = true;
if (mcsum != 0) {
for (int i = 0; i < segments.length; ++i) {
int c = segments[i].count;
if (mc[i] != segments[i].modCount) {
cleanSweep = false;
break;
}
}
}
if (cleanSweep)
return false;
}
// Resort to locking all segments
for (int i = 0; i < segments.length; ++i)
segments[i].lock();
boolean found = false;
try {
for (int i = 0; i < segments.length; ++i) {
if (segments[i].containsValue(value)) {
found = true;
break;
}
}
} finally {
for (int i = 0; i < segments.length; ++i)
segments[i].unlock();
}
return found;
}
/**
* Legacy method testing if some key maps into the specified value
* in this table. This method is identical in functionality to
* {@link #containsValue}, and exists solely to ensure
* full compatibility with class {@link java.util.Hashtable},
* which supported this method prior to introduction of the
* Java Collections framework.
* @param value a value to search for.
* @return <tt>true</tt> if and only if some key maps to the
* <tt>value</tt> argument in this table as
* determined by the <tt>equals</tt> method;
* <tt>false</tt> otherwise.
* @throws NullPointerException if the value is <tt>null</tt>.
*/
public boolean contains(Object value) {
return containsValue(value);
}
/**
* Maps the specified <tt>key</tt> to the specified
* <tt>value</tt> in this table. Neither the key nor the
* value can be <tt>null</tt>.
*
* <p> The value can be retrieved by calling the <tt>get</tt> method
* with a key that is equal to the original key.
*
* @param key the table key.
* @param value the value.
* @return the previous value of the specified key in this table,
* or <tt>null</tt> if it did not have one.
* @throws NullPointerException if the key or value is
* <tt>null</tt>.
*/
@Override
public V put(K key, @NotNull V value) {
int hash = myHashingStrategy.computeHashCode(key);
return segmentFor(hash).put(key, hash, value, false);
}
/**
* If the specified key is not already associated
* with a value, associate it with the given value.
* This is equivalent to
* <pre>
* if (!map.containsKey(key))
* return map.put(key, value);
* else
* return map.get(key);
* </pre>
* Except that the action is performed atomically.
* @param key key with which the specified value is to be associated.
* @param value value to be associated with the specified key.
* @return previous value associated with specified key, or <tt>null</tt>
* if there was no mapping for key.
* @throws NullPointerException if the specified key or value is
* <tt>null</tt>.
*/
@Override
public V putIfAbsent(@NotNull K key, @NotNull V value) {
int hash = myHashingStrategy.computeHashCode(key);
return segmentFor(hash).put(key, hash, value, true);
}
/**
* Copies all of the mappings from the specified map to this one.
*
* These mappings replace any mappings that this map had for any of the
* keys currently in the specified Map.
*
* @param t Mappings to be stored in this map.
*/
@Override
public void putAll(Map<? extends K, ? extends V> t) {
for (Iterator<? extends Entry<? extends K, ? extends V>> it = (Iterator<? extends Entry<? extends K, ? extends V>>) t.entrySet().iterator(); it.hasNext(); ) {
Entry<? extends K, ? extends V> e = it.next();
put(e.getKey(), e.getValue());
}
}
/**
* Removes the key (and its corresponding value) from this
* table. This method does nothing if the key is not in the table.
*
* @param key the key that needs to be removed.
* @return the value to which the key had been mapped in this table,
* or <tt>null</tt> if the key did not have a mapping.
* @throws NullPointerException if the key is
* <tt>null</tt>.
*/
@Override
public V remove(Object key) {
int hash = myHashingStrategy.computeHashCode((K)key);
return segmentFor(hash).remove((K)key, hash, null);
}
/**
* Remove entry for key only if currently mapped to given value.
* Acts as
* <pre>
* if (map.get(key).equals(value)) {
* map.remove(key);
* return true;
* } else return false;
* </pre>
* except that the action is performed atomically.
* @param key key with which the specified value is associated.
* @param value value associated with the specified key.
* @return true if the value was removed
* @throws NullPointerException if the specified key is
* <tt>null</tt>.
*/
@Override
public boolean remove(@NotNull Object key, Object value) {
int hash = myHashingStrategy.computeHashCode((K)key);
return remove((K)key, hash, value);
}
public boolean remove(@NotNull K key, int hash, Object value) {
return segmentFor(hash).remove(key, hash, value) != null;
}
/**
* Replace entry for key only if currently mapped to given value.
* Acts as
* <pre>
* if (map.get(key).equals(oldValue)) {
* map.put(key, newValue);
* return true;
* } else return false;
* </pre>
* except that the action is performed atomically.
* @param key key with which the specified value is associated.
* @param oldValue value expected to be associated with the specified key.
* @param newValue value to be associated with the specified key.
* @return true if the value was replaced
* @throws NullPointerException if the specified key or values are
* <tt>null</tt>.
*/
@Override
public boolean replace(@NotNull K key, @NotNull V oldValue, @NotNull V newValue) {
int hash = myHashingStrategy.computeHashCode(key);
return segmentFor(hash).replace(key, hash, oldValue, newValue);
}
/**
* Replace entry for key only if currently mapped to some value.
* Acts as
* <pre>
* if ((map.containsKey(key)) {
* return map.put(key, value);
* } else return null;
* </pre>
* except that the action is performed atomically.
* @param key key with which the specified value is associated.
* @param value value to be associated with the specified key.
* @return previous value associated with specified key, or <tt>null</tt>
* if there was no mapping for key.
* @throws NullPointerException if the specified key or value is
* <tt>null</tt>.
*/
@Override
public V replace(@NotNull K key, @NotNull V value) {
int hash = myHashingStrategy.computeHashCode(key);
return segmentFor(hash).replace(key, hash, value);
}
/**
* Removes all mappings from this map.
*/
@Override
public void clear() {
for (Segment segment : segments) segment.clear();
}
/**
* Returns a set view of the keys contained in this map. The set is
* backed by the map, so changes to the map are reflected in the set, and
* vice-versa. The set supports element removal, which removes the
* corresponding mapping from this map, via the <tt>Iterator.remove</tt>,
* <tt>Set.remove</tt>, <tt>removeAll</tt>, <tt>retainAll</tt>, and
* <tt>clear</tt> operations. It does not support the <tt>add</tt> or
* <tt>addAll</tt> operations.
* The view's returned <tt>iterator</tt> is a "weakly consistent" iterator that
* will never throw {@link java.util.ConcurrentModificationException},
* and guarantees to traverse elements as they existed upon
* construction of the iterator, and may (but is not guaranteed to)
* reflect any modifications subsequent to construction.
*
* @return a set view of the keys contained in this map.
*/
@Override
public Set<K> keySet() {
Set<K> ks = keySet;
return (ks != null) ? ks : (keySet = new KeySet());
}
/**
* Returns a collection view of the values contained in this map. The
* collection is backed by the map, so changes to the map are reflected in
* the collection, and vice-versa. The collection supports element
* removal, which removes the corresponding mapping from this map, via the
* <tt>Iterator.remove</tt>, <tt>Collection.remove</tt>,
* <tt>removeAll</tt>, <tt>retainAll</tt>, and <tt>clear</tt> operations.
* It does not support the <tt>add</tt> or <tt>addAll</tt> operations.
* The view's returned <tt>iterator</tt> is a "weakly consistent" iterator that
* will never throw {@link java.util.ConcurrentModificationException},
* and guarantees to traverse elements as they existed upon
* construction of the iterator, and may (but is not guaranteed to)
* reflect any modifications subsequent to construction.
*
* @return a collection view of the values contained in this map.
*/
@Override
public Collection<V> values() {
Collection<V> vs = values;
return (vs != null) ? vs : (values = new Values());
}
/**
* Returns a collection view of the mappings contained in this map. Each
* element in the returned collection is a <tt>Map.Entry</tt>. The
* collection is backed by the map, so changes to the map are reflected in
* the collection, and vice-versa. The collection supports element
* removal, which removes the corresponding mapping from the map, via the
* <tt>Iterator.remove</tt>, <tt>Collection.remove</tt>,
* <tt>removeAll</tt>, <tt>retainAll</tt>, and <tt>clear</tt> operations.
* It does not support the <tt>add</tt> or <tt>addAll</tt> operations.
* The view's returned <tt>iterator</tt> is a "weakly consistent" iterator that
* will never throw {@link java.util.ConcurrentModificationException},
* and guarantees to traverse elements as they existed upon
* construction of the iterator, and may (but is not guaranteed to)
* reflect any modifications subsequent to construction.
*
* @return a collection view of the mappings contained in this map.
*/
@Override
public Set<Entry<K,V>> entrySet() {
Set<Entry<K,V>> es = entrySet;
return (es != null) ? es : (entrySet = (Set<Entry<K,V>>) (Set) new EntrySet());
}
/**
* Returns an enumeration of the keys in this table.
*
* @return an enumeration of the keys in this table.
* @see #keySet
*/
public Enumeration<K> keys() {
return new KeyIterator();
}
/**
* Returns an enumeration of the values in this table.
*
* @return an enumeration of the values in this table.
* @see #values
*/
public Enumeration<V> elements() {
return new ValueIterator();
}
/* ---------------- Iterator Support -------------- */
abstract class HashIterator {
int nextSegmentIndex;
int nextTableIndex;
HashEntry[] currentTable;
HashEntry<K, V> nextEntry;
HashEntry<K, V> lastReturned;
HashIterator() {
nextSegmentIndex = segments.length - 1;
nextTableIndex = -1;
advance();
}
public boolean hasMoreElements() { return hasNext(); }
final void advance() {
if (nextEntry != null && (nextEntry = nextEntry.next) != null)
return;
while (nextTableIndex >= 0) {
if ( (nextEntry = (HashEntry<K,V>)currentTable[nextTableIndex--]) != null)
return;
}
while (nextSegmentIndex >= 0) {
Segment seg = (Segment)segments[nextSegmentIndex--];
if (seg.count != 0) {
currentTable = seg.table;
for (int j = currentTable.length - 1; j >= 0; --j) {
if ( (nextEntry = (HashEntry<K,V>)currentTable[j]) != null) {
nextTableIndex = j - 1;
return;
}
}
}
}
}
public boolean hasNext() { return nextEntry != null; }
HashEntry<K,V> nextEntry() {
if (nextEntry == null)
throw new NoSuchElementException();
lastReturned = nextEntry;
advance();
return lastReturned;
}
public void remove() {
if (lastReturned == null)
throw new IllegalStateException();
ConcurrentHashMap.this.remove(lastReturned.key);
lastReturned = null;
}
}
final class KeyIterator extends HashIterator implements Iterator<K>, Enumeration<K> {
@Override
public K next() { return super.nextEntry().key; }
@Override
public K nextElement() { return super.nextEntry().key; }
}
final class ValueIterator extends HashIterator implements Iterator<V>, Enumeration<V> {
@Override
public V next() { return super.nextEntry().value; }
@Override
public V nextElement() { return super.nextEntry().value; }
}
/**
* Entry iterator. Exported Entry objects must write-through
* changes in setValue, even if the nodes have been cloned. So we
* cannot return internal HashEntry objects. Instead, the iterator
* itself acts as a forwarding pseudo-entry.
*/
final class EntryIterator extends HashIterator implements Entry<K,V>, Iterator<Entry<K,V>> {
@Override
public Entry<K,V> next() {
nextEntry();
return this;
}
@Override
public K getKey() {
if (lastReturned == null)
throw new IllegalStateException("Entry was removed");
return lastReturned.key;
}
@Override
public V getValue() {
if (lastReturned == null)
throw new IllegalStateException("Entry was removed");
return get(lastReturned.key);
}
@Override
public V setValue(V value) {
if (lastReturned == null)
throw new IllegalStateException("Entry was removed");
return put(lastReturned.key, value);
}
public boolean equals(Object o) {
// If not acting as entry, just use default.
if (lastReturned == null)
return super.equals(o);
if (!(o instanceof Entry))
return false;
Entry e = (Entry)o;
K o1 = getKey();
K o2 = (K)e.getKey();
return (o1 == null ? o2 == null : myHashingStrategy.equals(o1,o2)) && eq(getValue(), e.getValue());
}
public int hashCode() {
// If not acting as entry, just use default.
if (lastReturned == null)
return super.hashCode();
Object k = getKey();
Object v = getValue();
return ((k == null) ? 0 : k.hashCode()) ^
((v == null) ? 0 : v.hashCode());
}
public String toString() {
// If not acting as entry, just use default.
if (lastReturned == null)
return super.toString();
else
return getKey() + "=" + getValue();
}
boolean eq(Object o1, Object o2) {
return (o1 == null ? o2 == null : o1.equals(o2));
}
}
final class KeySet extends AbstractSet<K> {
@Override
public Iterator<K> iterator() {
return new KeyIterator();
}
@Override
public int size() {
return ConcurrentHashMap.this.size();
}
@Override
public boolean contains(Object o) {
return containsKey(o);
}
@Override
public boolean remove(Object o) {
return ConcurrentHashMap.this.remove(o) != null;
}
@Override
public void clear() {
ConcurrentHashMap.this.clear();
}
@Override
public Object[] toArray() {
Collection<K> c = new ArrayList<K>();
for (Iterator<K> i = iterator(); i.hasNext(); )
c.add(i.next());
return c.toArray();
}
@Override
public <T> T[] toArray(T[] a) {
Collection<K> c = new ArrayList<K>();
for (Iterator<K> i = iterator(); i.hasNext(); )
c.add(i.next());
return c.toArray(a);
}
}
final class Values extends AbstractCollection<V> {
@Override
public Iterator<V> iterator() {
return new ValueIterator();
}
@Override
public int size() {
return ConcurrentHashMap.this.size();
}
@Override
public boolean contains(Object o) {
return containsValue(o);
}
@Override
public void clear() {
ConcurrentHashMap.this.clear();
}
@Override
public Object[] toArray() {
Collection<V> c = new ArrayList<V>();
for (Iterator<V> i = iterator(); i.hasNext(); )
c.add(i.next());
return c.toArray();
}
@Override
public <T> T[] toArray(T[] a) {
Collection<V> c = new ArrayList<V>();
for (Iterator<V> i = iterator(); i.hasNext(); )
c.add(i.next());
return c.toArray(a);
}
}
final class EntrySet extends AbstractSet<Entry<K,V>> {
@Override
public Iterator<Entry<K,V>> iterator() {
return new EntryIterator();
}
@Override
public boolean contains(Object o) {
if (!(o instanceof Entry))
return false;
Entry<K,V> e = (Entry<K,V>)o;
V v = get(e.getKey());
return v != null && v.equals(e.getValue());
}
@Override
public boolean remove(Object o) {
if (!(o instanceof Entry))
return false;
Entry<K,V> e = (Entry<K,V>)o;
return ConcurrentHashMap.this.remove(e.getKey(), e.getValue());
}
@Override
public int size() {
return ConcurrentHashMap.this.size();
}
@Override
public void clear() {
ConcurrentHashMap.this.clear();
}
@Override
public Object[] toArray() {
// Since we don't ordinarily have distinct Entry objects, we
// must pack elements using exportable SimpleEntry
Collection<Entry<K,V>> c = new ArrayList<Entry<K,V>>(size());
for (Iterator<Entry<K,V>> i = iterator(); i.hasNext(); )
c.add(new SimpleEntry(i.next()));
return c.toArray();
}
@Override
public <T> T[] toArray(T[] a) {
Collection<Entry<K,V>> c = new ArrayList<Entry<K,V>>(size());
for (Iterator<Entry<K,V>> i = iterator(); i.hasNext(); )
c.add(new SimpleEntry(i.next()));
return c.toArray(a);
}
}
/**
* This duplicates java.util.AbstractMap.SimpleEntry until this class
* is made accessible.
*/
final class SimpleEntry implements Entry<K,V> {
K key;
V value;
public SimpleEntry(K key, V value) {
this.key = key;
this.value = value;
}
public SimpleEntry(Entry<K,V> e) {
key = e.getKey();
value = e.getValue();
}
@Override
public K getKey() {
return key;
}
@Override
public V getValue() {
return value;
}
@Override
public V setValue(V value) {
V oldValue = this.value;
this.value = value;
return oldValue;
}
public boolean equals(Object o) {
if (!(o instanceof Entry))
return false;
Entry e = (Entry)o;
K o2 = (K)e.getKey();
return (key == null ? o2 == null : myHashingStrategy.equals(key,o2)) && eq(value, e.getValue());
}
public int hashCode() {
return ((key == null) ? 0 : key.hashCode()) ^
((value == null) ? 0 : value.hashCode());
}
public String toString() {
return key + "=" + value;
}
boolean eq(Object o1, Object o2) {
return (o1 == null ? o2 == null : o1.equals(o2));
}
}
/* ---------------- Serialization Support -------------- */
/**
* Save the state of the <tt>ConcurrentHashMap</tt>
* instance to a stream (i.e.,
* serialize it).
* @param s the stream
* @serialData
* the key (Object) and value (Object)
* for each key-value mapping, followed by a null pair.
* The key-value mappings are emitted in no particular order.
*/
private void writeObject(java.io.ObjectOutputStream s) throws IOException {
s.defaultWriteObject();
for (int k = 0; k < segments.length; ++k) {
Segment seg = segments[k];
seg.lock();
try {
HashEntry[] tab = seg.table;
for (int i = 0; i < tab.length; ++i) {
for (HashEntry<K,V> e = (HashEntry<K,V>)tab[i]; e != null; e = e.next) {
s.writeObject(e.key);
s.writeObject(e.value);
}
}
} finally {
seg.unlock();
}
}
s.writeObject(null);
s.writeObject(null);
}
/**
* Reconstitute the <tt>ConcurrentHashMap</tt>
* instance from a stream (i.e.,
* deserialize it).
* @param s the stream
*/
private void readObject(java.io.ObjectInputStream s)
throws IOException, ClassNotFoundException {
s.defaultReadObject();
// Initialize each segment to be minimally sized, and let grow.
for (int i = 0; i < segments.length; ++i) {
segments[i].setTable(new HashEntry[1]);
}
// Read the keys and values, and put the mappings in the table
for (;;) {
K key = (K) s.readObject();
V value = (V) s.readObject();
if (key == null)
break;
put(key, value);
}
}
@Override
public int computeHashCode(final K object) {
int h = object.hashCode();
h += ~(h << 9);
h ^= (h >>> 14);
h += (h << 4);
h ^= (h >>> 10);
return h;
}
@Override
public boolean equals(final K o1, final K o2) {
return o1.equals(o2);
}
/**
* @return value if there is no entry in the map, or corresponding value if entry already exists
*/
public V cacheOrGet(final K key, final V value) {
return ConcurrencyUtil.cacheOrGet(this, key, value);
}
}
|
android-ia/platform_tools_idea
|
platform/util/src/com/intellij/util/containers/ConcurrentHashMap.java
|
Java
|
apache-2.0
| 45,553
|
/*
* Copyright (C) 2011 Everit Kft. (http://www.everit.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.everit.persistence.querydsl.sqltemplates.ecm.internal;
import java.util.Map;
import java.util.Objects;
import org.everit.persistence.querydsl.sqltemplates.ecm.SQLTemplatesConstants;
import com.mysema.query.sql.SQLTemplates.Builder;
/**
* Sets the properties for an instantiated SQLTemplates builder based on the configuration of the
* component.
*/
public final class SQLTemplateConfigurator {
private final Map<String, Object> config;
private final Builder sqlTemplate;
/**
* Constructor.
*
* @param sqlTemplate
* The sql template to be configured.
* @param config
* The component configuration to be used to set up the {@code sqlTemplate}
* @throws NullPointerException
* if any of the parameters is {@code null}
*/
public SQLTemplateConfigurator(final Builder sqlTemplate, final Map<String, Object> config) {
this.sqlTemplate = Objects.requireNonNull(sqlTemplate, "sqlTemplate cannot be null");
this.config = Objects.requireNonNull(config, "config cannot be null");
}
/**
* Sets the properties for an instantiated SQLTemplates builder based on the configuration of the
* component.
*/
public void configure() {
if (getBooleanProp(SQLTemplatesConstants.ATTR_PRINT_SCHEMA)) {
sqlTemplate.printSchema();
}
if (getBooleanProp(SQLTemplatesConstants.ATTR_QUOTE)) {
sqlTemplate.quote();
}
if (getBooleanProp(SQLTemplatesConstants.ATTR_NEW_LINE_TO_SINGLE_SPACE)) {
sqlTemplate.newLineToSingleSpace();
}
Character escapeChar = getCharacterProp(SQLTemplatesConstants.ATTR_ESCAPE);
if (escapeChar != null) {
sqlTemplate.escape(escapeChar.charValue());
}
}
private IllegalStateException exceptionForInvalidValue(final String name,
final Object rawValue, final String expectedType) {
return new IllegalStateException(
"config[" + name + "] is expected to be a " + expectedType + ", got "
+ (rawValue != null ? rawValue.getClass() : "null") + " instead");
}
/**
* Gets boolean property value.
*
* @param name
* the name of the property to be obtained from {@code config}.
* @return {@link Boolean#FALSE} if config[name] is not found
*/
private Boolean getBooleanProp(final String name) {
Object rawValue = null;
try {
rawValue = config.getOrDefault(name, Boolean.FALSE);
return (Boolean) rawValue;
} catch (ClassCastException e) {
throw exceptionForInvalidValue(name, rawValue, "Boolean");
}
}
/**
* Gets char property value.
*
* @param name
* the name of the property to be obtained from {@code config}.
* @return {@code null} if config[name] is not found
*/
private Character getCharacterProp(final String name) {
Object rawValue = null;
try {
rawValue = config.get(name);
return (Character) rawValue;
} catch (ClassCastException e) {
throw exceptionForInvalidValue(name, rawValue, "Character");
}
}
}
|
everit-org-archive/querydsl-sqltemplates-ecm
|
component/src/main/java/org/everit/persistence/querydsl/sqltemplates/ecm/internal/SQLTemplateConfigurator.java
|
Java
|
apache-2.0
| 3,663
|
program main
use iso_c_binding, only: c_int, c_char, c_null_char, c_ptr
use gzip, only: gzopen, gzwrite, gzclose
implicit none
character(kind=c_char,len=*), parameter :: path = &
c_char_"test.gz"//c_null_char
character(kind=c_char,len=*), parameter :: mode = &
c_char_"wb9"//c_null_char
integer(c_int), parameter :: buffer_size = 512
type(c_ptr) :: file
character(len=buffer_size) :: buffer
integer(c_int) :: ret
integer :: i
! open file
file = gzopen(path, mode)
! fill buffer with data
do i=1,buffer_size/4
write(buffer(4*(i-1)+1:4*i), '(i3.3, a)') i, new_line('')
end do
ret = gzwrite(file, buffer, buffer_size)
if (ret.ne.buffer_size) then
write(*,'(a, i3, a, i3, a)') 'Error: ', ret, ' / ', buffer_size, &
' bytes written.'
stop 1
end if
! close file
ret = gzclose(file)
if (ret.ne.0) then
print *, 'Error: failure to close file with error code ', ret
stop 1
end if
end program main
|
thiblahute/meson
|
test cases/fortran/10 find library/main.f90
|
FORTRAN
|
apache-2.0
| 989
|
goog.provide('ol.format.ogc.filter.Or');
goog.require('ol');
goog.require('ol.format.ogc.filter.LogicalBinary');
/**
* @classdesc
* Represents a logical `<Or>` operator between two filter conditions.
*
* @constructor
* @param {!ol.format.ogc.filter.Filter} conditionA First filter condition.
* @param {!ol.format.ogc.filter.Filter} conditionB Second filter condition.
* @extends {ol.format.ogc.filter.LogicalBinary}
* @api
*/
ol.format.ogc.filter.Or = function(conditionA, conditionB) {
ol.format.ogc.filter.LogicalBinary.call(this, 'Or', conditionA, conditionB);
};
ol.inherits(ol.format.ogc.filter.Or, ol.format.ogc.filter.LogicalBinary);
|
fblackburn/ol3
|
src/ol/format/ogc/filter/or.js
|
JavaScript
|
bsd-2-clause
| 655
|
"""Remove uniqueness in Repo
Revision ID: 51d493c4d3e1
Revises: 5ac5404bfcd9
Create Date: 2015-05-11 18:55:46.065354
"""
# revision identifiers, used by Alembic.
revision = '51d493c4d3e1'
down_revision = '5ac5404bfcd9'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_index(u'ix_RepositoryApps_url', table_name='RepositoryApps')
op.create_index(u'ix_RepositoryApps_url', 'RepositoryApps', ['url'], unique=False)
### end Alembic commands ###
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_index(u'ix_RepositoryApps_url', table_name='RepositoryApps')
op.create_index(u'ix_RepositoryApps_url', 'RepositoryApps', [u'url'], unique=True)
### end Alembic commands ###
|
go-lab/appcomposer
|
alembic/versions/51d493c4d3e1_remove_uniqueness_in_repo.py
|
Python
|
bsd-2-clause
| 820
|
class Bc < Formula
desc "Arbitrary precision numeric processing language"
homepage "https://www.gnu.org/software/bc/"
url "https://ftp.gnu.org/gnu/bc/bc-1.07.1.tar.gz"
mirror "https://ftpmirror.gnu.org/bc/bc-1.07.1.tar.gz"
sha256 "62adfca89b0a1c0164c2cdca59ca210c1d44c3ffc46daf9931cf4942664cb02a"
license "GPL-3.0"
livecheck do
url :stable
end
bottle do
cellar :any_skip_relocation
rebuild 1
sha256 "9fdbf6f45737082f911073b3c291399487bc3a3cfd1285e0da389436064c438f" => :catalina
sha256 "78372f9830096b6d63fa7278e141924869a9aaee250b2ac1135594e67ba76c09" => :mojave
sha256 "0baf2e31191d80258636186bf9adcdf6b3f554f213d36cb3054213f736e52bf1" => :high_sierra
sha256 "1d8f0459c0b67aae275c43e01e5312146be72163acadd3d6c8f2bc440181508c" => :sierra
sha256 "e5c4b3fa712d705c3cc9bfae12242c9b4dc429e329c61d12aa01b65c1623a11f" => :el_capitan
end
keg_only :provided_by_macos
uses_from_macos "bison" => :build
uses_from_macos "ed" => :build
uses_from_macos "flex"
def install
# prevent user BC_ENV_ARGS from interfering with or influencing the
# bootstrap phase of the build, particularly
# BC_ENV_ARGS="--mathlib=./my_custom_stuff.b"
ENV.delete("BC_ENV_ARGS")
system "./configure",
"--disable-debug",
"--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}",
"--infodir=#{info}",
"--mandir=#{man}",
"--with-libedit"
system "make", "install"
end
test do
system "#{bin}/bc", "--version"
assert_match "2", pipe_output("#{bin}/bc", "1+1\n")
end
end
|
jabenninghoff/homebrew-core
|
Formula/bc.rb
|
Ruby
|
bsd-2-clause
| 1,601
|
package core
// Clients _
type Clients []*Client
// RLockRecursive _
func (cs *Clients) RLockRecursive() {
for _, client := range *cs {
client.RLockAnon()
}
}
// RUnlockRecursive _
func (cs *Clients) RUnlockRecursive() {
for _, client := range *cs {
client.RUnlockAnon()
}
}
|
MG-RAST/AWE
|
lib/core/clients.go
|
GO
|
bsd-2-clause
| 286
|
/*
* Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>.
* All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
#include <asn_internal.h>
#include <constr_SET.h>
/* Check that all the mandatory members are present */
static int _SET_is_populated(const asn_TYPE_descriptor_t *td, const void *st);
/*
* Number of bytes left for this structure.
* (ctx->left) indicates the number of bytes _transferred_ for the structure.
* (size) contains the number of bytes in the buffer passed.
*/
#define LEFT ((size<(size_t)ctx->left)?size:(size_t)ctx->left)
/*
* If the subprocessor function returns with an indication that it wants
* more data, it may well be a fatal decoding problem, because the
* size is constrained by the <TLV>'s L, even if the buffer size allows
* reading more data.
* For example, consider the buffer containing the following TLVs:
* <T:5><L:1><V> <T:6>...
* The TLV length clearly indicates that one byte is expected in V, but
* if the V processor returns with "want more data" even if the buffer
* contains way more data than the V processor have seen.
*/
#define SIZE_VIOLATION (ctx->left >= 0 && (size_t)ctx->left <= size)
/*
* This macro "eats" the part of the buffer which is definitely "consumed",
* i.e. was correctly converted into local representation or rightfully skipped.
*/
#undef ADVANCE
#define ADVANCE(num_bytes) do { \
size_t num = num_bytes; \
ptr = ((const char *)ptr) + num;\
size -= num; \
if(ctx->left >= 0) \
ctx->left -= num; \
consumed_myself += num; \
} while(0)
/*
* Switch to the next phase of parsing.
*/
#undef NEXT_PHASE
#define NEXT_PHASE(ctx) do { \
ctx->phase++; \
ctx->step = 0; \
} while(0)
/*
* Return a standardized complex structure.
*/
#undef RETURN
#define RETURN(_code) do { \
rval.code = _code; \
rval.consumed = consumed_myself;\
return rval; \
} while(0)
/*
* Tags are canonically sorted in the tag2element map.
*/
static int
_t2e_cmp(const void *ap, const void *bp) {
const asn_TYPE_tag2member_t *a = (const asn_TYPE_tag2member_t *)ap;
const asn_TYPE_tag2member_t *b = (const asn_TYPE_tag2member_t *)bp;
int a_class = BER_TAG_CLASS(a->el_tag);
int b_class = BER_TAG_CLASS(b->el_tag);
if(a_class == b_class) {
ber_tlv_tag_t a_value = BER_TAG_VALUE(a->el_tag);
ber_tlv_tag_t b_value = BER_TAG_VALUE(b->el_tag);
if(a_value == b_value)
return 0;
else if(a_value < b_value)
return -1;
else
return 1;
} else if(a_class < b_class) {
return -1;
} else {
return 1;
}
}
/*
* The decoder of the SET type.
*/
asn_dec_rval_t
SET_decode_ber(const asn_codec_ctx_t *opt_codec_ctx,
const asn_TYPE_descriptor_t *td, void **struct_ptr,
const void *ptr, size_t size, int tag_mode) {
/*
* Bring closer parts of structure description.
*/
const asn_SET_specifics_t *specs = (const asn_SET_specifics_t *)td->specifics;
const asn_TYPE_member_t *elements = td->elements;
/*
* Parts of the structure being constructed.
*/
void *st = *struct_ptr; /* Target structure. */
asn_struct_ctx_t *ctx; /* Decoder context */
ber_tlv_tag_t tlv_tag; /* T from TLV */
asn_dec_rval_t rval; /* Return code from subparsers */
ssize_t consumed_myself = 0; /* Consumed bytes from ptr */
size_t edx; /* SET element's index */
ASN_DEBUG("Decoding %s as SET", td->name);
if(ASN__STACK_OVERFLOW_CHECK(opt_codec_ctx))
ASN__DECODE_FAILED;
/*
* Create the target structure if it is not present already.
*/
if(st == 0) {
st = *struct_ptr = CALLOC(1, specs->struct_size);
if(st == 0) {
RETURN(RC_FAIL);
}
}
/*
* Restore parsing context.
*/
ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset);
/*
* Start to parse where left previously
*/
switch(ctx->phase) {
case 0:
/*
* PHASE 0.
* Check that the set of tags associated with given structure
* perfectly fits our expectations.
*/
rval = ber_check_tags(opt_codec_ctx, td, ctx, ptr, size,
tag_mode, 1, &ctx->left, 0);
if(rval.code != RC_OK) {
ASN_DEBUG("%s tagging check failed: %d",
td->name, rval.code);
return rval;
}
if(ctx->left >= 0)
ctx->left += rval.consumed; /* ?Substracted below! */
ADVANCE(rval.consumed);
NEXT_PHASE(ctx);
ASN_DEBUG("Structure advertised %ld bytes, "
"buffer contains %ld", (long)ctx->left, (long)size);
/* Fall through */
case 1:
/*
* PHASE 1.
* From the place where we've left it previously,
* try to decode the next member from the list of
* this structure's elements.
* Note that elements in BER may arrive out of
* order, yet DER mandates that they shall arive in the
* canonical order of their tags. So, there is a room
* for optimization.
*/
for(;; ctx->step = 0) {
const asn_TYPE_tag2member_t *t2m;
asn_TYPE_tag2member_t key;
void *memb_ptr; /* Pointer to the member */
void **memb_ptr2; /* Pointer to that pointer */
ssize_t tag_len; /* Length of TLV's T */
if(ctx->step & 1) {
edx = ctx->step >> 1;
goto microphase2;
}
/*
* MICROPHASE 1: Synchronize decoding.
*/
if(ctx->left == 0)
/*
* No more things to decode.
* Exit out of here and check whether all mandatory
* elements have been received (in the next phase).
*/
break;
/*
* Fetch the T from TLV.
*/
tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag);
switch(tag_len) {
case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE);
/* Fall through */
case -1: RETURN(RC_FAIL);
}
if(ctx->left < 0 && ((const uint8_t *)ptr)[0] == 0) {
if(LEFT < 2) {
if(SIZE_VIOLATION)
RETURN(RC_FAIL);
else
RETURN(RC_WMORE);
} else if(((const uint8_t *)ptr)[1] == 0) {
/*
* Found the terminator of the
* indefinite length structure.
* Invoke the generic finalization function.
*/
goto phase3;
}
}
key.el_tag = tlv_tag;
t2m = (const asn_TYPE_tag2member_t *)bsearch(&key,
specs->tag2el, specs->tag2el_count,
sizeof(specs->tag2el[0]), _t2e_cmp);
if(t2m) {
/*
* Found the element corresponding to the tag.
*/
edx = t2m->el_no;
ctx->step = (edx << 1) + 1;
ASN_DEBUG("Got tag %s (%s), edx %" ASN_PRI_SSIZE "",
ber_tlv_tag_string(tlv_tag), td->name, edx);
} else if(specs->extensible == 0) {
ASN_DEBUG("Unexpected tag %s "
"in non-extensible SET %s",
ber_tlv_tag_string(tlv_tag), td->name);
RETURN(RC_FAIL);
} else {
/* Skip this tag */
ssize_t skip;
ASN_DEBUG("Skipping unknown tag %s",
ber_tlv_tag_string(tlv_tag));
skip = ber_skip_length(opt_codec_ctx,
BER_TLV_CONSTRUCTED(ptr),
(const char *)ptr + tag_len, LEFT - tag_len);
switch(skip) {
case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE);
/* Fall through */
case -1: RETURN(RC_FAIL);
}
ADVANCE(skip + tag_len);
continue; /* Try again with the next tag */
}
/*
* MICROPHASE 2: Invoke the member-specific decoder.
*/
microphase2:
/*
* Check for duplications: must not overwrite
* already decoded elements.
*/
if(ASN_SET_ISPRESENT2((char *)st + specs->pres_offset, edx)) {
ASN_DEBUG("SET %s: Duplicate element %s (%" ASN_PRI_SSIZE ")",
td->name, elements[edx].name, edx);
RETURN(RC_FAIL);
}
/*
* Compute the position of the member inside a structure,
* and also a type of containment (it may be contained
* as pointer or using inline inclusion).
*/
if(elements[edx].flags & ATF_POINTER) {
/* Member is a pointer to another structure */
memb_ptr2 = (void **)((char *)st + elements[edx].memb_offset);
} else {
/*
* A pointer to a pointer
* holding the start of the structure
*/
memb_ptr = (char *)st + elements[edx].memb_offset;
memb_ptr2 = &memb_ptr;
}
/*
* Invoke the member fetch routine according to member's type
*/
rval = elements[edx].type->op->ber_decoder(opt_codec_ctx,
elements[edx].type,
memb_ptr2, ptr, LEFT,
elements[edx].tag_mode);
switch(rval.code) {
case RC_OK:
ASN_SET_MKPRESENT((char *)st + specs->pres_offset, edx);
break;
case RC_WMORE: /* More data expected */
if(!SIZE_VIOLATION) {
ADVANCE(rval.consumed);
RETURN(RC_WMORE);
}
/* Fall through */
case RC_FAIL: /* Fatal error */
RETURN(RC_FAIL);
} /* switch(rval) */
ADVANCE(rval.consumed);
} /* for(all structure members) */
phase3:
ctx->phase = 3;
/* Fall through */
case 3:
case 4: /* Only 00 is expected */
ASN_DEBUG("SET %s Leftover: %ld, size = %ld",
td->name, (long)ctx->left, (long)size);
/*
* Skip everything until the end of the SET.
*/
while(ctx->left) {
ssize_t tl, ll;
tl = ber_fetch_tag(ptr, LEFT, &tlv_tag);
switch(tl) {
case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE);
/* Fall through */
case -1: RETURN(RC_FAIL);
}
/*
* If expected <0><0>...
*/
if(ctx->left < 0
&& ((const uint8_t *)ptr)[0] == 0) {
if(LEFT < 2) {
if(SIZE_VIOLATION)
RETURN(RC_FAIL);
else
RETURN(RC_WMORE);
} else if(((const uint8_t *)ptr)[1] == 0) {
/*
* Correctly finished with <0><0>.
*/
ADVANCE(2);
ctx->left++;
ctx->phase = 4;
continue;
}
}
if(specs->extensible == 0 || ctx->phase == 4) {
ASN_DEBUG("Unexpected continuation "
"of a non-extensible type %s "
"(ptr=%02x)",
td->name, *(const uint8_t *)ptr);
RETURN(RC_FAIL);
}
ll = ber_skip_length(opt_codec_ctx,
BER_TLV_CONSTRUCTED(ptr),
(const char *)ptr + tl, LEFT - tl);
switch(ll) {
case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE);
/* Fall through */
case -1: RETURN(RC_FAIL);
}
ADVANCE(tl + ll);
}
ctx->phase = 5;
/* Fall through */
case 5:
/* Check that all mandatory elements are present. */
if(!_SET_is_populated(td, st))
RETURN(RC_FAIL);
NEXT_PHASE(ctx);
}
RETURN(RC_OK);
}
static int
_SET_is_populated(const asn_TYPE_descriptor_t *td, const void *st) {
const asn_SET_specifics_t *specs = (const asn_SET_specifics_t *)td->specifics;
size_t edx;
/*
* Check that all mandatory elements are present.
*/
for(edx = 0; edx < td->elements_count;
edx += (8 * sizeof(specs->_mandatory_elements[0]))) {
unsigned int midx, pres, must;
midx = edx/(8 * sizeof(specs->_mandatory_elements[0]));
pres = ((const unsigned int *)((const char *)st
+ specs->pres_offset))[midx];
must = sys_ntohl(specs->_mandatory_elements[midx]);
if((pres & must) == must) {
/*
* Yes, everything seems to be in place.
*/
} else {
ASN_DEBUG("One or more mandatory elements "
"of a SET %s %d (%08x.%08x)=%08x "
"are not present",
td->name,
midx,
pres,
must,
(~(pres & must) & must)
);
return 0;
}
}
return 1;
}
/*
* The DER encoder of the SET type.
*/
asn_enc_rval_t
SET_encode_der(const asn_TYPE_descriptor_t *td, const void *sptr, int tag_mode,
ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) {
const asn_SET_specifics_t *specs = (const asn_SET_specifics_t *)td->specifics;
size_t computed_size = 0;
asn_enc_rval_t er;
int t2m_build_own = (specs->tag2el_count != td->elements_count);
const asn_TYPE_tag2member_t *t2m;
asn_TYPE_tag2member_t *t2m_build;
size_t t2m_count;
ssize_t ret;
size_t edx;
/*
* Use existing, or build our own tags map.
*/
if(t2m_build_own) {
t2m_build = (asn_TYPE_tag2member_t *)CALLOC(td->elements_count,
sizeof(t2m_build[0]));
if(!t2m_build) ASN__ENCODE_FAILED;
t2m_count = 0;
} else {
t2m_build = NULL;
/*
* There is no untagged CHOICE in this SET.
* Employ existing table.
*/
}
/*
* Gather the length of the underlying members sequence.
*/
for(edx = 0; edx < td->elements_count; edx++) {
asn_TYPE_member_t *elm = &td->elements[edx];
asn_enc_rval_t tmper;
const void *memb_ptr_dontuse; /* Pointer to the member */
const void *const *memb_ptr2; /* Pointer to that pointer */
/*
* Compute the length of the encoding of this member.
*/
if(elm->flags & ATF_POINTER) {
memb_ptr2 =
(const void *const *)((const char *)sptr + elm->memb_offset);
if(!*memb_ptr2) {
if(!elm->optional) {
/* Mandatory elements missing */
FREEMEM(t2m_build);
ASN__ENCODE_FAILED;
}
if(t2m_build) {
t2m_build[t2m_count].el_no = edx;
t2m_build[t2m_count].el_tag = 0;
t2m_count++;
}
continue;
}
} else {
memb_ptr_dontuse =
(const void *)((const char *)sptr + elm->memb_offset);
memb_ptr2 = &memb_ptr_dontuse; /* Only use of memb_ptr_dontuse */
}
/* Eliminate default values */
if(elm->default_value_cmp && elm->default_value_cmp(*memb_ptr2) == 0) {
if(t2m_build) {
t2m_build[t2m_count].el_no = edx;
t2m_build[t2m_count].el_tag = 0;
t2m_count++;
}
continue;
}
tmper = elm->type->op->der_encoder(elm->type, *memb_ptr2,
elm->tag_mode, elm->tag,
0, 0);
if(tmper.encoded == -1)
return tmper;
computed_size += tmper.encoded;
/*
* Remember the outmost tag of this member.
*/
if(t2m_build) {
t2m_build[t2m_count].el_no = edx;
t2m_build[t2m_count].el_tag = asn_TYPE_outmost_tag(
elm->type, *memb_ptr2, elm->tag_mode, elm->tag);
t2m_count++;
} else {
/*
* No dynamic sorting is necessary.
*/
}
}
/*
* Finalize order of the components.
*/
if(t2m_build) {
/*
* Sort the underlying members according to their
* canonical tags order. DER encoding mandates it.
*/
qsort(t2m_build, t2m_count, sizeof(specs->tag2el[0]), _t2e_cmp);
t2m = t2m_build;
} else {
/*
* Tags are already sorted by the compiler.
*/
t2m = specs->tag2el;
t2m_count = specs->tag2el_count;
}
assert(t2m_count == td->elements_count);
/*
* Encode the TLV for the sequence itself.
*/
ret = der_write_tags(td, computed_size, tag_mode, 1, tag, cb, app_key);
if(ret == -1) {
FREEMEM(t2m_build);
ASN__ENCODE_FAILED;
}
er.encoded = computed_size + ret;
if(!cb) {
FREEMEM(t2m_build);
ASN__ENCODED_OK(er);
}
/*
* Encode all members.
*/
for(edx = 0; edx < td->elements_count; edx++) {
asn_TYPE_member_t *elm;
asn_enc_rval_t tmper;
const void *memb_ptr_dontuse; /* Pointer to the member */
const void *const *memb_ptr2; /* Pointer to that pointer */
/* Encode according to the tag order */
elm = &td->elements[t2m[edx].el_no];
if(elm->flags & ATF_POINTER) {
memb_ptr2 =
(const void *const *)((const char *)sptr + elm->memb_offset);
if(!*memb_ptr2) continue;
} else {
memb_ptr_dontuse =
(const void *)((const char *)sptr + elm->memb_offset);
memb_ptr2 = &memb_ptr_dontuse; /* Only use of memb_ptr_dontuse */
}
/* Eliminate default values */
if(elm->default_value_cmp && elm->default_value_cmp(*memb_ptr2) == 0)
continue;
tmper = elm->type->op->der_encoder(elm->type, *memb_ptr2,
elm->tag_mode, elm->tag, cb, app_key);
if(tmper.encoded == -1)
return tmper;
computed_size -= tmper.encoded;
}
if(computed_size != 0) {
/*
* Encoded size is not equal to the computed size.
*/
FREEMEM(t2m_build);
ASN__ENCODE_FAILED;
}
FREEMEM(t2m_build);
ASN__ENCODED_OK(er);
}
#undef XER_ADVANCE
#define XER_ADVANCE(num_bytes) do { \
size_t num = num_bytes; \
buf_ptr = ((const char *)buf_ptr) + num;\
size -= num; \
consumed_myself += num; \
} while(0)
/*
* Decode the XER (XML) data.
*/
asn_dec_rval_t
SET_decode_xer(const asn_codec_ctx_t *opt_codec_ctx,
const asn_TYPE_descriptor_t *td, void **struct_ptr,
const char *opt_mname, const void *buf_ptr, size_t size) {
/*
* Bring closer parts of structure description.
*/
const asn_SET_specifics_t *specs = (const asn_SET_specifics_t *)td->specifics;
const asn_TYPE_member_t *elements = td->elements;
const char *xml_tag = opt_mname ? opt_mname : td->xml_tag;
/*
* ... and parts of the structure being constructed.
*/
void *st = *struct_ptr; /* Target structure. */
asn_struct_ctx_t *ctx; /* Decoder context */
asn_dec_rval_t rval; /* Return value from a decoder */
ssize_t consumed_myself = 0; /* Consumed bytes from ptr */
size_t edx; /* Element index */
/*
* Create the target structure if it is not present already.
*/
if(st == 0) {
st = *struct_ptr = CALLOC(1, specs->struct_size);
if(st == 0) RETURN(RC_FAIL);
}
/*
* Restore parsing context.
*/
ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset);
/*
* Phases of XER/XML processing:
* Phase 0: Check that the opening tag matches our expectations.
* Phase 1: Processing body and reacting on closing tag.
* Phase 2: Processing inner type.
* Phase 3: Skipping unknown extensions.
* Phase 4: PHASED OUT
*/
for(edx = ctx->step; ctx->phase <= 3;) {
pxer_chunk_type_e ch_type; /* XER chunk type */
ssize_t ch_size; /* Chunk size */
xer_check_tag_e tcv; /* Tag check value */
const asn_TYPE_member_t *elm;
/*
* Go inside the inner member of a set.
*/
if(ctx->phase == 2) {
asn_dec_rval_t tmprval;
void *memb_ptr_dontuse; /* Pointer to the member */
void **memb_ptr2; /* Pointer to that pointer */
if(ASN_SET_ISPRESENT2((char *)st + specs->pres_offset,
edx)) {
ASN_DEBUG("SET %s: Duplicate element %s (%" ASN_PRI_SSIZE ")",
td->name, elements[edx].name, edx);
RETURN(RC_FAIL);
}
elm = &elements[edx];
if(elm->flags & ATF_POINTER) {
/* Member is a pointer to another structure */
memb_ptr2 = (void **)((char *)st + elm->memb_offset);
} else {
memb_ptr_dontuse = (char *)st + elm->memb_offset;
memb_ptr2 = &memb_ptr_dontuse; /* Only use of memb_ptr_dontuse */
}
/* Invoke the inner type decoder, m.b. multiple times */
tmprval = elm->type->op->xer_decoder(opt_codec_ctx,
elm->type, memb_ptr2, elm->name,
buf_ptr, size);
XER_ADVANCE(tmprval.consumed);
if(tmprval.code != RC_OK)
RETURN(tmprval.code);
ctx->phase = 1; /* Back to body processing */
ASN_SET_MKPRESENT((char *)st + specs->pres_offset, edx);
ASN_DEBUG("XER/SET phase => %d", ctx->phase);
/* Fall through */
}
/*
* Get the next part of the XML stream.
*/
ch_size = xer_next_token(&ctx->context,
buf_ptr, size, &ch_type);
if(ch_size == -1) {
RETURN(RC_FAIL);
} else {
switch(ch_type) {
case PXER_WMORE:
RETURN(RC_WMORE);
case PXER_COMMENT: /* Got XML comment */
case PXER_TEXT: /* Ignore free-standing text */
XER_ADVANCE(ch_size); /* Skip silently */
continue;
case PXER_TAG:
break; /* Check the rest down there */
}
}
tcv = xer_check_tag(buf_ptr, ch_size, xml_tag);
ASN_DEBUG("XER/SET: tcv = %d, ph=%d", tcv, ctx->phase);
/* Skip the extensions section */
if(ctx->phase == 3) {
switch(xer_skip_unknown(tcv, &ctx->left)) {
case -1:
ctx->phase = 4;
RETURN(RC_FAIL);
case 1:
ctx->phase = 1;
/* Fall through */
case 0:
XER_ADVANCE(ch_size);
continue;
case 2:
ctx->phase = 1;
break;
}
}
switch(tcv) {
case XCT_CLOSING:
if(ctx->phase == 0) break;
ctx->phase = 0;
/* Fall through */
case XCT_BOTH:
if(ctx->phase == 0) {
if(_SET_is_populated(td, st)) {
XER_ADVANCE(ch_size);
ctx->phase = 4; /* Phase out */
RETURN(RC_OK);
} else {
ASN_DEBUG("Premature end of XER SET");
RETURN(RC_FAIL);
}
}
/* Fall through */
case XCT_OPENING:
if(ctx->phase == 0) {
XER_ADVANCE(ch_size);
ctx->phase = 1; /* Processing body phase */
continue;
}
/* Fall through */
case XCT_UNKNOWN_OP:
case XCT_UNKNOWN_BO:
ASN_DEBUG("XER/SET: tcv=%d, ph=%d", tcv, ctx->phase);
if(ctx->phase != 1)
break; /* Really unexpected */
/*
* Search which member corresponds to this tag.
*/
for(edx = 0; edx < td->elements_count; edx++) {
switch(xer_check_tag(buf_ptr, ch_size,
elements[edx].name)) {
case XCT_BOTH:
case XCT_OPENING:
/*
* Process this member.
*/
ctx->step = edx;
ctx->phase = 2;
break;
case XCT_UNKNOWN_OP:
case XCT_UNKNOWN_BO:
continue;
default:
edx = td->elements_count;
break; /* Phase out */
}
break;
}
if(edx != td->elements_count)
continue;
/* It is expected extension */
if(specs->extensible) {
ASN_DEBUG("Got anticipated extension");
/*
* Check for (XCT_BOTH or XCT_UNKNOWN_BO)
* By using a mask. Only record a pure
* <opening> tags.
*/
if(tcv & XCT_CLOSING) {
/* Found </extension> without body */
} else {
ctx->left = 1;
ctx->phase = 3; /* Skip ...'s */
}
XER_ADVANCE(ch_size);
continue;
}
/* Fall through */
default:
break;
}
ASN_DEBUG("Unexpected XML tag in SET, expected \"%s\"",
xml_tag);
break;
}
ctx->phase = 4; /* "Phase out" on hard failure */
RETURN(RC_FAIL);
}
asn_enc_rval_t
SET_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb,
void *app_key) {
const asn_SET_specifics_t *specs = (const asn_SET_specifics_t *)td->specifics;
asn_enc_rval_t er;
int xcan = (flags & XER_F_CANONICAL);
const asn_TYPE_tag2member_t *t2m = specs->tag2el_cxer;
size_t t2m_count = specs->tag2el_cxer_count;
size_t edx;
if(!sptr)
ASN__ENCODE_FAILED;
assert(t2m_count == td->elements_count);
er.encoded = 0;
for(edx = 0; edx < t2m_count; edx++) {
asn_enc_rval_t tmper;
asn_TYPE_member_t *elm;
const void *memb_ptr;
const char *mname;
size_t mlen;
elm = &td->elements[t2m[edx].el_no];
mname = elm->name;
mlen = strlen(elm->name);
if(elm->flags & ATF_POINTER) {
memb_ptr =
*(const void *const *)((const char *)sptr + elm->memb_offset);
if(!memb_ptr) {
if(elm->optional)
continue;
/* Mandatory element missing */
ASN__ENCODE_FAILED;
}
} else {
memb_ptr = (const void *)((const char *)sptr + elm->memb_offset);
}
if(!xcan)
ASN__TEXT_INDENT(1, ilevel);
ASN__CALLBACK3("<", 1, mname, mlen, ">", 1);
/* Print the member itself */
tmper = elm->type->op->xer_encoder(elm->type, memb_ptr,
ilevel + 1, flags, cb, app_key);
if(tmper.encoded == -1) return tmper;
er.encoded += tmper.encoded;
ASN__CALLBACK3("</", 2, mname, mlen, ">", 1);
}
if(!xcan) ASN__TEXT_INDENT(1, ilevel - 1);
ASN__ENCODED_OK(er);
cb_failed:
ASN__ENCODE_FAILED;
}
int
SET_print(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
asn_app_consume_bytes_f *cb, void *app_key) {
size_t edx;
int ret;
if(!sptr) return (cb("<absent>", 8, app_key) < 0) ? -1 : 0;
/* Dump preamble */
if(cb(td->name, strlen(td->name), app_key) < 0
|| cb(" ::= {", 6, app_key) < 0)
return -1;
for(edx = 0; edx < td->elements_count; edx++) {
asn_TYPE_member_t *elm = &td->elements[edx];
const void *memb_ptr;
if(elm->flags & ATF_POINTER) {
memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset);
if(!memb_ptr) {
if(elm->optional) continue;
/* Print <absent> line */
/* Fall through */
}
} else {
memb_ptr = (const void *)((const char *)sptr + elm->memb_offset);
}
_i_INDENT(1);
/* Print the member's name and stuff */
if(cb(elm->name, strlen(elm->name), app_key) < 0
|| cb(": ", 2, app_key) < 0)
return -1;
/* Print the member itself */
ret = elm->type->op->print_struct(elm->type, memb_ptr, ilevel + 1,
cb, app_key);
if(ret) return ret;
}
ilevel--;
_i_INDENT(1);
return (cb("}", 1, app_key) < 0) ? -1 : 0;
}
void
SET_free(const asn_TYPE_descriptor_t *td, void *ptr,
enum asn_struct_free_method method) {
size_t edx;
if(!td || !ptr)
return;
ASN_DEBUG("Freeing %s as SET", td->name);
for(edx = 0; edx < td->elements_count; edx++) {
asn_TYPE_member_t *elm = &td->elements[edx];
void *memb_ptr;
if(elm->flags & ATF_POINTER) {
memb_ptr = *(void **)((char *)ptr + elm->memb_offset);
if(memb_ptr)
ASN_STRUCT_FREE(*elm->type, memb_ptr);
} else {
memb_ptr = (void *)((char *)ptr + elm->memb_offset);
ASN_STRUCT_FREE_CONTENTS_ONLY(*elm->type, memb_ptr);
}
}
switch(method) {
case ASFM_FREE_EVERYTHING:
FREEMEM(ptr);
break;
case ASFM_FREE_UNDERLYING:
break;
case ASFM_FREE_UNDERLYING_AND_RESET:
memset(ptr, 0,
((const asn_SET_specifics_t *)(td->specifics))->struct_size);
break;
}
}
int
SET_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
size_t edx;
if(!sptr) {
ASN__CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
/*
* Iterate over structure members and check their validity.
*/
for(edx = 0; edx < td->elements_count; edx++) {
asn_TYPE_member_t *elm = &td->elements[edx];
const void *memb_ptr;
if(elm->flags & ATF_POINTER) {
memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset);
if(!memb_ptr) {
if(elm->optional)
continue;
ASN__CTFAIL(app_key, td, sptr,
"%s: mandatory element %s absent (%s:%d)",
td->name, elm->name, __FILE__, __LINE__);
return -1;
}
} else {
memb_ptr = (const void *)((const char *)sptr + elm->memb_offset);
}
if(elm->encoding_constraints.general_constraints) {
return elm->encoding_constraints.general_constraints(
elm->type, memb_ptr, ctfailcb, app_key);
} else {
return elm->type->encoding_constraints.general_constraints(
elm->type, memb_ptr, ctfailcb, app_key);
}
}
return 0;
}
int
SET_compare(const asn_TYPE_descriptor_t *td, const void *aptr,
const void *bptr) {
size_t edx;
for(edx = 0; edx < td->elements_count; edx++) {
asn_TYPE_member_t *elm = &td->elements[edx];
const void *amemb;
const void *bmemb;
int ret;
if(elm->flags & ATF_POINTER) {
amemb =
*(const void *const *)((const char *)aptr + elm->memb_offset);
bmemb =
*(const void *const *)((const char *)bptr + elm->memb_offset);
if(!amemb) {
if(!bmemb) continue;
return -1;
} else if(!bmemb) {
return 1;
}
} else {
amemb = (const void *)((const char *)aptr + elm->memb_offset);
bmemb = (const void *)((const char *)bptr + elm->memb_offset);
}
ret = elm->type->op->compare_struct(elm->type, amemb, bmemb);
if(ret != 0) return ret;
}
return 0;
}
asn_TYPE_operation_t asn_OP_SET = {
SET_free,
SET_print,
SET_compare,
SET_decode_ber,
SET_encode_der,
SET_decode_xer,
SET_encode_xer,
0, /* SET_decode_oer */
0, /* SET_encode_oer */
0, /* SET_decode_uper */
0, /* SET_encode_uper */
SET_random_fill,
0 /* Use generic outmost tag fetcher */
};
asn_random_fill_result_t
SET_random_fill(const asn_TYPE_descriptor_t *td, void **sptr,
const asn_encoding_constraints_t *constr,
size_t max_length) {
const asn_SET_specifics_t *specs =
(const asn_SET_specifics_t *)td->specifics;
asn_random_fill_result_t result_ok = {ARFILL_OK, 0};
asn_random_fill_result_t result_failed = {ARFILL_FAILED, 0};
asn_random_fill_result_t result_skipped = {ARFILL_SKIPPED, 0};
void *st = *sptr;
size_t edx;
if(max_length == 0) return result_skipped;
(void)constr;
if(st == NULL) {
st = CALLOC(1, specs->struct_size);
if(st == NULL) {
return result_failed;
}
}
for(edx = 0; edx < td->elements_count; edx++) {
const asn_TYPE_member_t *elm = &td->elements[edx];
void *memb_ptr; /* Pointer to the member */
void **memb_ptr2; /* Pointer to that pointer */
asn_random_fill_result_t tmpres;
if(elm->optional && asn_random_between(0, 4) == 2) {
/* Sometimes decide not to fill the optional value */
continue;
}
if(elm->flags & ATF_POINTER) {
/* Member is a pointer to another structure */
memb_ptr2 = (void **)((char *)st + elm->memb_offset);
} else {
memb_ptr = (char *)st + elm->memb_offset;
memb_ptr2 = &memb_ptr;
}
tmpres = elm->type->op->random_fill(
elm->type, memb_ptr2, &elm->encoding_constraints,
max_length > result_ok.length ? max_length - result_ok.length : 0);
switch(tmpres.code) {
case ARFILL_OK:
result_ok.length += tmpres.length;
continue;
case ARFILL_SKIPPED:
assert(!(elm->flags & ATF_POINTER) || *memb_ptr2 == NULL);
continue;
case ARFILL_FAILED:
if(st == *sptr) {
ASN_STRUCT_RESET(*td, st);
} else {
ASN_STRUCT_FREE(*td, st);
}
return tmpres;
}
}
*sptr = st;
return result_ok;
}
|
khmseu/asn1c
|
skeletons/constr_SET.c
|
C
|
bsd-2-clause
| 29,387
|
#ifndef SRC_COMMON_H_
#define SRC_COMMON_H_
#include <stdio.h>
#include <string.h>
#include "nan.h"
#define WARN(msg) fprintf(stdout, "\033[01;33m native:%s \033[00m\n", msg)
#define ERROR(msg) fprintf(stdout, "\033[01;32m native:%s \033[00m\n", msg)
#define INFO(msg) fprintf(stdout, "\033[01;34m native:%s \033[00m\n", msg)
#if defined(TRACING)
#define TRACE(msg) printf(" TRACE: %s\n", msg)
#define TRACE_S(msg, s) printf(" TRACE: %s : %s\n", msg, s)
#define TRACE_I(msg, i) printf(" TRACE: %s : %d\n", msg, i)
#define TRACE_U(msg, u) printf(" TRACE: %s : %u\n", msg, u)
#define TRACE_X(msg, x) printf(" TRACE: %s : 0x%x\n", msg, x)
#define TRACE_PTR(msg, p) printf(" TRACE: %s : %p\n", msg, p)
#define TRACE_CALL printf("-> TRACE: Call::%s\n", __PRETTY_FUNCTION__)
#define TRACE_CALL_I(p1) printf("-> TRACE: Call::%s(%d)\n", __PRETTY_FUNCTION__, p1)
#define TRACE_CALL_P(p1) printf("-> TRACE: Call::%s(%lx)\n", __PRETTY_FUNCTION__, p1)
#define TRACE_END printf("<- Call::%s\n", __PRETTY_FUNCTION__)
#else
#define TRACE(msg)
#define TRACE_S(msg, s)
#define TRACE_I(msg, i)
#define TRACE_U(msg, u)
#define TRACE_X(msg, x)
#define TRACE_PTR(msg, x)
#define TRACE_CALL
#define TRACE_CALL_I(p1)
#define TRACE_CALL_P(p1)
#define TRACE_END
#endif
#define THROW_TYPE_ERROR(MSG) \
return Nan::ThrowTypeError(MSG);
#define CHECK_ARG(I, CHECK, DO_TRUE, DO_FALSE) \
if (info.Length() <= (I) || !info[I]->CHECK) { DO_FALSE; } else { DO_TRUE; }
#define REQUIRE_ARG(I, CHECK) \
CHECK_ARG(I, CHECK, , THROW_TYPE_ERROR("Argument " #I " must be an object"))
#define REQ_OBJ_ARG(I, VAR) \
REQUIRE_ARG(I, IsObject()) \
Local<Object> VAR = Local<Object>::Cast(info[I])
#define OPT_INT_ARG(I, VAR, DEFAULT) \
int VAR; \
CHECK_ARG(I, IsNumber(), VAR = info[I]->Int32Value(), VAR = DEFAULT)
#define REQ_INT_ARG(I, VAR) \
REQUIRE_ARG(I, IsNumber()) \
int VAR = info[I]->Int32Value();
#define REQ_FUN_ARG(I, VAR) \
if (info.Length() <= (I) || !info[I]->IsFunction()) \
return Nan::ThrowTypeError("Argument " #I " must be a function"); \
Local<Function> VAR = Local<Function>::Cast(info[I]);
#define CREATE_BUFFER(name, data, length) \
Local<Object> name ## _buf = Nan::NewBuffer(length).ToLocalChecked(); \
memcpy(Buffer::Data(name ## _buf), data, length); \
Local<Object> name; \
Handle<Value> ctorArgs[3] = { name ## _buf, Nan::New<Integer>(length), Nan::New<Integer>(0) }; \
name = Local<Function>::Cast(\
Nan::GetCurrentContext() \
->Global() \
->Get(Nan::New("Buffer").ToLocalChecked()) \
)->NewInstance(3, ctorArgs);
#endif // SRC_COMMON_H_
|
ssaroha/node-webrtc
|
src/common.h
|
C
|
bsd-2-clause
| 2,679
|
#include "catch.hpp"
#include <osmium/geom/ogr.hpp>
#include "area_helper.hpp"
#include "wnl_helper.hpp"
TEST_CASE("OGR point geometry") {
osmium::geom::OGRFactory<> factory;
SECTION("point") {
std::unique_ptr<OGRPoint> point{factory.create_point(osmium::Location{3.2, 4.2})};
REQUIRE(3.2 == point->getX());
REQUIRE(4.2 == point->getY());
}
SECTION("empty_point") {
REQUIRE_THROWS_AS(factory.create_point(osmium::Location()), osmium::invalid_location);
}
}
TEST_CASE("OGR linestring geometry") {
osmium::geom::OGRFactory<> factory;
osmium::memory::Buffer buffer{10000};
const auto& wnl = create_test_wnl_okay(buffer);
SECTION("linestring, default") {
std::unique_ptr<OGRLineString> linestring{factory.create_linestring(wnl)};
REQUIRE(3 == linestring->getNumPoints());
REQUIRE(3.2 == linestring->getX(0));
REQUIRE(3.6 == linestring->getX(2));
}
SECTION("linestring, unique nodes, backwards") {
std::unique_ptr<OGRLineString> linestring{factory.create_linestring(wnl, osmium::geom::use_nodes::unique, osmium::geom::direction::backward)};
REQUIRE(3 == linestring->getNumPoints());
REQUIRE(3.6 == linestring->getX(0));
REQUIRE(3.2 == linestring->getX(2));
}
SECTION("linestring, all nodes") {
std::unique_ptr<OGRLineString> linestring{factory.create_linestring(wnl, osmium::geom::use_nodes::all)};
REQUIRE(4 == linestring->getNumPoints());
REQUIRE(3.2 == linestring->getX(0));
}
SECTION("linestring, all nodes, backwards") {
std::unique_ptr<OGRLineString> linestring{factory.create_linestring(wnl, osmium::geom::use_nodes::all, osmium::geom::direction::backward)};
REQUIRE(4 == linestring->getNumPoints());
REQUIRE(3.6 == linestring->getX(0));
}
}
TEST_CASE("OGR area geometry") {
osmium::geom::OGRFactory<> factory;
osmium::memory::Buffer buffer{10000};
SECTION("area_1outer_0inner") {
const osmium::Area& area = create_test_area_1outer_0inner(buffer);
std::unique_ptr<OGRMultiPolygon> mp {factory.create_multipolygon(area)};
REQUIRE(1 == mp->getNumGeometries());
const OGRPolygon* p0 = dynamic_cast<const OGRPolygon*>(mp->getGeometryRef(0));
REQUIRE(p0);
REQUIRE(0 == p0->getNumInteriorRings());
const OGRLineString* l0e = p0->getExteriorRing();
REQUIRE(4 == l0e->getNumPoints());
REQUIRE(3.5 == l0e->getX(1));
}
SECTION("area_1outer_1inner") {
const osmium::Area& area = create_test_area_1outer_1inner(buffer);
std::unique_ptr<OGRMultiPolygon> mp {factory.create_multipolygon(area)};
REQUIRE(1 == mp->getNumGeometries());
const OGRPolygon* p0 = dynamic_cast<const OGRPolygon*>(mp->getGeometryRef(0));
REQUIRE(p0);
REQUIRE(1 == p0->getNumInteriorRings());
const OGRLineString* l0e = p0->getExteriorRing();
REQUIRE(5 == l0e->getNumPoints());
const OGRLineString* l0i0 = p0->getInteriorRing(0);
REQUIRE(5 == l0i0->getNumPoints());
}
SECTION("area_2outer_2inner") {
const osmium::Area& area = create_test_area_2outer_2inner(buffer);
std::unique_ptr<OGRMultiPolygon> mp {factory.create_multipolygon(area)};
REQUIRE(2 == mp->getNumGeometries());
const OGRPolygon* p0 = dynamic_cast<const OGRPolygon*>(mp->getGeometryRef(0));
REQUIRE(p0);
REQUIRE(2 == p0->getNumInteriorRings());
const OGRLineString* l0e = p0->getExteriorRing();
REQUIRE(5 == l0e->getNumPoints());
const OGRPolygon* p1 = dynamic_cast<const OGRPolygon*>(mp->getGeometryRef(1));
REQUIRE(p1);
REQUIRE(0 == p1->getNumInteriorRings());
const OGRLineString* l1e = p1->getExteriorRing();
REQUIRE(5 == l1e->getNumPoints());
}
}
|
duizendnegen/osrm-backend
|
third_party/libosmium/test/t/geom/test_ogr.cpp
|
C++
|
bsd-2-clause
| 3,910
|
/*
* Copyright (C) Igor Sysoev
* Copyright (C) Nginx, Inc.
*/
#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_event.h>
#include <ngx_channel.h>
typedef struct {
int signo;
char *signame;
char *name;
void (*handler)(int signo, siginfo_t *siginfo, void *ucontext);
} ngx_signal_t;
static void ngx_execute_proc(ngx_cycle_t *cycle, void *data);
static void ngx_signal_handler(int signo, siginfo_t *siginfo, void *ucontext);
static void ngx_process_get_status(void);
static void ngx_unlock_mutexes(ngx_pid_t pid);
int ngx_argc;
char **ngx_argv;
char **ngx_os_argv;
ngx_int_t ngx_process_slot;
ngx_socket_t ngx_channel;
ngx_int_t ngx_last_process;
ngx_process_t ngx_processes[NGX_MAX_PROCESSES];
ngx_signal_t signals[] = {
{ ngx_signal_value(NGX_RECONFIGURE_SIGNAL),
"SIG" ngx_value(NGX_RECONFIGURE_SIGNAL),
"reload",
ngx_signal_handler },
{ ngx_signal_value(NGX_REOPEN_SIGNAL),
"SIG" ngx_value(NGX_REOPEN_SIGNAL),
"reopen",
ngx_signal_handler },
{ ngx_signal_value(NGX_NOACCEPT_SIGNAL),
"SIG" ngx_value(NGX_NOACCEPT_SIGNAL),
"",
ngx_signal_handler },
{ ngx_signal_value(NGX_TERMINATE_SIGNAL),
"SIG" ngx_value(NGX_TERMINATE_SIGNAL),
"stop",
ngx_signal_handler },
{ ngx_signal_value(NGX_SHUTDOWN_SIGNAL),
"SIG" ngx_value(NGX_SHUTDOWN_SIGNAL),
"quit",
ngx_signal_handler },
{ ngx_signal_value(NGX_CHANGEBIN_SIGNAL),
"SIG" ngx_value(NGX_CHANGEBIN_SIGNAL),
"",
ngx_signal_handler },
{ SIGALRM, "SIGALRM", "", ngx_signal_handler },
{ SIGINT, "SIGINT", "", ngx_signal_handler },
{ SIGIO, "SIGIO", "", ngx_signal_handler },
{ SIGCHLD, "SIGCHLD", "", ngx_signal_handler },
{ SIGSYS, "SIGSYS, SIG_IGN", "", NULL },
{ SIGPIPE, "SIGPIPE, SIG_IGN", "", NULL },
{ 0, NULL, "", NULL }
};
ngx_pid_t
ngx_spawn_process(ngx_cycle_t *cycle, ngx_spawn_proc_pt proc, void *data,
char *name, ngx_int_t respawn)
{
u_long on;
ngx_pid_t pid;
ngx_int_t s;
if (respawn >= 0) {
s = respawn;
} else {
for (s = 0; s < ngx_last_process; s++) {
if (ngx_processes[s].pid == -1) {
break;
}
}
if (s == NGX_MAX_PROCESSES) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
"no more than %d processes can be spawned",
NGX_MAX_PROCESSES);
return NGX_INVALID_PID;
}
}
if (respawn != NGX_PROCESS_DETACHED) {
/* Solaris 9 still has no AF_LOCAL */
if (socketpair(AF_UNIX, SOCK_STREAM, 0, ngx_processes[s].channel) == -1)
{
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
"socketpair() failed while spawning \"%s\"", name);
return NGX_INVALID_PID;
}
ngx_log_debug2(NGX_LOG_DEBUG_CORE, cycle->log, 0,
"channel %d:%d",
ngx_processes[s].channel[0],
ngx_processes[s].channel[1]);
if (ngx_nonblocking(ngx_processes[s].channel[0]) == -1) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
ngx_nonblocking_n " failed while spawning \"%s\"",
name);
ngx_close_channel(ngx_processes[s].channel, cycle->log);
return NGX_INVALID_PID;
}
if (ngx_nonblocking(ngx_processes[s].channel[1]) == -1) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
ngx_nonblocking_n " failed while spawning \"%s\"",
name);
ngx_close_channel(ngx_processes[s].channel, cycle->log);
return NGX_INVALID_PID;
}
on = 1;
if (ioctl(ngx_processes[s].channel[0], FIOASYNC, &on) == -1) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
"ioctl(FIOASYNC) failed while spawning \"%s\"", name);
ngx_close_channel(ngx_processes[s].channel, cycle->log);
return NGX_INVALID_PID;
}
if (fcntl(ngx_processes[s].channel[0], F_SETOWN, ngx_pid) == -1) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
"fcntl(F_SETOWN) failed while spawning \"%s\"", name);
ngx_close_channel(ngx_processes[s].channel, cycle->log);
return NGX_INVALID_PID;
}
if (fcntl(ngx_processes[s].channel[0], F_SETFD, FD_CLOEXEC) == -1) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
"fcntl(FD_CLOEXEC) failed while spawning \"%s\"",
name);
ngx_close_channel(ngx_processes[s].channel, cycle->log);
return NGX_INVALID_PID;
}
if (fcntl(ngx_processes[s].channel[1], F_SETFD, FD_CLOEXEC) == -1) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
"fcntl(FD_CLOEXEC) failed while spawning \"%s\"",
name);
ngx_close_channel(ngx_processes[s].channel, cycle->log);
return NGX_INVALID_PID;
}
ngx_channel = ngx_processes[s].channel[1];
} else {
ngx_processes[s].channel[0] = -1;
ngx_processes[s].channel[1] = -1;
}
ngx_process_slot = s;
pid = fork();
switch (pid) {
case -1:
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
"fork() failed while spawning \"%s\"", name);
ngx_close_channel(ngx_processes[s].channel, cycle->log);
return NGX_INVALID_PID;
case 0:
ngx_pid = ngx_getpid();
proc(cycle, data);
break;
default:
break;
}
ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "start %s %P", name, pid);
ngx_processes[s].pid = pid;
ngx_processes[s].exited = 0;
if (respawn >= 0) {
return pid;
}
ngx_processes[s].proc = proc;
ngx_processes[s].data = data;
ngx_processes[s].name = name;
ngx_processes[s].exiting = 0;
switch (respawn) {
case NGX_PROCESS_NORESPAWN:
ngx_processes[s].respawn = 0;
ngx_processes[s].just_spawn = 0;
ngx_processes[s].detached = 0;
break;
case NGX_PROCESS_JUST_SPAWN:
ngx_processes[s].respawn = 0;
ngx_processes[s].just_spawn = 1;
ngx_processes[s].detached = 0;
break;
case NGX_PROCESS_RESPAWN:
ngx_processes[s].respawn = 1;
ngx_processes[s].just_spawn = 0;
ngx_processes[s].detached = 0;
break;
case NGX_PROCESS_JUST_RESPAWN:
ngx_processes[s].respawn = 1;
ngx_processes[s].just_spawn = 1;
ngx_processes[s].detached = 0;
break;
case NGX_PROCESS_DETACHED:
ngx_processes[s].respawn = 0;
ngx_processes[s].just_spawn = 0;
ngx_processes[s].detached = 1;
break;
}
if (s == ngx_last_process) {
ngx_last_process++;
}
return pid;
}
ngx_pid_t
ngx_execute(ngx_cycle_t *cycle, ngx_exec_ctx_t *ctx)
{
return ngx_spawn_process(cycle, ngx_execute_proc, ctx, ctx->name,
NGX_PROCESS_DETACHED);
}
static void
ngx_execute_proc(ngx_cycle_t *cycle, void *data)
{
ngx_exec_ctx_t *ctx = data;
if (execve(ctx->path, ctx->argv, ctx->envp) == -1) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
"execve() failed while executing %s \"%s\"",
ctx->name, ctx->path);
}
exit(1);
}
ngx_int_t
ngx_init_signals(ngx_log_t *log)
{
ngx_signal_t *sig;
struct sigaction sa;
for (sig = signals; sig->signo != 0; sig++) {
ngx_memzero(&sa, sizeof(struct sigaction));
if (sig->handler) {
sa.sa_sigaction = sig->handler;
sa.sa_flags = SA_SIGINFO;
} else {
sa.sa_handler = SIG_IGN;
}
sigemptyset(&sa.sa_mask);
if (sigaction(sig->signo, &sa, NULL) == -1) {
#if (NGX_VALGRIND)
ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
"sigaction(%s) failed, ignored", sig->signame);
#else
ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
"sigaction(%s) failed", sig->signame);
return NGX_ERROR;
#endif
}
}
return NGX_OK;
}
static void
ngx_signal_handler(int signo, siginfo_t *siginfo, void *ucontext)
{
char *action;
ngx_int_t ignore;
ngx_err_t err;
ngx_signal_t *sig;
ignore = 0;
err = ngx_errno;
for (sig = signals; sig->signo != 0; sig++) {
if (sig->signo == signo) {
break;
}
}
ngx_time_sigsafe_update();
action = "";
switch (ngx_process) {
case NGX_PROCESS_MASTER:
case NGX_PROCESS_SINGLE:
switch (signo) {
case ngx_signal_value(NGX_SHUTDOWN_SIGNAL):
ngx_quit = 1;
action = ", shutting down";
break;
case ngx_signal_value(NGX_TERMINATE_SIGNAL):
case SIGINT:
ngx_terminate = 1;
action = ", exiting";
break;
case ngx_signal_value(NGX_NOACCEPT_SIGNAL):
if (ngx_daemonized) {
ngx_noaccept = 1;
action = ", stop accepting connections";
}
break;
case ngx_signal_value(NGX_RECONFIGURE_SIGNAL):
ngx_reconfigure = 1;
action = ", reconfiguring";
break;
case ngx_signal_value(NGX_REOPEN_SIGNAL):
ngx_reopen = 1;
action = ", reopening logs";
break;
case ngx_signal_value(NGX_CHANGEBIN_SIGNAL):
if (getppid() > 1 || ngx_new_binary > 0) {
/*
* Ignore the signal in the new binary if its parent is
* not the init process, i.e. the old binary's process
* is still running. Or ignore the signal in the old binary's
* process if the new binary's process is already running.
*/
action = ", ignoring";
ignore = 1;
break;
}
ngx_change_binary = 1;
action = ", changing binary";
break;
case SIGALRM:
ngx_sigalrm = 1;
break;
case SIGIO:
ngx_sigio = 1;
break;
case SIGCHLD:
ngx_reap = 1;
break;
}
break;
case NGX_PROCESS_WORKER:
case NGX_PROCESS_HELPER:
switch (signo) {
case ngx_signal_value(NGX_NOACCEPT_SIGNAL):
if (!ngx_daemonized) {
break;
}
ngx_debug_quit = 1;
/* fall through */
case ngx_signal_value(NGX_SHUTDOWN_SIGNAL):
ngx_quit = 1;
action = ", shutting down";
break;
case ngx_signal_value(NGX_TERMINATE_SIGNAL):
case SIGINT:
ngx_terminate = 1;
action = ", exiting";
break;
case ngx_signal_value(NGX_REOPEN_SIGNAL):
ngx_reopen = 1;
action = ", reopening logs";
break;
case ngx_signal_value(NGX_RECONFIGURE_SIGNAL):
case ngx_signal_value(NGX_CHANGEBIN_SIGNAL):
case SIGIO:
action = ", ignoring";
break;
}
break;
}
if (siginfo && siginfo->si_pid) {
ngx_log_error(NGX_LOG_NOTICE, ngx_cycle->log, 0,
"signal %d (%s) received from %P%s",
signo, sig->signame, siginfo->si_pid, action);
} else {
ngx_log_error(NGX_LOG_NOTICE, ngx_cycle->log, 0,
"signal %d (%s) received%s",
signo, sig->signame, action);
}
if (ignore) {
ngx_log_error(NGX_LOG_CRIT, ngx_cycle->log, 0,
"the changing binary signal is ignored: "
"you should shutdown or terminate "
"before either old or new binary's process");
}
if (signo == SIGCHLD) {
ngx_process_get_status();
}
ngx_set_errno(err);
}
static void
ngx_process_get_status(void)
{
int status;
char *process;
ngx_pid_t pid;
ngx_err_t err;
ngx_int_t i;
ngx_uint_t one;
one = 0;
for ( ;; ) {
pid = waitpid(-1, &status, WNOHANG);
if (pid == 0) {
return;
}
if (pid == -1) {
err = ngx_errno;
if (err == NGX_EINTR) {
continue;
}
if (err == NGX_ECHILD && one) {
return;
}
/*
* Solaris always calls the signal handler for each exited process
* despite waitpid() may be already called for this process.
*
* When several processes exit at the same time FreeBSD may
* erroneously call the signal handler for exited process
* despite waitpid() may be already called for this process.
*/
if (err == NGX_ECHILD) {
ngx_log_error(NGX_LOG_INFO, ngx_cycle->log, err,
"waitpid() failed");
return;
}
ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, err,
"waitpid() failed");
return;
}
one = 1;
process = "unknown process";
for (i = 0; i < ngx_last_process; i++) {
if (ngx_processes[i].pid == pid) {
ngx_processes[i].status = status;
ngx_processes[i].exited = 1;
process = ngx_processes[i].name;
break;
}
}
if (WTERMSIG(status)) {
#ifdef WCOREDUMP
ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, 0,
"%s %P exited on signal %d%s",
process, pid, WTERMSIG(status),
WCOREDUMP(status) ? " (core dumped)" : "");
#else
ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, 0,
"%s %P exited on signal %d",
process, pid, WTERMSIG(status));
#endif
} else {
ngx_log_error(NGX_LOG_NOTICE, ngx_cycle->log, 0,
"%s %P exited with code %d",
process, pid, WEXITSTATUS(status));
}
if (WEXITSTATUS(status) == 2 && ngx_processes[i].respawn) {
ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, 0,
"%s %P exited with fatal code %d "
"and cannot be respawned",
process, pid, WEXITSTATUS(status));
ngx_processes[i].respawn = 0;
}
ngx_unlock_mutexes(pid);
}
}
static void
ngx_unlock_mutexes(ngx_pid_t pid)
{
ngx_uint_t i;
ngx_shm_zone_t *shm_zone;
ngx_list_part_t *part;
ngx_slab_pool_t *sp;
/*
* unlock the accept mutex if the abnormally exited process
* held it
*/
if (ngx_accept_mutex_ptr) {
(void) ngx_shmtx_force_unlock(&ngx_accept_mutex, pid);
}
/*
* unlock shared memory mutexes if held by the abnormally exited
* process
*/
part = (ngx_list_part_t *) &ngx_cycle->shared_memory.part;
shm_zone = part->elts;
for (i = 0; /* void */ ; i++) {
if (i >= part->nelts) {
if (part->next == NULL) {
break;
}
part = part->next;
shm_zone = part->elts;
i = 0;
}
sp = (ngx_slab_pool_t *) shm_zone[i].shm.addr;
if (ngx_shmtx_force_unlock(&sp->mutex, pid)) {
ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, 0,
"shared memory zone \"%V\" was locked by %P",
&shm_zone[i].shm.name, pid);
}
}
}
void
ngx_debug_point(void)
{
ngx_core_conf_t *ccf;
ccf = (ngx_core_conf_t *) ngx_get_conf(ngx_cycle->conf_ctx,
ngx_core_module);
switch (ccf->debug_points) {
case NGX_DEBUG_POINTS_STOP:
raise(SIGSTOP);
break;
case NGX_DEBUG_POINTS_ABORT:
ngx_abort();
}
}
ngx_int_t
ngx_os_signal_process(ngx_cycle_t *cycle, char *name, ngx_pid_t pid)
{
ngx_signal_t *sig;
for (sig = signals; sig->signo != 0; sig++) {
if (ngx_strcmp(name, sig->name) == 0) {
if (kill(pid, sig->signo) != -1) {
return 0;
}
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
"kill(%P, %d) failed", pid, sig->signo);
}
}
return 1;
}
|
LomoX-Offical/nginx-openresty-windows
|
src/nginx/src/os/unix/ngx_process.c
|
C
|
bsd-2-clause
| 17,054
|
=pod
=head1 NAME
SSL_set_session - set a TLS/SSL session to be used during TLS/SSL connect
=head1 SYNOPSIS
#include <openssl/ssl.h>
int SSL_set_session(SSL *ssl, SSL_SESSION *session);
=head1 DESCRIPTION
SSL_set_session() sets B<session> to be used when the TLS/SSL connection
is to be established. SSL_set_session() is only useful for TLS/SSL clients.
When the session is set, the reference count of B<session> is incremented
by 1. If the session is not reused, the reference count is decremented
again during SSL_connect(). Whether the session was reused can be queried
with the L<SSL_session_reused(3)|SSL_session_reused(3)> call.
If there is already a session set inside B<ssl> (because it was set with
SSL_set_session() before or because the same B<ssl> was already used for
a connection), SSL_SESSION_free() will be called for that session.
=head1 NOTES
SSL_SESSION objects keep internal link information about the session cache
list, when being inserted into one SSL_CTX object's session cache.
One SSL_SESSION object, regardless of its reference count, must therefore
only be used with one SSL_CTX object (and the SSL objects created
from this SSL_CTX object).
=head1 RETURN VALUES
The following return values can occur:
=over 4
=item 0
The operation failed; check the error stack to find out the reason.
=item 1
The operation succeeded.
=back
=head1 SEE ALSO
L<ssl(3)|ssl(3)>, L<SSL_SESSION_free(3)|SSL_SESSION_free(3)>,
L<SSL_get_session(3)|SSL_get_session(3)>,
L<SSL_session_reused(3)|SSL_session_reused(3)>,
L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>
=cut
|
caidongyun/nginx-openresty-windows
|
nginx/objs/lib/openssl-1.0.1g/doc/ssl/SSL_set_session.pod
|
Perl
|
bsd-2-clause
| 1,676
|
cask 'duet' do
version '2.0.5.1'
sha256 '9f60e95aacc75510d3a3652210804cf5c09a6a155d895cdba5d58063967e7081'
# duet.nyc3.cdn.digitaloceanspaces.com/Mac was verified as official when first introduced to the cask
url "https://duet.nyc3.cdn.digitaloceanspaces.com/Mac/#{version.major_minor.dots_to_underscores}/duet-#{version.dots_to_hyphens}.zip"
appcast 'https://www.duetdisplay.com/mac/'
name 'Duet'
homepage 'https://www.duetdisplay.com/'
auto_updates true
app 'duet.app'
uninstall kext: 'com.karios.driver.DuetDisplay'
end
|
toonetown/homebrew-cask
|
Casks/duet.rb
|
Ruby
|
bsd-2-clause
| 547
|
class Entr < Formula
desc "Run arbitrary commands when files change"
homepage "http://entrproject.org/"
url "http://entrproject.org/code/entr-3.9.tar.gz"
mirror "https://bitbucket.org/eradman/entr/get/entr-3.9.tar.gz"
sha256 "a49daac8c46290f9886ac4ef3143da5b042a696c3969f6b40383e591c137d1ce"
bottle do
cellar :any_skip_relocation
sha256 "cc8b3e8f1c1e259bf9aee8c1b64c16303af6ac05f39cfb740b1e7fc184f3d7a6" => :high_sierra
sha256 "182ed754e56fd1ff6c75adead81b2d61d3346070dd314393b95a2450ca3cf787" => :sierra
sha256 "0bbc08a677fe8a56be9487f359118802aea13c150e86826bbbccd0b52b58c9c4" => :el_capitan
end
head do
url "https://bitbucket.org/eradman/entr", :using => :hg
depends_on :hg => :build
end
def install
ENV["PREFIX"] = prefix
ENV["MANPREFIX"] = man
system "./configure"
system "make"
system "make", "install"
end
test do
touch testpath/"test.1"
fork do
sleep 0.5
touch testpath/"test.2"
end
assert_equal "New File", pipe_output("#{bin}/entr -p -d echo 'New File'", testpath).strip
end
end
|
robohack/homebrew-core
|
Formula/entr.rb
|
Ruby
|
bsd-2-clause
| 1,091
|
#pragma once
//========================================================================
// BoxEntity.h
//
// This code is part of Minotower Games Engine 1.0v
//
// (c) Copyright 2012 Muralev Evgeny
//========================================================================
#include "Entities\Entity.h"
class BoxEntity : public Entity
{
public:
BoxEntity(EntityId id) : Entity(id) {}
};
|
Solidstatewater/Anubis-Engine
|
ZMotionBlurDemo/Source/Game/Entities/BoxEntity/BoxEntity.h
|
C
|
bsd-2-clause
| 388
|
static const uint8_t fs_imgui_image_swizz_glsl[425] =
{
0x46, 0x53, 0x48, 0x04, 0x6f, 0x1e, 0x3e, 0x3c, 0x03, 0x00, 0x11, 0x75, 0x5f, 0x69, 0x6d, 0x61, // FSH.o.><...u_ima
0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x02, 0x01, 0x00, 0x00, // geLodEnabled....
0x01, 0x00, 0x09, 0x75, 0x5f, 0x73, 0x77, 0x69, 0x7a, 0x7a, 0x6c, 0x65, 0x02, 0x01, 0x00, 0x00, // ...u_swizzle....
0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x01, 0x00, // ...s_texColor...
0x00, 0x01, 0x00, 0x61, 0x01, 0x00, 0x00, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, // ...a...varying h
0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // ighp vec2 v_texc
0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x68, // oord0;.uniform h
0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, // ighp vec4 u_imag
0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x3b, 0x0a, 0x75, 0x6e, 0x69, // eLodEnabled;.uni
0x66, 0x6f, 0x72, 0x6d, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, // form highp vec4
0x75, 0x5f, 0x73, 0x77, 0x69, 0x7a, 0x7a, 0x6c, 0x65, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, // u_swizzle;.unifo
0x72, 0x6d, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x20, 0x73, 0x5f, 0x74, // rm sampler2D s_t
0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, // exColor;.void ma
0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, // in ().{. lowp v
0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, // ec4 tmpvar_1;.
0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x76, // tmpvar_1.xyz = v
0x65, 0x63, 0x33, 0x28, 0x64, 0x6f, 0x74, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, // ec3(dot (texture
0x32, 0x44, 0x4c, 0x6f, 0x64, 0x20, 0x20, 0x20, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // 2DLod (s_texC
0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // olor, v_texcoord
0x30, 0x2c, 0x20, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, // 0, u_imageLodEna
0x62, 0x6c, 0x65, 0x64, 0x2e, 0x78, 0x29, 0x2c, 0x20, 0x75, 0x5f, 0x73, 0x77, 0x69, 0x7a, 0x7a, // bled.x), u_swizz
0x6c, 0x65, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // le));. tmpvar_1
0x2e, 0x77, 0x20, 0x3d, 0x20, 0x28, 0x30, 0x2e, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x30, 0x2e, 0x38, // .w = (0.2 + (0.8
0x20, 0x2a, 0x20, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, // * u_imageLodEna
0x62, 0x6c, 0x65, 0x64, 0x2e, 0x79, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, // bled.y));. gl_F
0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // ragColor = tmpva
0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // r_1;.}...
};
static const uint8_t fs_imgui_image_swizz_dx9[441] =
{
0x46, 0x53, 0x48, 0x04, 0x6f, 0x1e, 0x3e, 0x3c, 0x02, 0x00, 0x11, 0x75, 0x5f, 0x69, 0x6d, 0x61, // FSH.o.><...u_ima
0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x01, 0x00, 0x00, // geLodEnabled....
0x01, 0x00, 0x09, 0x75, 0x5f, 0x73, 0x77, 0x69, 0x7a, 0x7a, 0x6c, 0x65, 0x12, 0x01, 0x01, 0x00, // ...u_swizzle....
0x01, 0x00, 0x84, 0x01, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x38, 0x00, 0x43, 0x54, 0x41, 0x42, // ..........8.CTAB
0x1c, 0x00, 0x00, 0x00, 0xa9, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, // ................
0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0xa2, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, // ............X...
0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........d.......
0x74, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, // t...............
0x00, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, // ................
0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, // ........s_texCol
0x6f, 0x72, 0x00, 0xab, 0x04, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, // or..............
0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, // ....u_imageLodEn
0x61, 0x62, 0x6c, 0x65, 0x64, 0x00, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, // abled...........
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x73, 0x77, 0x69, 0x7a, 0x7a, 0x6c, // ........u_swizzl
0x65, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, // e.ps_3_0.Microso
0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, // ft (R) HLSL Shad
0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, // er Compiler 9.29
0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0xab, 0xab, 0x51, 0x00, 0x00, 0x05, // .952.3111...Q...
0x02, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xcd, 0xcc, 0x4c, 0x3f, // .......?......L?
0xcd, 0xcc, 0x4c, 0x3e, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, 0x90, // ..L>............
0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, 0x05, 0x00, 0x00, 0x03, // ................
0x00, 0x00, 0x07, 0x80, 0x02, 0x00, 0xd0, 0xa0, 0x00, 0x00, 0xc4, 0x90, 0x01, 0x00, 0x00, 0x02, // ................
0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0xa0, 0x5f, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, // ........_.......
0x00, 0x00, 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, // ................
0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0c, 0x80, // ................
0x02, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0xa0, // ..............U.
0x00, 0x00, 0xaa, 0x80, 0x00, 0x00, 0xff, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, // ................
0x00, 0x00, 0x40, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, // ..@......
};
static const uint8_t fs_imgui_image_swizz_dx11[476] =
{
0x46, 0x53, 0x48, 0x04, 0x6f, 0x1e, 0x3e, 0x3c, 0x02, 0x00, 0x11, 0x75, 0x5f, 0x69, 0x6d, 0x61, // FSH.o.><...u_ima
0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x00, 0x00, 0x00, // geLodEnabled....
0x01, 0x00, 0x09, 0x75, 0x5f, 0x73, 0x77, 0x69, 0x7a, 0x7a, 0x6c, 0x65, 0x12, 0x00, 0x10, 0x00, // ...u_swizzle....
0x01, 0x00, 0xa4, 0x01, 0x44, 0x58, 0x42, 0x43, 0x82, 0x53, 0x75, 0xc2, 0x4f, 0x7e, 0x06, 0x0a, // ....DXBC.Su.O~..
0x49, 0x27, 0x42, 0x29, 0x01, 0x0a, 0x6a, 0x92, 0x01, 0x00, 0x00, 0x00, 0xa4, 0x01, 0x00, 0x00, // I'B)..j.........
0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0xb8, 0x00, 0x00, 0x00, // ....,...........
0x49, 0x53, 0x47, 0x4e, 0x50, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, // ISGNP...........
0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // 8...............
0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........D.......
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, // ................
0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x54, 0x45, 0x58, 0x43, // SV_POSITION.TEXC
0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, 0xab, 0xab, 0x4f, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, // OORD....OSGN,...
0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........ .......
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, // ................
0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, 0x53, 0x48, 0x44, 0x52, // SV_TARGET...SHDR
0xe4, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, // ....@...9...Y...
0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x03, // F. .........Z...
0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x18, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, // .`......X....p..
0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, // ....UU..b...2...
0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....e.... ......
0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, // h.......H.......
0x00, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, // ....F.......F~..
0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x80, 0x20, 0x00, // .....`........ .
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x08, 0x12, 0x00, 0x10, 0x00, // ................
0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, // ....F.......F. .
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0x22, 0x00, 0x10, 0x00, // ........2..."...
0x00, 0x00, 0x00, 0x00, 0x1a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ...... .........
0x01, 0x40, 0x00, 0x00, 0xcd, 0xcc, 0x4c, 0x3f, 0x01, 0x40, 0x00, 0x00, 0xcd, 0xcc, 0x4c, 0x3e, // .@....L?.@....L>
0x36, 0x00, 0x00, 0x05, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x04, 0x10, 0x00, // 6.... ..........
0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x20, 0x00, // ....>..... .
};
|
ocornut/bgfx
|
examples/common/imgui/fs_imgui_image_swizz.bin.h
|
C
|
bsd-2-clause
| 10,103
|
<?php
namespace Aura\Filter\Rule\Validate;
class CallbackTest extends AbstractValidateTest
{
protected function getArgs()
{
return array(function ($subject, $field) {
return is_bool($subject->$field);
});
}
public function providerIs()
{
return array(
array(true),
array(false),
);
}
public function providerIsNot()
{
return array(
array(0),
array(1),
array(null),
);
}
public function providerFix()
{
return array(
array(0, true, false),
array(1, true, true),
);
}
}
|
jakejohns/Aura.Filter
|
tests/Rule/Validate/CallbackTest.php
|
PHP
|
bsd-2-clause
| 680
|
/*
* Copyright © 2010 Intel Corporation
*
* 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 (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include "ir_print_glsl_visitor.h"
#include "ir_visitor.h"
#include "glsl_types.h"
#include "glsl_parser_extras.h"
#include "ir_unused_structs.h"
#include "loop_analysis.h"
#include "program/hash_table.h"
#include <math.h>
#include <limits>
static void print_type(string_buffer& buffer, const glsl_type *t, bool arraySize);
static void print_type_post(string_buffer& buffer, const glsl_type *t, bool arraySize);
static inline const char* get_precision_string (glsl_precision p)
{
switch (p) {
case glsl_precision_high: return "highp ";
case glsl_precision_medium: return "mediump ";
case glsl_precision_low: return "lowp ";
case glsl_precision_undefined: return "";
}
assert(!"Should not get here.");
return "";
}
static const int tex_sampler_type_count = 7;
// [glsl_sampler_dim]
static const char* tex_sampler_dim_name[tex_sampler_type_count] = {
"1D", "2D", "3D", "Cube", "Rect", "Buf", "External",
};
static int tex_sampler_dim_size[tex_sampler_type_count] = {
1, 2, 3, 3, 2, 2, 2,
};
struct ga_entry : public exec_node
{
ga_entry(ir_instruction* ir)
{
assert(ir);
this->ir = ir;
}
ir_instruction* ir;
};
struct global_print_tracker {
global_print_tracker () {
mem_ctx = ralloc_context(0);
var_counter = 0;
var_hash = hash_table_ctor(0, hash_table_pointer_hash, hash_table_pointer_compare);
main_function_done = false;
}
~global_print_tracker() {
hash_table_dtor (var_hash);
ralloc_free(mem_ctx);
}
unsigned var_counter;
hash_table* var_hash;
exec_list global_assignements;
void* mem_ctx;
bool main_function_done;
};
class ir_print_glsl_visitor : public ir_visitor {
public:
ir_print_glsl_visitor(string_buffer& buf, global_print_tracker* globals_, PrintGlslMode mode_, bool use_precision_, const _mesa_glsl_parse_state* state_)
: buffer(buf)
, loopstate(NULL)
, inside_loop_body(false)
, skipped_this_ir(false)
, previous_skipped(false)
, uses_texlod_impl(0)
, uses_texlodproj_impl(0)
{
indentation = 0;
expression_depth = 0;
globals = globals_;
mode = mode_;
use_precision = use_precision_;
state = state_;
}
virtual ~ir_print_glsl_visitor()
{
}
void indent(void);
void newline_indent();
void end_statement_line();
void newline_deindent();
void print_var_name (ir_variable* v);
void print_precision (ir_instruction* ir, const glsl_type* type);
virtual void visit(ir_variable *);
virtual void visit(ir_function_signature *);
virtual void visit(ir_function *);
virtual void visit(ir_expression *);
virtual void visit(ir_texture *);
virtual void visit(ir_swizzle *);
virtual void visit(ir_dereference_variable *);
virtual void visit(ir_dereference_array *);
virtual void visit(ir_dereference_record *);
virtual void visit(ir_assignment *);
virtual void visit(ir_constant *);
virtual void visit(ir_call *);
virtual void visit(ir_return *);
virtual void visit(ir_discard *);
virtual void visit(ir_if *);
virtual void visit(ir_loop *);
virtual void visit(ir_loop_jump *);
virtual void visit(ir_precision_statement *);
virtual void visit(ir_typedecl_statement *);
virtual void visit(ir_emit_vertex *);
virtual void visit(ir_end_primitive *);
void emit_assignment_part (ir_dereference* lhs, ir_rvalue* rhs, unsigned write_mask, ir_rvalue* dstIndex);
bool can_emit_canonical_for (loop_variable_state *ls);
bool emit_canonical_for (ir_loop* ir);
bool try_print_array_assignment (ir_dereference* lhs, ir_rvalue* rhs);
int indentation;
int expression_depth;
string_buffer& buffer;
global_print_tracker* globals;
const _mesa_glsl_parse_state* state;
PrintGlslMode mode;
loop_state* loopstate;
bool use_precision;
bool inside_loop_body;
bool skipped_this_ir;
bool previous_skipped;
int uses_texlod_impl; // 3 bits per tex_dimension, bit set for each precision if any texture sampler needs the GLES2 lod workaround.
int uses_texlodproj_impl; // 3 bits per tex_dimension, bit set for each precision if any texture sampler needs the GLES2 lod workaround.
};
void print_texlod_workarounds(int usage_bitfield, int usage_proj_bitfield, string_buffer &str)
{
static const char *precStrings[3] = {"lowp", "mediump", "highp"};
static const char *precNameStrings[3] = { "low_", "medium_", "high_" };
// Print out the texlod workarounds
for (int prec = 0; prec < 3; prec++)
{
const char *precString = precStrings[prec];
const char *precName = precNameStrings[prec];
for (int dim = 0; dim < tex_sampler_type_count; dim++)
{
int mask = 1 << (dim + (prec * 8));
if (usage_bitfield & mask)
{
str.asprintf_append("%s vec4 impl_%stexture%sLodEXT(%s sampler%s sampler, highp vec%d coord, mediump float lod)\n", precString, precName, tex_sampler_dim_name[dim], precString, tex_sampler_dim_name[dim], tex_sampler_dim_size[dim]);
str.asprintf_append("{\n");
str.asprintf_append("#if defined(GL_EXT_shader_texture_lod)\n");
str.asprintf_append("\treturn texture%sLodEXT(sampler, coord, lod);\n", tex_sampler_dim_name[dim]);
str.asprintf_append("#else\n");
str.asprintf_append("\treturn texture%s(sampler, coord, lod);\n", tex_sampler_dim_name[dim]);
str.asprintf_append("#endif\n");
str.asprintf_append("}\n\n");
}
if (usage_proj_bitfield & mask)
{
// 2D projected read also has a vec4 UV variant
if (dim == GLSL_SAMPLER_DIM_2D)
{
str.asprintf_append("%s vec4 impl_%stexture2DProjLodEXT(%s sampler2D sampler, highp vec4 coord, mediump float lod)\n", precString, precName, precString);
str.asprintf_append("{\n");
str.asprintf_append("#if defined(GL_EXT_shader_texture_lod)\n");
str.asprintf_append("\treturn texture%sProjLodEXT(sampler, coord, lod);\n", tex_sampler_dim_name[dim]);
str.asprintf_append("#else\n");
str.asprintf_append("\treturn texture%sProj(sampler, coord, lod);\n", tex_sampler_dim_name[dim]);
str.asprintf_append("#endif\n");
str.asprintf_append("}\n\n");
}
str.asprintf_append("%s vec4 impl_%stexture%sProjLodEXT(%s sampler%s sampler, highp vec%d coord, mediump float lod)\n", precString, precName, tex_sampler_dim_name[dim], precString, tex_sampler_dim_name[dim], tex_sampler_dim_size[dim] + 1);
str.asprintf_append("{\n");
str.asprintf_append("#if defined(GL_EXT_shader_texture_lod)\n");
str.asprintf_append("\treturn texture%sProjLodEXT(sampler, coord, lod);\n", tex_sampler_dim_name[dim]);
str.asprintf_append("#else\n");
str.asprintf_append("\treturn texture%sProj(sampler, coord, lod);\n", tex_sampler_dim_name[dim]);
str.asprintf_append("#endif\n");
str.asprintf_append("}\n\n");
}
}
}
}
char*
_mesa_print_ir_glsl(exec_list *instructions,
struct _mesa_glsl_parse_state *state,
char* buffer, PrintGlslMode mode)
{
string_buffer str(buffer);
string_buffer body(buffer);
// print version & extensions
if (state) {
if (state->had_version_string)
{
str.asprintf_append ("#version %i", state->language_version);
if (state->es_shader && state->language_version >= 300)
str.asprintf_append (" es");
str.asprintf_append ("\n");
}
if (state->ARB_shader_texture_lod_enable)
str.asprintf_append ("#extension GL_ARB_shader_texture_lod : enable\n");
if (state->EXT_shader_texture_lod_enable)
str.asprintf_append ("#extension GL_EXT_shader_texture_lod : enable\n");
if (state->OES_standard_derivatives_enable)
str.asprintf_append ("#extension GL_OES_standard_derivatives : enable\n");
if (state->EXT_shadow_samplers_enable)
str.asprintf_append ("#extension GL_EXT_shadow_samplers : enable\n");
if (state->EXT_frag_depth_enable)
str.asprintf_append ("#extension GL_EXT_frag_depth : enable\n");
if (state->es_shader && state->language_version < 300)
{
if (state->EXT_draw_buffers_enable)
str.asprintf_append ("#extension GL_EXT_draw_buffers : require\n");
}
if (state->EXT_shader_framebuffer_fetch_enable)
str.asprintf_append ("#extension GL_EXT_shader_framebuffer_fetch : enable\n");
if (state->ARB_shader_bit_encoding_enable)
str.asprintf_append("#extension GL_ARB_shader_bit_encoding : enable\n");
}
// remove unused struct declarations
do_remove_unused_typedecls(instructions);
global_print_tracker gtracker;
int uses_texlod_impl = 0;
int uses_texlodproj_impl = 0;
loop_state* ls = analyze_loop_variables(instructions);
if (ls->loop_found)
set_loop_controls(instructions, ls);
foreach_in_list(ir_instruction, ir, instructions)
{
if (ir->ir_type == ir_type_variable) {
ir_variable *var = static_cast<ir_variable*>(ir);
if ((strstr(var->name, "gl_") == var->name)
&& !var->data.invariant)
continue;
}
ir_print_glsl_visitor v (body, >racker, mode, state->es_shader, state);
v.loopstate = ls;
ir->accept(&v);
if (ir->ir_type != ir_type_function && !v.skipped_this_ir)
body.asprintf_append (";\n");
uses_texlod_impl |= v.uses_texlod_impl;
uses_texlodproj_impl |= v.uses_texlodproj_impl;
}
delete ls;
#if 0 // BK - disable LOD workarounds.
print_texlod_workarounds(uses_texlod_impl, uses_texlodproj_impl, str);
#endif // 0
// Add the optimized glsl code
str.asprintf_append("%s", body.c_str());
return ralloc_strdup(buffer, str.c_str());
}
void ir_print_glsl_visitor::indent(void)
{
if (previous_skipped)
return;
previous_skipped = false;
for (int i = 0; i < indentation; i++)
buffer.asprintf_append (" ");
}
void ir_print_glsl_visitor::end_statement_line()
{
if (!skipped_this_ir)
buffer.asprintf_append(";\n");
previous_skipped = skipped_this_ir;
skipped_this_ir = false;
}
void ir_print_glsl_visitor::newline_indent()
{
if (expression_depth % 4 == 0)
{
++indentation;
buffer.asprintf_append ("\n");
indent();
}
}
void ir_print_glsl_visitor::newline_deindent()
{
if (expression_depth % 4 == 0)
{
--indentation;
buffer.asprintf_append ("\n");
indent();
}
}
void ir_print_glsl_visitor::print_var_name (ir_variable* v)
{
uintptr_t id = (uintptr_t)hash_table_find (globals->var_hash, v);
if (!id && v->data.mode == ir_var_temporary)
{
id = ++globals->var_counter;
hash_table_insert (globals->var_hash, (void*)id, v);
}
if (id)
{
if (v->data.mode == ir_var_temporary)
buffer.asprintf_append ("tmpvar_%d", (int)id);
else
buffer.asprintf_append ("%s_%d", v->name, (int)id);
}
else
{
buffer.asprintf_append ("%s", v->name);
}
}
void ir_print_glsl_visitor::print_precision (ir_instruction* ir, const glsl_type* type)
{
if (!this->use_precision)
return;
if (type &&
!type->is_float() &&
!type->is_sampler() &&
!type->is_integer() &&
(!type->is_array() || !type->element_type()->is_float()) &&
(!type->is_array() || !type->element_type()->is_integer())
)
{
return;
}
glsl_precision prec = precision_from_ir(ir);
// In fragment shader, default float precision is undefined.
// We must thus always print it, when there was no default precision
// and for whatever reason our type ended up having undefined precision.
if (prec == glsl_precision_undefined &&
type && type->is_float() &&
// this->state->stage == MESA_SHADER_FRAGMENT &&
!this->state->had_float_precision)
{
prec = glsl_precision_high;
}
if (type && type->is_integer())
{
if (prec == glsl_precision_undefined && type && type->is_integer())
{
// Default to highp on integers
prec = glsl_precision_high;
}
}
// skip precision for samplers that end up being lowp (default anyway) or undefined;
// except always emit it for shadowmap samplers (some drivers don't implement
// default EXT_shadow_samplers precision) and 3D textures (they always require precision)
if (type && type->is_sampler() && !type->sampler_shadow && !(type->sampler_dimensionality > GLSL_SAMPLER_DIM_2D))
{
if (prec == glsl_precision_low || prec == glsl_precision_undefined)
return;
}
if (prec == glsl_precision_high || prec == glsl_precision_undefined)
{
if (ir->ir_type == ir_type_function_signature)
return;
}
buffer.asprintf_append ("%s", get_precision_string(prec));
}
static void print_type(string_buffer& buffer, const glsl_type *t, bool arraySize)
{
if (t->base_type == GLSL_TYPE_ARRAY) {
print_type(buffer, t->fields.array, true);
if (arraySize)
buffer.asprintf_append ("[%u]", t->length);
} else if ((t->base_type == GLSL_TYPE_STRUCT)
&& (strncmp("gl_", t->name, 3) != 0)) {
buffer.asprintf_append ("%s", t->name);
} else {
buffer.asprintf_append ("%s", t->name);
}
}
static void print_type_post(string_buffer& buffer, const glsl_type *t, bool arraySize)
{
if (t->base_type == GLSL_TYPE_ARRAY) {
if (!arraySize)
buffer.asprintf_append ("[%u]", t->length);
}
}
void ir_print_glsl_visitor::visit(ir_variable *ir)
{
const char *const cent = (ir->data.centroid) ? "centroid " : "";
const char *const inv = (ir->data.invariant) ? "invariant " : "";
const char *const mode[3][ir_var_mode_count] =
{
{ "", "uniform ", "in ", "out ", "inout ", "in ", "out ", "inout ", "", "", "" },
{ "", "uniform ", "attribute ", "varying ", "inout ", "in ", "out ", "inout ", "", "", "" },
{ "", "uniform ", "varying ", "out ", "inout ", "in ", "out ", "inout ", "", "", "" },
};
const char *const interp[] = { "", "smooth ", "flat ", "noperspective " };
if (this->state->language_version >= 300 && ir->data.explicit_location)
{
const int binding_base = (this->state->stage == MESA_SHADER_VERTEX ? (int)VERT_ATTRIB_GENERIC0 : (int)FRAG_RESULT_DATA0);
const int location = ir->data.location - binding_base;
buffer.asprintf_append ("layout(location=%d) ", location);
}
int decormode = this->mode;
// GLSL 1.30 and up use "in" and "out" for everything
if (this->state->language_version >= 130)
{
decormode = 0;
}
// give an id to any variable defined in a function that is not an uniform
if ((this->mode == kPrintGlslNone && ir->data.mode != ir_var_uniform))
{
uintptr_t id = (uintptr_t)hash_table_find (globals->var_hash, ir);
if (id == 0)
{
id = ++globals->var_counter;
hash_table_insert (globals->var_hash, (void*)id, ir);
}
}
// if this is a loop induction variable, do not print it
// (will be printed inside loop body)
if (!inside_loop_body)
{
loop_variable_state* inductor_state = loopstate->get_for_inductor(ir);
if (inductor_state && inductor_state->private_induction_variable_count == 1 &&
can_emit_canonical_for(inductor_state))
{
skipped_this_ir = true;
return;
}
}
// keep invariant declaration for builtin variables
if (strstr(ir->name, "gl_") == ir->name) {
buffer.asprintf_append ("%s", inv);
print_var_name (ir);
return;
}
buffer.asprintf_append ("%s%s%s%s",
cent, inv, interp[ir->data.interpolation], mode[decormode][ir->data.mode]);
print_precision (ir, ir->type);
print_type(buffer, ir->type, false);
buffer.asprintf_append (" ");
print_var_name (ir);
print_type_post(buffer, ir->type, false);
if (ir->constant_value &&
ir->data.mode != ir_var_shader_in &&
ir->data.mode != ir_var_shader_out &&
ir->data.mode != ir_var_shader_inout &&
ir->data.mode != ir_var_function_in &&
ir->data.mode != ir_var_function_out &&
ir->data.mode != ir_var_function_inout)
{
buffer.asprintf_append (" = ");
visit (ir->constant_value);
}
}
void ir_print_glsl_visitor::visit(ir_function_signature *ir)
{
print_precision (ir, ir->return_type);
print_type(buffer, ir->return_type, true);
buffer.asprintf_append (" %s (", ir->function_name());
if (!ir->parameters.is_empty())
{
buffer.asprintf_append ("\n");
indentation++; previous_skipped = false;
bool first = true;
foreach_in_list(ir_variable, inst, &ir->parameters) {
if (!first)
buffer.asprintf_append (",\n");
indent();
inst->accept(this);
first = false;
}
indentation--;
buffer.asprintf_append ("\n");
indent();
}
if (ir->body.is_empty())
{
buffer.asprintf_append (");\n");
return;
}
buffer.asprintf_append (")\n");
indent();
buffer.asprintf_append ("{\n");
indentation++; previous_skipped = false;
// insert postponed global assigments
if (strcmp(ir->function()->name, "main") == 0)
{
assert (!globals->main_function_done);
globals->main_function_done = true;
foreach_in_list(ga_entry, node, &globals->global_assignements)
{
ir_instruction* as = node->ir;
as->accept(this);
buffer.asprintf_append(";\n");
}
}
foreach_in_list(ir_instruction, inst, &ir->body) {
indent();
inst->accept(this);
end_statement_line();
}
indentation--;
indent();
buffer.asprintf_append ("}\n");
}
void ir_print_glsl_visitor::visit(ir_function *ir)
{
bool found_non_builtin_proto = false;
foreach_in_list(ir_function_signature, sig, &ir->signatures) {
if (!sig->is_builtin())
found_non_builtin_proto = true;
}
if (!found_non_builtin_proto)
return;
PrintGlslMode oldMode = this->mode;
this->mode = kPrintGlslNone;
foreach_in_list(ir_function_signature, sig, &ir->signatures) {
indent();
sig->accept(this);
buffer.asprintf_append ("\n");
}
this->mode = oldMode;
indent();
}
static const char *const operator_glsl_strs[] = {
"~",
"!",
"-",
"abs",
"sign",
"1.0/",
"inversesqrt",
"sqrt",
"normalize",
"exp",
"log",
"exp2",
"log2",
"int", // f2i
"int", // f2u
"float", // i2f
"bool", // f2b
"float", // b2f
"bool", // i2b
"int", // b2i
"float", // u2f
"int", // i2u
"int", // u2i
"intBitsToFloat", // bit i2f
"floatBitsToInt", // bit f2i
"uintBitsToFloat", // bit u2f
"floatBitsToUint", // bit f2u
"any",
"trunc",
"ceil",
"floor",
"fract",
"roundEven",
"sin",
"cos",
"sin", // reduced
"cos", // reduced
"dFdx",
"dFdxCoarse",
"dFdxFine",
"dFdy",
"dFdyCoarse",
"dFdyFine",
"packSnorm2x16",
"packSnorm4x8",
"packUnorm2x16",
"packUnorm4x8",
"packHalf2x16",
"unpackSnorm2x16",
"unpackSnorm4x8",
"unpackUnorm2x16",
"unpackUnorm4x8",
"unpackHalf2x16",
"unpackHalf2x16_splitX_TODO",
"unpackHalf2x16_splitY_TODO",
"bitfieldReverse",
"bitCount",
"findMSB",
"findLSB",
"saturate",
"noise",
"interpolateAtCentroid",
"+",
"-",
"*",
"*_imul_high_TODO",
"/",
"carry_TODO",
"borrow_TODO",
"mod",
"<",
">",
"<=",
">=",
"equal",
"notEqual",
"==",
"!=",
"<<",
">>",
"&",
"^",
"|",
"&&",
"^^",
"||",
"dot",
"min",
"max",
"pow",
"packHalf2x16_split_TODO",
"bfm_TODO",
"uboloadTODO",
"ldexp_TODO",
"vectorExtract_TODO",
"interpolateAtOffset",
"interpolateAtSample",
"fma",
"clamp",
"mix",
"csel_TODO",
"bfi_TODO",
"bitfield_extract_TODO",
"vector_insert_TODO",
"bitfield_insert_TODO",
"vectorTODO",
};
static const char *const operator_vec_glsl_strs[] = {
"lessThan",
"greaterThan",
"lessThanEqual",
"greaterThanEqual",
"equal",
"notEqual",
};
static bool is_binop_func_like(ir_expression_operation op, const glsl_type* type)
{
if (op == ir_binop_equal ||
op == ir_binop_nequal ||
op == ir_binop_mod ||
(op >= ir_binop_dot && op <= ir_binop_pow))
return true;
if (type->is_vector() && (op >= ir_binop_less && op <= ir_binop_nequal))
{
return true;
}
return false;
}
void ir_print_glsl_visitor::visit(ir_expression *ir)
{
++this->expression_depth;
newline_indent();
if (ir->get_num_operands() == 1) {
if (ir->operation >= ir_unop_f2i && ir->operation <= ir_unop_u2i) {
print_type(buffer, ir->type, true);
buffer.asprintf_append ("(");
} else if (ir->operation == ir_unop_rcp) {
buffer.asprintf_append ("(1.0/(");
} else {
buffer.asprintf_append ("%s(", operator_glsl_strs[ir->operation]);
}
if (ir->operands[0])
ir->operands[0]->accept(this);
buffer.asprintf_append (")");
if (ir->operation == ir_unop_rcp) {
buffer.asprintf_append (")");
}
}
else if (ir->operation == ir_binop_vector_extract)
{
// a[b]
if (ir->operands[0])
ir->operands[0]->accept(this);
buffer.asprintf_append ("[");
if (ir->operands[1])
ir->operands[1]->accept(this);
buffer.asprintf_append ("]");
}
else if (is_binop_func_like(ir->operation, ir->type))
{
if (ir->operation == ir_binop_mod)
{
buffer.asprintf_append ("(");
print_type(buffer, ir->type, true);
buffer.asprintf_append ("(");
}
if (ir->type->is_vector() && (ir->operation >= ir_binop_less && ir->operation <= ir_binop_nequal))
buffer.asprintf_append ("%s (", operator_vec_glsl_strs[ir->operation-ir_binop_less]);
else
buffer.asprintf_append ("%s (", operator_glsl_strs[ir->operation]);
if (ir->operands[0])
ir->operands[0]->accept(this);
buffer.asprintf_append (", ");
if (ir->operands[1])
ir->operands[1]->accept(this);
buffer.asprintf_append (")");
if (ir->operation == ir_binop_mod)
buffer.asprintf_append ("))");
}
else if (ir->get_num_operands() == 2)
{
buffer.asprintf_append ("(");
if (ir->operands[0])
ir->operands[0]->accept(this);
buffer.asprintf_append (" %s ", operator_glsl_strs[ir->operation]);
if (ir->operands[1])
ir->operands[1]->accept(this);
buffer.asprintf_append (")");
}
else
{
// ternary op
buffer.asprintf_append ("%s (", operator_glsl_strs[ir->operation]);
if (ir->operands[0])
ir->operands[0]->accept(this);
buffer.asprintf_append (", ");
if (ir->operands[1])
ir->operands[1]->accept(this);
buffer.asprintf_append (", ");
if (ir->operands[2])
ir->operands[2]->accept(this);
buffer.asprintf_append (")");
}
newline_deindent();
--this->expression_depth;
}
void ir_print_glsl_visitor::visit(ir_texture *ir)
{
glsl_sampler_dim sampler_dim = (glsl_sampler_dim)ir->sampler->type->sampler_dimensionality;
const bool is_shadow = ir->sampler->type->sampler_shadow;
const glsl_type* uv_type = ir->coordinate->type;
const int uv_dim = uv_type->vector_elements;
int sampler_uv_dim = tex_sampler_dim_size[sampler_dim];
if (is_shadow)
sampler_uv_dim += 1;
const bool is_proj = (uv_dim > sampler_uv_dim);
const bool is_lod = (ir->op == ir_txl);
#if 0 // BK - disable LOD workarounds.
if (is_lod && state->es_shader && state->language_version < 300 && state->stage == MESA_SHADER_FRAGMENT)
{
// Special workaround for GLES 2.0 LOD samplers to prevent a lot of debug spew.
const glsl_precision prec = ir->sampler->get_precision();
const char *precString = "";
// Sampler bitfield is 7 bits, so use 0-7 for lowp, 8-15 for mediump and 16-23 for highp.
int position = (int)sampler_dim;
switch (prec)
{
case glsl_precision_high:
position += 16;
precString = "_high_";
break;
case glsl_precision_medium:
position += 8;
precString = "_medium_";
break;
case glsl_precision_low:
default:
precString = "_low_";
break;
}
buffer.asprintf_append("impl%s", precString);
if (is_proj)
uses_texlodproj_impl |= (1 << position);
else
uses_texlod_impl |= (1 << position);
}
#endif // 0
// texture function name
//ACS: shadow lookups and lookups with dimensionality included in the name were deprecated in 130
if(state->language_version<130)
{
buffer.asprintf_append ("%s", is_shadow ? "shadow" : "texture");
buffer.asprintf_append ("%s", tex_sampler_dim_name[sampler_dim]);
}
else
{
if (ir->op == ir_txf)
buffer.asprintf_append ("texelFetch");
else
buffer.asprintf_append ("texture");
}
if (is_proj)
buffer.asprintf_append ("Proj");
if (ir->op == ir_txl)
buffer.asprintf_append ("Lod");
if (ir->op == ir_txd)
buffer.asprintf_append ("Grad");
if (ir->offset != NULL)
buffer.asprintf_append ("Offset");
if (state->es_shader)
{
if ( (is_shadow && state->EXT_shadow_samplers_enable) ||
(ir->op == ir_txl && state->EXT_shader_texture_lod_enable) )
{
buffer.asprintf_append ("EXT");
}
}
if(ir->op == ir_txd)
{
if(state->es_shader && state->EXT_shader_texture_lod_enable)
buffer.asprintf_append ("EXT");
else if(!state->es_shader && state->ARB_shader_texture_lod_enable)
buffer.asprintf_append ("ARB");
}
buffer.asprintf_append (" (");
// sampler
ir->sampler->accept(this);
buffer.asprintf_append (", ");
// texture coordinate
ir->coordinate->accept(this);
// lod
if (ir->op == ir_txl || ir->op == ir_txf)
{
buffer.asprintf_append (", ");
ir->lod_info.lod->accept(this);
}
// grad
if (ir->op == ir_txd)
{
buffer.asprintf_append (", ");
ir->lod_info.grad.dPdx->accept(this);
buffer.asprintf_append (", ");
ir->lod_info.grad.dPdy->accept(this);
}
// texel offset
if (ir->offset != NULL)
{
buffer.asprintf_append (", ");
ir->offset->accept(this);
}
// lod bias
if (ir->op == ir_txb)
{
buffer.asprintf_append (", ");
ir->lod_info.bias->accept(this);
}
/*
if (ir->op != ir_txf) {
if (ir->projector)
ir->projector->accept(this);
else
buffer.asprintf_append ("1");
if (ir->shadow_comparitor) {
buffer.asprintf_append (" ");
ir->shadow_comparitor->accept(this);
} else {
buffer.asprintf_append (" ()");
}
}
buffer.asprintf_append (" ");
switch (ir->op)
{
case ir_tex:
break;
case ir_txb:
ir->lod_info.bias->accept(this);
break;
case ir_txl:
case ir_txf:
ir->lod_info.lod->accept(this);
break;
case ir_txd:
buffer.asprintf_append ("(");
ir->lod_info.grad.dPdx->accept(this);
buffer.asprintf_append (" ");
ir->lod_info.grad.dPdy->accept(this);
buffer.asprintf_append (")");
break;
};
*/
buffer.asprintf_append (")");
}
void ir_print_glsl_visitor::visit(ir_swizzle *ir)
{
const unsigned swiz[4] = {
ir->mask.x,
ir->mask.y,
ir->mask.z,
ir->mask.w,
};
if (ir->val->type == glsl_type::float_type || ir->val->type == glsl_type::int_type || ir->val->type == glsl_type::uint_type)
{
if (ir->mask.num_components != 1)
{
print_type(buffer, ir->type, true);
buffer.asprintf_append ("(");
}
}
ir->val->accept(this);
if (ir->val->type == glsl_type::float_type || ir->val->type == glsl_type::int_type || ir->val->type == glsl_type::uint_type)
{
if (ir->mask.num_components != 1)
{
buffer.asprintf_append (")");
}
return;
}
// Swizzling scalar types is not allowed so just return now.
if (ir->val->type->vector_elements == 1)
return;
buffer.asprintf_append (".");
for (unsigned i = 0; i < ir->mask.num_components; i++) {
buffer.asprintf_append ("%c", "xyzw"[swiz[i]]);
}
}
void ir_print_glsl_visitor::visit(ir_dereference_variable *ir)
{
ir_variable *var = ir->variable_referenced();
print_var_name (var);
}
void ir_print_glsl_visitor::visit(ir_dereference_array *ir)
{
ir->array->accept(this);
buffer.asprintf_append ("[");
ir->array_index->accept(this);
buffer.asprintf_append ("]");
}
void ir_print_glsl_visitor::visit(ir_dereference_record *ir)
{
ir->record->accept(this);
buffer.asprintf_append (".%s", ir->field);
}
bool ir_print_glsl_visitor::try_print_array_assignment (ir_dereference* lhs, ir_rvalue* rhs)
{
if (this->state->language_version >= 120)
return false;
ir_dereference_variable* rhsarr = rhs->as_dereference_variable();
if (rhsarr == NULL)
return false;
const glsl_type* lhstype = lhs->type;
const glsl_type* rhstype = rhsarr->type;
if (!lhstype->is_array() || !rhstype->is_array())
return false;
if (lhstype->array_size() != rhstype->array_size())
return false;
if (lhstype->base_type != rhstype->base_type)
return false;
const unsigned size = rhstype->array_size();
for (unsigned i = 0; i < size; i++)
{
lhs->accept(this);
buffer.asprintf_append ("[%d]=", i);
rhs->accept(this);
buffer.asprintf_append ("[%d]", i);
if (i != size-1)
buffer.asprintf_append (";");
}
return true;
}
void ir_print_glsl_visitor::emit_assignment_part (ir_dereference* lhs, ir_rvalue* rhs, unsigned write_mask, ir_rvalue* dstIndex)
{
lhs->accept(this);
if (dstIndex)
{
// if dst index is a constant, then emit a swizzle
ir_constant* dstConst = dstIndex->as_constant();
if (dstConst)
{
const char* comps = "xyzw";
char comp = comps[dstConst->get_int_component(0)];
buffer.asprintf_append (".%c", comp);
}
else
{
buffer.asprintf_append ("[");
dstIndex->accept(this);
buffer.asprintf_append ("]");
}
}
char mask[5];
unsigned j = 0;
const glsl_type* lhsType = lhs->type;
const glsl_type* rhsType = rhs->type;
if (!dstIndex && lhsType->matrix_columns <= 1 && lhsType->vector_elements > 1 && write_mask != (1<<lhsType->vector_elements)-1)
{
for (unsigned i = 0; i < 4; i++) {
if ((write_mask & (1 << i)) != 0) {
mask[j] = "xyzw"[i];
j++;
}
}
lhsType = glsl_type::get_instance(lhsType->base_type, j, 1);
}
mask[j] = '\0';
bool hasWriteMask = false;
if (mask[0])
{
buffer.asprintf_append (".%s", mask);
hasWriteMask = true;
}
buffer.asprintf_append (" = ");
bool typeMismatch = !dstIndex && (lhsType != rhsType);
const bool addSwizzle = hasWriteMask && typeMismatch;
if (typeMismatch)
{
if (!addSwizzle)
print_type(buffer, lhsType, true);
buffer.asprintf_append ("(");
}
rhs->accept(this);
if (typeMismatch)
{
buffer.asprintf_append (")");
if (addSwizzle)
buffer.asprintf_append (".%s", mask);
}
}
// Try to print (X = X + const) as (X += const), mostly to satisfy
// OpenGL ES 2.0 loop syntax restrictions.
static bool try_print_increment (ir_print_glsl_visitor* vis, ir_assignment* ir)
{
if (ir->condition)
return false;
// Needs to be + on rhs
ir_expression* rhsOp = ir->rhs->as_expression();
if (!rhsOp || rhsOp->operation != ir_binop_add)
return false;
// Needs to write to whole variable
ir_variable* lhsVar = ir->whole_variable_written();
if (lhsVar == NULL)
return false;
// Types must match
if (ir->lhs->type != ir->rhs->type)
return false;
// Type must be scalar
if (!ir->lhs->type->is_scalar())
return false;
// rhs0 must be variable deref, same one as lhs
ir_dereference_variable* rhsDeref = rhsOp->operands[0]->as_dereference_variable();
if (rhsDeref == NULL)
return false;
if (lhsVar != rhsDeref->var)
return false;
// rhs1 must be a constant
ir_constant* rhsConst = rhsOp->operands[1]->as_constant();
if (!rhsConst)
return false;
// print variable name
ir->lhs->accept (vis);
// print ++ or +=const
if (ir->lhs->type->base_type <= GLSL_TYPE_INT && rhsConst->is_one())
{
vis->buffer.asprintf_append ("++");
}
else
{
vis->buffer.asprintf_append(" += ");
rhsConst->accept (vis);
}
return true;
}
void ir_print_glsl_visitor::visit(ir_assignment *ir)
{
// if this is a loop induction variable initial assignment, and we aren't inside loop body:
// do not print it (will be printed when inside loop body)
if (!inside_loop_body)
{
ir_variable* whole_var = ir->whole_variable_written();
if (!ir->condition && whole_var)
{
loop_variable_state* inductor_state = loopstate->get_for_inductor(whole_var);
if (inductor_state && inductor_state->private_induction_variable_count == 1 &&
can_emit_canonical_for(inductor_state))
{
skipped_this_ir = true;
return;
}
}
}
// assignments in global scope are postponed to main function
if (this->mode != kPrintGlslNone)
{
assert (!this->globals->main_function_done);
this->globals->global_assignements.push_tail (new(this->globals->mem_ctx) ga_entry(ir));
buffer.asprintf_append ("//"); // for the ; that will follow (ugly, I know)
return;
}
// if RHS is ir_triop_vector_insert, then we have to do some special dance. If source expression is:
// dst = vector_insert (a, b, idx)
// then emit it like:
// dst = a;
// dst.idx = b;
ir_expression* rhsOp = ir->rhs->as_expression();
if (rhsOp && rhsOp->operation == ir_triop_vector_insert)
{
// skip assignment if lhs and rhs would be the same
bool skip_assign = false;
ir_dereference_variable* lhsDeref = ir->lhs->as_dereference_variable();
ir_dereference_variable* rhsDeref = rhsOp->operands[0]->as_dereference_variable();
if (lhsDeref && rhsDeref)
{
if (lhsDeref->var == rhsDeref->var)
skip_assign = true;
}
if (!skip_assign)
{
emit_assignment_part(ir->lhs, rhsOp->operands[0], ir->write_mask, NULL);
buffer.asprintf_append ("; ");
}
emit_assignment_part(ir->lhs, rhsOp->operands[1], ir->write_mask, rhsOp->operands[2]);
return;
}
if (try_print_increment (this, ir))
return;
if (try_print_array_assignment (ir->lhs, ir->rhs))
return;
if (ir->condition)
{
ir->condition->accept(this);
buffer.asprintf_append (" ");
}
emit_assignment_part (ir->lhs, ir->rhs, ir->write_mask, NULL);
}
#ifdef _MSC_VER
#define isnan(x) _isnan(x)
#define isinf(x) (!_finite(x))
#endif
#define fpcheck(x) (isnan(x) || isinf(x))
void print_float (string_buffer& buffer, float f)
{
// Kind of roundabout way, but this is to satisfy two things:
// * MSVC and gcc-based compilers differ a bit in how they treat float
// widht/precision specifiers. Want to match for tests.
// * GLSL (early version at least) require floats to have ".0" or
// exponential notation.
char tmp[64];
snprintf(tmp, 64, "%.7g", f);
char* posE = NULL;
posE = strchr(tmp, 'e');
if (!posE)
posE = strchr(tmp, 'E');
// snprintf formats infinity as inf.0 or -inf.0, which isn't useful here.
// GLSL has no infinity constant so print an equivalent expression instead.
if (f == std::numeric_limits<float>::infinity())
strcpy(tmp, "(1.0/0.0)");
if (f == -std::numeric_limits<float>::infinity())
strcpy(tmp, "(-1.0/0.0)");
// Do similar thing for NaN
if (f != f)
strcpy(tmp, "(0.0/0.0)");
#if defined(_MSC_VER)
// While gcc would print something like 1.0e+07, MSVC will print 1.0e+007 -
// only for exponential notation, it seems, will add one extra useless zero. Let's try to remove
// that so compiler output matches.
if (posE != NULL)
{
if((posE[1] == '+' || posE[1] == '-') && posE[2] == '0')
{
char* p = posE+2;
while (p[0])
{
p[0] = p[1];
++p;
}
}
}
#endif
buffer.asprintf_append ("%s", tmp);
// need to append ".0"?
if (!strchr(tmp,'.') && (posE == NULL))
buffer.asprintf_append(".0");
}
void ir_print_glsl_visitor::visit(ir_constant *ir)
{
const glsl_type* type = ir->type;
if (type == glsl_type::float_type)
{
if (fpcheck(ir->value.f[0]))
{
// Non-printable float. If we have bit conversions, we're fine. otherwise do hand-wavey things in print_float().
if ((state->es_shader && (state->language_version >= 300))
|| (state->language_version >= 330)
|| (state->ARB_shader_bit_encoding_enable))
{
buffer.asprintf_append("uintBitsToFloat(%uu)", ir->value.u[0]);
return;
}
}
print_float (buffer, ir->value.f[0]);
return;
}
else if (type == glsl_type::int_type)
{
// Need special handling for INT_MIN
if (ir->value.u[0] == 0x80000000)
buffer.asprintf_append("int(0x%X)", ir->value.i[0]);
else
buffer.asprintf_append ("%d", ir->value.i[0]);
return;
}
else if (type == glsl_type::uint_type)
{
// ES 2.0 doesn't support uints, neither does GLSL < 130
if ((state->es_shader && (state->language_version < 300))
|| (state->language_version < 130))
buffer.asprintf_append("%u", ir->value.u[0]);
else
{
// Old Adreno drivers try to be smart with '0u' and treat that as 'const int'. Sigh.
if (ir->value.u[0] == 0)
buffer.asprintf_append("uint(0)");
else
buffer.asprintf_append("%uu", ir->value.u[0]);
}
return;
}
const glsl_type *const base_type = ir->type->get_base_type();
print_type(buffer, type, true);
buffer.asprintf_append ("(");
if (ir->type->is_array()) {
for (unsigned i = 0; i < ir->type->length; i++)
{
if (i != 0)
buffer.asprintf_append (", ");
ir->get_array_element(i)->accept(this);
}
} else if (ir->type->is_record()) {
bool first = true;
foreach_in_list(ir_constant, inst, &ir->components) {
if (!first)
buffer.asprintf_append (", ");
first = false;
inst->accept(this);
}
}else {
bool first = true;
for (unsigned i = 0; i < ir->type->components(); i++) {
if (!first)
buffer.asprintf_append (", ");
first = false;
switch (base_type->base_type) {
case GLSL_TYPE_UINT:
{
// ES 2.0 doesn't support uints, neither does GLSL < 130
if ((state->es_shader && (state->language_version < 300))
|| (state->language_version < 130))
buffer.asprintf_append("%u", ir->value.u[i]);
else
buffer.asprintf_append("%uu", ir->value.u[i]);
break;
}
case GLSL_TYPE_INT:
{
// Need special handling for INT_MIN
if (ir->value.u[i] == 0x80000000)
buffer.asprintf_append("int(0x%X)", ir->value.i[i]);
else
buffer.asprintf_append("%d", ir->value.i[i]);
break;
}
case GLSL_TYPE_FLOAT: print_float(buffer, ir->value.f[i]); break;
case GLSL_TYPE_BOOL: buffer.asprintf_append ("%d", ir->value.b[i]); break;
default: assert(0);
}
}
}
buffer.asprintf_append (")");
}
void
ir_print_glsl_visitor::visit(ir_call *ir)
{
// calls in global scope are postponed to main function
if (this->mode != kPrintGlslNone)
{
assert (!this->globals->main_function_done);
this->globals->global_assignements.push_tail (new(this->globals->mem_ctx) ga_entry(ir));
buffer.asprintf_append ("//"); // for the ; that will follow (ugly, I know)
return;
}
if (ir->return_deref)
{
visit(ir->return_deref);
buffer.asprintf_append (" = ");
}
buffer.asprintf_append ("%s (", ir->callee_name());
bool first = true;
foreach_in_list(ir_instruction, inst, &ir->actual_parameters) {
if (!first)
buffer.asprintf_append (", ");
inst->accept(this);
first = false;
}
buffer.asprintf_append (")");
}
void
ir_print_glsl_visitor::visit(ir_return *ir)
{
buffer.asprintf_append ("return");
ir_rvalue *const value = ir->get_value();
if (value) {
buffer.asprintf_append (" ");
value->accept(this);
}
}
void
ir_print_glsl_visitor::visit(ir_discard *ir)
{
buffer.asprintf_append ("discard");
if (ir->condition != NULL) {
buffer.asprintf_append (" TODO ");
ir->condition->accept(this);
}
}
void
ir_print_glsl_visitor::visit(ir_if *ir)
{
buffer.asprintf_append ("if (");
ir->condition->accept(this);
buffer.asprintf_append (") {\n");
indentation++; previous_skipped = false;
foreach_in_list(ir_instruction, inst, &ir->then_instructions) {
indent();
inst->accept(this);
end_statement_line();
}
indentation--;
indent();
buffer.asprintf_append ("}");
if (!ir->else_instructions.is_empty())
{
buffer.asprintf_append (" else {\n");
indentation++; previous_skipped = false;
foreach_in_list(ir_instruction, inst, &ir->else_instructions) {
indent();
inst->accept(this);
end_statement_line();
}
indentation--;
indent();
buffer.asprintf_append ("}");
}
}
bool ir_print_glsl_visitor::can_emit_canonical_for (loop_variable_state *ls)
{
if (ls == NULL)
return false;
if (ls->induction_variables.is_empty())
return false;
if (ls->terminators.is_empty())
return false;
// only support for loops with one terminator condition
int terminatorCount = ls->terminators.length();
if (terminatorCount != 1)
return false;
return true;
}
bool ir_print_glsl_visitor::emit_canonical_for (ir_loop* ir)
{
loop_variable_state* const ls = this->loopstate->get(ir);
if (!can_emit_canonical_for(ls))
return false;
hash_table* terminator_hash = hash_table_ctor(0, hash_table_pointer_hash, hash_table_pointer_compare);
hash_table* induction_hash = hash_table_ctor(0, hash_table_pointer_hash, hash_table_pointer_compare);
buffer.asprintf_append("for (");
inside_loop_body = true;
// emit loop induction variable declarations.
// only for loops with single induction variable, to avoid cases of different types of them
if (ls->private_induction_variable_count == 1)
{
foreach_in_list(loop_variable, indvar, &ls->induction_variables)
{
if (!this->loopstate->get_for_inductor(indvar->var))
continue;
ir_variable* var = indvar->var;
print_precision (var, var->type);
print_type(buffer, var->type, false);
buffer.asprintf_append (" ");
print_var_name (var);
print_type_post(buffer, var->type, false);
if (indvar->initial_value)
{
buffer.asprintf_append (" = ");
// if the var is an array add the proper initializer
if(var->type->is_vector())
{
print_type(buffer, var->type, false);
buffer.asprintf_append ("(");
}
indvar->initial_value->accept(this);
if(var->type->is_vector())
{
buffer.asprintf_append (")");
}
}
}
}
buffer.asprintf_append("; ");
// emit loop terminating conditions
foreach_in_list(loop_terminator, term, &ls->terminators)
{
hash_table_insert(terminator_hash, term, term->ir);
// IR has conditions in the form of "if (x) break",
// whereas for loop needs them negated, in the form
// if "while (x) continue the loop".
// See if we can print them using syntax that reads nice.
bool handled = false;
ir_expression* term_expr = term->ir->condition->as_expression();
if (term_expr)
{
// Binary comparison conditions
const char* termOp = NULL;
switch (term_expr->operation)
{
case ir_binop_less: termOp = ">="; break;
case ir_binop_greater: termOp = "<="; break;
case ir_binop_lequal: termOp = ">"; break;
case ir_binop_gequal: termOp = "<"; break;
case ir_binop_equal: termOp = "!="; break;
case ir_binop_nequal: termOp = "=="; break;
default: break;
}
if (termOp != NULL)
{
term_expr->operands[0]->accept(this);
buffer.asprintf_append(" %s ", termOp);
term_expr->operands[1]->accept(this);
handled = true;
}
// Unary logic not
if (!handled && term_expr->operation == ir_unop_logic_not)
{
term_expr->operands[0]->accept(this);
handled = true;
}
}
// More complex condition, print as "!(x)"
if (!handled)
{
buffer.asprintf_append("!(");
term->ir->condition->accept(this);
buffer.asprintf_append(")");
}
}
buffer.asprintf_append("; ");
// emit loop induction variable updates
bool first = true;
foreach_in_list(loop_variable, indvar, &ls->induction_variables)
{
hash_table_insert(induction_hash, indvar, indvar->first_assignment);
if (!first)
buffer.asprintf_append(", ");
visit(indvar->first_assignment);
first = false;
}
buffer.asprintf_append(") {\n");
inside_loop_body = false;
// emit loop body
indentation++; previous_skipped = false;
foreach_in_list(ir_instruction, inst, &ir->body_instructions) {
// skip termination & induction statements,
// they are part of "for" clause
if (hash_table_find(terminator_hash, inst))
continue;
if (hash_table_find(induction_hash, inst))
continue;
indent();
inst->accept(this);
end_statement_line();
}
indentation--;
indent();
buffer.asprintf_append("}");
hash_table_dtor (terminator_hash);
hash_table_dtor (induction_hash);
return true;
}
void
ir_print_glsl_visitor::visit(ir_loop *ir)
{
if (emit_canonical_for(ir))
return;
buffer.asprintf_append ("while (true) {\n");
indentation++; previous_skipped = false;
foreach_in_list(ir_instruction, inst, &ir->body_instructions) {
indent();
inst->accept(this);
end_statement_line();
}
indentation--;
indent();
buffer.asprintf_append ("}");
}
void
ir_print_glsl_visitor::visit(ir_loop_jump *ir)
{
buffer.asprintf_append ("%s", ir->is_break() ? "break" : "continue");
}
void
ir_print_glsl_visitor::visit(ir_precision_statement *ir)
{
buffer.asprintf_append ("%s", ir->precision_statement);
}
void
ir_print_glsl_visitor::visit(ir_typedecl_statement *ir)
{
const glsl_type *const s = ir->type_decl;
buffer.asprintf_append ("struct %s {\n", s->name);
for (unsigned j = 0; j < s->length; j++) {
buffer.asprintf_append (" ");
if (state->es_shader)
buffer.asprintf_append ("%s", get_precision_string(s->fields.structure[j].precision));
print_type(buffer, s->fields.structure[j].type, false);
buffer.asprintf_append (" %s", s->fields.structure[j].name);
print_type_post(buffer, s->fields.structure[j].type, false);
buffer.asprintf_append (";\n");
}
buffer.asprintf_append ("}");
}
void
ir_print_glsl_visitor::visit(ir_emit_vertex *ir)
{
buffer.asprintf_append ("emit-vertex-TODO");
}
void
ir_print_glsl_visitor::visit(ir_end_primitive *ir)
{
buffer.asprintf_append ("end-primitive-TODO");
}
|
cyndis/bgfx
|
3rdparty/glsl-optimizer/src/glsl/ir_print_glsl_visitor.cpp
|
C++
|
bsd-2-clause
| 45,696
|
using System;
using System.Globalization;
using System.Reflection;
namespace BLToolkit.Reflection
{
/// <Summary>
/// Selects a member from a list of candidates, and performs type conversion
/// from actual argument type to formal argument type.
/// </Summary>
[Serializable]
public class GenericBinder : Binder
{
private readonly bool _genericMethodDefinition;
public GenericBinder(bool genericMethodDefinition)
{
_genericMethodDefinition = genericMethodDefinition;
}
#region System.Reflection.Binder methods
public override MethodBase BindToMethod(BindingFlags bindingAttr, MethodBase[] match, ref object[] args,
ParameterModifier[] modifiers, CultureInfo culture, string[] names, out object state)
{
throw new NotImplementedException("GenericBinder.BindToMethod");
}
public override FieldInfo BindToField(BindingFlags bindingAttr, FieldInfo[] match, object value, CultureInfo culture)
{
throw new NotImplementedException("GenericBinder.BindToField");
}
public override MethodBase SelectMethod(
BindingFlags bindingAttr,
MethodBase[] matchMethods,
Type[] parameterTypes,
ParameterModifier[] modifiers)
{
for (int i = 0; i < matchMethods.Length; ++i)
{
if (matchMethods[i].IsGenericMethodDefinition != _genericMethodDefinition)
continue;
ParameterInfo[] pis = matchMethods[i].GetParameters();
bool match = (pis.Length == parameterTypes.Length);
for (int j = 0; match && j < pis.Length; ++j)
{
match = TypeHelper.CompareParameterTypes(pis[j].ParameterType, parameterTypes[j]);
}
if (match)
return matchMethods[i];
}
return null;
}
public override PropertyInfo SelectProperty(BindingFlags bindingAttr, PropertyInfo[] match, Type returnType,
Type[] indexes, ParameterModifier[] modifiers)
{
throw new NotImplementedException("GenericBinder.SelectProperty");
}
public override object ChangeType(object value, Type type, CultureInfo culture)
{
throw new NotImplementedException("GenericBinder.ChangeType");
}
public override void ReorderArgumentArray(ref object[] args, object state)
{
throw new NotImplementedException("GenericBinder.ReorderArgumentArray");
}
#endregion
private static GenericBinder _generic;
public static GenericBinder Generic
{
get { return _generic ?? (_generic = new GenericBinder(true)); }
}
private static GenericBinder _nonGeneric;
public static GenericBinder NonGeneric
{
get { return _nonGeneric ?? (_nonGeneric = new GenericBinder(false)); }
}
}
}
|
EIDSS/EIDSS-Legacy
|
EIDSS v6/bltoolkit.3.2.dev/Reflection/GenericBinder.cs
|
C#
|
bsd-2-clause
| 2,686
|
cask 'without-languages' do
version '1.2.3'
sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
homepage 'https://brew.sh'
app 'Caffeine.app'
end
|
sjackman/linuxbrew
|
Library/Homebrew/test/support/fixtures/cask/Casks/without-languages.rb
|
Ruby
|
bsd-2-clause
| 231
|
class BoostPython < Formula
desc "C++ library for C++/Python interoperability"
homepage "http://www.boost.org"
url "https://downloads.sourceforge.net/project/boost/boost/1.58.0/boost_1_58_0.tar.bz2"
sha256 "fdfc204fc33ec79c99b9a74944c3e54bd78be4f7f15e260c0e2700a36dc7d3e5"
head "https://github.com/boostorg/boost.git"
stable do
# don't explicitly link a Python framework
# https://github.com/boostorg/build/pull/78
patch do
url "https://gist.githubusercontent.com/tdsmith/9026da299ac1bfd3f419/raw/b73a919c38af08941487ca37d46e711864104c4d/boost-python.diff"
sha256 "9f374761ada11eecd082e7f9d5b80efeb387039d3a290f45b61f0730bce3801a"
end
end
bottle do
cellar :any
sha256 "aa56ab952ef93ad52672b86cc8b8371fe79cb907d6eed88a316ed2808a264cd2" => :el_capitan
sha256 "7f627fb1887ecaaea4b6b363d300a21c5274a1607c7dc64f2114d3794b5fec11" => :yosemite
sha256 "6239719b00615abb9ce2bd40c680b14182325c2e1844c1bea410c002b42ce1db" => :mavericks
sha256 "24acf2ddde1edfabe04239856dec6ce85e8652f3c0d5d8cf357b219c2bf3272a" => :mountain_lion
end
option :universal
option :cxx11
option "without-python", "Build without python 2 support"
depends_on :python3 => :optional
if build.cxx11?
depends_on "boost" => "c++11"
else
depends_on "boost"
end
fails_with :llvm do
build 2335
cause "Dropped arguments to functions when linking with boost"
end
def install
ENV.universal_binary if build.universal?
# "layout" should be synchronized with boost
args = ["--prefix=#{prefix}",
"--libdir=#{lib}",
"-d2",
"-j#{ENV.make_jobs}",
"--layout=tagged",
"--user-config=user-config.jam",
"threading=multi,single",
"link=shared,static"]
args << "address-model=32_64" << "architecture=x86" << "pch=off" if build.universal?
# Build in C++11 mode if boost was built in C++11 mode.
# Trunk starts using "clang++ -x c" to select C compiler which breaks C++11
# handling using ENV.cxx11. Using "cxxflags" and "linkflags" still works.
if build.cxx11?
args << "cxxflags=-std=c++11"
if ENV.compiler == :clang
args << "cxxflags=-stdlib=libc++" << "linkflags=-stdlib=libc++"
end
elsif Tab.for_name("boost").cxx11?
odie "boost was built in C++11 mode so boost-python must be built with --c++11."
end
# disable python detection in bootstrap.sh; it guesses the wrong include directory
# for Python 3 headers, so we configure python manually in user-config.jam below.
inreplace "bootstrap.sh", "using python", "#using python"
Language::Python.each_python(build) do |python, version|
py_prefix = `#{python} -c "from __future__ import print_function; import sys; print(sys.prefix)"`.strip
py_include = `#{python} -c "from __future__ import print_function; import distutils.sysconfig; print(distutils.sysconfig.get_python_inc(True))"`.strip
open("user-config.jam", "w") do |file|
# Force boost to compile with the desired compiler
file.write "using #{OS.mac? ? 'darwin' : 'gcc'} : : #{ENV.cxx} ;\n"
file.write <<-EOS.undent
using python : #{version}
: #{python}
: #{py_include}
: #{py_prefix}/lib ;
EOS
end
system "./bootstrap.sh", "--prefix=#{prefix}", "--libdir=#{lib}", "--with-libraries=python",
"--with-python=#{python}", "--with-python-root=#{py_prefix}"
system "./b2", "--build-dir=build-#{python}", "--stagedir=stage-#{python}",
"python=#{version}", *args
end
lib.install Dir["stage-python3/lib/*py*"] if build.with?("python3")
lib.install Dir["stage-python/lib/*py*"] if build.with?("python")
end
test do
(testpath/"hello.cpp").write <<-EOS.undent
#include <boost/python.hpp>
char const* greet() {
return "Hello, world!";
}
BOOST_PYTHON_MODULE(hello)
{
boost::python::def("greet", greet);
}
EOS
Language::Python.each_python(build) do |python, _|
pyflags = (`#{python}-config --includes`.strip +
`#{python}-config --ldflags`.strip).split(" ")
system ENV.cxx, "-shared", "hello.cpp", "-lboost_#{python}", "-o", "hello.so", *pyflags
output = `#{python} -c "from __future__ import print_function; import hello; print(hello.greet())"`
assert_match "Hello, world!", output
end
end
end
|
jbaum98/linuxbrew
|
Library/Formula/boost-python.rb
|
Ruby
|
bsd-2-clause
| 4,541
|
//
// Copyright (c) 2004-2021 Jaroslaw Kowalski <jaak@jkowalski.net>, Kim Christensen, Julian Verdurmen
//
// 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 Jaroslaw Kowalski 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.
//
using System;
namespace NLog.LayoutRenderers.Wrappers
{
using System.Text;
using NLog.Common;
using NLog.Config;
using NLog.Layouts;
/// <summary>
/// Base class for <see cref="LayoutRenderer"/>s which wrapping other <see cref="LayoutRenderer"/>s.
///
/// This has the <see cref="Inner"/> property (which is default) and can be used to wrap.
/// </summary>
/// <example>
/// ${uppercase:${level}} //[DefaultParameter]
/// ${uppercase:Inner=${level}}
/// </example>
public abstract class WrapperLayoutRendererBase : LayoutRenderer
{
/// <summary>
/// Gets or sets the wrapped layout.
///
/// [DefaultParameter] so Inner: is not required if it's the first
/// </summary>
/// <docgen category='Transformation Options' order='10' />
[DefaultParameter]
public Layout Inner { get; set; }
/// <inheritdoc/>
protected override void InitializeLayoutRenderer()
{
base.InitializeLayoutRenderer();
Inner?.Initialize(LoggingConfiguration);
}
/// <summary>
/// Renders the inner message, processes it and appends it to the specified <see cref="StringBuilder" />.
/// </summary>
/// <param name="builder">The <see cref="StringBuilder"/> to append the rendered data to.</param>
/// <param name="logEvent">Logging event.</param>
protected override void Append(StringBuilder builder, LogEventInfo logEvent)
{
if (Inner == null)
{
InternalLogger.Warn("{0} has no configured Inner-Layout, so skipping", this);
return;
}
int orgLength = builder.Length;
try
{
RenderInnerAndTransform(logEvent, builder, orgLength);
}
catch
{
builder.Length = orgLength; // Rewind/Truncate on exception
throw;
}
}
/// <summary>
/// Appends the rendered output from <see cref="Inner"/>-layout and transforms the added output (when necessary)
/// </summary>
/// <param name="logEvent">Logging event.</param>
/// <param name="builder">The <see cref="StringBuilder"/> to append the rendered data to.</param>
/// <param name="orgLength">Start position for any necessary transformation of <see cref="StringBuilder"/>.</param>
protected virtual void RenderInnerAndTransform(LogEventInfo logEvent, StringBuilder builder, int orgLength)
{
string msg = RenderInner(logEvent);
builder.Append(Transform(logEvent, msg));
}
/// <summary>
/// Transforms the output of another layout.
/// </summary>
/// <param name="logEvent">Logging event.</param>
/// <param name="text">Output to be transform.</param>
/// <returns>Transformed text.</returns>
protected virtual string Transform(LogEventInfo logEvent, string text)
{
return Transform(text);
}
/// <summary>
/// Transforms the output of another layout.
/// </summary>
/// <param name="text">Output to be transform.</param>
/// <returns>Transformed text.</returns>
protected abstract string Transform(string text);
/// <summary>
/// Renders the inner layout contents.
/// </summary>
/// <param name="logEvent">The log event.</param>
/// <returns>Contents of inner layout.</returns>
protected virtual string RenderInner(LogEventInfo logEvent)
{
return Inner?.Render(logEvent) ?? string.Empty;
}
}
}
|
luigiberrettini/NLog
|
src/NLog/LayoutRenderers/Wrappers/WrapperLayoutRendererBase.cs
|
C#
|
bsd-3-clause
| 5,423
|
/*
* Copyright (c) 2007-2008, openmetaverse.org
* 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.
* - Neither the name of the openmetaverse.org 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.
*/
using System;
using System.Collections.Generic;
using System.Threading;
using OpenMetaverse;
namespace OpenMetaverse.Utilities
{
public partial class VoiceManager
{
/// <summary>Amount of time to wait for the voice daemon to respond.
/// The value needs to stay relatively high because some of the calls
/// require the voice daemon to make remote queries before replying</summary>
public int BlockingTimeout = 30 * 1000;
protected Dictionary<int, AutoResetEvent> Events = new Dictionary<int, AutoResetEvent>();
public List<string> CaptureDevices()
{
AutoResetEvent evt = new AutoResetEvent(false);
Events[_CommandCookie] = evt;
if (RequestCaptureDevices() == -1)
{
Events.Remove(_CommandCookie);
return new List<string>();
}
if (evt.WaitOne(BlockingTimeout, false))
return CurrentCaptureDevices();
else
return new List<string>();
}
public List<string> RenderDevices()
{
AutoResetEvent evt = new AutoResetEvent(false);
Events[_CommandCookie] = evt;
if (RequestRenderDevices() == -1)
{
Events.Remove(_CommandCookie);
return new List<string>();
}
if (evt.WaitOne(BlockingTimeout, false))
return CurrentRenderDevices();
else
return new List<string>();
}
public string CreateConnector(out int status)
{
status = 0;
AutoResetEvent evt = new AutoResetEvent(false);
Events[_CommandCookie] = evt;
if (RequestCreateConnector() == -1)
{
Events.Remove(_CommandCookie);
return String.Empty;
}
bool success = evt.WaitOne(BlockingTimeout, false);
status = statusCode;
if (success && statusCode == 0)
return connectorHandle;
else
return String.Empty;
}
public string Login(string accountName, string password, string connectorHandle, out int status)
{
status = 0;
AutoResetEvent evt = new AutoResetEvent(false);
Events[_CommandCookie] = evt;
if (RequestLogin(accountName, password, connectorHandle) == -1)
{
Events.Remove(_CommandCookie);
return String.Empty;
}
bool success = evt.WaitOne(BlockingTimeout, false);
status = statusCode;
if (success && statusCode == 0)
return accountHandle;
else
return String.Empty;
}
protected void RegisterCallbacks()
{
OnCaptureDevices += new DevicesCallback(VoiceManager_OnCaptureDevices);
OnRenderDevices += new DevicesCallback(VoiceManager_OnRenderDevices);
OnConnectorCreated += new ConnectorCreatedCallback(VoiceManager_OnConnectorCreated);
OnLogin += new LoginCallback(VoiceManager_OnLogin);
}
#region Callbacks
private void VoiceManager_OnCaptureDevices(int cookie, int statusCode, string statusString, string currentDevice)
{
if (Events.ContainsKey(cookie))
Events[cookie].Set();
}
private void VoiceManager_OnRenderDevices(int cookie, int statusCode, string statusString, string currentDevice)
{
if (Events.ContainsKey(cookie))
Events[cookie].Set();
}
private void VoiceManager_OnConnectorCreated(int cookie, int statusCode, string statusString, string connectorHandle)
{
if (Events.ContainsKey(cookie))
Events[cookie].Set();
}
private void VoiceManager_OnLogin(int cookie, int statusCode, string statusString, string accountHandle)
{
if (Events.ContainsKey(cookie))
Events[cookie].Set();
}
#endregion Callbacks
}
}
|
jhs/libopenmetaverse
|
OpenMetaverse.Utilities/VoiceManagerBlocking.cs
|
C#
|
bsd-3-clause
| 5,700
|
// Copyright 2015, ARM Limited
// 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 ARM Limited 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 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.
// ---------------------------------------------------------------------
// This file is auto generated using tools/generate_simulator_traces.py.
//
// PLEASE DO NOT EDIT.
// ---------------------------------------------------------------------
#ifndef VIXL_SIM_UABD_2S_TRACE_A64_H_
#define VIXL_SIM_UABD_2S_TRACE_A64_H_
const uint32_t kExpected_NEON_uabd_2S[] = {
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000100, 0x007f7e00, 0x00000000, 0x00000000,
0x007f7f00, 0x00007f00, 0x00000000, 0x00000000,
0x00007e00, 0x00007eff, 0x00000000, 0x00000000,
0x00007dff, 0x00007efe, 0x00000000, 0x00000000,
0x00007dfe, 0x00007ee0, 0x00000000, 0x00000000,
0x00007de0, 0x00007e83, 0x00000000, 0x00000000,
0x00007d83, 0x00007e82, 0x00000000, 0x00000000,
0x00007d82, 0x00007e81, 0x00000000, 0x00000000,
0x00007d81, 0x000000fd, 0x00000000, 0x00000000,
0x000001fd, 0x000000fe, 0x00000000, 0x00000000,
0x000001fe, 0x000000ff, 0x00000000, 0x00000000,
0x000001ff, 0x3332b433, 0x00000000, 0x00000000,
0x3332b533, 0x5554d655, 0x00000000, 0x00000000,
0x5554d755, 0x7fff80fd, 0x00000000, 0x00000000,
0x7fff81fd, 0x7fff80fe, 0x00000000, 0x00000000,
0x7fff81fe, 0x7fff80ff, 0x00000000, 0x00000000,
0x7fff81ff, 0x7fff8100, 0x00000000, 0x00000000,
0x7fff8200, 0x7fff8101, 0x00000000, 0x00000000,
0x7fff8201, 0xaaaa2baa, 0x00000000, 0x00000000,
0xaaaa2caa, 0xcccc4dcc, 0x00000000, 0x00000000,
0xcccc4ecc, 0xffff0100, 0x00000000, 0x00000000,
0xffff0200, 0xffff0101, 0x00000000, 0x00000000,
0xffff0201, 0xffff0102, 0x00000000, 0x00000000,
0xffff0202, 0xffff0103, 0x00000000, 0x00000000,
0xffff0203, 0xffff8080, 0x00000000, 0x00000000,
0xffff8180, 0xffff8081, 0x00000000, 0x00000000,
0xffff8181, 0xffff8082, 0x00000000, 0x00000000,
0xffff8182, 0xffff8083, 0x00000000, 0x00000000,
0xffff8183, 0xffff80e0, 0x00000000, 0x00000000,
0xffff81e0, 0xffff80fd, 0x00000000, 0x00000000,
0xffff80fd, 0xff8002fe, 0x00000000, 0x00000000,
0xffff80fe, 0xff8002ff, 0x00000000, 0x00000000,
0xffff80ff, 0x007ffd00, 0x00000000, 0x00000000,
0x00007f00, 0x007ffcff, 0x00000000, 0x00000000,
0x00007eff, 0x007ffcfe, 0x00000000, 0x00000000,
0x00007efe, 0x007ffce0, 0x00000000, 0x00000000,
0x00007ee0, 0x007ffc83, 0x00000000, 0x00000000,
0x00007e83, 0x007ffc82, 0x00000000, 0x00000000,
0x00007e82, 0x007ffc81, 0x00000000, 0x00000000,
0x00007e81, 0x007f7d03, 0x00000000, 0x00000000,
0x000000fd, 0x007f7d02, 0x00000000, 0x00000000,
0x000000fe, 0x007f7d01, 0x00000000, 0x00000000,
0x000000ff, 0x32b33633, 0x00000000, 0x00000000,
0x3332b433, 0x54d55855, 0x00000000, 0x00000000,
0x5554d655, 0x7f8002fd, 0x00000000, 0x00000000,
0x7fff80fd, 0x7f8002fe, 0x00000000, 0x00000000,
0x7fff80fe, 0x7f8002ff, 0x00000000, 0x00000000,
0x7fff80ff, 0x7f800300, 0x00000000, 0x00000000,
0x7fff8100, 0x7f800301, 0x00000000, 0x00000000,
0x7fff8101, 0xaa2aadaa, 0x00000000, 0x00000000,
0xaaaa2baa, 0xcc4ccfcc, 0x00000000, 0x00000000,
0xcccc4dcc, 0xff7f8300, 0x00000000, 0x00000000,
0xffff0100, 0xff7f8301, 0x00000000, 0x00000000,
0xffff0101, 0xff7f8302, 0x00000000, 0x00000000,
0xffff0102, 0xff7f8303, 0x00000000, 0x00000000,
0xffff0103, 0xff800280, 0x00000000, 0x00000000,
0xffff8080, 0xff800281, 0x00000000, 0x00000000,
0xffff8081, 0xff800282, 0x00000000, 0x00000000,
0xffff8082, 0xff800283, 0x00000000, 0x00000000,
0xffff8083, 0xff8002e0, 0x00000000, 0x00000000,
0xffff80e0, 0xff8002fd, 0x00000000, 0x00000000,
0xff8002fd, 0xfffffffe, 0x00000000, 0x00000000,
0xff8002fe, 0xffffffff, 0x00000000, 0x00000000,
0xff8002ff, 0x00000000, 0x00000000, 0x00000000,
0x007ffd00, 0x00000001, 0x00000000, 0x00000000,
0x007ffcff, 0x00000002, 0x00000000, 0x00000000,
0x007ffcfe, 0x00000020, 0x00000000, 0x00000000,
0x007ffce0, 0x0000007d, 0x00000000, 0x00000000,
0x007ffc83, 0x0000007e, 0x00000000, 0x00000000,
0x007ffc82, 0x0000007f, 0x00000000, 0x00000000,
0x007ffc81, 0x00007ffd, 0x00000000, 0x00000000,
0x007f7d03, 0x00007ffe, 0x00000000, 0x00000000,
0x007f7d02, 0x00007fff, 0x00000000, 0x00000000,
0x007f7d01, 0x33333333, 0x00000000, 0x00000000,
0x32b33633, 0x55555555, 0x00000000, 0x00000000,
0x54d55855, 0x7ffffffd, 0x00000000, 0x00000000,
0x7f8002fd, 0x7ffffffe, 0x00000000, 0x00000000,
0x7f8002fe, 0x7fffffff, 0x00000000, 0x00000000,
0x7f8002ff, 0x80000000, 0x00000000, 0x00000000,
0x7f800300, 0x80000001, 0x00000000, 0x00000000,
0x7f800301, 0xaaaaaaaa, 0x00000000, 0x00000000,
0xaa2aadaa, 0xcccccccc, 0x00000000, 0x00000000,
0xcc4ccfcc, 0xffff8000, 0x00000000, 0x00000000,
0xff7f8300, 0xffff8001, 0x00000000, 0x00000000,
0xff7f8301, 0xffff8002, 0x00000000, 0x00000000,
0xff7f8302, 0xffff8003, 0x00000000, 0x00000000,
0xff7f8303, 0xffffff80, 0x00000000, 0x00000000,
0xff800280, 0xffffff81, 0x00000000, 0x00000000,
0xff800281, 0xffffff82, 0x00000000, 0x00000000,
0xff800282, 0xffffff83, 0x00000000, 0x00000000,
0xff800283, 0xffffffe0, 0x00000000, 0x00000000,
0xff8002e0, 0xfffffffd, 0x00000000, 0x00000000,
0xfffffffd, 0xfffffffd, 0x00000000, 0x00000000,
0xfffffffe, 0xfffffffe, 0x00000000, 0x00000000,
0xffffffff, 0x00000001, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000001, 0x00000001, 0x00000000, 0x00000000,
0x00000002, 0x0000001f, 0x00000000, 0x00000000,
0x00000020, 0x0000007c, 0x00000000, 0x00000000,
0x0000007d, 0x0000007d, 0x00000000, 0x00000000,
0x0000007e, 0x0000007e, 0x00000000, 0x00000000,
0x0000007f, 0x00007ffc, 0x00000000, 0x00000000,
0x00007ffd, 0x00007ffd, 0x00000000, 0x00000000,
0x00007ffe, 0x00007ffe, 0x00000000, 0x00000000,
0x00007fff, 0x33333332, 0x00000000, 0x00000000,
0x33333333, 0x55555554, 0x00000000, 0x00000000,
0x55555555, 0x7ffffffc, 0x00000000, 0x00000000,
0x7ffffffd, 0x7ffffffd, 0x00000000, 0x00000000,
0x7ffffffe, 0x7ffffffe, 0x00000000, 0x00000000,
0x7fffffff, 0x7fffffff, 0x00000000, 0x00000000,
0x80000000, 0x80000000, 0x00000000, 0x00000000,
0x80000001, 0xaaaaaaa9, 0x00000000, 0x00000000,
0xaaaaaaaa, 0xcccccccb, 0x00000000, 0x00000000,
0xcccccccc, 0xffff7fff, 0x00000000, 0x00000000,
0xffff8000, 0xffff8000, 0x00000000, 0x00000000,
0xffff8001, 0xffff8001, 0x00000000, 0x00000000,
0xffff8002, 0xffff8002, 0x00000000, 0x00000000,
0xffff8003, 0xffffff7f, 0x00000000, 0x00000000,
0xffffff80, 0xffffff80, 0x00000000, 0x00000000,
0xffffff81, 0xffffff81, 0x00000000, 0x00000000,
0xffffff82, 0xffffff82, 0x00000000, 0x00000000,
0xffffff83, 0xffffffdf, 0x00000000, 0x00000000,
0xffffffe0, 0xfffffffc, 0x00000000, 0x00000000,
0xfffffffc, 0xfffffffc, 0x00000000, 0x00000000,
0xfffffffd, 0xfffffffd, 0x00000000, 0x00000000,
0xfffffffe, 0x00000002, 0x00000000, 0x00000000,
0x00000001, 0x00000001, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000001, 0x0000001e, 0x00000000, 0x00000000,
0x0000001f, 0x0000007b, 0x00000000, 0x00000000,
0x0000007c, 0x0000007c, 0x00000000, 0x00000000,
0x0000007d, 0x0000007d, 0x00000000, 0x00000000,
0x0000007e, 0x00007ffb, 0x00000000, 0x00000000,
0x00007ffc, 0x00007ffc, 0x00000000, 0x00000000,
0x00007ffd, 0x00007ffd, 0x00000000, 0x00000000,
0x00007ffe, 0x33333331, 0x00000000, 0x00000000,
0x33333332, 0x55555553, 0x00000000, 0x00000000,
0x55555554, 0x7ffffffb, 0x00000000, 0x00000000,
0x7ffffffc, 0x7ffffffc, 0x00000000, 0x00000000,
0x7ffffffd, 0x7ffffffd, 0x00000000, 0x00000000,
0x7ffffffe, 0x7ffffffe, 0x00000000, 0x00000000,
0x7fffffff, 0x7fffffff, 0x00000000, 0x00000000,
0x80000000, 0xaaaaaaa8, 0x00000000, 0x00000000,
0xaaaaaaa9, 0xccccccca, 0x00000000, 0x00000000,
0xcccccccb, 0xffff7ffe, 0x00000000, 0x00000000,
0xffff7fff, 0xffff7fff, 0x00000000, 0x00000000,
0xffff8000, 0xffff8000, 0x00000000, 0x00000000,
0xffff8001, 0xffff8001, 0x00000000, 0x00000000,
0xffff8002, 0xffffff7e, 0x00000000, 0x00000000,
0xffffff7f, 0xffffff7f, 0x00000000, 0x00000000,
0xffffff80, 0xffffff80, 0x00000000, 0x00000000,
0xffffff81, 0xffffff81, 0x00000000, 0x00000000,
0xffffff82, 0xffffffde, 0x00000000, 0x00000000,
0xffffffdf, 0xfffffffb, 0x00000000, 0x00000000,
0xfffffffb, 0xffffffde, 0x00000000, 0x00000000,
0xfffffffc, 0xffffffdf, 0x00000000, 0x00000000,
0xfffffffd, 0x00000020, 0x00000000, 0x00000000,
0x00000002, 0x0000001f, 0x00000000, 0x00000000,
0x00000001, 0x0000001e, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x0000001e, 0x0000005d, 0x00000000, 0x00000000,
0x0000007b, 0x0000005e, 0x00000000, 0x00000000,
0x0000007c, 0x0000005f, 0x00000000, 0x00000000,
0x0000007d, 0x00007fdd, 0x00000000, 0x00000000,
0x00007ffb, 0x00007fde, 0x00000000, 0x00000000,
0x00007ffc, 0x00007fdf, 0x00000000, 0x00000000,
0x00007ffd, 0x33333313, 0x00000000, 0x00000000,
0x33333331, 0x55555535, 0x00000000, 0x00000000,
0x55555553, 0x7fffffdd, 0x00000000, 0x00000000,
0x7ffffffb, 0x7fffffde, 0x00000000, 0x00000000,
0x7ffffffc, 0x7fffffdf, 0x00000000, 0x00000000,
0x7ffffffd, 0x7fffffe0, 0x00000000, 0x00000000,
0x7ffffffe, 0x7fffffe1, 0x00000000, 0x00000000,
0x7fffffff, 0xaaaaaa8a, 0x00000000, 0x00000000,
0xaaaaaaa8, 0xccccccac, 0x00000000, 0x00000000,
0xccccccca, 0xffff7fe0, 0x00000000, 0x00000000,
0xffff7ffe, 0xffff7fe1, 0x00000000, 0x00000000,
0xffff7fff, 0xffff7fe2, 0x00000000, 0x00000000,
0xffff8000, 0xffff7fe3, 0x00000000, 0x00000000,
0xffff8001, 0xffffff60, 0x00000000, 0x00000000,
0xffffff7e, 0xffffff61, 0x00000000, 0x00000000,
0xffffff7f, 0xffffff62, 0x00000000, 0x00000000,
0xffffff80, 0xffffff63, 0x00000000, 0x00000000,
0xffffff81, 0xffffffc0, 0x00000000, 0x00000000,
0xffffffde, 0xffffffdd, 0x00000000, 0x00000000,
0xffffffdd, 0xffffff81, 0x00000000, 0x00000000,
0xffffffde, 0xffffff82, 0x00000000, 0x00000000,
0xffffffdf, 0x0000007d, 0x00000000, 0x00000000,
0x00000020, 0x0000007c, 0x00000000, 0x00000000,
0x0000001f, 0x0000007b, 0x00000000, 0x00000000,
0x0000001e, 0x0000005d, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x0000005d, 0x00000001, 0x00000000, 0x00000000,
0x0000005e, 0x00000002, 0x00000000, 0x00000000,
0x0000005f, 0x00007f80, 0x00000000, 0x00000000,
0x00007fdd, 0x00007f81, 0x00000000, 0x00000000,
0x00007fde, 0x00007f82, 0x00000000, 0x00000000,
0x00007fdf, 0x333332b6, 0x00000000, 0x00000000,
0x33333313, 0x555554d8, 0x00000000, 0x00000000,
0x55555535, 0x7fffff80, 0x00000000, 0x00000000,
0x7fffffdd, 0x7fffff81, 0x00000000, 0x00000000,
0x7fffffde, 0x7fffff82, 0x00000000, 0x00000000,
0x7fffffdf, 0x7fffff83, 0x00000000, 0x00000000,
0x7fffffe0, 0x7fffff84, 0x00000000, 0x00000000,
0x7fffffe1, 0xaaaaaa2d, 0x00000000, 0x00000000,
0xaaaaaa8a, 0xcccccc4f, 0x00000000, 0x00000000,
0xccccccac, 0xffff7f83, 0x00000000, 0x00000000,
0xffff7fe0, 0xffff7f84, 0x00000000, 0x00000000,
0xffff7fe1, 0xffff7f85, 0x00000000, 0x00000000,
0xffff7fe2, 0xffff7f86, 0x00000000, 0x00000000,
0xffff7fe3, 0xffffff03, 0x00000000, 0x00000000,
0xffffff60, 0xffffff04, 0x00000000, 0x00000000,
0xffffff61, 0xffffff05, 0x00000000, 0x00000000,
0xffffff62, 0xffffff06, 0x00000000, 0x00000000,
0xffffff63, 0xffffff63, 0x00000000, 0x00000000,
0xffffffc0, 0xffffff80, 0x00000000, 0x00000000,
0xffffff80, 0xffffff80, 0x00000000, 0x00000000,
0xffffff81, 0xffffff81, 0x00000000, 0x00000000,
0xffffff82, 0x0000007e, 0x00000000, 0x00000000,
0x0000007d, 0x0000007d, 0x00000000, 0x00000000,
0x0000007c, 0x0000007c, 0x00000000, 0x00000000,
0x0000007b, 0x0000005e, 0x00000000, 0x00000000,
0x0000005d, 0x00000001, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000001, 0x00000001, 0x00000000, 0x00000000,
0x00000002, 0x00007f7f, 0x00000000, 0x00000000,
0x00007f80, 0x00007f80, 0x00000000, 0x00000000,
0x00007f81, 0x00007f81, 0x00000000, 0x00000000,
0x00007f82, 0x333332b5, 0x00000000, 0x00000000,
0x333332b6, 0x555554d7, 0x00000000, 0x00000000,
0x555554d8, 0x7fffff7f, 0x00000000, 0x00000000,
0x7fffff80, 0x7fffff80, 0x00000000, 0x00000000,
0x7fffff81, 0x7fffff81, 0x00000000, 0x00000000,
0x7fffff82, 0x7fffff82, 0x00000000, 0x00000000,
0x7fffff83, 0x7fffff83, 0x00000000, 0x00000000,
0x7fffff84, 0xaaaaaa2c, 0x00000000, 0x00000000,
0xaaaaaa2d, 0xcccccc4e, 0x00000000, 0x00000000,
0xcccccc4f, 0xffff7f82, 0x00000000, 0x00000000,
0xffff7f83, 0xffff7f83, 0x00000000, 0x00000000,
0xffff7f84, 0xffff7f84, 0x00000000, 0x00000000,
0xffff7f85, 0xffff7f85, 0x00000000, 0x00000000,
0xffff7f86, 0xffffff02, 0x00000000, 0x00000000,
0xffffff03, 0xffffff03, 0x00000000, 0x00000000,
0xffffff04, 0xffffff04, 0x00000000, 0x00000000,
0xffffff05, 0xffffff05, 0x00000000, 0x00000000,
0xffffff06, 0xffffff62, 0x00000000, 0x00000000,
0xffffff63, 0xffffff7f, 0x00000000, 0x00000000,
0xffffff7f, 0xffffff7f, 0x00000000, 0x00000000,
0xffffff80, 0xffffff80, 0x00000000, 0x00000000,
0xffffff81, 0x0000007f, 0x00000000, 0x00000000,
0x0000007e, 0x0000007e, 0x00000000, 0x00000000,
0x0000007d, 0x0000007d, 0x00000000, 0x00000000,
0x0000007c, 0x0000005f, 0x00000000, 0x00000000,
0x0000005e, 0x00000002, 0x00000000, 0x00000000,
0x00000001, 0x00000001, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000001, 0x00007f7e, 0x00000000, 0x00000000,
0x00007f7f, 0x00007f7f, 0x00000000, 0x00000000,
0x00007f80, 0x00007f80, 0x00000000, 0x00000000,
0x00007f81, 0x333332b4, 0x00000000, 0x00000000,
0x333332b5, 0x555554d6, 0x00000000, 0x00000000,
0x555554d7, 0x7fffff7e, 0x00000000, 0x00000000,
0x7fffff7f, 0x7fffff7f, 0x00000000, 0x00000000,
0x7fffff80, 0x7fffff80, 0x00000000, 0x00000000,
0x7fffff81, 0x7fffff81, 0x00000000, 0x00000000,
0x7fffff82, 0x7fffff82, 0x00000000, 0x00000000,
0x7fffff83, 0xaaaaaa2b, 0x00000000, 0x00000000,
0xaaaaaa2c, 0xcccccc4d, 0x00000000, 0x00000000,
0xcccccc4e, 0xffff7f81, 0x00000000, 0x00000000,
0xffff7f82, 0xffff7f82, 0x00000000, 0x00000000,
0xffff7f83, 0xffff7f83, 0x00000000, 0x00000000,
0xffff7f84, 0xffff7f84, 0x00000000, 0x00000000,
0xffff7f85, 0xffffff01, 0x00000000, 0x00000000,
0xffffff02, 0xffffff02, 0x00000000, 0x00000000,
0xffffff03, 0xffffff03, 0x00000000, 0x00000000,
0xffffff04, 0xffffff04, 0x00000000, 0x00000000,
0xffffff05, 0xffffff61, 0x00000000, 0x00000000,
0xffffff62, 0xffffff7e, 0x00000000, 0x00000000,
0xffffff7e, 0xffff8001, 0x00000000, 0x00000000,
0xffffff7f, 0xffff8002, 0x00000000, 0x00000000,
0xffffff80, 0x00007ffd, 0x00000000, 0x00000000,
0x0000007f, 0x00007ffc, 0x00000000, 0x00000000,
0x0000007e, 0x00007ffb, 0x00000000, 0x00000000,
0x0000007d, 0x00007fdd, 0x00000000, 0x00000000,
0x0000005f, 0x00007f80, 0x00000000, 0x00000000,
0x00000002, 0x00007f7f, 0x00000000, 0x00000000,
0x00000001, 0x00007f7e, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00007f7e, 0x00000001, 0x00000000, 0x00000000,
0x00007f7f, 0x00000002, 0x00000000, 0x00000000,
0x00007f80, 0x3332b336, 0x00000000, 0x00000000,
0x333332b4, 0x5554d558, 0x00000000, 0x00000000,
0x555554d6, 0x7fff8000, 0x00000000, 0x00000000,
0x7fffff7e, 0x7fff8001, 0x00000000, 0x00000000,
0x7fffff7f, 0x7fff8002, 0x00000000, 0x00000000,
0x7fffff80, 0x7fff8003, 0x00000000, 0x00000000,
0x7fffff81, 0x7fff8004, 0x00000000, 0x00000000,
0x7fffff82, 0xaaaa2aad, 0x00000000, 0x00000000,
0xaaaaaa2b, 0xcccc4ccf, 0x00000000, 0x00000000,
0xcccccc4d, 0xffff0003, 0x00000000, 0x00000000,
0xffff7f81, 0xffff0004, 0x00000000, 0x00000000,
0xffff7f82, 0xffff0005, 0x00000000, 0x00000000,
0xffff7f83, 0xffff0006, 0x00000000, 0x00000000,
0xffff7f84, 0xffff7f83, 0x00000000, 0x00000000,
0xffffff01, 0xffff7f84, 0x00000000, 0x00000000,
0xffffff02, 0xffff7f85, 0x00000000, 0x00000000,
0xffffff03, 0xffff7f86, 0x00000000, 0x00000000,
0xffffff04, 0xffff7fe3, 0x00000000, 0x00000000,
0xffffff61, 0xffff8000, 0x00000000, 0x00000000,
0xffff8000, 0xffff8000, 0x00000000, 0x00000000,
0xffff8001, 0xffff8001, 0x00000000, 0x00000000,
0xffff8002, 0x00007ffe, 0x00000000, 0x00000000,
0x00007ffd, 0x00007ffd, 0x00000000, 0x00000000,
0x00007ffc, 0x00007ffc, 0x00000000, 0x00000000,
0x00007ffb, 0x00007fde, 0x00000000, 0x00000000,
0x00007fdd, 0x00007f81, 0x00000000, 0x00000000,
0x00007f80, 0x00007f80, 0x00000000, 0x00000000,
0x00007f7f, 0x00007f7f, 0x00000000, 0x00000000,
0x00007f7e, 0x00000001, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000001, 0x00000001, 0x00000000, 0x00000000,
0x00000002, 0x3332b335, 0x00000000, 0x00000000,
0x3332b336, 0x5554d557, 0x00000000, 0x00000000,
0x5554d558, 0x7fff7fff, 0x00000000, 0x00000000,
0x7fff8000, 0x7fff8000, 0x00000000, 0x00000000,
0x7fff8001, 0x7fff8001, 0x00000000, 0x00000000,
0x7fff8002, 0x7fff8002, 0x00000000, 0x00000000,
0x7fff8003, 0x7fff8003, 0x00000000, 0x00000000,
0x7fff8004, 0xaaaa2aac, 0x00000000, 0x00000000,
0xaaaa2aad, 0xcccc4cce, 0x00000000, 0x00000000,
0xcccc4ccf, 0xffff0002, 0x00000000, 0x00000000,
0xffff0003, 0xffff0003, 0x00000000, 0x00000000,
0xffff0004, 0xffff0004, 0x00000000, 0x00000000,
0xffff0005, 0xffff0005, 0x00000000, 0x00000000,
0xffff0006, 0xffff7f82, 0x00000000, 0x00000000,
0xffff7f83, 0xffff7f83, 0x00000000, 0x00000000,
0xffff7f84, 0xffff7f84, 0x00000000, 0x00000000,
0xffff7f85, 0xffff7f85, 0x00000000, 0x00000000,
0xffff7f86, 0xffff7fe2, 0x00000000, 0x00000000,
0xffff7fe3, 0xffff7fff, 0x00000000, 0x00000000,
0xffff7fff, 0xffff7fff, 0x00000000, 0x00000000,
0xffff8000, 0xffff8000, 0x00000000, 0x00000000,
0xffff8001, 0x00007fff, 0x00000000, 0x00000000,
0x00007ffe, 0x00007ffe, 0x00000000, 0x00000000,
0x00007ffd, 0x00007ffd, 0x00000000, 0x00000000,
0x00007ffc, 0x00007fdf, 0x00000000, 0x00000000,
0x00007fde, 0x00007f82, 0x00000000, 0x00000000,
0x00007f81, 0x00007f81, 0x00000000, 0x00000000,
0x00007f80, 0x00007f80, 0x00000000, 0x00000000,
0x00007f7f, 0x00000002, 0x00000000, 0x00000000,
0x00000001, 0x00000001, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000001, 0x3332b334, 0x00000000, 0x00000000,
0x3332b335, 0x5554d556, 0x00000000, 0x00000000,
0x5554d557, 0x7fff7ffe, 0x00000000, 0x00000000,
0x7fff7fff, 0x7fff7fff, 0x00000000, 0x00000000,
0x7fff8000, 0x7fff8000, 0x00000000, 0x00000000,
0x7fff8001, 0x7fff8001, 0x00000000, 0x00000000,
0x7fff8002, 0x7fff8002, 0x00000000, 0x00000000,
0x7fff8003, 0xaaaa2aab, 0x00000000, 0x00000000,
0xaaaa2aac, 0xcccc4ccd, 0x00000000, 0x00000000,
0xcccc4cce, 0xffff0001, 0x00000000, 0x00000000,
0xffff0002, 0xffff0002, 0x00000000, 0x00000000,
0xffff0003, 0xffff0003, 0x00000000, 0x00000000,
0xffff0004, 0xffff0004, 0x00000000, 0x00000000,
0xffff0005, 0xffff7f81, 0x00000000, 0x00000000,
0xffff7f82, 0xffff7f82, 0x00000000, 0x00000000,
0xffff7f83, 0xffff7f83, 0x00000000, 0x00000000,
0xffff7f84, 0xffff7f84, 0x00000000, 0x00000000,
0xffff7f85, 0xffff7fe1, 0x00000000, 0x00000000,
0xffff7fe2, 0xffff7ffe, 0x00000000, 0x00000000,
0xffff7ffe, 0xcccccccb, 0x00000000, 0x00000000,
0xffff7fff, 0xcccccccc, 0x00000000, 0x00000000,
0xffff8000, 0x33333333, 0x00000000, 0x00000000,
0x00007fff, 0x33333332, 0x00000000, 0x00000000,
0x00007ffe, 0x33333331, 0x00000000, 0x00000000,
0x00007ffd, 0x33333313, 0x00000000, 0x00000000,
0x00007fdf, 0x333332b6, 0x00000000, 0x00000000,
0x00007f82, 0x333332b5, 0x00000000, 0x00000000,
0x00007f81, 0x333332b4, 0x00000000, 0x00000000,
0x00007f80, 0x3332b336, 0x00000000, 0x00000000,
0x00000002, 0x3332b335, 0x00000000, 0x00000000,
0x00000001, 0x3332b334, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x3332b334, 0x22222222, 0x00000000, 0x00000000,
0x5554d556, 0x4cccccca, 0x00000000, 0x00000000,
0x7fff7ffe, 0x4ccccccb, 0x00000000, 0x00000000,
0x7fff7fff, 0x4ccccccc, 0x00000000, 0x00000000,
0x7fff8000, 0x4ccccccd, 0x00000000, 0x00000000,
0x7fff8001, 0x4cccccce, 0x00000000, 0x00000000,
0x7fff8002, 0x77777777, 0x00000000, 0x00000000,
0xaaaa2aab, 0x99999999, 0x00000000, 0x00000000,
0xcccc4ccd, 0xcccc4ccd, 0x00000000, 0x00000000,
0xffff0001, 0xcccc4cce, 0x00000000, 0x00000000,
0xffff0002, 0xcccc4ccf, 0x00000000, 0x00000000,
0xffff0003, 0xcccc4cd0, 0x00000000, 0x00000000,
0xffff0004, 0xcccccc4d, 0x00000000, 0x00000000,
0xffff7f81, 0xcccccc4e, 0x00000000, 0x00000000,
0xffff7f82, 0xcccccc4f, 0x00000000, 0x00000000,
0xffff7f83, 0xcccccc50, 0x00000000, 0x00000000,
0xffff7f84, 0xccccccad, 0x00000000, 0x00000000,
0xffff7fe1, 0xccccccca, 0x00000000, 0x00000000,
0xccccccca, 0xaaaaaaa9, 0x00000000, 0x00000000,
0xcccccccb, 0xaaaaaaaa, 0x00000000, 0x00000000,
0xcccccccc, 0x55555555, 0x00000000, 0x00000000,
0x33333333, 0x55555554, 0x00000000, 0x00000000,
0x33333332, 0x55555553, 0x00000000, 0x00000000,
0x33333331, 0x55555535, 0x00000000, 0x00000000,
0x33333313, 0x555554d8, 0x00000000, 0x00000000,
0x333332b6, 0x555554d7, 0x00000000, 0x00000000,
0x333332b5, 0x555554d6, 0x00000000, 0x00000000,
0x333332b4, 0x5554d558, 0x00000000, 0x00000000,
0x3332b336, 0x5554d557, 0x00000000, 0x00000000,
0x3332b335, 0x5554d556, 0x00000000, 0x00000000,
0x3332b334, 0x22222222, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x22222222, 0x2aaaaaa8, 0x00000000, 0x00000000,
0x4cccccca, 0x2aaaaaa9, 0x00000000, 0x00000000,
0x4ccccccb, 0x2aaaaaaa, 0x00000000, 0x00000000,
0x4ccccccc, 0x2aaaaaab, 0x00000000, 0x00000000,
0x4ccccccd, 0x2aaaaaac, 0x00000000, 0x00000000,
0x4cccccce, 0x55555555, 0x00000000, 0x00000000,
0x77777777, 0x77777777, 0x00000000, 0x00000000,
0x99999999, 0xaaaa2aab, 0x00000000, 0x00000000,
0xcccc4ccd, 0xaaaa2aac, 0x00000000, 0x00000000,
0xcccc4cce, 0xaaaa2aad, 0x00000000, 0x00000000,
0xcccc4ccf, 0xaaaa2aae, 0x00000000, 0x00000000,
0xcccc4cd0, 0xaaaaaa2b, 0x00000000, 0x00000000,
0xcccccc4d, 0xaaaaaa2c, 0x00000000, 0x00000000,
0xcccccc4e, 0xaaaaaa2d, 0x00000000, 0x00000000,
0xcccccc4f, 0xaaaaaa2e, 0x00000000, 0x00000000,
0xcccccc50, 0xaaaaaa8b, 0x00000000, 0x00000000,
0xccccccad, 0xaaaaaaa8, 0x00000000, 0x00000000,
0xaaaaaaa8, 0x80000001, 0x00000000, 0x00000000,
0xaaaaaaa9, 0x80000002, 0x00000000, 0x00000000,
0xaaaaaaaa, 0x7ffffffd, 0x00000000, 0x00000000,
0x55555555, 0x7ffffffc, 0x00000000, 0x00000000,
0x55555554, 0x7ffffffb, 0x00000000, 0x00000000,
0x55555553, 0x7fffffdd, 0x00000000, 0x00000000,
0x55555535, 0x7fffff80, 0x00000000, 0x00000000,
0x555554d8, 0x7fffff7f, 0x00000000, 0x00000000,
0x555554d7, 0x7fffff7e, 0x00000000, 0x00000000,
0x555554d6, 0x7fff8000, 0x00000000, 0x00000000,
0x5554d558, 0x7fff7fff, 0x00000000, 0x00000000,
0x5554d557, 0x7fff7ffe, 0x00000000, 0x00000000,
0x5554d556, 0x4cccccca, 0x00000000, 0x00000000,
0x22222222, 0x2aaaaaa8, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x2aaaaaa8, 0x00000001, 0x00000000, 0x00000000,
0x2aaaaaa9, 0x00000002, 0x00000000, 0x00000000,
0x2aaaaaaa, 0x00000003, 0x00000000, 0x00000000,
0x2aaaaaab, 0x00000004, 0x00000000, 0x00000000,
0x2aaaaaac, 0x2aaaaaad, 0x00000000, 0x00000000,
0x55555555, 0x4ccccccf, 0x00000000, 0x00000000,
0x77777777, 0x7fff8003, 0x00000000, 0x00000000,
0xaaaa2aab, 0x7fff8004, 0x00000000, 0x00000000,
0xaaaa2aac, 0x7fff8005, 0x00000000, 0x00000000,
0xaaaa2aad, 0x7fff8006, 0x00000000, 0x00000000,
0xaaaa2aae, 0x7fffff83, 0x00000000, 0x00000000,
0xaaaaaa2b, 0x7fffff84, 0x00000000, 0x00000000,
0xaaaaaa2c, 0x7fffff85, 0x00000000, 0x00000000,
0xaaaaaa2d, 0x7fffff86, 0x00000000, 0x00000000,
0xaaaaaa2e, 0x7fffffe3, 0x00000000, 0x00000000,
0xaaaaaa8b, 0x80000000, 0x00000000, 0x00000000,
0x80000000, 0x80000000, 0x00000000, 0x00000000,
0x80000001, 0x80000001, 0x00000000, 0x00000000,
0x80000002, 0x7ffffffe, 0x00000000, 0x00000000,
0x7ffffffd, 0x7ffffffd, 0x00000000, 0x00000000,
0x7ffffffc, 0x7ffffffc, 0x00000000, 0x00000000,
0x7ffffffb, 0x7fffffde, 0x00000000, 0x00000000,
0x7fffffdd, 0x7fffff81, 0x00000000, 0x00000000,
0x7fffff80, 0x7fffff80, 0x00000000, 0x00000000,
0x7fffff7f, 0x7fffff7f, 0x00000000, 0x00000000,
0x7fffff7e, 0x7fff8001, 0x00000000, 0x00000000,
0x7fff8000, 0x7fff8000, 0x00000000, 0x00000000,
0x7fff7fff, 0x7fff7fff, 0x00000000, 0x00000000,
0x7fff7ffe, 0x4ccccccb, 0x00000000, 0x00000000,
0x4cccccca, 0x2aaaaaa9, 0x00000000, 0x00000000,
0x2aaaaaa8, 0x00000001, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000001, 0x00000001, 0x00000000, 0x00000000,
0x00000002, 0x00000002, 0x00000000, 0x00000000,
0x00000003, 0x00000003, 0x00000000, 0x00000000,
0x00000004, 0x2aaaaaac, 0x00000000, 0x00000000,
0x2aaaaaad, 0x4cccccce, 0x00000000, 0x00000000,
0x4ccccccf, 0x7fff8002, 0x00000000, 0x00000000,
0x7fff8003, 0x7fff8003, 0x00000000, 0x00000000,
0x7fff8004, 0x7fff8004, 0x00000000, 0x00000000,
0x7fff8005, 0x7fff8005, 0x00000000, 0x00000000,
0x7fff8006, 0x7fffff82, 0x00000000, 0x00000000,
0x7fffff83, 0x7fffff83, 0x00000000, 0x00000000,
0x7fffff84, 0x7fffff84, 0x00000000, 0x00000000,
0x7fffff85, 0x7fffff85, 0x00000000, 0x00000000,
0x7fffff86, 0x7fffffe2, 0x00000000, 0x00000000,
0x7fffffe3, 0x7fffffff, 0x00000000, 0x00000000,
0x7fffffff, 0x7fffffff, 0x00000000, 0x00000000,
0x80000000, 0x80000000, 0x00000000, 0x00000000,
0x80000001, 0x7fffffff, 0x00000000, 0x00000000,
0x7ffffffe, 0x7ffffffe, 0x00000000, 0x00000000,
0x7ffffffd, 0x7ffffffd, 0x00000000, 0x00000000,
0x7ffffffc, 0x7fffffdf, 0x00000000, 0x00000000,
0x7fffffde, 0x7fffff82, 0x00000000, 0x00000000,
0x7fffff81, 0x7fffff81, 0x00000000, 0x00000000,
0x7fffff80, 0x7fffff80, 0x00000000, 0x00000000,
0x7fffff7f, 0x7fff8002, 0x00000000, 0x00000000,
0x7fff8001, 0x7fff8001, 0x00000000, 0x00000000,
0x7fff8000, 0x7fff8000, 0x00000000, 0x00000000,
0x7fff7fff, 0x4ccccccc, 0x00000000, 0x00000000,
0x4ccccccb, 0x2aaaaaaa, 0x00000000, 0x00000000,
0x2aaaaaa9, 0x00000002, 0x00000000, 0x00000000,
0x00000001, 0x00000001, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000001, 0x00000001, 0x00000000, 0x00000000,
0x00000002, 0x00000002, 0x00000000, 0x00000000,
0x00000003, 0x2aaaaaab, 0x00000000, 0x00000000,
0x2aaaaaac, 0x4ccccccd, 0x00000000, 0x00000000,
0x4cccccce, 0x7fff8001, 0x00000000, 0x00000000,
0x7fff8002, 0x7fff8002, 0x00000000, 0x00000000,
0x7fff8003, 0x7fff8003, 0x00000000, 0x00000000,
0x7fff8004, 0x7fff8004, 0x00000000, 0x00000000,
0x7fff8005, 0x7fffff81, 0x00000000, 0x00000000,
0x7fffff82, 0x7fffff82, 0x00000000, 0x00000000,
0x7fffff83, 0x7fffff83, 0x00000000, 0x00000000,
0x7fffff84, 0x7fffff84, 0x00000000, 0x00000000,
0x7fffff85, 0x7fffffe1, 0x00000000, 0x00000000,
0x7fffffe2, 0x7ffffffe, 0x00000000, 0x00000000,
0x7ffffffe, 0x7ffffffe, 0x00000000, 0x00000000,
0x7fffffff, 0x7fffffff, 0x00000000, 0x00000000,
0x80000000, 0x80000000, 0x00000000, 0x00000000,
0x7fffffff, 0x7fffffff, 0x00000000, 0x00000000,
0x7ffffffe, 0x7ffffffe, 0x00000000, 0x00000000,
0x7ffffffd, 0x7fffffe0, 0x00000000, 0x00000000,
0x7fffffdf, 0x7fffff83, 0x00000000, 0x00000000,
0x7fffff82, 0x7fffff82, 0x00000000, 0x00000000,
0x7fffff81, 0x7fffff81, 0x00000000, 0x00000000,
0x7fffff80, 0x7fff8003, 0x00000000, 0x00000000,
0x7fff8002, 0x7fff8002, 0x00000000, 0x00000000,
0x7fff8001, 0x7fff8001, 0x00000000, 0x00000000,
0x7fff8000, 0x4ccccccd, 0x00000000, 0x00000000,
0x4ccccccc, 0x2aaaaaab, 0x00000000, 0x00000000,
0x2aaaaaaa, 0x00000003, 0x00000000, 0x00000000,
0x00000002, 0x00000002, 0x00000000, 0x00000000,
0x00000001, 0x00000001, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000001, 0x00000001, 0x00000000, 0x00000000,
0x00000002, 0x2aaaaaaa, 0x00000000, 0x00000000,
0x2aaaaaab, 0x4ccccccc, 0x00000000, 0x00000000,
0x4ccccccd, 0x7fff8000, 0x00000000, 0x00000000,
0x7fff8001, 0x7fff8001, 0x00000000, 0x00000000,
0x7fff8002, 0x7fff8002, 0x00000000, 0x00000000,
0x7fff8003, 0x7fff8003, 0x00000000, 0x00000000,
0x7fff8004, 0x7fffff80, 0x00000000, 0x00000000,
0x7fffff81, 0x7fffff81, 0x00000000, 0x00000000,
0x7fffff82, 0x7fffff82, 0x00000000, 0x00000000,
0x7fffff83, 0x7fffff83, 0x00000000, 0x00000000,
0x7fffff84, 0x7fffffe0, 0x00000000, 0x00000000,
0x7fffffe1, 0x7ffffffd, 0x00000000, 0x00000000,
0x7ffffffd, 0x7ffffffd, 0x00000000, 0x00000000,
0x7ffffffe, 0x7ffffffe, 0x00000000, 0x00000000,
0x7fffffff, 0x80000001, 0x00000000, 0x00000000,
0x80000000, 0x80000000, 0x00000000, 0x00000000,
0x7fffffff, 0x7fffffff, 0x00000000, 0x00000000,
0x7ffffffe, 0x7fffffe1, 0x00000000, 0x00000000,
0x7fffffe0, 0x7fffff84, 0x00000000, 0x00000000,
0x7fffff83, 0x7fffff83, 0x00000000, 0x00000000,
0x7fffff82, 0x7fffff82, 0x00000000, 0x00000000,
0x7fffff81, 0x7fff8004, 0x00000000, 0x00000000,
0x7fff8003, 0x7fff8003, 0x00000000, 0x00000000,
0x7fff8002, 0x7fff8002, 0x00000000, 0x00000000,
0x7fff8001, 0x4cccccce, 0x00000000, 0x00000000,
0x4ccccccd, 0x2aaaaaac, 0x00000000, 0x00000000,
0x2aaaaaab, 0x00000004, 0x00000000, 0x00000000,
0x00000003, 0x00000003, 0x00000000, 0x00000000,
0x00000002, 0x00000002, 0x00000000, 0x00000000,
0x00000001, 0x00000001, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000001, 0x2aaaaaa9, 0x00000000, 0x00000000,
0x2aaaaaaa, 0x4ccccccb, 0x00000000, 0x00000000,
0x4ccccccc, 0x7fff7fff, 0x00000000, 0x00000000,
0x7fff8000, 0x7fff8000, 0x00000000, 0x00000000,
0x7fff8001, 0x7fff8001, 0x00000000, 0x00000000,
0x7fff8002, 0x7fff8002, 0x00000000, 0x00000000,
0x7fff8003, 0x7fffff7f, 0x00000000, 0x00000000,
0x7fffff80, 0x7fffff80, 0x00000000, 0x00000000,
0x7fffff81, 0x7fffff81, 0x00000000, 0x00000000,
0x7fffff82, 0x7fffff82, 0x00000000, 0x00000000,
0x7fffff83, 0x7fffffdf, 0x00000000, 0x00000000,
0x7fffffe0, 0x7ffffffc, 0x00000000, 0x00000000,
0x7ffffffc, 0x55555554, 0x00000000, 0x00000000,
0x7ffffffd, 0x55555555, 0x00000000, 0x00000000,
0x7ffffffe, 0xaaaaaaaa, 0x00000000, 0x00000000,
0x80000001, 0xaaaaaaa9, 0x00000000, 0x00000000,
0x80000000, 0xaaaaaaa8, 0x00000000, 0x00000000,
0x7fffffff, 0xaaaaaa8a, 0x00000000, 0x00000000,
0x7fffffe1, 0xaaaaaa2d, 0x00000000, 0x00000000,
0x7fffff84, 0xaaaaaa2c, 0x00000000, 0x00000000,
0x7fffff83, 0xaaaaaa2b, 0x00000000, 0x00000000,
0x7fffff82, 0xaaaa2aad, 0x00000000, 0x00000000,
0x7fff8004, 0xaaaa2aac, 0x00000000, 0x00000000,
0x7fff8003, 0xaaaa2aab, 0x00000000, 0x00000000,
0x7fff8002, 0x77777777, 0x00000000, 0x00000000,
0x4cccccce, 0x55555555, 0x00000000, 0x00000000,
0x2aaaaaac, 0x2aaaaaad, 0x00000000, 0x00000000,
0x00000004, 0x2aaaaaac, 0x00000000, 0x00000000,
0x00000003, 0x2aaaaaab, 0x00000000, 0x00000000,
0x00000002, 0x2aaaaaaa, 0x00000000, 0x00000000,
0x00000001, 0x2aaaaaa9, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x2aaaaaa9, 0x22222222, 0x00000000, 0x00000000,
0x4ccccccb, 0x5554d556, 0x00000000, 0x00000000,
0x7fff7fff, 0x5554d557, 0x00000000, 0x00000000,
0x7fff8000, 0x5554d558, 0x00000000, 0x00000000,
0x7fff8001, 0x5554d559, 0x00000000, 0x00000000,
0x7fff8002, 0x555554d6, 0x00000000, 0x00000000,
0x7fffff7f, 0x555554d7, 0x00000000, 0x00000000,
0x7fffff80, 0x555554d8, 0x00000000, 0x00000000,
0x7fffff81, 0x555554d9, 0x00000000, 0x00000000,
0x7fffff82, 0x55555536, 0x00000000, 0x00000000,
0x7fffffdf, 0x55555553, 0x00000000, 0x00000000,
0x55555553, 0x33333332, 0x00000000, 0x00000000,
0x55555554, 0x33333333, 0x00000000, 0x00000000,
0x55555555, 0xcccccccc, 0x00000000, 0x00000000,
0xaaaaaaaa, 0xcccccccb, 0x00000000, 0x00000000,
0xaaaaaaa9, 0xccccccca, 0x00000000, 0x00000000,
0xaaaaaaa8, 0xccccccac, 0x00000000, 0x00000000,
0xaaaaaa8a, 0xcccccc4f, 0x00000000, 0x00000000,
0xaaaaaa2d, 0xcccccc4e, 0x00000000, 0x00000000,
0xaaaaaa2c, 0xcccccc4d, 0x00000000, 0x00000000,
0xaaaaaa2b, 0xcccc4ccf, 0x00000000, 0x00000000,
0xaaaa2aad, 0xcccc4cce, 0x00000000, 0x00000000,
0xaaaa2aac, 0xcccc4ccd, 0x00000000, 0x00000000,
0xaaaa2aab, 0x99999999, 0x00000000, 0x00000000,
0x77777777, 0x77777777, 0x00000000, 0x00000000,
0x55555555, 0x4ccccccf, 0x00000000, 0x00000000,
0x2aaaaaad, 0x4cccccce, 0x00000000, 0x00000000,
0x2aaaaaac, 0x4ccccccd, 0x00000000, 0x00000000,
0x2aaaaaab, 0x4ccccccc, 0x00000000, 0x00000000,
0x2aaaaaaa, 0x4ccccccb, 0x00000000, 0x00000000,
0x2aaaaaa9, 0x22222222, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x22222222, 0x3332b334, 0x00000000, 0x00000000,
0x5554d556, 0x3332b335, 0x00000000, 0x00000000,
0x5554d557, 0x3332b336, 0x00000000, 0x00000000,
0x5554d558, 0x3332b337, 0x00000000, 0x00000000,
0x5554d559, 0x333332b4, 0x00000000, 0x00000000,
0x555554d6, 0x333332b5, 0x00000000, 0x00000000,
0x555554d7, 0x333332b6, 0x00000000, 0x00000000,
0x555554d8, 0x333332b7, 0x00000000, 0x00000000,
0x555554d9, 0x33333314, 0x00000000, 0x00000000,
0x55555536, 0x33333331, 0x00000000, 0x00000000,
0x33333331, 0x00007ffe, 0x00000000, 0x00000000,
0x33333332, 0x00007fff, 0x00000000, 0x00000000,
0x33333333, 0xffff8000, 0x00000000, 0x00000000,
0xcccccccc, 0xffff7fff, 0x00000000, 0x00000000,
0xcccccccb, 0xffff7ffe, 0x00000000, 0x00000000,
0xccccccca, 0xffff7fe0, 0x00000000, 0x00000000,
0xccccccac, 0xffff7f83, 0x00000000, 0x00000000,
0xcccccc4f, 0xffff7f82, 0x00000000, 0x00000000,
0xcccccc4e, 0xffff7f81, 0x00000000, 0x00000000,
0xcccccc4d, 0xffff0003, 0x00000000, 0x00000000,
0xcccc4ccf, 0xffff0002, 0x00000000, 0x00000000,
0xcccc4cce, 0xffff0001, 0x00000000, 0x00000000,
0xcccc4ccd, 0xcccc4ccd, 0x00000000, 0x00000000,
0x99999999, 0xaaaa2aab, 0x00000000, 0x00000000,
0x77777777, 0x7fff8003, 0x00000000, 0x00000000,
0x4ccccccf, 0x7fff8002, 0x00000000, 0x00000000,
0x4cccccce, 0x7fff8001, 0x00000000, 0x00000000,
0x4ccccccd, 0x7fff8000, 0x00000000, 0x00000000,
0x4ccccccc, 0x7fff7fff, 0x00000000, 0x00000000,
0x4ccccccb, 0x5554d556, 0x00000000, 0x00000000,
0x22222222, 0x3332b334, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x3332b334, 0x00000001, 0x00000000, 0x00000000,
0x3332b335, 0x00000002, 0x00000000, 0x00000000,
0x3332b336, 0x00000003, 0x00000000, 0x00000000,
0x3332b337, 0x00007f80, 0x00000000, 0x00000000,
0x333332b4, 0x00007f81, 0x00000000, 0x00000000,
0x333332b5, 0x00007f82, 0x00000000, 0x00000000,
0x333332b6, 0x00007f83, 0x00000000, 0x00000000,
0x333332b7, 0x00007fe0, 0x00000000, 0x00000000,
0x33333314, 0x00007ffd, 0x00000000, 0x00000000,
0x00007ffd, 0x00007ffd, 0x00000000, 0x00000000,
0x00007ffe, 0x00007ffe, 0x00000000, 0x00000000,
0x00007fff, 0xffff8001, 0x00000000, 0x00000000,
0xffff8000, 0xffff8000, 0x00000000, 0x00000000,
0xffff7fff, 0xffff7fff, 0x00000000, 0x00000000,
0xffff7ffe, 0xffff7fe1, 0x00000000, 0x00000000,
0xffff7fe0, 0xffff7f84, 0x00000000, 0x00000000,
0xffff7f83, 0xffff7f83, 0x00000000, 0x00000000,
0xffff7f82, 0xffff7f82, 0x00000000, 0x00000000,
0xffff7f81, 0xffff0004, 0x00000000, 0x00000000,
0xffff0003, 0xffff0003, 0x00000000, 0x00000000,
0xffff0002, 0xffff0002, 0x00000000, 0x00000000,
0xffff0001, 0xcccc4cce, 0x00000000, 0x00000000,
0xcccc4ccd, 0xaaaa2aac, 0x00000000, 0x00000000,
0xaaaa2aab, 0x7fff8004, 0x00000000, 0x00000000,
0x7fff8003, 0x7fff8003, 0x00000000, 0x00000000,
0x7fff8002, 0x7fff8002, 0x00000000, 0x00000000,
0x7fff8001, 0x7fff8001, 0x00000000, 0x00000000,
0x7fff8000, 0x7fff8000, 0x00000000, 0x00000000,
0x7fff7fff, 0x5554d557, 0x00000000, 0x00000000,
0x5554d556, 0x3332b335, 0x00000000, 0x00000000,
0x3332b334, 0x00000001, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000001, 0x00000001, 0x00000000, 0x00000000,
0x00000002, 0x00000002, 0x00000000, 0x00000000,
0x00000003, 0x00007f7f, 0x00000000, 0x00000000,
0x00007f80, 0x00007f80, 0x00000000, 0x00000000,
0x00007f81, 0x00007f81, 0x00000000, 0x00000000,
0x00007f82, 0x00007f82, 0x00000000, 0x00000000,
0x00007f83, 0x00007fdf, 0x00000000, 0x00000000,
0x00007fe0, 0x00007ffc, 0x00000000, 0x00000000,
0x00007ffc, 0x00007ffc, 0x00000000, 0x00000000,
0x00007ffd, 0x00007ffd, 0x00000000, 0x00000000,
0x00007ffe, 0xffff8002, 0x00000000, 0x00000000,
0xffff8001, 0xffff8001, 0x00000000, 0x00000000,
0xffff8000, 0xffff8000, 0x00000000, 0x00000000,
0xffff7fff, 0xffff7fe2, 0x00000000, 0x00000000,
0xffff7fe1, 0xffff7f85, 0x00000000, 0x00000000,
0xffff7f84, 0xffff7f84, 0x00000000, 0x00000000,
0xffff7f83, 0xffff7f83, 0x00000000, 0x00000000,
0xffff7f82, 0xffff0005, 0x00000000, 0x00000000,
0xffff0004, 0xffff0004, 0x00000000, 0x00000000,
0xffff0003, 0xffff0003, 0x00000000, 0x00000000,
0xffff0002, 0xcccc4ccf, 0x00000000, 0x00000000,
0xcccc4cce, 0xaaaa2aad, 0x00000000, 0x00000000,
0xaaaa2aac, 0x7fff8005, 0x00000000, 0x00000000,
0x7fff8004, 0x7fff8004, 0x00000000, 0x00000000,
0x7fff8003, 0x7fff8003, 0x00000000, 0x00000000,
0x7fff8002, 0x7fff8002, 0x00000000, 0x00000000,
0x7fff8001, 0x7fff8001, 0x00000000, 0x00000000,
0x7fff8000, 0x5554d558, 0x00000000, 0x00000000,
0x5554d557, 0x3332b336, 0x00000000, 0x00000000,
0x3332b335, 0x00000002, 0x00000000, 0x00000000,
0x00000001, 0x00000001, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000001, 0x00000001, 0x00000000, 0x00000000,
0x00000002, 0x00007f7e, 0x00000000, 0x00000000,
0x00007f7f, 0x00007f7f, 0x00000000, 0x00000000,
0x00007f80, 0x00007f80, 0x00000000, 0x00000000,
0x00007f81, 0x00007f81, 0x00000000, 0x00000000,
0x00007f82, 0x00007fde, 0x00000000, 0x00000000,
0x00007fdf, 0x00007ffb, 0x00000000, 0x00000000,
0x00007ffb, 0x00007ffb, 0x00000000, 0x00000000,
0x00007ffc, 0x00007ffc, 0x00000000, 0x00000000,
0x00007ffd, 0xffff8003, 0x00000000, 0x00000000,
0xffff8002, 0xffff8002, 0x00000000, 0x00000000,
0xffff8001, 0xffff8001, 0x00000000, 0x00000000,
0xffff8000, 0xffff7fe3, 0x00000000, 0x00000000,
0xffff7fe2, 0xffff7f86, 0x00000000, 0x00000000,
0xffff7f85, 0xffff7f85, 0x00000000, 0x00000000,
0xffff7f84, 0xffff7f84, 0x00000000, 0x00000000,
0xffff7f83, 0xffff0006, 0x00000000, 0x00000000,
0xffff0005, 0xffff0005, 0x00000000, 0x00000000,
0xffff0004, 0xffff0004, 0x00000000, 0x00000000,
0xffff0003, 0xcccc4cd0, 0x00000000, 0x00000000,
0xcccc4ccf, 0xaaaa2aae, 0x00000000, 0x00000000,
0xaaaa2aad, 0x7fff8006, 0x00000000, 0x00000000,
0x7fff8005, 0x7fff8005, 0x00000000, 0x00000000,
0x7fff8004, 0x7fff8004, 0x00000000, 0x00000000,
0x7fff8003, 0x7fff8003, 0x00000000, 0x00000000,
0x7fff8002, 0x7fff8002, 0x00000000, 0x00000000,
0x7fff8001, 0x5554d559, 0x00000000, 0x00000000,
0x5554d558, 0x3332b337, 0x00000000, 0x00000000,
0x3332b336, 0x00000003, 0x00000000, 0x00000000,
0x00000002, 0x00000002, 0x00000000, 0x00000000,
0x00000001, 0x00000001, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000001, 0x00007f7d, 0x00000000, 0x00000000,
0x00007f7e, 0x00007f7e, 0x00000000, 0x00000000,
0x00007f7f, 0x00007f7f, 0x00000000, 0x00000000,
0x00007f80, 0x00007f80, 0x00000000, 0x00000000,
0x00007f81, 0x00007fdd, 0x00000000, 0x00000000,
0x00007fde, 0x00007ffa, 0x00000000, 0x00000000,
0x00007ffa, 0x0000007e, 0x00000000, 0x00000000,
0x00007ffb, 0x0000007f, 0x00000000, 0x00000000,
0x00007ffc, 0xffffff80, 0x00000000, 0x00000000,
0xffff8003, 0xffffff7f, 0x00000000, 0x00000000,
0xffff8002, 0xffffff7e, 0x00000000, 0x00000000,
0xffff8001, 0xffffff60, 0x00000000, 0x00000000,
0xffff7fe3, 0xffffff03, 0x00000000, 0x00000000,
0xffff7f86, 0xffffff02, 0x00000000, 0x00000000,
0xffff7f85, 0xffffff01, 0x00000000, 0x00000000,
0xffff7f84, 0xffff7f83, 0x00000000, 0x00000000,
0xffff0006, 0xffff7f82, 0x00000000, 0x00000000,
0xffff0005, 0xffff7f81, 0x00000000, 0x00000000,
0xffff0004, 0xcccccc4d, 0x00000000, 0x00000000,
0xcccc4cd0, 0xaaaaaa2b, 0x00000000, 0x00000000,
0xaaaa2aae, 0x7fffff83, 0x00000000, 0x00000000,
0x7fff8006, 0x7fffff82, 0x00000000, 0x00000000,
0x7fff8005, 0x7fffff81, 0x00000000, 0x00000000,
0x7fff8004, 0x7fffff80, 0x00000000, 0x00000000,
0x7fff8003, 0x7fffff7f, 0x00000000, 0x00000000,
0x7fff8002, 0x555554d6, 0x00000000, 0x00000000,
0x5554d559, 0x333332b4, 0x00000000, 0x00000000,
0x3332b337, 0x00007f80, 0x00000000, 0x00000000,
0x00000003, 0x00007f7f, 0x00000000, 0x00000000,
0x00000002, 0x00007f7e, 0x00000000, 0x00000000,
0x00000001, 0x00007f7d, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00007f7d, 0x00000001, 0x00000000, 0x00000000,
0x00007f7e, 0x00000002, 0x00000000, 0x00000000,
0x00007f7f, 0x00000003, 0x00000000, 0x00000000,
0x00007f80, 0x00000060, 0x00000000, 0x00000000,
0x00007fdd, 0x0000007d, 0x00000000, 0x00000000,
0x0000007d, 0x0000007d, 0x00000000, 0x00000000,
0x0000007e, 0x0000007e, 0x00000000, 0x00000000,
0x0000007f, 0xffffff81, 0x00000000, 0x00000000,
0xffffff80, 0xffffff80, 0x00000000, 0x00000000,
0xffffff7f, 0xffffff7f, 0x00000000, 0x00000000,
0xffffff7e, 0xffffff61, 0x00000000, 0x00000000,
0xffffff60, 0xffffff04, 0x00000000, 0x00000000,
0xffffff03, 0xffffff03, 0x00000000, 0x00000000,
0xffffff02, 0xffffff02, 0x00000000, 0x00000000,
0xffffff01, 0xffff7f84, 0x00000000, 0x00000000,
0xffff7f83, 0xffff7f83, 0x00000000, 0x00000000,
0xffff7f82, 0xffff7f82, 0x00000000, 0x00000000,
0xffff7f81, 0xcccccc4e, 0x00000000, 0x00000000,
0xcccccc4d, 0xaaaaaa2c, 0x00000000, 0x00000000,
0xaaaaaa2b, 0x7fffff84, 0x00000000, 0x00000000,
0x7fffff83, 0x7fffff83, 0x00000000, 0x00000000,
0x7fffff82, 0x7fffff82, 0x00000000, 0x00000000,
0x7fffff81, 0x7fffff81, 0x00000000, 0x00000000,
0x7fffff80, 0x7fffff80, 0x00000000, 0x00000000,
0x7fffff7f, 0x555554d7, 0x00000000, 0x00000000,
0x555554d6, 0x333332b5, 0x00000000, 0x00000000,
0x333332b4, 0x00007f81, 0x00000000, 0x00000000,
0x00007f80, 0x00007f80, 0x00000000, 0x00000000,
0x00007f7f, 0x00007f7f, 0x00000000, 0x00000000,
0x00007f7e, 0x00007f7e, 0x00000000, 0x00000000,
0x00007f7d, 0x00000001, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000001, 0x00000001, 0x00000000, 0x00000000,
0x00000002, 0x00000002, 0x00000000, 0x00000000,
0x00000003, 0x0000005f, 0x00000000, 0x00000000,
0x00000060, 0x0000007c, 0x00000000, 0x00000000,
0x0000007c, 0x0000007c, 0x00000000, 0x00000000,
0x0000007d, 0x0000007d, 0x00000000, 0x00000000,
0x0000007e, 0xffffff82, 0x00000000, 0x00000000,
0xffffff81, 0xffffff81, 0x00000000, 0x00000000,
0xffffff80, 0xffffff80, 0x00000000, 0x00000000,
0xffffff7f, 0xffffff62, 0x00000000, 0x00000000,
0xffffff61, 0xffffff05, 0x00000000, 0x00000000,
0xffffff04, 0xffffff04, 0x00000000, 0x00000000,
0xffffff03, 0xffffff03, 0x00000000, 0x00000000,
0xffffff02, 0xffff7f85, 0x00000000, 0x00000000,
0xffff7f84, 0xffff7f84, 0x00000000, 0x00000000,
0xffff7f83, 0xffff7f83, 0x00000000, 0x00000000,
0xffff7f82, 0xcccccc4f, 0x00000000, 0x00000000,
0xcccccc4e, 0xaaaaaa2d, 0x00000000, 0x00000000,
0xaaaaaa2c, 0x7fffff85, 0x00000000, 0x00000000,
0x7fffff84, 0x7fffff84, 0x00000000, 0x00000000,
0x7fffff83, 0x7fffff83, 0x00000000, 0x00000000,
0x7fffff82, 0x7fffff82, 0x00000000, 0x00000000,
0x7fffff81, 0x7fffff81, 0x00000000, 0x00000000,
0x7fffff80, 0x555554d8, 0x00000000, 0x00000000,
0x555554d7, 0x333332b6, 0x00000000, 0x00000000,
0x333332b5, 0x00007f82, 0x00000000, 0x00000000,
0x00007f81, 0x00007f81, 0x00000000, 0x00000000,
0x00007f80, 0x00007f80, 0x00000000, 0x00000000,
0x00007f7f, 0x00007f7f, 0x00000000, 0x00000000,
0x00007f7e, 0x00000002, 0x00000000, 0x00000000,
0x00000001, 0x00000001, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000001, 0x00000001, 0x00000000, 0x00000000,
0x00000002, 0x0000005e, 0x00000000, 0x00000000,
0x0000005f, 0x0000007b, 0x00000000, 0x00000000,
0x0000007b, 0x0000007b, 0x00000000, 0x00000000,
0x0000007c, 0x0000007c, 0x00000000, 0x00000000,
0x0000007d, 0xffffff83, 0x00000000, 0x00000000,
0xffffff82, 0xffffff82, 0x00000000, 0x00000000,
0xffffff81, 0xffffff81, 0x00000000, 0x00000000,
0xffffff80, 0xffffff63, 0x00000000, 0x00000000,
0xffffff62, 0xffffff06, 0x00000000, 0x00000000,
0xffffff05, 0xffffff05, 0x00000000, 0x00000000,
0xffffff04, 0xffffff04, 0x00000000, 0x00000000,
0xffffff03, 0xffff7f86, 0x00000000, 0x00000000,
0xffff7f85, 0xffff7f85, 0x00000000, 0x00000000,
0xffff7f84, 0xffff7f84, 0x00000000, 0x00000000,
0xffff7f83, 0xcccccc50, 0x00000000, 0x00000000,
0xcccccc4f, 0xaaaaaa2e, 0x00000000, 0x00000000,
0xaaaaaa2d, 0x7fffff86, 0x00000000, 0x00000000,
0x7fffff85, 0x7fffff85, 0x00000000, 0x00000000,
0x7fffff84, 0x7fffff84, 0x00000000, 0x00000000,
0x7fffff83, 0x7fffff83, 0x00000000, 0x00000000,
0x7fffff82, 0x7fffff82, 0x00000000, 0x00000000,
0x7fffff81, 0x555554d9, 0x00000000, 0x00000000,
0x555554d8, 0x333332b7, 0x00000000, 0x00000000,
0x333332b6, 0x00007f83, 0x00000000, 0x00000000,
0x00007f82, 0x00007f82, 0x00000000, 0x00000000,
0x00007f81, 0x00007f81, 0x00000000, 0x00000000,
0x00007f80, 0x00007f80, 0x00000000, 0x00000000,
0x00007f7f, 0x00000003, 0x00000000, 0x00000000,
0x00000002, 0x00000002, 0x00000000, 0x00000000,
0x00000001, 0x00000001, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000001, 0x0000005d, 0x00000000, 0x00000000,
0x0000005e, 0x0000007a, 0x00000000, 0x00000000,
0x0000007a, 0x0000001e, 0x00000000, 0x00000000,
0x0000007b, 0x0000001f, 0x00000000, 0x00000000,
0x0000007c, 0xffffffe0, 0x00000000, 0x00000000,
0xffffff83, 0xffffffdf, 0x00000000, 0x00000000,
0xffffff82, 0xffffffde, 0x00000000, 0x00000000,
0xffffff81, 0xffffffc0, 0x00000000, 0x00000000,
0xffffff63, 0xffffff63, 0x00000000, 0x00000000,
0xffffff06, 0xffffff62, 0x00000000, 0x00000000,
0xffffff05, 0xffffff61, 0x00000000, 0x00000000,
0xffffff04, 0xffff7fe3, 0x00000000, 0x00000000,
0xffff7f86, 0xffff7fe2, 0x00000000, 0x00000000,
0xffff7f85, 0xffff7fe1, 0x00000000, 0x00000000,
0xffff7f84, 0xccccccad, 0x00000000, 0x00000000,
0xcccccc50, 0xaaaaaa8b, 0x00000000, 0x00000000,
0xaaaaaa2e, 0x7fffffe3, 0x00000000, 0x00000000,
0x7fffff86, 0x7fffffe2, 0x00000000, 0x00000000,
0x7fffff85, 0x7fffffe1, 0x00000000, 0x00000000,
0x7fffff84, 0x7fffffe0, 0x00000000, 0x00000000,
0x7fffff83, 0x7fffffdf, 0x00000000, 0x00000000,
0x7fffff82, 0x55555536, 0x00000000, 0x00000000,
0x555554d9, 0x33333314, 0x00000000, 0x00000000,
0x333332b7, 0x00007fe0, 0x00000000, 0x00000000,
0x00007f83, 0x00007fdf, 0x00000000, 0x00000000,
0x00007f82, 0x00007fde, 0x00000000, 0x00000000,
0x00007f81, 0x00007fdd, 0x00000000, 0x00000000,
0x00007f80, 0x00000060, 0x00000000, 0x00000000,
0x00000003, 0x0000005f, 0x00000000, 0x00000000,
0x00000002, 0x0000005e, 0x00000000, 0x00000000,
0x00000001, 0x0000005d, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x0000005d, 0x0000001d, 0x00000000, 0x00000000,
0x0000001d, 0x00000001, 0x00000000, 0x00000000,
0x0000001e, 0x00000002, 0x00000000, 0x00000000,
0x0000001f, 0xfffffffd, 0x00000000, 0x00000000,
0xffffffe0, 0xfffffffc, 0x00000000, 0x00000000,
0xffffffdf, 0xfffffffb, 0x00000000, 0x00000000,
0xffffffde, 0xffffffdd, 0x00000000, 0x00000000,
0xffffffc0, 0xffffff80, 0x00000000, 0x00000000,
0xffffff63, 0xffffff7f, 0x00000000, 0x00000000,
0xffffff62, 0xffffff7e, 0x00000000, 0x00000000,
0xffffff61, 0xffff8000, 0x00000000, 0x00000000,
0xffff7fe3, 0xffff7fff, 0x00000000, 0x00000000,
0xffff7fe2, 0xffff7ffe, 0x00000000, 0x00000000,
0xffff7fe1, 0xccccccca, 0x00000000, 0x00000000,
0xccccccad, 0xaaaaaaa8, 0x00000000, 0x00000000,
0xaaaaaa8b, 0x80000000, 0x00000000, 0x00000000,
0x7fffffe3, 0x7fffffff, 0x00000000, 0x00000000,
0x7fffffe2, 0x7ffffffe, 0x00000000, 0x00000000,
0x7fffffe1, 0x7ffffffd, 0x00000000, 0x00000000,
0x7fffffe0, 0x7ffffffc, 0x00000000, 0x00000000,
0x7fffffdf, 0x55555553, 0x00000000, 0x00000000,
0x55555536, 0x33333331, 0x00000000, 0x00000000,
0x33333314, 0x00007ffd, 0x00000000, 0x00000000,
0x00007fe0, 0x00007ffc, 0x00000000, 0x00000000,
0x00007fdf, 0x00007ffb, 0x00000000, 0x00000000,
0x00007fde, 0x00007ffa, 0x00000000, 0x00000000,
0x00007fdd, 0x0000007d, 0x00000000, 0x00000000,
0x00000060, 0x0000007c, 0x00000000, 0x00000000,
0x0000005f, 0x0000007b, 0x00000000, 0x00000000,
0x0000005e, 0x0000007a, 0x00000000, 0x00000000,
0x0000005d, 0x0000001d, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
};
const unsigned kExpectedCount_NEON_uabd_2S = 961;
#endif // VIXL_SIM_UABD_2S_TRACE_A64_H_
|
darkenk/vixl
|
test/traces/a64/sim-uabd-2s-trace-a64.h
|
C
|
bsd-3-clause
| 50,071
|
<?php
/**
* Pimcore
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://www.pimcore.org/license
*
* @category Pimcore
* @package Object
* @copyright Copyright (c) 2009-2014 pimcore GmbH (http://www.pimcore.org)
* @license http://www.pimcore.org/license New BSD License
*/
namespace Pimcore\Model\Object\Classificationstore\KeyConfig;
use Pimcore\Model;
class Resource extends Model\Resource\AbstractResource {
const TABLE_NAME_KEYS = "classificationstore_keys";
/**
* Get the data for the object from database for the given id, or from the ID which is set in the object
*
* @param integer $id
* @return void
*/
public function getById($id = null) {
if ($id != null) {
$this->model->setId($id);
}
$data = $this->db->fetchRow("SELECT * FROM " . self::TABLE_NAME_KEYS . " WHERE id = ?", $this->model->getId());
$this->assignVariablesToModel($data);
}
/**
* @param null $name
* @throws \Exception
*/
public function getByName($name = null) {
if ($name != null) {
$this->model->setName($name);
}
$name = $this->model->getName();
$groupId = $this->model->getGroup();
$stmt = "SELECT * FROM " . self::TABLE_NAME_KEYS . " WHERE name = '" . $name . "'";
if ($groupId > 0) {
$stmt .= " AND `group` = " . $groupId;
}
$data = $this->db->fetchRow($stmt);
if($data["id"]) {
$this->assignVariablesToModel($data);
} else {
throw new \Exception("KeyConfig with name: " . $this->model->getName() . " does not exist");
}
}
/**
* Save object to database
*
* @return void
*/
public function save() {
if ($this->model->getId()) {
return $this->model->update();
}
return $this->create();
}
/**
* Deletes object from database
*
* @return void
*/
public function delete() {
$this->db->delete(self::TABLE_NAME_KEYS, $this->db->quoteInto("id = ?", $this->model->getId()));
}
/**
* @throws \Exception
*/
public function update() {
try {
$ts = time();
$this->model->setModificationDate($ts);
$type = get_object_vars($this->model);
foreach ($type as $key => $value) {
if (in_array($key, $this->getValidTableColumns(self::TABLE_NAME_KEYS))) {
if(is_bool($value)) {
$value = (int) $value;
}
if(is_array($value) || is_object($value)) {
if($this->model->getType() == 'select'){
$value = \Zend_Json::encode($value);
}else{
$value = \Pimcore\Tool\Serialize::serialize($value);
}
}
$data[$key] = $value;
}
}
$this->db->update(self::TABLE_NAME_KEYS, $data, $this->db->quoteInto("id = ?", $this->model->getId()));
return $this->model;
}
catch (\Exception $e) {
throw $e;
}
}
/**
* Create a new record for the object in database
*
* @return boolean
*/
public function create() {
$ts = time();
$this->model->setCreationDate($ts);
$this->model->setModificationDate($ts);
$this->db->insert(self::TABLE_NAME_KEYS, array());
$this->model->setId($this->db->lastInsertId());
return $this->save();
}
}
|
yasarkunduz/pimcore
|
pimcore/models/Object/Classificationstore/KeyConfig/Resource.php
|
PHP
|
bsd-3-clause
| 3,824
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/browser_command_controller.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/tab_modal_confirm_dialog_browsertest.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/test/base/in_process_browser_test.h"
typedef InProcessBrowserTest BrowserCommandControllerBrowserTest;
// Verify that showing a constrained window disables find.
IN_PROC_BROWSER_TEST_F(BrowserCommandControllerBrowserTest, DisableFind) {
EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FIND));
// Showing constrained window should disable find.
content::WebContents* web_contents =
browser()->tab_strip_model()->GetActiveWebContents();
MockTabModalConfirmDialogDelegate* delegate =
new MockTabModalConfirmDialogDelegate(web_contents, NULL);
TabModalConfirmDialog::Create(delegate, web_contents);
EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_FIND));
// Switching to a new (unblocked) tab should reenable it.
AddBlankTabAndShow(browser());
EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FIND));
// Switching back to the blocked tab should disable it again.
browser()->tab_strip_model()->ActivateTabAt(0, false);
EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_FIND));
// Closing the constrained window should reenable it.
delegate->Cancel();
EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FIND));
}
|
leiferikb/bitpop-private
|
chrome/browser/ui/browser_command_controller_browsertest.cc
|
C++
|
bsd-3-clause
| 1,667
|
/*
* $Header$
* $Revision$
* $Date$
*
* ====================================================================
*
* Copyright 2005 Elliotte Rusty Harold.
* 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 Jaxen 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.
*
* ====================================================================
* This software consists of voluntary contributions made by many
* individuals on behalf of the Jaxen Project and was originally
* created by bob mcwhirter <bob@werken.com> and
* James Strachan <jstrachan@apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
* $Id$
*/
package org.jaxen.test;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import junit.framework.TestCase;
import org.jaxen.JaxenException;
import org.jaxen.XPath;
import org.jaxen.dom.DOMXPath;
import org.w3c.dom.Document;
/**
* @author Elliotte Rusty Harold
*
*/
public class ArithmeticTest extends TestCase {
private Document doc;
public void setUp() throws ParserConfigurationException
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder builder = factory.newDocumentBuilder();
doc = builder.newDocument();
org.w3c.dom.Element a = doc.createElementNS("", "a");
doc.appendChild(a);
}
public ArithmeticTest(String name) {
super(name);
}
public void testNumbersThatBeginWithADecimalPoint()
throws JaxenException {
XPath xpath = new DOMXPath(".5 > .4");
Boolean result = (Boolean) xpath.evaluate(doc);
assertTrue(result.booleanValue());
}
public void testNumbersThatBeginWithADecimalPoint2()
throws JaxenException {
XPath xpath = new DOMXPath(".3 <= .4 <= 1.1");
Boolean result = (Boolean) xpath.evaluate(doc);
assertTrue(result.booleanValue());
}
public void testLeftAssociativityOfLessThanOrEqual()
throws JaxenException {
XPath xpath = new DOMXPath(".3 <= .4 <= 0.9");
Boolean result = (Boolean) xpath.evaluate(doc);
assertFalse(result.booleanValue());
}
}
|
appcelerator/jaxen_titanium
|
src/java/test/org/jaxen/test/ArithmeticTest.java
|
Java
|
bsd-3-clause
| 3,828
|
from traits.api import Int, Tuple
from enable.tools.api import ViewportPanTool
class MPViewportPanTool(ViewportPanTool):
cur_bid = Int(-1)
_last_blob_pos = Tuple
def normal_blob_down(self, event):
if self.cur_bid == -1 and self.is_draggable(event.x, event.y):
self.cur_bid = event.bid
self.drag_start(event)
def dragging_blob_up(self, event):
if event.bid == self.cur_bid:
self.cur_bid = -1
self.drag_end(event)
def dragging_blob_move(self, event):
if event.bid == self.cur_bid:
self._last_blob_pos = (event.x, event.y)
self.dragging(event)
def drag_start(self, event):
if self.component:
self.original_padding = self.component.padding
if hasattr(event, "bid"):
event.window.capture_blob(self, event.bid,
event.net_transform())
else:
event.window.set_mouse_owner(self, event.net_transform())
self._last_blob_pos = (event.x, event.y)
self.mouse_down_position = (event.x,event.y)
self.event_state = "dragging"
event.handled = True
ViewportPanTool.drag_start(self, event)
return
def drag_end(self, event):
event.x, event.y = self._last_blob_pos
if hasattr(event, "bid"):
event.window.release_blob(event.bid)
self.event_state = "normal"
ViewportPanTool.drag_end(self, event)
|
tommy-u/chaco
|
examples/demo/canvas/mp_viewport_pan_tool.py
|
Python
|
bsd-3-clause
| 1,535
|
using System;
using SQLite;
namespace Toggl.Phoebe.Data.DataObjects
{
[Table ("TaskModel")]
public class TaskData : CommonData
{
public TaskData ()
{
}
public TaskData (TaskData other) : base (other)
{
Name = other.Name;
IsActive = other.IsActive;
Estimate = other.Estimate;
WorkspaceId = other.WorkspaceId;
ProjectId = other.ProjectId;
}
public string Name { get; set; }
public bool IsActive { get; set; }
public long Estimate { get; set; }
[ForeignRelation (typeof (WorkspaceData))]
public Guid WorkspaceId { get; set; }
[ForeignRelation (typeof (ProjectData))]
public Guid ProjectId { get; set; }
}
}
|
masterrr/mobile
|
Phoebe/Data/DataObjects/TaskData.cs
|
C#
|
bsd-3-clause
| 791
|
/*******************************************************************************
Copyright (c) 2012, S-Core.
All rights reserved.
Use is subject to license terms.
This distribution may include materials developed by third parties.
***************************************************************************** */
var __result1 = Math.pow(3, 4);
var __expect1 = 81;
|
daejunpark/jsaf
|
tests/typing_tests/semantics/builtin_Math_pow6.js
|
JavaScript
|
bsd-3-clause
| 384
|
# Copyright (c) 2012-2013, Itzik Kotler
# 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 author 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.
import unittest
import networkx
# Local imports
import pythonect.internal.parsers.p2y
class TestPythonectScriptParser(unittest.TestCase):
def test_program_empty(self):
g = networkx.DiGraph()
self.assertEqual(len(pythonect.internal.parsers.p2y.PythonectScriptParser().parse('').nodes()) == len(g.nodes()), True)
def test_expr_atom(self):
g = networkx.DiGraph()
g.add_node('1')
self.assertEqual(len(pythonect.internal.parsers.p2y.PythonectScriptParser().parse('1').nodes()) == len(g.nodes()), True)
def test_shebang_line_with_even_expr_atom_op_expr(self):
g = networkx.DiGraph()
g.add_node('1')
g.add_node('2')
g.add_edge('1', '2')
self.assertEqual(len(pythonect.internal.parsers.p2y.PythonectScriptParser().parse('#! /usr/bin/env pythonect\n1 -> 1').edges()) == len(g.edges()), True)
def test_even_expr_atom_op_expr(self):
g = networkx.DiGraph()
g.add_node('1')
g.add_node('2')
g.add_edge('1', '2')
self.assertEqual(len(pythonect.internal.parsers.p2y.PythonectScriptParser().parse('1 -> 1').edges()) == len(g.edges()), True)
def test_odd_expr_atom_op_expr(self):
g = networkx.DiGraph()
g.add_node('1')
g.add_node('2')
g.add_node('3')
g.add_edge('1', '2')
g.add_edge('2', '3')
self.assertEqual(len(pythonect.internal.parsers.p2y.PythonectScriptParser().parse('1 -> 1 -> 1').edges()) == len(g.edges()), True)
def test_program_expr_list(self):
g = networkx.DiGraph()
g.add_node('1')
g.add_node('2')
self.assertEqual(len(pythonect.internal.parsers.p2y.PythonectScriptParser().parse('1 , 2').nodes()) == len(g.nodes()), True)
|
fr34k8/pythonect
|
pythonect/internal/parsers/test/test_p2y.py
|
Python
|
bsd-3-clause
| 3,355
|
// Test for ASAN_OPTIONS=start_deactivated=1 mode.
// Main executable is uninstrumented, but linked to ASan runtime. The shared
// library is instrumented. Memory errors before dlopen are not detected.
// RUN: %clangxx_asan -O0 -DSHARED_LIB %s -std=c++11 -fPIC -shared -o %t-so.so
// RUN: %clangxx -O0 %s -std=c++11 -c -o %t.o
// RUN: %clangxx_asan -O0 %t.o %libdl -o %t
// RUN: %env_asan_opts=start_deactivated=1,allocator_may_return_null=0 \
// RUN: ASAN_ACTIVATION_OPTIONS=allocator_may_return_null=1 not %run %t 2>&1 | FileCheck %s
// RUN: %env_asan_opts=start_deactivated=1 \
// RUN: ASAN_ACTIVATION_OPTIONS=help=1 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-HELP
// RUN: %env_asan_opts=start_deactivated=1,verbosity=1 \
// RUN: ASAN_ACTIVATION_OPTIONS=help=1,handle_segv=0 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-UNSUPPORTED
// RUN: %env_asan_opts=start_deactivated=1 \
// RUN: ASAN_ACTIVATION_OPTIONS=help=1,handle_segv=0 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-UNSUPPORTED-V0
// Check that verbosity=1 in activation flags affects reporting of unrecognized activation flags.
// RUN: %env_asan_opts=start_deactivated=1 \
// RUN: ASAN_ACTIVATION_OPTIONS=help=1,handle_segv=0,verbosity=1 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-UNSUPPORTED
// UNSUPPORTED: ios
// END.
#if !defined(SHARED_LIB)
#include <assert.h>
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <string>
#include "sanitizer/asan_interface.h"
void test_malloc_shadow(char *p, size_t sz, bool expect_redzones) {
// Last byte of the left redzone, if present.
assert((char *)__asan_region_is_poisoned(p - 1, sz + 1) ==
(expect_redzones ? p - 1 : nullptr));
// The user memory.
assert((char *)__asan_region_is_poisoned(p, sz) == nullptr);
// First byte of the right redzone, if present.
assert((char *)__asan_region_is_poisoned(p, sz + 1) ==
(expect_redzones ? p + sz : nullptr));
}
typedef void (*Fn)();
int main(int argc, char *argv[]) {
constexpr unsigned nPtrs = 200;
char *ptrs[nPtrs];
// Before activation: no redzones.
for (size_t sz = 1; sz < nPtrs; ++sz) {
ptrs[sz] = (char *)malloc(sz);
test_malloc_shadow(ptrs[sz], sz, false);
}
// Create a honey pot for the future, instrumented, allocations. Since the
// quarantine is disabled, chunks are going to be recycled right away and
// reused for the new allocations. New allocations must get the proper
// redzones anyway, whether it's a fresh or reused allocation.
constexpr size_t HoneyPotBlockSize = 4096;
constexpr int HoneyPotSize = 200;
char *honeyPot[HoneyPotSize];
for (int i = 1; i < HoneyPotSize; ++i) {
honeyPot[i] = (char *)malloc(HoneyPotBlockSize);
test_malloc_shadow(honeyPot[i], HoneyPotBlockSize, false);
}
for (int i = 1; i < HoneyPotSize; ++i)
free(honeyPot[i]);
std::string path = std::string(argv[0]) + "-so.so";
void *dso = dlopen(path.c_str(), RTLD_NOW);
if (!dso) {
fprintf(stderr, "dlopen failed: %s\n", dlerror());
return 1;
}
// After this line ASan is activated and starts detecting errors.
void *fn = dlsym(dso, "do_another_bad_thing");
if (!fn) {
fprintf(stderr, "dlsym failed: %s\n", dlerror());
return 1;
}
// After activation: redzones.
for (int i = 1; i < HoneyPotSize; ++i) {
honeyPot[i] = (char *)malloc(HoneyPotBlockSize);
test_malloc_shadow(honeyPot[i], HoneyPotBlockSize, true);
}
{
char *p = (char *)malloc(HoneyPotBlockSize);
test_malloc_shadow(p, HoneyPotBlockSize, true);
free(p);
}
for (int i = 1; i < HoneyPotSize; ++i)
free(honeyPot[i]);
// Pre-existing allocations got redzones, too.
for (size_t sz = 1; sz < nPtrs; ++sz) {
test_malloc_shadow(ptrs[sz], sz, true);
free(ptrs[sz]);
}
// Test that ASAN_ACTIVATION_OPTIONS=allocator_may_return_null=1 has effect.
void *p = malloc((unsigned long)-2);
assert(!p);
// CHECK: WARNING: AddressSanitizer failed to allocate 0xfff{{.*}} bytes
((Fn)fn)();
// CHECK: AddressSanitizer: heap-buffer-overflow
// CHECK: READ of size 1
// CHECK: {{#0 .* in do_another_bad_thing}}
// CHECK: is located 5 bytes to the right of 100-byte region
// CHECK: in do_another_bad_thing
return 0;
}
#else // SHARED_LIB
#include <stdio.h>
#include <stdlib.h>
extern "C" void do_another_bad_thing() {
char *volatile p = (char *)malloc(100);
printf("%hhx\n", p[105]);
}
#endif // SHARED_LIB
// help=1 in activation flags lists only flags are are supported at activation
// CHECK-HELP: Available flags for {{.*}}Sanitizer:
// CHECK-HELP-NOT: handle_segv
// CHECK-HELP: max_redzone
// CHECK-HELP-NOT: handle_segv
// unsupported activation flags produce a warning ...
// CHECK-UNSUPPORTED: WARNING: found 1 unrecognized
// CHECK-UNSUPPORTED: handle_segv
// ... but not at verbosity=0
// CHECK-UNSUPPORTED-V0-NOT: WARNING: found {{.*}} unrecognized
|
youtube/cobalt
|
third_party/llvm-project/compiler-rt/test/asan/TestCases/Posix/start-deactivated.cc
|
C++
|
bsd-3-clause
| 4,966
|
<?php
use tests\codeception\frontend\AcceptanceTester;
use tests\codeception\frontend\_pages\AboutPage;
/* @var $scenario Codeception\Scenario */
$I = new AcceptanceTester($scenario);
$I->wantTo('ensure that about works');
AboutPage::openBy($I);
$I->see('About', 'h1');
|
hucongyang/yii
|
tests/codeception/frontend/acceptance/AboutCept.php
|
PHP
|
bsd-3-clause
| 273
|
/*
* Copyright (c) 2007, Michael Feathers, James Grenning and Bas Vodde
* 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 <organization> 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 EARLIER MENTIONED AUTHORS ``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 <copyright holder> 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.
*/
#include "CppUTest/TestHarness.h"
#include "CppUTest/TestOutput.h"
#include "CppUTest/PlatformSpecificFunctions.h"
TestOutput::WorkingEnvironment TestOutput::workingEnvironment_ = TestOutput::detectEnvironment;
void TestOutput::setWorkingEnvironment(TestOutput::WorkingEnvironment workEnvironment)
{
workingEnvironment_ = workEnvironment;
}
TestOutput::WorkingEnvironment TestOutput::getWorkingEnvironment()
{
if (workingEnvironment_ == TestOutput::detectEnvironment)
return PlatformSpecificGetWorkingEnvironment();
return workingEnvironment_;
}
TestOutput::TestOutput() :
dotCount_(0), verbose_(level_quiet), color_(false), progressIndication_(".")
{
}
TestOutput::~TestOutput()
{
}
void TestOutput::verbose(VerbosityLevel level)
{
verbose_ = level;
}
void TestOutput::color()
{
color_ = true;
}
void TestOutput::print(const char* str)
{
printBuffer(str);
}
void TestOutput::print(long n)
{
print(StringFrom(n).asCharString());
}
void TestOutput::print(size_t n)
{
print(StringFrom(n).asCharString());
}
void TestOutput::printDouble(double d)
{
print(StringFrom(d).asCharString());
}
TestOutput& operator<<(TestOutput& p, const char* s)
{
p.print(s);
return p;
}
TestOutput& operator<<(TestOutput& p, long int i)
{
p.print(i);
return p;
}
void TestOutput::printCurrentTestStarted(const UtestShell& test)
{
if (verbose_ > level_quiet) print(test.getFormattedName().asCharString());
if (test.willRun()) {
setProgressIndicator(".");
}
else {
setProgressIndicator("!");
}
}
void TestOutput::printCurrentTestEnded(const TestResult& res)
{
if (verbose_ > level_quiet) {
print(" - ");
print(res.getCurrentTestTotalExecutionTime());
print(" ms\n");
}
else {
printProgressIndicator();
}
}
void TestOutput::printProgressIndicator()
{
print(progressIndication_);
if (++dotCount_ % 50 == 0) print("\n");
}
void TestOutput::setProgressIndicator(const char* indicator)
{
progressIndication_ = indicator;
}
void TestOutput::printTestsStarted()
{
}
void TestOutput::printCurrentGroupStarted(const UtestShell& /*test*/)
{
}
void TestOutput::printCurrentGroupEnded(const TestResult& /*res*/)
{
}
void TestOutput::printTestsEnded(const TestResult& result)
{
print("\n");
const bool isFailure = result.isFailure();
const size_t failureCount = result.getFailureCount();
if (isFailure) {
if (color_) {
print("\033[31;1m");
}
print("Errors (");
if (failureCount > 0) {
print(failureCount);
print(" failures, ");
}
else {
print("ran nothing, ");
}
}
else {
if (color_) {
print("\033[32;1m");
}
print("OK (");
}
print(result.getTestCount());
print(" tests, ");
print(result.getRunCount());
print(" ran, ");
print(result.getCheckCount());
print(" checks, ");
print(result.getIgnoredCount());
print(" ignored, ");
print(result.getFilteredOutCount());
print(" filtered out, ");
print(result.getTotalExecutionTime());
print(" ms)");
if (color_) {
print("\033[m");
}
if (isFailure && failureCount == 0) {
print("\nNote: test run failed because no tests were run or ignored. Assuming something went wrong. "
"This often happens because of linking errors or typos in test filter.");
}
print("\n\n");
dotCount_ = 0;
}
void TestOutput::printTestRun(size_t number, size_t total)
{
if (total > 1) {
print("Test run ");
print(number);
print(" of ");
print(total);
print("\n");
}
}
void TestOutput::printFailure(const TestFailure& failure)
{
if (failure.isOutsideTestFile() || failure.isInHelperFunction())
printFileAndLineForTestAndFailure(failure);
else
printFileAndLineForFailure(failure);
printFailureMessage(failure.getMessage());
}
void TestOutput::printFileAndLineForTestAndFailure(const TestFailure& failure)
{
printErrorInFileOnLineFormattedForWorkingEnvironment(failure.getTestFileName(), failure.getTestLineNumber());
printFailureInTest(failure.getTestName());
printErrorInFileOnLineFormattedForWorkingEnvironment(failure.getFileName(), failure.getFailureLineNumber());
}
void TestOutput::printFileAndLineForFailure(const TestFailure& failure)
{
printErrorInFileOnLineFormattedForWorkingEnvironment(failure.getFileName(), failure.getFailureLineNumber());
printFailureInTest(failure.getTestName());
}
void TestOutput::printFailureInTest(SimpleString testName)
{
print(" Failure in ");
print(testName.asCharString());
}
void TestOutput::printFailureMessage(SimpleString reason)
{
print("\n");
print("\t");
print(reason.asCharString());
print("\n\n");
}
void TestOutput::printErrorInFileOnLineFormattedForWorkingEnvironment(SimpleString file, size_t lineNumber)
{
if (TestOutput::getWorkingEnvironment() == TestOutput::visualStudio)
printVisualStudioErrorInFileOnLine(file, lineNumber);
else
printEclipseErrorInFileOnLine(file, lineNumber);
}
void TestOutput::printEclipseErrorInFileOnLine(SimpleString file, size_t lineNumber)
{
print("\n");
print(file.asCharString());
print(":");
print(lineNumber);
print(":");
print(" error:");
}
void TestOutput::printVisualStudioErrorInFileOnLine(SimpleString file, size_t lineNumber)
{
print("\n");
print(file.asCharString());
print("(");
print(lineNumber);
print("):");
print(" error:");
}
void TestOutput::printVeryVerbose(const char* str)
{
if(verbose_ == level_veryVerbose)
printBuffer(str);
}
void ConsoleTestOutput::printBuffer(const char* s)
{
while (*s) {
PlatformSpecificPutchar(*s);
s++;
}
flush();
}
void ConsoleTestOutput::flush()
{
PlatformSpecificFlush();
}
StringBufferTestOutput::~StringBufferTestOutput()
{
}
CompositeTestOutput::CompositeTestOutput()
: outputOne_(NULLPTR), outputTwo_(NULLPTR)
{
}
CompositeTestOutput::~CompositeTestOutput()
{
delete outputOne_;
delete outputTwo_;
}
void CompositeTestOutput::setOutputOne(TestOutput* output)
{
delete outputOne_;
outputOne_ = output;
}
void CompositeTestOutput::setOutputTwo(TestOutput* output)
{
delete outputTwo_;
outputTwo_ = output;
}
void CompositeTestOutput::printTestsStarted()
{
if (outputOne_) outputOne_->printTestsStarted();
if (outputTwo_) outputTwo_->printTestsStarted();
}
void CompositeTestOutput::printTestsEnded(const TestResult& result)
{
if (outputOne_) outputOne_->printTestsEnded(result);
if (outputTwo_) outputTwo_->printTestsEnded(result);
}
void CompositeTestOutput::printCurrentTestStarted(const UtestShell& test)
{
if (outputOne_) outputOne_->printCurrentTestStarted(test);
if (outputTwo_) outputTwo_->printCurrentTestStarted(test);
}
void CompositeTestOutput::printCurrentTestEnded(const TestResult& res)
{
if (outputOne_) outputOne_->printCurrentTestEnded(res);
if (outputTwo_) outputTwo_->printCurrentTestEnded(res);
}
void CompositeTestOutput::printCurrentGroupStarted(const UtestShell& test)
{
if (outputOne_) outputOne_->printCurrentGroupStarted(test);
if (outputTwo_) outputTwo_->printCurrentGroupStarted(test);
}
void CompositeTestOutput::printCurrentGroupEnded(const TestResult& res)
{
if (outputOne_) outputOne_->printCurrentGroupEnded(res);
if (outputTwo_) outputTwo_->printCurrentGroupEnded(res);
}
void CompositeTestOutput::verbose(VerbosityLevel level)
{
if (outputOne_) outputOne_->verbose(level);
if (outputTwo_) outputTwo_->verbose(level);
}
void CompositeTestOutput::color()
{
if (outputOne_) outputOne_->color();
if (outputTwo_) outputTwo_->color();
}
void CompositeTestOutput::printBuffer(const char* buffer)
{
if (outputOne_) outputOne_->printBuffer(buffer);
if (outputTwo_) outputTwo_->printBuffer(buffer);
}
void CompositeTestOutput::print(const char* buffer)
{
if (outputOne_) outputOne_->print(buffer);
if (outputTwo_) outputTwo_->print(buffer);
}
void CompositeTestOutput::print(long number)
{
if (outputOne_) outputOne_->print(number);
if (outputTwo_) outputTwo_->print(number);
}
void CompositeTestOutput::print(size_t number)
{
if (outputOne_) outputOne_->print(number);
if (outputTwo_) outputTwo_->print(number);
}
void CompositeTestOutput::printDouble(double number)
{
if (outputOne_) outputOne_->printDouble(number);
if (outputTwo_) outputTwo_->printDouble(number);
}
void CompositeTestOutput::printFailure(const TestFailure& failure)
{
if (outputOne_) outputOne_->printFailure(failure);
if (outputTwo_) outputTwo_->printFailure(failure);
}
void CompositeTestOutput::setProgressIndicator(const char* indicator)
{
if (outputOne_) outputOne_->setProgressIndicator(indicator);
if (outputTwo_) outputTwo_->setProgressIndicator(indicator);
}
void CompositeTestOutput::flush()
{
if (outputOne_) outputOne_->flush();
if (outputTwo_) outputTwo_->flush();
}
|
cpputest/cpputest
|
src/CppUTest/TestOutput.cpp
|
C++
|
bsd-3-clause
| 10,692
|
---
layout: data_model
title: NetworkSocketObjectType
this_version: 1.1.1
---
<div class="alert alert-danger bs-alert-old-docs">
<strong>Heads up!</strong> These docs are for STIX 1.1.1, which is not the latest version (1.2). <a href="/data-model/1.2/NetworkSocketObj/NetworkSocketObjectType">View the latest!</a>
</div>
<div class="row">
<div class="col-md-10">
<h1>NetworkSocketObjectType<span class="subdued">Network Socket Object Schema</span></h1>
<p class="data-model-description">The <a href='/data-model/1.1.1/NetworkSocketObj/NetworkSocketObjectType'>NetworkSocketObjectType</a> is intended to characterize network sockets.</p>
</div>
<div id="nav-area" class="col-md-2">
<p>
<form id="nav-version">
<select>
<option value="1.2" >STIX 1.2</option>
<option value="1.1.1" selected="selected">STIX 1.1.1</option>
<option value="1.1" >STIX 1.1</option>
<option value="1.0.1" >STIX 1.0.1</option>
<option value="1.0" >STIX 1.0</option>
</select>
</form>
</p>
</div>
</div>
<hr />
<h2>Fields</h2>
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Field Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>@object_reference<span class="occurrence">optional</span></td>
<td>
QName
</td>
<td>
<p>The object_reference field specifies a unique ID reference to an Object defined elsewhere. This construct allows for the re-use of the defined Properties of one Object within another, without the need to embed the full Object in the location from which it is being referenced. Thus, this ID reference is intended to resolve to the Properties of the Object that it points to.</p>
</td>
</tr>
<tr>
<td>Custom_Properties<span class="occurrence">0..1</span></td>
<td>
<a href="/data-model/1.1.1/cyboxCommon/CustomPropertiesType">CustomPropertiesType</a>
</td>
<td>
<p>The Custom_Properties construct is optional and enables the specification of a set of custom Object Properties that may not be defined in existing Properties schemas.</p>
</td>
</tr>
<tr>
<td>@is_blocking<span class="occurrence">optional</span></td>
<td>
boolean
</td>
<td>
<p>The is_blocking field specifies whether or not the socket is in blocking mode.</p>
</td>
</tr>
<tr>
<td>@is_listening<span class="occurrence">optional</span></td>
<td>
boolean
</td>
<td>
<p>The is_listening field specifies whether or not the socket is in listening mode.</p>
</td>
</tr>
<tr>
<td>Address_Family<span class="occurrence">0..1</span></td>
<td>
<a href="/data-model/1.1.1/NetworkSocketObj/AddressFamilyType">AddressFamilyType</a>
</td>
<td>
<p>The Address_Family field specifies the address family (AF_*) that the socket is configured for.</p>
</td>
</tr>
<tr>
<td>Domain<span class="occurrence">0..1</span></td>
<td>
<a href="/data-model/1.1.1/NetworkSocketObj/DomainFamilyType">DomainFamilyType</a>
</td>
<td>
<p>The Domain field specifies the communication domain (PF_*) of the socket.</p>
</td>
</tr>
<tr>
<td>Local_Address<span class="occurrence">0..1</span></td>
<td>
<a href="/data-model/1.1.1/SocketAddressObj/SocketAddressObjectType">SocketAddressObjectType</a>
</td>
<td>
<p>The Local_Address field specifies the IP address and port for the socket on the local machine.</p>
</td>
</tr>
<tr>
<td>Options<span class="occurrence">0..1</span></td>
<td>
<a href="/data-model/1.1.1/NetworkSocketObj/SocketOptionsType">SocketOptionsType</a>
</td>
<td>
<p>The Options field specifies any particular options used by the socket.</p>
</td>
</tr>
<tr>
<td>Protocol<span class="occurrence">0..1</span></td>
<td>
<a href="/data-model/1.1.1/NetworkSocketObj/ProtocolType">ProtocolType</a>
</td>
<td>
<p>The Protocol field specifies the type of IP layer protocol used by the socket.</p>
</td>
</tr>
<tr>
<td>Remote_Address<span class="occurrence">0..1</span></td>
<td>
<a href="/data-model/1.1.1/SocketAddressObj/SocketAddressObjectType">SocketAddressObjectType</a>
</td>
<td>
<p>The Remote_Address field specifies the IP address and port for the socket on the remote machine.</p>
</td>
</tr>
<tr>
<td>Type<span class="occurrence">0..1</span></td>
<td>
<a href="/data-model/1.1.1/NetworkSocketObj/SocketType">SocketType</a>
</td>
<td>
<p>The Type field specifies the type of socket being characterized.</p>
</td>
</tr>
<tr>
<td>Socket_Descriptor<span class="occurrence">0..1</span></td>
<td>
<a href="/data-model/1.1.1/cyboxCommon/NonNegativeIntegerObjectPropertyType">NonNegativeIntegerObjectPropertyType</a>
</td>
<td>
<p>The Socket_Descriptor field specifies the socket file descriptor value associated with the socket. Negative values are not allowed.</p>
</td>
</tr>
</tbody>
</table>
|
johnwunder/johnwunder.github.io
|
data-model/1.1.1/NetworkSocketObj/NetworkSocketObjectType/index.html
|
HTML
|
bsd-3-clause
| 5,970
|
#! /usr/bin/env perl
# Copyright 2005-2021 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
# in the file LICENSE in the source distribution or at
# https://www.openssl.org/source/license.html
# ====================================================================
# Written by Andy Polyakov <appro@openssl.org> for the OpenSSL
# project. The module is, however, dual licensed under OpenSSL and
# CRYPTOGAMS licenses depending on where you obtain it. For further
# details see http://www.openssl.org/~appro/cryptogams/.
# ====================================================================
# December 2005
#
# Pure SPARCv9/8+ and IALU-only bn_mul_mont implementation. The reasons
# for undertaken effort are multiple. First of all, UltraSPARC is not
# the whole SPARCv9 universe and other VIS-free implementations deserve
# optimized code as much. Secondly, newly introduced UltraSPARC T1,
# a.k.a. Niagara, has shared FPU and concurrent FPU-intensive paths,
# such as sparcv9a-mont, will simply sink it. Yes, T1 is equipped with
# several integrated RSA/DSA accelerator circuits accessible through
# kernel driver [only(*)], but having decent user-land software
# implementation is important too. Finally, reasons like desire to
# experiment with dedicated squaring procedure. Yes, this module
# implements one, because it was easiest to draft it in SPARCv9
# instructions...
# (*) Engine accessing the driver in question is on my TODO list.
# For reference, accelerator is estimated to give 6 to 10 times
# improvement on single-threaded RSA sign. It should be noted
# that 6-10x improvement coefficient does not actually mean
# something extraordinary in terms of absolute [single-threaded]
# performance, as SPARCv9 instruction set is by all means least
# suitable for high performance crypto among other 64 bit
# platforms. 6-10x factor simply places T1 in same performance
# domain as say AMD64 and IA-64. Improvement of RSA verify don't
# appear impressive at all, but it's the sign operation which is
# far more critical/interesting.
# You might notice that inner loops are modulo-scheduled:-) This has
# essentially negligible impact on UltraSPARC performance, it's
# Fujitsu SPARC64 V users who should notice and hopefully appreciate
# the advantage... Currently this module surpasses sparcv9a-mont.pl
# by ~20% on UltraSPARC-III and later cores, but recall that sparcv9a
# module still have hidden potential [see TODO list there], which is
# estimated to be larger than 20%...
$output = pop and open STDOUT,">$output";
# int bn_mul_mont(
$rp="%i0"; # BN_ULONG *rp,
$ap="%i1"; # const BN_ULONG *ap,
$bp="%i2"; # const BN_ULONG *bp,
$np="%i3"; # const BN_ULONG *np,
$n0="%i4"; # const BN_ULONG *n0,
$num="%i5"; # int num);
$frame="STACK_FRAME";
$bias="STACK_BIAS";
$car0="%o0";
$car1="%o1";
$car2="%o2"; # 1 bit
$acc0="%o3";
$acc1="%o4";
$mask="%g1"; # 32 bits, what a waste...
$tmp0="%g4";
$tmp1="%g5";
$i="%l0";
$j="%l1";
$mul0="%l2";
$mul1="%l3";
$tp="%l4";
$apj="%l5";
$npj="%l6";
$tpj="%l7";
$fname="bn_mul_mont_int";
$code=<<___;
#ifndef __ASSEMBLER__
# define __ASSEMBLER__ 1
#endif
#include "crypto/sparc_arch.h"
.section ".text",#alloc,#execinstr
.global $fname
.align 32
$fname:
cmp %o5,4 ! 128 bits minimum
bge,pt %icc,.Lenter
sethi %hi(0xffffffff),$mask
retl
clr %o0
.align 32
.Lenter:
save %sp,-$frame,%sp
sll $num,2,$num ! num*=4
or $mask,%lo(0xffffffff),$mask
ld [$n0],$n0
cmp $ap,$bp
and $num,$mask,$num
ld [$bp],$mul0 ! bp[0]
nop
add %sp,$bias,%o7 ! real top of stack
ld [$ap],$car0 ! ap[0] ! redundant in squaring context
sub %o7,$num,%o7
ld [$ap+4],$apj ! ap[1]
and %o7,-1024,%o7
ld [$np],$car1 ! np[0]
sub %o7,$bias,%sp ! alloca
ld [$np+4],$npj ! np[1]
be,pt SIZE_T_CC,.Lbn_sqr_mont
mov 12,$j
mulx $car0,$mul0,$car0 ! ap[0]*bp[0]
mulx $apj,$mul0,$tmp0 !prologue! ap[1]*bp[0]
and $car0,$mask,$acc0
add %sp,$bias+$frame,$tp
ld [$ap+8],$apj !prologue!
mulx $n0,$acc0,$mul1 ! "t[0]"*n0
and $mul1,$mask,$mul1
mulx $car1,$mul1,$car1 ! np[0]*"t[0]"*n0
mulx $npj,$mul1,$acc1 !prologue! np[1]*"t[0]"*n0
srlx $car0,32,$car0
add $acc0,$car1,$car1
ld [$np+8],$npj !prologue!
srlx $car1,32,$car1
mov $tmp0,$acc0 !prologue!
.L1st:
mulx $apj,$mul0,$tmp0
mulx $npj,$mul1,$tmp1
add $acc0,$car0,$car0
ld [$ap+$j],$apj ! ap[j]
and $car0,$mask,$acc0
add $acc1,$car1,$car1
ld [$np+$j],$npj ! np[j]
srlx $car0,32,$car0
add $acc0,$car1,$car1
add $j,4,$j ! j++
mov $tmp0,$acc0
st $car1,[$tp]
cmp $j,$num
mov $tmp1,$acc1
srlx $car1,32,$car1
bl %icc,.L1st
add $tp,4,$tp ! tp++
!.L1st
mulx $apj,$mul0,$tmp0 !epilogue!
mulx $npj,$mul1,$tmp1
add $acc0,$car0,$car0
and $car0,$mask,$acc0
add $acc1,$car1,$car1
srlx $car0,32,$car0
add $acc0,$car1,$car1
st $car1,[$tp]
srlx $car1,32,$car1
add $tmp0,$car0,$car0
and $car0,$mask,$acc0
add $tmp1,$car1,$car1
srlx $car0,32,$car0
add $acc0,$car1,$car1
st $car1,[$tp+4]
srlx $car1,32,$car1
add $car0,$car1,$car1
st $car1,[$tp+8]
srlx $car1,32,$car2
mov 4,$i ! i++
ld [$bp+4],$mul0 ! bp[1]
.Louter:
add %sp,$bias+$frame,$tp
ld [$ap],$car0 ! ap[0]
ld [$ap+4],$apj ! ap[1]
ld [$np],$car1 ! np[0]
ld [$np+4],$npj ! np[1]
ld [$tp],$tmp1 ! tp[0]
ld [$tp+4],$tpj ! tp[1]
mov 12,$j
mulx $car0,$mul0,$car0
mulx $apj,$mul0,$tmp0 !prologue!
add $tmp1,$car0,$car0
ld [$ap+8],$apj !prologue!
and $car0,$mask,$acc0
mulx $n0,$acc0,$mul1
and $mul1,$mask,$mul1
mulx $car1,$mul1,$car1
mulx $npj,$mul1,$acc1 !prologue!
srlx $car0,32,$car0
add $acc0,$car1,$car1
ld [$np+8],$npj !prologue!
srlx $car1,32,$car1
mov $tmp0,$acc0 !prologue!
.Linner:
mulx $apj,$mul0,$tmp0
mulx $npj,$mul1,$tmp1
add $tpj,$car0,$car0
ld [$ap+$j],$apj ! ap[j]
add $acc0,$car0,$car0
add $acc1,$car1,$car1
ld [$np+$j],$npj ! np[j]
and $car0,$mask,$acc0
ld [$tp+8],$tpj ! tp[j]
srlx $car0,32,$car0
add $acc0,$car1,$car1
add $j,4,$j ! j++
mov $tmp0,$acc0
st $car1,[$tp] ! tp[j-1]
srlx $car1,32,$car1
mov $tmp1,$acc1
cmp $j,$num
bl %icc,.Linner
add $tp,4,$tp ! tp++
!.Linner
mulx $apj,$mul0,$tmp0 !epilogue!
mulx $npj,$mul1,$tmp1
add $tpj,$car0,$car0
add $acc0,$car0,$car0
ld [$tp+8],$tpj ! tp[j]
and $car0,$mask,$acc0
add $acc1,$car1,$car1
srlx $car0,32,$car0
add $acc0,$car1,$car1
st $car1,[$tp] ! tp[j-1]
srlx $car1,32,$car1
add $tpj,$car0,$car0
add $tmp0,$car0,$car0
and $car0,$mask,$acc0
add $tmp1,$car1,$car1
add $acc0,$car1,$car1
st $car1,[$tp+4] ! tp[j-1]
srlx $car0,32,$car0
add $i,4,$i ! i++
srlx $car1,32,$car1
add $car0,$car1,$car1
cmp $i,$num
add $car2,$car1,$car1
st $car1,[$tp+8]
srlx $car1,32,$car2
bl,a %icc,.Louter
ld [$bp+$i],$mul0 ! bp[i]
!.Louter
add $tp,12,$tp
.Ltail:
add $np,$num,$np
add $rp,$num,$rp
sub %g0,$num,%o7 ! k=-num
ba .Lsub
subcc %g0,%g0,%g0 ! clear %icc.c
.align 16
.Lsub:
ld [$tp+%o7],%o0
ld [$np+%o7],%o1
subccc %o0,%o1,%o1 ! tp[j]-np[j]
add $rp,%o7,$i
add %o7,4,%o7
brnz %o7,.Lsub
st %o1,[$i]
subccc $car2,0,$car2 ! handle upmost overflow bit
sub %g0,$num,%o7
.Lcopy:
ld [$tp+%o7],%o1 ! conditional copy
ld [$rp+%o7],%o0
st %g0,[$tp+%o7] ! zap tp
movcs %icc,%o1,%o0
st %o0,[$rp+%o7]
add %o7,4,%o7
brnz %o7,.Lcopy
nop
mov 1,%i0
ret
restore
___
########
######## .Lbn_sqr_mont gives up to 20% *overall* improvement over
######## code without following dedicated squaring procedure.
########
$sbit="%o5";
$code.=<<___;
.align 32
.Lbn_sqr_mont:
mulx $mul0,$mul0,$car0 ! ap[0]*ap[0]
mulx $apj,$mul0,$tmp0 !prologue!
and $car0,$mask,$acc0
add %sp,$bias+$frame,$tp
ld [$ap+8],$apj !prologue!
mulx $n0,$acc0,$mul1 ! "t[0]"*n0
srlx $car0,32,$car0
and $mul1,$mask,$mul1
mulx $car1,$mul1,$car1 ! np[0]*"t[0]"*n0
mulx $npj,$mul1,$acc1 !prologue!
and $car0,1,$sbit
ld [$np+8],$npj !prologue!
srlx $car0,1,$car0
add $acc0,$car1,$car1
srlx $car1,32,$car1
mov $tmp0,$acc0 !prologue!
.Lsqr_1st:
mulx $apj,$mul0,$tmp0
mulx $npj,$mul1,$tmp1
add $acc0,$car0,$car0 ! ap[j]*a0+c0
add $acc1,$car1,$car1
ld [$ap+$j],$apj ! ap[j]
and $car0,$mask,$acc0
ld [$np+$j],$npj ! np[j]
srlx $car0,32,$car0
add $acc0,$acc0,$acc0
or $sbit,$acc0,$acc0
mov $tmp1,$acc1
srlx $acc0,32,$sbit
add $j,4,$j ! j++
and $acc0,$mask,$acc0
cmp $j,$num
add $acc0,$car1,$car1
st $car1,[$tp]
mov $tmp0,$acc0
srlx $car1,32,$car1
bl %icc,.Lsqr_1st
add $tp,4,$tp ! tp++
!.Lsqr_1st
mulx $apj,$mul0,$tmp0 ! epilogue
mulx $npj,$mul1,$tmp1
add $acc0,$car0,$car0 ! ap[j]*a0+c0
add $acc1,$car1,$car1
and $car0,$mask,$acc0
srlx $car0,32,$car0
add $acc0,$acc0,$acc0
or $sbit,$acc0,$acc0
srlx $acc0,32,$sbit
and $acc0,$mask,$acc0
add $acc0,$car1,$car1
st $car1,[$tp]
srlx $car1,32,$car1
add $tmp0,$car0,$car0 ! ap[j]*a0+c0
add $tmp1,$car1,$car1
and $car0,$mask,$acc0
srlx $car0,32,$car0
add $acc0,$acc0,$acc0
or $sbit,$acc0,$acc0
srlx $acc0,32,$sbit
and $acc0,$mask,$acc0
add $acc0,$car1,$car1
st $car1,[$tp+4]
srlx $car1,32,$car1
add $car0,$car0,$car0
or $sbit,$car0,$car0
add $car0,$car1,$car1
st $car1,[$tp+8]
srlx $car1,32,$car2
ld [%sp+$bias+$frame],$tmp0 ! tp[0]
ld [%sp+$bias+$frame+4],$tmp1 ! tp[1]
ld [%sp+$bias+$frame+8],$tpj ! tp[2]
ld [$ap+4],$mul0 ! ap[1]
ld [$ap+8],$apj ! ap[2]
ld [$np],$car1 ! np[0]
ld [$np+4],$npj ! np[1]
mulx $n0,$tmp0,$mul1
mulx $mul0,$mul0,$car0
and $mul1,$mask,$mul1
mulx $car1,$mul1,$car1
mulx $npj,$mul1,$acc1
add $tmp0,$car1,$car1
and $car0,$mask,$acc0
ld [$np+8],$npj ! np[2]
srlx $car1,32,$car1
add $tmp1,$car1,$car1
srlx $car0,32,$car0
add $acc0,$car1,$car1
and $car0,1,$sbit
add $acc1,$car1,$car1
srlx $car0,1,$car0
mov 12,$j
st $car1,[%sp+$bias+$frame] ! tp[0]=
srlx $car1,32,$car1
add %sp,$bias+$frame+4,$tp
.Lsqr_2nd:
mulx $apj,$mul0,$acc0
mulx $npj,$mul1,$acc1
add $acc0,$car0,$car0
add $tpj,$sbit,$sbit
ld [$ap+$j],$apj ! ap[j]
and $car0,$mask,$acc0
ld [$np+$j],$npj ! np[j]
srlx $car0,32,$car0
add $acc1,$car1,$car1
ld [$tp+8],$tpj ! tp[j]
add $acc0,$acc0,$acc0
add $j,4,$j ! j++
add $sbit,$acc0,$acc0
srlx $acc0,32,$sbit
and $acc0,$mask,$acc0
cmp $j,$num
add $acc0,$car1,$car1
st $car1,[$tp] ! tp[j-1]
srlx $car1,32,$car1
bl %icc,.Lsqr_2nd
add $tp,4,$tp ! tp++
!.Lsqr_2nd
mulx $apj,$mul0,$acc0
mulx $npj,$mul1,$acc1
add $acc0,$car0,$car0
add $tpj,$sbit,$sbit
and $car0,$mask,$acc0
srlx $car0,32,$car0
add $acc1,$car1,$car1
add $acc0,$acc0,$acc0
add $sbit,$acc0,$acc0
srlx $acc0,32,$sbit
and $acc0,$mask,$acc0
add $acc0,$car1,$car1
st $car1,[$tp] ! tp[j-1]
srlx $car1,32,$car1
add $car0,$car0,$car0
add $sbit,$car0,$car0
add $car0,$car1,$car1
add $car2,$car1,$car1
st $car1,[$tp+4]
srlx $car1,32,$car2
ld [%sp+$bias+$frame],$tmp1 ! tp[0]
ld [%sp+$bias+$frame+4],$tpj ! tp[1]
ld [$ap+8],$mul0 ! ap[2]
ld [$np],$car1 ! np[0]
ld [$np+4],$npj ! np[1]
mulx $n0,$tmp1,$mul1
and $mul1,$mask,$mul1
mov 8,$i
mulx $mul0,$mul0,$car0
mulx $car1,$mul1,$car1
and $car0,$mask,$acc0
add $tmp1,$car1,$car1
srlx $car0,32,$car0
add %sp,$bias+$frame,$tp
srlx $car1,32,$car1
and $car0,1,$sbit
srlx $car0,1,$car0
mov 4,$j
.Lsqr_outer:
.Lsqr_inner1:
mulx $npj,$mul1,$acc1
add $tpj,$car1,$car1
add $j,4,$j
ld [$tp+8],$tpj
cmp $j,$i
add $acc1,$car1,$car1
ld [$np+$j],$npj
st $car1,[$tp]
srlx $car1,32,$car1
bl %icc,.Lsqr_inner1
add $tp,4,$tp
!.Lsqr_inner1
add $j,4,$j
ld [$ap+$j],$apj ! ap[j]
mulx $npj,$mul1,$acc1
add $tpj,$car1,$car1
ld [$np+$j],$npj ! np[j]
srlx $car1,32,$tmp0
and $car1,$mask,$car1
add $tmp0,$sbit,$sbit
add $acc0,$car1,$car1
ld [$tp+8],$tpj ! tp[j]
add $acc1,$car1,$car1
st $car1,[$tp]
srlx $car1,32,$car1
add $j,4,$j
cmp $j,$num
be,pn %icc,.Lsqr_no_inner2
add $tp,4,$tp
.Lsqr_inner2:
mulx $apj,$mul0,$acc0
mulx $npj,$mul1,$acc1
add $tpj,$sbit,$sbit
add $acc0,$car0,$car0
ld [$ap+$j],$apj ! ap[j]
and $car0,$mask,$acc0
ld [$np+$j],$npj ! np[j]
srlx $car0,32,$car0
add $acc0,$acc0,$acc0
ld [$tp+8],$tpj ! tp[j]
add $sbit,$acc0,$acc0
add $j,4,$j ! j++
srlx $acc0,32,$sbit
and $acc0,$mask,$acc0
cmp $j,$num
add $acc0,$car1,$car1
add $acc1,$car1,$car1
st $car1,[$tp] ! tp[j-1]
srlx $car1,32,$car1
bl %icc,.Lsqr_inner2
add $tp,4,$tp ! tp++
.Lsqr_no_inner2:
mulx $apj,$mul0,$acc0
mulx $npj,$mul1,$acc1
add $tpj,$sbit,$sbit
add $acc0,$car0,$car0
and $car0,$mask,$acc0
srlx $car0,32,$car0
add $acc0,$acc0,$acc0
add $sbit,$acc0,$acc0
srlx $acc0,32,$sbit
and $acc0,$mask,$acc0
add $acc0,$car1,$car1
add $acc1,$car1,$car1
st $car1,[$tp] ! tp[j-1]
srlx $car1,32,$car1
add $car0,$car0,$car0
add $sbit,$car0,$car0
add $car0,$car1,$car1
add $car2,$car1,$car1
st $car1,[$tp+4]
srlx $car1,32,$car2
add $i,4,$i ! i++
ld [%sp+$bias+$frame],$tmp1 ! tp[0]
ld [%sp+$bias+$frame+4],$tpj ! tp[1]
ld [$ap+$i],$mul0 ! ap[j]
ld [$np],$car1 ! np[0]
ld [$np+4],$npj ! np[1]
mulx $n0,$tmp1,$mul1
and $mul1,$mask,$mul1
add $i,4,$tmp0
mulx $mul0,$mul0,$car0
mulx $car1,$mul1,$car1
and $car0,$mask,$acc0
add $tmp1,$car1,$car1
srlx $car0,32,$car0
add %sp,$bias+$frame,$tp
srlx $car1,32,$car1
and $car0,1,$sbit
srlx $car0,1,$car0
cmp $tmp0,$num ! i<num-1
bl %icc,.Lsqr_outer
mov 4,$j
.Lsqr_last:
mulx $npj,$mul1,$acc1
add $tpj,$car1,$car1
add $j,4,$j
ld [$tp+8],$tpj
cmp $j,$i
add $acc1,$car1,$car1
ld [$np+$j],$npj
st $car1,[$tp]
srlx $car1,32,$car1
bl %icc,.Lsqr_last
add $tp,4,$tp
!.Lsqr_last
mulx $npj,$mul1,$acc1
add $tpj,$acc0,$acc0
srlx $acc0,32,$tmp0
and $acc0,$mask,$acc0
add $tmp0,$sbit,$sbit
add $acc0,$car1,$car1
add $acc1,$car1,$car1
st $car1,[$tp]
srlx $car1,32,$car1
add $car0,$car0,$car0 ! recover $car0
add $sbit,$car0,$car0
add $car0,$car1,$car1
add $car2,$car1,$car1
st $car1,[$tp+4]
srlx $car1,32,$car2
ba .Ltail
add $tp,8,$tp
.type $fname,#function
.size $fname,(.-$fname)
.asciz "Montgomery Multiplication for SPARCv9, CRYPTOGAMS by <appro\@openssl.org>"
.align 32
___
$code =~ s/\`([^\`]*)\`/eval($1)/gem;
print $code;
close STDOUT or die "error closing STDOUT: $!";
|
jens-maus/amissl
|
openssl/crypto/bn/asm/sparcv9-mont.pl
|
Perl
|
bsd-3-clause
| 14,168
|
//===-- LockFileWindows.cpp -----------------------------------------------===//
//
// 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 "lldb/Host/windows/LockFileWindows.h"
#include <io.h>
using namespace lldb;
using namespace lldb_private;
namespace {
Status fileLock(HANDLE file_handle, DWORD flags, const uint64_t start,
const uint64_t len) {
if (start != 0)
return Status("Non-zero start lock regions are not supported");
OVERLAPPED overlapped = {};
if (!::LockFileEx(file_handle, flags, 0, len, 0, &overlapped) &&
::GetLastError() != ERROR_IO_PENDING)
return Status(::GetLastError(), eErrorTypeWin32);
DWORD bytes;
if (!::GetOverlappedResult(file_handle, &overlapped, &bytes, TRUE))
return Status(::GetLastError(), eErrorTypeWin32);
return Status();
}
} // namespace
LockFileWindows::LockFileWindows(int fd)
: LockFileBase(fd), m_file(reinterpret_cast<HANDLE>(_get_osfhandle(fd))) {}
LockFileWindows::~LockFileWindows() { Unlock(); }
bool LockFileWindows::IsValidFile() const {
return LockFileBase::IsValidFile() && m_file != INVALID_HANDLE_VALUE;
}
Status LockFileWindows::DoWriteLock(const uint64_t start, const uint64_t len) {
return fileLock(m_file, LOCKFILE_EXCLUSIVE_LOCK, start, len);
}
Status LockFileWindows::DoTryWriteLock(const uint64_t start,
const uint64_t len) {
return fileLock(m_file, LOCKFILE_EXCLUSIVE_LOCK | LOCKFILE_FAIL_IMMEDIATELY,
start, len);
}
Status LockFileWindows::DoReadLock(const uint64_t start, const uint64_t len) {
return fileLock(m_file, 0, start, len);
}
Status LockFileWindows::DoTryReadLock(const uint64_t start,
const uint64_t len) {
return fileLock(m_file, LOCKFILE_FAIL_IMMEDIATELY, start, len);
}
Status LockFileWindows::DoUnlock() {
OVERLAPPED overlapped = {};
if (!::UnlockFileEx(m_file, 0, m_len, 0, &overlapped) &&
::GetLastError() != ERROR_IO_PENDING)
return Status(::GetLastError(), eErrorTypeWin32);
DWORD bytes;
if (!::GetOverlappedResult(m_file, &overlapped, &bytes, TRUE))
return Status(::GetLastError(), eErrorTypeWin32);
return Status();
}
|
endlessm/chromium-browser
|
third_party/llvm/lldb/source/Host/windows/LockFileWindows.cpp
|
C++
|
bsd-3-clause
| 2,441
|
/*
* File: AbstractRelation.java
* Authors: Justin Basilico
* Company: Sandia National Laboratories
* Project: Cognitive Foundry
*
* Copyright March 18, 2009, Sandia Corporation.
* Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
* license for use of this work by or on behalf of the U.S. Government. Export
* of this program may require a license from the United States Government.
* See CopyrightHistory.txt for complete details.
*
*/
package gov.sandia.cognition.text.relation;
import gov.sandia.cognition.util.AbstractCloneableSerializable;
/**
* An abstract implementation of a relation between two objects. It holds
* pointers to the source and target objects.
*
* @param <SourceType> The type of the source object of the relation.
* @param <TargetType> The type of the target object of the relation.
* @author Justin Basilico
* @since 3.0
*/
public class AbstractRelation<SourceType, TargetType>
extends AbstractCloneableSerializable
{
/** The source object of the relation. */
protected SourceType source;
/** The target object of the relation. */
protected TargetType target;
/**
* Creates a new {@code AbstractRelation} with null source and target.
*/
public AbstractRelation()
{
this(null, null);
}
/**
* Creates a new {@code AbstractRelation} with the given source and target.
*
* @param source
* The source object of the relation.
* @param target
* The target object of the relation.
*/
public AbstractRelation(
final SourceType source,
final TargetType target)
{
super();
this.setSource(source);
this.setTarget(target);
}
/**
* Gets the source object of the relation.
*
* @return
* The source object of the relation.
*/
public SourceType getSource()
{
return this.source;
}
/**
* Sets the source object of the relation.
*
* @param source
* The source object of the relation.
*/
protected void setSource(
final SourceType source)
{
this.source = source;
}
/**
* Sets the target object of the relation.
*
* @return
* The target object of the relation.
*/
public TargetType getTarget()
{
return this.target;
}
/**
* Sets the target object of the relation.
*
* @param target
* The target object of the relation.
*/
protected void setTarget(
final TargetType target)
{
this.target = target;
}
}
|
codeaudit/Foundry
|
Components/TextCore/Source/gov/sandia/cognition/text/relation/AbstractRelation.java
|
Java
|
bsd-3-clause
| 2,719
|
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Photos';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="photo-index">
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?= Html::a('Create Photo', ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'size',
[
'header'=>'User',
'value'=>function($model,$key,$index,$column)
{
if ($model->created_by >0)
return \app\models\User::findOne($model->created_by)->username;
}
],
[
'header'=>'Location',
'value'=>function($model,$key,$index,$column)
{
if ($model->gpslat && $model->gpslong){
$x= \app\widgets\LeafletWidget::widget(['gpslat'=>$model->gpslat,'gpslong'=>$model->gpslong]);
return $x;
}
else
return "Location not set";
},
'format'=>'html'
],
[
'header'=>'Image',
'value'=>function($model,$key,$index,$column)
{ return '<img src="'.$model->url.'"/>' ;
},
'format'=>'html'
],
// 'url:ntext',
// 'path:ntext',
// 'filename:ntext',
// 'gpslat',
// 'gpslong',
// 'loc',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
</div>
|
ranvirp/discom
|
views/photo/index.php
|
PHP
|
bsd-3-clause
| 1,672
|
/*
* Copyright (C) 2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ConsoleTypes_h
#define ConsoleTypes_h
namespace WebCore {
enum MessageSource {
XMLMessageSource,
JSMessageSource,
NetworkMessageSource,
ConsoleAPIMessageSource,
StorageMessageSource,
AppCacheMessageSource,
RenderingMessageSource,
CSSMessageSource,
SecurityMessageSource,
OtherMessageSource,
DeprecationMessageSource,
};
enum MessageLevel {
DebugMessageLevel = 4,
LogMessageLevel = 1,
WarningMessageLevel = 2,
ErrorMessageLevel = 3
};
} // namespace WebCore
#endif // ConsoleTypes_h
|
windyuuy/opera
|
chromium/src/third_party/WebKit/Source/core/page/ConsoleTypes.h
|
C
|
bsd-3-clause
| 1,911
|
<?php
/**
* @copyright Copyright (c) 2013 2amigOS! Consulting Group LLC
* @link http://2amigos.us
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
*/
/**
* WhPlugin class file.
* Extends the plugins with common shared methods.
*
* @author Antonio Ramirez <amigo.cobos@gmail.com>
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @package yiiwheels.behaviors
*/
class WhPlugin extends CBehavior
{
protected $_assetsUrl;
protected static $_api;
protected static $_wheels;
/**
* Returns
*
* @param $path
*
* @return mixed
*/
public function getAssetsUrl($path)
{
if (isset($this->_assetsUrl)) {
return $this->_assetsUrl;
} else {
$forceCopyAssets = $this->getApi()->forceCopyAssets;
$assetsUrl = Yii::app()->assetManager->publish($path, false, -1, $forceCopyAssets);
return $this->_assetsUrl = $assetsUrl;
}
}
/**
* @return TbApi
*/
public function getApi()
{
if (self::$_api === null) {
self::$_api = self::getYiiWheels()->getApi();
}
return self::$_api;
}
/**
* Returns the main component
* @return YiiWheels
*/
public function getYiiWheels()
{
if (self::$_wheels === null) {
self::$_wheels = Yii::app()->getComponent('yiiwheels');
}
return self::$_wheels;
}
}
|
reedboat/yiiwheels
|
behaviors/WhPlugin.php
|
PHP
|
bsd-3-clause
| 1,496
|
/*
* Copyright (C) 2013 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY GOOGLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "modules/mediastream/RTCDTMFSender.h"
#include "bindings/core/v8/ExceptionMessages.h"
#include "bindings/core/v8/ExceptionState.h"
#include "core/dom/ExceptionCode.h"
#include "core/dom/ExecutionContext.h"
#include "modules/mediastream/MediaStreamTrack.h"
#include "modules/mediastream/RTCDTMFToneChangeEvent.h"
#include "public/platform/WebMediaStreamTrack.h"
#include "public/platform/WebRTCDTMFSenderHandler.h"
#include "public/platform/WebRTCPeerConnectionHandler.h"
namespace blink {
static const int minToneDurationMs = 70;
static const int defaultToneDurationMs = 100;
static const int maxToneDurationMs = 6000;
static const int minInterToneGapMs = 50;
static const int defaultInterToneGapMs = 50;
RTCDTMFSender* RTCDTMFSender::create(ExecutionContext* context, WebRTCPeerConnectionHandler* peerConnectionHandler, MediaStreamTrack* track, ExceptionState& exceptionState)
{
OwnPtr<WebRTCDTMFSenderHandler> handler = adoptPtr(peerConnectionHandler->createDTMFSender(track->component()));
if (!handler) {
exceptionState.throwDOMException(NotSupportedError, "The MediaStreamTrack provided is not an element of a MediaStream that's currently in the local streams set.");
return nullptr;
}
RTCDTMFSender* dtmfSender = new RTCDTMFSender(context, track, std::move(handler));
dtmfSender->suspendIfNeeded();
return dtmfSender;
}
RTCDTMFSender::RTCDTMFSender(ExecutionContext* context, MediaStreamTrack* track, PassOwnPtr<WebRTCDTMFSenderHandler> handler)
: ActiveDOMObject(context)
, m_track(track)
, m_duration(defaultToneDurationMs)
, m_interToneGap(defaultInterToneGapMs)
, m_handler(std::move(handler))
, m_stopped(false)
, m_scheduledEventTimer(this, &RTCDTMFSender::scheduledEventTimerFired)
{
ThreadState::current()->registerPreFinalizer(this);
m_handler->setClient(this);
}
RTCDTMFSender::~RTCDTMFSender()
{
}
void RTCDTMFSender::dispose()
{
// Promptly clears a raw reference from content/ to an on-heap object
// so that content/ doesn't access it in a lazy sweeping phase.
m_handler->setClient(nullptr);
m_handler.clear();
}
bool RTCDTMFSender::canInsertDTMF() const
{
return m_handler->canInsertDTMF();
}
MediaStreamTrack* RTCDTMFSender::track() const
{
return m_track.get();
}
String RTCDTMFSender::toneBuffer() const
{
return m_handler->currentToneBuffer();
}
void RTCDTMFSender::insertDTMF(const String& tones, ExceptionState& exceptionState)
{
insertDTMF(tones, defaultToneDurationMs, defaultInterToneGapMs, exceptionState);
}
void RTCDTMFSender::insertDTMF(const String& tones, int duration, ExceptionState& exceptionState)
{
insertDTMF(tones, duration, defaultInterToneGapMs, exceptionState);
}
void RTCDTMFSender::insertDTMF(const String& tones, int duration, int interToneGap, ExceptionState& exceptionState)
{
if (!canInsertDTMF()) {
exceptionState.throwDOMException(NotSupportedError, "The 'canInsertDTMF' attribute is false: this sender cannot send DTMF.");
return;
}
if (duration > maxToneDurationMs || duration < minToneDurationMs) {
exceptionState.throwDOMException(SyntaxError, ExceptionMessages::indexOutsideRange("duration", duration, minToneDurationMs, ExceptionMessages::ExclusiveBound, maxToneDurationMs, ExceptionMessages::ExclusiveBound));
return;
}
if (interToneGap < minInterToneGapMs) {
exceptionState.throwDOMException(SyntaxError, ExceptionMessages::indexExceedsMinimumBound("intertone gap", interToneGap, minInterToneGapMs));
return;
}
m_duration = duration;
m_interToneGap = interToneGap;
if (!m_handler->insertDTMF(tones, m_duration, m_interToneGap))
exceptionState.throwDOMException(SyntaxError, "Could not send provided tones, '" + tones + "'.");
}
void RTCDTMFSender::didPlayTone(const WebString& tone)
{
scheduleDispatchEvent(RTCDTMFToneChangeEvent::create(tone));
}
const AtomicString& RTCDTMFSender::interfaceName() const
{
return EventTargetNames::RTCDTMFSender;
}
ExecutionContext* RTCDTMFSender::getExecutionContext() const
{
return ActiveDOMObject::getExecutionContext();
}
void RTCDTMFSender::stop()
{
m_stopped = true;
m_handler->setClient(nullptr);
}
void RTCDTMFSender::scheduleDispatchEvent(Event* event)
{
m_scheduledEvents.append(event);
if (!m_scheduledEventTimer.isActive())
m_scheduledEventTimer.startOneShot(0, BLINK_FROM_HERE);
}
void RTCDTMFSender::scheduledEventTimerFired(Timer<RTCDTMFSender>*)
{
if (m_stopped)
return;
HeapVector<Member<Event>> events;
events.swap(m_scheduledEvents);
HeapVector<Member<Event>>::iterator it = events.begin();
for (; it != events.end(); ++it)
dispatchEvent((*it).release());
}
DEFINE_TRACE(RTCDTMFSender)
{
visitor->trace(m_track);
visitor->trace(m_scheduledEvents);
EventTargetWithInlineData::trace(visitor);
ActiveDOMObject::trace(visitor);
}
} // namespace blink
|
axinging/chromium-crosswalk
|
third_party/WebKit/Source/modules/mediastream/RTCDTMFSender.cpp
|
C++
|
bsd-3-clause
| 6,328
|
// Copyright (c) 2015, Baidu.com, Inc. All Rights Reserved
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef TERA_MASTER_MASTER_IMPL_H_
#define TERA_MASTER_MASTER_IMPL_H_
#include <stdint.h>
#include <semaphore.h>
#include <string>
#include <vector>
#include "common/event.h"
#include "common/base/scoped_ptr.h"
#include "common/mutex.h"
#include "common/thread_pool.h"
#include "gflags/gflags.h"
#include "master/tablet_manager.h"
#include "master/tabletnode_manager.h"
#include "master/gc_strategy.h"
#include "proto/master_rpc.pb.h"
#include "proto/table_meta.pb.h"
#include "sdk/client_impl.h"
#include "sdk/table_impl.h"
DECLARE_int32(tera_master_impl_retry_times);
namespace tera {
class LoadTabletRequest;
class LoadTabletResponse;
class UnloadTabletRequest;
class UnloadTabletResponse;
class SplitTabletRequest;
class SplitTabletResponse;
class MergeTabletRequest;
class MergeTabletResponse;
class QueryRequest;
class QueryResponse;
class WriteTabletRequest;
class WriteTabletResponse;
class ScanTabletRequest;
class ScanTabletResponse;
namespace master {
class MasterZkAdapterBase;
class MetaTable;
class Scheduler;
class TabletManager;
class TabletNodeManager;
class MasterImpl {
public:
enum MasterStatus {
kNotInited = kMasterNotInited,
kIsBusy = kMasterIsBusy,
kIsSecondary = kMasterIsSecondary,
kIsReadonly = kMasterIsReadonly,
kIsRunning = kMasterIsRunning,
kOnRestore = kMasterOnRestore,
kOnWait = kMasterOnWait
};
MasterImpl();
~MasterImpl();
bool Init();
bool Restore(const std::map<std::string, std::string>& tabletnode_list);
void GetSnapshot(const GetSnapshotRequest* request,
GetSnapshotResponse* response,
google::protobuf::Closure* done);
void DelSnapshot(const DelSnapshotRequest* request,
DelSnapshotResponse* response,
google::protobuf::Closure* done);
void Rollback(const RollbackRequest* request,
RollbackResponse* response,
google::protobuf::Closure* done);
void CreateTable(const CreateTableRequest* request,
CreateTableResponse* response,
google::protobuf::Closure* done);
void DeleteTable(const DeleteTableRequest* request,
DeleteTableResponse* response,
google::protobuf::Closure* done);
void DisableTable(const DisableTableRequest* request,
DisableTableResponse* response,
google::protobuf::Closure* done);
void EnableTable(const EnableTableRequest* request,
EnableTableResponse* response,
google::protobuf::Closure* done);
void UpdateTable(const UpdateTableRequest* request,
UpdateTableResponse* response,
google::protobuf::Closure* done);
void CompactTable(const CompactTableRequest* request,
CompactTableResponse* response,
google::protobuf::Closure* done);
void SearchTable(const SearchTableRequest* request,
SearchTableResponse* response,
google::protobuf::Closure* done);
void ShowTables(const ShowTablesRequest* request,
ShowTablesResponse* response,
google::protobuf::Closure* done);
void ShowTabletNodes(const ShowTabletNodesRequest* request,
ShowTabletNodesResponse* response,
google::protobuf::Closure* done);
void RenameTable(const RenameTableRequest* request,
RenameTableResponse* response,
google::protobuf::Closure* done);
void CmdCtrl(const CmdCtrlRequest* request,
CmdCtrlResponse* response);
void RefreshTabletNodeList(const std::map<std::string, std::string>& ts_node_list);
bool SetMasterStatus(const MasterStatus& new_status,
MasterStatus* old_status = NULL);
MasterStatus GetMasterStatus();
void EnableQueryTabletNodeTimer();
void DisableQueryTabletNodeTimer();
bool GetMetaTabletAddr(std::string* addr);
void TryLoadTablet(TabletPtr tablet, std::string addr = "");
private:
typedef Closure<void, SnapshotRequest*, SnapshotResponse*, bool, int> SnapshotClosure;
typedef Closure<void, SnapshotRollbackRequest*, SnapshotRollbackResponse*, bool, int> RollbackClosure;
typedef Closure<void, ReleaseSnapshotRequest*, ReleaseSnapshotResponse*, bool, int> DelSnapshotClosure;
typedef Closure<void, QueryRequest*, QueryResponse*, bool, int> QueryClosure;
typedef Closure<void, LoadTabletRequest*, LoadTabletResponse*, bool, int> LoadClosure;
typedef Closure<void, UnloadTabletRequest*, UnloadTabletResponse*, bool, int> UnloadClosure;
typedef Closure<void, SplitTabletRequest*, SplitTabletResponse*, bool, int> SplitClosure;
typedef Closure<void, WriteTabletRequest*, WriteTabletResponse*, bool, int> WriteClosure;
typedef Closure<void, ScanTabletRequest*, ScanTabletResponse*, bool, int> ScanClosure;
typedef boost::function<void (std::string*, std::string*)> ToMetaFunc;
enum MetaTaskType {
kWrite = 0,
kScan,
kRepair
};
struct MetaTask {
MetaTaskType m_type;
};
struct WriteTask {
MetaTaskType m_type;
WriteClosure* m_done;
std::vector<ToMetaFunc> m_meta_entries;
bool m_is_delete;
};
struct ScanTask {
MetaTaskType m_type;
ScanClosure* m_done;
std::string m_table_name;
std::string m_tablet_key_start;
std::string m_tablet_key_end;
};
struct RepairTask {
MetaTaskType m_type;
WriteClosure* m_done;
TabletPtr m_tablet;
ScanTabletResponse* m_scan_resp;
};
struct SnapshotTask {
const GetSnapshotRequest* request;
GetSnapshotResponse* response;
google::protobuf::Closure* done;
TablePtr table;
std::vector<TabletPtr> tablets;
std::vector<uint64_t> snapshot_id;
int task_num;
int finish_num;
mutable Mutex mutex;
bool aborted;
};
struct RollbackTask {
const RollbackRequest* request;
RollbackResponse* response;
google::protobuf::Closure* done;
TablePtr table;
std::vector<TabletPtr> tablets;
std::vector<uint64_t> rollback_points;
int task_num;
int finish_num;
mutable Mutex mutex;
bool aborted;
};
void SafeModeCmdCtrl(const CmdCtrlRequest* request,
CmdCtrlResponse* response);
void TabletCmdCtrl(const CmdCtrlRequest* request,
CmdCtrlResponse* response);
void MetaCmdCtrl(const CmdCtrlRequest* request,
CmdCtrlResponse* response);
bool LoadTabletSync(const TabletMeta& meta,
const TableSchema& schema,
StatusCode* status);
bool UnloadTabletSync(const std::string& table_name,
const std::string& key_start,
const std::string& key_end,
const std::string& server_addr, StatusCode* status);
void UnloadTabletAsync(std::string table_name, std::string key_start,
std::string server_addr, int32_t retry);
void RetryLoadTablet(TabletPtr tablet, int32_t retry_times);
void RetryUnloadTablet(TabletPtr tablet, int32_t retry_times);
bool TrySplitTablet(TabletPtr tablet);
bool TryMergeTablet(TabletPtr tablet);
void TryMoveTablet(TabletPtr tablet, const std::string& server_addr = "");
void TryReleaseCache(bool enbaled_debug = false);
void ReleaseCacheWrapper();
void EnableReleaseCacheTimer();
void DisableReleaseCacheTimer();
void EnableLoadBalanceTimer();
void DisableLoadBalanceTimer();
void InitAsync();
bool CreateAndLoadTable(const std::string& table_name,
bool compress, StoreMedium store, StatusCode* status);
void LoadTabletAsync(TabletPtr tablet, LoadClosure* done,
uint64_t timer_id = 0);
void LoadTabletCallback(TabletPtr tablet, int32_t retry,
LoadTabletRequest* request,
LoadTabletResponse* response, bool failed,
int error_code);
bool RemoveTablet(const TabletMeta& meta, StatusCode* status);
void UnloadTabletAsync(TabletPtr tablet, UnloadClosure* done);
void UnloadTabletCallback(TabletPtr tablet, int32_t retry,
UnloadTabletRequest* request,
UnloadTabletResponse* response, bool failed,
int error_code);
void MoveTabletCallback(TabletPtr tablet, int32_t retry,
UnloadTabletRequest* request,
UnloadTabletResponse* response,
bool failed, int error_code);
void DeleteTabletCallback(TabletPtr tablet, int32_t retry,
UnloadTabletRequest* request,
UnloadTabletResponse* response,
bool failed, int error_code);
void ScheduleLoadBalance();
void LoadBalance();
uint32_t LoadBalance(Scheduler* scheduler,
uint32_t max_move_num, uint32_t max_round_num,
std::vector<TabletNodePtr>& tabletnode_list,
std::vector<TabletPtr>& tablet_list,
const std::string& table_name = "");
bool TabletNodeLoadBalance(TabletNodePtr tabletnode, Scheduler* scheduler,
const std::vector<TabletPtr>& tablet_list,
const std::string& table_name = "");
void GetSnapshotAsync(TabletPtr tablet, int32_t timeout,
SnapshotClosure* done);
void GetSnapshotCallback(int32_t tablet_id, SnapshotTask* task,
SnapshotRequest* master_request,
SnapshotResponse* master_response,
bool failed, int error_code);
void AddSnapshotCallback(TablePtr table,
std::vector<TabletPtr> tablets,
int32_t retry_times,
const GetSnapshotRequest* rpc_request,
GetSnapshotResponse* rpc_response,
google::protobuf::Closure* rpc_done,
WriteTabletRequest* request,
WriteTabletResponse* response,
bool failed, int error_code);
void DelSnapshotCallback(TablePtr table,
std::vector<TabletPtr> tablets,
int32_t retry_times,
const DelSnapshotRequest* rpc_request,
DelSnapshotResponse* rpc_response,
google::protobuf::Closure* rpc_done,
WriteTabletRequest* request,
WriteTabletResponse* response,
bool failed, int error_code);
void RollbackAsync(TabletPtr tablet, uint64_t snapshot_id, int32_t timeout,
RollbackClosure* done);
void RollbackCallback(int32_t tablet_id, RollbackTask* task,
SnapshotRollbackRequest* master_request,
SnapshotRollbackResponse* master_response,
bool failed, int error_code);
void AddRollbackCallback(TablePtr table,
std::vector<TabletPtr> tablets,
int32_t retry_times,
const RollbackRequest* rpc_request,
RollbackResponse* rpc_response,
google::protobuf::Closure* rpc_done,
WriteTabletRequest* request,
WriteTabletResponse* response,
bool failed, int error_code);
void ScheduleQueryTabletNode();
void QueryTabletNode();
void QueryTabletNodeAsync(std::string addr, int32_t timeout,
bool is_gc, QueryClosure* done);
void ReleaseSnpashot(TabletPtr tablet, uint64_t snapshot);
void ReleaseSnapshotCallback(ReleaseSnapshotRequest* request,
ReleaseSnapshotResponse* response,
bool failed,
int error_code);
void ClearUnusedSnapshots(TabletPtr tablet, const TabletMeta& meta);
void QueryTabletNodeCallback(std::string addr, QueryRequest* request,
QueryResponse* response, bool failed,
int error_code);
void CollectTabletInfoCallback(std::string addr,
std::vector<TabletMeta>* tablet_list,
sem_t* finish_counter, Mutex* mutex,
QueryRequest* request,
QueryResponse* response, bool failed,
int error_code);
void TabletNodeRecoveryCallback(std::string addr, QueryRequest* request,
QueryResponse* response, bool failed,
int error_code);
void RetryCollectTabletInfo(std::string addr,
std::vector<TabletMeta>* tablet_list,
sem_t* finish_counter, Mutex* mutex);
void RetryQueryNewTabletNode(std::string addr);
void SplitTabletAsync(TabletPtr tablet);
void SplitTabletCallback(TabletPtr tablet, SplitTabletRequest* request,
SplitTabletResponse* response, bool failed,
int error_code);
void MergeTabletAsync(TabletPtr tablet_p1, TabletPtr tablet_p2);
void MergeTabletAsyncPhase2(TabletPtr tablet_p1, TabletPtr tablet_p2);
void MergeTabletUnloadCallback(TabletPtr tablet, TabletPtr tablet2, Mutex* mutex,
UnloadTabletRequest* request,
UnloadTabletResponse* response,
bool failed, int error_code);
void MergeTabletWriteMetaCallback(TabletMeta new_meta, TabletPtr tablet_p1,
TabletPtr tablet_p2, int32_t retry_times,
WriteTabletRequest* request,
WriteTabletResponse* response,
bool failed, int error_code);
void MergeTabletFailed(TabletPtr tablet_p1, TabletPtr tablet_p2);
void BatchWriteMetaTableAsync(ToMetaFunc meta_entry, bool is_delete, WriteClosure* done);
void BatchWriteMetaTableAsync(std::vector<ToMetaFunc> meta_entries,
bool is_delete, WriteClosure* done);
void BatchWriteMetaTableAsync(TablePtr table,
const std::vector<TabletPtr>& tablets,
bool is_delete, WriteClosure* done);
void AddMetaCallback(TablePtr table, std::vector<TabletPtr> tablets,
int32_t retry_times,
const CreateTableRequest* rpc_request,
CreateTableResponse* rpc_response,
google::protobuf::Closure* rpc_done,
WriteTabletRequest* request,
WriteTabletResponse* response,
bool failed, int error_code);
void UpdateTableRecordForDisableCallback(TablePtr table, int32_t retry_times,
DisableTableResponse* rpc_response,
google::protobuf::Closure* rpc_done,
WriteTabletRequest* request,
WriteTabletResponse* response,
bool failed, int error_code);
void UpdateTableRecordForEnableCallback(TablePtr table, int32_t retry_times,
EnableTableResponse* rpc_response,
google::protobuf::Closure* rpc_done,
WriteTabletRequest* request,
WriteTabletResponse* response,
bool failed, int error_code);
void UpdateTableRecordForUpdateCallback(TablePtr table, int32_t retry_times,
UpdateTableResponse* rpc_response,
google::protobuf::Closure* rpc_done,
WriteTabletRequest* request,
WriteTabletResponse* response,
bool failed, int error_code);
void UpdateTableRecordForRenameCallback(TablePtr table, int32_t retry_times,
RenameTableResponse* rpc_response,
google::protobuf::Closure* rpc_done,
std::string old_alias,
std::string new_alias,
WriteTabletRequest* request,
WriteTabletResponse* response,
bool failed, int error_code
);
void UpdateTabletRecordCallback(TabletPtr tablet, int32_t retry_times,
WriteTabletRequest* request,
WriteTabletResponse* response,
bool failed, int error_code);
void UpdateMetaForLoadCallback(TabletPtr tablet, int32_t retry_times,
WriteTabletRequest* request,
WriteTabletResponse* response,
bool failed, int error_code);
void DeleteTableRecordCallback(TablePtr table, int32_t retry_times,
WriteTabletRequest* request,
WriteTabletResponse* response,
bool failed, int error_code);
void DeleteTabletRecordCallback(TabletPtr tablet, int32_t retry_times,
WriteTabletRequest* request,
WriteTabletResponse* response,
bool failed, int error_code);
void ScanMetaTableAsync(const std::string& table_name,
const std::string& tablet_key_start,
const std::string& tablet_key_end,
ScanClosure* done);
void ScanMetaCallbackForSplit(TabletPtr tablet,
ScanTabletRequest* request,
ScanTabletResponse* response,
bool failed, int error_code);
void RepairMetaTableAsync(TabletPtr tablet,
ScanTabletResponse* response,
WriteClosure* done);
void RepairMetaAfterSplitCallback(TabletPtr tablet,
ScanTabletResponse* scan_resp,
int32_t retry_times,
WriteTabletRequest* request,
WriteTabletResponse* response,
bool failed, int error_code);
// load metabale to master memory
bool LoadMetaTable(const std::string& meta_tablet_addr,
StatusCode* ret_status);
bool LoadMetaTableFromFile(const std::string& filename,
StatusCode* ret_status = NULL);
bool ReadFromStream(std::ifstream& ifs,
std::string* key,
std::string* value);
// load metatable on a tabletserver
bool LoadMetaTablet(std::string* server_addr);
void UnloadMetaTablet(const std::string& server_addr);
void AddTabletNode(const std::string& tabletnode_addr,
const std::string& tabletnode_id);
void DeleteTabletNode(const std::string& tabletnode_addr);
void TryKickTabletNode(const std::string& tabletnode_addr);
void KickTabletNode(TabletNodePtr node);
void TryEnterSafeMode();
void TryLeaveSafeMode();
bool EnterSafeMode(StatusCode* status = NULL);
bool LeaveSafeMode(StatusCode* status = NULL);
void TryMovePendingTablets(std::string tabletnode_addr);
void TryMovePendingTablet(TabletPtr tablet);
void MoveOffLineTablets(const std::vector<TabletPtr>& tablet_list);
double LiveNodeTabletRatio();
void LoadAllDeadNodeTablets();
void LoadAllOffLineTablets();
void CollectAllTabletInfo(const std::map<std::string, std::string>& tabletnode_list,
std::vector<TabletMeta>* tablet_list);
bool RestoreMetaTablet(const std::vector<TabletMeta>& tablet_list,
std::string* meta_tablet_addr);
void RestoreUserTablet(const std::vector<TabletMeta>& report_tablet_list);
void LoadAllOffLineTablet();
void SuspendMetaOperation(TablePtr table, const std::vector<TabletPtr>& tablets,
bool is_delete, WriteClosure* done);
void SuspendMetaOperation(ToMetaFunc meta_entry,
bool is_delete, WriteClosure* done);
void SuspendMetaOperation(std::vector<ToMetaFunc> meta_entries,
bool is_delete, WriteClosure* done);
void SuspendMetaOperation(const std::string& table_name,
const std::string& tablet_key_start,
const std::string& tablet_key_end,
ScanClosure* done);
void SuspendMetaOperation(TabletPtr tablet, ScanTabletResponse* scan_resp,
WriteClosure* done);
void PushToMetaPendingQueue(MetaTask* task);
void ResumeMetaOperation();
void ProcessOffLineTablet(TabletPtr tablet);
void ProcessReadyTablet(TabletPtr tablet);
bool CheckStatusSwitch(MasterStatus old_status, MasterStatus new_status);
// stat table
bool CreateStatTable();
static void DumpStatCallBack(RowMutation* mutation);
void DumpTabletNodeAddrToTable(const std::string& addr);
void DumpStatToTable(const TabletNode& stat);
// garbage clean
void EnableTabletNodeGcTimer();
void DisableTabletNodeGcTimer();
void ScheduleTabletNodeGc();
void DoTabletNodeGc();
void DoTabletNodeGcPhase2();
bool IsRootUser(const std::string& token);
template <typename Request, typename Response, typename Callback>
bool HasTablePermission(const Request* request, Response* response,
Callback* done, TablePtr table, const char* operate);
void FillAlias(const std::string& key, const std::string& value);
private:
mutable Mutex m_status_mutex;
MasterStatus m_status;
std::string m_local_addr;
mutable Mutex m_tabletnode_mutex;
bool m_restored;
boost::shared_ptr<TabletManager> m_tablet_manager;
boost::shared_ptr<TabletNodeManager> m_tabletnode_manager;
scoped_ptr<MasterZkAdapterBase> m_zk_adapter;
scoped_ptr<Scheduler> m_size_scheduler;
scoped_ptr<Scheduler> m_load_scheduler;
Mutex m_mutex;
int64_t m_release_cache_timer_id;
Counter m_this_sequence_id;
bool m_query_enabled;
int64_t m_query_tabletnode_timer_id;
Counter m_query_pending_count;
bool m_load_balance_enabled;
int64_t m_load_balance_timer_id;
Counter m_load_balance_count;
scoped_ptr<ThreadPool> m_thread_pool;
AutoResetEvent m_query_event;
mutable Mutex m_meta_task_mutex;
std::queue<MetaTask*> m_meta_task_queue;
mutable Mutex m_tabletnode_timer_mutex;
std::map<std::string, int64_t> m_tabletnode_timer_id_map;
mutable Mutex m_tablet_mutex;
TabletPtr m_meta_tablet;
// stat table
bool m_is_stat_table;
std::map<std::string, int64_t> m_ts_stat_update_time;
mutable Mutex m_stat_table_mutex;
TableImpl* m_stat_table;
// tabletnode garbage clean
bool m_gc_enabled;
int64_t m_gc_timer_id;
bool m_gc_query_enable;
boost::shared_ptr<GcStrategy> gc_strategy;
std::map<std::string, std::string> m_alias;
mutable Mutex m_alias_mutex;
};
} // namespace master
} // namespace tera
#endif // TERA_MASTER_MASTER_IMPL_H_
|
flashbuckets/tera
|
src/master/master_impl.h
|
C
|
bsd-3-clause
| 25,148
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/net/chrome_url_request_context_getter.h"
#include "base/bind.h"
#include "base/compiler_specific.h"
#include "base/message_loop/message_loop.h"
#include "base/message_loop/message_loop_proxy.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/io_thread.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_io_data.h"
#include "chrome/browser/profiles/storage_partition_descriptor.h"
#include "content/public/browser/browser_thread.h"
#include "net/cookies/cookie_store.h"
using content::BrowserThread;
class ChromeURLRequestContextFactory {
public:
ChromeURLRequestContextFactory() {}
virtual ~ChromeURLRequestContextFactory() {}
// Called to create a new instance (will only be called once).
virtual net::URLRequestContext* Create() = 0;
protected:
DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContextFactory);
};
namespace {
// ----------------------------------------------------------------------------
// Helper factories
// ----------------------------------------------------------------------------
// Factory that creates the main URLRequestContext.
class FactoryForMain : public ChromeURLRequestContextFactory {
public:
FactoryForMain(
const ProfileIOData* profile_io_data,
content::ProtocolHandlerMap* protocol_handlers,
content::URLRequestInterceptorScopedVector request_interceptors)
: profile_io_data_(profile_io_data),
request_interceptors_(request_interceptors.Pass()) {
std::swap(protocol_handlers_, *protocol_handlers);
}
net::URLRequestContext* Create() override {
profile_io_data_->Init(&protocol_handlers_, request_interceptors_.Pass());
return profile_io_data_->GetMainRequestContext();
}
private:
const ProfileIOData* const profile_io_data_;
content::ProtocolHandlerMap protocol_handlers_;
content::URLRequestInterceptorScopedVector request_interceptors_;
};
// Factory that creates the URLRequestContext for extensions.
class FactoryForExtensions : public ChromeURLRequestContextFactory {
public:
explicit FactoryForExtensions(const ProfileIOData* profile_io_data)
: profile_io_data_(profile_io_data) {}
net::URLRequestContext* Create() override {
return profile_io_data_->GetExtensionsRequestContext();
}
private:
const ProfileIOData* const profile_io_data_;
};
// Factory that creates the URLRequestContext for a given isolated app.
class FactoryForIsolatedApp : public ChromeURLRequestContextFactory {
public:
FactoryForIsolatedApp(
const ProfileIOData* profile_io_data,
const StoragePartitionDescriptor& partition_descriptor,
ChromeURLRequestContextGetter* main_context,
scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor,
content::ProtocolHandlerMap* protocol_handlers,
content::URLRequestInterceptorScopedVector request_interceptors)
: profile_io_data_(profile_io_data),
partition_descriptor_(partition_descriptor),
main_request_context_getter_(main_context),
protocol_handler_interceptor_(protocol_handler_interceptor.Pass()),
request_interceptors_(request_interceptors.Pass()) {
std::swap(protocol_handlers_, *protocol_handlers);
}
net::URLRequestContext* Create() override {
// We will copy most of the state from the main request context.
//
// Note that this factory is one-shot. After Create() is called once, the
// factory is actually destroyed. Thus it is safe to destructively pass
// state onwards.
return profile_io_data_->GetIsolatedAppRequestContext(
main_request_context_getter_->GetURLRequestContext(),
partition_descriptor_,
protocol_handler_interceptor_.Pass(),
&protocol_handlers_,
request_interceptors_.Pass());
}
private:
const ProfileIOData* const profile_io_data_;
const StoragePartitionDescriptor partition_descriptor_;
scoped_refptr<ChromeURLRequestContextGetter>
main_request_context_getter_;
scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor_;
content::ProtocolHandlerMap protocol_handlers_;
content::URLRequestInterceptorScopedVector request_interceptors_;
};
// Factory that creates the media URLRequestContext for a given isolated
// app. The media context is based on the corresponding isolated app's context.
class FactoryForIsolatedMedia : public ChromeURLRequestContextFactory {
public:
FactoryForIsolatedMedia(
const ProfileIOData* profile_io_data,
const StoragePartitionDescriptor& partition_descriptor,
ChromeURLRequestContextGetter* app_context)
: profile_io_data_(profile_io_data),
partition_descriptor_(partition_descriptor),
app_context_getter_(app_context) {}
net::URLRequestContext* Create() override {
// We will copy most of the state from the corresopnding app's
// request context. We expect to have the same lifetime as
// the associated |app_context_getter_| so we can just reuse
// all its backing objects, including the
// |protocol_handler_interceptor|. This is why the API
// looks different from FactoryForIsolatedApp's.
return profile_io_data_->GetIsolatedMediaRequestContext(
app_context_getter_->GetURLRequestContext(), partition_descriptor_);
}
private:
const ProfileIOData* const profile_io_data_;
const StoragePartitionDescriptor partition_descriptor_;
scoped_refptr<ChromeURLRequestContextGetter> app_context_getter_;
};
// Factory that creates the URLRequestContext for media.
class FactoryForMedia : public ChromeURLRequestContextFactory {
public:
explicit FactoryForMedia(const ProfileIOData* profile_io_data)
: profile_io_data_(profile_io_data) {
}
net::URLRequestContext* Create() override {
return profile_io_data_->GetMediaRequestContext();
}
private:
const ProfileIOData* const profile_io_data_;
};
} // namespace
// ----------------------------------------------------------------------------
// ChromeURLRequestContextGetter
// ----------------------------------------------------------------------------
ChromeURLRequestContextGetter::ChromeURLRequestContextGetter(
ChromeURLRequestContextFactory* factory)
: factory_(factory),
url_request_context_(nullptr) {
DCHECK(factory);
}
ChromeURLRequestContextGetter::~ChromeURLRequestContextGetter() {
// NotifyContextShuttingDown() must have been called.
DCHECK(!factory_.get());
DCHECK(!url_request_context_);
}
// Lazily create a URLRequestContext using our factory.
net::URLRequestContext*
ChromeURLRequestContextGetter::GetURLRequestContext() {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
if (factory_.get()) {
DCHECK(!url_request_context_);
url_request_context_ = factory_->Create();
factory_.reset();
}
return url_request_context_;
}
void ChromeURLRequestContextGetter::NotifyContextShuttingDown() {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
factory_.reset();
url_request_context_ = nullptr;
URLRequestContextGetter::NotifyContextShuttingDown();
}
scoped_refptr<base::SingleThreadTaskRunner>
ChromeURLRequestContextGetter::GetNetworkTaskRunner() const {
return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO);
}
// static
ChromeURLRequestContextGetter* ChromeURLRequestContextGetter::Create(
Profile* profile,
const ProfileIOData* profile_io_data,
content::ProtocolHandlerMap* protocol_handlers,
content::URLRequestInterceptorScopedVector request_interceptors) {
return new ChromeURLRequestContextGetter(new FactoryForMain(
profile_io_data, protocol_handlers, request_interceptors.Pass()));
}
// static
ChromeURLRequestContextGetter*
ChromeURLRequestContextGetter::CreateForMedia(
Profile* profile, const ProfileIOData* profile_io_data) {
return new ChromeURLRequestContextGetter(
new FactoryForMedia(profile_io_data));
}
// static
ChromeURLRequestContextGetter*
ChromeURLRequestContextGetter::CreateForExtensions(
Profile* profile, const ProfileIOData* profile_io_data) {
return new ChromeURLRequestContextGetter(
new FactoryForExtensions(profile_io_data));
}
// static
ChromeURLRequestContextGetter*
ChromeURLRequestContextGetter::CreateForIsolatedApp(
Profile* profile,
const ProfileIOData* profile_io_data,
const StoragePartitionDescriptor& partition_descriptor,
scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor,
content::ProtocolHandlerMap* protocol_handlers,
content::URLRequestInterceptorScopedVector request_interceptors) {
ChromeURLRequestContextGetter* main_context =
static_cast<ChromeURLRequestContextGetter*>(profile->GetRequestContext());
return new ChromeURLRequestContextGetter(
new FactoryForIsolatedApp(profile_io_data,
partition_descriptor,
main_context,
protocol_handler_interceptor.Pass(),
protocol_handlers,
request_interceptors.Pass()));
}
// static
ChromeURLRequestContextGetter*
ChromeURLRequestContextGetter::CreateForIsolatedMedia(
Profile* profile,
ChromeURLRequestContextGetter* app_context,
const ProfileIOData* profile_io_data,
const StoragePartitionDescriptor& partition_descriptor) {
return new ChromeURLRequestContextGetter(
new FactoryForIsolatedMedia(
profile_io_data, partition_descriptor, app_context));
}
|
guorendong/iridium-browser-ubuntu
|
chrome/browser/net/chrome_url_request_context_getter.cc
|
C++
|
bsd-3-clause
| 9,730
|
// Copyright 2019 Google LLC.
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
#include "tools/fiddle/examples.h"
// HASH=10172fca71b9dbdcade772513ffeb27e
REG_FIDDLE(Image_makeShader_2, 256, 256, false, 5) {
void draw(SkCanvas* canvas) {
SkMatrix matrix;
matrix.setRotate(45);
matrix.postTranslate(125, 30);
SkPaint paint;
paint.setShader(image->makeShader(&matrix));
canvas->drawPaint(paint);
}
} // END FIDDLE
|
endlessm/chromium-browser
|
third_party/skia/docs/examples/Image_makeShader_2.cpp
|
C++
|
bsd-3-clause
| 489
|
module Backstop
module Config
def self.env!(key)
ENV[key] || raise("missing #{key}")
end
def self.deploy; env!('DEPLOY'); end
def self.port; env!('PORT').to_i; end
def self.carbon_urls; env!('CARBON_URLS').split(','); end
def self.prefixes; env!('PREFIXES').split(','); end
def self.api_key; ENV['API_KEY']; end
end
end
|
optimizely/backstop
|
lib/backstop/config.rb
|
Ruby
|
bsd-3-clause
| 359
|
!
! This program does a correctness check for
! ARRAY = SCALAR and ARRAY = ARRAY
!
program main
implicit none
integer, parameter :: n = 3
integer, parameter :: m = 4
! Allocatable coarrays
call one(-5, 1)
call one(0, 0)
call one(1, -5)
call one(0, -11)
! Static coarrays
call two()
call three()
write(*,*) 'Test passed'
contains
subroutine one(lb1, lb2)
integer, value :: lb1, lb2
integer :: i_sgn1, i_sgn2, i, i_e, i_s, j, j_e, j_s
integer, allocatable :: caf(:,:)[:]
integer, allocatable :: a(:,:), b(:,:)
allocate(caf(lb1:n+lb1-1, lb2:m+lb2-1)[*], &
a(lb1:n+lb1-1, lb2:m+lb2-1), &
b(lb1:n+lb1-1, lb2:m+lb2-1))
b = reshape([(i*33, i = 1, size(b))], shape(b))
! Whole array: ARRAY = SCALAR
a = -42
caf = -42
if(this_image() == num_images()) then
caf = b
endif
sync all
if (this_image() == 1) then
a(:,:) = caf(lb1,lb2)[num_images()]
print *, this_image(), '//', a, '//', b(lb1,lb2)
print *, '>>>', any(a /= b(lb1,lb2))
if (any (a /= b(lb1,lb2))) then
! FIXME: ABORTS UNLESS THERE IS SOME OTHER CODE
print *, 'HELLO!!!!!!!!!!!!!!!!!'
error stop
end if
end if
! Whole array: ARRAY = ARRAY
a = -42
caf = -42
if(this_image() == num_images()) then
caf = b
endif
sync all
if (this_image() == 1) then
a(:,:) = caf(:,:)[num_images()]
if (any (a /= b)) &
!FIXME
print *, a
print *, b
print *, 'WRONG:', any (a /= b)
error stop
end if
end if
! Array sections with different ranges and pos/neg strides
do i_sgn1 = -1, 1, 2
do i_sgn2 = -1, 1, 2
do i=lb1, n+lb1-1
do i_e=lb1, n+lb1-1
do i_s=1, n
do j=lb2, m+lb2-1
do j_e=lb2, m+lb2-1
do j_s=1, m
! ARRAY = SCALAR
a = -12
caf = -42
if(this_image() == num_images()) then
caf = b
endif
sync all
if (this_image() == 1) then
b(i:i_e:i_s*i_sgn1, j:j_e:j_s*i_sgn2) &
= caf(lb1, lb2)[num_images()]
end if
sync all
! ARRAY = ARRAY
a = -12
b = -32
if(this_image() == num_images()) then
caf = a
else
caf = -42
endif
sync all
if (this_image() == 1) then
! b(i:i_e:i_s*i_sgn1, j:j_e:j_s*i_sgn2) &
! = caf(i:i_e:i_s*i_sgn1, j:j_e:j_s*i_sgn2)[num_images()]
end if
sync all
if (this_image() == 1) then
! if (any (a /= b)) then
! print '(*(g0))', "bounds: ", lb1,":",n+lb1-1,", ", &
! lb2,":",m+lb2-1
! print '(*(g0))', "section: ", i,":",i_e,":",i_s*i_sgn1, &
! ", ", j,":",j_e,":",j_s*i_sgn2
! print *, i
! print *, a
! print *, caf
! print *, a-caf
! error stop
! endif
end if
end do
end do
end do
end do
end do
end do
end do
end do
end subroutine one
subroutine two()
integer, parameter :: lb1 = -5, lb2 = 1
integer :: i_sgn1, i_sgn2, i, i_e, i_s, j, j_e, j_s
integer, save :: caf(lb1:n+lb1-1, lb2:m+lb2-1)[*]
integer, save :: a(lb1:n+lb1-1, lb2:m+lb2-1)
integer, save :: b(lb1:n+lb1-1, lb2:m+lb2-1)
b = reshape([(i*33, i = 1, size(b))], shape(b))
! Whole array: ARRAY = SCALAR
a = -12
b = -32
if(this_image() == num_images()) then
caf = a
else
caf = -42
endif
sync all
if (this_image() == 1) then
b(:,:) = caf(lb1,lb2)[num_images()]
end if
sync all
if (this_image() == 1) then
if (any (a /= b)) &
error stop
end if
! Whole array: ARRAY = ARRAY
a = -12
b = -32
if(this_image() == num_images()) then
caf = a
else
caf = -42
endif
sync all
if (this_image() == 1) then
b(:,:) = caf(:,:)[num_images()]
end if
sync all
if (this_image() == 1) then
if (any (a /= b)) &
error stop
end if
! Array sections with different ranges and pos/neg strides
do i_sgn1 = -1, 1, 2
do i_sgn2 = -1, 1, 2
do i=lb1, n+lb1-1
do i_e=lb1, n+lb1-1
do i_s=1, n
do j=lb2, m+lb2-1
do j_e=lb2, m+lb2-1
do j_s=1, m
! ARRAY = SCALAR
a = -12
b = -32
if(this_image() == num_images()) then
caf = a
else
caf = -42
endif
sync all
if (this_image() == 1) then
b(i:i_e:i_s*i_sgn1, j:j_e:j_s*i_sgn2) = caf(lb1,lb2)[num_images()]
end if
sync all
! ARRAY = ARRAY
b = -32
a = -12
if(this_image() == num_images()) then
caf = a
else
caf = -42
endif
sync all
if (this_image() == 1) then
! b(i:i_e:i_s*i_sgn1, j:j_e:j_s*i_sgn2) &
! =caf(i:i_e:i_s*i_sgn1, j:j_e:j_s*i_sgn2)[num_images()]
end if
sync all
if (this_image() == 1) then
! if (any (a /= b)) then
! print '(*(g0))', "bounds: ", lb1,":",n+lb1-1,", ", &
! lb2,":",m+lb2-1
! print '(*(g0))', "section: ", i,":",i_e,":",i_s*i_sgn1, &
! ", ", j,":",j_e,":",j_s*i_sgn2
! print *, i
! print *, a
! print *, caf
! print *, a-caf
! error stop
! endif
end if
end do
end do
end do
end do
end do
end do
end do
end do
end subroutine two
subroutine three()
integer, parameter :: lb1 = 0, lb2 = 0
integer :: i_sgn1, i_sgn2, i, i_e, i_s, j, j_e, j_s
integer, save :: caf(lb1:n+lb1-1, lb2:m+lb2-1)[*]
integer, save :: a(lb1:n+lb1-1, lb2:m+lb2-1)
integer, save :: b(lb1:n+lb1-1, lb2:m+lb2-1)
b = reshape([(i*33, i = 1, size(b))], shape(b))
! Whole array: ARRAY = SCALAR
a = -12
b = -32
if(this_image() == num_images()) then
caf = a
else
caf = -42
endif
sync all
if (this_image() == 1) then
b(:,:) = caf(lb1,lb2)[num_images()]
end if
sync all
if (this_image() == 1) then
if (any (a /= b)) &
error stop
end if
! Whole array: ARRAY = ARRAY
a = -12
b = -32
if(this_image() == num_images()) then
caf = a
else
caf = -42
endif
sync all
if (this_image() == 1) then
b(:,:) = caf(:,:)[num_images()]
end if
sync all
if (this_image() == 1) then
if (any (a /= b)) &
error stop
end if
! Array sections with different ranges and pos/neg strides
do i_sgn1 = -1, 1, 2
do i_sgn2 = -1, 1, 2
do i=lb1, n+lb1-1
do i_e=lb1, n+lb1-1
do i_s=1, n
do j=lb2, m+lb2-1
do j_e=lb2, m+lb2-1
do j_s=1, m
! ARRAY = SCALAR
a = -12
b = -32
if(this_image() == num_images()) then
caf = a
else
caf = -42
endif
sync all
if (this_image() == 1) then
b(i:i_e:i_s*i_sgn1, j:j_e:j_s*i_sgn2) &
= caf(lb1,lb2)[num_images()]
end if
sync all
! ARRAY = ARRAY
a = -12
b = -32
if(this_image() == num_images()) then
caf = a
else
caf = -42
endif
sync all
if (this_image() == 1) then
! b(i:i_e:i_s*i_sgn1, j:j_e:j_s*i_sgn2) &
! = caf(i:i_e:i_s*i_sgn1, j:j_e:j_s*i_sgn2)[num_images()]
end if
sync all
if (this_image() == 1) then
! if (any (a /= b)) then
! print '(*(g0))', "bounds: ", lb1,":",n+lb1-1,", ", &
! lb2,":",m+lb2-1
! print '(*(g0))', "section: ", i,":",i_e,":",i_s*i_sgn1, &
! ", ", j,":",j_e,":",j_s*i_sgn2
! print *, i
! print *, a
! print *, caf
! print *, a-caf
! error stop
! endif
end if
end do
end do
end do
end do
end do
end do
end do
end do
end subroutine three
end program main
|
sourceryinstitute/opencoarrays
|
src/tests/unit/send-get/old_get_array_test.f90
|
FORTRAN
|
bsd-3-clause
| 9,853
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.