text:
<?php

namespace Application\Model;

class Transaction
{
	protected $id;
	protected $advertisementId;
	protected $advertisementName;
	protected $advertiserName;
	protected $transactionStatusId;
	protected $firstName;
	protected $lastName;
	protected $emailAddress;
	protected $telephone;
	protected $address1;
	protected $address2;
	protected $city;
	protected $state;
	protected $country;
	protected $postal;
	protected $cardFirstFour;
	protected $cardLastFour;
	protected $cardExpMonth;
	protected $cardExpYear;
	protected $processor;
	protected $amount;
	protected $paymentId;
	protected $status;
	protected $memo;
	protected $ipAddress;
	protected $createDateTime;
	protected $advertiserId;

	public function id($id=0)
	{
		if(!empty($id)){
			$this->id = $id;
		} // if
		return $this->id;
	}

	public function advertisementId($advertisementid=0)
	{
		if(!empty($advertisementid)){
			$this->advertisementId = $advertisementid;
		} // if
		return $this->advertisementId;
	}

	public function advertisementName()
	{
		return $this->advertisementName;
	}

	public function advertiserName()
	{
		return $this->advertiserName;
	}

	public function transactionStatusId($transactionstatusid=0)
	{
		if(!empty($transactionstatusid)){
			$this->transactionStatusId = $transactionstatusid;
		} // if
		return $this->transactionStatusId;
	}

	public function firstName($firstname='')
	{
		if(!empty($firstname)){
			$this->firstName = $firstname;
		} // if
		return $this->firstName;
	}

	public function lastName($lastname='')
	{
		if(!empty($lastname)){
			$this->lastName = $lastname;
		} // if
		return $this->lastName;
	}

	public function emailAddress($emailaddress='')
	{
		if(!empty($emailaddress)){
			$this->emailAddress = $emailaddress;
		} // if
		return $this->emailAddress;
	}

	public function telephone($telephone='')
	{
		if(!empty($telephone)){
			$this->telephone = $telephone;
		} // if
		return $this->telephone;
	}

	public function address1($address1='')
	{
		if(!empty($address1)){
			$this->address1 = $address1;
		} // if
		return $this->address1;
	}

	public function address2($address2='')
	{
		if(!empty($address2)){
			$this->address2 = $address2;
		} // if
		return $this->address2;
	}

	public function city($city='')
	{
		if(!empty($city)){
			$this->city = $city;
		} // if
		return $this->city;
	}

	public function state($state='')
	{
		if(!empty($state)){
			$this->state = $state;
		} // if
		return $this->state;
	}

	public function country($country='')
	{
		if(!empty($country)){
			$this->country = $country;
		} // if
		return $this->country;
	}

	public function postal($postal='')
	{
		if(!empty($postal)){
			$this->postal = $postal;
		} // if
		return $this->postal;
	}

	public function cardFirstFour($cardfirstfour='')
	{
		if(!empty($cardfirstfour)){
			$this->cardFirstFour = $cardfirstfour;
		} // if
		return $this->cardFirstFour;
	}

	public function cardLastFour($cardlastfour='')
	{
		if(!empty($cardlastfour)){
			 $this->cardLastFour = $cardlastfour;
		} // if
		return $this->cardLastFour;
	}

	public function cardExpMonth($cardexpmonth='')
	{
		if(!empty($cardexpmonth)){
			$this->cardExpMonth = $cardexpmonth;
		} // if
		return $this->cardExpMonth;
	}

	public function cardExpYear($cardexpyear='')
	{
		if(!empty($cardexpyear)){
			$this->cardExpYear = $cardexpyear;
		} // if
		return $this->cardExpYear;
	}

	public function processor($processor='')
	{
		if(!empty($processor)){
			$this->processor = $processor;
		} // if
		return $this->processor;
	}

	public function amount($amount=null)
	{
		if(!empty($amount)){
			$this->amount = $amount;
		} // if
		return $this->amount;
 	}

 	public function paymentId($paymentid='')
 	{
 		if(!empty($paymentid)){
 			$this->paymentId = $paymentid;
 		} // if
 		return $this->paymentId;
 	}

 	public function status($status='')
 	{
 		if(!empty($status)){
 			$this->status = $status;
 		} // if
 		return $this->status;
 	}

 	public function memo($memo='')
 	{
 		if(!empty($memo)){
 			$this->memo = $memo;
 		} // if
 		return $this->memo;
 	}

 	public function ipAddress($ipaddress='')
 	{
 		if(!empty($ipaddress)){
 			$this->ipAddress = $ipaddress;
 		} // if
 		return $this->ipAddress;
 	}

 	public function createDateTime($createdatetime='')
 	{
 		if(!empty($createdatetime)){
 			$this->createDateTime = $createdatetime;
 		} // if
 		return $this->createDateTime;
 	}

 	public function advertiserId()
 	{
 		return $this->advertiserId;
 	}

	public function __construct()
	{

	}

	public function exchangeArray($data)
	{
		$this->id = (isset($data['id'])) ? $data['id'] : $this->id;
		$this->advertisementId = (isset($data['advertisementid'])) ? $data['advertisementid'] : $this->advertisementId;
		$this->advertisementName = (isset($data['advertisementname'])) ? $data['advertisementname'] : "";
		$this->advertiserName = (isset($data['advertiserfirstname']) && isset($data['advertiserlastname'])) ?
			($data['advertiserfirstname'] . ' ' . $data['advertiserlastname']) : '';
		$this->transactionStatusId = (isset($data['transactionstatusid'])) ? $data['transactionstatusid'] : $this->transactionStatusId;
		$this->firstName = (isset($data['firstname'])) ? $data['firstname'] : $this->firstName;
		$this->lastName = (isset($data['lastname'])) ? $data['lastname'] : $this->lastName;
		$this->address1 = (isset($data['address1'])) ? $data['address1'] : $this->address1;
		$this->address2 = (isset($data['address2'])) ? $data['address2'] : $this->address2;
		$this->city = (isset($data['city'])) ? $data['city'] : $this->city;
		$this->state = (isset($data['state'])) ? $data['state'] : $this->state;
		$this->country = (isset($data['country'])) ? $data['country'] : $this->country;
		$this->postal = (isset($data['postal'])) ? $data['postal'] : $this->postal;
		$this->cardFirstFour = (isset($data['cardfirstfour'])) ? $data['cardfirstfour'] : $this->cardFirstFour;
		$this->cardLastFour = (isset($data['cardlastfour'])) ? $data['cardlastfour'] : $this->cardLastFour;
		$this->cardExpMonth = (isset($data['cardexpmonth'])) ? $data['cardexpmonth'] : $this->cardExpMonth;
		$this->cardExpYear = (isset($data['cardexpyear'])) ? $data['cardexpyear'] : $this->cardExpYear;
		$this->processor = (isset($data['processor'])) ? $data['processor'] : $this->processor;
		$this->amount = (isset($data['amount'])) ? $data['amount'] : $this->amount;
		$this->paymentId = (isset($data['paymentid'])) ? $data['paymentid'] : $this->paymentId;
		$this->status = (isset($data['status'])) ? $data['status'] : $this->status;
		$this->memo = (isset($data['memo'])) ? $data['memo'] : $this->memo;
		$this->createDateTime = (isset($data['createdatetime'])) ? $data['createdatetime'] : $this->createDateTime;
		$this->emailAddress = (isset($data['emailaddress'])) ? $data['emailaddress'] : $this->emailAddress;
		$this->telephone = (isset($data['telephone'])) ? $data['telephone'] : $this->telephone;
		$this->ipAddress = (isset($data['ipaddress'])) ? $data['ipaddress'] : $this->ipAddress;
		$this->advertiserId = (isset($data['advertiserid'])) ? $data['advertiserid'] : $this->advertiserId;
 	} // exchangeArray

	public function getArrayCopy()
	{
		return array(
			'id' => $this->id,
			'advertisementid' => $this->advertisementId,
			'advertisementname' => $this->advertisementName,
			'advertisername' => $this->advertiserName,
			'transactionstatusid' => $this->transactionStatusId,
			'firstname' => $this->firstName,
			'lastname' => $this->lastName,
			'address1' => $this->address1,
			'address2' => $this->address2,
			'city' => $this->city,
			'state' => $this->state,
			'country' => $this->country,
			'postal' => $this->postal,
			'cardfirstfour' => $this->cardFirstFour,
			'cardlastfour' => $this->cardLastFour,
			'cardexpmonth' => $this->cardExpMonth,
			'cardexpyear' => $this->cardExpYear,
			'processor' => $this->processor,
			'amount' => $this->amount,
			'paymentid' => $this->paymentId,
			'status' => $this->status,
			'memo' => $this->memo,
			'emailaddress' => $this->emailAddress,
			'telephone' => $this->telephone,
			'createdatetime' => $this->createDateTime,
			'ipaddress' => $this->ipAddress,
			'advertiserid' => $this->advertiserId
		);
	} // getArrayCopy
}


text:
<!doctype html>
<title>Cache Storage: verify cache_storage padding behavior</title>
<link rel="help" href="https://w3c.github.io/ServiceWorker/#cache-interface">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="/service-workers/service-worker/resources/test-helpers.sub.js"></script>
<script>
'use strict';

const tmp_url = new URL('resources/simple.js', self.location);
tmp_url.hostname = get_host_info().REMOTE_HOST;
const TARGET_URL = tmp_url.href;

async function usage(init) {
  const cache = await caches.open('padding');
  if (!init.mode)
    init.mode = 'no-cors';
  let r = await fetch(TARGET_URL, init);
  if (init.mode == 'no-cors')
    assert_equals(r.type, 'opaque');
  const clone = r.clone();
  // Note, this stores the response under a Request key that has a different
  // url than what we fetched above.  This is purposeful to ensure
  // that we are varying on how the Response was loaded and not on the Request
  // key.
  const cache_url = '/foo';
  await cache.put(cache_url, r);
  const usage1 = (await navigator.storage.estimate()).usageDetails.caches;
  await cache.delete(cache_url);

  await cache.put(cache_url, clone);
  const usage2 = (await navigator.storage.estimate()).usageDetails.caches;
  await cache.delete(cache_url);

  assert_equals(usage1, usage2, 'cloned response have the same padding size');
  return usage1;
}

promise_test(async t => {
  const usage1 = await usage({ cache: 'reload' });
  const usage2 = await usage({ cache: 'reload' });
  assert_not_equals(usage1, usage2,
                    'Responses loaded from network should have different ' +
                    'padding size.');
}, 'Cache padding varies if loaded from network.');

promise_test(async t => {
  // populate http cache
  await usage({ cache: 'reload' });

  const cache_usage1 = await usage({ cache: 'force-cache' });
  const cache_usage2 = await usage({ cache: 'force-cache' });

  assert_equals(cache_usage1, cache_usage2,
                'Responses loaded from http cache should have the same ' +
                'padding size.');

  // repopulate http cache
  await usage({ cache: 'reload' });

  const cache_usage3 = await usage({ cache: 'force-cache' });
  const cache_usage4 = await usage({ cache: 'force-cache' });

  assert_not_equals(cache_usage1, cache_usage3,
                    'An updated http cache entry should result in a ' +
                    'different padding size.');
  assert_equals(cache_usage3, cache_usage4,
                'Responses loaded from http cache should have the same ' +
                'padding size.');
}, 'Cache padding is stable if loaded from http cache.');

promise_test(async t => {
  // Determine the actual size difference between GET and HEAD requests.
  const cors_get_usage = await usage({ mode: 'cors', method: 'GET' });
  const cors_head_usage = await usage({ mode: 'cors', method: 'HEAD' });
  const cors_diff = cors_get_usage - cors_head_usage;

  const net_get_usage = await usage({ method: 'GET', cache: 'reload' });
  const net_head_usage = await usage({ method: 'HEAD', cache: 'reload' });
  const opaque_net_diff = net_get_usage - net_head_usage;

  assert_not_equals(net_get_usage, net_head_usage,
                    'Responses loaded from network with different methods ' +
                    'should have different padding size.');
  assert_not_equals(opaque_net_diff, cors_diff,
                    'Responses loaded from network with different methods ' +
                    'should have usages that differ more than actual ' +
                    'response size.');

  // populate http cache
  await usage({ cache: 'reload' });

  const cache_get_usage = await usage({ method: 'GET', cache: 'force-cache' });
  const cache_head_usage = await usage({ method: 'HEAD', cache: 'force-cache' });
  const opaque_cache_diff = cache_get_usage - cache_head_usage;

  assert_not_equals(cache_get_usage, cache_head_usage,
                    'Responses loaded from http cache with different methods ' +
                    'should have the different padding size.');
  assert_not_equals(opaque_cache_diff, cors_diff,
                    'Responses loaded from http cache with different methods ' +
                    'should have usages that differ more than actual ' +
                    'response size.');
}, 'Cache padding varies with request method.');

promise_test(async t => {
  const cache1 = await caches.open('padding');
  const cache2 = await caches.open('padding-2');

  const net_response = await fetch(TARGET_URL, { mode: 'no-cors',
                                                 cache: 'reload' });
  await cache1.put(TARGET_URL, net_response);
  const usage1 = (await navigator.storage.estimate()).usageDetails.caches;

  const cache_response = await cache1.match(TARGET_URL);
  await cache2.put(TARGET_URL, cache_response);
  await cache1.delete(TARGET_URL);
  const usage2 = (await navigator.storage.estimate()).usageDetails.caches;
  await cache2.delete(TARGET_URL);

  assert_equals(usage1, usage2,
                'The padding value should follow a response loaded from ' +
                'cache_storage.');

}, 'Cache padding follows a response loaded from cache_storage.');

promise_test(async t => {
  const script = './resources/padding-fetch-sw.js';
  const scope = './resources/padding-fetch-frame.html';

  // Setup a service worker.
  const reg = await service_worker_unregister_and_register(t, script, scope);
  t.add_cleanup(() => reg.unregister());
  await wait_for_state(t, reg.installing, 'activated');

  // Setup an iframe controlled by the service worker.
  const frame = await with_iframe(scope);
  t.add_cleanup(() => frame.remove());

  // The service worker will send a padded usage value via postMessage.
  // Prepare to receive this message.
  const message_promise = new Promise(resolve => {
    frame.contentWindow.navigator.serviceWorker.addEventListener('message',
        evt => {
          if (!('usage' in evt.data))
            return;
          resolve(evt.data.usage);
        });
  });

  // Fetch an opaque response from the network.  This will hit the
  // service worker fetch handler which will compute a padded usage
  // value before allowing this outer fetch to resolve.  The SW
  // usage value is sent via an out-of-band postMessage.
  const request = new Request(TARGET_URL, { mode: 'no-cors',
                                            cache: 'reload' });
  const net_response = await frame.contentWindow.fetch(request);

  // Compute a padded usage value based on the response returned from our
  // outer fetch.
  const cache = await caches.open('padding');
  // Make sure to use the URL and not the full request.  The main window
  // and service worker requests may have different headers which can
  // throw off the size comparison.
  await cache.put(request.url, net_response);
  const usage = (await navigator.storage.estimate()).usageDetails.caches;
  await cache.delete(request.url);

  // Compare our usage against the service worker usage.  They should be the
  // same.  While a random padding is generated when a response is loaded
  // over the network, that padding will be propagated through the service
  // worker boundary to the outer fetch.
  const sw_usage = await message_promise;
  assert_equals(usage, sw_usage,
                'The padding should propogate through the service worker ' +
                'respondWith().');

}, 'Cache padding propagates through a service worker respondWith().');

promise_test(async t => {
  const script = './resources/padding-install-sw.js';
  const scope = './resources/padding-install-frame.html';

  // populate http cache
  await usage({ cache: 'reload' });

  // Get usage for a response stored on the main thread.  This will
  // not include any code cache.
  const main_window_usage = await usage({ cache: 'force-cache' });

  // A utility function for creating a promise that waits for a message
  // from the service worker sending usage information.
  function make_message_promise() {
    return new Promise(resolve => {
      navigator.serviceWorker.addEventListener('message',
          function onMessage(evt) {
            if (!('usage' in evt.data))
              return;
            navigator.serviceWorker.removeEventListener('message', onMessage);
            resolve(evt.data.usage);
          });
    });
  }

  // Prepare to get a usage value from the service worker.
  const message_promise_1 = make_message_promise();

  // Register a service worker that stores and computes usage in its install
  // event.  This will result in code cache being stored as side data.
  const reg_1 = await service_worker_unregister_and_register(t, script, scope);
  t.add_cleanup(() => reg_1.unregister());
  await wait_for_state(t, reg_1.installing, 'activated');

  // Wait for the service worker usage including code cache.
  const sw_usage_1 = await message_promise_1;

  assert_true(sw_usage_1 > main_window_usage,
              'Usage with code cache should always be greater than ' +
              'main_window_usage.');

  // Prepare to get another usage value from a service worker.
  const message_promise_2 = make_message_promise();

  // Register a second service worker to get another usage with code cache.
  const reg_2 = await service_worker_unregister_and_register(t, script, scope + '-2');
  t.add_cleanup(() => reg_2.unregister());
  await wait_for_state(t, reg_2.installing, 'activated');

  // The usage with code cache should be stable.
  const sw_usage_2 = await message_promise_2;
  assert_equals(sw_usage_1, sw_usage_2,
                'Usage with code cache should be stable for a response ' +
                'loaded from http cache.');
}, 'Code cache padding should be stable.');

</script>

redpajama_set_name: RedPajamaGithub


text:
package com.eventos.model;

import java.util.Date;

/**
 * Clase utilizada para transmitir los resultados a la vista
 * Trabajo Fin de Master para el Master en Visual Analytics y Big Data
 * de la Universidad Internacional de la Rioja
 * @author jesus.aviles
 *
 */
public class UserResult {

	private String userId;

	private String name;

	private String location;

	private String relationshipStatus;

	private Date lastUpdatedDate;

	private String KeywordsCultura;

	private String KeywordsDeporte;

	private String KeywordsComida;

	private String KeywordsCaridad;

	private String KeywordsViajar;

	private String KeywordsSocial;

	private String KeywordsSalud;

	public UserResult(){
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getLocation() {
		return location;
	}

	public void setLocation(String location) {
		this.location = location;
	}

	public String getRelationshipStatus() {
		return relationshipStatus;
	}

	public void setRelationshipStatus(String relationshipStatus) {
		this.relationshipStatus = relationshipStatus;
	}

	public Date getLastUpdatedDate() {
		return lastUpdatedDate;
	}

	public void setLastUpdatedDate(Date lastUpdatedDate) {
		this.lastUpdatedDate = lastUpdatedDate;
	}

	public String getKeywordsCultura() {
		return KeywordsCultura;
	}

	public void setKeywordsCultura(String keywordsCultura) {
		KeywordsCultura = keywordsCultura;
	}

	public String getKeywordsDeporte() {
		return KeywordsDeporte;
	}

	public void setKeywordsDeporte(String keywordsDeporte) {
		KeywordsDeporte = keywordsDeporte;
	}

	public String getKeywordsComida() {
		return KeywordsComida;
	}

	public void setKeywordsComida(String keywordsComida) {
		KeywordsComida = keywordsComida;
	}

	public String getKeywordsCaridad() {
		return KeywordsCaridad;
	}

	public void setKeywordsCaridad(String keywordsCaridad) {
		KeywordsCaridad = keywordsCaridad;
	}

	public String getKeywordsViajar() {
		return KeywordsViajar;
	}

	public void setKeywordsViajar(String keywordsViajar) {
		KeywordsViajar = keywordsViajar;
	}

	public String getKeywordsSocial() {
		return KeywordsSocial;
	}

	public void setKeywordsSocial(String keywordsSocial) {
		KeywordsSocial = keywordsSocial;
	}

	public String getKeywordsSalud() {
		return KeywordsSalud;
	}

	public void setKeywordsSalud(String keywordsSalud) {
		KeywordsSalud = keywordsSalud;
	}

	@Override
	public String toString() {
		return "UserResult [userId=" + userId + ", name=" + name + ", location=" + location + ", relationshipStatus="
				+ relationshipStatus + ", lastUpdatedDate=" + lastUpdatedDate + ", KeywordsCultura=" + KeywordsCultura
				+ ", KeywordsDeporte=" + KeywordsDeporte + ", KeywordsComida=" + KeywordsComida + ", KeywordsCaridad="
				+ KeywordsCaridad + ", KeywordsViajar=" + KeywordsViajar + ", KeywordsSocial=" + KeywordsSocial
				+ ", KeywordsSalud=" + KeywordsSalud + "]";
	}

}


text:
package org.apache.camel.component.telegram.model;

import java.io.Serializable;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * Contains information about a telegram chat.
 */
@JsonIgnoreProperties(ignoreUnknown = true)
public class Chat implements Serializable {

    private static final long serialVersionUID = 4706232811327318379L;

    private String id;

    private String title;

    private String type;

    @JsonProperty("all_members_are_administrators")
    private boolean allMembersAreAdministrators;

    public Chat() {
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public boolean isAllMembersAreAdministrators() {
        return allMembersAreAdministrators;
    }

    public void setAllMembersAreAdministrators(boolean allMembersAreAdministrators) {
        this.allMembersAreAdministrators = allMembersAreAdministrators;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("Chat{");
        sb.append("id='").append(id).append('\'');
        sb.append(", title='").append(title).append('\'');
        sb.append(", type='").append(type).append('\'');
        sb.append(", all_members_are_administrators='").append(allMembersAreAdministrators).append('\'');
        sb.append('}');
        return sb.toString();
    }
}


text:
package org.apache.camel.component.grape;

public class MavenCoordinates {

    private final String groupId;

    private final String artifactId;

    private final String version;

    private final String classifier;

    MavenCoordinates(String groupId, String artifactId, String version, String classifier) {
        this.groupId = groupId;
        this.artifactId = artifactId;
        this.version = version;
        this.classifier = classifier;
    }

    public static MavenCoordinates parseMavenCoordinates(String coordinates) {
        String[] coordinatesParts = coordinates.split("/");
        String clazzifier = "";
        if (coordinatesParts.length < 3 || coordinatesParts.length > 4) {
            throw new IllegalArgumentException("Invalid coordinates: " + coordinates);
        }

        if (coordinatesParts.length == 4) {
            clazzifier = coordinatesParts[3];
        }

        return new MavenCoordinates(coordinatesParts[0], coordinatesParts[1], coordinatesParts[2], clazzifier);
    }

    public String getGroupId() {
        return groupId;
    }

    public String getArtifactId() {
        return artifactId;
    }

    public String getVersion() {
        return version;
    }

    public String getClassifier() {
        return classifier;
    }

}


text:
<?php
namespace Apple_Exporter\Components;

/**
 * An HTML audio tag.
 *
 * @since 0.2.0
 */
class Audio extends Component {

	/**
	 * Look for node matches for this component.
	 *
	 * @param DomNode $node
	 * @return mixed
	 * @static
	 * @access public
	 */
	public static function node_matches( $node ) {
		// Is this an audio node?
		if ( 'audio' == $node->nodeName && self::remote_file_exists( $node ) ) {
			return $node;
		}

		return null;
	}

	/**
	 * Build the component.
	 *
	 * @param string $text
	 * @access protected
	 */
	protected function build( $text ) {
		// Remove initial and trailing tags: <video><p>...</p></video>
		if ( ! preg_match( '/src="([^"]+)"/', $text, $match ) ) {
			return null;
		}

		$url = $match[1];

		$this->json = array(
			'role' => 'audio',
			'URL'  => $url,
		);
	}

}


text:
$: << File.join(File.dirname(__FILE__), '..')

require 'duvet'
Duvet.start :filter => 'ast_ast/lib'

require 'lib/ast_ast'
require 'rspec'

RSpec.configure do |config|
  config.color_enabled = true
end


text:
"""Aiohttp test utils."""
import asyncio
from contextlib import contextmanager
import json as _json
import re
from unittest import mock
from urllib.parse import parse_qs

from aiohttp import ClientSession
from aiohttp.streams import StreamReader
from yarl import URL

from aiohttp.client_exceptions import ClientResponseError

from homeassistant.const import EVENT_HOMEASSISTANT_CLOSE

retype = type(re.compile(''))

def mock_stream(data):
    """Mock a stream with data."""
    protocol = mock.Mock(_reading_paused=False)
    stream = StreamReader(protocol)
    stream.feed_data(data)
    stream.feed_eof()
    return stream

class AiohttpClientMocker:
    """Mock Aiohttp client requests."""

    def __init__(self):
        """Initialize the request mocker."""
        self._mocks = []
        self._cookies = {}
        self.mock_calls = []

    def request(self, method, url, *,
                auth=None,
                status=200,
                text=None,
                data=None,
                content=None,
                json=None,
                params=None,
                headers={},
                exc=None,
                cookies=None):
        """Mock a request."""
        if json is not None:
            text = _json.dumps(json)
        if text is not None:
            content = text.encode('utf-8')
        if content is None:
            content = b''

        if not isinstance(url, retype):
            url = URL(url)
        if params:
            url = url.with_query(params)

        self._mocks.append(AiohttpClientMockResponse(
            method, url, status, content, cookies, exc, headers))

    def get(self, *args, **kwargs):
        """Register a mock get request."""
        self.request('get', *args, **kwargs)

    def put(self, *args, **kwargs):
        """Register a mock put request."""
        self.request('put', *args, **kwargs)

    def post(self, *args, **kwargs):
        """Register a mock post request."""
        self.request('post', *args, **kwargs)

    def delete(self, *args, **kwargs):
        """Register a mock delete request."""
        self.request('delete', *args, **kwargs)

    def options(self, *args, **kwargs):
        """Register a mock options request."""
        self.request('options', *args, **kwargs)

    @property
    def call_count(self):
        """Return the number of requests made."""
        return len(self.mock_calls)

    def clear_requests(self):
        """Reset mock calls."""
        self._mocks.clear()
        self._cookies.clear()
        self.mock_calls.clear()

    def create_session(self, loop):
        """Create a ClientSession that is bound to this mocker."""
        session = ClientSession(loop=loop)
        # Setting directly on `session` will raise deprecation warning
        object.__setattr__(session, '_request', self.match_request)
        return session

    async def match_request(self, method, url, *, data=None, auth=None,
                            params=None, headers=None, allow_redirects=None,
                            timeout=None, json=None):
        """Match a request against pre-registered requests."""
        data = data or json
        url = URL(url)
        if params:
            url = url.with_query(params)

        for response in self._mocks:
            if response.match_request(method, url, params):
                self.mock_calls.append((method, url, data, headers))

                if response.exc:
                    raise response.exc
                return response

        assert False, "No mock registered for {} {} {}".format(method.upper(),
                                                               url, params)

class AiohttpClientMockResponse:
    """Mock Aiohttp client response."""

    def __init__(self, method, url, status, response, cookies=None, exc=None,
                 headers=None):
        """Initialize a fake response."""
        self.method = method
        self._url = url
        self.status = status
        self.response = response
        self.exc = exc

        self._headers = headers or {}
        self._cookies = {}

        if cookies:
            for name, data in cookies.items():
                cookie = mock.MagicMock()
                cookie.value = data
                self._cookies[name] = cookie

    def match_request(self, method, url, params=None):
        """Test if response answers request."""
        if method.lower() != self.method.lower():
            return False

        # regular expression matching
        if isinstance(self._url, retype):
            return self._url.search(str(url)) is not None

        if (self._url.scheme != url.scheme or self._url.host != url.host or
                self._url.path != url.path):
            return False

        # Ensure all query components in matcher are present in the request
        request_qs = parse_qs(url.query_string)
        matcher_qs = parse_qs(self._url.query_string)
        for key, vals in matcher_qs.items():
            for val in vals:
                try:
                    request_qs.get(key, []).remove(val)
                except ValueError:
                    return False

        return True

    @property
    def headers(self):
        """Return content_type."""
        return self._headers

    @property
    def cookies(self):
        """Return dict of cookies."""
        return self._cookies

    @property
    def url(self):
        """Return yarl of URL."""
        return self._url

    @property
    def content(self):
        """Return content."""
        return mock_stream(self.response)

    @asyncio.coroutine
    def read(self):
        """Return mock response."""
        return self.response

    @asyncio.coroutine
    def text(self, encoding='utf-8'):
        """Return mock response as a string."""
        return self.response.decode(encoding)

    @asyncio.coroutine
    def json(self, encoding='utf-8'):
        """Return mock response as a json."""
        return _json.loads(self.response.decode(encoding))

    @asyncio.coroutine
    def release(self):
        """Mock release."""
        pass

    def raise_for_status(self):
        """Raise error if status is 400 or higher."""
        if self.status >= 400:
            raise ClientResponseError(
                None, None, code=self.status, headers=self.headers)

    def close(self):
        """Mock close."""
        pass

@contextmanager
def mock_aiohttp_client():
    """Context manager to mock aiohttp client."""
    mocker = AiohttpClientMocker()

    def create_session(hass, *args):
        session = mocker.create_session(hass.loop)

        async def close_session(event):
            """Close session."""
            await session.close()

        hass.bus.async_listen_once(EVENT_HOMEASSISTANT_CLOSE, close_session)

        return session

    with mock.patch(
        'homeassistant.helpers.aiohttp_client.async_create_clientsession',
            side_effect=create_session):
        yield mocker


text:
namespace content {

namespace {

static base::LazyInstance<base::Lock>::Leaky
    g_default_share_groups_lock = LAZY_INSTANCE_INITIALIZER;

typedef std::map<
    gpu::GpuChannelHost*,
    scoped_refptr<WebGraphicsContext3DCommandBufferImpl::ShareGroup>>
    ShareGroupMap;
static base::LazyInstance<ShareGroupMap> g_default_share_groups =
    LAZY_INSTANCE_INITIALIZER;

scoped_refptr<WebGraphicsContext3DCommandBufferImpl::ShareGroup>
GetDefaultShareGroupForHost(gpu::GpuChannelHost* host) {
  base::AutoLock lock(g_default_share_groups_lock.Get());

  ShareGroupMap& share_groups = g_default_share_groups.Get();
  ShareGroupMap::iterator it = share_groups.find(host);
  if (it == share_groups.end()) {
    scoped_refptr<WebGraphicsContext3DCommandBufferImpl::ShareGroup> group =
        new WebGraphicsContext3DCommandBufferImpl::ShareGroup();
    share_groups[host] = group;
    return group;
  }
  return it->second;
}

} // namespace anonymous

WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits::SharedMemoryLimits()
    : command_buffer_size(kDefaultCommandBufferSize),
      start_transfer_buffer_size(kDefaultStartTransferBufferSize),
      min_transfer_buffer_size(kDefaultMinTransferBufferSize),
      max_transfer_buffer_size(kDefaultMaxTransferBufferSize),
      mapped_memory_reclaim_limit(gpu::gles2::GLES2Implementation::kNoLimit) {}

WebGraphicsContext3DCommandBufferImpl::ShareGroup::ShareGroup() {
}

WebGraphicsContext3DCommandBufferImpl::ShareGroup::~ShareGroup() {
  DCHECK(contexts_.empty());
}

WebGraphicsContext3DCommandBufferImpl::WebGraphicsContext3DCommandBufferImpl(
    gpu::SurfaceHandle surface_handle,
    const GURL& active_url,
    gpu::GpuChannelHost* host,
    const gpu::gles2::ContextCreationAttribHelper& attributes,
    gfx::GpuPreference gpu_preference,
    bool share_resources,
    bool automatic_flushes,
    const SharedMemoryLimits& limits,
    WebGraphicsContext3DCommandBufferImpl* share_context)
    : automatic_flushes_(automatic_flushes),
      attributes_(attributes),
      host_(host),
      surface_handle_(surface_handle),
      active_url_(active_url),
      gpu_preference_(gpu_preference),
      mem_limits_(limits),
      weak_ptr_factory_(this) {
  switch (attributes.context_type) {
    case gpu::gles2::CONTEXT_TYPE_OPENGLES2:
    case gpu::gles2::CONTEXT_TYPE_OPENGLES3:
      context_type_ = CONTEXT_TYPE_UNKNOWN;
    case gpu::gles2::CONTEXT_TYPE_WEBGL1:
    case gpu::gles2::CONTEXT_TYPE_WEBGL2:
      context_type_ = OFFSCREEN_CONTEXT_FOR_WEBGL;
  }
  if (share_context) {
    DCHECK(!share_resources);
    share_group_ = share_context->share_group_;
  } else if (share_resources) {
    share_group_ = GetDefaultShareGroupForHost(host);
  } else {
    share_group_ = make_scoped_refptr(new ShareGroup);
  }
}

WebGraphicsContext3DCommandBufferImpl::
    ~WebGraphicsContext3DCommandBufferImpl() {
  if (real_gl_) {
    real_gl_->SetErrorMessageCallback(NULL);
  }

  Destroy();
}

bool WebGraphicsContext3DCommandBufferImpl::MaybeInitializeGL() {
  if (initialized_)
    return true;

  if (initialize_failed_)
    return false;

  TRACE_EVENT0("gpu", "WebGfxCtx3DCmdBfrImpl::MaybeInitializeGL");

  // TODO(vadimt): Remove ScopedTracker below once crbug.com/125248 is fixed.
  tracked_objects::ScopedTracker tracking_profile(
      FROM_HERE_WITH_EXPLICIT_FUNCTION(
          "125248 WebGraphicsContext3DCommandBufferImpl::MaybeInitializeGL"));

  if (!CreateContext()) {
    Destroy();

    initialize_failed_ = true;
    return false;
  }

  command_buffer_->SetContextLostCallback(
      base::Bind(&WebGraphicsContext3DCommandBufferImpl::OnContextLost,
                 weak_ptr_factory_.GetWeakPtr()));

  command_buffer_->SetOnConsoleMessageCallback(
      base::Bind(&WebGraphicsContext3DCommandBufferImpl::OnErrorMessage,
                 weak_ptr_factory_.GetWeakPtr()));

  real_gl_->SetErrorMessageCallback(getErrorMessageCallback());
  real_gl_->TraceBeginCHROMIUM("WebGraphicsContext3D",
                               "CommandBufferContext");

  initialized_ = true;
  return true;
}

bool WebGraphicsContext3DCommandBufferImpl::InitializeCommandBuffer(
    WebGraphicsContext3DCommandBufferImpl* share_context) {
  if (!host_.get())
    return false;

  gpu::CommandBufferProxyImpl* share_group_command_buffer = NULL;

  if (share_context) {
    share_group_command_buffer = share_context->GetCommandBufferProxy();
  }

  DCHECK(attributes_.buffer_preserved);
  std::vector<int32_t> serialized_attributes;
  attributes_.Serialize(&serialized_attributes);

  // Create a proxy to a command buffer in the GPU process.
  command_buffer_ = host_->CreateCommandBuffer(
      surface_handle_, gfx::Size(), share_group_command_buffer,
      gpu::GpuChannelHost::kDefaultStreamId,
      gpu::GpuChannelHost::kDefaultStreamPriority, serialized_attributes,
      active_url_, gpu_preference_);

  if (!command_buffer_) {
    DLOG(ERROR) << "GpuChannelHost failed to create command buffer.";
    UmaRecordContextInitFailed(context_type_);
    return false;
  }

  DVLOG_IF(1, gpu::error::IsError(command_buffer_->GetLastError()))
      << "Context dead on arrival. Last error: "
      << command_buffer_->GetLastError();
  // Initialize the command buffer.
  bool result = command_buffer_->Initialize();
  LOG_IF(ERROR, !result) << "CommandBufferProxy::Initialize failed.";
  if (!result)
    UmaRecordContextInitFailed(context_type_);
  return result;
}

bool WebGraphicsContext3DCommandBufferImpl::CreateContext() {
  TRACE_EVENT0("gpu", "WebGfxCtx3DCmdBfrImpl::CreateContext");
  scoped_refptr<gpu::gles2::ShareGroup> gles2_share_group;

  scoped_ptr<base::AutoLock> share_group_lock;
  bool add_to_share_group = false;
  if (!command_buffer_) {
    WebGraphicsContext3DCommandBufferImpl* share_context = NULL;

    share_group_lock.reset(new base::AutoLock(share_group_->lock()));
    share_context = share_group_->GetAnyContextLocked();

    if (!InitializeCommandBuffer(share_context)) {
      LOG(ERROR) << "Failed to initialize command buffer.";
      return false;
    }

    if (share_context)
      gles2_share_group = share_context->GetImplementation()->share_group();

    add_to_share_group = true;
  }

  // Create the GLES2 helper, which writes the command buffer protocol.
  gles2_helper_.reset(new gpu::gles2::GLES2CmdHelper(command_buffer_.get()));
  if (!gles2_helper_->Initialize(mem_limits_.command_buffer_size)) {
    LOG(ERROR) << "Failed to initialize GLES2CmdHelper.";
    return false;
  }

  if (!automatic_flushes_)
    gles2_helper_->SetAutomaticFlushes(false);
  // Create a transfer buffer used to copy resources between the renderer
  // process and the GPU process.
  transfer_buffer_ .reset(new gpu::TransferBuffer(gles2_helper_.get()));

  DCHECK(host_.get());

  const bool bind_generates_resource = attributes_.bind_generates_resource;
  const bool lose_context_when_out_of_memory =
      attributes_.lose_context_when_out_of_memory;
  const bool support_client_side_arrays = false;

  // Create the object exposing the OpenGL API.
  real_gl_.reset(new gpu::gles2::GLES2Implementation(
      gles2_helper_.get(), gles2_share_group.get(), transfer_buffer_.get(),
      bind_generates_resource, lose_context_when_out_of_memory,
      support_client_side_arrays, command_buffer_.get()));
  SetGLInterface(real_gl_.get());

  if (!real_gl_->Initialize(
      mem_limits_.start_transfer_buffer_size,
      mem_limits_.min_transfer_buffer_size,
      mem_limits_.max_transfer_buffer_size,
      mem_limits_.mapped_memory_reclaim_limit)) {
    LOG(ERROR) << "Failed to initialize GLES2Implementation.";
    return false;
  }

  if (add_to_share_group)
    share_group_->AddContextLocked(this);

  if (base::CommandLine::ForCurrentProcess()->HasSwitch(
          switches::kEnableGpuClientTracing)) {
    trace_gl_.reset(new gpu::gles2::GLES2TraceImplementation(GetGLInterface()));
    SetGLInterface(trace_gl_.get());
  }
  return true;
}

bool WebGraphicsContext3DCommandBufferImpl::InitializeOnCurrentThread() {
  if (!MaybeInitializeGL()) {
    DLOG(ERROR) << "Failed to initialize context.";
    return false;
  }
  if (gpu::error::IsError(command_buffer_->GetLastError())) {
    LOG(ERROR) << "Context dead on arrival. Last error: "
               << command_buffer_->GetLastError();
    return false;
  }

  return true;
}

void WebGraphicsContext3DCommandBufferImpl::Destroy() {
  share_group_->RemoveContext(this);

  gpu::gles2::GLES2Interface* gl = GetGLInterface();
  if (gl) {
    // First flush the context to ensure that any pending frees of resources
    // are completed. Otherwise, if this context is part of a share group,
    // those resources might leak. Also, any remaining side effects of commands
    // issued on this context might not be visible to other contexts in the
    // share group.
    gl->Flush();
    SetGLInterface(nullptr);
  }

  trace_gl_.reset();
  real_gl_.reset();
  transfer_buffer_.reset();
  gles2_helper_.reset();
  real_gl_.reset();
  command_buffer_.reset();

  host_ = nullptr;
}

gpu::ContextSupport*
WebGraphicsContext3DCommandBufferImpl::GetContextSupport() {
  return real_gl_.get();
}

bool WebGraphicsContext3DCommandBufferImpl::IsCommandBufferContextLost() {
  // If the channel shut down unexpectedly, let that supersede the
  // command buffer's state.
  if (host_.get() && host_->IsLost())
    return true;
  gpu::CommandBuffer::State state = command_buffer_->GetLastState();
  return gpu::error::IsError(state.error);
}

// static
WebGraphicsContext3DCommandBufferImpl*
WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
    gpu::GpuChannelHost* host,
    const gpu::gles2::ContextCreationAttribHelper& attributes,
    gfx::GpuPreference gpu_preference,
    bool share_resources,
    bool automatic_flushes,
    const GURL& active_url,
    const SharedMemoryLimits& limits,
    WebGraphicsContext3DCommandBufferImpl* share_context) {
  if (!host)
    return NULL;

  if (share_context && share_context->IsCommandBufferContextLost())
    return NULL;

  return new WebGraphicsContext3DCommandBufferImpl(
      gpu::kNullSurfaceHandle, active_url, host, attributes, gpu_preference,
      share_resources, automatic_flushes, limits, share_context);
}

void WebGraphicsContext3DCommandBufferImpl::OnContextLost() {
  if (context_lost_callback_)
    context_lost_callback_->onContextLost();

  share_group_->RemoveAllContexts();

  DCHECK(host_.get());
  {
    base::AutoLock lock(g_default_share_groups_lock.Get());
    g_default_share_groups.Get().erase(host_.get());
  }

  gpu::CommandBuffer::State state = command_buffer_->GetLastState();
  UmaRecordContextLost(context_type_, state.error, state.context_lost_reason);
}

}  // namespace content


text:
#ifndef _FSL_QBMAN_PORTAL_H
#define _FSL_QBMAN_PORTAL_H

#include <rte_compat.h>
#include <fsl_qbman_base.h>

#define SVR_LS1080A	0x87030000
#define SVR_LS2080A	0x87010000
#define SVR_LS2088A	0x87090000
#define SVR_LX2160A	0x87360000

/* Variable to store DPAA2 platform type */
extern uint32_t dpaa2_svr_family;

/**
 * DOC - QBMan portal APIs to implement the following functions:
 * - Initialize and destroy Software portal object.
 * - Read and write Software portal interrupt registers.
 * - Enqueue, including setting the enqueue descriptor, and issuing enqueue
 *   command etc.
 * - Dequeue, including setting the dequeue descriptor, issuing dequeue command,
 *   parsing the dequeue response in DQRR and memory, parsing the state change
 *   notifications etc.
 * - Release, including setting the release descriptor, and issuing the buffer
 *   release command.
 * - Acquire, acquire the buffer from the given buffer pool.
 * - FQ management.
 * - Channel management, enable/disable CDAN with or without context.
 */

/**
 * qbman_swp_init() - Create a functional object representing the given
 * QBMan portal descriptor.
 * @d: the given qbman swp descriptor
 *
 * Return qbman_swp portal object for success, NULL if the object cannot
 * be created.
 */
struct qbman_swp *qbman_swp_init(const struct qbman_swp_desc *d);

/**
 * qbman_swp_update() - Update portal cacheability attributes.
 * @p: the given qbman swp portal
 */
int qbman_swp_update(struct qbman_swp *p, int stash_off);

/**
 * qbman_swp_finish() - Create and destroy a functional object representing
 * the given QBMan portal descriptor.
 * @p: the qbman_swp object to be destroyed.
 *
 */
void qbman_swp_finish(struct qbman_swp *p);

/**
 * qbman_swp_invalidate() - Invalidate the cache enabled area of the QBMan
 * portal. This is required to be called if a portal moved to another core
 * because the QBMan portal area is non coherent
 * @p: the qbman_swp object to be invalidated
 *
 */
void qbman_swp_invalidate(struct qbman_swp *p);

/**
 * qbman_swp_get_desc() - Get the descriptor of the given portal object.
 * @p: the given portal object.
 *
 * Return the descriptor for this portal.
 */
const struct qbman_swp_desc *qbman_swp_get_desc(struct qbman_swp *p);

	/**************/
	/* Interrupts */
	/**************/

/* EQCR ring interrupt */
#define QBMAN_SWP_INTERRUPT_EQRI ((uint32_t)0x00000001)
/* Enqueue command dispatched interrupt */
#define QBMAN_SWP_INTERRUPT_EQDI ((uint32_t)0x00000002)
/* DQRR non-empty interrupt */
#define QBMAN_SWP_INTERRUPT_DQRI ((uint32_t)0x00000004)
/* RCR ring interrupt */
#define QBMAN_SWP_INTERRUPT_RCRI ((uint32_t)0x00000008)
/* Release command dispatched interrupt */
#define QBMAN_SWP_INTERRUPT_RCDI ((uint32_t)0x00000010)
/* Volatile dequeue command interrupt */
#define QBMAN_SWP_INTERRUPT_VDCI ((uint32_t)0x00000020)

/**
 * qbman_swp_interrupt_get_vanish() - Get the data in software portal
 * interrupt status disable register.
 * @p: the given software portal object.
 *
 * Return the settings in SWP_ISDR register.
 */
uint32_t qbman_swp_interrupt_get_vanish(struct qbman_swp *p);

/**
 * qbman_swp_interrupt_set_vanish() - Set the data in software portal
 * interrupt status disable register.
 * @p: the given software portal object.
 * @mask: The value to set in SWP_IDSR register.
 */
void qbman_swp_interrupt_set_vanish(struct qbman_swp *p, uint32_t mask);

/**
 * qbman_swp_interrupt_read_status() - Get the data in software portal
 * interrupt status register.
 * @p: the given software portal object.
 *
 * Return the settings in SWP_ISR register.
 */
uint32_t qbman_swp_interrupt_read_status(struct qbman_swp *p);

/**
 * qbman_swp_interrupt_clear_status() - Set the data in software portal
 * interrupt status register.
 * @p: the given software portal object.
 * @mask: The value to set in SWP_ISR register.
 */
__rte_internal
void qbman_swp_interrupt_clear_status(struct qbman_swp *p, uint32_t mask);

/**
 * qbman_swp_dqrr_thrshld_read_status() - Get the data in software portal
 * DQRR interrupt threshold register.
 * @p: the given software portal object.
 */
uint32_t qbman_swp_dqrr_thrshld_read_status(struct qbman_swp *p);

/**
 * qbman_swp_dqrr_thrshld_write() - Set the data in software portal
 * DQRR interrupt threshold register.
 * @p: the given software portal object.
 * @mask: The value to set in SWP_DQRR_ITR register.
 */
void qbman_swp_dqrr_thrshld_write(struct qbman_swp *p, uint32_t mask);

/**
 * qbman_swp_intr_timeout_read_status() - Get the data in software portal
 * Interrupt Time-Out period register.
 * @p: the given software portal object.
 */
uint32_t qbman_swp_intr_timeout_read_status(struct qbman_swp *p);

/**
 * qbman_swp_intr_timeout_write() - Set the data in software portal
 * Interrupt Time-Out period register.
 * @p: the given software portal object.
 * @mask: The value to set in SWP_ITPR register.
 */
void qbman_swp_intr_timeout_write(struct qbman_swp *p, uint32_t mask);

/**
 * qbman_swp_interrupt_get_trigger() - Get the data in software portal
 * interrupt enable register.
 * @p: the given software portal object.
 *
 * Return the settings in SWP_IER register.
 */
uint32_t qbman_swp_interrupt_get_trigger(struct qbman_swp *p);

/**
 * qbman_swp_interrupt_set_trigger() - Set the data in software portal
 * interrupt enable register.
 * @p: the given software portal object.
 * @mask: The value to set in SWP_IER register.
 */
void qbman_swp_interrupt_set_trigger(struct qbman_swp *p, uint32_t mask);

/**
 * qbman_swp_interrupt_get_inhibit() - Get the data in software portal
 * interrupt inhibit register.
 * @p: the given software portal object.
 *
 * Return the settings in SWP_IIR register.
 */
int qbman_swp_interrupt_get_inhibit(struct qbman_swp *p);

/**
 * qbman_swp_interrupt_set_inhibit() - Set the data in software portal
 * interrupt inhibit register.
 * @p: the given software portal object.
 * @mask: The value to set in SWP_IIR register.
 */
void qbman_swp_interrupt_set_inhibit(struct qbman_swp *p, int inhibit);

	/************/
	/* Dequeues */
	/************/

/**
 * struct qbman_result - structure for qbman dequeue response and/or
 * notification.
 * @dont_manipulate_directly: the 16 32bit data to represent the whole
 * possible qbman dequeue result.
 */
struct qbman_result {
	union {
		struct common {
			uint8_t verb;
			uint8_t reserved[63];
		} common;
		struct dq {
			uint8_t verb;
			uint8_t stat;
			__le16 seqnum;
			__le16 oprid;
			uint8_t reserved;
			uint8_t tok;
			__le32 fqid;
			uint32_t reserved2;
			__le32 fq_byte_cnt;
			__le32 fq_frm_cnt;
			__le64 fqd_ctx;
			uint8_t fd[32];
		} dq;
		struct scn {
			uint8_t verb;
			uint8_t stat;
			uint8_t state;
			uint8_t reserved;
			__le32 rid_tok;
			__le64 ctx;
		} scn;
		struct eq_resp {
			uint8_t verb;
			uint8_t dca;
			__le16 seqnum;
			__le16 oprid;
			uint8_t reserved;
			uint8_t rc;
			__le32 tgtid;
			__le32 tag;
			uint16_t qdbin;
			uint8_t qpri;
			uint8_t reserved1;
			__le32 fqid:24;
			__le32 rspid:8;
			__le64 rsp_addr;
			uint8_t fd[32];
		} eq_resp;
	};
};

/* TODO:
 *A DQRI interrupt can be generated when there are dequeue results on the
 * portal's DQRR (this mechanism does not deal with "pull" dequeues to
 * user-supplied 'storage' addresses). There are two parameters to this
 * interrupt source, one is a threshold and the other is a timeout. The
 * interrupt will fire if either the fill-level of the ring exceeds 'thresh', or
 * if the ring has been non-empty for been longer than 'timeout' nanoseconds.
 * For timeout, an approximation to the desired nanosecond-granularity value is
 * made, so there are get and set APIs to allow the user to see what actual
 * timeout is set (compared to the timeout that was requested).
 */
int qbman_swp_dequeue_thresh(struct qbman_swp *s, unsigned int thresh);
int qbman_swp_dequeue_set_timeout(struct qbman_swp *s, unsigned int timeout);
int qbman_swp_dequeue_get_timeout(struct qbman_swp *s, unsigned int *timeout);

/* ------------------- */
/* Push-mode dequeuing */
/* ------------------- */

/* The user of a portal can enable and disable push-mode dequeuing of up to 16
 * channels independently. It does not specify this toggling by channel IDs, but
 * rather by specifying the index (from 0 to 15) that has been mapped to the
 * desired channel.
 */

/**
 * qbman_swp_push_get() - Get the push dequeue setup.
 * @s: the software portal object.
 * @channel_idx: the channel index to query.
 * @enabled: returned boolean to show whether the push dequeue is enabled for
 * the given channel.
 */
void qbman_swp_push_get(struct qbman_swp *s, uint8_t channel_idx, int *enabled);

/**
 * qbman_swp_push_set() - Enable or disable push dequeue.
 * @s: the software portal object.
 * @channel_idx: the channel index..
 * @enable: enable or disable push dequeue.
 *
 * The user of a portal can enable and disable push-mode dequeuing of up to 16
 * channels independently. It does not specify this toggling by channel IDs, but
 * rather by specifying the index (from 0 to 15) that has been mapped to the
 * desired channel.
 */
__rte_internal
void qbman_swp_push_set(struct qbman_swp *s, uint8_t channel_idx, int enable);

/* ------------------- */
/* Pull-mode dequeuing */
/* ------------------- */

/**
 * struct qbman_pull_desc - the structure for pull dequeue descriptor
 */
struct qbman_pull_desc {
	union {
		uint32_t dont_manipulate_directly[16];
		struct pull {
			uint8_t verb;
			uint8_t numf;
			uint8_t tok;
			uint8_t reserved;
			uint32_t dq_src;
			uint64_t rsp_addr;
			uint64_t rsp_addr_virt;
			uint8_t padding[40];
		} pull;
	};
};

enum qbman_pull_type_e {
	/* dequeue with priority precedence, respect intra-class scheduling */
	qbman_pull_type_prio = 1,
	/* dequeue with active FQ precedence, respect ICS */
	qbman_pull_type_active,
	/* dequeue with active FQ precedence, no ICS */
	qbman_pull_type_active_noics
};

/**
 * qbman_pull_desc_clear() - Clear the contents of a descriptor to
 * default/starting state.
 * @d: the pull dequeue descriptor to be cleared.
 */
__rte_internal
void qbman_pull_desc_clear(struct qbman_pull_desc *d);

/**
 * qbman_pull_desc_set_storage()- Set the pull dequeue storage
 * @d: the pull dequeue descriptor to be set.
 * @storage: the pointer of the memory to store the dequeue result.
 * @storage_phys: the physical address of the storage memory.
 * @stash: to indicate whether write allocate is enabled.
 *
 * If not called, or if called with 'storage' as NULL, the result pull dequeues
 * will produce results to DQRR. If 'storage' is non-NULL, then results are
 * produced to the given memory location (using the physical/DMA address which
 * the caller provides in 'storage_phys'), and 'stash' controls whether or not
 * those writes to main-memory express a cache-warming attribute.
 */
__rte_internal
void qbman_pull_desc_set_storage(struct qbman_pull_desc *d,
				 struct qbman_result *storage,
				 uint64_t storage_phys,
				 int stash);
/**
 * qbman_pull_desc_set_numframes() - Set the number of frames to be dequeued.
 * @d: the pull dequeue descriptor to be set.
 * @numframes: number of frames to be set, must be between 1 and 16, inclusive.
 */
__rte_internal
void qbman_pull_desc_set_numframes(struct qbman_pull_desc *d,
				   uint8_t numframes);
/**
 * qbman_pull_desc_set_token() - Set dequeue token for pull command
 * @d: the dequeue descriptor
 * @token: the token to be set
 *
 * token is the value that shows up in the dequeue response that can be used to
 * detect when the results have been published. The easiest technique is to zero
 * result "storage" before issuing a dequeue, and use any non-zero 'token' value
 */
void qbman_pull_desc_set_token(struct qbman_pull_desc *d, uint8_t token);

/* Exactly one of the following descriptor "actions" should be set. (Calling any
 * one of these will replace the effect of any prior call to one of these.)
 * - pull dequeue from the given frame queue (FQ)
 * - pull dequeue from any FQ in the given work queue (WQ)
 * - pull dequeue from any FQ in any WQ in the given channel
 */
/**
 * qbman_pull_desc_set_fq() - Set fqid from which the dequeue command dequeues.
 * @fqid: the frame queue index of the given FQ.
 */
__rte_internal
void qbman_pull_desc_set_fq(struct qbman_pull_desc *d, uint32_t fqid);

/**
 * qbman_pull_desc_set_wq() - Set wqid from which the dequeue command dequeues.
 * @wqid: composed of channel id and wqid within the channel.
 * @dct: the dequeue command type.
 */
void qbman_pull_desc_set_wq(struct qbman_pull_desc *d, uint32_t wqid,
			    enum qbman_pull_type_e dct);

/* qbman_pull_desc_set_channel() - Set channelid from which the dequeue command
 * dequeues.
 * @chid: the channel id to be dequeued.
 * @dct: the dequeue command type.
 */
void qbman_pull_desc_set_channel(struct qbman_pull_desc *d, uint32_t chid,
				 enum qbman_pull_type_e dct);

/**
 * qbman_pull_desc_set_rad() - Decide whether reschedule the fq after dequeue
 *
 * @rad: 1 = Reschedule the FQ after dequeue.
 *	 0 = Allow the FQ to remain active after dequeue.
 */
void qbman_pull_desc_set_rad(struct qbman_pull_desc *d, int rad);

/**
 * qbman_swp_pull() - Issue the pull dequeue command
 * @s: the software portal object.
 * @d: the software portal descriptor which has been configured with
 * the set of qbman_pull_desc_set_*() calls.
 *
 * Return 0 for success, and -EBUSY if the software portal is not ready
 * to do pull dequeue.
 */
__rte_internal
int qbman_swp_pull(struct qbman_swp *s, struct qbman_pull_desc *d);

/* -------------------------------- */
/* Polling DQRR for dequeue results */
/* -------------------------------- */

/**
 * qbman_swp_dqrr_next() - Get an valid DQRR entry.
 * @s: the software portal object.
 *
 * Return NULL if there are no unconsumed DQRR entries. Return a DQRR entry
 * only once, so repeated calls can return a sequence of DQRR entries, without
 * requiring they be consumed immediately or in any particular order.
 */
__rte_internal
const struct qbman_result *qbman_swp_dqrr_next(struct qbman_swp *p);

/**
 * qbman_swp_prefetch_dqrr_next() - prefetch the next DQRR entry.
 * @s: the software portal object.
 */
__rte_internal
void qbman_swp_prefetch_dqrr_next(struct qbman_swp *s);

/**
 * qbman_swp_dqrr_consume() -  Consume DQRR entries previously returned from
 * qbman_swp_dqrr_next().
 * @s: the software portal object.
 * @dq: the DQRR entry to be consumed.
 */
__rte_internal
void qbman_swp_dqrr_consume(struct qbman_swp *s, const struct qbman_result *dq);

/**
 * qbman_swp_dqrr_idx_consume() -  Given the DQRR index consume the DQRR entry
 * @s: the software portal object.
 * @dqrr_index: the DQRR index entry to be consumed.
 */
__rte_internal
void qbman_swp_dqrr_idx_consume(struct qbman_swp *s, uint8_t dqrr_index);

/**
 * qbman_get_dqrr_idx() - Get dqrr index from the given dqrr
 * @dqrr: the given dqrr object.
 *
 * Return dqrr index.
 */
__rte_internal
uint8_t qbman_get_dqrr_idx(const struct qbman_result *dqrr);

/**
 * qbman_get_dqrr_from_idx() - Use index to get the dqrr entry from the
 * given portal
 * @s: the given portal.
 * @idx: the dqrr index.
 *
 * Return dqrr entry object.
 */
__rte_internal
struct qbman_result *qbman_get_dqrr_from_idx(struct qbman_swp *s, uint8_t idx);

/* ------------------------------------------------- */
/* Polling user-provided storage for dequeue results */
/* ------------------------------------------------- */

/**
 * qbman_result_has_new_result() - Check and get the dequeue response from the
 * dq storage memory set in pull dequeue command
 * @s: the software portal object.
 * @dq: the dequeue result read from the memory.
 *
 * Only used for user-provided storage of dequeue results, not DQRR. For
 * efficiency purposes, the driver will perform any required endianness
 * conversion to ensure that the user's dequeue result storage is in host-endian
 * format (whether or not that is the same as the little-endian format that
 * hardware DMA'd to the user's storage). As such, once the user has called
 * qbman_result_has_new_result() and been returned a valid dequeue result,
 * they should not call it again on the same memory location (except of course
 * if another dequeue command has been executed to produce a new result to that
 * location).
 *
 * Return 1 for getting a valid dequeue result, or 0 for not getting a valid
 * dequeue result.
 */
__rte_internal
int qbman_result_has_new_result(struct qbman_swp *s,
				struct qbman_result *dq);

/**
 * qbman_check_command_complete() - Check if the previous issued dq command
 * is completed and results are available in memory.
 * @s: the software portal object.
 * @dq: the dequeue result read from the memory.
 *
 * Return 1 for getting a valid dequeue result, or 0 for not getting a valid
 * dequeue result.
 */
__rte_internal
int qbman_check_command_complete(struct qbman_result *dq);

__rte_internal
int qbman_check_new_result(struct qbman_result *dq);

/* -------------------------------------------------------- */
/* Parsing dequeue entries (DQRR and user-provided storage) */
/* -------------------------------------------------------- */

/**
 * qbman_result_is_DQ() - check the dequeue result is a dequeue response or not
 * @dq: the dequeue result to be checked.
 *
 * DQRR entries may contain non-dequeue results, ie. notifications
 */
int qbman_result_is_DQ(const struct qbman_result *dq);

/**
 * qbman_result_is_SCN() - Check the dequeue result is notification or not
 * @dq: the dequeue result to be checked.
 *
 * All the non-dequeue results (FQDAN/CDAN/CSCN/...) are "state change
 * notifications" of one type or another. Some APIs apply to all of them, of the
 * form qbman_result_SCN_***().
 */
static inline int qbman_result_is_SCN(const struct qbman_result *dq)
{
	return !qbman_result_is_DQ(dq);
}

/* Recognise different notification types, only required if the user allows for
 * these to occur, and cares about them when they do.
 */

/**
 * qbman_result_is_FQDAN() - Check for FQ Data Availability
 * @dq: the qbman_result object.
 *
 * Return 1 if this is FQDAN.
 */
int qbman_result_is_FQDAN(const struct qbman_result *dq);

/**
 * qbman_result_is_CDAN() - Check for Channel Data Availability
 * @dq: the qbman_result object to check.
 *
 * Return 1 if this is CDAN.
 */
int qbman_result_is_CDAN(const struct qbman_result *dq);

/**
 * qbman_result_is_CSCN() - Check for Congestion State Change
 * @dq: the qbman_result object to check.
 *
 * Return 1 if this is CSCN.
 */
int qbman_result_is_CSCN(const struct qbman_result *dq);

/**
 * qbman_result_is_BPSCN() - Check for Buffer Pool State Change.
 * @dq: the qbman_result object to check.
 *
 * Return 1 if this is BPSCN.
 */
int qbman_result_is_BPSCN(const struct qbman_result *dq);

/**
 * qbman_result_is_CGCU() - Check for Congestion Group Count Update.
 * @dq: the qbman_result object to check.
 *
 * Return 1 if this is CGCU.
 */
int qbman_result_is_CGCU(const struct qbman_result *dq);

/* Frame queue state change notifications; (FQDAN in theory counts too as it
 * leaves a FQ parked, but it is primarily a data availability notification)
 */

/**
 * qbman_result_is_FQRN() - Check for FQ Retirement Notification.
 * @dq: the qbman_result object to check.
 *
 * Return 1 if this is FQRN.
 */
int qbman_result_is_FQRN(const struct qbman_result *dq);

/**
 * qbman_result_is_FQRNI() - Check for FQ Retirement Immediate
 * @dq: the qbman_result object to check.
 *
 * Return 1 if this is FQRNI.
 */
int qbman_result_is_FQRNI(const struct qbman_result *dq);

/**
 * qbman_result_is_FQPN() - Check for FQ Park Notification
 * @dq: the qbman_result object to check.
 *
 * Return 1 if this is FQPN.
 */
int qbman_result_is_FQPN(const struct qbman_result *dq);

/* Parsing frame dequeue results (qbman_result_is_DQ() must be TRUE)
 */
/* FQ empty */
#define QBMAN_DQ_STAT_FQEMPTY       0x80
/* FQ held active */
#define QBMAN_DQ_STAT_HELDACTIVE    0x40
/* FQ force eligible */
#define QBMAN_DQ_STAT_FORCEELIGIBLE 0x20
/* Valid frame */
#define QBMAN_DQ_STAT_VALIDFRAME    0x10
/* FQ ODP enable */
#define QBMAN_DQ_STAT_ODPVALID      0x04
/* Volatile dequeue */
#define QBMAN_DQ_STAT_VOLATILE      0x02
/* volatile dequeue command is expired */
#define QBMAN_DQ_STAT_EXPIRED       0x01

#define QBMAN_EQCR_DCA_IDXMASK		0x0f
#define QBMAN_ENQUEUE_FLAG_DCA		(1ULL << 31)

/**
 * qbman_result_DQ_flags() - Get the STAT field of dequeue response
 * @dq: the dequeue result.
 *
 * Return the state field.
 */
__rte_internal
uint8_t qbman_result_DQ_flags(const struct qbman_result *dq);

/**
 * qbman_result_DQ_is_pull() - Check whether the dq response is from a pull
 * command.
 * @dq: the dequeue result.
 *
 * Return 1 for volatile(pull) dequeue, 0 for static dequeue.
 */
static inline int qbman_result_DQ_is_pull(const struct qbman_result *dq)
{
	return (int)(qbman_result_DQ_flags(dq) & QBMAN_DQ_STAT_VOLATILE);
}

/**
 * qbman_result_DQ_is_pull_complete() - Check whether the pull command is
 * completed.
 * @dq: the dequeue result.
 *
 * Return boolean.
 */
static inline int qbman_result_DQ_is_pull_complete(
					const struct qbman_result *dq)
{
	return (int)(qbman_result_DQ_flags(dq) & QBMAN_DQ_STAT_EXPIRED);
}

/**
 * qbman_result_DQ_seqnum()  - Get the seqnum field in dequeue response
 * seqnum is valid only if VALIDFRAME flag is TRUE
 * @dq: the dequeue result.
 *
 * Return seqnum.
 */
__rte_internal
uint16_t qbman_result_DQ_seqnum(const struct qbman_result *dq);

/**
 * qbman_result_DQ_odpid() - Get the seqnum field in dequeue response
 * odpid is valid only if ODPVALID flag is TRUE.
 * @dq: the dequeue result.
 *
 * Return odpid.
 */
__rte_internal
uint16_t qbman_result_DQ_odpid(const struct qbman_result *dq);

/**
 * qbman_result_DQ_fqid() - Get the fqid in dequeue response
 * @dq: the dequeue result.
 *
 * Return fqid.
 */
uint32_t qbman_result_DQ_fqid(const struct qbman_result *dq);

/**
 * qbman_result_DQ_byte_count() - Get the byte count in dequeue response
 * @dq: the dequeue result.
 *
 * Return the byte count remaining in the FQ.
 */
uint32_t qbman_result_DQ_byte_count(const struct qbman_result *dq);

/**
 * qbman_result_DQ_frame_count - Get the frame count in dequeue response
 * @dq: the dequeue result.
 *
 * Return the frame count remaining in the FQ.
 */
uint32_t qbman_result_DQ_frame_count(const struct qbman_result *dq);

/**
 * qbman_result_DQ_fqd_ctx() - Get the frame queue context in dequeue response
 * @dq: the dequeue result.
 *
 * Return the frame queue context.
 */
__rte_internal
uint64_t qbman_result_DQ_fqd_ctx(const struct qbman_result *dq);

/**
 * qbman_result_DQ_fd() - Get the frame descriptor in dequeue response
 * @dq: the dequeue result.
 *
 * Return the frame descriptor.
 */
__rte_internal
const struct qbman_fd *qbman_result_DQ_fd(const struct qbman_result *dq);

/* State-change notifications (FQDAN/CDAN/CSCN/...). */

/**
 * qbman_result_SCN_state() - Get the state field in State-change notification
 * @scn: the state change notification.
 *
 * Return the state in the notification.
 */
__rte_internal
uint8_t qbman_result_SCN_state(const struct qbman_result *scn);

/**
 * qbman_result_SCN_rid() - Get the resource id from the notification
 * @scn: the state change notification.
 *
 * Return the resource id.
 */
uint32_t qbman_result_SCN_rid(const struct qbman_result *scn);

/**
 * qbman_result_SCN_ctx() - get the context from the notification
 * @scn: the state change notification.
 *
 * Return the context.
 */
uint64_t qbman_result_SCN_ctx(const struct qbman_result *scn);

/* Type-specific "resource IDs". Mainly for illustration purposes, though it
 * also gives the appropriate type widths.
 */
/* Get the FQID from the FQDAN */
#define qbman_result_FQDAN_fqid(dq) qbman_result_SCN_rid(dq)
/* Get the FQID from the FQRN */
#define qbman_result_FQRN_fqid(dq) qbman_result_SCN_rid(dq)
/* Get the FQID from the FQRNI */
#define qbman_result_FQRNI_fqid(dq) qbman_result_SCN_rid(dq)
/* Get the FQID from the FQPN */
#define qbman_result_FQPN_fqid(dq) qbman_result_SCN_rid(dq)
/* Get the channel ID from the CDAN */
#define qbman_result_CDAN_cid(dq) ((uint16_t)qbman_result_SCN_rid(dq))
/* Get the CGID from the CSCN */
#define qbman_result_CSCN_cgid(dq) ((uint16_t)qbman_result_SCN_rid(dq))

/**
 * qbman_result_bpscn_bpid() - Get the bpid from BPSCN
 * @scn: the state change notification.
 *
 * Return the buffer pool id.
 */
uint16_t qbman_result_bpscn_bpid(const struct qbman_result *scn);

/**
 * qbman_result_bpscn_has_free_bufs() - Check whether there are free
 * buffers in the pool from BPSCN.
 * @scn: the state change notification.
 *
 * Return the number of free buffers.
 */
int qbman_result_bpscn_has_free_bufs(const struct qbman_result *scn);

/**
 * qbman_result_bpscn_is_depleted() - Check BPSCN to see whether the
 * buffer pool is depleted.
 * @scn: the state change notification.
 *
 * Return the status of buffer pool depletion.
 */
int qbman_result_bpscn_is_depleted(const struct qbman_result *scn);

/**
 * qbman_result_bpscn_is_surplus() - Check BPSCN to see whether the buffer
 * pool is surplus or not.
 * @scn: the state change notification.
 *
 * Return the status of buffer pool surplus.
 */
int qbman_result_bpscn_is_surplus(const struct qbman_result *scn);

/**
 * qbman_result_bpscn_ctx() - Get the BPSCN CTX from BPSCN message
 * @scn: the state change notification.
 *
 * Return the BPSCN context.
 */
uint64_t qbman_result_bpscn_ctx(const struct qbman_result *scn);

/* Parsing CGCU */
/**
 * qbman_result_cgcu_cgid() - Check CGCU resource id, i.e. cgid
 * @scn: the state change notification.
 *
 * Return the CGCU resource id.
 */
uint16_t qbman_result_cgcu_cgid(const struct qbman_result *scn);

/**
 * qbman_result_cgcu_icnt() - Get the I_CNT from CGCU
 * @scn: the state change notification.
 *
 * Return instantaneous count in the CGCU notification.
 */
uint64_t qbman_result_cgcu_icnt(const struct qbman_result *scn);

	/************/
	/* Enqueues */
	/************/
/* struct qbman_eq_desc - structure of enqueue descriptor */
struct qbman_eq_desc {
	union {
		uint32_t dont_manipulate_directly[8];
		struct eq {
			uint8_t verb;
			uint8_t dca;
			uint16_t seqnum;
			uint16_t orpid;
			uint16_t reserved1;
			uint32_t tgtid;
			uint32_t tag;
			uint16_t qdbin;
			uint8_t qpri;
			uint8_t reserved[3];
			uint8_t wae;
			uint8_t rspid;
			uint64_t rsp_addr;
		} eq;
	};
};

/**
 * struct qbman_eq_response - structure of enqueue response
 * @dont_manipulate_directly: the 16 32bit data to represent the whole
 * enqueue response.
 */
struct qbman_eq_response {
	uint32_t dont_manipulate_directly[16];
};

/**
 * qbman_eq_desc_clear() - Clear the contents of a descriptor to
 * default/starting state.
 * @d: the given enqueue descriptor.
 */
__rte_internal
void qbman_eq_desc_clear(struct qbman_eq_desc *d);

/* Exactly one of the following descriptor "actions" should be set. (Calling
 * any one of these will replace the effect of any prior call to one of these.)
 * - enqueue without order-restoration
 * - enqueue with order-restoration
 * - fill a hole in the order-restoration sequence, without any enqueue
 * - advance NESN (Next Expected Sequence Number), without any enqueue
 * 'respond_success' indicates whether an enqueue response should be DMA'd
 * after success (otherwise a response is DMA'd only after failure).
 * 'incomplete' indicates that other fragments of the same 'seqnum' are yet to
 * be enqueued.
 */

/**
 * qbman_eq_desc_set_no_orp() - Set enqueue descriptor without orp
 * @d: the enqueue descriptor.
 * @response_success: 1 = enqueue with response always; 0 = enqueue with
 * rejections returned on a FQ.
 */
__rte_internal
void qbman_eq_desc_set_no_orp(struct qbman_eq_desc *d, int respond_success);
/**
 * qbman_eq_desc_set_orp() - Set order-restoration in the enqueue descriptor
 * @d: the enqueue descriptor.
 * @response_success: 1 = enqueue with response always; 0 = enqueue with
 * rejections returned on a FQ.
 * @opr_id: the order point record id.
 * @seqnum: the order restoration sequence number.
 * @incomplete: indicates whether this is the last fragments using the same
 * sequence number.
 */
__rte_internal
void qbman_eq_desc_set_orp(struct qbman_eq_desc *d, int respond_success,
			   uint16_t opr_id, uint16_t seqnum, int incomplete);

/**
 * qbman_eq_desc_set_orp_hole() - fill a hole in the order-restoration sequence
 * without any enqueue
 * @d: the enqueue descriptor.
 * @opr_id: the order point record id.
 * @seqnum: the order restoration sequence number.
 */
void qbman_eq_desc_set_orp_hole(struct qbman_eq_desc *d, uint16_t opr_id,
				uint16_t seqnum);

/**
 * qbman_eq_desc_set_orp_nesn() -  advance NESN (Next Expected Sequence Number)
 * without any enqueue
 * @d: the enqueue descriptor.
 * @opr_id: the order point record id.
 * @seqnum: the order restoration sequence number.
 */
void qbman_eq_desc_set_orp_nesn(struct qbman_eq_desc *d, uint16_t opr_id,
				uint16_t seqnum);
/**
 * qbman_eq_desc_set_response() - Set the enqueue response info.
 * @d: the enqueue descriptor
 * @storage_phys: the physical address of the enqueue response in memory.
 * @stash: indicate that the write allocation enabled or not.
 *
 * In the case where an enqueue response is DMA'd, this determines where that
 * response should go. (The physical/DMA address is given for hardware's
 * benefit, but software should interpret it as a "struct qbman_eq_response"
 * data structure.) 'stash' controls whether or not the write to main-memory
 * expresses a cache-warming attribute.
 */
__rte_internal
void qbman_eq_desc_set_response(struct qbman_eq_desc *d,
				uint64_t storage_phys,
				int stash);

/**
 * qbman_eq_desc_set_token() - Set token for the enqueue command
 * @d: the enqueue descriptor
 * @token: the token to be set.
 *
 * token is the value that shows up in an enqueue response that can be used to
 * detect when the results have been published. The easiest technique is to zero
 * result "storage" before issuing an enqueue, and use any non-zero 'token'
 * value.
 */
__rte_internal
void qbman_eq_desc_set_token(struct qbman_eq_desc *d, uint8_t token);

/**
 * Exactly one of the following descriptor "targets" should be set. (Calling any
 * one of these will replace the effect of any prior call to one of these.)
 * - enqueue to a frame queue
 * - enqueue to a queuing destination
 * Note, that none of these will have any affect if the "action" type has been
 * set to "orp_hole" or "orp_nesn".
 */
/**
 * qbman_eq_desc_set_fq() - Set Frame Queue id for the enqueue command
 * @d: the enqueue descriptor
 * @fqid: the id of the frame queue to be enqueued.
 */
__rte_internal
void qbman_eq_desc_set_fq(struct qbman_eq_desc *d, uint32_t fqid);

/**
 * qbman_eq_desc_set_qd() - Set Queuing Destination for the enqueue command.
 * @d: the enqueue descriptor
 * @qdid: the id of the queuing destination to be enqueued.
 * @qd_bin: the queuing destination bin
 * @qd_prio: the queuing destination priority.
 */
__rte_internal
void qbman_eq_desc_set_qd(struct qbman_eq_desc *d, uint32_t qdid,
			  uint16_t qd_bin, uint8_t qd_prio);

/**
 * qbman_eq_desc_set_eqdi() - enable/disable EQDI interrupt
 * @d: the enqueue descriptor
 * @enable: boolean to enable/disable EQDI
 *
 * Determines whether or not the portal's EQDI interrupt source should be
 * asserted after the enqueue command is completed.
 */
void qbman_eq_desc_set_eqdi(struct qbman_eq_desc *d, int enable);

/**
 * qbman_eq_desc_set_dca() - Set DCA mode in the enqueue command.
 * @d: the enqueue descriptor.
 * @enable: enabled/disable DCA mode.
 * @dqrr_idx: DCAP_CI, the DCAP consumer index.
 * @park: determine the whether park the FQ or not
 *
 * Determines whether or not a portal DQRR entry should be consumed once the
 * enqueue command is completed. (And if so, and the DQRR entry corresponds to a
 * held-active (order-preserving) FQ, whether the FQ should be parked instead of
 * being rescheduled.)
 */
__rte_internal
void qbman_eq_desc_set_dca(struct qbman_eq_desc *d, int enable,
			   uint8_t dqrr_idx, int park);

/**
 * qbman_result_eqresp_fd() - Get fd from enqueue response.
 * @eqresp: enqueue response.
 *
 * Return the fd pointer.
 */
__rte_internal
struct qbman_fd *qbman_result_eqresp_fd(struct qbman_result *eqresp);

/**
 * qbman_result_eqresp_set_rspid() - Set the response id in enqueue response.
 * @eqresp: enqueue response.
 * @val: values to set into the response id.
 *
 * This value is set into the response id before the enqueue command, which,
 * get overwritten by qbman once the enqueue command is complete.
 */
__rte_internal
void qbman_result_eqresp_set_rspid(struct qbman_result *eqresp, uint8_t val);

/**
 * qbman_result_eqresp_rspid() - Get the response id.
 * @eqresp: enqueue response.
 *
 * Return the response id.
 *
 * At the time of enqueue user provides the response id. Response id gets
 * copied into the enqueue response to determine if the command has been
 * completed, and response has been updated.
 */
__rte_internal
uint8_t qbman_result_eqresp_rspid(struct qbman_result *eqresp);

/**
 * qbman_result_eqresp_rc() - determines if enqueue command is successful.
 * @eqresp: enqueue response.
 *
 * Return 0 when command is successful.
 */
__rte_internal
uint8_t qbman_result_eqresp_rc(struct qbman_result *eqresp);

/**
 * qbman_swp_enqueue() - Issue an enqueue command.
 * @s: the software portal used for enqueue.
 * @d: the enqueue descriptor.
 * @fd: the frame descriptor to be enqueued.
 *
 * Please note that 'fd' should only be NULL if the "action" of the
 * descriptor is "orp_hole" or "orp_nesn".
 *
 * Return 0 for a successful enqueue, -EBUSY if the EQCR is not ready.
 */
int qbman_swp_enqueue(struct qbman_swp *s, const struct qbman_eq_desc *d,
		      const struct qbman_fd *fd);
/**
 * qbman_swp_enqueue_multiple() - Enqueue multiple frames with same
				  eq descriptor
 * @s: the software portal used for enqueue.
 * @d: the enqueue descriptor.
 * @fd: the frame descriptor to be enqueued.
 * @flags: bit-mask of QBMAN_ENQUEUE_FLAG_*** options
 * @num_frames: the number of the frames to be enqueued.
 *
 * Return the number of enqueued frames, -EBUSY if the EQCR is not ready.
 */
__rte_internal
int qbman_swp_enqueue_multiple(struct qbman_swp *s,
			       const struct qbman_eq_desc *d,
			       const struct qbman_fd *fd,
			       uint32_t *flags,
			       int num_frames);

/**
 * qbman_swp_enqueue_multiple_fd() - Enqueue multiple frames with same
				  eq descriptor
 * @s: the software portal used for enqueue.
 * @d: the enqueue descriptor.
 * @fd: the frame descriptor to be enqueued.
 * @flags: bit-mask of QBMAN_ENQUEUE_FLAG_*** options
 * @num_frames: the number of the frames to be enqueued.
 *
 * Return the number of enqueued frames, -EBUSY if the EQCR is not ready.
 */
__rte_internal
int qbman_swp_enqueue_multiple_fd(struct qbman_swp *s,
				  const struct qbman_eq_desc *d,
				  struct qbman_fd **fd,
				  uint32_t *flags,
				  int num_frames);

/**
 * qbman_swp_enqueue_multiple_desc() - Enqueue multiple frames with
 *				       individual eq descriptor.
 * @s: the software portal used for enqueue.
 * @d: the enqueue descriptor.
 * @fd: the frame descriptor to be enqueued.
 * @num_frames: the number of the frames to be enqueued.
 *
 * Return the number of enqueued frames, -EBUSY if the EQCR is not ready.
 */
__rte_internal
int qbman_swp_enqueue_multiple_desc(struct qbman_swp *s,
				    const struct qbman_eq_desc *d,
				    const struct qbman_fd *fd,
				    int num_frames);

/* TODO:
 * qbman_swp_enqueue_thresh() - Set threshold for EQRI interrupt.
 * @s: the software portal.
 * @thresh: the threshold to trigger the EQRI interrupt.
 *
 * An EQRI interrupt can be generated when the fill-level of EQCR falls below
 * the 'thresh' value set here. Setting thresh==0 (the default) disables.
 */
int qbman_swp_enqueue_thresh(struct qbman_swp *s, unsigned int thresh);

	/*******************/
	/* Buffer releases */
	/*******************/
/**
 * struct qbman_release_desc - The structure for buffer release descriptor
 * @dont_manipulate_directly: the 32bit data to represent the whole
 * possible settings of qbman release descriptor.
 */
struct qbman_release_desc {
	union {
		uint32_t dont_manipulate_directly[16];
		struct br {
			uint8_t verb;
			uint8_t reserved;
			uint16_t bpid;
			uint32_t reserved2;
			uint64_t buf[7];
		} br;
	};
};

/**
 * qbman_release_desc_clear() - Clear the contents of a descriptor to
 * default/starting state.
 * @d: the qbman release descriptor.
 */
__rte_internal
void qbman_release_desc_clear(struct qbman_release_desc *d);

/**
 * qbman_release_desc_set_bpid() - Set the ID of the buffer pool to release to
 * @d: the qbman release descriptor.
 */
__rte_internal
void qbman_release_desc_set_bpid(struct qbman_release_desc *d, uint16_t bpid);

/**
 * qbman_release_desc_set_rcdi() - Determines whether or not the portal's RCDI
 * interrupt source should be asserted after the release command is completed.
 * @d: the qbman release descriptor.
 */
void qbman_release_desc_set_rcdi(struct qbman_release_desc *d, int enable);

/**
 * qbman_swp_release() - Issue a buffer release command.
 * @s: the software portal object.
 * @d: the release descriptor.
 * @buffers: a pointer pointing to the buffer address to be released.
 * @num_buffers: number of buffers to be released,  must be less than 8.
 *
 * Return 0 for success, -EBUSY if the release command ring is not ready.
 */
__rte_internal
int qbman_swp_release(struct qbman_swp *s, const struct qbman_release_desc *d,
		      const uint64_t *buffers, unsigned int num_buffers);

/* TODO:
 * qbman_swp_release_thresh() - Set threshold for RCRI interrupt
 * @s: the software portal.
 * @thresh: the threshold.
 * An RCRI interrupt can be generated when the fill-level of RCR falls below
 * the 'thresh' value set here. Setting thresh==0 (the default) disables.
 */
int qbman_swp_release_thresh(struct qbman_swp *s, unsigned int thresh);

	/*******************/
	/* Buffer acquires */
	/*******************/
/**
 * qbman_swp_acquire() - Issue a buffer acquire command.
 * @s: the software portal object.
 * @bpid: the buffer pool index.
 * @buffers: a pointer pointing to the acquired buffer address|es.
 * @num_buffers: number of buffers to be acquired, must be less than 8.
 *
 * Return 0 for success, or negative error code if the acquire command
 * fails.
 */
__rte_internal
int qbman_swp_acquire(struct qbman_swp *s, uint16_t bpid, uint64_t *buffers,
		      unsigned int num_buffers);

	/*****************/
	/* FQ management */
	/*****************/
/**
 * qbman_swp_fq_schedule() - Move the fq to the scheduled state.
 * @s: the software portal object.
 * @fqid: the index of frame queue to be scheduled.
 *
 * There are a couple of different ways that a FQ can end up parked state,
 * This schedules it.
 *
 * Return 0 for success, or negative error code for failure.
 */
int qbman_swp_fq_schedule(struct qbman_swp *s, uint32_t fqid);

/**
 * qbman_swp_fq_force() - Force the FQ to fully scheduled state.
 * @s: the software portal object.
 * @fqid: the index of frame queue to be forced.
 *
 * Force eligible will force a tentatively-scheduled FQ to be fully-scheduled
 * and thus be available for selection by any channel-dequeuing behaviour (push
 * or pull). If the FQ is subsequently "dequeued" from the channel and is still
 * empty at the time this happens, the resulting dq_entry will have no FD.
 * (qbman_result_DQ_fd() will return NULL.)
 *
 * Return 0 for success, or negative error code for failure.
 */
int qbman_swp_fq_force(struct qbman_swp *s, uint32_t fqid);

/**
 * These functions change the FQ flow-control stuff between XON/XOFF. (The
 * default is XON.) This setting doesn't affect enqueues to the FQ, just
 * dequeues. XOFF FQs will remain in the tentatively-scheduled state, even when
 * non-empty, meaning they won't be selected for scheduled dequeuing. If a FQ is
 * changed to XOFF after it had already become truly-scheduled to a channel, and
 * a pull dequeue of that channel occurs that selects that FQ for dequeuing,
 * then the resulting dq_entry will have no FD. (qbman_result_DQ_fd() will
 * return NULL.)
 */
/**
 * qbman_swp_fq_xon() - XON the frame queue.
 * @s: the software portal object.
 * @fqid: the index of frame queue.
 *
 * Return 0 for success, or negative error code for failure.
 */
int qbman_swp_fq_xon(struct qbman_swp *s, uint32_t fqid);
/**
 * qbman_swp_fq_xoff() - XOFF the frame queue.
 * @s: the software portal object.
 * @fqid: the index of frame queue.
 *
 * Return 0 for success, or negative error code for failure.
 */
int qbman_swp_fq_xoff(struct qbman_swp *s, uint32_t fqid);

	/**********************/
	/* Channel management */
	/**********************/

/**
 * If the user has been allocated a channel object that is going to generate
 * CDANs to another channel, then these functions will be necessary.
 * CDAN-enabled channels only generate a single CDAN notification, after which
 * it they need to be reenabled before they'll generate another. (The idea is
 * that pull dequeuing will occur in reaction to the CDAN, followed by a
 * reenable step.) Each function generates a distinct command to hardware, so a
 * combination function is provided if the user wishes to modify the "context"
 * (which shows up in each CDAN message) each time they reenable, as a single
 * command to hardware.
 */

/**
 * qbman_swp_CDAN_set_context() - Set CDAN context
 * @s: the software portal object.
 * @channelid: the channel index.
 * @ctx: the context to be set in CDAN.
 *
 * Return 0 for success, or negative error code for failure.
 */
int qbman_swp_CDAN_set_context(struct qbman_swp *s, uint16_t channelid,
			       uint64_t ctx);

/**
 * qbman_swp_CDAN_enable() - Enable CDAN for the channel.
 * @s: the software portal object.
 * @channelid: the index of the channel to generate CDAN.
 *
 * Return 0 for success, or negative error code for failure.
 */
int qbman_swp_CDAN_enable(struct qbman_swp *s, uint16_t channelid);

/**
 * qbman_swp_CDAN_disable() - disable CDAN for the channel.
 * @s: the software portal object.
 * @channelid: the index of the channel to generate CDAN.
 *
 * Return 0 for success, or negative error code for failure.
 */
int qbman_swp_CDAN_disable(struct qbman_swp *s, uint16_t channelid);

/**
 * qbman_swp_CDAN_set_context_enable() - Set CDAN contest and enable CDAN
 * @s: the software portal object.
 * @channelid: the index of the channel to generate CDAN.
 * @ctx: the context set in CDAN.
 *
 * Return 0 for success, or negative error code for failure.
 */
int qbman_swp_CDAN_set_context_enable(struct qbman_swp *s, uint16_t channelid,
				      uint64_t ctx);
#endif /* !_FSL_QBMAN_PORTAL_H */


text:
using System;
using System.Collections;
using UnityEngine;

public class ProgressBar : MonoBehaviour
{
	#region Private Fields

	bool  previouslyEmpty;
	bool  previouslyFull;
	float val;

	#endregion

	#region Public Properties

	public float  End        { get; private set; }
	public float  Magnitude  { get { return Value / End; } }

	public float Value
	{
		get
		{ return val; }
		set
		{
			val = Mathf.Clamp(value, 0, End);
		}
	}

	public float Visibility { get; set; }

	#endregion

	#region Private Properties

	SpriteRenderer BarBaseRenderer { get; set; }
	SpriteRenderer BarRenderer { get; set; }
	Transform BarTransform { get; set; }
	Gradient ColorGradient { get; set; }

	#endregion

	#region Private Methods

	void Awake()
	{
		BarBaseRenderer = GetComponent<SpriteRenderer>();
		BarRenderer = transform.FindChild("ProgressBar").gameObject.GetComponent<SpriteRenderer>();
		BarTransform = BarRenderer.transform;
		{
			ColorGradient = new Gradient();
			var colorKeys = new GradientColorKey[4];
			colorKeys[0].color = Color.red;
			colorKeys[0].time = 0f;
			colorKeys[1].color = Color.yellow;
			colorKeys[1].time = 0.3f;
			colorKeys[2].color = Color.green;
			colorKeys[2].time = 0.9f;
			colorKeys[3].color = Color.blue;
			colorKeys[3].time = 1f;
			var alphaKeys = new GradientAlphaKey[1];
			alphaKeys[0].alpha = 1;
			alphaKeys[0].time = 0;
			ColorGradient.SetKeys(colorKeys, alphaKeys);
		}
		End = 100;
		Value = 33;
	}

	void Start()
	{
	}

	void Update()
	{

		float root = -0.065f;
		root += Magnitude * 0.065f;
		BarTransform.localPosition = new Vector3(root, 0, 0);
		BarTransform.localScale = new Vector3(Magnitude, 1, 1);
		Color c = ColorGradient.Evaluate(Magnitude);
		c.a = Visibility;
		BarRenderer.color = c;

		BarBaseRenderer.color = new Color(0, 0, 0, Visibility);
	}

	#endregion
}


text:
package net.will_co21.application.googleAPIImageSearch;

public class ThumbnailSize {
	public static final int width = 152;
	public static final int height = 152;
}


text:
<resources>

    <style name="Exponential.Theme.Light" parent="Exponential.Theme.Base">
    </style>

    <style name="Exponential.Theme.Base" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="colorPrimary">@color/primary</item>
        <item name="colorPrimaryDark">@color/primary_dark</item>
        <item name="colorAccent">@color/accent</item>
        <item name="android:windowBackground">@color/window_background</item>
    </style>

</resources>


text:
@interface XCSymbolicatorHolder : NSObject
{
    struct _CSTypeRef _symbolicator;
}

@property struct _CSTypeRef symbolicator; // @synthesize symbolicator=_symbolicator;

@end


text:
Digging for data in a story
========================================================
author: Andrew Tran
date: September 16, 2015

**Welcome to class 3**

Internships!
========================================================

It's that time of the season to start applying

- [NYU Journalism internship, job listings ](http://journalism.nyu.edu/career-services/job-and-internship-listings/)
- [Data Journalism Jobs](http://datajournalismjobs.com/)
- [Data Journalism Jobs - Silk](http://data-journalism-jobs.silk.co/)

DO YOUR WORK
========================================================

[Seriously, do your homework](http://projects.ctmirror.org/tools/chart/charts/Doyourwork-3-8-2015-87298.html)

Spotlight
========================================================

[movie](https://www.youtube.com/watch?v=EwdCIpbTN5g)


text:
<meta charset="utf-8">

<meta name="description" content="Set of Polymer components to create modular, elegant and simple wireframes ">
<meta name="author" content="Xaviju">

<script src="../bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>

<link rel="import" href="../components/polymux-app.html">
<!-- Add external stylsheets -->
<link href="https://fonts.googleapis.com/css?family=Kalam:400,700" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="../bower_components/normalize-css/normalize.css">
<link rel="stylesheet" href="../styles/style.css">


text:
package unit

import (
	"bufio"
	"bytes"
	"errors"
	"fmt"
	"io"
	"strings"
	"unicode"
)

// Deserialize parses a systemd unit file into a list of UnitOption objects.
func Deserialize(f io.Reader) (opts []*UnitOption, err error) {
	lexer, optchan, errchan := newLexer(f)
	go lexer.lex()

	for opt := range optchan {
		opts = append(opts, &(*opt))
	}

	err = <-errchan
	return opts, err
}

func newLexer(f io.Reader) (*lexer, <-chan *UnitOption, <-chan error) {
	optchan := make(chan *UnitOption)
	errchan := make(chan error, 1)
	buf := bufio.NewReader(f)

	return &lexer{buf, optchan, errchan, ""}, optchan, errchan
}

type lexer struct {
	buf     *bufio.Reader
	optchan chan *UnitOption
	errchan chan error
	section string
}

func (l *lexer) lex() {
	var err error
	next := l.lexNextSection
	for next != nil {
		next, err = next()
		if err != nil {
			l.errchan <- err
			break
		}
	}

	close(l.optchan)
	close(l.errchan)
}

type lexStep func() (lexStep, error)

func (l *lexer) lexSectionName() (lexStep, error) {
	sec, err := l.buf.ReadBytes(']')
	if err != nil {
		return nil, errors.New("unable to find end of section")
	}

	return l.lexSectionSuffixFunc(string(sec[:len(sec)-1])), nil
}

func (l *lexer) lexSectionSuffixFunc(section string) lexStep {
	return func() (lexStep, error) {
		garbage, err := l.toEOL()
		if err != nil {
			return nil, err
		}

		garbage = bytes.TrimSpace(garbage)
		if len(garbage) > 0 {
			return nil, fmt.Errorf("found garbage after section name %s: %v", l.section, garbage)
		}

		return l.lexNextSectionOrOptionFunc(section), nil
	}
}

func (l *lexer) ignoreLineFunc(next lexStep) lexStep {
	return func() (lexStep, error) {
		for {
			line, err := l.toEOL()
			if err != nil {
				return nil, err
			}

			line = bytes.TrimSuffix(line, []byte{' '})

			// lack of continuation means this line has been exhausted
			if !bytes.HasSuffix(line, []byte{'\\'}) {
				break
			}
		}

		// reached end of buffer, safe to exit
		return next, nil
	}
}

func (l *lexer) lexNextSection() (lexStep, error) {
	r, _, err := l.buf.ReadRune()
	if err != nil {
		if err == io.EOF {
			err = nil
		}
		return nil, err
	}

	if r == '[' {
		return l.lexSectionName, nil
	} else if isComment(r) {
		return l.ignoreLineFunc(l.lexNextSection), nil
	}

	return l.lexNextSection, nil
}

func (l *lexer) lexNextSectionOrOptionFunc(section string) lexStep {
	return func() (lexStep, error) {
		r, _, err := l.buf.ReadRune()
		if err != nil {
			if err == io.EOF {
				err = nil
			}
			return nil, err
		}

		if unicode.IsSpace(r) {
			return l.lexNextSectionOrOptionFunc(section), nil
		} else if r == '[' {
			return l.lexSectionName, nil
		} else if isComment(r) {
			return l.ignoreLineFunc(l.lexNextSectionOrOptionFunc(section)), nil
		}

		l.buf.UnreadRune()
		return l.lexOptionNameFunc(section), nil
	}
}

func (l *lexer) lexOptionNameFunc(section string) lexStep {
	return func() (lexStep, error) {
		var partial bytes.Buffer
		for {
			r, _, err := l.buf.ReadRune()
			if err != nil {
				return nil, err
			}

			if r == '\n' || r == '\r' {
				return nil, errors.New("unexpected newline encountered while parsing option name")
			}

			if r == '=' {
				break
			}

			partial.WriteRune(r)
		}

		name := strings.TrimSpace(partial.String())
		return l.lexOptionValueFunc(section, name), nil
	}
}

func (l *lexer) lexOptionValueFunc(section, name string) lexStep {
	return func() (lexStep, error) {
		var partial bytes.Buffer

		for {
			line, err := l.toEOL()
			if err != nil {
				return nil, err
			}

			// lack of continuation means this value has been exhausted
			idx := bytes.LastIndex(line, []byte{'\\'})
			if idx == -1 || idx != (len(line)-1) {
				partial.Write(line)
				break
			}

			partial.Write(line[0:idx])
			partial.WriteRune(' ')
		}

		val := strings.TrimSpace(partial.String())
		l.optchan <- &UnitOption{Section: section, Name: name, Value: val}

		return l.lexNextSectionOrOptionFunc(section), nil
	}
}

func (l *lexer) toEOL() ([]byte, error) {
	line, err := l.buf.ReadBytes('\n')
	// ignore EOF here since it's roughly equivalent to EOL
	if err != nil && err != io.EOF {
		return nil, err
	}

	line = bytes.TrimSuffix(line, []byte{'\r'})
	line = bytes.TrimSuffix(line, []byte{'\n'})

	return line, nil
}

func isComment(r rune) bool {
	return r == '#' || r == ';'
}


text:
module MiniTest
  raise 'Dominance for minitest/spec needs minitest/spec to be loaded' unless const_defined?(:Spec)

  # Add some functionality to minitest/spec.
  class Spec
    @@descendants = []

    # New it! method that dominates one test.
    # Could be implemented better.
    def self.it! *args, &block
      # First we need to nuke all test methods that were already defined.
      @@descendants.each(&:nuke_test_methods!)
      @@descendants = []
      # Now define the test method for the dominating test.
      self.it *args, &block
      # Now make sure that no test will be defined anymore by overwriting `it`.
      MiniTest::Spec.class_eval do
        def self.it *args, &block
          # Empty on purpose.
        end
      end
    end

    # We need to gather all descendants of Minitest::Spec in case their tests need to be nuked.
    def self.inherited test_class
      super
      @@descendants << test_class
    end
  end
end


text:
@interface ViewController ()

@property (nonatomic, strong) GMSMapView *mapView;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)mapViewInit {
    GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86
                                                            longitude:151.20
                                                                 zoom:6];

    _mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera];
    _mapView.myLocationEnabled = YES;
    self.view = _mapView;

    GMSMarker *marker = [[GMSMarker alloc] init];
    marker.position = CLLocationCoordinate2DMake(-33.86, 151.20);
    marker.title = @"Syndey";
    marker.snippet = @"Australia";
    marker.map = _mapView;
}

@end