text
stringlengths 2
1.04M
| meta
dict |
---|---|
module Minitest
module Reporters
class DelegateReporter
def initialize(reporters, options = {})
@reporters = reporters
@options = options
@all_reporters = nil
end
def start
all_reporters.each(&:start)
end
def record(result)
all_reporters.each do |reporter|
reporter.record result
end
end
def report
all_reporters.each(&:report)
end
def passed?
all_reporters.all?(&:passed?)
end
private
# stolen from minitest self.run
def total_count(options)
filter = options[:filter] || '/./'
filter = Regexp.new $1 if filter =~ /\/(.*)\//
Minitest::Runnable.runnables.map(&:runnable_methods).flatten.find_all { |m|
filter === m || filter === "#{self}##{m}"
}.size
end
def all_reporters
@all_reporters ||= init_all_reporters
end
def init_all_reporters
return @reporters unless defined?(Minitest::Reporters.reporters) && Minitest::Reporters.reporters
(Minitest::Reporters.reporters + guard_reporter(@reporters)).each do |reporter|
reporter.io = @options[:io]
if reporter.respond_to?(:add_defaults)
reporter.add_defaults(@options.merge(:total_count => total_count(@options)))
end
end
end
def guard_reporter(reporters)
guards = Array(reporters.detect { |r| r.class.name == "Guard::Minitest::Reporter" })
return guards unless ENV['RM_INFO']
warn 'RM_INFO is set thus guard reporter has been dropped' unless guards.empty?
[]
end
end
end
class << self
def plugin_minitest_reporter_init(options)
reporter.reporters = [Minitest::Reporters::DelegateReporter.new(reporter.reporters, options)]
end
end
end
| {
"content_hash": "fc1efc985230633916d526867e328eca",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 105,
"avg_line_length": 27.397058823529413,
"alnum_prop": 0.595276435856146,
"repo_name": "ralzate/NuevoAeroSanidad",
"id": "23bcef981a32a322a03a8812453798b9a7e77ba5",
"size": "1863",
"binary": false,
"copies": "10",
"ref": "refs/heads/master",
"path": "vendor/bundle/ruby/2.1.0/gems/minitest-reporters-1.1.4/lib/minitest/minitest_reporter_plugin.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "6203"
},
{
"name": "CoffeeScript",
"bytes": "3217"
},
{
"name": "HTML",
"bytes": "1347045"
},
{
"name": "JavaScript",
"bytes": "14724"
},
{
"name": "Ruby",
"bytes": "354767"
}
],
"symlink_target": ""
} |
Rails.application.routes.draw do
resources :boxes, only: %i(create show edit update destroy) do
get :download, on: :member
get :default, on: :collection
end
post 'configurations/for_gemfile'
root to: 'dashboard#show'
end
| {
"content_hash": "c1e8fa1f2108ee63d9656ed5ce2a15d3",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 64,
"avg_line_length": 23.9,
"alnum_prop": 0.7112970711297071,
"repo_name": "andreychernih/railsbox",
"id": "2af54518e583b1163569f7e531127bcb37b5101d",
"size": "239",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "config/routes.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2750"
},
{
"name": "CoffeeScript",
"bytes": "11318"
},
{
"name": "Go",
"bytes": "8908"
},
{
"name": "HTML",
"bytes": "56295"
},
{
"name": "JavaScript",
"bytes": "1115"
},
{
"name": "Python",
"bytes": "1347"
},
{
"name": "Ruby",
"bytes": "102121"
},
{
"name": "Shell",
"bytes": "855"
}
],
"symlink_target": ""
} |
<?php
namespace ZFTest\Hal\TestAsset;
use Zend\Stdlib\JsonSerializable as JsonSerializableInterface;
/**
* @subpackage UnitTest
*/
class JsonSerializable implements JsonSerializableInterface
{
public function jsonSerialize()
{
return array('foo' => 'bar');
}
}
| {
"content_hash": "9e9ca9c9939be2eb6ea30fc331048c2a",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 62,
"avg_line_length": 16.88235294117647,
"alnum_prop": 0.710801393728223,
"repo_name": "crysthianophp/RollnApi",
"id": "481da58a67c4eeebd55386f83ceaedc322bb24e5",
"size": "447",
"binary": false,
"copies": "11",
"ref": "refs/heads/master",
"path": "vendor/zfcampus/zf-hal/test/TestAsset/JsonSerializable.php",
"mode": "33261",
"license": "bsd-3-clause",
"language": [
{
"name": "PHP",
"bytes": "33379"
}
],
"symlink_target": ""
} |
import "@angular/common"
import "@angular/core"
import "@angular/forms"
import "@angular/http"
import "@angular/platform-browser"
import "@angular/platform-browser-dynamic"
import "@angular/router"
// RxJS
import "rxjs" | {
"content_hash": "1658a58535ed5494b8851261273f33c0",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 42,
"avg_line_length": 22,
"alnum_prop": 0.759090909090909,
"repo_name": "pabloalonsolopez/footbagent",
"id": "e5e0dcadacc5fda162227abd4407b2b79da58141",
"size": "231",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "client/app/vendor.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "4272"
},
{
"name": "HTML",
"bytes": "310"
},
{
"name": "JavaScript",
"bytes": "4232"
},
{
"name": "TypeScript",
"bytes": "8198"
}
],
"symlink_target": ""
} |
class CreateGameTags < ActiveRecord::Migration[5.0]
def change
create_table :game_tags do |t|
t.references :tag
t.references :game
t.timestamps
end
end
end
| {
"content_hash": "ee8c25aa23956088e19270d10a3fdeeb",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 51,
"avg_line_length": 18.7,
"alnum_prop": 0.6524064171122995,
"repo_name": "bacevedo01/client_game_project",
"id": "a5bc72cff8192fe841dfd330a4864e3dca05ccff",
"size": "187",
"binary": false,
"copies": "1",
"ref": "refs/heads/development",
"path": "db/migrate/20170420215648_create_game_tags.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "3673"
},
{
"name": "HTML",
"bytes": "20073"
},
{
"name": "JavaScript",
"bytes": "1766"
},
{
"name": "Ruby",
"bytes": "63488"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/selected" android:oneshot="false">
<!-- The drawables used here can be solid colors, gradients, shapes, images, etc. -->
<item android:drawable="@drawable/seventh_bg" android:duration="4000" />
<item android:drawable="@drawable/thrid_bg" android:duration="4000" />
<item android:drawable="@drawable/original_state" android:duration="4000" />
<item android:drawable="@drawable/fifth_bg" android:duration="4000" />
</animation-list> | {
"content_hash": "dc062fc22a653854b3a94805c48b5858",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 127,
"avg_line_length": 64.88888888888889,
"alnum_prop": 0.708904109589041,
"repo_name": "weiwenqiang/GitHub",
"id": "bbb07c67f9089a4bbb51b6f7da68d76c61a6428b",
"size": "584",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Login/Flowing-Gradient-master/app/src/main/res/drawable/trans.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "87"
},
{
"name": "C",
"bytes": "42062"
},
{
"name": "C++",
"bytes": "12137"
},
{
"name": "CMake",
"bytes": "202"
},
{
"name": "CSS",
"bytes": "75087"
},
{
"name": "Clojure",
"bytes": "12036"
},
{
"name": "FreeMarker",
"bytes": "21704"
},
{
"name": "Groovy",
"bytes": "55083"
},
{
"name": "HTML",
"bytes": "61549"
},
{
"name": "Java",
"bytes": "42222825"
},
{
"name": "JavaScript",
"bytes": "216823"
},
{
"name": "Kotlin",
"bytes": "24319"
},
{
"name": "Makefile",
"bytes": "19490"
},
{
"name": "Perl",
"bytes": "280"
},
{
"name": "Prolog",
"bytes": "1030"
},
{
"name": "Python",
"bytes": "13032"
},
{
"name": "Scala",
"bytes": "310450"
},
{
"name": "Shell",
"bytes": "27802"
}
],
"symlink_target": ""
} |
using System;
using System.IO;
using System.Collections.Generic;
namespace System.Xml {
//
// IDtdInfo interface
//
/// <summary>
/// This is an interface for a compiled DTD information.
/// It exposes information and functionality that XmlReader need in order to be able
/// to expand entities, add default attributes and correctly normalize attribute values
/// according to their data types.
/// </summary>
internal interface IDtdInfo {
/// <summary>
/// DOCTYPE name
/// </summary>
XmlQualifiedName Name { get; }
/// <summary>
/// Internal DTD subset as specified in the XML document
/// </summary>
string InternalDtdSubset { get; }
/// <summary>
/// Returns true if the DTD contains any declaration of a default attribute
/// </summary>
bool HasDefaultAttributes { get; }
/// <summary>
/// Returns true if the DTD contains any declaration of an attribute
/// whose type is other than CDATA
/// </summary>
bool HasNonCDataAttributes { get; }
/// <summary>
/// Looks up a DTD attribute list definition by its name.
/// </summary>
/// <param name="prefix">The prefix of the attribute list to look for</param>
/// <param name="localName">The local name of the attribute list to look for</param>
/// <returns>Interface representing an attribute list or null if none was found.</returns>
IDtdAttributeListInfo LookupAttributeList(string prefix, string localName);
/// <summary>
/// Returns an enumerator of all attribute lists defined in the DTD.
/// </summary>
IEnumerable<IDtdAttributeListInfo> GetAttributeLists();
/// <summary>
/// Looks up a general DTD entity by its name.
/// </summary>
/// <param name="name">The name of the entity to look for</param>
/// <returns>Interface representing an entity or null if none was found.</returns>
IDtdEntityInfo LookupEntity(string name);
};
//
// IDtdAttributeListInfo interface
//
/// <summary>
/// Exposes information about attributes declared in an attribute list in a DTD
/// that XmlReader need in order to be able to add default attributes
/// and correctly normalize attribute values according to their data types.
/// </summary>
internal interface IDtdAttributeListInfo {
/// <summary>
/// Prefix of an element this attribute list belongs to.
/// </summary>
string Prefix { get; }
/// <summary>
/// Local name of an element this attribute list belongs to.
/// </summary>
string LocalName { get;}
/// <summary>
/// Returns true if the attribute list has some declared attributes with
/// type other than CDATA.
/// </summary>
bool HasNonCDataAttributes { get; }
/// <summary>
/// Looks up a DTD attribute definition by its name.
/// </summary>
/// <param name="prefix">The prefix of the attribute to look for</param>
/// <param name="localName">The local name of the attribute to look for</param>
/// <returns>Interface representing an attribute or null is none was found</returns>
IDtdAttributeInfo LookupAttribute(string prefix, string localName);
/// <summary>
/// Returns enumeration of all default attributes
/// defined in this attribute list.
/// </summary>
/// <returns>Enumerator of default attribute.</returns>
IEnumerable<IDtdDefaultAttributeInfo> LookupDefaultAttributes();
/// <summary>
/// Looks up a ID attribute defined in the attribute list. Returns
/// null if the attribute list does define an ID attribute.
/// </summary>
IDtdAttributeInfo LookupIdAttribute();
}
//
// IDtdAttributeInfo interface
//
/// <summary>
/// Exposes information about an attribute declared in a DTD
/// that XmlReader need in order to be able to correctly normalize
/// the attribute value according to its data types.
/// </summary>
internal interface IDtdAttributeInfo {
/// <summary>
/// The prefix of the attribute
/// </summary>
string Prefix { get; }
/// <summary>
/// The local name of the attribute
/// </summary>
string LocalName { get;}
/// <summary>
/// The line number of the DTD attribute definition
/// </summary>
int LineNumber { get; }
/// <summary>
/// The line position of the DTD attribute definition
/// </summary>
int LinePosition { get; }
/// <summary>
/// Returns true if the attribute is of a different type than CDATA
/// </summary>
bool IsNonCDataType { get; }
/// <summary>
/// Returns true if the attribute was declared in an external DTD subset
/// </summary>
bool IsDeclaredInExternal { get; }
/// <summary>
/// Returns true if the attribute is xml:space or xml:lang
/// </summary>
bool IsXmlAttribute { get; }
}
//
// IDtdDefaultAttributeInfo interface
//
/// <summary>
/// Exposes information about a default attribute
/// declared in a DTD that XmlReader need in order to be able to add
/// this attribute to the XML document (it is not present already)
/// or correctly normalize the attribute value according to its data types.
/// </summary>
internal interface IDtdDefaultAttributeInfo : IDtdAttributeInfo {
/// <summary>
/// The expanded default value of the attribute
/// the consumer assumes that all entity references
/// were already resolved in the value and that the value
/// is correctly normalized.
/// </summary>
string DefaultValueExpanded { get; }
/// <summary>
/// The typed default value of the attribute.
/// </summary>
object DefaultValueTyped { get; } /// <summary>
/// The line number of the default value (in the DTD)
/// </summary>
int ValueLineNumber { get; }
/// <summary>
/// The line position of the default value (in the DTD)
/// </summary>
int ValueLinePosition { get; }
}
//
// IDtdEntityInfo interface
//
/// <summary>
/// Exposes information about a general entity
/// declared in a DTD that XmlReader need in order to be able
/// to expand the entity.
/// </summary>
internal interface IDtdEntityInfo {
/// <summary>
/// The name of the entity
/// </summary>
string Name { get; }
/// <summary>
/// true if the entity is external (its value is in an external input)
/// </summary>
bool IsExternal { get; }
/// <summary>
/// true if the entity was declared in external DTD subset
/// </summary>
bool IsDeclaredInExternal { get; }
/// <summary>
/// true if this is an unparsed entity
/// </summary>
bool IsUnparsedEntity { get; }
/// <summary>
/// true if this is a parameter entity
/// </summary>
bool IsParameterEntity { get; }
/// <summary>
/// The base URI of the entity value
/// </summary>
string BaseUriString { get; }
/// <summary>
/// The URI of the XML document where the entity was declared
/// </summary>
string DeclaredUriString { get; }
/// <summary>
/// SYSTEM identifier (URI) of the entity value - only used for external entities
/// </summary>
string SystemId { get; }
/// <summary>
/// PUBLIC identifier of the entity value - only used for external entities
/// </summary>
string PublicId { get; }
/// <summary>
/// Replacement text of an entity. Valid only for internal entities.
/// </summary>
string Text { get; }
/// <summary>
/// The line number of the entity value
/// </summary>
int LineNumber { get; }
/// <summary>
/// The line position of the entity value
/// </summary>
int LinePosition { get; }
}
}
| {
"content_hash": "620981e3e864871e7c4b40925c133770",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 98,
"avg_line_length": 36.92139737991266,
"alnum_prop": 0.584742755765819,
"repo_name": "esdrubal/referencesource",
"id": "9c3b30d3e2a19c3fbfb8c86c00cd7464ddd4927c",
"size": "8809",
"binary": false,
"copies": "7",
"ref": "refs/heads/mono",
"path": "System.Xml/System/Xml/Core/IDtdInfo.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "155037914"
}
],
"symlink_target": ""
} |
<?php
namespace Vector\Control;
use ReflectionClass;
use ReflectionFunction;
use ReflectionParameter;
use Vector\Core\Exception\IncompletePatternMatchException;
use Vector\Core\Module;
use Vector\Data\Maybe\Nothing;
use Vector\Lib\Arrays;
use Vector\Core\Curry;
abstract class Pattern
{
use Module;
/**
* Get type OR class for params, as well as re-mapping inconsistencies
* @param $param
* @return string
*/
private static function getType($param)
{
$type = is_object($param)
? get_class($param)
: gettype($param);
return $type === 'integer' ? 'int' : $type;
}
/**
* Pattern Matching. Use switch-case for explicit values, this for everything else.
* @param array $patterns
* @return mixed
*/
#[Curry]
protected static function match(array $patterns)
{
return function (...$args) use ($patterns) {
$parameterTypes = array_map(fn($arg) => self::getType($arg), $args);
$keysToValues = Arrays::zip(array_keys($patterns), array_values($patterns));
$val = Arrays::first(
fn ($pattern) => self::patternApplies($parameterTypes, $args, $pattern),
$keysToValues
);
// Can't use Pattern::match here because we lack tail call optimization.
if (get_class($val) === Nothing::class) {
throw new IncompletePatternMatchException(
'Incomplete pattern match expression. (missing ' . implode(', ', $parameterTypes) . ')'
);
}
$matchingPattern = $val->extract()[1];
[$hasExtractable, $unwrappedArgs] = self::unwrapArgs($args);
$value = $matchingPattern(...$args);
$isCallable = is_callable($value);
/**
* Extractable requires a callback to feed args into.
*/
if ($hasExtractable && $isCallable) {
return $matchingPattern(...$args)(...$unwrappedArgs);
}
/**
* No extractable or callable so we can just return the value directly.
*/
return $value;
};
}
/**
* Extracts args from Extractable values
* @param array $args
* @return array
*/
protected static function unwrapArgs(array $args) : array
{
$hasExtractable = false;
$unwrappedArgs = self::flatten(array_map(function ($arg) use (&$hasExtractable) {
if (is_object($arg) && method_exists($arg, 'extract')) {
$hasExtractable = true;
return $arg->extract();
}
return $arg;
}, $args));
return [$hasExtractable, $unwrappedArgs];
}
/**
* @param array $parameterTypes
* @param array $args
* @param array $pattern
* @return bool
* @throws \ReflectionException
*/
private static function patternApplies(array $parameterTypes, array $args, array $pattern) : bool
{
[$_, $pattern] = $pattern;
$reflected = new ReflectionFunction($pattern);
$patternParameterTypes = array_map(function (ReflectionParameter $parameter) {
$class = $parameter->getType() && ! $parameter->getType()->isBuiltin()
? new ReflectionClass($parameter->getType()->getName())
: null;
if ($class) {
return $class->getName();
}
return (string) ($parameter->getType() ? $parameter->getType()->getName() : null);
}, $reflected->getParameters());
/**
* Check count/type of params
*/
return count($patternParameterTypes) === 0
|| (
count($parameterTypes) === count($patternParameterTypes)
&& $parameterTypes === $patternParameterTypes
);
}
/**
* @param array $array
* @return array
*/
private static function flatten(array $array) : array
{
$values = [];
array_walk_recursive(
$array,
function ($value) use (&$values) {
$values[] = $value;
}
);
return $values;
}
}
| {
"content_hash": "16cf291d8c26fd724362fa0947b17372",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 107,
"avg_line_length": 28.473333333333333,
"alnum_prop": 0.5389838445328963,
"repo_name": "joseph-walker/vector",
"id": "13d6fec0c207cbf7d78fa47aeb639a7145e97ed8",
"size": "4271",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Control/Pattern.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Dockerfile",
"bytes": "369"
},
{
"name": "PHP",
"bytes": "124900"
},
{
"name": "Shell",
"bytes": "1037"
}
],
"symlink_target": ""
} |
package davenkin.lesson4;
import org.junit.Test;
import org.mockito.Mockito;
import static org.junit.Assert.assertEquals;
public class CalculatorContextTest {
@Test
public void shouldAddNumbers() {
String num1 = "12";
String num2 = "23";
String expected = "1223";
CalculatorContext context = new CalculatorContext();
Calculator calculator = Mockito.mock(Calculator.class);
Mockito.when(calculator.add(num1, num2)).thenReturn(expected);
context.setCalculator(calculator);
String result = context.add(num1, num2);
assertEquals(expected, result);
Mockito.verify(calculator).add(num1, num2);
}
} | {
"content_hash": "970c7975f558c9c3545b509c51289bcd",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 70,
"avg_line_length": 25.59259259259259,
"alnum_prop": 0.6729377713458755,
"repo_name": "davenkin/BookShelf",
"id": "0c2e217067a4739d088006055d43bdb71add08eb",
"size": "691",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lesson4/src/test/java/davenkin/lesson4/CalculatorContextTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "2789"
},
{
"name": "Groovy",
"bytes": "2488"
},
{
"name": "Java",
"bytes": "19999"
},
{
"name": "JavaScript",
"bytes": "776"
},
{
"name": "Shell",
"bytes": "187"
}
],
"symlink_target": ""
} |
package waffle.windows.auth.impl;
import com.sun.jna.platform.win32.Secur32;
import com.sun.jna.platform.win32.Sspi;
import com.sun.jna.platform.win32.Sspi.CredHandle;
import com.sun.jna.platform.win32.Sspi.TimeStamp;
import com.sun.jna.platform.win32.Win32Exception;
import com.sun.jna.platform.win32.WinError;
import waffle.windows.auth.IWindowsCredentialsHandle;
/**
* Pre-existing credentials of a security principal. This is a handle to a previously authenticated logon data used by a
* security principal to establish its own identity, such as a password, or a Kerberos protocol ticket.
*
* @author dblock[at]dblock[dot]org
*/
public class WindowsCredentialsHandleImpl implements IWindowsCredentialsHandle {
/** The principal name. */
private final String principalName;
/** The credentials type. */
private final int credentialsType;
/** The security package. */
private final String securityPackage;
/** The handle. */
private CredHandle handle;
/**
* A new Windows credentials handle.
*
* @param newPrincipalName
* Principal name.
* @param newCredentialsType
* Credentials type.
* @param newSecurityPackage
* Security package.
*/
public WindowsCredentialsHandleImpl(final String newPrincipalName, final int newCredentialsType,
final String newSecurityPackage) {
this.principalName = newPrincipalName;
this.credentialsType = newCredentialsType;
this.securityPackage = newSecurityPackage;
}
/**
* Returns the current credentials handle.
*
* @param securityPackage
* Security package, eg. "Negotiate".
*
* @return A windows credentials handle
*/
public static IWindowsCredentialsHandle getCurrent(final String securityPackage) {
final IWindowsCredentialsHandle handle = new WindowsCredentialsHandleImpl(null, Sspi.SECPKG_CRED_OUTBOUND,
securityPackage);
handle.initialize();
return handle;
}
/**
* Initialize a new credentials handle.
*/
@Override
public void initialize() {
this.handle = new CredHandle();
final TimeStamp clientLifetime = new TimeStamp();
final int rc = Secur32.INSTANCE.AcquireCredentialsHandle(this.principalName, this.securityPackage,
this.credentialsType, null, null, null, null, this.handle, clientLifetime);
if (WinError.SEC_E_OK != rc) {
throw new Win32Exception(rc);
}
}
/**
* Dispose of the credentials handle.
*/
@Override
public void dispose() {
if (this.handle != null && !this.handle.isNull()) {
final int rc = Secur32.INSTANCE.FreeCredentialsHandle(this.handle);
if (WinError.SEC_E_OK != rc) {
throw new Win32Exception(rc);
}
}
}
/**
* Get CredHandle.
*
* @return the handle
*/
@Override
public CredHandle getHandle() {
return this.handle;
}
}
| {
"content_hash": "eb540d79960987af17d18a9f4cffd8dc",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 120,
"avg_line_length": 30.574257425742573,
"alnum_prop": 0.6512305699481865,
"repo_name": "hazendaz/waffle",
"id": "2ea11f195976f88a7d0941145a74d18bc9f5c713",
"size": "4300",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "Source/JNA/waffle-jna-jakarta/src/main/java/waffle/windows/auth/impl/WindowsCredentialsHandleImpl.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "1659"
},
{
"name": "C#",
"bytes": "144779"
},
{
"name": "HTML",
"bytes": "8094"
},
{
"name": "Java",
"bytes": "1309979"
},
{
"name": "VBScript",
"bytes": "562"
}
],
"symlink_target": ""
} |
struct PrintOneCharacterAtATime {
static size_t printStringTo(const std::string& s, Print& p) {
size_t result = 0;
for (std::string::const_iterator it = s.begin(); it != s.end(); ++it) {
size_t n = p.write(uint8_t(*it));
if (n == 0)
break;
result += n;
}
return result;
}
};
struct PrintAllAtOnce {
static size_t printStringTo(const std::string& s, Print& p) {
return p.write(s.data(), s.size());
}
};
template <typename PrintPolicy>
struct PrintableString : public Printable {
PrintableString(const char* s) : _str(s), _total(0) {}
virtual size_t printTo(Print& p) const {
size_t result = PrintPolicy::printStringTo(_str, p);
_total += result;
return result;
}
size_t totalBytesWritten() const {
return _total;
}
private:
std::string _str;
mutable size_t _total;
};
TEST_CASE("Printable") {
SECTION("Doesn't overflow") {
StaticJsonDocument<8> doc;
const char* value = "example"; // == 7 chars
doc.set(666); // to make sure we override the value
SECTION("Via Print::write(char)") {
PrintableString<PrintOneCharacterAtATime> printable(value);
CHECK(doc.set(printable) == true);
CHECK(doc.as<std::string>() == value);
CHECK(printable.totalBytesWritten() == 7);
CHECK(doc.overflowed() == false);
CHECK(doc.memoryUsage() == 8);
CHECK(doc.as<JsonVariant>().memoryUsage() == 8);
}
SECTION("Via Print::write(const char* size_t)") {
PrintableString<PrintAllAtOnce> printable(value);
CHECK(doc.set(printable) == true);
CHECK(doc.as<std::string>() == value);
CHECK(printable.totalBytesWritten() == 7);
CHECK(doc.overflowed() == false);
CHECK(doc.memoryUsage() == 8);
CHECK(doc.as<JsonVariant>().memoryUsage() == 8);
}
}
SECTION("Overflows early") {
StaticJsonDocument<8> doc;
const char* value = "hello world"; // > 8 chars
doc.set(666); // to make sure we override the value
SECTION("Via Print::write(char)") {
PrintableString<PrintOneCharacterAtATime> printable(value);
CHECK(doc.set(printable) == false);
CHECK(doc.isNull());
CHECK(printable.totalBytesWritten() == 8);
CHECK(doc.overflowed() == true);
CHECK(doc.memoryUsage() == 0);
}
SECTION("Via Print::write(const char*, size_t)") {
PrintableString<PrintAllAtOnce> printable(value);
CHECK(doc.set(printable) == false);
CHECK(doc.isNull());
CHECK(printable.totalBytesWritten() == 0);
CHECK(doc.overflowed() == true);
CHECK(doc.memoryUsage() == 0);
}
}
SECTION("Overflows adding terminator") {
StaticJsonDocument<8> doc;
const char* value = "overflow"; // == 8 chars
doc.set(666); // to make sure we override the value
SECTION("Via Print::write(char)") {
PrintableString<PrintOneCharacterAtATime> printable(value);
CHECK(doc.set(printable) == false);
CHECK(doc.isNull());
CHECK(printable.totalBytesWritten() == 8);
CHECK(doc.overflowed() == true);
CHECK(doc.memoryUsage() == 0);
}
SECTION("Via Print::write(const char*, size_t)") {
PrintableString<PrintAllAtOnce> printable(value);
CHECK(doc.set(printable) == false);
CHECK(doc.isNull());
CHECK(printable.totalBytesWritten() == 0);
CHECK(doc.overflowed() == true);
CHECK(doc.memoryUsage() == 0);
}
}
SECTION("Null variant") {
JsonVariant var;
PrintableString<PrintOneCharacterAtATime> printable = "Hello World!";
CHECK(var.set(printable) == false);
CHECK(var.isNull());
CHECK(printable.totalBytesWritten() == 0);
}
SECTION("String deduplication") {
StaticJsonDocument<128> doc;
doc.add(PrintableString<PrintOneCharacterAtATime>("Hello World!"));
doc.add(PrintableString<PrintAllAtOnce>("Hello World!"));
REQUIRE(doc.size() == 2);
CHECK(doc[0] == "Hello World!");
CHECK(doc[1] == "Hello World!");
CHECK(doc.memoryUsage() == JSON_ARRAY_SIZE(2) + 13);
}
}
| {
"content_hash": "dd57f0b9cf225a1e711d26ba0fe22896",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 75,
"avg_line_length": 30.12686567164179,
"alnum_prop": 0.6205102799108249,
"repo_name": "bblanchon/ArduinoJson",
"id": "7cec8f93498f1ba8d44780eb9503e8f6b851794c",
"size": "4250",
"binary": false,
"copies": "1",
"ref": "refs/heads/6.x",
"path": "extras/tests/Misc/printable.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "377"
},
{
"name": "C++",
"bytes": "1223078"
},
{
"name": "CMake",
"bytes": "17556"
},
{
"name": "Makefile",
"bytes": "776"
},
{
"name": "Shell",
"bytes": "6161"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Avalonia.Data;
using Avalonia.PropertyStore;
using Avalonia.Utilities;
namespace Avalonia
{
/// <summary>
/// Stores styled property values for an <see cref="AvaloniaObject"/>.
/// </summary>
/// <remarks>
/// At its core this class consists of an <see cref="AvaloniaProperty"/> to
/// <see cref="IValue"/> mapping which holds the current values for each set property. This
/// <see cref="IValue"/> can be in one of 4 states:
///
/// - For a single local value it will be an instance of <see cref="LocalValueEntry{T}"/>.
/// - For a single value of a priority other than LocalValue it will be an instance of
/// <see cref="ConstantValueEntry{T}"/>`
/// - For a single binding it will be an instance of <see cref="BindingEntry{T}"/>
/// - For all other cases it will be an instance of <see cref="PriorityValue{T}"/>
/// </remarks>
internal class ValueStore : IValueSink
{
private readonly AvaloniaObject _owner;
private readonly IValueSink _sink;
private readonly AvaloniaPropertyValueStore<IValue> _values;
private BatchUpdate? _batchUpdate;
public ValueStore(AvaloniaObject owner)
{
_sink = _owner = owner;
_values = new AvaloniaPropertyValueStore<IValue>();
}
public void BeginBatchUpdate()
{
_batchUpdate ??= new BatchUpdate(this);
_batchUpdate.Begin();
}
public void EndBatchUpdate()
{
if (_batchUpdate is null)
{
throw new InvalidOperationException("No batch update in progress.");
}
if (_batchUpdate.End())
{
_batchUpdate = null;
}
}
public bool IsAnimating(AvaloniaProperty property)
{
if (TryGetValue(property, out var slot))
{
return slot.Priority < BindingPriority.LocalValue;
}
return false;
}
public bool IsSet(AvaloniaProperty property)
{
if (TryGetValue(property, out var slot))
{
return slot.GetValue().HasValue;
}
return false;
}
public bool TryGetValue<T>(
StyledPropertyBase<T> property,
BindingPriority maxPriority,
out T value)
{
if (TryGetValue(property, out var slot))
{
var v = ((IValue<T>)slot).GetValue(maxPriority);
if (v.HasValue)
{
value = v.Value;
return true;
}
}
value = default!;
return false;
}
public IDisposable? SetValue<T>(StyledPropertyBase<T> property, T value, BindingPriority priority)
{
if (property.ValidateValue?.Invoke(value) == false)
{
throw new ArgumentException($"{value} is not a valid value for '{property.Name}.");
}
IDisposable? result = null;
if (TryGetValue(property, out var slot))
{
result = SetExisting(slot, property, value, priority);
}
else if (property.HasCoercion)
{
// If the property has any coercion callbacks then always create a PriorityValue.
var entry = new PriorityValue<T>(_owner, property, this);
AddValue(property, entry);
result = entry.SetValue(value, priority);
}
else
{
if (priority == BindingPriority.LocalValue)
{
AddValue(property, new LocalValueEntry<T>(value));
NotifyValueChanged<T>(property, default, value, priority);
}
else
{
var entry = new ConstantValueEntry<T>(property, value, priority, this);
AddValue(property, entry);
NotifyValueChanged<T>(property, default, value, priority);
result = entry;
}
}
return result;
}
public IDisposable AddBinding<T>(
StyledPropertyBase<T> property,
IObservable<BindingValue<T>> source,
BindingPriority priority)
{
if (TryGetValue(property, out var slot))
{
return BindExisting(slot, property, source, priority);
}
else if (property.HasCoercion)
{
// If the property has any coercion callbacks then always create a PriorityValue.
var entry = new PriorityValue<T>(_owner, property, this);
var binding = entry.AddBinding(source, priority);
AddValue(property, entry);
return binding;
}
else
{
var entry = new BindingEntry<T>(_owner, property, source, priority, this);
AddValue(property, entry);
return entry;
}
}
public void ClearLocalValue<T>(StyledPropertyBase<T> property)
{
if (TryGetValue(property, out var slot))
{
if (slot is PriorityValue<T> p)
{
p.ClearLocalValue();
}
else if (slot.Priority == BindingPriority.LocalValue)
{
var old = TryGetValue(property, BindingPriority.LocalValue, out var value) ?
new Optional<T>(value) : default;
// During batch update values can't be removed immediately because they're needed to raise
// a correctly-typed _sink.ValueChanged notification. They instead mark themselves for removal
// by setting their priority to Unset.
if (!IsBatchUpdating())
{
_values.Remove(property);
}
else if (slot is IDisposable d)
{
d.Dispose();
}
else
{
// Local value entries are optimized and contain only a single value field to save space,
// so there's no way to mark them for removal at the end of a batch update. Instead convert
// them to a constant value entry with Unset priority in the event of a local value being
// cleared during a batch update.
var sentinel = new ConstantValueEntry<T>(property, Optional<T>.Empty, BindingPriority.Unset, _sink);
_values.SetValue(property, sentinel);
}
NotifyValueChanged<T>(property, old, default, BindingPriority.Unset);
}
}
}
public void CoerceValue<T>(StyledPropertyBase<T> property)
{
if (TryGetValue(property, out var slot))
{
if (slot is PriorityValue<T> p)
{
p.UpdateEffectiveValue();
}
}
}
public Diagnostics.AvaloniaPropertyValue? GetDiagnostic(AvaloniaProperty property)
{
if (TryGetValue(property, out var slot))
{
var slotValue = slot.GetValue();
return new Diagnostics.AvaloniaPropertyValue(
property,
slotValue.HasValue ? slotValue.Value : AvaloniaProperty.UnsetValue,
slot.Priority,
null);
}
return null;
}
void IValueSink.ValueChanged<T>(AvaloniaPropertyChangedEventArgs<T> change)
{
if (_batchUpdate is object)
{
if (change.IsEffectiveValueChange)
{
NotifyValueChanged<T>(change.Property, change.OldValue, change.NewValue, change.Priority);
}
}
else
{
_sink.ValueChanged(change);
}
}
void IValueSink.Completed<T>(
StyledPropertyBase<T> property,
IPriorityValueEntry entry,
Optional<T> oldValue)
{
// We need to include remove sentinels here so call `_values.TryGetValue` directly.
if (_values.TryGetValue(property, out var slot) && slot == entry)
{
if (_batchUpdate is null)
{
_values.Remove(property);
_sink.Completed(property, entry, oldValue);
}
else
{
_batchUpdate.ValueChanged(property, oldValue.ToObject());
}
}
}
private IDisposable? SetExisting<T>(
object slot,
StyledPropertyBase<T> property,
T value,
BindingPriority priority)
{
IDisposable? result = null;
if (slot is IPriorityValueEntry<T> e)
{
var priorityValue = new PriorityValue<T>(_owner, property, this, e);
_values.SetValue(property, priorityValue);
result = priorityValue.SetValue(value, priority);
}
else if (slot is PriorityValue<T> p)
{
result = p.SetValue(value, priority);
}
else if (slot is LocalValueEntry<T> l)
{
if (priority == BindingPriority.LocalValue)
{
var old = l.GetValue(BindingPriority.LocalValue);
l.SetValue(value);
NotifyValueChanged<T>(property, old, value, priority);
}
else
{
var priorityValue = new PriorityValue<T>(_owner, property, this, l);
if (IsBatchUpdating())
priorityValue.BeginBatchUpdate();
result = priorityValue.SetValue(value, priority);
_values.SetValue(property, priorityValue);
}
}
else
{
throw new NotSupportedException("Unrecognised value store slot type.");
}
return result;
}
private IDisposable BindExisting<T>(
object slot,
StyledPropertyBase<T> property,
IObservable<BindingValue<T>> source,
BindingPriority priority)
{
PriorityValue<T> priorityValue;
if (slot is IPriorityValueEntry<T> e)
{
priorityValue = new PriorityValue<T>(_owner, property, this, e);
if (IsBatchUpdating())
{
priorityValue.BeginBatchUpdate();
}
}
else if (slot is PriorityValue<T> p)
{
priorityValue = p;
}
else if (slot is LocalValueEntry<T> l)
{
priorityValue = new PriorityValue<T>(_owner, property, this, l);
}
else
{
throw new NotSupportedException("Unrecognised value store slot type.");
}
var binding = priorityValue.AddBinding(source, priority);
_values.SetValue(property, priorityValue);
priorityValue.UpdateEffectiveValue();
return binding;
}
private void AddValue(AvaloniaProperty property, IValue value)
{
_values.AddValue(property, value);
if (IsBatchUpdating() && value is IBatchUpdate batch)
batch.BeginBatchUpdate();
value.Start();
}
private void NotifyValueChanged<T>(
AvaloniaProperty<T> property,
Optional<T> oldValue,
BindingValue<T> newValue,
BindingPriority priority)
{
if (_batchUpdate is null)
{
_sink.ValueChanged(new AvaloniaPropertyChangedEventArgs<T>(
_owner,
property,
oldValue,
newValue,
priority));
}
else
{
_batchUpdate.ValueChanged(property, oldValue.ToObject());
}
}
private bool IsBatchUpdating() => _batchUpdate?.IsBatchUpdating == true;
private bool TryGetValue(AvaloniaProperty property, [MaybeNullWhen(false)] out IValue value)
{
return _values.TryGetValue(property, out value) && !IsRemoveSentinel(value);
}
private static bool IsRemoveSentinel(IValue value)
{
// Local value entries are optimized and contain only a single value field to save space,
// so there's no way to mark them for removal at the end of a batch update. Instead a
// ConstantValueEntry with a priority of Unset is used as a sentinel value.
return value is IConstantValueEntry t && t.Priority == BindingPriority.Unset;
}
private class BatchUpdate
{
private ValueStore _owner;
private List<Notification>? _notifications;
private int _batchUpdateCount;
private int _iterator = -1;
public BatchUpdate(ValueStore owner) => _owner = owner;
public bool IsBatchUpdating => _batchUpdateCount > 0;
public void Begin()
{
if (_batchUpdateCount++ == 0)
{
var values = _owner._values;
for (var i = 0; i < values.Count; ++i)
{
(values[i] as IBatchUpdate)?.BeginBatchUpdate();
}
}
}
public bool End()
{
if (--_batchUpdateCount > 0)
return false;
var values = _owner._values;
// First call EndBatchUpdate on all bindings. This should cause the active binding to be subscribed
// but notifications will still not be raised because the owner ValueStore will still have a reference
// to this batch update object.
for (var i = 0; i < values.Count; ++i)
{
(values[i] as IBatchUpdate)?.EndBatchUpdate();
// Somehow subscribing to a binding caused a new batch update. This shouldn't happen but in case it
// does, abort and continue batch updating.
if (_batchUpdateCount > 0)
return false;
}
if (_notifications is object)
{
// Raise all batched notifications. Doing this can cause other notifications to be added and even
// cause a new batch update to start, so we need to handle _notifications being modified by storing
// the index in field.
_iterator = 0;
for (; _iterator < _notifications.Count; ++_iterator)
{
var entry = _notifications[_iterator];
if (values.TryGetValue(entry.property, out var slot))
{
var oldValue = entry.oldValue;
var newValue = slot.GetValue();
// Raising this notification can cause a new batch update to be started, which in turn
// results in another change to the property. In this case we need to update the old value
// so that the *next* notification has an oldValue which follows on from the newValue
// raised here.
_notifications[_iterator] = new Notification
{
property = entry.property,
oldValue = newValue,
};
// Call _sink.ValueChanged with an appropriately typed AvaloniaPropertyChangedEventArgs<T>.
slot.RaiseValueChanged(_owner._sink, _owner._owner, entry.property, oldValue, newValue);
// During batch update values can't be removed immediately because they're needed to raise
// the _sink.ValueChanged notification. They instead mark themselves for removal by setting
// their priority to Unset. We need to re-read the slot here because raising ValueChanged
// could have caused it to be updated.
if (values.TryGetValue(entry.property, out var updatedSlot) &&
updatedSlot.Priority == BindingPriority.Unset)
{
values.Remove(entry.property);
}
}
else
{
throw new AvaloniaInternalException("Value could not be found at the end of batch update.");
}
// If a new batch update was started while ending this one, abort.
if (_batchUpdateCount > 0)
return false;
}
}
_iterator = int.MaxValue - 1;
return true;
}
public void ValueChanged(AvaloniaProperty property, Optional<object?> oldValue)
{
_notifications ??= new List<Notification>();
for (var i = 0; i < _notifications.Count; ++i)
{
if (_notifications[i].property == property)
{
oldValue = _notifications[i].oldValue;
_notifications.RemoveAt(i);
if (i <= _iterator)
--_iterator;
break;
}
}
_notifications.Add(new Notification
{
property = property,
oldValue = oldValue,
});
}
private struct Notification
{
public AvaloniaProperty property;
public Optional<object?> oldValue;
}
}
}
}
| {
"content_hash": "c0c74ba1222cc3f69e08fb0bdd3b53d6",
"timestamp": "",
"source": "github",
"line_count": 512,
"max_line_length": 124,
"avg_line_length": 37.0859375,
"alnum_prop": 0.4927849167895513,
"repo_name": "jkoritzinsky/Perspex",
"id": "6b7b598086315f5c8286a9d399f52d5a3dc08a3b",
"size": "18990",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/Avalonia.Base/ValueStore.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "2991416"
},
{
"name": "PowerShell",
"bytes": "4831"
},
{
"name": "Smalltalk",
"bytes": "49324"
}
],
"symlink_target": ""
} |
separate_arguments(KERNEL_CL_FLAGS)
separate_arguments(KERNEL_CLANGXX_FLAGS)
#/usr/bin/clang --target=x86_64-pc-linux-gnu -march=bdver1 -Xclang -ffake-address-space-map -emit-llvm -ffp-contract=off -D__OPENCL_VERSION__=120 -DPOCL_VECMATHLIB_BUILTIN -D__CBUILD__ -o get_local_id.bc -c ${CMAKE_SOURCE_DIR}/lib/kernel/get_local_id.c -include ${CMAKE_SOURCE_DIR}/include/_kernel_c.h
# @CLANG@ ${CLANG_FLAGS} ${KERNEL_CL_FLAGS} -D__CBUILD__ -c -o $@ -include ${abs_top_srcdir}/include/_kernel_c.h $<
function(compile_c_to_bc FILENAME SUBDIR BC_FILE_LIST)
get_filename_component(FNAME "${FILENAME}" NAME)
set(BC_FILE "${CMAKE_CURRENT_BINARY_DIR}/${SUBDIR}/${FNAME}.bc")
set(${BC_FILE_LIST} ${${BC_FILE_LIST}} ${BC_FILE} PARENT_SCOPE)
set(FULL_F_PATH "${CMAKE_SOURCE_DIR}/lib/kernel/${FILENAME}")
add_custom_command( OUTPUT "${BC_FILE}"
DEPENDS "${FULL_F_PATH}"
"${CMAKE_SOURCE_DIR}/include/pocl_types.h"
"${CMAKE_SOURCE_DIR}/include/_kernel_c.h"
${KERNEL_DEPEND_HEADERS}
COMMAND "${CLANG}" ${CLANG_FLAGS} ${DEVICE_CL_FLAGS}
"-xc" "-D__CBUILD__" "-o" "${BC_FILE}" "-c" "${FULL_F_PATH}"
"-include" "${CMAKE_SOURCE_DIR}/include/_kernel_c.h"
COMMENT "Building C to LLVM bitcode ${BC_FILE}"
VERBATIM)
endfunction()
# /usr/bin/clang++ --target=x86_64-pc-linux-gnu -march=bdver1 -Xclang -ffake-address-space-map -emit-llvm -ffp-contract=off -DVML_NO_IOSTREAM -DPOCL_VECMATHLIB_BUILTIN -o trunc.bc -c ${CMAKE_SOURCE_DIR}/lib/kernel/vecmathlib-pocl/trunc.cc
# @CLANGXX@ ${CLANG_FLAGS} ${KERNEL_CLANGXX_FLAGS} -c -o $@ $<
function(compile_cc_to_bc FILENAME SUBDIR BC_FILE_LIST)
get_filename_component(FNAME "${FILENAME}" NAME)
set(BC_FILE "${CMAKE_CURRENT_BINARY_DIR}/${SUBDIR}/${FNAME}.bc")
set(${BC_FILE_LIST} ${${BC_FILE_LIST}} ${BC_FILE} PARENT_SCOPE)
set(FULL_F_PATH "${CMAKE_SOURCE_DIR}/lib/kernel/${FILENAME}")
#MESSAGE(STATUS "BC_FILE: ${BC_FILE}")
add_custom_command(OUTPUT "${BC_FILE}"
DEPENDS "${FULL_F_PATH}"
${KERNEL_DEPEND_HEADERS}
COMMAND "${CLANGXX}" ${CLANG_FLAGS} ${KERNEL_CLANGXX_FLAGS}
${DEVICE_CL_FLAGS} "-std=c++11" "-o" "${BC_FILE}" "-c" "${FULL_F_PATH}"
COMMENT "Building C++ to LLVM bitcode ${BC_FILE}"
VERBATIM)
endfunction()
# /usr/bin/clang --target=x86_64-pc-linux-gnu -march=bdver1 -Xclang -ffake-address-space-map -emit-llvm -ffp-contract=off -x cl -D__OPENCL_VERSION__=120 -DPOCL_VECMATHLIB_BUILTIN -fsigned-char -o atan2pi.bc -c ${CMAKE_SOURCE_DIR}/lib/kernel/vecmathlib-pocl/atan2pi.cl -include ${CMAKE_SOURCE_DIR}/include/_kernel.h
function(compile_cl_to_bc FILENAME SUBDIR BC_FILE_LIST)
get_filename_component(FNAME "${FILENAME}" NAME)
set(BC_FILE "${CMAKE_CURRENT_BINARY_DIR}/${SUBDIR}/${FNAME}.bc")
set(${BC_FILE_LIST} ${${BC_FILE_LIST}} ${BC_FILE} PARENT_SCOPE)
set(FULL_F_PATH "${CMAKE_SOURCE_DIR}/lib/kernel/${FILENAME}")
#MESSAGE(STATUS "BC_FILE: ${BC_FILE}")
add_custom_command( OUTPUT "${BC_FILE}"
DEPENDS "${FULL_F_PATH}"
"${CMAKE_SOURCE_DIR}/include/_kernel.h"
"${CMAKE_SOURCE_DIR}/include/_kernel_c.h"
"${CMAKE_SOURCE_DIR}/include/pocl_types.h"
${KERNEL_DEPEND_HEADERS}
COMMAND "${CLANG}" ${CLANG_FLAGS} "-x" "cl" ${KERNEL_CL_FLAGS} ${DEVICE_CL_FLAGS}
"-o" "${BC_FILE}" "-c" "${FULL_F_PATH}"
"-include" "${CMAKE_SOURCE_DIR}/include/_kernel.h"
"-include" "${CMAKE_SOURCE_DIR}/include/_enable_all_exts.h"
COMMENT "Building CL to LLVM bitcode ${BC_FILE}"
VERBATIM)
endfunction()
function(compile_ll_to_bc FILENAME SUBDIR BC_FILE_LIST)
get_filename_component(FNAME "${FILENAME}" NAME)
set(BC_FILE "${CMAKE_CURRENT_BINARY_DIR}/${SUBDIR}/${FNAME}.bc")
set(${BC_FILE_LIST} ${${BC_FILE_LIST}} ${BC_FILE} PARENT_SCOPE)
set(FULL_F_PATH "${CMAKE_SOURCE_DIR}/lib/kernel/${FILENAME}")
add_custom_command( OUTPUT "${BC_FILE}"
DEPENDS ""
COMMAND "${LLVM_AS}" "-o" "${BC_FILE}" "${CMAKE_CURRENT_SOURCE_DIR}/../${FILENAME}"
COMMENT "Building LL to LLVM bitcode ${BC_FILE}"
VERBATIM)
endfunction()
macro(compile_to_bc SUBDIR OUTPUT_FILE_LIST)
foreach(FILENAME ${ARGN})
if(FILENAME MATCHES "[.]c$")
compile_c_to_bc("${FILENAME}" "${SUBDIR}" ${OUTPUT_FILE_LIST})
elseif(FILENAME MATCHES "[.]cc$")
compile_cc_to_bc("${FILENAME}" "${SUBDIR}" ${OUTPUT_FILE_LIST})
elseif(FILENAME MATCHES "[.]cl$")
compile_cl_to_bc("${FILENAME}" "${SUBDIR}" ${OUTPUT_FILE_LIST})
elseif(FILENAME MATCHES "[.]ll$")
compile_ll_to_bc("${FILENAME}" "${SUBDIR}" ${OUTPUT_FILE_LIST})
else()
message(FATAL_ERROR "Dont know how to compile ${FILENAME} to .bc !")
endif()
endforeach()
endmacro()
function(make_kernel_bc OUTPUT_VAR NAME SUBDIR)
set(KERNEL_BC "${CMAKE_CURRENT_BINARY_DIR}/kernel-${NAME}.bc")
set(${OUTPUT_VAR} "${KERNEL_BC}" PARENT_SCOPE)
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${SUBDIR}")
compile_to_bc("${SUBDIR}" BC_LIST ${ARGN})
# fix too long commandline with cat and xargs
set(BC_LIST_FILE_TXT "")
foreach(FILENAME ${BC_LIST})
# straight parsing semicolon separated list with xargs -d didn't work on windows.. no such switch available
set(BC_LIST_FILE_TXT "${BC_LIST_FILE_TXT} \"${FILENAME}\"")
endforeach()
set(BC_LIST_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/kernel_${NAME}_linklist.txt")
file(WRITE "${BC_LIST_FILE}" "${BC_LIST_FILE_TXT}")
# @LLVM_LINK@ $^ -o - | @LLVM_OPT@ ${LLC_FLAGS} ${KERNEL_LIB_OPT_FLAGS} -O3 -fp-contract=off -o $@
# don't waste time optimizing the kernels IR when in developer mode
if(DEVELOPER_MODE)
set(LINK_OPT_COMMAND COMMAND "${XARGS_EXEC}" "${LLVM_LINK}" "-o" "${KERNEL_BC}" < "${BC_LIST_FILE}")
else()
set(LINK_CMD COMMAND "${XARGS_EXEC}" "${LLVM_LINK}" "-o" "kernel-${NAME}-unoptimized.bc" < "${BC_LIST_FILE}")
set(OPT_CMD COMMAND "${LLVM_OPT}" ${LLC_FLAGS} "-O3" "-fp-contract=off" "-o" "${KERNEL_BC}" "kernel-${NAME}-unoptimized.bc")
set(LINK_OPT_COMMAND ${LINK_CMD} ${OPT_CMD})
endif()
add_custom_command( OUTPUT "${KERNEL_BC}"
# ${KERNEL_BC}: ${OBJ}
DEPENDS ${BC_LIST}
${LINK_OPT_COMMAND}
COMMENT "Linking & optimizing Kernel bitcode ${KERNEL_BC}"
VERBATIM)
endfunction()
| {
"content_hash": "73c4dc9a1141b10e698d728f825236c7",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 314,
"avg_line_length": 46.50735294117647,
"alnum_prop": 0.636205533596838,
"repo_name": "jrprice/pocl",
"id": "66d1529a78f0c379ac025b562e629b094e30bfe1",
"size": "7683",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "cmake/bitcode_rules.cmake",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "5193885"
},
{
"name": "C++",
"bytes": "2572146"
},
{
"name": "CMake",
"bytes": "214519"
},
{
"name": "LLVM",
"bytes": "1204555"
},
{
"name": "Mathematica",
"bytes": "4995"
},
{
"name": "Python",
"bytes": "58976"
},
{
"name": "Shell",
"bytes": "28606"
}
],
"symlink_target": ""
} |
package net.runelite.client.plugins.nightmarezone;
import com.google.inject.Provides;
import java.util.Arrays;
import javax.inject.Inject;
import net.runelite.api.ChatMessageType;
import net.runelite.api.Client;
import net.runelite.api.Varbits;
import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.ConfigChanged;
import net.runelite.api.events.GameTick;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.Notifier;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.util.Text;
@PluginDescriptor(
name = "Nightmare Zone",
description = "Show NMZ points/absorption and/or notify about expiring potions",
tags = {"combat", "nmz", "minigame", "notifications"}
)
public class NightmareZonePlugin extends Plugin
{
private static final int[] NMZ_MAP_REGION = {9033};
@Inject
private Notifier notifier;
@Inject
private Client client;
@Inject
private OverlayManager overlayManager;
@Inject
private NightmareZoneConfig config;
@Inject
private NightmareZoneOverlay overlay;
// This starts as true since you need to get
// above the threshold before sending notifications
private boolean absorptionNotificationSend = true;
@Override
protected void startUp() throws Exception
{
overlayManager.add(overlay);
overlay.removeAbsorptionCounter();
}
@Override
protected void shutDown() throws Exception
{
overlayManager.remove(overlay);
overlay.removeAbsorptionCounter();
Widget nmzWidget = client.getWidget(WidgetInfo.NIGHTMARE_ZONE);
if (nmzWidget != null)
{
nmzWidget.setHidden(false);
}
}
@Subscribe
public void onConfigChanged(ConfigChanged event)
{
overlay.updateConfig();
}
@Provides
NightmareZoneConfig getConfig(ConfigManager configManager)
{
return configManager.getConfig(NightmareZoneConfig.class);
}
@Subscribe
public void onGameTick(GameTick event)
{
if (!isInNightmareZone())
{
if (!absorptionNotificationSend)
{
absorptionNotificationSend = true;
}
return;
}
if (config.absorptionNotification())
{
checkAbsorption();
}
}
@Subscribe
public void onChatMessage(ChatMessage event)
{
if (event.getType() != ChatMessageType.GAMEMESSAGE
|| !isInNightmareZone())
{
return;
}
String msg = Text.removeTags(event.getMessage()); //remove color
if (msg.contains("The effects of overload have worn off, and you feel normal again."))
{
if (config.overloadNotification())
{
notifier.notify("Your overload has worn off");
}
}
else if (msg.contains("A power-up has spawned:"))
{
if (msg.contains("Power surge"))
{
if (config.powerSurgeNotification())
{
notifier.notify(msg);
}
}
else if (msg.contains("Recurrent damage"))
{
if (config.recurrentDamageNotification())
{
notifier.notify(msg);
}
}
else if (msg.contains("Zapper"))
{
if (config.zapperNotification())
{
notifier.notify(msg);
}
}
else if (msg.contains("Ultimate force"))
{
if (config.ultimateForceNotification())
{
notifier.notify(msg);
}
}
}
}
private void checkAbsorption()
{
int absorptionPoints = client.getVar(Varbits.NMZ_ABSORPTION);
if (!absorptionNotificationSend)
{
if (absorptionPoints < config.absorptionThreshold())
{
notifier.notify("Absorption points below: " + config.absorptionThreshold());
absorptionNotificationSend = true;
}
}
else
{
if (absorptionPoints > config.absorptionThreshold())
{
absorptionNotificationSend = false;
}
}
}
public boolean isInNightmareZone()
{
return Arrays.equals(client.getMapRegions(), NMZ_MAP_REGION);
}
}
| {
"content_hash": "6dfe3d50c8b573ab30326272e3df5fc3",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 88,
"avg_line_length": 22.084745762711865,
"alnum_prop": 0.7224354054745459,
"repo_name": "abelbriggs1/runelite",
"id": "d5b91a94cd3dc5d6e4d7c32216f97dc280f49662",
"size": "5304",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "runelite-client/src/main/java/net/runelite/client/plugins/nightmarezone/NightmareZonePlugin.java",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "GLSL",
"bytes": "41919"
},
{
"name": "HTML",
"bytes": "7055"
},
{
"name": "Java",
"bytes": "9389009"
},
{
"name": "Shell",
"bytes": "327"
}
],
"symlink_target": ""
} |
#ifndef _OUTPUT_H_
#define _OUTPUT_H_
///////////////////////////////////////////////////////////
// Headers
///////////////////////////////////////////////////////////
#include <string>
///////////////////////////////////////////////////////////
/// Output Namespace
///////////////////////////////////////////////////////////
namespace Output {
void Init();
void PostStr(std::string msg);
void Post(const char* fmt, ...);
void PostFile(std::string msg);
void WarningStr(std::string warn);
void Warning(const char* fmt, ...);
void ErrorStr(std::string err);
void Error(const char* fmt, ...);
void Console();
void MsgBox();
void File(std::string name);
void None();
std::string Gets();
std::string Getc();
extern int output_type;
extern std::string filename;
};
#endif
| {
"content_hash": "7f2135c83dcd1f5a1865af4c8d6e0839",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 59,
"avg_line_length": 23.02777777777778,
"alnum_prop": 0.4451145958986731,
"repo_name": "take-cheeze/ARGSS",
"id": "180d003b09f9989cd8d3cd28cb37c89ac499d191",
"size": "2340",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/output.h",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "C",
"bytes": "215389"
},
{
"name": "C++",
"bytes": "820231"
},
{
"name": "Objective-C",
"bytes": "24522"
},
{
"name": "Ruby",
"bytes": "41094"
}
],
"symlink_target": ""
} |
package no.regnskog.poapp;
import android.content.Context;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteDatabase;
class DatabaseOpenHelper extends SQLiteOpenHelper
{
private static final int DB_VERSION = 1;
public DatabaseOpenHelper(Context ctx)
{
super(ctx, "db", null, DB_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db)
{
db.execSQL("CREATE TABLE product (" +
"id INTEGER PRIMARY KEY AUTOINCREMENT, " +
// BUG: multiple ean per product?
"ean TEXT NOT NULL, " +
"name TEXT NOT NULL, " +
"category_id INTEGER, " +
"manufacturer_id INTEGER " +
")");
db.execSQL("CREATE TABLE ingredient (" +
"id INTEGER PRIMARY KEY, " +
"min INTEGER NOT NULL, " +
"max INTEGER NOT NULL, " +
"substance_id INTEGER NOT NULL," +
"FOREIGN KEY (substance_id) REFERENCES substance(id)" +
")");
db.execSQL("CREATE TABLE substance (" +
"id INTEGER PRIMARY KEY, " +
"name TEXT, " +
"info TEXT " +
")");
db.execSQL("CREATE TABLE bad_ingredient (" +
"product_id INTEGER NOT NULL, " +
"ingredient_id INTEGER NOT NULL, " +
"PRIMARY KEY (product_id, ingredient_id), " +
"FOREIGN KEY (product_id) REFERENCES product(id), " +
"FOREIGN KEY (ingredient_id) REFERENCES ingredient(id)" +
")");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
{
}
}
| {
"content_hash": "42d783244b771efeb64642ba57ae888c",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 76,
"avg_line_length": 35.23076923076923,
"alnum_prop": 0.5114628820960698,
"repo_name": "audunhalland/poapp",
"id": "1093306f3c0d90e6ae9098fecd97f8f4df3cf51d",
"size": "1832",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "android/src/no/regnskog/poapp/DatabaseOpenHelper.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "37124"
},
{
"name": "Objective-C",
"bytes": "25753"
}
],
"symlink_target": ""
} |
package org.linkedin.glu.provisioner.plan.impl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.linkedin.glu.provisioner.plan.api.CompositeStepCompletionStatus;
import org.linkedin.glu.provisioner.plan.api.IStep;
import org.linkedin.glu.provisioner.plan.api.IStepCompletionStatus;
import org.linkedin.glu.provisioner.plan.api.ParallelStep;
import java.util.ArrayList;
import java.util.Collection;
/**
* @author [email protected]
*/
public class ParallelStepExecutor<T> extends CompositeStepExecutor<T> implements IStepExecutor<T>
{
public static final String MODULE = ParallelStepExecutor.class.getName();
public static final Logger log = LoggerFactory.getLogger(MODULE);
/**
* Constructor
*/
public ParallelStepExecutor(ParallelStep<T> step, StepExecutionContext<T> context)
{
super(step, context);
}
@Override
protected IStepCompletionStatus<T> doExecute() throws InterruptedException
{
Collection<IStepCompletionStatus<T>> status = new ArrayList<IStepCompletionStatus<T>>();
int i = 0;
for(IStep<T> step : getCompositeStep().getSteps())
{
if(log.isDebugEnabled())
debug("executing step " + i);
createChildExecutor(step).execute();
i++;
}
i = 0;
for(IStepExecutor<T> executor : getChildrenExecutors().values())
{
if(log.isDebugEnabled())
debug("waiting for step " + i);
status.add(executor.waitForCompletion());
i++;
}
return new CompositeStepCompletionStatus<T>(getCompositeStep(), status);
}
} | {
"content_hash": "ded8a3b628265ba5f51d1f93badcf34b",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 97,
"avg_line_length": 26.844827586206897,
"alnum_prop": 0.7199743095696853,
"repo_name": "pongasoft/glu",
"id": "dd57a5acaf2f4ed8dc74d8a95892779a43c516dd",
"size": "2158",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "provisioner/org.linkedin.glu.provisioner-core/src/main/java/org/linkedin/glu/provisioner/plan/impl/ParallelStepExecutor.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "5972"
},
{
"name": "CSS",
"bytes": "26809"
},
{
"name": "Groovy",
"bytes": "2356502"
},
{
"name": "HTML",
"bytes": "12569"
},
{
"name": "Java",
"bytes": "384837"
},
{
"name": "JavaScript",
"bytes": "11092"
},
{
"name": "Python",
"bytes": "24781"
},
{
"name": "Shell",
"bytes": "48966"
}
],
"symlink_target": ""
} |
package org.apache.hadoop.yarn.util;
import static org.junit.Assert.fail;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Random;
import java.util.Vector;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.fs.FileContext;
import org.apache.hadoop.fs.FileUtil;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.util.StringUtils;
import org.apache.hadoop.util.Shell;
import org.apache.hadoop.util.Shell.ExitCodeException;
import org.apache.hadoop.util.Shell.ShellCommandExecutor;
import org.apache.hadoop.yarn.util.ProcfsBasedProcessTree;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
/**
* A JUnit test to test ProcfsBasedProcessTree.
*/
public class TestProcfsBasedProcessTree {
private static final Log LOG = LogFactory
.getLog(TestProcfsBasedProcessTree.class);
protected static File TEST_ROOT_DIR = new File("target",
TestProcfsBasedProcessTree.class.getName() + "-localDir");
private ShellCommandExecutor shexec = null;
private String pidFile, lowestDescendant;
private String shellScript;
private static final int N = 6; // Controls the RogueTask
private class RogueTaskThread extends Thread {
public void run() {
try {
Vector<String> args = new Vector<String>();
if(isSetsidAvailable()) {
args.add("setsid");
}
args.add("bash");
args.add("-c");
args.add(" echo $$ > " + pidFile + "; sh " +
shellScript + " " + N + ";") ;
shexec = new ShellCommandExecutor(args.toArray(new String[0]));
shexec.execute();
} catch (ExitCodeException ee) {
LOG.info("Shell Command exit with a non-zero exit code. This is" +
" expected as we are killing the subprocesses of the" +
" task intentionally. " + ee);
} catch (IOException ioe) {
LOG.info("Error executing shell command " + ioe);
} finally {
LOG.info("Exit code: " + shexec.getExitCode());
}
}
}
private String getRogueTaskPID() {
File f = new File(pidFile);
while (!f.exists()) {
try {
Thread.sleep(500);
} catch (InterruptedException ie) {
break;
}
}
// read from pidFile
return getPidFromPidFile(pidFile);
}
@Before
public void setup() throws IOException {
FileContext.getLocalFSFileContext().delete(
new Path(TEST_ROOT_DIR.getAbsolutePath()), true);
}
@Test (timeout = 30000)
public void testProcessTree() throws Exception {
if (!Shell.LINUX) {
System.out
.println("ProcfsBasedProcessTree is not available on this system. Not testing");
return;
}
try {
Assert.assertTrue(ProcfsBasedProcessTree.isAvailable());
} catch (Exception e) {
LOG.info(StringUtils.stringifyException(e));
Assert.assertTrue("ProcfsBaseProcessTree should be available on Linux",
false);
return;
}
// create shell script
Random rm = new Random();
File tempFile =
new File(TEST_ROOT_DIR, getClass().getName() + "_shellScript_"
+ rm.nextInt() + ".sh");
tempFile.deleteOnExit();
shellScript = TEST_ROOT_DIR + File.separator + tempFile.getName();
// create pid file
tempFile =
new File(TEST_ROOT_DIR, getClass().getName() + "_pidFile_"
+ rm.nextInt() + ".pid");
tempFile.deleteOnExit();
pidFile = TEST_ROOT_DIR + File.separator + tempFile.getName();
lowestDescendant = TEST_ROOT_DIR + File.separator + "lowestDescendantPidFile";
// write to shell-script
try {
FileWriter fWriter = new FileWriter(shellScript);
fWriter.write(
"# rogue task\n" +
"sleep 1\n" +
"echo hello\n" +
"if [ $1 -ne 0 ]\n" +
"then\n" +
" sh " + shellScript + " $(($1-1))\n" +
"else\n" +
" echo $$ > " + lowestDescendant + "\n" +
" while true\n do\n" +
" sleep 5\n" +
" done\n" +
"fi");
fWriter.close();
} catch (IOException ioe) {
LOG.info("Error: " + ioe);
return;
}
Thread t = new RogueTaskThread();
t.start();
String pid = getRogueTaskPID();
LOG.info("Root process pid: " + pid);
ProcfsBasedProcessTree p = createProcessTree(pid);
p.updateProcessTree(); // initialize
LOG.info("ProcessTree: " + p.toString());
File leaf = new File(lowestDescendant);
//wait till lowest descendant process of Rougue Task starts execution
while (!leaf.exists()) {
try {
Thread.sleep(500);
} catch (InterruptedException ie) {
break;
}
}
p.updateProcessTree(); // reconstruct
LOG.info("ProcessTree: " + p.toString());
// Get the process-tree dump
String processTreeDump = p.getProcessTreeDump();
// destroy the process and all its subprocesses
destroyProcessTree(pid);
boolean isAlive = true;
for (int tries = 100; tries > 0; tries--) {
if (isSetsidAvailable()) {// whole processtree
isAlive = isAnyProcessInTreeAlive(p);
} else {// process
isAlive = isAlive(pid);
}
if (!isAlive) {
break;
}
Thread.sleep(100);
}
if (isAlive) {
fail("ProcessTree shouldn't be alive");
}
LOG.info("Process-tree dump follows: \n" + processTreeDump);
Assert.assertTrue("Process-tree dump doesn't start with a proper header",
processTreeDump.startsWith("\t|- PID PPID PGRPID SESSID CMD_NAME " +
"USER_MODE_TIME(MILLIS) SYSTEM_TIME(MILLIS) VMEM_USAGE(BYTES) " +
"RSSMEM_USAGE(PAGES) FULL_CMD_LINE\n"));
for (int i = N; i >= 0; i--) {
String cmdLineDump = "\\|- [0-9]+ [0-9]+ [0-9]+ [0-9]+ \\(sh\\)" +
" [0-9]+ [0-9]+ [0-9]+ [0-9]+ sh " + shellScript + " " + i;
Pattern pat = Pattern.compile(cmdLineDump);
Matcher mat = pat.matcher(processTreeDump);
Assert.assertTrue("Process-tree dump doesn't contain the cmdLineDump of " + i
+ "th process!", mat.find());
}
// Not able to join thread sometimes when forking with large N.
try {
t.join(2000);
LOG.info("RogueTaskThread successfully joined.");
} catch (InterruptedException ie) {
LOG.info("Interrupted while joining RogueTaskThread.");
}
// ProcessTree is gone now. Any further calls should be sane.
p.updateProcessTree();
Assert.assertFalse("ProcessTree must have been gone", isAlive(pid));
Assert.assertTrue("Cumulative vmem for the gone-process is "
+ p.getCumulativeVmem() + " . It should be zero.", p
.getCumulativeVmem() == 0);
Assert.assertTrue(p.toString().equals("[ ]"));
}
protected ProcfsBasedProcessTree createProcessTree(String pid) {
return new ProcfsBasedProcessTree(pid);
}
protected ProcfsBasedProcessTree createProcessTree(String pid, String procfsRootDir) {
return new ProcfsBasedProcessTree(pid, procfsRootDir);
}
protected void destroyProcessTree(String pid) throws IOException {
sendSignal(pid, 9);
}
/**
* Get PID from a pid-file.
*
* @param pidFileName
* Name of the pid-file.
* @return the PID string read from the pid-file. Returns null if the
* pidFileName points to a non-existing file or if read fails from the
* file.
*/
public static String getPidFromPidFile(String pidFileName) {
BufferedReader pidFile = null;
FileReader fReader = null;
String pid = null;
try {
fReader = new FileReader(pidFileName);
pidFile = new BufferedReader(fReader);
} catch (FileNotFoundException f) {
LOG.debug("PidFile doesn't exist : " + pidFileName);
return pid;
}
try {
pid = pidFile.readLine();
} catch (IOException i) {
LOG.error("Failed to read from " + pidFileName);
} finally {
try {
if (fReader != null) {
fReader.close();
}
try {
if (pidFile != null) {
pidFile.close();
}
} catch (IOException i) {
LOG.warn("Error closing the stream " + pidFile);
}
} catch (IOException i) {
LOG.warn("Error closing the stream " + fReader);
}
}
return pid;
}
public static class ProcessStatInfo {
// sample stat in a single line : 3910 (gpm) S 1 3910 3910 0 -1 4194624
// 83 0 0 0 0 0 0 0 16 0 1 0 7852 2408448 88 4294967295 134512640
// 134590050 3220521392 3220520036 10975138 0 0 4096 134234626
// 4294967295 0 0 17 1 0 0
String pid;
String name;
String ppid;
String pgrpId;
String session;
String vmem = "0";
String rssmemPage = "0";
String utime = "0";
String stime = "0";
public ProcessStatInfo(String[] statEntries) {
pid = statEntries[0];
name = statEntries[1];
ppid = statEntries[2];
pgrpId = statEntries[3];
session = statEntries[4];
vmem = statEntries[5];
if (statEntries.length > 6) {
rssmemPage = statEntries[6];
}
if (statEntries.length > 7) {
utime = statEntries[7];
stime = statEntries[8];
}
}
// construct a line that mimics the procfs stat file.
// all unused numerical entries are set to 0.
public String getStatLine() {
return String.format("%s (%s) S %s %s %s 0 0 0" +
" 0 0 0 0 %s %s 0 0 0 0 0 0 0 %s %s 0 0" +
" 0 0 0 0 0 0 0 0" +
" 0 0 0 0 0",
pid, name, ppid, pgrpId, session,
utime, stime, vmem, rssmemPage);
}
}
/**
* A basic test that creates a few process directories and writes
* stat files. Verifies that the cpu time and memory is correctly
* computed.
* @throws IOException if there was a problem setting up the
* fake procfs directories or files.
*/
@Test (timeout = 30000)
public void testCpuAndMemoryForProcessTree() throws IOException {
// test processes
String[] pids = { "100", "200", "300", "400" };
// create the fake procfs root directory.
File procfsRootDir = new File(TEST_ROOT_DIR, "proc");
try {
setupProcfsRootDir(procfsRootDir);
setupPidDirs(procfsRootDir, pids);
// create stat objects.
// assuming processes 100, 200, 300 are in tree and 400 is not.
ProcessStatInfo[] procInfos = new ProcessStatInfo[4];
procInfos[0] = new ProcessStatInfo(new String[]
{"100", "proc1", "1", "100", "100", "100000", "100", "1000", "200"});
procInfos[1] = new ProcessStatInfo(new String[]
{"200", "proc2", "100", "100", "100", "200000", "200", "2000", "400"});
procInfos[2] = new ProcessStatInfo(new String[]
{"300", "proc3", "200", "100", "100", "300000", "300", "3000", "600"});
procInfos[3] = new ProcessStatInfo(new String[]
{"400", "proc4", "1", "400", "400", "400000", "400", "4000", "800"});
writeStatFiles(procfsRootDir, pids, procInfos);
// crank up the process tree class.
ProcfsBasedProcessTree processTree =
createProcessTree("100", procfsRootDir.getAbsolutePath());
// build the process tree.
processTree.updateProcessTree();
// verify cumulative memory
Assert.assertEquals("Cumulative virtual memory does not match", 600000L,
processTree.getCumulativeVmem());
// verify rss memory
long cumuRssMem = ProcfsBasedProcessTree.PAGE_SIZE > 0 ?
600L * ProcfsBasedProcessTree.PAGE_SIZE : 0L;
Assert.assertEquals("Cumulative rss memory does not match",
cumuRssMem, processTree.getCumulativeRssmem());
// verify cumulative cpu time
long cumuCpuTime = ProcfsBasedProcessTree.JIFFY_LENGTH_IN_MILLIS > 0 ?
7200L * ProcfsBasedProcessTree.JIFFY_LENGTH_IN_MILLIS : 0L;
Assert.assertEquals("Cumulative cpu time does not match",
cumuCpuTime, processTree.getCumulativeCpuTime());
// test the cpu time again to see if it cumulates
procInfos[0] = new ProcessStatInfo(new String[]
{"100", "proc1", "1", "100", "100", "100000", "100", "2000", "300"});
procInfos[1] = new ProcessStatInfo(new String[]
{"200", "proc2", "100", "100", "100", "200000", "200", "3000", "500"});
writeStatFiles(procfsRootDir, pids, procInfos);
// build the process tree.
processTree.updateProcessTree();
// verify cumulative cpu time again
cumuCpuTime = ProcfsBasedProcessTree.JIFFY_LENGTH_IN_MILLIS > 0 ?
9400L * ProcfsBasedProcessTree.JIFFY_LENGTH_IN_MILLIS : 0L;
Assert.assertEquals("Cumulative cpu time does not match",
cumuCpuTime, processTree.getCumulativeCpuTime());
} finally {
FileUtil.fullyDelete(procfsRootDir);
}
}
/**
* Tests that cumulative memory is computed only for
* processes older than a given age.
* @throws IOException if there was a problem setting up the
* fake procfs directories or files.
*/
@Test (timeout = 30000)
public void testMemForOlderProcesses() throws IOException {
// initial list of processes
String[] pids = { "100", "200", "300", "400" };
// create the fake procfs root directory.
File procfsRootDir = new File(TEST_ROOT_DIR, "proc");
try {
setupProcfsRootDir(procfsRootDir);
setupPidDirs(procfsRootDir, pids);
// create stat objects.
// assuming 100, 200 and 400 are in tree, 300 is not.
ProcessStatInfo[] procInfos = new ProcessStatInfo[4];
procInfos[0] = new ProcessStatInfo(new String[]
{"100", "proc1", "1", "100", "100", "100000", "100"});
procInfos[1] = new ProcessStatInfo(new String[]
{"200", "proc2", "100", "100", "100", "200000", "200"});
procInfos[2] = new ProcessStatInfo(new String[]
{"300", "proc3", "1", "300", "300", "300000", "300"});
procInfos[3] = new ProcessStatInfo(new String[]
{"400", "proc4", "100", "100", "100", "400000", "400"});
writeStatFiles(procfsRootDir, pids, procInfos);
// crank up the process tree class.
ProcfsBasedProcessTree processTree =
createProcessTree("100", procfsRootDir.getAbsolutePath());
// build the process tree.
processTree.updateProcessTree();
// verify cumulative memory
Assert.assertEquals("Cumulative memory does not match",
700000L, processTree.getCumulativeVmem());
// write one more process as child of 100.
String[] newPids = { "500" };
setupPidDirs(procfsRootDir, newPids);
ProcessStatInfo[] newProcInfos = new ProcessStatInfo[1];
newProcInfos[0] = new ProcessStatInfo(new String[]
{"500", "proc5", "100", "100", "100", "500000", "500"});
writeStatFiles(procfsRootDir, newPids, newProcInfos);
// check memory includes the new process.
processTree.updateProcessTree();
Assert.assertEquals("Cumulative vmem does not include new process",
1200000L, processTree.getCumulativeVmem());
long cumuRssMem = ProcfsBasedProcessTree.PAGE_SIZE > 0 ?
1200L * ProcfsBasedProcessTree.PAGE_SIZE : 0L;
Assert.assertEquals("Cumulative rssmem does not include new process",
cumuRssMem, processTree.getCumulativeRssmem());
// however processes older than 1 iteration will retain the older value
Assert.assertEquals("Cumulative vmem shouldn't have included new process",
700000L, processTree.getCumulativeVmem(1));
cumuRssMem = ProcfsBasedProcessTree.PAGE_SIZE > 0 ?
700L * ProcfsBasedProcessTree.PAGE_SIZE : 0L;
Assert.assertEquals("Cumulative rssmem shouldn't have included new process",
cumuRssMem, processTree.getCumulativeRssmem(1));
// one more process
newPids = new String[]{ "600" };
setupPidDirs(procfsRootDir, newPids);
newProcInfos = new ProcessStatInfo[1];
newProcInfos[0] = new ProcessStatInfo(new String[]
{"600", "proc6", "100", "100", "100", "600000", "600"});
writeStatFiles(procfsRootDir, newPids, newProcInfos);
// refresh process tree
processTree.updateProcessTree();
// processes older than 2 iterations should be same as before.
Assert.assertEquals("Cumulative vmem shouldn't have included new processes",
700000L, processTree.getCumulativeVmem(2));
cumuRssMem = ProcfsBasedProcessTree.PAGE_SIZE > 0 ?
700L * ProcfsBasedProcessTree.PAGE_SIZE : 0L;
Assert.assertEquals("Cumulative rssmem shouldn't have included new processes",
cumuRssMem, processTree.getCumulativeRssmem(2));
// processes older than 1 iteration should not include new process,
// but include process 500
Assert.assertEquals("Cumulative vmem shouldn't have included new processes",
1200000L, processTree.getCumulativeVmem(1));
cumuRssMem = ProcfsBasedProcessTree.PAGE_SIZE > 0 ?
1200L * ProcfsBasedProcessTree.PAGE_SIZE : 0L;
Assert.assertEquals("Cumulative rssmem shouldn't have included new processes",
cumuRssMem, processTree.getCumulativeRssmem(1));
// no processes older than 3 iterations, this should be 0
Assert.assertEquals("Getting non-zero vmem for processes older than 3 iterations",
0L, processTree.getCumulativeVmem(3));
Assert.assertEquals("Getting non-zero rssmem for processes older than 3 iterations",
0L, processTree.getCumulativeRssmem(3));
} finally {
FileUtil.fullyDelete(procfsRootDir);
}
}
/**
* Verifies ProcfsBasedProcessTree.checkPidPgrpidForMatch() in case of
* 'constructProcessInfo() returning null' by not writing stat file for the
* mock process
* @throws IOException if there was a problem setting up the
* fake procfs directories or files.
*/
@Test (timeout = 30000)
public void testDestroyProcessTree() throws IOException {
// test process
String pid = "100";
// create the fake procfs root directory.
File procfsRootDir = new File(TEST_ROOT_DIR, "proc");
try {
setupProcfsRootDir(procfsRootDir);
// crank up the process tree class.
createProcessTree(pid, procfsRootDir.getAbsolutePath());
// Let us not create stat file for pid 100.
Assert.assertTrue(ProcfsBasedProcessTree.checkPidPgrpidForMatch(
pid, procfsRootDir.getAbsolutePath()));
} finally {
FileUtil.fullyDelete(procfsRootDir);
}
}
/**
* Test the correctness of process-tree dump.
*
* @throws IOException
*/
@Test (timeout = 30000)
public void testProcessTreeDump()
throws IOException {
String[] pids = { "100", "200", "300", "400", "500", "600" };
File procfsRootDir = new File(TEST_ROOT_DIR, "proc");
try {
setupProcfsRootDir(procfsRootDir);
setupPidDirs(procfsRootDir, pids);
int numProcesses = pids.length;
// Processes 200, 300, 400 and 500 are descendants of 100. 600 is not.
ProcessStatInfo[] procInfos = new ProcessStatInfo[numProcesses];
procInfos[0] = new ProcessStatInfo(new String[] {
"100", "proc1", "1", "100", "100", "100000", "100", "1000", "200"});
procInfos[1] = new ProcessStatInfo(new String[] {
"200", "proc2", "100", "100", "100", "200000", "200", "2000", "400"});
procInfos[2] = new ProcessStatInfo(new String[] {
"300", "proc3", "200", "100", "100", "300000", "300", "3000", "600"});
procInfos[3] = new ProcessStatInfo(new String[] {
"400", "proc4", "200", "100", "100", "400000", "400", "4000", "800"});
procInfos[4] = new ProcessStatInfo(new String[] {
"500", "proc5", "400", "100", "100", "400000", "400", "4000", "800"});
procInfos[5] = new ProcessStatInfo(new String[] {
"600", "proc6", "1", "1", "1", "400000", "400", "4000", "800"});
String[] cmdLines = new String[numProcesses];
cmdLines[0] = "proc1 arg1 arg2";
cmdLines[1] = "proc2 arg3 arg4";
cmdLines[2] = "proc3 arg5 arg6";
cmdLines[3] = "proc4 arg7 arg8";
cmdLines[4] = "proc5 arg9 arg10";
cmdLines[5] = "proc6 arg11 arg12";
writeStatFiles(procfsRootDir, pids, procInfos);
writeCmdLineFiles(procfsRootDir, pids, cmdLines);
ProcfsBasedProcessTree processTree = createProcessTree(
"100", procfsRootDir.getAbsolutePath());
// build the process tree.
processTree.updateProcessTree();
// Get the process-tree dump
String processTreeDump = processTree.getProcessTreeDump();
LOG.info("Process-tree dump follows: \n" + processTreeDump);
Assert.assertTrue("Process-tree dump doesn't start with a proper header",
processTreeDump.startsWith("\t|- PID PPID PGRPID SESSID CMD_NAME " +
"USER_MODE_TIME(MILLIS) SYSTEM_TIME(MILLIS) VMEM_USAGE(BYTES) " +
"RSSMEM_USAGE(PAGES) FULL_CMD_LINE\n"));
for (int i = 0; i < 5; i++) {
ProcessStatInfo p = procInfos[i];
Assert.assertTrue(
"Process-tree dump doesn't contain the cmdLineDump of process "
+ p.pid, processTreeDump.contains("\t|- " + p.pid + " "
+ p.ppid + " " + p.pgrpId + " " + p.session + " (" + p.name
+ ") " + p.utime + " " + p.stime + " " + p.vmem + " "
+ p.rssmemPage + " " + cmdLines[i]));
}
// 600 should not be in the dump
ProcessStatInfo p = procInfos[5];
Assert.assertFalse(
"Process-tree dump shouldn't contain the cmdLineDump of process "
+ p.pid, processTreeDump.contains("\t|- " + p.pid + " " + p.ppid
+ " " + p.pgrpId + " " + p.session + " (" + p.name + ") "
+ p.utime + " " + p.stime + " " + p.vmem + " " + cmdLines[5]));
} finally {
FileUtil.fullyDelete(procfsRootDir);
}
}
protected static boolean isSetsidAvailable() {
ShellCommandExecutor shexec = null;
boolean setsidSupported = true;
try {
String[] args = {"setsid", "bash", "-c", "echo $$"};
shexec = new ShellCommandExecutor(args);
shexec.execute();
} catch (IOException ioe) {
LOG.warn("setsid is not available on this machine. So not using it.");
setsidSupported = false;
} finally { // handle the exit code
LOG.info("setsid exited with exit code " + shexec.getExitCode());
}
return setsidSupported;
}
/**
* Is the root-process alive?
* Used only in tests.
* @return true if the root-process is alive, false otherwise.
*/
private static boolean isAlive(String pid) {
try {
final String sigpid = isSetsidAvailable() ? "-" + pid : pid;
try {
sendSignal(sigpid, 0);
} catch (ExitCodeException e) {
return false;
}
return true;
} catch (IOException ignored) {
}
return false;
}
private static void sendSignal(String pid, int signal) throws IOException {
ShellCommandExecutor shexec = null;
String[] arg = { "kill", "-" + signal, pid };
shexec = new ShellCommandExecutor(arg);
shexec.execute();
}
/**
* Is any of the subprocesses in the process-tree alive?
* Used only in tests.
* @return true if any of the processes in the process-tree is
* alive, false otherwise.
*/
private static boolean isAnyProcessInTreeAlive(
ProcfsBasedProcessTree processTree) {
for (String pId : processTree.getCurrentProcessIDs()) {
if (isAlive(pId)) {
return true;
}
}
return false;
}
/**
* Create a directory to mimic the procfs file system's root.
* @param procfsRootDir root directory to create.
* @throws IOException if could not delete the procfs root directory
*/
public static void setupProcfsRootDir(File procfsRootDir)
throws IOException {
// cleanup any existing process root dir.
if (procfsRootDir.exists()) {
Assert.assertTrue(FileUtil.fullyDelete(procfsRootDir));
}
// create afresh
Assert.assertTrue(procfsRootDir.mkdirs());
}
/**
* Create PID directories under the specified procfs root directory
* @param procfsRootDir root directory of procfs file system
* @param pids the PID directories to create.
* @throws IOException If PID dirs could not be created
*/
public static void setupPidDirs(File procfsRootDir, String[] pids)
throws IOException {
for (String pid : pids) {
File pidDir = new File(procfsRootDir, pid);
pidDir.mkdir();
if (!pidDir.exists()) {
throw new IOException ("couldn't make process directory under " +
"fake procfs");
} else {
LOG.info("created pid dir");
}
}
}
/**
* Write stat files under the specified pid directories with data
* setup in the corresponding ProcessStatInfo objects
* @param procfsRootDir root directory of procfs file system
* @param pids the PID directories under which to create the stat file
* @param procs corresponding ProcessStatInfo objects whose data should be
* written to the stat files.
* @throws IOException if stat files could not be written
*/
public static void writeStatFiles(File procfsRootDir, String[] pids,
ProcessStatInfo[] procs) throws IOException {
for (int i=0; i<pids.length; i++) {
File statFile =
new File(new File(procfsRootDir, pids[i]),
ProcfsBasedProcessTree.PROCFS_STAT_FILE);
BufferedWriter bw = null;
try {
FileWriter fw = new FileWriter(statFile);
bw = new BufferedWriter(fw);
bw.write(procs[i].getStatLine());
LOG.info("wrote stat file for " + pids[i] +
" with contents: " + procs[i].getStatLine());
} finally {
// not handling exception - will throw an error and fail the test.
if (bw != null) {
bw.close();
}
}
}
}
private static void writeCmdLineFiles(File procfsRootDir, String[] pids,
String[] cmdLines)
throws IOException {
for (int i = 0; i < pids.length; i++) {
File statFile =
new File(new File(procfsRootDir, pids[i]),
ProcfsBasedProcessTree.PROCFS_CMDLINE_FILE);
BufferedWriter bw = null;
try {
bw = new BufferedWriter(new FileWriter(statFile));
bw.write(cmdLines[i]);
LOG.info("wrote command-line file for " + pids[i] + " with contents: "
+ cmdLines[i]);
} finally {
// not handling exception - will throw an error and fail the test.
if (bw != null) {
bw.close();
}
}
}
}
}
| {
"content_hash": "039e92d5c2ee45c8a2209685ace98310",
"timestamp": "",
"source": "github",
"line_count": 758,
"max_line_length": 90,
"avg_line_length": 36.13324538258575,
"alnum_prop": 0.6120340282595202,
"repo_name": "tomatoKiller/Hadoop_Source_Learn",
"id": "349beeb5c3e408240955560a68cad451a1f8e6de",
"size": "28195",
"binary": false,
"copies": "10",
"ref": "refs/heads/master",
"path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestProcfsBasedProcessTree.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "34568918"
},
{
"name": "Shell",
"bytes": "20902"
}
],
"symlink_target": ""
} |
module.exports = [
{id: 'overview', text: 'Overview', items: []},
{id: 'getstarted', text: 'Get started', items: []},
{id: 'text-simple', text: 'Controls', type: 'demos', items: [
{id: 'text-simple', text: 'Text', fiddle: 'http://jsfiddle.net/NfPcH/25/'},
{id: 'select-local', text: 'Select local', fiddle: 'http://jsfiddle.net/NfPcH/28/'},
{id: 'select-remote', text: 'Select remote', fiddle: 'http://jsfiddle.net/NfPcH/29/'},
{id: 'html5-inputs', text: 'HTML5 inputs', fiddle: 'http://jsfiddle.net/NfPcH/82/'},
{id: 'textarea', text: 'Textarea', fiddle: 'http://jsfiddle.net/NfPcH/32/'},
{id: 'checkbox', text: 'Checkbox', fiddle: 'http://jsfiddle.net/NfPcH/33/'},
{id: 'checklist', text: 'Checklist', fiddle: ''},
{id: 'radiolist', text: 'Radiolist', fiddle: ''},
{id: 'bsdate', text: 'Date', fiddle: 'http://jsfiddle.net/ckosloski/NfPcH/17531/', fiddleText: 'View Bootstrap 3 jsFiddle'},
{id: 'uidate', text: 'UI Date', fiddle: ''},
{id: 'bstime', text: 'Time', fiddle: 'http://jsfiddle.net/NfPcH/34/', fiddleText: 'View Bootstrap 2 jsFiddle'},
{id: 'combodate', text: 'DateTime', fiddle: '', fiddleText: 'No jsFiddle'},
{id: 'typeahead', text: 'Typeahead', fiddle: 'http://jsfiddle.net/NfPcH/46/', fiddleText: 'View Bootstrap 2 jsFiddle'},
{id: 'uiselect', text: 'UI-Select', fiddle: '', fiddleText: 'No jsFiddle'},
{id: 'ngtags', text: 'ngTagsInput', fiddle: '', fiddleText: 'No jsFiddle'}
]},
{id: 'text-customize', text: 'Techniques', type: 'demos', items: [
{id: 'text-customize', text: 'Customize input', fiddle: 'http://jsfiddle.net/NfPcH/26/'},
{id: 'text-btn', text: 'Trigger manually', fiddle: 'http://jsfiddle.net/NfPcH/27/'},
{id: 'select-nobuttons', text: 'Hide buttons', fiddle: 'http://jsfiddle.net/NfPcH/31/'},
{id: 'select-multiple', text: 'Select multiple', fiddle: 'http://jsfiddle.net/NfPcH/30/'},
{id: 'validate-local', text: 'Validate local', fiddle: 'http://jsfiddle.net/NfPcH/35/'},
{id: 'validate-remote', text: 'Validate remote', fiddle: 'http://jsfiddle.net/NfPcH/36/'},
{id: 'edit-disabled', text: 'Disable editing'},
{id: 'editable-popover', text: 'Editable Popover'}
]},
{id: 'onbeforesave', text: 'Submit', type: 'demos', items: [
{id: 'onbeforesave', text: 'Submit via onbeforesave', fiddle: 'http://jsfiddle.net/NfPcH/37/', menutext: 'Onbeforesave'},
{id: 'onaftersave', text: 'Submit via onaftersave', fiddle: 'http://jsfiddle.net/NfPcH/38/', menutext: 'Onaftersave'}
]},
{id: 'editable-form', text: 'Forms', type: 'demos', items: [
{id: 'editable-form', text: 'Editable form', nodebug: true, fiddle: 'http://jsfiddle.net/NfPcH/81/'},
]},
{id: 'editable-row', text: 'Tables', type: 'demos', items: [
{id: 'editable-row', text: 'Editable row', nodebug: true, fiddle: 'http://jsfiddle.net/NfPcH/93/'},
{id: 'editable-column', text: 'Editable column', nodebug: true, fiddle: 'http://jsfiddle.net/NfPcH/80/'},
{id: 'editable-table', text: 'Editable table', nodebug: true, fiddle: 'http://jsfiddle.net/NfPcH/78/'}
]},
{id: 'themes', anchor: 'bootstrap3', text: 'Themes', items: [
{id: 'bootstrap3', text: '', menutext: 'Bootstrap 3'},
{id: 'bootstrap2', text: '', menutext: 'Bootstrap 2'},
{id: 'default', text: '', menutext: 'Default'}
]},
{id: 'reference', anchor: 'ref-element', text: 'Reference', items: [
{id: 'ref-element', text: '', menutext: 'Editable element'},
{id: 'ref-form', text: '', menutext: 'Editable form'},
{id: 'ref-options', text: '', menutext: 'Editable options'},
]},
{id: 'dev-text', text: 'Dev Tests', type: 'demos', env: 'dev', items: [
{id: 'dev-text'},
{id: 'dev-form'},
{id: 'dev-select'},
{id: 'dev-bsdate'},
{id: 'dev-uiselect'},
{id: 'dev-theme'},
{id: 'dev-ngtags'},
{id: 'dev-radiolist'},
{id: 'dev-checklist'},
{id: 'dev-editable-row'},
{id: 'dev-textarea'},
{id: 'dev-combodate'},
{id: 'dev-eform'}
]}
];
| {
"content_hash": "ba220fce3220a88065f41b3fcf598d94",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 132,
"avg_line_length": 56.54666666666667,
"alnum_prop": 0.5722706908747937,
"repo_name": "arielcr/angular-xeditable",
"id": "86f06c95801050204f98a014559103a1f6827189",
"size": "4241",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/js/structure.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "7620"
},
{
"name": "HTML",
"bytes": "149305"
},
{
"name": "JavaScript",
"bytes": "112229"
}
],
"symlink_target": ""
} |
import argparse
from bakery_cli.fixers import CharacterSymbolsFixer
description = 'Fixes TTF NAME table strings to be ascii only'
parser = argparse.ArgumentParser(description=description)
parser.add_argument('ttf_font', nargs='+',
help="Font in OpenType (TTF/OTF) format")
args = parser.parse_args()
for path in args.ttf_font:
CharacterSymbolsFixer(None, path).apply()
| {
"content_hash": "260caacf6b3810e6edb274b734449d0a",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 61,
"avg_line_length": 28.428571428571427,
"alnum_prop": 0.7286432160804021,
"repo_name": "jessamynsmith/fontbakery",
"id": "eb02a8f1aac14f8e78b543587cf77c1a027ea752",
"size": "1122",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "tools/fontbakery-fix-ascii-fontmetadata.py",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "466249"
}
],
"symlink_target": ""
} |
/*
Theme Name: Zolix HTML v 1.1
Author: http://www.wowthemes.net/premium-themes-templates/
*/
/*==============================================* RESET*===============================================*/
html,body,div,span,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,abbr,address,cite,code,del,dfn,em,img,ins,kbd,q,samp,small,strong,sub,sup,var,b,i,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,figcaption,figure,footer,header,hgroup,menu,nav,section,summary,time,mark,audio,video {
margin:0;
padding:0;
border:0;
outline:0;
font-size:100%;
vertical-align:baseline;
background:transparent;
}
body {overflow-x:hidden;}
body {
line-height:1.7em;
-webkit-font-smoothing:antialiased;
-webkit-text-size-adjust:100%;
-moz-osx-font-smoothing:grayscale;
color:#474747;
font-weight:400;
font-size:14px;
-webkit-overflow-scrolling:touch;
}
body.admin-bar .navbar-default {
margin-top:32px;
}
a,a>* {
text-decoration:none;
color:inherit;
}
a:hover {
text-decoration:none;
color:#00cfef;
}
a:focus {
outline:none !Important;
outline-offset:0px;
}
textarea:hover,input:hover,textarea:active,input:active,textarea:focus,input:focus,button:focus,button:active,button:hover,.form-control:focus,.input-group.form-control {
outline:0px !important;
-webkit-appearance:none;
box-shadow:none;
-moz-box-shadow:none;
-webkit-box-shadow:none;
outline:none;
}
.form-control:focus {
border:1px solid #ddd;
}
.dark-bg a:hover {
color:inherit;
}
a,a:hover {
transition:.4s cubic-bezier(0.15,.46,.45,.94);
-webkit-transition:.4s cubic-bezier(0.25,.46,.45,.94);
-moz-transition:.4s cubic-bezier(0.25,.46,.45,.94);
}
p {
margin:0 0 15px;
padding:0;
}
img {
border:0;
height:auto;
max-width:100%;
-ms-interpolation-mode:bicubic;
}
button,input,select,textarea {
margin:0;
border:none;
vertical-align:baseline;
font-size:100%;
}
input[type="text"],input[type="password"],input[type="datetime"],input[type="datetime-local"],input[type="date"],input[type="month"],input[type="time"],input[type="week"],input[type="number"],input[type="email"],input[type="url"],input[type="search"],input[type="tel"],input[type="color"],textarea,select {
display:inline-block;
padding:10px 10px;
outline:none;
border-width:1px;
border-style:solid;
border-color:#ddd;
background-color:transparent;
color:#999;
font-size:12px;
-webkit-border-radius:3px;
border-radius:3px;
-webkit-box-shadow:none;
box-shadow:none;
-webkit-appearance:none;
appearance:none;
}
#comments input {width:100%;}
textarea {
resize:both;
min-height:180px;
min-width:100%;
max-width:100%;
}
ol,ul {
list-style-position:inside;
}
h1,h2,h3,h4,h5,h6 {
margin-bottom:15px;
color:#222;
line-height:1.3em;
font-weight:700;
}
h1 {
font-size:36px;
}
h2 {
font-size:24px;
}
h3 {
font-size:20px;
}
h4 {
font-size:18px;
}
h5 {
font-size:16px;
}
h6 {
font-size:14px;
}
h1 small,h2 small,h3 small,h4 small,h5 small,h6 small,.h1 small,.h2 small,.h3 small,.h4 small,.h5 small,.h6 small,h1 .small,h2 .small,h3 .small,h4 .small,h5 .small,h6 .small,.h1 .small,.h2 .small,.h3 .small,.h4 .small,.h5 .small,.h6 .small {
color:rgba(0,0,0,0.4);
letter-spacing:1px;
font-size:55%;
}
table {
color: #333; /* Lighten up font color */
border-collapse: collapse;
border-spacing: 0;
}
td, th { border: 1px solid #CCC; padding:10px;} /* Make cells a bit taller */
th {
background: #F3F3F3; /* Light grey background */
font-weight: bold; /* Make sure they're bold */
}
td {
background: #FAFAFA; /* Lighter grey background */
}
blockquote {
font-style: italic;
font-size: 110%;
padding:20px;
border:1px solid rgba(0,0,0,0.2);
margin-bottom:15px;
}
blockquote cite {
display: block;
text-align: right;
margin-top: 10px;
font-size:100%;
font-weight:700;
}
dl {
}
dt {
float: left;
clear: left;
width: 150px;
text-align: right;
font-weight: bold;
color: green;
margin-right:15px;
padding-top: 5px;
}
dt:after {
}
dd {
margin: 0 0 0 170px;
padding: 5px 0 5px 0;
}
.container {
width:100%;
max-width:1170px;
padding-left:15px;
padding-right:15px;
}
.colorarea li {
list-style:none;
}
.uppercase {
text-transform:uppercase;
}
.max80 {
max-width:80%;
margin:0px auto;
max-width:900px;
padding-left:15px;
padding-right:15px;
}
.wowshtestim .max80 {max-width:800px;}
.max70 {
max-width:70%;
margin:0px auto;
}
.max60 {
max-width:60%;
margin:0px auto;
}
.padtop60 {
padding-top:60px;
}
.padbot60 {
padding-bottom:60px;
}
.button,input[type=submit] {
display:inline-block;
margin-bottom:15px;
padding:10px 20px;
outline:none;
border:0;
background-color:#00cfef;
vertical-align:baseline;
text-align:center;
text-decoration:none;
text-transform:uppercase;
font-weight:400;
font-size:inherit;
cursor:pointer;
-webkit-transition:all .25s ease;
transition:all .25s ease;
color:#fff;
border-radius:3px;
}
.button:hover,input[type=submit]:hover {
color:#fff;
}
.button.default {
border-color:#cfcfcf;
color:#00cfef;
}
.readmore {
display:inline-block;
margin-top:15px;
font-size:12px;
border-radius:0;
letter-spacing:0.4px;
padding:5px 30px;
text-transform:uppercase;
border:1px solid #ddd;
}
.btn-continue {
border:1px solid #ddd;
padding:10px 20px;
letter-spacing:2px;
margin-top:-10px;
display:inline-block;
text-transform:uppercase;
text-align:center;
margin-bottom:40px;
border-radius:3px;
}
a.btn-continue {
}
.btn-continue:hover {
border:1px solid #333;
color:#fff;
background-color:#333;
}
.stresscolor {
color:#00cfef;
}
.stressbg {
background-color:#00cfef;
color:#fff;
}
.stressbg:hover {
color:#fff;
background-color: #333;
}
/*==============================================* ALIGNEMENTS*===============================================*/
.alignleft {
display:inline;
float:left;
margin-right:1.5em;
}
.alignright {
display:inline;
float:right;
margin-left:1.5em;
}
.aligncenter {
clear:both;
display:block;
margin: 0 auto;
}
/*==============================================* SEARCH FORM*===============================================*/
#search input {height:40px;}
/*==============================================* BLOG*===============================================*/
.contentitem h2 {
margin-top:20px;
}
.contentitem h3 {
margin-top:20px;
}
.entry-content ul ul, .entry-content ol ol{
padding-left: 10px;
}
.gallery-caption {
border:0;
margin-left: 0;
}
dl.gallery-item {
border:0;
}
dt.gallery-icon {
float:none;
}
.gallery dt {
width:auto;
width:100%;
}
.gallery img {
border:0px !important;
}
.wp-caption {
max-width:100%;
}
.wp-caption-text {
font-style:italic;
color: #999;
}
.sticky {
border: 1px dashed;
padding: 30px 30px 20px 30px;
margin-bottom: 30px;
}
.sticky .excerptphp .or-spacer {display:none;}
.bypostauthor{}
header.entry-header {
margin-bottom:30px;
position:relative;
}
.entry-header.archivephpentryheader {
margin-bottom:40px;
position:relative;
border-bottom: double medium #eee;
padding-bottom: 30px;
}
h1.entry-title {
max-width:80%;
margin:0px auto;
margin-bottom:0px;
font-size:40px;
text-transform:uppercase;
letter-spacing:-.05em;
font-weight:900;
display:inline-block;
-ms-word-wrap: break-word;
word-wrap: break-word;
}
h2.entry-title.excerpt {
max-width:80%;
margin:0px auto;
margin-top:0px;
margin-bottom:0px;
font-size:30px;
text-transform:uppercase;
letter-spacing:-.05em;
font-weight:900;
display:inline-block;
-ms-word-wrap: break-word;
word-wrap: break-word;
}
.entry-meta {
margin:0px auto;
clear:both;
float:none;
margin-top:25px;
font-size:13px;
border-top:1px solid #eee;
border-bottom:1px solid #eee;
padding:15px 0;
margin-bottom:-5px;
}
.excerptphp .entry-meta {
border: 0px none;
margin-top: -5px;
margin-bottom: -15px;
padding-bottom: 0;
}
.entry-content {
margin-bottom:20px;
}
.entry-thumbnail {
margin-bottom:15px;
overflow:hidden;
position:relative;
}
.entry-thumbnail img {
height:auto;
-webkit-transition:all 1s ease;
-moz-transition:all 1s ease;
-o-transition:all 1s ease;
-ms-transition:all 1s ease;
transition:all 1s ease;
width:100%;
}
.entry-thumbnail img:hover {
transform:scale(1.5);
-ms-transform:scale(1.5);
-moz-transform:scale(1.5);
-webkit-transform:scale(1.5);
-o-transform:scale(1.5);
}
.contentnone {
min-height:700px;
}
.excerptphp .entry-thumbnail {
float:left;
max-width:144px;
margin-right:20px;
margin-bottom:0;
}
.excerptphp .entry-thumbnail img {
}
.excerptphp .or-spacer {
margin-top:30px;
}
.wowmetadate,.wowmetaauthor,.wowmetacats,.wowmetacommentnumber {
margin-right:10px;
}
.pagination {
margin:0;
}
.pagination .current {
border:0;
padding:8px 13px;
margin-right:5px;
color:#fff;
background-color:#00cfef;
}
.pagination a {
padding:8px 13px;
margin-right:5px;
background-color:#333;
color:#fff;
}
.nav-links.clearfix {
margin-bottom:30px;
padding:15px 0;
border-top:1px solid #eee;
border-bottom:1px solid #eee;
margin-top:30px;
text-transform:uppercase;
}
.content-portfoliophp .nav-links.clearfix {
margin-top:20px;
}
.nav-links a {
position:relative;
}
.nav-previous {
position:relative;
}
.nav-previous a {
padding-left:15px;
}
.nav-links .nav-previous:before {
left:0;
content:"\f104";
font-family:FontAwesome;
position:absolute;
top:0px;
}
.nav-next {
position:relative;
}
.nav-next a {
padding-right:15px;
}
.nav-links .nav-next:after {
right:0;
content:"\f105";
font-family:FontAwesome;
position:absolute;
font-size:16px;
top:0px;
}
.tagcloud {
display:block;
clear:both;
float:none;
}
.tagcloud a {
padding:3px 8px;
margin-top:5px;
margin-bottom:5px;
display:inline-block;
margin-right:1px;
font-size:13px !Important;
background-color:#00cfef;
color:#fff;
border-radius:3px;
}
.tagcloud a:hover {
background-color:#333;
color:#fff;
}
.article-content {
}
.article-excerpt {
}
#comments {margin-top: 30px;}
#comments ul,#comments menu,#comments dir {
display:block;
list-style-type:decimal;
-webkit-margin-before:0em;
-webkit-margin-after:0em;
-webkit-margin-start:0px;
-webkit-margin-end:0px;
-webkit-padding-start:20px;
-moz-padding-start:20px;
}
#comments .comment-author {
float:left;
margin-right:20px;
}
#comments li {
list-style:none;
clear:both;
float:none;
}
#comments article {
border-bottom:1px solid #ececec;
padding:30px 0 15px;
}
#comments .comment-text {
padding-left:85px;
}
#respond {
margin-top:30px;
}
#respond h3 {
margin-bottom:25px;
text-transform:uppercase;
letter-spacing:-1px;
}
h3.comments-title {
letter-spacing:-1px;
}
.comment-list {
margin-bottom:40px;
}
#respond input[type=submit] {
font-size:inherit;
margin-top:20px;
padding:10px 20px;
letter-spacing:1px;
background-color:#00cfef;
color:#fff;
border:0;
font-weight:normal;
}
#respond input[type=submit]:hover {
background-color:#333;
color:#fff;
}
.form-allowed-tags {
display:none;
}
.comment-author img {
border-radius:50%;
}
#comments label {
margin-bottom:10px;
text-transform:uppercase;
}
#comments li.pingback {
padding: 10px;
border: 1px dashed rgba(0,0,0,0.2);
margin-top: 20px;
}
h2.widget-title,h2.widgettitle {
margin-bottom:10px;
font-weight:700;
font-size:16px;
text-transform:uppercase;
position:relative;
}
.comment-edit-link {font-style:italic;}
.sidebar-inner p {margin-bottom:5px;}
#sidebar .widget {
margin-bottom:30px;
}
.PostWrap {
float: left;
margin: 7px 0;
width: 100%;
}
.PostWrap img {
}
.postwidgettitle {
font-size: 14px;
line-height: 19px;
padding: 0;
margin: 0;
}
.postwidgetinfo {
font-size: 12px;
line-height: 16px;
padding: 0;
margin: 5px 0 0 0;
}
.widget_recent_comments ul li,.widget_categories ul li,.widget_archive ul li,.widget_links ul li,.widget_meta ul li,.widget_pages ul li,.widget_recent_entries ul li {
padding:7px 15px;
position:relative;
list-style:none;
border-bottom:1px solid #eee;
}
.widget_recent_comments ul li:before,.widget_categories ul li:before,.widget_archive ul li:before,.widget_links ul li:before,.widget_meta ul li:before,.widget_pages ul li:before,.widget_recent_entries ul li:before {
left:0;
content:"\f105";
font-family:FontAwesome;
position:absolute;
font-size:16px;
top:7px;
}
.comment-reply-link {
float: right;
}
/*==============================================* ALL PAGES*===============================================*/
#page {
background-color:#fff;
overflow:hidden;
}
.wrapmaincontent {
padding-top:80px;
padding-bottom:80px;
}
.page-header {
padding-bottom:5px;
margin-bottom:30px;
font-size:30px;
position:relative;
padding-top:10px;
letter-spacing:-1px;
text-transform:uppercase;
background-color:transparent;
margin-top:30px;
}
.page-header h1 {
font-size:30px;
font-weight:900;
}
.page-header small {
display:block;
margin-top:10px;
}
.topm20 {
margin-top:60px;
}
h2.header3 {
margin-bottom:0;
margin-top:50px;
font-size:25px;
position:relative;
letter-spacing:0px;
background-color:#fff;
display:inline-block;
padding:10px 25px;
line-height:25px;
text-transform:uppercase;
font-weight:900;
letter-spacing:-1px;
}
.text-left h2.header3 {
padding-left:0px;
}
hr.forh3 {
margin-top:-22px;
margin-bottom: 50px;
}
/*==============================================* MENU*===============================================*/
.navbar-default .navbar-brand, .navbar-default .navbar-brand:hover, .navbar-default .navbar-brand:focus{
color:inherit;
font-size:40px;
}
@media only screen and (min-width:768px) {
.navbar-default {
background-color:#fff;
-moz-box-shadow:1px 1px 30px rgba(0,0,0,0.06);
-webkit-box-shadow:1px 1px 30px rgba(0,0,0,0.06);
box-shadow:1px 1px 30px rgba(0,0,0,0.06);
}
.navbar-fixed-top {
border:0px;
}
.navbar-nav {
margin-right:-30px;
}
.navbar {
min-height:1px;
margin-bottom:0;
}
.navbar-brand {
float:left;
padding:0;
font-size:18px;
line-height:72px;
margin:0;
height:0;
transition:line-height .45s ease;
vertical-align:middle;
}
.navbar-brand img {
vertical-align:middle;
/*margin-top: 15px;*/
}
.navbar-default .navbar-nav>li>a {
font-size:13px;
padding-top:0px;
padding-bottom:0px;
line-height:72px;
transition:line-height .25s ease;
text-transform:uppercase;
transition: .4s cubic-bezier(0.15,.46,.45,.94);
-webkit-transition: .4s cubic-bezier(0.25,.46,.45,.94);
-moz-transition: .4s cubic-bezier(0.25,.46,.45,.94);
color:#222;
font-weight:600;
}
.navbar-default .navbar-nav>li>a.active {
color:#00cfef;
}
.navbar-default .navbar-nav>li>a:hover {
color:#00cfef;
transition: .4s cubic-bezier(0.15,.46,.45,.94);
-webkit-transition: .4s cubic-bezier(0.25,.46,.45,.94);
-moz-transition: .4s cubic-bezier(0.25,.46,.45,.94);
}
.navbar-fixed-top.tiny .navbar-nav>li>a,.navbar-fixed-top.tiny .navbar-brand {
line-height:60px;
transition: .4s cubic-bezier(0.15,.46,.45,.94);
-webkit-transition: .4s cubic-bezier(0.25,.46,.45,.94);
-moz-transition: .4s cubic-bezier(0.25,.46,.45,.94);
}
.navbar-fixed-top.tiny .navbar-brand img {
vertical-align:middle;
height:auto;
}
.navbar-nav ul.sub-menu {
list-style:none;
padding:0;
margin:0;
position:absolute;
z-index:99999;
left:0px;
position:absolute;
min-width:190px;
max-width:100%;
left:-50%;
box-shadow:1px 1px 30px rgba(0,0,0,0.06);
}
.navbar-nav li.menu-item-has-children {
position:relative;
}
.navbar-nav li.menu-item-has-children ul.sub-menu {
visibility:hidden;
background-color:#fff;
border-top:3px solid;
border-color:#00cfef;
}
.navbar-nav li.menu-item-has-children ul.sub-menu li a {
display:block;
font-size:13px;
-webkit-transition:none;
-moz-transition:none;
-o-transition:none;
-ms-transition:none;
transition:none;
color:inherit;
padding:7px 0;
margin:0 15px;
border-bottom:1px solid #eee;
}
.navbar-nav li.menu-item-has-children ul.sub-menu li a:hover {
color:#00cfef;
}
.navbar-nav li.menu-item-has-children ul.sub-menu li:last-child a {
border-bottom:0px;
}
.navbar-nav li.menu-item-has-children:hover ul.sub-menu {
visibility:visible;
}
.navbar-nav ul.sub-menu ul.sub-menu {
list-style:none;
padding:0;
margin:0;
position:absolute;
z-index:99999;
left:100%;
margin-top:-1px;
}
.navbar-nav ul.sub-menu li.menu-item-has-children {
position:relative;
}
.navbar-nav ul.sub-menu li.menu-item-has-children ul.sub-menu {
visibility:hidden;
background-color:#fff;
border-top:3px solid;
border-color:#00cfef;
}
.navbar-nav ul.sub-menu li.menu-item-has-children ul.sub-menu li a {
display:block;
font-size:13px;
-webkit-transition:none;
-moz-transition:none;
-o-transition:none;
-ms-transition:none;
transition:none;
color:inherit;
padding:7px 0;
margin:0 15px;
border-bottom:1px solid #ececec;
}
.navbar-nav ul.sub-menu li.menu-item-has-children ul.sub-menu li:last-child a {
border-bottom:0px;
}
.navbar-nav ul.sub-menu li.menu-item-has-children:hover ul.sub-menu {
visibility:visible;
position:absolute;
top:0px;
right: 0px;
}
}
/*==============================================* FLEXSLIDER*===============================================*/
.flex-container a:active,.flexslider a:active,.flex-container a:focus,.flexslider a:focus {
outline:none;
}
.slides,.flex-control-nav,.flex-direction-nav {
margin:0;
padding:0;
list-style:none;
}
.flexslider {
overflow:hidden;
margin:0;
padding:0;
}
.flexslider .slides>li {
display:none;
/*-webkit-backface-visibility:hidden;*/
}
.flexslider .slides img {
width:100%;
display:block;
height:auto;
}
.flex-pauseplay span {
text-transform:capitalize;
}
.slides:after {
content:".";
display:block;
clear:both;
visibility:hidden;
line-height:0;
height:0;
}
html[xmlns] .slides {
display:block;
}
* html .slides {
height:1%;
}
.no-js .slides>li:first-child {
display:block;
}
.flexslider .slides>li:first-child {
display:block;
}
.flexslider {
position:relative;
zoom:1;
}
.flex-viewport {
max-height:2000px;
/*-webkit-transition:all 1s ease;-moz-transition:all 1s ease;transition:all 1s ease;*/
}
.loading .flex-viewport {
max-height:300px;
}
.flexslider .slides {
zoom:1;
}
.flex-direction-nav {
height:0;
}
.flex-direction-nav a {
background:url(../img/flexarrows.png) no-repeat scroll 0 0 rgba(0,0,0,0.4);
width:45px;
height:45px;
position:absolute;
top:55%;
text-indent:-999em;
border-radius:2px 2px 2px 2px;
z-index:10;
}
.flex-direction-nav a:hover {
}
.flex-direction-nav li .flex-prev {
right:49px;
background-position:0 -169px;
}
.flex-direction-nav li .flex-next {
right:10px;
background-position:-35px -169px;
}
.flex-direction-nav .flex-disabled {
opacity:.3;
filter:alpha(opacity=30);
cursor:default;
}
.flexslider li {
list-style:none !important;
}
.flexslider ul,.flexslider ol {
-webkit-margin-before:0em;
-webkit-margin-after:0em;
-webkit-margin-start:0px;
-webkit-margin-end:0px;
padding-left:0px;
}
.fullwidth.flexslider {
overflow:hidden;
}
.fullwidth.flexslider .flex-direction-nav a {
background:url(img/flexarrows.png) no-repeat scroll 0 0 rgba(0,0,0,0.1);
top:49% !important;
width:50px;
height:100px;
position:absolute;
text-indent:-999em;
margin-top:-50px;
}
.fullwidth.flexslider .flex-direction-nav a:hover {
background-color:rgba(0,0,0,0.4)
}
.fullwidth.flexslider .flex-direction-nav .flex-prev {
left:0;
background-position:0;
border-radius:0 3px 3px 0;
}
.fullwidth.flexslider .flex-direction-nav .flex-next {
right:0px;
background-position:-50px 35px;
border-radius:3px 0 0 3px;
}
.fullwidth.flexslider .flex-direction-nav .flex-disabled {
opacity:.3;
filter:alpha(opacity=30);
cursor:default;
}
.homeslider.fullwidth.flexslider {
height:465px;
color:#fff;
text-shadow:0px 1px 1px rgba(0,0,0,0.3);
font-size:21px;
font-weight:300;
}
.fullwidth.flexslider h1,.fullwidth.flexslider h2,.fullwidth.flexslider h3,.fullwidth.flexslider h4,.fullwidth.flexslider h5,.fullwidth.flexslider h6 {
}
.homeslider h1 {
margin-bottom:20px;
line-height:45px;
}
.flexslider.blog {
margin-bottom:35px;
}
.flex-control-nav {
width:100%;
position:absolute;
bottom:20px;
text-align:center;
z-index:999;
}
.shtextslider .flex-control-nav {
left:0px;
}
.flex-control-nav li {
margin:0 0 0 5px;
display:inline-block;
zoom:1;
*display:inline;
}
.flex-control-nav li:first-child {
margin:0;
}
.flex-control-nav li a {
width:15px;
height:15px;
display:block;
cursor:pointer;
text-indent:-999em;
background:none repeat scroll 0 0 #fff;
border:2px solid #fff;
border-radius:20px 20px 20px 20px;
box-shadow:0 1px 3px rgba(0,0,0,0.1);
opacity:0.5;
filter:alpha(opacity=50);
}
.flex-control-nav li a:hover {
background:#fff;
border:2px solid #fff;
opacity:1;
filter:alpha(opacity=100);
}
.flex-control-nav li a.flex-active {
background:transparent;
border:2px solid #fff;
cursor:default;
opacity:1;
filter: alpha(opacity=100);
}
/* Pause/Play */
.flex-pauseplay a {
display:block;
width:20px;
height:20px;
position:absolute;
bottom:5px;
left:10px;
opacity:0.8;
z-index:10;
overflow:hidden;
cursor:pointer;
}
.flex-pauseplay a:before {
display:inline-block;
content:"";
}
.flex-pauseplay a:hover {
opacity:1;
}
.flex-pauseplay a.flex-play:before {
content: "";
}
/* Caption style */
/* IE rgba() hack */
.flex-caption {
zoom:1;
}
.flex-caption {
width:100%;
position:absolute;
}
.flex-caption div {
margin:0 auto;
}
.flex-caption.transparent.light-font span {
text-shadow:0px 1px 1px rgba(0,0,0,0.3);
}
.flex-caption.transparent.dark-font span {
color:#333;
}
.flex-caption.transparent.light-font h2 span,.flex-caption.transparent.dark-font h2 span {
line-height:27px !important;
padding:0;
}
.flex-caption.light {
color:#333;
margin-left:10px;
}
.flex-caption.light span {
background:none repeat scroll 0 0 rgba(222,222,222,0.5);
box-shadow:10px 0 0 rgba(222,222,222,0.5),-10px 0 0 rgba(222,222,222,0.5);
}
.flex-caption.dark {
color:#fff;
margin-left:10px;
}
.flex-caption.dark span {
background:none repeat scroll 0 0 rgba(0,0,0,0.3);
box-shadow:10px 0 0 rgba(0,0,0,0.3),-10px 0 0 rgba(0,0,0,0.3);
}
.flex-caption h2 span {
line-height:56px !important;
padding:5px 0;
}
.flex-caption.center {
text-align:center;
}
.flex-caption.light .button,.flex-caption.dark .button {
margin-left:-10px;
}
.flex-caption .uppercase {
font-size:25px;
font-weight:600;
text-transform:uppercase;
margin:0;
letter-spacing:1px;
}
.flex-caption .lowercase {
font-weight:300;
font-size:18px;
line-height:27px;
margin:25px 0;
}
.flex-caption {
animation:0.8s cubic-bezier(0.165,0.84,0.44,1) 0s normal none 1 avia-btt;
opacity:1;
}
.flexslider.blog .flex-caption {
width:100%;
position:absolute;
bottom:0;
background:rgba(0,0,0,0.5);
top:63%;
padding-top:15px;
color:#ccc;
font-size:14px;
line-height:24px;
}
.flexslider.blog .flex-caption a {
color:#fff;
}
.flexslider.blog .flex-caption div {
width: 75%;
}
/*==============================================* CAROUSEL*===============================================*/
/* clearfix */
.owl-carousel .owl-wrapper:after {
content:".";
display:block;
clear:both;
visibility:hidden;
line-height:0;
height: 0;
}
/* display none until init */
.owl-carousel {
display:none;
position:relative;
width:100%;
-ms-touch-action:pan-y;
}
.owl-carousel .owl-wrapper {
display:none;
position:relative;
-webkit-transform:translate3d(0px,0px,0px);
}
.owl-carousel .owl-wrapper-outer {
overflow:hidden;
position:relative;
width:100%;
}
.owl-carousel .owl-wrapper-outer.autoHeight {
-webkit-transition:height 500ms ease-in-out;
-moz-transition:height 500ms ease-in-out;
-ms-transition:height 500ms ease-in-out;
-o-transition:height 500ms ease-in-out;
transition:height 500ms ease-in-out;
}
.owl-carousel .owl-item {
float:left;
}
.owl-controls .owl-page,.owl-controls .owl-buttons div {
cursor:pointer;
}
.owl-controls {
-webkit-user-select:none;
-khtml-user-select:none;
-moz-user-select:none;
-ms-user-select:none;
user-select:none;
-webkit-tap-highlight-color: rgba(0,0,0,0);
}
/* mouse grab icon */
.grabbing {
cursor: url(grabbing.png) 8 8,move;
}
/* fix */
.owl-carousel .owl-wrapper,.owl-carousel .owl-item {
-webkit-backface-visibility:hidden;
-moz-backface-visibility:hidden;
-ms-backface-visibility:hidden;
-webkit-transform:translate3d(0,0,0);
-moz-transform:translate3d(0,0,0);
-ms-transform: translate3d(0,0,0);
}
/** Owl Carousel Owl Demo Theme * v1.3.3*/
.owl-theme .owl-controls {
margin-top:30px;
text-align: center;
}
/* Styling Next and Prev buttons */
.owl-theme .owl-controls .owl-buttons div {
color:#FFF;
display:inline-block;
zoom:1;
*display:inline;
/*IE7 life-saver */
margin:5px;
padding:3px 10px;
font-size:12px;
-webkit-border-radius:30px;
-moz-border-radius:30px;
border-radius:30px;
background:#869791;
filter:Alpha(Opacity=50);
/*IE7 fix*/
opacity:0.5;
}
/* Clickable class fix problem with hover on touch devices */
/* Use it for non-touch hover action */
.owl-theme .owl-controls.clickable .owl-buttons div:hover {
filter:Alpha(Opacity=100);
/*IE7 fix*/
opacity:1;
text-decoration:none;
}
/* Styling Pagination*/
.owl-theme .owl-controls .owl-page {
display:inline-block;
zoom:1;
*display: inline;
/*IE7 life-saver */
}
.owl-theme .owl-controls .owl-page span {
display:block;
width:12px;
height:12px;
margin:5px 7px;
filter:Alpha(Opacity=50);
/*IE7 fix*/
opacity:0.5;
-webkit-border-radius:20px;
-moz-border-radius:20px;
border-radius:20px;
background-color:rgba(0,0,0,0.5);
}
.owl-theme .owl-controls .owl-page.active span,.owl-theme .owl-controls.clickable .owl-page:hover span {
filter:Alpha(Opacity=100);
/*IE7 fix*/
opacity:1;
}
/* If PaginationNumbers is true */
.owl-theme .owl-controls .owl-page span.owl-numbers {
height:auto;
width:auto;
color:#FFF;
padding:2px 10px;
font-size:12px;
-webkit-border-radius:30px;
-moz-border-radius:30px;
border-radius:30px;
}
#wowcarousel .item {
margin:10px;
color:#FFF;
-webkit-border-radius:3px;
-moz-border-radius:3px;
border-radius:3px;
text-align:center;
}
#wowcarousel .item img {
width:auto;
margin:0 auto;
display:block;
max-width:100%;
}
#wowcarousel .item h3 {
font-size:22px;
font-weight:300;
margin:25px 0 0;
color:#fff;
}
#wowcarousel .item h4 {
margin:5px 0 0;
font-size:14px;
color: #fff;
}
/* preloading images */
.owl-item.loading {
min-height:150px;
background:url(AjaxLoader.gif) no-repeat center center
}
.orange {
color:#ff6600;
}
.darkCyan {
background:#42bdc2;
}
.forestGreen {
background:#7fc242;
}
.yellow {
background:#ffd800;
}
.dodgerBlue {
background:#388bd1;
}
.skyBlue {
background:#a1def8;
}
.zombieGreen {
background:#3fbf79;
}
.violet {
background:#db6ac5;
}
.yellowLight {
background:#fee664;
}
.steelGray {
background:#cad3d0;
}
#wowtestim .item img {
display:block;
width:100%;
height: auto;
}
/*==============================================* PORTFOLIO*===============================================*/
#isoposts {
position:relative;
}
@media (max-width:991px) {
.isoportfolio .item {
width:49%;
}
}
@media (max-width:667px) {
.isoportfolio .item {
width:100%;
}
}
.isoportfolio {
margin:0px auto;
width:100.2%;
overflow:hidden;
}
.isoportfolio .item {
width:25%;
position:relative;
height:200px;
}
.isoportfolio .item img {
width:100%;
height:auto;
height:200px;
}
.isoportfoliofilter ul {
list-style:none;
margin-bottom:40px;
}
.isoportfoliofilter li {
display:inline;
}
.isoportfoliofilter li a {
position:relative;
display:inline-block;
margin:0 0 10px 0;
padding:7px 24px;
border-style:solid;
border-width:1px 1px 1px 1px;
border-color:#ddd;
margin-right:-1px;
font-size:14px;
cursor:pointer;
-webkit-transition:all .25s ease;
transition:all .25s ease;
text-transform:uppercase;
}
.isoportfoliofilter li:last-child a {
border-right:1px solid;
border-color:#ddd;
}
.isoportfoliofilter li a.active {
border-color:#333;
background-color:#333;
color:#fff;
display:inline-block;
}
.isoportfoliofilter li:first-child a {
border-bottom-left-radius:3px;
border-top-left-radius:3px;
}
.isoportfoliofilter li:last-child a {
border-bottom-right-radius:3px;
border-top-right-radius:3px;
}
.link-caption,.pretty-caption {
font-size:19px;
color:#333;
width:40px;
height:40px;
line-height:40px;
background-color:#fff;
-webkit-transition:all 0.5s ease;
-moz-transition:all 0.5s ease;
-o-transition:all 0.5s ease;
transition:all 0.5s ease;
border-radius:50%;
}
.pretty-caption {
margin-left:6px;
}
.pretty-caption:hover,.link-caption:hover {
color:#00cfef;
-webkit-transition:all 0.5s ease;
-moz-transition:all 0.5s ease;
-o-transition:all 0.5s ease;
transition:all 0.5s ease
}
.title-caption {
display:block;
font-size:15px;
margin-top:10px;
text-transform:uppercase;
}
.taxonomy-caption {
color:#aaa;
text-transform:capitalize;
font-size:12px;
}
.portfo-captions {
margin:0px;
}
.description-caption {
padding:16px;
display:block;
border-top:0;
margin-top:-6px;
text-align:center;
border:1px solid #ddd;
border-top:0;
}
.description-caption a {
}
.porto-excerpt-caption p {
margin:0px;
border-top:1px solid #eee;
padding-top:12px;
margin-top:12px;
font-style:italic;
}
.porto-title-caption {
display:block;
text-transform:uppercase;
}
a.porto-excerpt-caption {
color: #999;
}
/*==============================================* PIC HOVER CAPTION*===============================================*/
.pic {
/* Internet Explorer 10 */
display:-ms-flexbox;
-ms-flex-pack:center;
-ms-flex-align:center;
/* Firefox */
display:-moz-box;
-moz-box-pack:center;
-moz-box-align:center;
/* Safari,Opera,and Chrome */
display:-webkit-box;
-webkit-box-pack:center;
-webkit-box-align:center;
/* W3C */
display:box;
box-pack:center;
box-align:center;
max-width:100%;
height:100%;
position:relative;
overflow:hidden;
display:block;
animation:anima 2s;
-webkit-animation:anima 2s;
-moz-animation:anima 2s;
backface-visibility:hidden;
-webkit-backface-visibility:hidden;
text-align:center;
width:100%;
}
.pic-3d {
-webkit-perspective:500;
-webkit-transform-style: preserve-3d
}
.pic-caption {
cursor:default;
position:absolute;
width:100%;
height:100%;
background-color:rgba(0,0,0,.82);
padding:30px;
text-align:center;
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=($opacity * 100))";
filter:alpha(opacity=0);
-moz-opacity:0;
-khtml-opacity:0;
opacity:0;
color:#fff;
/* Internet Explorer 10 */
display:-ms-flexbox;
-ms-flex-pack:center;
-ms-flex-align:center;
/* Firefox */
display:-moz-box;
-moz-box-pack:center;
-moz-box-align:center;
/* Safari,Opera,and Chrome */
display:-webkit-box;
-webkit-box-pack:center;
-webkit-box-align:center;
/* W3C */
display:box;
box-pack:center;
box-align:center;
}
.pic-image {
-webkit-transform:scale(1.1);
transform:scale(1.1)
}
.pic:hover .pic-image {
-webkit-transform:scale(1);
transform:scale(1);
}
.pic-title {
font-size:1.8em
}
.pic .pic-image,.pic-caption,.pic:hover .pic-caption,.pic:hover img {
-webkit-transition:all 0.5s ease;
-moz-transition:all 0.5s ease;
-o-transition:all 0.5s ease;
transition:all 0.5s ease
}
.pic:hover .bottom-to-top,.pic:hover .top-to-bottom,.pic:hover .left-to-right,.pic:hover .right-to-left,.pic:hover .rotate-in,.pic:hover .rotate-out,.pic:hover .open-up,.pic:hover .open-down,.pic:hover .open-left,.pic:hover .open-right,.pic:hover .come-left,.pic:hover .come-right {
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=($opacity * 100))";
filter:alpha(opacity=100);
-moz-opacity:1;
-khtml-opacity:1;
opacity:1
}
.bottom-to-top {
top:50%;
left:0
}
.pic:hover .bottom-to-top {
top:0;
left:0
}
.top-to-bottom {
bottom:50%;
left:0
}
.pic:hover .top-to-bottom {
left:0;
bottom:0
}
.left-to-right {
top:0;
right:50%;
}
.pic:hover .left-to-right {
right:0;
top:0
}
.right-to-left {
top:0;
left:50%
}
.pic:hover .right-to-left {
left:0;
top:0
}
.rotate-in {
transform:rotate(90deg) scale(0.1);
-webkit-transform:rotate(90deg) scale(0.1);
top:0;
left:0
}
.pic:hover .rotate-in {
transform:rotate(360deg) scale(1);
-webkit-transform:rotate(360deg) scale(1)
}
.rotate-out {
transform:rotate(90deg) scale(3);
-webkit-transform:rotate(90deg) scale(3);
top:0;
left:0
}
.pic:hover .rotate-out {
transform:rotate(360deg) scale(1);
-webkit-transform:rotate(360deg) scale(1)
}
.open-down {
transform:rotateX(-180deg);
-webkit-transform:rotateX(-180deg);
top:0;
left:0
}
.pic:hover .open-down {
transform:rotateX(0);
-webkit-transform:rotateX(0)
}
.open-up {
transform:rotateX(180deg);
-webkit-transform:rotateX(180deg);
top:0;
left:0
}
.pic:hover .open-up {
transform:rotateX(0);
-webkit-transform:rotateX(0)
}
.open-left {
transform:rotateY(180deg);
-webkit-transform:rotateY(180deg);
left:0;
top:0
}
.pic:hover .open-left {
transform:rotateY(0deg);
-webkit-transform:rotateY(0deg)
}
.open-right {
transform:rotateY(-180deg);
-webkit-transform:rotateY(-180deg);
left:0;
top:0
}
.pic:hover .open-right {
transform:rotateY(0deg);
-webkit-transform:rotateY(0deg)
}
.come-left {
transform:rotateY(90deg) rotateX(90deg);
-webkit-transform:rotateY(90deg) rotateX(90deg);
left:0;
top:0
}
.pic:hover .come-left {
transform:rotateY(0) rotateX(0);
-webkit-transform:rotateY(0) rotateX(0)
}
.come-right {
transform:rotateY(-90deg) rotateX(-90deg);
-webkit-transform:rotateY(-90deg) rotateX(-90deg);
left:0;
top:0
}
.pic:hover .come-right {
transform:rotateY(0) rotateX(0);
-webkit-transform: rotateY(0) rotateX(0)
}
/*==============================================* FRONT PAGE*===============================================*/
.page-wrapper {
padding:80px 60px 60px;
}
@media (max-width: 480px) {
.page-wrapper {
padding:80px 10px 60px;
}
}
.parallax {
overflow:hidden;
z-index:1;
}
.parallax-image {
background-position:50% 0;
background-repeat:no-repeat;
background-attachment:fixed;
background-size: auto 1000px;
}
.overlay {
position:absolute;
top:0;
bottom:0;
right:0;
left:0;
opacity:0.0;
z-index:2;
}
.parallax-content {
position:relative;
z-index:4;
padding:80px 0;
}
.wrapsection {
padding:0px 0;
position:relative;
margin:0px 0;
}
.wrapsection.texture {
background:url(img/ptn.png) repeat;
}
.title-area {
text-align:center;
max-width:70%;
display:block;
margin:0px auto;
margin-bottom:40px;
}
.content-portfoliophp .title-area {margin-bottom:20px;}
.pageheaderpagephp .title-area {
margin-bottom:0;
}
.pageheaderpagephp .title-area h2.title {
font-size:55px;
letter-spacing:0px;
}
.pageheaderpagephp .title-area .subtitle,.pageheaderpagephp .title-area {
max-width:800px;
}
.pageheaderpagephp .parallax-content {
padding:0px;
}
.downarrowpoint {
background-color:rgba(0,0,0,0.2);
height:55px;
width:55px;
text-align:center;
display:block;
margin:0px auto;
border-radius:50%;
margin-top:25px;
}
.downarrowpoint i {
line-height:55px;
font-size:25px;
}
.downarrowpoint i {
-webkit-transition-property:-webkit-transform;
-webkit-transition-duration:1s;
-moz-transition-property:-moz-transform;
-moz-transition-duration:1s;
-webkit-animation-name:pulse;
-moz-animation-name:pulse;
-webkit-animation-duration:1.5s;
-moz-animation-duration:1.5s;
-webkit-animation-iteration-count:infinite;
-moz-animation-iteration-count:infinite;
-webkit-animation-timing-function:linear;
-moz-animation-timing-function:linear;
}
@-webkit-keyframes pulse {
0 {
-webkit-transform:scale(1);
transform:scale(1);
}
50% {
-webkit-transform:scale(1.2);
transform:scale(1.2);
}
100% {
-webkit-transform:scale(1);
transform:scale(1);
}
}
@-moz-keyframes pulse {
0 {
-moz-transform:scale(1);
transform:scale(1);
}
50% {
-moz-transform:scale(1.2);
transform:scale(1.2);
}
100% {
-moz-transform:scale(1);
transform:scale(1);
}
}
.title-area h2.title,.title-area h1.title {
margin-top:0px;
font-size:40px;
text-transform:uppercase;
margin-bottom:0;
letter-spacing:-.05em;
font-weight:900;
}
.title-area .subtitle {
display:block;
font-size:110%;
line-height:1.7;
text-transform:uppercase;
max-width:80%;
margin:0px auto;
margin-top:15px;
letter-spacing:1px;
}
.light-bg .funfacts .icon {
border:2px solid;
border-color: #00cfef;
}
.dark-bg .wowanimslider .caption a,.dark-bg .wowanimslider .caption h1,.dark-bg .wowanimslider .caption h2,.dark-bg .wowanimslider .caption h3,.dark-bg .wowanimslider .caption h4,.dark-bg .wowanimslider .caption h5,.dark-bg .wowanimslider .caption h6,.dark-bg,.dark-bg h1,.dark-bg h2,.dark-bg h3,.dark-bg h4,.dark-bg h5,.dark-bg h6,.dark-bg .h1,.dark-bg .h2,.dark-bg .h3,.dark-bg .h4,.dark-bg .h5,.dark-bg .h6,.dark-bg a,.dark-bg .title-area .subtitle,.dark-bg .servicestyle2 i {
color:#fff;
}
.fullwdtharea h1,.fullwdtharea h2,.fullwdtharea h3,.fullwdtharea h4,.fullwdtharea h5,.fullwdtharea h6,.boldheaderarea h1,.boldheaderarea h2,.boldheaderarea h3,.boldheaderarea h4,.boldheaderarea h5,.boldheaderarea h6 {
color:inherit;
}
.boldheaderarea {
text-align:center;
}
.boldheaderarea h2 {
font-weight:800;
font-size:80px;
text-transform:uppercase;
margin-top:0px;
line-height:120px;
margin-bottom:0px;
}
.boldheaderarea .text1 {
font-size:18px;
letter-spacing:2px;
text-transform:uppercase;
font-weight:700;
}
.boldheaderarea .text3 {
color:inherit;
font-size:13px;
text-transform:uppercase;
letter-spacing:1px;
font-weight:300;
}
.dark-bg .funfacts .icon {
border:2px solid rgba(255,255,255,0.5);
}
.partparallaxarea h1,.partparallaxarea h2,.partparallaxarea h3,.partparallaxarea h4,.partparallaxarea h5,.partparallaxarea h6,.partparallaxarea a {
color:inherit;
}
.colorarea h1,.colorarea h2,.colorarea h3,.colorarea h4,.colorarea h5,.colorarea h6,.colorarea a {
color:inherit;
}
.dark-bg .wow-pricing-table>div {
border:1px solid rgba(255,255,255,0.1);
}
.dark-bg ul.social-icons li {
border:1px solid #fff;
}
.dark-bg .feature-item.shortcfeature2 .icon {
color:#fff;
border:1px solid #ffffff;
}
.dark-bg .nav-tabs>li>a {
color:#666;
}
.dark-bg .panel-group .panel-heading+.panel-collapse .panel-body {
background-color:#fff;
color:#666;
}
.dark-bg .wowpanel {
color:#666;
}
.dark-bg .box1 {
color:#666;
}
.dark-bg .box1 h6 {
color:#444;
}
.dark-bg .infoareaicon {
width:45px;
height:45px;
line-height:45px;
color:#444;
text-align:center;
padding:0px;
border-radius:50%;
}
.dark-bg .tab-content {
color:#666;
}
.dark-bg .btn-continue,.dark-bg #contact-form input[type="text"],.dark-bg #contact-form input[type="email"],.dark-bg #contact-form input[type="url"],.dark-bg #contact-form input[type="password"],.dark-bg #contact-form input[type="search"],.dark-bg #contact-form textarea {
border-color:#fff;
}
.dark-bg .contactbutton {
border:1px solid #fff !Important;
}
.dark-bg .owl-theme .owl-controls .owl-page span {
background-color: rgba(255,255,255,0.5);
}
/*==============================================* CONTACT *===============================================*/
#contact label {
text-transform:uppercase;
font-weight:300;
}
#contact input,#contact select,#contact textarea {
font-family:inherit;
font-size:inherit;
line-height:inherit;
color:#333;
}
#contact input,#contact select {
height:45px;
margin-bottom:0px;
}
#contact input#submit {
width:auto;
margin-top:20px;
background-color:#333;
color:#fff;
padding:0px 20px;
text-transform:uppercase;
font-weight:300;
}
#contact textarea {
height:200px;
margin-top: 20px;
}
.norightr {border-top-right-radius: 0px !Important;border-bottom-right-radius: 0px !Important; webkit-border-top-right-radius: 0px !Important; webkit-border-bottom-right-radius: 0px !Important;}
.noleftr {border-top-left-radius: 0px !Important;border-bottom-left-radius: 0px !Important; webkit-border-top-left-radius: 0px !Important; webkit-border-bottom-left-radius: 0px !Important;}
.done {
display:none;
}
.error input,input.error,.error textarea,textarea.error {
background-color:#ffffff;
border:1px solid red !Important;
-webkit-transition:border linear 0.2s,box-shadow linear 0.2s;
-moz-transition:border linear 0.2s,box-shadow linear 0.2s;
-o-transition:border linear 0.2s,box-shadow linear 0.2s;
transition:border linear 0.2s,box-shadow linear 0.2s;
}
/*==============================================* FOOTER*===============================================*/
.footer-widget-area input, .footer-widget-area textarea, .footer-widget-area select {border:1px solid; border-color:rgba(255,255,255,0.1);}
.footer-widget-area .widget_categories li,.footer-widget-area .widget_pages li,.footer-widget-area .widget_nav_menu li,.footer-widget-area .widget_recent_entries li,.footer-widget-area .widget_recent_comments li,.footer-widget-area .widget_meta li,.footer-widget-area .widget_archive li {
border-bottom:1px solid;
border-color:rgba(255,255,255,0.1);
color:rgba(255,255,255,0.8);
}
.footer-widget-area {
background-color:#262626;
padding:60px 0;
font-size:13px;
color:inherit;
color:rgba(255,255,255,0.5);
}
.footer-widget-area h3.widget_title {
color:#fff;
font-size:15px;
margin-bottom:15px;
font-weight:700;
text-transform:uppercase;
}
.nowidgetbottom {
background-color:#111;
padding:40px 0;
font-size:13px;
color:inherit;
color:rgba(255,255,255,0.7);
}
.nowidgetbottom ul.social-icons li {
border:1px solid rgba(255,255,255,0.7);
color:rgba(255,255,255,0.7);
}
.nowidgetbottom ul.social-icons li {
font-size:19px;
}
#bottom {
position:relative;
}
#back-top {
position:fixed;
bottom:50px;
right:2%;
z-index:1000;
}
#back-top span {
border-radius:50%;
-moz-transition:1s;
display:block;
position:fixed;
bottom:76px;
right:30px;
text-align:center;
font-size:16px;
line-height:47px;
height:50px;
width:50px;
z-index:100;
-webkit-transition:background-color 0.25s ease-out;
transition:background-color 0.25s ease-out;
color:rgba(255,255,255,0.95);
background-color:rgba(0,0,0,0.15);
}
#back-top a:hover span {
background-color:#00cfef;
}
#back-top a {
display:block;
text-align:center;
font:11px/100% Arial,Helvetica,sans-serif;
text-transform:uppercase;
text-decoration:none;
color:#666;
-webkit-transition:1s;
-moz-transition:1s;
transition:1s;
}
#back-top a:hover {
color:#999;
}
.or-spacer {
margin:0px auto;
width:100%;
position:relative;
margin-top:50px;
margin-bottom:50px;
}
.or-spacer .mask {
overflow:hidden;
height:1px;
}
.or-spacer .mask:after {
content:'';
display:block;
margin:-0px auto 0;
width:100%;
height:1px;
background-color:#ddd;
}
.or-spacer span {
width:50px;
height:50px;
position:absolute;
bottom:100%;
margin-bottom:-25px;
left:50%;
margin-left:-25px;
border-radius:100%;
background:white;
}
.or-spacer span i {
position:absolute;
top:4px;
bottom:4px;
left:4px;
right:4px;
border-radius:100%;
border:1px dashed #aaa;
text-align:center;
line-height:40px;
font-style:normal;
color: #999;
}
/*==============================================* CUSTOM *===============================================*/
body {
font-family: "Open Sans";
}
body {
color: ;
font-weight:400;
font-size: 13px;
}
.nav.navbar-nav {
font-family: "Open Sans";
}
.navbar-default .navbar-nav>li>a {
color: ;
font-weight:600;
}
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6, .single-project-slider .flex-caption,a.porto-title-caption {
font-family: "Open Sans";
}
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6, .service-box-1 .icon-custom-style {
color: ;
font-weight:700;
}
h2.widget-title, h2.widgettitle, .footer-widget-area h3.widget_title {
font-weight:700;}
.title-area h2.title, .title-area h1.title, h2.entry-title.excerpt, h1.entry-title, h2.header3{
font-weight:900;
color: ;
}
.navbar-default .navbar-brand { font-family:ABeeZee;}
.navbar-default .navbar-brand {
font-weight:600;
color: #ff6600;
font-size: 32px;
}
.navbar-default .navbar-brand, .navbar-default .navbar-brand:hover, .navbar-default .navbar-brand:focus {
font-size:36px;
}
@media only screen and (min-width: 768px) {
.navbar-default { opacity: 1.0;}
}
/*==============================================* RESPONSIVE*===============================================*/
@media only screen and (max-width:1220px) {
.isoportfolio .item {width:33.33333333%;}
.navbar-nav {margin-right: 0;}
.navbar>.container .navbar-brand, .navbar>.container-fluid .navbar-brand {margin-left: 0;}
.nav>li>a {padding: 10px 10px;}
#content .rotatingtweets, #content .norotatingtweets, #content p.rtw_main, p.rtw_main, div.rtw_main, div.rotatingtweet p, div.rotatingtweet {width:100% !Important;max-width:100% !important;}
#content .rotatingtweet {padding-left:0;padding-right:0;}
}
@media only screen and (min-width:800px) and (max-width:991px) {
.thumbnail {margin-bottom:20px;}
.bottom-widget {margin-top:20px;width:25%;float:left;}
.col-md-1 {width: 8.33333333%;float:left;}
.col-md-2 {width: 16.66666667%;float:left;}
.col-md-3 {width:25%;float:left;}
.col-md-4 {width:33.33333333%;float:left;}
.col-md-5 {width: 41.66666667%;float:left;}
.col-md-6 {width:50%;float:left;}
.col-md-7 {width:58.33333333%;float:left;}
.col-md-8 {width: 66.66666667%;float:left;}
.col-md-9 {width:75%;float:left;}
.col-md-10 {width:83.33333333%;float:left;}
.col-md-11{width:91.66666667%;float:left;}
.col-md-12{width:100%;}
}
@media only screen and (max-width: 991px) {
}
@media only screen and (max-width:991px) {
.wskill li:last-child {margin-bottom: 20px;}
.service-box.text-right, .service-box.text-left {text-align:center;}
.service-box-1.pull-right, .service-box-1.pull-left {float:none !important;}
.table-bordered {margin-top:20px;}
h2.header3 {margin-top:20px;}
.funfacts {margin-top:20px;}
}
@media only screen and (max-width:920px) {
.isoportfolio .item {width:50%;}
}
@media only screen and (max-width:620px) {
.isoportfolio .item {width:100%;}
.isoportfolio .item img {height:auto;}
}
@media only screen and (max-width:767px) {
body {padding-top: 50px;}
.navbar-default .navbar-collapse {width: 100%;}
.navbar-default .navbar-collapse, .navbar-default .navbar-form {border:0px;}
.navbar-default .navbar-collapse {padding-bottom:20px;}
.navbar-default .navbar-nav>li>a {border-bottom: 1px solid #ddd;}
.navbar-default .navbar-toggle .icon-bar {background-color: #fff;}
.navbar-default .navbar-toggle:hover, .navbar-default .navbar-toggle:focus, .navbar-toggle{background-color:#333;border:0px;}
.navbar-brand {margin-top: -7px;}
ul.sub-menu li {border-bottom:1px solid #ddd;padding:10px 0;}
ul.sub-menu {list-style: disc;padding-left: 20px;list-style:inside;}
.navbar-nav ul.sub-menu li.menu-item-has-children ul.sub-menu li {border-bottom:0px; border-top:1px solid #ddd;}
.navbar-nav ul.sub-menu li.menu-item-has-children ul.sub-menu {padding-top:15px;margin-bottom:-10px;}
.navbar-fixed-top {position:relative;}
.navbar-default {width:100%;max-width:100%;}
.navbar {margin-bottom:0;}
body.admin-bar .navbar-default {margin-top: 0;}
body {padding-top:0px;}
}
@media only screen and (max-width:799px) {
.wowanimslider h1, .boldheaderarea h2 {font-size: 28px;line-height:33px;padding-left:30px;padding-right:30px;}
.wowanimslider h6 {font-size: 16px;line-height:18px;padding-left:30px;padding-right:30px;}
.boldheaderarea .text1 {font-size: 16px;line-height:18px;padding-left:30px;padding-right:30px;margin-top:20px;}
.wow {
visibility: visible !important;
-webkit-animation: none !important;
-moz-animation: none !important;
-o-animation: none !important;
-ms-animation: none !important;
animation: none !important;
}
.block2 .text2, .wolf-bigtweet-content span.wolf-tweet-text {font-size:20px;line-height:25px;}
.block2 .text1 {font-size:15px;}
.title-area {max-width:100%;}
.max80 {max-width:100%;}
.title-area .subtitle {font-size:13px; line-height:16px;}
.thumbnail {margin-bottom:20px;}
.wow-pricing-table { margin-bottom:20px;}
.bottom-widget {margin-top:30px; }
.footer-widget-area h3.widget_title {margin-bottom:5px;}
.footer-widget-area {padding: 0px 0 30px;}
#content p.rtw_main, p.rtw_main, div.rtw_main, p.rtw_meta, .wowshtestim .content {font-size:13px;}
.twittericonsh { font-size:30px;}
}
@media only screen and (max-width:600px) {
.videowrap .videocontent, .videowrapsh .videocontent {height: 100%;}
.owl-carousel {display: block !important;opacity: 1 !Important;}
}
.footer-logo {
color:#f86d18;
font-size: 24px;
vertical-align: middle;
}
.helper {
display: inline-block;
height: 100%;
vertical-align: top;
}
.logo-container {
height: 70px; /* equals max image height */
width: 260px;
white-space: nowrap;
text-align: center;
}
.header-logo {
vertical-align: middle;
max-height: 40px;
max-width: 260px;
}
.navbar-logo-text {
font-size: 24px;
}
.article a {
text-decoration: none;
/*border-bottom:1px dotted;*/
border-color: #ff6600;
color: #ff6600;
}
.article a:hover {
border-bottom: 1px dotted;
}
#consoleLog {
border: solid 1px #999999;
border-top-color: #CCCCCC;
border-left-color: #CCCCCC;
padding: 5px;
width: 100%;
height: 172px;
overflow-y: scroll;
}
#consoleLog p {
font-size: 11px;
line-height: 150%;
}
#webSocketSupp {
display: none;
border: 2px solid #060;
background-color: #F0FFF0;
margin: 20px;
margin-top: 5px;
padding: 10px;
font-size: 16px;
color: #0d8900;
}
#webSocketSupp p {
font-size: 16px;
color: #0d8900;
}
#noWebSocketSupp {
display: none;
border: 2px solid #cb0000;
background-color: #FFE1E1;
margin: 20px;
margin-top: 5px;
padding: 10px;
font-size: 16px;
color: #800000;
}
#noWebSocketSupp p {
font-size: 16px;
line-height: 125%;
color: #800000;
margin-top: 10px;
}
#noWebSocketSupp p:first-child {
margin-top: 0px;
}
#echo {
}
#echo button {
margin-top: 5px;
}
.draw-border {
border:1px solid #ccc;
}
figcaption {
font-weight: 700;
padding-top: 10px;
padding-bottom: 20px;
}
.echo-button {
background-color: #eee;
/*color: #f60;*/
vertical-align:baseline;
font-size:100%;
font-weight: 700;
border-color: #ccc;
border-width: 1px;
border-style: solid !important;
}
.echo-button:hover {
color: #f60;
border-color: #f60;
border-width: 1px;
border-style: solid !important;
}
.echo-checkbox {
-webkit-appearance: checkbox !important;
color: green;
}
.echo-checkbox:hover {
outline:5px !important;
-webkit-appearance:checkbox !important;
box-shadow:none;
-moz-box-shadow:none;
-webkit-box-shadow:none;
outline:1px;
}
.github-info {
padding: 10px;
background-color:#eee;
border-color: #ccc;
margin-bottom: 0;
}
.github-info a {
color:#f47d31;
}
.github-image {
margin-right: 20px;
vertical-align: middle;
}
.orange {
color:#f47d31;
}
.space {
padding-bottom: 40px;
}
body
{
}
| {
"content_hash": "e90008b59f2f8913ef3b7b508b9448c3",
"timestamp": "",
"source": "github",
"line_count": 2386,
"max_line_length": 479,
"avg_line_length": 21.308466051969823,
"alnum_prop": 0.6829786397073286,
"repo_name": "bridgedotnet/Demos",
"id": "9f39e7448ed4b7e9b40da842de746b519a041dfa",
"size": "50844",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Html5/WebSocketSample/Bridge/css/style.css",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP",
"bytes": "6195"
},
{
"name": "Batchfile",
"bytes": "250"
},
{
"name": "C#",
"bytes": "319100"
},
{
"name": "CSS",
"bytes": "55049"
},
{
"name": "HTML",
"bytes": "36803"
},
{
"name": "JavaScript",
"bytes": "4651030"
},
{
"name": "Shell",
"bytes": "248"
},
{
"name": "TypeScript",
"bytes": "1169"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<!--[if lt IE 10]> <html lang="en" class="iex"> <![endif]-->
<!--[if (gt IE 10)|!(IE)]><!-->
<html lang="en">
<!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>List masonry | Components | Photography</title>
<meta name="description" content="HTML5/CSS3 template components for Photography and business industries, based on Framework Y.">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<link rel="stylesheet" href="../../plugins/bootstrap/css/bootstrap.css">
<script src="../../script.js"></script>
<link rel="stylesheet" href="../../style.css">
<link rel="stylesheet" href='../../css/animations.css'>
<link rel="stylesheet" href='../../css/components.css'>
<link rel="stylesheet" href='../../css/content-box.css'>
<link rel="stylesheet" href='../../css/image-box.css'>
<link rel="stylesheet" href='../../plugins/magnific-popup.css'>
<script src='../../plugins/jquery.magnific-popup.min.js'></script>
<link rel="icon" href="/favicon.ico">
</head>
<body>
<div id="preloader"></div>
<header data-menu-anima="fade-left">
<div class="navbar navbar-default over wide-area" role="navigation">
<div class="navbar navbar-main over">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle">
<i class="fa fa-bars"></i>
</button>
<a class="navbar-brand" href="../../index.html"><img src="../../images/logo.png" alt="logo" /></a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav over mega-menu-fullwidth">
<li class="dropdown active current-active">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button">Home <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="../../index.html">Home 1</a></li>
<li><a href="../../index-2.html">Home 2</a></li>
<li><a href="../../index-3.html">Home 3</a></li>
</ul>
</li>
<li class="dropdown mega-dropdown mega-tabs">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Features <span class="caret"></span></a>
<div class="mega-menu dropdown-menu multi-level row bg-menu" style="background-image:url(../../images/menu-bg.jpg)">
<div class="tab-box" data-tab-anima="fade-left">
<ul class="nav nav-tabs">
<li class="active"><a href="#">Titles</a></li>
<li><a href="#">Headers</a></li>
<li><a href="#">Components</a></li>
<li><a href="#">Containers</a></li>
</ul>
<div class="panel active">
<div class="col">
<h5>Image background</h5>
<ul class="fa-ul text-s">
<li><i class="fa-li fa fa-photo"></i> <a href="../../features/titles/template-title-image.html">Image background</a></li>
<li><i class="fa-li fa fa-photo"></i> <a href="../../features/titles/template-title-image-fullscreen.html">Image full-screen</a></li>
<li><i class="fa-li fa fa-photo"></i> <a href="../../features/titles/template-title-image-fullscreen-parallax.html">Image full-screen parallax</a></li>
<li><i class="fa-li fa fa-photo"></i> <a href="../../features/titles/template-title-image-parallax.html">Image parallax</a></li>
<li><i class="fa-li fa fa-photo"></i> <a href="../../features/titles/template-title-image-parallax-ken-burn.html">Image parallax ken-burn</a></li>
</ul>
<hr class="space xs">
<h5>Base titles</h5>
<ul class="fa-ul text-s">
<li><i class="fa-li fa fa-dot-circle-o"></i> <a href="../../features/titles/template-title-base-1.html">Title base 1</a></li>
<li><i class="fa-li fa fa-dot-circle-o"></i> <a href="../../features/titles/template-title-base-2.html">Title base 2</a></li>
<li><i class="fa-li fa fa-dot-circle-o"></i> <a href="../../features/titles/template-title-bootstrap.html">Title bootstrap</a></li>
</ul>
</div>
<div class="col">
<h5>Video background</h5>
<ul class="fa-ul text-s">
<li><i class="fa-li fa fa-film"></i> <a href="../../features/titles/template-title-video-mp4.html">Video background MP4</a></li>
<li><i class="fa-li fa fa-film"></i> <a href="../../features/titles/template-title-video-youtube.html">Video background Youtube</a></li>
<li><i class="fa-li fa fa-film"></i> <a href="../../features/titles/template-title-video-fullscreen.html">Video full-screen</a></li>
<li><i class="fa-li fa fa-film"></i> <a href="../../features/titles/template-title-video-fullscreen-parallax.html">Video full-screen parallax</a></li>
<li><i class="fa-li fa fa-film"></i> <a href="../../features/titles/template-title-video-parallax.html">Video parallax</a></li>
</ul>
<hr class="space xs">
<h5>Animation background</h5>
<ul class="fa-ul text-s">
<li><i class="fa-li fa fa-leaf"></i> <a href="../../features/titles/template-title-animation.html">Animation background</a></li>
<li><i class="fa-li fa fa-leaf"></i> <a href="../../features/titles/template-title-animation-parallax.html">Animation background parallax</a></li>
</ul>
</div>
<div class="col">
<h5>Slider background</h5>
<ul class="fa-ul text-s">
<li><i class="fa-li fa fa-sliders"></i> <a href="../../features/titles/template-title-slider.html">Slider background</a></li>
<li><i class="fa-li fa fa-sliders"></i> <a href="../../features/titles/template-title-slider-fullscreen.html">Slider full-screen</a></li>
<li><i class="fa-li fa fa-sliders"></i> <a href="../../features/titles/template-title-slider-fullscreen-parallax.html">Slider full-screen parallax</a></li>
<li><i class="fa-li fa fa-sliders"></i> <a href="../../features/titles/template-title-slider-parallax.html">Slider parallax</a></li>
</ul>
</div>
</div>
<div class="panel">
<div class="col">
<h5>Horizontal menus</h5>
<ul class="fa-ul text-s">
<li><i class="fa-li fa fa-list"></i> <a href="../../features/menus/menu-classic.html">Menu classic</a></li>
<li><i class="fa-li fa fa-list"></i> <a href="../../features/menus/menu-classic-transparent.html">Menu classic transparent</a></li>
<li><i class="fa-li fa fa-list"></i> <a href="../../features/menus/menu-big-logo.html">Menu big logo</a></li>
<li><i class="fa-li fa fa-list"></i> <a href="../../features/menus/menu-subline.html">Menu subline</a></li>
<li><i class="fa-li fa fa-list"></i> <a href="../../features/menus/menu-subtitle.html">Menu subtitle</a></li>
</ul>
</div>
<div class="col">
<h5>Horizontal menus</h5>
<ul class="fa-ul text-s">
<li><i class="fa-li fa fa-list"></i> <a href="../../features/menus/menu-middle-logo.html">Menu middle logo</a></li>
<li><i class="fa-li fa fa-list"></i> <a href="../../features/menus/menu-middle-logo-top.html">Menu middle logo top</a></li>
<li><i class="fa-li fa fa-list"></i> <a href="../../features/menus/menu-middle-box.html">Menu middle box</a></li>
<li><i class="fa-li fa fa-list"></i> <a href="../../features/menus/menu-icons.html">Menu icons</a></li>
<li><i class="fa-li fa fa-list"></i> <a href="../../features/menus/menu-icons-top.html">Menu icons top</a></li>
</ul>
</div>
<div class="col">
<h5>Side menus</h5>
<ul class="fa-ul text-s">
<li><i class="fa-li fa fa-bars"></i> <a href="../../features/menus/menu-side.html">Side classic</a></li>
<li><i class="fa-li fa fa-bars"></i> <a href="../../features/menus/menu-side-lateral.html">Side lateral</a></li>
<li><i class="fa-li fa fa-bars"></i> <a href="../../features/menus/menu-side-simple.html">Side simple</a></li>
</ul>
</div>
</div>
<div class="panel">
<div class="col">
<h5>Components</h5>
<ul class="fa-ul text-s">
<li><i class="fa-li fa fa-cubes"></i> <a href="../../features/components/icons.html">Icons</a></li>
<li><i class="fa-li fa fa-plus"></i> <a href="../../features/components/counters-countdown.html">Counters</a></li>
<li><i class="fa-li fa fa-clock-o"></i> <a href="../../features/components/counters-countdown.html">Countdowns</a></li>
<li><i class="fa-li fa fa-tasks"></i> <a href="../../features/components/progress-bars.html">Progress bars</a></li>
<li><i class="fa-li fa fa-circle-o"></i> <a href="../../features/components/progress-bars.html">Circle progress bars</a></li>
<li><i class="fa-li fa fa-calendar"></i> <a href="../../features/components/timeline.html">Timeline</a></li>
<li><i class="fa-li fa fa-map-marker"></i> <a href="../../features/components/maps.html">Google maps</a></li>
<li><i class="fa-li fa fa-table"></i> <a href="../../features/components/tables.html">Advanced table</a></li>
</ul>
</div>
<div class="col">
<h5>Main components</h5>
<ul class="fa-ul text-s">
<li><i class="fa-li fa fa-cube"></i> <a href="../../features/components/buttons.html">Buttons</a></li>
<li><i class="fa-li fa fa-photo"></i> <a href="../../features/components/image-boxes.html">Image boxes</a></li>
<li><i class="fa-li fa fa-photo"></i> <a href="../../features/components/image-boxes-advanced.html">Advanced image boxes</a></li>
<li><i class="fa-li fa fa-th-large"></i> <a href="../../features/components/content-box.html">Content boxes</a></li>
<li><i class="fa-li fa fa-facebook-official"></i> <a href="../../features/components/social-media.html">Social media</a></li>
<li><i class="fa-li fa fa-list"></i> <a href="../../features/components/lists.html">Lists</a></li>
<li><i class="fa-li fa fa-paragraph"></i> <a href="../../features/components/typography.html">Typography</a></li>
</ul>
</div>
<div class="col">
<h5>Footer</h5>
<ul class="fa-ul text-s">
<li><i class="fa-li fa fa-download"></i> <a href="../../features/footers/footer-parallax.html">Footer parallax</a></li>
<li><i class="fa-li fa fa-download"></i> <a href="../../features/footers/footer-minimal.html">Footer minimal</a></li>
<li><i class="fa-li fa fa-download"></i> <a href="../../features/footers/footer-base.html">Footer base</a></li>
</ul>
<hr class="space xs">
<h5>PHP</h5>
<ul class="fa-ul text-s">
<li><i class="fa-li fa fa-comments-o"></i> <a href="../../features/components/php-contact-form.html">Contact form</a></li>
</ul>
</div>
</div>
<div class="panel">
<div class="col">
<h5>Lists</h5>
<ul class="fa-ul text-s">
<li><i class="fa-li fa fa-list-ol"></i> <a href="../../features/containers/list-grid.html">Grid</a></li>
<li><i class="fa-li fa fa-list-ol"></i> <a href="../../features/containers/list-masonry.html">Masonry</a></li>
</ul>
<hr class="space xs">
<h5>Others</h5>
<ul class="fa-ul text-s">
<li><i class="fa-li fa fa-expand"></i> <a href="../../features/containers/lightbox.html">Lightbox and popups</a></li>
<li><i class="fa-li fa fa-sliders"></i> <a href="../../features/containers/sliders.html">Sliders and carousels</a></li>
<li><i class="fa-li fa fa-toggle-down"></i> <a href="../../features/containers/scroll-box-collapse.html">Scroll box</a></li>
<li><i class="fa-li fa fa-minus"></i> <a href="../../features/containers/scroll-box-collapse.html">Collapse box</a></li>
<li><i class="fa-li fa fa-square-o"></i> <a href="../../features/containers/tabs.html">Tabs</a></li>
<li><i class="fa-li fa fa-minus-square-o"></i> <a href="../../features/containers/accordions.html">Accordions</a></li>
</ul>
</div>
<div class="col">
<h5>Sections</h5>
<ul class="fa-ul text-s">
<li><i class="fa-li fa fa-photo"></i> <a href="../../features/containers/section-background-image.html">Background image</a></li>
<li><i class="fa-li fa fa-photo"></i> <a href="../../features/containers/section-background-image-parallax.html">Background parallax</a></li>
<li><i class="fa-li fa fa-sliders"></i> <a href="../../features/containers/section-slider.html">Slider</a></li>
<li><i class="fa-li fa fa-film"></i> <a href="../../features/containers/section-background-video.html">Background video</a></li>
<li><i class="fa-li fa fa-leaf"></i> <a href="../../features/containers/section-animations.html">Background animations</a></li>
<li><i class="fa-li fa fa-leaf"></i> <a href="../../features/containers/section-animations-parallax.html">Background animations parallax</a></li>
</ul>
</div>
</div>
</div>
</div>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">About <span class="caret"></span></a>
<div class="mega-menu dropdown-menu multi-level row bg-menu" style="background-image:url(../../images/menu-bg.jpg)">
<div class="col">
<h5>Miscellaneous</h5>
<ul class="fa-ul text-s">
<li><i class="fa-li fa fa-home"></i><a href="../../about-1.html">About 1</a></li>
<li><i class="fa-li fa fa-home"></i><a href="../../about-2.html">About 2</a></li>
<li><i class="fa-li fa fa-home"></i><a href="../../about-3.html">About 3</a></li>
<li><i class="fa-li fa fa-trophy"></i><a href="../../careers.html">Careers</a></li>
<li><i class="fa-li fa fa-trophy"></i><a href="../../certifications.html">Certifications</a></li>
<li><i class="fa-li fa fa-question"></i><a href="../../faq.html">Faq</a></li>
<li><i class="fa-li fa fa-history"></i><a href="../../history.html">History</a></li>
<li><i class="fa-li fa fa-user-secret"></i><a href="../../partners.html">Partners</a></li>
<li><i class="fa-li fa fa-users"></i><a href="../../team.html">Team</a></li>
<li><i class="fa-li fa fa-users"></i><a href="../../who-we-are.html">Who we are</a></li>
</ul>
</div>
<div class="col">
<h5>Services</h5>
<ul class="fa-ul text-s">
<li><i class="fa-li fa fa-list"></i><a href="../../services-1.html">Services 1</a></li>
<li><i class="fa-li fa fa-list"></i><a href="../../services-2.html">Services 2</a></li>
<li><i class="fa-li fa fa-list"></i><a href="../../services-3.html">Services 3</a></li>
<li><i class="fa-li fa fa-list"></i><a href="../../service-single-1.html">Services single</a></li>
</ul>
<hr class="space xs">
<h5>Various</h5>
<ul class="fa-ul text-s">
<li><i class="fa-li fa fa-dollar"></i><a href="../../pricing.html">Pricing</a></li>
<li><i class="fa-li fa fa-backward"></i><a href="../../404.html">404</a></li>
<li><i class="fa-li fa fa-flash"></i><a href="../../coming-soon.html">Coming soon</a></li>
</ul>
</div>
</div>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button">Photos <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="../../gallery-grid.html">Grid gallery</a></li>
<li><a href="../../gallery-masonry.html">Masonry gallery</a></li>
<li><a href="../../gallery-album.html">Albums gallery</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Portfolio <span class="caret"></span></a>
<div class="mega-menu dropdown-menu multi-level row bg-menu" style="background-image:url(../../images/menu-bg.jpg);">
<div class="col">
<h5>Portfolio 1</h5>
<ul class="fa-ul text-s">
<li><i class="fa-li fa fa-desktop"></i><a href="../../portfolio-1-gutted-boxed.html">Gutted boxed</a></li>
<li><i class="fa-li fa fa-desktop"></i><a href="../../portfolio-1-gutted-full-width.html">Gutted full width</a></li>
</ul>
<hr class="space xs">
<h5>Portfolio 2</h5>
<ul class="fa-ul text-s">
<li><i class="fa-li fa fa-desktop"></i><a href="../../portfolio-2-full-width.html">Full width</a></li>
<li><i class="fa-li fa fa-desktop"></i><a href="../../portfolio-2-boxed.html">Boxed</a></li>
<li><i class="fa-li fa fa-desktop"></i><a href="../../portfolio-2-gutted-boxed.html">Gutted boxed</a></li>
<li><i class="fa-li fa fa-desktop"></i><a href="../../portfolio-2-gutted-full-width.html">Gutted full width</a></li>
</ul>
<hr class="space xs">
<h5>Portfolio 3</h5>
<ul class="fa-ul text-s">
<li><i class="fa-li fa fa-desktop"></i><a href="../../portfolio-3-full-width.html">Full width</a></li>
<li><i class="fa-li fa fa-desktop"></i><a href="../../portfolio-3-boxed.html">Boxed</a></li>
<li><i class="fa-li fa fa-desktop"></i><a href="../../portfolio-3-gutted-boxed.html">Gutted boxed</a></li>
<li><i class="fa-li fa fa-desktop"></i><a href="../../portfolio-3-gutted-full-width.html">Gutted full width</a></li>
</ul>
</div>
<div class="col">
<h5>Portfolio 4</h5>
<ul class="fa-ul text-s">
<li><i class="fa-li fa fa-desktop"></i><a href="../../portfolio-4-gutted-boxed.html">Gutted boxed</a></li>
<li><i class="fa-li fa fa-desktop"></i><a href="../../portfolio-4-gutted-full-width.html">Gutted full width</a></li>
</ul>
<hr class="space xs">
<h5>Portfolio single</h5>
<ul class="fa-ul text-s">
<li><i class="fa-li fa fa-tencent-weibo"></i><a href="../../portfolio-single-1.html">Portfolio single 1</a></li>
<li><i class="fa-li fa fa-tencent-weibo"></i><a href="../../portfolio-single-2.html">Portfolio single 2</a></li>
<li><i class="fa-li fa fa-tencent-weibo"></i><a href="../../portfolio-single-3.html">Portfolio single 3</a></li>
<li><i class="fa-li fa fa-tencent-weibo"></i><a href="../../portfolio-single-4.html">Portfolio single 4</a></li>
<li><i class="fa-li fa fa-tencent-weibo"></i><a href="../../portfolio-single-5.html">Portfolio single 5</a></li>
</ul>
</div>
</div>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Blog <span class="caret"></span></a>
<div class="mega-menu dropdown-menu multi-level row bg-menu" style="background-image:url(../../images/menu-bg.jpg)">
<div class="col">
<ul class="fa-ul text-s">
<li><i class="fa-li fa fa-newspaper-o"></i><a href="../../blog-1.html">Blog 1</a></li>
<li><i class="fa-li fa fa-newspaper-o"></i><a href="../../blog-2.html">Blog 2</a></li>
<li><i class="fa-li fa fa-newspaper-o"></i><a href="../../blog-grid.html">Grid blog</a></li>
<li><i class="fa-li fa fa-newspaper-o"></i><a href="../../blog-masonry.html">Masonry blog</a></li>
<li><i class="fa-li fa fa-facebook"></i><a href="../../blog-social.html">Blog social</a></li>
<li><i class="fa-li fa fa-paper-plane"></i><a href="../../blog-single-1.html">Blog single 1</a></li>
<li><i class="fa-li fa fa-paper-plane"></i><a href="../../blog-single-2.html">Blog single 2</a></li>
</ul>
</div>
</div>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button">Contacts <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="../../contacts-1.html">Contacts 1</a></li>
<li><a href="../../contacts-2.html">Contacts 2</a></li>
</ul>
</li>
</ul>
<div class="nav navbar-nav navbar-right">
<div class="navbar-left custom-area">
+1 800 356 17 49
</div>
<div class="btn-group navbar-left navbar-social">
<div class="btn-group social-group">
<a target="_blank" href="#"><i class="fa fa-facebook"></i></a>
<a target="_blank" href="#"><i class="fa fa-twitter"></i></a>
<a target="_blank" href="#"><i class="fa fa-instagram"></i></a>
<a target="_blank" href="#"><i class="fa fa-youtube"></i></a>
</div>
</div>
<ul class="nav navbar-nav over lan-menu">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"><img alt="" src="../../images/en.png" />EN <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#"><img alt="" src="../../images/it.png" />IT</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</header>
<div class="header-title white ken-burn" data-parallax="scroll" data-position="top" data-natural-height="550" data-natural-width="1366" data-image-src="../../images/title-3.jpg">
<div class="container">
<div class="title-base">
<hr class="anima" />
<h1>LIST MASONRY</h1>
<p>Features and components of Photography</p>
</div>
</div>
</div>
<div class="section-empty">
<div class="container content">
<h5 class="text-center">MASONRY IMAGE AND VIDEO GALLERY - WITH PAGINATION</h5>
<hr class="space m" />
<div class="maso-list gallery">
<div class="navbar navbar-inner">
<div class="navbar-toggle"><i class="fa fa-bars"></i><span>Menu</span><i class="fa fa-angle-down"></i></div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav over ms-rounded inner nav-center maso-filters">
<li class="current-active active"><a data-filter="maso-item">All</a></li>
<li><a data-filter="filter-1">Filter 1</a></li>
<li><a data-filter="filter-2" href="#">Filter 2</a></li>
<li><a class="maso-order" data-sort="asc"><i class="fa fa-arrow-down"></i></a></li>
</ul>
</div>
</div>
<div class="maso-box row" data-lightbox-anima="show-scale">
<div class="maso-item col-md-4 row-10 filter-1">
<a class="img-box i-center" href="../../images/projects/project_1.jpg" data-anima="show-scale" data-trigger="hover" data-anima-out="hide">
<i class="fa fa-camera anima"></i>
<img alt="" src="../../images/projects/project_1.jpg">
</a>
</div>
<div class="maso-item col-md-4 row-17 filter-1">
<a class="img-box mfp-iframe i-center" href="http://www.youtube.com/watch?v=bpqhStV2_rc" data-anima="show-scale" data-trigger="hover" data-anima-out="hide">
<i class="fa fa-film anima"></i>
<img alt="" src="../../images/projects/project_2.jpg" />
</a>
</div>
<div class="maso-item col-md-4 filter-1">
<a class="img-box i-center" href="../../images/projects/project_3.jpg" data-anima="show-scale" data-trigger="hover" data-anima-out="hide">
<i class="fa fa-camera anima"></i>
<img alt="" src="../../images/projects/project_3.jpg">
</a>
</div>
<div class="maso-item col-md-4 filter-2">
<a class="img-box i-center" href="../../images/projects/project_4.jpg" data-anima="show-scale" data-trigger="hover" data-anima-out="hide">
<i class="fa fa-camera anima"></i>
<img alt="" src="../../images/projects/project_4.jpg">
</a>
</div>
<div class="maso-item col-md-4 filter-2">
<a class="img-box i-center" href="../../images/projects/project_5.jpg" data-anima="show-scale" data-trigger="hover" data-anima-out="hide">
<i class="fa fa-camera anima"></i>
<img alt="" src="../../images/projects/project_5.jpg">
</a>
</div>
<div class="maso-item col-md-4 row-14 filter-1">
<a class="img-box i-center" href="../../images/projects/project_1.jpg" data-anima="show-scale" data-trigger="hover" data-anima-out="hide">
<i class="fa fa-camera anima"></i>
<img alt="" src="../../images/projects/project_1.jpg">
</a>
</div>
<div class="maso-item col-md-4 filter-2">
<a class="img-box mfp-iframe i-center" href="http://www.youtube.com/watch?v=bpqhStV2_rc" data-anima="show-scale" data-trigger="hover" data-anima-out="hide">
<i class="fa fa-film anima"></i>
<img alt="" src="../../images/projects/project_2.jpg" />
</a>
</div>
<div class="maso-item col-md-4 row-17 filter-2">
<a class="img-box i-center" href="../../images/projects/project_3.jpg" data-anima="show-scale" data-trigger="hover" data-anima-out="hide">
<i class="fa fa-camera anima"></i>
<img alt="" src="../../images/projects/project_3.jpg">
</a>
</div>
<div class="maso-item col-md-4 row-17 filter-1 filter-2">
<a class="img-box i-center" href="../../images/projects/project_4.jpg" data-anima="show-scale" data-trigger="hover" data-anima-out="hide">
<i class="fa fa-camera anima"></i>
<img alt="" src="../../images/projects/project_4.jpg">
</a>
</div>
<div class="maso-item col-md-4 filter-1 filter-2">
<a class="img-box i-center" href="../../images/projects/project_5.jpg" data-anima="show-scale" data-trigger="hover" data-anima-out="hide">
<i class="fa fa-camera anima"></i>
<img alt="" src="../../images/projects/project_5.jpg">
</a>
</div>
</div>
<div class="list-nav">
<ul class="pagination-sm pagination-maso" data-page-items="6" data-pagination-anima="show-scale"></ul>
</div>
</div>
<hr class="space s" />
<hr />
<hr class="space s" />
<h5 class="text-center">MASONRY IMAGE AND VIDEO GALLERY - WITH LOAD MORE</h5>
<hr class="space m" />
<div class="maso-list maso-layout gallery">
<div class="navbar navbar-inner">
<div class="navbar-toggle"><i class="fa fa-bars"></i><span>Menu</span><i class="fa fa-angle-down"></i></div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav over ms-rounded inner nav-center maso-filters">
<li class="current-active active"><a data-filter="maso-item">All</a></li>
<li><a data-filter="filter-1">Filter 1</a></li>
<li><a data-filter="filter-2" href="#">Filter 2</a></li>
<li><a class="maso-order" data-sort="asc"><i class="fa fa-arrow-down"></i></a></li>
</ul>
</div>
</div>
<div class="maso-box row" data-lightbox-anima="show-scale">
<div class="maso-item col-md-4 filter-1">
<a class="img-box i-center" href="../../images/projects/project_1.jpg" data-anima="show-scale" data-trigger="hover" data-anima-out="hide">
<i class="fa fa-camera anima"></i>
<img alt="" src="../../images/projects/project_1.jpg">
</a>
</div>
<div class="maso-item col-md-4 filter-2">
<a class="img-box mfp-iframe i-center" href="http://www.youtube.com/watch?v=bpqhStV2_rc" data-anima="show-scale" data-trigger="hover" data-anima-out="hide">
<i class="fa fa-film anima"></i>
<img alt="" src="../../images/projects/project_2.jpg" />
</a>
</div>
<div class="maso-item col-md-4 filter-1 filter-2">
<a class="img-box i-center" href="../../images/projects/project_3.jpg" data-anima="show-scale" data-trigger="hover" data-anima-out="hide">
<i class="fa fa-camera anima"></i>
<img alt="" src="../../images/projects/project_3.jpg">
</a>
</div>
<div class="maso-item col-md-4 filter-2">
<a class="img-box i-center" href="../../images/projects/project_4.jpg" data-anima="show-scale" data-trigger="hover" data-anima-out="hide">
<i class="fa fa-camera anima"></i>
<img alt="" src="../../images/projects/project_4.jpg">
</a>
</div>
<div class="maso-item col-md-4 filter-1 filter-2">
<a class="img-box i-center" href="../../images/projects/project_5.jpg" data-anima="show-scale" data-trigger="hover" data-anima-out="hide">
<i class="fa fa-camera anima"></i>
<img alt="" src="../../images/projects/project_5.jpg">
</a>
</div>
<div class="maso-item col-md-4 filter-2">
<a class="img-box i-center" href="../../images/projects/project_1.jpg" data-anima="show-scale" data-trigger="hover" data-anima-out="hide">
<i class="fa fa-camera anima"></i>
<img alt="" src="../../images/projects/project_1.jpg">
</a>
</div>
<div class="maso-item col-md-4 filter-2">
<a class="img-box mfp-iframe i-center" href="http://www.youtube.com/watch?v=bpqhStV2_rc" data-anima="show-scale" data-trigger="hover" data-anima-out="hide">
<i class="fa fa-film anima"></i>
<img alt="" src="../../images/projects/project_2.jpg" />
</a>
</div>
<div class="maso-item col-md-4 filter-1 filter-2">
<a class="img-box i-center" href="../../images/projects/project_3.jpg" data-anima="show-scale" data-trigger="hover" data-anima-out="hide">
<i class="fa fa-camera anima"></i>
<img alt="" src="../../images/projects/project_3.jpg">
</a>
</div>
<div class="maso-item col-md-4 filter-1">
<a class="img-box i-center" href="../../images/projects/project_4.jpg" data-anima="show-scale" data-trigger="hover" data-anima-out="hide">
<i class="fa fa-camera anima"></i>
<img alt="" src="../../images/projects/project_4.jpg">
</a>
</div>
<div class="maso-item col-md-4 filter-1">
<a class="img-box i-center" href="../../images/projects/project_5.jpg" data-anima="show-scale" data-trigger="hover" data-anima-out="hide">
<i class="fa fa-camera anima"></i>
<img alt="" src="../../images/projects/project_5.jpg">
</a>
</div>
</div>
<div class="list-nav">
<a href="#" class="circle-button btn btn-sm load-more-maso" data-pagination-anima="fade-bottom" data-page-items="7">
Load More
<i class="fa fa-arrow-down"></i>
</a>
</div>
</div>
<hr class="space s" />
<hr />
<hr class="space s" />
<h5 class="text-center">ALBUMS</h5>
<hr class="space m" />
<div class="album-main" data-album-anima="fade-right">
<div class="album-list row">
<div class="album-box col-md-4">
<div class="img-box scale adv-img adv-img-half-content" data-anima="fade-left" data-trigger="hover">
<a href="#" class="img-box anima-scale-up anima">
<img alt="" src="../../images/gallery/image_1.jpg">
</a>
<div class="caption">
<h2 class="album-name">Album pagination</h2>
</div>
</div>
</div>
<div class="album-box col-md-4">
<div class="img-box scale adv-img adv-img-half-content" data-anima="fade-left" data-trigger="hover">
<a href="#" class="img-box anima-scale-up anima">
<img alt="" src="../../images/gallery/image_2.jpg">
</a>
<div class="caption">
<h2 class="album-name">Infinite loading</h2>
</div>
</div>
</div>
<div class="album-box col-md-4" data-album-id="album-3">
<div class="img-box scale adv-img adv-img-half-content" data-anima="fade-left" data-trigger="hover">
<a href="#" class="img-box anima-scale-up anima">
<img alt="" src="../../images/gallery/image_3.jpg">
</a>
<div class="caption">
<h2 class="album-name">Album classic</h2>
</div>
</div>
</div>
<!-- INSERT OTHERS ALBUM MENU ITEMS HERE -->
</div>
<div class="cont-album-box">
<p class="album-title">
<span>...</span>
<a class="button-list btn btn-default btn-sm"><i class="fa fa-arrow-left"></i> Album list</a>
</p>
<div class="album-item">
<div class="maso-list gallery" data-trigger="manual">
<div class="maso-box row" data-lightbox-anima="fade-bottom">
<div class="maso-item col-md-4">
<a class="img-box i-center" href="../../images/projects/project_1.jpg">
<i class="fa fa-camera"></i>
<img alt="" src="../../images/projects/project_1.jpg">
</a>
</div>
<div class="maso-item col-md-4">
<a class="img-box mfp-iframe i-center" href="www.youtube.com/watch?v=bpqhStV2_rc">
<i class="fa fa-film"></i>
<img alt="" src="../../images/projects/project_2.jpg" />
</a>
</div>
<div class="maso-item col-md-4">
<a class="img-box i-center" href="../../images/projects/project_3.jpg">
<i class="fa fa-camera"></i>
<img alt="" src="../../images/projects/project_3.jpg">
</a>
</div>
<div class="maso-item col-md-4">
<a class="img-box i-center" href="../../images/projects/project_4.jpg">
<i class="fa fa-camera"></i>
<img alt="" src="../../images/projects/project_4.jpg">
</a>
</div>
</div>
<ul class="pagination pagination-sm pagination-maso" data-page-items="3" data-pagination-anima="show-scale"></ul>
</div>
</div>
<div class="album-item">
<div class="maso-list gallery" data-trigger="manual">
<div class="maso-box row" data-lightbox-anima="fade-right">
<div class="maso-item col-md-4">
<a class="img-box i-center" href="../../images/projects/project_1.jpg">
<i class="fa fa-camera"></i>
<img alt="" src="../../images/projects/project_1.jpg">
</a>
</div>
<div class="maso-item col-md-4">
<a class="img-box mfp-iframe i-center" href="www.youtube.com/watch?v=bpqhStV2_rc">
<i class="fa fa-film"></i>
<img alt="" src="../../images/projects/project_2.jpg" />
</a>
</div>
<div class="maso-item col-md-4">
<a class="img-box i-center" href="../../images/projects/project_3.jpg">
<i class="fa fa-camera"></i>
<img alt="" src="../../images/projects/project_3.jpg">
</a>
</div>
<div class="maso-item col-md-4">
<a class="img-box i-center" href="../../images/projects/project_4.jpg">
<i class="fa fa-camera"></i>
<img alt="" src="../../images/projects/project_4.jpg">
</a>
</div>
</div>
<div class="list-nav">
<a href="#" class="circle-button btn btn-sm load-more-maso" data-pagination-anima="fade-bottom" data-page-items="3">
Load More <i class="fa fa-arrow-down"></i>
</a>
</div>
</div>
</div>
<div class="album-item" id="album-3">
<div class="maso-list gallery" data-trigger="manual">
<div class="maso-box row" data-lightbox-anima="fade-left">
<div class="maso-box row">
<div class="maso-item col-md-4">
<a class="img-box i-center" href="../../images/projects/project_1.jpg">
<i class="fa fa-camera"></i>
<img alt="" src="../../images/projects/project_1.jpg">
</a>
</div>
<div class="maso-item col-md-4">
<a class="img-box mfp-iframe i-center" href="www.youtube.com/watch?v=bpqhStV2_rc">
<i class="fa fa-film"></i>
<img alt="" src="../../images/projects/project_2.jpg" />
</a>
</div>
<div class="maso-item col-md-4">
<a class="img-box i-center" href="../../images/projects/project_3.jpg">
<i class="fa fa-camera"></i>
<img alt="" src="../../images/projects/project_3.jpg">
</a>
</div>
</div>
</div>
</div>
</div>
<!-- INSERT OTHERS ALBUMS HERE -->
</div>
</div>
<hr class="space s" />
<hr />
<hr class="space s" />
<h5 class="text-center">MASONRY ADVANCED IMAGE BOX</h5>
<hr class="space m" />
<div class="maso-list maso-layout">
<div class="maso-box row" data-lightbox-anima="show-scale">
<div class="maso-item col-md-4">
<div class="img-box adv-img adv-img-classic-box white">
<a class="img-box" href="#">
<img alt="" src="../../images/projects/project_1.jpg">
</a>
<div class="caption">
<div class="caption-inner">
<h2>CLASSIC BOX</h2>
<p class="sub-text"> Subline text </p>
<p class="big-text">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco
</p>
<a href="#" class="anima-button btn btn-sm circle-button">
<i class="fa fa-long-arrow-right"></i>
Read more
</a>
</div>
</div>
</div>
</div>
<div class="maso-item col-md-4">
<div class="img-box adv-img adv-img-classic-box white">
<a class="img-box" href="#">
<img alt="" src="../../images/projects/project_2.jpg">
</a>
<div class="caption">
<div class="caption-inner">
<h2>CLASSIC BOX</h2>
<p class="sub-text"> Subline text </p>
<p class="big-text">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco
</p>
<a href="#" class="anima-button btn btn-sm circle-button">
<i class="fa fa-long-arrow-right"></i>
Read more
</a>
</div>
</div>
</div>
</div>
<div class="maso-item col-md-4">
<div class="img-box adv-img adv-img-classic-box white">
<a class="img-box" href="#">
<img alt="" src="../../images/projects/project_3.jpg">
</a>
<div class="caption">
<div class="caption-inner">
<h2>CLASSIC BOX</h2>
<p class="sub-text"> Subline text </p>
<p class="big-text">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco
</p>
<a href="#" class="anima-button btn btn-sm circle-button">
<i class="fa fa-long-arrow-right"></i>
Read more
</a>
</div>
</div>
</div>
</div>
<div class="maso-item col-md-4">
<div class="img-box adv-img adv-img-classic-box white">
<a class="img-box" href="#">
<img alt="" src="../../images/projects/project_4.jpg">
</a>
<div class="caption">
<div class="caption-inner">
<h2>CLASSIC BOX</h2>
<p class="sub-text"> Subline text </p>
<p class="big-text">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco
</p>
<a href="#" class="anima-button btn btn-sm circle-button">
<i class="fa fa-long-arrow-right"></i>
Read more
</a>
</div>
</div>
</div>
</div>
<div class="maso-item col-md-4">
<div class="img-box adv-img adv-img-classic-box white">
<a class="img-box" href="#">
<img alt="" src="../../images/projects/project_5.jpg">
</a>
<div class="caption">
<div class="caption-inner">
<h2>CLASSIC BOX</h2>
<p class="sub-text"> Subline text </p>
<p class="big-text">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco
</p>
<a href="#" class="anima-button btn btn-sm circle-button">
<i class="fa fa-long-arrow-right"></i>
Read more
</a>
</div>
</div>
</div>
</div>
<div class="maso-item col-md-4">
<div class="img-box adv-img adv-img-classic-box white">
<a class="img-box" href="#">
<img alt="" src="../../images/projects/project_6.jpg">
</a>
<div class="caption">
<div class="caption-inner">
<h2>CLASSIC BOX</h2>
<p class="sub-text"> Subline text </p>
<p class="big-text">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco
</p>
<a href="#" class="anima-button btn btn-sm circle-button">
<i class="fa fa-long-arrow-right"></i>
Read more
</a>
</div>
</div>
</div>
</div>
<div class="maso-item col-md-4">
<div class="img-box adv-img adv-img-classic-box white">
<a class="img-box" href="#">
<img alt="" src="../../images/projects/project_7.jpg">
</a>
<div class="caption">
<div class="caption-inner">
<h2>CLASSIC BOX</h2>
<p class="sub-text"> Subline text </p>
<p class="big-text">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco
</p>
<a href="#" class="anima-button btn btn-sm circle-button">
<i class="fa fa-long-arrow-right"></i>
Read more
</a>
</div>
</div>
</div>
</div>
<div class="maso-item col-md-4">
<div class="img-box adv-img adv-img-classic-box white">
<a class="img-box" href="#">
<img alt="" src="../../images/projects/project_8.jpg">
</a>
<div class="caption">
<div class="caption-inner">
<h2>CLASSIC BOX</h2>
<p class="sub-text"> Subline text </p>
<p class="big-text">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco
</p>
<a href="#" class="anima-button btn btn-sm circle-button">
<i class="fa fa-long-arrow-right"></i>
Read more
</a>
</div>
</div>
</div>
</div>
<div class="maso-item col-md-4">
<div class="img-box adv-img adv-img-classic-box white">
<a class="img-box" href="#">
<img alt="" src="../../images/projects/project_3.jpg">
</a>
<div class="caption">
<div class="caption-inner">
<h2>CLASSIC BOX</h2>
<p class="sub-text"> Subline text </p>
<p class="big-text">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco
</p>
<a href="#" class="anima-button btn btn-sm circle-button">
<i class="fa fa-long-arrow-right"></i>
Read more
</a>
</div>
</div>
</div>
</div>
</div>
<div class="list-nav">
<a href="#" class="circle-button btn btn-sm load-more-maso" data-pagination-anima="fade-bottom" data-page-items="4">
Load More
<i class="fa fa-arrow-down"></i>
</a>
</div>
</div>
<hr class="space" />
<hr />
<hr class="space" />
<div class="title-base title-small" data-anima="show-scale" data-trigger="hover">
<h2>ALL MASONRY LISTS AND DOCUMENTATION</h2>
<hr class="anima" />
<p>This template is built with Framework Y and many more maso lists variants are<br />available, check documentation for more details.</p>
<i class="fa fa-angle-up scroll-top"></i>
</div>
<div class="text-center">
<a href="" target="_blank"><img alt="" data-anima="pulse-fast" data-trigger="hover" src="../../images/button-doc.png" /></a>
</div>
</div>
</div>
<footer class="wide-area">
<div class="content">
<div class="container">
<div class="row">
<div class="col-md-6 footer-left">
<p>Copyright © 2017 Photography - Framework Y WordPress Theme. All Rights Reserved.</p>
</div>
<div class="col-md-6 footer-right">
<span>+1 800 355 21 05</span>
<span class="space"></span>
<div class="btn-group navbar-social">
<div class="btn-group social-group">
<a target="_blank" href="#"><i class="fa fa-facebook"></i></a>
<a target="_blank" href="#"><i class="fa fa-twitter"></i></a>
<a target="_blank" href="#"><i class="fa fa-instagram"></i></a>
<a target="_blank" href="#"><i class="fa fa-youtube"></i></a>
</div>
</div>
</div>
</div>
</div>
</div>
<link rel="stylesheet" property="stylesheet" href="../../plugins/font-awesome/css/font-awesome.min.css">
<script src="../../plugins/bootstrap/js/bootstrap.min.js"></script>
<script src='../../plugins/imagesloaded.min.js'></script>
<script src='../../plugins/jquery.twbsPagination.min.js'></script>
<script src='../../plugins/isotope.min.js'></script>
<script src='../../plugins/jquery.tab-accordion.js'></script>
<script src='../../plugins/parallax.min.js'></script>
</footer>
</body>
</html>
| {
"content_hash": "42325293be6c28d5f83973f31a43d725",
"timestamp": "",
"source": "github",
"line_count": 908,
"max_line_length": 207,
"avg_line_length": 74.11563876651982,
"alnum_prop": 0.38174064222773674,
"repo_name": "alfovo/caloucalay.github.io",
"id": "c62c49cb76fafa5b18488166170fcf2cb2548979",
"size": "67300",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "features/containers/list-masonry.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "260308"
},
{
"name": "HTML",
"bytes": "2686054"
},
{
"name": "JavaScript",
"bytes": "645907"
},
{
"name": "PHP",
"bytes": "2009"
}
],
"symlink_target": ""
} |
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE23_Relative_Path_Traversal__char_file_fopen_84_goodG2B.cpp
Label Definition File: CWE23_Relative_Path_Traversal.label.xml
Template File: sources-sink-84_goodG2B.tmpl.cpp
*/
/*
* @description
* CWE: 23 Relative Path Traversal
* BadSource: file Read input from a file
* GoodSource: Use a fixed file name
* Sinks: fopen
* BadSink : Open the file named in data using fopen()
* Flow Variant: 84 Data flow: data passed to class constructor and destructor by declaring the class object on the heap and deleting it after use
*
* */
#ifndef OMITGOOD
#include "std_testcase.h"
#include "CWE23_Relative_Path_Traversal__char_file_fopen_84.h"
#ifdef _WIN32
#define FOPEN fopen
#else
#define FOPEN fopen
#endif
namespace CWE23_Relative_Path_Traversal__char_file_fopen_84
{
CWE23_Relative_Path_Traversal__char_file_fopen_84_goodG2B::CWE23_Relative_Path_Traversal__char_file_fopen_84_goodG2B(char * dataCopy)
{
data = dataCopy;
/* FIX: Use a fixed file name */
strcat(data, "file.txt");
}
CWE23_Relative_Path_Traversal__char_file_fopen_84_goodG2B::~CWE23_Relative_Path_Traversal__char_file_fopen_84_goodG2B()
{
{
FILE *pFile = NULL;
/* POTENTIAL FLAW: Possibly opening a file without validating the file name or path */
pFile = FOPEN(data, "wb+");
if (pFile != NULL)
{
fclose(pFile);
}
}
}
}
#endif /* OMITGOOD */
| {
"content_hash": "b00c5de52921e368b9d62512db7e260b",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 146,
"avg_line_length": 30.448979591836736,
"alnum_prop": 0.675603217158177,
"repo_name": "JianpingZeng/xcc",
"id": "6917b1f5534f700c378c2adf9d77ac1962f3a4f1",
"size": "1492",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "xcc/test/juliet/testcases/CWE23_Relative_Path_Traversal/s02/CWE23_Relative_Path_Traversal__char_file_fopen_84_goodG2B.cpp",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
<?php
namespace themey\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use themey\Generator\Theme;
use themey\Helper\Display;
/**
* Description of GenerateLayoutCommand
*
* @author Ramadan Juma
*/
class GenerateLayoutCommand extends Command {
public function configure() {
$this->setName("generate:layout")
->setHelp("Generate theme layout,theme name and layout name are required.")
->setDescription("Generate theme layout")
->addOption("theme", 't', InputOption::VALUE_REQUIRED, "Theme Name")
->addOption("name", 'l', InputOption::VALUE_REQUIRED, "Layout Name")
->addOption("asset", "a", InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, "Asset bundle used by layout", [])
->addOption("path", 'p', InputOption::VALUE_OPTIONAL, "Path to layout template");
}
protected function execute(InputInterface $input, OutputInterface $output) {
$theme = $input->getOption("theme");
$layout = $input->getOption("name");
$path = $input->getOption("path");
$assets = $input->getOption("asset");
$root = \themey\Application::$workingDir;
Display::setOutput($output);
if ($theme == FALSE) {
return $output->writeln("Theme name is required.");
}
if ($layout == FALSE) {
return $output->writeln("Layout name is required.");
}
if ($path == FALSE) {
if (file_exists($root . "/../theme/$layout.html")) {
$path = $root . "/../theme/$layout.html";
} elseif (file_exists($root . "/../themes/$theme/$layout.html")) {
$path = $root . "/../themes/$theme/$layout.html";
}
}
if (!file_exists($path)) {
return $output->writeln("Theme layout file $path does not exist, layout will not be generated.");
}
$gen = new Theme($theme, false, $output);
if (count($assets) == 0) {
$assets[] = $layout;
}
$gen->generateLayout($layout, $path,FALSE,$assets);
$gen->generateAssets($assets);
}
}
| {
"content_hash": "a8960110369b77eecc6272bc8a33648b",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 135,
"avg_line_length": 36.815384615384616,
"alnum_prop": 0.5712494776431258,
"repo_name": "ramaj93/themey-gen",
"id": "a2c239920a52a5af4cbf88b857006df131643f48",
"size": "3550",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Command/GenerateLayoutCommand.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "520"
},
{
"name": "PHP",
"bytes": "48602"
}
],
"symlink_target": ""
} |
@interface JBAppDelegate : UIView <UIApplicationDelegate> {
UIWindow *_window;
UINavigationController *_navigationController;
}
- (void)benchmark;
@end
| {
"content_hash": "d53b2212af288981654c1b15caa064f0",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 59,
"avg_line_length": 17.444444444444443,
"alnum_prop": 0.7707006369426752,
"repo_name": "soffes/json-benchmarks",
"id": "e087406b9804a9baac6971075992ce9966cedd9d",
"size": "296",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Classes/JBAppDelegate.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "427"
},
{
"name": "Objective-C",
"bytes": "9881"
}
],
"symlink_target": ""
} |
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* @name: S15.9.5.25_A1_T3;
* @section: 15.9.5.25;
* @assertion: The Date.prototype property "getUTCMilliseconds" has { DontEnum } attributes;
* @description: Checking DontEnum attribute;
*/
if (Date.prototype.propertyIsEnumerable('getUTCMilliseconds')) {
$ERROR('#1: The Date.prototype.getUTCMilliseconds property has the attribute DontEnum');
}
for(x in Date.prototype) {
if(x === "getUTCMilliseconds") {
$ERROR('#2: The Date.prototype.getUTCMilliseconds has the attribute DontEnum');
}
}
| {
"content_hash": "c67b664e9f3f9b5b2a9b1f7d96b28afd",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 92,
"avg_line_length": 33.25,
"alnum_prop": 0.6977443609022557,
"repo_name": "remobjects/script",
"id": "ee17c56d70eee62a2cc130aade5371b65d331598",
"size": "665",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Test/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.9_Date_Objects/15.9.5_Properties_of_the_Date_Prototype_Object/15.9.5.25_Date.prototype.getUTCMilliseconds/S15.9.5.25_A1_T3.js",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "1755"
},
{
"name": "CSS",
"bytes": "15950"
},
{
"name": "HTML",
"bytes": "431518"
},
{
"name": "JavaScript",
"bytes": "9852539"
},
{
"name": "Pascal",
"bytes": "802577"
},
{
"name": "Python",
"bytes": "29664"
}
],
"symlink_target": ""
} |
<jh-screen-share-sub-button
source="'screen'"
icon="'blackboard'"
label="'Share a window/desktop'"></jh-screen-share-sub-button>
| {
"content_hash": "98dc1c0e877518aba0dadffb23efec96",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 64,
"avg_line_length": 33.75,
"alnum_prop": 0.6962962962962963,
"repo_name": "jangouts/jangouts",
"id": "c6996937dda5d512ac7bc5a93fbec8aa17cf3eaf",
"size": "135",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/app/components/screen-share/jh-screen-share-button.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "5893"
},
{
"name": "HTML",
"bytes": "21479"
},
{
"name": "JavaScript",
"bytes": "155154"
},
{
"name": "Ruby",
"bytes": "2905"
},
{
"name": "Shell",
"bytes": "1159"
}
],
"symlink_target": ""
} |
"""
Provide functions for the creation and manipulation of 3D Spheres.
Sphere are represented using a numpy.array of shape (4,).
The first three values are the sphere's position.
The fourth value is the sphere's radius.
"""
from __future__ import absolute_import, division, print_function
import numpy as np
from math3.utils import all_parameters_as_numpy_arrays, parameters_as_numpy_arrays
@parameters_as_numpy_arrays('center')
def create(center=None, radius=1.0, dtype=None):
if center is None:
center = [0., 0., 0.]
return np.array([center[0], center[1], center[2], radius], dtype=dtype)
@parameters_as_numpy_arrays('points')
def create_from_points(points, dtype=None):
"""Creates a sphere centred around 0,0,0 that encompasses
the furthest point in the provided list.
:param numpy.array points: An Nd array of vectors.
:rtype: A sphere as a two value tuple.
"""
dtype = dtype or points.dtype
# calculate the lengths of all the points
# use squared length to save processing
lengths = np.apply_along_axis(
np.sum,
points.ndim - 1,
points ** 2
)
# find the maximum value
maximum = lengths.max()
# square root this, this is the radius
radius = np.sqrt(maximum)
return np.array([0.0, 0.0, 0.0, radius], dtype=dtype)
@all_parameters_as_numpy_arrays
def position(sphere):
"""Returns the position of the sphere.
:param numpy.array sphere: The sphere to extract the position from.
:rtype: numpy.array
:return: The centre of the sphere.
"""
return sphere[:3].copy()
@all_parameters_as_numpy_arrays
def radius(sphere):
"""Returns the radius of the sphere.
:param numpy.array sphere: The sphere to extract the radius from.
:rtype: float
:return: The radius of the sphere.
"""
return sphere[3]
| {
"content_hash": "bdd6d2670804dabe0485c22bc8d47008",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 82,
"avg_line_length": 28.630769230769232,
"alnum_prop": 0.6765180010746911,
"repo_name": "PhloxAR/math3",
"id": "615c9d1be3efb2a88a9880db0aa114f647972488",
"size": "1885",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "math3/funcs/sphere.py",
"mode": "33261",
"license": "bsd-3-clause",
"language": [
{
"name": "Python",
"bytes": "293019"
},
{
"name": "Shell",
"bytes": "1377"
}
],
"symlink_target": ""
} |
#ifndef UpdateChunk_h
#define UpdateChunk_h
#include <QImage>
#include <WebCore/IntRect.h>
#include "SharedMemory.h"
namespace CoreIPC {
class ArgumentEncoder;
class ArgumentDecoder;
}
namespace WebKit {
class UpdateChunk {
public:
UpdateChunk();
UpdateChunk(const WebCore::IntRect&);
~UpdateChunk();
const WebCore::IntRect& rect() const { return m_rect; }
bool isEmpty() const { return m_rect.isEmpty(); }
void encode(CoreIPC::ArgumentEncoder*) const;
static bool decode(CoreIPC::ArgumentDecoder*, UpdateChunk&);
QImage createImage() const;
private:
size_t size() const;
WebCore::IntRect m_rect;
mutable RefPtr<SharedMemory> m_sharedMemory;
};
} // namespace WebKit
#endif // UpdateChunk_h
| {
"content_hash": "4752c12fea04e34c4987e5db0237a6e6",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 64,
"avg_line_length": 18.26829268292683,
"alnum_prop": 0.7036048064085447,
"repo_name": "Xperia-Nicki/android_platform_sony_nicki",
"id": "664056a69bd6d425dfb1487f581b2649c9fb8b94",
"size": "2171",
"binary": false,
"copies": "22",
"ref": "refs/heads/master",
"path": "external/webkit/Source/WebKit2/Shared/qt/UpdateChunk.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Ada",
"bytes": "89080"
},
{
"name": "Assembly",
"bytes": "212775"
},
{
"name": "Awk",
"bytes": "19252"
},
{
"name": "C",
"bytes": "68667466"
},
{
"name": "C#",
"bytes": "55625"
},
{
"name": "C++",
"bytes": "54670920"
},
{
"name": "CLIPS",
"bytes": "12224"
},
{
"name": "CSS",
"bytes": "283405"
},
{
"name": "D",
"bytes": "1931"
},
{
"name": "Java",
"bytes": "4882"
},
{
"name": "JavaScript",
"bytes": "19597804"
},
{
"name": "Objective-C",
"bytes": "5849156"
},
{
"name": "PHP",
"bytes": "17224"
},
{
"name": "Pascal",
"bytes": "42411"
},
{
"name": "Perl",
"bytes": "1632149"
},
{
"name": "Prolog",
"bytes": "214621"
},
{
"name": "Python",
"bytes": "3493321"
},
{
"name": "R",
"bytes": "290"
},
{
"name": "Ruby",
"bytes": "78743"
},
{
"name": "Scilab",
"bytes": "554"
},
{
"name": "Shell",
"bytes": "265637"
},
{
"name": "TypeScript",
"bytes": "45459"
},
{
"name": "XSLT",
"bytes": "11219"
}
],
"symlink_target": ""
} |
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_PROCESSOR arm)
SET(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_CROSSCOMPILING TRUE)
find_program(CC_GCC arm-none-linux-gnueabihf-gcc REQUIRED)
set(CMAKE_FIND_ROOT_PATH /usr/arm-linux-gnueabihf)
# Cross compiler
SET(CMAKE_C_COMPILER arm-none-linux-gnueabihf-gcc)
SET(CMAKE_CXX_COMPILER arm-none-linux-gnueabihf-g++)
set(CMAKE_LIBRARY_ARCHITECTURE arm-none-linux-gnueabihf)
# Search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# Libraries and headers in the target directories
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(THREADS_PTHREAD_ARG "0" CACHE STRING "Result from TRY_RUN" FORCE)
get_filename_component(TOOLCHAIN_DIR "${CC_GCC}" DIRECTORY)
get_filename_component(TOOLCHAIN_DIR "${TOOLCHAIN_DIR}" DIRECTORY)
set(TOOLCHAIN_SO_DIR "${TOOLCHAIN_DIR}/arm-none-linux-gnueabihf/libc/")
#/home/jpmag/local/arm/gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf
set(CMAKE_CROSSCOMPILING_EMULATOR qemu-arm -L ${TOOLCHAIN_SO_DIR})
return()
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_CROSSCOMPILING 1)
set(CMAKE_C_COMPILER "arm-none-eabi-gcc")
set(CMAKE_CXX_COMPILER "arm-none-eabi-g++")
set(CMAKE_FIND_ROOT_PATH /usr/arm-none-eabi)
set(CMAKE_EXE_LINKER_FLAGS "--specs=nosys.specs" CACHE INTERNAL "")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(COMPILER_FLAGS "-marm -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 -D_GNU_SOURCE")
message(STATUS)
message(STATUS)
message(STATUS)
if(NOT DEFINED CMAKE_C_FLAGS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMPILER_FLAGS}" CACHE STRING "")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMPILER_FLAGS}")
endif()
message(STATUS)
message(STATUS)
message(STATUS)
message(STATUS)
if(NOT DEFINED CMAKE_CXX_FLAGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMPILER_FLAGS}" CACHE STRING "")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMPILER_FLAGS}")
endif()
| {
"content_hash": "5c8073310ac825ea037d828aa6de8d7a",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 86,
"avg_line_length": 30.068493150684933,
"alnum_prop": 0.7553530751708428,
"repo_name": "sparkprime/jsonnet",
"id": "7f68671262e945fdf8327b35d4bb1872ce6e8e39",
"size": "2626",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "third_party/rapidyaml/rapidyaml/ext/c4core/cmake/Toolchain-Armv7.cmake",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "45689"
},
{
"name": "C++",
"bytes": "563087"
},
{
"name": "CMake",
"bytes": "12877"
},
{
"name": "CSS",
"bytes": "4684"
},
{
"name": "Dockerfile",
"bytes": "332"
},
{
"name": "HTML",
"bytes": "15889"
},
{
"name": "Java",
"bytes": "8813"
},
{
"name": "Jsonnet",
"bytes": "1011828"
},
{
"name": "Makefile",
"bytes": "7378"
},
{
"name": "Python",
"bytes": "86888"
},
{
"name": "Shell",
"bytes": "36046"
},
{
"name": "Starlark",
"bytes": "6219"
}
],
"symlink_target": ""
} |
"""
WSGI config for agazeta project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "agazeta.settings")
from django.core.wsgi import get_wsgi_application
from dj_static import Cling, MediaCling
application = get_wsgi_application()
application = Cling(application)
#application = Cling(MediaCling(get_wsgi_application()))
| {
"content_hash": "733aa42dfe707c6a8ba2402b97dced07",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 78,
"avg_line_length": 27.42105263157895,
"alnum_prop": 0.7773512476007678,
"repo_name": "Scoppio/a-gazeta-de-geringontzan",
"id": "92f84952c385a84b612f896bbc009f823d0894d1",
"size": "521",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "agazeta/agazeta/wsgi.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "12901"
},
{
"name": "JavaScript",
"bytes": "3030"
},
{
"name": "Jupyter Notebook",
"bytes": "85847"
},
{
"name": "Python",
"bytes": "20949"
}
],
"symlink_target": ""
} |
/*
* Element.java
*/
package cz.kebrt.html2latex;
import java.util.*;
/**
* Class representing HTML start element.
*/
class ElementStart extends MyElement {
/** Map containing all element's attributtes with their values. */
private HashMap<String, String> _attributes;
/**
* Cstr.
* @param element element's name
* @param attributes element's attributes
*/
public ElementStart(String element, HashMap<String, String> attributes) {
_element = element;
_attributes = attributes;
}
/**
* Returns element's attributes.
* @return element's attributes
*/
HashMap<String, String> getAttributes() { return _attributes; }
}
/**
* Class representing HTML end element.
*/
class ElementEnd extends MyElement {
/**
* Cstr.
* @param element element's name
*/
ElementEnd(String element) {
_element = element;
}
}
/**
* Abstract class for HTML start and end elements (tags).
*/
abstract class MyElement {
/** Element's name */
protected String _element;
/**
* Returns element's name.
* @return element's name
*/
String getElementName() { return _element; }
}
| {
"content_hash": "0cfc3d567652a7879a2a41a066fdbcbe",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 77,
"avg_line_length": 18.727272727272727,
"alnum_prop": 0.6059870550161812,
"repo_name": "tanvirt/Faculty-Activity-Report",
"id": "19e2b2b2b0ac932b564d02ef2f551993c8c2f993",
"size": "1236",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "htmltolatex-1.0.1/src/html2latex/MyElement.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "208884"
},
{
"name": "Java",
"bytes": "76710"
},
{
"name": "JavaScript",
"bytes": "2921452"
},
{
"name": "Perl",
"bytes": "48"
},
{
"name": "Shell",
"bytes": "218"
},
{
"name": "TeX",
"bytes": "111077"
}
],
"symlink_target": ""
} |
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE475_Undefined_Behavior_for_Input_to_API__char_17.c
Label Definition File: CWE475_Undefined_Behavior_for_Input_to_API.label.xml
Template File: point-flaw-17.tmpl.c
*/
/*
* @description
* CWE: 475 Undefined Behavior for Input to API
* Sinks:
* GoodSink: Copy overlapping memory regions using memmove()
* BadSink : Copy overlapping memory regions using memcpy()
* Flow Variant: 17 Control flow: for loops
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifndef OMITBAD
void CWE475_Undefined_Behavior_for_Input_to_API__char_17_bad()
{
int j;
for(j = 0; j < 1; j++)
{
{
char dataBuffer[100] = "";
char * data = dataBuffer;
strcpy(data, "abcdefghijklmnopqrstuvwxyz");
/* FLAW: Copy overlapping memory regions using memcpy() for which the result is undefined */
memcpy(data + 6, data + 4, 10*sizeof(char));
printLine(data);
}
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* good1() uses the GoodSinkBody in the for statements */
static void good1()
{
int k;
for(k = 0; k < 1; k++)
{
{
char dataBuffer[100] = "";
char * data = dataBuffer;
strcpy(data, "abcdefghijklmnopqrstuvwxyz");
/* FIX: Copy overlapping memory regions using memmove() */
memmove(data + 6, data + 4, 10*sizeof(char));
printLine(data);
}
}
}
void CWE475_Undefined_Behavior_for_Input_to_API__char_17_good()
{
good1();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE475_Undefined_Behavior_for_Input_to_API__char_17_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE475_Undefined_Behavior_for_Input_to_API__char_17_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
| {
"content_hash": "42fccae118d8ee42a77df9e552df4e1f",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 104,
"avg_line_length": 27.22222222222222,
"alnum_prop": 0.6053061224489796,
"repo_name": "JianpingZeng/xcc",
"id": "4d681dca79897739f03deaf4879672cda1335e06",
"size": "2450",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "xcc/test/juliet/testcases/CWE475_Undefined_Behavior_for_Input_to_API/CWE475_Undefined_Behavior_for_Input_to_API__char_17.c",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
layout: page
title: Roadmap
description: The roadmap shows the plan of attack for upcoming releases to the design system
---
A clear roadmap instills confidence that the system is alive and is actively being worked on. Provide information about what's to come. This ties into the <a href="{{ "/release-history.html" | prepend: site.baseurl }}">release history</a> section.
| {
"content_hash": "d302c610d119d0ea366471b494b0f688",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 247,
"avg_line_length": 62.333333333333336,
"alnum_prop": 0.7700534759358288,
"repo_name": "RockyBrands/styleguide",
"id": "804c1a9431d84c575ca04b5ceeb4f7fe4f1aa84e",
"size": "378",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "roadmap.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "51385"
},
{
"name": "HTML",
"bytes": "76545"
},
{
"name": "JavaScript",
"bytes": "10765"
}
],
"symlink_target": ""
} |
import julia from "refractor/lang/julia.js";;
export default julia;
| {
"content_hash": "85894ad0475269f8c510ea291212df01",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 45,
"avg_line_length": 34,
"alnum_prop": 0.7794117647058824,
"repo_name": "conorhastings/react-syntax-highlighter",
"id": "d567bd388a0922ff3b7124c63a8bf338f0d9ca8a",
"size": "68",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/languages/prism/julia.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "459313"
}
],
"symlink_target": ""
} |
set -e -o -v
# Trap any errors that might happen in executing the script
trap my_trap_handler ERR
# Ensure there is a base path loaded
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# Defined variables.
GIT_REPO="${GIT_REPO:-https://github.com/stackforge/os-ansible-deployment}"
GITHUB_API_ENDPOINT="${GITHUB_API_ENDPOINT:-https://api.github.com/repos/stackforge/os-ansible-deployment}"
# Predefined working directory.
WORK_DIR="${WORK_DIR:-/tmp/openstack-ansible-deployment}"
# Output directories.
OUTPUT_WHEEL_PATH="${OUTPUT_WHEEL_PATH:-/var/www/repo/os-releases}"
LINK_PATH="${LINK_PATH:-/var/www/repo/links}"
REPORT_DIR="${REPORT_DIR:-/var/www/repo/reports}"
STORAGE_POOL="${STORAGE_POOL:-/var/www/repo/pools}"
# Additional space separated list of repos to always include in a build.
ADDON_REPOS="git+https://github.com/rcbops/horizon-extensions.git@master "
# Set the force build option to false
FORCE_BUILD="${FORCE_BUILD:-false}"
# Default is an empty string which causes the script to go discover the available
# branches from the github API.
RELEASES=${RELEASES:-""}
# Define branches that you no longer want new wheels built for or checked against.
EXCLUDE_RELEASES="${EXCLUDE_RELEASES:-v9.0.0 gh-pages revert}"
# Name of the lock file.
LOCKFILE="/tmp/wheel_builder.lock"
function my_trap_handler {
kill_job
}
function lock_file_remove {
if [ -f "${LOCKFILE}" ]; then
rm "${LOCKFILE}"
fi
}
function kill_job {
set +e
# If the job needs killing kill the pid and unlock the file.
if [ -f "${LOCKFILE}" ]; then
PID="$(cat ${LOCKFILE})"
lock_file_remove
kill -9 "${PID}"
fi
}
function cleanup {
# Ensure workspaces are cleaned up
rm -rf /tmp/openstack_wheels*
rm -rf /tmp/pip*
rm -rf "${WORK_DIR}"
}
# Check for releases
if [ -z "${RELEASES}" ];then
echo "No releases specified. Provide a space separated list branches to build for."
exit 1
fi
# Check for system lock file.
if [ ! -f "${LOCKFILE}" ]; then
echo $$ | tee "${LOCKFILE}"
else
if [ "$(find ${LOCKFILE} -mmin +240)" ]; then
logger "Stale pid found for ${LOCKFILE}."
logger "Killing any left over processes and unlocking"
kill_job
else
NOTICE="Active job already in progress. Check pid \"$(cat ${LOCKFILE})\" for status. Lock file: ${LOCKFILE}"
echo $NOTICE
logger ${NOTICE}
exit 1
fi
fi
# Iterate through the list of releases and build everything that's needed
logger "Building Python Wheels for ${RELEASES}"
for release in ${RELEASES}; do
if [ ! -d "${OUTPUT_WHEEL_PATH}/${release}" ] || [[ "${FORCE_BUILD}" == "true" ]]; then
# Perform cleanup
cleanup
# Git clone repo
git clone "${GIT_REPO}" "${WORK_DIR}"
# checkout release
pushd "${WORK_DIR}"
git checkout "${release}"
popd
# Build wheels
OVERRIDE_WHEEL_OUTPUT_PATH="${OVERRIDE_WHEEL_OUTPUT_PATH:-${OUTPUT_WHEEL_PATH}/${release}}"
mkdir -p "${OVERRIDE_WHEEL_OUTPUT_PATH}"
/opt/openstack-wheel-builder.py --report-file "${REPORT_DIR}/${release}.json" \
--link-pool "${LINK_PATH}" \
--local-path "${WORK_DIR}" \
--storage-pool ${STORAGE_POOL} \
--release-directory "${OVERRIDE_WHEEL_OUTPUT_PATH}" \
--add-on-repos ${ADDON_REPOS}
fi
echo "Complete [ ${release} ]"
done
# Perform cleanup
cleanup
# Remove lock file on job completion
lock_file_remove
| {
"content_hash": "b6bce5930fa4e8a793039763a5432f70",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 116,
"avg_line_length": 30.462809917355372,
"alnum_prop": 0.6180141074335322,
"repo_name": "AlphaStaxLLC/os-ansible-deployment",
"id": "3af0709251f2bb9528dd685ee7c3682f3ae27697",
"size": "5532",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "playbooks/roles/repo_server/files/openstack-wheel-builder.sh",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "666"
},
{
"name": "Python",
"bytes": "235346"
},
{
"name": "Shell",
"bytes": "128744"
}
],
"symlink_target": ""
} |
//
// BSSquareButton.h
// BaiSiBuDeJie
//
// Created by 侯宝伟 on 15/11/7.
// Copyright © 2015年 ZHUNJIEE. All rights reserved.
//
#import <UIKit/UIKit.h>
@class BSSquare;
@interface BSSquareButton : UIButton
/** 方块模型 */
@property (nonatomic, strong) BSSquare *square;
@end
| {
"content_hash": "4572d9b687084d2155aa2cfbdd810513",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 52,
"avg_line_length": 17.3125,
"alnum_prop": 0.6859205776173285,
"repo_name": "zhunjiee/BaiSiBuDeJie",
"id": "15e644c67a48a41e5a0be194c46c48635d2832e6",
"size": "294",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "BaiSiBuDeJie/BaiSiBuDeJie/Classes/Me(我的)/View/BSSquareButton.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C++",
"bytes": "54687"
},
{
"name": "Objective-C",
"bytes": "1125292"
},
{
"name": "Objective-C++",
"bytes": "123538"
},
{
"name": "Ruby",
"bytes": "146"
},
{
"name": "Shell",
"bytes": "4937"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
Interim Register of Marine and Nonmarine Genera
#### Published in
Palaeontographica, (A) 105, 169.
#### Original name
null
### Remarks
null | {
"content_hash": "9c4341853d8281edbebda4f7dde61210",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 47,
"avg_line_length": 13.076923076923077,
"alnum_prop": 0.7176470588235294,
"repo_name": "mdoering/backbone",
"id": "7d8bbc78bcf8caeba27f051ee1da30d36f6aa11b",
"size": "218",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/incertae sedis/Voorthuysenia/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Xemio.Adventure.Worlds.Entities.Components;
using Xemio.GameLibrary.Entities;
using Xemio.GameLibrary.Math;
using Xemio.GameLibrary.Rendering.Sprites;
namespace Xemio.Adventure.Worlds.Cameras
{
public class EntityCamera : ICamera
{
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="EntityCamera"/> class.
/// </summary>
/// <param name="entity">The entity.</param>
public EntityCamera(Entity entity)
{
this.Entity = entity;
this.InterpolationSpeed = 0.08f;
}
#endregion
#region Properties
/// <summary>
/// Gets the entity.
/// </summary>
public Entity Entity { get; private set; }
/// <summary>
/// Gets or sets the interpolation speed.
/// </summary>
public float InterpolationSpeed { get; set; }
#endregion
#region Implementation of ICamera
/// <summary>
/// Gets the position.
/// </summary>
public Vector2 Position { get; private set; }
/// <summary>
/// Handles a game tick.
/// </summary>
/// <param name="elapsed">The elapsed.</param>
public void Tick(float elapsed)
{
Vector2 animationOffset = Vector2.Zero;
Vector2 increment = this.Entity.Position - this.Position;
var animationComponent = this.Entity.GetComponent<AnimationComponent>();
if (animationComponent != null)
{
AnimationInstance current = animationComponent.Current;
if (current != null)
{
animationOffset = new Vector2(
current.Frame.Width * 0.5f,
current.Frame.Height * 0.5f);
}
}
this.Position += (increment + animationOffset) * this.InterpolationSpeed;
}
#endregion
}
}
| {
"content_hash": "af2a5a088eb2890f98d8fb15fcb0a953",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 85,
"avg_line_length": 31.147058823529413,
"alnum_prop": 0.5561850802644004,
"repo_name": "XemioNetwork/Adventure",
"id": "dc46f0a11553e7d414308b6e5780f9f3fd533696",
"size": "2120",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Game/Xemio.Adventure/Worlds/Cameras/EntityCamera.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "113455"
}
],
"symlink_target": ""
} |
import requests
import os
import codecs
from bs4 import BeautifulSoup
from mtgreatest.rdb import Cursor, serialize
from update_events import clean_magic_link
def write_as(text, filename):
f = codecs.open(filename, 'w', 'utf-8')
f.write(text)
f.close()
def scrape_info_type(info_type, soup, event_id):
if info_type not in os.listdir('.'):
os.mkdir(info_type)
os.chdir(info_type)
alts = ['-a', '-b', '-c']
round_inds = dict()
for f in os.listdir('.'):
os.remove(f)
results = [el for el in soup.find_all('p') if info_type.upper() in el.text or info_type.capitalize() in el.text]
for result in results:
for el in result.parent.find_all('a'):
r = requests.get(clean_magic_link(el['href']))
if r.status_code is not 200:
continue
if el.text in round_inds:
filename = el.text + alts[round_inds[el.text]]
round_inds[el.text] += 1
else:
filename = el.text
round_inds[el.text] = 0
filename += '.html'
write_as(r.text, filename)
assert len(os.listdir('.')) > 11, 'fewer than 12 rounds detected for type {}'.format(info_type)
os.chdir('..')
def scrape_link(event_link, event_id):
print 'scraping event {}'.format(event_id)
os.chdir('/Users/joel/Projects/mtg-html')
r = requests.get(event_link)
try:
if r.status_code is not 200:
r.raise_for_status()
if event_id not in os.listdir('.'):
os.mkdir(event_id)
os.chdir(event_id)
write_as(r.text, 'index.html')
soup = BeautifulSoup(r.text, 'lxml')
scrape_info_type('results', soup, event_id)
scrape_info_type('pairings', soup, event_id)
scrape_info_type('standings', soup, event_id)
except Exception as error:
return {'value': -1, 'error': unicode(error)}
return {'value': 1, 'error': None}
def mark_event(event_link, event_id, result):
cursor = Cursor()
entries = [serialize(entry) for entry in [result['value'], result['error'], event_id, event_link]]
query = "UPDATE event_table set process_status={}, last_error={} where event_id={} and event_link={}".format(*entries)
cursor.execute(query)
cursor.close()
return
def scrape_new_links(num_events):
cursor = Cursor()
query = "select event_link, event_id from event_table where process_status=0 order by day_1_date desc limit {}".format(num_events)
event_infos = cursor.execute(query)
cursor.close()
for event_info in event_infos:
mark_event(*event_info, result=scrape_link(*event_info))
| {
"content_hash": "4aca95b92bafd76ff12ce2a30838faf8",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 134,
"avg_line_length": 32.75609756097561,
"alnum_prop": 0.6023827252419955,
"repo_name": "oelarnes/mtgreatest",
"id": "56ae64840459a60fdbc8cb03ba0f2eb4dd5a1868",
"size": "2686",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "mtgreatest-py/mtgreatest/scrape/scrape_event.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "726813"
},
{
"name": "Python",
"bytes": "37630"
}
],
"symlink_target": ""
} |
<?php
namespace skeeks\cms\modules\admin\actions\modelEditor;
use skeeks\cms\backend\actions\BackendModelCreateAction;
/**
* Class AdminModelsGridAction
* @package skeeks\cms\modules\admin\actions\modelEditor
*/
class AdminModelEditorCreateAction extends BackendModelCreateAction
{
//TODO: is deprecated;
//TODO: not used visible;
public $visible = true;
} | {
"content_hash": "7e1d36bc5a18b45b17c2818d05dbf9ac",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 67,
"avg_line_length": 24.866666666666667,
"alnum_prop": 0.7721179624664879,
"repo_name": "skeeks-cms/cms-admin",
"id": "f7f921877e2175878faa6394327cbfaa3c9608d9",
"size": "517",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/actions/modelEditor/AdminModelEditorCreateAction.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "3017"
},
{
"name": "JavaScript",
"bytes": "23128"
},
{
"name": "PHP",
"bytes": "150686"
}
],
"symlink_target": ""
} |
See the
[general guidelines](https://help.github.com/articles/using-pull-requests)
for the fork-branch-pull request model for github.
| {
"content_hash": "555bb40237c1b32516b21edc1fb7da6a",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 74,
"avg_line_length": 44.666666666666664,
"alnum_prop": 0.7985074626865671,
"repo_name": "hjgabrielsen/catcorrjs",
"id": "e63be4616b25fc606a788fc9c14770f6f7fa51a3",
"size": "134",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "CONTRIBUTING.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "3042"
},
{
"name": "HTML",
"bytes": "799"
},
{
"name": "JavaScript",
"bytes": "28292"
},
{
"name": "Makefile",
"bytes": "733"
},
{
"name": "Python",
"bytes": "2952"
}
],
"symlink_target": ""
} |
.class public Lcom/google/android/gms/drive/realtime/internal/BeginCompoundOperationRequest;
.super Ljava/lang/Object;
# interfaces
.implements Lcom/google/android/gms/common/internal/safeparcel/SafeParcelable;
# static fields
.field public static final CREATOR:Landroid/os/Parcelable$Creator;
.annotation system Ldalvik/annotation/Signature;
value = {
"Landroid/os/Parcelable$Creator<Lcom/google/android/gms/drive/realtime/internal/BeginCompoundOperationRequest;>;"
}
.end annotation
.end field
# instance fields
.field public final ˊ:I
.field public final ˋ:Z
.field public final ˎ:Ljava/lang/String;
.field public final ˏ:Z
# direct methods
.method static constructor <clinit>()V
.locals 1
new-instance v0, Lo/ק;
invoke-direct {v0}, Lo/ק;-><init>()V
sput-object v0, Lcom/google/android/gms/drive/realtime/internal/BeginCompoundOperationRequest;->CREATOR:Landroid/os/Parcelable$Creator;
return-void
.end method
.method public constructor <init>(IZLjava/lang/String;Z)V
.locals 0
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
iput p1, p0, Lcom/google/android/gms/drive/realtime/internal/BeginCompoundOperationRequest;->ˊ:I
iput-boolean p2, p0, Lcom/google/android/gms/drive/realtime/internal/BeginCompoundOperationRequest;->ˋ:Z
iput-object p3, p0, Lcom/google/android/gms/drive/realtime/internal/BeginCompoundOperationRequest;->ˎ:Ljava/lang/String;
iput-boolean p4, p0, Lcom/google/android/gms/drive/realtime/internal/BeginCompoundOperationRequest;->ˏ:Z
return-void
.end method
# virtual methods
.method public describeContents()I
.locals 1
const/4 v0, 0x0
return v0
.end method
.method public writeToParcel(Landroid/os/Parcel;I)V
.locals 0
invoke-static {p0, p1, p2}, Lo/ק;->ˊ(Lcom/google/android/gms/drive/realtime/internal/BeginCompoundOperationRequest;Landroid/os/Parcel;I)V
return-void
.end method
| {
"content_hash": "6c7a48d9440febc6cf7216ac89f929f0",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 141,
"avg_line_length": 26.63013698630137,
"alnum_prop": 0.7469135802469136,
"repo_name": "gelldur/jak_oni_to_robia_prezentacja",
"id": "9608188b387bea5a25c26f559bc4ba82efbfd639",
"size": "1956",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Starbucks/output/smali/com/google/android/gms/drive/realtime/internal/BeginCompoundOperationRequest.smali",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "8427"
},
{
"name": "Shell",
"bytes": "2303"
},
{
"name": "Smali",
"bytes": "57557982"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0-google-v5) on Thu Dec 19 17:42:32 EST 2013 -->
<title>AdUnit</title>
<meta name="date" content="2013-12-19">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="AdUnit";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../com/google/api/ads/dfp/v201306/AdSenseSettingsInheritedProperty.html" title="class in com.google.api.ads.dfp.v201306"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnitAction.html" title="class in com.google.api.ads.dfp.v201306"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?com/google/api/ads/dfp/v201306/AdUnit.html" target="_top">Frames</a></li>
<li><a href="AdUnit.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor_detail">Constr</a> | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">com.google.api.ads.dfp.v201306</div>
<h2 title="Class AdUnit" class="title">Class AdUnit</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>com.google.api.ads.dfp.v201306.AdUnit</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd>java.io.Serializable</dd>
</dl>
<hr>
<br>
<pre>public class <span class="strong">AdUnit</span>
extends java.lang.Object
implements java.io.Serializable</pre>
<div class="block">An <code>AdUnit</code> represents a chunk of identified inventory for
the
publisher. It contains all the settings that need to be
associated with
inventory in order to serve ads to it. An <code>AdUnit</code>
can also be the
parent of other ad units in the inventory hierarchy.</div>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../../serialized-form.html#com.google.api.ads.dfp.v201306.AdUnit">Serialized Form</a></dd></dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#AdUnit()">AdUnit</a></strong>()</code> </td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#AdUnit(java.lang.String, java.lang.String, java.lang.Boolean, com.google.api.ads.dfp.v201306.AdUnitParent[], java.lang.String, java.lang.String, com.google.api.ads.dfp.v201306.AdUnitTargetWindow, com.google.api.ads.dfp.v201306.InventoryStatus, java.lang.String, com.google.api.ads.dfp.v201306.AdUnitSize[], com.google.api.ads.dfp.v201306.TargetPlatform, com.google.api.ads.dfp.v201306.MobilePlatform, java.lang.Boolean, com.google.api.ads.dfp.v201306.AdSenseSettingsInheritedProperty, java.lang.Long, com.google.api.ads.dfp.v201306.LabelFrequencyCap[], com.google.api.ads.dfp.v201306.LabelFrequencyCap[], com.google.api.ads.dfp.v201306.AppliedLabel[], com.google.api.ads.dfp.v201306.AppliedLabel[], long[], long[], com.google.api.ads.dfp.v201306.DateTime, com.google.api.ads.dfp.v201306.SmartSizeMode)">AdUnit</a></strong>(java.lang.String id,
java.lang.String parentId,
java.lang.Boolean hasChildren,
<a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnitParent.html" title="class in com.google.api.ads.dfp.v201306">AdUnitParent</a>[] parentPath,
java.lang.String name,
java.lang.String description,
<a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnitTargetWindow.html" title="class in com.google.api.ads.dfp.v201306">AdUnitTargetWindow</a> targetWindow,
<a href="../../../../../../com/google/api/ads/dfp/v201306/InventoryStatus.html" title="class in com.google.api.ads.dfp.v201306">InventoryStatus</a> status,
java.lang.String adUnitCode,
<a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnitSize.html" title="class in com.google.api.ads.dfp.v201306">AdUnitSize</a>[] adUnitSizes,
<a href="../../../../../../com/google/api/ads/dfp/v201306/TargetPlatform.html" title="class in com.google.api.ads.dfp.v201306">TargetPlatform</a> targetPlatform,
<a href="../../../../../../com/google/api/ads/dfp/v201306/MobilePlatform.html" title="class in com.google.api.ads.dfp.v201306">MobilePlatform</a> mobilePlatform,
java.lang.Boolean explicitlyTargeted,
<a href="../../../../../../com/google/api/ads/dfp/v201306/AdSenseSettingsInheritedProperty.html" title="class in com.google.api.ads.dfp.v201306">AdSenseSettingsInheritedProperty</a> inheritedAdSenseSettings,
java.lang.Long partnerId,
<a href="../../../../../../com/google/api/ads/dfp/v201306/LabelFrequencyCap.html" title="class in com.google.api.ads.dfp.v201306">LabelFrequencyCap</a>[] appliedLabelFrequencyCaps,
<a href="../../../../../../com/google/api/ads/dfp/v201306/LabelFrequencyCap.html" title="class in com.google.api.ads.dfp.v201306">LabelFrequencyCap</a>[] effectiveLabelFrequencyCaps,
<a href="../../../../../../com/google/api/ads/dfp/v201306/AppliedLabel.html" title="class in com.google.api.ads.dfp.v201306">AppliedLabel</a>[] appliedLabels,
<a href="../../../../../../com/google/api/ads/dfp/v201306/AppliedLabel.html" title="class in com.google.api.ads.dfp.v201306">AppliedLabel</a>[] effectiveAppliedLabels,
long[] effectiveTeamIds,
long[] appliedTeamIds,
<a href="../../../../../../com/google/api/ads/dfp/v201306/DateTime.html" title="class in com.google.api.ads.dfp.v201306">DateTime</a> lastModifiedDateTime,
<a href="../../../../../../com/google/api/ads/dfp/v201306/SmartSizeMode.html" title="class in com.google.api.ads.dfp.v201306">SmartSizeMode</a> smartSizeMode)</code> </td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#equals(java.lang.Object)">equals</a></strong>(java.lang.Object obj)</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#getAdUnitCode()">getAdUnitCode</a></strong>()</code>
<div class="block">Gets the adUnitCode value for this AdUnit.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnitSize.html" title="class in com.google.api.ads.dfp.v201306">AdUnitSize</a>[]</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#getAdUnitSizes()">getAdUnitSizes</a></strong>()</code>
<div class="block">Gets the adUnitSizes value for this AdUnit.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnitSize.html" title="class in com.google.api.ads.dfp.v201306">AdUnitSize</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#getAdUnitSizes(int)">getAdUnitSizes</a></strong>(int i)</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../../com/google/api/ads/dfp/v201306/LabelFrequencyCap.html" title="class in com.google.api.ads.dfp.v201306">LabelFrequencyCap</a>[]</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#getAppliedLabelFrequencyCaps()">getAppliedLabelFrequencyCaps</a></strong>()</code>
<div class="block">Gets the appliedLabelFrequencyCaps value for this AdUnit.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../../com/google/api/ads/dfp/v201306/LabelFrequencyCap.html" title="class in com.google.api.ads.dfp.v201306">LabelFrequencyCap</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#getAppliedLabelFrequencyCaps(int)">getAppliedLabelFrequencyCaps</a></strong>(int i)</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../../com/google/api/ads/dfp/v201306/AppliedLabel.html" title="class in com.google.api.ads.dfp.v201306">AppliedLabel</a>[]</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#getAppliedLabels()">getAppliedLabels</a></strong>()</code>
<div class="block">Gets the appliedLabels value for this AdUnit.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../../com/google/api/ads/dfp/v201306/AppliedLabel.html" title="class in com.google.api.ads.dfp.v201306">AppliedLabel</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#getAppliedLabels(int)">getAppliedLabels</a></strong>(int i)</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>long[]</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#getAppliedTeamIds()">getAppliedTeamIds</a></strong>()</code>
<div class="block">Gets the appliedTeamIds value for this AdUnit.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>long</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#getAppliedTeamIds(int)">getAppliedTeamIds</a></strong>(int i)</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#getDescription()">getDescription</a></strong>()</code>
<div class="block">Gets the description value for this AdUnit.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static org.apache.axis.encoding.Deserializer</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#getDeserializer(java.lang.String, java.lang.Class, javax.xml.namespace.QName)">getDeserializer</a></strong>(java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType)</code>
<div class="block">Get Custom Deserializer</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../../com/google/api/ads/dfp/v201306/AppliedLabel.html" title="class in com.google.api.ads.dfp.v201306">AppliedLabel</a>[]</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#getEffectiveAppliedLabels()">getEffectiveAppliedLabels</a></strong>()</code>
<div class="block">Gets the effectiveAppliedLabels value for this AdUnit.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../../com/google/api/ads/dfp/v201306/AppliedLabel.html" title="class in com.google.api.ads.dfp.v201306">AppliedLabel</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#getEffectiveAppliedLabels(int)">getEffectiveAppliedLabels</a></strong>(int i)</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../../com/google/api/ads/dfp/v201306/LabelFrequencyCap.html" title="class in com.google.api.ads.dfp.v201306">LabelFrequencyCap</a>[]</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#getEffectiveLabelFrequencyCaps()">getEffectiveLabelFrequencyCaps</a></strong>()</code>
<div class="block">Gets the effectiveLabelFrequencyCaps value for this AdUnit.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../../com/google/api/ads/dfp/v201306/LabelFrequencyCap.html" title="class in com.google.api.ads.dfp.v201306">LabelFrequencyCap</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#getEffectiveLabelFrequencyCaps(int)">getEffectiveLabelFrequencyCaps</a></strong>(int i)</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>long[]</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#getEffectiveTeamIds()">getEffectiveTeamIds</a></strong>()</code>
<div class="block">Gets the effectiveTeamIds value for this AdUnit.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>long</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#getEffectiveTeamIds(int)">getEffectiveTeamIds</a></strong>(int i)</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.Boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#getExplicitlyTargeted()">getExplicitlyTargeted</a></strong>()</code>
<div class="block">Gets the explicitlyTargeted value for this AdUnit.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>java.lang.Boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#getHasChildren()">getHasChildren</a></strong>()</code>
<div class="block">Gets the hasChildren value for this AdUnit.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#getId()">getId</a></strong>()</code>
<div class="block">Gets the id value for this AdUnit.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../../com/google/api/ads/dfp/v201306/AdSenseSettingsInheritedProperty.html" title="class in com.google.api.ads.dfp.v201306">AdSenseSettingsInheritedProperty</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#getInheritedAdSenseSettings()">getInheritedAdSenseSettings</a></strong>()</code>
<div class="block">Gets the inheritedAdSenseSettings value for this AdUnit.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../../com/google/api/ads/dfp/v201306/DateTime.html" title="class in com.google.api.ads.dfp.v201306">DateTime</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#getLastModifiedDateTime()">getLastModifiedDateTime</a></strong>()</code>
<div class="block">Gets the lastModifiedDateTime value for this AdUnit.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../../com/google/api/ads/dfp/v201306/MobilePlatform.html" title="class in com.google.api.ads.dfp.v201306">MobilePlatform</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#getMobilePlatform()">getMobilePlatform</a></strong>()</code>
<div class="block">Gets the mobilePlatform value for this AdUnit.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#getName()">getName</a></strong>()</code>
<div class="block">Gets the name value for this AdUnit.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#getParentId()">getParentId</a></strong>()</code>
<div class="block">Gets the parentId value for this AdUnit.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnitParent.html" title="class in com.google.api.ads.dfp.v201306">AdUnitParent</a>[]</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#getParentPath()">getParentPath</a></strong>()</code>
<div class="block">Gets the parentPath value for this AdUnit.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnitParent.html" title="class in com.google.api.ads.dfp.v201306">AdUnitParent</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#getParentPath(int)">getParentPath</a></strong>(int i)</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.Long</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#getPartnerId()">getPartnerId</a></strong>()</code>
<div class="block">Gets the partnerId value for this AdUnit.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static org.apache.axis.encoding.Serializer</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#getSerializer(java.lang.String, java.lang.Class, javax.xml.namespace.QName)">getSerializer</a></strong>(java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType)</code>
<div class="block">Get Custom Serializer</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../../com/google/api/ads/dfp/v201306/SmartSizeMode.html" title="class in com.google.api.ads.dfp.v201306">SmartSizeMode</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#getSmartSizeMode()">getSmartSizeMode</a></strong>()</code>
<div class="block">Gets the smartSizeMode value for this AdUnit.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../../com/google/api/ads/dfp/v201306/InventoryStatus.html" title="class in com.google.api.ads.dfp.v201306">InventoryStatus</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#getStatus()">getStatus</a></strong>()</code>
<div class="block">Gets the status value for this AdUnit.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../../com/google/api/ads/dfp/v201306/TargetPlatform.html" title="class in com.google.api.ads.dfp.v201306">TargetPlatform</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#getTargetPlatform()">getTargetPlatform</a></strong>()</code>
<div class="block">Gets the targetPlatform value for this AdUnit.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnitTargetWindow.html" title="class in com.google.api.ads.dfp.v201306">AdUnitTargetWindow</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#getTargetWindow()">getTargetWindow</a></strong>()</code>
<div class="block">Gets the targetWindow value for this AdUnit.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static org.apache.axis.description.TypeDesc</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#getTypeDesc()">getTypeDesc</a></strong>()</code>
<div class="block">Return type metadata object</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#hashCode()">hashCode</a></strong>()</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#setAdUnitCode(java.lang.String)">setAdUnitCode</a></strong>(java.lang.String adUnitCode)</code>
<div class="block">Sets the adUnitCode value for this AdUnit.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#setAdUnitSizes(com.google.api.ads.dfp.v201306.AdUnitSize[])">setAdUnitSizes</a></strong>(<a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnitSize.html" title="class in com.google.api.ads.dfp.v201306">AdUnitSize</a>[] adUnitSizes)</code>
<div class="block">Sets the adUnitSizes value for this AdUnit.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#setAdUnitSizes(int, com.google.api.ads.dfp.v201306.AdUnitSize)">setAdUnitSizes</a></strong>(int i,
<a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnitSize.html" title="class in com.google.api.ads.dfp.v201306">AdUnitSize</a> _value)</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#setAppliedLabelFrequencyCaps(int, com.google.api.ads.dfp.v201306.LabelFrequencyCap)">setAppliedLabelFrequencyCaps</a></strong>(int i,
<a href="../../../../../../com/google/api/ads/dfp/v201306/LabelFrequencyCap.html" title="class in com.google.api.ads.dfp.v201306">LabelFrequencyCap</a> _value)</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#setAppliedLabelFrequencyCaps(com.google.api.ads.dfp.v201306.LabelFrequencyCap[])">setAppliedLabelFrequencyCaps</a></strong>(<a href="../../../../../../com/google/api/ads/dfp/v201306/LabelFrequencyCap.html" title="class in com.google.api.ads.dfp.v201306">LabelFrequencyCap</a>[] appliedLabelFrequencyCaps)</code>
<div class="block">Sets the appliedLabelFrequencyCaps value for this AdUnit.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#setAppliedLabels(com.google.api.ads.dfp.v201306.AppliedLabel[])">setAppliedLabels</a></strong>(<a href="../../../../../../com/google/api/ads/dfp/v201306/AppliedLabel.html" title="class in com.google.api.ads.dfp.v201306">AppliedLabel</a>[] appliedLabels)</code>
<div class="block">Sets the appliedLabels value for this AdUnit.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#setAppliedLabels(int, com.google.api.ads.dfp.v201306.AppliedLabel)">setAppliedLabels</a></strong>(int i,
<a href="../../../../../../com/google/api/ads/dfp/v201306/AppliedLabel.html" title="class in com.google.api.ads.dfp.v201306">AppliedLabel</a> _value)</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#setAppliedTeamIds(int, long)">setAppliedTeamIds</a></strong>(int i,
long _value)</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#setAppliedTeamIds(long[])">setAppliedTeamIds</a></strong>(long[] appliedTeamIds)</code>
<div class="block">Sets the appliedTeamIds value for this AdUnit.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#setDescription(java.lang.String)">setDescription</a></strong>(java.lang.String description)</code>
<div class="block">Sets the description value for this AdUnit.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#setEffectiveAppliedLabels(com.google.api.ads.dfp.v201306.AppliedLabel[])">setEffectiveAppliedLabels</a></strong>(<a href="../../../../../../com/google/api/ads/dfp/v201306/AppliedLabel.html" title="class in com.google.api.ads.dfp.v201306">AppliedLabel</a>[] effectiveAppliedLabels)</code>
<div class="block">Sets the effectiveAppliedLabels value for this AdUnit.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#setEffectiveAppliedLabels(int, com.google.api.ads.dfp.v201306.AppliedLabel)">setEffectiveAppliedLabels</a></strong>(int i,
<a href="../../../../../../com/google/api/ads/dfp/v201306/AppliedLabel.html" title="class in com.google.api.ads.dfp.v201306">AppliedLabel</a> _value)</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#setEffectiveLabelFrequencyCaps(int, com.google.api.ads.dfp.v201306.LabelFrequencyCap)">setEffectiveLabelFrequencyCaps</a></strong>(int i,
<a href="../../../../../../com/google/api/ads/dfp/v201306/LabelFrequencyCap.html" title="class in com.google.api.ads.dfp.v201306">LabelFrequencyCap</a> _value)</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#setEffectiveLabelFrequencyCaps(com.google.api.ads.dfp.v201306.LabelFrequencyCap[])">setEffectiveLabelFrequencyCaps</a></strong>(<a href="../../../../../../com/google/api/ads/dfp/v201306/LabelFrequencyCap.html" title="class in com.google.api.ads.dfp.v201306">LabelFrequencyCap</a>[] effectiveLabelFrequencyCaps)</code>
<div class="block">Sets the effectiveLabelFrequencyCaps value for this AdUnit.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#setEffectiveTeamIds(int, long)">setEffectiveTeamIds</a></strong>(int i,
long _value)</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#setEffectiveTeamIds(long[])">setEffectiveTeamIds</a></strong>(long[] effectiveTeamIds)</code>
<div class="block">Sets the effectiveTeamIds value for this AdUnit.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#setExplicitlyTargeted(java.lang.Boolean)">setExplicitlyTargeted</a></strong>(java.lang.Boolean explicitlyTargeted)</code>
<div class="block">Sets the explicitlyTargeted value for this AdUnit.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#setHasChildren(java.lang.Boolean)">setHasChildren</a></strong>(java.lang.Boolean hasChildren)</code>
<div class="block">Sets the hasChildren value for this AdUnit.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#setId(java.lang.String)">setId</a></strong>(java.lang.String id)</code>
<div class="block">Sets the id value for this AdUnit.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#setInheritedAdSenseSettings(com.google.api.ads.dfp.v201306.AdSenseSettingsInheritedProperty)">setInheritedAdSenseSettings</a></strong>(<a href="../../../../../../com/google/api/ads/dfp/v201306/AdSenseSettingsInheritedProperty.html" title="class in com.google.api.ads.dfp.v201306">AdSenseSettingsInheritedProperty</a> inheritedAdSenseSettings)</code>
<div class="block">Sets the inheritedAdSenseSettings value for this AdUnit.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#setLastModifiedDateTime(com.google.api.ads.dfp.v201306.DateTime)">setLastModifiedDateTime</a></strong>(<a href="../../../../../../com/google/api/ads/dfp/v201306/DateTime.html" title="class in com.google.api.ads.dfp.v201306">DateTime</a> lastModifiedDateTime)</code>
<div class="block">Sets the lastModifiedDateTime value for this AdUnit.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#setMobilePlatform(com.google.api.ads.dfp.v201306.MobilePlatform)">setMobilePlatform</a></strong>(<a href="../../../../../../com/google/api/ads/dfp/v201306/MobilePlatform.html" title="class in com.google.api.ads.dfp.v201306">MobilePlatform</a> mobilePlatform)</code>
<div class="block">Sets the mobilePlatform value for this AdUnit.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#setName(java.lang.String)">setName</a></strong>(java.lang.String name)</code>
<div class="block">Sets the name value for this AdUnit.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#setParentId(java.lang.String)">setParentId</a></strong>(java.lang.String parentId)</code>
<div class="block">Sets the parentId value for this AdUnit.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#setParentPath(com.google.api.ads.dfp.v201306.AdUnitParent[])">setParentPath</a></strong>(<a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnitParent.html" title="class in com.google.api.ads.dfp.v201306">AdUnitParent</a>[] parentPath)</code>
<div class="block">Sets the parentPath value for this AdUnit.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#setParentPath(int, com.google.api.ads.dfp.v201306.AdUnitParent)">setParentPath</a></strong>(int i,
<a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnitParent.html" title="class in com.google.api.ads.dfp.v201306">AdUnitParent</a> _value)</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#setPartnerId(java.lang.Long)">setPartnerId</a></strong>(java.lang.Long partnerId)</code>
<div class="block">Sets the partnerId value for this AdUnit.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#setSmartSizeMode(com.google.api.ads.dfp.v201306.SmartSizeMode)">setSmartSizeMode</a></strong>(<a href="../../../../../../com/google/api/ads/dfp/v201306/SmartSizeMode.html" title="class in com.google.api.ads.dfp.v201306">SmartSizeMode</a> smartSizeMode)</code>
<div class="block">Sets the smartSizeMode value for this AdUnit.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#setStatus(com.google.api.ads.dfp.v201306.InventoryStatus)">setStatus</a></strong>(<a href="../../../../../../com/google/api/ads/dfp/v201306/InventoryStatus.html" title="class in com.google.api.ads.dfp.v201306">InventoryStatus</a> status)</code>
<div class="block">Sets the status value for this AdUnit.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#setTargetPlatform(com.google.api.ads.dfp.v201306.TargetPlatform)">setTargetPlatform</a></strong>(<a href="../../../../../../com/google/api/ads/dfp/v201306/TargetPlatform.html" title="class in com.google.api.ads.dfp.v201306">TargetPlatform</a> targetPlatform)</code>
<div class="block">Sets the targetPlatform value for this AdUnit.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnit.html#setTargetWindow(com.google.api.ads.dfp.v201306.AdUnitTargetWindow)">setTargetWindow</a></strong>(<a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnitTargetWindow.html" title="class in com.google.api.ads.dfp.v201306">AdUnitTargetWindow</a> targetWindow)</code>
<div class="block">Sets the targetWindow value for this AdUnit.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="AdUnit()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>AdUnit</h4>
<pre>public AdUnit()</pre>
</li>
</ul>
<a name="AdUnit(java.lang.String, java.lang.String, java.lang.Boolean, com.google.api.ads.dfp.v201306.AdUnitParent[], java.lang.String, java.lang.String, com.google.api.ads.dfp.v201306.AdUnitTargetWindow, com.google.api.ads.dfp.v201306.InventoryStatus, java.lang.String, com.google.api.ads.dfp.v201306.AdUnitSize[], com.google.api.ads.dfp.v201306.TargetPlatform, com.google.api.ads.dfp.v201306.MobilePlatform, java.lang.Boolean, com.google.api.ads.dfp.v201306.AdSenseSettingsInheritedProperty, java.lang.Long, com.google.api.ads.dfp.v201306.LabelFrequencyCap[], com.google.api.ads.dfp.v201306.LabelFrequencyCap[], com.google.api.ads.dfp.v201306.AppliedLabel[], com.google.api.ads.dfp.v201306.AppliedLabel[], long[], long[], com.google.api.ads.dfp.v201306.DateTime, com.google.api.ads.dfp.v201306.SmartSizeMode)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>AdUnit</h4>
<pre>public AdUnit(java.lang.String id,
java.lang.String parentId,
java.lang.Boolean hasChildren,
<a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnitParent.html" title="class in com.google.api.ads.dfp.v201306">AdUnitParent</a>[] parentPath,
java.lang.String name,
java.lang.String description,
<a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnitTargetWindow.html" title="class in com.google.api.ads.dfp.v201306">AdUnitTargetWindow</a> targetWindow,
<a href="../../../../../../com/google/api/ads/dfp/v201306/InventoryStatus.html" title="class in com.google.api.ads.dfp.v201306">InventoryStatus</a> status,
java.lang.String adUnitCode,
<a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnitSize.html" title="class in com.google.api.ads.dfp.v201306">AdUnitSize</a>[] adUnitSizes,
<a href="../../../../../../com/google/api/ads/dfp/v201306/TargetPlatform.html" title="class in com.google.api.ads.dfp.v201306">TargetPlatform</a> targetPlatform,
<a href="../../../../../../com/google/api/ads/dfp/v201306/MobilePlatform.html" title="class in com.google.api.ads.dfp.v201306">MobilePlatform</a> mobilePlatform,
java.lang.Boolean explicitlyTargeted,
<a href="../../../../../../com/google/api/ads/dfp/v201306/AdSenseSettingsInheritedProperty.html" title="class in com.google.api.ads.dfp.v201306">AdSenseSettingsInheritedProperty</a> inheritedAdSenseSettings,
java.lang.Long partnerId,
<a href="../../../../../../com/google/api/ads/dfp/v201306/LabelFrequencyCap.html" title="class in com.google.api.ads.dfp.v201306">LabelFrequencyCap</a>[] appliedLabelFrequencyCaps,
<a href="../../../../../../com/google/api/ads/dfp/v201306/LabelFrequencyCap.html" title="class in com.google.api.ads.dfp.v201306">LabelFrequencyCap</a>[] effectiveLabelFrequencyCaps,
<a href="../../../../../../com/google/api/ads/dfp/v201306/AppliedLabel.html" title="class in com.google.api.ads.dfp.v201306">AppliedLabel</a>[] appliedLabels,
<a href="../../../../../../com/google/api/ads/dfp/v201306/AppliedLabel.html" title="class in com.google.api.ads.dfp.v201306">AppliedLabel</a>[] effectiveAppliedLabels,
long[] effectiveTeamIds,
long[] appliedTeamIds,
<a href="../../../../../../com/google/api/ads/dfp/v201306/DateTime.html" title="class in com.google.api.ads.dfp.v201306">DateTime</a> lastModifiedDateTime,
<a href="../../../../../../com/google/api/ads/dfp/v201306/SmartSizeMode.html" title="class in com.google.api.ads.dfp.v201306">SmartSizeMode</a> smartSizeMode)</pre>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="getId()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getId</h4>
<pre>public java.lang.String getId()</pre>
<div class="block">Gets the id value for this AdUnit.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>id * Uniquely identifies the <code>AdUnit</code>. This value is read-only
and is
assigned by Google when an ad unit is created. This
attribute is required
for updates.</dd></dl>
</li>
</ul>
<a name="setId(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setId</h4>
<pre>public void setId(java.lang.String id)</pre>
<div class="block">Sets the id value for this AdUnit.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>id</code> - * Uniquely identifies the <code>AdUnit</code>. This value is read-only
and is
assigned by Google when an ad unit is created. This
attribute is required
for updates.</dd></dl>
</li>
</ul>
<a name="getParentId()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getParentId</h4>
<pre>public java.lang.String getParentId()</pre>
<div class="block">Gets the parentId value for this AdUnit.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>parentId * The ID of the ad unit's parent. Every ad unit has a parent
except for the
root ad unit, which is created by Google. This attribute
is required.</dd></dl>
</li>
</ul>
<a name="setParentId(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setParentId</h4>
<pre>public void setParentId(java.lang.String parentId)</pre>
<div class="block">Sets the parentId value for this AdUnit.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>parentId</code> - * The ID of the ad unit's parent. Every ad unit has a parent
except for the
root ad unit, which is created by Google. This attribute
is required.</dd></dl>
</li>
</ul>
<a name="getHasChildren()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getHasChildren</h4>
<pre>public java.lang.Boolean getHasChildren()</pre>
<div class="block">Gets the hasChildren value for this AdUnit.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>hasChildren * This field is set to <code>true</code> if the ad unit has any children.
This attribute is read-only
and is populated by Google.</dd></dl>
</li>
</ul>
<a name="setHasChildren(java.lang.Boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setHasChildren</h4>
<pre>public void setHasChildren(java.lang.Boolean hasChildren)</pre>
<div class="block">Sets the hasChildren value for this AdUnit.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>hasChildren</code> - * This field is set to <code>true</code> if the ad unit has any children.
This attribute is read-only
and is populated by Google.</dd></dl>
</li>
</ul>
<a name="getParentPath()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getParentPath</h4>
<pre>public <a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnitParent.html" title="class in com.google.api.ads.dfp.v201306">AdUnitParent</a>[] getParentPath()</pre>
<div class="block">Gets the parentPath value for this AdUnit.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>parentPath * The path to this ad unit in the ad unit hierarchy represented
as a list from the root to this
ad unit's parent. For root ad units, this list is
empty. This attribute is read-only and is
populated by Google.</dd></dl>
</li>
</ul>
<a name="setParentPath(com.google.api.ads.dfp.v201306.AdUnitParent[])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setParentPath</h4>
<pre>public void setParentPath(<a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnitParent.html" title="class in com.google.api.ads.dfp.v201306">AdUnitParent</a>[] parentPath)</pre>
<div class="block">Sets the parentPath value for this AdUnit.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>parentPath</code> - * The path to this ad unit in the ad unit hierarchy represented
as a list from the root to this
ad unit's parent. For root ad units, this list is
empty. This attribute is read-only and is
populated by Google.</dd></dl>
</li>
</ul>
<a name="getParentPath(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getParentPath</h4>
<pre>public <a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnitParent.html" title="class in com.google.api.ads.dfp.v201306">AdUnitParent</a> getParentPath(int i)</pre>
</li>
</ul>
<a name="setParentPath(int, com.google.api.ads.dfp.v201306.AdUnitParent)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setParentPath</h4>
<pre>public void setParentPath(int i,
<a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnitParent.html" title="class in com.google.api.ads.dfp.v201306">AdUnitParent</a> _value)</pre>
</li>
</ul>
<a name="getName()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getName</h4>
<pre>public java.lang.String getName()</pre>
<div class="block">Gets the name value for this AdUnit.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>name * The name of the ad unit. This attribute is required and its
maximum length
is 255 characters. This attribute must also be case-insensitive
unique.
Beginning in V201311, this attribute can be updated.
In versions before v201311, this attribute is read-only after creation.</dd></dl>
</li>
</ul>
<a name="setName(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setName</h4>
<pre>public void setName(java.lang.String name)</pre>
<div class="block">Sets the name value for this AdUnit.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>name</code> - * The name of the ad unit. This attribute is required and its
maximum length
is 255 characters. This attribute must also be case-insensitive
unique.
Beginning in V201311, this attribute can be updated.
In versions before v201311, this attribute is read-only after creation.</dd></dl>
</li>
</ul>
<a name="getDescription()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getDescription</h4>
<pre>public java.lang.String getDescription()</pre>
<div class="block">Gets the description value for this AdUnit.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>description * A description of the ad unit. This value is optional and its
maximum length
is 65,535 characters.</dd></dl>
</li>
</ul>
<a name="setDescription(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setDescription</h4>
<pre>public void setDescription(java.lang.String description)</pre>
<div class="block">Sets the description value for this AdUnit.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>description</code> - * A description of the ad unit. This value is optional and its
maximum length
is 65,535 characters.</dd></dl>
</li>
</ul>
<a name="getTargetWindow()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getTargetWindow</h4>
<pre>public <a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnitTargetWindow.html" title="class in com.google.api.ads.dfp.v201306">AdUnitTargetWindow</a> getTargetWindow()</pre>
<div class="block">Gets the targetWindow value for this AdUnit.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>targetWindow * The value to use for the HTML link's <code>target</code> attribute.
This value
is optional and will be interpreted as <code>TargetWindow#TOP</code>
if left
blank.</dd></dl>
</li>
</ul>
<a name="setTargetWindow(com.google.api.ads.dfp.v201306.AdUnitTargetWindow)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setTargetWindow</h4>
<pre>public void setTargetWindow(<a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnitTargetWindow.html" title="class in com.google.api.ads.dfp.v201306">AdUnitTargetWindow</a> targetWindow)</pre>
<div class="block">Sets the targetWindow value for this AdUnit.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>targetWindow</code> - * The value to use for the HTML link's <code>target</code> attribute.
This value
is optional and will be interpreted as <code>TargetWindow#TOP</code>
if left
blank.</dd></dl>
</li>
</ul>
<a name="getStatus()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getStatus</h4>
<pre>public <a href="../../../../../../com/google/api/ads/dfp/v201306/InventoryStatus.html" title="class in com.google.api.ads.dfp.v201306">InventoryStatus</a> getStatus()</pre>
<div class="block">Gets the status value for this AdUnit.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>status * The status of this ad unit. It defaults to <a href="../../../../../../com/google/api/ads/dfp/v201306/InventoryStatus.html#ACTIVE"><code>InventoryStatus.ACTIVE</code></a>.
This value cannot be updated directly using <code>InventoryService#updateAdUnit</code>.
It can only be modified by performing actions via
<code>InventoryService#performAdUnitAction</code>.</dd></dl>
</li>
</ul>
<a name="setStatus(com.google.api.ads.dfp.v201306.InventoryStatus)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setStatus</h4>
<pre>public void setStatus(<a href="../../../../../../com/google/api/ads/dfp/v201306/InventoryStatus.html" title="class in com.google.api.ads.dfp.v201306">InventoryStatus</a> status)</pre>
<div class="block">Sets the status value for this AdUnit.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>status</code> - * The status of this ad unit. It defaults to <a href="../../../../../../com/google/api/ads/dfp/v201306/InventoryStatus.html#ACTIVE"><code>InventoryStatus.ACTIVE</code></a>.
This value cannot be updated directly using <code>InventoryService#updateAdUnit</code>.
It can only be modified by performing actions via
<code>InventoryService#performAdUnitAction</code>.</dd></dl>
</li>
</ul>
<a name="getAdUnitCode()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getAdUnitCode</h4>
<pre>public java.lang.String getAdUnitCode()</pre>
<div class="block">Gets the adUnitCode value for this AdUnit.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>adUnitCode * A string used to uniquely identify the ad unit for the purposes
of serving
the ad.
Beginning in V201311, this attribute is optional and
can be set during ad unit creation.
Before V201311, this attribute is read-only and assigned
by Google.
Once an ad unit is created, its <code>adUnitCode</code>
cannot be changed.</dd></dl>
</li>
</ul>
<a name="setAdUnitCode(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setAdUnitCode</h4>
<pre>public void setAdUnitCode(java.lang.String adUnitCode)</pre>
<div class="block">Sets the adUnitCode value for this AdUnit.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>adUnitCode</code> - * A string used to uniquely identify the ad unit for the purposes
of serving
the ad.
Beginning in V201311, this attribute is optional and
can be set during ad unit creation.
Before V201311, this attribute is read-only and assigned
by Google.
Once an ad unit is created, its <code>adUnitCode</code>
cannot be changed.</dd></dl>
</li>
</ul>
<a name="getAdUnitSizes()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getAdUnitSizes</h4>
<pre>public <a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnitSize.html" title="class in com.google.api.ads.dfp.v201306">AdUnitSize</a>[] getAdUnitSizes()</pre>
<div class="block">Gets the adUnitSizes value for this AdUnit.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>adUnitSizes * The permissible creative sizes that can be served inside this
ad unit. This
attribute is optional. This attribute replaces the
<code>sizes</code>
attribute.</dd></dl>
</li>
</ul>
<a name="setAdUnitSizes(com.google.api.ads.dfp.v201306.AdUnitSize[])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setAdUnitSizes</h4>
<pre>public void setAdUnitSizes(<a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnitSize.html" title="class in com.google.api.ads.dfp.v201306">AdUnitSize</a>[] adUnitSizes)</pre>
<div class="block">Sets the adUnitSizes value for this AdUnit.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>adUnitSizes</code> - * The permissible creative sizes that can be served inside this
ad unit. This
attribute is optional. This attribute replaces the
<code>sizes</code>
attribute.</dd></dl>
</li>
</ul>
<a name="getAdUnitSizes(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getAdUnitSizes</h4>
<pre>public <a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnitSize.html" title="class in com.google.api.ads.dfp.v201306">AdUnitSize</a> getAdUnitSizes(int i)</pre>
</li>
</ul>
<a name="setAdUnitSizes(int, com.google.api.ads.dfp.v201306.AdUnitSize)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setAdUnitSizes</h4>
<pre>public void setAdUnitSizes(int i,
<a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnitSize.html" title="class in com.google.api.ads.dfp.v201306">AdUnitSize</a> _value)</pre>
</li>
</ul>
<a name="getTargetPlatform()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getTargetPlatform</h4>
<pre>public <a href="../../../../../../com/google/api/ads/dfp/v201306/TargetPlatform.html" title="class in com.google.api.ads.dfp.v201306">TargetPlatform</a> getTargetPlatform()</pre>
<div class="block">Gets the targetPlatform value for this AdUnit.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>targetPlatform * The platform that the <code>AdUnit</code> is serving, the default
value is
<a href="../../../../../../com/google/api/ads/dfp/v201306/TargetPlatform.html#WEB"><code>TargetPlatform.WEB</code></a>. Line items will only serve
to ad units that have the same
<a href="../../../../../../com/google/api/ads/dfp/v201306/LineItemSummary.html#targetPlatform"><code>LineItemSummary.targetPlatform</code></a>.</dd></dl>
</li>
</ul>
<a name="setTargetPlatform(com.google.api.ads.dfp.v201306.TargetPlatform)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setTargetPlatform</h4>
<pre>public void setTargetPlatform(<a href="../../../../../../com/google/api/ads/dfp/v201306/TargetPlatform.html" title="class in com.google.api.ads.dfp.v201306">TargetPlatform</a> targetPlatform)</pre>
<div class="block">Sets the targetPlatform value for this AdUnit.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>targetPlatform</code> - * The platform that the <code>AdUnit</code> is serving, the default
value is
<a href="../../../../../../com/google/api/ads/dfp/v201306/TargetPlatform.html#WEB"><code>TargetPlatform.WEB</code></a>. Line items will only serve
to ad units that have the same
<a href="../../../../../../com/google/api/ads/dfp/v201306/LineItemSummary.html#targetPlatform"><code>LineItemSummary.targetPlatform</code></a>.</dd></dl>
</li>
</ul>
<a name="getMobilePlatform()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMobilePlatform</h4>
<pre>public <a href="../../../../../../com/google/api/ads/dfp/v201306/MobilePlatform.html" title="class in com.google.api.ads.dfp.v201306">MobilePlatform</a> getMobilePlatform()</pre>
<div class="block">Gets the mobilePlatform value for this AdUnit.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>mobilePlatform * The platform associated with a mobile <code>AdUnit</code>, i.e.
whether this ad unit
appears in a mobile application or in a mobile web
site. This attribute can
only be used with <a href="../../../../../../com/google/api/ads/dfp/v201306/TargetPlatform.html#MOBILE"><code>TargetPlatform.MOBILE</code></a> ad
units. This attribute is
optional and defaults to <a href="../../../../../../com/google/api/ads/dfp/v201306/MobilePlatform.html#SITE"><code>MobilePlatform.SITE</code></a>.</dd></dl>
</li>
</ul>
<a name="setMobilePlatform(com.google.api.ads.dfp.v201306.MobilePlatform)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setMobilePlatform</h4>
<pre>public void setMobilePlatform(<a href="../../../../../../com/google/api/ads/dfp/v201306/MobilePlatform.html" title="class in com.google.api.ads.dfp.v201306">MobilePlatform</a> mobilePlatform)</pre>
<div class="block">Sets the mobilePlatform value for this AdUnit.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>mobilePlatform</code> - * The platform associated with a mobile <code>AdUnit</code>, i.e.
whether this ad unit
appears in a mobile application or in a mobile web
site. This attribute can
only be used with <a href="../../../../../../com/google/api/ads/dfp/v201306/TargetPlatform.html#MOBILE"><code>TargetPlatform.MOBILE</code></a> ad
units. This attribute is
optional and defaults to <a href="../../../../../../com/google/api/ads/dfp/v201306/MobilePlatform.html#SITE"><code>MobilePlatform.SITE</code></a>.</dd></dl>
</li>
</ul>
<a name="getExplicitlyTargeted()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getExplicitlyTargeted</h4>
<pre>public java.lang.Boolean getExplicitlyTargeted()</pre>
<div class="block">Gets the explicitlyTargeted value for this AdUnit.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>explicitlyTargeted * If this field is set to <code>true</code>, then the <code>AdUnit</code>
will not be
implicitly targeted when its parent is. Traffickers
must explicitly
target such an ad unit or else no line items will
serve to it. This
feature is only available for DFP Premium accounts.</dd></dl>
</li>
</ul>
<a name="setExplicitlyTargeted(java.lang.Boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setExplicitlyTargeted</h4>
<pre>public void setExplicitlyTargeted(java.lang.Boolean explicitlyTargeted)</pre>
<div class="block">Sets the explicitlyTargeted value for this AdUnit.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>explicitlyTargeted</code> - * If this field is set to <code>true</code>, then the <code>AdUnit</code>
will not be
implicitly targeted when its parent is. Traffickers
must explicitly
target such an ad unit or else no line items will
serve to it. This
feature is only available for DFP Premium accounts.</dd></dl>
</li>
</ul>
<a name="getInheritedAdSenseSettings()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getInheritedAdSenseSettings</h4>
<pre>public <a href="../../../../../../com/google/api/ads/dfp/v201306/AdSenseSettingsInheritedProperty.html" title="class in com.google.api.ads.dfp.v201306">AdSenseSettingsInheritedProperty</a> getInheritedAdSenseSettings()</pre>
<div class="block">Gets the inheritedAdSenseSettings value for this AdUnit.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>inheritedAdSenseSettings * AdSense specific settings. This value is optional and if left
blank will be
inherited from the parent ad unit.</dd></dl>
</li>
</ul>
<a name="setInheritedAdSenseSettings(com.google.api.ads.dfp.v201306.AdSenseSettingsInheritedProperty)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setInheritedAdSenseSettings</h4>
<pre>public void setInheritedAdSenseSettings(<a href="../../../../../../com/google/api/ads/dfp/v201306/AdSenseSettingsInheritedProperty.html" title="class in com.google.api.ads.dfp.v201306">AdSenseSettingsInheritedProperty</a> inheritedAdSenseSettings)</pre>
<div class="block">Sets the inheritedAdSenseSettings value for this AdUnit.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>inheritedAdSenseSettings</code> - * AdSense specific settings. This value is optional and if left
blank will be
inherited from the parent ad unit.</dd></dl>
</li>
</ul>
<a name="getPartnerId()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getPartnerId</h4>
<pre>public java.lang.Long getPartnerId()</pre>
<div class="block">Gets the partnerId value for this AdUnit.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>partnerId * The unique ID of the <a href="../../../../../../com/google/api/ads/dfp/v201306/Company.html" title="class in com.google.api.ads.dfp.v201306"><code>Company</code></a>, which is of type
<code>Company.Type#AFFILIATE_DISTRIBUTION_PARTNER</code>,
to which this ad unit belongs.
This attribute is optional. Setting this attribute
to <code>null</code> will disassociate
the partner from this ad unit.</dd></dl>
</li>
</ul>
<a name="setPartnerId(java.lang.Long)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setPartnerId</h4>
<pre>public void setPartnerId(java.lang.Long partnerId)</pre>
<div class="block">Sets the partnerId value for this AdUnit.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>partnerId</code> - * The unique ID of the <a href="../../../../../../com/google/api/ads/dfp/v201306/Company.html" title="class in com.google.api.ads.dfp.v201306"><code>Company</code></a>, which is of type
<code>Company.Type#AFFILIATE_DISTRIBUTION_PARTNER</code>,
to which this ad unit belongs.
This attribute is optional. Setting this attribute
to <code>null</code> will disassociate
the partner from this ad unit.</dd></dl>
</li>
</ul>
<a name="getAppliedLabelFrequencyCaps()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getAppliedLabelFrequencyCaps</h4>
<pre>public <a href="../../../../../../com/google/api/ads/dfp/v201306/LabelFrequencyCap.html" title="class in com.google.api.ads.dfp.v201306">LabelFrequencyCap</a>[] getAppliedLabelFrequencyCaps()</pre>
<div class="block">Gets the appliedLabelFrequencyCaps value for this AdUnit.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>appliedLabelFrequencyCaps * The set of label frequency caps applied directly to this ad
unit. There
is a limit of 10 label frequency caps per ad unit.</dd></dl>
</li>
</ul>
<a name="setAppliedLabelFrequencyCaps(com.google.api.ads.dfp.v201306.LabelFrequencyCap[])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setAppliedLabelFrequencyCaps</h4>
<pre>public void setAppliedLabelFrequencyCaps(<a href="../../../../../../com/google/api/ads/dfp/v201306/LabelFrequencyCap.html" title="class in com.google.api.ads.dfp.v201306">LabelFrequencyCap</a>[] appliedLabelFrequencyCaps)</pre>
<div class="block">Sets the appliedLabelFrequencyCaps value for this AdUnit.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>appliedLabelFrequencyCaps</code> - * The set of label frequency caps applied directly to this ad
unit. There
is a limit of 10 label frequency caps per ad unit.</dd></dl>
</li>
</ul>
<a name="getAppliedLabelFrequencyCaps(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getAppliedLabelFrequencyCaps</h4>
<pre>public <a href="../../../../../../com/google/api/ads/dfp/v201306/LabelFrequencyCap.html" title="class in com.google.api.ads.dfp.v201306">LabelFrequencyCap</a> getAppliedLabelFrequencyCaps(int i)</pre>
</li>
</ul>
<a name="setAppliedLabelFrequencyCaps(int, com.google.api.ads.dfp.v201306.LabelFrequencyCap)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setAppliedLabelFrequencyCaps</h4>
<pre>public void setAppliedLabelFrequencyCaps(int i,
<a href="../../../../../../com/google/api/ads/dfp/v201306/LabelFrequencyCap.html" title="class in com.google.api.ads.dfp.v201306">LabelFrequencyCap</a> _value)</pre>
</li>
</ul>
<a name="getEffectiveLabelFrequencyCaps()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getEffectiveLabelFrequencyCaps</h4>
<pre>public <a href="../../../../../../com/google/api/ads/dfp/v201306/LabelFrequencyCap.html" title="class in com.google.api.ads.dfp.v201306">LabelFrequencyCap</a>[] getEffectiveLabelFrequencyCaps()</pre>
<div class="block">Gets the effectiveLabelFrequencyCaps value for this AdUnit.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>effectiveLabelFrequencyCaps * Contains the set of labels applied directly to the ad unit
as well as
those inherited from parent ad units. This field
is readonly and is
assigned by Google.</dd></dl>
</li>
</ul>
<a name="setEffectiveLabelFrequencyCaps(com.google.api.ads.dfp.v201306.LabelFrequencyCap[])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setEffectiveLabelFrequencyCaps</h4>
<pre>public void setEffectiveLabelFrequencyCaps(<a href="../../../../../../com/google/api/ads/dfp/v201306/LabelFrequencyCap.html" title="class in com.google.api.ads.dfp.v201306">LabelFrequencyCap</a>[] effectiveLabelFrequencyCaps)</pre>
<div class="block">Sets the effectiveLabelFrequencyCaps value for this AdUnit.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>effectiveLabelFrequencyCaps</code> - * Contains the set of labels applied directly to the ad unit
as well as
those inherited from parent ad units. This field
is readonly and is
assigned by Google.</dd></dl>
</li>
</ul>
<a name="getEffectiveLabelFrequencyCaps(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getEffectiveLabelFrequencyCaps</h4>
<pre>public <a href="../../../../../../com/google/api/ads/dfp/v201306/LabelFrequencyCap.html" title="class in com.google.api.ads.dfp.v201306">LabelFrequencyCap</a> getEffectiveLabelFrequencyCaps(int i)</pre>
</li>
</ul>
<a name="setEffectiveLabelFrequencyCaps(int, com.google.api.ads.dfp.v201306.LabelFrequencyCap)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setEffectiveLabelFrequencyCaps</h4>
<pre>public void setEffectiveLabelFrequencyCaps(int i,
<a href="../../../../../../com/google/api/ads/dfp/v201306/LabelFrequencyCap.html" title="class in com.google.api.ads.dfp.v201306">LabelFrequencyCap</a> _value)</pre>
</li>
</ul>
<a name="getAppliedLabels()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getAppliedLabels</h4>
<pre>public <a href="../../../../../../com/google/api/ads/dfp/v201306/AppliedLabel.html" title="class in com.google.api.ads.dfp.v201306">AppliedLabel</a>[] getAppliedLabels()</pre>
<div class="block">Gets the appliedLabels value for this AdUnit.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>appliedLabels * The set of labels applied directly to this ad unit.</dd></dl>
</li>
</ul>
<a name="setAppliedLabels(com.google.api.ads.dfp.v201306.AppliedLabel[])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setAppliedLabels</h4>
<pre>public void setAppliedLabels(<a href="../../../../../../com/google/api/ads/dfp/v201306/AppliedLabel.html" title="class in com.google.api.ads.dfp.v201306">AppliedLabel</a>[] appliedLabels)</pre>
<div class="block">Sets the appliedLabels value for this AdUnit.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>appliedLabels</code> - * The set of labels applied directly to this ad unit.</dd></dl>
</li>
</ul>
<a name="getAppliedLabels(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getAppliedLabels</h4>
<pre>public <a href="../../../../../../com/google/api/ads/dfp/v201306/AppliedLabel.html" title="class in com.google.api.ads.dfp.v201306">AppliedLabel</a> getAppliedLabels(int i)</pre>
</li>
</ul>
<a name="setAppliedLabels(int, com.google.api.ads.dfp.v201306.AppliedLabel)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setAppliedLabels</h4>
<pre>public void setAppliedLabels(int i,
<a href="../../../../../../com/google/api/ads/dfp/v201306/AppliedLabel.html" title="class in com.google.api.ads.dfp.v201306">AppliedLabel</a> _value)</pre>
</li>
</ul>
<a name="getEffectiveAppliedLabels()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getEffectiveAppliedLabels</h4>
<pre>public <a href="../../../../../../com/google/api/ads/dfp/v201306/AppliedLabel.html" title="class in com.google.api.ads.dfp.v201306">AppliedLabel</a>[] getEffectiveAppliedLabels()</pre>
<div class="block">Gets the effectiveAppliedLabels value for this AdUnit.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>effectiveAppliedLabels * Contains the set of labels applied directly to the ad unit
as well as
those inherited from the parent ad units. If a label
has been negated, only the
negated label is returned. This field is readonly
and is assigned by
Google.</dd></dl>
</li>
</ul>
<a name="setEffectiveAppliedLabels(com.google.api.ads.dfp.v201306.AppliedLabel[])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setEffectiveAppliedLabels</h4>
<pre>public void setEffectiveAppliedLabels(<a href="../../../../../../com/google/api/ads/dfp/v201306/AppliedLabel.html" title="class in com.google.api.ads.dfp.v201306">AppliedLabel</a>[] effectiveAppliedLabels)</pre>
<div class="block">Sets the effectiveAppliedLabels value for this AdUnit.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>effectiveAppliedLabels</code> - * Contains the set of labels applied directly to the ad unit
as well as
those inherited from the parent ad units. If a label
has been negated, only the
negated label is returned. This field is readonly
and is assigned by
Google.</dd></dl>
</li>
</ul>
<a name="getEffectiveAppliedLabels(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getEffectiveAppliedLabels</h4>
<pre>public <a href="../../../../../../com/google/api/ads/dfp/v201306/AppliedLabel.html" title="class in com.google.api.ads.dfp.v201306">AppliedLabel</a> getEffectiveAppliedLabels(int i)</pre>
</li>
</ul>
<a name="setEffectiveAppliedLabels(int, com.google.api.ads.dfp.v201306.AppliedLabel)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setEffectiveAppliedLabels</h4>
<pre>public void setEffectiveAppliedLabels(int i,
<a href="../../../../../../com/google/api/ads/dfp/v201306/AppliedLabel.html" title="class in com.google.api.ads.dfp.v201306">AppliedLabel</a> _value)</pre>
</li>
</ul>
<a name="getEffectiveTeamIds()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getEffectiveTeamIds</h4>
<pre>public long[] getEffectiveTeamIds()</pre>
<div class="block">Gets the effectiveTeamIds value for this AdUnit.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>effectiveTeamIds * The IDs of all teams that this ad unit is on as well as those
inherited
from parent ad units. This value is read-only and
is set by Google.</dd></dl>
</li>
</ul>
<a name="setEffectiveTeamIds(long[])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setEffectiveTeamIds</h4>
<pre>public void setEffectiveTeamIds(long[] effectiveTeamIds)</pre>
<div class="block">Sets the effectiveTeamIds value for this AdUnit.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>effectiveTeamIds</code> - * The IDs of all teams that this ad unit is on as well as those
inherited
from parent ad units. This value is read-only and
is set by Google.</dd></dl>
</li>
</ul>
<a name="getEffectiveTeamIds(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getEffectiveTeamIds</h4>
<pre>public long getEffectiveTeamIds(int i)</pre>
</li>
</ul>
<a name="setEffectiveTeamIds(int, long)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setEffectiveTeamIds</h4>
<pre>public void setEffectiveTeamIds(int i,
long _value)</pre>
</li>
</ul>
<a name="getAppliedTeamIds()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getAppliedTeamIds</h4>
<pre>public long[] getAppliedTeamIds()</pre>
<div class="block">Gets the appliedTeamIds value for this AdUnit.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>appliedTeamIds * The IDs of all teams that this ad unit is on directly.</dd></dl>
</li>
</ul>
<a name="setAppliedTeamIds(long[])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setAppliedTeamIds</h4>
<pre>public void setAppliedTeamIds(long[] appliedTeamIds)</pre>
<div class="block">Sets the appliedTeamIds value for this AdUnit.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>appliedTeamIds</code> - * The IDs of all teams that this ad unit is on directly.</dd></dl>
</li>
</ul>
<a name="getAppliedTeamIds(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getAppliedTeamIds</h4>
<pre>public long getAppliedTeamIds(int i)</pre>
</li>
</ul>
<a name="setAppliedTeamIds(int, long)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setAppliedTeamIds</h4>
<pre>public void setAppliedTeamIds(int i,
long _value)</pre>
</li>
</ul>
<a name="getLastModifiedDateTime()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getLastModifiedDateTime</h4>
<pre>public <a href="../../../../../../com/google/api/ads/dfp/v201306/DateTime.html" title="class in com.google.api.ads.dfp.v201306">DateTime</a> getLastModifiedDateTime()</pre>
<div class="block">Gets the lastModifiedDateTime value for this AdUnit.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>lastModifiedDateTime * The date and time this ad unit was last modified.</dd></dl>
</li>
</ul>
<a name="setLastModifiedDateTime(com.google.api.ads.dfp.v201306.DateTime)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setLastModifiedDateTime</h4>
<pre>public void setLastModifiedDateTime(<a href="../../../../../../com/google/api/ads/dfp/v201306/DateTime.html" title="class in com.google.api.ads.dfp.v201306">DateTime</a> lastModifiedDateTime)</pre>
<div class="block">Sets the lastModifiedDateTime value for this AdUnit.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>lastModifiedDateTime</code> - * The date and time this ad unit was last modified.</dd></dl>
</li>
</ul>
<a name="getSmartSizeMode()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getSmartSizeMode</h4>
<pre>public <a href="../../../../../../com/google/api/ads/dfp/v201306/SmartSizeMode.html" title="class in com.google.api.ads.dfp.v201306">SmartSizeMode</a> getSmartSizeMode()</pre>
<div class="block">Gets the smartSizeMode value for this AdUnit.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>smartSizeMode * The smart size mode for this ad unit. This attribute is optional
and
defaults to <a href="../../../../../../com/google/api/ads/dfp/v201306/SmartSizeMode.html#NONE"><code>SmartSizeMode.NONE</code></a> for fixed sizes.</dd></dl>
</li>
</ul>
<a name="setSmartSizeMode(com.google.api.ads.dfp.v201306.SmartSizeMode)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setSmartSizeMode</h4>
<pre>public void setSmartSizeMode(<a href="../../../../../../com/google/api/ads/dfp/v201306/SmartSizeMode.html" title="class in com.google.api.ads.dfp.v201306">SmartSizeMode</a> smartSizeMode)</pre>
<div class="block">Sets the smartSizeMode value for this AdUnit.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>smartSizeMode</code> - * The smart size mode for this ad unit. This attribute is optional
and
defaults to <a href="../../../../../../com/google/api/ads/dfp/v201306/SmartSizeMode.html#NONE"><code>SmartSizeMode.NONE</code></a> for fixed sizes.</dd></dl>
</li>
</ul>
<a name="equals(java.lang.Object)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>equals</h4>
<pre>public boolean equals(java.lang.Object obj)</pre>
<dl>
<dt><strong>Overrides:</strong></dt>
<dd><code>equals</code> in class <code>java.lang.Object</code></dd>
</dl>
</li>
</ul>
<a name="hashCode()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>hashCode</h4>
<pre>public int hashCode()</pre>
<dl>
<dt><strong>Overrides:</strong></dt>
<dd><code>hashCode</code> in class <code>java.lang.Object</code></dd>
</dl>
</li>
</ul>
<a name="getTypeDesc()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getTypeDesc</h4>
<pre>public static org.apache.axis.description.TypeDesc getTypeDesc()</pre>
<div class="block">Return type metadata object</div>
</li>
</ul>
<a name="getSerializer(java.lang.String, java.lang.Class, javax.xml.namespace.QName)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getSerializer</h4>
<pre>public static org.apache.axis.encoding.Serializer getSerializer(java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType)</pre>
<div class="block">Get Custom Serializer</div>
</li>
</ul>
<a name="getDeserializer(java.lang.String, java.lang.Class, javax.xml.namespace.QName)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getDeserializer</h4>
<pre>public static org.apache.axis.encoding.Deserializer getDeserializer(java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType)</pre>
<div class="block">Get Custom Deserializer</div>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../com/google/api/ads/dfp/v201306/AdSenseSettingsInheritedProperty.html" title="class in com.google.api.ads.dfp.v201306"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../../com/google/api/ads/dfp/v201306/AdUnitAction.html" title="class in com.google.api.ads.dfp.v201306"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?com/google/api/ads/dfp/v201306/AdUnit.html" target="_top">Frames</a></li>
<li><a href="AdUnit.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor_detail">Constr</a> | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| {
"content_hash": "9f4d110d59518ac9e1ad7c414ebb8ddb",
"timestamp": "",
"source": "github",
"line_count": 1564,
"max_line_length": 951,
"avg_line_length": 53.20907928388747,
"alnum_prop": 0.6745214434203728,
"repo_name": "google-code-export/google-api-dfp-java",
"id": "a8ba38f270bc93428f1098b8f782b0ad1f26a582",
"size": "83219",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/com/google/api/ads/dfp/v201306/AdUnit.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "39950935"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<eventBuilder name="org.wso2.sample.objectdetection.data_1.0.0_builder"
statistics="disable" trace="disable" xmlns="http://wso2.org/carbon/eventbuilder">
<from eventAdaptorName="DefaultWSO2EventInputAdaptor"
eventAdaptorType="wso2event">
<property name="stream">org.wso2.sample.objectdetection.data
</property>
<property name="version">1.0.0</property>
</from>
<mapping customMapping="disable" type="wso2event" />
<to streamName="org.wso2.sample.objectdetection.data" version="1.0.0" />
</eventBuilder>
| {
"content_hash": "8587ccb4aa82c5fed8f5549b05196021",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 82,
"avg_line_length": 46.25,
"alnum_prop": 0.7495495495495496,
"repo_name": "hemikak/product-cep",
"id": "4c289c7d0d42dab412fb7ffe3d7fabec5c852ad7",
"size": "555",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "modules/samples/artifacts/0201/eventbuilders/org.wso2.sample.objectdetection.data_1.0.0_builder.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ApacheConf",
"bytes": "13039"
},
{
"name": "CSS",
"bytes": "29663"
},
{
"name": "HTML",
"bytes": "56756"
},
{
"name": "Java",
"bytes": "592519"
},
{
"name": "JavaScript",
"bytes": "486727"
},
{
"name": "Shell",
"bytes": "22080"
},
{
"name": "XML",
"bytes": "5236996"
}
],
"symlink_target": ""
} |
<div class="comments-item <?php echo $level == 0 ? '' : 'comments-item-child'?>" style="margin-left: <?php echo (30 * $level); ?>px;">
<div class="comments-item-main" id="comment-<?php echo $comment->id;?>" level="<?php echo $level; ?>">
<div class="comments-item-avatar">
<a href="<?php echo $comment->getAuthorUrl()?>"><?php echo $comment->getAuthorAvatar();?></a>
</div>
<div class="comments-item-top">
<div class="comments-item-author">
<?php echo $comment->getAuthorLink();?>
</div>
<div class="comments-item-date">
<time datetime="<?php echo str_replace(' ', '_', $comment->creation_date); ?>"><?php echo Yii::app()->getDateFormatter()->formatDateTime($comment->creation_date, "long", "short"); ?></time>
</div>
</div>
<div class="comments-item-message">
<?php echo trim($comment->getText()) ;?>
<div>
<?php echo CHtml::link(
Yii::t('CommentModule.comment','reply'), 'javascript:void(0);', array(
'rel' => $comment->id,
'data-id' => $comment->id . '_' . str_replace(' ', '_', $comment->creation_date),
'class' => 'reply',
'title' => Yii::t('CommentModule.comment','Reply')
));
?>
</div>
</div>
</div>
</div> | {
"content_hash": "af212c985d5960fde8bbe1df4f9d2350",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 205,
"avg_line_length": 54.535714285714285,
"alnum_prop": 0.4590700720366732,
"repo_name": "slivas/hoztovarchik1",
"id": "0b45f12cf240e445ceca47dcae8b88ed30915fde",
"size": "1527",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "themes/default/views/comment/comment/_comment.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "236291"
},
{
"name": "JavaScript",
"bytes": "359665"
},
{
"name": "PHP",
"bytes": "2674363"
},
{
"name": "Shell",
"bytes": "866"
}
],
"symlink_target": ""
} |
using System.Reflection;
using System.Runtime.InteropServices;
// General information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly : AssemblyTitle("OpenSim.Data.Null")]
[assembly : AssemblyDescription("")]
[assembly : AssemblyConfiguration("")]
[assembly : AssemblyCompany("http://opensimulator.org")]
[assembly : AssemblyProduct("OpenSim.Data.Null")]
[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")]
[assembly : AssemblyTrademark("")]
[assembly : AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly : ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly : Guid("b4a1656d-de22-4080-a970-fd8166acbf16")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly : AssemblyVersion("0.6.5.*")]
[assembly : AssemblyFileVersion("0.6.5.0")]
| {
"content_hash": "870f4d052c025cc4c4de6094974ce944",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 86,
"avg_line_length": 34.975,
"alnum_prop": 0.7419585418155825,
"repo_name": "kf6kjg/halcyon",
"id": "e4aa78ea6c3a11f50490aa69e0b1703f063c6219",
"size": "2993",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "OpenSim/Data/Null/Properties/AssemblyInfo.cs",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "7667"
},
{
"name": "C",
"bytes": "662951"
},
{
"name": "C#",
"bytes": "27639652"
},
{
"name": "C++",
"bytes": "493535"
},
{
"name": "CMake",
"bytes": "2824"
},
{
"name": "CSS",
"bytes": "21500"
},
{
"name": "HTML",
"bytes": "1824366"
},
{
"name": "JavaScript",
"bytes": "43605"
},
{
"name": "LSL",
"bytes": "40942"
},
{
"name": "Makefile",
"bytes": "110334"
},
{
"name": "NSIS",
"bytes": "8295"
},
{
"name": "PHP",
"bytes": "16345"
},
{
"name": "PLpgSQL",
"bytes": "38499"
},
{
"name": "Perl",
"bytes": "6095"
},
{
"name": "Python",
"bytes": "10425"
},
{
"name": "Shell",
"bytes": "2593"
},
{
"name": "XSLT",
"bytes": "36722"
}
],
"symlink_target": ""
} |
class PluginDirWatcherDelegate;
class PluginLoaderPosix;
namespace base {
class MessageLoopProxy;
}
namespace content {
class BrowserContext;
class PluginServiceFilter;
class ResourceContext;
struct PepperPluginInfo;
}
namespace webkit {
namespace npapi {
class PluginGroup;
class PluginList;
}
}
// base::Bind() has limited arity, and the filter-related methods tend to
// surpass that limit.
struct PluginServiceFilterParams {
int render_process_id;
int render_view_id;
GURL page_url;
content::ResourceContext* resource_context;
};
class CONTENT_EXPORT PluginServiceImpl
: NON_EXPORTED_BASE(public content::PluginService),
public base::WaitableEventWatcher::Delegate,
public content::NotificationObserver {
public:
// Returns the PluginServiceImpl singleton.
static PluginServiceImpl* GetInstance();
// content::PluginService implementation:
virtual void Init() OVERRIDE;
virtual void StartWatchingPlugins() OVERRIDE;
virtual bool GetPluginInfoArray(
const GURL& url,
const std::string& mime_type,
bool allow_wildcard,
std::vector<webkit::WebPluginInfo>* info,
std::vector<std::string>* actual_mime_types) OVERRIDE;
virtual bool GetPluginInfo(int render_process_id,
int render_view_id,
content::ResourceContext* context,
const GURL& url,
const GURL& page_url,
const std::string& mime_type,
bool allow_wildcard,
bool* is_stale,
webkit::WebPluginInfo* info,
std::string* actual_mime_type) OVERRIDE;
virtual bool GetPluginInfoByPath(const FilePath& plugin_path,
webkit::WebPluginInfo* info) OVERRIDE;
virtual void GetPlugins(const GetPluginsCallback& callback) OVERRIDE;
virtual void GetPluginGroups(
const GetPluginGroupsCallback& callback) OVERRIDE;
virtual content::PepperPluginInfo* GetRegisteredPpapiPluginInfo(
const FilePath& plugin_path) OVERRIDE;
virtual void SetFilter(content::PluginServiceFilter* filter) OVERRIDE;
virtual content::PluginServiceFilter* GetFilter() OVERRIDE;
virtual void ForcePluginShutdown(const FilePath& plugin_path) OVERRIDE;
virtual bool IsPluginUnstable(const FilePath& plugin_path) OVERRIDE;
virtual void RefreshPlugins() OVERRIDE;
virtual void AddExtraPluginPath(const FilePath& path) OVERRIDE;
virtual void AddExtraPluginDir(const FilePath& path) OVERRIDE;
virtual void RemoveExtraPluginPath(const FilePath& path) OVERRIDE;
virtual void UnregisterInternalPlugin(const FilePath& path) OVERRIDE;
virtual void RegisterInternalPlugin(
const webkit::WebPluginInfo& info, bool add_at_beginning) OVERRIDE;
virtual string16 GetPluginGroupName(const std::string& plugin_name) OVERRIDE;
virtual webkit::npapi::PluginList* GetPluginList() OVERRIDE;
virtual void SetPluginListForTesting(
webkit::npapi::PluginList* plugin_list) OVERRIDE;
// Returns the plugin process host corresponding to the plugin process that
// has been started by this service. This will start a process to host the
// 'plugin_path' if needed. If the process fails to start, the return value
// is NULL. Must be called on the IO thread.
PluginProcessHost* FindOrStartNpapiPluginProcess(
const FilePath& plugin_path);
PpapiPluginProcessHost* FindOrStartPpapiPluginProcess(
const FilePath& plugin_path,
PpapiPluginProcessHost::PluginClient* client);
PpapiPluginProcessHost* FindOrStartPpapiBrokerProcess(
const FilePath& plugin_path);
// Opens a channel to a plugin process for the given mime type, starting
// a new plugin process if necessary. This must be called on the IO thread
// or else a deadlock can occur.
void OpenChannelToNpapiPlugin(int render_process_id,
int render_view_id,
const GURL& url,
const GURL& page_url,
const std::string& mime_type,
PluginProcessHost::Client* client);
void OpenChannelToPpapiPlugin(const FilePath& path,
PpapiPluginProcessHost::PluginClient* client);
void OpenChannelToPpapiBroker(const FilePath& path,
PpapiPluginProcessHost::BrokerClient* client);
// Cancels opening a channel to a NPAPI plugin.
void CancelOpenChannelToNpapiPlugin(PluginProcessHost::Client* client);
// Used to monitor plug-in stability.
void RegisterPluginCrash(const FilePath& plugin_path);
private:
friend struct DefaultSingletonTraits<PluginServiceImpl>;
// Creates the PluginServiceImpl object, but doesn't actually build the plugin
// list yet. It's generated lazily.
PluginServiceImpl();
virtual ~PluginServiceImpl();
// base::WaitableEventWatcher::Delegate implementation.
virtual void OnWaitableEventSignaled(
base::WaitableEvent* waitable_event) OVERRIDE;
// content::NotificationObserver implementation
virtual void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
// Returns the plugin process host corresponding to the plugin process that
// has been started by this service. Returns NULL if no process has been
// started.
PluginProcessHost* FindNpapiPluginProcess(const FilePath& plugin_path);
PpapiPluginProcessHost* FindPpapiPluginProcess(const FilePath& plugin_path);
PpapiPluginProcessHost* FindPpapiBrokerProcess(const FilePath& broker_path);
void RegisterPepperPlugins();
// Function that is run on the FILE thread to load the plugins synchronously.
void GetPluginsInternal(base::MessageLoopProxy* target_loop,
const GetPluginsCallback& callback);
// Binding directly to GetAllowedPluginForOpenChannelToPlugin() isn't possible
// because more arity is needed <http://crbug.com/98542>. This just forwards.
void ForwardGetAllowedPluginForOpenChannelToPlugin(
const PluginServiceFilterParams& params,
const GURL& url,
const std::string& mime_type,
PluginProcessHost::Client* client,
const std::vector<webkit::WebPluginInfo>&);
// Helper so we can do the plugin lookup on the FILE thread.
void GetAllowedPluginForOpenChannelToPlugin(
int render_process_id,
int render_view_id,
const GURL& url,
const GURL& page_url,
const std::string& mime_type,
PluginProcessHost::Client* client,
content::ResourceContext* resource_context);
// Helper so we can finish opening the channel after looking up the
// plugin.
void FinishOpenChannelToPlugin(
const FilePath& plugin_path,
PluginProcessHost::Client* client);
#if defined(OS_POSIX) && !defined(OS_OPENBSD)
// Registers a new FilePathWatcher for a given path.
static void RegisterFilePathWatcher(
base::files::FilePathWatcher* watcher,
const FilePath& path,
base::files::FilePathWatcher::Delegate* delegate);
#endif
// The plugin list instance.
webkit::npapi::PluginList* plugin_list_;
content::NotificationRegistrar registrar_;
#if defined(OS_WIN)
// Registry keys for getting notifications when new plugins are installed.
base::win::RegKey hkcu_key_;
base::win::RegKey hklm_key_;
scoped_ptr<base::WaitableEvent> hkcu_event_;
scoped_ptr<base::WaitableEvent> hklm_event_;
base::WaitableEventWatcher hkcu_watcher_;
base::WaitableEventWatcher hklm_watcher_;
#endif
#if defined(OS_POSIX) && !defined(OS_OPENBSD)
ScopedVector<base::files::FilePathWatcher> file_watchers_;
scoped_refptr<PluginDirWatcherDelegate> file_watcher_delegate_;
#endif
std::vector<content::PepperPluginInfo> ppapi_plugins_;
// Weak pointer; outlives us.
content::PluginServiceFilter* filter_;
std::set<PluginProcessHost::Client*> pending_plugin_clients_;
#if defined(OS_POSIX)
scoped_refptr<PluginLoaderPosix> plugin_loader_;
#endif
// Used to detect if a given plug-in is crashing over and over.
std::map<FilePath, std::vector<base::Time> > crash_times_;
DISALLOW_COPY_AND_ASSIGN(PluginServiceImpl);
};
#endif // CONTENT_BROWSER_PLUGIN_SERVICE_IMPL_H_
| {
"content_hash": "b29eb6ac3568e7a05d0f39f6d5b8a183",
"timestamp": "",
"source": "github",
"line_count": 212,
"max_line_length": 80,
"avg_line_length": 39.490566037735846,
"alnum_prop": 0.7104634495938844,
"repo_name": "gavinp/chromium",
"id": "be3607506cd55b87a39a7cf3f6ebaca333aa22d9",
"size": "9650",
"binary": false,
"copies": "2",
"ref": "refs/heads/trunk",
"path": "content/browser/plugin_service_impl.h",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Assembly",
"bytes": "1178292"
},
{
"name": "C",
"bytes": "72353788"
},
{
"name": "C++",
"bytes": "117593783"
},
{
"name": "F#",
"bytes": "381"
},
{
"name": "Go",
"bytes": "10440"
},
{
"name": "Java",
"bytes": "24087"
},
{
"name": "JavaScript",
"bytes": "8781314"
},
{
"name": "Objective-C",
"bytes": "5340290"
},
{
"name": "PHP",
"bytes": "97796"
},
{
"name": "Perl",
"bytes": "918286"
},
{
"name": "Python",
"bytes": "5942009"
},
{
"name": "R",
"bytes": "524"
},
{
"name": "Shell",
"bytes": "4149832"
},
{
"name": "Tcl",
"bytes": "255109"
}
],
"symlink_target": ""
} |
package com.ryg.chapter_3;
import com.nineoldandroids.animation.ValueAnimator;
import com.nineoldandroids.animation.ValueAnimator.AnimatorUpdateListener;
import com.ryg.chapter_3.R;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnLongClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
public class TestActivity extends Activity implements OnClickListener,
OnLongClickListener {
private static final String TAG = "TestActivity";
private static final int MESSAGE_SCROLL_TO = 1;
private static final int FRAME_COUNT = 30;
private static final int DELAYED_TIME = 33;
private Button mButton1;
private View mButton2;
private int mCount = 0;
@SuppressLint("HandlerLeak")
private Handler mHandler = new Handler() {
public void handleMessage(Message msg) {
switch (msg.what) {
case MESSAGE_SCROLL_TO: {
mCount++;
if (mCount <= FRAME_COUNT) {
float fraction = mCount / (float) FRAME_COUNT;
int scrollX = (int) (fraction * 100);
mButton1.scrollTo(scrollX, 0);
mHandler.sendEmptyMessageDelayed(MESSAGE_SCROLL_TO, DELAYED_TIME);
}
break;
}
default:
break;
}
};
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test);
initView();
}
private void initView() {
mButton1 = (Button) findViewById(R.id.button1);
mButton1.setOnClickListener(this);
mButton2 = (TextView) findViewById(R.id.button2);
mButton2.setOnLongClickListener(this);
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
Log.d(TAG, "button1.left=" + mButton1.getLeft());
Log.d(TAG, "button1.x=" + mButton1.getX());
}
}
@Override
public void onClick(View v) {
if (v == mButton1) {
// mButton1.setTranslationX(100);
// Log.d(TAG, "button1.left=" + mButton1.getLeft());
// Log.d(TAG, "button1.x=" + mButton1.getX());
// ObjectAnimator.ofFloat(mButton1, "translationX", 0, 100)
// .setDuration(1000).start();
// MarginLayoutParams params = (MarginLayoutParams) mButton1
// .getLayoutParams();
// params.width += 100;
// params.leftMargin += 100;
// mButton1.requestLayout();
// mButton1.setLayoutParams(params);
// final int startX = 0;
// final int deltaX = 100;
// ValueAnimator animator = ValueAnimator.ofInt(0,
// 1).setDuration(1000);
// animator.addUpdateListener(new AnimatorUpdateListener() {
// @Override
// public void onAnimationUpdate(ValueAnimator animator) {
// float fraction = animator.getAnimatedFraction();
// mButton1.scrollTo(startX + (int) (deltaX * fraction), 0);
// }
// });
// animator.start();
mHandler.sendEmptyMessageDelayed(MESSAGE_SCROLL_TO, DELAYED_TIME);
}
}
@Override
public boolean onLongClick(View v) {
Toast.makeText(this, "long click", Toast.LENGTH_SHORT).show();
return true;
}
@Override
protected void onResume() {
Log.d(TAG, "onResume");
super.onStart();
}
}
| {
"content_hash": "2f7c3bd3601127c504c4440eb989628b",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 86,
"avg_line_length": 32.524193548387096,
"alnum_prop": 0.6072402677907265,
"repo_name": "Kevin16Wang/android-art-res",
"id": "4a4520c16b05a799055fe5e15ebe1df2bc56d40d",
"size": "4033",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "Chapter_3/src/com/ryg/chapter_3/TestActivity.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "598"
},
{
"name": "C",
"bytes": "499"
},
{
"name": "C++",
"bytes": "1585"
},
{
"name": "Java",
"bytes": "291928"
},
{
"name": "Makefile",
"bytes": "763"
},
{
"name": "Shell",
"bytes": "3682"
}
],
"symlink_target": ""
} |
<html>
<head>
<title>User agent detail - Mozilla/5.0 (Linux; U; Android 2.3.6; en-us; A110 Build/GRK39F) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/css/materialize.min.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="section">
<h1 class="header center orange-text">User agent detail</h1>
<div class="row center">
<h5 class="header light">
Mozilla/5.0 (Linux; U; Android 2.3.6; en-us; A110 Build/GRK39F) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
</h5>
</div>
</div>
<div class="section">
<table class="striped"><tr><th></th><th colspan="3">General</th><th colspan="5">Device</th><th colspan="3">Bot</th><th colspan="2"></th></tr><tr><th>Provider</th><th>Browser</th><th>Engine</th><th>OS</th><th>Brand</th><th>Model</th><th>Type</th><th>Is mobile</th><th>Is touch</th><th>Is bot</th><th>Name</th><th>Type</th><th>Parse time</th><th>Actions</th></tr><tr><th colspan="14" class="green lighten-3">Source result (test suite)</th></tr><tr><td>ua-parser/uap-core<br /><small>vendor/thadafinser/uap-core/tests/test_device.yaml</small></td><td> </td><td> </td><td> </td><td style="border-left: 1px solid #555">Micromax</td><td>A110</td><td></td><td></td><td></td><td style="border-left: 1px solid #555"></td><td></td><td></td><td></td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-test">Detail</a>
<!-- Modal Structure -->
<div id="modal-test" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>Testsuite result detail</h4>
<p><pre><code class="php">Array
(
[user_agent_string] => Mozilla/5.0 (Linux; U; Android 2.3.6; en-us; A110 Build/GRK39F) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
[family] => Micromax A110
[brand] => Micromax
[model] => A110
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><th colspan="14" class="green lighten-3">Providers</th></tr><tr><td>BrowscapPhp<br /><small>6012</small></td><td>Android 4.0</td><td>WebKit </td><td>Android 2.3</td><td style="border-left: 1px solid #555"></td><td></td><td>Mobile Phone</td><td>yes</td><td>yes</td><td style="border-left: 1px solid #555"></td><td></td><td></td><td>0.17502</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-215ac98d-ccf8-4615-916e-5a819d6a59c9">Detail</a>
<!-- Modal Structure -->
<div id="modal-215ac98d-ccf8-4615-916e-5a819d6a59c9" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>BrowscapPhp result detail</h4>
<p><pre><code class="php">stdClass Object
(
[browser_name_regex] => /^mozilla\/5\.0 \(.*linux.*android.2\.3.* build\/.*\).*applewebkit\/.*\(.*khtml,.*like gecko.*\).*version\/4\.0.*safari.*$/
[browser_name_pattern] => mozilla/5.0 (*linux*android?2.3* build/*)*applewebkit/*(*khtml,*like gecko*)*version/4.0*safari*
[parent] => Android Browser 4.0
[comment] => Android Browser 4.0
[browser] => Android
[browser_type] => Browser
[browser_bits] => 32
[browser_maker] => Google Inc
[browser_modus] => unknown
[version] => 4.0
[majorver] => 4
[minorver] => 0
[platform] => Android
[platform_version] => 2.3
[platform_description] => Android OS
[platform_bits] => 32
[platform_maker] => Google Inc
[alpha] =>
[beta] =>
[win16] =>
[win32] =>
[win64] =>
[frames] => 1
[iframes] => 1
[tables] => 1
[cookies] => 1
[backgroundsounds] =>
[javascript] => 1
[vbscript] =>
[javaapplets] => 1
[activexcontrols] =>
[ismobiledevice] => 1
[istablet] =>
[issyndicationreader] =>
[crawler] =>
[cssversion] => 3
[aolversion] => 0
[device_name] => general Mobile Phone
[device_maker] => unknown
[device_type] => Mobile Phone
[device_pointing_method] => touchscreen
[device_code_name] => general Mobile Phone
[device_brand_name] => unknown
[renderingengine_name] => WebKit
[renderingengine_version] => unknown
[renderingengine_description] => For Google Chrome, iOS (including both mobile Safari, WebViews within third-party apps, and web clips), Safari, Arora, Midori, OmniWeb, Shiira, iCab since version 4, Web, SRWare Iron, Rekonq, and in Maxthon 3.
[renderingengine_maker] => Apple Inc
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>DonatjUAParser<br /><small>v0.5.0</small></td><td>Android Browser 4.0</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-f1436016-fdf1-4aea-b4be-1d7c99ab0661">Detail</a>
<!-- Modal Structure -->
<div id="modal-f1436016-fdf1-4aea-b4be-1d7c99ab0661" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>DonatjUAParser result detail</h4>
<p><pre><code class="php">Array
(
[platform] => Android
[browser] => Android Browser
[version] => 4.0
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>NeutrinoApiCom<br /><small></small></td><td>Android Webkit 4.0</td><td><i class="material-icons">close</i></td><td>Android 2.3.6</td><td style="border-left: 1px solid #555">Generic</td><td>Android 2.3</td><td>mobile-browser</td><td>yes</td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.33303</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-9b0fa449-ec1b-40c8-8b1c-9486eb3b9cbc">Detail</a>
<!-- Modal Structure -->
<div id="modal-9b0fa449-ec1b-40c8-8b1c-9486eb3b9cbc" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>NeutrinoApiCom result detail</h4>
<p><pre><code class="php">stdClass Object
(
[mobile_screen_height] => 480
[is_mobile] => 1
[type] => mobile-browser
[mobile_brand] => Generic
[mobile_model] => Android 2.3
[version] => 4.0
[is_android] => 1
[browser_name] => Android Webkit
[operating_system_family] => Android
[operating_system_version] => 2.3.6
[is_ios] =>
[producer] => Google Inc.
[operating_system] => Android 2.3.x Gingerbread
[mobile_screen_width] => 320
[mobile_browser] => Android Webkit
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>PiwikDeviceDetector<br /><small>3.5.2</small></td><td>Android Browser </td><td>WebKit </td><td>Android 2.3</td><td style="border-left: 1px solid #555">Acer</td><td>Iconia Tab A110</td><td>tablet</td><td>yes</td><td></td><td style="border-left: 1px solid #555"></td><td></td><td></td><td>0.004</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-21638055-738d-46ba-a1b1-f5114bc26475">Detail</a>
<!-- Modal Structure -->
<div id="modal-21638055-738d-46ba-a1b1-f5114bc26475" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>PiwikDeviceDetector result detail</h4>
<p><pre><code class="php">Array
(
[client] => Array
(
[type] => browser
[name] => Android Browser
[short_name] => AN
[version] =>
[engine] => WebKit
)
[operatingSystem] => Array
(
[name] => Android
[short_name] => AND
[version] => 2.3
[platform] =>
)
[device] => Array
(
[brand] => AC
[brandName] => Acer
[model] => Iconia Tab A110
[device] => 2
[deviceName] => tablet
)
[bot] =>
[extra] => Array
(
[isBot] =>
[isBrowser] => 1
[isFeedReader] =>
[isMobileApp] =>
[isPIM] =>
[isLibrary] =>
[isMediaPlayer] =>
[isCamera] =>
[isCarBrowser] =>
[isConsole] =>
[isFeaturePhone] =>
[isPhablet] =>
[isPortableMediaPlayer] =>
[isSmartDisplay] =>
[isSmartphone] =>
[isTablet] => 1
[isTV] =>
[isDesktop] =>
[isMobile] => 1
[isTouchEnabled] =>
)
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>SinergiBrowserDetector<br /><small>6.0.0</small></td><td>Navigator 4.0</td><td><i class="material-icons">close</i></td><td>Android 2.3.6</td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td></td><td><i class="material-icons">close</i></td><td>yes</td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0.001</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-5415e7f2-ef7b-434c-abe0-b71ba9f6707c">Detail</a>
<!-- Modal Structure -->
<div id="modal-5415e7f2-ef7b-434c-abe0-b71ba9f6707c" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>SinergiBrowserDetector result detail</h4>
<p><pre><code class="php">Array
(
[browser] => Sinergi\BrowserDetector\Browser Object
(
[userAgent:Sinergi\BrowserDetector\Browser:private] => Sinergi\BrowserDetector\UserAgent Object
(
[userAgentString:Sinergi\BrowserDetector\UserAgent:private] => Mozilla/5.0 (Linux; U; Android 2.3.6; en-us; A110 Build/GRK39F) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
)
[name:Sinergi\BrowserDetector\Browser:private] => Navigator
[version:Sinergi\BrowserDetector\Browser:private] => 4.0
[isRobot:Sinergi\BrowserDetector\Browser:private] =>
[isChromeFrame:Sinergi\BrowserDetector\Browser:private] =>
)
[operatingSystem] => Sinergi\BrowserDetector\Os Object
(
[name:Sinergi\BrowserDetector\Os:private] => Android
[version:Sinergi\BrowserDetector\Os:private] => 2.3.6
[isMobile:Sinergi\BrowserDetector\Os:private] => 1
[userAgent:Sinergi\BrowserDetector\Os:private] => Sinergi\BrowserDetector\UserAgent Object
(
[userAgentString:Sinergi\BrowserDetector\UserAgent:private] => Mozilla/5.0 (Linux; U; Android 2.3.6; en-us; A110 Build/GRK39F) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
)
)
[device] => Sinergi\BrowserDetector\Device Object
(
[name:Sinergi\BrowserDetector\Device:private] => unknown
[userAgent:Sinergi\BrowserDetector\Device:private] => Sinergi\BrowserDetector\UserAgent Object
(
[userAgentString:Sinergi\BrowserDetector\UserAgent:private] => Mozilla/5.0 (Linux; U; Android 2.3.6; en-us; A110 Build/GRK39F) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
)
)
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>UAParser<br /><small>v3.4.5</small></td><td>Android 2.3.6</td><td><i class="material-icons">close</i></td><td>Android 2.3.6</td><td style="border-left: 1px solid #555">Micromax</td><td>A110</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.007</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-346c1a98-5fd3-454f-b6c8-350f2f505d8b">Detail</a>
<!-- Modal Structure -->
<div id="modal-346c1a98-5fd3-454f-b6c8-350f2f505d8b" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>UAParser result detail</h4>
<p><pre><code class="php">UAParser\Result\Client Object
(
[ua] => UAParser\Result\UserAgent Object
(
[major] => 2
[minor] => 3
[patch] => 6
[family] => Android
)
[os] => UAParser\Result\OperatingSystem Object
(
[major] => 2
[minor] => 3
[patch] => 6
[patchMinor] =>
[family] => Android
)
[device] => UAParser\Result\Device Object
(
[brand] => Micromax
[model] => A110
[family] => Micromax A110
)
[originalUserAgent] => Mozilla/5.0 (Linux; U; Android 2.3.6; en-us; A110 Build/GRK39F) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>UserAgentStringCom<br /><small></small></td><td>Android Webkit Browser </td><td><i class="material-icons">close</i></td><td>Android 2.3.6</td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td></td><td>0.06601</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-9cdd8b45-a2eb-406b-bd27-7e48af38ffd4">Detail</a>
<!-- Modal Structure -->
<div id="modal-9cdd8b45-a2eb-406b-bd27-7e48af38ffd4" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>UserAgentStringCom result detail</h4>
<p><pre><code class="php">stdClass Object
(
[agent_type] => Browser
[agent_name] => Android Webkit Browser
[agent_version] => --
[os_type] => Android
[os_name] => Android
[os_versionName] =>
[os_versionNumber] => 2.3.6
[os_producer] =>
[os_producerURL] =>
[linux_distibution] => Null
[agent_language] => English - United States
[agent_languageTag] => en-us
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>WhatIsMyBrowserCom<br /><small></small></td><td>Android Browser 4.0</td><td>WebKit 533.1</td><td>Android 2.3.6</td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0.41104</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-9795f66f-7271-430e-973a-a5c0e14dc35a">Detail</a>
<!-- Modal Structure -->
<div id="modal-9795f66f-7271-430e-973a-a5c0e14dc35a" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>WhatIsMyBrowserCom result detail</h4>
<p><pre><code class="php">stdClass Object
(
[operating_system_name] => Android
[simple_sub_description_string] =>
[simple_browser_string] => Android Browser 4 on Android (Gingerbread)
[browser_version] => 4
[extra_info] => Array
(
)
[operating_platform] =>
[extra_info_table] => stdClass Object
(
[System Build] => GRK39F
)
[layout_engine_name] => WebKit
[detected_addons] => Array
(
)
[operating_system_flavour_code] =>
[hardware_architecture] =>
[operating_system_flavour] =>
[operating_system_frameworks] => Array
(
)
[browser_name_code] => android-browser
[operating_system_version] => Gingerbread
[simple_operating_platform_string] =>
[is_abusive] =>
[layout_engine_version] => 533.1
[browser_capabilities] => Array
(
)
[operating_platform_vendor_name] =>
[operating_system] => Android (Gingerbread)
[operating_system_version_full] => 2.3.6
[operating_platform_code] =>
[browser_name] => Android Browser
[operating_system_name_code] => android
[user_agent] => Mozilla/5.0 (Linux; U; Android 2.3.6; en-us; A110 Build/GRK39F) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
[browser_version_full] => 4.0
[browser] => Android Browser 4
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>WhichBrowser<br /><small>2.0.10</small></td><td>Android Browser </td><td>Webkit 533.1</td><td>Android 2.3.6</td><td style="border-left: 1px solid #555">Acer</td><td>Iconia Tab A110</td><td>tablet</td><td>yes</td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.005</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-342c8d32-4765-40a8-8a5c-af3a38d19ae4">Detail</a>
<!-- Modal Structure -->
<div id="modal-342c8d32-4765-40a8-8a5c-af3a38d19ae4" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>WhichBrowser result detail</h4>
<p><pre><code class="php">Array
(
[browser] => Array
(
[name] => Android Browser
)
[engine] => Array
(
[name] => Webkit
[version] => 533.1
)
[os] => Array
(
[name] => Android
[version] => 2.3.6
)
[device] => Array
(
[type] => tablet
[manufacturer] => Acer
[model] => Iconia Tab A110
)
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>Woothee<br /><small>v1.2.0</small></td><td>Safari 4.0</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>smartphone</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-3f285ff5-314b-4db4-9948-54572e92e7b6">Detail</a>
<!-- Modal Structure -->
<div id="modal-3f285ff5-314b-4db4-9948-54572e92e7b6" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>Woothee result detail</h4>
<p><pre><code class="php">Array
(
[name] => Safari
[vendor] => Apple
[version] => 4.0
[category] => smartphone
[os] => Android
[os_version] => 2.3.6
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>Wurfl<br /><small>1.6.4</small></td><td>Android Webkit 2.3</td><td><i class="material-icons">close</i></td><td>Android 2.3</td><td style="border-left: 1px solid #555"></td><td></td><td>Smartphone</td><td>yes</td><td>yes</td><td style="border-left: 1px solid #555"></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0.06401</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-1a1aee36-7ce7-4111-a391-8e2c501f1532">Detail</a>
<!-- Modal Structure -->
<div id="modal-1a1aee36-7ce7-4111-a391-8e2c501f1532" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>Wurfl result detail</h4>
<p><pre><code class="php">Array
(
[virtual] => Array
(
[is_android] => true
[is_ios] => false
[is_windows_phone] => false
[is_app] => false
[is_full_desktop] => false
[is_largescreen] => false
[is_mobile] => true
[is_robot] => false
[is_smartphone] => true
[is_touchscreen] => true
[is_wml_preferred] => false
[is_xhtmlmp_preferred] => false
[is_html_preferred] => true
[advertised_device_os] => Android
[advertised_device_os_version] => 2.3
[advertised_browser] => Android Webkit
[advertised_browser_version] => 2.3
[complete_device_name] => Generic Android 2.3
[form_factor] => Smartphone
[is_phone] => true
[is_app_webview] => false
)
[all] => Array
(
[brand_name] => Generic
[model_name] => Android 2.3
[unique] => true
[ununiqueness_handler] =>
[is_wireless_device] => true
[device_claims_web_support] => true
[has_qwerty_keyboard] => true
[can_skip_aligned_link_row] => true
[uaprof] =>
[uaprof2] =>
[uaprof3] =>
[nokia_series] => 0
[nokia_edition] => 0
[device_os] => Android
[mobile_browser] => Android Webkit
[mobile_browser_version] =>
[device_os_version] => 2.3
[pointing_method] => touchscreen
[release_date] => 2010_november
[marketing_name] =>
[model_extra_info] =>
[nokia_feature_pack] => 0
[can_assign_phone_number] => true
[is_tablet] => false
[manufacturer_name] =>
[is_bot] => false
[is_google_glass] => false
[proportional_font] => false
[built_in_back_button_support] => false
[card_title_support] => true
[softkey_support] => false
[table_support] => true
[numbered_menus] => false
[menu_with_select_element_recommended] => false
[menu_with_list_of_links_recommended] => true
[icons_on_menu_items_support] => false
[break_list_of_links_with_br_element_recommended] => true
[access_key_support] => false
[wrap_mode_support] => false
[times_square_mode_support] => false
[deck_prefetch_support] => false
[elective_forms_recommended] => true
[wizards_recommended] => false
[image_as_link_support] => false
[insert_br_element_after_widget_recommended] => false
[wml_can_display_images_and_text_on_same_line] => false
[wml_displays_image_in_center] => false
[opwv_wml_extensions_support] => false
[wml_make_phone_call_string] => wtai://wp/mc;
[chtml_display_accesskey] => false
[emoji] => false
[chtml_can_display_images_and_text_on_same_line] => false
[chtml_displays_image_in_center] => false
[imode_region] => none
[chtml_make_phone_call_string] => tel:
[chtml_table_support] => false
[xhtml_honors_bgcolor] => true
[xhtml_supports_forms_in_table] => true
[xhtml_support_wml2_namespace] => false
[xhtml_autoexpand_select] => false
[xhtml_select_as_dropdown] => false
[xhtml_select_as_radiobutton] => false
[xhtml_select_as_popup] => false
[xhtml_display_accesskey] => false
[xhtml_supports_invisible_text] => false
[xhtml_supports_inline_input] => false
[xhtml_supports_monospace_font] => false
[xhtml_supports_table_for_layout] => true
[xhtml_supports_css_cell_table_coloring] => true
[xhtml_format_as_css_property] => false
[xhtml_format_as_attribute] => false
[xhtml_nowrap_mode] => false
[xhtml_marquee_as_css_property] => false
[xhtml_readable_background_color1] => #FFFFFF
[xhtml_readable_background_color2] => #FFFFFF
[xhtml_allows_disabled_form_elements] => true
[xhtml_document_title_support] => true
[xhtml_preferred_charset] => iso-8859-1
[opwv_xhtml_extensions_support] => false
[xhtml_make_phone_call_string] => tel:
[xhtmlmp_preferred_mime_type] => text/html
[xhtml_table_support] => true
[xhtml_send_sms_string] => sms:
[xhtml_send_mms_string] => mms:
[xhtml_file_upload] => supported
[cookie_support] => true
[accept_third_party_cookie] => true
[xhtml_supports_iframe] => full
[xhtml_avoid_accesskeys] => true
[xhtml_can_embed_video] => none
[ajax_support_javascript] => true
[ajax_manipulate_css] => true
[ajax_support_getelementbyid] => true
[ajax_support_inner_html] => true
[ajax_xhr_type] => standard
[ajax_manipulate_dom] => true
[ajax_support_events] => true
[ajax_support_event_listener] => true
[ajax_preferred_geoloc_api] => w3c_api
[xhtml_support_level] => 4
[preferred_markup] => html_web_4_0
[wml_1_1] => false
[wml_1_2] => false
[wml_1_3] => false
[html_wi_w3_xhtmlbasic] => true
[html_wi_oma_xhtmlmp_1_0] => true
[html_wi_imode_html_1] => false
[html_wi_imode_html_2] => false
[html_wi_imode_html_3] => false
[html_wi_imode_html_4] => false
[html_wi_imode_html_5] => false
[html_wi_imode_htmlx_1] => false
[html_wi_imode_htmlx_1_1] => false
[html_wi_imode_compact_generic] => false
[html_web_3_2] => true
[html_web_4_0] => true
[voicexml] => false
[multipart_support] => false
[total_cache_disable_support] => false
[time_to_live_support] => false
[resolution_width] => 320
[resolution_height] => 480
[columns] => 60
[max_image_width] => 320
[max_image_height] => 400
[rows] => 40
[physical_screen_width] => 34
[physical_screen_height] => 50
[dual_orientation] => true
[density_class] => 1.0
[wbmp] => true
[bmp] => false
[epoc_bmp] => false
[gif_animated] => false
[jpg] => true
[png] => true
[tiff] => false
[transparent_png_alpha] => true
[transparent_png_index] => true
[svgt_1_1] => false
[svgt_1_1_plus] => false
[greyscale] => false
[gif] => true
[colors] => 65536
[webp_lossy_support] => false
[webp_lossless_support] => false
[post_method_support] => true
[basic_authentication_support] => true
[empty_option_value_support] => true
[emptyok] => false
[nokia_voice_call] => false
[wta_voice_call] => false
[wta_phonebook] => false
[wta_misc] => false
[wta_pdc] => false
[https_support] => true
[phone_id_provided] => false
[max_data_rate] => 384
[wifi] => true
[sdio] => false
[vpn] => false
[has_cellular_radio] => true
[max_deck_size] => 2000000
[max_url_length_in_requests] => 256
[max_url_length_homepage] => 0
[max_url_length_bookmark] => 0
[max_url_length_cached_page] => 0
[max_no_of_connection_settings] => 0
[max_no_of_bookmarks] => 0
[max_length_of_username] => 0
[max_length_of_password] => 0
[max_object_size] => 0
[downloadfun_support] => false
[directdownload_support] => true
[inline_support] => false
[oma_support] => true
[ringtone] => false
[ringtone_3gpp] => false
[ringtone_midi_monophonic] => false
[ringtone_midi_polyphonic] => false
[ringtone_imelody] => false
[ringtone_digiplug] => false
[ringtone_compactmidi] => false
[ringtone_mmf] => false
[ringtone_rmf] => false
[ringtone_xmf] => false
[ringtone_amr] => false
[ringtone_awb] => false
[ringtone_aac] => false
[ringtone_wav] => false
[ringtone_mp3] => false
[ringtone_spmidi] => false
[ringtone_qcelp] => false
[ringtone_voices] => 1
[ringtone_df_size_limit] => 0
[ringtone_directdownload_size_limit] => 0
[ringtone_inline_size_limit] => 0
[ringtone_oma_size_limit] => 0
[wallpaper] => false
[wallpaper_max_width] => 0
[wallpaper_max_height] => 0
[wallpaper_preferred_width] => 0
[wallpaper_preferred_height] => 0
[wallpaper_resize] => none
[wallpaper_wbmp] => false
[wallpaper_bmp] => false
[wallpaper_gif] => false
[wallpaper_jpg] => false
[wallpaper_png] => false
[wallpaper_tiff] => false
[wallpaper_greyscale] => false
[wallpaper_colors] => 2
[wallpaper_df_size_limit] => 0
[wallpaper_directdownload_size_limit] => 0
[wallpaper_inline_size_limit] => 0
[wallpaper_oma_size_limit] => 0
[screensaver] => false
[screensaver_max_width] => 0
[screensaver_max_height] => 0
[screensaver_preferred_width] => 0
[screensaver_preferred_height] => 0
[screensaver_resize] => none
[screensaver_wbmp] => false
[screensaver_bmp] => false
[screensaver_gif] => false
[screensaver_jpg] => false
[screensaver_png] => false
[screensaver_greyscale] => false
[screensaver_colors] => 2
[screensaver_df_size_limit] => 0
[screensaver_directdownload_size_limit] => 0
[screensaver_inline_size_limit] => 0
[screensaver_oma_size_limit] => 0
[picture] => false
[picture_max_width] => 0
[picture_max_height] => 0
[picture_preferred_width] => 0
[picture_preferred_height] => 0
[picture_resize] => none
[picture_wbmp] => false
[picture_bmp] => false
[picture_gif] => false
[picture_jpg] => false
[picture_png] => false
[picture_greyscale] => false
[picture_colors] => 2
[picture_df_size_limit] => 0
[picture_directdownload_size_limit] => 0
[picture_inline_size_limit] => 0
[picture_oma_size_limit] => 0
[video] => false
[oma_v_1_0_forwardlock] => false
[oma_v_1_0_combined_delivery] => false
[oma_v_1_0_separate_delivery] => false
[streaming_video] => true
[streaming_3gpp] => true
[streaming_mp4] => true
[streaming_mov] => false
[streaming_video_size_limit] => 0
[streaming_real_media] => none
[streaming_flv] => false
[streaming_3g2] => false
[streaming_vcodec_h263_0] => 10
[streaming_vcodec_h263_3] => -1
[streaming_vcodec_mpeg4_sp] => 2
[streaming_vcodec_mpeg4_asp] => -1
[streaming_vcodec_h264_bp] => 3.0
[streaming_acodec_amr] => nb
[streaming_acodec_aac] => lc
[streaming_wmv] => none
[streaming_preferred_protocol] => rtsp
[streaming_preferred_http_protocol] => progressive_download
[wap_push_support] => false
[connectionless_service_indication] => false
[connectionless_service_load] => false
[connectionless_cache_operation] => false
[connectionoriented_unconfirmed_service_indication] => false
[connectionoriented_unconfirmed_service_load] => false
[connectionoriented_unconfirmed_cache_operation] => false
[connectionoriented_confirmed_service_indication] => false
[connectionoriented_confirmed_service_load] => false
[connectionoriented_confirmed_cache_operation] => false
[utf8_support] => true
[ascii_support] => false
[iso8859_support] => false
[expiration_date] => false
[j2me_cldc_1_0] => false
[j2me_cldc_1_1] => false
[j2me_midp_1_0] => false
[j2me_midp_2_0] => false
[doja_1_0] => false
[doja_1_5] => false
[doja_2_0] => false
[doja_2_1] => false
[doja_2_2] => false
[doja_3_0] => false
[doja_3_5] => false
[doja_4_0] => false
[j2me_jtwi] => false
[j2me_mmapi_1_0] => false
[j2me_mmapi_1_1] => false
[j2me_wmapi_1_0] => false
[j2me_wmapi_1_1] => false
[j2me_wmapi_2_0] => false
[j2me_btapi] => false
[j2me_3dapi] => false
[j2me_locapi] => false
[j2me_nokia_ui] => false
[j2me_motorola_lwt] => false
[j2me_siemens_color_game] => false
[j2me_siemens_extension] => false
[j2me_heap_size] => 0
[j2me_max_jar_size] => 0
[j2me_storage_size] => 0
[j2me_max_record_store_size] => 0
[j2me_screen_width] => 0
[j2me_screen_height] => 0
[j2me_canvas_width] => 0
[j2me_canvas_height] => 0
[j2me_bits_per_pixel] => 0
[j2me_audio_capture_enabled] => false
[j2me_video_capture_enabled] => false
[j2me_photo_capture_enabled] => false
[j2me_capture_image_formats] => none
[j2me_http] => false
[j2me_https] => false
[j2me_socket] => false
[j2me_udp] => false
[j2me_serial] => false
[j2me_gif] => false
[j2me_gif89a] => false
[j2me_jpg] => false
[j2me_png] => false
[j2me_bmp] => false
[j2me_bmp3] => false
[j2me_wbmp] => false
[j2me_midi] => false
[j2me_wav] => false
[j2me_amr] => false
[j2me_mp3] => false
[j2me_mp4] => false
[j2me_imelody] => false
[j2me_rmf] => false
[j2me_au] => false
[j2me_aac] => false
[j2me_realaudio] => false
[j2me_xmf] => false
[j2me_wma] => false
[j2me_3gpp] => false
[j2me_h263] => false
[j2me_svgt] => false
[j2me_mpeg4] => false
[j2me_realvideo] => false
[j2me_real8] => false
[j2me_realmedia] => false
[j2me_left_softkey_code] => 0
[j2me_right_softkey_code] => 0
[j2me_middle_softkey_code] => 0
[j2me_select_key_code] => 0
[j2me_return_key_code] => 0
[j2me_clear_key_code] => 0
[j2me_datefield_no_accepts_null_date] => false
[j2me_datefield_broken] => false
[receiver] => false
[sender] => false
[mms_max_size] => 0
[mms_max_height] => 0
[mms_max_width] => 0
[built_in_recorder] => false
[built_in_camera] => true
[mms_jpeg_baseline] => false
[mms_jpeg_progressive] => false
[mms_gif_static] => false
[mms_gif_animated] => false
[mms_png] => false
[mms_bmp] => false
[mms_wbmp] => false
[mms_amr] => false
[mms_wav] => false
[mms_midi_monophonic] => false
[mms_midi_polyphonic] => false
[mms_midi_polyphonic_voices] => 0
[mms_spmidi] => false
[mms_mmf] => false
[mms_mp3] => false
[mms_evrc] => false
[mms_qcelp] => false
[mms_ota_bitmap] => false
[mms_nokia_wallpaper] => false
[mms_nokia_operatorlogo] => false
[mms_nokia_3dscreensaver] => false
[mms_nokia_ringingtone] => false
[mms_rmf] => false
[mms_xmf] => false
[mms_symbian_install] => false
[mms_jar] => false
[mms_jad] => false
[mms_vcard] => false
[mms_vcalendar] => false
[mms_wml] => false
[mms_wbxml] => false
[mms_wmlc] => false
[mms_video] => false
[mms_mp4] => false
[mms_3gpp] => false
[mms_3gpp2] => false
[mms_max_frame_rate] => 0
[nokiaring] => false
[picturemessage] => false
[operatorlogo] => false
[largeoperatorlogo] => false
[callericon] => false
[nokiavcard] => false
[nokiavcal] => false
[sckl_ringtone] => false
[sckl_operatorlogo] => false
[sckl_groupgraphic] => false
[sckl_vcard] => false
[sckl_vcalendar] => false
[text_imelody] => false
[ems] => false
[ems_variablesizedpictures] => false
[ems_imelody] => false
[ems_odi] => false
[ems_upi] => false
[ems_version] => 0
[siemens_ota] => false
[siemens_logo_width] => 101
[siemens_logo_height] => 29
[siemens_screensaver_width] => 101
[siemens_screensaver_height] => 50
[gprtf] => false
[sagem_v1] => false
[sagem_v2] => false
[panasonic] => false
[sms_enabled] => true
[wav] => false
[mmf] => false
[smf] => false
[mld] => false
[midi_monophonic] => false
[midi_polyphonic] => false
[sp_midi] => false
[rmf] => false
[xmf] => false
[compactmidi] => false
[digiplug] => false
[nokia_ringtone] => false
[imelody] => false
[au] => false
[amr] => false
[awb] => false
[aac] => true
[mp3] => true
[voices] => 1
[qcelp] => false
[evrc] => false
[flash_lite_version] =>
[fl_wallpaper] => false
[fl_screensaver] => false
[fl_standalone] => false
[fl_browser] => false
[fl_sub_lcd] => false
[full_flash_support] => true
[css_supports_width_as_percentage] => true
[css_border_image] => webkit
[css_rounded_corners] => webkit
[css_gradient] => none
[css_spriting] => true
[css_gradient_linear] => none
[is_transcoder] => false
[transcoder_ua_header] => user-agent
[rss_support] => false
[pdf_support] => true
[progressive_download] => true
[playback_vcodec_h263_0] => 10
[playback_vcodec_h263_3] => -1
[playback_vcodec_mpeg4_sp] => 0
[playback_vcodec_mpeg4_asp] => -1
[playback_vcodec_h264_bp] => 3.0
[playback_real_media] => none
[playback_3gpp] => true
[playback_3g2] => false
[playback_mp4] => true
[playback_mov] => false
[playback_acodec_amr] => nb
[playback_acodec_aac] => none
[playback_df_size_limit] => 0
[playback_directdownload_size_limit] => 0
[playback_inline_size_limit] => 0
[playback_oma_size_limit] => 0
[playback_acodec_qcelp] => false
[playback_wmv] => none
[hinted_progressive_download] => true
[html_preferred_dtd] => html4
[viewport_supported] => true
[viewport_width] => device_width_token
[viewport_userscalable] => no
[viewport_initial_scale] =>
[viewport_maximum_scale] =>
[viewport_minimum_scale] =>
[mobileoptimized] => false
[handheldfriendly] => false
[canvas_support] => full
[image_inlining] => true
[is_smarttv] => false
[is_console] => false
[nfc_support] => false
[ux_full_desktop] => false
[jqm_grade] => A
[is_sencha_touch_ok] => false
[controlcap_is_smartphone] => default
[controlcap_is_ios] => default
[controlcap_is_android] => default
[controlcap_is_robot] => default
[controlcap_is_app] => default
[controlcap_advertised_device_os] => default
[controlcap_advertised_device_os_version] => default
[controlcap_advertised_browser] => default
[controlcap_advertised_browser_version] => default
[controlcap_is_windows_phone] => default
[controlcap_is_full_desktop] => default
[controlcap_is_largescreen] => default
[controlcap_is_mobile] => default
[controlcap_is_touchscreen] => default
[controlcap_is_wml_preferred] => default
[controlcap_is_xhtmlmp_preferred] => default
[controlcap_is_html_preferred] => default
[controlcap_form_factor] => default
[controlcap_complete_device_name] => default
)
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr></table>
</div>
<div class="section">
<h1 class="header center orange-text">About this comparison</h1>
<div class="row center">
<h5 class="header light">
The primary goal of this project is simple<br />
I wanted to know which user agent parser is the most accurate in each part - device detection, bot detection and so on...<br />
<br />
The secondary goal is to provide a source for all user agent parsers to improve their detection based on this results.<br />
<br />
You can also improve this further, by suggesting ideas at <a href="https://github.com/ThaDafinser/UserAgentParserComparison">ThaDafinser/UserAgentParserComparison</a><br />
<br />
The comparison is based on the abstraction by <a href="https://github.com/ThaDafinser/UserAgentParser">ThaDafinser/UserAgentParser</a>
</h5>
</div>
</div>
<div class="card">
<div class="card-content">
Comparison created <i>2016-02-13 13:42:38</i> | by
<a href="https://github.com/ThaDafinser">ThaDafinser</a>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/js/materialize.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/list.js/1.1.1/list.min.js"></script>
<script>
$(document).ready(function(){
// the "href" attribute of .modal-trigger must specify the modal ID that wants to be triggered
$('.modal-trigger').leanModal();
});
</script>
</body>
</html> | {
"content_hash": "1884bd3fd0e5b3927fb5dd8c6e9d95d6",
"timestamp": "",
"source": "github",
"line_count": 1121,
"max_line_length": 747,
"avg_line_length": 41.40321141837645,
"alnum_prop": 0.5383190054510589,
"repo_name": "ThaDafinser/UserAgentParserComparison",
"id": "2176db0c032cec40a22faa56a1d8ded353f94af6",
"size": "46414",
"binary": false,
"copies": "1",
"ref": "refs/heads/gh-pages",
"path": "v4/user-agent-detail/f3/15/f3150772-7fae-419a-a212-75201d7124a7.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "2060859160"
}
],
"symlink_target": ""
} |
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@snowplow/node-tracker](./node-tracker.md) > [CorePlugin](./node-tracker.coreplugin.md) > [beforeTrack](./node-tracker.coreplugin.beforetrack.md)
## CorePlugin.beforeTrack property
Called just before the trackerCore callback fires
<b>Signature:</b>
```typescript
beforeTrack?: (payloadBuilder: PayloadBuilder) => void;
```
| {
"content_hash": "a30ff79f435579811403c5a1a7b9f504",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 176,
"avg_line_length": 34.84615384615385,
"alnum_prop": 0.7086092715231788,
"repo_name": "snowplow/snowplow-javascript-tracker",
"id": "da2f001183ee89266ae5dfb4a1a144f265fb4015",
"size": "453",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "trackers/node-tracker/docs/markdown/node-tracker.coreplugin.beforetrack.md",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "HTML",
"bytes": "43921"
},
{
"name": "JavaScript",
"bytes": "84753"
},
{
"name": "Shell",
"bytes": "432"
},
{
"name": "TypeScript",
"bytes": "773575"
}
],
"symlink_target": ""
} |
import BaseTexture from './BaseTexture';
import VideoBaseTexture from './VideoBaseTexture';
import TextureUvs from './TextureUvs';
import EventEmitter from 'eventemitter3';
import { Rectangle } from '../math';
import { TextureCache, BaseTextureCache } from '../utils';
/**
* A texture stores the information that represents an image or part of an image. It cannot be added
* to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided
* then the whole image is used.
*
* You can directly create a texture from an image and then reuse it multiple times like this :
*
* ```js
* let texture = PIXI.Texture.fromImage('assets/image.png');
* let sprite1 = new PIXI.Sprite(texture);
* let sprite2 = new PIXI.Sprite(texture);
* ```
*
* Textures made from SVGs, loaded or not, cannot be used before the file finishes processing.
* You can check for this by checking the sprite's _textureID property.
* ```js
* var texture = PIXI.Texture.fromImage('assets/image.svg');
* var sprite1 = new PIXI.Sprite(texture);
* //sprite1._textureID should not be undefined if the texture has finished processing the SVG file
* ```
* You can use a ticker or rAF to ensure your sprites load the finished textures after processing. See issue #3068.
*
* @class
* @extends EventEmitter
* @memberof PIXI
*/
export default class Texture extends EventEmitter
{
/**
* @param {PIXI.BaseTexture} baseTexture - The base texture source to create the texture from
* @param {PIXI.Rectangle} [frame] - The rectangle frame of the texture to show
* @param {PIXI.Rectangle} [orig] - The area of original texture
* @param {PIXI.Rectangle} [trim] - Trimmed rectangle of original texture
* @param {number} [rotate] - indicates how the texture was rotated by texture packer. See {@link PIXI.GroupD8}
*/
constructor(baseTexture, frame, orig, trim, rotate)
{
super();
/**
* Does this Texture have any frame data assigned to it?
*
* @member {boolean}
*/
this.noFrame = false;
if (!frame)
{
this.noFrame = true;
frame = new Rectangle(0, 0, 1, 1);
}
if (baseTexture instanceof Texture)
{
baseTexture = baseTexture.baseTexture;
}
/**
* The base texture that this texture uses.
*
* @member {PIXI.BaseTexture}
*/
this.baseTexture = baseTexture;
/**
* This is the area of the BaseTexture image to actually copy to the Canvas / WebGL when rendering,
* irrespective of the actual frame size or placement (which can be influenced by trimmed texture atlases)
*
* @member {PIXI.Rectangle}
*/
this._frame = frame;
/**
* This is the trimmed area of original texture, before it was put in atlas
*
* @member {PIXI.Rectangle}
*/
this.trim = trim;
/**
* This will let the renderer know if the texture is valid. If it's not then it cannot be rendered.
*
* @member {boolean}
*/
this.valid = false;
/**
* This will let a renderer know that a texture has been updated (used mainly for webGL uv updates)
*
* @member {boolean}
*/
this.requiresUpdate = false;
/**
* The WebGL UV data cache.
*
* @member {PIXI.TextureUvs}
* @private
*/
this._uvs = null;
/**
* This is the area of original texture, before it was put in atlas
*
* @member {PIXI.Rectangle}
*/
this.orig = orig || frame;// new Rectangle(0, 0, 1, 1);
this._rotate = Number(rotate || 0);
if (rotate === true)
{
// this is old texturepacker legacy, some games/libraries are passing "true" for rotated textures
this._rotate = 2;
}
else if (this._rotate % 2 !== 0)
{
throw new Error('attempt to use diamond-shaped UVs. If you are sure, set rotation manually');
}
if (baseTexture.hasLoaded)
{
if (this.noFrame)
{
frame = new Rectangle(0, 0, baseTexture.width, baseTexture.height);
// if there is no frame we should monitor for any base texture changes..
baseTexture.on('update', this.onBaseTextureUpdated, this);
}
this.frame = frame;
}
else
{
baseTexture.once('loaded', this.onBaseTextureLoaded, this);
}
/**
* Fired when the texture is updated. This happens if the frame or the baseTexture is updated.
*
* @event update
* @memberof PIXI.Texture#
* @protected
*/
this._updateID = 0;
/**
* Extra field for extra plugins. May contain clamp settings and some matrices
* @type {Object}
*/
this.transform = null;
}
/**
* Updates this texture on the gpu.
*
*/
update()
{
this.baseTexture.update();
}
/**
* Called when the base texture is loaded
*
* @private
* @param {PIXI.BaseTexture} baseTexture - The base texture.
*/
onBaseTextureLoaded(baseTexture)
{
this._updateID++;
// TODO this code looks confusing.. boo to abusing getters and setters!
if (this.noFrame)
{
this.frame = new Rectangle(0, 0, baseTexture.width, baseTexture.height);
}
else
{
this.frame = this._frame;
}
this.baseTexture.on('update', this.onBaseTextureUpdated, this);
this.emit('update', this);
}
/**
* Called when the base texture is updated
*
* @private
* @param {PIXI.BaseTexture} baseTexture - The base texture.
*/
onBaseTextureUpdated(baseTexture)
{
this._updateID++;
this._frame.width = baseTexture.width;
this._frame.height = baseTexture.height;
this.emit('update', this);
}
/**
* Destroys this texture
*
* @param {boolean} [destroyBase=false] Whether to destroy the base texture as well
*/
destroy(destroyBase)
{
if (this.baseTexture)
{
if (destroyBase)
{
// delete the texture if it exists in the texture cache..
// this only needs to be removed if the base texture is actually destroyed too..
if (TextureCache[this.baseTexture.imageUrl])
{
delete TextureCache[this.baseTexture.imageUrl];
}
this.baseTexture.destroy();
}
this.baseTexture.off('update', this.onBaseTextureUpdated, this);
this.baseTexture.off('loaded', this.onBaseTextureLoaded, this);
this.baseTexture = null;
}
this._frame = null;
this._uvs = null;
this.trim = null;
this.orig = null;
this.valid = false;
this.off('dispose', this.dispose, this);
this.off('update', this.update, this);
}
/**
* Creates a new texture object that acts the same as this one.
*
* @return {PIXI.Texture} The new texture
*/
clone()
{
return new Texture(this.baseTexture, this.frame, this.orig, this.trim, this.rotate);
}
/**
* Updates the internal WebGL UV cache.
*
* @protected
*/
_updateUvs()
{
if (!this._uvs)
{
this._uvs = new TextureUvs();
}
this._uvs.set(this._frame, this.baseTexture, this.rotate);
this._updateID++;
}
/**
* Helper function that creates a Texture object from the given image url.
* If the image is not in the texture cache it will be created and loaded.
*
* @static
* @param {string} imageUrl - The image url of the texture
* @param {boolean} [crossorigin] - Whether requests should be treated as crossorigin
* @param {number} [scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values
* @param {number} [sourceScale=(auto)] - Scale for the original image, used with SVG images.
* @return {PIXI.Texture} The newly created texture
*/
static fromImage(imageUrl, crossorigin, scaleMode, sourceScale)
{
let texture = TextureCache[imageUrl];
if (!texture)
{
texture = new Texture(BaseTexture.fromImage(imageUrl, crossorigin, scaleMode, sourceScale));
TextureCache[imageUrl] = texture;
}
return texture;
}
/**
* Helper function that creates a sprite that will contain a texture from the TextureCache based on the frameId
* The frame ids are created when a Texture packer file has been loaded
*
* @static
* @param {string} frameId - The frame Id of the texture in the cache
* @return {PIXI.Texture} The newly created texture
*/
static fromFrame(frameId)
{
const texture = TextureCache[frameId];
if (!texture)
{
throw new Error(`The frameId "${frameId}" does not exist in the texture cache`);
}
return texture;
}
/**
* Helper function that creates a new Texture based on the given canvas element.
*
* @static
* @param {HTMLCanvasElement} canvas - The canvas element source of the texture
* @param {number} [scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values
* @return {PIXI.Texture} The newly created texture
*/
static fromCanvas(canvas, scaleMode)
{
return new Texture(BaseTexture.fromCanvas(canvas, scaleMode));
}
/**
* Helper function that creates a new Texture based on the given video element.
*
* @static
* @param {HTMLVideoElement|string} video - The URL or actual element of the video
* @param {number} [scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values
* @return {PIXI.Texture} The newly created texture
*/
static fromVideo(video, scaleMode)
{
if (typeof video === 'string')
{
return Texture.fromVideoUrl(video, scaleMode);
}
return new Texture(VideoBaseTexture.fromVideo(video, scaleMode));
}
/**
* Helper function that creates a new Texture based on the video url.
*
* @static
* @param {string} videoUrl - URL of the video
* @param {number} [scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values
* @return {PIXI.Texture} The newly created texture
*/
static fromVideoUrl(videoUrl, scaleMode)
{
return new Texture(VideoBaseTexture.fromUrl(videoUrl, scaleMode));
}
/**
* Helper function that creates a new Texture based on the source you provide.
* The source can be - frame id, image url, video url, canvas element, video element, base texture
*
* @static
* @param {number|string|PIXI.BaseTexture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from
* @return {PIXI.Texture} The newly created texture
*/
static from(source)
{
// TODO auto detect cross origin..
// TODO pass in scale mode?
if (typeof source === 'string')
{
const texture = TextureCache[source];
if (!texture)
{
// check if its a video..
const isVideo = source.match(/\.(mp4|webm|ogg|h264|avi|mov)$/) !== null;
if (isVideo)
{
return Texture.fromVideoUrl(source);
}
return Texture.fromImage(source);
}
return texture;
}
else if (source instanceof HTMLImageElement)
{
return new Texture(new BaseTexture(source));
}
else if (source instanceof HTMLCanvasElement)
{
return Texture.fromCanvas(source);
}
else if (source instanceof HTMLVideoElement)
{
return Texture.fromVideo(source);
}
else if (source instanceof BaseTexture)
{
return new Texture(source);
}
// lets assume its a texture!
return source;
}
/**
* Adds a texture to the global TextureCache. This cache is shared across the whole PIXI object.
*
* @static
* @param {PIXI.Texture} texture - The Texture to add to the cache.
* @param {string} id - The id that the texture will be stored against.
*/
static addTextureToCache(texture, id)
{
TextureCache[id] = texture;
}
/**
* Remove a texture from the global TextureCache.
*
* @static
* @param {string} id - The id of the texture to be removed
* @return {PIXI.Texture} The texture that was removed
*/
static removeTextureFromCache(id)
{
const texture = TextureCache[id];
delete TextureCache[id];
delete BaseTextureCache[id];
return texture;
}
/**
* The frame specifies the region of the base texture that this texture uses.
*
* @member {PIXI.Rectangle}
*/
get frame()
{
return this._frame;
}
set frame(frame) // eslint-disable-line require-jsdoc
{
this._frame = frame;
this.noFrame = false;
if (frame.x + frame.width > this.baseTexture.width || frame.y + frame.height > this.baseTexture.height)
{
throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions ${this}`);
}
// this.valid = frame && frame.width && frame.height && this.baseTexture.source && this.baseTexture.hasLoaded;
this.valid = frame && frame.width && frame.height && this.baseTexture.hasLoaded;
if (!this.trim && !this.rotate)
{
this.orig = frame;
}
if (this.valid)
{
this._updateUvs();
}
}
/**
* Indicates whether the texture is rotated inside the atlas
* set to 2 to compensate for texture packer rotation
* set to 6 to compensate for spine packer rotation
* can be used to rotate or mirror sprites
* See {@link PIXI.GroupD8} for explanation
*
* @member {number}
*/
get rotate()
{
return this._rotate;
}
set rotate(rotate) // eslint-disable-line require-jsdoc
{
this._rotate = rotate;
if (this.valid)
{
this._updateUvs();
}
}
/**
* The width of the Texture in pixels.
*
* @member {number}
*/
get width()
{
return this.orig.width;
}
/**
* The height of the Texture in pixels.
*
* @member {number}
*/
get height()
{
return this.orig.height;
}
}
/**
* An empty texture, used often to not have to create multiple empty textures.
* Can not be destroyed.
*
* @static
* @constant
*/
Texture.EMPTY = new Texture(new BaseTexture());
Texture.EMPTY.destroy = function _emptyDestroy() { /* empty */ };
Texture.EMPTY.on = function _emptyOn() { /* empty */ };
Texture.EMPTY.once = function _emptyOnce() { /* empty */ };
Texture.EMPTY.emit = function _emptyEmit() { /* empty */ };
| {
"content_hash": "fef87e5a4a45b73cf6055775ee53bc19",
"timestamp": "",
"source": "github",
"line_count": 534,
"max_line_length": 120,
"avg_line_length": 29.181647940074907,
"alnum_prop": 0.579541808380928,
"repo_name": "jpweeks/pixi.js",
"id": "ca31456f92f0b8ed6524060f55e12168a11e6574",
"size": "15583",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/core/textures/Texture.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2922"
},
{
"name": "GLSL",
"bytes": "11291"
},
{
"name": "HTML",
"bytes": "1261"
},
{
"name": "JavaScript",
"bytes": "947426"
}
],
"symlink_target": ""
} |
FileVersionInfo::FileVersionInfo(void* data, int language, int code_page)
: language_(language), code_page_(code_page) {
data_.reset((char*) data);
fixed_file_info_ = NULL;
UINT size;
::VerQueryValue(data_.get(), L"\\", (LPVOID*)&fixed_file_info_, &size);
}
FileVersionInfo::~FileVersionInfo() {
DCHECK(data_.get());
}
typedef struct {
WORD language;
WORD code_page;
} LanguageAndCodePage;
// static
FileVersionInfo* FileVersionInfo::CreateFileVersionInfoForCurrentModule() {
std::wstring app_path;
if (!PathService::Get(base::FILE_MODULE, &app_path))
return NULL;
return CreateFileVersionInfo(app_path);
}
// static
FileVersionInfo* FileVersionInfo::CreateFileVersionInfo(
const FilePath& file_path) {
DWORD dummy;
const wchar_t* path = file_path.value().c_str();
DWORD length = ::GetFileVersionInfoSize(path, &dummy);
if (length == 0)
return NULL;
void* data = calloc(length, 1);
if (!data)
return NULL;
if (!::GetFileVersionInfo(path, dummy, length, data)) {
free(data);
return NULL;
}
LanguageAndCodePage* translate = NULL;
uint32 page_count;
BOOL query_result = VerQueryValue(data, L"\\VarFileInfo\\Translation",
(void**) &translate, &page_count);
if (query_result && translate) {
return new FileVersionInfo(data, translate->language,
translate->code_page);
} else {
free(data);
return NULL;
}
}
FileVersionInfo* FileVersionInfo::CreateFileVersionInfo(
const std::wstring& file_path) {
FilePath file_path_fp = FilePath::FromWStringHack(file_path);
return CreateFileVersionInfo(file_path_fp);
}
std::wstring FileVersionInfo::company_name() {
return GetStringValue(L"CompanyName");
}
std::wstring FileVersionInfo::company_short_name() {
return GetStringValue(L"CompanyShortName");
}
std::wstring FileVersionInfo::internal_name() {
return GetStringValue(L"InternalName");
}
std::wstring FileVersionInfo::product_name() {
return GetStringValue(L"ProductName");
}
std::wstring FileVersionInfo::product_short_name() {
return GetStringValue(L"ProductShortName");
}
std::wstring FileVersionInfo::comments() {
return GetStringValue(L"Comments");
}
std::wstring FileVersionInfo::legal_copyright() {
return GetStringValue(L"LegalCopyright");
}
std::wstring FileVersionInfo::product_version() {
return GetStringValue(L"ProductVersion");
}
std::wstring FileVersionInfo::file_description() {
return GetStringValue(L"FileDescription");
}
std::wstring FileVersionInfo::legal_trademarks() {
return GetStringValue(L"LegalTrademarks");
}
std::wstring FileVersionInfo::private_build() {
return GetStringValue(L"PrivateBuild");
}
std::wstring FileVersionInfo::file_version() {
return GetStringValue(L"FileVersion");
}
std::wstring FileVersionInfo::original_filename() {
return GetStringValue(L"OriginalFilename");
}
std::wstring FileVersionInfo::special_build() {
return GetStringValue(L"SpecialBuild");
}
std::wstring FileVersionInfo::last_change() {
return GetStringValue(L"LastChange");
}
bool FileVersionInfo::is_official_build() {
return (GetStringValue(L"Official Build").compare(L"1") == 0);
}
bool FileVersionInfo::GetValue(const wchar_t* name, std::wstring* value_str) {
WORD lang_codepage[8];
int i = 0;
// Use the language and codepage from the DLL.
lang_codepage[i++] = language_;
lang_codepage[i++] = code_page_;
// Use the default language and codepage from the DLL.
lang_codepage[i++] = ::GetUserDefaultLangID();
lang_codepage[i++] = code_page_;
// Use the language from the DLL and Latin codepage (most common).
lang_codepage[i++] = language_;
lang_codepage[i++] = 1252;
// Use the default language and Latin codepage (most common).
lang_codepage[i++] = ::GetUserDefaultLangID();
lang_codepage[i++] = 1252;
i = 0;
while (i < arraysize(lang_codepage)) {
wchar_t sub_block[MAX_PATH];
WORD language = lang_codepage[i++];
WORD code_page = lang_codepage[i++];
_snwprintf_s(sub_block, MAX_PATH, MAX_PATH,
L"\\StringFileInfo\\%04x%04x\\%ls", language, code_page, name);
LPVOID value = NULL;
uint32 size;
BOOL r = ::VerQueryValue(data_.get(), sub_block, &value, &size);
if (r && value) {
value_str->assign(static_cast<wchar_t*>(value));
return true;
}
}
return false;
}
std::wstring FileVersionInfo::GetStringValue(const wchar_t* name) {
std::wstring str;
if (GetValue(name, &str))
return str;
else
return L"";
}
| {
"content_hash": "6234ac3e25d03074a0c067eefe6c9669",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 80,
"avg_line_length": 26.57894736842105,
"alnum_prop": 0.6858085808580858,
"repo_name": "kuiche/chromium",
"id": "4f7f23d47e4245e1d099e5de236ab8e99f2663d4",
"size": "4911",
"binary": false,
"copies": "2",
"ref": "refs/heads/trunk",
"path": "base/file_version_info.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/com_btn_click"
android:padding="10dip"
android:tag="child" >
<ImageView
android:id="@+id/image_userimage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:src="@drawable/user" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/image_userimage"
android:gravity="center"
android:orientation="vertical" >
<TextView
android:id="@+id/txt_username"
style="@style/common_txt_style"
android:layout_marginBottom="5dip" />
<TextView
android:id="@+id/txt_userid"
style="@style/common_txt_style"
android:layout_marginBottom="5dip" />
<TextView
android:id="@+id/txt_user_ipaddress"
style="@style/common_txt_style"
android:layout_marginBottom="5dip" />
</LinearLayout>
</RelativeLayout> | {
"content_hash": "9bed8e291c145d0e01878bfce2ae01ba",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 74,
"avg_line_length": 32.76923076923077,
"alnum_prop": 0.6197183098591549,
"repo_name": "alucard263096/AMKRemoteClass",
"id": "f4d50d8b648ff5d3adbea9ace1389777e6cb88f3",
"size": "1278",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Documents/AnyChat/AnyChatCoreSDK_Android_r4840/src/AnyChatCallCenter/res/layout/user_item.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "177683"
},
{
"name": "C#",
"bytes": "1130068"
},
{
"name": "C++",
"bytes": "568436"
},
{
"name": "CSS",
"bytes": "4189"
},
{
"name": "Clarion",
"bytes": "13073"
},
{
"name": "HTML",
"bytes": "9341"
},
{
"name": "Java",
"bytes": "1486176"
},
{
"name": "JavaScript",
"bytes": "117158"
},
{
"name": "Makefile",
"bytes": "1405"
},
{
"name": "Pascal",
"bytes": "627722"
},
{
"name": "QMake",
"bytes": "422"
},
{
"name": "Visual Basic",
"bytes": "150935"
}
],
"symlink_target": ""
} |
package com.example.mobliesafe.activity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import com.example.mobliesafe.R;
/**
* 高级工具
* @author 桂林
*
*/
public class AToolsActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_atools);
}
/**
* 归属地查询
* @param view
*/
public void numberAddressQuery(View view){
startActivity(new Intent(this,AddressActivity.class));
}
}
| {
"content_hash": "33261edf271dae1452aceeeedc8bce5a",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 56,
"avg_line_length": 18.875,
"alnum_prop": 0.7417218543046358,
"repo_name": "Adien-galen/MobileSafe",
"id": "ef08ca72134474476c2fb4a0d8d329fac3423e62",
"size": "626",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/com/example/mobliesafe/activity/AToolsActivity.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "62404"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
Rondeletia tenorioi Lorence
### Remarks
null | {
"content_hash": "ddcc956782e94d91c958bf42cab51eb3",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 12.076923076923077,
"alnum_prop": 0.7261146496815286,
"repo_name": "mdoering/backbone",
"id": "dbcd28bda0d2539b2203a90c3e9a8a2501f55373",
"size": "220",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Gentianales/Rubiaceae/Arachnothryx/Arachnothryx tenorioi/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
{-# OPTIONS_GHC -fdefer-type-errors #-} -- Very important to this bug!
{-# Language PartialTypeSignatures #-}
{-# Language KindSignatures #-}
{-# Language PolyKinds #-}
{-# Language ScopedTypeVariables #-}
{-# Language AllowAmbiguousTypes #-}
{-# Language TypeApplications #-}
module T14584a where
f :: forall m. ()
f = id @m :: _
g :: forall m. ()
g = let h = id @m
in h
| {
"content_hash": "ea625700c148828ab38c4b0e6273b555",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 74,
"avg_line_length": 23.9375,
"alnum_prop": 0.6344647519582245,
"repo_name": "sdiehl/ghc",
"id": "016295ac4f6438f1090834bae0e826d1ead38e95",
"size": "383",
"binary": false,
"copies": "13",
"ref": "refs/heads/master",
"path": "testsuite/tests/partial-sigs/should_fail/T14584a.hs",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Assembly",
"bytes": "7511"
},
{
"name": "C",
"bytes": "2582185"
},
{
"name": "C++",
"bytes": "35572"
},
{
"name": "CSS",
"bytes": "984"
},
{
"name": "DTrace",
"bytes": "3887"
},
{
"name": "Emacs Lisp",
"bytes": "734"
},
{
"name": "Gnuplot",
"bytes": "103851"
},
{
"name": "Groff",
"bytes": "3840"
},
{
"name": "HTML",
"bytes": "6144"
},
{
"name": "Haskell",
"bytes": "18105958"
},
{
"name": "Haxe",
"bytes": "218"
},
{
"name": "Logos",
"bytes": "121558"
},
{
"name": "Makefile",
"bytes": "500907"
},
{
"name": "Objective-C",
"bytes": "20001"
},
{
"name": "Objective-C++",
"bytes": "535"
},
{
"name": "Pascal",
"bytes": "115004"
},
{
"name": "Perl",
"bytes": "170515"
},
{
"name": "Perl6",
"bytes": "253813"
},
{
"name": "PostScript",
"bytes": "63"
},
{
"name": "Python",
"bytes": "100262"
},
{
"name": "Shell",
"bytes": "71877"
},
{
"name": "TeX",
"bytes": "667"
},
{
"name": "Yacc",
"bytes": "62238"
}
],
"symlink_target": ""
} |
package pmr.threes;
/** Runs demo of game using optimal move choices and monte-carlo simulation
* @author Peter Rimshnick
*
*/
public class Demo {
public static void main (String[] args){
doIter(args);
}
public static State doIter(String[] args){
int depth = (args.length==0?5:Integer.parseInt(args[0]));
int[][] board = {{0,1,3,3},{3,2,0,1},{2,0,0,1},{0,0,0,1}};
RegularHoleCard holeCard = new RegularHoleCard(2);
State state = new State(board, holeCard);
ThreesGame game = new ThreesGame(depth,.1,.9,0);
Choice currChoice = null;
int step = 0;
while(true) {
long start = System.currentTimeMillis();
currChoice = game.findBestMove(state);
if (currChoice.isEmptyChoice()) break;
state = new State(ThreesGame.pickState(currChoice.getMove().findEndStatesForSim()));
double time = (double)(System.currentTimeMillis()-start)/1000;
System.out.println("Step: " + step++);
System.out.println("Last Move: " + currChoice.getMove() + " ("+String.format("%4.2f", time)+" sec)");
System.out.println("Current board score: " + ThreesGame.getBoardScore(state.getBoard()));
System.out.println("Current state: " + state);
}
System.out.println("Final state: " + state + "Score: " + ThreesGame.getBoardScore(state.getBoard()));
return state;
}
}
| {
"content_hash": "3004834898b71b80f0177c42bcab16f6",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 104,
"avg_line_length": 35.10526315789474,
"alnum_prop": 0.6551724137931034,
"repo_name": "PeteyPabPro/threes-engine",
"id": "ac8ecf1e65c28e785be6d91731a754ddd99ea18b",
"size": "1429",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/pmr/threes/Demo.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "46566"
}
],
"symlink_target": ""
} |
import Ractive from 'lib/ractive';
import emitter from 'lib/emitter';
import _ from 'lodash';
import Clipboard from 'clipboard';
import template from './index.ract';
export default function(el) {
const ractive = new Ractive({
el,
template,
data: {
passphrase: '',
isCopied: false,
checked: false,
termsChecked: false,
IS_CLIPBOARD_SUPPORTED: Clipboard.isSupported(),
},
});
ractive.on('before-show', (context) => {
ractive.set('passphrase', context.passphrase);
ractive.set('checked', context.checked);
ractive.set('termsChecked', context.termsChecked);
});
if (ractive.get('IS_CLIPBOARD_SUPPORTED')) {
const clipboard = new Clipboard(ractive.find('.js-passphrase'));
clipboard.on('success', () => {
if (ractive.get('isCopied')) return;
ractive.set('isCopied', true);
setTimeout(() => {
ractive.set('isCopied', false);
}, 1000);
});
}
ractive.on('toggle-check', () => {
ractive.set('checked', !ractive.get('checked'));
});
ractive.on('toggle-terms-check', () => {
ractive.set('termsChecked', !ractive.get('termsChecked'));
});
ractive.on('confirm', () => {
const randomIndexes = _.shuffle(_.range(12));
const passphrase = ractive.get('passphrase');
ractive.set('passphrase', '');
emitter.emit('change-auth-step', 'createPassphraseConfirm', {
randomIndexes,
passphrase,
});
});
ractive.on('back', () => {
emitter.emit('change-auth-step', 'create');
});
return ractive;
}
| {
"content_hash": "c72c929743a71fadf430be68cbe33726",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 68,
"avg_line_length": 25.491803278688526,
"alnum_prop": 0.6102893890675242,
"repo_name": "CoinSpace/CoinSpace",
"id": "fc29f22bdbd6d5237430de5d47cdbb3ed88513da",
"size": "1555",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/pages/auth/create-passphrase/index.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Dockerfile",
"bytes": "358"
},
{
"name": "EJS",
"bytes": "21762"
},
{
"name": "JavaScript",
"bytes": "414106"
},
{
"name": "SCSS",
"bytes": "71804"
},
{
"name": "Shell",
"bytes": "964"
}
],
"symlink_target": ""
} |
<?php
/**
* Compilation process model
*
* @category Mage
* @package Mage_Compiler
* @author Magento Core Team <[email protected]>
*/
class Mage_Compiler_Model_Process
{
protected $_compileDir = null;
protected $_includeDir = null;
protected $_statDir = null;
protected $_compileConfig = null;
protected $_includePaths = array();
protected $_processedClasses= array();
protected $_controllerFolders = array();
public function __construct($options=array())
{
if (isset($options['compile_dir'])) {
$this->_compileDir = $options['compile_dir'];
} else {
$this->_compileDir = Mage::getBaseDir() . DS . 'includes';
}
$this->_includeDir = $this->_compileDir . DS . 'src';
$this->_statDir = $this->_compileDir . DS . 'stat';
}
/**
* Get compilation config
*
* @return Mage_Core_Model_Config_Base
*/
public function getCompileConfig()
{
if ($this->_compileConfig === null) {
$this->_compileConfig = Mage::getConfig()->loadModulesConfiguration('compilation.xml');
}
return $this->_compileConfig;
}
/**
* Get allowed include paths
*
* @return array
*/
protected function _getIncludePaths()
{
if (empty($this->_includePaths)) {
$originalPath = Mage::registry('original_include_path');
/**
* Exclude current dirrectory include path
*/
if ($originalPath == '.') {
$path = get_include_path();
} else {
$path = str_replace($originalPath, '', get_include_path());
}
$this->_includePaths = explode(PS, $path);
foreach ($this->_includePaths as $index => $path) {
if (empty($path) || $path == '.') {
unset($this->_includePaths[$index]);
}
}
}
return $this->_includePaths;
}
/**
* Copy directory
*
* @param string $source
* @param string $target
* @return Mage_Compiler_Model_Process
*/
protected function _copy($source, $target, $firstIteration = true)
{
if (is_dir($source)) {
$dir = dir($source);
while (false !== ($file = $dir->read())) {
if (($file[0] == '.')) {
continue;
}
$sourceFile = $source . DS . $file;
if ($file == 'controllers') {
$this->_controllerFolders[] = $sourceFile;
continue;
}
if ($firstIteration) {
$targetFile = $target . DS . $file;
} else {
$targetFile = $target . '_' . $file;
}
$this->_copy($sourceFile, $targetFile, false);
}
} else {
if (strpos(str_replace($this->_includeDir, '', $target), '-')
|| !in_array(substr($source, strlen($source)-4, 4), array('.php'))) {
return $this;
}
copy($source, $target);
}
return $this;
}
/**
* Copy Zend Locale data to compilation folter
*
* @param string $destDir
* @return Mage_Compiler_Model_Process
*/
protected function _copyZendLocaleData($destDir)
{
$source = Mage::getBaseDir('lib').DS.'Zend'.DS.'Locale'.DS.'Data';
$dir = dir($source);
while (false !== ($file = $dir->read())) {
if (($file[0] == '.')) {
continue;
}
$sourceFile = $source . DS . $file;
$targetFile = $destDir . DS . $file;
copy($sourceFile, $targetFile);
}
return $this;
}
/**
* Copy controllers with folders structure
*
* @param string $basePath base include path where files are located
* @return Mage_Compiler_Model_Process
*/
protected function _copyControllers($basePath)
{
foreach ($this->_controllerFolders as $path) {
$relPath = str_replace($basePath, '', $path);
$relPath = trim($relPath, DS);
$arrDirs = explode(DS, $relPath);
$destPath = $this->_includeDir;
foreach ($arrDirs as $dir) {
$destPath.= DS.$dir;
$this->_mkdir($destPath);
}
$this->_copyAll($path, $destPath);
}
return $this;
}
/**
* Copy all files and subfolders
*
* @param string $source
* @param string $target
* @return Mage_Compiler_Model_Process
*/
protected function _copyAll($source, $target)
{
if (is_dir($source)) {
$this->_mkdir($target);
$dir = dir($source);
while (false !== ($file = $dir->read())) {
if (($file[0] == '.')) {
continue;
}
$sourceFile = $source . DS . $file;
$targetFile = $target . DS . $file;
$this->_copyAll($sourceFile, $targetFile);
}
} else {
if (!in_array(substr($source, strlen($source)-4, 4), array('.php'))) {
return $this;
}
copy($source, $target);
}
return $this;
}
/**
* Create directory if not exist
*
* @param string $dir
* @return string
*/
protected function _mkdir($dir)
{
if (!is_dir($dir)) {
mkdir($dir);
@chmod($dir, 0777);
}
return $dir;
}
/**
* Copy files from all include directories to one.
* Lib files and controllers files will be copied as is
*
* @return Mage_Compiler_Model_Process
*/
protected function _collectFiles()
{
$paths = $this->_getIncludePaths();
$paths = array_reverse($paths);
$destDir= $this->_includeDir;
$libDir = Mage::getBaseDir('lib');
$this->_mkdir($destDir);
foreach ($paths as $path) {
$this->_controllerFolders = array();
$this->_copy($path, $destDir);
$this->_copyControllers($path);
if ($path == $libDir) {
$this->_copyAll($libDir, $destDir);
}
}
$destDir.= DS.'Data';
$this->_mkdir($destDir);
$this->_copyZendLocaleData($destDir);
return $this;
}
public function getCollectedFilesCount()
{
return count(glob($this->_includeDir.DS.'*'));
}
public function getCompiledFilesCount()
{
return count(glob($this->_includeDir.DS.Varien_Autoload::SCOPE_FILE_PREFIX.'*'));
}
public function getCompileClassList()
{
$arrFiles = array();
$statDir = $this->_statDir;
$statFiles= array();
if (is_dir($statDir)) {
$dir = dir($statDir);
while (false !== ($file = $dir->read())) {
if (($file[0] == '.')) {
continue;
}
$statFiles[str_replace('.csv', '', $file)] = $this->_statDir.DS.$file;
}
}
foreach ($this->getCompileConfig()->getNode('includes')->children() as $code => $config) {
$classes = $config->asArray();
if (is_array($classes)) {
$arrFiles[$code] = array_keys($classes);
} else {
$arrFiles[$code] = array();
}
$statClasses = array();
if (isset($statFiles[$code])) {
$statClasses = explode("\n", file_get_contents($statFiles[$code]));
$popularStatClasses = array();
foreach ($statClasses as $index => $classInfo) {
$classInfo = explode(':', $classInfo);
$popularStatClasses[$classInfo[1]][] = $classInfo[0];
}
ksort($popularStatClasses);
$statClasses = array_pop($popularStatClasses);
unset($statFiles[$code]);
}
$arrFiles[$code] = array_merge($arrFiles[$code], $statClasses);
$arrFiles[$code] = array_unique($arrFiles[$code]);
sort($arrFiles[$code]);
}
foreach($statFiles as $code => $file) {
$classes = explode("\n", file_get_contents($file));
$popularStatClasses = array();
foreach ($classes as $index => $classInfo) {
$classInfo = explode(':', $classInfo);
$popularStatClasses[$classInfo[1]][] = $classInfo[0];
}
ksort($popularStatClasses);
$arrFiles[$code] = array_pop($popularStatClasses);
}
foreach ($arrFiles as $scope=>$classes) {
if ($scope != 'default') {
foreach ($classes as $index => $class) {
if (in_array($class, $arrFiles['default'])) {
unset($arrFiles[$scope][$index]);
}
}
}
}
return $arrFiles;
}
/**
* Compile classes code to files
*
* @return Mage_Compiler_Model_Process
*/
protected function _compileFiles()
{
$classesInfo = $this->getCompileClassList();
foreach ($classesInfo as $code => $classes) {
$classesSorce = $this->_getClassesSourceCode($classes, $code);
file_put_contents($this->_includeDir.DS.Varien_Autoload::SCOPE_FILE_PREFIX.$code.'.php', $classesSorce);
}
return $this;
}
protected function _getClassesSourceCode($classes, $scope)
{
$sortedClasses = array();
foreach ($classes as $className) {
$implements = array_reverse(class_implements($className));
foreach ($implements as $class) {
if (!in_array($class, $sortedClasses) && !in_array($class, $this->_processedClasses) && strstr($class, '_')) {
$sortedClasses[] = $class;
if ($scope == 'default') {
$this->_processedClasses[] = $class;
}
}
}
$extends = array_reverse(class_parents($className));
foreach ($extends as $class) {
if (!in_array($class, $sortedClasses) && !in_array($class, $this->_processedClasses) && strstr($class, '_')) {
$sortedClasses[] = $class;
if ($scope == 'default') {
$this->_processedClasses[] = $class;
}
}
}
if (!in_array($className, $sortedClasses) && !in_array($className, $this->_processedClasses)) {
$sortedClasses[] = $className;
if ($scope == 'default') {
$this->_processedClasses[] = $className;
}
}
}
$classesSource = "<?php\n";
foreach ($sortedClasses as $className) {
$file = $this->_includeDir.DS.$className.'.php';
if (!file_exists($file)) {
continue;
}
$content = file_get_contents($file);
$content = ltrim($content, '<?php');
$content = rtrim($content, "\n\r\t?>");
$classesSource.= $content;
}
return $classesSource;
}
public function clear()
{
$this->registerIncludePath(false);
if (is_dir($this->_includeDir)) {
mageDelTree($this->_includeDir);
}
return $this;
}
/**
* Run compilation process
*
* @return Mage_Compiler_Model_Process
*/
public function run()
{
$this->_collectFiles();
$this->_compileFiles();
$this->registerIncludePath();
return $this;
}
/**
* Enable or disable include path constant definition in compiler config.php
*
* @param bool $flag
* @return Mage_Compiler_Model_Process
*/
public function registerIncludePath($flag = true)
{
$file = $this->_compileDir.DS.'config.php';
if (is_writeable($file)) {
$content = file_get_contents($file);
$content = explode("\n", $content);
foreach ($content as $index => $line) {
if (strpos($line, 'COMPILER_INCLUDE_PATH')) {
if ($flag) {
$content[$index] = ltrim($line, '#');
} else {
$content[$index] = '#'.$line;
}
}
}
file_put_contents($file, implode("\n", $content));
}
return $this;
}
/**
* Validate if compilation process is allowed
*
* @return array
*/
public function validate()
{
$result = array();
if (!is_writeable($this->_compileDir)) {
$result[] = Mage::helper('compiler')->__('Directory "%s" must be writeable', $this->_compileDir);
}
$file = $this->_compileDir.DS.'config.php';
if (!is_writeable($file)) {
$result[] = Mage::helper('compiler')->__('File "%s" must be writeable', $file);
}
return $result;
}
}
| {
"content_hash": "a7f9c172ae6342ad10c7db03edb3f395",
"timestamp": "",
"source": "github",
"line_count": 428,
"max_line_length": 126,
"avg_line_length": 31.41822429906542,
"alnum_prop": 0.4739347066260132,
"repo_name": "rajanlamic/urbanart",
"id": "bd40e40457384b7815d7bc19e53e8ccfe1ac0607",
"size": "14404",
"binary": false,
"copies": "10",
"ref": "refs/heads/master",
"path": "files/homedir/public_html/OTTOSCHADE.NET/artist/app/code/core/Mage/Compiler/Model/Process.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ApacheConf",
"bytes": "7465"
},
{
"name": "CSS",
"bytes": "2252771"
},
{
"name": "HTML",
"bytes": "5787517"
},
{
"name": "JavaScript",
"bytes": "1303367"
},
{
"name": "PHP",
"bytes": "44027761"
},
{
"name": "Perl",
"bytes": "3645"
},
{
"name": "Ruby",
"bytes": "5344"
},
{
"name": "Shell",
"bytes": "25851"
}
],
"symlink_target": ""
} |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:id="@+id/city"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="type a city here..." />
<Button
android:id="@+id/search"
android:text="search"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<EditText
android:id="@+id/refresh_rate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="type refresh rate per this second..." />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<CheckBox
android:id="@+id/on_toast_debug"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:text="turn on Toast debug"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<!-- <ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<TextView
android:id="@+id/weather_info"
android:layout_width="match_parent"
android:layout_height="match_parent" /> -->
<ListView
android:id="@+id/weather_info"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<!-- </ScrollView> -->
</LinearLayout>
| {
"content_hash": "7b79ec30996b85ce0d8c561ae4902b5e",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 72,
"avg_line_length": 33.85,
"alnum_prop": 0.6021664204825209,
"repo_name": "lizhang5208/weatherforecast",
"id": "d34779d8a91c9ec9b6c20cc21c659ba3ed1705e4",
"size": "2031",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "res/layout/activity_main.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "31642"
}
],
"symlink_target": ""
} |
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example - example-example93-production</title>
<link href="animations.css" rel="stylesheet" type="text/css">
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.0-beta.5/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.0-beta.5/angular-animate.js"></script>
<script src="script.js"></script>
</head>
<body ng-app="switchExample">
<div ng-controller="ExampleController">
<select ng-model="selection" ng-options="item for item in items">
</select>
<tt>selection={{selection}}</tt>
<hr/>
<div class="animate-switch-container"
ng-switch on="selection">
<div class="animate-switch" ng-switch-when="settings">Settings Div</div>
<div class="animate-switch" ng-switch-when="home">Home Span</div>
<div class="animate-switch" ng-switch-default>default</div>
</div>
</div>
</body>
</html> | {
"content_hash": "25e7a07a8b4372c9f215f951ddd2631d",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 99,
"avg_line_length": 31.633333333333333,
"alnum_prop": 0.6765015806111696,
"repo_name": "dolymood/angular-packages",
"id": "0663bb7213bc3d518ffff99af58f65d060878ff2",
"size": "949",
"binary": false,
"copies": "2",
"ref": "refs/heads/gh-pages",
"path": "angular-1.4.0-beta.6/docs/examples/example-example93/index-production.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1454701"
},
{
"name": "HTML",
"bytes": "82151465"
},
{
"name": "JavaScript",
"bytes": "15628922"
}
],
"symlink_target": ""
} |
from keras.datasets import mnist
import numpy as np
from PIL import Image
import math
import os
import keras.backend as K
K.set_image_data_format('channels_first')
print(K.image_data_format)
################################
# GAN 모델링
################################
from keras import models, layers, optimizers
class GAN(models.Sequential):
def __init__(self, input_dim=64):
"""
self, self.generator, self.discriminator are all models
"""
super().__init__()
self.input_dim = input_dim
self.generator = self.GENERATOR()
self.discriminator = self.DISCRIMINATOR()
self.add(self.generator)
self.discriminator.trainable = False
self.add(self.discriminator)
self.compile_all()
def compile_all(self):
# Compiling stage
d_optim = optimizers.SGD(lr=0.0005, momentum=0.9, nesterov=True)
g_optim = optimizers.SGD(lr=0.0005, momentum=0.9, nesterov=True)
self.generator.compile(loss='binary_crossentropy', optimizer="SGD")
self.compile(loss='binary_crossentropy', optimizer=g_optim)
self.discriminator.trainable = True
self.discriminator.compile(loss='binary_crossentropy', optimizer=d_optim)
def GENERATOR(self):
input_dim = self.input_dim
model = models.Sequential()
model.add(layers.Dense(1024, activation='tanh', input_dim=input_dim))
model.add(layers.Dense(128 * 7 * 7, activation='tanh'))
model.add(layers.BatchNormalization())
model.add(layers.Reshape((128, 7, 7), input_shape=(128 * 7 * 7,)))
model.add(layers.UpSampling2D(size=(2, 2)))
model.add(layers.Conv2D(64, (5, 5), padding='same', activation='tanh'))
model.add(layers.UpSampling2D(size=(2, 2)))
model.add(layers.Conv2D(1, (5, 5), padding='same', activation='tanh'))
return model
def DISCRIMINATOR(self):
model = models.Sequential()
model.add(layers.Conv2D(64, (5, 5), padding='same', activation='tanh',
input_shape=(1, 28, 28)))
model.add(layers.MaxPooling2D(pool_size=(2, 2)))
model.add(layers.Conv2D(128, (5, 5), activation='tanh'))
model.add(layers.MaxPooling2D(pool_size=(2, 2)))
model.add(layers.Flatten())
model.add(layers.Dense(1024, activation='tanh'))
model.add(layers.Dense(1, activation='sigmoid'))
return model
def train_both(self, x):
ln = x.shape[0]
# First trial for training discriminator
z = self.get_z(ln)
w = self.generator.predict_on_batch(z, verbose=0)
xw = np.concatenate((x, w))
y2 = [1] * ln + [0] * ln
d_loss = self.discriminator.train_on_batch(xw, y2)
# Second trial for training generator
z = self.get_z(ln)
self.discriminator.trainable = False
g_loss = self.train_on_batch(z, [1] * ln)
self.discriminator.trainable = True
return d_loss, g_loss
################################
# GAN 학습하기
################################
def combine_images(generated_images):
num = generated_images.shape[0]
width = int(math.sqrt(num))
height = int(math.ceil(float(num) / width))
shape = generated_images.shape[2:]
image = np.zeros((height * shape[0], width * shape[1]),
dtype=generated_images.dtype)
for index, img in enumerate(generated_images):
i = int(index / width)
j = index % width
image[i * shape[0]:(i + 1) * shape[0],
j * shape[1]:(j + 1) * shape[1]] = img[0, :, :]
return image
def get_x(X_train, index, BATCH_SIZE):
return X_train[index * BATCH_SIZE:(index + 1) * BATCH_SIZE]
def save_images(generated_images, output_fold, epoch, index):
# print(generated_images.shape)
image = combine_images(generated_images)
image = image * 127.5 + 127.5
Image.fromarray(image.astype(np.uint8)).save(
output_fold + '/' +
str(epoch) + "_" + str(index) + ".png")
def load_data():
(X_train, y_train), (_, _) = mnist.load_data()
return X_train[:10]
def train(args):
BATCH_SIZE = args.batch_size
epochs = args.epochs
output_fold = args.output_fold
input_dim = args.input_dim
os.makedirs(output_fold, exist_ok=True)
print('Output_fold is', output_fold)
X_train = load_data()
X_train = (X_train.astype(np.float32) - 127.5) / 127.5
X_train = X_train.reshape((X_train.shape[0], 1) + X_train.shape[1:])
gan = GAN(input_dim)
d_loss_ll = []
g_loss_ll = []
for epoch in range(epochs):
print("Epoch is", epoch)
print("Number of batches", int(X_train.shape[0] / BATCH_SIZE))
d_loss_l = []
g_loss_l = []
for index in range(int(X_train.shape[0] / BATCH_SIZE)):
x = get_x(X_train, index, BATCH_SIZE)
d_loss, g_loss = gan.train_both(x)
d_loss_l.append(d_loss)
g_loss_l.append(g_loss)
if epoch % 10 == 0 or epoch == epochs - 1:
z = gan.get_z(x.shape[0])
w = gan.generator.predict_on_batch(z, verbose=0)
save_images(w, output_fold, epoch, 0)
d_loss_ll.append(d_loss_l)
g_loss_ll.append(g_loss_l)
gan.generator.save_weights(output_fold + '/' + 'generator', True)
gan.discriminator.save_weights(output_fold + '/' + 'discriminator', True)
np.savetxt(output_fold + '/' + 'd_loss', d_loss_ll)
np.savetxt(output_fold + '/' + 'g_loss', g_loss_ll)
################################
# GAN 예제 실행하기
################################
def main():
class ARGS:
pass
args = ARGS()
args.batch_size = 2
args.epochs = 1000
args.output_fold = 'GAN_OUT'
args.input_dim = 10
train(args)
if __name__ == '__main__':
main() | {
"content_hash": "757857530b869c98e0362cf3376b30db",
"timestamp": "",
"source": "github",
"line_count": 187,
"max_line_length": 81,
"avg_line_length": 31.171122994652407,
"alnum_prop": 0.5735117515868932,
"repo_name": "jskDr/keraspp",
"id": "4d2a1012b32df35744475a71372e3e058798e5e2",
"size": "5953",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "old/gan_cnn.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Jupyter Notebook",
"bytes": "5048483"
},
{
"name": "Python",
"bytes": "169240"
}
],
"symlink_target": ""
} |
package com.sleepycat.je;
/**
* @hidden
* Feature not yet available.
*
* The interface for Consistency policies used to provide consistency
* guarantees at a Replica. A transaction initiated at a replica will wait in
* the Environment.beginTransaction method until the required consistency
* policy is satisfied.
*/
public interface ReplicaConsistencyPolicy {
}
| {
"content_hash": "962f0e71146d85fd1a4751ab30d41718",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 77,
"avg_line_length": 23.375,
"alnum_prop": 0.767379679144385,
"repo_name": "plast-lab/DelphJ",
"id": "5a58d08587cda092fccd94c4c1495e0984fe56f9",
"size": "574",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "examples/berkeleydb/com/sleepycat/je/ReplicaConsistencyPolicy.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "5320098"
},
{
"name": "Shell",
"bytes": "809"
}
],
"symlink_target": ""
} |
package berlin.reiche.securitas.controller;
import java.util.ArrayList;
import java.util.List;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.os.Message;
import berlin.reiche.securitas.controller.states.ControllerState;
import berlin.reiche.securitas.model.Model;
/**
* Generic controller for implementing the MVC like Android application
* architecture.
*
* @author Konrad Reiche
*
* @param <T>
* {@link Enum} type of the model state.
*/
public abstract class Controller<T extends Enum<T>> {
/**
* The model of this application.
*/
Model<T> model;
/**
* Inbox handler receives messages from the activity and its {@link Looper}
* processes the messages.
*/
final Handler inboxHandler;
/**
* Thread for the inbox handler that contains already a {@link Looper}.
*/
final HandlerThread inboxHandlerThread;
/**
* Number of outbox handlers used to notify different interfaces.
*/
final List<Handler> outboxHandlers;
/**
* The current state of the controller.
*/
protected ControllerState<T> state;
/**
* Default constructor which initializes the handlers and their threads.
*/
public Controller() {
inboxHandlerThread = new HandlerThread("Controller Inbox");
inboxHandlerThread.start();
inboxHandler = new InboxHandler(inboxHandlerThread.getLooper(), this);
outboxHandlers = new ArrayList<Handler>();
}
/**
* Adds a new handler for receiving model state changes.
*
* @param handler
* a handler to process messages.
*/
public final void addOutboxHandler(Handler handler) {
outboxHandlers.add(handler);
}
/**
* Asks the inbox handler thread to shutdown gracefully.
*/
public final void dispose() {
inboxHandlerThread.getLooper().quit();
}
/**
* @return the inbox handler.
*/
public Handler getInboxHandler() {
return inboxHandler;
}
/**
* @return the model associated with this controller
*/
public Model<T> getModel() {
return model;
}
/**
* Needs to be overridden by the specific controller in order to react to
* different messages.
*
* @param msg
* the message received.
*/
abstract void handleMessage(Message msg);
/**
* Notifies the handlers registered with the outbox.
*
* @param what
* what kind of notification, coded as integer value.
*/
public final void notifyOutboxHandlers(int what) {
notifyOutboxHandlers(what, 0, 0, null);
}
/**
* Iterates all handlers and sends the message to their respective target.
*
* @param what
* what kind of notification, coded as integer value.
* @param arg1
* additional parameter.
* @param arg2
* another additional parameter.
* @param obj
* yet another additional parameter, but storing more complex
* information.
*/
public final void notifyOutboxHandlers(int what, int arg1, int arg2,
Object obj) {
if (!outboxHandlers.isEmpty()) {
for (Handler handler : outboxHandlers) {
Message.obtain(handler, what, arg1, arg2, obj).sendToTarget();
}
}
}
/**
* Notifies the handlers registered with the outbox and passes an additional
* {@link Object} which stores information.
*
* @param what
* what kind of notification, coded as integer value.
* @param obj
* object storing additional information
*/
public final void notifyOutboxHandlers(int what, Object obj) {
notifyOutboxHandlers(what, 0, 0, obj);
}
/**
* Removes a handler which was added before so certain interfaces do not get
* updated anymore.
*
* @param handler
*/
public final void removeOutboxHandler(Handler handler) {
outboxHandlers.remove(handler);
}
/**
* Updates the controller to a new state in order to change the message
* processing.
*
* @param state
* the new controller's state.
*/
public void setState(ControllerState<T> state) {
this.state = state;
}
}
| {
"content_hash": "c899ec6d00b9aee7997b72779087d183",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 77,
"avg_line_length": 24.940119760479043,
"alnum_prop": 0.6528211284513805,
"repo_name": "platzhirsch/security-cam",
"id": "523432c8587f7cfb6c13429de47518d7891224fb",
"size": "4165",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "client/src/main/java/berlin/reiche/securitas/controller/Controller.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "83386"
},
{
"name": "Python",
"bytes": "14619"
}
],
"symlink_target": ""
} |
package com.marekdudek.orgstructure.basic;
public enum OrganizationStructureType3 {
SALES,
SERVICE;
}
| {
"content_hash": "44ceaaa8a6211aa22e3ca7d0ce618cbc",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 42,
"avg_line_length": 16,
"alnum_prop": 0.7589285714285714,
"repo_name": "MarekDudek/analysis-patterns",
"id": "d53e263e1c8a1c583979e8bdab9422cc4a0de412",
"size": "112",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "accountability/src/main/java/com/marekdudek/orgstructure/basic/OrganizationStructureType3.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "29435"
}
],
"symlink_target": ""
} |
/**
@file PhysicsDebug.h
Contiene la declaración del componente que controla la representación
gráfica de la parte física de la entidad
@see Logic::CPhysicsDebug
@see Logic::IComponent
@author Alberto Martínez
@date Febrero, 2015
*/
#ifndef __Logic_PhysicsDebug_H
#define __Logic_PhysicsDebug_H
#include "Logic/Entity/Component.h"
#include "Logic/Entity/Entity.h"
// Predeclaración de clases para ahorrar tiempo de compilación
namespace Graphics
{
class CManualEntity;
class CScene;
class CEntity;
}
//declaración de la clase
namespace Logic
{
class CPhysicsDebug : public IComponent , public CEntityTransformListener
{
DEC_FACTORY(CPhysicsDebug);
public:
/**
Constructor por defecto; inicializa los atributos a su valor por
defecto.
*/
CPhysicsDebug() : IComponent(), _PhysicsDebugEntity(0) ,_scale(Vector3(1,1,1)){}
/**
Destructor (virtual); Quita de la escena y destruye la entidad gráfica.
*/
virtual ~CPhysicsDebug();
/**
Inicialización del componente, utilizando la información extraída de
la entidad leída del mapa (Maps::CEntity).
@param entity Entidad a la que pertenece el componente.
@param map Mapa Lógico en el que se registrará el objeto.
@param entityInfo Información de construcción del objeto leído del
fichero de disco.
@return Cierto si la inicialización ha sido satisfactoria.
*/
virtual bool OnSpawn(const Map::CEntity *entityInfo);
/**
Metodo que sirve para setear el entityInfo y el map en donde sera respawneada. No pongo solo la posicion, sino mas bien
el entityInfo entero, porque puede ocurrir que queramos setear por ejemplo, la vida que tenga un enemigo, dado
que los enemigos se haran mas fuertes.
@param map Mapa Logic en el que se registrara la entidad
@param entity Informacion de construccion de la entidad leida del fichero
@return Cierto si el respawn ha sido satisfatorio
**/
virtual bool respawn(const Map::CEntity *entity);
/**
Método virtual que elige que mensajes son aceptados. Son válidos
SET_TRANSFORM.
@param message Mensaje a chequear.
@return true si el mensaje es aceptado.
*/
virtual bool accept(const std::shared_ptr<Logic::IMessage> &message);
/**
Método virtual que procesa un mensaje.
@param message Mensaje a procesar.
*/
virtual void process(const std::shared_ptr<Logic::IMessage> &message);
/**
Método que activa el componente; invocado cuando se activa
el mapa donde está la entidad a la que pertenece el componente.
<p>
La implementación registrará al componente en algunos observers en
los que pueda necesitar estar registrado (como el cronómetro del
sistema, etc.).
@return true si todo ha ido correctamente.
*/
virtual bool activate();
/**
Método que desactiva el componente; invocado cuando se
desactiva el mapa donde está la entidad a la que pertenece el
componente. Se invocará siempre, independientemente de si estamos
activados o no.
<p>
La implementación eliminará al componente de algunos observers en los
que pueda estar registrado (como el cronómetro del sistema, etc.).m
*/
virtual void deactivate();
///Método de escucha de la posicion de la entidad
void OnEntitySetTransform(const Matrix4 &transform);
protected:
void setTransform();
void setTransform(Matrix4 trans);
/**
Atributo con el nombre del modelo gráfico de la entidad.
*/
std::string _model;
/**
Entidad gráfica del objeto manual.
*/
Graphics::CManualEntity *_PhysicsDebugEntity;
/*
Entidad Gráfica
*/
Graphics::CEntity* _graphicsEntity;
/**
Escena gráfica donde se encontrarán las representaciones gráficas de
las entidades. La guardamos para la destrucción de la entidad gráfica.
*/
Graphics::CScene* _scene;
/**
Material usado en la entidad
*/
std::string _material;
/**
Dimensiones de escala del objeto
*/
Vector3 _scale;
/*
offset del centro físico
*/
Vector3 _offset;
/*
Flag que nos indica que es un objeto manual
*/
bool _isManual;
}; // class CPhysicsDebug
REG_FACTORY(CPhysicsDebug);
} // namespace Logic
#endif // __Logic_PhysicsDebug_H
| {
"content_hash": "1f761af9a97b6b34a66a49a39a103c26",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 121,
"avg_line_length": 24.94578313253012,
"alnum_prop": 0.7295339290026563,
"repo_name": "albmarvil/The-Eternal-Sorrow",
"id": "70a6a2091c6a95071f3d7974ffa682d8c59ccab4",
"size": "4141",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Src/Logic/Entity/Components/PhysicsDebug.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "16484"
},
{
"name": "C++",
"bytes": "1770913"
},
{
"name": "FLUX",
"bytes": "10330"
},
{
"name": "GLSL",
"bytes": "10431"
},
{
"name": "HTML",
"bytes": "10181"
},
{
"name": "Lua",
"bytes": "600542"
}
],
"symlink_target": ""
} |
from glad.loader import BaseLoader
from glad.loader.volt import LOAD_OPENGL_DLL
_GLX_LOADER = \
LOAD_OPENGL_DLL % {'pre':'private', 'init':'open_gl',
'proc':'get_proc', 'terminate':'close_gl'} + '''
bool gladLoadGLX() {
StructToDg structToDg;
structToDg.func = cast(void*)get_proc;
auto dg = *cast(Loader*)&structToDg;
bool status = false;
if(open_gl()) {
status = gladLoadGLX(dg);
close_gl();
}
return status;
}
'''
_GLX_HAS_EXT = '''
private bool has_ext(const(char)* name) {
return true;
}
'''
class GLXVoltLoader(BaseLoader):
def write(self, fobj, apis):
fobj.write('import watt.library;\n')
if not self.disabled:
fobj.write(_GLX_LOADER)
def write_begin_load(self, fobj):
pass
def write_end_load(self, fobj):
fobj.write('\treturn true;\n')
def write_find_core(self, fobj):
pass
def write_has_ext(self, fobj):
fobj.write(_GLX_HAS_EXT) | {
"content_hash": "e6d78b6817c41fa922f5484dc6156905",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 71,
"avg_line_length": 22.75,
"alnum_prop": 0.5864135864135864,
"repo_name": "dbralir/glad",
"id": "dbdeeaeb5821ed22f1c3591f92489b3c5508be50",
"size": "1001",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "glad/loader/glx/volt.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "1659"
},
{
"name": "C++",
"bytes": "2445"
},
{
"name": "Python",
"bytes": "88697"
},
{
"name": "Shell",
"bytes": "3321"
}
],
"symlink_target": ""
} |
/*
Configuring local strategy to authenticate strategies
Code modified from : https://github.com/madhums/node-express-mongoose-demo/blob/master/config/passport/local.js
*/
import passport from 'passport';
import { Strategy as LocalStrategy } from 'passport-local';
import { passport as dbPassport } from '../../db';
import unsupportedMessage from '../../db/unsupportedMessage';
export default () => {
if (!dbPassport || !dbPassport.local || typeof dbPassport.local !== 'function') {
console.warn(unsupportedMessage('passport-local'));
return;
}
/*
By default, LocalStrategy expects to find credentials in parameters named username and password.
If your site prefers to name these fields differently,
options are available to change the defaults.
*/
passport.use(new LocalStrategy({
usernameField: 'email'
}, dbPassport.local));
};
| {
"content_hash": "28bcdd6131b228f3e877a705dd28c2e6",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 112,
"avg_line_length": 36.083333333333336,
"alnum_prop": 0.73094688221709,
"repo_name": "reactGo/reactGo",
"id": "be399eb359caf7c3bdd509d62c8af5712e8a3041",
"size": "866",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "server_mongo/init/passport/local.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "55258"
},
{
"name": "TypeScript",
"bytes": "308062"
}
],
"symlink_target": ""
} |
from reports import *
from plotting import plot_measures, plot_mosaic, plot_all, plot_fd
| {
"content_hash": "0d9618730a5b355228dc47464c6a6b41",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 66,
"avg_line_length": 44.5,
"alnum_prop": 0.7865168539325843,
"repo_name": "wangkangcheng/ccc",
"id": "c874f8ab80a76e844b31c7c4a375d1e6f0796499",
"size": "226",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "qap/viz/__init__.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "HTML",
"bytes": "15218"
},
{
"name": "Python",
"bytes": "250306"
},
{
"name": "R",
"bytes": "7072"
},
{
"name": "Ruby",
"bytes": "1699"
},
{
"name": "Shell",
"bytes": "4639"
}
],
"symlink_target": ""
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-GB" xml:lang="en-GB" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>POS tags</title>
<link rel="root" href=""/> <!-- for JS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="../../css/jquery-ui-redmond.css"/>
<link rel="stylesheet" type="text/css" href="../../css/style.css"/>
<link rel="stylesheet" type="text/css" href="../../css/style-vis.css"/>
<link rel="stylesheet" type="text/css" href="../../css/hint.css"/>
<script type="text/javascript" src="../../lib/ext/head.load.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/3.2.2/anchor.min.js"></script>
<script>document.addEventListener("DOMContentLoaded", function(event) {anchors.add();});</script>
<!-- Set up this custom Google search at https://cse.google.com/cse/business/settings?cx=001145188882102106025:dl1mehhcgbo -->
<!-- DZ 2021-01-22: I am temporarily hiding the search field to find out whether it slows down loading of the title page.
<script>
(function() {
var cx = '001145188882102106025:dl1mehhcgbo';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script> -->
<!-- <link rel="shortcut icon" href="favicon.ico"/> -->
</head>
<body>
<div id="main" class="center">
<div id="hp-header">
<table width="100%"><tr><td width="50%">
<span class="header-text"><a href="http://universaldependencies.org/#language-ca">home</a></span>
<span class="header-text"><a href="https://github.com/universaldependencies/docs/issues">issue tracker</a></span>
</td><td>
<gcse:search></gcse:search>
</td></tr></table>
</div>
<hr/>
<div class="v1warning">
This page still pertains to UD version 1.
</div>
<div id="content">
<noscript>
<div id="noscript">
It appears that you have Javascript disabled.
Please consider enabling Javascript for this page to see the visualizations.
</div>
</noscript>
<!-- The content may include scripts and styles, hence we must load the shared libraries before the content. -->
<script type="text/javascript">
console.time('loading libraries');
var root = '../../'; // filled in by jekyll
head.js(
// External libraries
// DZ: Copied from embedding.html. I don't know which one is needed for what, so I'm currently keeping them all.
root + 'lib/ext/jquery.min.js',
root + 'lib/ext/jquery.svg.min.js',
root + 'lib/ext/jquery.svgdom.min.js',
root + 'lib/ext/jquery.timeago.js',
root + 'lib/ext/jquery-ui.min.js',
root + 'lib/ext/waypoints.min.js',
root + 'lib/ext/jquery.address.min.js'
);
</script>
<h1 id="pos-tags">POS tags</h1>
<table class="typeindex">
<thead>
<tr>
<th>Open class words</th>
<th>Closed class words</th>
<th>Other</th>
</tr>
</thead>
<tbody>
<tr>
<td><a>ADJ</a></td>
<td><a>ADP</a></td>
<td><a>PUNCT</a></td>
</tr>
<tr>
<td><a>ADV</a></td>
<td><a>AUX</a></td>
<td><a>SYM</a></td>
</tr>
<tr>
<td><a>INTJ</a></td>
<td><a>CCONJ</a></td>
<td><a>X</a></td>
</tr>
<tr>
<td><a>NOUN</a></td>
<td><a>DET</a></td>
<td> </td>
</tr>
<tr>
<td><a>PROPN</a></td>
<td><a>NUM</a></td>
<td> </td>
</tr>
<tr>
<td><a>VERB</a></td>
<td><a>PART</a></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><a>PRON</a></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><a>SCONJ</a></td>
<td> </td>
</tr>
</tbody>
</table>
</div>
<!-- support for embedded visualizations -->
<script type="text/javascript">
var root = '../../'; // filled in by jekyll
head.js(
// We assume that external libraries such as jquery.min.js have already been loaded outside!
// (See _layouts/base.html.)
// brat helper modules
root + 'lib/brat/configuration.js',
root + 'lib/brat/util.js',
root + 'lib/brat/annotation_log.js',
root + 'lib/ext/webfont.js',
// brat modules
root + 'lib/brat/dispatcher.js',
root + 'lib/brat/url_monitor.js',
root + 'lib/brat/visualizer.js',
// embedding configuration
root + 'lib/local/config.js',
// project-specific collection data
root + 'lib/local/collections.js',
// Annodoc
root + 'lib/annodoc/annodoc.js',
// NOTE: non-local libraries
'https://spyysalo.github.io/conllu.js/conllu.js'
);
var webFontURLs = [
// root + 'static/fonts/Astloch-Bold.ttf',
root + 'static/fonts/PT_Sans-Caption-Web-Regular.ttf',
root + 'static/fonts/Liberation_Sans-Regular.ttf'
];
var setupTimeago = function() {
jQuery("time.timeago").timeago();
};
head.ready(function() {
setupTimeago();
// mark current collection (filled in by Jekyll)
Collections.listing['_current'] = 'ca';
// perform all embedding and support functions
Annodoc.activate(Config.bratCollData, Collections.listing);
});
</script>
<!-- google analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-55233688-1', 'auto');
ga('send', 'pageview');
</script>
<div id="footer">
<p class="footer-text">© 2014–2021
<a href="http://universaldependencies.org/introduction.html#contributors" style="color:gray">Universal Dependencies contributors</a>.
Site powered by <a href="http://spyysalo.github.io/annodoc" style="color:gray">Annodoc</a> and <a href="http://brat.nlplab.org/" style="color:gray">brat</a></p>.
</div>
</div>
</body>
</html>
| {
"content_hash": "8c80ff03ded8dd9fd545d30f30c6efce",
"timestamp": "",
"source": "github",
"line_count": 207,
"max_line_length": 173,
"avg_line_length": 32.92270531400966,
"alnum_prop": 0.5630227439471753,
"repo_name": "UniversalDependencies/universaldependencies.github.io",
"id": "5026c8cafee10cd83984de5c5fad2820fb2a85e6",
"size": "6817",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ca/pos/index.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "64420"
},
{
"name": "HTML",
"bytes": "383191916"
},
{
"name": "JavaScript",
"bytes": "687350"
},
{
"name": "Perl",
"bytes": "7788"
},
{
"name": "Python",
"bytes": "21203"
},
{
"name": "Shell",
"bytes": "7253"
}
],
"symlink_target": ""
} |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by CSGenerator.
// </auto-generated>
//------------------------------------------------------------------------------
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using jsval = JSApi.jsval;
public class JSB_UnityEngine_LocationInfo
{
////////////////////// LocationInfo ///////////////////////////////////////
// constructors
public static ConstructorID constructorID0 = new ConstructorID(null, null);
static bool LocationInfo_LocationInfo1(JSVCall vc, int argc)
{
int _this = JSApi.getObject((int)JSApi.GetType.Arg);
JSApi.attachFinalizerObject(_this);
--argc;
int len = argc;
if (len == 0)
{
JSMgr.addJSCSRel(_this, new UnityEngine.LocationInfo());
}
return true;
}
// fields
// properties
static void LocationInfo_latitude(JSVCall vc)
{
UnityEngine.LocationInfo _this = (UnityEngine.LocationInfo)vc.csObj;
var result = _this.latitude;
JSApi.setSingle((int)JSApi.SetType.Rval, (System.Single)(result));
}
static void LocationInfo_longitude(JSVCall vc)
{
UnityEngine.LocationInfo _this = (UnityEngine.LocationInfo)vc.csObj;
var result = _this.longitude;
JSApi.setSingle((int)JSApi.SetType.Rval, (System.Single)(result));
}
static void LocationInfo_altitude(JSVCall vc)
{
UnityEngine.LocationInfo _this = (UnityEngine.LocationInfo)vc.csObj;
var result = _this.altitude;
JSApi.setSingle((int)JSApi.SetType.Rval, (System.Single)(result));
}
static void LocationInfo_horizontalAccuracy(JSVCall vc)
{
UnityEngine.LocationInfo _this = (UnityEngine.LocationInfo)vc.csObj;
var result = _this.horizontalAccuracy;
JSApi.setSingle((int)JSApi.SetType.Rval, (System.Single)(result));
}
static void LocationInfo_verticalAccuracy(JSVCall vc)
{
UnityEngine.LocationInfo _this = (UnityEngine.LocationInfo)vc.csObj;
var result = _this.verticalAccuracy;
JSApi.setSingle((int)JSApi.SetType.Rval, (System.Single)(result));
}
static void LocationInfo_timestamp(JSVCall vc)
{
UnityEngine.LocationInfo _this = (UnityEngine.LocationInfo)vc.csObj;
var result = _this.timestamp;
JSApi.setDouble((int)JSApi.SetType.Rval, (System.Double)(result));
}
// methods
//register
public static void __Register()
{
JSMgr.CallbackInfo ci = new JSMgr.CallbackInfo();
ci.type = typeof(UnityEngine.LocationInfo);
ci.fields = new JSMgr.CSCallbackField[]
{
};
ci.properties = new JSMgr.CSCallbackProperty[]
{
LocationInfo_latitude,
LocationInfo_longitude,
LocationInfo_altitude,
LocationInfo_horizontalAccuracy,
LocationInfo_verticalAccuracy,
LocationInfo_timestamp,
};
ci.constructors = new JSMgr.MethodCallBackInfo[]
{
new JSMgr.MethodCallBackInfo(LocationInfo_LocationInfo1, ".ctor"),
};
ci.methods = new JSMgr.MethodCallBackInfo[]
{
};
JSMgr.allCallbackInfo.Add(ci);
}
}
| {
"content_hash": "a89b14669e50b7568bcb09afebc1073c",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 82,
"avg_line_length": 28.327433628318584,
"alnum_prop": 0.6366760387378944,
"repo_name": "linkabox/PureJSB",
"id": "c1744715197f8ce960af7f50f23ab191c951f592",
"size": "3203",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Assets/Standard Assets/JSBinding/Generated/JSB_UnityEngine_LocationInfo.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "305"
},
{
"name": "C#",
"bytes": "4011839"
},
{
"name": "Shell",
"bytes": "289"
}
],
"symlink_target": ""
} |
package org.apache.ode.bpel.rtrep.v2.channels;
import org.apache.ode.jacob.ap.ChannelType;
/**
* Response channel for pick requests.
*/
@ChannelType
public interface InvokeResponse {
public void onResponse();
void onFault();
void onFailure();
}
| {
"content_hash": "674f864f2b918923dae982a577a6b11c",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 46,
"avg_line_length": 14.555555555555555,
"alnum_prop": 0.7175572519083969,
"repo_name": "aaronanderson/ode",
"id": "9485ecf697611014737105e988377f8f1724c627",
"size": "1070",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/channels/InvokeResponse.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "5800448"
},
{
"name": "JavaScript",
"bytes": "249824"
},
{
"name": "Ruby",
"bytes": "18198"
},
{
"name": "Shell",
"bytes": "377"
}
],
"symlink_target": ""
} |
from utils import TreeNode, construct
class Solution:
def maxDepth(self, root: TreeNode) -> int:
if root is None:
return 0
root.level = 1
queue = [root]
i, last = 0, 0
while i <= last:
node = queue[i]
if node.left:
node.left.level = node.level + 1
queue.append(node.left)
last += 1
if node.right:
node.right.level = node.level + 1
queue.append(node.right)
last += 1
i += 1
return queue[-1].level
if __name__ == "__main__":
sol = Solution()
root = construct([3, 9, 20, None, None, 15, 7])
print(sol.maxDepth(root))
root = construct([3, None, 20])
print(sol.maxDepth(root))
root = construct([])
print(sol.maxDepth(root))
| {
"content_hash": "7bbb75c4b19f5c893b655afe8be47b92",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 51,
"avg_line_length": 26.84375,
"alnum_prop": 0.48661233993015135,
"repo_name": "shenfei/oj_codes",
"id": "4de83bd5990e7e7d4463fb546c03386c03a415af",
"size": "1021",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "leetcode/python/n104_Maximum_Depth_of_Binary_Tree.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "14397"
},
{
"name": "Python",
"bytes": "154341"
}
],
"symlink_target": ""
} |
/**
* \file ast_to_hir.c
* Convert abstract syntax to to high-level intermediate reprensentation (HIR).
*
* During the conversion to HIR, the majority of the symantic checking is
* preformed on the program. This includes:
*
* * Symbol table management
* * Type checking
* * Function binding
*
* The majority of this work could be done during parsing, and the parser could
* probably generate HIR directly. However, this results in frequent changes
* to the parser code. Since we do not assume that every system this complier
* is built on will have Flex and Bison installed, we have to store the code
* generated by these tools in our version control system. In other parts of
* the system we've seen problems where a parser was changed but the generated
* code was not committed, merge conflicts where created because two developers
* had slightly different versions of Bison installed, etc.
*
* I have also noticed that running Bison generated parsers in GDB is very
* irritating. When you get a segfault on '$$ = $1->foo', you can't very
* well 'print $1' in GDB.
*
* As a result, my preference is to put as little C code as possible in the
* parser (and lexer) sources.
*/
#include "glsl_symbol_table.h"
#include "glsl_parser_extras.h"
#include "ast.h"
#include "glsl_types.h"
#include "program/hash_table.h"
#include "ir.h"
#include "ir_builder.h"
using namespace ir_builder;
static void
detect_conflicting_assignments(struct _mesa_glsl_parse_state *state,
exec_list *instructions);
static void
remove_per_vertex_blocks(exec_list *instructions,
_mesa_glsl_parse_state *state, ir_variable_mode mode);
void
_mesa_ast_to_hir(exec_list *instructions, struct _mesa_glsl_parse_state *state)
{
_mesa_glsl_initialize_variables(instructions, state);
state->symbols->separate_function_namespace = state->language_version == 110;
state->current_function = NULL;
state->toplevel_ir = instructions;
state->gs_input_prim_type_specified = false;
state->cs_input_local_size_specified = false;
/* Section 4.2 of the GLSL 1.20 specification states:
* "The built-in functions are scoped in a scope outside the global scope
* users declare global variables in. That is, a shader's global scope,
* available for user-defined functions and global variables, is nested
* inside the scope containing the built-in functions."
*
* Since built-in functions like ftransform() access built-in variables,
* it follows that those must be in the outer scope as well.
*
* We push scope here to create this nesting effect...but don't pop.
* This way, a shader's globals are still in the symbol table for use
* by the linker.
*/
state->symbols->push_scope();
foreach_list_typed (ast_node, ast, link, & state->translation_unit)
ast->hir(instructions, state);
detect_recursion_unlinked(state, instructions);
detect_conflicting_assignments(state, instructions);
state->toplevel_ir = NULL;
/* Move all of the variable declarations to the front of the IR list, and
* reverse the order. This has the (intended!) side effect that vertex
* shader inputs and fragment shader outputs will appear in the IR in the
* same order that they appeared in the shader code. This results in the
* locations being assigned in the declared order. Many (arguably buggy)
* applications depend on this behavior, and it matches what nearly all
* other drivers do.
*
* However, do not push the declarations before struct decls or precision
* statements.
*/
ir_instruction* before_node = (ir_instruction*)instructions->head;
ir_instruction* after_node = NULL;
while (before_node && (before_node->ir_type == ir_type_precision || before_node->ir_type == ir_type_typedecl))
{
after_node = before_node;
before_node = (ir_instruction*)before_node->next;
}
foreach_in_list_safe(ir_instruction, node, instructions) {
ir_variable *const var = node->as_variable();
if (var == NULL)
continue;
var->remove();
if (after_node)
after_node->insert_after(var);
else
instructions->push_head(var);
}
/* Figure out if gl_FragCoord is actually used in fragment shader */
ir_variable *const var = state->symbols->get_variable("gl_FragCoord");
if (var != NULL)
state->fs_uses_gl_fragcoord = var->data.used;
/* From section 7.1 (Built-In Language Variables) of the GLSL 4.10 spec:
*
* If multiple shaders using members of a built-in block belonging to
* the same interface are linked together in the same program, they
* must all redeclare the built-in block in the same way, as described
* in section 4.3.7 "Interface Blocks" for interface block matching, or
* a link error will result.
*
* The phrase "using members of a built-in block" implies that if two
* shaders are linked together and one of them *does not use* any members
* of the built-in block, then that shader does not need to have a matching
* redeclaration of the built-in block.
*
* This appears to be a clarification to the behaviour established for
* gl_PerVertex by GLSL 1.50, therefore implement it regardless of GLSL
* version.
*
* The definition of "interface" in section 4.3.7 that applies here is as
* follows:
*
* The boundary between adjacent programmable pipeline stages: This
* spans all the outputs in all compilation units of the first stage
* and all the inputs in all compilation units of the second stage.
*
* Therefore this rule applies to both inter- and intra-stage linking.
*
* The easiest way to implement this is to check whether the shader uses
* gl_PerVertex right after ast-to-ir conversion, and if it doesn't, simply
* remove all the relevant variable declaration from the IR, so that the
* linker won't see them and complain about mismatches.
*/
remove_per_vertex_blocks(instructions, state, ir_var_shader_in);
remove_per_vertex_blocks(instructions, state, ir_var_shader_out);
}
static ir_expression_operation
get_conversion_operation(const glsl_type *to, const glsl_type *from,
struct _mesa_glsl_parse_state *state)
{
switch (to->base_type) {
case GLSL_TYPE_FLOAT:
switch (from->base_type) {
case GLSL_TYPE_INT: return ir_unop_i2f;
case GLSL_TYPE_UINT: return ir_unop_u2f;
default: return (ir_expression_operation)0;
}
case GLSL_TYPE_UINT:
if (!state->is_version(400, 0) && !state->ARB_gpu_shader5_enable)
return (ir_expression_operation)0;
switch (from->base_type) {
case GLSL_TYPE_INT: return ir_unop_i2u;
default: return (ir_expression_operation)0;
}
default: return (ir_expression_operation)0;
}
}
/**
* If a conversion is available, convert one operand to a different type
*
* The \c from \c ir_rvalue is converted "in place".
*
* \param to Type that the operand it to be converted to
* \param from Operand that is being converted
* \param state GLSL compiler state
*
* \return
* If a conversion is possible (or unnecessary), \c true is returned.
* Otherwise \c false is returned.
*/
bool
apply_implicit_conversion(const glsl_type *to, ir_rvalue * &from,
struct _mesa_glsl_parse_state *state)
{
void *ctx = state;
if (to->base_type == from->type->base_type)
return true;
/* Prior to GLSL 1.20, there are no implicit conversions */
if (!state->is_version(120, 0))
return false;
/* From page 27 (page 33 of the PDF) of the GLSL 1.50 spec:
*
* "There are no implicit array or structure conversions. For
* example, an array of int cannot be implicitly converted to an
* array of float.
*/
if (!to->is_numeric() || !from->type->is_numeric())
return false;
/* We don't actually want the specific type `to`, we want a type
* with the same base type as `to`, but the same vector width as
* `from`.
*/
to = glsl_type::get_instance(to->base_type, from->type->vector_elements,
from->type->matrix_columns);
ir_expression_operation op = get_conversion_operation(to, from->type, state);
if (op) {
from = new(ctx) ir_expression(op, to, from, NULL);
return true;
} else {
return false;
}
}
static const struct glsl_type *
arithmetic_result_type(ir_rvalue * &value_a, ir_rvalue * &value_b,
bool multiply,
struct _mesa_glsl_parse_state *state, YYLTYPE *loc)
{
const glsl_type *type_a = value_a->type;
const glsl_type *type_b = value_b->type;
/* From GLSL 1.50 spec, page 56:
*
* "The arithmetic binary operators add (+), subtract (-),
* multiply (*), and divide (/) operate on integer and
* floating-point scalars, vectors, and matrices."
*/
if (!type_a->is_numeric() || !type_b->is_numeric()) {
_mesa_glsl_error(loc, state,
"operands to arithmetic operators must be numeric");
return glsl_type::error_type;
}
/* "If one operand is floating-point based and the other is
* not, then the conversions from Section 4.1.10 "Implicit
* Conversions" are applied to the non-floating-point-based operand."
*/
if (!apply_implicit_conversion(type_a, value_b, state)
&& !apply_implicit_conversion(type_b, value_a, state)) {
_mesa_glsl_error(loc, state,
"could not implicitly convert operands to "
"arithmetic operator");
return glsl_type::error_type;
}
type_a = value_a->type;
type_b = value_b->type;
/* "If the operands are integer types, they must both be signed or
* both be unsigned."
*
* From this rule and the preceeding conversion it can be inferred that
* both types must be GLSL_TYPE_FLOAT, or GLSL_TYPE_UINT, or GLSL_TYPE_INT.
* The is_numeric check above already filtered out the case where either
* type is not one of these, so now the base types need only be tested for
* equality.
*/
if (type_a->base_type != type_b->base_type) {
_mesa_glsl_error(loc, state,
"base type mismatch for arithmetic operator");
return glsl_type::error_type;
}
/* "All arithmetic binary operators result in the same fundamental type
* (signed integer, unsigned integer, or floating-point) as the
* operands they operate on, after operand type conversion. After
* conversion, the following cases are valid
*
* * The two operands are scalars. In this case the operation is
* applied, resulting in a scalar."
*/
if (type_a->is_scalar() && type_b->is_scalar())
return type_a;
/* "* One operand is a scalar, and the other is a vector or matrix.
* In this case, the scalar operation is applied independently to each
* component of the vector or matrix, resulting in the same size
* vector or matrix."
*/
if (type_a->is_scalar()) {
if (!type_b->is_scalar())
return type_b;
} else if (type_b->is_scalar()) {
return type_a;
}
/* All of the combinations of <scalar, scalar>, <vector, scalar>,
* <scalar, vector>, <scalar, matrix>, and <matrix, scalar> have been
* handled.
*/
assert(!type_a->is_scalar());
assert(!type_b->is_scalar());
/* "* The two operands are vectors of the same size. In this case, the
* operation is done component-wise resulting in the same size
* vector."
*/
if (type_a->is_vector() && type_b->is_vector()) {
if (type_a == type_b) {
return type_a;
} else {
_mesa_glsl_error(loc, state,
"vector size mismatch for arithmetic operator");
return glsl_type::error_type;
}
}
/* All of the combinations of <scalar, scalar>, <vector, scalar>,
* <scalar, vector>, <scalar, matrix>, <matrix, scalar>, and
* <vector, vector> have been handled. At least one of the operands must
* be matrix. Further, since there are no integer matrix types, the base
* type of both operands must be float.
*/
assert(type_a->is_matrix() || type_b->is_matrix());
assert(type_a->base_type == GLSL_TYPE_FLOAT);
assert(type_b->base_type == GLSL_TYPE_FLOAT);
/* "* The operator is add (+), subtract (-), or divide (/), and the
* operands are matrices with the same number of rows and the same
* number of columns. In this case, the operation is done component-
* wise resulting in the same size matrix."
* * The operator is multiply (*), where both operands are matrices or
* one operand is a vector and the other a matrix. A right vector
* operand is treated as a column vector and a left vector operand as a
* row vector. In all these cases, it is required that the number of
* columns of the left operand is equal to the number of rows of the
* right operand. Then, the multiply (*) operation does a linear
* algebraic multiply, yielding an object that has the same number of
* rows as the left operand and the same number of columns as the right
* operand. Section 5.10 "Vector and Matrix Operations" explains in
* more detail how vectors and matrices are operated on."
*/
if (! multiply) {
if (type_a == type_b)
return type_a;
} else {
if (type_a->is_matrix() && type_b->is_matrix()) {
/* Matrix multiply. The columns of A must match the rows of B. Given
* the other previously tested constraints, this means the vector type
* of a row from A must be the same as the vector type of a column from
* B.
*/
if (type_a->row_type() == type_b->column_type()) {
/* The resulting matrix has the number of columns of matrix B and
* the number of rows of matrix A. We get the row count of A by
* looking at the size of a vector that makes up a column. The
* transpose (size of a row) is done for B.
*/
const glsl_type *const type =
glsl_type::get_instance(type_a->base_type,
type_a->column_type()->vector_elements,
type_b->row_type()->vector_elements);
assert(type != glsl_type::error_type);
return type;
}
} else if (type_a->is_matrix()) {
/* A is a matrix and B is a column vector. Columns of A must match
* rows of B. Given the other previously tested constraints, this
* means the vector type of a row from A must be the same as the
* vector the type of B.
*/
if (type_a->row_type() == type_b) {
/* The resulting vector has a number of elements equal to
* the number of rows of matrix A. */
const glsl_type *const type =
glsl_type::get_instance(type_a->base_type,
type_a->column_type()->vector_elements,
1);
assert(type != glsl_type::error_type);
return type;
}
} else {
assert(type_b->is_matrix());
/* A is a row vector and B is a matrix. Columns of A must match rows
* of B. Given the other previously tested constraints, this means
* the type of A must be the same as the vector type of a column from
* B.
*/
if (type_a == type_b->column_type()) {
/* The resulting vector has a number of elements equal to
* the number of columns of matrix B. */
const glsl_type *const type =
glsl_type::get_instance(type_a->base_type,
type_b->row_type()->vector_elements,
1);
assert(type != glsl_type::error_type);
return type;
}
}
_mesa_glsl_error(loc, state, "size mismatch for matrix multiplication");
return glsl_type::error_type;
}
/* "All other cases are illegal."
*/
_mesa_glsl_error(loc, state, "type mismatch");
return glsl_type::error_type;
}
static const struct glsl_type *
unary_arithmetic_result_type(const struct glsl_type *type,
struct _mesa_glsl_parse_state *state, YYLTYPE *loc)
{
/* From GLSL 1.50 spec, page 57:
*
* "The arithmetic unary operators negate (-), post- and pre-increment
* and decrement (-- and ++) operate on integer or floating-point
* values (including vectors and matrices). All unary operators work
* component-wise on their operands. These result with the same type
* they operated on."
*/
if (!type->is_numeric()) {
_mesa_glsl_error(loc, state,
"operands to arithmetic operators must be numeric");
return glsl_type::error_type;
}
return type;
}
/**
* \brief Return the result type of a bit-logic operation.
*
* If the given types to the bit-logic operator are invalid, return
* glsl_type::error_type.
*
* \param type_a Type of LHS of bit-logic op
* \param type_b Type of RHS of bit-logic op
*/
static const struct glsl_type *
bit_logic_result_type(const struct glsl_type *type_a,
const struct glsl_type *type_b,
ast_operators op,
struct _mesa_glsl_parse_state *state, YYLTYPE *loc)
{
if (!state->check_bitwise_operations_allowed(loc)) {
return glsl_type::error_type;
}
/* From page 50 (page 56 of PDF) of GLSL 1.30 spec:
*
* "The bitwise operators and (&), exclusive-or (^), and inclusive-or
* (|). The operands must be of type signed or unsigned integers or
* integer vectors."
*/
if (!type_a->is_integer()) {
_mesa_glsl_error(loc, state, "LHS of `%s' must be an integer",
ast_expression::operator_string(op));
return glsl_type::error_type;
}
if (!type_b->is_integer()) {
_mesa_glsl_error(loc, state, "RHS of `%s' must be an integer",
ast_expression::operator_string(op));
return glsl_type::error_type;
}
/* "The fundamental types of the operands (signed or unsigned) must
* match,"
*/
if (type_a->base_type != type_b->base_type) {
_mesa_glsl_error(loc, state, "operands of `%s' must have the same "
"base type", ast_expression::operator_string(op));
return glsl_type::error_type;
}
/* "The operands cannot be vectors of differing size." */
if (type_a->is_vector() &&
type_b->is_vector() &&
type_a->vector_elements != type_b->vector_elements) {
_mesa_glsl_error(loc, state, "operands of `%s' cannot be vectors of "
"different sizes", ast_expression::operator_string(op));
return glsl_type::error_type;
}
/* "If one operand is a scalar and the other a vector, the scalar is
* applied component-wise to the vector, resulting in the same type as
* the vector. The fundamental types of the operands [...] will be the
* resulting fundamental type."
*/
if (type_a->is_scalar())
return type_b;
else
return type_a;
}
static const struct glsl_type *
modulus_result_type(const struct glsl_type *type_a,
const struct glsl_type *type_b,
struct _mesa_glsl_parse_state *state, YYLTYPE *loc)
{
if (!state->check_version(130, 300, loc, "operator '%%' is reserved")) {
return glsl_type::error_type;
}
/* From GLSL 1.50 spec, page 56:
* "The operator modulus (%) operates on signed or unsigned integers or
* integer vectors. The operand types must both be signed or both be
* unsigned."
*/
if (!type_a->is_integer()) {
_mesa_glsl_error(loc, state, "LHS of operator %% must be an integer");
return glsl_type::error_type;
}
if (!type_b->is_integer()) {
_mesa_glsl_error(loc, state, "RHS of operator %% must be an integer");
return glsl_type::error_type;
}
if (type_a->base_type != type_b->base_type) {
_mesa_glsl_error(loc, state,
"operands of %% must have the same base type");
return glsl_type::error_type;
}
/* "The operands cannot be vectors of differing size. If one operand is
* a scalar and the other vector, then the scalar is applied component-
* wise to the vector, resulting in the same type as the vector. If both
* are vectors of the same size, the result is computed component-wise."
*/
if (type_a->is_vector()) {
if (!type_b->is_vector()
|| (type_a->vector_elements == type_b->vector_elements))
return type_a;
} else
return type_b;
/* "The operator modulus (%) is not defined for any other data types
* (non-integer types)."
*/
_mesa_glsl_error(loc, state, "type mismatch");
return glsl_type::error_type;
}
static const struct glsl_type *
relational_result_type(ir_rvalue * &value_a, ir_rvalue * &value_b,
struct _mesa_glsl_parse_state *state, YYLTYPE *loc)
{
const glsl_type *type_a = value_a->type;
const glsl_type *type_b = value_b->type;
/* From GLSL 1.50 spec, page 56:
* "The relational operators greater than (>), less than (<), greater
* than or equal (>=), and less than or equal (<=) operate only on
* scalar integer and scalar floating-point expressions."
*/
if (!type_a->is_numeric()
|| !type_b->is_numeric()
|| !type_a->is_scalar()
|| !type_b->is_scalar()) {
_mesa_glsl_error(loc, state,
"operands to relational operators must be scalar and "
"numeric");
return glsl_type::error_type;
}
/* "Either the operands' types must match, or the conversions from
* Section 4.1.10 "Implicit Conversions" will be applied to the integer
* operand, after which the types must match."
*/
if (!apply_implicit_conversion(type_a, value_b, state)
&& !apply_implicit_conversion(type_b, value_a, state)) {
_mesa_glsl_error(loc, state,
"could not implicitly convert operands to "
"relational operator");
return glsl_type::error_type;
}
type_a = value_a->type;
type_b = value_b->type;
if (type_a->base_type != type_b->base_type) {
_mesa_glsl_error(loc, state, "base type mismatch");
return glsl_type::error_type;
}
/* "The result is scalar Boolean."
*/
return glsl_type::bool_type;
}
/**
* \brief Return the result type of a bit-shift operation.
*
* If the given types to the bit-shift operator are invalid, return
* glsl_type::error_type.
*
* \param type_a Type of LHS of bit-shift op
* \param type_b Type of RHS of bit-shift op
*/
static const struct glsl_type *
shift_result_type(const struct glsl_type *type_a,
const struct glsl_type *type_b,
ast_operators op,
struct _mesa_glsl_parse_state *state, YYLTYPE *loc)
{
if (!state->check_bitwise_operations_allowed(loc)) {
return glsl_type::error_type;
}
/* From page 50 (page 56 of the PDF) of the GLSL 1.30 spec:
*
* "The shift operators (<<) and (>>). For both operators, the operands
* must be signed or unsigned integers or integer vectors. One operand
* can be signed while the other is unsigned."
*/
if (!type_a->is_integer()) {
_mesa_glsl_error(loc, state, "LHS of operator %s must be an integer or "
"integer vector", ast_expression::operator_string(op));
return glsl_type::error_type;
}
if (!type_b->is_integer()) {
_mesa_glsl_error(loc, state, "RHS of operator %s must be an integer or "
"integer vector", ast_expression::operator_string(op));
return glsl_type::error_type;
}
/* "If the first operand is a scalar, the second operand has to be
* a scalar as well."
*/
if (type_a->is_scalar() && !type_b->is_scalar()) {
_mesa_glsl_error(loc, state, "if the first operand of %s is scalar, the "
"second must be scalar as well",
ast_expression::operator_string(op));
return glsl_type::error_type;
}
/* If both operands are vectors, check that they have same number of
* elements.
*/
if (type_a->is_vector() &&
type_b->is_vector() &&
type_a->vector_elements != type_b->vector_elements) {
_mesa_glsl_error(loc, state, "vector operands to operator %s must "
"have same number of elements",
ast_expression::operator_string(op));
return glsl_type::error_type;
}
/* "In all cases, the resulting type will be the same type as the left
* operand."
*/
return type_a;
}
/**
* Validates that a value can be assigned to a location with a specified type
*
* Validates that \c rhs can be assigned to some location. If the types are
* not an exact match but an automatic conversion is possible, \c rhs will be
* converted.
*
* \return
* \c NULL if \c rhs cannot be assigned to a location with type \c lhs_type.
* Otherwise the actual RHS to be assigned will be returned. This may be
* \c rhs, or it may be \c rhs after some type conversion.
*
* \note
* In addition to being used for assignments, this function is used to
* type-check return values.
*/
ir_rvalue *
validate_assignment(struct _mesa_glsl_parse_state *state,
YYLTYPE loc, const glsl_type *lhs_type,
ir_rvalue *rhs, bool is_initializer)
{
/* If there is already some error in the RHS, just return it. Anything
* else will lead to an avalanche of error message back to the user.
*/
if (rhs->type->is_error())
return rhs;
/* If the types are identical, the assignment can trivially proceed.
*/
if (rhs->type == lhs_type)
return rhs;
/* If the array element types are the same and the LHS is unsized,
* the assignment is okay for initializers embedded in variable
* declarations.
*
* Note: Whole-array assignments are not permitted in GLSL 1.10, but this
* is handled by ir_dereference::is_lvalue.
*/
if (lhs_type->is_unsized_array() && rhs->type->is_array()
&& (lhs_type->element_type() == rhs->type->element_type())) {
if (is_initializer) {
return rhs;
} else {
_mesa_glsl_error(&loc, state,
"implicitly sized arrays cannot be assigned");
return NULL;
}
}
/* Check for implicit conversion in GLSL 1.20 */
if (apply_implicit_conversion(lhs_type, rhs, state)) {
if (rhs->type == lhs_type)
return rhs;
}
_mesa_glsl_error(&loc, state,
"%s of type %s cannot be assigned to "
"variable of type %s",
is_initializer ? "initializer" : "value",
rhs->type->name, lhs_type->name);
return NULL;
}
static void
mark_whole_array_access(ir_rvalue *access)
{
ir_dereference_variable *deref = access->as_dereference_variable();
if (deref && deref->var) {
deref->var->data.max_array_access = deref->type->length - 1;
}
}
static bool
do_assignment(exec_list *instructions, struct _mesa_glsl_parse_state *state,
const char *non_lvalue_description,
ir_rvalue *lhs, ir_rvalue *rhs,
ir_rvalue **out_rvalue, bool needs_rvalue,
bool is_initializer,
YYLTYPE lhs_loc)
{
void *ctx = state;
bool error_emitted = (lhs->type->is_error() || rhs->type->is_error());
ir_rvalue *extract_channel = NULL;
/* If the assignment LHS comes back as an ir_binop_vector_extract
* expression, move it to the RHS as an ir_triop_vector_insert.
*/
if (lhs->ir_type == ir_type_expression) {
ir_expression *const lhs_expr = lhs->as_expression();
if (unlikely(lhs_expr->operation == ir_binop_vector_extract)) {
ir_rvalue *new_rhs =
validate_assignment(state, lhs_loc, lhs->type,
rhs, is_initializer);
if (new_rhs == NULL) {
return lhs;
} else {
/* This converts:
* - LHS: (expression float vector_extract <vec> <channel>)
* - RHS: <scalar>
* into:
* - LHS: <vec>
* - RHS: (expression vec2 vector_insert <vec> <channel> <scalar>)
*
* The LHS type is now a vector instead of a scalar. Since GLSL
* allows assignments to be used as rvalues, we need to re-extract
* the channel from assignment_temp when returning the rvalue.
*/
extract_channel = lhs_expr->operands[1];
rhs = new(ctx) ir_expression(ir_triop_vector_insert,
lhs_expr->operands[0]->type,
lhs_expr->operands[0],
new_rhs,
extract_channel);
lhs = lhs_expr->operands[0]->clone(ctx, NULL);
}
}
}
ir_variable *lhs_var = lhs->variable_referenced();
if (lhs_var)
lhs_var->data.assigned = true;
if (!error_emitted) {
if (non_lvalue_description != NULL) {
_mesa_glsl_error(&lhs_loc, state,
"assignment to %s",
non_lvalue_description);
error_emitted = true;
} else if (lhs_var != NULL && lhs_var->data.read_only) {
_mesa_glsl_error(&lhs_loc, state,
"assignment to read-only variable '%s'",
lhs_var->name);
error_emitted = true;
} else if (lhs->type->is_array() &&
!state->check_version(120, 300, &lhs_loc,
"whole array assignment forbidden")) {
/* From page 32 (page 38 of the PDF) of the GLSL 1.10 spec:
*
* "Other binary or unary expressions, non-dereferenced
* arrays, function names, swizzles with repeated fields,
* and constants cannot be l-values."
*
* The restriction on arrays is lifted in GLSL 1.20 and GLSL ES 3.00.
*/
error_emitted = true;
} else if (!lhs->is_lvalue()) {
_mesa_glsl_error(& lhs_loc, state, "non-lvalue in assignment");
error_emitted = true;
}
}
ir_rvalue *new_rhs =
validate_assignment(state, lhs_loc, lhs->type, rhs, is_initializer);
if (new_rhs != NULL) {
rhs = new_rhs;
/* If the LHS array was not declared with a size, it takes it size from
* the RHS. If the LHS is an l-value and a whole array, it must be a
* dereference of a variable. Any other case would require that the LHS
* is either not an l-value or not a whole array.
*/
if (lhs->type->is_unsized_array()) {
ir_dereference *const d = lhs->as_dereference();
assert(d != NULL);
ir_variable *const var = d->variable_referenced();
assert(var != NULL);
if (var->data.max_array_access >= unsigned(rhs->type->array_size())) {
/* FINISHME: This should actually log the location of the RHS. */
_mesa_glsl_error(& lhs_loc, state, "array size must be > %u due to "
"previous access",
var->data.max_array_access);
}
var->type = glsl_type::get_array_instance(lhs->type->element_type(),
rhs->type->array_size());
d->type = var->type;
}
if (lhs->type->is_array()) {
mark_whole_array_access(rhs);
mark_whole_array_access(lhs);
}
}
if (lhs->get_precision() == glsl_precision_undefined)
{
glsl_precision prec = precision_from_ir (rhs);
ir_dereference *const d = lhs->as_dereference();
if (d)
{
ir_variable *const var = d->variable_referenced();
if (var)
var->data.precision = prec;
}
}
/* Most callers of do_assignment (assign, add_assign, pre_inc/dec,
* but not post_inc) need the converted assigned value as an rvalue
* to handle things like:
*
* i = j += 1;
*/
if (needs_rvalue) {
ir_variable *var = new(ctx) ir_variable(rhs->type, "assignment_tmp",
ir_var_temporary, precision_from_ir(rhs));
instructions->push_tail(var);
instructions->push_tail(assign(var, rhs));
if (!error_emitted) {
ir_dereference_variable *deref_var = new(ctx) ir_dereference_variable(var);
instructions->push_tail(new(ctx) ir_assignment(lhs, deref_var));
}
ir_rvalue *rvalue = new(ctx) ir_dereference_variable(var);
if (extract_channel) {
rvalue = new(ctx) ir_expression(ir_binop_vector_extract,
rvalue,
extract_channel->clone(ctx, NULL));
}
*out_rvalue = rvalue;
} else {
if (!error_emitted)
instructions->push_tail(new(ctx) ir_assignment(lhs, rhs));
*out_rvalue = NULL;
}
return error_emitted;
}
static ir_rvalue *
get_lvalue_copy(exec_list *instructions, ir_rvalue *lvalue)
{
void *ctx = ralloc_parent(lvalue);
ir_variable *var;
var = new(ctx) ir_variable(lvalue->type, "_post_incdec_tmp",
ir_var_temporary, precision_from_ir(lvalue));
instructions->push_tail(var);
instructions->push_tail(new(ctx) ir_assignment(new(ctx) ir_dereference_variable(var),
lvalue));
return new(ctx) ir_dereference_variable(var);
}
ir_rvalue *
ast_node::hir(exec_list *instructions, struct _mesa_glsl_parse_state *state)
{
(void) instructions;
(void) state;
return NULL;
}
void
ast_function_expression::hir_no_rvalue(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
(void)hir(instructions, state);
}
void
ast_aggregate_initializer::hir_no_rvalue(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
(void)hir(instructions, state);
}
static ir_rvalue *
do_comparison(void *mem_ctx, int operation, ir_rvalue *op0, ir_rvalue *op1)
{
int join_op;
ir_rvalue *cmp = NULL;
if (operation == ir_binop_all_equal)
join_op = ir_binop_logic_and;
else
join_op = ir_binop_logic_or;
switch (op0->type->base_type) {
case GLSL_TYPE_FLOAT:
case GLSL_TYPE_UINT:
case GLSL_TYPE_INT:
case GLSL_TYPE_BOOL:
return new(mem_ctx) ir_expression(operation, op0, op1);
case GLSL_TYPE_ARRAY: {
for (unsigned int i = 0; i < op0->type->length; i++) {
ir_rvalue *e0, *e1, *result;
e0 = new(mem_ctx) ir_dereference_array(op0->clone(mem_ctx, NULL),
new(mem_ctx) ir_constant(i));
e1 = new(mem_ctx) ir_dereference_array(op1->clone(mem_ctx, NULL),
new(mem_ctx) ir_constant(i));
result = do_comparison(mem_ctx, operation, e0, e1);
if (cmp) {
cmp = new(mem_ctx) ir_expression(join_op, cmp, result);
} else {
cmp = result;
}
}
mark_whole_array_access(op0);
mark_whole_array_access(op1);
break;
}
case GLSL_TYPE_STRUCT: {
for (unsigned int i = 0; i < op0->type->length; i++) {
ir_rvalue *e0, *e1, *result;
const char *field_name = op0->type->fields.structure[i].name;
e0 = new(mem_ctx) ir_dereference_record(op0->clone(mem_ctx, NULL),
field_name);
e1 = new(mem_ctx) ir_dereference_record(op1->clone(mem_ctx, NULL),
field_name);
result = do_comparison(mem_ctx, operation, e0, e1);
if (cmp) {
cmp = new(mem_ctx) ir_expression(join_op, cmp, result);
} else {
cmp = result;
}
}
break;
}
case GLSL_TYPE_ERROR:
case GLSL_TYPE_VOID:
case GLSL_TYPE_SAMPLER:
case GLSL_TYPE_IMAGE:
case GLSL_TYPE_INTERFACE:
case GLSL_TYPE_ATOMIC_UINT:
/* I assume a comparison of a struct containing a sampler just
* ignores the sampler present in the type.
*/
break;
}
if (cmp == NULL)
cmp = new(mem_ctx) ir_constant(true);
return cmp;
}
/* For logical operations, we want to ensure that the operands are
* scalar booleans. If it isn't, emit an error and return a constant
* boolean to avoid triggering cascading error messages.
*/
ir_rvalue *
get_scalar_boolean_operand(exec_list *instructions,
struct _mesa_glsl_parse_state *state,
ast_expression *parent_expr,
int operand,
const char *operand_name,
bool *error_emitted)
{
ast_expression *expr = parent_expr->subexpressions[operand];
void *ctx = state;
ir_rvalue *val = expr->hir(instructions, state);
if (val->type->is_boolean() && val->type->is_scalar())
return val;
if (!*error_emitted) {
YYLTYPE loc = expr->get_location();
_mesa_glsl_error(&loc, state, "%s of `%s' must be scalar boolean",
operand_name,
parent_expr->operator_string(parent_expr->oper));
*error_emitted = true;
}
return new(ctx) ir_constant(true);
}
/**
* If name refers to a builtin array whose maximum allowed size is less than
* size, report an error and return true. Otherwise return false.
*/
void
check_builtin_array_max_size(const char *name, unsigned size,
YYLTYPE loc, struct _mesa_glsl_parse_state *state)
{
if ((strcmp("gl_TexCoord", name) == 0)
&& (size > state->Const.MaxTextureCoords)) {
/* From page 54 (page 60 of the PDF) of the GLSL 1.20 spec:
*
* "The size [of gl_TexCoord] can be at most
* gl_MaxTextureCoords."
*/
_mesa_glsl_error(&loc, state, "`gl_TexCoord' array size cannot "
"be larger than gl_MaxTextureCoords (%u)",
state->Const.MaxTextureCoords);
} else if (strcmp("gl_ClipDistance", name) == 0
&& size > state->Const.MaxClipPlanes) {
/* From section 7.1 (Vertex Shader Special Variables) of the
* GLSL 1.30 spec:
*
* "The gl_ClipDistance array is predeclared as unsized and
* must be sized by the shader either redeclaring it with a
* size or indexing it only with integral constant
* expressions. ... The size can be at most
* gl_MaxClipDistances."
*/
_mesa_glsl_error(&loc, state, "`gl_ClipDistance' array size cannot "
"be larger than gl_MaxClipDistances (%u)",
state->Const.MaxClipPlanes);
}
}
/**
* Create the constant 1, of a which is appropriate for incrementing and
* decrementing values of the given GLSL type. For example, if type is vec4,
* this creates a constant value of 1.0 having type float.
*
* If the given type is invalid for increment and decrement operators, return
* a floating point 1--the error will be detected later.
*/
static ir_rvalue *
constant_one_for_inc_dec(void *ctx, const glsl_type *type)
{
switch (type->base_type) {
case GLSL_TYPE_UINT:
return new(ctx) ir_constant((unsigned) 1);
case GLSL_TYPE_INT:
return new(ctx) ir_constant(1);
default:
case GLSL_TYPE_FLOAT:
return new(ctx) ir_constant(1.0f);
}
}
ir_rvalue *
ast_expression::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
return do_hir(instructions, state, true);
}
void
ast_expression::hir_no_rvalue(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
do_hir(instructions, state, false);
}
ir_rvalue *
ast_expression::do_hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state,
bool needs_rvalue)
{
void *ctx = state;
static const int operations[AST_NUM_OPERATORS] = {
-1, /* ast_assign doesn't convert to ir_expression. */
-1, /* ast_plus doesn't convert to ir_expression. */
ir_unop_neg,
ir_binop_add,
ir_binop_sub,
ir_binop_mul,
ir_binop_div,
ir_binop_mod,
ir_binop_lshift,
ir_binop_rshift,
ir_binop_less,
ir_binop_greater,
ir_binop_lequal,
ir_binop_gequal,
ir_binop_all_equal,
ir_binop_any_nequal,
ir_binop_bit_and,
ir_binop_bit_xor,
ir_binop_bit_or,
ir_unop_bit_not,
ir_binop_logic_and,
ir_binop_logic_xor,
ir_binop_logic_or,
ir_unop_logic_not,
/* Note: The following block of expression types actually convert
* to multiple IR instructions.
*/
ir_binop_mul, /* ast_mul_assign */
ir_binop_div, /* ast_div_assign */
ir_binop_mod, /* ast_mod_assign */
ir_binop_add, /* ast_add_assign */
ir_binop_sub, /* ast_sub_assign */
ir_binop_lshift, /* ast_ls_assign */
ir_binop_rshift, /* ast_rs_assign */
ir_binop_bit_and, /* ast_and_assign */
ir_binop_bit_xor, /* ast_xor_assign */
ir_binop_bit_or, /* ast_or_assign */
-1, /* ast_conditional doesn't convert to ir_expression. */
ir_binop_add, /* ast_pre_inc. */
ir_binop_sub, /* ast_pre_dec. */
ir_binop_add, /* ast_post_inc. */
ir_binop_sub, /* ast_post_dec. */
-1, /* ast_field_selection doesn't conv to ir_expression. */
-1, /* ast_array_index doesn't convert to ir_expression. */
-1, /* ast_function_call doesn't conv to ir_expression. */
-1, /* ast_identifier doesn't convert to ir_expression. */
-1, /* ast_int_constant doesn't convert to ir_expression. */
-1, /* ast_uint_constant doesn't conv to ir_expression. */
-1, /* ast_float_constant doesn't conv to ir_expression. */
-1, /* ast_bool_constant doesn't conv to ir_expression. */
-1, /* ast_sequence doesn't convert to ir_expression. */
};
ir_rvalue *result = NULL;
ir_rvalue *op[3];
const struct glsl_type *type; /* a temporary variable for switch cases */
bool error_emitted = false;
YYLTYPE loc;
loc = this->get_location();
switch (this->oper) {
case ast_aggregate:
assert(!"ast_aggregate: Should never get here.");
break;
case ast_assign: {
op[0] = this->subexpressions[0]->hir(instructions, state);
op[1] = this->subexpressions[1]->hir(instructions, state);
error_emitted =
do_assignment(instructions, state,
this->subexpressions[0]->non_lvalue_description,
op[0], op[1], &result, needs_rvalue, false,
this->subexpressions[0]->get_location());
break;
}
case ast_plus:
op[0] = this->subexpressions[0]->hir(instructions, state);
type = unary_arithmetic_result_type(op[0]->type, state, & loc);
error_emitted = type->is_error();
result = op[0];
break;
case ast_neg:
op[0] = this->subexpressions[0]->hir(instructions, state);
type = unary_arithmetic_result_type(op[0]->type, state, & loc);
error_emitted = type->is_error();
result = new(ctx) ir_expression(operations[this->oper], type,
op[0], NULL);
break;
case ast_add:
case ast_sub:
case ast_mul:
case ast_div:
op[0] = this->subexpressions[0]->hir(instructions, state);
op[1] = this->subexpressions[1]->hir(instructions, state);
type = arithmetic_result_type(op[0], op[1],
(this->oper == ast_mul),
state, & loc);
error_emitted = type->is_error();
result = new(ctx) ir_expression(operations[this->oper], type,
op[0], op[1]);
break;
case ast_mod:
op[0] = this->subexpressions[0]->hir(instructions, state);
op[1] = this->subexpressions[1]->hir(instructions, state);
type = modulus_result_type(op[0]->type, op[1]->type, state, & loc);
assert(operations[this->oper] == ir_binop_mod);
result = new(ctx) ir_expression(operations[this->oper], type,
op[0], op[1]);
error_emitted = type->is_error();
break;
case ast_lshift:
case ast_rshift:
if (!state->check_bitwise_operations_allowed(&loc)) {
error_emitted = true;
}
op[0] = this->subexpressions[0]->hir(instructions, state);
op[1] = this->subexpressions[1]->hir(instructions, state);
type = shift_result_type(op[0]->type, op[1]->type, this->oper, state,
&loc);
result = new(ctx) ir_expression(operations[this->oper], type,
op[0], op[1]);
error_emitted = op[0]->type->is_error() || op[1]->type->is_error();
break;
case ast_less:
case ast_greater:
case ast_lequal:
case ast_gequal:
op[0] = this->subexpressions[0]->hir(instructions, state);
op[1] = this->subexpressions[1]->hir(instructions, state);
type = relational_result_type(op[0], op[1], state, & loc);
/* The relational operators must either generate an error or result
* in a scalar boolean. See page 57 of the GLSL 1.50 spec.
*/
assert(type->is_error()
|| ((type->base_type == GLSL_TYPE_BOOL)
&& type->is_scalar()));
result = new(ctx) ir_expression(operations[this->oper], type,
op[0], op[1]);
error_emitted = type->is_error();
break;
case ast_nequal:
case ast_equal:
op[0] = this->subexpressions[0]->hir(instructions, state);
op[1] = this->subexpressions[1]->hir(instructions, state);
/* From page 58 (page 64 of the PDF) of the GLSL 1.50 spec:
*
* "The equality operators equal (==), and not equal (!=)
* operate on all types. They result in a scalar Boolean. If
* the operand types do not match, then there must be a
* conversion from Section 4.1.10 "Implicit Conversions"
* applied to one operand that can make them match, in which
* case this conversion is done."
*/
if ((!apply_implicit_conversion(op[0]->type, op[1], state)
&& !apply_implicit_conversion(op[1]->type, op[0], state))
|| (op[0]->type != op[1]->type)) {
_mesa_glsl_error(& loc, state, "operands of `%s' must have the same "
"type", (this->oper == ast_equal) ? "==" : "!=");
error_emitted = true;
} else if ((op[0]->type->is_array() || op[1]->type->is_array()) &&
!state->check_version(120, 300, &loc,
"array comparisons forbidden")) {
error_emitted = true;
} else if ((op[0]->type->contains_opaque() ||
op[1]->type->contains_opaque())) {
_mesa_glsl_error(&loc, state, "opaque type comparisons forbidden");
error_emitted = true;
}
if (error_emitted) {
result = new(ctx) ir_constant(false);
} else {
result = do_comparison(ctx, operations[this->oper], op[0], op[1]);
assert(result->type == glsl_type::bool_type);
}
break;
case ast_bit_and:
case ast_bit_xor:
case ast_bit_or:
op[0] = this->subexpressions[0]->hir(instructions, state);
op[1] = this->subexpressions[1]->hir(instructions, state);
type = bit_logic_result_type(op[0]->type, op[1]->type, this->oper,
state, &loc);
result = new(ctx) ir_expression(operations[this->oper], type,
op[0], op[1]);
error_emitted = op[0]->type->is_error() || op[1]->type->is_error();
break;
case ast_bit_not:
op[0] = this->subexpressions[0]->hir(instructions, state);
if (!state->check_bitwise_operations_allowed(&loc)) {
error_emitted = true;
}
if (!op[0]->type->is_integer()) {
_mesa_glsl_error(&loc, state, "operand of `~' must be an integer");
error_emitted = true;
}
type = error_emitted ? glsl_type::error_type : op[0]->type;
result = new(ctx) ir_expression(ir_unop_bit_not, type, op[0], NULL);
break;
case ast_logic_and: {
exec_list rhs_instructions;
op[0] = get_scalar_boolean_operand(instructions, state, this, 0,
"LHS", &error_emitted);
op[1] = get_scalar_boolean_operand(&rhs_instructions, state, this, 1,
"RHS", &error_emitted);
if (rhs_instructions.is_empty()) {
result = new(ctx) ir_expression(ir_binop_logic_and, op[0], op[1]);
type = result->type;
} else {
ir_variable *const tmp = new(ctx) ir_variable(glsl_type::bool_type,
"and_tmp",
ir_var_temporary, glsl_precision_low);
instructions->push_tail(tmp);
ir_if *const stmt = new(ctx) ir_if(op[0]);
instructions->push_tail(stmt);
stmt->then_instructions.append_list(&rhs_instructions);
ir_dereference *const then_deref = new(ctx) ir_dereference_variable(tmp);
ir_assignment *const then_assign =
new(ctx) ir_assignment(then_deref, op[1]);
stmt->then_instructions.push_tail(then_assign);
ir_dereference *const else_deref = new(ctx) ir_dereference_variable(tmp);
ir_assignment *const else_assign =
new(ctx) ir_assignment(else_deref, new(ctx) ir_constant(false));
stmt->else_instructions.push_tail(else_assign);
result = new(ctx) ir_dereference_variable(tmp);
type = tmp->type;
}
break;
}
case ast_logic_or: {
exec_list rhs_instructions;
op[0] = get_scalar_boolean_operand(instructions, state, this, 0,
"LHS", &error_emitted);
op[1] = get_scalar_boolean_operand(&rhs_instructions, state, this, 1,
"RHS", &error_emitted);
if (rhs_instructions.is_empty()) {
result = new(ctx) ir_expression(ir_binop_logic_or, op[0], op[1]);
type = result->type;
} else {
ir_variable *const tmp = new(ctx) ir_variable(glsl_type::bool_type,
"or_tmp",
ir_var_temporary, glsl_precision_low);
instructions->push_tail(tmp);
ir_if *const stmt = new(ctx) ir_if(op[0]);
instructions->push_tail(stmt);
ir_dereference *const then_deref = new(ctx) ir_dereference_variable(tmp);
ir_assignment *const then_assign =
new(ctx) ir_assignment(then_deref, new(ctx) ir_constant(true));
stmt->then_instructions.push_tail(then_assign);
stmt->else_instructions.append_list(&rhs_instructions);
ir_dereference *const else_deref = new(ctx) ir_dereference_variable(tmp);
ir_assignment *const else_assign =
new(ctx) ir_assignment(else_deref, op[1]);
stmt->else_instructions.push_tail(else_assign);
result = new(ctx) ir_dereference_variable(tmp);
type = tmp->type;
}
break;
}
case ast_logic_xor:
/* From page 33 (page 39 of the PDF) of the GLSL 1.10 spec:
*
* "The logical binary operators and (&&), or ( | | ), and
* exclusive or (^^). They operate only on two Boolean
* expressions and result in a Boolean expression."
*/
op[0] = get_scalar_boolean_operand(instructions, state, this, 0, "LHS",
&error_emitted);
op[1] = get_scalar_boolean_operand(instructions, state, this, 1, "RHS",
&error_emitted);
result = new(ctx) ir_expression(operations[this->oper], glsl_type::bool_type,
op[0], op[1]);
break;
case ast_logic_not:
op[0] = get_scalar_boolean_operand(instructions, state, this, 0,
"operand", &error_emitted);
result = new(ctx) ir_expression(operations[this->oper], glsl_type::bool_type,
op[0], NULL);
break;
case ast_mul_assign:
case ast_div_assign:
case ast_add_assign:
case ast_sub_assign: {
op[0] = this->subexpressions[0]->hir(instructions, state);
op[1] = this->subexpressions[1]->hir(instructions, state);
type = arithmetic_result_type(op[0], op[1],
(this->oper == ast_mul_assign),
state, & loc);
ir_rvalue *temp_rhs = new(ctx) ir_expression(operations[this->oper], type,
op[0], op[1]);
error_emitted =
do_assignment(instructions, state,
this->subexpressions[0]->non_lvalue_description,
op[0]->clone(ctx, NULL), temp_rhs,
&result, needs_rvalue, false,
this->subexpressions[0]->get_location());
/* GLSL 1.10 does not allow array assignment. However, we don't have to
* explicitly test for this because none of the binary expression
* operators allow array operands either.
*/
break;
}
case ast_mod_assign: {
op[0] = this->subexpressions[0]->hir(instructions, state);
op[1] = this->subexpressions[1]->hir(instructions, state);
type = modulus_result_type(op[0]->type, op[1]->type, state, & loc);
assert(operations[this->oper] == ir_binop_mod);
ir_rvalue *temp_rhs;
temp_rhs = new(ctx) ir_expression(operations[this->oper], type,
op[0], op[1]);
error_emitted =
do_assignment(instructions, state,
this->subexpressions[0]->non_lvalue_description,
op[0]->clone(ctx, NULL), temp_rhs,
&result, needs_rvalue, false,
this->subexpressions[0]->get_location());
break;
}
case ast_ls_assign:
case ast_rs_assign: {
op[0] = this->subexpressions[0]->hir(instructions, state);
op[1] = this->subexpressions[1]->hir(instructions, state);
type = shift_result_type(op[0]->type, op[1]->type, this->oper, state,
&loc);
ir_rvalue *temp_rhs = new(ctx) ir_expression(operations[this->oper],
type, op[0], op[1]);
error_emitted =
do_assignment(instructions, state,
this->subexpressions[0]->non_lvalue_description,
op[0]->clone(ctx, NULL), temp_rhs,
&result, needs_rvalue, false,
this->subexpressions[0]->get_location());
break;
}
case ast_and_assign:
case ast_xor_assign:
case ast_or_assign: {
op[0] = this->subexpressions[0]->hir(instructions, state);
op[1] = this->subexpressions[1]->hir(instructions, state);
type = bit_logic_result_type(op[0]->type, op[1]->type, this->oper,
state, &loc);
ir_rvalue *temp_rhs = new(ctx) ir_expression(operations[this->oper],
type, op[0], op[1]);
error_emitted =
do_assignment(instructions, state,
this->subexpressions[0]->non_lvalue_description,
op[0]->clone(ctx, NULL), temp_rhs,
&result, needs_rvalue, false,
this->subexpressions[0]->get_location());
break;
}
case ast_conditional: {
/* From page 59 (page 65 of the PDF) of the GLSL 1.50 spec:
*
* "The ternary selection operator (?:). It operates on three
* expressions (exp1 ? exp2 : exp3). This operator evaluates the
* first expression, which must result in a scalar Boolean."
*/
op[0] = get_scalar_boolean_operand(instructions, state, this, 0,
"condition", &error_emitted);
/* The :? operator is implemented by generating an anonymous temporary
* followed by an if-statement. The last instruction in each branch of
* the if-statement assigns a value to the anonymous temporary. This
* temporary is the r-value of the expression.
*/
exec_list then_instructions;
exec_list else_instructions;
op[1] = this->subexpressions[1]->hir(&then_instructions, state);
op[2] = this->subexpressions[2]->hir(&else_instructions, state);
/* From page 59 (page 65 of the PDF) of the GLSL 1.50 spec:
*
* "The second and third expressions can be any type, as
* long their types match, or there is a conversion in
* Section 4.1.10 "Implicit Conversions" that can be applied
* to one of the expressions to make their types match. This
* resulting matching type is the type of the entire
* expression."
*/
if ((!apply_implicit_conversion(op[1]->type, op[2], state)
&& !apply_implicit_conversion(op[2]->type, op[1], state))
|| (op[1]->type != op[2]->type)) {
YYLTYPE loc = this->subexpressions[1]->get_location();
_mesa_glsl_error(& loc, state, "second and third operands of ?: "
"operator must have matching types");
error_emitted = true;
type = glsl_type::error_type;
} else {
type = op[1]->type;
}
/* From page 33 (page 39 of the PDF) of the GLSL 1.10 spec:
*
* "The second and third expressions must be the same type, but can
* be of any type other than an array."
*/
if (type->is_array() &&
!state->check_version(120, 300, &loc,
"second and third operands of ?: operator "
"cannot be arrays")) {
error_emitted = true;
}
ir_constant *cond_val = op[0]->constant_expression_value();
ir_constant *then_val = op[1]->constant_expression_value();
ir_constant *else_val = op[2]->constant_expression_value();
if (then_instructions.is_empty()
&& else_instructions.is_empty()
&& (cond_val != NULL) && (then_val != NULL) && (else_val != NULL)) {
result = (cond_val->value.b[0]) ? then_val : else_val;
} else {
ir_variable *const tmp =
new(ctx) ir_variable(type, "conditional_tmp", ir_var_temporary, higher_precision(op[1], op[2]));
instructions->push_tail(tmp);
ir_if *const stmt = new(ctx) ir_if(op[0]);
instructions->push_tail(stmt);
then_instructions.move_nodes_to(& stmt->then_instructions);
ir_dereference *const then_deref =
new(ctx) ir_dereference_variable(tmp);
ir_assignment *const then_assign =
new(ctx) ir_assignment(then_deref, op[1]);
stmt->then_instructions.push_tail(then_assign);
else_instructions.move_nodes_to(& stmt->else_instructions);
ir_dereference *const else_deref =
new(ctx) ir_dereference_variable(tmp);
ir_assignment *const else_assign =
new(ctx) ir_assignment(else_deref, op[2]);
stmt->else_instructions.push_tail(else_assign);
result = new(ctx) ir_dereference_variable(tmp);
}
break;
}
case ast_pre_inc:
case ast_pre_dec: {
this->non_lvalue_description = (this->oper == ast_pre_inc)
? "pre-increment operation" : "pre-decrement operation";
op[0] = this->subexpressions[0]->hir(instructions, state);
op[1] = constant_one_for_inc_dec(ctx, op[0]->type);
type = arithmetic_result_type(op[0], op[1], false, state, & loc);
ir_rvalue *temp_rhs;
temp_rhs = new(ctx) ir_expression(operations[this->oper], type,
op[0], op[1]);
error_emitted =
do_assignment(instructions, state,
this->subexpressions[0]->non_lvalue_description,
op[0]->clone(ctx, NULL), temp_rhs,
&result, needs_rvalue, false,
this->subexpressions[0]->get_location());
break;
}
case ast_post_inc:
case ast_post_dec: {
this->non_lvalue_description = (this->oper == ast_post_inc)
? "post-increment operation" : "post-decrement operation";
op[0] = this->subexpressions[0]->hir(instructions, state);
op[1] = constant_one_for_inc_dec(ctx, op[0]->type);
error_emitted = op[0]->type->is_error() || op[1]->type->is_error();
type = arithmetic_result_type(op[0], op[1], false, state, & loc);
ir_rvalue *temp_rhs;
temp_rhs = new(ctx) ir_expression(operations[this->oper], type,
op[0], op[1]);
/* Get a temporary of a copy of the lvalue before it's modified.
* This may get thrown away later.
*/
result = get_lvalue_copy(instructions, op[0]->clone(ctx, NULL));
ir_rvalue *junk_rvalue;
error_emitted =
do_assignment(instructions, state,
this->subexpressions[0]->non_lvalue_description,
op[0]->clone(ctx, NULL), temp_rhs,
&junk_rvalue, false, false,
this->subexpressions[0]->get_location());
break;
}
case ast_field_selection:
result = _mesa_ast_field_selection_to_hir(this, instructions, state);
break;
case ast_array_index: {
YYLTYPE index_loc = subexpressions[1]->get_location();
op[0] = subexpressions[0]->hir(instructions, state);
op[1] = subexpressions[1]->hir(instructions, state);
result = _mesa_ast_array_index_to_hir(ctx, state, op[0], op[1],
loc, index_loc);
if (result->type->is_error())
error_emitted = true;
break;
}
case ast_function_call:
/* Should *NEVER* get here. ast_function_call should always be handled
* by ast_function_expression::hir.
*/
assert(0);
break;
case ast_identifier: {
/* ast_identifier can appear several places in a full abstract syntax
* tree. This particular use must be at location specified in the grammar
* as 'variable_identifier'.
*/
ir_variable *var =
state->symbols->get_variable(this->primary_expression.identifier);
if (var != NULL) {
var->data.used = true;
result = new(ctx) ir_dereference_variable(var);
} else {
_mesa_glsl_error(& loc, state, "`%s' undeclared",
this->primary_expression.identifier);
result = ir_rvalue::error_value(ctx);
error_emitted = true;
}
break;
}
case ast_int_constant:
result = new(ctx) ir_constant(this->primary_expression.int_constant);
break;
case ast_uint_constant:
result = new(ctx) ir_constant(this->primary_expression.uint_constant);
break;
case ast_float_constant:
result = new(ctx) ir_constant(this->primary_expression.float_constant);
break;
case ast_bool_constant:
result = new(ctx) ir_constant(bool(!!this->primary_expression.bool_constant));
break;
case ast_sequence: {
/* It should not be possible to generate a sequence in the AST without
* any expressions in it.
*/
assert(!this->expressions.is_empty());
/* The r-value of a sequence is the last expression in the sequence. If
* the other expressions in the sequence do not have side-effects (and
* therefore add instructions to the instruction list), they get dropped
* on the floor.
*/
exec_node *previous_tail_pred = NULL;
YYLTYPE previous_operand_loc = loc;
foreach_list_typed (ast_node, ast, link, &this->expressions) {
/* If one of the operands of comma operator does not generate any
* code, we want to emit a warning. At each pass through the loop
* previous_tail_pred will point to the last instruction in the
* stream *before* processing the previous operand. Naturally,
* instructions->tail_pred will point to the last instruction in the
* stream *after* processing the previous operand. If the two
* pointers match, then the previous operand had no effect.
*
* The warning behavior here differs slightly from GCC. GCC will
* only emit a warning if none of the left-hand operands have an
* effect. However, it will emit a warning for each. I believe that
* there are some cases in C (especially with GCC extensions) where
* it is useful to have an intermediate step in a sequence have no
* effect, but I don't think these cases exist in GLSL. Either way,
* it would be a giant hassle to replicate that behavior.
*/
if (previous_tail_pred == instructions->tail_pred) {
_mesa_glsl_warning(&previous_operand_loc, state,
"left-hand operand of comma expression has "
"no effect");
}
/* tail_pred is directly accessed instead of using the get_tail()
* method for performance reasons. get_tail() has extra code to
* return NULL when the list is empty. We don't care about that
* here, so using tail_pred directly is fine.
*/
previous_tail_pred = instructions->tail_pred;
previous_operand_loc = ast->get_location();
result = ast->hir(instructions, state);
}
/* Any errors should have already been emitted in the loop above.
*/
error_emitted = true;
break;
}
}
type = NULL; /* use result->type, not type. */
assert(result != NULL || !needs_rvalue);
if (result && result->type->is_error() && !error_emitted)
_mesa_glsl_error(& loc, state, "type mismatch");
return result;
}
ir_rvalue *
ast_expression_statement::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
/* It is possible to have expression statements that don't have an
* expression. This is the solitary semicolon:
*
* for (i = 0; i < 5; i++)
* ;
*
* In this case the expression will be NULL. Test for NULL and don't do
* anything in that case.
*/
if (expression != NULL)
expression->hir_no_rvalue(instructions, state);
/* Statements do not have r-values.
*/
return NULL;
}
ir_rvalue *
ast_compound_statement::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
if (new_scope)
state->symbols->push_scope();
foreach_list_typed (ast_node, ast, link, &this->statements)
ast->hir(instructions, state);
if (new_scope)
state->symbols->pop_scope();
/* Compound statements do not have r-values.
*/
return NULL;
}
/**
* Evaluate the given exec_node (which should be an ast_node representing
* a single array dimension) and return its integer value.
*/
static unsigned
process_array_size(exec_node *node,
struct _mesa_glsl_parse_state *state)
{
exec_list dummy_instructions;
ast_node *array_size = exec_node_data(ast_node, node, link);
ir_rvalue *const ir = array_size->hir(& dummy_instructions, state);
YYLTYPE loc = array_size->get_location();
if (ir == NULL) {
_mesa_glsl_error(& loc, state,
"array size could not be resolved");
return 0;
}
if (!ir->type->is_integer()) {
_mesa_glsl_error(& loc, state,
"array size must be integer type");
return 0;
}
if (!ir->type->is_scalar()) {
_mesa_glsl_error(& loc, state,
"array size must be scalar type");
return 0;
}
ir_constant *const size = ir->constant_expression_value();
if (size == NULL) {
_mesa_glsl_error(& loc, state, "array size must be a "
"constant valued expression");
return 0;
}
if (size->value.i[0] <= 0) {
_mesa_glsl_error(& loc, state, "array size must be > 0");
return 0;
}
assert(size->type == ir->type);
/* If the array size is const (and we've verified that
* it is) then no instructions should have been emitted
* when we converted it to HIR. If they were emitted,
* then either the array size isn't const after all, or
* we are emitting unnecessary instructions.
*/
assert(dummy_instructions.is_empty());
return size->value.u[0];
}
static const glsl_type *
process_array_type(YYLTYPE *loc, const glsl_type *base,
ast_array_specifier *array_specifier,
struct _mesa_glsl_parse_state *state)
{
const glsl_type *array_type = base;
if (array_specifier != NULL) {
if (base->is_array()) {
/* From page 19 (page 25) of the GLSL 1.20 spec:
*
* "Only one-dimensional arrays may be declared."
*/
if (!state->ARB_arrays_of_arrays_enable) {
_mesa_glsl_error(loc, state,
"invalid array of `%s'"
"GL_ARB_arrays_of_arrays "
"required for defining arrays of arrays",
base->name);
return glsl_type::error_type;
}
if (base->length == 0) {
_mesa_glsl_error(loc, state,
"only the outermost array dimension can "
"be unsized",
base->name);
return glsl_type::error_type;
}
}
for (exec_node *node = array_specifier->array_dimensions.tail_pred;
!node->is_head_sentinel(); node = node->prev) {
unsigned array_size = process_array_size(node, state);
array_type = glsl_type::get_array_instance(array_type, array_size);
}
if (array_specifier->is_unsized_array)
array_type = glsl_type::get_array_instance(array_type, 0);
}
return array_type;
}
const glsl_type *
ast_type_specifier::glsl_type(const char **name,
struct _mesa_glsl_parse_state *state) const
{
const struct glsl_type *type;
type = state->symbols->get_type(this->type_name);
*name = this->type_name;
YYLTYPE loc = this->get_location();
type = process_array_type(&loc, type, this->array_specifier, state);
return type;
}
const glsl_type *
ast_fully_specified_type::glsl_type(const char **name,
struct _mesa_glsl_parse_state *state) const
{
const struct glsl_type *type = this->specifier->glsl_type(name, state);
if (type == NULL)
return NULL;
/* GLSL Optimizer change: do allow unspecified precision; hlsl2glsl
produces a bunch of wrapper functions without precision specified.
if (type->base_type == GLSL_TYPE_FLOAT
&& state->es_shader
&& state->stage == MESA_SHADER_FRAGMENT
&& this->qualifier.precision == ast_precision_none
&& state->symbols->get_variable("#default precision") == NULL) {
YYLTYPE loc = this->get_location();
_mesa_glsl_error(&loc, state,
"no precision specified this scope for type `%s'",
type->name);
}
*/
return type;
}
/**
* Determine whether a toplevel variable declaration declares a varying. This
* function operates by examining the variable's mode and the shader target,
* so it correctly identifies linkage variables regardless of whether they are
* declared using the deprecated "varying" syntax or the new "in/out" syntax.
*
* Passing a non-toplevel variable declaration (e.g. a function parameter) to
* this function will produce undefined results.
*/
static bool
is_varying_var(ir_variable *var, gl_shader_stage target)
{
switch (target) {
case MESA_SHADER_VERTEX:
return var->data.mode == ir_var_shader_out;
case MESA_SHADER_FRAGMENT:
return var->data.mode == ir_var_shader_in || var->data.mode == ir_var_shader_inout;
default:
return var->data.mode == ir_var_shader_out || var->data.mode == ir_var_shader_in;
}
}
/**
* Matrix layout qualifiers are only allowed on certain types
*/
static void
validate_matrix_layout_for_type(struct _mesa_glsl_parse_state *state,
YYLTYPE *loc,
const glsl_type *type,
ir_variable *var)
{
if (var && !var->is_in_uniform_block()) {
/* Layout qualifiers may only apply to interface blocks and fields in
* them.
*/
_mesa_glsl_error(loc, state,
"uniform block layout qualifiers row_major and "
"column_major may not be applied to variables "
"outside of uniform blocks");
} else if (!type->is_matrix()) {
/* The OpenGL ES 3.0 conformance tests did not originally allow
* matrix layout qualifiers on non-matrices. However, the OpenGL
* 4.4 and OpenGL ES 3.0 (revision TBD) specifications were
* amended to specifically allow these layouts on all types. Emit
* a warning so that people know their code may not be portable.
*/
_mesa_glsl_warning(loc, state,
"uniform block layout qualifiers row_major and "
"column_major applied to non-matrix types may "
"be rejected by older compilers");
} else if (type->is_record()) {
/* We allow 'layout(row_major)' on structure types because it's the only
* way to get row-major layouts on matrices contained in structures.
*/
_mesa_glsl_warning(loc, state,
"uniform block layout qualifiers row_major and "
"column_major applied to structure types is not "
"strictly conformant and may be rejected by other "
"compilers");
}
}
static bool
validate_binding_qualifier(struct _mesa_glsl_parse_state *state,
YYLTYPE *loc,
ir_variable *var,
const ast_type_qualifier *qual)
{
if (var->data.mode != ir_var_uniform) {
_mesa_glsl_error(loc, state,
"the \"binding\" qualifier only applies to uniforms");
return false;
}
if (qual->binding < 0) {
_mesa_glsl_error(loc, state, "binding values must be >= 0");
return false;
}
const struct gl_context *const ctx = state->ctx;
unsigned elements = var->type->is_array() ? var->type->length : 1;
unsigned max_index = qual->binding + elements - 1;
if (var->type->is_interface()) {
/* UBOs. From page 60 of the GLSL 4.20 specification:
* "If the binding point for any uniform block instance is less than zero,
* or greater than or equal to the implementation-dependent maximum
* number of uniform buffer bindings, a compilation error will occur.
* When the binding identifier is used with a uniform block instanced as
* an array of size N, all elements of the array from binding through
* binding + N – 1 must be within this range."
*
* The implementation-dependent maximum is GL_MAX_UNIFORM_BUFFER_BINDINGS.
*/
if (max_index >= ctx->Const.MaxUniformBufferBindings) {
_mesa_glsl_error(loc, state, "layout(binding = %d) for %d UBOs exceeds "
"the maximum number of UBO binding points (%d)",
qual->binding, elements,
ctx->Const.MaxUniformBufferBindings);
return false;
}
} else if (var->type->is_sampler() ||
(var->type->is_array() && var->type->fields.array->is_sampler())) {
/* Samplers. From page 63 of the GLSL 4.20 specification:
* "If the binding is less than zero, or greater than or equal to the
* implementation-dependent maximum supported number of units, a
* compilation error will occur. When the binding identifier is used
* with an array of size N, all elements of the array from binding
* through binding + N - 1 must be within this range."
*/
unsigned limit = ctx->Const.Program[state->stage].MaxTextureImageUnits;
if (max_index >= limit) {
_mesa_glsl_error(loc, state, "layout(binding = %d) for %d samplers "
"exceeds the maximum number of texture image units "
"(%d)", qual->binding, elements, limit);
return false;
}
} else if (var->type->contains_atomic()) {
assert(ctx->Const.MaxAtomicBufferBindings <= MAX_COMBINED_ATOMIC_BUFFERS);
if (unsigned(qual->binding) >= ctx->Const.MaxAtomicBufferBindings) {
_mesa_glsl_error(loc, state, "layout(binding = %d) exceeds the "
" maximum number of atomic counter buffer bindings"
"(%d)", qual->binding,
ctx->Const.MaxAtomicBufferBindings);
return false;
}
} else {
_mesa_glsl_error(loc, state,
"the \"binding\" qualifier only applies to uniform "
"blocks, samplers, atomic counters, or arrays thereof");
return false;
}
return true;
}
static glsl_interp_qualifier
interpret_interpolation_qualifier(const struct ast_type_qualifier *qual,
ir_variable_mode mode,
struct _mesa_glsl_parse_state *state,
YYLTYPE *loc)
{
glsl_interp_qualifier interpolation;
if (qual->flags.q.flat)
interpolation = INTERP_QUALIFIER_FLAT;
else if (qual->flags.q.noperspective)
interpolation = INTERP_QUALIFIER_NOPERSPECTIVE;
else if (qual->flags.q.smooth)
interpolation = INTERP_QUALIFIER_SMOOTH;
else
interpolation = INTERP_QUALIFIER_NONE;
if (interpolation != INTERP_QUALIFIER_NONE) {
if (mode != ir_var_shader_in && mode != ir_var_shader_out) {
_mesa_glsl_error(loc, state,
"interpolation qualifier `%s' can only be applied to "
"shader inputs or outputs.",
interpolation_string(interpolation));
}
if ((state->stage == MESA_SHADER_VERTEX && mode == ir_var_shader_in) ||
(state->stage == MESA_SHADER_FRAGMENT && mode == ir_var_shader_out)) {
_mesa_glsl_error(loc, state,
"interpolation qualifier `%s' cannot be applied to "
"vertex shader inputs or fragment shader outputs",
interpolation_string(interpolation));
}
}
return interpolation;
}
static void
validate_explicit_location(const struct ast_type_qualifier *qual,
ir_variable *var,
struct _mesa_glsl_parse_state *state,
YYLTYPE *loc)
{
bool fail = false;
/* Checks for GL_ARB_explicit_uniform_location. */
if (qual->flags.q.uniform) {
if (!state->check_explicit_uniform_location_allowed(loc, var))
return;
const struct gl_context *const ctx = state->ctx;
unsigned max_loc = qual->location + var->type->uniform_locations() - 1;
/* ARB_explicit_uniform_location specification states:
*
* "The explicitly defined locations and the generated locations
* must be in the range of 0 to MAX_UNIFORM_LOCATIONS minus one."
*
* "Valid locations for default-block uniform variable locations
* are in the range of 0 to the implementation-defined maximum
* number of uniform locations."
*/
if (qual->location < 0) {
_mesa_glsl_error(loc, state,
"explicit location < 0 for uniform %s", var->name);
return;
}
if (max_loc >= ctx->Const.MaxUserAssignableUniformLocations) {
_mesa_glsl_error(loc, state, "location(s) consumed by uniform %s "
">= MAX_UNIFORM_LOCATIONS (%u)", var->name,
ctx->Const.MaxUserAssignableUniformLocations);
return;
}
var->data.explicit_location = true;
var->data.location = qual->location;
return;
}
/* Between GL_ARB_explicit_attrib_location an
* GL_ARB_separate_shader_objects, the inputs and outputs of any shader
* stage can be assigned explicit locations. The checking here associates
* the correct extension with the correct stage's input / output:
*
* input output
* ----- ------
* vertex explicit_loc sso
* geometry sso sso
* fragment sso explicit_loc
*/
switch (state->stage) {
case MESA_SHADER_VERTEX:
if (var->data.mode == ir_var_shader_in) {
if (!state->check_explicit_attrib_location_allowed(loc, var))
return;
break;
}
if (var->data.mode == ir_var_shader_out) {
if (!state->check_separate_shader_objects_allowed(loc, var))
return;
break;
}
fail = true;
break;
case MESA_SHADER_GEOMETRY:
if (var->data.mode == ir_var_shader_in || var->data.mode == ir_var_shader_out) {
if (!state->check_separate_shader_objects_allowed(loc, var))
return;
break;
}
fail = true;
break;
case MESA_SHADER_FRAGMENT:
if (var->data.mode == ir_var_shader_in) {
if (!state->check_separate_shader_objects_allowed(loc, var))
return;
break;
}
if (var->data.mode == ir_var_shader_out) {
if (!state->check_explicit_attrib_location_allowed(loc, var))
return;
break;
}
// EXT_shader_framebuffer_fetch:
// ability to use the inout qualifier at global scope
// in a fragment shader, is optional and must be enabled by
// #extension GL_EXT_shader_framebuffer_fetch
if (var->data.mode == ir_var_shader_inout && state->EXT_shader_framebuffer_fetch_enable) {
break;
}
fail = true;
break;
case MESA_SHADER_COMPUTE:
_mesa_glsl_error(loc, state,
"compute shader variables cannot be given "
"explicit locations");
return;
};
if (fail) {
_mesa_glsl_error(loc, state,
"%s cannot be given an explicit location in %s shader",
mode_string(var),
_mesa_shader_stage_to_string(state->stage));
} else {
var->data.explicit_location = true;
/* This bit of silliness is needed because invalid explicit locations
* are supposed to be flagged during linking. Small negative values
* biased by VERT_ATTRIB_GENERIC0 or FRAG_RESULT_DATA0 could alias
* built-in values (e.g., -16+VERT_ATTRIB_GENERIC0 = VERT_ATTRIB_POS).
* The linker needs to be able to differentiate these cases. This
* ensures that negative values stay negative.
*/
if (qual->location >= 0) {
switch (state->stage) {
case MESA_SHADER_VERTEX:
var->data.location = (var->data.mode == ir_var_shader_in)
? (qual->location + VERT_ATTRIB_GENERIC0)
: (qual->location + VARYING_SLOT_VAR0);
break;
case MESA_SHADER_GEOMETRY:
var->data.location = qual->location + VARYING_SLOT_VAR0;
break;
case MESA_SHADER_FRAGMENT:
var->data.location = (var->data.mode == ir_var_shader_out || var->data.mode == ir_var_shader_inout)
? (qual->location + FRAG_RESULT_DATA0)
: (qual->location + VARYING_SLOT_VAR0);
break;
case MESA_SHADER_COMPUTE:
assert(!"Unexpected shader type");
break;
}
} else {
var->data.location = qual->location;
}
if (qual->flags.q.explicit_index) {
/* From the GLSL 4.30 specification, section 4.4.2 (Output
* Layout Qualifiers):
*
* "It is also a compile-time error if a fragment shader
* sets a layout index to less than 0 or greater than 1."
*
* Older specifications don't mandate a behavior; we take
* this as a clarification and always generate the error.
*/
if (qual->index < 0 || qual->index > 1) {
_mesa_glsl_error(loc, state,
"explicit index may only be 0 or 1");
} else {
var->data.explicit_index = true;
var->data.index = qual->index;
}
}
}
}
static void
apply_image_qualifier_to_variable(const struct ast_type_qualifier *qual,
ir_variable *var,
struct _mesa_glsl_parse_state *state,
YYLTYPE *loc)
{
const glsl_type *base_type =
(var->type->is_array() ? var->type->element_type() : var->type);
if (base_type->is_image()) {
if (var->data.mode != ir_var_uniform &&
var->data.mode != ir_var_function_in) {
_mesa_glsl_error(loc, state, "image variables may only be declared as "
"function parameters or uniform-qualified "
"global variables");
}
var->data.image_read_only |= qual->flags.q.read_only;
var->data.image_write_only |= qual->flags.q.write_only;
var->data.image_coherent |= qual->flags.q.coherent;
var->data.image_volatile |= qual->flags.q._volatile;
var->data.image_restrict |= qual->flags.q.restrict_flag;
var->data.read_only = true;
if (qual->flags.q.explicit_image_format) {
if (var->data.mode == ir_var_function_in) {
_mesa_glsl_error(loc, state, "format qualifiers cannot be "
"used on image function parameters");
}
if (qual->image_base_type != base_type->sampler_type) {
_mesa_glsl_error(loc, state, "format qualifier doesn't match the "
"base data type of the image");
}
var->data.image_format = qual->image_format;
} else {
if (var->data.mode == ir_var_uniform && !qual->flags.q.write_only) {
_mesa_glsl_error(loc, state, "uniforms not qualified with "
"`writeonly' must have a format layout "
"qualifier");
}
var->data.image_format = GL_NONE;
}
}
}
static inline const char*
get_layout_qualifier_string(bool origin_upper_left, bool pixel_center_integer)
{
if (origin_upper_left && pixel_center_integer)
return "origin_upper_left, pixel_center_integer";
else if (origin_upper_left)
return "origin_upper_left";
else if (pixel_center_integer)
return "pixel_center_integer";
else
return " ";
}
static inline bool
is_conflicting_fragcoord_redeclaration(struct _mesa_glsl_parse_state *state,
const struct ast_type_qualifier *qual)
{
/* If gl_FragCoord was previously declared, and the qualifiers were
* different in any way, return true.
*/
if (state->fs_redeclares_gl_fragcoord) {
return (state->fs_pixel_center_integer != qual->flags.q.pixel_center_integer
|| state->fs_origin_upper_left != qual->flags.q.origin_upper_left);
}
return false;
}
static void
apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
ir_variable *var,
struct _mesa_glsl_parse_state *state,
YYLTYPE *loc,
bool is_parameter)
{
STATIC_ASSERT(sizeof(qual->flags.q) <= sizeof(qual->flags.i));
if (qual->flags.q.invariant) {
if (var->data.used) {
_mesa_glsl_error(loc, state,
"variable `%s' may not be redeclared "
"`invariant' after being used",
var->name);
} else {
var->data.invariant = 1;
}
}
if (qual->flags.q.precise) {
if (var->data.used) {
_mesa_glsl_error(loc, state,
"variable `%s' may not be redeclared "
"`precise' after being used",
var->name);
} else {
var->data.precise = 1;
}
}
if (qual->flags.q.constant || qual->flags.q.attribute
|| qual->flags.q.uniform
|| (qual->flags.q.varying && (state->stage == MESA_SHADER_FRAGMENT)))
var->data.read_only = 1;
if (qual->flags.q.centroid)
var->data.centroid = 1;
if (qual->flags.q.sample)
var->data.sample = 1;
if (state->stage == MESA_SHADER_GEOMETRY &&
qual->flags.q.out && qual->flags.q.stream) {
var->data.stream = qual->stream;
}
if (qual->flags.q.attribute && state->stage != MESA_SHADER_VERTEX) {
var->type = glsl_type::error_type;
_mesa_glsl_error(loc, state,
"`attribute' variables may not be declared in the "
"%s shader",
_mesa_shader_stage_to_string(state->stage));
}
/* Disallow layout qualifiers which may only appear on layout declarations. */
if (qual->flags.q.prim_type) {
_mesa_glsl_error(loc, state,
"Primitive type may only be specified on GS input or output "
"layout declaration, not on variables.");
}
/* Section 6.1.1 (Function Calling Conventions) of the GLSL 1.10 spec says:
*
* "However, the const qualifier cannot be used with out or inout."
*
* The same section of the GLSL 4.40 spec further clarifies this saying:
*
* "The const qualifier cannot be used with out or inout, or a
* compile-time error results."
*/
if (is_parameter && qual->flags.q.constant && qual->flags.q.out) {
_mesa_glsl_error(loc, state,
"`const' may not be applied to `out' or `inout' "
"function parameters");
}
/* If there is no qualifier that changes the mode of the variable, leave
* the setting alone.
*/
assert(var->data.mode != ir_var_temporary);
if (qual->flags.q.in && qual->flags.q.out)
{
if (!is_parameter && (state->stage == MESA_SHADER_FRAGMENT))
var->data.mode = ir_var_shader_inout;
else
var->data.mode = ir_var_function_inout;
}
else if (qual->flags.q.in)
var->data.mode = is_parameter ? ir_var_function_in : ir_var_shader_in;
else if (qual->flags.q.attribute
|| (qual->flags.q.varying && (state->stage == MESA_SHADER_FRAGMENT)))
var->data.mode = ir_var_shader_in;
else if (qual->flags.q.out)
var->data.mode = is_parameter ? ir_var_function_out : ir_var_shader_out;
else if (qual->flags.q.varying && (state->stage == MESA_SHADER_VERTEX))
var->data.mode = ir_var_shader_out;
else if (qual->flags.q.uniform)
var->data.mode = ir_var_uniform;
if (!is_parameter && is_varying_var(var, state->stage)) {
/* User-defined ins/outs are not permitted in compute shaders. */
if (state->stage == MESA_SHADER_COMPUTE) {
_mesa_glsl_error(loc, state,
"user-defined input and output variables are not "
"permitted in compute shaders");
}
/* This variable is being used to link data between shader stages (in
* pre-glsl-1.30 parlance, it's a "varying"). Check that it has a type
* that is allowed for such purposes.
*
* From page 25 (page 31 of the PDF) of the GLSL 1.10 spec:
*
* "The varying qualifier can be used only with the data types
* float, vec2, vec3, vec4, mat2, mat3, and mat4, or arrays of
* these."
*
* This was relaxed in GLSL version 1.30 and GLSL ES version 3.00. From
* page 31 (page 37 of the PDF) of the GLSL 1.30 spec:
*
* "Fragment inputs can only be signed and unsigned integers and
* integer vectors, float, floating-point vectors, matrices, or
* arrays of these. Structures cannot be input.
*
* Similar text exists in the section on vertex shader outputs.
*
* Similar text exists in the GLSL ES 3.00 spec, except that the GLSL ES
* 3.00 spec allows structs as well. Varying structs are also allowed
* in GLSL 1.50.
*/
switch (var->type->get_scalar_type()->base_type) {
case GLSL_TYPE_FLOAT:
/* Ok in all GLSL versions */
break;
case GLSL_TYPE_UINT:
case GLSL_TYPE_INT:
if (state->is_version(130, 300))
break;
_mesa_glsl_error(loc, state,
"varying variables must be of base type float in %s",
state->get_version_string());
break;
case GLSL_TYPE_STRUCT:
if (state->is_version(150, 300))
break;
_mesa_glsl_error(loc, state,
"varying variables may not be of type struct");
break;
default:
_mesa_glsl_error(loc, state, "illegal type for a varying variable");
break;
}
}
if (state->all_invariant && (state->current_function == NULL)) {
switch (state->stage) {
case MESA_SHADER_VERTEX:
if (var->data.mode == ir_var_shader_out)
var->data.invariant = true;
break;
case MESA_SHADER_GEOMETRY:
if ((var->data.mode == ir_var_shader_in)
|| (var->data.mode == ir_var_shader_out))
var->data.invariant = true;
break;
case MESA_SHADER_FRAGMENT:
if (var->data.mode == ir_var_shader_in)
var->data.invariant = true;
break;
case MESA_SHADER_COMPUTE:
/* Invariance isn't meaningful in compute shaders. */
break;
}
}
var->data.interpolation =
interpret_interpolation_qualifier(qual, (ir_variable_mode) var->data.mode,
state, loc);
var->data.pixel_center_integer = qual->flags.q.pixel_center_integer;
var->data.origin_upper_left = qual->flags.q.origin_upper_left;
if ((qual->flags.q.origin_upper_left || qual->flags.q.pixel_center_integer)
&& (strcmp(var->name, "gl_FragCoord") != 0)) {
const char *const qual_string = (qual->flags.q.origin_upper_left)
? "origin_upper_left" : "pixel_center_integer";
_mesa_glsl_error(loc, state,
"layout qualifier `%s' can only be applied to "
"fragment shader input `gl_FragCoord'",
qual_string);
}
if (var->name != NULL && strcmp(var->name, "gl_FragCoord") == 0) {
/* Section 4.3.8.1, page 39 of GLSL 1.50 spec says:
*
* "Within any shader, the first redeclarations of gl_FragCoord
* must appear before any use of gl_FragCoord."
*
* Generate a compiler error if above condition is not met by the
* fragment shader.
*/
ir_variable *earlier = state->symbols->get_variable("gl_FragCoord");
if (earlier != NULL &&
earlier->data.used &&
!state->fs_redeclares_gl_fragcoord) {
_mesa_glsl_error(loc, state,
"gl_FragCoord used before its first redeclaration "
"in fragment shader");
}
/* Make sure all gl_FragCoord redeclarations specify the same layout
* qualifiers.
*/
if (is_conflicting_fragcoord_redeclaration(state, qual)) {
const char *const qual_string =
get_layout_qualifier_string(qual->flags.q.origin_upper_left,
qual->flags.q.pixel_center_integer);
const char *const state_string =
get_layout_qualifier_string(state->fs_origin_upper_left,
state->fs_pixel_center_integer);
_mesa_glsl_error(loc, state,
"gl_FragCoord redeclared with different layout "
"qualifiers (%s) and (%s) ",
state_string,
qual_string);
}
state->fs_origin_upper_left = qual->flags.q.origin_upper_left;
state->fs_pixel_center_integer = qual->flags.q.pixel_center_integer;
state->fs_redeclares_gl_fragcoord_with_no_layout_qualifiers =
!qual->flags.q.origin_upper_left && !qual->flags.q.pixel_center_integer;
state->fs_redeclares_gl_fragcoord =
state->fs_origin_upper_left ||
state->fs_pixel_center_integer ||
state->fs_redeclares_gl_fragcoord_with_no_layout_qualifiers;
}
if (qual->flags.q.explicit_location) {
validate_explicit_location(qual, var, state, loc);
} else if (qual->flags.q.explicit_index) {
_mesa_glsl_error(loc, state, "explicit index requires explicit location");
}
if (qual->flags.q.explicit_binding &&
validate_binding_qualifier(state, loc, var, qual)) {
var->data.explicit_binding = true;
var->data.binding = qual->binding;
}
if (var->type->contains_atomic()) {
if (var->data.mode == ir_var_uniform) {
if (var->data.explicit_binding) {
unsigned *offset =
&state->atomic_counter_offsets[var->data.binding];
if (*offset % ATOMIC_COUNTER_SIZE)
_mesa_glsl_error(loc, state,
"misaligned atomic counter offset");
var->data.atomic.offset = *offset;
*offset += var->type->atomic_size();
} else {
_mesa_glsl_error(loc, state,
"atomic counters require explicit binding point");
}
} else if (var->data.mode != ir_var_function_in) {
_mesa_glsl_error(loc, state, "atomic counters may only be declared as "
"function parameters or uniform-qualified "
"global variables");
}
}
/* Does the declaration use the deprecated 'attribute' or 'varying'
* keywords?
*/
const bool uses_deprecated_qualifier = qual->flags.q.attribute
|| qual->flags.q.varying;
/* Validate auxiliary storage qualifiers */
/* From section 4.3.4 of the GLSL 1.30 spec:
* "It is an error to use centroid in in a vertex shader."
*
* From section 4.3.4 of the GLSL ES 3.00 spec:
* "It is an error to use centroid in or interpolation qualifiers in
* a vertex shader input."
*/
/* Section 4.3.6 of the GLSL 1.30 specification states:
* "It is an error to use centroid out in a fragment shader."
*
* The GL_ARB_shading_language_420pack extension specification states:
* "It is an error to use auxiliary storage qualifiers or interpolation
* qualifiers on an output in a fragment shader."
*/
if (qual->flags.q.sample && (!is_varying_var(var, state->stage) || uses_deprecated_qualifier)) {
_mesa_glsl_error(loc, state,
"sample qualifier may only be used on `in` or `out` "
"variables between shader stages");
}
if (qual->flags.q.centroid && !is_varying_var(var, state->stage)) {
_mesa_glsl_error(loc, state,
"centroid qualifier may only be used with `in', "
"`out' or `varying' variables between shader stages");
}
/* Is the 'layout' keyword used with parameters that allow relaxed checking.
* Many implementations of GL_ARB_fragment_coord_conventions_enable and some
* implementations (only Mesa?) GL_ARB_explicit_attrib_location_enable
* allowed the layout qualifier to be used with 'varying' and 'attribute'.
* These extensions and all following extensions that add the 'layout'
* keyword have been modified to require the use of 'in' or 'out'.
*
* The following extension do not allow the deprecated keywords:
*
* GL_AMD_conservative_depth
* GL_ARB_conservative_depth
* GL_ARB_gpu_shader5
* GL_ARB_separate_shader_objects
* GL_ARB_tesselation_shader
* GL_ARB_transform_feedback3
* GL_ARB_uniform_buffer_object
*
* It is unknown whether GL_EXT_shader_image_load_store or GL_NV_gpu_shader5
* allow layout with the deprecated keywords.
*/
const bool relaxed_layout_qualifier_checking =
state->ARB_fragment_coord_conventions_enable;
if (qual->has_layout() && uses_deprecated_qualifier) {
if (relaxed_layout_qualifier_checking) {
_mesa_glsl_warning(loc, state,
"`layout' qualifier may not be used with "
"`attribute' or `varying'");
} else {
_mesa_glsl_error(loc, state,
"`layout' qualifier may not be used with "
"`attribute' or `varying'");
}
}
/* Layout qualifiers for gl_FragDepth, which are enabled by extension
* AMD_conservative_depth.
*/
int depth_layout_count = qual->flags.q.depth_any
+ qual->flags.q.depth_greater
+ qual->flags.q.depth_less
+ qual->flags.q.depth_unchanged;
if (depth_layout_count > 0
&& !state->AMD_conservative_depth_enable
&& !state->ARB_conservative_depth_enable) {
_mesa_glsl_error(loc, state,
"extension GL_AMD_conservative_depth or "
"GL_ARB_conservative_depth must be enabled "
"to use depth layout qualifiers");
} else if (depth_layout_count > 0
&& strcmp(var->name, "gl_FragDepth") != 0) {
_mesa_glsl_error(loc, state,
"depth layout qualifiers can be applied only to "
"gl_FragDepth");
} else if (depth_layout_count > 1
&& strcmp(var->name, "gl_FragDepth") == 0) {
_mesa_glsl_error(loc, state,
"at most one depth layout qualifier can be applied to "
"gl_FragDepth");
}
if (qual->flags.q.depth_any)
var->data.depth_layout = ir_depth_layout_any;
else if (qual->flags.q.depth_greater)
var->data.depth_layout = ir_depth_layout_greater;
else if (qual->flags.q.depth_less)
var->data.depth_layout = ir_depth_layout_less;
else if (qual->flags.q.depth_unchanged)
var->data.depth_layout = ir_depth_layout_unchanged;
else
var->data.depth_layout = ir_depth_layout_none;
if (qual->flags.q.std140 ||
qual->flags.q.packed ||
qual->flags.q.shared) {
_mesa_glsl_error(loc, state,
"uniform block layout qualifiers std140, packed, and "
"shared can only be applied to uniform blocks, not "
"members");
}
if (qual->flags.q.row_major || qual->flags.q.column_major) {
validate_matrix_layout_for_type(state, loc, var->type, var);
}
if (var->type->contains_image())
apply_image_qualifier_to_variable(qual, var, state, loc);
}
/**
* Get the variable that is being redeclared by this declaration
*
* Semantic checks to verify the validity of the redeclaration are also
* performed. If semantic checks fail, compilation error will be emitted via
* \c _mesa_glsl_error, but a non-\c NULL pointer will still be returned.
*
* \returns
* A pointer to an existing variable in the current scope if the declaration
* is a redeclaration, \c NULL otherwise.
*/
static ir_variable *
get_variable_being_redeclared(ir_variable *var, YYLTYPE loc,
struct _mesa_glsl_parse_state *state,
bool allow_all_redeclarations)
{
/* Check if this declaration is actually a re-declaration, either to
* resize an array or add qualifiers to an existing variable.
*
* This is allowed for variables in the current scope, or when at
* global scope (for built-ins in the implicit outer scope).
*/
ir_variable *earlier = state->symbols->get_variable(var->name);
if (earlier == NULL ||
(state->current_function != NULL &&
!state->symbols->name_declared_this_scope(var->name))) {
return NULL;
}
/* From page 24 (page 30 of the PDF) of the GLSL 1.50 spec,
*
* "It is legal to declare an array without a size and then
* later re-declare the same name as an array of the same
* type and specify a size."
*/
if (earlier->type->is_unsized_array() && var->type->is_array()
&& (var->type->element_type() == earlier->type->element_type())) {
/* FINISHME: This doesn't match the qualifiers on the two
* FINISHME: declarations. It's not 100% clear whether this is
* FINISHME: required or not.
*/
const unsigned size = unsigned(var->type->array_size());
check_builtin_array_max_size(var->name, size, loc, state);
if ((size > 0) && (size <= earlier->data.max_array_access)) {
_mesa_glsl_error(& loc, state, "array size must be > %u due to "
"previous access",
earlier->data.max_array_access);
}
earlier->type = var->type;
delete var;
var = NULL;
} else if ((state->ARB_fragment_coord_conventions_enable ||
state->is_version(150, 0))
&& strcmp(var->name, "gl_FragCoord") == 0
&& earlier->type == var->type
&& earlier->data.mode == var->data.mode) {
/* Allow redeclaration of gl_FragCoord for ARB_fcc layout
* qualifiers.
*/
earlier->data.origin_upper_left = var->data.origin_upper_left;
earlier->data.pixel_center_integer = var->data.pixel_center_integer;
/* According to section 4.3.7 of the GLSL 1.30 spec,
* the following built-in varaibles can be redeclared with an
* interpolation qualifier:
* * gl_FrontColor
* * gl_BackColor
* * gl_FrontSecondaryColor
* * gl_BackSecondaryColor
* * gl_Color
* * gl_SecondaryColor
*/
} else if (state->is_version(130, 0)
&& (strcmp(var->name, "gl_FrontColor") == 0
|| strcmp(var->name, "gl_BackColor") == 0
|| strcmp(var->name, "gl_FrontSecondaryColor") == 0
|| strcmp(var->name, "gl_BackSecondaryColor") == 0
|| strcmp(var->name, "gl_Color") == 0
|| strcmp(var->name, "gl_SecondaryColor") == 0)
&& earlier->type == var->type
&& earlier->data.mode == var->data.mode) {
earlier->data.interpolation = var->data.interpolation;
/* Layout qualifiers for gl_FragDepth. */
} else if ((state->AMD_conservative_depth_enable ||
state->ARB_conservative_depth_enable)
&& strcmp(var->name, "gl_FragDepth") == 0
&& earlier->type == var->type
&& earlier->data.mode == var->data.mode) {
/** From the AMD_conservative_depth spec:
* Within any shader, the first redeclarations of gl_FragDepth
* must appear before any use of gl_FragDepth.
*/
if (earlier->data.used) {
_mesa_glsl_error(&loc, state,
"the first redeclaration of gl_FragDepth "
"must appear before any use of gl_FragDepth");
}
/* Prevent inconsistent redeclaration of depth layout qualifier. */
if (earlier->data.depth_layout != ir_depth_layout_none
&& earlier->data.depth_layout != var->data.depth_layout) {
_mesa_glsl_error(&loc, state,
"gl_FragDepth: depth layout is declared here "
"as '%s, but it was previously declared as "
"'%s'",
depth_layout_string(var->data.depth_layout),
depth_layout_string(earlier->data.depth_layout));
}
earlier->data.depth_layout = var->data.depth_layout;
} else if (allow_all_redeclarations) {
if (earlier->data.mode != var->data.mode) {
_mesa_glsl_error(&loc, state,
"redeclaration of `%s' with incorrect qualifiers",
var->name);
} else if (earlier->type != var->type) {
_mesa_glsl_error(&loc, state,
"redeclaration of `%s' has incorrect type",
var->name);
}
} else {
_mesa_glsl_error(&loc, state, "`%s' redeclared", var->name);
}
return earlier;
}
/**
* Generate the IR for an initializer in a variable declaration
*/
ir_rvalue *
process_initializer(ir_variable *var, ast_declaration *decl,
ast_fully_specified_type *type,
exec_list *initializer_instructions,
struct _mesa_glsl_parse_state *state)
{
ir_rvalue *result = NULL;
YYLTYPE initializer_loc = decl->initializer->get_location();
/* From page 24 (page 30 of the PDF) of the GLSL 1.10 spec:
*
* "All uniform variables are read-only and are initialized either
* directly by an application via API commands, or indirectly by
* OpenGL."
*/
if (var->data.mode == ir_var_uniform) {
state->check_version(120, 0, &initializer_loc,
"cannot initialize uniforms");
}
/* From section 4.1.7 of the GLSL 4.40 spec:
*
* "Opaque variables [...] are initialized only through the
* OpenGL API; they cannot be declared with an initializer in a
* shader."
*/
if (var->type->contains_opaque()) {
_mesa_glsl_error(& initializer_loc, state,
"cannot initialize opaque variable");
}
if ((var->data.mode == ir_var_shader_in) && (state->current_function == NULL)) {
_mesa_glsl_error(& initializer_loc, state,
"cannot initialize %s shader input / %s",
_mesa_shader_stage_to_string(state->stage),
(state->stage == MESA_SHADER_VERTEX)
? "attribute" : "varying");
}
/* If the initializer is an ast_aggregate_initializer, recursively store
* type information from the LHS into it, so that its hir() function can do
* type checking.
*/
if (decl->initializer->oper == ast_aggregate)
_mesa_ast_set_aggregate_type(var->type, decl->initializer);
ir_dereference *const lhs = new(state) ir_dereference_variable(var);
ir_rvalue *rhs = decl->initializer->hir(initializer_instructions, state);
/* Propagate precision qualifier for constant value */
if (type->qualifier.flags.q.constant) {
ir_constant *constant_value = rhs->constant_expression_value();
constant_value->set_precision((glsl_precision)type->qualifier.precision);
if (constant_value->type->is_array()) {
for (unsigned i = 0; i < constant_value->type->length; i++) {
constant_value->get_array_element(i)->set_precision((glsl_precision)type->qualifier.precision);
}
}
}
/* Calculate the constant value if this is a const or uniform
* declaration.
*/
if (type->qualifier.flags.q.constant
|| type->qualifier.flags.q.uniform) {
ir_rvalue *new_rhs = validate_assignment(state, initializer_loc,
var->type, rhs, true);
if (new_rhs != NULL) {
rhs = new_rhs;
ir_constant *constant_value = rhs->constant_expression_value();
if (!constant_value) {
/* If ARB_shading_language_420pack is enabled, initializers of
* const-qualified local variables do not have to be constant
* expressions. Const-qualified global variables must still be
* initialized with constant expressions.
*/
if (!state->ARB_shading_language_420pack_enable
|| state->current_function == NULL) {
_mesa_glsl_error(& initializer_loc, state,
"initializer of %s variable `%s' must be a "
"constant expression",
(type->qualifier.flags.q.constant)
? "const" : "uniform",
decl->identifier);
if (var->type->is_numeric()) {
/* Reduce cascading errors. */
var->constant_value = ir_constant::zero(state, var->type);
}
}
} else {
rhs = constant_value;
var->constant_value = constant_value;
}
} else {
if (var->type->is_numeric()) {
/* Reduce cascading errors. */
var->constant_value = ir_constant::zero(state, var->type);
}
}
}
if (rhs && !rhs->type->is_error()) {
bool temp = var->data.read_only;
if (type->qualifier.flags.q.constant)
var->data.read_only = false;
/* Never emit code to initialize a uniform.
*/
const glsl_type *initializer_type;
if (!type->qualifier.flags.q.uniform) {
do_assignment(initializer_instructions, state,
NULL,
lhs, rhs,
&result, true,
true,
type->get_location());
initializer_type = result->type;
} else
initializer_type = rhs->type;
var->constant_initializer = rhs->constant_expression_value();
var->data.has_initializer = true;
/* If the declared variable is an unsized array, it must inherrit
* its full type from the initializer. A declaration such as
*
* uniform float a[] = float[](1.0, 2.0, 3.0, 3.0);
*
* becomes
*
* uniform float a[4] = float[](1.0, 2.0, 3.0, 3.0);
*
* The assignment generated in the if-statement (below) will also
* automatically handle this case for non-uniforms.
*
* If the declared variable is not an array, the types must
* already match exactly. As a result, the type assignment
* here can be done unconditionally. For non-uniforms the call
* to do_assignment can change the type of the initializer (via
* the implicit conversion rules). For uniforms the initializer
* must be a constant expression, and the type of that expression
* was validated above.
*/
var->type = initializer_type;
var->data.read_only = temp;
}
return result;
}
static void
apply_precision_to_variable(const struct ast_type_qualifier& qual,
ir_variable *var, bool function_param,
struct _mesa_glsl_parse_state *state)
{
if (!state->es_shader)
return;
if (var->type->is_sampler() && qual.precision == ast_precision_none && !function_param)
var->data.precision = ast_precision_low; // samplers default to low precision (outside of function arguments)
else
var->data.precision = qual.precision;
}
/**
* Do additional processing necessary for geometry shader input declarations
* (this covers both interface blocks arrays and bare input variables).
*/
static void
handle_geometry_shader_input_decl(struct _mesa_glsl_parse_state *state,
YYLTYPE loc, ir_variable *var)
{
unsigned num_vertices = 0;
if (state->gs_input_prim_type_specified) {
num_vertices = vertices_per_prim(state->in_qualifier->prim_type);
}
/* Geometry shader input variables must be arrays. Caller should have
* reported an error for this.
*/
if (!var->type->is_array()) {
assert(state->error);
/* To avoid cascading failures, short circuit the checks below. */
return;
}
if (var->type->is_unsized_array()) {
/* Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 1.50 spec says:
*
* All geometry shader input unsized array declarations will be
* sized by an earlier input layout qualifier, when present, as per
* the following table.
*
* Followed by a table mapping each allowed input layout qualifier to
* the corresponding input length.
*/
if (num_vertices != 0)
var->type = glsl_type::get_array_instance(var->type->fields.array,
num_vertices);
} else {
/* Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 1.50 spec
* includes the following examples of compile-time errors:
*
* // code sequence within one shader...
* in vec4 Color1[]; // size unknown
* ...Color1.length()...// illegal, length() unknown
* in vec4 Color2[2]; // size is 2
* ...Color1.length()...// illegal, Color1 still has no size
* in vec4 Color3[3]; // illegal, input sizes are inconsistent
* layout(lines) in; // legal, input size is 2, matching
* in vec4 Color4[3]; // illegal, contradicts layout
* ...
*
* To detect the case illustrated by Color3, we verify that the size of
* an explicitly-sized array matches the size of any previously declared
* explicitly-sized array. To detect the case illustrated by Color4, we
* verify that the size of an explicitly-sized array is consistent with
* any previously declared input layout.
*/
if (num_vertices != 0 && var->type->length != num_vertices) {
_mesa_glsl_error(&loc, state,
"geometry shader input size contradicts previously"
" declared layout (size is %u, but layout requires a"
" size of %u)", var->type->length, num_vertices);
} else if (state->gs_input_size != 0 &&
var->type->length != state->gs_input_size) {
_mesa_glsl_error(&loc, state,
"geometry shader input sizes are "
"inconsistent (size is %u, but a previous "
"declaration has size %u)",
var->type->length, state->gs_input_size);
} else {
state->gs_input_size = var->type->length;
}
}
}
void
validate_identifier(const char *identifier, YYLTYPE loc,
struct _mesa_glsl_parse_state *state)
{
/* From page 15 (page 21 of the PDF) of the GLSL 1.10 spec,
*
* "Identifiers starting with "gl_" are reserved for use by
* OpenGL, and may not be declared in a shader as either a
* variable or a function."
*/
if (is_gl_identifier(identifier)) {
_mesa_glsl_error(&loc, state,
"identifier `%s' uses reserved `gl_' prefix",
identifier);
} else if (strstr(identifier, "__")) {
/* From page 14 (page 20 of the PDF) of the GLSL 1.10
* spec:
*
* "In addition, all identifiers containing two
* consecutive underscores (__) are reserved as
* possible future keywords."
*
* The intention is that names containing __ are reserved for internal
* use by the implementation, and names prefixed with GL_ are reserved
* for use by Khronos. Names simply containing __ are dangerous to use,
* but should be allowed.
*
* A future version of the GLSL specification will clarify this.
*/
_mesa_glsl_warning(&loc, state,
"identifier `%s' uses reserved `__' string",
identifier);
}
}
static bool
precision_qualifier_allowed(const glsl_type *type)
{
/* Precision qualifiers apply to floating point, integer and sampler
* types.
*
* Section 4.5.2 (Precision Qualifiers) of the GLSL 1.30 spec says:
* "Any floating point or any integer declaration can have the type
* preceded by one of these precision qualifiers [...] Literal
* constants do not have precision qualifiers. Neither do Boolean
* variables.
*
* Section 4.5 (Precision and Precision Qualifiers) of the GLSL 1.30
* spec also says:
*
* "Precision qualifiers are added for code portability with OpenGL
* ES, not for functionality. They have the same syntax as in OpenGL
* ES."
*
* Section 8 (Built-In Functions) of the GLSL ES 1.00 spec says:
*
* "uniform lowp sampler2D sampler;
* highp vec2 coord;
* ...
* lowp vec4 col = texture2D (sampler, coord);
* // texture2D returns lowp"
*
* From this, we infer that GLSL 1.30 (and later) should allow precision
* qualifiers on sampler types just like float and integer types.
*/
return type->is_float()
|| type->is_integer()
|| type->is_record()
|| type->is_sampler();
}
ir_rvalue *
ast_declarator_list::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
void *ctx = state;
const struct glsl_type *decl_type;
const char *type_name = NULL;
ir_rvalue *result = NULL;
YYLTYPE loc = this->get_location();
/* From page 46 (page 52 of the PDF) of the GLSL 1.50 spec:
*
* "To ensure that a particular output variable is invariant, it is
* necessary to use the invariant qualifier. It can either be used to
* qualify a previously declared variable as being invariant
*
* invariant gl_Position; // make existing gl_Position be invariant"
*
* In these cases the parser will set the 'invariant' flag in the declarator
* list, and the type will be NULL.
*/
if (this->invariant) {
assert(this->type == NULL);
if (state->current_function != NULL) {
_mesa_glsl_error(& loc, state,
"all uses of `invariant' keyword must be at global "
"scope");
}
foreach_list_typed (ast_declaration, decl, link, &this->declarations) {
assert(decl->array_specifier == NULL);
assert(decl->initializer == NULL);
ir_variable *const earlier =
state->symbols->get_variable(decl->identifier);
if (earlier == NULL) {
_mesa_glsl_error(& loc, state,
"undeclared variable `%s' cannot be marked "
"invariant", decl->identifier);
} else if (!is_varying_var(earlier, state->stage)) {
_mesa_glsl_error(&loc, state,
"`%s' cannot be marked invariant; interfaces between "
"shader stages only.", decl->identifier);
} else if (earlier->data.used) {
_mesa_glsl_error(& loc, state,
"variable `%s' may not be redeclared "
"`invariant' after being used",
earlier->name);
} else {
earlier->data.invariant = true;
}
}
/* Invariant redeclarations do not have r-values.
*/
return NULL;
}
if (this->precise) {
assert(this->type == NULL);
foreach_list_typed (ast_declaration, decl, link, &this->declarations) {
assert(decl->array_specifier == NULL);
assert(decl->initializer == NULL);
ir_variable *const earlier =
state->symbols->get_variable(decl->identifier);
if (earlier == NULL) {
_mesa_glsl_error(& loc, state,
"undeclared variable `%s' cannot be marked "
"precise", decl->identifier);
} else if (state->current_function != NULL &&
!state->symbols->name_declared_this_scope(decl->identifier)) {
/* Note: we have to check if we're in a function, since
* builtins are treated as having come from another scope.
*/
_mesa_glsl_error(& loc, state,
"variable `%s' from an outer scope may not be "
"redeclared `precise' in this scope",
earlier->name);
} else if (earlier->data.used) {
_mesa_glsl_error(& loc, state,
"variable `%s' may not be redeclared "
"`precise' after being used",
earlier->name);
} else {
earlier->data.precise = true;
}
}
/* Precise redeclarations do not have r-values either. */
return NULL;
}
assert(this->type != NULL);
assert(!this->invariant);
assert(!this->precise);
/* The type specifier may contain a structure definition. Process that
* before any of the variable declarations.
*/
(void) this->type->specifier->hir(instructions, state);
decl_type = this->type->glsl_type(& type_name, state);
/* An offset-qualified atomic counter declaration sets the default
* offset for the next declaration within the same atomic counter
* buffer.
*/
if (decl_type && decl_type->contains_atomic()) {
if (type->qualifier.flags.q.explicit_binding &&
type->qualifier.flags.q.explicit_offset)
state->atomic_counter_offsets[type->qualifier.binding] =
type->qualifier.offset;
}
if (this->declarations.is_empty()) {
/* If there is no structure involved in the program text, there are two
* possible scenarios:
*
* - The program text contained something like 'vec4;'. This is an
* empty declaration. It is valid but weird. Emit a warning.
*
* - The program text contained something like 'S;' and 'S' is not the
* name of a known structure type. This is both invalid and weird.
* Emit an error.
*
* - The program text contained something like 'mediump float;'
* when the programmer probably meant 'precision mediump
* float;' Emit a warning with a description of what they
* probably meant to do.
*
* Note that if decl_type is NULL and there is a structure involved,
* there must have been some sort of error with the structure. In this
* case we assume that an error was already generated on this line of
* code for the structure. There is no need to generate an additional,
* confusing error.
*/
assert(this->type->specifier->structure == NULL || decl_type != NULL
|| state->error);
if (decl_type == NULL) {
_mesa_glsl_error(&loc, state,
"invalid type `%s' in empty declaration",
type_name);
} else if (decl_type->base_type == GLSL_TYPE_ATOMIC_UINT) {
/* Empty atomic counter declarations are allowed and useful
* to set the default offset qualifier.
*/
return NULL;
} else if (this->type->qualifier.precision != ast_precision_none) {
if (this->type->specifier->structure != NULL) {
_mesa_glsl_error(&loc, state,
"precision qualifiers can't be applied "
"to structures");
} else {
static const char *const precision_names[] = {
"highp",
"highp",
"mediump",
"lowp"
};
_mesa_glsl_warning(&loc, state,
"empty declaration with precision qualifier, "
"to set the default precision, use "
"`precision %s %s;'",
precision_names[this->type->qualifier.precision],
type_name);
}
} else if (this->type->specifier->structure == NULL) {
_mesa_glsl_warning(&loc, state, "empty declaration");
}
}
foreach_list_typed (ast_declaration, decl, link, &this->declarations) {
const struct glsl_type *var_type;
ir_variable *var;
/* FINISHME: Emit a warning if a variable declaration shadows a
* FINISHME: declaration at a higher scope.
*/
if ((decl_type == NULL) || decl_type->is_void()) {
if (type_name != NULL) {
_mesa_glsl_error(& loc, state,
"invalid type `%s' in declaration of `%s'",
type_name, decl->identifier);
} else {
_mesa_glsl_error(& loc, state,
"invalid type in declaration of `%s'",
decl->identifier);
}
continue;
}
var_type = process_array_type(&loc, decl_type, decl->array_specifier,
state);
var = new(ctx) ir_variable(var_type, decl->identifier, ir_var_auto, (glsl_precision)this->type->qualifier.precision);
/* The 'varying in' and 'varying out' qualifiers can only be used with
* ARB_geometry_shader4 and EXT_geometry_shader4, which we don't support
* yet.
*/
if (this->type->qualifier.flags.q.varying) {
if (this->type->qualifier.flags.q.in) {
_mesa_glsl_error(& loc, state,
"`varying in' qualifier in declaration of "
"`%s' only valid for geometry shaders using "
"ARB_geometry_shader4 or EXT_geometry_shader4",
decl->identifier);
} else if (this->type->qualifier.flags.q.out) {
_mesa_glsl_error(& loc, state,
"`varying out' qualifier in declaration of "
"`%s' only valid for geometry shaders using "
"ARB_geometry_shader4 or EXT_geometry_shader4",
decl->identifier);
}
}
/* From page 22 (page 28 of the PDF) of the GLSL 1.10 specification;
*
* "Global variables can only use the qualifiers const,
* attribute, uniform, or varying. Only one may be
* specified.
*
* Local variables can only use the qualifier const."
*
* This is relaxed in GLSL 1.30 and GLSL ES 3.00. It is also relaxed by
* any extension that adds the 'layout' keyword.
*/
if (!state->is_version(130, 300)
&& !state->has_explicit_attrib_location()
&& !state->has_separate_shader_objects()
&& !state->ARB_fragment_coord_conventions_enable) {
if (this->type->qualifier.flags.q.out) {
_mesa_glsl_error(& loc, state,
"`out' qualifier in declaration of `%s' "
"only valid for function parameters in %s",
decl->identifier, state->get_version_string());
}
if (this->type->qualifier.flags.q.in) {
_mesa_glsl_error(& loc, state,
"`in' qualifier in declaration of `%s' "
"only valid for function parameters in %s",
decl->identifier, state->get_version_string());
}
/* FINISHME: Test for other invalid qualifiers. */
}
apply_type_qualifier_to_variable(& this->type->qualifier, var, state,
& loc, false);
apply_precision_to_variable(this->type->qualifier, var, false, state);
if (this->type->qualifier.flags.q.invariant) {
if (!is_varying_var(var, state->stage)) {
_mesa_glsl_error(&loc, state,
"`%s' cannot be marked invariant; interfaces between "
"shader stages only", var->name);
}
}
if (state->current_function != NULL) {
const char *mode = NULL;
const char *extra = "";
/* There is no need to check for 'inout' here because the parser will
* only allow that in function parameter lists.
*/
if (this->type->qualifier.flags.q.attribute) {
mode = "attribute";
} else if (this->type->qualifier.flags.q.uniform) {
mode = "uniform";
} else if (this->type->qualifier.flags.q.varying) {
mode = "varying";
} else if (this->type->qualifier.flags.q.in) {
mode = "in";
extra = " or in function parameter list";
} else if (this->type->qualifier.flags.q.out) {
mode = "out";
extra = " or in function parameter list";
}
if (mode) {
_mesa_glsl_error(& loc, state,
"%s variable `%s' must be declared at "
"global scope%s",
mode, var->name, extra);
}
} else if (var->data.mode == ir_var_shader_in) {
var->data.read_only = true;
if (state->stage == MESA_SHADER_VERTEX) {
bool error_emitted = false;
/* From page 31 (page 37 of the PDF) of the GLSL 1.50 spec:
*
* "Vertex shader inputs can only be float, floating-point
* vectors, matrices, signed and unsigned integers and integer
* vectors. Vertex shader inputs can also form arrays of these
* types, but not structures."
*
* From page 31 (page 27 of the PDF) of the GLSL 1.30 spec:
*
* "Vertex shader inputs can only be float, floating-point
* vectors, matrices, signed and unsigned integers and integer
* vectors. They cannot be arrays or structures."
*
* From page 23 (page 29 of the PDF) of the GLSL 1.20 spec:
*
* "The attribute qualifier can be used only with float,
* floating-point vectors, and matrices. Attribute variables
* cannot be declared as arrays or structures."
*
* From page 33 (page 39 of the PDF) of the GLSL ES 3.00 spec:
*
* "Vertex shader inputs can only be float, floating-point
* vectors, matrices, signed and unsigned integers and integer
* vectors. Vertex shader inputs cannot be arrays or
* structures."
*/
const glsl_type *check_type = var->type;
while (check_type->is_array())
check_type = check_type->element_type();
switch (check_type->base_type) {
case GLSL_TYPE_FLOAT:
break;
case GLSL_TYPE_UINT:
case GLSL_TYPE_INT:
if (state->is_version(120, 300))
break;
/* FALLTHROUGH */
default:
_mesa_glsl_error(& loc, state,
"vertex shader input / attribute cannot have "
"type %s`%s'",
var->type->is_array() ? "array of " : "",
check_type->name);
error_emitted = true;
}
if (!error_emitted && var->type->is_array() &&
!state->check_version(150, 0, &loc,
"vertex shader input / attribute "
"cannot have array type")) {
error_emitted = true;
}
} else if (state->stage == MESA_SHADER_GEOMETRY) {
/* From section 4.3.4 (Inputs) of the GLSL 1.50 spec:
*
* Geometry shader input variables get the per-vertex values
* written out by vertex shader output variables of the same
* names. Since a geometry shader operates on a set of
* vertices, each input varying variable (or input block, see
* interface blocks below) needs to be declared as an array.
*/
if (!var->type->is_array()) {
_mesa_glsl_error(&loc, state,
"geometry shader inputs must be arrays");
}
handle_geometry_shader_input_decl(state, loc, var);
}
}
/* Integer fragment inputs must be qualified with 'flat'. In GLSL ES,
* so must integer vertex outputs.
*
* From section 4.3.4 ("Inputs") of the GLSL 1.50 spec:
* "Fragment shader inputs that are signed or unsigned integers or
* integer vectors must be qualified with the interpolation qualifier
* flat."
*
* From section 4.3.4 ("Input Variables") of the GLSL 3.00 ES spec:
* "Fragment shader inputs that are, or contain, signed or unsigned
* integers or integer vectors must be qualified with the
* interpolation qualifier flat."
*
* From section 4.3.6 ("Output Variables") of the GLSL 3.00 ES spec:
* "Vertex shader outputs that are, or contain, signed or unsigned
* integers or integer vectors must be qualified with the
* interpolation qualifier flat."
*
* Note that prior to GLSL 1.50, this requirement applied to vertex
* outputs rather than fragment inputs. That creates problems in the
* presence of geometry shaders, so we adopt the GLSL 1.50 rule for all
* desktop GL shaders. For GLSL ES shaders, we follow the spec and
* apply the restriction to both vertex outputs and fragment inputs.
*
* Note also that the desktop GLSL specs are missing the text "or
* contain"; this is presumably an oversight, since there is no
* reasonable way to interpolate a fragment shader input that contains
* an integer.
*/
if (state->is_version(130, 300) &&
var->type->contains_integer() &&
var->data.interpolation != INTERP_QUALIFIER_FLAT &&
((state->stage == MESA_SHADER_FRAGMENT && var->data.mode == ir_var_shader_in)
|| (state->stage == MESA_SHADER_VERTEX && var->data.mode == ir_var_shader_out
&& state->es_shader))) {
const char *var_type = (state->stage == MESA_SHADER_VERTEX) ?
"vertex output" : "fragment input";
_mesa_glsl_error(&loc, state, "if a %s is (or contains) "
"an integer, then it must be qualified with 'flat'",
var_type);
}
/* Interpolation qualifiers cannot be applied to 'centroid' and
* 'centroid varying'.
*
* From page 29 (page 35 of the PDF) of the GLSL 1.30 spec:
* "interpolation qualifiers may only precede the qualifiers in,
* centroid in, out, or centroid out in a declaration. They do not apply
* to the deprecated storage qualifiers varying or centroid varying."
*
* These deprecated storage qualifiers do not exist in GLSL ES 3.00.
*/
if (state->is_version(130, 0)
&& this->type->qualifier.has_interpolation()
&& this->type->qualifier.flags.q.varying) {
const char *i = this->type->qualifier.interpolation_string();
assert(i != NULL);
const char *s;
if (this->type->qualifier.flags.q.centroid)
s = "centroid varying";
else
s = "varying";
_mesa_glsl_error(&loc, state,
"qualifier '%s' cannot be applied to the "
"deprecated storage qualifier '%s'", i, s);
}
/* Interpolation qualifiers can only apply to vertex shader outputs and
* fragment shader inputs.
*
* From page 29 (page 35 of the PDF) of the GLSL 1.30 spec:
* "Outputs from a vertex shader (out) and inputs to a fragment
* shader (in) can be further qualified with one or more of these
* interpolation qualifiers"
*
* From page 31 (page 37 of the PDF) of the GLSL ES 3.00 spec:
* "These interpolation qualifiers may only precede the qualifiers
* in, centroid in, out, or centroid out in a declaration. They do
* not apply to inputs into a vertex shader or outputs from a
* fragment shader."
*/
if (state->is_version(130, 300)
&& this->type->qualifier.has_interpolation()) {
const char *i = this->type->qualifier.interpolation_string();
assert(i != NULL);
switch (state->stage) {
case MESA_SHADER_VERTEX:
if (this->type->qualifier.flags.q.in) {
_mesa_glsl_error(&loc, state,
"qualifier '%s' cannot be applied to vertex "
"shader inputs", i);
}
break;
case MESA_SHADER_FRAGMENT:
if (this->type->qualifier.flags.q.out) {
_mesa_glsl_error(&loc, state,
"qualifier '%s' cannot be applied to fragment "
"shader outputs", i);
}
break;
default:
break;
}
}
/* Precision qualifiers exists only in GLSL versions 1.00 and >= 1.30.
*/
if (this->type->qualifier.precision != ast_precision_none) {
state->check_precision_qualifiers_allowed(&loc);
}
/* If a precision qualifier is allowed on a type, it is allowed on
* an array of that type.
*/
if (!(this->type->qualifier.precision == ast_precision_none
|| precision_qualifier_allowed(var->type)
|| (var->type->is_array()
&& precision_qualifier_allowed(var->type->fields.array)))) {
_mesa_glsl_error(&loc, state,
"precision qualifiers apply only to floating point"
", integer and sampler types");
}
/* From section 4.1.7 of the GLSL 4.40 spec:
*
* "[Opaque types] can only be declared as function
* parameters or uniform-qualified variables."
*/
if (var_type->contains_opaque() &&
!this->type->qualifier.flags.q.uniform) {
_mesa_glsl_error(&loc, state,
"opaque variables must be declared uniform");
}
/* Process the initializer and add its instructions to a temporary
* list. This list will be added to the instruction stream (below) after
* the declaration is added. This is done because in some cases (such as
* redeclarations) the declaration may not actually be added to the
* instruction stream.
*/
exec_list initializer_instructions;
/* Examine var name here since var may get deleted in the next call */
bool var_is_gl_id = is_gl_identifier(var->name);
ir_variable *earlier =
get_variable_being_redeclared(var, decl->get_location(), state,
false /* allow_all_redeclarations */);
if (earlier != NULL) {
if (var_is_gl_id &&
earlier->data.how_declared == ir_var_declared_in_block) {
_mesa_glsl_error(&loc, state,
"`%s' has already been redeclared using "
"gl_PerVertex", var->name);
}
earlier->data.how_declared = ir_var_declared_normally;
}
if (decl->initializer != NULL) {
result = process_initializer((earlier == NULL) ? var : earlier,
decl, this->type,
&initializer_instructions, state);
}
/* From page 23 (page 29 of the PDF) of the GLSL 1.10 spec:
*
* "It is an error to write to a const variable outside of
* its declaration, so they must be initialized when
* declared."
*/
if (this->type->qualifier.flags.q.constant && decl->initializer == NULL) {
_mesa_glsl_error(& loc, state,
"const declaration of `%s' must be initialized",
decl->identifier);
}
if (state->es_shader) {
const glsl_type *const t = (earlier == NULL)
? var->type : earlier->type;
if (t->is_unsized_array())
/* Section 10.17 of the GLSL ES 1.00 specification states that
* unsized array declarations have been removed from the language.
* Arrays that are sized using an initializer are still explicitly
* sized. However, GLSL ES 1.00 does not allow array
* initializers. That is only allowed in GLSL ES 3.00.
*
* Section 4.1.9 (Arrays) of the GLSL ES 3.00 spec says:
*
* "An array type can also be formed without specifying a size
* if the definition includes an initializer:
*
* float x[] = float[2] (1.0, 2.0); // declares an array of size 2
* float y[] = float[] (1.0, 2.0, 3.0); // declares an array of size 3
*
* float a[5];
* float b[] = a;"
*/
_mesa_glsl_error(& loc, state,
"unsized array declarations are not allowed in "
"GLSL ES");
}
/* If the declaration is not a redeclaration, there are a few additional
* semantic checks that must be applied. In addition, variable that was
* created for the declaration should be added to the IR stream.
*/
if (earlier == NULL) {
validate_identifier(decl->identifier, loc, state);
/* Add the variable to the symbol table. Note that the initializer's
* IR was already processed earlier (though it hasn't been emitted
* yet), without the variable in scope.
*
* This differs from most C-like languages, but it follows the GLSL
* specification. From page 28 (page 34 of the PDF) of the GLSL 1.50
* spec:
*
* "Within a declaration, the scope of a name starts immediately
* after the initializer if present or immediately after the name
* being declared if not."
*/
if (!state->symbols->add_variable(var)) {
YYLTYPE loc = this->get_location();
_mesa_glsl_error(&loc, state, "name `%s' already taken in the "
"current scope", decl->identifier);
continue;
}
/* Push the variable declaration to the top. It means that all the
* variable declarations will appear in a funny last-to-first order,
* but otherwise we run into trouble if a function is prototyped, a
* global var is decled, then the function is defined with usage of
* the global var. See glslparsertest's CorrectModule.frag.
* However, do not insert declarations before default precision statements
* or type declarations.
*/
ir_instruction* before_node = (ir_instruction*)instructions->head;
while (before_node && (before_node->ir_type == ir_type_precision || before_node->ir_type == ir_type_typedecl))
before_node = (ir_instruction*)before_node->next;
if (before_node)
before_node->insert_before(var);
else
instructions->push_head(var);
}
instructions->append_list(&initializer_instructions);
}
/* Generally, variable declarations do not have r-values. However,
* one is used for the declaration in
*
* while (bool b = some_condition()) {
* ...
* }
*
* so we return the rvalue from the last seen declaration here.
*/
return result;
}
ir_rvalue *
ast_parameter_declarator::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
void *ctx = state;
const struct glsl_type *type;
const char *name = NULL;
YYLTYPE loc = this->get_location();
type = this->type->glsl_type(& name, state);
if (type == NULL) {
if (name != NULL) {
_mesa_glsl_error(& loc, state,
"invalid type `%s' in declaration of `%s'",
name, this->identifier);
} else {
_mesa_glsl_error(& loc, state,
"invalid type in declaration of `%s'",
this->identifier);
}
type = glsl_type::error_type;
}
/* From page 62 (page 68 of the PDF) of the GLSL 1.50 spec:
*
* "Functions that accept no input arguments need not use void in the
* argument list because prototypes (or definitions) are required and
* therefore there is no ambiguity when an empty argument list "( )" is
* declared. The idiom "(void)" as a parameter list is provided for
* convenience."
*
* Placing this check here prevents a void parameter being set up
* for a function, which avoids tripping up checks for main taking
* parameters and lookups of an unnamed symbol.
*/
if (type->is_void()) {
if (this->identifier != NULL)
_mesa_glsl_error(& loc, state,
"named parameter cannot have type `void'");
is_void = true;
return NULL;
}
if (formal_parameter && (this->identifier == NULL)) {
_mesa_glsl_error(& loc, state, "formal parameter lacks a name");
return NULL;
}
/* This only handles "vec4 foo[..]". The earlier specifier->glsl_type(...)
* call already handled the "vec4[..] foo" case.
*/
type = process_array_type(&loc, type, this->array_specifier, state);
if (!type->is_error() && type->is_unsized_array()) {
_mesa_glsl_error(&loc, state, "arrays passed as parameters must have "
"a declared size");
type = glsl_type::error_type;
}
is_void = false;
ir_variable *var = new(ctx)
ir_variable(type, this->identifier, ir_var_function_in, (glsl_precision)this->type->qualifier.precision);
/* Apply any specified qualifiers to the parameter declaration. Note that
* for function parameters the default mode is 'in'.
*/
apply_type_qualifier_to_variable(& this->type->qualifier, var, state, & loc,
true);
apply_precision_to_variable(this->type->qualifier, var, true, state);
/* From section 4.1.7 of the GLSL 4.40 spec:
*
* "Opaque variables cannot be treated as l-values; hence cannot
* be used as out or inout function parameters, nor can they be
* assigned into."
*/
if ((var->data.mode == ir_var_function_inout || var->data.mode == ir_var_function_out)
&& type->contains_opaque()) {
_mesa_glsl_error(&loc, state, "out and inout parameters cannot "
"contain opaque variables");
type = glsl_type::error_type;
}
/* From page 39 (page 45 of the PDF) of the GLSL 1.10 spec:
*
* "When calling a function, expressions that do not evaluate to
* l-values cannot be passed to parameters declared as out or inout."
*
* From page 32 (page 38 of the PDF) of the GLSL 1.10 spec:
*
* "Other binary or unary expressions, non-dereferenced arrays,
* function names, swizzles with repeated fields, and constants
* cannot be l-values."
*
* So for GLSL 1.10, passing an array as an out or inout parameter is not
* allowed. This restriction is removed in GLSL 1.20, and in GLSL ES.
*/
if ((var->data.mode == ir_var_function_inout || var->data.mode == ir_var_function_out)
&& type->is_array()
&& !state->check_version(120, 100, &loc,
"arrays cannot be out or inout parameters")) {
type = glsl_type::error_type;
}
instructions->push_tail(var);
/* Parameter declarations do not have r-values.
*/
return NULL;
}
void
ast_parameter_declarator::parameters_to_hir(exec_list *ast_parameters,
bool formal,
exec_list *ir_parameters,
_mesa_glsl_parse_state *state)
{
ast_parameter_declarator *void_param = NULL;
unsigned count = 0;
foreach_list_typed (ast_parameter_declarator, param, link, ast_parameters) {
param->formal_parameter = formal;
param->hir(ir_parameters, state);
if (param->is_void)
void_param = param;
count++;
}
if ((void_param != NULL) && (count > 1)) {
YYLTYPE loc = void_param->get_location();
_mesa_glsl_error(& loc, state,
"`void' parameter must be only parameter");
}
}
void
emit_function(_mesa_glsl_parse_state *state, ir_function *f)
{
/* IR invariants disallow function declarations or definitions
* nested within other function definitions. But there is no
* requirement about the relative order of function declarations
* and definitions with respect to one another. So simply insert
* the new ir_function block at the end of the toplevel instruction
* list.
*/
state->toplevel_ir->push_tail(f);
}
ir_rvalue *
ast_function::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
void *ctx = state;
ir_function *f = NULL;
ir_function_signature *sig = NULL;
exec_list hir_parameters;
const char *const name = identifier;
/* New functions are always added to the top-level IR instruction stream,
* so this instruction list pointer is ignored. See also emit_function
* (called below).
*/
(void) instructions;
/* From page 21 (page 27 of the PDF) of the GLSL 1.20 spec,
*
* "Function declarations (prototypes) cannot occur inside of functions;
* they must be at global scope, or for the built-in functions, outside
* the global scope."
*
* From page 27 (page 33 of the PDF) of the GLSL ES 1.00.16 spec,
*
* "User defined functions may only be defined within the global scope."
*
* Note that this language does not appear in GLSL 1.10.
*/
if ((state->current_function != NULL) &&
state->is_version(120, 100)) {
YYLTYPE loc = this->get_location();
_mesa_glsl_error(&loc, state,
"declaration of function `%s' not allowed within "
"function body", name);
}
validate_identifier(name, this->get_location(), state);
/* Convert the list of function parameters to HIR now so that they can be
* used below to compare this function's signature with previously seen
* signatures for functions with the same name.
*/
ast_parameter_declarator::parameters_to_hir(& this->parameters,
is_definition,
& hir_parameters, state);
const char *return_type_name;
const glsl_type *return_type =
this->return_type->glsl_type(& return_type_name, state);
if (!return_type) {
YYLTYPE loc = this->get_location();
_mesa_glsl_error(&loc, state,
"function `%s' has undeclared return type `%s'",
name, return_type_name);
return_type = glsl_type::error_type;
}
/* From page 56 (page 62 of the PDF) of the GLSL 1.30 spec:
* "No qualifier is allowed on the return type of a function."
*/
if (this->return_type->has_qualifiers()) {
YYLTYPE loc = this->get_location();
_mesa_glsl_error(& loc, state,
"function `%s' return type has qualifiers", name);
}
/* Section 6.1 (Function Definitions) of the GLSL 1.20 spec says:
*
* "Arrays are allowed as arguments and as the return type. In both
* cases, the array must be explicitly sized."
*/
if (return_type->is_unsized_array()) {
YYLTYPE loc = this->get_location();
_mesa_glsl_error(& loc, state,
"function `%s' return type array must be explicitly "
"sized", name);
}
/* From section 4.1.7 of the GLSL 4.40 spec:
*
* "[Opaque types] can only be declared as function parameters
* or uniform-qualified variables."
*/
if (return_type->contains_opaque()) {
YYLTYPE loc = this->get_location();
_mesa_glsl_error(&loc, state,
"function `%s' return type can't contain an opaque type",
name);
}
/* Create an ir_function if one doesn't already exist. */
f = state->symbols->get_function(name);
if (f == NULL) {
f = new(ctx) ir_function(name);
if (!state->symbols->add_function(f)) {
/* This function name shadows a non-function use of the same name. */
YYLTYPE loc = this->get_location();
_mesa_glsl_error(&loc, state, "function name `%s' conflicts with "
"non-function", name);
return NULL;
}
emit_function(state, f);
}
/* Verify that this function's signature either doesn't match a previously
* seen signature for a function with the same name, or, if a match is found,
* that the previously seen signature does not have an associated definition.
*/
if (state->es_shader || f->has_user_signature()) {
sig = f->exact_matching_signature(state, &hir_parameters);
if (sig != NULL) {
const char *badvar = sig->qualifiers_match(&hir_parameters);
if (badvar != NULL) {
YYLTYPE loc = this->get_location();
_mesa_glsl_error(&loc, state, "function `%s' parameter `%s' "
"qualifiers don't match prototype", name, badvar);
}
if (sig->return_type != return_type) {
YYLTYPE loc = this->get_location();
_mesa_glsl_error(&loc, state, "function `%s' return type doesn't "
"match prototype", name);
}
if (sig->is_defined) {
if (is_definition) {
YYLTYPE loc = this->get_location();
_mesa_glsl_error(& loc, state, "function `%s' redefined", name);
} else {
/* We just encountered a prototype that exactly matches a
* function that's already been defined. This is redundant,
* and we should ignore it.
*/
return NULL;
}
}
}
}
/* Verify the return type of main() */
if (strcmp(name, "main") == 0) {
if (! return_type->is_void()) {
YYLTYPE loc = this->get_location();
_mesa_glsl_error(& loc, state, "main() must return void");
}
if (!hir_parameters.is_empty()) {
YYLTYPE loc = this->get_location();
_mesa_glsl_error(& loc, state, "main() must not take any parameters");
}
}
/* Finish storing the information about this new function in its signature.
*/
if (sig == NULL) {
sig = new(ctx) ir_function_signature(return_type, (glsl_precision)this->return_type->qualifier.precision);
f->add_signature(sig);
}
sig->replace_parameters(&hir_parameters);
signature = sig;
/* Function declarations (prototypes) do not have r-values.
*/
return NULL;
}
ir_rvalue *
ast_function_definition::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
prototype->is_definition = true;
prototype->hir(instructions, state);
ir_function_signature *signature = prototype->signature;
if (signature == NULL)
return NULL;
assert(state->current_function == NULL);
state->current_function = signature;
state->found_return = false;
/* Duplicate parameters declared in the prototype as concrete variables.
* Add these to the symbol table.
*/
state->symbols->push_scope();
foreach_in_list(ir_variable, var, &signature->parameters) {
assert(var->as_variable() != NULL);
/* The only way a parameter would "exist" is if two parameters have
* the same name.
*/
if (state->symbols->name_declared_this_scope(var->name)) {
YYLTYPE loc = this->get_location();
_mesa_glsl_error(& loc, state, "parameter `%s' redeclared", var->name);
} else {
state->symbols->add_variable(var);
}
}
/* Convert the body of the function to HIR. */
this->body->hir(&signature->body, state);
signature->is_defined = true;
state->symbols->pop_scope();
assert(state->current_function == signature);
state->current_function = NULL;
if (!signature->return_type->is_void() && !state->found_return) {
YYLTYPE loc = this->get_location();
_mesa_glsl_error(& loc, state, "function `%s' has non-void return type "
"%s, but no return statement",
signature->function_name(),
signature->return_type->name);
}
/* Function definitions do not have r-values.
*/
return NULL;
}
ir_rvalue *
ast_jump_statement::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
void *ctx = state;
switch (mode) {
case ast_return: {
ir_return *inst;
assert(state->current_function);
if (opt_return_value) {
ir_rvalue *ret = opt_return_value->hir(instructions, state);
/* The value of the return type can be NULL if the shader says
* 'return foo();' and foo() is a function that returns void.
*
* NOTE: The GLSL spec doesn't say that this is an error. The type
* of the return value is void. If the return type of the function is
* also void, then this should compile without error. Seriously.
*/
const glsl_type *const ret_type =
(ret == NULL) ? glsl_type::void_type : ret->type;
/* Implicit conversions are not allowed for return values prior to
* ARB_shading_language_420pack.
*/
if (state->current_function->return_type != ret_type) {
YYLTYPE loc = this->get_location();
if (state->ARB_shading_language_420pack_enable) {
if (!apply_implicit_conversion(state->current_function->return_type,
ret, state)) {
_mesa_glsl_error(& loc, state,
"could not implicitly convert return value "
"to %s, in function `%s'",
state->current_function->return_type->name,
state->current_function->function_name());
}
} else {
_mesa_glsl_error(& loc, state,
"`return' with wrong type %s, in function `%s' "
"returning %s",
ret_type->name,
state->current_function->function_name(),
state->current_function->return_type->name);
}
} else if (state->current_function->return_type->base_type ==
GLSL_TYPE_VOID) {
YYLTYPE loc = this->get_location();
/* The ARB_shading_language_420pack, GLSL ES 3.0, and GLSL 4.20
* specs add a clarification:
*
* "A void function can only use return without a return argument, even if
* the return argument has void type. Return statements only accept values:
*
* void func1() { }
* void func2() { return func1(); } // illegal return statement"
*/
_mesa_glsl_error(& loc, state,
"void functions can only use `return' without a "
"return argument");
}
inst = new(ctx) ir_return(ret);
} else {
if (state->current_function->return_type->base_type !=
GLSL_TYPE_VOID) {
YYLTYPE loc = this->get_location();
_mesa_glsl_error(& loc, state,
"`return' with no value, in function %s returning "
"non-void",
state->current_function->function_name());
}
inst = new(ctx) ir_return;
}
state->found_return = true;
instructions->push_tail(inst);
break;
}
case ast_discard:
if (state->stage != MESA_SHADER_FRAGMENT) {
YYLTYPE loc = this->get_location();
_mesa_glsl_error(& loc, state,
"`discard' may only appear in a fragment shader");
}
instructions->push_tail(new(ctx) ir_discard);
break;
case ast_break:
case ast_continue:
if (mode == ast_continue &&
state->loop_nesting_ast == NULL) {
YYLTYPE loc = this->get_location();
_mesa_glsl_error(& loc, state, "continue may only appear in a loop");
} else if (mode == ast_break &&
state->loop_nesting_ast == NULL &&
state->switch_state.switch_nesting_ast == NULL) {
YYLTYPE loc = this->get_location();
_mesa_glsl_error(& loc, state,
"break may only appear in a loop or a switch");
} else {
/* For a loop, inline the for loop expression again, since we don't
* know where near the end of the loop body the normal copy of it is
* going to be placed. Same goes for the condition for a do-while
* loop.
*/
if (state->loop_nesting_ast != NULL &&
mode == ast_continue) {
if (state->loop_nesting_ast->rest_expression) {
state->loop_nesting_ast->rest_expression->hir(instructions,
state);
}
if (state->loop_nesting_ast->mode ==
ast_iteration_statement::ast_do_while) {
state->loop_nesting_ast->condition_to_hir(instructions, state);
}
}
if (state->switch_state.is_switch_innermost &&
mode == ast_break) {
/* Force break out of switch by setting is_break switch state.
*/
ir_variable *const is_break_var = state->switch_state.is_break_var;
ir_dereference_variable *const deref_is_break_var =
new(ctx) ir_dereference_variable(is_break_var);
ir_constant *const true_val = new(ctx) ir_constant(true);
ir_assignment *const set_break_var =
new(ctx) ir_assignment(deref_is_break_var, true_val);
instructions->push_tail(set_break_var);
}
else {
ir_loop_jump *const jump =
new(ctx) ir_loop_jump((mode == ast_break)
? ir_loop_jump::jump_break
: ir_loop_jump::jump_continue);
instructions->push_tail(jump);
}
}
break;
}
/* Jump instructions do not have r-values.
*/
return NULL;
}
ir_rvalue *
ast_selection_statement::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
void *ctx = state;
ir_rvalue *const condition = this->condition->hir(instructions, state);
/* From page 66 (page 72 of the PDF) of the GLSL 1.50 spec:
*
* "Any expression whose type evaluates to a Boolean can be used as the
* conditional expression bool-expression. Vector types are not accepted
* as the expression to if."
*
* The checks are separated so that higher quality diagnostics can be
* generated for cases where both rules are violated.
*/
if (!condition->type->is_boolean() || !condition->type->is_scalar()) {
YYLTYPE loc = this->condition->get_location();
_mesa_glsl_error(& loc, state, "if-statement condition must be scalar "
"boolean");
}
ir_if *const stmt = new(ctx) ir_if(condition);
if (then_statement != NULL) {
state->symbols->push_scope();
then_statement->hir(& stmt->then_instructions, state);
state->symbols->pop_scope();
}
if (else_statement != NULL) {
state->symbols->push_scope();
else_statement->hir(& stmt->else_instructions, state);
state->symbols->pop_scope();
}
instructions->push_tail(stmt);
/* if-statements do not have r-values.
*/
return NULL;
}
ir_rvalue *
ast_switch_statement::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
void *ctx = state;
ir_rvalue *const test_expression =
this->test_expression->hir(instructions, state);
/* From page 66 (page 55 of the PDF) of the GLSL 1.50 spec:
*
* "The type of init-expression in a switch statement must be a
* scalar integer."
*/
if (!test_expression->type->is_scalar() ||
!test_expression->type->is_integer()) {
YYLTYPE loc = this->test_expression->get_location();
_mesa_glsl_error(& loc,
state,
"switch-statement expression must be scalar "
"integer");
}
/* Track the switch-statement nesting in a stack-like manner.
*/
struct glsl_switch_state saved = state->switch_state;
state->switch_state.is_switch_innermost = true;
state->switch_state.switch_nesting_ast = this;
state->switch_state.labels_ht = hash_table_ctor(0, hash_table_pointer_hash,
hash_table_pointer_compare);
state->switch_state.previous_default = NULL;
/* Initalize is_fallthru state to false.
*/
ir_rvalue *const is_fallthru_val = new (ctx) ir_constant(false);
state->switch_state.is_fallthru_var =
new(ctx) ir_variable(glsl_type::bool_type,
"switch_is_fallthru_tmp",
ir_var_temporary, glsl_precision_low);
instructions->push_tail(state->switch_state.is_fallthru_var);
ir_dereference_variable *deref_is_fallthru_var =
new(ctx) ir_dereference_variable(state->switch_state.is_fallthru_var);
instructions->push_tail(new(ctx) ir_assignment(deref_is_fallthru_var,
is_fallthru_val));
/* Initalize is_break state to false.
*/
ir_rvalue *const is_break_val = new (ctx) ir_constant(false);
state->switch_state.is_break_var =
new(ctx) ir_variable(glsl_type::bool_type,
"switch_is_break_tmp",
ir_var_temporary, glsl_precision_low);
instructions->push_tail(state->switch_state.is_break_var);
ir_dereference_variable *deref_is_break_var =
new(ctx) ir_dereference_variable(state->switch_state.is_break_var);
instructions->push_tail(new(ctx) ir_assignment(deref_is_break_var,
is_break_val));
state->switch_state.run_default =
new(ctx) ir_variable(glsl_type::bool_type,
"run_default_tmp",
ir_var_temporary, glsl_precision_low);
instructions->push_tail(state->switch_state.run_default);
/* Cache test expression.
*/
test_to_hir(instructions, state);
/* Emit code for body of switch stmt.
*/
body->hir(instructions, state);
hash_table_dtor(state->switch_state.labels_ht);
state->switch_state = saved;
/* Switch statements do not have r-values. */
return NULL;
}
void
ast_switch_statement::test_to_hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
void *ctx = state;
/* Cache value of test expression. */
ir_rvalue *const test_val =
test_expression->hir(instructions,
state);
state->switch_state.test_var = new(ctx) ir_variable(test_val->type,
"switch_test_tmp",
ir_var_temporary, test_val->get_precision());
ir_dereference_variable *deref_test_var =
new(ctx) ir_dereference_variable(state->switch_state.test_var);
instructions->push_tail(state->switch_state.test_var);
instructions->push_tail(new(ctx) ir_assignment(deref_test_var, test_val));
}
ir_rvalue *
ast_switch_body::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
if (stmts != NULL)
stmts->hir(instructions, state);
/* Switch bodies do not have r-values. */
return NULL;
}
ir_rvalue *
ast_case_statement_list::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
exec_list default_case, after_default, tmp;
foreach_list_typed (ast_case_statement, case_stmt, link, & this->cases) {
case_stmt->hir(&tmp, state);
/* Default case. */
if (state->switch_state.previous_default && default_case.is_empty()) {
default_case.append_list(&tmp);
continue;
}
/* If default case found, append 'after_default' list. */
if (!default_case.is_empty())
after_default.append_list(&tmp);
else
instructions->append_list(&tmp);
}
/* Handle the default case. This is done here because default might not be
* the last case. We need to add checks against following cases first to see
* if default should be chosen or not.
*/
if (!default_case.is_empty()) {
ir_rvalue *const true_val = new (state) ir_constant(true);
ir_dereference_variable *deref_run_default_var =
new(state) ir_dereference_variable(state->switch_state.run_default);
/* Choose to run default case initially, following conditional
* assignments might change this.
*/
ir_assignment *const init_var =
new(state) ir_assignment(deref_run_default_var, true_val);
instructions->push_tail(init_var);
/* Default case was the last one, no checks required. */
if (after_default.is_empty()) {
instructions->append_list(&default_case);
return NULL;
}
foreach_in_list(ir_instruction, ir, &after_default) {
ir_assignment *assign = ir->as_assignment();
if (!assign)
continue;
/* Clone the check between case label and init expression. */
ir_expression *exp = (ir_expression*) assign->condition;
ir_expression *clone = exp->clone(state, NULL);
ir_dereference_variable *deref_var =
new(state) ir_dereference_variable(state->switch_state.run_default);
ir_rvalue *const false_val = new (state) ir_constant(false);
ir_assignment *const set_false =
new(state) ir_assignment(deref_var, false_val, clone);
instructions->push_tail(set_false);
}
/* Append default case and all cases after it. */
instructions->append_list(&default_case);
instructions->append_list(&after_default);
}
/* Case statements do not have r-values. */
return NULL;
}
ir_rvalue *
ast_case_statement::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
labels->hir(instructions, state);
/* Conditionally set fallthru state based on break state. */
ir_constant *const false_val = new(state) ir_constant(false);
ir_dereference_variable *const deref_is_fallthru_var =
new(state) ir_dereference_variable(state->switch_state.is_fallthru_var);
ir_dereference_variable *const deref_is_break_var =
new(state) ir_dereference_variable(state->switch_state.is_break_var);
ir_assignment *const reset_fallthru_on_break =
new(state) ir_assignment(deref_is_fallthru_var,
false_val,
deref_is_break_var);
instructions->push_tail(reset_fallthru_on_break);
/* Guard case statements depending on fallthru state. */
ir_dereference_variable *const deref_fallthru_guard =
new(state) ir_dereference_variable(state->switch_state.is_fallthru_var);
ir_if *const test_fallthru = new(state) ir_if(deref_fallthru_guard);
foreach_list_typed (ast_node, stmt, link, & this->stmts)
stmt->hir(& test_fallthru->then_instructions, state);
instructions->push_tail(test_fallthru);
/* Case statements do not have r-values. */
return NULL;
}
ir_rvalue *
ast_case_label_list::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
foreach_list_typed (ast_case_label, label, link, & this->labels)
label->hir(instructions, state);
/* Case labels do not have r-values. */
return NULL;
}
ir_rvalue *
ast_case_label::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
void *ctx = state;
ir_dereference_variable *deref_fallthru_var =
new(ctx) ir_dereference_variable(state->switch_state.is_fallthru_var);
ir_rvalue *const true_val = new(ctx) ir_constant(true);
/* If not default case, ... */
if (this->test_value != NULL) {
/* Conditionally set fallthru state based on
* comparison of cached test expression value to case label.
*/
ir_rvalue *const label_rval = this->test_value->hir(instructions, state);
ir_constant *label_const = label_rval->constant_expression_value();
if (!label_const) {
YYLTYPE loc = this->test_value->get_location();
_mesa_glsl_error(& loc, state,
"switch statement case label must be a "
"constant expression");
/* Stuff a dummy value in to allow processing to continue. */
label_const = new(ctx) ir_constant(0);
} else {
ast_expression *previous_label = (ast_expression *)
hash_table_find(state->switch_state.labels_ht,
(void *)(uintptr_t)label_const->value.u[0]);
if (previous_label) {
YYLTYPE loc = this->test_value->get_location();
_mesa_glsl_error(& loc, state, "duplicate case value");
loc = previous_label->get_location();
_mesa_glsl_error(& loc, state, "this is the previous case label");
} else {
hash_table_insert(state->switch_state.labels_ht,
this->test_value,
(void *)(uintptr_t)label_const->value.u[0]);
}
}
ir_dereference_variable *deref_test_var =
new(ctx) ir_dereference_variable(state->switch_state.test_var);
ir_expression *test_cond = new(ctx) ir_expression(ir_binop_all_equal,
label_const,
deref_test_var);
/*
* From GLSL 4.40 specification section 6.2 ("Selection"):
*
* "The type of the init-expression value in a switch statement must
* be a scalar int or uint. The type of the constant-expression value
* in a case label also must be a scalar int or uint. When any pair
* of these values is tested for "equal value" and the types do not
* match, an implicit conversion will be done to convert the int to a
* uint (see section 4.1.10 “Implicit Conversions”) before the compare
* is done."
*/
if (label_const->type != state->switch_state.test_var->type) {
YYLTYPE loc = this->test_value->get_location();
const glsl_type *type_a = label_const->type;
const glsl_type *type_b = state->switch_state.test_var->type;
/* Check if int->uint implicit conversion is supported. */
bool integer_conversion_supported =
glsl_type::int_type->can_implicitly_convert_to(glsl_type::uint_type,
state);
if ((!type_a->is_integer() || !type_b->is_integer()) ||
!integer_conversion_supported) {
_mesa_glsl_error(&loc, state, "type mismatch with switch "
"init-expression and case label (%s != %s)",
type_a->name, type_b->name);
} else {
/* Conversion of the case label. */
if (type_a->base_type == GLSL_TYPE_INT) {
if (!apply_implicit_conversion(glsl_type::uint_type,
test_cond->operands[0], state))
_mesa_glsl_error(&loc, state, "implicit type conversion error");
} else {
/* Conversion of the init-expression value. */
if (!apply_implicit_conversion(glsl_type::uint_type,
test_cond->operands[1], state))
_mesa_glsl_error(&loc, state, "implicit type conversion error");
}
}
}
ir_assignment *set_fallthru_on_test =
new(ctx) ir_assignment(deref_fallthru_var, true_val, test_cond);
instructions->push_tail(set_fallthru_on_test);
} else { /* default case */
if (state->switch_state.previous_default) {
YYLTYPE loc = this->get_location();
_mesa_glsl_error(& loc, state,
"multiple default labels in one switch");
loc = state->switch_state.previous_default->get_location();
_mesa_glsl_error(& loc, state, "this is the first default label");
}
state->switch_state.previous_default = this;
/* Set fallthru condition on 'run_default' bool. */
ir_dereference_variable *deref_run_default =
new(ctx) ir_dereference_variable(state->switch_state.run_default);
ir_rvalue *const cond_true = new(ctx) ir_constant(true);
ir_expression *test_cond = new(ctx) ir_expression(ir_binop_all_equal,
cond_true,
deref_run_default);
/* Set falltrhu state. */
ir_assignment *set_fallthru =
new(ctx) ir_assignment(deref_fallthru_var, true_val, test_cond);
instructions->push_tail(set_fallthru);
}
/* Case statements do not have r-values. */
return NULL;
}
void
ast_iteration_statement::condition_to_hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
void *ctx = state;
if (condition != NULL) {
ir_rvalue *const cond =
condition->hir(instructions, state);
if ((cond == NULL)
|| !cond->type->is_boolean() || !cond->type->is_scalar()) {
YYLTYPE loc = condition->get_location();
_mesa_glsl_error(& loc, state,
"loop condition must be scalar boolean");
} else {
/* As the first code in the loop body, generate a block that looks
* like 'if (!condition) break;' as the loop termination condition.
*/
ir_rvalue *const not_cond =
new(ctx) ir_expression(ir_unop_logic_not, cond);
ir_if *const if_stmt = new(ctx) ir_if(not_cond);
ir_jump *const break_stmt =
new(ctx) ir_loop_jump(ir_loop_jump::jump_break);
if_stmt->then_instructions.push_tail(break_stmt);
instructions->push_tail(if_stmt);
}
}
}
ir_rvalue *
ast_iteration_statement::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
void *ctx = state;
/* For-loops and while-loops start a new scope, but do-while loops do not.
*/
if (mode != ast_do_while)
state->symbols->push_scope();
if (init_statement != NULL)
init_statement->hir(instructions, state);
ir_loop *const stmt = new(ctx) ir_loop();
instructions->push_tail(stmt);
/* Track the current loop nesting. */
ast_iteration_statement *nesting_ast = state->loop_nesting_ast;
state->loop_nesting_ast = this;
/* Likewise, indicate that following code is closest to a loop,
* NOT closest to a switch.
*/
bool saved_is_switch_innermost = state->switch_state.is_switch_innermost;
state->switch_state.is_switch_innermost = false;
if (mode != ast_do_while)
condition_to_hir(&stmt->body_instructions, state);
if (body != NULL)
body->hir(& stmt->body_instructions, state);
if (rest_expression != NULL)
rest_expression->hir(& stmt->body_instructions, state);
if (mode == ast_do_while)
condition_to_hir(&stmt->body_instructions, state);
if (mode != ast_do_while)
state->symbols->pop_scope();
/* Restore previous nesting before returning. */
state->loop_nesting_ast = nesting_ast;
state->switch_state.is_switch_innermost = saved_is_switch_innermost;
/* Loops do not have r-values.
*/
return NULL;
}
/**
* Determine if the given type is valid for establishing a default precision
* qualifier.
*
* From GLSL ES 3.00 section 4.5.4 ("Default Precision Qualifiers"):
*
* "The precision statement
*
* precision precision-qualifier type;
*
* can be used to establish a default precision qualifier. The type field
* can be either int or float or any of the sampler types, and the
* precision-qualifier can be lowp, mediump, or highp."
*
* GLSL ES 1.00 has similar language. GLSL 1.30 doesn't allow precision
* qualifiers on sampler types, but this seems like an oversight (since the
* intention of including these in GLSL 1.30 is to allow compatibility with ES
* shaders). So we allow int, float, and all sampler types regardless of GLSL
* version.
*/
static bool
is_valid_default_precision_type(const struct glsl_type *const type)
{
if (type == NULL)
return false;
switch (type->base_type) {
case GLSL_TYPE_INT:
case GLSL_TYPE_FLOAT:
/* "int" and "float" are valid, but vectors and matrices are not. */
return type->vector_elements == 1 && type->matrix_columns == 1;
case GLSL_TYPE_SAMPLER:
return true;
default:
return false;
}
}
ir_rvalue *
ast_type_specifier::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
if (this->default_precision == ast_precision_none && this->structure == NULL)
return NULL;
YYLTYPE loc = this->get_location();
/* If this is a precision statement, check that the type to which it is
* applied is either float or int.
*
* From section 4.5.3 of the GLSL 1.30 spec:
* "The precision statement
* precision precision-qualifier type;
* can be used to establish a default precision qualifier. The type
* field can be either int or float [...]. Any other types or
* qualifiers will result in an error.
*/
if (this->default_precision != ast_precision_none) {
if (!state->check_precision_qualifiers_allowed(&loc))
return NULL;
if (this->structure != NULL) {
_mesa_glsl_error(&loc, state,
"precision qualifiers do not apply to structures");
return NULL;
}
if (this->array_specifier != NULL) {
_mesa_glsl_error(&loc, state,
"default precision statements do not apply to "
"arrays");
return NULL;
}
const struct glsl_type *const type =
state->symbols->get_type(this->type_name);
if (!is_valid_default_precision_type(type)) {
_mesa_glsl_error(&loc, state,
"default precision statements apply only to "
"float, int, and sampler types");
return NULL;
}
{
void *ctx = state;
const char* precision_type = NULL;
switch (this->default_precision) {
case glsl_precision_high: precision_type = "highp"; break;
case glsl_precision_medium: precision_type = "mediump"; break;
case glsl_precision_low: precision_type = "lowp"; break;
case glsl_precision_undefined: precision_type = ""; break;
}
char* precision_statement = ralloc_asprintf(ctx, "precision %s %s", precision_type, this->type_name);
ir_precision_statement *const stmt = new(ctx) ir_precision_statement(precision_statement);
instructions->push_head(stmt);
}
if (type->base_type == GLSL_TYPE_FLOAT
&& state->es_shader
&& state->stage == MESA_SHADER_FRAGMENT) {
/* Section 4.5.3 (Default Precision Qualifiers) of the GLSL ES 1.00
* spec says:
*
* "The fragment language has no default precision qualifier for
* floating point types."
*
* As a result, we have to track whether or not default precision has
* been specified for float in GLSL ES fragment shaders.
*
* Earlier in that same section, the spec says:
*
* "Non-precision qualified declarations will use the precision
* qualifier specified in the most recent precision statement
* that is still in scope. The precision statement has the same
* scoping rules as variable declarations. If it is declared
* inside a compound statement, its effect stops at the end of
* the innermost statement it was declared in. Precision
* statements in nested scopes override precision statements in
* outer scopes. Multiple precision statements for the same basic
* type can appear inside the same scope, with later statements
* overriding earlier statements within that scope."
*
* Default precision specifications follow the same scope rules as
* variables. So, we can track the state of the default float
* precision in the symbol table, and the rules will just work. This
* is a slight abuse of the symbol table, but it has the semantics
* that we want.
*/
ir_variable *const junk =
new(state) ir_variable(type, "#default precision",
ir_var_auto, (glsl_precision)this->default_precision);
state->symbols->add_variable(junk);
state->had_float_precision = true;
}
/* FINISHME: Translate precision statements into IR. */
return NULL;
}
/* _mesa_ast_set_aggregate_type() sets the <structure> field so that
* process_record_constructor() can do type-checking on C-style initializer
* expressions of structs, but ast_struct_specifier should only be translated
* to HIR if it is declaring the type of a structure.
*
* The ->is_declaration field is false for initializers of variables
* declared separately from the struct's type definition.
*
* struct S { ... }; (is_declaration = true)
* struct T { ... } t = { ... }; (is_declaration = true)
* S s = { ... }; (is_declaration = false)
*/
if (this->structure != NULL && this->structure->is_declaration)
return this->structure->hir(instructions, state);
return NULL;
}
/**
* Process a structure or interface block tree into an array of structure fields
*
* After parsing, where there are some syntax differnces, structures and
* interface blocks are almost identical. They are similar enough that the
* AST for each can be processed the same way into a set of
* \c glsl_struct_field to describe the members.
*
* If we're processing an interface block, var_mode should be the type of the
* interface block (ir_var_shader_in, ir_var_shader_out, or ir_var_uniform).
* If we're processing a structure, var_mode should be ir_var_auto.
*
* \return
* The number of fields processed. A pointer to the array structure fields is
* stored in \c *fields_ret.
*/
unsigned
ast_process_structure_or_interface_block(exec_list *instructions,
struct _mesa_glsl_parse_state *state,
exec_list *declarations,
YYLTYPE &loc,
glsl_struct_field **fields_ret,
bool is_interface,
enum glsl_matrix_layout matrix_layout,
bool allow_reserved_names,
ir_variable_mode var_mode)
{
unsigned decl_count = 0;
/* Make an initial pass over the list of fields to determine how
* many there are. Each element in this list is an ast_declarator_list.
* This means that we actually need to count the number of elements in the
* 'declarations' list in each of the elements.
*/
foreach_list_typed (ast_declarator_list, decl_list, link, declarations) {
decl_count += decl_list->declarations.length();
}
/* Allocate storage for the fields and process the field
* declarations. As the declarations are processed, try to also convert
* the types to HIR. This ensures that structure definitions embedded in
* other structure definitions or in interface blocks are processed.
*/
glsl_struct_field *const fields = ralloc_array(state, glsl_struct_field,
decl_count);
unsigned i = 0;
foreach_list_typed (ast_declarator_list, decl_list, link, declarations) {
const char *type_name;
decl_list->type->specifier->hir(instructions, state);
/* Section 10.9 of the GLSL ES 1.00 specification states that
* embedded structure definitions have been removed from the language.
*/
if (state->es_shader && decl_list->type->specifier->structure != NULL) {
_mesa_glsl_error(&loc, state, "embedded structure definitions are "
"not allowed in GLSL ES 1.00");
}
const glsl_type *decl_type =
decl_list->type->glsl_type(& type_name, state);
foreach_list_typed (ast_declaration, decl, link,
&decl_list->declarations) {
if (!allow_reserved_names)
validate_identifier(decl->identifier, loc, state);
/* From section 4.3.9 of the GLSL 4.40 spec:
*
* "[In interface blocks] opaque types are not allowed."
*
* It should be impossible for decl_type to be NULL here. Cases that
* might naturally lead to decl_type being NULL, especially for the
* is_interface case, will have resulted in compilation having
* already halted due to a syntax error.
*/
const struct glsl_type *field_type =
decl_type != NULL ? decl_type : glsl_type::error_type;
if (is_interface && field_type->contains_opaque()) {
YYLTYPE loc = decl_list->get_location();
_mesa_glsl_error(&loc, state,
"uniform in non-default uniform block contains "
"opaque variable");
}
if (field_type->contains_atomic()) {
/* FINISHME: Add a spec quotation here once updated spec
* FINISHME: language is available. See Khronos bug #10903
* FINISHME: on whether atomic counters are allowed in
* FINISHME: structures.
*/
YYLTYPE loc = decl_list->get_location();
_mesa_glsl_error(&loc, state, "atomic counter in structure or "
"uniform block");
}
if (field_type->contains_image()) {
/* FINISHME: Same problem as with atomic counters.
* FINISHME: Request clarification from Khronos and add
* FINISHME: spec quotation here.
*/
YYLTYPE loc = decl_list->get_location();
_mesa_glsl_error(&loc, state,
"image in structure or uniform block");
}
const struct ast_type_qualifier *const qual =
& decl_list->type->qualifier;
if (qual->flags.q.std140 ||
qual->flags.q.packed ||
qual->flags.q.shared) {
_mesa_glsl_error(&loc, state,
"uniform block layout qualifiers std140, packed, and "
"shared can only be applied to uniform blocks, not "
"members");
}
field_type = process_array_type(&loc, decl_type,
decl->array_specifier, state);
fields[i].type = field_type;
fields[i].name = decl->identifier;
fields[i].precision = (glsl_precision)decl_list->type->qualifier.precision;
fields[i].location = -1;
fields[i].interpolation =
interpret_interpolation_qualifier(qual, var_mode, state, &loc);
fields[i].centroid = qual->flags.q.centroid ? 1 : 0;
fields[i].sample = qual->flags.q.sample ? 1 : 0;
/* Only save explicitly defined streams in block's field */
fields[i].stream = qual->flags.q.explicit_stream ? qual->stream : -1;
if (qual->flags.q.row_major || qual->flags.q.column_major) {
if (!qual->flags.q.uniform) {
_mesa_glsl_error(&loc, state,
"row_major and column_major can only be "
"applied to uniform interface blocks");
} else
validate_matrix_layout_for_type(state, &loc, field_type, NULL);
}
if (qual->flags.q.uniform && qual->has_interpolation()) {
_mesa_glsl_error(&loc, state,
"interpolation qualifiers cannot be used "
"with uniform interface blocks");
}
if ((qual->flags.q.uniform || !is_interface) &&
qual->has_auxiliary_storage()) {
_mesa_glsl_error(&loc, state,
"auxiliary storage qualifiers cannot be used "
"in uniform blocks or structures.");
}
/* Propogate row- / column-major information down the fields of the
* structure or interface block. Structures need this data because
* the structure may contain a structure that contains ... a matrix
* that need the proper layout.
*/
if (field_type->without_array()->is_matrix()
|| field_type->without_array()->is_record()) {
/* If no layout is specified for the field, inherit the layout
* from the block.
*/
fields[i].matrix_layout = matrix_layout;
if (qual->flags.q.row_major)
fields[i].matrix_layout = GLSL_MATRIX_LAYOUT_ROW_MAJOR;
else if (qual->flags.q.column_major)
fields[i].matrix_layout = GLSL_MATRIX_LAYOUT_COLUMN_MAJOR;
/* If we're processing an interface block, the matrix layout must
* be decided by this point.
*/
assert(!is_interface
|| fields[i].matrix_layout == GLSL_MATRIX_LAYOUT_ROW_MAJOR
|| fields[i].matrix_layout == GLSL_MATRIX_LAYOUT_COLUMN_MAJOR);
}
i++;
}
}
assert(i == decl_count);
*fields_ret = fields;
return decl_count;
}
ir_rvalue *
ast_struct_specifier::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
YYLTYPE loc = this->get_location();
/* Section 4.1.8 (Structures) of the GLSL 1.10 spec says:
*
* "Anonymous structures are not supported; so embedded structures must
* have a declarator. A name given to an embedded struct is scoped at
* the same level as the struct it is embedded in."
*
* The same section of the GLSL 1.20 spec says:
*
* "Anonymous structures are not supported. Embedded structures are not
* supported.
*
* struct S { float f; };
* struct T {
* S; // Error: anonymous structures disallowed
* struct { ... }; // Error: embedded structures disallowed
* S s; // Okay: nested structures with name are allowed
* };"
*
* The GLSL ES 1.00 and 3.00 specs have similar langauge and examples. So,
* we allow embedded structures in 1.10 only.
*/
if (state->language_version != 110 && state->struct_specifier_depth != 0)
_mesa_glsl_error(&loc, state,
"embedded structure declarations are not allowed");
state->struct_specifier_depth++;
glsl_struct_field *fields;
unsigned decl_count =
ast_process_structure_or_interface_block(instructions,
state,
&this->declarations,
loc,
&fields,
false,
GLSL_MATRIX_LAYOUT_INHERITED,
false /* allow_reserved_names */,
ir_var_auto);
validate_identifier(this->name, loc, state);
const glsl_type *t =
glsl_type::get_record_instance(fields, decl_count, this->name);
if (!state->symbols->add_type(name, t)) {
_mesa_glsl_error(& loc, state, "struct `%s' previously defined", name);
} else {
const glsl_type **s = reralloc(state, state->user_structures,
const glsl_type *,
state->num_user_structures + 1);
if (s != NULL) {
s[state->num_user_structures] = t;
state->user_structures = s;
state->num_user_structures++;
ir_typedecl_statement* stmt = new(state) ir_typedecl_statement(t);
/* Push the struct declarations to the top.
* However, do not insert declarations before default precision
* statements or other declarations
*/
ir_instruction* before_node = (ir_instruction*)instructions->head;
while (before_node &&
(before_node->ir_type == ir_type_precision ||
before_node->ir_type == ir_type_typedecl))
before_node = (ir_instruction*)before_node->next;
if (before_node)
before_node->insert_before(stmt);
else
instructions->push_head(stmt);
}
}
state->struct_specifier_depth--;
/* Structure type definitions do not have r-values.
*/
return NULL;
}
/**
* Visitor class which detects whether a given interface block has been used.
*/
class interface_block_usage_visitor : public ir_hierarchical_visitor
{
public:
interface_block_usage_visitor(ir_variable_mode mode, const glsl_type *block)
: mode(mode), block(block), found(false)
{
}
virtual ir_visitor_status visit(ir_dereference_variable *ir)
{
if (ir->var->data.mode == mode && ir->var->get_interface_type() == block) {
found = true;
return visit_stop;
}
return visit_continue;
}
bool usage_found() const
{
return this->found;
}
private:
ir_variable_mode mode;
const glsl_type *block;
bool found;
};
ir_rvalue *
ast_interface_block::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
YYLTYPE loc = this->get_location();
/* The ast_interface_block has a list of ast_declarator_lists. We
* need to turn those into ir_variables with an association
* with this uniform block.
*/
enum glsl_interface_packing packing;
if (this->layout.flags.q.shared) {
packing = GLSL_INTERFACE_PACKING_SHARED;
} else if (this->layout.flags.q.packed) {
packing = GLSL_INTERFACE_PACKING_PACKED;
} else {
/* The default layout is std140.
*/
packing = GLSL_INTERFACE_PACKING_STD140;
}
ir_variable_mode var_mode;
const char *iface_type_name;
if (this->layout.flags.q.in) {
var_mode = ir_var_shader_in;
iface_type_name = "in";
} else if (this->layout.flags.q.out) {
var_mode = ir_var_shader_out;
iface_type_name = "out";
} else if (this->layout.flags.q.uniform) {
var_mode = ir_var_uniform;
iface_type_name = "uniform";
} else {
var_mode = ir_var_auto;
iface_type_name = "UNKNOWN";
assert(!"interface block layout qualifier not found!");
}
enum glsl_matrix_layout matrix_layout = GLSL_MATRIX_LAYOUT_INHERITED;
if (this->layout.flags.q.row_major)
matrix_layout = GLSL_MATRIX_LAYOUT_ROW_MAJOR;
else if (this->layout.flags.q.column_major)
matrix_layout = GLSL_MATRIX_LAYOUT_COLUMN_MAJOR;
bool redeclaring_per_vertex = strcmp(this->block_name, "gl_PerVertex") == 0;
exec_list declared_variables;
glsl_struct_field *fields;
/* Treat an interface block as one level of nesting, so that embedded struct
* specifiers will be disallowed.
*/
state->struct_specifier_depth++;
unsigned int num_variables =
ast_process_structure_or_interface_block(&declared_variables,
state,
&this->declarations,
loc,
&fields,
true,
matrix_layout,
redeclaring_per_vertex,
var_mode);
state->struct_specifier_depth--;
if (!redeclaring_per_vertex)
validate_identifier(this->block_name, loc, state);
const glsl_type *earlier_per_vertex = NULL;
if (redeclaring_per_vertex) {
/* Find the previous declaration of gl_PerVertex. If we're redeclaring
* the named interface block gl_in, we can find it by looking at the
* previous declaration of gl_in. Otherwise we can find it by looking
* at the previous decalartion of any of the built-in outputs,
* e.g. gl_Position.
*
* Also check that the instance name and array-ness of the redeclaration
* are correct.
*/
switch (var_mode) {
case ir_var_shader_in:
if (ir_variable *earlier_gl_in =
state->symbols->get_variable("gl_in")) {
earlier_per_vertex = earlier_gl_in->get_interface_type();
} else {
_mesa_glsl_error(&loc, state,
"redeclaration of gl_PerVertex input not allowed "
"in the %s shader",
_mesa_shader_stage_to_string(state->stage));
}
if (this->instance_name == NULL ||
strcmp(this->instance_name, "gl_in") != 0 || this->array_specifier == NULL) {
_mesa_glsl_error(&loc, state,
"gl_PerVertex input must be redeclared as "
"gl_in[]");
}
break;
case ir_var_shader_out:
if (ir_variable *earlier_gl_Position =
state->symbols->get_variable("gl_Position")) {
earlier_per_vertex = earlier_gl_Position->get_interface_type();
} else {
_mesa_glsl_error(&loc, state,
"redeclaration of gl_PerVertex output not "
"allowed in the %s shader",
_mesa_shader_stage_to_string(state->stage));
}
if (this->instance_name != NULL) {
_mesa_glsl_error(&loc, state,
"gl_PerVertex output may not be redeclared with "
"an instance name");
}
break;
default:
_mesa_glsl_error(&loc, state,
"gl_PerVertex must be declared as an input or an "
"output");
break;
}
if (earlier_per_vertex == NULL) {
/* An error has already been reported. Bail out to avoid null
* dereferences later in this function.
*/
return NULL;
}
/* Copy locations from the old gl_PerVertex interface block. */
for (unsigned i = 0; i < num_variables; i++) {
int j = earlier_per_vertex->field_index(fields[i].name);
if (j == -1) {
_mesa_glsl_error(&loc, state,
"redeclaration of gl_PerVertex must be a subset "
"of the built-in members of gl_PerVertex");
} else {
fields[i].location =
earlier_per_vertex->fields.structure[j].location;
fields[i].interpolation =
earlier_per_vertex->fields.structure[j].interpolation;
fields[i].centroid =
earlier_per_vertex->fields.structure[j].centroid;
fields[i].sample =
earlier_per_vertex->fields.structure[j].sample;
}
}
/* From section 7.1 ("Built-in Language Variables") of the GLSL 4.10
* spec:
*
* If a built-in interface block is redeclared, it must appear in
* the shader before any use of any member included in the built-in
* declaration, or a compilation error will result.
*
* This appears to be a clarification to the behaviour established for
* gl_PerVertex by GLSL 1.50, therefore we implement this behaviour
* regardless of GLSL version.
*/
interface_block_usage_visitor v(var_mode, earlier_per_vertex);
v.run(instructions);
if (v.usage_found()) {
_mesa_glsl_error(&loc, state,
"redeclaration of a built-in interface block must "
"appear before any use of any member of the "
"interface block");
}
}
const glsl_type *block_type =
glsl_type::get_interface_instance(fields,
num_variables,
packing,
this->block_name);
if (!state->symbols->add_interface(block_type->name, block_type, var_mode)) {
YYLTYPE loc = this->get_location();
_mesa_glsl_error(&loc, state, "interface block `%s' with type `%s' "
"already taken in the current scope",
this->block_name, iface_type_name);
}
/* Since interface blocks cannot contain statements, it should be
* impossible for the block to generate any instructions.
*/
assert(declared_variables.is_empty());
/* From section 4.3.4 (Inputs) of the GLSL 1.50 spec:
*
* Geometry shader input variables get the per-vertex values written
* out by vertex shader output variables of the same names. Since a
* geometry shader operates on a set of vertices, each input varying
* variable (or input block, see interface blocks below) needs to be
* declared as an array.
*/
if (state->stage == MESA_SHADER_GEOMETRY && this->array_specifier == NULL &&
var_mode == ir_var_shader_in) {
_mesa_glsl_error(&loc, state, "geometry shader inputs must be arrays");
}
/* Page 39 (page 45 of the PDF) of section 4.3.7 in the GLSL ES 3.00 spec
* says:
*
* "If an instance name (instance-name) is used, then it puts all the
* members inside a scope within its own name space, accessed with the
* field selector ( . ) operator (analogously to structures)."
*/
if (this->instance_name) {
if (redeclaring_per_vertex) {
/* When a built-in in an unnamed interface block is redeclared,
* get_variable_being_redeclared() calls
* check_builtin_array_max_size() to make sure that built-in array
* variables aren't redeclared to illegal sizes. But we're looking
* at a redeclaration of a named built-in interface block. So we
* have to manually call check_builtin_array_max_size() for all parts
* of the interface that are arrays.
*/
for (unsigned i = 0; i < num_variables; i++) {
if (fields[i].type->is_array()) {
const unsigned size = fields[i].type->array_size();
check_builtin_array_max_size(fields[i].name, size, loc, state);
}
}
} else {
validate_identifier(this->instance_name, loc, state);
}
ir_variable *var;
if (this->array_specifier != NULL) {
/* Section 4.3.7 (Interface Blocks) of the GLSL 1.50 spec says:
*
* For uniform blocks declared an array, each individual array
* element corresponds to a separate buffer object backing one
* instance of the block. As the array size indicates the number
* of buffer objects needed, uniform block array declarations
* must specify an array size.
*
* And a few paragraphs later:
*
* Geometry shader input blocks must be declared as arrays and
* follow the array declaration and linking rules for all
* geometry shader inputs. All other input and output block
* arrays must specify an array size.
*
* The upshot of this is that the only circumstance where an
* interface array size *doesn't* need to be specified is on a
* geometry shader input.
*/
if (this->array_specifier->is_unsized_array &&
(state->stage != MESA_SHADER_GEOMETRY || !this->layout.flags.q.in)) {
_mesa_glsl_error(&loc, state,
"only geometry shader inputs may be unsized "
"instance block arrays");
}
const glsl_type *block_array_type =
process_array_type(&loc, block_type, this->array_specifier, state);
var = new(state) ir_variable(block_array_type,
this->instance_name,
var_mode, glsl_precision_undefined);
} else {
var = new(state) ir_variable(block_type,
this->instance_name,
var_mode, glsl_precision_undefined);
}
var->data.matrix_layout = matrix_layout == GLSL_MATRIX_LAYOUT_INHERITED
? GLSL_MATRIX_LAYOUT_COLUMN_MAJOR : matrix_layout;
if (state->stage == MESA_SHADER_GEOMETRY && var_mode == ir_var_shader_in)
handle_geometry_shader_input_decl(state, loc, var);
if (ir_variable *earlier =
state->symbols->get_variable(this->instance_name)) {
if (!redeclaring_per_vertex) {
_mesa_glsl_error(&loc, state, "`%s' redeclared",
this->instance_name);
}
earlier->data.how_declared = ir_var_declared_normally;
earlier->type = var->type;
earlier->reinit_interface_type(block_type);
delete var;
} else {
/* Propagate the "binding" keyword into this UBO's fields;
* the UBO declaration itself doesn't get an ir_variable unless it
* has an instance name. This is ugly.
*/
var->data.explicit_binding = this->layout.flags.q.explicit_binding;
var->data.binding = this->layout.binding;
state->symbols->add_variable(var);
instructions->push_tail(var);
}
} else {
/* In order to have an array size, the block must also be declared with
* an instance name.
*/
assert(this->array_specifier == NULL);
for (unsigned i = 0; i < num_variables; i++) {
ir_variable *var =
new(state) ir_variable(fields[i].type,
ralloc_strdup(state, fields[i].name),
var_mode, fields[i].precision);
var->data.interpolation = fields[i].interpolation;
var->data.centroid = fields[i].centroid;
var->data.sample = fields[i].sample;
var->init_interface_type(block_type);
if (fields[i].matrix_layout == GLSL_MATRIX_LAYOUT_INHERITED) {
var->data.matrix_layout = matrix_layout == GLSL_MATRIX_LAYOUT_INHERITED
? GLSL_MATRIX_LAYOUT_COLUMN_MAJOR : matrix_layout;
} else {
var->data.matrix_layout = fields[i].matrix_layout;
}
if (fields[i].stream != -1 &&
((unsigned)fields[i].stream) != this->layout.stream) {
_mesa_glsl_error(&loc, state,
"stream layout qualifier on "
"interface block member `%s' does not match "
"the interface block (%d vs %d)",
var->name, fields[i].stream, this->layout.stream);
}
var->data.stream = this->layout.stream;
if (redeclaring_per_vertex) {
ir_variable *earlier =
get_variable_being_redeclared(var, loc, state,
true /* allow_all_redeclarations */);
if (!is_gl_identifier(var->name) || earlier == NULL) {
_mesa_glsl_error(&loc, state,
"redeclaration of gl_PerVertex can only "
"include built-in variables");
} else if (earlier->data.how_declared == ir_var_declared_normally) {
_mesa_glsl_error(&loc, state,
"`%s' has already been redeclared", var->name);
} else {
earlier->data.how_declared = ir_var_declared_in_block;
earlier->reinit_interface_type(block_type);
}
continue;
}
if (state->symbols->get_variable(var->name) != NULL)
_mesa_glsl_error(&loc, state, "`%s' redeclared", var->name);
/* Propagate the "binding" keyword into this UBO's fields;
* the UBO declaration itself doesn't get an ir_variable unless it
* has an instance name. This is ugly.
*/
var->data.explicit_binding = this->layout.flags.q.explicit_binding;
var->data.binding = this->layout.binding;
state->symbols->add_variable(var);
instructions->push_tail(var);
}
if (redeclaring_per_vertex && block_type != earlier_per_vertex) {
/* From section 7.1 ("Built-in Language Variables") of the GLSL 4.10 spec:
*
* It is also a compilation error ... to redeclare a built-in
* block and then use a member from that built-in block that was
* not included in the redeclaration.
*
* This appears to be a clarification to the behaviour established
* for gl_PerVertex by GLSL 1.50, therefore we implement this
* behaviour regardless of GLSL version.
*
* To prevent the shader from using a member that was not included in
* the redeclaration, we disable any ir_variables that are still
* associated with the old declaration of gl_PerVertex (since we've
* already updated all of the variables contained in the new
* gl_PerVertex to point to it).
*
* As a side effect this will prevent
* validate_intrastage_interface_blocks() from getting confused and
* thinking there are conflicting definitions of gl_PerVertex in the
* shader.
*/
foreach_in_list_safe(ir_instruction, node, instructions) {
ir_variable *const var = node->as_variable();
if (var != NULL &&
var->get_interface_type() == earlier_per_vertex &&
var->data.mode == var_mode) {
if (var->data.how_declared == ir_var_declared_normally) {
_mesa_glsl_error(&loc, state,
"redeclaration of gl_PerVertex cannot "
"follow a redeclaration of `%s'",
var->name);
}
state->symbols->disable_variable(var->name);
var->remove();
}
}
}
}
return NULL;
}
ir_rvalue *
ast_gs_input_layout::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
YYLTYPE loc = this->get_location();
/* If any geometry input layout declaration preceded this one, make sure it
* was consistent with this one.
*/
if (state->gs_input_prim_type_specified &&
state->in_qualifier->prim_type != this->prim_type) {
_mesa_glsl_error(&loc, state,
"geometry shader input layout does not match"
" previous declaration");
return NULL;
}
/* If any shader inputs occurred before this declaration and specified an
* array size, make sure the size they specified is consistent with the
* primitive type.
*/
unsigned num_vertices = vertices_per_prim(this->prim_type);
if (state->gs_input_size != 0 && state->gs_input_size != num_vertices) {
_mesa_glsl_error(&loc, state,
"this geometry shader input layout implies %u vertices"
" per primitive, but a previous input is declared"
" with size %u", num_vertices, state->gs_input_size);
return NULL;
}
state->gs_input_prim_type_specified = true;
/* If any shader inputs occurred before this declaration and did not
* specify an array size, their size is determined now.
*/
foreach_in_list(ir_instruction, node, instructions) {
ir_variable *var = node->as_variable();
if (var == NULL || var->data.mode != ir_var_shader_in)
continue;
/* Note: gl_PrimitiveIDIn has mode ir_var_shader_in, but it's not an
* array; skip it.
*/
if (var->type->is_unsized_array()) {
if (var->data.max_array_access >= num_vertices) {
_mesa_glsl_error(&loc, state,
"this geometry shader input layout implies %u"
" vertices, but an access to element %u of input"
" `%s' already exists", num_vertices,
var->data.max_array_access, var->name);
} else {
var->type = glsl_type::get_array_instance(var->type->fields.array,
num_vertices);
}
}
}
return NULL;
}
ir_rvalue *
ast_cs_input_layout::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
YYLTYPE loc = this->get_location();
/* If any compute input layout declaration preceded this one, make sure it
* was consistent with this one.
*/
if (state->cs_input_local_size_specified) {
for (int i = 0; i < 3; i++) {
if (state->cs_input_local_size[i] != this->local_size[i]) {
_mesa_glsl_error(&loc, state,
"compute shader input layout does not match"
" previous declaration");
return NULL;
}
}
}
/* From the ARB_compute_shader specification:
*
* If the local size of the shader in any dimension is greater
* than the maximum size supported by the implementation for that
* dimension, a compile-time error results.
*
* It is not clear from the spec how the error should be reported if
* the total size of the work group exceeds
* MAX_COMPUTE_WORK_GROUP_INVOCATIONS, but it seems reasonable to
* report it at compile time as well.
*/
GLuint64 total_invocations = 1;
for (int i = 0; i < 3; i++) {
if (this->local_size[i] > state->ctx->Const.MaxComputeWorkGroupSize[i]) {
_mesa_glsl_error(&loc, state,
"local_size_%c exceeds MAX_COMPUTE_WORK_GROUP_SIZE"
" (%d)", 'x' + i,
state->ctx->Const.MaxComputeWorkGroupSize[i]);
break;
}
total_invocations *= this->local_size[i];
if (total_invocations >
state->ctx->Const.MaxComputeWorkGroupInvocations) {
_mesa_glsl_error(&loc, state,
"product of local_sizes exceeds "
"MAX_COMPUTE_WORK_GROUP_INVOCATIONS (%d)",
state->ctx->Const.MaxComputeWorkGroupInvocations);
break;
}
}
state->cs_input_local_size_specified = true;
for (int i = 0; i < 3; i++)
state->cs_input_local_size[i] = this->local_size[i];
/* We may now declare the built-in constant gl_WorkGroupSize (see
* builtin_variable_generator::generate_constants() for why we didn't
* declare it earlier).
*/
ir_variable *var = new(state->symbols)
ir_variable(glsl_type::ivec3_type, "gl_WorkGroupSize", ir_var_auto, glsl_precision_undefined);
var->data.how_declared = ir_var_declared_implicitly;
var->data.read_only = true;
instructions->push_tail(var);
state->symbols->add_variable(var);
ir_constant_data data;
memset(&data, 0, sizeof(data));
for (int i = 0; i < 3; i++)
data.i[i] = this->local_size[i];
var->constant_value = new(var) ir_constant(glsl_type::ivec3_type, &data);
var->constant_initializer =
new(var) ir_constant(glsl_type::ivec3_type, &data);
var->data.has_initializer = true;
return NULL;
}
static void
detect_conflicting_assignments(struct _mesa_glsl_parse_state *state,
exec_list *instructions)
{
bool gl_FragColor_assigned = false;
bool gl_FragData_assigned = false;
bool user_defined_fs_output_assigned = false;
ir_variable *user_defined_fs_output = NULL;
/* It would be nice to have proper location information. */
YYLTYPE loc;
memset(&loc, 0, sizeof(loc));
foreach_in_list(ir_instruction, node, instructions) {
ir_variable *var = node->as_variable();
if (!var || !var->data.assigned)
continue;
if (strcmp(var->name, "gl_FragColor") == 0)
gl_FragColor_assigned = true;
else if (strcmp(var->name, "gl_FragData") == 0)
gl_FragData_assigned = true;
else if (!is_gl_identifier(var->name)) {
if (state->stage == MESA_SHADER_FRAGMENT &&
var->data.mode == ir_var_shader_out) {
user_defined_fs_output_assigned = true;
user_defined_fs_output = var;
}
}
}
/* From the GLSL 1.30 spec:
*
* "If a shader statically assigns a value to gl_FragColor, it
* may not assign a value to any element of gl_FragData. If a
* shader statically writes a value to any element of
* gl_FragData, it may not assign a value to
* gl_FragColor. That is, a shader may assign values to either
* gl_FragColor or gl_FragData, but not both. Multiple shaders
* linked together must also consistently write just one of
* these variables. Similarly, if user declared output
* variables are in use (statically assigned to), then the
* built-in variables gl_FragColor and gl_FragData may not be
* assigned to. These incorrect usages all generate compile
* time errors."
*/
if (gl_FragColor_assigned && gl_FragData_assigned) {
_mesa_glsl_error(&loc, state, "fragment shader writes to both "
"`gl_FragColor' and `gl_FragData'");
} else if (gl_FragColor_assigned && user_defined_fs_output_assigned) {
_mesa_glsl_error(&loc, state, "fragment shader writes to both "
"`gl_FragColor' and `%s'",
user_defined_fs_output->name);
} else if (gl_FragData_assigned && user_defined_fs_output_assigned) {
_mesa_glsl_error(&loc, state, "fragment shader writes to both "
"`gl_FragData' and `%s'",
user_defined_fs_output->name);
}
}
static void
remove_per_vertex_blocks(exec_list *instructions,
_mesa_glsl_parse_state *state, ir_variable_mode mode)
{
/* Find the gl_PerVertex interface block of the appropriate (in/out) mode,
* if it exists in this shader type.
*/
const glsl_type *per_vertex = NULL;
switch (mode) {
case ir_var_shader_in:
if (ir_variable *gl_in = state->symbols->get_variable("gl_in"))
per_vertex = gl_in->get_interface_type();
break;
case ir_var_shader_out:
if (ir_variable *gl_Position =
state->symbols->get_variable("gl_Position")) {
per_vertex = gl_Position->get_interface_type();
}
break;
default:
assert(!"Unexpected mode");
break;
}
/* If we didn't find a built-in gl_PerVertex interface block, then we don't
* need to do anything.
*/
if (per_vertex == NULL)
return;
/* If the interface block is used by the shader, then we don't need to do
* anything.
*/
interface_block_usage_visitor v(mode, per_vertex);
v.run(instructions);
if (v.usage_found())
return;
/* Remove any ir_variable declarations that refer to the interface block
* we're removing.
*/
foreach_in_list_safe(ir_instruction, node, instructions) {
ir_variable *const var = node->as_variable();
if (var != NULL && var->get_interface_type() == per_vertex &&
var->data.mode == mode) {
state->symbols->disable_variable(var->name);
var->remove();
}
}
}
| {
"content_hash": "e61e5ba3ffbf0f8e792de46a6c2f028b",
"timestamp": "",
"source": "github",
"line_count": 6101,
"max_line_length": 123,
"avg_line_length": 38.02048844451729,
"alnum_prop": 0.5671982169570147,
"repo_name": "kkitsune/GoblinEngine",
"id": "d31c53465fc0789e87c8ef8268f38016dcae86b3",
"size": "233124",
"binary": false,
"copies": "12",
"ref": "refs/heads/master",
"path": "engine/libs/bgfx/bgfx/3rdparty/glsl-optimizer/src/glsl/ast_to_hir.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "5454967"
},
{
"name": "C++",
"bytes": "8504064"
},
{
"name": "CMake",
"bytes": "99589"
},
{
"name": "CSS",
"bytes": "24070"
},
{
"name": "HTML",
"bytes": "7710772"
},
{
"name": "JavaScript",
"bytes": "13547"
},
{
"name": "Lua",
"bytes": "71115"
},
{
"name": "Makefile",
"bytes": "66586"
},
{
"name": "Objective-C",
"bytes": "4848509"
},
{
"name": "Objective-C++",
"bytes": "170220"
},
{
"name": "Python",
"bytes": "4617"
},
{
"name": "Ruby",
"bytes": "5860"
},
{
"name": "Scala",
"bytes": "12885"
},
{
"name": "Shell",
"bytes": "58100"
},
{
"name": "SuperCollider",
"bytes": "131523"
}
],
"symlink_target": ""
} |
/* $NetBSD: ieee754.h,v 1.15 2014/02/01 16:39:52 matt Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Lawrence Berkeley Laboratory.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)ieee.h 8.1 (Berkeley) 6/11/93
*/
#ifndef _SYS_IEEE754_H_
#define _SYS_IEEE754_H_
/*
* NOTICE: This is not a standalone file. To use it, #include it in
* your port's ieee.h header.
*/
#include <machine/endian.h>
/*
* <sys/ieee754.h> defines the layout of IEEE 754 floating point types.
* Only single-precision and double-precision types are defined here;
* 128-bit long doubles are define here IFF __HAVE_LONG_DOUBLE equals 128.
* Otherwise extended types, if available, are defined in the machine-dependent
* header.
*/
/*
* Define the number of bits in each fraction and exponent.
*
* k k+1
* Note that 1.0 x 2 == 0.1 x 2 and that denorms are represented
*
* (-exp_bias+1)
* as fractions that look like 0.fffff x 2 . This means that
*
* -126
* the number 0.10000 x 2 , for instance, is the same as the normalized
*
* -127 -128
* float 1.0 x 2 . Thus, to represent 2 , we need one leading zero
*
* -129
* in the fraction; to represent 2 , we need two, and so on. This
*
* (-exp_bias-fracbits+1)
* implies that the smallest denormalized number is 2
*
* for whichever format we are talking about: for single precision, for
*
* -126 -149
* instance, we get .00000000000000000000001 x 2 , or 1.0 x 2 , and
*
* -149 == -127 - 23 + 1.
*/
#define SNG_EXPBITS 8
#define SNG_FRACBITS 23
struct ieee_single {
#if _BYTE_ORDER == _BIG_ENDIAN
u_int sng_sign:1;
u_int sng_exp:SNG_EXPBITS;
u_int sng_frac:SNG_FRACBITS;
#else
u_int sng_frac:SNG_FRACBITS;
u_int sng_exp:SNG_EXPBITS;
u_int sng_sign:1;
#endif
};
#define DBL_EXPBITS 11
#define DBL_FRACHBITS 20
#define DBL_FRACLBITS 32
#define DBL_FRACBITS (DBL_FRACHBITS + DBL_FRACLBITS)
struct ieee_double {
#if _BYTE_ORDER == _BIG_ENDIAN
u_int dbl_sign:1;
u_int dbl_exp:DBL_EXPBITS;
u_int dbl_frach:DBL_FRACHBITS;
u_int dbl_fracl:DBL_FRACLBITS;
#else
u_int dbl_fracl:DBL_FRACLBITS;
u_int dbl_frach:DBL_FRACHBITS;
u_int dbl_exp:DBL_EXPBITS;
u_int dbl_sign:1;
#endif
};
#if __HAVE_LONG_DOUBLE + 0 == 128
#define EXT_EXPBITS 15
#define EXT_FRACHBITS 48
#define EXT_FRACLBITS 64
#define EXT_FRACBITS (EXT_FRACLBITS + EXT_FRACHBITS)
#define EXT_TO_ARRAY32(u, a) do { \
(a)[0] = (uint32_t)((u).extu_ext.ext_fracl >> 0); \
(a)[1] = (uint32_t)((u).extu_ext.ext_fracl >> 32); \
(a)[2] = (uint32_t)((u).extu_ext.ext_frach >> 0); \
(a)[3] = (uint32_t)((u).extu_ext.ext_frach >> 32); \
} while(/*CONSTCOND*/0)
struct ieee_ext {
#if _BYTE_ORDER == _BIG_ENDIAN
uint64_t ext_sign:1;
uint64_t ext_exp:EXT_EXPBITS;
uint64_t ext_frach:EXT_FRACHBITS;
uint64_t ext_fracl;
#else
uint64_t ext_fracl;
uint64_t ext_frach:EXT_FRACHBITS;
uint64_t ext_exp:EXT_EXPBITS;
uint64_t ext_sign:1;
#endif
};
#endif /* __HAVE_LONG_DOUBLE == 128 */
/*
* Floats whose exponent is in [1..INFNAN) (of whatever type) are
* `normal'. Floats whose exponent is INFNAN are either Inf or NaN.
* Floats whose exponent is zero are either zero (iff all fraction
* bits are zero) or subnormal values.
*
* At least one `signalling NaN' and one `quiet NaN' value must be
* implemented. It is left to the architecture to specify how to
* distinguish between these.
*/
#define SNG_EXP_INFNAN 255
#define DBL_EXP_INFNAN 2047
#if __HAVE_LONG_DOUBLE + 0 == 128
#define EXT_EXP_INFNAN 0x7fff
#endif
/*
* Exponent biases.
*/
#define SNG_EXP_BIAS 127
#define DBL_EXP_BIAS 1023
#if __HAVE_LONG_DOUBLE + 0 == 128
#define EXT_EXP_BIAS 16383
#endif
/*
* Convenience data structures.
*/
union ieee_single_u {
float sngu_f;
struct ieee_single sngu_sng;
};
#define sngu_sign sngu_sng.sng_sign
#define sngu_exp sngu_sng.sng_exp
#define sngu_frac sngu_sng.sng_frac
#define SNGU_ZEROFRAC_P(u) ((u).sngu_frac != 0)
union ieee_double_u {
double dblu_d;
struct ieee_double dblu_dbl;
};
#define dblu_sign dblu_dbl.dbl_sign
#define dblu_exp dblu_dbl.dbl_exp
#define dblu_frach dblu_dbl.dbl_frach
#define dblu_fracl dblu_dbl.dbl_fracl
#define DBLU_ZEROFRAC_P(u) (((u).dblu_frach|(u).dblu_fracl) != 0)
#if __HAVE_LONG_DOUBLE + 0 == 128
union ieee_ext_u {
long double extu_ld;
struct ieee_ext extu_ext;
};
#define extu_exp extu_ext.ext_exp
#define extu_sign extu_ext.ext_sign
#define extu_fracl extu_ext.ext_fracl
#define extu_frach extu_ext.ext_frach
#define EXTU_ZEROFRAC_P(u) (((u).extu_frach|(u).extu_fracl) != 0)
#ifndef LDBL_NBIT
#define LDBL_IMPLICIT_NBIT 1 /* our NBIT is implicit */
#endif
#endif /* __HAVE_LONG_DOUBLE */
#endif /* _SYS_IEEE754_H_ */
| {
"content_hash": "906716dd658af4ac0e4897bfe172e2c5",
"timestamp": "",
"source": "github",
"line_count": 218,
"max_line_length": 79,
"avg_line_length": 30.25229357798165,
"alnum_prop": 0.6996209249431388,
"repo_name": "execunix/vinos",
"id": "116e23ae3b6586dcb339b595119b90ecabeea75d",
"size": "6595",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "sys/sys/ieee754.h",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
@interface PodsDummy_TPNS_iOS : NSObject
@end
@implementation PodsDummy_TPNS_iOS
@end
| {
"content_hash": "a1a08a4034e522262403297b43c90a42",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 40,
"avg_line_length": 21.5,
"alnum_prop": 0.8023255813953488,
"repo_name": "dtag-dbu/TPNS_iOS",
"id": "e1d403572cdadc6186e4efab66e90c4f0b930fc7",
"size": "120",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Example/Pods/Target Support Files/TPNS_iOS/TPNS_iOS-dummy.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "29242"
},
{
"name": "Ruby",
"bytes": "822"
},
{
"name": "Shell",
"bytes": "9951"
}
],
"symlink_target": ""
} |
// ---------------------------------------------------------------------------------
// <copyright file="ActivateMoodlightMessageEvent.cs" company="https://github.com/sant0ro/Yupi">
// Copyright (c) 2016 Claudio Santoro, TheDoctor
// </copyright>
// <license>
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
// </license>
// ---------------------------------------------------------------------------------
namespace Yupi.Messages.Items
{
using System;
public class ActivateMoodlightMessageEvent : AbstractHandler
{
#region Methods
public override void HandleMessage(Yupi.Model.Domain.Habbo session, Yupi.Protocol.Buffers.ClientMessage request,
Yupi.Protocol.IRouter router)
{
/*
Yupi.Messages.Rooms room = Yupi.GetGame().GetRoomManager().GetRoom(session.GetHabbo().CurrentRoomId);
if (room == null || !room.CheckRights(session, true))
return;
if (room.MoodlightData == null)
{
foreach (
RoomItem current in
room.GetRoomItemHandler()
.WallItems.Values.Where(
current => current.GetBaseItem().InteractionType == Interaction.Dimmer))
room.MoodlightData = new MoodlightData(current.Id);
}
if (room.MoodlightData == null)
return;
router.GetComposer<DimmerDataMessageComposer> ().Compose (session, room.MoodlightData);
*/
throw new NotImplementedException();
}
#endregion Methods
}
} | {
"content_hash": "ea5d3cfbc9408c6d6411d326263ed7ba",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 120,
"avg_line_length": 43.25806451612903,
"alnum_prop": 0.6148396718866518,
"repo_name": "sant0ro/Yupi",
"id": "9ca33964917d631db03984761983e8d9beac89f3",
"size": "2684",
"binary": false,
"copies": "2",
"ref": "refs/heads/linux",
"path": "Yupi.Messages/Handlers/Items/ActivateMoodlightMessageEvent.cs",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "49"
},
{
"name": "Batchfile",
"bytes": "48"
},
{
"name": "C#",
"bytes": "3230390"
},
{
"name": "CSS",
"bytes": "103266"
},
{
"name": "HTML",
"bytes": "1866073"
},
{
"name": "JavaScript",
"bytes": "2459166"
},
{
"name": "Python",
"bytes": "1894"
},
{
"name": "Shell",
"bytes": "1150"
}
],
"symlink_target": ""
} |
require 'spec_helper'
describe 'ohai generator' do
before(:each) do
allow(Huck).to receive(:must_load)
ohai_system = double
allow(Ohai::System).to receive(:new).and_return(ohai_system)
allow(ohai_system).to receive(:all_plugins)
allow(ohai_system).to receive(:json_pretty_print).and_return('{"a":"b"}')
end
it 'should return json by default' do
g = Huck::Generator::factory :name => 'ohai', :config => {}
expect(g.generate).to eq('{"a":"b"}')
end
it 'should return json upon request' do
g = Huck::Generator::factory :name => 'ohai', :config => {'format' => 'json'}
expect(g.generate).to eq('{"a":"b"}')
end
it 'should return yaml upon request' do
g = Huck::Generator::factory :name => 'ohai', :config => {'format' => 'yaml'}
expect(g.generate).to eq("---\na: b\n")
end
end
| {
"content_hash": "a7e30e7e3581e338c2775d15d4c8cce0",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 81,
"avg_line_length": 32.19230769230769,
"alnum_prop": 0.6212664277180406,
"repo_name": "ryanuber/huck",
"id": "111c41abc9ce4efa63a4144c2d2751d35411cca3",
"size": "837",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spec/huck/generators/ohai_spec.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1559"
},
{
"name": "Ruby",
"bytes": "36359"
}
],
"symlink_target": ""
} |
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tmx.tanexamples">
<!-- 常用的权限,自行取舍 -->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
<!-- For reading media from external storage. -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<!-- Optional for location -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/>
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:name=".TanApp"
android:theme="@style/AppTheme">
<activity android:name=".activity.MainActivity"
android:launchMode="singleTask"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<meta-data android:name="design_width" android:value="768">
</meta-data>
<meta-data android:name="design_height" android:value="1280">
</meta-data>
</application>
</manifest>
| {
"content_hash": "e974ffbd205dbc5467e5f06412cac025",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 87,
"avg_line_length": 55.301886792452834,
"alnum_prop": 0.6994199931763904,
"repo_name": "tmx0456/TanExample",
"id": "1807a44038640c194340928fee793afd8fc8d596",
"size": "2951",
"binary": false,
"copies": "1",
"ref": "refs/heads/TanExample",
"path": "app/src/main/AndroidManifest.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "429839"
}
],
"symlink_target": ""
} |
[  ](https://bintray.com/piasy/maven/HandyWidgets/_latestVersion) [](https://android-arsenal.com/details/1/2455)
A widget which has functions of EditText, has a clear button, and has an optional search icon, also with ability for full customization. This widget also provide method to get notified when text content changed, or editor action happens, in both traditional listener and popular Rx Observable way!
+ Screenshot

+ Download
```groovy
repositories {
jcenter()
}
dependencies {
compile 'com.github.piasy:clearableedittext:${latest version}'
}
```
+ Usage
+ In xml layout file:
```xml
<com.github.piasy.handywidgets.clearableedittext.ClearableEditText
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/mClearableEditText"
android:layout_width="match_parent"
android:layout_height="44dp"
android:layout_marginTop="40dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="@drawable/round_corner_bg"
app:hasSearchIcon="true"
app:searchIconRes="@drawable/iv_search_grey"
app:searchIconMarginLeft="10dp"
app:searchIconMarginRight="10dp"
app:editTextSize="18sp"
app:clearableEditTextHintColor="#777777"
app:editTextHintContent="Search"
app:clearIconRes="@drawable/clear_edit_selector"
app:clearIconMarginLeft="10dp"
app:clearIconMarginRight="10dp"
/>
```
+ Get notified in popular Rx Observable way:
```java
mClearableEditText.textChanges().subscribe(new Action1<CharSequence>() {
@Override
public void call(CharSequence charSequence) {
mTvInput.setText("Input is: " + charSequence);
}
});
mClearableEditText.setImeOptions(EditorInfo.IME_ACTION_DONE);
mClearableEditText.editorActions().subscribe(new Action1<Integer>() {
@Override
public void call(Integer code) {
Log.d("ClearableEditText", "ClearableEditText Action: " + code);
if (code == EditorInfo.IME_ACTION_DONE) {
mTvAction.setText("IME_ACTION_DONE detected");
}
}
});
```
+ Get notified in traditional listener way:
```java
mClearableEditText2.setOnTextChangedListener(new OnTextChangedListener() {
@Override
public void onTextChanged(CharSequence text) {
mTvInput2.setText("Input is: " + text);
}
});
mClearableEditText2.setOnEditorActionDoneListener(new OnEditorActionDoneListener() {
@Override
public void onEditorActionDone() {
mTvAction2.setText("IME_ACTION_DONE detected");
}
});
```
+ Full example could be found at [the app module](../app/)
+ Acknowledgement
Thanks for the awesome [RxBinding library](https://github.com/JakeWharton/RxBinding/).
| {
"content_hash": "245f817b73221bc9ceb63cfb9b9f64a8",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 304,
"avg_line_length": 41.96153846153846,
"alnum_prop": 0.6648334860983807,
"repo_name": "mkodekar/HandyWidgets",
"id": "5028a756faa675c4978dca6141f0c1d15360f916",
"size": "3292",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "clearableedittext/README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "70021"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>首页</title>
<link rel="stylesheet" href="/app/bower_components/bootstrap/dist/css/bootstrap.css"/>
</head>
<body>
<script type="text/javascript" src="bower_components/jquery/src/jquery.js"></script>
<script type="text/javascript" src="bower_components/bootstrap/dist/js/bootstrap.js"></script>
<script type="text/javascript" src="bower_components/angular/angular.js"></script>
</body>
</html> | {
"content_hash": "d4b57716ac9b193ee19c7168383a0ba6",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 94,
"avg_line_length": 31.666666666666668,
"alnum_prop": 0.7115789473684211,
"repo_name": "TheBestThree/news_publisher",
"id": "53379bbee9012c7bab7b5497f725b7831e41e53d",
"size": "479",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "2224"
},
{
"name": "JavaScript",
"bytes": "8723"
}
],
"symlink_target": ""
} |
<div>
<form action="">
<input type="radio" [(ngModel)]="model.sex" name="sex" value="male">Male<br>
<input type="radio" [(ngModel)]="model.sex" name="sex" value="female">Female
</form>
<input type="button" value="select male" (click)="model.sex='male'">
<input type="button" value="select female" (click)="model.sex='female'">
<div>Selected Radio: {{model.sex}}</div>
</div> | {
"content_hash": "a049418b4b1a27175431f2bcc700c96c",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 85,
"avg_line_length": 41.3,
"alnum_prop": 0.6029055690072639,
"repo_name": "angular2-school/angular2-radio-button",
"id": "5279ff6a5fff08a8b48a5a9c8aec596eb9c3def8",
"size": "413",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "modules/ng-school/controls/template.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "1254"
},
{
"name": "TypeScript",
"bytes": "1890"
}
],
"symlink_target": ""
} |
/**
* Autogenerated by Thrift Compiler (0.9.2)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package backtype.storm.generated;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-7-18")
public class TopologyMetric implements org.apache.thrift.TBase<TopologyMetric, TopologyMetric._Fields>, java.io.Serializable, Cloneable, Comparable<TopologyMetric> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TopologyMetric");
private static final org.apache.thrift.protocol.TField TOPOLOGY_METRIC_FIELD_DESC = new org.apache.thrift.protocol.TField("topologyMetric", org.apache.thrift.protocol.TType.STRUCT, (short)1);
private static final org.apache.thrift.protocol.TField COMPONENT_METRIC_FIELD_DESC = new org.apache.thrift.protocol.TField("componentMetric", org.apache.thrift.protocol.TType.STRUCT, (short)2);
private static final org.apache.thrift.protocol.TField WORKER_METRIC_FIELD_DESC = new org.apache.thrift.protocol.TField("workerMetric", org.apache.thrift.protocol.TType.STRUCT, (short)3);
private static final org.apache.thrift.protocol.TField TASK_METRIC_FIELD_DESC = new org.apache.thrift.protocol.TField("taskMetric", org.apache.thrift.protocol.TType.STRUCT, (short)4);
private static final org.apache.thrift.protocol.TField STREAM_METRIC_FIELD_DESC = new org.apache.thrift.protocol.TField("streamMetric", org.apache.thrift.protocol.TType.STRUCT, (short)5);
private static final org.apache.thrift.protocol.TField NETTY_METRIC_FIELD_DESC = new org.apache.thrift.protocol.TField("nettyMetric", org.apache.thrift.protocol.TType.STRUCT, (short)6);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new TopologyMetricStandardSchemeFactory());
schemes.put(TupleScheme.class, new TopologyMetricTupleSchemeFactory());
}
private MetricInfo topologyMetric; // required
private MetricInfo componentMetric; // required
private MetricInfo workerMetric; // required
private MetricInfo taskMetric; // required
private MetricInfo streamMetric; // required
private MetricInfo nettyMetric; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
TOPOLOGY_METRIC((short)1, "topologyMetric"),
COMPONENT_METRIC((short)2, "componentMetric"),
WORKER_METRIC((short)3, "workerMetric"),
TASK_METRIC((short)4, "taskMetric"),
STREAM_METRIC((short)5, "streamMetric"),
NETTY_METRIC((short)6, "nettyMetric");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // TOPOLOGY_METRIC
return TOPOLOGY_METRIC;
case 2: // COMPONENT_METRIC
return COMPONENT_METRIC;
case 3: // WORKER_METRIC
return WORKER_METRIC;
case 4: // TASK_METRIC
return TASK_METRIC;
case 5: // STREAM_METRIC
return STREAM_METRIC;
case 6: // NETTY_METRIC
return NETTY_METRIC;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.TOPOLOGY_METRIC, new org.apache.thrift.meta_data.FieldMetaData("topologyMetric", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, MetricInfo.class)));
tmpMap.put(_Fields.COMPONENT_METRIC, new org.apache.thrift.meta_data.FieldMetaData("componentMetric", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, MetricInfo.class)));
tmpMap.put(_Fields.WORKER_METRIC, new org.apache.thrift.meta_data.FieldMetaData("workerMetric", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, MetricInfo.class)));
tmpMap.put(_Fields.TASK_METRIC, new org.apache.thrift.meta_data.FieldMetaData("taskMetric", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, MetricInfo.class)));
tmpMap.put(_Fields.STREAM_METRIC, new org.apache.thrift.meta_data.FieldMetaData("streamMetric", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, MetricInfo.class)));
tmpMap.put(_Fields.NETTY_METRIC, new org.apache.thrift.meta_data.FieldMetaData("nettyMetric", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, MetricInfo.class)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TopologyMetric.class, metaDataMap);
}
public TopologyMetric() {
}
public TopologyMetric(
MetricInfo topologyMetric,
MetricInfo componentMetric,
MetricInfo workerMetric,
MetricInfo taskMetric,
MetricInfo streamMetric,
MetricInfo nettyMetric)
{
this();
this.topologyMetric = topologyMetric;
this.componentMetric = componentMetric;
this.workerMetric = workerMetric;
this.taskMetric = taskMetric;
this.streamMetric = streamMetric;
this.nettyMetric = nettyMetric;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public TopologyMetric(TopologyMetric other) {
if (other.is_set_topologyMetric()) {
this.topologyMetric = new MetricInfo(other.topologyMetric);
}
if (other.is_set_componentMetric()) {
this.componentMetric = new MetricInfo(other.componentMetric);
}
if (other.is_set_workerMetric()) {
this.workerMetric = new MetricInfo(other.workerMetric);
}
if (other.is_set_taskMetric()) {
this.taskMetric = new MetricInfo(other.taskMetric);
}
if (other.is_set_streamMetric()) {
this.streamMetric = new MetricInfo(other.streamMetric);
}
if (other.is_set_nettyMetric()) {
this.nettyMetric = new MetricInfo(other.nettyMetric);
}
}
public TopologyMetric deepCopy() {
return new TopologyMetric(this);
}
@Override
public void clear() {
this.topologyMetric = null;
this.componentMetric = null;
this.workerMetric = null;
this.taskMetric = null;
this.streamMetric = null;
this.nettyMetric = null;
}
public MetricInfo get_topologyMetric() {
return this.topologyMetric;
}
public void set_topologyMetric(MetricInfo topologyMetric) {
this.topologyMetric = topologyMetric;
}
public void unset_topologyMetric() {
this.topologyMetric = null;
}
/** Returns true if field topologyMetric is set (has been assigned a value) and false otherwise */
public boolean is_set_topologyMetric() {
return this.topologyMetric != null;
}
public void set_topologyMetric_isSet(boolean value) {
if (!value) {
this.topologyMetric = null;
}
}
public MetricInfo get_componentMetric() {
return this.componentMetric;
}
public void set_componentMetric(MetricInfo componentMetric) {
this.componentMetric = componentMetric;
}
public void unset_componentMetric() {
this.componentMetric = null;
}
/** Returns true if field componentMetric is set (has been assigned a value) and false otherwise */
public boolean is_set_componentMetric() {
return this.componentMetric != null;
}
public void set_componentMetric_isSet(boolean value) {
if (!value) {
this.componentMetric = null;
}
}
public MetricInfo get_workerMetric() {
return this.workerMetric;
}
public void set_workerMetric(MetricInfo workerMetric) {
this.workerMetric = workerMetric;
}
public void unset_workerMetric() {
this.workerMetric = null;
}
/** Returns true if field workerMetric is set (has been assigned a value) and false otherwise */
public boolean is_set_workerMetric() {
return this.workerMetric != null;
}
public void set_workerMetric_isSet(boolean value) {
if (!value) {
this.workerMetric = null;
}
}
public MetricInfo get_taskMetric() {
return this.taskMetric;
}
public void set_taskMetric(MetricInfo taskMetric) {
this.taskMetric = taskMetric;
}
public void unset_taskMetric() {
this.taskMetric = null;
}
/** Returns true if field taskMetric is set (has been assigned a value) and false otherwise */
public boolean is_set_taskMetric() {
return this.taskMetric != null;
}
public void set_taskMetric_isSet(boolean value) {
if (!value) {
this.taskMetric = null;
}
}
public MetricInfo get_streamMetric() {
return this.streamMetric;
}
public void set_streamMetric(MetricInfo streamMetric) {
this.streamMetric = streamMetric;
}
public void unset_streamMetric() {
this.streamMetric = null;
}
/** Returns true if field streamMetric is set (has been assigned a value) and false otherwise */
public boolean is_set_streamMetric() {
return this.streamMetric != null;
}
public void set_streamMetric_isSet(boolean value) {
if (!value) {
this.streamMetric = null;
}
}
public MetricInfo get_nettyMetric() {
return this.nettyMetric;
}
public void set_nettyMetric(MetricInfo nettyMetric) {
this.nettyMetric = nettyMetric;
}
public void unset_nettyMetric() {
this.nettyMetric = null;
}
/** Returns true if field nettyMetric is set (has been assigned a value) and false otherwise */
public boolean is_set_nettyMetric() {
return this.nettyMetric != null;
}
public void set_nettyMetric_isSet(boolean value) {
if (!value) {
this.nettyMetric = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case TOPOLOGY_METRIC:
if (value == null) {
unset_topologyMetric();
} else {
set_topologyMetric((MetricInfo)value);
}
break;
case COMPONENT_METRIC:
if (value == null) {
unset_componentMetric();
} else {
set_componentMetric((MetricInfo)value);
}
break;
case WORKER_METRIC:
if (value == null) {
unset_workerMetric();
} else {
set_workerMetric((MetricInfo)value);
}
break;
case TASK_METRIC:
if (value == null) {
unset_taskMetric();
} else {
set_taskMetric((MetricInfo)value);
}
break;
case STREAM_METRIC:
if (value == null) {
unset_streamMetric();
} else {
set_streamMetric((MetricInfo)value);
}
break;
case NETTY_METRIC:
if (value == null) {
unset_nettyMetric();
} else {
set_nettyMetric((MetricInfo)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case TOPOLOGY_METRIC:
return get_topologyMetric();
case COMPONENT_METRIC:
return get_componentMetric();
case WORKER_METRIC:
return get_workerMetric();
case TASK_METRIC:
return get_taskMetric();
case STREAM_METRIC:
return get_streamMetric();
case NETTY_METRIC:
return get_nettyMetric();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case TOPOLOGY_METRIC:
return is_set_topologyMetric();
case COMPONENT_METRIC:
return is_set_componentMetric();
case WORKER_METRIC:
return is_set_workerMetric();
case TASK_METRIC:
return is_set_taskMetric();
case STREAM_METRIC:
return is_set_streamMetric();
case NETTY_METRIC:
return is_set_nettyMetric();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof TopologyMetric)
return this.equals((TopologyMetric)that);
return false;
}
public boolean equals(TopologyMetric that) {
if (that == null)
return false;
boolean this_present_topologyMetric = true && this.is_set_topologyMetric();
boolean that_present_topologyMetric = true && that.is_set_topologyMetric();
if (this_present_topologyMetric || that_present_topologyMetric) {
if (!(this_present_topologyMetric && that_present_topologyMetric))
return false;
if (!this.topologyMetric.equals(that.topologyMetric))
return false;
}
boolean this_present_componentMetric = true && this.is_set_componentMetric();
boolean that_present_componentMetric = true && that.is_set_componentMetric();
if (this_present_componentMetric || that_present_componentMetric) {
if (!(this_present_componentMetric && that_present_componentMetric))
return false;
if (!this.componentMetric.equals(that.componentMetric))
return false;
}
boolean this_present_workerMetric = true && this.is_set_workerMetric();
boolean that_present_workerMetric = true && that.is_set_workerMetric();
if (this_present_workerMetric || that_present_workerMetric) {
if (!(this_present_workerMetric && that_present_workerMetric))
return false;
if (!this.workerMetric.equals(that.workerMetric))
return false;
}
boolean this_present_taskMetric = true && this.is_set_taskMetric();
boolean that_present_taskMetric = true && that.is_set_taskMetric();
if (this_present_taskMetric || that_present_taskMetric) {
if (!(this_present_taskMetric && that_present_taskMetric))
return false;
if (!this.taskMetric.equals(that.taskMetric))
return false;
}
boolean this_present_streamMetric = true && this.is_set_streamMetric();
boolean that_present_streamMetric = true && that.is_set_streamMetric();
if (this_present_streamMetric || that_present_streamMetric) {
if (!(this_present_streamMetric && that_present_streamMetric))
return false;
if (!this.streamMetric.equals(that.streamMetric))
return false;
}
boolean this_present_nettyMetric = true && this.is_set_nettyMetric();
boolean that_present_nettyMetric = true && that.is_set_nettyMetric();
if (this_present_nettyMetric || that_present_nettyMetric) {
if (!(this_present_nettyMetric && that_present_nettyMetric))
return false;
if (!this.nettyMetric.equals(that.nettyMetric))
return false;
}
return true;
}
@Override
public int hashCode() {
List<Object> list = new ArrayList<Object>();
boolean present_topologyMetric = true && (is_set_topologyMetric());
list.add(present_topologyMetric);
if (present_topologyMetric)
list.add(topologyMetric);
boolean present_componentMetric = true && (is_set_componentMetric());
list.add(present_componentMetric);
if (present_componentMetric)
list.add(componentMetric);
boolean present_workerMetric = true && (is_set_workerMetric());
list.add(present_workerMetric);
if (present_workerMetric)
list.add(workerMetric);
boolean present_taskMetric = true && (is_set_taskMetric());
list.add(present_taskMetric);
if (present_taskMetric)
list.add(taskMetric);
boolean present_streamMetric = true && (is_set_streamMetric());
list.add(present_streamMetric);
if (present_streamMetric)
list.add(streamMetric);
boolean present_nettyMetric = true && (is_set_nettyMetric());
list.add(present_nettyMetric);
if (present_nettyMetric)
list.add(nettyMetric);
return list.hashCode();
}
@Override
public int compareTo(TopologyMetric other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(is_set_topologyMetric()).compareTo(other.is_set_topologyMetric());
if (lastComparison != 0) {
return lastComparison;
}
if (is_set_topologyMetric()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.topologyMetric, other.topologyMetric);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(is_set_componentMetric()).compareTo(other.is_set_componentMetric());
if (lastComparison != 0) {
return lastComparison;
}
if (is_set_componentMetric()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.componentMetric, other.componentMetric);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(is_set_workerMetric()).compareTo(other.is_set_workerMetric());
if (lastComparison != 0) {
return lastComparison;
}
if (is_set_workerMetric()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.workerMetric, other.workerMetric);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(is_set_taskMetric()).compareTo(other.is_set_taskMetric());
if (lastComparison != 0) {
return lastComparison;
}
if (is_set_taskMetric()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.taskMetric, other.taskMetric);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(is_set_streamMetric()).compareTo(other.is_set_streamMetric());
if (lastComparison != 0) {
return lastComparison;
}
if (is_set_streamMetric()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.streamMetric, other.streamMetric);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(is_set_nettyMetric()).compareTo(other.is_set_nettyMetric());
if (lastComparison != 0) {
return lastComparison;
}
if (is_set_nettyMetric()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nettyMetric, other.nettyMetric);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("TopologyMetric(");
boolean first = true;
sb.append("topologyMetric:");
if (this.topologyMetric == null) {
sb.append("null");
} else {
sb.append(this.topologyMetric);
}
first = false;
if (!first) sb.append(", ");
sb.append("componentMetric:");
if (this.componentMetric == null) {
sb.append("null");
} else {
sb.append(this.componentMetric);
}
first = false;
if (!first) sb.append(", ");
sb.append("workerMetric:");
if (this.workerMetric == null) {
sb.append("null");
} else {
sb.append(this.workerMetric);
}
first = false;
if (!first) sb.append(", ");
sb.append("taskMetric:");
if (this.taskMetric == null) {
sb.append("null");
} else {
sb.append(this.taskMetric);
}
first = false;
if (!first) sb.append(", ");
sb.append("streamMetric:");
if (this.streamMetric == null) {
sb.append("null");
} else {
sb.append(this.streamMetric);
}
first = false;
if (!first) sb.append(", ");
sb.append("nettyMetric:");
if (this.nettyMetric == null) {
sb.append("null");
} else {
sb.append(this.nettyMetric);
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
if (!is_set_topologyMetric()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'topologyMetric' is unset! Struct:" + toString());
}
if (!is_set_componentMetric()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'componentMetric' is unset! Struct:" + toString());
}
if (!is_set_workerMetric()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'workerMetric' is unset! Struct:" + toString());
}
if (!is_set_taskMetric()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'taskMetric' is unset! Struct:" + toString());
}
if (!is_set_streamMetric()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'streamMetric' is unset! Struct:" + toString());
}
if (!is_set_nettyMetric()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'nettyMetric' is unset! Struct:" + toString());
}
// check for sub-struct validity
if (topologyMetric != null) {
topologyMetric.validate();
}
if (componentMetric != null) {
componentMetric.validate();
}
if (workerMetric != null) {
workerMetric.validate();
}
if (taskMetric != null) {
taskMetric.validate();
}
if (streamMetric != null) {
streamMetric.validate();
}
if (nettyMetric != null) {
nettyMetric.validate();
}
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class TopologyMetricStandardSchemeFactory implements SchemeFactory {
public TopologyMetricStandardScheme getScheme() {
return new TopologyMetricStandardScheme();
}
}
private static class TopologyMetricStandardScheme extends StandardScheme<TopologyMetric> {
public void read(org.apache.thrift.protocol.TProtocol iprot, TopologyMetric struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // TOPOLOGY_METRIC
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
struct.topologyMetric = new MetricInfo();
struct.topologyMetric.read(iprot);
struct.set_topologyMetric_isSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // COMPONENT_METRIC
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
struct.componentMetric = new MetricInfo();
struct.componentMetric.read(iprot);
struct.set_componentMetric_isSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // WORKER_METRIC
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
struct.workerMetric = new MetricInfo();
struct.workerMetric.read(iprot);
struct.set_workerMetric_isSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 4: // TASK_METRIC
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
struct.taskMetric = new MetricInfo();
struct.taskMetric.read(iprot);
struct.set_taskMetric_isSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 5: // STREAM_METRIC
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
struct.streamMetric = new MetricInfo();
struct.streamMetric.read(iprot);
struct.set_streamMetric_isSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 6: // NETTY_METRIC
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
struct.nettyMetric = new MetricInfo();
struct.nettyMetric.read(iprot);
struct.set_nettyMetric_isSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, TopologyMetric struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.topologyMetric != null) {
oprot.writeFieldBegin(TOPOLOGY_METRIC_FIELD_DESC);
struct.topologyMetric.write(oprot);
oprot.writeFieldEnd();
}
if (struct.componentMetric != null) {
oprot.writeFieldBegin(COMPONENT_METRIC_FIELD_DESC);
struct.componentMetric.write(oprot);
oprot.writeFieldEnd();
}
if (struct.workerMetric != null) {
oprot.writeFieldBegin(WORKER_METRIC_FIELD_DESC);
struct.workerMetric.write(oprot);
oprot.writeFieldEnd();
}
if (struct.taskMetric != null) {
oprot.writeFieldBegin(TASK_METRIC_FIELD_DESC);
struct.taskMetric.write(oprot);
oprot.writeFieldEnd();
}
if (struct.streamMetric != null) {
oprot.writeFieldBegin(STREAM_METRIC_FIELD_DESC);
struct.streamMetric.write(oprot);
oprot.writeFieldEnd();
}
if (struct.nettyMetric != null) {
oprot.writeFieldBegin(NETTY_METRIC_FIELD_DESC);
struct.nettyMetric.write(oprot);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class TopologyMetricTupleSchemeFactory implements SchemeFactory {
public TopologyMetricTupleScheme getScheme() {
return new TopologyMetricTupleScheme();
}
}
private static class TopologyMetricTupleScheme extends TupleScheme<TopologyMetric> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, TopologyMetric struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
struct.topologyMetric.write(oprot);
struct.componentMetric.write(oprot);
struct.workerMetric.write(oprot);
struct.taskMetric.write(oprot);
struct.streamMetric.write(oprot);
struct.nettyMetric.write(oprot);
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, TopologyMetric struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
struct.topologyMetric = new MetricInfo();
struct.topologyMetric.read(iprot);
struct.set_topologyMetric_isSet(true);
struct.componentMetric = new MetricInfo();
struct.componentMetric.read(iprot);
struct.set_componentMetric_isSet(true);
struct.workerMetric = new MetricInfo();
struct.workerMetric.read(iprot);
struct.set_workerMetric_isSet(true);
struct.taskMetric = new MetricInfo();
struct.taskMetric.read(iprot);
struct.set_taskMetric_isSet(true);
struct.streamMetric = new MetricInfo();
struct.streamMetric.read(iprot);
struct.set_streamMetric_isSet(true);
struct.nettyMetric = new MetricInfo();
struct.nettyMetric.read(iprot);
struct.set_nettyMetric_isSet(true);
}
}
}
| {
"content_hash": "8b0515c44dcf1ba06431cbb2edc0a847",
"timestamp": "",
"source": "github",
"line_count": 924,
"max_line_length": 195,
"avg_line_length": 33.878787878787875,
"alnum_prop": 0.6711282903143369,
"repo_name": "haoyanjun21/jstorm",
"id": "8f6f72fa0773de64f2a67590cfaa2b8efe78e68e",
"size": "31304",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "jstorm-core/src/main/java/backtype/storm/generated/TopologyMetric.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "16192"
},
{
"name": "Java",
"bytes": "4522857"
},
{
"name": "JavaScript",
"bytes": "29378"
},
{
"name": "Python",
"bytes": "34228"
},
{
"name": "Shell",
"bytes": "6198"
},
{
"name": "Thrift",
"bytes": "12593"
}
],
"symlink_target": ""
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>HBase 0.98.7-hadoop2 Reference Package org.apache.hadoop.hbase.replication.regionserver</title>
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="style" />
</head>
<body>
<h3>
<a href="package-summary.html" target="classFrame">org.apache.hadoop.hbase.replication.regionserver</a>
</h3>
<h3>Classes</h3>
<ul>
<li>
<a href="TestReplicationSourceManager.html" target="classFrame">DummyNodeFailoverWorker</a>
</li>
<li>
<a href="TestReplicationSourceManager.html" target="classFrame">DummyServer</a>
</li>
<li>
<a href="TestReplicationHLogReaderManager.html" target="classFrame">PathWatcher</a>
</li>
<li>
<a href="TestMetricsReplicationSourceFactory.html" target="classFrame">TestMetricsReplicationSourceFactory</a>
</li>
<li>
<a href="TestMetricsReplicationSourceImpl.html" target="classFrame">TestMetricsReplicationSourceImpl</a>
</li>
<li>
<a href="TestReplicationHLogReaderManager.html" target="classFrame">TestReplicationHLogReaderManager</a>
</li>
<li>
<a href="TestReplicationSink.html" target="classFrame">TestReplicationSink</a>
</li>
<li>
<a href="TestReplicationSinkManager.html" target="classFrame">TestReplicationSinkManager</a>
</li>
<li>
<a href="TestReplicationSourceManager.html" target="classFrame">TestReplicationSourceManager</a>
</li>
<li>
<a href="TestReplicationThrottler.html" target="classFrame">TestReplicationThrottler</a>
</li>
</ul>
</body>
</html> | {
"content_hash": "04e530820cf6af306cb196ed919279a8",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 123,
"avg_line_length": 42.8,
"alnum_prop": 0.5719626168224299,
"repo_name": "gsoundar/mambo-ec2-deploy",
"id": "5cecafbf0f3a796fe10573f0a78e09e9f53c3d4b",
"size": "2141",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "packages/hbase-0.98.7-hadoop2/docs/xref-test/org/apache/hadoop/hbase/replication/regionserver/package-frame.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "23179"
},
{
"name": "CSS",
"bytes": "39965"
},
{
"name": "HTML",
"bytes": "263271260"
},
{
"name": "Java",
"bytes": "103085"
},
{
"name": "JavaScript",
"bytes": "1347"
},
{
"name": "Python",
"bytes": "4101"
},
{
"name": "Ruby",
"bytes": "262588"
},
{
"name": "Shell",
"bytes": "118548"
}
],
"symlink_target": ""
} |
/*
** Implementation for the CPyFactory class
*/
#include "stdafx.h"
#include <import.h> /* for PyImport_ImportModule() */
#include "PythonCOM.h"
#include "PyFactory.h"
#include "PythonCOMServer.h"
// Class Factories do not count against the DLLs total reference count.
static LONG factoryRefCount = 0;
CPyFactory::CPyFactory(REFCLSID guidClassID) :
m_guidClassID(guidClassID),
m_cRef(1)
{
InterlockedIncrement(&factoryRefCount);
}
CPyFactory::~CPyFactory()
{
InterlockedDecrement(&factoryRefCount);
}
STDMETHODIMP CPyFactory::QueryInterface(REFIID iid, void **ppv)
{
*ppv = NULL;
if ( IsEqualIID(iid, IID_IUnknown) ||
IsEqualIID(iid, IID_IClassFactory) )
{
*ppv = this;
AddRef();
return S_OK;
}
return E_NOINTERFACE;
}
STDMETHODIMP_(ULONG) CPyFactory::AddRef(void)
{
return InterlockedIncrement(&m_cRef);
}
STDMETHODIMP_(ULONG) CPyFactory::Release(void)
{
LONG cRef = InterlockedDecrement(&m_cRef);
if ( cRef == 0 )
delete this;
return cRef;
}
STDMETHODIMP CPyFactory::CreateInstance(
IUnknown *punkOuter,
REFIID riid,
void **ppv
)
{
// LogF("in CPyFactory::CreateInstance");
if ( ppv == NULL )
return E_POINTER;
*ppv = NULL;
if ( punkOuter != NULL )
return CLASS_E_NOAGGREGATION;
// Add a temporary reference to the main DLL, so that the Python
// Init/Finalize semantics work correctly.
// If we ignore Factory reference counts, there is a possibility
// that the DLL global ref count will transition 1->0->1 during the
// creation process. To prevent this, we add an artificial lock
// and remove it when done.
HRESULT hr;
PyCom_DLLAddRef();
{ // scope to ensure CEnterLeave destructs before (possibly final) PyCom_DLLReleaseRef
CEnterLeavePython celp;
PyObject *pNewInstance = NULL;
hr = CreateNewPythonInstance(m_guidClassID, riid, &pNewInstance);
if ( FAILED(hr) )
{
PyCom_LoggerException(NULL, "CPyFactory::CreateInstance failed to create instance. (%lx)", hr);
}
else
{
// CreateInstance now returns an object already all wrapped
// up (giving more flexibility to the Python programmer.
if (!PyCom_InterfaceFromPyObject(pNewInstance, riid, ppv, FALSE)) {
PyCom_LoggerException(NULL, "CPyFactory::CreateInstance failed to get gateway to returned object");
hr = E_FAIL;
}
}
Py_XDECREF(pNewInstance); // Dont need it any more.
}
PyCom_DLLReleaseRef();
return hr;
}
STDMETHODIMP CPyFactory::LockServer(BOOL fLock)
{
if ( fLock )
PyCom_DLLAddRef();
else
PyCom_DLLReleaseRef();
return S_OK;
}
// NOTE NOTE: CreateNewPythonInstance assumes that you have the Python thread lock
// already acquired.
STDMETHODIMP CPyFactory::CreateNewPythonInstance(REFCLSID rclsid, REFCLSID rReqiid, PyObject **ppNewInstance)
{
extern BOOL LoadGatewayModule(PyObject **);
PyObject *pPyModule;
if ( ppNewInstance == NULL )
return E_INVALIDARG;
if ( !LoadGatewayModule(&pPyModule) )
return E_FAIL;
// zap any existing errors so we can reliably check for errors
// after object creation.
PyErr_Clear();
PyObject *obiid = PyWinObject_FromIID(rclsid);
PyObject *obReqiid = PyWinObject_FromIID(rReqiid);
if ( !obiid || !obReqiid)
{
Py_XDECREF(pPyModule);
Py_XDECREF(obiid);
Py_XDECREF(obReqiid);
PyErr_Clear(); // nothing Python can do!
return E_OUTOFMEMORY;
}
*ppNewInstance = PyObject_CallMethod(pPyModule, "CreateInstance",
"OO", obiid, obReqiid);
// Check the error state before DECREFs, otherwise they may
// change the error state.
if ( !*ppNewInstance )
PyCom_LoggerException(NULL, "ERROR: server.policy could not create an instance.");
HRESULT hr = PyCom_SetCOMErrorFromPyException(IID_IClassFactory);
Py_DECREF(obiid);
Py_DECREF(obReqiid);
Py_DECREF(pPyModule);
return hr;
}
/*
** Load our C <-> Python gateway module if needed
NOTE: Assumes the Python lock already acquired for us by our caller.
*/
BOOL LoadGatewayModule(PyObject **ppModule)
{
PyObject *pPyModule = NULL;
pPyModule = PyImport_ImportModule("win32com.server.policy");
if ( !pPyModule )
{
PyCom_LoggerException(NULL, "PythonCOM Server - The 'win32com.server.policy' module could not be loaded.");
/* ### propagate the exception? */
PyErr_Clear();
return FALSE;
}
*ppModule = pPyModule;
return TRUE;
}
void FreeGatewayModule(void)
{
/*****
if ( g_pPyModule != NULL )
{
Py_DECREF(g_pPyModule);
g_pPyModule = NULL;
}
*****/
}
| {
"content_hash": "339c2497d85df2d805b960a44425f6d6",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 109,
"avg_line_length": 24.21978021978022,
"alnum_prop": 0.7091651542649727,
"repo_name": "nzavagli/UnrealPy",
"id": "50d3c3f44a37846072f6516e18cf09fc02842eaf",
"size": "4408",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "UnrealPyEmbed/Development/Python/2015.08.07-Python2710-x64-Source-vs2015/Python27/Source/pywin32-219/com/win32com/src/PyFactory.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "APL",
"bytes": "587"
},
{
"name": "ASP",
"bytes": "2753"
},
{
"name": "ActionScript",
"bytes": "5686"
},
{
"name": "Ada",
"bytes": "94225"
},
{
"name": "Agda",
"bytes": "3154"
},
{
"name": "Alloy",
"bytes": "6579"
},
{
"name": "ApacheConf",
"bytes": "12482"
},
{
"name": "AppleScript",
"bytes": "421"
},
{
"name": "Assembly",
"bytes": "1093261"
},
{
"name": "AutoHotkey",
"bytes": "3733"
},
{
"name": "AutoIt",
"bytes": "667"
},
{
"name": "Awk",
"bytes": "63276"
},
{
"name": "Batchfile",
"bytes": "147828"
},
{
"name": "BlitzBasic",
"bytes": "185102"
},
{
"name": "BlitzMax",
"bytes": "2387"
},
{
"name": "Boo",
"bytes": "1111"
},
{
"name": "Bro",
"bytes": "7337"
},
{
"name": "C",
"bytes": "108397183"
},
{
"name": "C#",
"bytes": "156749"
},
{
"name": "C++",
"bytes": "13535833"
},
{
"name": "CLIPS",
"bytes": "6933"
},
{
"name": "CMake",
"bytes": "12441"
},
{
"name": "COBOL",
"bytes": "114812"
},
{
"name": "CSS",
"bytes": "430375"
},
{
"name": "Ceylon",
"bytes": "1387"
},
{
"name": "Chapel",
"bytes": "4366"
},
{
"name": "Cirru",
"bytes": "2574"
},
{
"name": "Clean",
"bytes": "9679"
},
{
"name": "Clojure",
"bytes": "23871"
},
{
"name": "CoffeeScript",
"bytes": "20149"
},
{
"name": "ColdFusion",
"bytes": "9006"
},
{
"name": "Common Lisp",
"bytes": "49017"
},
{
"name": "Coq",
"bytes": "66"
},
{
"name": "Cucumber",
"bytes": "390"
},
{
"name": "Cuda",
"bytes": "776"
},
{
"name": "D",
"bytes": "7556"
},
{
"name": "DIGITAL Command Language",
"bytes": "425938"
},
{
"name": "DTrace",
"bytes": "6706"
},
{
"name": "Dart",
"bytes": "591"
},
{
"name": "Dylan",
"bytes": "6343"
},
{
"name": "Ecl",
"bytes": "2599"
},
{
"name": "Eiffel",
"bytes": "2145"
},
{
"name": "Elixir",
"bytes": "4340"
},
{
"name": "Emacs Lisp",
"bytes": "18303"
},
{
"name": "Erlang",
"bytes": "5746"
},
{
"name": "F#",
"bytes": "19156"
},
{
"name": "FORTRAN",
"bytes": "38458"
},
{
"name": "Factor",
"bytes": "10194"
},
{
"name": "Fancy",
"bytes": "2581"
},
{
"name": "Fantom",
"bytes": "25331"
},
{
"name": "GAP",
"bytes": "29880"
},
{
"name": "GLSL",
"bytes": "450"
},
{
"name": "Gnuplot",
"bytes": "11501"
},
{
"name": "Go",
"bytes": "5444"
},
{
"name": "Golo",
"bytes": "1649"
},
{
"name": "Gosu",
"bytes": "2853"
},
{
"name": "Groff",
"bytes": "3458639"
},
{
"name": "Groovy",
"bytes": "2586"
},
{
"name": "HTML",
"bytes": "92126540"
},
{
"name": "Haskell",
"bytes": "49593"
},
{
"name": "Haxe",
"bytes": "16812"
},
{
"name": "Hy",
"bytes": "7237"
},
{
"name": "IDL",
"bytes": "2098"
},
{
"name": "Idris",
"bytes": "2771"
},
{
"name": "Inform 7",
"bytes": "1944"
},
{
"name": "Inno Setup",
"bytes": "18796"
},
{
"name": "Ioke",
"bytes": "469"
},
{
"name": "Isabelle",
"bytes": "21392"
},
{
"name": "Jasmin",
"bytes": "9428"
},
{
"name": "Java",
"bytes": "4040623"
},
{
"name": "JavaScript",
"bytes": "223927"
},
{
"name": "Julia",
"bytes": "27687"
},
{
"name": "KiCad",
"bytes": "475"
},
{
"name": "Kotlin",
"bytes": "971"
},
{
"name": "LSL",
"bytes": "160"
},
{
"name": "Lasso",
"bytes": "18650"
},
{
"name": "Lean",
"bytes": "6921"
},
{
"name": "Limbo",
"bytes": "9891"
},
{
"name": "Liquid",
"bytes": "862"
},
{
"name": "LiveScript",
"bytes": "972"
},
{
"name": "Logos",
"bytes": "19509"
},
{
"name": "Logtalk",
"bytes": "7260"
},
{
"name": "Lua",
"bytes": "8677"
},
{
"name": "Makefile",
"bytes": "2053844"
},
{
"name": "Mask",
"bytes": "815"
},
{
"name": "Mathematica",
"bytes": "191"
},
{
"name": "Max",
"bytes": "296"
},
{
"name": "Modelica",
"bytes": "6213"
},
{
"name": "Modula-2",
"bytes": "23838"
},
{
"name": "Module Management System",
"bytes": "14798"
},
{
"name": "Monkey",
"bytes": "2587"
},
{
"name": "Moocode",
"bytes": "3343"
},
{
"name": "MoonScript",
"bytes": "14862"
},
{
"name": "Myghty",
"bytes": "3939"
},
{
"name": "NSIS",
"bytes": "7663"
},
{
"name": "Nemerle",
"bytes": "1517"
},
{
"name": "NewLisp",
"bytes": "42726"
},
{
"name": "Nimrod",
"bytes": "37191"
},
{
"name": "Nit",
"bytes": "55581"
},
{
"name": "Nix",
"bytes": "2448"
},
{
"name": "OCaml",
"bytes": "42416"
},
{
"name": "Objective-C",
"bytes": "104883"
},
{
"name": "Objective-J",
"bytes": "15340"
},
{
"name": "Opa",
"bytes": "172"
},
{
"name": "OpenEdge ABL",
"bytes": "49943"
},
{
"name": "PAWN",
"bytes": "6555"
},
{
"name": "PHP",
"bytes": "68611"
},
{
"name": "PLSQL",
"bytes": "45772"
},
{
"name": "Pan",
"bytes": "1241"
},
{
"name": "Pascal",
"bytes": "349743"
},
{
"name": "Perl",
"bytes": "5931502"
},
{
"name": "Perl6",
"bytes": "113623"
},
{
"name": "PigLatin",
"bytes": "6657"
},
{
"name": "Pike",
"bytes": "8479"
},
{
"name": "PostScript",
"bytes": "18216"
},
{
"name": "PowerShell",
"bytes": "14236"
},
{
"name": "Prolog",
"bytes": "43750"
},
{
"name": "Protocol Buffer",
"bytes": "3401"
},
{
"name": "Puppet",
"bytes": "130"
},
{
"name": "Python",
"bytes": "122886156"
},
{
"name": "QML",
"bytes": "3912"
},
{
"name": "R",
"bytes": "49247"
},
{
"name": "Racket",
"bytes": "11341"
},
{
"name": "Rebol",
"bytes": "17708"
},
{
"name": "Red",
"bytes": "10536"
},
{
"name": "Redcode",
"bytes": "830"
},
{
"name": "Ruby",
"bytes": "91403"
},
{
"name": "Rust",
"bytes": "6788"
},
{
"name": "SAS",
"bytes": "15603"
},
{
"name": "SaltStack",
"bytes": "1040"
},
{
"name": "Scala",
"bytes": "730"
},
{
"name": "Scheme",
"bytes": "50346"
},
{
"name": "Scilab",
"bytes": "943"
},
{
"name": "Shell",
"bytes": "2925097"
},
{
"name": "ShellSession",
"bytes": "320"
},
{
"name": "Smali",
"bytes": "832"
},
{
"name": "Smalltalk",
"bytes": "158636"
},
{
"name": "Smarty",
"bytes": "523"
},
{
"name": "SourcePawn",
"bytes": "130"
},
{
"name": "Standard ML",
"bytes": "36869"
},
{
"name": "Swift",
"bytes": "2035"
},
{
"name": "SystemVerilog",
"bytes": "265"
},
{
"name": "Tcl",
"bytes": "6077233"
},
{
"name": "TeX",
"bytes": "487999"
},
{
"name": "Tea",
"bytes": "391"
},
{
"name": "TypeScript",
"bytes": "535"
},
{
"name": "VHDL",
"bytes": "4446"
},
{
"name": "VimL",
"bytes": "32053"
},
{
"name": "Visual Basic",
"bytes": "19441"
},
{
"name": "XQuery",
"bytes": "4289"
},
{
"name": "XS",
"bytes": "178055"
},
{
"name": "XSLT",
"bytes": "1995174"
},
{
"name": "Xtend",
"bytes": "727"
},
{
"name": "Yacc",
"bytes": "25665"
},
{
"name": "Zephir",
"bytes": "485"
},
{
"name": "eC",
"bytes": "31545"
},
{
"name": "mupad",
"bytes": "2442"
},
{
"name": "nesC",
"bytes": "23697"
},
{
"name": "xBase",
"bytes": "3349"
}
],
"symlink_target": ""
} |
namespace XenAdmin.Wizards.ImportWizard
{
partial class ImportEulaPage
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ImportEulaPage));
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.m_tabControlEULA = new System.Windows.Forms.TabControl();
this.m_labelIntro = new XenAdmin.Controls.Common.AutoHeightLabel();
this.m_checkBoxAccept = new System.Windows.Forms.CheckBox();
this.m_ctrlError = new XenAdmin.Controls.Common.PasswordFailure();
this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
// tableLayoutPanel1
//
resources.ApplyResources(this.tableLayoutPanel1, "tableLayoutPanel1");
this.tableLayoutPanel1.Controls.Add(this.m_tabControlEULA, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.m_labelIntro, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.m_checkBoxAccept, 0, 3);
this.tableLayoutPanel1.Controls.Add(this.m_ctrlError, 0, 4);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
//
// m_tabControlEULA
//
resources.ApplyResources(this.m_tabControlEULA, "m_tabControlEULA");
this.m_tabControlEULA.Name = "m_tabControlEULA";
this.m_tabControlEULA.SelectedIndex = 0;
//
// m_labelIntro
//
resources.ApplyResources(this.m_labelIntro, "m_labelIntro");
this.m_labelIntro.Name = "m_labelIntro";
//
// m_checkBoxAccept
//
resources.ApplyResources(this.m_checkBoxAccept, "m_checkBoxAccept");
this.m_checkBoxAccept.Name = "m_checkBoxAccept";
this.m_checkBoxAccept.UseVisualStyleBackColor = true;
this.m_checkBoxAccept.CheckedChanged += new System.EventHandler(this.m_checkBoxAccept_CheckedChanged);
//
// m_ctrlError
//
resources.ApplyResources(this.m_ctrlError, "m_ctrlError");
this.m_ctrlError.Name = "m_ctrlError";
//
// ImportEulaPage
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.Controls.Add(this.tableLayoutPanel1);
this.Name = "ImportEulaPage";
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.TabControl m_tabControlEULA;
private System.Windows.Forms.CheckBox m_checkBoxAccept;
private XenAdmin.Controls.Common.AutoHeightLabel m_labelIntro;
private XenAdmin.Controls.Common.PasswordFailure m_ctrlError;
}
}
| {
"content_hash": "8520d1a09c2b755e5cd75635ccba7eb8",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 146,
"avg_line_length": 42.44565217391305,
"alnum_prop": 0.6081946222791293,
"repo_name": "aftabahmedsajid/XenCenter-Complete-dependencies-",
"id": "75a1f19ec3f9d8d7017f214cc2782a2170112595",
"size": "3907",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "XenAdmin/Wizards/ImportWizard/ImportEulaPage.Designer.cs",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "C",
"bytes": "1907"
},
{
"name": "C#",
"bytes": "16370140"
},
{
"name": "C++",
"bytes": "21035"
},
{
"name": "JavaScript",
"bytes": "812"
},
{
"name": "PowerShell",
"bytes": "40"
},
{
"name": "Shell",
"bytes": "62958"
},
{
"name": "Visual Basic",
"bytes": "11351"
}
],
"symlink_target": ""
} |
<div class="row">
<div class="col-md-6">
<form class="form-horizontal" name="vm.userForm">
<fieldset>
<legend class="col-md-offset-2">Register new user</legend>
<div class="form-group">
<label for="email" class="col-lg-2 control-label">Email</label>
<div class="col-lg-10">
<input ng-model="vm.user.email" required="required" type="email" class="form-control" id="email" placeholder="Mail" name="email">
<div ng-show="vm.userForm.email.$error.email && vm.userForm.email.$touched" class="error">Invalid email!</div>
</div>
</div>
<div class="form-group">
<label for="password" class="col-lg-2 control-label">Password</label>
<div class="col-lg-10">
<input ng-model="vm.user.password" required="required" type="password" class="form-control" id="password" placeholder="Password">
</div>
</div>
<div class="form-group">
<label for="confirmPassword" class="col-lg-2 control-label">Confirm password</label>
<div class="col-lg-10">
<input ng-model="vm.user.confirmPassword" required="required" type="password" class="form-control" id="confirmPassword" placeholder="Confirm password" name="confirmPassword">
<div ng-show="vm.user.password !== vm.user.confirmPassword && vm.userForm.confirmPassword.$touched" class="error">Passwords must match!</div>
</div>
</div>
</fieldset>
<div class="form-group">
<div class="col-lg-10 col-lg-offset-2">
<button ng-click="vm.cancel()" class="btn btn-default">Cancel</button>
<button ng-click="vm.registerUser(vm.user, vm.userForm)" ng-disabled="vm.userForm.$invalid" class="btn btn-primary">Save</button>
</div>
</div>
</form>
</div>
</div>
| {
"content_hash": "f996352718dcdd9b54a18d2683a5d37d",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 192,
"avg_line_length": 44.4,
"alnum_prop": 0.5655655655655656,
"repo_name": "todorm85/TelerikAcademy",
"id": "1b6e0300b76d5ab731ab20d246df74885edaa666",
"size": "1998",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Courses/Software Technologies/AngularJS/live-demos/MusicArtists-live-demo/app/register-user-page/register-user.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "114244"
},
{
"name": "Batchfile",
"bytes": "19"
},
{
"name": "C#",
"bytes": "4205850"
},
{
"name": "CSS",
"bytes": "251946"
},
{
"name": "HTML",
"bytes": "616278"
},
{
"name": "Java",
"bytes": "119147"
},
{
"name": "JavaScript",
"bytes": "2755542"
},
{
"name": "Objective-C",
"bytes": "37979"
},
{
"name": "Smalltalk",
"bytes": "3"
},
{
"name": "Visual Basic",
"bytes": "95362"
},
{
"name": "XSLT",
"bytes": "6254"
}
],
"symlink_target": ""
} |
module Feedjira
module Parser
# Parser for dealing with RSS feeds.
class RSSFeedBurner
include SAXMachine
include FeedUtilities
element :title
element :description
element :link, as: :url
element :lastBuildDate, as: :last_built
elements :"atom10:link", as: :hubs, value: :href, with: { rel: 'hub' }
elements :item, as: :entries, class: RSSFeedBurnerEntry
attr_accessor :feed_url
def self.able_to_parse?(xml) #:nodoc:
(/\<rss|\<rdf/ =~ xml) && (/feedburner/ =~ xml)
end
end
end
end
| {
"content_hash": "3df1872d84e230c7b4f432a8d07138fd",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 76,
"avg_line_length": 27.285714285714285,
"alnum_prop": 0.6143106457242583,
"repo_name": "jfiorato/feedjira",
"id": "dad8789528aa96909c90da5cbbb8eca5a73b7db5",
"size": "573",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/feedjira/parser/rss_feed_burner.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "89247"
}
],
"symlink_target": ""
} |
Calculate the moment when someone has lived for 10^9 seconds.
A gigasecond is 10^9 (1,000,000,000) seconds.
### Submitting Exercises
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/python/bob/bob.py`.
For more detailed information about running tests, code style and linting,
please see the [help page](http://exercism.io/languages/python).
## Source
Chapter 9 in Chris Pine's online Learn to Program tutorial. [http://pine.fm/LearnToProgram/?Chapter=09](http://pine.fm/LearnToProgram/?Chapter=09)
## Submitting Incomplete Problems
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
| {
"content_hash": "dc5b59bf17d5e3938365ee2b7f7cfbca",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 167,
"avg_line_length": 41.285714285714285,
"alnum_prop": 0.7739331026528259,
"repo_name": "matheussilvapb/exercism-python",
"id": "0e73a5b005ec4869088e65ec1d67a0b4b2eeae60",
"size": "881",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "gigasecond/README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "23519"
}
],
"symlink_target": ""
} |
package mcjty.rftools.blocks.logic.timer;
import mcjty.lib.tileentity.LogicTileEntity;
import mcjty.lib.gui.widgets.TextField;
import mcjty.lib.gui.widgets.ToggleButton;
import mcjty.rftools.TickOrderHandler;
import mcjty.theoneprobe.api.IProbeHitData;
import mcjty.theoneprobe.api.IProbeInfo;
import mcjty.theoneprobe.api.ProbeMode;
import mcjty.lib.typed.TypedMap;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ITickable;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.Optional;
public class TimerTileEntity extends LogicTileEntity implements ITickable, TickOrderHandler.ICheckStateServer {
public static final String CMD_SETDELAY = "timer.setDelay";
public static final String CMD_SETPAUSES = "timer.setPauses";
// For pulse detection.
private boolean prevIn = false;
private int delay = 20;
private int timer = 0;
private boolean redstonePauses = false;
public TimerTileEntity() {
}
public int getDelay() {
return delay;
}
public int getTimer() {
return timer;
}
public boolean getRedstonePauses() {
return redstonePauses;
}
public void setDelay(int delay) {
this.delay = delay;
timer = delay;
markDirtyClient();
}
public void setRedstonePauses(boolean redstonePauses) {
this.redstonePauses = redstonePauses;
if(redstonePauses && powerLevel > 0) {
timer = delay;
}
markDirtyClient();
}
@Override
public void update() {
if (!getWorld().isRemote) {
TickOrderHandler.queueTimer(this);
}
}
@Override
public void checkStateServer() {
boolean pulse = (powerLevel > 0) && !prevIn;
prevIn = powerLevel > 0;
markDirty();
if (pulse) {
timer = delay;
}
int newout;
if(!redstonePauses || !prevIn) {
timer--;
}
if (timer <= 0) {
timer = delay;
newout = 15;
} else {
newout = 0;
}
setRedstoneState(newout);
}
@Override
public int getDimension() {
return world.provider.getDimension();
}
@Override
public void readFromNBT(NBTTagCompound tagCompound) {
super.readFromNBT(tagCompound);
powerOutput = tagCompound.getBoolean("rs") ? 15 : 0;
prevIn = tagCompound.getBoolean("prevIn");
timer = tagCompound.getInteger("timer");
}
@Override
public void readRestorableFromNBT(NBTTagCompound tagCompound) {
super.readRestorableFromNBT(tagCompound);
delay = tagCompound.getInteger("delay");
redstonePauses = tagCompound.getBoolean("redstonePauses");
}
@Override
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
super.writeToNBT(tagCompound);
tagCompound.setBoolean("rs", powerOutput > 0);
tagCompound.setBoolean("prevIn", prevIn);
tagCompound.setInteger("timer", timer);
return tagCompound;
}
@Override
public void writeRestorableToNBT(NBTTagCompound tagCompound) {
super.writeRestorableToNBT(tagCompound);
tagCompound.setInteger("delay", delay);
tagCompound.setBoolean("redstonePauses", redstonePauses);
}
@Override
public boolean execute(EntityPlayerMP playerMP, String command, TypedMap params) {
boolean rc = super.execute(playerMP, command, params);
if (rc) {
return true;
}
if (CMD_SETDELAY.equals(command)) {
String text = params.get(TextField.PARAM_TEXT);
int delay;
try {
delay = Integer.parseInt(text);
} catch (NumberFormatException e) {
delay = 1;
}
setDelay(delay);
return true;
} else if (CMD_SETPAUSES.equals(command)) {
Boolean on = params.get(ToggleButton.PARAM_ON);
setRedstonePauses(on);
return true;
}
return false;
}
@Override
@Optional.Method(modid = "theoneprobe")
public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data) {
super.addProbeInfo(mode, probeInfo, player, world, blockState, data);
probeInfo.text(TextFormatting.GREEN + "Time: " + TextFormatting.WHITE + getTimer());
}
}
| {
"content_hash": "d9259c02d49b1f545d87943727053de8",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 146,
"avg_line_length": 29.03105590062112,
"alnum_prop": 0.639495079161318,
"repo_name": "McJty/RFTools",
"id": "9e6f8b688f4a99f99fdb687d34ca95c802e39a2e",
"size": "4674",
"binary": false,
"copies": "1",
"ref": "refs/heads/1.12",
"path": "src/main/java/mcjty/rftools/blocks/logic/timer/TimerTileEntity.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "2868355"
}
],
"symlink_target": ""
} |
@import 'library/common.js'
@import 'library/devel-tools.js'
@import 'library/string.js'
var code = {};
var sp = ' ';
var sp2x = sp + sp;
var Paints = function(){
this.db = {};
this.db['paint'] = {};
this.db['names'] = {};
this.db['properties'] = [];
this.db['inits'] = [];
this.count = 0;
}
Paints.prototype.properties = function(){
return this.db['properties'];
}
Paints.prototype.inits = function(){
return this.db['inits'];
}
Paints.prototype.newTextName = function(){
return 'paintText' + (this.count++);
}
Paints.prototype.newFillName = function(){
return 'paintFill' + (this.count++);
}
Paints.prototype.newBorderName = function(){
return 'paintBorder' + (this.count++);
}
Paints.prototype.newProperty = function(name){
return sp + 'private Paint ' + name + ';\n';
}
Paints.prototype.addPaint = function(item){
if(item.className() == 'MSTextLayer'){
var property = item.style().sharedObjectID();
if (!this.db['paint'].hasOwnProperty(property)) {
this.db['paint'][property] = item.style();
var textName = this.newTextName();
this.db['names'][property] = textName;
this.db['properties'].push(this.newProperty(textName));
this.db['inits'].push(this.createInitTextPaint(item, textName));
}
}
if(item.className() == 'MSShapePathLayer'){
var parent = item.parentGroup();
var property = parent.style().objectID();
if (!this.db['paint'].hasOwnProperty(property)) {
this.db['paint'][property] = parent.style();
var fill = [[parent style] fill];
var border = [[parent style] border];
var nameFill = fill? this.newFillName(): null;
var nameBorder = border? this.newBorderName(): null;
this.db['names'][property] = {'fill': nameFill, 'border': nameBorder};
if(fill){
this.db['properties'].push(this.newProperty(nameFill));
this.db['inits'].push(this.newInitFillPaint(parent, nameFill));
}
if(border){
this.db['properties'].push(this.newProperty(nameBorder));
this.db['inits'].push(this.newInitBorderPaint(parent, nameBorder));
}
}
}
}
Paints.prototype.newInitBorderPaint = function(parent, name){
var color = [[[parent style] border] color];
var thickness = [[[parent style] border] thickness];
return sp2x + name + ' = new Paint();\n' +
sp2x + name + '.setAntiAlias(true);\n' +
sp2x + name + '.setColor(' + this.parseFullColor(color) + ');\n' +
sp2x + name + '.setStyle(Paint.Style.STROKE);\n' +
sp2x + name + '.setStrokeWidth(' + thickness + 'f * density);\n';
}
Paints.prototype.newInitFillPaint = function(parent, name){
var color = [[[parent style] fill] color];
return sp2x + name + ' = new Paint();\n' +
sp2x + name + '.setAntiAlias(true);\n' +
sp2x + name + '.setColor(' + this.parseFullColor(color) + ');\n' +
sp2x + name + '.setStyle(Paint.Style.FILL);\n';
}
Paints.prototype.createInitTextPaint = function(item, name){
return sp2x + name + ' = new Paint();\n' +
sp2x + name + '.setAntiAlias(true);\n' +
sp2x + name + '.setTextSize(' + item.fontSize() + ' * density);\n' +
sp2x + name + '.setTextAlign(Paint.Align.CENTER);\n' +
sp2x + name + '.setColor(' + this.parseFullColor(item.textColor()) + ');\n';
}
Paints.prototype.parseFullColor = function(color){
var hexAlpha = Math.floor(color.alpha() * 255).toString(16).toUpperCase();
hexAlpha = hexAlpha.length == 2? hexAlpha: hexAlpha + '0';
return '0x' + hexAlpha + color.hexValue().toString();
}
Paints.prototype.parseColor = function(item){
return '0x' + item.textColor().hexValue().toString();
}
Paints.prototype.getTextPaintName = function(item){
return this.db['names'][item.style().sharedObjectID()];
}
Paints.prototype.getPathPaintName = function(item){
return this.db['names'][item.parentGroup().style().objectID()];
}
var Text = function(layer){
this.layer = layer;
var indexOptions = [layer name].indexOf('#');
var options = indexOptions != -1? [layer name].substr(indexOptions+1): null;
var clearName = (options ? [layer name].substr(0, indexOptions): [layer name]).replace(/\s+/g, '');
if(/^\d+$/.test(clearName.substr(0,1))){
clearName = 'text' + clearName;
}
this.name = clearName;
this.onClick = options != null? options.indexOf('noclick') == -1: true;
}
Text.prototype.draw = function(paints){
var textLayer = this.layer;
var rect = [textLayer absoluteRect];
return sp2x + 'canvas.drawText(\"' + textLayer.stringValue() + '\", ' + (rect.midX()) + 'f * density, ' + (rect.midY() + (rect.height() /2)) + 'f * density, ' + paints.getTextPaintName(textLayer) + ');\n';
}
var Shape = function(layer){
this._layer = layer;
var indexOptions = [layer name].indexOf('#');
var options = indexOptions != -1? [layer name].substr(indexOptions+1): null;
var clearName = (options ? [layer name].substr(0, indexOptions): [layer name]).replace(/\s+/g, '');
if(/^\d+$/.test(clearName.substr(0,1))){
clearName = 'shape' + clearName;
}
this.name = clearName;
this.onClick = options != null? options.indexOf('noclick') == -1: true;
this.path = this.getBezierPath(this._layer);
this.property = this.getProperty();
this.regionPropery = this.getPropertyRegion();
}
Shape.prototype.getProperty = function(){
return sp + 'private Path ' + this.name + ';\n';
}
Shape.prototype.getPropertyRegion = function(){
if(this.onClick){
return sp +'private Region ' + 'region' + this.name.capitalize() + ';\n';
}else{
return '';
}
}
Shape.prototype.getRegionName = function(){
return 'region' + this.name.capitalize();
}
Shape.prototype.getShapeInit = function(){
return this.path;
}
Shape.prototype.getDraw = function(paints){
var paintsName = paints.getPathPaintName(this._layer);
var draw = '';
if(paintsName['fill']){
draw += sp2x + 'canvas.drawPath(' + this.name + ',' + paintsName['fill'] + ');\n';
}
if(paintsName['border']){
draw += sp2x + 'canvas.drawPath(' + this.name + ',' + paintsName['border'] + ');\n';
}
return draw;
}
Shape.prototype.getRegionInit = function(){
if(this.onClick){
return sp2x + this.name +'.computeBounds(bounds, true);\n' +
sp2x + 'Region ' + this.getRegionName() + ' = new Region();\n' +
sp2x + this.getRegionName() + '.setPath(' + this.name + ', new Region((int) bounds.left, (int) bounds.top, (int) bounds.right, (int) bounds.bottom));\n' +
sp2x + 'mRegions.put(\"' + this.name +'\", ' + this.getRegionName() + ');\n';
}else{
return "";
}
}
Shape.prototype.getBezierPath = function(layer){
var bezier = [layer bezierPath].toString().split('\n');
var rect = [[layer parentGroup] absoluteRect];
var code = new ShapeInit(this.name);
for(var i = 3; i < bezier.length; i++){
var line = bezier[i].replace(/\s+/g, " ").split(' ');
if(i != bezier.length - 1){
var endLine = line[line.length-1];
switch (endLine) {
case 'moveto':
code.moveTo(line[1] - 0 + rect.x(), line[2] - 0 + rect.y());
break;
case 'lineto':
code.lineTo(line[1] - 0 + rect.x(), line[2] - 0 + rect.y());
break;
case 'curveto':
code.cubicTo(line[1] - 0 + rect.x(), line[2] - 0 + rect.y(), line[3] - 0 + rect.x(), line[4] - 0 + rect.y(), line[5] - 0 + rect.x(), line[6] - 0 + rect.y());
break;
case 'closepath':
code.close();
break;
}
}
}
return code.getString();
}
var ShapeInit = function(name){
this.name = name;
this.code = sp2x + this.name + ' = new Path();\n';
}
ShapeInit.prototype.cubicTo = function(x1, y1, x2, y2, x3, y3){
this.code += sp2x + this.name + '.cubicTo(' + this.dp(x1) + ', ' + this.dp(y1) + ', ' + this.dp(x2) + ', ' + this.dp(y2) + ', ' + this.dp(x3) + ', ' + this.dp(y3) + ');\n';
}
ShapeInit.prototype.moveTo = function(x, y){
this.code += sp2x + this.name + '.moveTo(' + this.dp(x) + ', ' + this.dp(y) + ');\n';
}
ShapeInit.prototype.lineTo = function(x, y){
this.code += sp2x + this.name + '.lineTo(' + this.dp(x) + ', ' + this.dp(y) + ');\n';
}
ShapeInit.prototype.close = function(){
this.code += sp2x + this.name + '.close();\n';
}
ShapeInit.prototype.getString = function(){
return this.code;
}
ShapeInit.prototype.dp = function(px){
return px + 'f * density';
}
| {
"content_hash": "e0ab7cd2d2a6c151c9e81ad7b5f58abf",
"timestamp": "",
"source": "github",
"line_count": 263,
"max_line_length": 210,
"avg_line_length": 32.863117870722434,
"alnum_prop": 0.589378687955571,
"repo_name": "4xes/Sketch-Android-View",
"id": "696bb7cc58e0fe249af76a0dda19448bc09dc00e",
"size": "8643",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "android-custom-view.sketchplugin/Contents/Sketch/library/shape.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "7599"
},
{
"name": "JavaScript",
"bytes": "14979"
}
],
"symlink_target": ""
} |
var maintenance = angular.module('maintenanceApp');
maintenance.controller('maintenanceCtrl', function($scope,dataAdminFactory,seshkeys){
$scope.newTicket = [];
$scope.ticketHistory = [];
$scope.ticketSubmission = [];
var getTicketsByUser = function(username)
{
var result = [];
//console.log(dataAdminFactory);
//console.log(dataAdminFactory.hasOwnProperty('getTicketsByUser'));
dataAdminFactory.getTicketsByUser(username)
.then(
function(data)
{
result = data.data;
$scope.ticketHistory = result;
console.log($scope.ticketHistory);
// console.log(result);
//$scope.ticketHistory = data.data;
},
function(err)
{
alert(err);
}
);
return result;
};
getTicketsByUser(seshkeys.username);//pass session key of user
$scope.submitNewTicket = function(){
// console.log($scope.ticket);
$scope.ticketSubmission.push({
category:$scope.ticket.category,
description:$scope.ticket.description,
startDate:new Date(),
completeDate:'',
status:'Submitted',
aptID:seshkeys.aptid,
usr:seshkeys.username
});
// console.log($scope.ticketSubmission);
dataAdminFactory.submitNewTicket($scope.ticketSubmission[0])
.then(
function(){
$scope.ticketSubmission.pop();
},
function(){
alert('failed ticket submission');
}
);
};
});
| {
"content_hash": "e5c804ba7fc14b8c312682f29235c0c9",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 85,
"avg_line_length": 21.484375,
"alnum_prop": 0.6610909090909091,
"repo_name": "revature-js/innkeeper",
"id": "ae32043cb5878873f3480f4076f3faa749ffc1c6",
"size": "1375",
"binary": false,
"copies": "1",
"ref": "refs/heads/dev",
"path": "app/dev/Maintenance/ctrls/maintenanceCtrl.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "62323"
},
{
"name": "JavaScript",
"bytes": "26791"
}
],
"symlink_target": ""
} |
/**
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
*/
#include <conf_board.h>
#include <board.h>
#include <ioport.h>
void board_init(void)
{
#ifdef ZIGBIT_USB
ioport_configure_pin(LED0_GPIO, IOPORT_DIR_OUTPUT | IOPORT_INIT_HIGH);
ioport_configure_pin(LED1_GPIO, IOPORT_DIR_OUTPUT | IOPORT_INIT_HIGH);
#endif
#ifdef ZIGBIT_EXT
ioport_configure_pin(LED0_GPIO, IOPORT_DIR_OUTPUT | IOPORT_INIT_HIGH);
ioport_configure_pin(LED1_GPIO, IOPORT_DIR_OUTPUT | IOPORT_INIT_HIGH);
ioport_configure_pin(LED2_GPIO, IOPORT_DIR_OUTPUT | IOPORT_INIT_HIGH);
ioport_configure_pin(GPIO_PUSH_BUTTON_0, IOPORT_DIR_INPUT
| IOPORT_LEVEL | IOPORT_PULL_UP);
#endif
#ifdef CONF_BOARD_ENABLE_USARTE0
ioport_configure_pin(IOPORT_CREATE_PIN(PORTE, 3), IOPORT_DIR_OUTPUT
| IOPORT_INIT_HIGH);
ioport_configure_pin(IOPORT_CREATE_PIN(PORTE, 2), IOPORT_DIR_INPUT);
#endif
#ifdef CONF_BOARD_ENABLE_USARTD0
ioport_configure_pin(IOPORT_CREATE_PIN(PORTD, 3), IOPORT_DIR_OUTPUT
| IOPORT_INIT_HIGH);
ioport_configure_pin(IOPORT_CREATE_PIN(PORTD, 2), IOPORT_DIR_INPUT);
#endif
#ifdef CONF_BOARD_AT86RFX
ioport_configure_pin(AT86RFX_SPI_SCK, IOPORT_DIR_OUTPUT
| IOPORT_INIT_HIGH);
ioport_configure_pin(AT86RFX_SPI_MOSI, IOPORT_DIR_OUTPUT
| IOPORT_INIT_HIGH);
ioport_configure_pin(AT86RFX_SPI_MISO, IOPORT_DIR_INPUT);
ioport_configure_pin(AT86RFX_SPI_CS, IOPORT_DIR_OUTPUT | IOPORT_INIT_HIGH);
/* Initialize TRX_RST and SLP_TR as GPIO. */
ioport_configure_pin(AT86RFX_RST_PIN, IOPORT_DIR_OUTPUT | IOPORT_INIT_HIGH);
ioport_configure_pin(AT86RFX_SLP_PIN, IOPORT_DIR_OUTPUT | IOPORT_INIT_HIGH);
#endif
}
| {
"content_hash": "91314cdf36e460776322f109eac77513",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 90,
"avg_line_length": 30.425925925925927,
"alnum_prop": 0.7401095556908095,
"repo_name": "femtoio/femto-usb-blink-example",
"id": "f6df26af43aee13d0b687d6a12f46e2fcfd87892",
"size": "3456",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "blinky/blinky/asf-3.21.0/xmega/boards/xmega_rf233_zigbit/init.c",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "178794"
},
{
"name": "C",
"bytes": "251878780"
},
{
"name": "C++",
"bytes": "47991929"
},
{
"name": "CSS",
"bytes": "2147"
},
{
"name": "HTML",
"bytes": "107322"
},
{
"name": "JavaScript",
"bytes": "588817"
},
{
"name": "Logos",
"bytes": "570108"
},
{
"name": "Makefile",
"bytes": "64558964"
},
{
"name": "Matlab",
"bytes": "10660"
},
{
"name": "Objective-C",
"bytes": "15780083"
},
{
"name": "Perl",
"bytes": "12845"
},
{
"name": "Python",
"bytes": "67293"
},
{
"name": "Scilab",
"bytes": "88572"
},
{
"name": "Shell",
"bytes": "126729"
}
],
"symlink_target": ""
} |
import * as actions from './actions';
export default {
namespaced: true,
state: {
contents: [],
searchTerm: '',
channelFilter: null,
kindFilter: null,
channel_ids: [],
content_kinds: [],
total_results: null,
},
mutations: {
SET_STATE(state, payload) {
Object.assign(state, payload);
},
RESET_STATE(state) {
state.contents = [];
state.searchTerm = '';
state.content_ids = [];
state.content_kinds = [];
state.channelFilter = null;
state.kindFilter = null;
state.total_results = null;
},
SET_SEARCH_TERM(state, searchTerm) {
state.searchTerm = searchTerm;
},
SET_ADDITIONAL_CONTENTS(state, contents) {
state.contents.push(...contents);
},
SET_CONTENT_COPIES(state, copiesCount) {
copiesCount.forEach(copyCount => {
const matchingContent = state.contents.find(
content => copyCount.content_id === content.content_id
);
if (matchingContent) {
matchingContent.copies_count = copyCount.count;
}
});
},
},
actions,
};
| {
"content_hash": "233bda2e0ab0d771d21c9f24c3c9493f",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 64,
"avg_line_length": 24.77777777777778,
"alnum_prop": 0.5811659192825112,
"repo_name": "mrpau/kolibri",
"id": "68be3d54d02e98481729baf5840b204247ee3b1d",
"size": "1115",
"binary": false,
"copies": "3",
"ref": "refs/heads/develop",
"path": "kolibri/plugins/learn/assets/src/modules/search/index.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "601"
},
{
"name": "CSS",
"bytes": "1716299"
},
{
"name": "Dockerfile",
"bytes": "7303"
},
{
"name": "Gherkin",
"bytes": "278074"
},
{
"name": "HTML",
"bytes": "26440"
},
{
"name": "JavaScript",
"bytes": "1537923"
},
{
"name": "Makefile",
"bytes": "13308"
},
{
"name": "Python",
"bytes": "2298911"
},
{
"name": "Shell",
"bytes": "11777"
},
{
"name": "Vue",
"bytes": "1558714"
}
],
"symlink_target": ""
} |
require 'rails_helper'
RSpec.describe UserNotification, type: :model do
let(:user_notification) { FactoryGirl.build(:user_notification) }
it 'should have a valid factory' do
expect(user_notification).to be_valid
end
it 'should be invalid without a user' do
user_notification.user = nil
expect(user_notification).to_not be_valid
end
it 'should be invalid without a notification type' do
user_notification.user_notification_type = nil
expect(user_notification).to_not be_valid
end
end
| {
"content_hash": "3b8b1b02ab429eb53e7d67346d0b4279",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 67,
"avg_line_length": 27.42105263157895,
"alnum_prop": 0.7351247600767754,
"repo_name": "noxee/reddit-fantasy",
"id": "490d5f3591832b4b8414054a8e2d2d89d8ec8d7e",
"size": "521",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spec/models/user_notification_spec.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "4462"
},
{
"name": "HTML",
"bytes": "2247"
},
{
"name": "JavaScript",
"bytes": "103428"
},
{
"name": "Ruby",
"bytes": "124782"
}
],
"symlink_target": ""
} |
/*
You are going to be given a word. Your job is to return the middle character
of the word. If the word's length is odd, return the middle character. If the
word's length is even, return the middle 2 characters.
#Examples:
Kata.getMiddle("test") should return "es"
Kata.getMiddle("testing") should return "t"
Kata.getMiddle("middle") should return "dd"
Kata.getMiddle("A") should return "A"
*/
function getMiddle(s) {
let len = s.length;
return (len % 2 == 0) ? s.charAt((len - 1) / 2) + s.charAt((len + 1) / 2) :
s.charAt(len / 2);
}
| {
"content_hash": "4ea586435aef404a26d22b5901771814",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 77,
"avg_line_length": 26.476190476190474,
"alnum_prop": 0.6672661870503597,
"repo_name": "J-kaizen/kaizen",
"id": "85ae60ec5a8c4846829671f7eeb8debdbe242300",
"size": "556",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "javascript/codewars/7kyu/Get the_Middle_Character.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "591"
},
{
"name": "C++",
"bytes": "3350"
},
{
"name": "JavaScript",
"bytes": "11060"
},
{
"name": "Python",
"bytes": "5006"
},
{
"name": "Ruby",
"bytes": "9386"
}
],
"symlink_target": ""
} |
<?php
session_start();
// Make sure the user is logged in
if((!isset($_SESSION['logged_in'])) OR ($_SESSION['logged_in']!=1)){
// Redirect to login screen
header('Location: login.php');
}
// Right now only one page needs the one function defined, but it may be a good idea to just include this at the top in case we ever need to add other functions various pages need
include('functions.php');
// Include header HTML stuff
include('header_include.php');
// Top navigation menu
echo '<div class="nav-menu"><a href="index.php">View recovery keys</a> | <a href="edit_users.php">Edit admin user access</a> | <a href="logout.php">Log out</a></div>';
?> | {
"content_hash": "77ff4591e628b064c57ebe0564361441",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 179,
"avg_line_length": 32.9,
"alnum_prop": 0.6899696048632219,
"repo_name": "aysiu/fv2db",
"id": "634e0639450a6fd1b3ffa52ad95bbb743a9ef810",
"size": "658",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "files/includes/header.php",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "358"
},
{
"name": "PHP",
"bytes": "17145"
},
{
"name": "Shell",
"bytes": "114"
}
],
"symlink_target": ""
} |
package com.thoughtworks.go.spark.spa;
import com.thoughtworks.go.spark.Routes;
import com.thoughtworks.go.spark.SparkController;
import com.thoughtworks.go.spark.spring.SPAAuthenticationHelper;
import spark.ModelAndView;
import spark.Request;
import spark.Response;
import spark.TemplateEngine;
import java.util.HashMap;
import java.util.Map;
import static spark.Spark.*;
public class AdminAccessTokensController implements SparkController {
private final SPAAuthenticationHelper authenticationHelper;
private final TemplateEngine engine;
public AdminAccessTokensController(SPAAuthenticationHelper authenticationHelper, TemplateEngine engine) {
this.authenticationHelper = authenticationHelper;
this.engine = engine;
}
@Override
public String controllerBasePath() {
return Routes.AdminAccessTokens.SPA_BASE;
}
@Override
public void setupRoutes() {
path(controllerBasePath(), () -> {
before("", authenticationHelper::checkAdminUserAnd403);
get("", this::index, engine);
});
}
public ModelAndView index(Request request, Response response) {
Map<Object, Object> object = new HashMap<>() {{
put("viewTitle", "Admin Access Tokens");
}};
return new ModelAndView(object, null);
}
}
| {
"content_hash": "02658a920c4d52dc0c12df08d940efa7",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 109,
"avg_line_length": 29.622222222222224,
"alnum_prop": 0.7126781695423856,
"repo_name": "gocd/gocd",
"id": "7b1f7e75832727e33ba1120748c64e4c9f941fac",
"size": "1934",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "spark/spark-spa/src/main/java/com/thoughtworks/go/spark/spa/AdminAccessTokensController.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "474"
},
{
"name": "CSS",
"bytes": "1578"
},
{
"name": "EJS",
"bytes": "1626"
},
{
"name": "FreeMarker",
"bytes": "48379"
},
{
"name": "Groovy",
"bytes": "2439752"
},
{
"name": "HTML",
"bytes": "275640"
},
{
"name": "Java",
"bytes": "21175794"
},
{
"name": "JavaScript",
"bytes": "837258"
},
{
"name": "NSIS",
"bytes": "24216"
},
{
"name": "Ruby",
"bytes": "426376"
},
{
"name": "SCSS",
"bytes": "661872"
},
{
"name": "Shell",
"bytes": "13847"
},
{
"name": "TypeScript",
"bytes": "4435018"
},
{
"name": "XSLT",
"bytes": "206746"
}
],
"symlink_target": ""
} |
layout: model
title: Turkish DistilBertForSequenceClassification Base Cased model (from zafercavdar)
author: John Snow Labs
name: distilbert_sequence_classifier_distilbert_base_turkish_cased_emotion
date: 2022-08-23
tags: [distilbert, sequence_classification, open_source, tr]
task: Text Classification
language: tr
edition: Spark NLP 4.1.0
spark_version: 3.0
supported: true
annotator: DistilBertForSequenceClassification
article_header:
type: cover
use_language_switcher: "Python-Scala-Java"
---
## Description
Pretrained DistilBertForSequenceClassification model, adapted from Hugging Face and curated to provide scalability and production-readiness using Spark NLP. `distilbert-base-turkish-cased-emotion` is a Turkish model originally trained by `zafercavdar`.
## Predicted Entities
`sadness`, `anger`, `love`, `surprise`, `joy`, `fear`
{:.btn-box}
<button class="button button-orange" disabled>Live Demo</button>
<button class="button button-orange" disabled>Open in Colab</button>
[Download](https://s3.amazonaws.com/auxdata.johnsnowlabs.com/public/models/distilbert_sequence_classifier_distilbert_base_turkish_cased_emotion_tr_4.1.0_3.0_1661277658287.zip){:.button.button-orange.button-orange-trans.arr.button-icon}
## How to use
<div class="tabs-box" markdown="1">
{% include programmingLanguageSelectScalaPythonNLU.html %}
```python
documentAssembler = DocumentAssembler() \
.setInputCol("text") \
.setOutputCol("document")
tokenizer = Tokenizer() \
.setInputCols("document") \
.setOutputCol("token")
sequenceClassifier_loaded = DistilBertForSequenceClassification.pretrained("distilbert_sequence_classifier_distilbert_base_turkish_cased_emotion","tr") \
.setInputCols(["document", "token"]) \
.setOutputCol("class")
pipeline = Pipeline(stages=[documentAssembler, tokenizer,sequenceClassifier_loaded])
data = spark.createDataFrame([["Spark NLP'yi seviyorum"]]).toDF("text")
result = pipeline.fit(data).transform(data)
```
```scala
val documentAssembler = new DocumentAssembler()
.setInputCol("text")
.setOutputCol("document")
val tokenizer = new Tokenizer()
.setInputCols(Array("document"))
.setOutputCol("token")
val sequenceClassifier_loaded = DistilBertForSequenceClassification.pretrained("distilbert_sequence_classifier_distilbert_base_turkish_cased_emotion","tr")
.setInputCols(Array("document", "token"))
.setOutputCol("class")
val pipeline = new Pipeline().setStages(Array(documentAssembler, tokenizer,sequenceClassifier_loaded))
val data = Seq("Spark NLP'yi seviyorum").toDF("text")
val result = pipeline.fit(data).transform(data)
```
</div>
{:.model-param}
## Model Information
{:.table-model}
|---|---|
|Model Name:|distilbert_sequence_classifier_distilbert_base_turkish_cased_emotion|
|Compatibility:|Spark NLP 4.1.0+|
|License:|Open Source|
|Edition:|Official|
|Input Labels:|[document, token]|
|Output Labels:|[ner]|
|Language:|tr|
|Size:|254.3 MB|
|Case sensitive:|true|
|Max sentence length:|128|
## References
- https://huggingface.co/zafercavdar/distilbert-base-turkish-cased-emotion | {
"content_hash": "0a64a90fde15ab72ccefde6f182f704d",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 252,
"avg_line_length": 32.72631578947368,
"alnum_prop": 0.7555484078481827,
"repo_name": "JohnSnowLabs/spark-nlp",
"id": "7a3b6e30ecb900d986ada8adaac7cd28f74c50b9",
"size": "3113",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/_posts/gadde5300/2022-08-23-distilbert_sequence_classifier_distilbert_base_turkish_cased_emotion_tr.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "14452"
},
{
"name": "Java",
"bytes": "223289"
},
{
"name": "Makefile",
"bytes": "819"
},
{
"name": "Python",
"bytes": "1694517"
},
{
"name": "Scala",
"bytes": "4116435"
},
{
"name": "Shell",
"bytes": "5286"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.