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 the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using Microsoft.CodeAnalysis.CSharp.Extensions;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.Shared.Extensions;
namespace Microsoft.CodeAnalysis.CSharp.Simplification
{
internal partial class CSharpExtensionMethodReducer : AbstractCSharpReducer
{
private static readonly ObjectPool<IReductionRewriter> s_pool = new(
() => new Rewriter(s_pool));
public CSharpExtensionMethodReducer() : base(s_pool)
{
}
private static readonly Func<InvocationExpressionSyntax, SemanticModel, OptionSet, CancellationToken, SyntaxNode> s_simplifyExtensionMethod = SimplifyExtensionMethod;
private static SyntaxNode SimplifyExtensionMethod(
InvocationExpressionSyntax node,
SemanticModel semanticModel,
OptionSet optionSet,
CancellationToken cancellationToken)
{
var rewrittenNode = node;
if (node.Expression.Kind() == SyntaxKind.SimpleMemberAccessExpression)
{
var memberAccessName = (MemberAccessExpressionSyntax)node.Expression;
rewrittenNode = TryReduceExtensionMethod(node, semanticModel, rewrittenNode, memberAccessName.Name);
}
else if (node.Expression is SimpleNameSyntax)
{
rewrittenNode = TryReduceExtensionMethod(node, semanticModel, rewrittenNode, (SimpleNameSyntax)node.Expression);
}
return rewrittenNode;
}
private static InvocationExpressionSyntax TryReduceExtensionMethod(InvocationExpressionSyntax node, SemanticModel semanticModel, InvocationExpressionSyntax rewrittenNode, SimpleNameSyntax expressionName)
{
var targetSymbol = semanticModel.GetSymbolInfo(expressionName);
if (targetSymbol.Symbol != null && targetSymbol.Symbol.Kind == SymbolKind.Method)
{
var targetMethodSymbol = (IMethodSymbol)targetSymbol.Symbol;
if (!targetMethodSymbol.IsReducedExtension())
{
var argumentList = node.ArgumentList;
var noOfArguments = argumentList.Arguments.Count;
if (noOfArguments > 0)
{
MemberAccessExpressionSyntax newMemberAccess = null;
var invocationExpressionNodeExpression = node.Expression;
// Ensure the first expression is parenthesized so that we don't cause any
// precedence issues when we take the extension method and tack it on the
// end of it.
var expression = argumentList.Arguments[0].Expression.Parenthesize();
if (node.Expression.Kind() == SyntaxKind.SimpleMemberAccessExpression)
{
newMemberAccess = SyntaxFactory.MemberAccessExpression(
SyntaxKind.SimpleMemberAccessExpression, expression,
((MemberAccessExpressionSyntax)invocationExpressionNodeExpression).OperatorToken,
((MemberAccessExpressionSyntax)invocationExpressionNodeExpression).Name);
}
else if (node.Expression.Kind() == SyntaxKind.IdentifierName)
{
newMemberAccess = SyntaxFactory.MemberAccessExpression(
SyntaxKind.SimpleMemberAccessExpression, expression,
(IdentifierNameSyntax)invocationExpressionNodeExpression.WithoutLeadingTrivia());
}
else if (node.Expression.Kind() == SyntaxKind.GenericName)
{
newMemberAccess = SyntaxFactory.MemberAccessExpression(
SyntaxKind.SimpleMemberAccessExpression, expression,
(GenericNameSyntax)invocationExpressionNodeExpression.WithoutLeadingTrivia());
}
else
{
Debug.Assert(false, "The expression kind is not MemberAccessExpression or IdentifierName or GenericName to be converted to Member Access Expression for Ext Method Reduction");
}
if (newMemberAccess == null)
{
return node;
}
// Preserve Trivia
newMemberAccess = newMemberAccess.WithLeadingTrivia(node.GetLeadingTrivia());
// Below removes the first argument
// we need to reuse the separators to maintain existing formatting & comments in the arguments itself
var newArguments = SyntaxFactory.SeparatedList<ArgumentSyntax>(argumentList.Arguments.GetWithSeparators().AsEnumerable().Skip(2));
var rewrittenArgumentList = argumentList.WithArguments(newArguments);
var candidateRewrittenNode = SyntaxFactory.InvocationExpression(newMemberAccess, rewrittenArgumentList);
var oldSymbol = semanticModel.GetSymbolInfo(node).Symbol;
var newSymbol = semanticModel.GetSpeculativeSymbolInfo(
node.SpanStart,
candidateRewrittenNode,
SpeculativeBindingOption.BindAsExpression).Symbol;
if (oldSymbol != null && newSymbol != null)
{
if (newSymbol.Kind == SymbolKind.Method && oldSymbol.Equals(((IMethodSymbol)newSymbol).GetConstructedReducedFrom()))
{
rewrittenNode = candidateRewrittenNode;
}
}
}
}
}
return rewrittenNode;
}
}
}
| shyamnamboodiripad/roslyn | src/Workspaces/CSharp/Portable/Simplification/Reducers/CSharpExtensionMethodReducer.cs | C# | apache-2.0 | 6,511 |
/*
* 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.kafka.connect.storage;
import org.apache.kafka.connect.errors.ConnectException;
import org.apache.kafka.connect.runtime.WorkerConfig;
import org.apache.kafka.connect.util.Callback;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.nio.ByteBuffer;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
/**
* Implementation of OffsetBackingStore that doesn't actually persist any data. To ensure this
* behaves similarly to a real backing store, operations are executed asynchronously on a
* background thread.
*/
public class MemoryOffsetBackingStore implements OffsetBackingStore {
private static final Logger log = LoggerFactory.getLogger(MemoryOffsetBackingStore.class);
protected Map<ByteBuffer, ByteBuffer> data = new HashMap<>();
protected ExecutorService executor;
public MemoryOffsetBackingStore() {
}
@Override
public void configure(WorkerConfig config) {
}
@Override
public void start() {
executor = Executors.newSingleThreadExecutor();
}
@Override
public void stop() {
if (executor != null) {
executor.shutdown();
// Best effort wait for any get() and set() tasks (and caller's callbacks) to complete.
try {
executor.awaitTermination(30, TimeUnit.SECONDS);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
if (!executor.shutdownNow().isEmpty()) {
throw new ConnectException("Failed to stop MemoryOffsetBackingStore. Exiting without cleanly " +
"shutting down pending tasks and/or callbacks.");
}
executor = null;
}
}
@Override
public Future<Map<ByteBuffer, ByteBuffer>> get(
final Collection<ByteBuffer> keys,
final Callback<Map<ByteBuffer, ByteBuffer>> callback) {
return executor.submit(new Callable<Map<ByteBuffer, ByteBuffer>>() {
@Override
public Map<ByteBuffer, ByteBuffer> call() throws Exception {
Map<ByteBuffer, ByteBuffer> result = new HashMap<>();
for (ByteBuffer key : keys) {
result.put(key, data.get(key));
}
if (callback != null)
callback.onCompletion(null, result);
return result;
}
});
}
@Override
public Future<Void> set(final Map<ByteBuffer, ByteBuffer> values,
final Callback<Void> callback) {
return executor.submit(new Callable<Void>() {
@Override
public Void call() throws Exception {
for (Map.Entry<ByteBuffer, ByteBuffer> entry : values.entrySet()) {
data.put(entry.getKey(), entry.getValue());
}
save();
if (callback != null)
callback.onCompletion(null, null);
return null;
}
});
}
// Hook to allow subclasses to persist data
protected void save() {
}
}
| wangcy6/storm_app | frame/kafka-0.11.0/kafka-0.11.0.1-src/connect/runtime/src/main/java/org/apache/kafka/connect/storage/MemoryOffsetBackingStore.java | Java | apache-2.0 | 4,169 |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
#if NETCOREAPP
using System;
using System.IO;
using System.Text;
using System.Threading;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
namespace Roslyn.Test.Utilities.CoreClr
{
internal static class SharedConsole
{
private static TextWriter s_savedConsoleOut;
private static TextWriter s_savedConsoleError;
private static AsyncLocal<StringWriter> s_currentOut;
private static AsyncLocal<StringWriter> s_currentError;
internal static void OverrideConsole()
{
s_savedConsoleOut = Console.Out;
s_savedConsoleError = Console.Error;
s_currentOut = new AsyncLocal<StringWriter>();
s_currentError = new AsyncLocal<StringWriter>();
Console.SetOut(new SharedConsoleOutWriter());
Console.SetError(new SharedConsoleErrorWriter());
}
public static void CaptureOutput(Action action, int expectedLength, out string output, out string errorOutput)
{
var outputWriter = new CappedStringWriter(expectedLength);
var errorOutputWriter = new CappedStringWriter(expectedLength);
var savedOutput = s_currentOut.Value;
var savedError = s_currentError.Value;
try
{
s_currentOut.Value = outputWriter;
s_currentError.Value = errorOutputWriter;
action();
}
finally
{
s_currentOut.Value = savedOutput;
s_currentError.Value = savedError;
}
output = outputWriter.ToString();
errorOutput = errorOutputWriter.ToString();
}
private sealed class SharedConsoleOutWriter : SharedConsoleWriter
{
public override TextWriter Underlying => s_currentOut.Value ?? s_savedConsoleOut;
}
private sealed class SharedConsoleErrorWriter : SharedConsoleWriter
{
public override TextWriter Underlying => s_currentError.Value ?? s_savedConsoleError;
}
private abstract class SharedConsoleWriter : TextWriter
{
public override Encoding Encoding => Underlying.Encoding;
public abstract TextWriter Underlying { get; }
public override void Write(char value) => Underlying.Write(value);
}
}
}
#endif
| brettfo/roslyn | src/Test/Utilities/Portable/Platform/CoreClr/SharedConsoleOutWriter.cs | C# | apache-2.0 | 2,634 |
/*
* 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.spark.deploy.worker
import java.io._
import java.net.URI
import java.nio.charset.StandardCharsets
import scala.collection.JavaConverters._
import com.google.common.io.Files
import org.apache.spark.{SecurityManager, SparkConf}
import org.apache.spark.deploy.{DriverDescription, SparkHadoopUtil}
import org.apache.spark.deploy.DeployMessages.DriverStateChanged
import org.apache.spark.deploy.master.DriverState
import org.apache.spark.deploy.master.DriverState.DriverState
import org.apache.spark.internal.Logging
import org.apache.spark.rpc.RpcEndpointRef
import org.apache.spark.util.{Clock, ShutdownHookManager, SystemClock, Utils}
/**
* Manages the execution of one driver, including automatically restarting the driver on failure.
* This is currently only used in standalone cluster deploy mode.
*/
private[deploy] class DriverRunner(
conf: SparkConf,
val driverId: String,
val workDir: File,
val sparkHome: File,
val driverDesc: DriverDescription,
val worker: RpcEndpointRef,
val workerUrl: String,
val securityManager: SecurityManager)
extends Logging {
@volatile private var process: Option[Process] = None
@volatile private var killed = false
// Populated once finished
@volatile private[worker] var finalState: Option[DriverState] = None
@volatile private[worker] var finalException: Option[Exception] = None
// Timeout to wait for when trying to terminate a driver.
private val DRIVER_TERMINATE_TIMEOUT_MS = 10 * 1000
// Decoupled for testing
def setClock(_clock: Clock): Unit = {
clock = _clock
}
def setSleeper(_sleeper: Sleeper): Unit = {
sleeper = _sleeper
}
private var clock: Clock = new SystemClock()
private var sleeper = new Sleeper {
def sleep(seconds: Int): Unit = (0 until seconds).takeWhile { _ =>
Thread.sleep(1000)
!killed
}
}
/** Starts a thread to run and manage the driver. */
private[worker] def start() = {
new Thread("DriverRunner for " + driverId) {
override def run() {
var shutdownHook: AnyRef = null
try {
shutdownHook = ShutdownHookManager.addShutdownHook { () =>
logInfo(s"Worker shutting down, killing driver $driverId")
kill()
}
// prepare driver jars and run driver
val exitCode = prepareAndRunDriver()
// set final state depending on if forcibly killed and process exit code
finalState = if (exitCode == 0) {
Some(DriverState.FINISHED)
} else if (killed) {
Some(DriverState.KILLED)
} else {
Some(DriverState.FAILED)
}
} catch {
case e: Exception =>
kill()
finalState = Some(DriverState.ERROR)
finalException = Some(e)
} finally {
if (shutdownHook != null) {
ShutdownHookManager.removeShutdownHook(shutdownHook)
}
}
// notify worker of final driver state, possible exception
worker.send(DriverStateChanged(driverId, finalState.get, finalException))
}
}.start()
}
/** Terminate this driver (or prevent it from ever starting if not yet started) */
private[worker] def kill(): Unit = {
logInfo("Killing driver process!")
killed = true
synchronized {
process.foreach { p =>
val exitCode = Utils.terminateProcess(p, DRIVER_TERMINATE_TIMEOUT_MS)
if (exitCode.isEmpty) {
logWarning("Failed to terminate driver process: " + p +
". This process will likely be orphaned.")
}
}
}
}
/**
* Creates the working directory for this driver.
* Will throw an exception if there are errors preparing the directory.
*/
private def createWorkingDirectory(): File = {
val driverDir = new File(workDir, driverId)
if (!driverDir.exists() && !driverDir.mkdirs()) {
throw new IOException("Failed to create directory " + driverDir)
}
driverDir
}
/**
* Download the user jar into the supplied directory and return its local path.
* Will throw an exception if there are errors downloading the jar.
*/
private def downloadUserJar(driverDir: File): String = {
val jarFileName = new URI(driverDesc.jarUrl).getPath.split("/").last
val localJarFile = new File(driverDir, jarFileName)
if (!localJarFile.exists()) { // May already exist if running multiple workers on one node
logInfo(s"Copying user jar ${driverDesc.jarUrl} to $localJarFile")
Utils.fetchFile(
driverDesc.jarUrl,
driverDir,
conf,
securityManager,
SparkHadoopUtil.get.newConfiguration(conf),
System.currentTimeMillis(),
useCache = false)
if (!localJarFile.exists()) { // Verify copy succeeded
throw new IOException(
s"Can not find expected jar $jarFileName which should have been loaded in $driverDir")
}
}
localJarFile.getAbsolutePath
}
private[worker] def prepareAndRunDriver(): Int = {
val driverDir = createWorkingDirectory()
val localJarFilename = downloadUserJar(driverDir)
def substituteVariables(argument: String): String = argument match {
case "{{WORKER_URL}}" => workerUrl
case "{{USER_JAR}}" => localJarFilename
case other => other
}
// TODO: If we add ability to submit multiple jars they should also be added here
val builder = CommandUtils.buildProcessBuilder(driverDesc.command, securityManager,
driverDesc.mem, sparkHome.getAbsolutePath, substituteVariables)
runDriver(builder, driverDir, driverDesc.supervise)
}
private def runDriver(builder: ProcessBuilder, baseDir: File, supervise: Boolean): Int = {
builder.directory(baseDir)
def initialize(process: Process): Unit = {
// Redirect stdout and stderr to files
val stdout = new File(baseDir, "stdout")
CommandUtils.redirectStream(process.getInputStream, stdout)
val stderr = new File(baseDir, "stderr")
val formattedCommand = builder.command.asScala.mkString("\"", "\" \"", "\"")
val header = "Launch Command: %s\n%s\n\n".format(formattedCommand, "=" * 40)
Files.append(header, stderr, StandardCharsets.UTF_8)
CommandUtils.redirectStream(process.getErrorStream, stderr)
}
runCommandWithRetry(ProcessBuilderLike(builder), initialize, supervise)
}
private[worker] def runCommandWithRetry(
command: ProcessBuilderLike, initialize: Process => Unit, supervise: Boolean): Int = {
var exitCode = -1
// Time to wait between submission retries.
var waitSeconds = 1
// A run of this many seconds resets the exponential back-off.
val successfulRunDuration = 5
var keepTrying = !killed
while (keepTrying) {
logInfo("Launch Command: " + command.command.mkString("\"", "\" \"", "\""))
synchronized {
if (killed) { return exitCode }
process = Some(command.start())
initialize(process.get)
}
val processStart = clock.getTimeMillis()
exitCode = process.get.waitFor()
// check if attempting another run
keepTrying = supervise && exitCode != 0 && !killed
if (keepTrying) {
if (clock.getTimeMillis() - processStart > successfulRunDuration * 1000) {
waitSeconds = 1
}
logInfo(s"Command exited with status $exitCode, re-launching after $waitSeconds s.")
sleeper.sleep(waitSeconds)
waitSeconds = waitSeconds * 2 // exponential back-off
}
}
exitCode
}
}
private[deploy] trait Sleeper {
def sleep(seconds: Int): Unit
}
// Needed because ProcessBuilder is a final class and cannot be mocked
private[deploy] trait ProcessBuilderLike {
def start(): Process
def command: Seq[String]
}
private[deploy] object ProcessBuilderLike {
def apply(processBuilder: ProcessBuilder): ProcessBuilderLike = new ProcessBuilderLike {
override def start(): Process = processBuilder.start()
override def command: Seq[String] = processBuilder.command().asScala
}
}
| sh-cho/cshSpark | deploy/worker/DriverRunner.scala | Scala | apache-2.0 | 8,881 |
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
using System.Linq.Expressions;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.WebMatrix.Extensibility;
using NuGet;
using NuGet.WebMatrix.Data;
namespace NuGet.WebMatrix
{
internal class FilterManager
{
private ListViewFilter _installedFilter;
private ListViewFilter _updatesFilter;
private ListViewFilter _disabledFilter;
private VirtualizingListViewFilter _allFilter;
// Task scheduler for executing tasks on the primary thread
private TaskScheduler _scheduler;
/// <summary>
/// Initializes a new instance of the <see cref="T:FilterManager"/> class.
/// </summary>
internal FilterManager(NuGetModel model, TaskScheduler scheduler, INuGetGalleryDescriptor descriptor)
{
Debug.Assert(model != null, "Model must not be null");
Debug.Assert(scheduler != null, "TaskScheduler must not be null");
this.Model = model;
Filters = new ObservableCollection<IListViewFilter>();
_installedFilter = new ListViewFilter(Resources.Filter_Installed, string.Format(Resources.Filter_InstalledDescription, descriptor.PackageKind), supportsPrerelease: false);
_installedFilter.FilteredItems.SortDescriptions.Clear();
_updatesFilter = new ListViewFilter(Resources.Filter_Updated, string.Format(Resources.Filter_UpdatedDescription, descriptor.PackageKind), supportsPrerelease: true);
_updatesFilter.FilteredItems.SortDescriptions.Clear();
_disabledFilter = new ListViewFilter(Resources.Filter_Disabled, string.Format(Resources.Filter_DisabledDescription, descriptor.PackageKind), supportsPrerelease: false);
_disabledFilter.FilteredItems.SortDescriptions.Clear();
_scheduler = scheduler;
}
internal ObservableCollection<IListViewFilter> Filters
{
get;
private set;
}
public NuGetModel Model
{
get;
private set;
}
internal ListViewFilter InstalledFilter
{
get
{
return _installedFilter;
}
}
private VirtualizingListViewFilter AllFilter
{
get
{
return _allFilter;
}
}
private ListViewFilter DisabledFilter
{
get
{
return _disabledFilter;
}
}
public void UpdateFilters()
{
// populate the installed packages first, followed by disabled filter (other categories depend on this information)
var populateInstalledTask = StartPopulatingInstalledAndDisabledFilters();
populateInstalledTask.Wait();
// Start populating the filters
var populateFiltersTask = StartPopulatingAllAndUpdateFilters();
populateFiltersTask.Wait();
}
private Task StartPopulatingInstalledAndDisabledFilters()
{
return Task.Factory.StartNew(() =>
{
// after we get the installed packages, use them to populate the 'installed' and 'disabled' filters
var installedTask = Task.Factory
.StartNew<IEnumerable<PackageViewModel>>(GetInstalledPackages, TaskCreationOptions.AttachedToParent);
installedTask.ContinueWith(
UpdateInstalledFilter,
CancellationToken.None,
TaskContinuationOptions.AttachedToParent | TaskContinuationOptions.OnlyOnRanToCompletion,
this._scheduler);
installedTask.ContinueWith(
UpdateDisabledFilter,
CancellationToken.None,
TaskContinuationOptions.AttachedToParent | TaskContinuationOptions.OnlyOnRanToCompletion,
this._scheduler);
});
}
private Task StartPopulatingAllAndUpdateFilters()
{
// the child tasks here are created with AttachedToParent, the outer task will not
// complete until all children have.
return Task.Factory.StartNew(() =>
{
// each of these operations is a two-step process
// 1. Get the packages
// 2. Create view models and add to filters
Task.Factory
.StartNew(UpdateTheAllFilter, TaskCreationOptions.AttachedToParent);
Task.Factory
.StartNew<IEnumerable<IPackage>>(GetUpdatePackages, TaskCreationOptions.AttachedToParent)
.ContinueWith(
UpdateUpdatesFilter(),
CancellationToken.None,
TaskContinuationOptions.AttachedToParent | TaskContinuationOptions.OnlyOnRanToCompletion,
this._scheduler);
})
.ContinueWith(AddFilters, this._scheduler);
}
private void AddFilters(Task task)
{
Filters.Clear();
// always show the 'all' filter
Filters.Add(_allFilter);
if (_updatesFilter.Count > 0)
{
Filters.Add(_updatesFilter);
}
// always show the installed filter
Filters.Add(_installedFilter);
if (_disabledFilter.Count > 0)
{
Filters.Add(_disabledFilter);
}
if (task.IsFaulted)
{
throw task.Exception;
}
}
private void UpdateTheAllFilter()
{
// updating the 'all' filter can take a matter of seconds -- so only update when it's timed out
if (this._allFilter == null)
{
this._allFilter = new VirtualizingListViewFilter(
Resources.Filter_All,
Resources.Filter_AllDescription,
(p) => new PackageViewModel(this.Model, p as IPackage, PackageViewModelAction.InstallOrUninstall));
this.AllFilter.Sort = (p) => p.DownloadCount;
if (!String.IsNullOrWhiteSpace(this.Model.FeedSource.FilterTag))
{
this.AllFilter.Filter = FilterManager.BuildTagFilterExpression(this.Model.FeedSource.FilterTag);
}
this.AllFilter.PackageManager = this.Model.PackageManager;
}
}
private void UpdateInstalledFilter(Task<IEnumerable<PackageViewModel>> task)
{
var installed = task.Result;
_installedFilter.Items.Clear();
foreach (var viewModel in installed)
{
_installedFilter.Items.Add(new ListViewItemWrapper()
{
Item = viewModel,
SearchText = viewModel.SearchText,
Name = viewModel.Name,
});
}
}
private void UpdateDisabledFilter(Task<IEnumerable<PackageViewModel>> task)
{
var installed = task.Result;
_disabledFilter.Items.Clear();
foreach (var viewModel in installed)
{
if (!viewModel.IsEnabled)
{
_disabledFilter.Items.Add(new ListViewItemWrapper()
{
Item = viewModel,
SearchText = viewModel.SearchText,
Name = viewModel.Name,
});
}
}
}
private Action<Task<IEnumerable<IPackage>>> UpdateUpdatesFilter()
{
return (task) =>
{
if (task.Result == null)
{
return;
}
_updatesFilter.Items.Clear();
var packages = task.Result;
foreach (var package in packages)
{
var packageViewModel = new PackageViewModel(this.Model, package, PackageViewModelAction.Update);
_updatesFilter.Items.Add(new ListViewItemWrapper()
{
Item = packageViewModel,
SearchText = packageViewModel.SearchText,
Name = packageViewModel.Name,
});
}
};
}
/// <summary>
/// Filters the given set of packages on the given tag. If the filter tag is null or whitespace,
/// all packages are returned. (Case-Insensitive)
/// </summary>
/// <param name="packages">Input packages</param>
/// <param name="filterTag">The tag to filter</param>
/// <returns>The set of packages containing the given tag tag</returns>
/// <remarks>
/// This implementation (IQueryable) is based on the nature of the NuGet remote package service.
/// The filter clause applied here is pushed up to the server, which will dramatically increase the
/// performance. If you tweak the body of this function, expect to find things that work locally,
/// and fail when hitting the server-side.
/// </remarks>
public static IQueryable<IPackage> FilterOnTag(IQueryable<IPackage> packages, string filterTag)
{
Debug.Assert(packages != null, "Packages cannot be null");
if (string.IsNullOrWhiteSpace(filterTag))
{
return packages;
}
// we're doing this padding because we don't get to call string.split
// when this is running on a remote package list (inside the lambda)
//
// the tag value on the package is considered untrusted input, so we make sure
// it has a leading and trailing space, as does the search text.
// it's also possible that package.Tags might be delimited by spaces and commas
// like: ' foo, bar '
string loweredFilterTag = filterTag.ToLowerInvariant().Trim();
string loweredPaddedFilterTag = " " + loweredFilterTag + " ";
string loweredCommaPaddedFilterTag = " " + loweredFilterTag + ", ";
return packages
.Where(package => package.Tags != null)
.Where(package =>
(" " + package.Tags.ToLower().Trim() + " ").Contains(loweredPaddedFilterTag)
|| (" " + package.Tags.ToLower().Trim() + " ").Contains(loweredCommaPaddedFilterTag));
}
public static Expression<Func<IPackage, bool>> BuildTagFilterExpression(string filterTag)
{
// we're doing this padding because we don't get to call string.split
// when this is running on a remote package list (inside the lambda)
//
// the tag value on the package is considered untrusted input, so we make sure
// it has a leading and trailing space, as does the search text.
// it's also possible that package.Tags might be delimited by spaces and commas
// like: ' foo, bar '
string loweredFilterTag = filterTag.ToLowerInvariant().Trim();
string loweredPaddedFilterTag = " " + loweredFilterTag + " ";
string loweredCommaPaddedFilterTag = " " + loweredFilterTag + ", ";
return (package) => package.Tags != null &&
((" " + package.Tags.ToLower().Trim() + " ").Contains(loweredPaddedFilterTag) ||
(" " + package.Tags.ToLower().Trim() + " ").Contains(loweredCommaPaddedFilterTag));
}
private IEnumerable<PackageViewModel> GetInstalledPackages()
{
var installed = FilterOnTag(this.Model.GetInstalledPackages().AsQueryable(), this.Model.FeedSource.FilterTag);
//// From the installed tab, the only possible operation is uninstall and update is NOT supported
//// For this reason, retrieving the remote package is not worthwhile
//// Plus, Downloads count will not be shown in installed tab, which is fine
//// Note that 'ALL' tab continues to support all applicable operations on a selected package including 'Update'
IEnumerable<PackageViewModel> viewModels;
viewModels = installed.Select((local) => new PackageViewModel(
this.Model,
local,
true,
PackageViewModelAction.InstallOrUninstall));
return viewModels;
}
private IEnumerable<IPackage> GetUpdatePackages()
{
IEnumerable<IPackage> allPackages = this.Model.GetPackagesWithUpdates();
return FilterOnTag(allPackages.AsQueryable(), this.Model.FeedSource.FilterTag);
}
}
}
| mrward/NuGet.V2 | WebMatrixExtension/NuGetExtension/Core/FilterManager.cs | C# | apache-2.0 | 13,110 |
<!DOCTYPE html>
<title>SVG*List immutability</title>
<script src=../../resources/testharness.js></script>
<script src=../../resources/testharnessreport.js></script>
<script>
var root = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
[
{
element: 'polygon', attr: 'points', value: '0,0 10,10', listName: 'SVGPointList',
accessor: function(elm) { return elm.animatedPoints; },
constructItem: function(elm) { return root.createSVGPoint(); }
}, {
element: 'text', attr: 'x', value: '0 10', listName: 'SVGLengthList',
accessor: function(elm) { return elm.x.animVal; },
constructItem: function(elm) { return root.createSVGLength(); }
}, {
element: 'rect', attr: 'transform', value: 'rotate(0) scale(1)', listName: 'SVGTransformList',
accessor: function(elm) { return elm.transform.animVal; },
constructItem: function(elm) { return root.createSVGTransform(); }
}
].forEach(function(testItem) {
var element = document.createElementNS('http://www.w3.org/2000/svg', testItem.element);
element.setAttribute(testItem.attr, testItem.value);
var list = testItem.accessor(element);
var item = testItem.constructItem(element);
test(function() {
assert_equals(list.length, 2);
assert_throws('NoModificationAllowedError', function() { list.clear(); });
assert_throws('NoModificationAllowedError', function() { list.initialize(item); });
assert_throws('NoModificationAllowedError', function() { list[0] = item; });
assert_throws('NoModificationAllowedError', function() { list.insertItemBefore(item, 0); });
assert_throws('NoModificationAllowedError', function() { list.replaceItem(item, 0); });
assert_throws('NoModificationAllowedError', function() { list.removeItem(0); });
assert_throws('NoModificationAllowedError', function() { list.appendItem(item); });
}, document.title + ', ' + testItem.listName);
});
</script>
| js0701/chromium-crosswalk | third_party/WebKit/LayoutTests/svg/dom/svglist-immutable.html | HTML | bsd-3-clause | 1,994 |
description("Test path animation where coordinate modes of start and end differ. You should see PASS messages");
createSVGTestCase();
// Setup test document
var path = createSVGElement("path");
path.setAttribute("id", "path");
path.setAttribute("d", "M -30 -30 q 30 0 30 30 t -30 30 Z");
path.setAttribute("fill", "green");
path.setAttribute("onclick", "executeTest()");
path.setAttribute("transform", "translate(50, 50)");
var animate = createSVGElement("animate");
animate.setAttribute("id", "animation");
animate.setAttribute("attributeName", "d");
animate.setAttribute("from", "M -30 -30 q 30 0 30 30 t -30 30 Z");
animate.setAttribute("to", "M -30 -30 Q 30 -30 30 0 T -30 30 Z");
animate.setAttribute("begin", "click");
animate.setAttribute("dur", "4s");
path.appendChild(animate);
rootSVGElement.appendChild(path);
// Setup animation test
function sample1() {
// Check initial/end conditions
shouldBeEqualToString("path.getAttribute('d')", "M -30 -30 q 30 0 30 30 t -30 30 Z");
}
function sample2() {
shouldBeEqualToString("path.getAttribute('d')", "M -30 -30 q 37.5 0 37.5 30 t -37.5 30 Z");
}
function sample3() {
shouldBeEqualToString("path.getAttribute('d')", "M -30 -30 Q 22.5 -30 22.5 0 T -30 30 Z");
}
function sample4() {
shouldBeEqualToString("path.getAttribute('d')", "M -30 -30 Q 29.9925 -30 29.9925 0 T -30 30 Z");
}
function executeTest() {
const expectedValues = [
// [animationId, time, sampleCallback]
["animation", 0.0, sample1],
["animation", 1.0, sample2],
["animation", 3.0, sample3],
["animation", 3.999, sample4],
["animation", 4.001, sample1]
];
runAnimationTest(expectedValues);
}
window.clickX = 40;
window.clickY = 70;
var successfullyParsed = true;
| wuhengzhi/chromium-crosswalk | third_party/WebKit/LayoutTests/svg/animations/script-tests/animate-path-animation-qQ-tT-inverse.js | JavaScript | bsd-3-clause | 1,777 |
<html>
<body>
<script type="text/javascript" charset="utf-8">
window.open('http://host', 'host', 'this-is-not-a-standard-feature');
</script>
</body>
</html>
| renaesop/electron | spec/fixtures/pages/window-open.html | HTML | mit | 160 |
/**
* Copyright 2017 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MDCFoundation } from 'material__base';
import { cssClasses, strings } from './constants';
import { MSDDialogAdapter } from './adapter';
export class MDCDialogFoundation extends MDCFoundation<MSDDialogAdapter> {
static readonly cssClasses: cssClasses;
static readonly strings: strings;
static readonly defaultAdapter: MSDDialogAdapter;
open(): void;
close(): void;
isOpen(): boolean;
accept(shouldNotify: boolean): void;
cancel(shouldNotify: boolean): void;
}
export default MDCDialogFoundation;
| laurentiustamate94/DefinitelyTyped | types/material__dialog/foundation.d.ts | TypeScript | mit | 1,164 |
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\DependencyInjection\Tests\Dumper;
use DummyProxyDumper;
use PHPUnit\Framework\TestCase;
use Psr\Container\ContainerInterface;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface as SymfonyContainerInterface;
use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator;
use Symfony\Component\DependencyInjection\TypedReference;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\DependencyInjection\ServiceLocator;
use Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber;
use Symfony\Component\DependencyInjection\Variable;
use Symfony\Component\ExpressionLanguage\Expression;
require_once __DIR__.'/../Fixtures/includes/classes.php';
class PhpDumperTest extends TestCase
{
protected static $fixturesPath;
public static function setUpBeforeClass()
{
self::$fixturesPath = realpath(__DIR__.'/../Fixtures/');
}
public function testDump()
{
$container = new ContainerBuilder();
$container->compile();
$dumper = new PhpDumper($container);
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services1.php', $dumper->dump(), '->dump() dumps an empty container as an empty PHP class');
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services1-1.php', $dumper->dump(array('class' => 'Container', 'base_class' => 'AbstractContainer', 'namespace' => 'Symfony\Component\DependencyInjection\Dump')), '->dump() takes a class and a base_class options');
}
public function testDumpOptimizationString()
{
$definition = new Definition();
$definition->setClass('stdClass');
$definition->addArgument(array(
'only dot' => '.',
'concatenation as value' => '.\'\'.',
'concatenation from the start value' => '\'\'.',
'.' => 'dot as a key',
'.\'\'.' => 'concatenation as a key',
'\'\'.' => 'concatenation from the start key',
'optimize concatenation' => 'string1%some_string%string2',
'optimize concatenation with empty string' => 'string1%empty_value%string2',
'optimize concatenation from the start' => '%empty_value%start',
'optimize concatenation at the end' => 'end%empty_value%',
));
$container = new ContainerBuilder();
$container->setResourceTracking(false);
$container->setDefinition('test', $definition);
$container->setParameter('empty_value', '');
$container->setParameter('some_string', '-');
$container->compile();
$dumper = new PhpDumper($container);
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services10.php', $dumper->dump(), '->dump() dumps an empty container as an empty PHP class');
}
public function testDumpRelativeDir()
{
$definition = new Definition();
$definition->setClass('stdClass');
$definition->addArgument('%foo%');
$definition->addArgument(array('%foo%' => '%buz%/'));
$container = new ContainerBuilder();
$container->setDefinition('test', $definition);
$container->setParameter('foo', 'wiz'.dirname(__DIR__));
$container->setParameter('bar', __DIR__);
$container->setParameter('baz', '%bar%/PhpDumperTest.php');
$container->setParameter('buz', dirname(dirname(__DIR__)));
$container->compile();
$dumper = new PhpDumper($container);
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services12.php', $dumper->dump(array('file' => __FILE__)), '->dump() dumps __DIR__ relative strings');
}
/**
* @dataProvider provideInvalidParameters
* @expectedException \InvalidArgumentException
*/
public function testExportParameters($parameters)
{
$container = new ContainerBuilder(new ParameterBag($parameters));
$container->compile();
$dumper = new PhpDumper($container);
$dumper->dump();
}
public function provideInvalidParameters()
{
return array(
array(array('foo' => new Definition('stdClass'))),
array(array('foo' => new Expression('service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default")'))),
array(array('foo' => new Reference('foo'))),
array(array('foo' => new Variable('foo'))),
);
}
public function testAddParameters()
{
$container = include self::$fixturesPath.'/containers/container8.php';
$container->compile();
$dumper = new PhpDumper($container);
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services8.php', $dumper->dump(), '->dump() dumps parameters');
}
/**
* @group legacy
* @expectedDeprecation Dumping an uncompiled ContainerBuilder is deprecated since version 3.3 and will not be supported anymore in 4.0. Compile the container beforehand.
*/
public function testAddServiceWithoutCompilation()
{
$container = include self::$fixturesPath.'/containers/container9.php';
$dumper = new PhpDumper($container);
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services9.php', str_replace(str_replace('\\', '\\\\', self::$fixturesPath.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR), '%path%', $dumper->dump()), '->dump() dumps services');
}
public function testAddService()
{
$container = include self::$fixturesPath.'/containers/container9.php';
$container->compile();
$dumper = new PhpDumper($container);
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services9_compiled.php', str_replace(str_replace('\\', '\\\\', self::$fixturesPath.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR), '%path%', $dumper->dump()), '->dump() dumps services');
$container = new ContainerBuilder();
$container->register('foo', 'FooClass')->addArgument(new \stdClass());
$container->compile();
$dumper = new PhpDumper($container);
try {
$dumper->dump();
$this->fail('->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources');
} catch (\Exception $e) {
$this->assertInstanceOf('\Symfony\Component\DependencyInjection\Exception\RuntimeException', $e, '->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources');
$this->assertEquals('Unable to dump a service container if a parameter is an object or a resource.', $e->getMessage(), '->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources');
}
}
public function testServicesWithAnonymousFactories()
{
$container = include self::$fixturesPath.'/containers/container19.php';
$container->compile();
$dumper = new PhpDumper($container);
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services19.php', $dumper->dump(), '->dump() dumps services with anonymous factories');
}
public function testAddServiceIdWithUnsupportedCharacters()
{
$class = 'Symfony_DI_PhpDumper_Test_Unsupported_Characters';
$container = new ContainerBuilder();
$container->register('bar$', 'FooClass');
$container->register('bar$!', 'FooClass');
$container->compile();
$dumper = new PhpDumper($container);
eval('?>'.$dumper->dump(array('class' => $class)));
$this->assertTrue(method_exists($class, 'getBarService'));
$this->assertTrue(method_exists($class, 'getBar2Service'));
}
public function testConflictingServiceIds()
{
$class = 'Symfony_DI_PhpDumper_Test_Conflicting_Service_Ids';
$container = new ContainerBuilder();
$container->register('foo_bar', 'FooClass');
$container->register('foobar', 'FooClass');
$container->compile();
$dumper = new PhpDumper($container);
eval('?>'.$dumper->dump(array('class' => $class)));
$this->assertTrue(method_exists($class, 'getFooBarService'));
$this->assertTrue(method_exists($class, 'getFoobar2Service'));
}
public function testConflictingMethodsWithParent()
{
$class = 'Symfony_DI_PhpDumper_Test_Conflicting_Method_With_Parent';
$container = new ContainerBuilder();
$container->register('bar', 'FooClass');
$container->register('foo_bar', 'FooClass');
$container->compile();
$dumper = new PhpDumper($container);
eval('?>'.$dumper->dump(array(
'class' => $class,
'base_class' => 'Symfony\Component\DependencyInjection\Tests\Fixtures\containers\CustomContainer',
)));
$this->assertTrue(method_exists($class, 'getBar2Service'));
$this->assertTrue(method_exists($class, 'getFoobar2Service'));
}
/**
* @dataProvider provideInvalidFactories
* @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
* @expectedExceptionMessage Cannot dump definition
*/
public function testInvalidFactories($factory)
{
$container = new ContainerBuilder();
$def = new Definition('stdClass');
$def->setFactory($factory);
$container->setDefinition('bar', $def);
$container->compile();
$dumper = new PhpDumper($container);
$dumper->dump();
}
public function provideInvalidFactories()
{
return array(
array(array('', 'method')),
array(array('class', '')),
array(array('...', 'method')),
array(array('class', '...')),
);
}
public function testAliases()
{
$container = include self::$fixturesPath.'/containers/container9.php';
$container->setParameter('foo_bar', 'foo_bar');
$container->compile();
$dumper = new PhpDumper($container);
eval('?>'.$dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Test_Aliases')));
$container = new \Symfony_DI_PhpDumper_Test_Aliases();
$foo = $container->get('foo');
$this->assertSame($foo, $container->get('alias_for_foo'));
$this->assertSame($foo, $container->get('alias_for_alias'));
}
public function testFrozenContainerWithoutAliases()
{
$container = new ContainerBuilder();
$container->compile();
$dumper = new PhpDumper($container);
eval('?>'.$dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Test_Frozen_No_Aliases')));
$container = new \Symfony_DI_PhpDumper_Test_Frozen_No_Aliases();
$this->assertFalse($container->has('foo'));
}
/**
* @group legacy
* @expectedDeprecation Setting the "bar" pre-defined service is deprecated since Symfony 3.3 and won't be supported anymore in Symfony 4.0.
*/
public function testOverrideServiceWhenUsingADumpedContainer()
{
require_once self::$fixturesPath.'/php/services9.php';
require_once self::$fixturesPath.'/includes/foo.php';
$container = new \ProjectServiceContainer();
$container->set('bar', $bar = new \stdClass());
$container->setParameter('foo_bar', 'foo_bar');
$this->assertSame($bar, $container->get('bar'), '->set() overrides an already defined service');
}
/**
* @group legacy
* @expectedDeprecation Setting the "bar" pre-defined service is deprecated since Symfony 3.3 and won't be supported anymore in Symfony 4.0.
*/
public function testOverrideServiceWhenUsingADumpedContainerAndServiceIsUsedFromAnotherOne()
{
require_once self::$fixturesPath.'/php/services9.php';
require_once self::$fixturesPath.'/includes/foo.php';
require_once self::$fixturesPath.'/includes/classes.php';
$container = new \ProjectServiceContainer();
$container->set('bar', $bar = new \stdClass());
$this->assertSame($bar, $container->get('foo')->bar, '->set() overrides an already defined service');
}
/**
* @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException
*/
public function testCircularReference()
{
$container = new ContainerBuilder();
$container->register('foo', 'stdClass')->addArgument(new Reference('bar'));
$container->register('bar', 'stdClass')->setPublic(false)->addMethodCall('setA', array(new Reference('baz')));
$container->register('baz', 'stdClass')->addMethodCall('setA', array(new Reference('foo')));
$container->compile();
$dumper = new PhpDumper($container);
$dumper->dump();
}
public function testDumpAutowireData()
{
$container = include self::$fixturesPath.'/containers/container24.php';
$container->compile();
$dumper = new PhpDumper($container);
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services24.php', $dumper->dump());
}
public function testEnvParameter()
{
$container = new ContainerBuilder();
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml'));
$loader->load('services26.yml');
$container->compile();
$dumper = new PhpDumper($container);
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services26.php', $dumper->dump(), '->dump() dumps inline definitions which reference service_container');
}
/**
* @expectedException \Symfony\Component\DependencyInjection\Exception\EnvParameterException
* @expectedExceptionMessage Environment variables "FOO" are never used. Please, check your container's configuration.
*/
public function testUnusedEnvParameter()
{
$container = new ContainerBuilder();
$container->getParameter('env(FOO)');
$container->compile();
$dumper = new PhpDumper($container);
$dumper->dump();
}
public function testInlinedDefinitionReferencingServiceContainer()
{
$container = new ContainerBuilder();
$container->register('foo', 'stdClass')->addMethodCall('add', array(new Reference('service_container')))->setPublic(false);
$container->register('bar', 'stdClass')->addArgument(new Reference('foo'));
$container->compile();
$dumper = new PhpDumper($container);
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services13.php', $dumper->dump(), '->dump() dumps inline definitions which reference service_container');
}
public function testInitializePropertiesBeforeMethodCalls()
{
require_once self::$fixturesPath.'/includes/classes.php';
$container = new ContainerBuilder();
$container->register('foo', 'stdClass');
$container->register('bar', 'MethodCallClass')
->setProperty('simple', 'bar')
->setProperty('complex', new Reference('foo'))
->addMethodCall('callMe');
$container->compile();
$dumper = new PhpDumper($container);
eval('?>'.$dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Test_Properties_Before_Method_Calls')));
$container = new \Symfony_DI_PhpDumper_Test_Properties_Before_Method_Calls();
$this->assertTrue($container->get('bar')->callPassed(), '->dump() initializes properties before method calls');
}
public function testCircularReferenceAllowanceForLazyServices()
{
$container = new ContainerBuilder();
$container->register('foo', 'stdClass')->addArgument(new Reference('bar'));
$container->register('bar', 'stdClass')->setLazy(true)->addArgument(new Reference('foo'));
$container->compile();
$dumper = new PhpDumper($container);
$dumper->dump();
$this->addToAssertionCount(1);
}
public function testCircularReferenceAllowanceForInlinedDefinitionsForLazyServices()
{
/*
* test graph:
* [connection] -> [event_manager] --> [entity_manager](lazy)
* |
* --(call)- addEventListener ("@lazy_service")
*
* [lazy_service](lazy) -> [entity_manager](lazy)
*
*/
$container = new ContainerBuilder();
$eventManagerDefinition = new Definition('stdClass');
$connectionDefinition = $container->register('connection', 'stdClass');
$connectionDefinition->addArgument($eventManagerDefinition);
$container->register('entity_manager', 'stdClass')
->setLazy(true)
->addArgument(new Reference('connection'));
$lazyServiceDefinition = $container->register('lazy_service', 'stdClass');
$lazyServiceDefinition->setLazy(true);
$lazyServiceDefinition->addArgument(new Reference('entity_manager'));
$eventManagerDefinition->addMethodCall('addEventListener', array(new Reference('lazy_service')));
$container->compile();
$dumper = new PhpDumper($container);
$dumper->setProxyDumper(new DummyProxyDumper());
$dumper->dump();
$this->addToAssertionCount(1);
}
public function testLazyArgumentProvideGenerator()
{
require_once self::$fixturesPath.'/includes/classes.php';
$container = new ContainerBuilder();
$container->register('lazy_referenced', 'stdClass');
$container
->register('lazy_context', 'LazyContext')
->setArguments(array(
new IteratorArgument(array('k1' => new Reference('lazy_referenced'), 'k2' => new Reference('service_container'))),
new IteratorArgument(array()),
))
;
$container->compile();
$dumper = new PhpDumper($container);
eval('?>'.$dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Test_Lazy_Argument_Provide_Generator')));
$container = new \Symfony_DI_PhpDumper_Test_Lazy_Argument_Provide_Generator();
$lazyContext = $container->get('lazy_context');
$this->assertInstanceOf(RewindableGenerator::class, $lazyContext->lazyValues);
$this->assertInstanceOf(RewindableGenerator::class, $lazyContext->lazyEmptyValues);
$this->assertCount(2, $lazyContext->lazyValues);
$this->assertCount(0, $lazyContext->lazyEmptyValues);
$i = -1;
foreach ($lazyContext->lazyValues as $k => $v) {
switch (++$i) {
case 0:
$this->assertEquals('k1', $k);
$this->assertInstanceOf('stdCLass', $v);
break;
case 1:
$this->assertEquals('k2', $k);
$this->assertInstanceOf('Symfony_DI_PhpDumper_Test_Lazy_Argument_Provide_Generator', $v);
break;
}
}
$this->assertEmpty(iterator_to_array($lazyContext->lazyEmptyValues));
}
public function testNormalizedId()
{
$container = include self::$fixturesPath.'/containers/container33.php';
$container->compile();
$dumper = new PhpDumper($container);
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services33.php', $dumper->dump());
}
public function testDumpContainerBuilderWithFrozenConstructorIncludingPrivateServices()
{
$container = new ContainerBuilder();
$container->register('foo_service', 'stdClass')->setArguments(array(new Reference('baz_service')));
$container->register('bar_service', 'stdClass')->setArguments(array(new Reference('baz_service')));
$container->register('baz_service', 'stdClass')->setPublic(false);
$container->compile();
$dumper = new PhpDumper($container);
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services_private_frozen.php', $dumper->dump());
}
public function testServiceLocator()
{
$container = new ContainerBuilder();
$container->register('foo_service', ServiceLocator::class)
->addArgument(array(
'bar' => new ServiceClosureArgument(new Reference('bar_service')),
'baz' => new ServiceClosureArgument(new TypedReference('baz_service', 'stdClass')),
'nil' => $nil = new ServiceClosureArgument(new Reference('nil')),
))
;
// no method calls
$container->register('translator.loader_1', 'stdClass');
$container->register('translator.loader_1_locator', ServiceLocator::class)
->setPublic(false)
->addArgument(array(
'translator.loader_1' => new ServiceClosureArgument(new Reference('translator.loader_1')),
));
$container->register('translator_1', StubbedTranslator::class)
->addArgument(new Reference('translator.loader_1_locator'));
// one method calls
$container->register('translator.loader_2', 'stdClass');
$container->register('translator.loader_2_locator', ServiceLocator::class)
->setPublic(false)
->addArgument(array(
'translator.loader_2' => new ServiceClosureArgument(new Reference('translator.loader_2')),
));
$container->register('translator_2', StubbedTranslator::class)
->addArgument(new Reference('translator.loader_2_locator'))
->addMethodCall('addResource', array('db', new Reference('translator.loader_2'), 'nl'));
// two method calls
$container->register('translator.loader_3', 'stdClass');
$container->register('translator.loader_3_locator', ServiceLocator::class)
->setPublic(false)
->addArgument(array(
'translator.loader_3' => new ServiceClosureArgument(new Reference('translator.loader_3')),
));
$container->register('translator_3', StubbedTranslator::class)
->addArgument(new Reference('translator.loader_3_locator'))
->addMethodCall('addResource', array('db', new Reference('translator.loader_3'), 'nl'))
->addMethodCall('addResource', array('db', new Reference('translator.loader_3'), 'en'));
$nil->setValues(array(null));
$container->register('bar_service', 'stdClass')->setArguments(array(new Reference('baz_service')));
$container->register('baz_service', 'stdClass')->setPublic(false);
$container->compile();
$dumper = new PhpDumper($container);
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services_locator.php', $dumper->dump());
}
public function testServiceSubscriber()
{
$container = new ContainerBuilder();
$container->register('foo_service', TestServiceSubscriber::class)
->setAutowired(true)
->addArgument(new Reference(ContainerInterface::class))
->addTag('container.service_subscriber', array(
'key' => 'bar',
'id' => TestServiceSubscriber::class,
))
;
$container->register(TestServiceSubscriber::class, TestServiceSubscriber::class);
$container->compile();
$dumper = new PhpDumper($container);
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services_subscriber.php', $dumper->dump());
}
public function testPrivateWithIgnoreOnInvalidReference()
{
require_once self::$fixturesPath.'/includes/classes.php';
$container = new ContainerBuilder();
$container->register('not_invalid', 'BazClass')
->setPublic(false);
$container->register('bar', 'BarClass')
->addMethodCall('setBaz', array(new Reference('not_invalid', SymfonyContainerInterface::IGNORE_ON_INVALID_REFERENCE)));
$container->compile();
$dumper = new PhpDumper($container);
eval('?>'.$dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Test_Private_With_Ignore_On_Invalid_Reference')));
$container = new \Symfony_DI_PhpDumper_Test_Private_With_Ignore_On_Invalid_Reference();
$this->assertInstanceOf('BazClass', $container->get('bar')->getBaz());
}
public function testExpressionReferencingPrivateService()
{
$container = new ContainerBuilder();
$container->register('private_bar', 'stdClass')
->setPublic(false);
$container->register('private_foo', 'stdClass')
->setPublic(false);
$container->register('public_foo', 'stdClass')
->addArgument(new Expression('service("private_foo")'));
$container->compile();
$dumper = new PhpDumper($container);
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services_private_in_expression.php', $dumper->dump());
}
public function testDumpHandlesLiteralClassWithRootNamespace()
{
$container = new ContainerBuilder();
$container->register('foo', '\\stdClass');
$container->compile();
$dumper = new PhpDumper($container);
eval('?>'.$dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Test_Literal_Class_With_Root_Namespace')));
$container = new \Symfony_DI_PhpDumper_Test_Literal_Class_With_Root_Namespace();
$this->assertInstanceOf('stdClass', $container->get('foo'));
}
/**
* This test checks the trigger of a deprecation note and should not be removed in major releases.
*
* @group legacy
* @expectedDeprecation The "foo" service is deprecated. You should stop using it, as it will soon be removed.
*/
public function testPrivateServiceTriggersDeprecation()
{
$container = new ContainerBuilder();
$container->register('foo', 'stdClass')
->setPublic(false)
->setDeprecated(true);
$container->register('bar', 'stdClass')
->setPublic(true)
->setProperty('foo', new Reference('foo'));
$container->compile();
$dumper = new PhpDumper($container);
eval('?>'.$dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Test_Private_Service_Triggers_Deprecation')));
$container = new \Symfony_DI_PhpDumper_Test_Private_Service_Triggers_Deprecation();
$container->get('bar');
}
}
| davidcerezal/symfony_api_project | vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php | PHP | mit | 27,206 |
--
-- Copyright (c) 2011 Citrix Systems, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--
import Distribution.Simple
import Distribution.Simple.PreProcess
import Distribution.Simple.PreProcess.Unlit (unlit)
import Distribution.Package
( Package(..), PackageName(..) )
import Distribution.ModuleName (ModuleName)
import qualified Distribution.ModuleName as ModuleName
import Distribution.PackageDescription as PD
( PackageDescription(..), BuildInfo(..), Executable(..), withExe
, Library(..), withLib, libModules )
import qualified Distribution.InstalledPackageInfo as Installed
( InstalledPackageInfo_(..) )
import qualified Distribution.Simple.PackageIndex as PackageIndex
import Distribution.Simple.Compiler
( CompilerFlavor(..), Compiler(..), compilerFlavor, compilerVersion )
import Distribution.Simple.LocalBuildInfo (LocalBuildInfo(..))
import Distribution.Simple.BuildPaths (autogenModulesDir,cppHeaderName)
import Distribution.Simple.Utils
( createDirectoryIfMissingVerbose, withUTF8FileContents, writeUTF8File
, die, setupMessage, intercalate, copyFileVerbose
, findFileWithExtension, findFileWithExtension' )
import Distribution.Simple.Program
( Program(..), ConfiguredProgram(..), lookupProgram, programPath
, rawSystemProgramConf, rawSystemProgram
, greencardProgram, cpphsProgram, hsc2hsProgram, c2hsProgram
, happyProgram, alexProgram, haddockProgram, ghcProgram, gccProgram, ldProgram )
import Distribution.System
( OS(OSX, Windows), buildOS )
import Distribution.Version (Version(..))
import Distribution.Verbosity
import Distribution.Text
( display )
import Control.Monad (when, unless)
import Data.Maybe (fromMaybe)
import Data.List (nub)
import System.Directory (getModificationTime, doesFileExist)
import System.Info (os, arch)
import System.FilePath (splitExtension, dropExtensions, (</>), (<.>),
takeDirectory, normalise, replaceExtension)
import Distribution.Simple.Program (simpleProgram)
hsc2hsLdProgram = simpleProgram "hsc2hs-ld"
my_ppHsc2hs :: BuildInfo -> LocalBuildInfo -> PreProcessor
my_ppHsc2hs bi lbi = standardPP lbi hsc2hsProgram $
[ "--cc=" ++ programPath gccProg
, "--ld=" ++ programPath ldProg ]
-- [ "--cc=" ++ cc
-- , "--ld=" ++ ld ]
-- Additional gcc options
++ [ "--cflag=" ++ opt | opt <- programArgs gccProg ]
++ [ "--lflag=" ++ opt | opt <- programArgs gccProg ]
-- OSX frameworks:
++ [ what ++ "=-F" ++ opt
| isOSX
, opt <- nub (concatMap Installed.frameworkDirs pkgs)
, what <- ["--cflag", "--lflag"] ]
++ [ "--lflag=" ++ arg
| isOSX
, opt <- PD.frameworks bi ++ concatMap Installed.frameworks pkgs
, arg <- ["-framework", opt] ]
-- Note that on ELF systems, wherever we use -L, we must also use -R
-- because presumably that -L dir is not on the normal path for the
-- system's dynamic linker. This is needed because hsc2hs works by
-- compiling a C program and then running it.
-- Options from the current package:
++ [ "--cflag=" ++ opt | opt <- hcDefines (compiler lbi) ]
++ [ "--cflag=-I" ++ dir | dir <- PD.includeDirs bi ]
++ [ "--cflag=" ++ opt | opt <- PD.ccOptions bi
++ PD.cppOptions bi ]
++ [ "--lflag=-L" ++ opt | opt <- PD.extraLibDirs bi ]
++ [ "--lflag=-Wl,-R," ++ opt | isELF
, opt <- PD.extraLibDirs bi ]
++ [ "--lflag=-l" ++ opt | opt <- PD.extraLibs bi ]
++ [ "--lflag=" ++ opt | opt <- PD.ldOptions bi ]
-- Options from dependent packages
++ [ "--cflag=" ++ opt
| pkg <- pkgs
, opt <- [ "-I" ++ opt | opt <- Installed.includeDirs pkg ]
++ [ opt | opt <- Installed.ccOptions pkg ] ]
++ [ "--lflag=" ++ opt
| pkg <- pkgs
, opt <- [ "-L" ++ opt | opt <- Installed.libraryDirs pkg ]
++ [ "-Wl,-R," ++ opt | isELF
, opt <- Installed.libraryDirs pkg ]
++ [ "-l" ++ opt | opt <- Installed.extraLibraries pkg ]
++ [ opt | opt <- Installed.ldOptions pkg ] ]
where
pkgs = PackageIndex.topologicalOrder (packageHacks (installedPkgs lbi))
Just gccProg = lookupProgram gccProgram (withPrograms lbi)
Just ldProg = lookupProgram hsc2hsLdProgram (withPrograms lbi)
isOSX = case buildOS of OSX -> True; _ -> False
isELF = case buildOS of OSX -> False; Windows -> False; _ -> True;
packageHacks = case compilerFlavor (compiler lbi) of
GHC -> hackRtsPackage
_ -> id
-- We don't link in the actual Haskell libraries of our dependencies, so
-- the -u flags in the ldOptions of the rts package mean linking fails on
-- OS X (it's ld is a tad stricter than gnu ld). Thus we remove the
-- ldOptions for GHC's rts package:
hackRtsPackage index =
case PackageIndex.lookupPackageName index (PackageName "rts") of
[(_, [rts])]
-> PackageIndex.insert rts { Installed.ldOptions = [] } index
_ -> error "No (or multiple) ghc rts package is registered!!"
-- TODO: move this into the compiler abstraction
-- FIXME: this forces GHC's crazy 4.8.2 -> 408 convention on all the other
-- compilers. Check if that's really what they want.
versionInt :: Version -> String
versionInt (Version { versionBranch = [] }) = "1"
versionInt (Version { versionBranch = [n] }) = show n
versionInt (Version { versionBranch = n1:n2:_ })
= -- 6.8.x -> 608
-- 6.10.x -> 610
let s1 = show n1
s2 = show n2
middle = case s2 of
_ : _ : _ -> ""
_ -> "0"
in s1 ++ middle ++ s2
standardPP :: LocalBuildInfo -> Program -> [String] -> PreProcessor
standardPP lbi prog args =
PreProcessor {
platformIndependent = False,
runPreProcessor = mkSimplePreProcessor $ \inFile outFile verbosity ->
do rawSystemProgramConf verbosity prog (withPrograms lbi)
(args ++ ["-o", outFile, inFile])
-- XXX This is a nasty hack. GHC requires that hs-boot files
-- be in the same place as the hs files, so if we put the hs
-- file in dist/... then we need to copy the hs-boot file
-- there too. This should probably be done another way, e.g.
-- by preprocessing all files, with and "id" preprocessor if
-- nothing else, so the hs-boot files automatically get copied
-- into the right place.
-- Possibly we should also be looking for .lhs-boot files, but
-- I think that preprocessors only produce .hs files.
let inBoot = replaceExtension inFile "hs-boot"
outBoot = replaceExtension outFile "hs-boot"
exists <- doesFileExist inBoot
when exists $ copyFileVerbose verbosity inBoot outBoot
}
hcDefines :: Compiler -> [String]
hcDefines comp =
case compilerFlavor comp of
GHC -> ["-D__GLASGOW_HASKELL__=" ++ versionInt version]
JHC -> ["-D__JHC__=" ++ versionInt version]
NHC -> ["-D__NHC__=" ++ versionInt version]
Hugs -> ["-D__HUGS__"]
_ -> []
where version = compilerVersion comp
main = defaultMainWithHooks $ simpleUserHooks {
hookedPreProcessors = [ ("hsc", my_ppHsc2hs) ]
, hookedPrograms = hsc2hsLdProgram : hookedPrograms simpleUserHooks
}
| jean-edouard/manager | xenmgr/Setup.hs | Haskell | gpl-2.0 | 8,034 |
/*
* chap.c - Challenge Handshake Authentication Protocol.
*
* Copyright (c) 1993 The Australian National University.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the Australian National University. The name of the University
* may not be used to endorse or promote products derived from this
* software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* Copyright (c) 1991 Gregory M. Christy.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by Gregory M. Christy. The name of the author may not be used to
* endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#define RCSID "$Id$"
/*
* TODO:
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h> /* drand48, srand48 */
#include <sys/types.h>
#include <sys/time.h>
#include "pppd.h"
#include "chap.h"
#include "md5.h"
#ifdef CHAPMS
#include "chap_ms.h"
#endif
static const char rcsid[] = RCSID;
/*
* Command-line options.
*/
static option_t chap_option_list[] = {
{ "chap-restart", o_int, &chap[0].timeouttime,
"Set timeout for CHAP", 0, NULL, 0, 0 },
{ "chap-max-challenge", o_int, &chap[0].max_transmits,
"Set max #xmits for challenge", 0, NULL, 0, 0 },
{ "chap-interval", o_int, &chap[0].chal_interval,
"Set interval for rechallenge", 0, NULL, 0, 0 },
#ifdef MSLANMAN
{ "ms-lanman", o_bool, &ms_lanman,
"Use LanMan passwd when using MS-CHAP", 1, NULL, 0, 0 },
#endif
{ NULL, 0, NULL, NULL, 0, NULL, 0, 0 }
};
/*
* Protocol entry points.
*/
static void ChapInit(int);
static void ChapLowerUp(int);
static void ChapLowerDown(int);
static void ChapInput(int, u_char *, int);
static void ChapProtocolReject(int);
static int ChapPrintPkt(u_char *, int,
void (*)(void *, char *, ...), void *);
struct protent chap_protent = {
PPP_CHAP,
ChapInit,
ChapInput,
ChapProtocolReject,
ChapLowerUp,
ChapLowerDown,
NULL,
NULL,
ChapPrintPkt,
NULL,
1,
"CHAP",
NULL,
chap_option_list,
NULL,
NULL,
NULL
};
chap_state chap[NUM_PPP]; /* CHAP state; one for each unit */
static void ChapChallengeTimeout(void *);
static void ChapResponseTimeout(void *);
static void ChapReceiveChallenge(chap_state *, u_char *, int, int);
static void ChapRechallenge(void *);
static void ChapReceiveResponse(chap_state *, u_char *, int, int);
static void ChapReceiveSuccess(chap_state *, u_char *, u_char, int);
static void ChapReceiveFailure(chap_state *, u_char *, u_char, int);
static void ChapSendStatus(chap_state *, int);
static void ChapSendChallenge(chap_state *);
static void ChapSendResponse(chap_state *);
static void ChapGenChallenge(chap_state *);
/*
* ChapInit - Initialize a CHAP unit.
*/
static void
ChapInit(
int unit)
{
chap_state *cstate = &chap[unit];
BZERO(cstate, sizeof(*cstate));
cstate->unit = unit;
cstate->clientstate = CHAPCS_INITIAL;
cstate->serverstate = CHAPSS_INITIAL;
cstate->timeouttime = CHAP_DEFTIMEOUT;
cstate->max_transmits = CHAP_DEFTRANSMITS;
/* random number generator is initialized in magic_init */
}
/*
* ChapAuthWithPeer - Authenticate us with our peer (start client).
*
*/
void
ChapAuthWithPeer(
int unit,
char *our_name,
int digest)
{
chap_state *cstate = &chap[unit];
cstate->resp_name = our_name;
cstate->resp_type = digest;
if (cstate->clientstate == CHAPCS_INITIAL ||
cstate->clientstate == CHAPCS_PENDING) {
/* lower layer isn't up - wait until later */
cstate->clientstate = CHAPCS_PENDING;
return;
}
/*
* We get here as a result of LCP coming up.
* So even if CHAP was open before, we will
* have to re-authenticate ourselves.
*/
cstate->clientstate = CHAPCS_LISTEN;
}
/*
* ChapAuthPeer - Authenticate our peer (start server).
*/
void
ChapAuthPeer(
int unit,
char *our_name,
int digest)
{
chap_state *cstate = &chap[unit];
cstate->chal_name = our_name;
cstate->chal_type = digest;
if (cstate->serverstate == CHAPSS_INITIAL ||
cstate->serverstate == CHAPSS_PENDING) {
/* lower layer isn't up - wait until later */
cstate->serverstate = CHAPSS_PENDING;
return;
}
ChapGenChallenge(cstate);
ChapSendChallenge(cstate); /* crank it up dude! */
cstate->serverstate = CHAPSS_INITIAL_CHAL;
}
/*
* ChapChallengeTimeout - Timeout expired on sending challenge.
*/
static void
ChapChallengeTimeout(
void *arg)
{
chap_state *cstate = (chap_state *) arg;
/* if we aren't sending challenges, don't worry. then again we */
/* probably shouldn't be here either */
if (cstate->serverstate != CHAPSS_INITIAL_CHAL &&
cstate->serverstate != CHAPSS_RECHALLENGE)
return;
if (cstate->chal_transmits >= cstate->max_transmits) {
/* give up on peer */
error("Peer failed to respond to CHAP challenge");
cstate->serverstate = CHAPSS_BADAUTH;
auth_peer_fail(cstate->unit, PPP_CHAP);
return;
}
ChapSendChallenge(cstate); /* Re-send challenge */
}
/*
* ChapResponseTimeout - Timeout expired on sending response.
*/
static void
ChapResponseTimeout(
void *arg)
{
chap_state *cstate = (chap_state *) arg;
/* if we aren't sending a response, don't worry. */
if (cstate->clientstate != CHAPCS_RESPONSE)
return;
ChapSendResponse(cstate); /* re-send response */
}
/*
* ChapRechallenge - Time to challenge the peer again.
*/
static void
ChapRechallenge(
void *arg)
{
chap_state *cstate = (chap_state *) arg;
/* if we aren't sending a response, don't worry. */
if (cstate->serverstate != CHAPSS_OPEN)
return;
ChapGenChallenge(cstate);
ChapSendChallenge(cstate);
cstate->serverstate = CHAPSS_RECHALLENGE;
}
/*
* ChapLowerUp - The lower layer is up.
*
* Start up if we have pending requests.
*/
static void
ChapLowerUp(
int unit)
{
chap_state *cstate = &chap[unit];
if (cstate->clientstate == CHAPCS_INITIAL)
cstate->clientstate = CHAPCS_CLOSED;
else if (cstate->clientstate == CHAPCS_PENDING)
cstate->clientstate = CHAPCS_LISTEN;
if (cstate->serverstate == CHAPSS_INITIAL)
cstate->serverstate = CHAPSS_CLOSED;
else if (cstate->serverstate == CHAPSS_PENDING) {
ChapGenChallenge(cstate);
ChapSendChallenge(cstate);
cstate->serverstate = CHAPSS_INITIAL_CHAL;
}
}
/*
* ChapLowerDown - The lower layer is down.
*
* Cancel all timeouts.
*/
static void
ChapLowerDown(
int unit)
{
chap_state *cstate = &chap[unit];
/* Timeout(s) pending? Cancel if so. */
if (cstate->serverstate == CHAPSS_INITIAL_CHAL ||
cstate->serverstate == CHAPSS_RECHALLENGE)
UNTIMEOUT(ChapChallengeTimeout, cstate);
else if (cstate->serverstate == CHAPSS_OPEN
&& cstate->chal_interval != 0)
UNTIMEOUT(ChapRechallenge, cstate);
if (cstate->clientstate == CHAPCS_RESPONSE)
UNTIMEOUT(ChapResponseTimeout, cstate);
cstate->clientstate = CHAPCS_INITIAL;
cstate->serverstate = CHAPSS_INITIAL;
}
/*
* ChapProtocolReject - Peer doesn't grok CHAP.
*/
static void
ChapProtocolReject(
int unit)
{
chap_state *cstate = &chap[unit];
if (cstate->serverstate != CHAPSS_INITIAL &&
cstate->serverstate != CHAPSS_CLOSED)
auth_peer_fail(unit, PPP_CHAP);
if (cstate->clientstate != CHAPCS_INITIAL &&
cstate->clientstate != CHAPCS_CLOSED)
auth_withpeer_fail(unit, PPP_CHAP);
ChapLowerDown(unit); /* shutdown chap */
}
/*
* ChapInput - Input CHAP packet.
*/
static void
ChapInput(
int unit,
u_char *inpacket,
int packet_len)
{
chap_state *cstate = &chap[unit];
u_char *inp;
u_char code, id;
int len;
/*
* Parse header (code, id and length).
* If packet too short, drop it.
*/
inp = inpacket;
if (packet_len < CHAP_HEADERLEN) {
CHAPDEBUG(("ChapInput: rcvd short header."));
return;
}
GETCHAR(code, inp);
GETCHAR(id, inp);
GETSHORT(len, inp);
if (len < CHAP_HEADERLEN) {
CHAPDEBUG(("ChapInput: rcvd illegal length."));
return;
}
if (len > packet_len) {
CHAPDEBUG(("ChapInput: rcvd short packet."));
return;
}
len -= CHAP_HEADERLEN;
/*
* Action depends on code (as in fact it usually does :-).
*/
switch (code) {
case CHAP_CHALLENGE:
ChapReceiveChallenge(cstate, inp, id, len);
break;
case CHAP_RESPONSE:
ChapReceiveResponse(cstate, inp, id, len);
break;
case CHAP_FAILURE:
ChapReceiveFailure(cstate, inp, id, len);
break;
case CHAP_SUCCESS:
ChapReceiveSuccess(cstate, inp, id, len);
break;
default: /* Need code reject? */
warn("Unknown CHAP code (%d) received.", code);
break;
}
}
/*
* ChapReceiveChallenge - Receive Challenge and send Response.
*/
static void
ChapReceiveChallenge(
chap_state *cstate,
u_char *inp,
int id,
int len)
{
int rchallenge_len;
u_char *rchallenge;
int secret_len;
unsigned char secret[MAXSECRETLEN];
char rhostname[256];
MD5_CTX mdContext;
u_char hash[MD5_SIGNATURE_SIZE];
if (cstate->clientstate == CHAPCS_CLOSED ||
cstate->clientstate == CHAPCS_PENDING) {
CHAPDEBUG(("ChapReceiveChallenge: in state %d", cstate->clientstate));
return;
}
if (len < 2) {
CHAPDEBUG(("ChapReceiveChallenge: rcvd short packet."));
return;
}
GETCHAR(rchallenge_len, inp);
len -= sizeof (u_char) + rchallenge_len; /* now name field length */
if (len < 0) {
CHAPDEBUG(("ChapReceiveChallenge: rcvd short packet."));
return;
}
rchallenge = inp;
INCPTR(rchallenge_len, inp);
if (len >= sizeof(rhostname))
len = sizeof(rhostname) - 1;
BCOPY(inp, rhostname, len);
rhostname[len] = '\000';
/* Microsoft doesn't send their name back in the PPP packet */
if (explicit_remote || (remote_name[0] != 0 && rhostname[0] == 0)) {
strlcpy(rhostname, remote_name, sizeof(rhostname));
CHAPDEBUG(("ChapReceiveChallenge: using '%q' as remote name",
rhostname));
}
/* get secret for authenticating ourselves with the specified host */
if (!get_secret(cstate->unit, cstate->resp_name, rhostname,
secret, &secret_len, 0)) {
secret_len = 0; /* assume null secret if can't find one */
warn("No CHAP secret found for authenticating us to %q", rhostname);
}
/* cancel response send timeout if necessary */
if (cstate->clientstate == CHAPCS_RESPONSE)
UNTIMEOUT(ChapResponseTimeout, cstate);
cstate->resp_id = id;
cstate->resp_transmits = 0;
/* generate MD based on negotiated type */
switch (cstate->resp_type) {
case CHAP_DIGEST_MD5:
MD5Init(&mdContext);
MD5Update(&mdContext, &cstate->resp_id, 1);
MD5Update(&mdContext, secret, secret_len);
MD5Update(&mdContext, rchallenge, rchallenge_len);
MD5Final(hash, &mdContext);
BCOPY(hash, cstate->response, MD5_SIGNATURE_SIZE);
cstate->resp_length = MD5_SIGNATURE_SIZE;
break;
#ifdef CHAPMS
case CHAP_MICROSOFT:
ChapMS(cstate, rchallenge, rchallenge_len, secret, secret_len);
break;
#endif
default:
CHAPDEBUG(("unknown digest type %d", cstate->resp_type));
return;
}
BZERO(secret, sizeof(secret));
ChapSendResponse(cstate);
}
/*
* ChapReceiveResponse - Receive and process response.
*/
static void
ChapReceiveResponse(
chap_state *cstate,
u_char *inp,
int id,
int len)
{
u_char *remmd, remmd_len;
int secret_len, old_state;
int code;
char rhostname[256];
MD5_CTX mdContext;
unsigned char secret[MAXSECRETLEN];
u_char hash[MD5_SIGNATURE_SIZE];
if (cstate->serverstate == CHAPSS_CLOSED ||
cstate->serverstate == CHAPSS_PENDING) {
CHAPDEBUG(("ChapReceiveResponse: in state %d", cstate->serverstate));
return;
}
if (id != cstate->chal_id)
return; /* doesn't match ID of last challenge */
/*
* If we have received a duplicate or bogus Response,
* we have to send the same answer (Success/Failure)
* as we did for the first Response we saw.
*/
if (cstate->serverstate == CHAPSS_OPEN) {
ChapSendStatus(cstate, CHAP_SUCCESS);
return;
}
if (cstate->serverstate == CHAPSS_BADAUTH) {
ChapSendStatus(cstate, CHAP_FAILURE);
return;
}
if (len < 2) {
CHAPDEBUG(("ChapReceiveResponse: rcvd short packet."));
return;
}
GETCHAR(remmd_len, inp); /* get length of MD */
remmd = inp; /* get pointer to MD */
INCPTR(remmd_len, inp);
len -= sizeof (u_char) + remmd_len;
if (len < 0) {
CHAPDEBUG(("ChapReceiveResponse: rcvd short packet."));
return;
}
UNTIMEOUT(ChapChallengeTimeout, cstate);
if (len >= sizeof(rhostname))
len = sizeof(rhostname) - 1;
BCOPY(inp, rhostname, len);
rhostname[len] = '\000';
/*
* Get secret for authenticating them with us,
* do the hash ourselves, and compare the result.
*/
code = CHAP_FAILURE;
if (!get_secret(cstate->unit, (explicit_remote? remote_name: rhostname),
cstate->chal_name, secret, &secret_len, 1)) {
warn("No CHAP secret found for authenticating %q", rhostname);
} else {
/* generate MD based on negotiated type */
switch (cstate->chal_type) {
case CHAP_DIGEST_MD5: /* only MD5 is defined for now */
if (remmd_len != MD5_SIGNATURE_SIZE)
break; /* it's not even the right length */
MD5Init(&mdContext);
MD5Update(&mdContext, &cstate->chal_id, 1);
MD5Update(&mdContext, secret, secret_len);
MD5Update(&mdContext, cstate->challenge, cstate->chal_len);
MD5Final(hash, &mdContext);
/* compare local and remote MDs and send the appropriate status */
if (memcmp (hash, remmd, MD5_SIGNATURE_SIZE) == 0)
code = CHAP_SUCCESS; /* they are the same! */
break;
default:
CHAPDEBUG(("unknown digest type %d", cstate->chal_type));
}
}
BZERO(secret, sizeof(secret));
ChapSendStatus(cstate, code);
if (code == CHAP_SUCCESS) {
old_state = cstate->serverstate;
cstate->serverstate = CHAPSS_OPEN;
if (old_state == CHAPSS_INITIAL_CHAL) {
auth_peer_success(cstate->unit, PPP_CHAP, rhostname, len);
}
if (cstate->chal_interval != 0)
TIMEOUT(ChapRechallenge, cstate, cstate->chal_interval);
notice("CHAP peer authentication succeeded for %q", rhostname);
} else {
error("CHAP peer authentication failed for remote host %q", rhostname);
cstate->serverstate = CHAPSS_BADAUTH;
auth_peer_fail(cstate->unit, PPP_CHAP);
}
}
/*
* ChapReceiveSuccess - Receive Success
*/
static void
ChapReceiveSuccess(
chap_state *cstate,
u_char *inp,
u_char id,
int len)
{
if (cstate->clientstate == CHAPCS_OPEN)
/* presumably an answer to a duplicate response */
return;
if (cstate->clientstate != CHAPCS_RESPONSE) {
/* don't know what this is */
CHAPDEBUG(("ChapReceiveSuccess: in state %d\n", cstate->clientstate));
return;
}
UNTIMEOUT(ChapResponseTimeout, cstate);
/*
* Print message.
*/
if (len > 0)
PRINTMSG(inp, len);
cstate->clientstate = CHAPCS_OPEN;
auth_withpeer_success(cstate->unit, PPP_CHAP);
}
/*
* ChapReceiveFailure - Receive failure.
*/
static void
ChapReceiveFailure(
chap_state *cstate,
u_char *inp,
u_char id,
int len)
{
if (cstate->clientstate != CHAPCS_RESPONSE) {
/* don't know what this is */
CHAPDEBUG(("ChapReceiveFailure: in state %d\n", cstate->clientstate));
return;
}
UNTIMEOUT(ChapResponseTimeout, cstate);
/*
* Print message.
*/
if (len > 0)
PRINTMSG(inp, len);
error("CHAP authentication failed");
auth_withpeer_fail(cstate->unit, PPP_CHAP);
}
/*
* ChapSendChallenge - Send an Authenticate challenge.
*/
static void
ChapSendChallenge(
chap_state *cstate)
{
u_char *outp;
int chal_len, name_len;
int outlen;
chal_len = cstate->chal_len;
name_len = strlen(cstate->chal_name);
outlen = CHAP_HEADERLEN + sizeof (u_char) + chal_len + name_len;
outp = outpacket_buf;
MAKEHEADER(outp, PPP_CHAP); /* paste in a CHAP header */
PUTCHAR(CHAP_CHALLENGE, outp);
PUTCHAR(cstate->chal_id, outp);
PUTSHORT(outlen, outp);
PUTCHAR(chal_len, outp); /* put length of challenge */
BCOPY(cstate->challenge, outp, chal_len);
INCPTR(chal_len, outp);
BCOPY(cstate->chal_name, outp, name_len); /* append hostname */
output(cstate->unit, outpacket_buf, outlen + PPP_HDRLEN);
TIMEOUT(ChapChallengeTimeout, cstate, cstate->timeouttime);
++cstate->chal_transmits;
}
/*
* ChapSendStatus - Send a status response (ack or nak).
*/
static void
ChapSendStatus(
chap_state *cstate,
int code)
{
u_char *outp;
int outlen, msglen;
char msg[256];
if (code == CHAP_SUCCESS)
slprintf(msg, sizeof(msg), "Welcome to %s.", hostname);
else
slprintf(msg, sizeof(msg), "I don't like you. Go 'way.");
msglen = strlen(msg);
outlen = CHAP_HEADERLEN + msglen;
outp = outpacket_buf;
MAKEHEADER(outp, PPP_CHAP); /* paste in a header */
PUTCHAR(code, outp);
PUTCHAR(cstate->chal_id, outp);
PUTSHORT(outlen, outp);
BCOPY(msg, outp, msglen);
output(cstate->unit, outpacket_buf, outlen + PPP_HDRLEN);
}
/*
* ChapGenChallenge is used to generate a pseudo-random challenge string of
* a pseudo-random length between min_len and max_len. The challenge
* string and its length are stored in *cstate, and various other fields of
* *cstate are initialized.
*/
static void
ChapGenChallenge(
chap_state *cstate)
{
int chal_len;
u_char *ptr = cstate->challenge;
int i;
/* pick a random challenge length between MIN_CHALLENGE_LENGTH and
MAX_CHALLENGE_LENGTH */
chal_len = (unsigned) ((drand48() *
(MAX_CHALLENGE_LENGTH - MIN_CHALLENGE_LENGTH)) +
MIN_CHALLENGE_LENGTH);
cstate->chal_len = chal_len;
cstate->chal_id = ++cstate->id;
cstate->chal_transmits = 0;
/* generate a random string */
for (i = 0; i < chal_len; i++)
*ptr++ = (char) (drand48() * 0xff);
}
/*
* ChapSendResponse - send a response packet with values as specified
* in *cstate.
*/
/* ARGSUSED */
static void
ChapSendResponse(
chap_state *cstate)
{
u_char *outp;
int outlen, md_len, name_len;
md_len = cstate->resp_length;
name_len = strlen(cstate->resp_name);
outlen = CHAP_HEADERLEN + sizeof (u_char) + md_len + name_len;
outp = outpacket_buf;
MAKEHEADER(outp, PPP_CHAP);
PUTCHAR(CHAP_RESPONSE, outp); /* we are a response */
PUTCHAR(cstate->resp_id, outp); /* copy id from challenge packet */
PUTSHORT(outlen, outp); /* packet length */
PUTCHAR(md_len, outp); /* length of MD */
BCOPY(cstate->response, outp, md_len); /* copy MD to buffer */
INCPTR(md_len, outp);
BCOPY(cstate->resp_name, outp, name_len); /* append our name */
/* send the packet */
output(cstate->unit, outpacket_buf, outlen + PPP_HDRLEN);
cstate->clientstate = CHAPCS_RESPONSE;
TIMEOUT(ChapResponseTimeout, cstate, cstate->timeouttime);
++cstate->resp_transmits;
}
/*
* ChapPrintPkt - print the contents of a CHAP packet.
*/
static char *ChapCodenames[] = {
"Challenge", "Response", "Success", "Failure"
};
static int
ChapPrintPkt(
u_char *p,
int plen,
void (*printer)(void *, char *, ...),
void *arg)
{
int code, id, len;
int clen, nlen;
u_char x;
if (plen < CHAP_HEADERLEN)
return 0;
GETCHAR(code, p);
GETCHAR(id, p);
GETSHORT(len, p);
if (len < CHAP_HEADERLEN || len > plen)
return 0;
if (code >= 1 && code <= sizeof(ChapCodenames) / sizeof(char *))
printer(arg, " %s", ChapCodenames[code-1]);
else
printer(arg, " code=0x%x", code);
printer(arg, " id=0x%x", id);
len -= CHAP_HEADERLEN;
switch (code) {
case CHAP_CHALLENGE:
case CHAP_RESPONSE:
if (len < 1)
break;
clen = p[0];
if (len < clen + 1)
break;
++p;
nlen = len - clen - 1;
printer(arg, " <");
for (; clen > 0; --clen) {
GETCHAR(x, p);
printer(arg, "%.2x", x);
}
printer(arg, ">, name = ");
print_string((char *)p, nlen, printer, arg);
break;
case CHAP_FAILURE:
case CHAP_SUCCESS:
printer(arg, " ");
print_string((char *)p, len, printer, arg);
break;
default:
for (clen = len; clen > 0; --clen) {
GETCHAR(x, p);
printer(arg, " %.2x", x);
}
}
return len + CHAP_HEADERLEN;
}
| lizhuobin1981/rtems_test | cpukit/pppd/chap.c | C | gpl-2.0 | 21,275 |
/* Area: ffi_closure, unwind info
Purpose: Check if the unwind information is passed correctly.
Limitations: none.
PR: none.
Originator: Jeff Sturm <jsturm@one-point.com> */
/* { dg-do run } */
#include "ffitestcxx.h"
#if defined HAVE_STDINT_H
#include <stdint.h>
#endif
#if defined HAVE_INTTYPES_H
#include <inttypes.h>
#endif
void
closure_test_fn(ffi_cif* cif __UNUSED__, void* resp __UNUSED__,
void** args __UNUSED__, void* userdata __UNUSED__)
{
throw 9;
}
typedef void (*closure_test_type)();
void closure_test_fn1(ffi_cif* cif __UNUSED__, void* resp,
void** args, void* userdata __UNUSED__)
{
*(ffi_arg*)resp =
(int)*(float *)args[0] +(int)(*(float *)args[1]) +
(int)(*(float *)args[2]) + (int)*(float *)args[3] +
(int)(*(signed short *)args[4]) + (int)(*(float *)args[5]) +
(int)*(float *)args[6] + (int)(*(int *)args[7]) +
(int)(*(double*)args[8]) + (int)*(int *)args[9] +
(int)(*(int *)args[10]) + (int)(*(float *)args[11]) +
(int)*(int *)args[12] + (int)(*(int *)args[13]) +
(int)(*(int *)args[14]) + *(int *)args[15] + (int)(intptr_t)userdata;
printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n",
(int)*(float *)args[0], (int)(*(float *)args[1]),
(int)(*(float *)args[2]), (int)*(float *)args[3],
(int)(*(signed short *)args[4]), (int)(*(float *)args[5]),
(int)*(float *)args[6], (int)(*(int *)args[7]),
(int)(*(double *)args[8]), (int)*(int *)args[9],
(int)(*(int *)args[10]), (int)(*(float *)args[11]),
(int)*(int *)args[12], (int)(*(int *)args[13]),
(int)(*(int *)args[14]), *(int *)args[15],
(int)(intptr_t)userdata, (int)*(ffi_arg*)resp);
throw (int)*(ffi_arg*)resp;
}
typedef int (*closure_test_type1)(float, float, float, float, signed short,
float, float, int, double, int, int, float,
int, int, int, int);
int main (void)
{
ffi_cif cif;
void *code;
ffi_closure *pcl = (ffi_closure *)ffi_closure_alloc(sizeof(ffi_closure), &code);
ffi_type * cl_arg_types[17];
{
cl_arg_types[1] = NULL;
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0,
&ffi_type_void, cl_arg_types) == FFI_OK);
CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn, NULL, code) == FFI_OK);
try
{
(*((closure_test_type)(code)))();
} catch (int exception_code)
{
CHECK(exception_code == 9);
}
printf("part one OK\n");
/* { dg-output "part one OK" } */
}
{
cl_arg_types[0] = &ffi_type_float;
cl_arg_types[1] = &ffi_type_float;
cl_arg_types[2] = &ffi_type_float;
cl_arg_types[3] = &ffi_type_float;
cl_arg_types[4] = &ffi_type_sshort;
cl_arg_types[5] = &ffi_type_float;
cl_arg_types[6] = &ffi_type_float;
cl_arg_types[7] = &ffi_type_uint;
cl_arg_types[8] = &ffi_type_double;
cl_arg_types[9] = &ffi_type_uint;
cl_arg_types[10] = &ffi_type_uint;
cl_arg_types[11] = &ffi_type_float;
cl_arg_types[12] = &ffi_type_uint;
cl_arg_types[13] = &ffi_type_uint;
cl_arg_types[14] = &ffi_type_uint;
cl_arg_types[15] = &ffi_type_uint;
cl_arg_types[16] = NULL;
/* Initialize the cif */
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16,
&ffi_type_sint, cl_arg_types) == FFI_OK);
CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn1,
(void *) 3 /* userdata */, code) == FFI_OK);
try
{
(*((closure_test_type1)code))
(1.1, 2.2, 3.3, 4.4, 127, 5.5, 6.6, 8, 9, 10, 11, 12.0, 13,
19, 21, 1);
/* { dg-output "\n1 2 3 4 127 5 6 8 9 10 11 12 13 19 21 1 3: 255" } */
} catch (int exception_code)
{
CHECK(exception_code == 255);
}
printf("part two OK\n");
/* { dg-output "\npart two OK" } */
}
exit(0);
}
| teeple/pns_server | work/install/Python-2.7.4/Modules/_ctypes/libffi/testsuite/libffi.special/unwindtest.cc | C++ | gpl-2.0 | 3,804 |
/*
* INET An implementation of the TCP/IP protocol suite for the LINUX
* operating system. INET is implemented using the BSD Socket
* interface as the means of communication with the user level.
*
* ROUTE - implementation of the IP router.
*
* Authors: Ross Biro
* Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
* Alan Cox, <gw4pts@gw4pts.ampr.org>
* Linus Torvalds, <Linus.Torvalds@helsinki.fi>
* Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
*
* Fixes:
* Alan Cox : Verify area fixes.
* Alan Cox : cli() protects routing changes
* Rui Oliveira : ICMP routing table updates
* (rco@di.uminho.pt) Routing table insertion and update
* Linus Torvalds : Rewrote bits to be sensible
* Alan Cox : Added BSD route gw semantics
* Alan Cox : Super /proc >4K
* Alan Cox : MTU in route table
* Alan Cox : MSS actually. Also added the window
* clamper.
* Sam Lantinga : Fixed route matching in rt_del()
* Alan Cox : Routing cache support.
* Alan Cox : Removed compatibility cruft.
* Alan Cox : RTF_REJECT support.
* Alan Cox : TCP irtt support.
* Jonathan Naylor : Added Metric support.
* Miquel van Smoorenburg : BSD API fixes.
* Miquel van Smoorenburg : Metrics.
* Alan Cox : Use __u32 properly
* Alan Cox : Aligned routing errors more closely with BSD
* our system is still very different.
* Alan Cox : Faster /proc handling
* Alexey Kuznetsov : Massive rework to support tree based routing,
* routing caches and better behaviour.
*
* Olaf Erb : irtt wasn't being copied right.
* Bjorn Ekwall : Kerneld route support.
* Alan Cox : Multicast fixed (I hope)
* Pavel Krauz : Limited broadcast fixed
* Mike McLagan : Routing by source
* Alexey Kuznetsov : End of old history. Split to fib.c and
* route.c and rewritten from scratch.
* Andi Kleen : Load-limit warning messages.
* Vitaly E. Lavrov : Transparent proxy revived after year coma.
* Vitaly E. Lavrov : Race condition in ip_route_input_slow.
* Tobias Ringstrom : Uninitialized res.type in ip_route_output_slow.
* Vladimir V. Ivanov : IP rule info (flowid) is really useful.
* Marc Boucher : routing by fwmark
* Robert Olsson : Added rt_cache statistics
* Arnaldo C. Melo : Convert proc stuff to seq_file
* Eric Dumazet : hashed spinlocks and rt_check_expire() fixes.
* Ilia Sotnikov : Ignore TOS on PMTUD and Redirect
* Ilia Sotnikov : Removed TOS from hash calculations
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#define pr_fmt(fmt) "IPv4: " fmt
#include <linux/module.h>
#include <asm/uaccess.h>
#include <linux/bitops.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/string.h>
#include <linux/socket.h>
#include <linux/sockios.h>
#include <linux/errno.h>
#include <linux/in.h>
#include <linux/inet.h>
#include <linux/netdevice.h>
#include <linux/proc_fs.h>
#include <linux/init.h>
#include <linux/skbuff.h>
#include <linux/inetdevice.h>
#include <linux/igmp.h>
#include <linux/pkt_sched.h>
#include <linux/mroute.h>
#include <linux/netfilter_ipv4.h>
#include <linux/random.h>
#include <linux/rcupdate.h>
#include <linux/times.h>
#include <linux/slab.h>
#include <linux/jhash.h>
#include <net/dst.h>
#include <net/net_namespace.h>
#include <net/protocol.h>
#include <net/ip.h>
#include <net/route.h>
#include <net/inetpeer.h>
#include <net/sock.h>
#include <net/ip_fib.h>
#include <net/arp.h>
#include <net/tcp.h>
#include <net/icmp.h>
#include <net/xfrm.h>
#include <net/netevent.h>
#include <net/rtnetlink.h>
#ifdef CONFIG_SYSCTL
#include <linux/sysctl.h>
#include <linux/kmemleak.h>
#endif
#include <net/secure_seq.h>
#define RT_FL_TOS(oldflp4) \
((oldflp4)->flowi4_tos & (IPTOS_RT_MASK | RTO_ONLINK))
#define RT_GC_TIMEOUT (300*HZ)
static int ip_rt_max_size;
static int ip_rt_redirect_number __read_mostly = 9;
static int ip_rt_redirect_load __read_mostly = HZ / 50;
static int ip_rt_redirect_silence __read_mostly = ((HZ / 50) << (9 + 1));
static int ip_rt_error_cost __read_mostly = HZ;
static int ip_rt_error_burst __read_mostly = 5 * HZ;
static int ip_rt_mtu_expires __read_mostly = 10 * 60 * HZ;
static int ip_rt_min_pmtu __read_mostly = 512 + 20 + 20;
static int ip_rt_min_advmss __read_mostly = 256;
/*
* Interface to generic destination cache.
*/
static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie);
static unsigned int ipv4_default_advmss(const struct dst_entry *dst);
static unsigned int ipv4_mtu(const struct dst_entry *dst);
static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst);
static void ipv4_link_failure(struct sk_buff *skb);
static void ip_rt_update_pmtu(struct dst_entry *dst, struct sock *sk,
struct sk_buff *skb, u32 mtu);
static void ip_do_redirect(struct dst_entry *dst, struct sock *sk,
struct sk_buff *skb);
static void ipv4_dst_destroy(struct dst_entry *dst);
static u32 *ipv4_cow_metrics(struct dst_entry *dst, unsigned long old)
{
WARN_ON(1);
return NULL;
}
static struct neighbour *ipv4_neigh_lookup(const struct dst_entry *dst,
struct sk_buff *skb,
const void *daddr);
static struct dst_ops ipv4_dst_ops = {
.family = AF_INET,
.protocol = cpu_to_be16(ETH_P_IP),
.check = ipv4_dst_check,
.default_advmss = ipv4_default_advmss,
.mtu = ipv4_mtu,
.cow_metrics = ipv4_cow_metrics,
.destroy = ipv4_dst_destroy,
.negative_advice = ipv4_negative_advice,
.link_failure = ipv4_link_failure,
.update_pmtu = ip_rt_update_pmtu,
.redirect = ip_do_redirect,
.local_out = __ip_local_out,
.neigh_lookup = ipv4_neigh_lookup,
};
#define ECN_OR_COST(class) TC_PRIO_##class
const __u8 ip_tos2prio[16] = {
TC_PRIO_BESTEFFORT,
ECN_OR_COST(BESTEFFORT),
TC_PRIO_BESTEFFORT,
ECN_OR_COST(BESTEFFORT),
TC_PRIO_BULK,
ECN_OR_COST(BULK),
TC_PRIO_BULK,
ECN_OR_COST(BULK),
TC_PRIO_INTERACTIVE,
ECN_OR_COST(INTERACTIVE),
TC_PRIO_INTERACTIVE,
ECN_OR_COST(INTERACTIVE),
TC_PRIO_INTERACTIVE_BULK,
ECN_OR_COST(INTERACTIVE_BULK),
TC_PRIO_INTERACTIVE_BULK,
ECN_OR_COST(INTERACTIVE_BULK)
};
EXPORT_SYMBOL(ip_tos2prio);
static DEFINE_PER_CPU(struct rt_cache_stat, rt_cache_stat);
#define RT_CACHE_STAT_INC(field) raw_cpu_inc(rt_cache_stat.field)
#ifdef CONFIG_PROC_FS
static void *rt_cache_seq_start(struct seq_file *seq, loff_t *pos)
{
if (*pos)
return NULL;
return SEQ_START_TOKEN;
}
static void *rt_cache_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{
++*pos;
return NULL;
}
static void rt_cache_seq_stop(struct seq_file *seq, void *v)
{
}
static int rt_cache_seq_show(struct seq_file *seq, void *v)
{
if (v == SEQ_START_TOKEN)
seq_printf(seq, "%-127s\n",
"Iface\tDestination\tGateway \tFlags\t\tRefCnt\tUse\t"
"Metric\tSource\t\tMTU\tWindow\tIRTT\tTOS\tHHRef\t"
"HHUptod\tSpecDst");
return 0;
}
static const struct seq_operations rt_cache_seq_ops = {
.start = rt_cache_seq_start,
.next = rt_cache_seq_next,
.stop = rt_cache_seq_stop,
.show = rt_cache_seq_show,
};
static int rt_cache_seq_open(struct inode *inode, struct file *file)
{
return seq_open(file, &rt_cache_seq_ops);
}
static const struct file_operations rt_cache_seq_fops = {
.owner = THIS_MODULE,
.open = rt_cache_seq_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
static void *rt_cpu_seq_start(struct seq_file *seq, loff_t *pos)
{
int cpu;
if (*pos == 0)
return SEQ_START_TOKEN;
for (cpu = *pos-1; cpu < nr_cpu_ids; ++cpu) {
if (!cpu_possible(cpu))
continue;
*pos = cpu+1;
return &per_cpu(rt_cache_stat, cpu);
}
return NULL;
}
static void *rt_cpu_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{
int cpu;
for (cpu = *pos; cpu < nr_cpu_ids; ++cpu) {
if (!cpu_possible(cpu))
continue;
*pos = cpu+1;
return &per_cpu(rt_cache_stat, cpu);
}
return NULL;
}
static void rt_cpu_seq_stop(struct seq_file *seq, void *v)
{
}
static int rt_cpu_seq_show(struct seq_file *seq, void *v)
{
struct rt_cache_stat *st = v;
if (v == SEQ_START_TOKEN) {
seq_printf(seq, "entries in_hit in_slow_tot in_slow_mc in_no_route in_brd in_martian_dst in_martian_src out_hit out_slow_tot out_slow_mc gc_total gc_ignored gc_goal_miss gc_dst_overflow in_hlist_search out_hlist_search\n");
return 0;
}
seq_printf(seq,"%08x %08x %08x %08x %08x %08x %08x %08x "
" %08x %08x %08x %08x %08x %08x %08x %08x %08x \n",
dst_entries_get_slow(&ipv4_dst_ops),
0, /* st->in_hit */
st->in_slow_tot,
st->in_slow_mc,
st->in_no_route,
st->in_brd,
st->in_martian_dst,
st->in_martian_src,
0, /* st->out_hit */
st->out_slow_tot,
st->out_slow_mc,
0, /* st->gc_total */
0, /* st->gc_ignored */
0, /* st->gc_goal_miss */
0, /* st->gc_dst_overflow */
0, /* st->in_hlist_search */
0 /* st->out_hlist_search */
);
return 0;
}
static const struct seq_operations rt_cpu_seq_ops = {
.start = rt_cpu_seq_start,
.next = rt_cpu_seq_next,
.stop = rt_cpu_seq_stop,
.show = rt_cpu_seq_show,
};
static int rt_cpu_seq_open(struct inode *inode, struct file *file)
{
return seq_open(file, &rt_cpu_seq_ops);
}
static const struct file_operations rt_cpu_seq_fops = {
.owner = THIS_MODULE,
.open = rt_cpu_seq_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
#ifdef CONFIG_IP_ROUTE_CLASSID
static int rt_acct_proc_show(struct seq_file *m, void *v)
{
struct ip_rt_acct *dst, *src;
unsigned int i, j;
dst = kcalloc(256, sizeof(struct ip_rt_acct), GFP_KERNEL);
if (!dst)
return -ENOMEM;
for_each_possible_cpu(i) {
src = (struct ip_rt_acct *)per_cpu_ptr(ip_rt_acct, i);
for (j = 0; j < 256; j++) {
dst[j].o_bytes += src[j].o_bytes;
dst[j].o_packets += src[j].o_packets;
dst[j].i_bytes += src[j].i_bytes;
dst[j].i_packets += src[j].i_packets;
}
}
seq_write(m, dst, 256 * sizeof(struct ip_rt_acct));
kfree(dst);
return 0;
}
static int rt_acct_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, rt_acct_proc_show, NULL);
}
static const struct file_operations rt_acct_proc_fops = {
.owner = THIS_MODULE,
.open = rt_acct_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
#endif
static int __net_init ip_rt_do_proc_init(struct net *net)
{
struct proc_dir_entry *pde;
pde = proc_create("rt_cache", S_IRUGO, net->proc_net,
&rt_cache_seq_fops);
if (!pde)
goto err1;
pde = proc_create("rt_cache", S_IRUGO,
net->proc_net_stat, &rt_cpu_seq_fops);
if (!pde)
goto err2;
#ifdef CONFIG_IP_ROUTE_CLASSID
pde = proc_create("rt_acct", 0, net->proc_net, &rt_acct_proc_fops);
if (!pde)
goto err3;
#endif
return 0;
#ifdef CONFIG_IP_ROUTE_CLASSID
err3:
remove_proc_entry("rt_cache", net->proc_net_stat);
#endif
err2:
remove_proc_entry("rt_cache", net->proc_net);
err1:
return -ENOMEM;
}
static void __net_exit ip_rt_do_proc_exit(struct net *net)
{
remove_proc_entry("rt_cache", net->proc_net_stat);
remove_proc_entry("rt_cache", net->proc_net);
#ifdef CONFIG_IP_ROUTE_CLASSID
remove_proc_entry("rt_acct", net->proc_net);
#endif
}
static struct pernet_operations ip_rt_proc_ops __net_initdata = {
.init = ip_rt_do_proc_init,
.exit = ip_rt_do_proc_exit,
};
static int __init ip_rt_proc_init(void)
{
return register_pernet_subsys(&ip_rt_proc_ops);
}
#else
static inline int ip_rt_proc_init(void)
{
return 0;
}
#endif /* CONFIG_PROC_FS */
static inline bool rt_is_expired(const struct rtable *rth)
{
return rth->rt_genid != rt_genid_ipv4(dev_net(rth->dst.dev));
}
void rt_cache_flush(struct net *net)
{
rt_genid_bump_ipv4(net);
}
static struct neighbour *ipv4_neigh_lookup(const struct dst_entry *dst,
struct sk_buff *skb,
const void *daddr)
{
struct net_device *dev = dst->dev;
const __be32 *pkey = daddr;
const struct rtable *rt;
struct neighbour *n;
rt = (const struct rtable *) dst;
if (rt->rt_gateway)
pkey = (const __be32 *) &rt->rt_gateway;
else if (skb)
pkey = &ip_hdr(skb)->daddr;
n = __ipv4_neigh_lookup(dev, *(__force u32 *)pkey);
if (n)
return n;
return neigh_create(&arp_tbl, pkey, dev);
}
#define IP_IDENTS_SZ 2048u
struct ip_ident_bucket {
atomic_t id;
u32 stamp32;
};
static struct ip_ident_bucket *ip_idents __read_mostly;
/* In order to protect privacy, we add a perturbation to identifiers
* if one generator is seldom used. This makes hard for an attacker
* to infer how many packets were sent between two points in time.
*/
u32 ip_idents_reserve(u32 hash, int segs)
{
struct ip_ident_bucket *bucket = ip_idents + hash % IP_IDENTS_SZ;
u32 old = ACCESS_ONCE(bucket->stamp32);
u32 now = (u32)jiffies;
u32 delta = 0;
if (old != now && cmpxchg(&bucket->stamp32, old, now) == old)
delta = prandom_u32_max(now - old);
return atomic_add_return(segs + delta, &bucket->id) - segs;
}
EXPORT_SYMBOL(ip_idents_reserve);
void __ip_select_ident(struct iphdr *iph, int segs)
{
static u32 ip_idents_hashrnd __read_mostly;
u32 hash, id;
net_get_random_once(&ip_idents_hashrnd, sizeof(ip_idents_hashrnd));
hash = jhash_3words((__force u32)iph->daddr,
(__force u32)iph->saddr,
iph->protocol,
ip_idents_hashrnd);
id = ip_idents_reserve(hash, segs);
iph->id = htons(id);
}
EXPORT_SYMBOL(__ip_select_ident);
static void __build_flow_key(struct flowi4 *fl4, const struct sock *sk,
const struct iphdr *iph,
int oif, u8 tos,
u8 prot, u32 mark, int flow_flags)
{
if (sk) {
const struct inet_sock *inet = inet_sk(sk);
oif = sk->sk_bound_dev_if;
mark = sk->sk_mark;
tos = RT_CONN_FLAGS(sk);
prot = inet->hdrincl ? IPPROTO_RAW : sk->sk_protocol;
}
flowi4_init_output(fl4, oif, mark, tos,
RT_SCOPE_UNIVERSE, prot,
flow_flags,
iph->daddr, iph->saddr, 0, 0);
}
static void build_skb_flow_key(struct flowi4 *fl4, const struct sk_buff *skb,
const struct sock *sk)
{
const struct iphdr *iph = ip_hdr(skb);
int oif = skb->dev->ifindex;
u8 tos = RT_TOS(iph->tos);
u8 prot = iph->protocol;
u32 mark = skb->mark;
__build_flow_key(fl4, sk, iph, oif, tos, prot, mark, 0);
}
static void build_sk_flow_key(struct flowi4 *fl4, const struct sock *sk)
{
const struct inet_sock *inet = inet_sk(sk);
const struct ip_options_rcu *inet_opt;
__be32 daddr = inet->inet_daddr;
rcu_read_lock();
inet_opt = rcu_dereference(inet->inet_opt);
if (inet_opt && inet_opt->opt.srr)
daddr = inet_opt->opt.faddr;
flowi4_init_output(fl4, sk->sk_bound_dev_if, sk->sk_mark,
RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE,
inet->hdrincl ? IPPROTO_RAW : sk->sk_protocol,
inet_sk_flowi_flags(sk),
daddr, inet->inet_saddr, 0, 0);
rcu_read_unlock();
}
static void ip_rt_build_flow_key(struct flowi4 *fl4, const struct sock *sk,
const struct sk_buff *skb)
{
if (skb)
build_skb_flow_key(fl4, skb, sk);
else
build_sk_flow_key(fl4, sk);
}
static inline void rt_free(struct rtable *rt)
{
call_rcu(&rt->dst.rcu_head, dst_rcu_free);
}
static DEFINE_SPINLOCK(fnhe_lock);
static void fnhe_flush_routes(struct fib_nh_exception *fnhe)
{
struct rtable *rt;
rt = rcu_dereference(fnhe->fnhe_rth_input);
if (rt) {
RCU_INIT_POINTER(fnhe->fnhe_rth_input, NULL);
rt_free(rt);
}
rt = rcu_dereference(fnhe->fnhe_rth_output);
if (rt) {
RCU_INIT_POINTER(fnhe->fnhe_rth_output, NULL);
rt_free(rt);
}
}
static struct fib_nh_exception *fnhe_oldest(struct fnhe_hash_bucket *hash)
{
struct fib_nh_exception *fnhe, *oldest;
oldest = rcu_dereference(hash->chain);
for (fnhe = rcu_dereference(oldest->fnhe_next); fnhe;
fnhe = rcu_dereference(fnhe->fnhe_next)) {
if (time_before(fnhe->fnhe_stamp, oldest->fnhe_stamp))
oldest = fnhe;
}
fnhe_flush_routes(oldest);
return oldest;
}
static inline u32 fnhe_hashfun(__be32 daddr)
{
static u32 fnhe_hashrnd __read_mostly;
u32 hval;
net_get_random_once(&fnhe_hashrnd, sizeof(fnhe_hashrnd));
hval = jhash_1word((__force u32) daddr, fnhe_hashrnd);
return hash_32(hval, FNHE_HASH_SHIFT);
}
static void fill_route_from_fnhe(struct rtable *rt, struct fib_nh_exception *fnhe)
{
rt->rt_pmtu = fnhe->fnhe_pmtu;
rt->dst.expires = fnhe->fnhe_expires;
if (fnhe->fnhe_gw) {
rt->rt_flags |= RTCF_REDIRECTED;
rt->rt_gateway = fnhe->fnhe_gw;
rt->rt_uses_gateway = 1;
}
}
static void update_or_create_fnhe(struct fib_nh *nh, __be32 daddr, __be32 gw,
u32 pmtu, unsigned long expires)
{
struct fnhe_hash_bucket *hash;
struct fib_nh_exception *fnhe;
struct rtable *rt;
unsigned int i;
int depth;
u32 hval = fnhe_hashfun(daddr);
spin_lock_bh(&fnhe_lock);
hash = rcu_dereference(nh->nh_exceptions);
if (!hash) {
hash = kzalloc(FNHE_HASH_SIZE * sizeof(*hash), GFP_ATOMIC);
if (!hash)
goto out_unlock;
rcu_assign_pointer(nh->nh_exceptions, hash);
}
hash += hval;
depth = 0;
for (fnhe = rcu_dereference(hash->chain); fnhe;
fnhe = rcu_dereference(fnhe->fnhe_next)) {
if (fnhe->fnhe_daddr == daddr)
break;
depth++;
}
if (fnhe) {
if (gw)
fnhe->fnhe_gw = gw;
if (pmtu) {
fnhe->fnhe_pmtu = pmtu;
fnhe->fnhe_expires = max(1UL, expires);
}
/* Update all cached dsts too */
rt = rcu_dereference(fnhe->fnhe_rth_input);
if (rt)
fill_route_from_fnhe(rt, fnhe);
rt = rcu_dereference(fnhe->fnhe_rth_output);
if (rt)
fill_route_from_fnhe(rt, fnhe);
} else {
if (depth > FNHE_RECLAIM_DEPTH)
fnhe = fnhe_oldest(hash);
else {
fnhe = kzalloc(sizeof(*fnhe), GFP_ATOMIC);
if (!fnhe)
goto out_unlock;
fnhe->fnhe_next = hash->chain;
rcu_assign_pointer(hash->chain, fnhe);
}
fnhe->fnhe_genid = fnhe_genid(dev_net(nh->nh_dev));
fnhe->fnhe_daddr = daddr;
fnhe->fnhe_gw = gw;
fnhe->fnhe_pmtu = pmtu;
fnhe->fnhe_expires = expires;
/* Exception created; mark the cached routes for the nexthop
* stale, so anyone caching it rechecks if this exception
* applies to them.
*/
rt = rcu_dereference(nh->nh_rth_input);
if (rt)
rt->dst.obsolete = DST_OBSOLETE_KILL;
for_each_possible_cpu(i) {
struct rtable __rcu **prt;
prt = per_cpu_ptr(nh->nh_pcpu_rth_output, i);
rt = rcu_dereference(*prt);
if (rt)
rt->dst.obsolete = DST_OBSOLETE_KILL;
}
}
fnhe->fnhe_stamp = jiffies;
out_unlock:
spin_unlock_bh(&fnhe_lock);
}
static void __ip_do_redirect(struct rtable *rt, struct sk_buff *skb, struct flowi4 *fl4,
bool kill_route)
{
__be32 new_gw = icmp_hdr(skb)->un.gateway;
__be32 old_gw = ip_hdr(skb)->saddr;
struct net_device *dev = skb->dev;
struct in_device *in_dev;
struct fib_result res;
struct neighbour *n;
struct net *net;
switch (icmp_hdr(skb)->code & 7) {
case ICMP_REDIR_NET:
case ICMP_REDIR_NETTOS:
case ICMP_REDIR_HOST:
case ICMP_REDIR_HOSTTOS:
break;
default:
return;
}
if (rt->rt_gateway != old_gw)
return;
in_dev = __in_dev_get_rcu(dev);
if (!in_dev)
return;
net = dev_net(dev);
if (new_gw == old_gw || !IN_DEV_RX_REDIRECTS(in_dev) ||
ipv4_is_multicast(new_gw) || ipv4_is_lbcast(new_gw) ||
ipv4_is_zeronet(new_gw))
goto reject_redirect;
if (!IN_DEV_SHARED_MEDIA(in_dev)) {
if (!inet_addr_onlink(in_dev, new_gw, old_gw))
goto reject_redirect;
if (IN_DEV_SEC_REDIRECTS(in_dev) && ip_fib_check_default(new_gw, dev))
goto reject_redirect;
} else {
if (inet_addr_type(net, new_gw) != RTN_UNICAST)
goto reject_redirect;
}
n = ipv4_neigh_lookup(&rt->dst, NULL, &new_gw);
if (!IS_ERR(n)) {
if (!(n->nud_state & NUD_VALID)) {
neigh_event_send(n, NULL);
} else {
if (fib_lookup(net, fl4, &res) == 0) {
struct fib_nh *nh = &FIB_RES_NH(res);
update_or_create_fnhe(nh, fl4->daddr, new_gw,
0, 0);
}
if (kill_route)
rt->dst.obsolete = DST_OBSOLETE_KILL;
call_netevent_notifiers(NETEVENT_NEIGH_UPDATE, n);
}
neigh_release(n);
}
return;
reject_redirect:
#ifdef CONFIG_IP_ROUTE_VERBOSE
if (IN_DEV_LOG_MARTIANS(in_dev)) {
const struct iphdr *iph = (const struct iphdr *) skb->data;
__be32 daddr = iph->daddr;
__be32 saddr = iph->saddr;
net_info_ratelimited("Redirect from %pI4 on %s about %pI4 ignored\n"
" Advised path = %pI4 -> %pI4\n",
&old_gw, dev->name, &new_gw,
&saddr, &daddr);
}
#endif
;
}
static void ip_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_buff *skb)
{
struct rtable *rt;
struct flowi4 fl4;
const struct iphdr *iph = (const struct iphdr *) skb->data;
int oif = skb->dev->ifindex;
u8 tos = RT_TOS(iph->tos);
u8 prot = iph->protocol;
u32 mark = skb->mark;
rt = (struct rtable *) dst;
__build_flow_key(&fl4, sk, iph, oif, tos, prot, mark, 0);
__ip_do_redirect(rt, skb, &fl4, true);
}
static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst)
{
struct rtable *rt = (struct rtable *)dst;
struct dst_entry *ret = dst;
if (rt) {
if (dst->obsolete > 0) {
ip_rt_put(rt);
ret = NULL;
} else if ((rt->rt_flags & RTCF_REDIRECTED) ||
rt->dst.expires) {
ip_rt_put(rt);
ret = NULL;
}
}
return ret;
}
/*
* Algorithm:
* 1. The first ip_rt_redirect_number redirects are sent
* with exponential backoff, then we stop sending them at all,
* assuming that the host ignores our redirects.
* 2. If we did not see packets requiring redirects
* during ip_rt_redirect_silence, we assume that the host
* forgot redirected route and start to send redirects again.
*
* This algorithm is much cheaper and more intelligent than dumb load limiting
* in icmp.c.
*
* NOTE. Do not forget to inhibit load limiting for redirects (redundant)
* and "frag. need" (breaks PMTU discovery) in icmp.c.
*/
void ip_rt_send_redirect(struct sk_buff *skb)
{
struct rtable *rt = skb_rtable(skb);
struct in_device *in_dev;
struct inet_peer *peer;
struct net *net;
int log_martians;
rcu_read_lock();
in_dev = __in_dev_get_rcu(rt->dst.dev);
if (!in_dev || !IN_DEV_TX_REDIRECTS(in_dev)) {
rcu_read_unlock();
return;
}
log_martians = IN_DEV_LOG_MARTIANS(in_dev);
rcu_read_unlock();
net = dev_net(rt->dst.dev);
peer = inet_getpeer_v4(net->ipv4.peers, ip_hdr(skb)->saddr, 1);
if (!peer) {
icmp_send(skb, ICMP_REDIRECT, ICMP_REDIR_HOST,
rt_nexthop(rt, ip_hdr(skb)->daddr));
return;
}
/* No redirected packets during ip_rt_redirect_silence;
* reset the algorithm.
*/
if (time_after(jiffies, peer->rate_last + ip_rt_redirect_silence))
peer->rate_tokens = 0;
/* Too many ignored redirects; do not send anything
* set dst.rate_last to the last seen redirected packet.
*/
if (peer->rate_tokens >= ip_rt_redirect_number) {
peer->rate_last = jiffies;
goto out_put_peer;
}
/* Check for load limit; set rate_last to the latest sent
* redirect.
*/
if (peer->rate_tokens == 0 ||
time_after(jiffies,
(peer->rate_last +
(ip_rt_redirect_load << peer->rate_tokens)))) {
__be32 gw = rt_nexthop(rt, ip_hdr(skb)->daddr);
icmp_send(skb, ICMP_REDIRECT, ICMP_REDIR_HOST, gw);
peer->rate_last = jiffies;
++peer->rate_tokens;
#ifdef CONFIG_IP_ROUTE_VERBOSE
if (log_martians &&
peer->rate_tokens == ip_rt_redirect_number)
net_warn_ratelimited("host %pI4/if%d ignores redirects for %pI4 to %pI4\n",
&ip_hdr(skb)->saddr, inet_iif(skb),
&ip_hdr(skb)->daddr, &gw);
#endif
}
out_put_peer:
inet_putpeer(peer);
}
static int ip_error(struct sk_buff *skb)
{
struct in_device *in_dev = __in_dev_get_rcu(skb->dev);
struct rtable *rt = skb_rtable(skb);
struct inet_peer *peer;
unsigned long now;
struct net *net;
bool send;
int code;
net = dev_net(rt->dst.dev);
if (!IN_DEV_FORWARD(in_dev)) {
switch (rt->dst.error) {
case EHOSTUNREACH:
IP_INC_STATS_BH(net, IPSTATS_MIB_INADDRERRORS);
break;
case ENETUNREACH:
IP_INC_STATS_BH(net, IPSTATS_MIB_INNOROUTES);
break;
}
goto out;
}
switch (rt->dst.error) {
case EINVAL:
default:
goto out;
case EHOSTUNREACH:
code = ICMP_HOST_UNREACH;
break;
case ENETUNREACH:
code = ICMP_NET_UNREACH;
IP_INC_STATS_BH(net, IPSTATS_MIB_INNOROUTES);
break;
case EACCES:
code = ICMP_PKT_FILTERED;
break;
}
peer = inet_getpeer_v4(net->ipv4.peers, ip_hdr(skb)->saddr, 1);
send = true;
if (peer) {
now = jiffies;
peer->rate_tokens += now - peer->rate_last;
if (peer->rate_tokens > ip_rt_error_burst)
peer->rate_tokens = ip_rt_error_burst;
peer->rate_last = now;
if (peer->rate_tokens >= ip_rt_error_cost)
peer->rate_tokens -= ip_rt_error_cost;
else
send = false;
inet_putpeer(peer);
}
if (send)
icmp_send(skb, ICMP_DEST_UNREACH, code, 0);
out: kfree_skb(skb);
return 0;
}
static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu)
{
struct dst_entry *dst = &rt->dst;
struct fib_result res;
if (dst_metric_locked(dst, RTAX_MTU))
return;
if (dst->dev->mtu < mtu)
return;
if (mtu < ip_rt_min_pmtu)
mtu = ip_rt_min_pmtu;
if (rt->rt_pmtu == mtu &&
time_before(jiffies, dst->expires - ip_rt_mtu_expires / 2))
return;
rcu_read_lock();
if (fib_lookup(dev_net(dst->dev), fl4, &res) == 0) {
struct fib_nh *nh = &FIB_RES_NH(res);
update_or_create_fnhe(nh, fl4->daddr, 0, mtu,
jiffies + ip_rt_mtu_expires);
}
rcu_read_unlock();
}
static void ip_rt_update_pmtu(struct dst_entry *dst, struct sock *sk,
struct sk_buff *skb, u32 mtu)
{
struct rtable *rt = (struct rtable *) dst;
struct flowi4 fl4;
ip_rt_build_flow_key(&fl4, sk, skb);
__ip_rt_update_pmtu(rt, &fl4, mtu);
}
void ipv4_update_pmtu(struct sk_buff *skb, struct net *net, u32 mtu,
int oif, u32 mark, u8 protocol, int flow_flags)
{
const struct iphdr *iph = (const struct iphdr *) skb->data;
struct flowi4 fl4;
struct rtable *rt;
if (!mark)
mark = IP4_REPLY_MARK(net, skb->mark);
__build_flow_key(&fl4, NULL, iph, oif,
RT_TOS(iph->tos), protocol, mark, flow_flags);
rt = __ip_route_output_key(net, &fl4);
if (!IS_ERR(rt)) {
__ip_rt_update_pmtu(rt, &fl4, mtu);
ip_rt_put(rt);
}
}
EXPORT_SYMBOL_GPL(ipv4_update_pmtu);
static void __ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu)
{
const struct iphdr *iph = (const struct iphdr *) skb->data;
struct flowi4 fl4;
struct rtable *rt;
__build_flow_key(&fl4, sk, iph, 0, 0, 0, 0, 0);
if (!fl4.flowi4_mark)
fl4.flowi4_mark = IP4_REPLY_MARK(sock_net(sk), skb->mark);
rt = __ip_route_output_key(sock_net(sk), &fl4);
if (!IS_ERR(rt)) {
__ip_rt_update_pmtu(rt, &fl4, mtu);
ip_rt_put(rt);
}
}
void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu)
{
const struct iphdr *iph = (const struct iphdr *) skb->data;
struct flowi4 fl4;
struct rtable *rt;
struct dst_entry *odst = NULL;
bool new = false;
bh_lock_sock(sk);
if (!ip_sk_accept_pmtu(sk))
goto out;
odst = sk_dst_get(sk);
if (sock_owned_by_user(sk) || !odst) {
__ipv4_sk_update_pmtu(skb, sk, mtu);
goto out;
}
__build_flow_key(&fl4, sk, iph, 0, 0, 0, 0, 0);
rt = (struct rtable *)odst;
if (odst->obsolete && odst->ops->check(odst, 0) == NULL) {
rt = ip_route_output_flow(sock_net(sk), &fl4, sk);
if (IS_ERR(rt))
goto out;
new = true;
}
__ip_rt_update_pmtu((struct rtable *) rt->dst.path, &fl4, mtu);
if (!dst_check(&rt->dst, 0)) {
if (new)
dst_release(&rt->dst);
rt = ip_route_output_flow(sock_net(sk), &fl4, sk);
if (IS_ERR(rt))
goto out;
new = true;
}
if (new)
sk_dst_set(sk, &rt->dst);
out:
bh_unlock_sock(sk);
dst_release(odst);
}
EXPORT_SYMBOL_GPL(ipv4_sk_update_pmtu);
void ipv4_redirect(struct sk_buff *skb, struct net *net,
int oif, u32 mark, u8 protocol, int flow_flags)
{
const struct iphdr *iph = (const struct iphdr *) skb->data;
struct flowi4 fl4;
struct rtable *rt;
__build_flow_key(&fl4, NULL, iph, oif,
RT_TOS(iph->tos), protocol, mark, flow_flags);
rt = __ip_route_output_key(net, &fl4);
if (!IS_ERR(rt)) {
__ip_do_redirect(rt, skb, &fl4, false);
ip_rt_put(rt);
}
}
EXPORT_SYMBOL_GPL(ipv4_redirect);
void ipv4_sk_redirect(struct sk_buff *skb, struct sock *sk)
{
const struct iphdr *iph = (const struct iphdr *) skb->data;
struct flowi4 fl4;
struct rtable *rt;
__build_flow_key(&fl4, sk, iph, 0, 0, 0, 0, 0);
rt = __ip_route_output_key(sock_net(sk), &fl4);
if (!IS_ERR(rt)) {
__ip_do_redirect(rt, skb, &fl4, false);
ip_rt_put(rt);
}
}
EXPORT_SYMBOL_GPL(ipv4_sk_redirect);
static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie)
{
struct rtable *rt = (struct rtable *) dst;
/* All IPV4 dsts are created with ->obsolete set to the value
* DST_OBSOLETE_FORCE_CHK which forces validation calls down
* into this function always.
*
* When a PMTU/redirect information update invalidates a route,
* this is indicated by setting obsolete to DST_OBSOLETE_KILL or
* DST_OBSOLETE_DEAD by dst_free().
*/
if (dst->obsolete != DST_OBSOLETE_FORCE_CHK || rt_is_expired(rt))
return NULL;
return dst;
}
static void ipv4_link_failure(struct sk_buff *skb)
{
struct rtable *rt;
icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0);
rt = skb_rtable(skb);
if (rt)
dst_set_expires(&rt->dst, 0);
}
static int ip_rt_bug(struct sock *sk, struct sk_buff *skb)
{
pr_debug("%s: %pI4 -> %pI4, %s\n",
__func__, &ip_hdr(skb)->saddr, &ip_hdr(skb)->daddr,
skb->dev ? skb->dev->name : "?");
kfree_skb(skb);
WARN_ON(1);
return 0;
}
/*
We do not cache source address of outgoing interface,
because it is used only by IP RR, TS and SRR options,
so that it out of fast path.
BTW remember: "addr" is allowed to be not aligned
in IP options!
*/
void ip_rt_get_source(u8 *addr, struct sk_buff *skb, struct rtable *rt)
{
__be32 src;
if (rt_is_output_route(rt))
src = ip_hdr(skb)->saddr;
else {
struct fib_result res;
struct flowi4 fl4;
struct iphdr *iph;
iph = ip_hdr(skb);
memset(&fl4, 0, sizeof(fl4));
fl4.daddr = iph->daddr;
fl4.saddr = iph->saddr;
fl4.flowi4_tos = RT_TOS(iph->tos);
fl4.flowi4_oif = rt->dst.dev->ifindex;
fl4.flowi4_iif = skb->dev->ifindex;
fl4.flowi4_mark = skb->mark;
rcu_read_lock();
if (fib_lookup(dev_net(rt->dst.dev), &fl4, &res) == 0)
src = FIB_RES_PREFSRC(dev_net(rt->dst.dev), res);
else
src = inet_select_addr(rt->dst.dev,
rt_nexthop(rt, iph->daddr),
RT_SCOPE_UNIVERSE);
rcu_read_unlock();
}
memcpy(addr, &src, 4);
}
#ifdef CONFIG_IP_ROUTE_CLASSID
static void set_class_tag(struct rtable *rt, u32 tag)
{
if (!(rt->dst.tclassid & 0xFFFF))
rt->dst.tclassid |= tag & 0xFFFF;
if (!(rt->dst.tclassid & 0xFFFF0000))
rt->dst.tclassid |= tag & 0xFFFF0000;
}
#endif
static unsigned int ipv4_default_advmss(const struct dst_entry *dst)
{
unsigned int advmss = dst_metric_raw(dst, RTAX_ADVMSS);
if (advmss == 0) {
advmss = max_t(unsigned int, dst->dev->mtu - 40,
ip_rt_min_advmss);
if (advmss > 65535 - 40)
advmss = 65535 - 40;
}
return advmss;
}
static unsigned int ipv4_mtu(const struct dst_entry *dst)
{
const struct rtable *rt = (const struct rtable *) dst;
unsigned int mtu = rt->rt_pmtu;
if (!mtu || time_after_eq(jiffies, rt->dst.expires))
mtu = dst_metric_raw(dst, RTAX_MTU);
if (mtu)
return mtu;
mtu = dst->dev->mtu;
if (unlikely(dst_metric_locked(dst, RTAX_MTU))) {
if (rt->rt_uses_gateway && mtu > 576)
mtu = 576;
}
return min_t(unsigned int, mtu, IP_MAX_MTU);
}
static struct fib_nh_exception *find_exception(struct fib_nh *nh, __be32 daddr)
{
struct fnhe_hash_bucket *hash = rcu_dereference(nh->nh_exceptions);
struct fib_nh_exception *fnhe;
u32 hval;
if (!hash)
return NULL;
hval = fnhe_hashfun(daddr);
for (fnhe = rcu_dereference(hash[hval].chain); fnhe;
fnhe = rcu_dereference(fnhe->fnhe_next)) {
if (fnhe->fnhe_daddr == daddr)
return fnhe;
}
return NULL;
}
static bool rt_bind_exception(struct rtable *rt, struct fib_nh_exception *fnhe,
__be32 daddr)
{
bool ret = false;
spin_lock_bh(&fnhe_lock);
if (daddr == fnhe->fnhe_daddr) {
struct rtable __rcu **porig;
struct rtable *orig;
int genid = fnhe_genid(dev_net(rt->dst.dev));
if (rt_is_input_route(rt))
porig = &fnhe->fnhe_rth_input;
else
porig = &fnhe->fnhe_rth_output;
orig = rcu_dereference(*porig);
if (fnhe->fnhe_genid != genid) {
fnhe->fnhe_genid = genid;
fnhe->fnhe_gw = 0;
fnhe->fnhe_pmtu = 0;
fnhe->fnhe_expires = 0;
fnhe_flush_routes(fnhe);
orig = NULL;
}
fill_route_from_fnhe(rt, fnhe);
if (!rt->rt_gateway)
rt->rt_gateway = daddr;
if (!(rt->dst.flags & DST_NOCACHE)) {
rcu_assign_pointer(*porig, rt);
if (orig)
rt_free(orig);
ret = true;
}
fnhe->fnhe_stamp = jiffies;
}
spin_unlock_bh(&fnhe_lock);
return ret;
}
static bool rt_cache_route(struct fib_nh *nh, struct rtable *rt)
{
struct rtable *orig, *prev, **p;
bool ret = true;
if (rt_is_input_route(rt)) {
p = (struct rtable **)&nh->nh_rth_input;
} else {
p = (struct rtable **)raw_cpu_ptr(nh->nh_pcpu_rth_output);
}
orig = *p;
prev = cmpxchg(p, orig, rt);
if (prev == orig) {
if (orig)
rt_free(orig);
} else
ret = false;
return ret;
}
static DEFINE_SPINLOCK(rt_uncached_lock);
static LIST_HEAD(rt_uncached_list);
static void rt_add_uncached_list(struct rtable *rt)
{
spin_lock_bh(&rt_uncached_lock);
list_add_tail(&rt->rt_uncached, &rt_uncached_list);
spin_unlock_bh(&rt_uncached_lock);
}
static void ipv4_dst_destroy(struct dst_entry *dst)
{
struct rtable *rt = (struct rtable *) dst;
if (!list_empty(&rt->rt_uncached)) {
spin_lock_bh(&rt_uncached_lock);
list_del(&rt->rt_uncached);
spin_unlock_bh(&rt_uncached_lock);
}
}
void rt_flush_dev(struct net_device *dev)
{
if (!list_empty(&rt_uncached_list)) {
struct net *net = dev_net(dev);
struct rtable *rt;
spin_lock_bh(&rt_uncached_lock);
list_for_each_entry(rt, &rt_uncached_list, rt_uncached) {
if (rt->dst.dev != dev)
continue;
rt->dst.dev = net->loopback_dev;
dev_hold(rt->dst.dev);
dev_put(dev);
}
spin_unlock_bh(&rt_uncached_lock);
}
}
static bool rt_cache_valid(const struct rtable *rt)
{
return rt &&
rt->dst.obsolete == DST_OBSOLETE_FORCE_CHK &&
!rt_is_expired(rt);
}
static void rt_set_nexthop(struct rtable *rt, __be32 daddr,
const struct fib_result *res,
struct fib_nh_exception *fnhe,
struct fib_info *fi, u16 type, u32 itag)
{
bool cached = false;
if (fi) {
struct fib_nh *nh = &FIB_RES_NH(*res);
if (nh->nh_gw && nh->nh_scope == RT_SCOPE_LINK) {
rt->rt_gateway = nh->nh_gw;
rt->rt_uses_gateway = 1;
}
dst_init_metrics(&rt->dst, fi->fib_metrics, true);
#ifdef CONFIG_IP_ROUTE_CLASSID
rt->dst.tclassid = nh->nh_tclassid;
#endif
if (unlikely(fnhe))
cached = rt_bind_exception(rt, fnhe, daddr);
else if (!(rt->dst.flags & DST_NOCACHE))
cached = rt_cache_route(nh, rt);
if (unlikely(!cached)) {
/* Routes we intend to cache in nexthop exception or
* FIB nexthop have the DST_NOCACHE bit clear.
* However, if we are unsuccessful at storing this
* route into the cache we really need to set it.
*/
rt->dst.flags |= DST_NOCACHE;
if (!rt->rt_gateway)
rt->rt_gateway = daddr;
rt_add_uncached_list(rt);
}
} else
rt_add_uncached_list(rt);
#ifdef CONFIG_IP_ROUTE_CLASSID
#ifdef CONFIG_IP_MULTIPLE_TABLES
set_class_tag(rt, res->tclassid);
#endif
set_class_tag(rt, itag);
#endif
}
static struct rtable *rt_dst_alloc(struct net_device *dev,
bool nopolicy, bool noxfrm, bool will_cache)
{
return dst_alloc(&ipv4_dst_ops, dev, 1, DST_OBSOLETE_FORCE_CHK,
(will_cache ? 0 : (DST_HOST | DST_NOCACHE)) |
(nopolicy ? DST_NOPOLICY : 0) |
(noxfrm ? DST_NOXFRM : 0));
}
/* called in rcu_read_lock() section */
static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
u8 tos, struct net_device *dev, int our)
{
struct rtable *rth;
struct in_device *in_dev = __in_dev_get_rcu(dev);
u32 itag = 0;
int err;
/* Primary sanity checks. */
if (in_dev == NULL)
return -EINVAL;
if (ipv4_is_multicast(saddr) || ipv4_is_lbcast(saddr) ||
skb->protocol != htons(ETH_P_IP))
goto e_inval;
if (likely(!IN_DEV_ROUTE_LOCALNET(in_dev)))
if (ipv4_is_loopback(saddr))
goto e_inval;
if (ipv4_is_zeronet(saddr)) {
if (!ipv4_is_local_multicast(daddr))
goto e_inval;
} else {
err = fib_validate_source(skb, saddr, 0, tos, 0, dev,
in_dev, &itag);
if (err < 0)
goto e_err;
}
rth = rt_dst_alloc(dev_net(dev)->loopback_dev,
IN_DEV_CONF_GET(in_dev, NOPOLICY), false, false);
if (!rth)
goto e_nobufs;
#ifdef CONFIG_IP_ROUTE_CLASSID
rth->dst.tclassid = itag;
#endif
rth->dst.output = ip_rt_bug;
rth->rt_genid = rt_genid_ipv4(dev_net(dev));
rth->rt_flags = RTCF_MULTICAST;
rth->rt_type = RTN_MULTICAST;
rth->rt_is_input= 1;
rth->rt_iif = 0;
rth->rt_pmtu = 0;
rth->rt_gateway = 0;
rth->rt_uses_gateway = 0;
INIT_LIST_HEAD(&rth->rt_uncached);
if (our) {
rth->dst.input= ip_local_deliver;
rth->rt_flags |= RTCF_LOCAL;
}
#ifdef CONFIG_IP_MROUTE
if (!ipv4_is_local_multicast(daddr) && IN_DEV_MFORWARD(in_dev))
rth->dst.input = ip_mr_input;
#endif
RT_CACHE_STAT_INC(in_slow_mc);
skb_dst_set(skb, &rth->dst);
return 0;
e_nobufs:
return -ENOBUFS;
e_inval:
return -EINVAL;
e_err:
return err;
}
static void ip_handle_martian_source(struct net_device *dev,
struct in_device *in_dev,
struct sk_buff *skb,
__be32 daddr,
__be32 saddr)
{
RT_CACHE_STAT_INC(in_martian_src);
#ifdef CONFIG_IP_ROUTE_VERBOSE
if (IN_DEV_LOG_MARTIANS(in_dev) && net_ratelimit()) {
/*
* RFC1812 recommendation, if source is martian,
* the only hint is MAC header.
*/
pr_warn("martian source %pI4 from %pI4, on dev %s\n",
&daddr, &saddr, dev->name);
if (dev->hard_header_len && skb_mac_header_was_set(skb)) {
print_hex_dump(KERN_WARNING, "ll header: ",
DUMP_PREFIX_OFFSET, 16, 1,
skb_mac_header(skb),
dev->hard_header_len, true);
}
}
#endif
}
/* called in rcu_read_lock() section */
static int __mkroute_input(struct sk_buff *skb,
const struct fib_result *res,
struct in_device *in_dev,
__be32 daddr, __be32 saddr, u32 tos)
{
struct fib_nh_exception *fnhe;
struct rtable *rth;
int err;
struct in_device *out_dev;
unsigned int flags = 0;
bool do_cache;
u32 itag = 0;
/* get a working reference to the output device */
out_dev = __in_dev_get_rcu(FIB_RES_DEV(*res));
if (out_dev == NULL) {
net_crit_ratelimited("Bug in ip_route_input_slow(). Please report.\n");
return -EINVAL;
}
err = fib_validate_source(skb, saddr, daddr, tos, FIB_RES_OIF(*res),
in_dev->dev, in_dev, &itag);
if (err < 0) {
ip_handle_martian_source(in_dev->dev, in_dev, skb, daddr,
saddr);
goto cleanup;
}
do_cache = res->fi && !itag;
if (out_dev == in_dev && err && IN_DEV_TX_REDIRECTS(out_dev) &&
(IN_DEV_SHARED_MEDIA(out_dev) ||
inet_addr_onlink(out_dev, saddr, FIB_RES_GW(*res)))) {
flags |= RTCF_DOREDIRECT;
do_cache = false;
}
if (skb->protocol != htons(ETH_P_IP)) {
/* Not IP (i.e. ARP). Do not create route, if it is
* invalid for proxy arp. DNAT routes are always valid.
*
* Proxy arp feature have been extended to allow, ARP
* replies back to the same interface, to support
* Private VLAN switch technologies. See arp.c.
*/
if (out_dev == in_dev &&
IN_DEV_PROXY_ARP_PVLAN(in_dev) == 0) {
err = -EINVAL;
goto cleanup;
}
}
fnhe = find_exception(&FIB_RES_NH(*res), daddr);
if (do_cache) {
if (fnhe != NULL)
rth = rcu_dereference(fnhe->fnhe_rth_input);
else
rth = rcu_dereference(FIB_RES_NH(*res).nh_rth_input);
if (rt_cache_valid(rth)) {
skb_dst_set_noref(skb, &rth->dst);
goto out;
}
}
rth = rt_dst_alloc(out_dev->dev,
IN_DEV_CONF_GET(in_dev, NOPOLICY),
IN_DEV_CONF_GET(out_dev, NOXFRM), do_cache);
if (!rth) {
err = -ENOBUFS;
goto cleanup;
}
rth->rt_genid = rt_genid_ipv4(dev_net(rth->dst.dev));
rth->rt_flags = flags;
rth->rt_type = res->type;
rth->rt_is_input = 1;
rth->rt_iif = 0;
rth->rt_pmtu = 0;
rth->rt_gateway = 0;
rth->rt_uses_gateway = 0;
INIT_LIST_HEAD(&rth->rt_uncached);
RT_CACHE_STAT_INC(in_slow_tot);
rth->dst.input = ip_forward;
rth->dst.output = ip_output;
rt_set_nexthop(rth, daddr, res, fnhe, res->fi, res->type, itag);
skb_dst_set(skb, &rth->dst);
out:
err = 0;
cleanup:
return err;
}
static int ip_mkroute_input(struct sk_buff *skb,
struct fib_result *res,
const struct flowi4 *fl4,
struct in_device *in_dev,
__be32 daddr, __be32 saddr, u32 tos)
{
#ifdef CONFIG_IP_ROUTE_MULTIPATH
if (res->fi && res->fi->fib_nhs > 1)
fib_select_multipath(res);
#endif
/* create a routing cache entry */
return __mkroute_input(skb, res, in_dev, daddr, saddr, tos);
}
/*
* NOTE. We drop all the packets that has local source
* addresses, because every properly looped back packet
* must have correct destination already attached by output routine.
*
* Such approach solves two big problems:
* 1. Not simplex devices are handled properly.
* 2. IP spoofing attempts are filtered with 100% of guarantee.
* called with rcu_read_lock()
*/
static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
u8 tos, struct net_device *dev)
{
struct fib_result res;
struct in_device *in_dev = __in_dev_get_rcu(dev);
struct flowi4 fl4;
unsigned int flags = 0;
u32 itag = 0;
struct rtable *rth;
int err = -EINVAL;
struct net *net = dev_net(dev);
bool do_cache;
/* IP on this device is disabled. */
if (!in_dev)
goto out;
/* Check for the most weird martians, which can be not detected
by fib_lookup.
*/
if (ipv4_is_multicast(saddr) || ipv4_is_lbcast(saddr))
goto martian_source;
res.fi = NULL;
if (ipv4_is_lbcast(daddr) || (saddr == 0 && daddr == 0))
goto brd_input;
/* Accept zero addresses only to limited broadcast;
* I even do not know to fix it or not. Waiting for complains :-)
*/
if (ipv4_is_zeronet(saddr))
goto martian_source;
if (ipv4_is_zeronet(daddr))
goto martian_destination;
/* Following code try to avoid calling IN_DEV_NET_ROUTE_LOCALNET(),
* and call it once if daddr or/and saddr are loopback addresses
*/
if (ipv4_is_loopback(daddr)) {
if (!IN_DEV_NET_ROUTE_LOCALNET(in_dev, net))
goto martian_destination;
} else if (ipv4_is_loopback(saddr)) {
if (!IN_DEV_NET_ROUTE_LOCALNET(in_dev, net))
goto martian_source;
}
/*
* Now we are ready to route packet.
*/
fl4.flowi4_oif = 0;
fl4.flowi4_iif = dev->ifindex;
fl4.flowi4_mark = skb->mark;
fl4.flowi4_tos = tos;
fl4.flowi4_scope = RT_SCOPE_UNIVERSE;
fl4.daddr = daddr;
fl4.saddr = saddr;
err = fib_lookup(net, &fl4, &res);
if (err != 0) {
if (!IN_DEV_FORWARD(in_dev))
err = -EHOSTUNREACH;
goto no_route;
}
if (res.type == RTN_BROADCAST)
goto brd_input;
if (res.type == RTN_LOCAL) {
err = fib_validate_source(skb, saddr, daddr, tos,
0, dev, in_dev, &itag);
if (err < 0)
goto martian_source_keep_err;
goto local_input;
}
if (!IN_DEV_FORWARD(in_dev)) {
err = -EHOSTUNREACH;
goto no_route;
}
if (res.type != RTN_UNICAST)
goto martian_destination;
err = ip_mkroute_input(skb, &res, &fl4, in_dev, daddr, saddr, tos);
out: return err;
brd_input:
if (skb->protocol != htons(ETH_P_IP))
goto e_inval;
if (!ipv4_is_zeronet(saddr)) {
err = fib_validate_source(skb, saddr, 0, tos, 0, dev,
in_dev, &itag);
if (err < 0)
goto martian_source_keep_err;
}
flags |= RTCF_BROADCAST;
res.type = RTN_BROADCAST;
RT_CACHE_STAT_INC(in_brd);
local_input:
do_cache = false;
if (res.fi) {
if (!itag) {
rth = rcu_dereference(FIB_RES_NH(res).nh_rth_input);
if (rt_cache_valid(rth)) {
skb_dst_set_noref(skb, &rth->dst);
err = 0;
goto out;
}
do_cache = true;
}
}
rth = rt_dst_alloc(net->loopback_dev,
IN_DEV_CONF_GET(in_dev, NOPOLICY), false, do_cache);
if (!rth)
goto e_nobufs;
rth->dst.input= ip_local_deliver;
rth->dst.output= ip_rt_bug;
#ifdef CONFIG_IP_ROUTE_CLASSID
rth->dst.tclassid = itag;
#endif
rth->rt_genid = rt_genid_ipv4(net);
rth->rt_flags = flags|RTCF_LOCAL;
rth->rt_type = res.type;
rth->rt_is_input = 1;
rth->rt_iif = 0;
rth->rt_pmtu = 0;
rth->rt_gateway = 0;
rth->rt_uses_gateway = 0;
INIT_LIST_HEAD(&rth->rt_uncached);
RT_CACHE_STAT_INC(in_slow_tot);
if (res.type == RTN_UNREACHABLE) {
rth->dst.input= ip_error;
rth->dst.error= -err;
rth->rt_flags &= ~RTCF_LOCAL;
}
if (do_cache) {
if (unlikely(!rt_cache_route(&FIB_RES_NH(res), rth))) {
rth->dst.flags |= DST_NOCACHE;
rt_add_uncached_list(rth);
}
}
skb_dst_set(skb, &rth->dst);
err = 0;
goto out;
no_route:
RT_CACHE_STAT_INC(in_no_route);
res.type = RTN_UNREACHABLE;
goto local_input;
/*
* Do not cache martian addresses: they should be logged (RFC1812)
*/
martian_destination:
RT_CACHE_STAT_INC(in_martian_dst);
#ifdef CONFIG_IP_ROUTE_VERBOSE
if (IN_DEV_LOG_MARTIANS(in_dev))
net_warn_ratelimited("martian destination %pI4 from %pI4, dev %s\n",
&daddr, &saddr, dev->name);
#endif
e_inval:
err = -EINVAL;
goto out;
e_nobufs:
err = -ENOBUFS;
goto out;
martian_source:
err = -EINVAL;
martian_source_keep_err:
ip_handle_martian_source(dev, in_dev, skb, daddr, saddr);
goto out;
}
int ip_route_input_noref(struct sk_buff *skb, __be32 daddr, __be32 saddr,
u8 tos, struct net_device *dev)
{
int res;
rcu_read_lock();
/* Multicast recognition logic is moved from route cache to here.
The problem was that too many Ethernet cards have broken/missing
hardware multicast filters :-( As result the host on multicasting
network acquires a lot of useless route cache entries, sort of
SDR messages from all the world. Now we try to get rid of them.
Really, provided software IP multicast filter is organized
reasonably (at least, hashed), it does not result in a slowdown
comparing with route cache reject entries.
Note, that multicast routers are not affected, because
route cache entry is created eventually.
*/
if (ipv4_is_multicast(daddr)) {
struct in_device *in_dev = __in_dev_get_rcu(dev);
if (in_dev) {
int our = ip_check_mc_rcu(in_dev, daddr, saddr,
ip_hdr(skb)->protocol);
if (our
#ifdef CONFIG_IP_MROUTE
||
(!ipv4_is_local_multicast(daddr) &&
IN_DEV_MFORWARD(in_dev))
#endif
) {
int res = ip_route_input_mc(skb, daddr, saddr,
tos, dev, our);
rcu_read_unlock();
return res;
}
}
rcu_read_unlock();
return -EINVAL;
}
res = ip_route_input_slow(skb, daddr, saddr, tos, dev);
rcu_read_unlock();
return res;
}
EXPORT_SYMBOL(ip_route_input_noref);
/* called with rcu_read_lock() */
static struct rtable *__mkroute_output(const struct fib_result *res,
const struct flowi4 *fl4, int orig_oif,
struct net_device *dev_out,
unsigned int flags)
{
struct fib_info *fi = res->fi;
struct fib_nh_exception *fnhe;
struct in_device *in_dev;
u16 type = res->type;
struct rtable *rth;
bool do_cache;
in_dev = __in_dev_get_rcu(dev_out);
if (!in_dev)
return ERR_PTR(-EINVAL);
if (likely(!IN_DEV_ROUTE_LOCALNET(in_dev)))
if (ipv4_is_loopback(fl4->saddr) && !(dev_out->flags & IFF_LOOPBACK))
return ERR_PTR(-EINVAL);
if (ipv4_is_lbcast(fl4->daddr))
type = RTN_BROADCAST;
else if (ipv4_is_multicast(fl4->daddr))
type = RTN_MULTICAST;
else if (ipv4_is_zeronet(fl4->daddr))
return ERR_PTR(-EINVAL);
if (dev_out->flags & IFF_LOOPBACK)
flags |= RTCF_LOCAL;
do_cache = true;
if (type == RTN_BROADCAST) {
flags |= RTCF_BROADCAST | RTCF_LOCAL;
fi = NULL;
} else if (type == RTN_MULTICAST) {
flags |= RTCF_MULTICAST | RTCF_LOCAL;
if (!ip_check_mc_rcu(in_dev, fl4->daddr, fl4->saddr,
fl4->flowi4_proto))
flags &= ~RTCF_LOCAL;
else
do_cache = false;
/* If multicast route do not exist use
* default one, but do not gateway in this case.
* Yes, it is hack.
*/
if (fi && res->prefixlen < 4)
fi = NULL;
}
fnhe = NULL;
do_cache &= fi != NULL;
if (do_cache) {
struct rtable __rcu **prth;
struct fib_nh *nh = &FIB_RES_NH(*res);
fnhe = find_exception(nh, fl4->daddr);
if (fnhe)
prth = &fnhe->fnhe_rth_output;
else {
if (unlikely(fl4->flowi4_flags &
FLOWI_FLAG_KNOWN_NH &&
!(nh->nh_gw &&
nh->nh_scope == RT_SCOPE_LINK))) {
do_cache = false;
goto add;
}
prth = raw_cpu_ptr(nh->nh_pcpu_rth_output);
}
rth = rcu_dereference(*prth);
if (rt_cache_valid(rth)) {
dst_hold(&rth->dst);
return rth;
}
}
add:
rth = rt_dst_alloc(dev_out,
IN_DEV_CONF_GET(in_dev, NOPOLICY),
IN_DEV_CONF_GET(in_dev, NOXFRM),
do_cache);
if (!rth)
return ERR_PTR(-ENOBUFS);
rth->dst.output = ip_output;
rth->rt_genid = rt_genid_ipv4(dev_net(dev_out));
rth->rt_flags = flags;
rth->rt_type = type;
rth->rt_is_input = 0;
rth->rt_iif = orig_oif ? : 0;
rth->rt_pmtu = 0;
rth->rt_gateway = 0;
rth->rt_uses_gateway = 0;
INIT_LIST_HEAD(&rth->rt_uncached);
RT_CACHE_STAT_INC(out_slow_tot);
if (flags & RTCF_LOCAL)
rth->dst.input = ip_local_deliver;
if (flags & (RTCF_BROADCAST | RTCF_MULTICAST)) {
if (flags & RTCF_LOCAL &&
!(dev_out->flags & IFF_LOOPBACK)) {
rth->dst.output = ip_mc_output;
RT_CACHE_STAT_INC(out_slow_mc);
}
#ifdef CONFIG_IP_MROUTE
if (type == RTN_MULTICAST) {
if (IN_DEV_MFORWARD(in_dev) &&
!ipv4_is_local_multicast(fl4->daddr)) {
rth->dst.input = ip_mr_input;
rth->dst.output = ip_mc_output;
}
}
#endif
}
rt_set_nexthop(rth, fl4->daddr, res, fnhe, fi, type, 0);
return rth;
}
/*
* Major route resolver routine.
*/
struct rtable *__ip_route_output_key(struct net *net, struct flowi4 *fl4)
{
struct net_device *dev_out = NULL;
__u8 tos = RT_FL_TOS(fl4);
unsigned int flags = 0;
struct fib_result res;
struct rtable *rth;
int orig_oif;
res.tclassid = 0;
res.fi = NULL;
res.table = NULL;
orig_oif = fl4->flowi4_oif;
fl4->flowi4_iif = LOOPBACK_IFINDEX;
fl4->flowi4_tos = tos & IPTOS_RT_MASK;
fl4->flowi4_scope = ((tos & RTO_ONLINK) ?
RT_SCOPE_LINK : RT_SCOPE_UNIVERSE);
rcu_read_lock();
if (fl4->saddr) {
rth = ERR_PTR(-EINVAL);
if (ipv4_is_multicast(fl4->saddr) ||
ipv4_is_lbcast(fl4->saddr) ||
ipv4_is_zeronet(fl4->saddr))
goto out;
/* I removed check for oif == dev_out->oif here.
It was wrong for two reasons:
1. ip_dev_find(net, saddr) can return wrong iface, if saddr
is assigned to multiple interfaces.
2. Moreover, we are allowed to send packets with saddr
of another iface. --ANK
*/
if (fl4->flowi4_oif == 0 &&
(ipv4_is_multicast(fl4->daddr) ||
ipv4_is_lbcast(fl4->daddr))) {
/* It is equivalent to inet_addr_type(saddr) == RTN_LOCAL */
dev_out = __ip_dev_find(net, fl4->saddr, false);
if (dev_out == NULL)
goto out;
/* Special hack: user can direct multicasts
and limited broadcast via necessary interface
without fiddling with IP_MULTICAST_IF or IP_PKTINFO.
This hack is not just for fun, it allows
vic,vat and friends to work.
They bind socket to loopback, set ttl to zero
and expect that it will work.
From the viewpoint of routing cache they are broken,
because we are not allowed to build multicast path
with loopback source addr (look, routing cache
cannot know, that ttl is zero, so that packet
will not leave this host and route is valid).
Luckily, this hack is good workaround.
*/
fl4->flowi4_oif = dev_out->ifindex;
goto make_route;
}
if (!(fl4->flowi4_flags & FLOWI_FLAG_ANYSRC)) {
/* It is equivalent to inet_addr_type(saddr) == RTN_LOCAL */
if (!__ip_dev_find(net, fl4->saddr, false))
goto out;
}
}
if (fl4->flowi4_oif) {
dev_out = dev_get_by_index_rcu(net, fl4->flowi4_oif);
rth = ERR_PTR(-ENODEV);
if (dev_out == NULL)
goto out;
/* RACE: Check return value of inet_select_addr instead. */
if (!(dev_out->flags & IFF_UP) || !__in_dev_get_rcu(dev_out)) {
rth = ERR_PTR(-ENETUNREACH);
goto out;
}
if (ipv4_is_local_multicast(fl4->daddr) ||
ipv4_is_lbcast(fl4->daddr)) {
if (!fl4->saddr)
fl4->saddr = inet_select_addr(dev_out, 0,
RT_SCOPE_LINK);
goto make_route;
}
if (!fl4->saddr) {
if (ipv4_is_multicast(fl4->daddr))
fl4->saddr = inet_select_addr(dev_out, 0,
fl4->flowi4_scope);
else if (!fl4->daddr)
fl4->saddr = inet_select_addr(dev_out, 0,
RT_SCOPE_HOST);
}
}
if (!fl4->daddr) {
fl4->daddr = fl4->saddr;
if (!fl4->daddr)
fl4->daddr = fl4->saddr = htonl(INADDR_LOOPBACK);
dev_out = net->loopback_dev;
fl4->flowi4_oif = LOOPBACK_IFINDEX;
res.type = RTN_LOCAL;
flags |= RTCF_LOCAL;
goto make_route;
}
if (fib_lookup(net, fl4, &res)) {
res.fi = NULL;
res.table = NULL;
if (fl4->flowi4_oif) {
/* Apparently, routing tables are wrong. Assume,
that the destination is on link.
WHY? DW.
Because we are allowed to send to iface
even if it has NO routes and NO assigned
addresses. When oif is specified, routing
tables are looked up with only one purpose:
to catch if destination is gatewayed, rather than
direct. Moreover, if MSG_DONTROUTE is set,
we send packet, ignoring both routing tables
and ifaddr state. --ANK
We could make it even if oif is unknown,
likely IPv6, but we do not.
*/
if (fl4->saddr == 0)
fl4->saddr = inet_select_addr(dev_out, 0,
RT_SCOPE_LINK);
res.type = RTN_UNICAST;
goto make_route;
}
rth = ERR_PTR(-ENETUNREACH);
goto out;
}
if (res.type == RTN_LOCAL) {
if (!fl4->saddr) {
if (res.fi->fib_prefsrc)
fl4->saddr = res.fi->fib_prefsrc;
else
fl4->saddr = fl4->daddr;
}
dev_out = net->loopback_dev;
fl4->flowi4_oif = dev_out->ifindex;
flags |= RTCF_LOCAL;
goto make_route;
}
#ifdef CONFIG_IP_ROUTE_MULTIPATH
if (res.fi->fib_nhs > 1 && fl4->flowi4_oif == 0)
fib_select_multipath(&res);
else
#endif
if (!res.prefixlen &&
res.table->tb_num_default > 1 &&
res.type == RTN_UNICAST && !fl4->flowi4_oif)
fib_select_default(&res);
if (!fl4->saddr)
fl4->saddr = FIB_RES_PREFSRC(net, res);
dev_out = FIB_RES_DEV(res);
fl4->flowi4_oif = dev_out->ifindex;
make_route:
rth = __mkroute_output(&res, fl4, orig_oif, dev_out, flags);
out:
rcu_read_unlock();
return rth;
}
EXPORT_SYMBOL_GPL(__ip_route_output_key);
static struct dst_entry *ipv4_blackhole_dst_check(struct dst_entry *dst, u32 cookie)
{
return NULL;
}
static unsigned int ipv4_blackhole_mtu(const struct dst_entry *dst)
{
unsigned int mtu = dst_metric_raw(dst, RTAX_MTU);
return mtu ? : dst->dev->mtu;
}
static void ipv4_rt_blackhole_update_pmtu(struct dst_entry *dst, struct sock *sk,
struct sk_buff *skb, u32 mtu)
{
}
static void ipv4_rt_blackhole_redirect(struct dst_entry *dst, struct sock *sk,
struct sk_buff *skb)
{
}
static u32 *ipv4_rt_blackhole_cow_metrics(struct dst_entry *dst,
unsigned long old)
{
return NULL;
}
static struct dst_ops ipv4_dst_blackhole_ops = {
.family = AF_INET,
.protocol = cpu_to_be16(ETH_P_IP),
.check = ipv4_blackhole_dst_check,
.mtu = ipv4_blackhole_mtu,
.default_advmss = ipv4_default_advmss,
.update_pmtu = ipv4_rt_blackhole_update_pmtu,
.redirect = ipv4_rt_blackhole_redirect,
.cow_metrics = ipv4_rt_blackhole_cow_metrics,
.neigh_lookup = ipv4_neigh_lookup,
};
struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_orig)
{
struct rtable *ort = (struct rtable *) dst_orig;
struct rtable *rt;
rt = dst_alloc(&ipv4_dst_blackhole_ops, NULL, 1, DST_OBSOLETE_NONE, 0);
if (rt) {
struct dst_entry *new = &rt->dst;
new->__use = 1;
new->input = dst_discard;
new->output = dst_discard_sk;
new->dev = ort->dst.dev;
if (new->dev)
dev_hold(new->dev);
rt->rt_is_input = ort->rt_is_input;
rt->rt_iif = ort->rt_iif;
rt->rt_pmtu = ort->rt_pmtu;
rt->rt_genid = rt_genid_ipv4(net);
rt->rt_flags = ort->rt_flags;
rt->rt_type = ort->rt_type;
rt->rt_gateway = ort->rt_gateway;
rt->rt_uses_gateway = ort->rt_uses_gateway;
INIT_LIST_HEAD(&rt->rt_uncached);
dst_free(new);
}
dst_release(dst_orig);
return rt ? &rt->dst : ERR_PTR(-ENOMEM);
}
struct rtable *ip_route_output_flow(struct net *net, struct flowi4 *flp4,
struct sock *sk)
{
struct rtable *rt = __ip_route_output_key(net, flp4);
if (IS_ERR(rt))
return rt;
if (flp4->flowi4_proto)
rt = (struct rtable *)xfrm_lookup_route(net, &rt->dst,
flowi4_to_flowi(flp4),
sk, 0);
return rt;
}
EXPORT_SYMBOL_GPL(ip_route_output_flow);
static int rt_fill_info(struct net *net, __be32 dst, __be32 src,
struct flowi4 *fl4, struct sk_buff *skb, u32 portid,
u32 seq, int event, int nowait, unsigned int flags)
{
struct rtable *rt = skb_rtable(skb);
struct rtmsg *r;
struct nlmsghdr *nlh;
unsigned long expires = 0;
u32 error;
u32 metrics[RTAX_MAX];
nlh = nlmsg_put(skb, portid, seq, event, sizeof(*r), flags);
if (nlh == NULL)
return -EMSGSIZE;
r = nlmsg_data(nlh);
r->rtm_family = AF_INET;
r->rtm_dst_len = 32;
r->rtm_src_len = 0;
r->rtm_tos = fl4->flowi4_tos;
r->rtm_table = RT_TABLE_MAIN;
if (nla_put_u32(skb, RTA_TABLE, RT_TABLE_MAIN))
goto nla_put_failure;
r->rtm_type = rt->rt_type;
r->rtm_scope = RT_SCOPE_UNIVERSE;
r->rtm_protocol = RTPROT_UNSPEC;
r->rtm_flags = (rt->rt_flags & ~0xFFFF) | RTM_F_CLONED;
if (rt->rt_flags & RTCF_NOTIFY)
r->rtm_flags |= RTM_F_NOTIFY;
if (nla_put_be32(skb, RTA_DST, dst))
goto nla_put_failure;
if (src) {
r->rtm_src_len = 32;
if (nla_put_be32(skb, RTA_SRC, src))
goto nla_put_failure;
}
if (rt->dst.dev &&
nla_put_u32(skb, RTA_OIF, rt->dst.dev->ifindex))
goto nla_put_failure;
#ifdef CONFIG_IP_ROUTE_CLASSID
if (rt->dst.tclassid &&
nla_put_u32(skb, RTA_FLOW, rt->dst.tclassid))
goto nla_put_failure;
#endif
if (!rt_is_input_route(rt) &&
fl4->saddr != src) {
if (nla_put_be32(skb, RTA_PREFSRC, fl4->saddr))
goto nla_put_failure;
}
if (rt->rt_uses_gateway &&
nla_put_be32(skb, RTA_GATEWAY, rt->rt_gateway))
goto nla_put_failure;
expires = rt->dst.expires;
if (expires) {
unsigned long now = jiffies;
if (time_before(now, expires))
expires -= now;
else
expires = 0;
}
memcpy(metrics, dst_metrics_ptr(&rt->dst), sizeof(metrics));
if (rt->rt_pmtu && expires)
metrics[RTAX_MTU - 1] = rt->rt_pmtu;
if (rtnetlink_put_metrics(skb, metrics) < 0)
goto nla_put_failure;
if (fl4->flowi4_mark &&
nla_put_u32(skb, RTA_MARK, fl4->flowi4_mark))
goto nla_put_failure;
error = rt->dst.error;
if (rt_is_input_route(rt)) {
#ifdef CONFIG_IP_MROUTE
if (ipv4_is_multicast(dst) && !ipv4_is_local_multicast(dst) &&
IPV4_DEVCONF_ALL(net, MC_FORWARDING)) {
int err = ipmr_get_route(net, skb,
fl4->saddr, fl4->daddr,
r, nowait);
if (err <= 0) {
if (!nowait) {
if (err == 0)
return 0;
goto nla_put_failure;
} else {
if (err == -EMSGSIZE)
goto nla_put_failure;
error = err;
}
}
} else
#endif
if (nla_put_u32(skb, RTA_IIF, skb->dev->ifindex))
goto nla_put_failure;
}
if (rtnl_put_cacheinfo(skb, &rt->dst, 0, expires, error) < 0)
goto nla_put_failure;
return nlmsg_end(skb, nlh);
nla_put_failure:
nlmsg_cancel(skb, nlh);
return -EMSGSIZE;
}
static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh)
{
struct net *net = sock_net(in_skb->sk);
struct rtmsg *rtm;
struct nlattr *tb[RTA_MAX+1];
struct rtable *rt = NULL;
struct flowi4 fl4;
__be32 dst = 0;
__be32 src = 0;
u32 iif;
int err;
int mark;
struct sk_buff *skb;
err = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_ipv4_policy);
if (err < 0)
goto errout;
rtm = nlmsg_data(nlh);
skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL);
if (skb == NULL) {
err = -ENOBUFS;
goto errout;
}
/* Reserve room for dummy headers, this skb can pass
through good chunk of routing engine.
*/
skb_reset_mac_header(skb);
skb_reset_network_header(skb);
/* Bugfix: need to give ip_route_input enough of an IP header to not gag. */
ip_hdr(skb)->protocol = IPPROTO_ICMP;
skb_reserve(skb, MAX_HEADER + sizeof(struct iphdr));
src = tb[RTA_SRC] ? nla_get_be32(tb[RTA_SRC]) : 0;
dst = tb[RTA_DST] ? nla_get_be32(tb[RTA_DST]) : 0;
iif = tb[RTA_IIF] ? nla_get_u32(tb[RTA_IIF]) : 0;
mark = tb[RTA_MARK] ? nla_get_u32(tb[RTA_MARK]) : 0;
memset(&fl4, 0, sizeof(fl4));
fl4.daddr = dst;
fl4.saddr = src;
fl4.flowi4_tos = rtm->rtm_tos;
fl4.flowi4_oif = tb[RTA_OIF] ? nla_get_u32(tb[RTA_OIF]) : 0;
fl4.flowi4_mark = mark;
if (iif) {
struct net_device *dev;
dev = __dev_get_by_index(net, iif);
if (dev == NULL) {
err = -ENODEV;
goto errout_free;
}
skb->protocol = htons(ETH_P_IP);
skb->dev = dev;
skb->mark = mark;
local_bh_disable();
err = ip_route_input(skb, dst, src, rtm->rtm_tos, dev);
local_bh_enable();
rt = skb_rtable(skb);
if (err == 0 && rt->dst.error)
err = -rt->dst.error;
} else {
rt = ip_route_output_key(net, &fl4);
err = 0;
if (IS_ERR(rt))
err = PTR_ERR(rt);
}
if (err)
goto errout_free;
skb_dst_set(skb, &rt->dst);
if (rtm->rtm_flags & RTM_F_NOTIFY)
rt->rt_flags |= RTCF_NOTIFY;
err = rt_fill_info(net, dst, src, &fl4, skb,
NETLINK_CB(in_skb).portid, nlh->nlmsg_seq,
RTM_NEWROUTE, 0, 0);
if (err <= 0)
goto errout_free;
err = rtnl_unicast(skb, net, NETLINK_CB(in_skb).portid);
errout:
return err;
errout_free:
kfree_skb(skb);
goto errout;
}
void ip_rt_multicast_event(struct in_device *in_dev)
{
rt_cache_flush(dev_net(in_dev->dev));
}
#ifdef CONFIG_SYSCTL
static int ip_rt_gc_timeout __read_mostly = RT_GC_TIMEOUT;
static int ip_rt_gc_interval __read_mostly = 60 * HZ;
static int ip_rt_gc_min_interval __read_mostly = HZ / 2;
static int ip_rt_gc_elasticity __read_mostly = 8;
static int ipv4_sysctl_rtcache_flush(struct ctl_table *__ctl, int write,
void __user *buffer,
size_t *lenp, loff_t *ppos)
{
struct net *net = (struct net *)__ctl->extra1;
if (write) {
rt_cache_flush(net);
fnhe_genid_bump(net);
return 0;
}
return -EINVAL;
}
static struct ctl_table ipv4_route_table[] = {
{
.procname = "gc_thresh",
.data = &ipv4_dst_ops.gc_thresh,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec,
},
{
.procname = "max_size",
.data = &ip_rt_max_size,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec,
},
{
/* Deprecated. Use gc_min_interval_ms */
.procname = "gc_min_interval",
.data = &ip_rt_gc_min_interval,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec_jiffies,
},
{
.procname = "gc_min_interval_ms",
.data = &ip_rt_gc_min_interval,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec_ms_jiffies,
},
{
.procname = "gc_timeout",
.data = &ip_rt_gc_timeout,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec_jiffies,
},
{
.procname = "gc_interval",
.data = &ip_rt_gc_interval,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec_jiffies,
},
{
.procname = "redirect_load",
.data = &ip_rt_redirect_load,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec,
},
{
.procname = "redirect_number",
.data = &ip_rt_redirect_number,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec,
},
{
.procname = "redirect_silence",
.data = &ip_rt_redirect_silence,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec,
},
{
.procname = "error_cost",
.data = &ip_rt_error_cost,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec,
},
{
.procname = "error_burst",
.data = &ip_rt_error_burst,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec,
},
{
.procname = "gc_elasticity",
.data = &ip_rt_gc_elasticity,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec,
},
{
.procname = "mtu_expires",
.data = &ip_rt_mtu_expires,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec_jiffies,
},
{
.procname = "min_pmtu",
.data = &ip_rt_min_pmtu,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec,
},
{
.procname = "min_adv_mss",
.data = &ip_rt_min_advmss,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec,
},
{ }
};
static struct ctl_table ipv4_route_flush_table[] = {
{
.procname = "flush",
.maxlen = sizeof(int),
.mode = 0200,
.proc_handler = ipv4_sysctl_rtcache_flush,
},
{ },
};
static __net_init int sysctl_route_net_init(struct net *net)
{
struct ctl_table *tbl;
tbl = ipv4_route_flush_table;
if (!net_eq(net, &init_net)) {
tbl = kmemdup(tbl, sizeof(ipv4_route_flush_table), GFP_KERNEL);
if (tbl == NULL)
goto err_dup;
/* Don't export sysctls to unprivileged users */
if (net->user_ns != &init_user_ns)
tbl[0].procname = NULL;
}
tbl[0].extra1 = net;
net->ipv4.route_hdr = register_net_sysctl(net, "net/ipv4/route", tbl);
if (net->ipv4.route_hdr == NULL)
goto err_reg;
return 0;
err_reg:
if (tbl != ipv4_route_flush_table)
kfree(tbl);
err_dup:
return -ENOMEM;
}
static __net_exit void sysctl_route_net_exit(struct net *net)
{
struct ctl_table *tbl;
tbl = net->ipv4.route_hdr->ctl_table_arg;
unregister_net_sysctl_table(net->ipv4.route_hdr);
BUG_ON(tbl == ipv4_route_flush_table);
kfree(tbl);
}
static __net_initdata struct pernet_operations sysctl_route_ops = {
.init = sysctl_route_net_init,
.exit = sysctl_route_net_exit,
};
#endif
static __net_init int rt_genid_init(struct net *net)
{
atomic_set(&net->ipv4.rt_genid, 0);
atomic_set(&net->fnhe_genid, 0);
get_random_bytes(&net->ipv4.dev_addr_genid,
sizeof(net->ipv4.dev_addr_genid));
return 0;
}
static __net_initdata struct pernet_operations rt_genid_ops = {
.init = rt_genid_init,
};
static int __net_init ipv4_inetpeer_init(struct net *net)
{
struct inet_peer_base *bp = kmalloc(sizeof(*bp), GFP_KERNEL);
if (!bp)
return -ENOMEM;
inet_peer_base_init(bp);
net->ipv4.peers = bp;
return 0;
}
static void __net_exit ipv4_inetpeer_exit(struct net *net)
{
struct inet_peer_base *bp = net->ipv4.peers;
net->ipv4.peers = NULL;
inetpeer_invalidate_tree(bp);
kfree(bp);
}
static __net_initdata struct pernet_operations ipv4_inetpeer_ops = {
.init = ipv4_inetpeer_init,
.exit = ipv4_inetpeer_exit,
};
#ifdef CONFIG_IP_ROUTE_CLASSID
struct ip_rt_acct __percpu *ip_rt_acct __read_mostly;
#endif /* CONFIG_IP_ROUTE_CLASSID */
int __init ip_rt_init(void)
{
int rc = 0;
ip_idents = kmalloc(IP_IDENTS_SZ * sizeof(*ip_idents), GFP_KERNEL);
if (!ip_idents)
panic("IP: failed to allocate ip_idents\n");
prandom_bytes(ip_idents, IP_IDENTS_SZ * sizeof(*ip_idents));
#ifdef CONFIG_IP_ROUTE_CLASSID
ip_rt_acct = __alloc_percpu(256 * sizeof(struct ip_rt_acct), __alignof__(struct ip_rt_acct));
if (!ip_rt_acct)
panic("IP: failed to allocate ip_rt_acct\n");
#endif
ipv4_dst_ops.kmem_cachep =
kmem_cache_create("ip_dst_cache", sizeof(struct rtable), 0,
SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);
ipv4_dst_blackhole_ops.kmem_cachep = ipv4_dst_ops.kmem_cachep;
if (dst_entries_init(&ipv4_dst_ops) < 0)
panic("IP: failed to allocate ipv4_dst_ops counter\n");
if (dst_entries_init(&ipv4_dst_blackhole_ops) < 0)
panic("IP: failed to allocate ipv4_dst_blackhole_ops counter\n");
ipv4_dst_ops.gc_thresh = ~0;
ip_rt_max_size = INT_MAX;
devinet_init();
ip_fib_init();
if (ip_rt_proc_init())
pr_err("Unable to create route proc files\n");
#ifdef CONFIG_XFRM
xfrm_init();
xfrm4_init();
#endif
rtnl_register(PF_INET, RTM_GETROUTE, inet_rtm_getroute, NULL, NULL);
#ifdef CONFIG_SYSCTL
register_pernet_subsys(&sysctl_route_ops);
#endif
register_pernet_subsys(&rt_genid_ops);
register_pernet_subsys(&ipv4_inetpeer_ops);
return rc;
}
#ifdef CONFIG_SYSCTL
/*
* We really need to sanitize the damn ipv4 init order, then all
* this nonsense will go away.
*/
void __init ip_static_sysctl_init(void)
{
register_net_sysctl(&init_net, "net/ipv4/route", ipv4_route_table);
}
#endif
| Andiry/prd | net/ipv4/route.c | C | gpl-2.0 | 68,241 |
var utils = require('./connection_utils'),
inherits = require('util').inherits,
net = require('net'),
EventEmitter = require('events').EventEmitter,
inherits = require('util').inherits,
MongoReply = require("../responses/mongo_reply").MongoReply,
Connection = require("./connection").Connection;
var ConnectionPool = exports.ConnectionPool = function(host, port, poolSize, bson, socketOptions) {
if(typeof host !== 'string' || typeof port !== 'number') throw "host and port must be specified [" + host + ":" + port + "]";
// Set up event emitter
EventEmitter.call(this);
// Keep all options for the socket in a specific collection allowing the user to specify the
// Wished upon socket connection parameters
this.socketOptions = typeof socketOptions === 'object' ? socketOptions : {};
this.socketOptions.host = host;
this.socketOptions.port = port;
this.bson = bson;
// PoolSize is always + 1 for special reserved "measurment" socket (like ping, stats etc)
this.poolSize = poolSize;
this.minPoolSize = Math.floor(this.poolSize / 2) + 1;
// Set default settings for the socket options
utils.setIntegerParameter(this.socketOptions, 'timeout', 0);
// Delay before writing out the data to the server
utils.setBooleanParameter(this.socketOptions, 'noDelay', true);
// Delay before writing out the data to the server
utils.setIntegerParameter(this.socketOptions, 'keepAlive', 0);
// Set the encoding of the data read, default is binary == null
utils.setStringParameter(this.socketOptions, 'encoding', null);
// Allows you to set a throttling bufferSize if you need to stop overflows
utils.setIntegerParameter(this.socketOptions, 'bufferSize', 0);
// Internal structures
this.openConnections = [];
// Assign connection id's
this.connectionId = 0;
// Current index for selection of pool connection
this.currentConnectionIndex = 0;
// The pool state
this._poolState = 'disconnected';
// timeout control
this._timeout = false;
}
inherits(ConnectionPool, EventEmitter);
ConnectionPool.prototype.setMaxBsonSize = function(maxBsonSize) {
if(maxBsonSize == null){
maxBsonSize = Connection.DEFAULT_MAX_BSON_SIZE;
}
for(var i = 0; i < this.openConnections.length; i++) {
this.openConnections[i].maxBsonSize = maxBsonSize;
}
}
// Start a function
var _connect = function(_self) {
return new function() {
// Create a new connection instance
var connection = new Connection(_self.connectionId++, _self.socketOptions);
// Set logger on pool
connection.logger = _self.logger;
// Connect handler
connection.on("connect", function(err, connection) {
// Add connection to list of open connections
_self.openConnections.push(connection);
// If the number of open connections is equal to the poolSize signal ready pool
if(_self.openConnections.length === _self.poolSize && _self._poolState !== 'disconnected') {
// Set connected
_self._poolState = 'connected';
// Emit pool ready
_self.emit("poolReady");
} else if(_self.openConnections.length < _self.poolSize) {
// We need to open another connection, make sure it's in the next
// tick so we don't get a cascade of errors
process.nextTick(function() {
_connect(_self);
});
}
});
var numberOfErrors = 0
// Error handler
connection.on("error", function(err, connection) {
numberOfErrors++;
// If we are already disconnected ignore the event
if(_self._poolState != 'disconnected' && _self.listeners("error").length > 0) {
_self.emit("error", err);
}
// Set disconnected
_self._poolState = 'disconnected';
// Stop
_self.stop();
});
// Close handler
connection.on("close", function() {
// If we are already disconnected ignore the event
if(_self._poolState !== 'disconnected' && _self.listeners("close").length > 0) {
_self.emit("close");
}
// Set disconnected
_self._poolState = 'disconnected';
// Stop
_self.stop();
});
// Timeout handler
connection.on("timeout", function(err, connection) {
// If we are already disconnected ignore the event
if(_self._poolState !== 'disconnected' && _self.listeners("timeout").length > 0) {
_self.emit("timeout", err);
}
// Set disconnected
_self._poolState = 'disconnected';
// Stop
_self.stop();
});
// Parse error, needs a complete shutdown of the pool
connection.on("parseError", function() {
// If we are already disconnected ignore the event
if(_self._poolState !== 'disconnected' && _self.listeners("parseError").length > 0) {
_self.emit("parseError", new Error("parseError occured"));
}
_self.stop();
});
connection.on("message", function(message) {
_self.emit("message", message);
});
// Start connection in the next tick
connection.start();
}();
}
// Start method, will throw error if no listeners are available
// Pass in an instance of the listener that contains the api for
// finding callbacks for a given message etc.
ConnectionPool.prototype.start = function() {
var markerDate = new Date().getTime();
var self = this;
if(this.listeners("poolReady").length == 0) {
throw "pool must have at least one listener ready that responds to the [poolReady] event";
}
// Set pool state to connecting
this._poolState = 'connecting';
this._timeout = false;
_connect(self);
}
// Restart a connection pool (on a close the pool might be in a wrong state)
ConnectionPool.prototype.restart = function() {
// Close all connections
this.stop(false);
// Now restart the pool
this.start();
}
// Stop the connections in the pool
ConnectionPool.prototype.stop = function(removeListeners) {
removeListeners = removeListeners == null ? true : removeListeners;
// Set disconnected
this._poolState = 'disconnected';
// Clear all listeners if specified
if(removeListeners) {
this.removeAllEventListeners();
}
// Close all connections
for(var i = 0; i < this.openConnections.length; i++) {
this.openConnections[i].close();
}
// Clean up
this.openConnections = [];
}
// Check the status of the connection
ConnectionPool.prototype.isConnected = function() {
return this._poolState === 'connected';
}
// Checkout a connection from the pool for usage, or grab a specific pool instance
ConnectionPool.prototype.checkoutConnection = function(id) {
var index = (this.currentConnectionIndex++ % (this.openConnections.length));
var connection = this.openConnections[index];
return connection;
}
ConnectionPool.prototype.getAllConnections = function() {
return this.openConnections;
}
// Remove all non-needed event listeners
ConnectionPool.prototype.removeAllEventListeners = function() {
this.removeAllListeners("close");
this.removeAllListeners("error");
this.removeAllListeners("timeout");
this.removeAllListeners("connect");
this.removeAllListeners("end");
this.removeAllListeners("parseError");
this.removeAllListeners("message");
this.removeAllListeners("poolReady");
}
| cw0100/cwse | nodejs/node_modules/rrestjs/node_modules/mongodb/lib/mongodb/connection/connection_pool.js | JavaScript | gpl-2.0 | 7,246 |
//
// openhabMasterViewController.h
// openHAB iOS User Interface
// Copyright © 2011 Pablo Romeu
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#import <UIKit/UIKit.h>
#import "openhab.h"
@protocol splitMultipleDetailViews;
@interface openhabMasterViewController : UITableViewController <UISplitViewControllerDelegate>
{
UIPopoverController *thePopover;
UIBarButtonItem*theButton;
}
// Everything for the splitMultipleDetailViews
@property (strong, nonatomic) UIViewController <splitMultipleDetailViews> *detailViewController;
@property (strong,nonatomic) UIPopoverController *thePopover;
@property (strong,nonatomic) UIBarButtonItem*theButton;
@end
@protocol splitMultipleDetailViews
-(void)showButton:(UIBarButtonItem*)button pop:(UIPopoverController*)popover;
-(void)hideButton:(UIBarButtonItem*)button;
@end | hektiker1983/openhab.ios | openhab/openhabMasterViewController.h | C | gpl-3.0 | 1,440 |
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Mvc;
using SmartStore.Core.Domain.Tasks;
namespace SmartStore.Core.Events
{
/// <summary>
/// to initialize scheduled tasks in Application_Start
/// </summary>
public class AppInitScheduledTasksEvent
{
public IList<ScheduleTask> ScheduledTasks { get; set; }
}
}
| ibindura/SmartStoreNET | src/Libraries/SmartStore.Core/Events/CommonMessages/AppInitScheduledTasksEvent.cs | C# | gpl-3.0 | 357 |
#include <iostream>
#include <seqan/stream.h>
using namespace seqan;
int main(int argc, char const ** argv)
{
if (argc != 2)
{
std::cerr << "USAGE: tutorial_solution1 VALUE\n";
return 1;
}
// Lexical casting with the 1-argument lexicalCast().
{
int i = 0;
unsigned u = 0;
double d = 0;
try
{
d = lexicalCast<double>(argv[1]);
i = lexicalCast<int>(argv[1]);
u = lexicalCast<unsigned>(argv[1]);
}
catch (BadLexicalCast & e)
{
std::cerr << e.what() << std::endl;
}
std::cout << "lexicalCast<int>(" << argv[1] << ") == " << i << '\n';
std::cout << "lexicalCast<unsinged>(" << argv[1] << ") == " << u << '\n';
std::cout << "lexicalCast<double>(" << argv[1] << ") == " << d << '\n';
}
// Lexical casting with the 2-argument lexicalCast().
{
int i = 0;
unsigned u = 0;
double d = 0;
bool bi = lexicalCast(i, argv[1]);
bool bu = lexicalCast(u, argv[1]);
bool bd = lexicalCast(d, argv[1]);
std::cout << "lexicalCast2<int>(" << argv[1] << ") == (" << bi << ", " << i << ")\n";
std::cout << "lexicalCast2<unsigned>(" << argv[1] << ") == (" << bu << ", " << u << ")\n";
std::cout << "lexicalCast2<double>(" << argv[1] << ") == (" << bd << ", " << d << ")\n";
}
// Lexical casting with the 2-argument lexicalCast() that throws exceptions.
{
int i = 0;
unsigned u = 0;
double d = 0;
try
{
lexicalCastWithException(d, argv[1]);
lexicalCastWithException(i, argv[1]);
lexicalCastWithException(u, argv[1]);
}
catch (BadLexicalCast & e)
{
std::cerr << e.what() << std::endl;
}
std::cout << "lexicalCast2<int>(" << argv[1] << ") == (" << i << ")\n";
std::cout << "lexicalCast2<unsigned>(" << argv[1] << ") == (" << u << ")\n";
std::cout << "lexicalCast2<double>(" << argv[1] << ") == (" << d << ")\n";
}
return 0;
}
| rrahn/jst_bench | include/seqan/demos/tutorial/custom_io/solution4.cpp | C++ | gpl-3.0 | 2,177 |
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/device.h>
#include <linux/kdev_t.h>
#include <linux/fs.h>
#include <linux/cdev.h>
#include <linux/platform_device.h>
#include <linux/dma-mapping.h>
#include <linux/mm_types.h>
#include <linux/mm.h>
#include <linux/jiffies.h>
#include <linux/sched.h>
#include <asm/uaccess.h>
#include <asm/page.h>
#include <linux/vmalloc.h>
#include <linux/interrupt.h>
#include <mach/irqs.h>
//#include <mach/x_define_irq.h>
#include <linux/wait.h>
#include <linux/proc_fs.h>
#include <linux/semaphore.h>
#include <mach/dma.h>
#include <linux/delay.h>
#include "mach/sync_write.h"
//#include "mach/mt_reg_base.h"
#if !defined(CONFIG_MTK_LEGACY)
#include <linux/clk.h>
#else /* defined(CONFIG_MTK_LEGACY) */
#include "mach/mt_clkmgr.h"
#endif /* !defined(CONFIG_MTK_LEGACY) */
#ifdef CONFIG_MTK_HIBERNATION
#include "mach/mtk_hibernate_dpm.h"
#endif
#include "videocodec_kernel_driver.h"
#include <asm/cacheflush.h>
#include <asm/io.h>
#include <asm/sizes.h>
#include "val_types_private.h"
#include "hal_types_private.h"
#include "val_api_private.h"
#include "val_log.h"
#include "drv_api.h"
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#if IS_ENABLED(CONFIG_COMPAT)
#include <linux/uaccess.h>
#include <linux/compat.h>
#endif
#define ENABLE_MMDVFS_VDEC
#ifdef ENABLE_MMDVFS_VDEC
// <--- MM DVFS related
#include <mt_smi.h>
#define DROP_PERCENTAGE 50
#define RAISE_PERCENTAGE 90
#define MONITOR_DURATION_MS 4000
#define DVFS_LOW MMDVFS_VOLTAGE_LOW
#define DVFS_HIGH MMDVFS_VOLTAGE_HIGH
#define DVFS_DEFAULT MMDVFS_VOLTAGE_HIGH
#define MONITOR_START_MINUS_1 0
#define SW_OVERHEAD_MS 1
static VAL_BOOL_T gMMDFVFSMonitorStarts = VAL_FALSE;
static VAL_BOOL_T gFirstDvfsLock = VAL_FALSE;
static VAL_UINT32_T gMMDFVFSMonitorCounts = 0;
static VAL_TIME_T gMMDFVFSMonitorStartTime;
static VAL_TIME_T gMMDFVFSLastLockTime;
static VAL_TIME_T gMMDFVFSMonitorEndTime;
static VAL_UINT32_T gHWLockInterval = 0;
static VAL_INT32_T gHWLockMaxDuration = 0;
VAL_UINT32_T TimeDiffMs(VAL_TIME_T timeOld, VAL_TIME_T timeNew)
{
//MFV_LOGE ("@@ timeOld(%d, %d), timeNew(%d, %d)", timeOld.u4Sec, timeOld.u4uSec, timeNew.u4Sec, timeNew.u4uSec);
return (((((timeNew.u4Sec - timeOld.u4Sec) * 1000000) + timeNew.u4uSec) - timeOld.u4uSec) / 1000);
}
// raise/drop voltage
void SendDvfsRequest(int level)
{
int ret = 0;
if (level == MMDVFS_VOLTAGE_LOW)
{
MFV_LOGE("[VCODEC][MMDVFS_VDEC] SendDvfsRequest(MMDVFS_VOLTAGE_LOW)");
#if defined(CONFIG_MTK_LEGACY)
clkmux_sel(MT_MUX_VDEC, 3, "MMDVFS_VOLTAGE_LOW"); // 136.5MHz
#else // #if !defined(CONFIG_MTK_LEGACY)
// [ToDo]
#endif // #if defined(CONFIG_MTK_LEGACY)
ret = mmdvfs_set_step(SMI_BWC_SCEN_VP, MMDVFS_VOLTAGE_LOW);
}
else if (level == MMDVFS_VOLTAGE_HIGH)
{
MFV_LOGE("[VCODEC][MMDVFS_VDEC] SendDvfsRequest(MMDVFS_VOLTAGE_HIGH)");
ret = mmdvfs_set_step(SMI_BWC_SCEN_VP, MMDVFS_VOLTAGE_HIGH);
#if defined(CONFIG_MTK_LEGACY)
clkmux_sel(MT_MUX_VDEC, 1, "MMDVFS_VOLTAGE_HIGH"); // 273MHz
#else // #if !defined(CONFIG_MTK_LEGACY)
// [ToDo]
#endif // #if defined(CONFIG_MTK_LEGACY)
}
else
{
MFV_LOGE("[VCODEC][MMDVFS_VDEC] @@ OOPS: level = %d\n", level);
}
if (0 != ret)
{
MFV_LOGE("[VCODEC][MMDVFS_VDEC] @@ OOPS: mmdvfs_set_step error!");
}
}
void VdecDvfsBegin(void)
{
gMMDFVFSMonitorStarts = VAL_TRUE;
gMMDFVFSMonitorCounts = 0;
gHWLockInterval = 0;
gFirstDvfsLock = VAL_TRUE;
gHWLockMaxDuration = 0;
MFV_LOGE("[VCODEC][MMDVFS_VDEC] @@ VdecDvfsBegin");
//eVideoGetTimeOfDay(&gMMDFVFSMonitorStartTime, sizeof(VAL_TIME_T));
}
VAL_UINT32_T VdecDvfsGetMonitorDuration(void)
{
eVideoGetTimeOfDay(&gMMDFVFSMonitorEndTime, sizeof(VAL_TIME_T));
return TimeDiffMs(gMMDFVFSMonitorStartTime, gMMDFVFSMonitorEndTime);
}
void VdecDvfsEnd(int level)
{
MFV_LOGE("[VCODEC][MMDVFS_VDEC] @@ VdecDVFS monitor %dms, decoded %d frames, total time %d, max duration %d, target lv %d",
MONITOR_DURATION_MS, gMMDFVFSMonitorCounts, gHWLockInterval, gHWLockMaxDuration, level);
gMMDFVFSMonitorStarts = VAL_FALSE;
gMMDFVFSMonitorCounts = 0;
gHWLockInterval = 0;
gHWLockMaxDuration = 0;
}
VAL_UINT32_T VdecDvfsStep(void)
{
VAL_TIME_T _now;
VAL_UINT32_T _diff = 0;
eVideoGetTimeOfDay(&_now, sizeof(VAL_TIME_T));
_diff = TimeDiffMs(gMMDFVFSLastLockTime, _now);
if (_diff > gHWLockMaxDuration)
{
gHWLockMaxDuration = _diff;
}
gHWLockInterval += (_diff + SW_OVERHEAD_MS);
return _diff;
}
// --->
#endif
#define VDO_HW_WRITE(ptr,data) mt_reg_sync_writel(data,ptr)
#define VDO_HW_READ(ptr) (*((volatile unsigned int * const)(ptr)))
#define VCODEC_DEVNAME "Vcodec"
#define VCODEC_DEV_MAJOR_NUMBER 160 //189
//#define VENC_USE_L2C
static dev_t vcodec_devno = MKDEV(VCODEC_DEV_MAJOR_NUMBER, 0);
static struct cdev *vcodec_cdev;
static struct class *vcodec_class = NULL;
static struct device *vcodec_device = NULL;
#if !defined(CONFIG_MTK_LEGACY)
static struct clk *clk_MT_CG_DISP0_SMI_COMMON; /* MM_DISP0_SMI_COMMON */
static struct clk *clk_MT_CG_VDEC0_VDEC; /* VDEC0_VDEC */
static struct clk *clk_MT_CG_VDEC1_LARB; /* VDEC1_LARB */
static struct clk *clk_MT_CG_VENC_VENC; /* VENC_VENC */
static struct clk *clk_MT_CG_VENC_LARB; /* VENC_LARB */
#endif /* !defined(CONFIG_MTK_LEGACY) */
static DEFINE_MUTEX(IsOpenedLock);
static DEFINE_MUTEX(PWRLock);
static DEFINE_MUTEX(VdecHWLock);
static DEFINE_MUTEX(VencHWLock);
static DEFINE_MUTEX(EncEMILock);
static DEFINE_MUTEX(L2CLock);
static DEFINE_MUTEX(DecEMILock);
static DEFINE_MUTEX(DriverOpenCountLock);
static DEFINE_MUTEX(DecHWLockEventTimeoutLock);
static DEFINE_MUTEX(EncHWLockEventTimeoutLock);
static DEFINE_MUTEX(VdecPWRLock);
static DEFINE_MUTEX(VencPWRLock);
static DEFINE_SPINLOCK(DecIsrLock);
static DEFINE_SPINLOCK(EncIsrLock);
static DEFINE_SPINLOCK(LockDecHWCountLock);
static DEFINE_SPINLOCK(LockEncHWCountLock);
static DEFINE_SPINLOCK(DecISRCountLock);
static DEFINE_SPINLOCK(EncISRCountLock);
static VAL_EVENT_T DecHWLockEvent; //mutex : HWLockEventTimeoutLock
static VAL_EVENT_T EncHWLockEvent; //mutex : HWLockEventTimeoutLock
static VAL_EVENT_T DecIsrEvent; //mutex : HWLockEventTimeoutLock
static VAL_EVENT_T EncIsrEvent; //mutex : HWLockEventTimeoutLock
static VAL_INT32_T Driver_Open_Count; //mutex : DriverOpenCountLock
static VAL_UINT32_T gu4PWRCounter = 0; //mutex : PWRLock
static VAL_UINT32_T gu4EncEMICounter = 0; //mutex : EncEMILock
static VAL_UINT32_T gu4DecEMICounter = 0; //mutex : DecEMILock
static VAL_UINT32_T gu4L2CCounter = 0; //mutex : L2CLock
static VAL_BOOL_T bIsOpened = VAL_FALSE; //mutex : IsOpenedLock
static VAL_UINT32_T gu4HwVencIrqStatus = 0; //hardware VENC IRQ status (VP8/H264)
static VAL_UINT32_T gu4VdecPWRCounter = 0; //mutex : VdecPWRLock
static VAL_UINT32_T gu4VencPWRCounter = 0; //mutex : VencPWRLock
static VAL_UINT32_T gLockTimeOutCount = 0;
static VAL_UINT32_T gu4VdecLockThreadId = 0;
//#define VCODEC_DEBUG
#ifdef VCODEC_DEBUG
#undef VCODEC_DEBUG
#define VCODEC_DEBUG MFV_LOGE
#undef MFV_LOGD
#define MFV_LOGD MFV_LOGE
#else
#define VCODEC_DEBUG(...)
#undef MFV_LOGD
#define MFV_LOGD(...)
#endif
// VENC physical base address
#undef VENC_BASE
#define VENC_BASE 0x17002000
#define VENC_REGION 0x1000
// VDEC virtual base address
#define VDEC_BASE_PHY 0x16000000
#define VDEC_REGION 0x29000
#define HW_BASE 0x7FFF000
#define HW_REGION 0x2000
#define INFO_BASE 0x10000000
#define INFO_REGION 0x1000
#if 0
#define VENC_IRQ_STATUS_addr VENC_BASE + 0x05C
#define VENC_IRQ_ACK_addr VENC_BASE + 0x060
#define VENC_MP4_IRQ_ACK_addr VENC_BASE + 0x678
#define VENC_MP4_IRQ_STATUS_addr VENC_BASE + 0x67C
#define VENC_ZERO_COEF_COUNT_addr VENC_BASE + 0x688
#define VENC_BYTE_COUNT_addr VENC_BASE + 0x680
#define VENC_MP4_IRQ_ENABLE_addr VENC_BASE + 0x668
#define VENC_MP4_STATUS_addr VENC_BASE + 0x664
#define VENC_MP4_MVQP_STATUS_addr VENC_BASE + 0x6E4
#endif
#define VENC_IRQ_STATUS_SPS 0x1
#define VENC_IRQ_STATUS_PPS 0x2
#define VENC_IRQ_STATUS_FRM 0x4
#define VENC_IRQ_STATUS_DRAM 0x8
#define VENC_IRQ_STATUS_PAUSE 0x10
#define VENC_IRQ_STATUS_SWITCH 0x20
//#define VENC_PWR_FPGA
// Cheng-Jung 20120621 VENC power physical base address (FPGA only, should use API) [
#ifdef VENC_PWR_FPGA
#define CLK_CFG_0_addr 0x10000140
#define CLK_CFG_4_addr 0x10000150
#define VENC_PWR_addr 0x10006230
#define VENCSYS_CG_SET_addr 0x15000004
#define PWR_ONS_1_D 3
#define PWR_CKD_1_D 4
#define PWR_ONN_1_D 2
#define PWR_ISO_1_D 1
#define PWR_RST_0_D 0
#define PWR_ON_SEQ_0 ((0x1 << PWR_ONS_1_D) | (0x1 << PWR_CKD_1_D) | (0x1 << PWR_ONN_1_D) | (0x1 << PWR_ISO_1_D) | (0x0 << PWR_RST_0_D))
#define PWR_ON_SEQ_1 ((0x1 << PWR_ONS_1_D) | (0x0 << PWR_CKD_1_D) | (0x1 << PWR_ONN_1_D) | (0x1 << PWR_ISO_1_D) | (0x0 << PWR_RST_0_D))
#define PWR_ON_SEQ_2 ((0x1 << PWR_ONS_1_D) | (0x0 << PWR_CKD_1_D) | (0x1 << PWR_ONN_1_D) | (0x0 << PWR_ISO_1_D) | (0x0 << PWR_RST_0_D))
#define PWR_ON_SEQ_3 ((0x1 << PWR_ONS_1_D) | (0x0 << PWR_CKD_1_D) | (0x1 << PWR_ONN_1_D) | (0x0 << PWR_ISO_1_D) | (0x1 << PWR_RST_0_D))
// ]
#endif
#if 0
// VDEC virtual base address
#define VDEC_MISC_BASE VDEC_BASE + 0x0000
#define VDEC_VLD_BASE VDEC_BASE + 0x1000
#endif
VAL_ULONG_T KVA_VENC_IRQ_ACK_ADDR, KVA_VENC_IRQ_STATUS_ADDR, KVA_VENC_BASE;
VAL_ULONG_T KVA_VDEC_MISC_BASE, KVA_VDEC_VLD_BASE, KVA_VDEC_BASE, KVA_VDEC_GCON_BASE;
VAL_UINT32_T VENC_IRQ_ID, VDEC_IRQ_ID;
#ifdef VENC_PWR_FPGA
// Cheng-Jung 20120621 VENC power physical base address (FPGA only, should use API) [
VAL_ULONG_T KVA_VENC_CLK_CFG_0_ADDR, KVA_VENC_CLK_CFG_4_ADDR, KVA_VENC_PWR_ADDR, KVA_VENCSYS_CG_SET_ADDR;
// ]
#endif
extern unsigned long pmem_user_v2p_video(unsigned long va);
#if defined(VENC_USE_L2C)
extern int config_L2(int option);
#endif
void vdec_power_on(void)
{
int ret;
mutex_lock(&VdecPWRLock);
gu4VdecPWRCounter++;
mutex_unlock(&VdecPWRLock);
#if defined(CONFIG_MTK_LEGACY)
// Central power on
enable_clock(MT_CG_DISP0_SMI_COMMON, "VDEC");
enable_clock(MT_CG_VDEC0_VDEC, "VDEC");
enable_clock(MT_CG_VDEC1_LARB, "VDEC");
#ifdef VDEC_USE_L2C
//enable_clock(MT_CG_INFRA_L2C_SRAM, "VDEC");
#endif
#else //#if !defined(CONFIG_MTK_LEGACY)
ret = clk_prepare_enable(clk_MT_CG_DISP0_SMI_COMMON);
if (ret)
{
// print error log & error handling
MFV_LOGE("[VCODEC][ERROR][vdec_power_on] clk_MT_CG_DISP0_SMI_COMMON is not enabled, ret = %d\n", ret);
}
ret = clk_prepare_enable(clk_MT_CG_VDEC0_VDEC);
if (ret)
{
// print error log & error handling
MFV_LOGE("[VCODEC][ERROR][vdec_power_on] clk_MT_CG_VDEC0_VDEC is not enabled, ret = %d\n", ret);
}
ret = clk_prepare_enable(clk_MT_CG_VDEC1_LARB);
if (ret)
{
// print error log & error handling
MFV_LOGE("[VCODEC][ERROR][vdec_power_on] clk_MT_CG_VDEC1_LARB is not enabled, ret = %d\n", ret);
}
#endif //#if defined(CONFIG_MTK_LEGACY)
}
void vdec_power_off(void)
{
mutex_lock(&VdecPWRLock);
if (gu4VdecPWRCounter == 0)
{
}
else
{
gu4VdecPWRCounter--;
#if defined(CONFIG_MTK_LEGACY)
// Central power off
disable_clock(MT_CG_VDEC0_VDEC, "VDEC");
disable_clock(MT_CG_VDEC1_LARB, "VDEC");
disable_clock(MT_CG_DISP0_SMI_COMMON, "VDEC");
#ifdef VDEC_USE_L2C
//disable_clock(MT_CG_INFRA_L2C_SRAM, "VDEC");
#endif
#else //#if !defined(CONFIG_MTK_LEGACY)
clk_disable_unprepare(clk_MT_CG_VDEC1_LARB);
clk_disable_unprepare(clk_MT_CG_VDEC0_VDEC);
clk_disable_unprepare(clk_MT_CG_DISP0_SMI_COMMON);
#endif //#if defined(CONFIG_MTK_LEGACY)
}
mutex_unlock(&VdecPWRLock);
}
void venc_power_on(void)
{
int ret;
mutex_lock(&VencPWRLock);
gu4VencPWRCounter++;
mutex_unlock(&VencPWRLock);
MFV_LOGD("[VCODEC] venc_power_on +\n");
#if defined(CONFIG_MTK_LEGACY)
enable_clock(MT_CG_DISP0_SMI_COMMON, "VENC");
enable_clock(MT_CG_VENC_VENC, "VENC");
enable_clock(MT_CG_VENC_LARB , "VENC");
#ifdef VENC_USE_L2C
enable_clock(MT_CG_INFRA_L2C_SRAM, "VENC");
#endif
#else //#if !defined(CONFIG_MTK_LEGACY)
ret = clk_prepare_enable(clk_MT_CG_DISP0_SMI_COMMON);
if (ret)
{
// print error log & error handling
MFV_LOGE("[VCODEC][ERROR][venc_power_on] clk_MT_CG_DISP0_SMI_COMMON is not enabled, ret = %d\n", ret);
}
ret = clk_prepare_enable(clk_MT_CG_VENC_VENC);
if (ret)
{
// print error log & error handling
MFV_LOGE("[VCODEC][ERROR][venc_power_on] clk_MT_CG_VENC_VENC is not enabled, ret = %d\n", ret);
}
ret = clk_prepare_enable(clk_MT_CG_VENC_LARB);
if (ret)
{
// print error log & error handling
MFV_LOGE("[VCODEC][ERROR][venc_power_on] clk_MT_CG_VENC_LARB is not enabled, ret = %d\n", ret);
}
#endif //#if defined(CONFIG_MTK_LEGACY)
MFV_LOGD("[VCODEC] venc_power_on -\n");
}
void venc_power_off(void)
{
mutex_lock(&VencPWRLock);
if (gu4VencPWRCounter == 0)
{
}
else
{
gu4VencPWRCounter--;
MFV_LOGD("[VCODEC] venc_power_off +\n");
#if defined(CONFIG_MTK_LEGACY)
disable_clock(MT_CG_VENC_VENC, "VENC");
disable_clock(MT_CG_VENC_LARB, "VENC");
disable_clock(MT_CG_DISP0_SMI_COMMON, "VENC");
#ifdef VENC_USE_L2C
disable_clock(MT_CG_INFRA_L2C_SRAM, "VENC");
#endif
#else //#if !defined(CONFIG_MTK_LEGACY)
clk_disable_unprepare(clk_MT_CG_VENC_LARB);
clk_disable_unprepare(clk_MT_CG_VENC_VENC);
clk_disable_unprepare(clk_MT_CG_DISP0_SMI_COMMON);
#endif //#if defined(CONFIG_MTK_LEGACY)
MFV_LOGD("[VCODEC] venc_power_off -\n");
}
mutex_unlock(&VencPWRLock);
}
void dec_isr(void)
{
VAL_RESULT_T eValRet;
VAL_ULONG_T ulFlags, ulFlagsISR, ulFlagsLockHW;
VAL_UINT32_T u4TempDecISRCount = 0;
VAL_UINT32_T u4TempLockDecHWCount = 0;
VAL_UINT32_T u4CgStatus = 0;
VAL_UINT32_T u4DecDoneStatus = 0;
u4CgStatus = VDO_HW_READ(KVA_VDEC_GCON_BASE);
if ((u4CgStatus & 0x10) != 0)
{
MFV_LOGE("[VCODEC][ERROR] DEC ISR, VDEC active is not 0x0 (0x%08x)", u4CgStatus);
return;
}
u4DecDoneStatus = VDO_HW_READ(KVA_VDEC_BASE + 0xA4);
if ((u4DecDoneStatus & (0x1 << 16)) != 0x10000)
{
MFV_LOGE("[VCODEC][ERROR] DEC ISR, Decode done status is not 0x1 (0x%08x)", u4DecDoneStatus);
return;
}
spin_lock_irqsave(&DecISRCountLock, ulFlagsISR);
gu4DecISRCount++;
u4TempDecISRCount = gu4DecISRCount;
spin_unlock_irqrestore(&DecISRCountLock, ulFlagsISR);
spin_lock_irqsave(&LockDecHWCountLock, ulFlagsLockHW);
u4TempLockDecHWCount = gu4LockDecHWCount;
spin_unlock_irqrestore(&LockDecHWCountLock, ulFlagsLockHW);
if (u4TempDecISRCount != u4TempLockDecHWCount)
{
//MFV_LOGE("[INFO] Dec ISRCount: 0x%x, LockHWCount:0x%x\n", u4TempDecISRCount, u4TempLockDecHWCount);
}
// Clear interrupt
VDO_HW_WRITE(KVA_VDEC_MISC_BASE + 41 * 4, VDO_HW_READ(KVA_VDEC_MISC_BASE + 41 * 4) | 0x11);
VDO_HW_WRITE(KVA_VDEC_MISC_BASE + 41 * 4, VDO_HW_READ(KVA_VDEC_MISC_BASE + 41 * 4) & ~0x10);
spin_lock_irqsave(&DecIsrLock, ulFlags);
eValRet = eVideoSetEvent(&DecIsrEvent, sizeof(VAL_EVENT_T));
if (VAL_RESULT_NO_ERROR != eValRet)
{
MFV_LOGE("[VCODEC][ERROR] ISR set DecIsrEvent error\n");
}
spin_unlock_irqrestore(&DecIsrLock, ulFlags);
return;
}
void enc_isr(void)
{
VAL_RESULT_T eValRet;
VAL_ULONG_T ulFlagsISR, ulFlagsLockHW;
VAL_UINT32_T u4TempEncISRCount = 0;
VAL_UINT32_T u4TempLockEncHWCount = 0;
//----------------------
spin_lock_irqsave(&EncISRCountLock, ulFlagsISR);
gu4EncISRCount++;
u4TempEncISRCount = gu4EncISRCount;
spin_unlock_irqrestore(&EncISRCountLock, ulFlagsISR);
spin_lock_irqsave(&LockEncHWCountLock, ulFlagsLockHW);
u4TempLockEncHWCount = gu4LockEncHWCount;
spin_unlock_irqrestore(&LockEncHWCountLock, ulFlagsLockHW);
if (u4TempEncISRCount != u4TempLockEncHWCount)
{
//MFV_LOGE("[INFO] Enc ISRCount: 0x%x, LockHWCount:0x%x\n", u4TempEncISRCount, u4TempLockEncHWCount);
}
if (grVcodecEncHWLock.pvHandle == 0)
{
MFV_LOGE("[VCODEC][ERROR] NO one Lock Enc HW, please check!!\n");
// Clear all status
//VDO_HW_WRITE(KVA_VENC_MP4_IRQ_ACK_ADDR, 1);
VDO_HW_WRITE(KVA_VENC_IRQ_ACK_ADDR, VENC_IRQ_STATUS_PAUSE);
//VDO_HW_WRITE(KVA_VENC_IRQ_ACK_ADDR, VENC_IRQ_STATUS_DRAM_VP8);
VDO_HW_WRITE(KVA_VENC_IRQ_ACK_ADDR, VENC_IRQ_STATUS_SWITCH);
VDO_HW_WRITE(KVA_VENC_IRQ_ACK_ADDR, VENC_IRQ_STATUS_DRAM);
VDO_HW_WRITE(KVA_VENC_IRQ_ACK_ADDR, VENC_IRQ_STATUS_SPS);
VDO_HW_WRITE(KVA_VENC_IRQ_ACK_ADDR, VENC_IRQ_STATUS_PPS);
VDO_HW_WRITE(KVA_VENC_IRQ_ACK_ADDR, VENC_IRQ_STATUS_FRM);
return;
}
if (grVcodecEncHWLock.eDriverType == VAL_DRIVER_TYPE_H264_ENC) // hardwire
{
gu4HwVencIrqStatus = VDO_HW_READ(KVA_VENC_IRQ_STATUS_ADDR);
if (gu4HwVencIrqStatus & VENC_IRQ_STATUS_PAUSE)
{
VDO_HW_WRITE(KVA_VENC_IRQ_ACK_ADDR, VENC_IRQ_STATUS_PAUSE);
}
if (gu4HwVencIrqStatus & VENC_IRQ_STATUS_SWITCH)
{
VDO_HW_WRITE(KVA_VENC_IRQ_ACK_ADDR, VENC_IRQ_STATUS_SWITCH);
}
if (gu4HwVencIrqStatus & VENC_IRQ_STATUS_DRAM)
{
VDO_HW_WRITE(KVA_VENC_IRQ_ACK_ADDR, VENC_IRQ_STATUS_DRAM);
}
if (gu4HwVencIrqStatus & VENC_IRQ_STATUS_SPS)
{
VDO_HW_WRITE(KVA_VENC_IRQ_ACK_ADDR, VENC_IRQ_STATUS_SPS);
}
if (gu4HwVencIrqStatus & VENC_IRQ_STATUS_PPS)
{
VDO_HW_WRITE(KVA_VENC_IRQ_ACK_ADDR, VENC_IRQ_STATUS_PPS);
}
if (gu4HwVencIrqStatus & VENC_IRQ_STATUS_FRM)
{
VDO_HW_WRITE(KVA_VENC_IRQ_ACK_ADDR, VENC_IRQ_STATUS_FRM);
}
}
else if (grVcodecEncHWLock.eDriverType == VAL_DRIVER_TYPE_HEVC_ENC) // hardwire
{
MFV_LOGE("[VCODEC][enc_isr] VAL_DRIVER_TYPE_HEVC_ENC!!\n");
}
else
{
MFV_LOGE("[VCODEC][ERROR] Invalid lock holder driver type = %d\n", grVcodecEncHWLock.eDriverType);
}
eValRet = eVideoSetEvent(&EncIsrEvent, sizeof(VAL_EVENT_T));
if (VAL_RESULT_NO_ERROR != eValRet)
{
MFV_LOGE("[VCODEC][ERROR] ISR set EncIsrEvent error\n");
}
}
static irqreturn_t video_intr_dlr(int irq, void *dev_id)
{
dec_isr();
return IRQ_HANDLED;
}
static irqreturn_t video_intr_dlr2(int irq, void *dev_id)
{
enc_isr();
return IRQ_HANDLED;
}
static long vcodec_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
VAL_LONG_T ret;
VAL_UINT8_T *user_data_addr;
VAL_RESULT_T eValRet;
VAL_ULONG_T ulFlags, ulFlagsLockHW;
VAL_HW_LOCK_T rHWLock;
VAL_BOOL_T bLockedHW = VAL_FALSE;
VAL_UINT32_T FirstUseDecHW = 0;
VAL_UINT32_T FirstUseEncHW = 0;
VAL_TIME_T rCurTime;
VAL_UINT32_T u4TimeInterval;
VAL_ISR_T val_isr;
VAL_VCODEC_CORE_LOADING_T rTempCoreLoading;
VAL_VCODEC_CPU_OPP_LIMIT_T rCpuOppLimit;
VAL_INT32_T temp_nr_cpu_ids;
VAL_POWER_T rPowerParam;
VAL_MEMORY_T rTempMem;
#ifdef ENABLE_MMDVFS_VDEC
VAL_UINT32_T _monitor_duration = 0;
VAL_UINT32_T _diff = 0;
VAL_UINT32_T _perc = 0;
#endif
#if 0
VCODEC_DRV_CMD_QUEUE_T rDrvCmdQueue;
P_VCODEC_DRV_CMD_T cmd_queue = VAL_NULL;
VAL_UINT32_T u4Size, uValue, nCount;
#endif
switch (cmd)
{
case VCODEC_SET_THREAD_ID:
{
MFV_LOGE("VCODEC_SET_THREAD_ID [EMPTY] + tid = %d\n", current->pid);
MFV_LOGE("VCODEC_SET_THREAD_ID [EMPTY] - tid = %d\n", current->pid);
}
break;
case VCODEC_ALLOC_NON_CACHE_BUFFER:
{
MFV_LOGE("VCODEC_ALLOC_NON_CACHE_BUFFER + tid = %d\n", current->pid);
user_data_addr = (VAL_UINT8_T *)arg;
ret = copy_from_user(&rTempMem, user_data_addr, sizeof(VAL_MEMORY_T));
if (ret)
{
MFV_LOGE("[ERROR] VCODEC_ALLOC_NON_CACHE_BUFFER, copy_from_user failed: %lu\n", ret);
return -EFAULT;
}
rTempMem.u4ReservedSize /*kernel va*/ = (VAL_ULONG_T)dma_alloc_coherent(0, rTempMem.u4MemSize, (dma_addr_t *)&rTempMem.pvMemPa, GFP_KERNEL);
if ((0 == rTempMem.u4ReservedSize) || (0 == rTempMem.pvMemPa))
{
MFV_LOGE("[ERROR] dma_alloc_coherent fail in VCODEC_ALLOC_NON_CACHE_BUFFER\n");
return -EFAULT;
}
MFV_LOGD("[VCODEC] kernel va = 0x%lx, kernel pa = 0x%lx, memory size = %lu\n",
(VAL_ULONG_T)rTempMem.u4ReservedSize, (VAL_ULONG_T)rTempMem.pvMemPa, (VAL_ULONG_T)rTempMem.u4MemSize);
//mutex_lock(&NonCacheMemoryListLock);
//Add_NonCacheMemoryList(rTempMem.u4ReservedSize, (VAL_UINT32_T)rTempMem.pvMemPa, (VAL_UINT32_T)rTempMem.u4MemSize, 0, 0);
//mutex_unlock(&NonCacheMemoryListLock);
ret = copy_to_user(user_data_addr, &rTempMem, sizeof(VAL_MEMORY_T));
if (ret)
{
MFV_LOGE("[ERROR] VCODEC_ALLOC_NON_CACHE_BUFFER, copy_to_user failed: %lu\n", ret);
return -EFAULT;
}
MFV_LOGE("VCODEC_ALLOC_NON_CACHE_BUFFER - tid = %d\n", current->pid);
}
break;
case VCODEC_FREE_NON_CACHE_BUFFER:
{
MFV_LOGE("VCODEC_FREE_NON_CACHE_BUFFER + tid = %d\n", current->pid);
user_data_addr = (VAL_UINT8_T *)arg;
ret = copy_from_user(&rTempMem, user_data_addr, sizeof(VAL_MEMORY_T));
if (ret)
{
MFV_LOGE("[ERROR] VCODEC_FREE_NON_CACHE_BUFFER, copy_from_user failed: %lu\n", ret);
return -EFAULT;
}
dma_free_coherent(0, rTempMem.u4MemSize, (void *)rTempMem.u4ReservedSize, (dma_addr_t)rTempMem.pvMemPa);
//mutex_lock(&NonCacheMemoryListLock);
//Free_NonCacheMemoryList(rTempMem.u4ReservedSize, (VAL_UINT32_T)rTempMem.pvMemPa);
//mutex_unlock(&NonCacheMemoryListLock);
rTempMem.u4ReservedSize = 0;
rTempMem.pvMemPa = NULL;
ret = copy_to_user(user_data_addr, &rTempMem, sizeof(VAL_MEMORY_T));
if (ret)
{
MFV_LOGE("[ERROR] VCODEC_FREE_NON_CACHE_BUFFER, copy_to_user failed: %lu\n", ret);
return -EFAULT;
}
MFV_LOGE("VCODEC_FREE_NON_CACHE_BUFFER - tid = %d\n", current->pid);
}
break;
case VCODEC_INC_DEC_EMI_USER:
{
MFV_LOGD("VCODEC_INC_DEC_EMI_USER + tid = %d\n", current->pid);
mutex_lock(&DecEMILock);
gu4DecEMICounter++;
MFV_LOGE("[VCODEC] DEC_EMI_USER = %d\n", gu4DecEMICounter);
user_data_addr = (VAL_UINT8_T *)arg;
ret = copy_to_user(user_data_addr, &gu4DecEMICounter, sizeof(VAL_UINT32_T));
if (ret)
{
MFV_LOGE("[ERROR] VCODEC_INC_DEC_EMI_USER, copy_to_user failed: %lu\n", ret);
mutex_unlock(&DecEMILock);
return -EFAULT;
}
mutex_unlock(&DecEMILock);
#ifdef ENABLE_MMDVFS_VDEC
// MM DVFS related
MFV_LOGE("[VCODEC][MMDVFS_VDEC] @@ INC_DEC_EMI MM DVFS init");
// raise voltage
SendDvfsRequest(DVFS_DEFAULT);
VdecDvfsBegin();
#endif
MFV_LOGD("VCODEC_INC_DEC_EMI_USER - tid = %d\n", current->pid);
}
break;
case VCODEC_DEC_DEC_EMI_USER:
{
MFV_LOGD("VCODEC_DEC_DEC_EMI_USER + tid = %d\n", current->pid);
mutex_lock(&DecEMILock);
gu4DecEMICounter--;
MFV_LOGE("[VCODEC] DEC_EMI_USER = %d\n", gu4DecEMICounter);
user_data_addr = (VAL_UINT8_T *)arg;
ret = copy_to_user(user_data_addr, &gu4DecEMICounter, sizeof(VAL_UINT32_T));
if (ret)
{
MFV_LOGE("[ERROR] VCODEC_DEC_DEC_EMI_USER, copy_to_user failed: %lu\n", ret);
mutex_unlock(&DecEMILock);
return -EFAULT;
}
mutex_unlock(&DecEMILock);
MFV_LOGD("VCODEC_DEC_DEC_EMI_USER - tid = %d\n", current->pid);
}
break;
case VCODEC_INC_ENC_EMI_USER:
{
MFV_LOGD("VCODEC_INC_ENC_EMI_USER + tid = %d\n", current->pid);
mutex_lock(&EncEMILock);
gu4EncEMICounter++;
MFV_LOGE("[VCODEC] ENC_EMI_USER = %d\n", gu4EncEMICounter);
user_data_addr = (VAL_UINT8_T *)arg;
ret = copy_to_user(user_data_addr, &gu4EncEMICounter, sizeof(VAL_UINT32_T));
if (ret)
{
MFV_LOGE("[ERROR] VCODEC_INC_ENC_EMI_USER, copy_to_user failed: %lu\n", ret);
mutex_unlock(&EncEMILock);
return -EFAULT;
}
mutex_unlock(&EncEMILock);
MFV_LOGD("VCODEC_INC_ENC_EMI_USER - tid = %d\n", current->pid);
}
break;
case VCODEC_DEC_ENC_EMI_USER:
{
MFV_LOGD("VCODEC_DEC_ENC_EMI_USER + tid = %d\n", current->pid);
mutex_lock(&EncEMILock);
gu4EncEMICounter--;
MFV_LOGE("[VCODEC] ENC_EMI_USER = %d\n", gu4EncEMICounter);
user_data_addr = (VAL_UINT8_T *)arg;
ret = copy_to_user(user_data_addr, &gu4EncEMICounter, sizeof(VAL_UINT32_T));
if (ret)
{
MFV_LOGE("[ERROR] VCODEC_DEC_ENC_EMI_USER, copy_to_user failed: %lu\n", ret);
mutex_unlock(&EncEMILock);
return -EFAULT;
}
mutex_unlock(&EncEMILock);
MFV_LOGD("VCODEC_DEC_ENC_EMI_USER - tid = %d\n", current->pid);
}
break;
case VCODEC_LOCKHW:
{
MFV_LOGD("VCODEC_LOCKHW + tid = %d\n", current->pid);
user_data_addr = (VAL_UINT8_T *)arg;
ret = copy_from_user(&rHWLock, user_data_addr, sizeof(VAL_HW_LOCK_T));
if (ret)
{
MFV_LOGE("[ERROR] VCODEC_LOCKHW, copy_from_user failed: %lu\n", ret);
return -EFAULT;
}
MFV_LOGD("[VCODEC] LOCKHW eDriverType = %d\n", rHWLock.eDriverType);
eValRet = VAL_RESULT_INVALID_ISR;
if (rHWLock.eDriverType == VAL_DRIVER_TYPE_MP4_DEC ||
rHWLock.eDriverType == VAL_DRIVER_TYPE_HEVC_DEC ||
rHWLock.eDriverType == VAL_DRIVER_TYPE_H264_DEC ||
rHWLock.eDriverType == VAL_DRIVER_TYPE_MP1_MP2_DEC ||
rHWLock.eDriverType == VAL_DRIVER_TYPE_VC1_DEC ||
rHWLock.eDriverType == VAL_DRIVER_TYPE_VC1_ADV_DEC ||
rHWLock.eDriverType == VAL_DRIVER_TYPE_VP8_DEC)
{
while (bLockedHW == VAL_FALSE)
{
mutex_lock(&DecHWLockEventTimeoutLock);
if (DecHWLockEvent.u4TimeoutMs == 1)
{
MFV_LOGE("VCODEC_LOCKHW, First Use Dec HW!!\n");
FirstUseDecHW = 1;
}
else
{
FirstUseDecHW = 0;
}
mutex_unlock(&DecHWLockEventTimeoutLock);
if (FirstUseDecHW == 1)
{
eValRet = eVideoWaitEvent(&DecHWLockEvent, sizeof(VAL_EVENT_T));
}
mutex_lock(&DecHWLockEventTimeoutLock);
if (DecHWLockEvent.u4TimeoutMs != 1000)
{
DecHWLockEvent.u4TimeoutMs = 1000;
FirstUseDecHW = 1;
}
else
{
FirstUseDecHW = 0;
}
mutex_unlock(&DecHWLockEventTimeoutLock);
mutex_lock(&VdecHWLock);
// one process try to lock twice
if (grVcodecDecHWLock.pvHandle == (VAL_VOID_T *)pmem_user_v2p_video((VAL_ULONG_T)rHWLock.pvHandle))
{
MFV_LOGE("[WARNING] VCODEC_LOCKHW, one decoder instance try to lock twice, may cause lock HW timeout!! instance = 0x%lx, CurrentTID = %d\n",
(VAL_ULONG_T)grVcodecDecHWLock.pvHandle, current->pid);
}
mutex_unlock(&VdecHWLock);
if (FirstUseDecHW == 0)
{
MFV_LOGD("VCODEC_LOCKHW, Not first time use HW, timeout = %d\n", DecHWLockEvent.u4TimeoutMs);
eValRet = eVideoWaitEvent(&DecHWLockEvent, sizeof(VAL_EVENT_T));
}
if (VAL_RESULT_INVALID_ISR == eValRet)
{
MFV_LOGE("[ERROR] VCODEC_LOCKHW, DecHWLockEvent TimeOut, CurrentTID = %d\n", current->pid);
if (FirstUseDecHW != 1)
{
mutex_lock(&VdecHWLock);
if (grVcodecDecHWLock.pvHandle == 0)
{
MFV_LOGE("[WARNING] VCODEC_LOCKHW, maybe mediaserver restart before, please check!!\n");
}
else
{
MFV_LOGE("[WARNING] VCODEC_LOCKHW, someone use HW, and check timeout value!!\n");
}
mutex_unlock(&VdecHWLock);
}
}
else if (VAL_RESULT_RESTARTSYS == eValRet)
{
MFV_LOGE("[WARNING] VCODEC_LOCKHW, VAL_RESULT_RESTARTSYS return when HWLock!!\n");
return -ERESTARTSYS;
}
mutex_lock(&VdecHWLock);
if (grVcodecDecHWLock.pvHandle == 0) // No one holds dec hw lock now
{
gu4VdecLockThreadId = current->pid;
grVcodecDecHWLock.pvHandle = (VAL_VOID_T *)pmem_user_v2p_video((VAL_ULONG_T)rHWLock.pvHandle);
grVcodecDecHWLock.eDriverType = rHWLock.eDriverType;
eVideoGetTimeOfDay(&grVcodecDecHWLock.rLockedTime, sizeof(VAL_TIME_T));
MFV_LOGD("VCODEC_LOCKHW, No process use dec HW, so current process can use HW\n");
MFV_LOGD("VCODEC_LOCKHW, LockInstance = 0x%lx CurrentTID = %d, rLockedTime(s, us) = %d, %d\n",
(VAL_ULONG_T)grVcodecDecHWLock.pvHandle, current->pid, grVcodecDecHWLock.rLockedTime.u4Sec, grVcodecDecHWLock.rLockedTime.u4uSec);
bLockedHW = VAL_TRUE;
if (VAL_RESULT_INVALID_ISR == eValRet && FirstUseDecHW != 1)
{
MFV_LOGE("[WARNING] VCODEC_LOCKHW, reset power/irq when HWLock!!\n");
vdec_power_off();
disable_irq(VDEC_IRQ_ID);
}
vdec_power_on();
if (rHWLock.bSecureInst == VAL_FALSE)
{
enable_irq(VDEC_IRQ_ID);
}
#ifdef ENABLE_MMDVFS_VDEC
// MM DVFS related
if (VAL_FALSE == gMMDFVFSMonitorStarts)
{
// Continous monitoring
VdecDvfsBegin();
}
if (VAL_TRUE == gMMDFVFSMonitorStarts)
{
MFV_LOGD("[VCODEC][MMDVFS_VDEC] @@ LOCK 1");
if (gMMDFVFSMonitorCounts > MONITOR_START_MINUS_1)
{
if (VAL_TRUE == gFirstDvfsLock)
{
gFirstDvfsLock = VAL_FALSE;
MFV_LOGE("[VCODEC][MMDVFS_VDEC] @@ LOCK 1 start monitor");
eVideoGetTimeOfDay(&gMMDFVFSMonitorStartTime, sizeof(VAL_TIME_T));
}
eVideoGetTimeOfDay(&gMMDFVFSLastLockTime, sizeof(VAL_TIME_T));
}
}
#endif
}
else // Another one holding dec hw now
{
MFV_LOGE("VCODEC_LOCKHW E\n");
eVideoGetTimeOfDay(&rCurTime, sizeof(VAL_TIME_T));
u4TimeInterval = (((((rCurTime.u4Sec - grVcodecDecHWLock.rLockedTime.u4Sec) * 1000000) + rCurTime.u4uSec)
- grVcodecDecHWLock.rLockedTime.u4uSec) / 1000);
MFV_LOGD("VCODEC_LOCKHW, someone use dec HW, and check timeout value\n");
MFV_LOGD("VCODEC_LOCKHW, Instance = 0x%lx CurrentTID = %d, TimeInterval(ms) = %d, TimeOutValue(ms)) = %d\n",
(VAL_ULONG_T)grVcodecDecHWLock.pvHandle, current->pid, u4TimeInterval, rHWLock.u4TimeoutMs);
MFV_LOGE("VCODEC_LOCKHW Lock Instance = 0x%lx, Lock TID = %d, CurrentTID = %d, rLockedTime(%d s, %d us), rCurTime(%d s, %d us)\n",
(VAL_ULONG_T)grVcodecDecHWLock.pvHandle, gu4VdecLockThreadId, current->pid,
grVcodecDecHWLock.rLockedTime.u4Sec, grVcodecDecHWLock.rLockedTime.u4uSec,
rCurTime.u4Sec, rCurTime.u4uSec
);
// 2012/12/16. Cheng-Jung Never steal hardware lock
if (0)
//if (u4TimeInterval >= rHWLock.u4TimeoutMs)
{
grVcodecDecHWLock.pvHandle = (VAL_VOID_T *)pmem_user_v2p_video((VAL_ULONG_T)rHWLock.pvHandle);
grVcodecDecHWLock.eDriverType = rHWLock.eDriverType;
eVideoGetTimeOfDay(&grVcodecDecHWLock.rLockedTime, sizeof(VAL_TIME_T));
bLockedHW = VAL_TRUE;
vdec_power_on();
// TODO: Error handling, VDEC break, reset?
}
}
mutex_unlock(&VdecHWLock);
spin_lock_irqsave(&LockDecHWCountLock, ulFlagsLockHW);
gu4LockDecHWCount++;
spin_unlock_irqrestore(&LockDecHWCountLock, ulFlagsLockHW);
}
}
else if (rHWLock.eDriverType == VAL_DRIVER_TYPE_H264_ENC ||
rHWLock.eDriverType == VAL_DRIVER_TYPE_HEVC_ENC ||
rHWLock.eDriverType == VAL_DRIVER_TYPE_JPEG_ENC)
{
while (bLockedHW == VAL_FALSE)
{
// Early break for JPEG VENC
if (rHWLock.u4TimeoutMs == 0)
{
if (grVcodecEncHWLock.pvHandle != 0)
{
break;
}
}
// Wait to acquire Enc HW lock
mutex_lock(&EncHWLockEventTimeoutLock);
if (EncHWLockEvent.u4TimeoutMs == 1)
{
MFV_LOGE("VCODEC_LOCKHW, First Use Enc HW %d!!\n", rHWLock.eDriverType);
FirstUseEncHW = 1;
}
else
{
FirstUseEncHW = 0;
}
mutex_unlock(&EncHWLockEventTimeoutLock);
if (FirstUseEncHW == 1)
{
eValRet = eVideoWaitEvent(&EncHWLockEvent, sizeof(VAL_EVENT_T));
}
mutex_lock(&EncHWLockEventTimeoutLock);
if (EncHWLockEvent.u4TimeoutMs == 1)
{
EncHWLockEvent.u4TimeoutMs = 1000;
FirstUseEncHW = 1;
}
else
{
FirstUseEncHW = 0;
if (rHWLock.u4TimeoutMs == 0)
{
EncHWLockEvent.u4TimeoutMs = 0; // No wait
}
else
{
EncHWLockEvent.u4TimeoutMs = 1000; // Wait indefinitely
}
}
mutex_unlock(&EncHWLockEventTimeoutLock);
mutex_lock(&VencHWLock);
// one process try to lock twice
if (grVcodecEncHWLock.pvHandle == (VAL_VOID_T *)pmem_user_v2p_video((VAL_ULONG_T)rHWLock.pvHandle))
{
MFV_LOGE("[WARNING] VCODEC_LOCKHW, one encoder instance try to lock twice, may cause lock HW timeout!! instance = 0x%lx, CurrentTID = %d, type:%d\n",
(VAL_ULONG_T)grVcodecEncHWLock.pvHandle, current->pid, rHWLock.eDriverType);
}
mutex_unlock(&VencHWLock);
if (FirstUseEncHW == 0)
{
eValRet = eVideoWaitEvent(&EncHWLockEvent, sizeof(VAL_EVENT_T));
}
if (VAL_RESULT_INVALID_ISR == eValRet)
{
MFV_LOGE("[ERROR] VCODEC_LOCKHW EncHWLockEvent TimeOut, CurrentTID = %d\n", current->pid);
if (FirstUseEncHW != 1)
{
mutex_lock(&VencHWLock);
if (grVcodecEncHWLock.pvHandle == 0)
{
MFV_LOGE("[WARNING] VCODEC_LOCKHW, maybe mediaserver restart before, please check!!\n");
}
else
{
MFV_LOGE("[WARNING] VCODEC_LOCKHW, someone use HW, and check timeout value!! %d\n", gLockTimeOutCount);
++gLockTimeOutCount;
if (gLockTimeOutCount > 30)
{
MFV_LOGE("[ERROR] VCODEC_LOCKHW - ID %d fail, someone locked HW time out more than 30 times 0x%lx, %lx, 0x%lx, type:%d\n", current->pid, (VAL_ULONG_T)grVcodecEncHWLock.pvHandle, pmem_user_v2p_video((VAL_ULONG_T)rHWLock.pvHandle), (VAL_ULONG_T)rHWLock.pvHandle, rHWLock.eDriverType);
gLockTimeOutCount = 0;
mutex_unlock(&VencHWLock);
return -EFAULT;
}
if (rHWLock.u4TimeoutMs == 0)
{
MFV_LOGE("[ERROR] VCODEC_LOCKHW - ID %d fail, someone locked HW already 0x%lx, %lx, 0x%lx, type:%d\n", current->pid, (VAL_ULONG_T)grVcodecEncHWLock.pvHandle, pmem_user_v2p_video((VAL_ULONG_T)rHWLock.pvHandle), (VAL_ULONG_T)rHWLock.pvHandle, rHWLock.eDriverType);
gLockTimeOutCount = 0;
mutex_unlock(&VencHWLock);
return -EFAULT;
}
}
mutex_unlock(&VencHWLock);
}
}
else if (VAL_RESULT_RESTARTSYS == eValRet)
{
return -ERESTARTSYS;
}
mutex_lock(&VencHWLock);
if (grVcodecEncHWLock.pvHandle == 0) //No process use HW, so current process can use HW
{
if (rHWLock.eDriverType == VAL_DRIVER_TYPE_H264_ENC ||
rHWLock.eDriverType == VAL_DRIVER_TYPE_HEVC_ENC ||
rHWLock.eDriverType == VAL_DRIVER_TYPE_JPEG_ENC)
{
grVcodecEncHWLock.pvHandle = (VAL_VOID_T *)pmem_user_v2p_video((VAL_ULONG_T)rHWLock.pvHandle);
MFV_LOGD("VCODEC_LOCKHW, No process use HW, so current process can use HW, handle = 0x%lx\n", (VAL_ULONG_T)grVcodecEncHWLock.pvHandle);
grVcodecEncHWLock.eDriverType = rHWLock.eDriverType;
eVideoGetTimeOfDay(&grVcodecEncHWLock.rLockedTime, sizeof(VAL_TIME_T));
MFV_LOGD("VCODEC_LOCKHW, No process use HW, so current process can use HW\n");
MFV_LOGD("VCODEC_LOCKHW, LockInstance = 0x%lx CurrentTID = %d, rLockedTime(s, us) = %d, %d\n",
(VAL_ULONG_T)grVcodecEncHWLock.pvHandle, current->pid, grVcodecEncHWLock.rLockedTime.u4Sec, grVcodecEncHWLock.rLockedTime.u4uSec);
bLockedHW = VAL_TRUE;
if (rHWLock.eDriverType == VAL_DRIVER_TYPE_H264_ENC ||
rHWLock.eDriverType == VAL_DRIVER_TYPE_HEVC_ENC)
{
venc_power_on();
//enable_irq(MT_VENC_IRQ_ID);
enable_irq(VENC_IRQ_ID);
}
}
}
else //someone use HW, and check timeout value
{
if (rHWLock.u4TimeoutMs == 0)
{
bLockedHW = VAL_FALSE;
mutex_unlock(&VencHWLock);
break;
}
eVideoGetTimeOfDay(&rCurTime, sizeof(VAL_TIME_T));
u4TimeInterval = (((((rCurTime.u4Sec - grVcodecEncHWLock.rLockedTime.u4Sec) * 1000000) + rCurTime.u4uSec)
- grVcodecEncHWLock.rLockedTime.u4uSec) / 1000);
MFV_LOGD("VCODEC_LOCKHW, someone use enc HW, and check timeout value\n");
MFV_LOGD("VCODEC_LOCKHW, LockInstance = 0x%lx, CurrentInstance = 0x%lx, CurrentTID = %d, TimeInterval(ms) = %d, TimeOutValue(ms)) = %d\n",
(VAL_ULONG_T)grVcodecEncHWLock.pvHandle, pmem_user_v2p_video((VAL_ULONG_T)rHWLock.pvHandle), current->pid, u4TimeInterval, rHWLock.u4TimeoutMs);
MFV_LOGD("VCODEC_LOCKHW, LockInstance = 0x%lx, CurrentInstance = 0x%lx, CurrentTID = %d, rLockedTime(s, us) = %d, %d, rCurTime(s, us) = %d, %d\n",
(VAL_ULONG_T)grVcodecEncHWLock.pvHandle, pmem_user_v2p_video((VAL_ULONG_T)rHWLock.pvHandle), current->pid,
grVcodecEncHWLock.rLockedTime.u4Sec, grVcodecEncHWLock.rLockedTime.u4uSec,
rCurTime.u4Sec, rCurTime.u4uSec
);
++gLockTimeOutCount;
if (gLockTimeOutCount > 30)
{
MFV_LOGE("[ERROR] VCODEC_LOCKHW - ID %d fail, someone locked HW over 30 times without timeout 0x%lx, %lx, 0x%lx, type:%d\n", current->pid, (VAL_ULONG_T)grVcodecEncHWLock.pvHandle, pmem_user_v2p_video((VAL_ULONG_T)rHWLock.pvHandle), (VAL_ULONG_T)rHWLock.pvHandle, rHWLock.eDriverType);
gLockTimeOutCount = 0;
mutex_unlock(&VencHWLock);
return -EFAULT;
}
// 2013/04/10. Cheng-Jung Never steal hardware lock
if (0)
//if (u4TimeInterval >= rHWLock.u4TimeoutMs)
{
if (rHWLock.eDriverType == VAL_DRIVER_TYPE_H264_ENC ||
rHWLock.eDriverType == VAL_DRIVER_TYPE_HEVC_ENC ||
rHWLock.eDriverType == VAL_DRIVER_TYPE_JPEG_ENC)
{
grVcodecEncHWLock.pvHandle = (VAL_VOID_T *)pmem_user_v2p_video((VAL_ULONG_T)rHWLock.pvHandle);
grVcodecEncHWLock.eDriverType = rHWLock.eDriverType;
eVideoGetTimeOfDay(&grVcodecEncHWLock.rLockedTime, sizeof(VAL_TIME_T));
MFV_LOGD("VCODEC_LOCKHW, LockInstance = 0x%lx, CurrentTID = %d, rLockedTime(s, us) = %d, %d\n",
(VAL_ULONG_T)grVcodecEncHWLock.pvHandle, current->pid, grVcodecEncHWLock.rLockedTime.u4Sec, grVcodecEncHWLock.rLockedTime.u4uSec);
bLockedHW = VAL_TRUE;
if (rHWLock.eDriverType == VAL_DRIVER_TYPE_H264_ENC ||
rHWLock.eDriverType == VAL_DRIVER_TYPE_HEVC_ENC)
{
venc_power_on();
}
}
}
}
if (VAL_TRUE == bLockedHW)
{
MFV_LOGD("VCODEC_LOCKHW, Lock ok grVcodecEncHWLock.pvHandle = 0x%lx, va:%lx, type:%d", (VAL_ULONG_T)grVcodecEncHWLock.pvHandle, (VAL_ULONG_T)rHWLock.pvHandle, rHWLock.eDriverType);
gLockTimeOutCount = 0;
}
mutex_unlock(&VencHWLock);
}
if (VAL_FALSE == bLockedHW)
{
MFV_LOGE("[ERROR] VCODEC_LOCKHW - ID %d fail, someone locked HW already , 0x%lx, %lx, 0x%lx, type:%d\n", current->pid, (VAL_ULONG_T)grVcodecEncHWLock.pvHandle, pmem_user_v2p_video((VAL_ULONG_T)rHWLock.pvHandle), (VAL_ULONG_T)rHWLock.pvHandle, rHWLock.eDriverType);
gLockTimeOutCount = 0;
return -EFAULT;
}
spin_lock_irqsave(&LockEncHWCountLock, ulFlagsLockHW);
gu4LockEncHWCount++;
spin_unlock_irqrestore(&LockEncHWCountLock, ulFlagsLockHW);
MFV_LOGD("VCODEC_LOCKHW, get locked - ObjId =%d\n", current->pid);
MFV_LOGD("VCODEC_LOCKHWed - tid = %d\n", current->pid);
}
else
{
MFV_LOGE("[WARNING] VCODEC_LOCKHW Unknown instance\n");
return -EFAULT;
}
MFV_LOGD("VCODEC_LOCKHW - tid = %d\n", current->pid);
}
break;
case VCODEC_UNLOCKHW:
{
MFV_LOGD("VCODEC_UNLOCKHW + tid = %d\n", current->pid);
user_data_addr = (VAL_UINT8_T *)arg;
ret = copy_from_user(&rHWLock, user_data_addr, sizeof(VAL_HW_LOCK_T));
if (ret)
{
MFV_LOGE("[ERROR] VCODEC_UNLOCKHW, copy_from_user failed: %lu\n", ret);
return -EFAULT;
}
MFV_LOGD("VCODEC_UNLOCKHW eDriverType = %d\n", rHWLock.eDriverType);
eValRet = VAL_RESULT_INVALID_ISR;
if (rHWLock.eDriverType == VAL_DRIVER_TYPE_MP4_DEC ||
rHWLock.eDriverType == VAL_DRIVER_TYPE_HEVC_DEC ||
rHWLock.eDriverType == VAL_DRIVER_TYPE_H264_DEC ||
rHWLock.eDriverType == VAL_DRIVER_TYPE_MP1_MP2_DEC ||
rHWLock.eDriverType == VAL_DRIVER_TYPE_VC1_DEC ||
rHWLock.eDriverType == VAL_DRIVER_TYPE_VC1_ADV_DEC ||
rHWLock.eDriverType == VAL_DRIVER_TYPE_VP8_DEC)
{
mutex_lock(&VdecHWLock);
if (grVcodecDecHWLock.pvHandle == (VAL_VOID_T *)pmem_user_v2p_video((VAL_ULONG_T)rHWLock.pvHandle)) // Current owner give up hw lock
{
grVcodecDecHWLock.pvHandle = 0;
grVcodecDecHWLock.eDriverType = VAL_DRIVER_TYPE_NONE;
if (rHWLock.bSecureInst == VAL_FALSE)
{
disable_irq(VDEC_IRQ_ID);
}
// TODO: check if turning power off is ok
vdec_power_off();
#ifdef ENABLE_MMDVFS_VDEC
// MM DVFS related
if (VAL_TRUE == gMMDFVFSMonitorStarts && gMMDFVFSMonitorCounts > MONITOR_START_MINUS_1)
{
_monitor_duration = VdecDvfsGetMonitorDuration();
if (_monitor_duration < MONITOR_DURATION_MS)
{
_diff = VdecDvfsStep();
MFV_LOGD("[VCODEC][MMDVFS_VDEC] @@ UNLOCK - lock time(%d ms, %d ms), cnt=%d, _monitor_duration=%d", _diff, gHWLockInterval, gMMDFVFSMonitorCounts, _monitor_duration);
}
else
{
VdecDvfsStep();
_perc = (VAL_UINT32_T)(100 * gHWLockInterval / _monitor_duration);
MFV_LOGE("[VCODEC][MMDVFS_VDEC] @@ UNLOCK - reset monitor duration (%d ms), percent: %d, (DROP_PERCENTAGE = %d, RAISE_PERCENTAGE = %d)", _monitor_duration, _perc, DROP_PERCENTAGE, RAISE_PERCENTAGE);
if (_perc < DROP_PERCENTAGE)
{
SendDvfsRequest(DVFS_LOW);
VdecDvfsEnd(DVFS_LOW);
}
else if (_perc > RAISE_PERCENTAGE)
{
SendDvfsRequest(DVFS_HIGH);
VdecDvfsEnd(DVFS_HIGH);
}
else
{
VdecDvfsEnd(-1);
}
}
}
gMMDFVFSMonitorCounts ++;
#endif
}
else // Not current owner
{
MFV_LOGE("[ERROR] VCODEC_UNLOCKHW, Not owner trying to unlock dec hardware 0x%lx\n", pmem_user_v2p_video((VAL_ULONG_T)rHWLock.pvHandle));
mutex_unlock(&VdecHWLock);
return -EFAULT;
}
mutex_unlock(&VdecHWLock);
eValRet = eVideoSetEvent(&DecHWLockEvent, sizeof(VAL_EVENT_T));
}
else if (rHWLock.eDriverType == VAL_DRIVER_TYPE_H264_ENC ||
rHWLock.eDriverType == VAL_DRIVER_TYPE_HEVC_ENC ||
rHWLock.eDriverType == VAL_DRIVER_TYPE_JPEG_ENC)
{
mutex_lock(&VencHWLock);
if (grVcodecEncHWLock.pvHandle == (VAL_VOID_T *)pmem_user_v2p_video((VAL_ULONG_T)rHWLock.pvHandle)) // Current owner give up hw lock
{
grVcodecEncHWLock.pvHandle = 0;
grVcodecEncHWLock.eDriverType = VAL_DRIVER_TYPE_NONE;
if (rHWLock.eDriverType == VAL_DRIVER_TYPE_H264_ENC ||
rHWLock.eDriverType == VAL_DRIVER_TYPE_HEVC_ENC)
{
//disable_irq(MT_VENC_IRQ_ID);
disable_irq(VENC_IRQ_ID);
// turn venc power off
venc_power_off();
}
}
else // Not current owner
{
// [TODO] error handling
MFV_LOGE("[ERROR] VCODEC_UNLOCKHW, Not owner trying to unlock enc hardware 0x%lx, pa:%lx, va:%lx type:%d\n", (VAL_ULONG_T)grVcodecEncHWLock.pvHandle, pmem_user_v2p_video((VAL_ULONG_T)rHWLock.pvHandle), (VAL_ULONG_T)rHWLock.pvHandle, rHWLock.eDriverType);
mutex_unlock(&VencHWLock);
return -EFAULT;
}
mutex_unlock(&VencHWLock);
eValRet = eVideoSetEvent(&EncHWLockEvent, sizeof(VAL_EVENT_T));
}
else
{
MFV_LOGE("[WARNING] VCODEC_UNLOCKHW Unknown instance\n");
return -EFAULT;
}
MFV_LOGD("VCODEC_UNLOCKHW - tid = %d\n", current->pid);
}
break;
case VCODEC_INC_PWR_USER:
{
MFV_LOGD("VCODEC_INC_PWR_USER + tid = %d\n", current->pid);
user_data_addr = (VAL_UINT8_T *)arg;
ret = copy_from_user(&rPowerParam, user_data_addr, sizeof(VAL_POWER_T));
if (ret)
{
MFV_LOGE("[ERROR] VCODEC_INC_PWR_USER, copy_from_user failed: %lu\n", ret);
return -EFAULT;
}
MFV_LOGD("[VCODEC] INC_PWR_USER eDriverType = %d\n", rPowerParam.eDriverType);
mutex_lock(&L2CLock);
#ifdef VENC_USE_L2C
if (rPowerParam.eDriverType == VAL_DRIVER_TYPE_H264_ENC)
{
gu4L2CCounter++;
MFV_LOGD("[VCODEC] INC_PWR_USER L2C counter = %d\n", gu4L2CCounter);
if (1 == gu4L2CCounter)
{
if (config_L2(0))
{
MFV_LOGE("[VCODEC][ERROR] Switch L2C size to 512K failed\n");
mutex_unlock(&L2CLock);
return -EFAULT;
}
else
{
MFV_LOGE("[VCODEC] Switch L2C size to 512K successful\n");
}
}
}
#endif
mutex_unlock(&L2CLock);
MFV_LOGD("VCODEC_INC_PWR_USER - tid = %d\n", current->pid);
}
break;
case VCODEC_DEC_PWR_USER:
{
MFV_LOGD("VCODEC_DEC_PWR_USER + tid = %d\n", current->pid);
user_data_addr = (VAL_UINT8_T *)arg;
ret = copy_from_user(&rPowerParam, user_data_addr, sizeof(VAL_POWER_T));
if (ret)
{
MFV_LOGE("[ERROR] VCODEC_DEC_PWR_USER, copy_from_user failed: %lu\n", ret);
return -EFAULT;
}
MFV_LOGD("[VCODEC] DEC_PWR_USER eDriverType = %d\n", rPowerParam.eDriverType);
mutex_lock(&L2CLock);
#ifdef VENC_USE_L2C
if (rPowerParam.eDriverType == VAL_DRIVER_TYPE_H264_ENC)
{
gu4L2CCounter--;
MFV_LOGD("[VCODEC] DEC_PWR_USER L2C counter = %d\n", gu4L2CCounter);
if (0 == gu4L2CCounter)
{
if (config_L2(1))
{
MFV_LOGE("[VCODEC][ERROR] Switch L2C size to 0K failed\n");
mutex_unlock(&L2CLock);
return -EFAULT;
}
else
{
MFV_LOGE("[VCODEC] Switch L2C size to 0K successful\n");
}
}
}
#endif
mutex_unlock(&L2CLock);
MFV_LOGD("VCODEC_DEC_PWR_USER - tid = %d\n", current->pid);
}
break;
case VCODEC_WAITISR:
{
MFV_LOGD("VCODEC_WAITISR + tid = %d\n", current->pid);
user_data_addr = (VAL_UINT8_T *)arg;
ret = copy_from_user(&val_isr, user_data_addr, sizeof(VAL_ISR_T));
if (ret)
{
MFV_LOGE("[ERROR] VCODEC_WAITISR, copy_from_user failed: %lu\n", ret);
return -EFAULT;
}
if (val_isr.eDriverType == VAL_DRIVER_TYPE_MP4_DEC ||
val_isr.eDriverType == VAL_DRIVER_TYPE_HEVC_DEC ||
val_isr.eDriverType == VAL_DRIVER_TYPE_H264_DEC ||
val_isr.eDriverType == VAL_DRIVER_TYPE_MP1_MP2_DEC ||
val_isr.eDriverType == VAL_DRIVER_TYPE_VC1_DEC ||
val_isr.eDriverType == VAL_DRIVER_TYPE_VC1_ADV_DEC ||
val_isr.eDriverType == VAL_DRIVER_TYPE_VP8_DEC)
{
mutex_lock(&VdecHWLock);
if (grVcodecDecHWLock.pvHandle == (VAL_VOID_T *)pmem_user_v2p_video((VAL_ULONG_T)val_isr.pvHandle))
{
bLockedHW = VAL_TRUE;
}
else
{
}
mutex_unlock(&VdecHWLock);
if (bLockedHW == VAL_FALSE)
{
MFV_LOGE("[ERROR] VCODEC_WAITISR, DO NOT have HWLock, so return fail\n");
break;
}
spin_lock_irqsave(&DecIsrLock, ulFlags);
DecIsrEvent.u4TimeoutMs = val_isr.u4TimeoutMs;
spin_unlock_irqrestore(&DecIsrLock, ulFlags);
eValRet = eVideoWaitEvent(&DecIsrEvent, sizeof(VAL_EVENT_T));
if (VAL_RESULT_INVALID_ISR == eValRet)
{
return -2;
}
else if (VAL_RESULT_RESTARTSYS == eValRet)
{
MFV_LOGE("[WARNING] VCODEC_WAITISR, VAL_RESULT_RESTARTSYS return when WAITISR!!\n");
return -ERESTARTSYS;
}
}
else if (val_isr.eDriverType == VAL_DRIVER_TYPE_H264_ENC ||
val_isr.eDriverType == VAL_DRIVER_TYPE_HEVC_ENC)
{
mutex_lock(&VencHWLock);
if (grVcodecEncHWLock.pvHandle == (VAL_VOID_T *)pmem_user_v2p_video((VAL_ULONG_T)val_isr.pvHandle))
{
bLockedHW = VAL_TRUE;
}
else
{
}
mutex_unlock(&VencHWLock);
if (bLockedHW == VAL_FALSE)
{
MFV_LOGE("[ERROR] VCODEC_WAITISR, DO NOT have enc HWLock, so return fail pa:%lx, va:%lx\n", pmem_user_v2p_video((VAL_ULONG_T)val_isr.pvHandle), (VAL_ULONG_T)val_isr.pvHandle);
break;
}
spin_lock_irqsave(&EncIsrLock, ulFlags);
EncIsrEvent.u4TimeoutMs = val_isr.u4TimeoutMs;
spin_unlock_irqrestore(&EncIsrLock, ulFlags);
eValRet = eVideoWaitEvent(&EncIsrEvent, sizeof(VAL_EVENT_T));
if (VAL_RESULT_INVALID_ISR == eValRet)
{
return -2;
}
else if (VAL_RESULT_RESTARTSYS == eValRet)
{
MFV_LOGE("[WARNING] VCODEC_WAITISR, VAL_RESULT_RESTARTSYS return when WAITISR!!\n");
return -ERESTARTSYS;
}
if (val_isr.u4IrqStatusNum > 0)
{
val_isr.u4IrqStatus[0] = gu4HwVencIrqStatus;
ret = copy_to_user(user_data_addr, &val_isr, sizeof(VAL_ISR_T));
if (ret)
{
MFV_LOGE("[ERROR] VCODEC_WAITISR, copy_to_user failed: %lu\n", ret);
return -EFAULT;
}
}
}
else
{
MFV_LOGE("[WARNING] VCODEC_WAITISR Unknown instance\n");
return -EFAULT;
}
MFV_LOGD("VCODEC_WAITISR - tid = %d\n", current->pid);
}
break;
case VCODEC_INITHWLOCK:
{
MFV_LOGE("VCODEC_INITHWLOCK [EMPTY] + - tid = %d\n", current->pid);
MFV_LOGE("VCODEC_INITHWLOCK [EMPTY] - - tid = %d\n", current->pid);
}
break;
case VCODEC_DEINITHWLOCK:
{
MFV_LOGE("VCODEC_DEINITHWLOCK [EMPTY] + - tid = %d\n", current->pid);
MFV_LOGE("VCODEC_DEINITHWLOCK [EMPTY] - - tid = %d\n", current->pid);
}
break;
case VCODEC_GET_CPU_LOADING_INFO:
{
VAL_UINT8_T *user_data_addr;
VAL_VCODEC_CPU_LOADING_INFO_T _temp;
MFV_LOGD("VCODEC_GET_CPU_LOADING_INFO +\n");
user_data_addr = (VAL_UINT8_T *)arg;
// TODO:
#if 0 // Morris Yang 20120112 mark temporarily
_temp._cpu_idle_time = mt_get_cpu_idle(0);
_temp._thread_cpu_time = mt_get_thread_cputime(0);
spin_lock_irqsave(&OalHWContextLock, ulFlags);
_temp._inst_count = getCurInstanceCount();
spin_unlock_irqrestore(&OalHWContextLock, ulFlags);
_temp._sched_clock = mt_sched_clock();
#endif
ret = copy_to_user(user_data_addr, &_temp, sizeof(VAL_VCODEC_CPU_LOADING_INFO_T));
if (ret)
{
MFV_LOGE("[ERROR] VCODEC_GET_CPU_LOADING_INFO, copy_to_user failed: %lu\n", ret);
return -EFAULT;
}
MFV_LOGD("VCODEC_GET_CPU_LOADING_INFO -\n");
}
break;
case VCODEC_GET_CORE_LOADING:
{
MFV_LOGD("VCODEC_GET_CORE_LOADING + - tid = %d\n", current->pid);
user_data_addr = (VAL_UINT8_T *)arg;
ret = copy_from_user(&rTempCoreLoading, user_data_addr, sizeof(VAL_VCODEC_CORE_LOADING_T));
if (ret)
{
MFV_LOGE("[ERROR] VCODEC_GET_CORE_LOADING, copy_from_user failed: %lu\n", ret);
return -EFAULT;
}
rTempCoreLoading.Loading = get_cpu_load(rTempCoreLoading.CPUid);
ret = copy_to_user(user_data_addr, &rTempCoreLoading, sizeof(VAL_VCODEC_CORE_LOADING_T));
if (ret)
{
MFV_LOGE("[ERROR] VCODEC_GET_CORE_LOADING, copy_to_user failed: %lu\n", ret);
return -EFAULT;
}
MFV_LOGD("VCODEC_GET_CORE_LOADING - - tid = %d\n", current->pid);
}
break;
case VCODEC_GET_CORE_NUMBER:
{
MFV_LOGD("VCODEC_GET_CORE_NUMBER + - tid = %d\n", current->pid);
user_data_addr = (VAL_UINT8_T *)arg;
temp_nr_cpu_ids = nr_cpu_ids;
ret = copy_to_user(user_data_addr, &temp_nr_cpu_ids, sizeof(int));
if (ret)
{
MFV_LOGE("[ERROR] VCODEC_GET_CORE_NUMBER, copy_to_user failed: %lu\n", ret);
return -EFAULT;
}
MFV_LOGD("VCODEC_GET_CORE_NUMBER - - tid = %d\n", current->pid);
}
break;
case VCODEC_SET_CPU_OPP_LIMIT:
{
MFV_LOGE("VCODEC_SET_CPU_OPP_LIMIT [EMPTY] + - tid = %d\n", current->pid);
user_data_addr = (VAL_UINT8_T *)arg;
ret = copy_from_user(&rCpuOppLimit, user_data_addr, sizeof(VAL_VCODEC_CPU_OPP_LIMIT_T));
if (ret)
{
MFV_LOGE("[ERROR] VCODEC_SET_CPU_OPP_LIMIT, copy_from_user failed: %lu\n", ret);
return -EFAULT;
}
MFV_LOGE("+VCODEC_SET_CPU_OPP_LIMIT (%d, %d, %d), tid = %d\n", rCpuOppLimit.limited_freq, rCpuOppLimit.limited_cpu, rCpuOppLimit.enable, current->pid);
// TODO: Check if cpu_opp_limit is available
//ret = cpu_opp_limit(EVENT_VIDEO, rCpuOppLimit.limited_freq, rCpuOppLimit.limited_cpu, rCpuOppLimit.enable); // 0: PASS, other: FAIL
if (ret)
{
MFV_LOGE("[VCODEC][ERROR] cpu_opp_limit failed: %lu\n", ret);
return -EFAULT;
}
MFV_LOGE("-VCODEC_SET_CPU_OPP_LIMIT tid = %d, ret = %lu\n", current->pid, ret);
MFV_LOGE("VCODEC_SET_CPU_OPP_LIMIT [EMPTY] - - tid = %d\n", current->pid);
}
break;
case VCODEC_MB:
{
mb();
}
break;
#if 0
case MFV_SET_CMD_CMD:
MFV_LOGD("[MFV] MFV_SET_CMD_CMD\n");
MFV_LOGD("[MFV] Arg = %x\n", arg);
user_data_addr = (VAL_UINT8_T *)arg;
ret = copy_from_user(&rDrvCmdQueue, user_data_addr, sizeof(VCODEC_DRV_CMD_QUEUE_T));
MFV_LOGD("[MFV] CmdNum = %d\n", rDrvCmdQueue.CmdNum);
u4Size = (rDrvCmdQueue.CmdNum) * sizeof(VCODEC_DRV_CMD_T);
cmd_queue = (P_VCODEC_DRV_CMD_T)kmalloc(u4Size, GFP_ATOMIC);
if (cmd_queue != VAL_NULL && rDrvCmdQueue.pCmd != VAL_NULL)
{
ret = copy_from_user(cmd_queue, rDrvCmdQueue.pCmd, u4Size);
while (cmd_queue->type != END_CMD)
{
switch (cmd_queue->type)
{
case ENABLE_HW_CMD:
break;
case DISABLE_HW_CMD:
break;
case WRITE_REG_CMD:
VDO_HW_WRITE(cmd_queue->address + cmd_queue->offset, cmd_queue->value);
break;
case READ_REG_CMD:
uValue = VDO_HW_READ(cmd_queue->address + cmd_queue->offset);
copy_to_user((void *)cmd_queue->value, &uValue, sizeof(VAL_UINT32_T));
break;
case WRITE_SYSRAM_CMD:
VDO_HW_WRITE(cmd_queue->address + cmd_queue->offset, cmd_queue->value);
break;
case READ_SYSRAM_CMD:
uValue = VDO_HW_READ(cmd_queue->address + cmd_queue->offset);
copy_to_user((void *)cmd_queue->value, &uValue, sizeof(VAL_UINT32_T));
break;
case MASTER_WRITE_CMD:
uValue = VDO_HW_READ(cmd_queue->address + cmd_queue->offset);
VDO_HW_WRITE(cmd_queue->address + cmd_queue->offset, cmd_queue->value | (uValue & cmd_queue->mask));
break;
case SETUP_ISR_CMD:
break;
case WAIT_ISR_CMD:
MFV_LOGD("HAL_CMD_SET_CMD_QUEUE: WAIT_ISR_CMD+\n");
MFV_LOGD("HAL_CMD_SET_CMD_QUEUE: WAIT_ISR_CMD-\n");
break;
case TIMEOUT_CMD:
break;
case WRITE_SYSRAM_RANGE_CMD:
break;
case READ_SYSRAM_RANGE_CMD:
break;
case POLL_REG_STATUS_CMD:
uValue = VDO_HW_READ(cmd_queue->address + cmd_queue->offset);
nCount = 0;
while ((uValue & cmd_queue->mask) != 0)
{
nCount++;
if (nCount > 1000)
{
break;
}
uValue = VDO_HW_READ(cmd_queue->address + cmd_queue->offset);
}
break;
default:
break;
}
cmd_queue++;
}
}
break;
#endif
default:
{
MFV_LOGE("========[ERROR] vcodec_ioctl default case======== %u\n", cmd);
}
break;
}
return 0xFF;
}
#if IS_ENABLED(CONFIG_COMPAT)
typedef enum
{
VAL_HW_LOCK_TYPE = 0,
VAL_POWER_TYPE,
VAL_ISR_TYPE,
VAL_MEMORY_TYPE
} STRUCT_TYPE;
typedef enum
{
COPY_FROM_USER = 0,
COPY_TO_USER,
} COPY_DIRECTION;
typedef struct COMPAT_VAL_HW_LOCK
{
compat_uptr_t pvHandle; ///< [IN] The video codec driver handle
compat_uint_t u4HandleSize; ///< [IN] The size of video codec driver handle
compat_uptr_t pvLock; ///< [IN/OUT] The Lock discriptor
compat_uint_t u4TimeoutMs; ///< [IN] The timeout ms
compat_uptr_t pvReserved; ///< [IN/OUT] The reserved parameter
compat_uint_t u4ReservedSize; ///< [IN] The size of reserved parameter structure
compat_uint_t eDriverType; ///< [IN] The driver type
char bSecureInst; ///< [IN] True if this is a secure instance // MTK_SEC_VIDEO_PATH_SUPPORT
} COMPAT_VAL_HW_LOCK_T;
typedef struct COMPAT_VAL_POWER
{
compat_uptr_t pvHandle; ///< [IN] The video codec driver handle
compat_uint_t u4HandleSize; ///< [IN] The size of video codec driver handle
compat_uint_t eDriverType; ///< [IN] The driver type
char fgEnable; ///< [IN] Enable or not.
compat_uptr_t pvReserved; ///< [IN/OUT] The reserved parameter
compat_uint_t u4ReservedSize; ///< [IN] The size of reserved parameter structure
//VAL_UINT32_T u4L2CUser; ///< [OUT] The number of power user right now
} COMPAT_VAL_POWER_T;
typedef struct COMPAT_VAL_ISR
{
compat_uptr_t pvHandle; ///< [IN] The video codec driver handle
compat_uint_t u4HandleSize; ///< [IN] The size of video codec driver handle
compat_uint_t eDriverType; ///< [IN] The driver type
compat_uptr_t pvIsrFunction; ///< [IN] The isr function
compat_uptr_t pvReserved; ///< [IN/OUT] The reserved parameter
compat_uint_t u4ReservedSize; ///< [IN] The size of reserved parameter structure
compat_uint_t u4TimeoutMs; ///< [IN] The timeout in ms
compat_uint_t u4IrqStatusNum; ///< [IN] The num of return registers when HW done
compat_uint_t u4IrqStatus[IRQ_STATUS_MAX_NUM]; ///< [IN/OUT] The value of return registers when HW done
} COMPAT_VAL_ISR_T;
typedef struct COMPAT_VAL_MEMORY
{
compat_uint_t eMemType; ///< [IN] The allocation memory type
compat_ulong_t u4MemSize; ///< [IN] The size of memory allocation
compat_uptr_t pvMemVa; ///< [IN/OUT] The memory virtual address
compat_uptr_t pvMemPa; ///< [IN/OUT] The memory physical address
compat_uint_t eAlignment; ///< [IN] The memory byte alignment setting
compat_uptr_t pvAlignMemVa; ///< [IN/OUT] The align memory virtual address
compat_uptr_t pvAlignMemPa; ///< [IN/OUT] The align memory physical address
compat_uint_t eMemCodec; ///< [IN] The memory codec for VENC or VDEC
compat_uint_t i4IonShareFd;
compat_uptr_t pIonBufhandle;
compat_uptr_t pvReserved; ///< [IN/OUT] The reserved parameter
compat_ulong_t u4ReservedSize; ///< [IN] The size of reserved parameter structure
} COMPAT_VAL_MEMORY_T;
static int compat_copy_struct(
STRUCT_TYPE eType,
COPY_DIRECTION eDirection,
void __user *data32,
void __user *data)
{
compat_uint_t u;
compat_ulong_t l;
compat_uptr_t p;
char c;
int err = 0;
switch (eType)
{
case VAL_HW_LOCK_TYPE:
{
if (eDirection == COPY_FROM_USER)
{
COMPAT_VAL_HW_LOCK_T __user *from32 = (COMPAT_VAL_HW_LOCK_T *)data32;
VAL_HW_LOCK_T __user *to = (VAL_HW_LOCK_T *)data;
err = get_user(p, &(from32->pvHandle));
err |= put_user(p, &(to->pvHandle));
err |= get_user(u, &(from32->u4HandleSize));
err |= put_user(u, &(to->u4HandleSize));
err |= get_user(p, &(from32->pvLock));
err |= put_user(p, &(to->pvLock));
err |= get_user(u, &(from32->u4TimeoutMs));
err |= put_user(u, &(to->u4TimeoutMs));
err |= get_user(p, &(from32->pvReserved));
err |= put_user(p, &(to->pvReserved));
err |= get_user(u, &(from32->u4ReservedSize));
err |= put_user(u, &(to->u4ReservedSize));
err |= get_user(u, &(from32->eDriverType));
err |= put_user(u, &(to->eDriverType));
err |= get_user(c, &(from32->bSecureInst));
err |= put_user(c, &(to->bSecureInst));
}
else
{
COMPAT_VAL_HW_LOCK_T __user *to32 = (COMPAT_VAL_HW_LOCK_T *)data32;
VAL_HW_LOCK_T __user *from = (VAL_HW_LOCK_T *)data;
err = get_user(p, &(from->pvHandle));
err |= put_user(p, &(to32->pvHandle));
err |= get_user(u, &(from->u4HandleSize));
err |= put_user(u, &(to32->u4HandleSize));
err |= get_user(p, &(from->pvLock));
err |= put_user(p, &(to32->pvLock));
err |= get_user(u, &(from->u4TimeoutMs));
err |= put_user(u, &(to32->u4TimeoutMs));
err |= get_user(p, &(from->pvReserved));
err |= put_user(p, &(to32->pvReserved));
err |= get_user(u, &(from->u4ReservedSize));
err |= put_user(u, &(to32->u4ReservedSize));
err |= get_user(u, &(from->eDriverType));
err |= put_user(u, &(to32->eDriverType));
err |= get_user(c, &(from->bSecureInst));
err |= put_user(c, &(to32->bSecureInst));
}
}
break;
case VAL_POWER_TYPE:
{
if (eDirection == COPY_FROM_USER)
{
COMPAT_VAL_POWER_T __user *from32 = (COMPAT_VAL_POWER_T *)data32;
VAL_POWER_T __user *to = (VAL_POWER_T *)data;
err = get_user(p, &(from32->pvHandle));
err |= put_user(p, &(to->pvHandle));
err |= get_user(u, &(from32->u4HandleSize));
err |= put_user(u, &(to->u4HandleSize));
err |= get_user(u, &(from32->eDriverType));
err |= put_user(u, &(to->eDriverType));
err |= get_user(c, &(from32->fgEnable));
err |= put_user(c, &(to->fgEnable));
err |= get_user(p, &(from32->pvReserved));
err |= put_user(p, &(to->pvReserved));
err |= get_user(u, &(from32->u4ReservedSize));
err |= put_user(u, &(to->u4ReservedSize));
}
else
{
COMPAT_VAL_POWER_T __user *to32 = (COMPAT_VAL_POWER_T *)data32;
VAL_POWER_T __user *from = (VAL_POWER_T *)data;
err = get_user(p, &(from->pvHandle));
err |= put_user(p, &(to32->pvHandle));
err |= get_user(u, &(from->u4HandleSize));
err |= put_user(u, &(to32->u4HandleSize));
err |= get_user(u, &(from->eDriverType));
err |= put_user(u, &(to32->eDriverType));
err |= get_user(c, &(from->fgEnable));
err |= put_user(c, &(to32->fgEnable));
err |= get_user(p, &(from->pvReserved));
err |= put_user(p, &(to32->pvReserved));
err |= get_user(u, &(from->u4ReservedSize));
err |= put_user(u, &(to32->u4ReservedSize));
}
}
break;
case VAL_ISR_TYPE:
{
int i = 0;
if (eDirection == COPY_FROM_USER)
{
COMPAT_VAL_ISR_T __user *from32 = (COMPAT_VAL_ISR_T *)data32;
VAL_ISR_T __user *to = (VAL_ISR_T *)data;
err = get_user(p, &(from32->pvHandle));
err |= put_user(p, &(to->pvHandle));
err |= get_user(u, &(from32->u4HandleSize));
err |= put_user(u, &(to->u4HandleSize));
err |= get_user(u, &(from32->eDriverType));
err |= put_user(u, &(to->eDriverType));
err |= get_user(p, &(from32->pvIsrFunction));
err |= put_user(p, &(to->pvIsrFunction));
err |= get_user(p, &(from32->pvReserved));
err |= put_user(p, &(to->pvReserved));
err |= get_user(u, &(from32->u4ReservedSize));
err |= put_user(u, &(to->u4ReservedSize));
err |= get_user(u, &(from32->u4TimeoutMs));
err |= put_user(u, &(to->u4TimeoutMs));
err |= get_user(u, &(from32->u4IrqStatusNum));
err |= put_user(u, &(to->u4IrqStatusNum));
for (; i < IRQ_STATUS_MAX_NUM; i++)
{
err |= get_user(u, &(from32->u4IrqStatus[i]));
err |= put_user(u, &(to->u4IrqStatus[i]));
}
return err;
}
else
{
COMPAT_VAL_ISR_T __user *to32 = (COMPAT_VAL_ISR_T *)data32;
VAL_ISR_T __user *from = (VAL_ISR_T *)data;
err = get_user(p, &(from->pvHandle));
err |= put_user(p, &(to32->pvHandle));
err |= get_user(u, &(from->u4HandleSize));
err |= put_user(u, &(to32->u4HandleSize));
err |= get_user(u, &(from->eDriverType));
err |= put_user(u, &(to32->eDriverType));
err |= get_user(p, &(from->pvIsrFunction));
err |= put_user(p, &(to32->pvIsrFunction));
err |= get_user(p, &(from->pvReserved));
err |= put_user(p, &(to32->pvReserved));
err |= get_user(u, &(from->u4ReservedSize));
err |= put_user(u, &(to32->u4ReservedSize));
err |= get_user(u, &(from->u4TimeoutMs));
err |= put_user(u, &(to32->u4TimeoutMs));
err |= get_user(u, &(from->u4IrqStatusNum));
err |= put_user(u, &(to32->u4IrqStatusNum));
for (; i < IRQ_STATUS_MAX_NUM; i++)
{
err |= get_user(u, &(from->u4IrqStatus[i]));
err |= put_user(u, &(to32->u4IrqStatus[i]));
}
}
}
break;
case VAL_MEMORY_TYPE:
{
if (eDirection == COPY_FROM_USER)
{
COMPAT_VAL_MEMORY_T __user *from32 = (COMPAT_VAL_MEMORY_T *)data32;
VAL_MEMORY_T __user *to = (VAL_MEMORY_T *)data;
err = get_user(u, &(from32->eMemType));
err |= put_user(u, &(to->eMemType));
err |= get_user(l, &(from32->u4MemSize));
err |= put_user(l, &(to->u4MemSize));
err |= get_user(p, &(from32->pvMemVa));
err |= put_user(p, &(to->pvMemVa));
err |= get_user(p, &(from32->pvMemPa));
err |= put_user(p, &(to->pvMemPa));
err |= get_user(u, &(from32->eAlignment));
err |= put_user(u, &(to->eAlignment));
err |= get_user(p, &(from32->pvAlignMemVa));
err |= put_user(p, &(to->pvAlignMemVa));
err |= get_user(p, &(from32->pvAlignMemPa));
err |= put_user(p, &(to->pvAlignMemPa));
err |= get_user(u, &(from32->eMemCodec));
err |= put_user(u, &(to->eMemCodec));
err |= get_user(u, &(from32->i4IonShareFd));
err |= put_user(u, &(to->i4IonShareFd));
err |= get_user(p, &(from32->pIonBufhandle));
err |= put_user(p, &(to->pIonBufhandle));
err |= get_user(p, &(from32->pvReserved));
err |= put_user(p, &(to->pvReserved));
err |= get_user(l, &(from32->u4ReservedSize));
err |= put_user(l, &(to->u4ReservedSize));
return err;
}
else
{
COMPAT_VAL_MEMORY_T __user *to32 = (COMPAT_VAL_MEMORY_T *)data32;
VAL_MEMORY_T __user *from = (VAL_MEMORY_T *)data;
err = get_user(u, &(from->eMemType));
err |= put_user(u, &(to32->eMemType));
err |= get_user(l, &(from->u4MemSize));
err |= put_user(l, &(to32->u4MemSize));
err |= get_user(p, &(from->pvMemVa));
err |= put_user(p, &(to32->pvMemVa));
err |= get_user(p, &(from->pvMemPa));
err |= put_user(p, &(to32->pvMemPa));
err |= get_user(u, &(from->eAlignment));
err |= put_user(u, &(to32->eAlignment));
err |= get_user(p, &(from->pvAlignMemVa));
err |= put_user(p, &(to32->pvAlignMemVa));
err |= get_user(p, &(from->pvAlignMemPa));
err |= put_user(p, &(to32->pvAlignMemPa));
err |= get_user(u, &(from->eMemCodec));
err |= put_user(u, &(to32->eMemCodec));
err |= get_user(u, &(from->i4IonShareFd));
err |= put_user(u, &(to32->i4IonShareFd));
err |= get_user(p, &(from->pIonBufhandle));
err |= put_user(p, &(to32->pIonBufhandle));
err |= get_user(p, &(from->pvReserved));
err |= put_user(p, &(to32->pvReserved));
err |= get_user(l, &(from->u4ReservedSize));
err |= put_user(l, &(to32->u4ReservedSize));
}
}
break;
default:
break;
}
return err;
}
static long vcodec_unlocked_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
long ret = 0;
MFV_LOGD("vcodec_unlocked_compat_ioctl: 0x%x\n", cmd);
switch (cmd)
{
case VCODEC_ALLOC_NON_CACHE_BUFFER:
case VCODEC_FREE_NON_CACHE_BUFFER:
{
COMPAT_VAL_MEMORY_T __user *data32;
VAL_MEMORY_T __user *data;
int err;
data32 = compat_ptr(arg);
data = compat_alloc_user_space(sizeof(VAL_MEMORY_T));
if (data == NULL)
{
return -EFAULT;
}
err = compat_copy_struct(VAL_MEMORY_TYPE, COPY_FROM_USER, (void *)data32, (void *)data);
if (err)
{
return err;
}
ret = file->f_op->unlocked_ioctl(file, cmd, (unsigned long)data);
err = compat_copy_struct(VAL_MEMORY_TYPE, COPY_TO_USER, (void *)data32, (void *)data);
if (err)
{
return err;
}
return ret;
}
break;
case VCODEC_LOCKHW:
case VCODEC_UNLOCKHW:
{
COMPAT_VAL_HW_LOCK_T __user *data32;
VAL_HW_LOCK_T __user *data;
int err;
data32 = compat_ptr(arg);
data = compat_alloc_user_space(sizeof(VAL_HW_LOCK_T));
if (data == NULL)
{
return -EFAULT;
}
err = compat_copy_struct(VAL_HW_LOCK_TYPE, COPY_FROM_USER, (void *)data32, (void *)data);
if (err)
{
return err;
}
ret = file->f_op->unlocked_ioctl(file, cmd, (unsigned long)data);
err = compat_copy_struct(VAL_HW_LOCK_TYPE, COPY_TO_USER, (void *)data32, (void *)data);
if (err)
{
return err;
}
return ret;
}
break;
case VCODEC_INC_PWR_USER:
case VCODEC_DEC_PWR_USER:
{
COMPAT_VAL_POWER_T __user *data32;
VAL_POWER_T __user *data;
int err;
data32 = compat_ptr(arg);
data = compat_alloc_user_space(sizeof(VAL_POWER_T));
if (data == NULL)
{
return -EFAULT;
}
err = compat_copy_struct(VAL_POWER_TYPE, COPY_FROM_USER, (void *)data32, (void *)data);
if (err)
{
return err;
}
ret = file->f_op->unlocked_ioctl(file, cmd, (unsigned long)data);
err = compat_copy_struct(VAL_POWER_TYPE, COPY_TO_USER, (void *)data32, (void *)data);
if (err)
{
return err;
}
return ret;
}
break;
case VCODEC_WAITISR:
{
COMPAT_VAL_ISR_T __user *data32;
VAL_ISR_T __user *data;
int err;
data32 = compat_ptr(arg);
data = compat_alloc_user_space(sizeof(VAL_ISR_T));
if (data == NULL)
{
return -EFAULT;
}
err = compat_copy_struct(VAL_ISR_TYPE, COPY_FROM_USER, (void *)data32, (void *)data);
if (err)
{
return err;
}
ret = file->f_op->unlocked_ioctl(file, VCODEC_WAITISR, (unsigned long)data);
err = compat_copy_struct(VAL_ISR_TYPE, COPY_TO_USER, (void *)data32, (void *)data);
if (err)
{
return err;
}
return ret;
}
break;
default:
{
return vcodec_unlocked_ioctl(file, cmd, arg);
}
break;
}
return 0;
}
#else
#define vcodec_unlocked_compat_ioctl NULL
#endif
static int vcodec_open(struct inode *inode, struct file *file)
{
MFV_LOGD("vcodec_open\n");
mutex_lock(&DriverOpenCountLock);
Driver_Open_Count++;
MFV_LOGE("vcodec_open pid = %d, Driver_Open_Count %d\n", current->pid, Driver_Open_Count);
mutex_unlock(&DriverOpenCountLock);
// TODO: Check upper limit of concurrent users?
return 0;
}
static int vcodec_flush(struct file *file, fl_owner_t id)
{
MFV_LOGD("vcodec_flush, curr_tid =%d\n", current->pid);
MFV_LOGE("vcodec_flush pid = %d, Driver_Open_Count %d\n", current->pid, Driver_Open_Count);
return 0;
}
static int vcodec_release(struct inode *inode, struct file *file)
{
VAL_ULONG_T ulFlagsLockHW, ulFlagsISR;
//dump_stack();
MFV_LOGD("vcodec_release, curr_tid =%d\n", current->pid);
mutex_lock(&DriverOpenCountLock);
MFV_LOGE("vcodec_release pid = %d, Driver_Open_Count %d\n", current->pid, Driver_Open_Count);
Driver_Open_Count--;
if (Driver_Open_Count == 0)
{
mutex_lock(&VdecHWLock);
gu4VdecLockThreadId = 0;
grVcodecDecHWLock.pvHandle = 0;
grVcodecDecHWLock.eDriverType = VAL_DRIVER_TYPE_NONE;
grVcodecDecHWLock.rLockedTime.u4Sec = 0;
grVcodecDecHWLock.rLockedTime.u4uSec = 0;
mutex_unlock(&VdecHWLock);
mutex_lock(&VencHWLock);
grVcodecEncHWLock.pvHandle = 0;
grVcodecEncHWLock.eDriverType = VAL_DRIVER_TYPE_NONE;
grVcodecEncHWLock.rLockedTime.u4Sec = 0;
grVcodecEncHWLock.rLockedTime.u4uSec = 0;
mutex_unlock(&VencHWLock);
mutex_lock(&DecEMILock);
gu4DecEMICounter = 0;
mutex_unlock(&DecEMILock);
mutex_lock(&EncEMILock);
gu4EncEMICounter = 0;
mutex_unlock(&EncEMILock);
mutex_lock(&PWRLock);
gu4PWRCounter = 0;
mutex_unlock(&PWRLock);
#if defined(VENC_USE_L2C)
mutex_lock(&L2CLock);
if (gu4L2CCounter != 0)
{
MFV_LOGE("vcodec_flush pid = %d, L2 user = %d, force restore L2 settings\n", current->pid, gu4L2CCounter);
if (config_L2(1))
{
MFV_LOGE("[VCODEC][ERROR] restore L2 settings failed\n");
}
}
gu4L2CCounter = 0;
mutex_unlock(&L2CLock);
#endif
spin_lock_irqsave(&LockDecHWCountLock, ulFlagsLockHW);
gu4LockDecHWCount = 0;
spin_unlock_irqrestore(&LockDecHWCountLock, ulFlagsLockHW);
spin_lock_irqsave(&LockEncHWCountLock, ulFlagsLockHW);
gu4LockEncHWCount = 0;
spin_unlock_irqrestore(&LockEncHWCountLock, ulFlagsLockHW);
spin_lock_irqsave(&DecISRCountLock, ulFlagsISR);
gu4DecISRCount = 0;
spin_unlock_irqrestore(&DecISRCountLock, ulFlagsISR);
spin_lock_irqsave(&EncISRCountLock, ulFlagsISR);
gu4EncISRCount = 0;
spin_unlock_irqrestore(&EncISRCountLock, ulFlagsISR);
#ifdef ENABLE_MMDVFS_VDEC
if (VAL_TRUE == gMMDFVFSMonitorStarts)
{
gMMDFVFSMonitorStarts = VAL_FALSE;
gMMDFVFSMonitorCounts = 0;
gHWLockInterval = 0;
gHWLockMaxDuration = 0;
SendDvfsRequest(DVFS_LOW);
}
#endif
}
#ifdef ENABLE_MMDVFS_VDEC
mutex_lock(&DecEMILock);
if (VAL_TRUE == gMMDFVFSMonitorStarts && 0 == gu4DecEMICounter)
{
gMMDFVFSMonitorStarts = VAL_FALSE;
gMMDFVFSMonitorCounts = 0;
gHWLockInterval = 0;
gHWLockMaxDuration = 0;
SendDvfsRequest(DVFS_LOW);
}
mutex_unlock(&DecEMILock);
#endif
mutex_unlock(&DriverOpenCountLock);
return 0;
}
void vcodec_vma_open(struct vm_area_struct *vma)
{
MFV_LOGD("vcodec VMA open, virt %lx, phys %lx\n", vma->vm_start, vma->vm_pgoff << PAGE_SHIFT);
}
void vcodec_vma_close(struct vm_area_struct *vma)
{
MFV_LOGD("vcodec VMA close, virt %lx, phys %lx\n", vma->vm_start, vma->vm_pgoff << PAGE_SHIFT);
}
static struct vm_operations_struct vcodec_remap_vm_ops =
{
.open = vcodec_vma_open,
.close = vcodec_vma_close,
};
static int vcodec_mmap(struct file *file, struct vm_area_struct *vma)
{
#if 1
VAL_UINT32_T u4I = 0;
VAL_ULONG_T length;
VAL_ULONG_T pfn;
length = vma->vm_end - vma->vm_start;
pfn = vma->vm_pgoff << PAGE_SHIFT;
if (((length > VENC_REGION) || (pfn < VENC_BASE) || (pfn > VENC_BASE + VENC_REGION)) &&
((length > VDEC_REGION) || (pfn < VDEC_BASE_PHY) || (pfn > VDEC_BASE_PHY + VDEC_REGION)) &&
((length > HW_REGION) || (pfn < HW_BASE) || (pfn > HW_BASE + HW_REGION)) &&
((length > INFO_REGION) || (pfn < INFO_BASE) || (pfn > INFO_BASE + INFO_REGION))
)
{
VAL_ULONG_T ulAddr, ulSize;
for (u4I = 0; u4I < VCODEC_MULTIPLE_INSTANCE_NUM_x_10; u4I++)
{
if ((grNonCacheMemoryList[u4I].ulKVA != -1L) && (grNonCacheMemoryList[u4I].ulKPA != -1L))
{
ulAddr = grNonCacheMemoryList[u4I].ulKPA;
ulSize = (grNonCacheMemoryList[u4I].ulSize + 0x1000 - 1) & ~(0x1000 - 1);
if ((length == ulSize) && (pfn == ulAddr))
{
MFV_LOGD("[VCODEC] cache idx %d \n", u4I);
break;
}
}
}
if (u4I == VCODEC_MULTIPLE_INSTANCE_NUM_x_10)
{
MFV_LOGE("[VCODEC][ERROR] mmap region error: Length(0x%lx), pfn(0x%lx)\n", (VAL_ULONG_T)length, pfn);
return -EAGAIN;
}
}
#endif
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
MFV_LOGE("[VCODEC][mmap] vma->start 0x%lx, vma->end 0x%lx, vma->pgoff 0x%lx\n",
(VAL_ULONG_T)vma->vm_start, (VAL_ULONG_T)vma->vm_end, (VAL_ULONG_T)vma->vm_pgoff);
if (remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
vma->vm_end - vma->vm_start, vma->vm_page_prot))
{
return -EAGAIN;
}
vma->vm_ops = &vcodec_remap_vm_ops;
vcodec_vma_open(vma);
return 0;
}
static struct file_operations vcodec_fops =
{
.owner = THIS_MODULE,
.unlocked_ioctl = vcodec_unlocked_ioctl,
.open = vcodec_open,
.flush = vcodec_flush,
.release = vcodec_release,
.mmap = vcodec_mmap,
#if IS_ENABLED(CONFIG_COMPAT)
.compat_ioctl = vcodec_unlocked_compat_ioctl,
#endif
};
static int vcodec_probe(struct platform_device *dev)
{
int ret;
MFV_LOGD("+vcodec_probe\n");
mutex_lock(&DecEMILock);
gu4DecEMICounter = 0;
mutex_unlock(&DecEMILock);
mutex_lock(&EncEMILock);
gu4EncEMICounter = 0;
mutex_unlock(&EncEMILock);
mutex_lock(&PWRLock);
gu4PWRCounter = 0;
mutex_unlock(&PWRLock);
mutex_lock(&L2CLock);
gu4L2CCounter = 0;
mutex_unlock(&L2CLock);
ret = register_chrdev_region(vcodec_devno, 1, VCODEC_DEVNAME);
if (ret)
{
MFV_LOGE("[ERROR] Can't Get Major number for VCodec Device\n");
}
vcodec_cdev = cdev_alloc();
vcodec_cdev->owner = THIS_MODULE;
vcodec_cdev->ops = &vcodec_fops;
ret = cdev_add(vcodec_cdev, vcodec_devno, 1);
if (ret)
{
MFV_LOGE("[ERROR] Can't add Vcodec Device\n");
}
vcodec_class = class_create(THIS_MODULE, VCODEC_DEVNAME);
if (IS_ERR(vcodec_class))
{
ret = PTR_ERR(vcodec_class);
MFV_LOGE("[VCODEC][ERROR] Unable to create class, err = %d", ret);
return ret;
}
vcodec_device = device_create(vcodec_class, NULL, vcodec_devno, NULL, VCODEC_DEVNAME);
//if (request_irq(MT_VDEC_IRQ_ID , (irq_handler_t)video_intr_dlr, IRQF_TRIGGER_LOW, VCODEC_DEVNAME, NULL) < 0)
if (request_irq(VDEC_IRQ_ID , (irq_handler_t)video_intr_dlr, IRQF_TRIGGER_LOW, VCODEC_DEVNAME, NULL) < 0)
{
MFV_LOGE("[VCODEC][ERROR] error to request dec irq\n");
}
else
{
MFV_LOGD("[VCODEC] success to request dec irq: %d\n", VDEC_IRQ_ID);
}
//if (request_irq(MT_VENC_IRQ_ID , (irq_handler_t)video_intr_dlr2, IRQF_TRIGGER_LOW, VCODEC_DEVNAME, NULL) < 0)
if (request_irq(VENC_IRQ_ID , (irq_handler_t)video_intr_dlr2, IRQF_TRIGGER_LOW, VCODEC_DEVNAME, NULL) < 0)
{
MFV_LOGD("[VCODEC][ERROR] error to request enc irq\n");
}
else
{
MFV_LOGD("[VCODEC] success to request enc irq: %d\n", VENC_IRQ_ID);
}
//disable_irq(MT_VDEC_IRQ_ID);
disable_irq(VDEC_IRQ_ID);
//disable_irq(MT_VENC_IRQ_ID);
disable_irq(VENC_IRQ_ID);
#if !defined(CONFIG_MTK_LEGACY)
clk_MT_CG_DISP0_SMI_COMMON = devm_clk_get(&dev->dev, "MT_CG_DISP0_SMI_COMMON");
if (IS_ERR(clk_MT_CG_DISP0_SMI_COMMON))
{
MFV_LOGE("[VCODEC][ERROR] Unable to devm_clk_get MT_CG_DISP0_SMI_COMMON\n");
return PTR_ERR(clk_MT_CG_DISP0_SMI_COMMON);
}
clk_MT_CG_VDEC0_VDEC = devm_clk_get(&dev->dev, "MT_CG_VDEC0_VDEC");
if (IS_ERR(clk_MT_CG_VDEC0_VDEC))
{
MFV_LOGE("[VCODEC][ERROR] Unable to devm_clk_get MT_CG_VDEC0_VDEC\n");
return PTR_ERR(clk_MT_CG_VDEC0_VDEC);
}
clk_MT_CG_VDEC1_LARB = devm_clk_get(&dev->dev, "MT_CG_VDEC1_LARB");
if (IS_ERR(clk_MT_CG_VDEC1_LARB))
{
MFV_LOGE("[VCODEC][ERROR] Unable to devm_clk_get MT_CG_VDEC1_LARB\n");
return PTR_ERR(clk_MT_CG_VDEC1_LARB);
}
clk_MT_CG_VENC_VENC = devm_clk_get(&dev->dev, "MT_CG_VENC_VENC");
if (IS_ERR(clk_MT_CG_VENC_VENC))
{
MFV_LOGE("[VCODEC][ERROR] Unable to devm_clk_get MT_CG_VENC_VENC\n");
return PTR_ERR(clk_MT_CG_VENC_VENC);
}
clk_MT_CG_VENC_LARB = devm_clk_get(&dev->dev, "MT_CG_VENC_LARB");
if (IS_ERR(clk_MT_CG_VENC_LARB))
{
MFV_LOGE("[VCODEC][ERROR] Unable to devm_clk_get MT_CG_VENC_LARB\n");
return PTR_ERR(clk_MT_CG_VENC_LARB);
}
#endif /* !defined(CONFIG_MTK_LEGACY) */
MFV_LOGD("vcodec_probe Done\n");
return 0;
}
static int vcodec_remove(struct platform_device *pDev)
{
MFV_LOGD("vcodec_remove\n");
return 0;
}
#ifdef CONFIG_MTK_HIBERNATION
extern void mt_irq_set_sens(unsigned int irq, unsigned int sens);
extern void mt_irq_set_polarity(unsigned int irq, unsigned int polarity);
static int vcodec_pm_restore_noirq(struct device *device)
{
// vdec: IRQF_TRIGGER_LOW
mt_irq_set_sens(VDEC_IRQ_ID, MT_LEVEL_SENSITIVE);
mt_irq_set_polarity(VDEC_IRQ_ID, MT_POLARITY_LOW);
// venc: IRQF_TRIGGER_LOW
mt_irq_set_sens(VENC_IRQ_ID, MT_LEVEL_SENSITIVE);
mt_irq_set_polarity(VENC_IRQ_ID, MT_POLARITY_LOW);
return 0;
}
#endif
static const struct of_device_id vcodec_of_match[] =
{
{ .compatible = "mediatek,VDEC_GCON", },
{/* sentinel */}
};
MODULE_DEVICE_TABLE(of, vcodec_of_match);
static struct platform_driver vcodec_driver =
{
.probe = vcodec_probe,
.remove = vcodec_remove,
/*
.suspend = vcodec_suspend,
.resume = vcodec_resume,
*/
.driver = {
.name = VCODEC_DEVNAME,
.owner = THIS_MODULE,
.of_match_table = vcodec_of_match,
},
};
static int __init vcodec_driver_init(void)
{
VAL_RESULT_T eValHWLockRet;
VAL_ULONG_T ulFlags, ulFlagsLockHW, ulFlagsISR;
MFV_LOGD("+vcodec_driver_init !!\n");
mutex_lock(&DriverOpenCountLock);
Driver_Open_Count = 0;
mutex_unlock(&DriverOpenCountLock);
{
struct device_node *node = NULL;
node = of_find_compatible_node(NULL, NULL, "mediatek,VENC");
KVA_VENC_BASE = (VAL_ULONG_T)of_iomap(node, 0);
VENC_IRQ_ID = irq_of_parse_and_map(node, 0);
KVA_VENC_IRQ_STATUS_ADDR = KVA_VENC_BASE + 0x05C;
KVA_VENC_IRQ_ACK_ADDR = KVA_VENC_BASE + 0x060;
}
{
struct device_node *node = NULL;
node = of_find_compatible_node(NULL, NULL, "mediatek,VDEC_FULL_TOP");
KVA_VDEC_BASE = (VAL_ULONG_T)of_iomap(node, 0);
VDEC_IRQ_ID = irq_of_parse_and_map(node, 0);
KVA_VDEC_MISC_BASE = KVA_VDEC_BASE + 0x0000;
KVA_VDEC_VLD_BASE = KVA_VDEC_BASE + 0x1000;
}
{
struct device_node *node = NULL;
node = of_find_compatible_node(NULL, NULL, "mediatek,VDEC_GCON");
KVA_VDEC_GCON_BASE = (VAL_ULONG_T)of_iomap(node, 0);
MFV_LOGD("[VCODEC][DeviceTree] KVA_VENC_BASE(0x%lx), KVA_VDEC_BASE(0x%lx), KVA_VDEC_GCON_BASE(0x%lx)", KVA_VENC_BASE, KVA_VDEC_BASE, KVA_VDEC_GCON_BASE);
MFV_LOGD("[VCODEC][DeviceTree] VDEC_IRQ_ID(%d), VENC_IRQ_ID(%d)", VDEC_IRQ_ID, VENC_IRQ_ID);
}
// KVA_VENC_IRQ_STATUS_ADDR = (VAL_ULONG_T)ioremap(VENC_IRQ_STATUS_addr, 4);
// KVA_VENC_IRQ_ACK_ADDR = (VAL_ULONG_T)ioremap(VENC_IRQ_ACK_addr, 4);
#ifdef VENC_PWR_FPGA // useless 2014_3_4
KVA_VENC_CLK_CFG_0_ADDR = (VAL_ULONG_T)ioremap(CLK_CFG_0_addr, 4);
KVA_VENC_CLK_CFG_4_ADDR = (VAL_ULONG_T)ioremap(CLK_CFG_4_addr, 4);
KVA_VENC_PWR_ADDR = (VAL_ULONG_T)ioremap(VENC_PWR_addr, 4);
KVA_VENCSYS_CG_SET_ADDR = (VAL_ULONG_T)ioremap(VENCSYS_CG_SET_addr, 4);
#endif
spin_lock_irqsave(&LockDecHWCountLock, ulFlagsLockHW);
gu4LockDecHWCount = 0;
spin_unlock_irqrestore(&LockDecHWCountLock, ulFlagsLockHW);
spin_lock_irqsave(&LockEncHWCountLock, ulFlagsLockHW);
gu4LockEncHWCount = 0;
spin_unlock_irqrestore(&LockEncHWCountLock, ulFlagsLockHW);
spin_lock_irqsave(&DecISRCountLock, ulFlagsISR);
gu4DecISRCount = 0;
spin_unlock_irqrestore(&DecISRCountLock, ulFlagsISR);
spin_lock_irqsave(&EncISRCountLock, ulFlagsISR);
gu4EncISRCount = 0;
spin_unlock_irqrestore(&EncISRCountLock, ulFlagsISR);
mutex_lock(&VdecPWRLock);
gu4VdecPWRCounter = 0;
mutex_unlock(&VdecPWRLock);
mutex_lock(&VencPWRLock);
gu4VencPWRCounter = 0;
mutex_unlock(&VencPWRLock);
mutex_lock(&IsOpenedLock);
if (VAL_FALSE == bIsOpened)
{
bIsOpened = VAL_TRUE;
//vcodec_probe(NULL);
}
mutex_unlock(&IsOpenedLock);
mutex_lock(&VdecHWLock);
gu4VdecLockThreadId = 0;
grVcodecDecHWLock.pvHandle = 0;
grVcodecDecHWLock.eDriverType = VAL_DRIVER_TYPE_NONE;
grVcodecDecHWLock.rLockedTime.u4Sec = 0;
grVcodecDecHWLock.rLockedTime.u4uSec = 0;
mutex_unlock(&VdecHWLock);
mutex_lock(&VencHWLock);
grVcodecEncHWLock.pvHandle = 0;
grVcodecEncHWLock.eDriverType = VAL_DRIVER_TYPE_NONE;
grVcodecEncHWLock.rLockedTime.u4Sec = 0;
grVcodecEncHWLock.rLockedTime.u4uSec = 0;
mutex_unlock(&VencHWLock);
//HWLockEvent part
mutex_lock(&DecHWLockEventTimeoutLock);
DecHWLockEvent.pvHandle = "DECHWLOCK_EVENT";
DecHWLockEvent.u4HandleSize = sizeof("DECHWLOCK_EVENT") + 1;
DecHWLockEvent.u4TimeoutMs = 1;
mutex_unlock(&DecHWLockEventTimeoutLock);
eValHWLockRet = eVideoCreateEvent(&DecHWLockEvent, sizeof(VAL_EVENT_T));
if (VAL_RESULT_NO_ERROR != eValHWLockRet)
{
MFV_LOGE("[VCODEC][ERROR] create dec hwlock event error\n");
}
mutex_lock(&EncHWLockEventTimeoutLock);
EncHWLockEvent.pvHandle = "ENCHWLOCK_EVENT";
EncHWLockEvent.u4HandleSize = sizeof("ENCHWLOCK_EVENT") + 1;
EncHWLockEvent.u4TimeoutMs = 1;
mutex_unlock(&EncHWLockEventTimeoutLock);
eValHWLockRet = eVideoCreateEvent(&EncHWLockEvent, sizeof(VAL_EVENT_T));
if (VAL_RESULT_NO_ERROR != eValHWLockRet)
{
MFV_LOGE("[VCODEC][ERROR] create enc hwlock event error\n");
}
//IsrEvent part
spin_lock_irqsave(&DecIsrLock, ulFlags);
DecIsrEvent.pvHandle = "DECISR_EVENT";
DecIsrEvent.u4HandleSize = sizeof("DECISR_EVENT") + 1;
DecIsrEvent.u4TimeoutMs = 1;
spin_unlock_irqrestore(&DecIsrLock, ulFlags);
eValHWLockRet = eVideoCreateEvent(&DecIsrEvent, sizeof(VAL_EVENT_T));
if (VAL_RESULT_NO_ERROR != eValHWLockRet)
{
MFV_LOGE("[VCODEC][ERROR] create dec isr event error\n");
}
spin_lock_irqsave(&EncIsrLock, ulFlags);
EncIsrEvent.pvHandle = "ENCISR_EVENT";
EncIsrEvent.u4HandleSize = sizeof("ENCISR_EVENT") + 1;
EncIsrEvent.u4TimeoutMs = 1;
spin_unlock_irqrestore(&EncIsrLock, ulFlags);
eValHWLockRet = eVideoCreateEvent(&EncIsrEvent, sizeof(VAL_EVENT_T));
if (VAL_RESULT_NO_ERROR != eValHWLockRet)
{
MFV_LOGE("[VCODEC][ERROR] create enc isr event error\n");
}
MFV_LOGD("vcodec_driver_init Done\n");
#ifdef CONFIG_MTK_HIBERNATION
register_swsusp_restore_noirq_func(ID_M_VCODEC, vcodec_pm_restore_noirq, NULL);
#endif
return platform_driver_register(&vcodec_driver);
}
static void __exit vcodec_driver_exit(void)
{
VAL_RESULT_T eValHWLockRet;
MFV_LOGD("vcodec_driver_exit\n");
mutex_lock(&IsOpenedLock);
if (VAL_TRUE == bIsOpened)
{
bIsOpened = VAL_FALSE;
}
mutex_unlock(&IsOpenedLock);
cdev_del(vcodec_cdev);
unregister_chrdev_region(vcodec_devno, 1);
// [TODO] iounmap the following?
#if 0
iounmap((void *)KVA_VENC_IRQ_STATUS_ADDR);
iounmap((void *)KVA_VENC_IRQ_ACK_ADDR);
#endif
#ifdef VENC_PWR_FPGA
iounmap((void *)KVA_VENC_CLK_CFG_0_ADDR);
iounmap((void *)KVA_VENC_CLK_CFG_4_ADDR);
iounmap((void *)KVA_VENC_PWR_ADDR);
iounmap((void *)KVA_VENCSYS_CG_SET_ADDR);
#endif
// [TODO] free IRQ here
//free_irq(MT_VENC_IRQ_ID, NULL);
free_irq(VENC_IRQ_ID, NULL);
//free_irq(MT_VDEC_IRQ_ID, NULL);
free_irq(VDEC_IRQ_ID, NULL);
//MT6589_HWLockEvent part
eValHWLockRet = eVideoCloseEvent(&DecHWLockEvent, sizeof(VAL_EVENT_T));
if (VAL_RESULT_NO_ERROR != eValHWLockRet)
{
MFV_LOGE("[VCODEC][ERROR] close dec hwlock event error\n");
}
eValHWLockRet = eVideoCloseEvent(&EncHWLockEvent, sizeof(VAL_EVENT_T));
if (VAL_RESULT_NO_ERROR != eValHWLockRet)
{
MFV_LOGE("[VCODEC][ERROR] close enc hwlock event error\n");
}
//MT6589_IsrEvent part
eValHWLockRet = eVideoCloseEvent(&DecIsrEvent, sizeof(VAL_EVENT_T));
if (VAL_RESULT_NO_ERROR != eValHWLockRet)
{
MFV_LOGE("[VCODEC][ERROR] close dec isr event error\n");
}
eValHWLockRet = eVideoCloseEvent(&EncIsrEvent, sizeof(VAL_EVENT_T));
if (VAL_RESULT_NO_ERROR != eValHWLockRet)
{
MFV_LOGE("[VCODEC][ERROR] close enc isr event error\n");
}
#ifdef CONFIG_MTK_HIBERNATION
unregister_swsusp_restore_noirq_func(ID_M_VCODEC);
#endif
platform_driver_unregister(&vcodec_driver);
}
module_init(vcodec_driver_init);
module_exit(vcodec_driver_exit);
MODULE_AUTHOR("Legis, Lu <legis.lu@mediatek.com>");
MODULE_DESCRIPTION("Denali-1 Vcodec Driver");
MODULE_LICENSE("GPL");
| valascus/android_p8000_kernel_nougat | drivers/misc/mediatek/videocodec/mt6735/videocodec_kernel_driver_D1.c | C | gpl-3.0 | 104,623 |
define(
({
"collapse": "Spusti traku s alatima editora",
"expand": "Proširi traku s alatima editora"
})
);
| avz-cmf/zaboy-middleware | www/js/dojox/editor/plugins/nls/hr/CollapsibleToolbar.js | JavaScript | gpl-3.0 | 110 |
-----------------------------------
-- Area: Middle Delkfutt's Tower
-- MOB: Tower Bats
-----------------------------------
require("scripts/globals/groundsofvalor");
-----------------------------------
-- onMobDeath
-----------------------------------
function onMobDeath(mob, player, isKiller)
checkGoVregime(player,mob,782,2);
checkGoVregime(player,mob,783,2);
end; | Scavenge/darkstar | scripts/zones/Middle_Delkfutts_Tower/mobs/Tower_Bats.lua | Lua | gpl-3.0 | 380 |
// Copyright 2014 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package upgrader
import (
"github.com/juju/juju/agent/tools"
"github.com/juju/juju/version"
)
// UpgradeReadyError is returned by an Upgrader to report that
// an upgrade is ready to be performed and a restart is due.
type UpgradeReadyError struct {
AgentName string
OldTools version.Binary
NewTools version.Binary
DataDir string
}
func (e *UpgradeReadyError) Error() string {
return "must restart: an agent upgrade is available"
}
// ChangeAgentTools does the actual agent upgrade.
// It should be called just before an agent exits, so that
// it will restart running the new tools.
func (e *UpgradeReadyError) ChangeAgentTools() error {
agentTools, err := tools.ChangeAgentTools(e.DataDir, e.AgentName, e.NewTools)
if err != nil {
return err
}
logger.Infof("upgraded from %v to %v (%q)", e.OldTools, agentTools.Version, agentTools.URL)
return nil
}
| tsakas/juju | worker/upgrader/error.go | GO | agpl-3.0 | 967 |
// stdafx.cpp : source file that includes just the standard includes
// xpad.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
string format(const char* fmt, ...)
{
va_list args;
va_start(args, fmt);
int result = -1, length = 256;
char* buffer = NULL;
while(result == -1)
{
if(buffer) delete [] buffer;
buffer = new char[length + 1];
memset(buffer, 0, length + 1);
result = _vsnprintf(buffer, length, fmt, args);
length *= 2;
}
va_end(args);
string s(buffer);
delete [] buffer;
return s;
}
| Pistachioman/pcsx2 | plugins/CDVDolio/stdafx.cpp | C++ | lgpl-3.0 | 679 |
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_HangoutsChat_Image extends Google_Model
{
public $aspectRatio;
public $imageUrl;
protected $onClickType = 'Google_Service_HangoutsChat_OnClick';
protected $onClickDataType = '';
public function setAspectRatio($aspectRatio)
{
$this->aspectRatio = $aspectRatio;
}
public function getAspectRatio()
{
return $this->aspectRatio;
}
public function setImageUrl($imageUrl)
{
$this->imageUrl = $imageUrl;
}
public function getImageUrl()
{
return $this->imageUrl;
}
/**
* @param Google_Service_HangoutsChat_OnClick
*/
public function setOnClick(Google_Service_HangoutsChat_OnClick $onClick)
{
$this->onClick = $onClick;
}
/**
* @return Google_Service_HangoutsChat_OnClick
*/
public function getOnClick()
{
return $this->onClick;
}
}
| drthomas21/WordPress_Tutorial | wordpress_htdocs/wp-content/plugins/swg-youtube-vids/vendor/google/apiclient-services/src/Google/Service/HangoutsChat/Image.php | PHP | apache-2.0 | 1,427 |
<!DOCTYPE html>
<html>
<head>
<title>dom_test</title>
<script src="test_bootstrap.js"></script>
<script type="text/javascript">
goog.require('bot.dom.core');
goog.require('bot.userAgent');
goog.require('goog.testing.jsunit');
goog.require('goog.userAgent');
</script>
<body>
<script type="text/javascript">
function testStandardizeStyleAttributeReturnsIdenticalStringWithLowercasedPropertyNames() {
var toTest = [
{input: "Left: 0px; Text-align: center;",
expected: "left: 0px; text-align: center;"},
{input: "background-image: url('testdata/kitten3.jpg');",
expected: "background-image: url('testdata/kitten3.jpg');"},
{input: "-ms-filter: 'progid:DXImageTransform(strength=50)," +
" progid:DXImageTransform.(mirror=1)';",
expected: "-ms-filter: 'progid:DXImageTransform(strength=50)," +
" progid:DXImageTransform.(mirror=1)';"}
];
for (var i = 0; i < toTest.length; i++) {
assertObjectEquals(toTest[i].expected,
bot.dom.core.standardizeStyleAttribute_(toTest[i].input));
}
}
function testStandardizeStyleAttributeAppendsAMissingSemicolonToTheEndOfTheString() {
assertEquals("background-color:green; width:100px; height:50px;",
bot.dom.core.standardizeStyleAttribute_(
"background-color:green; width:100px; height:50px")
);
}
function testStandardizeStyleAttributeShouldWorkWithQuotesAndParens() {
if (goog.userAgent.IE && !bot.userAgent.isProductVersion(7)) {
// IE6 cannot properly parse the embedded semicolons in the strings below.
return;
}
var toTest = [
{input: "key:value", expected: "key:value;"},
{input: "key:value;", expected: "key:value;"},
{input: "key1:value1; key2: value2",
expected: "key1:value1; key2: value2;"},
{input: "key1:value1; key2: value2(semi;colons;in;here;)",
expected: "key1:value1; key2: value2(semi;colons;in;here;);"},
{input: "key1:value1; key2: 'string; with; semicolons; and more';",
expected: "key1:value1; key2: 'string; with; semicolons; and more';"},
{input: "key1:value1; key2: 'string; with; semicolons; and more'",
expected: "key1:value1; key2: 'string; with; semicolons; and more';"},
{input: "key1:value1;" +
" key2: url('something;with;semicolons;?oh=yeah&x=y');" +
" key3:'string;with;semicolons;'",
expected: "key1:value1;" +
" key2: url('something;with;semicolons;?oh=yeah&x=y');" +
" key3:'string;with;semicolons;';"},
{input: "key1:\"double;quoted;string!\";" +
" key2:'single;quoted;string;';" +
" key3:it(is;in;parens);",
expected: "key1:\"double;quoted;string!\";" +
" key2:'single;quoted;string;'; key3:it(is;in;parens);"}
];
for (var i = 0; i < toTest.length; i++) {
assertObjectEquals(toTest[i].expected,
bot.dom.core.standardizeStyleAttribute_(toTest[i].input));
}
}
</script>
</body>
</html>
| SeleniumHQ/htmlunit-driver | src/test/resources/javascript/atoms/test/dom_test.html | HTML | apache-2.0 | 3,025 |
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// 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.
// ----------------------------------------------------------------------------------
namespace Microsoft.Azure.Commands.Sql.SecureConnection.Model
{
/// <summary>
/// A class representing a database's secure connection policy
/// </summary>
public class DatabaseSecureConnectionPolicyModel : BaseSecureConnectionPolicyModel
{
/// <summary>
/// The internal ConnectionString field
/// </summary>
private ConnectionStrings m_ConnectionStrings;
/// <summary>
/// Gets or sets the database name
/// </summary>
public string DatabaseName { get; set; }
/// <summary>
/// Lazy set of the connection string object
/// </summary>
public ConnectionStrings ConnectionStrings
{
get
{
if (m_ConnectionStrings == null)
{
if (ProxyDnsName != null && ProxyPort != null && ServerName != null && DatabaseName != null)
{
m_ConnectionStrings = new ConnectionStrings(ProxyDnsName, ProxyPort, ServerName, DatabaseName);
}
}
return m_ConnectionStrings;
}
}
}
}
| atpham256/azure-powershell | src/ResourceManager/Sql/Commands.Sql/Secure Connection/Model/DatabaseSecureConnectionPolicyModel.cs | C# | apache-2.0 | 1,931 |
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
using Microsoft.CodeAnalysis.Operations;
using Microsoft.CodeAnalysis.Shared.Utilities;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.PopulateSwitch
{
internal static class PopulateSwitchHelpers
{
public const string MissingCases = nameof(MissingCases);
public const string MissingDefaultCase = nameof(MissingDefaultCase);
public static bool HasDefaultCase(ISwitchOperation switchStatement)
{
for (var index = switchStatement.Cases.Length - 1; index >= 0; index--)
{
if (HasDefaultCase(switchStatement.Cases[index]))
{
return true;
}
}
return false;
}
private static bool HasDefaultCase(ISwitchCaseOperation switchCase)
{
foreach (var clause in switchCase.Clauses)
{
if (clause.CaseKind == CaseKind.Default)
{
return true;
}
}
return false;
}
public static ICollection<ISymbol> GetMissingEnumMembers(ISwitchOperation switchStatement)
{
var switchExpression = switchStatement.Value;
var switchExpressionType = switchExpression?.Type;
var enumMembers = new Dictionary<long, ISymbol>();
if (switchExpressionType?.TypeKind == TypeKind.Enum)
{
if (!TryGetAllEnumMembers(switchExpressionType, enumMembers) ||
!TryRemoveExistingEnumMembers(switchStatement, enumMembers))
{
return SpecializedCollections.EmptyCollection<ISymbol>();
}
}
return enumMembers.Values;
}
private static bool TryRemoveExistingEnumMembers(ISwitchOperation switchStatement, Dictionary<long, ISymbol> enumValues)
{
foreach (var switchCase in switchStatement.Cases)
{
foreach (var clause in switchCase.Clauses)
{
switch (clause.CaseKind)
{
default:
case CaseKind.None:
case CaseKind.Relational:
case CaseKind.Range:
// This was some sort of complex switch. For now just ignore
// these and assume that they're complete.
return false;
case CaseKind.Default:
// ignore the 'default/else' clause.
continue;
case CaseKind.SingleValue:
var value = ((ISingleValueCaseClauseOperation)clause).Value;
if (value == null || !value.ConstantValue.HasValue)
{
// We had a case which didn't resolve properly.
// Assume the switch is complete.
return false;
}
var caseValue = IntegerUtilities.ToInt64(value.ConstantValue.Value);
enumValues.Remove(caseValue);
break;
}
}
}
return true;
}
private static bool TryGetAllEnumMembers(
ITypeSymbol enumType,
Dictionary<long, ISymbol> enumValues)
{
foreach (var member in enumType.GetMembers())
{
// skip `.ctor` and `__value`
var fieldSymbol = member as IFieldSymbol;
if (fieldSymbol == null || fieldSymbol.Type.SpecialType != SpecialType.None)
{
continue;
}
if (fieldSymbol.ConstantValue == null)
{
// We have an enum that has problems with it (i.e. non-const members). We won't
// be able to determine properly if the switch is complete. Assume it is so we
// don't offer to do anything.
return false;
}
// Multiple enum members may have the same value. Only consider the first one
// we run int.
var enumValue = IntegerUtilities.ToInt64(fieldSymbol.ConstantValue);
if (!enumValues.ContainsKey(enumValue))
{
enumValues.Add(enumValue, fieldSymbol);
}
}
return true;
}
}
}
| mmitche/roslyn | src/Features/Core/Portable/PopulateSwitch/PopulateSwitchHelpers.cs | C# | apache-2.0 | 4,898 |
/*
Copyright 2018 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package csi
import (
"fmt"
"os"
"path"
"path/filepath"
"testing"
api "k8s.io/api/core/v1"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
fakeclient "k8s.io/client-go/kubernetes/fake"
"k8s.io/kubernetes/pkg/volume"
volumetest "k8s.io/kubernetes/pkg/volume/testing"
)
func TestBlockMapperGetGlobalMapPath(t *testing.T) {
plug, tmpDir := newTestPlugin(t)
defer os.RemoveAll(tmpDir)
// TODO (vladimirvivien) specName with slashes will not work
testCases := []struct {
name string
specVolumeName string
path string
}{
{
name: "simple specName",
specVolumeName: "spec-0",
path: path.Join(tmpDir, fmt.Sprintf("plugins/kubernetes.io/csi/volumeDevices/%s/%s", "spec-0", "dev")),
},
{
name: "specName with dots",
specVolumeName: "test.spec.1",
path: path.Join(tmpDir, fmt.Sprintf("plugins/kubernetes.io/csi/volumeDevices/%s/%s", "test.spec.1", "dev")),
},
}
for _, tc := range testCases {
t.Logf("test case: %s", tc.name)
pv := makeTestPV(tc.specVolumeName, 10, testDriver, testVol)
spec := volume.NewSpecFromPersistentVolume(pv, pv.Spec.PersistentVolumeSource.CSI.ReadOnly)
mapper, err := plug.NewBlockVolumeMapper(
spec,
&api.Pod{ObjectMeta: meta.ObjectMeta{UID: testPodUID, Namespace: testns}},
volume.VolumeOptions{},
)
if err != nil {
t.Fatalf("Failed to make a new Mapper: %v", err)
}
csiMapper := mapper.(*csiBlockMapper)
path, err := csiMapper.GetGlobalMapPath(spec)
if err != nil {
t.Errorf("mapper GetGlobalMapPath failed: %v", err)
}
if tc.path != path {
t.Errorf("expecting path %s, got %s", tc.path, path)
}
}
}
func TestBlockMapperSetupDevice(t *testing.T) {
plug, tmpDir := newTestPlugin(t)
defer os.RemoveAll(tmpDir)
fakeClient := fakeclient.NewSimpleClientset()
host := volumetest.NewFakeVolumeHostWithNodeName(
tmpDir,
fakeClient,
nil,
"fakeNode",
)
plug.host = host
pv := makeTestPV("test-pv", 10, testDriver, testVol)
pvName := pv.GetName()
nodeName := string(plug.host.GetNodeName())
spec := volume.NewSpecFromPersistentVolume(pv, pv.Spec.PersistentVolumeSource.CSI.ReadOnly)
// MapDevice
mapper, err := plug.NewBlockVolumeMapper(
spec,
&api.Pod{ObjectMeta: meta.ObjectMeta{UID: testPodUID, Namespace: testns}},
volume.VolumeOptions{},
)
if err != nil {
t.Fatalf("failed to create new mapper: %v", err)
}
csiMapper := mapper.(*csiBlockMapper)
csiMapper.csiClient = setupClient(t, true)
attachID := getAttachmentName(csiMapper.volumeID, csiMapper.driverName, string(nodeName))
attachment := makeTestAttachment(attachID, nodeName, pvName)
attachment.Status.Attached = true
_, err = csiMapper.k8s.StorageV1beta1().VolumeAttachments().Create(attachment)
if err != nil {
t.Fatalf("failed to setup VolumeAttachment: %v", err)
}
t.Log("created attachement ", attachID)
devicePath, err := csiMapper.SetUpDevice()
if err != nil {
t.Fatalf("mapper failed to SetupDevice: %v", err)
}
globalMapPath, err := csiMapper.GetGlobalMapPath(spec)
if err != nil {
t.Fatalf("mapper failed to GetGlobalMapPath: %v", err)
}
if devicePath != globalMapPath {
t.Fatalf("mapper.SetupDevice returned unexpected path %s instead of %v", devicePath, globalMapPath)
}
vols := csiMapper.csiClient.(*fakeCsiDriverClient).nodeClient.GetNodeStagedVolumes()
if vols[csiMapper.volumeID] != devicePath {
t.Error("csi server may not have received NodePublishVolume call")
}
}
func TestBlockMapperMapDevice(t *testing.T) {
plug, tmpDir := newTestPlugin(t)
defer os.RemoveAll(tmpDir)
fakeClient := fakeclient.NewSimpleClientset()
host := volumetest.NewFakeVolumeHostWithNodeName(
tmpDir,
fakeClient,
nil,
"fakeNode",
)
plug.host = host
pv := makeTestPV("test-pv", 10, testDriver, testVol)
pvName := pv.GetName()
nodeName := string(plug.host.GetNodeName())
spec := volume.NewSpecFromPersistentVolume(pv, pv.Spec.PersistentVolumeSource.CSI.ReadOnly)
// MapDevice
mapper, err := plug.NewBlockVolumeMapper(
spec,
&api.Pod{ObjectMeta: meta.ObjectMeta{UID: testPodUID, Namespace: testns}},
volume.VolumeOptions{},
)
if err != nil {
t.Fatalf("failed to create new mapper: %v", err)
}
csiMapper := mapper.(*csiBlockMapper)
csiMapper.csiClient = setupClient(t, true)
attachID := getAttachmentName(csiMapper.volumeID, csiMapper.driverName, string(nodeName))
attachment := makeTestAttachment(attachID, nodeName, pvName)
attachment.Status.Attached = true
_, err = csiMapper.k8s.StorageV1beta1().VolumeAttachments().Create(attachment)
if err != nil {
t.Fatalf("failed to setup VolumeAttachment: %v", err)
}
t.Log("created attachement ", attachID)
devicePath, err := csiMapper.SetUpDevice()
if err != nil {
t.Fatalf("mapper failed to SetupDevice: %v", err)
}
globalMapPath, err := csiMapper.GetGlobalMapPath(csiMapper.spec)
if err != nil {
t.Fatalf("mapper failed to GetGlobalMapPath: %v", err)
}
// Map device to global and pod device map path
volumeMapPath, volName := csiMapper.GetPodDeviceMapPath()
err = csiMapper.MapDevice(devicePath, globalMapPath, volumeMapPath, volName, csiMapper.podUID)
if err != nil {
t.Fatalf("mapper failed to GetGlobalMapPath: %v", err)
}
if _, err := os.Stat(filepath.Join(volumeMapPath, volName)); err != nil {
if os.IsNotExist(err) {
t.Errorf("mapper.MapDevice failed, volume path not created: %s", volumeMapPath)
} else {
t.Errorf("mapper.MapDevice failed: %v", err)
}
}
pubs := csiMapper.csiClient.(*fakeCsiDriverClient).nodeClient.GetNodePublishedVolumes()
if pubs[csiMapper.volumeID] != volumeMapPath {
t.Error("csi server may not have received NodePublishVolume call")
}
}
func TestBlockMapperTearDownDevice(t *testing.T) {
plug, tmpDir := newTestPlugin(t)
defer os.RemoveAll(tmpDir)
fakeClient := fakeclient.NewSimpleClientset()
host := volumetest.NewFakeVolumeHostWithNodeName(
tmpDir,
fakeClient,
nil,
"fakeNode",
)
plug.host = host
pv := makeTestPV("test-pv", 10, testDriver, testVol)
spec := volume.NewSpecFromPersistentVolume(pv, pv.Spec.PersistentVolumeSource.CSI.ReadOnly)
// save volume data
dir := getVolumeDeviceDataDir(pv.ObjectMeta.Name, plug.host)
if err := os.MkdirAll(dir, 0755); err != nil && !os.IsNotExist(err) {
t.Errorf("failed to create dir [%s]: %v", dir, err)
}
if err := saveVolumeData(
dir,
volDataFileName,
map[string]string{
volDataKey.specVolID: pv.ObjectMeta.Name,
volDataKey.driverName: testDriver,
volDataKey.volHandle: testVol,
},
); err != nil {
t.Fatalf("failed to save volume data: %v", err)
}
unmapper, err := plug.NewBlockVolumeUnmapper(pv.ObjectMeta.Name, testPodUID)
if err != nil {
t.Fatalf("failed to make a new Unmapper: %v", err)
}
csiUnmapper := unmapper.(*csiBlockMapper)
csiUnmapper.csiClient = setupClient(t, true)
globalMapPath, err := csiUnmapper.GetGlobalMapPath(spec)
if err != nil {
t.Fatalf("unmapper failed to GetGlobalMapPath: %v", err)
}
err = csiUnmapper.TearDownDevice(globalMapPath, "/dev/test")
if err != nil {
t.Fatal(err)
}
// ensure csi client call and node unstaged
vols := csiUnmapper.csiClient.(*fakeCsiDriverClient).nodeClient.GetNodeStagedVolumes()
if _, ok := vols[csiUnmapper.volumeID]; ok {
t.Error("csi server may not have received NodeUnstageVolume call")
}
// ensure csi client call and node unpblished
pubs := csiUnmapper.csiClient.(*fakeCsiDriverClient).nodeClient.GetNodePublishedVolumes()
if _, ok := pubs[csiUnmapper.volumeID]; ok {
t.Error("csi server may not have received NodeUnpublishVolume call")
}
}
| imcsk8/origin | vendor/k8s.io/kubernetes/pkg/volume/csi/csi_block_test.go | GO | apache-2.0 | 8,146 |
'use strict';
angular.module('openshiftConsole')
.directive('overviewDeployment', function($location, $timeout, LabelFilter) {
return {
restrict: 'E',
scope: {
// Replication controller / deployment fields
rc: '=',
deploymentConfigId: '=',
deploymentConfigMissing: '=',
deploymentConfigDifferentService: '=',
// Nested podTemplate fields
imagesByDockerReference: '=',
builds: '=',
// Pods
pods: '='
},
templateUrl: 'views/_overview-deployment.html',
controller: function($scope) {
$scope.viewPodsForDeployment = function(deployment) {
$location.url("/project/" + deployment.metadata.namespace + "/browse/pods");
$timeout(function() {
LabelFilter.setLabelSelector(new LabelSelector(deployment.spec.selector, true));
}, 1);
};
}
};
})
.directive('overviewMonopod', function() {
return {
restrict: 'E',
scope: {
pod: '='
},
templateUrl: 'views/_overview-monopod.html'
};
})
.directive('podTemplate', function() {
return {
restrict: 'E',
scope: {
podTemplate: '=',
imagesByDockerReference: '=',
builds: '='
},
templateUrl: 'views/_pod-template.html'
};
})
.directive('pods', function() {
return {
restrict: 'E',
scope: {
pods: '=',
projectName: '@?' //TODO optional for now
},
templateUrl: 'views/_pods.html',
controller: function($scope) {
$scope.phases = [
"Failed",
"Pending",
"Running",
"Succeeded",
"Unknown"
];
$scope.expandedPhase = null;
$scope.warningsExpanded = false;
$scope.expandPhase = function(phase, warningsExpanded, $event) {
$scope.expandedPhase = phase;
$scope.warningsExpanded = warningsExpanded;
if ($event) {
$event.stopPropagation();
}
};
}
};
})
.directive('podContent', function() {
// sub-directive used by the pods directive
return {
restrict: 'E',
scope: {
pod: '=',
troubled: '='
},
templateUrl: 'views/directives/_pod-content.html'
};
})
.directive('triggers', function() {
var hideBuildKey = function(build) {
return 'hide/build/' + build.metadata.namespace + '/' + build.metadata.name;
};
return {
restrict: 'E',
scope: {
triggers: '='
},
link: function(scope) {
scope.isBuildHidden = function(build) {
var key = hideBuildKey(build);
return sessionStorage.getItem(key) === 'true';
};
scope.hideBuild = function(build) {
var key = hideBuildKey(build);
sessionStorage.setItem(key, 'true');
};
},
templateUrl: 'views/_triggers.html'
};
})
.directive('deploymentConfigMetadata', function() {
return {
restrict: 'E',
scope: {
deploymentConfigId: '=',
exists: '=',
differentService: '='
},
templateUrl: 'views/_deployment-config-metadata.html'
};
});
| domenicbove/origin | assets/app/scripts/directives/resources.js | JavaScript | apache-2.0 | 3,240 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0-google-internal) on Wed Dec 30 10:35:12 PST 2009 -->
<TITLE>
Uses of Interface com.google.common.collect.Multimap (Google Collections Library 1.0 (FINAL))
</TITLE>
<META NAME="date" CONTENT="2009-12-30">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Interface com.google.common.collect.Multimap (Google Collections Library 1.0 (FINAL))";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?com/google/common/collect//class-useMultimap.html" target="_top"><B>FRAMES</B></A>
<A HREF="Multimap.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<CENTER>
<H2>
<B>Uses of Interface<br>com.google.common.collect.Multimap</B></H2>
</CENTER>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Packages that use <A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="#com.google.common.collect"><B>com.google.common.collect</B></A></TD>
<TD>This package contains generic collection interfaces and implementations, and
other utilities for working with collections. </TD>
</TR>
</TABLE>
<P>
<A NAME="com.google.common.collect"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Uses of <A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A> in <A HREF="../../../../../com/google/common/collect/package-summary.html">com.google.common.collect</A></FONT></TH>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left" COLSPAN="2">Subinterfaces of <A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A> in <A HREF="../../../../../com/google/common/collect/package-summary.html">com.google.common.collect</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> interface</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/google/common/collect/ListMultimap.html" title="interface in com.google.common.collect">ListMultimap<K,V></A></B></CODE>
<BR>
A <code>Multimap</code> that can hold duplicate key-value pairs and that maintains
the insertion ordering of values for a given key.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> interface</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/google/common/collect/SetMultimap.html" title="interface in com.google.common.collect">SetMultimap<K,V></A></B></CODE>
<BR>
A <code>Multimap</code> that cannot hold duplicate key-value pairs.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> interface</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/google/common/collect/SortedSetMultimap.html" title="interface in com.google.common.collect">SortedSetMultimap<K,V></A></B></CODE>
<BR>
A <code>SetMultimap</code> whose set of values for a given key are kept sorted;
that is, they comprise a <A HREF="http://java.sun.com/javase/6/docs/api/java/util/SortedSet.html?is-external=true" title="class or interface in java.util"><CODE>SortedSet</CODE></A>.</TD>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left" COLSPAN="2">Classes in <A HREF="../../../../../com/google/common/collect/package-summary.html">com.google.common.collect</A> that implement <A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> class</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/google/common/collect/ArrayListMultimap.html" title="class in com.google.common.collect">ArrayListMultimap<K,V></A></B></CODE>
<BR>
Implementation of <code>Multimap</code> that uses an <code>ArrayList</code> to store
the values for a given key.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> class</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/google/common/collect/ForwardingMultimap.html" title="class in com.google.common.collect">ForwardingMultimap<K,V></A></B></CODE>
<BR>
A multimap which forwards all its method calls to another multimap.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> class</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/google/common/collect/HashMultimap.html" title="class in com.google.common.collect">HashMultimap<K,V></A></B></CODE>
<BR>
Implementation of <A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect"><CODE>Multimap</CODE></A> using hash tables.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> class</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/google/common/collect/ImmutableListMultimap.html" title="class in com.google.common.collect">ImmutableListMultimap<K,V></A></B></CODE>
<BR>
An immutable <A HREF="../../../../../com/google/common/collect/ListMultimap.html" title="interface in com.google.common.collect"><CODE>ListMultimap</CODE></A> with reliable user-specified key and value
iteration order.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> class</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/google/common/collect/ImmutableMultimap.html" title="class in com.google.common.collect">ImmutableMultimap<K,V></A></B></CODE>
<BR>
An immutable <A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect"><CODE>Multimap</CODE></A>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> class</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/google/common/collect/ImmutableSetMultimap.html" title="class in com.google.common.collect">ImmutableSetMultimap<K,V></A></B></CODE>
<BR>
An immutable <A HREF="../../../../../com/google/common/collect/SetMultimap.html" title="interface in com.google.common.collect"><CODE>SetMultimap</CODE></A> with reliable user-specified key and value
iteration order.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> class</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/google/common/collect/LinkedHashMultimap.html" title="class in com.google.common.collect">LinkedHashMultimap<K,V></A></B></CODE>
<BR>
Implementation of <code>Multimap</code> that does not allow duplicate key-value
entries and that returns collections whose iterators follow the ordering in
which the data was added to the multimap.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> class</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/google/common/collect/LinkedListMultimap.html" title="class in com.google.common.collect">LinkedListMultimap<K,V></A></B></CODE>
<BR>
An implementation of <code>ListMultimap</code> that supports deterministic
iteration order for both keys and values.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> class</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/google/common/collect/TreeMultimap.html" title="class in com.google.common.collect">TreeMultimap<K,V></A></B></CODE>
<BR>
Implementation of <code>Multimap</code> whose keys and values are ordered by
their natural ordering or by supplied comparators.</TD>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../../com/google/common/collect/package-summary.html">com.google.common.collect</A> with type parameters of type <A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
<TR ALIGN="right" VALIGN="">
<TD NOWRAP><FONT SIZE="-1">
<CODE><K,V,M extends <A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A><K,V>>
<BR>
M</CODE></FONT></TD>
</TR>
</TABLE>
</CODE></FONT></TD>
<TD><CODE><B>Multimaps.</B><B><A HREF="../../../../../com/google/common/collect/Multimaps.html#invertFrom(com.google.common.collect.Multimap, M)">invertFrom</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A><? extends V,? extends K> source,
M dest)</CODE>
<BR>
Copies each key-value mapping in <code>source</code> into <code>dest</code>, with
its key and value reversed.</TD>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../../com/google/common/collect/package-summary.html">com.google.common.collect</A> that return <A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected abstract <A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A><<A HREF="../../../../../com/google/common/collect/ForwardingMultimap.html" title="type parameter in ForwardingMultimap">K</A>,<A HREF="../../../../../com/google/common/collect/ForwardingMultimap.html" title="type parameter in ForwardingMultimap">V</A>></CODE></FONT></TD>
<TD><CODE><B>ForwardingMultimap.</B><B><A HREF="../../../../../com/google/common/collect/ForwardingMultimap.html#delegate()">delegate</A></B>()</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
<TR ALIGN="right" VALIGN="">
<TD NOWRAP><FONT SIZE="-1">
<CODE><K,V> <A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A><K,V></CODE></FONT></TD>
</TR>
</TABLE>
</CODE></FONT></TD>
<TD><CODE><B>Multimaps.</B><B><A HREF="../../../../../com/google/common/collect/Multimaps.html#newMultimap(java.util.Map, com.google.common.base.Supplier)">newMultimap</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A><K,<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</A><V>> map,
<A HREF="../../../../../com/google/common/base/Supplier.html" title="interface in com.google.common.base">Supplier</A><? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</A><V>> factory)</CODE>
<BR>
Creates a new <code>Multimap</code> that uses the provided map and factory.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
<TR ALIGN="right" VALIGN="">
<TD NOWRAP><FONT SIZE="-1">
<CODE><K,V> <A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A><K,V></CODE></FONT></TD>
</TR>
</TABLE>
</CODE></FONT></TD>
<TD><CODE><B>Multimaps.</B><B><A HREF="../../../../../com/google/common/collect/Multimaps.html#synchronizedMultimap(com.google.common.collect.Multimap)">synchronizedMultimap</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A><K,V> multimap)</CODE>
<BR>
Returns a synchronized (thread-safe) multimap backed by the specified
multimap.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
<TR ALIGN="right" VALIGN="">
<TD NOWRAP><FONT SIZE="-1">
<CODE><K,V> <A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A><K,V></CODE></FONT></TD>
</TR>
</TABLE>
</CODE></FONT></TD>
<TD><CODE><B>Multimaps.</B><B><A HREF="../../../../../com/google/common/collect/Multimaps.html#unmodifiableMultimap(com.google.common.collect.Multimap)">unmodifiableMultimap</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A><K,V> delegate)</CODE>
<BR>
Returns an unmodifiable view of the specified multimap.</TD>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../../com/google/common/collect/package-summary.html">com.google.common.collect</A> with parameters of type <A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
<TR ALIGN="right" VALIGN="">
<TD NOWRAP><FONT SIZE="-1">
<CODE><K,V> <A HREF="../../../../../com/google/common/collect/ImmutableListMultimap.html" title="class in com.google.common.collect">ImmutableListMultimap</A><K,V></CODE></FONT></TD>
</TR>
</TABLE>
</CODE></FONT></TD>
<TD><CODE><B>ImmutableListMultimap.</B><B><A HREF="../../../../../com/google/common/collect/ImmutableListMultimap.html#copyOf(com.google.common.collect.Multimap)">copyOf</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A><? extends K,? extends V> multimap)</CODE>
<BR>
Returns an immutable multimap containing the same mappings as
<code>multimap</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
<TR ALIGN="right" VALIGN="">
<TD NOWRAP><FONT SIZE="-1">
<CODE><K,V> <A HREF="../../../../../com/google/common/collect/ImmutableSetMultimap.html" title="class in com.google.common.collect">ImmutableSetMultimap</A><K,V></CODE></FONT></TD>
</TR>
</TABLE>
</CODE></FONT></TD>
<TD><CODE><B>ImmutableSetMultimap.</B><B><A HREF="../../../../../com/google/common/collect/ImmutableSetMultimap.html#copyOf(com.google.common.collect.Multimap)">copyOf</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A><? extends K,? extends V> multimap)</CODE>
<BR>
Returns an immutable set multimap containing the same mappings as
<code>multimap</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
<TR ALIGN="right" VALIGN="">
<TD NOWRAP><FONT SIZE="-1">
<CODE><K,V> <A HREF="../../../../../com/google/common/collect/ImmutableMultimap.html" title="class in com.google.common.collect">ImmutableMultimap</A><K,V></CODE></FONT></TD>
</TR>
</TABLE>
</CODE></FONT></TD>
<TD><CODE><B>ImmutableMultimap.</B><B><A HREF="../../../../../com/google/common/collect/ImmutableMultimap.html#copyOf(com.google.common.collect.Multimap)">copyOf</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A><? extends K,? extends V> multimap)</CODE>
<BR>
Returns an immutable multimap containing the same mappings as
<code>multimap</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
<TR ALIGN="right" VALIGN="">
<TD NOWRAP><FONT SIZE="-1">
<CODE><K extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Comparable.html?is-external=true" title="class or interface in java.lang">Comparable</A>,V extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Comparable.html?is-external=true" title="class or interface in java.lang">Comparable</A>>
<BR>
<A HREF="../../../../../com/google/common/collect/TreeMultimap.html" title="class in com.google.common.collect">TreeMultimap</A><K,V></CODE></FONT></TD>
</TR>
</TABLE>
</CODE></FONT></TD>
<TD><CODE><B>TreeMultimap.</B><B><A HREF="../../../../../com/google/common/collect/TreeMultimap.html#create(com.google.common.collect.Multimap)">create</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A><? extends K,? extends V> multimap)</CODE>
<BR>
Constructs a <code>TreeMultimap</code>, ordered by the natural ordering of its
keys and values, with the same mappings as the specified multimap.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
<TR ALIGN="right" VALIGN="">
<TD NOWRAP><FONT SIZE="-1">
<CODE><K,V> <A HREF="../../../../../com/google/common/collect/HashMultimap.html" title="class in com.google.common.collect">HashMultimap</A><K,V></CODE></FONT></TD>
</TR>
</TABLE>
</CODE></FONT></TD>
<TD><CODE><B>HashMultimap.</B><B><A HREF="../../../../../com/google/common/collect/HashMultimap.html#create(com.google.common.collect.Multimap)">create</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A><? extends K,? extends V> multimap)</CODE>
<BR>
Constructs a <code>HashMultimap</code> with the same mappings as the specified
multimap.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
<TR ALIGN="right" VALIGN="">
<TD NOWRAP><FONT SIZE="-1">
<CODE><K,V> <A HREF="../../../../../com/google/common/collect/ArrayListMultimap.html" title="class in com.google.common.collect">ArrayListMultimap</A><K,V></CODE></FONT></TD>
</TR>
</TABLE>
</CODE></FONT></TD>
<TD><CODE><B>ArrayListMultimap.</B><B><A HREF="../../../../../com/google/common/collect/ArrayListMultimap.html#create(com.google.common.collect.Multimap)">create</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A><? extends K,? extends V> multimap)</CODE>
<BR>
Constructs an <code>ArrayListMultimap</code> with the same mappings as the
specified multimap.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
<TR ALIGN="right" VALIGN="">
<TD NOWRAP><FONT SIZE="-1">
<CODE><K,V> <A HREF="../../../../../com/google/common/collect/LinkedListMultimap.html" title="class in com.google.common.collect">LinkedListMultimap</A><K,V></CODE></FONT></TD>
</TR>
</TABLE>
</CODE></FONT></TD>
<TD><CODE><B>LinkedListMultimap.</B><B><A HREF="../../../../../com/google/common/collect/LinkedListMultimap.html#create(com.google.common.collect.Multimap)">create</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A><? extends K,? extends V> multimap)</CODE>
<BR>
Constructs a <code>LinkedListMultimap</code> with the same mappings as the
specified <code>Multimap</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
<TR ALIGN="right" VALIGN="">
<TD NOWRAP><FONT SIZE="-1">
<CODE><K,V> <A HREF="../../../../../com/google/common/collect/LinkedHashMultimap.html" title="class in com.google.common.collect">LinkedHashMultimap</A><K,V></CODE></FONT></TD>
</TR>
</TABLE>
</CODE></FONT></TD>
<TD><CODE><B>LinkedHashMultimap.</B><B><A HREF="../../../../../com/google/common/collect/LinkedHashMultimap.html#create(com.google.common.collect.Multimap)">create</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A><? extends K,? extends V> multimap)</CODE>
<BR>
Constructs a <code>LinkedHashMultimap</code> with the same mappings as the
specified multimap.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
<TR ALIGN="right" VALIGN="">
<TD NOWRAP><FONT SIZE="-1">
<CODE><K,V,M extends <A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A><K,V>>
<BR>
M</CODE></FONT></TD>
</TR>
</TABLE>
</CODE></FONT></TD>
<TD><CODE><B>Multimaps.</B><B><A HREF="../../../../../com/google/common/collect/Multimaps.html#invertFrom(com.google.common.collect.Multimap, M)">invertFrom</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A><? extends V,? extends K> source,
M dest)</CODE>
<BR>
Copies each key-value mapping in <code>source</code> into <code>dest</code>, with
its key and value reversed.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../com/google/common/collect/ImmutableListMultimap.Builder.html" title="class in com.google.common.collect">ImmutableListMultimap.Builder</A><<A HREF="../../../../../com/google/common/collect/ImmutableListMultimap.Builder.html" title="type parameter in ImmutableListMultimap.Builder">K</A>,<A HREF="../../../../../com/google/common/collect/ImmutableListMultimap.Builder.html" title="type parameter in ImmutableListMultimap.Builder">V</A>></CODE></FONT></TD>
<TD><CODE><B>ImmutableListMultimap.Builder.</B><B><A HREF="../../../../../com/google/common/collect/ImmutableListMultimap.Builder.html#putAll(com.google.common.collect.Multimap)">putAll</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A><? extends <A HREF="../../../../../com/google/common/collect/ImmutableListMultimap.Builder.html" title="type parameter in ImmutableListMultimap.Builder">K</A>,? extends <A HREF="../../../../../com/google/common/collect/ImmutableListMultimap.Builder.html" title="type parameter in ImmutableListMultimap.Builder">V</A>> multimap)</CODE>
<BR>
Stores another multimap's entries in the built multimap.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../com/google/common/collect/ImmutableSetMultimap.Builder.html" title="class in com.google.common.collect">ImmutableSetMultimap.Builder</A><<A HREF="../../../../../com/google/common/collect/ImmutableSetMultimap.Builder.html" title="type parameter in ImmutableSetMultimap.Builder">K</A>,<A HREF="../../../../../com/google/common/collect/ImmutableSetMultimap.Builder.html" title="type parameter in ImmutableSetMultimap.Builder">V</A>></CODE></FONT></TD>
<TD><CODE><B>ImmutableSetMultimap.Builder.</B><B><A HREF="../../../../../com/google/common/collect/ImmutableSetMultimap.Builder.html#putAll(com.google.common.collect.Multimap)">putAll</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A><? extends <A HREF="../../../../../com/google/common/collect/ImmutableSetMultimap.Builder.html" title="type parameter in ImmutableSetMultimap.Builder">K</A>,? extends <A HREF="../../../../../com/google/common/collect/ImmutableSetMultimap.Builder.html" title="type parameter in ImmutableSetMultimap.Builder">V</A>> multimap)</CODE>
<BR>
Stores another multimap's entries in the built multimap.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> boolean</CODE></FONT></TD>
<TD><CODE><B>ForwardingMultimap.</B><B><A HREF="../../../../../com/google/common/collect/ForwardingMultimap.html#putAll(com.google.common.collect.Multimap)">putAll</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A><? extends <A HREF="../../../../../com/google/common/collect/ForwardingMultimap.html" title="type parameter in ForwardingMultimap">K</A>,? extends <A HREF="../../../../../com/google/common/collect/ForwardingMultimap.html" title="type parameter in ForwardingMultimap">V</A>> multimap)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> boolean</CODE></FONT></TD>
<TD><CODE><B>Multimap.</B><B><A HREF="../../../../../com/google/common/collect/Multimap.html#putAll(com.google.common.collect.Multimap)">putAll</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A><? extends <A HREF="../../../../../com/google/common/collect/Multimap.html" title="type parameter in Multimap">K</A>,? extends <A HREF="../../../../../com/google/common/collect/Multimap.html" title="type parameter in Multimap">V</A>> multimap)</CODE>
<BR>
Copies all of another multimap's key-value pairs into this multimap.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> boolean</CODE></FONT></TD>
<TD><CODE><B>LinkedListMultimap.</B><B><A HREF="../../../../../com/google/common/collect/LinkedListMultimap.html#putAll(com.google.common.collect.Multimap)">putAll</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A><? extends <A HREF="../../../../../com/google/common/collect/LinkedListMultimap.html" title="type parameter in LinkedListMultimap">K</A>,? extends <A HREF="../../../../../com/google/common/collect/LinkedListMultimap.html" title="type parameter in LinkedListMultimap">V</A>> multimap)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> boolean</CODE></FONT></TD>
<TD><CODE><B>ImmutableMultimap.</B><B><A HREF="../../../../../com/google/common/collect/ImmutableMultimap.html#putAll(com.google.common.collect.Multimap)">putAll</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A><? extends <A HREF="../../../../../com/google/common/collect/ImmutableMultimap.html" title="type parameter in ImmutableMultimap">K</A>,? extends <A HREF="../../../../../com/google/common/collect/ImmutableMultimap.html" title="type parameter in ImmutableMultimap">V</A>> multimap)</CODE>
<BR>
Guaranteed to throw an exception and leave the multimap unmodified.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../com/google/common/collect/ImmutableMultimap.Builder.html" title="class in com.google.common.collect">ImmutableMultimap.Builder</A><<A HREF="../../../../../com/google/common/collect/ImmutableMultimap.Builder.html" title="type parameter in ImmutableMultimap.Builder">K</A>,<A HREF="../../../../../com/google/common/collect/ImmutableMultimap.Builder.html" title="type parameter in ImmutableMultimap.Builder">V</A>></CODE></FONT></TD>
<TD><CODE><B>ImmutableMultimap.Builder.</B><B><A HREF="../../../../../com/google/common/collect/ImmutableMultimap.Builder.html#putAll(com.google.common.collect.Multimap)">putAll</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A><? extends <A HREF="../../../../../com/google/common/collect/ImmutableMultimap.Builder.html" title="type parameter in ImmutableMultimap.Builder">K</A>,? extends <A HREF="../../../../../com/google/common/collect/ImmutableMultimap.Builder.html" title="type parameter in ImmutableMultimap.Builder">V</A>> multimap)</CODE>
<BR>
Stores another multimap's entries in the built multimap.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
<TR ALIGN="right" VALIGN="">
<TD NOWRAP><FONT SIZE="-1">
<CODE><K,V> <A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A><K,V></CODE></FONT></TD>
</TR>
</TABLE>
</CODE></FONT></TD>
<TD><CODE><B>Multimaps.</B><B><A HREF="../../../../../com/google/common/collect/Multimaps.html#synchronizedMultimap(com.google.common.collect.Multimap)">synchronizedMultimap</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A><K,V> multimap)</CODE>
<BR>
Returns a synchronized (thread-safe) multimap backed by the specified
multimap.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
<TR ALIGN="right" VALIGN="">
<TD NOWRAP><FONT SIZE="-1">
<CODE><K,V> <A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A><K,V></CODE></FONT></TD>
</TR>
</TABLE>
</CODE></FONT></TD>
<TD><CODE><B>Multimaps.</B><B><A HREF="../../../../../com/google/common/collect/Multimaps.html#unmodifiableMultimap(com.google.common.collect.Multimap)">unmodifiableMultimap</A></B>(<A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect">Multimap</A><K,V> delegate)</CODE>
<BR>
Returns an unmodifiable view of the specified multimap.</TD>
</TR>
</TABLE>
<P>
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../com/google/common/collect/Multimap.html" title="interface in com.google.common.collect"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?com/google/common/collect//class-useMultimap.html" target="_top"><B>FRAMES</B></A>
<A HREF="Multimap.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
</BODY>
</HTML>
| MedwynLiang/google-collections | javadoc/com/google/common/collect/class-use/Multimap.html | HTML | apache-2.0 | 39,388 |
/*
* RealVideo 4 decoder
* copyright (c) 2007 Konstantin Shishkov
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file rv40vlc2.h
* RV40 VLC tables used for macroblock information decoding
*/
#ifndef FFMPEG_RV40VLC2_H
#define FFMPEG_RV40VLC2_H
#include <stdint.h>
/**
* codes used for the first four block types
*/
//@{
#define AIC_TOP_BITS 8
#define AIC_TOP_SIZE 16
static const uint8_t rv40_aic_top_vlc_codes[AIC_TOP_SIZE] = {
0x01, 0x05, 0x01, 0x00, 0x03, 0x3D, 0x1D, 0x02,
0x04, 0x3C, 0x3F, 0x1C, 0x0D, 0x3E, 0x0C, 0x01
};
static const uint8_t rv40_aic_top_vlc_bits[AIC_TOP_SIZE] = {
1, 4, 5, 5, 5, 7, 6, 5, 4, 7, 7, 6, 5, 7, 5, 3
};
//@}
/**
* codes used for determining a pair of block types
*/
//@{
#define AIC_MODE2_NUM 20
#define AIC_MODE2_SIZE 81
#define AIC_MODE2_BITS 9
static const uint16_t aic_mode2_vlc_codes[AIC_MODE2_NUM][AIC_MODE2_SIZE] = {
{ 0x0001, 0x0001, 0x0005, 0x01F5, 0x0011, 0x0049, 0x0000, 0x0048, 0x004B,
0x0035, 0x0003, 0x0034, 0x03C9, 0x01F4, 0x00C9, 0x004A, 0x0FD9, 0x03C8,
0x0010, 0x0037, 0x0001, 0x00C8, 0x0075, 0x01F7, 0x00CB, 0x0074, 0x0002,
0x01F6, 0x00CA, 0x01F1, 0x01F0, 0x1F81, 0x07F9, 0x1F80, 0x1F83, 0x07F8,
0x0077, 0x00F5, 0x0036, 0x07FB, 0x0076, 0x1F82, 0x00F4, 0x00F7, 0x07FA,
0x0071, 0x00F6, 0x03CB, 0x03CA, 0x0FD8, 0x00F1, 0x03F5, 0x1F8D, 0x07E5,
0x0013, 0x0031, 0x00F0, 0x0FDB, 0x00F3, 0x07E4, 0x0030, 0x01F3, 0x07E7,
0x03F4, 0x07E6, 0x0070, 0x3F19, 0x01F2, 0x3F18, 0x0FDA, 0x0033, 0x07E1,
0x01FD, 0x01FC, 0x0073, 0x01FF, 0x0FC5, 0x0FC4, 0x0FC7, 0x03F7, 0x0072, },
{ 0x0005, 0x0005, 0x0005, 0x0079, 0x0005, 0x000D, 0x001D, 0x0078, 0x0069,
0x0004, 0x0001, 0x0007, 0x0068, 0x001C, 0x001F, 0x0004, 0x006B, 0x000C,
0x0004, 0x001E, 0x0006, 0x006A, 0x0015, 0x000F, 0x0014, 0x0017, 0x0007,
0x0016, 0x000E, 0x0011, 0x0009, 0x00D1, 0x00D0, 0x0181, 0x00D3, 0x007B,
0x0010, 0x0013, 0x0004, 0x00D2, 0x0007, 0x0319, 0x0008, 0x007A, 0x00DD,
0x0019, 0x0006, 0x000B, 0x0065, 0x00DC, 0x0012, 0x0064, 0x0180, 0x00DF,
0x0006, 0x0018, 0x0001, 0x00DE, 0x001D, 0x00D9, 0x001B, 0x0067, 0x000A,
0x00D8, 0x00DB, 0x001C, 0x0318, 0x00DA, 0x0635, 0x0183, 0x0000, 0x00C5,
0x0066, 0x0061, 0x0035, 0x00C4, 0x0182, 0x0634, 0x031B, 0x00C7, 0x001F, },
{ 0x0005, 0x0001, 0x001D, 0x01C1, 0x0035, 0x00F1, 0x006D, 0x00F0, 0x0049,
0x0000, 0x0004, 0x0003, 0x00F3, 0x0048, 0x0034, 0x006C, 0x01C0, 0x01C3,
0x0007, 0x0006, 0x0001, 0x006F, 0x0002, 0x004B, 0x006E, 0x001C, 0x0005,
0x0069, 0x0068, 0x006B, 0x0037, 0x01C2, 0x00F2, 0x0395, 0x01CD, 0x00FD,
0x006A, 0x0036, 0x0015, 0x01CC, 0x0014, 0x0394, 0x004A, 0x00FC, 0x00FF,
0x0017, 0x0031, 0x00FE, 0x01CF, 0x0397, 0x00F9, 0x01CE, 0x0725, 0x0396,
0x0016, 0x0030, 0x0075, 0x0724, 0x00F8, 0x0727, 0x0033, 0x0391, 0x0390,
0x0011, 0x0032, 0x001F, 0x00FB, 0x0074, 0x0726, 0x00FA, 0x001E, 0x0077,
0x0019, 0x0018, 0x0004, 0x0010, 0x003D, 0x0076, 0x0071, 0x0013, 0x0001, },
{ 0x000D, 0x0019, 0x0011, 0x0015, 0x0061, 0x0019, 0x0014, 0x01AD, 0x0060,
0x0018, 0x0001, 0x0005, 0x001B, 0x0010, 0x0019, 0x0005, 0x0017, 0x0018,
0x0016, 0x0004, 0x0004, 0x0013, 0x000C, 0x0012, 0x001A, 0x0018, 0x0005,
0x000F, 0x001B, 0x0004, 0x001D, 0x0011, 0x001C, 0x0010, 0x000E, 0x001B,
0x0013, 0x001F, 0x001A, 0x0029, 0x0005, 0x0063, 0x001E, 0x0009, 0x0062,
0x0008, 0x0007, 0x0007, 0x0019, 0x0004, 0x001A, 0x0018, 0x006D, 0x0007,
0x001B, 0x0007, 0x001A, 0x006C, 0x0006, 0x0012, 0x0005, 0x006F, 0x000B,
0x006E, 0x0069, 0x001D, 0x0359, 0x0028, 0x002B, 0x002A, 0x001C, 0x00D5,
0x0358, 0x001F, 0x0001, 0x001E, 0x0068, 0x00D4, 0x00D7, 0x0019, 0x0000, },
{ 0x00B9, 0x0061, 0x0060, 0x00B8, 0x02B5, 0x01AD, 0x00BB, 0x0AF5, 0x0151,
0x0001, 0x0001, 0x0005, 0x0000, 0x0003, 0x0005, 0x0004, 0x0063, 0x0025,
0x00BA, 0x0004, 0x0007, 0x0062, 0x00A5, 0x0024, 0x006D, 0x0002, 0x006C,
0x02B4, 0x000D, 0x006F, 0x0027, 0x00A4, 0x0026, 0x01AC, 0x0150, 0x01AF,
0x01AE, 0x0021, 0x006E, 0x02B7, 0x0020, 0x0153, 0x0023, 0x00A7, 0x0152,
0x00A6, 0x0006, 0x000C, 0x0022, 0x01A9, 0x0019, 0x002D, 0x02B6, 0x01A8,
0x000F, 0x0007, 0x000E, 0x00A1, 0x0069, 0x002C, 0x0001, 0x01AB, 0x00A0,
0x02B1, 0x00A3, 0x002F, 0x0AF4, 0x02B0, 0x0AF7, 0x02B3, 0x0068, 0x015D,
0x0AF6, 0x01AA, 0x0055, 0x015C, 0x02B2, 0x0579, 0x0578, 0x015F, 0x00A2, },
{ 0x0905, 0x013D, 0x013C, 0x0904, 0x121D, 0x049D, 0x049C, 0x243D, 0x0907,
0x00ED, 0x0001, 0x0015, 0x0041, 0x013F, 0x0031, 0x0014, 0x025D, 0x025C,
0x013E, 0x000D, 0x0000, 0x0040, 0x0139, 0x0043, 0x0030, 0x0017, 0x0033,
0x0906, 0x0032, 0x0042, 0x00EC, 0x025F, 0x00EF, 0x025E, 0x049F, 0x0138,
0x0901, 0x013B, 0x0259, 0x121C, 0x049E, 0x0900, 0x0258, 0x243C, 0x121F,
0x0903, 0x003D, 0x00EE, 0x025B, 0x025A, 0x004D, 0x013A, 0x0902, 0x0245,
0x00E9, 0x0016, 0x00E8, 0x0499, 0x0125, 0x0244, 0x004C, 0x0498, 0x090D,
0x00EB, 0x003C, 0x0011, 0x049B, 0x049A, 0x0485, 0x00EA, 0x003F, 0x0124,
0x090C, 0x003E, 0x0039, 0x0095, 0x0247, 0x0246, 0x0484, 0x0094, 0x0038, },
{ 0x0F09, 0x00CD, 0x01FD, 0x0791, 0x1E6D, 0x0790, 0x03D9, 0x3CD1, 0x3CD0,
0x0075, 0x0001, 0x0001, 0x0035, 0x00CC, 0x0011, 0x0000, 0x03D8, 0x01FC,
0x03DB, 0x0010, 0x0003, 0x00CF, 0x03DA, 0x00CE, 0x0074, 0x0034, 0x0077,
0x0793, 0x0013, 0x0076, 0x0071, 0x03C5, 0x0070, 0x01FF, 0x0792, 0x01FE,
0x01F9, 0x0037, 0x00C9, 0x0F08, 0x01F8, 0x03C4, 0x00C8, 0x0F0B, 0x079D,
0x03C7, 0x0001, 0x0012, 0x0073, 0x00CB, 0x0005, 0x0036, 0x03C6, 0x0072,
0x007D, 0x0002, 0x00CA, 0x079C, 0x01FB, 0x00F5, 0x0031, 0x079F, 0x0F0A,
0x0F35, 0x079E, 0x01FA, 0x1E6C, 0x1E6F, 0x3CD3, 0x0799, 0x03C1, 0x1E6E,
0x3CD2, 0x0030, 0x00F4, 0x007C, 0x03C0, 0x03C3, 0x0798, 0x01E5, 0x00F7, },
{ 0x01A5, 0x0001, 0x001D, 0x0021, 0x00A1, 0x000D, 0x0061, 0x06B9, 0x00A0,
0x0060, 0x0001, 0x0005, 0x000C, 0x0020, 0x001C, 0x0004, 0x01A4, 0x01A7,
0x00A3, 0x001F, 0x001E, 0x0023, 0x0022, 0x002D, 0x002C, 0x0063, 0x0062,
0x1A81, 0x01A6, 0x01A1, 0x06B8, 0x06BB, 0x00A2, 0x06BA, 0x0D59, 0x06A5,
0x01A0, 0x000F, 0x006D, 0x06A4, 0x002F, 0x00AD, 0x006C, 0x06A7, 0x00AC,
0x0D58, 0x000E, 0x01A3, 0x00AF, 0x00AE, 0x006F, 0x01A2, 0x0D5B, 0x00A9,
0x0019, 0x0001, 0x0009, 0x00A8, 0x006E, 0x002E, 0x0000, 0x01AD, 0x00AB,
0x00AA, 0x0355, 0x0029, 0x1A80, 0x1A83, 0x1A82, 0x0354, 0x01AC, 0x0D5A,
0x1A8D, 0x01AF, 0x0357, 0x0D45, 0x0D44, 0x0D47, 0x1A8C, 0x06A6, 0x06A1, },
{ 0x0001, 0x0011, 0x0005, 0x0775, 0x00F9, 0x00F8, 0x0031, 0x0030, 0x0049,
0x00FB, 0x0010, 0x0033, 0x0EC9, 0x038D, 0x038C, 0x00FA, 0x038F, 0x0774,
0x0048, 0x0032, 0x0000, 0x01D5, 0x00E5, 0x038E, 0x00E4, 0x0013, 0x000D,
0x0389, 0x0777, 0x0388, 0x038B, 0x1DF9, 0x0EC8, 0x3BC9, 0x1DF8, 0x038A,
0x03B5, 0x0776, 0x00E7, 0x3BC8, 0x01D4, 0x3BCB, 0x0ECB, 0x0771, 0x0ECA,
0x01D7, 0x03B4, 0x01D6, 0x1DFB, 0x0EF5, 0x0770, 0x0EF4, 0x3BCA, 0x0773,
0x00E6, 0x03B7, 0x004B, 0x1DFA, 0x03B6, 0x0EF7, 0x00E1, 0x0EF6, 0x0EF1,
0x03B1, 0x01D1, 0x003D, 0x0EF0, 0x0772, 0x077D, 0x077C, 0x003C, 0x01D0,
0x03B0, 0x01D3, 0x003F, 0x03B3, 0x01D2, 0x0EF3, 0x077F, 0x00E0, 0x004A, },
{ 0x0015, 0x0049, 0x0014, 0x07D1, 0x03FD, 0x03FC, 0x01C1, 0x01C0, 0x00F1,
0x0017, 0x0001, 0x0001, 0x01C3, 0x0048, 0x004B, 0x0016, 0x0031, 0x01C2,
0x004A, 0x0011, 0x0000, 0x01CD, 0x00F0, 0x01CC, 0x0075, 0x0010, 0x000D,
0x03FF, 0x01CF, 0x01CE, 0x07D0, 0x0F81, 0x07D3, 0x1F1D, 0x0F80, 0x07D2,
0x01C9, 0x03FE, 0x0074, 0x07DD, 0x00F3, 0x1F1C, 0x07DC, 0x03F9, 0x07DF,
0x00F2, 0x00FD, 0x0077, 0x07DE, 0x07D9, 0x01C8, 0x07D8, 0x0F83, 0x03F8,
0x0030, 0x0076, 0x0013, 0x0F82, 0x00FC, 0x03FB, 0x0033, 0x03FA, 0x03E5,
0x03E4, 0x01CB, 0x0032, 0x1F1F, 0x03E7, 0x07DB, 0x07DA, 0x003D, 0x01CA,
0x07C5, 0x03E6, 0x0071, 0x0F8D, 0x07C4, 0x1F1E, 0x0F8C, 0x03E1, 0x01F5, },
{ 0x0019, 0x0065, 0x0018, 0x0351, 0x0350, 0x0353, 0x0021, 0x0020, 0x0064,
0x001D, 0x0005, 0x0005, 0x01A5, 0x0023, 0x0067, 0x0005, 0x0066, 0x0022,
0x001B, 0x0004, 0x0001, 0x0004, 0x001C, 0x0061, 0x001A, 0x0005, 0x0004,
0x0007, 0x002D, 0x0006, 0x002C, 0x01A4, 0x002F, 0x0352, 0x035D, 0x0060,
0x0001, 0x002E, 0x001F, 0x035C, 0x0000, 0x06B1, 0x01A7, 0x0029, 0x01A6,
0x0028, 0x0063, 0x0062, 0x035F, 0x01A1, 0x002B, 0x06B0, 0x06B3, 0x01A0,
0x0003, 0x006D, 0x001E, 0x035E, 0x006C, 0x06B2, 0x0002, 0x01A3, 0x01A2,
0x000D, 0x0005, 0x0007, 0x01AD, 0x006F, 0x002A, 0x006E, 0x0004, 0x0004,
0x000C, 0x0007, 0x0006, 0x000F, 0x000E, 0x00D5, 0x0009, 0x0006, 0x0007, },
{ 0x0065, 0x0181, 0x0064, 0x36C9, 0x06D5, 0x0DB5, 0x0379, 0x0180, 0x0183,
0x00D5, 0x001D, 0x001C, 0x0DB4, 0x0182, 0x0378, 0x00D4, 0x00D7, 0x06D4,
0x0067, 0x001F, 0x0001, 0x00D6, 0x00D1, 0x018D, 0x0066, 0x0001, 0x0000,
0x037B, 0x06D7, 0x037A, 0x0DB7, 0x36C8, 0x06D6, 0x0DB6, 0x1B79, 0x0DB1,
0x018C, 0x0365, 0x00D0, 0x1B78, 0x00D3, 0x1B7B, 0x0364, 0x06D1, 0x06D0,
0x018F, 0x018E, 0x00D2, 0x36CB, 0x0367, 0x0366, 0x06D3, 0x0DB0, 0x06D2,
0x0361, 0x06DD, 0x0189, 0x36CA, 0x0360, 0x36F5, 0x0188, 0x0DB3, 0x36F4,
0x0009, 0x0008, 0x0005, 0x06DC, 0x00DD, 0x018B, 0x00DC, 0x0004, 0x000B,
0x018A, 0x0061, 0x0003, 0x0363, 0x00DF, 0x06DF, 0x0362, 0x000A, 0x001E, },
{ 0x001D, 0x0061, 0x000D, 0x0D55, 0x06B9, 0x06B8, 0x01A5, 0x0021, 0x0020,
0x0023, 0x000C, 0x0060, 0x0D54, 0x00AD, 0x00AC, 0x0022, 0x00AF, 0x06BB,
0x000F, 0x001C, 0x0001, 0x002D, 0x0063, 0x01A4, 0x000E, 0x0001, 0x0005,
0x01A7, 0x06BA, 0x01A6, 0x06A5, 0x0D57, 0x0D56, 0x1ABD, 0x0D51, 0x00AE,
0x002C, 0x00A9, 0x002F, 0x0D50, 0x01A1, 0x1ABC, 0x06A4, 0x06A7, 0x06A6,
0x00A8, 0x06A1, 0x01A0, 0x1ABF, 0x0D53, 0x06A0, 0x0D52, 0x1ABE, 0x06A3,
0x0062, 0x002E, 0x0009, 0x0D5D, 0x01A3, 0x0D5C, 0x006D, 0x00AB, 0x06A2,
0x006C, 0x001F, 0x0001, 0x06AD, 0x0029, 0x01A2, 0x0028, 0x0004, 0x001E,
0x01AD, 0x006F, 0x0000, 0x01AC, 0x01AF, 0x06AC, 0x00AA, 0x006E, 0x0019, },
{ 0x0019, 0x007D, 0x0018, 0x01B5, 0x000D, 0x01B4, 0x007C, 0x007F, 0x01B7,
0x000C, 0x001B, 0x001A, 0x01B6, 0x000F, 0x00D5, 0x0019, 0x007E, 0x00D4,
0x0018, 0x001B, 0x0001, 0x000E, 0x0011, 0x0009, 0x0005, 0x0005, 0x0005,
0x00D7, 0x01B1, 0x0008, 0x01B0, 0x0079, 0x06FD, 0x0371, 0x0370, 0x00D6,
0x0078, 0x01B3, 0x0010, 0x0373, 0x0013, 0x06FC, 0x007B, 0x007A, 0x00D1,
0x00D0, 0x00D3, 0x0065, 0x0372, 0x06FF, 0x0064, 0x06FE, 0x037D, 0x00D2,
0x00DD, 0x0067, 0x0004, 0x037C, 0x0012, 0x01B2, 0x0007, 0x0066, 0x01BD,
0x0006, 0x0061, 0x0004, 0x01BC, 0x001A, 0x0060, 0x001D, 0x0004, 0x001C,
0x0063, 0x0001, 0x0007, 0x000B, 0x0000, 0x0062, 0x000A, 0x0005, 0x0007, },
{ 0x0069, 0x0045, 0x0068, 0x04BD, 0x0255, 0x04BC, 0x00E5, 0x00E4, 0x0031,
0x0030, 0x0019, 0x0001, 0x0121, 0x00E7, 0x00E6, 0x0033, 0x00E1, 0x00E0,
0x006B, 0x0018, 0x0001, 0x0044, 0x0032, 0x0047, 0x006A, 0x001B, 0x0005,
0x003D, 0x0046, 0x0015, 0x0041, 0x0120, 0x0123, 0x04BF, 0x0122, 0x0040,
0x003C, 0x00E3, 0x0014, 0x0254, 0x0043, 0x0975, 0x012D, 0x00E2, 0x00ED,
0x0042, 0x00EC, 0x004D, 0x0257, 0x0256, 0x0251, 0x04BE, 0x0974, 0x0250,
0x00EF, 0x00EE, 0x004C, 0x04B9, 0x012C, 0x04B8, 0x004F, 0x04BB, 0x0253,
0x003F, 0x0017, 0x0001, 0x0252, 0x00E9, 0x00E8, 0x00EB, 0x0000, 0x0003,
0x0016, 0x0002, 0x0004, 0x004E, 0x003E, 0x00EA, 0x0049, 0x000D, 0x0007, },
{ 0x000D, 0x01BD, 0x000C, 0x0D31, 0x0D30, 0x0D33, 0x0359, 0x0358, 0x002D,
0x0065, 0x001D, 0x001C, 0x0D32, 0x035B, 0x035A, 0x002C, 0x01BC, 0x0345,
0x000F, 0x001F, 0x0001, 0x002F, 0x0064, 0x01BF, 0x0067, 0x0001, 0x0005,
0x0066, 0x002E, 0x0061, 0x0029, 0x0695, 0x0694, 0x0697, 0x0696, 0x0060,
0x01BE, 0x0D3D, 0x0028, 0x1A49, 0x0344, 0x1A48, 0x1A4B, 0x0D3C, 0x0691,
0x002B, 0x01B9, 0x002A, 0x0D3F, 0x0690, 0x0347, 0x0D3E, 0x1A4A, 0x0346,
0x00D5, 0x0341, 0x0063, 0x0D39, 0x0340, 0x0D38, 0x01B8, 0x0D3B, 0x0D3A,
0x00D4, 0x0062, 0x0000, 0x0693, 0x01BB, 0x0343, 0x0342, 0x001E, 0x000E,
0x006D, 0x0009, 0x0001, 0x006C, 0x00D7, 0x034D, 0x01BA, 0x0008, 0x0004, },
{ 0x0075, 0x00CD, 0x0035, 0x03C1, 0x03C0, 0x07F9, 0x03C3, 0x1F8D, 0x00CC,
0x0074, 0x0011, 0x0010, 0x03C2, 0x0FD9, 0x01F1, 0x00CF, 0x03CD, 0x00CE,
0x0034, 0x0001, 0x0001, 0x0037, 0x00C9, 0x00C8, 0x0036, 0x0000, 0x0001,
0x0FD8, 0x03CC, 0x00CB, 0x01F0, 0x07F8, 0x03CF, 0x07FB, 0x07FA, 0x00CA,
0x01F3, 0x03CE, 0x00F5, 0x0FDB, 0x00F4, 0x07E5, 0x07E4, 0x07E7, 0x01F2,
0x07E6, 0x03C9, 0x01FD, 0x0FDA, 0x1F8C, 0x07E1, 0x1F8F, 0x1F8E, 0x03C8,
0x03CB, 0x0077, 0x0076, 0x0FC5, 0x03CA, 0x07E0, 0x00F7, 0x0FC4, 0x03F5,
0x00F6, 0x01FC, 0x0003, 0x03F4, 0x0071, 0x03F7, 0x00F1, 0x0013, 0x0031,
0x0030, 0x0070, 0x0005, 0x0012, 0x0073, 0x01FF, 0x0072, 0x007D, 0x0002, },
{ 0x0061, 0x0055, 0x0060, 0x02C9, 0x02C8, 0x02CB, 0x0171, 0x00B5, 0x0054,
0x0001, 0x0001, 0x0001, 0x0057, 0x0001, 0x0063, 0x001D, 0x0062, 0x0039,
0x006D, 0x0000, 0x0005, 0x0038, 0x0056, 0x00B4, 0x006C, 0x0003, 0x001C,
0x006F, 0x003B, 0x0002, 0x003A, 0x0170, 0x00B7, 0x0173, 0x0051, 0x006E,
0x0025, 0x0050, 0x0069, 0x02CA, 0x0024, 0x0027, 0x0172, 0x00B6, 0x00B1,
0x000D, 0x000C, 0x001F, 0x017D, 0x0026, 0x0068, 0x0053, 0x017C, 0x006B,
0x001E, 0x000F, 0x0004, 0x017F, 0x006A, 0x02F5, 0x0019, 0x0021, 0x0052,
0x02F4, 0x02F7, 0x0020, 0x0BCD, 0x05E5, 0x05E4, 0x0BCC, 0x0023, 0x00B0,
0x02F6, 0x00B3, 0x0022, 0x02F1, 0x02F0, 0x0BCF, 0x0BCE, 0x017E, 0x005D, },
{ 0x00BD, 0x0025, 0x01A1, 0x0159, 0x0299, 0x00BC, 0x0024, 0x0505, 0x0504,
0x01A0, 0x0001, 0x001D, 0x006D, 0x001C, 0x0001, 0x0005, 0x0027, 0x01A3,
0x0158, 0x001F, 0x001E, 0x01A2, 0x0026, 0x0021, 0x000D, 0x0020, 0x0023,
0x0298, 0x006C, 0x0022, 0x00BF, 0x00BE, 0x01AD, 0x002D, 0x029B, 0x00B9,
0x01AC, 0x00B8, 0x01AF, 0x029A, 0x006F, 0x015B, 0x006E, 0x0285, 0x0284,
0x01AE, 0x0019, 0x002C, 0x01A9, 0x01A8, 0x000C, 0x000F, 0x015A, 0x00BB,
0x000E, 0x0000, 0x0069, 0x01AB, 0x0018, 0x01AA, 0x0004, 0x0055, 0x00BA,
0x0507, 0x0145, 0x0054, 0x0506, 0x00A5, 0x0501, 0x00A4, 0x0057, 0x0500,
0x0A05, 0x0144, 0x00A7, 0x0287, 0x0286, 0x0503, 0x0147, 0x0A04, 0x0146, },
{ 0x0759, 0x0041, 0x00E5, 0x03BD, 0x0E9D, 0x012D, 0x012C, 0x3A1D, 0x03BC,
0x012F, 0x000D, 0x0040, 0x00E4, 0x03BF, 0x0043, 0x0042, 0x0758, 0x03BE,
0x00E7, 0x0001, 0x0000, 0x003D, 0x00E6, 0x0015, 0x0014, 0x0017, 0x003C,
0x743D, 0x012E, 0x03B9, 0x03B8, 0x0E9C, 0x03BB, 0x075B, 0x3A1C, 0x0E9F,
0x0129, 0x00E1, 0x0128, 0x0E9E, 0x012B, 0x075A, 0x00E0, 0x0E99, 0x0745,
0x3A1F, 0x03BA, 0x0744, 0x0E98, 0x1D0D, 0x03A5, 0x0E9B, 0x743C, 0x0E9A,
0x012A, 0x004D, 0x00E3, 0x0E85, 0x01D5, 0x0E84, 0x004C, 0x0747, 0x1D0C,
0x01D4, 0x003F, 0x0016, 0x0746, 0x03A4, 0x0741, 0x004F, 0x003E, 0x01D7,
0x0740, 0x000C, 0x0011, 0x004E, 0x00E2, 0x00ED, 0x00EC, 0x0049, 0x0048, },
};
static const uint8_t aic_mode2_vlc_bits[AIC_MODE2_NUM][AIC_MODE2_SIZE] = {
{ 1, 5, 4, 10, 6, 8, 5, 8, 8,
7, 5, 7, 11, 10, 9, 8, 13, 11,
6, 7, 3, 9, 8, 10, 9, 8, 5,
10, 9, 10, 10, 14, 12, 14, 14, 12,
8, 9, 7, 12, 8, 14, 9, 9, 12,
8, 9, 11, 11, 13, 9, 11, 14, 12,
6, 7, 9, 13, 9, 12, 7, 10, 12,
11, 12, 8, 15, 10, 15, 13, 7, 12,
10, 10, 8, 10, 13, 13, 13, 11, 8, },
{ 4, 6, 5, 11, 8, 10, 7, 11, 9,
4, 1, 4, 9, 7, 7, 5, 9, 10,
6, 7, 4, 9, 9, 10, 9, 9, 6,
9, 10, 9, 10, 12, 12, 13, 12, 11,
9, 9, 8, 12, 8, 14, 10, 11, 12,
7, 8, 10, 11, 12, 9, 11, 13, 12,
6, 7, 8, 12, 9, 12, 7, 11, 10,
12, 12, 9, 14, 12, 15, 13, 8, 12,
11, 11, 10, 12, 13, 15, 14, 12, 9, },
{ 5, 7, 6, 12, 9, 11, 8, 11, 10,
7, 5, 7, 11, 10, 9, 8, 12, 12,
5, 5, 1, 8, 7, 10, 8, 6, 4,
8, 8, 8, 9, 12, 11, 13, 12, 11,
8, 9, 8, 12, 8, 13, 10, 11, 11,
8, 9, 11, 12, 13, 11, 12, 14, 13,
8, 9, 10, 14, 11, 14, 9, 13, 13,
8, 9, 6, 11, 10, 14, 11, 6, 10,
6, 6, 4, 8, 9, 10, 10, 8, 5, },
{ 11, 7, 8, 10, 12, 9, 10, 14, 12,
7, 1, 5, 7, 8, 6, 4, 10, 9,
10, 5, 4, 8, 11, 8, 7, 6, 7,
11, 6, 7, 8, 10, 8, 10, 11, 9,
10, 8, 9, 13, 9, 12, 8, 11, 12,
11, 4, 7, 8, 9, 6, 8, 12, 9,
8, 5, 8, 12, 9, 10, 6, 12, 11,
12, 12, 10, 15, 13, 13, 13, 10, 13,
15, 10, 9, 10, 12, 13, 13, 10, 9, },
{ 11, 8, 8, 11, 13, 10, 11, 15, 12,
7, 1, 4, 7, 7, 5, 4, 8, 9,
11, 5, 5, 8, 11, 9, 8, 7, 8,
13, 7, 8, 9, 11, 9, 10, 12, 10,
10, 9, 8, 13, 9, 12, 9, 11, 12,
11, 5, 7, 9, 10, 6, 9, 13, 10,
7, 4, 7, 11, 8, 9, 5, 10, 11,
13, 11, 9, 15, 13, 15, 13, 8, 12,
15, 10, 10, 12, 13, 14, 14, 12, 11, },
{ 12, 9, 9, 12, 13, 11, 11, 14, 12,
8, 2, 5, 7, 9, 6, 5, 10, 10,
9, 4, 2, 7, 9, 7, 6, 5, 6,
12, 6, 7, 8, 10, 8, 10, 11, 9,
12, 9, 10, 13, 11, 12, 10, 14, 13,
12, 6, 8, 10, 10, 7, 9, 12, 10,
8, 5, 8, 11, 9, 10, 7, 11, 12,
8, 6, 5, 11, 11, 11, 8, 6, 9,
12, 6, 6, 8, 10, 10, 11, 8, 6, },
{ 13, 9, 10, 12, 14, 12, 11, 15, 15,
8, 1, 5, 7, 9, 6, 5, 11, 10,
11, 6, 5, 9, 11, 9, 8, 7, 8,
12, 6, 8, 8, 11, 8, 10, 12, 10,
10, 7, 9, 13, 10, 11, 9, 13, 12,
11, 3, 6, 8, 9, 4, 7, 11, 8,
8, 5, 9, 12, 10, 9, 7, 12, 13,
13, 12, 10, 14, 14, 15, 12, 11, 14,
15, 7, 9, 8, 11, 11, 12, 10, 9, },
{ 10, 5, 6, 9, 11, 7, 8, 12, 11,
8, 1, 4, 7, 9, 6, 4, 10, 10,
11, 6, 6, 9, 9, 9, 9, 8, 8,
14, 10, 10, 12, 12, 11, 12, 13, 12,
10, 7, 8, 12, 9, 11, 8, 12, 11,
13, 7, 10, 11, 11, 8, 10, 13, 11,
6, 3, 7, 11, 8, 9, 5, 10, 11,
11, 11, 9, 14, 14, 14, 11, 10, 13,
14, 10, 11, 13, 13, 13, 14, 12, 12, },
{ 2, 5, 3, 11, 8, 8, 6, 6, 7,
8, 5, 6, 12, 10, 10, 8, 10, 11,
7, 6, 2, 9, 8, 10, 8, 5, 4,
10, 11, 10, 10, 13, 12, 14, 13, 10,
10, 11, 8, 14, 9, 14, 12, 11, 12,
9, 10, 9, 13, 12, 11, 12, 14, 11,
8, 10, 7, 13, 10, 12, 8, 12, 12,
10, 9, 6, 12, 11, 11, 11, 6, 9,
10, 9, 6, 10, 9, 12, 11, 8, 7, },
{ 6, 8, 6, 12, 11, 11, 10, 10, 9,
6, 1, 3, 10, 8, 8, 6, 7, 10,
8, 6, 3, 10, 9, 10, 8, 6, 5,
11, 10, 10, 12, 13, 12, 14, 13, 12,
10, 11, 8, 12, 9, 14, 12, 11, 12,
9, 9, 8, 12, 12, 10, 12, 13, 11,
7, 8, 6, 13, 9, 11, 7, 11, 11,
11, 10, 7, 14, 11, 12, 12, 7, 10,
12, 11, 8, 13, 12, 14, 13, 11, 10, },
{ 7, 10, 7, 13, 13, 13, 11, 11, 10,
8, 5, 6, 12, 11, 10, 9, 10, 11,
7, 5, 1, 9, 8, 10, 7, 4, 4,
9, 11, 9, 11, 12, 11, 13, 13, 10,
9, 11, 8, 13, 9, 14, 12, 11, 12,
11, 10, 10, 13, 12, 11, 14, 14, 12,
9, 10, 8, 13, 10, 14, 9, 12, 12,
9, 7, 4, 12, 10, 11, 10, 6, 7,
9, 7, 4, 9, 9, 11, 9, 7, 5, },
{ 7, 9, 7, 14, 11, 12, 10, 9, 9,
8, 5, 5, 12, 9, 10, 8, 8, 11,
7, 5, 2, 8, 8, 9, 7, 4, 4,
10, 11, 10, 12, 14, 11, 12, 13, 12,
9, 10, 8, 13, 8, 13, 10, 11, 11,
9, 9, 8, 14, 10, 10, 11, 12, 11,
10, 11, 9, 14, 10, 14, 9, 12, 14,
6, 6, 3, 11, 8, 9, 8, 3, 6,
9, 7, 4, 10, 8, 11, 10, 6, 5, },
{ 6, 8, 7, 13, 12, 12, 10, 9, 9,
9, 7, 8, 13, 11, 11, 9, 11, 12,
7, 6, 1, 9, 8, 10, 7, 5, 4,
10, 12, 10, 12, 13, 13, 14, 13, 11,
9, 11, 9, 13, 10, 14, 12, 12, 12,
11, 12, 10, 14, 13, 12, 13, 14, 12,
8, 9, 7, 13, 10, 13, 8, 11, 12,
8, 6, 3, 12, 9, 10, 9, 4, 6,
10, 8, 5, 10, 10, 12, 11, 8, 6, },
{ 7, 10, 7, 12, 9, 12, 10, 10, 12,
9, 7, 7, 12, 9, 11, 6, 10, 11,
6, 6, 1, 9, 8, 9, 7, 4, 5,
11, 12, 9, 12, 10, 14, 13, 13, 11,
10, 12, 8, 13, 8, 14, 10, 10, 11,
11, 11, 10, 13, 14, 10, 14, 13, 11,
11, 10, 7, 13, 8, 12, 7, 10, 12,
7, 10, 4, 12, 6, 10, 8, 5, 8,
10, 7, 4, 9, 7, 10, 9, 6, 5, },
{ 7, 9, 7, 13, 12, 13, 10, 10, 8,
8, 5, 6, 11, 10, 10, 8, 10, 10,
7, 5, 2, 9, 8, 9, 7, 5, 3,
8, 9, 7, 9, 11, 11, 13, 11, 9,
8, 10, 7, 12, 9, 14, 11, 10, 10,
9, 10, 9, 12, 12, 12, 13, 14, 12,
10, 10, 9, 13, 11, 13, 9, 13, 12,
8, 7, 4, 12, 10, 10, 10, 6, 6,
7, 6, 3, 9, 8, 10, 9, 6, 3, },
{ 7, 10, 7, 13, 13, 13, 11, 11, 9,
8, 6, 6, 13, 11, 11, 9, 10, 11,
7, 6, 1, 9, 8, 10, 8, 5, 4,
8, 9, 8, 9, 12, 12, 12, 12, 8,
10, 13, 9, 14, 11, 14, 14, 13, 12,
9, 10, 9, 13, 12, 11, 13, 14, 11,
9, 11, 8, 13, 11, 13, 10, 13, 13,
9, 8, 5, 12, 10, 11, 11, 6, 7,
8, 7, 3, 8, 9, 11, 10, 7, 4, },
{ 8, 9, 7, 11, 11, 12, 11, 14, 9,
8, 6, 6, 11, 13, 10, 9, 11, 9,
7, 5, 1, 7, 9, 9, 7, 5, 3,
13, 11, 9, 10, 12, 11, 12, 12, 9,
10, 11, 9, 13, 9, 12, 12, 12, 10,
12, 11, 10, 13, 14, 12, 14, 14, 11,
11, 8, 8, 13, 11, 12, 9, 13, 11,
9, 10, 5, 11, 8, 11, 9, 6, 7,
7, 8, 4, 6, 8, 10, 8, 8, 5, },
{ 8, 10, 8, 13, 13, 13, 12, 11, 10,
5, 1, 3, 10, 7, 8, 6, 8, 9,
8, 7, 4, 9, 10, 11, 8, 7, 6,
8, 9, 7, 9, 12, 11, 12, 10, 8,
9, 10, 8, 13, 9, 9, 12, 11, 11,
7, 7, 6, 12, 9, 8, 10, 12, 8,
6, 7, 4, 12, 8, 13, 6, 9, 10,
13, 13, 9, 15, 14, 14, 15, 9, 11,
13, 11, 9, 13, 13, 15, 15, 12, 10, },
{ 10, 8, 9, 11, 12, 10, 8, 13, 13,
9, 2, 5, 7, 5, 4, 3, 8, 9,
11, 5, 5, 9, 8, 8, 6, 8, 8,
12, 7, 8, 10, 10, 9, 8, 12, 10,
9, 10, 9, 12, 7, 11, 7, 12, 12,
9, 5, 8, 9, 9, 6, 6, 11, 10,
6, 4, 7, 9, 5, 9, 3, 9, 10,
13, 11, 9, 13, 10, 13, 10, 9, 13,
14, 11, 10, 12, 12, 13, 11, 14, 11, },
{ 11, 7, 8, 10, 12, 9, 9, 14, 10,
9, 4, 7, 8, 10, 7, 7, 11, 10,
8, 2, 2, 6, 8, 5, 5, 5, 6,
15, 9, 10, 10, 12, 10, 11, 14, 12,
9, 8, 9, 12, 9, 11, 8, 12, 11,
14, 10, 11, 12, 13, 10, 12, 15, 12,
9, 7, 8, 12, 9, 12, 7, 11, 13,
9, 6, 5, 11, 10, 11, 7, 6, 9,
11, 4, 5, 7, 8, 8, 8, 7, 7, },
};
//@}
/**
* Codes used for determining block type
*/
//@{
#define AIC_MODE1_NUM 90
#define AIC_MODE1_SIZE 9
#define AIC_MODE1_BITS 7
static const uint8_t aic_mode1_vlc_codes[AIC_MODE1_NUM][AIC_MODE1_SIZE] = {
{ 0x01, 0x01, 0x01, 0x11, 0x00, 0x09, 0x03, 0x10, 0x05,},
{ 0x09, 0x01, 0x01, 0x05, 0x11, 0x00, 0x03, 0x21, 0x20,},
{ 0x01, 0x01, 0x01, 0x11, 0x09, 0x10, 0x05, 0x00, 0x03,},
{ 0x01, 0x01, 0x00, 0x03, 0x21, 0x05, 0x09, 0x20, 0x11,},
{ 0x01, 0x09, 0x00, 0x29, 0x08, 0x15, 0x03, 0x0B, 0x28,},
{ 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x03, 0x02,},
{ 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x01, 0x09, 0x08,},
{ 0x01, 0x01, 0x01, 0x09, 0x01, 0x08, 0x00, 0x03, 0x05,},
{ 0x01, 0x01, 0x01, 0x00, 0x05, 0x11, 0x09, 0x10, 0x03,},
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
{ 0x01, 0x01, 0x01, 0x05, 0x01, 0x00, 0x03, 0x09, 0x08,},
{ 0x09, 0x01, 0x01, 0x05, 0x11, 0x00, 0x03, 0x21, 0x20,},
{ 0x01, 0x01, 0x01, 0x0D, 0x05, 0x04, 0x00, 0x07, 0x0C,},
{ 0x01, 0x01, 0x00, 0x05, 0x11, 0x03, 0x09, 0x21, 0x20,},
{ 0x05, 0x01, 0x01, 0x11, 0x00, 0x09, 0x03, 0x21, 0x20,},
{ 0x09, 0x01, 0x01, 0x00, 0x05, 0x01, 0x03, 0x11, 0x10,},
{ 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x03, 0x02,},
{ 0x01, 0x01, 0x01, 0x09, 0x00, 0x05, 0x01, 0x03, 0x08,},
{ 0x01, 0x01, 0x01, 0x09, 0x11, 0x05, 0x00, 0x10, 0x03,},
{ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
{ 0x01, 0x00, 0x01, 0x09, 0x08, 0x15, 0x14, 0x0B, 0x03,},
{ 0x0D, 0x01, 0x01, 0x05, 0x0C, 0x04, 0x01, 0x00, 0x07,},
{ 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x03, 0x01, 0x01,},
{ 0x05, 0x01, 0x01, 0x04, 0x19, 0x07, 0x18, 0x0D, 0x00,},
{ 0x11, 0x09, 0x01, 0x21, 0x05, 0x20, 0x01, 0x00, 0x03,},
{ 0x41, 0x01, 0x00, 0x05, 0x40, 0x03, 0x09, 0x21, 0x11,},
{ 0x29, 0x01, 0x00, 0x28, 0x09, 0x15, 0x03, 0x08, 0x0B,},
{ 0x01, 0x00, 0x01, 0x11, 0x09, 0x10, 0x05, 0x01, 0x03,},
{ 0x05, 0x01, 0x01, 0x04, 0x0D, 0x0C, 0x07, 0x00, 0x01,},
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
{ 0x01, 0x00, 0x03, 0x05, 0x11, 0x10, 0x25, 0x24, 0x13,},
{ 0x21, 0x01, 0x01, 0x00, 0x11, 0x03, 0x05, 0x20, 0x09,},
{ 0x01, 0x01, 0x01, 0x00, 0x09, 0x11, 0x10, 0x05, 0x03,},
{ 0x21, 0x05, 0x01, 0x01, 0x09, 0x00, 0x11, 0x20, 0x03,},
{ 0x05, 0x01, 0x00, 0x04, 0x01, 0x19, 0x07, 0x18, 0x0D,},
{ 0x11, 0x01, 0x00, 0x01, 0x09, 0x01, 0x03, 0x10, 0x05,},
{ 0x1D, 0x01, 0x05, 0x0D, 0x0C, 0x04, 0x00, 0x1C, 0x0F,},
{ 0x05, 0x19, 0x01, 0x04, 0x00, 0x18, 0x1B, 0x1A, 0x07,},
{ 0x09, 0x01, 0x00, 0x01, 0x05, 0x03, 0x11, 0x10, 0x01,},
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
{ 0x01, 0x00, 0x03, 0x41, 0x05, 0x40, 0x09, 0x11, 0x21,},
{ 0x05, 0x01, 0x01, 0x19, 0x04, 0x07, 0x00, 0x18, 0x0D,},
{ 0x01, 0x01, 0x01, 0x05, 0x01, 0x04, 0x01, 0x00, 0x03,},
{ 0x01, 0x05, 0x00, 0x0D, 0x01, 0x04, 0x07, 0x19, 0x18,},
{ 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x02,},
{ 0x31, 0x01, 0x05, 0x19, 0x04, 0x07, 0x00, 0x30, 0x0D,},
{ 0x01, 0x00, 0x03, 0x11, 0x01, 0x05, 0x01, 0x09, 0x10,},
{ 0x01, 0x05, 0x01, 0x11, 0x01, 0x10, 0x00, 0x03, 0x09,},
{ 0x01, 0x09, 0x00, 0x29, 0x03, 0x08, 0x28, 0x15, 0x0B,},
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
{ 0x01, 0x01, 0x00, 0x09, 0x15, 0x03, 0x08, 0x14, 0x0B,},
{ 0x11, 0x01, 0x01, 0x00, 0x09, 0x01, 0x03, 0x10, 0x05,},
{ 0x01, 0x00, 0x03, 0x25, 0x11, 0x05, 0x10, 0x24, 0x13,},
{ 0x11, 0x01, 0x00, 0x01, 0x09, 0x01, 0x05, 0x10, 0x03,},
{ 0x05, 0x01, 0x00, 0x0D, 0x0C, 0x04, 0x0F, 0x1D, 0x1C,},
{ 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x03, 0x02,},
{ 0x21, 0x01, 0x05, 0x09, 0x11, 0x00, 0x03, 0x41, 0x40,},
{ 0x05, 0x01, 0x00, 0x1D, 0x1C, 0x0D, 0x0C, 0x0F, 0x04,},
{ 0x05, 0x01, 0x00, 0x0D, 0x31, 0x04, 0x19, 0x30, 0x07,},
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
{ 0x01, 0x01, 0x00, 0x21, 0x05, 0x11, 0x03, 0x09, 0x20,},
{ 0x01, 0x01, 0x00, 0x11, 0x03, 0x05, 0x01, 0x09, 0x10,},
{ 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x02,},
{ 0x05, 0x01, 0x04, 0x19, 0x07, 0x0D, 0x00, 0x31, 0x30,},
{ 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x02,},
{ 0x05, 0x01, 0x01, 0x11, 0x09, 0x00, 0x03, 0x21, 0x20,},
{ 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x02,},
{ 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x01, 0x01, 0x02,},
{ 0x09, 0x01, 0x00, 0x29, 0x08, 0x15, 0x03, 0x28, 0x0B,},
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
{ 0x01, 0x01, 0x01, 0x05, 0x01, 0x04, 0x00, 0x01, 0x03,},
{ 0x09, 0x01, 0x00, 0x29, 0x28, 0x15, 0x08, 0x03, 0x0B,},
{ 0x01, 0x00, 0x01, 0x11, 0x05, 0x10, 0x09, 0x01, 0x03,},
{ 0x05, 0x04, 0x01, 0x1D, 0x0D, 0x0C, 0x1C, 0x00, 0x0F,},
{ 0x09, 0x11, 0x01, 0x41, 0x00, 0x40, 0x05, 0x03, 0x21,},
{ 0x0D, 0x05, 0x01, 0x1D, 0x1C, 0x0C, 0x04, 0x00, 0x0F,},
{ 0x41, 0x09, 0x01, 0x40, 0x00, 0x11, 0x05, 0x03, 0x21,},
{ 0x01, 0x01, 0x01, 0x05, 0x01, 0x04, 0x00, 0x01, 0x03,},
{ 0x05, 0x04, 0x01, 0x0D, 0x01, 0x0C, 0x07, 0x01, 0x00,},
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
{ 0x05, 0x04, 0x01, 0x07, 0x19, 0x31, 0x30, 0x0D, 0x00,},
{ 0x21, 0x01, 0x01, 0x00, 0x11, 0x09, 0x20, 0x05, 0x03,},
{ 0x05, 0x01, 0x01, 0x04, 0x07, 0x0D, 0x0C, 0x00, 0x01,},
{ 0x21, 0x09, 0x01, 0x00, 0x20, 0x05, 0x23, 0x22, 0x03,},
{ 0x31, 0x0D, 0x01, 0x19, 0x05, 0x30, 0x04, 0x07, 0x00,},
{ 0x31, 0x05, 0x01, 0x04, 0x19, 0x00, 0x0D, 0x30, 0x07,},
{ 0x31, 0x01, 0x00, 0x0D, 0x05, 0x19, 0x04, 0x30, 0x07,},
{ 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x02, 0x01, 0x01,},
{ 0x01, 0x00, 0x01, 0x01, 0x05, 0x09, 0x08, 0x03, 0x01,},
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
};
static const uint8_t aic_mode1_vlc_bits[AIC_MODE1_NUM][AIC_MODE1_SIZE] = {
{ 1, 4, 2, 7, 4, 6, 4, 7, 5,},
{ 5, 1, 3, 4, 6, 3, 3, 7, 7,},
{ 1, 4, 2, 7, 6, 7, 5, 4, 4,},
{ 1, 3, 3, 3, 7, 4, 5, 7, 6,},
{ 2, 4, 2, 6, 4, 5, 2, 4, 6,},
{ 7, 2, 3, 4, 7, 1, 5, 7, 7,},
{ 5, 1, 3, 6, 5, 5, 2, 7, 7,},
{ 2, 5, 1, 7, 3, 7, 5, 5, 6,},
{ 2, 4, 1, 4, 5, 7, 6, 7, 4,},
{ 0, 0, 0, 0, 0, 0, 0, 0, 0,},
{ 2, 1, 3, 6, 5, 5, 5, 7, 7,},
{ 5, 1, 3, 4, 6, 3, 3, 7, 7,},
{ 4, 1, 2, 6, 5, 5, 4, 5, 6,},
{ 3, 1, 3, 4, 6, 3, 5, 7, 7,},
{ 4, 1, 3, 6, 3, 5, 3, 7, 7,},
{ 6, 1, 4, 4, 5, 2, 4, 7, 7,},
{ 7, 1, 5, 7, 4, 3, 2, 7, 7,},
{ 5, 3, 2, 7, 5, 6, 1, 5, 7,},
{ 4, 1, 2, 6, 7, 5, 4, 7, 4,},
{ 1, 0, 1, 0, 0, 0, 0, 0, 0,},
{ 3, 3, 1, 5, 5, 6, 6, 5, 3,},
{ 6, 2, 1, 5, 6, 5, 4, 4, 5,},
{ 6, 4, 1, 7, 6, 7, 6, 3, 2,},
{ 4, 3, 1, 4, 6, 4, 6, 5, 3,},
{ 6, 5, 1, 7, 4, 7, 3, 3, 3,},
{ 7, 2, 2, 3, 7, 2, 4, 6, 5,},
{ 6, 2, 2, 6, 4, 5, 2, 4, 4,},
{ 4, 4, 1, 7, 6, 7, 5, 2, 4,},
{ 5, 4, 1, 5, 6, 6, 5, 4, 2,},
{ 0, 0, 0, 0, 0, 0, 0, 0, 0,},
{ 2, 2, 2, 3, 5, 5, 6, 6, 5,},
{ 7, 1, 3, 3, 6, 3, 4, 7, 5,},
{ 2, 4, 1, 4, 6, 7, 7, 5, 4,},
{ 7, 4, 3, 1, 5, 3, 6, 7, 3,},
{ 4, 3, 3, 4, 1, 6, 4, 6, 5,},
{ 7, 4, 4, 2, 6, 1, 4, 7, 5,},
{ 5, 2, 3, 4, 4, 3, 2, 5, 4,},
{ 3, 5, 2, 3, 2, 5, 5, 5, 3,},
{ 6, 4, 4, 2, 5, 4, 7, 7, 1,},
{ 0, 0, 0, 0, 0, 0, 0, 0, 0,},
{ 2, 2, 2, 7, 3, 7, 4, 5, 6,},
{ 4, 1, 3, 6, 4, 4, 3, 6, 5,},
{ 2, 4, 1, 7, 3, 7, 6, 6, 6,},
{ 3, 4, 3, 5, 1, 4, 4, 6, 6,},
{ 4, 5, 2, 7, 1, 7, 3, 7, 7,},
{ 6, 2, 3, 5, 3, 3, 2, 6, 4,},
{ 4, 4, 4, 7, 2, 5, 1, 6, 7,},
{ 4, 5, 2, 7, 1, 7, 4, 4, 6,},
{ 2, 4, 2, 6, 2, 4, 6, 5, 4,},
{ 0, 0, 0, 0, 0, 0, 0, 0, 0,},
{ 1, 3, 3, 5, 6, 3, 5, 6, 5,},
{ 7, 1, 4, 4, 6, 2, 4, 7, 5,},
{ 2, 2, 2, 6, 5, 3, 5, 6, 5,},
{ 7, 4, 4, 2, 6, 1, 5, 7, 4,},
{ 3, 2, 2, 4, 4, 3, 4, 5, 5,},
{ 7, 2, 5, 3, 7, 1, 4, 7, 7,},
{ 6, 2, 3, 4, 5, 2, 2, 7, 7,},
{ 3, 2, 2, 5, 5, 4, 4, 4, 3,},
{ 3, 2, 2, 4, 6, 3, 5, 6, 3,},
{ 0, 0, 0, 0, 0, 0, 0, 0, 0,},
{ 1, 3, 3, 7, 4, 6, 3, 5, 7,},
{ 4, 1, 4, 7, 4, 5, 2, 6, 7,},
{ 2, 4, 1, 7, 5, 7, 3, 7, 7,},
{ 3, 2, 3, 5, 3, 4, 2, 6, 6,},
{ 3, 5, 4, 7, 2, 7, 1, 7, 7,},
{ 4, 1, 3, 6, 5, 3, 3, 7, 7,},
{ 4, 2, 5, 7, 3, 7, 1, 7, 7,},
{ 7, 4, 1, 7, 3, 7, 2, 5, 7,},
{ 4, 2, 2, 6, 4, 5, 2, 6, 4,},
{ 0, 0, 0, 0, 0, 0, 0, 0, 0,},
{ 3, 4, 1, 7, 6, 7, 6, 2, 6,},
{ 4, 2, 2, 6, 6, 5, 4, 2, 4,},
{ 4, 4, 1, 7, 5, 7, 6, 2, 4,},
{ 3, 3, 2, 5, 4, 4, 5, 2, 4,},
{ 4, 5, 2, 7, 2, 7, 3, 2, 6,},
{ 4, 3, 2, 5, 5, 4, 3, 2, 4,},
{ 7, 4, 2, 7, 2, 5, 3, 2, 6,},
{ 4, 6, 2, 7, 3, 7, 6, 1, 6,},
{ 5, 5, 1, 6, 4, 6, 5, 2, 4,},
{ 0, 0, 0, 0, 0, 0, 0, 0, 0,},
{ 3, 3, 2, 3, 5, 6, 6, 4, 2,},
{ 7, 1, 3, 3, 6, 5, 7, 4, 3,},
{ 5, 4, 1, 5, 5, 6, 6, 4, 2,},
{ 6, 4, 2, 2, 6, 3, 6, 6, 2,},
{ 6, 4, 2, 5, 3, 6, 3, 3, 2,},
{ 6, 3, 2, 3, 5, 2, 4, 6, 3,},
{ 6, 2, 2, 4, 3, 5, 3, 6, 3,},
{ 7, 5, 1, 7, 4, 7, 7, 3, 2,},
{ 5, 5, 2, 3, 6, 7, 7, 5, 1,},
{ 0, 0, 0, 0, 0, 0, 0, 0, 0,},
};
//@}
#define PBTYPE_ESCAPE 0xFF
/** tables used for P-frame macroblock type decoding */
//@{
#define NUM_PTYPE_VLCS 7
#define PTYPE_VLC_SIZE 8
#define PTYPE_VLC_BITS 7
static const uint8_t ptype_vlc_codes[NUM_PTYPE_VLCS][PTYPE_VLC_SIZE] = {
{ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
{ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
{ 0x0D, 0x05, 0x01, 0x04, 0x01, 0x00, 0x07, 0x0C },
{ 0x09, 0x11, 0x01, 0x00, 0x05, 0x03, 0x21, 0x20 },
{ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
{ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
{ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 }
};
static const uint8_t ptype_vlc_bits[NUM_PTYPE_VLCS][PTYPE_VLC_SIZE] = {
{ 1, 2, 3, 6, 5, 4, 7, 7 },
{ 3, 1, 2, 7, 6, 5, 4, 7 },
{ 5, 4, 1, 4, 3, 3, 4, 5 },
{ 4, 5, 2, 2, 3, 2, 6, 6 },
{ 5, 6, 1, 4, 2, 3, 7, 7 },
{ 5, 6, 1, 4, 3, 2, 7, 7 },
{ 6, 3, 2, 7, 5, 4, 1, 7 }
};
static const uint8_t ptype_vlc_syms[PTYPE_VLC_SIZE] = {
0, 1, 2, 3, 8, 9, 11, PBTYPE_ESCAPE
};
/** reverse of ptype_vlc_syms */
static const uint8_t block_num_to_ptype_vlc_num[12] = {
0, 1, 2, 3, 0, 0, 2, 0, 4, 5, 0, 6
};
//@}
/** tables used for P-frame macroblock type decoding */
//@{
#define NUM_BTYPE_VLCS 6
#define BTYPE_VLC_SIZE 7
#define BTYPE_VLC_BITS 6
static const uint8_t btype_vlc_codes[NUM_BTYPE_VLCS][BTYPE_VLC_SIZE] = {
{ 0x01, 0x05, 0x00, 0x03, 0x11, 0x09, 0x10 },
{ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
{ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
{ 0x09, 0x01, 0x00, 0x01, 0x05, 0x03, 0x08 },
{ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
{ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 }
};
static const uint8_t btype_vlc_bits[NUM_BTYPE_VLCS][PTYPE_VLC_SIZE] = {
{ 2, 3, 2, 2, 5, 4, 5 },
{ 4, 1, 3, 2, 6, 5, 6 },
{ 6, 4, 1, 2, 5, 3, 6 },
{ 5, 3, 3, 1, 4, 3, 5 },
{ 6, 5, 3, 2, 4, 1, 6 },
{ 6, 5, 3, 1, 4, 2, 6 }
};
static const uint8_t btype_vlc_syms[BTYPE_VLC_SIZE] = {
0, 1, 4, 5, 10, 7, PBTYPE_ESCAPE
};
/** reverse of btype_vlc_syms */
static const uint8_t block_num_to_btype_vlc_num[12] = {
0, 1, 0, 0, 2, 3, 0, 5, 0, 0, 4, 0
};
//@}
#endif /* FFMPEG_RV40VLC2_H */
| shyamalschandra/sagetv | third_party/ffmpeg/libavcodec/rv40vlc2.h | C | apache-2.0 | 33,390 |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Module: zrender/tool/http</title>
<meta property="og:title" content=""/>
<meta property="og:type" content="website"/>
<meta property="og:image" content=""/>
<meta property="og:url" content=""/>
<script src="scripts/prettify/prettify.js"></script>
<script src="scripts/prettify/lang-css.js"></script>
<script src="scripts/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/bootstrap.min.css">
<link type="text/css" rel="stylesheet" href="styles/jaguar.css">
<script>
var config = {"monospaceLinks":false,"cleverLinks":false,"applicationName":"ZRender","disqus":"","googleAnalytics":"","openGraph":{"title":"","type":"website","image":"","site_name":"","url":""},"meta":{"title":"","description":"","keyword":""},"default":{}};
</script>
</head>
<body>
<div id="wrap" class="clearfix">
<div class="navigation">
<h3 class="applicationName"><a href="index.html">ZRender</a></h3>
<div class="search">
<input id="search" type="text" class="form-control input-sm" placeholder="Search Documentations">
</div>
<ul class="list">
<li class="item" data-name="module:zrender">
<span class="title">
<a href="module-zrender.html">module:zrender</a>
</span>
<ul class="members itemMembers">
<span class="subtitle">Members</span>
<li data-name="module:zrender.version"><a href="module-zrender.html#.version">version</a></li>
</ul>
<ul class="typedefs itemMembers">
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="module:zrender.delInstance"><a href="module-zrender.html#.delInstance">delInstance</a></li>
<li data-name="module:zrender.dispose"><a href="module-zrender.html#.dispose">dispose</a></li>
<li data-name="module:zrender.getInstance"><a href="module-zrender.html#.getInstance">getInstance</a></li>
<li data-name="module:zrender.init"><a href="module-zrender.html#.init">init</a></li>
</ul>
<ul class="events itemMembers">
</ul>
</li>
<li class="item" data-name="module:zrender/animation/Animation">
<span class="title">
<a href="module-zrender_animation_Animation.html">module:zrender/animation/Animation</a>
</span>
<ul class="members itemMembers">
</ul>
<ul class="typedefs itemMembers">
<span class="subtitle">Typedefs</span>
<li data-name="module:zrender/animation/Animation~IZRenderStage"><a href="module-zrender_animation_Animation.html#~IZRenderStage">IZRenderStage</a></li>
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="module:zrender/animation/Animation#add"><a href="module-zrender_animation_Animation.html#add">add</a></li>
<li data-name="module:zrender/animation/Animation#animate"><a href="module-zrender_animation_Animation.html#animate">animate</a></li>
<li data-name="module:zrender/animation/Animation#clear"><a href="module-zrender_animation_Animation.html#clear">clear</a></li>
<li data-name="module:zrender/animation/Animation#remove"><a href="module-zrender_animation_Animation.html#remove">remove</a></li>
<li data-name="module:zrender/animation/Animation#start"><a href="module-zrender_animation_Animation.html#start">start</a></li>
<li data-name="module:zrender/animation/Animation#stop"><a href="module-zrender_animation_Animation.html#stop">stop</a></li>
</ul>
<ul class="events itemMembers">
</ul>
</li>
<li class="item" data-name="module:zrender/animation/easing">
<span class="title">
<a href="module-zrender_animation_easing.html">module:zrender/animation/easing</a>
</span>
<ul class="members itemMembers">
</ul>
<ul class="typedefs itemMembers">
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="module:zrender/animation/easing.BackIn"><a href="module-zrender_animation_easing.html#.BackIn">BackIn</a></li>
<li data-name="module:zrender/animation/easing.BackInOut"><a href="module-zrender_animation_easing.html#.BackInOut">BackInOut</a></li>
<li data-name="module:zrender/animation/easing.BackOut"><a href="module-zrender_animation_easing.html#.BackOut">BackOut</a></li>
<li data-name="module:zrender/animation/easing.BounceIn"><a href="module-zrender_animation_easing.html#.BounceIn">BounceIn</a></li>
<li data-name="module:zrender/animation/easing.BounceInOut"><a href="module-zrender_animation_easing.html#.BounceInOut">BounceInOut</a></li>
<li data-name="module:zrender/animation/easing.BounceOut"><a href="module-zrender_animation_easing.html#.BounceOut">BounceOut</a></li>
<li data-name="module:zrender/animation/easing.CircularIn"><a href="module-zrender_animation_easing.html#.CircularIn">CircularIn</a></li>
<li data-name="module:zrender/animation/easing.CircularInOut"><a href="module-zrender_animation_easing.html#.CircularInOut">CircularInOut</a></li>
<li data-name="module:zrender/animation/easing.CircularOut"><a href="module-zrender_animation_easing.html#.CircularOut">CircularOut</a></li>
<li data-name="module:zrender/animation/easing.CubicIn"><a href="module-zrender_animation_easing.html#.CubicIn">CubicIn</a></li>
<li data-name="module:zrender/animation/easing.CubicInOut"><a href="module-zrender_animation_easing.html#.CubicInOut">CubicInOut</a></li>
<li data-name="module:zrender/animation/easing.CubicOut"><a href="module-zrender_animation_easing.html#.CubicOut">CubicOut</a></li>
<li data-name="module:zrender/animation/easing.ElasticIn"><a href="module-zrender_animation_easing.html#.ElasticIn">ElasticIn</a></li>
<li data-name="module:zrender/animation/easing.ElasticInOut"><a href="module-zrender_animation_easing.html#.ElasticInOut">ElasticInOut</a></li>
<li data-name="module:zrender/animation/easing.ElasticOut"><a href="module-zrender_animation_easing.html#.ElasticOut">ElasticOut</a></li>
<li data-name="module:zrender/animation/easing.ExponentialIn"><a href="module-zrender_animation_easing.html#.ExponentialIn">ExponentialIn</a></li>
<li data-name="module:zrender/animation/easing.ExponentialInOut"><a href="module-zrender_animation_easing.html#.ExponentialInOut">ExponentialInOut</a></li>
<li data-name="module:zrender/animation/easing.ExponentialOut"><a href="module-zrender_animation_easing.html#.ExponentialOut">ExponentialOut</a></li>
<li data-name="module:zrender/animation/easing.Linear"><a href="module-zrender_animation_easing.html#.Linear">Linear</a></li>
<li data-name="module:zrender/animation/easing.QuadraticIn"><a href="module-zrender_animation_easing.html#.QuadraticIn">QuadraticIn</a></li>
<li data-name="module:zrender/animation/easing.QuadraticInOut"><a href="module-zrender_animation_easing.html#.QuadraticInOut">QuadraticInOut</a></li>
<li data-name="module:zrender/animation/easing.QuadraticOut"><a href="module-zrender_animation_easing.html#.QuadraticOut">QuadraticOut</a></li>
<li data-name="module:zrender/animation/easing.QuarticIn"><a href="module-zrender_animation_easing.html#.QuarticIn">QuarticIn</a></li>
<li data-name="module:zrender/animation/easing.QuarticInOut"><a href="module-zrender_animation_easing.html#.QuarticInOut">QuarticInOut</a></li>
<li data-name="module:zrender/animation/easing.QuarticOut"><a href="module-zrender_animation_easing.html#.QuarticOut">QuarticOut</a></li>
<li data-name="module:zrender/animation/easing.QuinticIn"><a href="module-zrender_animation_easing.html#.QuinticIn">QuinticIn</a></li>
<li data-name="module:zrender/animation/easing.QuinticInOut"><a href="module-zrender_animation_easing.html#.QuinticInOut">QuinticInOut</a></li>
<li data-name="module:zrender/animation/easing.QuinticOut"><a href="module-zrender_animation_easing.html#.QuinticOut">QuinticOut</a></li>
<li data-name="module:zrender/animation/easing.SinusoidalIn"><a href="module-zrender_animation_easing.html#.SinusoidalIn">SinusoidalIn</a></li>
<li data-name="module:zrender/animation/easing.SinusoidalInOut"><a href="module-zrender_animation_easing.html#.SinusoidalInOut">SinusoidalInOut</a></li>
<li data-name="module:zrender/animation/easing.SinusoidalOut"><a href="module-zrender_animation_easing.html#.SinusoidalOut">SinusoidalOut</a></li>
</ul>
<ul class="events itemMembers">
</ul>
</li>
<li class="item" data-name="module:zrender/config">
<span class="title">
<a href="module-zrender_config.html">module:zrender/config</a>
</span>
<ul class="members itemMembers">
<span class="subtitle">Members</span>
<li data-name="module:zrender/config.debugMode"><a href="module-zrender_config.html#.debugMode">debugMode</a></li>
</ul>
<ul class="typedefs itemMembers">
</ul>
<ul class="methods itemMembers">
</ul>
<ul class="events itemMembers">
</ul>
</li>
<li class="item" data-name="module:zrender/Group">
<span class="title">
<a href="module-zrender_Group.html">module:zrender/Group</a>
</span>
<ul class="members itemMembers">
<span class="subtitle">Members</span>
<li data-name="module:zrender/Group#clipShape"><a href="module-zrender_Group.html#clipShape">clipShape</a></li>
<li data-name="module:zrender/Group#id"><a href="module-zrender_Group.html#id">id</a></li>
<li data-name="module:zrender/Group#ignore"><a href="module-zrender_Group.html#ignore">ignore</a></li>
<li data-name="module:zrender/Group#type"><a href="module-zrender_Group.html#type">type</a></li>
<li data-name="module:zrender/Group#position"><a href="module-zrender_Group.html#position">position</a></li>
<li data-name="module:zrender/Group#rotation"><a href="module-zrender_Group.html#rotation">rotation</a></li>
<li data-name="module:zrender/Group#scale"><a href="module-zrender_Group.html#scale">scale</a></li>
</ul>
<ul class="typedefs itemMembers">
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="module:zrender/Group#addChild"><a href="module-zrender_Group.html#addChild">addChild</a></li>
<li data-name="module:zrender/Group#childAt"><a href="module-zrender_Group.html#childAt">childAt</a></li>
<li data-name="module:zrender/Group#children"><a href="module-zrender_Group.html#children">children</a></li>
<li data-name="module:zrender/Group#clearChildren"><a href="module-zrender_Group.html#clearChildren">clearChildren</a></li>
<li data-name="module:zrender/Group#eachChild"><a href="module-zrender_Group.html#eachChild">eachChild</a></li>
<li data-name="module:zrender/Group#removeChild"><a href="module-zrender_Group.html#removeChild">removeChild</a></li>
<li data-name="module:zrender/Group#traverse"><a href="module-zrender_Group.html#traverse">traverse</a></li>
<li data-name="module:zrender/Group#bind"><a href="module-zrender_Group.html#bind">bind</a></li>
<li data-name="module:zrender/Group#decomposeTransform"><a href="module-zrender_Group.html#decomposeTransform">decomposeTransform</a></li>
<li data-name="module:zrender/Group#dispatch"><a href="module-zrender_Group.html#dispatch">dispatch</a></li>
<li data-name="module:zrender/Group#dispatchWithContext"><a href="module-zrender_Group.html#dispatchWithContext">dispatchWithContext</a></li>
<li data-name="module:zrender/Group#lookAt"><a href="module-zrender_Group.html#lookAt">lookAt</a></li>
<li data-name="module:zrender/Group#one"><a href="module-zrender_Group.html#one">one</a></li>
<li data-name="module:zrender/Group#setTransform"><a href="module-zrender_Group.html#setTransform">setTransform</a></li>
<li data-name="module:zrender/Group#transformCoordToLocal"><a href="module-zrender_Group.html#transformCoordToLocal">transformCoordToLocal</a></li>
<li data-name="module:zrender/Group#unbind"><a href="module-zrender_Group.html#unbind">unbind</a></li>
<li data-name="module:zrender/Group#updateTransform"><a href="module-zrender_Group.html#updateTransform">updateTransform</a></li>
</ul>
<ul class="events itemMembers">
<span class="subtitle">Events</span>
<li data-name="module:zrender/Group#event:onclick"><a href="module-zrender_Group.html#event:onclick">onclick</a></li>
<li data-name="module:zrender/Group#event:ondragend"><a href="module-zrender_Group.html#event:ondragend">ondragend</a></li>
<li data-name="module:zrender/Group#event:ondragenter"><a href="module-zrender_Group.html#event:ondragenter">ondragenter</a></li>
<li data-name="module:zrender/Group#event:ondragleave"><a href="module-zrender_Group.html#event:ondragleave">ondragleave</a></li>
<li data-name="module:zrender/Group#event:ondragover"><a href="module-zrender_Group.html#event:ondragover">ondragover</a></li>
<li data-name="module:zrender/Group#event:ondragstart"><a href="module-zrender_Group.html#event:ondragstart">ondragstart</a></li>
<li data-name="module:zrender/Group#event:ondrop"><a href="module-zrender_Group.html#event:ondrop">ondrop</a></li>
<li data-name="module:zrender/Group#event:onmousedown"><a href="module-zrender_Group.html#event:onmousedown">onmousedown</a></li>
<li data-name="module:zrender/Group#event:onmousemove"><a href="module-zrender_Group.html#event:onmousemove">onmousemove</a></li>
<li data-name="module:zrender/Group#event:onmouseout"><a href="module-zrender_Group.html#event:onmouseout">onmouseout</a></li>
<li data-name="module:zrender/Group#event:onmouseover"><a href="module-zrender_Group.html#event:onmouseover">onmouseover</a></li>
<li data-name="module:zrender/Group#event:onmouseup"><a href="module-zrender_Group.html#event:onmouseup">onmouseup</a></li>
<li data-name="module:zrender/Group#event:onmousewheel"><a href="module-zrender_Group.html#event:onmousewheel">onmousewheel</a></li>
</ul>
</li>
<li class="item" data-name="module:zrender/Handler">
<span class="title">
<a href="module-zrender_Handler.html">module:zrender/Handler</a>
</span>
<ul class="members itemMembers">
</ul>
<ul class="typedefs itemMembers">
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="module:zrender/Handler#dispose"><a href="module-zrender_Handler.html#dispose">dispose</a></li>
<li data-name="module:zrender/Handler#on"><a href="module-zrender_Handler.html#on">on</a></li>
<li data-name="module:zrender/Handler#trigger"><a href="module-zrender_Handler.html#trigger">trigger</a></li>
<li data-name="module:zrender/Handler#un"><a href="module-zrender_Handler.html#un">un</a></li>
<li data-name="module:zrender/Handler#bind"><a href="module-zrender_Handler.html#bind">bind</a></li>
<li data-name="module:zrender/Handler#dispatch"><a href="module-zrender_Handler.html#dispatch">dispatch</a></li>
<li data-name="module:zrender/Handler#dispatchWithContext"><a href="module-zrender_Handler.html#dispatchWithContext">dispatchWithContext</a></li>
<li data-name="module:zrender/Handler#one"><a href="module-zrender_Handler.html#one">one</a></li>
<li data-name="module:zrender/Handler#unbind"><a href="module-zrender_Handler.html#unbind">unbind</a></li>
</ul>
<ul class="events itemMembers">
<span class="subtitle">Events</span>
<li data-name="module:zrender/Handler#event:onclick"><a href="module-zrender_Handler.html#event:onclick">onclick</a></li>
<li data-name="module:zrender/Handler#event:ondragend"><a href="module-zrender_Handler.html#event:ondragend">ondragend</a></li>
<li data-name="module:zrender/Handler#event:ondragenter"><a href="module-zrender_Handler.html#event:ondragenter">ondragenter</a></li>
<li data-name="module:zrender/Handler#event:ondragleave"><a href="module-zrender_Handler.html#event:ondragleave">ondragleave</a></li>
<li data-name="module:zrender/Handler#event:ondragover"><a href="module-zrender_Handler.html#event:ondragover">ondragover</a></li>
<li data-name="module:zrender/Handler#event:ondragstart"><a href="module-zrender_Handler.html#event:ondragstart">ondragstart</a></li>
<li data-name="module:zrender/Handler#event:ondrop"><a href="module-zrender_Handler.html#event:ondrop">ondrop</a></li>
<li data-name="module:zrender/Handler#event:onmousedown"><a href="module-zrender_Handler.html#event:onmousedown">onmousedown</a></li>
<li data-name="module:zrender/Handler#event:onmousemove"><a href="module-zrender_Handler.html#event:onmousemove">onmousemove</a></li>
<li data-name="module:zrender/Handler#event:onmouseout"><a href="module-zrender_Handler.html#event:onmouseout">onmouseout</a></li>
<li data-name="module:zrender/Handler#event:onmouseover"><a href="module-zrender_Handler.html#event:onmouseover">onmouseover</a></li>
<li data-name="module:zrender/Handler#event:onmouseup"><a href="module-zrender_Handler.html#event:onmouseup">onmouseup</a></li>
<li data-name="module:zrender/Handler#event:onmousewheel"><a href="module-zrender_Handler.html#event:onmousewheel">onmousewheel</a></li>
</ul>
</li>
<li class="item" data-name="module:zrender/Layer">
<span class="title">
<a href="module-zrender_Layer.html">module:zrender/Layer</a>
</span>
<ul class="members itemMembers">
<span class="subtitle">Members</span>
<li data-name="module:zrender/Layer#clearColor"><a href="module-zrender_Layer.html#clearColor">clearColor</a></li>
<li data-name="module:zrender/Layer#lastFrameAlpha"><a href="module-zrender_Layer.html#lastFrameAlpha">lastFrameAlpha</a></li>
<li data-name="module:zrender/Layer#motionBlur"><a href="module-zrender_Layer.html#motionBlur">motionBlur</a></li>
<li data-name="module:zrender/Layer#panable"><a href="module-zrender_Layer.html#panable">panable</a></li>
<li data-name="module:zrender/Layer#zoomable"><a href="module-zrender_Layer.html#zoomable">zoomable</a></li>
<li data-name="module:zrender/Layer#position"><a href="module-zrender_Layer.html#position">position</a></li>
<li data-name="module:zrender/Layer#rotation"><a href="module-zrender_Layer.html#rotation">rotation</a></li>
<li data-name="module:zrender/Layer#scale"><a href="module-zrender_Layer.html#scale">scale</a></li>
</ul>
<ul class="typedefs itemMembers">
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="module:zrender/Layer#clear"><a href="module-zrender_Layer.html#clear">clear</a></li>
<li data-name="module:zrender/Layer#resize"><a href="module-zrender_Layer.html#resize">resize</a></li>
<li data-name="module:zrender/Layer#decomposeTransform"><a href="module-zrender_Layer.html#decomposeTransform">decomposeTransform</a></li>
<li data-name="module:zrender/Layer#lookAt"><a href="module-zrender_Layer.html#lookAt">lookAt</a></li>
<li data-name="module:zrender/Layer#setTransform"><a href="module-zrender_Layer.html#setTransform">setTransform</a></li>
<li data-name="module:zrender/Layer#transformCoordToLocal"><a href="module-zrender_Layer.html#transformCoordToLocal">transformCoordToLocal</a></li>
<li data-name="module:zrender/Layer#updateTransform"><a href="module-zrender_Layer.html#updateTransform">updateTransform</a></li>
</ul>
<ul class="events itemMembers">
</ul>
</li>
<li class="item" data-name="module:zrender/mixin/Eventful">
<span class="title">
<a href="module-zrender_mixin_Eventful.html">module:zrender/mixin/Eventful</a>
</span>
<ul class="members itemMembers">
</ul>
<ul class="typedefs itemMembers">
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="module:zrender/mixin/Eventful#bind"><a href="module-zrender_mixin_Eventful.html#bind">bind</a></li>
<li data-name="module:zrender/mixin/Eventful#dispatch"><a href="module-zrender_mixin_Eventful.html#dispatch">dispatch</a></li>
<li data-name="module:zrender/mixin/Eventful#dispatchWithContext"><a href="module-zrender_mixin_Eventful.html#dispatchWithContext">dispatchWithContext</a></li>
<li data-name="module:zrender/mixin/Eventful#one"><a href="module-zrender_mixin_Eventful.html#one">one</a></li>
<li data-name="module:zrender/mixin/Eventful#unbind"><a href="module-zrender_mixin_Eventful.html#unbind">unbind</a></li>
</ul>
<ul class="events itemMembers">
<span class="subtitle">Events</span>
<li data-name="module:zrender/mixin/Eventful#event:onclick"><a href="module-zrender_mixin_Eventful.html#event:onclick">onclick</a></li>
<li data-name="module:zrender/mixin/Eventful#event:ondragend"><a href="module-zrender_mixin_Eventful.html#event:ondragend">ondragend</a></li>
<li data-name="module:zrender/mixin/Eventful#event:ondragenter"><a href="module-zrender_mixin_Eventful.html#event:ondragenter">ondragenter</a></li>
<li data-name="module:zrender/mixin/Eventful#event:ondragleave"><a href="module-zrender_mixin_Eventful.html#event:ondragleave">ondragleave</a></li>
<li data-name="module:zrender/mixin/Eventful#event:ondragover"><a href="module-zrender_mixin_Eventful.html#event:ondragover">ondragover</a></li>
<li data-name="module:zrender/mixin/Eventful#event:ondragstart"><a href="module-zrender_mixin_Eventful.html#event:ondragstart">ondragstart</a></li>
<li data-name="module:zrender/mixin/Eventful#event:ondrop"><a href="module-zrender_mixin_Eventful.html#event:ondrop">ondrop</a></li>
<li data-name="module:zrender/mixin/Eventful#event:onmousedown"><a href="module-zrender_mixin_Eventful.html#event:onmousedown">onmousedown</a></li>
<li data-name="module:zrender/mixin/Eventful#event:onmousemove"><a href="module-zrender_mixin_Eventful.html#event:onmousemove">onmousemove</a></li>
<li data-name="module:zrender/mixin/Eventful#event:onmouseout"><a href="module-zrender_mixin_Eventful.html#event:onmouseout">onmouseout</a></li>
<li data-name="module:zrender/mixin/Eventful#event:onmouseover"><a href="module-zrender_mixin_Eventful.html#event:onmouseover">onmouseover</a></li>
<li data-name="module:zrender/mixin/Eventful#event:onmouseup"><a href="module-zrender_mixin_Eventful.html#event:onmouseup">onmouseup</a></li>
<li data-name="module:zrender/mixin/Eventful#event:onmousewheel"><a href="module-zrender_mixin_Eventful.html#event:onmousewheel">onmousewheel</a></li>
</ul>
</li>
<li class="item" data-name="module:zrender/mixin/Transformable">
<span class="title">
<a href="module-zrender_mixin_Transformable.html">module:zrender/mixin/Transformable</a>
</span>
<ul class="members itemMembers">
<span class="subtitle">Members</span>
<li data-name="module:zrender/mixin/Transformable#needTransform"><a href="module-zrender_mixin_Transformable.html#needTransform">needTransform</a></li>
<li data-name="module:zrender/mixin/Transformable#position"><a href="module-zrender_mixin_Transformable.html#position">position</a></li>
<li data-name="module:zrender/mixin/Transformable#rotation"><a href="module-zrender_mixin_Transformable.html#rotation">rotation</a></li>
<li data-name="module:zrender/mixin/Transformable#scale"><a href="module-zrender_mixin_Transformable.html#scale">scale</a></li>
</ul>
<ul class="typedefs itemMembers">
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="module:zrender/mixin/Transformable#decomposeTransform"><a href="module-zrender_mixin_Transformable.html#decomposeTransform">decomposeTransform</a></li>
<li data-name="module:zrender/mixin/Transformable#lookAt"><a href="module-zrender_mixin_Transformable.html#lookAt">lookAt</a></li>
<li data-name="module:zrender/mixin/Transformable#setTransform"><a href="module-zrender_mixin_Transformable.html#setTransform">setTransform</a></li>
<li data-name="module:zrender/mixin/Transformable#transformCoordToLocal"><a href="module-zrender_mixin_Transformable.html#transformCoordToLocal">transformCoordToLocal</a></li>
<li data-name="module:zrender/mixin/Transformable#updateTransform"><a href="module-zrender_mixin_Transformable.html#updateTransform">updateTransform</a></li>
</ul>
<ul class="events itemMembers">
</ul>
</li>
<li class="item" data-name="module:zrender/Painter">
<span class="title">
<a href="module-zrender_Painter.html">module:zrender/Painter</a>
</span>
<ul class="members itemMembers">
<span class="subtitle">Members</span>
<li data-name="module:zrender/Painter#root"><a href="module-zrender_Painter.html#root">root</a></li>
<li data-name="module:zrender/Painter#storage"><a href="module-zrender_Painter.html#storage">storage</a></li>
</ul>
<ul class="typedefs itemMembers">
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="module:zrender/Painter#clear"><a href="module-zrender_Painter.html#clear">clear</a></li>
<li data-name="module:zrender/Painter#clearHover"><a href="module-zrender_Painter.html#clearHover">clearHover</a></li>
<li data-name="module:zrender/Painter#clearLayer"><a href="module-zrender_Painter.html#clearLayer">clearLayer</a></li>
<li data-name="module:zrender/Painter#delLayer"><a href="module-zrender_Painter.html#delLayer">delLayer</a></li>
<li data-name="module:zrender/Painter#dispose"><a href="module-zrender_Painter.html#dispose">dispose</a></li>
<li data-name="module:zrender/Painter#getHeight"><a href="module-zrender_Painter.html#getHeight">getHeight</a></li>
<li data-name="module:zrender/Painter#getLayer"><a href="module-zrender_Painter.html#getLayer">getLayer</a></li>
<li data-name="module:zrender/Painter#getLayers"><a href="module-zrender_Painter.html#getLayers">getLayers</a></li>
<li data-name="module:zrender/Painter#getWidth"><a href="module-zrender_Painter.html#getWidth">getWidth</a></li>
<li data-name="module:zrender/Painter#hideLoading"><a href="module-zrender_Painter.html#hideLoading">hideLoading</a></li>
<li data-name="module:zrender/Painter#isLoading"><a href="module-zrender_Painter.html#isLoading">isLoading</a></li>
<li data-name="module:zrender/Painter#modLayer"><a href="module-zrender_Painter.html#modLayer">modLayer</a></li>
<li data-name="module:zrender/Painter#refresh"><a href="module-zrender_Painter.html#refresh">refresh</a></li>
<li data-name="module:zrender/Painter#refreshHover"><a href="module-zrender_Painter.html#refreshHover">refreshHover</a></li>
<li data-name="module:zrender/Painter#refreshShapes"><a href="module-zrender_Painter.html#refreshShapes">refreshShapes</a></li>
<li data-name="module:zrender/Painter#render"><a href="module-zrender_Painter.html#render">render</a></li>
<li data-name="module:zrender/Painter#resize"><a href="module-zrender_Painter.html#resize">resize</a></li>
<li data-name="module:zrender/Painter#setLoadingEffect"><a href="module-zrender_Painter.html#setLoadingEffect">setLoadingEffect</a></li>
<li data-name="module:zrender/Painter#showLoading"><a href="module-zrender_Painter.html#showLoading">showLoading</a></li>
<li data-name="module:zrender/Painter#toDataURL"><a href="module-zrender_Painter.html#toDataURL">toDataURL</a></li>
</ul>
<ul class="events itemMembers">
</ul>
</li>
<li class="item" data-name="module:zrender/shape/Base">
<span class="title">
<a href="module-zrender_shape_Base.html">module:zrender/shape/Base</a>
</span>
<ul class="members itemMembers">
<span class="subtitle">Members</span>
<li data-name="module:zrender/shape/Base#clickable"><a href="module-zrender_shape_Base.html#clickable">clickable</a></li>
<li data-name="module:zrender/shape/Base#draggable"><a href="module-zrender_shape_Base.html#draggable">draggable</a></li>
<li data-name="module:zrender/shape/Base#highlightStyle"><a href="module-zrender_shape_Base.html#highlightStyle">highlightStyle</a></li>
<li data-name="module:zrender/shape/Base#hoverable"><a href="module-zrender_shape_Base.html#hoverable">hoverable</a></li>
<li data-name="module:zrender/shape/Base#id"><a href="module-zrender_shape_Base.html#id">id</a></li>
<li data-name="module:zrender/shape/Base#ignore"><a href="module-zrender_shape_Base.html#ignore">ignore</a></li>
<li data-name="module:zrender/shape/Base#invisible"><a href="module-zrender_shape_Base.html#invisible">invisible</a></li>
<li data-name="module:zrender/shape/Base#parent"><a href="module-zrender_shape_Base.html#parent">parent</a></li>
<li data-name="module:zrender/shape/Base#style"><a href="module-zrender_shape_Base.html#style">style</a></li>
<li data-name="module:zrender/shape/Base#z"><a href="module-zrender_shape_Base.html#z">z</a></li>
<li data-name="module:zrender/shape/Base#zlevel"><a href="module-zrender_shape_Base.html#zlevel">zlevel</a></li>
<li data-name="module:zrender/shape/Base#position"><a href="module-zrender_shape_Base.html#position">position</a></li>
<li data-name="module:zrender/shape/Base#rotation"><a href="module-zrender_shape_Base.html#rotation">rotation</a></li>
<li data-name="module:zrender/shape/Base#scale"><a href="module-zrender_shape_Base.html#scale">scale</a></li>
</ul>
<ul class="typedefs itemMembers">
<span class="subtitle">Typedefs</span>
<li data-name="module:zrender/shape/Base~IBaseShapeStyle"><a href="module-zrender_shape_Base.html#~IBaseShapeStyle">IBaseShapeStyle</a></li>
<li data-name="module:zrender/shape/Base~IBoundingRect"><a href="module-zrender_shape_Base.html#~IBoundingRect">IBoundingRect</a></li>
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="module:zrender/shape/Base#afterBrush"><a href="module-zrender_shape_Base.html#afterBrush">afterBrush</a></li>
<li data-name="module:zrender/shape/Base#beforeBrush"><a href="module-zrender_shape_Base.html#beforeBrush">beforeBrush</a></li>
<li data-name="module:zrender/shape/Base#brush"><a href="module-zrender_shape_Base.html#brush">brush</a></li>
<li data-name="module:zrender/shape/Base#buildPath"><a href="module-zrender_shape_Base.html#buildPath">buildPath</a></li>
<li data-name="module:zrender/shape/Base#drawText"><a href="module-zrender_shape_Base.html#drawText">drawText</a></li>
<li data-name="module:zrender/shape/Base#drift"><a href="module-zrender_shape_Base.html#drift">drift</a></li>
<li data-name="module:zrender/shape/Base#getHighlightStyle"><a href="module-zrender_shape_Base.html#getHighlightStyle">getHighlightStyle</a></li>
<li data-name="module:zrender/shape/Base#getRect"><a href="module-zrender_shape_Base.html#getRect">getRect</a></li>
<li data-name="module:zrender/shape/Base#isCover"><a href="module-zrender_shape_Base.html#isCover">isCover</a></li>
<li data-name="module:zrender/shape/Base#isSilent"><a href="module-zrender_shape_Base.html#isSilent">isSilent</a></li>
<li data-name="module:zrender/shape/Base#setContext"><a href="module-zrender_shape_Base.html#setContext">setContext</a></li>
<li data-name="module:zrender/shape/Base#bind"><a href="module-zrender_shape_Base.html#bind">bind</a></li>
<li data-name="module:zrender/shape/Base#decomposeTransform"><a href="module-zrender_shape_Base.html#decomposeTransform">decomposeTransform</a></li>
<li data-name="module:zrender/shape/Base#dispatch"><a href="module-zrender_shape_Base.html#dispatch">dispatch</a></li>
<li data-name="module:zrender/shape/Base#dispatchWithContext"><a href="module-zrender_shape_Base.html#dispatchWithContext">dispatchWithContext</a></li>
<li data-name="module:zrender/shape/Base#lookAt"><a href="module-zrender_shape_Base.html#lookAt">lookAt</a></li>
<li data-name="module:zrender/shape/Base#one"><a href="module-zrender_shape_Base.html#one">one</a></li>
<li data-name="module:zrender/shape/Base#setTransform"><a href="module-zrender_shape_Base.html#setTransform">setTransform</a></li>
<li data-name="module:zrender/shape/Base#transformCoordToLocal"><a href="module-zrender_shape_Base.html#transformCoordToLocal">transformCoordToLocal</a></li>
<li data-name="module:zrender/shape/Base#unbind"><a href="module-zrender_shape_Base.html#unbind">unbind</a></li>
<li data-name="module:zrender/shape/Base#updateTransform"><a href="module-zrender_shape_Base.html#updateTransform">updateTransform</a></li>
</ul>
<ul class="events itemMembers">
<span class="subtitle">Events</span>
<li data-name="module:zrender/shape/Base#event:onclick"><a href="module-zrender_shape_Base.html#event:onclick">onclick</a></li>
<li data-name="module:zrender/shape/Base#event:ondragend"><a href="module-zrender_shape_Base.html#event:ondragend">ondragend</a></li>
<li data-name="module:zrender/shape/Base#event:ondragenter"><a href="module-zrender_shape_Base.html#event:ondragenter">ondragenter</a></li>
<li data-name="module:zrender/shape/Base#event:ondragleave"><a href="module-zrender_shape_Base.html#event:ondragleave">ondragleave</a></li>
<li data-name="module:zrender/shape/Base#event:ondragover"><a href="module-zrender_shape_Base.html#event:ondragover">ondragover</a></li>
<li data-name="module:zrender/shape/Base#event:ondragstart"><a href="module-zrender_shape_Base.html#event:ondragstart">ondragstart</a></li>
<li data-name="module:zrender/shape/Base#event:ondrop"><a href="module-zrender_shape_Base.html#event:ondrop">ondrop</a></li>
<li data-name="module:zrender/shape/Base#event:onmousedown"><a href="module-zrender_shape_Base.html#event:onmousedown">onmousedown</a></li>
<li data-name="module:zrender/shape/Base#event:onmousemove"><a href="module-zrender_shape_Base.html#event:onmousemove">onmousemove</a></li>
<li data-name="module:zrender/shape/Base#event:onmouseout"><a href="module-zrender_shape_Base.html#event:onmouseout">onmouseout</a></li>
<li data-name="module:zrender/shape/Base#event:onmouseover"><a href="module-zrender_shape_Base.html#event:onmouseover">onmouseover</a></li>
<li data-name="module:zrender/shape/Base#event:onmouseup"><a href="module-zrender_shape_Base.html#event:onmouseup">onmouseup</a></li>
<li data-name="module:zrender/shape/Base#event:onmousewheel"><a href="module-zrender_shape_Base.html#event:onmousewheel">onmousewheel</a></li>
</ul>
</li>
<li class="item" data-name="module:zrender/shape/BezierCurve">
<span class="title">
<a href="module-zrender_shape_BezierCurve.html">module:zrender/shape/BezierCurve</a>
</span>
<ul class="members itemMembers">
<span class="subtitle">Members</span>
<li data-name="module:zrender/shape/BezierCurve#highlightStyle"><a href="module-zrender_shape_BezierCurve.html#highlightStyle">highlightStyle</a></li>
<li data-name="module:zrender/shape/BezierCurve#style"><a href="module-zrender_shape_BezierCurve.html#style">style</a></li>
<li data-name="module:zrender/shape/BezierCurve#id"><a href="module-zrender_shape_BezierCurve.html#id">id</a></li>
<li data-name="module:zrender/shape/BezierCurve#parent"><a href="module-zrender_shape_BezierCurve.html#parent">parent</a></li>
<li data-name="module:zrender/shape/BezierCurve#position"><a href="module-zrender_shape_BezierCurve.html#position">position</a></li>
<li data-name="module:zrender/shape/BezierCurve#rotation"><a href="module-zrender_shape_BezierCurve.html#rotation">rotation</a></li>
<li data-name="module:zrender/shape/BezierCurve#scale"><a href="module-zrender_shape_BezierCurve.html#scale">scale</a></li>
</ul>
<ul class="typedefs itemMembers">
<span class="subtitle">Typedefs</span>
<li data-name="module:zrender/shape/BezierCurve~IBezierCurveStyle"><a href="module-zrender_shape_BezierCurve.html#~IBezierCurveStyle">IBezierCurveStyle</a></li>
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="module:zrender/shape/BezierCurve#buildPath"><a href="module-zrender_shape_BezierCurve.html#buildPath">buildPath</a></li>
<li data-name="module:zrender/shape/BezierCurve#getRect"><a href="module-zrender_shape_BezierCurve.html#getRect">getRect</a></li>
<li data-name="module:zrender/shape/BezierCurve#afterBrush"><a href="module-zrender_shape_BezierCurve.html#afterBrush">afterBrush</a></li>
<li data-name="module:zrender/shape/BezierCurve#beforeBrush"><a href="module-zrender_shape_BezierCurve.html#beforeBrush">beforeBrush</a></li>
<li data-name="module:zrender/shape/BezierCurve#bind"><a href="module-zrender_shape_BezierCurve.html#bind">bind</a></li>
<li data-name="module:zrender/shape/BezierCurve#brush"><a href="module-zrender_shape_BezierCurve.html#brush">brush</a></li>
<li data-name="module:zrender/shape/BezierCurve#decomposeTransform"><a href="module-zrender_shape_BezierCurve.html#decomposeTransform">decomposeTransform</a></li>
<li data-name="module:zrender/shape/BezierCurve#dispatch"><a href="module-zrender_shape_BezierCurve.html#dispatch">dispatch</a></li>
<li data-name="module:zrender/shape/BezierCurve#dispatchWithContext"><a href="module-zrender_shape_BezierCurve.html#dispatchWithContext">dispatchWithContext</a></li>
<li data-name="module:zrender/shape/BezierCurve#drawText"><a href="module-zrender_shape_BezierCurve.html#drawText">drawText</a></li>
<li data-name="module:zrender/shape/BezierCurve#drift"><a href="module-zrender_shape_BezierCurve.html#drift">drift</a></li>
<li data-name="module:zrender/shape/BezierCurve#getHighlightStyle"><a href="module-zrender_shape_BezierCurve.html#getHighlightStyle">getHighlightStyle</a></li>
<li data-name="module:zrender/shape/BezierCurve#isCover"><a href="module-zrender_shape_BezierCurve.html#isCover">isCover</a></li>
<li data-name="module:zrender/shape/BezierCurve#isSilent"><a href="module-zrender_shape_BezierCurve.html#isSilent">isSilent</a></li>
<li data-name="module:zrender/shape/BezierCurve#lookAt"><a href="module-zrender_shape_BezierCurve.html#lookAt">lookAt</a></li>
<li data-name="module:zrender/shape/BezierCurve#one"><a href="module-zrender_shape_BezierCurve.html#one">one</a></li>
<li data-name="module:zrender/shape/BezierCurve#setContext"><a href="module-zrender_shape_BezierCurve.html#setContext">setContext</a></li>
<li data-name="module:zrender/shape/BezierCurve#setTransform"><a href="module-zrender_shape_BezierCurve.html#setTransform">setTransform</a></li>
<li data-name="module:zrender/shape/BezierCurve#transformCoordToLocal"><a href="module-zrender_shape_BezierCurve.html#transformCoordToLocal">transformCoordToLocal</a></li>
<li data-name="module:zrender/shape/BezierCurve#unbind"><a href="module-zrender_shape_BezierCurve.html#unbind">unbind</a></li>
<li data-name="module:zrender/shape/BezierCurve#updateTransform"><a href="module-zrender_shape_BezierCurve.html#updateTransform">updateTransform</a></li>
</ul>
<ul class="events itemMembers">
<span class="subtitle">Events</span>
<li data-name="module:zrender/shape/BezierCurve#event:onclick"><a href="module-zrender_shape_BezierCurve.html#event:onclick">onclick</a></li>
<li data-name="module:zrender/shape/BezierCurve#event:ondragend"><a href="module-zrender_shape_BezierCurve.html#event:ondragend">ondragend</a></li>
<li data-name="module:zrender/shape/BezierCurve#event:ondragenter"><a href="module-zrender_shape_BezierCurve.html#event:ondragenter">ondragenter</a></li>
<li data-name="module:zrender/shape/BezierCurve#event:ondragleave"><a href="module-zrender_shape_BezierCurve.html#event:ondragleave">ondragleave</a></li>
<li data-name="module:zrender/shape/BezierCurve#event:ondragover"><a href="module-zrender_shape_BezierCurve.html#event:ondragover">ondragover</a></li>
<li data-name="module:zrender/shape/BezierCurve#event:ondragstart"><a href="module-zrender_shape_BezierCurve.html#event:ondragstart">ondragstart</a></li>
<li data-name="module:zrender/shape/BezierCurve#event:ondrop"><a href="module-zrender_shape_BezierCurve.html#event:ondrop">ondrop</a></li>
<li data-name="module:zrender/shape/BezierCurve#event:onmousedown"><a href="module-zrender_shape_BezierCurve.html#event:onmousedown">onmousedown</a></li>
<li data-name="module:zrender/shape/BezierCurve#event:onmousemove"><a href="module-zrender_shape_BezierCurve.html#event:onmousemove">onmousemove</a></li>
<li data-name="module:zrender/shape/BezierCurve#event:onmouseout"><a href="module-zrender_shape_BezierCurve.html#event:onmouseout">onmouseout</a></li>
<li data-name="module:zrender/shape/BezierCurve#event:onmouseover"><a href="module-zrender_shape_BezierCurve.html#event:onmouseover">onmouseover</a></li>
<li data-name="module:zrender/shape/BezierCurve#event:onmouseup"><a href="module-zrender_shape_BezierCurve.html#event:onmouseup">onmouseup</a></li>
<li data-name="module:zrender/shape/BezierCurve#event:onmousewheel"><a href="module-zrender_shape_BezierCurve.html#event:onmousewheel">onmousewheel</a></li>
</ul>
</li>
<li class="item" data-name="module:zrender/shape/Circle">
<span class="title">
<a href="module-zrender_shape_Circle.html">module:zrender/shape/Circle</a>
</span>
<ul class="members itemMembers">
<span class="subtitle">Members</span>
<li data-name="module:zrender/shape/Circle#highlightStyle"><a href="module-zrender_shape_Circle.html#highlightStyle">highlightStyle</a></li>
<li data-name="module:zrender/shape/Circle#style"><a href="module-zrender_shape_Circle.html#style">style</a></li>
<li data-name="module:zrender/shape/Circle#id"><a href="module-zrender_shape_Circle.html#id">id</a></li>
<li data-name="module:zrender/shape/Circle#parent"><a href="module-zrender_shape_Circle.html#parent">parent</a></li>
<li data-name="module:zrender/shape/Circle#position"><a href="module-zrender_shape_Circle.html#position">position</a></li>
<li data-name="module:zrender/shape/Circle#rotation"><a href="module-zrender_shape_Circle.html#rotation">rotation</a></li>
<li data-name="module:zrender/shape/Circle#scale"><a href="module-zrender_shape_Circle.html#scale">scale</a></li>
</ul>
<ul class="typedefs itemMembers">
<span class="subtitle">Typedefs</span>
<li data-name="module:zrender/shape/Circle~ICircleStyle"><a href="module-zrender_shape_Circle.html#~ICircleStyle">ICircleStyle</a></li>
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="module:zrender/shape/Circle#buildPath"><a href="module-zrender_shape_Circle.html#buildPath">buildPath</a></li>
<li data-name="module:zrender/shape/Circle#getRect"><a href="module-zrender_shape_Circle.html#getRect">getRect</a></li>
<li data-name="module:zrender/shape/Circle#afterBrush"><a href="module-zrender_shape_Circle.html#afterBrush">afterBrush</a></li>
<li data-name="module:zrender/shape/Circle#beforeBrush"><a href="module-zrender_shape_Circle.html#beforeBrush">beforeBrush</a></li>
<li data-name="module:zrender/shape/Circle#bind"><a href="module-zrender_shape_Circle.html#bind">bind</a></li>
<li data-name="module:zrender/shape/Circle#brush"><a href="module-zrender_shape_Circle.html#brush">brush</a></li>
<li data-name="module:zrender/shape/Circle#decomposeTransform"><a href="module-zrender_shape_Circle.html#decomposeTransform">decomposeTransform</a></li>
<li data-name="module:zrender/shape/Circle#dispatch"><a href="module-zrender_shape_Circle.html#dispatch">dispatch</a></li>
<li data-name="module:zrender/shape/Circle#dispatchWithContext"><a href="module-zrender_shape_Circle.html#dispatchWithContext">dispatchWithContext</a></li>
<li data-name="module:zrender/shape/Circle#drawText"><a href="module-zrender_shape_Circle.html#drawText">drawText</a></li>
<li data-name="module:zrender/shape/Circle#drift"><a href="module-zrender_shape_Circle.html#drift">drift</a></li>
<li data-name="module:zrender/shape/Circle#getHighlightStyle"><a href="module-zrender_shape_Circle.html#getHighlightStyle">getHighlightStyle</a></li>
<li data-name="module:zrender/shape/Circle#isCover"><a href="module-zrender_shape_Circle.html#isCover">isCover</a></li>
<li data-name="module:zrender/shape/Circle#isSilent"><a href="module-zrender_shape_Circle.html#isSilent">isSilent</a></li>
<li data-name="module:zrender/shape/Circle#lookAt"><a href="module-zrender_shape_Circle.html#lookAt">lookAt</a></li>
<li data-name="module:zrender/shape/Circle#one"><a href="module-zrender_shape_Circle.html#one">one</a></li>
<li data-name="module:zrender/shape/Circle#setContext"><a href="module-zrender_shape_Circle.html#setContext">setContext</a></li>
<li data-name="module:zrender/shape/Circle#setTransform"><a href="module-zrender_shape_Circle.html#setTransform">setTransform</a></li>
<li data-name="module:zrender/shape/Circle#transformCoordToLocal"><a href="module-zrender_shape_Circle.html#transformCoordToLocal">transformCoordToLocal</a></li>
<li data-name="module:zrender/shape/Circle#unbind"><a href="module-zrender_shape_Circle.html#unbind">unbind</a></li>
<li data-name="module:zrender/shape/Circle#updateTransform"><a href="module-zrender_shape_Circle.html#updateTransform">updateTransform</a></li>
</ul>
<ul class="events itemMembers">
<span class="subtitle">Events</span>
<li data-name="module:zrender/shape/Circle#event:onclick"><a href="module-zrender_shape_Circle.html#event:onclick">onclick</a></li>
<li data-name="module:zrender/shape/Circle#event:ondragend"><a href="module-zrender_shape_Circle.html#event:ondragend">ondragend</a></li>
<li data-name="module:zrender/shape/Circle#event:ondragenter"><a href="module-zrender_shape_Circle.html#event:ondragenter">ondragenter</a></li>
<li data-name="module:zrender/shape/Circle#event:ondragleave"><a href="module-zrender_shape_Circle.html#event:ondragleave">ondragleave</a></li>
<li data-name="module:zrender/shape/Circle#event:ondragover"><a href="module-zrender_shape_Circle.html#event:ondragover">ondragover</a></li>
<li data-name="module:zrender/shape/Circle#event:ondragstart"><a href="module-zrender_shape_Circle.html#event:ondragstart">ondragstart</a></li>
<li data-name="module:zrender/shape/Circle#event:ondrop"><a href="module-zrender_shape_Circle.html#event:ondrop">ondrop</a></li>
<li data-name="module:zrender/shape/Circle#event:onmousedown"><a href="module-zrender_shape_Circle.html#event:onmousedown">onmousedown</a></li>
<li data-name="module:zrender/shape/Circle#event:onmousemove"><a href="module-zrender_shape_Circle.html#event:onmousemove">onmousemove</a></li>
<li data-name="module:zrender/shape/Circle#event:onmouseout"><a href="module-zrender_shape_Circle.html#event:onmouseout">onmouseout</a></li>
<li data-name="module:zrender/shape/Circle#event:onmouseover"><a href="module-zrender_shape_Circle.html#event:onmouseover">onmouseover</a></li>
<li data-name="module:zrender/shape/Circle#event:onmouseup"><a href="module-zrender_shape_Circle.html#event:onmouseup">onmouseup</a></li>
<li data-name="module:zrender/shape/Circle#event:onmousewheel"><a href="module-zrender_shape_Circle.html#event:onmousewheel">onmousewheel</a></li>
</ul>
</li>
<li class="item" data-name="module:zrender/shape/Droplet">
<span class="title">
<a href="module-zrender_shape_Droplet.html">module:zrender/shape/Droplet</a>
</span>
<ul class="members itemMembers">
<span class="subtitle">Members</span>
<li data-name="module:zrender/shape/Droplet#highlightStyle"><a href="module-zrender_shape_Droplet.html#highlightStyle">highlightStyle</a></li>
<li data-name="module:zrender/shape/Droplet#style"><a href="module-zrender_shape_Droplet.html#style">style</a></li>
<li data-name="module:zrender/shape/Droplet#id"><a href="module-zrender_shape_Droplet.html#id">id</a></li>
<li data-name="module:zrender/shape/Droplet#parent"><a href="module-zrender_shape_Droplet.html#parent">parent</a></li>
<li data-name="module:zrender/shape/Droplet#position"><a href="module-zrender_shape_Droplet.html#position">position</a></li>
<li data-name="module:zrender/shape/Droplet#rotation"><a href="module-zrender_shape_Droplet.html#rotation">rotation</a></li>
<li data-name="module:zrender/shape/Droplet#scale"><a href="module-zrender_shape_Droplet.html#scale">scale</a></li>
</ul>
<ul class="typedefs itemMembers">
<span class="subtitle">Typedefs</span>
<li data-name="module:zrender/shape/Droplet~IDropletStyle"><a href="module-zrender_shape_Droplet.html#~IDropletStyle">IDropletStyle</a></li>
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="module:zrender/shape/Droplet#buildPath"><a href="module-zrender_shape_Droplet.html#buildPath">buildPath</a></li>
<li data-name="module:zrender/shape/Droplet#getRect"><a href="module-zrender_shape_Droplet.html#getRect">getRect</a></li>
<li data-name="module:zrender/shape/Droplet#afterBrush"><a href="module-zrender_shape_Droplet.html#afterBrush">afterBrush</a></li>
<li data-name="module:zrender/shape/Droplet#beforeBrush"><a href="module-zrender_shape_Droplet.html#beforeBrush">beforeBrush</a></li>
<li data-name="module:zrender/shape/Droplet#bind"><a href="module-zrender_shape_Droplet.html#bind">bind</a></li>
<li data-name="module:zrender/shape/Droplet#brush"><a href="module-zrender_shape_Droplet.html#brush">brush</a></li>
<li data-name="module:zrender/shape/Droplet#decomposeTransform"><a href="module-zrender_shape_Droplet.html#decomposeTransform">decomposeTransform</a></li>
<li data-name="module:zrender/shape/Droplet#dispatch"><a href="module-zrender_shape_Droplet.html#dispatch">dispatch</a></li>
<li data-name="module:zrender/shape/Droplet#dispatchWithContext"><a href="module-zrender_shape_Droplet.html#dispatchWithContext">dispatchWithContext</a></li>
<li data-name="module:zrender/shape/Droplet#drawText"><a href="module-zrender_shape_Droplet.html#drawText">drawText</a></li>
<li data-name="module:zrender/shape/Droplet#drift"><a href="module-zrender_shape_Droplet.html#drift">drift</a></li>
<li data-name="module:zrender/shape/Droplet#getHighlightStyle"><a href="module-zrender_shape_Droplet.html#getHighlightStyle">getHighlightStyle</a></li>
<li data-name="module:zrender/shape/Droplet#isCover"><a href="module-zrender_shape_Droplet.html#isCover">isCover</a></li>
<li data-name="module:zrender/shape/Droplet#isSilent"><a href="module-zrender_shape_Droplet.html#isSilent">isSilent</a></li>
<li data-name="module:zrender/shape/Droplet#lookAt"><a href="module-zrender_shape_Droplet.html#lookAt">lookAt</a></li>
<li data-name="module:zrender/shape/Droplet#one"><a href="module-zrender_shape_Droplet.html#one">one</a></li>
<li data-name="module:zrender/shape/Droplet#setContext"><a href="module-zrender_shape_Droplet.html#setContext">setContext</a></li>
<li data-name="module:zrender/shape/Droplet#setTransform"><a href="module-zrender_shape_Droplet.html#setTransform">setTransform</a></li>
<li data-name="module:zrender/shape/Droplet#transformCoordToLocal"><a href="module-zrender_shape_Droplet.html#transformCoordToLocal">transformCoordToLocal</a></li>
<li data-name="module:zrender/shape/Droplet#unbind"><a href="module-zrender_shape_Droplet.html#unbind">unbind</a></li>
<li data-name="module:zrender/shape/Droplet#updateTransform"><a href="module-zrender_shape_Droplet.html#updateTransform">updateTransform</a></li>
</ul>
<ul class="events itemMembers">
<span class="subtitle">Events</span>
<li data-name="module:zrender/shape/Droplet#event:onclick"><a href="module-zrender_shape_Droplet.html#event:onclick">onclick</a></li>
<li data-name="module:zrender/shape/Droplet#event:ondragend"><a href="module-zrender_shape_Droplet.html#event:ondragend">ondragend</a></li>
<li data-name="module:zrender/shape/Droplet#event:ondragenter"><a href="module-zrender_shape_Droplet.html#event:ondragenter">ondragenter</a></li>
<li data-name="module:zrender/shape/Droplet#event:ondragleave"><a href="module-zrender_shape_Droplet.html#event:ondragleave">ondragleave</a></li>
<li data-name="module:zrender/shape/Droplet#event:ondragover"><a href="module-zrender_shape_Droplet.html#event:ondragover">ondragover</a></li>
<li data-name="module:zrender/shape/Droplet#event:ondragstart"><a href="module-zrender_shape_Droplet.html#event:ondragstart">ondragstart</a></li>
<li data-name="module:zrender/shape/Droplet#event:ondrop"><a href="module-zrender_shape_Droplet.html#event:ondrop">ondrop</a></li>
<li data-name="module:zrender/shape/Droplet#event:onmousedown"><a href="module-zrender_shape_Droplet.html#event:onmousedown">onmousedown</a></li>
<li data-name="module:zrender/shape/Droplet#event:onmousemove"><a href="module-zrender_shape_Droplet.html#event:onmousemove">onmousemove</a></li>
<li data-name="module:zrender/shape/Droplet#event:onmouseout"><a href="module-zrender_shape_Droplet.html#event:onmouseout">onmouseout</a></li>
<li data-name="module:zrender/shape/Droplet#event:onmouseover"><a href="module-zrender_shape_Droplet.html#event:onmouseover">onmouseover</a></li>
<li data-name="module:zrender/shape/Droplet#event:onmouseup"><a href="module-zrender_shape_Droplet.html#event:onmouseup">onmouseup</a></li>
<li data-name="module:zrender/shape/Droplet#event:onmousewheel"><a href="module-zrender_shape_Droplet.html#event:onmousewheel">onmousewheel</a></li>
</ul>
</li>
<li class="item" data-name="module:zrender/shape/Ellipse">
<span class="title">
<a href="module-zrender_shape_Ellipse.html">module:zrender/shape/Ellipse</a>
</span>
<ul class="members itemMembers">
<span class="subtitle">Members</span>
<li data-name="module:zrender/shape/Ellipse#highlightStyle"><a href="module-zrender_shape_Ellipse.html#highlightStyle">highlightStyle</a></li>
<li data-name="module:zrender/shape/Ellipse#style"><a href="module-zrender_shape_Ellipse.html#style">style</a></li>
<li data-name="module:zrender/shape/Ellipse#id"><a href="module-zrender_shape_Ellipse.html#id">id</a></li>
<li data-name="module:zrender/shape/Ellipse#parent"><a href="module-zrender_shape_Ellipse.html#parent">parent</a></li>
<li data-name="module:zrender/shape/Ellipse#position"><a href="module-zrender_shape_Ellipse.html#position">position</a></li>
<li data-name="module:zrender/shape/Ellipse#rotation"><a href="module-zrender_shape_Ellipse.html#rotation">rotation</a></li>
<li data-name="module:zrender/shape/Ellipse#scale"><a href="module-zrender_shape_Ellipse.html#scale">scale</a></li>
</ul>
<ul class="typedefs itemMembers">
<span class="subtitle">Typedefs</span>
<li data-name="module:zrender/shape/Ellipse~IEllipseStyle"><a href="module-zrender_shape_Ellipse.html#~IEllipseStyle">IEllipseStyle</a></li>
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="module:zrender/shape/Ellipse#buildPath"><a href="module-zrender_shape_Ellipse.html#buildPath">buildPath</a></li>
<li data-name="module:zrender/shape/Ellipse#getRect"><a href="module-zrender_shape_Ellipse.html#getRect">getRect</a></li>
<li data-name="module:zrender/shape/Ellipse#afterBrush"><a href="module-zrender_shape_Ellipse.html#afterBrush">afterBrush</a></li>
<li data-name="module:zrender/shape/Ellipse#beforeBrush"><a href="module-zrender_shape_Ellipse.html#beforeBrush">beforeBrush</a></li>
<li data-name="module:zrender/shape/Ellipse#bind"><a href="module-zrender_shape_Ellipse.html#bind">bind</a></li>
<li data-name="module:zrender/shape/Ellipse#brush"><a href="module-zrender_shape_Ellipse.html#brush">brush</a></li>
<li data-name="module:zrender/shape/Ellipse#decomposeTransform"><a href="module-zrender_shape_Ellipse.html#decomposeTransform">decomposeTransform</a></li>
<li data-name="module:zrender/shape/Ellipse#dispatch"><a href="module-zrender_shape_Ellipse.html#dispatch">dispatch</a></li>
<li data-name="module:zrender/shape/Ellipse#dispatchWithContext"><a href="module-zrender_shape_Ellipse.html#dispatchWithContext">dispatchWithContext</a></li>
<li data-name="module:zrender/shape/Ellipse#drawText"><a href="module-zrender_shape_Ellipse.html#drawText">drawText</a></li>
<li data-name="module:zrender/shape/Ellipse#drift"><a href="module-zrender_shape_Ellipse.html#drift">drift</a></li>
<li data-name="module:zrender/shape/Ellipse#getHighlightStyle"><a href="module-zrender_shape_Ellipse.html#getHighlightStyle">getHighlightStyle</a></li>
<li data-name="module:zrender/shape/Ellipse#isCover"><a href="module-zrender_shape_Ellipse.html#isCover">isCover</a></li>
<li data-name="module:zrender/shape/Ellipse#isSilent"><a href="module-zrender_shape_Ellipse.html#isSilent">isSilent</a></li>
<li data-name="module:zrender/shape/Ellipse#lookAt"><a href="module-zrender_shape_Ellipse.html#lookAt">lookAt</a></li>
<li data-name="module:zrender/shape/Ellipse#one"><a href="module-zrender_shape_Ellipse.html#one">one</a></li>
<li data-name="module:zrender/shape/Ellipse#setContext"><a href="module-zrender_shape_Ellipse.html#setContext">setContext</a></li>
<li data-name="module:zrender/shape/Ellipse#setTransform"><a href="module-zrender_shape_Ellipse.html#setTransform">setTransform</a></li>
<li data-name="module:zrender/shape/Ellipse#transformCoordToLocal"><a href="module-zrender_shape_Ellipse.html#transformCoordToLocal">transformCoordToLocal</a></li>
<li data-name="module:zrender/shape/Ellipse#unbind"><a href="module-zrender_shape_Ellipse.html#unbind">unbind</a></li>
<li data-name="module:zrender/shape/Ellipse#updateTransform"><a href="module-zrender_shape_Ellipse.html#updateTransform">updateTransform</a></li>
</ul>
<ul class="events itemMembers">
<span class="subtitle">Events</span>
<li data-name="module:zrender/shape/Ellipse#event:onclick"><a href="module-zrender_shape_Ellipse.html#event:onclick">onclick</a></li>
<li data-name="module:zrender/shape/Ellipse#event:ondragend"><a href="module-zrender_shape_Ellipse.html#event:ondragend">ondragend</a></li>
<li data-name="module:zrender/shape/Ellipse#event:ondragenter"><a href="module-zrender_shape_Ellipse.html#event:ondragenter">ondragenter</a></li>
<li data-name="module:zrender/shape/Ellipse#event:ondragleave"><a href="module-zrender_shape_Ellipse.html#event:ondragleave">ondragleave</a></li>
<li data-name="module:zrender/shape/Ellipse#event:ondragover"><a href="module-zrender_shape_Ellipse.html#event:ondragover">ondragover</a></li>
<li data-name="module:zrender/shape/Ellipse#event:ondragstart"><a href="module-zrender_shape_Ellipse.html#event:ondragstart">ondragstart</a></li>
<li data-name="module:zrender/shape/Ellipse#event:ondrop"><a href="module-zrender_shape_Ellipse.html#event:ondrop">ondrop</a></li>
<li data-name="module:zrender/shape/Ellipse#event:onmousedown"><a href="module-zrender_shape_Ellipse.html#event:onmousedown">onmousedown</a></li>
<li data-name="module:zrender/shape/Ellipse#event:onmousemove"><a href="module-zrender_shape_Ellipse.html#event:onmousemove">onmousemove</a></li>
<li data-name="module:zrender/shape/Ellipse#event:onmouseout"><a href="module-zrender_shape_Ellipse.html#event:onmouseout">onmouseout</a></li>
<li data-name="module:zrender/shape/Ellipse#event:onmouseover"><a href="module-zrender_shape_Ellipse.html#event:onmouseover">onmouseover</a></li>
<li data-name="module:zrender/shape/Ellipse#event:onmouseup"><a href="module-zrender_shape_Ellipse.html#event:onmouseup">onmouseup</a></li>
<li data-name="module:zrender/shape/Ellipse#event:onmousewheel"><a href="module-zrender_shape_Ellipse.html#event:onmousewheel">onmousewheel</a></li>
</ul>
</li>
<li class="item" data-name="module:zrender/shape/Heart">
<span class="title">
<a href="module-zrender_shape_Heart.html">module:zrender/shape/Heart</a>
</span>
<ul class="members itemMembers">
<span class="subtitle">Members</span>
<li data-name="module:zrender/shape/Heart#highlightStyle"><a href="module-zrender_shape_Heart.html#highlightStyle">highlightStyle</a></li>
<li data-name="module:zrender/shape/Heart#style"><a href="module-zrender_shape_Heart.html#style">style</a></li>
<li data-name="module:zrender/shape/Heart#id"><a href="module-zrender_shape_Heart.html#id">id</a></li>
<li data-name="module:zrender/shape/Heart#parent"><a href="module-zrender_shape_Heart.html#parent">parent</a></li>
<li data-name="module:zrender/shape/Heart#position"><a href="module-zrender_shape_Heart.html#position">position</a></li>
<li data-name="module:zrender/shape/Heart#rotation"><a href="module-zrender_shape_Heart.html#rotation">rotation</a></li>
<li data-name="module:zrender/shape/Heart#scale"><a href="module-zrender_shape_Heart.html#scale">scale</a></li>
</ul>
<ul class="typedefs itemMembers">
<span class="subtitle">Typedefs</span>
<li data-name="module:zrender/shape/Heart~IHeartStyle"><a href="module-zrender_shape_Heart.html#~IHeartStyle">IHeartStyle</a></li>
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="module:zrender/shape/Heart#buildPath"><a href="module-zrender_shape_Heart.html#buildPath">buildPath</a></li>
<li data-name="module:zrender/shape/Heart#getRect"><a href="module-zrender_shape_Heart.html#getRect">getRect</a></li>
<li data-name="module:zrender/shape/Heart#afterBrush"><a href="module-zrender_shape_Heart.html#afterBrush">afterBrush</a></li>
<li data-name="module:zrender/shape/Heart#beforeBrush"><a href="module-zrender_shape_Heart.html#beforeBrush">beforeBrush</a></li>
<li data-name="module:zrender/shape/Heart#bind"><a href="module-zrender_shape_Heart.html#bind">bind</a></li>
<li data-name="module:zrender/shape/Heart#brush"><a href="module-zrender_shape_Heart.html#brush">brush</a></li>
<li data-name="module:zrender/shape/Heart#decomposeTransform"><a href="module-zrender_shape_Heart.html#decomposeTransform">decomposeTransform</a></li>
<li data-name="module:zrender/shape/Heart#dispatch"><a href="module-zrender_shape_Heart.html#dispatch">dispatch</a></li>
<li data-name="module:zrender/shape/Heart#dispatchWithContext"><a href="module-zrender_shape_Heart.html#dispatchWithContext">dispatchWithContext</a></li>
<li data-name="module:zrender/shape/Heart#drawText"><a href="module-zrender_shape_Heart.html#drawText">drawText</a></li>
<li data-name="module:zrender/shape/Heart#drift"><a href="module-zrender_shape_Heart.html#drift">drift</a></li>
<li data-name="module:zrender/shape/Heart#getHighlightStyle"><a href="module-zrender_shape_Heart.html#getHighlightStyle">getHighlightStyle</a></li>
<li data-name="module:zrender/shape/Heart#isCover"><a href="module-zrender_shape_Heart.html#isCover">isCover</a></li>
<li data-name="module:zrender/shape/Heart#isSilent"><a href="module-zrender_shape_Heart.html#isSilent">isSilent</a></li>
<li data-name="module:zrender/shape/Heart#lookAt"><a href="module-zrender_shape_Heart.html#lookAt">lookAt</a></li>
<li data-name="module:zrender/shape/Heart#one"><a href="module-zrender_shape_Heart.html#one">one</a></li>
<li data-name="module:zrender/shape/Heart#setContext"><a href="module-zrender_shape_Heart.html#setContext">setContext</a></li>
<li data-name="module:zrender/shape/Heart#setTransform"><a href="module-zrender_shape_Heart.html#setTransform">setTransform</a></li>
<li data-name="module:zrender/shape/Heart#transformCoordToLocal"><a href="module-zrender_shape_Heart.html#transformCoordToLocal">transformCoordToLocal</a></li>
<li data-name="module:zrender/shape/Heart#unbind"><a href="module-zrender_shape_Heart.html#unbind">unbind</a></li>
<li data-name="module:zrender/shape/Heart#updateTransform"><a href="module-zrender_shape_Heart.html#updateTransform">updateTransform</a></li>
</ul>
<ul class="events itemMembers">
<span class="subtitle">Events</span>
<li data-name="module:zrender/shape/Heart#event:onclick"><a href="module-zrender_shape_Heart.html#event:onclick">onclick</a></li>
<li data-name="module:zrender/shape/Heart#event:ondragend"><a href="module-zrender_shape_Heart.html#event:ondragend">ondragend</a></li>
<li data-name="module:zrender/shape/Heart#event:ondragenter"><a href="module-zrender_shape_Heart.html#event:ondragenter">ondragenter</a></li>
<li data-name="module:zrender/shape/Heart#event:ondragleave"><a href="module-zrender_shape_Heart.html#event:ondragleave">ondragleave</a></li>
<li data-name="module:zrender/shape/Heart#event:ondragover"><a href="module-zrender_shape_Heart.html#event:ondragover">ondragover</a></li>
<li data-name="module:zrender/shape/Heart#event:ondragstart"><a href="module-zrender_shape_Heart.html#event:ondragstart">ondragstart</a></li>
<li data-name="module:zrender/shape/Heart#event:ondrop"><a href="module-zrender_shape_Heart.html#event:ondrop">ondrop</a></li>
<li data-name="module:zrender/shape/Heart#event:onmousedown"><a href="module-zrender_shape_Heart.html#event:onmousedown">onmousedown</a></li>
<li data-name="module:zrender/shape/Heart#event:onmousemove"><a href="module-zrender_shape_Heart.html#event:onmousemove">onmousemove</a></li>
<li data-name="module:zrender/shape/Heart#event:onmouseout"><a href="module-zrender_shape_Heart.html#event:onmouseout">onmouseout</a></li>
<li data-name="module:zrender/shape/Heart#event:onmouseover"><a href="module-zrender_shape_Heart.html#event:onmouseover">onmouseover</a></li>
<li data-name="module:zrender/shape/Heart#event:onmouseup"><a href="module-zrender_shape_Heart.html#event:onmouseup">onmouseup</a></li>
<li data-name="module:zrender/shape/Heart#event:onmousewheel"><a href="module-zrender_shape_Heart.html#event:onmousewheel">onmousewheel</a></li>
</ul>
</li>
<li class="item" data-name="module:zrender/shape/Image">
<span class="title">
<a href="module-zrender_shape_Image.html">module:zrender/shape/Image</a>
</span>
<ul class="members itemMembers">
<span class="subtitle">Members</span>
<li data-name="module:zrender/shape/Image#highlightStyle"><a href="module-zrender_shape_Image.html#highlightStyle">highlightStyle</a></li>
<li data-name="module:zrender/shape/Image#style"><a href="module-zrender_shape_Image.html#style">style</a></li>
</ul>
<ul class="typedefs itemMembers">
<span class="subtitle">Typedefs</span>
<li data-name="module:zrender/shape/Image~IImageStyle"><a href="module-zrender_shape_Image.html#~IImageStyle">IImageStyle</a></li>
</ul>
<ul class="methods itemMembers">
</ul>
<ul class="events itemMembers">
</ul>
</li>
<li class="item" data-name="module:zrender/shape/Isogon">
<span class="title">
<a href="module-zrender_shape_Isogon.html">module:zrender/shape/Isogon</a>
</span>
<ul class="members itemMembers">
<span class="subtitle">Members</span>
<li data-name="module:zrender/shape/Isogon#highlightStyle"><a href="module-zrender_shape_Isogon.html#highlightStyle">highlightStyle</a></li>
<li data-name="module:zrender/shape/Isogon#style"><a href="module-zrender_shape_Isogon.html#style">style</a></li>
</ul>
<ul class="typedefs itemMembers">
<span class="subtitle">Typedefs</span>
<li data-name="module:zrender/shape/Isogon~IIsogonStyle"><a href="module-zrender_shape_Isogon.html#~IIsogonStyle">IIsogonStyle</a></li>
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="module:zrender/shape/Isogon#buildPath"><a href="module-zrender_shape_Isogon.html#buildPath">buildPath</a></li>
<li data-name="module:zrender/shape/Isogon#getRect"><a href="module-zrender_shape_Isogon.html#getRect">getRect</a></li>
</ul>
<ul class="events itemMembers">
</ul>
</li>
<li class="item" data-name="module:zrender/shape/Line">
<span class="title">
<a href="module-zrender_shape_Line.html">module:zrender/shape/Line</a>
</span>
<ul class="members itemMembers">
<span class="subtitle">Members</span>
<li data-name="module:zrender/shape/Line#highlightStyle"><a href="module-zrender_shape_Line.html#highlightStyle">highlightStyle</a></li>
<li data-name="module:zrender/shape/Line#style"><a href="module-zrender_shape_Line.html#style">style</a></li>
<li data-name="module:zrender/shape/Line#id"><a href="module-zrender_shape_Line.html#id">id</a></li>
<li data-name="module:zrender/shape/Line#parent"><a href="module-zrender_shape_Line.html#parent">parent</a></li>
<li data-name="module:zrender/shape/Line#position"><a href="module-zrender_shape_Line.html#position">position</a></li>
<li data-name="module:zrender/shape/Line#rotation"><a href="module-zrender_shape_Line.html#rotation">rotation</a></li>
<li data-name="module:zrender/shape/Line#scale"><a href="module-zrender_shape_Line.html#scale">scale</a></li>
</ul>
<ul class="typedefs itemMembers">
<span class="subtitle">Typedefs</span>
<li data-name="module:zrender/shape/Line~ILineStyle"><a href="module-zrender_shape_Line.html#~ILineStyle">ILineStyle</a></li>
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="module:zrender/shape/Line#buildPath"><a href="module-zrender_shape_Line.html#buildPath">buildPath</a></li>
<li data-name="module:zrender/shape/Line#getRect"><a href="module-zrender_shape_Line.html#getRect">getRect</a></li>
<li data-name="module:zrender/shape/Line#afterBrush"><a href="module-zrender_shape_Line.html#afterBrush">afterBrush</a></li>
<li data-name="module:zrender/shape/Line#beforeBrush"><a href="module-zrender_shape_Line.html#beforeBrush">beforeBrush</a></li>
<li data-name="module:zrender/shape/Line#bind"><a href="module-zrender_shape_Line.html#bind">bind</a></li>
<li data-name="module:zrender/shape/Line#brush"><a href="module-zrender_shape_Line.html#brush">brush</a></li>
<li data-name="module:zrender/shape/Line#decomposeTransform"><a href="module-zrender_shape_Line.html#decomposeTransform">decomposeTransform</a></li>
<li data-name="module:zrender/shape/Line#dispatch"><a href="module-zrender_shape_Line.html#dispatch">dispatch</a></li>
<li data-name="module:zrender/shape/Line#dispatchWithContext"><a href="module-zrender_shape_Line.html#dispatchWithContext">dispatchWithContext</a></li>
<li data-name="module:zrender/shape/Line#drawText"><a href="module-zrender_shape_Line.html#drawText">drawText</a></li>
<li data-name="module:zrender/shape/Line#drift"><a href="module-zrender_shape_Line.html#drift">drift</a></li>
<li data-name="module:zrender/shape/Line#getHighlightStyle"><a href="module-zrender_shape_Line.html#getHighlightStyle">getHighlightStyle</a></li>
<li data-name="module:zrender/shape/Line#isCover"><a href="module-zrender_shape_Line.html#isCover">isCover</a></li>
<li data-name="module:zrender/shape/Line#isSilent"><a href="module-zrender_shape_Line.html#isSilent">isSilent</a></li>
<li data-name="module:zrender/shape/Line#lookAt"><a href="module-zrender_shape_Line.html#lookAt">lookAt</a></li>
<li data-name="module:zrender/shape/Line#one"><a href="module-zrender_shape_Line.html#one">one</a></li>
<li data-name="module:zrender/shape/Line#setContext"><a href="module-zrender_shape_Line.html#setContext">setContext</a></li>
<li data-name="module:zrender/shape/Line#setTransform"><a href="module-zrender_shape_Line.html#setTransform">setTransform</a></li>
<li data-name="module:zrender/shape/Line#transformCoordToLocal"><a href="module-zrender_shape_Line.html#transformCoordToLocal">transformCoordToLocal</a></li>
<li data-name="module:zrender/shape/Line#unbind"><a href="module-zrender_shape_Line.html#unbind">unbind</a></li>
<li data-name="module:zrender/shape/Line#updateTransform"><a href="module-zrender_shape_Line.html#updateTransform">updateTransform</a></li>
</ul>
<ul class="events itemMembers">
<span class="subtitle">Events</span>
<li data-name="module:zrender/shape/Line#event:onclick"><a href="module-zrender_shape_Line.html#event:onclick">onclick</a></li>
<li data-name="module:zrender/shape/Line#event:ondragend"><a href="module-zrender_shape_Line.html#event:ondragend">ondragend</a></li>
<li data-name="module:zrender/shape/Line#event:ondragenter"><a href="module-zrender_shape_Line.html#event:ondragenter">ondragenter</a></li>
<li data-name="module:zrender/shape/Line#event:ondragleave"><a href="module-zrender_shape_Line.html#event:ondragleave">ondragleave</a></li>
<li data-name="module:zrender/shape/Line#event:ondragover"><a href="module-zrender_shape_Line.html#event:ondragover">ondragover</a></li>
<li data-name="module:zrender/shape/Line#event:ondragstart"><a href="module-zrender_shape_Line.html#event:ondragstart">ondragstart</a></li>
<li data-name="module:zrender/shape/Line#event:ondrop"><a href="module-zrender_shape_Line.html#event:ondrop">ondrop</a></li>
<li data-name="module:zrender/shape/Line#event:onmousedown"><a href="module-zrender_shape_Line.html#event:onmousedown">onmousedown</a></li>
<li data-name="module:zrender/shape/Line#event:onmousemove"><a href="module-zrender_shape_Line.html#event:onmousemove">onmousemove</a></li>
<li data-name="module:zrender/shape/Line#event:onmouseout"><a href="module-zrender_shape_Line.html#event:onmouseout">onmouseout</a></li>
<li data-name="module:zrender/shape/Line#event:onmouseover"><a href="module-zrender_shape_Line.html#event:onmouseover">onmouseover</a></li>
<li data-name="module:zrender/shape/Line#event:onmouseup"><a href="module-zrender_shape_Line.html#event:onmouseup">onmouseup</a></li>
<li data-name="module:zrender/shape/Line#event:onmousewheel"><a href="module-zrender_shape_Line.html#event:onmousewheel">onmousewheel</a></li>
</ul>
</li>
<li class="item" data-name="module:zrender/shape/Path">
<span class="title">
<a href="module-zrender_shape_Path.html">module:zrender/shape/Path</a>
</span>
<ul class="members itemMembers">
<span class="subtitle">Members</span>
<li data-name="module:zrender/shape/Path#highlightStyle"><a href="module-zrender_shape_Path.html#highlightStyle">highlightStyle</a></li>
<li data-name="module:zrender/shape/Path#style"><a href="module-zrender_shape_Path.html#style">style</a></li>
<li data-name="module:zrender/shape/Path#id"><a href="module-zrender_shape_Path.html#id">id</a></li>
<li data-name="module:zrender/shape/Path#parent"><a href="module-zrender_shape_Path.html#parent">parent</a></li>
<li data-name="module:zrender/shape/Path#position"><a href="module-zrender_shape_Path.html#position">position</a></li>
<li data-name="module:zrender/shape/Path#rotation"><a href="module-zrender_shape_Path.html#rotation">rotation</a></li>
<li data-name="module:zrender/shape/Path#scale"><a href="module-zrender_shape_Path.html#scale">scale</a></li>
</ul>
<ul class="typedefs itemMembers">
<span class="subtitle">Typedefs</span>
<li data-name="module:zrender/shape/Path~IPathStyle"><a href="module-zrender_shape_Path.html#~IPathStyle">IPathStyle</a></li>
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="module:zrender/shape/Path#buildPath"><a href="module-zrender_shape_Path.html#buildPath">buildPath</a></li>
<li data-name="module:zrender/shape/Path#getRect"><a href="module-zrender_shape_Path.html#getRect">getRect</a></li>
<li data-name="module:zrender/shape/Path#afterBrush"><a href="module-zrender_shape_Path.html#afterBrush">afterBrush</a></li>
<li data-name="module:zrender/shape/Path#beforeBrush"><a href="module-zrender_shape_Path.html#beforeBrush">beforeBrush</a></li>
<li data-name="module:zrender/shape/Path#bind"><a href="module-zrender_shape_Path.html#bind">bind</a></li>
<li data-name="module:zrender/shape/Path#brush"><a href="module-zrender_shape_Path.html#brush">brush</a></li>
<li data-name="module:zrender/shape/Path#decomposeTransform"><a href="module-zrender_shape_Path.html#decomposeTransform">decomposeTransform</a></li>
<li data-name="module:zrender/shape/Path#dispatch"><a href="module-zrender_shape_Path.html#dispatch">dispatch</a></li>
<li data-name="module:zrender/shape/Path#dispatchWithContext"><a href="module-zrender_shape_Path.html#dispatchWithContext">dispatchWithContext</a></li>
<li data-name="module:zrender/shape/Path#drawText"><a href="module-zrender_shape_Path.html#drawText">drawText</a></li>
<li data-name="module:zrender/shape/Path#drift"><a href="module-zrender_shape_Path.html#drift">drift</a></li>
<li data-name="module:zrender/shape/Path#getHighlightStyle"><a href="module-zrender_shape_Path.html#getHighlightStyle">getHighlightStyle</a></li>
<li data-name="module:zrender/shape/Path#isCover"><a href="module-zrender_shape_Path.html#isCover">isCover</a></li>
<li data-name="module:zrender/shape/Path#isSilent"><a href="module-zrender_shape_Path.html#isSilent">isSilent</a></li>
<li data-name="module:zrender/shape/Path#lookAt"><a href="module-zrender_shape_Path.html#lookAt">lookAt</a></li>
<li data-name="module:zrender/shape/Path#one"><a href="module-zrender_shape_Path.html#one">one</a></li>
<li data-name="module:zrender/shape/Path#setContext"><a href="module-zrender_shape_Path.html#setContext">setContext</a></li>
<li data-name="module:zrender/shape/Path#setTransform"><a href="module-zrender_shape_Path.html#setTransform">setTransform</a></li>
<li data-name="module:zrender/shape/Path#transformCoordToLocal"><a href="module-zrender_shape_Path.html#transformCoordToLocal">transformCoordToLocal</a></li>
<li data-name="module:zrender/shape/Path#unbind"><a href="module-zrender_shape_Path.html#unbind">unbind</a></li>
<li data-name="module:zrender/shape/Path#updateTransform"><a href="module-zrender_shape_Path.html#updateTransform">updateTransform</a></li>
</ul>
<ul class="events itemMembers">
<span class="subtitle">Events</span>
<li data-name="module:zrender/shape/Path#event:onclick"><a href="module-zrender_shape_Path.html#event:onclick">onclick</a></li>
<li data-name="module:zrender/shape/Path#event:ondragend"><a href="module-zrender_shape_Path.html#event:ondragend">ondragend</a></li>
<li data-name="module:zrender/shape/Path#event:ondragenter"><a href="module-zrender_shape_Path.html#event:ondragenter">ondragenter</a></li>
<li data-name="module:zrender/shape/Path#event:ondragleave"><a href="module-zrender_shape_Path.html#event:ondragleave">ondragleave</a></li>
<li data-name="module:zrender/shape/Path#event:ondragover"><a href="module-zrender_shape_Path.html#event:ondragover">ondragover</a></li>
<li data-name="module:zrender/shape/Path#event:ondragstart"><a href="module-zrender_shape_Path.html#event:ondragstart">ondragstart</a></li>
<li data-name="module:zrender/shape/Path#event:ondrop"><a href="module-zrender_shape_Path.html#event:ondrop">ondrop</a></li>
<li data-name="module:zrender/shape/Path#event:onmousedown"><a href="module-zrender_shape_Path.html#event:onmousedown">onmousedown</a></li>
<li data-name="module:zrender/shape/Path#event:onmousemove"><a href="module-zrender_shape_Path.html#event:onmousemove">onmousemove</a></li>
<li data-name="module:zrender/shape/Path#event:onmouseout"><a href="module-zrender_shape_Path.html#event:onmouseout">onmouseout</a></li>
<li data-name="module:zrender/shape/Path#event:onmouseover"><a href="module-zrender_shape_Path.html#event:onmouseover">onmouseover</a></li>
<li data-name="module:zrender/shape/Path#event:onmouseup"><a href="module-zrender_shape_Path.html#event:onmouseup">onmouseup</a></li>
<li data-name="module:zrender/shape/Path#event:onmousewheel"><a href="module-zrender_shape_Path.html#event:onmousewheel">onmousewheel</a></li>
</ul>
</li>
<li class="item" data-name="module:zrender/shape/Polygon">
<span class="title">
<a href="module-zrender_shape_Polygon.html">module:zrender/shape/Polygon</a>
</span>
<ul class="members itemMembers">
<span class="subtitle">Members</span>
<li data-name="module:zrender/shape/Polygon#highlightStyle"><a href="module-zrender_shape_Polygon.html#highlightStyle">highlightStyle</a></li>
<li data-name="module:zrender/shape/Polygon#style"><a href="module-zrender_shape_Polygon.html#style">style</a></li>
<li data-name="module:zrender/shape/Polygon#id"><a href="module-zrender_shape_Polygon.html#id">id</a></li>
<li data-name="module:zrender/shape/Polygon#parent"><a href="module-zrender_shape_Polygon.html#parent">parent</a></li>
<li data-name="module:zrender/shape/Polygon#position"><a href="module-zrender_shape_Polygon.html#position">position</a></li>
<li data-name="module:zrender/shape/Polygon#rotation"><a href="module-zrender_shape_Polygon.html#rotation">rotation</a></li>
<li data-name="module:zrender/shape/Polygon#scale"><a href="module-zrender_shape_Polygon.html#scale">scale</a></li>
</ul>
<ul class="typedefs itemMembers">
<span class="subtitle">Typedefs</span>
<li data-name="module:zrender/shape/Polygon~IPolygonStyle"><a href="module-zrender_shape_Polygon.html#~IPolygonStyle">IPolygonStyle</a></li>
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="module:zrender/shape/Polygon#buildPath"><a href="module-zrender_shape_Polygon.html#buildPath">buildPath</a></li>
<li data-name="module:zrender/shape/Polygon#getRect"><a href="module-zrender_shape_Polygon.html#getRect">getRect</a></li>
<li data-name="module:zrender/shape/Polygon#afterBrush"><a href="module-zrender_shape_Polygon.html#afterBrush">afterBrush</a></li>
<li data-name="module:zrender/shape/Polygon#beforeBrush"><a href="module-zrender_shape_Polygon.html#beforeBrush">beforeBrush</a></li>
<li data-name="module:zrender/shape/Polygon#bind"><a href="module-zrender_shape_Polygon.html#bind">bind</a></li>
<li data-name="module:zrender/shape/Polygon#brush"><a href="module-zrender_shape_Polygon.html#brush">brush</a></li>
<li data-name="module:zrender/shape/Polygon#decomposeTransform"><a href="module-zrender_shape_Polygon.html#decomposeTransform">decomposeTransform</a></li>
<li data-name="module:zrender/shape/Polygon#dispatch"><a href="module-zrender_shape_Polygon.html#dispatch">dispatch</a></li>
<li data-name="module:zrender/shape/Polygon#dispatchWithContext"><a href="module-zrender_shape_Polygon.html#dispatchWithContext">dispatchWithContext</a></li>
<li data-name="module:zrender/shape/Polygon#drawText"><a href="module-zrender_shape_Polygon.html#drawText">drawText</a></li>
<li data-name="module:zrender/shape/Polygon#drift"><a href="module-zrender_shape_Polygon.html#drift">drift</a></li>
<li data-name="module:zrender/shape/Polygon#getHighlightStyle"><a href="module-zrender_shape_Polygon.html#getHighlightStyle">getHighlightStyle</a></li>
<li data-name="module:zrender/shape/Polygon#isCover"><a href="module-zrender_shape_Polygon.html#isCover">isCover</a></li>
<li data-name="module:zrender/shape/Polygon#isSilent"><a href="module-zrender_shape_Polygon.html#isSilent">isSilent</a></li>
<li data-name="module:zrender/shape/Polygon#lookAt"><a href="module-zrender_shape_Polygon.html#lookAt">lookAt</a></li>
<li data-name="module:zrender/shape/Polygon#one"><a href="module-zrender_shape_Polygon.html#one">one</a></li>
<li data-name="module:zrender/shape/Polygon#setContext"><a href="module-zrender_shape_Polygon.html#setContext">setContext</a></li>
<li data-name="module:zrender/shape/Polygon#setTransform"><a href="module-zrender_shape_Polygon.html#setTransform">setTransform</a></li>
<li data-name="module:zrender/shape/Polygon#transformCoordToLocal"><a href="module-zrender_shape_Polygon.html#transformCoordToLocal">transformCoordToLocal</a></li>
<li data-name="module:zrender/shape/Polygon#unbind"><a href="module-zrender_shape_Polygon.html#unbind">unbind</a></li>
<li data-name="module:zrender/shape/Polygon#updateTransform"><a href="module-zrender_shape_Polygon.html#updateTransform">updateTransform</a></li>
</ul>
<ul class="events itemMembers">
<span class="subtitle">Events</span>
<li data-name="module:zrender/shape/Polygon#event:onclick"><a href="module-zrender_shape_Polygon.html#event:onclick">onclick</a></li>
<li data-name="module:zrender/shape/Polygon#event:ondragend"><a href="module-zrender_shape_Polygon.html#event:ondragend">ondragend</a></li>
<li data-name="module:zrender/shape/Polygon#event:ondragenter"><a href="module-zrender_shape_Polygon.html#event:ondragenter">ondragenter</a></li>
<li data-name="module:zrender/shape/Polygon#event:ondragleave"><a href="module-zrender_shape_Polygon.html#event:ondragleave">ondragleave</a></li>
<li data-name="module:zrender/shape/Polygon#event:ondragover"><a href="module-zrender_shape_Polygon.html#event:ondragover">ondragover</a></li>
<li data-name="module:zrender/shape/Polygon#event:ondragstart"><a href="module-zrender_shape_Polygon.html#event:ondragstart">ondragstart</a></li>
<li data-name="module:zrender/shape/Polygon#event:ondrop"><a href="module-zrender_shape_Polygon.html#event:ondrop">ondrop</a></li>
<li data-name="module:zrender/shape/Polygon#event:onmousedown"><a href="module-zrender_shape_Polygon.html#event:onmousedown">onmousedown</a></li>
<li data-name="module:zrender/shape/Polygon#event:onmousemove"><a href="module-zrender_shape_Polygon.html#event:onmousemove">onmousemove</a></li>
<li data-name="module:zrender/shape/Polygon#event:onmouseout"><a href="module-zrender_shape_Polygon.html#event:onmouseout">onmouseout</a></li>
<li data-name="module:zrender/shape/Polygon#event:onmouseover"><a href="module-zrender_shape_Polygon.html#event:onmouseover">onmouseover</a></li>
<li data-name="module:zrender/shape/Polygon#event:onmouseup"><a href="module-zrender_shape_Polygon.html#event:onmouseup">onmouseup</a></li>
<li data-name="module:zrender/shape/Polygon#event:onmousewheel"><a href="module-zrender_shape_Polygon.html#event:onmousewheel">onmousewheel</a></li>
</ul>
</li>
<li class="item" data-name="module:zrender/shape/Polyline">
<span class="title">
<a href="module-zrender_shape_Polyline.html">module:zrender/shape/Polyline</a>
</span>
<ul class="members itemMembers">
<span class="subtitle">Members</span>
<li data-name="module:zrender/shape/Polyline#highlightStyle"><a href="module-zrender_shape_Polyline.html#highlightStyle">highlightStyle</a></li>
<li data-name="module:zrender/shape/Polyline#style"><a href="module-zrender_shape_Polyline.html#style">style</a></li>
<li data-name="module:zrender/shape/Polyline#id"><a href="module-zrender_shape_Polyline.html#id">id</a></li>
<li data-name="module:zrender/shape/Polyline#parent"><a href="module-zrender_shape_Polyline.html#parent">parent</a></li>
<li data-name="module:zrender/shape/Polyline#position"><a href="module-zrender_shape_Polyline.html#position">position</a></li>
<li data-name="module:zrender/shape/Polyline#rotation"><a href="module-zrender_shape_Polyline.html#rotation">rotation</a></li>
<li data-name="module:zrender/shape/Polyline#scale"><a href="module-zrender_shape_Polyline.html#scale">scale</a></li>
</ul>
<ul class="typedefs itemMembers">
<span class="subtitle">Typedefs</span>
<li data-name="module:zrender/shape/Polyline~IPolylineStyle"><a href="module-zrender_shape_Polyline.html#~IPolylineStyle">IPolylineStyle</a></li>
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="module:zrender/shape/Polyline#buildPath"><a href="module-zrender_shape_Polyline.html#buildPath">buildPath</a></li>
<li data-name="module:zrender/shape/Polyline#getRect"><a href="module-zrender_shape_Polyline.html#getRect">getRect</a></li>
<li data-name="module:zrender/shape/Polyline#afterBrush"><a href="module-zrender_shape_Polyline.html#afterBrush">afterBrush</a></li>
<li data-name="module:zrender/shape/Polyline#beforeBrush"><a href="module-zrender_shape_Polyline.html#beforeBrush">beforeBrush</a></li>
<li data-name="module:zrender/shape/Polyline#bind"><a href="module-zrender_shape_Polyline.html#bind">bind</a></li>
<li data-name="module:zrender/shape/Polyline#brush"><a href="module-zrender_shape_Polyline.html#brush">brush</a></li>
<li data-name="module:zrender/shape/Polyline#decomposeTransform"><a href="module-zrender_shape_Polyline.html#decomposeTransform">decomposeTransform</a></li>
<li data-name="module:zrender/shape/Polyline#dispatch"><a href="module-zrender_shape_Polyline.html#dispatch">dispatch</a></li>
<li data-name="module:zrender/shape/Polyline#dispatchWithContext"><a href="module-zrender_shape_Polyline.html#dispatchWithContext">dispatchWithContext</a></li>
<li data-name="module:zrender/shape/Polyline#drawText"><a href="module-zrender_shape_Polyline.html#drawText">drawText</a></li>
<li data-name="module:zrender/shape/Polyline#drift"><a href="module-zrender_shape_Polyline.html#drift">drift</a></li>
<li data-name="module:zrender/shape/Polyline#getHighlightStyle"><a href="module-zrender_shape_Polyline.html#getHighlightStyle">getHighlightStyle</a></li>
<li data-name="module:zrender/shape/Polyline#isCover"><a href="module-zrender_shape_Polyline.html#isCover">isCover</a></li>
<li data-name="module:zrender/shape/Polyline#isSilent"><a href="module-zrender_shape_Polyline.html#isSilent">isSilent</a></li>
<li data-name="module:zrender/shape/Polyline#lookAt"><a href="module-zrender_shape_Polyline.html#lookAt">lookAt</a></li>
<li data-name="module:zrender/shape/Polyline#one"><a href="module-zrender_shape_Polyline.html#one">one</a></li>
<li data-name="module:zrender/shape/Polyline#setContext"><a href="module-zrender_shape_Polyline.html#setContext">setContext</a></li>
<li data-name="module:zrender/shape/Polyline#setTransform"><a href="module-zrender_shape_Polyline.html#setTransform">setTransform</a></li>
<li data-name="module:zrender/shape/Polyline#transformCoordToLocal"><a href="module-zrender_shape_Polyline.html#transformCoordToLocal">transformCoordToLocal</a></li>
<li data-name="module:zrender/shape/Polyline#unbind"><a href="module-zrender_shape_Polyline.html#unbind">unbind</a></li>
<li data-name="module:zrender/shape/Polyline#updateTransform"><a href="module-zrender_shape_Polyline.html#updateTransform">updateTransform</a></li>
</ul>
<ul class="events itemMembers">
<span class="subtitle">Events</span>
<li data-name="module:zrender/shape/Polyline#event:onclick"><a href="module-zrender_shape_Polyline.html#event:onclick">onclick</a></li>
<li data-name="module:zrender/shape/Polyline#event:ondragend"><a href="module-zrender_shape_Polyline.html#event:ondragend">ondragend</a></li>
<li data-name="module:zrender/shape/Polyline#event:ondragenter"><a href="module-zrender_shape_Polyline.html#event:ondragenter">ondragenter</a></li>
<li data-name="module:zrender/shape/Polyline#event:ondragleave"><a href="module-zrender_shape_Polyline.html#event:ondragleave">ondragleave</a></li>
<li data-name="module:zrender/shape/Polyline#event:ondragover"><a href="module-zrender_shape_Polyline.html#event:ondragover">ondragover</a></li>
<li data-name="module:zrender/shape/Polyline#event:ondragstart"><a href="module-zrender_shape_Polyline.html#event:ondragstart">ondragstart</a></li>
<li data-name="module:zrender/shape/Polyline#event:ondrop"><a href="module-zrender_shape_Polyline.html#event:ondrop">ondrop</a></li>
<li data-name="module:zrender/shape/Polyline#event:onmousedown"><a href="module-zrender_shape_Polyline.html#event:onmousedown">onmousedown</a></li>
<li data-name="module:zrender/shape/Polyline#event:onmousemove"><a href="module-zrender_shape_Polyline.html#event:onmousemove">onmousemove</a></li>
<li data-name="module:zrender/shape/Polyline#event:onmouseout"><a href="module-zrender_shape_Polyline.html#event:onmouseout">onmouseout</a></li>
<li data-name="module:zrender/shape/Polyline#event:onmouseover"><a href="module-zrender_shape_Polyline.html#event:onmouseover">onmouseover</a></li>
<li data-name="module:zrender/shape/Polyline#event:onmouseup"><a href="module-zrender_shape_Polyline.html#event:onmouseup">onmouseup</a></li>
<li data-name="module:zrender/shape/Polyline#event:onmousewheel"><a href="module-zrender_shape_Polyline.html#event:onmousewheel">onmousewheel</a></li>
</ul>
</li>
<li class="item" data-name="module:zrender/shape/Rectangle">
<span class="title">
<a href="module-zrender_shape_Rectangle.html">module:zrender/shape/Rectangle</a>
</span>
<ul class="members itemMembers">
<span class="subtitle">Members</span>
<li data-name="module:zrender/shape/Rectangle#highlightStyle"><a href="module-zrender_shape_Rectangle.html#highlightStyle">highlightStyle</a></li>
<li data-name="module:zrender/shape/Rectangle#style"><a href="module-zrender_shape_Rectangle.html#style">style</a></li>
<li data-name="module:zrender/shape/Rectangle#id"><a href="module-zrender_shape_Rectangle.html#id">id</a></li>
<li data-name="module:zrender/shape/Rectangle#parent"><a href="module-zrender_shape_Rectangle.html#parent">parent</a></li>
<li data-name="module:zrender/shape/Rectangle#position"><a href="module-zrender_shape_Rectangle.html#position">position</a></li>
<li data-name="module:zrender/shape/Rectangle#rotation"><a href="module-zrender_shape_Rectangle.html#rotation">rotation</a></li>
<li data-name="module:zrender/shape/Rectangle#scale"><a href="module-zrender_shape_Rectangle.html#scale">scale</a></li>
</ul>
<ul class="typedefs itemMembers">
<span class="subtitle">Typedefs</span>
<li data-name="module:zrender/shape/Rectangle~IRectangleStyle"><a href="module-zrender_shape_Rectangle.html#~IRectangleStyle">IRectangleStyle</a></li>
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="module:zrender/shape/Rectangle#buildPath"><a href="module-zrender_shape_Rectangle.html#buildPath">buildPath</a></li>
<li data-name="module:zrender/shape/Rectangle#getRect"><a href="module-zrender_shape_Rectangle.html#getRect">getRect</a></li>
<li data-name="module:zrender/shape/Rectangle#afterBrush"><a href="module-zrender_shape_Rectangle.html#afterBrush">afterBrush</a></li>
<li data-name="module:zrender/shape/Rectangle#beforeBrush"><a href="module-zrender_shape_Rectangle.html#beforeBrush">beforeBrush</a></li>
<li data-name="module:zrender/shape/Rectangle#bind"><a href="module-zrender_shape_Rectangle.html#bind">bind</a></li>
<li data-name="module:zrender/shape/Rectangle#brush"><a href="module-zrender_shape_Rectangle.html#brush">brush</a></li>
<li data-name="module:zrender/shape/Rectangle#decomposeTransform"><a href="module-zrender_shape_Rectangle.html#decomposeTransform">decomposeTransform</a></li>
<li data-name="module:zrender/shape/Rectangle#dispatch"><a href="module-zrender_shape_Rectangle.html#dispatch">dispatch</a></li>
<li data-name="module:zrender/shape/Rectangle#dispatchWithContext"><a href="module-zrender_shape_Rectangle.html#dispatchWithContext">dispatchWithContext</a></li>
<li data-name="module:zrender/shape/Rectangle#drawText"><a href="module-zrender_shape_Rectangle.html#drawText">drawText</a></li>
<li data-name="module:zrender/shape/Rectangle#drift"><a href="module-zrender_shape_Rectangle.html#drift">drift</a></li>
<li data-name="module:zrender/shape/Rectangle#getHighlightStyle"><a href="module-zrender_shape_Rectangle.html#getHighlightStyle">getHighlightStyle</a></li>
<li data-name="module:zrender/shape/Rectangle#isCover"><a href="module-zrender_shape_Rectangle.html#isCover">isCover</a></li>
<li data-name="module:zrender/shape/Rectangle#isSilent"><a href="module-zrender_shape_Rectangle.html#isSilent">isSilent</a></li>
<li data-name="module:zrender/shape/Rectangle#lookAt"><a href="module-zrender_shape_Rectangle.html#lookAt">lookAt</a></li>
<li data-name="module:zrender/shape/Rectangle#one"><a href="module-zrender_shape_Rectangle.html#one">one</a></li>
<li data-name="module:zrender/shape/Rectangle#setContext"><a href="module-zrender_shape_Rectangle.html#setContext">setContext</a></li>
<li data-name="module:zrender/shape/Rectangle#setTransform"><a href="module-zrender_shape_Rectangle.html#setTransform">setTransform</a></li>
<li data-name="module:zrender/shape/Rectangle#transformCoordToLocal"><a href="module-zrender_shape_Rectangle.html#transformCoordToLocal">transformCoordToLocal</a></li>
<li data-name="module:zrender/shape/Rectangle#unbind"><a href="module-zrender_shape_Rectangle.html#unbind">unbind</a></li>
<li data-name="module:zrender/shape/Rectangle#updateTransform"><a href="module-zrender_shape_Rectangle.html#updateTransform">updateTransform</a></li>
</ul>
<ul class="events itemMembers">
<span class="subtitle">Events</span>
<li data-name="module:zrender/shape/Rectangle#event:onclick"><a href="module-zrender_shape_Rectangle.html#event:onclick">onclick</a></li>
<li data-name="module:zrender/shape/Rectangle#event:ondragend"><a href="module-zrender_shape_Rectangle.html#event:ondragend">ondragend</a></li>
<li data-name="module:zrender/shape/Rectangle#event:ondragenter"><a href="module-zrender_shape_Rectangle.html#event:ondragenter">ondragenter</a></li>
<li data-name="module:zrender/shape/Rectangle#event:ondragleave"><a href="module-zrender_shape_Rectangle.html#event:ondragleave">ondragleave</a></li>
<li data-name="module:zrender/shape/Rectangle#event:ondragover"><a href="module-zrender_shape_Rectangle.html#event:ondragover">ondragover</a></li>
<li data-name="module:zrender/shape/Rectangle#event:ondragstart"><a href="module-zrender_shape_Rectangle.html#event:ondragstart">ondragstart</a></li>
<li data-name="module:zrender/shape/Rectangle#event:ondrop"><a href="module-zrender_shape_Rectangle.html#event:ondrop">ondrop</a></li>
<li data-name="module:zrender/shape/Rectangle#event:onmousedown"><a href="module-zrender_shape_Rectangle.html#event:onmousedown">onmousedown</a></li>
<li data-name="module:zrender/shape/Rectangle#event:onmousemove"><a href="module-zrender_shape_Rectangle.html#event:onmousemove">onmousemove</a></li>
<li data-name="module:zrender/shape/Rectangle#event:onmouseout"><a href="module-zrender_shape_Rectangle.html#event:onmouseout">onmouseout</a></li>
<li data-name="module:zrender/shape/Rectangle#event:onmouseover"><a href="module-zrender_shape_Rectangle.html#event:onmouseover">onmouseover</a></li>
<li data-name="module:zrender/shape/Rectangle#event:onmouseup"><a href="module-zrender_shape_Rectangle.html#event:onmouseup">onmouseup</a></li>
<li data-name="module:zrender/shape/Rectangle#event:onmousewheel"><a href="module-zrender_shape_Rectangle.html#event:onmousewheel">onmousewheel</a></li>
</ul>
</li>
<li class="item" data-name="module:zrender/shape/Ring">
<span class="title">
<a href="module-zrender_shape_Ring.html">module:zrender/shape/Ring</a>
</span>
<ul class="members itemMembers">
<span class="subtitle">Members</span>
<li data-name="module:zrender/shape/Ring#highlightStyle"><a href="module-zrender_shape_Ring.html#highlightStyle">highlightStyle</a></li>
<li data-name="module:zrender/shape/Ring#style"><a href="module-zrender_shape_Ring.html#style">style</a></li>
<li data-name="module:zrender/shape/Ring#id"><a href="module-zrender_shape_Ring.html#id">id</a></li>
<li data-name="module:zrender/shape/Ring#parent"><a href="module-zrender_shape_Ring.html#parent">parent</a></li>
<li data-name="module:zrender/shape/Ring#position"><a href="module-zrender_shape_Ring.html#position">position</a></li>
<li data-name="module:zrender/shape/Ring#rotation"><a href="module-zrender_shape_Ring.html#rotation">rotation</a></li>
<li data-name="module:zrender/shape/Ring#scale"><a href="module-zrender_shape_Ring.html#scale">scale</a></li>
</ul>
<ul class="typedefs itemMembers">
<span class="subtitle">Typedefs</span>
<li data-name="module:zrender/shape/Ring~IRingStyle"><a href="module-zrender_shape_Ring.html#~IRingStyle">IRingStyle</a></li>
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="module:zrender/shape/Ring#buildPath"><a href="module-zrender_shape_Ring.html#buildPath">buildPath</a></li>
<li data-name="module:zrender/shape/Ring#getRect"><a href="module-zrender_shape_Ring.html#getRect">getRect</a></li>
<li data-name="module:zrender/shape/Ring#afterBrush"><a href="module-zrender_shape_Ring.html#afterBrush">afterBrush</a></li>
<li data-name="module:zrender/shape/Ring#beforeBrush"><a href="module-zrender_shape_Ring.html#beforeBrush">beforeBrush</a></li>
<li data-name="module:zrender/shape/Ring#bind"><a href="module-zrender_shape_Ring.html#bind">bind</a></li>
<li data-name="module:zrender/shape/Ring#brush"><a href="module-zrender_shape_Ring.html#brush">brush</a></li>
<li data-name="module:zrender/shape/Ring#decomposeTransform"><a href="module-zrender_shape_Ring.html#decomposeTransform">decomposeTransform</a></li>
<li data-name="module:zrender/shape/Ring#dispatch"><a href="module-zrender_shape_Ring.html#dispatch">dispatch</a></li>
<li data-name="module:zrender/shape/Ring#dispatchWithContext"><a href="module-zrender_shape_Ring.html#dispatchWithContext">dispatchWithContext</a></li>
<li data-name="module:zrender/shape/Ring#drawText"><a href="module-zrender_shape_Ring.html#drawText">drawText</a></li>
<li data-name="module:zrender/shape/Ring#drift"><a href="module-zrender_shape_Ring.html#drift">drift</a></li>
<li data-name="module:zrender/shape/Ring#getHighlightStyle"><a href="module-zrender_shape_Ring.html#getHighlightStyle">getHighlightStyle</a></li>
<li data-name="module:zrender/shape/Ring#isCover"><a href="module-zrender_shape_Ring.html#isCover">isCover</a></li>
<li data-name="module:zrender/shape/Ring#isSilent"><a href="module-zrender_shape_Ring.html#isSilent">isSilent</a></li>
<li data-name="module:zrender/shape/Ring#lookAt"><a href="module-zrender_shape_Ring.html#lookAt">lookAt</a></li>
<li data-name="module:zrender/shape/Ring#one"><a href="module-zrender_shape_Ring.html#one">one</a></li>
<li data-name="module:zrender/shape/Ring#setContext"><a href="module-zrender_shape_Ring.html#setContext">setContext</a></li>
<li data-name="module:zrender/shape/Ring#setTransform"><a href="module-zrender_shape_Ring.html#setTransform">setTransform</a></li>
<li data-name="module:zrender/shape/Ring#transformCoordToLocal"><a href="module-zrender_shape_Ring.html#transformCoordToLocal">transformCoordToLocal</a></li>
<li data-name="module:zrender/shape/Ring#unbind"><a href="module-zrender_shape_Ring.html#unbind">unbind</a></li>
<li data-name="module:zrender/shape/Ring#updateTransform"><a href="module-zrender_shape_Ring.html#updateTransform">updateTransform</a></li>
</ul>
<ul class="events itemMembers">
<span class="subtitle">Events</span>
<li data-name="module:zrender/shape/Ring#event:onclick"><a href="module-zrender_shape_Ring.html#event:onclick">onclick</a></li>
<li data-name="module:zrender/shape/Ring#event:ondragend"><a href="module-zrender_shape_Ring.html#event:ondragend">ondragend</a></li>
<li data-name="module:zrender/shape/Ring#event:ondragenter"><a href="module-zrender_shape_Ring.html#event:ondragenter">ondragenter</a></li>
<li data-name="module:zrender/shape/Ring#event:ondragleave"><a href="module-zrender_shape_Ring.html#event:ondragleave">ondragleave</a></li>
<li data-name="module:zrender/shape/Ring#event:ondragover"><a href="module-zrender_shape_Ring.html#event:ondragover">ondragover</a></li>
<li data-name="module:zrender/shape/Ring#event:ondragstart"><a href="module-zrender_shape_Ring.html#event:ondragstart">ondragstart</a></li>
<li data-name="module:zrender/shape/Ring#event:ondrop"><a href="module-zrender_shape_Ring.html#event:ondrop">ondrop</a></li>
<li data-name="module:zrender/shape/Ring#event:onmousedown"><a href="module-zrender_shape_Ring.html#event:onmousedown">onmousedown</a></li>
<li data-name="module:zrender/shape/Ring#event:onmousemove"><a href="module-zrender_shape_Ring.html#event:onmousemove">onmousemove</a></li>
<li data-name="module:zrender/shape/Ring#event:onmouseout"><a href="module-zrender_shape_Ring.html#event:onmouseout">onmouseout</a></li>
<li data-name="module:zrender/shape/Ring#event:onmouseover"><a href="module-zrender_shape_Ring.html#event:onmouseover">onmouseover</a></li>
<li data-name="module:zrender/shape/Ring#event:onmouseup"><a href="module-zrender_shape_Ring.html#event:onmouseup">onmouseup</a></li>
<li data-name="module:zrender/shape/Ring#event:onmousewheel"><a href="module-zrender_shape_Ring.html#event:onmousewheel">onmousewheel</a></li>
</ul>
</li>
<li class="item" data-name="module:zrender/shape/Rose">
<span class="title">
<a href="module-zrender_shape_Rose.html">module:zrender/shape/Rose</a>
</span>
<ul class="members itemMembers">
<span class="subtitle">Members</span>
<li data-name="module:zrender/shape/Rose#highlightStyle"><a href="module-zrender_shape_Rose.html#highlightStyle">highlightStyle</a></li>
<li data-name="module:zrender/shape/Rose#style"><a href="module-zrender_shape_Rose.html#style">style</a></li>
<li data-name="module:zrender/shape/Rose#id"><a href="module-zrender_shape_Rose.html#id">id</a></li>
<li data-name="module:zrender/shape/Rose#parent"><a href="module-zrender_shape_Rose.html#parent">parent</a></li>
<li data-name="module:zrender/shape/Rose#position"><a href="module-zrender_shape_Rose.html#position">position</a></li>
<li data-name="module:zrender/shape/Rose#rotation"><a href="module-zrender_shape_Rose.html#rotation">rotation</a></li>
<li data-name="module:zrender/shape/Rose#scale"><a href="module-zrender_shape_Rose.html#scale">scale</a></li>
</ul>
<ul class="typedefs itemMembers">
<span class="subtitle">Typedefs</span>
<li data-name="module:zrender/shape/Rose~IRoseStyle"><a href="module-zrender_shape_Rose.html#~IRoseStyle">IRoseStyle</a></li>
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="module:zrender/shape/Rose#buildPath"><a href="module-zrender_shape_Rose.html#buildPath">buildPath</a></li>
<li data-name="module:zrender/shape/Rose#getRect"><a href="module-zrender_shape_Rose.html#getRect">getRect</a></li>
<li data-name="module:zrender/shape/Rose#afterBrush"><a href="module-zrender_shape_Rose.html#afterBrush">afterBrush</a></li>
<li data-name="module:zrender/shape/Rose#beforeBrush"><a href="module-zrender_shape_Rose.html#beforeBrush">beforeBrush</a></li>
<li data-name="module:zrender/shape/Rose#bind"><a href="module-zrender_shape_Rose.html#bind">bind</a></li>
<li data-name="module:zrender/shape/Rose#brush"><a href="module-zrender_shape_Rose.html#brush">brush</a></li>
<li data-name="module:zrender/shape/Rose#decomposeTransform"><a href="module-zrender_shape_Rose.html#decomposeTransform">decomposeTransform</a></li>
<li data-name="module:zrender/shape/Rose#dispatch"><a href="module-zrender_shape_Rose.html#dispatch">dispatch</a></li>
<li data-name="module:zrender/shape/Rose#dispatchWithContext"><a href="module-zrender_shape_Rose.html#dispatchWithContext">dispatchWithContext</a></li>
<li data-name="module:zrender/shape/Rose#drawText"><a href="module-zrender_shape_Rose.html#drawText">drawText</a></li>
<li data-name="module:zrender/shape/Rose#drift"><a href="module-zrender_shape_Rose.html#drift">drift</a></li>
<li data-name="module:zrender/shape/Rose#getHighlightStyle"><a href="module-zrender_shape_Rose.html#getHighlightStyle">getHighlightStyle</a></li>
<li data-name="module:zrender/shape/Rose#isCover"><a href="module-zrender_shape_Rose.html#isCover">isCover</a></li>
<li data-name="module:zrender/shape/Rose#isSilent"><a href="module-zrender_shape_Rose.html#isSilent">isSilent</a></li>
<li data-name="module:zrender/shape/Rose#lookAt"><a href="module-zrender_shape_Rose.html#lookAt">lookAt</a></li>
<li data-name="module:zrender/shape/Rose#one"><a href="module-zrender_shape_Rose.html#one">one</a></li>
<li data-name="module:zrender/shape/Rose#setContext"><a href="module-zrender_shape_Rose.html#setContext">setContext</a></li>
<li data-name="module:zrender/shape/Rose#setTransform"><a href="module-zrender_shape_Rose.html#setTransform">setTransform</a></li>
<li data-name="module:zrender/shape/Rose#transformCoordToLocal"><a href="module-zrender_shape_Rose.html#transformCoordToLocal">transformCoordToLocal</a></li>
<li data-name="module:zrender/shape/Rose#unbind"><a href="module-zrender_shape_Rose.html#unbind">unbind</a></li>
<li data-name="module:zrender/shape/Rose#updateTransform"><a href="module-zrender_shape_Rose.html#updateTransform">updateTransform</a></li>
</ul>
<ul class="events itemMembers">
<span class="subtitle">Events</span>
<li data-name="module:zrender/shape/Rose#event:onclick"><a href="module-zrender_shape_Rose.html#event:onclick">onclick</a></li>
<li data-name="module:zrender/shape/Rose#event:ondragend"><a href="module-zrender_shape_Rose.html#event:ondragend">ondragend</a></li>
<li data-name="module:zrender/shape/Rose#event:ondragenter"><a href="module-zrender_shape_Rose.html#event:ondragenter">ondragenter</a></li>
<li data-name="module:zrender/shape/Rose#event:ondragleave"><a href="module-zrender_shape_Rose.html#event:ondragleave">ondragleave</a></li>
<li data-name="module:zrender/shape/Rose#event:ondragover"><a href="module-zrender_shape_Rose.html#event:ondragover">ondragover</a></li>
<li data-name="module:zrender/shape/Rose#event:ondragstart"><a href="module-zrender_shape_Rose.html#event:ondragstart">ondragstart</a></li>
<li data-name="module:zrender/shape/Rose#event:ondrop"><a href="module-zrender_shape_Rose.html#event:ondrop">ondrop</a></li>
<li data-name="module:zrender/shape/Rose#event:onmousedown"><a href="module-zrender_shape_Rose.html#event:onmousedown">onmousedown</a></li>
<li data-name="module:zrender/shape/Rose#event:onmousemove"><a href="module-zrender_shape_Rose.html#event:onmousemove">onmousemove</a></li>
<li data-name="module:zrender/shape/Rose#event:onmouseout"><a href="module-zrender_shape_Rose.html#event:onmouseout">onmouseout</a></li>
<li data-name="module:zrender/shape/Rose#event:onmouseover"><a href="module-zrender_shape_Rose.html#event:onmouseover">onmouseover</a></li>
<li data-name="module:zrender/shape/Rose#event:onmouseup"><a href="module-zrender_shape_Rose.html#event:onmouseup">onmouseup</a></li>
<li data-name="module:zrender/shape/Rose#event:onmousewheel"><a href="module-zrender_shape_Rose.html#event:onmousewheel">onmousewheel</a></li>
</ul>
</li>
<li class="item" data-name="module:zrender/shape/Sector">
<span class="title">
<a href="module-zrender_shape_Sector.html">module:zrender/shape/Sector</a>
</span>
<ul class="members itemMembers">
<span class="subtitle">Members</span>
<li data-name="module:zrender/shape/Sector#highlightStyle"><a href="module-zrender_shape_Sector.html#highlightStyle">highlightStyle</a></li>
<li data-name="module:zrender/shape/Sector#style"><a href="module-zrender_shape_Sector.html#style">style</a></li>
<li data-name="module:zrender/shape/Sector#id"><a href="module-zrender_shape_Sector.html#id">id</a></li>
<li data-name="module:zrender/shape/Sector#parent"><a href="module-zrender_shape_Sector.html#parent">parent</a></li>
<li data-name="module:zrender/shape/Sector#position"><a href="module-zrender_shape_Sector.html#position">position</a></li>
<li data-name="module:zrender/shape/Sector#rotation"><a href="module-zrender_shape_Sector.html#rotation">rotation</a></li>
<li data-name="module:zrender/shape/Sector#scale"><a href="module-zrender_shape_Sector.html#scale">scale</a></li>
</ul>
<ul class="typedefs itemMembers">
<span class="subtitle">Typedefs</span>
<li data-name="module:zrender/shape/Sector~ISectorStyle"><a href="module-zrender_shape_Sector.html#~ISectorStyle">ISectorStyle</a></li>
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="module:zrender/shape/Sector#buildPath"><a href="module-zrender_shape_Sector.html#buildPath">buildPath</a></li>
<li data-name="module:zrender/shape/Sector#getRect"><a href="module-zrender_shape_Sector.html#getRect">getRect</a></li>
<li data-name="module:zrender/shape/Sector#afterBrush"><a href="module-zrender_shape_Sector.html#afterBrush">afterBrush</a></li>
<li data-name="module:zrender/shape/Sector#beforeBrush"><a href="module-zrender_shape_Sector.html#beforeBrush">beforeBrush</a></li>
<li data-name="module:zrender/shape/Sector#bind"><a href="module-zrender_shape_Sector.html#bind">bind</a></li>
<li data-name="module:zrender/shape/Sector#brush"><a href="module-zrender_shape_Sector.html#brush">brush</a></li>
<li data-name="module:zrender/shape/Sector#decomposeTransform"><a href="module-zrender_shape_Sector.html#decomposeTransform">decomposeTransform</a></li>
<li data-name="module:zrender/shape/Sector#dispatch"><a href="module-zrender_shape_Sector.html#dispatch">dispatch</a></li>
<li data-name="module:zrender/shape/Sector#dispatchWithContext"><a href="module-zrender_shape_Sector.html#dispatchWithContext">dispatchWithContext</a></li>
<li data-name="module:zrender/shape/Sector#drawText"><a href="module-zrender_shape_Sector.html#drawText">drawText</a></li>
<li data-name="module:zrender/shape/Sector#drift"><a href="module-zrender_shape_Sector.html#drift">drift</a></li>
<li data-name="module:zrender/shape/Sector#getHighlightStyle"><a href="module-zrender_shape_Sector.html#getHighlightStyle">getHighlightStyle</a></li>
<li data-name="module:zrender/shape/Sector#isCover"><a href="module-zrender_shape_Sector.html#isCover">isCover</a></li>
<li data-name="module:zrender/shape/Sector#isSilent"><a href="module-zrender_shape_Sector.html#isSilent">isSilent</a></li>
<li data-name="module:zrender/shape/Sector#lookAt"><a href="module-zrender_shape_Sector.html#lookAt">lookAt</a></li>
<li data-name="module:zrender/shape/Sector#one"><a href="module-zrender_shape_Sector.html#one">one</a></li>
<li data-name="module:zrender/shape/Sector#setContext"><a href="module-zrender_shape_Sector.html#setContext">setContext</a></li>
<li data-name="module:zrender/shape/Sector#setTransform"><a href="module-zrender_shape_Sector.html#setTransform">setTransform</a></li>
<li data-name="module:zrender/shape/Sector#transformCoordToLocal"><a href="module-zrender_shape_Sector.html#transformCoordToLocal">transformCoordToLocal</a></li>
<li data-name="module:zrender/shape/Sector#unbind"><a href="module-zrender_shape_Sector.html#unbind">unbind</a></li>
<li data-name="module:zrender/shape/Sector#updateTransform"><a href="module-zrender_shape_Sector.html#updateTransform">updateTransform</a></li>
</ul>
<ul class="events itemMembers">
<span class="subtitle">Events</span>
<li data-name="module:zrender/shape/Sector#event:onclick"><a href="module-zrender_shape_Sector.html#event:onclick">onclick</a></li>
<li data-name="module:zrender/shape/Sector#event:ondragend"><a href="module-zrender_shape_Sector.html#event:ondragend">ondragend</a></li>
<li data-name="module:zrender/shape/Sector#event:ondragenter"><a href="module-zrender_shape_Sector.html#event:ondragenter">ondragenter</a></li>
<li data-name="module:zrender/shape/Sector#event:ondragleave"><a href="module-zrender_shape_Sector.html#event:ondragleave">ondragleave</a></li>
<li data-name="module:zrender/shape/Sector#event:ondragover"><a href="module-zrender_shape_Sector.html#event:ondragover">ondragover</a></li>
<li data-name="module:zrender/shape/Sector#event:ondragstart"><a href="module-zrender_shape_Sector.html#event:ondragstart">ondragstart</a></li>
<li data-name="module:zrender/shape/Sector#event:ondrop"><a href="module-zrender_shape_Sector.html#event:ondrop">ondrop</a></li>
<li data-name="module:zrender/shape/Sector#event:onmousedown"><a href="module-zrender_shape_Sector.html#event:onmousedown">onmousedown</a></li>
<li data-name="module:zrender/shape/Sector#event:onmousemove"><a href="module-zrender_shape_Sector.html#event:onmousemove">onmousemove</a></li>
<li data-name="module:zrender/shape/Sector#event:onmouseout"><a href="module-zrender_shape_Sector.html#event:onmouseout">onmouseout</a></li>
<li data-name="module:zrender/shape/Sector#event:onmouseover"><a href="module-zrender_shape_Sector.html#event:onmouseover">onmouseover</a></li>
<li data-name="module:zrender/shape/Sector#event:onmouseup"><a href="module-zrender_shape_Sector.html#event:onmouseup">onmouseup</a></li>
<li data-name="module:zrender/shape/Sector#event:onmousewheel"><a href="module-zrender_shape_Sector.html#event:onmousewheel">onmousewheel</a></li>
</ul>
</li>
<li class="item" data-name="module:zrender/shape/ShapeBundle">
<span class="title">
<a href="module-zrender_shape_ShapeBundle.html">module:zrender/shape/ShapeBundle</a>
</span>
<ul class="members itemMembers">
<span class="subtitle">Members</span>
<li data-name="module:zrender/shape/ShapeBundle#highlightStyle"><a href="module-zrender_shape_ShapeBundle.html#highlightStyle">highlightStyle</a></li>
<li data-name="module:zrender/shape/ShapeBundle#style"><a href="module-zrender_shape_ShapeBundle.html#style">style</a></li>
</ul>
<ul class="typedefs itemMembers">
<span class="subtitle">Typedefs</span>
<li data-name="module:zrender/shape/ShapeBundle~IShapeBundleStyle"><a href="module-zrender_shape_ShapeBundle.html#~IShapeBundleStyle">IShapeBundleStyle</a></li>
</ul>
<ul class="methods itemMembers">
</ul>
<ul class="events itemMembers">
</ul>
</li>
<li class="item" data-name="module:zrender/shape/Star">
<span class="title">
<a href="module-zrender_shape_Star.html">module:zrender/shape/Star</a>
</span>
<ul class="members itemMembers">
<span class="subtitle">Members</span>
<li data-name="module:zrender/shape/Star#highlightStyle"><a href="module-zrender_shape_Star.html#highlightStyle">highlightStyle</a></li>
<li data-name="module:zrender/shape/Star#style"><a href="module-zrender_shape_Star.html#style">style</a></li>
<li data-name="module:zrender/shape/Star#id"><a href="module-zrender_shape_Star.html#id">id</a></li>
<li data-name="module:zrender/shape/Star#parent"><a href="module-zrender_shape_Star.html#parent">parent</a></li>
<li data-name="module:zrender/shape/Star#position"><a href="module-zrender_shape_Star.html#position">position</a></li>
<li data-name="module:zrender/shape/Star#rotation"><a href="module-zrender_shape_Star.html#rotation">rotation</a></li>
<li data-name="module:zrender/shape/Star#scale"><a href="module-zrender_shape_Star.html#scale">scale</a></li>
</ul>
<ul class="typedefs itemMembers">
<span class="subtitle">Typedefs</span>
<li data-name="module:zrender/shape/Star~IStarStyle"><a href="module-zrender_shape_Star.html#~IStarStyle">IStarStyle</a></li>
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="module:zrender/shape/Star#buildPath"><a href="module-zrender_shape_Star.html#buildPath">buildPath</a></li>
<li data-name="module:zrender/shape/Star#getRect"><a href="module-zrender_shape_Star.html#getRect">getRect</a></li>
<li data-name="module:zrender/shape/Star#afterBrush"><a href="module-zrender_shape_Star.html#afterBrush">afterBrush</a></li>
<li data-name="module:zrender/shape/Star#beforeBrush"><a href="module-zrender_shape_Star.html#beforeBrush">beforeBrush</a></li>
<li data-name="module:zrender/shape/Star#bind"><a href="module-zrender_shape_Star.html#bind">bind</a></li>
<li data-name="module:zrender/shape/Star#brush"><a href="module-zrender_shape_Star.html#brush">brush</a></li>
<li data-name="module:zrender/shape/Star#decomposeTransform"><a href="module-zrender_shape_Star.html#decomposeTransform">decomposeTransform</a></li>
<li data-name="module:zrender/shape/Star#dispatch"><a href="module-zrender_shape_Star.html#dispatch">dispatch</a></li>
<li data-name="module:zrender/shape/Star#dispatchWithContext"><a href="module-zrender_shape_Star.html#dispatchWithContext">dispatchWithContext</a></li>
<li data-name="module:zrender/shape/Star#drawText"><a href="module-zrender_shape_Star.html#drawText">drawText</a></li>
<li data-name="module:zrender/shape/Star#drift"><a href="module-zrender_shape_Star.html#drift">drift</a></li>
<li data-name="module:zrender/shape/Star#getHighlightStyle"><a href="module-zrender_shape_Star.html#getHighlightStyle">getHighlightStyle</a></li>
<li data-name="module:zrender/shape/Star#isCover"><a href="module-zrender_shape_Star.html#isCover">isCover</a></li>
<li data-name="module:zrender/shape/Star#isSilent"><a href="module-zrender_shape_Star.html#isSilent">isSilent</a></li>
<li data-name="module:zrender/shape/Star#lookAt"><a href="module-zrender_shape_Star.html#lookAt">lookAt</a></li>
<li data-name="module:zrender/shape/Star#one"><a href="module-zrender_shape_Star.html#one">one</a></li>
<li data-name="module:zrender/shape/Star#setContext"><a href="module-zrender_shape_Star.html#setContext">setContext</a></li>
<li data-name="module:zrender/shape/Star#setTransform"><a href="module-zrender_shape_Star.html#setTransform">setTransform</a></li>
<li data-name="module:zrender/shape/Star#transformCoordToLocal"><a href="module-zrender_shape_Star.html#transformCoordToLocal">transformCoordToLocal</a></li>
<li data-name="module:zrender/shape/Star#unbind"><a href="module-zrender_shape_Star.html#unbind">unbind</a></li>
<li data-name="module:zrender/shape/Star#updateTransform"><a href="module-zrender_shape_Star.html#updateTransform">updateTransform</a></li>
</ul>
<ul class="events itemMembers">
<span class="subtitle">Events</span>
<li data-name="module:zrender/shape/Star#event:onclick"><a href="module-zrender_shape_Star.html#event:onclick">onclick</a></li>
<li data-name="module:zrender/shape/Star#event:ondragend"><a href="module-zrender_shape_Star.html#event:ondragend">ondragend</a></li>
<li data-name="module:zrender/shape/Star#event:ondragenter"><a href="module-zrender_shape_Star.html#event:ondragenter">ondragenter</a></li>
<li data-name="module:zrender/shape/Star#event:ondragleave"><a href="module-zrender_shape_Star.html#event:ondragleave">ondragleave</a></li>
<li data-name="module:zrender/shape/Star#event:ondragover"><a href="module-zrender_shape_Star.html#event:ondragover">ondragover</a></li>
<li data-name="module:zrender/shape/Star#event:ondragstart"><a href="module-zrender_shape_Star.html#event:ondragstart">ondragstart</a></li>
<li data-name="module:zrender/shape/Star#event:ondrop"><a href="module-zrender_shape_Star.html#event:ondrop">ondrop</a></li>
<li data-name="module:zrender/shape/Star#event:onmousedown"><a href="module-zrender_shape_Star.html#event:onmousedown">onmousedown</a></li>
<li data-name="module:zrender/shape/Star#event:onmousemove"><a href="module-zrender_shape_Star.html#event:onmousemove">onmousemove</a></li>
<li data-name="module:zrender/shape/Star#event:onmouseout"><a href="module-zrender_shape_Star.html#event:onmouseout">onmouseout</a></li>
<li data-name="module:zrender/shape/Star#event:onmouseover"><a href="module-zrender_shape_Star.html#event:onmouseover">onmouseover</a></li>
<li data-name="module:zrender/shape/Star#event:onmouseup"><a href="module-zrender_shape_Star.html#event:onmouseup">onmouseup</a></li>
<li data-name="module:zrender/shape/Star#event:onmousewheel"><a href="module-zrender_shape_Star.html#event:onmousewheel">onmousewheel</a></li>
</ul>
</li>
<li class="item" data-name="module:zrender/shape/Text">
<span class="title">
<a href="module-zrender_shape_Text.html">module:zrender/shape/Text</a>
</span>
<ul class="members itemMembers">
<span class="subtitle">Members</span>
<li data-name="module:zrender/shape/Text#highlightStyle"><a href="module-zrender_shape_Text.html#highlightStyle">highlightStyle</a></li>
<li data-name="module:zrender/shape/Text#style"><a href="module-zrender_shape_Text.html#style">style</a></li>
<li data-name="module:zrender/shape/Text#id"><a href="module-zrender_shape_Text.html#id">id</a></li>
<li data-name="module:zrender/shape/Text#parent"><a href="module-zrender_shape_Text.html#parent">parent</a></li>
<li data-name="module:zrender/shape/Text#position"><a href="module-zrender_shape_Text.html#position">position</a></li>
<li data-name="module:zrender/shape/Text#rotation"><a href="module-zrender_shape_Text.html#rotation">rotation</a></li>
<li data-name="module:zrender/shape/Text#scale"><a href="module-zrender_shape_Text.html#scale">scale</a></li>
</ul>
<ul class="typedefs itemMembers">
<span class="subtitle">Typedefs</span>
<li data-name="module:zrender/shape/Text~ITextStyle"><a href="module-zrender_shape_Text.html#~ITextStyle">ITextStyle</a></li>
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="module:zrender/shape/Text#getRect"><a href="module-zrender_shape_Text.html#getRect">getRect</a></li>
<li data-name="module:zrender/shape/Text#afterBrush"><a href="module-zrender_shape_Text.html#afterBrush">afterBrush</a></li>
<li data-name="module:zrender/shape/Text#beforeBrush"><a href="module-zrender_shape_Text.html#beforeBrush">beforeBrush</a></li>
<li data-name="module:zrender/shape/Text#bind"><a href="module-zrender_shape_Text.html#bind">bind</a></li>
<li data-name="module:zrender/shape/Text#brush"><a href="module-zrender_shape_Text.html#brush">brush</a></li>
<li data-name="module:zrender/shape/Text#buildPath"><a href="module-zrender_shape_Text.html#buildPath">buildPath</a></li>
<li data-name="module:zrender/shape/Text#decomposeTransform"><a href="module-zrender_shape_Text.html#decomposeTransform">decomposeTransform</a></li>
<li data-name="module:zrender/shape/Text#dispatch"><a href="module-zrender_shape_Text.html#dispatch">dispatch</a></li>
<li data-name="module:zrender/shape/Text#dispatchWithContext"><a href="module-zrender_shape_Text.html#dispatchWithContext">dispatchWithContext</a></li>
<li data-name="module:zrender/shape/Text#drawText"><a href="module-zrender_shape_Text.html#drawText">drawText</a></li>
<li data-name="module:zrender/shape/Text#drift"><a href="module-zrender_shape_Text.html#drift">drift</a></li>
<li data-name="module:zrender/shape/Text#getHighlightStyle"><a href="module-zrender_shape_Text.html#getHighlightStyle">getHighlightStyle</a></li>
<li data-name="module:zrender/shape/Text#isCover"><a href="module-zrender_shape_Text.html#isCover">isCover</a></li>
<li data-name="module:zrender/shape/Text#isSilent"><a href="module-zrender_shape_Text.html#isSilent">isSilent</a></li>
<li data-name="module:zrender/shape/Text#lookAt"><a href="module-zrender_shape_Text.html#lookAt">lookAt</a></li>
<li data-name="module:zrender/shape/Text#one"><a href="module-zrender_shape_Text.html#one">one</a></li>
<li data-name="module:zrender/shape/Text#setContext"><a href="module-zrender_shape_Text.html#setContext">setContext</a></li>
<li data-name="module:zrender/shape/Text#setTransform"><a href="module-zrender_shape_Text.html#setTransform">setTransform</a></li>
<li data-name="module:zrender/shape/Text#transformCoordToLocal"><a href="module-zrender_shape_Text.html#transformCoordToLocal">transformCoordToLocal</a></li>
<li data-name="module:zrender/shape/Text#unbind"><a href="module-zrender_shape_Text.html#unbind">unbind</a></li>
<li data-name="module:zrender/shape/Text#updateTransform"><a href="module-zrender_shape_Text.html#updateTransform">updateTransform</a></li>
</ul>
<ul class="events itemMembers">
<span class="subtitle">Events</span>
<li data-name="module:zrender/shape/Text#event:onclick"><a href="module-zrender_shape_Text.html#event:onclick">onclick</a></li>
<li data-name="module:zrender/shape/Text#event:ondragend"><a href="module-zrender_shape_Text.html#event:ondragend">ondragend</a></li>
<li data-name="module:zrender/shape/Text#event:ondragenter"><a href="module-zrender_shape_Text.html#event:ondragenter">ondragenter</a></li>
<li data-name="module:zrender/shape/Text#event:ondragleave"><a href="module-zrender_shape_Text.html#event:ondragleave">ondragleave</a></li>
<li data-name="module:zrender/shape/Text#event:ondragover"><a href="module-zrender_shape_Text.html#event:ondragover">ondragover</a></li>
<li data-name="module:zrender/shape/Text#event:ondragstart"><a href="module-zrender_shape_Text.html#event:ondragstart">ondragstart</a></li>
<li data-name="module:zrender/shape/Text#event:ondrop"><a href="module-zrender_shape_Text.html#event:ondrop">ondrop</a></li>
<li data-name="module:zrender/shape/Text#event:onmousedown"><a href="module-zrender_shape_Text.html#event:onmousedown">onmousedown</a></li>
<li data-name="module:zrender/shape/Text#event:onmousemove"><a href="module-zrender_shape_Text.html#event:onmousemove">onmousemove</a></li>
<li data-name="module:zrender/shape/Text#event:onmouseout"><a href="module-zrender_shape_Text.html#event:onmouseout">onmouseout</a></li>
<li data-name="module:zrender/shape/Text#event:onmouseover"><a href="module-zrender_shape_Text.html#event:onmouseover">onmouseover</a></li>
<li data-name="module:zrender/shape/Text#event:onmouseup"><a href="module-zrender_shape_Text.html#event:onmouseup">onmouseup</a></li>
<li data-name="module:zrender/shape/Text#event:onmousewheel"><a href="module-zrender_shape_Text.html#event:onmousewheel">onmousewheel</a></li>
</ul>
</li>
<li class="item" data-name="module:zrender/shape/tool/PathProxy">
<span class="title">
<a href="module-zrender_shape_tool_PathProxy.html">module:zrender/shape/tool/PathProxy</a>
</span>
<ul class="members itemMembers">
<span class="subtitle">Members</span>
<li data-name="module:zrender/shape/tool/PathProxy#pathCommands"><a href="module-zrender_shape_tool_PathProxy.html#pathCommands">pathCommands</a></li>
</ul>
<ul class="typedefs itemMembers">
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="module:zrender/shape/tool/PathProxy#arc"><a href="module-zrender_shape_tool_PathProxy.html#arc">arc</a></li>
<li data-name="module:zrender/shape/tool/PathProxy#begin"><a href="module-zrender_shape_tool_PathProxy.html#begin">begin</a></li>
<li data-name="module:zrender/shape/tool/PathProxy#bezierCurveTo"><a href="module-zrender_shape_tool_PathProxy.html#bezierCurveTo">bezierCurveTo</a></li>
<li data-name="module:zrender/shape/tool/PathProxy#closePath"><a href="module-zrender_shape_tool_PathProxy.html#closePath">closePath</a></li>
<li data-name="module:zrender/shape/tool/PathProxy#fastBoundingRect"><a href="module-zrender_shape_tool_PathProxy.html#fastBoundingRect">fastBoundingRect</a></li>
<li data-name="module:zrender/shape/tool/PathProxy#isEmpty"><a href="module-zrender_shape_tool_PathProxy.html#isEmpty">isEmpty</a></li>
<li data-name="module:zrender/shape/tool/PathProxy#lineTo"><a href="module-zrender_shape_tool_PathProxy.html#lineTo">lineTo</a></li>
<li data-name="module:zrender/shape/tool/PathProxy#moveTo"><a href="module-zrender_shape_tool_PathProxy.html#moveTo">moveTo</a></li>
<li data-name="module:zrender/shape/tool/PathProxy#quadraticCurveTo"><a href="module-zrender_shape_tool_PathProxy.html#quadraticCurveTo">quadraticCurveTo</a></li>
</ul>
<ul class="events itemMembers">
</ul>
</li>
<li class="item" data-name="module:zrender/shape/Trochold">
<span class="title">
<a href="module-zrender_shape_Trochold.html">module:zrender/shape/Trochold</a>
</span>
<ul class="members itemMembers">
<span class="subtitle">Members</span>
<li data-name="module:zrender/shape/Trochold#highlightStyle"><a href="module-zrender_shape_Trochold.html#highlightStyle">highlightStyle</a></li>
<li data-name="module:zrender/shape/Trochold#style"><a href="module-zrender_shape_Trochold.html#style">style</a></li>
</ul>
<ul class="typedefs itemMembers">
<span class="subtitle">Typedefs</span>
<li data-name="module:zrender/shape/Trochold~ITrocholdStyle"><a href="module-zrender_shape_Trochold.html#~ITrocholdStyle">ITrocholdStyle</a></li>
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="module:zrender/shape/Trochold#buildPath"><a href="module-zrender_shape_Trochold.html#buildPath">buildPath</a></li>
<li data-name="module:zrender/shape/Trochold#getRect"><a href="module-zrender_shape_Trochold.html#getRect">getRect</a></li>
</ul>
<ul class="events itemMembers">
</ul>
</li>
<li class="item" data-name="module:zrender/shape/util/smoothBezier">
<span class="title">
<a href="module-zrender_shape_util_smoothBezier.html">module:zrender/shape/util/smoothBezier</a>
</span>
<ul class="members itemMembers">
</ul>
<ul class="typedefs itemMembers">
</ul>
<ul class="methods itemMembers">
</ul>
<ul class="events itemMembers">
</ul>
</li>
<li class="item" data-name="module:zrender/shape/util/smoothSpline">
<span class="title">
<a href="module-zrender_shape_util_smoothSpline.html">module:zrender/shape/util/smoothSpline</a>
</span>
<ul class="members itemMembers">
</ul>
<ul class="typedefs itemMembers">
</ul>
<ul class="methods itemMembers">
</ul>
<ul class="events itemMembers">
</ul>
</li>
<li class="item" data-name="module:zrender/Storage">
<span class="title">
<a href="module-zrender_Storage.html">module:zrender/Storage</a>
</span>
<ul class="members itemMembers">
</ul>
<ul class="typedefs itemMembers">
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="module:zrender/Storage#addHover"><a href="module-zrender_Storage.html#addHover">addHover</a></li>
<li data-name="module:zrender/Storage#addRoot"><a href="module-zrender_Storage.html#addRoot">addRoot</a></li>
<li data-name="module:zrender/Storage#delHover"><a href="module-zrender_Storage.html#delHover">delHover</a></li>
<li data-name="module:zrender/Storage#delRoot"><a href="module-zrender_Storage.html#delRoot">delRoot</a></li>
<li data-name="module:zrender/Storage#dispose"><a href="module-zrender_Storage.html#dispose">dispose</a></li>
<li data-name="module:zrender/Storage#drift"><a href="module-zrender_Storage.html#drift">drift</a></li>
<li data-name="module:zrender/Storage#getHoverShapes"><a href="module-zrender_Storage.html#getHoverShapes">getHoverShapes</a></li>
<li data-name="module:zrender/Storage#getShapeList"><a href="module-zrender_Storage.html#getShapeList">getShapeList</a></li>
<li data-name="module:zrender/Storage#hasHoverShape"><a href="module-zrender_Storage.html#hasHoverShape">hasHoverShape</a></li>
<li data-name="module:zrender/Storage#iterShape"><a href="module-zrender_Storage.html#iterShape">iterShape</a></li>
<li data-name="module:zrender/Storage#mod"><a href="module-zrender_Storage.html#mod">mod</a></li>
<li data-name="module:zrender/Storage#updateShapeList"><a href="module-zrender_Storage.html#updateShapeList">updateShapeList</a></li>
</ul>
<ul class="events itemMembers">
</ul>
</li>
<li class="item" data-name="module:zrender/tool/color">
<span class="title">
<a href="module-zrender_tool_color.html">module:zrender/tool/color</a>
</span>
<ul class="members itemMembers">
</ul>
<ul class="typedefs itemMembers">
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="module:zrender/tool/color.alpha"><a href="module-zrender_tool_color.html#.alpha">alpha</a></li>
<li data-name="module:zrender/tool/color.getColor"><a href="module-zrender_tool_color.html#.getColor">getColor</a></li>
<li data-name="module:zrender/tool/color.getGradientColors"><a href="module-zrender_tool_color.html#.getGradientColors">getGradientColors</a></li>
<li data-name="module:zrender/tool/color.getRadialGradient"><a href="module-zrender_tool_color.html#.getRadialGradient">getRadialGradient</a></li>
<li data-name="module:zrender/tool/color.lift"><a href="module-zrender_tool_color.html#.lift">lift</a></li>
<li data-name="module:zrender/tool/color.mix"><a href="module-zrender_tool_color.html#.mix">mix</a></li>
<li data-name="module:zrender/tool/color.normalize"><a href="module-zrender_tool_color.html#.normalize">normalize</a></li>
<li data-name="module:zrender/tool/color.reverse"><a href="module-zrender_tool_color.html#.reverse">reverse</a></li>
<li data-name="module:zrender/tool/color.toArray"><a href="module-zrender_tool_color.html#.toArray">toArray</a></li>
<li data-name="module:zrender/tool/color.toHSB"><a href="module-zrender_tool_color.html#.toHSB">toHSB</a></li>
<li data-name="module:zrender/tool/color.toHSBA"><a href="module-zrender_tool_color.html#.toHSBA">toHSBA</a></li>
<li data-name="module:zrender/tool/color.toHSL"><a href="module-zrender_tool_color.html#.toHSL">toHSL</a></li>
<li data-name="module:zrender/tool/color.toHSLA"><a href="module-zrender_tool_color.html#.toHSLA">toHSLA</a></li>
<li data-name="module:zrender/tool/color.toHSV"><a href="module-zrender_tool_color.html#.toHSV">toHSV</a></li>
<li data-name="module:zrender/tool/color.toHSVA"><a href="module-zrender_tool_color.html#.toHSVA">toHSVA</a></li>
<li data-name="module:zrender/tool/color.toHex"><a href="module-zrender_tool_color.html#.toHex">toHex</a></li>
<li data-name="module:zrender/tool/color.toRGB"><a href="module-zrender_tool_color.html#.toRGB">toRGB</a></li>
<li data-name="module:zrender/tool/color.toRGBA"><a href="module-zrender_tool_color.html#.toRGBA">toRGBA</a></li>
</ul>
<ul class="events itemMembers">
</ul>
</li>
<li class="item" data-name="module:zrender/tool/computeBoundingBox">
<span class="title">
<a href="module-zrender_tool_computeBoundingBox.html">module:zrender/tool/computeBoundingBox</a>
</span>
<ul class="members itemMembers">
</ul>
<ul class="typedefs itemMembers">
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="module:zrender/tool/computeBoundingBox.computeArcBoundingBox"><a href="module-zrender_tool_computeBoundingBox.html#.computeArcBoundingBox">computeArcBoundingBox</a></li>
<li data-name="module:zrender/tool/computeBoundingBox.computeCubeBezierBoundingBox"><a href="module-zrender_tool_computeBoundingBox.html#.computeCubeBezierBoundingBox">computeCubeBezierBoundingBox</a></li>
<li data-name="module:zrender/tool/computeBoundingBox.computeQuadraticBezierBoundingBox"><a href="module-zrender_tool_computeBoundingBox.html#.computeQuadraticBezierBoundingBox">computeQuadraticBezierBoundingBox</a></li>
</ul>
<ul class="events itemMembers">
</ul>
</li>
<li class="item" data-name="module:zrender/tool/curve">
<span class="title">
<a href="module-zrender_tool_curve.html">module:zrender/tool/curve</a>
</span>
<ul class="members itemMembers">
</ul>
<ul class="typedefs itemMembers">
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="module:zrender/tool/curve.cubicAt"><a href="module-zrender_tool_curve.html#.cubicAt">cubicAt</a></li>
<li data-name="module:zrender/tool/curve.cubicDerivativeAt"><a href="module-zrender_tool_curve.html#.cubicDerivativeAt">cubicDerivativeAt</a></li>
<li data-name="module:zrender/tool/curve.cubicExtrema"><a href="module-zrender_tool_curve.html#.cubicExtrema">cubicExtrema</a></li>
<li data-name="module:zrender/tool/curve.cubicRootAt"><a href="module-zrender_tool_curve.html#.cubicRootAt">cubicRootAt</a></li>
<li data-name="module:zrender/tool/curve.cubicSubdivide"><a href="module-zrender_tool_curve.html#.cubicSubdivide">cubicSubdivide</a></li>
<li data-name="module:zrender/tool/curve.quadraticExtremum"><a href="module-zrender_tool_curve.html#.quadraticExtremum">quadraticExtremum</a></li>
<li data-name="module:zrender/tool/curve.quadraticSubdivide"><a href="module-zrender_tool_curve.html#.quadraticSubdivide">quadraticSubdivide</a></li>
</ul>
<ul class="events itemMembers">
</ul>
</li>
<li class="item" data-name="module:zrender/tool/event">
<span class="title">
<a href="module-zrender_tool_event.html">module:zrender/tool/event</a>
</span>
<ul class="members itemMembers">
</ul>
<ul class="typedefs itemMembers">
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="module:zrender/tool/event.getDelta"><a href="module-zrender_tool_event.html#.getDelta">getDelta</a></li>
<li data-name="module:zrender/tool/event.getX"><a href="module-zrender_tool_event.html#.getX">getX</a></li>
<li data-name="module:zrender/tool/event.getY"><a href="module-zrender_tool_event.html#.getY">getY</a></li>
<li data-name="module:zrender/tool/event.stop"><a href="module-zrender_tool_event.html#.stop">stop</a></li>
</ul>
<ul class="events itemMembers">
</ul>
</li>
<li class="item" data-name="module:zrender/tool/http">
<span class="title">
<a href="module-zrender_tool_http.html">module:zrender/tool/http</a>
</span>
<ul class="members itemMembers">
</ul>
<ul class="typedefs itemMembers">
<span class="subtitle">Typedefs</span>
<li data-name="module:zrender/tool/http~IHTTPGetOption"><a href="module-zrender_tool_http.html#~IHTTPGetOption">IHTTPGetOption</a></li>
</ul>
<ul class="methods itemMembers">
</ul>
<ul class="events itemMembers">
</ul>
</li>
<li class="item" data-name="module:zrender/tool/matrix">
<span class="title">
<a href="module-zrender_tool_matrix.html">module:zrender/tool/matrix</a>
</span>
<ul class="members itemMembers">
</ul>
<ul class="typedefs itemMembers">
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="module:zrender/tool/matrix.copy"><a href="module-zrender_tool_matrix.html#.copy">copy</a></li>
<li data-name="module:zrender/tool/matrix.create"><a href="module-zrender_tool_matrix.html#.create">create</a></li>
<li data-name="module:zrender/tool/matrix.identity"><a href="module-zrender_tool_matrix.html#.identity">identity</a></li>
<li data-name="module:zrender/tool/matrix.invert"><a href="module-zrender_tool_matrix.html#.invert">invert</a></li>
<li data-name="module:zrender/tool/matrix.mul"><a href="module-zrender_tool_matrix.html#.mul">mul</a></li>
<li data-name="module:zrender/tool/matrix.rotate"><a href="module-zrender_tool_matrix.html#.rotate">rotate</a></li>
<li data-name="module:zrender/tool/matrix.scale"><a href="module-zrender_tool_matrix.html#.scale">scale</a></li>
<li data-name="module:zrender/tool/matrix.translate"><a href="module-zrender_tool_matrix.html#.translate">translate</a></li>
</ul>
<ul class="events itemMembers">
</ul>
</li>
<li class="item" data-name="module:zrender/tool/util">
<span class="title">
<a href="module-zrender_tool_util.html">module:zrender/tool/util</a>
</span>
<ul class="members itemMembers">
</ul>
<ul class="typedefs itemMembers">
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="module:zrender/tool/util.clone"><a href="module-zrender_tool_util.html#.clone">clone</a></li>
<li data-name="module:zrender/tool/util.each"><a href="module-zrender_tool_util.html#.each">each</a></li>
<li data-name="module:zrender/tool/util.filter"><a href="module-zrender_tool_util.html#.filter">filter</a></li>
<li data-name="module:zrender/tool/util.indexOf"><a href="module-zrender_tool_util.html#.indexOf">indexOf</a></li>
<li data-name="module:zrender/tool/util.inherits"><a href="module-zrender_tool_util.html#.inherits">inherits</a></li>
<li data-name="module:zrender/tool/util.map"><a href="module-zrender_tool_util.html#.map">map</a></li>
<li data-name="module:zrender/tool/util.merge"><a href="module-zrender_tool_util.html#.merge">merge</a></li>
</ul>
<ul class="events itemMembers">
</ul>
</li>
<li class="item" data-name="module:zrender/tool/vector">
<span class="title">
<a href="module-zrender_tool_vector.html">module:zrender/tool/vector</a>
</span>
<ul class="members itemMembers">
</ul>
<ul class="typedefs itemMembers">
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="module:zrender/tool/vector.add"><a href="module-zrender_tool_vector.html#.add">add</a></li>
<li data-name="module:zrender/tool/vector.applyTransform"><a href="module-zrender_tool_vector.html#.applyTransform">applyTransform</a></li>
<li data-name="module:zrender/tool/vector.clone"><a href="module-zrender_tool_vector.html#.clone">clone</a></li>
<li data-name="module:zrender/tool/vector.copy"><a href="module-zrender_tool_vector.html#.copy">copy</a></li>
<li data-name="module:zrender/tool/vector.create"><a href="module-zrender_tool_vector.html#.create">create</a></li>
<li data-name="module:zrender/tool/vector.distance"><a href="module-zrender_tool_vector.html#.distance">distance</a></li>
<li data-name="module:zrender/tool/vector.distanceSquare"><a href="module-zrender_tool_vector.html#.distanceSquare">distanceSquare</a></li>
<li data-name="module:zrender/tool/vector.div"><a href="module-zrender_tool_vector.html#.div">div</a></li>
<li data-name="module:zrender/tool/vector.dot"><a href="module-zrender_tool_vector.html#.dot">dot</a></li>
<li data-name="module:zrender/tool/vector.len"><a href="module-zrender_tool_vector.html#.len">len</a></li>
<li data-name="module:zrender/tool/vector.lenSquare"><a href="module-zrender_tool_vector.html#.lenSquare">lenSquare</a></li>
<li data-name="module:zrender/tool/vector.lerp"><a href="module-zrender_tool_vector.html#.lerp">lerp</a></li>
<li data-name="module:zrender/tool/vector.max"><a href="module-zrender_tool_vector.html#.max">max</a></li>
<li data-name="module:zrender/tool/vector.min"><a href="module-zrender_tool_vector.html#.min">min</a></li>
<li data-name="module:zrender/tool/vector.mul"><a href="module-zrender_tool_vector.html#.mul">mul</a></li>
<li data-name="module:zrender/tool/vector.negate"><a href="module-zrender_tool_vector.html#.negate">negate</a></li>
<li data-name="module:zrender/tool/vector.normalize"><a href="module-zrender_tool_vector.html#.normalize">normalize</a></li>
<li data-name="module:zrender/tool/vector.scale"><a href="module-zrender_tool_vector.html#.scale">scale</a></li>
<li data-name="module:zrender/tool/vector.scaleAndAdd"><a href="module-zrender_tool_vector.html#.scaleAndAdd">scaleAndAdd</a></li>
<li data-name="module:zrender/tool/vector.set"><a href="module-zrender_tool_vector.html#.set">set</a></li>
<li data-name="module:zrender/tool/vector.sub"><a href="module-zrender_tool_vector.html#.sub">sub</a></li>
</ul>
<ul class="events itemMembers">
</ul>
</li>
<li class="item" data-name="module:zrender/ZRender">
<span class="title">
<a href="module-zrender_ZRender.html">module:zrender/ZRender</a>
</span>
<ul class="members itemMembers">
<span class="subtitle">Members</span>
<li data-name="module:zrender/ZRender#animation"><a href="module-zrender_ZRender.html#animation">animation</a></li>
<li data-name="module:zrender/ZRender#id"><a href="module-zrender_ZRender.html#id">id</a></li>
</ul>
<ul class="typedefs itemMembers">
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="module:zrender/ZRender#addElement"><a href="module-zrender_ZRender.html#addElement">addElement</a></li>
<li data-name="module:zrender/ZRender#addGroup"><a href="module-zrender_ZRender.html#addGroup">addGroup</a></li>
<li data-name="module:zrender/ZRender#addHoverShape"><a href="module-zrender_ZRender.html#addHoverShape">addHoverShape</a></li>
<li data-name="module:zrender/ZRender#addShape"><a href="module-zrender_ZRender.html#addShape">addShape</a></li>
<li data-name="module:zrender/ZRender#animate"><a href="module-zrender_ZRender.html#animate">animate</a></li>
<li data-name="module:zrender/ZRender#clear"><a href="module-zrender_ZRender.html#clear">clear</a></li>
<li data-name="module:zrender/ZRender#clearAnimation"><a href="module-zrender_ZRender.html#clearAnimation">clearAnimation</a></li>
<li data-name="module:zrender/ZRender#delElement"><a href="module-zrender_ZRender.html#delElement">delElement</a></li>
<li data-name="module:zrender/ZRender#delGroup"><a href="module-zrender_ZRender.html#delGroup">delGroup</a></li>
<li data-name="module:zrender/ZRender#delShape"><a href="module-zrender_ZRender.html#delShape">delShape</a></li>
<li data-name="module:zrender/ZRender#dispose"><a href="module-zrender_ZRender.html#dispose">dispose</a></li>
<li data-name="module:zrender/ZRender#getHeight"><a href="module-zrender_ZRender.html#getHeight">getHeight</a></li>
<li data-name="module:zrender/ZRender#getId"><a href="module-zrender_ZRender.html#getId">getId</a></li>
<li data-name="module:zrender/ZRender#getWidth"><a href="module-zrender_ZRender.html#getWidth">getWidth</a></li>
<li data-name="module:zrender/ZRender#hideLoading"><a href="module-zrender_ZRender.html#hideLoading">hideLoading</a></li>
<li data-name="module:zrender/ZRender#modElement"><a href="module-zrender_ZRender.html#modElement">modElement</a></li>
<li data-name="module:zrender/ZRender#modGroup"><a href="module-zrender_ZRender.html#modGroup">modGroup</a></li>
<li data-name="module:zrender/ZRender#modLayer"><a href="module-zrender_ZRender.html#modLayer">modLayer</a></li>
<li data-name="module:zrender/ZRender#modShape"><a href="module-zrender_ZRender.html#modShape">modShape</a></li>
<li data-name="module:zrender/ZRender#on"><a href="module-zrender_ZRender.html#on">on</a></li>
<li data-name="module:zrender/ZRender#refresh"><a href="module-zrender_ZRender.html#refresh">refresh</a></li>
<li data-name="module:zrender/ZRender#refreshHover"><a href="module-zrender_ZRender.html#refreshHover">refreshHover</a></li>
<li data-name="module:zrender/ZRender#refreshNextFrame"><a href="module-zrender_ZRender.html#refreshNextFrame">refreshNextFrame</a></li>
<li data-name="module:zrender/ZRender#refreshShapes"><a href="module-zrender_ZRender.html#refreshShapes">refreshShapes</a></li>
<li data-name="module:zrender/ZRender#render"><a href="module-zrender_ZRender.html#render">render</a></li>
<li data-name="module:zrender/ZRender#resize"><a href="module-zrender_ZRender.html#resize">resize</a></li>
<li data-name="module:zrender/ZRender#shapeToImage"><a href="module-zrender_ZRender.html#shapeToImage">shapeToImage</a></li>
<li data-name="module:zrender/ZRender#showLoading"><a href="module-zrender_ZRender.html#showLoading">showLoading</a></li>
<li data-name="module:zrender/ZRender#stopAnimation"><a href="module-zrender_ZRender.html#stopAnimation">stopAnimation</a></li>
<li data-name="module:zrender/ZRender#toDataURL"><a href="module-zrender_ZRender.html#toDataURL">toDataURL</a></li>
<li data-name="module:zrender/ZRender#trigger"><a href="module-zrender_ZRender.html#trigger">trigger</a></li>
<li data-name="module:zrender/ZRender#un"><a href="module-zrender_ZRender.html#un">un</a></li>
</ul>
<ul class="events itemMembers">
</ul>
</li>
</ul>
</div>
<div class="main">
<h1 class="page-title" data-filename="module-zrender_tool_http.html">Module: zrender/tool/http</h1>
<section>
<header>
<h2>
zrender/tool/http
</h2>
</header>
<article>
<div class="container-overview">
<dl class="details">
</dl>
</div>
<h3 class="subsection-title">Type Definitions</h3>
<dl>
<dt>
<div class="nameContainer">
<h4 class="name" id="~IHTTPGetOption">
IHTTPGetOption<span class="type-signature type object">Object</span>
</h4>
</div>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>url</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>onsuccess</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="attributes">
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>onerror</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table></dl>
</dl>
</dd>
</dl>
</article>
</section>
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Thu May 28 2015 14:42:44 GMT+0800 (CST)
</footer>
</div>
</div>
<script>prettyPrint();</script>
<script src="scripts/linenumber.js"></script>
<script src="scripts/main.js"></script>
</body>
</html> | yckrasnodar/zrender | doc/api/module-zrender_tool_http.html | HTML | bsd-3-clause | 190,196 |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Canvas Test</title>
<script type="text/javascript" src="../doc/asset/js/esl/esl.js"></script>
<style>
html, body, #main {
margin: 0;
}
</style>
</head>
<body>
<div id="main"></div>
<script type="text/javascript">
require.config({
packages: [
{
name: 'zrender',
location: '../src',
main: 'zrender'
}
]
});
require(
[
"zrender",
"zrender/graphic/shape/Rectangle"
],
function(zrender, RectangleShape) {
for (var i = 0; i < 200; i++) {
var dom = document.createElement('div');
dom.style.width = '700px';
dom.style.height = '400px';
document.getElementById('main').appendChild(dom);
var zr = zrender.init(dom, {
// renderer: 'svg'
});
for (var j = 0; j < 50; j++) {
zr.addElement(new RectangleShape({
shape: {
x: j * 14,
width: 10,
height: Math.round(Math.random() * 300)
},
style: {
// fill: '#02f',
fill: '#f20'
}
}));
}
}
}
)
</script>
</body>
</html> | lkiarest/zrender | test/memory.html | HTML | bsd-3-clause | 1,585 |
#define A2_A_h
| endlessm/chromium-browser | third_party/llvm/clang/test/Modules/Inputs/shadow/A2/A.h | C | bsd-3-clause | 15 |
//
// Created by Krzysztof Zabłocki(http://twitter.com/merowing_) on 20/10/14.
//
//
//
@import Foundation;
@protocol KZPComponent <NSObject>
@required
+ (void)reset;
@end | xuvw/KZPlayground | Pod/Classes/Components/KZPComponent.h | C | mit | 176 |
#!/usr/bin/env bash
echo "
Please run download-db.sh to download the PlasmidFinder database to ${PLASMID_DB}.
If you have a database in custom path, please use "plasmidfinder.py" with the option "-p".
" >> ${PREFIX}/.messages.txt
printf '%s\n' "${URLS[@]}" >> "${PREFIX}/.messages.txt" 2>&1
| jerowe/bioconda-recipes | recipes/plasmidfinder/post-link.sh | Shell | mit | 292 |
<!DOCTYPE html>
<!--[if lt IE 7]>
<html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>
<html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>
<html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="css/bootstrap.min.css">
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="../bower_components/angular/angular.js"></script>
<script src="../dist/ng-table.js"></script>
<link rel="stylesheet" href="../dist/ng-table.css">
<style>
/* original source: http://elvery.net/demo/responsive-tables/ */
@media only screen and (max-width: 800px){
.demo-reponsiveTable table,
.demo-reponsiveTable thead,
.demo-reponsiveTable tbody,
.demo-reponsiveTable th,
.demo-reponsiveTable td,
.demo-reponsiveTable tr {
display: block;
}
/* Hide table sorting (but not display: none;, for accessibility) */
/* Note: we're hiding the sorting because it looks terrible! Making this pretty is an exercise for the reader*/
.demo-reponsiveTable thead tr:first-child {
position: absolute;
top: -9999px;
left: -9999px;
}
.demo-reponsiveTable tr {
border: 1px solid #ccc;
}
.demo-reponsiveTable table>tbody>tr>td,
.demo-reponsiveTable table>thead>tr>th {
/* Behave like a "row" */
border: none;
border-bottom: 1px solid #eee;
position: relative;
padding-left: 50%;
white-space: normal;
text-align: left;
}
.demo-reponsiveTable table>tbody>tr>td:before,
.demo-reponsiveTable table>thead>tr>th:before {
/* Now like a table header */
position: absolute;
/* Top/left values mimic padding */
top: 6px;
left: 6px;
width: 45%;
padding-right: 10px;
white-space: nowrap;
text-align: left;
font-weight: bold;
/* Label the data */
content: attr(data-title-text);
}
}
</style>
</head>
<body ng-app="main">
<h1>Responsive table</h1>
<p><strong>Resize the the width of browser window to see table switch to <em>'card view'</em></strong></p>
<div ng-controller="DemoCtrl" class="demo-reponsiveTable clearfix">
<button class="btn btn-default" ng-click="removeFilters()">Remove filters</button>
<button class="btn btn-default" ng-click="addFilters()">Add filters</button>
<table ng-table="tableParams" class="table table-bordered table-striped">
<tr ng-repeat="user in $data">
<td title="'Full Name'" title-alt="'Name'" sortable="'name'" filter="filters.name">
{{user.name}}
</td>
<td title="'Age'" sortable="'age'" filter="filters.age">
{{user.age}}
</td>
</tr>
</table>
<script>
var app = angular.module('main', ['ngTable']).
controller('DemoCtrl', function ($scope, $filter, NgTableParams) {
var data = [
{name: "Moroni", age: 50},
{name: "Tiancum", age: 43},
{name: "Jacob", age: 27},
{name: "Nephi", age: 29},
{name: "Enos", age: 34},
{name: "Tiancum", age: 43},
{name: "Jacob", age: 27},
{name: "Nephi", age: 29},
{name: "Enos", age: 34},
{name: "Tiancum", age: 43},
{name: "Jacob", age: 27},
{name: "Nephi", age: 29},
{name: "Enos", age: 34},
{name: "Tiancum", age: 43},
{name: "Jacob", age: 27},
{name: "Nephi", age: 29},
{name: "Enos", age: 34}
];
$scope.data = data;
$scope.removeFilters = function(){
$scope.filters = { name: false, age: false };
};
$scope.addFilters = function(){
$scope.filters = {
name: {
'name': 'text'
},
age: {
'age': 'number'
}
};
};
$scope.addFilters();
$scope.tableParams = new NgTableParams({
page: 1, // show first page
count: 10, // count per page
filter: {
//name: 'M' // initial filter
},
sorting: {
//name: 'asc' // initial sorting
}
}, {
filterOptions: { filterDelay: 0 },
total: data.length, // length of data
getData: function ($defer, params) {
// use built-in angular filter
var filteredData = params.filter() ?
$filter('filter')(data, params.filter()) :
data;
var orderedData = params.sorting() ?
$filter('orderBy')(filteredData, params.orderBy()) :
data;
params.total(orderedData.length); // set total for recalc pagination
$defer.resolve(orderedData.slice((params.page() - 1) * params.count(), params.page() * params.count()));
}
});
})
</script>
</div>
</body>
</html>
| sorlandoiii/dynasty-league | resources/public/bower_components/ng-table/examples-old/demo32.html | HTML | epl-1.0 | 6,229 |
/*
* @test /nodynamiccopyright/
* @bug 4482403
* @summary javac failed to check second bound
* @author gafter
*
* @compile/fail/ref=Multibound1.out -XDrawDiagnostics Multibound1.java
*/
package Multibound1;
interface A {}
interface B {}
class C<T extends A&B> {}
class D implements A {}
class E extends C<D> {}
| FauxFaux/jdk9-langtools | test/tools/javac/generics/Multibound1.java | Java | gpl-2.0 | 321 |
/*
* linux/ipc/namespace.c
* Copyright (C) 2006 Pavel Emelyanov <xemul@openvz.org> OpenVZ, SWsoft Inc.
*/
#include <linux/ipc.h>
#include <linux/msg.h>
#include <linux/ipc_namespace.h>
#include <linux/rcupdate.h>
#include <linux/nsproxy.h>
#include <linux/slab.h>
#include <linux/fs.h>
#include <linux/mount.h>
#include <linux/user_namespace.h>
#include <linux/proc_fs.h>
#include "util.h"
static struct ipc_namespace *create_ipc_ns(void)
{
struct ipc_namespace *ns;
int err;
ns = kmalloc(sizeof(struct ipc_namespace), GFP_KERNEL);
if (ns == NULL)
return ERR_PTR(-ENOMEM);
err = proc_alloc_inum(&ns->proc_inum);
if (err) {
kfree(ns);
return ERR_PTR(err);
}
atomic_set(&ns->count, 1);
err = mq_init_ns(ns);
if (err) {
proc_free_inum(ns->proc_inum);
kfree(ns);
return ERR_PTR(err);
}
atomic_inc(&nr_ipc_ns);
sem_init_ns(ns);
msg_init_ns(ns);
shm_init_ns(ns);
/*
* msgmni has already been computed for the new ipc ns.
* Thus, do the ipcns creation notification before registering that
* new ipcns in the chain.
*/
ipcns_notify(IPCNS_CREATED);
register_ipcns_notifier(ns);
return ns;
}
struct ipc_namespace *copy_ipcs(unsigned long flags, struct ipc_namespace *ns)
{
if (!(flags & CLONE_NEWIPC))
return get_ipc_ns(ns);
return create_ipc_ns();
}
/*
* free_ipcs - free all ipcs of one type
* @ns: the namespace to remove the ipcs from
* @ids: the table of ipcs to free
* @free: the function called to free each individual ipc
*
* Called for each kind of ipc when an ipc_namespace exits.
*/
void free_ipcs(struct ipc_namespace *ns, struct ipc_ids *ids,
void (*free)(struct ipc_namespace *, struct kern_ipc_perm *))
{
struct kern_ipc_perm *perm;
int next_id;
int total, in_use;
down_write(&ids->rw_mutex);
in_use = ids->in_use;
for (total = 0, next_id = 0; total < in_use; next_id++) {
perm = idr_find(&ids->ipcs_idr, next_id);
if (perm == NULL)
continue;
ipc_lock_by_ptr(perm);
free(ns, perm);
total++;
}
up_write(&ids->rw_mutex);
}
static void free_ipc_ns(struct ipc_namespace *ns)
{
/*
* Unregistering the hotplug notifier at the beginning guarantees
* that the ipc namespace won't be freed while we are inside the
* callback routine. Since the blocking_notifier_chain_XXX routines
* hold a rw lock on the notifier list, unregister_ipcns_notifier()
* won't take the rw lock before blocking_notifier_call_chain() has
* released the rd lock.
*/
unregister_ipcns_notifier(ns);
sem_exit_ns(ns);
msg_exit_ns(ns);
shm_exit_ns(ns);
proc_free_inum(ns->proc_inum);
kfree(ns);
atomic_dec(&nr_ipc_ns);
/*
* Do the ipcns removal notification after decrementing nr_ipc_ns in
* order to have a correct value when recomputing msgmni.
*/
ipcns_notify(IPCNS_REMOVED);
}
/*
* put_ipc_ns - drop a reference to an ipc namespace.
* @ns: the namespace to put
*
* If this is the last task in the namespace exiting, and
* it is dropping the refcount to 0, then it can race with
* a task in another ipc namespace but in a mounts namespace
* which has this ipcns's mqueuefs mounted, doing some action
* with one of the mqueuefs files. That can raise the refcount.
* So dropping the refcount, and raising the refcount when
* accessing it through the VFS, are protected with mq_lock.
*
* (Clearly, a task raising the refcount on its own ipc_ns
* needn't take mq_lock since it can't race with the last task
* in the ipcns exiting).
*/
void put_ipc_ns(struct ipc_namespace *ns)
{
if (atomic_dec_and_lock(&ns->count, &mq_lock)) {
mq_clear_sbinfo(ns);
spin_unlock(&mq_lock);
mq_put_mnt(ns);
free_ipc_ns(ns);
}
}
static void *ipcns_get(struct task_struct *task)
{
struct ipc_namespace *ns = NULL;
struct nsproxy *nsproxy;
rcu_read_lock();
nsproxy = task_nsproxy(task);
if (nsproxy)
ns = get_ipc_ns(nsproxy->ipc_ns);
rcu_read_unlock();
return ns;
}
static void ipcns_put(void *ns)
{
return put_ipc_ns(ns);
}
static int ipcns_install(struct nsproxy *nsproxy, void *ns)
{
/* Ditch state from the old ipc namespace */
exit_sem(current);
put_ipc_ns(nsproxy->ipc_ns);
nsproxy->ipc_ns = get_ipc_ns(ns);
return 0;
}
static unsigned int ipcns_inum(void *vp)
{
struct ipc_namespace *ns = vp;
return ns->proc_inum;
}
const struct proc_ns_operations ipcns_operations = {
.name = "ipc",
.type = CLONE_NEWIPC,
.get = ipcns_get,
.put = ipcns_put,
.install = ipcns_install,
.inum = ipcns_inum,
};
| augustayu/fastsocket | kernel/ipc/namespace.c | C | gpl-2.0 | 4,437 |
/*
* include/linux/muic/muic.h
*
* header file supporting MUIC common information
*
* Copyright (C) 2010 Samsung Electronics
* Seoyoung Jeong <seo0.jeong@samsung.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __MUIC_H__
#define __MUIC_H__
/* Status of IF PMIC chip (suspend and resume) */
enum {
MUIC_SUSPEND = 0,
MUIC_RESUME,
};
/* MUIC Interrupt */
enum {
MUIC_INTR_DETACH = 0,
MUIC_INTR_ATTACH
};
/* MUIC Dock Observer Callback parameter */
enum {
MUIC_DOCK_DETACHED = 0,
MUIC_DOCK_DESKDOCK = 1,
MUIC_DOCK_CARDOCK = 2,
MUIC_DOCK_AUDIODOCK = 7,
MUIC_DOCK_SMARTDOCK = 8,
MUIC_DOCK_HMT = 11,
};
/* MUIC Path */
enum {
MUIC_PATH_USB_AP = 0,
MUIC_PATH_USB_CP,
MUIC_PATH_UART_AP,
MUIC_PATH_UART_CP,
MUIC_PATH_OPEN,
MUIC_PATH_AUDIO,
};
#ifdef CONFIG_MUIC_HV_FORCE_LIMIT
enum {
HV_9V = 0,
HV_5V,
};
#endif
/* bootparam SWITCH_SEL */
enum {
SWITCH_SEL_USB_MASK = 0x1,
SWITCH_SEL_UART_MASK = 0x2,
SWITCH_SEL_RUSTPROOF_MASK = 0x8,
SWITCH_SEL_AFC_DISABLE_MASK = 0x100,
};
/* MUIC ADC table */
typedef enum {
ADC_GND = 0x00,
ADC_SEND_END = 0x01, /* 0x00001 2K ohm */
ADC_REMOTE_S11 = 0x0c, /* 0x01100 20.5K ohm */
ADC_REMOTE_S12 = 0x0d, /* 0x01101 24.07K ohm */
ADC_RESERVED_VZW = 0x0e, /* 0x01110 28.7K ohm */
ADC_INCOMPATIBLE_VZW = 0x0f, /* 0x01111 34K ohm */
ADC_SMARTDOCK = 0x10, /* 0x10000 40.2K ohm */
ADC_HMT = 0x11, /* 0x10001 49.9K ohm */
ADC_AUDIODOCK = 0x12, /* 0x10010 64.9K ohm */
ADC_USB_LANHUB = 0x13, /* 0x10011 80.07K ohm */
ADC_CHARGING_CABLE = 0x14, /* 0x10100 102K ohm */
ADC_UNIVERSAL_MMDOCK = 0x15, /* 0x10101 121K ohm */
ADC_UART_CABLE = 0x16, /* 0x10110 150K ohm */
ADC_CEA936ATYPE1_CHG = 0x17, /* 0x10111 200K ohm */
ADC_JIG_USB_OFF = 0x18, /* 0x11000 255K ohm */
ADC_JIG_USB_ON = 0x19, /* 0x11001 301K ohm */
ADC_DESKDOCK = 0x1a, /* 0x11010 365K ohm */
ADC_CEA936ATYPE2_CHG = 0x1b, /* 0x11011 442K ohm */
ADC_JIG_UART_OFF = 0x1c, /* 0x11100 523K ohm */
ADC_JIG_UART_ON = 0x1d, /* 0x11101 619K ohm */
ADC_AUDIOMODE_W_REMOTE = 0x1e, /* 0x11110 1000K ohm */
ADC_OPEN = 0x1f,
ADC_OPEN_219 = 0xfb, /* ADC open or 219.3K ohm */
ADC_219 = 0xfc, /* ADC open or 219.3K ohm */
ADC_UNDEFINED = 0xfd, /* Undefied range */
ADC_DONTCARE = 0xfe, /* ADC don't care for MHL */
ADC_ERROR = 0xff, /* ADC value read error */
} muic_adc_t;
/* MUIC attached device type */
typedef enum {
ATTACHED_DEV_NONE_MUIC = 0,
ATTACHED_DEV_USB_MUIC,
ATTACHED_DEV_CDP_MUIC,
ATTACHED_DEV_OTG_MUIC,
ATTACHED_DEV_TA_MUIC,
ATTACHED_DEV_UNOFFICIAL_MUIC,
ATTACHED_DEV_UNOFFICIAL_TA_MUIC,
ATTACHED_DEV_UNOFFICIAL_ID_MUIC,
ATTACHED_DEV_UNOFFICIAL_ID_TA_MUIC,
ATTACHED_DEV_UNOFFICIAL_ID_ANY_MUIC,
ATTACHED_DEV_UNOFFICIAL_ID_USB_MUIC,
ATTACHED_DEV_UNOFFICIAL_ID_CDP_MUIC,
ATTACHED_DEV_UNDEFINED_CHARGING_MUIC,
ATTACHED_DEV_DESKDOCK_MUIC,
ATTACHED_DEV_UNKNOWN_VB_MUIC,
ATTACHED_DEV_DESKDOCK_VB_MUIC,
ATTACHED_DEV_CARDOCK_MUIC,
ATTACHED_DEV_JIG_UART_OFF_MUIC,
ATTACHED_DEV_JIG_UART_OFF_VB_MUIC, /* VBUS enabled */
ATTACHED_DEV_JIG_UART_OFF_VB_OTG_MUIC, /* for otg test */
ATTACHED_DEV_JIG_UART_OFF_VB_FG_MUIC, /* for fuelgauge test */
ATTACHED_DEV_JIG_UART_ON_MUIC,
ATTACHED_DEV_JIG_USB_OFF_MUIC,
ATTACHED_DEV_JIG_USB_ON_MUIC,
ATTACHED_DEV_SMARTDOCK_MUIC,
ATTACHED_DEV_SMARTDOCK_VB_MUIC,
ATTACHED_DEV_SMARTDOCK_TA_MUIC,
ATTACHED_DEV_SMARTDOCK_USB_MUIC,
ATTACHED_DEV_UNIVERSAL_MMDOCK_MUIC,
ATTACHED_DEV_AUDIODOCK_MUIC,
ATTACHED_DEV_MHL_MUIC,
ATTACHED_DEV_CHARGING_CABLE_MUIC,
ATTACHED_DEV_AFC_CHARGER_PREPARE_MUIC,
ATTACHED_DEV_AFC_CHARGER_PREPARE_DUPLI_MUIC,
ATTACHED_DEV_AFC_CHARGER_5V_MUIC,
ATTACHED_DEV_AFC_CHARGER_5V_DUPLI_MUIC,
ATTACHED_DEV_AFC_CHARGER_9V_MUIC,
ATTACHED_DEV_AFC_CHARGER_ERR_V_MUIC,
ATTACHED_DEV_AFC_CHARGER_ERR_V_DUPLI_MUIC,
ATTACHED_DEV_QC_CHARGER_PREPARE_MUIC,
ATTACHED_DEV_QC_CHARGER_5V_MUIC,
ATTACHED_DEV_QC_CHARGER_ERR_V_MUIC,
ATTACHED_DEV_QC_CHARGER_9V_MUIC,
ATTACHED_DEV_HV_ID_ERR_UNDEFINED_MUIC,
ATTACHED_DEV_HV_ID_ERR_UNSUPPORTED_MUIC,
ATTACHED_DEV_HV_ID_ERR_SUPPORTED_MUIC,
ATTACHED_DEV_HMT_MUIC,
ATTACHED_DEV_VZW_ACC_MUIC,
ATTACHED_DEV_VZW_INCOMPATIBLE_MUIC,
ATTACHED_DEV_USB_LANHUB_MUIC,
ATTACHED_DEV_TYPE2_CHG_MUIC,
ATTACHED_DEV_UNSUPPORTED_ID_MUIC,
ATTACHED_DEV_UNSUPPORTED_ID_VB_MUIC,
ATTACHED_DEV_TIMEOUT_OPEN_MUIC,
ATTACHED_DEV_WIRELESS_PAD_MUIC,
ATTACHED_DEV_POWERPACK_MUIC,
ATTACHED_DEV_UNKNOWN_MUIC,
ATTACHED_DEV_NUM,
} muic_attached_dev_t;
#ifdef CONFIG_MUIC_HV_FORCE_LIMIT
/* MUIC attached device type */
typedef enum {
SILENT_CHG_DONE = 0,
SILENT_CHG_CHANGING = 1,
SILENT_CHG_NUM,
} muic_silent_change_state_t;
#endif
/* muic common callback driver internal data structure
* that setted at muic-core.c file
*/
struct muic_platform_data {
int irq_gpio;
int switch_sel;
/* muic current USB/UART path */
int usb_path;
int uart_path;
int gpio_uart_sel;
bool rustproof_on;
bool afc_disable;
bool wireless;
#ifdef CONFIG_MUIC_HV_FORCE_LIMIT
int hv_sel;
int silent_chg_change_state;
#endif
/* muic switch dev register function for DockObserver */
void (*init_switch_dev_cb) (void);
void (*cleanup_switch_dev_cb) (void);
/* muic GPIO control function */
int (*init_gpio_cb) (int switch_sel);
int (*set_gpio_usb_sel) (int usb_path);
int (*set_gpio_uart_sel) (int uart_path);
int (*set_safeout) (int safeout_path);
/* muic path switch function for rustproof */
void (*set_path_switch_suspend) (struct device *dev);
void (*set_path_switch_resume) (struct device *dev);
};
int get_switch_sel(void);
#endif /* __MUIC_H__ */
| 7420dev/android_kernel_samsung_zeroflte | include/linux/muic/muic.h | C | gpl-2.0 | 6,208 |
#megaMenu ul.megaMenu{
background-color:#222;
border:1px solid #222;
}
#megaMenu ul.megaMenu > li > a{
font-size:12px;
color:#d9d9d9;
text-shadow:none;
font-weight:bold;
text-transform:uppercase;
text-shadow:0px 1px 1px #000;
}
#megaMenu ul.megaMenu > li:hover > a, #megaMenu ul.megaMenu > li > a:hover, #megaMenu ul.megaMenu > li.megaHover > a{
background-color:#111;
color:#fff;
text-shadow:0px 1px 1px #000;
}
#megaMenu ul.megaMenu > li:hover > a,
#megaMenu ul.megaMenu > li.megaHover > a{
border-color:transparent;
}
#megaMenu ul.megaMenu > li.ss-nav-menu-mega > ul.sub-menu-1,
#megaMenu ul.megaMenu li.ss-nav-menu-reg ul.sub-menu{
border-color:#000;
color:#777;
text-shadow:0px 1px 1px #fff;
}
#megaMenu ul.megaMenu > li.ss-nav-menu-mega:hover > a, #megaMenu ul.megaMenu > li.ss-nav-menu-reg.mega-with-sub:hover > a, #megaMenu ul.megaMenu > li.ss-nav-menu-mega.megaHover > a, #megaMenu ul.megaMenu > li.ss-nav-menu-reg.mega-with-sub.megaHover > a{
border-bottom-color:#000;
}
#megaMenu.megaMenuHorizontal ul ul.sub-menu-1{
top:100% !important;
}
#megaMenu li.ss-nav-menu-mega ul.sub-menu.sub-menu-1, #megaMenu li.ss-nav-menu-reg ul.sub-menu{
background-color:#e9e9e9;
}
#megaMenu ul li.ss-nav-menu-mega ul ul.sub-menu li a, #megaMenu ul ul.sub-menu li a{
color:#444;
font-size:12px;
text-shadow:0px 1px 1px #fff;
}
#megaMenu ul li.ss-nav-menu-mega ul.sub-menu-1 > li > a,
#megaMenu ul li.ss-nav-menu-mega ul.sub-menu-1 > li:hover > a,
#megaMenu ul li.ss-nav-menu-mega ul ul.sub-menu .ss-nav-menu-header > a,
.wpmega-widgetarea h2.widgettitle{
color:#222;
font-size:12px;
font-weight:bold;
text-shadow:0px 1px 1px #fff;
text-transform:uppercase;
}
#megaMenu ul li.ss-nav-menu-mega ul ul.sub-menu li a:hover, #megaMenu ul ul.sub-menu > li:hover > a{
/*background-color:#222;
color:#fff;
text-shadow:0px 1px 1px #000;*/
color:#000;
}
#megaMenu ul li.ss-nav-menu-mega ul.sub-menu li.ss-nav-menu-highlight > a, #megaMenu ul li.ss-nav-menu-reg ul.sub-menu li.ss-nav-menu-highlight > a{
color:#8f0000;
}
.ss-nav-menu-with-img .wpmega-link-title, .ss-nav-menu-with-img .wpmega-link-description{
/*padding-left:20px;*/
}
.ss-nav-menu-with-img{
min-height:20px;
}
#megaMenu ul.megaMenu > li.ss-nav-menu-reg ul.sub-menu > li > ul.sub-menu{
top:-1px;
border-left-color:#e9e9e9;
}
.wpmega-item-description{
font-size:9px;
}
#megaMenu ul li.ss-nav-menu-mega ul.sub-menu li ul.wpmega-postlist img {
background:#fff;
border:1px solid #ddd;
float:left;
padding:4px;
}
/* IE7 Hacks */
#megaMenu.megaMenuHorizontal ul.megaMenu{
*border-bottom:none;
}
#megaMenu.megaMenuVertical ul.megaMenu{
*border-right:none;
}
/* Top Level Searchbar */
#megaMenu > ul.megaMenu > li > .wpmega-widgetarea > ul > li > form#searchform input[type="text"]{
background:#d9d9d9;
color:#444;
text-shadow:0px 1px 1px #fff;
}
#megaMenu > ul.megaMenu > li > .wpmega-widgetarea > ul > li > form#searchform input[type="submit"]{
background-color:#aaa;
border-color:#000;
} | level09/wp34 | wp-content/plugins/wp-uber-menu/styles/skins/greywhite.css | CSS | gpl-2.0 | 2,988 |
/************************************************************************************************/
/* */
/* Copyright 2013 Broadcom Corporation */
/* */
/* Unless you and Broadcom execute a separate written software license agreement governing */
/* use of this software, this software is licensed to you under the terms of the GNU */
/* General Public License version 2 (the GPL), available at */
/* */
/* http://www.broadcom.com/licenses/GPLv2.php */
/* */
/* with the following added to such license: */
/* */
/* As a special exception, the copyright holders of this software give you permission to */
/* link this software with independent modules, and to copy and distribute the resulting */
/* executable under terms of your choice, provided that you also meet, for each linked */
/* independent module, the terms and conditions of the license of that module. */
/* An independent module is a module which is not derived from this software. The special */
/* exception does not apply to any modifications of the software. */
/* */
/* Notwithstanding the above, under no circumstances may you combine this software in any */
/* way with any other Broadcom software provided under a license other than the GPL, */
/* without Broadcom's express prior written consent. */
/* */
/* Date : Generated on 6/27/2013 16:58:22 */
/* RDB file : //JAVA/ */
/************************************************************************************************/
#ifndef __BRCM_RDB_RF_INTERFACE_BLOCK3_TOP_H__
#define __BRCM_RDB_RF_INTERFACE_BLOCK3_TOP_H__
#define RF_INTERFACE_BLOCK3_TOP_DACCFG_OFFSET 0x00000000
#define RF_INTERFACE_BLOCK3_TOP_DACCFG_TYPE UInt32
#define RF_INTERFACE_BLOCK3_TOP_DACCFG_RESERVED_MASK 0xFFFFCEEE
#define RF_INTERFACE_BLOCK3_TOP_DACCFG_GPDACMODE_SHIFT 12
#define RF_INTERFACE_BLOCK3_TOP_DACCFG_GPDACMODE_MASK 0x00003000
#define RF_INTERFACE_BLOCK3_TOP_DACCFG_GPDACTWOS_SHIFT 8
#define RF_INTERFACE_BLOCK3_TOP_DACCFG_GPDACTWOS_MASK 0x00000100
#define RF_INTERFACE_BLOCK3_TOP_DACCFG_GPDACTESTSEL_SHIFT 4
#define RF_INTERFACE_BLOCK3_TOP_DACCFG_GPDACTESTSEL_MASK 0x00000010
#define RF_INTERFACE_BLOCK3_TOP_DACCFG_GPDACTESTEN_SHIFT 0
#define RF_INTERFACE_BLOCK3_TOP_DACCFG_GPDACTESTEN_MASK 0x00000001
#define RF_INTERFACE_BLOCK3_TOP_DACDATA_OFFSET 0x00000004
#define RF_INTERFACE_BLOCK3_TOP_DACDATA_TYPE UInt32
#define RF_INTERFACE_BLOCK3_TOP_DACDATA_RESERVED_MASK 0xFFFFFC00
#define RF_INTERFACE_BLOCK3_TOP_DACDATA_GPDACDATA_SHIFT 0
#define RF_INTERFACE_BLOCK3_TOP_DACDATA_GPDACDATA_MASK 0x000003FF
#define RF_INTERFACE_BLOCK3_TOP_DACRDDATA_OFFSET 0x00000008
#define RF_INTERFACE_BLOCK3_TOP_DACRDDATA_TYPE UInt32
#define RF_INTERFACE_BLOCK3_TOP_DACRDDATA_RESERVED_MASK 0xFFFFFC00
#define RF_INTERFACE_BLOCK3_TOP_DACRDDATA_GPDACRDDATA_SHIFT 0
#define RF_INTERFACE_BLOCK3_TOP_DACRDDATA_GPDACRDDATA_MASK 0x000003FF
#define RF_INTERFACE_BLOCK3_TOP_DACATCCTRL_OFFSET 0x00000010
#define RF_INTERFACE_BLOCK3_TOP_DACATCCTRL_TYPE UInt32
#define RF_INTERFACE_BLOCK3_TOP_DACATCCTRL_RESERVED_MASK 0xFF80FCCE
#define RF_INTERFACE_BLOCK3_TOP_DACATCCTRL_GPDACATCCYCLE_SHIFT 16
#define RF_INTERFACE_BLOCK3_TOP_DACATCCTRL_GPDACATCCYCLE_MASK 0x007F0000
#define RF_INTERFACE_BLOCK3_TOP_DACATCCTRL_GPDACATCUPDOWN_SHIFT 9
#define RF_INTERFACE_BLOCK3_TOP_DACATCCTRL_GPDACATCUPDOWN_MASK 0x00000200
#define RF_INTERFACE_BLOCK3_TOP_DACATCCTRL_GPDACATCUPDNSEL_SHIFT 8
#define RF_INTERFACE_BLOCK3_TOP_DACATCCTRL_GPDACATCUPDNSEL_MASK 0x00000100
#define RF_INTERFACE_BLOCK3_TOP_DACATCCTRL_GPDACATCSTROBE_SHIFT 5
#define RF_INTERFACE_BLOCK3_TOP_DACATCCTRL_GPDACATCSTROBE_MASK 0x00000020
#define RF_INTERFACE_BLOCK3_TOP_DACATCCTRL_GPDACATCSTBSEL_SHIFT 4
#define RF_INTERFACE_BLOCK3_TOP_DACATCCTRL_GPDACATCSTBSEL_MASK 0x00000010
#define RF_INTERFACE_BLOCK3_TOP_DACATCCTRL_GPDACATCMODE_SHIFT 0
#define RF_INTERFACE_BLOCK3_TOP_DACATCCTRL_GPDACATCMODE_MASK 0x00000001
#define RF_INTERFACE_BLOCK3_TOP_DACATCDATA0_OFFSET 0x00000014
#define RF_INTERFACE_BLOCK3_TOP_DACATCDATA0_TYPE UInt32
#define RF_INTERFACE_BLOCK3_TOP_DACATCDATA0_RESERVED_MASK 0xFFFFFC00
#define RF_INTERFACE_BLOCK3_TOP_DACATCDATA0_GPDACATCDATA0_SHIFT 0
#define RF_INTERFACE_BLOCK3_TOP_DACATCDATA0_GPDACATCDATA0_MASK 0x000003FF
#define RF_INTERFACE_BLOCK3_TOP_DACATCDATA1_OFFSET 0x00000018
#define RF_INTERFACE_BLOCK3_TOP_DACATCDATA1_TYPE UInt32
#define RF_INTERFACE_BLOCK3_TOP_DACATCDATA1_RESERVED_MASK 0xFFFFFC00
#define RF_INTERFACE_BLOCK3_TOP_DACATCDATA1_GPDACATCDATA1_SHIFT 0
#define RF_INTERFACE_BLOCK3_TOP_DACATCDATA1_GPDACATCDATA1_MASK 0x000003FF
#define RF_INTERFACE_BLOCK3_TOP_DACATCDATA2_OFFSET 0x0000001C
#define RF_INTERFACE_BLOCK3_TOP_DACATCDATA2_TYPE UInt32
#define RF_INTERFACE_BLOCK3_TOP_DACATCDATA2_RESERVED_MASK 0xFFFFFC00
#define RF_INTERFACE_BLOCK3_TOP_DACATCDATA2_GPDACATCDATA2_SHIFT 0
#define RF_INTERFACE_BLOCK3_TOP_DACATCDATA2_GPDACATCDATA2_MASK 0x000003FF
#define RF_INTERFACE_BLOCK3_TOP_DACATCDATA3_OFFSET 0x00000020
#define RF_INTERFACE_BLOCK3_TOP_DACATCDATA3_TYPE UInt32
#define RF_INTERFACE_BLOCK3_TOP_DACATCDATA3_RESERVED_MASK 0xFFFFFC00
#define RF_INTERFACE_BLOCK3_TOP_DACATCDATA3_GPDACATCDATA3_SHIFT 0
#define RF_INTERFACE_BLOCK3_TOP_DACATCDATA3_GPDACATCDATA3_MASK 0x000003FF
#define RF_INTERFACE_BLOCK3_TOP_DACATCDATA4_OFFSET 0x00000024
#define RF_INTERFACE_BLOCK3_TOP_DACATCDATA4_TYPE UInt32
#define RF_INTERFACE_BLOCK3_TOP_DACATCDATA4_RESERVED_MASK 0xFFFFFC00
#define RF_INTERFACE_BLOCK3_TOP_DACATCDATA4_GPDACATCDATA4_SHIFT 0
#define RF_INTERFACE_BLOCK3_TOP_DACATCDATA4_GPDACATCDATA4_MASK 0x000003FF
#define RF_INTERFACE_BLOCK3_TOP_DACATCDATA5_OFFSET 0x00000028
#define RF_INTERFACE_BLOCK3_TOP_DACATCDATA5_TYPE UInt32
#define RF_INTERFACE_BLOCK3_TOP_DACATCDATA5_RESERVED_MASK 0xFFFFFC00
#define RF_INTERFACE_BLOCK3_TOP_DACATCDATA5_GPDACATCDATA5_SHIFT 0
#define RF_INTERFACE_BLOCK3_TOP_DACATCDATA5_GPDACATCDATA5_MASK 0x000003FF
#define RF_INTERFACE_BLOCK3_TOP_DACATCSTATUS_OFFSET 0x0000002C
#define RF_INTERFACE_BLOCK3_TOP_DACATCSTATUS_TYPE UInt32
#define RF_INTERFACE_BLOCK3_TOP_DACATCSTATUS_RESERVED_MASK 0xFFFFFF8E
#define RF_INTERFACE_BLOCK3_TOP_DACATCSTATUS_GPDACATCDATANO_SHIFT 4
#define RF_INTERFACE_BLOCK3_TOP_DACATCSTATUS_GPDACATCDATANO_MASK 0x00000070
#define RF_INTERFACE_BLOCK3_TOP_DACATCSTATUS_GPDACATCDONE_SHIFT 0
#define RF_INTERFACE_BLOCK3_TOP_DACATCSTATUS_GPDACATCDONE_MASK 0x00000001
#endif /* __BRCM_RDB_RF_INTERFACE_BLOCK3_TOP_H__ */
| baran0119/kernel_samsung_baffinlitexx | arch/arm/mach-java/include/mach/rdb_A1/brcm_rdb_rf_interface_block3_top.h | C | gpl-2.0 | 8,712 |
/*
* CHRP pci routines.
*/
#include <linux/kernel.h>
#include <linux/pci.h>
#include <linux/delay.h>
#include <linux/string.h>
#include <linux/init.h>
#include <asm/io.h>
#include <asm/pgtable.h>
#include <asm/irq.h>
#include <asm/hydra.h>
#include <asm/prom.h>
#include <asm/machdep.h>
#include <asm/sections.h>
#include <asm/pci-bridge.h>
#include <asm/grackle.h>
#include <asm/rtas.h>
#include "chrp.h"
#include "gg2.h"
/* LongTrail */
void __iomem *gg2_pci_config_base;
/*
* The VLSI Golden Gate II has only 512K of PCI configuration space, so we
* limit the bus number to 3 bits
*/
int gg2_read_config(struct pci_bus *bus, unsigned int devfn, int off,
int len, u32 *val)
{
volatile void __iomem *cfg_data;
struct pci_controller *hose = pci_bus_to_host(bus);
if (bus->number > 7)
return PCIBIOS_DEVICE_NOT_FOUND;
/*
* Note: the caller has already checked that off is
* suitably aligned and that len is 1, 2 or 4.
*/
cfg_data = hose->cfg_data + ((bus->number<<16) | (devfn<<8) | off);
switch (len) {
case 1:
*val = in_8(cfg_data);
break;
case 2:
*val = in_le16(cfg_data);
break;
default:
*val = in_le32(cfg_data);
break;
}
return PCIBIOS_SUCCESSFUL;
}
int gg2_write_config(struct pci_bus *bus, unsigned int devfn, int off,
int len, u32 val)
{
volatile void __iomem *cfg_data;
struct pci_controller *hose = pci_bus_to_host(bus);
if (bus->number > 7)
return PCIBIOS_DEVICE_NOT_FOUND;
/*
* Note: the caller has already checked that off is
* suitably aligned and that len is 1, 2 or 4.
*/
cfg_data = hose->cfg_data + ((bus->number<<16) | (devfn<<8) | off);
switch (len) {
case 1:
out_8(cfg_data, val);
break;
case 2:
out_le16(cfg_data, val);
break;
default:
out_le32(cfg_data, val);
break;
}
return PCIBIOS_SUCCESSFUL;
}
static struct pci_ops gg2_pci_ops =
{
.read = gg2_read_config,
.write = gg2_write_config,
};
/*
* Access functions for PCI config space using RTAS calls.
*/
int rtas_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
int len, u32 *val)
{
struct pci_controller *hose = pci_bus_to_host(bus);
unsigned long addr = (offset & 0xff) | ((devfn & 0xff) << 8)
| (((bus->number - hose->first_busno) & 0xff) << 16)
| (hose->global_number << 24);
int ret = -1;
int rval;
rval = rtas_call(rtas_token("read-pci-config"), 2, 2, &ret, addr, len);
*val = ret;
return rval? PCIBIOS_DEVICE_NOT_FOUND: PCIBIOS_SUCCESSFUL;
}
int rtas_write_config(struct pci_bus *bus, unsigned int devfn, int offset,
int len, u32 val)
{
struct pci_controller *hose = pci_bus_to_host(bus);
unsigned long addr = (offset & 0xff) | ((devfn & 0xff) << 8)
| (((bus->number - hose->first_busno) & 0xff) << 16)
| (hose->global_number << 24);
int rval;
rval = rtas_call(rtas_token("write-pci-config"), 3, 1, NULL,
addr, len, val);
return rval? PCIBIOS_DEVICE_NOT_FOUND: PCIBIOS_SUCCESSFUL;
}
static struct pci_ops rtas_pci_ops =
{
.read = rtas_read_config,
.write = rtas_write_config,
};
volatile struct Hydra __iomem *Hydra = NULL;
int __init
hydra_init(void)
{
struct device_node *np;
struct resource r;
np = of_find_node_by_name(NULL, "mac-io");
if (np == NULL || of_address_to_resource(np, 0, &r)) {
of_node_put(np);
return 0;
}
of_node_put(np);
Hydra = ioremap(r.start, r.end-r.start);
printk("Hydra Mac I/O at %llx\n", (unsigned long long)r.start);
printk("Hydra Feature_Control was %x",
in_le32(&Hydra->Feature_Control));
out_le32(&Hydra->Feature_Control, (HYDRA_FC_SCC_CELL_EN |
HYDRA_FC_SCSI_CELL_EN |
HYDRA_FC_SCCA_ENABLE |
HYDRA_FC_SCCB_ENABLE |
HYDRA_FC_ARB_BYPASS |
HYDRA_FC_MPIC_ENABLE |
HYDRA_FC_SLOW_SCC_PCLK |
HYDRA_FC_MPIC_IS_MASTER));
printk(", now %x\n", in_le32(&Hydra->Feature_Control));
return 1;
}
#define PRG_CL_RESET_VALID 0x00010000
static void __init
setup_python(struct pci_controller *hose, struct device_node *dev)
{
u32 __iomem *reg;
u32 val;
struct resource r;
if (of_address_to_resource(dev, 0, &r)) {
printk(KERN_ERR "No address for Python PCI controller\n");
return;
}
/* Clear the magic go-slow bit */
reg = ioremap(r.start + 0xf6000, 0x40);
BUG_ON(!reg);
val = in_be32(®[12]);
if (val & PRG_CL_RESET_VALID) {
out_be32(®[12], val & ~PRG_CL_RESET_VALID);
in_be32(®[12]);
}
iounmap(reg);
setup_indirect_pci(hose, r.start + 0xf8000, r.start + 0xf8010, 0);
}
/* Marvell Discovery II based Pegasos 2 */
static void __init setup_peg2(struct pci_controller *hose, struct device_node *dev)
{
struct device_node *root = of_find_node_by_path("/");
struct device_node *rtas;
rtas = of_find_node_by_name (root, "rtas");
if (rtas) {
hose->ops = &rtas_pci_ops;
of_node_put(rtas);
} else {
printk ("RTAS supporting Pegasos OF not found, please upgrade"
" your firmware\n");
}
pci_add_flags(PCI_REASSIGN_ALL_BUS);
/* keep the reference to the root node */
}
void __init
chrp_find_bridges(void)
{
struct device_node *dev;
const int *bus_range;
int len, index = -1;
struct pci_controller *hose;
const unsigned int *dma;
const char *model, *machine;
int is_longtrail = 0, is_mot = 0, is_pegasos = 0;
struct device_node *root = of_find_node_by_path("/");
struct resource r;
/*
* The PCI host bridge nodes on some machines don't have
* properties to adequately identify them, so we have to
* look at what sort of machine this is as well.
*/
machine = of_get_property(root, "model", NULL);
if (machine != NULL) {
is_longtrail = strncmp(machine, "IBM,LongTrail", 13) == 0;
is_mot = strncmp(machine, "MOT", 3) == 0;
if (strncmp(machine, "Pegasos2", 8) == 0)
is_pegasos = 2;
else if (strncmp(machine, "Pegasos", 7) == 0)
is_pegasos = 1;
}
for (dev = root->child; dev != NULL; dev = dev->sibling) {
if (dev->type == NULL || strcmp(dev->type, "pci") != 0)
continue;
++index;
/* The GG2 bridge on the LongTrail doesn't have an address */
if (of_address_to_resource(dev, 0, &r) && !is_longtrail) {
printk(KERN_WARNING "Can't use %s: no address\n",
dev->full_name);
continue;
}
bus_range = of_get_property(dev, "bus-range", &len);
if (bus_range == NULL || len < 2 * sizeof(int)) {
printk(KERN_WARNING "Can't get bus-range for %s\n",
dev->full_name);
continue;
}
if (bus_range[1] == bus_range[0])
printk(KERN_INFO "PCI bus %d", bus_range[0]);
else
printk(KERN_INFO "PCI buses %d..%d",
bus_range[0], bus_range[1]);
printk(" controlled by %s", dev->full_name);
if (!is_longtrail)
printk(" at %llx", (unsigned long long)r.start);
printk("\n");
hose = pcibios_alloc_controller(dev);
if (!hose) {
printk("Can't allocate PCI controller structure for %s\n",
dev->full_name);
continue;
}
hose->first_busno = hose->self_busno = bus_range[0];
hose->last_busno = bus_range[1];
model = of_get_property(dev, "model", NULL);
if (model == NULL)
model = "<none>";
if (strncmp(model, "IBM, Python", 11) == 0) {
setup_python(hose, dev);
} else if (is_mot
|| strncmp(model, "Motorola, Grackle", 17) == 0) {
setup_grackle(hose);
} else if (is_longtrail) {
void __iomem *p = ioremap(GG2_PCI_CONFIG_BASE, 0x80000);
hose->ops = &gg2_pci_ops;
hose->cfg_data = p;
gg2_pci_config_base = p;
} else if (is_pegasos == 1) {
setup_indirect_pci(hose, 0xfec00cf8, 0xfee00cfc, 0);
} else if (is_pegasos == 2) {
setup_peg2(hose, dev);
} else if (!strncmp(model, "IBM,CPC710", 10)) {
setup_indirect_pci(hose,
r.start + 0x000f8000,
r.start + 0x000f8010,
0);
if (index == 0) {
dma = of_get_property(dev, "system-dma-base",
&len);
if (dma && len >= sizeof(*dma)) {
dma = (unsigned int *)
(((unsigned long)dma) +
len - sizeof(*dma));
pci_dram_offset = *dma;
}
}
} else {
printk("No methods for %s (model %s), using RTAS\n",
dev->full_name, model);
hose->ops = &rtas_pci_ops;
}
pci_process_bridge_OF_ranges(hose, dev, index == 0);
/* check the first bridge for a property that we can
use to set pci_dram_offset */
dma = of_get_property(dev, "ibm,dma-ranges", &len);
if (index == 0 && dma != NULL && len >= 6 * sizeof(*dma)) {
pci_dram_offset = dma[2] - dma[3];
printk("pci_dram_offset = %lx\n", pci_dram_offset);
}
}
of_node_put(root);
}
/* SL82C105 IDE Control/Status Register */
#define SL82C105_IDECSR 0x40
/* Fixup for Winbond ATA quirk, required for briq mostly because the
* 8259 is configured for level sensitive IRQ 14 and so wants the
* ATA controller to be set to fully native mode or bad things
* will happen.
*/
static void __devinit chrp_pci_fixup_winbond_ata(struct pci_dev *sl82c105)
{
u8 progif;
/* If non-briq machines need that fixup too, please speak up */
if (!machine_is(chrp) || _chrp_type != _CHRP_briq)
return;
if ((sl82c105->class & 5) != 5) {
printk("W83C553: Switching SL82C105 IDE to PCI native mode\n");
/* Enable SL82C105 PCI native IDE mode */
pci_read_config_byte(sl82c105, PCI_CLASS_PROG, &progif);
pci_write_config_byte(sl82c105, PCI_CLASS_PROG, progif | 0x05);
sl82c105->class |= 0x05;
/* Disable SL82C105 second port */
pci_write_config_word(sl82c105, SL82C105_IDECSR, 0x0003);
/* Clear IO BARs, they will be reassigned */
pci_write_config_dword(sl82c105, PCI_BASE_ADDRESS_0, 0);
pci_write_config_dword(sl82c105, PCI_BASE_ADDRESS_1, 0);
pci_write_config_dword(sl82c105, PCI_BASE_ADDRESS_2, 0);
pci_write_config_dword(sl82c105, PCI_BASE_ADDRESS_3, 0);
}
}
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105,
chrp_pci_fixup_winbond_ata);
/* Pegasos2 firmware version 20040810 configures the built-in IDE controller
* in legacy mode, but sets the PCI registers to PCI native mode.
* The chip can only operate in legacy mode, so force the PCI class into legacy
* mode as well. The same fixup must be done to the class-code property in
* the IDE node /pci@80000000/ide@C,1
*/
static void chrp_pci_fixup_vt8231_ata(struct pci_dev *viaide)
{
u8 progif;
struct pci_dev *viaisa;
if (!machine_is(chrp) || _chrp_type != _CHRP_Pegasos)
return;
if (viaide->irq != 14)
return;
viaisa = pci_get_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8231, NULL);
if (!viaisa)
return;
dev_info(&viaide->dev, "Fixing VIA IDE, force legacy mode on\n");
pci_read_config_byte(viaide, PCI_CLASS_PROG, &progif);
pci_write_config_byte(viaide, PCI_CLASS_PROG, progif & ~0x5);
viaide->class &= ~0x5;
pci_dev_put(viaisa);
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, chrp_pci_fixup_vt8231_ata);
| augustayu/fastsocket | kernel/arch/powerpc/platforms/chrp/pci.c | C | gpl-2.0 | 10,671 |
/*
* ff.h - a part of driver for RME Fireface series
*
* Copyright (c) 2015-2017 Takashi Sakamoto
*
* Licensed under the terms of the GNU General Public License, version 2.
*/
#ifndef SOUND_FIREFACE_H_INCLUDED
#define SOUND_FIREFACE_H_INCLUDED
#include <linux/device.h>
#include <linux/firewire.h>
#include <linux/firewire-constants.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/mutex.h>
#include <linux/slab.h>
#include <linux/compat.h>
#include <linux/sched/signal.h>
#include <sound/core.h>
#include <sound/info.h>
#include <sound/rawmidi.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/hwdep.h>
#include <sound/firewire.h>
#include "../lib.h"
#include "../amdtp-stream.h"
#include "../iso-resources.h"
#define SND_FF_MAXIMIM_MIDI_QUADS 9
#define SND_FF_IN_MIDI_PORTS 2
#define SND_FF_OUT_MIDI_PORTS 2
#define SND_FF_REG_SYNC_STATUS 0x0000801c0000ull
/* For block write request. */
#define SND_FF_REG_FETCH_PCM_FRAMES 0x0000801c0000ull
#define SND_FF_REG_CLOCK_CONFIG 0x0000801c0004ull
enum snd_ff_stream_mode {
SND_FF_STREAM_MODE_LOW = 0,
SND_FF_STREAM_MODE_MID,
SND_FF_STREAM_MODE_HIGH,
SND_FF_STREAM_MODE_COUNT,
};
struct snd_ff_protocol;
struct snd_ff_spec {
const char *const name;
const unsigned int pcm_capture_channels[SND_FF_STREAM_MODE_COUNT];
const unsigned int pcm_playback_channels[SND_FF_STREAM_MODE_COUNT];
unsigned int midi_in_ports;
unsigned int midi_out_ports;
const struct snd_ff_protocol *protocol;
u64 midi_high_addr;
};
struct snd_ff {
struct snd_card *card;
struct fw_unit *unit;
struct mutex mutex;
spinlock_t lock;
bool registered;
struct delayed_work dwork;
const struct snd_ff_spec *spec;
/* To handle MIDI tx. */
struct snd_rawmidi_substream *tx_midi_substreams[SND_FF_IN_MIDI_PORTS];
struct fw_address_handler async_handler;
/* TO handle MIDI rx. */
struct snd_rawmidi_substream *rx_midi_substreams[SND_FF_OUT_MIDI_PORTS];
u8 running_status[SND_FF_OUT_MIDI_PORTS];
__le32 msg_buf[SND_FF_OUT_MIDI_PORTS][SND_FF_MAXIMIM_MIDI_QUADS];
struct work_struct rx_midi_work[SND_FF_OUT_MIDI_PORTS];
struct fw_transaction transactions[SND_FF_OUT_MIDI_PORTS];
ktime_t next_ktime[SND_FF_OUT_MIDI_PORTS];
bool rx_midi_error[SND_FF_OUT_MIDI_PORTS];
unsigned int rx_bytes[SND_FF_OUT_MIDI_PORTS];
unsigned int substreams_counter;
struct amdtp_stream tx_stream;
struct amdtp_stream rx_stream;
struct fw_iso_resources tx_resources;
struct fw_iso_resources rx_resources;
int dev_lock_count;
bool dev_lock_changed;
wait_queue_head_t hwdep_wait;
};
enum snd_ff_clock_src {
SND_FF_CLOCK_SRC_INTERNAL,
SND_FF_CLOCK_SRC_SPDIF,
SND_FF_CLOCK_SRC_ADAT1,
SND_FF_CLOCK_SRC_ADAT2,
SND_FF_CLOCK_SRC_WORD,
SND_FF_CLOCK_SRC_LTC,
/* TODO: perhaps TCO exists. */
};
struct snd_ff_protocol {
void (*handle_midi_msg)(struct snd_ff *ff, __le32 *buf, size_t length);
int (*begin_session)(struct snd_ff *ff, unsigned int rate);
void (*finish_session)(struct snd_ff *ff);
};
extern const struct snd_ff_protocol snd_ff_protocol_ff800;
extern const struct snd_ff_protocol snd_ff_protocol_ff400;
int snd_ff_transaction_get_clock(struct snd_ff *ff, unsigned int *rate,
enum snd_ff_clock_src *src);
int snd_ff_transaction_register(struct snd_ff *ff);
int snd_ff_transaction_reregister(struct snd_ff *ff);
void snd_ff_transaction_unregister(struct snd_ff *ff);
int amdtp_ff_set_parameters(struct amdtp_stream *s, unsigned int rate,
unsigned int pcm_channels);
int amdtp_ff_add_pcm_hw_constraints(struct amdtp_stream *s,
struct snd_pcm_runtime *runtime);
int amdtp_ff_init(struct amdtp_stream *s, struct fw_unit *unit,
enum amdtp_stream_direction dir);
int snd_ff_stream_get_multiplier_mode(enum cip_sfc sfc,
enum snd_ff_stream_mode *mode);
int snd_ff_stream_init_duplex(struct snd_ff *ff);
void snd_ff_stream_destroy_duplex(struct snd_ff *ff);
int snd_ff_stream_start_duplex(struct snd_ff *ff, unsigned int rate);
void snd_ff_stream_stop_duplex(struct snd_ff *ff);
void snd_ff_stream_update_duplex(struct snd_ff *ff);
void snd_ff_stream_lock_changed(struct snd_ff *ff);
int snd_ff_stream_lock_try(struct snd_ff *ff);
void snd_ff_stream_lock_release(struct snd_ff *ff);
void snd_ff_proc_init(struct snd_ff *ff);
int snd_ff_create_midi_devices(struct snd_ff *ff);
int snd_ff_create_pcm_devices(struct snd_ff *ff);
int snd_ff_create_hwdep_devices(struct snd_ff *ff);
#endif
| qzhuyan/linux | sound/firewire/fireface/ff.h | C | gpl-2.0 | 4,433 |
/*
* Implementation of the userspace SID hashtable.
*
* Author : Eamon Walsh, <ewalsh@epoch.ncsc.mil>
*/
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include "selinux_internal.h"
#include <selinux/avc.h>
#include "avc_sidtab.h"
#include "avc_internal.h"
static inline unsigned sidtab_hash(const char * key)
{
char *p, *keyp;
unsigned int size;
unsigned int val;
val = 0;
keyp = (char *)key;
size = strlen(keyp);
for (p = keyp; (unsigned int)(p - keyp) < size; p++)
val =
(val << 4 | (val >> (8 * sizeof(unsigned int) - 4))) ^ (*p);
return val & (SIDTAB_SIZE - 1);
}
int sidtab_init(struct sidtab *s)
{
int i, rc = 0;
s->htable = (struct sidtab_node **)avc_malloc
(sizeof(struct sidtab_node *) * SIDTAB_SIZE);
if (!s->htable) {
rc = -1;
goto out;
}
for (i = 0; i < SIDTAB_SIZE; i++)
s->htable[i] = NULL;
s->nel = 0;
out:
return rc;
}
int sidtab_insert(struct sidtab *s, const char * ctx)
{
int hvalue, rc = 0;
struct sidtab_node *newnode;
char * newctx;
newnode = (struct sidtab_node *)avc_malloc(sizeof(*newnode));
if (!newnode) {
rc = -1;
goto out;
}
newctx = (char *) strdup(ctx);
if (!newctx) {
rc = -1;
avc_free(newnode);
goto out;
}
hvalue = sidtab_hash(newctx);
newnode->next = s->htable[hvalue];
newnode->sid_s.ctx = newctx;
newnode->sid_s.refcnt = 1; /* unused */
s->htable[hvalue] = newnode;
s->nel++;
out:
return rc;
}
int
sidtab_context_to_sid(struct sidtab *s,
const char * ctx, security_id_t * sid)
{
int hvalue, rc = 0;
struct sidtab_node *cur;
*sid = NULL;
hvalue = sidtab_hash(ctx);
loop:
cur = s->htable[hvalue];
while (cur != NULL && strcmp(cur->sid_s.ctx, ctx))
cur = cur->next;
if (cur == NULL) { /* need to make a new entry */
rc = sidtab_insert(s, ctx);
if (rc)
goto out;
goto loop; /* find the newly inserted node */
}
*sid = &cur->sid_s;
out:
return rc;
}
void sidtab_sid_stats(struct sidtab *h, char *buf, int buflen)
{
int i, chain_len, slots_used, max_chain_len;
struct sidtab_node *cur;
slots_used = 0;
max_chain_len = 0;
for (i = 0; i < SIDTAB_SIZE; i++) {
cur = h->htable[i];
if (cur) {
slots_used++;
chain_len = 0;
while (cur) {
chain_len++;
cur = cur->next;
}
if (chain_len > max_chain_len)
max_chain_len = chain_len;
}
}
snprintf(buf, buflen,
"%s: %d SID entries and %d/%d buckets used, longest "
"chain length %d\n", avc_prefix, h->nel, slots_used,
SIDTAB_SIZE, max_chain_len);
}
void sidtab_destroy(struct sidtab *s)
{
int i;
struct sidtab_node *cur, *temp;
if (!s)
return;
for (i = 0; i < SIDTAB_SIZE; i++) {
cur = s->htable[i];
while (cur != NULL) {
temp = cur;
cur = cur->next;
freecon(temp->sid_s.ctx);
avc_free(temp);
}
s->htable[i] = NULL;
}
avc_free(s->htable);
s->htable = NULL;
}
| KubaKaszycki/kubux | libselinux/src/avc_sidtab.c | C | gpl-3.0 | 2,894 |
/*
* jsimd_i386.c
*
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
* Copyright 2009-2011, 2013-2014 D. R. Commander
*
* Based on the x86 SIMD extension for IJG JPEG library,
* Copyright (C) 1999-2006, MIYASAKA Masaru.
* For conditions of distribution and use, see copyright notice in jsimdext.inc
*
* This file contains the interface between the "normal" portions
* of the library and the SIMD implementations when running on a
* 32-bit x86 architecture.
*/
#define JPEG_INTERNALS
#include "../jinclude.h"
#include "../jpeglib.h"
#include "../jsimd.h"
#include "../jdct.h"
#include "../jsimddct.h"
#include "jsimd.h"
/*
* In the PIC cases, we have no guarantee that constants will keep
* their alignment. This macro allows us to verify it at runtime.
*/
#define IS_ALIGNED(ptr, order) (((unsigned)ptr & ((1 << order) - 1)) == 0)
#define IS_ALIGNED_SSE(ptr) (IS_ALIGNED(ptr, 4)) /* 16 byte alignment */
static unsigned int simd_support = ~0;
/*
* Check what SIMD accelerations are supported.
*
* FIXME: This code is racy under a multi-threaded environment.
*/
LOCAL(void)
init_simd (void)
{
char *env = NULL;
if (simd_support != ~0U)
return;
simd_support = jpeg_simd_cpu_support();
/* Force different settings through environment variables */
env = getenv("JSIMD_FORCEMMX");
if ((env != NULL) && (strcmp(env, "1") == 0))
simd_support &= JSIMD_MMX;
env = getenv("JSIMD_FORCE3DNOW");
if ((env != NULL) && (strcmp(env, "1") == 0))
simd_support &= JSIMD_3DNOW|JSIMD_MMX;
env = getenv("JSIMD_FORCESSE");
if ((env != NULL) && (strcmp(env, "1") == 0))
simd_support &= JSIMD_SSE|JSIMD_MMX;
env = getenv("JSIMD_FORCESSE2");
if ((env != NULL) && (strcmp(env, "1") == 0))
simd_support &= JSIMD_SSE2;
env = getenv("JSIMD_FORCENONE");
if ((env != NULL) && (strcmp(env, "1") == 0))
simd_support = 0;
}
GLOBAL(int)
jsimd_can_rgb_ycc (void)
{
init_simd();
/* The code is optimised for these values only */
if (BITS_IN_JSAMPLE != 8)
return 0;
if (sizeof(JDIMENSION) != 4)
return 0;
if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
return 0;
if ((simd_support & JSIMD_SSE2) &&
IS_ALIGNED_SSE(jconst_rgb_ycc_convert_sse2))
return 1;
if (simd_support & JSIMD_MMX)
return 1;
return 0;
}
GLOBAL(int)
jsimd_can_rgb_gray (void)
{
init_simd();
/* The code is optimised for these values only */
if (BITS_IN_JSAMPLE != 8)
return 0;
if (sizeof(JDIMENSION) != 4)
return 0;
if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
return 0;
if ((simd_support & JSIMD_SSE2) &&
IS_ALIGNED_SSE(jconst_rgb_gray_convert_sse2))
return 1;
if (simd_support & JSIMD_MMX)
return 1;
return 0;
}
GLOBAL(int)
jsimd_can_ycc_rgb (void)
{
init_simd();
/* The code is optimised for these values only */
if (BITS_IN_JSAMPLE != 8)
return 0;
if (sizeof(JDIMENSION) != 4)
return 0;
if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
return 0;
if ((simd_support & JSIMD_SSE2) &&
IS_ALIGNED_SSE(jconst_ycc_rgb_convert_sse2))
return 1;
if (simd_support & JSIMD_MMX)
return 1;
return 0;
}
GLOBAL(int)
jsimd_can_ycc_rgb565 (void)
{
return 0;
}
GLOBAL(void)
jsimd_rgb_ycc_convert (j_compress_ptr cinfo,
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
JDIMENSION output_row, int num_rows)
{
void (*sse2fct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
void (*mmxfct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
switch(cinfo->in_color_space) {
case JCS_EXT_RGB:
sse2fct=jsimd_extrgb_ycc_convert_sse2;
mmxfct=jsimd_extrgb_ycc_convert_mmx;
break;
case JCS_EXT_RGBX:
case JCS_EXT_RGBA:
sse2fct=jsimd_extrgbx_ycc_convert_sse2;
mmxfct=jsimd_extrgbx_ycc_convert_mmx;
break;
case JCS_EXT_BGR:
sse2fct=jsimd_extbgr_ycc_convert_sse2;
mmxfct=jsimd_extbgr_ycc_convert_mmx;
break;
case JCS_EXT_BGRX:
case JCS_EXT_BGRA:
sse2fct=jsimd_extbgrx_ycc_convert_sse2;
mmxfct=jsimd_extbgrx_ycc_convert_mmx;
break;
case JCS_EXT_XBGR:
case JCS_EXT_ABGR:
sse2fct=jsimd_extxbgr_ycc_convert_sse2;
mmxfct=jsimd_extxbgr_ycc_convert_mmx;
break;
case JCS_EXT_XRGB:
case JCS_EXT_ARGB:
sse2fct=jsimd_extxrgb_ycc_convert_sse2;
mmxfct=jsimd_extxrgb_ycc_convert_mmx;
break;
default:
sse2fct=jsimd_rgb_ycc_convert_sse2;
mmxfct=jsimd_rgb_ycc_convert_mmx;
break;
}
if ((simd_support & JSIMD_SSE2) &&
IS_ALIGNED_SSE(jconst_rgb_ycc_convert_sse2))
sse2fct(cinfo->image_width, input_buf, output_buf, output_row, num_rows);
else if (simd_support & JSIMD_MMX)
mmxfct(cinfo->image_width, input_buf, output_buf, output_row, num_rows);
}
GLOBAL(void)
jsimd_rgb_gray_convert (j_compress_ptr cinfo,
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
JDIMENSION output_row, int num_rows)
{
void (*sse2fct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
void (*mmxfct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
switch(cinfo->in_color_space) {
case JCS_EXT_RGB:
sse2fct=jsimd_extrgb_gray_convert_sse2;
mmxfct=jsimd_extrgb_gray_convert_mmx;
break;
case JCS_EXT_RGBX:
case JCS_EXT_RGBA:
sse2fct=jsimd_extrgbx_gray_convert_sse2;
mmxfct=jsimd_extrgbx_gray_convert_mmx;
break;
case JCS_EXT_BGR:
sse2fct=jsimd_extbgr_gray_convert_sse2;
mmxfct=jsimd_extbgr_gray_convert_mmx;
break;
case JCS_EXT_BGRX:
case JCS_EXT_BGRA:
sse2fct=jsimd_extbgrx_gray_convert_sse2;
mmxfct=jsimd_extbgrx_gray_convert_mmx;
break;
case JCS_EXT_XBGR:
case JCS_EXT_ABGR:
sse2fct=jsimd_extxbgr_gray_convert_sse2;
mmxfct=jsimd_extxbgr_gray_convert_mmx;
break;
case JCS_EXT_XRGB:
case JCS_EXT_ARGB:
sse2fct=jsimd_extxrgb_gray_convert_sse2;
mmxfct=jsimd_extxrgb_gray_convert_mmx;
break;
default:
sse2fct=jsimd_rgb_gray_convert_sse2;
mmxfct=jsimd_rgb_gray_convert_mmx;
break;
}
if ((simd_support & JSIMD_SSE2) &&
IS_ALIGNED_SSE(jconst_rgb_gray_convert_sse2))
sse2fct(cinfo->image_width, input_buf, output_buf, output_row, num_rows);
else if (simd_support & JSIMD_MMX)
mmxfct(cinfo->image_width, input_buf, output_buf, output_row, num_rows);
}
GLOBAL(void)
jsimd_ycc_rgb_convert (j_decompress_ptr cinfo,
JSAMPIMAGE input_buf, JDIMENSION input_row,
JSAMPARRAY output_buf, int num_rows)
{
void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int);
void (*mmxfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int);
switch(cinfo->out_color_space) {
case JCS_EXT_RGB:
sse2fct=jsimd_ycc_extrgb_convert_sse2;
mmxfct=jsimd_ycc_extrgb_convert_mmx;
break;
case JCS_EXT_RGBX:
case JCS_EXT_RGBA:
sse2fct=jsimd_ycc_extrgbx_convert_sse2;
mmxfct=jsimd_ycc_extrgbx_convert_mmx;
break;
case JCS_EXT_BGR:
sse2fct=jsimd_ycc_extbgr_convert_sse2;
mmxfct=jsimd_ycc_extbgr_convert_mmx;
break;
case JCS_EXT_BGRX:
case JCS_EXT_BGRA:
sse2fct=jsimd_ycc_extbgrx_convert_sse2;
mmxfct=jsimd_ycc_extbgrx_convert_mmx;
break;
case JCS_EXT_XBGR:
case JCS_EXT_ABGR:
sse2fct=jsimd_ycc_extxbgr_convert_sse2;
mmxfct=jsimd_ycc_extxbgr_convert_mmx;
break;
case JCS_EXT_XRGB:
case JCS_EXT_ARGB:
sse2fct=jsimd_ycc_extxrgb_convert_sse2;
mmxfct=jsimd_ycc_extxrgb_convert_mmx;
break;
default:
sse2fct=jsimd_ycc_rgb_convert_sse2;
mmxfct=jsimd_ycc_rgb_convert_mmx;
break;
}
if ((simd_support & JSIMD_SSE2) &&
IS_ALIGNED_SSE(jconst_ycc_rgb_convert_sse2))
sse2fct(cinfo->output_width, input_buf, input_row, output_buf, num_rows);
else if (simd_support & JSIMD_MMX)
mmxfct(cinfo->output_width, input_buf, input_row, output_buf, num_rows);
}
GLOBAL(void)
jsimd_ycc_rgb565_convert (j_decompress_ptr cinfo,
JSAMPIMAGE input_buf, JDIMENSION input_row,
JSAMPARRAY output_buf, int num_rows)
{
}
GLOBAL(int)
jsimd_can_h2v2_downsample (void)
{
init_simd();
/* The code is optimised for these values only */
if (BITS_IN_JSAMPLE != 8)
return 0;
if (sizeof(JDIMENSION) != 4)
return 0;
if (simd_support & JSIMD_SSE2)
return 1;
if (simd_support & JSIMD_MMX)
return 1;
return 0;
}
GLOBAL(int)
jsimd_can_h2v1_downsample (void)
{
init_simd();
/* The code is optimised for these values only */
if (BITS_IN_JSAMPLE != 8)
return 0;
if (sizeof(JDIMENSION) != 4)
return 0;
if (simd_support & JSIMD_SSE2)
return 1;
if (simd_support & JSIMD_MMX)
return 1;
return 0;
}
GLOBAL(void)
jsimd_h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
JSAMPARRAY input_data, JSAMPARRAY output_data)
{
if (simd_support & JSIMD_SSE2)
jsimd_h2v2_downsample_sse2(cinfo->image_width, cinfo->max_v_samp_factor,
compptr->v_samp_factor,
compptr->width_in_blocks, input_data,
output_data);
else if (simd_support & JSIMD_MMX)
jsimd_h2v2_downsample_mmx(cinfo->image_width, cinfo->max_v_samp_factor,
compptr->v_samp_factor, compptr->width_in_blocks,
input_data, output_data);
}
GLOBAL(void)
jsimd_h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
JSAMPARRAY input_data, JSAMPARRAY output_data)
{
if (simd_support & JSIMD_SSE2)
jsimd_h2v1_downsample_sse2(cinfo->image_width, cinfo->max_v_samp_factor,
compptr->v_samp_factor,
compptr->width_in_blocks, input_data,
output_data);
else if (simd_support & JSIMD_MMX)
jsimd_h2v1_downsample_mmx(cinfo->image_width, cinfo->max_v_samp_factor,
compptr->v_samp_factor, compptr->width_in_blocks,
input_data, output_data);
}
GLOBAL(int)
jsimd_can_h2v2_upsample (void)
{
init_simd();
/* The code is optimised for these values only */
if (BITS_IN_JSAMPLE != 8)
return 0;
if (sizeof(JDIMENSION) != 4)
return 0;
if (simd_support & JSIMD_SSE2)
return 1;
if (simd_support & JSIMD_MMX)
return 1;
return 0;
}
GLOBAL(int)
jsimd_can_h2v1_upsample (void)
{
init_simd();
/* The code is optimised for these values only */
if (BITS_IN_JSAMPLE != 8)
return 0;
if (sizeof(JDIMENSION) != 4)
return 0;
if (simd_support & JSIMD_SSE2)
return 1;
if (simd_support & JSIMD_MMX)
return 1;
return 0;
}
GLOBAL(void)
jsimd_h2v2_upsample (j_decompress_ptr cinfo,
jpeg_component_info * compptr,
JSAMPARRAY input_data,
JSAMPARRAY * output_data_ptr)
{
if (simd_support & JSIMD_SSE2)
jsimd_h2v2_upsample_sse2(cinfo->max_v_samp_factor, cinfo->output_width,
input_data, output_data_ptr);
else if (simd_support & JSIMD_MMX)
jsimd_h2v2_upsample_mmx(cinfo->max_v_samp_factor, cinfo->output_width,
input_data, output_data_ptr);
}
GLOBAL(void)
jsimd_h2v1_upsample (j_decompress_ptr cinfo,
jpeg_component_info * compptr,
JSAMPARRAY input_data,
JSAMPARRAY * output_data_ptr)
{
if (simd_support & JSIMD_SSE2)
jsimd_h2v1_upsample_sse2(cinfo->max_v_samp_factor, cinfo->output_width,
input_data, output_data_ptr);
else if (simd_support & JSIMD_MMX)
jsimd_h2v1_upsample_mmx(cinfo->max_v_samp_factor, cinfo->output_width,
input_data, output_data_ptr);
}
GLOBAL(int)
jsimd_can_h2v2_fancy_upsample (void)
{
init_simd();
/* The code is optimised for these values only */
if (BITS_IN_JSAMPLE != 8)
return 0;
if (sizeof(JDIMENSION) != 4)
return 0;
if ((simd_support & JSIMD_SSE2) &&
IS_ALIGNED_SSE(jconst_fancy_upsample_sse2))
return 1;
if (simd_support & JSIMD_MMX)
return 1;
return 0;
}
GLOBAL(int)
jsimd_can_h2v1_fancy_upsample (void)
{
init_simd();
/* The code is optimised for these values only */
if (BITS_IN_JSAMPLE != 8)
return 0;
if (sizeof(JDIMENSION) != 4)
return 0;
if ((simd_support & JSIMD_SSE2) &&
IS_ALIGNED_SSE(jconst_fancy_upsample_sse2))
return 1;
if (simd_support & JSIMD_MMX)
return 1;
return 0;
}
GLOBAL(void)
jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo,
jpeg_component_info * compptr,
JSAMPARRAY input_data,
JSAMPARRAY * output_data_ptr)
{
if ((simd_support & JSIMD_SSE2) &&
IS_ALIGNED_SSE(jconst_fancy_upsample_sse2))
jsimd_h2v2_fancy_upsample_sse2(cinfo->max_v_samp_factor,
compptr->downsampled_width, input_data,
output_data_ptr);
else if (simd_support & JSIMD_MMX)
jsimd_h2v2_fancy_upsample_mmx(cinfo->max_v_samp_factor,
compptr->downsampled_width, input_data,
output_data_ptr);
}
GLOBAL(void)
jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo,
jpeg_component_info * compptr,
JSAMPARRAY input_data,
JSAMPARRAY * output_data_ptr)
{
if ((simd_support & JSIMD_SSE2) &&
IS_ALIGNED_SSE(jconst_fancy_upsample_sse2))
jsimd_h2v1_fancy_upsample_sse2(cinfo->max_v_samp_factor,
compptr->downsampled_width, input_data,
output_data_ptr);
else if (simd_support & JSIMD_MMX)
jsimd_h2v1_fancy_upsample_mmx(cinfo->max_v_samp_factor,
compptr->downsampled_width, input_data,
output_data_ptr);
}
GLOBAL(int)
jsimd_can_h2v2_merged_upsample (void)
{
init_simd();
/* The code is optimised for these values only */
if (BITS_IN_JSAMPLE != 8)
return 0;
if (sizeof(JDIMENSION) != 4)
return 0;
if ((simd_support & JSIMD_SSE2) &&
IS_ALIGNED_SSE(jconst_merged_upsample_sse2))
return 1;
if (simd_support & JSIMD_MMX)
return 1;
return 0;
}
GLOBAL(int)
jsimd_can_h2v1_merged_upsample (void)
{
init_simd();
/* The code is optimised for these values only */
if (BITS_IN_JSAMPLE != 8)
return 0;
if (sizeof(JDIMENSION) != 4)
return 0;
if ((simd_support & JSIMD_SSE2) &&
IS_ALIGNED_SSE(jconst_merged_upsample_sse2))
return 1;
if (simd_support & JSIMD_MMX)
return 1;
return 0;
}
GLOBAL(void)
jsimd_h2v2_merged_upsample (j_decompress_ptr cinfo,
JSAMPIMAGE input_buf,
JDIMENSION in_row_group_ctr,
JSAMPARRAY output_buf)
{
void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY);
void (*mmxfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY);
switch(cinfo->out_color_space) {
case JCS_EXT_RGB:
sse2fct=jsimd_h2v2_extrgb_merged_upsample_sse2;
mmxfct=jsimd_h2v2_extrgb_merged_upsample_mmx;
break;
case JCS_EXT_RGBX:
case JCS_EXT_RGBA:
sse2fct=jsimd_h2v2_extrgbx_merged_upsample_sse2;
mmxfct=jsimd_h2v2_extrgbx_merged_upsample_mmx;
break;
case JCS_EXT_BGR:
sse2fct=jsimd_h2v2_extbgr_merged_upsample_sse2;
mmxfct=jsimd_h2v2_extbgr_merged_upsample_mmx;
break;
case JCS_EXT_BGRX:
case JCS_EXT_BGRA:
sse2fct=jsimd_h2v2_extbgrx_merged_upsample_sse2;
mmxfct=jsimd_h2v2_extbgrx_merged_upsample_mmx;
break;
case JCS_EXT_XBGR:
case JCS_EXT_ABGR:
sse2fct=jsimd_h2v2_extxbgr_merged_upsample_sse2;
mmxfct=jsimd_h2v2_extxbgr_merged_upsample_mmx;
break;
case JCS_EXT_XRGB:
case JCS_EXT_ARGB:
sse2fct=jsimd_h2v2_extxrgb_merged_upsample_sse2;
mmxfct=jsimd_h2v2_extxrgb_merged_upsample_mmx;
break;
default:
sse2fct=jsimd_h2v2_merged_upsample_sse2;
mmxfct=jsimd_h2v2_merged_upsample_mmx;
break;
}
if ((simd_support & JSIMD_SSE2) &&
IS_ALIGNED_SSE(jconst_merged_upsample_sse2))
sse2fct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf);
else if (simd_support & JSIMD_MMX)
mmxfct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf);
}
GLOBAL(void)
jsimd_h2v1_merged_upsample (j_decompress_ptr cinfo,
JSAMPIMAGE input_buf,
JDIMENSION in_row_group_ctr,
JSAMPARRAY output_buf)
{
void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY);
void (*mmxfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY);
switch(cinfo->out_color_space) {
case JCS_EXT_RGB:
sse2fct=jsimd_h2v1_extrgb_merged_upsample_sse2;
mmxfct=jsimd_h2v1_extrgb_merged_upsample_mmx;
break;
case JCS_EXT_RGBX:
case JCS_EXT_RGBA:
sse2fct=jsimd_h2v1_extrgbx_merged_upsample_sse2;
mmxfct=jsimd_h2v1_extrgbx_merged_upsample_mmx;
break;
case JCS_EXT_BGR:
sse2fct=jsimd_h2v1_extbgr_merged_upsample_sse2;
mmxfct=jsimd_h2v1_extbgr_merged_upsample_mmx;
break;
case JCS_EXT_BGRX:
case JCS_EXT_BGRA:
sse2fct=jsimd_h2v1_extbgrx_merged_upsample_sse2;
mmxfct=jsimd_h2v1_extbgrx_merged_upsample_mmx;
break;
case JCS_EXT_XBGR:
case JCS_EXT_ABGR:
sse2fct=jsimd_h2v1_extxbgr_merged_upsample_sse2;
mmxfct=jsimd_h2v1_extxbgr_merged_upsample_mmx;
break;
case JCS_EXT_XRGB:
case JCS_EXT_ARGB:
sse2fct=jsimd_h2v1_extxrgb_merged_upsample_sse2;
mmxfct=jsimd_h2v1_extxrgb_merged_upsample_mmx;
break;
default:
sse2fct=jsimd_h2v1_merged_upsample_sse2;
mmxfct=jsimd_h2v1_merged_upsample_mmx;
break;
}
if ((simd_support & JSIMD_SSE2) &&
IS_ALIGNED_SSE(jconst_merged_upsample_sse2))
sse2fct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf);
else if (simd_support & JSIMD_MMX)
mmxfct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf);
}
GLOBAL(int)
jsimd_can_convsamp (void)
{
init_simd();
/* The code is optimised for these values only */
if (DCTSIZE != 8)
return 0;
if (BITS_IN_JSAMPLE != 8)
return 0;
if (sizeof(JDIMENSION) != 4)
return 0;
if (sizeof(DCTELEM) != 2)
return 0;
if (simd_support & JSIMD_SSE2)
return 1;
if (simd_support & JSIMD_MMX)
return 1;
return 0;
}
GLOBAL(int)
jsimd_can_convsamp_float (void)
{
init_simd();
/* The code is optimised for these values only */
if (DCTSIZE != 8)
return 0;
if (BITS_IN_JSAMPLE != 8)
return 0;
if (sizeof(JDIMENSION) != 4)
return 0;
if (sizeof(FAST_FLOAT) != 4)
return 0;
if (simd_support & JSIMD_SSE2)
return 1;
if (simd_support & JSIMD_SSE)
return 1;
if (simd_support & JSIMD_3DNOW)
return 1;
return 0;
}
GLOBAL(void)
jsimd_convsamp (JSAMPARRAY sample_data, JDIMENSION start_col,
DCTELEM * workspace)
{
if (simd_support & JSIMD_SSE2)
jsimd_convsamp_sse2(sample_data, start_col, workspace);
else if (simd_support & JSIMD_MMX)
jsimd_convsamp_mmx(sample_data, start_col, workspace);
}
GLOBAL(void)
jsimd_convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col,
FAST_FLOAT * workspace)
{
if (simd_support & JSIMD_SSE2)
jsimd_convsamp_float_sse2(sample_data, start_col, workspace);
else if (simd_support & JSIMD_SSE)
jsimd_convsamp_float_sse(sample_data, start_col, workspace);
else if (simd_support & JSIMD_3DNOW)
jsimd_convsamp_float_3dnow(sample_data, start_col, workspace);
}
GLOBAL(int)
jsimd_can_fdct_islow (void)
{
init_simd();
/* The code is optimised for these values only */
if (DCTSIZE != 8)
return 0;
if (sizeof(DCTELEM) != 2)
return 0;
if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_fdct_islow_sse2))
return 1;
if (simd_support & JSIMD_MMX)
return 1;
return 0;
}
GLOBAL(int)
jsimd_can_fdct_ifast (void)
{
init_simd();
/* The code is optimised for these values only */
if (DCTSIZE != 8)
return 0;
if (sizeof(DCTELEM) != 2)
return 0;
if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_fdct_ifast_sse2))
return 1;
if (simd_support & JSIMD_MMX)
return 1;
return 0;
}
GLOBAL(int)
jsimd_can_fdct_float (void)
{
init_simd();
/* The code is optimised for these values only */
if (DCTSIZE != 8)
return 0;
if (sizeof(FAST_FLOAT) != 4)
return 0;
if ((simd_support & JSIMD_SSE) && IS_ALIGNED_SSE(jconst_fdct_float_sse))
return 1;
if (simd_support & JSIMD_3DNOW)
return 1;
return 0;
}
GLOBAL(void)
jsimd_fdct_islow (DCTELEM * data)
{
if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_fdct_islow_sse2))
jsimd_fdct_islow_sse2(data);
else if (simd_support & JSIMD_MMX)
jsimd_fdct_islow_mmx(data);
}
GLOBAL(void)
jsimd_fdct_ifast (DCTELEM * data)
{
if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_fdct_islow_sse2))
jsimd_fdct_ifast_sse2(data);
else if (simd_support & JSIMD_MMX)
jsimd_fdct_ifast_mmx(data);
}
GLOBAL(void)
jsimd_fdct_float (FAST_FLOAT * data)
{
if ((simd_support & JSIMD_SSE) && IS_ALIGNED_SSE(jconst_fdct_float_sse))
jsimd_fdct_float_sse(data);
else if (simd_support & JSIMD_3DNOW)
jsimd_fdct_float_3dnow(data);
}
GLOBAL(int)
jsimd_can_quantize (void)
{
init_simd();
/* The code is optimised for these values only */
if (DCTSIZE != 8)
return 0;
if (sizeof(JCOEF) != 2)
return 0;
if (sizeof(DCTELEM) != 2)
return 0;
if (simd_support & JSIMD_SSE2)
return 1;
if (simd_support & JSIMD_MMX)
return 1;
return 0;
}
GLOBAL(int)
jsimd_can_quantize_float (void)
{
init_simd();
/* The code is optimised for these values only */
if (DCTSIZE != 8)
return 0;
if (sizeof(JCOEF) != 2)
return 0;
if (sizeof(FAST_FLOAT) != 4)
return 0;
if (simd_support & JSIMD_SSE2)
return 1;
if (simd_support & JSIMD_SSE)
return 1;
if (simd_support & JSIMD_3DNOW)
return 1;
return 0;
}
GLOBAL(void)
jsimd_quantize (JCOEFPTR coef_block, DCTELEM * divisors,
DCTELEM * workspace)
{
if (simd_support & JSIMD_SSE2)
jsimd_quantize_sse2(coef_block, divisors, workspace);
else if (simd_support & JSIMD_MMX)
jsimd_quantize_mmx(coef_block, divisors, workspace);
}
GLOBAL(void)
jsimd_quantize_float (JCOEFPTR coef_block, FAST_FLOAT * divisors,
FAST_FLOAT * workspace)
{
if (simd_support & JSIMD_SSE2)
jsimd_quantize_float_sse2(coef_block, divisors, workspace);
else if (simd_support & JSIMD_SSE)
jsimd_quantize_float_sse(coef_block, divisors, workspace);
else if (simd_support & JSIMD_3DNOW)
jsimd_quantize_float_3dnow(coef_block, divisors, workspace);
}
GLOBAL(int)
jsimd_can_idct_2x2 (void)
{
init_simd();
/* The code is optimised for these values only */
if (DCTSIZE != 8)
return 0;
if (sizeof(JCOEF) != 2)
return 0;
if (BITS_IN_JSAMPLE != 8)
return 0;
if (sizeof(JDIMENSION) != 4)
return 0;
if (sizeof(ISLOW_MULT_TYPE) != 2)
return 0;
if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_red_sse2))
return 1;
if (simd_support & JSIMD_MMX)
return 1;
return 0;
}
GLOBAL(int)
jsimd_can_idct_4x4 (void)
{
init_simd();
/* The code is optimised for these values only */
if (DCTSIZE != 8)
return 0;
if (sizeof(JCOEF) != 2)
return 0;
if (BITS_IN_JSAMPLE != 8)
return 0;
if (sizeof(JDIMENSION) != 4)
return 0;
if (sizeof(ISLOW_MULT_TYPE) != 2)
return 0;
if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_red_sse2))
return 1;
if (simd_support & JSIMD_MMX)
return 1;
return 0;
}
GLOBAL(void)
jsimd_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JCOEFPTR coef_block, JSAMPARRAY output_buf,
JDIMENSION output_col)
{
if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_red_sse2))
jsimd_idct_2x2_sse2(compptr->dct_table, coef_block, output_buf,
output_col);
else if (simd_support & JSIMD_MMX)
jsimd_idct_2x2_mmx(compptr->dct_table, coef_block, output_buf, output_col);
}
GLOBAL(void)
jsimd_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JCOEFPTR coef_block, JSAMPARRAY output_buf,
JDIMENSION output_col)
{
if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_red_sse2))
jsimd_idct_4x4_sse2(compptr->dct_table, coef_block, output_buf,
output_col);
else if (simd_support & JSIMD_MMX)
jsimd_idct_4x4_mmx(compptr->dct_table, coef_block, output_buf, output_col);
}
GLOBAL(int)
jsimd_can_idct_islow (void)
{
init_simd();
/* The code is optimised for these values only */
if (DCTSIZE != 8)
return 0;
if (sizeof(JCOEF) != 2)
return 0;
if (BITS_IN_JSAMPLE != 8)
return 0;
if (sizeof(JDIMENSION) != 4)
return 0;
if (sizeof(ISLOW_MULT_TYPE) != 2)
return 0;
if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_islow_sse2))
return 1;
if (simd_support & JSIMD_MMX)
return 1;
return 0;
}
GLOBAL(int)
jsimd_can_idct_ifast (void)
{
init_simd();
/* The code is optimised for these values only */
if (DCTSIZE != 8)
return 0;
if (sizeof(JCOEF) != 2)
return 0;
if (BITS_IN_JSAMPLE != 8)
return 0;
if (sizeof(JDIMENSION) != 4)
return 0;
if (sizeof(IFAST_MULT_TYPE) != 2)
return 0;
if (IFAST_SCALE_BITS != 2)
return 0;
if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_ifast_sse2))
return 1;
if (simd_support & JSIMD_MMX)
return 1;
return 0;
}
GLOBAL(int)
jsimd_can_idct_float (void)
{
init_simd();
if (DCTSIZE != 8)
return 0;
if (sizeof(JCOEF) != 2)
return 0;
if (BITS_IN_JSAMPLE != 8)
return 0;
if (sizeof(JDIMENSION) != 4)
return 0;
if (sizeof(FAST_FLOAT) != 4)
return 0;
if (sizeof(FLOAT_MULT_TYPE) != 4)
return 0;
if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_float_sse2))
return 1;
if ((simd_support & JSIMD_SSE) && IS_ALIGNED_SSE(jconst_idct_float_sse))
return 1;
if (simd_support & JSIMD_3DNOW)
return 1;
return 0;
}
GLOBAL(void)
jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JCOEFPTR coef_block, JSAMPARRAY output_buf,
JDIMENSION output_col)
{
if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_islow_sse2))
jsimd_idct_islow_sse2(compptr->dct_table, coef_block, output_buf,
output_col);
else if (simd_support & JSIMD_MMX)
jsimd_idct_islow_mmx(compptr->dct_table, coef_block, output_buf,
output_col);
}
GLOBAL(void)
jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JCOEFPTR coef_block, JSAMPARRAY output_buf,
JDIMENSION output_col)
{
if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_ifast_sse2))
jsimd_idct_ifast_sse2(compptr->dct_table, coef_block, output_buf,
output_col);
else if (simd_support & JSIMD_MMX)
jsimd_idct_ifast_mmx(compptr->dct_table, coef_block, output_buf,
output_col);
}
GLOBAL(void)
jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JCOEFPTR coef_block, JSAMPARRAY output_buf,
JDIMENSION output_col)
{
if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_float_sse2))
jsimd_idct_float_sse2(compptr->dct_table, coef_block, output_buf,
output_col);
else if ((simd_support & JSIMD_SSE) && IS_ALIGNED_SSE(jconst_idct_float_sse))
jsimd_idct_float_sse(compptr->dct_table, coef_block, output_buf,
output_col);
else if (simd_support & JSIMD_3DNOW)
jsimd_idct_float_3dnow(compptr->dct_table, coef_block, output_buf,
output_col);
}
| cedewey/sol | wp-content/themes/gulp-dev/node_modules/mozjpeg/f47f5773-89ce-4b83-810e-48145ecc3389/simd/jsimd_i386.c | C | gpl-3.0 | 28,380 |
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="utf-8"/>
<title>CSS3 Text, linebreaks: 3087 HIRAGANA LETTER SMALL YO </title>
<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
<meta name='flags' content='font'>
<style type='text/css'>
@font-face {
font-family: 'mplus-1p-regular';
src: url('support/mplus-1p-regular.woff') format('woff');
/* filesize: 803K */
}
.test, .ref { font-size: 30px; font-family: mplus-1p-regular, sans-serif; width: 95px; padding: 0; border: 1px solid orange; line-height: 1em; }
</style>
</head>
<body>
<p class="instructions">Test passes if the two orange boxes are identical.</p>
<div class='ref'>かか<br />かょな</div>
<div class='ref'>かか<br />かょな</div>
</body>
</html>
| shinglyu/servo | tests/wpt/web-platform-tests/css/css-text-3/i18n/reference/css3-text-line-break-opclns-258-ref.html | HTML | mpl-2.0 | 771 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
#
# Copyright (c) 2013-2015 Noviat nv/sa (www.noviat.com).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import account
from . import res_partner
from . import ir_actions
| damdam-s/account-financial-tools | account_move_line_search_extension/__init__.py | Python | agpl-3.0 | 1,056 |
# -*- coding: utf-8 -*-
from odoo.tests.common import HttpCase
from odoo.exceptions import ValidationError
class AccountingTestCase(HttpCase):
""" This class extends the base TransactionCase, in order to test the
accounting with localization setups. It is configured to run the tests after
the installation of all modules, and will SKIP TESTS ifit cannot find an already
configured accounting (which means no localization module has been installed).
"""
post_install = True
at_install = False
def setUp(self):
super(AccountingTestCase, self).setUp()
domain = [('company_id', '=', self.env.ref('base.main_company').id)]
if not self.env['account.account'].search_count(domain):
self.skipTest("No Chart of account found")
def check_complete_move(self, move, theorical_lines):
for aml in move.line_ids:
line = (aml.name, round(aml.debit, 2), round(aml.credit, 2))
if line in theorical_lines:
theorical_lines.remove(line)
else:
raise ValidationError('Unexpected journal item. (label: %s, debit: %s, credit: %s)' % (aml.name, round(aml.debit, 2), round(aml.credit, 2)))
if theorical_lines:
raise ValidationError('Remaining theorical line (not found). %s)' % ([(aml[0], aml[1], aml[2]) for aml in theorical_lines]))
return True
def ensure_account_property(self, property_name):
'''Ensure the ir.property targetting an account.account passed as parameter exists.
In case it's not: create it with a random account. This is useful when testing with
partially defined localization (missing stock properties for example)
:param property_name: The name of the property.
'''
company_id = self.env.user.company_id
field_id = self.env['ir.model.fields'].search(
[('model', '=', 'product.template'), ('name', '=', property_name)], limit=1)
property_id = self.env['ir.property'].search([
('company_id', '=', company_id.id),
('name', '=', property_name),
('res_id', '=', None),
('fields_id', '=', field_id.id)], limit=1)
account_id = self.env['account.account'].search([('company_id', '=', company_id.id)], limit=1)
value_reference = 'account.account,%d' % account_id.id
if property_id and not property_id.value_reference:
property_id.value_reference = value_reference
else:
self.env['ir.property'].create({
'name': property_name,
'company_id': company_id.id,
'fields_id': field_id.id,
'value_reference': value_reference,
})
| Aravinthu/odoo | addons/account/tests/account_test_classes.py | Python | agpl-3.0 | 2,749 |
/* linpack/csvdc.f -- translated by f2c (version 20050501).
You must link the resulting object file with libf2c:
on Microsoft Windows system, link with libf2c.lib;
on Linux or Unix systems, link with .../path/to/libf2c.a -lm
or, if you install libf2c.a in a standard place, with -lf2c -lm
-- in that order, at the end of the command line, as in
cc *.o -lf2c -lm
Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
http://www.netlib.org/f2c/libf2c.zip
*/
#ifdef __cplusplus
extern "C" {
#endif
#include "v3p_netlib.h"
/* Table of constant values */
static integer c__1 = 1;
static complex c_b8 = {(float)1.,(float)0.};
static complex c_b53 = {(float)-1.,(float)0.};
/*< subroutine csvdc(x,ldx,n,p,s,e,u,ldu,v,ldv,work,job,info) >*/
/* Subroutine */ int csvdc_(complex *x, integer *ldx, integer *n, integer *p,
complex *s, complex *e, complex *u, integer *ldu, complex *v, integer
*ldv, complex *work, integer *job, integer *info)
{
/* System generated locals */
integer x_dim1, x_offset, u_dim1, u_offset, v_dim1, v_offset, i__1, i__2,
i__3, i__4;
real r__1, r__2, r__3, r__4;
complex q__1, q__2, q__3;
/* Builtin functions */
double r_imag(complex *), c_abs(complex *);
void c_div(complex *, complex *, complex *), r_cnjg(complex *, complex *);
double sqrt(doublereal);
/* Local variables */
real b, c__, f, g;
integer i__, j, k, l=0, m;
complex r__, t;
real t1, el;
integer kk;
real cs;
integer ll, mm, ls=0;
real sl;
integer lu;
real sm, sn;
integer lm1, mm1, lp1, mp1, nct, ncu, lls, nrt;
real emm1, smm1;
integer kase, jobu, iter;
real test;
integer nctp1, nrtp1;
extern /* Subroutine */ int cscal_(integer *, complex *, complex *,
integer *);
real scale;
extern /* Complex */ VOID cdotc_(complex *, integer *, complex *, integer
*, complex *, integer *);
real shift;
extern /* Subroutine */ int cswap_(integer *, complex *, integer *,
complex *, integer *);
integer maxit;
extern /* Subroutine */ int caxpy_(integer *, complex *, complex *,
integer *, complex *, integer *), csrot_(integer *, complex *,
integer *, complex *, integer *, real *, real *);
logical wantu, wantv;
extern /* Subroutine */ int srotg_(real *, real *, real *, real *);
real ztest;
extern doublereal scnrm2_(integer *, complex *, integer *);
/*< integer ldx,n,p,ldu,ldv,job,info >*/
/*< complex x(ldx,1),s(1),e(1),u(ldu,1),v(ldv,1),work(1) >*/
/* csvdc is a subroutine to reduce a complex nxp matrix x by */
/* unitary transformations u and v to diagonal form. the */
/* diagonal elements s(i) are the singular values of x. the */
/* columns of u are the corresponding left singular vectors, */
/* and the columns of v the right singular vectors. */
/* on entry */
/* x complex(ldx,p), where ldx.ge.n. */
/* x contains the matrix whose singular value */
/* decomposition is to be computed. x is */
/* destroyed by csvdc. */
/* ldx integer. */
/* ldx is the leading dimension of the array x. */
/* n integer. */
/* n is the number of rows of the matrix x. */
/* p integer. */
/* p is the number of columns of the matrix x. */
/* ldu integer. */
/* ldu is the leading dimension of the array u */
/* (see below). */
/* ldv integer. */
/* ldv is the leading dimension of the array v */
/* (see below). */
/* work complex(n). */
/* work is a scratch array. */
/* job integer. */
/* job controls the computation of the singular */
/* vectors. it has the decimal expansion ab */
/* with the following meaning */
/* a.eq.0 do not compute the left singular */
/* vectors. */
/* a.eq.1 return the n left singular vectors */
/* in u. */
/* a.ge.2 returns the first min(n,p) */
/* left singular vectors in u. */
/* b.eq.0 do not compute the right singular */
/* vectors. */
/* b.eq.1 return the right singular vectors */
/* in v. */
/* on return */
/* s complex(mm), where mm=min(n+1,p). */
/* the first min(n,p) entries of s contain the */
/* singular values of x arranged in descending */
/* order of magnitude. */
/* e complex(p). */
/* e ordinarily contains zeros. however see the */
/* discussion of info for exceptions. */
/* u complex(ldu,k), where ldu.ge.n. if joba.eq.1 then */
/* k.eq.n, if joba.ge.2 then */
/* k.eq.min(n,p). */
/* u contains the matrix of left singular vectors. */
/* u is not referenced if joba.eq.0. if n.le.p */
/* or if joba.gt.2, then u may be identified with x */
/* in the subroutine call. */
/* v complex(ldv,p), where ldv.ge.p. */
/* v contains the matrix of right singular vectors. */
/* v is not referenced if jobb.eq.0. if p.le.n, */
/* then v may be identified whth x in the */
/* subroutine call. */
/* info integer. */
/* the singular values (and their corresponding */
/* singular vectors) s(info+1),s(info+2),...,s(m) */
/* are correct (here m=min(n,p)). thus if */
/* info.eq.0, all the singular values and their */
/* vectors are correct. in any event, the matrix */
/* b = ctrans(u)*x*v is the bidiagonal matrix */
/* with the elements of s on its diagonal and the */
/* elements of e on its super-diagonal (ctrans(u) */
/* is the conjugate-transpose of u). thus the */
/* singular values of x and b are the same. */
/* linpack. this version dated 03/19/79 . */
/* correction to shift calculation made 2/85. */
/* g.w. stewart, university of maryland, argonne national lab. */
/* csvdc uses the following functions and subprograms. */
/* external csrot */
/* blas caxpy,cdotc,cscal,cswap,scnrm2,srotg */
/* fortran abs,aimag,amax1,cabs,cmplx */
/* fortran conjg,max0,min0,mod,real,sqrt */
/* internal variables */
/*< >*/
/*< complex cdotc,t,r >*/
/*< >*/
/*< logical wantu,wantv >*/
/*< complex csign,zdum,zdum1,zdum2 >*/
/*< real cabs1 >*/
/*< cabs1(zdum) = abs(real(zdum)) + abs(aimag(zdum)) >*/
/*< csign(zdum1,zdum2) = cabs(zdum1)*(zdum2/cabs(zdum2)) >*/
/* set the maximum number of iterations. */
/*< maxit = 1000 >*/
/* Parameter adjustments */
x_dim1 = *ldx;
x_offset = 1 + x_dim1;
x -= x_offset;
--s;
--e;
u_dim1 = *ldu;
u_offset = 1 + u_dim1;
u -= u_offset;
v_dim1 = *ldv;
v_offset = 1 + v_dim1;
v -= v_offset;
--work;
/* Function Body */
maxit = 1000;
/* determine what is to be computed. */
/*< wantu = .false. >*/
wantu = FALSE_;
/*< wantv = .false. >*/
wantv = FALSE_;
/*< jobu = mod(job,100)/10 >*/
jobu = *job % 100 / 10;
/*< ncu = n >*/
ncu = *n;
/*< if (jobu .gt. 1) ncu = min0(n,p) >*/
if (jobu > 1) {
ncu = min(*n,*p);
}
/*< if (jobu .ne. 0) wantu = .true. >*/
if (jobu != 0) {
wantu = TRUE_;
}
/*< if (mod(job,10) .ne. 0) wantv = .true. >*/
if (*job % 10 != 0) {
wantv = TRUE_;
}
/* reduce x to bidiagonal form, storing the diagonal elements */
/* in s and the super-diagonal elements in e. */
/*< info = 0 >*/
*info = 0;
/*< nct = min0(n-1,p) >*/
/* Computing MIN */
i__1 = *n - 1;
nct = min(i__1,*p);
/*< nrt = max0(0,min0(p-2,n)) >*/
/* Computing MAX */
/* Computing MIN */
i__3 = *p - 2;
i__1 = 0, i__2 = min(i__3,*n);
nrt = max(i__1,i__2);
/*< lu = max0(nct,nrt) >*/
lu = max(nct,nrt);
/*< if (lu .lt. 1) go to 170 >*/
if (lu < 1) {
goto L170;
}
/*< do 160 l = 1, lu >*/
i__1 = lu;
for (l = 1; l <= i__1; ++l) {
/*< lp1 = l + 1 >*/
lp1 = l + 1;
/*< if (l .gt. nct) go to 20 >*/
if (l > nct) {
goto L20;
}
/* compute the transformation for the l-th column and */
/* place the l-th diagonal in s(l). */
/*< s(l) = cmplx(scnrm2(n-l+1,x(l,l),1),0.0e0) >*/
i__2 = l;
i__3 = *n - l + 1;
r__1 = scnrm2_(&i__3, &x[l + l * x_dim1], &c__1);
q__1.r = r__1, q__1.i = (float)0.;
s[i__2].r = q__1.r, s[i__2].i = q__1.i;
/*< if (cabs1(s(l)) .eq. 0.0e0) go to 10 >*/
i__2 = l;
if ((r__1 = s[i__2].r, dabs(r__1)) + (r__2 = r_imag(&s[l]), dabs(r__2)
) == (float)0.) {
goto L10;
}
/*< if (cabs1(x(l,l)) .ne. 0.0e0) s(l) = csign(s(l),x(l,l)) >*/
i__2 = l + l * x_dim1;
if ((r__1 = x[i__2].r, dabs(r__1)) + (r__2 = r_imag(&x[l + l * x_dim1]
), dabs(r__2)) != (float)0.) {
i__3 = l;
r__3 = c_abs(&s[l]);
i__4 = l + l * x_dim1;
r__4 = c_abs(&x[l + l * x_dim1]);
q__2.r = x[i__4].r / r__4, q__2.i = x[i__4].i / r__4;
q__1.r = r__3 * q__2.r, q__1.i = r__3 * q__2.i;
s[i__3].r = q__1.r, s[i__3].i = q__1.i;
}
/*< call cscal(n-l+1,1.0e0/s(l),x(l,l),1) >*/
i__2 = *n - l + 1;
c_div(&q__1, &c_b8, &s[l]);
cscal_(&i__2, &q__1, &x[l + l * x_dim1], &c__1);
/*< x(l,l) = (1.0e0,0.0e0) + x(l,l) >*/
i__2 = l + l * x_dim1;
i__3 = l + l * x_dim1;
q__1.r = x[i__3].r + (float)1., q__1.i = x[i__3].i + (float)0.;
x[i__2].r = q__1.r, x[i__2].i = q__1.i;
/*< 10 continue >*/
L10:
/*< s(l) = -s(l) >*/
i__2 = l;
i__3 = l;
q__1.r = -s[i__3].r, q__1.i = -s[i__3].i;
s[i__2].r = q__1.r, s[i__2].i = q__1.i;
/*< 20 continue >*/
L20:
/*< if (p .lt. lp1) go to 50 >*/
if (*p < lp1) {
goto L50;
}
/*< do 40 j = lp1, p >*/
i__2 = *p;
for (j = lp1; j <= i__2; ++j) {
/*< if (l .gt. nct) go to 30 >*/
if (l > nct) {
goto L30;
}
/*< if (cabs1(s(l)) .eq. 0.0e0) go to 30 >*/
i__3 = l;
if ((r__1 = s[i__3].r, dabs(r__1)) + (r__2 = r_imag(&s[l]), dabs(
r__2)) == (float)0.) {
goto L30;
}
/* apply the transformation. */
/*< t = -cdotc(n-l+1,x(l,l),1,x(l,j),1)/x(l,l) >*/
i__3 = *n - l + 1;
cdotc_(&q__3, &i__3, &x[l + l * x_dim1], &c__1, &x[l + j * x_dim1]
, &c__1);
q__2.r = -q__3.r, q__2.i = -q__3.i;
c_div(&q__1, &q__2, &x[l + l * x_dim1]);
t.r = q__1.r, t.i = q__1.i;
/*< call caxpy(n-l+1,t,x(l,l),1,x(l,j),1) >*/
i__3 = *n - l + 1;
caxpy_(&i__3, &t, &x[l + l * x_dim1], &c__1, &x[l + j * x_dim1], &
c__1);
/*< 30 continue >*/
L30:
/* place the l-th row of x into e for the */
/* subsequent calculation of the row transformation. */
/*< e(j) = conjg(x(l,j)) >*/
i__3 = j;
r_cnjg(&q__1, &x[l + j * x_dim1]);
e[i__3].r = q__1.r, e[i__3].i = q__1.i;
/*< 40 continue >*/
/* L40: */
}
/*< 50 continue >*/
L50:
/*< if (.not.wantu .or. l .gt. nct) go to 70 >*/
if (! wantu || l > nct) {
goto L70;
}
/* place the transformation in u for subsequent back */
/* multiplication. */
/*< do 60 i = l, n >*/
i__2 = *n;
for (i__ = l; i__ <= i__2; ++i__) {
/*< u(i,l) = x(i,l) >*/
i__3 = i__ + l * u_dim1;
i__4 = i__ + l * x_dim1;
u[i__3].r = x[i__4].r, u[i__3].i = x[i__4].i;
/*< 60 continue >*/
/* L60: */
}
/*< 70 continue >*/
L70:
/*< if (l .gt. nrt) go to 150 >*/
if (l > nrt) {
goto L150;
}
/* compute the l-th row transformation and place the */
/* l-th super-diagonal in e(l). */
/*< e(l) = cmplx(scnrm2(p-l,e(lp1),1),0.0e0) >*/
i__2 = l;
i__3 = *p - l;
r__1 = scnrm2_(&i__3, &e[lp1], &c__1);
q__1.r = r__1, q__1.i = (float)0.;
e[i__2].r = q__1.r, e[i__2].i = q__1.i;
/*< if (cabs1(e(l)) .eq. 0.0e0) go to 80 >*/
i__2 = l;
if ((r__1 = e[i__2].r, dabs(r__1)) + (r__2 = r_imag(&e[l]), dabs(r__2)
) == (float)0.) {
goto L80;
}
/*< if (cabs1(e(lp1)) .ne. 0.0e0) e(l) = csign(e(l),e(lp1)) >*/
i__2 = lp1;
if ((r__1 = e[i__2].r, dabs(r__1)) + (r__2 = r_imag(&e[lp1]), dabs(
r__2)) != (float)0.) {
i__3 = l;
r__3 = c_abs(&e[l]);
i__4 = lp1;
r__4 = c_abs(&e[lp1]);
q__2.r = e[i__4].r / r__4, q__2.i = e[i__4].i / r__4;
q__1.r = r__3 * q__2.r, q__1.i = r__3 * q__2.i;
e[i__3].r = q__1.r, e[i__3].i = q__1.i;
}
/*< call cscal(p-l,1.0e0/e(l),e(lp1),1) >*/
i__2 = *p - l;
c_div(&q__1, &c_b8, &e[l]);
cscal_(&i__2, &q__1, &e[lp1], &c__1);
/*< e(lp1) = (1.0e0,0.0e0) + e(lp1) >*/
i__2 = lp1;
i__3 = lp1;
q__1.r = e[i__3].r + (float)1., q__1.i = e[i__3].i + (float)0.;
e[i__2].r = q__1.r, e[i__2].i = q__1.i;
/*< 80 continue >*/
L80:
/*< e(l) = -conjg(e(l)) >*/
i__2 = l;
r_cnjg(&q__2, &e[l]);
q__1.r = -q__2.r, q__1.i = -q__2.i;
e[i__2].r = q__1.r, e[i__2].i = q__1.i;
/*< if (lp1 .gt. n .or. cabs1(e(l)) .eq. 0.0e0) go to 120 >*/
i__2 = l;
if (lp1 > *n || (r__1 = e[i__2].r, dabs(r__1)) + (r__2 = r_imag(&e[l])
, dabs(r__2)) == (float)0.) {
goto L120;
}
/* apply the transformation. */
/*< do 90 i = lp1, n >*/
i__2 = *n;
for (i__ = lp1; i__ <= i__2; ++i__) {
/*< work(i) = (0.0e0,0.0e0) >*/
i__3 = i__;
work[i__3].r = (float)0., work[i__3].i = (float)0.;
/*< 90 continue >*/
/* L90: */
}
/*< do 100 j = lp1, p >*/
i__2 = *p;
for (j = lp1; j <= i__2; ++j) {
/*< call caxpy(n-l,e(j),x(lp1,j),1,work(lp1),1) >*/
i__3 = *n - l;
caxpy_(&i__3, &e[j], &x[lp1 + j * x_dim1], &c__1, &work[lp1], &
c__1);
/*< 100 continue >*/
/* L100: */
}
/*< do 110 j = lp1, p >*/
i__2 = *p;
for (j = lp1; j <= i__2; ++j) {
/*< >*/
i__3 = *n - l;
i__4 = j;
q__3.r = -e[i__4].r, q__3.i = -e[i__4].i;
c_div(&q__2, &q__3, &e[lp1]);
r_cnjg(&q__1, &q__2);
caxpy_(&i__3, &q__1, &work[lp1], &c__1, &x[lp1 + j * x_dim1], &
c__1);
/*< 110 continue >*/
/* L110: */
}
/*< 120 continue >*/
L120:
/*< if (.not.wantv) go to 140 >*/
if (! wantv) {
goto L140;
}
/* place the transformation in v for subsequent */
/* back multiplication. */
/*< do 130 i = lp1, p >*/
i__2 = *p;
for (i__ = lp1; i__ <= i__2; ++i__) {
/*< v(i,l) = e(i) >*/
i__3 = i__ + l * v_dim1;
i__4 = i__;
v[i__3].r = e[i__4].r, v[i__3].i = e[i__4].i;
/*< 130 continue >*/
/* L130: */
}
/*< 140 continue >*/
L140:
/*< 150 continue >*/
L150:
/*< 160 continue >*/
/* L160: */
;
}
/*< 170 continue >*/
L170:
/* set up the final bidiagonal matrix or order m. */
/*< m = min0(p,n+1) >*/
/* Computing MIN */
i__1 = *p, i__2 = *n + 1;
m = min(i__1,i__2);
/*< nctp1 = nct + 1 >*/
nctp1 = nct + 1;
/*< nrtp1 = nrt + 1 >*/
nrtp1 = nrt + 1;
/*< if (nct .lt. p) s(nctp1) = x(nctp1,nctp1) >*/
if (nct < *p) {
i__1 = nctp1;
i__2 = nctp1 + nctp1 * x_dim1;
s[i__1].r = x[i__2].r, s[i__1].i = x[i__2].i;
}
/*< if (n .lt. m) s(m) = (0.0e0,0.0e0) >*/
if (*n < m) {
i__1 = m;
s[i__1].r = (float)0., s[i__1].i = (float)0.;
}
/*< if (nrtp1 .lt. m) e(nrtp1) = x(nrtp1,m) >*/
if (nrtp1 < m) {
i__1 = nrtp1;
i__2 = nrtp1 + m * x_dim1;
e[i__1].r = x[i__2].r, e[i__1].i = x[i__2].i;
}
/*< e(m) = (0.0e0,0.0e0) >*/
i__1 = m;
e[i__1].r = (float)0., e[i__1].i = (float)0.;
/* if required, generate u. */
/*< if (.not.wantu) go to 300 >*/
if (! wantu) {
goto L300;
}
/*< if (ncu .lt. nctp1) go to 200 >*/
if (ncu < nctp1) {
goto L200;
}
/*< do 190 j = nctp1, ncu >*/
i__1 = ncu;
for (j = nctp1; j <= i__1; ++j) {
/*< do 180 i = 1, n >*/
i__2 = *n;
for (i__ = 1; i__ <= i__2; ++i__) {
/*< u(i,j) = (0.0e0,0.0e0) >*/
i__3 = i__ + j * u_dim1;
u[i__3].r = (float)0., u[i__3].i = (float)0.;
/*< 180 continue >*/
/* L180: */
}
/*< u(j,j) = (1.0e0,0.0e0) >*/
i__2 = j + j * u_dim1;
u[i__2].r = (float)1., u[i__2].i = (float)0.;
/*< 190 continue >*/
/* L190: */
}
/*< 200 continue >*/
L200:
/*< if (nct .lt. 1) go to 290 >*/
if (nct < 1) {
goto L290;
}
/*< do 280 ll = 1, nct >*/
i__1 = nct;
for (ll = 1; ll <= i__1; ++ll) {
/*< l = nct - ll + 1 >*/
l = nct - ll + 1;
/*< if (cabs1(s(l)) .eq. 0.0e0) go to 250 >*/
i__2 = l;
if ((r__1 = s[i__2].r, dabs(r__1)) + (r__2 = r_imag(&s[l]), dabs(r__2)
) == (float)0.) {
goto L250;
}
/*< lp1 = l + 1 >*/
lp1 = l + 1;
/*< if (ncu .lt. lp1) go to 220 >*/
if (ncu < lp1) {
goto L220;
}
/*< do 210 j = lp1, ncu >*/
i__2 = ncu;
for (j = lp1; j <= i__2; ++j) {
/*< t = -cdotc(n-l+1,u(l,l),1,u(l,j),1)/u(l,l) >*/
i__3 = *n - l + 1;
cdotc_(&q__3, &i__3, &u[l + l * u_dim1], &c__1, &u[l + j * u_dim1]
, &c__1);
q__2.r = -q__3.r, q__2.i = -q__3.i;
c_div(&q__1, &q__2, &u[l + l * u_dim1]);
t.r = q__1.r, t.i = q__1.i;
/*< call caxpy(n-l+1,t,u(l,l),1,u(l,j),1) >*/
i__3 = *n - l + 1;
caxpy_(&i__3, &t, &u[l + l * u_dim1], &c__1, &u[l + j * u_dim1], &
c__1);
/*< 210 continue >*/
/* L210: */
}
/*< 220 continue >*/
L220:
/*< call cscal(n-l+1,(-1.0e0,0.0e0),u(l,l),1) >*/
i__2 = *n - l + 1;
cscal_(&i__2, &c_b53, &u[l + l * u_dim1], &c__1);
/*< u(l,l) = (1.0e0,0.0e0) + u(l,l) >*/
i__2 = l + l * u_dim1;
i__3 = l + l * u_dim1;
q__1.r = u[i__3].r + (float)1., q__1.i = u[i__3].i + (float)0.;
u[i__2].r = q__1.r, u[i__2].i = q__1.i;
/*< lm1 = l - 1 >*/
lm1 = l - 1;
/*< if (lm1 .lt. 1) go to 240 >*/
if (lm1 < 1) {
goto L240;
}
/*< do 230 i = 1, lm1 >*/
i__2 = lm1;
for (i__ = 1; i__ <= i__2; ++i__) {
/*< u(i,l) = (0.0e0,0.0e0) >*/
i__3 = i__ + l * u_dim1;
u[i__3].r = (float)0., u[i__3].i = (float)0.;
/*< 230 continue >*/
/* L230: */
}
/*< 240 continue >*/
L240:
/*< go to 270 >*/
goto L270;
/*< 250 continue >*/
L250:
/*< do 260 i = 1, n >*/
i__2 = *n;
for (i__ = 1; i__ <= i__2; ++i__) {
/*< u(i,l) = (0.0e0,0.0e0) >*/
i__3 = i__ + l * u_dim1;
u[i__3].r = (float)0., u[i__3].i = (float)0.;
/*< 260 continue >*/
/* L260: */
}
/*< u(l,l) = (1.0e0,0.0e0) >*/
i__2 = l + l * u_dim1;
u[i__2].r = (float)1., u[i__2].i = (float)0.;
/*< 270 continue >*/
L270:
/*< 280 continue >*/
/* L280: */
;
}
/*< 290 continue >*/
L290:
/*< 300 continue >*/
L300:
/* if it is required, generate v. */
/*< if (.not.wantv) go to 350 >*/
if (! wantv) {
goto L350;
}
/*< do 340 ll = 1, p >*/
i__1 = *p;
for (ll = 1; ll <= i__1; ++ll) {
/*< l = p - ll + 1 >*/
l = *p - ll + 1;
/*< lp1 = l + 1 >*/
lp1 = l + 1;
/*< if (l .gt. nrt) go to 320 >*/
if (l > nrt) {
goto L320;
}
/*< if (cabs1(e(l)) .eq. 0.0e0) go to 320 >*/
i__2 = l;
if ((r__1 = e[i__2].r, dabs(r__1)) + (r__2 = r_imag(&e[l]), dabs(r__2)
) == (float)0.) {
goto L320;
}
/*< do 310 j = lp1, p >*/
i__2 = *p;
for (j = lp1; j <= i__2; ++j) {
/*< t = -cdotc(p-l,v(lp1,l),1,v(lp1,j),1)/v(lp1,l) >*/
i__3 = *p - l;
cdotc_(&q__3, &i__3, &v[lp1 + l * v_dim1], &c__1, &v[lp1 + j *
v_dim1], &c__1);
q__2.r = -q__3.r, q__2.i = -q__3.i;
c_div(&q__1, &q__2, &v[lp1 + l * v_dim1]);
t.r = q__1.r, t.i = q__1.i;
/*< call caxpy(p-l,t,v(lp1,l),1,v(lp1,j),1) >*/
i__3 = *p - l;
caxpy_(&i__3, &t, &v[lp1 + l * v_dim1], &c__1, &v[lp1 + j *
v_dim1], &c__1);
/*< 310 continue >*/
/* L310: */
}
/*< 320 continue >*/
L320:
/*< do 330 i = 1, p >*/
i__2 = *p;
for (i__ = 1; i__ <= i__2; ++i__) {
/*< v(i,l) = (0.0e0,0.0e0) >*/
i__3 = i__ + l * v_dim1;
v[i__3].r = (float)0., v[i__3].i = (float)0.;
/*< 330 continue >*/
/* L330: */
}
/*< v(l,l) = (1.0e0,0.0e0) >*/
i__2 = l + l * v_dim1;
v[i__2].r = (float)1., v[i__2].i = (float)0.;
/*< 340 continue >*/
/* L340: */
}
/*< 350 continue >*/
L350:
/* transform s and e so that they are real. */
/*< do 380 i = 1, m >*/
i__1 = m;
for (i__ = 1; i__ <= i__1; ++i__) {
/*< if (cabs1(s(i)) .eq. 0.0e0) go to 360 >*/
i__2 = i__;
if ((r__1 = s[i__2].r, dabs(r__1)) + (r__2 = r_imag(&s[i__]), dabs(
r__2)) == (float)0.) {
goto L360;
}
/*< t = cmplx(cabs(s(i)),0.0e0) >*/
r__1 = c_abs(&s[i__]);
q__1.r = r__1, q__1.i = (float)0.;
t.r = q__1.r, t.i = q__1.i;
/*< r = s(i)/t >*/
c_div(&q__1, &s[i__], &t);
r__.r = q__1.r, r__.i = q__1.i;
/*< s(i) = t >*/
i__2 = i__;
s[i__2].r = t.r, s[i__2].i = t.i;
/*< if (i .lt. m) e(i) = e(i)/r >*/
if (i__ < m) {
i__2 = i__;
c_div(&q__1, &e[i__], &r__);
e[i__2].r = q__1.r, e[i__2].i = q__1.i;
}
/*< if (wantu) call cscal(n,r,u(1,i),1) >*/
if (wantu) {
cscal_(n, &r__, &u[i__ * u_dim1 + 1], &c__1);
}
/*< 360 continue >*/
L360:
/* ...exit */
/*< if (i .eq. m) go to 390 >*/
if (i__ == m) {
goto L390;
}
/*< if (cabs1(e(i)) .eq. 0.0e0) go to 370 >*/
i__2 = i__;
if ((r__1 = e[i__2].r, dabs(r__1)) + (r__2 = r_imag(&e[i__]), dabs(
r__2)) == (float)0.) {
goto L370;
}
/*< t = cmplx(cabs(e(i)),0.0e0) >*/
r__1 = c_abs(&e[i__]);
q__1.r = r__1, q__1.i = (float)0.;
t.r = q__1.r, t.i = q__1.i;
/*< r = t/e(i) >*/
c_div(&q__1, &t, &e[i__]);
r__.r = q__1.r, r__.i = q__1.i;
/*< e(i) = t >*/
i__2 = i__;
e[i__2].r = t.r, e[i__2].i = t.i;
/*< s(i+1) = s(i+1)*r >*/
i__2 = i__ + 1;
i__3 = i__ + 1;
q__1.r = s[i__3].r * r__.r - s[i__3].i * r__.i, q__1.i = s[i__3].r *
r__.i + s[i__3].i * r__.r;
s[i__2].r = q__1.r, s[i__2].i = q__1.i;
/*< if (wantv) call cscal(p,r,v(1,i+1),1) >*/
if (wantv) {
cscal_(p, &r__, &v[(i__ + 1) * v_dim1 + 1], &c__1);
}
/*< 370 continue >*/
L370:
/*< 380 continue >*/
/* L380: */
;
}
/*< 390 continue >*/
L390:
/* main iteration loop for the singular values. */
/*< mm = m >*/
mm = m;
/*< iter = 0 >*/
iter = 0;
/*< 400 continue >*/
L400:
/* quit if all the singular values have been found. */
/* ...exit */
/*< if (m .eq. 0) go to 660 >*/
if (m == 0) {
goto L660;
}
/* if too many iterations have been performed, set */
/* flag and return. */
/*< if (iter .lt. maxit) go to 410 >*/
if (iter < maxit) {
goto L410;
}
/*< info = m >*/
*info = m;
/* ......exit */
/*< go to 660 >*/
goto L660;
/*< 410 continue >*/
L410:
/* this section of the program inspects for */
/* negligible elements in the s and e arrays. on */
/* completion the variables kase and l are set as follows. */
/* kase = 1 if s(m) and e(l-1) are negligible and l.lt.m */
/* kase = 2 if s(l) is negligible and l.lt.m */
/* kase = 3 if e(l-1) is negligible, l.lt.m, and */
/* s(l), ..., s(m) are not negligible (qr step). */
/* kase = 4 if e(m-1) is negligible (convergence). */
/*< do 430 ll = 1, m >*/
i__1 = m;
for (ll = 1; ll <= i__1; ++ll) {
/*< l = m - ll >*/
l = m - ll;
/* ...exit */
/*< if (l .eq. 0) go to 440 >*/
if (l == 0) {
goto L440;
}
/*< test = cabs(s(l)) + cabs(s(l+1)) >*/
test = c_abs(&s[l]) + c_abs(&s[l + 1]);
/*< ztest = test + cabs(e(l)) >*/
ztest = test + c_abs(&e[l]);
/*< if (ztest .ne. test) go to 420 >*/
if (ztest != test) {
goto L420;
}
/*< e(l) = (0.0e0,0.0e0) >*/
i__2 = l;
e[i__2].r = (float)0., e[i__2].i = (float)0.;
/* ......exit */
/*< go to 440 >*/
goto L440;
/*< 420 continue >*/
L420:
/*< 430 continue >*/
/* L430: */
;
}
/*< 440 continue >*/
L440:
/*< if (l .ne. m - 1) go to 450 >*/
if (l != m - 1) {
goto L450;
}
/*< kase = 4 >*/
kase = 4;
/*< go to 520 >*/
goto L520;
/*< 450 continue >*/
L450:
/*< lp1 = l + 1 >*/
lp1 = l + 1;
/*< mp1 = m + 1 >*/
mp1 = m + 1;
/*< do 470 lls = lp1, mp1 >*/
i__1 = mp1;
for (lls = lp1; lls <= i__1; ++lls) {
/*< ls = m - lls + lp1 >*/
ls = m - lls + lp1;
/* ...exit */
/*< if (ls .eq. l) go to 480 >*/
if (ls == l) {
goto L480;
}
/*< test = 0.0e0 >*/
test = (float)0.;
/*< if (ls .ne. m) test = test + cabs(e(ls)) >*/
if (ls != m) {
test += c_abs(&e[ls]);
}
/*< if (ls .ne. l + 1) test = test + cabs(e(ls-1)) >*/
if (ls != l + 1) {
test += c_abs(&e[ls - 1]);
}
/*< ztest = test + cabs(s(ls)) >*/
ztest = test + c_abs(&s[ls]);
/*< if (ztest .ne. test) go to 460 >*/
if (ztest != test) {
goto L460;
}
/*< s(ls) = (0.0e0,0.0e0) >*/
i__2 = ls;
s[i__2].r = (float)0., s[i__2].i = (float)0.;
/* ......exit */
/*< go to 480 >*/
goto L480;
/*< 460 continue >*/
L460:
/*< 470 continue >*/
/* L470: */
;
}
/*< 480 continue >*/
L480:
/*< if (ls .ne. l) go to 490 >*/
if (ls != l) {
goto L490;
}
/*< kase = 3 >*/
kase = 3;
/*< go to 510 >*/
goto L510;
/*< 490 continue >*/
L490:
/*< if (ls .ne. m) go to 500 >*/
if (ls != m) {
goto L500;
}
/*< kase = 1 >*/
kase = 1;
/*< go to 510 >*/
goto L510;
/*< 500 continue >*/
L500:
/*< kase = 2 >*/
kase = 2;
/*< l = ls >*/
l = ls;
/*< 510 continue >*/
L510:
/*< 520 continue >*/
L520:
/*< l = l + 1 >*/
++l;
/* perform the task indicated by kase. */
/*< go to (530, 560, 580, 610), kase >*/
switch (kase) {
case 1: goto L530;
case 2: goto L560;
case 3: goto L580;
case 4: goto L610;
}
/* deflate negligible s(m). */
/*< 530 continue >*/
L530:
/*< mm1 = m - 1 >*/
mm1 = m - 1;
/*< f = real(e(m-1)) >*/
i__1 = m - 1;
f = e[i__1].r;
/*< e(m-1) = (0.0e0,0.0e0) >*/
i__1 = m - 1;
e[i__1].r = (float)0., e[i__1].i = (float)0.;
/*< do 550 kk = l, mm1 >*/
i__1 = mm1;
for (kk = l; kk <= i__1; ++kk) {
/*< k = mm1 - kk + l >*/
k = mm1 - kk + l;
/*< t1 = real(s(k)) >*/
i__2 = k;
t1 = s[i__2].r;
/*< call srotg(t1,f,cs,sn) >*/
srotg_(&t1, &f, &cs, &sn);
/*< s(k) = cmplx(t1,0.0e0) >*/
i__2 = k;
q__1.r = t1, q__1.i = (float)0.;
s[i__2].r = q__1.r, s[i__2].i = q__1.i;
/*< if (k .eq. l) go to 540 >*/
if (k == l) {
goto L540;
}
/*< f = -sn*real(e(k-1)) >*/
i__2 = k - 1;
f = -sn * e[i__2].r;
/*< e(k-1) = cs*e(k-1) >*/
i__2 = k - 1;
i__3 = k - 1;
q__1.r = cs * e[i__3].r, q__1.i = cs * e[i__3].i;
e[i__2].r = q__1.r, e[i__2].i = q__1.i;
/*< 540 continue >*/
L540:
/*< if (wantv) call csrot(p,v(1,k),1,v(1,m),1,cs,sn) >*/
if (wantv) {
csrot_(p, &v[k * v_dim1 + 1], &c__1, &v[m * v_dim1 + 1], &c__1, &
cs, &sn);
}
/*< 550 continue >*/
/* L550: */
}
/*< go to 650 >*/
goto L650;
/* split at negligible s(l). */
/*< 560 continue >*/
L560:
/*< f = real(e(l-1)) >*/
i__1 = l - 1;
f = e[i__1].r;
/*< e(l-1) = (0.0e0,0.0e0) >*/
i__1 = l - 1;
e[i__1].r = (float)0., e[i__1].i = (float)0.;
/*< do 570 k = l, m >*/
i__1 = m;
for (k = l; k <= i__1; ++k) {
/*< t1 = real(s(k)) >*/
i__2 = k;
t1 = s[i__2].r;
/*< call srotg(t1,f,cs,sn) >*/
srotg_(&t1, &f, &cs, &sn);
/*< s(k) = cmplx(t1,0.0e0) >*/
i__2 = k;
q__1.r = t1, q__1.i = (float)0.;
s[i__2].r = q__1.r, s[i__2].i = q__1.i;
/*< f = -sn*real(e(k)) >*/
i__2 = k;
f = -sn * e[i__2].r;
/*< e(k) = cs*e(k) >*/
i__2 = k;
i__3 = k;
q__1.r = cs * e[i__3].r, q__1.i = cs * e[i__3].i;
e[i__2].r = q__1.r, e[i__2].i = q__1.i;
/*< if (wantu) call csrot(n,u(1,k),1,u(1,l-1),1,cs,sn) >*/
if (wantu) {
csrot_(n, &u[k * u_dim1 + 1], &c__1, &u[(l - 1) * u_dim1 + 1], &
c__1, &cs, &sn);
}
/*< 570 continue >*/
/* L570: */
}
/*< go to 650 >*/
goto L650;
/* perform one qr step. */
/*< 580 continue >*/
L580:
/* calculate the shift. */
/*< >*/
/* Computing MAX */
r__1 = c_abs(&s[m]), r__2 = c_abs(&s[m - 1]), r__1 = max(r__1,r__2), r__2
= c_abs(&e[m - 1]), r__1 = max(r__1,r__2), r__2 = c_abs(&s[l]),
r__1 = max(r__1,r__2), r__2 = c_abs(&e[l]);
scale = dmax(r__1,r__2);
/*< sm = real(s(m))/scale >*/
i__1 = m;
sm = s[i__1].r / scale;
/*< smm1 = real(s(m-1))/scale >*/
i__1 = m - 1;
smm1 = s[i__1].r / scale;
/*< emm1 = real(e(m-1))/scale >*/
i__1 = m - 1;
emm1 = e[i__1].r / scale;
/*< sl = real(s(l))/scale >*/
i__1 = l;
sl = s[i__1].r / scale;
/*< el = real(e(l))/scale >*/
i__1 = l;
el = e[i__1].r / scale;
/*< b = ((smm1 + sm)*(smm1 - sm) + emm1**2)/2.0e0 >*/
/* Computing 2nd power */
r__1 = emm1;
b = ((smm1 + sm) * (smm1 - sm) + r__1 * r__1) / (float)2.;
/*< c = (sm*emm1)**2 >*/
/* Computing 2nd power */
r__1 = sm * emm1;
c__ = r__1 * r__1;
/*< shift = 0.0e0 >*/
shift = (float)0.;
/*< if (b .eq. 0.0e0 .and. c .eq. 0.0e0) go to 590 >*/
if (b == (float)0. && c__ == (float)0.) {
goto L590;
}
/*< shift = sqrt(b**2+c) >*/
/* Computing 2nd power */
r__1 = b;
shift = sqrt(r__1 * r__1 + c__);
/*< if (b .lt. 0.0e0) shift = -shift >*/
if (b < (float)0.) {
shift = -shift;
}
/*< shift = c/(b + shift) >*/
shift = c__ / (b + shift);
/*< 590 continue >*/
L590:
/*< f = (sl + sm)*(sl - sm) + shift >*/
f = (sl + sm) * (sl - sm) + shift;
/*< g = sl*el >*/
g = sl * el;
/* chase zeros. */
/*< mm1 = m - 1 >*/
mm1 = m - 1;
/*< do 600 k = l, mm1 >*/
i__1 = mm1;
for (k = l; k <= i__1; ++k) {
/*< call srotg(f,g,cs,sn) >*/
srotg_(&f, &g, &cs, &sn);
/*< if (k .ne. l) e(k-1) = cmplx(f,0.0e0) >*/
if (k != l) {
i__2 = k - 1;
q__1.r = f, q__1.i = (float)0.;
e[i__2].r = q__1.r, e[i__2].i = q__1.i;
}
/*< f = cs*real(s(k)) + sn*real(e(k)) >*/
i__2 = k;
i__3 = k;
f = cs * s[i__2].r + sn * e[i__3].r;
/*< e(k) = cs*e(k) - sn*s(k) >*/
i__2 = k;
i__3 = k;
q__2.r = cs * e[i__3].r, q__2.i = cs * e[i__3].i;
i__4 = k;
q__3.r = sn * s[i__4].r, q__3.i = sn * s[i__4].i;
q__1.r = q__2.r - q__3.r, q__1.i = q__2.i - q__3.i;
e[i__2].r = q__1.r, e[i__2].i = q__1.i;
/*< g = sn*real(s(k+1)) >*/
i__2 = k + 1;
g = sn * s[i__2].r;
/*< s(k+1) = cs*s(k+1) >*/
i__2 = k + 1;
i__3 = k + 1;
q__1.r = cs * s[i__3].r, q__1.i = cs * s[i__3].i;
s[i__2].r = q__1.r, s[i__2].i = q__1.i;
/*< if (wantv) call csrot(p,v(1,k),1,v(1,k+1),1,cs,sn) >*/
if (wantv) {
csrot_(p, &v[k * v_dim1 + 1], &c__1, &v[(k + 1) * v_dim1 + 1], &
c__1, &cs, &sn);
}
/*< call srotg(f,g,cs,sn) >*/
srotg_(&f, &g, &cs, &sn);
/*< s(k) = cmplx(f,0.0e0) >*/
i__2 = k;
q__1.r = f, q__1.i = (float)0.;
s[i__2].r = q__1.r, s[i__2].i = q__1.i;
/*< f = cs*real(e(k)) + sn*real(s(k+1)) >*/
i__2 = k;
i__3 = k + 1;
f = cs * e[i__2].r + sn * s[i__3].r;
/*< s(k+1) = -sn*e(k) + cs*s(k+1) >*/
i__2 = k + 1;
r__1 = -sn;
i__3 = k;
q__2.r = r__1 * e[i__3].r, q__2.i = r__1 * e[i__3].i;
i__4 = k + 1;
q__3.r = cs * s[i__4].r, q__3.i = cs * s[i__4].i;
q__1.r = q__2.r + q__3.r, q__1.i = q__2.i + q__3.i;
s[i__2].r = q__1.r, s[i__2].i = q__1.i;
/*< g = sn*real(e(k+1)) >*/
i__2 = k + 1;
g = sn * e[i__2].r;
/*< e(k+1) = cs*e(k+1) >*/
i__2 = k + 1;
i__3 = k + 1;
q__1.r = cs * e[i__3].r, q__1.i = cs * e[i__3].i;
e[i__2].r = q__1.r, e[i__2].i = q__1.i;
/*< >*/
if (wantu && k < *n) {
csrot_(n, &u[k * u_dim1 + 1], &c__1, &u[(k + 1) * u_dim1 + 1], &
c__1, &cs, &sn);
}
/*< 600 continue >*/
/* L600: */
}
/*< e(m-1) = cmplx(f,0.0e0) >*/
i__1 = m - 1;
q__1.r = f, q__1.i = (float)0.;
e[i__1].r = q__1.r, e[i__1].i = q__1.i;
/*< iter = iter + 1 >*/
++iter;
/*< go to 650 >*/
goto L650;
/* convergence. */
/*< 610 continue >*/
L610:
/* make the singular value positive */
/*< if (real(s(l)) .ge. 0.0e0) go to 620 >*/
i__1 = l;
if (s[i__1].r >= (float)0.) {
goto L620;
}
/*< s(l) = -s(l) >*/
i__1 = l;
i__2 = l;
q__1.r = -s[i__2].r, q__1.i = -s[i__2].i;
s[i__1].r = q__1.r, s[i__1].i = q__1.i;
/*< if (wantv) call cscal(p,(-1.0e0,0.0e0),v(1,l),1) >*/
if (wantv) {
cscal_(p, &c_b53, &v[l * v_dim1 + 1], &c__1);
}
/*< 620 continue >*/
L620:
/* order the singular value. */
/*< 630 if (l .eq. mm) go to 640 >*/
L630:
if (l == mm) {
goto L640;
}
/* ...exit */
/*< if (real(s(l)) .ge. real(s(l+1))) go to 640 >*/
i__1 = l;
i__2 = l + 1;
if (s[i__1].r >= s[i__2].r) {
goto L640;
}
/*< t = s(l) >*/
i__1 = l;
t.r = s[i__1].r, t.i = s[i__1].i;
/*< s(l) = s(l+1) >*/
i__1 = l;
i__2 = l + 1;
s[i__1].r = s[i__2].r, s[i__1].i = s[i__2].i;
/*< s(l+1) = t >*/
i__1 = l + 1;
s[i__1].r = t.r, s[i__1].i = t.i;
/*< >*/
if (wantv && l < *p) {
cswap_(p, &v[l * v_dim1 + 1], &c__1, &v[(l + 1) * v_dim1 + 1], &c__1);
}
/*< >*/
if (wantu && l < *n) {
cswap_(n, &u[l * u_dim1 + 1], &c__1, &u[(l + 1) * u_dim1 + 1], &c__1);
}
/*< l = l + 1 >*/
++l;
/*< go to 630 >*/
goto L630;
/*< 640 continue >*/
L640:
/*< iter = 0 >*/
iter = 0;
/*< m = m - 1 >*/
--m;
/*< 650 continue >*/
L650:
/*< go to 400 >*/
goto L400;
/*< 660 continue >*/
L660:
/*< return >*/
return 0;
/*< end >*/
} /* csvdc_ */
#ifdef __cplusplus
}
#endif
| eile/ITK | Modules/ThirdParty/VNL/src/vxl/v3p/netlib/linpack/csvdc.c | C | apache-2.0 | 39,375 |
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports Microsoft.CodeAnalysis.Editor.VisualBasic.KeywordHighlighting
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.KeywordHighlighting
Public Class WhileBlockHighlighterTests
Inherits AbstractVisualBasicKeywordHighlighterTests
Friend Overrides Function CreateHighlighter() As IHighlighter
Return New WhileBlockHighlighter()
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestWhileBlock1() As Task
Await TestAsync(<Text>
Class C
Sub M()
{|Cursor:[|While|]|} True
If x Then
[|Exit While|]
Else
[|Continue While|]
End If
[|End While|]
End Sub
End Class</Text>)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestWhileBlock2() As Task
Await TestAsync(<Text>
Class C
Sub M()
[|While|] True
If x Then
{|Cursor:[|Exit While|]|}
Else
[|Continue While|]
End If
[|End While|]
End Sub
End Class</Text>)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestWhileBlock3() As Task
Await TestAsync(<Text>
Class C
Sub M()
[|While|] True
If x Then
[|Exit While|]
Else
{|Cursor:[|Continue While|]|}
End If
[|End While|]
End Sub
End Class</Text>)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestWhileBlock4() As Task
Await TestAsync(<Text>
Class C
Sub M()
[|While|] True
If x Then
[|Exit While|]
Else
[|Continue While|]
End If
{|Cursor:[|End While|]|}
End Sub
End Class</Text>)
End Function
End Class
End Namespace
| bbarry/roslyn | src/EditorFeatures/VisualBasicTest/KeywordHighlighting/WhileBlockHighlighterTests.vb | Visual Basic | apache-2.0 | 2,001 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=constant.LC_PAPER.html">
</head>
<body>
<p>Redirecting to <a href="constant.LC_PAPER.html">constant.LC_PAPER.html</a>...</p>
<script>location.replace("constant.LC_PAPER.html" + location.search + location.hash);</script>
</body>
</html> | nitro-devs/nitro-game-engine | docs/libc/unix/notbsd/linux/other/LC_PAPER.v.html | HTML | apache-2.0 | 329 |
/*
* @author RocketTheme http://www.rockettheme.com
* @copyright Copyright (C) 2007 - 2013 RocketTheme, LLC
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
*/
var RokIEWarn=new Class({site:"sitename",initialize:function(f){var d=f;this.box=new Element("div",{id:"iewarn"}).inject(document.body,"top");var g=new Element("div").inject(this.box).set("html",d);
var e=this.toggle.bind(this);var c=new Element("a",{id:"iewarn_close"}).addEvents({mouseover:function(){this.addClass("cHover");},mouseout:function(){this.removeClass("cHover");
},click:function(){e();}}).inject(g,"top");this.height=document.id("iewarn").getSize().y;this.fx=new Fx.Morph(this.box,{duration:1000}).set({top:document.id("iewarn").getStyle("top").toInt()});
this.open=false;var b=Cookie.read("rokIEWarn"),a=this.height;if(!b||b=="open"){this.show();}else{this.fx.set({top:-a});}return;},show:function(){this.fx.start({top:0});
this.open=true;Cookie.write("rokIEWarn","open",{duration:7});},close:function(){var a=this.height;this.fx.start({top:-a});this.open=false;Cookie.write("rokIEWarn","close",{duration:7});
},status:function(){return this.open;},toggle:function(){if(this.open){this.close();}else{this.show();}}}); | devxive/nawala-rdk | src/lib_gantry/js/gantry-ie6warn.js | JavaScript | apache-2.0 | 1,220 |
from sentry.testutils.cases import RuleTestCase
from sentry.rules.conditions.first_seen_event import FirstSeenEventCondition
class FirstSeenEventConditionTest(RuleTestCase):
rule_cls = FirstSeenEventCondition
def test_applies_correctly(self):
rule = self.get_rule()
self.assertPasses(rule, self.event, is_new=True)
self.assertDoesNotPass(rule, self.event, is_new=False)
| felixbuenemann/sentry | tests/sentry/rules/conditions/test_first_seen_event.py | Python | bsd-3-clause | 407 |
<?php
/**
* Lithium: the most rad php framework
*
* @copyright Copyright 2013, Union of RAD (http://union-of-rad.org)
* @license http://opensource.org/licenses/bsd-license.php The BSD License
*/
namespace lithium\tests\cases\console\command\create;
use lithium\console\command\create\Model;
use lithium\console\Request;
use lithium\core\Libraries;
class ModelTest extends \lithium\test\Unit {
public $request;
protected $_backup = array();
protected $_testPath = null;
public function skip() {
$this->_testPath = Libraries::get(true, 'resources') . '/tmp/tests';
$this->skipIf(!is_writable($this->_testPath), "Path `{$this->_testPath}` is not writable.");
}
public function setUp() {
$this->classes = array('response' => 'lithium\tests\mocks\console\MockResponse');
$this->_backup['cwd'] = getcwd();
$this->_backup['_SERVER'] = $_SERVER;
$_SERVER['argv'] = array();
Libraries::add('create_test', array('path' => $this->_testPath . '/create_test'));
$this->request = new Request(array('input' => fopen('php://temp', 'w+')));
$this->request->params = array('library' => 'create_test');
}
public function tearDown() {
$_SERVER = $this->_backup['_SERVER'];
chdir($this->_backup['cwd']);
$this->_cleanUp();
}
public function testClass() {
$this->request->params = array(
'command' => 'model', 'action' => 'Posts'
);
$model = new Model(array(
'request' => $this->request, 'classes' => $this->classes
));
$expected = 'Posts';
$result = $model->invokeMethod('_class', array($this->request));
$this->assertEqual($expected, $result);
}
}
?> | kevin-jones/lithium | tests/cases/console/command/create/ModelTest.php | PHP | bsd-3-clause | 1,613 |
// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by SpecFlow (http://www.specflow.org/).
// SpecFlow Version:1.9.0.77
// SpecFlow Generator Version:1.9.0.0
// Runtime Version:4.0.30319.33440
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------
#region Designer generated code
#pragma warning disable
namespace Orchard.Specs
{
using TechTalk.SpecFlow;
[System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.9.0.77")]
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[NUnit.Framework.TestFixtureAttribute()]
[NUnit.Framework.DescriptionAttribute("DateTime Field")]
public partial class DateTimeFieldFeature
{
private static TechTalk.SpecFlow.ITestRunner testRunner;
#line 1 "DateTime.feature"
#line hidden
[NUnit.Framework.TestFixtureSetUpAttribute()]
public virtual void FeatureSetup()
{
testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "DateTime Field", " In order to add Date content to my types\r\nAs an administrator\r\n I want to crea" +
"te, edit and publish DateTime fields", ProgrammingLanguage.CSharp, ((string[])(null)));
testRunner.OnFeatureStart(featureInfo);
}
[NUnit.Framework.TestFixtureTearDownAttribute()]
public virtual void FeatureTearDown()
{
testRunner.OnFeatureEnd();
testRunner = null;
}
[NUnit.Framework.SetUpAttribute()]
public virtual void TestInitialize()
{
}
[NUnit.Framework.TearDownAttribute()]
public virtual void ScenarioTearDown()
{
testRunner.OnScenarioEnd();
}
public virtual void ScenarioSetup(TechTalk.SpecFlow.ScenarioInfo scenarioInfo)
{
testRunner.OnScenarioStart(scenarioInfo);
}
public virtual void ScenarioCleanup()
{
testRunner.CollectScenarioErrors();
}
[NUnit.Framework.TestAttribute()]
[NUnit.Framework.DescriptionAttribute("Creating and using Date fields")]
public virtual void CreatingAndUsingDateFields()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Creating and using Date fields", ((string[])(null)));
#line 6
this.ScenarioSetup(scenarioInfo);
#line 9
testRunner.Given("I have installed Orchard", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
#line 10
testRunner.And("I have installed \"Orchard.Fields\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 11
testRunner.When("I go to \"Admin/ContentTypes\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 12
testRunner.Then("I should see \"<a[^>]*>.*?Create new type</a>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 13
testRunner.When("I go to \"Admin/ContentTypes/Create\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table1.AddRow(new string[] {
"DisplayName",
"Event"});
table1.AddRow(new string[] {
"Name",
"Event"});
#line 14
testRunner.And("I fill in", ((string)(null)), table1, "And ");
#line 18
testRunner.And("I hit \"Create\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 19
testRunner.And("I go to \"Admin/ContentTypes/\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 20
testRunner.Then("I should see \"Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 23
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 24
testRunner.And("I follow \"Add Field\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table2 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table2.AddRow(new string[] {
"DisplayName",
"Date of the event"});
table2.AddRow(new string[] {
"Name",
"EventDate"});
table2.AddRow(new string[] {
"FieldTypeName",
"DateTimeField"});
#line 25
testRunner.And("I fill in", ((string)(null)), table2, "And ");
#line 30
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 31
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 32
testRunner.Then("I should see \"The \\\"Date of the event\\\" field has been added.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 35
testRunner.When("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 36
testRunner.Then("I should see \"Date of the event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
TechTalk.SpecFlow.Table table3 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table3.AddRow(new string[] {
"Event.EventDate.Date",
"31/01/2012"});
table3.AddRow(new string[] {
"Event.EventDate.Time",
"12:00 AM"});
#line 37
testRunner.When("I fill in", ((string)(null)), table3, "When ");
#line 41
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 42
testRunner.Then("I should see \"Date of the event is an invalid date and time\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 45
testRunner.When("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 46
testRunner.Then("I should see \"Date of the event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
TechTalk.SpecFlow.Table table4 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table4.AddRow(new string[] {
"Event.EventDate.Date",
"01/31/2012"});
#line 47
testRunner.When("I fill in", ((string)(null)), table4, "When ");
#line hidden
TechTalk.SpecFlow.Table table5 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table5.AddRow(new string[] {
"Event.EventDate.Time",
"12:00 AM"});
#line 50
testRunner.And("I fill in", ((string)(null)), table5, "And ");
#line 53
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 54
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 55
testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 56
testRunner.When("I go to \"Admin/Contents/List\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 57
testRunner.Then("I should see \"Date of the event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 58
testRunner.And("I should see \"1/31/2012 12:00\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 61
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table6 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table6.AddRow(new string[] {
"Fields[0].DateTimeFieldSettings.Hint",
"Enter the date of the event"});
#line 62
testRunner.And("I fill in", ((string)(null)), table6, "And ");
#line 65
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 66
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 67
testRunner.Then("I should see \"Enter the date of the event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 70
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table7 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table7.AddRow(new string[] {
"Fields[0].DateTimeFieldSettings.Display",
"DateOnly"});
#line 71
testRunner.And("I fill in", ((string)(null)), table7, "And ");
#line 74
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 75
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 76
testRunner.Then("I should see \"Event.EventDate.Date\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 77
testRunner.And("I should not see \"Event.EventDate.Time\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 80
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table8 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table8.AddRow(new string[] {
"Fields[0].DateTimeFieldSettings.Display",
"TimeOnly"});
#line 81
testRunner.And("I fill in", ((string)(null)), table8, "And ");
#line 84
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 85
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 86
testRunner.Then("I should see \"Event.EventDate.Time\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 87
testRunner.And("I should not see \"Event.EventDate.Date\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 90
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table9 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table9.AddRow(new string[] {
"Fields[0].DateTimeFieldSettings.Display",
"DateAndTime"});
table9.AddRow(new string[] {
"Fields[0].DateTimeFieldSettings.Required",
"true"});
#line 91
testRunner.And("I fill in", ((string)(null)), table9, "And ");
#line 95
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 96
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 97
testRunner.Then("I should see \"Event.EventDate.Date\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
TechTalk.SpecFlow.Table table10 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table10.AddRow(new string[] {
"Event.EventDate.Date",
"01/31/2012"});
table10.AddRow(new string[] {
"Event.EventDate.Time",
"12:00 AM"});
#line 98
testRunner.When("I fill in", ((string)(null)), table10, "When ");
#line 102
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 103
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 104
testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 105
testRunner.When("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table11 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table11.AddRow(new string[] {
"Event.EventDate.Date",
"01/31/2012"});
#line 106
testRunner.And("I fill in", ((string)(null)), table11, "And ");
#line 109
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 110
testRunner.Then("I should see \"Date of the event is required.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 111
testRunner.When("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table12 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table12.AddRow(new string[] {
"Event.EventDate.Time",
"12:00 AM"});
#line 112
testRunner.And("I fill in", ((string)(null)), table12, "And ");
#line 115
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 116
testRunner.Then("I should see \"Date of the event is required.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 119
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table13 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table13.AddRow(new string[] {
"Fields[0].DateTimeFieldSettings.Display",
"DateOnly"});
table13.AddRow(new string[] {
"Fields[0].DateTimeFieldSettings.Required",
"true"});
#line 120
testRunner.And("I fill in", ((string)(null)), table13, "And ");
#line 124
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 125
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 126
testRunner.Then("I should see \"Event.EventDate.Date\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 127
testRunner.When("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 128
testRunner.Then("I should see \"Date of the event is required.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 131
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table14 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table14.AddRow(new string[] {
"Fields[0].DateTimeFieldSettings.Display",
"TimeOnly"});
table14.AddRow(new string[] {
"Fields[0].DateTimeFieldSettings.Required",
"true"});
#line 132
testRunner.And("I fill in", ((string)(null)), table14, "And ");
#line 136
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 137
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 138
testRunner.Then("I should see \"Event.EventDate.Date\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 139
testRunner.When("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 140
testRunner.Then("I should see \"Date of the event is required.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
this.ScenarioCleanup();
}
[NUnit.Framework.TestAttribute()]
[NUnit.Framework.DescriptionAttribute("Creating and using date time fields in another culture")]
public virtual void CreatingAndUsingDateTimeFieldsInAnotherCulture()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Creating and using date time fields in another culture", ((string[])(null)));
#line 142
this.ScenarioSetup(scenarioInfo);
#line 145
testRunner.Given("I have installed Orchard", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
#line 146
testRunner.And("I have installed \"Orchard.Fields\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 147
testRunner.And("I have the file \"Content\\orchard.core.po\" in \"Core\\App_Data\\Localization\\fr-FR\\or" +
"chard.core.po\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 148
testRunner.When("I go to \"Admin/ContentTypes\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 149
testRunner.Then("I should see \"<a[^>]*>.*?Create new type</a>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 150
testRunner.When("I go to \"Admin/ContentTypes/Create\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table15 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table15.AddRow(new string[] {
"DisplayName",
"Event"});
table15.AddRow(new string[] {
"Name",
"Event"});
#line 151
testRunner.And("I fill in", ((string)(null)), table15, "And ");
#line 155
testRunner.And("I hit \"Create\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 156
testRunner.And("I go to \"Admin/ContentTypes/\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 157
testRunner.Then("I should see \"Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 160
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 161
testRunner.And("I follow \"Add Field\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table16 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table16.AddRow(new string[] {
"DisplayName",
"Date of the event"});
table16.AddRow(new string[] {
"Name",
"EventDate"});
table16.AddRow(new string[] {
"FieldTypeName",
"DateTimeField"});
#line 162
testRunner.And("I fill in", ((string)(null)), table16, "And ");
#line 167
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 168
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 169
testRunner.Then("I should see \"The \\\"Date of the event\\\" field has been added.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 172
testRunner.When("I have \"fr-FR\" as the default culture", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 173
testRunner.And("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table17 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table17.AddRow(new string[] {
"Fields[0].DateTimeFieldSettings.Display",
"DateAndTime"});
table17.AddRow(new string[] {
"Fields[0].DateTimeFieldSettings.Required",
"true"});
#line 174
testRunner.And("I fill in", ((string)(null)), table17, "And ");
#line 178
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 179
testRunner.When("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table18 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table18.AddRow(new string[] {
"Event.EventDate.Date",
"01/31/2012"});
table18.AddRow(new string[] {
"Event.EventDate.Time",
"12:00 AM"});
#line 180
testRunner.And("I fill in", ((string)(null)), table18, "And ");
#line 184
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 185
testRunner.Then("I should see \"Date of the event is an invalid date and time\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 186
testRunner.When("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table19 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table19.AddRow(new string[] {
"Event.EventDate.Date",
"31/01/2012"});
table19.AddRow(new string[] {
"Event.EventDate.Time",
"18:00"});
#line 187
testRunner.And("I fill in", ((string)(null)), table19, "And ");
#line 191
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 192
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 193
testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
this.ScenarioCleanup();
}
}
}
#pragma warning restore
#endregion
| the-only-brivad/HOPM | src/orchard.specs/DateTime.feature.cs | C# | bsd-3-clause | 23,611 |
require "helper"
describe Octokit::EnterpriseAdminClient::Orgs do
before do
Octokit.reset!
@admin_client = enterprise_admin_client
end
describe ".create_organization", :vcr do
it "creates a new organization" do
@admin_client.create_organization('SuchAGreatOrg', 'gjtorikian')
expect(@admin_client.last_response.status).to eq(201)
assert_requested :post, github_enterprise_url("admin/organizations")
end
end # .create_organization
end
| iainbeeston/octokit.rb | spec/octokit/enterprise_admin_client/orgs_spec.rb | Ruby | mit | 479 |
// Type definitions for es6-promise
// Project: https://github.com/jakearchibald/ES6-Promise
// Definitions by: François de Campredon <https://github.com/fdecampredon>, vvakame <https://github.com/vvakame>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface Thenable<T> {
then<U>(onFulfilled?: (value: T) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Thenable<U>;
then<U>(onFulfilled?: (value: T) => U | Thenable<U>, onRejected?: (error: any) => void): Thenable<U>;
}
declare class Promise<T> implements Thenable<T> {
/**
* If you call resolve in the body of the callback passed to the constructor,
* your promise is fulfilled with result object passed to resolve.
* If you call reject your promise is rejected with the object passed to reject.
* For consistency and debugging (eg stack traces), obj should be an instanceof Error.
* Any errors thrown in the constructor callback will be implicitly passed to reject().
*/
constructor(callback: (resolve : (value?: T | Thenable<T>) => void, reject: (error?: any) => void) => void);
/**
* onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
* Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
* Both callbacks have a single parameter , the fulfillment value or rejection reason.
* "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve.
* If an error is thrown in the callback, the returned promise rejects with that error.
*
* @param onFulfilled called when/if "promise" resolves
* @param onRejected called when/if "promise" rejects
*/
then<U>(onFulfilled?: (value: T) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Promise<U>;
then<U>(onFulfilled?: (value: T) => U | Thenable<U>, onRejected?: (error: any) => void): Promise<U>;
/**
* Sugar for promise.then(undefined, onRejected)
*
* @param onRejected called when/if "promise" rejects
*/
catch<U>(onRejected?: (error: any) => U | Thenable<U>): Promise<U>;
}
declare namespace Promise {
/**
* Make a new promise from the thenable.
* A thenable is promise-like in as far as it has a "then" method.
*/
function resolve<T>(value?: T | Thenable<T>): Promise<T>;
/**
* Make a promise that rejects to obj. For consistency and debugging (eg stack traces), obj should be an instanceof Error
*/
function reject(error: any): Promise<any>;
function reject<T>(error: T): Promise<T>;
/**
* Make a promise that fulfills when every item in the array fulfills, and rejects if (and when) any item rejects.
* the array passed to all can be a mixture of promise-like objects and other objects.
* The fulfillment value is an array (in order) of fulfillment values. The rejection value is the first rejection value.
*/
function all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable <T4>, T5 | Thenable<T5>, T6 | Thenable<T6>, T7 | Thenable<T7>, T8 | Thenable<T8>, T9 | Thenable<T9>, T10 | Thenable<T10>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
function all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable <T4>, T5 | Thenable<T5>, T6 | Thenable<T6>, T7 | Thenable<T7>, T8 | Thenable<T8>, T9 | Thenable<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
function all<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable <T4>, T5 | Thenable<T5>, T6 | Thenable<T6>, T7 | Thenable<T7>, T8 | Thenable<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
function all<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable <T4>, T5 | Thenable<T5>, T6 | Thenable<T6>, T7 | Thenable<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>;
function all<T1, T2, T3, T4, T5, T6>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable <T4>, T5 | Thenable<T5>, T6 | Thenable<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>;
function all<T1, T2, T3, T4, T5>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable <T4>, T5 | Thenable<T5>]): Promise<[T1, T2, T3, T4, T5]>;
function all<T1, T2, T3, T4>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable <T4>]): Promise<[T1, T2, T3, T4]>;
function all<T1, T2, T3>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>]): Promise<[T1, T2, T3]>;
function all<T1, T2>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>]): Promise<[T1, T2]>;
function all<T>(values: (T | Thenable<T>)[]): Promise<T[]>;
/**
* Make a Promise that fulfills when any item fulfills, and rejects if any item rejects.
*/
function race<T>(promises: (T | Thenable<T>)[]): Promise<T>;
}
declare module 'es6-promise' {
var foo: typeof Promise; // Temp variable to reference Promise in local context
namespace rsvp {
export var Promise: typeof foo;
export function polyfill(): void;
}
export = rsvp;
}
| AbraaoAlves/DefinitelyTyped | types/es6-promise/index.d.ts | TypeScript | mit | 5,199 |
<?php
/*
* This file is part of Respect/Validation.
*
* (c) Alexandre Gomes Gaigalas <alexandre@gaigalas.net>
*
* For the full copyright and license information, please view the "LICENSE.md"
* file that was distributed with this source code.
*/
namespace Respect\Validation\Rules\SubdivisionCode;
use Respect\Validation\Rules\AbstractSearcher;
/**
* Validator for Somalia subdivision code.
*
* ISO 3166-1 alpha-2: SO
*
* @link http://www.geonames.org/SO/administrative-division-somalia.html
*/
class SoSubdivisionCode extends AbstractSearcher
{
public $haystack = [
'AW', // Awdal
'BK', // Bakool
'BN', // Banaadir
'BR', // Bari
'BY', // Bay
'GA', // Galguduud
'GE', // Gedo
'HI', // Hiiraan
'JD', // Jubbada Dhexe
'JH', // Jubbada Hoose
'MU', // Mudug
'NU', // Nugaal
'SA', // Sanaag
'SD', // Shabeellaha Dhexe
'SH', // Shabeellaha Hoose
'SO', // Sool
'TO', // Togdheer
'WO', // Woqooyi Galbeed
];
public $compareIdentical = true;
}
| SiliconSouthTech/farmeazy | vendor/respect/validation/library/Rules/SubdivisionCode/SoSubdivisionCode.php | PHP | mit | 1,108 |
<?php
namespace Kunstmaan\GeneratorBundle\Generator;
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
/**
* Generates all classes/files for a new page
*/
class PageGenerator extends KunstmaanGenerator
{
/**
* @var BundleInterface
*/
private $bundle;
/**
* @var string
*/
private $entity;
/**
* @var string
*/
private $prefix;
/**
* @var array
*/
private $fields;
/**
* @var string
*/
private $template;
/**
* @var array
*/
private $sections;
/**
* @var array
*/
private $parentPages;
/**
* Generate the page.
*
* @param BundleInterface $bundle The bundle
* @param string $entity The entity name
* @param string $prefix The database prefix
* @param array $fields The fields
* @param string $template The page template
* @param array $sections The page sections
* @param array $parentPages The parent pages
*
* @throws \RuntimeException
*/
public function generate(
BundleInterface $bundle,
$entity,
$prefix,
array $fields,
$template,
array $sections,
array $parentPages
) {
$this->bundle = $bundle;
$this->entity = $entity;
$this->prefix = $prefix;
$this->fields = $fields;
$this->template = $template;
$this->sections = $sections;
$this->parentPages = $parentPages;
$this->generatePageEntity();
$this->generatePageFormType();
$this->generatePageTemplateConfiguration();
$this->updateParentPages();
}
/**
* Generate the page entity.
*
* @throws \RuntimeException
*/
private function generatePageEntity()
{
list($entityCode, $entityPath) = $this->generateEntity(
$this->bundle,
$this->entity,
$this->fields,
'Pages',
$this->prefix,
'Kunstmaan\NodeBundle\Entity\AbstractPage'
);
// Add implements HasPageTemplateInterface
$search = 'extends \Kunstmaan\NodeBundle\Entity\AbstractPage';
$entityCode = str_replace(
$search,
$search . ' implements \Kunstmaan\PagePartBundle\Helper\HasPageTemplateInterface',
$entityCode
);
// Add some extra functions in the generated entity :s
$params = array(
'bundle' => $this->bundle->getName(),
'page' => $this->entity,
'template' => substr($this->template, 0, strlen($this->template) - 4),
'sections' => array_map(
function ($val) {
return substr($val, 0, strlen($val) - 4);
},
$this->sections
),
'adminType' => '\\' . $this->bundle->getNamespace() . '\\Form\\Pages\\' . $this->entity . 'AdminType',
'namespace' => $this->registry->getAliasNamespace($this->bundle->getName()) . '\\Pages\\' . $this->entity
);
$extraCode = $this->render('/Entity/Pages/ExtraFunctions.php', $params);
$pos = strrpos($entityCode, '}');
$trimmed = substr($entityCode, 0, $pos);
$entityCode = $trimmed . $extraCode . "\n}";
// Write class to filesystem
$this->filesystem->mkdir(dirname($entityPath));
file_put_contents($entityPath, $entityCode);
$this->assistant->writeLine('Generating entity : <info>OK</info>');
}
/**
* Generate the admin form type entity.
*/
private function generatePageFormType()
{
$this->generateEntityAdminType(
$this->bundle,
$this->entity,
'Pages',
$this->fields,
'\Kunstmaan\NodeBundle\Form\PageAdminType'
);
$this->assistant->writeLine('Generating form type : <info>OK</info>');
}
/**
* Generate the page template -and pagepart configuration.
*/
private function generatePageTemplateConfiguration()
{
$this->installDefaultPageTemplates($this->bundle);
$this->installDefaultPagePartConfiguration($this->bundle);
$this->assistant->writeLine('Generating template configuration : <info>OK</info>');
}
/**
* Update the getPossibleChildTypes function of the parent Page classes
*/
private function updateParentPages()
{
$phpCode = " array(\n";
$phpCode .= " 'name' => '" . $this->entity . "',\n";
$phpCode .= " 'class'=> '" .
$this->bundle->getNamespace() .
"\\Entity\\Pages\\" . $this->entity . "'\n";
$phpCode .= " ),";
// When there is a BehatTestPage, we should also allow the new page as sub page
$behatTestPage = $this->bundle->getPath() . '/Entity/Pages/BehatTestPage.php';
if (file_exists($behatTestPage)) {
$this->parentPages[] = $behatTestPage;
}
foreach ($this->parentPages as $file) {
$data = file_get_contents($file);
$data = preg_replace(
'/(function\s*getPossibleChildTypes\s*\(\)\s*\{\s*return\s*array\s*\()/',
"$1\n$phpCode",
$data
);
file_put_contents($file, $data);
}
}
}
| Amrit01/KunstmaanBundlesCMS | src/Kunstmaan/GeneratorBundle/Generator/PageGenerator.php | PHP | mit | 5,521 |
/**
*
*/
var obj = {
num: 123,
str: 'hello',
};
obj.
| JonathanUsername/flow | newtests/autocomplete/foo.js | JavaScript | mit | 61 |
function error_log(message, message_type, destination, extra_headers) {
// http://kevin.vanzonneveld.net
// + original by: Paul Hutchinson (http://restaurantthing.com/)
// + revised by: Brett Zamir (http://brett-zamir.me)
// % note 1: The dependencies, mail(), syslog(), and file_put_contents()
// % note 1: are either not fullly implemented or implemented at all
// - depends on: mail
// - depends on: syslog
// - depends on: file_put_contents
// * example 1: error_log('Oops!');
// * returns 1: true
var that = this,
_sapi = function() { // SAPI logging (we treat console as the "server" logging; the
// syslog option could do so potentially as well)
if (!that.window.console || !that.window.console.log) {
return false;
}
that.window.console.log(message);
return true;
};
message_type = message_type || 0;
switch (message_type) {
case 1: // Email
var subject = 'PHP error_log message'; // Apparently no way to customize the subject
return this.mail(destination, subject, message, extra_headers);
case 2: // No longer an option in PHP, but had been to send via TCP/IP to 'destination' (name or IP:port)
// use socket_create() and socket_send()?
return false;
case 0: // syslog or file depending on ini
var log = this.php_js && this.php_js.ini && this.php_js.ini.error_log && this.php_js.ini.error_log.local_value;
if (!log) {
return _sapi();
}
if (log === 'syslog') {
return this.syslog(4, message); // presumably 'LOG_ERR' (4) is correct?
}
destination = log;
// Fall-through
case 3: // File logging
var ret = this.file_put_contents(destination, message, 8); // FILE_APPEND (8)
return ret === false ? false : true;
case 4: // SAPI logging
return _sapi();
default: // Unrecognized value
return false;
}
return false; // Shouldn't get here
}
| cigraphics/phpjs | experimental/errorfunc/error_log.js | JavaScript | mit | 2,020 |
namespace Nancy.Tests.Unit.Json
{
using System;
public class TestPrimitiveConverterType : IEquatable<TestPrimitiveConverterType>
{
public int Data;
public bool Equals(TestPrimitiveConverterType other)
{
if (other == null)
return false;
return (this.Data == other.Data);
}
public override bool Equals(object obj)
{
return this.Equals(obj as TestPrimitiveConverterType);
}
public override int GetHashCode()
{
return this.Data.GetHashCode();
}
}
}
| anton-gogolev/Nancy | test/Nancy.Tests/Unit/Json/TestPrimitiveConverterType.cs | C# | mit | 526 |
/*
*************************************************************************************
* Linux
* USB Host Controller Driver
*
* (c) Copyright 2006-2010, All winners Co,Ld.
* All Rights Reserved
*
* File Name : sw_udc_board.h
*
* Author : javen
*
* Description : °å¼¶¿ØÖÆ
*
* Notes :
*
* History :
* <author> <time> <version > <desc>
* javen 2010-12-20 1.0 create this file
*
*************************************************************************************
*/
#ifndef __SW_UDC_BOARD_H__
#define __SW_UDC_BOARD_H__
u32 open_usb_clock(sw_udc_io_t *sw_udc_io);
u32 close_usb_clock(sw_udc_io_t *sw_udc_io);
__s32 sw_udc_io_init(__u32 usbc_no, struct platform_device *pdev, sw_udc_io_t *sw_udc_io);
__s32 sw_udc_io_exit(__u32 usbc_no, struct platform_device *pdev, sw_udc_io_t *sw_udc_io);
#endif //__SW_UDC_BOARD_H__
| uei/enchantmoon_kernel | linux-3.0/drivers/usb/sun4i_usb/udc/sw_udc_board.h | C | gpl-2.0 | 968 |
# SPDX-License-Identifier: GPL-2.0
#
# Makefile for the Linux kernel device drivers.
#
# 15 Sep 2000, Christoph Hellwig <hch@infradead.org>
# Rewritten to use lists instead of if-statements.
#
obj-y += irqchip/
obj-y += bus/
obj-$(CONFIG_GENERIC_PHY) += phy/
# GPIO must come after pinctrl as gpios may need to mux pins etc
obj-$(CONFIG_PINCTRL) += pinctrl/
obj-$(CONFIG_GPIOLIB) += gpio/
obj-y += pwm/
obj-y += pci/
obj-$(CONFIG_PARISC) += parisc/
obj-$(CONFIG_RAPIDIO) += rapidio/
obj-y += video/
obj-y += idle/
# IPMI must come before ACPI in order to provide IPMI opregion support
obj-y += char/ipmi/
obj-$(CONFIG_ACPI) += acpi/
# PnP must come after ACPI since it will eventually need to check if acpi
# was used and do nothing if so
obj-$(CONFIG_PNP) += pnp/
obj-y += amba/
obj-y += clk/
# Many drivers will want to use DMA so this has to be made available
# really early.
obj-$(CONFIG_DMADEVICES) += dma/
# SOC specific infrastructure drivers.
obj-y += soc/
obj-$(CONFIG_VIRTIO) += virtio/
obj-$(CONFIG_VIRTIO_PCI_LIB) += virtio/
obj-$(CONFIG_VDPA) += vdpa/
obj-$(CONFIG_XEN) += xen/
# regulators early, since some subsystems rely on them to initialize
obj-$(CONFIG_REGULATOR) += regulator/
# reset controllers early, since gpu drivers might rely on them to initialize
obj-$(CONFIG_RESET_CONTROLLER) += reset/
# tty/ comes before char/ so that the VT console is the boot-time
# default.
obj-y += tty/
obj-y += char/
# iommu/ comes before gpu as gpu are using iommu controllers
obj-y += iommu/
# gpu/ comes after char for AGP vs DRM startup and after iommu
obj-y += gpu/
obj-$(CONFIG_CONNECTOR) += connector/
# i810fb and intelfb depend on char/agp/
obj-$(CONFIG_FB_I810) += video/fbdev/i810/
obj-$(CONFIG_FB_INTEL) += video/fbdev/intelfb/
obj-$(CONFIG_PARPORT) += parport/
obj-$(CONFIG_NVM) += lightnvm/
obj-y += base/ block/ misc/ mfd/ nfc/
obj-$(CONFIG_LIBNVDIMM) += nvdimm/
obj-$(CONFIG_DAX) += dax/
obj-$(CONFIG_CXL_BUS) += cxl/
obj-$(CONFIG_DMA_SHARED_BUFFER) += dma-buf/
obj-$(CONFIG_NUBUS) += nubus/
obj-y += macintosh/
obj-$(CONFIG_IDE) += ide/
obj-y += scsi/
obj-y += nvme/
obj-$(CONFIG_ATA) += ata/
obj-$(CONFIG_TARGET_CORE) += target/
obj-$(CONFIG_MTD) += mtd/
obj-$(CONFIG_SPI) += spi/
obj-$(CONFIG_SPMI) += spmi/
obj-$(CONFIG_HSI) += hsi/
obj-$(CONFIG_SLIMBUS) += slimbus/
obj-y += net/
obj-$(CONFIG_ATM) += atm/
obj-$(CONFIG_FUSION) += message/
obj-y += firewire/
obj-$(CONFIG_UIO) += uio/
obj-$(CONFIG_VFIO) += vfio/
obj-y += cdrom/
obj-y += auxdisplay/
obj-$(CONFIG_PCCARD) += pcmcia/
obj-$(CONFIG_DIO) += dio/
obj-$(CONFIG_SBUS) += sbus/
obj-$(CONFIG_ZORRO) += zorro/
obj-$(CONFIG_ATA_OVER_ETH) += block/aoe/
obj-$(CONFIG_PARIDE) += block/paride/
obj-$(CONFIG_TC) += tc/
obj-$(CONFIG_USB_PHY) += usb/
obj-$(CONFIG_USB) += usb/
obj-$(CONFIG_USB_SUPPORT) += usb/
obj-$(CONFIG_PCI) += usb/
obj-$(CONFIG_USB_GADGET) += usb/
obj-$(CONFIG_OF) += usb/
obj-$(CONFIG_SERIO) += input/serio/
obj-$(CONFIG_GAMEPORT) += input/gameport/
obj-$(CONFIG_INPUT) += input/
obj-$(CONFIG_RTC_LIB) += rtc/
obj-y += i2c/ i3c/ media/
obj-$(CONFIG_PPS) += pps/
obj-y += ptp/
obj-$(CONFIG_W1) += w1/
obj-y += power/
obj-$(CONFIG_HWMON) += hwmon/
obj-$(CONFIG_THERMAL) += thermal/
obj-$(CONFIG_WATCHDOG) += watchdog/
obj-$(CONFIG_MD) += md/
obj-$(CONFIG_BT) += bluetooth/
obj-$(CONFIG_ACCESSIBILITY) += accessibility/
obj-$(CONFIG_ISDN) += isdn/
obj-$(CONFIG_EDAC) += edac/
obj-$(CONFIG_EISA) += eisa/
obj-$(CONFIG_PM_OPP) += opp/
obj-$(CONFIG_CPU_FREQ) += cpufreq/
obj-$(CONFIG_CPU_IDLE) += cpuidle/
obj-y += mmc/
obj-$(CONFIG_MEMSTICK) += memstick/
obj-$(CONFIG_NEW_LEDS) += leds/
obj-$(CONFIG_INFINIBAND) += infiniband/
obj-y += firmware/
obj-$(CONFIG_CRYPTO) += crypto/
obj-$(CONFIG_SUPERH) += sh/
obj-y += clocksource/
obj-$(CONFIG_DCA) += dca/
obj-$(CONFIG_HID) += hid/
obj-$(CONFIG_PPC_PS3) += ps3/
obj-$(CONFIG_OF) += of/
obj-$(CONFIG_SSB) += ssb/
obj-$(CONFIG_BCMA) += bcma/
obj-$(CONFIG_VHOST_RING) += vhost/
obj-$(CONFIG_VHOST_IOTLB) += vhost/
obj-$(CONFIG_VHOST) += vhost/
obj-$(CONFIG_VLYNQ) += vlynq/
obj-$(CONFIG_GREYBUS) += greybus/
obj-$(CONFIG_COMEDI) += comedi/
obj-$(CONFIG_STAGING) += staging/
obj-y += platform/
obj-$(CONFIG_MAILBOX) += mailbox/
obj-$(CONFIG_HWSPINLOCK) += hwspinlock/
obj-$(CONFIG_REMOTEPROC) += remoteproc/
obj-$(CONFIG_RPMSG) += rpmsg/
obj-$(CONFIG_SOUNDWIRE) += soundwire/
# Virtualization drivers
obj-$(CONFIG_VIRT_DRIVERS) += virt/
obj-$(CONFIG_HYPERV) += hv/
obj-$(CONFIG_PM_DEVFREQ) += devfreq/
obj-$(CONFIG_EXTCON) += extcon/
obj-$(CONFIG_MEMORY) += memory/
obj-$(CONFIG_IIO) += iio/
obj-$(CONFIG_VME_BUS) += vme/
obj-$(CONFIG_IPACK_BUS) += ipack/
obj-$(CONFIG_NTB) += ntb/
obj-$(CONFIG_POWERCAP) += powercap/
obj-$(CONFIG_MCB) += mcb/
obj-$(CONFIG_PERF_EVENTS) += perf/
obj-$(CONFIG_RAS) += ras/
obj-$(CONFIG_USB4) += thunderbolt/
obj-$(CONFIG_CORESIGHT) += hwtracing/coresight/
obj-y += hwtracing/intel_th/
obj-$(CONFIG_STM) += hwtracing/stm/
obj-$(CONFIG_ANDROID) += android/
obj-$(CONFIG_NVMEM) += nvmem/
obj-$(CONFIG_FPGA) += fpga/
obj-$(CONFIG_FSI) += fsi/
obj-$(CONFIG_TEE) += tee/
obj-$(CONFIG_MULTIPLEXER) += mux/
obj-$(CONFIG_UNISYS_VISORBUS) += visorbus/
obj-$(CONFIG_SIOX) += siox/
obj-$(CONFIG_GNSS) += gnss/
obj-$(CONFIG_INTERCONNECT) += interconnect/
obj-$(CONFIG_COUNTER) += counter/
obj-$(CONFIG_MOST) += most/
| rperier/linux-rockchip | drivers/Makefile | Makefile | gpl-2.0 | 5,499 |
/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
// vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4:
#ident "$Id$"
/*
COPYING CONDITIONS NOTICE:
This program is free software; you can redistribute it and/or modify
it under the terms of version 2 of the GNU General Public License as
published by the Free Software Foundation, and provided that the
following conditions are met:
* Redistributions of source code must retain this COPYING
CONDITIONS NOTICE, the COPYRIGHT NOTICE (below), the
DISCLAIMER (below), the UNIVERSITY PATENT NOTICE (below), the
PATENT MARKING NOTICE (below), and the PATENT RIGHTS
GRANT (below).
* Redistributions in binary form must reproduce this COPYING
CONDITIONS NOTICE, the COPYRIGHT NOTICE (below), the
DISCLAIMER (below), the UNIVERSITY PATENT NOTICE (below), the
PATENT MARKING NOTICE (below), and the PATENT RIGHTS
GRANT (below) in the documentation and/or other materials
provided with the distribution.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
COPYRIGHT NOTICE:
TokuFT, Tokutek Fractal Tree Indexing Library.
Copyright (C) 2007-2013 Tokutek, Inc.
DISCLAIMER:
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
UNIVERSITY PATENT NOTICE:
The technology is licensed by the Massachusetts Institute of
Technology, Rutgers State University of New Jersey, and the Research
Foundation of State University of New York at Stony Brook under
United States of America Serial No. 11/760379 and to the patents
and/or patent applications resulting from it.
PATENT MARKING NOTICE:
This software is covered by US Patent No. 8,185,551.
This software is covered by US Patent No. 8,489,638.
PATENT RIGHTS GRANT:
"THIS IMPLEMENTATION" means the copyrightable works distributed by
Tokutek as part of the Fractal Tree project.
"PATENT CLAIMS" means the claims of patents that are owned or
licensable by Tokutek, both currently or in the future; and that in
the absence of this license would be infringed by THIS
IMPLEMENTATION or by using or running THIS IMPLEMENTATION.
"PATENT CHALLENGE" shall mean a challenge to the validity,
patentability, enforceability and/or non-infringement of any of the
PATENT CLAIMS or otherwise opposing any of the PATENT CLAIMS.
Tokutek hereby grants to you, for the term and geographical scope of
the PATENT CLAIMS, a non-exclusive, no-charge, royalty-free,
irrevocable (except as stated in this section) patent license to
make, have made, use, offer to sell, sell, import, transfer, and
otherwise run, modify, and propagate the contents of THIS
IMPLEMENTATION, where such license applies only to the PATENT
CLAIMS. This grant does not include claims that would be infringed
only as a consequence of further modifications of THIS
IMPLEMENTATION. If you or your agent or licensee institute or order
or agree to the institution of patent litigation against any entity
(including a cross-claim or counterclaim in a lawsuit) alleging that
THIS IMPLEMENTATION constitutes direct or contributory patent
infringement, or inducement of patent infringement, then any rights
granted to you under this License shall terminate as of the date
such litigation is filed. If you or your agent or exclusive
licensee institute or order or agree to the institution of a PATENT
CHALLENGE, then Tokutek may terminate any rights granted to you
under this License.
*/
#pragma once
#ident "Copyright (c) 2007-2013 Tokutek Inc. All rights reserved."
#include "cachetable/cachetable-internal.h"
//
// Dummy callbacks for checkpointing
//
static void dummy_log_fassociate(CACHEFILE UU(cf), void* UU(p)) { }
static void dummy_close_usr(CACHEFILE UU(cf), int UU(i), void* UU(p), bool UU(b), LSN UU(lsn)) { }
static void dummy_free_usr(CACHEFILE UU(cf), void* UU(p)) { }
static void dummy_chckpnt_usr(CACHEFILE UU(cf), int UU(i), void* UU(p)) { }
static void dummy_begin(LSN UU(lsn), void* UU(p)) { }
static void dummy_end(CACHEFILE UU(cf), int UU(i), void* UU(p)) { }
static void dummy_note_pin(CACHEFILE UU(cf), void* UU(p)) { }
static void dummy_note_unpin(CACHEFILE UU(cf), void* UU(p)) { }
//
// Helper function to set dummy functions in given cachefile.
//
static UU() void
create_dummy_functions(CACHEFILE cf)
{
void *ud = NULL;
toku_cachefile_set_userdata(cf,
ud,
&dummy_log_fassociate,
&dummy_close_usr,
&dummy_free_usr,
&dummy_chckpnt_usr,
&dummy_begin,
&dummy_end,
&dummy_note_pin,
&dummy_note_unpin);
};
| louishust/mysql5.6.14_tokudb | storage/tokudb/ft-index/ft/tests/cachetable-test.h | C | gpl-2.0 | 5,186 |
/*
* amrnb audio input device
*
* Copyright (C) 2008 Google, Inc.
* Copyright (C) 2008 HTC Corporation
* Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/miscdevice.h>
#include <linux/uaccess.h>
#include <linux/sched.h>
#include <linux/wait.h>
#include <linux/dma-mapping.h>
#include <linux/msm_audio_7X30.h>
#include <linux/msm_audio_amrnb.h>
#include <asm/atomic.h>
#include <asm/ioctls.h>
#include <mach/msm_adsp.h>
#include <mach/qdsp5v2/qdsp5audreccmdi.h>
#include <mach/qdsp5v2/qdsp5audrecmsg.h>
#include <mach/qdsp5v2/audpreproc.h>
#include <mach/qdsp5v2/audio_dev_ctl.h>
#include <mach/debug_mm.h>
/* FRAME_NUM must be a power of two */
#define FRAME_NUM (8)
#define FRAME_SIZE (22 * 2) /* 36 bytes data */
#define DMASZ (FRAME_SIZE * FRAME_NUM)
struct buffer {
void *data;
uint32_t size;
uint32_t read;
uint32_t addr;
};
struct audio_in {
struct buffer in[FRAME_NUM];
spinlock_t dsp_lock;
atomic_t in_bytes;
atomic_t in_samples;
struct mutex lock;
struct mutex read_lock;
wait_queue_head_t wait;
wait_queue_head_t wait_enable;
struct msm_adsp_module *audrec;
/* configuration to use on next enable */
uint32_t buffer_size; /* Frame size (36 bytes) */
uint32_t enc_type;
int dtx_mode;
uint32_t frame_format;
uint32_t used_mode;
uint32_t rec_mode;
uint32_t dsp_cnt;
uint32_t in_head; /* next buffer dsp will write */
uint32_t in_tail; /* next buffer read() will read */
uint32_t in_count; /* number of buffers available to read() */
uint32_t mode;
const char *module_name;
unsigned queue_ids;
uint16_t enc_id;
uint16_t source; /* Encoding source bit mask */
uint32_t device_events;
uint32_t in_call;
uint32_t dev_cnt;
int voice_state;
spinlock_t dev_lock;
/* data allocated for various buffers */
char *data;
dma_addr_t phys;
int opened;
int enabled;
int running;
int stopped; /* set when stopped, cleared on flush */
};
struct audio_frame {
uint16_t frame_count_lsw;
uint16_t frame_count_msw;
uint16_t frame_length;
uint16_t erased_pcm;
unsigned char raw_bitstream[]; /* samples */
} __attribute__((packed));
/* Audrec Queue command sent macro's */
#define audrec_send_bitstreamqueue(audio, cmd, len) \
msm_adsp_write(audio->audrec, ((audio->queue_ids & 0xFFFF0000) >> 16),\
cmd, len)
#define audrec_send_audrecqueue(audio, cmd, len) \
msm_adsp_write(audio->audrec, (audio->queue_ids & 0x0000FFFF),\
cmd, len)
struct audio_in the_audio_amrnb_in;
/* DSP command send functions */
static int audamrnb_in_enc_config(struct audio_in *audio, int enable);
static int audamrnb_in_param_config(struct audio_in *audio);
static int audamrnb_in_mem_config(struct audio_in *audio);
static int audamrnb_in_record_config(struct audio_in *audio, int enable);
static int audamrnb_dsp_read_buffer(struct audio_in *audio, uint32_t read_cnt);
static void audamrnb_in_get_dsp_frames(struct audio_in *audio);
static void audamrnb_in_flush(struct audio_in *audio);
static void amrnb_in_listener(u32 evt_id, union auddev_evt_data *evt_payload,
void *private_data)
{
struct audio_in *audio = (struct audio_in *) private_data;
unsigned long flags;
MM_DBG("evt_id = 0x%8x\n", evt_id);
switch (evt_id) {
case AUDDEV_EVT_DEV_RDY: {
MM_DBG("AUDDEV_EVT_DEV_RDY\n");
spin_lock_irqsave(&audio->dev_lock, flags);
audio->dev_cnt++;
if (!audio->in_call)
audio->source |= (0x1 << evt_payload->routing_id);
spin_unlock_irqrestore(&audio->dev_lock, flags);
if ((audio->running == 1) && (audio->enabled == 1))
audamrnb_in_record_config(audio, 1);
break;
}
case AUDDEV_EVT_DEV_RLS: {
MM_DBG("AUDDEV_EVT_DEV_RLS\n");
spin_lock_irqsave(&audio->dev_lock, flags);
audio->dev_cnt--;
if (!audio->in_call)
audio->source &= ~(0x1 << evt_payload->routing_id);
spin_unlock_irqrestore(&audio->dev_lock, flags);
if ((!audio->running) || (!audio->enabled))
break;
/* Turn of as per source */
if (audio->source)
audamrnb_in_record_config(audio, 1);
else
/* Turn off all */
audamrnb_in_record_config(audio, 0);
break;
}
case AUDDEV_EVT_VOICE_STATE_CHG: {
MM_DBG("AUDDEV_EVT_VOICE_STATE_CHG, state = %d\n",
evt_payload->voice_state);
audio->voice_state = evt_payload->voice_state;
if (audio->in_call && audio->running) {
if (audio->voice_state == VOICE_STATE_INCALL)
audamrnb_in_record_config(audio, 1);
else if (audio->voice_state == VOICE_STATE_OFFCALL) {
audamrnb_in_record_config(audio, 0);
wake_up(&audio->wait);
}
}
break;
}
default:
MM_AUD_ERR("wrong event %d\n", evt_id);
break;
}
}
/* ------------------- dsp preproc event handler--------------------- */
static void audpreproc_dsp_event(void *data, unsigned id, void *msg)
{
struct audio_in *audio = data;
switch (id) {
case AUDPREPROC_ERROR_MSG: {
struct audpreproc_err_msg *err_msg = msg;
MM_AUD_ERR("ERROR_MSG: stream id %d err idx %d\n",
err_msg->stream_id, err_msg->aud_preproc_err_idx);
/* Error case */
wake_up(&audio->wait_enable);
break;
}
case AUDPREPROC_CMD_CFG_DONE_MSG: {
MM_DBG("CMD_CFG_DONE_MSG \n");
break;
}
case AUDPREPROC_CMD_ENC_CFG_DONE_MSG: {
struct audpreproc_cmd_enc_cfg_done_msg *enc_cfg_msg = msg;
MM_DBG("CMD_ENC_CFG_DONE_MSG: stream id %d enc type \
0x%8x\n", enc_cfg_msg->stream_id,
enc_cfg_msg->rec_enc_type);
/* Encoder enable success */
if (enc_cfg_msg->rec_enc_type & ENCODE_ENABLE)
audamrnb_in_param_config(audio);
else { /* Encoder disable success */
audio->running = 0;
audamrnb_in_record_config(audio, 0);
}
break;
}
case AUDPREPROC_CMD_ENC_PARAM_CFG_DONE_MSG: {
MM_DBG("CMD_ENC_PARAM_CFG_DONE_MSG \n");
audamrnb_in_mem_config(audio);
break;
}
case AUDPREPROC_AFE_CMD_AUDIO_RECORD_CFG_DONE_MSG: {
MM_DBG("AFE_CMD_AUDIO_RECORD_CFG_DONE_MSG \n");
wake_up(&audio->wait_enable);
break;
}
default:
MM_AUD_ERR("Unknown Event id %d\n", id);
}
}
/* ------------------- dsp audrec event handler--------------------- */
static void audrec_dsp_event(void *data, unsigned id, size_t len,
void (*getevent)(void *ptr, size_t len))
{
struct audio_in *audio = data;
switch (id) {
case AUDREC_CMD_MEM_CFG_DONE_MSG: {
MM_DBG("CMD_MEM_CFG_DONE MSG DONE\n");
audio->running = 1;
if ((!audio->in_call && (audio->dev_cnt > 0)) ||
(audio->in_call &&
(audio->voice_state == VOICE_STATE_INCALL)))
audamrnb_in_record_config(audio, 1);
break;
}
case AUDREC_FATAL_ERR_MSG: {
struct audrec_fatal_err_msg fatal_err_msg;
getevent(&fatal_err_msg, AUDREC_FATAL_ERR_MSG_LEN);
MM_AUD_ERR("FATAL_ERR_MSG: err id %d\n",
fatal_err_msg.audrec_err_id);
/* Error stop the encoder */
audio->stopped = 1;
wake_up(&audio->wait);
break;
}
case AUDREC_UP_PACKET_READY_MSG: {
struct audrec_up_pkt_ready_msg pkt_ready_msg;
getevent(&pkt_ready_msg, AUDREC_UP_PACKET_READY_MSG_LEN);
MM_DBG("UP_PACKET_READY_MSG: write cnt lsw %d \
write cnt msw %d read cnt lsw %d read cnt msw %d \n",\
pkt_ready_msg.audrec_packet_write_cnt_lsw, \
pkt_ready_msg.audrec_packet_write_cnt_msw, \
pkt_ready_msg.audrec_up_prev_read_cnt_lsw, \
pkt_ready_msg.audrec_up_prev_read_cnt_msw);
audamrnb_in_get_dsp_frames(audio);
break;
}
default:
MM_AUD_ERR("Unknown Event id %d\n", id);
}
}
static void audamrnb_in_get_dsp_frames(struct audio_in *audio)
{
struct audio_frame *frame;
uint32_t index;
unsigned long flags;
index = audio->in_head;
frame = (void *) (((char *)audio->in[index].data) - \
sizeof(*frame));
spin_lock_irqsave(&audio->dsp_lock, flags);
audio->in[index].size = frame->frame_length;
/* statistics of read */
atomic_add(audio->in[index].size, &audio->in_bytes);
atomic_add(1, &audio->in_samples);
audio->in_head = (audio->in_head + 1) & (FRAME_NUM - 1);
/* If overflow, move the tail index foward. */
if (audio->in_head == audio->in_tail)
audio->in_tail = (audio->in_tail + 1) & (FRAME_NUM - 1);
else
audio->in_count++;
audamrnb_dsp_read_buffer(audio, audio->dsp_cnt++);
spin_unlock_irqrestore(&audio->dsp_lock, flags);
wake_up(&audio->wait);
}
struct msm_adsp_ops audrec_amrnb_adsp_ops = {
.event = audrec_dsp_event,
};
static int audamrnb_in_enc_config(struct audio_in *audio, int enable)
{
struct audpreproc_audrec_cmd_enc_cfg cmd;
memset(&cmd, 0, sizeof(cmd));
cmd.cmd_id = AUDPREPROC_AUDREC_CMD_ENC_CFG;
cmd.stream_id = audio->enc_id;
if (enable)
cmd.audrec_enc_type = audio->enc_type | ENCODE_ENABLE;
else
cmd.audrec_enc_type &= ~(ENCODE_ENABLE);
return audpreproc_send_audreccmdqueue(&cmd, sizeof(cmd));
}
static int audamrnb_in_param_config(struct audio_in *audio)
{
struct audpreproc_audrec_cmd_parm_cfg_amrnb cmd;
memset(&cmd, 0, sizeof(cmd));
cmd.common.cmd_id = AUDPREPROC_AUDREC_CMD_PARAM_CFG;
cmd.common.stream_id = audio->enc_id;
cmd.dtx_mode = audio->dtx_mode;
cmd.test_mode = -1; /* Default set to -1 */
cmd.used_mode = audio->used_mode;
return audpreproc_send_audreccmdqueue(&cmd, sizeof(cmd));
}
/* To Do: msm_snddev_route_enc(audio->enc_id); */
static int audamrnb_in_record_config(struct audio_in *audio, int enable)
{
struct audpreproc_afe_cmd_audio_record_cfg cmd;
memset(&cmd, 0, sizeof(cmd));
cmd.cmd_id = AUDPREPROC_AFE_CMD_AUDIO_RECORD_CFG;
cmd.stream_id = audio->enc_id;
if (enable)
cmd.destination_activity = AUDIO_RECORDING_TURN_ON;
else
cmd.destination_activity = AUDIO_RECORDING_TURN_OFF;
cmd.source_mix_mask = audio->source;
if (audio->enc_id == 2) {
if ((cmd.source_mix_mask &
INTERNAL_CODEC_TX_SOURCE_MIX_MASK) ||
(cmd.source_mix_mask & AUX_CODEC_TX_SOURCE_MIX_MASK) ||
(cmd.source_mix_mask & VOICE_UL_SOURCE_MIX_MASK) ||
(cmd.source_mix_mask & VOICE_DL_SOURCE_MIX_MASK)) {
cmd.pipe_id = SOURCE_PIPE_1;
}
if (cmd.source_mix_mask &
AUDPP_A2DP_PIPE_SOURCE_MIX_MASK)
cmd.pipe_id |= SOURCE_PIPE_0;
}
return audpreproc_send_audreccmdqueue(&cmd, sizeof(cmd));
}
static int audamrnb_in_mem_config(struct audio_in *audio)
{
struct audrec_cmd_arecmem_cfg cmd;
uint16_t *data = (void *) audio->data;
int n;
memset(&cmd, 0, sizeof(cmd));
cmd.cmd_id = AUDREC_CMD_MEM_CFG_CMD;
cmd.audrec_up_pkt_intm_count = 1;
cmd.audrec_ext_pkt_start_addr_msw = audio->phys >> 16;
cmd.audrec_ext_pkt_start_addr_lsw = audio->phys;
cmd.audrec_ext_pkt_buf_number = FRAME_NUM;
/* prepare buffer pointers:
* 36 bytes amrnb packet + 4 halfword header
*/
for (n = 0; n < FRAME_NUM; n++) {
audio->in[n].data = data + 4;
data += (FRAME_SIZE/2); /* word increment */
MM_DBG("0x%8x\n", (int)(audio->in[n].data - 8));
}
return audrec_send_audrecqueue(audio, &cmd, sizeof(cmd));
}
static int audamrnb_dsp_read_buffer(struct audio_in *audio, uint32_t read_cnt)
{
struct up_audrec_packet_ext_ptr cmd;
memset(&cmd, 0, sizeof(cmd));
cmd.cmd_id = UP_AUDREC_PACKET_EXT_PTR;
cmd.audrec_up_curr_read_count_msw = read_cnt >> 16;
cmd.audrec_up_curr_read_count_lsw = read_cnt;
return audrec_send_bitstreamqueue(audio, &cmd, sizeof(cmd));
}
/* must be called with audio->lock held */
static int audamrnb_in_enable(struct audio_in *audio)
{
if (audio->enabled)
return 0;
if (audpreproc_enable(audio->enc_id, &audpreproc_dsp_event, audio)) {
MM_AUD_ERR("msm_adsp_enable(audpreproc) failed\n");
return -ENODEV;
}
if (msm_adsp_enable(audio->audrec)) {
MM_AUD_ERR("msm_adsp_enable(audrec) failed\n");
audpreproc_disable(audio->enc_id, audio);
return -ENODEV;
}
audio->enabled = 1;
audamrnb_in_enc_config(audio, 1);
return 0;
}
/* must be called with audio->lock held */
static int audamrnb_in_disable(struct audio_in *audio)
{
if (audio->enabled) {
audio->enabled = 0;
audamrnb_in_enc_config(audio, 0);
wake_up(&audio->wait);
wait_event_interruptible_timeout(audio->wait_enable,
audio->running == 0, 1*HZ);
msm_adsp_disable(audio->audrec);
audpreproc_disable(audio->enc_id, audio);
}
return 0;
}
static void audamrnb_in_flush(struct audio_in *audio)
{
int i;
audio->dsp_cnt = 0;
audio->in_head = 0;
audio->in_tail = 0;
audio->in_count = 0;
for (i = 0; i < FRAME_NUM; i++) {
audio->in[i].size = 0;
audio->in[i].read = 0;
}
MM_DBG("in_bytes %d\n", atomic_read(&audio->in_bytes));
MM_DBG("in_samples %d\n", atomic_read(&audio->in_samples));
atomic_set(&audio->in_bytes, 0);
atomic_set(&audio->in_samples, 0);
}
/* ------------------- device --------------------- */
static long audamrnb_in_ioctl(struct file *file,
unsigned int cmd, unsigned long arg)
{
struct audio_in *audio = file->private_data;
int rc = 0;
if (cmd == AUDIO_GET_STATS) {
struct msm_audio_stats stats;
stats.byte_count = atomic_read(&audio->in_bytes);
stats.sample_count = atomic_read(&audio->in_samples);
if (copy_to_user((void *) arg, &stats, sizeof(stats)))
return -EFAULT;
return rc;
}
mutex_lock(&audio->lock);
switch (cmd) {
case AUDIO_START: {
uint32_t freq;
freq = 48000;
MM_DBG("AUDIO_START\n");
if (audio->in_call && (audio->voice_state !=
VOICE_STATE_INCALL)) {
rc = -EPERM;
break;
}
rc = msm_snddev_request_freq(&freq, audio->enc_id,
SNDDEV_CAP_TX, AUDDEV_CLNT_ENC);
MM_DBG("sample rate configured %d\n", freq);
if (rc < 0) {
MM_DBG(" Sample rate can not be set, return code %d\n",
rc);
msm_snddev_withdraw_freq(audio->enc_id,
SNDDEV_CAP_TX, AUDDEV_CLNT_ENC);
MM_DBG("msm_snddev_withdraw_freq\n");
break;
}
rc = audamrnb_in_enable(audio);
if (!rc) {
rc =
wait_event_interruptible_timeout(audio->wait_enable,
audio->running != 0, 1*HZ);
MM_DBG("state %d rc = %d\n", audio->running, rc);
if (audio->running == 0)
rc = -ENODEV;
else
rc = 0;
}
audio->stopped = 0;
break;
}
case AUDIO_STOP: {
rc = audamrnb_in_disable(audio);
rc = msm_snddev_withdraw_freq(audio->enc_id,
SNDDEV_CAP_TX, AUDDEV_CLNT_ENC);
MM_DBG("msm_snddev_withdraw_freq\n");
audio->stopped = 1;
break;
}
case AUDIO_FLUSH: {
if (audio->stopped) {
/* Make sure we're stopped and we wake any threads
* that might be blocked holding the read_lock.
* While audio->stopped read threads will always
* exit immediately.
*/
wake_up(&audio->wait);
mutex_lock(&audio->read_lock);
audamrnb_in_flush(audio);
mutex_unlock(&audio->read_lock);
}
break;
}
case AUDIO_SET_STREAM_CONFIG: {
struct msm_audio_stream_config cfg;
if (copy_from_user(&cfg, (void *) arg, sizeof(cfg))) {
rc = -EFAULT;
break;
}
/* Allow only single frame */
if (cfg.buffer_size != (FRAME_SIZE - 8))
rc = -EINVAL;
else
audio->buffer_size = cfg.buffer_size;
break;
}
case AUDIO_GET_STREAM_CONFIG: {
struct msm_audio_stream_config cfg;
memset(&cfg, 0, sizeof(cfg));
cfg.buffer_size = audio->buffer_size;
cfg.buffer_count = FRAME_NUM;
if (copy_to_user((void *) arg, &cfg, sizeof(cfg)))
rc = -EFAULT;
break;
}
case AUDIO_GET_AMRNB_ENC_CONFIG_V2: {
struct msm_audio_amrnb_enc_config_v2 cfg;
memset(&cfg, 0, sizeof(cfg));
cfg.dtx_enable = ((audio->dtx_mode == -1) ? 1 : 0);
cfg.band_mode = audio->used_mode;
cfg.frame_format = audio->frame_format;
if (copy_to_user((void *) arg, &cfg, sizeof(cfg)))
rc = -EFAULT;
break;
}
case AUDIO_SET_AMRNB_ENC_CONFIG_V2: {
struct msm_audio_amrnb_enc_config_v2 cfg;
if (copy_from_user(&cfg, (void *) arg, sizeof(cfg))) {
rc = -EFAULT;
break;
}
/* DSP does not support any other than default format */
if (audio->frame_format != cfg.frame_format) {
rc = -EINVAL;
break;
}
if (cfg.dtx_enable == 0)
audio->dtx_mode = 0;
else if (cfg.dtx_enable == 1)
audio->dtx_mode = -1;
else {
rc = -EINVAL;
break;
}
audio->used_mode = cfg.band_mode;
break;
}
case AUDIO_SET_INCALL: {
struct msm_voicerec_mode cfg;
unsigned long flags;
if (copy_from_user(&cfg, (void *) arg, sizeof(cfg))) {
rc = -EFAULT;
break;
}
if (cfg.rec_mode != VOC_REC_BOTH &&
cfg.rec_mode != VOC_REC_UPLINK &&
cfg.rec_mode != VOC_REC_DOWNLINK) {
MM_AUD_ERR("invalid rec_mode\n");
rc = -EINVAL;
break;
} else {
spin_lock_irqsave(&audio->dev_lock, flags);
if (cfg.rec_mode == VOC_REC_UPLINK)
audio->source = VOICE_UL_SOURCE_MIX_MASK;
else if (cfg.rec_mode == VOC_REC_DOWNLINK)
audio->source = VOICE_DL_SOURCE_MIX_MASK;
else
audio->source = VOICE_DL_SOURCE_MIX_MASK |
VOICE_UL_SOURCE_MIX_MASK ;
audio->in_call = 1;
spin_unlock_irqrestore(&audio->dev_lock, flags);
}
break;
}
case AUDIO_GET_SESSION_ID: {
if (copy_to_user((void *) arg, &audio->enc_id,
sizeof(unsigned short))) {
rc = -EFAULT;
}
break;
}
default:
rc = -EINVAL;
}
mutex_unlock(&audio->lock);
return rc;
}
static ssize_t audamrnb_in_read(struct file *file,
char __user *buf,
size_t count, loff_t *pos)
{
struct audio_in *audio = file->private_data;
unsigned long flags;
const char __user *start = buf;
void *data;
uint32_t index;
uint32_t size;
int rc = 0;
mutex_lock(&audio->read_lock);
while (count > 0) {
rc = wait_event_interruptible(
audio->wait, (audio->in_count > 0) || audio->stopped
|| (audio->in_call && audio->running &&
(audio->voice_state == VOICE_STATE_OFFCALL)));
if (rc < 0)
break;
if (!audio->in_count) {
if (audio->stopped) {
rc = 0;/* End of File */
break;
} else if (audio->in_call && audio->running &&
(audio->voice_state == VOICE_STATE_OFFCALL)) {
MM_DBG("Not Permitted Voice Terminated\n");
rc = -EPERM; /* Voice Call stopped */
break;
}
}
index = audio->in_tail;
data = (uint8_t *) audio->in[index].data;
size = audio->in[index].size;
if (count >= size) {
if (copy_to_user(buf, data, size)) {
rc = -EFAULT;
break;
}
spin_lock_irqsave(&audio->dsp_lock, flags);
if (index != audio->in_tail) {
/* overrun -- data is
* invalid and we need to retry */
spin_unlock_irqrestore(&audio->dsp_lock, flags);
continue;
}
audio->in[index].size = 0;
audio->in_tail = (audio->in_tail + 1) & (FRAME_NUM - 1);
audio->in_count--;
spin_unlock_irqrestore(&audio->dsp_lock, flags);
count -= size;
buf += size;
} else {
MM_AUD_ERR("short read\n");
break;
}
}
mutex_unlock(&audio->read_lock);
if (buf > start)
return buf - start;
return rc;
}
static ssize_t audamrnb_in_write(struct file *file,
const char __user *buf,
size_t count, loff_t *pos)
{
return -EINVAL;
}
static int audamrnb_in_release(struct inode *inode, struct file *file)
{
struct audio_in *audio = file->private_data;
MM_DBG("\n");
mutex_lock(&audio->lock);
audio->in_call = 0;
/* with draw frequency for session
incase not stopped the driver */
msm_snddev_withdraw_freq(audio->enc_id, SNDDEV_CAP_TX,
AUDDEV_CLNT_ENC);
auddev_unregister_evt_listner(AUDDEV_CLNT_ENC, audio->enc_id);
audamrnb_in_disable(audio);
audamrnb_in_flush(audio);
msm_adsp_put(audio->audrec);
audpreproc_aenc_free(audio->enc_id);
audio->audrec = NULL;
audio->opened = 0;
mutex_unlock(&audio->lock);
return 0;
}
static int audamrnb_in_open(struct inode *inode, struct file *file)
{
struct audio_in *audio = &the_audio_amrnb_in;
int rc;
int encid;
mutex_lock(&audio->lock);
if (audio->opened) {
rc = -EBUSY;
goto done;
}
if ((file->f_mode & FMODE_WRITE) &&
(file->f_mode & FMODE_READ)) {
rc = -EACCES;
MM_AUD_ERR("Non tunnel encoding is not supported\n");
goto done;
} else if (!(file->f_mode & FMODE_WRITE) &&
(file->f_mode & FMODE_READ)) {
audio->mode = MSM_AUD_ENC_MODE_TUNNEL;
MM_DBG("Opened for tunnel mode encoding\n");
} else {
rc = -EACCES;
goto done;
}
/* Settings will be re-config at AUDIO_SET_CONFIG,
* but at least we need to have initial config
*/
audio->buffer_size = (FRAME_SIZE - 8);
audio->enc_type = ENC_TYPE_AMRNB | audio->mode;
audio->dtx_mode = -1;
audio->frame_format = 0;
audio->used_mode = 7; /* Bit Rate 12.2 kbps MR122 */
encid = audpreproc_aenc_alloc(audio->enc_type, &audio->module_name,
&audio->queue_ids);
if (encid < 0) {
MM_AUD_ERR("No free encoder available\n");
rc = -ENODEV;
goto done;
}
audio->enc_id = encid;
rc = msm_adsp_get(audio->module_name, &audio->audrec,
&audrec_amrnb_adsp_ops, audio);
if (rc) {
audpreproc_aenc_free(audio->enc_id);
goto done;
}
audio->stopped = 0;
audio->source = 0;
audamrnb_in_flush(audio);
audio->device_events = AUDDEV_EVT_DEV_RDY | AUDDEV_EVT_DEV_RLS |
AUDDEV_EVT_VOICE_STATE_CHG;
audio->voice_state = VOICE_STATE_INCALL;
rc = auddev_register_evt_listner(audio->device_events,
AUDDEV_CLNT_ENC, audio->enc_id,
amrnb_in_listener, (void *) audio);
if (rc) {
MM_AUD_ERR("failed to register device event listener\n");
goto evt_error;
}
file->private_data = audio;
audio->opened = 1;
done:
mutex_unlock(&audio->lock);
return rc;
evt_error:
msm_adsp_put(audio->audrec);
audpreproc_aenc_free(audio->enc_id);
mutex_unlock(&audio->lock);
return rc;
}
static const struct file_operations audio_in_fops = {
.owner = THIS_MODULE,
.open = audamrnb_in_open,
.release = audamrnb_in_release,
.read = audamrnb_in_read,
.write = audamrnb_in_write,
.unlocked_ioctl = audamrnb_in_ioctl,
};
struct miscdevice audio_amrnb_in_misc = {
.minor = MISC_DYNAMIC_MINOR,
.name = "msm_amrnb_in",
.fops = &audio_in_fops,
};
static int __init audamrnb_in_init(void)
{
the_audio_amrnb_in.data = dma_alloc_coherent(NULL, DMASZ,
&the_audio_amrnb_in.phys, GFP_KERNEL);
MM_DBG("Memory addr = 0x%8x Phy addr= 0x%8x ---- \n", \
(int) the_audio_amrnb_in.data, (int) the_audio_amrnb_in.phys);
if (!the_audio_amrnb_in.data) {
MM_AUD_ERR("Unable to allocate DMA buffer\n");
return -ENOMEM;
}
mutex_init(&the_audio_amrnb_in.lock);
mutex_init(&the_audio_amrnb_in.read_lock);
spin_lock_init(&the_audio_amrnb_in.dsp_lock);
spin_lock_init(&the_audio_amrnb_in.dev_lock);
init_waitqueue_head(&the_audio_amrnb_in.wait);
init_waitqueue_head(&the_audio_amrnb_in.wait_enable);
return misc_register(&audio_amrnb_in_misc);
}
device_initcall(audamrnb_in_init);
| chrisch1974/htc7x30-2.6-flyer | arch/arm/mach-msm/qdsp5v2/audio_amrnb_in.c | C | gpl-2.0 | 22,485 |
// 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/extensions/api/content_settings/content_settings_store.h"
#include <set>
#include "base/debug/alias.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
#include "base/stl_util.h"
#include "base/strings/string_util.h"
#include "base/values.h"
#include "chrome/browser/content_settings/content_settings_origin_identifier_value_map.h"
#include "chrome/browser/content_settings/content_settings_rule.h"
#include "chrome/browser/content_settings/content_settings_utils.h"
#include "chrome/browser/extensions/api/content_settings/content_settings_api_constants.h"
#include "chrome/browser/extensions/api/content_settings/content_settings_helpers.h"
#include "content/public/browser/browser_thread.h"
using content::BrowserThread;
using content_settings::ConcatenationIterator;
using content_settings::Rule;
using content_settings::RuleIterator;
using content_settings::OriginIdentifierValueMap;
using content_settings::ResourceIdentifier;
using content_settings::ValueToContentSetting;
namespace extensions {
namespace helpers = content_settings_helpers;
namespace keys = content_settings_api_constants;
struct ContentSettingsStore::ExtensionEntry {
// Extension id
std::string id;
// Whether extension is enabled in the profile.
bool enabled;
// Content settings.
OriginIdentifierValueMap settings;
// Persistent incognito content settings.
OriginIdentifierValueMap incognito_persistent_settings;
// Session-only incognito content settings.
OriginIdentifierValueMap incognito_session_only_settings;
};
ContentSettingsStore::ContentSettingsStore() {
DCHECK(OnCorrectThread());
}
ContentSettingsStore::~ContentSettingsStore() {
STLDeleteValues(&entries_);
}
RuleIterator* ContentSettingsStore::GetRuleIterator(
ContentSettingsType type,
const content_settings::ResourceIdentifier& identifier,
bool incognito) const {
ScopedVector<RuleIterator> iterators;
// Iterate the extensions based on install time (last installed extensions
// first).
ExtensionEntryMap::const_reverse_iterator entry;
// The individual |RuleIterators| shouldn't lock; pass |lock_| to the
// |ConcatenationIterator| in a locked state.
scoped_ptr<base::AutoLock> auto_lock(new base::AutoLock(lock_));
for (entry = entries_.rbegin(); entry != entries_.rend(); ++entry) {
if (!entry->second->enabled)
continue;
if (incognito) {
iterators.push_back(
entry->second->incognito_session_only_settings.GetRuleIterator(
type,
identifier,
NULL));
iterators.push_back(
entry->second->incognito_persistent_settings.GetRuleIterator(
type,
identifier,
NULL));
} else {
iterators.push_back(
entry->second->settings.GetRuleIterator(type, identifier, NULL));
}
}
return new ConcatenationIterator(&iterators, auto_lock.release());
}
void ContentSettingsStore::SetExtensionContentSetting(
const std::string& ext_id,
const ContentSettingsPattern& primary_pattern,
const ContentSettingsPattern& secondary_pattern,
ContentSettingsType type,
const content_settings::ResourceIdentifier& identifier,
ContentSetting setting,
ExtensionPrefsScope scope) {
{
base::AutoLock lock(lock_);
OriginIdentifierValueMap* map = GetValueMap(ext_id, scope);
if (setting == CONTENT_SETTING_DEFAULT) {
map->DeleteValue(primary_pattern, secondary_pattern, type, identifier);
} else {
map->SetValue(primary_pattern, secondary_pattern, type, identifier,
new base::FundamentalValue(setting));
}
}
// Send notification that content settings changed.
// TODO(markusheintz): Notifications should only be sent if the set content
// setting is effective and not hidden by another setting of another
// extension installed more recently.
NotifyOfContentSettingChanged(ext_id,
scope != kExtensionPrefsScopeRegular);
}
void ContentSettingsStore::RegisterExtension(
const std::string& ext_id,
const base::Time& install_time,
bool is_enabled) {
base::AutoLock lock(lock_);
ExtensionEntryMap::iterator i = FindEntry(ext_id);
ExtensionEntry* entry;
if (i != entries_.end()) {
entry = i->second;
} else {
entry = new ExtensionEntry;
entries_.insert(std::make_pair(install_time, entry));
}
entry->id = ext_id;
entry->enabled = is_enabled;
}
void ContentSettingsStore::UnregisterExtension(
const std::string& ext_id) {
bool notify = false;
bool notify_incognito = false;
{
base::AutoLock lock(lock_);
ExtensionEntryMap::iterator i = FindEntry(ext_id);
if (i == entries_.end())
return;
notify = !i->second->settings.empty();
notify_incognito = !i->second->incognito_persistent_settings.empty() ||
!i->second->incognito_session_only_settings.empty();
delete i->second;
entries_.erase(i);
}
if (notify)
NotifyOfContentSettingChanged(ext_id, false);
if (notify_incognito)
NotifyOfContentSettingChanged(ext_id, true);
}
void ContentSettingsStore::SetExtensionState(
const std::string& ext_id, bool is_enabled) {
bool notify = false;
bool notify_incognito = false;
{
base::AutoLock lock(lock_);
ExtensionEntryMap::const_iterator i = FindEntry(ext_id);
if (i == entries_.end())
return;
notify = !i->second->settings.empty();
notify_incognito = !i->second->incognito_persistent_settings.empty() ||
!i->second->incognito_session_only_settings.empty();
i->second->enabled = is_enabled;
}
if (notify)
NotifyOfContentSettingChanged(ext_id, false);
if (notify_incognito)
NotifyOfContentSettingChanged(ext_id, true);
}
OriginIdentifierValueMap* ContentSettingsStore::GetValueMap(
const std::string& ext_id,
ExtensionPrefsScope scope) {
ExtensionEntryMap::const_iterator i = FindEntry(ext_id);
if (i != entries_.end()) {
switch (scope) {
case kExtensionPrefsScopeRegular:
return &(i->second->settings);
case kExtensionPrefsScopeRegularOnly:
// TODO(bauerb): Implement regular-only content settings.
NOTREACHED();
return NULL;
case kExtensionPrefsScopeIncognitoPersistent:
return &(i->second->incognito_persistent_settings);
case kExtensionPrefsScopeIncognitoSessionOnly:
return &(i->second->incognito_session_only_settings);
}
}
return NULL;
}
const OriginIdentifierValueMap* ContentSettingsStore::GetValueMap(
const std::string& ext_id,
ExtensionPrefsScope scope) const {
ExtensionEntryMap::const_iterator i = FindEntry(ext_id);
if (i == entries_.end())
return NULL;
switch (scope) {
case kExtensionPrefsScopeRegular:
return &(i->second->settings);
case kExtensionPrefsScopeRegularOnly:
// TODO(bauerb): Implement regular-only content settings.
NOTREACHED();
return NULL;
case kExtensionPrefsScopeIncognitoPersistent:
return &(i->second->incognito_persistent_settings);
case kExtensionPrefsScopeIncognitoSessionOnly:
return &(i->second->incognito_session_only_settings);
}
NOTREACHED();
return NULL;
}
void ContentSettingsStore::ClearContentSettingsForExtension(
const std::string& ext_id,
ExtensionPrefsScope scope) {
bool notify = false;
{
base::AutoLock lock(lock_);
OriginIdentifierValueMap* map = GetValueMap(ext_id, scope);
if (!map) {
// Fail gracefully in Release builds.
NOTREACHED();
return;
}
notify = !map->empty();
map->clear();
}
if (notify) {
NotifyOfContentSettingChanged(ext_id, scope != kExtensionPrefsScopeRegular);
}
}
base::ListValue* ContentSettingsStore::GetSettingsForExtension(
const std::string& extension_id,
ExtensionPrefsScope scope) const {
base::AutoLock lock(lock_);
const OriginIdentifierValueMap* map = GetValueMap(extension_id, scope);
if (!map)
return NULL;
base::ListValue* settings = new base::ListValue();
OriginIdentifierValueMap::EntryMap::const_iterator it;
for (it = map->begin(); it != map->end(); ++it) {
scoped_ptr<RuleIterator> rule_iterator(
map->GetRuleIterator(it->first.content_type,
it->first.resource_identifier,
NULL)); // We already hold the lock.
while (rule_iterator->HasNext()) {
const Rule& rule = rule_iterator->Next();
base::DictionaryValue* setting_dict = new base::DictionaryValue();
setting_dict->SetString(keys::kPrimaryPatternKey,
rule.primary_pattern.ToString());
setting_dict->SetString(keys::kSecondaryPatternKey,
rule.secondary_pattern.ToString());
setting_dict->SetString(
keys::kContentSettingsTypeKey,
helpers::ContentSettingsTypeToString(it->first.content_type));
setting_dict->SetString(keys::kResourceIdentifierKey,
it->first.resource_identifier);
ContentSetting content_setting = ValueToContentSetting(rule.value.get());
DCHECK_NE(CONTENT_SETTING_DEFAULT, content_setting);
setting_dict->SetString(
keys::kContentSettingKey,
helpers::ContentSettingToString(content_setting));
settings->Append(setting_dict);
}
}
return settings;
}
void ContentSettingsStore::SetExtensionContentSettingFromList(
const std::string& extension_id,
const base::ListValue* list,
ExtensionPrefsScope scope) {
for (base::ListValue::const_iterator it = list->begin();
it != list->end(); ++it) {
if ((*it)->GetType() != Value::TYPE_DICTIONARY) {
NOTREACHED();
continue;
}
base::DictionaryValue* dict = static_cast<base::DictionaryValue*>(*it);
std::string primary_pattern_str;
dict->GetString(keys::kPrimaryPatternKey, &primary_pattern_str);
ContentSettingsPattern primary_pattern =
ContentSettingsPattern::FromString(primary_pattern_str);
DCHECK(primary_pattern.IsValid());
std::string secondary_pattern_str;
dict->GetString(keys::kSecondaryPatternKey, &secondary_pattern_str);
ContentSettingsPattern secondary_pattern =
ContentSettingsPattern::FromString(secondary_pattern_str);
DCHECK(secondary_pattern.IsValid());
std::string content_settings_type_str;
dict->GetString(keys::kContentSettingsTypeKey, &content_settings_type_str);
ContentSettingsType content_settings_type =
helpers::StringToContentSettingsType(content_settings_type_str);
DCHECK_NE(CONTENT_SETTINGS_TYPE_DEFAULT, content_settings_type);
std::string resource_identifier;
dict->GetString(keys::kResourceIdentifierKey, &resource_identifier);
std::string content_setting_string;
dict->GetString(keys::kContentSettingKey, &content_setting_string);
ContentSetting setting = CONTENT_SETTING_DEFAULT;
bool result =
helpers::StringToContentSetting(content_setting_string, &setting);
DCHECK(result);
SetExtensionContentSetting(extension_id,
primary_pattern,
secondary_pattern,
content_settings_type,
resource_identifier,
setting,
scope);
}
}
void ContentSettingsStore::AddObserver(Observer* observer) {
DCHECK(OnCorrectThread());
observers_.AddObserver(observer);
}
void ContentSettingsStore::RemoveObserver(Observer* observer) {
DCHECK(OnCorrectThread());
observers_.RemoveObserver(observer);
}
void ContentSettingsStore::NotifyOfContentSettingChanged(
const std::string& extension_id,
bool incognito) {
FOR_EACH_OBSERVER(
ContentSettingsStore::Observer,
observers_,
OnContentSettingChanged(extension_id, incognito));
}
bool ContentSettingsStore::OnCorrectThread() {
// If there is no UI thread, we're most likely in a unit test.
return !BrowserThread::IsThreadInitialized(BrowserThread::UI) ||
BrowserThread::CurrentlyOn(BrowserThread::UI);
}
ContentSettingsStore::ExtensionEntryMap::iterator
ContentSettingsStore::FindEntry(const std::string& ext_id) {
ExtensionEntryMap::iterator i;
for (i = entries_.begin(); i != entries_.end(); ++i) {
if (i->second->id == ext_id)
return i;
}
return entries_.end();
}
ContentSettingsStore::ExtensionEntryMap::const_iterator
ContentSettingsStore::FindEntry(const std::string& ext_id) const {
ExtensionEntryMap::const_iterator i;
for (i = entries_.begin(); i != entries_.end(); ++i) {
if (i->second->id == ext_id)
return i;
}
return entries_.end();
}
} // namespace extensions
| qtekfun/htcDesire820Kernel | external/chromium_org/chrome/browser/extensions/api/content_settings/content_settings_store.cc | C++ | gpl-2.0 | 12,997 |
/*
* This file is part of the libopencm3 project.
*
* Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIBOPENCM3_MEMORYMAP_H
#define LIBOPENCM3_MEMORYMAP_H
#include <libopencm3/cm3/memorymap.h>
/* --- STM32 specific peripheral definitions ------------------------------- */
/* Memory map for all buses */
#define FLASH_BASE (0x08000000U)
#define PERIPH_BASE (0x40000000U)
#define INFO_BASE (0x1ffff000U)
#define PERIPH_BASE_APB1 (PERIPH_BASE + 0x00000)
#define PERIPH_BASE_APB2 (PERIPH_BASE + 0x10000)
#define PERIPH_BASE_AHB (PERIPH_BASE + 0x18000)
/* Register boundary addresses */
/* APB1 */
#define TIM2_BASE (PERIPH_BASE_APB1 + 0x0000)
#define TIM3_BASE (PERIPH_BASE_APB1 + 0x0400)
#define TIM4_BASE (PERIPH_BASE_APB1 + 0x0800)
#define TIM5_BASE (PERIPH_BASE_APB1 + 0x0c00)
#define TIM6_BASE (PERIPH_BASE_APB1 + 0x1000)
#define TIM7_BASE (PERIPH_BASE_APB1 + 0x1400)
#define TIM12_BASE (PERIPH_BASE_APB1 + 0x1800)
#define TIM13_BASE (PERIPH_BASE_APB1 + 0x1c00)
#define TIM14_BASE (PERIPH_BASE_APB1 + 0x2000)
/* PERIPH_BASE_APB1 + 0x2400 (0x4000 2400 - 0x4000 27FF): Reserved */
#define RTC_BASE (PERIPH_BASE_APB1 + 0x2800)
#define WWDG_BASE (PERIPH_BASE_APB1 + 0x2c00)
#define IWDG_BASE (PERIPH_BASE_APB1 + 0x3000)
/* PERIPH_BASE_APB1 + 0x3400 (0x4000 3400 - 0x4000 37FF): Reserved */
#define SPI2_BASE (PERIPH_BASE_APB1 + 0x3800)
#define SPI3_BASE (PERIPH_BASE_APB1 + 0x3c00)
/* PERIPH_BASE_APB1 + 0x4000 (0x4000 4000 - 0x4000 3FFF): Reserved */
#define USART2_BASE (PERIPH_BASE_APB1 + 0x4400)
#define USART3_BASE (PERIPH_BASE_APB1 + 0x4800)
#define UART4_BASE (PERIPH_BASE_APB1 + 0x4c00)
#define UART5_BASE (PERIPH_BASE_APB1 + 0x5000)
#define I2C1_BASE (PERIPH_BASE_APB1 + 0x5400)
#define I2C2_BASE (PERIPH_BASE_APB1 + 0x5800)
#define USB_DEV_FS_BASE (PERIPH_BASE_APB1 + 0x5c00)
#define USB_PMA_BASE (PERIPH_BASE_APB1 + 0x6000)
#define USB_CAN_SRAM_BASE (PERIPH_BASE_APB1 + 0x6000)
#define BX_CAN1_BASE (PERIPH_BASE_APB1 + 0x6400)
#define BX_CAN2_BASE (PERIPH_BASE_APB1 + 0x6800)
/* PERIPH_BASE_APB1 + 0x6800 (0x4000 6800 - 0x4000 6BFF): Reserved? Typo? */
#define BACKUP_REGS_BASE (PERIPH_BASE_APB1 + 0x6c00)
#define POWER_CONTROL_BASE (PERIPH_BASE_APB1 + 0x7000)
#define DAC_BASE (PERIPH_BASE_APB1 + 0x7400)
#define CEC_BASE (PERIPH_BASE_APB1 + 0x7800)
/* PERIPH_BASE_APB1 + 0x7c00 (0x4000 7c00 - 0x4000 FFFF): Reserved */
/* APB2 */
#define AFIO_BASE (PERIPH_BASE_APB2 + 0x0000)
#define EXTI_BASE (PERIPH_BASE_APB2 + 0x0400)
#define GPIO_PORT_A_BASE (PERIPH_BASE_APB2 + 0x0800)
#define GPIO_PORT_B_BASE (PERIPH_BASE_APB2 + 0x0c00)
#define GPIO_PORT_C_BASE (PERIPH_BASE_APB2 + 0x1000)
#define GPIO_PORT_D_BASE (PERIPH_BASE_APB2 + 0x1400)
#define GPIO_PORT_E_BASE (PERIPH_BASE_APB2 + 0x1800)
#define GPIO_PORT_F_BASE (PERIPH_BASE_APB2 + 0x1c00)
#define GPIO_PORT_G_BASE (PERIPH_BASE_APB2 + 0x2000)
#define ADC1_BASE (PERIPH_BASE_APB2 + 0x2400)
#define ADC2_BASE (PERIPH_BASE_APB2 + 0x2800)
#define TIM1_BASE (PERIPH_BASE_APB2 + 0x2c00)
#define SPI1_BASE (PERIPH_BASE_APB2 + 0x3000)
#define TIM8_BASE (PERIPH_BASE_APB2 + 0x3400)
#define USART1_BASE (PERIPH_BASE_APB2 + 0x3800)
#define ADC3_BASE (PERIPH_BASE_APB2 + 0x3c00)
#define TIM15_BASE (PERIPH_BASE_APB2 + 0x4000)
#define TIM16_BASE (PERIPH_BASE_APB2 + 0x4400)
#define TIM17_BASE (PERIPH_BASE_APB2 + 0x4800)
#define TIM9_BASE (PERIPH_BASE_APB2 + 0x4c00)
#define TIM10_BASE (PERIPH_BASE_APB2 + 0x5000)
#define TIM11_BASE (PERIPH_BASE_APB2 + 0x5400)
/* PERIPH_BASE_APB2 + 0x5800 (0x4001 5800 - 0x4001 7FFF): Reserved */
/* AHB */
#define SDIO_BASE (PERIPH_BASE_AHB + 0x00000)
/* PERIPH_BASE_AHB + 0x0400 (0x4001 8400 - 0x4001 7FFF): Reserved */
#define DMA1_BASE (PERIPH_BASE_AHB + 0x08000)
#define DMA2_BASE (PERIPH_BASE_AHB + 0x08400)
/* PERIPH_BASE_AHB + 0x8800 (0x4002 0800 - 0x4002 0FFF): Reserved */
#define RCC_BASE (PERIPH_BASE_AHB + 0x09000)
/* PERIPH_BASE_AHB + 0x9400 (0x4002 1400 - 0x4002 1FFF): Reserved */
#define FLASH_MEM_INTERFACE_BASE (PERIPH_BASE_AHB + 0x0a000)
#define CRC_BASE (PERIPH_BASE_AHB + 0x0b000)
/* PERIPH_BASE_AHB + 0xb400 (0x4002 3400 - 0x4002 7FFF): Reserved */
#define ETHERNET_BASE (PERIPH_BASE_AHB + 0x10000)
/* PERIPH_BASE_AHB + 0x18000 (0x4003 0000 - 0x4FFF FFFF): Reserved */
#define USB_OTG_FS_BASE (PERIPH_BASE_AHB + 0xffe8000)
/* PPIB */
#define DBGMCU_BASE (PPBI_BASE + 0x00042000)
/* FSMC */
#define FSMC_BASE (PERIPH_BASE + 0x60000000)
/* Device Electronic Signature */
#define DESIG_FLASH_SIZE_BASE (INFO_BASE + 0x7e0)
#define DESIG_UNIQUE_ID_BASE (INFO_BASE + 0x7e8)
/* Ignore the "reserved for future use" half of the first word */
#define DESIG_UNIQUE_ID0 MMIO32(DESIG_UNIQUE_ID_BASE)
#define DESIG_UNIQUE_ID1 MMIO32(DESIG_UNIQUE_ID_BASE + 4)
#define DESIG_UNIQUE_ID2 MMIO32(DESIG_UNIQUE_ID_BASE + 8)
#endif
| supercamel/ninjaskit | libopencm3/stm32/f1/memorymap.h | C | gpl-3.0 | 5,545 |
<?php
class ControllerReportCustomerActivity extends Controller {
public function index() {
$this->load->language('report/customer_activity');
$this->document->setTitle($this->language->get('heading_title'));
if (isset($this->request->get['filter_customer'])) {
$filter_customer = $this->request->get['filter_customer'];
} else {
$filter_customer = null;
}
if (isset($this->request->get['filter_ip'])) {
$filter_ip = $this->request->get['filter_ip'];
} else {
$filter_ip = null;
}
if (isset($this->request->get['filter_date_start'])) {
$filter_date_start = $this->request->get['filter_date_start'];
} else {
$filter_date_start = '';
}
if (isset($this->request->get['filter_date_end'])) {
$filter_date_end = $this->request->get['filter_date_end'];
} else {
$filter_date_end = '';
}
if (isset($this->request->get['page'])) {
$page = $this->request->get['page'];
} else {
$page = 1;
}
$url = '';
if (isset($this->request->get['filter_customer'])) {
$url .= '&filter_customer=' . urlencode($this->request->get['filter_customer']);
}
if (isset($this->request->get['filter_ip'])) {
$url .= '&filter_ip=' . $this->request->get['filter_ip'];
}
if (isset($this->request->get['filter_date_start'])) {
$url .= '&filter_date_start=' . $this->request->get['filter_date_start'];
}
if (isset($this->request->get['filter_date_end'])) {
$url .= '&filter_date_end=' . $this->request->get['filter_date_end'];
}
if (isset($this->request->get['page'])) {
$url .= '&page=' . $this->request->get['page'];
}
$data['breadcrumbs'] = array();
$data['breadcrumbs'][] = array(
'href' => $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], 'SSL'),
'text' => $this->language->get('text_home')
);
$data['breadcrumbs'][] = array(
'href' => $this->url->link('report/customer_activity', 'token=' . $this->session->data['token'] . $url, 'SSL'),
'text' => $this->language->get('heading_title')
);
$this->load->model('report/customer');
$data['activities'] = array();
$filter_data = array(
'filter_customer' => $filter_customer,
'filter_ip' => $filter_ip,
'filter_date_start' => $filter_date_start,
'filter_date_end' => $filter_date_end,
'start' => ($page - 1) * 20,
'limit' => 20
);
$activity_total = $this->model_report_customer->getTotalCustomerActivities($filter_data);
$results = $this->model_report_customer->getCustomerActivities($filter_data);
foreach ($results as $result) {
$comment = vsprintf($this->language->get('text_' . $result['key']), unserialize($result['data']));
$find = array(
'customer_id=',
'order_id='
);
$replace = array(
$this->url->link('sale/customer/edit', 'token=' . $this->session->data['token'] . '&customer_id=', 'SSL'),
$this->url->link('sale/order/info', 'token=' . $this->session->data['token'] . '&order_id=', 'SSL')
);
$data['activities'][] = array(
'comment' => str_replace($find, $replace, $comment),
'ip' => $result['ip'],
'date_added' => date($this->language->get('datetime_format'), strtotime($result['date_added']))
);
}
$data['heading_title'] = $this->language->get('heading_title');
$data['text_list'] = $this->language->get('text_list');
$data['text_no_results'] = $this->language->get('text_no_results');
$data['text_confirm'] = $this->language->get('text_confirm');
$data['column_comment'] = $this->language->get('column_comment');
$data['column_ip'] = $this->language->get('column_ip');
$data['column_date_added'] = $this->language->get('column_date_added');
$data['entry_customer'] = $this->language->get('entry_customer');
$data['entry_ip'] = $this->language->get('entry_ip');
$data['entry_date_start'] = $this->language->get('entry_date_start');
$data['entry_date_end'] = $this->language->get('entry_date_end');
$data['button_filter'] = $this->language->get('button_filter');
$data['token'] = $this->session->data['token'];
$url = '';
if (isset($this->request->get['filter_customer'])) {
$url .= '&filter_customer=' . urlencode($this->request->get['filter_customer']);
}
if (isset($this->request->get['filter_ip'])) {
$url .= '&filter_ip=' . $this->request->get['filter_ip'];
}
if (isset($this->request->get['filter_date_start'])) {
$url .= '&filter_date_start=' . $this->request->get['filter_date_start'];
}
if (isset($this->request->get['filter_date_end'])) {
$url .= '&filter_date_end=' . $this->request->get['filter_date_end'];
}
$pagination = new Pagination();
$pagination->total = $activity_total;
$pagination->page = $page;
$pagination->limit = $this->config->get('config_limit_admin');
$pagination->url = $this->url->link('report/customer_activity', 'token=' . $this->session->data['token'] . $url . '&page={page}', 'SSL');
$data['pagination'] = $pagination->render();
$data['results'] = sprintf($this->language->get('text_pagination'), ($activity_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($activity_total - $this->config->get('config_limit_admin'))) ? $activity_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $activity_total, ceil($activity_total / $this->config->get('config_limit_admin')));
$data['filter_customer'] = $filter_customer;
$data['filter_ip'] = $filter_ip;
$data['filter_date_start'] = $filter_date_start;
$data['filter_date_end'] = $filter_date_end;
$data['header'] = $this->load->controller('common/header');
$data['column_left'] = $this->load->controller('common/column_left');
$data['footer'] = $this->load->controller('common/footer');
$this->response->setOutput($this->load->view('report/customer_activity.tpl', $data));
}
} | latestthemes/opencart | upload/admin/controller/report/customer_activity.php | PHP | gpl-3.0 | 5,935 |
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Version details.
*
* @package report
* @subpackage backups
* @copyright 2007 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
$plugin->version = 2017051500; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2017050500; // Requires this Moodle version
$plugin->component = 'report_backups'; // Full name of the plugin (used for diagnostics)
| cbradley456/moodle | report/backups/version.php | PHP | gpl-3.0 | 1,202 |
<!DOCTYPE html>
<html>
<!-- Submitted from TestTWF Paris -->
<head>
<title>CSS Values and Units Test: vh-based dimension doesn't change when the element other dimension doesn't change.</title>
<style type="text/css">
* { margin: 0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size: 13px; }
/* the first test box has its vertical dimension is set to some vh units */
#testBoxWithVhOnly { background: #F00; width: 60px; height: 20vh; float: left; }
/* the second test box, with fixed height */
#testBoxNotGrownHorizontallyByJS { background: #F0F; width: 20vh; height: 60px; float: left; }
/* third box, changed by using CSS transition */
#testBoxWithTransition { background: #FF0; width: 20vh; height: 40px; float: left;
transition-property: width, height;
transition-duration: 0.3s;
transition-delay: 0;
}
/* the reference box, growing in both directions (height by js, width by vh unit */
#referenceBoxGrownHorizontallyByJS { background: #0F0; width: 20vh; height: 40px; float: left; }
p { clear: both; margin: 10px 0; }
</style>
</head>
<body>
<p>
All boxes should end up the same size. The green box is the reference one.
</p>
<div id="testBoxWithVhOnly"></div>
<div id="testBoxNotGrownHorizontallyByJS"></div>
<div id="testBoxWithTransition"></div>
<div id="referenceBoxGrownHorizontallyByJS"></div>
<script type="text/javascript">
'use strict';
// In case this file was opened by mistake, redirects to proper test
if (window.top.location.href === document.location.href) {
window.top.location.href = "vh_not_refreshing_on_chrome.html";
}
function setDimension(id, dimension, value) {
var element = document.getElementById(id);
element.style[dimension] = value + "px";
}
function animate() {
var viewportHeight = document.documentElement.clientHeight;
var sizeH = 20;
var referenceDimension = Math.round(sizeH * viewportHeight / 100);
setDimension('referenceBoxGrownHorizontallyByJS', 'height', referenceDimension);
if (referenceDimension < 60) {
setTimeout(animate, 20);
} else {
parent.postMessage('referenceBoxGrownHorizontallyByJS', '*');
}
}
setTimeout(animate, 20);
addEventListener('transitionend', function() {
parent.postMessage('testBoxWithTransition', '*');
}, false);
var transitionedTestBoxStyle = document.getElementById('testBoxWithTransition').style;
transitionedTestBoxStyle.height = "60px";
</script>
</body>
</html>
| anthgur/servo | tests/wpt/web-platform-tests/css/css-values/support/vh_not_refreshing_on_chrome_iframe.html | HTML | mpl-2.0 | 2,485 |
'use strict'
const Buffer = require('safe-buffer').Buffer
const crypto = require('crypto')
const Transform = require('stream').Transform
const SPEC_ALGORITHMS = ['sha256', 'sha384', 'sha512']
const BASE64_REGEX = /^[a-z0-9+/]+(?:=?=?)$/i
const SRI_REGEX = /^([^-]+)-([^?]+)([?\S*]*)$/
const STRICT_SRI_REGEX = /^([^-]+)-([A-Za-z0-9+/=]{44,88})(\?[\x21-\x7E]*)*$/
const VCHAR_REGEX = /^[\x21-\x7E]+$/
class Hash {
get isHash () { return true }
constructor (hash, opts) {
const strict = !!(opts && opts.strict)
this.source = hash.trim()
// 3.1. Integrity metadata (called "Hash" by ssri)
// https://w3c.github.io/webappsec-subresource-integrity/#integrity-metadata-description
const match = this.source.match(
strict
? STRICT_SRI_REGEX
: SRI_REGEX
)
if (!match) { return }
if (strict && !SPEC_ALGORITHMS.some(a => a === match[1])) { return }
this.algorithm = match[1]
this.digest = match[2]
const rawOpts = match[3]
this.options = rawOpts ? rawOpts.slice(1).split('?') : []
}
hexDigest () {
return this.digest && Buffer.from(this.digest, 'base64').toString('hex')
}
toJSON () {
return this.toString()
}
toString (opts) {
if (opts && opts.strict) {
// Strict mode enforces the standard as close to the foot of the
// letter as it can.
if (!(
// The spec has very restricted productions for algorithms.
// https://www.w3.org/TR/CSP2/#source-list-syntax
SPEC_ALGORITHMS.some(x => x === this.algorithm) &&
// Usually, if someone insists on using a "different" base64, we
// leave it as-is, since there's multiple standards, and the
// specified is not a URL-safe variant.
// https://www.w3.org/TR/CSP2/#base64_value
this.digest.match(BASE64_REGEX) &&
// Option syntax is strictly visual chars.
// https://w3c.github.io/webappsec-subresource-integrity/#grammardef-option-expression
// https://tools.ietf.org/html/rfc5234#appendix-B.1
(this.options || []).every(opt => opt.match(VCHAR_REGEX))
)) {
return ''
}
}
const options = this.options && this.options.length
? `?${this.options.join('?')}`
: ''
return `${this.algorithm}-${this.digest}${options}`
}
}
class Integrity {
get isIntegrity () { return true }
toJSON () {
return this.toString()
}
toString (opts) {
opts = opts || {}
let sep = opts.sep || ' '
if (opts.strict) {
// Entries must be separated by whitespace, according to spec.
sep = sep.replace(/\S+/g, ' ')
}
return Object.keys(this).map(k => {
return this[k].map(hash => {
return Hash.prototype.toString.call(hash, opts)
}).filter(x => x.length).join(sep)
}).filter(x => x.length).join(sep)
}
concat (integrity, opts) {
const other = typeof integrity === 'string'
? integrity
: stringify(integrity, opts)
return parse(`${this.toString(opts)} ${other}`, opts)
}
hexDigest () {
return parse(this, {single: true}).hexDigest()
}
match (integrity, opts) {
const other = parse(integrity, opts)
const algo = other.pickAlgorithm(opts)
return (
this[algo] &&
other[algo] &&
this[algo].find(hash =>
other[algo].find(otherhash =>
hash.digest === otherhash.digest
)
)
) || false
}
pickAlgorithm (opts) {
const pickAlgorithm = (opts && opts.pickAlgorithm) || getPrioritizedHash
const keys = Object.keys(this)
if (!keys.length) {
throw new Error(`No algorithms available for ${
JSON.stringify(this.toString())
}`)
}
return keys.reduce((acc, algo) => {
return pickAlgorithm(acc, algo) || acc
})
}
}
module.exports.parse = parse
function parse (sri, opts) {
opts = opts || {}
if (typeof sri === 'string') {
return _parse(sri, opts)
} else if (sri.algorithm && sri.digest) {
const fullSri = new Integrity()
fullSri[sri.algorithm] = [sri]
return _parse(stringify(fullSri, opts), opts)
} else {
return _parse(stringify(sri, opts), opts)
}
}
function _parse (integrity, opts) {
// 3.4.3. Parse metadata
// https://w3c.github.io/webappsec-subresource-integrity/#parse-metadata
if (opts.single) {
return new Hash(integrity, opts)
}
return integrity.trim().split(/\s+/).reduce((acc, string) => {
const hash = new Hash(string, opts)
if (hash.algorithm && hash.digest) {
const algo = hash.algorithm
if (!acc[algo]) { acc[algo] = [] }
acc[algo].push(hash)
}
return acc
}, new Integrity())
}
module.exports.stringify = stringify
function stringify (obj, opts) {
if (obj.algorithm && obj.digest) {
return Hash.prototype.toString.call(obj, opts)
} else if (typeof obj === 'string') {
return stringify(parse(obj, opts), opts)
} else {
return Integrity.prototype.toString.call(obj, opts)
}
}
module.exports.fromHex = fromHex
function fromHex (hexDigest, algorithm, opts) {
const optString = (opts && opts.options && opts.options.length)
? `?${opts.options.join('?')}`
: ''
return parse(
`${algorithm}-${
Buffer.from(hexDigest, 'hex').toString('base64')
}${optString}`, opts
)
}
module.exports.fromData = fromData
function fromData (data, opts) {
opts = opts || {}
const algorithms = opts.algorithms || ['sha512']
const optString = opts.options && opts.options.length
? `?${opts.options.join('?')}`
: ''
return algorithms.reduce((acc, algo) => {
const digest = crypto.createHash(algo).update(data).digest('base64')
const hash = new Hash(
`${algo}-${digest}${optString}`,
opts
)
if (hash.algorithm && hash.digest) {
const algo = hash.algorithm
if (!acc[algo]) { acc[algo] = [] }
acc[algo].push(hash)
}
return acc
}, new Integrity())
}
module.exports.fromStream = fromStream
function fromStream (stream, opts) {
opts = opts || {}
const P = opts.Promise || Promise
const istream = integrityStream(opts)
return new P((resolve, reject) => {
stream.pipe(istream)
stream.on('error', reject)
istream.on('error', reject)
let sri
istream.on('integrity', s => { sri = s })
istream.on('end', () => resolve(sri))
istream.on('data', () => {})
})
}
module.exports.checkData = checkData
function checkData (data, sri, opts) {
opts = opts || {}
sri = parse(sri, opts)
if (!Object.keys(sri).length) {
if (opts.error) {
throw Object.assign(
new Error('No valid integrity hashes to check against'), {
code: 'EINTEGRITY'
}
)
} else {
return false
}
}
const algorithm = sri.pickAlgorithm(opts)
const digest = crypto.createHash(algorithm).update(data).digest('base64')
const newSri = parse({algorithm, digest})
const match = newSri.match(sri, opts)
if (match || !opts.error) {
return match
} else if (typeof opts.size === 'number' && (data.length !== opts.size)) {
const err = new Error(`data size mismatch when checking ${sri}.\n Wanted: ${opts.size}\n Found: ${data.length}`)
err.code = 'EBADSIZE'
err.found = data.length
err.expected = opts.size
err.sri = sri
throw err
} else {
const err = new Error(`Integrity checksum failed when using ${algorithm}: Wanted ${sri}, but got ${newSri}. (${data.length} bytes)`)
err.code = 'EINTEGRITY'
err.found = newSri
err.expected = sri
err.algorithm = algorithm
err.sri = sri
throw err
}
}
module.exports.checkStream = checkStream
function checkStream (stream, sri, opts) {
opts = opts || {}
const P = opts.Promise || Promise
const checker = integrityStream(Object.assign({}, opts, {
integrity: sri
}))
return new P((resolve, reject) => {
stream.pipe(checker)
stream.on('error', reject)
checker.on('error', reject)
let sri
checker.on('verified', s => { sri = s })
checker.on('end', () => resolve(sri))
checker.on('data', () => {})
})
}
module.exports.integrityStream = integrityStream
function integrityStream (opts) {
opts = opts || {}
// For verification
const sri = opts.integrity && parse(opts.integrity, opts)
const goodSri = sri && Object.keys(sri).length
const algorithm = goodSri && sri.pickAlgorithm(opts)
const digests = goodSri && sri[algorithm]
// Calculating stream
const algorithms = Array.from(
new Set(
(opts.algorithms || ['sha512'])
.concat(algorithm ? [algorithm] : [])
)
)
const hashes = algorithms.map(crypto.createHash)
let streamSize = 0
const stream = new Transform({
transform (chunk, enc, cb) {
streamSize += chunk.length
hashes.forEach(h => h.update(chunk, enc))
cb(null, chunk, enc)
}
}).on('end', () => {
const optString = (opts.options && opts.options.length)
? `?${opts.options.join('?')}`
: ''
const newSri = parse(hashes.map((h, i) => {
return `${algorithms[i]}-${h.digest('base64')}${optString}`
}).join(' '), opts)
// Integrity verification mode
const match = goodSri && newSri.match(sri, opts)
if (typeof opts.size === 'number' && streamSize !== opts.size) {
const err = new Error(`stream size mismatch when checking ${sri}.\n Wanted: ${opts.size}\n Found: ${streamSize}`)
err.code = 'EBADSIZE'
err.found = streamSize
err.expected = opts.size
err.sri = sri
stream.emit('error', err)
} else if (opts.integrity && !match) {
const err = new Error(`${sri} integrity checksum failed when using ${algorithm}: wanted ${digests} but got ${newSri}. (${streamSize} bytes)`)
err.code = 'EINTEGRITY'
err.found = newSri
err.expected = digests
err.algorithm = algorithm
err.sri = sri
stream.emit('error', err)
} else {
stream.emit('size', streamSize)
stream.emit('integrity', newSri)
match && stream.emit('verified', match)
}
})
return stream
}
module.exports.create = createIntegrity
function createIntegrity (opts) {
opts = opts || {}
const algorithms = opts.algorithms || ['sha512']
const optString = opts.options && opts.options.length
? `?${opts.options.join('?')}`
: ''
const hashes = algorithms.map(crypto.createHash)
return {
update: function (chunk, enc) {
hashes.forEach(h => h.update(chunk, enc))
return this
},
digest: function (enc) {
const integrity = algorithms.reduce((acc, algo) => {
const digest = hashes.shift().digest('base64')
const hash = new Hash(
`${algo}-${digest}${optString}`,
opts
)
if (hash.algorithm && hash.digest) {
const algo = hash.algorithm
if (!acc[algo]) { acc[algo] = [] }
acc[algo].push(hash)
}
return acc
}, new Integrity())
return integrity
}
}
}
const NODE_HASHES = new Set(crypto.getHashes())
// This is a Best Effort™ at a reasonable priority for hash algos
const DEFAULT_PRIORITY = [
'md5', 'whirlpool', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512',
// TODO - it's unclear _which_ of these Node will actually use as its name
// for the algorithm, so we guesswork it based on the OpenSSL names.
'sha3',
'sha3-256', 'sha3-384', 'sha3-512',
'sha3_256', 'sha3_384', 'sha3_512'
].filter(algo => NODE_HASHES.has(algo))
function getPrioritizedHash (algo1, algo2) {
return DEFAULT_PRIORITY.indexOf(algo1.toLowerCase()) >= DEFAULT_PRIORITY.indexOf(algo2.toLowerCase())
? algo1
: algo2
}
| veerhiremath7/veerhiremath7.github.io | node_modules/ssri/index.js | JavaScript | unlicense | 11,559 |
/// <reference path="fourslash.ts" />
// @allowNonTsExtensions: true
// @Filename: file.js
//// /**
//// * @param {number} a
//// * @param {string} b
//// */
//// exports.foo = function(a, b) {
//// a/*a*/;
//// b/*b*/
//// };
goTo.marker('a');
edit.insert('.');
verify.completionListContains('toFixed', undefined, undefined, 'method');
goTo.marker('b');
edit.insert('.');
verify.completionListContains('substr', undefined, undefined, 'method');
| plantain-00/TypeScript | tests/cases/fourslash/getJavaScriptCompletions18.ts | TypeScript | apache-2.0 | 477 |
//===--- ScratchBuffer.cpp - Scratch space for forming tokens -------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file implements the ScratchBuffer interface.
//
//===----------------------------------------------------------------------===//
#include "clang/Lex/ScratchBuffer.h"
#include "clang/Basic/SourceManager.h"
#include "llvm/Support/MemoryBuffer.h"
#include <cstring>
using namespace clang;
// ScratchBufSize - The size of each chunk of scratch memory. Slightly less
//than a page, almost certainly enough for anything. :)
static const unsigned ScratchBufSize = 4060;
ScratchBuffer::ScratchBuffer(SourceManager &SM) : SourceMgr(SM), CurBuffer(0) {
// Set BytesUsed so that the first call to getToken will require an alloc.
BytesUsed = ScratchBufSize;
}
/// getToken - Splat the specified text into a temporary MemoryBuffer and
/// return a SourceLocation that refers to the token. This is just like the
/// method below, but returns a location that indicates the physloc of the
/// token.
SourceLocation ScratchBuffer::getToken(const char *Buf, unsigned Len,
const char *&DestPtr) {
if (BytesUsed+Len+2 > ScratchBufSize)
AllocScratchBuffer(Len+2);
// Prefix the token with a \n, so that it looks like it is the first thing on
// its own virtual line in caret diagnostics.
CurBuffer[BytesUsed++] = '\n';
// Return a pointer to the character data.
DestPtr = CurBuffer+BytesUsed;
// Copy the token data into the buffer.
memcpy(CurBuffer+BytesUsed, Buf, Len);
// Remember that we used these bytes.
BytesUsed += Len+1;
// Add a NUL terminator to the token. This keeps the tokens separated, in
// case they get relexed, and puts them on their own virtual lines in case a
// diagnostic points to one.
CurBuffer[BytesUsed-1] = '\0';
return BufferStartLoc.getLocWithOffset(BytesUsed-Len-1);
}
void ScratchBuffer::AllocScratchBuffer(unsigned RequestLen) {
// Only pay attention to the requested length if it is larger than our default
// page size. If it is, we allocate an entire chunk for it. This is to
// support gigantic tokens, which almost certainly won't happen. :)
if (RequestLen < ScratchBufSize)
RequestLen = ScratchBufSize;
llvm::MemoryBuffer *Buf =
llvm::MemoryBuffer::getNewMemBuffer(RequestLen, "<scratch space>");
FileID FID = SourceMgr.createFileIDForMemBuffer(Buf);
BufferStartLoc = SourceMgr.getLocForStartOfFile(FID);
CurBuffer = const_cast<char*>(Buf->getBufferStart());
BytesUsed = 1;
CurBuffer[0] = '0'; // Start out with a \0 for cleanliness.
}
| jeltz/rust-debian-package | src/llvm/tools/clang/lib/Lex/ScratchBuffer.cpp | C++ | apache-2.0 | 2,830 |
<?php
/**
* Validates an integer representation of pixels according to the HTML spec.
*/
class HTMLPurifier_AttrDef_HTML_Pixels extends HTMLPurifier_AttrDef
{
protected $max;
public function __construct($max = null) {
$this->max = $max;
}
public function validate($string, $config, $context) {
$string = trim($string);
if ($string === '0') return $string;
if ($string === '') return false;
$length = strlen($string);
if (substr($string, $length - 2) == 'px') {
$string = substr($string, 0, $length - 2);
}
if (!is_numeric($string)) return false;
$int = (int) $string;
if ($int < 0) return '0';
// upper-bound value, extremely high values can
// crash operating systems, see <http://ha.ckers.org/imagecrash.html>
// WARNING, above link WILL crash you if you're using Windows
if ($this->max !== null && $int > $this->max) return (string) $this->max;
return (string) $int;
}
public function make($string) {
if ($string === '') $max = null;
else $max = (int) $string;
$class = get_class($this);
return new $class($max);
}
}
| cappetta/CyberCloud | puppet/garbage/website/files/DVWA/external/phpids/0.6/lib/IDS/vendors/htmlpurifier/HTMLPurifier/AttrDef/HTML/Pixels.php | PHP | apache-2.0 | 1,343 |
/*
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1_test
import (
"reflect"
"testing"
"k8s.io/api/scheduling/v1alpha1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/kubernetes/pkg/api/legacyscheme"
apiv1 "k8s.io/api/core/v1"
utilfeature "k8s.io/apiserver/pkg/util/feature"
featuregatetesting "k8s.io/component-base/featuregate/testing"
// enforce that all types are installed
_ "k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/features"
)
func roundTrip(t *testing.T, obj runtime.Object) runtime.Object {
codec := legacyscheme.Codecs.LegacyCodec(v1alpha1.SchemeGroupVersion)
data, err := runtime.Encode(codec, obj)
if err != nil {
t.Errorf("%v\n %#v", err, obj)
return nil
}
obj2, err := runtime.Decode(codec, data)
if err != nil {
t.Errorf("%v\nData: %s\nSource: %#v", err, string(data), obj)
return nil
}
obj3 := reflect.New(reflect.TypeOf(obj).Elem()).Interface().(runtime.Object)
err = legacyscheme.Scheme.Convert(obj2, obj3, nil)
if err != nil {
t.Errorf("%v\nSource: %#v", err, obj2)
return nil
}
return obj3
}
func TestSetDefaultPreempting(t *testing.T) {
priorityClass := &v1alpha1.PriorityClass{}
// set NonPreemptingPriority true
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.NonPreemptingPriority, true)()
output := roundTrip(t, runtime.Object(priorityClass)).(*v1alpha1.PriorityClass)
if output.PreemptionPolicy == nil || *output.PreemptionPolicy != apiv1.PreemptLowerPriority {
t.Errorf("Expected PriorityClass.Preempting value: %+v\ngot: %+v\n", apiv1.PreemptLowerPriority, output.PreemptionPolicy)
}
}
| ingvagabund/origin | vendor/k8s.io/kubernetes/pkg/apis/scheduling/v1alpha1/defaults_test.go | GO | apache-2.0 | 2,157 |
/*
* Copyright 2010-2015 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.rds.model;
import java.io.Serializable;
/**
* <p>
* Contains the result of a successful invocation of the
* ModifyDBParameterGroup or ResetDBParameterGroup action.
* </p>
*/
public class ResetDBParameterGroupResult implements Serializable, Cloneable {
/**
* Provides the name of the DB parameter group.
*/
private String dBParameterGroupName;
/**
* Provides the name of the DB parameter group.
*
* @return Provides the name of the DB parameter group.
*/
public String getDBParameterGroupName() {
return dBParameterGroupName;
}
/**
* Provides the name of the DB parameter group.
*
* @param dBParameterGroupName Provides the name of the DB parameter group.
*/
public void setDBParameterGroupName(String dBParameterGroupName) {
this.dBParameterGroupName = dBParameterGroupName;
}
/**
* Provides the name of the DB parameter group.
* <p>
* Returns a reference to this object so that method calls can be chained together.
*
* @param dBParameterGroupName Provides the name of the DB parameter group.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public ResetDBParameterGroupResult withDBParameterGroupName(String dBParameterGroupName) {
this.dBParameterGroupName = dBParameterGroupName;
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 (getDBParameterGroupName() != null) sb.append("DBParameterGroupName: " + getDBParameterGroupName() );
sb.append("}");
return sb.toString();
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getDBParameterGroupName() == null) ? 0 : getDBParameterGroupName().hashCode());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (obj instanceof ResetDBParameterGroupResult == false) return false;
ResetDBParameterGroupResult other = (ResetDBParameterGroupResult)obj;
if (other.getDBParameterGroupName() == null ^ this.getDBParameterGroupName() == null) return false;
if (other.getDBParameterGroupName() != null && other.getDBParameterGroupName().equals(this.getDBParameterGroupName()) == false) return false;
return true;
}
@Override
public ResetDBParameterGroupResult clone() {
try {
return (ResetDBParameterGroupResult) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException(
"Got a CloneNotSupportedException from Object.clone() "
+ "even though we're Cloneable!",
e);
}
}
}
| mahaliachante/aws-sdk-java | aws-java-sdk-rds/src/main/java/com/amazonaws/services/rds/model/ResetDBParameterGroupResult.java | Java | apache-2.0 | 3,865 |
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<link href='../fullcalendar.css' rel='stylesheet' />
<link href='../fullcalendar.print.css' rel='stylesheet' media='print' />
<script src='../lib/moment.min.js'></script>
<script src='../lib/jquery.min.js'></script>
<script src='../lib/jquery-ui.custom.min.js'></script>
<script src='../fullcalendar.min.js'></script>
<script>
$(document).ready(function() {
$('#calendar').fullCalendar({
defaultDate: '2014-06-12',
editable: true,
events: [
{
title: 'All Day Event',
start: '2014-06-01'
},
{
title: 'Long Event',
start: '2014-06-07',
end: '2014-06-10'
},
{
id: 999,
title: 'Repeating Event',
start: '2014-06-09T16:00:00'
},
{
id: 999,
title: 'Repeating Event',
start: '2014-06-16T16:00:00'
},
{
title: 'Meeting',
start: '2014-06-12T10:30:00',
end: '2014-06-12T12:30:00'
},
{
title: 'Lunch',
start: '2014-06-12T12:00:00'
},
{
title: 'Birthday Party',
start: '2014-06-13T07:00:00'
},
{
title: 'Click for Google',
url: 'http://google.com/',
start: '2014-06-28'
}
]
});
});
</script>
<style>
body {
margin: 0;
padding: 0;
font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
font-size: 14px;
}
#calendar {
width: 900px;
margin: 40px auto;
}
</style>
</head>
<body>
<div id='calendar'></div>
</body>
</html>
| ubiquitous-computing-lab/Mining-Minds | supporting-layer/descriptive-analytics/src/assets/lib/fullcalendar/demos/default.html | HTML | apache-2.0 | 1,485 |
cask 'kk7ds-python-runtime' do
version '10.1'
sha256 '5cee8acb941e39f93a4df6a99ed29a14c48da0bc5beb3b31068852b1fad8b009'
url "http://www.d-rats.com/download/OSX_Runtime/KK7DS_Python_Runtime_R#{version.major}.pkg"
name 'KK7DS Python Runtime'
homepage 'http://www.d-rats.com/download/OSX_Runtime/'
pkg "KK7DS_Python_Runtime_R#{version.major}.pkg"
uninstall pkgutil: 'com.danplanet.python_runtime',
delete: '/opt/kk7ds'
end
| gerrypower/homebrew-cask | Casks/kk7ds-python-runtime.rb | Ruby | bsd-2-clause | 450 |
<!doctype html>
<title>
legend and float and position: absolute/fixed when the display type of
the fieldset is flex.
</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<style>
body { margin: 0; }
fieldset {
border: 10px solid;
display: flex;
margin: 0;
padding: 20px;
width: 300px;
}
legend { height: 10px; }
#legend1 { float: left; }
#legend2 { float: right; }
#legend3 { position: absolute; }
#legend4 { position: fixed; }
</style>
<fieldset id=fieldset>
<div>div</div>
<legend id=legend1>legend1</legend>
<legend id=legend2>legend2</legend>
<legend id=legend3>legend3</legend>
<legend id=legend4>legend4</legend>
<legend id=legend5>legend5</legend>
</fieldset>
<script>
const fieldset = document.getElementById('fieldset');
const legends = document.getElementsByTagName('legend');
const [legend1, legend2, legend3, legend4, legend5] = legends;
const expectedTop = 0;
const expectedLeft = 10 + 20;
function assert_rendered_legend(legend) {
assert_equals(legend.offsetTop, expectedTop, `${legend.id}.offsetTop`);
assert_equals(legend.offsetLeft, expectedLeft, `${legend.id}.offsetLeft`);
for (const other of legends) {
if (other === legend) {
continue;
}
if (other.offsetTop === expectedTop && other.offsetLeft === expectedLeft) {
assert_unreached(`${other.id} should not be the "rendered legend"`);
}
}
}
test(t => {
assert_rendered_legend(legend5);
}, 'no dynamic changes');
test(t => {
const legend = document.createElement('legend');
t.add_cleanup(() => {
legend.remove();
});
legend.id = 'script-inserted';
legend.textContent = 'script-inserted legend';
fieldset.insertBefore(legend, legend1);
assert_rendered_legend(legend);
legend.remove();
assert_rendered_legend(legend5);
}, 'inserting a new legend and removing it again');
test(t => {
t.add_cleanup(() => {
legend1.id = 'legend1';
legend2.id = 'legend2';
});
legend2.id = '';
assert_rendered_legend(legend2);
legend1.id = '';
assert_rendered_legend(legend1);
legend1.id = 'legend1';
assert_rendered_legend(legend2);
legend2.id = 'legend2';
assert_rendered_legend(legend5);
}, 'dynamic changes to float');
test(t => {
t.add_cleanup(() => {
legend3.id = 'legend3';
legend4.id = 'legend4';
});
legend4.id = '';
assert_rendered_legend(legend4);
legend3.id = '';
assert_rendered_legend(legend3);
legend3.id = 'legend3';
assert_rendered_legend(legend4);
legend4.id = 'legend4';
assert_rendered_legend(legend5);
}, 'dynamic changes to position');
</script>
| scheib/chromium | third_party/blink/web_tests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/flex-legend-float-abspos.html | HTML | bsd-3-clause | 2,691 |
/******************************************************************************
*
* Module Name: nsrepair2 - Repair for objects returned by specific
* predefined methods
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* 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,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* 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 MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
*/
#include <acpi/acpi.h>
#include "accommon.h"
#include "acnamesp.h"
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME("nsrepair2")
/*
* Information structure and handler for ACPI predefined names that can
* be repaired on a per-name basis.
*/
typedef
acpi_status(*acpi_repair_function) (struct acpi_evaluate_info * info,
union acpi_operand_object
**return_object_ptr);
typedef struct acpi_repair_info {
char name[ACPI_NAME_SIZE];
acpi_repair_function repair_function;
} acpi_repair_info;
/* Local prototypes */
static const struct acpi_repair_info *acpi_ns_match_complex_repair(struct
acpi_namespace_node
*node);
static acpi_status
acpi_ns_repair_ALR(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr);
static acpi_status
acpi_ns_repair_CID(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr);
static acpi_status
acpi_ns_repair_CST(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr);
static acpi_status
acpi_ns_repair_FDE(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr);
static acpi_status
acpi_ns_repair_HID(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr);
static acpi_status
acpi_ns_repair_PRT(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr);
static acpi_status
acpi_ns_repair_PSS(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr);
static acpi_status
acpi_ns_repair_TSS(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr);
static acpi_status
acpi_ns_check_sorted_list(struct acpi_evaluate_info *info,
union acpi_operand_object *return_object,
u32 start_index,
u32 expected_count,
u32 sort_index,
u8 sort_direction, char *sort_key_name);
/* Values for sort_direction above */
#define ACPI_SORT_ASCENDING 0
#define ACPI_SORT_DESCENDING 1
static void
acpi_ns_remove_element(union acpi_operand_object *obj_desc, u32 index);
static void
acpi_ns_sort_list(union acpi_operand_object **elements,
u32 count, u32 index, u8 sort_direction);
/*
* This table contains the names of the predefined methods for which we can
* perform more complex repairs.
*
* As necessary:
*
* _ALR: Sort the list ascending by ambient_illuminance
* _CID: Strings: uppercase all, remove any leading asterisk
* _CST: Sort the list ascending by C state type
* _FDE: Convert Buffer of BYTEs to a Buffer of DWORDs
* _GTM: Convert Buffer of BYTEs to a Buffer of DWORDs
* _HID: Strings: uppercase all, remove any leading asterisk
* _PRT: Fix reversed source_name and source_index
* _PSS: Sort the list descending by Power
* _TSS: Sort the list descending by Power
*
* Names that must be packages, but cannot be sorted:
*
* _BCL: Values are tied to the Package index where they appear, and cannot
* be moved or sorted. These index values are used for _BQC and _BCM.
* However, we can fix the case where a buffer is returned, by converting
* it to a Package of integers.
*/
static const struct acpi_repair_info acpi_ns_repairable_names[] = {
{"_ALR", acpi_ns_repair_ALR},
{"_CID", acpi_ns_repair_CID},
{"_CST", acpi_ns_repair_CST},
{"_FDE", acpi_ns_repair_FDE},
{"_GTM", acpi_ns_repair_FDE}, /* _GTM has same repair as _FDE */
{"_HID", acpi_ns_repair_HID},
{"_PRT", acpi_ns_repair_PRT},
{"_PSS", acpi_ns_repair_PSS},
{"_TSS", acpi_ns_repair_TSS},
{{0, 0, 0, 0}, NULL} /* Table terminator */
};
#define ACPI_FDE_FIELD_COUNT 5
#define ACPI_FDE_BYTE_BUFFER_SIZE 5
#define ACPI_FDE_DWORD_BUFFER_SIZE (ACPI_FDE_FIELD_COUNT * sizeof (u32))
/******************************************************************************
*
* FUNCTION: acpi_ns_complex_repairs
*
* PARAMETERS: info - Method execution information block
* node - Namespace node for the method/object
* validate_status - Original status of earlier validation
* return_object_ptr - Pointer to the object returned from the
* evaluation of a method or object
*
* RETURN: Status. AE_OK if repair was successful. If name is not
* matched, validate_status is returned.
*
* DESCRIPTION: Attempt to repair/convert a return object of a type that was
* not expected.
*
*****************************************************************************/
acpi_status
acpi_ns_complex_repairs(struct acpi_evaluate_info *info,
struct acpi_namespace_node *node,
acpi_status validate_status,
union acpi_operand_object **return_object_ptr)
{
const struct acpi_repair_info *predefined;
acpi_status status;
/* Check if this name is in the list of repairable names */
predefined = acpi_ns_match_complex_repair(node);
if (!predefined) {
return (validate_status);
}
status = predefined->repair_function(info, return_object_ptr);
return (status);
}
/******************************************************************************
*
* FUNCTION: acpi_ns_match_complex_repair
*
* PARAMETERS: node - Namespace node for the method/object
*
* RETURN: Pointer to entry in repair table. NULL indicates not found.
*
* DESCRIPTION: Check an object name against the repairable object list.
*
*****************************************************************************/
static const struct acpi_repair_info *acpi_ns_match_complex_repair(struct
acpi_namespace_node
*node)
{
const struct acpi_repair_info *this_name;
/* Search info table for a repairable predefined method/object name */
this_name = acpi_ns_repairable_names;
while (this_name->repair_function) {
if (ACPI_COMPARE_NAME(node->name.ascii, this_name->name)) {
return (this_name);
}
this_name++;
}
return (NULL); /* Not found */
}
/******************************************************************************
*
* FUNCTION: acpi_ns_repair_ALR
*
* PARAMETERS: info - Method execution information block
* return_object_ptr - Pointer to the object returned from the
* evaluation of a method or object
*
* RETURN: Status. AE_OK if object is OK or was repaired successfully
*
* DESCRIPTION: Repair for the _ALR object. If necessary, sort the object list
* ascending by the ambient illuminance values.
*
*****************************************************************************/
static acpi_status
acpi_ns_repair_ALR(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr)
{
union acpi_operand_object *return_object = *return_object_ptr;
acpi_status status;
status = acpi_ns_check_sorted_list(info, return_object, 0, 2, 1,
ACPI_SORT_ASCENDING,
"AmbientIlluminance");
return (status);
}
/******************************************************************************
*
* FUNCTION: acpi_ns_repair_FDE
*
* PARAMETERS: info - Method execution information block
* return_object_ptr - Pointer to the object returned from the
* evaluation of a method or object
*
* RETURN: Status. AE_OK if object is OK or was repaired successfully
*
* DESCRIPTION: Repair for the _FDE and _GTM objects. The expected return
* value is a Buffer of 5 DWORDs. This function repairs a common
* problem where the return value is a Buffer of BYTEs, not
* DWORDs.
*
*****************************************************************************/
static acpi_status
acpi_ns_repair_FDE(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr)
{
union acpi_operand_object *return_object = *return_object_ptr;
union acpi_operand_object *buffer_object;
u8 *byte_buffer;
u32 *dword_buffer;
u32 i;
ACPI_FUNCTION_NAME(ns_repair_FDE);
switch (return_object->common.type) {
case ACPI_TYPE_BUFFER:
/* This is the expected type. Length should be (at least) 5 DWORDs */
if (return_object->buffer.length >= ACPI_FDE_DWORD_BUFFER_SIZE) {
return (AE_OK);
}
/* We can only repair if we have exactly 5 BYTEs */
if (return_object->buffer.length != ACPI_FDE_BYTE_BUFFER_SIZE) {
ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
info->node_flags,
"Incorrect return buffer length %u, expected %u",
return_object->buffer.length,
ACPI_FDE_DWORD_BUFFER_SIZE));
return (AE_AML_OPERAND_TYPE);
}
/* Create the new (larger) buffer object */
buffer_object =
acpi_ut_create_buffer_object(ACPI_FDE_DWORD_BUFFER_SIZE);
if (!buffer_object) {
return (AE_NO_MEMORY);
}
/* Expand each byte to a DWORD */
byte_buffer = return_object->buffer.pointer;
dword_buffer =
ACPI_CAST_PTR(u32, buffer_object->buffer.pointer);
for (i = 0; i < ACPI_FDE_FIELD_COUNT; i++) {
*dword_buffer = (u32) *byte_buffer;
dword_buffer++;
byte_buffer++;
}
ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
"%s Expanded Byte Buffer to expected DWord Buffer\n",
info->full_pathname));
break;
default:
return (AE_AML_OPERAND_TYPE);
}
/* Delete the original return object, return the new buffer object */
acpi_ut_remove_reference(return_object);
*return_object_ptr = buffer_object;
info->return_flags |= ACPI_OBJECT_REPAIRED;
return (AE_OK);
}
/******************************************************************************
*
* FUNCTION: acpi_ns_repair_CID
*
* PARAMETERS: info - Method execution information block
* return_object_ptr - Pointer to the object returned from the
* evaluation of a method or object
*
* RETURN: Status. AE_OK if object is OK or was repaired successfully
*
* DESCRIPTION: Repair for the _CID object. If a string, ensure that all
* letters are uppercase and that there is no leading asterisk.
* If a Package, ensure same for all string elements.
*
*****************************************************************************/
static acpi_status
acpi_ns_repair_CID(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr)
{
acpi_status status;
union acpi_operand_object *return_object = *return_object_ptr;
union acpi_operand_object **element_ptr;
union acpi_operand_object *original_element;
u16 original_ref_count;
u32 i;
/* Check for _CID as a simple string */
if (return_object->common.type == ACPI_TYPE_STRING) {
status = acpi_ns_repair_HID(info, return_object_ptr);
return (status);
}
/* Exit if not a Package */
if (return_object->common.type != ACPI_TYPE_PACKAGE) {
return (AE_OK);
}
/* Examine each element of the _CID package */
element_ptr = return_object->package.elements;
for (i = 0; i < return_object->package.count; i++) {
original_element = *element_ptr;
original_ref_count = original_element->common.reference_count;
status = acpi_ns_repair_HID(info, element_ptr);
if (ACPI_FAILURE(status)) {
return (status);
}
/* Take care with reference counts */
if (original_element != *element_ptr) {
/* Element was replaced */
(*element_ptr)->common.reference_count =
original_ref_count;
acpi_ut_remove_reference(original_element);
}
element_ptr++;
}
return (AE_OK);
}
/******************************************************************************
*
* FUNCTION: acpi_ns_repair_CST
*
* PARAMETERS: info - Method execution information block
* return_object_ptr - Pointer to the object returned from the
* evaluation of a method or object
*
* RETURN: Status. AE_OK if object is OK or was repaired successfully
*
* DESCRIPTION: Repair for the _CST object:
* 1. Sort the list ascending by C state type
* 2. Ensure type cannot be zero
* 3. A subpackage count of zero means _CST is meaningless
* 4. Count must match the number of C state subpackages
*
*****************************************************************************/
static acpi_status
acpi_ns_repair_CST(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr)
{
union acpi_operand_object *return_object = *return_object_ptr;
union acpi_operand_object **outer_elements;
u32 outer_element_count;
union acpi_operand_object *obj_desc;
acpi_status status;
u8 removing;
u32 i;
ACPI_FUNCTION_NAME(ns_repair_CST);
/*
* Check if the C-state type values are proportional.
*/
outer_element_count = return_object->package.count - 1;
i = 0;
while (i < outer_element_count) {
outer_elements = &return_object->package.elements[i + 1];
removing = FALSE;
if ((*outer_elements)->package.count == 0) {
ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
info->node_flags,
"SubPackage[%u] - removing entry due to zero count",
i));
removing = TRUE;
goto remove_element;
}
obj_desc = (*outer_elements)->package.elements[1]; /* Index1 = Type */
if ((u32)obj_desc->integer.value == 0) {
ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
info->node_flags,
"SubPackage[%u] - removing entry due to invalid Type(0)",
i));
removing = TRUE;
}
remove_element:
if (removing) {
acpi_ns_remove_element(return_object, i + 1);
outer_element_count--;
} else {
i++;
}
}
/* Update top-level package count, Type "Integer" checked elsewhere */
obj_desc = return_object->package.elements[0];
obj_desc->integer.value = outer_element_count;
/*
* Entries (subpackages) in the _CST Package must be sorted by the
* C-state type, in ascending order.
*/
status = acpi_ns_check_sorted_list(info, return_object, 1, 4, 1,
ACPI_SORT_ASCENDING, "C-State Type");
if (ACPI_FAILURE(status)) {
return (status);
}
return (AE_OK);
}
/******************************************************************************
*
* FUNCTION: acpi_ns_repair_HID
*
* PARAMETERS: info - Method execution information block
* return_object_ptr - Pointer to the object returned from the
* evaluation of a method or object
*
* RETURN: Status. AE_OK if object is OK or was repaired successfully
*
* DESCRIPTION: Repair for the _HID object. If a string, ensure that all
* letters are uppercase and that there is no leading asterisk.
*
*****************************************************************************/
static acpi_status
acpi_ns_repair_HID(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr)
{
union acpi_operand_object *return_object = *return_object_ptr;
union acpi_operand_object *new_string;
char *source;
char *dest;
ACPI_FUNCTION_NAME(ns_repair_HID);
/* We only care about string _HID objects (not integers) */
if (return_object->common.type != ACPI_TYPE_STRING) {
return (AE_OK);
}
if (return_object->string.length == 0) {
ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
info->node_flags,
"Invalid zero-length _HID or _CID string"));
/* Return AE_OK anyway, let driver handle it */
info->return_flags |= ACPI_OBJECT_REPAIRED;
return (AE_OK);
}
/* It is simplest to always create a new string object */
new_string = acpi_ut_create_string_object(return_object->string.length);
if (!new_string) {
return (AE_NO_MEMORY);
}
/*
* Remove a leading asterisk if present. For some unknown reason, there
* are many machines in the field that contains IDs like this.
*
* Examples: "*PNP0C03", "*ACPI0003"
*/
source = return_object->string.pointer;
if (*source == '*') {
source++;
new_string->string.length--;
ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
"%s: Removed invalid leading asterisk\n",
info->full_pathname));
}
/*
* Copy and uppercase the string. From the ACPI 5.0 specification:
*
* A valid PNP ID must be of the form "AAA####" where A is an uppercase
* letter and # is a hex digit. A valid ACPI ID must be of the form
* "NNNN####" where N is an uppercase letter or decimal digit, and
* # is a hex digit.
*/
for (dest = new_string->string.pointer; *source; dest++, source++) {
*dest = (char)toupper((int)*source);
}
acpi_ut_remove_reference(return_object);
*return_object_ptr = new_string;
return (AE_OK);
}
/******************************************************************************
*
* FUNCTION: acpi_ns_repair_PRT
*
* PARAMETERS: info - Method execution information block
* return_object_ptr - Pointer to the object returned from the
* evaluation of a method or object
*
* RETURN: Status. AE_OK if object is OK or was repaired successfully
*
* DESCRIPTION: Repair for the _PRT object. If necessary, fix reversed
* source_name and source_index field, a common BIOS bug.
*
*****************************************************************************/
static acpi_status
acpi_ns_repair_PRT(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr)
{
union acpi_operand_object *package_object = *return_object_ptr;
union acpi_operand_object **top_object_list;
union acpi_operand_object **sub_object_list;
union acpi_operand_object *obj_desc;
union acpi_operand_object *sub_package;
u32 element_count;
u32 index;
/* Each element in the _PRT package is a subpackage */
top_object_list = package_object->package.elements;
element_count = package_object->package.count;
/* Examine each subpackage */
for (index = 0; index < element_count; index++, top_object_list++) {
sub_package = *top_object_list;
sub_object_list = sub_package->package.elements;
/* Check for minimum required element count */
if (sub_package->package.count < 4) {
continue;
}
/*
* If the BIOS has erroneously reversed the _PRT source_name (index 2)
* and the source_index (index 3), fix it. _PRT is important enough to
* workaround this BIOS error. This also provides compatibility with
* other ACPI implementations.
*/
obj_desc = sub_object_list[3];
if (!obj_desc || (obj_desc->common.type != ACPI_TYPE_INTEGER)) {
sub_object_list[3] = sub_object_list[2];
sub_object_list[2] = obj_desc;
info->return_flags |= ACPI_OBJECT_REPAIRED;
ACPI_WARN_PREDEFINED((AE_INFO,
info->full_pathname,
info->node_flags,
"PRT[%X]: Fixed reversed SourceName and SourceIndex",
index));
}
}
return (AE_OK);
}
/******************************************************************************
*
* FUNCTION: acpi_ns_repair_PSS
*
* PARAMETERS: info - Method execution information block
* return_object_ptr - Pointer to the object returned from the
* evaluation of a method or object
*
* RETURN: Status. AE_OK if object is OK or was repaired successfully
*
* DESCRIPTION: Repair for the _PSS object. If necessary, sort the object list
* by the CPU frequencies. Check that the power dissipation values
* are all proportional to CPU frequency (i.e., sorting by
* frequency should be the same as sorting by power.)
*
*****************************************************************************/
static acpi_status
acpi_ns_repair_PSS(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr)
{
union acpi_operand_object *return_object = *return_object_ptr;
union acpi_operand_object **outer_elements;
u32 outer_element_count;
union acpi_operand_object **elements;
union acpi_operand_object *obj_desc;
u32 previous_value;
acpi_status status;
u32 i;
/*
* Entries (subpackages) in the _PSS Package must be sorted by power
* dissipation, in descending order. If it appears that the list is
* incorrectly sorted, sort it. We sort by cpu_frequency, since this
* should be proportional to the power.
*/
status = acpi_ns_check_sorted_list(info, return_object, 0, 6, 0,
ACPI_SORT_DESCENDING,
"CpuFrequency");
if (ACPI_FAILURE(status)) {
return (status);
}
/*
* We now know the list is correctly sorted by CPU frequency. Check if
* the power dissipation values are proportional.
*/
previous_value = ACPI_UINT32_MAX;
outer_elements = return_object->package.elements;
outer_element_count = return_object->package.count;
for (i = 0; i < outer_element_count; i++) {
elements = (*outer_elements)->package.elements;
obj_desc = elements[1]; /* Index1 = power_dissipation */
if ((u32) obj_desc->integer.value > previous_value) {
ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
info->node_flags,
"SubPackage[%u,%u] - suspicious power dissipation values",
i - 1, i));
}
previous_value = (u32) obj_desc->integer.value;
outer_elements++;
}
return (AE_OK);
}
/******************************************************************************
*
* FUNCTION: acpi_ns_repair_TSS
*
* PARAMETERS: info - Method execution information block
* return_object_ptr - Pointer to the object returned from the
* evaluation of a method or object
*
* RETURN: Status. AE_OK if object is OK or was repaired successfully
*
* DESCRIPTION: Repair for the _TSS object. If necessary, sort the object list
* descending by the power dissipation values.
*
*****************************************************************************/
static acpi_status
acpi_ns_repair_TSS(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr)
{
union acpi_operand_object *return_object = *return_object_ptr;
acpi_status status;
struct acpi_namespace_node *node;
/*
* We can only sort the _TSS return package if there is no _PSS in the
* same scope. This is because if _PSS is present, the ACPI specification
* dictates that the _TSS Power Dissipation field is to be ignored, and
* therefore some BIOSs leave garbage values in the _TSS Power field(s).
* In this case, it is best to just return the _TSS package as-is.
* (May, 2011)
*/
status = acpi_ns_get_node(info->node, "^_PSS",
ACPI_NS_NO_UPSEARCH, &node);
if (ACPI_SUCCESS(status)) {
return (AE_OK);
}
status = acpi_ns_check_sorted_list(info, return_object, 0, 5, 1,
ACPI_SORT_DESCENDING,
"PowerDissipation");
return (status);
}
/******************************************************************************
*
* FUNCTION: acpi_ns_check_sorted_list
*
* PARAMETERS: info - Method execution information block
* return_object - Pointer to the top-level returned object
* start_index - Index of the first subpackage
* expected_count - Minimum length of each subpackage
* sort_index - Subpackage entry to sort on
* sort_direction - Ascending or descending
* sort_key_name - Name of the sort_index field
*
* RETURN: Status. AE_OK if the list is valid and is sorted correctly or
* has been repaired by sorting the list.
*
* DESCRIPTION: Check if the package list is valid and sorted correctly by the
* sort_index. If not, then sort the list.
*
*****************************************************************************/
static acpi_status
acpi_ns_check_sorted_list(struct acpi_evaluate_info *info,
union acpi_operand_object *return_object,
u32 start_index,
u32 expected_count,
u32 sort_index,
u8 sort_direction, char *sort_key_name)
{
u32 outer_element_count;
union acpi_operand_object **outer_elements;
union acpi_operand_object **elements;
union acpi_operand_object *obj_desc;
u32 i;
u32 previous_value;
ACPI_FUNCTION_NAME(ns_check_sorted_list);
/* The top-level object must be a package */
if (return_object->common.type != ACPI_TYPE_PACKAGE) {
return (AE_AML_OPERAND_TYPE);
}
/*
* NOTE: assumes list of subpackages contains no NULL elements.
* Any NULL elements should have been removed by earlier call
* to acpi_ns_remove_null_elements.
*/
outer_element_count = return_object->package.count;
if (!outer_element_count || start_index >= outer_element_count) {
return (AE_AML_PACKAGE_LIMIT);
}
outer_elements = &return_object->package.elements[start_index];
outer_element_count -= start_index;
previous_value = 0;
if (sort_direction == ACPI_SORT_DESCENDING) {
previous_value = ACPI_UINT32_MAX;
}
/* Examine each subpackage */
for (i = 0; i < outer_element_count; i++) {
/* Each element of the top-level package must also be a package */
if ((*outer_elements)->common.type != ACPI_TYPE_PACKAGE) {
return (AE_AML_OPERAND_TYPE);
}
/* Each subpackage must have the minimum length */
if ((*outer_elements)->package.count < expected_count) {
return (AE_AML_PACKAGE_LIMIT);
}
elements = (*outer_elements)->package.elements;
obj_desc = elements[sort_index];
if (obj_desc->common.type != ACPI_TYPE_INTEGER) {
return (AE_AML_OPERAND_TYPE);
}
/*
* The list must be sorted in the specified order. If we detect a
* discrepancy, sort the entire list.
*/
if (((sort_direction == ACPI_SORT_ASCENDING) &&
(obj_desc->integer.value < previous_value)) ||
((sort_direction == ACPI_SORT_DESCENDING) &&
(obj_desc->integer.value > previous_value))) {
acpi_ns_sort_list(&return_object->package.
elements[start_index],
outer_element_count, sort_index,
sort_direction);
info->return_flags |= ACPI_OBJECT_REPAIRED;
ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
"%s: Repaired unsorted list - now sorted by %s\n",
info->full_pathname, sort_key_name));
return (AE_OK);
}
previous_value = (u32) obj_desc->integer.value;
outer_elements++;
}
return (AE_OK);
}
/******************************************************************************
*
* FUNCTION: acpi_ns_sort_list
*
* PARAMETERS: elements - Package object element list
* count - Element count for above
* index - Sort by which package element
* sort_direction - Ascending or Descending sort
*
* RETURN: None
*
* DESCRIPTION: Sort the objects that are in a package element list.
*
* NOTE: Assumes that all NULL elements have been removed from the package,
* and that all elements have been verified to be of type Integer.
*
*****************************************************************************/
static void
acpi_ns_sort_list(union acpi_operand_object **elements,
u32 count, u32 index, u8 sort_direction)
{
union acpi_operand_object *obj_desc1;
union acpi_operand_object *obj_desc2;
union acpi_operand_object *temp_obj;
u32 i;
u32 j;
/* Simple bubble sort */
for (i = 1; i < count; i++) {
for (j = (count - 1); j >= i; j--) {
obj_desc1 = elements[j - 1]->package.elements[index];
obj_desc2 = elements[j]->package.elements[index];
if (((sort_direction == ACPI_SORT_ASCENDING) &&
(obj_desc1->integer.value >
obj_desc2->integer.value))
|| ((sort_direction == ACPI_SORT_DESCENDING)
&& (obj_desc1->integer.value <
obj_desc2->integer.value))) {
temp_obj = elements[j - 1];
elements[j - 1] = elements[j];
elements[j] = temp_obj;
}
}
}
}
/******************************************************************************
*
* FUNCTION: acpi_ns_remove_element
*
* PARAMETERS: obj_desc - Package object element list
* index - Index of element to remove
*
* RETURN: None
*
* DESCRIPTION: Remove the requested element of a package and delete it.
*
*****************************************************************************/
static void
acpi_ns_remove_element(union acpi_operand_object *obj_desc, u32 index)
{
union acpi_operand_object **source;
union acpi_operand_object **dest;
u32 count;
u32 new_count;
u32 i;
ACPI_FUNCTION_NAME(ns_remove_element);
count = obj_desc->package.count;
new_count = count - 1;
source = obj_desc->package.elements;
dest = source;
/* Examine all elements of the package object, remove matched index */
for (i = 0; i < count; i++) {
if (i == index) {
acpi_ut_remove_reference(*source); /* Remove one ref for being in pkg */
acpi_ut_remove_reference(*source);
} else {
*dest = *source;
dest++;
}
source++;
}
/* NULL terminate list and update the package count */
*dest = NULL;
obj_desc->package.count = new_count;
}
| AiJiaZone/linux-4.0 | virt/drivers/acpi/acpica/nsrepair2.c | C | gpl-2.0 | 31,111 |
/*
* Copyright (C) ST-Ericsson SA 2010
*
* License terms: GNU General Public License (GPL) version 2
* Author: Virupax Sadashivpetimath <virupax.sadashivpetimath@stericsson.com>
*
* RTC clock driver for the RTC part of the AB8500 Power management chip.
* Based on RTC clock driver for the AB3100 Analog Baseband Chip by
* Linus Walleij <linus.walleij@stericsson.com>
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/rtc.h>
#include <linux/mfd/abx500.h>
#include <linux/mfd/abx500/ab8500.h>
#include <linux/delay.h>
#define AB8500_RTC_SOFF_STAT_REG 0x00
#define AB8500_RTC_CC_CONF_REG 0x01
#define AB8500_RTC_READ_REQ_REG 0x02
#define AB8500_RTC_WATCH_TSECMID_REG 0x03
#define AB8500_RTC_WATCH_TSECHI_REG 0x04
#define AB8500_RTC_WATCH_TMIN_LOW_REG 0x05
#define AB8500_RTC_WATCH_TMIN_MID_REG 0x06
#define AB8500_RTC_WATCH_TMIN_HI_REG 0x07
#define AB8500_RTC_ALRM_MIN_LOW_REG 0x08
#define AB8500_RTC_ALRM_MIN_MID_REG 0x09
#define AB8500_RTC_ALRM_MIN_HI_REG 0x0A
#define AB8500_RTC_STAT_REG 0x0B
#define AB8500_RTC_BKUP_CHG_REG 0x0C
#define AB8500_RTC_FORCE_BKUP_REG 0x0D
#define AB8500_RTC_CALIB_REG 0x0E
#define AB8500_RTC_SWITCH_STAT_REG 0x0F
/* RtcReadRequest bits */
#define RTC_READ_REQUEST 0x01
#define RTC_WRITE_REQUEST 0x02
/* RtcCtrl bits */
#define RTC_ALARM_ENA 0x04
#define RTC_STATUS_DATA 0x01
#define COUNTS_PER_SEC (0xF000 / 60)
#define AB8500_RTC_EPOCH 2000
static const u8 ab8500_rtc_time_regs[] = {
AB8500_RTC_WATCH_TMIN_HI_REG, AB8500_RTC_WATCH_TMIN_MID_REG,
AB8500_RTC_WATCH_TMIN_LOW_REG, AB8500_RTC_WATCH_TSECHI_REG,
AB8500_RTC_WATCH_TSECMID_REG
};
static const u8 ab8500_rtc_alarm_regs[] = {
AB8500_RTC_ALRM_MIN_HI_REG, AB8500_RTC_ALRM_MIN_MID_REG,
AB8500_RTC_ALRM_MIN_LOW_REG
};
/* Calculate the seconds from 1970 to 01-01-2000 00:00:00 */
static unsigned long get_elapsed_seconds(int year)
{
unsigned long secs;
struct rtc_time tm = {
.tm_year = year - 1900,
.tm_mday = 1,
};
/*
* This function calculates secs from 1970 and not from
* 1900, even if we supply the offset from year 1900.
*/
rtc_tm_to_time(&tm, &secs);
return secs;
}
static int ab8500_rtc_read_time(struct device *dev, struct rtc_time *tm)
{
unsigned long timeout = jiffies + HZ;
int retval, i;
unsigned long mins, secs;
unsigned char buf[ARRAY_SIZE(ab8500_rtc_time_regs)];
u8 value;
/* Request a data read */
retval = abx500_set_register_interruptible(dev,
AB8500_RTC, AB8500_RTC_READ_REQ_REG, RTC_READ_REQUEST);
if (retval < 0)
return retval;
/* Early AB8500 chips will not clear the rtc read request bit */
if (abx500_get_chip_id(dev) == 0) {
usleep_range(1000, 1000);
} else {
/* Wait for some cycles after enabling the rtc read in ab8500 */
while (time_before(jiffies, timeout)) {
retval = abx500_get_register_interruptible(dev,
AB8500_RTC, AB8500_RTC_READ_REQ_REG, &value);
if (retval < 0)
return retval;
if (!(value & RTC_READ_REQUEST))
break;
usleep_range(1000, 5000);
}
}
/* Read the Watchtime registers */
for (i = 0; i < ARRAY_SIZE(ab8500_rtc_time_regs); i++) {
retval = abx500_get_register_interruptible(dev,
AB8500_RTC, ab8500_rtc_time_regs[i], &value);
if (retval < 0)
return retval;
buf[i] = value;
}
mins = (buf[0] << 16) | (buf[1] << 8) | buf[2];
secs = (buf[3] << 8) | buf[4];
secs = secs / COUNTS_PER_SEC;
secs = secs + (mins * 60);
/* Add back the initially subtracted number of seconds */
secs += get_elapsed_seconds(AB8500_RTC_EPOCH);
rtc_time_to_tm(secs, tm);
return rtc_valid_tm(tm);
}
static int ab8500_rtc_set_time(struct device *dev, struct rtc_time *tm)
{
int retval, i;
unsigned char buf[ARRAY_SIZE(ab8500_rtc_time_regs)];
unsigned long no_secs, no_mins, secs = 0;
if (tm->tm_year < (AB8500_RTC_EPOCH - 1900)) {
dev_dbg(dev, "year should be equal to or greater than %d\n",
AB8500_RTC_EPOCH);
return -EINVAL;
}
/* Get the number of seconds since 1970 */
rtc_tm_to_time(tm, &secs);
/*
* Convert it to the number of seconds since 01-01-2000 00:00:00, since
* we only have a small counter in the RTC.
*/
secs -= get_elapsed_seconds(AB8500_RTC_EPOCH);
no_mins = secs / 60;
no_secs = secs % 60;
/* Make the seconds count as per the RTC resolution */
no_secs = no_secs * COUNTS_PER_SEC;
buf[4] = no_secs & 0xFF;
buf[3] = (no_secs >> 8) & 0xFF;
buf[2] = no_mins & 0xFF;
buf[1] = (no_mins >> 8) & 0xFF;
buf[0] = (no_mins >> 16) & 0xFF;
for (i = 0; i < ARRAY_SIZE(ab8500_rtc_time_regs); i++) {
retval = abx500_set_register_interruptible(dev, AB8500_RTC,
ab8500_rtc_time_regs[i], buf[i]);
if (retval < 0)
return retval;
}
/* Request a data write */
return abx500_set_register_interruptible(dev, AB8500_RTC,
AB8500_RTC_READ_REQ_REG, RTC_WRITE_REQUEST);
}
static int ab8500_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm)
{
int retval, i;
u8 rtc_ctrl, value;
unsigned char buf[ARRAY_SIZE(ab8500_rtc_alarm_regs)];
unsigned long secs, mins;
/* Check if the alarm is enabled or not */
retval = abx500_get_register_interruptible(dev, AB8500_RTC,
AB8500_RTC_STAT_REG, &rtc_ctrl);
if (retval < 0)
return retval;
if (rtc_ctrl & RTC_ALARM_ENA)
alarm->enabled = 1;
else
alarm->enabled = 0;
alarm->pending = 0;
for (i = 0; i < ARRAY_SIZE(ab8500_rtc_alarm_regs); i++) {
retval = abx500_get_register_interruptible(dev, AB8500_RTC,
ab8500_rtc_alarm_regs[i], &value);
if (retval < 0)
return retval;
buf[i] = value;
}
mins = (buf[0] << 16) | (buf[1] << 8) | (buf[2]);
secs = mins * 60;
/* Add back the initially subtracted number of seconds */
secs += get_elapsed_seconds(AB8500_RTC_EPOCH);
rtc_time_to_tm(secs, &alarm->time);
return rtc_valid_tm(&alarm->time);
}
static int ab8500_rtc_irq_enable(struct device *dev, unsigned int enabled)
{
return abx500_mask_and_set_register_interruptible(dev, AB8500_RTC,
AB8500_RTC_STAT_REG, RTC_ALARM_ENA,
enabled ? RTC_ALARM_ENA : 0);
}
static int ab8500_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
{
int retval, i;
unsigned char buf[ARRAY_SIZE(ab8500_rtc_alarm_regs)];
unsigned long mins, secs = 0;
if (alarm->time.tm_year < (AB8500_RTC_EPOCH - 1900)) {
dev_dbg(dev, "year should be equal to or greater than %d\n",
AB8500_RTC_EPOCH);
return -EINVAL;
}
/* Get the number of seconds since 1970 */
rtc_tm_to_time(&alarm->time, &secs);
/*
* Convert it to the number of seconds since 01-01-2000 00:00:00, since
* we only have a small counter in the RTC.
*/
secs -= get_elapsed_seconds(AB8500_RTC_EPOCH);
mins = secs / 60;
buf[2] = mins & 0xFF;
buf[1] = (mins >> 8) & 0xFF;
buf[0] = (mins >> 16) & 0xFF;
/* Set the alarm time */
for (i = 0; i < ARRAY_SIZE(ab8500_rtc_alarm_regs); i++) {
retval = abx500_set_register_interruptible(dev, AB8500_RTC,
ab8500_rtc_alarm_regs[i], buf[i]);
if (retval < 0)
return retval;
}
return ab8500_rtc_irq_enable(dev, alarm->enabled);
}
static int ab8500_rtc_set_calibration(struct device *dev, int calibration)
{
int retval;
u8 rtccal = 0;
/*
* Check that the calibration value (which is in units of 0.5
* parts-per-million) is in the AB8500's range for RtcCalibration
* register. -128 (0x80) is not permitted because the AB8500 uses
* a sign-bit rather than two's complement, so 0x80 is just another
* representation of zero.
*/
if ((calibration < -127) || (calibration > 127)) {
dev_err(dev, "RtcCalibration value outside permitted range\n");
return -EINVAL;
}
/*
* The AB8500 uses sign (in bit7) and magnitude (in bits0-7)
* so need to convert to this sort of representation before writing
* into RtcCalibration register...
*/
if (calibration >= 0)
rtccal = 0x7F & calibration;
else
rtccal = ~(calibration - 1) | 0x80;
retval = abx500_set_register_interruptible(dev, AB8500_RTC,
AB8500_RTC_CALIB_REG, rtccal);
return retval;
}
static int ab8500_rtc_get_calibration(struct device *dev, int *calibration)
{
int retval;
u8 rtccal = 0;
retval = abx500_get_register_interruptible(dev, AB8500_RTC,
AB8500_RTC_CALIB_REG, &rtccal);
if (retval >= 0) {
/*
* The AB8500 uses sign (in bit7) and magnitude (in bits0-7)
* so need to convert value from RtcCalibration register into
* a two's complement signed value...
*/
if (rtccal & 0x80)
*calibration = 0 - (rtccal & 0x7F);
else
*calibration = 0x7F & rtccal;
}
return retval;
}
static ssize_t ab8500_sysfs_store_rtc_calibration(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
int retval;
int calibration = 0;
if (sscanf(buf, " %i ", &calibration) != 1) {
dev_err(dev, "Failed to store RTC calibration attribute\n");
return -EINVAL;
}
retval = ab8500_rtc_set_calibration(dev, calibration);
return retval ? retval : count;
}
static ssize_t ab8500_sysfs_show_rtc_calibration(struct device *dev,
struct device_attribute *attr, char *buf)
{
int retval = 0;
int calibration = 0;
retval = ab8500_rtc_get_calibration(dev, &calibration);
if (retval < 0) {
dev_err(dev, "Failed to read RTC calibration attribute\n");
sprintf(buf, "0\n");
return retval;
}
return sprintf(buf, "%d\n", calibration);
}
static DEVICE_ATTR(rtc_calibration, S_IRUGO | S_IWUSR,
ab8500_sysfs_show_rtc_calibration,
ab8500_sysfs_store_rtc_calibration);
static int ab8500_sysfs_rtc_register(struct device *dev)
{
return device_create_file(dev, &dev_attr_rtc_calibration);
}
static void ab8500_sysfs_rtc_unregister(struct device *dev)
{
device_remove_file(dev, &dev_attr_rtc_calibration);
}
static irqreturn_t rtc_alarm_handler(int irq, void *data)
{
struct rtc_device *rtc = data;
unsigned long events = RTC_IRQF | RTC_AF;
dev_dbg(&rtc->dev, "%s\n", __func__);
rtc_update_irq(rtc, 1, events);
return IRQ_HANDLED;
}
static const struct rtc_class_ops ab8500_rtc_ops = {
.read_time = ab8500_rtc_read_time,
.set_time = ab8500_rtc_set_time,
.read_alarm = ab8500_rtc_read_alarm,
.set_alarm = ab8500_rtc_set_alarm,
.alarm_irq_enable = ab8500_rtc_irq_enable,
};
static int __devinit ab8500_rtc_probe(struct platform_device *pdev)
{
int err;
struct rtc_device *rtc;
u8 rtc_ctrl;
int irq;
irq = platform_get_irq_byname(pdev, "ALARM");
if (irq < 0)
return irq;
/* For RTC supply test */
err = abx500_mask_and_set_register_interruptible(&pdev->dev, AB8500_RTC,
AB8500_RTC_STAT_REG, RTC_STATUS_DATA, RTC_STATUS_DATA);
if (err < 0)
return err;
/* Wait for reset by the PorRtc */
usleep_range(1000, 5000);
err = abx500_get_register_interruptible(&pdev->dev, AB8500_RTC,
AB8500_RTC_STAT_REG, &rtc_ctrl);
if (err < 0)
return err;
/* Check if the RTC Supply fails */
if (!(rtc_ctrl & RTC_STATUS_DATA)) {
dev_err(&pdev->dev, "RTC supply failure\n");
return -ENODEV;
}
device_init_wakeup(&pdev->dev, true);
rtc = rtc_device_register("ab8500-rtc", &pdev->dev, &ab8500_rtc_ops,
THIS_MODULE);
if (IS_ERR(rtc)) {
dev_err(&pdev->dev, "Registration failed\n");
err = PTR_ERR(rtc);
return err;
}
err = request_threaded_irq(irq, NULL, rtc_alarm_handler,
IRQF_NO_SUSPEND, "ab8500-rtc", rtc);
if (err < 0) {
rtc_device_unregister(rtc);
return err;
}
platform_set_drvdata(pdev, rtc);
err = ab8500_sysfs_rtc_register(&pdev->dev);
if (err) {
dev_err(&pdev->dev, "sysfs RTC failed to register\n");
return err;
}
return 0;
}
static int __devexit ab8500_rtc_remove(struct platform_device *pdev)
{
struct rtc_device *rtc = platform_get_drvdata(pdev);
int irq = platform_get_irq_byname(pdev, "ALARM");
ab8500_sysfs_rtc_unregister(&pdev->dev);
free_irq(irq, rtc);
rtc_device_unregister(rtc);
platform_set_drvdata(pdev, NULL);
return 0;
}
static struct platform_driver ab8500_rtc_driver = {
.driver = {
.name = "ab8500-rtc",
.owner = THIS_MODULE,
},
.probe = ab8500_rtc_probe,
.remove = __devexit_p(ab8500_rtc_remove),
};
module_platform_driver(ab8500_rtc_driver);
MODULE_AUTHOR("Virupax Sadashivpetimath <virupax.sadashivpetimath@stericsson.com>");
MODULE_DESCRIPTION("AB8500 RTC Driver");
MODULE_LICENSE("GPL v2");
| itgb/opCloudRouter | qca/src/linux/drivers/rtc/rtc-ab8500.c | C | gpl-2.0 | 12,132 |
# == Schema Information
#
# Table name: runner_projects
#
# id :integer not null, primary key
# runner_id :integer not null
# project_id :integer not null
# created_at :datetime
# updated_at :datetime
#
module Ci
class RunnerProject < ActiveRecord::Base
extend Ci::Model
belongs_to :runner, class_name: 'Ci::Runner'
belongs_to :project, class_name: 'Ci::Project'
validates_uniqueness_of :runner_id, scope: :project_id
end
end
| Exeia/gitlabhq | app/models/ci/runner_project.rb | Ruby | mit | 494 |
/*
Simple Random Number Generators
- getuniform - uniform deviate [0,1]
- getnorm - gaussian (normal) deviate (mean=0, stddev=1)
- getpoisson - poisson deviate for given expected mean lambda
This code is adapted from SimpleRNG by John D Cook, which is
provided in the public domain.
The original C++ code is found here:
http://www.johndcook.com/cpp_random_number_generation.html
This code has been modified in the following ways compared to the
original.
1. convert to C from C++
2. keep only uniform, gaussian and poisson deviates
3. state variables are module static instead of class variables
4. provide an srand() equivalent to initialize the state
*/
extern void simplerng_setstate(unsigned int u, unsigned int v);
extern void simplerng_getstate(unsigned int *u, unsigned int *v);
extern void simplerng_srand(unsigned int seed);
extern double simplerng_getuniform(void);
extern double simplerng_getnorm(void);
extern int simplerng_getpoisson(double lambda);
extern double simplerng_logfactorial(int n);
| teuben/masc | www/js/lib/js9-3.5/astroem/include/simplerng.h | C | mit | 1,078 |
//
// RTLabel.h
// RTLabelProject
//
/**
* Copyright (c) 2010 Muh Hon Cheng
* Created by honcheng on 1/6/11.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject
* to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT
* WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR
* PURPOSE AND NONINFRINGEMENT. IN NO EVENT
* SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR
* IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* @author Muh Hon Cheng <honcheng@gmail.com>
* @copyright 2011 Muh Hon Cheng
* @version
*
*/
#import <UIKit/UIKit.h>
#import <CoreText/CoreText.h>
typedef enum
{
RTTextAlignmentRight = kCTRightTextAlignment,
RTTextAlignmentLeft = kCTLeftTextAlignment,
RTTextAlignmentCenter = kCTCenterTextAlignment,
RTTextAlignmentJustify = kCTJustifiedTextAlignment
} RTTextAlignment;
typedef enum
{
RTTextLineBreakModeWordWrapping = kCTLineBreakByWordWrapping,
RTTextLineBreakModeCharWrapping = kCTLineBreakByCharWrapping,
RTTextLineBreakModeClip = kCTLineBreakByClipping,
}RTTextLineBreakMode;
@protocol RTLabelDelegate <NSObject>
@optional
- (void)rtLabel:(id)rtLabel didSelectLinkWithURL:(NSURL*)url;
@end
@interface RTLabelComponent : NSObject
@property (nonatomic, assign) int componentIndex;
@property (nonatomic, copy) NSString *text;
@property (nonatomic, copy) NSString *tagLabel;
@property (nonatomic) NSMutableDictionary *attributes;
@property (nonatomic, assign) int position;
- (id)initWithString:(NSString*)aText tag:(NSString*)aTagLabel attributes:(NSMutableDictionary*)theAttributes;
+ (id)componentWithString:(NSString*)aText tag:(NSString*)aTagLabel attributes:(NSMutableDictionary*)theAttributes;
- (id)initWithTag:(NSString*)aTagLabel position:(int)_position attributes:(NSMutableDictionary*)_attributes;
+ (id)componentWithTag:(NSString*)aTagLabel position:(int)aPosition attributes:(NSMutableDictionary*)theAttributes;
@end
@interface RTLabelExtractedComponent : NSObject
@property (nonatomic, strong) NSMutableArray *textComponents;
@property (nonatomic, copy) NSString *plainText;
+ (RTLabelExtractedComponent*)rtLabelExtractComponentsWithTextComponent:(NSMutableArray*)textComponents plainText:(NSString*)plainText;
@end
@interface RTLabel : UIView
@property (nonatomic, copy) NSString *text, *plainText, *highlightedText;
@property (nonatomic, strong) UIColor *textColor;
@property (nonatomic, strong) UIFont *font;
@property (nonatomic, strong) NSDictionary *linkAttributes;
@property (nonatomic, strong) NSDictionary *selectedLinkAttributes;
@property (nonatomic, unsafe_unretained) id<RTLabelDelegate> delegate;
@property (nonatomic, copy) NSString *paragraphReplacement;
@property (nonatomic, strong) NSMutableArray *textComponents, *highlightedTextComponents;
@property (nonatomic, assign) RTTextAlignment textAlignment;
@property (nonatomic, assign) CGSize optimumSize;
@property (nonatomic, assign) RTTextLineBreakMode lineBreakMode;
@property (nonatomic, assign) CGFloat lineSpacing;
@property (nonatomic, assign) int currentSelectedButtonComponentIndex;
@property (nonatomic, assign) CFRange visibleRange;
@property (nonatomic, assign) BOOL highlighted;
// set text
- (void)setText:(NSString*)text;
+ (RTLabelExtractedComponent*)extractTextStyleFromText:(NSString*)data paragraphReplacement:(NSString*)paragraphReplacement;
// get the visible text
- (NSString*)visibleText;
// alternative
// from susieyy http://github.com/susieyy
// The purpose of this code is to cache pre-create the textComponents, is to improve the performance when drawing the text.
// This improvement is effective if the text is long.
- (void)setText:(NSString *)text extractedTextComponent:(RTLabelExtractedComponent*)extractedComponent;
- (void)setHighlightedText:(NSString *)text extractedTextComponent:(RTLabelExtractedComponent*)extractedComponent;
- (void)setText:(NSString *)text extractedTextStyle:(NSDictionary*)extractTextStyle __attribute__((deprecated));
+ (NSDictionary*)preExtractTextStyle:(NSString*)data __attribute__((deprecated));
@end
| jimneylee/JLOSChina-iPhone-V2 | vendor/RTLabel/RTLabel.h | C | mit | 4,806 |
<!-- Generated by Rakefile:build -->
<strong>
TeMc
</strong>
on 2012-04-06 21:31:15 <br />
@Jean Marie:
1) Maybe it should be limited to arrays, like PHP does
2) No, because the purpose of this website is to re-create php functions in javascript. Feature requests are not accepted here by design.
<hr />
<strong>
<a href="http://brett-zamir.me" rel="nofollow">Brett Zamir</a>
</strong>
on 2009-08-11 19:43:20 <br />
Sorry again, but my reply is mistaken as well. And it will all really depend on whether you are trying to build a return array which returns all of the keys shared across arrays based on the first one, and those subkeys which are shared as well, or if you want to ensure that those whose keys match across all arrays must also, if they are objects, have subkeys which are also contained across all arrays (or otherwise not include them)...
<hr />
<strong>
<a href="http://brett-zamir.me" rel="nofollow">Brett Zamir</a>
</strong>
on 2009-08-11 19:23:18 <br />
Sorry, I realized the long 'if' should be changed to this to account for null values:
<pre><code>if (i === arguments.length-1 && (typeof arr1[k1] !== 'object' || typeof arr1[k1] === null || ct(arr[k]) === ct( this.array_intersect_key_recursive.apply(this, tempArr)))) {</code></pre>
<hr />
<strong>
<a href="http://brett-zamir.me" rel="nofollow">Brett Zamir</a>
</strong>
on 2009-08-11 19:04:33 <br />
@Jean Marie: Glad to hear it fit your needs... Since there is otherwise no reasonable way for us to represent associative arrays in JavaScript, the PHP.JS project generally considers objects to be as arrays. As far as your question, I am guessing you want to ensure that only those keys are returned where there is a perfect match, including any subkeys? Here is a recursive version that seems to work for this:
<pre><code>var_dump(
array_intersect_key_recursive({a:3, b:{c:5, d:5}, q:{r:5}}, {a:'z', c:'y', b:{c:6, d:8}, q:{s:5}})
);
function array_intersect_key_recursive () {
var arr1 = arguments[0], retArr = {};
var k1 = '', arr = {}, i = 0, k = '';
var ct = function (obj) {
var c = 0;
for (var p in obj) {
c++;
}
return c;
};
arr1keys:
for (k1 in arr1) {
var tempArr = [arr1[k1]];
arrs:
for (i=1; i < arguments.length; i++) {
arr = arguments[i];
for (k in arr) {
if (k === k1) {
tempArr.push(arr[k]);
if (i === arguments.length-1 && (typeof arr1[k1] !== 'object' || ct(arr[k]) === ct( this.array_intersect_key_recursive.apply(this, tempArr)))) {
retArr[k1] = arr1[k1];
}
// If the innermost loop always leads at least once to an equal value, continue the loop until done
continue arrs;
}
}
// If it reaches here, it wasn't found in at least one array, so try next value
continue arr1keys;
}
}
return retArr;
}</code></pre>
<hr />
<strong>
Jean Marie
</strong>
on 2009-08-11 11:28:37 <br />
Hi,
nice function i was looking for. Thanks!
Two points to mention:
1) You're not handling arrays! It should be named object_intersect_key().
2) Is it possible to get this working in recursive.
Best regards
Jean Marie
<hr />
| cigraphics/phpjs | _octopress/source/functions/array_intersect_key/_comments.html | HTML | mit | 3,369 |
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example - example-example92</title>
<script src="../../../angular.min.js"></script>
<script src="script.js"></script>
</head>
<body ng-app="eventExampleApp">
<div ng-controller="EventController">
<button ng-click="clickMe($event)">Event</button>
<p><code>$event</code>: <pre> {{$event | json}}</pre></p>
<p><code>clickEvent</code>: <pre>{{clickEvent | json}}</pre></p>
</div>
</body>
</html> | abique/scissy | www/vendor/angular/docs/examples/example-example92/index.html | HTML | gpl-2.0 | 498 |
// { dg-options "-std=c++0x" }
// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
// Copyright (C) 2008-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <random>
#include <testsuite_hooks.h>
void
test01()
{
bool test __attribute__((unused)) = true;
std::subtract_with_carry_engine<unsigned long, 24, 10, 24> x;
VERIFY( x.min() == 0 );
VERIFY( x.max() == ((1UL << 24) - 1) );
VERIFY( x() == 15039276 );
}
int main()
{
test01();
return 0;
}
| atgreen/gcc | libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/default.cc | C++ | gpl-2.0 | 1,206 |
// { dg-options "-std=gnu++0x" }
// 2010-03-23 Paolo Carlini <paolo.carlini@oracle.com>
//
// Copyright (C) 2010-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <type_traits>
#include <testsuite_hooks.h>
#include <testsuite_tr1.h>
void test01()
{
bool test __attribute__((unused)) = true;
using std::is_literal_type;
using namespace __gnu_test;
VERIFY( (test_category<is_literal_type, int>(true)) );
VERIFY( (test_category<is_literal_type, unsigned char>(true)) );
VERIFY( (test_category<is_literal_type, TType>(true)) );
VERIFY( (test_category<is_literal_type, PODType>(true)) );
VERIFY( (test_category<is_literal_type, NType>(false)) );
VERIFY( (test_category<is_literal_type, SLType>(false)) );
VERIFY( (test_category<is_literal_type, LType>(true)) );
VERIFY( (test_category<is_literal_type, LType[5]>(true)) );
VERIFY( (test_category<is_literal_type, NLType>(false)) );
VERIFY( (test_category<is_literal_type, NLType[5]>(false)) );
VERIFY( (test_category<is_literal_type, LTypeDerived>(true)) );
VERIFY( (test_category<is_literal_type, LTypeDerived[5]>(true)) );
}
int main()
{
test01();
return 0;
}
| pschorf/gcc-races | libstdc++-v3/testsuite/20_util/is_literal_type/value.cc | C++ | gpl-2.0 | 1,855 |
// Copyright (C) 2010-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
//
// { dg-require-debug-mode "" }
// { dg-do run { xfail *-*-* } }
#include <map>
#include <debug/checks.h>
void test01()
{
__gnu_test::check_insert3<std::map<int, int> >();
}
int main()
{
test01();
return 0;
}
| atgreen/gcc | libstdc++-v3/testsuite/23_containers/map/debug/insert3_neg.cc | C++ | gpl-2.0 | 988 |
// Copyright (C) 2004-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// { dg-require-fileio "" }
// 27.6.1.3 unformatted input functions
// NB: ostream has a particular "seeks" category. Adopt this for istreams too.
// @require@ %-*.tst %-*.txt
// @diff@ %-*.tst %-*.txt
#include <istream>
#include <sstream>
#include <fstream>
#include <testsuite_hooks.h>
// fstreams
void test04(void)
{
typedef std::wistream::off_type off_type;
bool test __attribute__((unused)) = true;
std::wistream::pos_type pos01, pos02, pos03, pos04, pos05, pos06;
std::ios_base::iostate state01, state02;
const char str_lit01[] = "wistream_seeks-1.txt";
const char str_lit02[] = "wistream_seeks-2.txt";
std::wifstream if01(str_lit01, std::ios_base::in | std::ios_base::out);
std::wifstream if02(str_lit01, std::ios_base::in);
std::wifstream if03(str_lit02, std::ios_base::out | std::ios_base::trunc);
VERIFY( if01.good() );
VERIFY( if02.good() );
VERIFY( if03.good() );
std::wistream is01(if01.rdbuf());
std::wistream is02(if02.rdbuf());
std::wistream is03(if03.rdbuf());
// pos_type tellg()
// in | out
pos01 = is01.tellg();
pos02 = is01.tellg();
VERIFY( pos01 == pos02 );
// in
pos03 = is02.tellg();
pos04 = is02.tellg();
VERIFY( pos03 == pos04 );
// out
pos05 = is03.tellg();
pos06 = is03.tellg();
VERIFY( pos05 == pos06 );
// cur
// NB: see library issues list 136. It's the v-3 interp that seekg
// only sets the input buffer, or else istreams with buffers that
// have _M_mode == ios_base::out will fail to have consistency
// between seekg and tellg.
state01 = is01.rdstate();
is01.seekg(10, std::ios_base::cur);
state02 = is01.rdstate();
pos01 = is01.tellg();
VERIFY( pos01 == pos02 + off_type(10) );
VERIFY( state01 == state02 );
pos02 = is01.tellg();
VERIFY( pos02 == pos01 );
}
int main()
{
test04();
return 0;
}
| atgreen/gcc | libstdc++-v3/testsuite/27_io/basic_istream/tellg/wchar_t/fstream.cc | C++ | gpl-2.0 | 2,596 |
package ONVIF::PTZ::Types::IPv6Configuration;
use strict;
use warnings;
__PACKAGE__->_set_element_form_qualified(1);
sub get_xmlns { 'http://www.onvif.org/ver10/schema' };
our $XML_ATTRIBUTE_CLASS;
undef $XML_ATTRIBUTE_CLASS;
sub __get_attr_class {
return $XML_ATTRIBUTE_CLASS;
}
use Class::Std::Fast::Storable constructor => 'none';
use base qw(SOAP::WSDL::XSD::Typelib::ComplexType);
Class::Std::initialize();
{ # BLOCK to scope variables
my %AcceptRouterAdvert_of :ATTR(:get<AcceptRouterAdvert>);
my %DHCP_of :ATTR(:get<DHCP>);
my %Manual_of :ATTR(:get<Manual>);
my %LinkLocal_of :ATTR(:get<LinkLocal>);
my %FromDHCP_of :ATTR(:get<FromDHCP>);
my %FromRA_of :ATTR(:get<FromRA>);
my %Extension_of :ATTR(:get<Extension>);
__PACKAGE__->_factory(
[ qw( AcceptRouterAdvert
DHCP
Manual
LinkLocal
FromDHCP
FromRA
Extension
) ],
{
'AcceptRouterAdvert' => \%AcceptRouterAdvert_of,
'DHCP' => \%DHCP_of,
'Manual' => \%Manual_of,
'LinkLocal' => \%LinkLocal_of,
'FromDHCP' => \%FromDHCP_of,
'FromRA' => \%FromRA_of,
'Extension' => \%Extension_of,
},
{
'AcceptRouterAdvert' => 'SOAP::WSDL::XSD::Typelib::Builtin::boolean',
'DHCP' => 'ONVIF::PTZ::Types::IPv6DHCPConfiguration',
'Manual' => 'ONVIF::PTZ::Types::PrefixedIPv6Address',
'LinkLocal' => 'ONVIF::PTZ::Types::PrefixedIPv6Address',
'FromDHCP' => 'ONVIF::PTZ::Types::PrefixedIPv6Address',
'FromRA' => 'ONVIF::PTZ::Types::PrefixedIPv6Address',
'Extension' => 'ONVIF::PTZ::Types::IPv6ConfigurationExtension',
},
{
'AcceptRouterAdvert' => 'AcceptRouterAdvert',
'DHCP' => 'DHCP',
'Manual' => 'Manual',
'LinkLocal' => 'LinkLocal',
'FromDHCP' => 'FromDHCP',
'FromRA' => 'FromRA',
'Extension' => 'Extension',
}
);
} # end BLOCK
1;
=pod
=head1 NAME
ONVIF::PTZ::Types::IPv6Configuration
=head1 DESCRIPTION
Perl data type class for the XML Schema defined complexType
IPv6Configuration from the namespace http://www.onvif.org/ver10/schema.
=head2 PROPERTIES
The following properties may be accessed using get_PROPERTY / set_PROPERTY
methods:
=over
=item * AcceptRouterAdvert
=item * DHCP
=item * Manual
=item * LinkLocal
=item * FromDHCP
=item * FromRA
=item * Extension
=back
=head1 METHODS
=head2 new
Constructor. The following data structure may be passed to new():
{ # ONVIF::PTZ::Types::IPv6Configuration
AcceptRouterAdvert => $some_value, # boolean
DHCP => $some_value, # IPv6DHCPConfiguration
Manual => { # ONVIF::PTZ::Types::PrefixedIPv6Address
Address => $some_value, # IPv6Address
PrefixLength => $some_value, # int
},
LinkLocal => { # ONVIF::PTZ::Types::PrefixedIPv6Address
Address => $some_value, # IPv6Address
PrefixLength => $some_value, # int
},
FromDHCP => { # ONVIF::PTZ::Types::PrefixedIPv6Address
Address => $some_value, # IPv6Address
PrefixLength => $some_value, # int
},
FromRA => { # ONVIF::PTZ::Types::PrefixedIPv6Address
Address => $some_value, # IPv6Address
PrefixLength => $some_value, # int
},
Extension => { # ONVIF::PTZ::Types::IPv6ConfigurationExtension
},
},
=head1 AUTHOR
Generated by SOAP::WSDL
=cut
| pliablepixels/ZoneMinder | onvif/proxy/lib/ONVIF/PTZ/Types/IPv6Configuration.pm | Perl | gpl-2.0 | 3,376 |
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 2012-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <list>
// libstdc++/43813
void test01()
{
std::list<double*> l(7, 0);
l.assign(7, 0);
l.insert(l.begin(), 7, 0);
}
| atgreen/gcc | libstdc++-v3/testsuite/23_containers/list/requirements/do_the_right_thing.cc | C++ | gpl-2.0 | 950 |
<?php
/**
* Copyright 2010-2013 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.
*/
namespace Aws\S3\Sync;
use \FilesystemIterator as FI;
use Aws\Common\Model\MultipartUpload\AbstractTransfer;
use Aws\S3\Model\Acp;
use Guzzle\Common\Event;
use Guzzle\Service\Command\CommandInterface;
class UploadSyncBuilder extends AbstractSyncBuilder
{
/** @var string|Acp Access control policy to set on each object */
protected $acp = 'private';
/** @var int */
protected $multipartUploadSize;
/**
* Set the path that contains files to recursively upload to Amazon S3
*
* @param string $path Path that contains files to upload
*
* @return self
*/
public function uploadFromDirectory($path)
{
$this->baseDir = $path;
$this->sourceIterator = $this->filterIterator(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(
$path,
FI::SKIP_DOTS | FI::UNIX_PATHS | FI::FOLLOW_SYMLINKS
)));
return $this;
}
/**
* Set a glob expression that will match files to upload to Amazon S3
*
* @param string $glob Glob expression
*
* @return self
* @link http://www.php.net/manual/en/function.glob.php
*/
public function uploadFromGlob($glob)
{
$this->sourceIterator = $this->filterIterator(
new \GlobIterator($glob, FI::SKIP_DOTS | FI::UNIX_PATHS | FI::FOLLOW_SYMLINKS)
);
return $this;
}
/**
* Set a canned ACL to apply to each uploaded object
*
* @param string $acl Canned ACL for each upload
*
* @return self
*/
public function setAcl($acl)
{
$this->acp = $acl;
return $this;
}
/**
* Set an Access Control Policy to apply to each uploaded object
*
* @param Acp $acp Access control policy
*
* @return self
*/
public function setAcp(Acp $acp)
{
$this->acp = $acp;
return $this;
}
/**
* Set the multipart upload size threshold. When the size of a file exceeds this value, the file will be uploaded
* using a multipart upload.
*
* @param int $size Size threshold
*
* @return self
*/
public function setMultipartUploadSize($size)
{
$this->multipartUploadSize = $size;
return $this;
}
protected function specificBuild()
{
$sync = new UploadSync(array(
'client' => $this->client,
'bucket' => $this->bucket,
'iterator' => $this->sourceIterator,
'source_converter' => $this->sourceConverter,
'target_converter' => $this->targetConverter,
'concurrency' => $this->concurrency,
'multipart_upload_size' => $this->multipartUploadSize,
'acl' => $this->acp
));
return $sync;
}
protected function getTargetIterator()
{
return $this->createS3Iterator();
}
protected function getDefaultSourceConverter()
{
return new KeyConverter($this->baseDir, $this->keyPrefix . $this->delimiter, $this->delimiter);
}
protected function getDefaultTargetConverter()
{
return new KeyConverter('s3://' . $this->bucket . '/', '', DIRECTORY_SEPARATOR);
}
protected function addDebugListener(AbstractSync $sync, $resource)
{
$sync->getEventDispatcher()->addListener(UploadSync::BEFORE_TRANSFER, function (Event $e) use ($resource) {
$c = $e['command'];
if ($c instanceof CommandInterface) {
$uri = $c['Body']->getUri();
$size = $c['Body']->getSize();
fwrite($resource, "Uploading {$uri} -> {$c['Key']} ({$size} bytes)\n");
return;
}
// Multipart upload
$body = $c->getSource();
$totalSize = $body->getSize();
$progress = 0;
fwrite($resource, "Beginning multipart upload: " . $body->getUri() . ' -> ');
fwrite($resource, $c->getState()->getFromId('Key') . " ({$totalSize} bytes)\n");
$c->getEventDispatcher()->addListener(
AbstractTransfer::BEFORE_PART_UPLOAD,
function ($e) use (&$progress, $totalSize, $resource) {
$command = $e['command'];
$size = $command['Body']->getContentLength();
$percentage = number_format(($progress / $totalSize) * 100, 2);
fwrite($resource, "- Part {$command['PartNumber']} ({$size} bytes, {$percentage}%)\n");
$progress .= $size;
}
);
});
}
}
| jacobdfriedmann/jacobfriedmanndotcom | wp-content/plugins/wp-amazon-web-services-master/vendor/aws/Aws/S3/Sync/UploadSyncBuilder.php | PHP | gpl-2.0 | 5,208 |
/**
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
* https://www.drupal.org/node/2815083
* @preserve
**/
(function (_, $, Backbone, Drupal) {
Drupal.quickedit.EntityModel = Drupal.quickedit.BaseModel.extend({
defaults: {
el: null,
entityID: null,
entityInstanceID: null,
id: null,
label: null,
fields: null,
isActive: false,
inTempStore: false,
isDirty: false,
isCommitting: false,
state: 'closed',
fieldsInTempStore: [],
reload: false
},
initialize: function initialize() {
this.set('fields', new Drupal.quickedit.FieldCollection());
this.listenTo(this, 'change:state', this.stateChange);
this.listenTo(this.get('fields'), 'change:state', this.fieldStateChange);
Drupal.quickedit.BaseModel.prototype.initialize.call(this);
},
stateChange: function stateChange(entityModel, state, options) {
var to = state;
switch (to) {
case 'closed':
this.set({
isActive: false,
inTempStore: false,
isDirty: false
});
break;
case 'launching':
break;
case 'opening':
entityModel.get('fields').each(function (fieldModel) {
fieldModel.set('state', 'candidate', options);
});
break;
case 'opened':
this.set('isActive', true);
break;
case 'committing':
{
var fields = this.get('fields');
fields.chain().filter(function (fieldModel) {
return _.intersection([fieldModel.get('state')], ['active']).length;
}).each(function (fieldModel) {
fieldModel.set('state', 'candidate');
});
fields.chain().filter(function (fieldModel) {
return _.intersection([fieldModel.get('state')], Drupal.quickedit.app.changedFieldStates).length;
}).each(function (fieldModel) {
fieldModel.set('state', 'saving');
});
break;
}
case 'deactivating':
{
var changedFields = this.get('fields').filter(function (fieldModel) {
return _.intersection([fieldModel.get('state')], ['changed', 'invalid']).length;
});
if ((changedFields.length || this.get('fieldsInTempStore').length) && !options.saved && !options.confirmed) {
this.set('state', 'opened', { confirming: true });
_.defer(function () {
Drupal.quickedit.app.confirmEntityDeactivation(entityModel);
});
} else {
var invalidFields = this.get('fields').filter(function (fieldModel) {
return _.intersection([fieldModel.get('state')], ['invalid']).length;
});
entityModel.set('reload', this.get('fieldsInTempStore').length || invalidFields.length);
entityModel.get('fields').each(function (fieldModel) {
if (_.intersection([fieldModel.get('state')], ['candidate', 'highlighted']).length) {
fieldModel.trigger('change:state', fieldModel, fieldModel.get('state'), options);
} else {
fieldModel.set('state', 'candidate', options);
}
});
}
break;
}
case 'closing':
options.reason = 'stop';
this.get('fields').each(function (fieldModel) {
fieldModel.set({
inTempStore: false,
state: 'inactive'
}, options);
});
break;
}
},
_updateInTempStoreAttributes: function _updateInTempStoreAttributes(entityModel, fieldModel) {
var current = fieldModel.get('state');
var previous = fieldModel.previous('state');
var fieldsInTempStore = entityModel.get('fieldsInTempStore');
if (current === 'saved') {
entityModel.set('inTempStore', true);
fieldModel.set('inTempStore', true);
fieldsInTempStore.push(fieldModel.get('fieldID'));
fieldsInTempStore = _.uniq(fieldsInTempStore);
entityModel.set('fieldsInTempStore', fieldsInTempStore);
} else if (current === 'candidate' && previous === 'inactive') {
fieldModel.set('inTempStore', _.intersection([fieldModel.get('fieldID')], fieldsInTempStore).length > 0);
}
},
fieldStateChange: function fieldStateChange(fieldModel, state) {
var entityModel = this;
var fieldState = state;
switch (this.get('state')) {
case 'closed':
case 'launching':
break;
case 'opening':
_.defer(function () {
entityModel.set('state', 'opened', {
'accept-field-states': Drupal.quickedit.app.readyFieldStates
});
});
break;
case 'opened':
if (fieldState === 'changed') {
entityModel.set('isDirty', true);
} else {
this._updateInTempStoreAttributes(entityModel, fieldModel);
}
break;
case 'committing':
{
if (fieldState === 'invalid') {
_.defer(function () {
entityModel.set('state', 'opened', { reason: 'invalid' });
});
} else {
this._updateInTempStoreAttributes(entityModel, fieldModel);
}
var options = {
'accept-field-states': Drupal.quickedit.app.readyFieldStates
};
if (entityModel.set('isCommitting', true, options)) {
entityModel.save({
success: function success() {
entityModel.set({
state: 'deactivating',
isCommitting: false
}, { saved: true });
},
error: function error() {
entityModel.set('isCommitting', false);
entityModel.set('state', 'opened', { reason: 'networkerror' });
var message = Drupal.t('Your changes to <q>@entity-title</q> could not be saved, either due to a website problem or a network connection problem.<br>Please try again.', { '@entity-title': entityModel.get('label') });
Drupal.quickedit.util.networkErrorModal(Drupal.t('Network problem!'), message);
}
});
}
break;
}
case 'deactivating':
_.defer(function () {
entityModel.set('state', 'closing', {
'accept-field-states': Drupal.quickedit.app.readyFieldStates
});
});
break;
case 'closing':
_.defer(function () {
entityModel.set('state', 'closed', {
'accept-field-states': ['inactive']
});
});
break;
}
},
save: function save(options) {
var entityModel = this;
var entitySaverAjax = Drupal.ajax({
url: Drupal.url('quickedit/entity/' + entityModel.get('entityID')),
error: function error() {
options.error.call(entityModel);
}
});
entitySaverAjax.commands.quickeditEntitySaved = function (ajax, response, status) {
entityModel.get('fields').each(function (fieldModel) {
fieldModel.set('inTempStore', false);
});
entityModel.set('inTempStore', false);
entityModel.set('fieldsInTempStore', []);
if (options.success) {
options.success.call(entityModel);
}
};
entitySaverAjax.execute();
},
validate: function validate(attrs, options) {
var acceptedFieldStates = options['accept-field-states'] || [];
var currentState = this.get('state');
var nextState = attrs.state;
if (currentState !== nextState) {
if (_.indexOf(this.constructor.states, nextState) === -1) {
return '"' + nextState + '" is an invalid state';
}
if (!this._acceptStateChange(currentState, nextState, options)) {
return 'state change not accepted';
} else if (!this._fieldsHaveAcceptableStates(acceptedFieldStates)) {
return 'state change not accepted because fields are not in acceptable state';
}
}
var currentIsCommitting = this.get('isCommitting');
var nextIsCommitting = attrs.isCommitting;
if (currentIsCommitting === false && nextIsCommitting === true) {
if (!this._fieldsHaveAcceptableStates(acceptedFieldStates)) {
return 'isCommitting change not accepted because fields are not in acceptable state';
}
} else if (currentIsCommitting === true && nextIsCommitting === true) {
return 'isCommitting is a mutex, hence only changes are allowed';
}
},
_acceptStateChange: function _acceptStateChange(from, to, context) {
var accept = true;
if (!this.constructor.followsStateSequence(from, to)) {
accept = false;
if (from === 'closing' && to === 'closed') {
accept = true;
} else if (from === 'committing' && to === 'opened' && context.reason && (context.reason === 'invalid' || context.reason === 'networkerror')) {
accept = true;
} else if (from === 'deactivating' && to === 'opened' && context.confirming) {
accept = true;
} else if (from === 'opened' && to === 'deactivating' && context.confirmed) {
accept = true;
}
}
return accept;
},
_fieldsHaveAcceptableStates: function _fieldsHaveAcceptableStates(acceptedFieldStates) {
var accept = true;
if (acceptedFieldStates.length > 0) {
var fieldStates = this.get('fields').pluck('state') || [];
if (_.difference(fieldStates, acceptedFieldStates).length) {
accept = false;
}
}
return accept;
},
destroy: function destroy(options) {
Drupal.quickedit.BaseModel.prototype.destroy.call(this, options);
this.stopListening();
this.get('fields').reset();
},
sync: function sync() {}
}, {
states: ['closed', 'launching', 'opening', 'opened', 'committing', 'deactivating', 'closing'],
followsStateSequence: function followsStateSequence(from, to) {
return _.indexOf(this.states, from) < _.indexOf(this.states, to);
}
});
Drupal.quickedit.EntityCollection = Backbone.Collection.extend({
model: Drupal.quickedit.EntityModel
});
})(_, jQuery, Backbone, Drupal); | isauragalafate/drupal8 | web/core/modules/quickedit/js/models/EntityModel.js | JavaScript | gpl-2.0 | 10,662 |
#include QMK_KEYBOARD_H
#include "debug.h"
#include "action_layer.h"
#define BASE 0 // default layer
#define FN1 1 // media layer
#define CAPS_CTL CTL_T(KC_CAPS) // Caps on tap, Ctrl on hold.
#define COPY LCTL(KC_V) // C-c Copy
#define PASTE LCTL(KC_V) // C-v Paste
#define ZM_NRM LCTL(KC_0) // C-0 Zoom Normal
#define ZM_OUT LCTL(KC_MINS) // C-- Zoom Out
#define ZM_IN LCTL(KC_PLUS) // C-+ Zoom In
#define EM_UNDO LCTL(KC_UNDS) // C-_ Emacs Undo
#define _MOB 1 // Mobile#
#define _CUS1 2 // Custom macro 1
#define _CUS2 3 // Custom macro 2
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap 0: Basic layer
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | | 7 | 8 | 9 | 0 | - | = | BSpace |
* |--------+------+------+------+------+------+------| |------+------+------+------+------+------+--------|
* | Tab | Q | W | E | R | T | Fwd | | Back | Y | U | I | O | P | \ |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* |Caps/Ctl| A | S | D | F | G |------| |------| H | J | K | L | ; | Enter |
* |--------+------+------+------+------+------| PgDn | | PgUp |------+------+------+------+------+--------|
* | LShift | Z | X | C | V | B | | | | N | M | , | . | / | ' |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | Ctrl | Esc | LGui | Alt | Alt | | Left | Dn | Up | Right| Fn |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | Copy | ( | | ) | Paste|
* ,------|------+------| |------+------+------.
* | | | [ | | ] | | |
* |Space | Del |------| |------| Enter|BSpace|
* | | | { | | } | | |
* `--------------------' `--------------------'
*/
// If it accepts an argument (i.e, is a function), it doesn't need KC_.
// Otherwise, it needs KC_*
[BASE] = LAYOUT_ergodox( // layer 0 : default
// Left hand
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_WBAK,
CAPS_CTL, KC_A, KC_S, KC_D, KC_F, KC_G,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_PGDN,
KC_LCTL, KC_ESC, KC_LGUI, KC_LALT, KC_LALT,
COPY, KC_LCBR,
KC_LPRN,
KC_SPC, KC_DEL, KC_LBRC,
// Right hand
KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC,
KC_WFWD, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT,
KC_PGUP, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_QUOT,
KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, TG(FN1),
KC_RCBR, PASTE,
KC_RPRN,
KC_RBRC, KC_ENT, KC_BSPC),
/* Keymap 1: Fn Keys, media and mouse keys
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | Esc | F1 | F2 | F3 | F4 | F5 | F6 | | F7 | F8 | F9 | F10 | F11 | F12 | BSpace |
* |--------+------+------+------+------+------+------| |------+------+------+------+------+------+--------|
* | | | | MsUp | | | | | | | | | | | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | |MsLeft|MsDown|MsRght| |------| |------| | | | | | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | | LClk | MClk | RClk | | | | | | | | | | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* |Teensy| | ZmNrm| ZmOut| ZmIn | | Undo |VolDn |VolUp | Mute | |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | | | | | |
* ,------|------+------| |------+------+------.
* | | | | | | | |
* | | |------| |------| | |
* | | | | | | | |
* `--------------------' `--------------------'
*/
// FN1 Layer
[FN1] = LAYOUT_ergodox(
// Left hand
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6,
KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS,
KC_TRNS, KC_TRNS, KC_BTN1, KC_BTN3, KC_BTN2, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, ZM_NRM, ZM_OUT, ZM_IN,
KC_TRNS, KC_TRNS,
KC_TRNS,
RESET, KC_TRNS, KC_TRNS,
// Right hand
KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_BSPC,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY,
KC_TRNS, M(_MOB), KC_TRNS, M(_CUS1),M(_CUS2),KC_TRNS, KC_TRNS,
EM_UNDO, KC_VOLD, KC_VOLU, KC_MUTE, KC_TRNS,
KC_TRNS, KC_TRNS,
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS
),
};
const uint16_t PROGMEM fn_actions[] = {
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
// MACRODOWN only works in this function
switch(id) {
case _MOB: // Your mobile# here.
return MACRODOWN(T(1), T(2), T(3), T(MINS),
T(1), T(2), T(3), T(MINS),
T(1), T(2), T(3), T(4),
END);
case _CUS1: // Your custom macro 1
return MACRODOWN(T(E), T(M), T(A), T(C), T(S), T(SPC), END);
case _CUS2: // Your custom macro 2
return MACRODOWN(T(L), T(S), T(SPC), T(MINS), T(L), T(ENT), END);
};
return MACRO_NONE;
};
// Runs just one time when the keyboard initializes.
void matrix_init_user(void) {
};
// Runs constantly in the background, in a loop.
void matrix_scan_user(void) {
uint8_t layer = biton32(layer_state);
ergodox_board_led_off();
ergodox_right_led_1_off();
ergodox_right_led_2_off();
ergodox_right_led_3_off();
switch (layer) {
// TODO: Make this relevant to the ErgoDox EZ.
case 1:
ergodox_right_led_1_on();
break;
case 2:
ergodox_right_led_2_on();
break;
default:
// none
break;
}
};
| kll/qmk_firmware | layouts/community/ergodox/ab/keymap.c | C | gpl-2.0 | 7,321 |
! { dg-do compile }
! Test the patch for PR36374 in which the different
! symbols for 'foobar' would be incorrectly flagged as
! ambiguous in foo_mod.
!
! Contributed by Salvatore Filippone <sfilippone@uniroma2.it>
!
module s_foo_mod
type s_foo_type
real(kind(1.e0)) :: v
end type s_foo_type
interface foobar
subroutine s_foobar(x)
import
type(s_foo_type), intent (inout) :: x
end subroutine s_foobar
end interface
end module s_foo_mod
module d_foo_mod
type d_foo_type
real(kind(1.d0)) :: v
end type d_foo_type
interface foobar
subroutine d_foobar(x)
import
type(d_foo_type), intent (inout) :: x
end subroutine d_foobar
end interface
end module d_foo_mod
module foo_mod
use s_foo_mod
use d_foo_mod
end module foo_mod
subroutine s_foobar(x)
use foo_mod
end subroutine s_foobar
! { dg-final { cleanup-modules "s_foo_mod d_foo_mod foo_mod" } }
| SanDisk-Open-Source/SSD_Dashboard | uefi/gcc/gcc-4.6.3/gcc/testsuite/gfortran.dg/generic_17.f90 | FORTRAN | gpl-2.0 | 952 |
/* $Id$ */
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file base_media_base.h Generic functions for replacing base data (graphics, sounds). */
#ifndef BASE_MEDIA_BASE_H
#define BASE_MEDIA_BASE_H
#include "fileio_func.h"
#include "core/smallmap_type.hpp"
#include "gfx_type.h"
#include "textfile_type.h"
#include "textfile_gui.h"
/* Forward declare these; can't do 'struct X' in functions as older GCCs barf on that */
struct IniFile;
struct ContentInfo;
/** Structure holding filename and MD5 information about a single file */
struct MD5File {
/** The result of a checksum check */
enum ChecksumResult {
CR_MATCH, ///< The file did exist and the md5 checksum did match
CR_MISMATCH, ///< The file did exist, just the md5 checksum did not match
CR_NO_FILE, ///< The file did not exist
};
const char *filename; ///< filename
uint8 hash[16]; ///< md5 sum of the file
const char *missing_warning; ///< warning when this file is missing
ChecksumResult CheckMD5(Subdirectory subdir, size_t max_size) const;
};
/**
* Information about a single base set.
* @tparam T the real class we're going to be
* @tparam Tnum_files the number of files in the set
* @tparam Tsearch_in_tars whether to search in the tars or not
*/
template <class T, size_t Tnum_files, bool Tsearch_in_tars>
struct BaseSet {
typedef SmallMap<const char *, const char *> TranslatedStrings;
/** Number of files in this set */
static const size_t NUM_FILES = Tnum_files;
/** Whether to search in the tars or not. */
static const bool SEARCH_IN_TARS = Tsearch_in_tars;
/** Internal names of the files in this set. */
static const char * const *file_names;
const char *name; ///< The name of the base set
TranslatedStrings description; ///< Description of the base set
uint32 shortname; ///< Four letter short variant of the name
uint32 version; ///< The version of this base set
bool fallback; ///< This set is a fallback set, i.e. it should be used only as last resort
MD5File files[NUM_FILES]; ///< All files part of this set
uint found_files; ///< Number of the files that could be found
uint valid_files; ///< Number of the files that could be found and are valid
T *next; ///< The next base set in this list
/** Free everything we allocated */
~BaseSet()
{
free(this->name);
for (TranslatedStrings::iterator iter = this->description.Begin(); iter != this->description.End(); iter++) {
free(iter->first);
free(iter->second);
}
for (uint i = 0; i < NUM_FILES; i++) {
free(this->files[i].filename);
free(this->files[i].missing_warning);
}
delete this->next;
}
/**
* Get the number of missing files.
* @return the number
*/
int GetNumMissing() const
{
return Tnum_files - this->found_files;
}
/**
* Get the number of invalid files.
* @note a missing file is invalid too!
* @return the number
*/
int GetNumInvalid() const
{
return Tnum_files - this->valid_files;
}
bool FillSetDetails(IniFile *ini, const char *path, const char *full_filename, bool allow_empty_filename = true);
/**
* Get the description for the given ISO code.
* It falls back to the first two characters of the ISO code in case
* no match could be made with the full ISO code. If even then the
* matching fails the default is returned.
* @param isocode the isocode to search for
* @return the description
*/
const char *GetDescription(const char *isocode = NULL) const
{
if (isocode != NULL) {
/* First the full ISO code */
for (TranslatedStrings::const_iterator iter = this->description.Begin(); iter != this->description.End(); iter++) {
if (strcmp(iter->first, isocode) == 0) return iter->second;
}
/* Then the first two characters */
for (TranslatedStrings::const_iterator iter = this->description.Begin(); iter != this->description.End(); iter++) {
if (strncmp(iter->first, isocode, 2) == 0) return iter->second;
}
}
/* Then fall back */
return this->description.Begin()->second;
}
/**
* Calculate and check the MD5 hash of the supplied file.
* @param file The file get the hash of.
* @param subdir The sub directory to get the files from.
* @return
* - #CR_MATCH if the MD5 hash matches
* - #CR_MISMATCH if the MD5 does not match
* - #CR_NO_FILE if the file misses
*/
static MD5File::ChecksumResult CheckMD5(const MD5File *file, Subdirectory subdir)
{
return file->CheckMD5(subdir, SIZE_MAX);
}
/**
* Search a textfile file next to this base media.
* @param type The type of the textfile to search for.
* @return The filename for the textfile, \c NULL otherwise.
*/
const char *GetTextfile(TextfileType type) const
{
for (uint i = 0; i < NUM_FILES; i++) {
const char *textfile = ::GetTextfile(type, BASESET_DIR, this->files[i].filename);
if (textfile != NULL) {
return textfile;
}
}
return NULL;
}
};
/**
* Base for all base media (graphics, sounds)
* @tparam Tbase_set the real set we're going to be
*/
template <class Tbase_set>
class BaseMedia : FileScanner {
protected:
static Tbase_set *available_sets; ///< All available sets
static Tbase_set *duplicate_sets; ///< All sets that aren't available, but needed for not downloading base sets when a newer version than the one on BaNaNaS is loaded.
static const Tbase_set *used_set; ///< The currently used set
/* virtual */ bool AddFile(const char *filename, size_t basepath_length, const char *tar_filename);
/**
* Get the extension that is used to identify this set.
* @return the extension
*/
static const char *GetExtension();
public:
/** The set as saved in the config file. */
static const char *ini_set;
/**
* Determine the graphics pack that has to be used.
* The one with the most correct files wins.
* @return true if a best set has been found.
*/
static bool DetermineBestSet();
/** Do the scan for files. */
static uint FindSets()
{
BaseMedia<Tbase_set> fs;
/* Searching in tars is only done in the old "data" directories basesets. */
uint num = fs.Scan(GetExtension(), Tbase_set::SEARCH_IN_TARS ? OLD_DATA_DIR : OLD_GM_DIR, Tbase_set::SEARCH_IN_TARS);
return num + fs.Scan(GetExtension(), BASESET_DIR, Tbase_set::SEARCH_IN_TARS);
}
static Tbase_set *GetAvailableSets();
static bool SetSet(const char *name);
static char *GetSetsList(char *p, const char *last);
static int GetNumSets();
static int GetIndexOfUsedSet();
static const Tbase_set *GetSet(int index);
static const Tbase_set *GetUsedSet();
/**
* Check whether we have an set with the exact characteristics as ci.
* @param ci the characteristics to search on (shortname and md5sum)
* @param md5sum whether to check the MD5 checksum
* @return true iff we have an set matching.
*/
static bool HasSet(const ContentInfo *ci, bool md5sum);
};
/**
* Check whether there's a base set matching some information.
* @param ci The content info to compare it to.
* @param md5sum Should the MD5 checksum be tested as well?
* @param s The list with sets.
* @return The filename of the first file of the base set, or \c NULL if there is no match.
*/
template <class Tbase_set>
const char *TryGetBaseSetFile(const ContentInfo *ci, bool md5sum, const Tbase_set *s);
/** Types of graphics in the base graphics set */
enum GraphicsFileType {
GFT_BASE, ///< Base sprites for all climates
GFT_LOGOS, ///< Logos, landscape icons and original terrain generator sprites
GFT_ARCTIC, ///< Landscape replacement sprites for arctic
GFT_TROPICAL, ///< Landscape replacement sprites for tropical
GFT_TOYLAND, ///< Landscape replacement sprites for toyland
GFT_EXTRA, ///< Extra sprites that were not part of the original sprites
MAX_GFT, ///< We are looking for this amount of GRFs
};
/** Blitter type for base graphics sets. */
enum BlitterType {
BLT_8BPP, ///< Base set has 8 bpp sprites only.
BLT_32BPP, ///< Base set has both 8 bpp and 32 bpp sprites.
};
/** All data of a graphics set. */
struct GraphicsSet : BaseSet<GraphicsSet, MAX_GFT, true> {
PaletteType palette; ///< Palette of this graphics set
BlitterType blitter; ///< Blitter of this graphics set
bool FillSetDetails(struct IniFile *ini, const char *path, const char *full_filename);
static MD5File::ChecksumResult CheckMD5(const MD5File *file, Subdirectory subdir);
};
/** All data/functions related with replacing the base graphics. */
class BaseGraphics : public BaseMedia<GraphicsSet> {
public:
};
/** All data of a sounds set. */
struct SoundsSet : BaseSet<SoundsSet, 1, true> {
};
/** All data/functions related with replacing the base sounds */
class BaseSounds : public BaseMedia<SoundsSet> {
public:
};
/** Maximum number of songs in the 'class' playlists. */
static const uint NUM_SONGS_CLASS = 10;
/** Number of classes for songs */
static const uint NUM_SONG_CLASSES = 3;
/** Maximum number of songs in the full playlist; theme song + the classes */
static const uint NUM_SONGS_AVAILABLE = 1 + NUM_SONG_CLASSES * NUM_SONGS_CLASS;
/** Maximum number of songs in the (custom) playlist */
static const uint NUM_SONGS_PLAYLIST = 32;
/** All data of a music set. */
struct MusicSet : BaseSet<MusicSet, NUM_SONGS_AVAILABLE, false> {
/** The name of the different songs. */
char song_name[NUM_SONGS_AVAILABLE][32];
byte track_nr[NUM_SONGS_AVAILABLE];
byte num_available;
bool FillSetDetails(struct IniFile *ini, const char *path, const char *full_filename);
};
/** All data/functions related with replacing the base music */
class BaseMusic : public BaseMedia<MusicSet> {
public:
};
#endif /* BASE_MEDIA_BASE_H */
| supermerill/openttd | src/base_media_base.h | C | gpl-2.0 | 10,260 |
#ifndef _IFADDRS_H
#include <inet/ifaddrs.h>
#include <stdbool.h>
#include <stdint.h>
libc_hidden_proto (getifaddrs)
libc_hidden_proto (freeifaddrs)
struct in6addrinfo
{
enum {
in6ai_deprecated = 1,
in6ai_homeaddress = 2
} flags:8;
uint8_t prefixlen;
uint16_t :16;
uint32_t index;
uint32_t addr[4];
};
extern void __check_pf (bool *seen_ipv4, bool *seen_ipv6,
struct in6addrinfo **in6ai, size_t *in6ailen)
attribute_hidden;
extern void __free_in6ai (struct in6addrinfo *in6ai) attribute_hidden;
extern void __check_native (uint32_t a1_index, int *a1_native,
uint32_t a2_index, int *a2_native)
attribute_hidden;
#if IS_IN (nscd)
extern uint32_t __bump_nl_timestamp (void) attribute_hidden;
#endif
#endif /* ifaddrs.h */
| geminy/aidear | oss/glibc/glibc-2.24/include/ifaddrs.h | C | gpl-3.0 | 758 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.