define("dojox/app/controllers/HistoryHash", ["dojo/_base/lang", "dojo/_base/declare", "dojo/topic", "dojo/on", "../Controller", "dojo/hash"],
	function(lang, declare, topic, on, Controller){
	// module:
	//		dojox/app/controllers/HistoryHash
	// summary:
	//		Bind "startTransition" event on dojox/app application's domNode,
	//		Bind "/dojo/hashchange" event on window object.
	//		Maintain history by history hash.

	return declare("dojox.app.controllers.HistoryHash", Controller, {

		constructor: function(app){
			// summary:
			//		Bind "startTransition" event on dojox/app application's domNode,
			//		subscribe "/dojo/hashchange" event.
			//
			// app:
			//		dojox/app application instance.
			this.events = {
				"startTransition": this.onStartTransition
			};
			this.inherited(arguments);

			topic.subscribe("/dojo/hashchange", lang.hitch(this, function(newhash){
				this._onHashChange(newhash);
			}));

			this._historyStack = []; // application history stack
			this._historyLen = 0;	// current window.history length
			this._current = null;	// current history item in application history stack
			this._next = null;		// next history item in application history stack
			this._previous = null;	// privious history item in application history stack
			this._index = 0;		// identify current history item's index in application history stack
			this._oldHistoryLen = 0;// window.history stack length before hash change
			this._newHistoryLen = 0;// window.history stack length after hash change
			this._addToHistoryStack = false;
			this._detail = null;
			this._startTransitionEvent = false;

			// push the default page to the history stack
			var currentHash = window.location.hash;
			if (currentHash && (currentHash.length > 1)) {
				currentHash = currentHash.substr(1);
			}
			this._historyStack.push({
				'hash': currentHash,
				'url': window.location.href,
				'detail': {target:currentHash}
			});
			this._historyLen = window.history.length;
			this._index = this._historyStack.length - 1;
			this._current = currentHash;

			// get the diff of window.history and application history
			this._historyDiff = window.history.length - this._historyStack.length;
		},

		onStartTransition: function(evt){
			// summary:
			//		Response to dojox/app "startTransition" event.
			//
			// example:
			//		Use "dojox/mobile/TransitionEvent" to trigger "startTransition" event, and this function will response the event. For example:
			//		|	var transOpts = {
			//		|		title:"List",
			//		|		target:"items,list",
			//		|		url: "#items,list"
			//		|	};
			//		|	new TransitionEvent(domNode, transOpts, e).dispatch();
			//
			// evt: Object
			//		transition options parameter

			var target = evt.detail.target;
			var regex = /#(.+)/;
			if (!target && regex.test(evt.detail.href)) {
				target = evt.detail.href.match(regex)[1];
			}

			var currentHash = evt.detail.url || '#' + target;

			this._oldHistoryLen = window.history.length;
			// pushState on iOS will not change location bar hash because of security.
			// window.history.pushState(evt.detail, title, currentHash);

			// history.length will be changed by set location hash
			// change url hash, to workaround iOS pushState not change address bar issue.
			window.location.hash = currentHash;

			// The operation above will trigger hashchange.
			// Use _addToHistoryStack flag to indicate the _onHashChange method should add this hash to history stack.
			// When add hash to history stack, this flag should be set to false, we do this in _addHistory.
			this._addToHistoryStack = true;
			this._detail = evt.detail;
			//set startTransition event flag to true if the hash change from startTransition event.
			this._startTransitionEvent = true;
		},

		_addHistory: function(hash){
			// summary:
			//		Add hash to application history stack, update history management flags.
			//
			// hash:
			//		new hash should be added to _historyStack.
			this._historyStack.push({
				'hash': hash,
				'url': window.location.href,
				'detail': {target:hash}
			});

			this._historyLen = window.history.length;
			this._index = this._historyStack.length - 1;

			this._previous = this._current;
			this._current = hash;
			this._next = null;

			this._historyDiff = window.history.length - this._historyStack.length;

			// In order to make sure _addToHistoryStack flag invalid after add hash to history stack,
			// we set this flag to false in every addHistory operation even if it's already false.
			this._addToHistoryStack = false;
		},

		_onHashChange: function(currentHash){
			// summary:
			//		subscribe /dojo/hashchange and do add history, back, forward and go operation.
			//
			// currentHash:
			//		the new url hash when /dojo/hashchange is triggered.

			if(this._index < 0 || this._index > (window.history.length - 1)){
				throw Error("Application history out of management.");
			}

			this._newHistoryLen = window.history.length;

			// Application history stack asynchronized with window.history, refresh application history stack.
			if(this._oldHistoryLen > this._newHistoryLen){
				//console.log("need to refresh _historyStack, oldLen:"+this._oldHistoryLen+", newLen: "+this._newHistoryLen+", diff:"+this._historyDiff);
				this._historyStack.splice((this._newHistoryLen - this._historyDiff - 1), (this._historyStack.length - 1));

				// Reset _historyLen to make sure this._historyLen<window.history.length, so it will push this hash to history stack.
				this._historyLen = this._historyStack.length;

				// Reset this._oldHistoryLen, so it can avoid refresh history stack again in some situation,
				// because by doing this, this._oldHistoryLen !== this._newHistoryLen
				this._oldHistoryLen = 0;
			}

			// this._oldHistoryLen === this._newHistoryLen, it maybe need to refresh history stack or do history go, back and forward,
			// so we use _addToHistoryStack to indentify the refresh operation.
			if(this._addToHistoryStack && (this._oldHistoryLen === this._newHistoryLen)){
				this._historyStack.splice((this._newHistoryLen - this._historyDiff - 1), (this._historyStack.length - 1));
				this._addHistory(currentHash);

				// It's a refresh operation, so that's no need to check history go, back or forward, just return.
				return;
			}

			//window.history.length increase, add hash to application history stack.
			if(this._historyLen < window.history.length){
				this._addHistory(currentHash);
				if (!this._startTransitionEvent) {
					// transition to the target view
					this.app.trigger("transition", {
						"viewId": currentHash
					});
				}
			}else{
				if(currentHash == this._current){
					console.log("do nothing.");
				}else if(currentHash === this._previous){ // back
					this._back(currentHash, this._historyStack[this._index]['detail']);
				}else if(currentHash === this._next){ //forward
					this._forward(currentHash, this._historyStack[this._index]['detail']);
				}else{ // go
					//search in 'back' first, then 'forward'
					var index = -1;
					for(var i = this._index; i > 0; i--){
						if(currentHash === this._historyStack[i]['hash']){
							index = i;
							break;
						}
					}

					//search in 'forward'
					if(-1 === index){
						for(var i = this._index; i < this._historyStack.length; i++){
							if(currentHash === this._historyStack[i]['hash']){
								index = i;
								break;
							}
						}
					}

					if(0 < index < this._historyStack.length){
						this._go(index, (index - this._index));
					}else{
						console.log("go error. index out of history stack.");
					}
				}
			}
			// set startTransition event flag to false
			this._startTransitionEvent = false;
		},

		_back: function(currentHash, detail){
			console.log("back");
			this._next = this._historyStack[this._index]['hash'];
			this._index--;
			if(this._index > 0){
				this._previous = this._historyStack[this._index - 1]['hash'];
			}else{
				this._previous = null;
			}
			this._current = currentHash;

			// publish history back event
			topic.publish("/app/history/back", {"viewId": currentHash, "detail": detail});

			// transition to the target view
			this.app.trigger("transition", {
				"viewId": currentHash,
				"opts": {reverse: true}
			});
		},

		_forward: function(currentHash, detail){
			console.log("forward");
			this._previous = this._historyStack[this._index]['hash'];
			this._index++;
			if(this._index < this._historyStack.length - 1){
				this._next = this._historyStack[this._index + 1]['hash'];
			}else{
				this._next = null;
			}
			this._current = currentHash;

			// publish history forward event
			topic.publish("/app/history/forward", {"viewId": currentHash, "detail": detail});

			// transition to the target view
			this.app.trigger("transition", {
				"viewId": currentHash,
				"opts": {reverse: false}
			});
		},

		_go: function(index, step){
			if(index < 0 || (index > window.history.length - 1)){
				throw Error("Application history.go steps out of management.");
			}

			this._index = index;
			this._current = this._historyStack[index]['hash'];
			this._previous = this._historyStack[index - 1] ? this._historyStack[index - 1]['hash'] : null;
			this._next = this._historyStack[index + 1] ? this._historyStack[index + 1]['hash'] : null;

			// publish history go event
			topic.publish("/app/history/go", {"viewId": this._current, "step": step, "detail": this._historyStack[index]["detail"]});

			var param;
			if(step > 0){
				param = {
					"viewId": this._current,
					"opts": {reverse: false}
				};
			}else{
				param = {
					"viewId": this._current,
					"opts": {reverse: true}
				};
			}
			// transition to the target view
			this.app.trigger("transition", param);
		}
	});
});


/*
 * 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.openide.filesystems;

import java.io.File;
import org.openide.modules.ConstructorDelegate;
import org.openide.modules.PatchFor;

/**
 *
 * @author sdedic
 */
@PatchFor(LocalFileSystem.class)
public abstract class LocalFileSystemCompat extends AbstractFileSystem {
    public LocalFileSystemCompat() {

    }

    @ConstructorDelegate
    public static void createLocalFileSystemCompat(LocalFileSystemCompat self, FileSystemCapability cap) {
        FileSystemCompat.compat(self).setCapability(cap);
    }

    /** Prepare environment by adding the root directory of the filesystem to the class path.
    * @param environment the environment to add to
     * @deprecated Useless.
    */
    @Deprecated
    public void prepareEnvironment(FileSystem$Environment environment) {
        environment.addClassPath(getRootDirectory().getAbsolutePath());
    }

    public abstract File getRootDirectory();
}


<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
   <extension
         point="org.eclipse.e4.ui.css.swt.theme">
      <theme
            basestylesheeturi="css/geppettoclassic.css"
            id="com.puppetlabs.geppetto.themes.classic"
            label="Geppetto Classic">
      </theme>
   </extension>

</plugin>


<!DOCTYPE html>
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<style>
		body {
			background: url('../1x1.jpg');
		}
	</style>
	<script src="../../jquery.js"></script>
</head>
<body>
	<script>
		window.parent.iframeCallback();
	</script>
</body>
</html>


/*
** $Id: lptypes.h,v 1.14 2015/09/28 17:17:41 roberto Exp $
** LPeg - PEG pattern matching for Lua
** Copyright 2007-2015, Lua.org & PUC-Rio  (see 'lpeg.html' for license)
** written by Roberto Ierusalimschy
*/

#if !defined(lptypes_h)
#define lptypes_h

#if !defined(LPEG_DEBUG)
#define NDEBUG
#endif

#include <assert.h>
#include <limits.h>

#include "lua.h"

#define VERSION         "1.0.0"

#define PATTERN_T	"lpeg-pattern"
#define MAXSTACKIDX	"lpeg-maxstack"

/*
** compatibility with Lua 5.1
*/
#if (LUA_VERSION_NUM == 501)

#define lp_equal	lua_equal

#define lua_getuservalue	lua_getfenv
#define lua_setuservalue	lua_setfenv

#define lua_rawlen		lua_objlen

#define luaL_setfuncs(L,f,n)	luaL_register(L,NULL,f)
#define luaL_newlib(L,f)	luaL_register(L,"lpeg",f)

#endif

#if !defined(lp_equal)
#define lp_equal(L,idx1,idx2)  lua_compare(L,(idx1),(idx2),LUA_OPEQ)
#endif

/* default maximum size for call/backtrack stack */
#if !defined(MAXBACK)
#define MAXBACK         400
#endif

/* maximum number of rules in a grammar */
#if !defined(MAXRULES)
#define MAXRULES        1000
#endif

/* initial size for capture's list */
#define INITCAPSIZE	32

/* index, on Lua stack, for subject */
#define SUBJIDX		2

/* number of fixed arguments to 'match' (before capture arguments) */
#define FIXEDARGS	3

/* index, on Lua stack, for capture list */
#define caplistidx(ptop)	((ptop) + 2)

/* index, on Lua stack, for pattern's ktable */
#define ktableidx(ptop)		((ptop) + 3)

/* index, on Lua stack, for backtracking stack */
#define stackidx(ptop)	((ptop) + 4)

typedef unsigned char byte;

#define BITSPERCHAR		8

#define CHARSETSIZE		((UCHAR_MAX/BITSPERCHAR) + 1)

typedef struct Charset {
  byte cs[CHARSETSIZE];
} Charset;

#define loopset(v,b)    { int v; for (v = 0; v < CHARSETSIZE; v++) {b;} }

/* access to charset */
#define treebuffer(t)      ((byte *)((t) + 1))

/* number of slots needed for 'n' bytes */
#define bytes2slots(n)  (((n) - 1) / sizeof(TTree) + 1)

/* set 'b' bit in charset 'cs' */
#define setchar(cs,b)   ((cs)[(b) >> 3] |= (1 << ((b) & 7)))

/*
** in capture instructions, 'kind' of capture and its offset are
** packed in field 'aux', 4 bits for each
*/
#define getkind(op)		((op)->i.aux & 0xF)
#define getoff(op)		(((op)->i.aux >> 4) & 0xF)
#define joinkindoff(k,o)	((k) | ((o) << 4))

#define MAXOFF		0xF
#define MAXAUX		0xFF

/* maximum number of bytes to look behind */
#define MAXBEHIND	MAXAUX

/* maximum size (in elements) for a pattern */
#define MAXPATTSIZE	(SHRT_MAX - 10)

/* size (in elements) for an instruction plus extra l bytes */
#define instsize(l)  (((l) + sizeof(Instruction) - 1)/sizeof(Instruction) + 1)

/* size (in elements) for a ISet instruction */
#define CHARSETINSTSIZE		instsize(CHARSETSIZE)

/* size (in elements) for a IFunc instruction */
#define funcinstsize(p)		((p)->i.aux + 2)

#define testchar(st,c)	(((int)(st)[((c) >> 3)] & (1 << ((c) & 7))))

#endif


<?xml version="1.0" encoding="utf-8" ?>
<Patch>
	<Operation Class="PatchOperationSequence">
		<success>Always</success>
		<operations>

				<modName>Medical System Expansion - Revived</modName>

				<xpath>Defs/HediffDef[@Name="MSE_AddedBodyPartSimpleBase"]/stages/li/statOffsets</xpath>
				<value>
					<statOffsets>
						<ArmorRating_Blunt>0.138</ArmorRating_Blunt>
						<ArmorRating_Sharp>0.075</ArmorRating_Sharp>
					</statOffsets>
				</value>

				<xpath>Defs/HediffDef[@Name="MSE_AddedBodyPartBionicBase"]/stages/li/statOffsets</xpath>
				<value>
					<statOffsets>
						<ArmorRating_Blunt>0.39</ArmorRating_Blunt>
						<ArmorRating_Sharp>0.212</ArmorRating_Sharp>
						<ArmorRating_Heat>0.106</ArmorRating_Heat>
					</statOffsets>
				</value>

				<xpath>Defs/HediffDef[@Name="MSE_AddedBodyPartArchotechBase"]/stages/li/statOffsets</xpath>
				<value>
					<statOffsets>
						<ArmorRating_Blunt>1.102</ArmorRating_Blunt>
						<ArmorRating_Sharp>0.6</ArmorRating_Sharp>
						<ArmorRating_Heat>0.3</ArmorRating_Heat>
					</statOffsets>
				</value>

		</operations>
	</Operation>
</Patch>


<?php

namespace Drupal\Tests\simpletest\Unit;

use Drupal\Tests\UnitTestCase;

/**
 * Tests that classes are correctly loaded during PHPUnit initialization.
 *
 * @group simpletest
 */
class PhpUnitAutoloaderTest extends UnitTestCase {

  /**
   * Test loading of classes provided by test sub modules.
   */
  public function testPhpUnitTestClassesLoading() {
    $this->assertTrue(class_exists('\Drupal\phpunit_test\PhpUnitTestDummyClass'), 'Class provided by test module was not autoloaded.');
  }

}


# How to generate your own inputs

To run the borrow checker on an input, you first need to generate the
input facts.  For that, you will need to run rustc with the
`-Znll-facts` option:

```
> rustc -Znll-facts inputs/issue-47680/issue-47680.rs
```

Or, for generating the input facts of a crate using the `#![feature(nll)]` flag:

```
> cargo rustc -- -Znll-facts
```

This will generate a `nll-facts` directory with one subdirectory per function:

```bash
> ls -F nll-facts
{{impl}}-maybe_next/  main/
```

You can then run on these directories.


// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

#ifndef EIGEN_ROTATIONBASE_H
#define EIGEN_ROTATIONBASE_H

namespace Eigen {

// forward declaration
namespace internal {
template<typename RotationDerived, typename MatrixType, bool IsVector=MatrixType::IsVectorAtCompileTime>
struct rotation_base_generic_product_selector;
}

/** \class RotationBase
  *
  * \brief Common base class for compact rotation representations
  *
  * \tparam Derived is the derived type, i.e., a rotation type
  * \tparam _Dim the dimension of the space
  */
template<typename Derived, int _Dim>
class RotationBase
{
  public:
    enum { Dim = _Dim };
    /** the scalar type of the coefficients */
    typedef typename internal::traits<Derived>::Scalar Scalar;

    /** corresponding linear transformation matrix type */
    typedef Matrix<Scalar,Dim,Dim> RotationMatrixType;
    typedef Matrix<Scalar,Dim,1> VectorType;

  public:
    EIGEN_DEVICE_FUNC inline const Derived& derived() const { return *static_cast<const Derived*>(this); }
    EIGEN_DEVICE_FUNC inline Derived& derived() { return *static_cast<Derived*>(this); }

    /** \returns an equivalent rotation matrix */
    EIGEN_DEVICE_FUNC inline RotationMatrixType toRotationMatrix() const { return derived().toRotationMatrix(); }

    /** \returns an equivalent rotation matrix
      * This function is added to be conform with the Transform class' naming scheme.
      */
    EIGEN_DEVICE_FUNC inline RotationMatrixType matrix() const { return derived().toRotationMatrix(); }

    /** \returns the inverse rotation */
    EIGEN_DEVICE_FUNC inline Derived inverse() const { return derived().inverse(); }

    /** \returns the concatenation of the rotation \c *this with a translation \a t */
    EIGEN_DEVICE_FUNC inline Transform<Scalar,Dim,Isometry> operator*(const Translation<Scalar,Dim>& t) const
    { return Transform<Scalar,Dim,Isometry>(*this) * t; }

    /** \returns the concatenation of the rotation \c *this with a uniform scaling \a s */
    EIGEN_DEVICE_FUNC inline RotationMatrixType operator*(const UniformScaling<Scalar>& s) const
    { return toRotationMatrix() * s.factor(); }

    /** \returns the concatenation of the rotation \c *this with a generic expression \a e
      * \a e can be:
      *  - a DimxDim linear transformation matrix
      *  - a DimxDim diagonal matrix (axis aligned scaling)
      *  - a vector of size Dim
      */
    template<typename OtherDerived>
    EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::rotation_base_generic_product_selector<Derived,OtherDerived,OtherDerived::IsVectorAtCompileTime>::ReturnType
    operator*(const EigenBase<OtherDerived>& e) const
    { return internal::rotation_base_generic_product_selector<Derived,OtherDerived>::run(derived(), e.derived()); }

    /** \returns the concatenation of a linear transformation \a l with the rotation \a r */
    template<typename OtherDerived> friend
    EIGEN_DEVICE_FUNC inline RotationMatrixType operator*(const EigenBase<OtherDerived>& l, const Derived& r)
    { return l.derived() * r.toRotationMatrix(); }

    /** \returns the concatenation of a scaling \a l with the rotation \a r */
    EIGEN_DEVICE_FUNC friend inline Transform<Scalar,Dim,Affine> operator*(const DiagonalMatrix<Scalar,Dim>& l, const Derived& r)
    {
      Transform<Scalar,Dim,Affine> res(r);
      res.linear().applyOnTheLeft(l);
      return res;
    }

    /** \returns the concatenation of the rotation \c *this with a transformation \a t */
    template<int Mode, int Options>
    EIGEN_DEVICE_FUNC inline Transform<Scalar,Dim,Mode> operator*(const Transform<Scalar,Dim,Mode,Options>& t) const
    { return toRotationMatrix() * t; }

    template<typename OtherVectorType>
    EIGEN_DEVICE_FUNC inline VectorType _transformVector(const OtherVectorType& v) const
    { return toRotationMatrix() * v; }
};

namespace internal {

// implementation of the generic product rotation * matrix
template<typename RotationDerived, typename MatrixType>
struct rotation_base_generic_product_selector<RotationDerived,MatrixType,false>
{
  enum { Dim = RotationDerived::Dim };
  typedef Matrix<typename RotationDerived::Scalar,Dim,Dim> ReturnType;
  EIGEN_DEVICE_FUNC static inline ReturnType run(const RotationDerived& r, const MatrixType& m)
  { return r.toRotationMatrix() * m; }
};

template<typename RotationDerived, typename Scalar, int Dim, int MaxDim>
struct rotation_base_generic_product_selector< RotationDerived, DiagonalMatrix<Scalar,Dim,MaxDim>, false >
{
  typedef Transform<Scalar,Dim,Affine> ReturnType;
  EIGEN_DEVICE_FUNC static inline ReturnType run(const RotationDerived& r, const DiagonalMatrix<Scalar,Dim,MaxDim>& m)
  {
    ReturnType res(r);
    res.linear() *= m;
    return res;
  }
};

template<typename RotationDerived,typename OtherVectorType>
struct rotation_base_generic_product_selector<RotationDerived,OtherVectorType,true>
{
  enum { Dim = RotationDerived::Dim };
  typedef Matrix<typename RotationDerived::Scalar,Dim,1> ReturnType;
  EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE ReturnType run(const RotationDerived& r, const OtherVectorType& v)
  {
    return r._transformVector(v);
  }
};

} // end namespace internal

/** \geometry_module
  *
  * \brief Constructs a Dim x Dim rotation matrix from the rotation \a r
  */
template<typename _Scalar, int _Rows, int _Cols, int _Storage, int _MaxRows, int _MaxCols>
template<typename OtherDerived>
EIGEN_DEVICE_FUNC Matrix<_Scalar, _Rows, _Cols, _Storage, _MaxRows, _MaxCols>
::Matrix(const RotationBase<OtherDerived,ColsAtCompileTime>& r)
{
  EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Matrix,int(OtherDerived::Dim),int(OtherDerived::Dim))
  *this = r.toRotationMatrix();
}

/** \geometry_module
  *
  * \brief Set a Dim x Dim rotation matrix from the rotation \a r
  */
template<typename _Scalar, int _Rows, int _Cols, int _Storage, int _MaxRows, int _MaxCols>
template<typename OtherDerived>
EIGEN_DEVICE_FUNC Matrix<_Scalar, _Rows, _Cols, _Storage, _MaxRows, _MaxCols>&
Matrix<_Scalar, _Rows, _Cols, _Storage, _MaxRows, _MaxCols>
::operator=(const RotationBase<OtherDerived,ColsAtCompileTime>& r)
{
  EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Matrix,int(OtherDerived::Dim),int(OtherDerived::Dim))
  return *this = r.toRotationMatrix();
}

namespace internal {

/** \internal
  *
  * Helper function to return an arbitrary rotation object to a rotation matrix.
  *
  * \tparam Scalar the numeric type of the matrix coefficients
  * \tparam Dim the dimension of the current space
  *
  * It returns a Dim x Dim fixed size matrix.
  *
  * Default specializations are provided for:
  *   - any scalar type (2D),
  *   - any matrix expression,
  *   - any type based on RotationBase (e.g., Quaternion, AngleAxis, Rotation2D)
  *
  * Currently toRotationMatrix is only used by Transform.
  *
  * \sa class Transform, class Rotation2D, class Quaternion, class AngleAxis
  */
template<typename Scalar, int Dim>
EIGEN_DEVICE_FUNC static inline Matrix<Scalar,2,2> toRotationMatrix(const Scalar& s)
{
  EIGEN_STATIC_ASSERT(Dim==2,YOU_MADE_A_PROGRAMMING_MISTAKE)
  return Rotation2D<Scalar>(s).toRotationMatrix();
}

template<typename Scalar, int Dim, typename OtherDerived>
EIGEN_DEVICE_FUNC static inline Matrix<Scalar,Dim,Dim> toRotationMatrix(const RotationBase<OtherDerived,Dim>& r)
{
  return r.toRotationMatrix();
}

template<typename Scalar, int Dim, typename OtherDerived>
EIGEN_DEVICE_FUNC static inline const MatrixBase<OtherDerived>& toRotationMatrix(const MatrixBase<OtherDerived>& mat)
{
  EIGEN_STATIC_ASSERT(OtherDerived::RowsAtCompileTime==Dim && OtherDerived::ColsAtCompileTime==Dim,
    YOU_MADE_A_PROGRAMMING_MISTAKE)
  return mat;
}

} // end namespace internal

} // end namespace Eigen

#endif // EIGEN_ROTATIONBASE_H


//
// This file is distributed under the MIT License. See LICENSE for details.
//
#include "pthread.h"
#include "smack.h"

void *__SMACK_PthreadReturn[SMACK_MAX_THREADS];

void __SMACK_init_tidtype() {
#ifdef BIT_PRECISE
  __SMACK_top_decl("type $tidtype = bv32;");
#else
  __SMACK_top_decl("type $tidtype = i32;");
#endif
}

void __SMACK_init_func_corral_primitives() {
  // Declare these, so bpl parsing doesn't complain
  __SMACK_top_decl("procedure corral_getThreadID() returns (x:$tidtype);");
  __SMACK_top_decl("procedure corral_getChildThreadID() returns (x:$tidtype);");
}

void __SMACK_init_func_thread() {
  // Array and possible statuses for tracking pthreads
  __SMACK_top_decl("var $pthreadStatus: [$tidtype]int;");
  __SMACK_top_decl("const unique $pthread_uninitialized: int;");
  __SMACK_top_decl("const unique $pthread_initialized: int;");
  __SMACK_top_decl("const unique $pthread_waiting: int;");
  __SMACK_top_decl("const unique $pthread_running: int;");
  __SMACK_top_decl("const unique $pthread_stopped: int;");
  // Initialize this array so all threads begin as uninitialized
  __SMACK_code("assume (forall i:$tidtype :: $pthreadStatus[i] == "
               "$pthread_uninitialized);");
}

pthread_t pthread_self(void) {
  int tmp_tid = __VERIFIER_nondet_int();
  __SMACK_code("call @ := corral_getThreadID();", tmp_tid);
  __VERIFIER_assume(tmp_tid < SMACK_MAX_THREADS);

  // Print actual tid to SMACK traces
  int actual_tid = tmp_tid;

  return actual_tid;
}

int pthread_equal(pthread_t t1, pthread_t t2) {
  // Return non-zero if threads are equal.  0 otherwise.
  return (int)t1 == (int)t2;
}

int pthread_join(pthread_t __th, void **__thread_return) {
  pthread_t calling_tid = pthread_self();

  // Print the tid of the thread being joined to SMACK traces
  int joining_tid = __th;

  // Check for self-joining deadlock
  if (calling_tid == __th)
    return 35; // This is EDEADLK

  // Wait for the thread to terminate
  __SMACK_code("assume $pthreadStatus[@] == $pthread_stopped;", __th);

  if (__thread_return) {
    *__thread_return = __SMACK_PthreadReturn[__th];

    // Print return pointer value to SMACK traces
    void *actual_thread_return_pointer = *__thread_return;
  }

  return 0;
}

// TODO: A terminating thread that DOESN'T call pthread_exit() should have
//       an implicit call to pthread_exit().  This is not currently modeled.
//       Further, a child thread's routine which uses `return` calls should
//       have the returned value passed to this implicit call to pthread_exit().
//       In other words, a `return` should pass its value to an implicit call to
//       pthread_exit().
void pthread_exit(void *retval) {
  pthread_t tid = pthread_self();

// Ensure exit hasn't already been called
#ifndef DISABLE_PTHREAD_ASSERTS
  __SMACK_code("assert $pthreadStatus[@] == $pthread_running;", tid);
#endif
  __SMACK_PthreadReturn[tid] = retval;

  // Set return pointer value for display in SMACK traces
  void *pthread_return_pointer = retval;
}

int pthread_mutexattr_init(pthread_mutexattr_t *attr) {
  attr->type = PTHREAD_MUTEX_NORMAL;
  return 0;
}

int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type) {
  attr->type = type;
  return 0;
}

int pthread_mutex_init(pthread_mutex_t *mutex,
                       const pthread_mutexattr_t *attr) {
  // Can't check for already initialized error,
  //  since uninitialized values are nondet and could be INITIALIZED
  mutex->lock = UNLOCKED;
  mutex->init = INITIALIZED;
  if (attr == 0) {
    pthread_mutexattr_init(&mutex->attr);
  } else {
    mutex->attr.type = attr->type;
    // Any additional info modeled from attr should be copied,
    //  as changes to attr should not apply to mutexes alread initialized
    //  (as opposed to directly setting mutex->attr = attr)
  }
  return 0;
}

int pthread_mutex_lock(pthread_mutex_t *__mutex) {
  int tid = (int)pthread_self();
  // Ensure mutex is initialized & hasn't already been locked by caller
  if (__mutex->attr.type == PTHREAD_MUTEX_NORMAL) {
#ifndef DISABLE_PTHREAD_ASSERTS
    assert(__mutex->init == INITIALIZED);
    assert(__mutex->lock != tid);
#endif
  } else if (__mutex->attr.type == PTHREAD_MUTEX_ERRORCHECK) {
    if (__mutex->init != INITIALIZED)
      return 22; // This is EINVAL
    if (__mutex->lock == tid)
      return 35; // This is EDEADLK
  } else {
// Other types not currently implemented
#ifndef DISABLE_PTHREAD_ASSERTS
    assert(0);
#endif
  }
  __SMACK_code("call corral_atomic_begin();");
  // Wait for lock to become free
  __VERIFIER_assume(__mutex->lock == UNLOCKED);
  __mutex->lock = tid;
  __SMACK_code("call corral_atomic_end();");
  return 0;
}

int pthread_mutex_unlock(pthread_mutex_t *__mutex) {
  int tid = (int)pthread_self();
  // Ensure mutex is initialized & caller is current owner
  if (__mutex->attr.type == PTHREAD_MUTEX_NORMAL) {
#ifndef DISABLE_PTHREAD_ASSERTS
    assert(__mutex->init == INITIALIZED);
    assert(__mutex->lock == tid);
#endif
  } else if (__mutex->attr.type == PTHREAD_MUTEX_ERRORCHECK) {
    if (__mutex->init != INITIALIZED)
      return 22; // This is EINVAL
    if (__mutex->lock != tid)
      return 1; // This is EPERM
  } else {
// Other types not currently implemented
#ifndef DISABLE_PTHREAD_ASSERTS
    assert(0);
#endif
  }
  __SMACK_code("call corral_atomic_begin();");
  __mutex->lock = UNLOCKED;
  __SMACK_code("call corral_atomic_end();");
  return 0;
}

int pthread_mutex_destroy(pthread_mutex_t *__mutex) {
// Make sure the lock is initialized, and unlocked
#ifndef DISABLE_PTHREAD_ASSERTS
  assert(__mutex->init == INITIALIZED);
  assert(__mutex->lock == UNLOCKED);
#endif
  __SMACK_code("call corral_atomic_begin();");
  __mutex->init = UNINITIALIZED;
  __SMACK_code("call corral_atomic_end();");
  return 0;
}

int pthread_cond_init(pthread_cond_t *__cond, pthread_condattr_t *__condattr) {
  if (__condattr == 0) {
    __cond->cond = 0;
    __cond->init = INITIALIZED;
  } else {
// Unimplemented
// NOTE: if implemented, attr should be a copy of __condattr passed in
//       (spec says changes to condattr doesn't affect initialized conds
#ifndef DISABLE_PTHREAD_ASSERTS
    assert(0);
#endif
  }
  return 0;
}

int pthread_cond_wait(pthread_cond_t *__cond, pthread_mutex_t *__mutex) {
// Ensure conditional var is initialized, and mutex is locked properly
#ifndef DISABLE_PTHREAD_ASSERTS
  assert(__cond->init == INITIALIZED);
  assert((int)pthread_self() == __mutex->lock);
#endif
  pthread_mutex_unlock(__mutex);
  // Wait to be woken up
  // No need to check for signal on __cond, since OS can do spurious wakeup
  // Call to pthread_cond_wait should always be protected by while loop

  // Adding var checks in improves performance

  // assume(__cond->cond == 1);
  //__cond->cond = 0;
  pthread_mutex_lock(__mutex);
  return 0;
}

int pthread_cond_signal(pthread_cond_t *__cond) {
  // Do nothing, since state of __cond doesn't matter
  //  due to possibility of spurious wakeup from OS

  //__cond->cond = 1;
  return 0;
}

// NOTE: How to handle broadcast?  Technically, as is, all threads have
//       the opportunity to read __cond->cond before one of the other threads
//       switch this value back to 0...  I guess this is sufficient, but
//       will this require a high number of context switches for a true
//       broadcast to happen?
//
//       I thought about using cond->cond = 2 to signal broadcast, but then
//       how to know which thread to have switch it back to 0?

int pthread_cond_broadcast(pthread_cond_t *__cond) {
  // Do nothing, since state of __cond doesn't matter
  //  due to possibility of spurious wakeup from OS

  //__cond->cond = 1;
  return 0;
}

int pthread_cond_destroy(pthread_cond_t *__cond) {
// Make sure the cond is initialized
#ifndef DISABLE_PTHREAD_ASSERTS
  assert(__cond->init == INITIALIZED);
#endif
  __cond->init = UNINITIALIZED;
  return 0;
}

void __call_wrapper(pthread_t *__newthread, void *(*__start_routine)(void *),
                    void *__arg) {

  pthread_t ctid = pthread_self();
  // Wait for parent to set child's thread ID in original pthread_t struct
  __VERIFIER_assume(ctid == *__newthread);

  // Cycle through thread statuses properly, as thread is started, run,
  // and stopped.
  __SMACK_code("$pthreadStatus[@] := $pthread_waiting;", ctid);
  __SMACK_code("$pthreadStatus[@] := $pthread_running;", ctid);
  __start_routine(__arg);
  __SMACK_code("$pthreadStatus[@] := $pthread_stopped;", ctid);
}

int pthread_create(pthread_t *__newthread, __const pthread_attr_t *__attr,
                   void *(*__start_routine)(void *), void *__arg) {

  // Add unreachable C-level call to __call_wrapper, so LLVM sees
  // the call to __call_wrapper and performs DSA on it.
  int x = __VERIFIER_nondet_int();
  __VERIFIER_assume(x == 0);
  if (x)
    __call_wrapper(__newthread, __start_routine, __arg);

  __SMACK_code("async call @(@, @, @);", __call_wrapper, __newthread,
               __start_routine, __arg);
  pthread_t tmp = __VERIFIER_nondet_int();
  __SMACK_code("call @ := corral_getChildThreadID();", tmp);
  __VERIFIER_assume(tmp < SMACK_MAX_THREADS);
  *__newthread = tmp;

  return 0;
}


//
//     Generated by class-dump 3.5 (64 bit).
//
//     class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//

@class NSData, NSString;

@protocol XCTestManager_TestsInterface
- (void)_XCT_receivedAccessibilityNotification:(int)arg1 withPayload:(NSData *)arg2;
- (void)_XCT_applicationWithBundleID:(NSString *)arg1 didUpdatePID:(int)arg2 andState:(unsigned long long)arg3;
@end


#
# Fluentd Kubernetes Metadata Filter Plugin - Enrich Fluentd events with
# Kubernetes metadata
#
# Copyright 2015 Red Hat, 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.
#
---
http_interactions:
- request:
    method: get
    uri: https://localhost:8443/api/v1/namespaces/default/pods/fabric8-console-controller-98rqc
    body:
      encoding: US-ASCII
      string: ''
    headers:
      Accept:
      - "*/*; q=0.5, application/xml"
      Accept-Encoding:
      - gzip, deflate
      User-Agent:
      - Ruby
  response:
    status:
      code: 200
      message: OK
    headers:
      Content-Type:
      - application/json
      Date:
      - Fri, 08 May 2015 10:35:37 GMT
      Transfer-Encoding:
      - chunked
    body:
      encoding: UTF-8
      string: |-
        {
          "kind": "Pod",
          "apiVersion": "v1",
          "metadata": {
            "name": "fabric8-console-controller-98rqc",
            "generateName": "fabric8-console-controller-",
            "namespace": "default",
            "selfLink": "/api/v1/namespaces/default/pods/fabric8-console-controller-98rqc",
            "uid": "c76927af-f563-11e4-b32d-54ee7527188d",
            "resourceVersion": "122",
            "creationTimestamp": "2015-05-08T09:22:42Z",
            "labels": {
              "component": "fabric8Console"
            }
          },
          "spec": {
            "volumes": [
              {
                "name": "openshift-cert-secrets",
                "hostPath": null,
                "emptyDir": null,
                "gcePersistentDisk": null,
                "gitRepo": null,
                "secret": {
                  "secretName": "openshift-cert-secrets"
                },
                "nfs": null,
                "iscsi": null,
                "glusterfs": null
              }
            ],
            "containers": [
              {
                "name": "fabric8-console-container",
                "image": "fabric8/hawtio-kubernetes:latest",
                "ports": [
                  {
                    "containerPort": 9090,
                    "protocol": "TCP"
                  }
                ],
                "env": [
                  {
                    "name": "OAUTH_CLIENT_ID",
                    "value": "fabric8-console"
                  },
                  {
                    "name": "OAUTH_AUTHORIZE_URI",
                    "value": "https://localhost:8443/oauth/authorize"
                  }
                ],
                "resources": {},
                "volumeMounts": [
                  {
                    "name": "openshift-cert-secrets",
                    "readOnly": true,
                    "mountPath": "/etc/secret-volume"
                  }
                ],
                "terminationMessagePath": "/dev/termination-log",
                "imagePullPolicy": "IfNotPresent",
                "capabilities": {}
              }
            ],
            "restartPolicy": "Always",
            "dnsPolicy": "ClusterFirst",
            "nodeName": "jimmi-redhat.localnet"
          },
          "status": {
            "phase": "Running",
            "Condition": [
              {
                "type": "Ready",
                "status": "True"
              }
            ],
            "hostIP": "172.17.42.1",
            "podIP": "172.17.0.8",
            "containerStatuses": [
              {
                "name": "fabric8-console-container",
                "state": {
                  "running": {
                    "startedAt": "2015-05-08T09:22:44Z"
                  }
                },
                "lastState": {},
                "ready": true,
                "restartCount": 0,
                "image": "fabric8/hawtio-kubernetes:latest",
                "imageID": "docker://b2bd1a24a68356b2f30128e6e28e672c1ef92df0d9ec01ec0c7faea5d77d2303",
                "containerID": "docker://49095a2894da899d3b327c5fde1e056a81376cc9a8f8b09a195f2a92bceed459"
              }
            ]
          }
        }
    http_version:
  recorded_at: Fri, 08 May 2015 10:35:37 GMT
recorded_with: VCR 2.9.3


/*
 *  Hardware dependent layer
 *  Copyright (c) by Jaroslav Kysela <perex@perex.cz>
 *
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 *
 */

#include <linux/major.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/time.h>
#include <linux/mutex.h>
#include <sound/core.h>
#include <sound/control.h>
#include <sound/minors.h>
#include <sound/hwdep.h>
#include <sound/info.h>

MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>");
MODULE_DESCRIPTION("Hardware dependent layer");
MODULE_LICENSE("GPL");

static LIST_HEAD(snd_hwdep_devices);
static DEFINE_MUTEX(register_mutex);

static int snd_hwdep_free(struct snd_hwdep *hwdep);
static int snd_hwdep_dev_free(struct snd_device *device);
static int snd_hwdep_dev_register(struct snd_device *device);
static int snd_hwdep_dev_disconnect(struct snd_device *device);

static struct snd_hwdep *snd_hwdep_search(struct snd_card *card, int device)
{
	struct snd_hwdep *hwdep;

	list_for_each_entry(hwdep, &snd_hwdep_devices, list)
		if (hwdep->card == card && hwdep->device == device)
			return hwdep;
	return NULL;
}

static loff_t snd_hwdep_llseek(struct file * file, loff_t offset, int orig)
{
	struct snd_hwdep *hw = file->private_data;
	if (hw->ops.llseek)
		return hw->ops.llseek(hw, file, offset, orig);
	return -ENXIO;
}

static ssize_t snd_hwdep_read(struct file * file, char __user *buf,
			      size_t count, loff_t *offset)
{
	struct snd_hwdep *hw = file->private_data;
	if (hw->ops.read)
		return hw->ops.read(hw, buf, count, offset);
	return -ENXIO;
}

static ssize_t snd_hwdep_write(struct file * file, const char __user *buf,
			       size_t count, loff_t *offset)
{
	struct snd_hwdep *hw = file->private_data;
	if (hw->ops.write)
		return hw->ops.write(hw, buf, count, offset);
	return -ENXIO;
}

static int snd_hwdep_open(struct inode *inode, struct file * file)
{
	int major = imajor(inode);
	struct snd_hwdep *hw;
	int err;
	wait_queue_t wait;

	if (major == snd_major) {
		hw = snd_lookup_minor_data(iminor(inode),
					   SNDRV_DEVICE_TYPE_HWDEP);
#ifdef CONFIG_SND_OSSEMUL
	} else if (major == SOUND_MAJOR) {
		hw = snd_lookup_oss_minor_data(iminor(inode),
					       SNDRV_OSS_DEVICE_TYPE_DMFM);
#endif
	} else
		return -ENXIO;
	if (hw == NULL)
		return -ENODEV;

	if (!try_module_get(hw->card->module))
		return -EFAULT;

	init_waitqueue_entry(&wait, current);
	add_wait_queue(&hw->open_wait, &wait);
	mutex_lock(&hw->open_mutex);
	while (1) {
		if (hw->exclusive && hw->used > 0) {
			err = -EBUSY;
			break;
		}
		if (!hw->ops.open) {
			err = 0;
			break;
		}
		err = hw->ops.open(hw, file);
		if (err >= 0)
			break;
		if (err == -EAGAIN) {
			if (file->f_flags & O_NONBLOCK) {
				err = -EBUSY;
				break;
			}
		} else
			break;
		set_current_state(TASK_INTERRUPTIBLE);
		mutex_unlock(&hw->open_mutex);
		schedule();
		mutex_lock(&hw->open_mutex);
		if (signal_pending(current)) {
			err = -ERESTARTSYS;
			break;
		}
	}
	remove_wait_queue(&hw->open_wait, &wait);
	if (err >= 0) {
		err = snd_card_file_add(hw->card, file);
		if (err >= 0) {
			file->private_data = hw;
			hw->used++;
		} else {
			if (hw->ops.release)
				hw->ops.release(hw, file);
		}
	}
	mutex_unlock(&hw->open_mutex);
	if (err < 0)
		module_put(hw->card->module);
	return err;
}

static int snd_hwdep_release(struct inode *inode, struct file * file)
{
	int err = 0;
	struct snd_hwdep *hw = file->private_data;
	struct module *mod = hw->card->module;

	mutex_lock(&hw->open_mutex);
	if (hw->ops.release)
		err = hw->ops.release(hw, file);
	if (hw->used > 0)
		hw->used--;
	mutex_unlock(&hw->open_mutex);
	wake_up(&hw->open_wait);

	snd_card_file_remove(hw->card, file);
	module_put(mod);
	return err;
}

static unsigned int snd_hwdep_poll(struct file * file, poll_table * wait)
{
	struct snd_hwdep *hw = file->private_data;
	if (hw->ops.poll)
		return hw->ops.poll(hw, file, wait);
	return 0;
}

static int snd_hwdep_info(struct snd_hwdep *hw,
			  struct snd_hwdep_info __user *_info)
{
	struct snd_hwdep_info info;

	memset(&info, 0, sizeof(info));
	info.card = hw->card->number;
	strlcpy(info.id, hw->id, sizeof(info.id));
	strlcpy(info.name, hw->name, sizeof(info.name));
	info.iface = hw->iface;
	if (copy_to_user(_info, &info, sizeof(info)))
		return -EFAULT;
	return 0;
}

static int snd_hwdep_dsp_status(struct snd_hwdep *hw,
				struct snd_hwdep_dsp_status __user *_info)
{
	struct snd_hwdep_dsp_status info;
	int err;

	if (! hw->ops.dsp_status)
		return -ENXIO;
	memset(&info, 0, sizeof(info));
	info.dsp_loaded = hw->dsp_loaded;
	if ((err = hw->ops.dsp_status(hw, &info)) < 0)
		return err;
	if (copy_to_user(_info, &info, sizeof(info)))
		return -EFAULT;
	return 0;
}

static int snd_hwdep_dsp_load(struct snd_hwdep *hw,
			      struct snd_hwdep_dsp_image __user *_info)
{
	struct snd_hwdep_dsp_image info;
	int err;

	if (! hw->ops.dsp_load)
		return -ENXIO;
	memset(&info, 0, sizeof(info));
	if (copy_from_user(&info, _info, sizeof(info)))
		return -EFAULT;
	/* check whether the dsp was already loaded */
	if (hw->dsp_loaded & (1 << info.index))
		return -EBUSY;
	if (!access_ok(VERIFY_READ, info.image, info.length))
		return -EFAULT;
	err = hw->ops.dsp_load(hw, &info);
	if (err < 0)
		return err;
	hw->dsp_loaded |= (1 << info.index);
	return 0;
}

static long snd_hwdep_ioctl(struct file * file, unsigned int cmd,
			    unsigned long arg)
{
	struct snd_hwdep *hw = file->private_data;
	void __user *argp = (void __user *)arg;
	switch (cmd) {
	case SNDRV_HWDEP_IOCTL_PVERSION:
		return put_user(SNDRV_HWDEP_VERSION, (int __user *)argp);
	case SNDRV_HWDEP_IOCTL_INFO:
		return snd_hwdep_info(hw, argp);
	case SNDRV_HWDEP_IOCTL_DSP_STATUS:
		return snd_hwdep_dsp_status(hw, argp);
	case SNDRV_HWDEP_IOCTL_DSP_LOAD:
		return snd_hwdep_dsp_load(hw, argp);
	}
	if (hw->ops.ioctl)
		return hw->ops.ioctl(hw, file, cmd, arg);
	return -ENOTTY;
}

static int snd_hwdep_mmap(struct file * file, struct vm_area_struct * vma)
{
	struct snd_hwdep *hw = file->private_data;
	if (hw->ops.mmap)
		return hw->ops.mmap(hw, file, vma);
	return -ENXIO;
}

static int snd_hwdep_control_ioctl(struct snd_card *card,
				   struct snd_ctl_file * control,
				   unsigned int cmd, unsigned long arg)
{
	switch (cmd) {
	case SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE:
		{
			int device;

			if (get_user(device, (int __user *)arg))
				return -EFAULT;
			mutex_lock(&register_mutex);
			device = device < 0 ? 0 : device + 1;
			while (device < SNDRV_MINOR_HWDEPS) {
				if (snd_hwdep_search(card, device))
					break;
				device++;
			}
			if (device >= SNDRV_MINOR_HWDEPS)
				device = -1;
			mutex_unlock(&register_mutex);
			if (put_user(device, (int __user *)arg))
				return -EFAULT;
			return 0;
		}
	case SNDRV_CTL_IOCTL_HWDEP_INFO:
		{
			struct snd_hwdep_info __user *info = (struct snd_hwdep_info __user *)arg;
			int device, err;
			struct snd_hwdep *hwdep;

			if (get_user(device, &info->device))
				return -EFAULT;
			mutex_lock(&register_mutex);
			hwdep = snd_hwdep_search(card, device);
			if (hwdep)
				err = snd_hwdep_info(hwdep, info);
			else
				err = -ENXIO;
			mutex_unlock(&register_mutex);
			return err;
		}
	}
	return -ENOIOCTLCMD;
}

#ifdef CONFIG_COMPAT
#include "hwdep_compat.c"
#else
#define snd_hwdep_ioctl_compat	NULL
#endif

/*

 */

static const struct file_operations snd_hwdep_f_ops =
{
	.owner = 	THIS_MODULE,
	.llseek =	snd_hwdep_llseek,
	.read = 	snd_hwdep_read,
	.write =	snd_hwdep_write,
	.open =		snd_hwdep_open,
	.release =	snd_hwdep_release,
	.poll =		snd_hwdep_poll,
	.unlocked_ioctl =	snd_hwdep_ioctl,
	.compat_ioctl =	snd_hwdep_ioctl_compat,
	.mmap =		snd_hwdep_mmap,
};

/**
 * snd_hwdep_new - create a new hwdep instance
 * @card: the card instance
 * @id: the id string
 * @device: the device index (zero-based)
 * @rhwdep: the pointer to store the new hwdep instance
 *
 * Creates a new hwdep instance with the given index on the card.
 * The callbacks (hwdep->ops) must be set on the returned instance
 * after this call manually by the caller.
 *
 * Returns zero if successful, or a negative error code on failure.
 */
int snd_hwdep_new(struct snd_card *card, char *id, int device,
		  struct snd_hwdep **rhwdep)
{
	struct snd_hwdep *hwdep;
	int err;
	static struct snd_device_ops ops = {
		.dev_free = snd_hwdep_dev_free,
		.dev_register = snd_hwdep_dev_register,
		.dev_disconnect = snd_hwdep_dev_disconnect,
	};

	if (snd_BUG_ON(!card))
		return -ENXIO;
	if (rhwdep)
		*rhwdep = NULL;
	hwdep = kzalloc(sizeof(*hwdep), GFP_KERNEL);
	if (hwdep == NULL) {
		snd_printk(KERN_ERR "hwdep: cannot allocate\n");
		return -ENOMEM;
	}
	hwdep->card = card;
	hwdep->device = device;
	if (id)
		strlcpy(hwdep->id, id, sizeof(hwdep->id));
#ifdef CONFIG_SND_OSSEMUL
	hwdep->oss_type = -1;
#endif
	if ((err = snd_device_new(card, SNDRV_DEV_HWDEP, hwdep, &ops)) < 0) {
		snd_hwdep_free(hwdep);
		return err;
	}
	init_waitqueue_head(&hwdep->open_wait);
	mutex_init(&hwdep->open_mutex);
	if (rhwdep)
		*rhwdep = hwdep;
	return 0;
}

static int snd_hwdep_free(struct snd_hwdep *hwdep)
{
	if (!hwdep)
		return 0;
	if (hwdep->private_free)
		hwdep->private_free(hwdep);
	kfree(hwdep);
	return 0;
}

static int snd_hwdep_dev_free(struct snd_device *device)
{
	struct snd_hwdep *hwdep = device->device_data;
	return snd_hwdep_free(hwdep);
}

static int snd_hwdep_dev_register(struct snd_device *device)
{
	struct snd_hwdep *hwdep = device->device_data;
	int err;
	char name[32];

	mutex_lock(&register_mutex);
	if (snd_hwdep_search(hwdep->card, hwdep->device)) {
		mutex_unlock(&register_mutex);
		return -EBUSY;
	}
	list_add_tail(&hwdep->list, &snd_hwdep_devices);
	sprintf(name, "hwC%iD%i", hwdep->card->number, hwdep->device);
	if ((err = snd_register_device(SNDRV_DEVICE_TYPE_HWDEP,
				       hwdep->card, hwdep->device,
				       &snd_hwdep_f_ops, hwdep, name)) < 0) {
		snd_printk(KERN_ERR "unable to register hardware dependent device %i:%i\n",
			   hwdep->card->number, hwdep->device);
		list_del(&hwdep->list);
		mutex_unlock(&register_mutex);
		return err;
	}
#ifdef CONFIG_SND_OSSEMUL
	hwdep->ossreg = 0;
	if (hwdep->oss_type >= 0) {
		if ((hwdep->oss_type == SNDRV_OSS_DEVICE_TYPE_DMFM) && (hwdep->device != 0)) {
			snd_printk (KERN_WARNING "only hwdep device 0 can be registered as OSS direct FM device!\n");
		} else {
			if (snd_register_oss_device(hwdep->oss_type,
						    hwdep->card, hwdep->device,
						    &snd_hwdep_f_ops, hwdep,
						    hwdep->oss_dev) < 0) {
				snd_printk(KERN_ERR "unable to register OSS compatibility device %i:%i\n",
					   hwdep->card->number, hwdep->device);
			} else
				hwdep->ossreg = 1;
		}
	}
#endif
	mutex_unlock(&register_mutex);
	return 0;
}

static int snd_hwdep_dev_disconnect(struct snd_device *device)
{
	struct snd_hwdep *hwdep = device->device_data;

	if (snd_BUG_ON(!hwdep))
		return -ENXIO;
	mutex_lock(&register_mutex);
	if (snd_hwdep_search(hwdep->card, hwdep->device) != hwdep) {
		mutex_unlock(&register_mutex);
		return -EINVAL;
	}
#ifdef CONFIG_SND_OSSEMUL
	if (hwdep->ossreg)
		snd_unregister_oss_device(hwdep->oss_type, hwdep->card, hwdep->device);
#endif
	snd_unregister_device(SNDRV_DEVICE_TYPE_HWDEP, hwdep->card, hwdep->device);
	list_del_init(&hwdep->list);
	mutex_unlock(&register_mutex);
	return 0;
}

#ifdef CONFIG_PROC_FS
/*
 *  Info interface
 */

static void snd_hwdep_proc_read(struct snd_info_entry *entry,
				struct snd_info_buffer *buffer)
{
	struct snd_hwdep *hwdep;

	mutex_lock(&register_mutex);
	list_for_each_entry(hwdep, &snd_hwdep_devices, list)
		snd_iprintf(buffer, "%02i-%02i: %s\n",
			    hwdep->card->number, hwdep->device, hwdep->name);
	mutex_unlock(&register_mutex);
}

static struct snd_info_entry *snd_hwdep_proc_entry;

static void __init snd_hwdep_proc_init(void)
{
	struct snd_info_entry *entry;

	if ((entry = snd_info_create_module_entry(THIS_MODULE, "hwdep", NULL)) != NULL) {
		entry->c.text.read = snd_hwdep_proc_read;
		if (snd_info_register(entry) < 0) {
			snd_info_free_entry(entry);
			entry = NULL;
		}
	}
	snd_hwdep_proc_entry = entry;
}

static void __exit snd_hwdep_proc_done(void)
{
	snd_info_free_entry(snd_hwdep_proc_entry);
}
#else /* !CONFIG_PROC_FS */
#define snd_hwdep_proc_init()
#define snd_hwdep_proc_done()
#endif /* CONFIG_PROC_FS */

/*
 *  ENTRY functions
 */

static int __init alsa_hwdep_init(void)
{
	snd_hwdep_proc_init();
	snd_ctl_register_ioctl(snd_hwdep_control_ioctl);
	snd_ctl_register_ioctl_compat(snd_hwdep_control_ioctl);
	return 0;
}

static void __exit alsa_hwdep_exit(void)
{
	snd_ctl_unregister_ioctl(snd_hwdep_control_ioctl);
	snd_ctl_unregister_ioctl_compat(snd_hwdep_control_ioctl);
	snd_hwdep_proc_done();
}

module_init(alsa_hwdep_init)
module_exit(alsa_hwdep_exit)

EXPORT_SYMBOL(snd_hwdep_new);


//******************************************************************************
//
// Copyright (c) 2016 Microsoft Corporation. All rights reserved.
//
// This code is licensed under the MIT License (MIT).
//
// 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.
//
//******************************************************************************

#import <TestFramework.h>
#import <Foundation/Foundation.h>
#import <UWP/WindowsFoundation.h>
#import <UWP/WindowsStorage.h>

class NSBundleTests {
public:
    BEGIN_TEST_CLASS(NSBundleTests)
    END_TEST_CLASS()

    TEST_CLASS_SETUP(NSURLClassSetup) {
        return FunctionalTestSetupUIApplication();
    }

    TEST_CLASS_CLEANUP(NSBundleCleanup) {
        return FunctionalTestCleanupUIApplication();
    }

    TEST_METHOD(MSAppxURL) {
        LOG_INFO("MSAppxURL test: ");

        NSURL* resourceURL = [[NSBundle mainBundle] URLForResource:@"FunctionalTests" withExtension:@"dll"];
        NSURL* msAppxURL = [[NSBundle mainBundle] _msAppxURLForResourceWithURL:resourceURL];
        ASSERT_OBJCEQ([NSURL URLWithString:[@"ms-appx:///" stringByAppendingString:[resourceURL lastPathComponent]]], msAppxURL);

        WFUri* msAppxURI = [WFUri makeUri:msAppxURL.absoluteString];

        // Verify that the file can be accessed
        __block BOOL success = NO;
        __block BOOL signaled = NO;
        __block NSCondition* condition = [[NSCondition new] autorelease];

        [WSStorageFile getFileFromApplicationUriAsync:msAppxURI
            success:^void(WSStorageFile* file) {
                [condition lock];
                success = YES;
                signaled = YES;
                [condition signal];
                [condition unlock];
            }
            failure:^void(NSError* error) {
                LOG_ERROR([[error description] UTF8String]);
                [condition lock];
                signaled = YES;
                [condition signal];
                [condition unlock];
            }];

        [condition lock];
        ASSERT_TRUE(signaled || [condition waitUntilDate:[NSDate dateWithTimeIntervalSinceNow:2]]);
        [condition unlock];

        ASSERT_EQ(YES, success);
    }
};


<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <script type="text/javascript" src="../helper.js"></script>
</head>
<body>

</body>
</html>


<!doctype html>

<title>CodeMirror: ASN.1 mode</title>
<meta charset="utf-8"/>
<link rel=stylesheet href="../../doc/docs.css">

<link rel="stylesheet" href="../../lib/codemirror.css">

CodeMirror

Home

Manual

Code

Language modes

ASN.1

ASN.1 example

        <textarea id="ttcn-asn-code">
 --
 -- Sample ASN.1 Code
 --
 MyModule DEFINITIONS ::=
 BEGIN

 MyTypes ::= SEQUENCE {
     myObjectId   OBJECT IDENTIFIER,
     mySeqOf      SEQUENCE OF MyInt,
     myBitString  BIT STRING {
                         muxToken(0),
                         modemToken(1)
                  }
 }

 MyInt ::= INTEGER (0..65535)

 END
        </textarea>

Language: Abstract Syntax Notation One
        (ASN.1)

MIME types defined: text/x-ttcn-asn

The development of this mode has been sponsored by Ericsson
    .

Coded by Asmelash Tsegay Gebretsadkan


// @flow
/* eslint-disable react/jsx-sort-props */
import * as React from 'react';
import * as vars from '../../styles/variables';
import AccessibleSVG from '../../icons/accessible-svg';
import type { Icon } from '../../icons/flowTypes';

/**
 * This is an auto-generated component and should not be edited
 * manually in contributor pull requests.
 *
 * If you have problems with this component:
 * - https://github.com/box/box-ui-elements/issues/new?template=Bug_report.md
 *
 * If there are missing features in this component:
 * - https://github.com/box/box-ui-elements/issues/new?template=Feature_request.md
 */

const FileVector32 = (props: Icon) => (
    <AccessibleSVG width={32} height={32} viewBox="0 0 32 32" {...props}>
        <g fill="none">
            <path
                fill="#F7931D"
                d="M9 3h9.586a1 1 0 01.707.293l6.415 6.414a1 1 0 01.293.707V26A3 3 0 0123 29H9a3 3 0 01-3-3V6a3 3 0 013-3z"
            />
            <path
                fill={vars.white}
                fillOpacity={0.5}
                d="M19.286 3.286l5.01 5.009 1.412 1.412a1 1 0 01.203.293H21a2 2 0 01-2-2V3.09a1 1 0 01.286.196z"
            />
            <path
                fill={vars.white}
                d="M13.195 17.07l.005.01c.12.312.292.6.504.851l-.424.254c-1.414.847-2.452 2.33-2.715 3.992a1 1 0 11-.999-.078c.289-1.994 1.516-3.763 3.2-4.772l.43-.257zm5.618.003l.429.256c1.687 1.008 2.91 2.77 3.197 4.77a1 1 0 11-1.002.073c-.26-1.664-1.293-3.14-2.708-3.985l-.43-.256.013-.019c.194-.235.354-.5.47-.787l.03-.052zM16 14a2 2 0 011.937 1.5h4.592c.26 0 .471.21.471.47v.06c0 .26-.21.47-.47.47l-4.593.001a2 2 0 01-3.874 0L9.471 16.5a.47.47 0 01-.47-.47v-.06c0-.26.21-.47.47-.47h4.592A2 2 0 0116 14zm0 1a1 1 0 00-1 .98v.039l.007.098A1 1 0 1016 15z"
            />
        </g>
    </AccessibleSVG>
);

export default FileVector32;


铘


/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/. */

'use strict';

const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;

Cu.import('resource://gre/modules/XPCOMUtils.jsm');
Cu.import('resource://gre/modules/Services.jsm');

XPCOMUtils.defineLazyServiceGetter(this, "gSysMsgr",
                                   "@mozilla.org/system-message-internal;1",
                                   "nsISystemMessagesInternal");

const DEBUG = false; // set to true to show debug messages

const kCAPTIVEPORTALDETECTOR_CONTRACTID = '@mozilla.org/toolkit/captive-detector;1';
const kCAPTIVEPORTALDETECTOR_CID        = Components.ID('{d9cd00ba-aa4d-47b1-8792-b1fe0cd35060}');

const kOpenCaptivePortalLoginEvent = 'captive-portal-login';
const kAbortCaptivePortalLoginEvent = 'captive-portal-login-abort';
const kCaptivePortalLoginSuccessEvent = 'captive-portal-login-success';
const kCaptivePortalCheckComplete = 'captive-portal-check-complete';

const kCaptivePortalSystemMessage = 'captive-portal';

function URLFetcher(url, timeout) {
  let self = this;
  let xhr = Cc['@mozilla.org/xmlextras/xmlhttprequest;1']
              .createInstance(Ci.nsIXMLHttpRequest);
  xhr.open('GET', url, true);
  // Prevent the request from reading from the cache.
  xhr.channel.loadFlags |= Ci.nsIRequest.LOAD_BYPASS_CACHE;
  // Prevent the request from writing to the cache.
  xhr.channel.loadFlags |= Ci.nsIRequest.INHIBIT_CACHING;
  // Prevent privacy leaks
  xhr.channel.loadFlags |= Ci.nsIRequest.LOAD_ANONYMOUS;
  // The Cache-Control header is only interpreted by proxies and the
  // final destination. It does not help if a resource is already
  // cached locally.
  xhr.setRequestHeader("Cache-Control", "no-cache");
  // HTTP/1.0 servers might not implement Cache-Control and
  // might only implement Pragma: no-cache
  xhr.setRequestHeader("Pragma", "no-cache");

  xhr.timeout = timeout;
  xhr.ontimeout = function () { self.ontimeout(); };
  xhr.onerror = function () { self.onerror(); };
  xhr.onreadystatechange = function(oEvent) {
    if (xhr.readyState === 4) {
      if (self._isAborted) {
        return;
      }
      if (xhr.status === 200) {
        self.onsuccess(xhr.responseText);
      } else if (xhr.status) {
        self.onredirectorerror(xhr.status);
      }
    }
  };
  xhr.send();
  this._xhr = xhr;
}

URLFetcher.prototype = {
  _isAborted: false,
  ontimeout: function() {},
  onerror: function() {},
  abort: function() {
    if (!this._isAborted) {
      this._isAborted = true;
      this._xhr.abort();
    }
  },
}

function LoginObserver(captivePortalDetector) {
  const LOGIN_OBSERVER_STATE_DETACHED = 0; /* Should not monitor network activity since no ongoing login procedure */
  const LOGIN_OBSERVER_STATE_IDLE = 1; /* No network activity currently, waiting for a longer enough idle period */
  const LOGIN_OBSERVER_STATE_BURST = 2; /* Network activity is detected, probably caused by a login procedure */
  const LOGIN_OBSERVER_STATE_VERIFY_NEEDED = 3; /* Verifing network accessiblity is required after a long enough idle */
  const LOGIN_OBSERVER_STATE_VERIFYING = 4; /* LoginObserver is probing if public network is available */

  let state = LOGIN_OBSERVER_STATE_DETACHED;

  let timer = Cc['@mozilla.org/timer;1'].createInstance(Ci.nsITimer);
  let activityDistributor = Cc['@mozilla.org/network/http-activity-distributor;1']
                              .getService(Ci.nsIHttpActivityDistributor);
  let urlFetcher = null;

  let waitForNetworkActivity = false;

  let pageCheckingDone = function pageCheckingDone() {
    if (state === LOGIN_OBSERVER_STATE_VERIFYING) {
      urlFetcher = null;
      // Finish polling the canonical site, switch back to idle state and
      // waiting for next burst
      state = LOGIN_OBSERVER_STATE_IDLE;
      timer.initWithCallback(observer,
                             captivePortalDetector._pollingTime,
                             timer.TYPE_ONE_SHOT);
    }
  };

  let checkPageContent = function checkPageContent() {
    debug("checking if public network is available after the login procedure");

    urlFetcher = new URLFetcher(captivePortalDetector._canonicalSiteURL,
                                captivePortalDetector._maxWaitingTime);
    urlFetcher.ontimeout = pageCheckingDone;
    urlFetcher.onerror = pageCheckingDone;
    urlFetcher.onsuccess = function (content) {
      if (captivePortalDetector.validateContent(content)) {
        urlFetcher = null;
        captivePortalDetector.executeCallback(true);
      } else {
        pageCheckingDone();
      }
    };
    urlFetcher.onredirectorerror = pageCheckingDone;
  };

  // Public interface of LoginObserver
  let observer = {
    QueryInterface: XPCOMUtils.generateQI([Ci.nsIHttpActivityObserver,
                                           Ci.nsITimerCallback]),

    attach: function attach() {
      if (state === LOGIN_OBSERVER_STATE_DETACHED) {
        activityDistributor.addObserver(this);
        state = LOGIN_OBSERVER_STATE_IDLE;
        timer.initWithCallback(this,
                               captivePortalDetector._pollingTime,
                               timer.TYPE_ONE_SHOT);
        debug('attach HttpObserver for login activity');
      }
    },

    detach: function detach() {
      if (state !== LOGIN_OBSERVER_STATE_DETACHED) {
        if (urlFetcher) {
          urlFetcher.abort();
          urlFetcher = null;
        }
        activityDistributor.removeObserver(this);
        timer.cancel();
        state = LOGIN_OBSERVER_STATE_DETACHED;
        debug('detach HttpObserver for login activity');
      }
    },

    /*
     * Treat all HTTP transactions as captive portal login activities.
     */
    observeActivity: function observeActivity(aHttpChannel, aActivityType,
                                              aActivitySubtype, aTimestamp,
                                              aExtraSizeData, aExtraStringData) {
      if (aActivityType === Ci.nsIHttpActivityObserver.ACTIVITY_TYPE_HTTP_TRANSACTION
          && aActivitySubtype === Ci.nsIHttpActivityObserver.ACTIVITY_SUBTYPE_RESPONSE_COMPLETE) {
        switch (state) {
          case LOGIN_OBSERVER_STATE_IDLE:
          case LOGIN_OBSERVER_STATE_VERIFY_NEEDED:
            state = LOGIN_OBSERVER_STATE_BURST;
            break;
          default:
            break;
        }
      }
    },

    /*
     * Check if login activity is finished according to HTTP burst.
     */
    notify : function notify() {
      switch (state) {
        case LOGIN_OBSERVER_STATE_BURST:
          // Wait while network stays idle for a short period
          state = LOGIN_OBSERVER_STATE_VERIFY_NEEDED;
          // Fall though to start polling timer
        case LOGIN_OBSERVER_STATE_IDLE:
          if (waitForNetworkActivity) {
            timer.initWithCallback(this,
                                   captivePortalDetector._pollingTime,
                                   timer.TYPE_ONE_SHOT);
            break;
          }
          // if we don't need to wait for network activity, just fall through
          // to perform a captive portal check.
        case LOGIN_OBSERVER_STATE_VERIFY_NEEDED:
          // Polling the canonical website since network stays idle for a while
          state = LOGIN_OBSERVER_STATE_VERIFYING;
          checkPageContent();
          break;

        default:
          break;
      }
    },
  };

  return observer;
}

function CaptivePortalDetector() {
  // Load preference
  this._canonicalSiteURL = null;
  this._canonicalSiteExpectedContent = null;

  try {
    this._canonicalSiteURL =
      Services.prefs.getCharPref('captivedetect.canonicalURL');
    this._canonicalSiteExpectedContent =
      Services.prefs.getCharPref('captivedetect.canonicalContent');
  } catch (e) {
    debug('canonicalURL or canonicalContent not set.')
  }

  this._maxWaitingTime =
    Services.prefs.getIntPref('captivedetect.maxWaitingTime');
  this._pollingTime =
    Services.prefs.getIntPref('captivedetect.pollingTime');
  this._maxRetryCount =
    Services.prefs.getIntPref('captivedetect.maxRetryCount');
  debug('Load Prefs {site=' + this._canonicalSiteURL + ',content='
        + this._canonicalSiteExpectedContent + ',time=' + this._maxWaitingTime
        + "max-retry=" + this._maxRetryCount + '}');

  // Create HttpObserver for monitoring the login procedure
  this._loginObserver = LoginObserver(this);

  this._nextRequestId = 0;
  this._runningRequest = null;
  this._requestQueue = []; // Maintain a progress table, store callbacks and the ongoing XHR
  this._interfaceNames = {}; // Maintain names of the requested network interfaces

  debug('CaptiveProtalDetector initiated, waiting for network connection established');
}

CaptivePortalDetector.prototype = {
  classID:   kCAPTIVEPORTALDETECTOR_CID,
  classInfo: XPCOMUtils.generateCI({classID: kCAPTIVEPORTALDETECTOR_CID,
                                    contractID: kCAPTIVEPORTALDETECTOR_CONTRACTID,
                                    classDescription: 'Captive Portal Detector',
                                    interfaces: [Ci.nsICaptivePortalDetector]}),
  QueryInterface: XPCOMUtils.generateQI([Ci.nsICaptivePortalDetector]),

  // nsICaptivePortalDetector
  checkCaptivePortal: function checkCaptivePortal(aInterfaceName, aCallback) {
    if (!this._canonicalSiteURL) {
      throw Components.Exception('No canonical URL set up.');
    }

    // Prevent multiple requests on a single network interface
    if (this._interfaceNames[aInterfaceName]) {
      throw Components.Exception('Do not allow multiple request on one interface: ' + aInterfaceName);
    }

    let request = {interfaceName: aInterfaceName};
    if (aCallback) {
      let callback = aCallback.QueryInterface(Ci.nsICaptivePortalCallback);
      request['callback'] = callback;
      request['retryCount'] = 0;
    }
    this._addRequest(request);
  },

  abort: function abort(aInterfaceName) {
    debug('abort for ' + aInterfaceName);
    this._removeRequest(aInterfaceName);
  },

  finishPreparation: function finishPreparation(aInterfaceName) {
    debug('finish preparation phase for interface "' + aInterfaceName + '"');
    if (!this._runningRequest
        || this._runningRequest.interfaceName !== aInterfaceName) {
      debug('invalid finishPreparation for ' + aInterfaceName);
      throw Components.Exception('only first request is allowed to invoke |finishPreparation|');
    }

    this._startDetection();
  },

  cancelLogin: function cancelLogin(eventId) {
    debug('login canceled by user for request "' + eventId + '"');
    // Captive portal login procedure is canceled by user
    if (this._runningRequest && this._runningRequest.hasOwnProperty('eventId')) {
      let id = this._runningRequest.eventId;
      if (eventId === id) {
        this.executeCallback(false);
      }
    }
  },

  _applyDetection: function _applyDetection() {
    debug('enter applyDetection('+ this._runningRequest.interfaceName + ')');

    // Execute network interface preparation
    if (this._runningRequest.hasOwnProperty('callback')) {
      this._runningRequest.callback.prepare();
    } else {
      this._startDetection();
    }
  },

  _startDetection: function _startDetection() {
    debug('startDetection {site=' + this._canonicalSiteURL + ',content='
          + this._canonicalSiteExpectedContent + ',time=' + this._maxWaitingTime + '}');
    let self = this;

    let urlFetcher = new URLFetcher(this._canonicalSiteURL, this._maxWaitingTime);

    let mayRetry = this._mayRetry.bind(this);

    urlFetcher.ontimeout = mayRetry;
    urlFetcher.onerror = mayRetry;
    urlFetcher.onsuccess = function (content) {
      if (self.validateContent(content)) {
        self.executeCallback(true);
      } else {
        // Content of the canonical website has been overwrite
        self._startLogin();
      }
    };
    urlFetcher.onredirectorerror = function (status) {
      if (status >= 300 && status <= 399) {
        // The canonical website has been redirected to an unknown location
        self._startLogin();
      } else {
        mayRetry();
      }
    };

    this._runningRequest['urlFetcher'] = urlFetcher;
  },

  _startLogin: function _startLogin() {
    let id = this._allocateRequestId();
    let details = {
      type: kOpenCaptivePortalLoginEvent,
      id: id,
      url: this._canonicalSiteURL,
    };
    this._loginObserver.attach();
    this._runningRequest['eventId'] = id;
    this._sendEvent(kOpenCaptivePortalLoginEvent, details);
    gSysMsgr.broadcastMessage(kCaptivePortalSystemMessage, {});
  },

  _mayRetry: function _mayRetry() {
    if (this._runningRequest.retryCount++ < this._maxRetryCount) {
      debug('retry-Detection: ' + this._runningRequest.retryCount + '/' + this._maxRetryCount);
      this._startDetection();
    } else {
      this.executeCallback(false);
    }
  },

  executeCallback: function executeCallback(success) {
    if (this._runningRequest) {
      debug('callback executed');
      if (this._runningRequest.hasOwnProperty('callback')) {
        this._runningRequest.callback.complete(success);
      }

      // Only when the request has a event id and |success| is true
      // do we need to notify the login-success event.
      if (this._runningRequest.hasOwnProperty('eventId') && success) {
        let details = {
          type: kCaptivePortalLoginSuccessEvent,
          id: this._runningRequest['eventId'],
        };
        this._sendEvent(kCaptivePortalLoginSuccessEvent, details);
      }

      // Continue the following request
      this._runningRequest['complete'] = true;
      this._removeRequest(this._runningRequest.interfaceName);
    }
  },

  _sendEvent: function _sendEvent(topic, details) {
    debug('sendEvent "' + JSON.stringify(details) + '"');
    Services.obs.notifyObservers(this,
                                 topic,
                                 JSON.stringify(details));
  },

  validateContent: function validateContent(content) {
    debug('received content: ' + content);
    let valid = content === this._canonicalSiteExpectedContent;
    // We need a way to indicate that a check has been performed, and if we are
    // still in a captive portal.
    this._sendEvent(kCaptivePortalCheckComplete, !valid);
    return valid;
  },

  _allocateRequestId: function _allocateRequestId() {
    let newId = this._nextRequestId++;
    return newId.toString();
  },

  _runNextRequest: function _runNextRequest() {
    let nextRequest = this._requestQueue.shift();
    if (nextRequest) {
      this._runningRequest = nextRequest;
      this._applyDetection();
    }
  },

  _addRequest: function _addRequest(request) {
    this._interfaceNames[request.interfaceName] = true;
    this._requestQueue.push(request);
    if (!this._runningRequest) {
      this._runNextRequest();
    }
  },

  _removeRequest: function _removeRequest(aInterfaceName) {
    if (!this._interfaceNames[aInterfaceName]) {
      return;
    }

    delete this._interfaceNames[aInterfaceName];

    if (this._runningRequest
        && this._runningRequest.interfaceName === aInterfaceName) {
      this._loginObserver.detach();

      if (!this._runningRequest.complete) {
        // Abort the user login procedure
        if (this._runningRequest.hasOwnProperty('eventId')) {
          let details = {
            type: kAbortCaptivePortalLoginEvent,
            id: this._runningRequest.eventId
          };
          this._sendEvent(kAbortCaptivePortalLoginEvent, details);
        }

        // Abort the ongoing HTTP request
        if (this._runningRequest.hasOwnProperty('urlFetcher')) {
          this._runningRequest.urlFetcher.abort();
        }
      }

      debug('remove running request');
      this._runningRequest = null;

      // Continue next pending reqeust if the ongoing one has been aborted
      this._runNextRequest();
      return;
    }

    // Check if a pending request has been aborted
    for (let i = 0; i < this._requestQueue.length; i++) {
      if (this._requestQueue[i].interfaceName == aInterfaceName) {
        this._requestQueue.splice(i, 1);

        debug('remove pending request #' + i + ', remaining ' + this._requestQueue.length);
        break;
      }
    }
  },
};

var debug;
if (DEBUG) {
  debug = function (s) {
    dump('-*- CaptivePortalDetector component: ' + s + '\n');
  };
} else {
  debug = function (s) {};
}

this.NSGetFactory = XPCOMUtils.generateNSGetFactory([CaptivePortalDetector]);


/* Copyright (c) 2000-2005, 2007 MySQL AB, 2009 Sun Microsystems, Inc.
   Use is subject to license terms.

   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; version 2 of the License.

   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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */

/* Written by Sergei A. Golubchik, who has a shared copyright to this code */

/* some definitions for full-text indices */

/* #include "myisam.h" */

#ifndef _ft_global_h
#define _ft_global_h
#ifdef  __cplusplus
extern "C" {
#endif

#include <my_compare.h>

#define HA_FT_MAXBYTELEN 254
#define HA_FT_MAXCHARLEN (HA_FT_MAXBYTELEN/3)

#define DEFAULT_FTB_SYNTAX "+ -><()~*:\"\"&|"

typedef struct st_ft_info FT_INFO;
struct _ft_vft
{
  int       (*read_next)(FT_INFO *, char *);
  float     (*find_relevance)(FT_INFO *, uchar *, uint);
  void      (*close_search)(FT_INFO *);
  float     (*get_relevance)(FT_INFO *);
  void      (*reinit_search)(FT_INFO *);
};

#ifndef FT_CORE
struct st_ft_info
{
  struct _ft_vft *please; /* INTERCAL style :-) */
};
#endif

extern const char *ft_stopword_file;
extern const char *ft_precompiled_stopwords[];

extern ulong ft_min_word_len;
extern ulong ft_max_word_len;
extern ulong ft_query_expansion_limit;
extern const char *ft_boolean_syntax;
extern struct st_mysql_ftparser ft_default_parser;

int ft_init_stopwords(void);
void ft_free_stopwords(void);

#define FT_NL     0
#define FT_BOOL   1
#define FT_SORTED 2
#define FT_EXPAND 4   /* query expansion */

FT_INFO *ft_init_search(uint,void *, uint, uchar *, size_t,
                        CHARSET_INFO *, uchar *);
my_bool ft_boolean_check_syntax_string(const uchar *);

/* Internal symbols for fulltext between maria and MyISAM */

#define HA_FT_WTYPE  HA_KEYTYPE_FLOAT
#define HA_FT_WLEN   4
#define FT_SEGS      2

#define ft_sintXkorr(A)    mi_sint4korr(A)
#define ft_intXstore(T,A)  mi_int4store(T,A)

extern const HA_KEYSEG ft_keysegs[FT_SEGS];

typedef union {int32 i; float f;} FT_WEIGTH;

#ifdef  __cplusplus
}
#endif
#endif


from sofi.ui import Address

def test_basic():
    assert(str(Address()) == "<address></address>")

def test_text():
    assert(str(Address("text")) == "<address>text</address>")

def test_custom_class_ident_style_and_attrs():
    assert(str(Address("text", cl='abclass', ident='123', style="font-size:0.9em;", attrs={"data-test": 'abc'}))
           == "<address id=\"123\" class=\"abclass\" style=\"font-size:0.9em;\" data-test=\"abc\">text</address>")


<assembly>
  <id>full</id>
  <formats>
    <format>jar</format>
  </formats>
  <includeBaseDirectory>false</includeBaseDirectory>
  <dependencySets>
    <dependencySet>
      <includes>
        <include>*:*:jar</include>
      </includes>
      <outputDirectory>/</outputDirectory>
      <useProjectArtifact>true</useProjectArtifact>
      <unpack>true</unpack>
      <scope>runtime</scope>
    </dependencySet>
    <dependencySet>
      <outputDirectory>lib/native</outputDirectory>
      <outputFileNameMapping>${artifact.artifactId}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
      <unpack>false</unpack>
      <useProjectArtifact>false</useProjectArtifact>
      <useStrictFiltering>false</useStrictFiltering>
      <includes>
        <include>*:*:dll:*</include>
        <include>*:*:so:*</include>
        <include>*:*:jnilib:*</include>
      </includes>
    </dependencySet>
  </dependencySets>
</assembly>


# Ceres Solver - A fast non-linear least squares minimizer
# Copyright 2017 Google Inc. All rights reserved.
# http://ceres-solver.org/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
#   this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
#   this list of conditions and the following disclaimer in the documentation
#   and/or other materials provided with the distribution.
# * Neither the name of Google Inc. nor the names of its contributors may be
#   used to endorse or promote products derived from this software without
#   specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# Author: sameeragarwal@google.com (Sameer Agarwal)
#
# Script for explicitly generating template specialization of the
# SchurEliminator class. It is a rather large class
# and the number of explicit instantiations is also large. Explicitly
# generating these instantiations in separate .cc files breaks the
# compilation into separate compilation unit rather than one large cc
# file which takes 2+GB of RAM to compile.
#
# This script creates two sets of files.
#
# 1. schur_eliminator_x_x_x.cc
# where, the x indicates the template parameters and
#
# 2. schur_eliminator.cc
#
# that contains a factory function for instantiating these classes
# based on runtime parameters.
#
# The list of tuples, specializations indicates the set of
# specializations that is generated.

# Set of template specializations to generate

HEADER = """// Ceres Solver - A fast non-linear least squares minimizer
// Copyright 2017 Google Inc. All rights reserved.
// http://ceres-solver.org/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
//   this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
//   this list of conditions and the following disclaimer in the documentation
//   and/or other materials provided with the distribution.
// * Neither the name of Google Inc. nor the names of its contributors may be
//   used to endorse or promote products derived from this software without
//   specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// Author: sameeragarwal@google.com (Sameer Agarwal)
//
// Template specialization of SchurEliminator.
//
// ========================================
// THIS FILE IS AUTOGENERATED. DO NOT EDIT.
// THIS FILE IS AUTOGENERATED. DO NOT EDIT.
// THIS FILE IS AUTOGENERATED. DO NOT EDIT.
// THIS FILE IS AUTOGENERATED. DO NOT EDIT.
//=========================================
//
// This file is generated using generate_template_specializations.py.
"""

DYNAMIC_FILE = """

#include "ceres/schur_eliminator_impl.h"
#include "ceres/internal/eigen.h"

namespace ceres {
namespace internal {

template class SchurEliminator<%s, %s, %s>;

}  // namespace internal
}  // namespace ceres
"""

SPECIALIZATION_FILE = """
// This include must come before any #ifndef check on Ceres compile options.
#include "ceres/internal/port.h"

#ifndef CERES_RESTRICT_SCHUR_SPECIALIZATION

#include "ceres/schur_eliminator_impl.h"
#include "ceres/internal/eigen.h"

namespace ceres {
namespace internal {

template class SchurEliminator<%s, %s, %s>;

}  // namespace internal
}  // namespace ceres

#endif  // CERES_RESTRICT_SCHUR_SPECIALIZATION
"""

FACTORY_FILE_HEADER = """
#include "ceres/linear_solver.h"
#include "ceres/schur_eliminator.h"
#include "ceres/internal/eigen.h"

namespace ceres {
namespace internal {

SchurEliminatorBase*
SchurEliminatorBase::Create(const LinearSolver::Options& options) {
#ifndef CERES_RESTRICT_SCHUR_SPECIALIZATION
"""

FACTORY = """ return new SchurEliminator<%s, %s, %s>(options);"""

FACTORY_FOOTER = """
#endif
  VLOG(1) << "Template specializations not found for <"
          << options.row_block_size << ","
          << options.e_block_size << ","
          << options.f_block_size << ">";
  return new SchurEliminator<Eigen::Dynamic, Eigen::Dynamic, Eigen::Dynamic>(options);
}

}  // namespace internal
}  // namespace ceres
"""


<?xml version="1.0" encoding="UTF-8"?>
<!--
/* //device/apps/common/assets/res/any/strings.xml
**
** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
**     http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
 -->

<resources xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
    <string name="mmcc_imsi_unknown_in_hlr" msgid="656054059094417927">"I-SIM ayinikezelwe MM#2"</string>
    <string name="mmcc_illegal_ms" msgid="1782569305985001089">"I-SIM ayivunyelwe MM#3"</string>
    <string name="mmcc_illegal_me" msgid="8246632898824321280">"Ifoni ayivunyelwe MM#6"</string>
</resources>


# -*- mode: snippet -*-
# name: macro
# key: macro
# uuid: macro
# --
!macro ${1:Name} UN
$0

!macroend


* Level 1
  * Level 2
    * Level 3
* Level 1
  * Level 1
  *
    *

          Test