text
stringlengths 2
100k
| meta
dict |
---|---|
using System;
using System.Drawing;
using System.Windows.Forms;
using EWSEditor.Common;
using EWSEditor.Logging;
using Microsoft.Exchange.WebServices.Data;
namespace EWSEditor.Forms
{
public class FormsUtil
{
public enum TriStateBool
{
True,
False
}
public static string GetFolderPathFromDialog(string dialogDescription)
{
FolderBrowserDialog dialog = new FolderBrowserDialog();
// Get the folder to save the output files to, if the user
// cancels this dialog bail out
dialog.Description = "Pick an output folder to save the MIME files to.";
DialogResult result = dialog.ShowDialog();
if (result != DialogResult.OK)
{
DebugLog.WriteVerbose("Leave: User closed dialog with result, {0}." + result);
return string.Empty;
}
return dialog.SelectedPath;
}
public static void DumpMimeContents(ExchangeService service, Folder folder)
{
if (folder != null)
{
string outputPath = FormsUtil.GetFolderPathFromDialog("Pick a folder to save the MIME files in.");
DumpHelper.DumpMIME(
folder,
ItemTraversal.Shallow,
outputPath,
service);
}
}
public static void DumpXmlContents(ExchangeService service, Folder folder)
{
if (folder != null)
{
string outputPath = FormsUtil.GetFolderPathFromDialog("Pick a folder to save the XML files in.");
DumpHelper.DumpXML(
folder,
ItemTraversal.Shallow,
new PropertySet(BasePropertySet.FirstClassProperties),
outputPath,
service);
}
}
public static Image ConvertIconToImage(Icon icon)
{
IconConverter convert = new IconConverter();
object output = convert.ConvertTo(icon, typeof(Image));
if (output == null)
{
return null;
}
return output as Image;
}
/// <summary>
/// Standardize the interaction for a retrying a ServiceObject.Load() call,
/// removing bad properties until the call succeeds.
/// </summary>
/// <param name="service">ExchangeService to make calls with</param>
/// <param name="id">ItemId to bind to</param>
/// <param name="propSet">PropertySet to load for the object</param>
/// <returns>Returns the Item that was bound</returns>
public static Item PerformRetryableItemBind(ExchangeService service, ItemId id, PropertySet propSet)
{
Item item = null;
while (true)
{
try
{
service.ClientRequestId = Guid.NewGuid().ToString(); // Set a new GUID
item = Item.Bind(service, id, propSet);
return item;
}
catch (ServiceResponseException srex)
{
DebugLog.WriteVerbose("Handled exception when retrieving property", srex);
// Give the user the option of removing the bad properites from the request
// and retrying.
if (ErrorDialog.ShowServiceExceptionMsgBox(srex, true, MessageBoxIcon.Warning) == DialogResult.Yes)
{
// Remove the bad properties from the PropertySet and try again.
foreach (PropertyDefinitionBase propDef in srex.Response.ErrorProperties)
{
propSet.Remove(propDef);
}
}
else
{
return item;
}
}
// mstehle - 11/15/2011 - This code makes little sense, commenting out for now...
//catch (Exception ex)
//{
// DebugLog.WriteVerbose(ex);
// if (ex.Message.Length > 0)
// {
// throw;
// }
//}
}
}
/// <summary>
/// Standardize the interaction for a retrying a ServiceObject.Load() call,
/// removing bad properties until the call succeeds.
/// </summary>
/// <param name="obj">Object to load</param>
/// <param name="propSet">PropertySet to load for the object</param>
public static void PerformRetryableLoad(ServiceObject obj, PropertySet propSet)
{
bool retry = true;
while (retry)
{
try
{
obj.Service.ClientRequestId = Guid.NewGuid().ToString(); // Set a new GUID
obj.Load(propSet);
retry = false;
}
catch (ServiceResponseException srex)
{
DebugLog.WriteVerbose("Handled exception when retrieving property", srex);
// Give the user the option of removing the bad properites from the request
// and retrying.
if (ErrorDialog.ShowServiceExceptionMsgBox(srex, true, MessageBoxIcon.Warning) == DialogResult.Yes)
{
// Remove the bad properties from the PropertySet and try again.
foreach (PropertyDefinitionBase propDef in srex.Response.ErrorProperties)
{
propSet.Remove(propDef);
}
retry = true;
}
else
{
retry = false;
}
}
}
}
}
}
| {
"pile_set_name": "Github"
} |
var toObject = require('./toObject');
/**
* Creates a base function for `_.forIn` or `_.forInRight`.
*
* @private
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new base function.
*/
function createBaseFor(fromRight) {
return function(object, iteratee, keysFunc) {
var iterable = toObject(object),
props = keysFunc(object),
length = props.length,
index = fromRight ? length : -1;
while ((fromRight ? index-- : ++index < length)) {
var key = props[index];
if (iteratee(iterable[key], key, iterable) === false) {
break;
}
}
return object;
};
}
module.exports = createBaseFor;
| {
"pile_set_name": "Github"
} |
Performance Guide
=================
Compilation and Parallelism
---------------------------
The pyfora runtime performs two kinds of optimization: JIT compilation, which ensures that
single-threaded code is fast, and automatic parallelization, which ensures that you can use many cores at once.
In both cases, the goal is to get as close as possible to the performance one can achieve using C with hand-crafted parallelism.
However, as with most programming models, there are multiple ways to write the same program and these
may have different performance characteristics. This section will help you understand what the pyfora VM
can optimize and what it can't.
Generally speaking, there's a lot of overhead for invoking pyfora, since it has to compile your code,
and has overhead shipping objects to the server.
Don't expect pyfora to speed up things that are already pretty fast (i.e. less than a second or two).
For achieving maximum single-threaded code, the main takeaways are:
* Numerical calculations involving ints and floats are super fast - very close to what you can get with C.
* There is no penalty for using higher-order functions, ``yield``, classes, etc.
pyfora can usually optimize it all away.
* Repeatedly assigning to a variable in a way that causes it to assume many different types will cause
a slow-down in code compilation. Avoid repeatedly assigning different types to one variable in a loop.
Similarly, ``for x in someList:`` might be slower if the types in someList are heterogeneous.
* Tuples with a structure that is stable throughout your program (e.g. they always have three elements)
will be very fast.
* Tuples where the number of elements varies with program data will be slow - use lists for this.
* Lists prefer to be homogeneously typed - e.g. a list with only floats in it will be faster to access
than a list with floats and ints.
* There is more overhead for using a list in pyfora than in CPython - prefer a few large lists to a lot of small ones. [#performance_defect]_
* Deeply nested lists of lists may be slow. [#performance_defect]_
* Dictionaries are slow. [#performance_defect]_
* Strings are fast.
For achieving maximum parallelism, know these principles:
* pyfora parallelizes within stackframes - if you write ``f(g(), h())``, pyfora will be able to run
g() and h() in parallel.
* Parallel calls within parallel calls work.
* List comprehensions, ``xrange()``, ``sum()``, are parallel out of the box.
* pyfora parallelizes adaptively - it won't be triggered if all the cores in the system are saturated.
* pyfora won't currently parallelize ``for`` and ``while`` loops.
* Passing generator expressions into ``sum()`` or other parallelizable algorithms parallelizes.
* Large lists have a strong performance preference for "cache local" access. Code that touches
neighboring list elements outperforms code that randomly accesses elements all over the list.
The pyfora JIT Compiler
-----------------------
Basic Behavior of the JIT
^^^^^^^^^^^^^^^^^^^^^^^^^
The pyfora JIT compiler optimizes the code your program spends the most time in.
So, for instance, if you write::
def loopSum(x):
result = 0.0
while x > 0:
result = result + x
x = x - 1
return result
print loopSum(1000000000)
The pyfora runtime will notice that your program is spending a huge amount of time in the while loop
and produce a fast machine-code version of it in which x and result are held in registers
(as 64 bit integer and floats, respectively). We generate machine code using the excellent and widely-used llvm_ project.
In simple numerical programs, you'll end up with the same code you'd get from a good C++ compiler.
Today, these are table-stakes for all JIT compilers.
Higher-Order Functions, Classes, and other Language Constructs
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Unlike most JIT compilers applied to dynamically typed languages, pyfora is designed to work well with
higher-order functions and classes. In general, this is a thorny problem for any system attempting to
speed up python because in regular python programs, it's possible to modify class and instance methods
during the execution of the program. This means that any generated code in tight loops has to repeatedly
check to see whether some method call has changed[#mutating_code]_.
Because this is disabled in pyfora code, pyfora can aggressively optimize away these checks,
perform aggressive function inlining, and generally perform a lot of the optimizations you see in
compilers optimizing statically typed languages like C++ or Java.
This allows you to refactor your code into classes and objects without paying a performance penalty.
This flexibility comes at a cost: the compiler generates new code for every combination of types and
functions that the it sees. For instance, if you write::
def loopSum(x, f):
result = 0
while x>0:
result = result + f(x)
x = x - 1
return result
then the compiler will generate completely different code for ``loopSum(1000000, lambda x:x)`` and
``loopSum(1000000, lambda x:x*x)`` and both will be very fast.
This extends to classes. For instance, if you write::
class Add:
def __init__(self, arg):
self.arg = arg
def __call__(self, x):
return self.arg + x
class Multiply:
def __init__(self, arg):
self.arg = arg
def __call__(self, x):
return self.arg * x
class Compose:
def __init__(self, f, g):
self.f = f
self.g = g
def __call__(self, x):
return self.f(self.g(x))
you will get identical performance if you write ``loopSum(1000000, lambda x: x * 10.0 + 20.0)`` and
``loopSum(1000000, Compose(Multiply(10.0), Add(20.0)))`` - they boil down to the same mathematical operations,
and because pyfora doesn't allow class methods to be modified, it can reason about the code well
enough to produce fast machine-code.
Keep the Total Number of Type Combinations Small
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The pyfora compiler operates by tracking all the distinct combinations of types it sees for all the
variables in a given stackframe, and generating code for each combination.
This means that a function like::
def typeExplosion(v):
a = None
b = None
c = None
for x in v:
if x < 1:
a = x
elif x < 2:
b = x
else:
c = x
return (a,b,c)
could generate a lot of code. For instance, if ``a``, ``b``, and ``c`` can all be None or an integer,
you'll end up with 8 copies of the loop.
That by itself isn't a problem, but if you keep adding variables, the total number of types grows
exponentially - eventually, you'll wind up waiting forever for the compiler to finish generating code.
Tuples as Structure
^^^^^^^^^^^^^^^^^^^
Speaking of "types", pyfora considers function instances, class instances, and tuples to be "structural".
This means that the compiler will aggressively track type information about the contents of these objects.
So, for instance, ``lambda x: x + y`` is a different type if ``y`` is an integer or a float in the surrounding scope.
Similarly, ``(x, y)`` tracks the type information of both ``x`` and ``y``.
This is one of the reasons why there is no penalty for putting values into objects or tuples - the
compiler tracks that type information the whole way through, so that ``(x, y)[0]`` is semantically
equivalent to ``x`` regardless of what ``y`` is.
This is great until you start using tuples to represent data with a huge variety of structure,
which can overwhelm the compiler. For instance,
::
def buildTuple(ct):
res = ()
for ix in xrange(ct):
res = res + (ix,)
return res
print buildTuple(100)
will produce a lot of code, because it will produce separate copies of the loop for the types "empty tuple",
"tuple of one integer", "tuple of two integers", ..., "tuple of 99 integers", etc.
Because of this, tuples should generally be used when their shape will be stable (i.e. producing a small number of types)
over the course of the program and you want the compiler to be able to see it. [#type_explosion]_
Also note that this means that if you have tuples with heterogeneous types and you index into it with
a non-constant index, you will generate slower code. This is because the compiler needs to generate
a separate pathway for each possible resulting type. For instance, if you write::
aTuple = (0.0, 1, "a string", lambda x: x)
functionCount = floatCount = 0
for ix in range(100):
# pull an element out of the tuple - the compiler can't tell what
# kind of element it is ahead of time
val = aTuple[ix % len(aTuple)]
if isinstance(val, type(lambda: None)):
functionCount = functionCount + 1
elif isinstance(val, float):
floatCount = floatCount + 1
then the compiler will need to generate branch code at the ``aTuple[...]`` instruction.
This will work, but will be slower than it would be if the tuple index could be known ahead of time.
Lists
^^^^^
Lists are designed to hold data that varies in structure. The compiler doesn't attempt to track the
types of the individual objects inside of a list. Specifically, that means that ``[1, 2.0]`` and ``[2.0, 1]``
have the same type - they're both 'list of int and float', whereas ``(1, 2.0)`` and ``(2.0, 1)`` are
different types.
Lists are fastest when they're homogeneous (e.g. entirely containing elements of the same type).
This is because the pyfora VM can pack data elements very tightly (since they all have the same layout)
and can generate very efficient lookup code. Lists with heterogeneous types are still fast,
but the more types there are, the more code the compiler needs to generate in order to work with them,
so try to keep the total number of types small.
In general, lists have more overhead in than in CPython [#list_size_optimization]_ .
This is because lists are the primary "big data" structure for pyfora - a list can be enormous
(up to terabytes of data), and the data structure that represents them is rather large and complex.
So, if possible, try to structure your program so that you create a few bigger lists,
rather than a lot of little lists.
One exception to this rule: if ``v`` is a list, the operation: ``v + [element]`` will be fast and
pyfora will optimize away the creation of the intermediate list and be careful not to duplicate ``v``
unless absolutely necessary. This is the fastest way to build a list.
Large lists are cheap to concatenate - they're held as a tree structure, so you don't have to worry
that each time you concatenate you're making a copy.
Finally, avoid nesting lists deeply - this places a huge strain on the "big data" component of pyfora's
internal infrastructure.
Dictionaries and Strings
^^^^^^^^^^^^^^^^^^^^^^^^
Dictionaries are currently very slow [#dicts_are_slow]_ . Don't use them inside of loops.
Strings are fast. The pyfora string structure is 32 bytes, allowing the VM to pack any string of 30
characters or less into a data structure that doesn't hit the memory manager.
Indexing into strings is also fast. Strings may be as large as you like (if necessary, they'll be split
across machines).
Note that for strings that are under 100000 characters, string concatenation makes a copy,
so you can accidentally get O(N\ :sup:`2`\ ) performance behavior if you write code where you are repeatedly
concatenating a large string to a small string.
Parallelism
-----------
The Core Model of Parallelism in pyfora
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pyfora exploits "dataflow" parallelism at the stack-frame level. It operates by executing your code
on a single thread and then periodically interrupting it and walking its stack, looking at the flow
of data within each stack frame to see whether there are upcoming calls to functions that it can
schedule while the current call is executing.
For instance, if you write ``f(g(),h())``, then while executing the call to ``g()``, the runtime can see
that you are going to execute ``h()`` next. If you have unsaturated cores, it will rewrite the stack frame
to also call ``h()`` in parallel. When both calls return, it will resume and call ``f()``.
You can think of this as fork-join parallelism where the forks are placed automatically.
As an example, the simple divide-and-conquer implementation of a ``sum()`` function could be written as::
def sum(a,b,f):
if a >= b:
return 0
if a + 1 >= b:
return f(a)
mid = (a+b)/2
return sum(a,mid,f) + sum(mid,b,f)
We can then write ``sum(0, 1000000000000, lambda x: x**0.5)`` and get a parallel implementation.
This works because each call to sum contains two recursive calls to sum, and pyfora can see that these
are independent.
Note that pyfora assumes that exceptions are rare - in the case of ``f(g(),h())``, pyfora assumes that by default,
``g()`` is not going to throw an exception and that it can start working on ``h()``.
In the case where ``g()`` routinely throws exceptions, pyfora will start working on ``h()`` only to find
that the work is not relevant.
Some python idioms use exceptions for flow control: for instance, accessing an attribute and then catching
:class:`AttributeError` as a way of determining if an object meets an interface.
In this case, make sure that you don't have an expensive operation in between the attribute check and
the catch block.
Nested Parallelism
^^^^^^^^^^^^^^^^^^
This model of parallelism naturally allows for nested parallelism. For instance,
``sum(0,1000,lambda x: sum(0,x,lambda y:x*y))`` will be parallel in the outer ``sum()`` but also in
the inner ``sum()``. This is because pyfora doesn't really distinguish between the two - it parallelizes
stackframes, not algorithms.
Adaptive Parallelism
^^^^^^^^^^^^^^^^^^^^
pyfora's parallelism is adaptive and dynamic - it doesn't know ahead of time how the workload is
distributed across your functions. It operates by aggressively splitting stackframes until cores are
saturated, waiting for threads to finish, and then splitting additional threads.
This model is particularly effective when your functions have different run times depending on their input.
For instance, consider::
def isPrime(p):
if p < 2: return 0
x = 2
while x*x <= p:
if p%x == 0:
return 1
x = x + 1
return 1
sum(isPrime(x) for x in xrange(10000000))
Calls to ``isPrime()`` with large integers take a lot longer than calls to ``isPrime()`` with small integers,
because we have to divide so many more numbers into the large ones. Naively allocating chunks of the
10000000 range to cores will end up with some cores working while others finish their tasks early.
pyfora can handle this because it sees the fine structure of parallelism available to sum and can
repeatedly subdivide the larger ranges, keeping all the cores busy.
This technique works best when your tasks subdivide to a very granular level. In the case where you have
a few subtasks with long sections of naturally single-threaded code, pyfora may not schedule those
sections until partway through the calculation. You'll get better performance if you can find a way
to get the calculation to break down as finely as possible.
It's also important to note that the pyfora VM doesn't penalize you for writing your code in a parallel way.
pyfora machine-code is optimized for single-threaded execution - it's only when there are unused cores
and pyfora wants more tasks to work on that we split stackframes, in which case we pop the given stackframe
out of native code and back into the interpreter.
The one caveat here is that function calls have stack-frame overhead. Code that's optimized for maximum
performance sometimes has conditions to switch it out of a recursive "parallelizable" form and into a loop.
This is a trade-off between single-threaded performance and parallelism granularity.
List Comprehensions and Sum are Parallel
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
By default, list comprehensions like ``[isPrime(x) for x in xrange(10000000)]`` are parallel if the
generator in the right-hand side supports the ``__pyfora_generator__`` parallelism model, which both ``xrange()``,
and lists support out of the box.
Similarly, functions like ``sum()`` are parallel if their argument supports the ``__pyfora_generator__`` interface.
Note that this subtly changes the semantics of ``sum:()`` in standard python, ``sum(f(x) for x in xrange(4))``
would be equivalent to::
(((f(0)+f(1))+f(2))+f(3))+f(4)
performing the addition operations linearly from left to right. In the parallel case, we have a tree structure::
(f(0)+f(1)) + (f(2)+f(3))
when addition is associative. Usually this produces the same results, but it's not always true.
For instance, round-off errors in floating point arithmetic mean that floating point addition is not
perfectly associative [#float_associativity]_ .
As this is a deviation from standard python, we plan to make it an optional feature in the future.
Loops are Sequential
^^^^^^^^^^^^^^^^^^^^
Note that pyfora doesn't try to parallelize across loops. The ``isPrime()`` example above runs sequentially.
In the future, we plan to implement loop unrolling so that if you write something like::
res = None
for x in xrange(...):
res = f(g(x), res)
if the calls to ``g()`` are sufficiently expensive, we'll be able to schedule those calls in parallel
and then execute the naturally sequential calls to ``f()`` as they complete.
For the moment, however, assume that while and for loops are sequential (although functions inside them
are all candidates for parallelism).
Lists Prefer Cache-Local Access
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Lists are the basic building-block for "big data" in pyfora. A list that's large enough will get split
across multiple machines. pyfora organizes a list's data into chunks of contiguous indices, where each
chunk represents ~50-100 MB of data.
When one of your threads (in this context, a thread is just a collection of stackframes of python code
that pyfora hasn't decided to subdivide) indexes into a very large list and that data isn't on the same
machine as the thread, pyfora must decide what to do: (a) move the thread to the data, or (b) move the
data to the thread? This is called a "cache miss." Threads tend to be much smaller than 50MB, so usually
it will move the thread to the remote machine.
One of the unique characteristics of the pyfora runtime: it will simulate the execution of code in
advance of its execution to predict cache misses and move data and threads accordingly.
For example, if your thread starts accessing two different blocks in a list, and those two blocks are on
different machines, that thread may end up bouncing back and forth between the two machines in a slow
oscillatory pattern. pyfora can predict these access patterns and optimize the layout of blocks and
threads to prevent this in advance.
All of this infrastructure is useless if you index randomly into very big lists (here, we mean bigger than
~25% of a machine's worth of data). This is because it's now impossible for the scheduler to find an
allocation of blocks to machines where a large fraction of your list accesses don't require you to cross
a machine boundary.
As a result, you'll get the best performance if you can organize your program so that list accesses
are "cache local", meaning that when you access one part of a list you tend to access other parts of
the list that are nearby in the index space [#streaming_read]_ .
.. rubric:: Footnote
.. [#performance_defect] We consider this to be a performance defect that we can eventually fix.
However, some of these defects will be easier to fix than others.
.. [#mutating_code] e.g. the following code:
.. code-block:: python
class X:
def f(self):
return 0
x = X()
print x.f()
# modify all instances of 'X'
X.f = lambda self: return 1
print x.f()
# now modify x itself
x.f = lambda: return 2
print x.f()
.. [#type_explosion] We expect to be able to fix this over the long run by identifying cases where
we have an inordinate number of types and moving to a collapsed representation in which we don't
track all the possible combinations.
.. [#list_size_optimization] Another performance optimization we plan for the future will be to
recognize the difference between small and large lists, and generate a faster implementation when
we recognize ahead of time that lists are going to be small.
.. [#dicts_are_slow] Something we can fix, but not currently scheduled. Let us know if you need this.
.. [#float_associativity] For instance, ``10e30 + (-10e30) + 10e-50`` is not the same as ``10e30 + ((-10e30) + 10e-50)``
.. [#streaming_read] In the future, we plan to implement a "streaming read" model for inherently
non-cache-local algorithms. Essentially the idea is to use the same simulation technique that we
use to determine what your cache misses are going to be, but instead of using them for scheduling
purposes, we will actually fetch the values and merge them back into the program.
In a good implementation, this should allow for a very low per-value overhead scattered value read.
.. _llvm: http://llvm.org/
| {
"pile_set_name": "Github"
} |
{
"data": [
{
"type": "scattergeo",
"marker": {
"opacity": 0.5,
"color": "green",
"size": 100
},
"lon": [
0
],
"lat": [
0
]
},
{
"geo": "geo2",
"type": "scattergeo",
"marker": {
"opacity": 0.5,
"color": "yellow",
"size": 100
},
"lon": [
0
],
"lat": [
0
]
},
{
"geo": "geo3",
"type": "scattergeo",
"marker": {
"opacity": 0.5,
"color": "red",
"size": 100
},
"lon": [
0
],
"lat": [
0
]
}
],
"layout": {
"width": 600,
"height": 800,
"title": {
"text": "geo visible false should override template.layout.geo.show*"
},
"geo": {
"visible": true
},
"geo2": {
"visible": false
},
"geo3": {
"visible": true
},
"template": {
"layout": {
"geo": {
"showcoastlines": true,
"showcountries": true,
"showframe": true,
"showland": true,
"showlakes": true,
"showocean": true,
"showrivers": true,
"showsubunits": true,
"lonaxis": {
"showgrid": true
},
"lataxis": {
"showgrid": true
}
}
}
}
}
}
| {
"pile_set_name": "Github"
} |
University of Trinidad and Tobago
| {
"pile_set_name": "Github"
} |
{
"layout": "layouts/page.njk"
}
| {
"pile_set_name": "Github"
} |
# /* **************************************************************************
# * *
# * (C) Copyright Paul Mensonides 2002.
# * (C) Copyright Edward Diener 2014.
# * Distributed under the Boost Software License, Version 1.0. (See
# * accompanying file LICENSE_1_0.txt or copy at
# * http://www.boost.org/LICENSE_1_0.txt)
# * *
# ************************************************************************** */
#
# /* See http://www.boost.org for most recent version. */
#
# ifndef BOOST_PREPROCESSOR_ARRAY_PUSH_BACK_HPP
# define BOOST_PREPROCESSOR_ARRAY_PUSH_BACK_HPP
#
# include <boost/preprocessor/arithmetic/inc.hpp>
# include <boost/preprocessor/array/data.hpp>
# include <boost/preprocessor/array/size.hpp>
# include <boost/preprocessor/config/config.hpp>
# include <boost/preprocessor/punctuation/comma_if.hpp>
# include <boost/preprocessor/tuple/rem.hpp>
# include <boost/preprocessor/array/detail/get_data.hpp>
#
# /* BOOST_PP_ARRAY_PUSH_BACK */
#
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
# define BOOST_PP_ARRAY_PUSH_BACK(array, elem) BOOST_PP_ARRAY_PUSH_BACK_I(BOOST_PP_ARRAY_SIZE(array), BOOST_PP_ARRAY_DATA(array), elem)
# else
# define BOOST_PP_ARRAY_PUSH_BACK(array, elem) BOOST_PP_ARRAY_PUSH_BACK_D(array, elem)
# define BOOST_PP_ARRAY_PUSH_BACK_D(array, elem) BOOST_PP_ARRAY_PUSH_BACK_I(BOOST_PP_ARRAY_SIZE(array), BOOST_PP_ARRAY_DATA(array), elem)
# endif
#
# define BOOST_PP_ARRAY_PUSH_BACK_I(size, data, elem) (BOOST_PP_INC(size), (BOOST_PP_ARRAY_DETAIL_GET_DATA(size,data) BOOST_PP_COMMA_IF(size) elem))
#
# endif
| {
"pile_set_name": "Github"
} |
import { compute } from './hamming';
describe('Hamming', () => {
test('empty strands', () => {
expect(compute('', '')).toEqual(0);
});
xtest('single letter identical strands', () => {
expect(compute('A', 'A')).toEqual(0);
});
xtest('single letter different strands', () => {
expect(compute('G', 'T')).toEqual(1);
});
xtest('long identical strands', () => {
expect(compute('GGACTGAAATCTG', 'GGACTGAAATCTG')).toEqual(0);
});
xtest('long different strands', () => {
expect(compute('GGACGGATTCTG', 'AGGACGGATTCT')).toEqual(9);
});
xtest('disallow first strand longer', () => {
expect(() => compute('AATG', 'AAA')).toThrow(
new Error('left and right strands must be of equal length'),
);
});
xtest('disallow second strand longer', () => {
expect(() => compute('ATA', 'AGTG')).toThrow(
new Error('left and right strands must be of equal length'),
);
});
xtest('disallow left empty strand', () => {
expect(() => compute('', 'G')).toThrow(
new Error('left strand must not be empty'),
);
});
xtest('disallow right empty strand', () => {
expect(() => compute('G', '')).toThrow(
new Error('right strand must not be empty'),
);
});
});
| {
"pile_set_name": "Github"
} |
#
# Makefile for the Linux/MIPS kernel.
#
CPPFLAGS_vmlinux.lds := $(KBUILD_CFLAGS)
extra-y := head.o init_task.o vmlinux.lds
obj-y += cpu-probe.o branch.o entry.o genex.o irq.o process.o \
ptrace.o reset.o setup.o signal.o syscall.o \
time.o topology.o traps.o unaligned.o watch.o
obj-$(CONFIG_CEVT_BCM1480) += cevt-bcm1480.o
obj-$(CONFIG_CEVT_R4K_LIB) += cevt-r4k.o
obj-$(CONFIG_MIPS_MT_SMTC) += cevt-smtc.o
obj-$(CONFIG_CEVT_DS1287) += cevt-ds1287.o
obj-$(CONFIG_CEVT_GT641XX) += cevt-gt641xx.o
obj-$(CONFIG_CEVT_SB1250) += cevt-sb1250.o
obj-$(CONFIG_CEVT_TXX9) += cevt-txx9.o
obj-$(CONFIG_CSRC_BCM1480) += csrc-bcm1480.o
obj-$(CONFIG_CSRC_IOASIC) += csrc-ioasic.o
obj-$(CONFIG_CSRC_R4K_LIB) += csrc-r4k.o
obj-$(CONFIG_CSRC_SB1250) += csrc-sb1250.o
obj-$(CONFIG_SYNC_R4K) += sync-r4k.o
obj-$(CONFIG_STACKTRACE) += stacktrace.o
obj-$(CONFIG_MODULES) += mips_ksyms.o module.o
obj-$(CONFIG_CPU_LOONGSON2) += r4k_fpu.o r4k_switch.o
obj-$(CONFIG_CPU_MIPS32) += r4k_fpu.o r4k_switch.o
obj-$(CONFIG_CPU_MIPS64) += r4k_fpu.o r4k_switch.o
obj-$(CONFIG_CPU_R3000) += r2300_fpu.o r2300_switch.o
obj-$(CONFIG_CPU_R4300) += r4k_fpu.o r4k_switch.o
obj-$(CONFIG_CPU_R4X00) += r4k_fpu.o r4k_switch.o
obj-$(CONFIG_CPU_R5000) += r4k_fpu.o r4k_switch.o
obj-$(CONFIG_CPU_R6000) += r6000_fpu.o r4k_switch.o
obj-$(CONFIG_CPU_R5432) += r4k_fpu.o r4k_switch.o
obj-$(CONFIG_CPU_R5500) += r4k_fpu.o r4k_switch.o
obj-$(CONFIG_CPU_R8000) += r4k_fpu.o r4k_switch.o
obj-$(CONFIG_CPU_RM7000) += r4k_fpu.o r4k_switch.o
obj-$(CONFIG_CPU_RM9000) += r4k_fpu.o r4k_switch.o
obj-$(CONFIG_CPU_NEVADA) += r4k_fpu.o r4k_switch.o
obj-$(CONFIG_CPU_R10000) += r4k_fpu.o r4k_switch.o
obj-$(CONFIG_CPU_SB1) += r4k_fpu.o r4k_switch.o
obj-$(CONFIG_CPU_TX39XX) += r2300_fpu.o r2300_switch.o
obj-$(CONFIG_CPU_TX49XX) += r4k_fpu.o r4k_switch.o
obj-$(CONFIG_CPU_VR41XX) += r4k_fpu.o r4k_switch.o
obj-$(CONFIG_CPU_CAVIUM_OCTEON) += octeon_switch.o
obj-$(CONFIG_SMP) += smp.o
obj-$(CONFIG_SMP_UP) += smp-up.o
obj-$(CONFIG_MIPS_MT) += mips-mt.o
obj-$(CONFIG_MIPS_MT_FPAFF) += mips-mt-fpaff.o
obj-$(CONFIG_MIPS_MT_SMTC) += smtc.o smtc-asm.o smtc-proc.o
obj-$(CONFIG_MIPS_MT_SMP) += smp-mt.o
obj-$(CONFIG_MIPS_CMP) += smp-cmp.o
obj-$(CONFIG_CPU_MIPSR2) += spram.o
obj-$(CONFIG_MIPS_VPE_LOADER) += vpe.o
obj-$(CONFIG_MIPS_VPE_APSP_API) += rtlx.o
obj-$(CONFIG_MIPS_APSP_KSPD) += kspd.o
obj-$(CONFIG_I8259) += i8259.o
obj-$(CONFIG_IRQ_CPU) += irq_cpu.o
obj-$(CONFIG_IRQ_CPU_RM7K) += irq-rm7000.o
obj-$(CONFIG_IRQ_CPU_RM9K) += irq-rm9000.o
obj-$(CONFIG_MIPS_MSC) += irq-msc01.o
obj-$(CONFIG_IRQ_TXX9) += irq_txx9.o
obj-$(CONFIG_IRQ_GT641XX) += irq-gt641xx.o
obj-$(CONFIG_IRQ_GIC) += irq-gic.o
obj-$(CONFIG_32BIT) += scall32-o32.o
obj-$(CONFIG_64BIT) += scall64-64.o
obj-$(CONFIG_MIPS32_COMPAT) += linux32.o ptrace32.o signal32.o
obj-$(CONFIG_MIPS32_N32) += binfmt_elfn32.o scall64-n32.o signal_n32.o
obj-$(CONFIG_MIPS32_O32) += binfmt_elfo32.o scall64-o32.o
obj-$(CONFIG_KGDB) += kgdb.o
obj-$(CONFIG_PROC_FS) += proc.o
obj-$(CONFIG_64BIT) += cpu-bugs64.o
obj-$(CONFIG_I8253) += i8253.o
obj-$(CONFIG_GPIO_TXX9) += gpio_txx9.o
obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(KBUILD_CFLAGS) -Wa,-mdaddi -c -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi)
obj-$(CONFIG_HAVE_STD_PC_SERIAL_PORT) += 8250-platform.o
| {
"pile_set_name": "Github"
} |
//
// This file is auto-generated. Please don't modify it!
//
package org.opencv.video;
import java.util.List;
import org.opencv.core.Mat;
import org.opencv.core.MatOfByte;
import org.opencv.core.MatOfFloat;
import org.opencv.core.MatOfPoint2f;
import org.opencv.core.MatOfRect;
import org.opencv.core.Rect;
import org.opencv.core.RotatedRect;
import org.opencv.core.Size;
import org.opencv.core.TermCriteria;
import org.opencv.utils.Converters;
public class Video {
private static final int
CV_LKFLOW_INITIAL_GUESSES = 4,
CV_LKFLOW_GET_MIN_EIGENVALS = 8;
public static final int
OPTFLOW_USE_INITIAL_FLOW = CV_LKFLOW_INITIAL_GUESSES,
OPTFLOW_LK_GET_MIN_EIGENVALS = CV_LKFLOW_GET_MIN_EIGENVALS,
OPTFLOW_FARNEBACK_GAUSSIAN = 256;
//
// C++: RotatedRect CamShift(Mat probImage, Rect& window, TermCriteria criteria)
//
/**
* <p>Finds an object center, size, and orientation.</p>
*
* <p>The function implements the CAMSHIFT object tracking algorithm [Bradski98].
* First, it finds an object center using "meanShift" and then adjusts the
* window size and finds the optimal rotation. The function returns the rotated
* rectangle structure that includes the object position, size, and orientation.
* The next position of the search window can be obtained with <code>RotatedRect.boundingRect()</code>.</p>
*
* <p>See the OpenCV sample <code>camshiftdemo.c</code> that tracks colored
* objects.</p>
*
* <p>Note:</p>
* <ul>
* <li> (Python) A sample explaining the camshift tracking algorithm can be
* found at opencv_source_code/samples/python2/camshift.py
* </ul>
*
* @param probImage Back projection of the object histogram. See
* "calcBackProject".
* @param window Initial search window.
* @param criteria Stop criteria for the underlying "meanShift".
*
* <p>:returns: (in old interfaces) Number of iterations CAMSHIFT took to converge</p>
*
* @see <a href="http://docs.opencv.org/modules/video/doc/motion_analysis_and_object_tracking.html#camshift">org.opencv.video.Video.CamShift</a>
*/
public static RotatedRect CamShift(Mat probImage, Rect window, TermCriteria criteria)
{
double[] window_out = new double[4];
RotatedRect retVal = new RotatedRect(CamShift_0(probImage.nativeObj, window.x, window.y, window.width, window.height, window_out, criteria.type, criteria.maxCount, criteria.epsilon));
if(window!=null){ window.x = (int)window_out[0]; window.y = (int)window_out[1]; window.width = (int)window_out[2]; window.height = (int)window_out[3]; }
return retVal;
}
//
// C++: int buildOpticalFlowPyramid(Mat img, vector_Mat& pyramid, Size winSize, int maxLevel, bool withDerivatives = true, int pyrBorder = BORDER_REFLECT_101, int derivBorder = BORDER_CONSTANT, bool tryReuseInputImage = true)
//
/**
* <p>Constructs the image pyramid which can be passed to "calcOpticalFlowPyrLK".</p>
*
* @param img 8-bit input image.
* @param pyramid output pyramid.
* @param winSize window size of optical flow algorithm. Must be not less than
* <code>winSize</code> argument of "calcOpticalFlowPyrLK". It is needed to
* calculate required padding for pyramid levels.
* @param maxLevel 0-based maximal pyramid level number.
* @param withDerivatives set to precompute gradients for the every pyramid
* level. If pyramid is constructed without the gradients then "calcOpticalFlowPyrLK"
* will calculate them internally.
* @param pyrBorder the border mode for pyramid layers.
* @param derivBorder the border mode for gradients.
* @param tryReuseInputImage put ROI of input image into the pyramid if
* possible. You can pass <code>false</code> to force data copying.
*
* <p>:return: number of levels in constructed pyramid. Can be less than
* <code>maxLevel</code>.</p>
*
* @see <a href="http://docs.opencv.org/modules/video/doc/motion_analysis_and_object_tracking.html#buildopticalflowpyramid">org.opencv.video.Video.buildOpticalFlowPyramid</a>
*/
public static int buildOpticalFlowPyramid(Mat img, List<Mat> pyramid, Size winSize, int maxLevel, boolean withDerivatives, int pyrBorder, int derivBorder, boolean tryReuseInputImage)
{
Mat pyramid_mat = new Mat();
int retVal = buildOpticalFlowPyramid_0(img.nativeObj, pyramid_mat.nativeObj, winSize.width, winSize.height, maxLevel, withDerivatives, pyrBorder, derivBorder, tryReuseInputImage);
Converters.Mat_to_vector_Mat(pyramid_mat, pyramid);
return retVal;
}
/**
* <p>Constructs the image pyramid which can be passed to "calcOpticalFlowPyrLK".</p>
*
* @param img 8-bit input image.
* @param pyramid output pyramid.
* @param winSize window size of optical flow algorithm. Must be not less than
* <code>winSize</code> argument of "calcOpticalFlowPyrLK". It is needed to
* calculate required padding for pyramid levels.
* @param maxLevel 0-based maximal pyramid level number.
*
* @see <a href="http://docs.opencv.org/modules/video/doc/motion_analysis_and_object_tracking.html#buildopticalflowpyramid">org.opencv.video.Video.buildOpticalFlowPyramid</a>
*/
public static int buildOpticalFlowPyramid(Mat img, List<Mat> pyramid, Size winSize, int maxLevel)
{
Mat pyramid_mat = new Mat();
int retVal = buildOpticalFlowPyramid_1(img.nativeObj, pyramid_mat.nativeObj, winSize.width, winSize.height, maxLevel);
Converters.Mat_to_vector_Mat(pyramid_mat, pyramid);
return retVal;
}
//
// C++: double calcGlobalOrientation(Mat orientation, Mat mask, Mat mhi, double timestamp, double duration)
//
/**
* <p>Calculates a global motion orientation in a selected region.</p>
*
* <p>The function calculates an average motion direction in the selected region
* and returns the angle between 0 degrees and 360 degrees. The average
* direction is computed from the weighted orientation histogram, where a recent
* motion has a larger weight and the motion occurred in the past has a smaller
* weight, as recorded in <code>mhi</code>.</p>
*
* @param orientation Motion gradient orientation image calculated by the
* function "calcMotionGradient".
* @param mask Mask image. It may be a conjunction of a valid gradient mask,
* also calculated by "calcMotionGradient", and the mask of a region whose
* direction needs to be calculated.
* @param mhi Motion history image calculated by "updateMotionHistory".
* @param timestamp Timestamp passed to "updateMotionHistory".
* @param duration Maximum duration of a motion track in milliseconds, passed to
* "updateMotionHistory".
*
* @see <a href="http://docs.opencv.org/modules/video/doc/motion_analysis_and_object_tracking.html#calcglobalorientation">org.opencv.video.Video.calcGlobalOrientation</a>
*/
public static double calcGlobalOrientation(Mat orientation, Mat mask, Mat mhi, double timestamp, double duration)
{
double retVal = calcGlobalOrientation_0(orientation.nativeObj, mask.nativeObj, mhi.nativeObj, timestamp, duration);
return retVal;
}
//
// C++: void calcMotionGradient(Mat mhi, Mat& mask, Mat& orientation, double delta1, double delta2, int apertureSize = 3)
//
/**
* <p>Calculates a gradient orientation of a motion history image.</p>
*
* <p>The function calculates a gradient orientation at each pixel <em>(x, y)</em>
* as:</p>
*
* <p><em>orientation(x,y)= arctan((dmhi/dy)/(dmhi/dx))</em></p>
*
* <p>In fact, "fastAtan2" and "phase" are used so that the computed angle is
* measured in degrees and covers the full range 0..360. Also, the
* <code>mask</code> is filled to indicate pixels where the computed angle is
* valid.</p>
*
* <p>Note:</p>
* <ul>
* <li> (Python) An example on how to perform a motion template technique can
* be found at opencv_source_code/samples/python2/motempl.py
* </ul>
*
* @param mhi Motion history single-channel floating-point image.
* @param mask Output mask image that has the type <code>CV_8UC1</code> and the
* same size as <code>mhi</code>. Its non-zero elements mark pixels where the
* motion gradient data is correct.
* @param orientation Output motion gradient orientation image that has the same
* type and the same size as <code>mhi</code>. Each pixel of the image is a
* motion orientation, from 0 to 360 degrees.
* @param delta1 Minimal (or maximal) allowed difference between
* <code>mhi</code> values within a pixel neighborhood.
* @param delta2 Maximal (or minimal) allowed difference between
* <code>mhi</code> values within a pixel neighborhood. That is, the function
* finds the minimum (<em>m(x,y)</em>) and maximum (<em>M(x,y)</em>)
* <code>mhi</code> values over <em>3 x 3</em> neighborhood of each pixel and
* marks the motion orientation at <em>(x, y)</em> as valid only if
*
* <p><em>min(delta1, delta2) <= M(x,y)-m(x,y) <= max(delta1, delta2).</em></p>
* @param apertureSize Aperture size of the "Sobel" operator.
*
* @see <a href="http://docs.opencv.org/modules/video/doc/motion_analysis_and_object_tracking.html#calcmotiongradient">org.opencv.video.Video.calcMotionGradient</a>
*/
public static void calcMotionGradient(Mat mhi, Mat mask, Mat orientation, double delta1, double delta2, int apertureSize)
{
calcMotionGradient_0(mhi.nativeObj, mask.nativeObj, orientation.nativeObj, delta1, delta2, apertureSize);
return;
}
/**
* <p>Calculates a gradient orientation of a motion history image.</p>
*
* <p>The function calculates a gradient orientation at each pixel <em>(x, y)</em>
* as:</p>
*
* <p><em>orientation(x,y)= arctan((dmhi/dy)/(dmhi/dx))</em></p>
*
* <p>In fact, "fastAtan2" and "phase" are used so that the computed angle is
* measured in degrees and covers the full range 0..360. Also, the
* <code>mask</code> is filled to indicate pixels where the computed angle is
* valid.</p>
*
* <p>Note:</p>
* <ul>
* <li> (Python) An example on how to perform a motion template technique can
* be found at opencv_source_code/samples/python2/motempl.py
* </ul>
*
* @param mhi Motion history single-channel floating-point image.
* @param mask Output mask image that has the type <code>CV_8UC1</code> and the
* same size as <code>mhi</code>. Its non-zero elements mark pixels where the
* motion gradient data is correct.
* @param orientation Output motion gradient orientation image that has the same
* type and the same size as <code>mhi</code>. Each pixel of the image is a
* motion orientation, from 0 to 360 degrees.
* @param delta1 Minimal (or maximal) allowed difference between
* <code>mhi</code> values within a pixel neighborhood.
* @param delta2 Maximal (or minimal) allowed difference between
* <code>mhi</code> values within a pixel neighborhood. That is, the function
* finds the minimum (<em>m(x,y)</em>) and maximum (<em>M(x,y)</em>)
* <code>mhi</code> values over <em>3 x 3</em> neighborhood of each pixel and
* marks the motion orientation at <em>(x, y)</em> as valid only if
*
* <p><em>min(delta1, delta2) <= M(x,y)-m(x,y) <= max(delta1, delta2).</em></p>
*
* @see <a href="http://docs.opencv.org/modules/video/doc/motion_analysis_and_object_tracking.html#calcmotiongradient">org.opencv.video.Video.calcMotionGradient</a>
*/
public static void calcMotionGradient(Mat mhi, Mat mask, Mat orientation, double delta1, double delta2)
{
calcMotionGradient_1(mhi.nativeObj, mask.nativeObj, orientation.nativeObj, delta1, delta2);
return;
}
//
// C++: void calcOpticalFlowFarneback(Mat prev, Mat next, Mat& flow, double pyr_scale, int levels, int winsize, int iterations, int poly_n, double poly_sigma, int flags)
//
/**
* <p>Computes a dense optical flow using the Gunnar Farneback's algorithm.</p>
*
* <p>The function finds an optical flow for each <code>prev</code> pixel using the
* [Farneback2003] algorithm so that</p>
*
* <p><em>prev(y,x) ~ next(y + flow(y,x)[1], x + flow(y,x)[0])</em></p>
*
* <p>Note:</p>
* <ul>
* <li> An example using the optical flow algorithm described by Gunnar
* Farneback can be found at opencv_source_code/samples/cpp/fback.cpp
* <li> (Python) An example using the optical flow algorithm described by
* Gunnar Farneback can be found at opencv_source_code/samples/python2/opt_flow.py
* </ul>
*
* @param prev first 8-bit single-channel input image.
* @param next second input image of the same size and the same type as
* <code>prev</code>.
* @param flow computed flow image that has the same size as <code>prev</code>
* and type <code>CV_32FC2</code>.
* @param pyr_scale parameter, specifying the image scale (<1) to build pyramids
* for each image; <code>pyr_scale=0.5</code> means a classical pyramid, where
* each next layer is twice smaller than the previous one.
* @param levels number of pyramid layers including the initial image;
* <code>levels=1</code> means that no extra layers are created and only the
* original images are used.
* @param winsize averaging window size; larger values increase the algorithm
* robustness to image noise and give more chances for fast motion detection,
* but yield more blurred motion field.
* @param iterations number of iterations the algorithm does at each pyramid
* level.
* @param poly_n size of the pixel neighborhood used to find polynomial
* expansion in each pixel; larger values mean that the image will be
* approximated with smoother surfaces, yielding more robust algorithm and more
* blurred motion field, typically <code>poly_n</code> =5 or 7.
* @param poly_sigma standard deviation of the Gaussian that is used to smooth
* derivatives used as a basis for the polynomial expansion; for
* <code>poly_n=5</code>, you can set <code>poly_sigma=1.1</code>, for
* <code>poly_n=7</code>, a good value would be <code>poly_sigma=1.5</code>.
* @param flags operation flags that can be a combination of the following:
* <ul>
* <li> OPTFLOW_USE_INITIAL_FLOW uses the input <code>flow</code> as an
* initial flow approximation.
* <li> OPTFLOW_FARNEBACK_GAUSSIAN uses the Gaussian <em>winsizexwinsize</em>
* filter instead of a box filter of the same size for optical flow estimation;
* usually, this option gives z more accurate flow than with a box filter, at
* the cost of lower speed; normally, <code>winsize</code> for a Gaussian window
* should be set to a larger value to achieve the same level of robustness.
* </ul>
*
* @see <a href="http://docs.opencv.org/modules/video/doc/motion_analysis_and_object_tracking.html#calcopticalflowfarneback">org.opencv.video.Video.calcOpticalFlowFarneback</a>
*/
public static void calcOpticalFlowFarneback(Mat prev, Mat next, Mat flow, double pyr_scale, int levels, int winsize, int iterations, int poly_n, double poly_sigma, int flags)
{
calcOpticalFlowFarneback_0(prev.nativeObj, next.nativeObj, flow.nativeObj, pyr_scale, levels, winsize, iterations, poly_n, poly_sigma, flags);
return;
}
//
// C++: void calcOpticalFlowPyrLK(Mat prevImg, Mat nextImg, vector_Point2f prevPts, vector_Point2f& nextPts, vector_uchar& status, vector_float& err, Size winSize = Size(21,21), int maxLevel = 3, TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 0.01), int flags = 0, double minEigThreshold = 1e-4)
//
/**
* <p>Calculates an optical flow for a sparse feature set using the iterative
* Lucas-Kanade method with pyramids.</p>
*
* <p>The function implements a sparse iterative version of the Lucas-Kanade
* optical flow in pyramids. See [Bouguet00]. The function is parallelized with
* the TBB library.</p>
*
* <p>Note:</p>
* <ul>
* <li> An example using the Lucas-Kanade optical flow algorithm can be found
* at opencv_source_code/samples/cpp/lkdemo.cpp
* <li> (Python) An example using the Lucas-Kanade optical flow algorithm can
* be found at opencv_source_code/samples/python2/lk_track.py
* <li> (Python) An example using the Lucas-Kanade tracker for homography
* matching can be found at opencv_source_code/samples/python2/lk_homography.py
* </ul>
*
* @param prevImg first 8-bit input image or pyramid constructed by
* "buildOpticalFlowPyramid".
* @param nextImg second input image or pyramid of the same size and the same
* type as <code>prevImg</code>.
* @param prevPts vector of 2D points for which the flow needs to be found;
* point coordinates must be single-precision floating-point numbers.
* @param nextPts output vector of 2D points (with single-precision
* floating-point coordinates) containing the calculated new positions of input
* features in the second image; when <code>OPTFLOW_USE_INITIAL_FLOW</code> flag
* is passed, the vector must have the same size as in the input.
* @param status output status vector (of unsigned chars); each element of the
* vector is set to 1 if the flow for the corresponding features has been found,
* otherwise, it is set to 0.
* @param err output vector of errors; each element of the vector is set to an
* error for the corresponding feature, type of the error measure can be set in
* <code>flags</code> parameter; if the flow wasn't found then the error is not
* defined (use the <code>status</code> parameter to find such cases).
* @param winSize size of the search window at each pyramid level.
* @param maxLevel 0-based maximal pyramid level number; if set to 0, pyramids
* are not used (single level), if set to 1, two levels are used, and so on; if
* pyramids are passed to input then algorithm will use as many levels as
* pyramids have but no more than <code>maxLevel</code>.
* @param criteria parameter, specifying the termination criteria of the
* iterative search algorithm (after the specified maximum number of iterations
* <code>criteria.maxCount</code> or when the search window moves by less than
* <code>criteria.epsilon</code>.
* @param flags operation flags:
* <ul>
* <li> OPTFLOW_USE_INITIAL_FLOW uses initial estimations, stored in
* <code>nextPts</code>; if the flag is not set, then <code>prevPts</code> is
* copied to <code>nextPts</code> and is considered the initial estimate.
* <li> OPTFLOW_LK_GET_MIN_EIGENVALS use minimum eigen values as an error
* measure (see <code>minEigThreshold</code> description); if the flag is not
* set, then L1 distance between patches around the original and a moved point,
* divided by number of pixels in a window, is used as a error measure.
* </ul>
* @param minEigThreshold the algorithm calculates the minimum eigen value of a
* 2x2 normal matrix of optical flow equations (this matrix is called a spatial
* gradient matrix in [Bouguet00]), divided by number of pixels in a window; if
* this value is less than <code>minEigThreshold</code>, then a corresponding
* feature is filtered out and its flow is not processed, so it allows to remove
* bad points and get a performance boost.
*
* @see <a href="http://docs.opencv.org/modules/video/doc/motion_analysis_and_object_tracking.html#calcopticalflowpyrlk">org.opencv.video.Video.calcOpticalFlowPyrLK</a>
*/
public static void calcOpticalFlowPyrLK(Mat prevImg, Mat nextImg, MatOfPoint2f prevPts, MatOfPoint2f nextPts, MatOfByte status, MatOfFloat err, Size winSize, int maxLevel, TermCriteria criteria, int flags, double minEigThreshold)
{
Mat prevPts_mat = prevPts;
Mat nextPts_mat = nextPts;
Mat status_mat = status;
Mat err_mat = err;
calcOpticalFlowPyrLK_0(prevImg.nativeObj, nextImg.nativeObj, prevPts_mat.nativeObj, nextPts_mat.nativeObj, status_mat.nativeObj, err_mat.nativeObj, winSize.width, winSize.height, maxLevel, criteria.type, criteria.maxCount, criteria.epsilon, flags, minEigThreshold);
return;
}
/**
* <p>Calculates an optical flow for a sparse feature set using the iterative
* Lucas-Kanade method with pyramids.</p>
*
* <p>The function implements a sparse iterative version of the Lucas-Kanade
* optical flow in pyramids. See [Bouguet00]. The function is parallelized with
* the TBB library.</p>
*
* <p>Note:</p>
* <ul>
* <li> An example using the Lucas-Kanade optical flow algorithm can be found
* at opencv_source_code/samples/cpp/lkdemo.cpp
* <li> (Python) An example using the Lucas-Kanade optical flow algorithm can
* be found at opencv_source_code/samples/python2/lk_track.py
* <li> (Python) An example using the Lucas-Kanade tracker for homography
* matching can be found at opencv_source_code/samples/python2/lk_homography.py
* </ul>
*
* @param prevImg first 8-bit input image or pyramid constructed by
* "buildOpticalFlowPyramid".
* @param nextImg second input image or pyramid of the same size and the same
* type as <code>prevImg</code>.
* @param prevPts vector of 2D points for which the flow needs to be found;
* point coordinates must be single-precision floating-point numbers.
* @param nextPts output vector of 2D points (with single-precision
* floating-point coordinates) containing the calculated new positions of input
* features in the second image; when <code>OPTFLOW_USE_INITIAL_FLOW</code> flag
* is passed, the vector must have the same size as in the input.
* @param status output status vector (of unsigned chars); each element of the
* vector is set to 1 if the flow for the corresponding features has been found,
* otherwise, it is set to 0.
* @param err output vector of errors; each element of the vector is set to an
* error for the corresponding feature, type of the error measure can be set in
* <code>flags</code> parameter; if the flow wasn't found then the error is not
* defined (use the <code>status</code> parameter to find such cases).
* @param winSize size of the search window at each pyramid level.
* @param maxLevel 0-based maximal pyramid level number; if set to 0, pyramids
* are not used (single level), if set to 1, two levels are used, and so on; if
* pyramids are passed to input then algorithm will use as many levels as
* pyramids have but no more than <code>maxLevel</code>.
*
* @see <a href="http://docs.opencv.org/modules/video/doc/motion_analysis_and_object_tracking.html#calcopticalflowpyrlk">org.opencv.video.Video.calcOpticalFlowPyrLK</a>
*/
public static void calcOpticalFlowPyrLK(Mat prevImg, Mat nextImg, MatOfPoint2f prevPts, MatOfPoint2f nextPts, MatOfByte status, MatOfFloat err, Size winSize, int maxLevel)
{
Mat prevPts_mat = prevPts;
Mat nextPts_mat = nextPts;
Mat status_mat = status;
Mat err_mat = err;
calcOpticalFlowPyrLK_1(prevImg.nativeObj, nextImg.nativeObj, prevPts_mat.nativeObj, nextPts_mat.nativeObj, status_mat.nativeObj, err_mat.nativeObj, winSize.width, winSize.height, maxLevel);
return;
}
/**
* <p>Calculates an optical flow for a sparse feature set using the iterative
* Lucas-Kanade method with pyramids.</p>
*
* <p>The function implements a sparse iterative version of the Lucas-Kanade
* optical flow in pyramids. See [Bouguet00]. The function is parallelized with
* the TBB library.</p>
*
* <p>Note:</p>
* <ul>
* <li> An example using the Lucas-Kanade optical flow algorithm can be found
* at opencv_source_code/samples/cpp/lkdemo.cpp
* <li> (Python) An example using the Lucas-Kanade optical flow algorithm can
* be found at opencv_source_code/samples/python2/lk_track.py
* <li> (Python) An example using the Lucas-Kanade tracker for homography
* matching can be found at opencv_source_code/samples/python2/lk_homography.py
* </ul>
*
* @param prevImg first 8-bit input image or pyramid constructed by
* "buildOpticalFlowPyramid".
* @param nextImg second input image or pyramid of the same size and the same
* type as <code>prevImg</code>.
* @param prevPts vector of 2D points for which the flow needs to be found;
* point coordinates must be single-precision floating-point numbers.
* @param nextPts output vector of 2D points (with single-precision
* floating-point coordinates) containing the calculated new positions of input
* features in the second image; when <code>OPTFLOW_USE_INITIAL_FLOW</code> flag
* is passed, the vector must have the same size as in the input.
* @param status output status vector (of unsigned chars); each element of the
* vector is set to 1 if the flow for the corresponding features has been found,
* otherwise, it is set to 0.
* @param err output vector of errors; each element of the vector is set to an
* error for the corresponding feature, type of the error measure can be set in
* <code>flags</code> parameter; if the flow wasn't found then the error is not
* defined (use the <code>status</code> parameter to find such cases).
*
* @see <a href="http://docs.opencv.org/modules/video/doc/motion_analysis_and_object_tracking.html#calcopticalflowpyrlk">org.opencv.video.Video.calcOpticalFlowPyrLK</a>
*/
public static void calcOpticalFlowPyrLK(Mat prevImg, Mat nextImg, MatOfPoint2f prevPts, MatOfPoint2f nextPts, MatOfByte status, MatOfFloat err)
{
Mat prevPts_mat = prevPts;
Mat nextPts_mat = nextPts;
Mat status_mat = status;
Mat err_mat = err;
calcOpticalFlowPyrLK_2(prevImg.nativeObj, nextImg.nativeObj, prevPts_mat.nativeObj, nextPts_mat.nativeObj, status_mat.nativeObj, err_mat.nativeObj);
return;
}
//
// C++: void calcOpticalFlowSF(Mat from, Mat to, Mat flow, int layers, int averaging_block_size, int max_flow)
//
/**
* <p>Calculate an optical flow using "SimpleFlow" algorithm.</p>
*
* <p>See [Tao2012]. And site of project - http://graphics.berkeley.edu/papers/Tao-SAN-2012-05/.</p>
*
* <p>Note:</p>
* <ul>
* <li> An example using the simpleFlow algorithm can be found at
* opencv_source_code/samples/cpp/simpleflow_demo.cpp
* </ul>
*
* @param from a from
* @param to a to
* @param flow a flow
* @param layers Number of layers
* @param averaging_block_size Size of block through which we sum up when
* calculate cost function for pixel
* @param max_flow maximal flow that we search at each level
*
* @see <a href="http://docs.opencv.org/modules/video/doc/motion_analysis_and_object_tracking.html#calcopticalflowsf">org.opencv.video.Video.calcOpticalFlowSF</a>
*/
public static void calcOpticalFlowSF(Mat from, Mat to, Mat flow, int layers, int averaging_block_size, int max_flow)
{
calcOpticalFlowSF_0(from.nativeObj, to.nativeObj, flow.nativeObj, layers, averaging_block_size, max_flow);
return;
}
//
// C++: void calcOpticalFlowSF(Mat from, Mat to, Mat flow, int layers, int averaging_block_size, int max_flow, double sigma_dist, double sigma_color, int postprocess_window, double sigma_dist_fix, double sigma_color_fix, double occ_thr, int upscale_averaging_radius, double upscale_sigma_dist, double upscale_sigma_color, double speed_up_thr)
//
/**
* <p>Calculate an optical flow using "SimpleFlow" algorithm.</p>
*
* <p>See [Tao2012]. And site of project - http://graphics.berkeley.edu/papers/Tao-SAN-2012-05/.</p>
*
* <p>Note:</p>
* <ul>
* <li> An example using the simpleFlow algorithm can be found at
* opencv_source_code/samples/cpp/simpleflow_demo.cpp
* </ul>
*
* @param from a from
* @param to a to
* @param flow a flow
* @param layers Number of layers
* @param averaging_block_size Size of block through which we sum up when
* calculate cost function for pixel
* @param max_flow maximal flow that we search at each level
* @param sigma_dist vector smooth spatial sigma parameter
* @param sigma_color vector smooth color sigma parameter
* @param postprocess_window window size for postprocess cross bilateral filter
* @param sigma_dist_fix spatial sigma for postprocess cross bilateralf filter
* @param sigma_color_fix color sigma for postprocess cross bilateral filter
* @param occ_thr threshold for detecting occlusions
* @param upscale_averaging_radius a upscale_averaging_radius
* @param upscale_sigma_dist spatial sigma for bilateral upscale operation
* @param upscale_sigma_color color sigma for bilateral upscale operation
* @param speed_up_thr threshold to detect point with irregular flow - where
* flow should be recalculated after upscale
*
* @see <a href="http://docs.opencv.org/modules/video/doc/motion_analysis_and_object_tracking.html#calcopticalflowsf">org.opencv.video.Video.calcOpticalFlowSF</a>
*/
public static void calcOpticalFlowSF(Mat from, Mat to, Mat flow, int layers, int averaging_block_size, int max_flow, double sigma_dist, double sigma_color, int postprocess_window, double sigma_dist_fix, double sigma_color_fix, double occ_thr, int upscale_averaging_radius, double upscale_sigma_dist, double upscale_sigma_color, double speed_up_thr)
{
calcOpticalFlowSF_1(from.nativeObj, to.nativeObj, flow.nativeObj, layers, averaging_block_size, max_flow, sigma_dist, sigma_color, postprocess_window, sigma_dist_fix, sigma_color_fix, occ_thr, upscale_averaging_radius, upscale_sigma_dist, upscale_sigma_color, speed_up_thr);
return;
}
//
// C++: Mat estimateRigidTransform(Mat src, Mat dst, bool fullAffine)
//
/**
* <p>Computes an optimal affine transformation between two 2D point sets.</p>
*
* <p>The function finds an optimal affine transform *[A|b]* (a <code>2 x 3</code>
* floating-point matrix) that approximates best the affine transformation
* between:</p>
* <ul>
* <li> Two point sets
* <li> Two raster images. In this case, the function first finds some
* features in the <code>src</code> image and finds the corresponding features
* in <code>dst</code> image. After that, the problem is reduced to the first
* case.
* </ul>
*
* <p>In case of point sets, the problem is formulated as follows: you need to find
* a 2x2 matrix *A* and 2x1 vector *b* so that:</p>
*
* <p><em>[A^*|b^*] = arg min _([A|b]) sum _i|dst[i] - A (src[i])^T - b| ^2</em></p>
*
* <p>where <code>src[i]</code> and <code>dst[i]</code> are the i-th points in
* <code>src</code> and <code>dst</code>, respectively</p>
*
* <p><em>[A|b]</em> can be either arbitrary (when <code>fullAffine=true</code>) or
* have a form of</p>
*
* <p><em>a_11 a_12 b_1
* -a_12 a_11 b_2 </em></p>
*
* <p>when <code>fullAffine=false</code>.</p>
*
* @param src First input 2D point set stored in <code>std.vector</code> or
* <code>Mat</code>, or an image stored in <code>Mat</code>.
* @param dst Second input 2D point set of the same size and the same type as
* <code>A</code>, or another image.
* @param fullAffine If true, the function finds an optimal affine
* transformation with no additional restrictions (6 degrees of freedom).
* Otherwise, the class of transformations to choose from is limited to
* combinations of translation, rotation, and uniform scaling (5 degrees of
* freedom).
*
* @see <a href="http://docs.opencv.org/modules/video/doc/motion_analysis_and_object_tracking.html#estimaterigidtransform">org.opencv.video.Video.estimateRigidTransform</a>
* @see org.opencv.calib3d.Calib3d#findHomography
* @see org.opencv.imgproc.Imgproc#getAffineTransform
* @see org.opencv.imgproc.Imgproc#getPerspectiveTransform
*/
public static Mat estimateRigidTransform(Mat src, Mat dst, boolean fullAffine)
{
Mat retVal = new Mat(estimateRigidTransform_0(src.nativeObj, dst.nativeObj, fullAffine));
return retVal;
}
//
// C++: int meanShift(Mat probImage, Rect& window, TermCriteria criteria)
//
/**
* <p>Finds an object on a back projection image.</p>
*
* <p>The function implements the iterative object search algorithm. It takes the
* input back projection of an object and the initial position. The mass center
* in <code>window</code> of the back projection image is computed and the
* search window center shifts to the mass center. The procedure is repeated
* until the specified number of iterations <code>criteria.maxCount</code> is
* done or until the window center shifts by less than <code>criteria.epsilon</code>.
* The algorithm is used inside "CamShift" and, unlike "CamShift", the search
* window size or orientation do not change during the search. You can simply
* pass the output of "calcBackProject" to this function. But better results can
* be obtained if you pre-filter the back projection and remove the noise. For
* example, you can do this by retrieving connected components with
* "findContours", throwing away contours with small area ("contourArea"), and
* rendering the remaining contours with "drawContours".</p>
*
* <p>Note:</p>
* <ul>
* <li> A mean-shift tracking sample can be found at opencv_source_code/samples/cpp/camshiftdemo.cpp
* </ul>
*
* @param probImage Back projection of the object histogram. See
* "calcBackProject" for details.
* @param window Initial search window.
* @param criteria Stop criteria for the iterative search algorithm.
*
* <p>:returns: Number of iterations CAMSHIFT took to converge.</p>
*
* @see <a href="http://docs.opencv.org/modules/video/doc/motion_analysis_and_object_tracking.html#meanshift">org.opencv.video.Video.meanShift</a>
*/
public static int meanShift(Mat probImage, Rect window, TermCriteria criteria)
{
double[] window_out = new double[4];
int retVal = meanShift_0(probImage.nativeObj, window.x, window.y, window.width, window.height, window_out, criteria.type, criteria.maxCount, criteria.epsilon);
if(window!=null){ window.x = (int)window_out[0]; window.y = (int)window_out[1]; window.width = (int)window_out[2]; window.height = (int)window_out[3]; }
return retVal;
}
//
// C++: void segmentMotion(Mat mhi, Mat& segmask, vector_Rect& boundingRects, double timestamp, double segThresh)
//
/**
* <p>Splits a motion history image into a few parts corresponding to separate
* independent motions (for example, left hand, right hand).</p>
*
* <p>The function finds all of the motion segments and marks them in
* <code>segmask</code> with individual values (1,2,...). It also computes a
* vector with ROIs of motion connected components. After that the motion
* direction for every component can be calculated with "calcGlobalOrientation"
* using the extracted mask of the particular component.</p>
*
* @param mhi Motion history image.
* @param segmask Image where the found mask should be stored, single-channel,
* 32-bit floating-point.
* @param boundingRects Vector containing ROIs of motion connected components.
* @param timestamp Current time in milliseconds or other units.
* @param segThresh Segmentation threshold that is recommended to be equal to
* the interval between motion history "steps" or greater.
*
* @see <a href="http://docs.opencv.org/modules/video/doc/motion_analysis_and_object_tracking.html#segmentmotion">org.opencv.video.Video.segmentMotion</a>
*/
public static void segmentMotion(Mat mhi, Mat segmask, MatOfRect boundingRects, double timestamp, double segThresh)
{
Mat boundingRects_mat = boundingRects;
segmentMotion_0(mhi.nativeObj, segmask.nativeObj, boundingRects_mat.nativeObj, timestamp, segThresh);
return;
}
//
// C++: void updateMotionHistory(Mat silhouette, Mat& mhi, double timestamp, double duration)
//
/**
* <p>Updates the motion history image by a moving silhouette.</p>
*
* <p>The function updates the motion history image as follows:</p>
*
* <p><em>mhi(x,y)= timestamp if silhouette(x,y) != 0; 0 if silhouette(x,y) = 0 and
* mhi <(timestamp - duration); mhi(x,y) otherwise</em></p>
*
* <p>That is, MHI pixels where the motion occurs are set to the current
* <code>timestamp</code>, while the pixels where the motion happened last time
* a long time ago are cleared.</p>
*
* <p>The function, together with "calcMotionGradient" and "calcGlobalOrientation",
* implements a motion templates technique described in [Davis97] and
* [Bradski00].
* See also the OpenCV sample <code>motempl.c</code> that demonstrates the use
* of all the motion template functions.</p>
*
* @param silhouette Silhouette mask that has non-zero pixels where the motion
* occurs.
* @param mhi Motion history image that is updated by the function
* (single-channel, 32-bit floating-point).
* @param timestamp Current time in milliseconds or other units.
* @param duration Maximal duration of the motion track in the same units as
* <code>timestamp</code>.
*
* @see <a href="http://docs.opencv.org/modules/video/doc/motion_analysis_and_object_tracking.html#updatemotionhistory">org.opencv.video.Video.updateMotionHistory</a>
*/
public static void updateMotionHistory(Mat silhouette, Mat mhi, double timestamp, double duration)
{
updateMotionHistory_0(silhouette.nativeObj, mhi.nativeObj, timestamp, duration);
return;
}
// C++: RotatedRect CamShift(Mat probImage, Rect& window, TermCriteria criteria)
private static native double[] CamShift_0(long probImage_nativeObj, int window_x, int window_y, int window_width, int window_height, double[] window_out, int criteria_type, int criteria_maxCount, double criteria_epsilon);
// C++: int buildOpticalFlowPyramid(Mat img, vector_Mat& pyramid, Size winSize, int maxLevel, bool withDerivatives = true, int pyrBorder = BORDER_REFLECT_101, int derivBorder = BORDER_CONSTANT, bool tryReuseInputImage = true)
private static native int buildOpticalFlowPyramid_0(long img_nativeObj, long pyramid_mat_nativeObj, double winSize_width, double winSize_height, int maxLevel, boolean withDerivatives, int pyrBorder, int derivBorder, boolean tryReuseInputImage);
private static native int buildOpticalFlowPyramid_1(long img_nativeObj, long pyramid_mat_nativeObj, double winSize_width, double winSize_height, int maxLevel);
// C++: double calcGlobalOrientation(Mat orientation, Mat mask, Mat mhi, double timestamp, double duration)
private static native double calcGlobalOrientation_0(long orientation_nativeObj, long mask_nativeObj, long mhi_nativeObj, double timestamp, double duration);
// C++: void calcMotionGradient(Mat mhi, Mat& mask, Mat& orientation, double delta1, double delta2, int apertureSize = 3)
private static native void calcMotionGradient_0(long mhi_nativeObj, long mask_nativeObj, long orientation_nativeObj, double delta1, double delta2, int apertureSize);
private static native void calcMotionGradient_1(long mhi_nativeObj, long mask_nativeObj, long orientation_nativeObj, double delta1, double delta2);
// C++: void calcOpticalFlowFarneback(Mat prev, Mat next, Mat& flow, double pyr_scale, int levels, int winsize, int iterations, int poly_n, double poly_sigma, int flags)
private static native void calcOpticalFlowFarneback_0(long prev_nativeObj, long next_nativeObj, long flow_nativeObj, double pyr_scale, int levels, int winsize, int iterations, int poly_n, double poly_sigma, int flags);
// C++: void calcOpticalFlowPyrLK(Mat prevImg, Mat nextImg, vector_Point2f prevPts, vector_Point2f& nextPts, vector_uchar& status, vector_float& err, Size winSize = Size(21,21), int maxLevel = 3, TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 0.01), int flags = 0, double minEigThreshold = 1e-4)
private static native void calcOpticalFlowPyrLK_0(long prevImg_nativeObj, long nextImg_nativeObj, long prevPts_mat_nativeObj, long nextPts_mat_nativeObj, long status_mat_nativeObj, long err_mat_nativeObj, double winSize_width, double winSize_height, int maxLevel, int criteria_type, int criteria_maxCount, double criteria_epsilon, int flags, double minEigThreshold);
private static native void calcOpticalFlowPyrLK_1(long prevImg_nativeObj, long nextImg_nativeObj, long prevPts_mat_nativeObj, long nextPts_mat_nativeObj, long status_mat_nativeObj, long err_mat_nativeObj, double winSize_width, double winSize_height, int maxLevel);
private static native void calcOpticalFlowPyrLK_2(long prevImg_nativeObj, long nextImg_nativeObj, long prevPts_mat_nativeObj, long nextPts_mat_nativeObj, long status_mat_nativeObj, long err_mat_nativeObj);
// C++: void calcOpticalFlowSF(Mat from, Mat to, Mat flow, int layers, int averaging_block_size, int max_flow)
private static native void calcOpticalFlowSF_0(long from_nativeObj, long to_nativeObj, long flow_nativeObj, int layers, int averaging_block_size, int max_flow);
// C++: void calcOpticalFlowSF(Mat from, Mat to, Mat flow, int layers, int averaging_block_size, int max_flow, double sigma_dist, double sigma_color, int postprocess_window, double sigma_dist_fix, double sigma_color_fix, double occ_thr, int upscale_averaging_radius, double upscale_sigma_dist, double upscale_sigma_color, double speed_up_thr)
private static native void calcOpticalFlowSF_1(long from_nativeObj, long to_nativeObj, long flow_nativeObj, int layers, int averaging_block_size, int max_flow, double sigma_dist, double sigma_color, int postprocess_window, double sigma_dist_fix, double sigma_color_fix, double occ_thr, int upscale_averaging_radius, double upscale_sigma_dist, double upscale_sigma_color, double speed_up_thr);
// C++: Mat estimateRigidTransform(Mat src, Mat dst, bool fullAffine)
private static native long estimateRigidTransform_0(long src_nativeObj, long dst_nativeObj, boolean fullAffine);
// C++: int meanShift(Mat probImage, Rect& window, TermCriteria criteria)
private static native int meanShift_0(long probImage_nativeObj, int window_x, int window_y, int window_width, int window_height, double[] window_out, int criteria_type, int criteria_maxCount, double criteria_epsilon);
// C++: void segmentMotion(Mat mhi, Mat& segmask, vector_Rect& boundingRects, double timestamp, double segThresh)
private static native void segmentMotion_0(long mhi_nativeObj, long segmask_nativeObj, long boundingRects_mat_nativeObj, double timestamp, double segThresh);
// C++: void updateMotionHistory(Mat silhouette, Mat& mhi, double timestamp, double duration)
private static native void updateMotionHistory_0(long silhouette_nativeObj, long mhi_nativeObj, double timestamp, double duration);
}
| {
"pile_set_name": "Github"
} |
{
"created_at": "2015-02-27T22:28:20.772861",
"description": "Cluster a node script from terminal or from another node script",
"fork": false,
"full_name": "co2-git/workers.js",
"language": "JavaScript",
"updated_at": "2015-02-27T23:42:32.112018"
} | {
"pile_set_name": "Github"
} |
using System;
namespace Duality.Editor
{
public enum AutosaveFrequency
{
Disabled,
TenMinutes,
ThirtyMinutes,
OneHour
}
}
| {
"pile_set_name": "Github"
} |
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.climatology.blocks;
import java.util.Locale;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.util.IStringSerializable;
public enum State implements IStringSerializable {
ON, OFF;
public static final PropertyEnum<State> PROPERTY = PropertyEnum.create("state", State.class);
public static State fromBool(boolean value) {
return value ? ON : OFF;
}
@Override
public String getName() {
return name().toLowerCase(Locale.ENGLISH);
}
}
| {
"pile_set_name": "Github"
} |
<template>
<!--新的朋友组件 交互没写完-->
<div :class="{'search-open-contact':!$store.state.headerStatus}">
<header id="wx-header">
<div class="other"><span>添加朋友</span></div>
<div class="center">
<router-link to="/contact" tag="div" class="iconfont icon-return-arrow">
<span>通讯录</span>
</router-link>
<span>新的朋友</span>
</div>
</header>
<!--这里的 search 组件的样式也需要修改一下-->
<search></search>
<div class="weui-cells margin-top-0">
<router-link to="/contact/new-friends/mobile-contacts" tag="div" class="weui-cell">
<dl class="add-tel-address">
<dt><span class="iconfont icon-iphone-address"></span></dt>
<dd>添加手机联系人</dd>
</dl>
</router-link>
</div>
<div class="weui-cells message-list">
<div class="weui-cell">
<div class="weui-cell__hd">
<img src="https://sinacloud.net/vue-wechat/images/headers/header02.png" alt=""> </div>
<div class="weui-cell__bd weui-cell_primary">
<p><b>路飞</b></p>
<p><span>来自手机通讯录</span></p>
</div>
<div class="weui-cell__ft">已添加</div>
</div>
<div class="weui-cell">
<div class="weui-cell__hd">
<img src="https://sinacloud.net/vue-wechat/images/headers/header02.png" alt=""></div>
<div class="weui-cell__bd weui-cell_primary">
<p><b>娜美</b></p>
<p><span>来自手机联系人</span></p>
</div>
<div class="weui-cell_ft">已拒绝</div>
</div>
<div class="weui-cell">
<div class="weui-cell__hd">
<img src="https://sinacloud.net/vue-wechat/images/headers/header02.png" alt=""></div>
<div class="weui-cell__bd weui-cell_primary">
<p><b>乌索普</b></p>
<p><span>来自账号查找</span></p>
</div>
<div class="weui-cell_ft"> <a href="javascript:;" class="weui-btn weui-btn_mini weui-btn_primary">接受</a> </div>
</div>
</div>
</div>
</template>
<script>
import search from "../common/search"
export default {
components: {
search
},
data() {
return {
pageName: "新的朋友"
}
}
}
</script>
<style lang="less">
@import "../../assets/less/new-friends.less";
</style> | {
"pile_set_name": "Github"
} |
<!DOCTYPE HTML>
<title>CSS Test Reference: breaking of column rule</title>
<meta charset="utf-8">
<link rel="author" title="L. David Baron" href="https://dbaron.org/">
<style>
.ref1, .ref2 {
display: inline-block;
vertical-align: top;
border: 2px solid blue;
border-top: none;
border-bottom: none;
}
.ref1 {
margin-left:49px;
height: 100px;
width: 148px;
}
.ref2 {
margin-left: 148px;
height: 50px;
width: 10px;
border-right: none;
}
</style>
<span class="ref1"></span><span class="ref2"></span>
| {
"pile_set_name": "Github"
} |
exports.version = '0.1';
exports.module = function(phantomas) {
'use strict';
phantomas.setMetric('scrollExecutionTree');
phantomas.on('report', function() {
phantomas.evaluate(function() {
(function(phantomas) {
var evt = document.createEvent('CustomEvent');
evt.initCustomEvent('scroll', false, false, null);
function triggerScrollEvent() {
phantomas.resetTree();
try {
// Chrome triggers them in this order:
// 1. document
phantomas.pushContext({
type: 'documentScroll'
});
document.dispatchEvent(evt);
// 2. window
phantomas.pushContext({
type: 'windowScroll'
});
window.dispatchEvent(evt);
// No need to call window.onscroll(), it's called by the scroll event on window
} catch(e) {
phantomas.log('ScrollListener error: %s', e);
}
}
var firstScrollTime = Date.now();
phantomas.log('ScrollListener: triggering a first scroll event...');
triggerScrollEvent();
// Ignore the first scroll event and only save the second one,
// because we want to detect un-throttled things, throttled ones are ok.
var secondScrollTime = Date.now();
phantomas.log('ScrollListener: triggering a second scroll event (%dms after the first)...', secondScrollTime - firstScrollTime);
triggerScrollEvent();
var fullTree = phantomas.readFullTree();
if (fullTree !== null) {
phantomas.setMetric('scrollExecutionTree', true, true);
phantomas.addOffender('scrollExecutionTree', JSON.stringify(fullTree));
phantomas.log('ScrollListener: scrollExecutionTree correctly extracted');
} else {
phantomas.log('Error: scrollExecutionTree could not be extracted');
}
phantomas.log('ScrollListener: end of scroll triggering');
})(window.__phantomas);
});
});
};
| {
"pile_set_name": "Github"
} |
<?php
namespace Ganlv\Down52PojieCn\FileSystem;
use Ganlv\Down52PojieCn\Helpers;
class GitHubCommitFileSystem extends AbstractFileSystem
{
protected $commitsUrl;
protected $rawFileUrl;
protected $cacheMaxAge;
public function __construct(array $options = [])
{
parent::__construct($options);
$this->commitsUrl = $options['COMMITS_URL'] ?? 'https://github.com/ganlvtech/down_52pojie_cn/commits/gh-pages/list.json';
$this->rawFileUrl = $options['RAW_FILE_URL'] ?? 'https://raw.githubusercontent.com/ganlvtech/down_52pojie_cn/gh-pages/list.json';
$this->cacheMaxAge = $options['CACHE_MAX_AGE'] ?? 7 * 24 * 60 * 60;
}
public function tree()
{
Helpers::log("Getting github commit history at: {$this->commitsUrl} .");
$html = Helpers::curl($this->commitsUrl);
if (1 === preg_match('/Commits on (\w+? \d+?, \d{4})/', $html, $matches)) {
$date = $matches[1];
$timestamp = strtotime($date);
Helpers::log("Most recently committed on: $date ($timestamp).");
if (time() - $timestamp < $this->cacheMaxAge) {
Helpers::log('File not expired.');
$downloadFileSystem = new DownloadFileSystem([
'FILE_URL' => $this->rawFileUrl,
]);
return $downloadFileSystem->tree();
} else {
Helpers::log('File expired.');
}
} else {
Helpers::log('No commits found.');
}
return null;
}
}
| {
"pile_set_name": "Github"
} |
module github.com/Mellanox/sriovnet
go 1.13
require (
github.com/google/uuid v1.1.1
github.com/spf13/afero v1.2.2
github.com/stretchr/testify v1.5.1
github.com/vishvananda/netlink v1.1.0
)
| {
"pile_set_name": "Github"
} |
// Copyright 2019, OpenCensus Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
package view
import (
"time"
"go.opencensus.io/metric/metricdata"
"go.opencensus.io/stats"
)
func getUnit(unit string) metricdata.Unit {
switch unit {
case "1":
return metricdata.UnitDimensionless
case "ms":
return metricdata.UnitMilliseconds
case "By":
return metricdata.UnitBytes
}
return metricdata.UnitDimensionless
}
func getType(v *View) metricdata.Type {
m := v.Measure
agg := v.Aggregation
switch agg.Type {
case AggTypeSum:
switch m.(type) {
case *stats.Int64Measure:
return metricdata.TypeCumulativeInt64
case *stats.Float64Measure:
return metricdata.TypeCumulativeFloat64
default:
panic("unexpected measure type")
}
case AggTypeDistribution:
return metricdata.TypeCumulativeDistribution
case AggTypeLastValue:
switch m.(type) {
case *stats.Int64Measure:
return metricdata.TypeGaugeInt64
case *stats.Float64Measure:
return metricdata.TypeGaugeFloat64
default:
panic("unexpected measure type")
}
case AggTypeCount:
switch m.(type) {
case *stats.Int64Measure:
return metricdata.TypeCumulativeInt64
case *stats.Float64Measure:
return metricdata.TypeCumulativeInt64
default:
panic("unexpected measure type")
}
default:
panic("unexpected aggregation type")
}
}
func getLabelKeys(v *View) []metricdata.LabelKey {
labelKeys := []metricdata.LabelKey{}
for _, k := range v.TagKeys {
labelKeys = append(labelKeys, metricdata.LabelKey{Key: k.Name()})
}
return labelKeys
}
func viewToMetricDescriptor(v *View) *metricdata.Descriptor {
return &metricdata.Descriptor{
Name: v.Name,
Description: v.Description,
Unit: getUnit(v.Measure.Unit()),
Type: getType(v),
LabelKeys: getLabelKeys(v),
}
}
func toLabelValues(row *Row, expectedKeys []metricdata.LabelKey) []metricdata.LabelValue {
labelValues := []metricdata.LabelValue{}
tagMap := make(map[string]string)
for _, tag := range row.Tags {
tagMap[tag.Key.Name()] = tag.Value
}
for _, key := range expectedKeys {
if val, ok := tagMap[key.Key]; ok {
labelValues = append(labelValues, metricdata.NewLabelValue(val))
} else {
labelValues = append(labelValues, metricdata.LabelValue{})
}
}
return labelValues
}
func rowToTimeseries(v *viewInternal, row *Row, now time.Time, startTime time.Time) *metricdata.TimeSeries {
return &metricdata.TimeSeries{
Points: []metricdata.Point{row.Data.toPoint(v.metricDescriptor.Type, now)},
LabelValues: toLabelValues(row, v.metricDescriptor.LabelKeys),
StartTime: startTime,
}
}
func viewToMetric(v *viewInternal, now time.Time, startTime time.Time) *metricdata.Metric {
if v.metricDescriptor.Type == metricdata.TypeGaugeInt64 ||
v.metricDescriptor.Type == metricdata.TypeGaugeFloat64 {
startTime = time.Time{}
}
rows := v.collectedRows()
if len(rows) == 0 {
return nil
}
ts := []*metricdata.TimeSeries{}
for _, row := range rows {
ts = append(ts, rowToTimeseries(v, row, now, startTime))
}
m := &metricdata.Metric{
Descriptor: *v.metricDescriptor,
TimeSeries: ts,
}
return m
}
| {
"pile_set_name": "Github"
} |
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package precis
import "errors"
// This file contains tables and code related to context rules.
type catBitmap uint16
const (
// These bits, once set depending on the current value, are never unset.
bJapanese catBitmap = 1 << iota
bArabicIndicDigit
bExtendedArabicIndicDigit
// These bits are set on each iteration depending on the current value.
bJoinStart
bJoinMid
bJoinEnd
bVirama
bLatinSmallL
bGreek
bHebrew
// These bits indicated which of the permanent bits need to be set at the
// end of the checks.
bMustHaveJapn
permanent = bJapanese | bArabicIndicDigit | bExtendedArabicIndicDigit | bMustHaveJapn
)
const finalShift = 10
var errContext = errors.New("precis: contextual rule violated")
func init() {
// Programmatically set these required bits as, manually setting them seems
// too error prone.
for i, ct := range categoryTransitions {
categoryTransitions[i].keep |= permanent
categoryTransitions[i].accept |= ct.term
}
}
var categoryTransitions = []struct {
keep catBitmap // mask selecting which bits to keep from the previous state
set catBitmap // mask for which bits to set for this transition
// These bitmaps are used for rules that require lookahead.
// term&accept == term must be true, which is enforced programmatically.
term catBitmap // bits accepted as termination condition
accept catBitmap // bits that pass, but not sufficient as termination
// The rule function cannot take a *context as an argument, as it would
// cause the context to escape, adding significant overhead.
rule func(beforeBits catBitmap) (doLookahead bool, err error)
}{
joiningL: {set: bJoinStart},
joiningD: {set: bJoinStart | bJoinEnd},
joiningT: {keep: bJoinStart, set: bJoinMid},
joiningR: {set: bJoinEnd},
viramaModifier: {set: bVirama},
viramaJoinT: {set: bVirama | bJoinMid},
latinSmallL: {set: bLatinSmallL},
greek: {set: bGreek},
greekJoinT: {set: bGreek | bJoinMid},
hebrew: {set: bHebrew},
hebrewJoinT: {set: bHebrew | bJoinMid},
japanese: {set: bJapanese},
katakanaMiddleDot: {set: bMustHaveJapn},
zeroWidthNonJoiner: {
term: bJoinEnd,
accept: bJoinMid,
rule: func(before catBitmap) (doLookAhead bool, err error) {
if before&bVirama != 0 {
return false, nil
}
if before&bJoinStart == 0 {
return false, errContext
}
return true, nil
},
},
zeroWidthJoiner: {
rule: func(before catBitmap) (doLookAhead bool, err error) {
if before&bVirama == 0 {
err = errContext
}
return false, err
},
},
middleDot: {
term: bLatinSmallL,
rule: func(before catBitmap) (doLookAhead bool, err error) {
if before&bLatinSmallL == 0 {
return false, errContext
}
return true, nil
},
},
greekLowerNumeralSign: {
set: bGreek,
term: bGreek,
rule: func(before catBitmap) (doLookAhead bool, err error) {
return true, nil
},
},
hebrewPreceding: {
set: bHebrew,
rule: func(before catBitmap) (doLookAhead bool, err error) {
if before&bHebrew == 0 {
err = errContext
}
return false, err
},
},
arabicIndicDigit: {
set: bArabicIndicDigit,
rule: func(before catBitmap) (doLookAhead bool, err error) {
if before&bExtendedArabicIndicDigit != 0 {
err = errContext
}
return false, err
},
},
extendedArabicIndicDigit: {
set: bExtendedArabicIndicDigit,
rule: func(before catBitmap) (doLookAhead bool, err error) {
if before&bArabicIndicDigit != 0 {
err = errContext
}
return false, err
},
},
}
| {
"pile_set_name": "Github"
} |
<template>
<d2-container>
<template slot="header">合并列</template>
<d2-crud
:columns="columns"
:data="data"
:options="options">
</d2-crud>
<el-card shadow="never" class="d2-mb">
<d2-markdown :source="doc"/>
</el-card>
<el-card shadow="never" class="d2-mb">
<d2-highlight :code="code"/>
</el-card>
<d2-link-btn
slot="footer"
title="文档"
link="https://d2.pub/zh/doc/d2-crud-v2"/>
</d2-container>
</template>
<script>
import '../install'
import doc from './doc.md'
import code from './code.js'
export default {
data () {
return {
doc,
code,
columns: [
{
title: 'ID',
key: 'id'
},
{
title: '姓名',
key: 'name'
},
{
title: '数值 1',
key: 'amount1'
},
{
title: '数值 2',
key: 'amount2'
},
{
title: '数值 3',
key: 'amount3'
}
],
data: [
{
id: '12987122',
name: '王小虎',
amount1: '234',
amount2: '3.2',
amount3: 10
},
{
id: '12987123',
name: '王小虎',
amount1: '165',
amount2: '4.43',
amount3: 12
},
{
id: '12987124',
name: '王小虎',
amount1: '324',
amount2: '1.9',
amount3: 9
},
{
id: '12987125',
name: '王小虎',
amount1: '621',
amount2: '2.2',
amount3: 17
},
{
id: '12987126',
name: '王小虎',
amount1: '539',
amount2: '4.1',
amount3: 15
}
],
options: {
border: true,
spanMethod ({ row, column, rowIndex, columnIndex }) {
if (columnIndex === 0) {
if (rowIndex % 2 === 0) {
return {
rowspan: 2,
colspan: 1
}
} else {
return {
rowspan: 0,
colspan: 0
}
}
}
}
}
}
}
}
</script>
| {
"pile_set_name": "Github"
} |
// Copyright (C) 2007 International Business Machines and others.
// All Rights Reserved.
// This code is published under the Eclipse Public License.
//
// Authors: Andreas Waechter IBM 2007-03-01
#ifndef __IP_STDAUGSYSTEMSOLVER_HPP__
#define __IP_STDAUGSYSTEMSOLVER_HPP__
#include "IpAugSystemSolver.hpp"
#include "IpGenKKTSolverInterface.hpp"
namespace Ipopt
{
/** Solver for the augmented system using GenKKTSolverInterfaces.
*
* This takes any Vector values out and provides Number*'s, but
* Matrices are provided as given from the NLP.
*/
class GenAugSystemSolver: public AugSystemSolver
{
public:
/**@name Constructors/Destructors */
//@{
/** Constructor using only a linear solver object */
GenAugSystemSolver(
GenKKTSolverInterface& SolverInterface
);
/** Destructor */
virtual ~GenAugSystemSolver();
//@}
/** overloaded from AlgorithmStrategyObject */
bool InitializeImpl(
const OptionsList& options,
const std::string& prefix
);
/** Set up the augmented system and solve it for a set of given
* right hand side - implementation for GenTMatrices and
* SymTMatrices.
*/
virtual ESymSolverStatus MultiSolve(
const SymMatrix* W,
double W_factor,
const Vector* D_x,
double delta_x,
const Vector* D_s,
double delta_s,
const Matrix* J_c,
const Vector* D_c,
double delta_c,
const Matrix* J_d,
const Vector* D_d,
double delta_d,
std::vector<SmartPtr<const Vector> >& rhs_xV,
std::vector<SmartPtr<const Vector> >& rhs_sV,
std::vector<SmartPtr<const Vector> >& rhs_cV,
std::vector<SmartPtr<const Vector> >& rhs_dV,
std::vector<SmartPtr<Vector> >& sol_xV,
std::vector<SmartPtr<Vector> >& sol_sV,
std::vector<SmartPtr<Vector> >& sol_cV,
std::vector<SmartPtr<Vector> >& sol_dV,
bool check_NegEVals,
Index numberOfNegEVals
);
/** Number of negative eigenvalues detected during last solve.
*
* This must not be called if the linear solver does
* not compute this quantities (see ProvidesInertia).
*
* @return the number of negative eigenvalues of the most recent factorized matrix.
*/
virtual Index NumberOfNegEVals() const;
/** Query whether inertia is computed by linear solver.
*
* @return true, if linear solver provides inertia
*/
virtual bool ProvidesInertia() const;
/** Request to increase quality of solution for next solve.
*
* Ask underlying linear solver to increase quality of solution for
* the next solve (e.g. increase pivot tolerance).
*
* @return false, if this is not possible (e.g. maximal pivot tolerance
* already used.)
*/
virtual bool IncreaseQuality();
private:
/**@name Default Compiler Generated Methods
* (Hidden to avoid implicit creation/calling).
*
* These methods are not implemented and
* we do not want the compiler to implement
* them for us, so we declare them private
* and do not define them. This ensures that
* they will not be implicitly created/called.
*/
//@{
/** Default constructor. */
GenAugSystemSolver();
/** Copy Constructor */
GenAugSystemSolver(
const GenAugSystemSolver&
);
/** Default Assignment Operator */
void operator=(
const GenAugSystemSolver&
);
//@}
/** Check the internal tags and decide if the passed variables are
* different from what is in the augmented_system_
*/
bool AugmentedSystemChanged(
const SymMatrix* W,
double W_factor,
const Vector* D_x,
double delta_x,
const Vector* D_s,
double delta_s,
const Matrix& J_c,
const Vector* D_c,
double delta_c,
const Matrix& J_d,
const Vector* D_d,
double delta_d
);
void UpdateTags(
const SymMatrix* W,
double W_factor,
const Vector* D_x,
double delta_x,
const Vector* D_s,
double delta_s,
const Matrix& J_c,
const Vector* D_c,
double delta_c,
const Matrix& J_d,
const Vector* D_d,
double delta_d
);
/** The linear solver object that is to be used to solve the
* linear systems.
*/
SmartPtr<GenKKTSolverInterface> solver_interface_;
/**@name Tags and values to track in order to decide whether the
* matrix has to be updated compared to the most recent call of
* the Set method.
*/
//@{
/** Tag for W matrix.
*
* If W has been given to Set as NULL, then this tag is set to 0
*/
TaggedObject::Tag w_tag_;
/** Most recent value of W_factor */
double w_factor_;
/** Tag for D_x vector, representing the diagonal matrix D_x.
*
* If D_x has been given to Set as NULL, then this tag is set to 0
*/
TaggedObject::Tag d_x_tag_;
/** Most recent value of delta_x from Set method */
double delta_x_;
/** Tag for D_s vector, representing the diagonal matrix D_s.
*
* If D_s has been given to Set as NULL, then this tag is set to 0
*/
TaggedObject::Tag d_s_tag_;
/** Most recent value of delta_s from Set method */
double delta_s_;
/** Tag for J_c matrix.
*
* If J_c has been given to Set as NULL, then this tag is set to 0
*/
TaggedObject::Tag j_c_tag_;
/** Tag for D_c vector, representing the diagonal matrix D_c.
*
* If D_c has been given to Set as NULL, then this tag is set to 0
*/
TaggedObject::Tag d_c_tag_;
/** Most recent value of delta_c from Set method */
double delta_c_;
/** Tag for J_d matrix.
*
* If J_d has been given to Set as NULL, then this tag is set to 0
*/
TaggedObject::Tag j_d_tag_;
/** Tag for D_d vector, representing the diagonal matrix D_d.
*
* If D_d has been given to Set as NULL, then this tag is set to 0
*/
TaggedObject::Tag d_d_tag_;
/** Most recent value of delta_d from Set method */
double delta_d_;
//@}
/** @name Space for storing the diagonal matrices.
*
* If the matrix hasn't changed, we can use it from the last call.
*/
//@{
Number* dx_vals_copy_;
Number* ds_vals_copy_;
Number* dc_vals_copy_;
Number* dd_vals_copy_;
//@}
/** @name Algorithmic parameters */
//@{
/** Flag indicating whether the TNLP with identical structure has
* already been solved before.
*/
bool warm_start_same_structure_;
//@}
};
} // namespace Ipopt
#endif
| {
"pile_set_name": "Github"
} |
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by pcafe.rc
//
#define IDI_ICON3 103
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 105
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
| {
"pile_set_name": "Github"
} |
# Dolibarr language file - Source file is en_US - agenda
IdAgenda=ID event
Actions=Cselekvések
Agenda=Napirend
TMenuAgenda=Napirend
Agendas=Napirendek
LocalAgenda=Belső naptár
ActionsOwnedBy=Esemény gazdája
ActionsOwnedByShort=Tulajdonos
AffectedTo=Hozzárendelve
Event=Cselekvés
Events=Események
EventsNb=Események száma
ListOfActions=Események listája
EventReports=Event reports
Location=Helyszín
ToUserOfGroup=Event assigned to any user in group
EventOnFullDay=Egész napos esemény
MenuToDoActions=Minden nem teljesített cselekvés
MenuDoneActions=Minden megszüntetett cselekvés
MenuToDoMyActions=Nem teljesített cselekvéseim
MenuDoneMyActions=Megszüntetett cselekvéseim
ListOfEvents=Események listája (belső naptár)
ActionsAskedBy=Cselekvéseket rögzítette
ActionsToDoBy=Események hozzárendelve
ActionsDoneBy=Végrehajtotta
ActionAssignedTo=Cselekvés hatással van rá
ViewCal=Naptár megtekintése
ViewDay=Nap nézet
ViewWeek=Hét nézet
ViewPerUser=Felhasználókénti nézet
ViewPerType=Per type view
AutoActions= Napirend automatikus kitöltése
AgendaAutoActionDesc= Here you may define events which you want Dolibarr to create automatically in Agenda. If nothing is checked, only manual actions will be included in logs and displayed in Agenda. Automatic tracking of business actions done on objects (validation, status change) will not be saved.
AgendaSetupOtherDesc= This page provides options to allow the export of your Dolibarr events into an external calendar (Thunderbird, Google Calendar etc...)
AgendaExtSitesDesc=Ez az oldal lehetővé teszi, hogy nyilvánítsa külső forrásokat naptárak látják eseményeket Dolibarr napirenden.
ActionsEvents=Events for which Dolibarr will create an action in agenda automatically
EventRemindersByEmailNotEnabled=Event reminders by email was not enabled into %s module setup.
##### Agenda event labels #####
NewCompanyToDolibarr=Third party %s created
COMPANY_DELETEInDolibarr=Third party %s deleted
ContractValidatedInDolibarr=%s szerződés jóváhagyva
CONTRACT_DELETEInDolibarr=Contract %s deleted
PropalClosedSignedInDolibarr=A %s javaslat alárva
PropalClosedRefusedInDolibarr=Proposal %s refused
PropalValidatedInDolibarr=%s ajánlat érvényesítve
PropalClassifiedBilledInDolibarr=Proposal %s classified billed
InvoiceValidatedInDolibarr=%s számla érvényesítve
InvoiceValidatedInDolibarrFromPos=Invoice %s validated from POS
InvoiceBackToDraftInDolibarr=Számla %s menj vissza a tervezett jogállását
InvoiceDeleteDolibarr=%s számla törölve
InvoicePaidInDolibarr=%s számla fizetettre változott
InvoiceCanceledInDolibarr=%s számla visszavonva
MemberValidatedInDolibarr=%s tag jóváhagyva
MemberModifiedInDolibarr=Member %s modified
MemberResiliatedInDolibarr=Member %s terminated
MemberDeletedInDolibarr=Member %s deleted
MemberSubscriptionAddedInDolibarr=Subscription %s for member %s added
MemberSubscriptionModifiedInDolibarr=Subscription %s for member %s modified
MemberSubscriptionDeletedInDolibarr=Subscription %s for member %s deleted
ShipmentValidatedInDolibarr=A %s szállítás jóváhagyva
ShipmentClassifyClosedInDolibarr=Shipment %s classified billed
ShipmentUnClassifyCloseddInDolibarr=Shipment %s classified re-open
ShipmentBackToDraftInDolibarr=Shipment %s go back to draft status
ShipmentDeletedInDolibarr=Shipment %s deleted
ReceptionValidatedInDolibarr=Reception %s validated
OrderCreatedInDolibarr=Order %s created
OrderValidatedInDolibarr=%s megrendelés érvényesítve
OrderDeliveredInDolibarr=Order %s classified delivered
OrderCanceledInDolibarr=Rendelés %s törölt
OrderBilledInDolibarr=Order %s classified billed
OrderApprovedInDolibarr=Rendelés %s jóváhagyott
OrderRefusedInDolibarr=A %s megrendelés elutasítva
OrderBackToDraftInDolibarr=Rendelés %s menj vissza vázlat
ProposalSentByEMail=Commercial proposal %s sent by email
ContractSentByEMail=Contract %s sent by email
OrderSentByEMail=Sales order %s sent by email
InvoiceSentByEMail=Customer invoice %s sent by email
SupplierOrderSentByEMail=Purchase order %s sent by email
ORDER_SUPPLIER_DELETEInDolibarr=Purchase order %s deleted
SupplierInvoiceSentByEMail=Vendor invoice %s sent by email
ShippingSentByEMail=Shipment %s sent by email
ShippingValidated= A %s szállítás jóváhagyva
InterventionSentByEMail=Intervention %s sent by email
ProposalDeleted=Proposal deleted
OrderDeleted=Order deleted
InvoiceDeleted=Invoice deleted
DraftInvoiceDeleted=Draft invoice deleted
CONTACT_CREATEInDolibarr=Contact %s created
CONTACT_DELETEInDolibarr=Contact %s deleted
PRODUCT_CREATEInDolibarr=Product %s created
PRODUCT_MODIFYInDolibarr=Product %s modified
PRODUCT_DELETEInDolibarr=Product %s deleted
HOLIDAY_CREATEInDolibarr=Request for leave %s created
HOLIDAY_MODIFYInDolibarr=Request for leave %s modified
HOLIDAY_APPROVEInDolibarr=Request for leave %s approved
HOLIDAY_VALIDATEInDolibarr=Request for leave %s validated
HOLIDAY_DELETEInDolibarr=Request for leave %s deleted
EXPENSE_REPORT_CREATEInDolibarr=Expense report %s created
EXPENSE_REPORT_VALIDATEInDolibarr=Expense report %s validated
EXPENSE_REPORT_APPROVEInDolibarr=Expense report %s approved
EXPENSE_REPORT_DELETEInDolibarr=Expense report %s deleted
EXPENSE_REPORT_REFUSEDInDolibarr=Expense report %s refused
PROJECT_CREATEInDolibarr=Project %s created
PROJECT_MODIFYInDolibarr=Project %s modified
PROJECT_DELETEInDolibarr=Project %s deleted
TICKET_CREATEInDolibarr=Ticket %s created
TICKET_MODIFYInDolibarr=Ticket %s modified
TICKET_ASSIGNEDInDolibarr=Ticket %s assigned
TICKET_CLOSEInDolibarr=Ticket %s closed
TICKET_DELETEInDolibarr=Ticket %s deleted
BOM_VALIDATEInDolibarr=BOM validated
BOM_UNVALIDATEInDolibarr=BOM unvalidated
BOM_CLOSEInDolibarr=BOM disabled
BOM_REOPENInDolibarr=BOM reopen
BOM_DELETEInDolibarr=BOM deleted
MRP_MO_VALIDATEInDolibarr=MO validated
MRP_MO_UNVALIDATEInDolibarr=MO set to draft status
MRP_MO_PRODUCEDInDolibarr=MO produced
MRP_MO_DELETEInDolibarr=MO deleted
MRP_MO_CANCELInDolibarr=MO canceled
##### End agenda events #####
AgendaModelModule=Document templates for event
DateActionStart=Indulási dátum
DateActionEnd=Befejezési dátum
AgendaUrlOptions1=Az alábbi paramétereket hozzá lehet adni a kimenet szűréséhez:
AgendaUrlOptions3=<b>logina=%s</b> to restrict output to actions owned by a user <b>%s</b>.
AgendaUrlOptionsNotAdmin=<b>logina=!%s</b> to restrict output to actions not owned by user <b>%s</b>.
AgendaUrlOptions4=<b>logint=%s</b> to restrict output to actions assigned to user <b>%s</b> (owner and others).
AgendaUrlOptionsProject=<b>project=__PROJECT_ID__</b> to restrict output to actions linked to project <b>__PROJECT_ID__</b>.
AgendaUrlOptionsNotAutoEvent=<b>notactiontype=systemauto</b> to exclude automatic events.
AgendaUrlOptionsIncludeHolidays=<b>includeholidays=1</b> to include events of holidays.
AgendaShowBirthdayEvents=Mutassa a születésnapokat a névjegyzékben
AgendaHideBirthdayEvents=Rejtse el a születésnapokat a névjegyzékben
Busy=Elfoglalt
ExportDataset_event1=List of agenda events
DefaultWorkingDays=A hét munkanapjai alapértelmezés szerint (pl. 1-5, 1-6)
DefaultWorkingHours=A napi munkaidő alapértelmezése (pl. 9-18)
# External Sites ical
ExportCal=Export naptár
ExtSites=Külső naptárak importálása
ExtSitesEnableThisTool=Show external calendars (defined in global setup) in Agenda. Does not affect external calendars defined by users.
ExtSitesNbOfAgenda=Naptárak száma
AgendaExtNb=Calendar no. %s
ExtSiteUrlAgenda=Az iCal fájl URL elérése
ExtSiteNoLabel=Nincs leírás
VisibleTimeRange=Visible time range
VisibleDaysRange=Visible days range
AddEvent=Esemény létrehozása
MyAvailability=Elérhetőségem
ActionType=Event type
DateActionBegin=Start event date
ConfirmCloneEvent=Are you sure you want to clone the event <b>%s</b>?
RepeatEvent=Repeat event
EveryWeek=Every week
EveryMonth=Every month
DayOfMonth=Day of month
DayOfWeek=Day of week
DateStartPlusOne=Date start + 1 hour
SetAllEventsToTodo=Set all events to todo
SetAllEventsToInProgress=Set all events to in progress
SetAllEventsToFinished=Set all events to finished
ReminderTime=Reminder period before the event
TimeType=Duration type
ReminderType=Callback type
AddReminder=Create an automatic reminder notification for this event
ErrorReminderActionCommCreation=Error creating the reminder notification for this event
BrowserPush=Browser Notification
| {
"pile_set_name": "Github"
} |
package promptui
import (
"fmt"
"strconv"
"strings"
"text/template"
)
const esc = "\033["
type attribute int
// The possible state of text inside the application, either Bold, faint, italic or underline.
//
// These constants are called through the use of the Styler function.
const (
reset attribute = iota
FGBold
FGFaint
FGItalic
FGUnderline
)
// The possible colors of text inside the application.
//
// These constants are called through the use of the Styler function.
const (
FGBlack attribute = iota + 30
FGRed
FGGreen
FGYellow
FGBlue
FGMagenta
FGCyan
FGWhite
)
// The possible background colors of text inside the application.
//
// These constants are called through the use of the Styler function.
const (
BGBlack attribute = iota + 40
BGRed
BGGreen
BGYellow
BGBlue
BGMagenta
BGCyan
BGWhite
)
// ResetCode is the character code used to reset the terminal formatting
var ResetCode = fmt.Sprintf("%s%dm", esc, reset)
const (
hideCursor = esc + "?25l"
showCursor = esc + "?25h"
clearLine = esc + "2K"
)
// FuncMap defines template helpers for the output. It can be extended as a regular map.
//
// The functions inside the map link the state, color and background colors strings detected in templates to a Styler
// function that applies the given style using the corresponding constant.
var FuncMap = template.FuncMap{
"black": Styler(FGBlack),
"red": Styler(FGRed),
"green": Styler(FGGreen),
"yellow": Styler(FGYellow),
"blue": Styler(FGBlue),
"magenta": Styler(FGMagenta),
"cyan": Styler(FGCyan),
"white": Styler(FGWhite),
"bgBlack": Styler(BGBlack),
"bgRed": Styler(BGRed),
"bgGreen": Styler(BGGreen),
"bgYellow": Styler(BGYellow),
"bgBlue": Styler(BGBlue),
"bgMagenta": Styler(BGMagenta),
"bgCyan": Styler(BGCyan),
"bgWhite": Styler(BGWhite),
"bold": Styler(FGBold),
"faint": Styler(FGFaint),
"italic": Styler(FGItalic),
"underline": Styler(FGUnderline),
}
func upLine(n uint) string {
return movementCode(n, 'A')
}
func movementCode(n uint, code rune) string {
return esc + strconv.FormatUint(uint64(n), 10) + string(code)
}
// Styler is a function that accepts multiple possible styling transforms from the state,
// color and background colors constants and transforms them into a templated string
// to apply those styles in the CLI.
//
// The returned styling function accepts a string that will be extended with
// the wrapping function's styling attributes.
func Styler(attrs ...attribute) func(interface{}) string {
attrstrs := make([]string, len(attrs))
for i, v := range attrs {
attrstrs[i] = strconv.Itoa(int(v))
}
seq := strings.Join(attrstrs, ";")
return func(v interface{}) string {
end := ""
s, ok := v.(string)
if !ok || !strings.HasSuffix(s, ResetCode) {
end = ResetCode
}
return fmt.Sprintf("%s%sm%v%s", esc, seq, v, end)
}
}
| {
"pile_set_name": "Github"
} |
server:
port: 9003
spring:
application:
name: template-zuul
zipkin:
base-url: http://localhost:9411
boot:
admin:
client:
url: http://localhost:9004
eureka:
client:
service-url:
# Eureka注册中心连接地址
# 如果注册中心地址配置的域名,这里使用 http://域名/eureka/ 格式
defaultZone: http://localhost:8080/eureka/
zuul:
routes:
# 路由名称,随意
template-admin:
# 路由地址
path: /api/admin/**
# 该路由地址对应的服务名称
serviceId: template-admin
template-auth:
path: /api/auth/**
serviceId: template-auth
| {
"pile_set_name": "Github"
} |
/***********************************************************************
*
* Copyright (c) 2012-2020 Barbara Geller
* Copyright (c) 2012-2020 Ansel Sermersheim
*
* Copyright (c) 2015 The Qt Company Ltd.
* Copyright (c) 2012-2016 Digia Plc and/or its subsidiary(-ies).
* Copyright (c) 2008-2012 Nokia Corporation and/or its subsidiary(-ies).
*
* This file is part of CopperSpice.
*
* CopperSpice is free software. You can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* CopperSpice is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* https://www.gnu.org/licenses/
*
***********************************************************************/
#include <qdeclarativevmemetaobject_p.h>
#include <qdeclarative.h>
#include <qdeclarativerefcount_p.h>
#include <qdeclarativeexpression.h>
#include <qdeclarativeexpression_p.h>
#include <qdeclarativecontext_p.h>
#include <qdeclarativebinding_p.h>
Q_DECLARE_METATYPE(QScriptValue);
QT_BEGIN_NAMESPACE
class QDeclarativeVMEVariant
{
public:
inline QDeclarativeVMEVariant();
inline ~QDeclarativeVMEVariant();
inline const void *dataPtr() const;
inline void *dataPtr();
inline int dataType() const;
inline QObject *asQObject();
inline const QVariant &asQVariant();
inline int asInt();
inline bool asBool();
inline double asDouble();
inline const QString &asQString();
inline const QUrl &asQUrl();
inline const QColor &asQColor();
inline const QTime &asQTime();
inline const QDate &asQDate();
inline const QDateTime &asQDateTime();
inline const QScriptValue &asQScriptValue();
inline void setValue(QObject *);
inline void setValue(const QVariant &);
inline void setValue(int);
inline void setValue(bool);
inline void setValue(double);
inline void setValue(const QString &);
inline void setValue(const QUrl &);
inline void setValue(const QColor &);
inline void setValue(const QTime &);
inline void setValue(const QDate &);
inline void setValue(const QDateTime &);
inline void setValue(const QScriptValue &);
private:
int type;
void *data[4]; // Large enough to hold all types
inline void cleanup();
};
QDeclarativeVMEVariant::QDeclarativeVMEVariant()
: type(QVariant::Invalid)
{
}
QDeclarativeVMEVariant::~QDeclarativeVMEVariant()
{
cleanup();
}
void QDeclarativeVMEVariant::cleanup()
{
if (type == QVariant::Invalid) {
} else if (type == QMetaType::Int ||
type == QMetaType::Bool ||
type == QMetaType::Double) {
type = QVariant::Invalid;
} else if (type == QMetaType::QObjectStar) {
((QDeclarativeGuard<QObject> *)dataPtr())->~QDeclarativeGuard<QObject>();
type = QVariant::Invalid;
} else if (type == QMetaType::QString) {
((QString *)dataPtr())->~QString();
type = QVariant::Invalid;
} else if (type == QMetaType::QUrl) {
((QUrl *)dataPtr())->~QUrl();
type = QVariant::Invalid;
} else if (type == QMetaType::QColor) {
((QColor *)dataPtr())->~QColor();
type = QVariant::Invalid;
} else if (type == QMetaType::QTime) {
((QTime *)dataPtr())->~QTime();
type = QVariant::Invalid;
} else if (type == QMetaType::QDate) {
((QDate *)dataPtr())->~QDate();
type = QVariant::Invalid;
} else if (type == QMetaType::QDateTime) {
((QDateTime *)dataPtr())->~QDateTime();
type = QVariant::Invalid;
} else if (type == qMetaTypeId<QVariant>()) {
((QVariant *)dataPtr())->~QVariant();
type = QVariant::Invalid;
} else if (type == qMetaTypeId<QScriptValue>()) {
((QScriptValue *)dataPtr())->~QScriptValue();
type = QVariant::Invalid;
}
}
int QDeclarativeVMEVariant::dataType() const
{
return type;
}
const void *QDeclarativeVMEVariant::dataPtr() const
{
return &data;
}
void *QDeclarativeVMEVariant::dataPtr()
{
return &data;
}
QObject *QDeclarativeVMEVariant::asQObject()
{
if (type != QMetaType::QObjectStar) {
setValue((QObject *)0);
}
return *(QDeclarativeGuard<QObject> *)(dataPtr());
}
const QVariant &QDeclarativeVMEVariant::asQVariant()
{
if (type != QMetaType::QVariant) {
setValue(QVariant());
}
return *(QVariant *)(dataPtr());
}
int QDeclarativeVMEVariant::asInt()
{
if (type != QMetaType::Int) {
setValue(int(0));
}
return *(int *)(dataPtr());
}
bool QDeclarativeVMEVariant::asBool()
{
if (type != QMetaType::Bool) {
setValue(bool(false));
}
return *(bool *)(dataPtr());
}
double QDeclarativeVMEVariant::asDouble()
{
if (type != QMetaType::Double) {
setValue(double(0));
}
return *(double *)(dataPtr());
}
const QString &QDeclarativeVMEVariant::asQString()
{
if (type != QMetaType::QString) {
setValue(QString());
}
return *(QString *)(dataPtr());
}
const QUrl &QDeclarativeVMEVariant::asQUrl()
{
if (type != QMetaType::QUrl) {
setValue(QUrl());
}
return *(QUrl *)(dataPtr());
}
const QColor &QDeclarativeVMEVariant::asQColor()
{
if (type != QMetaType::QColor) {
setValue(QColor());
}
return *(QColor *)(dataPtr());
}
const QTime &QDeclarativeVMEVariant::asQTime()
{
if (type != QMetaType::QTime) {
setValue(QTime());
}
return *(QTime *)(dataPtr());
}
const QDate &QDeclarativeVMEVariant::asQDate()
{
if (type != QMetaType::QDate) {
setValue(QDate());
}
return *(QDate *)(dataPtr());
}
const QDateTime &QDeclarativeVMEVariant::asQDateTime()
{
if (type != QMetaType::QDateTime) {
setValue(QDateTime());
}
return *(QDateTime *)(dataPtr());
}
const QScriptValue &QDeclarativeVMEVariant::asQScriptValue()
{
if (type != qMetaTypeId<QScriptValue>()) {
setValue(QScriptValue());
}
return *(QScriptValue *)(dataPtr());
}
void QDeclarativeVMEVariant::setValue(QObject *v)
{
if (type != QMetaType::QObjectStar) {
cleanup();
type = QMetaType::QObjectStar;
new (dataPtr()) QDeclarativeGuard<QObject>();
}
*(QDeclarativeGuard<QObject> *)(dataPtr()) = v;
}
void QDeclarativeVMEVariant::setValue(const QVariant &v)
{
if (type != qMetaTypeId<QVariant>()) {
cleanup();
type = qMetaTypeId<QVariant>();
new (dataPtr()) QVariant(v);
} else {
*(QVariant *)(dataPtr()) = v;
}
}
void QDeclarativeVMEVariant::setValue(int v)
{
if (type != QMetaType::Int) {
cleanup();
type = QMetaType::Int;
}
*(int *)(dataPtr()) = v;
}
void QDeclarativeVMEVariant::setValue(bool v)
{
if (type != QMetaType::Bool) {
cleanup();
type = QMetaType::Bool;
}
*(bool *)(dataPtr()) = v;
}
void QDeclarativeVMEVariant::setValue(double v)
{
if (type != QMetaType::Double) {
cleanup();
type = QMetaType::Double;
}
*(double *)(dataPtr()) = v;
}
void QDeclarativeVMEVariant::setValue(const QString &v)
{
if (type != QMetaType::QString) {
cleanup();
type = QMetaType::QString;
new (dataPtr()) QString(v);
} else {
*(QString *)(dataPtr()) = v;
}
}
void QDeclarativeVMEVariant::setValue(const QUrl &v)
{
if (type != QMetaType::QUrl) {
cleanup();
type = QMetaType::QUrl;
new (dataPtr()) QUrl(v);
} else {
*(QUrl *)(dataPtr()) = v;
}
}
void QDeclarativeVMEVariant::setValue(const QColor &v)
{
if (type != QMetaType::QColor) {
cleanup();
type = QMetaType::QColor;
new (dataPtr()) QColor(v);
} else {
*(QColor *)(dataPtr()) = v;
}
}
void QDeclarativeVMEVariant::setValue(const QTime &v)
{
if (type != QMetaType::QTime) {
cleanup();
type = QMetaType::QTime;
new (dataPtr()) QTime(v);
} else {
*(QTime *)(dataPtr()) = v;
}
}
void QDeclarativeVMEVariant::setValue(const QDate &v)
{
if (type != QMetaType::QDate) {
cleanup();
type = QMetaType::QDate;
new (dataPtr()) QDate(v);
} else {
*(QDate *)(dataPtr()) = v;
}
}
void QDeclarativeVMEVariant::setValue(const QDateTime &v)
{
if (type != QMetaType::QDateTime) {
cleanup();
type = QMetaType::QDateTime;
new (dataPtr()) QDateTime(v);
} else {
*(QDateTime *)(dataPtr()) = v;
}
}
void QDeclarativeVMEVariant::setValue(const QScriptValue &v)
{
if (type != qMetaTypeId<QScriptValue>()) {
cleanup();
type = qMetaTypeId<QScriptValue>();
new (dataPtr()) QScriptValue(v);
} else {
*(QScriptValue *)(dataPtr()) = v;
}
}
QDeclarativeVMEMetaObject::QDeclarativeVMEMetaObject(QObject *obj,
const QMetaObject *other,
const QDeclarativeVMEMetaData *meta,
QDeclarativeCompiledData *cdata)
: object(obj), compiledData(cdata), ctxt(QDeclarativeData::get(obj, true)->outerContext),
metaData(meta), data(0), methods(0), parent(0)
{
compiledData->addref();
*static_cast<QMetaObject *>(this) = *other;
this->d.superdata = obj->metaObject();
QObjectPrivate *op = QObjectPrivate::get(obj);
if (op->metaObject) {
parent = static_cast<QAbstractDynamicMetaObject *>(op->metaObject);
}
op->metaObject = this;
propOffset = QAbstractDynamicMetaObject::propertyOffset();
methodOffset = QAbstractDynamicMetaObject::methodOffset();
data = new QDeclarativeVMEVariant[metaData->propertyCount];
aConnected.resize(metaData->aliasCount);
int list_type = qMetaTypeId<QDeclarativeListProperty<QObject> >();
// ### Optimize
for (int ii = 0; ii < metaData->propertyCount; ++ii) {
int t = (metaData->propertyData() + ii)->propertyType;
if (t == list_type) {
listProperties.append(List(methodOffset + ii));
data[ii].setValue(listProperties.count() - 1);
}
}
}
QDeclarativeVMEMetaObject::~QDeclarativeVMEMetaObject()
{
compiledData->release();
delete parent;
delete [] data;
delete [] methods;
}
int QDeclarativeVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a)
{
int id = _id;
if (c == QMetaObject::WriteProperty) {
int flags = *reinterpret_cast<int *>(a[3]);
if (!(flags & QDeclarativePropertyPrivate::BypassInterceptor)
&& !aInterceptors.isEmpty()
&& aInterceptors.testBit(id)) {
QPair<int, QDeclarativePropertyValueInterceptor *> pair = interceptors.value(id);
int valueIndex = pair.first;
QDeclarativePropertyValueInterceptor *vi = pair.second;
int type = property(id).userType();
if (type != QVariant::Invalid) {
if (valueIndex != -1) {
QDeclarativeEnginePrivate *ep = ctxt ? QDeclarativeEnginePrivate::get(ctxt->engine) : 0;
QDeclarativeValueType *valueType = 0;
if (ep) {
valueType = ep->valueTypes[type];
} else {
valueType = QDeclarativeValueTypeFactory::valueType(type);
}
Q_ASSERT(valueType);
valueType->setValue(QVariant(type, a[0]));
QMetaProperty valueProp = valueType->metaObject()->property(valueIndex);
vi->write(valueProp.read(valueType));
if (!ep) {
delete valueType;
}
return -1;
} else {
vi->write(QVariant(type, a[0]));
return -1;
}
}
}
}
if (c == QMetaObject::ReadProperty || c == QMetaObject::WriteProperty) {
if (id >= propOffset) {
id -= propOffset;
if (id < metaData->propertyCount) {
int t = (metaData->propertyData() + id)->propertyType;
bool needActivate = false;
if (t == -1) {
if (c == QMetaObject::ReadProperty) {
*reinterpret_cast<QVariant *>(a[0]) = readVarPropertyAsVariant(id);
} else if (c == QMetaObject::WriteProperty) {
writeVarProperty(id, *reinterpret_cast<QVariant *>(a[0]));
}
} else {
if (c == QMetaObject::ReadProperty) {
switch (t) {
case QVariant::Int:
*reinterpret_cast<int *>(a[0]) = data[id].asInt();
break;
case QVariant::Bool:
*reinterpret_cast<bool *>(a[0]) = data[id].asBool();
break;
case QVariant::Double:
*reinterpret_cast<double *>(a[0]) = data[id].asDouble();
break;
case QVariant::String:
*reinterpret_cast<QString *>(a[0]) = data[id].asQString();
break;
case QVariant::Url:
*reinterpret_cast<QUrl *>(a[0]) = data[id].asQUrl();
break;
case QVariant::Color:
*reinterpret_cast<QColor *>(a[0]) = data[id].asQColor();
break;
case QVariant::Date:
*reinterpret_cast<QDate *>(a[0]) = data[id].asQDate();
break;
case QVariant::DateTime:
*reinterpret_cast<QDateTime *>(a[0]) = data[id].asQDateTime();
break;
case QMetaType::QObjectStar:
*reinterpret_cast<QObject **>(a[0]) = data[id].asQObject();
break;
default:
break;
}
if (t == qMetaTypeId<QDeclarativeListProperty<QObject> >()) {
int listIndex = data[id].asInt();
const List *list = &listProperties.at(listIndex);
*reinterpret_cast<QDeclarativeListProperty<QObject> *>(a[0]) =
QDeclarativeListProperty<QObject>(object, (void *)list,
list_append, list_count, list_at,
list_clear);
}
} else if (c == QMetaObject::WriteProperty) {
switch (t) {
case QVariant::Int:
needActivate = *reinterpret_cast<int *>(a[0]) != data[id].asInt();
data[id].setValue(*reinterpret_cast<int *>(a[0]));
break;
case QVariant::Bool:
needActivate = *reinterpret_cast<bool *>(a[0]) != data[id].asBool();
data[id].setValue(*reinterpret_cast<bool *>(a[0]));
break;
case QVariant::Double:
needActivate = *reinterpret_cast<double *>(a[0]) != data[id].asDouble();
data[id].setValue(*reinterpret_cast<double *>(a[0]));
break;
case QVariant::String:
needActivate = *reinterpret_cast<QString *>(a[0]) != data[id].asQString();
data[id].setValue(*reinterpret_cast<QString *>(a[0]));
break;
case QVariant::Url:
needActivate = *reinterpret_cast<QUrl *>(a[0]) != data[id].asQUrl();
data[id].setValue(*reinterpret_cast<QUrl *>(a[0]));
break;
case QVariant::Color:
needActivate = *reinterpret_cast<QColor *>(a[0]) != data[id].asQColor();
data[id].setValue(*reinterpret_cast<QColor *>(a[0]));
break;
case QVariant::Date:
needActivate = *reinterpret_cast<QDate *>(a[0]) != data[id].asQDate();
data[id].setValue(*reinterpret_cast<QDate *>(a[0]));
break;
case QVariant::DateTime:
needActivate = *reinterpret_cast<QDateTime *>(a[0]) != data[id].asQDateTime();
data[id].setValue(*reinterpret_cast<QDateTime *>(a[0]));
break;
case QMetaType::QObjectStar:
needActivate = *reinterpret_cast<QObject **>(a[0]) != data[id].asQObject();
data[id].setValue(*reinterpret_cast<QObject **>(a[0]));
break;
default:
break;
}
}
}
if (c == QMetaObject::WriteProperty && needActivate) {
activate(object, methodOffset + id, 0);
}
return -1;
}
id -= metaData->propertyCount;
if (id < metaData->aliasCount) {
QDeclarativeVMEMetaData::AliasData *d = metaData->aliasData() + id;
if (d->flags & QML_ALIAS_FLAG_PTR && c == QMetaObject::ReadProperty) {
*reinterpret_cast<void **>(a[0]) = 0;
}
if (!ctxt) {
return -1;
}
QDeclarativeContext *context = ctxt->asQDeclarativeContext();
QDeclarativeContextPrivate *ctxtPriv = QDeclarativeContextPrivate::get(context);
QObject *target = ctxtPriv->data->idValues[d->contextIdx].data();
if (!target) {
return -1;
}
connectAlias(id);
if (d->isObjectAlias()) {
*reinterpret_cast<QObject **>(a[0]) = target;
return -1;
}
// Remove binding (if any) on write
if (c == QMetaObject::WriteProperty) {
int flags = *reinterpret_cast<int *>(a[3]);
if (flags & QDeclarativePropertyPrivate::RemoveBindingOnAliasWrite) {
QDeclarativeData *targetData = QDeclarativeData::get(target);
if (targetData && targetData->hasBindingBit(d->propertyIndex())) {
QDeclarativeAbstractBinding *binding = QDeclarativePropertyPrivate::setBinding(target, d->propertyIndex(),
d->isValueTypeAlias() ? d->valueTypeIndex() : -1, 0);
if (binding) {
binding->destroy();
}
}
}
}
if (d->isValueTypeAlias()) {
// Value type property
QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(ctxt->engine);
QDeclarativeValueType *valueType = ep->valueTypes[d->valueType()];
Q_ASSERT(valueType);
valueType->read(target, d->propertyIndex());
int rv = QMetaObject::metacall(valueType, c, d->valueTypeIndex(), a);
if (c == QMetaObject::WriteProperty) {
valueType->write(target, d->propertyIndex(), 0x00);
}
return rv;
} else {
return QMetaObject::metacall(target, c, d->propertyIndex(), a);
}
}
return -1;
}
} else if (c == QMetaObject::InvokeMetaMethod) {
if (id >= methodOffset) {
id -= methodOffset;
int plainSignals = metaData->signalCount + metaData->propertyCount +
metaData->aliasCount;
if (id < plainSignals) {
QMetaObject::activate(object, _id, a);
return -1;
}
id -= plainSignals;
if (id < metaData->methodCount) {
if (!ctxt->engine) {
return -1; // We can't run the method
}
QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(ctxt->engine);
QScriptValue function = method(id);
QScriptValueList args;
QDeclarativeVMEMetaData::MethodData *data = metaData->methodData() + id;
if (data->parameterCount) {
for (int ii = 0; ii < data->parameterCount; ++ii) {
args << ep->scriptValueFromVariant(*(QVariant *)a[ii + 1]);
}
}
QScriptValue rv = function.call(ep->objectClass->newQObject(object), args);
if (a[0]) {
*reinterpret_cast<QVariant *>(a[0]) = ep->scriptValueToVariant(rv);
}
return -1;
}
return -1;
}
}
if (parent) {
return parent->metaCall(c, _id, a);
} else {
return object->qt_metacall(c, _id, a);
}
}
QScriptValue QDeclarativeVMEMetaObject::method(int index)
{
if (!methods) {
methods = new QScriptValue[metaData->methodCount];
}
if (!methods[index].isValid()) {
QDeclarativeVMEMetaData::MethodData *data = metaData->methodData() + index;
const QChar *body =
(const QChar *)(((const char *)metaData) + data->bodyOffset);
QString code = QString::fromRawData(body, data->bodyLength);
// XXX Use QScriptProgram
// XXX We should evaluate all methods in a single big script block to
// improve the call time between dynamic methods defined on the same
// object
methods[index] = QDeclarativeExpressionPrivate::evalInObjectScope(ctxt, object, code, ctxt->url.toString(),
data->lineNumber, 0);
}
return methods[index];
}
QScriptValue QDeclarativeVMEMetaObject::readVarProperty(int id)
{
if (data[id].dataType() == qMetaTypeId<QScriptValue>()) {
return data[id].asQScriptValue();
} else if (data[id].dataType() == QMetaType::QObjectStar) {
return QDeclarativeEnginePrivate::get(ctxt->engine)->objectClass->newQObject(data[id].asQObject());
} else {
return QDeclarativeEnginePrivate::get(ctxt->engine)->scriptValueFromVariant(data[id].asQVariant());
}
}
QVariant QDeclarativeVMEMetaObject::readVarPropertyAsVariant(int id)
{
if (data[id].dataType() == qMetaTypeId<QScriptValue>()) {
return QDeclarativeEnginePrivate::get(ctxt->engine)->scriptValueToVariant(data[id].asQScriptValue());
} else if (data[id].dataType() == QMetaType::QObjectStar) {
return QVariant::fromValue(data[id].asQObject());
} else {
return data[id].asQVariant();
}
}
void QDeclarativeVMEMetaObject::writeVarProperty(int id, const QScriptValue &value)
{
data[id].setValue(value);
activate(object, methodOffset + id, 0);
}
void QDeclarativeVMEMetaObject::writeVarProperty(int id, const QVariant &value)
{
bool needActivate = false;
if (value.userType() == QMetaType::QObjectStar) {
QObject *o = qvariant_cast<QObject *>(value);
needActivate = (data[id].dataType() != QMetaType::QObjectStar || data[id].asQObject() != o);
data[id].setValue(qvariant_cast<QObject *>(value));
} else {
needActivate = (data[id].dataType() != qMetaTypeId<QVariant>() ||
data[id].asQVariant().userType() != value.userType() ||
data[id].asQVariant() != value);
data[id].setValue(value);
}
if (needActivate) {
activate(object, methodOffset + id, 0);
}
}
void QDeclarativeVMEMetaObject::listChanged(int id)
{
activate(object, methodOffset + id, 0);
}
void QDeclarativeVMEMetaObject::list_append(QDeclarativeListProperty<QObject> *prop, QObject *o)
{
List *list = static_cast<List *>(prop->data);
list->append(o);
QMetaObject::activate(prop->object, list->notifyIndex, 0);
}
int QDeclarativeVMEMetaObject::list_count(QDeclarativeListProperty<QObject> *prop)
{
return static_cast<List *>(prop->data)->count();
}
QObject *QDeclarativeVMEMetaObject::list_at(QDeclarativeListProperty<QObject> *prop, int index)
{
return static_cast<List *>(prop->data)->at(index);
}
void QDeclarativeVMEMetaObject::list_clear(QDeclarativeListProperty<QObject> *prop)
{
List *list = static_cast<List *>(prop->data);
list->clear();
QMetaObject::activate(prop->object, list->notifyIndex, 0);
}
void QDeclarativeVMEMetaObject::registerInterceptor(int index, int valueIndex,
QDeclarativePropertyValueInterceptor *interceptor)
{
if (aInterceptors.isEmpty()) {
aInterceptors.resize(propertyCount() + metaData->propertyCount);
}
aInterceptors.setBit(index);
interceptors.insert(index, qMakePair(valueIndex, interceptor));
}
int QDeclarativeVMEMetaObject::vmeMethodLineNumber(int index)
{
if (index < methodOffset) {
Q_ASSERT(parent);
return static_cast<QDeclarativeVMEMetaObject *>(parent)->vmeMethodLineNumber(index);
}
int plainSignals = metaData->signalCount + metaData->propertyCount + metaData->aliasCount;
Q_ASSERT(index >= (methodOffset + plainSignals) && index < (methodOffset + plainSignals + metaData->methodCount));
int rawIndex = index - methodOffset - plainSignals;
QDeclarativeVMEMetaData::MethodData *data = metaData->methodData() + rawIndex;
return data->lineNumber;
}
QScriptValue QDeclarativeVMEMetaObject::vmeMethod(int index)
{
if (index < methodOffset) {
Q_ASSERT(parent);
return static_cast<QDeclarativeVMEMetaObject *>(parent)->vmeMethod(index);
}
int plainSignals = metaData->signalCount + metaData->propertyCount + metaData->aliasCount;
Q_ASSERT(index >= (methodOffset + plainSignals) && index < (methodOffset + plainSignals + metaData->methodCount));
return method(index - methodOffset - plainSignals);
}
void QDeclarativeVMEMetaObject::setVmeMethod(int index, const QScriptValue &value)
{
if (index < methodOffset) {
Q_ASSERT(parent);
return static_cast<QDeclarativeVMEMetaObject *>(parent)->setVmeMethod(index, value);
}
int plainSignals = metaData->signalCount + metaData->propertyCount + metaData->aliasCount;
Q_ASSERT(index >= (methodOffset + plainSignals) && index < (methodOffset + plainSignals + metaData->methodCount));
if (!methods) {
methods = new QScriptValue[metaData->methodCount];
}
methods[index - methodOffset - plainSignals] = value;
}
QScriptValue QDeclarativeVMEMetaObject::vmeProperty(int index)
{
if (index < propOffset) {
Q_ASSERT(parent);
return static_cast<QDeclarativeVMEMetaObject *>(parent)->vmeProperty(index);
}
return readVarProperty(index - propOffset);
}
void QDeclarativeVMEMetaObject::setVMEProperty(int index, const QScriptValue &v)
{
if (index < propOffset) {
Q_ASSERT(parent);
static_cast<QDeclarativeVMEMetaObject *>(parent)->setVMEProperty(index, v);
}
return writeVarProperty(index - propOffset, v);
}
bool QDeclarativeVMEMetaObject::aliasTarget(int index, QObject **target, int *coreIndex, int *valueTypeIndex) const
{
Q_ASSERT(index >= propOffset + metaData->propertyCount);
*target = 0;
*coreIndex = -1;
*valueTypeIndex = -1;
if (!ctxt) {
return false;
}
QDeclarativeVMEMetaData::AliasData *d = metaData->aliasData() + (index - propOffset - metaData->propertyCount);
QDeclarativeContext *context = ctxt->asQDeclarativeContext();
QDeclarativeContextPrivate *ctxtPriv = QDeclarativeContextPrivate::get(context);
*target = ctxtPriv->data->idValues[d->contextIdx].data();
if (!*target) {
return false;
}
if (d->isObjectAlias()) {
} else if (d->isValueTypeAlias()) {
*coreIndex = d->propertyIndex();
*valueTypeIndex = d->valueTypeIndex();
} else {
*coreIndex = d->propertyIndex();
}
return true;
}
void QDeclarativeVMEMetaObject::connectAlias(int aliasId)
{
if (!aConnected.testBit(aliasId)) {
aConnected.setBit(aliasId);
QDeclarativeContext *context = ctxt->asQDeclarativeContext();
QDeclarativeContextPrivate *ctxtPriv = QDeclarativeContextPrivate::get(context);
QDeclarativeVMEMetaData::AliasData *d = metaData->aliasData() + aliasId;
QObject *target = ctxtPriv->data->idValues[d->contextIdx].data();
if (!target) {
return;
}
int sigIdx = methodOffset + aliasId + metaData->propertyCount;
QMetaObject::connect(context, d->contextIdx + ctxtPriv->notifyIndex, object, sigIdx);
if (!d->isObjectAlias()) {
QMetaProperty prop = target->metaObject()->property(d->propertyIndex());
if (prop.hasNotifySignal()) {
QDeclarativePropertyPrivate::connect(target, prop.notifySignalIndex(), object, sigIdx);
}
}
}
}
void QDeclarativeVMEMetaObject::connectAliasSignal(int index)
{
int aliasId = (index - methodOffset) - metaData->propertyCount;
if (aliasId < 0 || aliasId >= metaData->aliasCount) {
return;
}
connectAlias(aliasId);
}
QT_END_NAMESPACE
| {
"pile_set_name": "Github"
} |
/**
* Copyright (C) 2018-2020
* All rights reserved, Designed By www.yixiang.co
* 注意:
* 本软件为www.yixiang.co开发研制
*/
package co.yixiang.modules.shop.service;
import co.yixiang.common.service.BaseService;
import co.yixiang.modules.shop.domain.YxStoreProductReply;
import co.yixiang.modules.shop.service.dto.YxStoreProductReplyDto;
import co.yixiang.modules.shop.service.dto.YxStoreProductReplyQueryCriteria;
import org.springframework.data.domain.Pageable;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
* @author hupeng
* @date 2020-05-12
*/
public interface YxStoreProductReplyService extends BaseService<YxStoreProductReply>{
/**
* 查询数据分页
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(YxStoreProductReplyQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<YxStoreProductReplyDto>
*/
List<YxStoreProductReply> queryAll(YxStoreProductReplyQueryCriteria criteria);
/**
* 导出数据
* @param all 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<YxStoreProductReplyDto> all, HttpServletResponse response) throws IOException;
}
| {
"pile_set_name": "Github"
} |
'use strict'
import { ADD_COUNTER, REMOVE_COUNTER, INCREMENT, DECREMENT } from './actions'
export const addCounter = () => ({ type: ADD_COUNTER })
export const removeCounter = (index) => ({ type: REMOVE_COUNTER, index })
export const increment = (index) => ({ type: INCREMENT, index })
export const decrement = (index) => ({ type: DECREMENT, index })
| {
"pile_set_name": "Github"
} |
# Awesome Draft.js [](https://github.com/sindresorhus/awesome)
[Draft.js](https://draftjs.org/) is a framework for building rich text editors in React.
**Table of Contents**
- [Community](https://github.com/nikgraf/awesome-draft-js#community)
- [Presentations](https://github.com/nikgraf/awesome-draft-js#presentations)
- [Projects on Top of Draft.js](https://github.com/nikgraf/awesome-draft-js#standalone-editors-built-on-draftjs)
- [Common Utilities](https://github.com/nikgraf/awesome-draft-js#common-utilities)
- [Blog Posts & Articles](https://github.com/nikgraf/awesome-draft-js#blog-posts--articles)
- [Live Demos](https://github.com/nikgraf/awesome-draft-js#live-demos)
- [Usage in Production](https://github.com/nikgraf/awesome-draft-js#usage-in-production)
- [License](https://github.com/nikgraf/awesome-draft-js#license)
## Community
* [Slack channel](https://draftjs.herokuapp.com/)
## Presentations
* [Rich Text Editing with React @ React.js Conf 2016 by Isaac Salier-Hellendag ](https://www.youtube.com/watch?v=feUYwoLhE_4)
* [Rich text editing with Draft.js & DraftJS Plugins by Nik Graf](https://www.youtube.com/watch?v=gxNuHZXZMgs)
* [React Ep. 37: Draftjs by What I Learned Today – Atomic Jolt](https://www.youtube.com/watch?v=0k9suXgCtTA)
* [008 - Draft.js Plugins @ React30](https://www.youtube.com/watch?v=w-PqnpMizcQ)
* [Draft.js at HubSpot by Ben Briggs](https://product.hubspot.com/blog/tech-talk-at-night-react-meetup)
* [Draft.js under the hood - React Melbourne meetup](https://www.youtube.com/watch?feature=player_embedded&v=vOZAO3jFSHI)
## Standalone Editors Built on Draft.js
* [Draft WYSIWYG](https://github.com/bkniffler/draft-wysiwyg) - WYSIWYG editor that with drag&drop, resizing & tooltips.
* [Draft.js Editor](https://github.com/AlastairTaft/draft-js-editor/) - A Rich text editor inspired by Medium & Facebook Notes.
* [React-RTE](https://github.com/sstur/react-rte/) - A full-featured textarea replacement similar to CKEditor or TinyMCE.
* [Facebook Notes Clone(ish)](https://github.com/andrewcoelho/react-text-editor) - Rich text editor similar to Facebook notes.
* [Megadraft](https://github.com/globocom/megadraft) - A rich text editor with a nice default base of plugins and extensibility.
* [Medium Draft](https://github.com/brijeshb42/medium-draft) - Medium-like rich text editor with a focus on keyboard shortcuts.
* [React-Draft-Wyiswyg](https://github.com/jpuri/react-draft-wysiwyg) - A WYISWYG editor, with various text editing options and corresponding HTML generation.
* [Dante 2](https://github.com/michelson/dante2) - Just another Medium clone built on top of DraftJs.
* [Last Draft](https://github.com/vacenz/last-draft) - A Draft editor built with Draft.js plugins.
* [Z-Editor](https://github.com/Z-Editor/Z-Editor) - Online Z-notations editor.
* [Draftail](https://github.com/springload/draftail/) - A configurable rich text editor based on Draft.js, built for Wagtail.
* [Braft](https://github.com/margox/braft-editor) - Extensible Draft JS Editor
## Plugins and Decorators Built for Draft.js
* [Draft.js Plugins](https://github.com/draft-js-plugins/draft-js-plugins) - A Plugin architecture on top of Draft.js
- [Alignment](https://www.draft-js-plugins.com/plugin/alignment)
- [Block Breakout](https://github.com/icelab/draft-js-block-breakout-plugin) - Break out of block types as you type.
- [Buttons](https://github.com/vacenz/last-draft-js-plugins)
- [Color Picker](https://github.com/vacenz/last-draft-js-plugins)
- [Counter](https://www.draft-js-plugins.com/plugin/counter) - Character, word & line counting.
- [Divider](https://github.com/simsim0709/draft-js-plugins/tree/master/draft-js-divider-plugin)
- [Drag and Drop](https://www.draft-js-plugins.com/plugin/drag-n-drop)
- [Embed](https://github.com/vacenz/last-draft-js-plugins)
- [Emoji](https://www.draft-js-plugins.com/plugin/emoji) - Slack-like emoji support
- [EmojiPicker](https://github.com/vacenz/last-draft-js-plugins)
- [Focus](https://www.draft-js-plugins.com/plugin/focus)
- [GifPicker](https://github.com/vacenz/last-draft-js-plugins)
- [Hashtags](https://www.draft-js-plugins.com/plugin/hashtag) - Twitter-like hashtag support
- [Image](https://www.draft-js-plugins.com/plugin/image)
- [Inline Toolbar](https://www.draft-js-plugins.com/plugin/inline-toolbar)
- [Katex](https://github.com/letranloc/draft-js-katex-plugin) - Insert and render LaTeX using Katex.
- [Link](https://github.com/vacenz/last-draft-js-plugins)
- [Linkify](https://www.draft-js-plugins.com/plugin/linkify) - Automatically turn links into anchor-tags.
- [List](https://github.com/samuelmeuli/draft-js-list-plugin) - Automatic list creation, nested lists
- [Markdown Shortcuts](https://github.com/ngs/draft-js-markdown-shortcuts-plugin/) - Markdown syntax shortcuts.
- [Mathjax](https://github.com/efloti/draft-js-mathjax-plugin) - Edit math using (La)TeX rendered by Mathjax.
- [Mention](https://www.draft-js-plugins.com/plugin/mention) - Twitter-like mention support
- [Modal](https://github.com/vacenz/last-draft-js-plugins)
- [Prism](https://github.com/withspectrum/draft-js-prism-plugin) - Syntax highlight code blocks with Prism.
- [Resizeable](https://www.draft-js-plugins.com/plugin/resizeable)
- [RichButtons](https://github.com/jasonphillips/draft-js-richbuttons-plugin) - Add and customize rich formatting buttons.
- [Side Toolbar](https://www.draft-js-plugins.com/plugin/side-toolbar)
- [Sidebar](https://github.com/vacenz/last-draft-js-plugins)
- [Single Line](https://github.com/icelab/draft-js-single-line-plugin) - Restrict to a single line of input.
- [Sticker](https://www.draft-js-plugins.com/plugin/sticker) - Facebook-like sticker support
- [Toolbar](https://github.com/vacenz/last-draft-js-plugins)
- [Undo](https://www.draft-js-plugins.com/plugin/undo) - Undo & Redo button.
- [Video](https://www.draft-js-plugins.com/plugin/video)
* [Draft.js Gutter](https://github.com/seejamescode/draft-js-gutter) - Compliments line number gutter.
* [Draft.js Basic HTML Editor](https://github.com/dburrows/draft-js-basic-html-editor) - Accept html as its input format, and return html to an onChange.
* [Draft.js Prism](https://github.com/SamyPesse/draft-js-prism)- Highlight code blocks using Prism.
* [Draft.js Typeahead](https://github.com/dooly-ai/draft-js-typeahead) - Support for typeahead functionality.
* [Draft Extend](https://github.com/HubSpot/draft-extend) - Build extensible Draft.js editors with configurable plugins and integrated serialization.
* [Draft.js Code](https://github.com/SamyPesse/draft-js-code) - A collection of low-level utilities for nicer code editing
* [Draft.js Annotatable](https://github.com/cltk/annotations) - Out of the box annotation system for Draft.js with support for user-created annotations.
* [Draft.js Regex](https://github.com/YozhikM/draft-regex) - The set of flexible helpers, like regex, blank lines preventing and pasted HTML clearing.
## Common Utilities
* [BackDraft.js](https://github.com/evanc/backdraft-js) - Function to turn a rawContentBlock into a marked-up string.
* [Draft.js Exporter](https://github.com/rkpasia/draft-js-exporter) - Export and format the content from Draft.js.
* [Draft.js: Export ContentState to HTML](https://github.com/sstur/draft-js-utils/tree/master/packages/draft-js-export-html) - Export ContentState to HTML.
* [Draft.js: Export ContentState to PDFMake](https://github.com/datagenno/draft-js-export-pdfmake) - Export ContentState to PDFMake.
* [Redraft](https://github.com/lokiuz/redraft) - Renders the result of Draft.js convertToRaw using provided callbacks, works well with React
* [Draft.js exporter (Ruby)](https://github.com/ignitionworks/draftjs_exporter) - Export Draft.js content state into HTML.
* [Draft.js exporter (Python)](https://github.com/springload/draftjs_exporter) - Library to convert Draft.js raw ContentState to HTML
* [Draft.js AST Exporter](https://github.com/icelab/draft-js-ast-exporter) - Export content into an abstract syntax tree (AST).
* [Draft.js AST Importer](https://github.com/icelab/draft-js-ast-importer)- Import an abstract syntax tree (AST) output from the companion draft-js-ast-exporter.
* [Draft.js Multidecorators](https://github.com/SamyPesse/draft-js-multidecorators) - Combine multiple decorators.
* [Draft.js SimpleDecorator](https://github.com/Soreine/draft-js-simpledecorator) - Easily create flexible decorators.
* [DraftJS Utils](https://github.com/jpuri/draftjs-utils) - Set of utility functions for DraftJS.
* [DraftJs to HTML](https://github.com/jpuri/draftjs-to-html) - Library for generating HTML for DraftJS editor content.
* [Draft Convert](https://github.com/HubSpot/draft-convert) - Extensibly serialize & deserialize Draft.js ContentState with HTML.
* [HTML to DraftJS](https://github.com/jpuri/html-to-draftjs) - Convert plain HTML to DraftJS Editor content.
* [Draft.js Exporter (Go)](https://github.com/ejilay/draftjs) - Export Draft.js content state into HTML.
* [React Native Draft.js Render](https://github.com/globocom/react-native-draftjs-render) - A React Native render for Draft.js model.
* [Draft.js filters](https://github.com/thibaudcolas/draftjs-filters) - Filter Draft.js content to preserve only the formatting you allow.
* [Sticky](https://github.com/nadunindunil/sticky) - A simple note taking and clipboard managing desktop application
## Blog Posts & Articles
* [Facebook open sources rich text editor framework Draft.js](https://code.facebook.com/posts/1684092755205505/facebook-open-sources-rich-text-editor-framework-draft-js/)
* [This Blog Post Was Written Using Draft.js](https://dev.to/ben/this-blog-post-was-written-using-draftjs)
* [How Draft.js Represents Rich Text Data](https://medium.com/@rajaraodv/how-draft-js-represents-rich-text-data-eeabb5f25cf2#.7gd8psdvi)
* [A Beginner’s Guide to Draft.js](https://medium.com/@adrianli/a-beginner-s-guide-to-draft-js-d1823f58d8cc#.uufeulpl5)
* [Implementing todo list in Draft.js](http://bitwiser.in/2016/08/31/implementing-todo-list-in-draft-js.html)
* [Draft.js Pieces](https://cannibalcoder.com/2016/12/02/draft-js-pieces/)
* [Learning Draft.js](https://reactrocket.com/series/learning-draft-js/) - Series of blog posts on how to develop with draft.js
* [Why Wagtail’s new editor is built with Draft.js](https://wagtail.io/blog/why-wagtail-new-editor-is-built-with-draft-js/)
* [Rethinking rich text pipelines with Draft.js](https://wagtail.io/blog/rethinking-rich-text-pipelines-with-draft-js/)
## Live Demos
* [Draft-js Samples - An app with examples and code explanations](https://github.com/Mair/react-meetup-draftjs)
* [Draftail Playground](https://draftail-playground.herokuapp.com/) – Wagtail’s Draft.js dependencies as a standalone demo.
* [Draft drag and drop demo for mobile browser](https://github.com/jan4984/draft-dnd-example)
## Playgrounds for Examples from Official Repository (v.0.10.0)
* [Rich Text Editor](https://codepen.io/Kiwka/pen/YNYvyG)
* [Color Editor](https://codepen.io/Kiwka/pen/oBpVve)
* [Convert from HTML Editor](https://codepen.io/Kiwka/pen/YNYgWa)
* [Entity Editor](https://codepen.io/Kiwka/pen/wgpOoZ)
* [Link Editor](https://codepen.io/Kiwka/pen/ZLvPeO)
* [Media Editor](https://codepen.io/Kiwka/pen/rjpRzj)
* [Plain Text Editor](https://codepen.io/Kiwka/pen/jyYJzb)
* [Decorators Editor - Tweet example](https://codepen.io/Kiwka/pen/KaZERV)
## Usage in Production
* [StoryChief](https://www.storychief.io/)
* [HKW Technosphere Magazine](https://technosphere-magazine.hkw.de/)
* [Douban Read](https://read.douban.com/editor_ng)
* [Dooly](https://www.dooly.ai)
* [Wagtail](https://wagtail.io/)
* [Patreon](https://www.patreon.com/)
## License
[](https://creativecommons.org/publicdomain/zero/1.0/)
To the extent possible under law, [Nikolaus Graf](https://github.com/nikgraf/) has waived all copyright and related or neighboring rights to this work.
| {
"pile_set_name": "Github"
} |
#define ISOLATION_AWARE_ENABLED
#include <windows.h>
#include "gui/win32res.h"
ICON_BOCHS ICON build/win32/nsis/bochs.ico
ICON_BOCHS2 ICON build/win32/nsis/logo.ico
// Manifest for both 32-bit and 64-bit Windows
1 24 build/win32/bochs.manifest
ASK_DLG DIALOG 30, 30, 200, 100
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Event"
FONT 8, "Helv"
BEGIN
LTEXT "Device", IDASKTX1, 10, 12, 40, 14
EDITTEXT IDASKDEV, 45, 10, 145, 14, ES_READONLY
LTEXT "Message", IDASKTX2, 10, 27, 40, 14
EDITTEXT IDASKMSG, 45, 25, 145, 14, ES_READONLY | ES_AUTOHSCROLL
LISTBOX IDASKLIST, 10, 50, 120, 45, WS_VSCROLL | WS_TABSTOP
DEFPUSHBUTTON "OK", IDOK, 140, 50, 50, 14
PUSHBUTTON "Cancel", IDCANCEL, 140, 70, 50, 14
END
STRING_DLG DIALOG 30, 30, 130, 65
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Param"
FONT 8, "Helv"
BEGIN
EDITTEXT IDSTRING, 15, 15, 100, 14
DEFPUSHBUTTON "OK", IDOK, 10, 40, 50, 14
PUSHBUTTON "Cancel", IDCANCEL, 70, 40, 50, 14
END
MAINMENU_DLG DIALOG 30, 30, 275, 130
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Bochs Start Menu"
FONT 8, "Helv"
BEGIN
GROUPBOX "Configuration", IDCONFIG, 10, 10, 70, 97
PUSHBUTTON "L&oad", IDREADRC, 20, 25, 50, 14
PUSHBUTTON "&Save", IDWRITERC, 20, 45, 50, 14
PUSHBUTTON "&Edit", IDEDITCFG, 20, 65, 50, 14
PUSHBUTTON "Rese&t", IDRESETCFG, 20, 85, 50, 14
GROUPBOX "Edit Options", IDEDITGRP, 90, 10, 95, 107
LISTBOX IDEDITBOX, 95, 20, 85, 100, WS_VSCROLL | WS_TABSTOP
GROUPBOX "Simulation", IDSIMU, 195, 10, 70, 77
DEFPUSHBUTTON "Sta&rt", IDOK, 205, 25, 50, 14
PUSHBUTTON "Restore St&ate", IDRESTORE, 205, 45, 50, 14
PUSHBUTTON "&Quit", IDQUIT, 205, 65, 50, 14
END
LOGOPT_DLG DIALOG 30, 30, 240, 180
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Log Options"
FONT 8, "Helv"
BEGIN
LISTBOX IDDEVLIST, 15, 25, 55, 100, LBS_SORT | WS_VSCROLL | WS_TABSTOP
LTEXT "Debug events", IDLOGLBL1, 80, 27, 55, 14
COMBOBOX IDLOGEVT1, 155, 25, 65, 56, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL |
WS_VSCROLL | WS_TABSTOP
LTEXT "Info events", IDLOGLBL2, 80, 47, 55, 14
COMBOBOX IDLOGEVT2, 155, 45, 65, 56, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL |
WS_VSCROLL | WS_TABSTOP
LTEXT "Error events", IDLOGLBL3, 80, 67, 55, 14
COMBOBOX IDLOGEVT3, 155, 65, 65, 56, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL |
WS_VSCROLL | WS_TABSTOP
LTEXT "Panic events", IDLOGLBL4, 80, 87, 55, 14
COMBOBOX IDLOGEVT4, 155, 85, 65, 56, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL |
WS_VSCROLL | WS_TABSTOP
AUTOCHECKBOX "Specify log options per device", IDADVLOGOPT, 50, 135, 112, 14, BS_LEFTTEXT | WS_TABSTOP
DEFPUSHBUTTON "OK", IDOK, 35, 155, 50, 14
PUSHBUTTON "Cancel", IDCANCEL, 95, 155, 50, 14
PUSHBUTTON "Apply", IDAPPLY, 155, 155, 50, 14
END
PLUGIN_CTRL_DLG DIALOG 100, 120, 180, 135
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Optional Plugin Control"
FONT 8, "Helv"
BEGIN
LISTBOX IDPLUGLIST, 15, 15, 85, 100, WS_VSCROLL | WS_TABSTOP
EDITTEXT IDEDIT, 110, 15, 60, 14
PUSHBUTTON "Load", IDLOAD, 110, 35, 50, 14
PUSHBUTTON "Unload", IDUNLOAD, 110, 55, 50, 14
DEFPUSHBUTTON "OK", IDOK, 65, 115, 50, 14
END
PARAM_DLG DIALOG 30, 30, 200, 65
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Param"
FONT 8, "Helv"
BEGIN
DEFPUSHBUTTON "OK", IDOK, 45, 40, 50, 14
PUSHBUTTON "Cancel", IDCANCEL, 105, 40, 50, 14
END
#include "bxversion.rc"
#include "win32_enh_dbg.rc"
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2010 Mans Rullgard <[email protected]>
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVCODEC_ARM_AAC_H
#define AVCODEC_ARM_AAC_H
#include "config.h"
#if HAVE_NEON_INLINE
#define VMUL2 VMUL2
static inline float *VMUL2(float *dst, const float *v, unsigned idx,
const float *scale)
{
unsigned v0, v1;
__asm__ ("ubfx %0, %6, #0, #4 \n\t"
"ubfx %1, %6, #4, #4 \n\t"
"ldr %0, [%5, %0, lsl #2] \n\t"
"ldr %1, [%5, %1, lsl #2] \n\t"
"vld1.32 {d1[]}, [%7,:32] \n\t"
"vmov d0, %0, %1 \n\t"
"vmul.f32 d0, d0, d1 \n\t"
"vst1.32 {d0}, [%2,:64]! \n\t"
: "=&r"(v0), "=&r"(v1), "+r"(dst), "=m"(dst[0]), "=m"(dst[1])
: "r"(v), "r"(idx), "r"(scale)
: "d0", "d1");
return dst;
}
#define VMUL4 VMUL4
static inline float *VMUL4(float *dst, const float *v, unsigned idx,
const float *scale)
{
unsigned v0, v1, v2, v3;
__asm__ ("ubfx %0, %10, #0, #2 \n\t"
"ubfx %1, %10, #2, #2 \n\t"
"ldr %0, [%9, %0, lsl #2] \n\t"
"ubfx %2, %10, #4, #2 \n\t"
"ldr %1, [%9, %1, lsl #2] \n\t"
"ubfx %3, %10, #6, #2 \n\t"
"ldr %2, [%9, %2, lsl #2] \n\t"
"vmov d0, %0, %1 \n\t"
"ldr %3, [%9, %3, lsl #2] \n\t"
"vld1.32 {d2[],d3[]},[%11,:32] \n\t"
"vmov d1, %2, %3 \n\t"
"vmul.f32 q0, q0, q1 \n\t"
"vst1.32 {q0}, [%4,:128]! \n\t"
: "=&r"(v0), "=&r"(v1), "=&r"(v2), "=&r"(v3), "+r"(dst),
"=m"(dst[0]), "=m"(dst[1]), "=m"(dst[2]), "=m"(dst[3])
: "r"(v), "r"(idx), "r"(scale)
: "d0", "d1", "d2", "d3");
return dst;
}
#define VMUL2S VMUL2S
static inline float *VMUL2S(float *dst, const float *v, unsigned idx,
unsigned sign, const float *scale)
{
unsigned v0, v1, v2, v3;
__asm__ ("ubfx %0, %8, #0, #4 \n\t"
"ubfx %1, %8, #4, #4 \n\t"
"ldr %0, [%7, %0, lsl #2] \n\t"
"lsl %2, %10, #30 \n\t"
"ldr %1, [%7, %1, lsl #2] \n\t"
"lsl %3, %10, #31 \n\t"
"vmov d0, %0, %1 \n\t"
"bic %2, %2, #1<<30 \n\t"
"vld1.32 {d1[]}, [%9,:32] \n\t"
"vmov d2, %2, %3 \n\t"
"veor d0, d0, d2 \n\t"
"vmul.f32 d0, d0, d1 \n\t"
"vst1.32 {d0}, [%4,:64]! \n\t"
: "=&r"(v0), "=&r"(v1), "=&r"(v2), "=&r"(v3), "+r"(dst),
"=m"(dst[0]), "=m"(dst[1])
: "r"(v), "r"(idx), "r"(scale), "r"(sign)
: "d0", "d1", "d2");
return dst;
}
#define VMUL4S VMUL4S
static inline float *VMUL4S(float *dst, const float *v, unsigned idx,
unsigned sign, const float *scale)
{
unsigned v0, v1, v2, v3, nz;
__asm__ ("vld1.32 {d2[],d3[]},[%13,:32] \n\t"
"ubfx %0, %12, #0, #2 \n\t"
"ubfx %1, %12, #2, #2 \n\t"
"ldr %0, [%11,%0, lsl #2] \n\t"
"ubfx %2, %12, #4, #2 \n\t"
"ldr %1, [%11,%1, lsl #2] \n\t"
"ubfx %3, %12, #6, #2 \n\t"
"ldr %2, [%11,%2, lsl #2] \n\t"
"vmov d0, %0, %1 \n\t"
"ldr %3, [%11,%3, lsl #2] \n\t"
"lsr %6, %12, #12 \n\t"
"rbit %6, %6 \n\t"
"vmov d1, %2, %3 \n\t"
"lsls %6, %6, #1 \n\t"
"and %0, %5, #1<<31 \n\t"
"it cs \n\t"
"lslcs %5, %5, #1 \n\t"
"lsls %6, %6, #1 \n\t"
"and %1, %5, #1<<31 \n\t"
"it cs \n\t"
"lslcs %5, %5, #1 \n\t"
"lsls %6, %6, #1 \n\t"
"and %2, %5, #1<<31 \n\t"
"it cs \n\t"
"lslcs %5, %5, #1 \n\t"
"vmov d4, %0, %1 \n\t"
"and %3, %5, #1<<31 \n\t"
"vmov d5, %2, %3 \n\t"
"veor q0, q0, q2 \n\t"
"vmul.f32 q0, q0, q1 \n\t"
"vst1.32 {q0}, [%4,:128]! \n\t"
: "=&r"(v0), "=&r"(v1), "=&r"(v2), "=&r"(v3), "+r"(dst),
"+r"(sign), "=r"(nz),
"=m"(dst[0]), "=m"(dst[1]), "=m"(dst[2]), "=m"(dst[3])
: "r"(v), "r"(idx), "r"(scale)
: "cc", "d0", "d1", "d2", "d3", "d4", "d5");
return dst;
}
#endif /* HAVE_NEON_INLINE */
#endif /* AVCODEC_ARM_AAC_H */
| {
"pile_set_name": "Github"
} |
<!DOCTYPE HTML>
<html lang="" >
<head>
<meta charset="UTF-8">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>12-060D补丁 · GitBook</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="description" content="">
<meta name="generator" content="GitBook 3.2.3">
<link rel="stylesheet" href="../gitbook/style.css">
<link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
<link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
<link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
<meta name="HandheldFriendly" content="true"/>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
<link rel="next" href="12-1-普通的060D补丁/" />
<link rel="prev" href="../11-PNP0C0E睡眠修正方法/睡眠按键和_LID更名.html" />
</head>
<body>
<div class="book">
<div class="book-summary">
<div id="book-search-input" role="search">
<input type="text" placeholder="Type to search" />
</div>
<nav role="navigation">
<ul class="summary">
<li class="chapter " data-level="1.1" data-path="../">
<a href="../">
OpenCore 部件
</a>
</li>
<li class="chapter " data-level="1.2" data-path="../00-总述/">
<a href="../00-总述/">
00-总述
</a>
<ul class="articles">
<li class="chapter " data-level="1.2.1" data-path="../00-总述/00-1-ASL语法基础/">
<a href="../00-总述/00-1-ASL语法基础/">
00-1-ASL语法基础
</a>
</li>
<li class="chapter " data-level="1.2.2" data-path="../00-总述/00-2-SSDT补丁加载顺序/">
<a href="../00-总述/00-2-SSDT补丁加载顺序/">
00-2-SSDT补丁加载顺序
</a>
<ul class="articles">
<li class="chapter " data-level="1.2.2.1" data-path="../00-总述/00-2-SSDT补丁加载顺序/SSDT-XXXX-1.html">
<a href="../00-总述/00-2-SSDT补丁加载顺序/SSDT-XXXX-1.html">
SSDT-XXXX-1.dsl
</a>
</li>
<li class="chapter " data-level="1.2.2.2" data-path="../00-总述/00-2-SSDT补丁加载顺序/SSDT-XXXX-2.html">
<a href="../00-总述/00-2-SSDT补丁加载顺序/SSDT-XXXX-2.html">
SSDT-XXXX-2.dsl
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.2.3" data-path="../00-总述/00-3-ACPI表单/">
<a href="../00-总述/00-3-ACPI表单/">
00-3-ACPI表单
</a>
</li>
<li class="chapter " data-level="1.2.4" data-path="../03-二进制更名与预置变量/03-2-ASL-AML对照表/ASL-AML对照表.md">
<span>
00-4-ASL-AML对照表
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.3" data-path="../01-关于AOAC/">
<a href="../01-关于AOAC/">
01-关于AOAC
</a>
<ul class="articles">
<li class="chapter " data-level="1.3.1" data-path="../01-关于AOAC/01-1-禁止S3睡眠/">
<a href="../01-关于AOAC/01-1-禁止S3睡眠/">
01-1-禁止S3睡眠
</a>
<ul class="articles">
<li class="chapter " data-level="1.3.1.1" data-path="../01-关于AOAC/01-1-禁止S3睡眠/_S3更名XS3.html">
<a href="../01-关于AOAC/01-1-禁止S3睡眠/_S3更名XS3.html">
_S3更名XS3.plist
</a>
</li>
<li class="chapter " data-level="1.3.1.2" data-path="../01-关于AOAC/01-1-禁止S3睡眠/SSDT-MethodS3-disable.html">
<a href="../01-关于AOAC/01-1-禁止S3睡眠/SSDT-MethodS3-disable.html">
SSDT-MethodS3-disable.dsl
</a>
</li>
<li class="chapter " data-level="1.3.1.3" data-path="../01-关于AOAC/01-1-禁止S3睡眠/SSDT-NameS3-disable.html">
<a href="../01-关于AOAC/01-1-禁止S3睡眠/SSDT-NameS3-disable.html">
SSDT-NameS3-disable.dsl
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.3.2" data-path="../01-关于AOAC/01-2-AOAC禁止独显/">
<a href="../01-关于AOAC/01-2-AOAC禁止独显/">
01-2-AOAC禁止独显
</a>
<ul class="articles">
<li class="chapter " data-level="1.3.2.1" data-path="../01-关于AOAC/01-2-AOAC禁止独显/SSDT-NDGP_OFF-AOAC.html">
<a href="../01-关于AOAC/01-2-AOAC禁止独显/SSDT-NDGP_OFF-AOAC.html">
SSDT-NDGP_OFF-AOAC.dsl
</a>
</li>
<li class="chapter " data-level="1.3.2.2" data-path="../01-关于AOAC/01-2-AOAC禁止独显/SSDT-NDGP_PS3-AOAC.html">
<a href="../01-关于AOAC/01-2-AOAC禁止独显/SSDT-NDGP_PS3-AOAC.html">
SSDT-NDGP_PS3-AOAC.dsl
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.3.3" data-path="../01-关于AOAC/01-3-电源空闲管理/">
<a href="../01-关于AOAC/01-3-电源空闲管理/">
01-3-电源空闲管理
</a>
<ul class="articles">
<li class="chapter " data-level="1.3.3.1" data-path="../01-关于AOAC/01-3-电源空闲管理/SSDT-DeepIdle.html">
<a href="../01-关于AOAC/01-3-电源空闲管理/SSDT-DeepIdle.html">
SSDT-DeepIdle.dsl
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.3.4" data-path="../01-关于AOAC/01-4-AOAC唤醒方法/">
<a href="../01-关于AOAC/01-4-AOAC唤醒方法/">
01-4-AOAC唤醒方法
</a>
<ul class="articles">
<li class="chapter " data-level="1.3.4.1" data-path="../01-关于AOAC/01-4-AOAC唤醒方法/SSDT-LIDpatch-AOAC.html">
<a href="../01-关于AOAC/01-4-AOAC唤醒方法/SSDT-LIDpatch-AOAC.html">
SSDT-LIDpatch-AOAC.dsl
</a>
</li>
<li class="chapter " data-level="1.3.4.2" data-path="../01-关于AOAC/01-4-AOAC唤醒方法/SSDT-PCI0.LPCB-Wake-AOAC.html">
<a href="../01-关于AOAC/01-4-AOAC唤醒方法/SSDT-PCI0.LPCB-Wake-AOAC.html">
SSDT-PCI0.LPCB-Wake-AOAC.dsl
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.3.5" data-path="../01-关于AOAC/01-5-设置ASPM工作模式/">
<a href="../01-关于AOAC/01-5-设置ASPM工作模式/">
01-5-设置ASPM工作模式
</a>
<ul class="articles">
<li class="chapter " data-level="1.3.5.1" data-path="../01-关于AOAC/01-5-设置ASPM工作模式/SSDT-PCI0.RPXX-ASPM.html">
<a href="../01-关于AOAC/01-5-设置ASPM工作模式/SSDT-PCI0.RPXX-ASPM.html">
SSDT-PCI0.RPXX-ASPM.dsl
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.3.6" data-path="../01-关于AOAC/01-6-睡眠自动关闭蓝牙WIFI/">
<a href="../01-关于AOAC/01-6-睡眠自动关闭蓝牙WIFI/">
01-6-睡眠自动关闭蓝牙WIFI
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.4" data-path="../02-仿冒设备/">
<a href="../02-仿冒设备/">
02-仿冒设备
</a>
<ul class="articles">
<li class="chapter " data-level="1.4.1" data-path="../02-仿冒设备/02-1-仿冒EC/">
<a href="../02-仿冒设备/02-1-仿冒EC/">
02-1-仿冒EC
</a>
<ul class="articles">
<li class="chapter " data-level="1.4.1.1" data-path="../02-仿冒设备/02-1-仿冒EC/SSDT-EC.html">
<a href="../02-仿冒设备/02-1-仿冒EC/SSDT-EC.html">
SSDT-EC.dsl
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.4.2" data-path="../02-仿冒设备/02-2-RTC0/">
<a href="../02-仿冒设备/02-2-RTC0/">
02-2-RTC0
</a>
<ul class="articles">
<li class="chapter " data-level="1.4.2.1" data-path="../02-仿冒设备/02-2-RTC0/SSDT-RTC0.html">
<a href="../02-仿冒设备/02-2-RTC0/SSDT-RTC0.html">
SSDT-RTC0.dsl
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.4.3" data-path="../02-仿冒设备/02-3-仿冒环境光传感器/">
<a href="../02-仿冒设备/02-3-仿冒环境光传感器/">
02-3-仿冒环境光传感器
</a>
<ul class="articles">
<li class="chapter " data-level="1.4.3.1" data-path="../02-仿冒设备/02-3-仿冒环境光传感器/SSDT-ALS0.html">
<a href="../02-仿冒设备/02-3-仿冒环境光传感器/SSDT-ALS0.html">
SSDT-ALS0.dsl
</a>
</li>
<li class="chapter " data-level="1.4.3.2" data-path="../02-仿冒设备/02-3-仿冒环境光传感器/SSDT-ALSD.html">
<a href="../02-仿冒设备/02-3-仿冒环境光传感器/SSDT-ALSD.html">
SSDT-ALSD.dsl
</a>
</li>
</ul>
</li>
</ul>
</li>
<li class="chapter " data-level="1.5" data-path="../03-二进制更名与预置变量/">
<a href="../03-二进制更名与预置变量/">
03-二进制更名与预置变量
</a>
<ul class="articles">
<li class="chapter " data-level="1.5.1" data-path="../03-二进制更名与预置变量/03-1-OCI2C-GPIO补丁/">
<a href="../03-二进制更名与预置变量/03-1-OCI2C-GPIO补丁/">
03-1-OCI2C-GPIO补丁
</a>
<ul class="articles">
<li class="chapter " data-level="1.5.1.1" data-path="../03-二进制更名与预置变量/03-1-OCI2C-GPIO补丁/SSDT-OCGPI0-GPEN.html">
<a href="../03-二进制更名与预置变量/03-1-OCI2C-GPIO补丁/SSDT-OCGPI0-GPEN.html">
SSDT-OCGPI0-GPEN.dsl
</a>
</li>
<li class="chapter " data-level="1.5.1.2" data-path="../03-二进制更名与预置变量/03-1-OCI2C-GPIO补丁/SSDT-OCGPI0-GPHD.html">
<a href="../03-二进制更名与预置变量/03-1-OCI2C-GPIO补丁/SSDT-OCGPI0-GPHD.html">
SSDT-OCGPI0-GPHD.dsl
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.5.2" >
<span>
补丁库
</span>
<ul class="articles">
<li class="chapter " data-level="1.5.2.1" data-path="../03-二进制更名与预置变量/补丁库/SSDT-AWAC.html">
<a href="../03-二进制更名与预置变量/补丁库/SSDT-AWAC.html">
SSDT-AWAC.dsl
</a>
</li>
<li class="chapter " data-level="1.5.2.2" data-path="../03-二进制更名与预置变量/补丁库/SSDT-RTC_Y-AWAC_N.html">
<a href="../03-二进制更名与预置变量/补丁库/SSDT-RTC_Y-AWAC_N.html">
SSDT-RTC_Y-AWAC_N.dsl
</a>
</li>
</ul>
</li>
</ul>
</li>
<li class="chapter " data-level="1.6" data-path="../04-操作系统补丁/">
<a href="../04-操作系统补丁/">
04-操作系统补丁
</a>
<ul class="articles">
<li class="chapter " data-level="1.6.1" data-path="../04-操作系统补丁/操作系统补丁前置更名.html">
<a href="../04-操作系统补丁/操作系统补丁前置更名.html">
操作系统补丁前置更名.plist
</a>
</li>
<li class="chapter " data-level="1.6.2" data-path="../04-操作系统补丁/操作系统更名.html">
<a href="../04-操作系统补丁/操作系统更名.html">
操作系统更名.plist
</a>
</li>
<li class="chapter " data-level="1.6.3" data-path="../04-操作系统补丁/SSDT-OC-XOSI.html">
<a href="../04-操作系统补丁/SSDT-OC-XOSI.html">
SSDT-OC-XOSI.dsl
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.7" data-path="../05-注入设备/">
<a href="../05-注入设备/">
05-注入设备
</a>
<ul class="articles">
<li class="chapter " data-level="1.7.1" data-path="../05-注入设备/05-1-注入X86/">
<a href="../05-注入设备/05-1-注入X86/">
05-1-注入X86
</a>
<ul class="articles">
<li class="chapter " data-level="1.7.1.1" data-path="../05-注入设备/05-1-注入X86/SSDT-PLUG-_PR.CPU0.html">
<a href="../05-注入设备/05-1-注入X86/SSDT-PLUG-_PR.CPU0.html">
SSDT-PLUG-_PR.CPU0.dsl
</a>
</li>
<li class="chapter " data-level="1.7.1.2" data-path="../05-注入设备/05-1-注入X86/SSDT-PLUG-_PR.P000.html">
<a href="../05-注入设备/05-1-注入X86/SSDT-PLUG-_PR.P000.html">
SSDT-PLUG-_PR.P000.dsl
</a>
</li>
<li class="chapter " data-level="1.7.1.3" data-path="../05-注入设备/05-1-注入X86/SSDT-PLUG-_PR.PR00.html">
<a href="../05-注入设备/05-1-注入X86/SSDT-PLUG-_PR.PR00.html">
SSDT-PLUG-_PR.PR00.dsl
</a>
</li>
<li class="chapter " data-level="1.7.1.4" data-path="../05-注入设备/05-1-注入X86/SSDT-PLUG-_SB.CPU0.html">
<a href="../05-注入设备/05-1-注入X86/SSDT-PLUG-_SB.CPU0.html">
SSDT-PLUG-_SB.CPU0.dsl
</a>
</li>
<li class="chapter " data-level="1.7.1.5" data-path="../05-注入设备/05-1-注入X86/SSDT-PLUG-_SB.P000.html">
<a href="../05-注入设备/05-1-注入X86/SSDT-PLUG-_SB.P000.html">
SSDT-PLUG-_SB.P000.dsl
</a>
</li>
<li class="chapter " data-level="1.7.1.6" data-path="../05-注入设备/05-1-注入X86/SSDT-PLUG-_SB.PR00.html">
<a href="../05-注入设备/05-1-注入X86/SSDT-PLUG-_SB.PR00.html">
SSDT-PLUG-_SB.PR00.dsl
</a>
</li>
<li class="chapter " data-level="1.7.1.7" data-path="../05-注入设备/05-1-注入X86/SSDT-PLUG-SCK0.C000.html">
<a href="../05-注入设备/05-1-注入X86/SSDT-PLUG-SCK0.C000.html">
SSDT-PLUG-SCK0.C000.dsl
</a>
</li>
<li class="chapter " data-level="1.7.1.8" data-path="../05-注入设备/05-1-注入X86/SSDT-PLUG-SCK0.CPU0.html">
<a href="../05-注入设备/05-1-注入X86/SSDT-PLUG-SCK0.CPU0.html">
SSDT-PLUG-SCK0.CPU0.dsl
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.7.2" data-path="../05-注入设备/05-2-PNLF注入方法/">
<a href="../05-注入设备/05-2-PNLF注入方法/">
05-2-PNLF注入方法
</a>
<ul class="articles">
<li class="chapter " data-level="1.7.2.1" data-path="../05-注入设备/05-2-PNLF注入方法/ACPI亮度补丁/ACPI亮度补丁.html">
<a href="../05-注入设备/05-2-PNLF注入方法/ACPI亮度补丁/ACPI亮度补丁.html">
ACPI亮度补丁
</a>
<ul class="articles">
<li class="chapter " data-level="1.7.2.1.1" data-path="../05-注入设备/05-2-PNLF注入方法/ACPI亮度补丁/SSDT-PNLF-ACPI.html">
<a href="../05-注入设备/05-2-PNLF注入方法/ACPI亮度补丁/SSDT-PNLF-ACPI.html">
SSDT-PNLF-ACPI.dsl
</a>
</li>
<li class="chapter " data-level="1.7.2.1.2" data-path="../05-注入设备/05-2-PNLF注入方法/ACPI亮度补丁/修改图示.html">
<a href="../05-注入设备/05-2-PNLF注入方法/ACPI亮度补丁/修改图示.html">
修改图示
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.7.2.2" >
<span>
定制亮度补丁
</span>
<ul class="articles">
<li class="chapter " data-level="1.7.2.2.1" data-path="../05-注入设备/05-2-PNLF注入方法/定制亮度补丁/SSDT-PNLF-CFL.html">
<a href="../05-注入设备/05-2-PNLF注入方法/定制亮度补丁/SSDT-PNLF-CFL.html">
SSDT-PNLF-CFL.dsl
</a>
</li>
<li class="chapter " data-level="1.7.2.2.2" data-path="../05-注入设备/05-2-PNLF注入方法/定制亮度补丁/SSDT-PNLF-Haswell_Broadwell.html">
<a href="../05-注入设备/05-2-PNLF注入方法/定制亮度补丁/SSDT-PNLF-Haswell_Broadwell.html">
SSDT-PNLF-Haswell_Broadwell.dsl
</a>
</li>
<li class="chapter " data-level="1.7.2.2.3" data-path="../05-注入设备/05-2-PNLF注入方法/定制亮度补丁/SSDT-PNLF-SKL_KBL.html">
<a href="../05-注入设备/05-2-PNLF注入方法/定制亮度补丁/SSDT-PNLF-SKL_KBL.html">
SSDT-PNLF-SKL_KBL.dsl
</a>
</li>
<li class="chapter " data-level="1.7.2.2.4" data-path="../05-注入设备/05-2-PNLF注入方法/定制亮度补丁/SSDT-PNLF-SNB_IVY.html">
<a href="../05-注入设备/05-2-PNLF注入方法/定制亮度补丁/SSDT-PNLF-SNB_IVY.html">
SSDT-PNLF-SNB_IVY.dsl
</a>
</li>
</ul>
</li>
</ul>
</li>
<li class="chapter " data-level="1.7.3" data-path="../05-注入设备/05-3-SBUS_SMBU补丁/">
<a href="../05-注入设备/05-3-SBUS_SMBU补丁/">
05-3-SBUS/SMBU补丁
</a>
<ul class="articles">
<li class="chapter " data-level="1.7.3.1" data-path="../05-注入设备/05-3-SBUS_SMBU补丁/SSDT-SBUS.html">
<a href="../05-注入设备/05-3-SBUS_SMBU补丁/SSDT-SBUS.html">
SSDT-SBUS.dsl
</a>
</li>
<li class="chapter " data-level="1.7.3.2" data-path="../05-注入设备/05-3-SBUS_SMBU补丁/SSDT-SMBU.html">
<a href="../05-注入设备/05-3-SBUS_SMBU补丁/SSDT-SMBU.html">
SSDT-SMBU.dsl
</a>
</li>
</ul>
</li>
</ul>
</li>
<li class="chapter " data-level="1.8" data-path="../06-添加缺失的部件/">
<a href="../06-添加缺失的部件/">
06-添加缺失的部件
</a>
<ul class="articles">
<li class="chapter " data-level="1.8.1" data-path="../06-添加缺失的部件/SSDT-DMAC.html">
<a href="../06-添加缺失的部件/SSDT-DMAC.html">
SSDT-DMAC.dsl
</a>
</li>
<li class="chapter " data-level="1.8.2" data-path="../06-添加缺失的部件/SSDT-IMEI.html">
<a href="../06-添加缺失的部件/SSDT-IMEI.html">
SSDT-IMEI.dsl
</a>
</li>
<li class="chapter " data-level="1.8.3" data-path="../06-添加缺失的部件/SSDT-MCHC.html">
<a href="../06-添加缺失的部件/SSDT-MCHC.html">
SSDT-MCHC.dsl
</a>
</li>
<li class="chapter " data-level="1.8.4" data-path="../06-添加缺失的部件/SSDT-MEM2.html">
<a href="../06-添加缺失的部件/SSDT-MEM2.html">
SSDT-MEM2.dsl
</a>
</li>
<li class="chapter " data-level="1.8.5" data-path="../06-添加缺失的部件/SSDT-PMCR.html">
<a href="../06-添加缺失的部件/SSDT-PMCR.html">
SSDT-PMCR.dsl
</a>
</li>
<li class="chapter " data-level="1.8.6" data-path="../06-添加缺失的部件/SSDT-PPMC.html">
<a href="../06-添加缺失的部件/SSDT-PPMC.html">
SSDT-PPMC.dsl
</a>
</li>
<li class="chapter " data-level="1.8.7" data-path="../06-添加缺失的部件/SSDT-PWRB.html">
<a href="../06-添加缺失的部件/SSDT-PWRB.html">
SSDT-PWRB.dsl
</a>
</li>
<li class="chapter " data-level="1.8.8" data-path="../06-添加缺失的部件/SSDT-SLPB.html">
<a href="../06-添加缺失的部件/SSDT-SLPB.html">
SSDT-SLPB.dsl
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.9" data-path="../07-PS2键盘映射及亮度快捷键/">
<a href="../07-PS2键盘映射及亮度快捷键/">
07-PS2键盘映射及亮度快捷键
</a>
<ul class="articles">
<li class="chapter " data-level="1.9.1" data-path="../07-PS2键盘映射及亮度快捷键/ApplePS2ToADBMap.html">
<a href="../07-PS2键盘映射及亮度快捷键/ApplePS2ToADBMap.html">
ApplePS2ToADBMap.h
</a>
</li>
<li class="chapter " data-level="1.9.2" data-path="../07-PS2键盘映射及亮度快捷键/SSDT-RMCF-MouseAsTrackpad.html">
<a href="../07-PS2键盘映射及亮度快捷键/SSDT-RMCF-MouseAsTrackpad.html">
SSDT-RMCF-MouseAsTrackpad.dsl
</a>
</li>
<li class="chapter " data-level="1.9.3" data-path="../07-PS2键盘映射及亮度快捷键/SSDT-RMCF-PS2Map-AtoZ.html">
<a href="../07-PS2键盘映射及亮度快捷键/SSDT-RMCF-PS2Map-AtoZ.html">
SSDT-RMCF-PS2Map-AtoZ.dsl
</a>
</li>
<li class="chapter " data-level="1.9.4" data-path="../07-PS2键盘映射及亮度快捷键/SSDT-RMCF-PS2Map-dell.html">
<a href="../07-PS2键盘映射及亮度快捷键/SSDT-RMCF-PS2Map-dell.html">
SSDT-RMCF-PS2Map-dell.dsl
</a>
</li>
<li class="chapter " data-level="1.9.5" data-path="../07-PS2键盘映射及亮度快捷键/SSDT-RMCF-PS2Map-LenovoIWL.html">
<a href="../07-PS2键盘映射及亮度快捷键/SSDT-RMCF-PS2Map-LenovoIWL.html">
SSDT-RMCF-PS2Map-LenovoIWL.dsl
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.10" data-path="../08-电池补丁/">
<a href="../08-电池补丁/">
08-电池补丁
</a>
<ul class="articles">
<li class="chapter " data-level="1.10.1" data-path="../08-电池补丁/08-1-Thinkpad/">
<a href="../08-电池补丁/08-1-Thinkpad/">
08-1-Thinkpad
</a>
<ul class="articles">
<li class="chapter " data-level="1.10.1.1" >
<span>
各机型电池补丁
</span>
<ul class="articles">
<li class="chapter " data-level="1.10.1.1.1" data-path="../08-电池补丁/08-1-Thinkpad/各机型电池补丁/SSDT-Notify-LPC.html">
<a href="../08-电池补丁/08-1-Thinkpad/各机型电池补丁/SSDT-Notify-LPC.html">
SSDT-Notify-LPC.dsl
</a>
</li>
<li class="chapter " data-level="1.10.1.1.2" data-path="../08-电池补丁/08-1-Thinkpad/各机型电池补丁/SSDT-Notify-LPCB.html">
<a href="../08-电池补丁/08-1-Thinkpad/各机型电池补丁/SSDT-Notify-LPCB.html">
SSDT-Notify-LPCB.dsl
</a>
</li>
<li class="chapter " data-level="1.10.1.1.3" data-path="../08-电池补丁/08-1-Thinkpad/各机型电池补丁/SSDT-OCBAT0-TP_e30_s30.html">
<a href="../08-电池补丁/08-1-Thinkpad/各机型电池补丁/SSDT-OCBAT0-TP_e30_s30.html">
SSDT-OCBAT0-TP_e30_s30.dsl
</a>
</li>
<li class="chapter " data-level="1.10.1.1.4" data-path="../08-电池补丁/08-1-Thinkpad/各机型电池补丁/SSDT-OCBAT0-TP_re80_tx70_x1c5th_s12017_p51.html">
<a href="../08-电池补丁/08-1-Thinkpad/各机型电池补丁/SSDT-OCBAT0-TP_re80_tx70_x1c5th_s12017_p51.html">
SSDT-OCBAT0-TP_re80_tx70_x1c5th_s12017_p51.dsl
</a>
</li>
<li class="chapter " data-level="1.10.1.1.5" data-path="../08-电池补丁/08-1-Thinkpad/各机型电池补丁/SSDT-OCBAT0-TP_tx80_x1c6th.html">
<a href="../08-电池补丁/08-1-Thinkpad/各机型电池补丁/SSDT-OCBAT0-TP_tx80_x1c6th.html">
SSDT-OCBAT0-TP_tx80_x1c6th.dsl
</a>
</li>
<li class="chapter " data-level="1.10.1.1.6" data-path="../08-电池补丁/08-1-Thinkpad/各机型电池补丁/SSDT-OCBAT0-TP_wtx20-60_e40-70_x1c1th-3th.html">
<a href="../08-电池补丁/08-1-Thinkpad/各机型电池补丁/SSDT-OCBAT0-TP_wtx20-60_e40-70_x1c1th-3th.html">
SSDT-OCBAT0-TP_wtx20-60_e40-70_x1c1th-3th.dsl
</a>
</li>
<li class="chapter " data-level="1.10.1.1.7" data-path="../08-电池补丁/08-1-Thinkpad/各机型电池补丁/SSDT-OCBAT1-disable-LPC.html">
<a href="../08-电池补丁/08-1-Thinkpad/各机型电池补丁/SSDT-OCBAT1-disable-LPC.html">
SSDT-OCBAT1-disable-LPC.dsl
</a>
</li>
<li class="chapter " data-level="1.10.1.1.8" data-path="../08-电池补丁/08-1-Thinkpad/各机型电池补丁/SSDT-OCBAT1-disable-LPCB.html">
<a href="../08-电池补丁/08-1-Thinkpad/各机型电池补丁/SSDT-OCBAT1-disable-LPCB.html">
SSDT-OCBAT1-disable-LPCB.dsl
</a>
</li>
<li class="chapter " data-level="1.10.1.1.9" data-path="../08-电池补丁/08-1-Thinkpad/各机型电池补丁/SSDT-OCBATC-TP-_BIX.html">
<a href="../08-电池补丁/08-1-Thinkpad/各机型电池补丁/SSDT-OCBATC-TP-_BIX.html">
SSDT-OCBATC-TP-_BIX.dsl
</a>
</li>
<li class="chapter " data-level="1.10.1.1.10" data-path="../08-电池补丁/08-1-Thinkpad/各机型电池补丁/SSDT-OCBATC-TP-LPC.html">
<a href="../08-电池补丁/08-1-Thinkpad/各机型电池补丁/SSDT-OCBATC-TP-LPC.html">
SSDT-OCBATC-TP-LPC.dsl
</a>
</li>
<li class="chapter " data-level="1.10.1.1.11" data-path="../08-电池补丁/08-1-Thinkpad/各机型电池补丁/SSDT-OCBATC-TP-LPCB.html">
<a href="../08-电池补丁/08-1-Thinkpad/各机型电池补丁/SSDT-OCBATC-TP-LPCB.html">
SSDT-OCBATC-TP-LPCB.dsl
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.10.1.2" >
<span>
更名样本
</span>
<ul class="articles">
<li class="chapter " data-level="1.10.1.2.1" data-path="../08-电池补丁/08-1-Thinkpad/更名样本/TP电池基本更名.html">
<a href="../08-电池补丁/08-1-Thinkpad/更名样本/TP电池基本更名.html">
TP电池基本更名.plist
</a>
</li>
<li class="chapter " data-level="1.10.1.2.2" data-path="../08-电池补丁/08-1-Thinkpad/更名样本/TP电池Mutex置0更名.html">
<a href="../08-电池补丁/08-1-Thinkpad/更名样本/TP电池Mutex置0更名.html">
TP电池Mutex置0更名.plist
</a>
</li>
<li class="chapter " data-level="1.10.1.2.3" data-path="../08-电池补丁/08-1-Thinkpad/更名样本/BAT1禁用更名_STA to XSTA.html">
<a href="../08-电池补丁/08-1-Thinkpad/更名样本/BAT1禁用更名_STA to XSTA.html">
BAT1禁用更名_STA to XSTA.plist
</a>
</li>
<li class="chapter " data-level="1.10.1.2.4" data-path="../08-电池补丁/08-1-Thinkpad/更名样本/Notify更名.html">
<a href="../08-电池补丁/08-1-Thinkpad/更名样本/Notify更名.html">
Notify更名.plist
</a>
</li>
</ul>
</li>
</ul>
</li>
<li class="chapter " data-level="1.10.2" >
<span>
08-2-其它品牌
</span>
<ul class="articles">
<li class="chapter " data-level="1.10.2.1" data-path="../08-电池补丁/08-2-其它品牌/SSDT-OCBAT0-ASUS_FL5900U.html">
<a href="../08-电池补丁/08-2-其它品牌/SSDT-OCBAT0-ASUS_FL5900U.html">
SSDT-OCBAT0-ASUS_FL5900U.dsl
</a>
</li>
<li class="chapter " data-level="1.10.2.2" data-path="../08-电池补丁/08-2-其它品牌/SSDT-OCBAT0-HP_840_G3.html">
<a href="../08-电池补丁/08-2-其它品牌/SSDT-OCBAT0-HP_840_G3.html">
SSDT-OCBAT0-HP_840_G3.dsl
</a>
</li>
<li class="chapter " data-level="1.10.2.3" data-path="../08-电池补丁/08-2-其它品牌/SSDT-OCBAT0-HP_Pavilion-15.html">
<a href="../08-电池补丁/08-2-其它品牌/SSDT-OCBAT0-HP_Pavilion-15.html">
SSDT-OCBAT0-HP_Pavilion-15.dsl
</a>
</li>
<li class="chapter " data-level="1.10.2.4" data-path="../08-电池补丁/08-2-其它品牌/SSDT-OCBAT0-HP_Z66-14ProG2.html">
<a href="../08-电池补丁/08-2-其它品牌/SSDT-OCBAT0-HP_Z66-14ProG2.html">
SSDT-OCBAT0-HP_Z66-14ProG2.dsl
</a>
</li>
<li class="chapter " data-level="1.10.2.5" data-path="../08-电池补丁/08-2-其它品牌/SSDT-OCBAT0-Thunderobot-Air2-911-9750h.html">
<a href="../08-电池补丁/08-2-其它品牌/SSDT-OCBAT0-Thunderobot-Air2-911-9750h.html">
SSDT-OCBAT0-Thunderobot-Air2-911-9750h.dsl
</a>
</li>
<li class="chapter " data-level="1.10.2.6" data-path="../08-电池补丁/08-2-其它品牌/SSDT-OCBAT1-lenovoPRO13.html">
<a href="../08-电池补丁/08-2-其它品牌/SSDT-OCBAT1-lenovoPRO13.html">
SSDT-OCBAT1-lenovoPRO13.dsl
</a>
</li>
</ul>
</li>
</ul>
</li>
<li class="chapter " data-level="1.11" data-path="../09-禁用EHCx/">
<a href="../09-禁用EHCx/">
09-禁用EHCx
</a>
<ul class="articles">
<li class="chapter " data-level="1.11.1" data-path="../09-禁用EHCx/SSDT-EHC1_OFF.html">
<a href="../09-禁用EHCx/SSDT-EHC1_OFF.html">
SSDT-EHC1_OFF.dsl
</a>
</li>
<li class="chapter " data-level="1.11.2" data-path="../09-禁用EHCx/SSDT-EHC2_OFF.html">
<a href="../09-禁用EHCx/SSDT-EHC2_OFF.html">
SSDT-EHC2_OFF.dsl
</a>
</li>
<li class="chapter " data-level="1.11.3" data-path="../09-禁用EHCx/SSDT-EHCx_OFF.html">
<a href="../09-禁用EHCx/SSDT-EHCx_OFF.html">
SSDT-EHCx_OFF.dsl
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.12" data-path="../10-PTSWAK综合扩展补丁/">
<a href="../10-PTSWAK综合扩展补丁/">
10-PTSWAK综合扩展补丁
</a>
<ul class="articles">
<li class="chapter " data-level="1.12.1" data-path="../10-PTSWAK综合扩展补丁/SSDT-EXT3-LedReset-TP.md">
<span>
SSDT-EXT3-LedReset-TP.dsl
</a>
</li>
<li class="chapter " data-level="1.12.2" data-path="../10-PTSWAK综合扩展补丁/SSDT-EXT4-WakeScreen.html">
<a href="../10-PTSWAK综合扩展补丁/SSDT-EXT4-WakeScreen.html">
SSDT-EXT4-WakeScreen.dsl
</a>
</li>
<li class="chapter " data-level="1.12.3" data-path="../10-PTSWAK综合扩展补丁/SSDT-PTSWAK.md">
<span>
SSDT-PTSWAK.dsl
</a>
</li>
<li class="chapter " data-level="1.12.4" data-path="../10-PTSWAK综合扩展补丁/综合补丁更名.html">
<a href="../10-PTSWAK综合扩展补丁/综合补丁更名.html">
综合补丁更名.plist
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.13" data-path="../11-PNP0C0E睡眠修正方法/">
<a href="../11-PNP0C0E睡眠修正方法/">
11-PNP0C0E睡眠修正方法
</a>
<ul class="articles">
<li class="chapter " data-level="1.13.1" data-path="../11-PNP0C0E睡眠修正方法/SSDT-FnF4_Q13-X1C5th.html">
<a href="../11-PNP0C0E睡眠修正方法/SSDT-FnF4_Q13-X1C5th.html">
SSDT-FnF4_Q13-X1C5th.dsl
</a>
</li>
<li class="chapter " data-level="1.13.2" data-path="../11-PNP0C0E睡眠修正方法/SSDT-FnInsert_BTNV-dell.html">
<a href="../11-PNP0C0E睡眠修正方法/SSDT-FnInsert_BTNV-dell.html">
SSDT-FnInsert_BTNV-dell.dsl
</a>
</li>
<li class="chapter " data-level="1.13.3" data-path="../11-PNP0C0E睡眠修正方法/SSDT-LIDpatch.html">
<a href="../11-PNP0C0E睡眠修正方法/SSDT-LIDpatch.html">
SSDT-LIDpatch.dsl
</a>
</li>
<li class="chapter " data-level="1.13.4" data-path="../11-PNP0C0E睡眠修正方法/睡眠按键和_LID更名.html">
<a href="../11-PNP0C0E睡眠修正方法/睡眠按键和_LID更名.html">
睡眠按键和_LID更名.plist
</a>
</li>
</ul>
</li>
<li class="chapter active" data-level="1.14" data-path="./">
<a href="./">
12-060D补丁
</a>
<ul class="articles">
<li class="chapter " data-level="1.14.1" data-path="12-1-普通的060D补丁/">
<a href="12-1-普通的060D补丁/">
12-1-普通的060D补丁
</a>
<ul class="articles">
<li class="chapter " data-level="1.14.1.1" data-path="12-1-普通的060D补丁/SSDT-GPRW.html">
<a href="12-1-普通的060D补丁/SSDT-GPRW.html">
SSDT-GPRW.dsl
</a>
</li>
<li class="chapter " data-level="1.14.1.2" data-path="12-1-普通的060D补丁/SSDT-UPRW.html">
<a href="12-1-普通的060D补丁/SSDT-UPRW.html">
SSDT-UPRW.dsl
</a>
</li>
<li class="chapter " data-level="1.14.1.3" data-path="12-1-普通的060D补丁/Name-0D更名.html">
<a href="12-1-普通的060D补丁/Name-0D更名.html">
Name-0D更名.plist
</a>
</li>
<li class="chapter " data-level="1.14.1.4" data-path="12-1-普通的060D补丁/Name-6D更名.html">
<a href="12-1-普通的060D补丁/Name-6D更名.html">
Name-6D更名.plist
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.14.2" data-path="12-2-惠普特殊的060D补丁/">
<a href="12-2-惠普特殊的060D补丁/">
12-2-惠普特殊的060D补丁
</a>
<ul class="articles">
<li class="chapter " data-level="1.14.2.1" data-path="12-2-惠普特殊的060D补丁/SSDT-0D6D-HP.html">
<a href="12-2-惠普特殊的060D补丁/SSDT-0D6D-HP.html">
SSDT-0D6D-HP.dsl
</a>
</li>
</ul>
</li>
</ul>
</li>
<li class="chapter " data-level="1.15" data-path="../13-仿冒以太网和重置以太网BSD Name/">
<a href="../13-仿冒以太网和重置以太网BSD Name/">
13-仿冒以太网和重置以太网BSD Name
</a>
<ul class="articles">
<li class="chapter " data-level="1.15.1" data-path="../13-仿冒以太网和重置以太网BSD Name/SSDT-LAN.html">
<a href="../13-仿冒以太网和重置以太网BSD Name/SSDT-LAN.html">
SSDT-LAN.dsl
</a>
</li>
<li class="chapter " data-level="1.15.2" data-path="../13-仿冒以太网和重置以太网BSD Name/清除所有网络.md">
<span>
清除所有网络
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.16" data-path="../14-CMOS相关/">
<a href="../14-CMOS相关/">
14-CMOS相关
</a>
<ul class="articles">
<li class="chapter " data-level="1.16.1" data-path="../14-CMOS相关/14-1-CMOS内存和RTCMemoryFixup/">
<a href="../14-CMOS相关/14-1-CMOS内存和RTCMemoryFixup/">
14-1-CMOS内存和RTCMemoryFixup
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.17" data-path="../15-ACPI定制USB端口/">
<a href="../15-ACPI定制USB端口/">
15-ACPI定制USB端口
</a>
<ul class="articles">
<li class="chapter " data-level="1.17.1" data-path="../15-ACPI定制USB端口/SSDT-CB-01_XHC.html">
<a href="../15-ACPI定制USB端口/SSDT-CB-01_XHC.html">
SSDT-CB-01_XHC.dsl
</a>
</li>
<li class="chapter " data-level="1.17.2" data-path="../15-ACPI定制USB端口/SSDT-xh_OEMBD_XHC.html">
<a href="../15-ACPI定制USB端口/SSDT-xh_OEMBD_XHC.html">
SSDT-xh_OEMBD_XHC.dsl
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.18" data-path="../16-禁止PCI设备/">
<a href="../16-禁止PCI设备/">
16-禁止PCI设备
</a>
<ul class="articles">
<li class="chapter " data-level="1.18.1" data-path="../16-禁止PCI设备/SSDT-RP01.PXSX-disbale.html">
<a href="../16-禁止PCI设备/SSDT-RP01.PXSX-disbale.html">
SSDT-RP01.PXSX-disbale.dsl
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.19" data-path="../17-ACPIDebug/">
<a href="../17-ACPIDebug/">
17-ACPIDebug
</a>
<ul class="articles">
<li class="chapter " data-level="1.19.1" data-path="../17-ACPIDebug/SSDT-BKeyQxx-Debug.html">
<a href="../17-ACPIDebug/SSDT-BKeyQxx-Debug.html">
SSDT-BKeyQxx-Debug.dsl
</a>
</li>
<li class="chapter " data-level="1.19.2" data-path="../17-ACPIDebug/SSDT-RMDT.html">
<a href="../17-ACPIDebug/SSDT-RMDT.html">
SSDT-RMDT.dsl
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.20" data-path="../18-品牌机器特殊补丁/">
<a href="../18-品牌机器特殊补丁/">
18-品牌机器特殊补丁
</a>
<ul class="articles">
<li class="chapter " data-level="1.20.1" data-path="../18-品牌机器特殊补丁/18-1-Dell机器特殊补丁/">
<a href="../18-品牌机器特殊补丁/18-1-Dell机器特殊补丁/">
18-1-Dell机器特殊补丁
</a>
<ul class="articles">
<li class="chapter " data-level="1.20.1.1" data-path="../18-品牌机器特殊补丁/18-1-Dell机器特殊补丁/SSDT-OCWork-dell.html">
<a href="../18-品牌机器特殊补丁/18-1-Dell机器特殊补丁/SSDT-OCWork-dell.html">
SSDT-OCWork-dell.dsl
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.20.2" data-path="../18-品牌机器特殊补丁/18-2-小新PRO13特殊补丁/">
<a href="../18-品牌机器特殊补丁/18-2-小新PRO13特殊补丁/">
18-2-小新PRO13特殊补丁
</a>
<ul class="articles">
<li class="chapter " data-level="1.20.2.1" data-path="../18-品牌机器特殊补丁/18-1-Dell机器特殊补丁/SSDT-OCPublic-Merge.md">
<span>
SSDT-OCPublic-Merge.dsl
</a>
</li>
<li class="chapter " data-level="1.20.2.2" data-path="../18-品牌机器特殊补丁/18-1-Dell机器特殊补丁/SSDT-RMCF-PS2Map-LenovoPRO13.md">
<span>
SSDT-RMCF-PS2Map-LenovoPRO13.dsl
</a>
</li>
</ul>
</li>
</ul>
</li>
<li class="chapter " data-level="1.21" data-path="../19-I2C专用部件/">
<a href="../19-I2C专用部件/">
19-I2C专用部件
</a>
<ul class="articles">
<li class="chapter " data-level="1.21.1" data-path="../19-I2C专用部件/SSDT-OCI2C-TPXX-chao7000.html">
<a href="../19-I2C专用部件/SSDT-OCI2C-TPXX-chao7000.html">
SSDT-OCI2C-TPXX-chao7000.dsl
</a>
</li>
<li class="chapter " data-level="1.21.2" data-path="../19-I2C专用部件/SSDT-OCI2C-TPXX-dell5480.html">
<a href="../19-I2C专用部件/SSDT-OCI2C-TPXX-dell5480.html">
SSDT-OCI2C-TPXX-dell5480.dsl
</a>
</li>
<li class="chapter " data-level="1.21.3" data-path="../19-I2C专用部件/SSDT-OCI2C-TPXX-LenovoIWL.html">
<a href="../19-I2C专用部件/SSDT-OCI2C-TPXX-LenovoIWL.html">
SSDT-OCI2C-TPXX-LenovoIWL.dsl
</a>
</li>
<li class="chapter " data-level="1.21.4" data-path="../19-I2C专用部件/SSDT-OCI2C-TPXX-lenovoPRO13.html">
<a href="../19-I2C专用部件/SSDT-OCI2C-TPXX-lenovoPRO13.html">
SSDT-OCI2C-TPXX-lenovoPRO13.dsl
</a>
</li>
<li class="chapter " data-level="1.21.5" data-path="../19-I2C专用部件/SSDT-OCGPI0-GPEN.html">
<a href="../19-I2C专用部件/SSDT-OCGPI0-GPEN.html">
SSDT-OCGPI0-GPEN.dsl
</a>
</li>
<li class="chapter " data-level="1.21.6" data-path="../19-I2C专用部件/SSDT-I2CxConf.html">
<a href="../19-I2C专用部件/SSDT-I2CxConf.html">
SSDT-I2CxConf.dsl
</a>
</li>
<li class="chapter " data-level="1.21.7" data-path="../19-I2C专用部件/SSDT-OCGPI0-GPHD.html">
<a href="../19-I2C专用部件/SSDT-OCGPI0-GPHD.html">
SSDT-OCGPI0-GPHD.dsl
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.22" data-path="../20-SSDT屏蔽独显方法/">
<a href="../20-SSDT屏蔽独显方法/">
20-SSDT屏蔽独显方法
</a>
<ul class="articles">
<li class="chapter " data-level="1.22.1" data-path="../20-SSDT屏蔽独显方法/SSDT-NDGP_OFF.html">
<a href="../20-SSDT屏蔽独显方法/SSDT-NDGP_OFF.html">
SSDT-NDGP_OFF.dsl
</a>
</li>
<li class="chapter " data-level="1.22.2" data-path="../20-SSDT屏蔽独显方法/SSDT-NDGP_PS3.html">
<a href="../20-SSDT屏蔽独显方法/SSDT-NDGP_PS3.html">
SSDT-NDGP_PS3.dsl
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.23" data-path="../保留部件/">
<a href="../保留部件/">
保留部件
</a>
<ul class="articles">
<li class="chapter " data-level="1.23.1" data-path="../保留部件/声卡IRQ补丁/">
<a href="../保留部件/声卡IRQ补丁/">
声卡IRQ补丁
</a>
<ul class="articles">
<li class="chapter " data-level="1.23.1.1" data-path="../保留部件/声卡IRQ补丁/SSDT-HPET_RTC_TIMR-fix.html">
<a href="../保留部件/声卡IRQ补丁/SSDT-HPET_RTC_TIMR-fix.html">
SSDT-HPET_RTC_TIMR-fix.dsl
</a>
</li>
<li class="chapter " data-level="1.23.1.2" data-path="../保留部件/声卡IRQ补丁/SSDT-IPIC.html">
<a href="../保留部件/声卡IRQ补丁/SSDT-IPIC.html">
SSDT-IPIC.dsl
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.23.2" data-path="../保留部件/CMOS重置补丁/">
<a href="../保留部件/CMOS重置补丁/">
CMOS重置补丁
</a>
<ul class="articles">
<li class="chapter " data-level="1.23.2.1" data-path="../保留部件/CMOS重置补丁/SSDT-RTC0-NoFlags.html">
<a href="../保留部件/CMOS重置补丁/SSDT-RTC0-NoFlags.html">
SSDT-RTC0-NoFlags.dsl
</a>
</li>
</ul>
</li>
</ul>
</li>
<li class="chapter " data-level="1.24" data-path="../常见驱动加载顺序/">
<a href="../常见驱动加载顺序/">
常见驱动加载顺序
</a>
<ul class="articles">
<li class="chapter " data-level="1.24.1" data-path="../常见驱动加载顺序/config-1-Lilu-SMC-WEG-ALC驱动列表.html">
<a href="../常见驱动加载顺序/config-1-Lilu-SMC-WEG-ALC驱动列表.html">
config-1-Lilu-SMC-WEG-ALC驱动列表.plist
</a>
</li>
<li class="chapter " data-level="1.24.2" data-path="../常见驱动加载顺序/config-2-PS2键盘驱动列表.html">
<a href="../常见驱动加载顺序/config-2-PS2键盘驱动列表.html">
config-2-PS2键盘驱动列表.plist
</a>
</li>
<li class="chapter " data-level="1.24.3" data-path="../常见驱动加载顺序/config-3-BCM无线和蓝牙驱动列表.html">
<a href="../常见驱动加载顺序/config-3-BCM无线和蓝牙驱动列表.html">
config-3-BCM无线和蓝牙驱动列表.plist
</a>
</li>
<li class="chapter " data-level="1.24.4" data-path="../常见驱动加载顺序/config-4-I2C驱动列表.html">
<a href="../常见驱动加载顺序/config-4-I2C驱动列表.html">
config-4-I2C驱动列表.plist
</a>
</li>
<li class="chapter " data-level="1.24.5" data-path="../常见驱动加载顺序/config-5-PS2Smart键盘驱动列表.html">
<a href="../常见驱动加载顺序/config-5-PS2Smart键盘驱动列表.html">
config-5-PS2Smart键盘驱动列表.plist
</a>
</li>
<li class="chapter " data-level="1.24.6" data-path="../常见驱动加载顺序/config-6-Intel无线和蓝牙驱动列表.html">
<a href="../常见驱动加载顺序/config-6-Intel无线和蓝牙驱动列表.html">
config-6-Intel无线和蓝牙驱动列表.plist
</a>
</li>
</ul>
</li>
<li class="divider"></li>
<li>
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
Published with GitBook
</a>
</li>
</ul>
</nav>
</div>
<div class="book-body">
<div class="body-inner">
<div class="book-header" role="navigation">
<!-- Title -->
<h1>
<i class="fa fa-circle-o-notch fa-spin"></i>
<a href=".." >12-060D补丁</a>
</h1>
</div>
<div class="page-wrapper" tabindex="-1" role="main">
<div class="page-inner">
<div id="book-search-results">
<div class="search-noresults">
<section class="normal markdown-section">
<h1 id="0d6d-补丁">0D/6D 补丁</h1>
<h2 id="概述">概述</h2>
<ul>
<li><code>_PRW</code> 定义了一个部件的唤醒方法。其 <code>Return</code> 2 个或者 2 个以上字节组成的数据包。有关 <code>_PRW</code> 详细的内容参见 ACPI 规范。</li>
<li>有这么一些部件,由于他们的 <code>_PRW</code> 和 macOS 发生了冲突从而导致机器刚刚睡眠成功就被立即唤醒。为了解决问题,必须对这些部件实施补丁。这些部件 <code>_PRW</code> 数据包的第 1 个字节是 <code>0D</code> 或者 <code>6D</code>。因此,这种补丁被称为 <code>0D/6D补丁</code>,也叫<code>秒醒补丁</code>,也叫<code>睡了即醒补丁</code>。为了描述方便,以下统一称之为 <code>0D/6D补丁</code>。</li>
<li><code>_PRW</code> 数据包的第 2 个字节多为 <code>03</code> 或者 <code>04</code>,将这个字节修正为 <code>0</code> 即完成了 <code>0D/6D补丁</code>。</li>
<li>不同的机器对 <code>_PRW</code> 定义的方法可能不同,其数据包的内容、形式也可能多样化。实际的 <code>0D/6D补丁</code> 应视具体情况而定。见后文的描述。</li>
<li>我们期待 OpenCore 后续版本能够解决 <code>0D/6D</code> 问题。</li>
</ul>
<h3 id="可能需要-0d6d补丁-的部件">可能需要 <code>0D/6D补丁</code> 的部件</h3>
<ul>
<li><p>USB 类设备</p>
<ul>
<li><code>ADR</code> 地址:<code>0x001D0000</code>, 部件名称:<code>EHC1</code> 【6代之前】</li>
<li><code>ADR</code> 地址:<code>0x001A0000</code>, 部件名称:<code>EHC2</code> 【6代之前】</li>
<li><code>ADR</code> 地址:<code>0x00140000</code>, 部件名称:<code>XHC</code>, <code>XHCI</code>, <code>XHC1</code> 等</li>
<li><code>ADR</code> 地址:<code>0x00140001</code>, 部件名称:<code>XDCI</code></li>
<li><code>ADR</code> 地址:<code>0x00140003</code>, 部件名称:<code>CNVW</code></li>
</ul>
</li>
<li><p>以太网</p>
<ul>
<li>6 代以前,<code>ADR</code> 地址:<code>0x00190000</code>, 部件名称:<code>GLAN</code>, <code>IGBE</code> 等。</li>
<li>6 代及 6 代以后,<code>ADR</code> 地址:<code>0x001F0006</code>, 部件名称:<code>GLAN</code>, <code>IGBE</code> 等。</li>
</ul>
</li>
<li><p>声卡</p>
<ul>
<li>6 代以前,<code>ADR</code> 地址:<code>0x001B0000</code>, 部件名称:<code>HDEF</code>, <code>AZAL</code> 等。</li>
<li>6 代及 6 代以后,<code>ADR</code> 地址:<code>0x001F0003</code>, 部件名称:<code>HDAS</code>, <code>AZAL</code> 等。</li>
</ul>
<p><strong>注意1</strong>:通过查找名称确认上述部件的方法并不可靠。可靠的方法是搜索 <code>ADR 地址</code>, <code>_PRW</code>。</p>
<p><strong>注意2</strong>:新发布的机器可能会有新的部件需要 <code>0D/6D补丁</code>。</p>
</li>
</ul>
<h2 id="prw-的多样性和对应的补丁方法"><code>_PRW</code> 的多样性和对应的补丁方法</h2>
<ul>
<li><p><code>Name 类型</code></p>
<pre><code class="lang-Swift"> <span class="hljs-type">Name</span> (_PRW, <span class="hljs-type">Package</span> (<span class="hljs-number">0x02</span>)
{
<span class="hljs-number">0x0D</span>, <span class="hljs-comment">/* 可能是0x6D */</span>
<span class="hljs-number">0x03</span>,<span class="hljs-comment">/* 可能是0x04 */</span>
...
})
</code></pre>
<p>这种类型的 <code>0D/6D补丁</code> 适合用二进制更名方法修正 <code>0x03</code>(或 <code>0x04</code>)为 <code>0x00</code>。文件包提供了:</p>
<ul>
<li>Name-0D 更名 .plist<ul>
<li><code>Name0D-03</code> to <code>00</code></li>
<li><code>Name0D-04</code> to <code>00</code></li>
</ul>
</li>
<li>Name-6D 更名 .plist<ul>
<li><code>Name6D-03</code> to <code>00</code></li>
<li><code>Name6D-04</code> to <code>00</code></li>
</ul>
</li>
</ul>
</li>
<li><p><code>Method 类型</code> 之一:<code>GPRW(UPRW)</code></p>
<pre><code class="lang-Swift"> <span class="hljs-type">Method</span> (_PRW, <span class="hljs-number">0</span>, <span class="hljs-type">NotSerialized</span>)
{
<span class="hljs-type">Return</span> (<span class="hljs-type">GPRW</span> (<span class="hljs-number">0x6D</span>, <span class="hljs-number">0x04</span>)) <span class="hljs-comment">/* 或者Return (UPRW (0x6D, 0x04)) */</span>
}
</code></pre>
<p>较新的机器大多数属于这种情况。按常规方法(更名-补丁)即可。文件包提供了:</p>
<ul>
<li><strong><em>SSDT-GPRW</em></strong>(补丁文件内有二进制更名数据)</li>
<li><strong><em>SSDT-UPRW</em></strong>(补丁文件内有二进制更名数据)</li>
</ul>
</li>
<li><p><code>Method 类型</code>之二:<code>Scope</code></p>
<pre><code class="lang-Swift"> <span class="hljs-type">Scope</span> (_SB.<span class="hljs-type">PCI0</span>.<span class="hljs-type">XHC</span>)
{
<span class="hljs-type">Method</span> (_PRW, <span class="hljs-number">0</span>, <span class="hljs-type">NotSerialized</span>)
{
...
<span class="hljs-type">If</span> ((<span class="hljs-type">Local0</span> == <span class="hljs-number">0x03</span>))
{
<span class="hljs-type">Return</span> (<span class="hljs-type">Package</span> (<span class="hljs-number">0x02</span>)
{
<span class="hljs-number">0x6D</span>,
<span class="hljs-number">0x03</span>
})
}
<span class="hljs-type">If</span> ((<span class="hljs-type">Local0</span> == <span class="hljs-type">One</span>))
{
<span class="hljs-type">Return</span> (<span class="hljs-type">Package</span> (<span class="hljs-number">0x02</span>)
{
<span class="hljs-number">0x6D</span>,
<span class="hljs-type">One</span>
})
}
<span class="hljs-type">Return</span> (<span class="hljs-type">Package</span> (<span class="hljs-number">0x02</span>)
{
<span class="hljs-number">0x6D</span>,
<span class="hljs-type">Zero</span>
})
}
}
</code></pre>
<p>这种情况并不常见。对于示例的情况,使用二进制更名 <strong><em>Name6D-03 to 00</em></strong> 即可。其他形式内容自行尝试。</p>
</li>
<li><p><code>Name 类型</code>, <code>Method 类型</code>混合方式</p>
<p>对于多数 TP 机器,涉及 <code>0D/6D补丁</code> 的部件既有 <code>Name 类型</code>,也有 <code>Method 类型</code>。采用各自类型的补丁即可。<strong>需要注意的是</strong>二进制更名补丁不可滥用,有些不需要 <code>0D/6D补丁</code> 的部件 <code>_PRW</code> 也可能是 <code>0D</code> 或 <code>6D</code>。为防止这种错误,应提取 <code>System DSDT</code> 文件加以验证、核实。</p>
</li>
</ul>
<h3 id="注意事项">注意事项</h3>
<ul>
<li>本文描述的方法适用于Hotpatch。</li>
<li>凡是用到了二进制更名,应提取 <code>System DSDT</code> 文件加以验证。</li>
<li>惠普机器<code>06/0D</code>补丁比较特殊,详见《12-2-惠普特殊的060D补丁》</li>
</ul>
</section>
</div>
<div class="search-results">
<div class="has-results">
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
<ul class="search-results-list"></ul>
</div>
<div class="no-results">
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
</div>
</div>
</div>
</div>
</div>
</div>
<a href="../11-PNP0C0E睡眠修正方法/睡眠按键和_LID更名.html" class="navigation navigation-prev " aria-label="Previous page: 睡眠按键和_LID更名.plist">
<i class="fa fa-angle-left"></i>
</a>
<a href="12-1-普通的060D补丁/" class="navigation navigation-next " aria-label="Next page: 12-1-普通的060D补丁">
<i class="fa fa-angle-right"></i>
</a>
</div>
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"12-060D补丁","level":"1.14","depth":1,"next":{"title":"12-1-普通的060D补丁","level":"1.14.1","depth":2,"path":"12-060D补丁/12-1-普通的060D补丁/README.md","ref":"12-060D补丁/12-1-普通的060D补丁/README.md","articles":[{"title":"SSDT-GPRW.dsl","level":"1.14.1.1","depth":3,"path":"12-060D补丁/12-1-普通的060D补丁/SSDT-GPRW.md","ref":"12-060D补丁/12-1-普通的060D补丁/SSDT-GPRW.md","articles":[]},{"title":"SSDT-UPRW.dsl","level":"1.14.1.2","depth":3,"path":"12-060D补丁/12-1-普通的060D补丁/SSDT-UPRW.md","ref":"12-060D补丁/12-1-普通的060D补丁/SSDT-UPRW.md","articles":[]},{"title":"Name-0D更名.plist","level":"1.14.1.3","depth":3,"path":"12-060D补丁/12-1-普通的060D补丁/Name-0D更名.md","ref":"12-060D补丁/12-1-普通的060D补丁/Name-0D更名.md","articles":[]},{"title":"Name-6D更名.plist","level":"1.14.1.4","depth":3,"path":"12-060D补丁/12-1-普通的060D补丁/Name-6D更名.md","ref":"12-060D补丁/12-1-普通的060D补丁/Name-6D更名.md","articles":[]}]},"previous":{"title":"睡眠按键和_LID更名.plist","level":"1.13.4","depth":2,"path":"11-PNP0C0E睡眠修正方法/睡眠按键和_LID更名.md","ref":"11-PNP0C0E睡眠修正方法/睡眠按键和_LID更名.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"12-060D补丁/README.md","mtime":"2020-09-19T06:09:20.607Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-09-19T06:10:45.526Z"},"basePath":"..","book":{"language":""}});
});
</script>
</div>
<script src="../gitbook/gitbook.js"></script>
<script src="../gitbook/theme.js"></script>
<script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
<script src="../gitbook/gitbook-plugin-search/search.js"></script>
<script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
<script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
<script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
<script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
</body>
</html>
| {
"pile_set_name": "Github"
} |
/*
* Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.crypto.provider;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactorySpi;
import javax.crypto.spec.DESedeKeySpec;
import java.security.InvalidKeyException;
import java.security.spec.KeySpec;
import java.security.spec.InvalidKeySpecException;
/**
* This class implements the DES-EDE key factory of the Sun provider.
*
* @author Jan Luehe
*
*/
public final class DESedeKeyFactory extends SecretKeyFactorySpi {
/**
* Verify the SunJCE provider in the constructor.
*
* @exception SecurityException if fails to verify
* its own integrity
*/
public DESedeKeyFactory() {
if (!SunJCE.verifySelfIntegrity(this.getClass())) {
throw new SecurityException("The SunJCE provider may have been " +
"tampered.");
}
}
/**
* Generates a <code>SecretKey</code> object from the provided key
* specification (key material).
*
* @param keySpec the specification (key material) of the secret key
*
* @return the secret key
*
* @exception InvalidKeySpecException if the given key specification
* is inappropriate for this key factory to produce a public key.
*/
protected SecretKey engineGenerateSecret(KeySpec keySpec)
throws InvalidKeySpecException {
DESedeKey desEdeKey = null;
try {
if (keySpec instanceof DESedeKeySpec) {
DESedeKeySpec desEdeKeySpec = (DESedeKeySpec)keySpec;
desEdeKey = new DESedeKey(desEdeKeySpec.getKey());
} else {
throw new InvalidKeySpecException
("Inappropriate key specification");
}
} catch (InvalidKeyException e) {
}
return desEdeKey;
}
/**
* Returns a specification (key material) of the given key
* in the requested format.
*
* @param key the key
*
* @param keySpec the requested format in which the key material shall be
* returned
*
* @return the underlying key specification (key material) in the
* requested format
*
* @exception InvalidKeySpecException if the requested key specification is
* inappropriate for the given key, or the given key cannot be processed
* (e.g., the given key has an unrecognized algorithm or format).
*/
protected KeySpec engineGetKeySpec(SecretKey key, Class keySpec)
throws InvalidKeySpecException {
try {
if ((key instanceof SecretKey)
&& (key.getAlgorithm().equalsIgnoreCase("DESede"))
&& (key.getFormat().equalsIgnoreCase("RAW"))) {
// Check if requested key spec is amongst the valid ones
if (DESedeKeySpec.class.isAssignableFrom(keySpec)) {
return new DESedeKeySpec(key.getEncoded());
} else {
throw new InvalidKeySpecException
("Inappropriate key specification");
}
} else {
throw new InvalidKeySpecException
("Inappropriate key format/algorithm");
}
} catch (InvalidKeyException e) {
throw new InvalidKeySpecException("Secret key has wrong size");
}
}
/**
* Translates a <code>SecretKey</code> object, whose provider may be
* unknown or potentially untrusted, into a corresponding
* <code>SecretKey</code> object of this key factory.
*
* @param key the key whose provider is unknown or untrusted
*
* @return the translated key
*
* @exception InvalidKeyException if the given key cannot be processed by
* this key factory.
*/
protected SecretKey engineTranslateKey(SecretKey key)
throws InvalidKeyException {
try {
if ((key != null)
&& (key.getAlgorithm().equalsIgnoreCase("DESede"))
&& (key.getFormat().equalsIgnoreCase("RAW"))) {
// Check if key originates from this factory
if (key instanceof com.sun.crypto.provider.DESedeKey) {
return key;
}
// Convert key to spec
DESedeKeySpec desEdeKeySpec
= (DESedeKeySpec)engineGetKeySpec(key,
DESedeKeySpec.class);
// Create key from spec, and return it
return engineGenerateSecret(desEdeKeySpec);
} else {
throw new InvalidKeyException
("Inappropriate key format/algorithm");
}
} catch (InvalidKeySpecException e) {
throw new InvalidKeyException("Cannot translate key");
}
}
}
| {
"pile_set_name": "Github"
} |
/* RTL dead code elimination.
Copyright (C) 2005-2018 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#ifndef GCC_DCE_H
#define GCC_DCE_H
extern void run_word_dce (void);
extern void run_fast_dce (void);
extern void run_fast_df_dce (void);
#endif /* GCC_DCE_H */
| {
"pile_set_name": "Github"
} |
include/group_replication.inc
Warnings:
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
[connection server1]
[connection server2]
include/start_and_bootstrap_group_replication.inc
CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
include/assert.inc [Assert that show slave hosts is empty..]
STOP SLAVE SQL_THREAD FOR CHANNEL 'group_replication_applier';
[connection server1]
SET @restore_slave_net_timeout=@@global.slave_net_timeout;
SET @@global.slave_net_timeout=20;
include/start_group_replication.inc
[connection server2]
START SLAVE SQL_THREAD FOR CHANNEL 'group_replication_applier';
[connection server1]
SET @@global.slave_net_timeout=@restore_slave_net_timeout;
DROP TABLE t1;
include/group_replication_end.inc
| {
"pile_set_name": "Github"
} |
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Web Page Editor Gadget XHTML Style</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Web Page Editor Gadget XHTML Style</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<tr><td>open</td>
<td>${base_url}/foo_module/ListBoxZuite_reset</td><td></td></tr>
<tr><td>assertTextPresent</td>
<td>Reset Successfully.</td><td></td></tr>
<tr><td colspan="3"><b>Set prefered text editor</b></td></tr>
<tr><td>open</td>
<td>${base_url}/portal_preferences/erp5_ui_test_preference/Preference_viewHtmlStyle</td><td></td></tr>
<tr><td>click</td>
<td>//input[@name="field_my_preferred_text_editor" and @value="monaco"]</td><td></td></tr>
<tr><td>clickAndWait</td>
<td>//button[@name='Base_edit:method']</td><td></td></tr>
<tr><td colspan="3"><b>Edit a web page</b></td></tr>
<tr><td>selectAndWait</td>
<td>select_module</td>
<td>Web Pages</td></tr>
<tr><td>selectAndWait</td>
<td>select_action</td>
<td>Add Web Page</td></tr>
<tr><td>click</td>
<td>//div[@class="actions"]//span[text() = "Edit"]</td><td></td></tr>
<tr><td colspan="3"><b>Wait for editor to be loaded</b></td></tr>
<tr><td>waitForElementPresent</td>
<td>//div[@data-gadget-editable="field_my_text_content"]//iframe</td><td></td></tr>
<tr><td>selectFrame</td>
<td>//div[@data-gadget-editable="field_my_text_content"]//iframe</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>css=div.monaco-editor.vs</td><td></td></tr>
<tr><td colspan="3"><b>Edit page content</b></td></tr>
<tr><td>storeEval</td>
<td>selenium.browserbot.getCurrentWindow().document.querySelector('div.monaco-editor.vs').getAttribute('data-uri')</td>
<td>model-data-uri</td></tr>
<tr><td>assertEval</td>
<td>selenium.browserbot.getCurrentWindow().monaco.editor.getModel(storedVars['model-data-uri']).setValue("Hello")</td>
<td>null</td></tr>
<tr><td>selectFrame</td>
<td>relative=top</td><td></td></tr>
<tr><td>clickAndWait</td>
<td>//button[@name='Base_edit:method']</td><td></td></tr>
<tr><td colspan="3"><b>Check that our edition is reflected on preview</b></td></tr>
<tr><td>click</td>
<td>//div[@class="actions"]//span[text() = "View"]</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>css=.bottom iframe</td><td></td></tr>
<tr><td>selectFrame</td>
<td>css=.bottom iframe</td><td></td></tr>
<tr><td>waitForText</td>
<td>//body</td>
<td>glob:1*Hello*</td></tr>
<tr><td>selectFrame</td>
<td>relative=top</td><td></td></tr>
</tbody></table>
</body>
</html> | {
"pile_set_name": "Github"
} |
.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.40)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
. if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{\
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "UI_CREATE_METHOD 3"
.TH UI_CREATE_METHOD 3 "2020-04-21" "1.1.1g" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
UI_METHOD, UI_create_method, UI_destroy_method, UI_method_set_opener, UI_method_set_writer, UI_method_set_flusher, UI_method_set_reader, UI_method_set_closer, UI_method_set_data_duplicator, UI_method_set_prompt_constructor, UI_method_set_ex_data, UI_method_get_opener, UI_method_get_writer, UI_method_get_flusher, UI_method_get_reader, UI_method_get_closer, UI_method_get_data_duplicator, UI_method_get_data_destructor, UI_method_get_prompt_constructor, UI_method_get_ex_data \- user interface method creation and destruction
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 1
\& #include <openssl/ui.h>
\&
\& typedef struct ui_method_st UI_METHOD;
\&
\& UI_METHOD *UI_create_method(const char *name);
\& void UI_destroy_method(UI_METHOD *ui_method);
\& int UI_method_set_opener(UI_METHOD *method, int (*opener) (UI *ui));
\& int UI_method_set_writer(UI_METHOD *method,
\& int (*writer) (UI *ui, UI_STRING *uis));
\& int UI_method_set_flusher(UI_METHOD *method, int (*flusher) (UI *ui));
\& int UI_method_set_reader(UI_METHOD *method,
\& int (*reader) (UI *ui, UI_STRING *uis));
\& int UI_method_set_closer(UI_METHOD *method, int (*closer) (UI *ui));
\& int UI_method_set_data_duplicator(UI_METHOD *method,
\& void *(*duplicator) (UI *ui, void *ui_data),
\& void (*destructor)(UI *ui, void *ui_data));
\& int UI_method_set_prompt_constructor(UI_METHOD *method,
\& char *(*prompt_constructor) (UI *ui,
\& const char
\& *object_desc,
\& const char
\& *object_name));
\& int UI_method_set_ex_data(UI_METHOD *method, int idx, void *data);
\& int (*UI_method_get_opener(const UI_METHOD *method)) (UI *);
\& int (*UI_method_get_writer(const UI_METHOD *method)) (UI *, UI_STRING *);
\& int (*UI_method_get_flusher(const UI_METHOD *method)) (UI *);
\& int (*UI_method_get_reader(const UI_METHOD *method)) (UI *, UI_STRING *);
\& int (*UI_method_get_closer(const UI_METHOD *method)) (UI *);
\& char *(*UI_method_get_prompt_constructor(const UI_METHOD *method))
\& (UI *, const char *, const char *);
\& void *(*UI_method_get_data_duplicator(const UI_METHOD *method)) (UI *, void *);
\& void (*UI_method_get_data_destructor(const UI_METHOD *method)) (UI *, void *);
\& const void *UI_method_get_ex_data(const UI_METHOD *method, int idx);
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
A method contains a few functions that implement the low level of the
User Interface.
These functions are:
.IP "an opener" 4
.IX Item "an opener"
This function takes a reference to a \s-1UI\s0 and starts a session, for
example by opening a channel to a tty, or by creating a dialog box.
.IP "a writer" 4
.IX Item "a writer"
This function takes a reference to a \s-1UI\s0 and a \s-1UI\s0 String, and writes
the string where appropriate, maybe to the tty, maybe added as a field
label in a dialog box.
Note that this gets fed all strings associated with a \s-1UI,\s0 one after
the other, so care must be taken which ones it actually uses.
.IP "a flusher" 4
.IX Item "a flusher"
This function takes a reference to a \s-1UI,\s0 and flushes everything that
has been output so far.
For example, if the method builds up a dialog box, this can be used to
actually display it and accepting input ended with a pressed button.
.IP "a reader" 4
.IX Item "a reader"
This function takes a reference to a \s-1UI\s0 and a \s-1UI\s0 string and reads off
the given prompt, maybe from the tty, maybe from a field in a dialog
box.
Note that this gets fed all strings associated with a \s-1UI,\s0 one after
the other, so care must be taken which ones it actually uses.
.IP "a closer" 4
.IX Item "a closer"
This function takes a reference to a \s-1UI,\s0 and closes the session, maybe
by closing the channel to the tty, maybe by destroying a dialog box.
.PP
All of these functions are expected to return 0 on error, 1 on
success, or \-1 on out-off-band events, for example if some prompting
has been cancelled (by pressing Ctrl-C, for example).
Only the flusher or the reader are expected to return \-1.
If returned by another of the functions, it's treated as if 0 was
returned.
.PP
Regarding the writer and the reader, don't assume the former should
only write and don't assume the latter should only read.
This depends on the needs of the method.
.PP
For example, a typical tty reader wouldn't write the prompts in the
write, but would rather do so in the reader, because of the sequential
nature of prompting on a tty.
This is how the \fBUI_OpenSSL()\fR method does it.
.PP
In contrast, a method that builds up a dialog box would add all prompt
text in the writer, have all input read in the flusher and store the
results in some temporary buffer, and finally have the reader just
fetch those results.
.PP
The central function that uses these method functions is \fBUI_process()\fR,
and it does it in five steps:
.IP "1." 4
Open the session using the opener function if that one's defined.
If an error occurs, jump to 5.
.IP "2." 4
For every \s-1UI\s0 String associated with the \s-1UI,\s0 call the writer function
if that one's defined.
If an error occurs, jump to 5.
.IP "3." 4
Flush everything using the flusher function if that one's defined.
If an error occurs, jump to 5.
.IP "4." 4
For every \s-1UI\s0 String associated with the \s-1UI,\s0 call the reader function
if that one's defined.
If an error occurs, jump to 5.
.IP "5." 4
Close the session using the closer function if that one's defined.
.PP
\&\fBUI_create_method()\fR creates a new \s-1UI\s0 method with a given \fBname\fR.
.PP
\&\fBUI_destroy_method()\fR destroys the given \s-1UI\s0 method \fBui_method\fR.
.PP
\&\fBUI_method_set_opener()\fR, \fBUI_method_set_writer()\fR,
\&\fBUI_method_set_flusher()\fR, \fBUI_method_set_reader()\fR and
\&\fBUI_method_set_closer()\fR set the five main method function to the given
function pointer.
.PP
\&\fBUI_method_set_data_duplicator()\fR sets the user data duplicator and destructor.
See \fBUI_dup_user_data\fR\|(3).
.PP
\&\fBUI_method_set_prompt_constructor()\fR sets the prompt constructor.
See \fBUI_construct_prompt\fR\|(3).
.PP
\&\fBUI_method_set_ex_data()\fR sets application specific data with a given
\&\s-1EX_DATA\s0 index.
See \fBCRYPTO_get_ex_new_index\fR\|(3) for general information on how to
get that index.
.PP
\&\fBUI_method_get_opener()\fR, \fBUI_method_get_writer()\fR,
\&\fBUI_method_get_flusher()\fR, \fBUI_method_get_reader()\fR,
\&\fBUI_method_get_closer()\fR, \fBUI_method_get_data_duplicator()\fR,
\&\fBUI_method_get_data_destructor()\fR and \fBUI_method_get_prompt_constructor()\fR
return the different method functions.
.PP
\&\fBUI_method_get_ex_data()\fR returns the application data previously stored
with \fBUI_method_set_ex_data()\fR.
.SH "RETURN VALUES"
.IX Header "RETURN VALUES"
\&\fBUI_create_method()\fR returns a \s-1UI_METHOD\s0 pointer on success, \s-1NULL\s0 on
error.
.PP
\&\fBUI_method_set_opener()\fR, \fBUI_method_set_writer()\fR,
\&\fBUI_method_set_flusher()\fR, \fBUI_method_set_reader()\fR,
\&\fBUI_method_set_closer()\fR, \fBUI_method_set_data_duplicator()\fR and
\&\fBUI_method_set_prompt_constructor()\fR
return 0 on success, \-1 if the given \fBmethod\fR is \s-1NULL.\s0
.PP
\&\fBUI_method_set_ex_data()\fR returns 1 on success and 0 on error (because
\&\fBCRYPTO_set_ex_data()\fR does so).
.PP
\&\fBUI_method_get_opener()\fR, \fBUI_method_get_writer()\fR,
\&\fBUI_method_get_flusher()\fR, \fBUI_method_get_reader()\fR,
\&\fBUI_method_get_closer()\fR, \fBUI_method_get_data_duplicator()\fR,
\&\fBUI_method_get_data_destructor()\fR and \fBUI_method_get_prompt_constructor()\fR
return the requested function pointer if it's set in the method,
otherwise \s-1NULL.\s0
.PP
\&\fBUI_method_get_ex_data()\fR returns a pointer to the application specific
data associated with the method.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\s-1\fBUI\s0\fR\|(3), \fBCRYPTO_get_ex_data\fR\|(3), \s-1\fBUI_STRING\s0\fR\|(3)
.SH "HISTORY"
.IX Header "HISTORY"
The \fBUI_method_set_data_duplicator()\fR, \fBUI_method_get_data_duplicator()\fR
and \fBUI_method_get_data_destructor()\fR functions were added in OpenSSL 1.1.1.
.SH "COPYRIGHT"
.IX Header "COPYRIGHT"
Copyright 2001\-2016 The OpenSSL Project Authors. All Rights Reserved.
.PP
Licensed under the OpenSSL license (the \*(L"License\*(R"). You may not use
this file except in compliance with the License. You can obtain a copy
in the file \s-1LICENSE\s0 in the source distribution or at
<https://www.openssl.org/source/license.html>.
| {
"pile_set_name": "Github"
} |
/**
* Copyright (C) 2015 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.fabric8.openshift.examples;
import io.fabric8.kubernetes.client.DefaultKubernetesClient;
import io.fabric8.kubernetes.client.KubernetesClient;
import io.fabric8.openshift.client.OpenShiftClient;
public class AdaptClient {
public static void main(String[] args) {
KubernetesClient client = new DefaultKubernetesClient();
OpenShiftClient oclient = client.adapt(OpenShiftClient.class);
System.out.println("Adapted to an openshift client: " + oclient);
}
}
| {
"pile_set_name": "Github"
} |
#!/usr/bin/env python3
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Copyright 2010 California Institute of Technology. ALL RIGHTS RESERVED.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# United States Government Sponsorship acknowledged. This software is subject to
# U.S. export control laws and regulations and has been classified as 'EAR99 NLR'
# (No [Export] License Required except when exporting to an embargoed country,
# end user, or in support of a prohibited end use). By downloading this software,
# the user agrees to comply with all applicable U.S. export laws and regulations.
# The user has the responsibility to obtain export licenses, or other export
# authority as may be required before exporting this software to any 'EAR99'
# embargoed foreign country or citizen of those countries.
#
# Author: Walter Szeliga
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
from isce import logging
from isceobj.Sensor.ERS import ERS
from isceobj.Scene.Track import Track
logger = logging.getLogger("testTrack")
def main():
output = 'test.raw'
frame1 = createERSFrame(leaderFile='/Users/szeliga/data/InSAR/raw/ers/track134/frame2961/930913/SARLEADER199309132961f134t',
imageryFile='/Users/szeliga/data/InSAR/raw/ers/track134/frame2961/930913/IMAGERY199309132961f134t',
output='frame2961.raw')
frame2 = createERSFrame(leaderFile='/Users/szeliga/data/InSAR/raw/ers/track134/frame2979/930913/SARLEADER199309132979f134t',
imageryFile='/Users/szeliga/data/InSAR/raw/ers/track134/frame2979/930913/IMAGERY199309132979f134t',
output='frame2979.raw')
track = Track()
track.addFrame(frame1)
track.addFrame(frame2)
track.createTrack(output)
def createERSFrame(leaderFile=None,imageryFile=None,output=None):
logger.info("Extracting ERS frame %s" % leaderFile)
ers = ERS()
ers._leaderFile = leaderFile
ers._imageFile = imageryFile
ers.output = output
ers.extractImage()
return ers.getFrame()
if __name__ == "__main__":
main()
| {
"pile_set_name": "Github"
} |
from torch import nn
import torch
from reproduction.sequence_labelling.cws.model.module import FeatureFunMax, SemiCRFShiftRelay
from fastNLP.modules import LSTM
class ShiftRelayCWSModel(nn.Module):
"""
该模型可以用于进行分词操作
包含两个方法,
forward(chars, bigrams, seq_len) -> {'loss': batch_size,}
predict(chars, bigrams) -> {'pred': batch_size x max_len, 'pred_mask': batch_size x max_len}
pred是对当前segment的长度预测,pred_mask是仅在有预测的位置为1
:param char_embed: 预训练的Embedding或者embedding的shape
:param bigram_embed: 预训练的Embedding或者embedding的shape
:param hidden_size: LSTM的隐藏层大小
:param num_layers: LSTM的层数
:param L: SemiCRFShiftRelay的segment大小
:param num_bigram_per_char: 每个character对应的bigram的数量
:param drop_p: Dropout的大小
"""
def __init__(self, char_embed, bigram_embed, hidden_size:int=400, num_layers:int=1, L:int=6, drop_p:float=0.2):
super().__init__()
self.char_embedding = char_embed
self.bigram_embedding = bigram_embed
self.lstm = LSTM(char_embed.embed_size+bigram_embed.embed_size, hidden_size // 2, num_layers=num_layers,
bidirectional=True,
batch_first=True)
self.feature_fn = FeatureFunMax(hidden_size, L)
self.semi_crf_relay = SemiCRFShiftRelay(L)
self.feat_drop = nn.Dropout(drop_p)
self.reset_param()
def reset_param(self):
for name, param in self.named_parameters():
if 'embedding' in name:
continue
if 'bias_hh' in name:
nn.init.constant_(param, 0)
elif 'bias_ih' in name:
nn.init.constant_(param, 1)
elif len(param.size()) < 2:
nn.init.uniform_(param, -0.1, 0.1)
else:
nn.init.xavier_uniform_(param)
def get_feats(self, chars, bigrams, seq_len):
chars = self.char_embedding(chars)
bigrams = self.bigram_embedding(bigrams)
chars = torch.cat([chars, bigrams], dim=-1)
feats, _ = self.lstm(chars, seq_len)
feats = self.feat_drop(feats)
logits, relay_logits = self.feature_fn(feats)
return logits, relay_logits
def forward(self, chars, bigrams, relay_target, relay_mask, end_seg_mask, seq_len):
logits, relay_logits = self.get_feats(chars, bigrams, seq_len)
loss = self.semi_crf_relay(logits, relay_logits, relay_target, relay_mask, end_seg_mask, seq_len)
return {'loss':loss}
def predict(self, chars, bigrams, seq_len):
logits, relay_logits = self.get_feats(chars, bigrams, seq_len)
pred, pred_mask = self.semi_crf_relay.predict(logits, relay_logits, seq_len)
return {'pred': pred, 'pred_mask': pred_mask}
| {
"pile_set_name": "Github"
} |
sha256:a163ff5dbf71b3970db7b500870c950fc782a065d05578102008395ce446539c
| {
"pile_set_name": "Github"
} |
//
// Created by Jesse Squires
// http://www.jessesquires.com
//
//
// Documentation
// http://cocoadocs.org/docsets/JSQMessagesViewController
//
//
// GitHub
// https://github.com/jessesquires/JSQMessagesViewController
//
//
// License
// Copyright (c) 2014 Jesse Squires
// Released under an MIT license: http://opensource.org/licenses/MIT
//
// ********************************
// Special thanks to the localization contributors!
//
// https://github.com/jessesquires/JSQMessagesViewController/issues/237
// ********************************
"load_earlier_messages" = "Ältere Nachrichten laden";
"send" = "Senden";
"new_message" = "Neue Nachricht";
"text_message_accessibility_label" = "%@: %@";
"media_message_accessibility_label" = "%@: media Nachricht";
"accessory_button_accessibility_label" = "Aktien media";
"new_message_received_accessibility_announcement" = "Neue Nachricht empfangen";
| {
"pile_set_name": "Github"
} |
#include "roi_align_rotated_gradient_op.h"
#include "caffe2/utils/eigen_utils.h"
#include "caffe2/utils/math.h"
namespace caffe2 {
// Input: X, rois, dY (aka "gradOutput");
// Output: dX (aka "gradInput")
OPERATOR_SCHEMA(RoIAlignRotatedGradient)
.NumInputs(3)
.NumOutputs(1)
.Input(0, "X", "See RoIAlignRotated.")
.Input(1, "RoIs", "See RoIAlignRotated.")
.Input(2, "dY", "Gradient of forward output 0 (Y)")
.Output(0, "dX", "Gradient of forward input 0 (X)");
namespace {
class GetRoIAlignRotatedGradient : public GradientMakerBase {
using GradientMakerBase::GradientMakerBase;
vector<OperatorDef> GetGradientDefs() override {
return SingleGradientDef(
"RoIAlignRotatedGradient",
"",
vector<string>{I(0), I(1), GO(0)},
vector<string>{GI(0)});
}
};
} // namespace
REGISTER_GRADIENT(RoIAlignRotated, GetRoIAlignRotatedGradient);
} // namespace caffe2
| {
"pile_set_name": "Github"
} |
using System;
using System.Collections.Generic;
using System.Text;
namespace MyHealth.Client.iOS
{
public class ShortcutHelper
{
/// <summary>
/// https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UIApplicationShortcutIcon_Class/#//apple_ref/c/tdef/UIApplicationShortcutIconType
/// </summary>
public static class ShortcutIdentifiers
{
public const string Appointments = "com.your-company.MyHealth.Client.iOS.Appointments";
public const string Treatments = "com.your-company.MyHealth.Client.iOS.Treatments";
public const string User = "com.your-company.MyHealth.Client.iOS.User";
}
}
}
| {
"pile_set_name": "Github"
} |
! Copyright (C) 2006 Imperial College London and others.
!
! Please see the AUTHORS file in the main source directory for a full list
! of copyright holders.
!
! Prof. C Pain
! Applied Modelling and Computation Group
! Department of Earth Science and Engineering
! Imperial College London
!
! [email protected]
!
! This library is free software; you can redistribute it and/or
! modify it under the terms of the GNU Lesser General Public
! License as published by the Free Software Foundation,
! version 2.1 of the License.
!
! This library is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied arranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
! Lesser General Public License for more details.
!
! You should have received a copy of the GNU Lesser General Public
! License along with this library; if not, write to the Free Software
! Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
! USA
#include "fdebug.h"
module gls
use global_parameters, only: OPTION_PATH_LEN, FIELD_NAME_LEN
use fldebug
use quadrature
use elements
use spud
use sparse_tools
use fetools
use fields
use state_module
use boundary_conditions
use field_derivatives
use sparse_matrices_fields
use fefields
use state_fields_module
use equation_of_state
use coordinates
use vertical_extrapolation_module
implicit none
private
! These variables are the parameters requried by GLS.
! They are all private to prevent tampering
! and save'd so that we don't need to call init every time some GLS-y
! happens. These are *all* private
real, save :: gls_n, gls_m, gls_p
real, save :: sigma_psi, sigma_k, kappa
integer, save :: nNodes
type(scalar_field), save :: tke_old, ll
type(scalar_field), save :: local_tke ! our local copy of TKE. We amend this
!to add the values of the Dirichlet BC onto the field for calculating the
!diagnostic quantities and for output. See Warner et al 2005.
type(scalar_field), save :: MM2, NN2, eps, Fwall, S_H, S_M
type(scalar_field), save :: K_H, K_M, density, P, B
real, save :: eps_min = 1e-10, psi_min, k_min
real, save :: cm0, cde
! the a_i's for the ASM
real, save :: a1,a2,a3,a4,a5
real, save :: at1,at2,at3,at4,at5
real, save :: cc1
real, save :: ct1,ctt
real, save :: cc2,cc3,cc4,cc5,cc6
real, save :: ct2,ct3,ct4,ct5
real, save :: cPsi1,cPsi2,cPsi3,cPsi3_plus,cPsi3_minus
real, save :: relaxation
! these are the fields and variables for the surface values
type(scalar_field), save :: top_surface_values, bottom_surface_values ! these are used to populate the bcs
type(scalar_field), save :: top_surface_tke_values, bottom_surface_tke_values ! for the Psi BC
type(scalar_field), save :: top_surface_km_values, bottom_surface_km_values ! for the Psi BC
integer, save :: NNodes_sur, NNodes_bot
integer, dimension(:), pointer, save :: bottom_surface_nodes, top_surface_nodes
integer, dimension(:), pointer, save :: top_surface_element_list, bottom_surface_element_list
logical, save :: calculate_bcs, calc_fwall
character(len=FIELD_NAME_LEN), save :: gls_wall_option, gls_stability_option, gls_option
! Switch for on sphere simulations to rotate the required tensors
logical, save :: on_sphere
! The following are the public subroutines
public :: gls_init, gls_cleanup, gls_tke, gls_diffusivity, gls_psi, gls_adapt_mesh, gls_check_options
! General plan is:
! - Init in main/Fluids.F90
! - Populate_State and BoundaryConditionsFromOptions also contain some set up
! routines such as looking for the GLS fields and setting up the automatic
! boundary conditions
! - If solve is about to do TKE, call gls_tke (which calculates NN, MM and set source/absorption for solve)
! - If solve is about to do Psi, call gls_psi (which fixes TKE surfaces, set source/absorption for solve)
! - After Psi solve, call gls_diffusivity, which sets the diffusivity and viscosity, via the lengthscale
! - If we adapt, call gls_adapt, which deallocates and re-allocates the
! fields on the new mesh. This also sets up the diagnostic fields again,
! which aren't interpolated
! - When done, clean-up
contains
!----------
! gls_init does the following:
! - check we have the right fields (if not abort)
! - initialise GLS parameters based on options
! - allocate space for optional fields, which are module level variables (to save passing them around)
!----------
subroutine gls_init(state)
type(state_type), intent(inout) :: state
real :: N,rad,rcm,cmsf
integer :: stat
type(scalar_field), pointer :: psi, tke
psi => extract_scalar_field(state, "GLSGenericSecondQuantity")
tke => extract_scalar_field(state, "GLSTurbulentKineticEnergy")
! Allocate the temporary, module-level variables
call gls_allocate_temps(state)
! Check if we're on the sphere
on_sphere = have_option('/geometry/spherical_earth/')
! populate some useful variables from options
calculate_bcs = have_option("/material_phase[0]/subgridscale_parameterisations/GLS/calculate_boundaries/")
calc_fwall = .false.
call get_option("/material_phase[0]/subgridscale_parameterisations/GLS/&
&scalar_field::GLSTurbulentKineticEnergy/prognostic/minimum_value", k_min, stat)
! these lot are global
call get_option("/material_phase[0]/subgridscale_parameterisations/GLS/relax_diffusivity", relaxation, default=0.0)
call get_option("/material_phase[0]/subgridscale_parameterisations/GLS/stability_function", gls_stability_option)
call get_option("/material_phase[0]/subgridscale_parameterisations/GLS/option", gls_option)
! there are lots of alternative formulae for this wall function, so let the
! user choose!
if (have_option("/material_phase[0]/subgridscale_parameterisations/GLS/wall_function")) then
call get_option("/material_phase[0]/subgridscale_parameterisations/GLS/wall_function",gls_wall_option)
else
gls_wall_option = "none"
end if
! Check the model used - we have four choices - then set the parameters appropriately
select case (gls_option)
case ("k-kl") ! Mellor-Yamada 2.5
gls_p = 0.0
gls_m = 1.0
gls_n = 1.0
sigma_k = 2.44 ! turbinent Schmidt number
sigma_psi = 2.44 ! turbulent Schmidt number
cPsi1 = 0.9
cPsi2 = 0.5
cPsi3_plus = 1.0
! c3 depends on which stability function has been choosen
select case (trim(gls_stability_option))
case ("KanthaClayson-94")
cPsi3_minus = 2.53
case ("Canuto-01-A")
cPsi3_minus = 2.681
case ("Canuto-01-B")
FLExit("GLS - Stability function combination not supported")
case ("GibsonLaunder-78")
FLExit("GLS - Stability function combination not supported")
end select
psi_min = 1.e-8
calc_fwall = .true.
case ("k-epsilon")
gls_p = 3.0
gls_m = 1.5
gls_n = -1.0
sigma_k = 1.3 ! turbulent Schmidt number
sigma_psi = 1.0 ! turbulent Schmidt number
cPsi1 = 1.44
cPsi2 = 1.92
cPsi3_plus = 1.0
select case (trim(gls_stability_option))
case ("KanthaClayson-94")
cPsi3_minus = -0.41
case ("Canuto-01-A")
cPsi3_minus = -0.63
case ("Canuto-01-B")
cPsi3_minus = -0.57
case ("GibsonLaunder-78")
cPsi3_minus = -0.3700
end select
psi_min = 1.e-12
case ("k-omega")
gls_p = -1.0
gls_m = 0.5
gls_n = -1.0
sigma_k = 2.0 ! turbulent Schmidt number
sigma_psi = 2.0 ! turbulent Schmidt number
cPsi1 = 0.555
cPsi2 = 0.833
cPsi3_plus = 1.0
select case (trim(gls_stability_option))
case ("KanthaClayson-94")
cPsi3_minus = -0.58
case ("Canuto-01-A")
cPsi3_minus = -0.64
case ("Canuto-01-B")
cPsi3_minus = -0.61
case ("GibsonLaunder-78")
cPsi3_minus = -0.4920
end select
psi_min = 1.e-12
case ("gen")
gls_p = 2.0
gls_m = 1.0
gls_n = -0.67
sigma_k = 0.8 ! turbulent Schmidt number
sigma_psi = 1.07 ! turbulent Schmidt number
cPsi1 = 1.0
cPsi2 = 1.22
cPsi3_plus = 1.0
select case (trim(gls_stability_option))
case ("KanthaClayson-94")
cPsi3_minus = 0.1
case ("Canuto-01-A")
cPsi3_minus = 0.05
case ("Canuto-01-B")
cPsi3_minus = 0.08
case ("GibsonLaunder-78")
cPsi3_minus = 0.1704
end select
psi_min = 1.e-12
case default
FLAbort("Unknown gls_option")
end select
select case (trim(gls_stability_option))
case ("KanthaClayson-94")
! parameters for Kantha and Clayson (2004)
cc1 = 6.0000
cc2 = 0.3200
cc3 = 0.0000
cc4 = 0.0000
cc5 = 0.0000
cc6 = 0.0000
ct1 = 3.7280
ct2 = 0.7000
ct3 = 0.7000
ct4 = 0.0000
ct5 = 0.2000
ctt = 0.6102
case("Canuto-01-B")
cc1 = 5.0000
cc2 = 0.6983
cc3 = 1.9664
cc4 = 1.0940
cc5 = 0.0000
cc6 = 0.4950
ct1 = 5.6000
ct2 = 0.6000
ct3 = 1.0000
ct4 = 0.0000
ct5 = 0.3333
ctt = 0.4770
case("Canuto-01-A")
cc1 = 5.0000
cc2 = 0.8000
cc3 = 1.9680
cc4 = 1.1360
cc5 = 0.0000
cc6 = 0.4000
ct1 = 5.9500
ct2 = 0.6000
ct3 = 1.0000
ct4 = 0.0000
ct5 = 0.3333
ctt = 0.720
case("GibsonLaunder-78")
cc1 = 3.6000
cc2 = 0.8000
cc3 = 1.2000
cc4 = 1.2000
cc5 = 0.0000
cc6 = 0.5000
ct1 = 3.0000
ct2 = 0.3333
ct3 = 0.3333
ct4 = 0.0000
ct5 = 0.3333
ctt = 0.8000
case default
FLAbort("Unknown gls_stability_function")
end select
! compute the a_i's for the Algebraic Stress Model
a1 = 2./3. - cc2/2.
a2 = 1. - cc3/2.
a3 = 1. - cc4/2.
a4 = cc5/2.
a5 = 1./2. - cc6/2.
at1 = 1. - ct2
at2 = 1. - ct3
at3 = 2. * ( 1. - ct4)
at4 = 2. * ( 1. - ct5)
at5 = 2.*ctt*( 1. - ct5)
! compute cm0
N = cc1/2.
cm0 = ( (a2**2. - 3.*a3**2. + 3.*a1*N)/(3.* N**2.) )**0.25
cmsf = a1/N/cm0**3
rad=sigma_psi*(cPsi2-cPsi1)/(gls_n**2.)
kappa = 0.41
if (gls_option .ne. "k-kl") then
kappa=cm0*sqrt(rad)
end if
rcm = cm0/cmsf
cde = cm0**3.
ewrite(1,*) "GLS Parameters"
ewrite(1,*) "--------------------------------------------"
ewrite(1,*) "cm0: ",cm0
ewrite(1,*) "kappa: ",kappa
ewrite(1,*) "p: ",gls_p
ewrite(1,*) "m: ",gls_m
ewrite(1,*) "n: ",gls_n
ewrite(1,*) "sigma_k: ",sigma_k
ewrite(1,*) "sigma_psi: ",sigma_psi
ewrite(1,*) "Calculating BCs: ", calculate_bcs
ewrite(1,*) "Using wall function: ", gls_wall_option
ewrite(1,*) "Smoothing NN2: ", have_option('/material_phase[0]/subgridscale_parameterisations/GLS/smooth_buoyancy/')
ewrite(1,*) "Smoothing MM2: ", have_option('/material_phase[0]/subgridscale_parameterisations/GLS/smooth_shear/')
ewrite(1,*) "--------------------------------------------"
! intilise surface - only if we need to though
if (calculate_bcs) then
call gls_init_surfaces(state)
end if
call gls_init_diagnostics(state)
call gls_calc_wall_function(state)
! we're all done!
end subroutine gls_init
!----------
! Update TKE
!----------
subroutine gls_tke(state)
type(state_type), intent(inout) :: state
type(scalar_field), pointer :: source, absorption, scalarField
type(tensor_field), pointer :: tke_diff, background_diff
type(scalar_field), pointer :: tke
real :: prod, buoyan, diss
integer :: i, stat, ele
character(len=FIELD_NAME_LEN) :: bc_type
type(scalar_field), pointer :: scalar_surface
type(vector_field), pointer :: positions
type(scalar_field), pointer :: lumped_mass
type(scalar_field) :: inverse_lumped_mass
! Temporary tensor to hold rotated values if on the sphere (note: must be a 3x3 mat)
real, dimension(3,3) :: K_M_sphere_node
ewrite(1,*) "In gls_tke"
! Get N^2 and M^2 -> NN2 and MM2
call gls_buoyancy(state)
do i=1,NNodes_sur
call set(NN2,top_surface_nodes(i),0.0)
end do
! calculate stability function
call gls_stability_function(state)
source => extract_scalar_field(state, "GLSTurbulentKineticEnergySource")
absorption => extract_scalar_field(state, "GLSTurbulentKineticEnergyAbsorption")
tke => extract_scalar_field(state, "GLSTurbulentKineticEnergy")
tke_diff => extract_tensor_field(state, "GLSTurbulentKineticEnergyDiffusivity")
positions => extract_vector_field(state, "Coordinate")
! Create a local_tke in which we can mess about with the surface values
! for creating some of the diagnostic values later
call set(tke,local_tke)
! Assembly loop
call zero(P)
call zero(B)
call allocate(inverse_lumped_mass, P%mesh, "InverseLumpedMass")
lumped_mass => get_lumped_mass(state, P%mesh)
call invert(lumped_mass, inverse_lumped_mass)
! create production terms, P, B
do ele=1, ele_count(P)
call assemble_tke_prodcution_terms(ele, P, B, mesh_dim(P))
end do
call scale(P,inverse_lumped_mass)
call scale(B,inverse_lumped_mass)
call deallocate(inverse_lumped_mass)
call zero(source)
call zero(absorption)
do ele = 1, ele_count(tke)
call assemble_kk_src_abs(ele,tke, mesh_dim(tke))
end do
call allocate(inverse_lumped_mass, tke%mesh, "InverseLumpedMass")
lumped_mass => get_lumped_mass(state, tke%mesh)
call invert(lumped_mass, inverse_lumped_mass)
! source and absorption terms are set, apart from the / by lumped mass
call scale(source,inverse_lumped_mass)
call scale(absorption,inverse_lumped_mass)
call deallocate(inverse_lumped_mass)
! set diffusivity for tke
call zero(tke_diff)
background_diff => extract_tensor_field(state, "GLSBackgroundDiffusivity")
if (on_sphere) then
do i=1,nNodes
K_M_sphere_node=align_with_radial(node_val(positions,i),node_val(K_M,i))
K_M_sphere_node=K_M_sphere_node*1./sigma_k
call set(tke_diff,i,K_M_sphere_node)
end do
else
call set(tke_diff,tke_diff%dim(1),tke_diff%dim(2),K_M,scale=1./sigma_k)
end if
call addto(tke_diff,background_diff)
! boundary conditions
if (calculate_bcs) then
ewrite(1,*) "Calculating BCs"
call get_option("/material_phase[0]/subgridscale_parameterisations/GLS/calculate_boundaries/", bc_type)
call gls_tke_bc(state,bc_type)
! above puts the BC boundary values in top_surface_values and bottom_surface_values module level variables
! map these onto the actual BCs in tke
scalar_surface => extract_surface_field(tke, 'tke_bottom_boundary', "value")
call remap_field(bottom_surface_values, scalar_surface)
scalar_surface => extract_surface_field(tke, 'tke_top_boundary', "value")
call remap_field(top_surface_values, scalar_surface)
end if
! finally, we need a copy of the old TKE for Psi, so grab it before we solve
call set(tke_old,tke)
! that's the TKE set up ready for the solve which is the next thing to happen (see Fluids.F90)
ewrite_minmax(source)
ewrite_minmax(absorption)
! set source and absorption terms in optional output fields
scalarField => extract_scalar_field(state, "GLSSource1", stat)
if(stat == 0) then
call set(scalarField,source)
end if
scalarField => extract_scalar_field(state, "GLSAbsorption1", stat)
if(stat == 0) then
call set(scalarField,absorption)
end if
contains
subroutine assemble_tke_prodcution_terms(ele, P, B, dim)
integer, intent(in) :: ele, dim
type(scalar_field), intent(inout) :: P, B
real, dimension(ele_loc(P,ele),ele_ngi(P,ele),dim) :: dshape_P
real, dimension(ele_ngi(P,ele)) :: detwei
real, dimension(ele_loc(P,ele)) :: rhs_addto_vel, rhs_addto_buoy
type(element_type), pointer :: shape_p
integer, pointer, dimension(:) :: nodes_p
nodes_p => ele_nodes(p, ele)
shape_p => ele_shape(p, ele)
call transform_to_physical( positions, ele, shape_p, dshape=dshape_p, detwei=detwei )
! Shear production term:
rhs_addto_vel = shape_rhs(shape_p, detwei*ele_val_at_quad(K_M,ele)*ele_val_at_quad(MM2,ele))
! Buoyancy production term:
rhs_addto_buoy = shape_rhs(shape_p, -detwei*ele_val_at_quad(K_H,ele)*ele_val_at_quad(NN2,ele))
call addto(P, nodes_p, rhs_addto_vel)
call addto(B, nodes_p, rhs_addto_buoy)
end subroutine assemble_tke_prodcution_terms
subroutine assemble_kk_src_abs(ele, kk, dim)
integer, intent(in) :: ele, dim
type(scalar_field), intent(in) :: kk
real, dimension(ele_loc(kk,ele),ele_ngi(kk,ele),dim) :: dshape_kk
real, dimension(ele_ngi(kk,ele)) :: detwei
real, dimension(ele_loc(kk,ele)) :: rhs_addto_disip, rhs_addto_src
type(element_type), pointer :: shape_kk
integer, pointer, dimension(:) :: nodes_kk
nodes_kk => ele_nodes(kk, ele)
shape_kk => ele_shape(kk, ele)
call transform_to_physical( positions, ele, shape_kk, dshape=dshape_kk, detwei=detwei )
! ROMS and GOTM hide the absorption term in the source if the
! total is > 0. Kinda hard to do that over an element (*what* should
! be > 0?). So we don't pull this trick. Doesn't seem to make a
! difference to anything.
rhs_addto_src = shape_rhs(shape_kk, detwei * (&
(ele_val_at_quad(P,ele))) &
)
rhs_addto_disip = shape_rhs(shape_kk, detwei * ( &
(ele_val_at_quad(eps,ele) - &
ele_val_at_quad(B,ele)) / &
ele_val_at_quad(tke,ele)) &
)
call addto(source, nodes_kk, rhs_addto_src)
call addto(absorption, nodes_kk, rhs_addto_disip)
end subroutine assemble_kk_src_abs
end subroutine gls_tke
!----------
! Calculate the second quantity
!----------
subroutine gls_psi(state)
type(state_type), intent(inout) :: state
type(scalar_field), pointer :: source, absorption, tke, psi, scalarField
type(tensor_field), pointer :: psi_diff, background_diff
real :: prod, buoyan,diss,PsiOverTke
character(len=FIELD_NAME_LEN) :: bc_type
integer :: i, stat, ele
type(scalar_field), pointer :: scalar_surface
type(vector_field), pointer :: positions
type(scalar_field), pointer :: lumped_mass
type(scalar_field) :: inverse_lumped_mass, vel_prod, buoy_prod
! variables for the ocean parameterisation
type(csr_matrix) :: face_normal_gravity
integer, dimension(:), allocatable :: ordered_elements
logical, dimension(:), allocatable :: node_list
logical :: got_surface
real :: lengthscale, percentage, tke_surface
type(scalar_field), pointer :: distanceToTop, distanceToBottom
type(vector_field), pointer :: vertical_normal
! Temporary tensor to hold rotated values (note: must be a 3x3 mat)
real, dimension(3,3) :: psi_sphere_node
real :: src, absn
ewrite(1,*) "In gls_psi"
source => extract_scalar_field(state, "GLSGenericSecondQuantitySource")
absorption => extract_scalar_field(state, "GLSGenericSecondQuantityAbsorption")
tke => extract_scalar_field(state, "GLSTurbulentKineticEnergy")
psi => extract_scalar_field(state, "GLSGenericSecondQuantity")
psi_diff => extract_tensor_field(state, "GLSGenericSecondQuantityDiffusivity")
positions => extract_vector_field(state, "Coordinate")
vertical_normal => extract_vector_field(state, "GravityDirection")
call allocate(vel_prod, psi%mesh, "_vel_prod_psi")
call allocate(buoy_prod, psi%mesh, "_buoy_prod_psi")
ewrite(2,*) "In gls_psi: setting up"
! store the tke in an internal field and then
! add the dirichlet conditions to the upper and lower surfaces. This
! helps stabilise the diffusivity (e.g. rapid heating cooling of the surface
! can destabilise the run)
call set(local_tke,tke)
! clip at k_min
do i=1,nNodes
call set(tke,i, max(node_val(tke,i),k_min))
call set(tke_old,i, max(node_val(tke_old,i),k_min))
call set(local_tke,i, max(node_val(local_tke,i),k_min))
end do
! This is the extra term meant to add in internal wave breaking and the
! like. Based on a similar term in NEMO
if (have_option("/material_phase[0]/subgridscale_parameterisations/GLS/ocean_parameterisation")) then
distanceToTop => extract_scalar_field(state, "DistanceToTop")
distanceToBottom => extract_scalar_field(state, "DistanceToBottom")
call get_option("/material_phase[0]/subgridscale_parameterisations/GLS/ocean_parameterisation/lengthscale",lengthscale)
call get_option("/material_phase[0]/subgridscale_parameterisations/GLS/ocean_parameterisation/percentage",percentage)
ewrite(2,*) "Computing extra ocean parameterisation"
allocate(node_list(NNodes))
node_list = .false.
! create gravity face normal
call compute_face_normal_gravity(face_normal_gravity, positions, vertical_normal)
allocate(ordered_elements(size(face_normal_gravity,1)))
! create an element ordering from the mesh that moves vertically downwards
call vertical_element_ordering(ordered_elements, face_normal_gravity)
! I assume the above fails gracefully if the mesh isn't suitable, hence
! no options checks are carried out
got_surface = .false.
do i=1, size(ordered_elements)
if (.not. got_surface) then
! First time around grab, the surface TKE
! for this column
tke_surface = maxval(ele_val(tke,i))
got_surface = .true.
end if
if (got_surface) then
call ocean_tke(i,tke,distanceToTop,lengthscale,percentage,tke_surface, node_list)
end if
if (minval(ele_val(distanceToBottom,i)) < 1e-6) then
got_surface = .false.
end if
end do
deallocate(ordered_elements)
call deallocate(face_normal_gravity)
deallocate(node_list)
end if
call allocate(inverse_lumped_mass, psi%mesh, "InverseLumpedMass")
lumped_mass => get_lumped_mass(state, psi%mesh)
call invert(lumped_mass, inverse_lumped_mass)
! Set Psi from previous timestep
do i=1,nNodes
call set(psi,i, cm0**gls_p * node_val(tke_old,i)**gls_m * node_val(ll,i)**gls_n)
call set(psi,i,max(node_val(psi,i),psi_min))
end do
ewrite(2,*) "In gls_psi: computing RHS"
call zero(vel_prod)
call zero(buoy_prod)
call zero(source)
call zero(absorption)
do ele = 1, ele_count(psi)
call assemble_production_terms_psi(ele, vel_prod, buoy_prod, psi, mesh_dim(psi))
end do
call scale(vel_prod,inverse_lumped_mass)
call scale(buoy_prod,inverse_lumped_mass)
do ele = 1, ele_count(psi)
call assemble_psi_src_abs(ele, psi, tke_old, mesh_dim(psi))
end do
call scale(source,inverse_lumped_mass)
call scale(absorption,inverse_lumped_mass)
call deallocate(inverse_lumped_mass)
ewrite(2,*) "In gls_psi: setting diffusivity"
! Set diffusivity for Psi
call zero(psi_diff)
background_diff => extract_tensor_field(state, "GLSBackgroundDiffusivity")
if (on_sphere) then
do i=1,nNodes
psi_sphere_node=align_with_radial(node_val(positions,i),node_val(K_M,i))
psi_sphere_node=psi_sphere_node*1./sigma_psi
call set(psi_diff,i,psi_sphere_node)
end do
else
call set(psi_diff,psi_diff%dim(1),psi_diff%dim(2),K_M,scale=1./sigma_psi)
end if
call addto(psi_diff,background_diff)
ewrite(2,*) "In gls_psi: setting BCs"
! boundary conditions
if (calculate_bcs) then
call get_option("/material_phase[0]/subgridscale_parameterisations/GLS/calculate_boundaries/", bc_type)
call gls_psi_bc(state,bc_type)
! above puts the BC boundary values in top_surface_values and bottom_surface_values module level variables
! map these onto the actual BCs in Psi
scalar_surface => extract_surface_field(psi, 'psi_bottom_boundary', "value")
call remap_field(bottom_surface_values, scalar_surface)
scalar_surface => extract_surface_field(psi, 'psi_top_boundary', "value")
call remap_field(top_surface_values, scalar_surface)
end if
ewrite(2,*) "In gls_psi: tearing down"
! Psi is now ready for solving (see Fluids.F90)
ewrite_minmax(source)
ewrite_minmax(absorption)
! set source and absorption terms in optional output fields
scalarField => extract_scalar_field(state, "GLSSource2", stat)
if(stat == 0) then
call set(scalarField,source)
end if
scalarField => extract_scalar_field(state, "GLSAbsorption2", stat)
if(stat == 0) then
call set(scalarField,absorption)
end if
call deallocate(vel_prod)
call deallocate(buoy_prod)
contains
subroutine ocean_tke(ele, tke, distanceToTop, lengthscale, percentage, tke_surface, nodes_done)
type(scalar_field),pointer, intent(in) :: distanceToTop
type(scalar_field),pointer, intent(out) :: tke
real, intent(in) :: lengthscale, percentage, tke_surface
integer, intent(in) :: ele
logical, dimension(:), intent(inout) :: nodes_done
integer, dimension(:), pointer :: element_nodes
integer :: i, node
real :: current_TKE, depth
element_nodes => ele_nodes(tke, ele)
! smooth out TKE according to length scale
do i = 1, size(element_nodes)
node = element_nodes(i)
depth = node_val(distanceToTop,node)
current_TKE = node_val(tke,node)
if (nodes_done(node)) then
cycle
end if
current_TKE = current_TKE + &
& percentage*TKE_surface * EXP( -depth / lengthscale )
call set(tke,node,current_TKE)
nodes_done(node) = .true.
end do
end subroutine ocean_tke
subroutine reconstruct_psi(ele, psi, dim)
integer, intent(in) :: ele, dim
type(scalar_field), intent(inout) :: psi
real, dimension(ele_loc(psi,ele),ele_ngi(psi,ele),dim) :: dshape_psi
real, dimension(ele_ngi(psi,ele)) :: detwei
real, dimension(ele_loc(psi,ele)) :: rhs_addto
type(element_type), pointer :: shape_psi
integer, pointer, dimension(:) :: nodes_psi
nodes_psi => ele_nodes(psi, ele)
shape_psi => ele_shape(psi, ele)
call transform_to_physical( positions, ele, shape_psi, dshape=dshape_psi, detwei=detwei )
rhs_addto = shape_rhs(shape_psi, detwei* &
(cm0**gls_p) * &
ele_val_at_quad(tke_old,ele)**gls_m * &
ele_val_at_quad(ll,ele)**gls_n)
call addto(psi, nodes_psi, rhs_addto)
end subroutine reconstruct_psi
subroutine assemble_production_terms_psi(ele, vel_prod, buoy_prod, psi, dim)
integer, intent(in) :: ele, dim
type(scalar_field), intent(inout) :: psi, vel_prod, buoy_prod
real, dimension(ele_loc(psi,ele),ele_ngi(psi,ele),dim) :: dshape_psi
real, dimension(ele_ngi(psi,ele)) :: detwei
real, dimension(ele_loc(psi,ele)) :: rhs_addto_vel, rhs_addto_buoy
real, dimension(ele_ngi(psi,ele)) :: cPsi3
type(element_type), pointer :: shape_psi
integer, pointer, dimension(:) :: nodes_psi
nodes_psi => ele_nodes(psi, ele)
shape_psi => ele_shape(psi, ele)
call transform_to_physical( positions, ele, shape_psi, dshape=dshape_psi, detwei=detwei )
! Buoyancy production term:
! First we need to work out if cPsi3 is for stable or unstable
! stratification
where(ele_val_at_quad(B,ele) .gt. 0.0)
cPsi3 = cPsi3_plus ! unstable strat
elsewhere
cPsi3 = cPsi3_minus ! stable strat
end where
rhs_addto_buoy = shape_rhs(shape_psi, detwei*(cPsi3*ele_val_at_quad(B,ele)*&
(ele_val_at_quad(psi, ele)/ele_val_at_quad(local_tke,ele))))
! shear production term:
rhs_addto_vel = shape_rhs(shape_psi, detwei*(cPsi1*ele_val_at_quad(P,ele)*&
(ele_val_at_quad(psi, ele)/ele_val_at_quad(local_tke,ele))))
call addto(vel_prod, nodes_psi, rhs_addto_vel)
call addto(buoy_prod, nodes_psi, rhs_addto_buoy)
end subroutine assemble_production_terms_psi
subroutine assemble_psi_src_abs(ele, psi, tke, dim)
integer, intent(in) :: ele, dim
type(scalar_field), intent(in) :: psi, tke
real, dimension(ele_loc(psi,ele),ele_ngi(psi,ele),dim) :: dshape_psi
real, dimension(ele_ngi(psi,ele)) :: detwei
real, dimension(ele_loc(psi,ele)) :: rhs_addto_src, rhs_addto_disip
type(element_type), pointer :: shape_psi
integer, pointer, dimension(:) :: nodes_psi
nodes_psi => ele_nodes(psi, ele)
shape_psi => ele_shape(psi, ele)
call transform_to_physical( positions, ele, shape_psi, dshape=dshape_psi, detwei=detwei )
where (ele_val_at_quad(vel_prod,ele) + ele_val_at_quad(buoy_prod,ele) .gt. 0)
rhs_addto_src = shape_rhs(shape_psi, detwei* ( &
(ele_val_at_quad(vel_prod,ele)) + &
(ele_val_at_quad(buoy_prod,ele)) &
) & !detwei
) ! shape_rhs
rhs_addto_disip = shape_rhs(shape_psi, detwei* (&
(cPsi2*ele_val_at_quad(eps,ele) * &
(ele_val_at_quad(Fwall,ele)*ele_val_at_quad(psi, ele)/ele_val_at_quad(tke,ele))) / &
ele_val_at_quad(psi,ele) &
) & ! detwei
) !shape_rhs
elsewhere
rhs_addto_src = shape_rhs(shape_psi, detwei * ( &
(ele_val_at_quad(vel_prod,ele)) &
) & !detwei
) !shape_rhs
rhs_addto_disip = shape_rhs(shape_psi, detwei * (&
((cPsi2*ele_val_at_quad(eps,ele) * &
(ele_val_at_quad(Fwall,ele)*ele_val_at_quad(psi, ele)/ele_val_at_quad(tke,ele))) - &! disipation term
(ele_val_at_quad(buoy_prod,ele)))/ & ! buoyancy term
ele_val_at_quad(psi,ele)&
) & !detwei
) !shape_rhs
end where
call addto(source, nodes_psi, rhs_addto_src)
call addto(absorption, nodes_psi, rhs_addto_disip)
end subroutine assemble_psi_src_abs
end subroutine gls_psi
!----------
! gls_diffusivity fixes the top/bottom boundaries of Psi
! then calulates the lengthscale, and then uses those to calculate the
! diffusivity and viscosity
! These are placed in the GLS fields ready for other tracer fields to use
! Viscosity is placed in the velocity viscosity
!----------
subroutine gls_diffusivity(state)
type(state_type), intent(inout) :: state
type(scalar_field), pointer :: tke_state, psi
type(tensor_field), pointer :: eddy_diff_KH,eddy_visc_KM,viscosity,background_diff,background_visc
real :: exp1, exp2, exp3, x
integer :: i, stat
real :: psi_limit, tke_cur, limit, epslim
real, parameter :: galp = 0.748331 ! sqrt(0.56)
type(vector_field), pointer :: positions, velocity
type(scalar_field) :: remaped_K_M, tke
type(tensor_field) :: remaped_background_visc
! Temporary tensors to hold rotated values (note: must be a 3x3 mat)
real, dimension(3,3) :: eddy_diff_KH_sphere_node, eddy_visc_KM_sphere_node, viscosity_sphere_node
ewrite(1,*) "In gls_diffusivity"
tke_state => extract_scalar_field(state, "GLSTurbulentKineticEnergy")
psi => extract_scalar_field(state, "GLSGenericSecondQuantity")
eddy_visc_KM => extract_tensor_field(state, "GLSEddyViscosityKM",stat)
eddy_diff_KH => extract_tensor_field(state, "GLSEddyDiffusivityKH",stat)
viscosity => extract_tensor_field(state, "Viscosity",stat)
positions => extract_vector_field(state, "Coordinate")
velocity => extract_vector_field(state, "Velocity")
call allocate(tke, tke_state%mesh, name="MyLocalTKE")
!if (gls_n > 0) then
! set the TKE to use below to the unaltered TKE
! with no changes to the upper/lower surfaces
! Applies to k-kl model only
! call set (tke, local_tke)
!else
! Use the altered TKE to get the surface diffusivity correct
call set (tke, tke_state)
!end if
exp1 = 3.0 + gls_p/gls_n
exp2 = 1.5 + gls_m/gls_n
exp3 = - 1.0/gls_n
if (gls_n > 0) then
do i=1,nNodes
tke_cur = node_val(tke,i)
psi_limit = (sqrt(0.56) * tke_cur**(exp2) * (1./sqrt(max(node_val(NN2,i)+1e-10,0.))) &
& * cm0**(gls_p / gls_n))**(-gls_n)
call set(psi,i,max(psi_min,min(node_val(psi,i),psi_limit)))
end do
end if
do i=1,nNodes
tke_cur = node_val(tke,i)
! recover dissipation rate from k and psi
call set(eps,i, cm0**exp1 * tke_cur**exp2 * node_val(psi,i)**exp3)
! limit dissipation rate under stable stratification,
! see Galperin et al. (1988)
if (node_val(NN2,i) > 0) then
epslim = (cde*tke_cur*sqrt(node_val(NN2,i)))/galp
else
epslim = eps_min
end if
call set(eps,i, max(node_val(eps,i),max(eps_min,epslim)))
! compute dissipative scale
call set(ll,i,cde*sqrt(tke_cur**3.)/node_val(eps,i))
!if (gls_n > 0) then
! if (node_val(NN2,i) > 0) then
! limit = sqrt(0.56 * tke_cur / node_val(NN2,i))
! call set(ll,i,min(limit,node_val(ll,i)))
! end if
!end if
end do
! calc fwall
ewrite(2,*) "Calculating the wall function for GLS"
call gls_calc_wall_function(state)
! calculate diffusivities for next step and for use in other fields
do i=1,nNodes
x = sqrt(node_val(tke,i))*node_val(ll,i)
! momentum
call set(K_M,i, relaxation*node_val(K_M,i) + (1-relaxation)*node_val(S_M,i)*x)
! tracer
call set(K_H,i, relaxation*node_val(K_H,i) + (1-relaxation)*node_val(S_H,i)*x)
end do
! put KM onto surface fields for Psi_bc
if (calculate_bcs) then
call remap_field_to_surface(K_M, top_surface_km_values, top_surface_element_list)
call remap_field_to_surface(K_M, bottom_surface_km_values, bottom_surface_element_list)
end if
!set the eddy_diffusivity and viscosity tensors for use by other fields
call zero(eddy_diff_KH) ! zero it first as we're using an addto below
call zero(eddy_visc_KM)
if (on_sphere) then
do i=1,nNodes
eddy_diff_KH_sphere_node=align_with_radial(node_val(positions,i),node_val(K_H,i))
eddy_visc_KM_sphere_node=align_with_radial(node_val(positions,i),node_val(K_M,i))
call set(eddy_diff_KH,i,eddy_diff_KH_sphere_node)
call set(eddy_visc_KM,i,eddy_visc_KM_sphere_node)
end do
else
call set(eddy_diff_KH,eddy_diff_KH%dim(1),eddy_diff_KH%dim(2),K_H)
call set(eddy_visc_KM,eddy_visc_KM%dim(1),eddy_visc_KM%dim(2),K_M)
end if
background_diff => extract_tensor_field(state, "GLSBackgroundDiffusivity")
call addto(eddy_diff_KH,background_diff)
background_visc => extract_tensor_field(state, "GLSBackgroundViscosity")
call addto(eddy_visc_KM,background_visc)
ewrite_minmax(K_H)
ewrite_minmax(K_M)
ewrite_minmax(S_H)
ewrite_minmax(S_M)
ewrite_minmax(ll)
ewrite_minmax(eps)
ewrite_minmax(tke)
ewrite_minmax(psi)
! Set viscosity
call allocate(remaped_K_M,velocity%mesh,name="remaped_Km")
call allocate(remaped_background_visc,velocity%mesh,name="remaped_viscosity")
if (K_M%mesh%continuity /= viscosity%mesh%continuity) then
! remap
call remap_field(K_M,remaped_K_M)
call remap_field(background_visc,remaped_background_visc)
else
! copy
call set(remaped_K_M,K_M)
call set(remaped_background_visc,background_visc)
end if
call zero(viscosity)
if (on_sphere) then
do i=1,nNodes
viscosity_sphere_node=align_with_radial(node_val(positions,i),node_val(remaped_K_M,i))
call set(viscosity,i,viscosity_sphere_node)
end do
else
call set(viscosity,viscosity%dim(1),viscosity%dim(2),remaped_K_M)
end if
call addto(viscosity,remaped_background_visc)
! Set output on optional fields - if the field exists, stick something in it
! We only need to do this to those fields that we haven't pulled from state, but
! allocated ourselves
call gls_output_fields(state)
call deallocate(remaped_background_visc)
call deallocate(remaped_K_M)
call deallocate(tke)
end subroutine gls_diffusivity
!----------
! gls_cleanup does...have a guess...go on.
!----------
subroutine gls_cleanup()
ewrite(1,*) "Cleaning up GLS variables"
! deallocate all our variables
if (calculate_bcs) then
ewrite(1,*) "Cleaning up GLS surface variables"
call deallocate(bottom_surface_values)
call deallocate(bottom_surface_tke_values)
call deallocate(bottom_surface_km_values)
call deallocate(top_surface_values)
call deallocate(top_surface_tke_values)
call deallocate(top_surface_km_values)
end if
call deallocate(NN2)
call deallocate(MM2)
call deallocate(B)
call deallocate(P)
call deallocate(S_H)
call deallocate(S_M)
call deallocate(K_H)
call deallocate(K_M)
call deallocate(eps)
call deallocate(Fwall)
call deallocate(density)
call deallocate(tke_old)
call deallocate(local_tke)
call deallocate(ll)
ewrite(1,*) "Finished gls_cleanup"
end subroutine gls_cleanup
!---------
! Needs to be called after an adapt to reset the fields
! and arrays within the module
! Note that clean_up has already been called in the pre-adapt hook
!----------
subroutine gls_adapt_mesh(state)
type(state_type), intent(inout) :: state
ewrite(1,*) "In gls_adapt_mesh"
call gls_allocate_temps(state) ! reallocate everything
if (calculate_bcs) then
call gls_init_surfaces(state) ! re-do the boundaries
end if
call gls_init_diagnostics(state)
end subroutine gls_adapt_mesh
subroutine gls_check_options
character(len=FIELD_NAME_LEN) :: buffer
integer :: stat
real :: min_tke, relax, nbcs
integer :: dimension
! Don't do GLS if it's not included in the model!
if (.not.have_option("/material_phase[0]/subgridscale_parameterisations/GLS/")) return
! one dimensional problems not supported
call get_option("/geometry/dimension/", dimension)
if (dimension .eq. 1 .and. have_option("/material_phase[0]/subgridscale_parameterisations/GLS/")) then
FLExit("GLS modelling is only supported for dimension > 1")
end if
call get_option("/problem_type", buffer)
if (.not. (buffer .eq. "oceans" .or. buffer .eq. "large_scale_ocean_options")) then
FLExit("GLS modelling is only supported for problem type oceans or large_scale_oceans.")
end if
if (.not.have_option("/physical_parameters/gravity")) then
ewrite(-1, *) "GLS modelling requires gravity"
FLExit("(otherwise buoyancy is a bit meaningless)")
end if
! checking for required fields
if (.not.have_option("/material_phase[0]/subgridscale_parameterisations/GLS/&
&scalar_field::GLSTurbulentKineticEnergy")) then
FLExit("You need GLSTurbulentKineticEnergy field for GLS")
end if
if (.not.have_option("/material_phase[0]/subgridscale_parameterisations/GLS/&
&scalar_field::GLSGenericSecondQuantity")) then
FLExit("You need GLSGenericSecondQuantity field for GLS")
end if
! check that the diffusivity is on for the two turbulent fields and is
! diagnostic
if (.not.have_option("/material_phase[0]/subgridscale_parameterisations/GLS/&
&scalar_field::GLSTurbulentKineticEnergy/prognostic/&
&tensor_field::Diffusivity")) then
FLExit("You need GLSTurbulentKineticEnergy Diffusivity field for GLS")
end if
if (.not.have_option("/material_phase[0]/subgridscale_parameterisations/GLS/&
&scalar_field::GLSTurbulentKineticEnergy/prognostic/&
&tensor_field::Diffusivity/diagnostic/algorithm::Internal")) then
FLExit("You need GLSTurbulentKineticEnergy Diffusivity field set to diagnostic/internal")
end if
if (.not.have_option("/material_phase[0]/subgridscale_parameterisations/GLS/&
&scalar_field::GLSGenericSecondQuantity/prognostic/&
&tensor_field::Diffusivity")) then
FLExit("You need GLSGenericSecondQuantity Diffusivity field for GLS")
end if
if (.not.have_option("/material_phase[0]/subgridscale_parameterisations/GLS/&
&scalar_field::GLSGenericSecondQuantity/prognostic/&
&tensor_field::Diffusivity/diagnostic/algorithm::Internal")) then
FLExit("You need GLSGenericSecondQuantity Diffusivity field set to diagnostic/internal")
end if
! source and absorption terms...
if (.not.have_option("/material_phase[0]/subgridscale_parameterisations/GLS/&
&scalar_field::GLSTurbulentKineticEnergy/prognostic/&
&scalar_field::Source")) then
FLExit("You need GLSTurbulentKineticEnergy Source field for GLS")
end if
if (.not.have_option("/material_phase[0]/subgridscale_parameterisations/GLS/&
&scalar_field::GLSTurbulentKineticEnergy/prognostic/&
&scalar_field::Source/diagnostic/algorithm::Internal")) then
FLExit("You need GLSTurbulentKineticEnergy Source field set to diagnostic/internal")
end if
if (.not.have_option("/material_phase[0]/subgridscale_parameterisations/GLS/&
&scalar_field::GLSGenericSecondQuantity/prognostic/&
&scalar_field::Source")) then
FLExit("You need GLSGenericSecondQuantity Source field for GLS")
end if
if (.not.have_option("/material_phase[0]/subgridscale_parameterisations/GLS/&
&scalar_field::GLSGenericSecondQuantity/prognostic/&
&scalar_field::Source/diagnostic/algorithm::Internal")) then
FLExit("You need GLSGenericSecondQuantity Source field set to diagnostic/internal")
end if
if (.not.have_option("/material_phase[0]/subgridscale_parameterisations/GLS/&
&scalar_field::GLSTurbulentKineticEnergy/prognostic/&
&scalar_field::Absorption")) then
FLExit("You need GLSTurbulentKineticEnergy Absorption field for GLS")
end if
if (.not.have_option("/material_phase[0]/subgridscale_parameterisations/GLS/&
&scalar_field::GLSTurbulentKineticEnergy/prognostic/&
&scalar_field::Absorption/diagnostic/algorithm::Internal")) then
FLExit("You need GLSTurbulentKineticEnergy Source field set to diagnostic/internal")
end if
if (.not.have_option("/material_phase[0]/subgridscale_parameterisations/GLS/&
&scalar_field::GLSGenericSecondQuantity/prognostic/&
&scalar_field::Absorption")) then
FLExit("You need GLSGenericSecondQuantity Absorption field for GLS")
end if
if (.not.have_option("/material_phase[0]/subgridscale_parameterisations/GLS/&
&scalar_field::GLSGenericSecondQuantity/prognostic/&
&scalar_field::Absorption/diagnostic/algorithm::Internal")) then
FLExit("You need GLSGenericSecondQuantity Source field set to diagnostic/internal")
end if
! background diffusivities are also needed
if (.not.have_option("/material_phase[0]/subgridscale_parameterisations/GLS/&
&tensor_field::GLSBackgroundDiffusivity/prescribed")) then
FLExit("You need GLSBackgroundDiffusivity tensor field for GLS")
end if
if (.not.have_option("/material_phase[0]/subgridscale_parameterisations/GLS/&
&tensor_field::GLSBackgroundViscosity/prescribed")) then
FLExit("You need GLSBackgroundViscosity tensor field for GLS")
end if
! check for some purturbation density and velocity
if (.not.have_option("/material_phase[0]/scalar_field::PerturbationDensity")) then
FLExit("You need PerturbationDensity field for GLS")
end if
if (.not.have_option("/material_phase[0]/vector_field::Velocity")) then
FLExit("You need Velocity field for GLS")
end if
! these two fields allow the new diffusivities/viscosities to be used in
! other calculations - we need them!
if (.not.have_option("/material_phase[0]/subgridscale_parameterisations/GLS/&
&tensor_field::GLSEddyViscosityKM")) then
FLExit("You need GLSEddyViscosityKM field for GLS")
end if
if (.not.have_option("/material_phase[0]/subgridscale_parameterisations/GLS/&
&tensor_field::GLSEddyViscosityKM")) then
FLExit("You need GLSEddyViscosityKM field for GLS")
end if
! check there's a viscosity somewhere
if (.not.have_option("/material_phase[0]/vector_field::Velocity/prognostic/&
&tensor_field::Viscosity/")) then
FLExit("Need viscosity switched on under the Velcotiy field for GLS.")
end if
! check that the user has switch Velocity/viscosity to diagnostic
if (.not.have_option("/material_phase[0]/vector_field::Velocity/prognostic/&
&tensor_field::Viscosity/diagnostic/")) then
FLExit("You need to switch the viscosity field under Velocity to diagnostic/internal")
end if
! check a minimum value of TKE has been set
call get_option("/material_phase[0]/subgridscale_parameterisations/GLS/&
&scalar_field::GLSTurbulentKineticEnergy/prognostic/minimum_value", min_tke, stat)
if (stat/=0) then
FLExit("You need to set a minimum TKE value - recommend a value of around 1e-6")
end if
! check if priorities have been set - if so warn the user this might screw
! things up
if (have_option("/material_phase[0]/subgridscale_parameterisations/GLS/&
&scalar_field::GLSTurbulentKineticEnergy/prognostic/priority")) then
ewrite(-1,*)("WARNING: Priorities for the GLS fields are set internally. Setting them in the FLML might mess things up")
end if
if (have_option("/material_phase[0]/subgridscale_parameterisations/GLS/&
&scalar_field::GLSGenericSecondQuantity/prognostic/priority")) then
ewrite(-1,*)("WARNING: Priorities for the GLS fields are set internally. Setting them in the FLML might mess things up")
end if
! check the relax option is valid
if (have_option("/material_phase[0]/subgridscale_parameterisations/GLS/relax_diffusivity")) then
call get_option("/material_phase[0]/subgridscale_parameterisations/GLS/relax_diffusivity", relax)
if (relax < 0 .or. relax >= 1.0) then
FLExit("The GLS diffusivity relaxation value should be greater than or equal to zero, but less than 1.0")
end if
if (.not. have_option("/material_phase[0]/subgridscale_parameterisations/GLS/scalar_field::GLSVerticalViscosity/")) then
FLExit("You will need to switch on the GLSVerticalViscosity field when using relaxation")
end if
if (.not. have_option("/material_phase[0]/subgridscale_parameterisations/GLS/scalar_field::GLSVerticalDiffusivity/")) then
FLExit("You will need to switch on the GLSVerticalDiffusivity field when using relaxation")
end if
end if
! Check that the we don't have auto boundaries and user-defined boundaries
if (have_option("/material_phase[0]/subgridscale_parameterisations/GLS/calculate_boundaries")) then
nbcs=option_count(trim("/material_phase[0]/subgridscale_parameterisations/GLS/scalar_field::GLSTurbulentKineticEnergy/prognostic/boundary_conditions"))
if (nbcs > 0) then
FLExit("You have automatic boundary conditions on, but some boundary conditions on the GLS TKE field. Not allowed")
end if
nbcs=option_count(trim("/material_phase[0]/subgridscale_parameterisations/GLS/scalar_field::GLSGenericSecondQuantity/prognostic/boundary_conditions"))
if (nbcs > 0) then
FLExit("You have automatic boundary conditions on, but some boundary conditions on the GLS Psi field. Not allowed")
end if
end if
! If the user has selected k-kl we need the ocean surface and bottom fields
! on in ocean_boundaries
call get_option("/material_phase[0]/subgridscale_parameterisations/GLS/option", buffer)
if (trim(buffer) .eq. "k-kl") then
if (.not. have_option("/geometry/ocean_boundaries")) then
FLExit("If you use the k-kl option under GLS, you need to switch on ocean_boundaries under /geometry/ocean_boundaries")
end if
end if
end subroutine gls_check_options
!------------------------------------------------------------------!
!------------------------------------------------------------------!
! !
! Private subroutines !
! !
!------------------------------------------------------------------!
!------------------------------------------------------------------!
!---------
! Initilise the surface meshes used for the BCS
! Called at startup and after an adapt
!----------
subroutine gls_init_surfaces(state)
type(state_type), intent(in) :: state
type(scalar_field), pointer :: tke
type(vector_field), pointer :: position
type(mesh_type), pointer :: ocean_mesh
type(mesh_type) :: meshy
ewrite(1,*) "Initialising the GLS surfaces required for BCs"
! grab hold of some essential field
tke => extract_scalar_field(state, "GLSTurbulentKineticEnergy")
position => extract_vector_field(state, "Coordinate")
! create a surface mesh to place values onto. This is for the top surface
call get_boundary_condition(tke, 'tke_top_boundary', surface_mesh=ocean_mesh, &
surface_element_list=top_surface_element_list)
NNodes_sur = node_count(ocean_mesh)
call allocate(top_surface_values, ocean_mesh, name="top_surface")
call allocate(top_surface_tke_values,ocean_mesh, name="surface_tke")
call allocate(top_surface_km_values,ocean_mesh, name="surface_km")
! Creating a surface mesh gives a mapping between to global node number
call create_surface_mesh(meshy, top_surface_nodes, tke%mesh, &
top_surface_element_list, 'OceanTop')
call deallocate(meshy)
! bottom
call get_boundary_condition(tke, 'tke_bottom_boundary', surface_mesh=ocean_mesh, &
surface_element_list=bottom_surface_element_list)
NNodes_bot = node_count(ocean_mesh)
call allocate(bottom_surface_values, ocean_mesh, name="bottom_surface")
call allocate(bottom_surface_tke_values,ocean_mesh, name="bottom_tke")
call allocate(bottom_surface_km_values,ocean_mesh, name="bottom_km")
call create_surface_mesh(meshy, bottom_surface_nodes, tke%mesh, &
bottom_surface_element_list, 'OceanBottom')
call deallocate(meshy)
end subroutine gls_init_surfaces
!----------------------
! Initialise the diagnostic fields, such as diffusivity, length
! scale, etc. This is called during initialisation and after an
! adapt
!----------------------
subroutine gls_init_diagnostics(state)
type(state_type), intent(inout) :: state
type(scalar_field), pointer :: tke
tke => extract_scalar_field(state, "GLSTurbulentKineticEnergy")
! put tke onto surface fields if we need to
if (calculate_bcs) then
call remap_field_to_surface(tke, top_surface_tke_values, top_surface_element_list)
call remap_field_to_surface(tke, bottom_surface_tke_values, bottom_surface_element_list)
end if
call set(tke_old,tke)
call set(FWall,1.0)
! bit complicated here - we need to repopulate the fields internal to this
! module, post adapt or at initialisation. We need the diffusivity for the first iteration to
! calculate the TKE src/abs terms, but for diffusivity, we need stability
! functions, for those we need epsilon, which is calculated in the
! diffusivity subroutine, but first we need the buoyancy freq.
! So, working backwards...
call gls_buoyancy(state) ! buoyancy for epsilon calculation
call gls_diffusivity(state) ! gets us epsilon, but K_H and K_M are wrong
call gls_stability_function(state) ! requires espilon, but sets S_H and S_M
call gls_diffusivity(state) ! sets K_H, K_M to correct values
! and this one sets up the diagnostic fields for output
call gls_output_fields(state)
end subroutine gls_init_diagnostics
!----------
! Calculate the buoyancy frequency and shear velocities
!----------
subroutine gls_buoyancy(state)
type(state_type), intent(inout) :: state
type(scalar_field), pointer :: pert_rho
type(vector_field), pointer :: positions, gravity
type(vector_field), pointer :: velocity
type(scalar_field) :: NU, NV, MM2_av, NN2_av, inverse_lumpedmass
type(scalar_field), pointer :: lumpedmass
real :: g
logical :: on_sphere, smooth_buoyancy, smooth_shear
integer :: ele, i, dim
type(csr_matrix), pointer :: mass
! grab variables required from state - already checked in init, so no need to check here
positions => extract_vector_field(state, "Coordinate")
velocity => extract_vector_field(state, "Velocity")
pert_rho => extract_scalar_field(state, "PerturbationDensity")
gravity => extract_vector_field(state, "GravityDirection")
! now allocate our temp fields
call allocate(NU, velocity%mesh, "NU")
call allocate(NV, velocity%mesh, "NV")
call set(NU, extract_scalar_field(velocity, 1))
call set(NV, extract_scalar_field(velocity, 2))
call get_option("/physical_parameters/gravity/magnitude", g)
on_sphere = have_option('/geometry/spherical_earth/')
smooth_buoyancy = have_option('/material_phase[0]/subgridscale_parameterisations/GLS/smooth_buoyancy/')
smooth_shear = have_option('/material_phase[0]/subgridscale_parameterisations/GLS/smooth_shear/')
dim = mesh_dim(NN2)
call zero(NN2)
call zero(MM2)
element_loop: do ele=1, element_count(velocity)
call assemble_elements(ele,MM2,NN2,velocity,pert_rho,NU,NV,on_sphere,dim)
end do element_loop
! Solve
lumpedmass => get_lumped_mass(state, NN2%mesh)
NN2%val = NN2%val / lumpedmass%val
lumpedmass => get_lumped_mass(state, MM2%mesh)
MM2%val = MM2%val / lumpedmass%val
if (smooth_shear) then
call allocate(MM2_av, MM2%mesh, "MM2_averaged")
call allocate(inverse_lumpedmass, MM2%mesh, "InverseLumpedMass")
mass => get_mass_matrix(state, MM2%mesh)
lumpedmass => get_lumped_mass(state, MM2%mesh)
call invert(lumpedmass, inverse_lumpedmass)
call mult( MM2_av, mass, MM2)
call scale(MM2_av, inverse_lumpedmass) ! so the averaging operator is [inv(ML)*M*]
call set(MM2, MM2_av)
call deallocate(inverse_lumpedmass)
call deallocate(MM2_av)
end if
if (smooth_buoyancy) then
call allocate(NN2_av, NN2%mesh, "NN2_averaged")
call allocate(inverse_lumpedmass, NN2%mesh, "InverseLumpedMass")
mass => get_mass_matrix(state, NN2%mesh)
lumpedmass => get_lumped_mass(state, NN2%mesh)
call invert(lumpedmass, inverse_lumpedmass)
call mult( NN2_av, mass, NN2)
call scale(NN2_av, inverse_lumpedmass) ! so the averaging operator is [inv(ML)*M*]
call set(NN2, NN2_av)
call deallocate(NN2_av)
call deallocate(inverse_lumpedmass)
end if
call deallocate(NU)
call deallocate(NV)
contains
subroutine assemble_elements(ele,MM2,NN2,velocity,rho,NU,NV,on_sphere,dim)
type(vector_field), intent(in), pointer :: velocity
type(scalar_field), intent(in) :: rho
type(scalar_field), intent(inout) :: NN2, MM2
type(scalar_field), intent(in) :: NU, NV
logical, intent(in) :: on_sphere
integer, intent(in) :: ele, dim
type(element_type), pointer :: NN2_shape, MM2_shape
real, dimension(ele_ngi(velocity,ele)) :: detwei, shear, drho_dz
real, dimension(dim, ele_ngi(velocity,ele)) :: grad_theta_gi, du_dz
real, dimension(dim,ele_ngi(velocity,ele)) :: grav_at_quads
type(element_type), pointer :: theta_shape, velocity_shape
integer, dimension(:), pointer :: element_nodes
real, dimension(ele_loc(velocity,ele),ele_ngi(velocity,ele),dim) :: dn_t
real, dimension(ele_loc(rho,ele),ele_ngi(rho,ele),dim) :: dtheta_t
real, dimension(ele_loc(velocity, ele),ele_ngi(velocity, ele),dim):: du_t
NN2_shape => ele_shape(NN2, ele)
MM2_shape => ele_shape(MM2, ele)
velocity_shape => ele_shape(velocity, ele)
theta_shape => ele_shape(rho, ele)
call transform_to_physical(positions, ele, NN2_shape, &
& dshape = dn_t, detwei = detwei)
if(NN2_shape == velocity_shape) then
du_t = dn_t
else
call transform_to_physical(positions, ele, velocity_shape, dshape = du_t)
end if
if(theta_shape == velocity_shape) then
dtheta_t = dn_t
else
call transform_to_physical(positions, ele, theta_shape, dshape = dtheta_t)
end if
if (on_sphere) then
grav_at_quads=radial_inward_normal_at_quad_ele(positions, ele)
else
grav_at_quads=ele_val_at_quad(gravity, ele)
end if
grad_theta_gi=ele_grad_at_quad(rho, ele, dtheta_t)
do i=1,ele_ngi(velocity,ele)
drho_dz(i)=dot_product(grad_theta_gi(:,i),grav_at_quads(:,i)) ! Divide this by rho_0 for non-Boussinesq?
end do
grad_theta_gi=ele_grad_at_quad(NU, ele, dtheta_t)
do i=1,ele_ngi(velocity,ele)
du_dz(1,i)=dot_product(grad_theta_gi(:,i),grav_at_quads(:,i)) ! Divide this by rho_0 for non-Boussinesq?
end do
grad_theta_gi=ele_grad_at_quad(NV, ele, dtheta_t)
do i=1,ele_ngi(velocity,ele)
du_dz(2,i)=dot_product(grad_theta_gi(:,i),grav_at_quads(:,i)) ! Divide this by rho_0 for non-Boussinesq?
end do
shear = 0.0
do i = 1, dim - 1
shear = shear + du_dz(i,:) ** 2
end do
element_nodes => ele_nodes(NN2, ele)
call addto(NN2, element_nodes, &
! already in the right direction due to multipling by grav_at_quads
& shape_rhs(NN2_shape, detwei * g * drho_dz) &
& )
call addto(MM2, element_nodes, &
& shape_rhs(MM2_shape,detwei * shear) &
& )
end subroutine assemble_elements
end subroutine gls_buoyancy
!----------
! Stability function based on Caunto et al 2001
!----------
subroutine gls_stability_function(state)
type(state_type), intent(in) :: state
integer :: i
real :: N,Nt,an,anMin,anMinNum,anMinDen
real, parameter :: anLimitFact = 0.5
real :: d0,d1,d2,d3,d4,d5
real :: n0,n1,n2,nt0,nt1,nt2
real :: dCm,nCm,nCmp,cm3_inv
real :: tmp0,tmp1,tmp2,tau2,as
type(scalar_field), pointer :: KK
ewrite(1,*) "Calculating GLS stability functions"
! grab stuff from state
KK => extract_scalar_field(state, 'GLSTurbulentKineticEnergy')
! This is written out verbatim as in GOTM v4.3.1 (also GNU GPL)
N = 0.5*cc1
Nt = ct1
d0 = 36.* N**3. * Nt**2.
d1 = 84.*a5*at3 * N**2. * Nt + 36.*at5 * N**3. * Nt
d2 = 9.*(at2**2.-at1**2.) * N**3. - 12.*(a2**2.-3.*a3**2.) * N * Nt**2.
d3 = 12.*a5*at3*(a2*at1-3.*a3*at2) * N + 12.*a5*at3*(a3**2.-a2**2.) * Nt &
+ 12.*at5*(3.*a3**2.-a2**2.) * N * Nt
d4 = 48.*a5**2.*at3**2. * N + 36.*a5*at3*at5 * N**2.
d5 = 3.*(a2**2.-3.*a3**2.)*(at1**2.-at2**2.) * N
n0 = 36.*a1 * N**2. * Nt**2.
n1 = - 12.*a5*at3*(at1+at2) * N**2. + 8.*a5*at3*(6.*a1-a2-3.*a3) * N * Nt &
+ 36.*a1*at5 * N**2. * Nt
n2 = 9.*a1*(at2**2.-at1**2.) * N**2.
nt0 = 12.*at3 * N**3. * Nt
nt1 = 12.*a5*at3**2. * N**2.
nt2 = 9.*a1*at3*(at1-at2) * N**2. + ( 6.*a1*(a2-3.*a3) &
- 4.*(a2**2.-3.*a3**2.) )*at3 * N * Nt
cm3_inv = 1./cm0**3
! mininum value of "an" to insure that "as" > 0 in equilibrium
anMinNum = -(d1 + nt0) + sqrt((d1+nt0)**2. - 4.*d0*(d4+nt1))
anMinDen = 2.*(d4+nt1)
anMin = anMinNum / anMinDen
if (abs(n2-d5) .lt. 1e-7) then
! (special treatment to avoid a singularity)
do i=1,nNodes
tau2 = node_val(KK,i)*node_val(KK,i) / ( node_val(eps,i)*node_val(eps,i) )
an = tau2 * node_val(NN2,i)
! clip an at minimum value
an = max(an,anLimitFact*anMin)
! compute the equilibrium value of as
tmp0 = -d0 - (d1 + nt0)*an - (d4 + nt1)*an*an
tmp1 = -d2 + n0 + (n1-d3-nt2)*an
as = -tmp0 / tmp1
! compute stability function
dCm = d0 + d1*an + d2*as + d3*an*as + d4*an*an + d5*as*as
nCm = n0 + n1*an + n2*as
nCmp = nt0 + nt1*an + nt2*as
call set(S_M,i, cm3_inv*nCm /dCm)
call set(S_H,i, cm3_inv*nCmp/dCm)
end do
else
do i=1,nNodes
tau2 = node_val(KK,i)*node_val(KK,i) / ( node_val(eps,i)*node_val(eps,i) )
an = tau2 * node_val(NN2,i)
! clip an at minimum value
an = max(an,anLimitFact*anMin)
! compute the equilibrium value of as
tmp0 = -d0 - (d1 + nt0)*an - (d4 + nt1)*an*an
tmp1 = -d2 + n0 + (n1-d3-nt2)*an
tmp2 = n2-d5
as = (-tmp1 + sqrt(tmp1*tmp1-4.*tmp0*tmp2) ) / (2.*tmp2)
! compute stability function
dCm = d0 + d1*an + d2*as + d3*an*as + d4*an*an + d5*as*as
nCm = n0 + n1*an + n2*as
nCmp = nt0 + nt1*an + nt2*as
call set(S_M,i, cm3_inv*nCm /dCm)
call set(S_H,i, cm3_inv*nCmp/dCm)
end do
endif
end subroutine gls_stability_function
!----------
! gls_tke_bc calculates the boundary conditions on the TKE (tke) field
! Boundary can be either Dirichlet or Neumann.
!----------
subroutine gls_tke_bc(state, bc_type)
type(state_type), intent(in) :: state
character(len=*), intent(in) :: bc_type
type(vector_field), pointer :: positions
real :: gravity_magnitude
integer :: i
real, allocatable, dimension(:) :: z0s, z0b, u_taus_squared, u_taub_squared
! grab hold of some essential field
call get_option("/physical_parameters/gravity/magnitude", gravity_magnitude)
positions => extract_vector_field(state, "Coordinate")
! Top boundary condition
select case(bc_type)
case("neumann")
! Top TKE flux BC
call set(top_surface_values,0.0)
call set(bottom_surface_values,0.0)
case("dirichlet")
allocate(z0s(NNodes_sur))
allocate(z0b(NNodes_bot))
allocate(u_taus_squared(NNodes_sur))
allocate(u_taub_squared(NNodes_bot))
call gls_friction(state,z0s,z0b,gravity_magnitude,u_taus_squared,u_taub_squared)
! Top TKE value set
do i=1,NNodes_sur
call set(top_surface_values,i,max(u_taus_squared(i)/(cm0**2),k_min))
end do
do i=1,NNodes_bot
call set(bottom_surface_values,i,max(u_taub_squared(i)/(cm0**2),k_min))
end do
deallocate(z0s)
deallocate(z0b)
deallocate(u_taus_squared)
deallocate(u_taub_squared)
case default
FLAbort('Unknown BC for TKE')
end select
end subroutine gls_tke_bc
!----------
! gls_psi_bc calculates the boundary conditions on the Psi (psi) field
! Boundary can be either Dirichlet or Neumann.
!----------
subroutine gls_psi_bc(state, bc_type)
type(state_type), intent(in) :: state
character(len=*), intent(in) :: bc_type
type(vector_field), pointer :: positions
real :: gravity_magnitude
integer :: i
real, allocatable, dimension(:) :: z0s, z0b, u_taus_squared, u_taub_squared
type(scalar_field), pointer :: tke, psi
real :: value
ewrite(2,*) "In gls_psi_bc: setting up"
! grab hold of some essential fields
call get_option("/physical_parameters/gravity/magnitude", gravity_magnitude)
positions => extract_vector_field(state, "Coordinate")
tke => extract_scalar_field(state, "GLSTurbulentKineticEnergy")
psi => extract_scalar_field(state, "GLSGenericSecondQuantity")
allocate(z0s(NNodes_sur))
allocate(z0b(NNodes_bot))
allocate(u_taus_squared(NNodes_sur))
allocate(u_taub_squared(NNodes_bot))
ewrite(2,*) "In gls_psi_bc: friction"
! get friction
call gls_friction(state,z0s,z0b,gravity_magnitude,u_taus_squared,u_taub_squared)
! put tke onto surface fields
call remap_field_to_surface(tke, top_surface_tke_values, top_surface_element_list)
call remap_field_to_surface(tke, bottom_surface_tke_values, bottom_surface_element_list)
ewrite(2,*) "In gls_psi_bc: setting values"
select case(bc_type)
case("neumann")
do i=1,NNodes_sur
! GOTM Boundary
value = -(gls_n*(cm0**(gls_p+1.))*(kappa**(gls_n+1.)))/sigma_psi &
*node_val(top_surface_tke_values,i)**(gls_m+0.5)*(z0s(i))**gls_n
! Warner 2005 - left here for posterity and debugging
!value = -gls_n*(cm0**(gls_p))*(node_val(top_surface_tke_values,i)**gls_m)* &
! (kappa**gls_n)*(z0s(i)**(gls_n-1))*((node_val(top_surface_km_values,i)/sigma_psi))
call set(top_surface_values,i,value)
end do
do i=1,NNodes_bot
if (u_taub_squared(i) < 1e-16) then
value = 0.0
else
! GOTM Boundary
value = - gls_n*cm0**(gls_p+1.)*(kappa**(gls_n+1.)/sigma_psi) &
*node_val(bottom_surface_tke_values,i)**(gls_m+0.5)*(z0b(i))**gls_n
! Warner 2005 - as above
!value = gls_n*cm0**(gls_p)*node_val(bottom_surface_tke_values,i)**(gls_m)* &
! kappa**gls_n*(z0b(i)**(gls_n-1))*(node_val(bottom_surface_km_values,i)/sigma_psi)
end if
call set(bottom_surface_values,i,value)
end do
case("dirichlet")
do i=1,NNodes_sur
value = max(cm0**(gls_p-2.*gls_m)*kappa**gls_n*u_taus_squared(i)**gls_m * &
(z0s(i))**gls_n,psi_min)
call set(top_surface_values,i,value)
end do
do i=1,NNodes_bot
value = max(cm0**(gls_p-2.*gls_m)*kappa**gls_n*u_taub_squared(i)**gls_m * &
(z0b(i))**gls_n,psi_min)
call set(bottom_surface_values,i,value)
end do
case default
FLAbort('Unknown boundary type for Psi')
end select
deallocate(z0s)
deallocate(z0b)
deallocate(u_taus_squared)
deallocate(u_taub_squared)
end subroutine gls_psi_bc
!----------
! gls_frction works out the depth of the friction layer
! either due to bottom topography roughness or the shear stress
! on the surface
!---------
subroutine gls_friction(state,z0s,z0b,gravity_magnitude,u_taus_squared,u_taub_squared)
type(state_type), intent(in) :: state
real, intent(in) :: gravity_magnitude
real, dimension(:), intent(inout) :: z0s,z0b,u_taus_squared,u_taub_squared
integer :: nobcs
integer :: i,ii, MaxIter
real :: rr
real :: charnock_val=18500.
character(len=OPTION_PATH_LEN) :: bctype
type(vector_field), pointer :: wind_surface_field, positions, velocity
type(scalar_field), pointer :: tke
type(vector_field) :: bottom_velocity, surface_forcing, cont_vel, surface_pos
type(mesh_type) :: ocean_mesh
real :: u_taub, z0s_min
real, dimension(1) :: temp_vector_1D ! Obviously, not really a vector, but lets keep the names consistant
real, dimension(2) :: temp_vector_2D
real, dimension(3) :: temp_vector_3D
logical :: surface_allocated
integer :: stat
MaxIter = 10
z0s_min = 0.003
surface_allocated = .false.
! get meshes
velocity => extract_vector_field(state, "Velocity")
positions => extract_vector_field(state, "Coordinate")
tke => extract_scalar_field(state, "GLSTurbulentKineticEnergy")
wind_surface_field => null()
! grab stresses from velocity field - Surface
nobcs = get_boundary_condition_count(velocity)
do i=1, nobcs
call get_boundary_condition(velocity, i, type=bctype)
if (bctype=='wind_forcing') then
wind_surface_field => extract_surface_field(velocity, i, "WindSurfaceField")
call create_surface_mesh(ocean_mesh, top_surface_nodes, tke%mesh, &
top_surface_element_list, 'OceanTop')
call allocate(surface_forcing, wind_surface_field%dim, ocean_mesh, name="surface_velocity")
surface_pos = get_coordinates_remapped_to_surface(positions, ocean_mesh, top_surface_element_list)
call deallocate(ocean_mesh)
if (tke%mesh%continuity == velocity%mesh%continuity) then
call set(surface_forcing,wind_surface_field)
else
! remap onto same mesh as TKE
call project_field(wind_surface_field, surface_forcing, surface_pos)
end if
surface_allocated = .true.
call deallocate(surface_pos)
exit
end if
end do
! sort out bottom surface velocity
call create_surface_mesh(ocean_mesh, bottom_surface_nodes, tke%mesh, &
bottom_surface_element_list, 'OceanBottom')
call allocate(bottom_velocity, velocity%dim, ocean_mesh, name="bottom_velocity")
call allocate(cont_vel, velocity%dim, tke%mesh, name="ContVel")
call deallocate(ocean_mesh)
! Do we need to project or copy?
if (velocity%mesh%continuity == tke%mesh%continuity) then
call set(cont_vel,velocity)
else
! remap onto same mesh as TKE
call project_field(velocity, cont_vel, positions)
end if
call remap_field_to_surface(cont_vel, bottom_velocity, &
bottom_surface_element_list)
call deallocate(cont_vel)
! we now have a bottom velocity surface and a top surface
! with the wind stress on (note easier to to zero the output array
! below than set wind_forcing to zero and work through all the calcs
! work out the friction in either 3 or 2 dimensions.
if (positions%dim .eq. 3) then
if (surface_allocated) then
do i=1,NNodes_sur
temp_vector_2D = node_val(surface_forcing,i)
! big hack! Assumes that the wind stress forcing has ALREADY been divded by ocean density
! Note that u_taus = sqrt(wind_stress/rho0)
! we assume here that the wind stress in diamond is already
! wind_stress/rho0, hence here:
! u_taus = sqrt(wind_stress)
u_taus_squared(i) = max(1e-12,sqrt(((temp_vector_2D(1))**2+(temp_vector_2D(2))**2)))
! use the Charnock formula to compute the surface roughness
z0s(i)=charnock_val*u_taus_squared(i)/gravity_magnitude
if (z0s(i).lt.z0s_min) z0s(i)=z0s_min
end do
else
z0s = z0s_min
u_taus_squared = 0.0
end if
do i=1,NNodes_bot
temp_vector_3D = node_val(bottom_velocity,i)
u_taub = sqrt(temp_vector_3D(1)**2+temp_vector_3D(2)**2+temp_vector_3D(3)**2)
if (u_taub <= 1e-12) then
z0b(i) = z0s_min
else
! iterate bottom roughness length MaxIter times
do ii=1,MaxIter
z0b(i)=(1e-7/max(1e-6,u_taub)+0.03*0.1)
! compute the factor r
rr=kappa/log(z0b(i))
! compute the friction velocity at the bottom
u_taub = rr*sqrt(temp_vector_3D(1)**2+temp_vector_3D(2)**2+temp_vector_3D(3)**2)
end do
end if
u_taub_squared(i) = u_taub**2
end do
else if (positions%dim .eq. 2) then
if (surface_allocated) then
do i=1,NNodes_sur
temp_vector_1D = node_val(surface_forcing,i)
u_taus_squared(i) = max(1e-12,abs(temp_vector_1D(1)))
! use the Charnock formula to compute the surface roughness
z0s(i)=charnock_val*u_taus_squared(i)/gravity_magnitude
if (z0s(i).lt.z0s_min) z0s(i)=z0s_min
end do
else
z0s = z0s_min
u_taus_squared = 0.0
end if
do i=1,NNodes_bot
temp_vector_2D = node_val(bottom_velocity,i)
u_taub = sqrt(temp_vector_2D(1)**2+temp_vector_2D(2)**2)
! iterate bottom roughness length MaxIter times
do ii=1,MaxIter
z0b(i)=(1e-7/(max(1e-6,u_taub)+0.03*0.1))
rr=kappa/log(z0b(i))
! compute the friction velocity at the bottom
u_taub = rr*sqrt((temp_vector_2D(1)**2+temp_vector_2D(2)**2))
end do
u_taub_squared(i) = u_taub**2
end do
else
FLAbort("Unsupported dimension in GLS friction")
end if
call deallocate(bottom_velocity)
if (surface_allocated) then
call deallocate(surface_forcing)
end if
return
end subroutine gls_friction
!---------
! Output the optional fields if they exist in state
!---------
subroutine gls_output_fields(state)
type(state_type), intent(in) :: state
type(scalar_field), pointer :: scalarField
type(tensor_field), pointer :: tensorField
integer :: stat
scalarField => extract_scalar_field(state, "GLSLengthScale", stat)
if(stat == 0) then
call set(scalarField,ll)
end if
scalarField => extract_scalar_field(state,"GLSTurbulentKineticEnergyOriginal", stat)
if(stat == 0) then
call set(scalarField,local_tke)
end if
scalarField => extract_scalar_field(state, "GLSBuoyancyFrequency", stat)
if(stat == 0) then
call set(scalarField,NN2)
end if
scalarField => extract_scalar_field(state, "GLSVelocityShear", stat)
if(stat == 0) then
call set(scalarField,MM2)
end if
scalarField => extract_scalar_field(state, "GLSShearProduction", stat)
if(stat == 0) then
call set(scalarField,P)
end if
scalarField => extract_scalar_field(state, "GLSBuoyancyProduction", stat)
if(stat == 0) then
call set(scalarField,B)
end if
scalarField => extract_scalar_field(state, "GLSDissipationEpsilon", stat)
if(stat == 0) then
call set(scalarField,eps)
end if
scalarField => extract_scalar_field(state, "GLSStabilityFunctionSH", stat)
if(stat == 0) then
call set(scalarField,S_H)
end if
scalarField => extract_scalar_field(state, "GLSStabilityFunctionSM", stat)
if(stat == 0) then
call set(scalarField,S_M)
end if
scalarField => extract_scalar_field(state, "GLSWallFunction", stat)
if(stat == 0) then
call set(scalarField,Fwall)
end if
scalarField => extract_scalar_field(state, "GLSVerticalViscosity", stat)
if(stat == 0) then
! add vertical background
tensorField => extract_tensor_field(state, "GLSBackgroundDiffusivity")
call set(scalarField,K_M)
call addto(scalarField, extract_scalar_field(tensorField, tensorField%dim(1), tensorField%dim(2)))
end if
scalarField => extract_scalar_field(state, "GLSVerticalDiffusivity", stat)
if(stat == 0) then
! add vertical background
tensorField => extract_tensor_field(state, "GLSBackgroundDiffusivity")
call set(scalarField,K_H)
call addto(scalarField, extract_scalar_field(tensorField,tensorField%dim(1), tensorField%dim(2)))
end if
end subroutine gls_output_fields
!---------
! Calculate the wall function as set by the user
! Each wall function has been designed with a
! particular problem in mind, so best to have a choice here
!---------
subroutine gls_calc_wall_function(state)
type(state_type), intent(in) :: state
type(scalar_field), pointer :: distanceToBottom, distanceToTop, tke
real :: LLL, distTop, distBot
type(scalar_field) :: top, bottom
real, parameter :: E2 = 1.33, E4 = 0.25
integer :: i, stat
! FWall is initialised in gls_init to 1, so no need to do anything
if (gls_wall_option .eq. "none") return
tke => extract_scalar_field(state,"GLSTurbulentKineticEnergy")
distanceToTop => extract_scalar_field(state, "DistanceToTop")
distanceToBottom => extract_scalar_field(state, "DistanceToBottom")
call allocate(top,tke%mesh,"TopOnTKEMesh")
call allocate(bottom,tke%mesh,"BottomOnTKEMesh")
call remap_field(distanceToTop,top,stat)
call remap_field(distanceToBottom,bottom,stat)
select case (gls_wall_option)
case ("MellorYamda")
do i=1,nNodes
distTop = max(1.0,node_val(top,i))
distBot = max(1.0,node_val(bottom,i))
LLL = (distBot + distTop) / (distTop * distBot)
call set( Fwall, i, 1.0 + E2*( ((node_val(ll,i)/kappa)*( LLL ))**2 ))
end do
case ("Burchard98")
do i=1,nNodes
distTop = max(1.0,node_val(top,i))
distBot = max(1.0,node_val(bottom,i))
LLL = 1.0 / min(distTop,distBot)
call set( Fwall, i, 1.0 + E2*( ((node_val(ll,i)/kappa)*( LLL ))**2 ))
end do
case ("Burchard01")
do i=1,nNodes
distTop = max(1.0,node_val(top,i))
distBot = max(1.0,node_val(bottom,i))
LLL = 1.0 / distTop
call set( Fwall, i, 1.0 + E2*( ((node_val(ll,i)/kappa)*( LLL ))**2 ))
end do
case ("Blumberg")
do i=1,nNodes
distTop = max(0.1,node_val(top,i))
distBot = max(0.1,node_val(bottom,i))
LLL = E2 * (node_val(ll,i) / (kappa * distBot)) ** 2
LLL = LLL + E4 * (node_val(ll,i) / (kappa * distTop)) ** 2
call set( Fwall, i, 1.0 + LLL)
end do
case default
FLAbort("Unknown wall function")
end select
call deallocate(top)
call deallocate(bottom)
end subroutine gls_calc_wall_function
subroutine gls_allocate_temps(state)
type(state_type), intent(inout) :: state
type(scalar_field), pointer :: tkeField
tkeField => extract_scalar_field(state,"GLSTurbulentKineticEnergy")
! allocate some space for the fields we need for calculations, but are optional in the model
! we're going to allocate these on the velocity mesh as we need one of these...
call allocate(ll, tkeField%mesh, "LengthScale")
call allocate(NN2, tkeField%mesh, "BuoyancyFrequency")
call allocate(MM2, tkeField%mesh, "VelocityShear")
call allocate(B, tkeField%mesh, "BuoyancyFrequency")
call allocate(P, tkeField%mesh, "ShearProduction")
call allocate(S_H, tkeField%mesh, "StabilityH")
call allocate(S_M, tkeField%mesh, "StabilityM")
call allocate(K_H, tkeField%mesh, "EddyDiff")
call allocate(K_M, tkeField%mesh, "EddyVisc")
call allocate(eps, tkeField%mesh, "GLS_TKE_Dissipation")
call allocate(Fwall, tkeField%mesh, "GLS_WallFunction")
call allocate(density, tkeField%mesh, "Density")
call allocate(tke_old, tkeField%mesh, "Old_TKE")
call allocate(local_tke, tkeField%mesh, "Local_TKE")
call set(ll,0.)
call set(NN2,0.)
call set(MM2,0.)
call set(B,0.)
call set(P,0.)
call set(S_H,0.)
call set(S_M,0.)
call set(K_H,0.)
call set(K_M,0.)
call set(eps,0.)
call set(density,0.)
call set(tke_old,0.)
call set(local_tke,tkeField)
nNodes = node_count(tkeField)
end subroutine gls_allocate_temps
!---------
! Align the diff/visc tensors with gravity when on the sphere
!---------
function align_with_radial(position, scalar) result(rotated_tensor)
! Function to align viscosities/diffusivities in the radial direction when on
! the sphere
real, dimension(:), intent(in) :: position
real, intent(in) :: scalar
real, dimension(size(position),size(position)) :: rotated_tensor
real :: rad, phi, theta
assert(size(position)==3)
rad=sqrt(sum(position(:)**2))
phi=atan2(position(2),position(1))
theta=acos(position(3)/rad)
rotated_tensor(1,1)=scalar*sin(theta)**2*cos(phi)**2
rotated_tensor(1,2)=scalar*sin(theta)**2*sin(phi)*cos(phi)
rotated_tensor(1,3)=scalar*sin(theta)*cos(theta)*cos(phi)
rotated_tensor(2,1)=rotated_tensor(1,2)
rotated_tensor(2,2)=scalar*sin(theta)**2*sin(phi)**2
rotated_tensor(2,3)=scalar*sin(theta)*cos(theta)*sin(phi)
rotated_tensor(3,1)=rotated_tensor(1,3)
rotated_tensor(3,2)=rotated_tensor(2,3)
rotated_tensor(3,3)=scalar*cos(theta)**2
end function align_with_radial
end module gls
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyTheme" parent="android:Theme.Material">
</style>
</resources>
| {
"pile_set_name": "Github"
} |
{p:v}
| {
"pile_set_name": "Github"
} |
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the SuperTux package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# Translators:
# Benjamin Leduc <[email protected]>, 2019
# mol1 <[email protected]>, 2019
# zecas <[email protected]>, 2019
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: SuperTux v0.6.0-1010-gefc33a183\n"
"Report-Msgid-Bugs-To: https://github.com/SuperTux/supertux/issues\n"
"POT-Creation-Date: 2019-11-24 01:44+0100\n"
"PO-Revision-Date: 2019-11-24 00:58+0000\n"
"Last-Translator: zecas <[email protected]>, 2019\n"
"Language-Team: French (https://www.transifex.com/arctic-games/teams/95/fr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: data/levels/bonus4/A_Narrow_Path.stl:3
msgid "A Narrow Path"
msgstr "Un Chemin Proche"
#: data/levels/bonus4/Beginning_The_Journey.stl:3
msgid "Beginning The Journey"
msgstr "Début de Quête"
#: data/levels/bonus4/Cave_of_Dreams.stl:3
msgid "Cave Of Dreams"
msgstr "Caverne Des Rêves"
#: data/levels/bonus4/Cold_Forest.stl:3
msgid "Cold Forest"
msgstr "Forêt Glacée"
#: data/levels/bonus4/Crystal_Mania.stl:3
msgid "Crystal Mania"
msgstr "La Folie Des Cristaux"
#: data/levels/bonus4/Deeper_Into_The_Mountains.stl:3
msgid "Deeper Into The Mountains"
msgstr "Au Plus Profond Des Montagnes"
#: data/levels/bonus4/Feeling_The_Nature.stl:3
msgid "Feeling The Nature"
msgstr "Sentir La Nature"
#: data/levels/bonus4/Fog_And_Mist.stl:3
msgid "Fog And Mist"
msgstr "Brume et Brouillard"
#: data/levels/bonus4/Forest_Mountains.stl:3
msgid "Forest Mountains"
msgstr "Montagnes Arborées"
#: data/levels/bonus4/Forest_Mountains.stl:140
msgid "#One Path contains enemies, the other treasure..."
msgstr "#Un Chemin recèle des ennemis, l'autre un trésor..."
#: data/levels/bonus4/Forest_Mountains.stl:145
#: data/levels/bonus4/Forest_Mountains.stl:150
msgid "#You can use this door to try the other way..."
msgstr "#Tu peux utiliser cette porte pour essayer l'autre chemin..."
#: data/levels/bonus4/Generic_Snow_Level.stl:3
msgid "Generic Snow Level"
msgstr "Niveau de Neige Générique"
#: data/levels/bonus4/Glacier_Danger.stl:3
msgid "Glacier Danger"
msgstr " Danger Glacier"
#: data/levels/bonus4/Halloween_Fields.stl:3
msgid "Halloween Fields"
msgstr "Prés d'Halloween"
#: data/levels/bonus4/Its_Halloween_Time.stl:3
msgid "It's Halloween Time!"
msgstr "C'est Halloween!"
#: data/levels/bonus4/Lets_Climb_That_Mountain.stl:3
msgid "Let's Climb That Mountain!"
msgstr "Grimpons à Cette Montagne!"
#: data/levels/bonus4/Night_Terrors.stl:3
msgid "Night Terrors"
msgstr "Terreurs Nocturnes"
#: data/levels/bonus4/Penguin_In_The_Bushes.stl:3
msgid "A Penguin In The Bushes"
msgstr "Un Manchot Dans Les Buissons"
#: data/levels/bonus4/Rainy_Swamps.stl:3
msgid "Rainy Swamps"
msgstr "Marécages Pluvieux"
#: data/levels/bonus4/Sky_High.stl:3
msgid "Sky High"
msgstr "Haut Ciel"
#: data/levels/bonus4/SnowMansLand.stl:3
msgid "SnowMan's Land"
msgstr "Terre du Yéti"
#: data/levels/bonus4/SnowMansLand.stl:86
msgid "#It sure is breezy today, huh?"
msgstr "#Ça caille aujourd'hui, non?"
#: data/levels/bonus4/Snowy_Sunset.stl:3
msgid "Snowy Sunset"
msgstr "Coucher du Soleil Enneigé"
#: data/levels/bonus4/Some_Icy_Path.stl:3
msgid "Some Icy Path"
msgstr "Quelques Chemins Gélés"
#: data/levels/bonus4/Some_Icy_Path.stl:115
msgid ""
"#You won't be able to pass, if you don't bring him something he wants..."
msgstr "#Tu ne peux pas passer, si tu ne lui apportes pas ce qu'il veut..."
#: data/levels/bonus4/Some_Icy_Path.stl:120
msgid "#Maybe this crystal is the right thing for this snowman...?"
msgstr "#Peut-être ce cristal est bon pour le yéti...?"
#: data/levels/bonus4/Some_Icy_Path.stl:125
msgid "#Great, now he's gone... I'll keep the crystal for myself."
msgstr "#Super, il est parti maintenant... Je vais me garder le cristal."
#: data/levels/bonus4/Spooky_Mansion.stl:3
msgid "Spooky Mansion"
msgstr "Manoir Frissonnant"
#: data/levels/bonus4/Stormy_Night.stl:3
msgid "Stormy Night"
msgstr "Nuit d'Orage"
#: data/levels/bonus4/Sunshine_Valley.stl:3
msgid "Sunshine Valley"
msgstr "Vallée Sous Le Soleil"
#: data/levels/bonus4/The_Way_Of_The_Snow.stl:3
msgid "The Way Of The Snow"
msgstr "Le Chemin De La Neige"
#: data/levels/bonus4/Too_Much_Water.stl:3
msgid "Too Much Water"
msgstr "Trop d'Eau"
#: data/levels/bonus4/Two_Tiny_Towers.stl:3
msgid "Two Tiny Towers"
msgstr "Les Deux petites Tours"
#: data/levels/bonus4/worldmap.stwm:3
msgid "Bonus Island IV"
msgstr "Île Bonus IV"
#: data/levels/bonus4/worldmap.stwm:210
msgid "Enter Forest Sector"
msgstr "Entrer Dans le Secteur Forestier"
#: data/levels/bonus4/worldmap.stwm:217
msgid "Enter Halloween Sector"
msgstr "Entrer Dans le Secteur Halloween"
#: data/levels/bonus4/worldmap.stwm:224
msgid "Enter Arctic Sector"
msgstr "Entrer Dans le Secteur Arctique"
#: data/levels/bonus4/worldmap.stwm:231 data/levels/bonus4/worldmap.stwm:238
#: data/levels/bonus4/worldmap.stwm:245 data/levels/bonus4/worldmap.stwm:252
#: data/levels/bonus4/worldmap.stwm:259 data/levels/bonus4/worldmap.stwm:266
msgid "Go Home"
msgstr "Retourner au point de départ"
#: data/levels/bonus4/worldmap.stwm:273
msgid "Go Back"
msgstr "Revenir"
#: data/levels/bonus4/worldmap.stwm:280
msgid "The next challenge awaits..."
msgstr "Le prochain défi attend..."
| {
"pile_set_name": "Github"
} |
#
# Makefile for the Linux kernel pci hotplug controller drivers.
#
obj-$(CONFIG_HOTPLUG_PCI) += pci_hotplug.o
obj-$(CONFIG_HOTPLUG_PCI_FAKE) += fakephp.o
obj-$(CONFIG_HOTPLUG_PCI_COMPAQ) += cpqphp.o
obj-$(CONFIG_HOTPLUG_PCI_IBM) += ibmphp.o
obj-$(CONFIG_HOTPLUG_PCI_ACPI) += acpiphp.o
obj-$(CONFIG_HOTPLUG_PCI_ACPI_IBM) += acpiphp_ibm.o
obj-$(CONFIG_HOTPLUG_PCI_CPCI_ZT5550) += cpcihp_zt5550.o
obj-$(CONFIG_HOTPLUG_PCI_CPCI_GENERIC) += cpcihp_generic.o
obj-$(CONFIG_HOTPLUG_PCI_PCIE) += pciehp.o
obj-$(CONFIG_HOTPLUG_PCI_SHPC) += shpchp.o
obj-$(CONFIG_HOTPLUG_PCI_RPA) += rpaphp.o
obj-$(CONFIG_HOTPLUG_PCI_RPA_DLPAR) += rpadlpar_io.o
obj-$(CONFIG_HOTPLUG_PCI_SGI) += sgi_hotplug.o
pci_hotplug-objs := pci_hotplug_core.o
ifdef CONFIG_HOTPLUG_PCI_CPCI
pci_hotplug-objs += cpci_hotplug_core.o \
cpci_hotplug_pci.o
endif
ifdef CONFIG_ACPI
pci_hotplug-objs += acpi_pcihp.o
endif
cpqphp-objs := cpqphp_core.o \
cpqphp_ctrl.o \
cpqphp_sysfs.o \
cpqphp_pci.o
cpqphp-$(CONFIG_HOTPLUG_PCI_COMPAQ_NVRAM) += cpqphp_nvram.o
cpqphp-objs += $(cpqphp-y)
ibmphp-objs := ibmphp_core.o \
ibmphp_ebda.o \
ibmphp_pci.o \
ibmphp_res.o \
ibmphp_hpc.o
acpiphp-objs := acpiphp_core.o \
acpiphp_glue.o
rpaphp-objs := rpaphp_core.o \
rpaphp_pci.o \
rpaphp_slot.o
rpadlpar_io-objs := rpadlpar_core.o \
rpadlpar_sysfs.o
pciehp-objs := pciehp_core.o \
pciehp_ctrl.o \
pciehp_pci.o \
pciehp_hpc.o
shpchp-objs := shpchp_core.o \
shpchp_ctrl.o \
shpchp_pci.o \
shpchp_sysfs.o \
shpchp_hpc.o
| {
"pile_set_name": "Github"
} |
/**
* This method returns `false`.
*
* @static
* @memberOf _
* @since 4.13.0
* @category Util
* @returns {boolean} Returns `false`.
* @example
*
* _.times(2, _.stubFalse);
* // => [false, false]
*/
function stubFalse() {
return false;
}
module.exports = stubFalse;
| {
"pile_set_name": "Github"
} |
/*
* jPOS Project [http://jpos.org]
* Copyright (C) 2000-2020 jPOS Software SRL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.jpos.iso;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import org.junit.jupiter.api.Test;
public class EbcdicBinaryInterpreterTest {
public static final BinaryInterpreter interpreter = EbcdicBinaryInterpreter.INSTANCE;
public static final byte[] EBCDICDATA = ISOUtil.hex2byte(
"F1F2F3F4F5F6F7F8F9F0C1C2C3C4C5C6C7C8C9D1D2D3D4D5D6D7D8D9E2E3E4E5E6E7E8E9818283848586878"
+"889919293949596979899A2A3A4A5A6A7A8A95FC0D0ADBD7F7E7D7C7A4F6B6C6D4C6E6F5A5C50");
final static byte[] binaryData = "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz^{}[]\"='@:|,%_<>?!*&".getBytes();
@Test
public void interpret() {
byte[] result = new byte[binaryData.length];
interpreter.interpret(binaryData, result, 0);
assertThat(result, is(EBCDICDATA));
}
@Test
public void uninterpret() {
int offset = 0;
int length = EBCDICDATA.length;
byte[] result = interpreter.uninterpret(EBCDICDATA, offset, length);
assertThat(result, is(binaryData));
}
}
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Topics | FOSSASIA</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="../sites/default/files/fever_favicon.ico" type="image/x-icon" />
<link type="text/css" rel="stylesheet" media="all" href="https://2010.fossasia.org/modules/node/node.css?e" /> <link type="text/css" rel="stylesheet" media="all" href="https://2010.fossasia.org/modules/system/defaults.css?e" /> <link type="text/css" rel="stylesheet" media="all" href="https://2010.fossasia.org/modules/system/system.css?e" /> <link type="text/css" rel="stylesheet" media="all" href="https://2010.fossasia.org/modules/system/system-menus.css?e" /> <link type="text/css" rel="stylesheet" media="all" href="https://2010.fossasia.org/modules/user/user.css?e" /> <link type="text/css" rel="stylesheet" media="all" href="../sites/all/modules/cck/theme/[email protected]" /> <link type="text/css" rel="stylesheet" media="all" href="../sites/all/modules/ctools/css/[email protected]" /> <link type="text/css" rel="stylesheet" media="all" href="../sites/all/modules/dhtml_menu/[email protected]" /> <link type="text/css" rel="stylesheet" media="all" href="../sites/all/modules/filefield/[email protected]" /> <link type="text/css" rel="stylesheet" media="all" href="../sites/all/modules/panels/css/[email protected]" /> <link type="text/css" rel="stylesheet" media="all" href="../sites/all/modules/cck/modules/fieldgroup/[email protected]" /> <link type="text/css" rel="stylesheet" media="all" href="../sites/all/modules/views/css/[email protected]" /> <link type="text/css" rel="stylesheet" media="all" href="../sites/all/themes/fever/css/[email protected]" /> <link type="text/css" rel="stylesheet" media="all" href="../sites/all/themes/fever/css/[email protected]" /> <link type="text/css" rel="stylesheet" media="all" href="../sites/default/files/customcssjs/css/[email protected]" /> <!--[if IE 7]>
<link type="text/css" rel="stylesheet" href="/sites/all/themes/fever/css/ie.css" media="screen">
<![endif]-->
<script type="text/javascript" src="../sites/all/modules/jquery_update/replace/jquery.min.js@e"></script>
<script type="text/javascript" src="https://2010.fossasia.org/misc/drupal.js?e"></script>
<script type="text/javascript" src="../sites/all/modules/dhtml_menu/dhtml_menu.js@e"></script>
<script type="text/javascript" src="../sites/all/modules/panels/js/panels.js@e"></script>
<script type="text/javascript" src="../sites/all/modules/views/js/base.js@e"></script>
<script type="text/javascript" src="../sites/all/modules/views/js/ajax_view.js@e"></script>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
jQuery.extend(Drupal.settings, { "basePath": "/", "dhtmlMenu": { "slide": "slide", "clone": "clone", "siblings": 0, "relativity": 0, "children": 0, "doubleclick": 0 }, "views": { "ajax_path": "/views/ajax", "ajaxViews": [ { "view_name": "topic_views", "view_display_id": "page_1", "view_args": "", "view_path": "2010/events", "view_base_path": "2010/events", "view_dom_id": 1, "pager_element": 0 } ] } });
//--><!]]>
</script>
</head>
<body class="not-front not-logged-in one-sidebar sidebar-right i18n-en">
<div id="page">
<div id="header"><div id="header-inner" class="clearfix">
<div id="secondary"><div id="secondary-inner-wrapper"><div id="secondary-inner">
<ul class="links"><li class="menu-354 first"><a href="http://fossasia.org" title="">Home</a></li>
<li class="menu-332"><a href="../about.html" title="">About</a></li>
<li class="menu-959"><a href="https://groups.google.com/group/fossasia" title="">Mailing List</a></li>
<li class="menu-4180 last"><a href="../contact.html">Contact</a></li>
</ul> </div></div></div>
<div id="logo-title">
<div id="logo"><a href="../index.html" title="Home" rel="home"><img src="../sites/default/files/fever_logo.png" alt="Home" id="logo-image" /></a></div>
<div id="site-slogan">Open Technology<br />Developer Summit<br />12-14 Nov. 2010<br /></div>
</div>
</div></div>
<div id="navbar"><div id="navbar-inner" class="clearfix">
<div id="primary-left" class="withoutsearch">
<div id="primary-right"><div id="primary">
<ul class="menu"><li class="expanded first no-dhtml active-trail"><a href="../schedule.html" id="dhtml_menu-816"><span>Schedule</span></a><ul class="menu"><li class="leaf first no-dhtml "><a href="../minidebconf.html" id="dhtml_menu-814"><span>MiniDebConf</span></a></li>
<li class="leaf no-dhtml "><a href="../unconference.html" id="dhtml_menu-674"><span>Unconference</span></a></li>
<li class="leaf no-dhtml active-trail"><a href="events.html" title="" id="dhtml_menu-524" class="active"><span>Sessions</span></a></li>
<li class="leaf no-dhtml "><a href="speakers.html" title="" id="dhtml_menu-391"><span>Speakers</span></a></li>
<li class="leaf no-dhtml "><a href="events/friday.html" title="" id="dhtml_menu-799"><span>Friday</span></a></li>
<li class="leaf no-dhtml "><a href="events/saturday.html" title="" id="dhtml_menu-800"><span>Saturday</span></a></li>
<li class="leaf last no-dhtml "><a href="events/sunday.html" title="" id="dhtml_menu-801"><span>Sunday</span></a></li>
</ul></li>
<li class="expanded no-dhtml "><a href="../location.html" id="dhtml_menu-353"><span>Location</span></a><ul class="menu"><li class="leaf first last no-dhtml "><a href="../hotels-accommodation.html" id="dhtml_menu-544"><span>Hotels & Accommodation</span></a></li>
</ul></li>
<li class="leaf no-dhtml "><a href="venue.html" id="dhtml_menu-356"><span>Venue</span></a></li>
<li class="leaf no-dhtml "><a href="coming.html" id="dhtml_menu-525"><span>Who's Coming</span></a></li>
<li class="leaf no-dhtml "><a href="http://2011.fossasia.org" id="dhtml_menu-3528"><span>FOSSASIA '11</span></a></li>
<li class="leaf no-dhtml "><a href="http://blog.fossasia.org" id="dhtml_menu-1781"><span>Blog</span></a></li>
<li class="leaf last no-dhtml "><a href="http://events.fossasia.org" title="" id="dhtml_menu-4231"><span>FOSSASIA Events</span></a></li>
</ul> </div></div></div>
</div></div>
<div id="top-border"></div>
<div id="main">
<div id="main-inner" class="clearfix">
<div>
<div id="content-top">
<div id="breadcrumb-wrapper"><div id="breadcrumb">You are here: <div class="breadcrumb"><a href="../index.html">Home</a> » <a href="../schedule.html" title="">Schedule</a> » <a href="events.html" class="active">Sessions</a></div></div></div> <div id="content-top-inner">
<div id="content-wrapper" class="clearfix">
<div id="content">
<div id="content-header">
<h1 class="title">Topics</h1> </div>
<div class="view view-topic-views view-id-topic_views view-display-id-page_1 view-dom-id-1">
</div> </div>
</div>
</div>
</div>
<div id="sidebar-right">
<div class="block block-locale region-count-1 ">
<div class="block-inner clearfix">
<h2 class="title"><span class="first-word">Choose</span> Languages</h2>
<div class="makeup"></div>
<div class="content">
<ul><li class="en first active"><a href="events.html" class="language-link active">English</a></li>
<li class="vi last"><a href="../vi/2010/events.html" class="language-link">Tiếng Việt</a></li>
</ul> </div>
</div>
</div>
<div class="block block-block region-count-2 ">
<div class="block-inner clearfix">
<h2 class="title"><span class="first-word">Twitter</span></h2>
<div class="makeup"></div>
<div class="content">
<a class="twitter-timeline" data-dnt="true" href="https://twitter.com/fossasia" data-widget-id="312420098352742400">Tweets by @fossasia</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
<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-17146009-5', 'auto');
ga('send', 'pageview');
</script> </div>
</div>
</div>
<div class="block block-block region-count-3 ">
<div class="block-inner clearfix">
<h2 class="title"><span class="first-word">Schedule</span></h2>
<div class="makeup"></div>
<div class="content">
<ul class="menu"><li class="leaf first no-dhtml "><a href="../minidebconf.html"><span>MiniDebConf</span></a></li> <li class="leaf no-dhtml "><a href="../unconference.html"><span>Unconference</span></a></li> <li class="leaf no-dhtml "><a href="https://2010.fossasia.org/events"><span>Sessions</span></a></li> <li class="leaf no-dhtml "><a href="https://2010.fossasia.org/speakers"><span>Speakers</span></a></li> <li class="leaf no-dhtml "><a href="https://2010.fossasia.org/events/friday"><span>Friday</span></a></li> <li class="leaf no-dhtml active-trail"><a href="https://2010.fossasia.org/events/saturday"><span>Saturday</span></a></li> <li class="leaf last no-dhtml "><a href="https://2010.fossasia.org/events/sunday"><span>Sunday</span></a></li> </ul> </div>
</div>
</div>
<div class="block block-views region-count-4 ">
<div class="block-inner clearfix">
<h2 class="title"><span class="first-word">Organizer</span></h2>
<div class="makeup"></div>
<div class="content">
<div class="view view-sponsor-list view-id-sponsor_list view-display-id-block_1 view-dom-id-2">
<div class="view-content">
<div class="views-row views-row-1 views-row-odd views-row-first">
<div class="views-field-field-sponsor-logo-fid">
<span class="field-content"><a href="../sponsors/mbm-international.html" class="imagefield imagefield-nodelink imagefield-field_sponsor_logo"><img class="imagefield imagefield-field_sponsor_logo" width="200" height="57" alt="" src="../sites/default/files/mbm_logo_1.png@1286510326" /></a></span>
</div>
</div>
<div class="views-row views-row-2 views-row-even views-row-last">
<div class="views-field-field-sponsor-logo-fid">
<span class="field-content"><a href="../sponsors/qtsconline-cloud-service-provider.html" class="imagefield imagefield-nodelink imagefield-field_sponsor_logo"><img class="imagefield imagefield-field_sponsor_logo" width="157" height="110" alt="" src="../sites/default/files/qtsconline_logo_1.png@1286529128" /></a></span>
</div>
</div>
</div>
</div> </div>
</div>
</div>
<div class="block block-views region-count-5 ">
<div class="block-inner clearfix">
<h2 class="title"><span class="first-word">Host</span></h2>
<div class="makeup"></div>
<div class="content">
<div class="view view-sponsor-list view-id-sponsor_list view-display-id-block_3 view-dom-id-3">
<div class="view-content">
<div class="views-row views-row-1 views-row-odd views-row-first views-row-last">
<div class="views-field-field-sponsor-logo-fid">
<span class="field-content"><a href="../sponsors/raffles-international-college.html" class="imagefield imagefield-nodelink imagefield-field_sponsor_logo"><img class="imagefield imagefield-field_sponsor_logo" width="200" height="73" alt="" src="../sites/default/files/raffles.png@1286512248" /></a></span>
</div>
</div>
</div>
</div> </div>
</div>
</div>
<div class="block block-block region-count-6 ">
<div class="block-inner clearfix">
<h2 class="title"><span class="first-word">Projects</span></h2>
<div class="makeup"></div>
<div class="content">
<div class="project-list"><ul><li><a title="Debian" href="https://www.debian.org/"><img src="../sites/default/files/project/debian.png" alt="Debian" width="75"></a></li><li><a href="https://www.drupal.org"><img src="../sites/default/files/project/drupal.png" alt="Drupal" width="68"></a></li><li><a href="https://fedoraproject.org"><img src="../sites/default/files/project/fedora.png" alt="" width="100"></a></li><li><a href="http://www.blackray.org"><img src="../sites/default/files/project/blackray.png" alt="BlackRay" width="100"></a></li><li><a href="http://lubuntu.net"><img src="../sites/default/files/project/lubuntu.png" alt="" width="100"></a></li><li><a href="https://mozilla.org"><img src="../sites/default/files/project/mozilla.png" alt="" width="100"></a></li><li><a title="OPENDESIGN.ASIA" href="http://opendesign.asia"><img src="../sites/default/files/project/opendesign.png" alt="OpenDesign.Asia" width="100"></a></li><li><a href="http://nosql-database.org"><img src="../sites/default/files/project/nosql.png" alt="" width="100"></a></li><li><a href="http://olpc.vn"><img src="../sites/default/files/project/olpc.png" alt="" width="100"></a></li><li><a href="https://status.net"><img src="../sites/default/files/project/statusnet.png" alt="" width="100"></a></li><li><a href="http://tiddlywiki.com"><img src="../sites/default/files/project/tiddlywiki.png" alt="" width="100"></a></li><li><a href="http://yacy.net"><img src="../sites/default/files/project/yacy.png" alt="YaCy.net" width="100"></a></li><li><a href="http://ubuntu-vn.org"><img src="../sites/default/files/project/ubuntu_vn.png" alt="" width="100"></a></li><li><a href="http://xpud.org"><img src="../sites/default/files/project/xpud.png" alt="xPUD" width="100"></a></li><li><a href="http://www.exoplatform.com"><img src="../sites/default/files/project/exo.png" alt="" width="100"></a></li><li><a href="https://freifunk.net/"><img src="../sites/default/files/project/freifunk.png" alt="" width="100"></a></li><li><a title="Joomla" href="https://www.joomla.org"><img src="../sites/default/files/project/joomla-logo.png" alt="Joomla" width="100"></a></li><li><a title="Libre Graphics" href="http://libregraphicsmeeting.org"><img src="../sites/default/files/project/libregraphics.png" alt="Libre Graphics" width="100"></a></li><li><a href="http://www.android.com"><img src="../sites/default/files/project/android.png" alt="Android" width="100"></a></li><li><a title="MariaDB" href="https://www.mariadb.org"><img src="../sites/default/files/project/mariadb.png" alt="MariaDB" width="100"></a></li><li><a title="TomatoCMS" href="http://tomatocms.com"><img src="../sites/default/files/project/tomatocms.png" alt="TomatoCMS" width="100"></a></li><li><a title="Sahana Eden" href="http://eden.sahanafoundation.org"><img src="../sites/default/files/project/sahana_eden.png" alt="Sahana Eden"></a></li><li><a title="TYPO 3" href="https://www.typo3.com/"><img src="../sites/default/files/project/typo3.png" alt="Typo 3"></a></li></ul></div> </div>
</div>
</div>
<div class="block block-views region-count-7 ">
<div class="block-inner clearfix">
<h2 class="title"><span class="first-word">Sponsors</span></h2>
<div class="makeup"></div>
<div class="content">
<div class="view view-sponsor-list view-id-sponsor_list view-display-id-block_5 view-dom-id-4">
<div class="view-content">
<div class="views-row views-row-1 views-row-odd views-row-first">
<div class="views-field-field-sponsor-logo-fid">
<span class="field-content"><a href="../sponsors/openofficeorg.html" class="imagefield imagefield-nodelink imagefield-field_sponsor_logo"><img class="imagefield imagefield-field_sponsor_logo" width="200" height="63" alt="" src="../sites/default/files/openoffice.png@1288920591" /></a></span>
</div>
</div>
<div class="views-row views-row-2 views-row-even">
<div class="views-field-field-sponsor-logo-fid">
<span class="field-content"><a href="https://2010.fossasia.org/sponsors/seacem" class="imagefield imagefield-nodelink imagefield-field_sponsor_logo"><img class="imagefield imagefield-field_sponsor_logo" width="200" height="28" alt="" src="../sites/default/files/seacem.png@1286513214" /></a></span>
</div>
</div>
<div class="views-row views-row-3 views-row-odd views-row-last">
<div class="views-field-field-sponsor-logo-fid">
<span class="field-content"><a href="../sponsors/web-essentials.html" class="imagefield imagefield-nodelink imagefield-field_sponsor_logo"><img class="imagefield imagefield-field_sponsor_logo" width="200" height="36" alt="" src="../sites/default/files/webessentials.png@1287712884" /></a></span>
</div>
</div>
</div>
</div> </div>
</div>
</div>
<div class="block block-views region-count-8 ">
<div class="block-inner clearfix">
<h2 class="title"><span class="first-word">Media</span> Partner</h2>
<div class="makeup"></div>
<div class="content">
<div class="view view-sponsor-list view-id-sponsor_list view-display-id-block_9 view-dom-id-5">
<div class="view-content">
<div class="views-row views-row-1 views-row-odd views-row-first views-row-last">
<div class="views-field-field-sponsor-logo-fid">
<span class="field-content"><a href="http://www.pcworld.com.vn"><img src="../sites/default/files/imagecache/sponsor_logo/TGVT logo.gif" alt="" title="" width="210" height="58" class="imagecache imagecache-sponsor_logo imagecache-default imagecache-sponsor_logo_default" /></a></span>
</div>
</div>
</div>
</div> </div>
</div>
</div>
<div class="block block-views region-count-9 ">
<div class="block-inner clearfix">
<h2 class="title"><span class="first-word">Partners</span></h2>
<div class="makeup"></div>
<div class="content">
<div class="view view-sponsor-list view-id-sponsor_list view-display-id-block_7 view-dom-id-6">
<div class="view-content">
<div class="views-row views-row-1 views-row-odd views-row-first views-row-last">
<div class="views-field-field-sponsor-logo-fid">
<span class="field-content"><a href="../sponsors/qhoach.html" class="imagefield imagefield-nodelink imagefield-field_sponsor_logo"><img class="imagefield imagefield-field_sponsor_logo" width="200" height="51" alt="" src="../sites/default/files/qhoach-logo-en.png@1288928650" /></a></span>
</div>
</div>
</div>
</div> </div>
</div>
</div>
<div class="block block-block region-count-10 ">
<div class="block-inner clearfix">
<h2 class="title"><span class="first-word">Hotel</span> Partner</h2>
<div class="makeup"></div>
<div class="content">
<a title="Hotel Cantho" href="http://hotelxoai.com"><img src="../sites/default/files/canthohotelmekong.png" alt="Hotel Cantho Vietnam Mekong" width="200" height="149"></a> </div>
</div>
</div> </div>
</div>
<div id="content-bottom"><div id="content-bottom-inner" class="content_bottom-2 clearfix">
<div id="content-bottom-one" class="column">
<div class="block block-menu region-count-1 ">
<div class="block-inner clearfix">
<h2 class="title"><span class="first-word">Our</span> Friends</h2>
<div class="makeup"></div>
<div class="content">
<ul class="menu"><li class="leaf first dhtml-menu "><a href="http://icos.org.tw/" id="dhtml_menu-349-1">ICOS, Taiwan</a></li>
<li class="leaf dhtml-menu "><a href="http://hpdang.com" id="dhtml_menu-343-1">HPDang</a></li>
<li class="leaf dhtml-menu "><a href="http://www.fisl.org.br/" id="dhtml_menu-344-1">FISL, Brazil</a></li>
<li class="leaf dhtml-menu "><a href="https://www.fosdem.org/" id="dhtml_menu-345-1">FOSDEM, Brussels</a></li>
<li class="leaf dhtml-menu "><a href="http://perspektive89.com" id="dhtml_menu-2967-1">Perspektive'89</a></li>
<li class="leaf dhtml-menu "><a href="http://libregraphics.asia" id="dhtml_menu-346-1">Libre Graphics Images Indonesia</a></li>
<li class="leaf dhtml-menu "><a href="http://mekongtours.info" id="dhtml_menu-347-1">Fair Travel Mekong Tours Agency</a></li>
<li class="leaf dhtml-menu "><a href="https://www.froscon.de" id="dhtml_menu-2966-1">FrOScon</a></li>
<li class="leaf dhtml-menu "><a href="http://hackerspace.sg" id="dhtml_menu-1780-1">Hackerspace Singapore</a></li>
<li class="leaf dhtml-menu "><a href="https://www.laquadrature.net" id="dhtml_menu-2968-1">La Quadrature du Net</a></li>
<li class="leaf dhtml-menu "><a href="http://www.typo3cambodia.org" id="dhtml_menu-1779-1">Typo3 Cambodia</a></li>
<li class="leaf last dhtml-menu "><a href="http://meshcon.net" id="dhtml_menu-3526-1">MeshCon FashionTec Week</a></li>
</ul> </div>
</div>
</div> </div>
<div id="content-bottom-two" class="column">
<div class="block block-block region-count-1 ">
<div class="block-inner clearfix">
<h2 class="title"><span class="first-word">Face</span> Book</h2>
<div class="makeup"></div>
<div class="content">
<iframe scrolling="no" frameborder="0" allowtransparency="true" style="border: medium none; overflow: hidden; width: 400px; height: 206px;" src="https://www.facebook.com/plugins/likebox.php?id=126893747338271&width=400&connections=24&stream=false&header=false&height=206"></iframe> </div>
</div>
</div>
<div class="block block-menu region-count-2 ">
<div class="block-inner clearfix">
<h2 class="title"><span class="first-word">FOSSASIA</span></h2>
<div class="makeup"></div>
<div class="content">
<ul class="menu"><li class="leaf first dhtml-menu "><a href="http://fossasia.org" id="dhtml_menu-3511-1">FOSSASIA Website</a></li>
<li class="leaf last dhtml-menu "><a href="http://2011.fossasia.org" id="dhtml_menu-3510-1">FOSSASIA 2011</a></li>
</ul> </div>
</div>
</div> </div>
</div></div>
</div>
</div>
<div id="bottom-border"></div>
<div id="closure"><div id="closure-inner" class="clearfix"><div id="designed-by"><small>Site by <a href="http://www.mbm.vn" title="MBM International">MBM</a></small></div>
<div class="block block-block region-count-1 ">
<div class="block-inner clearfix">
<div class="content">
<a href="https://plus.google.com/108920596016838318216" rel="publisher">Google+</a> </div>
</div>
</div>
<div class="block block-block region-count-2 ">
<div class="block-inner clearfix">
<div class="content">
<p><a rel="license" href="https://creativecommons.org/licenses/by-sa/3.0/"><img style="border-width: 0pt;" src="https://i.creativecommons.org/l/by-sa/3.0/80x15.png" alt="Creative Commons License"></a> Site under <a rel="license" href="https://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-Share Alike</a> » Substance: <a href="https://drupal.org/">Drupal</a></p> </div>
</div>
</div> </div></div>
</div>
</body>
</html>
| {
"pile_set_name": "Github"
} |
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001 - 2004. All Rights Reserved.
*
* 3GPP features implementation is based on 3GPP's TS26.234-v5.60,
* and was contributed by Ximpo Group Ltd.
*
* Portions created by Ximpo Group Ltd. are
* Copyright (C) Ximpo Group Ltd. 2003, 2004. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie [email protected]
* Alix Marchandise-Franquet [email protected]
* Ximpo Group Ltd. [email protected]
*/
#include "src/impl.h"
namespace mp4v2 {
namespace impl {
///////////////////////////////////////////////////////////////////////////////
MP4StsdAtom::MP4StsdAtom(MP4File &file)
: MP4Atom(file, "stsd")
{
AddVersionAndFlags();
MP4Integer32Property* pCount =
new MP4Integer32Property(*this, "entryCount");
pCount->SetReadOnly();
AddProperty(pCount);
ExpectChildAtom("mp4a", Optional, Many);
ExpectChildAtom("enca", Optional, Many);
ExpectChildAtom("mp4s", Optional, Many);
ExpectChildAtom("mp4v", Optional, Many);
ExpectChildAtom("encv", Optional, Many);
ExpectChildAtom("rtp ", Optional, Many);
ExpectChildAtom("samr", Optional, Many); // For AMR-NB
ExpectChildAtom("sawb", Optional, Many); // For AMR-WB
ExpectChildAtom("s263", Optional, Many); // For H.263
ExpectChildAtom("avc1", Optional, Many);
ExpectChildAtom("alac", Optional, Many);
ExpectChildAtom("text", Optional, Many);
ExpectChildAtom("ac-3", Optional, Many);
}
void MP4StsdAtom::Read()
{
/* do the usual read */
MP4Atom::Read();
// check that number of children == entryCount
MP4Integer32Property* pCount =
(MP4Integer32Property*)m_pProperties[2];
if (m_pChildAtoms.Size() != pCount->GetValue()) {
log.warningf("%s: \"%s\": stsd inconsistency with number of entries",
__FUNCTION__, GetFile().GetFilename().c_str() );
/* fix it */
pCount->SetReadOnly(false);
pCount->SetValue(m_pChildAtoms.Size());
pCount->SetReadOnly(true);
}
}
///////////////////////////////////////////////////////////////////////////////
}
} // namespace mp4v2::impl
| {
"pile_set_name": "Github"
} |
package form
import com.google.i18n.phonenumbers.PhoneNumberUtil
import com.gu.identity.model.TelephoneNumber
import scala.util._
import play.api.data.Forms._
import play.api.data.Mapping
import scala.util.Success
import scala.util.Failure
import play.api.i18n.{Messages, MessagesProvider}
trait TelephoneNumberMapping {
def telephoneNumberMapping(implicit messagesProvider: MessagesProvider): Mapping[TelephoneNumberFormData] =
mapping(
"countryCode" -> optional(text),
"localNumber" -> optional(text),
)(TelephoneNumberFormData.apply)(TelephoneNumberFormData.unapply) verifying (
Messages("error.telephoneNumber"),
data => data.isValid
)
}
case class TelephoneNumberFormData(countryCode: Option[String], localNumber: Option[String]) {
lazy val telephoneNumber: Option[TelephoneNumber] = (countryCode, localNumber) match {
case (Some(cc), Some(ln)) => Some(TelephoneNumber(Some(cc), Some(ln)))
case _ => None
}
lazy val isValid: Boolean = {
(countryCode, localNumber) match {
case (Some(cc), Some(ln)) =>
val internationalNumber = s"+$cc$ln"
val phoneUtil = PhoneNumberUtil.getInstance()
Try {
val parsed = phoneUtil.parse(internationalNumber, "")
phoneUtil.isValidNumber(parsed)
} match {
case Success(result) => result
case Failure(t) => false
}
case (Some(cc), None) => false
case (None, Some(ln)) => false
case _ => true
}
}
}
object TelephoneNumberFormData {
def apply(telephoneNumber: TelephoneNumber): TelephoneNumberFormData =
TelephoneNumberFormData(
telephoneNumber.countryCode,
telephoneNumber.localNumber,
)
}
| {
"pile_set_name": "Github"
} |
/* eslint-disable global-require, import/no-dynamic-require */
import fs from 'fs'
import path from 'path'
import parseColor from 'color-parse'
import { TextStyles } from 'react-sketchapp'
import { FileFormat1 } from '@sketch-hq/sketch-file-format-ts'
import { ColorToken, TextStyleToken, ShadowToken } from 'lonac/types'
import createComponentLayerCollection from './component-layer-collection'
import { Component } from './measure-component'
import { Preset } from './device-info'
type Config = {
paths: {
output: string
sketchFile: string
workspace: string
components: string[]
}
tokens: {
colors: ColorToken[]
textStyles: TextStyleToken[]
shadows: ShadowToken[]
}
devicePresetList: Preset[]
componentPathFilter: (filePath: string) => boolean
}
function loadComponent(config: Config, componentPath: string): Component {
const relativeComponentPath = path
.relative(config.paths.workspace, componentPath)
.replace(/\.component$/gi, '')
try {
return {
name: relativeComponentPath,
compiled: require(path.join(config.paths.output, relativeComponentPath))
.default,
meta: JSON.parse(fs.readFileSync(componentPath, 'utf8')),
}
} catch (err) {
console.error(`Failed to load ${componentPath}`)
console.error(err)
return undefined
}
}
function arrangeComponentLayerCollections(
collections: ReturnType<typeof createComponentLayerCollection>[]
) {
return collections.reduce<{
offset: number
layers: (FileFormat1.SymbolMaster | FileFormat1.Artboard)[]
}>(
(acc, collection) => {
const { layers, offset } = acc
const { artboard, symbols } = collection
const arranged = [artboard, ...symbols].map(layer => {
layer.frame.y += offset
return layer
})
return {
layers: layers.concat(arranged),
offset: offset + artboard.frame.height + 96,
}
},
{
layers: [],
offset: 0,
}
).layers
}
export default (config: Config) => {
const colors = config.tokens.colors
.map(color => {
const parsed = parseColor(color.value.value.css)
if (!parsed) {
return undefined
}
return {
name: color.qualifiedName.join('/'),
red: parsed.values[0] / 255,
green: parsed.values[1] / 255,
blue: parsed.values[2] / 255,
alpha: parsed.alpha,
}
})
.filter(x => x)
TextStyles.create(
config.tokens.textStyles.reduce((prev, k) => {
const name = k.qualifiedName.join('/')
prev[name] = {
...k.value.value,
...(k.value.value.color ? { color: k.value.value.color.css } : {}),
}
return prev
}, {})
)
const components: Component[] = config.paths.components
.filter(componentPath => {
const relativeComponentPath = path
.relative(config.paths.workspace, componentPath)
.replace(/\.component$/gi, '')
return config.componentPathFilter(relativeComponentPath)
})
.map(componentPath => loadComponent(config, componentPath))
.filter(x => x)
const collections = components
.map(component => {
try {
return createComponentLayerCollection(
component,
config.devicePresetList
)
} catch (err) {
console.error(`Skipping ${component.name} due to an error`)
console.error(err)
return undefined
}
})
.filter(x => x)
return {
layers: arrangeComponentLayerCollections(collections),
textStyles: TextStyles.toJSON(),
colors,
}
}
| {
"pile_set_name": "Github"
} |
//
// MIT License
//
// Copyright (c) 2014 Bob McCune http://bobmccune.com/
// Copyright (c) 2014 TapHarmonic, LLC http://tapharmonic.com/
//
// 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.
//
#import "THTabBarView.h"
#define BUTTON_MARGIN 10.0f
#define BUTTON_WIDTH 56.0f
@interface THTabBarView ()
@property (strong, nonatomic) UIImageView *backgroundImageView;
@end
@implementation THTabBarView
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin;
_backgroundImageView = [[UIImageView alloc] initWithFrame:frame];
[self addSubview:_backgroundImageView];
}
return self;
}
- (void)setBackgroundImage:(UIImage *)image {
self.backgroundImageView.image = image;
}
- (void)setTabBarButtons:(NSArray *)buttons {
// Remove existing items
for (id button in _tabBarButtons) {
[button removeFromSuperview];
}
_tabBarButtons = [buttons copy];
if (_tabBarButtons.count > 0) {
[[_tabBarButtons objectAtIndex:0] setSelected:YES];
self.selectedTabBarButton = [_tabBarButtons objectAtIndex:0];
if (self.delegate && [self.delegate respondsToSelector:@selector(tabBar:didSelectTabAtIndex:)]) {
[self.delegate tabBar:self didSelectTabAtIndex:0];
}
}
for (id button in _tabBarButtons) {
[button addTarget:self action:@selector(selectTabIfAllowed:) forControlEvents:UIControlEventTouchDown];
}
[self setNeedsLayout];
}
- (NSUInteger)selectedTabBarButtonIndex {
return [self.tabBarButtons indexOfObject:self.selectedTabBarButton];
}
- (void)layoutSubviews {
self.backgroundImageView.frame = self.bounds;
// Calculate the total width from the left edge of the leftmost button to the right edge of the rightmost button
CGFloat buttonLayoutWidth = (BUTTON_WIDTH * self.tabBarButtons.count) + (BUTTON_MARGIN * (self.tabBarButtons.count - 1));
// Calculate the X-origin point at which to start drawing the buttons
CGFloat startOrigin = ((self.bounds.size.width - buttonLayoutWidth) / 2);
CGFloat buttonMargin = BUTTON_MARGIN;
// Create tab bar button item frame
CGRect frame = CGRectMake(startOrigin, self.bounds.origin.y + 5.0, BUTTON_WIDTH, self.bounds.size.height - 8);
for (id button in self.tabBarButtons) {
[button setFrame:frame];
[self addSubview:button];
frame.origin.x += (frame.size.width + buttonMargin);
}
}
- (void)selectTabIfAllowed:(id)sender {
if ([self.delegate tabBar:self canSelectTabAtIndex:[self.tabBarButtons indexOfObject:sender]]) {
// Only trigger selection change if new tab selected
if (self.selectedTabBarButton != sender) {
for (id item in self.tabBarButtons) {
[item setSelected:NO];
}
[sender setSelected:YES];
self.selectedTabBarButton = sender;
}
if (self.delegate && [self.delegate respondsToSelector:@selector(tabBar:didSelectTabAtIndex:)]) {
[self.delegate tabBar:self didSelectTabAtIndex:[self.tabBarButtons indexOfObject:sender]];
}
}
}
@end
| {
"pile_set_name": "Github"
} |
#####################################
# Wrapper for rpl_insert_ignore.test#
#####################################
-- source include/not_group_replication_plugin.inc
-- source include/have_binlog_format_row.inc
-- source include/not_ndb_default.inc
-- source include/have_rocksdb.inc
-- source include/master-slave.inc
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
-- let $engine_type=rocksdb
-- source extra/rpl_tests/rpl_insert_ignore.test
-- source include/rpl_end.inc
| {
"pile_set_name": "Github"
} |
// go run mksysnum.go https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build arm64,freebsd
package unix
const (
// SYS_NOSYS = 0; // { int nosys(void); } syscall nosys_args int
SYS_EXIT = 1 // { void sys_exit(int rval); } exit sys_exit_args void
SYS_FORK = 2 // { int fork(void); }
SYS_READ = 3 // { ssize_t read(int fd, void *buf, size_t nbyte); }
SYS_WRITE = 4 // { ssize_t write(int fd, const void *buf, size_t nbyte); }
SYS_OPEN = 5 // { int open(char *path, int flags, int mode); }
SYS_CLOSE = 6 // { int close(int fd); }
SYS_WAIT4 = 7 // { int wait4(int pid, int *status, int options, struct rusage *rusage); }
SYS_LINK = 9 // { int link(char *path, char *link); }
SYS_UNLINK = 10 // { int unlink(char *path); }
SYS_CHDIR = 12 // { int chdir(char *path); }
SYS_FCHDIR = 13 // { int fchdir(int fd); }
SYS_MKNOD = 14 // { int mknod(char *path, int mode, int dev); }
SYS_CHMOD = 15 // { int chmod(char *path, int mode); }
SYS_CHOWN = 16 // { int chown(char *path, int uid, int gid); }
SYS_OBREAK = 17 // { int obreak(char *nsize); } break obreak_args int
SYS_GETPID = 20 // { pid_t getpid(void); }
SYS_MOUNT = 21 // { int mount(char *type, char *path, int flags, caddr_t data); }
SYS_UNMOUNT = 22 // { int unmount(char *path, int flags); }
SYS_SETUID = 23 // { int setuid(uid_t uid); }
SYS_GETUID = 24 // { uid_t getuid(void); }
SYS_GETEUID = 25 // { uid_t geteuid(void); }
SYS_PTRACE = 26 // { int ptrace(int req, pid_t pid, caddr_t addr, int data); }
SYS_RECVMSG = 27 // { int recvmsg(int s, struct msghdr *msg, int flags); }
SYS_SENDMSG = 28 // { int sendmsg(int s, struct msghdr *msg, int flags); }
SYS_RECVFROM = 29 // { int recvfrom(int s, caddr_t buf, size_t len, int flags, struct sockaddr * __restrict from, __socklen_t * __restrict fromlenaddr); }
SYS_ACCEPT = 30 // { int accept(int s, struct sockaddr * __restrict name, __socklen_t * __restrict anamelen); }
SYS_GETPEERNAME = 31 // { int getpeername(int fdes, struct sockaddr * __restrict asa, __socklen_t * __restrict alen); }
SYS_GETSOCKNAME = 32 // { int getsockname(int fdes, struct sockaddr * __restrict asa, __socklen_t * __restrict alen); }
SYS_ACCESS = 33 // { int access(char *path, int amode); }
SYS_CHFLAGS = 34 // { int chflags(const char *path, u_long flags); }
SYS_FCHFLAGS = 35 // { int fchflags(int fd, u_long flags); }
SYS_SYNC = 36 // { int sync(void); }
SYS_KILL = 37 // { int kill(int pid, int signum); }
SYS_GETPPID = 39 // { pid_t getppid(void); }
SYS_DUP = 41 // { int dup(u_int fd); }
SYS_PIPE = 42 // { int pipe(void); }
SYS_GETEGID = 43 // { gid_t getegid(void); }
SYS_PROFIL = 44 // { int profil(caddr_t samples, size_t size, size_t offset, u_int scale); }
SYS_KTRACE = 45 // { int ktrace(const char *fname, int ops, int facs, int pid); }
SYS_GETGID = 47 // { gid_t getgid(void); }
SYS_GETLOGIN = 49 // { int getlogin(char *namebuf, u_int namelen); }
SYS_SETLOGIN = 50 // { int setlogin(char *namebuf); }
SYS_ACCT = 51 // { int acct(char *path); }
SYS_SIGALTSTACK = 53 // { int sigaltstack(stack_t *ss, stack_t *oss); }
SYS_IOCTL = 54 // { int ioctl(int fd, u_long com, caddr_t data); }
SYS_REBOOT = 55 // { int reboot(int opt); }
SYS_REVOKE = 56 // { int revoke(char *path); }
SYS_SYMLINK = 57 // { int symlink(char *path, char *link); }
SYS_READLINK = 58 // { ssize_t readlink(char *path, char *buf, size_t count); }
SYS_EXECVE = 59 // { int execve(char *fname, char **argv, char **envv); }
SYS_UMASK = 60 // { int umask(int newmask); } umask umask_args int
SYS_CHROOT = 61 // { int chroot(char *path); }
SYS_MSYNC = 65 // { int msync(void *addr, size_t len, int flags); }
SYS_VFORK = 66 // { int vfork(void); }
SYS_SBRK = 69 // { int sbrk(int incr); }
SYS_SSTK = 70 // { int sstk(int incr); }
SYS_OVADVISE = 72 // { int ovadvise(int anom); } vadvise ovadvise_args int
SYS_MUNMAP = 73 // { int munmap(void *addr, size_t len); }
SYS_MPROTECT = 74 // { int mprotect(const void *addr, size_t len, int prot); }
SYS_MADVISE = 75 // { int madvise(void *addr, size_t len, int behav); }
SYS_MINCORE = 78 // { int mincore(const void *addr, size_t len, char *vec); }
SYS_GETGROUPS = 79 // { int getgroups(u_int gidsetsize, gid_t *gidset); }
SYS_SETGROUPS = 80 // { int setgroups(u_int gidsetsize, gid_t *gidset); }
SYS_GETPGRP = 81 // { int getpgrp(void); }
SYS_SETPGID = 82 // { int setpgid(int pid, int pgid); }
SYS_SETITIMER = 83 // { int setitimer(u_int which, struct itimerval *itv, struct itimerval *oitv); }
SYS_SWAPON = 85 // { int swapon(char *name); }
SYS_GETITIMER = 86 // { int getitimer(u_int which, struct itimerval *itv); }
SYS_GETDTABLESIZE = 89 // { int getdtablesize(void); }
SYS_DUP2 = 90 // { int dup2(u_int from, u_int to); }
SYS_FCNTL = 92 // { int fcntl(int fd, int cmd, long arg); }
SYS_SELECT = 93 // { int select(int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tv); }
SYS_FSYNC = 95 // { int fsync(int fd); }
SYS_SETPRIORITY = 96 // { int setpriority(int which, int who, int prio); }
SYS_SOCKET = 97 // { int socket(int domain, int type, int protocol); }
SYS_CONNECT = 98 // { int connect(int s, caddr_t name, int namelen); }
SYS_GETPRIORITY = 100 // { int getpriority(int which, int who); }
SYS_BIND = 104 // { int bind(int s, caddr_t name, int namelen); }
SYS_SETSOCKOPT = 105 // { int setsockopt(int s, int level, int name, caddr_t val, int valsize); }
SYS_LISTEN = 106 // { int listen(int s, int backlog); }
SYS_GETTIMEOFDAY = 116 // { int gettimeofday(struct timeval *tp, struct timezone *tzp); }
SYS_GETRUSAGE = 117 // { int getrusage(int who, struct rusage *rusage); }
SYS_GETSOCKOPT = 118 // { int getsockopt(int s, int level, int name, caddr_t val, int *avalsize); }
SYS_READV = 120 // { int readv(int fd, struct iovec *iovp, u_int iovcnt); }
SYS_WRITEV = 121 // { int writev(int fd, struct iovec *iovp, u_int iovcnt); }
SYS_SETTIMEOFDAY = 122 // { int settimeofday(struct timeval *tv, struct timezone *tzp); }
SYS_FCHOWN = 123 // { int fchown(int fd, int uid, int gid); }
SYS_FCHMOD = 124 // { int fchmod(int fd, int mode); }
SYS_SETREUID = 126 // { int setreuid(int ruid, int euid); }
SYS_SETREGID = 127 // { int setregid(int rgid, int egid); }
SYS_RENAME = 128 // { int rename(char *from, char *to); }
SYS_FLOCK = 131 // { int flock(int fd, int how); }
SYS_MKFIFO = 132 // { int mkfifo(char *path, int mode); }
SYS_SENDTO = 133 // { int sendto(int s, caddr_t buf, size_t len, int flags, caddr_t to, int tolen); }
SYS_SHUTDOWN = 134 // { int shutdown(int s, int how); }
SYS_SOCKETPAIR = 135 // { int socketpair(int domain, int type, int protocol, int *rsv); }
SYS_MKDIR = 136 // { int mkdir(char *path, int mode); }
SYS_RMDIR = 137 // { int rmdir(char *path); }
SYS_UTIMES = 138 // { int utimes(char *path, struct timeval *tptr); }
SYS_ADJTIME = 140 // { int adjtime(struct timeval *delta, struct timeval *olddelta); }
SYS_SETSID = 147 // { int setsid(void); }
SYS_QUOTACTL = 148 // { int quotactl(char *path, int cmd, int uid, caddr_t arg); }
SYS_NLM_SYSCALL = 154 // { int nlm_syscall(int debug_level, int grace_period, int addr_count, char **addrs); }
SYS_NFSSVC = 155 // { int nfssvc(int flag, caddr_t argp); }
SYS_LGETFH = 160 // { int lgetfh(char *fname, struct fhandle *fhp); }
SYS_GETFH = 161 // { int getfh(char *fname, struct fhandle *fhp); }
SYS_SYSARCH = 165 // { int sysarch(int op, char *parms); }
SYS_RTPRIO = 166 // { int rtprio(int function, pid_t pid, struct rtprio *rtp); }
SYS_SEMSYS = 169 // { int semsys(int which, int a2, int a3, int a4, int a5); }
SYS_MSGSYS = 170 // { int msgsys(int which, int a2, int a3, int a4, int a5, int a6); }
SYS_SHMSYS = 171 // { int shmsys(int which, int a2, int a3, int a4); }
SYS_SETFIB = 175 // { int setfib(int fibnum); }
SYS_NTP_ADJTIME = 176 // { int ntp_adjtime(struct timex *tp); }
SYS_SETGID = 181 // { int setgid(gid_t gid); }
SYS_SETEGID = 182 // { int setegid(gid_t egid); }
SYS_SETEUID = 183 // { int seteuid(uid_t euid); }
SYS_STAT = 188 // { int stat(char *path, struct stat *ub); }
SYS_FSTAT = 189 // { int fstat(int fd, struct stat *sb); }
SYS_LSTAT = 190 // { int lstat(char *path, struct stat *ub); }
SYS_PATHCONF = 191 // { int pathconf(char *path, int name); }
SYS_FPATHCONF = 192 // { int fpathconf(int fd, int name); }
SYS_GETRLIMIT = 194 // { int getrlimit(u_int which, struct rlimit *rlp); } getrlimit __getrlimit_args int
SYS_SETRLIMIT = 195 // { int setrlimit(u_int which, struct rlimit *rlp); } setrlimit __setrlimit_args int
SYS_GETDIRENTRIES = 196 // { int getdirentries(int fd, char *buf, u_int count, long *basep); }
SYS___SYSCTL = 202 // { int __sysctl(int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen); } __sysctl sysctl_args int
SYS_MLOCK = 203 // { int mlock(const void *addr, size_t len); }
SYS_MUNLOCK = 204 // { int munlock(const void *addr, size_t len); }
SYS_UNDELETE = 205 // { int undelete(char *path); }
SYS_FUTIMES = 206 // { int futimes(int fd, struct timeval *tptr); }
SYS_GETPGID = 207 // { int getpgid(pid_t pid); }
SYS_POLL = 209 // { int poll(struct pollfd *fds, u_int nfds, int timeout); }
SYS_SEMGET = 221 // { int semget(key_t key, int nsems, int semflg); }
SYS_SEMOP = 222 // { int semop(int semid, struct sembuf *sops, size_t nsops); }
SYS_MSGGET = 225 // { int msgget(key_t key, int msgflg); }
SYS_MSGSND = 226 // { int msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg); }
SYS_MSGRCV = 227 // { int msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); }
SYS_SHMAT = 228 // { int shmat(int shmid, const void *shmaddr, int shmflg); }
SYS_SHMDT = 230 // { int shmdt(const void *shmaddr); }
SYS_SHMGET = 231 // { int shmget(key_t key, size_t size, int shmflg); }
SYS_CLOCK_GETTIME = 232 // { int clock_gettime(clockid_t clock_id, struct timespec *tp); }
SYS_CLOCK_SETTIME = 233 // { int clock_settime( clockid_t clock_id, const struct timespec *tp); }
SYS_CLOCK_GETRES = 234 // { int clock_getres(clockid_t clock_id, struct timespec *tp); }
SYS_KTIMER_CREATE = 235 // { int ktimer_create(clockid_t clock_id, struct sigevent *evp, int *timerid); }
SYS_KTIMER_DELETE = 236 // { int ktimer_delete(int timerid); }
SYS_KTIMER_SETTIME = 237 // { int ktimer_settime(int timerid, int flags, const struct itimerspec *value, struct itimerspec *ovalue); }
SYS_KTIMER_GETTIME = 238 // { int ktimer_gettime(int timerid, struct itimerspec *value); }
SYS_KTIMER_GETOVERRUN = 239 // { int ktimer_getoverrun(int timerid); }
SYS_NANOSLEEP = 240 // { int nanosleep(const struct timespec *rqtp, struct timespec *rmtp); }
SYS_FFCLOCK_GETCOUNTER = 241 // { int ffclock_getcounter(ffcounter *ffcount); }
SYS_FFCLOCK_SETESTIMATE = 242 // { int ffclock_setestimate( struct ffclock_estimate *cest); }
SYS_FFCLOCK_GETESTIMATE = 243 // { int ffclock_getestimate( struct ffclock_estimate *cest); }
SYS_CLOCK_NANOSLEEP = 244 // { int clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *rqtp, struct timespec *rmtp); }
SYS_CLOCK_GETCPUCLOCKID2 = 247 // { int clock_getcpuclockid2(id_t id,int which, clockid_t *clock_id); }
SYS_NTP_GETTIME = 248 // { int ntp_gettime(struct ntptimeval *ntvp); }
SYS_MINHERIT = 250 // { int minherit(void *addr, size_t len, int inherit); }
SYS_RFORK = 251 // { int rfork(int flags); }
SYS_OPENBSD_POLL = 252 // { int openbsd_poll(struct pollfd *fds, u_int nfds, int timeout); }
SYS_ISSETUGID = 253 // { int issetugid(void); }
SYS_LCHOWN = 254 // { int lchown(char *path, int uid, int gid); }
SYS_AIO_READ = 255 // { int aio_read(struct aiocb *aiocbp); }
SYS_AIO_WRITE = 256 // { int aio_write(struct aiocb *aiocbp); }
SYS_LIO_LISTIO = 257 // { int lio_listio(int mode, struct aiocb * const *acb_list, int nent, struct sigevent *sig); }
SYS_GETDENTS = 272 // { int getdents(int fd, char *buf, size_t count); }
SYS_LCHMOD = 274 // { int lchmod(char *path, mode_t mode); }
SYS_LUTIMES = 276 // { int lutimes(char *path, struct timeval *tptr); }
SYS_NSTAT = 278 // { int nstat(char *path, struct nstat *ub); }
SYS_NFSTAT = 279 // { int nfstat(int fd, struct nstat *sb); }
SYS_NLSTAT = 280 // { int nlstat(char *path, struct nstat *ub); }
SYS_PREADV = 289 // { ssize_t preadv(int fd, struct iovec *iovp, u_int iovcnt, off_t offset); }
SYS_PWRITEV = 290 // { ssize_t pwritev(int fd, struct iovec *iovp, u_int iovcnt, off_t offset); }
SYS_FHOPEN = 298 // { int fhopen(const struct fhandle *u_fhp, int flags); }
SYS_FHSTAT = 299 // { int fhstat(const struct fhandle *u_fhp, struct stat *sb); }
SYS_MODNEXT = 300 // { int modnext(int modid); }
SYS_MODSTAT = 301 // { int modstat(int modid, struct module_stat *stat); }
SYS_MODFNEXT = 302 // { int modfnext(int modid); }
SYS_MODFIND = 303 // { int modfind(const char *name); }
SYS_KLDLOAD = 304 // { int kldload(const char *file); }
SYS_KLDUNLOAD = 305 // { int kldunload(int fileid); }
SYS_KLDFIND = 306 // { int kldfind(const char *file); }
SYS_KLDNEXT = 307 // { int kldnext(int fileid); }
SYS_KLDSTAT = 308 // { int kldstat(int fileid, struct kld_file_stat* stat); }
SYS_KLDFIRSTMOD = 309 // { int kldfirstmod(int fileid); }
SYS_GETSID = 310 // { int getsid(pid_t pid); }
SYS_SETRESUID = 311 // { int setresuid(uid_t ruid, uid_t euid, uid_t suid); }
SYS_SETRESGID = 312 // { int setresgid(gid_t rgid, gid_t egid, gid_t sgid); }
SYS_AIO_RETURN = 314 // { ssize_t aio_return(struct aiocb *aiocbp); }
SYS_AIO_SUSPEND = 315 // { int aio_suspend( struct aiocb * const * aiocbp, int nent, const struct timespec *timeout); }
SYS_AIO_CANCEL = 316 // { int aio_cancel(int fd, struct aiocb *aiocbp); }
SYS_AIO_ERROR = 317 // { int aio_error(struct aiocb *aiocbp); }
SYS_YIELD = 321 // { int yield(void); }
SYS_MLOCKALL = 324 // { int mlockall(int how); }
SYS_MUNLOCKALL = 325 // { int munlockall(void); }
SYS___GETCWD = 326 // { int __getcwd(char *buf, u_int buflen); }
SYS_SCHED_SETPARAM = 327 // { int sched_setparam (pid_t pid, const struct sched_param *param); }
SYS_SCHED_GETPARAM = 328 // { int sched_getparam (pid_t pid, struct sched_param *param); }
SYS_SCHED_SETSCHEDULER = 329 // { int sched_setscheduler (pid_t pid, int policy, const struct sched_param *param); }
SYS_SCHED_GETSCHEDULER = 330 // { int sched_getscheduler (pid_t pid); }
SYS_SCHED_YIELD = 331 // { int sched_yield (void); }
SYS_SCHED_GET_PRIORITY_MAX = 332 // { int sched_get_priority_max (int policy); }
SYS_SCHED_GET_PRIORITY_MIN = 333 // { int sched_get_priority_min (int policy); }
SYS_SCHED_RR_GET_INTERVAL = 334 // { int sched_rr_get_interval (pid_t pid, struct timespec *interval); }
SYS_UTRACE = 335 // { int utrace(const void *addr, size_t len); }
SYS_KLDSYM = 337 // { int kldsym(int fileid, int cmd, void *data); }
SYS_JAIL = 338 // { int jail(struct jail *jail); }
SYS_SIGPROCMASK = 340 // { int sigprocmask(int how, const sigset_t *set, sigset_t *oset); }
SYS_SIGSUSPEND = 341 // { int sigsuspend(const sigset_t *sigmask); }
SYS_SIGPENDING = 343 // { int sigpending(sigset_t *set); }
SYS_SIGTIMEDWAIT = 345 // { int sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *timeout); }
SYS_SIGWAITINFO = 346 // { int sigwaitinfo(const sigset_t *set, siginfo_t *info); }
SYS___ACL_GET_FILE = 347 // { int __acl_get_file(const char *path, acl_type_t type, struct acl *aclp); }
SYS___ACL_SET_FILE = 348 // { int __acl_set_file(const char *path, acl_type_t type, struct acl *aclp); }
SYS___ACL_GET_FD = 349 // { int __acl_get_fd(int filedes, acl_type_t type, struct acl *aclp); }
SYS___ACL_SET_FD = 350 // { int __acl_set_fd(int filedes, acl_type_t type, struct acl *aclp); }
SYS___ACL_DELETE_FILE = 351 // { int __acl_delete_file(const char *path, acl_type_t type); }
SYS___ACL_DELETE_FD = 352 // { int __acl_delete_fd(int filedes, acl_type_t type); }
SYS___ACL_ACLCHECK_FILE = 353 // { int __acl_aclcheck_file(const char *path, acl_type_t type, struct acl *aclp); }
SYS___ACL_ACLCHECK_FD = 354 // { int __acl_aclcheck_fd(int filedes, acl_type_t type, struct acl *aclp); }
SYS_EXTATTRCTL = 355 // { int extattrctl(const char *path, int cmd, const char *filename, int attrnamespace, const char *attrname); }
SYS_EXTATTR_SET_FILE = 356 // { ssize_t extattr_set_file( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); }
SYS_EXTATTR_GET_FILE = 357 // { ssize_t extattr_get_file( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); }
SYS_EXTATTR_DELETE_FILE = 358 // { int extattr_delete_file(const char *path, int attrnamespace, const char *attrname); }
SYS_AIO_WAITCOMPLETE = 359 // { ssize_t aio_waitcomplete( struct aiocb **aiocbp, struct timespec *timeout); }
SYS_GETRESUID = 360 // { int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); }
SYS_GETRESGID = 361 // { int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); }
SYS_KQUEUE = 362 // { int kqueue(void); }
SYS_KEVENT = 363 // { int kevent(int fd, struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); }
SYS_EXTATTR_SET_FD = 371 // { ssize_t extattr_set_fd(int fd, int attrnamespace, const char *attrname, void *data, size_t nbytes); }
SYS_EXTATTR_GET_FD = 372 // { ssize_t extattr_get_fd(int fd, int attrnamespace, const char *attrname, void *data, size_t nbytes); }
SYS_EXTATTR_DELETE_FD = 373 // { int extattr_delete_fd(int fd, int attrnamespace, const char *attrname); }
SYS___SETUGID = 374 // { int __setugid(int flag); }
SYS_EACCESS = 376 // { int eaccess(char *path, int amode); }
SYS_NMOUNT = 378 // { int nmount(struct iovec *iovp, unsigned int iovcnt, int flags); }
SYS___MAC_GET_PROC = 384 // { int __mac_get_proc(struct mac *mac_p); }
SYS___MAC_SET_PROC = 385 // { int __mac_set_proc(struct mac *mac_p); }
SYS___MAC_GET_FD = 386 // { int __mac_get_fd(int fd, struct mac *mac_p); }
SYS___MAC_GET_FILE = 387 // { int __mac_get_file(const char *path_p, struct mac *mac_p); }
SYS___MAC_SET_FD = 388 // { int __mac_set_fd(int fd, struct mac *mac_p); }
SYS___MAC_SET_FILE = 389 // { int __mac_set_file(const char *path_p, struct mac *mac_p); }
SYS_KENV = 390 // { int kenv(int what, const char *name, char *value, int len); }
SYS_LCHFLAGS = 391 // { int lchflags(const char *path, u_long flags); }
SYS_UUIDGEN = 392 // { int uuidgen(struct uuid *store, int count); }
SYS_SENDFILE = 393 // { int sendfile(int fd, int s, off_t offset, size_t nbytes, struct sf_hdtr *hdtr, off_t *sbytes, int flags); }
SYS_MAC_SYSCALL = 394 // { int mac_syscall(const char *policy, int call, void *arg); }
SYS_GETFSSTAT = 395 // { int getfsstat(struct statfs *buf, long bufsize, int mode); }
SYS_STATFS = 396 // { int statfs(char *path, struct statfs *buf); }
SYS_FSTATFS = 397 // { int fstatfs(int fd, struct statfs *buf); }
SYS_FHSTATFS = 398 // { int fhstatfs(const struct fhandle *u_fhp, struct statfs *buf); }
SYS_KSEM_CLOSE = 400 // { int ksem_close(semid_t id); }
SYS_KSEM_POST = 401 // { int ksem_post(semid_t id); }
SYS_KSEM_WAIT = 402 // { int ksem_wait(semid_t id); }
SYS_KSEM_TRYWAIT = 403 // { int ksem_trywait(semid_t id); }
SYS_KSEM_INIT = 404 // { int ksem_init(semid_t *idp, unsigned int value); }
SYS_KSEM_OPEN = 405 // { int ksem_open(semid_t *idp, const char *name, int oflag, mode_t mode, unsigned int value); }
SYS_KSEM_UNLINK = 406 // { int ksem_unlink(const char *name); }
SYS_KSEM_GETVALUE = 407 // { int ksem_getvalue(semid_t id, int *val); }
SYS_KSEM_DESTROY = 408 // { int ksem_destroy(semid_t id); }
SYS___MAC_GET_PID = 409 // { int __mac_get_pid(pid_t pid, struct mac *mac_p); }
SYS___MAC_GET_LINK = 410 // { int __mac_get_link(const char *path_p, struct mac *mac_p); }
SYS___MAC_SET_LINK = 411 // { int __mac_set_link(const char *path_p, struct mac *mac_p); }
SYS_EXTATTR_SET_LINK = 412 // { ssize_t extattr_set_link( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); }
SYS_EXTATTR_GET_LINK = 413 // { ssize_t extattr_get_link( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); }
SYS_EXTATTR_DELETE_LINK = 414 // { int extattr_delete_link( const char *path, int attrnamespace, const char *attrname); }
SYS___MAC_EXECVE = 415 // { int __mac_execve(char *fname, char **argv, char **envv, struct mac *mac_p); }
SYS_SIGACTION = 416 // { int sigaction(int sig, const struct sigaction *act, struct sigaction *oact); }
SYS_SIGRETURN = 417 // { int sigreturn( const struct __ucontext *sigcntxp); }
SYS_GETCONTEXT = 421 // { int getcontext(struct __ucontext *ucp); }
SYS_SETCONTEXT = 422 // { int setcontext( const struct __ucontext *ucp); }
SYS_SWAPCONTEXT = 423 // { int swapcontext(struct __ucontext *oucp, const struct __ucontext *ucp); }
SYS_SWAPOFF = 424 // { int swapoff(const char *name); }
SYS___ACL_GET_LINK = 425 // { int __acl_get_link(const char *path, acl_type_t type, struct acl *aclp); }
SYS___ACL_SET_LINK = 426 // { int __acl_set_link(const char *path, acl_type_t type, struct acl *aclp); }
SYS___ACL_DELETE_LINK = 427 // { int __acl_delete_link(const char *path, acl_type_t type); }
SYS___ACL_ACLCHECK_LINK = 428 // { int __acl_aclcheck_link(const char *path, acl_type_t type, struct acl *aclp); }
SYS_SIGWAIT = 429 // { int sigwait(const sigset_t *set, int *sig); }
SYS_THR_CREATE = 430 // { int thr_create(ucontext_t *ctx, long *id, int flags); }
SYS_THR_EXIT = 431 // { void thr_exit(long *state); }
SYS_THR_SELF = 432 // { int thr_self(long *id); }
SYS_THR_KILL = 433 // { int thr_kill(long id, int sig); }
SYS_JAIL_ATTACH = 436 // { int jail_attach(int jid); }
SYS_EXTATTR_LIST_FD = 437 // { ssize_t extattr_list_fd(int fd, int attrnamespace, void *data, size_t nbytes); }
SYS_EXTATTR_LIST_FILE = 438 // { ssize_t extattr_list_file( const char *path, int attrnamespace, void *data, size_t nbytes); }
SYS_EXTATTR_LIST_LINK = 439 // { ssize_t extattr_list_link( const char *path, int attrnamespace, void *data, size_t nbytes); }
SYS_KSEM_TIMEDWAIT = 441 // { int ksem_timedwait(semid_t id, const struct timespec *abstime); }
SYS_THR_SUSPEND = 442 // { int thr_suspend( const struct timespec *timeout); }
SYS_THR_WAKE = 443 // { int thr_wake(long id); }
SYS_KLDUNLOADF = 444 // { int kldunloadf(int fileid, int flags); }
SYS_AUDIT = 445 // { int audit(const void *record, u_int length); }
SYS_AUDITON = 446 // { int auditon(int cmd, void *data, u_int length); }
SYS_GETAUID = 447 // { int getauid(uid_t *auid); }
SYS_SETAUID = 448 // { int setauid(uid_t *auid); }
SYS_GETAUDIT = 449 // { int getaudit(struct auditinfo *auditinfo); }
SYS_SETAUDIT = 450 // { int setaudit(struct auditinfo *auditinfo); }
SYS_GETAUDIT_ADDR = 451 // { int getaudit_addr( struct auditinfo_addr *auditinfo_addr, u_int length); }
SYS_SETAUDIT_ADDR = 452 // { int setaudit_addr( struct auditinfo_addr *auditinfo_addr, u_int length); }
SYS_AUDITCTL = 453 // { int auditctl(char *path); }
SYS__UMTX_OP = 454 // { int _umtx_op(void *obj, int op, u_long val, void *uaddr1, void *uaddr2); }
SYS_THR_NEW = 455 // { int thr_new(struct thr_param *param, int param_size); }
SYS_SIGQUEUE = 456 // { int sigqueue(pid_t pid, int signum, void *value); }
SYS_KMQ_OPEN = 457 // { int kmq_open(const char *path, int flags, mode_t mode, const struct mq_attr *attr); }
SYS_KMQ_SETATTR = 458 // { int kmq_setattr(int mqd, const struct mq_attr *attr, struct mq_attr *oattr); }
SYS_KMQ_TIMEDRECEIVE = 459 // { int kmq_timedreceive(int mqd, char *msg_ptr, size_t msg_len, unsigned *msg_prio, const struct timespec *abs_timeout); }
SYS_KMQ_TIMEDSEND = 460 // { int kmq_timedsend(int mqd, const char *msg_ptr, size_t msg_len,unsigned msg_prio, const struct timespec *abs_timeout);}
SYS_KMQ_NOTIFY = 461 // { int kmq_notify(int mqd, const struct sigevent *sigev); }
SYS_KMQ_UNLINK = 462 // { int kmq_unlink(const char *path); }
SYS_ABORT2 = 463 // { int abort2(const char *why, int nargs, void **args); }
SYS_THR_SET_NAME = 464 // { int thr_set_name(long id, const char *name); }
SYS_AIO_FSYNC = 465 // { int aio_fsync(int op, struct aiocb *aiocbp); }
SYS_RTPRIO_THREAD = 466 // { int rtprio_thread(int function, lwpid_t lwpid, struct rtprio *rtp); }
SYS_SCTP_PEELOFF = 471 // { int sctp_peeloff(int sd, uint32_t name); }
SYS_SCTP_GENERIC_SENDMSG = 472 // { int sctp_generic_sendmsg(int sd, caddr_t msg, int mlen, caddr_t to, __socklen_t tolen, struct sctp_sndrcvinfo *sinfo, int flags); }
SYS_SCTP_GENERIC_SENDMSG_IOV = 473 // { int sctp_generic_sendmsg_iov(int sd, struct iovec *iov, int iovlen, caddr_t to, __socklen_t tolen, struct sctp_sndrcvinfo *sinfo, int flags); }
SYS_SCTP_GENERIC_RECVMSG = 474 // { int sctp_generic_recvmsg(int sd, struct iovec *iov, int iovlen, struct sockaddr * from, __socklen_t *fromlenaddr, struct sctp_sndrcvinfo *sinfo, int *msg_flags); }
SYS_PREAD = 475 // { ssize_t pread(int fd, void *buf, size_t nbyte, off_t offset); }
SYS_PWRITE = 476 // { ssize_t pwrite(int fd, const void *buf, size_t nbyte, off_t offset); }
SYS_MMAP = 477 // { caddr_t mmap(caddr_t addr, size_t len, int prot, int flags, int fd, off_t pos); }
SYS_LSEEK = 478 // { off_t lseek(int fd, off_t offset, int whence); }
SYS_TRUNCATE = 479 // { int truncate(char *path, off_t length); }
SYS_FTRUNCATE = 480 // { int ftruncate(int fd, off_t length); }
SYS_THR_KILL2 = 481 // { int thr_kill2(pid_t pid, long id, int sig); }
SYS_SHM_OPEN = 482 // { int shm_open(const char *path, int flags, mode_t mode); }
SYS_SHM_UNLINK = 483 // { int shm_unlink(const char *path); }
SYS_CPUSET = 484 // { int cpuset(cpusetid_t *setid); }
SYS_CPUSET_SETID = 485 // { int cpuset_setid(cpuwhich_t which, id_t id, cpusetid_t setid); }
SYS_CPUSET_GETID = 486 // { int cpuset_getid(cpulevel_t level, cpuwhich_t which, id_t id, cpusetid_t *setid); }
SYS_CPUSET_GETAFFINITY = 487 // { int cpuset_getaffinity(cpulevel_t level, cpuwhich_t which, id_t id, size_t cpusetsize, cpuset_t *mask); }
SYS_CPUSET_SETAFFINITY = 488 // { int cpuset_setaffinity(cpulevel_t level, cpuwhich_t which, id_t id, size_t cpusetsize, const cpuset_t *mask); }
SYS_FACCESSAT = 489 // { int faccessat(int fd, char *path, int amode, int flag); }
SYS_FCHMODAT = 490 // { int fchmodat(int fd, char *path, mode_t mode, int flag); }
SYS_FCHOWNAT = 491 // { int fchownat(int fd, char *path, uid_t uid, gid_t gid, int flag); }
SYS_FEXECVE = 492 // { int fexecve(int fd, char **argv, char **envv); }
SYS_FSTATAT = 493 // { int fstatat(int fd, char *path, struct stat *buf, int flag); }
SYS_FUTIMESAT = 494 // { int futimesat(int fd, char *path, struct timeval *times); }
SYS_LINKAT = 495 // { int linkat(int fd1, char *path1, int fd2, char *path2, int flag); }
SYS_MKDIRAT = 496 // { int mkdirat(int fd, char *path, mode_t mode); }
SYS_MKFIFOAT = 497 // { int mkfifoat(int fd, char *path, mode_t mode); }
SYS_MKNODAT = 498 // { int mknodat(int fd, char *path, mode_t mode, dev_t dev); }
SYS_OPENAT = 499 // { int openat(int fd, char *path, int flag, mode_t mode); }
SYS_READLINKAT = 500 // { int readlinkat(int fd, char *path, char *buf, size_t bufsize); }
SYS_RENAMEAT = 501 // { int renameat(int oldfd, char *old, int newfd, char *new); }
SYS_SYMLINKAT = 502 // { int symlinkat(char *path1, int fd, char *path2); }
SYS_UNLINKAT = 503 // { int unlinkat(int fd, char *path, int flag); }
SYS_POSIX_OPENPT = 504 // { int posix_openpt(int flags); }
SYS_GSSD_SYSCALL = 505 // { int gssd_syscall(char *path); }
SYS_JAIL_GET = 506 // { int jail_get(struct iovec *iovp, unsigned int iovcnt, int flags); }
SYS_JAIL_SET = 507 // { int jail_set(struct iovec *iovp, unsigned int iovcnt, int flags); }
SYS_JAIL_REMOVE = 508 // { int jail_remove(int jid); }
SYS_CLOSEFROM = 509 // { int closefrom(int lowfd); }
SYS___SEMCTL = 510 // { int __semctl(int semid, int semnum, int cmd, union semun *arg); }
SYS_MSGCTL = 511 // { int msgctl(int msqid, int cmd, struct msqid_ds *buf); }
SYS_SHMCTL = 512 // { int shmctl(int shmid, int cmd, struct shmid_ds *buf); }
SYS_LPATHCONF = 513 // { int lpathconf(char *path, int name); }
SYS___CAP_RIGHTS_GET = 515 // { int __cap_rights_get(int version, int fd, cap_rights_t *rightsp); }
SYS_CAP_ENTER = 516 // { int cap_enter(void); }
SYS_CAP_GETMODE = 517 // { int cap_getmode(u_int *modep); }
SYS_PDFORK = 518 // { int pdfork(int *fdp, int flags); }
SYS_PDKILL = 519 // { int pdkill(int fd, int signum); }
SYS_PDGETPID = 520 // { int pdgetpid(int fd, pid_t *pidp); }
SYS_PSELECT = 522 // { int pselect(int nd, fd_set *in, fd_set *ou, fd_set *ex, const struct timespec *ts, const sigset_t *sm); }
SYS_GETLOGINCLASS = 523 // { int getloginclass(char *namebuf, size_t namelen); }
SYS_SETLOGINCLASS = 524 // { int setloginclass(const char *namebuf); }
SYS_RCTL_GET_RACCT = 525 // { int rctl_get_racct(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); }
SYS_RCTL_GET_RULES = 526 // { int rctl_get_rules(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); }
SYS_RCTL_GET_LIMITS = 527 // { int rctl_get_limits(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); }
SYS_RCTL_ADD_RULE = 528 // { int rctl_add_rule(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); }
SYS_RCTL_REMOVE_RULE = 529 // { int rctl_remove_rule(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); }
SYS_POSIX_FALLOCATE = 530 // { int posix_fallocate(int fd, off_t offset, off_t len); }
SYS_POSIX_FADVISE = 531 // { int posix_fadvise(int fd, off_t offset, off_t len, int advice); }
SYS_WAIT6 = 532 // { int wait6(idtype_t idtype, id_t id, int *status, int options, struct __wrusage *wrusage, siginfo_t *info); }
SYS_CAP_RIGHTS_LIMIT = 533 // { int cap_rights_limit(int fd, cap_rights_t *rightsp); }
SYS_CAP_IOCTLS_LIMIT = 534 // { int cap_ioctls_limit(int fd, const u_long *cmds, size_t ncmds); }
SYS_CAP_IOCTLS_GET = 535 // { ssize_t cap_ioctls_get(int fd, u_long *cmds, size_t maxcmds); }
SYS_CAP_FCNTLS_LIMIT = 536 // { int cap_fcntls_limit(int fd, uint32_t fcntlrights); }
SYS_CAP_FCNTLS_GET = 537 // { int cap_fcntls_get(int fd, uint32_t *fcntlrightsp); }
SYS_BINDAT = 538 // { int bindat(int fd, int s, caddr_t name, int namelen); }
SYS_CONNECTAT = 539 // { int connectat(int fd, int s, caddr_t name, int namelen); }
SYS_CHFLAGSAT = 540 // { int chflagsat(int fd, const char *path, u_long flags, int atflag); }
SYS_ACCEPT4 = 541 // { int accept4(int s, struct sockaddr * __restrict name, __socklen_t * __restrict anamelen, int flags); }
SYS_PIPE2 = 542 // { int pipe2(int *fildes, int flags); }
SYS_AIO_MLOCK = 543 // { int aio_mlock(struct aiocb *aiocbp); }
SYS_PROCCTL = 544 // { int procctl(idtype_t idtype, id_t id, int com, void *data); }
SYS_PPOLL = 545 // { int ppoll(struct pollfd *fds, u_int nfds, const struct timespec *ts, const sigset_t *set); }
SYS_FUTIMENS = 546 // { int futimens(int fd, struct timespec *times); }
SYS_UTIMENSAT = 547 // { int utimensat(int fd, char *path, struct timespec *times, int flag); }
SYS_NUMA_GETAFFINITY = 548 // { int numa_getaffinity(cpuwhich_t which, id_t id, struct vm_domain_policy_entry *policy); }
SYS_NUMA_SETAFFINITY = 549 // { int numa_setaffinity(cpuwhich_t which, id_t id, const struct vm_domain_policy_entry *policy); }
SYS_FDATASYNC = 550 // { int fdatasync(int fd); }
)
| {
"pile_set_name": "Github"
} |
<Application x:Class="NavigationSampleApp.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:NavigationSampleApp"
Startup="Application_Startup">
<Application.Resources>
</Application.Resources>
</Application>
| {
"pile_set_name": "Github"
} |
import {genDefaultValue} from '../src/utils';
describe('genDefaultValue', () => {
it('should return value with given string', () => {
const defaultValue = 'value';
expect(genDefaultValue(defaultValue)).toBe(defaultValue);
});
it('should retrun value with given funciton', () => {
const defaultValue = () => 'value';
expect(genDefaultValue(defaultValue)).toBe(defaultValue());
})
})
| {
"pile_set_name": "Github"
} |
# required options:
kam1n0.data.path=E:/testappplatform/
kam1n0.ida.home=C:/Program Files (x86)/IDA 6.9/
# support reference
kam1n0.data.logging.path=${kam1n0.data.path}/logs/
# optional options:
kam1n0.ida.batch=20000
kam1n0.web.port=8571
# session timeout in seconds
kam1n0.web.session.timeout=3600
kam1n0.web.request.maxSize=1024MB
# add as many jvm-options as you want
# batch script/bash script/workbench will read them in sequence
jvm-option=-Xmx12G
jvm-option=-Xss4m
# other available options:
# Dynamic switch to enable or disable colored console output:
# kam1n0.ansi.enable=false
# CCfinder home and settings for source code clone search
# kam1n0.ccfinder.home=""
# kam1n0.ccfinder.python26exe=""
# kam1n0.ccfinder.b=12
# kam1n0.ccfinder.t=50
# PDB debug symbol parser path
# kam1n0.parser.pdb.dia2dump="" | {
"pile_set_name": "Github"
} |
{
"versions": [
{
"status": "CURRENT",
"updated": "2013-07-23T11:33:21Z",
"links": [
{
"href": "https://example.com/image/v7/",
"rel": "self"
}
],
"id": "v7"
}
]
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) .NET Foundation and Contributors
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*
* http://github.com/tidyui/coreweb
*
*/
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
namespace MvcWeb
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.apps.forscience.whistlepunk.devicemanager;
class TestDevicesPresenter implements DevicesPresenter {
public String experimentId;
public String sensorId;
private MemorySensorGroup availableDevices;
private SensorGroup pairedDevices;
public TestDevicesPresenter(MemorySensorGroup availableDevices, MemorySensorGroup pairedDevices) {
this.availableDevices = availableDevices;
this.pairedDevices = pairedDevices;
}
@Override
public void refreshScanningUI() {}
@Override
public void showSensorOptions(
String experimentId, String sensorId, SensorDiscoverer.SettingsInterface settings) {
this.experimentId = experimentId;
this.sensorId = sensorId;
}
@Override
public SensorGroup getPairedSensorGroup() {
return pairedDevices;
}
@Override
public SensorGroup getAvailableSensorGroup() {
return availableDevices;
}
@Override
public void unpair(String experimentId, String sensorId) {}
@Override
public boolean isDestroyed() {
return false;
}
public void setPairedDevices(SensorGroup pairedDevices) {
this.pairedDevices = pairedDevices;
}
}
| {
"pile_set_name": "Github"
} |
{
"author": {
"name": "Mark Cavage",
"email": "[email protected]"
},
"name": "assert-plus",
"description": "Extra assertions on top of node's assert module",
"version": "1.0.0",
"license": "MIT",
"main": "./assert.js",
"devDependencies": {
"tape": "4.2.2",
"faucet": "0.0.1"
},
"optionalDependencies": {},
"scripts": {
"test": "tape tests/*.js | ./node_modules/.bin/faucet"
},
"repository": {
"type": "git",
"url": "git+https://github.com/mcavage/node-assert-plus.git"
},
"engines": {
"node": ">=0.8"
},
"contributors": [
{
"name": "Dave Eddy",
"email": "[email protected]"
},
{
"name": "Fred Kuo",
"email": "[email protected]"
},
{
"name": "Lars-Magnus Skog",
"email": "[email protected]"
},
{
"name": "Mark Cavage",
"email": "[email protected]"
},
{
"name": "Patrick Mooney",
"email": "[email protected]"
},
{
"name": "Rob Gulewich",
"email": "[email protected]"
}
],
"bugs": {
"url": "https://github.com/mcavage/node-assert-plus/issues"
},
"homepage": "https://github.com/mcavage/node-assert-plus#readme",
"dependencies": {},
"_id": "[email protected]",
"_shasum": "f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525",
"_resolved": "http://10.0.1.33:8354/assert-plus/-/assert-plus-1.0.0.tgz",
"_from": "assert-plus@>=1.0.0 <2.0.0",
"_npmVersion": "3.3.9",
"_nodeVersion": "0.10.40",
"_npmUser": {
"name": "pfmooney",
"email": "[email protected]"
},
"maintainers": [
{
"name": "mcavage",
"email": "[email protected]"
},
{
"name": "pfmooney",
"email": "[email protected]"
}
],
"dist": {
"shasum": "f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525",
"tarball": "http://10.0.1.33:8354/assert-plus/-/assert-plus-1.0.0.tgz"
},
"directories": {},
"readme": "ERROR: No README data found!"
}
| {
"pile_set_name": "Github"
} |
return "
| # Type some coffeescript here, to run in the browser
| alert 'hi'
> See
<< coffee/
" if args.empty?
return "=beg/quoted/" if args[0] !~ /\n/
txt = CoffeeScript.to_js args[0]
Browser.js txt
"<* ran in browser!"
| {
"pile_set_name": "Github"
} |
% --------------------------------------------------------
% MDP Tracking
% Copyright (c) 2015 CVGL Stanford
% Licensed under The MIT License [see LICENSE for details]
% Written by Yu Xiang
% --------------------------------------------------------
%
% draw dres structure
function show_dres(frame_id, I, tit, dres, state, cmap)
if nargin < 5
state = 1;
end
if nargin < 6
cmap = colormap;
end
imshow(I);
title(tit);
hold on;
if isempty(dres) == 1
index = [];
else
if isfield(dres, 'state') == 1
index = find(dres.fr == frame_id & dres.state == state);
else
index = find(dres.fr == frame_id);
end
end
ids = unique(dres.id);
for i = 1:numel(index)
ind = index(i);
x = dres.x(ind);
y = dres.y(ind);
w = dres.w(ind);
h = dres.h(ind);
r = dres.r(ind);
if isfield(dres, 'id') && dres.id(ind) > 0
id = dres.id(ind);
id_index = find(id == ids);
str = sprintf('%d', id_index);
index_color = min(1 + floor((id_index-1) * size(cmap,1) / numel(ids)), size(cmap,1));
c = cmap(index_color,:);
else
c = 'g';
str = sprintf('%.2f', r);
end
if isfield(dres, 'occluded') && dres.occluded(ind) > 0
s = '--';
else
s = '-';
end
rectangle('Position', [x y w h], 'EdgeColor', c, 'LineWidth', 4, 'LineStyle', s);
text(x, y-size(I,1)*0.01, str, 'BackgroundColor', [.7 .9 .7], 'FontSize', 14);
if isfield(dres, 'id') && dres.id(ind) > 0
% show the previous path
ind = find(dres.id == id & dres.fr <= frame_id);
centers = [dres.x(ind)+dres.w(ind)/2, dres.y(ind)+dres.h(ind)];
patchline(centers(:,1), centers(:,2), 'LineWidth', 4, 'edgecolor', c, 'edgealpha', 0.3);
end
end
hold off; | {
"pile_set_name": "Github"
} |
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via [email protected] or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.model;
import org.adempiere.exceptions.AdempiereException;
import org.compiere.process.DocAction;
import org.compiere.process.DocumentReversalEnabled;
import org.compiere.process.DocumentEngine;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.eevolution.model.MDDOrder;
import java.io.File;
import java.math.BigDecimal;
import java.sql.ResultSet;
import java.sql.Timestamp;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.Properties;
/**
* Inventory Movement Model
*
* @author Jorg Janke
* @author [email protected], e-Evolution http://www.e-evolution.com
* <li>FR [ 1948157 ] Is necessary the reference for document reverse
* @see http://sourceforge.net/tracker/?func=detail&atid=879335&aid=1948157&group_id=176962
* <li> FR [ 2520591 ] Support multiples calendar for Org
* @see http://sourceforge.net/tracker2/?func=detail&atid=879335&aid=2520591&group_id=176962
* @author Armen Rizal, Goodwill Consulting
* <li>BF [ 1745154 ] Cost in Reversing Material Related Docs
* @author Teo Sarca, www.arhipac.ro
* <li>FR [ 2214883 ] Remove SQL code and Replace for Query
* @version $Id: MMovement.java,v 1.3 2006/07/30 00:51:03 jjanke Exp $
* @author Yamel Senih, [email protected], ERPCyA http://www.erpcya.com 2015-05-25, 18:20
* <a href="https://github.com/adempiere/adempiere/issues/887">
* @see FR [ 887 ] System Config reversal invoice DocNo</a>
*/
public class MMovement extends X_M_Movement implements DocAction , DocumentReversalEnabled
{
/**
*
*/
private static final long serialVersionUID = -1628932946440487727L;
/**
* Standard Constructor
* @param ctx context
* @param movementId id
* @param trxName transaction
*/
public MMovement (Properties ctx, int movementId, String trxName)
{
super (ctx, movementId, trxName);
if (movementId == 0)
{
// setC_DocType_ID (0);
setDocAction (DOCACTION_Complete); // CO
setDocStatus (DOCSTATUS_Drafted); // DR
setIsApproved (false);
setIsInTransit (false);
setMovementDate (new Timestamp(System.currentTimeMillis())); // @#Date@
setPosted (false);
super.setProcessed (false);
}
} // MMovement
/**
* Load Constructor
* @param ctx context
* @param rs result set
* @param trxName transaction
*/
public MMovement (Properties ctx, ResultSet rs, String trxName)
{
super(ctx, rs, trxName);
} // MMovement
/**
* Created an instance based Distribution Order
* @param order
* @param movementDate
*/
public MMovement(MDDOrder order , Timestamp movementDate)
{
super(order.getCtx() , 0 , order.get_TrxName());
setDD_Order_ID(order.getDD_Order_ID());
setAD_User_ID(order.getAD_User_ID());
setPOReference(order.getPOReference());
setReversal_ID(0);
setM_Shipper_ID(order.getM_Shipper_ID());
setDescription(order.getDescription());
setC_BPartner_ID(order.getC_BPartner_ID());
setC_BPartner_Location_ID(order.getC_BPartner_Location_ID());
setAD_Org_ID(order.getAD_Org_ID());
setAD_OrgTrx_ID(order.getAD_OrgTrx_ID());
setAD_User_ID(order.getAD_User_ID());
setC_Activity_ID(order.getC_Activity_ID());
setC_Charge_ID(order.getC_Charge_ID());
setChargeAmt(order.getChargeAmt());
setC_Campaign_ID(order.getC_Campaign_ID());
setC_Project_ID(order.getC_Project_ID());
setAD_OrgTrx_ID(order.getAD_OrgTrx_ID());
setUser1_ID(order.getUser1_ID());
setUser2_ID(order.getUser2_ID());
setUser3_ID(order.getUser3_ID());
setUser4_ID(order.getUser4_ID());
setPriorityRule(order.getPriorityRule());
if (movementDate != null)
setMovementDate (movementDate);
setDeliveryRule(order.getDeliveryRule());
setDeliveryViaRule(order.getDeliveryViaRule());
setDocStatus(MMovement.DOCSTATUS_Drafted);
setDocAction(MMovement.ACTION_Prepare);
setFreightCostRule (order.getFreightCostRule());
setFreightAmt(order.getFreightAmt());
setSalesRep_ID(order.getSalesRep_ID());
}
/** Lines */
private MMovementLine[] movementLines = null;
/** Confirmations */
private MMovementConfirm[] movementConfirms = null;
/**
* Get Lines
* @param requery requery
* @return array of lines
*/
public MMovementLine[] getLines (boolean requery)
{
if (movementLines != null && !requery) {
set_TrxName(movementLines, get_TrxName());
return movementLines;
}
//
final String whereClause = "M_Movement_ID=?";
List<MMovementLine> list = new Query(getCtx(), I_M_MovementLine.Table_Name, whereClause, get_TrxName())
.setParameters(getM_Movement_ID())
.setOrderBy(MMovementLine.COLUMNNAME_Line)
.list();
movementLines = new MMovementLine[list.size ()];
list.toArray (movementLines);
return movementLines;
} // getLines
/**
* Get Confirmations
* @param requery requery
* @return array of Confirmations
*/
public MMovementConfirm[] getConfirmations(boolean requery)
{
if (movementConfirms != null && !requery)
return movementConfirms;
List<MMovementConfirm> list = new Query(getCtx(), I_M_MovementConfirm.Table_Name, "M_Movement_ID=?", get_TrxName())
.setParameters(get_ID())
.list();
movementConfirms = list.toArray(new MMovementConfirm[list.size()]);
return movementConfirms;
} // getConfirmations
/**
* Add to Description
* @param description text
*/
public void addDescription (String description)
{
String desc = getDescription();
if (desc == null)
setDescription(description);
else
setDescription(desc + " | " + description);
} // addDescription
/**
* Get Document Info
* @return document info (untranslated)
*/
public String getDocumentInfo()
{
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
return dt.getName() + " " + getDocumentNo();
} // getDocumentInfo
/**
* Create PDF
* @return File or null
*/
public File createPDF ()
{
try
{
File temp = File.createTempFile(get_TableName()+get_ID()+"_", ".pdf");
return createPDF (temp);
}
catch (Exception e)
{
log.severe("Could not create PDF - " + e.getMessage());
}
return null;
} // getPDF
/**
* Create PDF file
* @param file output file
* @return file if success
*/
public File createPDF (File file)
{
// ReportEngine re = ReportEngine.get (getCtx(), ReportEngine.INVOICE, getC_Invoice_ID());
// if (re == null)
return null;
// return re.getPDF(file);
} // createPDF
/**
* Before Save
* @param newRecord new
* @return true
*/
protected boolean beforeSave (boolean newRecord)
{
if (getC_DocType_ID() == 0)
{
MDocType docTypes[] = MDocType.getOfDocBaseType(getCtx(), MDocType.DOCBASETYPE_MaterialMovement);
if (docTypes.length > 0) // get first
setC_DocType_ID(docTypes[0].getC_DocType_ID());
else
{
log.saveError("Error", Msg.parseTranslation(getCtx(), "@NotFound@ @C_DocType_ID@"));
return false;
}
}
return true;
} // beforeSave
/**
* Set Processed.
* Propergate to Lines/Taxes
* @param processed processed
*/
@Override
public void setProcessed (boolean processed)
{
super.setProcessed (processed);
if (get_ID() == 0)
return;
final String sql = "UPDATE M_MovementLine SET Processed=? WHERE M_Movement_ID=?";
int noLine = DB.executeUpdateEx(sql, new Object[]{processed, get_ID()}, get_TrxName());
movementLines = null;
log.fine("Processed=" + processed + " - Lines=" + noLine);
} // setProcessed
/**************************************************************************
* Process document
* @param processAction document action
* @return true if performed
*/
public boolean processIt (String processAction)
{
processMessage = null;
DocumentEngine engine = new DocumentEngine (this, getDocStatus());
return engine.processIt (processAction, getDocAction());
} // processIt
/** Process Message */
private String processMessage = null;
/** Just Prepared Flag */
private boolean justPrepared = false;
/**
* Unlock Document.
* @return true if success
*/
public boolean unlockIt()
{
log.info(toString());
setProcessing(false);
return true;
} // unlockIt
/**
* Invalidate Document
* @return true if success
*/
public boolean invalidateIt()
{
log.info(toString());
setDocAction(DOCACTION_Prepare);
return true;
} // invalidateIt
/**
* Prepare Document
* @return new status (In Progress or Invalid)
*/
public String prepareIt()
{
log.info(toString());
processMessage = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_PREPARE);
if (processMessage != null)
return DocAction.STATUS_Invalid;
MDocType docType = MDocType.get(getCtx(), getC_DocType_ID());
// Std Period open?
if (!MPeriod.isOpen(getCtx(), getMovementDate(), docType.getDocBaseType(), getAD_Org_ID()))
{
processMessage = "@PeriodClosed@";
return DocAction.STATUS_Invalid;
}
MMovementLine[] lines = getLines(false);
if (lines.length == 0)
{
processMessage = "@NoLines@";
return DocAction.STATUS_Invalid;
}
// Confirmation
if (docType.isInTransit() && !isReversal())
createConfirmation();
processMessage = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_PREPARE);
if (processMessage != null)
return DocAction.STATUS_Invalid;
justPrepared = true;
if (!DOCACTION_Complete.equals(getDocAction()))
setDocAction(DOCACTION_Complete);
return DocAction.STATUS_InProgress;
} // prepareIt
/**
* Create Movement Confirmation
*/
private void createConfirmation()
{
MMovementConfirm[] movementConfirms = getConfirmations(false);
if (movementConfirms.length > 0)
return;
// Create Confirmation
MMovementConfirm.create (this, false);
} // createConfirmation
/**
* Approve Document
* @return true if success
*/
public boolean approveIt()
{
log.info(toString());
setIsApproved(true);
return true;
} // approveIt
/**
* Reject Approval
* @return true if success
*/
public boolean rejectIt()
{
log.info(toString());
setIsApproved(false);
return true;
} // rejectIt
/**
* Complete Document
* @return new status (Complete, In Progress, Invalid, Waiting ..)
*/
public String completeIt()
{
// Re-Check
if (!justPrepared)
{
String status = prepareIt();
if (!DocAction.STATUS_InProgress.equals(status))
return status;
}
processMessage = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);
if (processMessage != null)
return DocAction.STATUS_Invalid;
// Outstanding (not processed) Incoming Confirmations ?
MMovementConfirm[] movementConfirms = getConfirmations(true);
for (MMovementConfirm movementConfirm : movementConfirms)
{
if (!movementConfirm.isProcessed())
{
processMessage = "Open: @M_MovementConfirm_ID@ - " + movementConfirm.getDocumentNo();
return DocAction.STATUS_InProgress;
}
}
// Implicit Approval
if (!isApproved())
approveIt();
log.info(toString());
//
MMovementLine[] movementLines = getLines(false);
//for (int i = 0; i < movementLines.length; i++)
for (MMovementLine movementLine : movementLines)
{
MTransaction transactionFrom = null;
//Stock Movement - Counterpart MOrder.reserveStock
MProduct product = movementLine.getProduct();
if (product != null
&& product.isStocked() )
{
//Ignore the Material Policy when is Reverse Correction
if(!isReversal())
checkMaterialPolicy(movementLine);
if (movementLine.getM_AttributeSetInstance_ID() == 0)
{
MMovementLineMA movementLineMAS[] = MMovementLineMA.get(getCtx(),
movementLine.getM_MovementLine_ID(), get_TrxName());
for (int j = 0; j < movementLineMAS.length; j++)
{
MMovementLineMA movementLineMA = movementLineMAS[j];
//
MLocator locator = new MLocator (getCtx(), movementLine.getM_Locator_ID(), get_TrxName());
MLocator locatorTo = new MLocator (getCtx(), movementLine.getM_LocatorTo_ID(), get_TrxName());
//Update Storage
if (!MStorage.add(getCtx(),locator.getM_Warehouse_ID(),
movementLine.getM_Locator_ID(),
movementLine.getM_Product_ID(),
movementLineMA.getM_AttributeSetInstance_ID(), 0,
movementLineMA.getMovementQty().negate(), Env.ZERO , Env.ZERO , get_TrxName()))
{
processMessage = "Cannot correct Inventory (MA)";
return DocAction.STATUS_Invalid;
}
int attributeSetInstanceToId = movementLine.getM_AttributeSetInstanceTo_ID();
//only can be same asi if locator is different
if (attributeSetInstanceToId == 0 && movementLine.getM_Locator_ID() != movementLine.getM_LocatorTo_ID())
{
attributeSetInstanceToId = movementLineMA.getM_AttributeSetInstance_ID();
}
//Update Storage
if (!MStorage.add(getCtx(),locatorTo.getM_Warehouse_ID(),
movementLine.getM_LocatorTo_ID(),
movementLine.getM_Product_ID(),
attributeSetInstanceToId, 0,
movementLineMA.getMovementQty(), Env.ZERO , Env.ZERO , get_TrxName()))
{
processMessage = "Cannot correct Inventory (MA)";
return DocAction.STATUS_Invalid;
}
//
transactionFrom = new MTransaction (getCtx(), locator.getAD_Org_ID(),
MTransaction.MOVEMENTTYPE_MovementFrom,
movementLine.getM_Locator_ID(), movementLine.getM_Product_ID(), movementLineMA.getM_AttributeSetInstance_ID(),
movementLineMA.getMovementQty().negate(), getMovementDate(), get_TrxName());
transactionFrom.setM_MovementLine_ID(movementLine.getM_MovementLine_ID());
if (!transactionFrom.save())
{
processMessage = "Transaction From not inserted (MA)";
return DocAction.STATUS_Invalid;
}
MTransaction transactionTo = new MTransaction (getCtx(), locatorTo.getAD_Org_ID(),
MTransaction.MOVEMENTTYPE_MovementTo,
movementLine.getM_LocatorTo_ID(), movementLine.getM_Product_ID(), attributeSetInstanceToId,
movementLineMA.getMovementQty(), getMovementDate(), get_TrxName());
transactionTo.setAD_Org_ID(locatorTo.getAD_Org_ID());
transactionTo.setM_MovementLine_ID(movementLine.getM_MovementLine_ID());
if (!transactionTo.save())
{
processMessage = "Transaction To not inserted (MA)";
return DocAction.STATUS_Invalid;
}
}
}
// Fallback - We have ASI
if (transactionFrom == null)
{
MLocator locator = new MLocator (getCtx(), movementLine.getM_Locator_ID(), get_TrxName());
MLocator locatorTo = new MLocator (getCtx(), movementLine.getM_LocatorTo_ID(), get_TrxName());
//Update Storage
if (!MStorage.add(getCtx(),locator.getM_Warehouse_ID(),
movementLine.getM_Locator_ID(),
movementLine.getM_Product_ID(),
movementLine.getM_AttributeSetInstance_ID(), 0,
movementLine.getMovementQty().negate(), Env.ZERO , Env.ZERO , get_TrxName()))
{
processMessage = "Cannot correct Inventory (MA)";
return DocAction.STATUS_Invalid;
}
//Update Storage
if (!MStorage.add(getCtx(),locatorTo.getM_Warehouse_ID(),
movementLine.getM_LocatorTo_ID(),
movementLine.getM_Product_ID(),
movementLine.getM_AttributeSetInstanceTo_ID(), 0,
movementLine.getMovementQty(), Env.ZERO , Env.ZERO , get_TrxName()))
{
processMessage = "Cannot correct Inventory (MA)";
return DocAction.STATUS_Invalid;
}
//
transactionFrom = new MTransaction (getCtx(), locator.getAD_Org_ID(),
MTransaction.MOVEMENTTYPE_MovementFrom,
movementLine.getM_Locator_ID(), movementLine.getM_Product_ID(), movementLine.getM_AttributeSetInstance_ID(),
movementLine.getMovementQty().negate(), getMovementDate(), get_TrxName());
transactionFrom.setM_MovementLine_ID(movementLine.getM_MovementLine_ID());
if (!transactionFrom.save())
{
processMessage = "Transaction From not inserted";
return DocAction.STATUS_Invalid;
}
MTransaction transactionTo = new MTransaction (getCtx(), locatorTo.getAD_Org_ID(),
MTransaction.MOVEMENTTYPE_MovementTo,
movementLine.getM_LocatorTo_ID(), movementLine.getM_Product_ID(), movementLine.getM_AttributeSetInstanceTo_ID(),
movementLine.getMovementQty(), getMovementDate(), get_TrxName());
transactionTo.setM_MovementLine_ID(movementLine.getM_MovementLine_ID());
transactionTo.setAD_Org_ID(locatorTo.getAD_Org_ID());
if (!transactionTo.save())
{
processMessage = "Transaction To not inserted";
return DocAction.STATUS_Invalid;
}
} // Fallback
} // product stock
} // for all lines
// User Validation
String valid = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE);
if (valid != null)
{
processMessage = valid;
return DocAction.STATUS_Invalid;
}
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
//
setProcessed(true);
setDocAction(DOCACTION_Close);
return DocAction.STATUS_Completed;
} // completeIt
/**
* Set the definite document number after completed
*/
private void setDefiniteDocumentNo() {
MDocType docType = MDocType.get(getCtx(), getC_DocType_ID());
if (docType.isOverwriteDateOnComplete()) {
setMovementDate(new Timestamp (System.currentTimeMillis()));
}
if (docType.isOverwriteSeqOnComplete()) {
Boolean isOverwrite = !isReversal() || (isReversal() && !docType.isCopyDocNoOnReversal());
if (isOverwrite){String value = DB.getDocumentNo(getC_DocType_ID(), get_TrxName(), true, this);
if (value != null)
setDocumentNo(value);
}
}
}
/**
* Check Material Policy
* Sets line ASI
*/
private void checkMaterialPolicy(MMovementLine line)
{
int no = MMovementLineMA.deleteMovementLineMA(line.getM_MovementLine_ID(), get_TrxName());
if (no > 0)
log.config("Delete old #" + no);
boolean needSave = false;
// Attribute Set Instance
if (line.getM_AttributeSetInstance_ID() == 0)
{
MProduct product = MProduct.get(getCtx(), line.getM_Product_ID());
String issuePolicy = product.getMMPolicy();
MStorage[] storages = MStorage.getWarehouse(getCtx(), 0, line.getM_Product_ID(), 0,
null, MClient.MMPOLICY_FiFo.equals(issuePolicy), true, line.getM_Locator_ID(), get_TrxName());
BigDecimal qtyToDeliver = line.getMovementQty();
for (MStorage storage: storages)
{
if (storage.getQtyOnHand().compareTo(qtyToDeliver) >= 0)
{
MMovementLineMA movementLineMA = new MMovementLineMA (line,
storage.getM_AttributeSetInstance_ID(),
qtyToDeliver);
movementLineMA.saveEx();
qtyToDeliver = Env.ZERO;
log.fine( movementLineMA + ", QtyToDeliver=" + qtyToDeliver);
}
else
{
MMovementLineMA movementLineMA = new MMovementLineMA (line,
storage.getM_AttributeSetInstance_ID(),
storage.getQtyOnHand());
movementLineMA.saveEx();
qtyToDeliver = qtyToDeliver.subtract(storage.getQtyOnHand());
log.fine( movementLineMA + ", QtyToDeliver=" + qtyToDeliver);
}
if (qtyToDeliver.signum() == 0)
break;
}
// No AttributeSetInstance found for remainder
if (qtyToDeliver.signum() != 0)
{
//deliver using new asi
MAttributeSet.validateAttributeSetInstanceMandatory(product, line.Table_ID , false , line.getM_AttributeSetInstance_ID());
MAttributeSetInstance attributeSetInstance = MAttributeSetInstance.create(getCtx(), product, get_TrxName());
int attributeSetInstanceId = attributeSetInstance.getM_AttributeSetInstance_ID();
MMovementLineMA movementLineMA = new MMovementLineMA (line, attributeSetInstanceId , qtyToDeliver);
movementLineMA.saveEx();
log.fine("##: " + movementLineMA);
}
} // attributeSetInstance
if (needSave)
{
line.saveEx();
}
} // checkMaterialPolicy
/**
* Void Document.
* @return true if success
*/
public boolean voidIt()
{
log.info(toString());
// Before Void
processMessage = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_VOID);
if (processMessage != null)
return false;
if (DOCSTATUS_Closed.equals(getDocStatus())
|| DOCSTATUS_Reversed.equals(getDocStatus())
|| DOCSTATUS_Voided.equals(getDocStatus()))
{
processMessage = "Document Closed: " + getDocStatus();
return false;
}
// Not Processed
if (DOCSTATUS_Drafted.equals(getDocStatus())
|| DOCSTATUS_Invalid.equals(getDocStatus())
|| DOCSTATUS_InProgress.equals(getDocStatus())
|| DOCSTATUS_Approved.equals(getDocStatus())
|| DOCSTATUS_NotApproved.equals(getDocStatus()) )
{
// Set lines to 0
MMovementLine[] movementLines = getLines(false);
for (int i = 0; i < movementLines.length; i++)
{
MMovementLine movementLine = movementLines[i];
BigDecimal oldMovementLine = movementLine.getMovementQty();
if (oldMovementLine.compareTo(Env.ZERO) != 0)
{
movementLine.setMovementQty(Env.ZERO);
movementLine.addDescription("Void (" + oldMovementLine + ")");
movementLine.saveEx();
}
}
}
else
{
return reverseCorrectIt();
}
// After Void
processMessage = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_VOID);
if (processMessage != null)
return false;
setProcessed(true);
setDocAction(DOCACTION_None);
return true;
} // voidIt
/**
* Close Document.
* @return true if success
*/
public boolean closeIt()
{
log.info(toString());
// Before Close
processMessage = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_CLOSE);
if (processMessage != null)
return false;
// Close Not delivered Qty
setDocAction(DOCACTION_None);
// After Close
processMessage = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_CLOSE);
if (processMessage != null)
return false;
return true;
} // closeIt
/**
* Create reversal based is accrual or not
* @param isAccrual
* @return
*/
public MMovement reverseIt(boolean isAccrual)
{
Timestamp currentDate = new Timestamp(System.currentTimeMillis());
Optional<Timestamp> loginDateOptional = Optional.of(Env.getContextAsDate(getCtx(),"#Date"));
Timestamp reversalDate = isAccrual ? loginDateOptional.orElseGet(() -> currentDate) : getMovementDate();
MDocType docType = MDocType.get(getCtx(), getC_DocType_ID());
MPeriod.testPeriodOpen(getCtx(), reversalDate , docType.getDocBaseType(), getAD_Org_ID());
// Deep Copy
MMovement reversalMovement = new MMovement(getCtx(), 0, get_TrxName());
copyValues(this, reversalMovement, getAD_Client_ID(), getAD_Org_ID());
reversalMovement.setDocStatus(DOCSTATUS_Drafted);
reversalMovement.setDocAction(DOCACTION_Complete);
reversalMovement.setIsApproved (false);
reversalMovement.setIsInTransit (false);
reversalMovement.setPosted(false);
reversalMovement.setProcessed(false);
reversalMovement.set_ValueNoCheck("DocumentNo", null);
reversalMovement.addDescription("{->" + getDocumentNo() + ")");
//FR [ 1948157 ]
reversalMovement.setReversal_ID(getM_Movement_ID());
reversalMovement.setReversal(true);
// Set Document No from flag
if(docType.isCopyDocNoOnReversal()) {
reversalMovement.setDocumentNo(getDocumentNo()+ Msg.getMsg(reversalMovement.getCtx(), "^"));
}
//
if (!reversalMovement.save())
{
processMessage = "Could not create Movement Reversal";
return null;
}
reversalMovement.setReversal(true);
// Reverse Line Qty
Arrays.stream(getLines(true)).forEach(movementLine -> {
MMovementLine reversalMovementLine = new MMovementLine(getCtx(), 0, get_TrxName());
copyValues(movementLine, reversalMovementLine, movementLine.getAD_Client_ID(), movementLine.getAD_Org_ID());
reversalMovementLine.setM_Movement_ID(reversalMovement.getM_Movement_ID());
// store original (voided/reversed) document line
reversalMovementLine.setReversalLine_ID(movementLine.getM_MovementLine_ID());
reversalMovementLine.setMovementQty(movementLine.getMovementQty().negate());
reversalMovementLine.setTargetQty(movementLine.getTargetQty().negate());
reversalMovementLine.setScrappedQty(movementLine.getScrappedQty().negate());
reversalMovementLine.setConfirmedQty(movementLine.getConfirmedQty().negate());
reversalMovementLine.setProcessed(false);
reversalMovementLine.saveEx();
// We need revert MA
MMovementLineMA[] mas = MMovementLineMA.get(getCtx(), movementLine.getM_MovementLine_ID(), get_TrxName());
Arrays.stream(mas).forEach(lineMA -> {
MMovementLineMA reverseLine = new MMovementLineMA (reversalMovementLine, lineMA.getM_AttributeSetInstance_ID(), lineMA.getMovementQty().negate());
reverseLine.saveEx();
});
});
//After that those reverse movements confirmations are generated,
//the reverse reference for movement and movement line are set
Arrays.stream(getConfirmations(true)).forEach(movementConfirm -> {
movementConfirm.reverseCorrectIt();
});
//After movements confirmations are reverce generate the movement id and movement line
Arrays.stream(getConfirmations(true)).filter(movementConfirm -> movementConfirm.getReversal_ID() > 0)
.forEach(movementConfirm -> {
Arrays.stream(reversalMovement.getLines(true)).forEach(reversalMovementLine -> {
Arrays.stream(movementConfirm.getLines(true))
.filter(movementLineConfirm -> movementLineConfirm.getM_MovementLine_ID() == reversalMovementLine.getReversalLine_ID())
.forEach(movementLineConfirm -> {
movementLineConfirm.setM_MovementLine_ID(reversalMovementLine.getM_MovementLine_ID());
movementLineConfirm.saveEx();
});
});
movementConfirm.setM_Movement_ID(reversalMovement.getM_Movement_ID());
movementConfirm.setIsReversal(true);
movementConfirm.saveEx();
});
if (!reversalMovement.processIt(DocAction.ACTION_Complete))
{
processMessage = "Reversal ERROR: " + reversalMovement.getProcessMsg();
return null;
}
reversalMovement.closeIt();
reversalMovement.setDocStatus(DOCSTATUS_Reversed);
reversalMovement.setDocAction(DOCACTION_None);
reversalMovement.saveEx();
processMessage = reversalMovement.getDocumentNo();
// Update Reversed (this)
addDescription("(" + reversalMovement.getDocumentNo() + "<-)");
setReversal_ID(reversalMovement.getM_Movement_ID());
setProcessed(true);
setDocStatus(DOCSTATUS_Reversed); // may come from void
setDocAction(DOCACTION_None);
return reversalMovement;
}
/**
* Reverse Correction
* @return false
*/
public boolean reverseCorrectIt()
{
log.info(toString());
// Before reverseCorrect
processMessage = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSECORRECT);
if (processMessage != null)
return false;
MMovement reversalMovement = reverseIt(true);
if (reversalMovement == null)
return false;
processMessage = reversalMovement.getDocumentNo();
/*MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
if (!MPeriod.isOpen(getCtx(), getMovementDate(), dt.getDocBaseType(), getAD_Org_ID()))
{
processMessage = "@PeriodClosed@";
return false;
}
// Deep Copy
MMovement reversalMovement = new MMovement(getCtx(), 0, get_TrxName());
copyValues(this, reversalMovement, getAD_Client_ID(), getAD_Org_ID());
reversalMovement.setDocStatus(DOCSTATUS_Drafted);
reversalMovement.setDocAction(DOCACTION_Complete);
reversalMovement.setIsApproved (false);
reversalMovement.setIsInTransit (false);
reversalMovement.setPosted(false);
reversalMovement.setProcessed(false);
reversalMovement.set_ValueNoCheck("DocumentNo", null);
reversalMovement.addDescription("{->" + getDocumentNo() + ")");
//FR [ 1948157 ]
reversalMovement.setReversal_ID(getM_Movement_ID());
reversalMovement.setReversal(true);
// Set Document No from flag
if(dt.isCopyDocNoOnReversal()) {
reversalMovement.setDocumentNo(getDocumentNo() + "^");
}
//
if (!reversalMovement.save())
{
processMessage = "Could not create Movement Reversal";
return false;
}
reversalMovement.setReversal(true);
// Reverse Line Qty
Arrays.stream(getLines(true)).forEach(movementLine -> {
MMovementLine reversalMovementLine = new MMovementLine(getCtx(), 0, get_TrxName());
copyValues(movementLine, reversalMovementLine, movementLine.getAD_Client_ID(), movementLine.getAD_Org_ID());
reversalMovementLine.setM_Movement_ID(reversalMovement.getM_Movement_ID());
// store original (voided/reversed) document line
reversalMovementLine.setReversalLine_ID(movementLine.getM_MovementLine_ID());
reversalMovementLine.setMovementQty(movementLine.getMovementQty().negate());
reversalMovementLine.setTargetQty(movementLine.getTargetQty().negate());
reversalMovementLine.setScrappedQty(movementLine.getScrappedQty().negate());
reversalMovementLine.setConfirmedQty(movementLine.getConfirmedQty().negate());
reversalMovementLine.setProcessed(false);
reversalMovementLine.saveEx();
// We need revert MA
MMovementLineMA[] mas = MMovementLineMA.get(getCtx(), movementLine.getM_MovementLine_ID(), get_TrxName());
Arrays.stream(mas).forEach(lineMA -> {
MMovementLineMA reverseLine = new MMovementLineMA (reversalMovementLine, lineMA.getM_AttributeSetInstance_ID(), lineMA.getMovementQty().negate());
reverseLine.saveEx();
});
});
//After that those reverse movements confirmations are generated,
//the reverse reference for movement and movement line are set
Arrays.stream(getConfirmations(true)).forEach(movementConfirm -> {
movementConfirm.reverseCorrectIt();
});
//After movements confirmations are reverce generate the movement id and movement line
Arrays.stream(getConfirmations(true)).filter(movementConfirm -> movementConfirm.getReversal_ID() > 0)
.forEach(movementConfirm -> {
Arrays.stream(reversalMovement.getLines(true)).forEach(reversalMovementLine -> {
Arrays.stream(movementConfirm.getLines(true))
.filter(movementLineConfirm -> movementLineConfirm.getM_MovementLine_ID() == reversalMovementLine.getReversalLine_ID())
.forEach(movementLineConfirm -> {
movementLineConfirm.setM_MovementLine_ID(reversalMovementLine.getM_MovementLine_ID());
movementLineConfirm.saveEx();
});
});
movementConfirm.setM_Movement_ID(reversalMovement.getM_Movement_ID());
movementConfirm.setIsReversal(true);
movementConfirm.saveEx();
});
if (!reversalMovement.processIt(DocAction.ACTION_Complete))
{
processMessage = "Reversal ERROR: " + reversalMovement.getProcessMsg();
return false;
}
reversalMovement.closeIt();
reversalMovement.setDocStatus(DOCSTATUS_Reversed);
reversalMovement.setDocAction(DOCACTION_None);
reversalMovement.saveEx();
processMessage = reversalMovement.getDocumentNo();*/
// After reverseCorrect
processMessage = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSECORRECT);
if (processMessage != null)
return false;
return true;
} // reverseCorrectionIt
/**
* Reverse Accrual - none
* @return false
*/
public boolean reverseAccrualIt()
{
log.info(toString());
// Before reverseAccrual
processMessage = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSEACCRUAL);
if (processMessage != null)
return false;
// After reverseAccrual
processMessage = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSEACCRUAL);
if (processMessage != null)
return false;
return true;
} // reverseAccrualIt
/**
* Re-activate
* @return false
*/
public boolean reActivateIt()
{
log.info(toString());
// Before reActivate
processMessage = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REACTIVATE);
if (processMessage != null)
return false;
// After reActivate
processMessage = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REACTIVATE);
if (processMessage != null)
return false;
return false;
} // reActivateIt
/*************************************************************************
* Get Summary
* @return Summary of Document
*/
public String getSummary()
{
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(getDocumentNo());
// : Total Lines = 123.00 (#1)
stringBuffer.append(": ")
.append(Msg.translate(getCtx(),"ApprovalAmt")).append("=").append(getApprovalAmt())
.append(" (#").append(getLines(false).length).append(")");
// - Description
if (getDescription() != null && getDescription().length() > 0)
stringBuffer.append(" - ").append(getDescription());
return stringBuffer.toString();
} // getSummary
/**
* Get Process Message
* @return clear text error message
*/
public String getProcessMsg()
{
return processMessage;
} // getProcessMsg
/**
* Get Document Owner (Responsible)
* @return AD_User_ID
*/
public int getDoc_User_ID()
{
return getCreatedBy();
} // getDoc_User_ID
/**
* Get Document Currency
* @return C_Currency_ID
*/
public int getC_Currency_ID()
{
// MPriceList pl = MPriceList.get(getCtx(), getM_PriceList_ID());
// return pl.getC_Currency_ID();
return 0;
} // getC_Currency_ID
/** Reversal Flag */
private boolean m_reversal = false;
/**
* Set Reversal
* @param reversal reversal
*/
public void setReversal(boolean reversal)
{
m_reversal = reversal;
} // setReversal
/**
* Is Reversal
* @return reversal
*/
public boolean isReversal()
{
return m_reversal;
} // isReversal
/**
* Document Status is Complete or Closed
* @return true if CO, CL or RE
*/
public boolean isComplete()
{
String ds = getDocStatus();
return DOCSTATUS_Completed.equals(ds)
|| DOCSTATUS_Closed.equals(ds)
|| DOCSTATUS_Reversed.equals(ds);
} // isComplete
private boolean isSameCostDimension(MAcctSchema as, MTransaction trxFrom, MTransaction trxTo)
{
if (trxFrom.getM_Product_ID() != trxTo.getM_Product_ID())
{
throw new AdempiereException("Same product is needed - "+trxFrom+", "+trxTo);
}
MProduct product = MProduct.get(getCtx(), trxFrom.getM_Product_ID());
String costingLevel = product.getCostingLevel(as,trxFrom.getAD_Org_ID());
int orgId = trxFrom.getAD_Org_ID();
int orgToId = trxTo.getAD_Org_ID();
int attributeSetInstanceId = trxFrom.getM_AttributeSetInstance_ID();
int attributeSetInstanceToId = trxTo.getM_AttributeSetInstance_ID();
if (MAcctSchema.COSTINGLEVEL_Client.equals(costingLevel))
{
orgId = 0;
orgToId = 0;
attributeSetInstanceId = 0;
attributeSetInstanceToId = 0;
}
else if (MAcctSchema.COSTINGLEVEL_Organization.equals(costingLevel))
{
attributeSetInstanceId = 0;
attributeSetInstanceToId = 0;
}
else if (MAcctSchema.COSTINGLEVEL_BatchLot.equals(costingLevel))
{
orgId = 0;
orgToId = 0;
}
//
return orgId == orgToId && attributeSetInstanceId == attributeSetInstanceToId;
}
} // MMovement
| {
"pile_set_name": "Github"
} |
//-----------------------------------------------------------------------------
// MEKA - g_action.c
// Miscellaneous GUI action handlers - Code
//-----------------------------------------------------------------------------
// FIXME: Make this code/file obsolete eventually.
//-----------------------------------------------------------------------------
#include "shared.h"
#include "blit.h"
#include "db.h"
#include "video.h"
//-----------------------------------------------------------------------------
// Functions
//-----------------------------------------------------------------------------
// ACTION: QUITTING EMULATOR --------------------------------------------------
// FIXME-DEPTH: Ressources (machines, icons) not faded out
void Action_Quit()
{
Msg(MSGT_STATUS_BAR, "%s", Msg_Get(MSG_Quit));
// Shut up sound while fading
Sound_Playback_Stop();
// Redraw last time, so message appears on screen
gui_redraw_everything_now_once();
/*
// Software, naive, slow fade
// Only 32-bits supported
int depth = bitmap_color_depth(gui_buffer);
switch (depth)
{
case 32:
{
while (TRUE)
{
bool more = FALSE;
int y;
u32 **ppixels = (u32 **)&gui_buffer->line;
for (y = gui_buffer->h; y != 0; y--)
{
u32 *pixels = *ppixels++;
int x;
for (x = gui_buffer->w; x != 0; x--)
{
u32 c = *pixels;
int r = c & 0x000000FF;
int g = c & 0x0000FF00;
int b = c & 0x00FF0000;
int loop;
for (loop = 3; loop != 0; loop--)
{
if (r != 0) r -= 0x000001;
if (g != 0) g -= 0x000100;
if (b != 0) b -= 0x010000;
}
c = r | g | b;
if (c != 0)
more = TRUE;
*pixels++ = c;
}
}
Blit_GUI();
if (!more)
break;
}
} // 32
}
*/
// Switch to full black skin
//Skins_Select(Skins_GetSystemSkinBlack(), TRUE);
//Skins_QuitAfterFade();
opt.Force_Quit = TRUE;
}
// ACTION: SHOW OR HIDE SPRITES LAYER -----------------------------------------------
void Action_Switch_Layer_Sprites (void)
{
opt.Layer_Mask ^= LAYER_SPRITES;
gui_menu_toggle_check (menus_ID.layers, 0);
if (opt.Layer_Mask & LAYER_SPRITES)
{
Msg(MSGT_USER, "%s", Msg_Get(MSG_Layer_Spr_Enabled));
}
else
{
Msg(MSGT_USER, "%s", Msg_Get(MSG_Layer_Spr_Disabled));
}
}
// ACTION: SHOW OR HIDE BACKGROUND LAYER --------------------------------------
void Action_Switch_Layer_Background (void)
{
opt.Layer_Mask ^= LAYER_BACKGROUND;
gui_menu_toggle_check (menus_ID.layers, 1);
if (opt.Layer_Mask & LAYER_BACKGROUND)
{
Msg(MSGT_USER, "%s", Msg_Get(MSG_Layer_BG_Enabled));
}
else
{
Msg(MSGT_USER, "%s", Msg_Get(MSG_Layer_BG_Disabled));
}
}
// ACTION: SWITCH SPRITE FLICKERING TO 'AUTOMATIC' ----------------------------
void Action_Switch_Flickering_Auto (void)
{
g_config.sprite_flickering = SPRITE_FLICKERING_AUTO;
if (DB.current_entry && (DB.current_entry->flags & DB_FLAG_EMU_SPRITE_FLICKER))
g_config.sprite_flickering |= SPRITE_FLICKERING_ENABLED;
gui_menu_uncheck_all (menus_ID.flickering);
gui_menu_check (menus_ID.flickering, 0);
Msg(MSGT_USER, "%s", Msg_Get(MSG_Flickering_Auto));
}
// ACTION: SWITCH SPRITE FLICKERING TO 'TRUE' ----------------------------------
void Action_Switch_Flickering_Yes (void)
{
g_config.sprite_flickering = SPRITE_FLICKERING_ENABLED;
gui_menu_uncheck_all (menus_ID.flickering);
gui_menu_check (menus_ID.flickering, 1);
Msg(MSGT_USER, "%s", Msg_Get(MSG_Flickering_Yes));
}
// ACTION: SWITCH SPRITE FLICKERING TO 'FALSE' -----------------------------------
void Action_Switch_Flickering_No (void)
{
g_config.sprite_flickering = SPRITE_FLICKERING_NO;
gui_menu_uncheck_all (menus_ID.flickering);
gui_menu_check (menus_ID.flickering, 2);
Msg(MSGT_USER, "%s", Msg_Get(MSG_Flickering_No));
}
// ACTION: SWITCH BETWEEN FULLSCREEN AND INTERFACE MODES ----------------------
void Action_Switch_Mode(void)
{
switch (g_env.state)
{
case MEKA_STATE_GAME: g_env.state = MEKA_STATE_GUI; break;
case MEKA_STATE_GUI: g_env.state = MEKA_STATE_GAME; break;
default:
// FIXME: Should not happen
break;
}
Sound_Playback_Mute();
Video_Setup_State();
Sound_Playback_Resume();
}
//-----------------------------------------------------------------------------
| {
"pile_set_name": "Github"
} |
/* infback.c -- inflate using a call-back interface
* Copyright (C) 1995-2005 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/*
This code is largely copied from inflate.c. Normally either infback.o or
inflate.o would be linked into an application--not both. The interface
with inffast.c is retained so that optimized assembler-coded versions of
inflate_fast() can be used with either inflate.c or infback.c.
*/
#include "zutil.h"
#include "inftrees.h"
#include "inflate.h"
#include "inffast.h"
/* function prototypes */
local void fixedtables OF((struct inflate_state FAR *state));
/*
strm provides memory allocation functions in zalloc and zfree, or
Z_NULL to use the library memory allocation functions.
windowBits is in the range 8..15, and window is a user-supplied
window and output buffer that is 2**windowBits bytes.
*/
int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size)
z_streamp strm;
int windowBits;
unsigned char FAR *window;
const char *version;
int stream_size;
{
struct inflate_state FAR *state;
if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
stream_size != (int)(sizeof(z_stream)))
return Z_VERSION_ERROR;
if (strm == Z_NULL || window == Z_NULL ||
windowBits < 8 || windowBits > 15)
return Z_STREAM_ERROR;
strm->msg = Z_NULL; /* in case we return an error */
if (strm->zalloc == (alloc_func)0) {
strm->zalloc = zcalloc;
strm->opaque = (voidpf)0;
}
if (strm->zfree == (free_func)0) strm->zfree = zcfree;
state = (struct inflate_state FAR *)ZALLOC(strm, 1,
sizeof(struct inflate_state));
if (state == Z_NULL) return Z_MEM_ERROR;
Tracev((stderr, "inflate: allocated\n"));
strm->state = (struct internal_state FAR *)state;
state->dmax = 32768U;
state->wbits = windowBits;
state->wsize = 1U << windowBits;
state->window = window;
state->write = 0;
state->whave = 0;
return Z_OK;
}
/*
Return state with length and distance decoding tables and index sizes set to
fixed code decoding. Normally this returns fixed tables from inffixed.h.
If BUILDFIXED is defined, then instead this routine builds the tables the
first time it's called, and returns those tables the first time and
thereafter. This reduces the size of the code by about 2K bytes, in
exchange for a little execution time. However, BUILDFIXED should not be
used for threaded applications, since the rewriting of the tables and virgin
may not be thread-safe.
*/
local void fixedtables(state)
struct inflate_state FAR *state;
{
#ifdef BUILDFIXED
static int virgin = 1;
static code *lenfix, *distfix;
static code fixed[544];
/* build fixed huffman tables if first call (may not be thread safe) */
if (virgin) {
unsigned sym, bits;
static code *next;
/* literal/length table */
sym = 0;
while (sym < 144) state->lens[sym++] = 8;
while (sym < 256) state->lens[sym++] = 9;
while (sym < 280) state->lens[sym++] = 7;
while (sym < 288) state->lens[sym++] = 8;
next = fixed;
lenfix = next;
bits = 9;
inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
/* distance table */
sym = 0;
while (sym < 32) state->lens[sym++] = 5;
distfix = next;
bits = 5;
inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
/* do this just once */
virgin = 0;
}
#else /* !BUILDFIXED */
# include "inffixed.h"
#endif /* BUILDFIXED */
state->lencode = lenfix;
state->lenbits = 9;
state->distcode = distfix;
state->distbits = 5;
}
/* Macros for inflateBack(): */
/* Load returned state from inflate_fast() */
#define LOAD() \
do { \
put = strm->next_out; \
left = strm->avail_out; \
next = strm->next_in; \
have = strm->avail_in; \
hold = state->hold; \
bits = state->bits; \
} while (0)
/* Set state from registers for inflate_fast() */
#define RESTORE() \
do { \
strm->next_out = put; \
strm->avail_out = left; \
strm->next_in = next; \
strm->avail_in = have; \
state->hold = hold; \
state->bits = bits; \
} while (0)
/* Clear the input bit accumulator */
#define INITBITS() \
do { \
hold = 0; \
bits = 0; \
} while (0)
/* Assure that some input is available. If input is requested, but denied,
then return a Z_BUF_ERROR from inflateBack(). */
#define PULL() \
do { \
if (have == 0) { \
have = in(in_desc, &next); \
if (have == 0) { \
next = Z_NULL; \
ret = Z_BUF_ERROR; \
goto inf_leave; \
} \
} \
} while (0)
/* Get a byte of input into the bit accumulator, or return from inflateBack()
with an error if there is no input available. */
#define PULLBYTE() \
do { \
PULL(); \
have--; \
hold += (unsigned long)(*next++) << bits; \
bits += 8; \
} while (0)
/* Assure that there are at least n bits in the bit accumulator. If there is
not enough available input to do that, then return from inflateBack() with
an error. */
#define NEEDBITS(n) \
do { \
while (bits < (unsigned)(n)) \
PULLBYTE(); \
} while (0)
/* Return the low n bits of the bit accumulator (n < 16) */
#define BITS(n) \
((unsigned)hold & ((1U << (n)) - 1))
/* Remove n bits from the bit accumulator */
#define DROPBITS(n) \
do { \
hold >>= (n); \
bits -= (unsigned)(n); \
} while (0)
/* Remove zero to seven bits as needed to go to a byte boundary */
#define BYTEBITS() \
do { \
hold >>= bits & 7; \
bits -= bits & 7; \
} while (0)
/* Assure that some output space is available, by writing out the window
if it's full. If the write fails, return from inflateBack() with a
Z_BUF_ERROR. */
#define ROOM() \
do { \
if (left == 0) { \
put = state->window; \
left = state->wsize; \
state->whave = left; \
if (out(out_desc, put, left)) { \
ret = Z_BUF_ERROR; \
goto inf_leave; \
} \
} \
} while (0)
/*
strm provides the memory allocation functions and window buffer on input,
and provides information on the unused input on return. For Z_DATA_ERROR
returns, strm will also provide an error message.
in() and out() are the call-back input and output functions. When
inflateBack() needs more input, it calls in(). When inflateBack() has
filled the window with output, or when it completes with data in the
window, it calls out() to write out the data. The application must not
change the provided input until in() is called again or inflateBack()
returns. The application must not change the window/output buffer until
inflateBack() returns.
in() and out() are called with a descriptor parameter provided in the
inflateBack() call. This parameter can be a structure that provides the
information required to do the read or write, as well as accumulated
information on the input and output such as totals and check values.
in() should return zero on failure. out() should return non-zero on
failure. If either in() or out() fails, than inflateBack() returns a
Z_BUF_ERROR. strm->next_in can be checked for Z_NULL to see whether it
was in() or out() that caused in the error. Otherwise, inflateBack()
returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format
error, or Z_MEM_ERROR if it could not allocate memory for the state.
inflateBack() can also return Z_STREAM_ERROR if the input parameters
are not correct, i.e. strm is Z_NULL or the state was not initialized.
*/
int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc)
z_streamp strm;
in_func in;
void FAR *in_desc;
out_func out;
void FAR *out_desc;
{
struct inflate_state FAR *state;
unsigned char FAR *next; /* next input */
unsigned char FAR *put; /* next output */
unsigned have, left; /* available input and output */
unsigned long hold; /* bit buffer */
unsigned bits; /* bits in bit buffer */
unsigned copy; /* number of stored or match bytes to copy */
unsigned char FAR *from; /* where to copy match bytes from */
code this; /* current decoding table entry */
code last; /* parent table entry */
unsigned len; /* length to copy for repeats, bits to drop */
int ret; /* return code */
static const unsigned short order[19] = /* permutation of code lengths */
{16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
/* Check that the strm exists and that the state was initialized */
if (strm == Z_NULL || strm->state == Z_NULL)
return Z_STREAM_ERROR;
state = (struct inflate_state FAR *)strm->state;
/* Reset the state */
strm->msg = Z_NULL;
state->mode = TYPE;
state->last = 0;
state->whave = 0;
next = strm->next_in;
have = next != Z_NULL ? strm->avail_in : 0;
hold = 0;
bits = 0;
put = state->window;
left = state->wsize;
/* Inflate until end of block marked as last */
for (;;)
switch (state->mode) {
case TYPE:
/* determine and dispatch block type */
if (state->last) {
BYTEBITS();
state->mode = DONE;
break;
}
NEEDBITS(3);
state->last = BITS(1);
DROPBITS(1);
switch (BITS(2)) {
case 0: /* stored block */
Tracev((stderr, "inflate: stored block%s\n",
state->last ? " (last)" : ""));
state->mode = STORED;
break;
case 1: /* fixed block */
fixedtables(state);
Tracev((stderr, "inflate: fixed codes block%s\n",
state->last ? " (last)" : ""));
state->mode = LEN; /* decode codes */
break;
case 2: /* dynamic block */
Tracev((stderr, "inflate: dynamic codes block%s\n",
state->last ? " (last)" : ""));
state->mode = TABLE;
break;
case 3:
strm->msg = (char *)"invalid block type";
state->mode = BAD;
}
DROPBITS(2);
break;
case STORED:
/* get and verify stored block length */
BYTEBITS(); /* go to byte boundary */
NEEDBITS(32);
if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
strm->msg = (char *)"invalid stored block lengths";
state->mode = BAD;
break;
}
state->length = (unsigned)hold & 0xffff;
Tracev((stderr, "inflate: stored length %u\n",
state->length));
INITBITS();
/* copy stored block from input to output */
while (state->length != 0) {
copy = state->length;
PULL();
ROOM();
if (copy > have) copy = have;
if (copy > left) copy = left;
zmemcpy(put, next, copy);
have -= copy;
next += copy;
left -= copy;
put += copy;
state->length -= copy;
}
Tracev((stderr, "inflate: stored end\n"));
state->mode = TYPE;
break;
case TABLE:
/* get dynamic table entries descriptor */
NEEDBITS(14);
state->nlen = BITS(5) + 257;
DROPBITS(5);
state->ndist = BITS(5) + 1;
DROPBITS(5);
state->ncode = BITS(4) + 4;
DROPBITS(4);
#ifndef PKZIP_BUG_WORKAROUND
if (state->nlen > 286 || state->ndist > 30) {
strm->msg = (char *)"too many length or distance symbols";
state->mode = BAD;
break;
}
#endif
Tracev((stderr, "inflate: table sizes ok\n"));
/* get code length code lengths (not a typo) */
state->have = 0;
while (state->have < state->ncode) {
NEEDBITS(3);
state->lens[order[state->have++]] = (unsigned short)BITS(3);
DROPBITS(3);
}
while (state->have < 19)
state->lens[order[state->have++]] = 0;
state->next = state->codes;
state->lencode = (code const FAR *)(state->next);
state->lenbits = 7;
ret = inflate_table(CODES, state->lens, 19, &(state->next),
&(state->lenbits), state->work);
if (ret) {
strm->msg = (char *)"invalid code lengths set";
state->mode = BAD;
break;
}
Tracev((stderr, "inflate: code lengths ok\n"));
/* get length and distance code code lengths */
state->have = 0;
while (state->have < state->nlen + state->ndist) {
for (;;) {
this = state->lencode[BITS(state->lenbits)];
if ((unsigned)(this.bits) <= bits) break;
PULLBYTE();
}
if (this.val < 16) {
NEEDBITS(this.bits);
DROPBITS(this.bits);
state->lens[state->have++] = this.val;
}
else {
if (this.val == 16) {
NEEDBITS(this.bits + 2);
DROPBITS(this.bits);
if (state->have == 0) {
strm->msg = (char *)"invalid bit length repeat";
state->mode = BAD;
break;
}
len = (unsigned)(state->lens[state->have - 1]);
copy = 3 + BITS(2);
DROPBITS(2);
}
else if (this.val == 17) {
NEEDBITS(this.bits + 3);
DROPBITS(this.bits);
len = 0;
copy = 3 + BITS(3);
DROPBITS(3);
}
else {
NEEDBITS(this.bits + 7);
DROPBITS(this.bits);
len = 0;
copy = 11 + BITS(7);
DROPBITS(7);
}
if (state->have + copy > state->nlen + state->ndist) {
strm->msg = (char *)"invalid bit length repeat";
state->mode = BAD;
break;
}
while (copy--)
state->lens[state->have++] = (unsigned short)len;
}
}
/* handle error breaks in while */
if (state->mode == BAD) break;
/* build code tables */
state->next = state->codes;
state->lencode = (code const FAR *)(state->next);
state->lenbits = 9;
ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
&(state->lenbits), state->work);
if (ret) {
strm->msg = (char *)"invalid literal/lengths set";
state->mode = BAD;
break;
}
state->distcode = (code const FAR *)(state->next);
state->distbits = 6;
ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
&(state->next), &(state->distbits), state->work);
if (ret) {
strm->msg = (char *)"invalid distances set";
state->mode = BAD;
break;
}
Tracev((stderr, "inflate: codes ok\n"));
state->mode = LEN;
case LEN:
/* use inflate_fast() if we have enough input and output */
if (have >= 6 && left >= 258) {
RESTORE();
if (state->whave < state->wsize)
state->whave = state->wsize - left;
inflate_fast(strm, state->wsize);
LOAD();
break;
}
/* get a literal, length, or end-of-block code */
for (;;) {
this = state->lencode[BITS(state->lenbits)];
if ((unsigned)(this.bits) <= bits) break;
PULLBYTE();
}
if (this.op && (this.op & 0xf0) == 0) {
last = this;
for (;;) {
this = state->lencode[last.val +
(BITS(last.bits + last.op) >> last.bits)];
if ((unsigned)(last.bits + this.bits) <= bits) break;
PULLBYTE();
}
DROPBITS(last.bits);
}
DROPBITS(this.bits);
state->length = (unsigned)this.val;
/* process literal */
if (this.op == 0) {
Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ?
"inflate: literal '%c'\n" :
"inflate: literal 0x%02x\n", this.val));
ROOM();
*put++ = (unsigned char)(state->length);
left--;
state->mode = LEN;
break;
}
/* process end of block */
if (this.op & 32) {
Tracevv((stderr, "inflate: end of block\n"));
state->mode = TYPE;
break;
}
/* invalid code */
if (this.op & 64) {
strm->msg = (char *)"invalid literal/length code";
state->mode = BAD;
break;
}
/* length code -- get extra bits, if any */
state->extra = (unsigned)(this.op) & 15;
if (state->extra != 0) {
NEEDBITS(state->extra);
state->length += BITS(state->extra);
DROPBITS(state->extra);
}
Tracevv((stderr, "inflate: length %u\n", state->length));
/* get distance code */
for (;;) {
this = state->distcode[BITS(state->distbits)];
if ((unsigned)(this.bits) <= bits) break;
PULLBYTE();
}
if ((this.op & 0xf0) == 0) {
last = this;
for (;;) {
this = state->distcode[last.val +
(BITS(last.bits + last.op) >> last.bits)];
if ((unsigned)(last.bits + this.bits) <= bits) break;
PULLBYTE();
}
DROPBITS(last.bits);
}
DROPBITS(this.bits);
if (this.op & 64) {
strm->msg = (char *)"invalid distance code";
state->mode = BAD;
break;
}
state->offset = (unsigned)this.val;
/* get distance extra bits, if any */
state->extra = (unsigned)(this.op) & 15;
if (state->extra != 0) {
NEEDBITS(state->extra);
state->offset += BITS(state->extra);
DROPBITS(state->extra);
}
if (state->offset > state->wsize - (state->whave < state->wsize ?
left : 0)) {
strm->msg = (char *)"invalid distance too far back";
state->mode = BAD;
break;
}
Tracevv((stderr, "inflate: distance %u\n", state->offset));
/* copy match from window to output */
do {
ROOM();
copy = state->wsize - state->offset;
if (copy < left) {
from = put + copy;
copy = left - copy;
}
else {
from = put - state->offset;
copy = left;
}
if (copy > state->length) copy = state->length;
state->length -= copy;
left -= copy;
do {
*put++ = *from++;
} while (--copy);
} while (state->length != 0);
break;
case DONE:
/* inflate stream terminated properly -- write leftover output */
ret = Z_STREAM_END;
if (left < state->wsize) {
if (out(out_desc, state->window, state->wsize - left))
ret = Z_BUF_ERROR;
}
goto inf_leave;
case BAD:
ret = Z_DATA_ERROR;
goto inf_leave;
default: /* can't happen, but makes compilers happy */
ret = Z_STREAM_ERROR;
goto inf_leave;
}
/* Return unused input */
inf_leave:
strm->next_in = next;
strm->avail_in = have;
return ret;
}
int ZEXPORT inflateBackEnd(strm)
z_streamp strm;
{
if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
return Z_STREAM_ERROR;
ZFREE(strm, strm->state);
strm->state = Z_NULL;
Tracev((stderr, "inflate: end\n"));
return Z_OK;
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="SliderLayout">
<!-- indicator visibility -->
<attr name="indicator_visibility" format="enum">
<enum name="visible" value="0"/>
<enum name="invisible" value="1"/>
</attr>
<attr name="auto_cycle" format="boolean"/>
<!-- page animation -->
<attr name="pager_animation" format="enum">
<enum name="Default" value="0">Default</enum>
<enum name="Accordion" value="1">Accordion</enum>
<enum name="Background2Foreground" value="2">Background2Foreground</enum>
<enum name="CubeIn" value="3">CubeIn</enum>
<enum name="DepthPage" value="4">DepthPage</enum>
<enum name="Fade" value="5">Fade</enum>
<enum name="FlipHorizontal" value="6">FlipHorizontal</enum>
<enum name="FlipPage" value="7">FlipPage</enum>
<enum name="Foreground2Background" value="8">Foreground2Background</enum>
<enum name="RotateDown" value="9">RotateDown</enum>
<enum name="RotateUp" value="10">RotateUp</enum>
<enum name="Stack" value="11">Stack</enum>
<enum name="Tablet" value="12">Tablet</enum>
<enum name="ZoomIn" value="13">ZoomIn</enum>
<enum name="ZoomOutSlide" value="14">ZoomOutSlide</enum>
<enum name="ZoomOut" value="15">ZoomOut</enum>
</attr>
<!-- page animation time span -->
<attr name="pager_animation_span" format="integer"/>
</declare-styleable>
<declare-styleable name="PagerIndicator">
<!-- indicator visibility -->
<attr name="visibility" format="enum">
<enum name="visible" value="0"/>
<enum name="invisible" value="1"/>
</attr>
<attr name="shape" format="enum">
<enum value="0" name="oval"/>
<enum value="1" name="rect"/>
</attr>
<attr name="selected_color" format="color"/>
<attr name="unselected_color" format="color"/>
<!-- indicator style -->
<attr name="selected_drawable" format="reference"/>
<attr name="unselected_drawable" format="reference"/>
<attr name="selected_width" format="dimension"/>
<attr name="selected_height" format="dimension"/>
<attr name="unselected_width" format="dimension"/>
<attr name="unselected_height" format="dimension"/>
<attr name="padding_left" format="dimension"/>
<attr name="padding_right" format="dimension"/>
<attr name="padding_top" format="dimension"/>
<attr name="padding_bottom" format="dimension"/>
<attr name="selected_padding_left" format="dimension"/>
<attr name="selected_padding_right" format="dimension"/>
<attr name="selected_padding_top" format="dimension"/>
<attr name="selected_padding_bottom" format="dimension"/>
<attr name="unselected_padding_left" format="dimension"/>
<attr name="unselected_padding_right" format="dimension"/>
<attr name="unselected_padding_top" format="dimension"/>
<attr name="unselected_padding_bottom" format="dimension"/>
</declare-styleable>
<declare-styleable name="Themes">
<attr name="SliderStyle" format="reference"/>
<attr name="PagerIndicatorStyle" format="reference"/>
</declare-styleable>
<declare-styleable name="SlidingMenu">
<attr name="mode">
<enum name="left" value="0" />
<enum name="right" value="1" />
</attr>
<attr name="viewAbove" format="reference" />
<attr name="viewBehind" format="reference" />
<attr name="behindOffset" format="dimension" />
<attr name="behindWidth" format="dimension" />
<attr name="behindScrollScale" format="float" />
<attr name="touchModeAbove">
<enum name="margin" value="0" />
<enum name="fullscreen" value="1" />
</attr>
<attr name="touchModeBehind">
<enum name="margin" value="0" />
<enum name="fullscreen" value="1" />
</attr>
<attr name="shadowDrawable" format="reference" />
<attr name="shadowWidth" format="dimension" />
<attr name="fadeEnabled" format="boolean" />
<attr name="fadeDegree" format="float" />
<attr name="selectorEnabled" format="boolean" />
<attr name="selectorDrawable" format="reference" />
</declare-styleable>
<declare-styleable name="SwipeListView">
<attr name="swipeOpenOnLongPress" format="boolean"/>
<attr name="swipeAnimationTime" format="integer"/>
<attr name="swipeOffsetLeft" format="dimension"/>
<attr name="swipeOffsetRight" format="dimension"/>
<attr name="swipeCloseAllItemsWhenMoveList" format="boolean"/>
<attr name="swipeFrontView" format="reference"/>
<attr name="swipeBackView" format="reference"/>
<attr name="swipeMode" format="enum">
<enum name="none" value="0"/>
<enum name="both" value="1"/>
<enum name="right" value="2"/>
<enum name="left" value="3"/>
</attr>
<attr name="swipeActionLeft" format="enum">
<enum name="reveal" value="0"/>
<enum name="dismiss" value="1"/>
<enum name="choice" value="2"/>
</attr>
<attr name="swipeActionRight" format="enum">
<enum name="reveal" value="0"/>
<enum name="dismiss" value="1"/>
<enum name="choice" value="2"/>
</attr>
<attr name="swipeDrawableChecked" format="reference"/>
<attr name="swipeDrawableUnchecked" format="reference"/>
<attr name="swipeIsDropDownStyle" format="boolean" />
<attr name="swipeIsOnBottomStyle" format="boolean" />
<attr name="swipeIsAutoLoadOnBottom" format="boolean" />
</declare-styleable>
<declare-styleable name="drop_down_list_attr">
<attr name="isDropDownStyle" format="boolean" />
<attr name="isOnBottomStyle" format="boolean" />
<attr name="isAutoLoadOnBottom" format="boolean" />
</declare-styleable>
<declare-styleable name="FlipView">
<attr name="orientation" format="enum">
<enum name="vertical" value="0"/>
<enum name="horizontal" value="1"/>
</attr>
<attr name="overFlipMode" format="enum">
<enum name="glow" value="0"/>
<enum name="rubber_band" value="1"/>
</attr>
</declare-styleable>
<!-- 图片加载进度条 -->
<attr name="progressButtonStyle" format="reference"/>
<declare-styleable name="ProgressButton">
<attr name="progress" format="integer"/>
<attr name="max" format="integer"/>
<attr name="circleColor" format="color"/>
<attr name="progressColor" format="color"/>
<attr name="shadowDrawable1" format="reference"/>
<attr name="pinnedDrawable" format="reference"/>
<attr name="unpinnedDrawable" format="reference"/>
<attr name="innerSize" format="dimension"/>
<attr name="pinned" format="boolean"/>
<attr name="animating" format="boolean"/>
<attr name="animationSpeed" format="integer"/>
<attr name="animationDelay" format="integer"/>
<attr name="animationStripWidth" format="integer"/>
<attr name="android:background"/>
<attr name="android:clickable"/>
<attr name="android:focusable"/>
</declare-styleable>
<declare-styleable name="ProgressPieView">
<attr name="progress1" format="integer"/>
<attr name="max1" format="integer"/>
<attr name="startAngle" format="integer"/>
<attr name="strokeWidth" format="dimension"/>
<attr name="backgroundColor" format="reference|color"/>
<attr name="progressColor1" format="reference|color"/>
<attr name="strokeColor" format="reference|color"/>
<attr name="showStroke" format="boolean"/>
<attr name="showText" format="boolean"/>
<attr name="typeface" format="string"/>
<attr name="image" format="reference"/>
<attr name="android:text"/>
<attr name="android:textSize"/>
<attr name="android:textColor"/>
<attr name="progressFillType" format="enum" >
<enum name="radial" value="0"/>
<enum name="center" value="1"/>
</attr>
</declare-styleable>
<!-- 首页欢迎页 -->
<declare-styleable name="DiscrollView_LayoutParams">
<attr name="discrollve_alpha" format="boolean"/>
<attr name="discrollve_scaleX" format="boolean"/>
<attr name="discrollve_scaleY" format="boolean"/>
<attr name="discrollve_threshold" format="float"/>
<attr name="discrollve_fromBgColor" format="color"/>
<attr name="discrollve_toBgColor" format="color"/>
<attr name="discrollve_translation"/>
</declare-styleable>
<attr name="discrollve_translation">
<flag name="fromTop" value="0x01" />
<flag name="fromBottom" value="0x02" />
<flag name="fromLeft" value="0x04" />
<flag name="fromRight" value="0x08" />
</attr>
</resources> | {
"pile_set_name": "Github"
} |
// Copyright (c) 2011-2019 Roland Pheasant. All rights reserved.
// Roland Pheasant licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.Linq;
using DynamicData.Annotations;
using DynamicData.Kernel;
using System.Collections.ObjectModel;
// ReSharper disable once CheckNamespace
namespace DynamicData
{
/// <summary>
/// Extensions to help with maintainence of a list
/// </summary>
public static class ListEx
{
#region Apply operators to a list
internal static bool MovedWithinRange<T>(this Change<T> source, int startIndex, int endIndex)
{
if (source.Reason != ListChangeReason.Moved)
{
return false;
}
var current = source.Item.CurrentIndex;
var previous = source.Item.PreviousIndex;
return current >= startIndex && current <= endIndex
|| previous >= startIndex && previous <= endIndex;
}
/// <summary>
/// Clones the list from the specified change set
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="source">The source.</param>
/// <param name="changes">The changes.</param>
/// <exception cref="System.ArgumentNullException">
/// source
/// or
/// changes
/// </exception>
public static void Clone<T>(this IList<T> source, IChangeSet<T> changes)
{
Clone(source, changes, null);
}
/// <summary>
/// Clones the list from the specified change set
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="source">The source.</param>
/// <param name="changes">The changes.</param>
/// <param name="equalityComparer">An equality comparer to match items in the changes.</param>
/// <exception cref="System.ArgumentNullException">
/// source
/// or
/// changes
/// </exception>
public static void Clone<T>(this IList<T> source, IChangeSet<T> changes, IEqualityComparer<T> equalityComparer)
{
Clone(source, (IEnumerable<Change<T>>)changes, equalityComparer);
}
/// <summary>
/// Clones the list from the specified enumerable of changes
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="source">The source.</param>
/// <param name="changes">The changes.</param>
/// <param name="equalityComparer">An equality comparer to match items in the changes.</param>
/// <exception cref="System.ArgumentNullException">
/// source
/// or
/// changes
/// </exception>
public static void Clone<T>(this IList<T> source, IEnumerable<Change<T>> changes, IEqualityComparer<T> equalityComparer)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (changes == null)
{
throw new ArgumentNullException(nameof(changes));
}
foreach (var item in changes)
{
Clone(source, item, equalityComparer ?? EqualityComparer<T>.Default);
}
}
private static void Clone<T>(this IList<T> source, Change<T> item, IEqualityComparer<T> equalityComparer)
{
var changeAware = source as ChangeAwareList<T>;
switch (item.Reason)
{
case ListChangeReason.Add:
{
var change = item.Item;
var hasIndex = change.CurrentIndex >= 0;
if (hasIndex)
{
source.Insert(change.CurrentIndex, change.Current);
}
else
{
source.Add(change.Current);
}
break;
}
case ListChangeReason.AddRange:
{
source.AddOrInsertRange(item.Range, item.Range.Index);
break;
}
case ListChangeReason.Clear:
{
source.ClearOrRemoveMany(item);
break;
}
case ListChangeReason.Replace:
{
var change = item.Item;
if (change.CurrentIndex >= 0 && change.CurrentIndex == change.PreviousIndex)
{
source[change.CurrentIndex] = change.Current;
}
else
{
if (change.PreviousIndex == -1)
{
source.Remove(change.Previous.Value);
}
else
{
//is this best? or replace + move?
source.RemoveAt(change.PreviousIndex);
}
if (change.CurrentIndex == -1)
{
source.Add(change.Current);
}
else
{
source.Insert(change.CurrentIndex, change.Current);
}
}
break;
}
case ListChangeReason.Refresh:
{
if (changeAware != null)
{
changeAware.RefreshAt(item.Item.CurrentIndex);
}
else
{
source.RemoveAt(item.Item.CurrentIndex);
source.Insert(item.Item.CurrentIndex, item.Item.Current);
}
break;
}
case ListChangeReason.Remove:
{
var change = item.Item;
bool hasIndex = change.CurrentIndex >= 0;
if (hasIndex)
{
source.RemoveAt(change.CurrentIndex);
}
else
{
if (equalityComparer != null)
{
int index = source.IndexOf(change.Current, equalityComparer);
if (index > -1)
{
source.RemoveAt(index);
}
}
else
{
source.Remove(change.Current);
}
}
break;
}
case ListChangeReason.RemoveRange:
{
//ignore this case because WhereReasonsAre removes the index [in which case call RemoveMany]
//if (item.Range.Index < 0)
// throw new UnspecifiedIndexException("ListChangeReason.RemoveRange should not have an index specified index");
if (item.Range.Index >= 0 && (source is IExtendedList<T> || source is List<T>))
{
source.RemoveRange(item.Range.Index, item.Range.Count);
}
else
{
source.RemoveMany(item.Range);
}
break;
}
case ListChangeReason.Moved:
{
var change = item.Item;
bool hasIndex = change.CurrentIndex >= 0;
if (!hasIndex)
{
throw new UnspecifiedIndexException("Cannot move as an index was not specified");
}
if (source is IExtendedList<T> extendedList)
{
extendedList.Move(change.PreviousIndex, change.CurrentIndex);
}
else if (source is ObservableCollection<T> observableCollection)
{
observableCollection.Move(change.PreviousIndex, change.CurrentIndex);
}
else
{
//check this works whatever the index is
source.RemoveAt(change.PreviousIndex);
source.Insert(change.CurrentIndex, change.Current);
}
break;
}
}
}
/// <summary>
/// Clears the collection if the number of items in the range is the same as the source collection. Otherwise a remove many operation is applied.
///
/// NB: This is because an observable change set may be a composite of multiple change sets in which case if one of them has clear operation applied it should not clear the entire result.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="source">The source.</param>
/// <param name="change">The change.</param>
internal static void ClearOrRemoveMany<T>(this IList<T> source, Change<T> change)
{
//apply this to other operators
if (source.Count == change.Range.Count)
{
source.Clear();
}
else
{
source.RemoveMany(change.Range);
}
}
#endregion
#region Binary Search / Lookup
/// <summary>
/// Performs a binary search on the specified collection.
/// </summary>
/// <typeparam name="TItem">The type of the item.</typeparam>
/// <param name="list">The list to be searched.</param>
/// <param name="value">The value to search for.</param>
/// <returns></returns>
public static int BinarySearch<TItem>(this IList<TItem> list, TItem value)
{
return BinarySearch(list, value, Comparer<TItem>.Default);
}
/// <summary>
/// Performs a binary search on the specified collection.
/// </summary>
/// <typeparam name="TItem">The type of the item.</typeparam>
/// <param name="list">The list to be searched.</param>
/// <param name="value">The value to search for.</param>
/// <param name="comparer">The comparer that is used to compare the value with the list items.</param>
/// <returns></returns>
public static int BinarySearch<TItem>(this IList<TItem> list, TItem value, IComparer<TItem> comparer)
{
if (comparer == null)
{
throw new ArgumentNullException(nameof(comparer));
}
return list.BinarySearch(value, comparer.Compare);
}
/// <summary>
/// Performs a binary search on the specified collection.
///
/// Thanks to http://stackoverflow.com/questions/967047/how-to-perform-a-binary-search-on-ilistt
/// </summary>
/// <typeparam name="TItem">The type of the item.</typeparam>
/// <typeparam name="TSearch">The type of the searched item.</typeparam>
/// <param name="list">The list to be searched.</param>
/// <param name="value">The value to search for.</param>
/// <param name="comparer">The comparer that is used to compare the value with the list items.</param>
/// <returns></returns>
public static int BinarySearch<TItem, TSearch>(this IList<TItem> list, TSearch value, Func<TSearch, TItem, int> comparer)
{
if (list == null)
{
throw new ArgumentNullException(nameof(list));
}
if (comparer == null)
{
throw new ArgumentNullException(nameof(comparer));
}
int lower = 0;
int upper = list.Count - 1;
while (lower <= upper)
{
int middle = lower + (upper - lower) / 2;
int comparisonResult = comparer(value, list[middle]);
if (comparisonResult < 0)
{
upper = middle - 1;
}
else if (comparisonResult > 0)
{
lower = middle + 1;
}
else
{
return middle;
}
}
return ~lower;
}
/// <summary>
/// Lookups the item using the specified comparer. If matched, the item's index is also returned
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="source">The source.</param>
/// <param name="item">The item.</param>
/// <param name="equalityComparer">The equality comparer.</param>
/// <returns></returns>
public static Optional<ItemWithIndex<T>> IndexOfOptional<T>(this IEnumerable<T> source, T item, IEqualityComparer<T> equalityComparer = null)
{
var comparer = equalityComparer ?? EqualityComparer<T>.Default;
var index = source.IndexOf(item, comparer);
return index<0 ? Optional<ItemWithIndex<T>>.None : new ItemWithIndex<T>(item,index);
}
/// <summary>
/// Finds the index of the current item using the specified equality comparer
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="item"></param>
/// <param name="source"></param>
/// <returns></returns>
public static int IndexOf<T>(this IEnumerable<T> source, T item)
{
return IndexOf(source, item, EqualityComparer<T>.Default);
}
/// <summary>
/// Finds the index of the current item using the specified equality comparer
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="item"></param>
/// <param name="equalityComparer">Use to determine object equality</param>
/// <param name="source"></param>
/// <returns></returns>
public static int IndexOf<T>(this IEnumerable<T> source, T item, IEqualityComparer<T> equalityComparer)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (equalityComparer == null)
{
throw new ArgumentNullException(nameof(equalityComparer));
}
int i = 0;
foreach (var candidate in source)
{
if (equalityComparer.Equals(item, candidate))
{
return i;
}
i++;
}
return -1;
}
#endregion
#region Amendment
/// <summary>
/// Adds the items to the specified list
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="source">The source.</param>
/// <param name="items">The items.</param>
/// <exception cref="System.ArgumentNullException">
/// source
/// or
/// items
/// </exception>
public static void Add<T>(this IList<T> source, IEnumerable<T> items)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (items == null)
{
throw new ArgumentNullException(nameof(items));
}
items.ForEach(source.Add);
}
/// <summary>
/// Adds the range to the source ist
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="source">The source.</param>
/// <param name="items">The items.</param>
/// <exception cref="System.ArgumentNullException">
/// source
/// or
/// items
/// </exception>
public static void AddRange<T>(this IList<T> source, IEnumerable<T> items)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (items == null)
{
throw new ArgumentNullException(nameof(items));
}
if (source is List<T>)
{
((List<T>)source).AddRange(items);
}
else if (source is IExtendedList<T>)
{
((IExtendedList<T>)source).AddRange(items);
}
else
{
items.ForEach(source.Add);
}
}
/// <summary>
/// Adds the range to the list. The starting range is at the specified index
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="source">The source.</param>
/// <param name="items">The items.</param>
/// <param name="index">The index.</param>
/// <exception cref="System.ArgumentNullException">
/// </exception>
public static void AddRange<T>(this IList<T> source, IEnumerable<T> items, int index)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (items == null)
{
throw new ArgumentNullException(nameof(items));
}
if (source is List<T>)
{
((List<T>)source).InsertRange(index, items);
}
else if (source is IExtendedList<T>)
{
((IExtendedList<T>)source).InsertRange(items, index);
}
else
{
items.ForEach(source.Add);
}
}
/// <summary>
/// Adds the range if a negative is specified, otherwise the range is added at the end of the list
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="source">The source.</param>
/// <param name="items">The items.</param>
/// <param name="index">The index.</param>
/// <exception cref="System.ArgumentNullException">
/// </exception>
public static void AddOrInsertRange<T>(this IList<T> source, IEnumerable<T> items, int index)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (items == null)
{
throw new ArgumentNullException(nameof(items));
}
if (source is List<T>)
{
if (index >= 0)
{
((List<T>)source).InsertRange(index, items);
}
else
{
((List<T>)source).AddRange(items);
}
}
else if (source is IExtendedList<T>)
{
if (index >= 0)
{
((IExtendedList<T>)source).InsertRange(items, index);
}
else
{
((IExtendedList<T>)source).AddRange(items);
}
}
else
{
if (index >= 0)
{
//TODO: Why the hell reverse? Surely there must be as reason otherwise I would not have done it.
items.Reverse().ForEach(t => source.Insert(index, t));
}
else
{
items.ForEach(source.Add);
}
}
}
/// <summary>
/// Removes many items from the collection in an optimal way
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="source">The source.</param>
/// <param name="itemsToRemove">The items to remove.</param>
/// <exception cref="System.ArgumentNullException">
/// </exception>
public static void RemoveMany<T>(this IList<T> source, [NotNull] IEnumerable<T> itemsToRemove)
{
/*
This may seem OTT but for large sets of data where there are many removes scattered
across the source collection IndexOf lookups can result in very slow updates
(especially for subsequent operators)
*/
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (itemsToRemove == null)
{
throw new ArgumentNullException(nameof(itemsToRemove));
}
var toRemoveArray = itemsToRemove.AsArray();
//match all indicies and and remove in reverse as it is more efficient
var toRemove = source.IndexOfMany(toRemoveArray)
.OrderByDescending(x => x.Index)
.ToArray();
//if there are duplicates, it could be that an item exists in the
//source collection more than once - in that case the fast remove
//would remove each instance
var hasDuplicates = toRemove.Duplicates(t => t.Item).Any();
if (hasDuplicates)
{
//Slow remove but safe
toRemoveArray?.ForEach(t => source.Remove(t));
}
else
{
//Fast remove because we know the index of all and we remove in order
toRemove.ForEach(t => source.RemoveAt(t.Index));
}
}
/// <summary>
/// Removes the number of items, starting at the specified index
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="source">The source.</param>
/// <param name="index">The index.</param>
/// <param name="count">The count.</param>
/// <exception cref="System.ArgumentNullException"></exception>
/// <exception cref="System.NotSupportedException">Cannot remove range</exception>
private static void RemoveRange<T>(this IList<T> source, int index, int count)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (source is List<T>)
{
((List<T>)source).RemoveRange(index, count);
}
else if (source is IExtendedList<T>)
{
((IExtendedList<T>)source).RemoveRange(index, count);
}
else
{
throw new NotSupportedException($"Cannot remove range from {source.GetType().FullName}");
}
}
/// <summary>
/// Removes the items from the specified list
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="source">The source.</param>
/// <param name="items">The items.</param>
/// <exception cref="System.ArgumentNullException">
/// source
/// or
/// items
/// </exception>
public static void Remove<T>(this IList<T> source, IEnumerable<T> items)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (items == null)
{
throw new ArgumentNullException(nameof(items));
}
items.ForEach(t => source.Remove(t));
}
/// <summary>
/// Replaces the specified item.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="source">The source.</param>
/// <param name="original">The original.</param>
/// <param name="replacewith">The replacewith.</param>
/// <exception cref="System.ArgumentNullException">source
/// or
/// items</exception>
public static void Replace<T>(this IList<T> source, [NotNull] T original, [NotNull] T replacewith)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (original == null)
{
throw new ArgumentNullException(nameof(original));
}
if (replacewith == null)
{
throw new ArgumentNullException(nameof(replacewith));
}
var index = source.IndexOf(original);
if (index==-1)
{
throw new ArgumentException("Cannot find index of original item. Either it does not exist in the list or the hashcode has mutated");
}
source[index] = replacewith;
}
/// <summary>
/// Replaces the item if found, otherwise the item is added to the list
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="source">The source.</param>
/// <param name="original">The original.</param>
/// <param name="replacewith">The replacewith.</param>
/// <exception cref="System.ArgumentNullException">
/// </exception>
public static void ReplaceOrAdd<T>(this IList<T> source, [NotNull] T original, [NotNull] T replacewith)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (original == null)
{
throw new ArgumentNullException(nameof(original));
}
if (replacewith == null)
{
throw new ArgumentNullException(nameof(replacewith));
}
var index = source.IndexOf(original);
if (index == -1)
{
source.Add(replacewith);
}
else
{
source[index] = replacewith;
}
}
/// <summary>
/// Replaces the specified item.
/// </summary>
/// <param name="source">The source.</param>
/// <param name="original">The item which is to be replaced. If not in the list and argument exception will be thrown</param>
/// <param name="replaceWith">The new item</param>
/// <param name="comparer">The equality comparer to be used to find the original item in the list</param>
/// <exception cref="System.ArgumentNullException">source
/// or
/// items</exception>
public static void Replace<T>(this IList<T> source, [NotNull] T original, [NotNull] T replaceWith, IEqualityComparer<T> comparer)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (original == null)
{
throw new ArgumentNullException(nameof(original));
}
if (replaceWith == null)
{
throw new ArgumentNullException(nameof(replaceWith));
}
if (comparer == null)
{
throw new ArgumentNullException(nameof(comparer));
}
var index = source.IndexOf(original);
if (index == -1)
{
throw new ArgumentException("Cannot find index of original item. Either it does not exist in the list or the hashcode has mutated");
}
if (comparer.Equals(source[index], replaceWith))
{
source[index] = replaceWith;
}
}
#endregion
}
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2016 Chen-Yu Tsai
*
* Chen-Yu Tsai <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef _CCU_SUN8I_A83T_H_
#define _CCU_SUN8I_A83T_H_
#include <dt-bindings/clock/sun8i-a83t-ccu.h>
#include <dt-bindings/reset/sun8i-a83t-ccu.h>
#define CLK_PLL_C0CPUX 0
#define CLK_PLL_C1CPUX 1
#define CLK_PLL_AUDIO 2
#define CLK_PLL_VIDEO0 3
#define CLK_PLL_VE 4
#define CLK_PLL_DDR 5
/* pll-periph is exported to the PRCM block */
#define CLK_PLL_GPU 7
#define CLK_PLL_HSIC 8
/* pll-de is exported for the display engine */
#define CLK_PLL_VIDEO1 10
/* The CPUX clocks are exported */
#define CLK_AXI0 13
#define CLK_AXI1 14
#define CLK_AHB1 15
#define CLK_AHB2 16
#define CLK_APB1 17
#define CLK_APB2 18
/* bus gates exported */
#define CLK_CCI400 58
/* module and usb clocks exported */
#define CLK_DRAM 82
/* dram gates and more module clocks exported */
#define CLK_MBUS 95
/* more module clocks exported */
#define CLK_NUMBER (CLK_GPU_HYD + 1)
#endif /* _CCU_SUN8I_A83T_H_ */
| {
"pile_set_name": "Github"
} |
version https://git-lfs.github.com/spec/v1
oid sha256:d787c10a044a3f4bab06cf62160ffade48e9abba351445e8e10635939d76e2bb
size 13628
| {
"pile_set_name": "Github"
} |
""" Python Character Mapping Codec mac_cyrillic generated from 'MAPPINGS/VENDORS/APPLE/CYRILLIC.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
class IncrementalEncoder(codecs.IncrementalEncoder):
def encode(self, input, final=False):
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
class IncrementalDecoder(codecs.IncrementalDecoder):
def decode(self, input, final=False):
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
class StreamWriter(Codec,codecs.StreamWriter):
pass
class StreamReader(Codec,codecs.StreamReader):
pass
### encodings module API
def getregentry():
return codecs.CodecInfo(
name='mac-cyrillic',
encode=Codec().encode,
decode=Codec().decode,
incrementalencoder=IncrementalEncoder,
incrementaldecoder=IncrementalDecoder,
streamreader=StreamReader,
streamwriter=StreamWriter,
)
### Decoding Table
decoding_table = (
'\x00' # 0x00 -> CONTROL CHARACTER
'\x01' # 0x01 -> CONTROL CHARACTER
'\x02' # 0x02 -> CONTROL CHARACTER
'\x03' # 0x03 -> CONTROL CHARACTER
'\x04' # 0x04 -> CONTROL CHARACTER
'\x05' # 0x05 -> CONTROL CHARACTER
'\x06' # 0x06 -> CONTROL CHARACTER
'\x07' # 0x07 -> CONTROL CHARACTER
'\x08' # 0x08 -> CONTROL CHARACTER
'\t' # 0x09 -> CONTROL CHARACTER
'\n' # 0x0A -> CONTROL CHARACTER
'\x0b' # 0x0B -> CONTROL CHARACTER
'\x0c' # 0x0C -> CONTROL CHARACTER
'\r' # 0x0D -> CONTROL CHARACTER
'\x0e' # 0x0E -> CONTROL CHARACTER
'\x0f' # 0x0F -> CONTROL CHARACTER
'\x10' # 0x10 -> CONTROL CHARACTER
'\x11' # 0x11 -> CONTROL CHARACTER
'\x12' # 0x12 -> CONTROL CHARACTER
'\x13' # 0x13 -> CONTROL CHARACTER
'\x14' # 0x14 -> CONTROL CHARACTER
'\x15' # 0x15 -> CONTROL CHARACTER
'\x16' # 0x16 -> CONTROL CHARACTER
'\x17' # 0x17 -> CONTROL CHARACTER
'\x18' # 0x18 -> CONTROL CHARACTER
'\x19' # 0x19 -> CONTROL CHARACTER
'\x1a' # 0x1A -> CONTROL CHARACTER
'\x1b' # 0x1B -> CONTROL CHARACTER
'\x1c' # 0x1C -> CONTROL CHARACTER
'\x1d' # 0x1D -> CONTROL CHARACTER
'\x1e' # 0x1E -> CONTROL CHARACTER
'\x1f' # 0x1F -> CONTROL CHARACTER
' ' # 0x20 -> SPACE
'!' # 0x21 -> EXCLAMATION MARK
'"' # 0x22 -> QUOTATION MARK
'#' # 0x23 -> NUMBER SIGN
'$' # 0x24 -> DOLLAR SIGN
'%' # 0x25 -> PERCENT SIGN
'&' # 0x26 -> AMPERSAND
"'" # 0x27 -> APOSTROPHE
'(' # 0x28 -> LEFT PARENTHESIS
')' # 0x29 -> RIGHT PARENTHESIS
'*' # 0x2A -> ASTERISK
'+' # 0x2B -> PLUS SIGN
',' # 0x2C -> COMMA
'-' # 0x2D -> HYPHEN-MINUS
'.' # 0x2E -> FULL STOP
'/' # 0x2F -> SOLIDUS
'0' # 0x30 -> DIGIT ZERO
'1' # 0x31 -> DIGIT ONE
'2' # 0x32 -> DIGIT TWO
'3' # 0x33 -> DIGIT THREE
'4' # 0x34 -> DIGIT FOUR
'5' # 0x35 -> DIGIT FIVE
'6' # 0x36 -> DIGIT SIX
'7' # 0x37 -> DIGIT SEVEN
'8' # 0x38 -> DIGIT EIGHT
'9' # 0x39 -> DIGIT NINE
':' # 0x3A -> COLON
';' # 0x3B -> SEMICOLON
'<' # 0x3C -> LESS-THAN SIGN
'=' # 0x3D -> EQUALS SIGN
'>' # 0x3E -> GREATER-THAN SIGN
'?' # 0x3F -> QUESTION MARK
'@' # 0x40 -> COMMERCIAL AT
'A' # 0x41 -> LATIN CAPITAL LETTER A
'B' # 0x42 -> LATIN CAPITAL LETTER B
'C' # 0x43 -> LATIN CAPITAL LETTER C
'D' # 0x44 -> LATIN CAPITAL LETTER D
'E' # 0x45 -> LATIN CAPITAL LETTER E
'F' # 0x46 -> LATIN CAPITAL LETTER F
'G' # 0x47 -> LATIN CAPITAL LETTER G
'H' # 0x48 -> LATIN CAPITAL LETTER H
'I' # 0x49 -> LATIN CAPITAL LETTER I
'J' # 0x4A -> LATIN CAPITAL LETTER J
'K' # 0x4B -> LATIN CAPITAL LETTER K
'L' # 0x4C -> LATIN CAPITAL LETTER L
'M' # 0x4D -> LATIN CAPITAL LETTER M
'N' # 0x4E -> LATIN CAPITAL LETTER N
'O' # 0x4F -> LATIN CAPITAL LETTER O
'P' # 0x50 -> LATIN CAPITAL LETTER P
'Q' # 0x51 -> LATIN CAPITAL LETTER Q
'R' # 0x52 -> LATIN CAPITAL LETTER R
'S' # 0x53 -> LATIN CAPITAL LETTER S
'T' # 0x54 -> LATIN CAPITAL LETTER T
'U' # 0x55 -> LATIN CAPITAL LETTER U
'V' # 0x56 -> LATIN CAPITAL LETTER V
'W' # 0x57 -> LATIN CAPITAL LETTER W
'X' # 0x58 -> LATIN CAPITAL LETTER X
'Y' # 0x59 -> LATIN CAPITAL LETTER Y
'Z' # 0x5A -> LATIN CAPITAL LETTER Z
'[' # 0x5B -> LEFT SQUARE BRACKET
'\\' # 0x5C -> REVERSE SOLIDUS
']' # 0x5D -> RIGHT SQUARE BRACKET
'^' # 0x5E -> CIRCUMFLEX ACCENT
'_' # 0x5F -> LOW LINE
'`' # 0x60 -> GRAVE ACCENT
'a' # 0x61 -> LATIN SMALL LETTER A
'b' # 0x62 -> LATIN SMALL LETTER B
'c' # 0x63 -> LATIN SMALL LETTER C
'd' # 0x64 -> LATIN SMALL LETTER D
'e' # 0x65 -> LATIN SMALL LETTER E
'f' # 0x66 -> LATIN SMALL LETTER F
'g' # 0x67 -> LATIN SMALL LETTER G
'h' # 0x68 -> LATIN SMALL LETTER H
'i' # 0x69 -> LATIN SMALL LETTER I
'j' # 0x6A -> LATIN SMALL LETTER J
'k' # 0x6B -> LATIN SMALL LETTER K
'l' # 0x6C -> LATIN SMALL LETTER L
'm' # 0x6D -> LATIN SMALL LETTER M
'n' # 0x6E -> LATIN SMALL LETTER N
'o' # 0x6F -> LATIN SMALL LETTER O
'p' # 0x70 -> LATIN SMALL LETTER P
'q' # 0x71 -> LATIN SMALL LETTER Q
'r' # 0x72 -> LATIN SMALL LETTER R
's' # 0x73 -> LATIN SMALL LETTER S
't' # 0x74 -> LATIN SMALL LETTER T
'u' # 0x75 -> LATIN SMALL LETTER U
'v' # 0x76 -> LATIN SMALL LETTER V
'w' # 0x77 -> LATIN SMALL LETTER W
'x' # 0x78 -> LATIN SMALL LETTER X
'y' # 0x79 -> LATIN SMALL LETTER Y
'z' # 0x7A -> LATIN SMALL LETTER Z
'{' # 0x7B -> LEFT CURLY BRACKET
'|' # 0x7C -> VERTICAL LINE
'}' # 0x7D -> RIGHT CURLY BRACKET
'~' # 0x7E -> TILDE
'\x7f' # 0x7F -> CONTROL CHARACTER
'\u0410' # 0x80 -> CYRILLIC CAPITAL LETTER A
'\u0411' # 0x81 -> CYRILLIC CAPITAL LETTER BE
'\u0412' # 0x82 -> CYRILLIC CAPITAL LETTER VE
'\u0413' # 0x83 -> CYRILLIC CAPITAL LETTER GHE
'\u0414' # 0x84 -> CYRILLIC CAPITAL LETTER DE
'\u0415' # 0x85 -> CYRILLIC CAPITAL LETTER IE
'\u0416' # 0x86 -> CYRILLIC CAPITAL LETTER ZHE
'\u0417' # 0x87 -> CYRILLIC CAPITAL LETTER ZE
'\u0418' # 0x88 -> CYRILLIC CAPITAL LETTER I
'\u0419' # 0x89 -> CYRILLIC CAPITAL LETTER SHORT I
'\u041a' # 0x8A -> CYRILLIC CAPITAL LETTER KA
'\u041b' # 0x8B -> CYRILLIC CAPITAL LETTER EL
'\u041c' # 0x8C -> CYRILLIC CAPITAL LETTER EM
'\u041d' # 0x8D -> CYRILLIC CAPITAL LETTER EN
'\u041e' # 0x8E -> CYRILLIC CAPITAL LETTER O
'\u041f' # 0x8F -> CYRILLIC CAPITAL LETTER PE
'\u0420' # 0x90 -> CYRILLIC CAPITAL LETTER ER
'\u0421' # 0x91 -> CYRILLIC CAPITAL LETTER ES
'\u0422' # 0x92 -> CYRILLIC CAPITAL LETTER TE
'\u0423' # 0x93 -> CYRILLIC CAPITAL LETTER U
'\u0424' # 0x94 -> CYRILLIC CAPITAL LETTER EF
'\u0425' # 0x95 -> CYRILLIC CAPITAL LETTER HA
'\u0426' # 0x96 -> CYRILLIC CAPITAL LETTER TSE
'\u0427' # 0x97 -> CYRILLIC CAPITAL LETTER CHE
'\u0428' # 0x98 -> CYRILLIC CAPITAL LETTER SHA
'\u0429' # 0x99 -> CYRILLIC CAPITAL LETTER SHCHA
'\u042a' # 0x9A -> CYRILLIC CAPITAL LETTER HARD SIGN
'\u042b' # 0x9B -> CYRILLIC CAPITAL LETTER YERU
'\u042c' # 0x9C -> CYRILLIC CAPITAL LETTER SOFT SIGN
'\u042d' # 0x9D -> CYRILLIC CAPITAL LETTER E
'\u042e' # 0x9E -> CYRILLIC CAPITAL LETTER YU
'\u042f' # 0x9F -> CYRILLIC CAPITAL LETTER YA
'\u2020' # 0xA0 -> DAGGER
'\xb0' # 0xA1 -> DEGREE SIGN
'\u0490' # 0xA2 -> CYRILLIC CAPITAL LETTER GHE WITH UPTURN
'\xa3' # 0xA3 -> POUND SIGN
'\xa7' # 0xA4 -> SECTION SIGN
'\u2022' # 0xA5 -> BULLET
'\xb6' # 0xA6 -> PILCROW SIGN
'\u0406' # 0xA7 -> CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I
'\xae' # 0xA8 -> REGISTERED SIGN
'\xa9' # 0xA9 -> COPYRIGHT SIGN
'\u2122' # 0xAA -> TRADE MARK SIGN
'\u0402' # 0xAB -> CYRILLIC CAPITAL LETTER DJE
'\u0452' # 0xAC -> CYRILLIC SMALL LETTER DJE
'\u2260' # 0xAD -> NOT EQUAL TO
'\u0403' # 0xAE -> CYRILLIC CAPITAL LETTER GJE
'\u0453' # 0xAF -> CYRILLIC SMALL LETTER GJE
'\u221e' # 0xB0 -> INFINITY
'\xb1' # 0xB1 -> PLUS-MINUS SIGN
'\u2264' # 0xB2 -> LESS-THAN OR EQUAL TO
'\u2265' # 0xB3 -> GREATER-THAN OR EQUAL TO
'\u0456' # 0xB4 -> CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I
'\xb5' # 0xB5 -> MICRO SIGN
'\u0491' # 0xB6 -> CYRILLIC SMALL LETTER GHE WITH UPTURN
'\u0408' # 0xB7 -> CYRILLIC CAPITAL LETTER JE
'\u0404' # 0xB8 -> CYRILLIC CAPITAL LETTER UKRAINIAN IE
'\u0454' # 0xB9 -> CYRILLIC SMALL LETTER UKRAINIAN IE
'\u0407' # 0xBA -> CYRILLIC CAPITAL LETTER YI
'\u0457' # 0xBB -> CYRILLIC SMALL LETTER YI
'\u0409' # 0xBC -> CYRILLIC CAPITAL LETTER LJE
'\u0459' # 0xBD -> CYRILLIC SMALL LETTER LJE
'\u040a' # 0xBE -> CYRILLIC CAPITAL LETTER NJE
'\u045a' # 0xBF -> CYRILLIC SMALL LETTER NJE
'\u0458' # 0xC0 -> CYRILLIC SMALL LETTER JE
'\u0405' # 0xC1 -> CYRILLIC CAPITAL LETTER DZE
'\xac' # 0xC2 -> NOT SIGN
'\u221a' # 0xC3 -> SQUARE ROOT
'\u0192' # 0xC4 -> LATIN SMALL LETTER F WITH HOOK
'\u2248' # 0xC5 -> ALMOST EQUAL TO
'\u2206' # 0xC6 -> INCREMENT
'\xab' # 0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
'\xbb' # 0xC8 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
'\u2026' # 0xC9 -> HORIZONTAL ELLIPSIS
'\xa0' # 0xCA -> NO-BREAK SPACE
'\u040b' # 0xCB -> CYRILLIC CAPITAL LETTER TSHE
'\u045b' # 0xCC -> CYRILLIC SMALL LETTER TSHE
'\u040c' # 0xCD -> CYRILLIC CAPITAL LETTER KJE
'\u045c' # 0xCE -> CYRILLIC SMALL LETTER KJE
'\u0455' # 0xCF -> CYRILLIC SMALL LETTER DZE
'\u2013' # 0xD0 -> EN DASH
'\u2014' # 0xD1 -> EM DASH
'\u201c' # 0xD2 -> LEFT DOUBLE QUOTATION MARK
'\u201d' # 0xD3 -> RIGHT DOUBLE QUOTATION MARK
'\u2018' # 0xD4 -> LEFT SINGLE QUOTATION MARK
'\u2019' # 0xD5 -> RIGHT SINGLE QUOTATION MARK
'\xf7' # 0xD6 -> DIVISION SIGN
'\u201e' # 0xD7 -> DOUBLE LOW-9 QUOTATION MARK
'\u040e' # 0xD8 -> CYRILLIC CAPITAL LETTER SHORT U
'\u045e' # 0xD9 -> CYRILLIC SMALL LETTER SHORT U
'\u040f' # 0xDA -> CYRILLIC CAPITAL LETTER DZHE
'\u045f' # 0xDB -> CYRILLIC SMALL LETTER DZHE
'\u2116' # 0xDC -> NUMERO SIGN
'\u0401' # 0xDD -> CYRILLIC CAPITAL LETTER IO
'\u0451' # 0xDE -> CYRILLIC SMALL LETTER IO
'\u044f' # 0xDF -> CYRILLIC SMALL LETTER YA
'\u0430' # 0xE0 -> CYRILLIC SMALL LETTER A
'\u0431' # 0xE1 -> CYRILLIC SMALL LETTER BE
'\u0432' # 0xE2 -> CYRILLIC SMALL LETTER VE
'\u0433' # 0xE3 -> CYRILLIC SMALL LETTER GHE
'\u0434' # 0xE4 -> CYRILLIC SMALL LETTER DE
'\u0435' # 0xE5 -> CYRILLIC SMALL LETTER IE
'\u0436' # 0xE6 -> CYRILLIC SMALL LETTER ZHE
'\u0437' # 0xE7 -> CYRILLIC SMALL LETTER ZE
'\u0438' # 0xE8 -> CYRILLIC SMALL LETTER I
'\u0439' # 0xE9 -> CYRILLIC SMALL LETTER SHORT I
'\u043a' # 0xEA -> CYRILLIC SMALL LETTER KA
'\u043b' # 0xEB -> CYRILLIC SMALL LETTER EL
'\u043c' # 0xEC -> CYRILLIC SMALL LETTER EM
'\u043d' # 0xED -> CYRILLIC SMALL LETTER EN
'\u043e' # 0xEE -> CYRILLIC SMALL LETTER O
'\u043f' # 0xEF -> CYRILLIC SMALL LETTER PE
'\u0440' # 0xF0 -> CYRILLIC SMALL LETTER ER
'\u0441' # 0xF1 -> CYRILLIC SMALL LETTER ES
'\u0442' # 0xF2 -> CYRILLIC SMALL LETTER TE
'\u0443' # 0xF3 -> CYRILLIC SMALL LETTER U
'\u0444' # 0xF4 -> CYRILLIC SMALL LETTER EF
'\u0445' # 0xF5 -> CYRILLIC SMALL LETTER HA
'\u0446' # 0xF6 -> CYRILLIC SMALL LETTER TSE
'\u0447' # 0xF7 -> CYRILLIC SMALL LETTER CHE
'\u0448' # 0xF8 -> CYRILLIC SMALL LETTER SHA
'\u0449' # 0xF9 -> CYRILLIC SMALL LETTER SHCHA
'\u044a' # 0xFA -> CYRILLIC SMALL LETTER HARD SIGN
'\u044b' # 0xFB -> CYRILLIC SMALL LETTER YERU
'\u044c' # 0xFC -> CYRILLIC SMALL LETTER SOFT SIGN
'\u044d' # 0xFD -> CYRILLIC SMALL LETTER E
'\u044e' # 0xFE -> CYRILLIC SMALL LETTER YU
'\u20ac' # 0xFF -> EURO SIGN
)
### Encoding table
encoding_table=codecs.charmap_build(decoding_table)
| {
"pile_set_name": "Github"
} |
/*
Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <[email protected]>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/**
* \file SDL.h
*
* Main include header for the SDL library
*/
/**
* \mainpage Simple DirectMedia Layer (SDL)
*
* http://www.libsdl.org/
*
* \section intro_sec Introduction
*
* Simple DirectMedia Layer is a cross-platform development library designed
* to provide low level access to audio, keyboard, mouse, joystick, and
* graphics hardware via OpenGL and Direct3D. It is used by video playback
* software, emulators, and popular games including Valve's award winning
* catalog and many Humble Bundle games.
*
* SDL officially supports Windows, Mac OS X, Linux, iOS, and Android.
* Support for other platforms may be found in the source code.
*
* SDL is written in C, works natively with C++, and there are bindings
* available for several other languages, including C# and Python.
*
* This library is distributed under the zlib license, which can be found
* in the file "COPYING.txt".
*
* The best way to learn how to use SDL is to check out the header files in
* the "include" subdirectory and the programs in the "test" subdirectory.
* The header files and test programs are well commented and always up to date.
* More documentation and FAQs are available online at:
* http://wiki.libsdl.org/
*
* If you need help with the library, or just want to discuss SDL related
* issues, you can join the developers mailing list:
* http://www.libsdl.org/mailing-list.php
*
* Enjoy!
* Sam Lantinga ([email protected])
*/
#ifndef _SDL_H
#define _SDL_H
#include "SDL_main.h"
#include "SDL_stdinc.h"
#include "SDL_assert.h"
#include "SDL_atomic.h"
#include "SDL_audio.h"
#include "SDL_clipboard.h"
#include "SDL_cpuinfo.h"
#include "SDL_endian.h"
#include "SDL_error.h"
#include "SDL_events.h"
#include "SDL_filesystem.h"
#include "SDL_joystick.h"
#include "SDL_gamecontroller.h"
#include "SDL_haptic.h"
#include "SDL_hints.h"
#include "SDL_loadso.h"
#include "SDL_log.h"
#include "SDL_messagebox.h"
#include "SDL_mutex.h"
#include "SDL_power.h"
#include "SDL_render.h"
#include "SDL_rwops.h"
#include "SDL_system.h"
#include "SDL_thread.h"
#include "SDL_timer.h"
#include "SDL_version.h"
#include "SDL_video.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* As of version 0.5, SDL is loaded dynamically into the application */
/**
* \name SDL_INIT_*
*
* These are the flags which may be passed to SDL_Init(). You should
* specify the subsystems which you will be using in your application.
*/
/* @{ */
#define SDL_INIT_TIMER 0x00000001
#define SDL_INIT_AUDIO 0x00000010
#define SDL_INIT_VIDEO 0x00000020 /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */
#define SDL_INIT_JOYSTICK 0x00000200 /**< SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS */
#define SDL_INIT_HAPTIC 0x00001000
#define SDL_INIT_GAMECONTROLLER 0x00002000 /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */
#define SDL_INIT_EVENTS 0x00004000
#define SDL_INIT_NOPARACHUTE 0x00100000 /**< Don't catch fatal signals */
#define SDL_INIT_EVERYTHING ( \
SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \
SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER \
)
/* @} */
/**
* This function initializes the subsystems specified by \c flags
* Unless the ::SDL_INIT_NOPARACHUTE flag is set, it will install cleanup
* signal handlers for some commonly ignored fatal signals (like SIGSEGV).
*/
extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags);
/**
* This function initializes specific SDL subsystems
*/
extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags);
/**
* This function cleans up specific SDL subsystems
*/
extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags);
/**
* This function returns a mask of the specified subsystems which have
* previously been initialized.
*
* If \c flags is 0, it returns a mask of all initialized subsystems.
*/
extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags);
/**
* This function cleans up all initialized subsystems. You should
* call it upon all exit conditions.
*/
extern DECLSPEC void SDLCALL SDL_Quit(void);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_H */
/* vi: set ts=4 sw=4 expandtab: */
| {
"pile_set_name": "Github"
} |
ISO-10303-21;
HEADER;
/* C_Rect_L26.5mm_W7.0mm_P22.50mm_MKS4.step 3D STEP model for use in ECAD systems
* Copyright (C) 2017, kicad StepUp
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*
* As a special exception, if you create a design which uses this symbol,
* and embed this symbol or unaltered portions of this symbol into the design,
* this symbol does not by itself cause the resulting design to be covered by
* the GNU General Public License.
* This exception does not however invalidate any other reasons why the design
* itself might be covered by the GNU General Public License.
* If you modify this symbol, you may extend this exception to your version of the symbol,
* but you are not obligated to do so.
* If you do not wish to do so, delete this exception statement from your version
* Risk disclaimer
* *USE 3D CAD DATA AT YOUR OWN RISK*
* *DO NOT RELY UPON ANY INFORMATION FOUND HERE WITHOUT INDEPENDENT VERIFICATION.*
*
*/
FILE_DESCRIPTION(
/* description */ ('model of C_Rect_L26.5mm_W7.0mm_P22.50mm_MKS4'),
/* implementation_level */ '2;1');
FILE_NAME(
/* name */ 'C_Rect_L26.5mm_W7.0mm_P22.50mm_MKS4.step',
/* time_stamp */ '2017-06-04T20:41:20',
/* author */ ('kicad StepUp','ksu'),
/* organization */ ('FreeCAD'),
/* preprocessor_version */ 'OCC',
/* originating_system */ 'kicad StepUp',
/* authorisation */ '');
FILE_SCHEMA(('AUTOMOTIVE_DESIGN_CC2 { 1 2 10303 214 -1 1 5 4 }'));
ENDSEC;
DATA;
#1 = APPLICATION_PROTOCOL_DEFINITION('committee draft',
'automotive_design',1997,#2);
#2 = APPLICATION_CONTEXT(
'core data for automotive mechanical design processes');
#3 = SHAPE_DEFINITION_REPRESENTATION(#4,#10);
#4 = PRODUCT_DEFINITION_SHAPE('','',#5);
#5 = PRODUCT_DEFINITION('design','',#6,#9);
#6 = PRODUCT_DEFINITION_FORMATION('','',#7);
#7 = PRODUCT('C_Rect_L265mm_W70mm_P2250mm_MKS4',
'C_Rect_L265mm_W70mm_P2250mm_MKS4','',(#8));
#8 = MECHANICAL_CONTEXT('',#2,'mechanical');
#9 = PRODUCT_DEFINITION_CONTEXT('part definition',#2,'design');
#10 = ADVANCED_BREP_SHAPE_REPRESENTATION('',(#11,#15),#559);
#11 = AXIS2_PLACEMENT_3D('',#12,#13,#14);
#12 = CARTESIAN_POINT('',(0.,0.,0.));
#13 = DIRECTION('',(0.,0.,1.));
#14 = DIRECTION('',(1.,0.,-0.));
#15 = MANIFOLD_SOLID_BREP('',#16);
#16 = CLOSED_SHELL('',(#17,#57,#90,#123,#204,#229,#246,#270,#287,#318,
#342,#367,#392,#409,#434,#459,#477,#495,#519,#530,#541,#550));
#17 = ADVANCED_FACE('',(#18),#52,.F.);
#18 = FACE_BOUND('',#19,.F.);
#19 = EDGE_LOOP('',(#20,#30,#38,#46));
#20 = ORIENTED_EDGE('',*,*,#21,.F.);
#21 = EDGE_CURVE('',#22,#24,#26,.T.);
#22 = VERTEX_POINT('',#23);
#23 = CARTESIAN_POINT('',(-2.,-2.8,0.));
#24 = VERTEX_POINT('',#25);
#25 = CARTESIAN_POINT('',(-2.,-2.8,20.3));
#26 = LINE('',#27,#28);
#27 = CARTESIAN_POINT('',(-2.,-2.8,0.));
#28 = VECTOR('',#29,1.);
#29 = DIRECTION('',(0.,0.,1.));
#30 = ORIENTED_EDGE('',*,*,#31,.T.);
#31 = EDGE_CURVE('',#22,#32,#34,.T.);
#32 = VERTEX_POINT('',#33);
#33 = CARTESIAN_POINT('',(-2.,2.8,0.));
#34 = LINE('',#35,#36);
#35 = CARTESIAN_POINT('',(-2.,-3.5,0.));
#36 = VECTOR('',#37,1.);
#37 = DIRECTION('',(0.,1.,0.));
#38 = ORIENTED_EDGE('',*,*,#39,.T.);
#39 = EDGE_CURVE('',#32,#40,#42,.T.);
#40 = VERTEX_POINT('',#41);
#41 = CARTESIAN_POINT('',(-2.,2.8,20.3));
#42 = LINE('',#43,#44);
#43 = CARTESIAN_POINT('',(-2.,2.8,0.));
#44 = VECTOR('',#45,1.);
#45 = DIRECTION('',(0.,0.,1.));
#46 = ORIENTED_EDGE('',*,*,#47,.T.);
#47 = EDGE_CURVE('',#40,#24,#48,.T.);
#48 = LINE('',#49,#50);
#49 = CARTESIAN_POINT('',(-2.,2.8,20.3));
#50 = VECTOR('',#51,1.);
#51 = DIRECTION('',(-0.,-1.,-0.));
#52 = PLANE('',#53);
#53 = AXIS2_PLACEMENT_3D('',#54,#55,#56);
#54 = CARTESIAN_POINT('',(-2.,-3.5,0.));
#55 = DIRECTION('',(1.,0.,0.));
#56 = DIRECTION('',(0.,0.,1.));
#57 = ADVANCED_FACE('',(#58),#85,.T.);
#58 = FACE_BOUND('',#59,.T.);
#59 = EDGE_LOOP('',(#60,#61,#70,#78));
#60 = ORIENTED_EDGE('',*,*,#21,.F.);
#61 = ORIENTED_EDGE('',*,*,#62,.T.);
#62 = EDGE_CURVE('',#22,#63,#65,.T.);
#63 = VERTEX_POINT('',#64);
#64 = CARTESIAN_POINT('',(-1.3,-3.5,0.));
#65 = CIRCLE('',#66,0.7);
#66 = AXIS2_PLACEMENT_3D('',#67,#68,#69);
#67 = CARTESIAN_POINT('',(-1.3,-2.8,0.));
#68 = DIRECTION('',(-0.,0.,1.));
#69 = DIRECTION('',(0.,-1.,0.));
#70 = ORIENTED_EDGE('',*,*,#71,.T.);
#71 = EDGE_CURVE('',#63,#72,#74,.T.);
#72 = VERTEX_POINT('',#73);
#73 = CARTESIAN_POINT('',(-1.3,-3.5,20.3));
#74 = LINE('',#75,#76);
#75 = CARTESIAN_POINT('',(-1.3,-3.5,0.));
#76 = VECTOR('',#77,1.);
#77 = DIRECTION('',(0.,0.,1.));
#78 = ORIENTED_EDGE('',*,*,#79,.F.);
#79 = EDGE_CURVE('',#24,#72,#80,.T.);
#80 = CIRCLE('',#81,0.7);
#81 = AXIS2_PLACEMENT_3D('',#82,#83,#84);
#82 = CARTESIAN_POINT('',(-1.3,-2.8,20.3));
#83 = DIRECTION('',(0.,0.,1.));
#84 = DIRECTION('',(-1.,0.,0.));
#85 = CYLINDRICAL_SURFACE('',#86,0.7);
#86 = AXIS2_PLACEMENT_3D('',#87,#88,#89);
#87 = CARTESIAN_POINT('',(-1.3,-2.8,0.));
#88 = DIRECTION('',(0.,0.,1.));
#89 = DIRECTION('',(-1.,0.,0.));
#90 = ADVANCED_FACE('',(#91),#118,.T.);
#91 = FACE_BOUND('',#92,.T.);
#92 = EDGE_LOOP('',(#93,#102,#103,#112));
#93 = ORIENTED_EDGE('',*,*,#94,.T.);
#94 = EDGE_CURVE('',#95,#40,#97,.T.);
#95 = VERTEX_POINT('',#96);
#96 = CARTESIAN_POINT('',(-1.3,2.8,21.));
#97 = CIRCLE('',#98,0.7);
#98 = AXIS2_PLACEMENT_3D('',#99,#100,#101);
#99 = CARTESIAN_POINT('',(-1.3,2.8,20.3));
#100 = DIRECTION('',(-6.123233995737E-17,-1.,-0.));
#101 = DIRECTION('',(-1.,6.123233995737E-17,0.));
#102 = ORIENTED_EDGE('',*,*,#47,.T.);
#103 = ORIENTED_EDGE('',*,*,#104,.F.);
#104 = EDGE_CURVE('',#105,#24,#107,.T.);
#105 = VERTEX_POINT('',#106);
#106 = CARTESIAN_POINT('',(-1.3,-2.8,21.));
#107 = CIRCLE('',#108,0.7);
#108 = AXIS2_PLACEMENT_3D('',#109,#110,#111);
#109 = CARTESIAN_POINT('',(-1.3,-2.8,20.3));
#110 = DIRECTION('',(0.,-1.,0.));
#111 = DIRECTION('',(-1.,0.,0.));
#112 = ORIENTED_EDGE('',*,*,#113,.F.);
#113 = EDGE_CURVE('',#95,#105,#114,.T.);
#114 = LINE('',#115,#116);
#115 = CARTESIAN_POINT('',(-1.3,2.8,21.));
#116 = VECTOR('',#117,1.);
#117 = DIRECTION('',(-0.,-1.,-0.));
#118 = CYLINDRICAL_SURFACE('',#119,0.7);
#119 = AXIS2_PLACEMENT_3D('',#120,#121,#122);
#120 = CARTESIAN_POINT('',(-1.3,2.8,20.3));
#121 = DIRECTION('',(-0.,-1.,-0.));
#122 = DIRECTION('',(0.,0.,1.));
#123 = ADVANCED_FACE('',(#124,#177,#188),#199,.F.);
#124 = FACE_BOUND('',#125,.F.);
#125 = EDGE_LOOP('',(#126,#127,#128,#136,#145,#153,#162,#170));
#126 = ORIENTED_EDGE('',*,*,#31,.F.);
#127 = ORIENTED_EDGE('',*,*,#62,.T.);
#128 = ORIENTED_EDGE('',*,*,#129,.T.);
#129 = EDGE_CURVE('',#63,#130,#132,.T.);
#130 = VERTEX_POINT('',#131);
#131 = CARTESIAN_POINT('',(23.8,-3.5,0.));
#132 = LINE('',#133,#134);
#133 = CARTESIAN_POINT('',(-2.,-3.5,0.));
#134 = VECTOR('',#135,1.);
#135 = DIRECTION('',(1.,0.,0.));
#136 = ORIENTED_EDGE('',*,*,#137,.F.);
#137 = EDGE_CURVE('',#138,#130,#140,.T.);
#138 = VERTEX_POINT('',#139);
#139 = CARTESIAN_POINT('',(24.5,-2.8,0.));
#140 = CIRCLE('',#141,0.7);
#141 = AXIS2_PLACEMENT_3D('',#142,#143,#144);
#142 = CARTESIAN_POINT('',(23.8,-2.8,0.));
#143 = DIRECTION('',(-0.,-0.,-1.));
#144 = DIRECTION('',(0.,-1.,0.));
#145 = ORIENTED_EDGE('',*,*,#146,.T.);
#146 = EDGE_CURVE('',#138,#147,#149,.T.);
#147 = VERTEX_POINT('',#148);
#148 = CARTESIAN_POINT('',(24.5,2.8,0.));
#149 = LINE('',#150,#151);
#150 = CARTESIAN_POINT('',(24.5,-3.5,0.));
#151 = VECTOR('',#152,1.);
#152 = DIRECTION('',(0.,1.,0.));
#153 = ORIENTED_EDGE('',*,*,#154,.T.);
#154 = EDGE_CURVE('',#147,#155,#157,.T.);
#155 = VERTEX_POINT('',#156);
#156 = CARTESIAN_POINT('',(23.8,3.5,0.));
#157 = CIRCLE('',#158,0.7);
#158 = AXIS2_PLACEMENT_3D('',#159,#160,#161);
#159 = CARTESIAN_POINT('',(23.8,2.8,0.));
#160 = DIRECTION('',(-0.,0.,1.));
#161 = DIRECTION('',(0.,-1.,0.));
#162 = ORIENTED_EDGE('',*,*,#163,.F.);
#163 = EDGE_CURVE('',#164,#155,#166,.T.);
#164 = VERTEX_POINT('',#165);
#165 = CARTESIAN_POINT('',(-1.3,3.5,0.));
#166 = LINE('',#167,#168);
#167 = CARTESIAN_POINT('',(-2.,3.5,0.));
#168 = VECTOR('',#169,1.);
#169 = DIRECTION('',(1.,0.,0.));
#170 = ORIENTED_EDGE('',*,*,#171,.F.);
#171 = EDGE_CURVE('',#32,#164,#172,.T.);
#172 = CIRCLE('',#173,0.7);
#173 = AXIS2_PLACEMENT_3D('',#174,#175,#176);
#174 = CARTESIAN_POINT('',(-1.3,2.8,0.));
#175 = DIRECTION('',(-0.,-0.,-1.));
#176 = DIRECTION('',(0.,-1.,0.));
#177 = FACE_BOUND('',#178,.F.);
#178 = EDGE_LOOP('',(#179));
#179 = ORIENTED_EDGE('',*,*,#180,.F.);
#180 = EDGE_CURVE('',#181,#181,#183,.T.);
#181 = VERTEX_POINT('',#182);
#182 = CARTESIAN_POINT('',(0.45,0.,0.));
#183 = CIRCLE('',#184,0.45);
#184 = AXIS2_PLACEMENT_3D('',#185,#186,#187);
#185 = CARTESIAN_POINT('',(0.,0.,0.));
#186 = DIRECTION('',(0.,0.,1.));
#187 = DIRECTION('',(1.,0.,0.));
#188 = FACE_BOUND('',#189,.F.);
#189 = EDGE_LOOP('',(#190));
#190 = ORIENTED_EDGE('',*,*,#191,.F.);
#191 = EDGE_CURVE('',#192,#192,#194,.T.);
#192 = VERTEX_POINT('',#193);
#193 = CARTESIAN_POINT('',(22.95,0.,0.));
#194 = CIRCLE('',#195,0.45);
#195 = AXIS2_PLACEMENT_3D('',#196,#197,#198);
#196 = CARTESIAN_POINT('',(22.5,0.,0.));
#197 = DIRECTION('',(0.,0.,1.));
#198 = DIRECTION('',(1.,0.,0.));
#199 = PLANE('',#200);
#200 = AXIS2_PLACEMENT_3D('',#201,#202,#203);
#201 = CARTESIAN_POINT('',(-2.,-3.5,0.));
#202 = DIRECTION('',(0.,0.,1.));
#203 = DIRECTION('',(1.,0.,0.));
#204 = ADVANCED_FACE('',(#205),#224,.T.);
#205 = FACE_BOUND('',#206,.F.);
#206 = EDGE_LOOP('',(#207,#208,#209,#217));
#207 = ORIENTED_EDGE('',*,*,#39,.F.);
#208 = ORIENTED_EDGE('',*,*,#171,.T.);
#209 = ORIENTED_EDGE('',*,*,#210,.T.);
#210 = EDGE_CURVE('',#164,#211,#213,.T.);
#211 = VERTEX_POINT('',#212);
#212 = CARTESIAN_POINT('',(-1.3,3.5,20.3));
#213 = LINE('',#214,#215);
#214 = CARTESIAN_POINT('',(-1.3,3.5,0.));
#215 = VECTOR('',#216,1.);
#216 = DIRECTION('',(0.,0.,1.));
#217 = ORIENTED_EDGE('',*,*,#218,.T.);
#218 = EDGE_CURVE('',#211,#40,#219,.T.);
#219 = CIRCLE('',#220,0.7);
#220 = AXIS2_PLACEMENT_3D('',#221,#222,#223);
#221 = CARTESIAN_POINT('',(-1.3,2.8,20.3));
#222 = DIRECTION('',(0.,-0.,1.));
#223 = DIRECTION('',(0.,1.,0.));
#224 = CYLINDRICAL_SURFACE('',#225,0.7);
#225 = AXIS2_PLACEMENT_3D('',#226,#227,#228);
#226 = CARTESIAN_POINT('',(-1.3,2.8,0.));
#227 = DIRECTION('',(0.,0.,1.));
#228 = DIRECTION('',(-1.,0.,0.));
#229 = ADVANCED_FACE('',(#230),#241,.T.);
#230 = FACE_BOUND('',#231,.F.);
#231 = EDGE_LOOP('',(#232,#233,#240));
#232 = ORIENTED_EDGE('',*,*,#104,.F.);
#233 = ORIENTED_EDGE('',*,*,#234,.T.);
#234 = EDGE_CURVE('',#105,#72,#235,.T.);
#235 = CIRCLE('',#236,0.7);
#236 = AXIS2_PLACEMENT_3D('',#237,#238,#239);
#237 = CARTESIAN_POINT('',(-1.3,-2.8,20.3));
#238 = DIRECTION('',(1.,-6.123233995737E-17,0.));
#239 = DIRECTION('',(-6.123233995737E-17,-1.,0.));
#240 = ORIENTED_EDGE('',*,*,#79,.F.);
#241 = SPHERICAL_SURFACE('',#242,0.7);
#242 = AXIS2_PLACEMENT_3D('',#243,#244,#245);
#243 = CARTESIAN_POINT('',(-1.3,-2.8,20.3));
#244 = DIRECTION('',(-0.,-0.,-1.));
#245 = DIRECTION('',(-1.,0.,0.));
#246 = ADVANCED_FACE('',(#247),#265,.F.);
#247 = FACE_BOUND('',#248,.F.);
#248 = EDGE_LOOP('',(#249,#250,#258,#264));
#249 = ORIENTED_EDGE('',*,*,#71,.T.);
#250 = ORIENTED_EDGE('',*,*,#251,.T.);
#251 = EDGE_CURVE('',#72,#252,#254,.T.);
#252 = VERTEX_POINT('',#253);
#253 = CARTESIAN_POINT('',(23.8,-3.5,20.3));
#254 = LINE('',#255,#256);
#255 = CARTESIAN_POINT('',(-1.3,-3.5,20.3));
#256 = VECTOR('',#257,1.);
#257 = DIRECTION('',(1.,0.,0.));
#258 = ORIENTED_EDGE('',*,*,#259,.F.);
#259 = EDGE_CURVE('',#130,#252,#260,.T.);
#260 = LINE('',#261,#262);
#261 = CARTESIAN_POINT('',(23.8,-3.5,0.));
#262 = VECTOR('',#263,1.);
#263 = DIRECTION('',(0.,0.,1.));
#264 = ORIENTED_EDGE('',*,*,#129,.F.);
#265 = PLANE('',#266);
#266 = AXIS2_PLACEMENT_3D('',#267,#268,#269);
#267 = CARTESIAN_POINT('',(-2.,-3.5,0.));
#268 = DIRECTION('',(0.,1.,0.));
#269 = DIRECTION('',(0.,0.,1.));
#270 = ADVANCED_FACE('',(#271),#282,.T.);
#271 = FACE_BOUND('',#272,.F.);
#272 = EDGE_LOOP('',(#273,#280,#281));
#273 = ORIENTED_EDGE('',*,*,#274,.F.);
#274 = EDGE_CURVE('',#95,#211,#275,.T.);
#275 = CIRCLE('',#276,0.7);
#276 = AXIS2_PLACEMENT_3D('',#277,#278,#279);
#277 = CARTESIAN_POINT('',(-1.3,2.8,20.3));
#278 = DIRECTION('',(-1.,0.,0.));
#279 = DIRECTION('',(0.,0.,1.));
#280 = ORIENTED_EDGE('',*,*,#94,.T.);
#281 = ORIENTED_EDGE('',*,*,#218,.F.);
#282 = SPHERICAL_SURFACE('',#283,0.7);
#283 = AXIS2_PLACEMENT_3D('',#284,#285,#286);
#284 = CARTESIAN_POINT('',(-1.3,2.8,20.3));
#285 = DIRECTION('',(-0.,-0.,-1.));
#286 = DIRECTION('',(0.,1.,0.));
#287 = ADVANCED_FACE('',(#288),#313,.T.);
#288 = FACE_BOUND('',#289,.T.);
#289 = EDGE_LOOP('',(#290,#298,#306,#312));
#290 = ORIENTED_EDGE('',*,*,#291,.T.);
#291 = EDGE_CURVE('',#105,#292,#294,.T.);
#292 = VERTEX_POINT('',#293);
#293 = CARTESIAN_POINT('',(23.8,-2.8,21.));
#294 = LINE('',#295,#296);
#295 = CARTESIAN_POINT('',(-1.3,-2.8,21.));
#296 = VECTOR('',#297,1.);
#297 = DIRECTION('',(1.,0.,0.));
#298 = ORIENTED_EDGE('',*,*,#299,.T.);
#299 = EDGE_CURVE('',#292,#300,#302,.T.);
#300 = VERTEX_POINT('',#301);
#301 = CARTESIAN_POINT('',(23.8,2.8,21.));
#302 = LINE('',#303,#304);
#303 = CARTESIAN_POINT('',(23.8,-2.8,21.));
#304 = VECTOR('',#305,1.);
#305 = DIRECTION('',(0.,1.,0.));
#306 = ORIENTED_EDGE('',*,*,#307,.T.);
#307 = EDGE_CURVE('',#300,#95,#308,.T.);
#308 = LINE('',#309,#310);
#309 = CARTESIAN_POINT('',(23.8,2.8,21.));
#310 = VECTOR('',#311,1.);
#311 = DIRECTION('',(-1.,-0.,-0.));
#312 = ORIENTED_EDGE('',*,*,#113,.T.);
#313 = PLANE('',#314);
#314 = AXIS2_PLACEMENT_3D('',#315,#316,#317);
#315 = CARTESIAN_POINT('',(-2.,-3.5,21.));
#316 = DIRECTION('',(0.,0.,1.));
#317 = DIRECTION('',(1.,0.,0.));
#318 = ADVANCED_FACE('',(#319),#337,.T.);
#319 = FACE_BOUND('',#320,.T.);
#320 = EDGE_LOOP('',(#321,#322,#330,#336));
#321 = ORIENTED_EDGE('',*,*,#210,.T.);
#322 = ORIENTED_EDGE('',*,*,#323,.F.);
#323 = EDGE_CURVE('',#324,#211,#326,.T.);
#324 = VERTEX_POINT('',#325);
#325 = CARTESIAN_POINT('',(23.8,3.5,20.3));
#326 = LINE('',#327,#328);
#327 = CARTESIAN_POINT('',(23.8,3.5,20.3));
#328 = VECTOR('',#329,1.);
#329 = DIRECTION('',(-1.,-0.,-0.));
#330 = ORIENTED_EDGE('',*,*,#331,.F.);
#331 = EDGE_CURVE('',#155,#324,#332,.T.);
#332 = LINE('',#333,#334);
#333 = CARTESIAN_POINT('',(23.8,3.5,0.));
#334 = VECTOR('',#335,1.);
#335 = DIRECTION('',(0.,0.,1.));
#336 = ORIENTED_EDGE('',*,*,#163,.F.);
#337 = PLANE('',#338);
#338 = AXIS2_PLACEMENT_3D('',#339,#340,#341);
#339 = CARTESIAN_POINT('',(-2.,3.5,0.));
#340 = DIRECTION('',(0.,1.,0.));
#341 = DIRECTION('',(0.,0.,1.));
#342 = ADVANCED_FACE('',(#343),#362,.T.);
#343 = FACE_BOUND('',#344,.F.);
#344 = EDGE_LOOP('',(#345,#353,#354,#355));
#345 = ORIENTED_EDGE('',*,*,#346,.F.);
#346 = EDGE_CURVE('',#138,#347,#349,.T.);
#347 = VERTEX_POINT('',#348);
#348 = CARTESIAN_POINT('',(24.5,-2.8,20.3));
#349 = LINE('',#350,#351);
#350 = CARTESIAN_POINT('',(24.5,-2.8,0.));
#351 = VECTOR('',#352,1.);
#352 = DIRECTION('',(0.,0.,1.));
#353 = ORIENTED_EDGE('',*,*,#137,.T.);
#354 = ORIENTED_EDGE('',*,*,#259,.T.);
#355 = ORIENTED_EDGE('',*,*,#356,.T.);
#356 = EDGE_CURVE('',#252,#347,#357,.T.);
#357 = CIRCLE('',#358,0.7);
#358 = AXIS2_PLACEMENT_3D('',#359,#360,#361);
#359 = CARTESIAN_POINT('',(23.8,-2.8,20.3));
#360 = DIRECTION('',(-0.,0.,1.));
#361 = DIRECTION('',(0.,-1.,0.));
#362 = CYLINDRICAL_SURFACE('',#363,0.7);
#363 = AXIS2_PLACEMENT_3D('',#364,#365,#366);
#364 = CARTESIAN_POINT('',(23.8,-2.8,0.));
#365 = DIRECTION('',(0.,0.,1.));
#366 = DIRECTION('',(1.,0.,0.));
#367 = ADVANCED_FACE('',(#368),#387,.T.);
#368 = FACE_BOUND('',#369,.T.);
#369 = EDGE_LOOP('',(#370,#378,#379,#380));
#370 = ORIENTED_EDGE('',*,*,#371,.F.);
#371 = EDGE_CURVE('',#147,#372,#374,.T.);
#372 = VERTEX_POINT('',#373);
#373 = CARTESIAN_POINT('',(24.5,2.8,20.3));
#374 = LINE('',#375,#376);
#375 = CARTESIAN_POINT('',(24.5,2.8,0.));
#376 = VECTOR('',#377,1.);
#377 = DIRECTION('',(0.,0.,1.));
#378 = ORIENTED_EDGE('',*,*,#154,.T.);
#379 = ORIENTED_EDGE('',*,*,#331,.T.);
#380 = ORIENTED_EDGE('',*,*,#381,.F.);
#381 = EDGE_CURVE('',#372,#324,#382,.T.);
#382 = CIRCLE('',#383,0.7);
#383 = AXIS2_PLACEMENT_3D('',#384,#385,#386);
#384 = CARTESIAN_POINT('',(23.8,2.8,20.3));
#385 = DIRECTION('',(0.,0.,1.));
#386 = DIRECTION('',(1.,0.,0.));
#387 = CYLINDRICAL_SURFACE('',#388,0.7);
#388 = AXIS2_PLACEMENT_3D('',#389,#390,#391);
#389 = CARTESIAN_POINT('',(23.8,2.8,0.));
#390 = DIRECTION('',(0.,0.,1.));
#391 = DIRECTION('',(1.,0.,0.));
#392 = ADVANCED_FACE('',(#393),#404,.T.);
#393 = FACE_BOUND('',#394,.T.);
#394 = EDGE_LOOP('',(#395,#396,#397,#398));
#395 = ORIENTED_EDGE('',*,*,#346,.F.);
#396 = ORIENTED_EDGE('',*,*,#146,.T.);
#397 = ORIENTED_EDGE('',*,*,#371,.T.);
#398 = ORIENTED_EDGE('',*,*,#399,.F.);
#399 = EDGE_CURVE('',#347,#372,#400,.T.);
#400 = LINE('',#401,#402);
#401 = CARTESIAN_POINT('',(24.5,-2.8,20.3));
#402 = VECTOR('',#403,1.);
#403 = DIRECTION('',(0.,1.,0.));
#404 = PLANE('',#405);
#405 = AXIS2_PLACEMENT_3D('',#406,#407,#408);
#406 = CARTESIAN_POINT('',(24.5,-3.5,0.));
#407 = DIRECTION('',(1.,0.,0.));
#408 = DIRECTION('',(0.,0.,1.));
#409 = ADVANCED_FACE('',(#410),#429,.T.);
#410 = FACE_BOUND('',#411,.T.);
#411 = EDGE_LOOP('',(#412,#413,#421,#428));
#412 = ORIENTED_EDGE('',*,*,#180,.F.);
#413 = ORIENTED_EDGE('',*,*,#414,.T.);
#414 = EDGE_CURVE('',#181,#415,#417,.T.);
#415 = VERTEX_POINT('',#416);
#416 = CARTESIAN_POINT('',(0.45,0.,-1.9));
#417 = LINE('',#418,#419);
#418 = CARTESIAN_POINT('',(0.45,0.,0.1));
#419 = VECTOR('',#420,1.);
#420 = DIRECTION('',(-0.,-0.,-1.));
#421 = ORIENTED_EDGE('',*,*,#422,.T.);
#422 = EDGE_CURVE('',#415,#415,#423,.T.);
#423 = CIRCLE('',#424,0.45);
#424 = AXIS2_PLACEMENT_3D('',#425,#426,#427);
#425 = CARTESIAN_POINT('',(0.,0.,-1.9));
#426 = DIRECTION('',(0.,0.,1.));
#427 = DIRECTION('',(1.,0.,0.));
#428 = ORIENTED_EDGE('',*,*,#414,.F.);
#429 = CYLINDRICAL_SURFACE('',#430,0.45);
#430 = AXIS2_PLACEMENT_3D('',#431,#432,#433);
#431 = CARTESIAN_POINT('',(0.,0.,0.1));
#432 = DIRECTION('',(0.,0.,1.));
#433 = DIRECTION('',(1.,0.,0.));
#434 = ADVANCED_FACE('',(#435),#454,.T.);
#435 = FACE_BOUND('',#436,.T.);
#436 = EDGE_LOOP('',(#437,#438,#446,#453));
#437 = ORIENTED_EDGE('',*,*,#191,.F.);
#438 = ORIENTED_EDGE('',*,*,#439,.T.);
#439 = EDGE_CURVE('',#192,#440,#442,.T.);
#440 = VERTEX_POINT('',#441);
#441 = CARTESIAN_POINT('',(22.95,0.,-1.9));
#442 = LINE('',#443,#444);
#443 = CARTESIAN_POINT('',(22.95,0.,0.1));
#444 = VECTOR('',#445,1.);
#445 = DIRECTION('',(-0.,-0.,-1.));
#446 = ORIENTED_EDGE('',*,*,#447,.T.);
#447 = EDGE_CURVE('',#440,#440,#448,.T.);
#448 = CIRCLE('',#449,0.45);
#449 = AXIS2_PLACEMENT_3D('',#450,#451,#452);
#450 = CARTESIAN_POINT('',(22.5,0.,-1.9));
#451 = DIRECTION('',(0.,0.,1.));
#452 = DIRECTION('',(1.,0.,0.));
#453 = ORIENTED_EDGE('',*,*,#439,.F.);
#454 = CYLINDRICAL_SURFACE('',#455,0.45);
#455 = AXIS2_PLACEMENT_3D('',#456,#457,#458);
#456 = CARTESIAN_POINT('',(22.5,0.,0.1));
#457 = DIRECTION('',(0.,0.,1.));
#458 = DIRECTION('',(1.,0.,0.));
#459 = ADVANCED_FACE('',(#460),#472,.T.);
#460 = FACE_BOUND('',#461,.T.);
#461 = EDGE_LOOP('',(#462,#463,#464,#471));
#462 = ORIENTED_EDGE('',*,*,#234,.T.);
#463 = ORIENTED_EDGE('',*,*,#251,.T.);
#464 = ORIENTED_EDGE('',*,*,#465,.F.);
#465 = EDGE_CURVE('',#292,#252,#466,.T.);
#466 = CIRCLE('',#467,0.7);
#467 = AXIS2_PLACEMENT_3D('',#468,#469,#470);
#468 = CARTESIAN_POINT('',(23.8,-2.8,20.3));
#469 = DIRECTION('',(1.,0.,-0.));
#470 = DIRECTION('',(0.,0.,1.));
#471 = ORIENTED_EDGE('',*,*,#291,.F.);
#472 = CYLINDRICAL_SURFACE('',#473,0.7);
#473 = AXIS2_PLACEMENT_3D('',#474,#475,#476);
#474 = CARTESIAN_POINT('',(-1.3,-2.8,20.3));
#475 = DIRECTION('',(1.,0.,0.));
#476 = DIRECTION('',(0.,0.,1.));
#477 = ADVANCED_FACE('',(#478),#490,.T.);
#478 = FACE_BOUND('',#479,.T.);
#479 = EDGE_LOOP('',(#480,#487,#488,#489));
#480 = ORIENTED_EDGE('',*,*,#481,.T.);
#481 = EDGE_CURVE('',#300,#324,#482,.T.);
#482 = CIRCLE('',#483,0.7);
#483 = AXIS2_PLACEMENT_3D('',#484,#485,#486);
#484 = CARTESIAN_POINT('',(23.8,2.8,20.3));
#485 = DIRECTION('',(-1.,7.273661547325E-16,0.));
#486 = DIRECTION('',(7.273661547325E-16,1.,0.));
#487 = ORIENTED_EDGE('',*,*,#323,.T.);
#488 = ORIENTED_EDGE('',*,*,#274,.F.);
#489 = ORIENTED_EDGE('',*,*,#307,.F.);
#490 = CYLINDRICAL_SURFACE('',#491,0.7);
#491 = AXIS2_PLACEMENT_3D('',#492,#493,#494);
#492 = CARTESIAN_POINT('',(23.8,2.8,20.3));
#493 = DIRECTION('',(-1.,-0.,-0.));
#494 = DIRECTION('',(0.,0.,1.));
#495 = ADVANCED_FACE('',(#496),#514,.T.);
#496 = FACE_BOUND('',#497,.T.);
#497 = EDGE_LOOP('',(#498,#505,#506,#513));
#498 = ORIENTED_EDGE('',*,*,#499,.T.);
#499 = EDGE_CURVE('',#292,#347,#500,.T.);
#500 = CIRCLE('',#501,0.7);
#501 = AXIS2_PLACEMENT_3D('',#502,#503,#504);
#502 = CARTESIAN_POINT('',(23.8,-2.8,20.3));
#503 = DIRECTION('',(6.123233995737E-17,1.,0.));
#504 = DIRECTION('',(1.,-6.123233995737E-17,0.));
#505 = ORIENTED_EDGE('',*,*,#399,.T.);
#506 = ORIENTED_EDGE('',*,*,#507,.F.);
#507 = EDGE_CURVE('',#300,#372,#508,.T.);
#508 = CIRCLE('',#509,0.7);
#509 = AXIS2_PLACEMENT_3D('',#510,#511,#512);
#510 = CARTESIAN_POINT('',(23.8,2.8,20.3));
#511 = DIRECTION('',(0.,1.,0.));
#512 = DIRECTION('',(0.,0.,1.));
#513 = ORIENTED_EDGE('',*,*,#299,.F.);
#514 = CYLINDRICAL_SURFACE('',#515,0.7);
#515 = AXIS2_PLACEMENT_3D('',#516,#517,#518);
#516 = CARTESIAN_POINT('',(23.8,-2.8,20.3));
#517 = DIRECTION('',(0.,1.,0.));
#518 = DIRECTION('',(0.,0.,1.));
#519 = ADVANCED_FACE('',(#520),#525,.T.);
#520 = FACE_BOUND('',#521,.F.);
#521 = EDGE_LOOP('',(#522,#523,#524));
#522 = ORIENTED_EDGE('',*,*,#465,.F.);
#523 = ORIENTED_EDGE('',*,*,#499,.T.);
#524 = ORIENTED_EDGE('',*,*,#356,.F.);
#525 = SPHERICAL_SURFACE('',#526,0.7);
#526 = AXIS2_PLACEMENT_3D('',#527,#528,#529);
#527 = CARTESIAN_POINT('',(23.8,-2.8,20.3));
#528 = DIRECTION('',(-0.,-0.,-1.));
#529 = DIRECTION('',(0.,-1.,0.));
#530 = ADVANCED_FACE('',(#531),#536,.T.);
#531 = FACE_BOUND('',#532,.F.);
#532 = EDGE_LOOP('',(#533,#534,#535));
#533 = ORIENTED_EDGE('',*,*,#507,.F.);
#534 = ORIENTED_EDGE('',*,*,#481,.T.);
#535 = ORIENTED_EDGE('',*,*,#381,.F.);
#536 = SPHERICAL_SURFACE('',#537,0.7);
#537 = AXIS2_PLACEMENT_3D('',#538,#539,#540);
#538 = CARTESIAN_POINT('',(23.8,2.8,20.3));
#539 = DIRECTION('',(-0.,-0.,-1.));
#540 = DIRECTION('',(1.,0.,0.));
#541 = ADVANCED_FACE('',(#542),#545,.F.);
#542 = FACE_BOUND('',#543,.F.);
#543 = EDGE_LOOP('',(#544));
#544 = ORIENTED_EDGE('',*,*,#422,.T.);
#545 = PLANE('',#546);
#546 = AXIS2_PLACEMENT_3D('',#547,#548,#549);
#547 = CARTESIAN_POINT('',(-1.7763568394E-15,2.911085817041E-17,-1.9));
#548 = DIRECTION('',(0.,0.,1.));
#549 = DIRECTION('',(1.,0.,0.));
#550 = ADVANCED_FACE('',(#551),#554,.F.);
#551 = FACE_BOUND('',#552,.F.);
#552 = EDGE_LOOP('',(#553));
#553 = ORIENTED_EDGE('',*,*,#447,.T.);
#554 = PLANE('',#555);
#555 = AXIS2_PLACEMENT_3D('',#556,#557,#558);
#556 = CARTESIAN_POINT('',(22.5,2.911085817041E-17,-1.9));
#557 = DIRECTION('',(0.,0.,1.));
#558 = DIRECTION('',(1.,0.,0.));
#559 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3)
GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#563)) GLOBAL_UNIT_ASSIGNED_CONTEXT
((#560,#561,#562)) REPRESENTATION_CONTEXT('Context #1',
'3D Context with UNIT and UNCERTAINTY') );
#560 = ( LENGTH_UNIT() NAMED_UNIT(*) SI_UNIT(.MILLI.,.METRE.) );
#561 = ( NAMED_UNIT(*) PLANE_ANGLE_UNIT() SI_UNIT($,.RADIAN.) );
#562 = ( NAMED_UNIT(*) SI_UNIT($,.STERADIAN.) SOLID_ANGLE_UNIT() );
#563 = UNCERTAINTY_MEASURE_WITH_UNIT(LENGTH_MEASURE(1.E-07),#560,
'distance_accuracy_value','confusion accuracy');
#564 = PRODUCT_TYPE('part',$,(#7));
#565 = MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION('',(#566,
#574,#581,#588,#595,#602,#609,#616,#623,#630,#637,#644,#651,#658,
#666,#673,#680,#687,#694,#701,#708,#715),#559);
#566 = STYLED_ITEM('color',(#567),#17);
#567 = PRESENTATION_STYLE_ASSIGNMENT((#568));
#568 = SURFACE_STYLE_USAGE(.BOTH.,#569);
#569 = SURFACE_SIDE_STYLE('',(#570));
#570 = SURFACE_STYLE_FILL_AREA(#571);
#571 = FILL_AREA_STYLE('',(#572));
#572 = FILL_AREA_STYLE_COLOUR('',#573);
#573 = COLOUR_RGB('',0.699999988079,0.10000000149,5.000000074506E-02);
#574 = STYLED_ITEM('color',(#575),#57);
#575 = PRESENTATION_STYLE_ASSIGNMENT((#576));
#576 = SURFACE_STYLE_USAGE(.BOTH.,#577);
#577 = SURFACE_SIDE_STYLE('',(#578));
#578 = SURFACE_STYLE_FILL_AREA(#579);
#579 = FILL_AREA_STYLE('',(#580));
#580 = FILL_AREA_STYLE_COLOUR('',#573);
#581 = STYLED_ITEM('color',(#582),#90);
#582 = PRESENTATION_STYLE_ASSIGNMENT((#583));
#583 = SURFACE_STYLE_USAGE(.BOTH.,#584);
#584 = SURFACE_SIDE_STYLE('',(#585));
#585 = SURFACE_STYLE_FILL_AREA(#586);
#586 = FILL_AREA_STYLE('',(#587));
#587 = FILL_AREA_STYLE_COLOUR('',#573);
#588 = STYLED_ITEM('color',(#589),#123);
#589 = PRESENTATION_STYLE_ASSIGNMENT((#590));
#590 = SURFACE_STYLE_USAGE(.BOTH.,#591);
#591 = SURFACE_SIDE_STYLE('',(#592));
#592 = SURFACE_STYLE_FILL_AREA(#593);
#593 = FILL_AREA_STYLE('',(#594));
#594 = FILL_AREA_STYLE_COLOUR('',#573);
#595 = STYLED_ITEM('color',(#596),#204);
#596 = PRESENTATION_STYLE_ASSIGNMENT((#597));
#597 = SURFACE_STYLE_USAGE(.BOTH.,#598);
#598 = SURFACE_SIDE_STYLE('',(#599));
#599 = SURFACE_STYLE_FILL_AREA(#600);
#600 = FILL_AREA_STYLE('',(#601));
#601 = FILL_AREA_STYLE_COLOUR('',#573);
#602 = STYLED_ITEM('color',(#603),#229);
#603 = PRESENTATION_STYLE_ASSIGNMENT((#604));
#604 = SURFACE_STYLE_USAGE(.BOTH.,#605);
#605 = SURFACE_SIDE_STYLE('',(#606));
#606 = SURFACE_STYLE_FILL_AREA(#607);
#607 = FILL_AREA_STYLE('',(#608));
#608 = FILL_AREA_STYLE_COLOUR('',#573);
#609 = STYLED_ITEM('color',(#610),#246);
#610 = PRESENTATION_STYLE_ASSIGNMENT((#611));
#611 = SURFACE_STYLE_USAGE(.BOTH.,#612);
#612 = SURFACE_SIDE_STYLE('',(#613));
#613 = SURFACE_STYLE_FILL_AREA(#614);
#614 = FILL_AREA_STYLE('',(#615));
#615 = FILL_AREA_STYLE_COLOUR('',#573);
#616 = STYLED_ITEM('color',(#617),#270);
#617 = PRESENTATION_STYLE_ASSIGNMENT((#618));
#618 = SURFACE_STYLE_USAGE(.BOTH.,#619);
#619 = SURFACE_SIDE_STYLE('',(#620));
#620 = SURFACE_STYLE_FILL_AREA(#621);
#621 = FILL_AREA_STYLE('',(#622));
#622 = FILL_AREA_STYLE_COLOUR('',#573);
#623 = STYLED_ITEM('color',(#624),#287);
#624 = PRESENTATION_STYLE_ASSIGNMENT((#625));
#625 = SURFACE_STYLE_USAGE(.BOTH.,#626);
#626 = SURFACE_SIDE_STYLE('',(#627));
#627 = SURFACE_STYLE_FILL_AREA(#628);
#628 = FILL_AREA_STYLE('',(#629));
#629 = FILL_AREA_STYLE_COLOUR('',#573);
#630 = STYLED_ITEM('color',(#631),#318);
#631 = PRESENTATION_STYLE_ASSIGNMENT((#632));
#632 = SURFACE_STYLE_USAGE(.BOTH.,#633);
#633 = SURFACE_SIDE_STYLE('',(#634));
#634 = SURFACE_STYLE_FILL_AREA(#635);
#635 = FILL_AREA_STYLE('',(#636));
#636 = FILL_AREA_STYLE_COLOUR('',#573);
#637 = STYLED_ITEM('color',(#638),#342);
#638 = PRESENTATION_STYLE_ASSIGNMENT((#639));
#639 = SURFACE_STYLE_USAGE(.BOTH.,#640);
#640 = SURFACE_SIDE_STYLE('',(#641));
#641 = SURFACE_STYLE_FILL_AREA(#642);
#642 = FILL_AREA_STYLE('',(#643));
#643 = FILL_AREA_STYLE_COLOUR('',#573);
#644 = STYLED_ITEM('color',(#645),#367);
#645 = PRESENTATION_STYLE_ASSIGNMENT((#646));
#646 = SURFACE_STYLE_USAGE(.BOTH.,#647);
#647 = SURFACE_SIDE_STYLE('',(#648));
#648 = SURFACE_STYLE_FILL_AREA(#649);
#649 = FILL_AREA_STYLE('',(#650));
#650 = FILL_AREA_STYLE_COLOUR('',#573);
#651 = STYLED_ITEM('color',(#652),#392);
#652 = PRESENTATION_STYLE_ASSIGNMENT((#653));
#653 = SURFACE_STYLE_USAGE(.BOTH.,#654);
#654 = SURFACE_SIDE_STYLE('',(#655));
#655 = SURFACE_STYLE_FILL_AREA(#656);
#656 = FILL_AREA_STYLE('',(#657));
#657 = FILL_AREA_STYLE_COLOUR('',#573);
#658 = STYLED_ITEM('color',(#659),#409);
#659 = PRESENTATION_STYLE_ASSIGNMENT((#660));
#660 = SURFACE_STYLE_USAGE(.BOTH.,#661);
#661 = SURFACE_SIDE_STYLE('',(#662));
#662 = SURFACE_STYLE_FILL_AREA(#663);
#663 = FILL_AREA_STYLE('',(#664));
#664 = FILL_AREA_STYLE_COLOUR('',#665);
#665 = COLOUR_RGB('',0.824000000954,0.819999992847,0.78100001812);
#666 = STYLED_ITEM('color',(#667),#434);
#667 = PRESENTATION_STYLE_ASSIGNMENT((#668));
#668 = SURFACE_STYLE_USAGE(.BOTH.,#669);
#669 = SURFACE_SIDE_STYLE('',(#670));
#670 = SURFACE_STYLE_FILL_AREA(#671);
#671 = FILL_AREA_STYLE('',(#672));
#672 = FILL_AREA_STYLE_COLOUR('',#665);
#673 = STYLED_ITEM('color',(#674),#459);
#674 = PRESENTATION_STYLE_ASSIGNMENT((#675));
#675 = SURFACE_STYLE_USAGE(.BOTH.,#676);
#676 = SURFACE_SIDE_STYLE('',(#677));
#677 = SURFACE_STYLE_FILL_AREA(#678);
#678 = FILL_AREA_STYLE('',(#679));
#679 = FILL_AREA_STYLE_COLOUR('',#573);
#680 = STYLED_ITEM('color',(#681),#477);
#681 = PRESENTATION_STYLE_ASSIGNMENT((#682));
#682 = SURFACE_STYLE_USAGE(.BOTH.,#683);
#683 = SURFACE_SIDE_STYLE('',(#684));
#684 = SURFACE_STYLE_FILL_AREA(#685);
#685 = FILL_AREA_STYLE('',(#686));
#686 = FILL_AREA_STYLE_COLOUR('',#573);
#687 = STYLED_ITEM('color',(#688),#495);
#688 = PRESENTATION_STYLE_ASSIGNMENT((#689));
#689 = SURFACE_STYLE_USAGE(.BOTH.,#690);
#690 = SURFACE_SIDE_STYLE('',(#691));
#691 = SURFACE_STYLE_FILL_AREA(#692);
#692 = FILL_AREA_STYLE('',(#693));
#693 = FILL_AREA_STYLE_COLOUR('',#573);
#694 = STYLED_ITEM('color',(#695),#519);
#695 = PRESENTATION_STYLE_ASSIGNMENT((#696));
#696 = SURFACE_STYLE_USAGE(.BOTH.,#697);
#697 = SURFACE_SIDE_STYLE('',(#698));
#698 = SURFACE_STYLE_FILL_AREA(#699);
#699 = FILL_AREA_STYLE('',(#700));
#700 = FILL_AREA_STYLE_COLOUR('',#573);
#701 = STYLED_ITEM('color',(#702),#530);
#702 = PRESENTATION_STYLE_ASSIGNMENT((#703));
#703 = SURFACE_STYLE_USAGE(.BOTH.,#704);
#704 = SURFACE_SIDE_STYLE('',(#705));
#705 = SURFACE_STYLE_FILL_AREA(#706);
#706 = FILL_AREA_STYLE('',(#707));
#707 = FILL_AREA_STYLE_COLOUR('',#573);
#708 = STYLED_ITEM('color',(#709),#541);
#709 = PRESENTATION_STYLE_ASSIGNMENT((#710));
#710 = SURFACE_STYLE_USAGE(.BOTH.,#711);
#711 = SURFACE_SIDE_STYLE('',(#712));
#712 = SURFACE_STYLE_FILL_AREA(#713);
#713 = FILL_AREA_STYLE('',(#714));
#714 = FILL_AREA_STYLE_COLOUR('',#665);
#715 = STYLED_ITEM('color',(#716),#550);
#716 = PRESENTATION_STYLE_ASSIGNMENT((#717));
#717 = SURFACE_STYLE_USAGE(.BOTH.,#718);
#718 = SURFACE_SIDE_STYLE('',(#719));
#719 = SURFACE_STYLE_FILL_AREA(#720);
#720 = FILL_AREA_STYLE('',(#721));
#721 = FILL_AREA_STYLE_COLOUR('',#665);
ENDSEC;
END-ISO-10303-21;
| {
"pile_set_name": "Github"
} |
class MediaActivityService
attr_reader :library_entry
delegate :media, to: :library_entry
delegate :user, to: :library_entry
def initialize(library_entry)
@library_entry = library_entry
end
def status(status)
fill_defaults user.profile_feed.activities.new(
foreign_id: "LibraryEntry:#{library_entry.id}:updated-#{status}",
verb: 'updated',
status: status
)
end
def rating(rating)
fill_defaults user.profile_feed.activities.new(
foreign_id: "LibraryEntry:#{library_entry.id}:rated",
verb: 'rated',
rating: rating,
nineteen_scale: true,
time: Date.today.to_time
)
end
def reviewed(review)
fill_defaults user.profile_feed.activities.new(
foreign_id: review,
verb: 'reviewed',
review: review,
to: [media&.feed&.no_fanout]
)
end
def fill_defaults(activity)
activity.tap do |act|
act.actor ||= user
act.object ||= library_entry
act.to ||= []
act.media ||= media
act.nsfw ||= media.try(:nsfw?)
act.foreign_id ||= library_entry
act.time ||= Time.now
end
end
end
| {
"pile_set_name": "Github"
} |
# gRPC Integration Tests
Welcome the integration tests for the config-mgmt service.
# How to run the tests
Below is the steps to run the tests:
```
$ hab studio enter
[1][default:/src:0]# start_deployment_service
[2][default:/src:0]# chef-automate dev deploy-some chef/automate-elasticsearch --with-deps
[3][default:/src:0]# config_mgmt_integration
```
This will run the integration tests by leveraging the helper `go_test`
# How do I run a single test
Before running any test manually, make sure you bring up elasticsearch by running `start_deployment_service` then `chef-automate dev deploy-some chef/automate-elasticsearch --with-deps`,
otherwise you will see the following error when running any of them:
```
Could not create elasticsearch client from 'http://elasticsearch:9200': health check timeout: no Elasticsearch node available
exit status 1
FAIL github.com/chef/automate/components/config-mgmt-service/integration_test 6.016s
```
Lets assume you are creating a rpc function for a new functionality called `Foo()`, to test it you would want to
create a test function called (for example) `TestFooEmptyRequest()`, in order to run just that single test you
can execute:
```
[3][default:/hab/cache/src/go/src/github.com/chef/automate/components/config-mgmt-service:0]# go test -v github.com/chef/automate/components/config-mgmt-service/integration_test -run TestFooEmptyRequest
=== RUN TestFooEmptyRequest
--- PASS: TestFooEmptyRequest (0.00s)
PASS
ok github.com/chef/automate/components/config-mgmt-service/integration_test 2.904s
```
Now lets imagine that you continue writing more test cases for the same new functionality you just added (called
`Foo()` remember) so you add the following test functions:
* `TestFooSimpleRequest()`
* `TestFooWrongRequestReturnError()`
* `TestFooWithPagination()`
* `TestFooWithSorting()`
* `TestFooWithFilters()`
* `TestFooTableDriven()`
If you would like to run all these tests at once, you can just provide a regex that matches the tests names,
for example you can use `TestFoo` and it will run all tests that starts with that pattern:
```
[3][default:/hab/cache/src/go/src/github.com/chef/automate/components/config-mgmt-service:0]# go test -v github.com/chef/automate/components/config-mgmt-service/integration_test -run TestFoo
```
Follow this [link](https://golang.org/pkg/testing/#hdr-Subtests_and_Sub_benchmarks) to know more about available regex to match tests or sub-tests.
| {
"pile_set_name": "Github"
} |
.segment-viewer-overlay-container {
background-color: rgba(255, 255, 255, 0.5);
color: black;
display: inline-block;
left: 0;
position: absolute;
top: 0;
}
.segment-viewer-legend-container {
display: inline-block;
bottom: 0;
position: absolute;
right: 0;
}
.segment-viewer-legend-item {
font-family: monospace;
font-size: small;
white-space: nowrap;
}
.segment-viewer-legend-label {
color: gray;
}
.segment-viewer-legend-colorbox {
background-color: white;
border: 1px solid gray;
display: inline-block;
height: .7em;
vertical-align: middle;
width: .7em;
}
.segment-viewer-container {
background-color: gray;
display: inline-block;
position: relative;
}
.segment-viewer-layer {
left: 0;
position: absolute;
top: 0;
zoom: 1.0;
-moz-transform: scale(1.0);
}
.segment-annotator-outer-container {
display: inline-block;
overflow: auto;
}
.segment-annotator-inner-container {
background-color: #ccc;
position: relative;
zoom: 1.0;
-moz-transform: scale(1.0);
-moz-transform-origin: top left;
}
.segment-annotator-layer {
left: 0;
position: absolute;
top: 0;
cursor: pointer;
}
.edit-sidebar {
font-family: monospace;
}
.edit-sidebar p {
/* font-family: serif; */
padding: 0 0.5em;
width: 100%;
}
.edit-sidebar-button {
position: relative;
background-color: #eee;
cursor: pointer;
padding-left: 2px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.edit-sidebar-button:hover {
background-color: #aaa;
}
.edit-sidebar-button-selected,
.edit-sidebar-button-enabled {
background-color: #ccc;
}
.edit-sidebar-button-highlight {
background-color: #aaa;
}
.edit-sidebar-legend-colorbox {
background-color: white;
border: 1px solid gray;
display: inline-block;
height: .7em;
vertical-align: middle;
width: .7em;
}
.edit-sidebar-legend-label {
color: gray;
display: inline-block;
width: 10em;
padding: 0 0.3em;
}
.edit-sidebar-legend-label-active {
color: black;
font-weight: bold;
}
.edit-sidebar-popup-trigger {
display: inline-block;
position: relative;
min-width: 1em;
text-align: center;
background-color: #ddd;
}
.edit-sidebar-popup-trigger:hover {
background-color: #999;
}
.edit-sidebar-popup {
display: none;
position: absolute;
top: 1em;
right: 0;
padding: 0.1em 0.3em;
background-color: #ccc;
z-index: 1;
}
.edit-sidebar-popup-active {
display: block;
}
.edit-sidebar-spacer {
height: 1em;
}
.edit-sidebar-submit {
margin-left: 1em;
}
.edit-image-top-menu {
height: 1em;
font-family: monospace;
}
.edit-image-top-menu-item {
display: inline-block;
background-color: #eee;
padding: 0 2px;
min-width: 1em;
text-align: center;
}
.edit-image-top-button {
display: inline-block;
background-color: #eee;
cursor: pointer;
padding: 0 2px;
min-width: 1em;
text-align: center;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.edit-image-top-button:hover {
background-color: #aaa;
}
.edit-image-top-button-enabled {
background-color: #ccc;
}
.edit-image-top-spacer {
display: inline-block;
width: 1em;
}
.edit-image-display {
display: inline-block;
vertical-align: top;
}
.edit-main-container {
white-space: nowrap;
}
.edit-top-menu-block {
display: inline-block;
margin: 0 .5em;
}
| {
"pile_set_name": "Github"
} |
<?php
namespace Carbon_Fields\Field;
use Carbon_Fields\Helper\Helper;
/**
* Select dropdown field class.
*/
class Select_Field extends Predefined_Options_Field {
/**
* {@inheritDoc}
*/
public function set_value_from_input( $input ) {
$options_values = $this->get_options_values();
$value = null;
if ( isset( $input[ $this->get_name() ] ) ) {
$raw_value = stripslashes_deep( $input[ $this->get_name() ] );
$raw_value = Helper::get_valid_options( array( $raw_value ), $options_values );
if ( ! empty( $raw_value ) ) {
$value = $raw_value[0];
}
}
if ( $value === null ) {
$value = $options_values[0];
}
return $this->set_value( $value );
}
/**
* {@inheritDoc}
*/
public function to_json( $load ) {
$field_data = parent::to_json( $load );
$options = $this->parse_options( $this->get_options(), true );
$value = strval( $this->get_formatted_value() );
$field_data = array_merge( $field_data, array(
'value' => strval( $value ),
'options' => $options,
) );
return $field_data;
}
/**
* {@inheritDoc}
*/
public function get_formatted_value() {
$options_values = $this->get_options_values();
if ( empty( $options_values ) ) {
$options_values[] = '';
}
$value = $this->get_value();
$value = $this->get_values_from_options( array( $value ) );
$value = ! empty( $value ) ? $value[0] : $options_values[0];
return $value;
}
}
| {
"pile_set_name": "Github"
} |
<!--
Copyright World Wide Web Consortium, (Massachusetts Institute of
Technology, Institut National de Recherche en Informatique et en
Automatique, Keio University).
All Rights Reserved.
Please see the full Copyright clause at
<http://www.w3.org/Consortium/Legal/copyright-software.html>
Description: rdf:parseType="Collection" is parsed like the
nonstandard daml:collection.
Author: Jos De Roo (test case), Jeremy Carroll (comment)
$Id: test06.rdf,v 1.1 2005-08-06 06:14:49 jeremy_carroll Exp $
-->
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:eg="http://example.org/eg#">
<rdf:Description rdf:about="http://example.org/eg#eric">
<rdf:type rdf:parseType="Resource">
<eg:intersectionOf rdf:parseType="daml:collection">
<rdf:Description />
<rdf:Description />
<rdf:Description />
</eg:intersectionOf>
</rdf:type>
</rdf:Description>
</rdf:RDF>
| {
"pile_set_name": "Github"
} |
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// This header declares the namespace google::protobuf::protobuf_unittest in order to expose
// any problems with the generated class names. We use this header to ensure
// unittest.cc will declare the namespace prior to other includes, while obeying
// normal include ordering.
//
// When generating a class name of "foo.Bar" we must ensure we prefix the class
// name with "::", in case the namespace google::protobuf::foo exists. We intentionally
// trigger that case here by declaring google::protobuf::protobuf_unittest.
//
// See ClassName in helpers.h for more details.
#ifndef GOOGLE_PROTOBUF_COMPILER_CPP_UNITTEST_H__
#define GOOGLE_PROTOBUF_COMPILER_CPP_UNITTEST_H__
namespace google {
namespace protobuf {
namespace protobuf_unittest {}
} // namespace protobuf
} // namespace google
#endif // GOOGLE_PROTOBUF_COMPILER_CPP_UNITTEST_H__
| {
"pile_set_name": "Github"
} |
// Copyright 2013 com authors
//
// Licensed under the Apache License, Version 2.0 (the "License"): you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
package com
import (
"bytes"
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"encoding/base64"
"errors"
"io"
r "math/rand"
"strconv"
"strings"
"time"
"unicode"
"unicode/utf8"
)
// AESEncrypt encrypts text and given key with AES.
func AESEncrypt(key, text []byte) ([]byte, error) {
block, err := aes.NewCipher(key)
if err != nil {
return nil, err
}
b := base64.StdEncoding.EncodeToString(text)
ciphertext := make([]byte, aes.BlockSize+len(b))
iv := ciphertext[:aes.BlockSize]
if _, err := io.ReadFull(rand.Reader, iv); err != nil {
return nil, err
}
cfb := cipher.NewCFBEncrypter(block, iv)
cfb.XORKeyStream(ciphertext[aes.BlockSize:], []byte(b))
return ciphertext, nil
}
// AESDecrypt decrypts text and given key with AES.
func AESDecrypt(key, text []byte) ([]byte, error) {
block, err := aes.NewCipher(key)
if err != nil {
return nil, err
}
if len(text) < aes.BlockSize {
return nil, errors.New("ciphertext too short")
}
iv := text[:aes.BlockSize]
text = text[aes.BlockSize:]
cfb := cipher.NewCFBDecrypter(block, iv)
cfb.XORKeyStream(text, text)
data, err := base64.StdEncoding.DecodeString(string(text))
if err != nil {
return nil, err
}
return data, nil
}
// IsLetter returns true if the 'l' is an English letter.
func IsLetter(l uint8) bool {
n := (l | 0x20) - 'a'
if n >= 0 && n < 26 {
return true
}
return false
}
// Expand replaces {k} in template with match[k] or subs[atoi(k)] if k is not in match.
func Expand(template string, match map[string]string, subs ...string) string {
var p []byte
var i int
for {
i = strings.Index(template, "{")
if i < 0 {
break
}
p = append(p, template[:i]...)
template = template[i+1:]
i = strings.Index(template, "}")
if s, ok := match[template[:i]]; ok {
p = append(p, s...)
} else {
j, _ := strconv.Atoi(template[:i])
if j >= len(subs) {
p = append(p, []byte("Missing")...)
} else {
p = append(p, subs[j]...)
}
}
template = template[i+1:]
}
p = append(p, template...)
return string(p)
}
// Reverse s string, support unicode
func Reverse(s string) string {
n := len(s)
runes := make([]rune, n)
for _, rune := range s {
n--
runes[n] = rune
}
return string(runes[n:])
}
// RandomCreateBytes generate random []byte by specify chars.
func RandomCreateBytes(n int, alphabets ...byte) []byte {
const alphanum = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
var bytes = make([]byte, n)
var randby bool
if num, err := rand.Read(bytes); num != n || err != nil {
r.Seed(time.Now().UnixNano())
randby = true
}
for i, b := range bytes {
if len(alphabets) == 0 {
if randby {
bytes[i] = alphanum[r.Intn(len(alphanum))]
} else {
bytes[i] = alphanum[b%byte(len(alphanum))]
}
} else {
if randby {
bytes[i] = alphabets[r.Intn(len(alphabets))]
} else {
bytes[i] = alphabets[b%byte(len(alphabets))]
}
}
}
return bytes
}
// ToSnakeCase can convert all upper case characters in a string to
// underscore format.
//
// Some samples.
// "FirstName" => "first_name"
// "HTTPServer" => "http_server"
// "NoHTTPS" => "no_https"
// "GO_PATH" => "go_path"
// "GO PATH" => "go_path" // space is converted to underscore.
// "GO-PATH" => "go_path" // hyphen is converted to underscore.
//
// From https://github.com/huandu/xstrings
func ToSnakeCase(str string) string {
if len(str) == 0 {
return ""
}
buf := &bytes.Buffer{}
var prev, r0, r1 rune
var size int
r0 = '_'
for len(str) > 0 {
prev = r0
r0, size = utf8.DecodeRuneInString(str)
str = str[size:]
switch {
case r0 == utf8.RuneError:
buf.WriteByte(byte(str[0]))
case unicode.IsUpper(r0):
if prev != '_' {
buf.WriteRune('_')
}
buf.WriteRune(unicode.ToLower(r0))
if len(str) == 0 {
break
}
r0, size = utf8.DecodeRuneInString(str)
str = str[size:]
if !unicode.IsUpper(r0) {
buf.WriteRune(r0)
break
}
// find next non-upper-case character and insert `_` properly.
// it's designed to convert `HTTPServer` to `http_server`.
// if there are more than 2 adjacent upper case characters in a word,
// treat them as an abbreviation plus a normal word.
for len(str) > 0 {
r1 = r0
r0, size = utf8.DecodeRuneInString(str)
str = str[size:]
if r0 == utf8.RuneError {
buf.WriteRune(unicode.ToLower(r1))
buf.WriteByte(byte(str[0]))
break
}
if !unicode.IsUpper(r0) {
if r0 == '_' || r0 == ' ' || r0 == '-' {
r0 = '_'
buf.WriteRune(unicode.ToLower(r1))
} else {
buf.WriteRune('_')
buf.WriteRune(unicode.ToLower(r1))
buf.WriteRune(r0)
}
break
}
buf.WriteRune(unicode.ToLower(r1))
}
if len(str) == 0 || r0 == '_' {
buf.WriteRune(unicode.ToLower(r0))
break
}
default:
if r0 == ' ' || r0 == '-' {
r0 = '_'
}
buf.WriteRune(r0)
}
}
return buf.String()
}
| {
"pile_set_name": "Github"
} |
/*
This file is a part of libcds - Concurrent Data Structures library
(C) Copyright Maxim Khizhinsky ([email protected]) 2006-2016
Source code repo: http://github.com/khizmax/libcds/
Download: http://sourceforge.net/projects/libcds/files/
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test_set_nogc.h"
#include <cds/container/lazy_list_nogc.h>
#include <cds/container/split_list_set_nogc.h>
namespace {
namespace cc = cds::container;
typedef cds::gc::nogc gc_type;
class SplitListLazySet_NoGC : public cds_test::container_set_nogc
{
protected:
typedef cds_test::container_set_nogc base_class;
//void SetUp()
//{}
//void TearDown()
//{}
};
TEST_F( SplitListLazySet_NoGC, compare )
{
typedef cc::SplitListSet< gc_type, int_item,
typename cc::split_list::make_traits<
cc::split_list::ordered_list< cc::lazy_list_tag >
, cds::opt::hash< hash_int >
, cc::split_list::ordered_list_traits<
typename cc::lazy_list::make_traits<
cds::opt::compare< cmp >
>::type
>
>::type
> set_type;
set_type s( kSize, 2 );
test( s );
}
TEST_F( SplitListLazySet_NoGC, less )
{
typedef cc::SplitListSet< gc_type, int_item,
typename cc::split_list::make_traits<
cc::split_list::ordered_list< cc::lazy_list_tag >
, cds::opt::hash< hash_int >
, cc::split_list::ordered_list_traits<
typename cc::lazy_list::make_traits<
cds::opt::less< less >
>::type
>
>::type
> set_type;
set_type s( kSize, 2 );
test( s );
}
TEST_F( SplitListLazySet_NoGC, cmpmix )
{
typedef cc::SplitListSet< gc_type, int_item,
typename cc::split_list::make_traits<
cc::split_list::ordered_list< cc::lazy_list_tag >
, cds::opt::hash< hash_int >
, cc::split_list::ordered_list_traits<
typename cc::lazy_list::make_traits<
cds::opt::less< less >
, cds::opt::compare< cmp >
>::type
>
>::type
> set_type;
set_type s( kSize, 1 );
test( s );
}
TEST_F( SplitListLazySet_NoGC, item_counting )
{
struct set_traits: public cc::split_list::traits
{
typedef cc::lazy_list_tag ordered_list;
typedef hash_int hash;
typedef cds::atomicity::item_counter item_counter;
struct ordered_list_traits: public cc::lazy_list::traits
{
typedef cmp compare;
typedef base_class::less less;
typedef cds::backoff::empty back_off;
};
};
typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type;
set_type s( kSize, 3 );
test( s );
}
TEST_F( SplitListLazySet_NoGC, stat )
{
struct set_traits: public cc::split_list::traits
{
typedef cc::lazy_list_tag ordered_list;
typedef hash_int hash;
typedef cds::atomicity::item_counter item_counter;
typedef cc::split_list::stat<> stat;
struct ordered_list_traits: public cc::lazy_list::traits
{
typedef base_class::less less;
typedef cds::opt::v::sequential_consistent memory_model;
};
};
typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type;
set_type s( kSize, 4 );
test( s );
}
TEST_F( SplitListLazySet_NoGC, back_off )
{
struct set_traits: public cc::split_list::traits
{
typedef cc::lazy_list_tag ordered_list;
typedef hash_int hash;
typedef cds::atomicity::item_counter item_counter;
typedef cds::backoff::yield back_off;
typedef cds::opt::v::sequential_consistent memory_model;
struct ordered_list_traits: public cc::lazy_list::traits
{
typedef cmp compare;
typedef cds::backoff::empty back_off;
};
};
typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type;
set_type s( kSize, 2 );
test( s );
}
TEST_F( SplitListLazySet_NoGC, mutex )
{
struct set_traits: public cc::split_list::traits
{
typedef cc::lazy_list_tag ordered_list;
typedef hash_int hash;
typedef cds::atomicity::item_counter item_counter;
typedef cds::backoff::yield back_off;
typedef cds::opt::v::sequential_consistent memory_model;
struct ordered_list_traits: public cc::lazy_list::traits
{
typedef cmp compare;
typedef cds::backoff::pause back_off;
typedef std::mutex lock_type;
};
};
typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type;
set_type s( kSize, 3 );
test( s );
}
struct set_static_traits: public cc::split_list::traits
{
static bool const dynamic_bucket_table = false;
};
TEST_F( SplitListLazySet_NoGC, static_bucket_table )
{
struct set_traits: public set_static_traits
{
typedef cc::lazy_list_tag ordered_list;
typedef hash_int hash;
typedef cds::atomicity::item_counter item_counter;
struct ordered_list_traits: public cc::lazy_list::traits
{
typedef cmp compare;
typedef cds::backoff::pause back_off;
};
};
typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type;
set_type s( kSize, 4 );
test( s );
}
} // namespace
| {
"pile_set_name": "Github"
} |
/*
Copyright 2018 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package reconciliation
import (
"context"
corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
utilerrors "k8s.io/apimachinery/pkg/util/errors"
corev1client "k8s.io/client-go/kubernetes/typed/core/v1"
)
// tryEnsureNamespace gets or creates the given namespace while ignoring forbidden errors.
// It is a best effort attempt as the user may not be able to get or create namespaces.
// This allows us to handle flows where the user can only mutate roles and role bindings.
func tryEnsureNamespace(client corev1client.NamespaceInterface, namespace string) error {
_, getErr := client.Get(context.TODO(), namespace, metav1.GetOptions{})
if getErr == nil {
return nil
}
if fatalGetErr := utilerrors.FilterOut(getErr, apierrors.IsNotFound, apierrors.IsForbidden); fatalGetErr != nil {
return fatalGetErr
}
ns := &corev1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: namespace}}
_, createErr := client.Create(context.TODO(), ns, metav1.CreateOptions{})
return utilerrors.FilterOut(createErr, apierrors.IsAlreadyExists, apierrors.IsForbidden)
}
| {
"pile_set_name": "Github"
} |
{-#LANGUAGE FlexibleContexts, StandaloneDeriving, UndecidableInstances, ConstraintKinds #-}
module Carnap.Calculi.Tableau.Checker where
import Carnap.Core.Data.Types
import Carnap.Core.Data.Classes
import Carnap.Core.Data.Optics
import Carnap.Core.Data.Util (hasVar)
import Carnap.Core.Unification.Unification
import Carnap.Core.Unification.ACUI
import Carnap.Calculi.Util
import Carnap.Calculi.Tableau.Data
import Carnap.Languages.ClassicalSequent.Syntax
import Data.Tree
import Data.List
import Data.Typeable
import Control.Monad.State
import Control.Lens
type SupportsTableau rule lex sem =
( MonadVar (ClassicalSequentOver lex) (State Int)
, FirstOrderLex (lex (ClassicalSequentOver lex))
, FirstOrderLex (lex (FixLang lex))
, Eq (FixLang lex sem)
, Schematizable (lex (ClassicalSequentOver lex))
, CopulaSchema (ClassicalSequentOver lex)
, SpecifiedUnificationType rule
, CopulaSchema (FixLang lex)
, BoundVars lex
, PrismLink (lex (ClassicalSequentOver lex)) (SubstitutionalVariable (ClassicalSequentOver lex)) -- XXX Not needed in GHC >= 8.4
, Typeable sem
, Sequentable lex
, CoreInference rule lex sem
, PrismSubstitutionalVariable lex
, EtaExpand (ClassicalSequentOver lex) sem
)
--This function should swap out the contents of each node in a tableau for
--appropriate feedback, or an indication that the node is correct.
validateTree :: SupportsTableau rule lex sem => Tableau lex sem rule -> TreeFeedback lex
validateTree (Node n descendents) = Node (clean $ validateNode n theChildren) (map validateTree descendents)
where theChildren = map rootLabel descendents
clean (Correct:_) = Correct
clean (ProofData s:_) = ProofData s
clean [ProofError e] = ProofError e
clean (ProofError _ :xs) = clean xs
clean _ = ProofData "no feedback"
validateNode :: SupportsTableau rule lex sem => TableauNode lex sem rule -> [TableauNode lex sem rule] -> [TreeFeedbackNode lex]
validateNode n ns = case tableauNodeRule n of
Nothing -> return $ treeErrMsg "no rule developing this node"
Just rs ->
do r <- rs
let theRule = coreRuleOf r
if length (upperSequents theRule) /= length ns
then return $ treeErrMsg "wrong number of premises"
else do
ns' <- permutations ns
let childSeqs = map tableauNodeSeq ns'
thePairs = (lowerSequent theRule, n) : zip (upperSequents theRule) ns'
addTarget (scheme,node) = (node, getTargets scheme)
targetedPairs = map addTarget thePairs
if any (not . lengthCheck) targetedPairs
then return $ treeErrMsg $ "Missing target for rule"
else do
let mainProb = concat . map (uncurry toEqs) $ targetedPairs
case hosolve mainProb of
Left e -> return $ ProofError e
Right hosubs -> do
hosub <- hosubs
childSeqs <- permutations (map tableauNodeSeq ns)
let structsolver = case unificationType r of
AssociativeUnification -> ausolve
ACUIUnification -> acuisolve
let runSub = pureBNF . applySub hosub
subbedChildrenLHS = map (view lhs . runSub) (upperSequents theRule)
subbedChildrenRHS = map (view rhs . runSub) (upperSequents theRule)
subbedParentLHS = view lhs . runSub $ lowerSequent theRule
subbedParentRHS = view rhs . runSub $ lowerSequent theRule
prob = (subbedParentLHS :=: (view lhs . tableauNodeSeq $ n))
: (subbedParentRHS :=: (view rhs . tableauNodeSeq $ n))
: zipWith (:=:) subbedChildrenLHS (map (view lhs) childSeqs)
++ zipWith (:=:) subbedChildrenRHS (map (view rhs) childSeqs)
case structsolver prob of
Left e -> return $ ProofError e
Right structsubs -> do
finalsub <- map (++ hosub) structsubs
case coreRestriction r >>= ($ finalsub) of
Just msg -> return (treeErrMsg msg)
Nothing -> return Correct
getTargets :: ClassicalSequentOver lex (Sequent sem) -> [SequentRuleTarget (ClassicalSequentLexOver lex) sem]
getTargets seq = let (linit,lremainder) = getInitTargetsLeft 1 ([], cedentUnfold $ view lhs seq)
(rinit,rremainder) = getInitTargetsRight 1 ([], cedentUnfold $ view rhs seq)
in linit ++ rinit ++ getTailTargetsLeft (-1) (reverse lremainder) ++ getTailTargetsRight (-1) (reverse rremainder)
getInitTargetsRight :: Int -> ([SequentRuleTarget (ClassicalSequentLexOver lex) sem], [ClassicalSequentOver lex (Succedent sem)])
-> ([SequentRuleTarget (ClassicalSequentLexOver lex) sem], [ClassicalSequentOver lex (Succedent sem)])
getInitTargetsRight n (acc, SS f : fs) = getInitTargetsRight (n+1) (RightTarget f n: acc, fs)
getInitTargetsRight n (acc, fs) = (acc, fs)
getInitTargetsLeft :: Int -> ([SequentRuleTarget (ClassicalSequentLexOver lex) sem], [ClassicalSequentOver lex (Antecedent sem)])
-> ([SequentRuleTarget (ClassicalSequentLexOver lex) sem], [ClassicalSequentOver lex (Antecedent sem)])
getInitTargetsLeft n (acc, SA f : fs) = getInitTargetsLeft (n+1) (LeftTarget f n: acc, fs)
getInitTargetsLeft n (acc, fs) = (acc, fs)
getTailTargetsLeft :: Int -> [ClassicalSequentOver lex (Antecedent sem)] -> [SequentRuleTarget (ClassicalSequentLexOver lex) sem]
getTailTargetsLeft n (SA f:fs) = LeftTarget f n : getTailTargetsLeft (n - 1) fs
getTailTargetsLeft n _ = []
getTailTargetsRight :: Int -> [ClassicalSequentOver lex (Succedent sem)] -> [SequentRuleTarget (ClassicalSequentLexOver lex) sem]
getTailTargetsRight n (SS f:fs) = RightTarget f n: getTailTargetsRight (n - 1) fs
getTailTargetsRight n _ = []
lengthCheck :: SupportsTableau rule lex sem => (TableauNode lex sem rule, [SequentRuleTarget (ClassicalSequentLexOver lex) sem]) -> Bool
lengthCheck (node,targets) = (minLengthLeft targets <= length (cedentUnfold $ view lhs (tableauNodeSeq node)))
&& (minLengthRight targets <= length (cedentUnfold $ view rhs (tableauNodeSeq node)))
--TODO: Beef this up to allow manual targeting
toEqs :: SupportsTableau rule lex sem => TableauNode lex sem rule -> [SequentRuleTarget (ClassicalSequentLexOver lex) sem] -> [Equation (ClassicalSequentOver lex)]
toEqs node target =
case target of
(LeftTarget f n : ts) | n > 0 -> intoEq f (theLHS !! (n - 1)) : toEqs node ts
(LeftTarget f n : ts) | 0 > n -> intoEq f (reverseLHS !! (abs n - 1)) : toEqs node ts
(RightTarget f n : ts) | n > 0 -> intoEq f (theRHS !! (n - 1)) : toEqs node ts
(RightTarget f n : ts) | 0 > n -> intoEq f (reverseRHS !! (abs n - 1)) : toEqs node ts
(NoTarget : ts) -> toEqs node ts
[] -> []
where theLHS = toListOf (lhs . concretes) $ tableauNodeSeq node
theRHS = toListOf (rhs . concretes) $ tableauNodeSeq node
reverseLHS = reverse theLHS
reverseRHS = reverse theRHS
intoEq f x = f :=: x
--the minimum length of a cedent given a set of Conc targets
minLengthLeft targets = minInit targets + abs (minTail targets)
where minInit (LeftTarget _ n : ts) | n > 0 = max n (minInit ts)
minInit (_:xs) = minInit xs
minInit [] = 0
minTail (LeftTarget _ n : ts) | n < 0 = min n (minTail ts)
minTail (_:xs) = minTail xs
minTail [] = 0
minLengthRight targets = minInit targets + abs (minTail targets)
where minInit (RightTarget _ n : ts) | n > 0 = max n (minInit ts)
minInit (_:xs) = minInit xs
minInit [] = 0
minTail (RightTarget _ n : ts) | n < 0 = min n (minTail ts)
minTail (_:xs) = minTail xs
minTail [] = 0
treeErrMsg :: String -> TreeFeedbackNode lex
treeErrMsg s = ProofError (GenericError s 0)
data SequentRuleTarget lex sem = LeftTarget (FixLang lex sem) Int --the Int gives the position of the target in the left cedent of the sequent
| RightTarget (FixLang lex sem) Int
| NoTarget
deriving instance Eq (FixLang lex sem) => Eq (SequentRuleTarget lex sem)
deriving instance Show (FixLang lex sem) => Show (SequentRuleTarget lex sem)
| {
"pile_set_name": "Github"
} |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.tinkerpop.gremlin.structure.io;
/**
* A test class to be serialized.
*
* @author Stephen Mallette (http://stephen.genoprime.com)
*/
public class IoY {
private Integer y;
private Integer z;
private IoY() {}
public IoY(final int y, final int z) {
this.y = y;
this.z = z;
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final IoY ioY = (IoY) o;
return y.equals(ioY.y);
}
@Override
public int hashCode() {
return y.hashCode();
}
@Override
public String toString() {
return y + "-" + z;
}
}
| {
"pile_set_name": "Github"
} |
{
"images" : [
{
"idiom" : "watch",
"screenWidth" : "{130,145}",
"scale" : "2x"
},
{
"idiom" : "watch",
"screenWidth" : "{146,165}",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
} | {
"pile_set_name": "Github"
} |
import app from '@system.app';
import fetch from '@system.fetch';
import device from '@system.device';
import storage from '@system.storage';
import dc_stat_conf from './dcloud_stat_conf.js';
let dcloud_stat = {
stat_data: {
p: "a"
},
retryTime: 0, //重试次数
report: function (logType) {
this.stat_data.lt = logType || 1;
this.getAppInfo();
let _self = this;
this.getDeviceId(function () {
if (dc_stat_conf.app_key) {
_self.stat_data.ak = dc_stat_conf.app_key;
//console.log("stat_data:" + JSON.stringify(_self.stat_data));
fetch.fetch({
url: "https://stream.dcloud.net.cn/quickapp/stat",
data: _self.stat_data,
success: function (rsp) {
//console.log("report rsp: " + rsp.data);
},
fail: function (data, code) {
if (++_self.retryTime > 2) {
setTimeout((logType) => {
report(logType);
}, 500);
}
}
});
}
});
},
getAppInfo: function () {
let appInfo = app.getInfo();
if (appInfo) {
this.stat_data.vn = appInfo.versionName;
this.stat_data.vc = appInfo.versionCode;
}
},
getDeviceId: function (callback) {
let _self = this;
device.getId({
type: ["device", "mac", "user"],
success: function (data) {
console.log("device.getId success: " + JSON.stringify(data));
_self.stat_data.imei = "|" + data.device + "|" + data.mac + "|" + data.user + "||";
_self.getDeviceInfo(callback);
},
fail: function (data, code) {
console.log("handling fail, code=" + code);
let dt = new Date();
//读取之前缓存的数据
storage.get({
key: '__DC_STAT_DEVICE_R',
success: function (data) {
let rid = '';
if (data) {
//之前已经有缓存数据了
rid = data;
} else {
//首次,没有数据
rid = "__DS_RID__" + dt.getFullYear() + (dt.getMonth() +1) + dt.getDate() + dt.getHours() + parseInt(Math.random() *100000);
//存储rid
storage.set({
key:'__DC_STAT_DEVICE_R',
value:rid
});
}
_self.stat_data.imei = "||||" +rid + "|";
_self.getDeviceInfo(callback);
},
fail: function (data, code) {
console.log("storage handling fail, code=" + code);
}
});
}
});
},
getDeviceInfo: function (callback) {
let _self = this;
device.getInfo({
success: function (data) {
_self.stat_data.brand = data.brand;
_self.stat_data.vd = data.manufacturer;
_self.stat_data.md = data.model;
_self.stat_data.os = data.osVersionCode;
//TODO 缺少网络
_self.stat_data.pvn = data.platformVersionName;
_self.stat_data.vb = data.platformVersionCode;
_self.stat_data.lang = data.language;
_self.stat_data.region = data.region;
_self.stat_data.sw = data.screenWidth;
_self.stat_data.sh = data.screenHeight;
},
fail: function () {
},
complete: function () {
callback();
}
});
}
};
(global.__proto__ || global).dc_stat = dcloud_stat;
export default dcloud_stat;
| {
"pile_set_name": "Github"
} |
/*
This file is part of solidity.
solidity is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
solidity is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
/**
* @author Christian <[email protected]>
* @date 2014
* Utilities for the solidity compiler.
*/
#include <libsolidity/codegen/CompilerContext.h>
#include <libsolidity/ast/AST.h>
#include <libsolidity/codegen/Compiler.h>
#include <libsolidity/codegen/CompilerUtils.h>
#include <libsolidity/interface/Version.h>
#include <libyul/AsmParser.h>
#include <libyul/AsmPrinter.h>
#include <libyul/AsmAnalysis.h>
#include <libyul/AsmAnalysisInfo.h>
#include <libyul/backends/evm/AsmCodeGen.h>
#include <libyul/backends/evm/EVMDialect.h>
#include <libyul/backends/evm/EVMMetrics.h>
#include <libyul/optimiser/Suite.h>
#include <libyul/Object.h>
#include <libyul/YulString.h>
#include <libyul/Utilities.h>
#include <libsolutil/Whiskers.h>
#include <liblangutil/ErrorReporter.h>
#include <liblangutil/Scanner.h>
#include <liblangutil/SourceReferenceFormatter.h>
#include <boost/algorithm/string/replace.hpp>
#include <utility>
#include <numeric>
// Change to "define" to output all intermediate code
#undef SOL_OUTPUT_ASM
using namespace std;
using namespace solidity;
using namespace solidity::util;
using namespace solidity::evmasm;
using namespace solidity::frontend;
using namespace solidity::langutil;
void CompilerContext::addStateVariable(
VariableDeclaration const& _declaration,
u256 const& _storageOffset,
unsigned _byteOffset
)
{
m_stateVariables[&_declaration] = make_pair(_storageOffset, _byteOffset);
}
void CompilerContext::addImmutable(VariableDeclaration const& _variable)
{
solAssert(_variable.immutable(), "Attempted to register a non-immutable variable as immutable.");
solUnimplementedAssert(_variable.annotation().type->isValueType(), "Only immutable variables of value type are supported.");
solAssert(m_runtimeContext, "Attempted to register an immutable variable for runtime code generation.");
m_immutableVariables[&_variable] = CompilerUtils::generalPurposeMemoryStart + *m_reservedMemory;
solAssert(_variable.annotation().type->memoryHeadSize() == 32, "Memory writes might overlap.");
*m_reservedMemory += _variable.annotation().type->memoryHeadSize();
}
size_t CompilerContext::immutableMemoryOffset(VariableDeclaration const& _variable) const
{
solAssert(m_immutableVariables.count(&_variable), "Memory offset of unknown immutable queried.");
solAssert(m_runtimeContext, "Attempted to fetch the memory offset of an immutable variable during runtime code generation.");
return m_immutableVariables.at(&_variable);
}
vector<string> CompilerContext::immutableVariableSlotNames(VariableDeclaration const& _variable)
{
string baseName = to_string(_variable.id());
solAssert(_variable.annotation().type->sizeOnStack() > 0, "");
if (_variable.annotation().type->sizeOnStack() == 1)
return {baseName};
vector<string> names;
auto collectSlotNames = [&](string const& _baseName, TypePointer type, auto const& _recurse) -> void {
for (auto const& [slot, type]: type->stackItems())
if (type)
_recurse(_baseName + " " + slot, type, _recurse);
else
names.emplace_back(_baseName);
};
collectSlotNames(baseName, _variable.annotation().type, collectSlotNames);
return names;
}
size_t CompilerContext::reservedMemory()
{
solAssert(m_reservedMemory.has_value(), "Reserved memory was used before ");
size_t reservedMemory = *m_reservedMemory;
m_reservedMemory = std::nullopt;
return reservedMemory;
}
void CompilerContext::startFunction(Declaration const& _function)
{
m_functionCompilationQueue.startFunction(_function);
*this << functionEntryLabel(_function);
}
void CompilerContext::callLowLevelFunction(
string const& _name,
unsigned _inArgs,
unsigned _outArgs,
function<void(CompilerContext&)> const& _generator
)
{
evmasm::AssemblyItem retTag = pushNewTag();
CompilerUtils(*this).moveIntoStack(_inArgs);
*this << lowLevelFunctionTag(_name, _inArgs, _outArgs, _generator);
appendJump(evmasm::AssemblyItem::JumpType::IntoFunction);
adjustStackOffset(static_cast<int>(_outArgs) - 1 - static_cast<int>(_inArgs));
*this << retTag.tag();
}
void CompilerContext::callYulFunction(
string const& _name,
unsigned _inArgs,
unsigned _outArgs
)
{
m_externallyUsedYulFunctions.insert(_name);
auto const retTag = pushNewTag();
CompilerUtils(*this).moveIntoStack(_inArgs);
appendJumpTo(namedTag(_name), evmasm::AssemblyItem::JumpType::IntoFunction);
adjustStackOffset(static_cast<int>(_outArgs) - 1 - static_cast<int>(_inArgs));
*this << retTag.tag();
}
evmasm::AssemblyItem CompilerContext::lowLevelFunctionTag(
string const& _name,
unsigned _inArgs,
unsigned _outArgs,
function<void(CompilerContext&)> const& _generator
)
{
auto it = m_lowLevelFunctions.find(_name);
if (it == m_lowLevelFunctions.end())
{
evmasm::AssemblyItem tag = newTag().pushTag();
m_lowLevelFunctions.insert(make_pair(_name, tag));
m_lowLevelFunctionGenerationQueue.push(make_tuple(_name, _inArgs, _outArgs, _generator));
return tag;
}
else
return it->second;
}
void CompilerContext::appendMissingLowLevelFunctions()
{
while (!m_lowLevelFunctionGenerationQueue.empty())
{
string name;
unsigned inArgs;
unsigned outArgs;
function<void(CompilerContext&)> generator;
tie(name, inArgs, outArgs, generator) = m_lowLevelFunctionGenerationQueue.front();
m_lowLevelFunctionGenerationQueue.pop();
setStackOffset(static_cast<int>(inArgs) + 1);
*this << m_lowLevelFunctions.at(name).tag();
generator(*this);
CompilerUtils(*this).moveToStackTop(outArgs);
appendJump(evmasm::AssemblyItem::JumpType::OutOfFunction);
solAssert(stackHeight() == outArgs, "Invalid stack height in low-level function " + name + ".");
}
}
void CompilerContext::appendYulUtilityFunctions(OptimiserSettings const& _optimiserSettings)
{
solAssert(!m_appendYulUtilityFunctionsRan, "requestedYulFunctions called more than once.");
m_appendYulUtilityFunctionsRan = true;
string code = m_yulFunctionCollector.requestedFunctions();
if (!code.empty())
{
appendInlineAssembly(
yul::reindent("{\n" + move(code) + "\n}"),
{},
m_externallyUsedYulFunctions,
true,
_optimiserSettings,
yulUtilityFileName()
);
solAssert(!m_generatedYulUtilityCode.empty(), "");
}
}
void CompilerContext::addVariable(
VariableDeclaration const& _declaration,
unsigned _offsetToCurrent
)
{
solAssert(m_asm->deposit() >= 0 && unsigned(m_asm->deposit()) >= _offsetToCurrent, "");
unsigned sizeOnStack = _declaration.annotation().type->sizeOnStack();
// Variables should not have stack size other than [1, 2],
// but that might change when new types are introduced.
solAssert(sizeOnStack == 1 || sizeOnStack == 2, "");
m_localVariables[&_declaration].push_back(unsigned(m_asm->deposit()) - _offsetToCurrent);
}
void CompilerContext::removeVariable(Declaration const& _declaration)
{
solAssert(m_localVariables.count(&_declaration) && !m_localVariables[&_declaration].empty(), "");
m_localVariables[&_declaration].pop_back();
if (m_localVariables[&_declaration].empty())
m_localVariables.erase(&_declaration);
}
void CompilerContext::removeVariablesAboveStackHeight(unsigned _stackHeight)
{
vector<Declaration const*> toRemove;
for (auto _var: m_localVariables)
{
solAssert(!_var.second.empty(), "");
solAssert(_var.second.back() <= stackHeight(), "");
if (_var.second.back() >= _stackHeight)
toRemove.push_back(_var.first);
}
for (auto _var: toRemove)
removeVariable(*_var);
}
unsigned CompilerContext::numberOfLocalVariables() const
{
return m_localVariables.size();
}
shared_ptr<evmasm::Assembly> CompilerContext::compiledContract(ContractDefinition const& _contract) const
{
auto ret = m_otherCompilers.find(&_contract);
solAssert(ret != m_otherCompilers.end(), "Compiled contract not found.");
return ret->second->assemblyPtr();
}
shared_ptr<evmasm::Assembly> CompilerContext::compiledContractRuntime(ContractDefinition const& _contract) const
{
auto ret = m_otherCompilers.find(&_contract);
solAssert(ret != m_otherCompilers.end(), "Compiled contract not found.");
return ret->second->runtimeAssemblyPtr();
}
bool CompilerContext::isLocalVariable(Declaration const* _declaration) const
{
return !!m_localVariables.count(_declaration);
}
evmasm::AssemblyItem CompilerContext::functionEntryLabel(Declaration const& _declaration)
{
return m_functionCompilationQueue.entryLabel(_declaration, *this);
}
evmasm::AssemblyItem CompilerContext::functionEntryLabelIfExists(Declaration const& _declaration) const
{
return m_functionCompilationQueue.entryLabelIfExists(_declaration);
}
FunctionDefinition const& CompilerContext::superFunction(FunctionDefinition const& _function, ContractDefinition const& _base)
{
solAssert(m_mostDerivedContract, "No most derived contract set.");
ContractDefinition const* super = _base.superContract(mostDerivedContract());
solAssert(super, "Super contract not available.");
return _function.resolveVirtual(mostDerivedContract(), super);
}
ContractDefinition const& CompilerContext::mostDerivedContract() const
{
solAssert(m_mostDerivedContract, "Most derived contract not set.");
return *m_mostDerivedContract;
}
Declaration const* CompilerContext::nextFunctionToCompile() const
{
return m_functionCompilationQueue.nextFunctionToCompile();
}
unsigned CompilerContext::baseStackOffsetOfVariable(Declaration const& _declaration) const
{
auto res = m_localVariables.find(&_declaration);
solAssert(res != m_localVariables.end(), "Variable not found on stack.");
solAssert(!res->second.empty(), "");
return res->second.back();
}
unsigned CompilerContext::baseToCurrentStackOffset(unsigned _baseOffset) const
{
return static_cast<unsigned>(m_asm->deposit()) - _baseOffset - 1;
}
unsigned CompilerContext::currentToBaseStackOffset(unsigned _offset) const
{
return static_cast<unsigned>(m_asm->deposit()) - _offset - 1;
}
pair<u256, unsigned> CompilerContext::storageLocationOfVariable(Declaration const& _declaration) const
{
auto it = m_stateVariables.find(&_declaration);
solAssert(it != m_stateVariables.end(), "Variable not found in storage.");
return it->second;
}
CompilerContext& CompilerContext::appendJump(evmasm::AssemblyItem::JumpType _jumpType)
{
evmasm::AssemblyItem item(Instruction::JUMP);
item.setJumpType(_jumpType);
return *this << item;
}
CompilerContext& CompilerContext::appendInvalid()
{
return *this << Instruction::INVALID;
}
CompilerContext& CompilerContext::appendConditionalInvalid()
{
*this << Instruction::ISZERO;
evmasm::AssemblyItem afterTag = appendConditionalJump();
*this << Instruction::INVALID;
*this << afterTag;
return *this;
}
CompilerContext& CompilerContext::appendRevert(string const& _message)
{
appendInlineAssembly("{ " + revertReasonIfDebug(_message) + " }");
return *this;
}
CompilerContext& CompilerContext::appendConditionalRevert(bool _forwardReturnData, string const& _message)
{
if (_forwardReturnData && m_evmVersion.supportsReturndata())
appendInlineAssembly(R"({
if condition {
returndatacopy(0, 0, returndatasize())
revert(0, returndatasize())
}
})", {"condition"});
else
appendInlineAssembly("{ if condition { " + revertReasonIfDebug(_message) + " } }", {"condition"});
*this << Instruction::POP;
return *this;
}
void CompilerContext::resetVisitedNodes(ASTNode const* _node)
{
stack<ASTNode const*> newStack;
newStack.push(_node);
std::swap(m_visitedNodes, newStack);
updateSourceLocation();
}
void CompilerContext::appendInlineAssembly(
string const& _assembly,
vector<string> const& _localVariables,
set<string> const& _externallyUsedFunctions,
bool _system,
OptimiserSettings const& _optimiserSettings,
string _sourceName
)
{
unsigned startStackHeight = stackHeight();
set<yul::YulString> externallyUsedIdentifiers;
for (auto const& fun: _externallyUsedFunctions)
externallyUsedIdentifiers.insert(yul::YulString(fun));
for (auto const& var: _localVariables)
externallyUsedIdentifiers.insert(yul::YulString(var));
yul::ExternalIdentifierAccess identifierAccess;
identifierAccess.resolve = [&](
yul::Identifier const& _identifier,
yul::IdentifierContext,
bool _insideFunction
) -> bool
{
if (_insideFunction)
return false;
return contains(_localVariables, _identifier.name.str());
};
identifierAccess.generateCode = [&](
yul::Identifier const& _identifier,
yul::IdentifierContext _context,
yul::AbstractAssembly& _assembly
)
{
auto it = std::find(_localVariables.begin(), _localVariables.end(), _identifier.name.str());
solAssert(it != _localVariables.end(), "");
auto stackDepth = static_cast<size_t>(distance(it, _localVariables.end()));
size_t stackDiff = static_cast<size_t>(_assembly.stackHeight()) - startStackHeight + stackDepth;
if (_context == yul::IdentifierContext::LValue)
stackDiff -= 1;
if (stackDiff < 1 || stackDiff > 16)
BOOST_THROW_EXCEPTION(
StackTooDeepError() <<
errinfo_sourceLocation(_identifier.location) <<
util::errinfo_comment("Stack too deep (" + to_string(stackDiff) + "), try removing local variables.")
);
if (_context == yul::IdentifierContext::RValue)
_assembly.appendInstruction(dupInstruction(stackDiff));
else
{
_assembly.appendInstruction(swapInstruction(stackDiff));
_assembly.appendInstruction(Instruction::POP);
}
};
ErrorList errors;
ErrorReporter errorReporter(errors);
auto scanner = make_shared<langutil::Scanner>(langutil::CharStream(_assembly, _sourceName));
yul::EVMDialect const& dialect = yul::EVMDialect::strictAssemblyForEVM(m_evmVersion);
optional<langutil::SourceLocation> locationOverride;
if (!_system)
locationOverride = m_asm->currentSourceLocation();
shared_ptr<yul::Block> parserResult =
yul::Parser(errorReporter, dialect, std::move(locationOverride))
.parse(scanner, false);
#ifdef SOL_OUTPUT_ASM
cout << yul::AsmPrinter(&dialect)(*parserResult) << endl;
#endif
auto reportError = [&](string const& _context)
{
string message =
"Error parsing/analyzing inline assembly block:\n" +
_context + "\n"
"------------------ Input: -----------------\n" +
_assembly + "\n"
"------------------ Errors: ----------------\n";
for (auto const& error: errorReporter.errors())
message += SourceReferenceFormatter::formatErrorInformation(*error);
message += "-------------------------------------------\n";
solAssert(false, message);
};
yul::AsmAnalysisInfo analysisInfo;
bool analyzerResult = false;
if (parserResult)
analyzerResult = yul::AsmAnalyzer(
analysisInfo,
errorReporter,
dialect,
identifierAccess.resolve
).analyze(*parserResult);
if (!parserResult || !errorReporter.errors().empty() || !analyzerResult)
reportError("Invalid assembly generated by code generator.");
// Several optimizer steps cannot handle externally supplied stack variables,
// so we essentially only optimize the ABI functions.
if (_optimiserSettings.runYulOptimiser && _localVariables.empty())
{
yul::Object obj;
obj.code = parserResult;
obj.analysisInfo = make_shared<yul::AsmAnalysisInfo>(analysisInfo);
optimizeYul(obj, dialect, _optimiserSettings, externallyUsedIdentifiers);
if (_system)
{
// Store as generated sources, but first re-parse to update the source references.
solAssert(m_generatedYulUtilityCode.empty(), "");
m_generatedYulUtilityCode = yul::AsmPrinter(dialect)(*obj.code);
string code = yul::AsmPrinter{dialect}(*obj.code);
scanner = make_shared<langutil::Scanner>(langutil::CharStream(m_generatedYulUtilityCode, _sourceName));
obj.code = yul::Parser(errorReporter, dialect).parse(scanner, false);
*obj.analysisInfo = yul::AsmAnalyzer::analyzeStrictAssertCorrect(dialect, obj);
}
analysisInfo = std::move(*obj.analysisInfo);
parserResult = std::move(obj.code);
#ifdef SOL_OUTPUT_ASM
cout << "After optimizer:" << endl;
cout << yul::AsmPrinter(&dialect)(*parserResult) << endl;
#endif
}
else if (_system)
{
// Store as generated source.
solAssert(m_generatedYulUtilityCode.empty(), "");
m_generatedYulUtilityCode = _assembly;
}
if (!errorReporter.errors().empty())
reportError("Failed to analyze inline assembly block.");
solAssert(errorReporter.errors().empty(), "Failed to analyze inline assembly block.");
yul::CodeGenerator::assemble(
*parserResult,
analysisInfo,
*m_asm,
m_evmVersion,
identifierAccess,
_system,
_optimiserSettings.optimizeStackAllocation
);
// Reset the source location to the one of the node (instead of the CODEGEN source location)
updateSourceLocation();
}
void CompilerContext::optimizeYul(yul::Object& _object, yul::EVMDialect const& _dialect, OptimiserSettings const& _optimiserSettings, std::set<yul::YulString> const& _externalIdentifiers)
{
#ifdef SOL_OUTPUT_ASM
cout << yul::AsmPrinter(*dialect)(*_object.code) << endl;
#endif
bool const isCreation = runtimeContext() != nullptr;
yul::GasMeter meter(_dialect, isCreation, _optimiserSettings.expectedExecutionsPerDeployment);
yul::OptimiserSuite::run(
_dialect,
&meter,
_object,
_optimiserSettings.optimizeStackAllocation,
_optimiserSettings.yulOptimiserSteps,
_externalIdentifiers
);
#ifdef SOL_OUTPUT_ASM
cout << "After optimizer:" << endl;
cout << yul::AsmPrinter(*dialect)(*object.code) << endl;
#endif
}
LinkerObject const& CompilerContext::assembledObject() const
{
LinkerObject const& object = m_asm->assemble();
solAssert(object.immutableReferences.empty(), "Leftover immutables.");
return object;
}
string CompilerContext::revertReasonIfDebug(string const& _message)
{
return YulUtilFunctions::revertReasonIfDebug(m_revertStrings, _message);
}
void CompilerContext::updateSourceLocation()
{
m_asm->setSourceLocation(m_visitedNodes.empty() ? SourceLocation() : m_visitedNodes.top()->location());
}
evmasm::Assembly::OptimiserSettings CompilerContext::translateOptimiserSettings(OptimiserSettings const& _settings)
{
// Constructing it this way so that we notice changes in the fields.
evmasm::Assembly::OptimiserSettings asmSettings{false, false, false, false, false, false, m_evmVersion, 0};
asmSettings.isCreation = true;
asmSettings.runJumpdestRemover = _settings.runJumpdestRemover;
asmSettings.runPeephole = _settings.runPeephole;
asmSettings.runDeduplicate = _settings.runDeduplicate;
asmSettings.runCSE = _settings.runCSE;
asmSettings.runConstantOptimiser = _settings.runConstantOptimiser;
asmSettings.expectedExecutionsPerDeployment = _settings.expectedExecutionsPerDeployment;
asmSettings.evmVersion = m_evmVersion;
return asmSettings;
}
evmasm::AssemblyItem CompilerContext::FunctionCompilationQueue::entryLabel(
Declaration const& _declaration,
CompilerContext& _context
)
{
auto res = m_entryLabels.find(&_declaration);
if (res == m_entryLabels.end())
{
evmasm::AssemblyItem tag(_context.newTag());
m_entryLabels.insert(make_pair(&_declaration, tag));
m_functionsToCompile.push(&_declaration);
return tag.tag();
}
else
return res->second.tag();
}
evmasm::AssemblyItem CompilerContext::FunctionCompilationQueue::entryLabelIfExists(Declaration const& _declaration) const
{
auto res = m_entryLabels.find(&_declaration);
return res == m_entryLabels.end() ? evmasm::AssemblyItem(evmasm::UndefinedItem) : res->second.tag();
}
Declaration const* CompilerContext::FunctionCompilationQueue::nextFunctionToCompile() const
{
while (!m_functionsToCompile.empty())
{
if (m_alreadyCompiledFunctions.count(m_functionsToCompile.front()))
m_functionsToCompile.pop();
else
return m_functionsToCompile.front();
}
return nullptr;
}
void CompilerContext::FunctionCompilationQueue::startFunction(Declaration const& _function)
{
if (!m_functionsToCompile.empty() && m_functionsToCompile.front() == &_function)
m_functionsToCompile.pop();
m_alreadyCompiledFunctions.insert(&_function);
}
| {
"pile_set_name": "Github"
} |
/*
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
* Copyright (c) 2002-2017 Eric Lafortune @ GuardSquare
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package proguard.optimize.peephole;
import proguard.classfile.*;
import proguard.classfile.attribute.CodeAttribute;
import proguard.classfile.editor.CodeAttributeEditor;
import proguard.classfile.instruction.*;
import proguard.classfile.instruction.visitor.InstructionVisitor;
import proguard.classfile.util.SimplifiedVisitor;
/**
* This InstructionVisitor replaces unconditional branches to return instructions
* by these same return instructions.
*
* @author Eric Lafortune
*/
public class GotoReturnReplacer
extends SimplifiedVisitor
implements InstructionVisitor
{
private final CodeAttributeEditor codeAttributeEditor;
private final InstructionVisitor extraInstructionVisitor;
/**
* Creates a new GotoReturnReplacer.
* @param codeAttributeEditor a code editor that can be used for
* accumulating changes to the code.
*/
public GotoReturnReplacer(CodeAttributeEditor codeAttributeEditor)
{
this(codeAttributeEditor, null);
}
/**
* Creates a new GotoReturnReplacer.
* @param codeAttributeEditor a code editor that can be used for
* accumulating changes to the code.
* @param extraInstructionVisitor an optional extra visitor for all replaced
* goto instructions.
*/
public GotoReturnReplacer(CodeAttributeEditor codeAttributeEditor,
InstructionVisitor extraInstructionVisitor)
{
this.codeAttributeEditor = codeAttributeEditor;
this.extraInstructionVisitor = extraInstructionVisitor;
}
// Implementations for InstructionVisitor.
public void visitAnyInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, Instruction instruction) {}
public void visitBranchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, BranchInstruction branchInstruction)
{
// Check if the instruction is an unconditional goto instruction.
byte opcode = branchInstruction.opcode;
if (opcode == InstructionConstants.OP_GOTO ||
opcode == InstructionConstants.OP_GOTO_W)
{
// Check if the goto instruction points to a return instruction.
int targetOffset = offset + branchInstruction.branchOffset;
if (!codeAttributeEditor.isModified(offset) &&
!codeAttributeEditor.isModified(targetOffset))
{
Instruction targetInstruction = InstructionFactory.create(codeAttribute.code,
targetOffset);
switch (targetInstruction.opcode)
{
case InstructionConstants.OP_IRETURN:
case InstructionConstants.OP_LRETURN:
case InstructionConstants.OP_FRETURN:
case InstructionConstants.OP_DRETURN:
case InstructionConstants.OP_ARETURN:
case InstructionConstants.OP_RETURN:
// Replace the goto instruction by the return instruction.
Instruction returnInstruction =
new SimpleInstruction(targetInstruction.opcode);
codeAttributeEditor.replaceInstruction(offset,
returnInstruction);
// Visit the instruction, if required.
if (extraInstructionVisitor != null)
{
extraInstructionVisitor.visitBranchInstruction(clazz, method, codeAttribute, offset, branchInstruction);
}
break;
}
}
}
}
}
| {
"pile_set_name": "Github"
} |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.nifi.remote.protocol;
import java.io.IOException;
import java.io.InputStream;
public interface CommunicationsInput {
/**
* Reads all data currently on the socket and throws it away
*
* @throws IOException if unable to consume
*/
void consume() throws IOException;
InputStream getInputStream() throws IOException;
long getBytesRead();
}
| {
"pile_set_name": "Github"
} |
//
// AZSearchViewController.swift
// AZSearchViewController
//
// Created by Antonio Zaitoun on 04/01/2017.
// Copyright © 2017 Crofis. All rights reserved.
//
import Foundation
import UIKit
public class AZSearchViewController: UIViewController{
///The search bar
fileprivate (set) open var searchBar:UISearchBar!
///Auto complete tableview
fileprivate var tableView: UITableView!
///SearchView delegate
open var delegate: AZSearchViewDelegate?
///SearchView data source
open var dataSource: AZSearchViewDataSource?
open var navigationBarClosure: ((UINavigationBar)->Void)?
///The search bar offset
internal var searchBarOffset: UIOffset{
get{
return self.searchBar.searchFieldBackgroundPositionAdjustment
}set{
self.searchBar.searchFieldBackgroundPositionAdjustment = newValue
}
}
///Computed variable to set the search bar background color
open var searchBarBackgroundColor: UIColor = AZSearchViewDefaults.searchBarColor{
didSet{
if searchBar != nil, let searchField = searchBar.value(forKey: "searchField"){
(searchField as! UITextField).backgroundColor = searchBarBackgroundColor
}
}
}
open var keyboardAppearnce: UIKeyboardAppearance = .default {
didSet{
self.searchBar.keyboardAppearance = keyboardAppearnce
}
}
///The search bar place holder text
open var searchBarPlaceHolder: String = "Search"{
didSet{
if (self.searchBar != nil){
self.searchBar.placeholder = searchBarPlaceHolder
}
}
}
///A var to change the status bar appearnce
open var statusBarStyle: UIStatusBarStyle = .default{
didSet{
setNeedsStatusBarAppearanceUpdate()
}
}
///A var to change the separator color
open var separatorColor: UIColor = UIColor.lightGray{
didSet{
self.tableView.separatorColor = separatorColor
}
}
///A var to modify the separator offset
open var separatorInset: UIEdgeInsets = UIEdgeInsets.zero{
didSet{
self.tableView.separatorInset = separatorInset
}
}
///The cell reuse identifier
private (set) open var cellIdentifier: String = AZSearchViewDefaults.reuseIdetentifer
///The cell reuse class
private (set) open var cellClass: AnyClass = UITableViewCell.self
//The preferred status bar style
override public var preferredStatusBarStyle: UIStatusBarStyle{
return self.statusBarStyle
}
///Private var to assist viewDidAppear
fileprivate var didAppear = false
//MARK: - Init
convenience init(){
//let bundle = Bundle(for: AZSearchViewController.self)
//self.init(nibName: AZSearchViewDefaults.nibName, bundle: bundle)
self.init(nibName: nil, bundle: nil)
}
convenience init(cellReuseIdentifier cellId: String,cellReuseClass: AnyClass){
self.init()
self.cellIdentifier = cellId
self.cellClass = cellReuseClass
}
required public init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
setup()
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
setup()
}
deinit {
//remove keyboard oberservers
NotificationCenter.default.removeObserver(self)
}
//MARK: - UIViewController
override public func dismiss(animated flag: Bool, completion: (() -> Void)? = nil) {
self.searchBar.resignFirstResponder()
self.delegate?.searchView(self, didDismissWithText: searchBar.text!)
super.dismiss(animated: flag, completion: completion)
}
open func show(in controller: UIViewController,animated: Bool = true,completion: (()->Void)? = nil){
let navgation = WrapperNavigationController(rootViewController: self)
navgation.dataSource = self
navgation.modalPresentationStyle = .overCurrentContext
navgation.modalTransitionStyle = .crossDissolve
navgation.modalPresentationCapturesStatusBarAppearance = true
navigationBarClosure?(navgation.navigationBar)
controller.present(navgation, animated: animated, completion: completion)
}
override public func viewDidLoad() {
super.viewDidLoad()
view.addSubview(tableView)
tableView.translatesAutoresizingMaskIntoConstraints = false
tableView.topAnchor.constraint(equalTo: view.topAnchor).isActive = true
tableView.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true
tableView.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true
tableView.rightAnchor.constraint(equalTo: view.rightAnchor).isActive = true
//update view background
self.view.backgroundColor = AZSearchViewDefaults.backgroundColor
//setup tableview
self.tableView.register(self.cellClass, forCellReuseIdentifier: self.cellIdentifier)
self.tableView.tableFooterView = UIView()
self.tableView.isHidden = true
self.tableView.delegate = self
self.tableView.dataSource = self
//setup search bar
self.searchBar.placeholder = self.searchBarPlaceHolder
if let searchField = searchBar.value(forKey: "searchField"){(searchField as! UITextField).backgroundColor = self.searchBarBackgroundColor}
self.navigationItem.titleView = self.searchBar
self.searchBar.delegate = self
//setup background tap gesture
let tap = UITapGestureRecognizer(target: self, action: #selector(AZSearchViewController.didTapBackground(sender:)))
tap.delegate = self
self.view.addGestureRecognizer(tap)
//add observers to listen to keyboard events
NotificationCenter.default.addObserver(self, selector: #selector(AZSearchViewController.keyboardWillShow(notification:)), name: UIResponder.keyboardWillShowNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(AZSearchViewController.keyboardWillHide(notification:)), name: UIResponder.keyboardWillHideNotification, object: nil)
}
override public func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
//open keyboard
self.searchBar.becomeFirstResponder()
}
fileprivate func setup(){
self.modalPresentationStyle = .overCurrentContext
self.modalTransitionStyle = .crossDissolve
self.modalPresentationCapturesStatusBarAppearance = true
self.searchBar = UISearchBar()
self.tableView = UITableView()
//if ((self.view) != nil){}
}
///reloadData - refreshes the UITableView. If the data source function `results()` contains 0 index, the table view will be hidden.
open func reloadData(){
if (self.dataSource?.results().count ?? 0) > 0 {
tableView.isHidden = false
}else{
tableView.isHidden = true
}
self.tableView.reloadData()
}
//MARK: - Selectors
@objc func didTapBackground(sender: AnyObject?){
self.dismiss(animated: true, completion: nil)
}
@objc func keyboardWillShow(notification: NSNotification) {
guard let kbSizeValue = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue else { return }
guard let kbDurationNumber = notification.userInfo?[UIResponder.keyboardAnimationDurationUserInfoKey] as? NSNumber else { return }
animateToKeyboardHeight(kbHeight: kbSizeValue.cgRectValue.height, duration: kbDurationNumber.doubleValue)
}
@objc func keyboardWillHide(notification: NSNotification) {
guard let kbDurationNumber = notification.userInfo?[UIResponder.keyboardAnimationDurationUserInfoKey] as? NSNumber else { return }
animateToKeyboardHeight(kbHeight: 0, duration: kbDurationNumber.doubleValue)
}
func animateToKeyboardHeight(kbHeight: CGFloat, duration: Double) {
tableView.contentInset = UIEdgeInsets(top: tableView.contentInset.top, left: 0, bottom: kbHeight, right: 0)
tableView.scrollIndicatorInsets = UIEdgeInsets(top: tableView.contentInset.top, left: 0, bottom: kbHeight, right: 0)
}
}
//MARK: - UIGestureRecognizerDelegate
extension AZSearchViewController: UIGestureRecognizerDelegate{
public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool {
if (touch.view?.isDescendant(of: self.tableView))!{
return false
}
return true
}
}
//MARK: - UITableViewDelegate
extension AZSearchViewController: UITableViewDelegate{
public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
self.delegate?.searchView(self, didSelectResultAt: indexPath.row, text: dataSource?.results()[indexPath.row] ?? "")
self.tableView.deselectRow(at: indexPath, animated: true)
}
public func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
return self.delegate?.searchView(self, tableView: tableView, editActionsForRowAtIndexPath: indexPath)
}
public func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return self.delegate?.searchView(self, tableView: tableView, heightForRowAt: indexPath) ?? 0
}
}
//MARK: - UITableViewDataSource
extension AZSearchViewController: UITableViewDataSource{
public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.dataSource?.results().count ?? 0
}
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
return self.dataSource?.searchView(self,tableView: tableView, cellForRowAt: indexPath) ?? UITableViewCell()
}
public func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
return self.dataSource?.searchView(self, tableView: tableView, canEditRowAt: indexPath) ?? false
}
public func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
self.dataSource?.searchView(self, tableView: tableView, commit: editingStyle, forRowAt: indexPath)
}
}
//MARK: - UISearchBarDelegate
extension AZSearchViewController: UISearchBarDelegate{
public func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) {
self.delegate?.searchView(self, didTextChangeTo: searchBar.text!, textLength: searchBar.text!.count)
}
public func searchBarSearchButtonClicked(_ searchBar: UISearchBar) {
self.delegate?.searchView(self, didSearchForText: searchBar.text!)
}
}
extension AZSearchViewController: WrapperDataSource{
func statusBar()-> UIStatusBarStyle{
return self.dataSource?.statusBarStyle() ?? .default
}
}
fileprivate protocol WrapperDataSource{
func statusBar()-> UIStatusBarStyle
}
fileprivate class WrapperNavigationController: UINavigationController{
open var dataSource: WrapperDataSource?
override var preferredStatusBarStyle: UIStatusBarStyle {
return self.dataSource?.statusBar() ?? .default
}
}
| {
"pile_set_name": "Github"
} |
fileFormatVersion: 2
guid: 298fcb875e96e4d6f9b039f9f30aad82
timeCreated: 1483998783
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
| {
"pile_set_name": "Github"
} |
/*
Copyright Rene Rivera 2015-2016
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_PREDEF_VERSION_H
#define BOOST_PREDEF_VERSION_H
#include <boost/predef/version_number.h>
#define BOOST_PREDEF_VERSION BOOST_VERSION_NUMBER(1,10,0)
#endif
| {
"pile_set_name": "Github"
} |
const isClassComponent = require('../isClassComponent');
const getDefaultExportedPath = require('../getDefaultExportedPath');
const { parseCode } = require('../../parser');
describe('isClassComponent', () => {
it('#1', () => {
const code = `
import { createElement, Component } from 'rax';
import View from 'rax-view';
import './index.css';
export default class extends Component {
render() {
return (
<View className="header">
{this.props.children}
</View>
);
}
}
`;
const defaultExportedPath = getDefaultExportedPath(parseCode(code));
expect(isClassComponent(defaultExportedPath)).toBeTruthy();
});
it('#2', () => {
const code = `
import RaxRef from 'rax';
export default class extends RaxRef.Component {}
`;
const defaultExportedPath = getDefaultExportedPath(parseCode(code));
expect(isClassComponent(defaultExportedPath)).toBeTruthy();
});
it('#3', () => {
const code = `
import React, { Component } from 'react';
export default class extends Component {}
`;
const defaultExportedPath = getDefaultExportedPath(parseCode(code));
expect(isClassComponent(defaultExportedPath)).toBeTruthy();
});
it('#4', () => {
const code = `
import React, { Component } from 'react';
export default class {}
`;
const defaultExportedPath = getDefaultExportedPath(parseCode(code));
expect(isClassComponent(defaultExportedPath)).toBeFalsy();
});
it('#5', () => {
const code = `
import Rax, { Component } from 'rax';
const foo = class extends Component {};
export default foo;
`;
const defaultExportedPath = getDefaultExportedPath(parseCode(code));
expect(isClassComponent(defaultExportedPath)).toBeTruthy();
});
it('#6', () => {
const code = `
import Rax, { Component } from 'rax';
class foo extends Component {}
export default foo;
`;
const defaultExportedPath = getDefaultExportedPath(parseCode(code));
expect(isClassComponent(defaultExportedPath)).toBeTruthy();
});
});
| {
"pile_set_name": "Github"
} |
StartChar: uni0451
Encoding: 1105 1105 383
GlifName: uni0451
Width: 1024
VWidth: 0
Flags: W
HStem: -16 120<469.07 891.106> 512 120<354 798> 920 120<452.408 699.592> 1168 224<269.423 434.577 717.423 882.577>
VStem: 224 128<232.957 512 632 808.17> 240 224<1197.42 1362.58> 688 224<1197.42 1362.58> 798 130<632 812.653>
LayerCount: 5
Back
Fore
Refer: 300 776 N 1 0 0 1 0 -128 2
Refer: 356 1077 N 1 0 0 1 0 0 3
Validated: 1
Layer: 2
Layer: 3
Layer: 4
EndChar
| {
"pile_set_name": "Github"
} |
using System.Reflection;
using System.Runtime.CompilerServices;
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("TheInterface")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TheInterface")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[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("e967deca-1c22-4f92-94de-6b82f115f45a")]
// 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 Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.