text
large_stringlengths 384
2.05k
| rank_avg
float64 1
4.19k
⌀ | rank_max
float64 1
8.21k
⌀ | rank_min
float64 1
5.03k
⌀ | rank_median
float64 1
4.21k
⌀ | rank_by_avgsim
float64 1
4.19k
⌀ | avgsim_to_github
float32 0.77
0.85
⌀ | dataset
large_stringclasses 1
value |
|---|---|---|---|---|---|---|---|
ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Grid.Column="0">
<TextBlock Foreground="Brown" TextWrapping="Wrap" FontSize="12"
Margin="10">
This example shows how to position a Popup
when the Placement property is set to "Custom"
and the PlacementTarget is the button.</TextBlock>
<Button Name="myButton" Width="200" Margin="20,20,20,20"
Click="onClick">Click to display Popup</Button>
</StackPanel>
<!--<SnippetCustomPlacement>-->
<Popup Name="popup1"
PlacementTarget ="{Binding ElementName=myButton}"
Placement="Custom">
<TextBlock Height="60" Width="200"
Background="LightGray"
TextWrapping="Wrap">Popup positioned by using
CustomPopupPlacement callback delegate</TextBlock>
</Popup>
<!--</SnippetCustomPlacement>-->
</Grid>
</Window>
/*
* JBoss, Home of Professional Open Source.
* Copyright 2019, Red Hat, Inc., and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This 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.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.as.clustering.infinispan.subsystem;
import org.infinispan.Cache;
import org.infinispan.interceptors.AsyncInterceptor;
import org.jboss.as.clustering.controller.FunctionExecutorRegistry;
/**
* Executor for metrics based on a cache interceptor.
* @author Paul Ferraro
*/
public class CacheInterceptorOperationExecutor<I extends AsyncInterceptor> extends CacheOperationExecutor<I> {
private final Class<I> interceptorClass;
public CacheInterceptorOperationExecutor(FunctionExecutorRegistry<Cache<?, ?>> executors, Class<I> interceptorClass) {
super(executors);
this.interceptorClass = interceptorClass;
}
@Override
public I apply(Cache<?, ?> cache) {
return cache.getAdvancedCache().getAsyncInterceptorChain().findInterceptorExtending(this.interceptorClass);
}
}
// SGI's rope class implementation -*- C++ -*-
// Copyright (C) 2001-2016 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively.
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
If not, see
// <http://www.gnu.org/licenses/>.
/*
* Copyright (c) 1997
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*/
/** @file ropeimpl.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{ext/rope}
*/
#include <cstdio>
#include <ostream>
#include <bits/functexcept.h>
#include <ext/algorithm> // For copy_n and lexicographical_compare_3way
#include <ext/memory> // For uninitialized_copy_n
#include <ext/numeric> // For power
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
using std::size_t;
using std::printf;
using std::basic_ostream;
using std::__throw_length_error;
using std::_Destroy;
using std::__uninitialized_fill_n_a;
// Set buf_start, buf_end, and buf_ptr appropriately, filling tmp_buf
// if necessary. Assumes _M_path_end[leaf_index] and leaf_pos are correct.
// Results in a valid buf_ptr if the iterator can be legitimately
// dereferenced.
template <class _CharT, class _Alloc>
void
_Rope_iterator_base<_CharT, _Alloc>::
_S_setbuf(_Rope_iterator_base<_CharT, _Alloc>& __x)
{
const _RopeRep* __leaf = __x._M_path_end[__x._M_leaf_index];
size_t __leaf_pos = __x._M_leaf_pos;
size_t __pos = __x._M_current_pos;
switch(__leaf->_M_tag)
{
case __detail::_S_leaf:
__x._M_buf_start = ((_Rope_RopeLeaf<_CharT, _Alloc>*)__leaf)->_M_data;
__x._M_buf_ptr = __x._M_buf_start + (__pos - __leaf_pos);
__x._M_buf_end = __x._M_buf_start + __leaf->_M_size;
break;
case _
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
_detail::_S_function:
case __detail::_S_substringfn:
{
size_t __len = _S_iterator_buf_len;
size_t __buf_start_pos = __leaf_pos;
size_t __leaf_end = __leaf_pos + __leaf->_M_size;
char_producer<_CharT>* __fn = ((_Rope_RopeFunction<_CharT,
_Alloc>*)__leaf)->_M_fn;
if (__buf_start_pos + __len <= __pos)
{
__buf_start_pos = __pos - __len / 4;
if (__buf_start_pos + __len > __leaf_end)
__buf_start_pos = __leaf_end - __len;
}
if (__buf_start_pos + __len > __leaf_end)
__len = __leaf_end - __buf_start_pos;
(*__fn)(__buf_start_pos - __leaf_pos, __len, __x._M_tmp_buf);
__x._M_buf_ptr = __x._M_tmp_buf + (__pos - __buf_start_pos);
__x._M_buf_start = __x._M_tmp_buf;
__x._M_buf_end = __x._M_tmp_buf + __len;
}
break;
default:
break;
}
}
// Set path and buffer inside a rope iterator. We assume that
// pos and root are already set.
template <class _CharT, class _Alloc>
void
_Rope_iterator_base<_CharT, _Alloc>::
_S_setcache(_Rope_iterator_base<_CharT, _Alloc>& __x)
{
const _RopeRep* __path[int(__detail::_S_max_rope_depth) + 1];
const _RopeRep* __curr_rope;
int __curr_depth = -1; /* index into path */
size_t __curr_start_pos = 0;
size_t __pos = __x._M_current_pos;
unsigned char __dirns = 0; // Bit vector marking right turns in the path
if (__pos >= __x._M_root->_M_size)
{
__x._M_buf_ptr = 0;
return;
}
__curr_rope = __x._M_root;
if (0 != __curr_rope->_M_c_string)
{
/* Treat the root as a leaf. */
__x._M_buf_start = __curr_rope->_M_c_string;
__x._M_buf_end = __curr_rope->_M_c_string + __curr_rope->_M_size;
__x._M_buf_ptr = __curr_rope->_M_c_string + __pos;
__x._M_path_end[0] = __curr_rope;
__x._M_leaf_index = 0;
__x._M_leaf_pos = 0;
return;
}
for(;;)
{
++__curr_depth;
__path[__curr_depth] = __curr_rope;
switch(__curr_rope->_M_tag)
{
case __detail::_S_leaf:
case __detail::_S_function:
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
case __detail::_S_substringfn:
__x._M_leaf_pos = __curr_start_pos;
goto done;
case __detail::_S_concat:
{
_Rope_RopeConcatenation<_CharT, _Alloc>* __c =
(_Rope_RopeConcatenation<_CharT, _Alloc>*)__curr_rope;
_RopeRep* __left = __c->_M_left;
size_t __left_len = __left->_M_size;
__dirns <<= 1;
if (__pos >= __curr_start_pos + __left_len)
{
__dirns |= 1;
__curr_rope = __c->_M_right;
__curr_start_pos += __left_len;
}
else
__curr_rope = __left;
}
break;
}
}
done:
// Copy last section of path into _M_path_end.
{
int __i = -1;
int __j = __curr_depth + 1 - int(_S_path_cache_len);
if (__j < 0) __j = 0;
while (__j <= __curr_depth)
__x._M_path_end[++__i] = __path[__j++];
__x._M_leaf_index = __i;
}
__x._M_path_directions = __dirns;
_S_setbuf(__x);
}
// Specialized version of the above. Assumes that
// the path cache is valid for the previous position.
template <class _CharT, class _Alloc>
void
_Rope_iterator_base<_CharT, _Alloc>::
_S_setcache_for_incr(_Rope_iterator_base<_CharT, _Alloc>& __x)
{
int __current_index = __x._M_leaf_index;
const _RopeRep* __current_node = __x._M_path_end[__current_index];
size_t __len = __current_node->_M_size;
size_t __node_start_pos = __x._M_leaf_pos;
unsigned char __dirns = __x._M_path_directions;
_Rope_RopeConcatenation<_CharT, _Alloc>* __c;
if (__x._M_current_pos - __node_start_pos < __len)
{
/* More stuff in this leaf, we just didn't cache it. */
_S_setbuf(__x);
return;
}
// node_start_pos is starting position of last_node.
while (--__current_index >= 0)
{
if (!(__dirns & 1) /* Path turned left */)
break;
__current_node = __x._M_path_end[__current_index];
__c = (_Rope_RopeConcatenation<_CharT, _Alloc>*)__current_node;
// Otherwise we were in the right child. Thus we should pop
// the concatenation node.
__node_start_pos -= __c->_M_left->
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
_M_size;
__dirns >>= 1;
}
if (__current_index < 0)
{
// We underflowed the cache. Punt.
_S_setcache(__x);
return;
}
__current_node = __x._M_path_end[__current_index];
__c = (_Rope_RopeConcatenation<_CharT, _Alloc>*)__current_node;
// current_node is a concatenation node. We are positioned on the first
// character in its right child.
// node_start_pos is starting position of current_node.
__node_start_pos += __c->_M_left->_M_size;
__current_node = __c->_M_right;
__x._M_path_end[++__current_index] = __current_node;
__dirns |= 1;
while (__detail::_S_concat == __current_node->_M_tag)
{
++__current_index;
if (int(_S_path_cache_len) == __current_index)
{
int __i;
for (__i = 0; __i < int(_S_path_cache_len) - 1; __i++)
__x._M_path_end[__i] = __x._M_path_end[__i+1];
--__current_index;
}
__current_node =
((_Rope_RopeConcatenation<_CharT, _Alloc>*)__current_node)->_M_left;
__x._M_path_end[__current_index] = __current_node;
__dirns <<= 1;
// node_start_pos is unchanged.
}
__x._M_leaf_index = __current_index;
__x._M_leaf_pos = __node_start_pos;
__x._M_path_directions = __dirns;
_S_setbuf(__x);
}
template <class _CharT, class _Alloc>
void
_Rope_iterator_base<_CharT, _Alloc>::
_M_incr(size_t __n)
{
_M_current_pos += __n;
if (0 != _M_buf_ptr)
{
size_t __chars_left = _M_buf_end - _M_buf_ptr;
if (__chars_left > __n)
_M_buf_ptr += __n;
else if (__chars_left == __n)
{
_M_buf_ptr += __n;
_S_setcache_for_incr(*this);
}
else
_M_buf_ptr = 0;
}
}
template <class _CharT, class _Alloc>
void
_Rope_iterator_base<_CharT, _Alloc>::
_M_decr(size_t __n)
{
if (0 != _M_buf_ptr)
{
size_t __chars_left = _M_buf_ptr - _M_buf_start;
if (__chars_left >= __n)
_M_buf_ptr -= __n;
else
_M_buf_ptr = 0;
}
_M_current_pos -= __n;
}
template <class _CharT,
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
class _Alloc>
void
_Rope_iterator<_CharT, _Alloc>::
_M_check()
{
if (_M_root_rope->_M_tree_ptr != this->_M_root)
{
// _Rope was modified. Get things fixed up.
_RopeRep::_S_unref(this->_M_root);
this->_M_root = _M_root_rope->_M_tree_ptr;
_RopeRep::_S_ref(this->_M_root);
this->_M_buf_ptr = 0;
}
}
template <class _CharT, class _Alloc>
inline
_Rope_const_iterator<_CharT, _Alloc>::
_Rope_const_iterator(const _Rope_iterator<_CharT, _Alloc>& __x)
: _Rope_iterator_base<_CharT, _Alloc>(__x)
{ }
template <class _CharT, class _Alloc>
inline
_Rope_iterator<_CharT, _Alloc>::
_Rope_iterator(rope<_CharT, _Alloc>& __r, size_t __pos)
: _Rope_iterator_base<_CharT,_Alloc>(__r._M_tree_ptr, __pos),
_M_root_rope(&__r)
{ _RopeRep::_S_ref(this->_M_root); }
template <class _CharT, class _Alloc>
inline size_t
rope<_CharT, _Alloc>::
_S_char_ptr_len(const _CharT* __s)
{
const _CharT* __p = __s;
while (!_S_is0(*__p))
++__p;
return (__p - __s);
}
#ifndef __GC
template <class _CharT, class _Alloc>
inline void
_Rope_RopeRep<_CharT, _Alloc>::
_M_free_c_string()
{
_CharT* __cstr = _M_c_string;
if (0 != __cstr)
{
size_t __size = this->_M_size + 1;
_Destroy(__cstr, __cstr + __size, _M_get_allocator());
this->_Data_deallocate(__cstr, __size);
}
}
template <class _CharT, class _Alloc>
inline void
_Rope_RopeRep<_CharT, _Alloc>::
_S_free_string(_CharT* __s, size_t __n, allocator_type& __a)
{
if (!_S_is_basic_char_type((_CharT*)0))
_Destroy(__s, __s + __n, __a);
// This has to be a static member, so this gets a bit messy
__a.deallocate(__s,
_Rope_RopeLeaf<_CharT, _Alloc>::_S_rounded_up_size(__n));
}
// There are several reasons for not doing this with virtual destructors
// and a class specific delete operator:
// - A class specific delete operator can't easily get access to
// allocator insta
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
nces if we need them.
// - Any virtual function would need a 4 or byte vtable pointer;
// this only requires a one byte tag per object.
template <class _CharT, class _Alloc>
void
_Rope_RopeRep<_CharT, _Alloc>::
_M_free_tree()
{
switch(_M_tag)
{
case __detail::_S_leaf:
{
_Rope_RopeLeaf<_CharT, _Alloc>* __l
= (_Rope_RopeLeaf<_CharT, _Alloc>*)this;
__l->_Rope_RopeLeaf<_CharT, _Alloc>::~_Rope_RopeLeaf();
this->_L_deallocate(__l, 1);
break;
}
case __detail::_S_concat:
{
_Rope_RopeConcatenation<_CharT,_Alloc>* __c
= (_Rope_RopeConcatenation<_CharT, _Alloc>*)this;
__c->_Rope_RopeConcatenation<_CharT, _Alloc>::
~_Rope_RopeConcatenation();
this->_C_deallocate(__c, 1);
break;
}
case __detail::_S_function:
{
_Rope_RopeFunction<_CharT, _Alloc>* __f
= (_Rope_RopeFunction<_CharT, _Alloc>*)this;
__f->_Rope_RopeFunction<_CharT, _Alloc>::~_Rope_RopeFunction();
this->_F_deallocate(__f, 1);
break;
}
case __detail::_S_substringfn:
{
_Rope_RopeSubstring<_CharT, _Alloc>* __ss =
(_Rope_RopeSubstring<_CharT, _Alloc>*)this;
__ss->_Rope_RopeSubstring<_CharT, _Alloc>::
~_Rope_RopeSubstring();
this->_S_deallocate(__ss, 1);
break;
}
}
}
#else
template <class _CharT, class _Alloc>
inline void
_Rope_RopeRep<_CharT, _Alloc>::
_S_free_string(const _CharT*, size_t, allocator_type)
{ }
#endif
// Concatenate a C string onto a leaf rope by copying the rope data.
// Used for short ropes.
template <class _CharT, class _Alloc>
typename rope<_CharT, _Alloc>::_RopeLeaf*
rope<_CharT, _Alloc>::
_S_leaf_concat_char_iter(_RopeLeaf* __r, const _CharT* __iter, size_t __len)
{
size_t __old_len = __r->_M_size;
_CharT* __new_data = (_CharT*)
rope::_Data_allocate(_S_rounded_up_size(__old_len + __len));
_RopeLeaf* __result;
uninitialized_copy_n(__r->_M_data, __old_len, __new_data);
uninitialized_copy_n(__it
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
er, __len, __new_data + __old_len);
_S_cond_store_eos(__new_data[__old_len + __len]);
__try
{
__result = _S_new_RopeLeaf(__new_data, __old_len + __len,
__r->_M_get_allocator());
}
__catch(...)
{
_RopeRep::__STL_FREE_STRING(__new_data, __old_len + __len,
__r->_M_get_allocator());
__throw_exception_again;
}
return __result;
}
#ifndef __GC
// As above, but it's OK to clobber original if refcount is 1
template <class _CharT, class _Alloc>
typename rope<_CharT,_Alloc>::_RopeLeaf*
rope<_CharT, _Alloc>::
_S_destr_leaf_concat_char_iter(_RopeLeaf* __r, const _CharT* __iter,
size_t __len)
{
if (__r->_M_ref_count > 1)
return _S_leaf_concat_char_iter(__r, __iter, __len);
size_t __old_len = __r->_M_size;
if (_S_allocated_capacity(__old_len) >= __old_len + __len)
{
// The space has been partially initialized for the standard
// character types. But that doesn't matter for those types.
uninitialized_copy_n(__iter, __len, __r->_M_data + __old_len);
if (_S_is_basic_char_type((_CharT*)0))
_S_cond_store_eos(__r->_M_data[__old_len + __len]);
else if (__r->_M_c_string != __r->_M_data && 0 != __r->_M_c_string)
{
__r->_M_free_c_string();
__r->_M_c_string = 0;
}
__r->_M_size = __old_len + __len;
__r->_M_ref_count = 2;
return __r;
}
else
{
_RopeLeaf* __result = _S_leaf_concat_char_iter(__r, __iter, __len);
return __result;
}
}
#endif
// Assumes left and right are not 0.
// Does not increment (nor decrement on exception) child reference counts.
// Result has ref count 1.
template <class _CharT, class _Alloc>
typename rope<_CharT, _Alloc>::_RopeRep*
rope<_CharT, _Alloc>::
_S_tree_concat(_RopeRep* __left, _RopeRep* __right)
{
_RopeConcatenation* __result = _S_new_RopeConcatenation(__left, __right,
__left->
_M_get_allocator());
size_t __depth = __result->_M_depth;
if (__depth > 20
&& (_
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
_result->_M_size < 1000
|| __depth > size_t(__detail::_S_max_rope_depth)))
{
_RopeRep* __balanced;
__try
{
__balanced = _S_balance(__result);
__result->_M_unref_nonnil();
}
__catch(...)
{
rope::_C_deallocate(__result,1);
__throw_exception_again;
}
// In case of exception, we need to deallocate
// otherwise dangling result node. But caller
// still owns its children. Thus unref is
// inappropriate.
return __balanced;
}
else
return __result;
}
template <class _CharT, class _Alloc>
typename rope<_CharT, _Alloc>::_RopeRep*
rope<_CharT, _Alloc>::
_S_concat_char_iter(_RopeRep* __r, const _CharT*__s, size_t __slen)
{
_RopeRep* __result;
if (0 == __slen)
{
_S_ref(__r);
return __r;
}
if (0 == __r)
return __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen,
__r->_M_get_allocator());
if (__r->_M_tag == __detail::_S_leaf
&& __r->_M_size + __slen <= size_t(_S_copy_max))
{
__result = _S_leaf_concat_char_iter((_RopeLeaf*)__r, __s, __slen);
return __result;
}
if (__detail::_S_concat == __r->_M_tag
&& __detail::_S_leaf == ((_RopeConcatenation*) __r)->_M_right->_M_tag)
{
_RopeLeaf* __right =
(_RopeLeaf* )(((_RopeConcatenation* )__r)->_M_right);
if (__right->_M_size + __slen <= size_t(_S_copy_max))
{
_RopeRep* __left = ((_RopeConcatenation*)__r)->_M_left;
_RopeRep* __nright =
_S_leaf_concat_char_iter((_RopeLeaf*)__right, __s, __slen);
__left->_M_ref_nonnil();
__try
{ __result = _S_tree_concat(__left, __nright); }
__catch(...)
{
_S_unref(__left);
_S_unref(__nright);
__throw_exception_again;
}
return __result;
}
}
_RopeRep* __nright =
__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen, __r->_M_get_allocator());
__try
{
__r->_M_ref_nonnil();
__result = _S_tree_concat(__r, __nright);
}
__catch(...)
{
_S_unref(__r);
_S_unref(__nright);
__throw_exception_again;
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
}
return __result;
}
#ifndef __GC
template <class _CharT, class _Alloc>
typename rope<_CharT,_Alloc>::_RopeRep*
rope<_CharT,_Alloc>::
_S_destr_concat_char_iter(_RopeRep* __r, const _CharT* __s, size_t __slen)
{
_RopeRep* __result;
if (0 == __r)
return __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen,
__r->_M_get_allocator());
size_t __count = __r->_M_ref_count;
size_t __orig_size = __r->_M_size;
if (__count > 1)
return _S_concat_char_iter(__r, __s, __slen);
if (0 == __slen)
{
__r->_M_ref_count = 2; // One more than before
return __r;
}
if (__orig_size + __slen <= size_t(_S_copy_max)
&& __detail::_S_leaf == __r->_M_tag)
{
__result = _S_destr_leaf_concat_char_iter((_RopeLeaf*)__r, __s,
__slen);
return __result;
}
if (__detail::_S_concat == __r->_M_tag)
{
_RopeLeaf* __right = (_RopeLeaf*)(((_RopeConcatenation*)
__r)->_M_right);
if (__detail::_S_leaf == __right->_M_tag
&& __right->_M_size + __slen <= size_t(_S_copy_max))
{
_RopeRep* __new_right =
_S_destr_leaf_concat_char_iter(__right, __s, __slen);
if (__right == __new_right)
__new_right->_M_ref_count = 1;
else
__right->_M_unref_nonnil();
__r->_M_ref_count = 2; // One more than before.
((_RopeConcatenation*)__r)->_M_right = __new_right;
__r->_M_size = __orig_size + __slen;
if (0 != __r->_M_c_string)
{
__r->_M_free_c_string();
__r->_M_c_string = 0;
}
return __r;
}
}
_RopeRep* __right =
__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen, __r->_M_get_allocator());
__r->_M_ref_nonnil();
__try
{ __result = _S_tree_concat(__r, __right); }
__catch(...)
{
_S_unref(__r);
_S_unref(__right);
__throw_exception_again;
}
return __result;
}
#endif /* !__GC */
template <class _CharT, class _Alloc>
typename rope<_CharT, _Alloc>::_RopeRep*
rope<_CharT, _Alloc>::
_S_concat(_RopeRep* __left, _RopeRep* _
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
_right)
{
if (0 == __left)
{
_S_ref(__right);
return __right;
}
if (0 == __right)
{
__left->_M_ref_nonnil();
return __left;
}
if (__detail::_S_leaf == __right->_M_tag)
{
if (__detail::_S_leaf == __left->_M_tag)
{
if (__right->_M_size + __left->_M_size <= size_t(_S_copy_max))
return _S_leaf_concat_char_iter((_RopeLeaf*)__left,
((_RopeLeaf*)__right)->_M_data,
__right->_M_size);
}
else if (__detail::_S_concat == __left->_M_tag
&& __detail::_S_leaf == ((_RopeConcatenation*)
__left)->_M_right->_M_tag)
{
_RopeLeaf* __leftright =
(_RopeLeaf*)(((_RopeConcatenation*)__left)->_M_right);
if (__leftright->_M_size
+ __right->_M_size <= size_t(_S_copy_max))
{
_RopeRep* __leftleft = ((_RopeConcatenation*)__left)->_M_left;
_RopeRep* __rest = _S_leaf_concat_char_iter(__leftright,
((_RopeLeaf*)
__right)->
_M_data,
__right->_M_size);
__leftleft->_M_ref_nonnil();
__try
{ return(_S_tree_concat(__leftleft, __rest)); }
__catch(...)
{
_S_unref(__leftleft);
_S_unref(__rest);
__throw_exception_again;
}
}
}
}
__left->_M_ref_nonnil();
__right->_M_ref_nonnil();
__try
{ return(_S_tree_concat(__left, __right)); }
__catch(...)
{
_S_unref(__left);
_S_unref(__right);
__throw_exception_again;
}
}
template <class _CharT, class _Alloc>
typename rope<_CharT, _Alloc>::_RopeRep*
rope<_CharT, _Alloc>::
_S_substring(_RopeRep* __base, size_t __start, size_t __endp1)
{
if (0 == __base)
return 0;
size_t __len = __base->_M_size;
size_t __adj_endp1;
const size_t __lazy_threshold = 128;
if (__endp1 >= __len)
{
if (0 == __start)
{
__base->_M_ref_nonnil();
return __base;
}
else
__adj_endp1 = __len;
}
else
__adj_endp1 = __endp1;
switch(__base->_M_tag)
{
case __detail::_S_conca
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
t:
{
_RopeConcatenation* __c = (_RopeConcatenation*)__base;
_RopeRep* __left = __c->_M_left;
_RopeRep* __right = __c->_M_right;
size_t __left_len = __left->_M_size;
_RopeRep* __result;
if (__adj_endp1 <= __left_len)
return _S_substring(__left, __start, __endp1);
else if (__start >= __left_len)
return _S_substring(__right, __start - __left_len,
__adj_endp1 - __left_len);
_Self_destruct_ptr __left_result(_S_substring(__left,
__start,
__left_len));
_Self_destruct_ptr __right_result(_S_substring(__right, 0,
__endp1
- __left_len));
__result = _S_concat(__left_result, __right_result);
return __result;
}
case __detail::_S_leaf:
{
_RopeLeaf* __l = (_RopeLeaf*)__base;
_RopeLeaf* __result;
size_t __result_len;
if (__start >= __adj_endp1)
return 0;
__result_len = __adj_endp1 - __start;
if (__result_len > __lazy_threshold)
goto lazy;
#ifdef __GC
const _CharT* __section = __l->_M_data + __start;
__result = _S_new_RopeLeaf(__section, __result_len,
__base->_M_get_allocator());
__result->_M_c_string = 0; // Not eos terminated.
#else
// We should sometimes create substring node instead.
__result = __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__l->_M_data + __start,
__result_len,
__base->
_M_get_allocator());
#endif
return __result;
}
case __detail::_S_substringfn:
// Avoid introducing multiple layers of substring nodes.
{
_RopeSubstring* __old = (_RopeSubstring*)__base;
size_t __result_len;
if (__start >= __adj_endp1)
return 0;
__result_len = __adj_endp1 - __start;
if (__result_len > __lazy_threshold)
{
_RopeSubstring* __result =
_S_new_RopeSubstring(__old->_M_base,
__start + __old->_M_start,
__adj_endp1 - __start,
__base->_M_get_allocator());
return __result;
} // *** else fall thro
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
ugh: ***
}
case __detail::_S_function:
{
_RopeFunction* __f = (_RopeFunction*)__base;
_CharT* __section;
size_t __result_len;
if (__start >= __adj_endp1)
return 0;
__result_len = __adj_endp1 - __start;
if (__result_len > __lazy_threshold)
goto lazy;
__section = (_CharT*)
rope::_Data_allocate(_S_rounded_up_size(__result_len));
__try
{ (*(__f->_M_fn))(__start, __result_len, __section); }
__catch(...)
{
_RopeRep::__STL_FREE_STRING(__section, __result_len,
__base->_M_get_allocator());
__throw_exception_again;
}
_S_cond_store_eos(__section[__result_len]);
return _S_new_RopeLeaf(__section, __result_len,
__base->_M_get_allocator());
}
}
lazy:
{
// Create substring node.
return _S_new_RopeSubstring(__base, __start, __adj_endp1 - __start,
__base->_M_get_allocator());
}
}
template<class _CharT>
class _Rope_flatten_char_consumer
: public _Rope_char_consumer<_CharT>
{
private:
_CharT* _M_buf_ptr;
public:
_Rope_flatten_char_consumer(_CharT* __buffer)
{ _M_buf_ptr = __buffer; };
~_Rope_flatten_char_consumer() {}
bool
operator()(const _CharT* __leaf, size_t __n)
{
uninitialized_copy_n(__leaf, __n, _M_buf_ptr);
_M_buf_ptr += __n;
return true;
}
};
template<class _CharT>
class _Rope_find_char_char_consumer
: public _Rope_char_consumer<_CharT>
{
private:
_CharT _M_pattern;
public:
size_t _M_count; // Number of nonmatching characters
_Rope_find_char_char_consumer(_CharT __p)
: _M_pattern(__p), _M_count(0) {}
~_Rope_find_char_char_consumer() {}
bool
operator()(const _CharT* __leaf, size_t __n)
{
size_t __i;
for (__i = 0; __i < __n; __i++)
{
if (__leaf[__i] == _M_pattern)
{
_M_count += __i;
return false;
}
}
_M_count += __n; return true;
}
};
template
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
<class _CharT, class _Traits>
// Here _CharT is both the stream and rope character type.
class _Rope_insert_char_consumer
: public _Rope_char_consumer<_CharT>
{
private:
typedef basic_ostream<_CharT,_Traits> _Insert_ostream;
_Insert_ostream& _M_o;
public:
_Rope_insert_char_consumer(_Insert_ostream& __writer)
: _M_o(__writer) {};
~_Rope_insert_char_consumer() { };
// Caller is presumed to own the ostream
bool operator() (const _CharT* __leaf, size_t __n);
// Returns true to continue traversal.
};
template<class _CharT, class _Traits>
bool
_Rope_insert_char_consumer<_CharT, _Traits>::
operator()(const _CharT* __leaf, size_t __n)
{
size_t __i;
// We assume that formatting is set up correctly for each element.
for (__i = 0; __i < __n; __i++)
_M_o.put(__leaf[__i]);
return true;
}
template <class _CharT, class _Alloc>
bool
rope<_CharT, _Alloc>::
_S_apply_to_pieces(_Rope_char_consumer<_CharT>& __c,
const _RopeRep* __r, size_t __begin, size_t __end)
{
if (0 == __r)
return true;
switch(__r->_M_tag)
{
case __detail::_S_concat:
{
_RopeConcatenation* __conc = (_RopeConcatenation*)__r;
_RopeRep* __left = __conc->_M_left;
size_t __left_len = __left->_M_size;
if (__begin < __left_len)
{
size_t __left_end = std::min(__left_len, __end);
if (!_S_apply_to_pieces(__c, __left, __begin, __left_end))
return false;
}
if (__end > __left_len)
{
_RopeRep* __right = __conc->_M_right;
size_t __right_start = std::max(__left_len, __begin);
if (!_S_apply_to_pieces(__c, __right,
__right_start - __left_len,
__end - __left_len))
return false;
}
}
return true;
case __detail::_S_leaf:
{
_RopeLeaf* __l = (_RopeLeaf*)__r;
return __c(__l->_M_data + __begin, __end - __begin);
}
case __detail::_S_function:
case __detail::_S_substringfn:
{
_RopeFunction* __f = (_RopeFunction*)
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
__r;
size_t __len = __end - __begin;
bool __result;
_CharT* __buffer =
(_CharT*)_Alloc().allocate(__len * sizeof(_CharT));
__try
{
(*(__f->_M_fn))(__begin, __len, __buffer);
__result = __c(__buffer, __len);
_Alloc().deallocate(__buffer, __len * sizeof(_CharT));
}
__catch(...)
{
_Alloc().deallocate(__buffer, __len * sizeof(_CharT));
__throw_exception_again;
}
return __result;
}
default:
return false;
}
}
template<class _CharT, class _Traits>
inline void
_Rope_fill(basic_ostream<_CharT, _Traits>& __o, size_t __n)
{
char __f = __o.fill();
size_t __i;
for (__i = 0; __i < __n; __i++)
__o.put(__f);
}
template <class _CharT>
inline bool
_Rope_is_simple(_CharT*)
{ return false; }
inline bool
_Rope_is_simple(char*)
{ return true; }
inline bool
_Rope_is_simple(wchar_t*)
{ return true; }
template<class _CharT, class _Traits, class _Alloc>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __o,
const rope<_CharT, _Alloc>& __r)
{
size_t __w = __o.width();
bool __left = bool(__o.flags() & std::ios::left);
size_t __pad_len;
size_t __rope_len = __r.size();
_Rope_insert_char_consumer<_CharT, _Traits> __c(__o);
bool __is_simple = _Rope_is_simple((_CharT*)0);
if (__rope_len < __w)
__pad_len = __w - __rope_len;
else
__pad_len = 0;
if (!__is_simple)
__o.width(__w / __rope_len);
__try
{
if (__is_simple && !__left && __pad_len > 0)
_Rope_fill(__o, __pad_len);
__r.apply_to_pieces(0, __r.size(), __c);
if (__is_simple && __left && __pad_len > 0)
_Rope_fill(__o, __pad_len);
if (!__is_simple)
__o.width(__w);
}
__catch(...)
{
if (!__is_simple)
__o.width(__w);
__throw_exception_again;
}
return __o;
}
template <class _CharT, class _Alloc>
_CharT*
rope<_CharT, _Alloc>::
_
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
S_flatten(_RopeRep* __r, size_t __start, size_t __len,
_CharT* __buffer)
{
_Rope_flatten_char_consumer<_CharT> __c(__buffer);
_S_apply_to_pieces(__c, __r, __start, __start + __len);
return(__buffer + __len);
}
template <class _CharT, class _Alloc>
size_t
rope<_CharT, _Alloc>::
find(_CharT __pattern, size_t __start) const
{
_Rope_find_char_char_consumer<_CharT> __c(__pattern);
_S_apply_to_pieces(__c, this->_M_tree_ptr, __start, size());
size_type __result_pos = __start + __c._M_count;
#ifndef __STL_OLD_ROPE_SEMANTICS
if (__result_pos == size())
__result_pos = npos;
#endif
return __result_pos;
}
template <class _CharT, class _Alloc>
_CharT*
rope<_CharT, _Alloc>::
_S_flatten(_RopeRep* __r, _CharT* __buffer)
{
if (0 == __r)
return __buffer;
switch(__r->_M_tag)
{
case __detail::_S_concat:
{
_RopeConcatenation* __c = (_RopeConcatenation*)__r;
_RopeRep* __left = __c->_M_left;
_RopeRep* __right = __c->_M_right;
_CharT* __rest = _S_flatten(__left, __buffer);
return _S_flatten(__right, __rest);
}
case __detail::_S_leaf:
{
_RopeLeaf* __l = (_RopeLeaf*)__r;
return copy_n(__l->_M_data, __l->_M_size, __buffer).second;
}
case __detail::_S_function:
case __detail::_S_substringfn:
// We don't yet do anything with substring nodes.
// This needs to be fixed before ropefiles will work well.
{
_RopeFunction* __f = (_RopeFunction*)__r;
(*(__f->_M_fn))(0, __f->_M_size, __buffer);
return __buffer + __f->_M_size;
}
default:
return 0;
}
}
// This needs work for _CharT != char
template <class _CharT, class _Alloc>
void
rope<_CharT, _Alloc>::
_S_dump(_RopeRep* __r, int __indent)
{
for (int __i = 0; __i < __indent; __i++)
putchar(' ');
if (0 == __r)
{
printf("NULL\n");
return;
}
if (_S_concat == __r->_M_tag)
{
_RopeConcatenation* __c = (_RopeConcatenation*)__r;
_RopeRep* __left = __c
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
->_M_left;
_RopeRep* __right = __c->_M_right;
#ifdef __GC
printf("Concatenation %p (depth = %d, len = %ld, %s balanced)\n",
__r, __r->_M_depth, __r->_M_size,
__r->_M_is_balanced? "" : "not");
#else
printf("Concatenation %p (rc = %ld, depth = %d, "
"len = %ld, %s balanced)\n",
__r, __r->_M_ref_count, __r->_M_depth, __r->_M_size,
__r->_M_is_balanced? "" : "not");
#endif
_S_dump(__left, __indent + 2);
_S_dump(__right, __indent + 2);
return;
}
else
{
char* __kind;
switch (__r->_M_tag)
{
case __detail::_S_leaf:
__kind = "Leaf";
break;
case __detail::_S_function:
__kind = "Function";
break;
case __detail::_S_substringfn:
__kind = "Function representing substring";
break;
default:
__kind = "(corrupted kind field!)";
}
#ifdef __GC
printf("%s %p (depth = %d, len = %ld) ",
__kind, __r, __r->_M_depth, __r->_M_size);
#else
printf("%s %p (rc = %ld, depth = %d, len = %ld) ",
__kind, __r, __r->_M_ref_count, __r->_M_depth, __r->_M_size);
#endif
if (_S_is_one_byte_char_type((_CharT*)0))
{
const int __max_len = 40;
_Self_destruct_ptr __prefix(_S_substring(__r, 0, __max_len));
_CharT __buffer[__max_len + 1];
bool __too_big = __r->_M_size > __prefix->_M_size;
_S_flatten(__prefix, __buffer);
__buffer[__prefix->_M_size] = _S_eos((_CharT*)0);
printf("%s%s\n", (char*)__buffer,
__too_big? "...\n" : "\n");
}
else
printf("\n");
}
}
template <class _CharT, class _Alloc>
const unsigned long
rope<_CharT, _Alloc>::
_S_min_len[int(__detail::_S_max_rope_depth) + 1] = {
/* 0 */1, /* 1 */2, /* 2 */3, /* 3 */5, /* 4 */8, /* 5 */13, /* 6 */21,
/* 7 */34, /* 8 */55, /* 9 */89, /* 10 */144, /* 11 */233, /* 12 */377,
/* 13 */610, /* 14 */987, /* 15 */1597, /* 16 */2584, /* 17 */4181,
/* 18 */6765, /* 19 */10946, /* 20 */17711, /* 21 */28657, /* 22 */46368,
/* 23 */75025, /* 24
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
*/121393, /* 25 */196418, /* 26 */317811,
/* 27 */514229, /* 28 */832040, /* 29 */1346269, /* 30 */2178309,
/* 31 */3524578, /* 32 */5702887, /* 33 */9227465, /* 34 */14930352,
/* 35 */24157817, /* 36 */39088169, /* 37 */63245986, /* 38 */102334155,
/* 39 */165580141, /* 40 */267914296, /* 41 */433494437,
/* 42 */701408733, /* 43 */1134903170, /* 44 */1836311903,
/* 45 */2971215073u };
// These are Fibonacci numbers < 2**32.
template <class _CharT, class _Alloc>
typename rope<_CharT, _Alloc>::_RopeRep*
rope<_CharT, _Alloc>::
_S_balance(_RopeRep* __r)
{
_RopeRep* __forest[int(__detail::_S_max_rope_depth) + 1];
_RopeRep* __result = 0;
int __i;
// Invariant:
// The concatenation of forest in descending order is equal to __r.
// __forest[__i]._M_size >= _S_min_len[__i]
// __forest[__i]._M_depth = __i
// References from forest are included in refcount.
for (__i = 0; __i <= int(__detail::_S_max_rope_depth); ++__i)
__forest[__i] = 0;
__try
{
_S_add_to_forest(__r, __forest);
for (__i = 0; __i <= int(__detail::_S_max_rope_depth); ++__i)
if (0 != __forest[__i])
{
#ifndef __GC
_Self_destruct_ptr __old(__result);
#endif
__result = _S_concat(__forest[__i], __result);
__forest[__i]->_M_unref_nonnil();
#if !defined(__GC) && __cpp_exceptions
__forest[__i] = 0;
#endif
}
}
__catch(...)
{
for(__i = 0; __i <= int(__detail::_S_max_rope_depth); __i++)
_S_unref(__forest[__i]);
__throw_exception_again;
}
if (__result->_M_depth > int(__detail::_S_max_rope_depth))
__throw_length_error(__N("rope::_S_balance"));
return(__result);
}
template <class _CharT, class _Alloc>
void
rope<_CharT, _Alloc>::
_S_add_to_forest(_RopeRep* __r, _RopeRep** __forest)
{
if (__r->_M_is_balanced)
{
_S_add_leaf_to_forest(__r, __forest);
return;
}
{
_RopeConcatenation* __c = (_RopeConcatenation*)__r;
_S_add_to_forest(__c
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
->_M_left, __forest);
_S_add_to_forest(__c->_M_right, __forest);
}
}
template <class _CharT, class _Alloc>
void
rope<_CharT, _Alloc>::
_S_add_leaf_to_forest(_RopeRep* __r, _RopeRep** __forest)
{
_RopeRep* __insertee; // included in refcount
_RopeRep* __too_tiny = 0; // included in refcount
int __i; // forest[0..__i-1] is empty
size_t __s = __r->_M_size;
for (__i = 0; __s >= _S_min_len[__i+1]/* not this bucket */; ++__i)
{
if (0 != __forest[__i])
{
#ifndef __GC
_Self_destruct_ptr __old(__too_tiny);
#endif
__too_tiny = _S_concat_and_set_balanced(__forest[__i],
__too_tiny);
__forest[__i]->_M_unref_nonnil();
__forest[__i] = 0;
}
}
{
#ifndef __GC
_Self_destruct_ptr __old(__too_tiny);
#endif
__insertee = _S_concat_and_set_balanced(__too_tiny, __r);
}
// Too_tiny dead, and no longer included in refcount.
// Insertee is live and included.
for (;; ++__i)
{
if (0 != __forest[__i])
{
#ifndef __GC
_Self_destruct_ptr __old(__insertee);
#endif
__insertee = _S_concat_and_set_balanced(__forest[__i],
__insertee);
__forest[__i]->_M_unref_nonnil();
__forest[__i] = 0;
}
if (__i == int(__detail::_S_max_rope_depth)
|| __insertee->_M_size < _S_min_len[__i+1])
{
__forest[__i] = __insertee;
// refcount is OK since __insertee is now dead.
return;
}
}
}
template <class _CharT, class _Alloc>
_CharT
rope<_CharT, _Alloc>::
_S_fetch(_RopeRep* __r, size_type __i)
{
__GC_CONST _CharT* __cstr = __r->_M_c_string;
if (0 != __cstr)
return __cstr[__i];
for(;;)
{
switch(__r->_M_tag)
{
case __detail::_S_concat:
{
_RopeConcatenation* __c = (_RopeConcatenation*)__r;
_RopeRep* __left = __c->_M_left;
size_t __left_len = __left->_M_size;
if (__i >= __left_len)
{
__i -= __left_len;
__r = __c->_M_right;
}
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
else
__r = __left;
}
break;
case __detail::_S_leaf:
{
_RopeLeaf* __l = (_RopeLeaf*)__r;
return __l->_M_data[__i];
}
case __detail::_S_function:
case __detail::_S_substringfn:
{
_RopeFunction* __f = (_RopeFunction*)__r;
_CharT __result;
(*(__f->_M_fn))(__i, 1, &__result);
return __result;
}
}
}
}
#ifndef __GC
// Return a uniquely referenced character slot for the given
// position, or 0 if that's not possible.
template <class _CharT, class _Alloc>
_CharT*
rope<_CharT, _Alloc>::
_S_fetch_ptr(_RopeRep* __r, size_type __i)
{
_RopeRep* __clrstack[__detail::_S_max_rope_depth];
size_t __csptr = 0;
for(;;)
{
if (__r->_M_ref_count > 1)
return 0;
switch(__r->_M_tag)
{
case __detail::_S_concat:
{
_RopeConcatenation* __c = (_RopeConcatenation*)__r;
_RopeRep* __left = __c->_M_left;
size_t __left_len = __left->_M_size;
if (__c->_M_c_string != 0)
__clrstack[__csptr++] = __c;
if (__i >= __left_len)
{
__i -= __left_len;
__r = __c->_M_right;
}
else
__r = __left;
}
break;
case __detail::_S_leaf:
{
_RopeLeaf* __l = (_RopeLeaf*)__r;
if (__l->_M_c_string != __l->_M_data && __l->_M_c_string != 0)
__clrstack[__csptr++] = __l;
while (__csptr > 0)
{
-- __csptr;
_RopeRep* __d = __clrstack[__csptr];
__d->_M_free_c_string();
__d->_M_c_string = 0;
}
return __l->_M_data + __i;
}
case __detail::_S_function:
case __detail::_S_substringfn:
return 0;
}
}
}
#endif /* __GC */
// The following could be implemented trivially using
// lexicographical_compare_3way.
// We do a little more work to avoid dealing with rope iterators for
// flat strings.
template <class _CharT, class _Alloc>
int
rope<_CharT, _Alloc>::
_S_compare (const _RopeRep* __left, const _RopeRep* __right)
{
size_t __left_len;
size_t __right
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
_len;
if (0 == __right)
return 0 != __left;
if (0 == __left)
return -1;
__left_len = __left->_M_size;
__right_len = __right->_M_size;
if (__detail::_S_leaf == __left->_M_tag)
{
_RopeLeaf* __l = (_RopeLeaf*) __left;
if (__detail::_S_leaf == __right->_M_tag)
{
_RopeLeaf* __r = (_RopeLeaf*) __right;
return lexicographical_compare_3way(__l->_M_data,
__l->_M_data + __left_len,
__r->_M_data, __r->_M_data
+ __right_len);
}
else
{
const_iterator __rstart(__right, 0);
const_iterator __rend(__right, __right_len);
return lexicographical_compare_3way(__l->_M_data, __l->_M_data
+ __left_len,
__rstart, __rend);
}
}
else
{
const_iterator __lstart(__left, 0);
const_iterator __lend(__left, __left_len);
if (__detail::_S_leaf == __right->_M_tag)
{
_RopeLeaf* __r = (_RopeLeaf*) __right;
return lexicographical_compare_3way(__lstart, __lend,
__r->_M_data, __r->_M_data
+ __right_len);
}
else
{
const_iterator __rstart(__right, 0);
const_iterator __rend(__right, __right_len);
return lexicographical_compare_3way(__lstart, __lend,
__rstart, __rend);
}
}
}
// Assignment to reference proxies.
template <class _CharT, class _Alloc>
_Rope_char_ref_proxy<_CharT, _Alloc>&
_Rope_char_ref_proxy<_CharT, _Alloc>::
operator=(_CharT __c)
{
_RopeRep* __old = _M_root->_M_tree_ptr;
#ifndef __GC
// First check for the case in which everything is uniquely
// referenced. In that case we can do this destructively.
_CharT* __ptr = _My_rope::_S_fetch_ptr(__old, _M_pos);
if (0 != __ptr)
{
*__ptr = __c;
return *this;
}
#endif
_Self_destruct_ptr __left(_My_rope::_S_substring(__old, 0, _M_pos));
_Self_destruct_ptr __right(_My_rope::_S_substring(__old, _M_pos + 1,
__old->_M_size));
_Self_destruct_ptr __result_left(_My_rope::
_S_
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
destr_concat_char_iter(__left,
&__c, 1));
_RopeRep* __result = _My_rope::_S_concat(__result_left, __right);
#ifndef __GC
_RopeRep::_S_unref(__old);
#endif
_M_root->_M_tree_ptr = __result;
return *this;
}
template <class _CharT, class _Alloc>
inline _Rope_char_ref_proxy<_CharT, _Alloc>::
operator _CharT() const
{
if (_M_current_valid)
return _M_current;
else
return _My_rope::_S_fetch(_M_root->_M_tree_ptr, _M_pos);
}
template <class _CharT, class _Alloc>
_Rope_char_ptr_proxy<_CharT, _Alloc>
_Rope_char_ref_proxy<_CharT, _Alloc>::
operator&() const
{ return _Rope_char_ptr_proxy<_CharT, _Alloc>(*this); }
template <class _CharT, class _Alloc>
rope<_CharT, _Alloc>::
rope(size_t __n, _CharT __c, const allocator_type& __a)
: _Base(__a)
{
rope<_CharT,_Alloc> __result;
const size_t __exponentiate_threshold = 32;
size_t __exponent;
size_t __rest;
_CharT* __rest_buffer;
_RopeRep* __remainder;
rope<_CharT, _Alloc> __remainder_rope;
if (0 == __n)
return;
__exponent = __n / __exponentiate_threshold;
__rest = __n % __exponentiate_threshold;
if (0 == __rest)
__remainder = 0;
else
{
__rest_buffer = this->_Data_allocate(_S_rounded_up_size(__rest));
__uninitialized_fill_n_a(__rest_buffer, __rest, __c,
_M_get_allocator());
_S_cond_store_eos(__rest_buffer[__rest]);
__try
{ __remainder = _S_new_RopeLeaf(__rest_buffer, __rest,
_M_get_allocator()); }
__catch(...)
{
_RopeRep::__STL_FREE_STRING(__rest_buffer, __rest,
_M_get_allocator());
__throw_exception_again;
}
}
__remainder_rope._M_tree_ptr = __remainder;
if (__exponent != 0)
{
_CharT* __base_buffer =
this->_Data_allocate(_S_rounded_up_size(__exponentiate_threshold));
_RopeLeaf* __base_leaf;
rope __base_rope;
__uninitialized_fill_n_a(__base_buffer, __exponentiate_threshold, __c,
_M_get_allocator());
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
_S_cond_store_eos(__base_buffer[__exponentiate_threshold]);
__try
{
__base_leaf = _S_new_RopeLeaf(__base_buffer,
__exponentiate_threshold,
_M_get_allocator());
}
__catch(...)
{
_RopeRep::__STL_FREE_STRING(__base_buffer,
__exponentiate_threshold,
_M_get_allocator());
__throw_exception_again;
}
__base_rope._M_tree_ptr = __base_leaf;
if (1 == __exponent)
__result = __base_rope;
else
__result = power(__base_rope, __exponent,
_Rope_Concat_fn<_CharT, _Alloc>());
if (0 != __remainder)
__result += __remainder_rope;
}
else
__result = __remainder_rope;
this->_M_tree_ptr = __result._M_tree_ptr;
this->_M_tree_ptr->_M_ref_nonnil();
}
template<class _CharT, class _Alloc>
_CharT
rope<_CharT, _Alloc>::_S_empty_c_str[1];
template<class _CharT, class _Alloc>
const _CharT*
rope<_CharT, _Alloc>::
c_str() const
{
if (0 == this->_M_tree_ptr)
{
_S_empty_c_str[0] = _S_eos((_CharT*)0); // Possibly redundant,
// but probably fast.
return _S_empty_c_str;
}
__gthread_mutex_lock (&this->_M_tree_ptr->_M_c_string_lock);
__GC_CONST _CharT* __result = this->_M_tree_ptr->_M_c_string;
if (0 == __result)
{
size_t __s = size();
__result = this->_Data_allocate(__s + 1);
_S_flatten(this->_M_tree_ptr, __result);
__result[__s] = _S_eos((_CharT*)0);
this->_M_tree_ptr->_M_c_string = __result;
}
__gthread_mutex_unlock (&this->_M_tree_ptr->_M_c_string_lock);
return(__result);
}
template<class _CharT, class _Alloc>
const _CharT* rope<_CharT, _Alloc>::
replace_with_c_str()
{
if (0 == this->_M_tree_ptr)
{
_S_empty_c_str[0] = _S_eos((_CharT*)0);
return _S_empty_c_str;
}
__GC_CONST _CharT* __old_c_string = this->_M_tree_ptr->_M_c_string;
if (__detail::_S_leaf == this->_M_tree_ptr->_M_tag
&& 0 != __old_c_string)
return(_
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
_old_c_string);
size_t __s = size();
_CharT* __result = this->_Data_allocate(_S_rounded_up_size(__s));
_S_flatten(this->_M_tree_ptr, __result);
__result[__s] = _S_eos((_CharT*)0);
this->_M_tree_ptr->_M_unref_nonnil();
this->_M_tree_ptr = _S_new_RopeLeaf(__result, __s,
this->_M_get_allocator());
return(__result);
}
// Algorithm specializations. More should be added.
template<class _Rope_iterator> // was templated on CharT and Alloc
void // VC++ workaround
_Rope_rotate(_Rope_iterator __first,
_Rope_iterator __middle,
_Rope_iterator __last)
{
typedef typename _Rope_iterator::value_type _CharT;
typedef typename _Rope_iterator::_allocator_type _Alloc;
rope<_CharT, _Alloc>& __r(__first.container());
rope<_CharT, _Alloc> __prefix = __r.substr(0, __first.index());
rope<_CharT, _Alloc> __suffix =
__r.substr(__last.index(), __r.size() - __last.index());
rope<_CharT, _Alloc> __part1 =
__r.substr(__middle.index(), __last.index() - __middle.index());
rope<_CharT, _Alloc> __part2 =
__r.substr(__first.index(), __middle.index() - __first.index());
__r = __prefix;
__r += __part1;
__r += __part2;
__r += __suffix;
}
#if !defined(__GNUC__)
// Appears to confuse g++
inline void
rotate(_Rope_iterator<char, __STL_DEFAULT_ALLOCATOR(char)> __first,
_Rope_iterator<char, __STL_DEFAULT_ALLOCATOR(char)> __middle,
_Rope_iterator<char, __STL_DEFAULT_ALLOCATOR(char)> __last)
{ _Rope_rotate(__first, __middle, __last); }
#endif
# if 0
// Probably not useful for several reasons:
// - for SGIs 7.1 compiler and probably some others,
// this forces lots of rope<wchar_t, ...> instantiations, creating a
// code bloat and compile time problem. (Fixed in 7.2.)
// - wchar_t is 4 bytes wide on most UNIX platforms, making it
// unattractive for unicode strings. Unsigned short may be a better
// character type.
inline void
rotate(_Rope_iterator<wch
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
ar_t, __STL_DEFAULT_ALLOCATOR(char)> __first,
_Rope_iterator<wchar_t, __STL_DEFAULT_ALLOCATOR(char)> __middle,
_Rope_iterator<wchar_t, __STL_DEFAULT_ALLOCATOR(char)> __last)
{ _Rope_rotate(__first, __middle, __last); }
# endif
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
{
union {
...FC
}
}
fragment FC on C {
cText
}
// RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -Wc++11-narrowing -Wmicrosoft -verify -fms-extensions -std=c++11
// RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -Wc++11-narrowing -Wmicrosoft -verify -fms-extensions -std=c++11 -fms-compatibility -DMS_COMPAT
struct A {
unsigned int a;
};
int b = 3;
A var = { b }; // expected-warning {{ cannot be narrowed }} expected-note {{insert an explicit cast to silence this issue}}
namespace PR13433 {
struct S;
S make();
template<typename F> auto x(F f) -> decltype(f(make()));
#ifndef MS_COMPAT
// expected-error@-2{{calling 'make' with incomplete return type 'PR13433::S'}}
// expected-note@-5{{'make' declared here}}
// expected-note@-7{{forward declaration of 'PR13433::S'}}
#endif
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=402347&clcid=0x409
namespace AppServicesClientApp
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
sealed partial class App : Application
{
/// <summary>
/// Initializes the singleton application object. This is the first line of authored cod
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
e
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
this.InitializeComponent();
this.Suspending += OnSuspending;
}
/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used such as when the application is launched to open a specific file.
/// </summary>
/// <param name="e">Details about the launch request and process.</param>
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
#if DEBUG
if (System.Diagnostics.Debugger.IsAttached)
{
this.DebugSettings.EnableFrameRateCounter = true;
}
#endif
Frame rootFrame = Window.Current.Content as Frame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();
// Set the default language
rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];
rootFrame.NavigationFailed += OnNavigationFailed;
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
}
// Place the frame in the current Window
Window.Current.Content = rootFrame;
}
if (rootFrame.Content == null)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
rootFrame.Navigate(typeof(MainPage), e.Argu
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
ments);
}
// Ensure the current window is active
Window.Current.Activate();
}
/// <summary>
/// Invoked when Navigation to a certain page fails
/// </summary>
/// <param name="sender">The Frame which failed navigation</param>
/// <param name="e">Details about the navigation failure</param>
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
{
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
}
/// <summary>
/// Invoked when application execution is being suspended. Application state is saved
/// without knowing whether the application will be terminated or resumed with the contents
/// of memory still intact.
/// </summary>
/// <param name="sender">The source of the suspend request.</param>
/// <param name="e">Details about the suspend request.</param>
private void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
//TODO: Save application state and stop any background activity
deferral.Complete();
}
}
}
// (c) 2019-2020, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package snowman
import (
"github.com/ava-labs/avalanchego/ids"
)
// Voter records chits received from [vdr] once its dependencies are met.
type voter struct {
t *Transitive
vdr ids.ShortID
requestID uint32
response ids.ID
deps ids.Set
}
func (v *voter) Dependencies() ids.Set { return v.deps }
// Mark that a dependency has been met.
func (v *voter) Fulfill(id ids.ID) {
v.deps.Remove(id)
v.Update()
}
// Abandon this attempt to record chits.
func (v *voter) Abandon(id ids.ID) { v.Fulfill(id) }
func (v *voter) Update() {
if v.deps.Len() != 0 || v.t.errs.Errored() {
return
}
results := ids.Bag{}
finished := false
if v.response.IsZero() {
results
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
, finished = v.t.polls.Drop(v.requestID, v.vdr)
} else {
results, finished = v.t.polls.Vote(v.requestID, v.vdr, v.response)
}
if !finished {
return
}
// To prevent any potential deadlocks with un-disclosed dependencies, votes
// must be bubbled to the nearest valid block
results = v.bubbleVotes(results)
v.t.Ctx.Log.Debug("Finishing poll [%d] with:\n%s", v.requestID, &results)
if err := v.t.Consensus.RecordPoll(results); err != nil {
v.t.errs.Add(err)
return
}
v.t.VM.SetPreference(v.t.Consensus.Preference())
if v.t.Consensus.Finalized() {
v.t.Ctx.Log.Debug("Snowman engine can quiesce")
return
}
v.t.Ctx.Log.Debug("Snowman engine can't quiesce")
v.t.repoll()
}
func (v *voter) bubbleVotes(votes ids.Bag) ids.Bag {
bubbledVotes := ids.Bag{}
for _, vote := range votes.List() {
count := votes.Count(vote)
blk, err := v.t.VM.GetBlock(vote)
if err != nil {
continue
}
for blk.Status().Fetched() && !v.t.Consensus.Issued(blk) {
blk = blk.Parent()
}
if !blk.Status().Decided() && v.t.Consensus.Issued(blk) {
bubbledVotes.AddCount(blk.ID(), count)
}
}
return bubbledVotes
}
# .NET Metadata Dumper
This samples uses the [.NET Metadata Reader][MDReader] to dump the contents
of the [ECMA-335] metadata contained in a .NET assembly (or module).
[MDReader]: http://www.nuget.org/packages/Microsoft.Bcl.Metadata
[ECMA-335]: http://www.ecma-international.org/publications/standards/Ecma-335.htm
// Copyright (C) 2014 Vicente J. Botet Escriba
//
// 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_THREAD_EXECUTORS_GENERIC_EXECUTOR_REF_HPP
#define BOOST_THREAD_EXECUTORS_GENERIC_EXECUTOR_REF_HPP
#include <boost/thread/detail/config.hpp>
#include <boost/thread/detail/delete.hpp>
#include <boost/thread/detail/move.hpp>
#include <boost/thread/executors/executor.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/config/abi_prefix.hpp>
namespace boost
{
nam
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
espace executors
{
template <class Executor>
class executor_ref : public executor
{
Executor& ex;
public:
/// type-erasure to store the works to do
typedef executors::work work;
/// executor is not copyable.
BOOST_THREAD_NO_COPYABLE(executor_ref)
executor_ref(Executor& ex) : ex(ex) {}
/**
* \par Effects
* Destroys the executor.
*
* \par Synchronization
* The completion of all the closures happen before the completion of the executor destructor.
*/
~executor_ref() {};
/**
* \par Effects
* Close the \c executor for submissions.
* The worker threads will work until there is no more closures to run.
*/
void close() { ex.close(); }
/**
* \par Returns
* Whether the pool is closed for submissions.
*/
bool closed() { return ex.closed(); }
/**
* \par Effects
* The specified closure will be scheduled for execution at some point in the future.
* If invoked closure throws an exception the executor will call std::terminate, as is the case with threads.
*
* \par Synchronization
* Ccompletion of closure on a particular thread happens before destruction of thread's thread local variables.
*
* \par Throws
* \c sync_queue_is_closed if the thread pool is closed.
* Whatever exception that can be throw while storing the closure.
*/
void submit(BOOST_THREAD_RV_REF(work) closure) {
ex.submit(boost::move(closure));
}
// void submit(work& closure) {
// ex.submit(closure);
// }
/**
* \par Effects
* Try to execute one task.
*
* \par Returns
* Whether a task has been executed.
*
* \par Throws
* Whatever the current task constructor throws or the task() throws.
*/
bool try_executing_one() { return ex.try_executing_one(); }
};
class generic_executor_ref
{
shared_ptr<executor> ex;
public:
/// type-erasure to store the works to do
typedef executors::work work
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
;
template<typename Executor>
generic_executor_ref(Executor& ex)
//: ex(make_shared<executor_ref<Executor> >(ex)) // todo check why this doesn't works with C++03
: ex( new executor_ref<Executor>(ex) )
{
}
//generic_executor_ref(generic_executor_ref const& other) noexcept {}
//generic_executor_ref& operator=(generic_executor_ref const& other) noexcept {}
/**
* \par Effects
* Close the \c executor for submissions.
* The worker threads will work until there is no more closures to run.
*/
void close() { ex->close(); }
/**
* \par Returns
* Whether the pool is closed for submissions.
*/
bool closed() { return ex->closed(); }
/**
* \par Requires
* \c Closure is a model of Callable(void()) and a model of CopyConstructible/MoveConstructible.
*
* \par Effects
* The specified closure will be scheduled for execution at some point in the future.
* If invoked closure throws an exception the thread pool will call std::terminate, as is the case with threads.
*
* \par Synchronization
* Completion of closure on a particular thread happens before destruction of thread's thread local variables.
*
* \par Throws
* \c sync_queue_is_closed if the thread pool is closed.
* Whatever exception that can be throw while storing the closure.
*/
void submit(BOOST_THREAD_RV_REF(work) closure)
{
ex->submit(boost::move(closure));
}
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template <typename Closure>
void submit(Closure & closure)
{
//work w ((closure));
//submit(boost::move(w));
submit(work(closure));
}
#endif
void submit(void (*closure)())
{
work w ((closure));
submit(boost::move(w));
//submit(work(closure));
}
template <typename Closure>
void submit(BOOST_THREAD_FWD_REF(Closure) closure)
{
work w((boost::forward<Closure>(closure)));
submit(boost::move(w));
}
//
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
size_t num_pending_closures() const
// {
// return ex->num_pending_closures();
// }
/**
* \par Effects
* Try to execute one task.
*
* \par Returns
* Whether a task has been executed.
*
* \par Throws
* Whatever the current task constructor throws or the task() throws.
*/
bool try_executing_one() { return ex->try_executing_one(); }
/**
* \par Requires
* This must be called from an scheduled task.
*
* \par Effects
* reschedule functions until pred()
*/
template <typename Pred>
bool reschedule_until(Pred const& pred)
{
do {
//schedule_one_or_yield();
if ( ! try_executing_one())
{
return false;
}
} while (! pred());
return true;
}
};
}
using executors::executor_ref;
using executors::generic_executor_ref;
}
#include <boost/config/abi_suffix.hpp>
#endif
{
"$schema": "http://schemastore.org/schemas/json/webjob-publish-settings.json",
"webJobName": "CoreSimpleTimerJobConsole",
"startTime": null,
"endTime": null,
"jobRecurrenceFrequency": null,
"interval": null,
"runMode": "OnDemand"
}
/**
* @author MadhavBahlMD
* @date 08/01/2018
* METHOD - We keep thte second argument (num2) positive and add the first arguement num2(second arg) times
*/
function recursiveProd (num1, num2) {
// If num 2 becomes 1, return num1
if (num2 === 1)
return num1;
// If any of the numbers is zero, return 0
if (num1 === 0 || num2 === 0)
return 0;
// If both numbers are less than zero negative signs can be removed
if (num1 < 0 && num2 < 0)
return recursiveProd (-1*num1, -1*num2);
else if (num2 < 0)
return recursiveProd (num2, num1);
else
return num1 + recursiveProd(num1, num2-1);
}
let n1 = 5, n2 = 10;
console.log (`${n1} x ${n2} = ${recursiveProd(n1, n2)}`);
let n3 = -8, n4 = 4;
console.log (`${n3} x ${n4} = ${recursiveProd(n3, n4)}`);
let n5 = 2, n6 = -7;
console.l
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
og (`${n5} x ${n6} = ${recursiveProd(n5, n6)}`);
let n7 = -4, n8 = -7;
console.log (`${n7} x ${n8} = ${recursiveProd(n7, n8)}`);
---
title: Adding RSS Support - RSS Truncation Test
author: Eric Nakagawa
authorURL: http://twitter.com/ericnakagawa
authorFBID: 661277173
---
1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
This should be truncated.
<!--truncate-->
This line should never render in XML.
using Gtk;
using System.Linq;
using Xamarin.Forms.Internals;
using Xamarin.Forms.Platform.GTK.Extensions;
namespace Xamarin.Forms.Platform.GTK.Helpers
{
internal static class DialogHelper
{
public static void ShowAlert(PlatformRenderer platformRender, AlertArguments arguments)
{
MessageDialog messageDialog = new MessageDialog(
platformRender.Toplevel as Window,
DialogFlags.DestroyWithParent,
MessageType.Other,
GetAlertButtons(arguments),
arguments.Message);
SetDialogTitle(arguments.Title, messageDialog);
SetButtonText(arguments.Accept, ButtonsType.Ok, messageDialog);
SetButtonText(arguments.Cancel, ButtonsType.Cancel, messageDialog);
ResponseType result = (ResponseType)messageDialog.Run();
if (result == ResponseType.Ok)
{
arguments.SetResult(true);
}
else
{
arguments.SetResult(false);
}
messageDialog.Destroy();
}
public static void ShowActionSheet(PlatformRenderer platformRender, ActionSheetArguments arguments)
{
MessageDialog messageDialog = new MessageDialog(
platformRender.Toplevel as Window,
DialogFlags.DestroyWithParent,
MessageType.Other,
ButtonsType.Cancel,
null);
SetDialogTitle(arguments.Title, messageDialog);
SetButtonText(arguments.Cancel, ButtonsType.Cancel, messageDialog);
SetDestructionButton(arguments.Destruction, messageDialog);
AddExtraButtons(arguments, messageDial
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
og);
int result = messageDialog.Run();
if ((ResponseType)result == ResponseType.Cancel)
{
arguments.SetResult(arguments.Cancel);
}
else if ((ResponseType)result == ResponseType.Reject)
{
arguments.SetResult(arguments.Destruction);
}
messageDialog.Destroy();
}
private static void SetDialogTitle(string title, MessageDialog messageDialog)
{
messageDialog.Title = title ?? string.Empty;
}
private static void SetButtonText(string text, ButtonsType type, MessageDialog messageDialog)
{
string gtkLabel = string.Empty;
switch (type)
{
case ButtonsType.Ok:
gtkLabel = "gtk-ok";
break;
case ButtonsType.Cancel:
gtkLabel = "gtk-cancel";
break;
}
var buttonsBox = messageDialog.GetDescendants()
.OfType<HButtonBox>()
.FirstOrDefault();
if (buttonsBox == null) return;
var targetButton = buttonsBox.GetDescendants()
.OfType<Gtk.Button>()
.FirstOrDefault(x => x.Label == gtkLabel);
if (targetButton == null) return;
if (string.IsNullOrEmpty(text))
{
targetButton.Hide();
}
else
{
targetButton.Label = text;
}
}
private static void SetDestructionButton(string destruction, MessageDialog messageDialog)
{
if (!string.IsNullOrEmpty(destruction))
{
var destructionButton =
messageDialog.AddButton(destruction, ResponseType.Reject) as Gtk.Button;
var destructionColor = Color.Red.ToGtkColor();
destructionButton.Child.ModifyFg(StateType.Normal, destructionColor);
destructionButton.Child.ModifyFg(StateType.Prelight, destructionColor);
destructionButton.Child.ModifyFg(StateType.Active, destructionColor);
}
}
private static void AddExtraButtons(ActionSheetArguments arguments, MessageDialog messageDialog)
{
var vbox = messageDialog.VBox;
// As we are not showing any message in this dialog, we just
// hide default container and avoid it from using space
vbox.Children[0].Hide();
if (arguments.Buttons.Any())
{
for (int i = 0; i < argu
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
ments.Buttons.Count(); i++)
{
var button = new Gtk.Button();
button.Label = arguments.Buttons.ElementAt(i);
button.Clicked += (o, e) =>
{
arguments.SetResult(button.Label);
messageDialog.Destroy();
};
button.Show();
vbox.PackStart(button, false, false, 0);
}
}
}
private static ButtonsType GetAlertButtons(AlertArguments arguments)
{
bool hasAccept = !string.IsNullOrEmpty(arguments.Accept);
bool hasCancel = !string.IsNullOrEmpty(arguments.Cancel);
ButtonsType type = ButtonsType.None;
if (hasAccept && hasCancel)
{
type = ButtonsType.OkCancel;
}
else if (hasAccept && !hasCancel)
{
type = ButtonsType.Ok;
}
else if (!hasAccept && hasCancel)
{
type = ButtonsType.Cancel;
}
return type;
}
}
}
// Copyright © 2014 C4
//
// 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 UIKit
/// A Image provides a view-based container for displaying a single image. You can create images from files, from other
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
image objects, or from raw image data you receive.
open class Image: View, NSCopying {
open class ImageView: UIImageView {
var imageLayer: ImageLayer {
return self.layer as! ImageLayer // swiftlint:disable:this force_cast
}
override open class var layerClass: AnyClass {
return ImageLayer.self
}
}
/// Shape's contents are drawn on a ShapeLayer.
open var imageLayer: ImageLayer {
return self.imageView.imageLayer
}
// MARK: Initializers
/// Initializes an empty Image
public override init() {
super.init()
let uiimage = UIImage()
self.view = ImageView(image: uiimage)
}
public override init(frame: Rect) {
super.init(frame: frame)
let uiimage = UIImage()
let imageView = ImageView(image: uiimage)
imageView.frame = self.view.bounds
self.view = imageView
}
/// Initializes a new Image using the specified filename from the bundle (i.e. your project), it will also grab images
/// from the web if the filename starts with http.
/// ````
/// let img = Image("logo")
/// canvas.add(img)
/// ````
/// - parameter name: The name of the image included in your project, or a web address.
convenience public init?(_ name: String) {
self.init(name, scale: 1.0)
}
/// Initializes a new Image using the specified filename from the bundle (i.e. your project), it will also grab images
/// from the web if the filename starts with http.
/// ````
/// let img = Image("http://www.c4ios.com/images/logo@2x.png", scale: 2.0)
/// canvas.add(img)
/// ````
/// - parameter name: The name of the image included in your project, or a web address.
convenience public init?(_ name: String, scale: Double) {
guard let image = UIImage(named: name) else {
return nil
}
self.init(uiimage: image, scale: scale)
}
/// Initializes a new Image using an existing Image (basically l
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
ike copying).
/// ````
/// let a = Image("logo")
/// canvas.add(a)
/// let b = Image(image: a)
/// b.center = canvas.center
/// canvas.add(b)
/// ````
/// - parameter image: A Image.
convenience public init(copy image: Image) {
self.init()
let uiimage = image.uiimage
self.view = ImageView(image: uiimage)
copyViewStyle(image)
}
/// Initializes a new Image using a UIImage.
/// ````
/// if let uii = UIImage(named:"logo") {
/// let img = Image(uiimage: uii)
/// canvas.add(img)
/// }
/// ````
/// - parameter uiimage: A UIImage object.
convenience public init(uiimage: UIImage) {
self.init(uiimage: uiimage, scale: 1.0)
}
/// Initializes a new Image using a UIImage, with option for specifying the scale of the image.
/// ````
/// if let uii = UIImage(named:"logo") {
/// let img = Image(uiimage: uii, scale: 2.0)
/// canvas.add(img)
/// }
/// ````
/// - parameter uiimage: A UIImage object.
/// - parameter scale: A `Double` should be larger than 0.0
convenience public init(uiimage: UIImage, scale: Double) {
self.init()
if scale != 1.0 {
let scaledImage = UIImage(cgImage: uiimage.cgImage!, scale: CGFloat(scale), orientation: uiimage.imageOrientation)
self.view = ImageView(image: scaledImage)
} else {
self.view = ImageView(image: uiimage)
}
_originalSize = Size(view.frame.size)
}
/// Initializes a new Image using a CGImageRef.
/// ````
/// let cgi = CGImageCreate()
/// let img = Image(cgimage: cgi)
/// canvas.add(img)
/// ````
/// [Example](https://gist.github.com/C4Framework/06319d420426cb0f1cb3)
/// - parameter cgimage: A CGImageRef object.
convenience public init(cgimage: CGImage) {
let image = UIImage(cgImage: cgimage)
self.init(uiimage: image, scale: 1.0)
}
/// Initializes a new Image using a CGImageRef, wi
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
th option for specifying the scale of the image.
/// ````
/// let cgi = CGImageCreate()
/// let img = Image(cgimage: cgi, scale: 2.0)
/// canvas.add(img)
/// ````
/// - parameter cgimage: A CGImageRef object.
/// - parameter scale: The scale of the image.
convenience public init(cgimage: CGImage, scale: Double) {
let image = UIImage(cgImage: cgimage)
self.init(uiimage: image, scale: scale)
}
/// Initializes a new Image using a CIImage.
/// Use this method if you're working with the output of a CIFilter.
/// - parameter ciimage: A CIImage object.
convenience public init(ciimage: CIImage) {
self.init(ciimage: ciimage, scale: 1.0)
}
/// Initializes a new Image using a CIImage, with option for specifying the scale of the image.
/// Use this method if you're working with the output of a CIFilter.
/// - parameter ciimage: A CIImage object.
/// - parameter scale: The scale of the image.
convenience public init(ciimage: CIImage, scale: Double) {
let image = UIImage(ciImage: ciimage)
self.init(uiimage: image, scale: scale)
}
/// Initializes a new Image using raw data.
/// Use this if you download an image as data you can pass it here to create an image.
/// See the body of init(url:) to see how to download an image as data.
/// - parameter data: An NSData object.
convenience public init(data: Data) {
self.init(data: data, scale: 1.0)
}
/// Initializes a new Image using raw data, with option for specifying the scale of the image.
/// Use this if you download an image as data you can pass it here to create an image.
/// See the body of init(url:) to see how to download an image as data.
/// - parameter data: An NSData object.
/// - parameter scale: The scale of the image.
convenience public init(data: Data, scale: Double) {
let image = UIImage(data: data)
self.init(uiimage: image!, scale: scale)
}
/// Initializes a new Ima
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
ge from an URL.
/// ````
/// if let url = NSURL(string: "http://www.c4ios.com/images/logo@2x.png") {
/// let img = Image(url: url)
/// canvas.add(img)
/// }
/// ````
/// - parameter url: An NSURL object.
convenience public init(url: URL) {
self.init(url: url, scale: 1.0)
}
/// Initializes a new Image from an URL, with option for specifying the scale of the image.
/// ````
/// if let url = NSURL(string: "http://www.c4ios.com/images/logo@2x.png") {
/// let img = Image(url: url, scale: 2.0)
/// canvas.add(img)
/// }
/// ````
/// - parameter url: An NSURL object.
/// - parameter scale: The scale of the image.
convenience public init(url: URL, scale: Double) {
var error: NSError?
var data: Data?
do {
data = try Data(contentsOf: url, options: NSData.ReadingOptions.mappedIfSafe)
} catch let error1 as NSError {
error = error1
data = nil
}
if let d = data {
self.init(data: d, scale: scale)
return
}
if let e = error {
C4Log("There was an error loading image data from url:\n ERROR: \(e.localizedDescription)\n URL:\(url)")
}
self.init()
}
/// Initializes a new Image using raw data. This method differs from `Image(data:...)` in that you can pass an array of
/// raw data to the initializer. This works if you're creating your own raw images by changing the values of individual
/// pixels. Pixel data should be RGBA.
/// - parameter pixels: An array of raw pixel data.
/// - parameter size: The size {w, h} of the image you're creating based on the pixel array.
convenience public init(pixels: [Pixel], size: Size) {
let rgbColorSpace = CGColorSpaceCreateDeviceRGB()
let bitmapInfo: CGBitmapInfo = CGBitmapInfo(rawValue: CGImageAlphaInfo.premultipliedLast.rawValue)
let bitsPerComponent: Int = 8
let bitsPerPixel: Int = 32
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
let width: Int = Int(size.width)
let height: Int = Int(size.height)
assert(pixels.count == Int(width * height))
var provider: CGDataProvider?
pixels.withUnsafeBufferPointer { p in
if let address = p.baseAddress {
let data = Data(bytes: UnsafePointer(address), count: pixels.count * MemoryLayout<Pixel>.size)
provider = CGDataProvider(data: data as CFData)
}
}
let cgim = CGImage(
width: width,
height: height,
bitsPerComponent: bitsPerComponent,
bitsPerPixel: bitsPerPixel,
bytesPerRow: width * Int(MemoryLayout<Pixel>.size),
space: rgbColorSpace,
bitmapInfo: bitmapInfo,
provider: provider!,
decode: nil,
shouldInterpolate: true,
intent: CGColorRenderingIntent.defaultIntent
)
self.init(cgimage: cgim!)
}
/// Initializes a new Image using another image.
/// - parameter c4image: An Image around which the new image is created.
convenience public init(c4image: Image) {
let cgim = c4image.cgImage
self.init(cgimage: cgim, scale: c4image.scale)
}
/// Initializes a new copy of the receiver.
/// - parameter zone: This parameter is ignored. Memory zones are no longer used by Objective-C.
/// - returns: a new instance that’s a copy of the receiver.
public func copy(with zone: NSZone? = nil) -> Any {
let uiimage = UIImage(cgImage: self.contents)
let img = Image(uiimage: uiimage, scale: scale)
img.frame = self.frame
img.constrainsProportions = self.constrainsProportions
img._originalSize = _originalSize
return img
}
// MARK: Properties
/// Returns the UIImageView of the object.
/// - returns: A UIImageView object.
open var imageView: ImageView {
return self.view as! ImageView // swiftlint:disable:this force_cast
}
/// Returns a UIImage r
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
epresentation of the receiver.
/// - returns: A UIImage object.
open var uiimage: UIImage {
let layer = imageView.layer as CALayer
let contents = layer.contents as! CGImage // swiftlint:disable:this force_cast
return UIImage(cgImage: contents, scale: CGFloat(scale), orientation: imageView.image!.imageOrientation)
}
/// Returns a CGImageRef representation of the receiver.
/// - returns: A CGImageRef object.
open var cgImage: CGImage {
return uiimage.cgImage!
}
/// Returns a CIImage representation of the receiver. Generally, this would be used to work with filters.
/// - returns: A CIImage object.
open var ciImage: CIImage {
return CIImage(cgImage: cgImage)
}
/// An object that provides the contents of the layer. Animatable.
/// The default value of this property is nil.
/// If you are using the layer to display a static image, you can set this property to the CGImageRef containing the image
/// you want to display. Assigning a value to this property causes the layer to use your image rather than create a
/// separate backing store.
open var contents: CGImage {
get {
let layer = imageView.layer as CALayer
return layer.contents as! CGImage // swiftlint:disable:this force_cast
} set(val) {
imageView.layer.contents = val
}
}
/// The current rotation value of the view. Animatable.
/// - returns: A Double value representing the cumulative rotation of the view, measured in Radians.
open override var rotation: Double {
get {
if let number = imageLayer.value(forKeyPath: Layer.rotationKey) as? NSNumber {
return number.doubleValue
}
return 0.0
}
set {
imageLayer.setValue(newValue, forKeyPath: Layer.rotationKey)
}
}
/// The scale factor of the image. (read-only)
var scale: Double {
return Double(imageView.image!.scale)
}
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
/// A variable that provides access to the width of the receiver. Animatable.
/// The default value of this property is defined by the image being created.
/// Assigning a value to this property causes the receiver to change the width of its frame. If the receiver's
/// `contrainsProportions` variable is set to `true` the receiver's height will change to match the new width.
open override var width: Double {
get {
return Double(view.frame.size.width)
} set(val) {
var newSize = Size(val, Double(view.frame.size.height))
if constrainsProportions {
let ratio = Double(self.size.height / self.size.width)
newSize.height = val * ratio
}
var rect = self.frame
rect.size = newSize
self.frame = rect
}
}
/// A variable that provides access to the height of the receiver. Animatable.
/// The default value of this property is defined by the image being created.
/// Assigning a value to this property causes the receiver to change the height of its frame. If the receiver's
/// `contrainsProportions` variable is set to `true` the receiver's width will change to match the new width.
open override var height: Double {
get {
return Double(view.frame.size.height)
} set(val) {
var newSize = Size(Double(view.frame.size.width), val)
if constrainsProportions {
let ratio = Double(self.size.width / self.size.height)
newSize.width = val * ratio
}
var rect = self.frame
rect.size = newSize
self.frame = rect
}
}
/// Assigning a value of true to this property will cause the receiver to scale its entire frame whenever its `width` or
/// `height` variables are set.
/// The default value of this property is `false`.
open var constrainsProportions: Bool = false
internal var _originalSize: Size = Size()
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
/// The original size of the receiver when it was initialized.
public var originalSize: Size {
return _originalSize
}
/// The original width/height ratio of the receiver when it was initialized.
public var originalRatio: Double {
return _originalSize.width / _originalSize.height
}
// MARK: Filters
lazy internal var output: CIImage = self.ciImage
lazy internal var filterQueue: DispatchQueue = {
return DispatchQueue.global(qos: .background)
}()
lazy internal var renderImmediately = true
}
/*
===========================================================================
Loom SDK
Copyright 2011, 2012, 2013
The Game Engine Company, LLC
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 TestImportResolution.PackageA {
class ClassA {
public var memberVar:Number = 42;
public static var stringValue = "TestImportResolution.PackageA.ClassA";
public static function staticMethod():String {
return "TestImportResolution.PackageA.ClassA.staticMethod";
}
}
}
package com.easytoolsoft.easyreport.membership.domain;
import java.io.Serializable;
import java.util.Date;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;
/**
* 系统用户(easyreport_member_user表)持久化类
*
* @author Tom Deng
* @date 2017-03-25
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor(access = AccessLevel.PRIVATE)
public class User implements Serializable {
/**
* 系统用户标识
*/
private Integer id;
/**
* 系统用户所属角色集合(role_id以英文逗号分隔)
*/
@NotEmpty(message = "{member.user.roles.NotEmpty}")
@Length(max = 20, message = "{member.user.roles.Length}")
private String roles;
/**
* 系统用户账号
*/
@NotEmpty(message = "{member.user.account.NotEmpty}")
@Length(min = 8, max = 20, message = "{member.user.account.Length}")
private String account;
/**
* 系统用户密码
*/
@NotEmpty
@Length(max = 64)
private String password;
/**
* 加盐
*/
private String salt;
/**
* 系统用户姓名
*/
@NotEmpty
@Length(max = 20)
private String name;
/**
* 系统用户电子邮箱
*/
@Email
private String email;
/**
* 系统用户用户电话号码,多个用英文逗号分开
*/
@Length(max = 13)
private String telephone;
/**
* 系统用户的状态,1表示启用,0表示禁用,默认为1,其他保留
*/
@NotNull
private Byte status;
/**
* 系统用户备注
*/
@NotNull
private String comment;
/**
* 系统用户记录创建时间
*/
private Date gmtCreated;
/**
* 系统用户记录更新时间戳
*/
private Date gmtModified;
/**
* 获取系统用户密码的凭证盐(account+salt)
*
* @return account+salt
*/
public String getCredentialsSalt() {
return this.account + this.salt;
}
}
/*++
Copyright (c) 1990-1993 Microsoft Corporation
Module Name:
plotui.h
Abstract:
This module contains all plotters's user interface common defines
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
Author:
02-Dec-1993 Thu 09:56:07 created -by- Daniel Chou (danielc)
[Environment:]
GDI Device Driver - Plotter.
[Notes:]
Revision History:
--*/
#ifndef _PLOTUI_
#define _PLOTUI_
//
// For compilers that don't support nameless unions
//
#ifndef DUMMYUNIONNAME
#ifdef NONAMELESSUNION
#define DUMMYUNIONNAME u
#define DUMMYUNIONNAME2 u2
#define DUMMYUNIONNAME3 u3
#else
#define DUMMYUNIONNAME
#define DUMMYUNIONNAME2
#define DUMMYUNIONNAME3
#endif
#endif
//
// PrinterINFO data structure which used by following calls to map a hPrinter
// to this data structrue by follwoing funciton
//
// 1. DrvDeviceCapabilities()
// 2. DrvDocumentProperties()
// 3. AdvanceDocumentProperties()
// 4. PrinterProperties()
//
#define PIF_UPDATE_PERMISSION 0x01
#define PIF_DOCPROP 0x02
typedef struct _PRINTERINFO {
HANDLE hPrinter; // Handle to the printer belong to here
POPTITEM pOptItem;
LPWSTR pHelpFile; // pointer to the help file
PFORM_INFO_1 pFI1Base; // intalled form
PPLOTGPC pPlotGPC; // loaded/updated Plotter GPC data
WORD cOptItem;
BYTE Flags;
BYTE IdxPenSet; // plotter pen data set
DWORD dmErrBits; // ErrorBits for DM_
PLOTDEVMODE PlotDM; // Validated PLOTDEVMODE
PAPERINFO CurPaper; // Current loaded form on the device
PPDATA PPData; // Printer Prop Data
HANDLE hCPSUI; // handle to the common ui pages
PCOMPROPSHEETUI pCPSUI; // pointer to COMPROPSHEETUI
PPLOTDEVMODE pPlotDMIn; // input devmode
PPLOTDEVMODE pPlotDMOut; // output devmode
DWORD ExtraData; // starting of extra data
} PRINTERINFO, *PPRINTERINFO;
#define PI_PADJHTINFO(pPI) (PDEVHTINFO)&((pPI)->ExtraData)
#define PI_PDEVHTADJDATA(pPI) (PDEVHTADJDATA)(PI_PADJHTINFO(pPI) + 1)
#define PI_PPENDATA(pPI) (PPENDATA)&((pPI)-
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
>ExtraData)
typedef struct _DOCPROPINFO {
HWND hWnd;
DWORD Result;
DOCUMENTPROPERTYHEADER DPHdr;
} DOCPROPINFO, *PDOCPROPINFO;
typedef struct _DEVPROPINFO {
HWND hWnd;
DWORD Result;
DEVICEPROPERTYHEADER DPHdr;
} DEVPROPINFO, *PDEVPROPINFO;
typedef UINT (* _CREATEOIFUNC)(PPRINTERINFO pPI,
POPTITEM pOptItem,
LPVOID pOIData);
#define CREATEOIFUNC UINT
typedef struct _OPDATA {
WORD Flags;
WORD IDSName;
WORD IconID;
union {
WORD Style;
WORD IDSSeparator;
} DUMMYUNIONNAME;
union {
WORD wParam;
WORD IDSCheckedName;
} DUMMYUNIONNAME2;
SHORT sParam;
} OPDATA, *POPDATA;
#define ODF_PEN 0x00000001
#define ODF_RASTER 0x00000002
#define ODF_PEN_RASTER (ODF_PEN | ODF_RASTER)
#define ODF_COLOR 0x00000004
#define ODF_ROLLFEED 0x00000008
#define ODF_ECB 0x00000010
#define ODF_INC_IDSNAME 0x00000020
#define ODF_INC_ICONID 0x00000040
#define ODF_NO_INC_POPDATA 0x00000080
#define ODF_COLLAPSE 0x00000100
#define ODF_CALLBACK 0x00000200
#define ODF_NO_PAPERTRAY 0x00000400
#define ODF_CALLCREATEOI 0x00000800
#define ODF_MANUAL_FEED 0x00001000
#define OI_LEVEL_1 0
#define OI_LEVEL_2 1
#define OI_LEVEL_3 2
#define OI_LEVEL_4 3
#define OI_LEVEL_5 4
#define OI_LEVEL_6 5
typedef struct _OIDATA {
DWORD Flags;
BYTE NotUsed;
BYTE Level;
BYTE DMPubID;
BYTE Type;
WORD IDSName;
union {
WORD IconID;
WORD Style;
} DUMMYUNIONNAME;
WORD HelpIdx;
WORD
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
cOPData;
union {
POPDATA pOPData;
_CREATEOIFUNC pfnCreateOI;
} DUMMYUNIONNAME2;
} OIDATA, *POIDATA;
#define PI_OFF(x) (WORD)offsetof(PRINTERINFO, x)
#define PLOTDM_OFF(x) (WORD)offsetof(PLOTDEVMODE, x)
#define OPTIF_NONE 0
#define PP_FORMTRAY_ASSIGN (DMPUB_USER + 0)
#define PP_INSTALLED_FORM (DMPUB_USER + 1)
#define PP_MANUAL_FEED_METHOD (DMPUB_USER + 2)
#define PP_PRINT_FORM_OPTIONS (DMPUB_USER + 3)
#define PP_AUTO_ROTATE (DMPUB_USER + 4)
#define PP_PRINT_SMALLER_PAPER (DMPUB_USER + 5)
#define PP_HT_SETUP (DMPUB_USER + 6)
#define PP_INSTALLED_PENSET (DMPUB_USER + 7)
#define PP_PEN_SETUP (DMPUB_USER + 8)
#define PP_PENSET (DMPUB_USER + 9)
#define PP_PEN_NUM (DMPUB_USER + 10)
#define DP_HTCLRADJ (DMPUB_USER + 0)
#define DP_FILL_TRUETYPE (DMPUB_USER + 1)
#define DP_QUICK_POSTER_MODE (DMPUB_USER + 2)
//
// Icon ID
//
#define IDI_RASTER_ROLLFEED 64089
#define IDI_RASTER_TRAYFEED 64090
#define IDI_PEN_ROLLFEED 64087
#define IDI_PEN_TRAYFEED 64088
#define IDI_ROLLPAPER 64091
#define IDI_PEN_SETUP 64093
#define IDI_PENSET 64092
#define IDI_DEFAULT_PENCLR 1007
#define IDI_PENCLR 64092
#define IDI_AUTO_ROTATE_NO 1009
#define IDI_AUTO_ROTATE_YES 1010
#define IDI_PRINT_SMALLER_PAPER_NO 1011
#define IDI_PRINT_SMALLER_PAPER_YES 1012
#define IDI_MANUAL_CX 1013
#define IDI_MANUAL_CY 1014
#define IDI_FILL_TRUETYPE_NO 1015
#define IDI_FILL_TRUETYPE_YES 1016
#define IDI_COLOR_FIRST IDI_WHITE
#define IDI_WHITE 1100
#define IDI_BLACK 1101
#define IDI_RED 1102
#define IDI_GREEN 1103
#define IDI_YELLOW 1104
#define I
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
DI_BLUE 1105
#define IDI_MAGENTA 1106
#define IDI_CYAN 1107
#define IDI_ORANGE 1108
#define IDI_BROWN 1109
#define IDI_VIOLET 1110
#define IDI_COLOR_LAST IDI_VIOLET
//
// String table ID
//
#define IDS_PLOTTER_DRIVER 1900
#define IDS_CAUTION 1901
#define IDS_NO_MEMORY 1902
#define IDS_INVALID_DATA 1903
#define IDS_FORM_TOO_BIG 1904
#define IDS_INV_DMSIZE 1905
#define IDS_INV_DMVERSION 1906
#define IDS_INV_DMDRIVEREXTRA 1907
#define IDS_INV_DMCOLOR 1908
#define IDS_INV_DMCOPIES 1909
#define IDS_INV_DMSCALE 1910
#define IDS_INV_DMORIENTATION 1911
#define IDS_INV_DMFORM 1912
#define IDS_INV_DMQUALITY 1913
#define IDS_FORM_NOT_AVAI 1914
#define IDS_MODEL 1915
#define IDS_HELP_FILENAME 1916
#define IDS_NO_HELP 1918
#define IDS_PP_NO_SAVE 1919
#define IDS_INSTALLED_FORM 2030
#define IDS_MANUAL_FEEDER 2040
#define IDS_MANUAL_FEED_METHOD 2041
#define IDS_MANUAL_CX 2042
#define IDS_MANUAL_CY 2043
#define IDS_ROLLFEED 2044
#define IDS_MAINFEED 2045
#define IDS_PRINT_FORM_OPTIONS 2050
#define IDS_AUTO_ROTATE 2051
#define IDS_PRINT_SAMLLER_PAPER 2052
#define IDS_INSTALLED_PENSET 2060
#define IDS_PEN_SETUP 2061
#define IDS_PENSET_FIRST IDS_PENSET_1
#define IDS_PENSET_1 2070
#define IDS_PENSET_2 2071
#define IDS_PENSET_3 2072
#define IDS_PENSET_4 2073
#define IDS_PENSET_5 2074
#define IDS_PENSET_6 2075
#define IDS_PENSET_7 2076
#define IDS_PENSET_8 2077
#define IDS_PENSET_LAST IDS_PENSET_8
#define IDS_PEN_NUM
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
2100
#define IDS_DEFAULT_PENCLR 2101
#define IDS_QUALITY_FIRST IDS_QUALITY_DRAFT
#define IDS_QUALITY_DRAFT 2110
#define IDS_QUALITY_LOW 2111
#define IDS_QUALITY_MEDIUM 2112
#define IDS_QUALITY_HIGH 2113
#define IDS_QUALITY_LAST IDS_QUALITY_HIGH
#define IDS_COLOR_FIRST IDS_WHITE
#define IDS_WHITE 2120
#define IDS_BLACK 2121
#define IDS_RED 2122
#define IDS_GREEN 2123
#define IDS_YELLOW 2124
#define IDS_BLUE 2125
#define IDS_MAGENTA 2126
#define IDS_CYAN 2127
#define IDS_ORANGE 2128
#define IDS_BROWN 2129
#define IDS_VIOLET 2130
#define IDS_COLOR_LAST IDS_VIOLET
#define IDS_FILL_TRUETYPE 2140
#define IDS_POSTER_MODE 2150
#define IDS_USERFORM 2200
//
// Help Index for Printer Properties
//
#define IDH_FORMTRAYASSIGN 5000
#define IDH_FORM_ROLL_FEEDER 5010
#define IDH_FORM_MAIN_FEEDER 5020
#define IDH_FORM_MANUAL_FEEDER 5030
#define IDH_MANUAL_FEED_METHOD 5040
#define IDH_PRINT_FORM_OPTIONS 5050
#define IDH_AUTO_ROTATE 5060
#define IDH_PRINT_SMALLER_PAPER 5070
#define IDH_HALFTONE_SETUP 5080
#define IDH_INSTALLED_PENSET 5090
#define IDH_PEN_SETUP 5100
#define IDH_PENSET 5110
#define IDH_PEN_NUM 5120
//
// Help Index for Document Properties
#define IDH_FORMNAME 5500
#define IDH_ORIENTATION 5510
#define IDH_COPIES_COLLATE 5520
#define IDH_PRINTQUALITY 5530
#define IDH_COLOR 5540
#define IDH_SCALE 5550
#define IDH_HTCLRADJ 5560
#define IDH_FILL_TRUETYPE 5570
#define IDH_POSTER_MODE 5580
#endif // _PLOTUI_
<?php
namespace App\Http\Middleware;
us
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
e Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
class EncryptCookies extends Middleware
{
/**
* The names of the cookies that should not be encrypted.
*
* @var array
*/
protected $except = [
//
];
}
//===--- ASTDiagnostic.h - Diagnostics for the AST library ------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_DIAGNOSTICAST_H
#define LLVM_CLANG_DIAGNOSTICAST_H
#include "clang/Basic/Diagnostic.h"
namespace clang {
namespace diag {
enum {
#define DIAG(ENUM,FLAGS,DEFAULT_MAPPING,DESC,GROUP,\
SFINAE,ACCESS,NOWERROR,SHOWINSYSHEADER,CATEGORY) ENUM,
#define ASTSTART
#include "clang/Basic/DiagnosticASTKinds.inc"
#undef DIAG
NUM_BUILTIN_AST_DIAGNOSTICS
};
} // end namespace diag
/// \brief DiagnosticsEngine argument formatting function for diagnostics that
/// involve AST nodes.
///
/// This function formats diagnostic arguments for various AST nodes,
/// including types, declaration names, nested name specifiers, and
/// declaration contexts, into strings that can be printed as part of
/// diagnostics. It is meant to be used as the argument to
/// \c DiagnosticsEngine::SetArgToStringFn(), where the cookie is an \c
/// ASTContext pointer.
void FormatASTNodeDiagnosticArgument(
DiagnosticsEngine::ArgumentKind Kind,
intptr_t Val,
const char *Modifier,
unsigned ModLen,
const char *Argument,
unsigned ArgLen,
const DiagnosticsEngine::ArgumentValue *PrevArgs,
unsigned NumPrevArgs,
SmallVectorImpl<char> &Output,
void *Cookie,
ArrayRef<intptr_t> QualTypeVals);
} // end namespace clang
#endif
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
bl_info = {
"name": "Render Settings",
"author": "meta-androcto, Saidenka",
"version": (0, 1, 1),
"blender": (2, 80, 0),
"location": "Render Menu, UV Editor Render Tab",
"description": "Render Settings BI & Cycles",
"warning": "",
"wiki_url": "https://github.com/meta-androcto/blenderpython/wiki/AF_Render_Settings",
"tracker_url": "https://developer.blender.org/maniphest/task/edit/form/2/",
"category": "Render"
}
import bpy
import sys
import subprocess
class RenderBackground(bpy.types.Operator):
bl_idname = "render.render_background"
bl_label = "Background Render"
bl_description = "Render From The Commandline"
bl_options = {'REGISTER'}
is_quit: bpy.props.BoolProperty(name="Quit Blender", default=True)
items = [
('IMAGE', "Image", "", 1),
('ANIME', "Animation", "", 2),
]
mode: bpy.props.EnumProperty(items=items, name="Mode", default='IMAGE')
thread: bpy.props.IntProperty(name="Threads", default=2, min=1, max=16, soft_min=1, soft_max=16)
def execute(self, context):
blend_path = bpy.data.filepath
if (not blend_path):
self.report(type={'ERROR'}, message="Save File First")
return {'CANCELLED'}
if (self.mode == 'IMAGE'):
subprocess.Popen([sys.argv[0], '-b', blend_path, '-f', str(context.scene.fram
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
e_current), '-t', str(self.thread)])
elif (self.mode == 'ANIME'):
subprocess.Popen([sys.argv[0], '-b', blend_path, '-a', '-t', str(self.thread)])
if (self.is_quit):
bpy.ops.wm.quit_blender()
return {'FINISHED'}
def invoke(self, context, event):
return context.window_manager.invoke_props_dialog(self)
class SetRenderResolutionPercentage(bpy.types.Operator):
bl_idname = "render.set_render_resolution_percentage"
bl_label = "Set Resolution"
bl_description = "Percent of the size of the resolution"
bl_options = {'REGISTER', 'UNDO'}
size: bpy.props.IntProperty(name="Rendering size (%)", default=100, min=1, max=1000, soft_min=1, soft_max=1000, step=1)
def execute(self, context):
context.scene.render.resolution_percentage = self.size
return {'FINISHED'}
class ToggleThreadsMode(bpy.types.Operator):
bl_idname = "render.toggle_threads_mode"
bl_label = "Set Threads"
bl_description = "I will switch the number of threads in the CPU to be used for rendering"
bl_options = {'REGISTER', 'UNDO'}
threads: bpy.props.IntProperty(name="Number of threads", default=1, min=1, max=16, soft_min=1, soft_max=16, step=1)
def execute(self, context):
if (context.scene.render.threads_mode == 'AUTO'):
context.scene.render.threads_mode = 'FIXED'
context.scene.render.threads = self.threads
else:
context.scene.render.threads_mode = 'AUTO'
return {'FINISHED'}
def invoke(self, context, event):
if (context.scene.render.threads_mode == 'AUTO'):
self.threads = context.scene.render.threads
return context.window_manager.invoke_props_dialog(self)
else:
return self.execute(context)
class SetAllSubsurfRenderLevels(bpy.types.Operator):
bl_idname = "render.set_all_subsurf_render_levels"
bl_label = "Set Global Subsurf"
bl_description = "Level of Subsurf to apply when rendering"
bl_options = {'REGISTER'
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
, 'UNDO'}
items = [
('ABSOLUTE', "Absolute value", "", 1),
('RELATIVE', "Relative value", "", 2),
]
mode: bpy.props.EnumProperty(items=items, name="Mode")
levels: bpy.props.IntProperty(name="Level", default=2, min=-20, max=20, soft_min=-20, soft_max=20, step=1)
def execute(self, context):
for obj in bpy.data.objects:
if (obj.type != 'MESH' and obj.type != 'CURVE'):
continue
for mod in obj.modifiers:
if (mod.type == 'SUBSURF'):
if (self.mode == 'ABSOLUTE'):
mod.render_levels = self.levels
elif (self.mode == 'RELATIVE'):
mod.render_levels += self.levels
else:
self.report(type={'ERROR'}, message="Setting value is invalid")
return {'CANCELLED'}
for area in context.screen.areas:
area.tag_redraw()
return {'FINISHED'}
class SyncAllSubsurfRenderLevels(bpy.types.Operator):
bl_idname = "render.sync_all_subsurf_render_levels"
bl_label = "Sync All Subsurf Levels"
bl_description = "sync_all_subsurf_render_levels"
bl_options = {'REGISTER', 'UNDO'}
level_offset: bpy.props.IntProperty(name="Sync Levels", default=0, min=-20, max=20, soft_min=-20, soft_max=20, step=1)
def execute(self, context):
for obj in bpy.data.objects:
if (obj.type != 'MESH'):
continue
for mod in obj.modifiers:
if (mod.type == 'SUBSURF'):
mod.render_levels = mod.levels + self.level_offset
for area in context.screen.areas:
area.tag_redraw()
return {'FINISHED'}
def invoke(self, context, event):
return context.window_manager.invoke_props_dialog(self)
################
# Render Size
################
class RenderResolutionPercentageMenu(bpy.types.Menu):
bl_idname = "TOPBAR_MT_render_resolution_percentage"
bl_label = "Render
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
ing size (%)"
bl_description = "Setting is set to either rendered in what percent of the size of the resolution"
def check(self, context):
return True
def draw(self, context):
x = bpy.context.scene.render.resolution_x
y = bpy.context.scene.render.resolution_y
self.layout.operator(SetRenderResolutionPercentage.bl_idname, text="10% (" + str(int(x * 0.1)) + "x" + str(int(y * 0.1)) + ")", icon="CAMERA_DATA").size = 10
self.layout.operator(SetRenderResolutionPercentage.bl_idname, text="20% (" + str(int(x * 0.2)) + "x" + str(int(y * 0.2)) + ")", icon="CAMERA_DATA").size = 20
self.layout.operator(SetRenderResolutionPercentage.bl_idname, text="30% (" + str(int(x * 0.3)) + "x" + str(int(y * 0.3)) + ")", icon="CAMERA_DATA").size = 30
self.layout.operator(SetRenderResolutionPercentage.bl_idname, text="40% (" + str(int(x * 0.4)) + "x" + str(int(y * 0.4)) + ")", icon="CAMERA_DATA").size = 40
self.layout.operator(SetRenderResolutionPercentage.bl_idname, text="50% (" + str(int(x * 0.5)) + "x" + str(int(y * 0.5)) + ")", icon="CAMERA_DATA").size = 50
self.layout.operator(SetRenderResolutionPercentage.bl_idname, text="60% (" + str(int(x * 0.6)) + "x" + str(int(y * 0.6)) + ")", icon="CAMERA_DATA").size = 60
self.layout.operator(SetRenderResolutionPercentage.bl_idname, text="70% (" + str(int(x * 0.7)) + "x" + str(int(y * 0.7)) + ")", icon="CAMERA_DATA").size = 70
self.layout.operator(SetRenderResolutionPercentage.bl_idname, text="80% (" + str(int(x * 0.8)) + "x" + str(int(y * 0.8)) + ")", icon="CAMERA_DATA").size = 80
self.layout.operator(SetRenderResolutionPercentage.bl_idname, text="90% (" + str(int(x * 0.9)) + "x" + str(int(y * 0.9)) + ")", icon="CAMERA_DATA").size = 90
self.layout.separator()
self.layout.operator(SetRenderResolutionPercentage.bl_idname, text="100% (" + str(int(x)) + "x" + str(int(y)) + ")", icon="CAMERA_DATA").size = 100
self.layout.separator()
self.layout.operator(SetRend
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
erResolutionPercentage.bl_idname, text="150% (" + str(int(x * 1.5)) + "x" + str(int(y * 1.5)) + ")", icon="CAMERA_DATA").size = 150
self.layout.operator(SetRenderResolutionPercentage.bl_idname, text="200% (" + str(int(x * 2.0)) + "x" + str(int(y * 2.0)) + ")", icon="CAMERA_DATA").size = 200
self.layout.operator(SetRenderResolutionPercentage.bl_idname, text="300% (" + str(int(x * 3.0)) + "x" + str(int(y * 3.0)) + ")", icon="CAMERA_DATA").size = 300
class SimplifyRenderMenu(bpy.types.Menu):
bl_idname = "TOPBAR_MT_render_simplify"
bl_label = "Simplify Render"
bl_description = "I simplified set of rendering"
def draw(self, context):
self.layout.prop(context.scene.render, "use_simplify")
self.layout.separator()
self.layout.prop(context.scene.render, "simplify_subdivision")
self.layout.prop(context.scene.render, "simplify_shadow_samples")
self.layout.prop(context.scene.render, "simplify_child_particles")
self.layout.prop(context.scene.render, "simplify_ao_sss")
self.layout.prop(context.scene.render, "use_simplify_triangulate")
class ShadeingMenu(bpy.types.Menu):
bl_idname = "TOPBAR_MT_render_shadeing"
bl_label = "Use shading"
bl_description = "Shading on / off"
def draw(self, context):
self.layout.prop(context.scene.render, 'use_textures')
self.layout.prop(context.scene.render, 'use_shadows')
self.layout.prop(context.scene.render, 'use_sss')
self.layout.prop(context.scene.render, 'use_envmaps')
self.layout.prop(context.scene.render, 'use_raytrace')
class SubsurfMenu(bpy.types.Menu):
bl_idname = "TOPBAR_MT_render_subsurf"
bl_label = "Subsurf Level All"
bl_description = "Subsurf subdivision level of all objects"
def draw(self, context):
operator = self.layout.operator(SetAllSubsurfRenderLevels.bl_idname, text="Subdivision + 1", icon="MOD_SUBSURF")
operator.mode = 'RELATIVE'
operator.levels = 1
operator = self.layout.operato
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
r(SetAllSubsurfRenderLevels.bl_idname, text="Subdivision - 1", icon="MOD_SUBSURF")
operator.mode = 'RELATIVE'
operator.levels = -1
self.layout.separator()
operator = self.layout.operator(SetAllSubsurfRenderLevels.bl_idname, text="Subdivision = 0", icon="MOD_SUBSURF")
operator.mode = 'ABSOLUTE'
operator.levels = 0
operator = self.layout.operator(SetAllSubsurfRenderLevels.bl_idname, text="Subdivision = 1", icon="MOD_SUBSURF")
operator.mode = 'ABSOLUTE'
operator.levels = 1
operator = self.layout.operator(SetAllSubsurfRenderLevels.bl_idname, text="Subdivision = 2", icon="MOD_SUBSURF")
operator.mode = 'ABSOLUTE'
operator.levels = 2
operator = self.layout.operator(SetAllSubsurfRenderLevels.bl_idname, text="Subdivision = 3", icon="MOD_SUBSURF")
operator.mode = 'ABSOLUTE'
operator.levels = 3
self.layout.separator()
self.layout.operator(SyncAllSubsurfRenderLevels.bl_idname, text="Sync Subsurf Render Levels", icon="MOD_SUBSURF")
class RenderToolsMenu(bpy.types.Operator):
bl_idname = "render.render_tools"
bl_label = "Render Settings"
bl_description = "Pop up Render Settings"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'CYCLES'}
def draw(self, context):
# Cycles
layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN'
scene = context.scene
cscene = scene.cycles
self.layout.label(text="Render Cycles")
self.layout.separator()
self.layout.operator("render.render", text="Render Image").use_viewport = True
self.layout.operator("render.render", text="Render Animation")
self.layout.separator()
self.layout.prop(context.scene.render, 'resolution_x', text="Resolution X")
self.layout.prop(context.scene.render, 'resolution_y', text="Resolution Y")
self.layout.prop(context.scene.render, "resolution_percentage", text="Render Resolution")
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
self.layout.menu(RenderResolutionPercentageMenu.bl_idname, text="Resolution Presets")
self.layout.prop_menu_enum(context.scene.render.image_settings, 'file_format', text="File Format")
self.layout.separator()
self.layout.menu(AnimateRenderMenu.bl_idname, text="Animation")
self.layout.separator()
self.layout.prop(context.scene.world.light_settings, 'use_ambient_occlusion', text="Use AO")
self.layout.prop(context.scene.world.light_settings, "ao_factor", text="AO Factor")
self.layout.separator()
self.layout.label(text="Samples:")
self.layout.prop(cscene, "samples", text="Render")
self.layout.prop(cscene, "preview_samples", text="Preview")
self.layout.separator()
self.layout.prop(context.scene.render, 'use_freestyle', text="Use Freestyle")
self.layout.separator()
self.layout.menu(SimplifyRenderMenu.bl_idname)
self.layout.menu(SubsurfMenu.bl_idname)
self.layout.separator()
self.layout.operator(ToggleThreadsMode.bl_idname, text='Set Threads')
self.layout.operator(RenderBackground.bl_idname)
def execute(self, context):
return {'FINISHED'}
def invoke(self, context, event):
return context.window_manager.invoke_popup(self, width=250)
# Menu
def menu(self, context):
self.layout.separator()
self.layout.operator(RenderToolsMenu.bl_idname)
class AnimateRenderMenu(bpy.types.Menu):
bl_idname = "TOPBAR_MT_render_animate_menu"
bl_label = "Animation"
bl_description = "Set Frames & Animation Length"
def draw(self, context):
self.layout.separator()
self.layout.prop(context.scene, 'frame_start', text="Start Frame")
self.layout.prop(context.scene, 'frame_end', text="End Frame")
self.layout.prop(context.scene, 'frame_step', text="Frame Step")
self.layout.prop(context.scene.render, 'fps', text="FPS")
class IMAGE_PT_RenderSettingsPanel(bpy.types.Panel):
"""Render Settings Panel"""
bl_la
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
bel = "Render settings"
bl_space_type = 'IMAGE_EDITOR'
bl_category = 'Render'
bl_region_type = 'UI'
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'CYCLES'}
def draw(self, context):
# Cycles
layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN'
scene = context.scene
cscene = scene.cycles
self.layout.label(text="Render Settings")
self.layout.separator()
self.layout.operator("render.render", text="Render Image").use_viewport = True
self.layout.operator("render.render", text="Render Animation",)
self.layout.separator()
self.layout.prop(context.scene.render, 'resolution_x', text="Resolution X")
self.layout.prop(context.scene.render, 'resolution_y', text="Resolution Y")
self.layout.prop(context.scene.render, "resolution_percentage", text="Render Resolution")
self.layout.menu(RenderResolutionPercentageMenu.bl_idname, text="Resolution Presets")
self.layout.prop_menu_enum(context.scene.render.image_settings, 'file_format', text="File Format")
self.layout.separator()
self.layout.menu(AnimateRenderMenu.bl_idname, text="Animation")
self.layout.separator()
self.layout.prop(context.scene.world.light_settings, 'use_ambient_occlusion', text="Use AO")
self.layout.prop(context.scene.world.light_settings, "ao_factor", text="AO Factor")
self.layout.separator()
self.layout.label(text="Samples:")
self.layout.prop(cscene, "samples", text="Render")
self.layout.prop(cscene, "preview_samples", text="Preview")
self.layout.separator()
self.layout.prop(context.scene.render, 'use_freestyle', text="Use Freestyle")
self.layout.separator()
self.layout.menu(SimplifyRenderMenu.bl_idname)
self.layout.menu(SubsurfMenu.bl_idname)
self.layout.separator()
self.layout.operator(ToggleThreadsMode.bl_idname, text='Set Threads')
self.layout.ope
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
rator(RenderBackground.bl_idname)
def execute(self, context):
return {'FINISHED'}
def invoke(self, context, event):
return context.window_manager.invoke_popup(self, width=250)
# Class List
classes = (
RenderBackground,
SetRenderResolutionPercentage,
ToggleThreadsMode,
SetAllSubsurfRenderLevels,
SyncAllSubsurfRenderLevels,
RenderResolutionPercentageMenu,
SimplifyRenderMenu,
ShadeingMenu,
SubsurfMenu,
RenderToolsMenu,
AnimateRenderMenu,
IMAGE_PT_RenderSettingsPanel
)
# register
def register():
for cls in classes:
bpy.utils.register_class(cls)
bpy.types.TOPBAR_MT_render.append(menu)
# unregister
def unregister():
bpy.types.TOPBAR_MT_render.remove(menu)
for cls in classes:
bpy.utils.unregister_class(cls)
if __name__ == "__main__":
register()
SHA256 (ToolSet-1.00.tar.gz) = cc545d98e42e5cbcbf6e9df1f2a4de4e3e65d10b3ea07075b98a3afb96f3c24e
SIZE (ToolSet-1.00.tar.gz) = 17623
//
// JPSImagePickerControllerDemoTests.m
// JPSImagePickerControllerDemoTests
//
// Created by JP Simard on 1/31/2014.
// Copyright (c) 2014 JP Simard. All rights reserved.
//
#import <XCTest/XCTest.h>
@interface JPSImagePickerControllerDemoTests : XCTestCase
@end
@implementation JPSImagePickerControllerDemoTests
- (void)setUp
{
[super setUp];
// Put setup code here. This method is called before the invocation of each test method in the class.
}
- (void)tearDown
{
// Put teardown code here. This method is called after the invocation of each test method in the class.
[super tearDown];
}
- (void)testExample
{
XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__);
}
@end
/*
* Copyright (c) 2017 Fuzhou Rockchip Electronics Co., Ltd.
*
* SPDX-License-Identifier: GPL-2.0+
*/
/dts-v1/;
#include <dt-bindings/pwm/pwm.h>
#include <dt-bindings/pinctrl/rockchip.h>
#include "rk3399.dtsi"
#include "rk3399-sdram-ddr3-1333.dtsi"
/ {
model = "Firefly-RK3399 Board";
compatible = "firefly,firef
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
ly-rk3399", "rockchip,rk3399";
chosen {
stdout-path = &uart2;
};
backlight: backlight {
compatible = "pwm-backlight";
enable-gpios = <&gpio1 RK_PB5 GPIO_ACTIVE_HIGH>;
pwms = <&pwm0 0 25000 0>;
brightness-levels = <
0 1 2 3 4 5 6 7
8 9 10 11 12 13 14 15
16 17 18 19 20 21 22 23
24 25 26 27 28 29 30 31
32 33 34 35 36 37 38 39
40 41 42 43 44 45 46 47
48 49 50 51 52 53 54 55
56 57 58 59 60 61 62 63
64 65 66 67 68 69 70 71
72 73 74 75 76 77 78 79
80 81 82 83 84 85 86 87
88 89 90 91 92 93 94 95
96 97 98 99 100 101 102 103
104 105 106 107 108 109 110 111
112 113 114 115 116 117 118 119
120 121 122 123 124 125 126 127
128 129 130 131 132 133 134 135
136 137 138 139 140 141 142 143
144 145 146 147 148 149 150 151
152 153 154 155 156 157 158 159
160 161 162 163 164 165 166 167
168 169 170 171 172 173 174 175
176 177 178 179 180 181 182 183
184 185 186 187 188 189 190 191
192 193 194 195 196 197 198 199
200 201 202 203 204 205 206 207
208 209 210 211 212 213 214 215
216 217 218 219 220 221 222 223
224 225 226 227 228 229 230 231
232 233 234 235 236 237 238 239
240 241 242 243 244 245 246 247
248 249 250 251 252 253 254 255>;
default-brightness-level = <200>;
};
clkin_gmac: external-gmac-clock {
compatible = "fixed-clock";
clock-frequency = <125000000>;
clock-output-names = "clkin_gmac";
#clock-cells = <0>;
};
rt5640-sound {
compatible = "simple-audio-card";
simple-audio-card,name = "rockchip,rt5640-codec";
simple-audio-card,format = "i2s";
simple-audio-card,mclk-fs = <256>;
simple-audio-card,widgets =
"Microphone", "Mic Jack",
"Headphone", "Headphone Jack";
simple-audio-card,routing =
"Mic Jack", "MICBIAS1",
"IN1P", "Mic Jack",
"Headphone Jack", "HPOL",
"Headphone Jack", "HPOR";
simple-audio-card,cpu {
sound-dai = <&i2s1>;
};
simple-audio-card,codec {
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
sound-dai = <&rt5640>;
};
};
sdio_pwrseq: sdio-pwrseq {
compatible = "mmc-pwrseq-simple";
clocks = <&rk808 1>;
clock-names = "ext_clock";
pinctrl-names = "default";
pinctrl-0 = <&wifi_enable_h>;
/*
* On the module itself this is one of these (depending
* on the actual card populated):
* - SDIO_RESET_L_WL_REG_ON
* - PDN (power down when low)
*/
reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>;
};
vcc3v3_pcie: vcc3v3-pcie-regulator {
compatible = "regulator-fixed";
enable-active-high;
gpio = <&gpio1 RK_PC1 GPIO_ACTIVE_HIGH>;
pinctrl-names = "default";
pinctrl-0 = <&pcie_drv>;
regulator-name = "vcc3v3_pcie";
regulator-always-on;
regulator-boot-on;
};
vcc3v3_sys: vcc3v3-sys {
compatible = "regulator-fixed";
regulator-name = "vcc3v3_sys";
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
};
vcc5v0_host: vcc5v0-host-regulator {
compatible = "regulator-fixed";
enable-active-high;
gpio = <&gpio1 RK_PA0 GPIO_ACTIVE_HIGH>;
pinctrl-names = "default";
pinctrl-0 = <&host_vbus_drv>;
regulator-name = "vcc5v0_host";
regulator-always-on;
};
vcc5v0_sys: vcc5v0-sys {
compatible = "regulator-fixed";
regulator-name = "vcc5v0_sys";
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
};
vcc_phy: vcc-phy-regulator {
compatible = "regulator-fixed";
regulator-name = "vcc_phy";
regulator-always-on;
regulator-boot-on;
};
vdd_log: vdd-log {
compatible = "pwm-regulator";
pwms = <&pwm2 0 25000 1>;
regulator-name = "vdd_log";
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <800000>;
regulator-max-microvolt = <1400000>;
};
vccadc_ref: vccadc-ref {
compatible = "regulator-fixed";
regulator-name = "vcc1v8_sys";
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
};
};
&cpu_l0 {
cpu-supply = <&vdd_cpu_
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
l>;
};
&cpu_l1 {
cpu-supply = <&vdd_cpu_l>;
};
&cpu_l2 {
cpu-supply = <&vdd_cpu_l>;
};
&cpu_l3 {
cpu-supply = <&vdd_cpu_l>;
};
&cpu_b0 {
cpu-supply = <&vdd_cpu_b>;
};
&cpu_b1 {
cpu-supply = <&vdd_cpu_b>;
};
&emmc_phy {
status = "okay";
};
&gmac {
assigned-clocks = <&cru SCLK_RMII_SRC>;
assigned-clock-parents = <&clkin_gmac>;
clock_in_out = "input";
phy-supply = <&vcc_phy>;
phy-mode = "rgmii";
pinctrl-names = "default";
pinctrl-0 = <&rgmii_pins>;
snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
snps,reset-active-low;
snps,reset-delays-us = <0 10000 50000>;
tx_delay = <0x28>;
rx_delay = <0x11>;
status = "okay";
};
&i2c0 {
clock-frequency = <400000>;
i2c-scl-rising-time-ns = <168>;
i2c-scl-falling-time-ns = <4>;
status = "okay";
rk808: pmic@1b {
compatible = "rockchip,rk808";
reg = <0x1b>;
interrupt-parent = <&gpio1>;
interrupts = <21 IRQ_TYPE_LEVEL_LOW>;
#clock-cells = <1>;
clock-output-names = "xin32k", "rk808-clkout2";
pinctrl-names = "default";
pinctrl-0 = <&pmic_int_l>;
rockchip,system-power-controller;
wakeup-source;
vcc1-supply = <&vcc3v3_sys>;
vcc2-supply = <&vcc3v3_sys>;
vcc3-supply = <&vcc3v3_sys>;
vcc4-supply = <&vcc3v3_sys>;
vcc6-supply = <&vcc3v3_sys>;
vcc7-supply = <&vcc3v3_sys>;
vcc8-supply = <&vcc3v3_sys>;
vcc9-supply = <&vcc3v3_sys>;
vcc10-supply = <&vcc3v3_sys>;
vcc11-supply = <&vcc3v3_sys>;
vcc12-supply = <&vcc3v3_sys>;
vddio-supply = <&vcc1v8_pmu>;
regulators {
vdd_center: DCDC_REG1 {
regulator-name = "vdd_center";
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <750000>;
regulator-max-microvolt = <1350000>;
regulator-ramp-delay = <6001>;
regulator-state-mem {
regulator-off-in-suspend;
};
};
vdd_cpu_l: DCDC_REG2 {
regulator-name = "vdd_cpu_l";
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <750000>;
regulator-max-microvolt = <1350000>;
regulator-ramp-delay = <6001>;
regulator-state-mem {
regulator-of
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
f-in-suspend;
};
};
vcc_ddr: DCDC_REG3 {
regulator-name = "vcc_ddr";
regulator-always-on;
regulator-boot-on;
regulator-state-mem {
regulator-on-in-suspend;
};
};
vcc_1v8: DCDC_REG4 {
regulator-name = "vcc_1v8";
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-state-mem {
regulator-on-in-suspend;
regulator-suspend-microvolt = <1800000>;
};
};
vcc1v8_dvp: LDO_REG1 {
regulator-name = "vcc1v8_dvp";
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-state-mem {
regulator-off-in-suspend;
};
};
vcc3v0_tp: LDO_REG2 {
regulator-name = "vcc3v0_tp";
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <3000000>;
regulator-max-microvolt = <3000000>;
regulator-state-mem {
regulator-off-in-suspend;
};
};
vcc1v8_pmu: LDO_REG3 {
regulator-name = "vcc1v8_pmu";
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-state-mem {
regulator-on-in-suspend;
regulator-suspend-microvolt = <1800000>;
};
};
vcc_sd: LDO_REG4 {
regulator-name = "vcc_sd";
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <3300000>;
regulator-state-mem {
regulator-on-in-suspend;
regulator-suspend-microvolt = <3300000>;
};
};
vcca3v0_codec: LDO_REG5 {
regulator-name = "vcca3v0_codec";
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <3000000>;
regulator-max-microvolt = <3000000>;
regulator-state-mem {
regulator-off-in-suspend;
};
};
vcc_1v5: LDO_REG6 {
regulator-name = "vcc_1v5";
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <1500000>;
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
regulator-max-microvolt = <1500000>;
regulator-state-mem {
regulator-on-in-suspend;
regulator-suspend-microvolt = <1500000>;
};
};
vcca1v8_codec: LDO_REG7 {
regulator-name = "vcca1v8_codec";
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-state-mem {
regulator-off-in-suspend;
};
};
vcc_3v0: LDO_REG8 {
regulator-name = "vcc_3v0";
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <3000000>;
regulator-max-microvolt = <3000000>;
regulator-state-mem {
regulator-on-in-suspend;
regulator-suspend-microvolt = <3000000>;
};
};
vcc3v3_s3: SWITCH_REG1 {
regulator-name = "vcc3v3_s3";
regulator-always-on;
regulator-boot-on;
regulator-state-mem {
regulator-off-in-suspend;
};
};
vcc3v3_s0: SWITCH_REG2 {
regulator-name = "vcc3v3_s0";
regulator-always-on;
regulator-boot-on;
regulator-state-mem {
regulator-off-in-suspend;
};
};
};
};
vdd_cpu_b: regulator@40 {
compatible = "silergy,syr827";
reg = <0x40>;
fcs,suspend-voltage-selector = <0>;
regulator-name = "vdd_cpu_b";
regulator-min-microvolt = <712500>;
regulator-max-microvolt = <1500000>;
regulator-ramp-delay = <1000>;
regulator-always-on;
regulator-boot-on;
vin-supply = <&vcc5v0_sys>;
regulator-state-mem {
regulator-off-in-suspend;
};
};
vdd_gpu: regulator@41 {
compatible = "silergy,syr828";
reg = <0x41>;
fcs,suspend-voltage-selector = <1>;
regulator-name = "vdd_gpu";
regulator-min-microvolt = <712500>;
regulator-max-microvolt = <1500000>;
regulator-ramp-delay = <1000>;
regulator-always-on;
regulator-boot-on;
vin-supply = <&vcc5v0_sys>;
regulator-state-mem {
regulator-off-in-suspend;
};
};
};
&i2c1 {
i2c-scl-rising-time-ns = <300>;
i2c-scl-falling-time-ns = <15>;
status = "okay";
rt5640: rt5640@1c {
compatible = "realtek,rt5640";
reg = <0x1c>;
clo
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
cks = <&cru SCLK_I2S_8CH_OUT>;
clock-names = "mclk";
realtek,in1-differential;
#sound-dai-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&rt5640_hpcon>;
};
};
&i2c3 {
i2c-scl-rising-time-ns = <450>;
i2c-scl-falling-time-ns = <15>;
status = "okay";
};
&i2c4 {
i2c-scl-rising-time-ns = <600>;
i2c-scl-falling-time-ns = <20>;
status = "okay";
accelerometer@68 {
compatible = "invensense,mpu6500";
reg = <0x68>;
interrupt-parent = <&gpio1>;
interrupts = <RK_PC6 IRQ_TYPE_EDGE_RISING>;
};
};
&i2s0 {
rockchip,playback-channels = <8>;
rockchip,capture-channels = <8>;
#sound-dai-cells = <0>;
status = "okay";
};
&i2s1 {
rockchip,playback-channels = <2>;
rockchip,capture-channels = <2>;
#sound-dai-cells = <0>;
status = "okay";
};
&i2s2 {
#sound-dai-cells = <0>;
status = "okay";
};
&io_domains {
status = "okay";
bt656-supply = <&vcc1v8_dvp>;
audio-supply = <&vcca1v8_codec>;
sdmmc-supply = <&vcc_sd>;
gpio1830-supply = <&vcc_3v0>;
};
&pcie_phy {
status = "okay";
};
&pcie0 {
ep-gpios = <&gpio4 RK_PD1 GPIO_ACTIVE_HIGH>;
num-lanes = <4>;
pinctrl-names = "default";
pinctrl-0 = <&pcie_clkreqn>;
status = "okay";
};
&pmu_io_domains {
pmu1830-supply = <&vcc_3v0>;
status = "okay";
};
&pinctrl {
buttons {
pwrbtn: pwrbtn {
rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>;
};
};
lcd-panel {
lcd_panel_reset: lcd-panel-reset {
rockchip,pins = <4 RK_PD6 RK_FUNC_GPIO &pcfg_pull_up>;
};
};
pcie {
pcie_drv: pcie-drv {
rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>;
};
pcie_3g_drv: pcie-3g-drv {
rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>;
};
};
pmic {
vsel1_gpio: vsel1-gpio {
rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_down>;
};
vsel2_gpio: vsel2-gpio {
rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>;
};
};
sdio-pwrseq {
wifi_enable_h: wifi-enable-h {
rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>;
};
};
rt5640 {
rt5640_hpcon: rt5640-hpcon {
rockchip,pins = <4 RK_P
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
C5 RK_FUNC_GPIO &pcfg_pull_none>;
};
};
pmic {
pmic_int_l: pmic-int-l {
rockchip,pins = <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>;
};
};
usb2 {
host_vbus_drv: host-vbus-drv {
rockchip,pins = <1 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>;
};
};
};
&pwm0 {
status = "okay";
};
&pwm2 {
status = "okay";
};
&saradc {
vref-supply = <&vccadc_ref>;
status = "okay";
};
&sdhci {
bus-width = <8>;
keep-power-in-suspend;
mmc-hs400-1_8v;
mmc-hs400-enhanced-strobe;
non-removable;
status = "okay";
};
&tsadc {
/* tshut mode 0:CRU 1:GPIO */
rockchip,hw-tshut-mode = <1>;
/* tshut polarity 0:LOW 1:HIGH */
rockchip,hw-tshut-polarity = <1>;
status = "okay";
};
&u2phy0 {
status = "okay";
u2phy0_otg: otg-port {
status = "okay";
};
u2phy0_host: host-port {
phy-supply = <&vcc5v0_host>;
status = "okay";
};
};
&u2phy1 {
status = "okay";
u2phy1_otg: otg-port {
status = "okay";
};
u2phy1_host: host-port {
phy-supply = <&vcc5v0_host>;
status = "okay";
};
};
&uart0 {
pinctrl-names = "default";
pinctrl-0 = <&uart0_xfer &uart0_cts>;
status = "okay";
};
&uart2 {
status = "okay";
};
&usb_host0_ehci {
status = "okay";
};
&usb_host0_ohci {
status = "okay";
};
&usb_host1_ehci {
status = "okay";
};
&usb_host1_ohci {
status = "okay";
};
#!/bin/bash
: << '--COMMENT--'
Dependencies
sudo apt-get install tree
--COMMENT--
## set file date
## find ~/.local/share/0ad/mods/hannibal -exec touch -t 201501220000 {} \;
## paths
# pathRoot="/Daten/Dropbox/Projects/hannibal/"
pathCode="/home/noiv/.local/share/0ad/mods/hannibal/simulation/ai/hannibal"
pathDistri="/Daten/Dropbox/Projects/hannibal"
pathDiffer="/home/noiv/Sources/prettydiff-master"
## files
compiler="/home/noiv/Programs/closure-compiler/compiler.jar"
echo
echo "-- Start"
echo
## STATIC
cd $pathDistri
cp LICENCE.txt "${pathDistri}/mods/hannibal/LICENCE.txt"
cp README.md "${pathDistri}/mods/hannibal/README.md"
cp readme.txt "${pathDistri}/mods/hannibal.readme.txt"
cd $pathCode
cp data.json "${path
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
Distri}/mods/hannibal/simulation/ai/hannibal/data.json"
## DYNAMIC
cd $pathCode
rm -f \
hannibal.m.js \
_debug.js
ls _*.js | xargs cat > _.jss
ls [a-z]*.js | xargs cat > az.jss
cat _.jss az.jss > hannibal.m.js
rm -f \
_.jss \
az.jss
mv hannibal.m.js "${pathDistri}/mods/hannibal/simulation/ai/hannibal/hannibal.m.js"
echo
echo counting locs in hannibal.m.js ...
cd "${pathDistri}/mods/hannibal/simulation/ai/hannibal/"
cat hannibal.m.js | grep -v ^$ | wc -l
## java -jar compiler.jar --help
## real compress
# --compilation_level SIMPLE_OPTIMIZATIONS \
# --language_out ES5_strict \
# --tracer_mode ALL \
# --language_in ECMASCRIPT6_STRICT \
# --language_out ECMASCRIPT6_STRICT \
echo
echo compressing...
cd "${pathDistri}/mods/hannibal/simulation/ai/hannibal/"
# java -jar $compiler \
# --compilation_level WHITESPACE_ONLY \
# --js hannibal.m.js --js_output_file hannibal.js
fileMini="${pathDistri}/mods/hannibal/simulation/ai/hannibal/hannibal.m.js"
fileFina="${pathDistri}/mods/hannibal/simulation/ai/hannibal/hannibal.js"
echo "${pathDiffer}/api/node-local.js source:'${fileMini}' mode:'minify' readmethod:'file' output:'hannibal.js'"
js "${pathDiffer}/api/node-local.js source:'${fileMini}' mode:minify" ## source:'hannibal.m.js' mode:'minify' readmethod:'file' output:'hannibal.js'"
## fake compress
# cd "${pathDistri}/mods/hannibal/simulation/ai/hannibal/"
# cp hannibal.m.js hannibal.u.js
# cp hannibal.u.js hannibal.p.js
# cp hannibal.p.js hannibal.js
## clearup compress
cd "${pathDistri}/mods/hannibal/simulation/ai/hannibal/"
rm -f \
# hannibal.m.js \
hannibal.u.js \
hannibal.p.js
## ZIP
echo
echo zipping...
cd "${pathDistri}/mods/"
rm -f hannibal.zip
zip hannibal.zip \
hannibal/mod.json \
hannibal/README.md \
hannibal/LICENCE.txt \
hannibal/simulation/ai/hannibal/data.json \
hannibal/simulation/ai/hannibal/hannibal.js
## CHECK
cd "${pathDistri}/mods/"
tre
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
e
unzip -l hannibal.zip
echo
echo "-- Done --"
echo
// Copyright 2015 The etcd 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 snap
import (
"errors"
"fmt"
"hash/crc32"
"io/ioutil"
"os"
"path/filepath"
"sort"
"strings"
"time"
"go.etcd.io/etcd/etcdserver/api/snap/snappb"
pioutil "go.etcd.io/etcd/pkg/ioutil"
"go.etcd.io/etcd/pkg/pbutil"
"go.etcd.io/etcd/raft"
"go.etcd.io/etcd/raft/raftpb"
"github.com/coreos/pkg/capnslog"
"go.uber.org/zap"
)
const snapSuffix = ".snap"
var (
plog = capnslog.NewPackageLogger("go.etcd.io/etcd/v3", "snap")
ErrNoSnapshot = errors.New("snap: no available snapshot")
ErrEmptySnapshot = errors.New("snap: empty snapshot")
ErrCRCMismatch = errors.New("snap: crc mismatch")
crcTable = crc32.MakeTable(crc32.Castagnoli)
// A map of valid files that can be present in the snap folder.
validFiles = map[string]bool{
"db": true,
}
)
type Snapshotter struct {
lg *zap.Logger
dir string
}
func New(lg *zap.Logger, dir string) *Snapshotter {
return &Snapshotter{
lg: lg,
dir: dir,
}
}
func (s *Snapshotter) SaveSnap(snapshot raftpb.Snapshot) error {
if raft.IsEmptySnap(snapshot) {
return nil
}
return s.save(&snapshot)
}
func (s *Snapshotter) save(snapshot *raftpb.Snapshot) error {
start := time.Now()
fname := fmt.Sprintf("%016x-%016x%s", snapshot.Metadata.Term, snapshot.Metadata.Index, snapSuffix)
b := pbutil.MustMarshal(snapshot)
crc := crc32.Update(0, crcTable, b)
snap := snappb.Snapshot{Crc: crc, Data: b}
d, err
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
:= snap.Marshal()
if err != nil {
return err
}
snapMarshallingSec.Observe(time.Since(start).Seconds())
spath := filepath.Join(s.dir, fname)
fsyncStart := time.Now()
err = pioutil.WriteAndSyncFile(spath, d, 0666)
snapFsyncSec.Observe(time.Since(fsyncStart).Seconds())
if err != nil {
if s.lg != nil {
s.lg.Warn("failed to write a snap file", zap.String("path", spath), zap.Error(err))
}
rerr := os.Remove(spath)
if rerr != nil {
if s.lg != nil {
s.lg.Warn("failed to remove a broken snap file", zap.String("path", spath), zap.Error(err))
} else {
plog.Errorf("failed to remove broken snapshot file %s", spath)
}
}
return err
}
snapSaveSec.Observe(time.Since(start).Seconds())
return nil
}
func (s *Snapshotter) Load() (*raftpb.Snapshot, error) {
names, err := s.snapNames()
if err != nil {
return nil, err
}
var snap *raftpb.Snapshot
for _, name := range names {
if snap, err = loadSnap(s.lg, s.dir, name); err == nil {
break
}
}
if err != nil {
return nil, ErrNoSnapshot
}
return snap, nil
}
func loadSnap(lg *zap.Logger, dir, name string) (*raftpb.Snapshot, error) {
fpath := filepath.Join(dir, name)
snap, err := Read(lg, fpath)
if err != nil {
brokenPath := fpath + ".broken"
if lg != nil {
lg.Warn("failed to read a snap file", zap.String("path", fpath), zap.Error(err))
}
if rerr := os.Rename(fpath, brokenPath); rerr != nil {
if lg != nil {
lg.Warn("failed to rename a broken snap file", zap.String("path", fpath), zap.String("broken-path", brokenPath), zap.Error(rerr))
} else {
plog.Warningf("cannot rename broken snapshot file %v to %v: %v", fpath, brokenPath, rerr)
}
} else {
if lg != nil {
lg.Warn("renamed to a broken snap file", zap.String("path", fpath), zap.String("broken-path", brokenPath))
}
}
}
return snap, err
}
// Read reads the snapshot named by snapname and returns the snapshot.
func Read(lg *zap.Logger, snapname string) (*raftpb.Snapshot, error) {
b, err := ioutil.ReadFile(snapname)
if err != nil
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
{
if lg != nil {
lg.Warn("failed to read a snap file", zap.String("path", snapname), zap.Error(err))
} else {
plog.Errorf("cannot read file %v: %v", snapname, err)
}
return nil, err
}
if len(b) == 0 {
if lg != nil {
lg.Warn("failed to read empty snapshot file", zap.String("path", snapname))
} else {
plog.Errorf("unexpected empty snapshot")
}
return nil, ErrEmptySnapshot
}
var serializedSnap snappb.Snapshot
if err = serializedSnap.Unmarshal(b); err != nil {
if lg != nil {
lg.Warn("failed to unmarshal snappb.Snapshot", zap.String("path", snapname), zap.Error(err))
} else {
plog.Errorf("corrupted snapshot file %v: %v", snapname, err)
}
return nil, err
}
if len(serializedSnap.Data) == 0 || serializedSnap.Crc == 0 {
if lg != nil {
lg.Warn("failed to read empty snapshot data", zap.String("path", snapname))
} else {
plog.Errorf("unexpected empty snapshot")
}
return nil, ErrEmptySnapshot
}
crc := crc32.Update(0, crcTable, serializedSnap.Data)
if crc != serializedSnap.Crc {
if lg != nil {
lg.Warn("snap file is corrupt",
zap.String("path", snapname),
zap.Uint32("prev-crc", serializedSnap.Crc),
zap.Uint32("new-crc", crc),
)
} else {
plog.Errorf("corrupted snapshot file %v: crc mismatch", snapname)
}
return nil, ErrCRCMismatch
}
var snap raftpb.Snapshot
if err = snap.Unmarshal(serializedSnap.Data); err != nil {
if lg != nil {
lg.Warn("failed to unmarshal raftpb.Snapshot", zap.String("path", snapname), zap.Error(err))
} else {
plog.Errorf("corrupted snapshot file %v: %v", snapname, err)
}
return nil, err
}
return &snap, nil
}
// snapNames returns the filename of the snapshots in logical time order (from newest to oldest).
// If there is no available snapshots, an ErrNoSnapshot will be returned.
func (s *Snapshotter) snapNames() ([]string, error) {
dir, err := os.Open(s.dir)
if err != nil {
return nil, err
}
defer dir.Close()
names, err := dir.Readdirnames(-1)
if err != nil {
return nil, err
}
sna
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
ps := checkSuffix(s.lg, names)
if len(snaps) == 0 {
return nil, ErrNoSnapshot
}
sort.Sort(sort.Reverse(sort.StringSlice(snaps)))
return snaps, nil
}
func checkSuffix(lg *zap.Logger, names []string) []string {
snaps := []string{}
for i := range names {
if strings.HasSuffix(names[i], snapSuffix) {
snaps = append(snaps, names[i])
} else {
// If we find a file which is not a snapshot then check if it's
// a vaild file. If not throw out a warning.
if _, ok := validFiles[names[i]]; !ok {
if lg != nil {
lg.Warn("found unexpected non-snap file; skipping", zap.String("path", names[i]))
} else {
plog.Warningf("skipped unexpected non snapshot file %v", names[i])
}
}
}
}
return snaps
}
module Admin::SectionsHelper
end
// Copyright 2008, Google Inc.
// All rights reserved.
//
// 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
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
, 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.
//
// The Google C++ Testing and Mocking Framework (Google Test)
//
// This header file provides classes and functions used internally
// for testing Google Test itself.
#ifndef GTEST_TEST_GTEST_PARAM_TEST_TEST_H_
#define GTEST_TEST_GTEST_PARAM_TEST_TEST_H_
#include "gtest/gtest.h"
// Test fixture for testing definition and instantiation of a test
// in separate translation units.
class ExternalInstantiationTest : public ::testing::TestWithParam<int> {
};
// Test fixture for testing instantiation of a test in multiple
// translation units.
class InstantiationInMultipleTranslaionUnitsTest
: public ::testing::TestWithParam<int> {
};
#endif // GTEST_TEST_GTEST_PARAM_TEST_TEST_H_
/**
* \file
*
* \brief Linker script for running in internal FLASH on the SAMD21G18A
*
* Copyright (c) 2017 Microchip Technology Inc.
*
* \asf_license_start
*
* \page License
*
* SPDX-License-Identifier: Apache-2.0
*
* 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 Licence 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.
*
* \asf_license_stop
*
*/
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
SEARCH_DIR(.)
/* Memory Spaces Definitions */
MEMORY
{
rom (rx) : ORIGIN = 0x00000000 + 8K, LENGTH = 0x00040000 - 8K /* 8K offset to preserve bootloader */
ra
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
m (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x2000;
ENTRY(Reset_Handler)
/* Section Definitions */
SECTIONS
{
.text :
{
. = ALIGN(4);
_sfixed = .;
KEEP(*(.vectors .vectors.*))
*(.text .text.* .gnu.linkonce.t.*)
*(.glue_7t) *(.glue_7)
*(.rodata .rodata* .gnu.linkonce.r.*)
*(.ARM.extab* .gnu.linkonce.armextab.*)
/* Support C constructors, and C destructors in both user code
and the C library. This also provides support for C++ code. */
. = ALIGN(4);
KEEP(*(.init))
. = ALIGN(4);
__preinit_array_start = .;
KEEP (*(.preinit_array))
__preinit_array_end = .;
. = ALIGN(4);
__init_array_start = .;
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
__init_array_end = .;
. = ALIGN(4);
KEEP (*crtbegin.o(.ctors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*crtend.o(.ctors))
. = ALIGN(4);
KEEP(*(.fini))
. = ALIGN(4);
__fini_array_start = .;
KEEP (*(.fini_array))
KEEP (*(SORT(.fini_array.*)))
__fini_array_end = .;
KEEP (*crtbegin.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*crtend.o(.dtors))
. = ALIGN(4);
_efixed = .; /* End of text section */
} > rom
/* .ARM.exidx is sorted, so has to go in its own output section. */
PROVIDE_HIDDEN (__exidx_start = .);
.ARM.exidx :
{
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
} > rom
PROVIDE_HIDDEN (__exidx_end = .);
. = ALIGN(4);
_etext = .;
.relocate : AT (_etext)
{
. = ALIGN(4);
_srelocate = .;
*(.ramfunc .ramfunc.
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
*);
*(.data .data.*);
. = ALIGN(4);
_erelocate = .;
} > ram
/* .bss section which is used for uninitialized data */
.bss (NOLOAD) :
{
. = ALIGN(4);
_sbss = . ;
_szero = .;
*(.bss .bss.*)
*(COMMON)
. = ALIGN(4);
_ebss = . ;
_ezero = .;
end = .;
} > ram
/* stack section */
.stack (NOLOAD):
{
. = ALIGN(8);
_sstack = .;
. = . + STACK_SIZE;
. = ALIGN(8);
_estack = .;
} > ram
. = ALIGN(4);
_end = . ;
}
class FalseClass
def to_json(options = nil) #:nodoc:
'false'
end
end
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://curl.haxx.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
###########################################################################
pkginclude_HEADERS = \
curl.h curlver.h easy.h mprintf.h stdcheaders.h multi.h \
typecheck-gcc.h curlbuild.h curlrules.h
pkgincludedir= $(includedir)/curl
# curlbuild.h does not exist in the git tree. When the original libcurl
# source code distribution archive file is created, curlbuild.h.dist is
# renamed to curlbuild.h and included in the tarball so that it can be
# used
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
directly on non-configure systems.
#
# The distributed curlbuild.h will be overwritten on configure systems
# when the configure script runs, with one that is suitable and specific
# to the library being configured and built.
#
# curlbuild.h.in is the distributed template file from which the configure
# script creates curlbuild.h at library configuration time, overwiting the
# one included in the distribution archive.
#
# curlbuild.h.dist is not included in the source code distribution archive.
EXTRA_DIST = curlbuild.h.in
DISTCLEANFILES = curlbuild.h
checksrc:
@@PERL@ $(top_srcdir)/lib/checksrc.pl -Wcurlbuild.h -D$(top_srcdir)/include/curl $(pkginclude_HEADERS) $(EXTRA_DIST)
if CURLDEBUG
# for debug builds, we scan the sources on all regular make invokes
all-local: checksrc
endif
//===- llvm/unittest/ADT/SetVector.cpp ------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// SetVector unit tests.
//
//===----------------------------------------------------------------------===//
#include "llvm/ADT/SetVector.h"
#include "gtest/gtest.h"
using namespace llvm;
TEST(SetVector, EraseTest) {
SetVector<int> S;
S.insert(0);
S.insert(1);
S.insert(2);
auto I = S.erase(std::next(S.begin()));
// Test that the returned iterator is the expected one-after-erase
// and the size/contents is the expected sequence {0, 2}.
EXPECT_EQ(std::next(S.begin()), I);
EXPECT_EQ(2u, S.size());
EXPECT_EQ(0, *S.begin());
EXPECT_EQ(2, *std::next(S.begin()));
}
cmake_minimum_required(VERSION 2.8.3)
project(opt_utils)
set(CMAKE_BUILD_TYPE RelWithDebInfo)
find_package(catkin REQUIRED COMPONENTS cmake_modules roscpp rosconsole image_transport cv_bridge opt_msgs)
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
link_directories(${OpenCV_LIB_DIR})
fin
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
d_package(Eigen REQUIRED)
include_directories(${Eigen_INCLUDE_DIRS} include ${catkin_INCLUDE_DIRS})
add_library(json src/json.cpp)
target_link_libraries(json ${catkin_LIBRARIES})
catkin_package(
INCLUDE_DIRS include
LIBRARIES ${PROJECT_NAME} json
CATKIN_DEPENDS roscpp
)
add_library(${PROJECT_NAME} src/conversions.cpp)
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES})
add_executable(roi_viewer apps/roi_viewer.cpp)
target_link_libraries(roi_viewer boost_system boost_filesystem boost_signals ${PROJECT_NAME} ${catkin_LIBRARIES} ${OpenCV_LIBS})
#add_executable(tracking_viewer apps/tracking_viewer.cpp)
#target_link_libraries(tracking_viewer boost_system boost_filesystem boost_signals ${PROJECT_NAME} ${catkin_LIBRARIES} ${OpenCV_LIBS})
add_executable(ros2udp_converter apps/ros2udp_converter.cpp src/udp_messaging.cpp)# src/json.cpp)
target_link_libraries(ros2udp_converter ${catkin_LIBRARIES} json)
add_executable(udp_listener apps/udp_listener.cpp src/udp_messaging.cpp)
target_link_libraries(udp_listener ${catkin_LIBRARIES})
// mksysnum_openbsd.pl
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
// +build amd64,openbsd
package unix
const (
SYS_EXIT = 1 // { void sys_exit(int rval); }
SYS_FORK = 2 // { int sys_fork(void); }
SYS_READ = 3 // { ssize_t sys_read(int fd, void *buf, size_t nbyte); }
SYS_WRITE = 4 // { ssize_t sys_write(int fd, const void *buf, \
SYS_OPEN = 5 // { int sys_open(const char *path, \
SYS_CLOSE = 6 // { int sys_close(int fd); }
SYS___TFORK = 8 // { int sys___tfork(const struct __tfork *param, \
SYS_LINK = 9 // { int sys_link(const char *path, const char *link); }
SYS_UNLINK = 10 // { int sys_unlink(const char *path); }
SYS_WAIT4 = 11 // { pid_t sys_wait4(pid_t pid, int *status, \
SYS_CHDIR = 12 // { int sys_chdir(const char *path); }
SYS_FCHDIR = 13 // { int sys_fchdir(int fd); }
SYS_MKNOD = 14 // { int sys_mknod(con
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
st char *path, mode_t mode, \
SYS_CHMOD = 15 // { int sys_chmod(const char *path, mode_t mode); }
SYS_CHOWN = 16 // { int sys_chown(const char *path, uid_t uid, \
SYS_OBREAK = 17 // { int sys_obreak(char *nsize); } break
SYS_GETDTABLECOUNT = 18 // { int sys_getdtablecount(void); }
SYS_GETRUSAGE = 19 // { int sys_getrusage(int who, \
SYS_GETPID = 20 // { pid_t sys_getpid(void); }
SYS_MOUNT = 21 // { int sys_mount(const char *type, const char *path, \
SYS_UNMOUNT = 22 // { int sys_unmount(const char *path, int flags); }
SYS_SETUID = 23 // { int sys_setuid(uid_t uid); }
SYS_GETUID = 24 // { uid_t sys_getuid(void); }
SYS_GETEUID = 25 // { uid_t sys_geteuid(void); }
SYS_PTRACE = 26 // { int sys_ptrace(int req, pid_t pid, caddr_t addr, \
SYS_RECVMSG = 27 // { ssize_t sys_recvmsg(int s, struct msghdr *msg, \
SYS_SENDMSG = 28 // { ssize_t sys_sendmsg(int s, \
SYS_RECVFROM = 29 // { ssize_t sys_recvfrom(int s, void *buf, size_t len, \
SYS_ACCEPT = 30 // { int sys_accept(int s, struct sockaddr *name, \
SYS_GETPEERNAME = 31 // { int sys_getpeername(int fdes, struct sockaddr *asa, \
SYS_GETSOCKNAME = 32 // { int sys_getsockname(int fdes, struct sockaddr *asa, \
SYS_ACCESS = 33 // { int sys_access(const char *path, int flags); }
SYS_CHFLAGS = 34 // { int sys_chflags(const char *path, u_int flags); }
SYS_FCHFLAGS = 35 // { int sys_fchflags(int fd, u_int flags); }
SYS_SYNC = 36 // { void sys_sync(void); }
SYS_KILL = 37 // { int sys_kill(int pid, int signum); }
SYS_STAT = 38 // { int sys_stat(const char *path, struct stat *ub); }
SYS_GETPPID = 39 // { pid_t sys_getppid(void); }
SYS_LSTAT = 40 // { int sys_lstat(const char *path, struct stat *ub); }
SYS_DUP = 41 // { int sys_dup(int fd); }
SYS_FSTATAT = 42 // { int sys_fstatat(int fd, const char *path, \
SYS_GETEGID
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
= 43 // { gid_t sys_getegid(void); }
SYS_PROFIL = 44 // { int sys_profil(caddr_t samples, size_t size, \
SYS_KTRACE = 45 // { int sys_ktrace(const char *fname, int ops, \
SYS_SIGACTION = 46 // { int sys_sigaction(int signum, \
SYS_GETGID = 47 // { gid_t sys_getgid(void); }
SYS_SIGPROCMASK = 48 // { int sys_sigprocmask(int how, sigset_t mask); }
SYS_GETLOGIN = 49 // { int sys_getlogin(char *namebuf, u_int namelen); }
SYS_SETLOGIN = 50 // { int sys_setlogin(const char *namebuf); }
SYS_ACCT = 51 // { int sys_acct(const char *path); }
SYS_SIGPENDING = 52 // { int sys_sigpending(void); }
SYS_FSTAT = 53 // { int sys_fstat(int fd, struct stat *sb); }
SYS_IOCTL = 54 // { int sys_ioctl(int fd, \
SYS_REBOOT = 55 // { int sys_reboot(int opt); }
SYS_REVOKE = 56 // { int sys_revoke(const char *path); }
SYS_SYMLINK = 57 // { int sys_symlink(const char *path, \
SYS_READLINK = 58 // { int sys_readlink(const char *path, char *buf, \
SYS_EXECVE = 59 // { int sys_execve(const char *path, \
SYS_UMASK = 60 // { mode_t sys_umask(mode_t newmask); }
SYS_CHROOT = 61 // { int sys_chroot(const char *path); }
SYS_GETFSSTAT = 62 // { int sys_getfsstat(struct statfs *buf, size_t bufsize, \
SYS_STATFS = 63 // { int sys_statfs(const char *path, \
SYS_FSTATFS = 64 // { int sys_fstatfs(int fd, struct statfs *buf); }
SYS_FHSTATFS = 65 // { int sys_fhstatfs(const fhandle_t *fhp, \
SYS_VFORK = 66 // { int sys_vfork(void); }
SYS_GETTIMEOFDAY = 67 // { int sys_gettimeofday(struct timeval *tp, \
SYS_SETTIMEOFDAY = 68 // { int sys_settimeofday(const struct timeval *tv, \
SYS_SETITIMER = 69 // { int sys_setitimer(int which, \
SYS_GETITIMER = 70 // { int sys_getitimer(int which, \
SYS_SELECT = 71 // { int sys_select(int nd, fd_set *in, fd_set *ou, \
SYS_KEVENT = 72 // { int sys_kevent(int fd, \
SYS_MUNMA
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
P = 73 // { int sys_munmap(void *addr, size_t len); }
SYS_MPROTECT = 74 // { int sys_mprotect(void *addr, size_t len, \
SYS_MADVISE = 75 // { int sys_madvise(void *addr, size_t len, \
SYS_UTIMES = 76 // { int sys_utimes(const char *path, \
SYS_FUTIMES = 77 // { int sys_futimes(int fd, \
SYS_MINCORE = 78 // { int sys_mincore(void *addr, size_t len, \
SYS_GETGROUPS = 79 // { int sys_getgroups(int gidsetsize, \
SYS_SETGROUPS = 80 // { int sys_setgroups(int gidsetsize, \
SYS_GETPGRP = 81 // { int sys_getpgrp(void); }
SYS_SETPGID = 82 // { int sys_setpgid(pid_t pid, int pgid); }
SYS_UTIMENSAT = 84 // { int sys_utimensat(int fd, const char *path, \
SYS_FUTIMENS = 85 // { int sys_futimens(int fd, \
SYS_CLOCK_GETTIME = 87 // { int sys_clock_gettime(clockid_t clock_id, \
SYS_CLOCK_SETTIME = 88 // { int sys_clock_settime(clockid_t clock_id, \
SYS_CLOCK_GETRES = 89 // { int sys_clock_getres(clockid_t clock_id, \
SYS_DUP2 = 90 // { int sys_dup2(int from, int to); }
SYS_NANOSLEEP = 91 // { int sys_nanosleep(const struct timespec *rqtp, \
SYS_FCNTL = 92 // { int sys_fcntl(int fd, int cmd, ... void *arg); }
SYS___THRSLEEP = 94 // { int sys___thrsleep(const volatile void *ident, \
SYS_FSYNC = 95 // { int sys_fsync(int fd); }
SYS_SETPRIORITY = 96 // { int sys_setpriority(int which, id_t who, int prio); }
SYS_SOCKET = 97 // { int sys_socket(int domain, int type, int protocol); }
SYS_CONNECT = 98 // { int sys_connect(int s, const struct sockaddr *name, \
SYS_GETDENTS = 99 // { int sys_getdents(int fd, void *buf, size_t buflen); }
SYS_GETPRIORITY = 100 // { int sys_getpriority(int which, id_t who); }
SYS_SIGRETURN = 103 // { int sys_sigreturn(struct sigcontext *sigcntxp); }
SYS_BIND = 104 // { int sys_bind(int s, const struct sockaddr *name, \
SYS_SETSOCKOPT = 105 // { int sys_setsockopt(int s, int level, int name, \
SY
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
S_LISTEN = 106 // { int sys_listen(int s, int backlog); }
SYS_PPOLL = 109 // { int sys_ppoll(struct pollfd *fds, \
SYS_PSELECT = 110 // { int sys_pselect(int nd, fd_set *in, fd_set *ou, \
SYS_SIGSUSPEND = 111 // { int sys_sigsuspend(int mask); }
SYS_GETSOCKOPT = 118 // { int sys_getsockopt(int s, int level, int name, \
SYS_READV = 120 // { ssize_t sys_readv(int fd, \
SYS_WRITEV = 121 // { ssize_t sys_writev(int fd, \
SYS_FCHOWN = 123 // { int sys_fchown(int fd, uid_t uid, gid_t gid); }
SYS_FCHMOD = 124 // { int sys_fchmod(int fd, mode_t mode); }
SYS_SETREUID = 126 // { int sys_setreuid(uid_t ruid, uid_t euid); }
SYS_SETREGID = 127 // { int sys_setregid(gid_t rgid, gid_t egid); }
SYS_RENAME = 128 // { int sys_rename(const char *from, const char *to); }
SYS_FLOCK = 131 // { int sys_flock(int fd, int how); }
SYS_MKFIFO = 132 // { int sys_mkfifo(const char *path, mode_t mode); }
SYS_SENDTO = 133 // { ssize_t sys_sendto(int s, const void *buf, \
SYS_SHUTDOWN = 134 // { int sys_shutdown(int s, int how); }
SYS_SOCKETPAIR = 135 // { int sys_socketpair(int domain, int type, \
SYS_MKDIR = 136 // { int sys_mkdir(const char *path, mode_t mode); }
SYS_RMDIR = 137 // { int sys_rmdir(const char *path); }
SYS_ADJTIME = 140 // { int sys_adjtime(const struct timeval *delta, \
SYS_SETSID = 147 // { int sys_setsid(void); }
SYS_QUOTACTL = 148 // { int sys_quotactl(const char *path, int cmd, \
SYS_NFSSVC = 155 // { int sys_nfssvc(int flag, void *argp); }
SYS_GETFH = 161 // { int sys_getfh(const char *fname, fhandle_t *fhp); }
SYS_SYSARCH = 165 // { int sys_sysarch(int op, void *parms); }
SYS_PREAD = 173 // { ssize_t sys_pread(int fd, void *buf, \
SYS_PWRITE = 174 // { ssize_t sys_pwrite(int fd, const void *buf, \
SYS_SETGID = 181 // { int sys_setgid(gid_t gid); }
SYS_SETEGID = 182 // { int sys_se
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
tegid(gid_t egid); }
SYS_SETEUID = 183 // { int sys_seteuid(uid_t euid); }
SYS_PATHCONF = 191 // { long sys_pathconf(const char *path, int name); }
SYS_FPATHCONF = 192 // { long sys_fpathconf(int fd, int name); }
SYS_SWAPCTL = 193 // { int sys_swapctl(int cmd, const void *arg, int misc); }
SYS_GETRLIMIT = 194 // { int sys_getrlimit(int which, \
SYS_SETRLIMIT = 195 // { int sys_setrlimit(int which, \
SYS_MMAP = 197 // { void *sys_mmap(void *addr, size_t len, int prot, \
SYS_LSEEK = 199 // { off_t sys_lseek(int fd, int pad, off_t offset, \
SYS_TRUNCATE = 200 // { int sys_truncate(const char *path, int pad, \
SYS_FTRUNCATE = 201 // { int sys_ftruncate(int fd, int pad, off_t length); }
SYS___SYSCTL = 202 // { int sys___sysctl(const int *name, u_int namelen, \
SYS_MLOCK = 203 // { int sys_mlock(const void *addr, size_t len); }
SYS_MUNLOCK = 204 // { int sys_munlock(const void *addr, size_t len); }
SYS_GETPGID = 207 // { pid_t sys_getpgid(pid_t pid); }
SYS_UTRACE = 209 // { int sys_utrace(const char *label, const void *addr, \
SYS_SEMGET = 221 // { int sys_semget(key_t key, int nsems, int semflg); }
SYS_MSGGET = 225 // { int sys_msgget(key_t key, int msgflg); }
SYS_MSGSND = 226 // { int sys_msgsnd(int msqid, const void *msgp, size_t msgsz, \
SYS_MSGRCV = 227 // { int sys_msgrcv(int msqid, void *msgp, size_t msgsz, \
SYS_SHMAT = 228 // { void *sys_shmat(int shmid, const void *shmaddr, \
SYS_SHMDT = 230 // { int sys_shmdt(const void *shmaddr); }
SYS_MINHERIT = 250 // { int sys_minherit(void *addr, size_t len, \
SYS_POLL = 252 // { int sys_poll(struct pollfd *fds, \
SYS_ISSETUGID = 253 // { int sys_issetugid(void); }
SYS_LCHOWN = 254 // { int sys_lchown(const char *path, uid_t uid, gid_t gid); }
SYS_GETSID = 255 // { pid_t sys_getsid(pid_t pid); }
SYS_MSYNC = 256 // { int sys_msync(void *addr, size_t
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
len, int flags); }
SYS_PIPE = 263 // { int sys_pipe(int *fdp); }
SYS_FHOPEN = 264 // { int sys_fhopen(const fhandle_t *fhp, int flags); }
SYS_PREADV = 267 // { ssize_t sys_preadv(int fd, \
SYS_PWRITEV = 268 // { ssize_t sys_pwritev(int fd, \
SYS_KQUEUE = 269 // { int sys_kqueue(void); }
SYS_MLOCKALL = 271 // { int sys_mlockall(int flags); }
SYS_MUNLOCKALL = 272 // { int sys_munlockall(void); }
SYS_GETRESUID = 281 // { int sys_getresuid(uid_t *ruid, uid_t *euid, \
SYS_SETRESUID = 282 // { int sys_setresuid(uid_t ruid, uid_t euid, \
SYS_GETRESGID = 283 // { int sys_getresgid(gid_t *rgid, gid_t *egid, \
SYS_SETRESGID = 284 // { int sys_setresgid(gid_t rgid, gid_t egid, \
SYS_MQUERY = 286 // { void *sys_mquery(void *addr, size_t len, int prot, \
SYS_CLOSEFROM = 287 // { int sys_closefrom(int fd); }
SYS_SIGALTSTACK = 288 // { int sys_sigaltstack(const struct sigaltstack *nss, \
SYS_SHMGET = 289 // { int sys_shmget(key_t key, size_t size, int shmflg); }
SYS_SEMOP = 290 // { int sys_semop(int semid, struct sembuf *sops, \
SYS_FHSTAT = 294 // { int sys_fhstat(const fhandle_t *fhp, \
SYS___SEMCTL = 295 // { int sys___semctl(int semid, int semnum, int cmd, \
SYS_SHMCTL = 296 // { int sys_shmctl(int shmid, int cmd, \
SYS_MSGCTL = 297 // { int sys_msgctl(int msqid, int cmd, \
SYS_SCHED_YIELD = 298 // { int sys_sched_yield(void); }
SYS_GETTHRID = 299 // { pid_t sys_getthrid(void); }
SYS___THRWAKEUP = 301 // { int sys___thrwakeup(const volatile void *ident, \
SYS___THREXIT = 302 // { void sys___threxit(pid_t *notdead); }
SYS___THRSIGDIVERT = 303 // { int sys___thrsigdivert(sigset_t sigmask, \
SYS___GETCWD = 304 // { int sys___getcwd(char *buf, size_t len); }
SYS_ADJFREQ = 305 // { int sys_adjfreq(const int64_t *freq, \
SYS_SETRTABLE = 310 // { int sys_setrtable(int rtableid); }
SYS_GETRTABLE = 311 // { int sys_getrtable(void);
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
}
SYS_FACCESSAT = 313 // { int sys_faccessat(int fd, const char *path, \
SYS_FCHMODAT = 314 // { int sys_fchmodat(int fd, const char *path, \
SYS_FCHOWNAT = 315 // { int sys_fchownat(int fd, const char *path, \
SYS_LINKAT = 317 // { int sys_linkat(int fd1, const char *path1, int fd2, \
SYS_MKDIRAT = 318 // { int sys_mkdirat(int fd, const char *path, \
SYS_MKFIFOAT = 319 // { int sys_mkfifoat(int fd, const char *path, \
SYS_MKNODAT = 320 // { int sys_mknodat(int fd, const char *path, \
SYS_OPENAT = 321 // { int sys_openat(int fd, const char *path, int flags, \
SYS_READLINKAT = 322 // { ssize_t sys_readlinkat(int fd, const char *path, \
SYS_RENAMEAT = 323 // { int sys_renameat(int fromfd, const char *from, \
SYS_SYMLINKAT = 324 // { int sys_symlinkat(const char *path, int fd, \
SYS_UNLINKAT = 325 // { int sys_unlinkat(int fd, const char *path, \
SYS___SET_TCB = 329 // { void sys___set_tcb(void *tcb); }
SYS___GET_TCB = 330 // { void *sys___get_tcb(void); }
)
/* NOTICE: This file has been changed by Plutext Pty Ltd for use in docx4j.
* The package name has been changed; there may also be other changes.
*
* This notice is included to meet the condition in clause 4(b) of the License.
*/
/* ====================================================================
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 O
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
F ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.docx4j.org.apache.poi.poifs.property;
import java.util.Iterator;
import java.io.IOException;
/**
* Behavior for parent (directory) properties
*
* @author Marc Johnson27591@hotmail.com
*/
public interface Parent
extends Child
{
/**
* Get an iterator over the children of this Parent; all elements
* are instances of Property.
*
* @return Iterator of children; may refer to an empty collection
*/
public Iterator getChildren();
/**
* Add a new child to the collection of children
*
* @param property the new child to be added; must not be null
*
* @exception IOException if the Parent already has a child with
* the same name
*/
public void addChild(final Property property)
throws IOException;
/**
* Set the previous Child
*
* @param child the new 'previous' child; may be null, which has
* the effect of saying there is no 'previous' child
*/
public void setPreviousChild(final Child child);
/**
* Set the next Child
*
* @param child the new 'next' child; may be null, which has the
* effect of saying there is no 'next' child
*/
public void setNextChild(final Child child);
/** *** end methods from interface Child *** */
} // end public interface Parent
/*
* OPL4 MIDI synthesizer functions
*
* Copyright (c) 2003 by Clemens Ladisch <clemens@ladisch.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* no
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
tice, this list of conditions, and the following disclaimer,
* without modification.
* 2. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* Alternatively, this software may be distributed and/or modified 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 SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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 "opl4_local.h"
#include <linux/delay.h>
#include <asm/io.h>
#include <sound/asoundef.h>
/* GM2 controllers */
#ifndef MIDI_CTL_RELEASE_TIME
#define MIDI_CTL_RELEASE_TIME 0x48
#define MIDI_CTL_ATTACK_TIME 0x49
#define MIDI_CTL_DECAY_TIME 0x4b
#define MIDI_CTL_VIBRATO_RATE 0x4c
#define MIDI_CTL_VIBRATO_DEPTH 0x4d
#define MIDI_CTL_VIBRATO_DELAY 0x4e
#endif
/*
* This table maps 100/128 cents to F_NUMBER.
*/
static const s16 snd_opl4_pitch_map[0x600] = {
0x000,0x000,0x001,0x001,0x002,0x002,0x003,0x003,
0x004,0x004,0x005,0x005,0x006,0x006,0x006,0x007,
0x007,0x008,0x008,0x009,0x009,0x00a,0x00a,0x00b,
0x00b,0x00c,0x00c,0x00d,0x00d,0x00d,0x00e,0x00e,
0x00f,0x00f,0x010,0x010,0x011,0x011,0x012,0x012,
0x013,0x013,0x014,0x014,0x015,0x015,0x015,0x016,
0x016,0x017,0x
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
017,0x018,0x018,0x019,0x019,0x01a,
0x01a,0x01b,0x01b,0x01c,0x01c,0x01d,0x01d,0x01e,
0x01e,0x01e,0x01f,0x01f,0x020,0x020,0x021,0x021,
0x022,0x022,0x023,0x023,0x024,0x024,0x025,0x025,
0x026,0x026,0x027,0x027,0x028,0x028,0x029,0x029,
0x029,0x02a,0x02a,0x02b,0x02b,0x02c,0x02c,0x02d,
0x02d,0x02e,0x02e,0x02f,0x02f,0x030,0x030,0x031,
0x031,0x032,0x032,0x033,0x033,0x034,0x034,0x035,
0x035,0x036,0x036,0x037,0x037,0x038,0x038,0x038,
0x039,0x039,0x03a,0x03a,0x03b,0x03b,0x03c,0x03c,
0x03d,0x03d,0x03e,0x03e,0x03f,0x03f,0x040,0x040,
0x041,0x041,0x042,0x042,0x043,0x043,0x044,0x044,
0x045,0x045,0x046,0x046,0x047,0x047,0x048,0x048,
0x049,0x049,0x04a,0x04a,0x04b,0x04b,0x04c,0x04c,
0x04d,0x04d,0x04e,0x04e,0x04f,0x04f,0x050,0x050,
0x051,0x051,0x052,0x052,0x053,0x053,0x054,0x054,
0x055,0x055,0x056,0x056,0x057,0x057,0x058,0x058,
0x059,0x059,0x05a,0x05a,0x05b,0x05b,0x05c,0x05c,
0x05d,0x05d,0x05e,0x05e,0x05f,0x05f,0x060,0x060,
0x061,0x061,0x062,0x062,0x063,0x063,0x064,0x064,
0x065,0x065,0x066,0x066,0x067,0x067,0x068,0x068,
0x069,0x069,0x06a,0x06a,0x06b,0x06b,0x06c,0x06c,
0x06d,0x06d,0x06e,0x06e,0x06f,0x06f,0x070,0x071,
0x071,0x072,0x072,0x073,0x073,0x074,0x074,0x075,
0x075,0x076,0x076,0x077,0x077,0x078,0x078,0x079,
0x079,0x07a,0x07a,0x07b,0x07b,0x07c,0x07c,0x07d,
0x07d,0x07e,0x07e,0x07f,0x07f,0x080,0x081,0x081,
0x082,0x082,0x083,0x083,0x084,0x084,0x085,0x085,
0x086,0x086,0x087,0x087,0x088,0x088,0x089,0x089,
0x08a,0x08a,0x08b,0x08b,0x08c,0x08d,0x08d,0x08e,
0x08e,0x08f,0x08f,0x090,0x090,0x091,0x091,0x092,
0x092,0x093,0x093,0x094,0x094,0x095,0x096,0x096,
0x097,0x097,0x098,0x098,0x099,0x099,0x09a,0x09a,
0x09b,0x09b,0x09c,0x09c,0x09d,0x09d,0x09e,0x09f,
0x09f,0x0a0,0x0a0,0x0a1,0x0a1,0x0a2,0x0a2,0x0a3,
0x0a3,0x0a4,0x0a4,0x0a5,0x0a6,0x0a6,0x0a7,0x0a7,
0x0a8,0x0a8,0x0a9,0x0a9,0x0aa,0x0aa,0x0ab,0x0ab,
0x0ac,0x0ad,0x0ad,0x0ae,0x0ae,0x0af,0x0af,0x0b0,
0x0b0,0x0b1,0x0b1,0x0b2,0x0b2,0x0b3,0x0b4,0x0b4,
0x0b5,0x0b5,0x0b6,0x0b6,0x0b7,0x0b7,0x0b8,0x0b8,
0x0b9,0x0ba,0x0ba,0x0bb,0x0bb,0x0bc,0x0bc,0x0bd,
0x0bd,0x0be,
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
0x0be,0x0bf,0x0c0,0x0c0,0x0c1,0x0c1,
0x0c2,0x0c2,0x0c3,0x0c3,0x0c4,0x0c4,0x0c5,0x0c6,
0x0c6,0x0c7,0x0c7,0x0c8,0x0c8,0x0c9,0x0c9,0x0ca,
0x0cb,0x0cb,0x0cc,0x0cc,0x0cd,0x0cd,0x0ce,0x0ce,
0x0cf,0x0d0,0x0d0,0x0d1,0x0d1,0x0d2,0x0d2,0x0d3,
0x0d3,0x0d4,0x0d5,0x0d5,0x0d6,0x0d6,0x0d7,0x0d7,
0x0d8,0x0d8,0x0d9,0x0da,0x0da,0x0db,0x0db,0x0dc,
0x0dc,0x0dd,0x0de,0x0de,0x0df,0x0df,0x0e0,0x0e0,
0x0e1,0x0e1,0x0e2,0x0e3,0x0e3,0x0e4,0x0e4,0x0e5,
0x0e5,0x0e6,0x0e7,0x0e7,0x0e8,0x0e8,0x0e9,0x0e9,
0x0ea,0x0eb,0x0eb,0x0ec,0x0ec,0x0ed,0x0ed,0x0ee,
0x0ef,0x0ef,0x0f0,0x0f0,0x0f1,0x0f1,0x0f2,0x0f3,
0x0f3,0x0f4,0x0f4,0x0f5,0x0f5,0x0f6,0x0f7,0x0f7,
0x0f8,0x0f8,0x0f9,0x0f9,0x0fa,0x0fb,0x0fb,0x0fc,
0x0fc,0x0fd,0x0fd,0x0fe,0x0ff,0x0ff,0x100,0x100,
0x101,0x101,0x102,0x103,0x103,0x104,0x104,0x105,
0x106,0x106,0x107,0x107,0x108,0x108,0x109,0x10a,
0x10a,0x10b,0x10b,0x10c,0x10c,0x10d,0x10e,0x10e,
0x10f,0x10f,0x110,0x111,0x111,0x112,0x112,0x113,
0x114,0x114,0x115,0x115,0x116,0x116,0x117,0x118,
0x118,0x119,0x119,0x11a,0x11b,0x11b,0x11c,0x11c,
0x11d,0x11e,0x11e,0x11f,0x11f,0x120,0x120,0x121,
0x122,0x122,0x123,0x123,0x124,0x125,0x125,0x126,
0x126,0x127,0x128,0x128,0x129,0x129,0x12a,0x12b,
0x12b,0x12c,0x12c,0x12d,0x12e,0x12e,0x12f,0x12f,
0x130,0x131,0x131,0x132,0x132,0x133,0x134,0x134,
0x135,0x135,0x136,0x137,0x137,0x138,0x138,0x139,
0x13a,0x13a,0x13b,0x13b,0x13c,0x13d,0x13d,0x13e,
0x13e,0x13f,0x140,0x140,0x141,0x141,0x142,0x143,
0x143,0x144,0x144,0x145,0x146,0x146,0x147,0x148,
0x148,0x149,0x149,0x14a,0x14b,0x14b,0x14c,0x14c,
0x14d,0x14e,0x14e,0x14f,0x14f,0x150,0x151,0x151,
0x152,0x153,0x153,0x154,0x154,0x155,0x156,0x156,
0x157,0x157,0x158,0x159,0x159,0x15a,0x15b,0x15b,
0x15c,0x15c,0x15d,0x15e,0x15e,0x15f,0x160,0x160,
0x161,0x161,0x162,0x163,0x163,0x164,0x165,0x165,
0x166,0x166,0x167,0x168,0x168,0x169,0x16a,0x16a,
0x16b,0x16b,0x16c,0x16d,0x16d,0x16e,0x16f,0x16f,
0x170,0x170,0x171,0x172,0x172,0x173,0x174,0x174,
0x175,0x175,0x176,0x177,0x177,0x178,0x179,0x179,
0x17a,0x17a,0x17b,0x17c,0x17c,0x17d,0x17e,0x17e,
0x17f,0x18
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
0,0x180,0x181,0x181,0x182,0x183,0x183,
0x184,0x185,0x185,0x186,0x187,0x187,0x188,0x188,
0x189,0x18a,0x18a,0x18b,0x18c,0x18c,0x18d,0x18e,
0x18e,0x18f,0x190,0x190,0x191,0x191,0x192,0x193,
0x193,0x194,0x195,0x195,0x196,0x197,0x197,0x198,
0x199,0x199,0x19a,0x19a,0x19b,0x19c,0x19c,0x19d,
0x19e,0x19e,0x19f,0x1a0,0x1a0,0x1a1,0x1a2,0x1a2,
0x1a3,0x1a4,0x1a4,0x1a5,0x1a6,0x1a6,0x1a7,0x1a8,
0x1a8,0x1a9,0x1a9,0x1aa,0x1ab,0x1ab,0x1ac,0x1ad,
0x1ad,0x1ae,0x1af,0x1af,0x1b0,0x1b1,0x1b1,0x1b2,
0x1b3,0x1b3,0x1b4,0x1b5,0x1b5,0x1b6,0x1b7,0x1b7,
0x1b8,0x1b9,0x1b9,0x1ba,0x1bb,0x1bb,0x1bc,0x1bd,
0x1bd,0x1be,0x1bf,0x1bf,0x1c0,0x1c1,0x1c1,0x1c2,
0x1c3,0x1c3,0x1c4,0x1c5,0x1c5,0x1c6,0x1c7,0x1c7,
0x1c8,0x1c9,0x1c9,0x1ca,0x1cb,0x1cb,0x1cc,0x1cd,
0x1cd,0x1ce,0x1cf,0x1cf,0x1d0,0x1d1,0x1d1,0x1d2,
0x1d3,0x1d3,0x1d4,0x1d5,0x1d5,0x1d6,0x1d7,0x1d7,
0x1d8,0x1d9,0x1d9,0x1da,0x1db,0x1db,0x1dc,0x1dd,
0x1dd,0x1de,0x1df,0x1df,0x1e0,0x1e1,0x1e1,0x1e2,
0x1e3,0x1e4,0x1e4,0x1e5,0x1e6,0x1e6,0x1e7,0x1e8,
0x1e8,0x1e9,0x1ea,0x1ea,0x1eb,0x1ec,0x1ec,0x1ed,
0x1ee,0x1ee,0x1ef,0x1f0,0x1f0,0x1f1,0x1f2,0x1f3,
0x1f3,0x1f4,0x1f5,0x1f5,0x1f6,0x1f7,0x1f7,0x1f8,
0x1f9,0x1f9,0x1fa,0x1fb,0x1fb,0x1fc,0x1fd,0x1fe,
0x1fe,0x1ff,0x200,0x200,0x201,0x202,0x202,0x203,
0x204,0x205,0x205,0x206,0x207,0x207,0x208,0x209,
0x209,0x20a,0x20b,0x20b,0x20c,0x20d,0x20e,0x20e,
0x20f,0x210,0x210,0x211,0x212,0x212,0x213,0x214,
0x215,0x215,0x216,0x217,0x217,0x218,0x219,0x21a,
0x21a,0x21b,0x21c,0x21c,0x21d,0x21e,0x21e,0x21f,
0x220,0x221,0x221,0x222,0x223,0x223,0x224,0x225,
0x226,0x226,0x227,0x228,0x228,0x229,0x22a,0x22b,
0x22b,0x22c,0x22d,0x22d,0x22e,0x22f,0x230,0x230,
0x231,0x232,0x232,0x233,0x234,0x235,0x235,0x236,
0x237,0x237,0x238,0x239,0x23a,0x23a,0x23b,0x23c,
0x23c,0x23d,0x23e,0x23f,0x23f,0x240,0x241,0x241,
0x242,0x243,0x244,0x244,0x245,0x246,0x247,0x247,
0x248,0x249,0x249,0x24a,0x24b,0x24c,0x24c,0x24d,
0x24e,0x24f,0x24f,0x250,0x251,0x251,0x252,0x253,
0x254,0x254,0x255,0x256,0x257,0x257,0x258,0x259,
0x259,0x25a,0x25b,0x25c,0x25c,0x25d,0x25e,0x25f,
0x25f,0x
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
260,0x261,0x262,0x262,0x263,0x264,0x265,
0x265,0x266,0x267,0x267,0x268,0x269,0x26a,0x26a,
0x26b,0x26c,0x26d,0x26d,0x26e,0x26f,0x270,0x270,
0x271,0x272,0x273,0x273,0x274,0x275,0x276,0x276,
0x277,0x278,0x279,0x279,0x27a,0x27b,0x27c,0x27c,
0x27d,0x27e,0x27f,0x27f,0x280,0x281,0x282,0x282,
0x283,0x284,0x285,0x285,0x286,0x287,0x288,0x288,
0x289,0x28a,0x28b,0x28b,0x28c,0x28d,0x28e,0x28e,
0x28f,0x290,0x291,0x291,0x292,0x293,0x294,0x294,
0x295,0x296,0x297,0x298,0x298,0x299,0x29a,0x29b,
0x29b,0x29c,0x29d,0x29e,0x29e,0x29f,0x2a0,0x2a1,
0x2a1,0x2a2,0x2a3,0x2a4,0x2a5,0x2a5,0x2a6,0x2a7,
0x2a8,0x2a8,0x2a9,0x2aa,0x2ab,0x2ab,0x2ac,0x2ad,
0x2ae,0x2af,0x2af,0x2b0,0x2b1,0x2b2,0x2b2,0x2b3,
0x2b4,0x2b5,0x2b5,0x2b6,0x2b7,0x2b8,0x2b9,0x2b9,
0x2ba,0x2bb,0x2bc,0x2bc,0x2bd,0x2be,0x2bf,0x2c0,
0x2c0,0x2c1,0x2c2,0x2c3,0x2c4,0x2c4,0x2c5,0x2c6,
0x2c7,0x2c7,0x2c8,0x2c9,0x2ca,0x2cb,0x2cb,0x2cc,
0x2cd,0x2ce,0x2ce,0x2cf,0x2d0,0x2d1,0x2d2,0x2d2,
0x2d3,0x2d4,0x2d5,0x2d6,0x2d6,0x2d7,0x2d8,0x2d9,
0x2da,0x2da,0x2db,0x2dc,0x2dd,0x2dd,0x2de,0x2df,
0x2e0,0x2e1,0x2e1,0x2e2,0x2e3,0x2e4,0x2e5,0x2e5,
0x2e6,0x2e7,0x2e8,0x2e9,0x2e9,0x2ea,0x2eb,0x2ec,
0x2ed,0x2ed,0x2ee,0x2ef,0x2f0,0x2f1,0x2f1,0x2f2,
0x2f3,0x2f4,0x2f5,0x2f5,0x2f6,0x2f7,0x2f8,0x2f9,
0x2f9,0x2fa,0x2fb,0x2fc,0x2fd,0x2fd,0x2fe,0x2ff,
0x300,0x301,0x302,0x302,0x303,0x304,0x305,0x306,
0x306,0x307,0x308,0x309,0x30a,0x30a,0x30b,0x30c,
0x30d,0x30e,0x30f,0x30f,0x310,0x311,0x312,0x313,
0x313,0x314,0x315,0x316,0x317,0x318,0x318,0x319,
0x31a,0x31b,0x31c,0x31c,0x31d,0x31e,0x31f,0x320,
0x321,0x321,0x322,0x323,0x324,0x325,0x326,0x326,
0x327,0x328,0x329,0x32a,0x32a,0x32b,0x32c,0x32d,
0x32e,0x32f,0x32f,0x330,0x331,0x332,0x333,0x334,
0x334,0x335,0x336,0x337,0x338,0x339,0x339,0x33a,
0x33b,0x33c,0x33d,0x33e,0x33e,0x33f,0x340,0x341,
0x342,0x343,0x343,0x344,0x345,0x346,0x347,0x348,
0x349,0x349,0x34a,0x34b,0x34c,0x34d,0x34e,0x34e,
0x34f,0x350,0x351,0x352,0x353,0x353,0x354,0x355,
0x356,0x357,0x358,0x359,0x359,0x35a,0x35b,0x35c,
0x35d,0x35e,0x35f,0x35f,0x360,0x361,0x362,0x363,
0x364,
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
0x364,0x365,0x366,0x367,0x368,0x369,0x36a,
0x36a,0x36b,0x36c,0x36d,0x36e,0x36f,0x370,0x370,
0x371,0x372,0x373,0x374,0x375,0x376,0x377,0x377,
0x378,0x379,0x37a,0x37b,0x37c,0x37d,0x37d,0x37e,
0x37f,0x380,0x381,0x382,0x383,0x383,0x384,0x385,
0x386,0x387,0x388,0x389,0x38a,0x38a,0x38b,0x38c,
0x38d,0x38e,0x38f,0x390,0x391,0x391,0x392,0x393,
0x394,0x395,0x396,0x397,0x398,0x398,0x399,0x39a,
0x39b,0x39c,0x39d,0x39e,0x39f,0x39f,0x3a0,0x3a1,
0x3a2,0x3a3,0x3a4,0x3a5,0x3a6,0x3a7,0x3a7,0x3a8,
0x3a9,0x3aa,0x3ab,0x3ac,0x3ad,0x3ae,0x3ae,0x3af,
0x3b0,0x3b1,0x3b2,0x3b3,0x3b4,0x3b5,0x3b6,0x3b6,
0x3b7,0x3b8,0x3b9,0x3ba,0x3bb,0x3bc,0x3bd,0x3be,
0x3bf,0x3bf,0x3c0,0x3c1,0x3c2,0x3c3,0x3c4,0x3c5,
0x3c6,0x3c7,0x3c7,0x3c8,0x3c9,0x3ca,0x3cb,0x3cc,
0x3cd,0x3ce,0x3cf,0x3d0,0x3d1,0x3d1,0x3d2,0x3d3,
0x3d4,0x3d5,0x3d6,0x3d7,0x3d8,0x3d9,0x3da,0x3da,
0x3db,0x3dc,0x3dd,0x3de,0x3df,0x3e0,0x3e1,0x3e2,
0x3e3,0x3e4,0x3e4,0x3e5,0x3e6,0x3e7,0x3e8,0x3e9,
0x3ea,0x3eb,0x3ec,0x3ed,0x3ee,0x3ef,0x3ef,0x3f0,
0x3f1,0x3f2,0x3f3,0x3f4,0x3f5,0x3f6,0x3f7,0x3f8,
0x3f9,0x3fa,0x3fa,0x3fb,0x3fc,0x3fd,0x3fe,0x3ff
};
/*
* Attenuation according to GM recommendations, in -0.375 dB units.
* table[v] = 40 * log(v / 127) / -0.375
*/
static unsigned char snd_opl4_volume_table[128] = {
255,224,192,173,160,150,141,134,
128,122,117,113,109,105,102, 99,
96, 93, 90, 88, 85, 83, 81, 79,
77, 75, 73, 71, 70, 68, 67, 65,
64, 62, 61, 59, 58, 57, 56, 54,
53, 52, 51, 50, 49, 48, 47, 46,
45, 44, 43, 42, 41, 40, 39, 39,
38, 37, 36, 35, 34, 34, 33, 32,
31, 31, 30, 29, 29, 28, 27, 27,
26, 25, 25, 24, 24, 23, 22, 22,
21, 21, 20, 19, 19, 18, 18, 17,
17, 16, 16, 15, 15, 14, 14, 13,
13, 12, 12, 11, 11, 10, 10, 9,
9, 9, 8, 8, 7, 7, 6, 6,
6, 5, 5, 4, 4, 4, 3, 3,
2, 2, 2, 1, 1, 0, 0, 0
};
/*
* Initializes all voices.
*/
void snd_opl4_synth_reset(struct snd_opl4 *opl4)
{
unsigned long flags;
int i;
spin_lock_irqsave(&opl4->reg_lock, flags);
for (i = 0; i < OPL4_MAX_VOICES; i++)
snd_opl4_write(opl4, OPL4_REG_MISC +
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
i, OPL4_DAMP_BIT);
spin_unlock_irqrestore(&opl4->reg_lock, flags);
INIT_LIST_HEAD(&opl4->off_voices);
INIT_LIST_HEAD(&opl4->on_voices);
memset(opl4->voices, 0, sizeof(opl4->voices));
for (i = 0; i < OPL4_MAX_VOICES; i++) {
opl4->voices[i].number = i;
list_add_tail(&opl4->voices[i].list, &opl4->off_voices);
}
snd_midi_channel_set_clear(opl4->chset);
}
/*
* Shuts down all voices.
*/
void snd_opl4_synth_shutdown(struct snd_opl4 *opl4)
{
unsigned long flags;
int i;
spin_lock_irqsave(&opl4->reg_lock, flags);
for (i = 0; i < OPL4_MAX_VOICES; i++)
snd_opl4_write(opl4, OPL4_REG_MISC + i,
opl4->voices[i].reg_misc & ~OPL4_KEY_ON_BIT);
spin_unlock_irqrestore(&opl4->reg_lock, flags);
}
/*
* Executes the callback for all voices playing the specified note.
*/
static void snd_opl4_do_for_note(struct snd_opl4 *opl4, int note, struct snd_midi_channel *chan,
void (*func)(struct snd_opl4 *opl4, struct opl4_voice *voice))
{
int i;
unsigned long flags;
struct opl4_voice *voice;
spin_lock_irqsave(&opl4->reg_lock, flags);
for (i = 0; i < OPL4_MAX_VOICES; i++) {
voice = &opl4->voices[i];
if (voice->chan == chan && voice->note == note) {
func(opl4, voice);
}
}
spin_unlock_irqrestore(&opl4->reg_lock, flags);
}
/*
* Executes the callback for all voices of to the specified channel.
*/
static void snd_opl4_do_for_channel(struct snd_opl4 *opl4,
struct snd_midi_channel *chan,
void (*func)(struct snd_opl4 *opl4, struct opl4_voice *voice))
{
int i;
unsigned long flags;
struct opl4_voice *voice;
spin_lock_irqsave(&opl4->reg_lock, flags);
for (i = 0; i < OPL4_MAX_VOICES; i++) {
voice = &opl4->voices[i];
if (voice->chan == chan) {
func(opl4, voice);
}
}
spin_unlock_irqrestore(&opl4->reg_lock, flags);
}
/*
* Executes the callback for all active voices.
*/
static void snd_opl4_do_for_all(struct snd_opl4 *opl4,
void (*func)(struct snd_opl4 *opl4, struct opl4_voice *voice))
{
int i;
unsigned long flags;
struct opl4_voice *voice;
spin_lock_irqsave
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
(&opl4->reg_lock, flags);
for (i = 0; i < OPL4_MAX_VOICES; i++) {
voice = &opl4->voices[i];
if (voice->chan)
func(opl4, voice);
}
spin_unlock_irqrestore(&opl4->reg_lock, flags);
}
static void snd_opl4_update_volume(struct snd_opl4 *opl4, struct opl4_voice *voice)
{
int att;
att = voice->sound->tone_attenuate;
att += snd_opl4_volume_table[opl4->chset->gs_master_volume & 0x7f];
att += snd_opl4_volume_table[voice->chan->gm_volume & 0x7f];
att += snd_opl4_volume_table[voice->chan->gm_expression & 0x7f];
att += snd_opl4_volume_table[voice->velocity];
att = 0x7f - (0x7f - att) * (voice->sound->volume_factor) / 0xfe - volume_boost;
if (att < 0)
att = 0;
else if (att > 0x7e)
att = 0x7e;
snd_opl4_write(opl4, OPL4_REG_LEVEL + voice->number,
(att << 1) | voice->level_direct);
voice->level_direct = 0;
}
static void snd_opl4_update_pan(struct snd_opl4 *opl4, struct opl4_voice *voice)
{
int pan = voice->sound->panpot;
if (!voice->chan->drum_channel)
pan += (voice->chan->control[MIDI_CTL_MSB_PAN] - 0x40) >> 3;
if (pan < -7)
pan = -7;
else if (pan > 7)
pan = 7;
voice->reg_misc = (voice->reg_misc & ~OPL4_PAN_POT_MASK)
| (pan & OPL4_PAN_POT_MASK);
snd_opl4_write(opl4, OPL4_REG_MISC + voice->number, voice->reg_misc);
}
static void snd_opl4_update_vibrato_depth(struct snd_opl4 *opl4,
struct opl4_voice *voice)
{
int depth;
if (voice->chan->drum_channel)
return;
depth = (7 - voice->sound->vibrato)
* (voice->chan->control[MIDI_CTL_VIBRATO_DEPTH] & 0x7f);
depth = (depth >> 7) + voice->sound->vibrato;
voice->reg_lfo_vibrato &= ~OPL4_VIBRATO_DEPTH_MASK;
voice->reg_lfo_vibrato |= depth & OPL4_VIBRATO_DEPTH_MASK;
snd_opl4_write(opl4, OPL4_REG_LFO_VIBRATO + voice->number,
voice->reg_lfo_vibrato);
}
static void snd_opl4_update_pitch(struct snd_opl4 *opl4,
struct opl4_voice *voice)
{
struct snd_midi_channel *chan = voice->chan;
int note, pitch, octave;
note = chan->drum_channel ? 60 : voice->note;
/*
* pitch is in 100/128 cents, so 0x80 is one semito
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
ne and
* 0x600 is one octave.
*/
pitch = ((note - 60) << 7) * voice->sound->key_scaling / 100 + (60 << 7);
pitch += voice->sound->pitch_offset;
if (!chan->drum_channel)
pitch += chan->gm_rpn_coarse_tuning;
pitch += chan->gm_rpn_fine_tuning >> 7;
pitch += chan->midi_pitchbend * chan->gm_rpn_pitch_bend_range / 0x2000;
if (pitch < 0)
pitch = 0;
else if (pitch >= 0x6000)
pitch = 0x5fff;
octave = pitch / 0x600 - 8;
pitch = snd_opl4_pitch_map[pitch % 0x600];
snd_opl4_write(opl4, OPL4_REG_OCTAVE + voice->number,
(octave << 4) | ((pitch >> 7) & OPL4_F_NUMBER_HIGH_MASK));
voice->reg_f_number = (voice->reg_f_number & OPL4_TONE_NUMBER_BIT8)
| ((pitch << 1) & OPL4_F_NUMBER_LOW_MASK);
snd_opl4_write(opl4, OPL4_REG_F_NUMBER + voice->number, voice->reg_f_number);
}
static void snd_opl4_update_tone_parameters(struct snd_opl4 *opl4,
struct opl4_voice *voice)
{
snd_opl4_write(opl4, OPL4_REG_ATTACK_DECAY1 + voice->number,
voice->sound->reg_attack_decay1);
snd_opl4_write(opl4, OPL4_REG_LEVEL_DECAY2 + voice->number,
voice->sound->reg_level_decay2);
snd_opl4_write(opl4, OPL4_REG_RELEASE_CORRECTION + voice->number,
voice->sound->reg_release_correction);
snd_opl4_write(opl4, OPL4_REG_TREMOLO + voice->number,
voice->sound->reg_tremolo);
}
/* allocate one voice */
static struct opl4_voice *snd_opl4_get_voice(struct snd_opl4 *opl4)
{
/* first, try to get the oldest key-off voice */
if (!list_empty(&opl4->off_voices))
return list_entry(opl4->off_voices.next, struct opl4_voice, list);
/* then get the oldest key-on voice */
snd_BUG_ON(list_empty(&opl4->on_voices));
return list_entry(opl4->on_voices.next, struct opl4_voice, list);
}
static void snd_opl4_wait_for_wave_headers(struct snd_opl4 *opl4)
{
int timeout = 200;
while ((inb(opl4->fm_port) & OPL4_STATUS_LOAD) && --timeout > 0)
udelay(10);
}
void snd_opl4_note_on(void *private_data, int note, int vel, struct snd_midi_channel *chan)
{
struct snd_opl4 *opl4 = private_data;
const struct opl4_r
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
egion_ptr *regions;
struct opl4_voice *voice[2];
const struct opl4_sound *sound[2];
int voices = 0, i;
unsigned long flags;
/* determine the number of voices and voice parameters */
i = chan->drum_channel ? 0x80 : (chan->midi_program & 0x7f);
regions = &snd_yrw801_regions[i];
for (i = 0; i < regions->count; i++) {
if (note >= regions->regions[i].key_min &&
note <= regions->regions[i].key_max) {
sound[voices] = ®ions->regions[i].sound;
if (++voices >= 2)
break;
}
}
/* allocate and initialize the needed voices */
spin_lock_irqsave(&opl4->reg_lock, flags);
for (i = 0; i < voices; i++) {
voice[i] = snd_opl4_get_voice(opl4);
list_move_tail(&voice[i]->list, &opl4->on_voices);
voice[i]->chan = chan;
voice[i]->note = note;
voice[i]->velocity = vel & 0x7f;
voice[i]->sound = sound[i];
}
/* set tone number (triggers header loading) */
for (i = 0; i < voices; i++) {
voice[i]->reg_f_number =
(sound[i]->tone >> 8) & OPL4_TONE_NUMBER_BIT8;
snd_opl4_write(opl4, OPL4_REG_F_NUMBER + voice[i]->number,
voice[i]->reg_f_number);
snd_opl4_write(opl4, OPL4_REG_TONE_NUMBER + voice[i]->number,
sound[i]->tone & 0xff);
}
/* set parameters which can be set while loading */
for (i = 0; i < voices; i++) {
voice[i]->reg_misc = OPL4_LFO_RESET_BIT;
snd_opl4_update_pan(opl4, voice[i]);
snd_opl4_update_pitch(opl4, voice[i]);
voice[i]->level_direct = OPL4_LEVEL_DIRECT_BIT;
snd_opl4_update_volume(opl4, voice[i]);
}
spin_unlock_irqrestore(&opl4->reg_lock, flags);
/* wait for completion of loading */
snd_opl4_wait_for_wave_headers(opl4);
/* set remaining parameters */
spin_lock_irqsave(&opl4->reg_lock, flags);
for (i = 0; i < voices; i++) {
snd_opl4_update_tone_parameters(opl4, voice[i]);
voice[i]->reg_lfo_vibrato = voice[i]->sound->reg_lfo_vibrato;
snd_opl4_update_vibrato_depth(opl4, voice[i]);
}
/* finally, switch on all voices */
for (i = 0; i < voices; i++) {
voice[i]->reg_misc =
(voice[i]->reg_misc & 0x1f) | OPL4_KEY_ON_BIT;
sn
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
d_opl4_write(opl4, OPL4_REG_MISC + voice[i]->number,
voice[i]->reg_misc);
}
spin_unlock_irqrestore(&opl4->reg_lock, flags);
}
static void snd_opl4_voice_off(struct snd_opl4 *opl4, struct opl4_voice *voice)
{
list_move_tail(&voice->list, &opl4->off_voices);
voice->reg_misc &= ~OPL4_KEY_ON_BIT;
snd_opl4_write(opl4, OPL4_REG_MISC + voice->number, voice->reg_misc);
}
void snd_opl4_note_off(void *private_data, int note, int vel, struct snd_midi_channel *chan)
{
struct snd_opl4 *opl4 = private_data;
snd_opl4_do_for_note(opl4, note, chan, snd_opl4_voice_off);
}
static void snd_opl4_terminate_voice(struct snd_opl4 *opl4, struct opl4_voice *voice)
{
list_move_tail(&voice->list, &opl4->off_voices);
voice->reg_misc = (voice->reg_misc & ~OPL4_KEY_ON_BIT) | OPL4_DAMP_BIT;
snd_opl4_write(opl4, OPL4_REG_MISC + voice->number, voice->reg_misc);
}
void snd_opl4_terminate_note(void *private_data, int note, struct snd_midi_channel *chan)
{
struct snd_opl4 *opl4 = private_data;
snd_opl4_do_for_note(opl4, note, chan, snd_opl4_terminate_voice);
}
void snd_opl4_control(void *private_data, int type, struct snd_midi_channel *chan)
{
struct snd_opl4 *opl4 = private_data;
switch (type) {
case MIDI_CTL_MSB_MODWHEEL:
chan->control[MIDI_CTL_VIBRATO_DEPTH] = chan->control[MIDI_CTL_MSB_MODWHEEL];
snd_opl4_do_for_channel(opl4, chan, snd_opl4_update_vibrato_depth);
break;
case MIDI_CTL_MSB_MAIN_VOLUME:
snd_opl4_do_for_channel(opl4, chan, snd_opl4_update_volume);
break;
case MIDI_CTL_MSB_PAN:
snd_opl4_do_for_channel(opl4, chan, snd_opl4_update_pan);
break;
case MIDI_CTL_MSB_EXPRESSION:
snd_opl4_do_for_channel(opl4, chan, snd_opl4_update_volume);
break;
case MIDI_CTL_VIBRATO_RATE:
/* not yet supported */
break;
case MIDI_CTL_VIBRATO_DEPTH:
snd_opl4_do_for_channel(opl4, chan, snd_opl4_update_vibrato_depth);
break;
case MIDI_CTL_VIBRATO_DELAY:
/* not yet supported */
break;
case MIDI_CTL_E1_REVERB_DEPTH:
/*
* Each OPL4 voice has a bit called "Pseudo-Reverb", but
* IMHO _no
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
t_ using it enhances the listening experience.
*/
break;
case MIDI_CTL_PITCHBEND:
snd_opl4_do_for_channel(opl4, chan, snd_opl4_update_pitch);
break;
}
}
void snd_opl4_sysex(void *private_data, unsigned char *buf, int len,
int parsed, struct snd_midi_channel_set *chset)
{
struct snd_opl4 *opl4 = private_data;
if (parsed == SNDRV_MIDI_SYSEX_GS_MASTER_VOLUME)
snd_opl4_do_for_all(opl4, snd_opl4_update_volume);
}
.. _access-logging:
==============
Access Logging
==============
The WSGI design is modular. Waitress logs error conditions, debugging
output, etc., but not web traffic. For web traffic logging, Paste
provides `TransLogger
<https://web.archive.org/web/20160707041338/http://pythonpaste.org/modules/translogger.html>`_
:term:`middleware`. TransLogger produces logs in the `Apache Combined
Log Format <https://httpd.apache.org/docs/current/logs.html#combined>`_.
.. _logging-to-the-console-using-python:
Logging to the Console Using Python
-----------------------------------
``waitress.serve`` calls ``logging.basicConfig()`` to set up logging to the
console when the server starts up. Assuming no other logging configuration
has already been done, this sets the logging default level to
``logging.WARNING``. The Waitress logger will inherit the root logger's
level information (it logs at level ``WARNING`` or above).
Waitress sends its logging output (including application exception
renderings) to the Python logger object named ``waitress``. You can
influence the logger level and output stream using the normal Python
``logging`` module API. For example:
.. code-block:: python
import logging
logger = logging.getLogger('waitress')
logger.setLevel(logging.INFO)
Within a PasteDeploy configuration file, you can use the normal Python
``logging`` module ``.ini`` file format to change similar Waitress logging
options. For example:
.. code-block:: ini
[logger_waitress]
level = INFO
.. _logging-to-the-console-using-pastedeploy:
Logging to the Console Using PasteDeploy
-
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
---------------------------------------
TransLogger will automatically setup a logging handler to the console when called with no arguments.
It "just works" in environments that don't configure logging.
This is by virtue of its default configuration setting of ``setup_console_handler = True``.
.. TODO:
.. .. _logging-to-a-file-using-python:
.. Logging to a File Using Python
.. ------------------------------
.. Show how to configure the WSGI logger via python.
.. _logging-to-a-file-using-pastedeploy:
Logging to a File Using PasteDeploy
------------------------------------
TransLogger does not write to files, and the Python logging system
must be configured to do this. The Python class :class:`FileHandler`
logging handler can be used alongside TransLogger to create an
``access.log`` file similar to Apache's.
Like any standard :term:`middleware` with a Paste entry point,
TransLogger can be configured to wrap your application using ``.ini``
file syntax. First add a
``[filter:translogger]`` section, then use a ``[pipeline:main]``
section file to form a WSGI pipeline with both the translogger and
your application in it. For instance, if you have this:
.. code-block:: ini
[app:wsgiapp]
use = egg:mypackage#wsgiapp
[server:main]
use = egg:waitress#main
host = 127.0.0.1
port = 8080
Add this:
.. code-block:: ini
[filter:translogger]
use = egg:Paste#translogger
setup_console_handler = False
[pipeline:main]
pipeline = translogger
wsgiapp
Using PasteDeploy this way to form and serve a pipeline is equivalent to
wrapping your app in a TransLogger instance via the bottom of the ``main``
function of your project's ``__init__`` file:
.. code-block:: python
from mypackage import wsgiapp
from waitress import serve
from paste.translogger import TransLogger
serve(TransLogger(wsgiapp, setup_console_handler=False))
.. note::
TransLogger will automatically set up a logging handler to the console when
called with no arguments, so it "just works"
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
in environments that don't
configure logging. Since our logging handlers are configured, we disable
the automation via ``setup_console_handler = False``.
With the filter in place, TransLogger's logger (named the ``wsgi`` logger) will
propagate its log messages to the parent logger (the root logger), sending
its output to the console when we request a page:
.. code-block:: text
00:50:53,694 INFO [wsgiapp] Returning: Hello World!
(content-type: text/plain)
00:50:53,695 INFO [wsgi] 192.168.1.111 - - [11/Aug/2011:20:09:33 -0700] "GET /hello
HTTP/1.1" 404 - "-"
"Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.6) Gecko/20070725
Firefox/2.0.0.6"
To direct TransLogger to an ``access.log`` FileHandler, we need the
following to add a FileHandler (named ``accesslog``) to the list of
handlers, and ensure that the ``wsgi`` logger is configured and uses
this handler accordingly:
.. code-block:: ini
# Begin logging configuration
[loggers]
keys = root, wsgiapp, wsgi
[handlers]
keys = console, accesslog
[logger_wsgi]
level = INFO
handlers = accesslog
qualname = wsgi
propagate = 0
[handler_accesslog]
class = FileHandler
args = ('%(here)s/access.log','a')
level = INFO
formatter = generic
As mentioned above, non-root loggers by default propagate their log records
to the root logger's handlers (currently the console handler). Setting
``propagate`` to ``0`` (``False``) here disables this; so the ``wsgi`` logger
directs its records only to the ``accesslog`` handler.
Finally, there's no need to use the ``generic`` formatter with
TransLogger, as TransLogger itself provides all the information we
need. We'll use a formatter that passes-through the log messages as
is. Add a new formatter called ``accesslog`` by including the
following in your configuration file:
.. code-block:: ini
[formatters]
keys = generic, accesslog
[formatter_accesslog]
format = %(message)s
Finally alter the existing
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
configuration to wire this new
``accesslog`` formatter into the FileHandler:
.. code-block:: ini
[handler_accesslog]
class = FileHandler
args = ('%(here)s/access.log','a')
level = INFO
formatter = accesslog
//
// PagerControllerDmeoController.h
// TYPagerControllerDemo
//
// Created by tany on 2017/7/19.
// Copyright © 2017年 tany. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface PagerControllerDmeoController : UIViewController
@end
// ----------------------------------------------------------------------------
// Copyright (C) 2002-2006 Marcin Kalicinski
//
// 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)
//
// For more information, see www.boost.org
// ----------------------------------------------------------------------------
#include "test_utils.hpp"
#include <boost/property_tree/ini_parser.hpp>
#include <sstream>
using namespace boost::property_tree;
///////////////////////////////////////////////////////////////////////////////
// Test data
// Correct data
const char *ok_data_1 =
"\n"
"; Comment\n"
"[Section1]\n"
"\t \t; Comment\n"
" Key1=Data1\n"
" \n"
" Key2 = Data2\n"
"Key 3 = Data 3 \n"
"Key4=Data4\n"
"[Section2] ;Comment\n"
"\t \tKey1=Data4\n";
// Correct data
const char *ok_data_2 =
"[Section1]\n"
"Key1=Data1"; // No eol
// Correct data
const char *ok_data_3 =
"";
// Correct data
const char *ok_data_4 =
";Comment";
// Correct data
const char *ok_data_5 =
"Key1=Data1\n" // No section
"Key2=Data2\n";
// Treat # as comment.
const char *ok_data_6 =
"# Comment\n"
"[Section1]\n"
"Key1=Data1\n";
// Erroneous data
const char *error_data_1 =
"[Section1]\n"
"Key1\n" // No equals sign
"Key2=Data2";
// Erroneous data
const char *error_data_2 =
"[Section1]\n"
"Key1=Data1\n
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
"
"=Data2\n"; // No key
struct ReadFunc
{
template<class Ptree>
void operator()(const std::string &filename, Ptree &pt) const
{
read_ini(filename, pt);
}
};
struct WriteFunc
{
template<class Ptree>
void operator()(const std::string &filename, const Ptree &pt) const
{
write_ini(filename, pt);
}
};
void test_erroneous_write(const boost::property_tree::ptree &pt)
{
std::stringstream stream;
try
{
write_ini(stream, pt);
BOOST_ERROR("No required exception thrown");
}
catch (ini_parser_error &e)
{
(void)e;
}
catch (...)
{
BOOST_ERROR("Wrong exception type thrown");
}
}
template<class Ptree>
void test_ini_parser()
{
generic_parser_test_ok<Ptree, ReadFunc, WriteFunc>
(
ReadFunc(), WriteFunc(), ok_data_1, NULL,
"testok1.ini", NULL, "testok1out.ini", 8, 26, 37
);
generic_parser_test_ok<Ptree, ReadFunc, WriteFunc>
(
ReadFunc(), WriteFunc(), ok_data_2, NULL,
"testok2.ini", NULL, "testok2out.ini", 3, 5, 12
);
generic_parser_test_ok<Ptree, ReadFunc, WriteFunc>
(
ReadFunc(), WriteFunc(), ok_data_3, NULL,
"testok3.ini", NULL, "testok3out.ini", 1, 0, 0
);
generic_parser_test_ok<Ptree, ReadFunc, WriteFunc>
(
ReadFunc(), WriteFunc(), ok_data_4, NULL,
"testok4.ini", NULL, "testok4out.ini", 1, 0, 0
);
generic_parser_test_ok<Ptree, ReadFunc, WriteFunc>
(
ReadFunc(), WriteFunc(), ok_data_5, NULL,
"testok5.ini", NULL, "testok5out.ini", 3, 10, 8
);
generic_parser_test_ok<Ptree, ReadFunc, WriteFunc>
(
ReadFunc(), WriteFunc(), ok_data_6, NULL,
"testok6.ini", NULL, "testok6out.ini", 3, 5, 12
);
generic_parser_test_error<Ptree, ReadFunc, WriteFunc, ini_parser_error>
(
ReadFunc(), WriteFunc(), error_data_1, NULL,
"testerr1.ini", NULL, "testerr1out.ini", 2
);
generic_parser_test_error<Ptree
| null | null | null | null | null | null |
github_plus_top10pct_by_avg
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.