answer stringlengths 15 1.25M |
|---|
#include <linux/slab.h>
#include "cpufreq_governor.h"
/* Conservative governor macros */
#define <API key> (80)
#define <API key> (20)
#define DEF_FREQUENCY_STEP (5)
#define <API key> (1)
#define <API key> (10)
u64 get_cpu_idle_time(unsigned int cpu, u64 *wall, int io_busy);
static DEFINE_PER_CPU(struct cs_cpu_dbs_info_s, cs_cpu_dbs_info);
static inline unsigned int get_freq_target(struct cs_dbs_tuners *cs_tuners,
struct cpufreq_policy *policy)
{
unsigned int freq_target = (cs_tuners->freq_step * policy->max) / 100;
/* max freq cannot be less than 100. But who knows... */
if (unlikely(freq_target == 0))
freq_target = DEF_FREQUENCY_STEP;
return freq_target;
}
/*
* Every sampling_rate, we check, if current idle time is less than 20%
* (default), then we try to increase frequency. Every sampling_rate *
* <API key>, we check, if current idle time is more than 80%
* (default), then we try to decrease frequency
*
* Any frequency increase takes it to the maximum frequency. Frequency reduction
* happens at minimum steps of 5% (default) of maximum frequency
*/
static void cs_check_cpu(int cpu, unsigned int load)
{
struct cs_cpu_dbs_info_s *dbs_info = &per_cpu(cs_cpu_dbs_info, cpu);
struct cpufreq_policy *policy = dbs_info->cdbs.cur_policy;
struct dbs_data *dbs_data = policy->governor_data;
struct cs_dbs_tuners *cs_tuners = dbs_data->tuners;
<API key>(policy, load);
/*
* break out if we 'cannot' reduce the speed as the user might
* want freq_step to be zero
*/
if (cs_tuners->freq_step == 0)
return;
/* Check for frequency increase */
if (load > cs_tuners->up_threshold) {
dbs_info->down_skip = 0;
/* if we are already at full speed then break out early */
if (dbs_info->requested_freq == policy->max)
return;
dbs_info->requested_freq += get_freq_target(cs_tuners, policy);
if (dbs_info->requested_freq > policy->max)
dbs_info->requested_freq = policy->max;
<API key>(policy, dbs_info->requested_freq,
CPUFREQ_RELATION_H);
return;
}
/* if <API key> is active break out early */
if (++dbs_info->down_skip < cs_tuners-><API key>)
return;
dbs_info->down_skip = 0;
/* Check for frequency decrease */
if (load < cs_tuners->down_threshold) {
unsigned int freq_target;
/*
* if we cannot reduce the frequency anymore, break out early
*/
if (policy->cur == policy->min)
return;
freq_target = get_freq_target(cs_tuners, policy);
if (dbs_info->requested_freq > freq_target)
dbs_info->requested_freq -= freq_target;
else
dbs_info->requested_freq = policy->min;
<API key>(policy, dbs_info->requested_freq,
CPUFREQ_RELATION_L);
return;
}
}
static void cs_dbs_timer(struct work_struct *work)
{
struct cs_cpu_dbs_info_s *dbs_info = container_of(work,
struct cs_cpu_dbs_info_s, cdbs.work.work);
unsigned int cpu = dbs_info->cdbs.cur_policy->cpu;
struct cs_cpu_dbs_info_s *core_dbs_info = &per_cpu(cs_cpu_dbs_info,
cpu);
struct dbs_data *dbs_data = dbs_info->cdbs.cur_policy->governor_data;
struct cs_dbs_tuners *cs_tuners = dbs_data->tuners;
int delay = <API key>(cs_tuners->sampling_rate);
bool modify_all = true;
mutex_lock(&core_dbs_info->cdbs.timer_mutex);
if (!need_load_eval(&core_dbs_info->cdbs, cs_tuners->sampling_rate))
modify_all = false;
else
dbs_check_cpu(dbs_data, cpu);
gov_queue_work(dbs_data, dbs_info->cdbs.cur_policy, delay, modify_all);
mutex_unlock(&core_dbs_info->cdbs.timer_mutex);
}
static int <API key>(struct notifier_block *nb, unsigned long val,
void *data)
{
struct cpufreq_freqs *freq = data;
struct cs_cpu_dbs_info_s *dbs_info =
&per_cpu(cs_cpu_dbs_info, freq->cpu);
struct cpufreq_policy *policy;
if (!dbs_info->enable)
return 0;
policy = dbs_info->cdbs.cur_policy;
/*
* we only care if our internally tracked freq moves outside the 'valid'
* ranges of frequency available to us otherwise we do not change it
*/
if (dbs_info->requested_freq > policy->max
|| dbs_info->requested_freq < policy->min)
dbs_info->requested_freq = freq->new;
return 0;
}
static struct common_dbs_data cs_dbs_cdata;
static ssize_t <API key>(struct dbs_data *dbs_data,
const char *buf, size_t count)
{
struct cs_dbs_tuners *cs_tuners = dbs_data->tuners;
unsigned int input;
int ret;
ret = sscanf(buf, "%u", &input);
if (ret != 1 || input > <API key> || input < 1)
return -EINVAL;
cs_tuners-><API key> = input;
return count;
}
static ssize_t store_sampling_rate(struct dbs_data *dbs_data, const char *buf,
size_t count)
{
struct cs_dbs_tuners *cs_tuners = dbs_data->tuners;
unsigned int input;
int ret;
ret = sscanf(buf, "%u", &input);
if (ret != 1)
return -EINVAL;
cs_tuners->sampling_rate = max(input, dbs_data->min_sampling_rate);
return count;
}
static ssize_t store_up_threshold(struct dbs_data *dbs_data, const char *buf,
size_t count)
{
struct cs_dbs_tuners *cs_tuners = dbs_data->tuners;
unsigned int input;
int ret;
ret = sscanf(buf, "%u", &input);
if (ret != 1 || input > 100 || input <= cs_tuners->down_threshold)
return -EINVAL;
cs_tuners->up_threshold = input;
return count;
}
static ssize_t <API key>(struct dbs_data *dbs_data, const char *buf,
size_t count)
{
struct cs_dbs_tuners *cs_tuners = dbs_data->tuners;
unsigned int input;
int ret;
ret = sscanf(buf, "%u", &input);
/* cannot be lower than 11 otherwise freq will not fall */
if (ret != 1 || input < 11 || input > 100 ||
input >= cs_tuners->up_threshold)
return -EINVAL;
cs_tuners->down_threshold = input;
return count;
}
static ssize_t <API key>(struct dbs_data *dbs_data,
const char *buf, size_t count)
{
struct cs_dbs_tuners *cs_tuners = dbs_data->tuners;
unsigned int input, j;
int ret;
ret = sscanf(buf, "%u", &input);
if (ret != 1)
return -EINVAL;
if (input > 1)
input = 1;
if (input == cs_tuners->ignore_nice_load) /* nothing to do */
return count;
cs_tuners->ignore_nice_load = input;
/* we need to re-evaluate prev_cpu_idle */
for_each_online_cpu(j) {
struct cs_cpu_dbs_info_s *dbs_info;
dbs_info = &per_cpu(cs_cpu_dbs_info, j);
dbs_info->cdbs.prev_cpu_idle = get_cpu_idle_time(j,
&dbs_info->cdbs.prev_cpu_wall, 0);
if (cs_tuners->ignore_nice_load)
dbs_info->cdbs.prev_cpu_nice =
kcpustat_cpu(j).cpustat[CPUTIME_NICE];
}
return count;
}
static ssize_t store_freq_step(struct dbs_data *dbs_data, const char *buf,
size_t count)
{
struct cs_dbs_tuners *cs_tuners = dbs_data->tuners;
unsigned int input;
int ret;
ret = sscanf(buf, "%u", &input);
if (ret != 1)
return -EINVAL;
if (input > 100)
input = 100;
/*
* no need to test here if freq_step is zero as the user might actually
* want this, they would be crazy though :)
*/
cs_tuners->freq_step = input;
return count;
}
show_store_one(cs, sampling_rate);
show_store_one(cs, <API key>);
show_store_one(cs, up_threshold);
show_store_one(cs, down_threshold);
show_store_one(cs, ignore_nice_load);
show_store_one(cs, freq_step);
<API key>(cs);
gov_sys_pol_attr_rw(sampling_rate);
gov_sys_pol_attr_rw(<API key>);
gov_sys_pol_attr_rw(up_threshold);
gov_sys_pol_attr_rw(down_threshold);
gov_sys_pol_attr_rw(ignore_nice_load);
gov_sys_pol_attr_rw(freq_step);
gov_sys_pol_attr_ro(sampling_rate_min);
static struct attribute *<API key>[] = {
&<API key>.attr,
&<API key>.attr,
&<API key>.attr,
&<API key>.attr,
&<API key>.attr,
&<API key>.attr,
&freq_step_gov_sys.attr,
NULL
};
static struct attribute_group <API key> = {
.attrs = <API key>,
.name = "conservative",
};
static struct attribute *<API key>[] = {
&<API key>.attr,
&<API key>.attr,
&<API key>.attr,
&<API key>.attr,
&<API key>.attr,
&<API key>.attr,
&freq_step_gov_pol.attr,
NULL
};
static struct attribute_group <API key> = {
.attrs = <API key>,
.name = "conservative",
};
static int cs_init(struct dbs_data *dbs_data)
{
struct cs_dbs_tuners *tuners;
tuners = kzalloc(sizeof(*tuners), GFP_KERNEL);
if (!tuners) {
pr_err("%s: kzalloc failed\n", __func__);
return -ENOMEM;
}
tuners->up_threshold = <API key>;
tuners->down_threshold = <API key>;
tuners-><API key> = <API key>;
tuners->ignore_nice_load = 0;
tuners->freq_step = DEF_FREQUENCY_STEP;
dbs_data->tuners = tuners;
dbs_data->min_sampling_rate = <API key> *
jiffies_to_usecs(10);
mutex_init(&dbs_data->mutex);
return 0;
}
static void cs_exit(struct dbs_data *dbs_data)
{
kfree(dbs_data->tuners);
}
<API key>(cs_cpu_dbs_info);
static struct notifier_block <API key> = {
.notifier_call = <API key>,
};
static struct cs_ops cs_ops = {
.notifier_block = &<API key>,
};
static struct common_dbs_data cs_dbs_cdata = {
.governor = GOV_CONSERVATIVE,
.attr_group_gov_sys = &<API key>,
.attr_group_gov_pol = &<API key>,
.get_cpu_cdbs = get_cpu_cdbs,
.get_cpu_dbs_info_s = get_cpu_dbs_info_s,
.gov_dbs_timer = cs_dbs_timer,
.gov_check_cpu = cs_check_cpu,
.gov_ops = &cs_ops,
.init = cs_init,
.exit = cs_exit,
};
static int <API key>(struct cpufreq_policy *policy,
unsigned int event)
{
return <API key>(policy, &cs_dbs_cdata, event);
}
#ifndef <API key>
static
#endif
struct cpufreq_governor <API key> = {
.name = "conservative",
.governor = <API key>,
.<API key> = <API key>,
.owner = THIS_MODULE,
};
static int __init <API key>(void)
{
return <API key>(&<API key>);
}
static void __exit <API key>(void)
{
<API key>(&<API key>);
}
MODULE_AUTHOR("Alexander Clouter <alex@digriz.org.uk>");
MODULE_DESCRIPTION("'<API key>' - A dynamic cpufreq governor for "
"Low Latency Frequency Transition capable processors "
"optimised for use in a battery environment");
MODULE_LICENSE("GPL");
#ifdef <API key>
fs_initcall(<API key>);
#else
module_init(<API key>);
#endif
module_exit(<API key>); |
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="design-properties" content="{"RULERS_VISIBLE":true,"GUIDELINES_VISIBLE":false,"SNAP_TO_OBJECTS":true,"SNAP_TO_GRID":true,"SNAPPING_DISTANCE":10,"GENERATE_GETTERS":false,"JAVA_SOURCES_ROOT":"src/main/java","THEME":"dashboard"}">
<meta name="vaadin-version" content="8.0.5">
<meta name="package-mapping" content="<API key>:org.openthinclient.web.ui">
</head>
<body>
<<API key> style-name="dashboard-view" size-full>
<<API key> width-full _id="header"></<API key>>
<vaadin-label style-name="large" width-full plain-text _id="descriptionLabel">
Label
</vaadin-label>
<vaadin-button style-name="huge icon-align-top primary" _id="<API key>" :middle :center :expand>
Generate Report
<br>
<small>and transmit to openthincient</small>
</vaadin-button>
<<API key> margin="false" _id="resultLayout" :expand>
<vaadin-label style-name="large colored" plain-text _id="<API key>" :center>
Your System Report has been Transmitted
</vaadin-label>
<vaadin-panel caption="Support ID" style-name="borderless" size-auto :middle :center :expand>
<<API key>>
<vaadin-label style-name="bold huge" width-full plain-text _id="supportIdLabel" :middle :center>
Label
</vaadin-label>
</<API key>>
</vaadin-panel>
</<API key>>
</<API key>>
</body>
</html> |
package org.tzi.use.uml.ocl.expr.operations;
import org.tzi.use.uml.ocl.expr.EvalContext;
import org.tzi.use.uml.ocl.type.Type;
import org.tzi.use.uml.ocl.type.TypeFactory;
import org.tzi.use.uml.ocl.value.BooleanValue;
import org.tzi.use.uml.ocl.value.ObjectValue;
import org.tzi.use.uml.ocl.value.UndefinedValue;
import org.tzi.use.uml.ocl.value.Value;
import org.tzi.use.uml.sys.MObject;
import org.tzi.use.uml.sys.MObjectState;
import org.tzi.use.util.collections.MultiMap;
public class <API key> {
public static void <API key>(MultiMap<String, OpGeneric> opmap) {
OpGeneric.registerOperation(new Op_oclIsNew(), opmap);
}
}
// Generic operations on all object types.
/* oclIsNew : T -> Boolean */
final class Op_oclIsNew extends OpGeneric {
public String name() {
return "oclIsNew";
}
public int kind() {
return OPERATION;
}
public boolean isInfixOrPrefix() {
return false;
}
public Type matches(Type params[]) {
if (params.length == 1 && params[0].isTrueObjectType())
return TypeFactory.mkBoolean();
else
return null;
}
public Value eval(EvalContext ctx, Value[] args, Type resultType) {
Value res;
if (args[0].isUndefined())
res = UndefinedValue.instance;
else {
// get object
ObjectValue objVal = (ObjectValue) args[0];
MObject obj = objVal.value();
MObjectState objPreState = obj.state(ctx.preState());
res = BooleanValue.get(objPreState == null);
}
return res;
}
} |
#import "SBAlertItem.h"
@class NSDictionary, NSMutableArray, NSString, NSTimer, UITable;
@interface SBWiFiAlertItem : SBAlertItem
{
NSMutableArray *_networks; // 12 = 0xc
NSTimer *_scanTimer; // 16 = 0x10
UITable *_table; // 20 = 0x14
struct CGSize _size; // 24 = 0x18
int _joinRow; // 32 = 0x20
NSString *_password; // 36 = 0x24
NSDictionary *_joinDict; // 40 = 0x28
SBAlertItem *_childAlert; // 44 = 0x2c
BOOL _selectingRow; // 48 = 0x30
BOOL _storedPassword; // 49 = 0x31
BOOL _passwordFailed; // 50 = 0x32
}
- (void)_enableTable; // IMP=0x00067914
- (int)_joinRow; // IMP=0x00066d04
- (void)alertSheet:(id)fp8 buttonClicked:(int)fp12; // IMP=0x000681d4
- (BOOL)<API key>; // IMP=0x00068360
- (void)configure:(BOOL)fp8 <API key>:(BOOL)fp12; // IMP=0x000687d0
- (void)dealloc; // IMP=0x000680e0
- (id)<API key>:(id)fp8 originalNetworks:(id)fp12; // IMP=0x00067038
- (void)didDeactivate:(BOOL)fp8; // IMP=0x00068a20
- (void)<API key>:(id)fp8; // IMP=0x00067e64
- (void)dismiss; // IMP=0x00067938
- (BOOL)dismissOnLock; // IMP=0x00068a18
- (id)init; // IMP=0x00066bb0
- (id)<API key>:(id)fp8; // IMP=0x00066ef0
- (int)numberOfRowsInTable:(id)fp8; // IMP=0x00068384
- (void)passwordEntered:(id)fp8; // IMP=0x00067f6c
- (void)performUnlockAction; // IMP=0x00068368
- (void)scan; // IMP=0x00066b54
- (void)setChildAlert:(id)fp8; // IMP=0x00066ee8
- (void)setNetworks:(id)fp8; // IMP=0x00066dc0
- (id)table:(id)fp8 cellForRow:(int)fp12 column:(id)fp16; // IMP=0x000683a4
- (void)<API key>:(id)fp8; // IMP=0x00068460
- (void)wifiManager:(id)fp8 joinCompleted:(int)fp12; // IMP=0x00067b14
- (void)wifiManager:(id)fp8 scanCompleted:(id)fp12; // IMP=0x000671e4
- (void)willActivate; // IMP=0x00067aa4
- (void)willDeactivate:(BOOL)fp8; // IMP=0x00067a2c
@end |
<div id="rbinstaller-install" class="modal hide fade">
<div id="<API key>">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<img class="display-inline" data-ng-src="{{ install_item.icon }}" alt="icon">
<p class="display-inline font-size-18">{{ install_item.title }}</p>
</div>
<div class="modal-body">
<table class="table table-striped">
<thead>
<tr>
<th>File Version</th>
<th>Compatible with</th>
<th></th>
</tr>
</thead>
<tbody>
<tr data-ng-repeat="version in install_item.version">
<td>
{{ version.version_name }}
</td>
<td>
<div data-ng-repeat="compatibility in <API key>[version.itemversion_id]">{{ compatibility.title }} :
<span data-ng-repeat="value in compatibility.values">
{{ value }}
<span ng-hide="$last">, </span>
</span>
</div>
</td>
<td>
<a href="#" class="btn btn-primary btn-medium" ng-click="install.item(version.itemversion_id);">Install</a>
</td>
</tr>
</tbody>
</table>
<div class="margin-top-5 font-size-14 text-center">
<p class="display-inline"><i class="icon-globe"></i> At Domain : </p>
<a class="display-inline" href="#"> {{ config.current_domain }}</a>
</div>
</div>
</div>
<div class="hide" id="<API key>">
<div class="modal-header">
<img class="display-inline" data-ng-src="{{ install_item.icon }}" alt="icon">
<p class="display-inline font-size-18">{{ install_item.title }}</p>
<p class="display-inline hide" id="install-version-id"></p>
</div>
<div class="margin-top-2 center font-size-14">
<p>App is Installing...</p>
<div class="progress progress-striped active <API key>">
<div class="bar" style="width: 100%;"></div>
</div>
</div>
<div class="margin-top-5 font-size-14 text-center">
<p class="display-inline"><i class="icon-globe"></i> At Domain : </p>
<a class="display-inline" href="#"> {{ config.current_domain }}</a>
</div>
<div class="margin-top-5"> </div>
</div>
<div class="hide" id="install-success">
<div class="modal-header">
<img class="display-inline" data-ng-src="{{ install_item.icon }}" alt="icon">
<p class="display-inline font-size-18">{{ install_item.title }}</p>
<p class="display-inline hide" id="install-version-id"></p>
</div>
<div class="margin-top-5 font-size-14 text-center">
<p class="display-inline"><i class="icon-globe"></i> At Domain : </p>
<a class="display-inline" href="#"> {{ config.current_domain }}</a>
</div>
<div class="modal-footer" style="background-color: #18BC9C;">
<span class="font-size-18 pull-left" style="color: #ffffff;margin-top: 10px;"><i class="icon-ok icon-white"></i> Installed Successfully</span>
<span><a href="#" class="btn btn-large" data-dismiss="modal">OK</a></span>
</div>
</div>
<div class="hide" id="install-failure">
<div class="modal-header">
<img class="display-inline" data-ng-src="{{ install_item.icon }}" alt="icon">
<p class="display-inline font-size-18">{{ install_item.title }}</p>
<p class="display-inline hide" id="install-version-id"></p>
</div>
<div class="modal-body">
<big>Installation of this version is failed, please try again or report this issue to service provider.</big>
</div>
<div class="margin-top-5 font-size-14 text-center">
<p class="display-inline"><i class="icon-globe"></i> At Domain : </p>
<a class="display-inline" href="#"> {{ config.current_domain }}</a>
</div>
<div class="modal-footer">
<span class="font-size-18 pull-left text-error">
<i class="icon-warning-sign"></i> Install Failed</span>
<span><a href="#" class="btn btn-large" data-dismiss="modal">OK</a></span>
</div>
</div>
</div> |
TM.declare('gc.controller.<API key>').share(function() {
var $doc = $(document), $elements = [], currentOpacity = 0, timer, INCREASE = 0.15, INTERVAL = 2000;
function <API key>() {
$('.<API key>').remove();
}
function updateBackgrounds() {
if (timer) {
return;
}
timer = setInterval(function() {
if (currentOpacity >= 1) {
if (timer) {
clearInterval(timer);
}
<API key>();
$elements = null;
} else {
currentOpacity += INCREASE;
for (var i = 0; i < $elements.length; i++) {
$elements[i].css('opacity', currentOpacity);
}
}
}, INTERVAL);
}
return {
addElement: function($el) {
if (!$el.hasClass('<API key>')) {
return;
}
if (currentOpacity > 0) {
$el.css('opacity', currentOpacity);
}
if (currentOpacity >= 1) {
<API key>();
return;
}
$elements.push($el);
if (!timer) {
$doc.one('update-backgrounds', updateBackgrounds);
}
}
};
}); |
<?php
// namespace administrator\components\com_jmap\libraries\framework;
defined ( '_JEXEC' ) or die ( 'Restricted access' );
/**
* Framework autoloader based on camel case and prefix namespacing
*
* @package JMAP::administrator::components::com_jmap
* @subpackage framework
* @since 2.0
*/
abstract class JMapLoader {
/**
* Container for already imported library paths.
*
* @var array
*/
protected static $classes = array ();
/**
* Container for already imported library paths.
*
* @var array
*/
protected static $imported = array ();
/**
* Container for registered library class prefixes and path lookups.
*
* @var array
*/
protected static $prefixes = array ();
/**
* Method to discover classes of a given type in a given path.
*
* @param string $classPrefix
* The class name prefix to use for discovery.
* @param string $parentPath
* Full path to the parent folder for the classes to discover.
* @param boolean $force
* True to overwrite the autoload path value for the class if it already exists.
* @param boolean $recurse
* Recurse through all child directories as well as the parent path.
*
* @return void
*/
public static function discover($classPrefix, $parentPath, $force = true, $recurse = false) {
try {
if ($recurse) {
$iterator = new <API key> ( new <API key> ( $parentPath ), <API key>::SELF_FIRST );
} else {
$iterator = new DirectoryIterator ( $parentPath );
}
foreach ( $iterator as $file ) {
$fileName = $file->getFilename ();
// Only load for php files.
// Note: DirectoryIterator::getExtension only available PHP >= 5.3.6
if ($file->isFile () && substr ( $fileName, strrpos ( $fileName, '.' ) + 1 ) == 'php') {
// Get the class name and full path for each file.
$class = strtolower ( $classPrefix . preg_replace ( '#\.php$#', '', $fileName ) );
// Register the class with the autoloader if not already registered or the force flag is set.
if (empty ( self::$classes [$class] ) || $force) {
self::register ( $class, $file->getPath () . '/' . $fileName );
}
}
}
} catch ( <API key> $e ) {
// Exception will be thrown if the path is not a directory. Ignore it.
}
}
/**
* Method to get the list of registered classes and their respective file paths for the autoloader.
*
* @return array The array of class => path values for the autoloader.
*/
public static function getClassList() {
return self::$classes;
}
/**
* Loads a class from specified directories.
*
* @param string $key
* The class name to look for (dot notation).
* @param string $base
* Search this directory for the class.
*
* @return boolean True on success.
*/
public static function import($key, $base = null) {
// Only import the library if not already attempted.
if (! isset ( self::$imported [$key] )) {
// Setup some variables.
$success = false;
$parts = explode ( '.', $key );
$class = array_pop ( $parts );
$base = (! empty ( $base )) ? $base : dirname ( __FILE__ );
$path = str_replace ( '.', DIRECTORY_SEPARATOR, $key );
// Handle special case for helper classes.
if ($class == 'helper') {
$class = ucfirst ( array_pop ( $parts ) ) . ucfirst ( $class );
} // Standard class.
else {
$class = ucfirst ( $class );
}
// If we are importing a library from the Joomla namespace set the class to autoload.
if (strpos ( $path, 'joomla' ) === 0) {
// Since we are in the Joomla namespace prepend the classname with J.
$class = 'J' . $class;
// Only register the class for autoloading if the file exists.
if (is_file ( $base . '/' . $path . '.php' )) {
self::$classes [strtolower ( $class )] = $base . '/' . $path . '.php';
$success = true;
}
} /*
* If we are not importing a library from the Joomla namespace directly include the file since we cannot assert the file/folder naming conventions.
*/
else {
// If the file exists attempt to include it.
if (is_file ( $base . '/' . $path . '.php' )) {
$success = ( bool ) include_once $base . '/' . $path . '.php';
}
}
// Add the import key to the memory cache container.
self::$imported [$key] = $success;
}
return self::$imported [$key];
}
/**
* Load the file for a class.
*
* @param string $class
* The class to be loaded.
*
* @return boolean True on success
*/
public static function load($class) {
// Sanitize class name.
$class = strtolower ( $class );
// If the class already exists do nothing.
if (class_exists ( $class )) {
return true;
}
// If the class is registered include the file.
if (isset ( self::$classes [$class] )) {
include_once self::$classes [$class];
return true;
}
return false;
}
/**
* Directly register a class to the autoload list.
*
* @param string $class
* The class name to register.
* @param string $path
* Full path to the file that holds the class to register.
* @param boolean $force
* True to overwrite the autoload path value for the class if it already exists.
*
* @return void
*/
public static function register($class, $path, $force = true) {
// Sanitize class name.
$class = strtolower ( $class );
// Only attempt to register the class if the name and file exist.
if (! empty ( $class ) && is_file ( $path )) {
// Register the class with the autoloader if not already registered or the force flag is set.
if (empty ( self::$classes [$class] ) || $force) {
self::$classes [$class] = $path;
}
}
}
/**
* Register a class prefix with lookup path.
* This will allow developers to register library
* packages with different class prefixes to the system autoloader. More than one lookup path
* may be registered for the same class prefix, but if this method is called with the reset flag
* set to true then any registered lookups for the given prefix will be overwritten with the current
* lookup path.
*
* @param string $prefix
* The class prefix to register.
* @param string $path
* Absolute file path to the library root where classes with the given prefix can be found.
* @param boolean $reset
* True to reset the prefix with only the given lookup path.
*
* @return void
*/
public static function registerPrefix($prefix, $path, $reset = false) {
// Verify the library path exists.
if (! file_exists ( $path )) {
throw new RuntimeException ( 'Library path ' . $path . ' cannot be found.', 500 );
}
// If the prefix is not yet registered or we have an explicit reset flag then set set the path.
if (! isset ( self::$prefixes [$prefix] ) || $reset) {
self::$prefixes [$prefix] = array (
$path
);
} // Otherwise we want to simply add the path to the prefix.
else {
self::$prefixes [$prefix] [] = $path;
}
}
/**
* Method to setup the autoloaders for the Joomla Platform.
* Since the SPL autoloaders are
* called in a queue we will add our explicit, class-registration based loader first, then
* fall back on the autoloader based on conventions. This will allow people to register a
* class in a specific location and override platform libraries as was previously possible.
*
* @return void
*/
public static function setup() {
// Register the autoloader functions.
<API key> ( array (
'JMapLoader',
'load'
) );
<API key> ( array (
'JMapLoader',
'_autoload'
) );
}
/**
* Autoload a class based on name.
*
* @param string $class
* The class to be loaded.
*
* @return void
*/
private static function _autoload($class) {
foreach ( self::$prefixes as $prefix => $lookup ) {
if (strpos ( $class, $prefix ) === 0) {
return self::_load ( substr ( $class, strlen ( $prefix ) ), $lookup );
}
}
}
/**
* Load a class based on name and lookup array.
*
* @param string $class
* The class to be loaded (wihtout prefix).
* @param array $lookup
* The array of base paths to use for finding the class file.
*
* @return void
*/
private static function _load($class, $lookup) {
// Split the class name into parts separated by camelCase.
$parts = preg_split ( '/(?<=[a-z0-9])(?=[A-Z])/x', $class );
// If there is only one part we want to duplicate that part for generating the path.
$parts = (count ( $parts ) === 1) ? array (
$parts [0],
$parts [0]
) : $parts;
foreach ( $lookup as $base ) {
// Generate the path based on the class name parts.
$path = $base . '/' . implode ( '/', array_map ( 'strtolower', $parts ) ) . '.php';
// Load the file if it exists.
if (file_exists ( $path )) {
return include $path;
}
}
}
} |
#ifndef _XFCE_OS_H_
#define _XFCE_OS_H_
#define CPU_SCALE 256
#include <glib.h>
typedef struct
{
guint load;
guint64 previous_used;
guint64 previous_total;
} CpuData;
guint detect_cpu_number();
gboolean read_cpu_data( CpuData *data, guint nb_cpu );
#endif /* !_XFCE_OS_H */ |
// Name: src/msw/wince/net.cpp
// Purpose:
// Created:
// RCS-ID: $Id: net.cpp 41054 2006-09-07 19:01:45Z ABX $
// Licence: wxWindows licence
/*
patch holes in winsock
WCE 2.0 lacks many of the 'database' winsock routines.
Stub just enough them for ss.dll.
getprotobynumber
getservbyport
getservbyname
*/
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/msw/wrapwin.h"
#endif
#include <tchar.h>
#include <winsock.h>
#include <string.h>
#include "wx/msw/wince/net.h"
#define CCH_MAX_PROTO 4
static struct protoent RgProtoEnt[] =
{
{ "tcp", {NULL}, 6 },
{ "udp", {NULL}, 17 },
{ "icmp", {NULL}, 1 },
{ "ip", {NULL}, 0 },
{ NULL, {NULL}, 0 }
};
#define CCH_MAX_SERV 8
// Ordered by most likely to be requested.
// Assumes that a service available on different protocols
// will use the same port number on each protocol.
// Should that be no longer the case,
// remove the fFoundOnce code from getservbyXxx fcns.
// This table keeps port numbers in host byte order.
static struct servent RgServEnt[] =
{
{ "ftp", {NULL}, 21, "tcp" },
{ "ftp-data", {NULL}, 20, "tcp" },
{ "telnet", {NULL}, 23, "tcp" },
{ "smtp", {NULL}, 25, "tcp" },
{ "http", {NULL}, 80, "tcp" },
{ "http", {NULL}, 80, "udp" },
{ "pop", {NULL}, 109, "tcp" },
{ "pop2", {NULL}, 109, "tcp" },
{ "pop3", {NULL}, 110, "tcp" },
{ "nntp", {NULL}, 119, "tcp" },
{ "finger", {NULL}, 79, "tcp" },
/* include most of the simple TCP services for testing */
{ "echo", {NULL}, 7, "tcp" },
{ "echo", {NULL}, 7, "udp" },
{ "discard", {NULL}, 9, "tcp" },
{ "discard", {NULL}, 9, "udp" },
{ "chargen", {NULL}, 19, "tcp" },
{ "chargen", {NULL}, 19, "udp" },
{ "systat", {NULL}, 11, "tcp" },
{ "systat", {NULL}, 11, "udp" },
{ "daytime", {NULL}, 13, "tcp" },
{ "daytime", {NULL}, 13, "udp" },
{ "netstat", {NULL}, 15, "tcp" },
{ "qotd", {NULL}, 17, "tcp" },
{ "qotd", {NULL}, 17, "udp" },
{ NULL, {NULL}, 0, NULL }
};
// Since table kept in host byte order,
// return this element to callers
static struct servent ServEntReturn = {0};
// Because CE doesn't have _stricmp - that's why.
static void strcpyLC(char* szDst, const char* szSrc, int cch)
{
int i;
char ch;
for (i = 0, ch = szSrc[i]; i < cch && ch != 0; ch = szSrc[++i])
{
szDst[i] = (ch >= 'A' && ch <= 'Z') ? (ch + ('a'-'A')) : ch;
} szDst[i] = 0;
}
struct servent * WINSOCKAPI getservbyport(int port, const char * proto)
{
port = ntohs((unsigned short)port); // arrives in network byte order
struct servent *ps = &RgServEnt[0];
BOOL fFoundOnce = FALSE; // flag to short-circuit search through rest of db
// Make a lowercase version for comparison
// truncate to 1 char longer than any value in table
char szProtoLC[CCH_MAX_PROTO+2];
if (NULL != proto)
strcpyLC(szProtoLC, proto, CCH_MAX_PROTO+1);
while (NULL != ps->s_name)
{
if (port == ps->s_port)
{
fFoundOnce = TRUE;
if (NULL == proto || !strcmp(szProtoLC, ps->s_proto))
{
ServEntReturn = *ps;
ServEntReturn.s_port = htons(ps->s_port);
return &ServEntReturn;
}
}
else if (fFoundOnce)
break;
++ps;
} return NULL;
}
struct servent * WINSOCKAPI getservbyname(const char * name,
const char * proto)
{
struct servent *ps = &RgServEnt[0];
BOOL fFoundOnce = FALSE; // flag to short-circuit search through rest of db
// Make lowercase versions for comparisons
// truncate to 1 char longer than any value in table
char szNameLC[CCH_MAX_SERV+2];
strcpyLC(szNameLC, name, CCH_MAX_SERV+1);
char szProtoLC[CCH_MAX_PROTO+2];
if (NULL != proto)
strcpyLC(szProtoLC, proto, CCH_MAX_PROTO+1);
while (NULL != ps->s_name)
{
if (!strcmp(szNameLC, ps->s_name))
{
fFoundOnce = TRUE;
if (NULL == proto || !strcmp(szProtoLC, ps->s_proto))
{
ServEntReturn = *ps;
ServEntReturn.s_port = htons(ps->s_port);
return &ServEntReturn;
}
}
else if (fFoundOnce)
break;
++ps;
} return NULL;
}
struct protoent * WINSOCKAPI getprotobynumber(int proto)
{
struct protoent *pr = &RgProtoEnt[0];
while (NULL != pr->p_name)
{
if (proto == pr->p_proto)
return pr;
++pr;
} return NULL;
} |
#!/usr/bin/perl
use Perl::utils;
if(@ARGV==0) {
print STDERR "Merger script for tsv files with SJ counts\n";
}
parse_command_line(i => {description=>'input gtf file name and label', array=>hash},
by => {description=>'comma separated list of key columns', default=>"1"},
val => {description=>'column with values', default=>'2'},
bysep => {description=>'separator',default=>'_'});
%input = @i;
@key = split /\,/, $by;
die unless(keys(%input)>0);
foreach $file(keys(%input)) {
$name = $input{$file};
print STDERR "[",++$N," $file $name";
open FILE, $file;
while($line = <FILE>) {
@array = split /\t/, $line;
unshift(@array, undef);
$id = join($bysep, @array[@key]);
$data{$name}{$id} += $array[$val];
$rows{$id}++;
$cols{$name}++;
}
print STDERR "]\n";
close FILE;
}
@c = sort keys(%cols);
@r = sort keys(%rows);
print join("\t", @c),"\n";
foreach $id(@r) {
@arr = ($id);
foreach $name(@c) {
push @arr, 0 + $data{$name}{$id};
}
print join("\t", @arr), "\n";
} |
package com.ftloverdrive.event.ship;
import com.badlogic.gdx.utils.Pool.Poolable;
import com.ftloverdrive.event.AbstractOVDEvent;
import com.ftloverdrive.io.ImageSpec;
public class <API key> extends AbstractOVDEvent implements Poolable {
public static final int DECOR = 0;
protected int eventType = DECOR;
protected int roomRefId = -1;
protected ImageSpec imageSpec = null;
public <API key>() {
}
/**
* Pseudo-constructor.
*
* @param eventType DECOR to set the room's background
* @param shipRefId a reserved reference id for the new room
* @param imageSpec a new image to use, or null
*/
public void init( int eventType, int roomRefId, ImageSpec imageSpec ) {
this.eventType = eventType;
this.roomRefId = roomRefId;
this.imageSpec = imageSpec;
}
public int getEventType() {
return eventType;
}
public int getRoomRefId() {
return roomRefId;
}
public ImageSpec getImageSpec() {
return imageSpec;
}
@Override
public void reset() {
super.reset();
eventType = DECOR;
roomRefId = -1;
imageSpec = null;
}
} |
<?php
namespace Drupal\webform\Plugin\WebformElement;
use Drupal\Component\Serialization\Json;
use Drupal\webform\Element\WebformMessage as <API key>;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Locale\CountryManager;
use Drupal\webform\WebformInterface;
use Drupal\webform\<API key>;
class Telephone extends TextBase {
/**
* {@inheritdoc}
*/
protected function <API key>() {
$properties = [
'input_hide' => FALSE,
'multiple' => FALSE,
'international' => FALSE,
'<API key>' => '',
'<API key>' => [],
] + parent::<API key>() + $this-><API key>();
// Add support for <API key>.module.
if (\Drupal::moduleHandler()->moduleExists('<API key>')) {
$properties += [
'<API key>' => '',
'<API key>' => '',
'<API key>' => [],
];
}
return $properties;
}
/**
* {@inheritdoc}
*/
protected function <API key>() {
return array_merge(parent::<API key>(), ['<API key>']);
}
/**
* {@inheritdoc}
*/
public function prepare(array &$element, <API key> $webform_submission = NULL) {
parent::prepare($element, $webform_submission);
// Add international library and classes.
if (!empty($element['#international']) && $this->librariesManager->isIncluded('jquery.intl-tel-input')) {
$element['#attached']['library'][] = 'webform/webform.element.telephone';
$element['#attributes']['class'][] = '<API key>';
$element['#attributes']['class'][] = '<API key>';
if (!empty($element['#<API key>'])) {
$element['#attributes']['<API key>'] = $element['#<API key>'];
}
if (!empty($element['#<API key>'])) {
$element['#attributes']['<API key>'] = Json::encode($element['#<API key>']);
}
// The utilsScript is fetched when the page has finished loading to
// prevent blocking.
$utils_script = '/libraries/jquery.intl-tel-input/build/js/utils.js';
// Load utils.js from CDN defined in webform.libraries.yml.
if (!file_exists(DRUPAL_ROOT . $utils_script)) {
/** @var \Drupal\Core\Asset\<API key> $library_discovery */
$library_discovery = \Drupal::service('library.discovery');
$<API key> = $library_discovery->getLibraryByName('webform', 'libraries.jquery.intl-tel-input');
$cdn = reset($<API key>['cdn']);
$utils_script = $cdn . 'build/js/utils.js';
}
$element['#attached']['drupalSettings']['webform']['intlTelInput']['utilsScript'] = $utils_script;
}
// Add support for <API key>.module.
if (\Drupal::moduleHandler()->moduleExists('<API key>')) {
$format = $this->getElementProperty($element, '<API key>');
$format = ($format !== '') ? (int) $format : '';
if ($format === \libphonenumber\PhoneNumberFormat::NATIONAL) {
$country = (array) $this->getElementProperty($element, '<API key>');
}
else {
$country = $this->getElementProperty($element, '<API key>');
}
if ($format !== '') {
$element['#element_validate'][] = [
'Drupal\<API key>\Render\Element\TelephoneValidation',
'validateTel',
];
$element['#<API key>'] = [
'format' => $format,
'country' => $country,
];
}
}
}
/**
* {@inheritdoc}
*/
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$form['telephone'] = [
'#type' => 'fieldset',
'#title' => $this->t('Telephone settings'),
];
$form['telephone']['international'] = [
'#type' => 'checkbox',
'#title' => $this->t('Enhance support for international phone numbers'),
'
'#return_value' => TRUE,
];
$form['telephone']['<API key>'] = [
'#title' => $this->t('Initial country'),
'#type' => 'select',
'#empty_option' => $this->t('- None -'),
'#options' => CountryManager::getStandardList(),
'#states' => [
'visible' => [':input[name="properties[international]"]' => ['checked' => TRUE]],
],
];
$form['telephone']['<API key>'] = [
'#title' => $this->t('Preferred countries'),
'#type' => 'select',
'#options' => CountryManager::getStandardList(),
'#description' => $this->t('Specify the countries to appear at the top of the list.'),
'#select2' => TRUE,
'#multiple' => TRUE,
'#states' => [
'visible' => [':input[name="properties[international]"]' => ['checked' => TRUE]],
],
];
$this->elementManager->processElement($form['telephone']['<API key>']);
if ($this->librariesManager->isExcluded('jquery.intl-tel-input')) {
$form['telephone']['#access'] = FALSE;
$form['telephone']['international']['#access'] = FALSE;
$form['telephone']['<API key>']['#access'] = FALSE;
$form['telephone']['<API key>']['#access'] = FALSE;
}
// Add support for <API key>.module.
if (\Drupal::moduleHandler()->moduleExists('<API key>')) {
$form['telephone']['<API key>'] = [
'#type' => 'select',
'#title' => $this->t('Valid format'),
'
'#empty_option' => $this->t('- None -'),
'#options' => [
\libphonenumber\PhoneNumberFormat::E164 => $this->t('E164'),
\libphonenumber\PhoneNumberFormat::NATIONAL => $this->t('National'),
],
];
$form['telephone']['<API key>'] = [
'#type' => 'select',
'#title' => $this->t('Valid country'),
'#options' => \Drupal::service('<API key>.validator')
->getCountryList(),
'#states' => [
'visible' => [
':input[name="properties[<API key>]"]' => ['value' => \libphonenumber\PhoneNumberFormat::NATIONAL],
],
'required' => [
':input[name="properties[<API key>]"]' => ['value' => \libphonenumber\PhoneNumberFormat::NATIONAL],
],
],
];
$form['telephone']['<API key>'] = [
'#type' => 'select',
'#title' => $this->t('Valid countries'),
'#description' => $this->t('If no country selected all countries are valid.'),
'#options' => \Drupal::service('<API key>.validator')
->getCountryList(),
'#select2' => TRUE,
'#multiple' => TRUE,
'#states' => [
'visible' => [
':input[name="properties[<API key>]"]' => ['value' => \libphonenumber\PhoneNumberFormat::E164],
],
],
];
$this->elementManager->processElement($form['telephone']['<API key>']);
}
elseif (\Drupal::currentUser()->hasPermission('administer modules')) {
$t_args = [':href' => 'https:
$form['telephone']['<API key>'] = [
'#type' => 'webform_message',
'#message_type' => 'info',
'#message_message' => $this->t('Install the <a href=":href">Telephone validation</a> module which provides international phone number validation.', $t_args),
'#message_id' => 'webform.<API key>',
'#message_close' => TRUE,
'#message_storage' => <API key>::STORAGE_STATE,
'#access' => TRUE,
];
}
return $form;
}
/**
* {@inheritdoc}
*/
protected function formatHtmlItem(array $element, <API key> $webform_submission, array $options = []) {
$value = $this->getValue($element, $webform_submission, $options);
if (empty($value)) {
return '';
}
$format = $this->getItemFormat($element);
switch ($format) {
case 'link':
$t_args = [':tel' => 'tel:' . $value, '@tel' => $value];
return $this->t('<a href=":tel">@tel</a>', $t_args);
default:
return parent::formatHtmlItem($element, $webform_submission, $options);
}
}
/**
* {@inheritdoc}
*/
public function <API key>() {
return 'link';
}
/**
* {@inheritdoc}
*/
public function getItemFormats() {
return parent::getItemFormats() + [
'link' => $this->t('Link'),
];
}
/**
* {@inheritdoc}
*/
public function preview() {
return parent::preview() + [
'#international' => TRUE,
];
}
/**
* {@inheritdoc}
*/
public function getTestValues(array $element, WebformInterface $webform, array $options = []) {
if (empty($element['#international'])) {
return FALSE;
}
return [
'+1 212-333-4444',
'+1 718-555-6666',
];
}
} |
subroutine chk441(dat,jz,tstart,width,nfreeze,mousedf, &
dftolerance,pick,nok)
! Experimental FSK441 decoder
parameter (NMAX=512*1024)
parameter (MAXFFT=8192)
real dat(NMAX) !Raw signal, 30 s at 11025 sps
logical pick
complex cdat(NMAX) !Analytic form of signal
character frag*28,frag0*29 !Message fragment to be matched
complex cfrag(2100) !Complex waveform of message fragment
complex z
integer itone(84) !Generated tones for msg fragment
real s(NMAX)
real ccf(-6000:6000)
integer dftolerance
logical first
data first/.true./
common/scratch/work(NMAX)
save
if(first) then
call abc441(' ',1,itone,ndits) !Generate waveform for <space>
call gen441(itone,ndits,cfrag)
first=.true.
endif
ccf0=3.0
sb0=0.75
if(pick) then
ccf0=2.1
sb0=0.60
endif
nsps=25 !Initialize variables
nsam=nsps*ndits
dt=1.0/11025.0
i0=(tstart-0.02)/dt
if(i0.lt.1) i0=1
npts=nint((width+0.02)/dt)+1
npts=min(npts,jz+1-i0)
npts=min(npts,22050) !Max ping length 2 s
xn=log(float(npts))/log(2.0)
n=xn
if(xn-n .gt.0.001) n=n+1
nfft1=2**n
df1=11025.0/nfft1
nok=0
sbest=0.
call analytic(dat(i0),npts,nfft1,s,cdat) !Convert to analytic signal
! call len441(cdat,npts,lenacf,nacf) !Do ACF to find message length
ia=nint(dftolerance/df1)
i0=0
if(nfreeze.ne.0) i0=nint(mousedf/df1)
ccfmax=0.
do i=-ia,ia !Find DF
ccf(i)=s(i0+i+nint(882.0/df1)) + s(i0+i+nint(1323.0/df1)) + &
s(i0+i+nint(1764.0/df1)) + s(i0+i+nint(2205.0/df1))
enddo
ccf(:-ia-1)=0.
ccf(ia+1:)=0.
nadd=2*nint(5.0/df1)+1
call smo(ccf(-ia),2*ia+1,work,nadd) !Smooth CCF by nadd
do i=-ia,ia !Find max of smoothed CCF
if(ccf(i).gt.ccfmax) then
ccfmax=ccf(i)
ipk=i0+i
dfx=ipk*df1
endif
enddo
ic=min(nint(220/df1),ia) !Baseline range +/- 220 Hz
call pctile(ccf(ipk-ic),work,2*ic+1,50,base)
ccfmax=ccfmax/base
if(ccfmax.lt.ccf0) go to 800 !Reject non-FSK441 signals
! We seem to have an FSK441 ping, and we know DF; now find DT.
call tweak1(cdat,npts,-dfx,cdat) !Mix to standard frequency
! Look for best match to "frag", find its DT
do i=1,npts-nsam
z=0.
a=0.
do j=1,nsam
a=a + abs(cdat(j+i-1))
z=z + cdat(j+i-1)*conjg(cfrag(j))
enddo
ss=abs(z)/a
if(ss.gt.sbest) then
sbest=ss
ipk=i
amp=a/nsam
endif
enddo
if(sbest.lt.sb0) go to 800 !Skip if not decodable FSK441 data
nok=1
800 continue
return
end subroutine chk441 |
<?php
//Config for project
return array(
'system' => array(
'tmp_path' => public_path().'/tmp/',
),
'contacts' => array(
'developer' => 'developer@example.com',
'administrator' => 'administrator@example.com'
),
); |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML3.2 EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="DOCTEXT">
<TITLE>MPI_Testall</TITLE>
</HEAD>
<BODY BGCOLOR="FFFFFF">
<A NAME="MPI_Testall"><H1>MPI_Testall</H1></A>
Tests for the completion of all previously initiated requests
<H2>Synopsis</H2>
<PRE>
int MPI_Testall(int count, MPI_Request array_of_requests[], int *flag,
MPI_Status array_of_statuses[])
</PRE>
<H2>Input Parameters</H2>
<DL>
<DT><B>count </B><DD>lists length (integer)
<DT><B>array_of_requests </B><DD>array of requests (array of handles)
</DL>
<P>
<H2>Output Parameters</H2>
<DL>
<DT><B>flag </B><DD>True if all requests have completed; false otherwise (logical)
<DT><B>array_of_statuses </B><DD>array of status objects (array of Status). May be
<TT>MPI_STATUSES_IGNORE</TT>.
</DL>
<P>
<H2>Notes</H2>
<TT>flag</TT> is true only if all requests have completed. Otherwise, flag is
false and neither the <TT>array_of_requests</TT> nor the <TT>array_of_statuses</TT> is
modified.
<P>
If one or more of the requests completes with an error, <TT>MPI_ERR_IN_STATUS</TT> is
returned. An error value will be present is elements of <TT>array_of_status
</TT>associated with the requests. Likewise, the <TT>MPI_ERROR</TT> field in the status
elements associated with requests that have successfully completed will be
<TT>MPI_SUCCESS</TT>. Finally, those requests that have not completed will have a
value of <TT>MPI_ERR_PENDING</TT>.
<P>
While it is possible to list a request handle more than once in the
<TT>array_of_requests</TT>, such an action is considered erroneous and may cause the
program to unexecpectedly terminate or produce incorrect results.
<P>
<H2>Thread and Interrupt Safety</H2>
<P>
This routine is thread-safe. This means that this routine may be
safely used by multiple threads without the need for any user-provided
thread locks. However, the routine is not interrupt safe. Typically,
this is due to the use of memory allocation routines such as <TT>malloc
</TT>or other non-MPICH runtime routines that are themselves not interrupt-safe.
<P>
<H2>Notes on the MPI_Status argument</H2>
<P>
The <TT>MPI_ERROR</TT> field of the status return is only set if
the return from the MPI routine is <TT>MPI_ERR_IN_STATUS</TT>. That error class
is only returned by the routines that take an array of status arguments
(<TT>MPI_Testall</TT>, <TT>MPI_Testsome</TT>, <TT>MPI_Waitall</TT>, and <TT>MPI_Waitsome</TT>). In
all other cases, the value of the <TT>MPI_ERROR</TT> field in the status is
unchanged. See section 3.2.5 in the MPI-1.1 specification for the
exact text.
<P>
For send operations, the only use of status is for <TT>MPI_Test_cancelled</TT> or
in the case that there is an error in one of the four routines that
may return the error class <TT>MPI_ERR_IN_STATUS</TT>, in which case the
<TT>MPI_ERROR</TT> field of status will be set. In that case, the value
will be set to <TT>MPI_SUCCESS</TT> for any send or receive operation that completed
successfully, or <TT>MPI_ERR_PENDING</TT> for any operation which has neither
failed nor completed.
<P>
<H2>Notes for Fortran</H2>
All MPI routines in Fortran (except for <TT>MPI_WTIME</TT> and <TT>MPI_WTICK</TT>) have
an additional argument <TT>ierr</TT> at the end of the argument list. <TT>ierr
</TT>is an integer and has the same meaning as the return value of the routine
in C. In Fortran, MPI routines are subroutines, and are invoked with the
<TT>call</TT> statement.
<P>
All MPI objects (e.g., <TT>MPI_Datatype</TT>, <TT>MPI_Comm</TT>) are of type <TT>INTEGER
</TT>in Fortran.
<P>
<H2>Errors</H2>
<P>
All MPI routines (except <TT>MPI_Wtime</TT> and <TT>MPI_Wtick</TT>) return an error value;
C routines as the value of the function and Fortran routines in the last
argument. Before the value is returned, the current MPI error handler is
called. By default, this error handler aborts the MPI job. The error handler
may be changed with <TT><API key></TT> (for communicators),
<TT><API key></TT> (for files), and <TT><API key></TT> (for
RMA windows). The MPI-1 routine <TT>MPI_Errhandler_set</TT> may be used but
its use is deprecated. The predefined error handler
<TT>MPI_ERRORS_RETURN</TT> may be used to cause error values to be returned.
Note that MPI does <EM>not</EM> guarentee that an MPI program can continue past
an error; however, MPI implementations will attempt to continue whenever
possible.
<P>
<DL><DT><B>MPI_SUCCESS </B> <DD> No error; MPI routine completed successfully.
</DL>
<DL><DT><B>MPI_ERR_IN_STATUS </B> <DD> The actual error value is in the <TT>MPI_Status</TT> argument.
This error class is returned only from the multiple-completion routines
(<TT>MPI_Testall</TT>, <TT>MPI_Testany</TT>, <TT>MPI_Testsome</TT>, <TT>MPI_Waitall</TT>, <TT>MPI_Waitany</TT>,
and <TT>MPI_Waitsome</TT>). The field <TT>MPI_ERROR</TT> in the status argument
contains the error value or <TT>MPI_SUCCESS</TT> (no error and complete) or
<TT>MPI_ERR_PENDING</TT> to indicate that the request has not completed.
</DL>
The MPI Standard does not specify what the result of the multiple
completion routines is when an error occurs. For example, in an
<TT>MPI_WAITALL</TT>, does the routine wait for all requests to either fail or
complete, or does it return immediately (with the MPI definition of
immediately, which means independent of actions of other MPI processes)?
MPICH has chosen to make the return immediate (alternately, local in MPI
terms), and to use the error class <TT>MPI_ERR_PENDING</TT> (introduced in MPI 1.1)
to indicate which requests have not completed. In most cases, only
one request with an error will be detected in each call to an MPI routine
that tests multiple requests. The requests that have not been processed
(because an error occured in one of the requests) will have their
<TT>MPI_ERROR</TT> field marked with <TT>MPI_ERR_PENDING</TT>.
<DL><DT><B>MPI_ERR_REQUEST </B> <DD> Invalid <TT>MPI_Request</TT>. Either null or, in the case of a
<TT>MPI_Start</TT> or <TT>MPI_Startall</TT>, not a persistent request.
</DL>
<DL><DT><B>MPI_ERR_ARG </B> <DD> Invalid argument. Some argument is invalid and is not
identified by a specific error class (e.g., <TT>MPI_ERR_RANK</TT>).
</DL>
<P><B>Location:</B>src/mpi/pt2pt/testall.c<P>
</BODY></HTML> |
snd-seq-oss-objs := seq_oss.o seq_oss_init.o seq_oss_timer.o seq_oss_ioctl.o \
seq_oss_event.o seq_oss_rw.o seq_oss_synth.o \
seq_oss_midi.o seq_oss_readq.o seq_oss_writeq.o
obj-$(<API key>) += snd-seq-oss.o |
#!/usr/bin/env sysbench
-- This program is free software; you can redistribute it and/or modify
-- (at your option) any later version.
-- This program is distributed in the hope that it will be useful,
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-- Delete-Only OLTP benchmark
require("oltp_common")
function prepare_statements()
<API key>()
end
function event()
<API key>()
end |
NAME= Xorg-proto
VER= X11R7.5
URLBASE= http://ftp.x.org/pub/individual/proto
include $(MY_ROOT)/packages/$(NAME)/filelist
ALLFILES= $(foreach FILE,$(sort $(filter FILE%,$(.VARIABLES))),$($(FILE)))
include $(MY_ROOT)/scripts/functions
stage2: Makefile $(ALLFILES)
$(foreach DIR,$(subst .tar.bz2,,$(ALLFILES)),make FILE=$(DIR).tar.bz2 DIR=$(DIR) $(DIR)-stage2 && ) true
compile-%-stage2:
./configure --prefix=/usr --sysconfdir=/etc --mandir=/usr/share/man --localstatedir=/var
make
make install
%-stage2:
$(std_build)
clean:
rm -rf *-*/ |
<!DOCTYPE html PUBLIC "-
<html xmlns="http:
<head>
<title><?php print $head_title; ?></title>
<?php print $head; ?>
<?php print $styles; ?>
<!--[if IE]>
<link rel="stylesheet" href="<?php print $base_path . $directory ?>/ie.css" type="text/css">
<?php if ($subtheme_directory && file_exists($subtheme_directory .'/ie.css')): ?>
<link rel="stylesheet" href="<?php print $base_path . $subtheme_directory ?>/ie.css" type="text/css">
<?php endif; ?>
<![endif]
<?php print $scripts; ?>
</head>
<body class="<?php print $body_classes; ?>">
<div id="page">
<div id="header">
<div id="skip-nav"><a href="#content"><?php print t('Skip to Main Content'); ?></a></div>
<div id="logo-title">
<?php print $search_box; ?>
<?php if (!empty($logo)): ?>
<a href="<?php print $base_path; ?>" title="<?php print t('Home'); ?>" rel="home">
<img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" id="logo" />
</a>
<?php endif; ?>
<div id="name-and-slogan">
<?php if (!empty($site_name)): ?>
<div id='site-name'><strong>
<a href="<?php print $base_path ?>" title="<?php print t('Home'); ?>" rel="home">
<?php print $site_name; ?>
</a>
</strong></div>
<?php endif; ?>
<?php if (!empty($site_slogan)): ?>
<div id='site-slogan'>
<?php print $site_slogan; ?>
</div>
<?php endif; ?>
</div> <!-- /name-and-slogan -->
</div> <!-- /logo-title -->
<div id="navigation" class="menu<?php if ($primary_links) { print " withprimary"; } if ($secondary_links) { print " withsecondary"; } ?> ">
<?php if (!empty($primary_links)): ?>
<div id="primary" class="clear-block">
<?php print theme('links', $primary_links); ?>
</div>
<?php endif; ?>
<?php if (!empty($secondary_links)): ?>
<div id="secondary" class="clear-block">
<?php print theme('links', $secondary_links); ?>
</div>
<?php endif; ?>
</div>
<div class="smc_toolbar" id="wikitoolbar">
<a href="<?php print url("wikichanges");?>" id="toolbarforumunread">Recent Wiki Changes</a> |
<a href="<?php print url("wiki_index");?>" id="toolbarwikiinsdex">Wiki Page Index</a> |
<a href="<?php print url('logout');?>">Logout</a>
<?php if (!empty($tabs)): ?><div class="tabs"><?php print $tabs; ?></div><?php endif; ?>
</div>
<?php if (!empty($header)): ?>
<div id="header-region">
<?php print $header; ?>
</div> <!-- /header-region -->
<?php endif; ?>
</div> <!-- /header -->
<div id="container" class="clear-block">
<?php if (!empty($sidebar_left)): ?>
<div id="sidebar-left" class="column sidebar">
<?php print $sidebar_left; ?>
</div> <!-- /sidebar-left -->
<?php endif; ?>
<div id="main" class="column"><div id="squeeze" class="clear-block">
<?php if (!empty($mission)): ?>
<div id="mission"><?php print $mission; ?></div>
<?php endif; ?>
<?php if (!empty($content_top)):?>
<div id="content-top"><?php print $content_top; ?></div>
<?php endif; ?>
<div id="content">
<?php if (!empty($title)): ?>
<?php endif; ?>
<?php print $help; ?>
<?php print $messages; ?>
<?php print $content; ?>
<?php if (!empty($feed_icons)): ?>
<div class="feed-icons"><?php print $feed_icons; ?></div>
<?php endif; ?>
</div> <!-- /content -->
<?php if (!empty($content_bottom)): ?>
<div id="content-bottom"><?php print $content_bottom; ?></div>
<?php endif; ?>
</div></div> <!-- /squeeze /main -->
<?php if (!empty($sidebar_right)): ?>
<div id="sidebar-right" class="column sidebar">
<?php print $sidebar_right; ?>
</div> <!-- /sidebar-right -->
<?php endif; ?>
</div> <!-- /container -->
<div id="footer-wrapper">
<div id="footer">
<?php print $footer_message; ?>
</div> <!-- /footer -->
</div> <!-- /footer-wrapper -->
<?php if ($closure_region): ?>
<div id="closure-blocks"><?php print $closure_region; ?></div>
<?php endif; ?>
<?php print $closure; ?>
</div> <!-- /page -->
</body>
</html> |
#!/bin/sh
# Please refer to RPC & TI-RPC Test Suite documentation.
# TEST : RPC svc_destroy basic
# creation : 2007-05-25 revision 2007-
# Parameters such as tests information, threads number...
# test information
TESTNAME="<API key>.basic"
TESTVERS="1.0"
# test binaries, used to call
TESTCLIENTPATH="rpc_suite/rpc/<API key>"
TESTCLIENTBIN="1-basic.bin"
TESTCLIENT=$CLIENTTSTPACKDIR/$TESTCLIENTPATH/$TESTCLIENTBIN
# table to save all tests result
result=
# tmp file declaration to store test returned result
TMPRESULTFILE=/tmp/rpcts.tmp
# erase temp. result file
echo -n "">$TMPRESULTFILE
# function to collect log result
get_test_result()
{
# default : test failed
r_value=1
# if result table is empty last test crashes (segment fault), so return must be "failed"
if [ ${#result[*]} -eq 0 ]
then
return
fi
for ((a=0; a < TESTINSTANCE-1 ; a++))
do
if [ ${result[$a]} -ne ${result[`expr $a + 1`]} ]
then
return
fi
done
# if all test instances return same result return the first element, note that test succeeds if value is 0
r_value=${result[0]}
}
# function to put test result into logfile
result_to_logFile()
{
case $r_value in
0)r_valueTxt="PASS";;
1)r_valueTxt="FAILED";;
2)r_valueTxt="HUNG";;
3)r_valueTxt="INTERRUPTED";;
4)r_valueTxt="SKIP";;
5)r_valueTxt="UNTESTED";;
esac
echo $TESTCLIENTPATH"/"$( echo $TESTCLIENTBIN | cut -d . -f1 )": execution: "$r_valueTxt>>$LOCLOGDIR/$TESTLOGFILE
}
# launch client instances depeding on test...
for ((a=0; a < TESTINSTANCE ; a++))
do
$REMOTESHELL $CLIENTUSER@$CLIENTIP "$TESTCLIENT $SERVERIP $PROGNUMNOSVC" >>$TMPRESULTFILE&
done
# wait for the end of all test
sleep $GLOBALTIMEOUT
# test if all test instances have stopped
# if it remains at least one instances, script kills instances and put status HUNG to the whole test case
IS_EX=`$REMOTESHELL $CLIENTUSER@$CLIENTIP "ps -e | grep $TESTCLIENTBIN"`
if [ "$IS_EX" ]
then
if [ $VERBOSE -eq 1 ]
then
echo " - error : prog is still running -> kill"
fi
$REMOTESHELL $CLIENTUSER@$CLIENTIP "killall -9 $TESTCLIENTBIN"
r_value=2
result_to_logFile
echo " * $TESTNAME execution: "$r_valueTxt
exit 2
fi
# if test program correctly run, this part aims to collect all test results and put this result into log file
result=( $(cat $TMPRESULTFILE) )
get_test_result
result_to_logFile
echo " * $TESTNAME execution: "$r_valueTxt |
using UnityEngine;
using System.Collections;
public class DestroyByTime : MonoBehaviour {
public float lifetime;
void Start ()
{
Destroy (gameObject, lifetime);
}
} |
#ifndef MMC_HOST_DEF_H
#define MMC_HOST_DEF_H
/*
* OMAP HSMMC register definitions
*/
#if defined(CONFIG_TI816X)
# define OMAP_HSMMC_BASE 0x48060100
#elif defined(CONFIG_TI814X)
# define OMAP_HSMMC_BASE 0x481D8100
#endif
typedef struct hsmmc {
unsigned char res1[0x10];
unsigned int sysconfig; /* 0x10 */
unsigned int sysstatus; /* 0x14 */
unsigned char res2[0x14];
unsigned int con; /* 0x2C */
unsigned char res3[0xD4];
unsigned int blk; /* 0x104 */
unsigned int arg; /* 0x108 */
unsigned int cmd; /* 0x10C */
unsigned int rsp10; /* 0x110 */
unsigned int rsp32; /* 0x114 */
unsigned int rsp54; /* 0x118 */
unsigned int rsp76; /* 0x11C */
unsigned int data; /* 0x120 */
unsigned int pstate; /* 0x124 */
unsigned int hctl; /* 0x128 */
unsigned int sysctl; /* 0x12C */
unsigned int stat; /* 0x130 */
unsigned int ie; /* 0x134 */
unsigned char res4[0x8];
unsigned int capa; /* 0x140 */
} hsmmc_t;
/*
* OMAP HS MMC Bit definitions
*/
#define MMC_SOFTRESET (0x1 << 1)
#define RESETDONE (0x1 << 0)
#define NOOPENDRAIN (0x0 << 0)
#define OPENDRAIN (0x1 << 0)
#define OD (0x1 << 0)
#define INIT_NOINIT (0x0 << 1)
#define INIT_INITSTREAM (0x1 << 1)
#define HR_NOHOSTRESP (0x0 << 2)
#define STR_BLOCK (0x0 << 3)
#define MODE_FUNC (0x0 << 4)
#define DW8_1_4BITMODE (0x0 << 5)
#define MIT_CTO (0x0 << 6)
#define CDP_ACTIVEHIGH (0x0 << 7)
#define WPP_ACTIVEHIGH (0x0 << 8)
#define RESERVED_MASK (0x3 << 9)
#define CTPL_MMC_SD (0x0 << 11)
#define BLEN_512BYTESLEN (0x200 << 0)
#define NBLK_STPCNT (0x0 << 16)
#define DE_DISABLE (0x0 << 0)
#define BCE_DISABLE (0x0 << 1)
#define ACEN_DISABLE (0x0 << 2)
#define DDIR_OFFSET (4)
#define DDIR_MASK (0x1 << 4)
#define DDIR_WRITE (0x0 << 4)
#define DDIR_READ (0x1 << 4)
#define MSBS_SGLEBLK (0x0 << 5)
#define RSP_TYPE_OFFSET (16)
#define RSP_TYPE_MASK (0x3 << 16)
#define RSP_TYPE_NORSP (0x0 << 16)
#define RSP_TYPE_LGHT136 (0x1 << 16)
#define RSP_TYPE_LGHT48 (0x2 << 16)
#define RSP_TYPE_LGHT48B (0x3 << 16)
#define CCCE_NOCHECK (0x0 << 19)
#define CCCE_CHECK (0x1 << 19)
#define CICE_NOCHECK (0x0 << 20)
#define CICE_CHECK (0x1 << 20)
#define DP_OFFSET (21)
#define DP_MASK (0x1 << 21)
#define DP_NO_DATA (0x0 << 21)
#define DP_DATA (0x1 << 21)
#define CMD_TYPE_NORMAL (0x0 << 22)
#define INDEX_OFFSET (24)
#define INDEX_MASK (0x3f << 24)
#define INDEX(i) (i << 24)
#define DATI_MASK (0x1 << 1)
#define DATI_CMDDIS (0x1 << 1)
#define DTW_1_BITMODE (0x0 << 1)
#define DTW_4_BITMODE (0x1 << 1)
#define SDBP_PWROFF (0x0 << 8)
#define SDBP_PWRON (0x1 << 8)
#define SDVS_1V8 (0x5 << 9)
#define SDVS_3V0 (0x6 << 9)
#define ICE_MASK (0x1 << 0)
#define ICE_STOP (0x0 << 0)
#define ICS_MASK (0x1 << 1)
#define ICS_NOTREADY (0x0 << 1)
#define ICE_OSCILLATE (0x1 << 0)
#define CEN_MASK (0x1 << 2)
#define CEN_DISABLE (0x0 << 2)
#define CEN_ENABLE (0x1 << 2)
#define CLKD_OFFSET (6)
#define CLKD_MASK (0x3FF << 6)
#define DTO_MASK (0xF << 16)
#define DTO_15THDTO (0xE << 16)
#define SOFTRESETALL (0x1 << 24)
#define CC_MASK (0x1 << 0)
#define TC_MASK (0x1 << 1)
#define BWR_MASK (0x1 << 4)
#define BRR_MASK (0x1 << 5)
#define ERRI_MASK (0x1 << 15)
#define IE_CC (0x01 << 0)
#define IE_TC (0x01 << 1)
#define IE_BWR (0x01 << 4)
#define IE_BRR (0x01 << 5)
#define IE_CTO (0x01 << 16)
#define IE_CCRC (0x01 << 17)
#define IE_CEB (0x01 << 18)
#define IE_CIE (0x01 << 19)
#define IE_DTO (0x01 << 20)
#define IE_DCRC (0x01 << 21)
#define IE_DEB (0x01 << 22)
#define IE_CERR (0x01 << 28)
#define IE_BADA (0x01 << 29)
#define VS30_3V0SUP (1 << 25)
#define VS18_1V8SUP (1 << 26)
/* Driver definitions */
#define MMCSD_SECTOR_SIZE 512
#define MMC_CARD 0
#define SD_CARD 1
#define BYTE_MODE 0
#define SECTOR_MODE 1
#define CLK_INITSEQ 0
#define CLK_400KHZ 1
#define CLK_MISC 2
typedef struct {
unsigned int card_type;
unsigned int version;
unsigned int mode;
unsigned int size;
unsigned int RCA;
} mmc_card_data;
#define mmc_reg_out(addr, mask, val)\
writel((readl(addr) & (~(mask))) | ((val) & (mask)), (addr))
#endif /* MMC_HOST_DEF_H */ |
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if ( ! class_exists( 'WPC_Tax_Condition' ) ) {
class WPC_Tax_Condition extends WPC_Condition {
public function __construct() {
$this->name = __( 'Tax', 'wpc-conditions' );
$this->slug = __( 'tax', 'wpc-conditions' );
$this->group = __( 'Cart', 'wpc-conditions' );
$this->description = __( 'Compared against the tax total amount', 'wpc-conditions' );
parent::__construct();
}
public function get_value( $value ) {
return str_replace( ',', '.', $value );
}
public function get_compare_value() {
return array_sum( (array) WC()->cart->taxes );
}
}
} |
<!DOCTYPE HTML PUBLIC "-
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_67) on Thu Apr 09 10:31:44 MDT 2015 -->
<meta http-equiv="Content-Type" content="text/html" charset="utf-8">
<title>org.apache.lucene.util.mutable (Lucene 5.1.0 API)</title>
<meta name="date" content="2015-04-09">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
</head>
<body>
<h1 class="bar"><a href="../../../../../org/apache/lucene/util/mutable/package-summary.html" target="classFrame">org.apache.lucene.util.mutable</a></h1>
<div class="indexContainer">
<h2 title="Classes">Classes</h2>
<ul title="Classes">
<li><a href="MutableValue.html" title="class in org.apache.lucene.util.mutable" target="classFrame">MutableValue</a></li>
<li><a href="MutableValueBool.html" title="class in org.apache.lucene.util.mutable" target="classFrame">MutableValueBool</a></li>
<li><a href="MutableValueDate.html" title="class in org.apache.lucene.util.mutable" target="classFrame">MutableValueDate</a></li>
<li><a href="MutableValueDouble.html" title="class in org.apache.lucene.util.mutable" target="classFrame">MutableValueDouble</a></li>
<li><a href="MutableValueFloat.html" title="class in org.apache.lucene.util.mutable" target="classFrame">MutableValueFloat</a></li>
<li><a href="MutableValueInt.html" title="class in org.apache.lucene.util.mutable" target="classFrame">MutableValueInt</a></li>
<li><a href="MutableValueLong.html" title="class in org.apache.lucene.util.mutable" target="classFrame">MutableValueLong</a></li>
<li><a href="MutableValueStr.html" title="class in org.apache.lucene.util.mutable" target="classFrame">MutableValueStr</a></li>
</ul>
</div>
</body>
</html> |
#ifndef <API key>
#define <API key>
/** \class ExRootTreeWriter
*
* Class handling output ROOT tree
*
* \author P. Demin - UCL, Louvain-la-Neuve
*
*/
#include "TNamed.h"
#include "CMExRootTreeBranch.h"
#include <set>
class TFile;
class TTree;
class TClass;
class ExRootTreeBranch;
class CMExRootTreeWriter : public TNamed
{
public:
CMExRootTreeWriter(TFile *file = 0, const char *treeName = "Analysis");
~CMExRootTreeWriter();
void SetTreeFile(TFile *file) { fFile = file; }
void SetTreeName(const char *name) { fTreeName = name; }
CMExRootTreeBranch *NewBranch(const char *name, TClass *cl);
inline std::set<CMExRootTreeBranch*> GetBranches() {return fBranches;};
void Clear();
void Fill();
void Write();
private:
TTree *NewTree();
TFile *fFile;
TTree *fTree;
TString fTreeName;
std::set<CMExRootTreeBranch*> fBranches;
};
#endif /* CMExRootTreeWriter */ |
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/init.h>
#include <linux/bitops.h>
#include <linux/memblock.h>
#include <linux/bootmem.h>
#include <linux/mm.h>
#include <linux/range.h>
/* Check for already reserved areas */
/* memblock (addr~last) (reserved) */
bool __init <API key>(u64 *addrp, u64 *sizep, u64 align)
{
struct memblock_region *r;
u64 addr = *addrp, last;
u64 size = *sizep;
bool changed = false;
again:
last = addr + size;
for_each_memblock(reserved, r) {
/* (addr~last) memblock */
if (last > r->base && addr < r->base) {
size = r->base - addr;
changed = true;
goto again;
}
/* memblock . */
if (last > (r->base + r->size) && addr < (r->base + r->size)) {
addr = round_up(r->base + r->size, align);
size = last - addr;
changed = true;
goto again;
}
/* memblock
* 0 .
*/
if (last <= (r->base + r->size) && addr >= r->base) {
*sizep = 0;
return false;
}
}
if (changed) {
*addrp = addr;
*sizep = size;
}
return changed;
}
/*
* Find next free range after start, and size is returned in *sizep
*/
/* start
* align .
*/
u64 __init <API key>(u64 start, u64 *sizep, u64 align)
{
struct memblock_region *r;
for_each_memblock(memory, r) {
u64 ei_start = r->base;
u64 ei_last = ei_start + r->size;
u64 addr;
/* align . */
addr = round_up(ei_start, align);
if (addr < start)
addr = round_up(start, align);
if (addr >= ei_last)
continue;
/* memblock */
*sizep = ei_last - addr;
/* reserved */
while (<API key>(&addr, sizep, align))
;
if (*sizep)
return addr;
}
return MEMBLOCK_ERROR;
}
/* memblock */
static __init struct range *find_range_array(int count)
{
u64 end, size, mem;
struct range *range;
size = sizeof(struct range) * count;
end = memblock.current_limit;
mem = <API key>(0, end, size, sizeof(struct range));
if (mem == MEMBLOCK_ERROR)
panic("can not find more space for range array");
/*
* This range is tempoaray, so don't reserve it, it will not be
* overlapped because We will not alloccate new buffer before
* We discard this one
*/
range = __va(mem);
memset(range, 0, size);
return range;
}
static void __init <API key>(struct range *range, int az)
{
u64 final_start, final_end;
struct memblock_region *r;
/* Take out region array itself at first*/
<API key>();
memblock_dbg("Subtract (%ld early reservations)\n", memblock.reserved.cnt);
for_each_memblock(reserved, r) {
memblock_dbg(" [%010llx-%010llx]\n", (u64)r->base, (u64)r->base + r->size - 1);
final_start = PFN_DOWN(r->base);
final_end = PFN_UP(r->base + r->size);
if (final_start >= final_end)
continue;
subtract_range(range, az, final_start, final_end);
}
/* Put region array back ? */
<API key>();
}
struct count_data {
int nr;
};
static int __init count_work_fn(unsigned long start_pfn,
unsigned long end_pfn, void *datax)
{
struct count_data *data = datax;
data->nr++;
return 0;
}
static int __init <API key>(int nodeid)
{
struct count_data data;
data.nr = 0;
<API key>(nodeid, count_work_fn, &data);
return data.nr;
}
int __init <API key>(struct range **rangep, int nodeid,
unsigned long start_pfn, unsigned long end_pfn)
{
int count;
struct range *range;
int nr_range;
count = (memblock.reserved.cnt + <API key>(nodeid)) * 2;
range = find_range_array(count);
nr_range = 0;
/*
* Use early_node_map[] and memblock.reserved.region to get range array
* at first
*/
nr_range = <API key>(range, count, nr_range, nodeid);
subtract_range(range, count, 0, start_pfn);
subtract_range(range, count, end_pfn, -1ULL);
<API key>(range, count);
nr_range = clean_sort_range(range, count);
*rangep = range;
return nr_range;
}
int __init <API key>(struct range **rangep, int nodeid)
{
unsigned long end_pfn = -1UL;
#ifdef CONFIG_X86_32
end_pfn = max_low_pfn;
#endif
return <API key>(rangep, nodeid, 0, end_pfn);
}
/**
* memblock (memroy, reserved) range(addr~limit) .
* get_free free .
*/
static u64 __init <API key>(u64 addr, u64 limit, bool get_free)
{
int i, count;
struct range *range;
int nr_range;
u64 final_start, final_end;
u64 free_size;
struct memblock_region *r;
/* subtract . */
count = (memblock.reserved.cnt + memblock.memory.cnt) * 2;
/* memblock count . */
range = find_range_array(count);
nr_range = 0;
addr = PFN_UP(addr);
limit = PFN_DOWN(limit);
/* memblock memory */
for_each_memblock(memory, r) {
/* Page Page */
final_start = PFN_UP(r->base);
final_end = PFN_DOWN(r->base + r->size);
if (final_start >= final_end)
continue;
if (final_start >= limit || final_end <= addr)
continue;
nr_range = add_range(range, count, nr_range, final_start, final_end);
}
subtract_range(range, count, 0, addr);
subtract_range(range, count, limit, -1ULL);
/* Subtract memblock.reserved.region in range ? */
/* get_free . */
if (!get_free)
goto sort_and_count_them;
for_each_memblock(reserved, r) {
final_start = PFN_DOWN(r->base);
final_end = PFN_UP(r->base + r->size);
if (final_start >= final_end)
continue;
if (final_start >= limit || final_end <= addr)
continue;
subtract_range(range, count, final_start, final_end);
}
sort_and_count_them:
/* range . nr_range */
nr_range = clean_sort_range(range, count);
free_size = 0;
for (i = 0; i < nr_range; i++)
free_size += range[i].end - range[i].start;
return free_size << PAGE_SHIFT;
}
/* range free memblock . */
u64 __init <API key>(u64 addr, u64 limit)
{
return <API key>(addr, limit, true);
}
/* memblock range . */
u64 __init <API key>(u64 addr, u64 limit)
{
return <API key>(addr, limit, false);
}
/* start end name . */
void __init <API key>(u64 start, u64 end, char *name)
{
if (start == end)
return;
if (WARN_ONCE(start > end, "<API key>: wrong range [%#llx, %#llx)\n", start, end))
return;
memblock_dbg(" <API key>: [%#010llx-%#010llx] %16s\n", start, end - 1, name);
memblock_reserve(start, end - start);
}
/* reserve */
void __init <API key>(u64 start, u64 end)
{
if (start == end)
return;
if (WARN_ONCE(start > end, "<API key>: wrong range [%#llx, %#llx)\n", start, end))
return;
memblock_dbg(" <API key>: [%#010llx-%#010llx]\n", start, end - 1);
memblock_free(start, end - start);
}
/*
* Need to call this function after <API key>,
* so early_node_map[] is filled already.
*/
u64 __init <API key>(int nid, u64 start, u64 end, u64 size, u64 align)
{
u64 addr;
addr = <API key>(nid, size, align, start, end);
if (addr != MEMBLOCK_ERROR)
return addr;
/* Fallback, should already have start end within node range */
return <API key>(start, end, size, align);
}
/*
* Finds an active region in the address range from start_pfn to last_pfn and
* returns its range in ei_startpfn and ei_endpfn for the memblock entry.
*/
/* ei start_pfn last_pfn ,
* ei_startpfn ei_endpfn */
static int __init <API key>(const struct memblock_region *ei,
unsigned long start_pfn,
unsigned long last_pfn,
unsigned long *ei_startpfn,
unsigned long *ei_endpfn)
{
u64 align = PAGE_SIZE;
*ei_startpfn = round_up(ei->base, align) >> PAGE_SHIFT;
*ei_endpfn = round_down(ei->base + ei->size, align) >> PAGE_SHIFT;
/* Skip map entries smaller than a page */
if (*ei_startpfn >= *ei_endpfn)
return 0;
/* Skip if map is outside the node */
if (*ei_endpfn <= start_pfn || *ei_startpfn >= last_pfn)
return 0;
/* Check for overlaps */
if (*ei_startpfn < start_pfn)
*ei_startpfn = start_pfn;
if (*ei_endpfn > last_pfn)
*ei_endpfn = last_pfn;
return 1;
}
/* Walk the memblock.memory map and register active regions within a node */
/* node memblock */
void __init <API key>(int nid, unsigned long start_pfn,
unsigned long last_pfn)
{
unsigned long ei_startpfn;
unsigned long ei_endpfn;
struct memblock_region *r;
for_each_memblock(memory, r)
if (<API key>(r, start_pfn, last_pfn,
&ei_startpfn, &ei_endpfn))
add_active_range(nid, ei_startpfn, ei_endpfn);
}
/*
* Find the hole size (in bytes) in the memory range.
* @start: starting address of the memory range to scan
* @end: ending address of the memory range to scan
*/
u64 __init <API key>(u64 start, u64 end)
{
unsigned long start_pfn = start >> PAGE_SHIFT;
unsigned long last_pfn = end >> PAGE_SHIFT;
unsigned long ei_startpfn, ei_endpfn, ram = 0;
struct memblock_region *r;
for_each_memblock(memory, r)
if (<API key>(r, start_pfn, last_pfn,
&ei_startpfn, &ei_endpfn))
ram += ei_endpfn - ei_startpfn;
return end - start - ((u64)ram << PAGE_SHIFT);
} |
<!DOCTYPE HTML PUBLIC "-
<!--NewPage
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
Uses of Interface com.sun.jersey.spi.container.JavaMethodInvoker (jersey-bundle 1.19 API)
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Interface com.sun.jersey.spi.container.JavaMethodInvoker (jersey-bundle 1.19 API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<A NAME="navbar_top"></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../com/sun/jersey/spi/container/JavaMethodInvoker.html" title="interface in com.sun.jersey.spi.container"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html?com/sun/jersey/spi/container//<API key>.html" target="_top"><B>FRAMES</B></A>
<A HREF="JavaMethodInvoker.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<HR>
<CENTER>
<H2>
<B>Uses of Interface<br>com.sun.jersey.spi.container.JavaMethodInvoker</B></H2>
</CENTER>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Packages that use <A HREF="../../../../../../com/sun/jersey/spi/container/JavaMethodInvoker.html" title="interface in com.sun.jersey.spi.container">JavaMethodInvoker</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="#com.sun.jersey.spi.container"><B>com.sun.jersey.spi.container</B></A></TD>
<TD>Provides support for containers and the web application that manages
resource classes. </TD>
</TR>
</TABLE>
<P>
<A NAME="com.sun.jersey.spi.container"></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Uses of <A HREF="../../../../../../com/sun/jersey/spi/container/JavaMethodInvoker.html" title="interface in com.sun.jersey.spi.container">JavaMethodInvoker</A> in <A HREF="../../../../../../com/sun/jersey/spi/container/package-summary.html">com.sun.jersey.spi.container</A></FONT></TH>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="<API key>">
<TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../../../com/sun/jersey/spi/container/package-summary.html">com.sun.jersey.spi.container</A> that return <A HREF="../../../../../../com/sun/jersey/spi/container/JavaMethodInvoker.html" title="interface in com.sun.jersey.spi.container">JavaMethodInvoker</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../../../com/sun/jersey/spi/container/JavaMethodInvoker.html" title="interface in com.sun.jersey.spi.container">JavaMethodInvoker</A></CODE></FONT></TD>
<TD><CODE><B><API key>.</B><B><A HREF="../../../../../../com/sun/jersey/spi/container/<API key>.html#getDefault()">getDefault</A></B>()</CODE>
<BR>
</TD>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="<API key>">
<TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../../../com/sun/jersey/spi/container/package-summary.html">com.sun.jersey.spi.container</A> with parameters of type <A HREF="../../../../../../com/sun/jersey/spi/container/JavaMethodInvoker.html" title="interface in com.sun.jersey.spi.container">JavaMethodInvoker</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../../com/sun/jersey/spi/dispatch/RequestDispatcher.html" title="interface in com.sun.jersey.spi.dispatch">RequestDispatcher</A></CODE></FONT></TD>
<TD><CODE><B><API key>.</B><B><A HREF="../../../../../../com/sun/jersey/spi/container/<API key>.html#create(com.sun.jersey.api.model.<API key>, com.sun.jersey.spi.container.JavaMethodInvoker)">create</A></B>(<A HREF="../../../../../../com/sun/jersey/api/model/<API key>.html" title="class in com.sun.jersey.api.model"><API key></A> <API key>,
<A HREF="../../../../../../com/sun/jersey/spi/container/JavaMethodInvoker.html" title="interface in com.sun.jersey.spi.container">JavaMethodInvoker</A> invoker)</CODE>
<BR>
Create a <A HREF="../../../../../../com/sun/jersey/spi/dispatch/RequestDispatcher.html" title="interface in com.sun.jersey.spi.dispatch"><CODE>RequestDispatcher</CODE></A> for a resource method of
a resource.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../../com/sun/jersey/spi/dispatch/RequestDispatcher.html" title="interface in com.sun.jersey.spi.dispatch">RequestDispatcher</A></CODE></FONT></TD>
<TD><CODE><B><API key>.</B><B><A HREF="../../../../../../com/sun/jersey/spi/container/<API key>.html#getDispatcher(com.sun.jersey.api.model.<API key>, com.sun.jersey.spi.container.JavaMethodInvoker)">getDispatcher</A></B>(<A HREF="../../../../../../com/sun/jersey/api/model/<API key>.html" title="class in com.sun.jersey.api.model"><API key></A> <API key>,
<A HREF="../../../../../../com/sun/jersey/spi/container/JavaMethodInvoker.html" title="interface in com.sun.jersey.spi.container">JavaMethodInvoker</A> invoker)</CODE>
<BR>
</TD>
</TR>
</TABLE>
<P>
<HR>
<A NAME="navbar_bottom"></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="<API key>"></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../com/sun/jersey/spi/container/JavaMethodInvoker.html" title="interface in com.sun.jersey.spi.container"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html?com/sun/jersey/spi/container//<API key>.html" target="_top"><B>FRAMES</B></A>
<A HREF="JavaMethodInvoker.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<HR>
Copyright &
</BODY>
</HTML> |
#include "<API key>.h"
#include <utility>
#include "addons/Skin.h"
#include "dialogs/GUIDialogYesNo.h"
#include "guilib/GUIWindowManager.h"
#include "GUIPassword.h"
#include "profiles/ProfilesManager.h"
#include "settings/lib/Setting.h"
#include "settings/lib/SettingsManager.h"
#include "settings/MediaSettings.h"
#include "settings/Settings.h"
#include "system.h"
#include "utils/log.h"
#include "utils/Variant.h"
#include "video/VideoDatabase.h"
#include "Application.h"
#include "utils/LangCodeExpander.h"
#include "utils/StringUtils.h"
#include "video/ViewModeSettings.h"
#define <API key> "video.viewmode"
#define SETTING_VIDEO_ZOOM "video.zoom"
#define <API key> "video.pixelratio"
#define <API key> "video.brightness"
#define <API key> "video.contrast"
#define SETTING_VIDEO_GAMMA "video.gamma"
#define <API key> "video.nonlinearstretch"
#define <API key> "video.postprocess"
#define <API key> "video.verticalshift"
#define <API key> "vdpau.noise"
#define <API key> "vdpau.sharpness"
#define <API key> "video.interlacemethod"
#define <API key> "video.scalingmethod"
#define <API key> "video.stereoscopicmode"
#define <API key> "video.stereoscopicinvert"
#define <API key> "video.save"
#define <API key> "video.calibration"
#define <API key> "video.stream"
<API key>::<API key>()
: <API key>(<API key>, "DialogSettings.xml"),
m_viewModeChanged(false)
{ }
<API key>::~<API key>()
{ }
void <API key>::OnSettingChanged(const CSetting *setting)
{
if (setting == NULL)
return;
<API key>::OnSettingChanged(setting);
CVideoSettings &videoSettings = CMediaSettings::GetInstance().<API key>();
const std::string &settingId = setting->GetId();
if (settingId == <API key>)
videoSettings.m_InterlaceMethod = static_cast<EINTERLACEMETHOD>(static_cast<const CSettingInt*>(setting)->GetValue());
else if (settingId == <API key>)
videoSettings.m_ScalingMethod = static_cast<ESCALINGMETHOD>(static_cast<const CSettingInt*>(setting)->GetValue());
#ifdef HAS_VIDEO_PLAYBACK
else if (settingId == <API key>)
{
m_videoStream = static_cast<const CSettingInt*>(setting)->GetValue();
// only change the video stream if a different one has been asked for
if (g_application.m_pPlayer->GetVideoStream() != m_videoStream)
{
videoSettings.m_VideoStream = m_videoStream;
g_application.m_pPlayer->SetVideoStream(m_videoStream); // Set the video stream to the one selected
}
}
else if (settingId == <API key>)
{
videoSettings.m_ViewMode = static_cast<const CSettingInt*>(setting)->GetValue();
g_application.m_pPlayer->SetRenderViewMode(videoSettings.m_ViewMode);
m_viewModeChanged = true;
m_settingsManager->SetNumber(SETTING_VIDEO_ZOOM, videoSettings.m_CustomZoomAmount);
m_settingsManager->SetNumber(<API key>, videoSettings.m_CustomPixelRatio);
m_settingsManager->SetNumber(<API key>, videoSettings.<API key>);
m_settingsManager->SetBool(<API key>, videoSettings.<API key>);
m_viewModeChanged = false;
}
else if (settingId == SETTING_VIDEO_ZOOM ||
settingId == <API key> ||
settingId == <API key> ||
settingId == <API key>)
{
if (settingId == SETTING_VIDEO_ZOOM)
videoSettings.m_CustomZoomAmount = static_cast<float>(static_cast<const CSettingNumber*>(setting)->GetValue());
else if (settingId == <API key>)
videoSettings.<API key> = static_cast<float>(static_cast<const CSettingNumber*>(setting)->GetValue());
else if (settingId == <API key>)
videoSettings.m_CustomPixelRatio = static_cast<float>(static_cast<const CSettingNumber*>(setting)->GetValue());
else if (settingId == <API key>)
videoSettings.<API key> = static_cast<const CSettingBool*>(setting)->GetValue();
if (!m_viewModeChanged)
{
// try changing the view mode to custom. If it already is set to custom
// manually call the render manager
if (m_settingsManager->GetInt(<API key>) != ViewModeCustom)
m_settingsManager->SetInt(<API key>, ViewModeCustom);
else
g_application.m_pPlayer->SetRenderViewMode(videoSettings.m_ViewMode);
}
}
else if (settingId == <API key>)
videoSettings.m_PostProcess = static_cast<const CSettingBool*>(setting)->GetValue();
else if (settingId == <API key>)
videoSettings.m_Brightness = static_cast<float>(static_cast<const CSettingInt*>(setting)->GetValue());
else if (settingId == <API key>)
videoSettings.m_Contrast = static_cast<float>(static_cast<const CSettingInt*>(setting)->GetValue());
else if (settingId == SETTING_VIDEO_GAMMA)
videoSettings.m_Gamma = static_cast<float>(static_cast<const CSettingInt*>(setting)->GetValue());
else if (settingId == <API key>)
videoSettings.m_NoiseReduction = static_cast<float>(static_cast<const CSettingNumber*>(setting)->GetValue());
else if (settingId == <API key>)
videoSettings.m_Sharpness = static_cast<float>(static_cast<const CSettingNumber*>(setting)->GetValue());
#endif
else if (settingId == <API key>)
videoSettings.m_StereoMode = static_cast<const CSettingInt*>(setting)->GetValue();
else if (settingId == <API key>)
videoSettings.m_StereoInvert = static_cast<const CSettingBool*>(setting)->GetValue();
}
void <API key>::OnSettingAction(const CSetting *setting)
{
if (setting == NULL)
return;
<API key>::OnSettingChanged(setting);
const std::string &settingId = setting->GetId();
if (settingId == <API key>)
{
// launch calibration window
if (CProfilesManager::GetInstance().GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE &&
g_passwordManager.<API key>(CSettings::GetInstance().GetSetting(CSettings::<API key>)->GetLevel()))
return;
g_windowManager.ForceActivateWindow(<API key>);
}
//! @todo implement
else if (settingId == <API key>)
Save();
}
void <API key>::Save()
{
if (CProfilesManager::GetInstance().GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE &&
!g_passwordManager.<API key>(::SettingLevelExpert))
return;
// prompt user if they are sure
if (CGUIDialogYesNo::ShowAndGetInput(CVariant(12376), CVariant(12377)))
{ // reset the settings
CVideoDatabase db;
if (!db.Open())
return;
db.EraseVideoSettings();
db.Close();
CMediaSettings::GetInstance().<API key>() = CMediaSettings::GetInstance().<API key>();
CMediaSettings::GetInstance().<API key>().m_SubtitleStream = -1;
CMediaSettings::GetInstance().<API key>().m_AudioStream = -1;
CSettings::GetInstance().Save();
}
}
void <API key>::SetupView()
{
<API key>::SetupView();
SetHeading(13395);
SET_CONTROL_HIDDEN(<API key>);
SET_CONTROL_HIDDEN(<API key>);
SET_CONTROL_LABEL(<API key>, 15067);
}
void <API key>::InitializeSettings()
{
<API key>::InitializeSettings();
CSettingCategory *category = AddCategory("videosettings", -1);
if (category == NULL)
{
CLog::Log(LOGERROR, "<API key>: unable to setup settings");
return;
}
// get all necessary setting groups
CSettingGroup *groupVideoStream = AddGroup(category);
if (groupVideoStream == NULL)
{
CLog::Log(LOGERROR, "<API key>: unable to setup settings");
return;
}
CSettingGroup *groupVideo = AddGroup(category);
if (groupVideo == NULL)
{
CLog::Log(LOGERROR, "<API key>: unable to setup settings");
return;
}
CSettingGroup *groupVideoPlayback = AddGroup(category);
if (groupVideoPlayback == NULL)
{
CLog::Log(LOGERROR, "<API key>: unable to setup settings");
return;
}
CSettingGroup *groupStereoscopic = AddGroup(category);
if (groupStereoscopic == NULL)
{
CLog::Log(LOGERROR, "<API key>: unable to setup settings");
return;
}
CSettingGroup *groupSaveAsDefault = AddGroup(category);
if (groupSaveAsDefault == NULL)
{
CLog::Log(LOGERROR, "<API key>: unable to setup settings");
return;
}
bool usePopup = g_SkinInfo->HasSkinFile("DialogSlider.xml");
CVideoSettings &videoSettings = CMediaSettings::GetInstance().<API key>();
<API key> entries;
entries.clear();
entries.push_back(std::make_pair(16039, <API key>));
entries.push_back(std::make_pair(16019, <API key>));
entries.push_back(std::make_pair(20131, <API key>));
entries.push_back(std::make_pair(20129, <API key>));
entries.push_back(std::make_pair(16021, <API key>));
entries.push_back(std::make_pair(16020, <API key>));
entries.push_back(std::make_pair(16036, <API key>));
entries.push_back(std::make_pair(16314, <API key>));
entries.push_back(std::make_pair(16311, <API key>));
entries.push_back(std::make_pair(16310, <API key>));
entries.push_back(std::make_pair(16325, <API key>));
entries.push_back(std::make_pair(16318, <API key>));
entries.push_back(std::make_pair(16317, <API key>));
entries.push_back(std::make_pair(16314, <API key>));
entries.push_back(std::make_pair(16325, <API key>));
entries.push_back(std::make_pair(16327, <API key>));
entries.push_back(std::make_pair(16328, <API key>));
entries.push_back(std::make_pair(16329, <API key>));
entries.push_back(std::make_pair(16330, <API key>));
entries.push_back(std::make_pair(16331, <API key>));
entries.push_back(std::make_pair(16332, <API key>));
entries.push_back(std::make_pair(16333, <API key>));
entries.push_back(std::make_pair(16334, <API key>));
entries.push_back(std::make_pair(16335, <API key>));
entries.push_back(std::make_pair(16336, <API key>));
/* remove unsupported methods */
for (<API key>::iterator it = entries.begin(); it != entries.end(); )
{
if (g_application.m_pPlayer->Supports((EINTERLACEMETHOD)it->second))
++it;
else
it = entries.erase(it);
}
if (!entries.empty())
{
if (!g_application.m_pPlayer->Supports(videoSettings.m_InterlaceMethod))
{
videoSettings.m_InterlaceMethod = g_application.m_pPlayer-><API key>();
}
AddSpinner(groupVideo, <API key>, 16038, 0, static_cast<int>(videoSettings.m_InterlaceMethod), entries);
}
entries.clear();
entries.push_back(std::make_pair(16301, <API key>));
entries.push_back(std::make_pair(16302, <API key>));
entries.push_back(std::make_pair(16303, <API key> ));
entries.push_back(std::make_pair(16304, <API key>));
entries.push_back(std::make_pair(16323, <API key>));
entries.push_back(std::make_pair(16315, <API key>));
entries.push_back(std::make_pair(16322, <API key>));
entries.push_back(std::make_pair(16305, <API key>));
entries.push_back(std::make_pair(16306, <API key>));
// entries.push_back(make_pair(?????, <API key>));
entries.push_back(std::make_pair(16307, <API key>));
entries.push_back(std::make_pair(16308, <API key>));
entries.push_back(std::make_pair(16309, <API key>));
entries.push_back(std::make_pair(13120, <API key>));
entries.push_back(std::make_pair(16319, <API key>));
entries.push_back(std::make_pair(16316, <API key>));
/* remove unsupported methods */
for(<API key>::iterator it = entries.begin(); it != entries.end(); )
{
if (g_application.m_pPlayer->Supports((ESCALINGMETHOD)it->second))
++it;
else
it = entries.erase(it);
}
AddSpinner(groupVideo, <API key>, 16300, 0, static_cast<int>(videoSettings.m_ScalingMethod), entries);
#ifdef HAS_VIDEO_PLAYBACK
AddVideoStreams(groupVideoStream, <API key>);
if (g_application.m_pPlayer->Supports(<API key>) || g_application.m_pPlayer->Supports(<API key>))
{
AddList(groupVideo, <API key>, 629, 0, videoSettings.m_ViewMode, CViewModeSettings::ViewModesFiller, 629);
}
if (g_application.m_pPlayer->Supports(RENDERFEATURE_ZOOM))
AddSlider(groupVideo, SETTING_VIDEO_ZOOM, 216, 0, videoSettings.m_CustomZoomAmount, "%2.2f", 0.5f, 0.01f, 2.0f, 216, usePopup);
if (g_application.m_pPlayer->Supports(<API key>))
AddSlider(groupVideo, <API key>, 225, 0, videoSettings.<API key>, "%2.2f", -2.0f, 0.01f, 2.0f, 225, usePopup);
if (g_application.m_pPlayer->Supports(<API key>))
AddSlider(groupVideo, <API key>, 217, 0, videoSettings.m_CustomPixelRatio, "%2.2f", 0.5f, 0.01f, 2.0f, 217, usePopup);
if (g_application.m_pPlayer->Supports(<API key>))
AddToggle(groupVideo, <API key>, 16400, 0, videoSettings.m_PostProcess);
if (g_application.m_pPlayer->Supports(<API key>))
AddPercentageSlider(groupVideoPlayback, <API key>, 464, 0, static_cast<int>(videoSettings.m_Brightness), 14047, 1, 464, usePopup);
if (g_application.m_pPlayer->Supports(<API key>))
AddPercentageSlider(groupVideoPlayback, <API key>, 465, 0, static_cast<int>(videoSettings.m_Contrast), 14047, 1, 465, usePopup);
if (g_application.m_pPlayer->Supports(RENDERFEATURE_GAMMA))
AddPercentageSlider(groupVideoPlayback, SETTING_VIDEO_GAMMA, 466, 0, static_cast<int>(videoSettings.m_Gamma), 14047, 1, 466, usePopup);
if (g_application.m_pPlayer->Supports(RENDERFEATURE_NOISE))
AddSlider(groupVideoPlayback, <API key>, 16312, 0, videoSettings.m_NoiseReduction, "%2.2f", 0.0f, 0.01f, 1.0f, 16312, usePopup);
if (g_application.m_pPlayer->Supports(<API key>))
AddSlider(groupVideoPlayback, <API key>, 16313, 0, videoSettings.m_Sharpness, "%2.2f", -1.0f, 0.02f, 1.0f, 16313, usePopup);
if (g_application.m_pPlayer->Supports(<API key>))
AddToggle(groupVideoPlayback, <API key>, 659, 0, videoSettings.<API key>);
#endif
// stereoscopic settings
entries.clear();
entries.push_back(std::make_pair(16316, <API key>));
entries.push_back(std::make_pair(36503, <API key>));
entries.push_back(std::make_pair(36504, <API key>));
AddSpinner(groupStereoscopic, <API key> , 36535, 0, videoSettings.m_StereoMode, entries);
AddToggle(groupStereoscopic, <API key>, 36536, 0, videoSettings.m_StereoInvert);
// general settings
AddButton(groupSaveAsDefault, <API key>, 12376, 0);
AddButton(groupSaveAsDefault, <API key>, 214, 0);
}
void <API key>::AddVideoStreams(CSettingGroup *group, const std::string &settingId)
{
if (group == NULL || settingId.empty())
return;
m_videoStream = g_application.m_pPlayer->GetVideoStream();
if (m_videoStream < 0)
m_videoStream = 0;
AddList(group, settingId, 38031, 0, m_videoStream, <API key>, 38031);
}
void <API key>::<API key>(const CSetting *setting, std::vector< std::pair<std::string, int> > &list, int ¤t, void *data)
{
int videoStreamCount = g_application.m_pPlayer->GetVideoStreamCount();
// cycle through each video stream and add it to our list control
for (int i = 0; i < videoStreamCount; ++i)
{
std::string strItem;
std::string strLanguage;
<API key> info;
g_application.m_pPlayer->GetVideoStreamInfo(i, info);
g_LangCodeExpander.Lookup(info.language, strLanguage);
if (!info.name.empty())
{
if (!strLanguage.empty())
strItem = StringUtils::Format("%s - %s", strLanguage.c_str(), info.name.c_str());
else
strItem = info.name;
}
else if (!strLanguage.empty())
{
strItem = strLanguage;
}
if (info.videoCodecName.empty())
strItem += StringUtils::Format(" (%ix%i)", info.width, info.height);
else
strItem += StringUtils::Format(" (%s, %ix%i)", info.videoCodecName.c_str(), info.width, info.height);
strItem += StringUtils::Format(" (%i/%i)", i + 1, videoStreamCount);
list.push_back(make_pair(strItem, i));
}
if (list.empty())
{
list.push_back(make_pair(g_localizeStrings.Get(231), -1));
current = -1;
}
} |
<?php
// no direct access
defined('_JEXEC') or die;
?>
<?php if($this->clientData):?>
<div class="alert alert-info"><?php echo JText::_('<API key>');?></div>
<table class="table table-striped">
<?php foreach ($this->clientData as $cd): ?>
<tr>
<td><img src="<?php echo $cd->thumburl;?>" style="height:20px; width:20px;"/></td>
<td><?php echo $cd->name;?> <i style="font-size:85%; color:#999;"><?php echo $cd->entry_id;?></i></td>
<td>
<?php if($cd->soldState==0):
$statusClass = 'notsold';
elseif($cd->soldState==1):
$statusClass = 'pending';
else:
$statusClass = 'sold';
endif;
?>
<span class="iconState <?php echo $statusClass;?>" id="<?php echo $cd->soldId;?>" title="<?php echo $cd->soldState;?>"></span></td>
<td><button class="btn btn-mini btn-danger deleteContent" id="<?php echo $cd->id;?>"><?php echo JText::_('<API key>');?></button>
</tr>
<?php endforeach;?>
</table>
<ul class="tableLEgendSold">
<li><span class="notsold legSold"></span> <?php echo JText::_('<API key>');?></li>
<li><span class="pending legSold"></span> <?php echo JText::_('<API key>');?></li>
<li><span class="sold legSold"></span> <?php echo JText::_('<API key>');?></li>
</ul>
<?php else:?>
<div class="alert"><?php echo JText::_('<API key>');?></div>
<?php endif;?> |
package javax.enterprise.inject.spi;
import java.lang.reflect.Field;
/**
* Abstract introspected view of a Bean injectible field
*/
public interface AnnotatedField<X> extends AnnotatedMember<X>
{
/**
* Returns the reflected Field
*/
public Field getJavaMember();
} |
////<auto-generated <- Codemaid exclusion for now (PacketIndex Order is important for maintenance)
using OpenNos.Core;
namespace OpenNos.GameObject.Packets.ClientPackets
{
[PacketHeader("game_start")]
public class GameStartPacket : PacketDefinition
{
}
} |
using Newtonsoft.Json;
using Svt.Caspar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Xml.Serialization;
using TAS.Remoting.Server;
using TAS.Common;
using TAS.Common.Interfaces;
using TAS.Common.Interfaces.Media;
using TAS.Common.Interfaces.MediaDirectory;
using TAS.Server.Media;
namespace TAS.Server
{
public class CasparRecorder: DtoBase, IRecorder
{
private TVideoFormat _tcFormat = TVideoFormat.PAL;
private Recorder _recorder;
private IMedia _recordingMedia;
internal IArchiveDirectory ArchiveDirectory;
private static readonly NLog.Logger Logger = NLog.LogManager.<API key>();
private CasparServer _ownerServer;
private TimeSpan _currentTc;
private TimeSpan _timeLimit;
private TDeckState _deckState;
private TDeckControl _deckControl;
private bool _isDeckConnected;
private bool _isServerConnected;
private string _recorderName;
#region Deserialized properties
public int RecorderNumber { get; set; }
public int Id { get; set; }
[JsonProperty]
public string RecorderName
{
get => _recorderName;
set => SetField(ref _recorderName, value);
}
[JsonProperty]
public int DefaultChannel { get; set; }
#endregion Deserialized properties
#region IRecorder
[JsonProperty, XmlIgnore]
public TimeSpan CurrentTc { get => _currentTc; private set => SetField(ref _currentTc, value); }
[JsonProperty, XmlIgnore]
public TimeSpan TimeLimit { get => _timeLimit; private set => SetField(ref _timeLimit, value); }
[JsonProperty, XmlIgnore]
public TDeckState DeckState { get => _deckState; private set => SetField(ref _deckState, value); }
[JsonProperty, XmlIgnore]
public TDeckControl DeckControl { get => _deckControl; private set => SetField(ref _deckControl, value); }
[JsonProperty, XmlIgnore]
public bool IsDeckConnected { get => _isDeckConnected; private set => SetField(ref _isDeckConnected, value); }
[JsonProperty, XmlIgnore]
public bool IsServerConnected { get => _isServerConnected; internal set => SetField(ref _isServerConnected, value); }
[JsonProperty(<API key> = TypeNameHandling.Objects), XmlIgnore]
public IEnumerable<<API key>> Channels => _ownerServer.Channels.ToList();
[JsonProperty, XmlIgnore]
public IMedia RecordingMedia { get => _recordingMedia; private set => SetField(ref _recordingMedia, value); }
[JsonProperty, XmlIgnore]
public IWatcherDirectory RecordingDirectory => _ownerServer.MediaDirectory;
public IMedia Capture(<API key> channel, TimeSpan tcIn, TimeSpan tcOut, bool narrowMode, string mediaName, string fileName, int[] channelMap)
{
_tcFormat = channel.VideoFormat;
var directory = (ServerDirectory)_ownerServer.MediaDirectory;
var newMedia = new ServerMedia
{
MediaName = mediaName,
LastUpdated = DateTime.UtcNow,
MediaGuid = Guid.NewGuid(),
MediaType = TMediaType.Movie,
FileName = fileName,
TcStart = tcIn,
TcPlay = tcIn,
Duration = tcOut - tcIn,
MediaStatus = TMediaStatus.Copying,
};
directory.AddMedia(newMedia);
if (_recorder?.Capture(channel.Id, tcIn.<API key>(channel.VideoFormat), tcOut.<API key>(channel.VideoFormat), narrowMode, fileName, channelMap) == true)
{
RecordingMedia = newMedia;
Logger.Debug("Started recording from {0} file {1} TcIn {2} TcOut {3}", channel.ChannelName, fileName, tcIn, tcOut);
return newMedia;
}
Logger.Error("Unsuccessfull recording from {0} file {1} TcIn {2} TcOut {3}", channel.ChannelName, fileName, tcIn, tcOut);
return null;
}
public IMedia Capture(<API key> channel, TimeSpan timeLimit, bool narrowMode, string mediaName, string fileName, int[] channelMap)
{
_tcFormat = channel.VideoFormat;
var directory = (ServerDirectory)_ownerServer.MediaDirectory;
var newMedia = new ServerMedia
{
MediaName = mediaName,
LastUpdated = DateTime.UtcNow,
MediaType = TMediaType.Movie,
MediaGuid = Guid.NewGuid(),
FileName = fileName,
TcStart = TimeSpan.Zero,
TcPlay =TimeSpan.Zero,
Duration = timeLimit,
MediaStatus = TMediaStatus.Copying,
};
directory.AddMedia(newMedia);
if (_recorder?.Capture(channel.Id, timeLimit.ToSMPTEFrames(channel.VideoFormat), narrowMode, fileName, channelMap) == true)
{
RecordingMedia = newMedia;
Logger.Debug("Started recording from {0} file {1} with time limit {2} ", channel.ChannelName, fileName, timeLimit);
return newMedia;
}
Logger.Error("Unsuccessfull recording from {0} file {1} with time limit {2}", channel.ChannelName, fileName, timeLimit);
return null;
}
public void SetTimeLimit(TimeSpan value)
{
var media = RecordingMedia;
if (media != null)
_recorder?.SetTimeLimit(value.ToSMPTEFrames(media.VideoFormat));
}
public void Finish()
{
_recorder?.Finish();
}
public void Abort()
{
_recorder?.Abort();
}
public void DeckPlay()
{
_recorder?.Play();
}
public void DeckStop()
{
_recorder?.Stop();
}
public void DeckFastForward()
{
_recorder.FastForward();
}
public void DeckRewind()
{
_recorder.Rewind();
}
public void GoToTimecode(TimeSpan tc, TVideoFormat format)
{
_recorder?.GotoTimecode(tc.<API key>(format));
}
#endregion IRecorder
internal void SetRecorder(Recorder value)
{
var oldRecorder = _recorder;
if (_recorder != value)
{
if (oldRecorder != null)
{
oldRecorder.Tc -= _recorder_Tc;
oldRecorder.FramesLeft -= <API key>;
oldRecorder.DeckConnected -= <API key>;
oldRecorder.DeckControl -= <API key>;
oldRecorder.DeckState -= _recorder_DeckState;
}
_recorder = value;
if (value != null)
{
value.Tc += _recorder_Tc;
value.DeckConnected += <API key>;
value.DeckControl += <API key>;
value.DeckState += _recorder_DeckState;
value.FramesLeft += <API key>;
IsDeckConnected = value.IsConnected;
DeckState = TDeckState.Unknown;
DeckControl = TDeckControl.None;
}
}
}
internal void SetOwner(CasparServer owner)
{
_ownerServer = owner;
}
internal event EventHandler<MediaEventArgs> CaptureSuccess;
private void <API key>(object sender, FramesLeftEventArgs e)
{
var media = _recordingMedia;
if (media != null)
TimeLimit = e.FramesLeft.<API key>(media.VideoFormat);
}
private void _recorder_DeckState(object sender, DeckStateEventArgs e)
{
DeckState = (TDeckState)e.State;
}
private void <API key>(object sender, <API key> e)
{
if (e.ControlEvent == Svt.Caspar.DeckControl.capture_complete)
_captureCompleted();
if (e.ControlEvent == Svt.Caspar.DeckControl.aborted)
_captureAborted();
DeckControl = (TDeckControl)e.ControlEvent;
}
private void _captureAborted()
{
_recordingMedia?.Delete();
RecordingMedia = null;
Logger.Trace("Capture aborted notified");
}
private void _captureCompleted()
{
var media = _recordingMedia;
if (media?.MediaStatus == TMediaStatus.Copying)
{
media.MediaStatus = TMediaStatus.Copied;
Task.Run(() =>
{
Thread.Sleep(500);
media.Verify(true);
if (media.MediaStatus == TMediaStatus.Available)
CaptureSuccess?.Invoke(this, new MediaEventArgs(media));
});
}
Logger.Trace("Capture completed notified");
}
private void <API key>(object sender, <API key> e)
{
IsDeckConnected = e.IsConnected;
Logger.Trace("Deck {0}", e.IsConnected ? "connected" : "disconnected");
}
private void _recorder_Tc(object sender, TcEventArgs e)
{
if (e.Tc.<API key>(_tcFormat))
CurrentTc = e.Tc.<API key>(_tcFormat);
}
}
} |
#ifndef QUNCATEGORYUI_H
#define QUNCATEGORYUI_H
#include <qvariant.h>
#include <qwidget.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QSpacerItem;
class QFrame;
class QComboBox;
class QPushButton;
class QunCategoryUI : public QWidget
{
Q_OBJECT
public:
QunCategoryUI( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~QunCategoryUI();
QFrame* frame3;
QComboBox* cbbTop;
QComboBox* cbbSecond;
QComboBox* cbbThird;
QPushButton* pbCancel;
QPushButton* pbOK;
protected:
QGridLayout* QunCategoryUILayout;
QVBoxLayout* layout5;
QGridLayout* frame3Layout;
QVBoxLayout* layout3;
QHBoxLayout* layout4;
QSpacerItem* spacer2;
protected slots:
virtual void languageChange();
};
#endif // QUNCATEGORYUI_H |
package net.sourceforge.cobertura.util;
import java.io.File;
import java.io.<API key>;
import java.io.RandomAccessFile;
import java.lang.reflect.<API key>;
import java.lang.reflect.Method;
/**
* This class controls access to any file so that multiple JVMs will
* not be able to write to the file at the same time.
*
* A file called "filename.lock" is created and Java's FileLock class
* is used to lock the file.
*
* The java.nio classes were introduced in Java 1.4, so this class
* does a no-op when used with Java 1.3. The class maintains
* compatability with Java 1.3 by accessing the java.nio classes
* using reflection.
*
* @author John Lewis
* @author Mark Doliner
*/
public class FileLocker
{
/**
* An object of type FileLock, created using reflection.
*/
private Object lock = null;
/**
* An object of type FileChannel, created using reflection.
*/
private Object lockChannel = null;
/**
* A file called "filename.lock" that resides in the same directory
* as "filename"
*/
private File lockFile;
public FileLocker(File file)
{
String lockFileName = file.getName() + ".lock";
File parent = file.getParentFile();
if (parent == null)
{
lockFile = new File(lockFileName);
}
else
{
lockFile = new File(parent, lockFileName);
}
}
/**
* Obtains a lock on the file. This blocks until the lock is obtained.
*/
public boolean lock()
{
String useNioProperty = System.getProperty("cobertura.use.java.nio");
if (System.getProperty("java.version").startsWith("1.3") ||
((useNioProperty != null) && useNioProperty.equalsIgnoreCase("false")))
{
return true;
}
try
{
Class aClass = Class.forName("java.io.RandomAccessFile");
Method method = aClass.getDeclaredMethod("getChannel", (Class[])null);
lockChannel = method.invoke(new RandomAccessFile(lockFile, "rw"), (Object[])null);
}
catch (<API key> e)
{
System.err.println("Unable to get lock channel for " + lockFile.getAbsolutePath()
+ ": " + e.getLocalizedMessage());
return false;
}
catch (<API key> e)
{
System.err.println("Unable to get lock channel for " + lockFile.getAbsolutePath()
+ ": " + e.getLocalizedMessage());
return false;
}
catch (Throwable t)
{
System.err.println("Unable to execute RandomAccessFile.getChannel() using reflection: "
+ t.getLocalizedMessage());
t.printStackTrace();
}
try
{
Class aClass = Class.forName("java.nio.channels.FileChannel");
Method method = aClass.getDeclaredMethod("lock", (Class[])null);
lock = method.invoke(lockChannel, (Object[])null);
}
catch (<API key> e)
{
System.err.println("
e.printStackTrace(System.err);
System.err.println("
System.err.println("Unable to get lock on " + lockFile.getAbsolutePath() + ": "
+ e.getLocalizedMessage());
System.err.println("This is known to happen on Linux kernel 2.6.20.");
System.err.println("Make sure cobertura.jar is in the root classpath of the jvm ");
System.err.println("process running the instrumented code. If the instrumented code ");
System.err.println("is running in a web server, this means cobertura.jar should be in ");
System.err.println("the web server's lib directory.");
System.err.println("Don't put multiple copies of cobertura.jar in different WEB-INF/lib directories.");
System.err.println("Only one classloader should load cobertura. It should be the root classloader.");
System.err.println("
return false;
}
catch (Throwable t)
{
System.err.println("Unable to execute FileChannel.lock() using reflection: "
+ t.getLocalizedMessage());
t.printStackTrace();
}
return true;
}
/**
* Releases the lock on the file.
*/
public void release()
{
if (lock != null)
lock = releaseFileLock(lock);
if (lockChannel != null)
lockChannel = closeChannel(lockChannel);
if (!lockFile.delete())
{
System.err.println("lock file could not be deleted");
}
}
private static Object releaseFileLock(Object lock)
{
try
{
Class aClass = Class.forName("java.nio.channels.FileLock");
Method method = aClass.getDeclaredMethod("isValid", (Class[])null);
if (((Boolean)method.invoke(lock, (Object[])null)).booleanValue())
{
method = aClass.getDeclaredMethod("release", (Class[])null);
method.invoke(lock, (Object[])null);
lock = null;
}
}
catch (Throwable t)
{
System.err.println("Unable to release locked file: " + t.getLocalizedMessage());
}
return lock;
}
private static Object closeChannel(Object channel)
{
try
{
Class aClass = Class.forName("java.nio.channels.spi.<API key>");
Method method = aClass.getDeclaredMethod("isOpen", (Class[])null);
if (((Boolean)method.invoke(channel, (Object[])null)).booleanValue())
{
method = aClass.getDeclaredMethod("close", (Class[])null);
method.invoke(channel, (Object[])null);
channel = null;
}
}
catch (Throwable t)
{
System.err.println("Unable to close file channel: " + t.getLocalizedMessage());
}
return channel;
}
} |
/*! \file
* \brief Implementation of Agents (proxy channel)
*
* This file is the implementation of Agents modules.
* It is a dynamic module that is loaded by Asterisk.
* \par See also
* \arg \ref Config_agent
*
* \ingroup channel_drivers
*/
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <fcntl.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/signal.h>
#include "asterisk.h"
<API key>(__FILE__, "$Revision: 76653 $")
#include "asterisk/lock.h"
#include "asterisk/channel.h"
#include "asterisk/config.h"
#include "asterisk/logger.h"
#include "asterisk/module.h"
#include "asterisk/pbx.h"
#include "asterisk/options.h"
#include "asterisk/lock.h"
#include "asterisk/sched.h"
#include "asterisk/io.h"
#include "asterisk/rtp.h"
#include "asterisk/acl.h"
#include "asterisk/callerid.h"
#include "asterisk/file.h"
#include "asterisk/cli.h"
#include "asterisk/app.h"
#include "asterisk/musiconhold.h"
#include "asterisk/manager.h"
#include "asterisk/features.h"
#include "asterisk/utils.h"
#include "asterisk/causes.h"
#include "asterisk/astdb.h"
#include "asterisk/devicestate.h"
#include "asterisk/monitor.h"
static const char desc[] = "Agent Proxy Channel";
static const char channeltype[] = "Agent";
static const char tdesc[] = "Call Agent Proxy Channel";
static const char config[] = "agents.conf";
static const char app[] = "AgentLogin";
static const char app2[] = "AgentCallbackLogin";
static const char app3[] = "<API key>";
static const char synopsis[] = "Call agent login";
static const char synopsis2[] = "Call agent callback login";
static const char synopsis3[] = "Record agent's outgoing call";
static const char descrip[] =
" AgentLogin([AgentNo][|options]):\n"
"Asks the agent to login to the system. Always returns -1. While\n"
"logged in, the agent can receive calls and will hear a 'beep'\n"
"when a new call comes in. The agent can dump the call by pressing\n"
"the star key.\n"
"The option string may contain zero or more of the following characters:\n"
" 's' -- silent login - do not announce the login ok segment after agent logged in/off\n";
static const char descrip2[] =
" AgentCallbackLogin([AgentNo][|[options][|[exten]@context]]):\n"
"Asks the agent to login to the system with callback.\n"
"The agent's callback extension is called (optionally with the specified\n"
"context).\n"
"The option string may contain zero or more of the following characters:\n"
" 's' -- silent login - do not announce the login ok segment agent logged in/off\n";
static const char descrip3[] =
" <API key>([options]):\n"
"Tries to figure out the id of the agent who is placing outgoing call based on\n"
"comparison of the callerid of the current interface and the global variable \n"
"placed by the AgentCallbackLogin application. That's why it should be used only\n"
"with the AgentCallbackLogin app. Uses the monitoring functions in chan_agent \n"
"instead of Monitor application. That have to be configured in the agents.conf file.\n"
"\nReturn value:\n"
"Normally the app returns 0 unless the options are passed. Also if the callerid or\n"
"the agentid are not specified it'll look for n+101 priority.\n"
"\nOptions:\n"
" 'd' - make the app return -1 if there is an error condition and there is\n"
" no extension n+101\n"
" 'c' - change the CDR so that the source of the call is 'Agent/agent_id'\n"
" 'n' - don't generate the warnings when there is no callerid or the\n"
" agentid is not known.\n"
" It's handy if you want to have one context for agent and non-agent calls.\n";
static const char mandescr_agents[] =
"Description: Will list info about all possible agents.\n"
"Variables: NONE\n";
static const char <API key>[] =
"Description: Sets an agent as no longer logged in.\n"
"Variables: (Names marked with * are required)\n"
" *Agent: Agent ID of the agent to log off\n"
" Soft: Set to 'true' to not hangup existing calls\n";
static const char <API key>[] =
"Description: Sets an agent as logged in with callback.\n"
"Variables: (Names marked with * are required)\n"
" *Agent: Agent ID of the agent to login\n"
" *Exten: Extension to use for callback\n"
" Context: Context to use for callback\n"
" AckCall: Set to 'true' to require an acknowledgement by '#' when agent is called back\n"
" WrapupTime: the minimum amount of time after disconnecting before the caller can receive a new call\n";
static char moh[80] = "default";
#define AST_MAX_AGENT 80 /**< Agent ID or Password max length */
#define AST_MAX_BUF 256
#define <API key> 256
/** Persistent Agents astdb family */
static const char pa_family[] = "/Agents";
/** The maximum length of each persistent member agent database entry */
#define PA_MAX_LEN 2048
/** queues.conf [general] option */
static int persistent_agents = 0;
static void dump_agents(void);
static ast_group_t group;
static int autologoff;
static int wrapuptime;
static int ackcall;
static int maxlogintries = 3;
static char agentgoodbye[<API key>] = "vm-goodbye";
static int usecnt =0;
<API key>(usecnt_lock);
/* Protect the interface list (of pvt's) */
<API key>(agentlock);
static int recordagentcalls = 0;
static char recordformat[AST_MAX_BUF] = "";
static char recordformatext[AST_MAX_BUF] = "";
static int createlink = 0;
static char urlprefix[AST_MAX_BUF] = "";
static char savecallsin[AST_MAX_BUF] = "";
static int updatecdr = 0;
static char beep[AST_MAX_BUF] = "beep";
#define GETAGENTBYCALLERID "AGENTBYCALLERID"
/**
* Structure representing an agent.
*/
struct agent_pvt {
ast_mutex_t lock; /**< Channel private lock */
int dead; /**< Poised for destruction? */
int pending; /**< Not a real agent -- just pending a match */
int abouttograb; /**< About to grab */
int autologoff; /**< Auto timeout time */
int ackcall; /**< ackcall */
time_t loginstart; /**< When agent first logged in (0 when logged off) */
time_t start; /**< When call started */
struct timeval lastdisc; /**< When last disconnected */
int wrapuptime; /**< Wrapup time in ms */
ast_group_t group; /**< Group memberships */
int acknowledged; /**< Acknowledged */
char moh[80]; /**< Which music on hold */
char agent[AST_MAX_AGENT]; /**< Agent ID */
char password[AST_MAX_AGENT]; /**< Password for Agent login */
char name[AST_MAX_AGENT];
ast_mutex_t app_lock; /**< Synchronization between owning applications */
volatile pthread_t owning_app; /**< Owning application thread id */
volatile int app_sleep_cond; /**< Sleep condition for the login app */
struct ast_channel *owner; /**< Agent */
char loginchan[80]; /**< channel they logged in from */
char logincallerid[80]; /**< Caller ID they had when they logged in */
struct ast_channel *chan; /**< Channel we use */
struct agent_pvt *next; /**< Next Agent in the linked list. */
};
static struct agent_pvt *agents = NULL; /**< Holds the list of agents (loaded form agents.conf). */
#define CHECK_FORMATS(ast, p) do { \
if (p->chan) {\
if (ast->nativeformats != p->chan->nativeformats) { \
ast_log(LOG_DEBUG, "Native formats changing from %d to %d\n", ast->nativeformats, p->chan->nativeformats); \
/* Native formats changed, reset things */ \
ast->nativeformats = p->chan->nativeformats; \
ast_log(LOG_DEBUG, "Resetting read to %d and write to %d\n", ast->readformat, ast->writeformat);\
ast_set_read_format(ast, ast->readformat); \
<API key>(ast, ast->writeformat); \
} \
if (p->chan->readformat != ast->rawreadformat && !p->chan->generator) \
ast_set_read_format(p->chan, ast->rawreadformat); \
if (p->chan->writeformat != ast->rawwriteformat && !p->chan->generator) \
<API key>(p->chan, ast->rawwriteformat); \
} \
} while(0)
/* Cleanup moves all the relevant FD's from the 2nd to the first, but retains things
properly for a timingfd XXX This might need more work if agents were logged in as agents or other
totally impractical combinations XXX */
#define CLEANUP(ast, p) do { \
int x; \
if (p->chan) { \
for (x=0;x<AST_MAX_FDS;x++) {\
if (x != AST_MAX_FDS - 2) \
ast->fds[x] = p->chan->fds[x]; \
} \
ast->fds[AST_MAX_FDS - 3] = p->chan->fds[AST_MAX_FDS - 2]; \
} \
} while(0)
static struct ast_channel *agent_request(const char *type, int format, void *data, int *cause);
static int agent_devicestate(void *data);
static int agent_digit(struct ast_channel *ast, char digit);
static int agent_call(struct ast_channel *ast, char *dest, int timeout);
static int agent_hangup(struct ast_channel *ast);
static int agent_answer(struct ast_channel *ast);
static struct ast_frame *agent_read(struct ast_channel *ast);
static int agent_write(struct ast_channel *ast, struct ast_frame *f);
static int agent_sendhtml(struct ast_channel *ast, int subclass, const char *data, int datalen);
static int agent_sendtext(struct ast_channel *ast, const char *text);
static int agent_indicate(struct ast_channel *ast, int condition);
static int agent_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
static struct ast_channel *<API key>(struct ast_channel *chan, struct ast_channel *bridge);
static const struct ast_channel_tech agent_tech = {
.type = channeltype,
.description = tdesc,
.capabilities = -1,
.requester = agent_request,
.devicestate = agent_devicestate,
.send_digit = agent_digit,
.call = agent_call,
.hangup = agent_hangup,
.answer = agent_answer,
.read = agent_read,
.write = agent_write,
.send_html = agent_sendhtml,
.send_text = agent_sendtext,
.exception = agent_read,
.indicate = agent_indicate,
.fixup = agent_fixup,
.bridged_channel = <API key>,
};
/**
* Unlink (that is, take outside of the linked list) an agent.
*
* @param agent Agent to be unlinked.
*/
static void agent_unlink(struct agent_pvt *agent)
{
struct agent_pvt *p, *prev;
prev = NULL;
p = agents;
// Iterate over all agents looking for the one.
while(p) {
if (p == agent) {
// Once it wal found, check if it is the first one.
if (prev)
// If it is not, tell the previous agent that the next one is the next one of the current (jumping the current).
prev->next = agent->next;
else
// If it is the first one, just change the general pointer to point to the second one.
agents = agent->next;
// We are done.
break;
}
prev = p;
p = p->next;
}
}
/**
* Adds an agent to the global list of agents.
*
* @param agent A string with the username, password and real name of an agent. As defined in agents.conf. Example: "13,169,John Smith"
* @param pending If it is pending or not.
* @return The just created agent.
* @sa agent_pvt, agents.
*/
static struct agent_pvt *add_agent(char *agent, int pending)
{
int argc;
char *argv[3];
char *args;
char *password = NULL;
char *name = NULL;
char *agt = NULL;
struct agent_pvt *p, *prev;
args = ast_strdupa(agent);
// Extract username (agt), password and name from agent (args).
if ((argc = <API key>(args, ',', argv, sizeof(argv) / sizeof(argv[0])))) {
agt = argv[0];
if (argc > 1) {
password = argv[1];
while (*password && *password < 33) password++;
}
if (argc > 2) {
name = argv[2];
while (*name && *name < 33) name++;
}
} else {
ast_log(LOG_WARNING, "A blank agent line!\n");
}
// Are we searching for the agent here ? to see if it exists already ?
prev=NULL;
p = agents;
while(p) {
if (!pending && !strcmp(p->agent, agt))
break;
prev = p;
p = p->next;
}
if (!p) {
// Build the agent.
p = malloc(sizeof(struct agent_pvt));
if (p) {
memset(p, 0, sizeof(struct agent_pvt));
ast_copy_string(p->agent, agt, sizeof(p->agent));
ast_mutex_init(&p->lock);
ast_mutex_init(&p->app_lock);
p->owning_app = (pthread_t) -1;
p->app_sleep_cond = 1;
p->group = group;
p->pending = pending;
p->next = NULL;
if (prev)
prev->next = p;
else
agents = p;
} else {
return NULL;
}
}
ast_copy_string(p->password, password ? password : "", sizeof(p->password));
ast_copy_string(p->name, name ? name : "", sizeof(p->name));
ast_copy_string(p->moh, moh, sizeof(p->moh));
p->ackcall = ackcall;
p->autologoff = autologoff;
/* If someone reduces the wrapuptime and reloads, we want it
* to change the wrapuptime immediately on all calls */
if (p->wrapuptime > wrapuptime) {
struct timeval now = ast_tvnow();
/* XXX check what is this exactly */
/* We won't be pedantic and check the tv_usec val */
if (p->lastdisc.tv_sec > (now.tv_sec + wrapuptime/1000)) {
p->lastdisc.tv_sec = now.tv_sec + wrapuptime/1000;
p->lastdisc.tv_usec = now.tv_usec;
}
}
p->wrapuptime = wrapuptime;
if (pending)
p->dead = 1;
else
p->dead = 0;
return p;
}
/**
* Deletes an agent after doing some clean up.
* Further documentation: How safe is this function ? What state should the agent be to be cleaned.
* @param p Agent to be deleted.
* @returns Always 0.
*/
static int agent_cleanup(struct agent_pvt *p)
{
struct ast_channel *chan = p->owner;
p->owner = NULL;
chan->tech_pvt = NULL;
p->app_sleep_cond = 1;
/* Release ownership of the agent to other threads (presumably running the login app). */
ast_mutex_unlock(&p->app_lock);
if (chan)
ast_channel_free(chan);
if (p->dead) {
ast_mutex_destroy(&p->lock);
ast_mutex_destroy(&p->app_lock);
free(p);
}
return 0;
}
static int check_availability(struct agent_pvt *newlyavailable, int needlock);
static int agent_answer(struct ast_channel *ast)
{
ast_log(LOG_WARNING, "Huh? Agent is being asked to answer?\n");
return -1;
}
static int <API key>(struct ast_channel *ast, struct agent_pvt *p, int needlock)
{
char tmp[AST_MAX_BUF],tmp2[AST_MAX_BUF], *pointer;
char filename[AST_MAX_BUF];
int res = -1;
if (!p)
return -1;
if (!ast->monitor) {
snprintf(filename, sizeof(filename), "agent-%s-%s",p->agent, ast->uniqueid);
/* substitute . for - */
if ((pointer = strchr(filename, '.')))
*pointer = '-';
snprintf(tmp, sizeof(tmp), "%s%s",savecallsin ? savecallsin : "", filename);
ast_monitor_start(ast, recordformat, tmp, needlock);
<API key>(ast, 1);
snprintf(tmp2, sizeof(tmp2), "%s%s.%s", urlprefix ? urlprefix : "", filename, recordformatext);
#if 0
ast_verbose("name is %s, link is %s\n",tmp, tmp2);
#endif
if (!ast->cdr)
ast->cdr = ast_cdr_alloc();
<API key>(ast, tmp2);
res = 0;
} else
ast_log(LOG_ERROR, "Recording already started on that call.\n");
return res;
}
static int <API key>(struct ast_channel *ast, int needlock)
{
return <API key>(ast, ast->tech_pvt, needlock);
}
static struct ast_frame *agent_read(struct ast_channel *ast)
{
struct agent_pvt *p = ast->tech_pvt;
struct ast_frame *f = NULL;
static struct ast_frame null_frame = { AST_FRAME_NULL, };
static struct ast_frame answer_frame = { AST_FRAME_CONTROL, AST_CONTROL_ANSWER };
ast_mutex_lock(&p->lock);
CHECK_FORMATS(ast, p);
if (p->chan) {
ast_copy_flags(p->chan, ast, AST_FLAG_EXCEPTION);
if (ast->fdno == AST_MAX_FDS - 3)
p->chan->fdno = AST_MAX_FDS - 2;
else
p->chan->fdno = ast->fdno;
f = ast_read(p->chan);
} else
f = &null_frame;
if (!f) {
/* If there's a channel, hang it up (if it's on a callback) make it NULL */
if (p->chan) {
p->chan->_bridge = NULL;
/* Note that we don't hangup if it's not a callback because Asterisk will do it
for us when the PBX instance that called login finishes */
if (!ast_strlen_zero(p->loginchan)) {
if (p->chan)
ast_log(LOG_DEBUG, "Bridge on '%s' being cleared (2)\n", p->chan->name);
ast_hangup(p->chan);
if (p->wrapuptime && p->acknowledged)
p->lastdisc = ast_tvadd(ast_tvnow(), ast_samp2tv(p->wrapuptime, 1000));
}
p->chan = NULL;
p->acknowledged = 0;
}
} else {
/* if acknowledgement is not required, and the channel is up, we may have missed
an AST_CONTROL_ANSWER (if there was one), so mark the call acknowledged anyway */
if (!p->ackcall && !p->acknowledged && p->chan && (p->chan->_state == AST_STATE_UP))
p->acknowledged = 1;
switch (f->frametype) {
case AST_FRAME_CONTROL:
if (f->subclass == AST_CONTROL_ANSWER) {
if (p->ackcall) {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "%s answered, waiting for '#' to acknowledge\n", p->chan->name);
/* Don't pass answer along */
ast_frfree(f);
f = &null_frame;
} else {
p->acknowledged = 1;
/* Use the builtin answer frame for the
recording start check below. */
ast_frfree(f);
f = &answer_frame;
}
}
break;
case AST_FRAME_DTMF:
if (!p->acknowledged && (f->subclass == '
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "%s acknowledged\n", p->chan->name);
p->acknowledged = 1;
ast_frfree(f);
f = &answer_frame;
} else if (f->subclass == '*') {
/* terminates call */
ast_frfree(f);
f = NULL;
}
break;
case AST_FRAME_VOICE:
/* don't pass voice until the call is acknowledged */
if (!p->acknowledged) {
ast_frfree(f);
f = &null_frame;
}
break;
}
}
CLEANUP(ast,p);
if (p->chan && !p->chan->_bridge) {
if (strcasecmp(p->chan->type, "Local")) {
p->chan->_bridge = ast;
if (p->chan)
ast_log(LOG_DEBUG, "Bridge on '%s' being set to '%s' (3)\n", p->chan->name, p->chan->_bridge->name);
}
}
ast_mutex_unlock(&p->lock);
if (recordagentcalls && f == &answer_frame)
<API key>(ast,0);
return f;
}
static int agent_sendhtml(struct ast_channel *ast, int subclass, const char *data, int datalen)
{
struct agent_pvt *p = ast->tech_pvt;
int res = -1;
ast_mutex_lock(&p->lock);
if (p->chan)
res = <API key>(p->chan, subclass, data, datalen);
ast_mutex_unlock(&p->lock);
return res;
}
static int agent_sendtext(struct ast_channel *ast, const char *text)
{
struct agent_pvt *p = ast->tech_pvt;
int res = -1;
ast_mutex_lock(&p->lock);
if (p->chan)
res = ast_sendtext(p->chan, text);
ast_mutex_unlock(&p->lock);
return res;
}
static int agent_write(struct ast_channel *ast, struct ast_frame *f)
{
struct agent_pvt *p = ast->tech_pvt;
int res = -1;
CHECK_FORMATS(ast, p);
ast_mutex_lock(&p->lock);
if (p->chan) {
if ((f->frametype != AST_FRAME_VOICE) ||
(f->subclass == p->chan->writeformat)) {
res = ast_write(p->chan, f);
} else {
ast_log(LOG_DEBUG, "Dropping one incompatible voice frame on '%s' to '%s'\n", ast->name, p->chan->name);
res = 0;
}
} else
res = 0;
CLEANUP(ast, p);
ast_mutex_unlock(&p->lock);
return res;
}
static int agent_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
{
struct agent_pvt *p = newchan->tech_pvt;
ast_mutex_lock(&p->lock);
if (p->owner != oldchan) {
ast_log(LOG_WARNING, "old channel wasn't %p but was %p\n", oldchan, p->owner);
ast_mutex_unlock(&p->lock);
return -1;
}
p->owner = newchan;
ast_mutex_unlock(&p->lock);
return 0;
}
static int agent_indicate(struct ast_channel *ast, int condition)
{
struct agent_pvt *p = ast->tech_pvt;
int res = -1;
ast_mutex_lock(&p->lock);
if (p->chan)
res = p->chan->tech->indicate ? p->chan->tech->indicate(p->chan, condition) : -1;
else
res = 0;
ast_mutex_unlock(&p->lock);
return res;
}
static int agent_digit(struct ast_channel *ast, char digit)
{
struct agent_pvt *p = ast->tech_pvt;
int res = -1;
ast_mutex_lock(&p->lock);
if (p->chan)
res = p->chan->tech->send_digit(p->chan, digit);
else
res = 0;
ast_mutex_unlock(&p->lock);
return res;
}
static int agent_call(struct ast_channel *ast, char *dest, int timeout)
{
struct agent_pvt *p = ast->tech_pvt;
int res = -1;
int newstate=0;
ast_mutex_lock(&p->lock);
p->acknowledged = 0;
if (!p->chan) {
if (p->pending) {
ast_log(LOG_DEBUG, "Pretending to dial on pending agent\n");
newstate = AST_STATE_DIALING;
res = 0;
} else {
ast_log(LOG_NOTICE, "Whoa, they hung up between alloc and call... what are the odds of that?\n");
res = -1;
}
ast_mutex_unlock(&p->lock);
if (newstate)
ast_setstate(ast, newstate);
return res;
} else if (!ast_strlen_zero(p->loginchan)) {
time(&p->start);
/* Call on this agent */
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "outgoing agentcall, to agent '%s', on '%s'\n", p->agent, p->chan->name);
ast_set_callerid(p->chan,
ast->cid.cid_num, ast->cid.cid_name, NULL);
<API key>(ast, p->chan);
res = ast_call(p->chan, p->loginchan, 0);
CLEANUP(ast,p);
ast_mutex_unlock(&p->lock);
return res;
}
ast_verbose( VERBOSE_PREFIX_3 "agent_call, call to agent '%s' call on '%s'\n", p->agent, p->chan->name);
ast_log( LOG_DEBUG, "Playing beep, lang '%s'\n", p->chan->language);
res = ast_streamfile(p->chan, beep, p->chan->language);
ast_log( LOG_DEBUG, "Played beep, result '%d'\n", res);
if (!res) {
res = ast_waitstream(p->chan, "");
ast_log( LOG_DEBUG, "Waited for stream, result '%d'\n", res);
}
if (!res) {
res = ast_set_read_format(p->chan, ast_best_codec(p->chan->nativeformats));
ast_log( LOG_DEBUG, "Set read format, result '%d'\n", res);
if (res)
ast_log(LOG_WARNING, "Unable to set read format to %s\n", ast_getformatname(ast_best_codec(p->chan->nativeformats)));
} else {
/* Agent hung-up */
p->chan = NULL;
}
if (!res) {
<API key>(p->chan, ast_best_codec(p->chan->nativeformats));
ast_log( LOG_DEBUG, "Set write format, result '%d'\n", res);
if (res)
ast_log(LOG_WARNING, "Unable to set write format to %s\n", ast_getformatname(ast_best_codec(p->chan->nativeformats)));
}
if( !res )
{
/* Call is immediately up, or might need ack */
if (p->ackcall > 1)
newstate = AST_STATE_RINGING;
else {
newstate = AST_STATE_UP;
if (recordagentcalls)
<API key>(ast,0);
p->acknowledged = 1;
}
res = 0;
}
CLEANUP(ast,p);
ast_mutex_unlock(&p->lock);
if (newstate)
ast_setstate(ast, newstate);
return res;
}
/* store/clear the global variable that stores agentid based on the callerid */
static void set_agentbycallerid(const char *callerid, const char *agent)
{
char buf[AST_MAX_BUF];
/* if there is no Caller ID, nothing to do */
if (ast_strlen_zero(callerid))
return;
snprintf(buf, sizeof(buf), "%s_%s",GETAGENTBYCALLERID, callerid);
<API key>(NULL, buf, agent);
}
static int agent_hangup(struct ast_channel *ast)
{
struct agent_pvt *p = ast->tech_pvt;
int howlong = 0;
ast_mutex_lock(&p->lock);
p->owner = NULL;
ast->tech_pvt = NULL;
p->app_sleep_cond = 1;
p->acknowledged = 0;
/* if they really are hung up then set start to 0 so the test
* later if we're called on an already downed channel
* doesn't cause an agent to be logged out like when
* agent_request() is followed immediately by agent_hangup()
* as in apps/app_chanisavail.c:chanavail_exec()
*/
ast_mutex_lock(&usecnt_lock);
usecnt
ast_mutex_unlock(&usecnt_lock);
ast_log(LOG_DEBUG, "Hangup called for state %s\n", ast_state2str(ast->_state));
if (p->start && (ast->_state != AST_STATE_UP)) {
howlong = time(NULL) - p->start;
p->start = 0;
} else if (ast->_state == AST_STATE_RESERVED) {
howlong = 0;
} else
p->start = 0;
if (p->chan) {
p->chan->_bridge = NULL;
/* If they're dead, go ahead and hang up on the agent now */
if (!ast_strlen_zero(p->loginchan)) {
/* Store last disconnect time */
if (p->wrapuptime)
p->lastdisc = ast_tvadd(ast_tvnow(), ast_samp2tv(p->wrapuptime, 1000));
else
p->lastdisc = ast_tv(0,0);
if (p->chan) {
/* Recognize the hangup and pass it along immediately */
ast_hangup(p->chan);
p->chan = NULL;
}
ast_log(LOG_DEBUG, "Hungup, howlong is %d, autologoff is %d\n", howlong, p->autologoff);
if (howlong && p->autologoff && (howlong > p->autologoff)) {
char agent[AST_MAX_AGENT] = "";
long logintime = time(NULL) - p->loginstart;
p->loginstart = 0;
ast_log(LOG_NOTICE, "Agent '%s' didn't answer/confirm within %d seconds (waited %d)\n", p->name, p->autologoff, howlong);
manager_event(EVENT_FLAG_AGENT, "Agentcallbacklogoff",
"Agent: %s\r\n"
"Loginchan: %s\r\n"
"Logintime: %ld\r\n"
"Reason: Autologoff\r\n"
"Uniqueid: %s\r\n",
p->agent, p->loginchan, logintime, ast->uniqueid);
snprintf(agent, sizeof(agent), "Agent/%s", p->agent);
ast_queue_log("NONE", ast->uniqueid, agent, "AGENTCALLBACKLOGOFF", "%s|%ld|%s", p->loginchan, logintime, "Autologoff");
set_agentbycallerid(p->logincallerid, NULL);
<API key>("Agent/%s", p->agent);
p->loginchan[0] = '\0';
p->logincallerid[0] = '\0';
if (persistent_agents)
dump_agents();
} else if (!p->loginstart) {
p->loginchan[0] = '\0';
p->logincallerid[0] = '\0';
if (persistent_agents)
dump_agents();
}
} else if (p->dead) {
ast_mutex_lock(&p->chan->lock);
ast_softhangup(p->chan, <API key>);
ast_mutex_unlock(&p->chan->lock);
} else if (p->loginstart) {
ast_mutex_lock(&p->chan->lock);
ast_moh_start(p->chan, p->moh);
ast_mutex_unlock(&p->chan->lock);
}
}
ast_mutex_unlock(&p->lock);
/* Only register a device state change if the agent is still logged in */
if (!p->loginstart) {
p->loginchan[0] = '\0';
p->logincallerid[0] = '\0';
if (persistent_agents)
dump_agents();
} else {
<API key>("Agent/%s", p->agent);
}
if (p->pending) {
ast_mutex_lock(&agentlock);
agent_unlink(p);
ast_mutex_unlock(&agentlock);
}
if (p->abouttograb) {
/* Let the "about to grab" thread know this isn't valid anymore, and let it
kill it later */
p->abouttograb = 0;
} else if (p->dead) {
ast_mutex_destroy(&p->lock);
ast_mutex_destroy(&p->app_lock);
free(p);
} else {
if (p->chan) {
/* Not dead -- check availability now */
ast_mutex_lock(&p->lock);
/* Store last disconnect time */
p->lastdisc = ast_tvadd(ast_tvnow(), ast_samp2tv(p->wrapuptime, 1000));
ast_mutex_unlock(&p->lock);
}
/* Release ownership of the agent to other threads (presumably running the login app). */
if (ast_strlen_zero(p->loginchan))
ast_mutex_unlock(&p->app_lock);
}
return 0;
}
static int agent_cont_sleep( void *data )
{
struct agent_pvt *p;
int res;
p = (struct agent_pvt *)data;
ast_mutex_lock(&p->lock);
res = p->app_sleep_cond;
if (p->lastdisc.tv_sec) {
if (ast_tvdiff_ms(ast_tvnow(), p->lastdisc) > 0)
res = 1;
}
ast_mutex_unlock(&p->lock);
#if 0
if( !res )
ast_log( LOG_DEBUG, "agent_cont_sleep() returning %d\n", res );
#endif
return res;
}
static int agent_ack_sleep( void *data )
{
struct agent_pvt *p;
int res=0;
int to = 1000;
struct ast_frame *f;
/* Wait a second and look for something */
p = (struct agent_pvt *)data;
if (p->chan) {
for(;;) {
to = ast_waitfor(p->chan, to);
if (to < 0) {
res = -1;
break;
}
if (!to) {
res = 0;
break;
}
f = ast_read(p->chan);
if (!f) {
res = -1;
break;
}
if (f->frametype == AST_FRAME_DTMF)
res = f->subclass;
else
res = 0;
ast_frfree(f);
ast_mutex_lock(&p->lock);
if (!p->app_sleep_cond) {
ast_mutex_unlock(&p->lock);
res = 0;
break;
} else if (res == '
ast_mutex_unlock(&p->lock);
res = 1;
break;
}
ast_mutex_unlock(&p->lock);
res = 0;
}
} else
res = -1;
return res;
}
static struct ast_channel *<API key>(struct ast_channel *chan, struct ast_channel *bridge)
{
struct agent_pvt *p = bridge->tech_pvt;
struct ast_channel *ret=NULL;
if (p) {
if (chan == p->chan)
ret = bridge->_bridge;
else if (chan == bridge->_bridge)
ret = p->chan;
}
if (option_debug)
ast_log(LOG_DEBUG, "Asked for bridged channel on '%s'/'%s', returning '%s'\n", chan->name, bridge->name, ret ? ret->name : "<none>");
return ret;
}
static struct ast_channel *agent_new(struct agent_pvt *p, int state)
{
struct ast_channel *tmp;
struct ast_frame null_frame = { AST_FRAME_NULL };
#if 0
if (!p->chan) {
ast_log(LOG_WARNING, "No channel? :(\n");
return NULL;
}
#endif
tmp = ast_channel_alloc(0);
if (tmp) {
tmp->tech = &agent_tech;
if (p->chan) {
tmp->nativeformats = p->chan->nativeformats;
tmp->writeformat = p->chan->writeformat;
tmp->rawwriteformat = p->chan->writeformat;
tmp->readformat = p->chan->readformat;
tmp->rawreadformat = p->chan->readformat;
ast_copy_string(tmp->language, p->chan->language, sizeof(tmp->language));
ast_copy_string(tmp->context, p->chan->context, sizeof(tmp->context));
ast_copy_string(tmp->exten, p->chan->exten, sizeof(tmp->exten));
} else {
tmp->nativeformats = AST_FORMAT_SLINEAR;
tmp->writeformat = AST_FORMAT_SLINEAR;
tmp->rawwriteformat = AST_FORMAT_SLINEAR;
tmp->readformat = AST_FORMAT_SLINEAR;
tmp->rawreadformat = AST_FORMAT_SLINEAR;
}
if (p->pending)
snprintf(tmp->name, sizeof(tmp->name), "Agent/P%s-%d", p->agent, rand() & 0xffff);
else
snprintf(tmp->name, sizeof(tmp->name), "Agent/%s", p->agent);
tmp->type = channeltype;
/* Safe, agentlock already held */
ast_setstate(tmp, state);
tmp->tech_pvt = p;
p->owner = tmp;
ast_mutex_lock(&usecnt_lock);
usecnt++;
ast_mutex_unlock(&usecnt_lock);
<API key>();
tmp->priority = 1;
/* Wake up and wait for other applications (by definition the login app)
* to release this channel). Takes ownership of the agent channel
* to this thread only.
* For signalling the other thread, ast_queue_frame is used until we
* can safely use signals for this purpose. The pselect() needs to be
* implemented in the kernel for this.
*/
p->app_sleep_cond = 0;
if( ast_strlen_zero(p->loginchan) && ast_mutex_trylock(&p->app_lock) )
{
if (p->chan) {
ast_queue_frame(p->chan, &null_frame);
ast_mutex_unlock(&p->lock); /* For other thread to read the condition. */
ast_mutex_lock(&p->app_lock);
ast_mutex_lock(&p->lock);
}
if( !p->chan )
{
ast_log(LOG_WARNING, "Agent disconnected while we were connecting the call\n");
p->owner = NULL;
tmp->tech_pvt = NULL;
p->app_sleep_cond = 1;
ast_channel_free( tmp );
ast_mutex_unlock(&p->lock); /* For other thread to read the condition. */
ast_mutex_unlock(&p->app_lock);
return NULL;
}
} else if (!ast_strlen_zero(p->loginchan)) {
if (p->chan)
ast_queue_frame(p->chan, &null_frame);
if (!p->chan) {
ast_log(LOG_WARNING, "Agent disconnected while we were connecting the call\n");
p->owner = NULL;
tmp->tech_pvt = NULL;
p->app_sleep_cond = 1;
ast_channel_free( tmp );
ast_mutex_unlock(&p->lock); /* For other thread to read the condition. */
return NULL;
}
}
p->owning_app = pthread_self();
/* After the above step, there should not be any blockers. */
if (p->chan) {
if (ast_test_flag(p->chan, AST_FLAG_BLOCKING)) {
ast_log( LOG_ERROR, "A blocker exists after agent channel ownership acquired\n" );
CRASH;
}
ast_moh_stop(p->chan);
}
} else
ast_log(LOG_WARNING, "Unable to allocate agent channel structure\n");
return tmp;
}
/**
* Read configuration data. The file named agents.conf.
*
* @returns Always 0, or so it seems.
*/
static int read_agent_config(void)
{
struct ast_config *cfg;
struct ast_variable *v;
struct agent_pvt *p, *pl, *pn;
char *general_val;
group = 0;
autologoff = 0;
wrapuptime = 0;
ackcall = 0;
cfg = ast_config_load(config);
if (!cfg) {
ast_log(LOG_NOTICE, "No agent configuration found -- agent support disabled\n");
return 0;
}
ast_mutex_lock(&agentlock);
p = agents;
while(p) {
p->dead = 1;
p = p->next;
}
strcpy(moh, "default");
/* set the default recording values */
recordagentcalls = 0;
createlink = 0;
strcpy(recordformat, "wav");
strcpy(recordformatext, "wav");
urlprefix[0] = '\0';
savecallsin[0] = '\0';
/* Read in [general] section for persistence */
if ((general_val = <API key>(cfg, "general", "persistentagents")))
persistent_agents = ast_true(general_val);
/* Read in the [agents] section */
v = ast_variable_browse(cfg, "agents");
while(v) {
/* Create the interface list */
if (!strcasecmp(v->name, "agent")) {
add_agent(v->value, 0);
} else if (!strcasecmp(v->name, "group")) {
group = ast_get_group(v->value);
} else if (!strcasecmp(v->name, "autologoff")) {
autologoff = atoi(v->value);
if (autologoff < 0)
autologoff = 0;
} else if (!strcasecmp(v->name, "ackcall")) {
if (!strcasecmp(v->value, "always"))
ackcall = 2;
else if (ast_true(v->value))
ackcall = 1;
else
ackcall = 0;
} else if (!strcasecmp(v->name, "wrapuptime")) {
wrapuptime = atoi(v->value);
if (wrapuptime < 0)
wrapuptime = 0;
} else if (!strcasecmp(v->name, "maxlogintries") && !ast_strlen_zero(v->value)) {
maxlogintries = atoi(v->value);
if (maxlogintries < 0)
maxlogintries = 0;
} else if (!strcasecmp(v->name, "goodbye") && !ast_strlen_zero(v->value)) {
strcpy(agentgoodbye,v->value);
} else if (!strcasecmp(v->name, "musiconhold")) {
ast_copy_string(moh, v->value, sizeof(moh));
} else if (!strcasecmp(v->name, "updatecdr")) {
if (ast_true(v->value))
updatecdr = 1;
else
updatecdr = 0;
} else if (!strcasecmp(v->name, "recordagentcalls")) {
recordagentcalls = ast_true(v->value);
} else if (!strcasecmp(v->name, "createlink")) {
createlink = ast_true(v->value);
} else if (!strcasecmp(v->name, "recordformat")) {
ast_copy_string(recordformat, v->value, sizeof(recordformat));
if (!strcasecmp(v->value, "wav49"))
strcpy(recordformatext, "WAV");
else
ast_copy_string(recordformatext, v->value, sizeof(recordformatext));
} else if (!strcasecmp(v->name, "urlprefix")) {
ast_copy_string(urlprefix, v->value, sizeof(urlprefix));
if (urlprefix[strlen(urlprefix) - 1] != '/')
strncat(urlprefix, "/", sizeof(urlprefix) - strlen(urlprefix) - 1);
} else if (!strcasecmp(v->name, "savecallsin")) {
if (v->value[0] == '/')
ast_copy_string(savecallsin, v->value, sizeof(savecallsin));
else
snprintf(savecallsin, sizeof(savecallsin) - 2, "/%s", v->value);
if (savecallsin[strlen(savecallsin) - 1] != '/')
strncat(savecallsin, "/", sizeof(savecallsin) - strlen(savecallsin) - 1);
} else if (!strcasecmp(v->name, "custom_beep")) {
ast_copy_string(beep, v->value, sizeof(beep));
}
v = v->next;
}
p = agents;
pl = NULL;
while(p) {
pn = p->next;
if (p->dead) {
/* Unlink */
if (pl)
pl->next = p->next;
else
agents = p->next;
/* Destroy if appropriate */
if (!p->owner) {
if (!p->chan) {
ast_mutex_destroy(&p->lock);
ast_mutex_destroy(&p->app_lock);
free(p);
} else {
/* Cause them to hang up */
ast_softhangup(p->chan, <API key>);
}
}
} else
pl = p;
p = pn;
}
ast_mutex_unlock(&agentlock);
ast_config_destroy(cfg);
return 0;
}
static int check_availability(struct agent_pvt *newlyavailable, int needlock)
{
struct ast_channel *chan=NULL, *parent=NULL;
struct agent_pvt *p;
int res;
if (option_debug)
ast_log(LOG_DEBUG, "Checking availability of '%s'\n", newlyavailable->agent);
if (needlock)
ast_mutex_lock(&agentlock);
p = agents;
while(p) {
if (p == newlyavailable) {
p = p->next;
continue;
}
ast_mutex_lock(&p->lock);
if (!p->abouttograb && p->pending && ((p->group && (newlyavailable->group & p->group)) || !strcmp(p->agent, newlyavailable->agent))) {
if (option_debug)
ast_log(LOG_DEBUG, "Call '%s' looks like a winner for agent '%s'\n", p->owner->name, newlyavailable->agent);
/* We found a pending call, time to merge */
chan = agent_new(newlyavailable, AST_STATE_DOWN);
parent = p->owner;
p->abouttograb = 1;
ast_mutex_unlock(&p->lock);
break;
}
ast_mutex_unlock(&p->lock);
p = p->next;
}
if (needlock)
ast_mutex_unlock(&agentlock);
if (parent && chan) {
if (newlyavailable->ackcall > 1) {
/* Don't do beep here */
res = 0;
} else {
if (option_debug > 2)
ast_log( LOG_DEBUG, "Playing beep, lang '%s'\n", newlyavailable->chan->language);
res = ast_streamfile(newlyavailable->chan, beep, newlyavailable->chan->language);
if (option_debug > 2)
ast_log( LOG_DEBUG, "Played beep, result '%d'\n", res);
if (!res) {
res = ast_waitstream(newlyavailable->chan, "");
ast_log( LOG_DEBUG, "Waited for stream, result '%d'\n", res);
}
}
if (!res) {
/* Note -- parent may have disappeared */
if (p->abouttograb) {
newlyavailable->acknowledged = 1;
/* Safe -- agent lock already held */
ast_setstate(parent, AST_STATE_UP);
ast_setstate(chan, AST_STATE_UP);
ast_copy_string(parent->context, chan->context, sizeof(parent->context));
/* Go ahead and mark the channel as a zombie so that masquerade will
destroy it for us, and we need not call ast_hangup */
ast_mutex_lock(&parent->lock);
ast_set_flag(chan, AST_FLAG_ZOMBIE);
<API key>(parent, chan);
ast_mutex_unlock(&parent->lock);
p->abouttograb = 0;
} else {
if (option_debug)
ast_log(LOG_DEBUG, "Sneaky, parent disappeared in the mean time...\n");
agent_cleanup(newlyavailable);
}
} else {
if (option_debug)
ast_log(LOG_DEBUG, "Ugh... Agent hung up at exactly the wrong time\n");
agent_cleanup(newlyavailable);
}
}
return 0;
}
static int check_beep(struct agent_pvt *newlyavailable, int needlock)
{
struct agent_pvt *p;
int res=0;
ast_log(LOG_DEBUG, "Checking beep availability of '%s'\n", newlyavailable->agent);
if (needlock)
ast_mutex_lock(&agentlock);
p = agents;
while(p) {
if (p == newlyavailable) {
p = p->next;
continue;
}
ast_mutex_lock(&p->lock);
if (!p->abouttograb && p->pending && ((p->group && (newlyavailable->group & p->group)) || !strcmp(p->agent, newlyavailable->agent))) {
if (option_debug)
ast_log(LOG_DEBUG, "Call '%s' looks like a would-be winner for agent '%s'\n", p->owner->name, newlyavailable->agent);
ast_mutex_unlock(&p->lock);
break;
}
ast_mutex_unlock(&p->lock);
p = p->next;
}
if (needlock)
ast_mutex_unlock(&agentlock);
if (p) {
ast_mutex_unlock(&newlyavailable->lock);
if (option_debug > 2)
ast_log( LOG_DEBUG, "Playing beep, lang '%s'\n", newlyavailable->chan->language);
res = ast_streamfile(newlyavailable->chan, beep, newlyavailable->chan->language);
if (option_debug > 2)
ast_log( LOG_DEBUG, "Played beep, result '%d'\n", res);
if (!res) {
res = ast_waitstream(newlyavailable->chan, "");
if (option_debug)
ast_log( LOG_DEBUG, "Waited for stream, result '%d'\n", res);
}
ast_mutex_lock(&newlyavailable->lock);
}
return res;
}
static struct ast_channel *agent_request(const char *type, int format, void *data, int *cause)
{
struct agent_pvt *p;
struct ast_channel *chan = NULL;
char *s;
ast_group_t groupmatch;
int groupoff;
int waitforagent=0;
int hasagent = 0;
struct timeval tv;
s = data;
if ((s[0] == '@') && (sscanf(s + 1, "%d", &groupoff) == 1)) {
groupmatch = (1 << groupoff);
} else if ((s[0] == ':') && (sscanf(s + 1, "%d", &groupoff) == 1)) {
groupmatch = (1 << groupoff);
waitforagent = 1;
} else {
groupmatch = 0;
}
/* Check actual logged in agents first */
ast_mutex_lock(&agentlock);
p = agents;
while(p) {
ast_mutex_lock(&p->lock);
if (!p->pending && ((groupmatch && (p->group & groupmatch)) || !strcmp(data, p->agent)) &&
ast_strlen_zero(p->loginchan)) {
if (p->chan)
hasagent++;
tv = ast_tvnow();
if (!p->lastdisc.tv_sec || (tv.tv_sec >= p->lastdisc.tv_sec)) {
p->lastdisc = ast_tv(0, 0);
/* Agent must be registered, but not have any active call, and not be in a waiting state */
if (!p->owner && p->chan) {
/* Fixed agent */
chan = agent_new(p, AST_STATE_DOWN);
}
if (chan) {
ast_mutex_unlock(&p->lock);
break;
}
}
}
ast_mutex_unlock(&p->lock);
p = p->next;
}
if (!p) {
p = agents;
while(p) {
ast_mutex_lock(&p->lock);
if (!p->pending && ((groupmatch && (p->group & groupmatch)) || !strcmp(data, p->agent))) {
if (p->chan || !ast_strlen_zero(p->loginchan))
hasagent++;
tv = ast_tvnow();
#if 0
ast_log(LOG_NOTICE, "Time now: %ld, Time of lastdisc: %ld\n", tv.tv_sec, p->lastdisc.tv_sec);
#endif
if (!p->lastdisc.tv_sec || (tv.tv_sec >= p->lastdisc.tv_sec)) {
p->lastdisc = ast_tv(0, 0);
/* Agent must be registered, but not have any active call, and not be in a waiting state */
if (!p->owner && p->chan) {
/* Could still get a fixed agent */
chan = agent_new(p, AST_STATE_DOWN);
} else if (!p->owner && !ast_strlen_zero(p->loginchan)) {
/* Adjustable agent */
p->chan = ast_request("Local", format, p->loginchan, cause);
if (p->chan)
chan = agent_new(p, AST_STATE_DOWN);
}
if (chan) {
ast_mutex_unlock(&p->lock);
break;
}
}
}
ast_mutex_unlock(&p->lock);
p = p->next;
}
}
if (!chan && waitforagent) {
/* No agent available -- but we're requesting to wait for one.
Allocate a place holder */
if (hasagent) {
if (option_debug)
ast_log(LOG_DEBUG, "Creating place holder for '%s'\n", s);
p = add_agent(data, 1);
p->group = groupmatch;
chan = agent_new(p, AST_STATE_DOWN);
if (!chan) {
ast_log(LOG_WARNING, "Weird... Fix this to drop the unused pending agent\n");
}
} else
ast_log(LOG_DEBUG, "Not creating place holder for '%s' since nobody logged in\n", s);
}
if (hasagent)
*cause = AST_CAUSE_BUSY;
else
*cause = <API key>;
ast_mutex_unlock(&agentlock);
return chan;
}
static int powerof(unsigned int v)
{
int x;
for (x=0;x<32;x++) {
if (v & (1 << x)) return x;
}
return 0;
}
/**
* Lists agents and their status to the Manager API.
* It is registered on load_module() and it gets called by the manager backend.
* @param s
* @param m
* @returns
* @sa action_agent_logoff(), <API key>(), load_module().
*/
static int action_agents(struct mansession *s, struct message *m)
{
char *id = astman_get_header(m,"ActionID");
char idText[256] = "";
char chanbuf[256];
struct agent_pvt *p;
char *username = NULL;
char *loginChan = NULL;
char *talkingtoChan = NULL;
char *status = NULL;
if (!ast_strlen_zero(id))
snprintf(idText, sizeof(idText) ,"ActionID: %s\r\n", id);
astman_send_ack(s, m, "Agents will follow");
ast_mutex_lock(&agentlock);
p = agents;
while(p) {
ast_mutex_lock(&p->lock);
/* Status Values:
AGENT_LOGGEDOFF - Agent isn't logged in
AGENT_IDLE - Agent is logged in, and waiting for call
AGENT_ONCALL - Agent is logged in, and on a call
AGENT_UNKNOWN - Don't know anything about agent. Shouldn't ever get this. */
if(!ast_strlen_zero(p->name)) {
username = p->name;
} else {
username = "None";
}
/* Set a default status. It 'should' get changed. */
status = "AGENT_UNKNOWN";
if (!ast_strlen_zero(p->loginchan) && !p->chan) {
loginChan = p->loginchan;
talkingtoChan = "n/a";
status = "AGENT_IDLE";
if (p->acknowledged) {
snprintf(chanbuf, sizeof(chanbuf), " %s (Confirmed)", p->loginchan);
loginChan = chanbuf;
}
} else if (p->chan) {
loginChan = ast_strdupa(p->chan->name);
if (p->owner && p->owner->_bridge) {
talkingtoChan = p->chan->cid.cid_num;
status = "AGENT_ONCALL";
} else {
talkingtoChan = "n/a";
status = "AGENT_IDLE";
}
} else {
loginChan = "n/a";
talkingtoChan = "n/a";
status = "AGENT_LOGGEDOFF";
}
ast_cli(s->fd, "Event: Agents\r\n"
"Agent: %s\r\n"
"Name: %s\r\n"
"Status: %s\r\n"
"LoggedInChan: %s\r\n"
"LoggedInTime: %d\r\n"
"TalkingTo: %s\r\n"
"%s"
"\r\n",
p->agent, username, status, loginChan, (int)p->loginstart, talkingtoChan, idText);
ast_mutex_unlock(&p->lock);
p = p->next;
}
ast_mutex_unlock(&agentlock);
ast_cli(s->fd, "Event: AgentsComplete\r\n"
"%s"
"\r\n",idText);
return 0;
}
static int agent_logoff(char *agent, int soft)
{
struct agent_pvt *p;
long logintime;
int ret = -1; /* Return -1 if no agent if found */
int defer = 0;
for (p=agents; p; p=p->next) {
if (!strcasecmp(p->agent, agent)) {
if (p->owner || p->chan)
defer = 1;
if (!soft) {
if (p->owner)
ast_softhangup(p->owner, <API key>);
if (p->chan)
ast_softhangup(p->chan, <API key>);
}
ret = 0; /* found an agent => return 0 */
logintime = time(NULL) - p->loginstart;
p->loginstart = 0;
manager_event(EVENT_FLAG_AGENT, "Agentcallbacklogoff",
"Agent: %s\r\n"
"Loginchan: %s\r\n"
"Logintime: %ld\r\n",
p->agent, p->loginchan, logintime);
ast_queue_log("NONE", "NONE", agent, "AGENTCALLBACKLOGOFF", "%s|%ld|%s", p->loginchan, logintime, "CommandLogoff");
set_agentbycallerid(p->logincallerid, NULL);
if (!defer) {
p->loginchan[0] = '\0';
p->logincallerid[0] = '\0';
}
<API key>("Agent/%s", p->agent);
if (persistent_agents)
dump_agents();
break;
}
}
return ret;
}
static int agent_logoff_cmd(int fd, int argc, char **argv)
{
int ret;
char *agent;
if (argc < 3 || argc > 4)
return RESULT_SHOWUSAGE;
if (argc == 4 && strcasecmp(argv[3], "soft"))
return RESULT_SHOWUSAGE;
agent = argv[2] + 6;
ret = agent_logoff(agent, argc == 4);
if (ret == 0)
ast_cli(fd, "Logging out %s\n", agent);
return RESULT_SUCCESS;
}
/**
* Sets an agent as no longer logged in in the Manager API.
* It is registered on load_module() and it gets called by the manager backend.
* @param s
* @param m
* @returns
* @sa action_agents(), <API key>(), load_module().
*/
static int action_agent_logoff(struct mansession *s, struct message *m)
{
char *agent = astman_get_header(m, "Agent");
char *soft_s = astman_get_header(m, "Soft"); /* "true" is don't hangup */
int soft;
int ret; /* return value of agent_logoff */
if (ast_strlen_zero(agent)) {
astman_send_error(s, m, "No agent specified");
return 0;
}
if (ast_true(soft_s))
soft = 1;
else
soft = 0;
ret = agent_logoff(agent, soft);
if (ret == 0)
astman_send_ack(s, m, "Agent logged out");
else
astman_send_error(s, m, "No such agent");
return 0;
}
static char *<API key>(char *line, char *word, int pos, int state)
{
struct agent_pvt *p;
char name[AST_MAX_AGENT];
int which = 0;
if (pos == 2) {
for (p=agents; p; p=p->next) {
snprintf(name, sizeof(name), "Agent/%s", p->agent);
if (!strncasecmp(word, name, strlen(word))) {
if (++which > state) {
return strdup(name);
}
}
}
} else if (pos == 3 && state == 0) {
return strdup("soft");
}
return NULL;
}
/**
* Show agents in cli.
*/
static int agents_show(int fd, int argc, char **argv)
{
struct agent_pvt *p;
char username[AST_MAX_BUF];
char location[AST_MAX_BUF] = "";
char talkingto[AST_MAX_BUF] = "";
char moh[AST_MAX_BUF];
int count_agents = 0; /* Number of agents configured */
int online_agents = 0; /* Number of online agents */
int offline_agents = 0; /* Number of offline agents */
if (argc != 2)
return RESULT_SHOWUSAGE;
ast_mutex_lock(&agentlock);
p = agents;
while(p) {
ast_mutex_lock(&p->lock);
if (p->pending) {
if (p->group)
ast_cli(fd, "-- Pending call to group %d\n", powerof(p->group));
else
ast_cli(fd, "-- Pending call to agent %s\n", p->agent);
} else {
if (!ast_strlen_zero(p->name))
snprintf(username, sizeof(username), "(%s) ", p->name);
else
username[0] = '\0';
if (p->chan) {
snprintf(location, sizeof(location), "logged in on %s", p->chan->name);
if (p->owner && ast_bridged_channel(p->owner)) {
snprintf(talkingto, sizeof(talkingto), " talking to %s", ast_bridged_channel(p->owner)->name);
} else {
strcpy(talkingto, " is idle");
}
online_agents++;
} else if (!ast_strlen_zero(p->loginchan)) {
if (ast_tvdiff_ms(ast_tvnow(), p->lastdisc) > 0 || !(p->lastdisc.tv_sec))
snprintf(location, sizeof(location) - 20, "available at '%s'", p->loginchan);
else
snprintf(location, sizeof(location) - 20, "wrapping up at '%s'", p->loginchan);
talkingto[0] = '\0';
online_agents++;
if (p->acknowledged)
strncat(location, " (Confirmed)", sizeof(location) - strlen(location) - 1);
} else {
strcpy(location, "not logged in");
talkingto[0] = '\0';
offline_agents++;
}
if (!ast_strlen_zero(p->moh))
snprintf(moh, sizeof(moh), " (musiconhold is '%s')", p->moh);
ast_cli(fd, "%-12.12s %s%s%s%s\n", p->agent,
username, location, talkingto, moh);
count_agents++;
}
ast_mutex_unlock(&p->lock);
p = p->next;
}
ast_mutex_unlock(&agentlock);
if ( !count_agents ) {
ast_cli(fd, "No Agents are configured in %s\n",config);
} else {
ast_cli(fd, "%d agents configured [%d online , %d offline]\n",count_agents, online_agents, offline_agents);
}
ast_cli(fd, "\n");
return RESULT_SUCCESS;
}
static char show_agents_usage[] =
"Usage: show agents\n"
" Provides summary information on agents.\n";
static char agent_logoff_usage[] =
"Usage: agent logoff <channel> [soft]\n"
" Sets an agent as no longer logged in.\n"
" If 'soft' is specified, do not hangup existing calls.\n";
static struct ast_cli_entry cli_show_agents = {
{ "show", "agents", NULL }, agents_show,
"Show status of agents", show_agents_usage, NULL };
static struct ast_cli_entry cli_agent_logoff = {
{ "agent", "logoff", NULL }, agent_logoff_cmd,
"Sets an agent offline", agent_logoff_usage, <API key> };
STANDARD_LOCAL_USER;
LOCAL_USER_DECL;
/*!
* \brief Log in agent application.
*
* \param chan
* \param data
* \param callbackmode non-zero for AgentCallbackLogin
*/
static int __login_exec(struct ast_channel *chan, void *data, int callbackmode)
{
int res=0;
int tries = 0;
int max_login_tries = maxlogintries;
struct agent_pvt *p;
struct localuser *u;
int login_state = 0;
char user[AST_MAX_AGENT] = "";
char pass[AST_MAX_AGENT];
char agent[AST_MAX_AGENT] = "";
char xpass[AST_MAX_AGENT] = "";
char *errmsg;
char *parse;
<API key>(args,
AST_APP_ARG(agent_id);
AST_APP_ARG(options);
AST_APP_ARG(extension);
);
char *tmpoptions = NULL;
char *context = NULL;
int play_announcement = 1;
char agent_goodbye[<API key>];
int update_cdr = updatecdr;
char *filename = "agent-loginok";
char tmpchan[AST_MAX_BUF] = "";
LOCAL_USER_ADD(u);
if (!(parse = ast_strdupa(data))) {
ast_log(LOG_ERROR, "Out of memory!\n");
LOCAL_USER_REMOVE(u);
return -1;
}
<API key>(args, parse);
ast_copy_string(agent_goodbye, agentgoodbye, sizeof(agent_goodbye));
/* Set Channel Specific Login Overrides */
if (<API key>(chan, "AGENTLMAXLOGINTRIES") && strlen(<API key>(chan, "AGENTLMAXLOGINTRIES"))) {
max_login_tries = atoi(<API key>(chan, "AGENTMAXLOGINTRIES"));
if (max_login_tries < 0)
max_login_tries = 0;
tmpoptions=<API key>(chan, "AGENTMAXLOGINTRIES");
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Saw variable AGENTMAXLOGINTRIES=%s, setting max_login_tries to: %d on Channel '%s'.\n",tmpoptions,max_login_tries,chan->name);
}
if (<API key>(chan, "AGENTUPDATECDR") && !ast_strlen_zero(<API key>(chan, "AGENTUPDATECDR"))) {
if (ast_true(<API key>(chan, "AGENTUPDATECDR")))
update_cdr = 1;
else
update_cdr = 0;
tmpoptions=<API key>(chan, "AGENTUPDATECDR");
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Saw variable AGENTUPDATECDR=%s, setting update_cdr to: %d on Channel '%s'.\n",tmpoptions,update_cdr,chan->name);
}
if (<API key>(chan, "AGENTGOODBYE") && !ast_strlen_zero(<API key>(chan, "AGENTGOODBYE"))) {
strcpy(agent_goodbye, <API key>(chan, "AGENTGOODBYE"));
tmpoptions=<API key>(chan, "AGENTGOODBYE");
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Saw variable AGENTGOODBYE=%s, setting agent_goodbye to: %s on Channel '%s'.\n",tmpoptions,agent_goodbye,chan->name);
}
/* End Channel Specific Login Overrides */
if (callbackmode && args.extension) {
parse = args.extension;
args.extension = strsep(&parse, "@");
context = parse;
}
if (!ast_strlen_zero(args.options)) {
if (strchr(args.options, 's')) {
play_announcement = 0;
}
}
if (chan->_state != AST_STATE_UP)
res = ast_answer(chan);
if (!res) {
if (!ast_strlen_zero(args.agent_id))
ast_copy_string(user, args.agent_id, AST_MAX_AGENT);
else
res = ast_app_getdata(chan, "agent-user", user, sizeof(user) - 1, 0);
}
while (!res && (max_login_tries==0 || tries < max_login_tries)) {
tries++;
/* Check for password */
ast_mutex_lock(&agentlock);
p = agents;
while(p) {
if (!strcmp(p->agent, user) && !p->pending)
ast_copy_string(xpass, p->password, sizeof(xpass));
p = p->next;
}
ast_mutex_unlock(&agentlock);
if (!res) {
if (!ast_strlen_zero(xpass))
res = ast_app_getdata(chan, "agent-pass", pass, sizeof(pass) - 1, 0);
else
pass[0] = '\0';
}
errmsg = "agent-incorrect";
#if 0
ast_log(LOG_NOTICE, "user: %s, pass: %s\n", user, pass);
#endif
/* Check again for accuracy */
ast_mutex_lock(&agentlock);
p = agents;
while(p) {
ast_mutex_lock(&p->lock);
if (!strcmp(p->agent, user) &&
!strcmp(p->password, pass) && !p->pending) {
login_state = 1; /* Successful Login */
/* Ensure we can't be gotten until we're done */
gettimeofday(&p->lastdisc, NULL);
p->lastdisc.tv_sec++;
/* Set Channel Specific Agent Overrides */
if (<API key>(chan, "AGENTACKCALL") && strlen(<API key>(chan, "AGENTACKCALL"))) {
if (!strcasecmp(<API key>(chan, "AGENTACKCALL"), "always"))
p->ackcall = 2;
else if (ast_true(<API key>(chan, "AGENTACKCALL")))
p->ackcall = 1;
else
p->ackcall = 0;
tmpoptions=<API key>(chan, "AGENTACKCALL");
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Saw variable AGENTACKCALL=%s, setting ackcall to: %d for Agent '%s'.\n",tmpoptions,p->ackcall,p->agent);
}
if (<API key>(chan, "AGENTAUTOLOGOFF") && strlen(<API key>(chan, "AGENTAUTOLOGOFF"))) {
p->autologoff = atoi(<API key>(chan, "AGENTAUTOLOGOFF"));
if (p->autologoff < 0)
p->autologoff = 0;
tmpoptions=<API key>(chan, "AGENTAUTOLOGOFF");
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Saw variable AGENTAUTOLOGOFF=%s, setting autologff to: %d for Agent '%s'.\n",tmpoptions,p->autologoff,p->agent);
}
if (<API key>(chan, "AGENTWRAPUPTIME") && strlen(<API key>(chan, "AGENTWRAPUPTIME"))) {
p->wrapuptime = atoi(<API key>(chan, "AGENTWRAPUPTIME"));
if (p->wrapuptime < 0)
p->wrapuptime = 0;
tmpoptions=<API key>(chan, "AGENTWRAPUPTIME");
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Saw variable AGENTWRAPUPTIME=%s, setting wrapuptime to: %d for Agent '%s'.\n",tmpoptions,p->wrapuptime,p->agent);
}
/* End Channel Specific Agent Overrides */
if (!p->chan) {
char last_loginchan[80] = "";
long logintime;
snprintf(agent, sizeof(agent), "Agent/%s", p->agent);
if (callbackmode) {
int pos = 0;
/* Retrieve login chan */
for (;;) {
if (!ast_strlen_zero(args.extension)) {
ast_copy_string(tmpchan, args.extension, sizeof(tmpchan));
res = 0;
} else
res = ast_app_getdata(chan, "agent-newlocation", tmpchan+pos, sizeof(tmpchan) - 2, 0);
if (ast_strlen_zero(tmpchan) || <API key>(chan, !ast_strlen_zero(context) ? context : "default", tmpchan,
1, NULL))
break;
if (args.extension) {
ast_log(LOG_WARNING, "Extension '%s' is not valid for automatic login of agent '%s'\n", args.extension, p->agent);
args.extension = NULL;
pos = 0;
} else {
ast_log(LOG_WARNING, "Extension '%s@%s' is not valid for automatic login of agent '%s'\n", tmpchan, !ast_strlen_zero(context) ? context : "default", p->agent);
res = ast_streamfile(chan, "invalid", chan->language);
if (!res)
res = ast_waitstream(chan, AST_DIGIT_ANY);
if (res > 0) {
tmpchan[0] = res;
tmpchan[1] = '\0';
pos = 1;
} else {
tmpchan[0] = '\0';
pos = 0;
}
}
}
args.extension = tmpchan;
if (!res) {
set_agentbycallerid(p->logincallerid, NULL);
if (!ast_strlen_zero(context) && !ast_strlen_zero(tmpchan))
snprintf(p->loginchan, sizeof(p->loginchan), "%s@%s", tmpchan, context);
else {
ast_copy_string(last_loginchan, p->loginchan, sizeof(last_loginchan));
ast_copy_string(p->loginchan, tmpchan, sizeof(p->loginchan));
}
p->acknowledged = 0;
if (ast_strlen_zero(p->loginchan)) {
login_state = 2;
filename = "agent-loggedoff";
} else {
if (chan->cid.cid_num) {
ast_copy_string(p->logincallerid, chan->cid.cid_num, sizeof(p->logincallerid));
set_agentbycallerid(p->logincallerid, p->agent);
} else
p->logincallerid[0] = '\0';
}
if(update_cdr && chan->cdr)
snprintf(chan->cdr->channel, sizeof(chan->cdr->channel), "Agent/%s", p->agent);
}
} else {
p->loginchan[0] = '\0';
p->logincallerid[0] = '\0';
p->acknowledged = 0;
}
ast_mutex_unlock(&p->lock);
ast_mutex_unlock(&agentlock);
if( !res && play_announcement==1 )
res = ast_streamfile(chan, filename, chan->language);
if (!res)
ast_waitstream(chan, "");
ast_mutex_lock(&agentlock);
ast_mutex_lock(&p->lock);
if (!res) {
res = ast_set_read_format(chan, ast_best_codec(chan->nativeformats));
if (res)
ast_log(LOG_WARNING, "Unable to set read format to %d\n", ast_best_codec(chan->nativeformats));
}
if (!res) {
res = <API key>(chan, ast_best_codec(chan->nativeformats));
if (res)
ast_log(LOG_WARNING, "Unable to set write format to %d\n", ast_best_codec(chan->nativeformats));
}
/* Check once more just in case */
if (p->chan)
res = -1;
if (callbackmode && !res) {
/* Just say goodbye and be done with it */
if (!ast_strlen_zero(p->loginchan)) {
if (p->loginstart == 0)
time(&p->loginstart);
manager_event(EVENT_FLAG_AGENT, "Agentcallbacklogin",
"Agent: %s\r\n"
"Loginchan: %s\r\n"
"Uniqueid: %s\r\n",
p->agent, p->loginchan, chan->uniqueid);
ast_queue_log("NONE", chan->uniqueid, agent, "AGENTCALLBACKLOGIN", "%s", p->loginchan);
if (option_verbose > 1)
ast_verbose(VERBOSE_PREFIX_2 "Callback Agent '%s' logged in on %s\n", p->agent, p->loginchan);
<API key>("Agent/%s", p->agent);
} else {
logintime = time(NULL) - p->loginstart;
p->loginstart = 0;
manager_event(EVENT_FLAG_AGENT, "Agentcallbacklogoff",
"Agent: %s\r\n"
"Loginchan: %s\r\n"
"Logintime: %ld\r\n"
"Uniqueid: %s\r\n",
p->agent, last_loginchan, logintime, chan->uniqueid);
ast_queue_log("NONE", chan->uniqueid, agent, "AGENTCALLBACKLOGOFF", "%s|%ld|", last_loginchan, logintime);
if (option_verbose > 1)
ast_verbose(VERBOSE_PREFIX_2 "Callback Agent '%s' logged out\n", p->agent);
<API key>("Agent/%s", p->agent);
}
ast_mutex_unlock(&agentlock);
if (!res)
res = ast_safe_sleep(chan, 500);
ast_mutex_unlock(&p->lock);
if (persistent_agents)
dump_agents();
} else if (!res) {
#ifdef HONOR_MUSIC_CLASS
/* check if the moh class was changed with setmusiconhold */
if (*(chan->musicclass))
ast_copy_string(p->moh, chan->musicclass, sizeof(p->moh));
#endif
ast_moh_start(chan, p->moh);
if (p->loginstart == 0)
time(&p->loginstart);
manager_event(EVENT_FLAG_AGENT, "Agentlogin",
"Agent: %s\r\n"
"Channel: %s\r\n"
"Uniqueid: %s\r\n",
p->agent, chan->name, chan->uniqueid);
if (update_cdr && chan->cdr)
snprintf(chan->cdr->channel, sizeof(chan->cdr->channel), "Agent/%s", p->agent);
ast_queue_log("NONE", chan->uniqueid, agent, "AGENTLOGIN", "%s", chan->name);
if (option_verbose > 1)
ast_verbose(VERBOSE_PREFIX_2 "Agent '%s' logged in (format %s/%s)\n", p->agent,
ast_getformatname(chan->readformat), ast_getformatname(chan->writeformat));
/* Login this channel and wait for it to
go away */
p->chan = chan;
if (p->ackcall > 1)
check_beep(p, 0);
else
check_availability(p, 0);
ast_mutex_unlock(&p->lock);
ast_mutex_unlock(&agentlock);
<API key>("Agent/%s", p->agent);
while (res >= 0) {
ast_mutex_lock(&p->lock);
if (!p->loginstart && p->chan)
ast_softhangup(p->chan, <API key>);
if (p->chan != chan)
res = -1;
ast_mutex_unlock(&p->lock);
/* Yield here so other interested threads can kick in. */
sched_yield();
if (res)
break;
ast_mutex_lock(&agentlock);
ast_mutex_lock(&p->lock);
if (p->lastdisc.tv_sec) {
if (ast_tvdiff_ms(ast_tvnow(), p->lastdisc) > 0) {
if (option_debug)
ast_log(LOG_DEBUG, "Wrapup time for %s expired!\n", p->agent);
p->lastdisc = ast_tv(0, 0);
if (p->ackcall > 1)
check_beep(p, 0);
else
check_availability(p, 0);
}
}
ast_mutex_unlock(&p->lock);
ast_mutex_unlock(&agentlock);
/* Synchronize channel ownership between call to agent and itself. */
ast_mutex_lock( &p->app_lock );
ast_mutex_lock(&p->lock);
p->owning_app = pthread_self();
ast_mutex_unlock(&p->lock);
if (p->ackcall > 1)
res = agent_ack_sleep(p);
else
res = <API key>( chan, 1000,
agent_cont_sleep, p );
ast_mutex_unlock( &p->app_lock );
if ((p->ackcall > 1) && (res == 1)) {
ast_mutex_lock(&agentlock);
ast_mutex_lock(&p->lock);
check_availability(p, 0);
ast_mutex_unlock(&p->lock);
ast_mutex_unlock(&agentlock);
res = 0;
}
sched_yield();
}
ast_mutex_lock(&p->lock);
if (res && p->owner)
ast_log(LOG_WARNING, "Huh? We broke out when there was still an owner?\n");
/* Log us off if appropriate */
if (p->chan == chan)
p->chan = NULL;
p->acknowledged = 0;
logintime = time(NULL) - p->loginstart;
p->loginstart = 0;
ast_mutex_unlock(&p->lock);
manager_event(EVENT_FLAG_AGENT, "Agentlogoff",
"Agent: %s\r\n"
"Logintime: %ld\r\n"
"Uniqueid: %s\r\n",
p->agent, logintime, chan->uniqueid);
ast_queue_log("NONE", chan->uniqueid, agent, "AGENTLOGOFF", "%s|%ld", chan->name, logintime);
if (option_verbose > 1)
ast_verbose(VERBOSE_PREFIX_2 "Agent '%s' logged out\n", p->agent);
/* If there is no owner, go ahead and kill it now */
<API key>("Agent/%s", p->agent);
if (p->dead && !p->owner) {
ast_mutex_destroy(&p->lock);
ast_mutex_destroy(&p->app_lock);
free(p);
}
}
else {
ast_mutex_unlock(&p->lock);
p = NULL;
}
res = -1;
} else {
ast_mutex_unlock(&p->lock);
errmsg = "agent-alreadyon";
p = NULL;
}
break;
}
ast_mutex_unlock(&p->lock);
p = p->next;
}
if (!p)
ast_mutex_unlock(&agentlock);
if (!res && (max_login_tries==0 || tries < max_login_tries))
res = ast_app_getdata(chan, errmsg, user, sizeof(user) - 1, 0);
}
if (!res)
res = ast_safe_sleep(chan, 500);
/* AgentLogin() exit */
if (!callbackmode) {
LOCAL_USER_REMOVE(u);
return -1;
}
/* AgentCallbackLogin() exit*/
else {
/* Set variables */
if (login_state > 0) {
<API key>(chan, "AGENTNUMBER", user);
if (login_state==1) {
<API key>(chan, "AGENTSTATUS", "on");
<API key>(chan, "AGENTEXTEN", args.extension);
}
else {
<API key>(chan, "AGENTSTATUS", "off");
}
}
else {
<API key>(chan, "AGENTSTATUS", "fail");
}
if (<API key>(chan, chan->context, chan->exten, chan->priority + 1, chan->cid.cid_num)) {
LOCAL_USER_REMOVE(u);
return 0;
}
/* Do we need to play agent-goodbye now that we will be hanging up? */
if (play_announcement) {
if (!res)
res = ast_safe_sleep(chan, 1000);
res = ast_streamfile(chan, agent_goodbye, chan->language);
if (!res)
res = ast_waitstream(chan, "");
if (!res)
res = ast_safe_sleep(chan, 1000);
}
}
LOCAL_USER_REMOVE(u);
/* We should never get here if next priority exists when in callbackmode */
return -1;
}
/**
* Called by the AgentLogin application (from the dial plan).
*
* @param chan
* @param data
* @returns
* @sa callback_login_exec(), <API key>(), load_module().
*/
static int login_exec(struct ast_channel *chan, void *data)
{
return __login_exec(chan, data, 0);
}
/**
* Called by the AgentCallbackLogin application (from the dial plan).
*
* @param chan
* @param data
* @returns
* @sa login_exec(), <API key>(), load_module().
*/
static int callback_exec(struct ast_channel *chan, void *data)
{
return __login_exec(chan, data, 1);
}
/**
* Sets an agent as logged in by callback in the Manager API.
* It is registered on load_module() and it gets called by the manager backend.
* @param s
* @param m
* @returns
* @sa action_agents(), action_agent_logoff(), load_module().
*/
static int <API key>(struct mansession *s, struct message *m)
{
char *agent = astman_get_header(m, "Agent");
char *exten = astman_get_header(m, "Exten");
char *context = astman_get_header(m, "Context");
char *wrapuptime_s = astman_get_header(m, "WrapupTime");
char *ackcall_s = astman_get_header(m, "AckCall");
struct agent_pvt *p;
int login_state = 0;
if (ast_strlen_zero(agent)) {
astman_send_error(s, m, "No agent specified");
return 0;
}
if (ast_strlen_zero(exten)) {
astman_send_error(s, m, "No extension specified");
return 0;
}
ast_mutex_lock(&agentlock);
p = agents;
while(p) {
if (strcmp(p->agent, agent) || p->pending) {
p = p->next;
continue;
}
if (p->chan) {
login_state = 2; /* already logged in (and on the phone)*/
break;
}
ast_mutex_lock(&p->lock);
login_state = 1; /* Successful Login */
if (ast_strlen_zero(context))
ast_copy_string(p->loginchan, exten, sizeof(p->loginchan));
else
snprintf(p->loginchan, sizeof(p->loginchan), "%s@%s", exten, context);
if (!ast_strlen_zero(wrapuptime_s)) {
p->wrapuptime = atoi(wrapuptime_s);
if (p->wrapuptime < 0)
p->wrapuptime = 0;
}
if (ast_true(ackcall_s))
p->ackcall = 1;
else
p->ackcall = 0;
if (p->loginstart == 0)
time(&p->loginstart);
manager_event(EVENT_FLAG_AGENT, "Agentcallbacklogin",
"Agent: %s\r\n"
"Loginchan: %s\r\n",
p->agent, p->loginchan);
ast_queue_log("NONE", "NONE", agent, "AGENTCALLBACKLOGIN", "%s", p->loginchan);
if (option_verbose > 1)
ast_verbose(VERBOSE_PREFIX_2 "Callback Agent '%s' logged in on %s\n", p->agent, p->loginchan);
<API key>("Agent/%s", p->agent);
ast_mutex_unlock(&p->lock);
p = p->next;
if (persistent_agents)
dump_agents();
}
ast_mutex_unlock(&agentlock);
if (login_state == 1)
astman_send_ack(s, m, "Agent logged in");
else if (login_state == 0)
astman_send_error(s, m, "No such agent");
else if (login_state == 2)
astman_send_error(s, m, "Agent already logged in");
return 0;
}
/**
* Called by the <API key> application (from the dial plan).
*
* @param chan
* @param data
* @returns
* @sa login_exec(), callback_login_exec(), load_module().
*/
static int <API key>(struct ast_channel *chan, void *data)
{
int exitifnoagentid = 0;
int nowarnings = 0;
int changeoutgoing = 0;
int res = 0;
char agent[AST_MAX_AGENT], *tmp;
if (data) {
if (strchr(data, 'd'))
exitifnoagentid = 1;
if (strchr(data, 'n'))
nowarnings = 1;
if (strchr(data, 'c'))
changeoutgoing = 1;
}
if (chan->cid.cid_num) {
char agentvar[AST_MAX_BUF];
snprintf(agentvar, sizeof(agentvar), "%s_%s", GETAGENTBYCALLERID, chan->cid.cid_num);
if ((tmp = <API key>(NULL, agentvar))) {
struct agent_pvt *p = agents;
ast_copy_string(agent, tmp, sizeof(agent));
ast_mutex_lock(&agentlock);
while (p) {
if (!strcasecmp(p->agent, tmp)) {
if (changeoutgoing) snprintf(chan->cdr->channel, sizeof(chan->cdr->channel), "Agent/%s", p->agent);
<API key>(chan, p, 1);
break;
}
p = p->next;
}
ast_mutex_unlock(&agentlock);
} else {
res = -1;
if (!nowarnings)
ast_log(LOG_WARNING, "Couldn't find the global variable %s, so I can't figure out which agent (if it's an agent) is placing outgoing call.\n", agentvar);
}
} else {
res = -1;
if (!nowarnings)
ast_log(LOG_WARNING, "There is no callerid on that call, so I can't figure out which agent (if it's an agent) is placing outgoing call.\n");
}
/* check if there is n + 101 priority */
if (res) {
if (<API key>(chan, chan->context, chan->exten, chan->priority + 101, chan->cid.cid_num)) {
chan->priority+=100;
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Going to %d priority because there is no callerid or the agentid cannot be found.\n",chan->priority);
}
else if (exitifnoagentid)
return res;
}
return 0;
}
/**
* Dump AgentCallbackLogin agents to the database for persistence
*/
static void dump_agents(void)
{
struct agent_pvt *cur_agent = NULL;
char buf[256];
for (cur_agent = agents; cur_agent; cur_agent = cur_agent->next) {
if (cur_agent->chan)
continue;
if (!ast_strlen_zero(cur_agent->loginchan)) {
snprintf(buf, sizeof(buf), "%s;%s", cur_agent->loginchan, cur_agent->logincallerid);
if (ast_db_put(pa_family, cur_agent->agent, buf))
ast_log(LOG_WARNING, "failed to create persistent entry!\n");
else if (option_debug)
ast_log(LOG_DEBUG, "Saved Agent: %s on %s\n", cur_agent->agent, cur_agent->loginchan);
} else {
/* Delete - no agent or there is an error */
ast_db_del(pa_family, cur_agent->agent);
}
}
}
/**
* Reload the persistent agents from astdb.
*/
static void reload_agents(void)
{
char *agent_num;
struct ast_db_entry *db_tree;
struct ast_db_entry *entry;
struct agent_pvt *cur_agent;
char agent_data[256];
char *parse;
char *agent_chan;
char *agent_callerid;
db_tree = ast_db_gettree(pa_family, NULL);
ast_mutex_lock(&agentlock);
for (entry = db_tree; entry; entry = entry->next) {
agent_num = entry->key + strlen(pa_family) + 2;
cur_agent = agents;
while (cur_agent) {
ast_mutex_lock(&cur_agent->lock);
if (strcmp(agent_num, cur_agent->agent) == 0)
break;
ast_mutex_unlock(&cur_agent->lock);
cur_agent = cur_agent->next;
}
if (!cur_agent) {
ast_db_del(pa_family, agent_num);
continue;
} else
ast_mutex_unlock(&cur_agent->lock);
if (!ast_db_get(pa_family, agent_num, agent_data, sizeof(agent_data)-1)) {
if (option_debug)
ast_log(LOG_DEBUG, "Reload Agent: %s on %s\n", cur_agent->agent, agent_data);
parse = agent_data;
agent_chan = strsep(&parse, ";");
agent_callerid = strsep(&parse, ";");
ast_copy_string(cur_agent->loginchan, agent_chan, sizeof(cur_agent->loginchan));
if (agent_callerid) {
ast_copy_string(cur_agent->logincallerid, agent_callerid, sizeof(cur_agent->logincallerid));
set_agentbycallerid(cur_agent->logincallerid, cur_agent->agent);
} else
cur_agent->logincallerid[0] = '\0';
if (cur_agent->loginstart == 0)
time(&cur_agent->loginstart);
<API key>("Agent/%s", cur_agent->agent);
}
}
ast_mutex_unlock(&agentlock);
if (db_tree) {
ast_log(LOG_NOTICE, "Agents successfully reloaded from database.\n");
ast_db_freetree(db_tree);
}
}
static int agent_devicestate(void *data)
{
struct agent_pvt *p;
char *s;
ast_group_t groupmatch;
int groupoff;
int waitforagent=0;
int res = AST_DEVICE_INVALID;
s = data;
if ((s[0] == '@') && (sscanf(s + 1, "%d", &groupoff) == 1)) {
groupmatch = (1 << groupoff);
} else if ((s[0] == ':') && (sscanf(s + 1, "%d", &groupoff) == 1)) {
groupmatch = (1 << groupoff);
waitforagent = 1;
} else {
groupmatch = 0;
}
/* Check actual logged in agents first */
ast_mutex_lock(&agentlock);
p = agents;
while(p) {
ast_mutex_lock(&p->lock);
if (!p->pending && ((groupmatch && (p->group & groupmatch)) || !strcmp(data, p->agent))) {
if (p->owner) {
if (res != AST_DEVICE_INUSE)
res = AST_DEVICE_BUSY;
} else {
if (res == AST_DEVICE_BUSY)
res = AST_DEVICE_INUSE;
if (p->chan || !ast_strlen_zero(p->loginchan)) {
if (res == AST_DEVICE_INVALID)
res = AST_DEVICE_UNKNOWN;
} else if (res == AST_DEVICE_INVALID)
res = <API key>;
}
if (!strcmp(data, p->agent)) {
ast_mutex_unlock(&p->lock);
break;
}
}
ast_mutex_unlock(&p->lock);
p = p->next;
}
ast_mutex_unlock(&agentlock);
return res;
}
/**
* Initialize the Agents module.
* This function is being called by Asterisk when loading the module. Among other thing it registers applications, cli commands and reads the cofiguration file.
*
* @returns int Always 0.
*/
int load_module()
{
/* Make sure we can register our agent channel type */
if (<API key>(&agent_tech)) {
ast_log(LOG_ERROR, "Unable to register channel class %s\n", channeltype);
return -1;
}
/* Dialplan applications */
<API key>(app, login_exec, synopsis, descrip);
<API key>(app2, callback_exec, synopsis2, descrip2);
<API key>(app3, <API key>, synopsis3, descrip3);
/* Manager commands */
<API key>("Agents", EVENT_FLAG_AGENT, action_agents, "Lists agents and their status", mandescr_agents);
<API key>("AgentLogoff", EVENT_FLAG_AGENT, action_agent_logoff, "Sets an agent as no longer logged in", <API key>);
<API key>("AgentCallbackLogin", EVENT_FLAG_AGENT, <API key>, "Sets an agent as logged in by callback", <API key>);
/* CLI Application */
ast_cli_register(&cli_show_agents);
ast_cli_register(&cli_agent_logoff);
/* Read in the config */
read_agent_config();
if (persistent_agents)
reload_agents();
return 0;
}
int reload()
{
read_agent_config();
if (persistent_agents)
reload_agents();
return 0;
}
int unload_module()
{
struct agent_pvt *p;
/* First, take us out of the channel loop */
/* Unregister CLI application */
ast_cli_unregister(&cli_show_agents);
ast_cli_unregister(&cli_agent_logoff);
/* Unregister dialplan applications */
<API key>(app);
<API key>(app2);
<API key>(app3);
/* Unregister manager command */
<API key>("Agents");
<API key>("AgentLogoff");
<API key>("AgentCallbackLogin");
/* Unregister channel */
<API key>(&agent_tech);
if (!ast_mutex_lock(&agentlock)) {
/* Hangup all interfaces if they have an owner */
p = agents;
while(p) {
if (p->owner)
ast_softhangup(p->owner, <API key>);
p = p->next;
}
agents = NULL;
ast_mutex_unlock(&agentlock);
} else {
ast_log(LOG_WARNING, "Unable to lock the monitor\n");
return -1;
}
return 0;
}
int usecount()
{
return usecnt;
}
char *key()
{
return ASTERISK_GPL_KEY;
}
char *description()
{
return (char *) desc;
} |
<amd-dependency path="../module"/>
import IRootScope = require("../../interfaces/IRootScope/interface");
import constants = require("../../common/constants/config");
import IEventingService = require("../../services/eventing-service/service");
export module app.configuration {
"use strict";
export class Runner {
static $inject = [ "$rootScope", "$state", "$stateParams", "$location", "EventingService" ];
static instance(
$rootScope: IRootScope.app.interfaces.IRootScopeService,
$state: angular.ui.IStateService,
$stateParams: angular.ui.IStateParamsService,
$location: angular.ILocationService,
EventingService: IEventingService.app.services.IEventingService): angular.IDirective {
return new Runner($rootScope, $state, $stateParams, $location, EventingService);
}
constructor(
$rootScope: IRootScope.app.interfaces.IRootScopeService,
$state: angular.ui.IStateService,
$stateParams: angular.ui.IStateParamsService,
$location: angular.ILocationService,
EventingService: IEventingService.app.services.IEventingService) {
$rootScope.$state = $state;
$rootScope.$stateParams = $stateParams;
/*$rootScope.$on("$stateChangeSuccess", (event, current, toParams, from, fromParams) => {
window.document.title = current.data.PageTitle;
if(constants.app.configuration.Constants.config.<API key>){
window.ga("send", "pageview", { page: $location.url() });
}
});*/
EventingService.subscribe(
$rootScope,
"$stateChangeSuccess",
(event: ng.IAngularEvent,
current,
toParams,
from,
fromParams) => {
window.document.title = current.data.PageTitle;
if(constants.app.configuration.Constants.config.<API key>){
window.ga("send", "pageview", { page: $location.url() });
}
}
);
/*$rootScope.$on("$stateChangeStart", (event, toState, toParams, fromState, fromParams, error) => {
if ($rootScope.stateChangeBypass) {
$rootScope.stateChangeBypass = false;
return;
}
event.preventDefault();
$rootScope.stateChangeBypass = true;
this._updateToState(toState, toParams, $rootScope);
$state.go(toState, toParams);
});*/
EventingService.subscribe(
$rootScope,
"$stateChangeStart",
(event: ng.IAngularEvent,
toState,
toParams,
fromState,
fromParams,
error) => {
if ($rootScope.stateChangeBypass) {
$rootScope.stateChangeBypass = false;
return;
}
event.preventDefault();
$rootScope.stateChangeBypass = true;
this._updateToState(toState, toParams, $rootScope);
$state.go(toState, toParams);
}
);
}
private _updateToState(toState, toParams, rootScope): void {
toState.data.PostID = (!angular.isDefined(toParams.ItemID)) ? "" : toParams.ItemID;
toState.data.PostName = (!angular.isDefined(toParams.ItemPath)) ? "" : toParams.ItemPath.split("/")[1];
toState.data.CategoryID = (!angular.isDefined(toParams.CategoryID)) ? "" : toParams.CategoryID;
toState.data.Key = (!angular.isDefined(toParams.Key)) ? toState.data.Key : toParams.Key;
rootScope.IsHomePage = toState.data.IsHomePage;
}
}
} |
<?php
defined('_JEXEC') or die('Restricted access');
?><?php
class acyorderHelper{
var $table = '';
var $pkey = '';
var $groupMap = '';
var $groupVal = '';
function order($down = true){
if($down){
$sign = '>';
$dir = 'ASC';
}else{
$sign = '<';
$dir = 'DESC';
}
$ids = JRequest::getVar( 'cid', array(), '', 'array' );
$id = (int) $ids[0];
$pkey = $this->pkey;
$database = JFactory::getDBO();
$query = 'SELECT a.ordering,a.'.$pkey.' FROM '.acymailing_table($this->table).' as b, '.acymailing_table($this->table).' as a';
$query .= ' WHERE a.ordering '.$sign.' b.ordering AND b.'.$pkey.' = '.$id;
if(!empty($this->groupMap)) $query .= ' AND a.'.$this->groupMap.' = '.$database->Quote($this->groupVal);
$query .= ' ORDER BY a.ordering '.$dir.' LIMIT 1';
$database->setQuery($query);
$secondElement = $database->loadObject();
if(empty($secondElement)) return false;
$firstElement = new stdClass();
$firstElement->$pkey = $id;
$firstElement->ordering = $secondElement->ordering;
if($down)$secondElement->ordering
else $secondElement->ordering++;
$status1 = $database->updateObject(acymailing_table($this->table),$firstElement,$pkey);
$status2 = $database->updateObject(acymailing_table($this->table),$secondElement,$pkey);
$status = $status1 && $status2;
if($status){
$app = JFactory::getApplication();
$app->enqueueMessage(JText::_( 'SUCC_MOVED' ), 'message');
}
return $status;
}
function save(){
$app = JFactory::getApplication();
$pkey = $this->pkey;
$cid = JRequest::getVar( 'cid', array(), 'post', 'array' );
$order = JRequest::getVar( 'order', array(), 'post', 'array' );
JArrayHelper::toInteger($cid);
$database = JFactory::getDBO();
$query = 'SELECT `ordering`,`'.$pkey.'` FROM '.acymailing_table($this->table).' WHERE `'.$pkey.'` NOT IN ('.implode(',',$cid).') ';
if(!empty($this->groupMap)) $query .= ' AND '.$this->groupMap.' = '.$database->Quote($this->groupVal);
$query .= ' ORDER BY `ordering` ASC';
$database->setQuery($query);
$results = $database->loadObjectList($pkey);
$oldResults = $results;
asort($order);
$newOrder = array();
while(!empty($order) OR !empty($results)){
$dbElement = reset($results);
if(empty($dbElement->ordering) OR (!empty($order) AND reset($order) <= $dbElement->ordering)){
$newOrder[] = $cid[(int)key($order)];
unset($order[key($order)]);
}else{
$newOrder[] = $dbElement->$pkey;
unset($results[$dbElement->$pkey]);
}
}
$i = 1;
$status = true;
$element = new stdClass();
foreach($newOrder as $val){
$element->$pkey = $val;
$element->ordering = $i;
if(!isset($oldResults[$val]) OR $oldResults[$val]->ordering != $i){
$status = $database->updateObject(acymailing_table($this->table),$element,$pkey) && $status;
}
$i++;
}
if($status){
$app->enqueueMessage(JText::_( '<API key>' ), 'message');
}else{
$app->enqueueMessage(JText::_( 'ERROR_ORDERING' ), 'error');
}
return $status;
}
function reOrder(){
$db = JFactory::getDBO();
$query = 'UPDATE '.acymailing_table($this->table).' SET `ordering` = `ordering`+1';
if(!empty($this->groupMap)) $query .= ' WHERE '.$this->groupMap.' = '.$db->Quote($this->groupVal);
$db->setQuery($query);
$db->query();
$query = 'SELECT `ordering`,`'.$this->pkey.'` FROM '.acymailing_table($this->table);
if(!empty($this->groupMap)) $query .= ' WHERE '.$this->groupMap.' = '.$db->Quote($this->groupVal);
$query .= ' ORDER BY `ordering` ASC';
$db->setQuery($query);
$results = $db->loadObjectList();
$i = 1;
foreach($results as $oneResult){
if($oneResult->ordering != $i){
$oneResult->ordering = $i;
$db->updateObject( acymailing_table($this->table), $oneResult, $this->pkey);
}
$i++;
}
}
} |
#ifndef HF_H
#define HF_H
#include <vector>
#include "psi4/libpsio/psio.hpp"
#include "psi4/libmints/wavefunction.h"
#include "psi4/libmints/basisset.h"
#include "psi4/libmints/vector.h"
#include "psi4/libdiis/diismanager.h"
#include "psi4/libdiis/diisentry.h"
#include "psi4/psi4-dec.h"
#include "psi4/libqt/qt.h"
namespace psi {
class Matrix;
class Vector;
class SimpleVector;
class TwoBodySOInt;
class JK;
class MinimalInterface;
class SOSCF;
class PCM;
class SuperFunctional;
class VBase;
namespace scf {
class HF : public Wavefunction {
protected:
The kinetic energy matrix
SharedMatrix T_;
The 1e potential energy matrix
SharedMatrix V_;
The DFT potential matrices (nice naming scheme)
SharedMatrix Va_;
SharedMatrix Vb_;
The orthogonalization matrix (symmetric or canonical)
SharedMatrix X_;
Temporary matrix for diagonalize_F
SharedMatrix diag_temp_;
Temporary matrix for diagonalize_F
SharedMatrix diag_F_temp_;
Temporary matrix for diagonalize_F
SharedMatrix diag_C_temp_;
Old C Alpha matrix (if needed for MOM)
SharedMatrix Ca_old_;
Old C Beta matrix (if needed for MOM)
SharedMatrix Cb_old_;
User defined orbitals
SharedMatrix guess_Ca_;
SharedMatrix guess_Cb_;
Energy convergence threshold
double energy_threshold_;
Density convergence threshold
double density_threshold_;
Previous iteration's energy and current energy
double Eold_;
double E_;
Table of energy components
std::map<std::string, double> energies_;
Basis list for SAD
std::vector<std::shared_ptr<BasisSet>> sad_basissets_;
std::vector<std::shared_ptr<BasisSet>> <API key>;
The RMS error in the density
double Drms_;
Max number of iterations for HF
int maxiter_;
Fail if we don't converge by maxiter?
bool ref_C_;
Fail if we don't converge by maxiter?
bool fail_on_maxiter_;
Current Iteration
int iteration_;
Did the SCF converge?
bool converged_;
Nuclear repulsion energy
double nuclearrep_;
Whether DIIS was performed this iteration, or not
bool diis_performed_;
DOCC vector from input (if found)
bool input_docc_;
SOCC vector from input (if found)
bool input_socc_;
Whether its broken symmetry solution or not
bool broken_symmetry_;
//Initial SAD doubly occupied may be more than ndocc
// int sad_nocc_[8];
Dimension original_doccpi_;
Dimension original_soccpi_;
int original_nalpha_;
int original_nbeta_;
bool reset_occ_;
Mapping arrays
int *so2symblk_;
int *so2index_;
SCF algorithm type
std::string scf_type_;
Old SCF type for DF guess trick
TODO We should really get rid of that and put it in the driver
std::string old_scf_type_;
Perturb the Hamiltonian?
int perturb_h_;
How big of a perturbation
Vector3 perturb_dipoles_;
With what...
enum perturb { nothing, dipole_x, dipole_y, dipole_z, dipole, embpot, dx, sphere };
perturb perturb_;
The value below which integrals are neglected
double integral_threshold_;
The soon to be ubiquitous JK object
std::shared_ptr<JK> jk_;
Are we to do MOM?
bool MOM_enabled_;
Are we to do excited-state MOM?
bool MOM_excited_;
MOM started?
bool MOM_started_;
MOM performed?
bool MOM_performed_;
Are we to fractionally occupy?
bool frac_enabled_;
Frac started? (Same thing as frac_performed_)
bool frac_performed_;
DIIS manager intiialized?
bool <API key>;
DIIS manager for all SCF wavefunctions
std::shared_ptr<DIISManager> diis_manager_;
How many min vectors for DIIS
int min_diis_vectors_;
How many max vectors for DIIS
int max_diis_vectors_;
When do we start collecting vectors for DIIS
int diis_start_;
Are we even using DIIS?
int diis_enabled_;
Are we doing second-order convergence acceleration?
bool soscf_enabled_;
What is the gradient threshold that we should start?
double soscf_r_start_;
Maximum number of iterations
int soscf_min_iter_;
Minimum number of iterations
int soscf_max_iter_;
Break if the residual RMS is less than this
double soscf_conv_;
Do we print the microiterations?
double soscf_print_;
The amount (%) of the previous orbitals to mix in during SCF damping
double damping_percentage_;
The energy convergence at which SCF damping is disabled
double <API key>;
Whether to use SCF damping
bool damping_enabled_;
Whether damping was actually performed this iteration
bool damping_performed_;
// parameters for hard-sphere potentials
double radius_; // radius of spherical potential
double thickness_; // thickness of spherical barrier
int r_points_; // number of radial integration points
int theta_points_; // number of colatitude integration points
int phi_points_; // number of azimuthal integration points
DFT variables
std::shared_ptr<SuperFunctional> functional_;
std::shared_ptr<VBase> potential_;
public:
Nuclear contributions
Vector <API key>;
Vector <API key>;
The number of iterations needed to reach convergence
int iterations_needed() {return iterations_needed_;}
The JK object (or null if it has been deleted)
std::shared_ptr<JK> jk() const { return jk_; }
The DFT Functional object (or null if it has been deleted)
std::shared_ptr<SuperFunctional> functional() const { return functional_; }
The DFT Potential object (or null if it has been deleted)
std::shared_ptr<VBase> V_potential() const { return potential_; }
The RMS error in the density
double rms_density_error() {return Drms_;}
Returns the occupation vectors
std::shared_ptr<Vector> occupation_a() const;
std::shared_ptr<Vector> occupation_b() const;
// PCM interface
bool pcm_enabled_;
std::shared_ptr<PCM> hf_pcm_;
protected:
Formation of H is the same regardless of RHF, ROHF, UHF
// Temporarily converting to virtual function for testing embedding
// potentials. TDC, 5/23/12.
virtual void form_H();
Formation of S^+1/2 and S^-1/2 are the same
void form_Shalf();
Edit matrices if we are doing canonical orthogonalization
virtual void <API key>() { return; }
Prints the orbital occupation
void print_occupation();
Common initializer
void common_init();
Figure out how to occupy the orbitals in the absence of DOCC and SOCC
void find_occupation();
Maximum overlap method for prevention of oscillation/excited state SCF
void MOM();
Start the MOM algorithm (requires one iteration worth of setup)
void MOM_start();
Fractional occupation UHF/UKS
void frac();
Renormalize orbitals to 1.0 before saving
void frac_renormalize();
Check the stability of the wavefunction, and correct (if requested)
virtual bool stability_analysis();
void <API key>(std::vector<std::pair<double, int> > &vec);
Determine how many core and virtual orbitals to freeze
void compute_fcpi();
void compute_fvpi();
Prints the orbitals energies and symmetries (helper method)
void print_orbitals(const char* header, std::vector<std::pair<double,
std::pair<const char*, int> > > orbs);
Prints the orbitals in arbitrary order (works with MOM)
void print_orbitals();
Prints the energy breakdown from this SCF
void print_energies();
Prints some opening information
void print_header();
Prints some details about nsopi/nmopi, and initial occupations
void print_preiterations();
Do any needed integral setup
virtual void integrals();
Which set of iterations we're on in this computation, e.g., for stability
analysis, where we want to retry SCF without going through all of the setup
int attempt_number_;
Maximum number of macroiterations to take in e.g. a stability analysis
int max_attempts_;
The number of electrons
int nelectron_;
The charge of the system
int charge_;
The multiplicity of the system (specified as 2 Ms + 1)
int multiplicity_;
The number of iterations need to reach convergence
int iterations_needed_;
Compute energy for the iteration.
virtual double compute_E() = 0;
Save the current density and energy.
virtual void <API key>() = 0;
Check MO phases
void check_phases();
SAD Guess and propagation
void compute_SAD_guess();
Reset to regular occupation from the fractional occupation
void reset_occupation();
Form the guess (gaurantees C, D, and E)
virtual void guess();
/** Applies damping to the density update */
virtual void damp_update();
/** Applies second-order convergence acceleration */
virtual int soscf_update();
/** Rotates orbitals inplace C' = exp(U) C, U = antisymmetric matrix from x */
void rotate_orbitals(SharedMatrix C, const SharedMatrix x);
/** Transformation, diagonalization, and backtransform of Fock matrix */
virtual void diagonalize_F(const SharedMatrix& F, SharedMatrix& C, std::shared_ptr<Vector>& eps);
/** Computes the Fock matrix */
virtual void form_F() =0;
/** Computes the initial MO coefficients (default is to call form_C) */
virtual void form_initial_C() { form_C(); }
/** Forms the G matrix */
virtual void form_G() =0;
/** Computes the initial energy. */
virtual double compute_initial_E() { return 0.0; }
/** Test convergence of the wavefunction */
virtual bool test_convergency() { return false; }
/** Compute/print spin contamination information (if unrestricted) **/
virtual void <API key>();
/** Saves information to the checkpoint file */
virtual void save_information() {}
/** Compute the orbital gradient */
virtual void <API key>(bool) {}
/** Performs DIIS extrapolation */
virtual bool diis() { return false; }
/** Form Fia (for DIIS) **/
virtual SharedMatrix form_Fia(SharedMatrix Fso, SharedMatrix Cso, int* noccpi);
/** Form X'(FDS - SDF)X (for DIIS) **/
virtual SharedMatrix form_FDSmSDF(SharedMatrix Fso, SharedMatrix Dso);
/** Performs any operations required for a incoming guess **/
virtual void format_guess();
/** Save orbitals to use later as a guess **/
// virtual void save_orbitals();
/** Tells whether or not to read Fock matrix as a guess **/
// bool do_use_fock_guess();
/** Load fock matrix from previous computation to form guess MO coefficients **/
// virtual void load_fock();
/** Load orbitals from previous computation, projecting if needed **/
// virtual void load_orbitals();
public:
HF(SharedWavefunction ref_wfn, std::shared_ptr<SuperFunctional> funct,
Options& options, std::shared_ptr<PSIO> psio);
virtual ~HF();
Specialized initialization, compute integrals and does everything to prepare for iterations
virtual void initialize();
Performs the actual SCF iterations
virtual void iterations();
Performs stability analysis and calls back SCF with new guess if needed,
Returns the SCF energy
This function should be called once orbitals are ready for energy/property computations,
usually after iterations() is called.
virtual double finalize_E();
Base class Wavefunction requires this function. Here it is simply a wrapper around
initialize(), iterations(), finalize_E(). It returns the SCF energy computed by
finalize_E()
virtual double compute_energy();
Clears memory and closes files (Should they be open) prior to correlated code execution
Derived classes override it for additional operations and then call HF::finalize()
virtual void finalize();
Semicanonicalizes ROHF/CUHF orbitals, breaking the alpha-beta degeneracy
On entrance, there's only one set of orbitals and orbital energies. On
exit, the alpha and beta Fock matrices correspond to those in the semicanonical
basis, and there are distinct alpha and beta C and epsilons, also in the
semicanonical basis.
virtual void semicanonicalize();
Compute the MO coefficients (C_)
virtual void form_C();
Computes the density matrix (D_)
virtual void form_D();
Computes the density matrix (V_)
virtual void form_V();
// Return the DFT potenitals
SharedMatrix Va() { return Va_; }
SharedMatrix Vb() { return Vb_; }
// Set guess occupied orbitals, nalpha and nbeta will be taken from the number of passed in eigenvectors
void guess_Ca(SharedMatrix Ca) { guess_Ca_ = Ca; }
void guess_Cb(SharedMatrix Cb) { guess_Cb_ = Cb; }
// Expert option to reset the occuption or not at iteration zero
void reset_occ(bool reset) { reset_occ_ = reset; }
void set_sad_basissets(std::vector<std::shared_ptr<BasisSet>> basis_vec) { sad_basissets_ = basis_vec; }
void <API key>(std::vector<std::shared_ptr<BasisSet>> basis_vec) { <API key> = basis_vec; }
};
}} // Namespaces
#endif |
<?php
/**
* CiviCRM Address Class.
*
* Handles CiviCRM Address functionality.
*
* @package <API key>
* @since 0.4
*/
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
/**
* CiviCRM Profile Sync CiviCRM Address Class.
*
* A class that encapsulates CiviCRM Address functionality.
*
* @since 0.4
*/
class <API key> {
/**
* Plugin object.
*
* @since 0.5
* @access public
* @var object $plugin The plugin object.
*/
public $plugin;
/**
* ACF Loader object.
*
* @since 0.4
* @access public
* @var object $acf_loader The ACF Loader object.
*/
public $acf_loader;
/**
* Parent (calling) object.
*
* @since 0.4
* @access public
* @var object $civicrm The parent object.
*/
public $civicrm;
/**
* "CiviCRM Field" Field value prefix in the ACF Field data.
*
* This distinguishes Address Fields from Custom Fields.
*
* @since 0.5
* @access public
* @var string $<API key> The prefix of the "CiviCRM Field" value.
*/
public $<API key> = 'caiaddress_';
/**
* Public Address Fields.
*
* Mapped to their corresponding ACF Field Types.
*
* @since 0.5
* @access public
* @var array $address_fields The array of public Address Fields.
*/
public $address_fields = [
'is_primary' => 'true_false',
'is_billing' => 'true_false',
'street_address' => 'text',
'<API key>' => 'text',
'<API key>' => 'text',
'<API key>' => 'text',
'city' => 'text',
'county_id' => 'select',
'state_province_id' => 'select',
'country_id' => 'select',
'postal_code' => 'text',
'geo_code_1' => 'text',
'geo_code_2' => 'text',
'name' => 'text',
];
/**
* Address Fields to remove for the Bypass Location Rule.
*
* These are mapped for Post Type Sync, but need to be removed for the
* Bypass Location Rule because they are handled by custom ACF Field Types.
*
* @since 0.5
* @access public
* @var array $bypass_fields The Address Fields to remove for the Bypass Location Rule.
*/
public $<API key> = [
'county_id' => 'select',
'state_province_id' => 'select',
'country_id' => 'select',
];
/**
* Constructor.
*
* @since 0.4
*
* @param object $parent The parent object reference.
*/
public function __construct( $parent ) {
// Store references to objects.
$this->plugin = $parent->acf_loader->plugin;
$this->acf_loader = $parent->acf_loader;
$this->civicrm = $parent;
// Init when the ACF CiviCRM object is loaded.
add_action( 'cwps/acf/civicrm/loaded', [ $this, 'initialise' ] );
}
/**
* Initialise this object.
*
* @since 0.4
*/
public function initialise() {
// Register hooks.
$this->register_hooks();
}
/**
* Register hooks.
*
* @since 0.4
*/
public function register_hooks() {
// Listen for queries from the ACF Bypass class.
add_filter( 'cwps/acf/bypass/<API key>', [ $this, '<API key>' ], 20, 4 );
// Listen for queries from our ACF Field Group class.
add_filter( 'cwps/acf/field_group/field/pre_update', [ $this, '<API key>' ], 10, 2 );
// Some Address "Text" Fields need their own validation.
//add_filter( 'acf/validate_value/type=text', [ $this, 'value_validate' ], 10, 4 );
}
/**
* Gets the CiviCRM Address Fields.
*
* @since 0.5
*
* @param string $filter The token by which to filter the array of Fields.
* @return array $fields The array of Field names.
*/
public function civicrm_fields_get( $filter = 'none' ) {
// Only do this once per Field Type and filter.
static $pseudocache;
if ( isset( $pseudocache[ $filter ] ) ) {
return $pseudocache[ $filter ];
}
// Init return.
$fields = [];
// Try and init CiviCRM.
if ( ! $this->civicrm->is_initialised() ) {
return $fields;
}
// Construct params.
$params = [
'version' => 3,
'options' => [
'limit' => 0, // No limit.
],
];
// Call the API.
$result = civicrm_api( 'Address', 'getfields', $params );
// Override return if we get some.
if ( $result['is_error'] == 0 && ! empty( $result['values'] ) ) {
// Check for no filter.
if ( $filter == 'none' ) {
// Grab all of them.
$fields = $result['values'];
// Check public filter.
} elseif ( $filter == 'public' ) {
// Skip all but those defined in our public Address Fields array.
foreach ( $result['values'] as $key => $value ) {
if ( array_key_exists( $value['name'], $this->address_fields ) ) {
$fields[] = $value;
}
}
}
}
// Maybe add to pseudo-cache.
if ( ! isset( $pseudocache[ $filter ] ) ) {
$pseudocache[ $filter ] = $fields;
}
return $fields;
}
/**
* Get the mapped Address Field name if present.
*
* @since 0.5
*
* @param array $field The existing Field data array.
* @return string|bool $address_field_name The name of the Address Field, or false if none.
*/
public function <API key>( $field ) {
// Init return.
$address_field_name = false;
// Get the ACF CiviCRM Field key.
$acf_field_key = $this->civicrm->acf_field_key_get();
// Set the mapped Address Field name if present.
if ( isset( $field[ $acf_field_key ] ) ) {
if ( false !== strpos( $field[ $acf_field_key ], $this-><API key> ) ) {
$address_field_name = (string) str_replace( $this-><API key>, '', $field[ $acf_field_key ] );
}
}
/**
* Filter the Address Field name.
*
* @since 0.5
*
* @param integer $address_field_name The existing Address Field name.
* @param array $field The array of ACF Field data.
*/
$address_field_name = apply_filters( 'cwps/acf/civicrm/address/address_field/name', $address_field_name, $field );
return $address_field_name;
}
/**
* Appends an array of Setting Field choices for a Bypass ACF Field Group when found.
*
* @since 0.5
*
* @param array $choices The existing Setting Field choices array.
* @param array $field The ACF Field data array.
* @param array $field_group The ACF Field Group data array.
* @param array $entity_array The Entity and ID array.
* @return array|bool $setting_field The Setting Field array if populated, false if conflicting.
*/
public function <API key>( $choices, $field, $field_group, $entity_array ) {
// Pass if a Contact Entity is not present.
if ( ! array_key_exists( 'contact', $entity_array ) ) {
return $choices;
}
// Get the public Fields on the Entity for this Field Type.
$public_fields = $this->civicrm_fields_get( 'public' );
$fields_for_entity = [];
foreach ( $public_fields as $key => $value ) {
if ( $field['type'] == $this->address_fields[ $value['name'] ] ) {
// Skip the ones that are not needed in ACFE Forms.
if ( ! array_key_exists( $value['name'], $this-><API key> ) ) {
$fields_for_entity[] = $value;
}
}
}
// Get the Custom Fields for this Entity.
$custom_fields = $this->plugin->civicrm->custom_field->get_for_entity_type( 'Address', '' );
/**
* Filter the Custom Fields.
*
* @since 0.5
*
* @param array The initially empty array of filtered Custom Fields.
* @param array $custom_fields The CiviCRM Custom Fields array.
* @param array $field The ACF Field data array.
*/
$filtered_fields = apply_filters( 'cwps/acf/query_settings/<API key>', [], $custom_fields, $field );
// Pass if not populated.
if ( empty( $fields_for_entity ) && empty( $filtered_fields ) ) {
return $choices;
}
// Build Address Field choices array for dropdown.
if ( ! empty( $fields_for_entity ) ) {
$<API key> = esc_attr__( 'Address Fields', '<API key>' );
foreach ( $fields_for_entity as $address_field ) {
$choices[ $<API key> ][ $this-><API key> . $address_field['name'] ] = $address_field['title'];
}
}
// Build Custom Field choices array for dropdown.
if ( ! empty( $filtered_fields ) ) {
$custom_field_prefix = $this->civicrm->custom_field_prefix();
foreach ( $filtered_fields as $custom_group_name => $custom_group ) {
$custom_fields_label = esc_attr( $custom_group_name );
foreach ( $custom_group as $custom_field ) {
$choices[ $custom_fields_label ][ $custom_field_prefix . $custom_field['id'] ] = $custom_field['label'];
}
}
}
/**
* Filter the choices to display in the "CiviCRM Field" select.
*
* @since 0.5
*
* @param array $choices The choices for the Setting Field array.
*/
$choices = apply_filters( 'cwps/acf/civicrm/address/civicrm_field/choices', $choices );
// Return populated array.
return $choices;
}
/**
* Modify the Settings of an ACF "Text" Field.
*
* @since 0.5
*
* @param array $field The existing ACF Field data array.
* @param array $field_group The ACF Field Group data array.
* @return array $field The modified ACF Field data array.
*/
public function <API key>( $field, $field_group ) {
// Bail early if not our Field Type.
if ( 'text' !== $field['type'] ) {
return $field;
}
// Skip if the CiviCRM Field key isn't there or isn't populated.
$key = $this->civicrm->acf_field_key_get();
if ( ! array_key_exists( $key, $field ) || empty( $field[ $key ] ) ) {
return $field;
}
// Get the mapped Address Field name if present.
$address_field_name = $this-><API key>( $field );
if ( $address_field_name === false ) {
return $field;
}
// Get Address Field data.
$field_data = $this->plugin->civicrm->address->get_by_name( $address_field_name );
// Set the "maxlength" attribute.
if ( ! empty( $field_data['maxlength'] ) ) {
$field['maxlength'] = $field_data['maxlength'];
}
return $field;
}
/**
* Validate the content of a Field.
*
* Some Address Fields require validation.
*
* @since 0.5
*
* @param bool $valid The existing valid status.
* @param mixed $value The value of the Field.
* @param array $field The Field data array.
* @param string $input The input element's name attribute.
* @return string|bool $valid A string to display a custom error message, boolean otherwise.
*/
public function value_validate( $valid, $value, $field, $input ) {
// Bail if it's not required and is empty.
if ( $field['required'] == '0' && empty( $value ) ) {
return $valid;
}
// Get the mapped Address Field name if present.
$address_field_name = $this-><API key>( $field );
if ( $address_field_name === false ) {
return $valid;
}
// Validate depending on the Field name.
switch ( $address_field_name ) {
case 'duration':
// Must be an integer.
if ( ! ctype_digit( $value ) ) {
$valid = __( 'Must be an integer.', '<API key>' );
}
break;
}
return $valid;
}
// Retained methods to provide backwards compatibility.
/**
* Get the data for an Address.
*
* @since 0.4
*
* @param integer $address_id The numeric ID of the Address.
* @return object|bool $address The Address data object, or false if none.
*/
public function address_get_by_id( $address_id ) {
return $this->plugin->civicrm->address->address_get_by_id( $address_id );
}
/**
* Get the Addresses for a Contact ID.
*
* @since 0.4
*
* @param integer $contact_id The numeric ID of the Contact.
* @return array $addresses The array of data for the Addresses, or empty if none.
*/
public function <API key>( $contact_id ) {
return $this->plugin->civicrm->address-><API key>( $contact_id );
}
} // Class ends. |
var guide={isDoable:true,operations:0,time:0,internalCounter:false,testName:"Conformity Silverlight",testVersion:"2.0",compareScore:1,isConformity:1};var test={init:function(){
return guide},run:function(f,a){var b=0;var e=PluginDetect.getVersion("Silverlight");var d="0.0.0.0";if(e!=null){b=1;d=e.replace(/,/gi,".")}var c={silverlightVersion:d};benchmark.submitResult(b,guide,c)}}; |
# Makefile for building: libenttecdmxusbout.so
# Generated by qmake (2.01a) (Qt 4.7.4) on: Fri Sep 2 17:10:34 2011
# Project: src.pro
# Template: lib
# Command: /usr/bin/qmake -Wnone -o Makefile src.pro
CC = gcc
CXX = g++
DEFINES = -DDBUS_ENABLED -DQT_PLUGIN -DQT_DBUS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
CFLAGS = -m64 -pipe -g -Wall -W -D_REENTRANT -fPIC $(DEFINES)
CXXFLAGS = -m64 -pipe -Werror -g -Wall -W -D_REENTRANT -fPIC $(DEFINES)
INCPATH = -I/usr/share/qt/mkspecs/linux-g++-64 -I. -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include/QtDBus -I/usr/include -I../../interfaces -I.
LINK = g++
LFLAGS = -m64 -Wl,-O1,--sort-common,--as-needed,-z,relro,--hash-style=gnu -shared
LIBS = $(SUBLIBS) -L/usr/lib -lftdi -lusb -lQtDBus -lQtGui -lQtCore -lpthread
AR = ar cqs
RANLIB =
QMAKE = /usr/bin/qmake
TAR = tar -cf
COMPRESS = gzip -9f
COPY = cp -f
SED = sed
COPY_FILE = $(COPY)
COPY_DIR = $(COPY) -r
STRIP = strip
INSTALL_FILE = install -m 644 -p
INSTALL_DIR = $(COPY_DIR)
INSTALL_PROGRAM = install -m 755 -p
DEL_FILE = rm -f
SYMLINK = ln -f -s
DEL_DIR = rmdir
MOVE = mv -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
OBJECTS_DIR = ./
SOURCES = enttecdmxusbwidget.cpp \
enttecdmxusbout.cpp \
enttecdmxusbpro.cpp \
enttecdmxusbopen.cpp \
qlcftdi-libftdi.cpp moc_qlcoutplugin.cpp \
moc_enttecdmxusbout.cpp \
moc_enttecdmxusbpro.cpp \
<API key>.cpp
OBJECTS = enttecdmxusbwidget.o \
enttecdmxusbout.o \
enttecdmxusbpro.o \
enttecdmxusbopen.o \
qlcftdi-libftdi.o \
moc_qlcoutplugin.o \
moc_enttecdmxusbout.o \
moc_enttecdmxusbpro.o \
<API key>.o
DIST = /usr/share/qt/mkspecs/common/g++.conf \
/usr/share/qt/mkspecs/common/unix.conf \
/usr/share/qt/mkspecs/common/linux.conf \
/usr/share/qt/mkspecs/qconfig.pri \
/usr/share/qt/mkspecs/modules/qt_phonon.pri \
/usr/share/qt/mkspecs/modules/qt_webkit_version.pri \
/usr/share/qt/mkspecs/features/qt_functions.prf \
/usr/share/qt/mkspecs/features/qt_config.prf \
/usr/share/qt/mkspecs/features/exclusive_builds.prf \
/usr/share/qt/mkspecs/features/default_pre.prf \
../../../variables.pri \
../../../i18n.pri \
/usr/share/qt/mkspecs/features/debug.prf \
/usr/share/qt/mkspecs/features/default_post.prf \
/usr/share/qt/mkspecs/features/link_pkgconfig.prf \
/usr/share/qt/mkspecs/features/warn_on.prf \
/usr/share/qt/mkspecs/features/qt.prf \
/usr/share/qt/mkspecs/features/moc.prf \
/usr/share/qt/mkspecs/features/dbusinterfaces.prf \
/usr/share/qt/mkspecs/features/dbusadaptors.prf \
/usr/share/qt/mkspecs/features/unix/thread.prf \
/usr/share/qt/mkspecs/features/resources.prf \
/usr/share/qt/mkspecs/features/uic.prf \
/usr/share/qt/mkspecs/features/yacc.prf \
/usr/share/qt/mkspecs/features/lex.prf \
/usr/share/qt/mkspecs/features/include_source_dir.prf \
src.pro
QMAKE_TARGET = enttecdmxusbout
DESTDIR =
TARGET = libenttecdmxusbout.so
TARGETD = libenttecdmxusbout.so
first: all
.SUFFIXES: .o .c .cpp .cc .cxx .C
.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.cc.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.cxx.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.C.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.c.o:
$(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
all: Makefile $(TARGET)
$(TARGET): $(OBJECTS) $(SUBLIBS) $(OBJCOMP) qmfiles
-$(DEL_FILE) $(TARGET)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS) $(OBJCOMP)
Makefile: src.pro /usr/share/qt/mkspecs/linux-g++-64/qmake.conf /usr/share/qt/mkspecs/common/g++.conf \
/usr/share/qt/mkspecs/common/unix.conf \
/usr/share/qt/mkspecs/common/linux.conf \
/usr/share/qt/mkspecs/qconfig.pri \
/usr/share/qt/mkspecs/modules/qt_phonon.pri \
/usr/share/qt/mkspecs/modules/qt_webkit_version.pri \
/usr/share/qt/mkspecs/features/qt_functions.prf \
/usr/share/qt/mkspecs/features/qt_config.prf \
/usr/share/qt/mkspecs/features/exclusive_builds.prf \
/usr/share/qt/mkspecs/features/default_pre.prf \
../../../variables.pri \
../../../i18n.pri \
/usr/share/qt/mkspecs/features/debug.prf \
/usr/share/qt/mkspecs/features/default_post.prf \
/usr/share/qt/mkspecs/features/link_pkgconfig.prf \
/usr/share/qt/mkspecs/features/warn_on.prf \
/usr/share/qt/mkspecs/features/qt.prf \
/usr/share/qt/mkspecs/features/moc.prf \
/usr/share/qt/mkspecs/features/dbusinterfaces.prf \
/usr/share/qt/mkspecs/features/dbusadaptors.prf \
/usr/share/qt/mkspecs/features/unix/thread.prf \
/usr/share/qt/mkspecs/features/resources.prf \
/usr/share/qt/mkspecs/features/uic.prf \
/usr/share/qt/mkspecs/features/yacc.prf \
/usr/share/qt/mkspecs/features/lex.prf \
/usr/share/qt/mkspecs/features/include_source_dir.prf \
/usr/lib/libQtDBus.prl \
/usr/lib/libQtGui.prl \
/usr/lib/libQtCore.prl
$(QMAKE) -Wnone -o Makefile src.pro
/usr/share/qt/mkspecs/common/g++.conf:
/usr/share/qt/mkspecs/common/unix.conf:
/usr/share/qt/mkspecs/common/linux.conf:
/usr/share/qt/mkspecs/qconfig.pri:
/usr/share/qt/mkspecs/modules/qt_phonon.pri:
/usr/share/qt/mkspecs/modules/qt_webkit_version.pri:
/usr/share/qt/mkspecs/features/qt_functions.prf:
/usr/share/qt/mkspecs/features/qt_config.prf:
/usr/share/qt/mkspecs/features/exclusive_builds.prf:
/usr/share/qt/mkspecs/features/default_pre.prf:
../../../variables.pri:
../../../i18n.pri:
/usr/share/qt/mkspecs/features/debug.prf:
/usr/share/qt/mkspecs/features/default_post.prf:
/usr/share/qt/mkspecs/features/link_pkgconfig.prf:
/usr/share/qt/mkspecs/features/warn_on.prf:
/usr/share/qt/mkspecs/features/qt.prf:
/usr/share/qt/mkspecs/features/moc.prf:
/usr/share/qt/mkspecs/features/dbusinterfaces.prf:
/usr/share/qt/mkspecs/features/dbusadaptors.prf:
/usr/share/qt/mkspecs/features/unix/thread.prf:
/usr/share/qt/mkspecs/features/resources.prf:
/usr/share/qt/mkspecs/features/uic.prf:
/usr/share/qt/mkspecs/features/yacc.prf:
/usr/share/qt/mkspecs/features/lex.prf:
/usr/share/qt/mkspecs/features/include_source_dir.prf:
/usr/lib/libQtDBus.prl:
/usr/lib/libQtGui.prl:
/usr/lib/libQtCore.prl:
qmake: FORCE
@$(QMAKE) -Wnone -o Makefile src.pro
dist:
@$(CHK_DIR_EXISTS) .tmp/enttecdmxusbout1.0.0 || $(MKDIR) .tmp/enttecdmxusbout1.0.0
$(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/enttecdmxusbout1.0.0/ && $(COPY_FILE) --parents ../../interfaces/qlcoutplugin.h enttecdmxusbwidget.h qlcftdi.h enttecdmxusbout.h enttecdmxusbpro.h enttecdmxusbopen.h .tmp/enttecdmxusbout1.0.0/ && $(COPY_FILE) --parents enttecdmxusbwidget.cpp enttecdmxusbout.cpp enttecdmxusbpro.cpp enttecdmxusbopen.cpp qlcftdi-libftdi.cpp .tmp/enttecdmxusbout1.0.0/ && $(COPY_FILE) --parents <API key>.ts <API key>.ts <API key>.ts <API key>.ts .tmp/enttecdmxusbout1.0.0/ && (cd `dirname .tmp/enttecdmxusbout1.0.0` && $(TAR) enttecdmxusbout1.0.0.tar enttecdmxusbout1.0.0 && $(COMPRESS) enttecdmxusbout1.0.0.tar) && $(MOVE) `dirname .tmp/enttecdmxusbout1.0.0`/enttecdmxusbout1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/enttecdmxusbout1.0.0
clean:compiler_clean
-$(DEL_FILE) $(OBJECTS)
-$(DEL_FILE) *~ core *.core
distclean: clean
-$(DEL_FILE) $(TARGET)
-$(DEL_FILE) Makefile
qmfiles:
lrelease src.pro
check: first
mocclean: <API key> <API key>
mocables: <API key> <API key>
<API key>: moc_qlcoutplugin.cpp moc_enttecdmxusbout.cpp moc_enttecdmxusbpro.cpp <API key>.cpp
<API key>:
-$(DEL_FILE) moc_qlcoutplugin.cpp moc_enttecdmxusbout.cpp moc_enttecdmxusbpro.cpp <API key>.cpp
moc_qlcoutplugin.cpp: ../../interfaces/qlcoutplugin.h
/usr/bin/moc $(DEFINES) $(INCPATH) ../../interfaces/qlcoutplugin.h -o moc_qlcoutplugin.cpp
moc_enttecdmxusbout.cpp: enttecdmxusbout.h
/usr/bin/moc $(DEFINES) $(INCPATH) enttecdmxusbout.h -o moc_enttecdmxusbout.cpp
moc_enttecdmxusbpro.cpp: enttecdmxusbwidget.h \
qlcftdi.h \
enttecdmxusbpro.h
/usr/bin/moc $(DEFINES) $(INCPATH) enttecdmxusbpro.h -o moc_enttecdmxusbpro.cpp
<API key>.cpp: enttecdmxusbwidget.h \
qlcftdi.h \
enttecdmxusbopen.h
/usr/bin/moc $(DEFINES) $(INCPATH) enttecdmxusbopen.h -o <API key>.cpp
<API key>:
<API key>:
<API key>:
<API key>:
<API key>:
compiler_rcc_clean:
<API key>: <API key>.cpp
<API key>:
-$(DEL_FILE) <API key>.cpp
<API key>:
<API key>:
<API key>:
<API key>:
<API key>:
<API key>:
<API key>:
<API key>:
<API key>:
<API key>:
<API key>:
compiler_uic_clean:
<API key>:
<API key>:
<API key>:
<API key>:
<API key>:
compiler_lex_clean:
compiler_clean: <API key>
enttecdmxusbwidget.o: enttecdmxusbwidget.cpp enttecdmxusbwidget.h \
qlcftdi.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o enttecdmxusbwidget.o enttecdmxusbwidget.cpp
enttecdmxusbout.o: enttecdmxusbout.cpp enttecdmxusbwidget.h \
qlcftdi.h \
enttecdmxusbopen.h \
enttecdmxusbpro.h \
enttecdmxusbout.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o enttecdmxusbout.o enttecdmxusbout.cpp
enttecdmxusbpro.o: enttecdmxusbpro.cpp enttecdmxusbpro.h \
enttecdmxusbwidget.h \
qlcftdi.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o enttecdmxusbpro.o enttecdmxusbpro.cpp
enttecdmxusbopen.o: enttecdmxusbopen.cpp enttecdmxusbopen.h \
enttecdmxusbwidget.h \
qlcftdi.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o enttecdmxusbopen.o enttecdmxusbopen.cpp
qlcftdi-libftdi.o: qlcftdi-libftdi.cpp enttecdmxusbwidget.h \
qlcftdi.h \
enttecdmxusbopen.h \
enttecdmxusbpro.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o qlcftdi-libftdi.o qlcftdi-libftdi.cpp
moc_qlcoutplugin.o: moc_qlcoutplugin.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_qlcoutplugin.o moc_qlcoutplugin.cpp
moc_enttecdmxusbout.o: moc_enttecdmxusbout.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_enttecdmxusbout.o moc_enttecdmxusbout.cpp
moc_enttecdmxusbpro.o: moc_enttecdmxusbpro.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_enttecdmxusbpro.o moc_enttecdmxusbpro.cpp
<API key>.o: <API key>.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o <API key>.o <API key>.cpp
install_udev: first FORCE
@$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/etc/udev/rules.d/ || $(MKDIR) $(INSTALL_ROOT)/etc/udev/rules.d/
-$(INSTALL_FILE) /home/apaul/src/qlc/plugins/enttecdmxusbout/src/z65-enttec-dmxusb.rules $(INSTALL_ROOT)/etc/udev/rules.d/
uninstall_udev: FORCE
-$(DEL_FILE) -r $(INSTALL_ROOT)/etc/udev/rules.d/z65-enttec-dmxusb.rules
-$(DEL_DIR) $(INSTALL_ROOT)/etc/udev/rules.d/
install_i18n: first FORCE
@$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/share/qlc/translations/ || $(MKDIR) $(INSTALL_ROOT)/usr/share/qlc/translations/
cp -f <API key>.qm /usr/share/qlc/translations && cp -f <API key>.qm /usr/share/qlc/translations && cp -f <API key>.qm /usr/share/qlc/translations && cp -f <API key>.qm /usr/share/qlc/translations
install_target: first FORCE
@$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/lib/qt4/plugins/qlc/output/ || $(MKDIR) $(INSTALL_ROOT)/usr/lib/qt4/plugins/qlc/output/
-$(INSTALL_PROGRAM) "$(TARGET)" "$(INSTALL_ROOT)/usr/lib/qt4/plugins/qlc/output/$(TARGET)"
uninstall_target: FORCE
-$(DEL_FILE) "$(INSTALL_ROOT)/usr/lib/qt4/plugins/qlc/output/$(TARGET)"
-$(DEL_DIR) $(INSTALL_ROOT)/usr/lib/qt4/plugins/qlc/output/
install: install_udev install_i18n install_target FORCE
uninstall: uninstall_udev uninstall_target FORCE
FORCE: |
package savitzky_golay;
import jama.Matrix;
import java.awt.geom.Point2D;
import java.io.File;
import java.io.<API key>;
import java.io.PrintWriter;
import java.text.NumberFormat;
import java.util.Vector;
public class SavGolOperations {
private double[][] data;
private SavitzkyGolay sg;
public SavGolOperations() {}
public SavGolOperations(double[][] data, SavitzkyGolay sg) {
this.data = data;
this.sg = sg;
}
private double applyMask(SavitzkyGolay.whichMask which, int startI, int startJ) {
double[][] mask = sg.getMaskAs2d(which);
double val = 0;
for(int i = 0; i < mask.length; i++) {
for(int j = 0; j < mask.length; j++) {
val += data[i+startI][j+startJ] * mask[i][j];
}
}
return val;
}
private double[][] get2ndDers(SavitzkyGolay.whichMask which) {
int maskDim = sg.getMaskDim();
int offset = (maskDim-1)/2;
double[][] _2ndDers = new double[data.length][data[0].length];
for(int i = 0; i < _2ndDers.length-maskDim; i++) {
for(int j = 0; j < _2ndDers[i].length-maskDim; j++) {
_2ndDers[i+offset][j+offset] = applyMask(which, i, j);
}
}
return _2ndDers;
}
private double[][] get2ndDerSum() {
PrintWriter pw = null;
try {
pw = new PrintWriter("<API key>.txt");
} catch (<API key> e) {
e.printStackTrace();
}
Matrix _2ndDersX = new Matrix(get2ndDers(SavitzkyGolay.whichMask.X2));
pw.println("X^2");
_2ndDersX.print(pw, NumberFormat.FRACTION_FIELD, 10);
pw.flush();
Matrix _2ndDersY = new Matrix(get2ndDers(SavitzkyGolay.whichMask.Y2));
pw.println("Y^2");
_2ndDersY.print(pw, NumberFormat.FRACTION_FIELD, 10);
pw.flush();
Matrix _2ndDersXY = new Matrix(get2ndDers(SavitzkyGolay.whichMask.XY));
pw.println("X * Y");
_2ndDersXY.print(pw, NumberFormat.FRACTION_FIELD, 10);
pw.flush();
Matrix sum = _2ndDersX.plus(_2ndDersY).plus(_2ndDersXY);
pw.println("X^2 + Y^2 + X * Y");
sum.print(pw, NumberFormat.FRACTION_FIELD, 10);
pw.flush();
double[][] d = sum.getArray();
for(int i = 0; i < d.length; i++) {
for(int j = 0; j < d[i].length; j++) {
pw.println(i + "\t" + j + "\t" + d[i][j]);
}
}
pw.flush();
return sum.getArray();
}
public int[][] getPeaks(){
int maskDim = sg.getMaskDim();
int offset = (maskDim-1)/2;
Vector<int[]> peaks = new Vector<int[]>();
double[][] sum = get2ndDerSum();
double testVal;
boolean lessThanAll;
for(int i = offset; i < sum.length-offset; i++) {
for(int j = offset; j < sum[i].length-offset; j++) {
testVal = sum[i][j];
lessThanAll = true;
if(i == 46 && j == 163) {
System.out.println("found it");
}
for(int a = i-1; a <= i+1 && lessThanAll; a++) {
for(int b = j-1; b <= j+1 && lessThanAll; b++) {
if(!(a == i && b == j)) {
if(testVal >= sum[a][b]) {
lessThanAll = false;
}
}
}
}
if(lessThanAll) {
peaks.add(new int[]{i, j});
}
}
}
return peaks.toArray(new int[peaks.size()][2]);
}
} |
<?php
/**
* This is the model class for table "<API key>".
*
* The followings are the available columns in table '<API key>':
* @property integer $category_id
* @property string $content_lang
* @property string $category_name
* @property string $<API key>
*
* The followings are the available model relations:
* @property DocsCategories $category
*
* @author Amiral Management Corporation
* @version 1.0
*/
class <API key> extends <API key> {
/**
* Returns the static model of the specified AR class.
* @param string $className active record class name.
* @return <API key> the static model class
*/
public static function model($className = __CLASS__) {
return parent::model($className);
}
/**
* @return string the associated database table name
*/
public function tableName() {
return '<API key>';
}
/**
* @return array validation rules for model attributes.
*/
public function rules() {
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('content_lang, category_name', 'required'),
array('category_id', 'numerical', 'integerOnly' => true),
array('content_lang', 'length', 'max' => 2),
array('category_name', 'length', 'max' => 100),
array('<API key>', 'safe'),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
array('category_id, content_lang, category_name, <API key>', 'safe', 'on' => 'search'),
);
}
/**
* @return array relational rules.
*/
public function relations() {
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
'parentContent' => array(self::BELONGS_TO, 'DocsCategories', 'category_id'),
);
}
/**
* @return array customized attribute labels (name=>label)
*/
public function attributeLabels() {
return array(
'category_id' => AmcWm::t("msgsbase.core", 'Category'),
'content_lang' => AmcWm::t("msgsbase.core", 'Content Lang'),
'category_name' => AmcWm::t("msgsbase.core", 'Category Name'),
'<API key>' => AmcWm::t("msgsbase.core", 'Category Description'),
);
}
/**
* Retrieves a list of models based on the current search/filter conditions.
* @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
*/
public function search() {
// Warning: Please modify the following code to remove attributes that
// should not be searched.
$criteria = new CDbCriteria;
$criteria->compare('category_id', $this->category_id);
$criteria->compare('content_lang', $this->content_lang, true);
$criteria->compare('category_name', $this->category_name, true);
$criteria->compare('<API key>', $this-><API key>, true);
return new CActiveDataProvider($this, array(
'criteria' => $criteria,
));
}
} |
#!/usr/bin/perl
use NOCpulse::SpreadNetwork;
$host = `uname -n`;
chomp($host);
$name = "memory";
$connection = SpreadConnection->newInitialized({
address=>'localhost',
privateName=>$name,
<API key>=>1
});
print "Running on $host as ".$connection->get_mailbox."\n";
$connection->join('memory');
$|=1;
print "Waiting for messages";
MESSAGE: while (1) {
if ($connection->isConnected) {
$message = SpreadMessage->nextFrom($connection);
if (! $message ) {
print ".";
} else {
if ($message->get_sender eq $connection->get_mailbox) {
print "Ignoring message from self\n";
next MESSAGE;
}
$contents = $message->get_contents;
($op,$key,$value) = split(
/,/,
$contents,
3);
$op=uc($op);
print time()." |$op|$key| from ".$message->get_sender."\n";
$reply = SpreadMessage->newInitialized({
addressee=>$message->get_sender
});
if ( $op eq 'GET') {
$reply->set_contents("OK,GET,$key,".$Memory{$key});
} elsif ($op eq 'SET') {
$Memory{$key} = $value;
$reply->set_contents("OK,SET,$key");
SpreadMessage->newInitialized({
addressee=>'memory',
contents=>"SET,$key,$value"
})->sendVia($connection);
} elsif ($op eq 'DEL') {
delete($Memory{$key});
$reply->set_contents("OK,DEL,$key");
} elsif ($op eq 'LST') {
$reply->set_contents("OK,LST,$key,".join("\n",keys(%Memory)));
} else {
$reply->set_contents("ERROR,$op,$key");
}
$reply->sendVia($connection);
}
} else {
print "Reconnecting...\n";
$connection->reconnect;
}
} |
/*
* Automatically generated C config: don't edit
*/
#define AUTOCONF_INCLUDED
#define RTL8711_MODULE_NAME "rtl8711_usb"
#undef <API key> 1
#undef CONFIG_SDIO_HCI
#undef CONFIG_CFIO_HCI
#undef CONFIG_LM_HCI
#define CONFIG_USB_HCI 1
#define CONFIG_RTL8711 1
#undef CONFIG_RTL8712
#undef CONFIG_RTL8716
//#define NEW_SDIO_RX 1
//#define NEW_SDIO_TX 1
#define USE_ASYNC_IRP 1
#undef USE_SYNC_IRP
#define <API key> 1
#undef CONFIG_BIG_ENDIAN
//#define CONFIG_PWRCTRL 1
#define RX_BUF_LEN (2400)
#define TX_BUFSZ (2048)
#undef CONFIG_TXSKBQSZ_16
#define CONFIG_TXSKBQSZ_32 1
#undef CONFIG_TXSKBQSZ_64
#define MAXCMDSZ (64)
//#define CONFIG_H2CLBK 1
#define CONFIG_HWPKT_END
#undef PLATFORM_OS_XP
#undef PLATFORM_WINDOWS
#undef PLATFORM_OS_XP
#undef PLATFORM_OS_CE
#define PLATFORM_LINUX 1
#define PLATFORM_OS_LINUX 1
#undef CONFIG_MP_INCLUDED
#define CONFIG_POLLING_MODE
#define dlfw_blk_wo_chk
#define LINUX_TASKLET
//#define burst_read_eeprom |
// WinDjView
// This program is free software; you can redistribute it and/or modify
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
// $Id: MyGdiPlus.cpp,v 1.2 2009/08/09 16:54:03 zhezherun Exp $
#include "stdafx.h"
#include "Global.h"
#undef DEFINE_GUID
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
EXTERN_C const GUID name \
= { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
#include "MyGdiPlus.h"
namespace Gdip
{
typedef Status (__stdcall *<API key>)(UINT* numEncoders, UINT* size);
typedef Status (__stdcall *pfGetImageEncoders)(UINT numEncoders, UINT size, ImageCodecInfo* encoders);
typedef Status (__stdcall *<API key>)(IStream* stream, Image** image);
typedef Status (__stdcall *pfLoadImageFromFile)(const WCHAR* filename, Image** image);
typedef Status (__stdcall *<API key>)(IStream* stream, Image** image);
typedef Status (__stdcall *<API key>)(const WCHAR* filename, Image** image);
typedef Status (__stdcall *pfCloneImage)(Image* image, Image** cloneImage);
typedef Status (__stdcall *pfDisposeImage)(Image* image);
typedef Status (__stdcall *pfSaveImageToFile)(Image* image, const WCHAR* filename,
const CLSID* clsidEncoder, const EncoderParameters* encoderParams);
typedef Status (__stdcall *pfSaveImageToStream)(Image* image, IStream* stream,
const CLSID* clsidEncoder, const EncoderParameters* encoderParams);
typedef Status (__stdcall *pfGdipSaveAdd)(Image* image,
const EncoderParameters* encoderParams);
typedef Status (__stdcall *pfGdipSaveAddImage)(Image* image, Image* newImage,
const EncoderParameters* encoderParams);
typedef Status (__stdcall *<API key>)(IStream* stream, Bitmap** bitmap);
typedef Status (__stdcall *<API key>)(const WCHAR* filename, Bitmap** bitmap);
typedef Status (__stdcall *<API key>)(IStream* stream, Bitmap** bitmap);
typedef Status (__stdcall *<API key>)(const WCHAR* filename, Bitmap** bitmap);
typedef Status (__stdcall *<API key>)(const BITMAPINFO* gdiBitmapInfo,
VOID* gdiBitmapData, Bitmap** bitmap);
typedef Status (__stdcall *<API key>)(HBITMAP hbm, HPALETTE hpal,
Bitmap** bitmap);
typedef Status (__stdcall *<API key>)(HICON hicon, Bitmap** bitmap);
typedef Status (__stdcall *<API key>)(HINSTANCE hInstance,
const WCHAR* lpBitmapName, Bitmap** bitmap);
typedef Status (__stdcall *<API key>)(Bitmap* bitmap, float xdpi, float ydpi);
<API key> <API key> = NULL;
pfGetImageEncoders pGetImageEncoders = NULL;
<API key> <API key> = NULL;
pfSaveImageToFile pSaveImageToFile = NULL;
pfSaveImageToStream pSaveImageToStream = NULL;
pfCloneImage pCloneImage = NULL;
pfDisposeImage pDisposeImage = NULL;
<API key> <API key> = NULL;
HMODULE hGdiplusDLL = NULL;
bool bGdiplusAvailable = false, bGdiplusAPILoaded = false, bGdiplusLoadFailed = false;
ULONG token = 0;
// Startup and shutdown
enum DebugEventLevel
{
<API key>,
<API key>
};
typedef VOID (__stdcall *DebugEventProc)(DebugEventLevel level, CHAR* message);
typedef Status (__stdcall *<API key>)(ULONG* token);
typedef VOID (__stdcall *<API key>)(ULONG token);
struct StartupInput
{
UINT32 GdiplusVersion; // Must be 1
DebugEventProc DebugEventCallback;
BOOL <API key>;
BOOL <API key>;
StartupInput(
DebugEventProc debugEventCallback = NULL,
BOOL <API key> = FALSE,
BOOL <API key> = FALSE)
{
GdiplusVersion = 1;
DebugEventCallback = debugEventCallback;
<API key> = <API key>;
<API key> = <API key>;
}
};
struct StartupOutput
{
<API key> NotificationHook;
<API key> NotificationUnhook;
};
typedef Status (__stdcall *pfStartup)(ULONG* token, const StartupInput* input,
StartupOutput* output);
typedef void (__stdcall *pfShutdown)(ULONG token);
pfStartup pStartup = NULL;
pfShutdown pShutdown = NULL;
void LoadGdiplusAPI()
{
hGdiplusDLL = ::LoadLibrary(_T("gdiplus.dll"));
if (hGdiplusDLL)
{
pStartup = (pfStartup)::GetProcAddress(hGdiplusDLL, "GdiplusStartup");
pShutdown = (pfShutdown)::GetProcAddress(hGdiplusDLL, "GdiplusShutdown");
<API key> = (<API key>)::GetProcAddress(hGdiplusDLL, "<API key>");
pGetImageEncoders = (pfGetImageEncoders)::GetProcAddress(hGdiplusDLL, "<API key>");
<API key> = (<API key>)::GetProcAddress(hGdiplusDLL, "<API key>");
pSaveImageToFile = (pfSaveImageToFile)::GetProcAddress(hGdiplusDLL, "GdipSaveImageToFile");
pSaveImageToStream = (pfSaveImageToStream)::GetProcAddress(hGdiplusDLL, "<API key>");
pCloneImage = (pfCloneImage)::GetProcAddress(hGdiplusDLL, "GdipCloneImage");
pDisposeImage = (pfDisposeImage)::GetProcAddress(hGdiplusDLL, "GdipDisposeImage");
<API key> = (<API key>)::GetProcAddress(hGdiplusDLL, "<API key>");
}
if (pStartup != NULL
&& pShutdown != NULL
&& <API key> != NULL
&& pGetImageEncoders != NULL
&& <API key> != NULL
&& pSaveImageToFile != NULL
&& pSaveImageToStream != NULL
&& pCloneImage != NULL
&& pDisposeImage != NULL
&& <API key> != NULL)
{
bGdiplusAvailable = true;
}
if (!bGdiplusAvailable && hGdiplusDLL != NULL)
{
::FreeLibrary(hGdiplusDLL);
hGdiplusDLL = NULL;
}
}
void UnloadGdiplusAPI()
{
if (bGdiplusAPILoaded)
pShutdown(token);
if (bGdiplusAvailable)
::FreeLibrary(hGdiplusDLL);
hGdiplusDLL = NULL;
bGdiplusAPILoaded = false;
bGdiplusAvailable = false;
bGdiplusLoadFailed = false;
}
bool IsLoaded()
{
if (bGdiplusAvailable && !bGdiplusAPILoaded && !bGdiplusLoadFailed)
{
StartupInput input;
StartupOutput output;
bGdiplusAPILoaded = (pStartup(&token, &input, &output) == Ok);
if (!bGdiplusAPILoaded)
bGdiplusLoadFailed = true;
}
return bGdiplusAPILoaded;
}
Status <API key>(UINT* numEncoders, UINT* size)
{
if (!bGdiplusAPILoaded)
return <API key>;
return <API key>(numEncoders, size);
}
Status GetImageEncoders(UINT numEncoders, UINT size, ImageCodecInfo* encoders)
{
if (!bGdiplusAPILoaded)
return <API key>;
return pGetImageEncoders(numEncoders, size, encoders);
}
Status <API key>(const BITMAPINFO* gdiBitmapInfo,
VOID* gdiBitmapData, Bitmap** bitmap)
{
if (!bGdiplusAPILoaded)
return <API key>;
return <API key>(gdiBitmapInfo, gdiBitmapData, bitmap);
}
Status SaveImageToFile(Image* image, const WCHAR* filename,
const CLSID* clsidEncoder, const EncoderParameters* encoderParams)
{
if (!bGdiplusAPILoaded)
return <API key>;
return pSaveImageToFile(image, filename, clsidEncoder, encoderParams);
}
Status SaveImageToStream(Image* image, IStream* stream,
const CLSID* clsidEncoder, const EncoderParameters* encoderParams)
{
if (!bGdiplusAPILoaded)
return <API key>;
return pSaveImageToStream(image, stream, clsidEncoder, encoderParams);
}
Status CloneImage(Image* image, Image** cloneImage)
{
if (!bGdiplusAPILoaded)
return <API key>;
return pCloneImage(image, cloneImage);
}
Status DisposeImage(Image* image)
{
if (!bGdiplusAPILoaded)
return <API key>;
return pDisposeImage(image);
}
Status BitmapSetResolution(Bitmap* bitmap, float xdpi, float ydpi)
{
if (!bGdiplusAPILoaded)
return <API key>;
return <API key>(bitmap, xdpi, ydpi);
}
bool GetEncoderClsid(const WCHAR* format, CLSID* pClsid)
{
UINT num = 0; // number of image encoders
UINT size = 0; // size of the image encoder array in bytes
<API key>(&num, &size);
if (size == 0)
return false;
vector<char> buf(size);
ImageCodecInfo* pImageCodecInfo = (ImageCodecInfo*) &buf[0];
GetImageEncoders(num, size, pImageCodecInfo);
for (UINT j = 0; j < num; ++j)
{
if (wcscmp(pImageCodecInfo[j].MimeType, format) == 0)
{
*pClsid = pImageCodecInfo[j].Clsid;
return true;
}
}
return false;
}
struct GdiplusAPI
{
GdiplusAPI() { LoadGdiplusAPI(); }
~GdiplusAPI() { UnloadGdiplusAPI(); }
static GdiplusAPI theAPI;
};
GdiplusAPI GdiplusAPI::theAPI;
} // namespace Gdip |
package student;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class AddScores implements ActionListener {
Connection dbConn = null;
//write a constructor to set the conn
public AddScores(Connection conn) {
dbConn = conn;
// TODO Auto-generated constructor stub
}
public void addScores(String strAssignmentName, String[] strStudentNames, int[] intScores){
DBInfo dbInfo = new DBInfo();
dbInfo.addScores(strAssignmentName, strStudentNames, intScores, dbConn);
}
@Override
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
String strAssignmentNames = dbInfo.getAssignmentNames();
String strStudentNames = dbInfo.getNames(conn);
Submit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String strAssignmentName = "";
String[] strStudentNames = new String[strStudentNames.length];
int[] intScores = new int[strStudentNames.length];
addScores(strAssignmentName, strStudentNames, intScores);
frame.setVisible(false);
}
});
}
} |
#pragma once
#include "android/skin/region.h"
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/* a SkinSurface models a 32-bit ARGB pixel image that can be blitted to or from
*/
typedef struct SkinSurface SkinSurface;
struct SkinScaler;
/* increment surface's reference count */
extern SkinSurface* skin_surface_ref( SkinSurface* surface );
/* decrement a surface's reference count. takes the surface's address as parameter.
it will be set to NULL on exit */
extern void skin_surface_unrefp( SkinSurface* *psurface );
extern int skin_surface_width(SkinSurface* s);
extern int skin_surface_height(SkinSurface* s);
/* there are two kinds of surfaces:
- fast surfaces, whose content can be placed in video memory or
RLE-compressed for faster blitting and blending. the pixel format
used internally might be something very different from ARGB32.
- slow surfaces, whose content (pixel buffer) can be accessed and modified
with _lock()/_unlock() but may be blitted far slower since they reside in
system memory.
*/
/* create a 'fast' surface that contains a copy of an input ARGB32 pixmap */
extern SkinSurface* <API key>( int w, int h );
/* create an empty 'slow' surface containing an ARGB32 pixmap */
extern SkinSurface* <API key>( int w, int h );
/* create a 'slow' surface from a given pixel buffer. if 'do_copy' is TRUE, then
* the content of 'pixels' is copied into a heap-allocated buffer. otherwise
* the data will be used directly.
*/
extern SkinSurface* <API key>(
int w,
int h,
int pitch,
uint32_t* pixels);
extern SkinSurface* <API key>(
int x,
int y,
int w,
int h,
int original_w,
int original_h,
int is_fullscreen);
extern void <API key>(SkinSurface* surface,
int* x,
int* y);
extern void <API key>(SkinSurface* surface,
const SkinRect* srect,
SkinRect* drect);
/* surface pixels information for slow surfaces */
typedef struct {
int w;
int h;
int pitch;
uint32_t* pixels;
} SkinSurfacePixels;
typedef struct {
uint32_t r_shift;
uint32_t r_mask;
uint32_t g_shift;
uint32_t g_mask;
uint32_t b_shift;
uint32_t b_mask;
uint32_t a_shift;
uint32_t a_mask;
} <API key>;
extern void <API key>(SkinSurface* s,
<API key>* format);
extern void <API key>( SkinSurface* s, int alpha );
extern void skin_surface_update(SkinSurface* surface, SkinRect* rect);
extern void <API key>(SkinSurface* dst_surface,
struct SkinScaler* scaler,
SkinSurface* src_surface,
const SkinRect* src_rect);
extern void skin_surface_upload(SkinSurface* surface,
SkinRect* rect,
const void* pixels,
int pitch);
/* list of composition operators for the blit routine */
typedef enum {
SKIN_BLIT_COPY = 0,
SKIN_BLIT_SRCOVER,
} SkinBlitOp;
/* blit a surface into another one */
extern void skin_surface_blit( SkinSurface* dst,
SkinPos* dst_pos,
SkinSurface* src,
SkinRect* src_rect,
SkinBlitOp blitop );
/* blit a colored rectangle into a destination surface */
extern void skin_surface_fill(SkinSurface* dst,
SkinRect* rect,
uint32_t argb_premul);
#ifdef __cplusplus
}
#endif |
<?php
namespace PHPExiftool\Driver\Tag\Radiance;
use PHPExiftool\Driver\AbstractTag;
class Orientation extends AbstractTag
{
protected $Id = '_orient';
protected $Name = 'Orientation';
protected $FullName = 'Radiance::Main';
protected $GroupName = 'Radiance';
protected $g0 = 'Radiance';
protected $g1 = 'Radiance';
protected $g2 = 'Image';
protected $Type = '?';
protected $Writable = false;
protected $Description = 'Orientation';
protected $Values = array(
'+X +Y' => array(
'Id' => '+X +Y',
'Label' => 'Rotate 90 CW',
),
'+X -Y' => array(
'Id' => '+X -Y',
'Label' => 'Mirror horizontal and rotate 270 CW',
),
'+Y +X' => array(
'Id' => '+Y +X',
'Label' => 'Mirror vertical',
),
'+Y -X' => array(
'Id' => '+Y -X',
'Label' => 'Rotate 180',
),
'-X +Y' => array(
'Id' => '-X +Y',
'Label' => 'Mirror horizontal and rotate 90 CW',
),
'-X -Y' => array(
'Id' => '-X -Y',
'Label' => 'Rotate 270 CW',
),
'-Y +X' => array(
'Id' => '-Y +X',
'Label' => 'Horizontal (normal)',
),
'-Y -X' => array(
'Id' => '-Y -X',
'Label' => 'Mirror horizontal',
),
);
} |
Wpbootstrap portfolio
===
This is a modified version of <a href="http: |
<?php
require_once dirname(__FILE__).'/../../blocks.inc.php';
class CScreenSystemStatus extends CScreenBase {
/**
* Process screen.
*
* @return CDiv (screen inside container)
*/
public function get() {
global $page;
// rewrite page file
$page['file'] = $this->pageFile;
$item = new CUIWidget('hat_syssum', make_system_status(array(
'groupids' => null,
'hostids' => null,
'maintenance' => null,
'severity' => null,
'limit' => null,
'extAck' => 0,
'screenid' => $this->screenid
)));
$item->setHeader(_('Status of Zabbix'), SPACE);
$item->setFooter(_s('Updated: %s', zbx_date2str(_('H:i:s'))));
return $this->getOutput($item);
}
} |
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using KeePass.Native;
using KeePass.Util;
namespace KeePass.UI
{
internal sealed class <API key> : IMessageFilter
{
public bool PreFilterMessage(ref Message m)
{
if((m.Msg == NativeMethods.WM_KEYDOWN) || (m.Msg == NativeMethods.WM_LBUTTONDOWN) ||
(m.Msg == NativeMethods.WM_RBUTTONDOWN) || (m.Msg == NativeMethods.WM_MBUTTONDOWN))
{
Program.NotifyUserActivity();
}
// Workaround for .NET 4.6 overflow bug in InputLanguage.Culture
// (handle casted to Int32 without the 'unchecked' keyword);
// https://referencesource.microsoft.com/#System.Windows.Forms/winforms/Managed/System/WinForms/InputLanguage.cs
if(m.Msg == NativeMethods.<API key>)
{
long l = m.LParam.ToInt64();
if((l < (long)int.MinValue) || (l > (long)int.MaxValue))
return true; // Ignore it (better than an exception)
}
return false;
}
}
} |
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
#ifndef <API key>
#define <API key>
#include <libsoup/soup-types.h>
#include <libsoup/soup-websocket.h>
G_BEGIN_DECLS
#define <API key> (<API key> ())
#define <API key>(o) (<API key> ((o), <API key>, <API key>))
#define <API key>(o) (<API key> ((o), <API key>))
#define <API key>(k) (<API key> ((k), <API key>, <API key>))
#define <API key>(o) (<API key> ((o), <API key>, <API key>))
#define <API key>(k) (<API key> ((k), <API key>))
typedef struct <API key> <API key>;
struct <API key> {
GObject parent;
/*< private >*/
<API key> *pv;
};
typedef struct {
GObjectClass parent;
/* signals */
void (* message) (<API key> *self,
<API key> type,
GBytes *message);
void (* error) (<API key> *self,
GError *error);
void (* closing) (<API key> *self);
void (* closed) (<API key> *self);
} <API key>;
<API key>
GType <API key> (void) G_GNUC_CONST;
<API key> *<API key> (GIOStream *stream,
SoupURI *uri,
<API key> type,
const char *origin,
const char *protocol);
<API key>
GIOStream * <API key> (<API key> *self);
<API key>
<API key> <API key> (<API key> *self);
<API key>
SoupURI * <API key> (<API key> *self);
<API key>
const char * <API key> (<API key> *self);
<API key>
const char * <API key> (<API key> *self);
<API key>
SoupWebsocketState <API key> (<API key> *self);
<API key>
gushort <API key> (<API key> *self);
<API key>
const char * <API key> (<API key> *self);
<API key>
void <API key> (<API key> *self,
const char *text);
<API key>
void <API key> (<API key> *self,
gconstpointer data,
gsize length);
<API key>
void <API key> (<API key> *self,
gushort code,
const char *data);
G_END_DECLS
#endif /* <API key> */ |
<?php
class MemcachedWrapper extends CacheProvider implements <API key>
{
/**
* If we want to compress the data.
*
* @var boolean
*/
private $compress = false;
/**
* Last result code.
*
* @var int
*/
private $last_result_code = 0;
/**
* Holds the memcache client.
* @var Memcache
*/
private $client = null;
/**
* Constructor
*
* Init memcache.
*
* @param Core $core
* The core.
*/
public function __construct(Core &$core) {
parent::__construct($core);
$this->client = new Memcache();
}
/**
* This method sets the value of a Memcached option.
*
* Some options correspond to the ones defined by libmemcached, and some are specific to the extension.
* See Memcached Constants for more information.
* The options listed below require values specified via constants.
*
* @param string $option
* the option
* @param mixed $value
* the value
*
* @return boolean true
*/
public function set_option($option, $value) {
parent::set_option($option, $value);
switch ($option) {
case CacheProvider::OPT_COMPRESSION:
$this->compress = $value;
break;
}
return true;
}
/**
* Add a server
*
* @param string $host
* the host
* @param int $port
* the port
* @param int $weight
* the server weight (higher weight will increase the probability of the server being selected). (optional, default = 0)
*
* @return boolean true
*/
public function add_server($host, $port, $weight = 0) {
return @$this->client->addServer($host, $port, true, $weight);
}
/**
* Store an item.
*
* @param string $key
* The key under which to store the value.
* @param mixed $value
* The value to store.
* @param int $expiration
* The expiration time, defaults to 0. See Expiration Times for more info. (optional, default = 0)
*
* @return boolean true on success, else false
*/
public function set($key, $value, $expiration = 0) {
parent::set($key, $value, $expiration);
$key = urlencode($key);
$this->last_result_code = @$this->client->replace($this->prefix_key . $key, $value, $this->compress, $expiration);
if ($this->last_result_code == false) {
$this->last_result_code = @$this->client->set($this->prefix_key . $key, $value, $this->compress, $expiration);
}
return $this->last_result_code;
}
/**
* Increment the given value for the key with the given offset.
*
* @param string $key
* the cache key.
* @param int $offset
* the int to be incremented. (optional, default = 1)
*
* @return boolean true on success, else false.
*/
public function increment($key, $offset = 1) {
$key = urlencode($key);
return @$this->client->increment($key, $offset);
}
/**
* Decrement the given value for the key with the given offset.
*
* @param string $key
* the cache key.
* @param int $offset
* the int to be decremented. (optional, default = 1)
*
* @return boolean true on success, else false.
*/
public function decrement($key, $offset = 1) {
$key = urlencode($key);
return @$this->client->decrement($key, $offset);
}
/**
* Retrieve an item.
*
* @param string $key
* The key under which to store the value.
*
* @return mixed Returns the value of the item or false on error
*/
public function get($key, $cache_db = null, &$cas_token = '') {
$key = urlencode($key);
return @$this->client->get($this->prefix_key . $key);
}
/**
* Return the result code of the last operation.
*
* @return int returns one of the CacheProvider::RES_* constants that is the result of the last executed Memcached method.
*/
public function get_result_code() {
if ($this->last_result_code == true) {
return CacheProvider::RES_SUCCESS;
}
return CacheProvider::RES_FAILURE;
}
/**
* Retrieve multiple items.
*
* @param array $key
* The key under which to store the value.
*
* @return boolean Returns the array of found items or false on error.
*/
public function get_multi(array $keys) {
foreach ($keys AS &$v) {
$v = urlencode($v);
$v = $this->prefix_key . $v;
}
return @$this->client->get($keys);
}
/**
* Store multiple item.
*
* @param array $items
* One or more key/value pair/s which to store.
* @param int $expiration
* The expiration time, defaults to 0. See Expiration Times for more info. (optional, default = 0)
*
* @return boolean true on success, else false
*/
public function set_multi(array $items, $expiration = 0) {
parent::set_multi($values, $expiration);
foreach ($items AS $key => $value) {
$key = urlencode($key);
if ($this->set($key, $value) != true) {
return false;
}
}
return true;
}
/**
* Delete an item.
*
* @param string $key
* The key to be deleted.
* @param int $time
* The amount of time the server will wait to delete the item. (optional, default = 0)
*
* @return boolean Returns true on success, else false.
*/
public function delete($key, $time = 0) {
parent::delete($key);
$key = urlencode($key);
return @$this->client->delete($this->prefix_key . $key, $time);
}
/**
* Flush all existing items at the server
*
* @return boolean Returns true on success, else false.
*/
public function flush() {
parent::flush();
return @$this->client->flush();
}
} |
package ome.logic;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import org.springframework.transaction.annotation.Transactional;
import ome.annotations.RolesAllowed;
import ome.api.IPixels;
import ome.api.ServiceInterface;
import ome.conditions.ValidationException;
import ome.model.IObject;
import ome.model.core.Channel;
import ome.model.core.Image;
import ome.model.core.LogicalChannel;
import ome.model.core.Pixels;
import ome.model.display.RenderingDef;
import ome.model.enums.DimensionOrder;
import ome.model.enums.PixelsType;
import ome.model.meta.Session;
import ome.model.stats.StatsInfo;
import ome.parameters.Parameters;
import ome.util.PixelData;
@Transactional(readOnly = true)
public class PixelsImpl extends <API key> implements IPixels {
/**
* Returns the interface this implementation is for.
* @see <API key>#getServiceInterface()
*/
public Class<? extends ServiceInterface> getServiceInterface() {
return IPixels.class;
}
/** Standard rendering definition HQL query prefix */
public static final String <API key> =
"select rdef from RenderingDef as rdef " +
"left outer join fetch rdef.details.owner " +
"left outer join fetch rdef.quantization " +
"left outer join fetch rdef.model " +
"left outer join fetch rdef.waveRendering as cb " +
"left outer join fetch cb.family " +
"left outer join fetch rdef.<API key> where ";
// ~ Service methods
@RolesAllowed("user")
public Pixels <API key>(long pixId) {
Pixels p = iQuery.findByQuery("select p from Pixels as p "
+ "left outer join fetch p.pixelsType as pt "
+ "left outer join fetch p.channels as c "
+ "left outer join fetch c.logicalChannel as lc "
+ "left outer join fetch c.statsInfo "
+ "left outer join fetch lc.<API key> "
+ "left outer join fetch lc.illumination "
+ "left outer join fetch lc.mode "
+ "left outer join fetch lc.contrastMethod "
+ "where p.id = :id",
new Parameters().addId(pixId));
return p;
}
/**
* Returns the Id of the currently logged in user.
* Returns owner of the share while in share
* @return See above.
*/
private Long getCurrentUserId() {
Long shareId = getSecuritySystem().getEventContext().getCurrentShareId();
if (shareId != null) {
Session s = iQuery.get(Session.class, shareId);
return s.getOwner().getId();
}
return getSecuritySystem().getEventContext().getCurrentUserId();
}
/**
* Implemented as specified by the {@link IPixels} I/F.
* @see IPixels#<API key>(long, long)
*/
@RolesAllowed("user")
public RenderingDef <API key>(long pixId, long userId)
{
List<IObject> list = <API key>(pixId, userId);
if (list == null || list.size() == 0) return null;
return (RenderingDef) list.get(0);
}
/**
* Implemented as specified by the {@link IPixels} I/F.
* @see IPixels#<API key>(long, long)
*/
@RolesAllowed("user")
public List<IObject> <API key>(long pixId, long userId)
{
Parameters params = new Parameters();
params.addLong("p_id", pixId);
String restriction = "rdef.pixels.id = :p_id ";
if (userId >= 0) {
restriction += "and rdef.details.owner.id = :o_id ";
params.addLong("o_id", userId);
}
List<IObject> l = iQuery.findAllByQuery(
<API key> +restriction +
"order by rdef.details.updateEvent.time", params);
return l;
}
/**
* Implemented as specified by the {@link IPixels} I/F.
* @see IPixels#retrieveRndSettings(long)
*/
@RolesAllowed("user")
public RenderingDef retrieveRndSettings(long pixId) {
Long userId = getCurrentUserId();
return <API key>(pixId, userId);
}
/**
* Implemented as specified by the {@link IPixels} I/F.
* @see IPixels#loadRndSettings(long)
*/
@RolesAllowed("user")
public RenderingDef loadRndSettings(long renderingDefId) {
return (RenderingDef) iQuery.findByQuery(
<API key> + "rdef.id = :id",
new Parameters().addId(renderingDefId));
}
/** Actually performs the work declared in {@link copyAndResizePixels()}. */
private Pixels <API key>(long pixelsId, Integer sizeX,
Integer sizeY, Integer sizeZ, Integer sizeT,
List<Integer> channelList, String methodology, boolean copyStats)
{
Pixels from = <API key>(pixelsId);
Pixels to = new Pixels();
// Ensure we have no values out of bounds
outOfBoundsCheck(sizeX, "sizeX");
outOfBoundsCheck(sizeY, "sizeY");
outOfBoundsCheck(sizeZ, "sizeZ");
outOfBoundsCheck(sizeT, "sizeT");
// Check that the channels in the list are valid indexes.
if(channelList!=null)
channelOutOfBounds(channelList, "channel", from);
// Copy basic metadata
to.setDimensionOrder(from.getDimensionOrder());
to.setMethodology(methodology);
to.setPhysicalSizeX(from.getPhysicalSizeX());
to.setPhysicalSizeY(from.getPhysicalSizeY());
to.setPhysicalSizeZ(from.getPhysicalSizeZ());
to.setPixelsType(from.getPixelsType());
to.setRelatedTo(from);
to.setSizeX(sizeX != null? sizeX : from.getSizeX());
to.setSizeY(sizeY != null? sizeY : from.getSizeY());
to.setSizeZ(sizeZ != null? sizeZ : from.getSizeZ());
to.setSizeT(sizeT != null? sizeT : from.getSizeT());
to.setSizeC(channelList!= null ? channelList.size() : from.getSizeC());
to.setSha1("Pending...");
// Copy channel data, if the channel list is null copy all channels.
// or copy the channels in the channelList if it's not null.
if(channelList != null)
{
for (Integer channel : channelList)
{
copyChannel(channel, from, to, copyStats);
}
}
else
{
for (int channel = 0 ; channel < from.sizeOfChannels(); channel++)
{
copyChannel(channel, from, to, copyStats);
}
}
return to;
}
@RolesAllowed("user")
@Transactional(readOnly = false)
public Long copyAndResizePixels(long pixelsId, Integer sizeX, Integer sizeY,
Integer sizeZ, Integer sizeT, List<Integer> channelList,
String methodology, boolean copyStats)
{
Pixels from = <API key>(pixelsId);
Pixels to =
<API key>(pixelsId, sizeX, sizeY, sizeZ, sizeT,
channelList, methodology, copyStats);
// Deal with Image linkage
Image image = from.getImage();
image.addPixels(to);
// Save and return our newly created Pixels Id
image = iUpdate.saveAndReturnObject(image);
return image.getPixels(image.sizeOfPixels() - 1).getId();
}
@RolesAllowed("user")
@Transactional(readOnly = false)
public Long copyAndResizeImage(long imageId, Integer sizeX, Integer sizeY,
Integer sizeZ, Integer sizeT, List<Integer> channelList,
String name, boolean copyStats)
{
Image iFrom = iQuery.get(Image.class, imageId);
Image iTo = new Image();
// Set the image name
iTo.setAcquisitionDate(iFrom.getAcquisitionDate());
iTo.setName(name);
iTo.<API key>(iFrom.<API key>());
iTo.<API key>(iFrom.<API key>());
iTo.setExperiment(iFrom.getExperiment());
iTo.setStageLabel(iFrom.getStageLabel());
iTo.setInstrument(iFrom.getInstrument());
// Copy each Pixels set that the source image has
Iterator<Pixels> i = iFrom.iteratePixels();
while (i.hasNext())
{
Pixels p = i.next();
Pixels to =
<API key>(p.getId(), sizeX, sizeY, sizeZ, sizeT,
channelList, null, copyStats);
iTo.addPixels(to);
}
// Save and return our newly created Image Id
iTo = iUpdate.saveAndReturnObject(iTo);
return iTo.getId();
}
@RolesAllowed("user")
@Transactional(readOnly = false)
public Long createImage(int sizeX, int sizeY, int sizeZ, int sizeT,
List<Integer> channelList, PixelsType pixelsType, String name,
String description)
{
Image image = new Image();
Pixels pixels = new Pixels();
image.setName(name);
image.setDescription(description);
image.setAcquisitionDate(new Timestamp(new Date().getTime()));
// Check that the channels in the list are valid.
if (channelList == null || channelList.size() == 0)
{
throw new ValidationException("Channel list must be filled.");
}
// Create basic metadata
// FIXME: Hack, when the model changes we'll want to remove this, it's
// unreasonable.
pixels.setPhysicalSizeX(1.0);
pixels.setPhysicalSizeY(1.0);
pixels.setPhysicalSizeZ(1.0);
pixels.setPixelsType(pixelsType);
pixels.setSizeX(sizeX);
pixels.setSizeY(sizeY);
pixels.setSizeZ(sizeZ);
pixels.setSizeC(channelList.size());
pixels.setSizeT(sizeT);
pixels.setSha1("Pending...");
pixels.setDimensionOrder(getEnumeration(DimensionOrder.class, "XYZCT"));
// Create channel data.
List<Channel> channels = createChannels(channelList);
for(Channel channel : channels)
pixels.addChannel(channel);
image.addPixels(pixels);
// Save and return our newly created Image Id
image = iUpdate.saveAndReturnObject(image);
return image.getId();
}
@RolesAllowed("user")
@Transactional(readOnly = false)
public void <API key>(long pixelsId, int channelIndex,
double min, double max)
{
Pixels pixels = <API key>(pixelsId);
StatsInfo stats = pixels.getChannel(channelIndex).getStatsInfo();
stats.setGlobalMax(max);
stats.setGlobalMin(min);
iUpdate.saveAndReturnObject(stats);
}
@RolesAllowed("user")
@Transactional(readOnly = false)
public void saveRndSettings(RenderingDef rndSettings) {
iUpdate.saveAndReturnObject(rndSettings);
}
@RolesAllowed("user")
public int getBitDepth(PixelsType pixelsType) {
return PixelData.getBitDepth(pixelsType.getValue());
}
@RolesAllowed("user")
public <T extends IObject> T getEnumeration(Class<T> klass, String value) {
return iQuery.findByString(klass, "value", value);
}
@RolesAllowed("user")
public <T extends IObject> List<T> getAllEnumerations(Class<T> klass) {
return iQuery.findAll(klass, null);
}
/**
* Ensures that a particular dimension value is not out of range (ex. less
* than zero).
* @param value The value to check.
* @param name The name of the value to be used for error reporting.
* @throws ValidationException If <code>value</code> is out of range.
*/
private void outOfBoundsCheck(Integer value, String name)
{
if (value != null && value < 0)
{
throw new ValidationException(name + ": " + value + " <= 0");
}
}
/**
* Ensures that a particular dimension value in a list is not out of
* range (ex. less than zero).
* @param channelList The list of channels to check.
* @param name The name of the value to be used for error reporting.
* @param pixels the pixels the channel list belongs to.
* @throws ValidationException If <code>value</code> is out of range.
*/
private void channelOutOfBounds(List<Integer> channelList, String name,
Pixels pixels)
{
if(channelList.size() == 0)
throw new ValidationException("Channel List is not null but size == 0");
for(int i = 0 ; i < channelList.size() ; i++)
{
int value = channelList.get(i);
if (value < 0 || value >= pixels.sizeOfChannels())
throw new ValidationException(name + ": " + i + " out of bounds");
}
}
/**
* Copy the channel from the pixels to the pixels called to.
* @param channel the channel index.
* @param from the pixel to copy from.
* @param to the pixels to copy to.
* @param copyStats Whether or not to copy the {@link StatsInfo} for each
* channel.
*/
private void copyChannel(int channel, Pixels from, Pixels to,
boolean copyStats)
{
Channel cFrom = from.getChannel(channel);
Channel cTo = new Channel();
cTo.setLogicalChannel(cFrom.getLogicalChannel());
if (copyStats)
{
cTo.setStatsInfo(new StatsInfo(cFrom.getStatsInfo().getGlobalMin(),
cFrom.getStatsInfo().getGlobalMax()));
}
to.addChannel(cTo);
}
/**
* Creates new channels to be added to a Pixels set.
* @param channelList The list of channel emission wavelengths in
* nanometers.
* @return See above.
*/
private List<Channel> createChannels(List<Integer> channelList)
{
List<Channel> channels = new ArrayList<Channel>();
for (Integer wavelength : channelList)
{
Channel channel = new Channel();
LogicalChannel lc = new LogicalChannel();
channel.setLogicalChannel(lc);
StatsInfo info = new StatsInfo();
info.setGlobalMin(0.0);
info.setGlobalMax(1.0);
channel.setStatsInfo(info);
lc.setEmissionWave(wavelength+1); //need positive integer
channels.add(channel);
}
return channels;
}
} |
#ifndef <API key>
#define <API key>
#include <QAbstractListModel>
#include <QHash>
class Task;
class <API key> : public QAbstractListModel
{
Q_OBJECT
Q_PROPERTY(int count READ count NOTIFY countChanged)
Q_PROPERTY(bool tagOnlyMenu READ tagOnlyMenu NOTIFY tagOnlyMenuChanged)
public:
enum Role {
TextRole = Qt::UserRole + 1,
IconRole,
CheckableRole,
DismissRole,
ActionRole, // unused
<API key>,
EnabledRole
};
enum OptionType {
OptionTypeNewTag = 0,
OptionTypeEdit,
OptionTypeDelete,
OptionTypeQueue,
OptionTypeCount
};
Q_ENUM(OptionType)
struct Option {
QString text;
QString icon;
bool dismiss;
bool showBusyIndicator = false;
bool enabled = true;
};
explicit <API key>(Task *task, QObject *parent = nullptr);
int rowCount(const QModelIndex &parent) const override;
QVariant data(const QModelIndex &index, int role) const override;
QHash<int, QByteArray> roleNames() const override;
int count() const;
bool tagOnlyMenu() const;
void setTagOnlyMenu(bool onlyTags);
Q_SIGNALS:
void countChanged();
void tagOnlyMenuChanged();
private Q_SLOTS:
void <API key>();
void onModelReset();
void <API key>();
void onLayoutChanged();
void onDataChanged(const QModelIndex &, const QModelIndex &);
void <API key>(const QModelIndex &, int start, int end);
void onRowsInserted();
void <API key>(const QModelIndex &, int start, int end);
void onRowsRemoved();
private:
void toggleTag(int index);
int rowOffset() const;
QVariant staticData(OptionType row, int role) const;
Task *m_task;
QHash<OptionType, Option> m_staticOptions;
Option m_moveToTodayOption;
Option m_archiveOption;
bool m_tagOnlyMenu;
friend class <API key>;
};
#endif |
#ifndef _USB_OHCI_H
#define _USB_OHCI_H
static int cc_to_error[16] = {
/* mapping of the OHCI CC status to error codes */
/* No Error */ USB_ST_NOERROR,
/* CRC Error */ USB_ST_CRC,
/* Bit Stuff */ USB_ST_BITSTUFF,
/* Data Togg */ USB_ST_CRC,
/* Stall */ USB_ST_STALL,
/* DevNotResp */ USB_ST_NORESPONSE,
/* PIDCheck */ USB_ST_BITSTUFF,
/* UnExpPID */ USB_ST_BITSTUFF,
/* DataOver */ USB_ST_DATAOVERRUN,
/* DataUnder */ USB_ST_DATAUNDERRUN,
/* reservd */ USB_ST_NORESPONSE,
/* reservd */ USB_ST_NORESPONSE,
/* BufferOver */ <API key>,
/* BuffUnder */ <API key>,
/* Not Access */ USB_ST_NORESPONSE,
/* Not Access */ USB_ST_NORESPONSE
};
#include <linux/config.h>
#if defined(<API key>)
#include "mem-onchip.h"
#endif
#if defined(<API key>)
/* not use pci-pool */
#define <API key>
#endif
#ifdef <API key>
// pci_pool_alloc(pool, flags, handle)
static inline void*
PCI_POOL_ALLOC(size_t size, int flags, dma_addr_t *handle)
{
void *p = KMALLOC(size, flags);
*handle = (dma_addr_t)<API key>(p);
return p;
}
#define pci_pool_free(pool, vaddr, addr) \
KFREE(vaddr)
#endif
/* ED States */
#define ED_NEW 0x00
#define ED_UNLINK 0x01
#define ED_OPER 0x02
#define ED_DEL 0x04
#define ED_URB_DEL 0x08
/* usb_ohci_ed */
struct ed {
__u32 hwINFO;
__u32 hwTailP;
__u32 hwHeadP;
__u32 hwNextED;
struct ed * ed_prev;
__u8 int_period;
__u8 int_branch;
__u8 int_load;
__u8 int_interval;
__u8 state;
__u8 type;
__u16 last_iso;
struct ed * ed_rm_list;
dma_addr_t dma;
__u32 unused[3];
} __attribute((aligned(16)));
typedef struct ed ed_t;
/* TD info field */
#define TD_CC 0xf0000000
#define TD_CC_GET(td_p) ((td_p >>28) & 0x0f)
#define TD_CC_SET(td_p, cc) (td_p) = ((td_p) & 0x0fffffff) | (((cc) & 0x0f) << 28)
#define TD_EC 0x0C000000
#define TD_T 0x03000000
#define TD_T_DATA0 0x02000000
#define TD_T_DATA1 0x03000000
#define TD_T_TOGGLE 0x00000000
#define TD_R 0x00040000
#define TD_DI 0x00E00000
#define TD_DI_SET(X) (((X) & 0x07)<< 21)
#define TD_DP 0x00180000
#define TD_DP_SETUP 0x00000000
#define TD_DP_IN 0x00100000
#define TD_DP_OUT 0x00080000
#define TD_ISO 0x00010000
#define TD_DEL 0x00020000
/* CC Codes */
#define TD_CC_NOERROR 0x00
#define TD_CC_CRC 0x01
#define TD_CC_BITSTUFFING 0x02
#define TD_CC_DATATOGGLEM 0x03
#define TD_CC_STALL 0x04
#define TD_DEVNOTRESP 0x05
#define TD_PIDCHECKFAIL 0x06
#define TD_UNEXPECTEDPID 0x07
#define TD_DATAOVERRUN 0x08
#define TD_DATAUNDERRUN 0x09
#define TD_BUFFEROVERRUN 0x0C
#define TD_BUFFERUNDERRUN 0x0D
#define TD_NOTACCESSED 0x0F
#define MAXPSW 1
struct td {
__u32 hwINFO;
__u32 hwCBP; /* Current Buffer Pointer */
__u32 hwNextTD; /* Next TD Pointer */
__u32 hwBE; /* Memory Buffer End Pointer */
__u16 hwPSW[MAXPSW];
__u8 unused;
__u8 index;
struct ed * ed;
struct td * next_dl_td;
struct urb * urb;
dma_addr_t td_dma;
dma_addr_t data_dma;
__u32 unused2[2];
} __attribute((aligned(32))); /* normally 16, iso needs 32 */
typedef struct td td_t;
#define OHCI_ED_SKIP (1 << 14)
/*
* The HCCA (Host Controller Communications Area) is a 256 byte
* structure defined in the OHCI spec. that the host controller is
* told the base address of. It must be 256-byte aligned.
*/
#define NUM_INTS 32 /* part of the OHCI standard */
struct ohci_hcca {
__u32 int_table[NUM_INTS]; /* Interrupt ED table */
__u16 frame_no; /* current frame number */
__u16 pad1; /* set to 0 on each frame_no change */
__u32 done_head; /* info returned for an interrupt */
u8 reserved_for_hc[116];
} __attribute((aligned(256)));
/*
* Maximum number of root hub ports.
*/
#define MAX_ROOT_PORTS 15 /* maximum OHCI root hub ports */
/*
* This is the structure of the OHCI controller's memory mapped I/O
* region. This is Memory Mapped I/O. You must use the readl() and
* writel() macros defined in asm/io.h to access these!!
*/
struct ohci_regs {
/* control and status registers */
__u32 revision;
__u32 control;
__u32 cmdstatus;
__u32 intrstatus;
__u32 intrenable;
__u32 intrdisable;
/* memory pointers */
__u32 hcca;
__u32 ed_periodcurrent;
__u32 ed_controlhead;
__u32 ed_controlcurrent;
__u32 ed_bulkhead;
__u32 ed_bulkcurrent;
__u32 donehead;
/* frame counters */
__u32 fminterval;
__u32 fmremaining;
__u32 fmnumber;
__u32 periodicstart;
__u32 lsthresh;
/* Root hub ports */
struct ohci_roothub_regs {
__u32 a;
__u32 b;
__u32 status;
__u32 portstatus[MAX_ROOT_PORTS];
} roothub;
} __attribute((aligned(32)));
/* OHCI CONTROL AND STATUS REGISTER MASKS */
/*
* HcControl (control) register masks
*/
#define OHCI_CTRL_CBSR (3 << 0) /* control/bulk service ratio */
#define OHCI_CTRL_PLE (1 << 2) /* periodic list enable */
#define OHCI_CTRL_IE (1 << 3) /* isochronous enable */
#define OHCI_CTRL_CLE (1 << 4) /* control list enable */
#define OHCI_CTRL_BLE (1 << 5) /* bulk list enable */
#define OHCI_CTRL_HCFS (3 << 6) /* host controller functional state */
#define OHCI_CTRL_IR (1 << 8) /* interrupt routing */
#define OHCI_CTRL_RWC (1 << 9) /* remote wakeup connected */
#define OHCI_CTRL_RWE (1 << 10) /* remote wakeup enable */
/* pre-shifted values for HCFS */
# define OHCI_USB_RESET (0 << 6)
# define OHCI_USB_RESUME (1 << 6)
# define OHCI_USB_OPER (2 << 6)
# define OHCI_USB_SUSPEND (3 << 6)
/*
* HcCommandStatus (cmdstatus) register masks
*/
#define OHCI_HCR (1 << 0) /* host controller reset */
#define OHCI_CLF (1 << 1) /* control list filled */
#define OHCI_BLF (1 << 2) /* bulk list filled */
#define OHCI_OCR (1 << 3) /* ownership change request */
#define OHCI_SOC (3 << 16) /* scheduling overrun count */
/*
* masks used with interrupt registers:
* HcInterruptStatus (intrstatus)
* HcInterruptEnable (intrenable)
* HcInterruptDisable (intrdisable)
*/
#define OHCI_INTR_SO (1 << 0) /* scheduling overrun */
#define OHCI_INTR_WDH (1 << 1) /* writeback of done_head */
#define OHCI_INTR_SF (1 << 2) /* start frame */
#define OHCI_INTR_RD (1 << 3) /* resume detect */
#define OHCI_INTR_UE (1 << 4) /* unrecoverable error */
#define OHCI_INTR_FNO (1 << 5) /* frame number overflow */
#define OHCI_INTR_RHSC (1 << 6) /* root hub status change */
#define OHCI_INTR_OC (1 << 30) /* ownership change */
#define OHCI_INTR_MIE (1 << 31) /* master interrupt enable */
/* Virtual Root HUB */
struct virt_root_hub {
int devnum; /* Address of Root Hub endpoint */
void * urb;
void * int_addr;
int send;
int interval;
struct timer_list rh_int_timer;
};
/* USB HUB CONSTANTS (not OHCI-specific; see hub.h) */
/* destination of request */
#define RH_INTERFACE 0x01
#define RH_ENDPOINT 0x02
#define RH_OTHER 0x03
#define RH_CLASS 0x20
#define RH_VENDOR 0x40
/* Requests: bRequest << 8 | bmRequestType */
#define RH_GET_STATUS 0x0080
#define RH_CLEAR_FEATURE 0x0100
#define RH_SET_FEATURE 0x0300
#define RH_SET_ADDRESS 0x0500
#define RH_GET_DESCRIPTOR 0x0680
#define RH_SET_DESCRIPTOR 0x0700
#define <API key> 0x0880
#define <API key> 0x0900
#define RH_GET_STATE 0x0280
#define RH_GET_INTERFACE 0x0A80
#define RH_SET_INTERFACE 0x0B00
#define RH_SYNC_FRAME 0x0C80
/* Our Vendor Specific Request */
#define RH_SET_EP 0x2000
/* Hub port features */
#define RH_PORT_CONNECTION 0x00
#define RH_PORT_ENABLE 0x01
#define RH_PORT_SUSPEND 0x02
#define <API key> 0x03
#define RH_PORT_RESET 0x04
#define RH_PORT_POWER 0x08
#define RH_PORT_LOW_SPEED 0x09
#define <API key> 0x10
#define RH_C_PORT_ENABLE 0x11
#define RH_C_PORT_SUSPEND 0x12
#define <API key> 0x13
#define RH_C_PORT_RESET 0x14
/* Hub features */
#define <API key> 0x00
#define <API key> 0x01
#define <API key> 0x00
#define RH_ENDPOINT_STALL 0x01
#define RH_ACK 0x01
#define RH_REQ_ERR -1
#define RH_NACK 0x00
/* OHCI ROOT HUB REGISTER MASKS */
/* roothub.portstatus [i] bits */
#define RH_PS_CCS 0x00000001 /* current connect status */
#define RH_PS_PES 0x00000002 /* port enable status*/
#define RH_PS_PSS 0x00000004 /* port suspend status */
#define RH_PS_POCI 0x00000008 /* port over current indicator */
#define RH_PS_PRS 0x00000010 /* port reset status */
#define RH_PS_PPS 0x00000100 /* port power status */
#define RH_PS_LSDA 0x00000200 /* low speed device attached */
#define RH_PS_CSC 0x00010000 /* connect status change */
#define RH_PS_PESC 0x00020000 /* port enable status change */
#define RH_PS_PSSC 0x00040000 /* port suspend status change */
#define RH_PS_OCIC 0x00080000 /* over current indicator change */
#define RH_PS_PRSC 0x00100000 /* port reset status change */
/* roothub.status bits */
#define RH_HS_LPS 0x00000001 /* local power status */
#define RH_HS_OCI 0x00000002 /* over current indicator */
#define RH_HS_DRWE 0x00008000 /* device remote wakeup enable */
#define RH_HS_LPSC 0x00010000 /* local power status change */
#define RH_HS_OCIC 0x00020000 /* over current indicator change */
#define RH_HS_CRWE 0x80000000 /* clear remote wakeup enable */
/* roothub.b masks */
#define RH_B_DR 0x0000ffff /* device removable flags */
#define RH_B_PPCM 0xffff0000 /* port power control mask */
/* roothub.a masks */
#define RH_A_NDP (0xff << 0) /* number of downstream ports */
#define RH_A_PSM (1 << 8) /* power switching mode */
#define RH_A_NPS (1 << 9) /* no power switching */
#define RH_A_DT (1 << 10) /* device type (mbz) */
#define RH_A_OCPM (1 << 11) /* over current protection mode */
#define RH_A_NOCP (1 << 12) /* no over current protection */
#define RH_A_POTPGT (0xff << 24) /* power on to power good time */
/* urb */
typedef struct
{
ed_t * ed;
__u16 length; // number of tds associated with this request
__u16 td_cnt; // number of tds already serviced
int state;
wait_queue_head_t * wait;
td_t * td[0]; // list pointer to all corresponding TDs associated with this request
} urb_priv_t;
#define URB_DEL 1
/* Hash struct used for TD/ED hashing */
struct hash_t {
void *virt;
dma_addr_t dma;
struct hash_t *next; // chaining for collision cases
};
/* List of TD/ED hash entries */
struct hash_list_t {
struct hash_t *head;
struct hash_t *tail;
};
#define TD_HASH_SIZE 64 /* power'o'two */
#define ED_HASH_SIZE 64 /* power'o'two */
#define TD_HASH_FUNC(td_dma) ((td_dma ^ (td_dma >> 5)) % TD_HASH_SIZE)
#define ED_HASH_FUNC(ed_dma) ((ed_dma ^ (ed_dma >> 5)) % ED_HASH_SIZE)
/*
* This is the full ohci controller description
*
* Note how the "proper" USB information is just
* a subset of what the full implementation needs. (Linus)
*/
typedef struct ohci {
struct ohci_hcca *hcca; /* hcca */
dma_addr_t hcca_dma;
int irq;
int disabled; /* e.g. got a UE, we're hung */
int sleeping;
atomic_t resume_count; /* defending against multiple resumes */
unsigned long flags; /* for HC bugs */
#define OHCI_QUIRK_AMD756 0x01 /* erratum #4 */
#define OHCI_QUIRK_SUCKYIO 0x02 /* NSC superio */
struct ohci_regs * regs; /* OHCI controller's memory */
struct list_head ohci_hcd_list; /* list of all ohci_hcd */
struct ohci * next; // chain of ohci device contexts
struct list_head timeout_list;
// struct list_head urb_list; // list of all pending urbs
// spinlock_t urb_list_lock; // lock to keep consistency
int ohci_int_load[32]; /* load of the 32 Interrupt Chains (for load balancing)*/
ed_t * ed_rm_list[2]; /* lists of all endpoints to be removed */
ed_t * ed_bulktail; /* last endpoint of bulk list */
ed_t * ed_controltail; /* last endpoint of control list */
ed_t * ed_isotail; /* last endpoint of iso list */
int intrstatus;
__u32 hc_control; /* copy of the hc control reg */
struct usb_bus * bus;
struct usb_device * dev[128];
struct virt_root_hub rh;
/* PCI device handle, settings, ... */
struct pci_dev *ohci_dev;
const char *slot_name;
u8 pci_latency;
struct pci_pool *td_cache;
struct pci_pool *dev_cache;
struct hash_list_t td_hash[TD_HASH_SIZE];
struct hash_list_t ed_hash[ED_HASH_SIZE];
} ohci_t;
#define NUM_EDS 32 /* num of preallocated endpoint descriptors */
struct ohci_device {
ed_t ed[NUM_EDS];
dma_addr_t dma;
int ed_cnt;
wait_queue_head_t * wait;
};
// #define ohci_to_usb(ohci) ((ohci)->usb)
#define usb_to_ohci(usb) ((struct ohci_device *)(usb)->hcpriv)
/* hcd */
/* endpoint */
static int ep_link(ohci_t * ohci, ed_t * ed);
static int ep_unlink(ohci_t * ohci, ed_t * ed);
static ed_t * ep_add_ed(struct usb_device * usb_dev, unsigned int pipe, int interval, int load, int mem_flags);
static void ep_rm_ed(struct usb_device * usb_dev, ed_t * ed);
static void td_fill(ohci_t * ohci, unsigned int info, dma_addr_t data, int len, struct urb * urb, int index);
static void td_submit_urb(struct urb * urb);
/* root hub */
static int rh_submit_urb(struct urb * urb);
static int rh_unlink_urb(struct urb * urb);
static int rh_init_int_timer(struct urb * urb);
#define ALLOC_FLAGS (in_interrupt () || current->state != TASK_RUNNING ? GFP_ATOMIC : GFP_KERNEL)
#ifdef DEBUG
# define OHCI_MEM_FLAGS SLAB_POISON
#else
# define OHCI_MEM_FLAGS 0
#endif
#ifndef CONFIG_PCI
//# error "usb-ohci currently requires PCI-based controllers"
/* to support non-PCI OHCIs, you need custom bus/mem/... glue */
#endif
/* Recover a TD/ED using its collision chain */
static inline void *
dma_to_ed_td (struct hash_list_t * entry, dma_addr_t dma)
{
struct hash_t * scan = entry->head;
while (scan && scan->dma != dma)
scan = scan->next;
if (!scan)
BUG();
return scan->virt;
}
static inline struct ed *
dma_to_ed (struct ohci * hc, dma_addr_t ed_dma)
{
return (struct ed *) dma_to_ed_td(&(hc->ed_hash[ED_HASH_FUNC(ed_dma)]),
ed_dma);
}
static inline struct td *
dma_to_td (struct ohci * hc, dma_addr_t td_dma)
{
return (struct td *) dma_to_ed_td(&(hc->td_hash[TD_HASH_FUNC(td_dma)]),
td_dma);
}
/* Add a hash entry for a TD/ED; return true on success */
static inline int
hash_add_ed_td(struct hash_list_t * entry, void * virt, dma_addr_t dma)
{
struct hash_t * scan;
scan = (struct hash_t *)kmalloc(sizeof(struct hash_t), ALLOC_FLAGS);
if (!scan)
return 0;
if (!entry->tail) {
entry->head = entry->tail = scan;
} else {
entry->tail->next = scan;
entry->tail = scan;
}
scan->virt = virt;
scan->dma = dma;
scan->next = NULL;
return 1;
}
static inline int
hash_add_ed (struct ohci * hc, struct ed * ed)
{
return hash_add_ed_td (&(hc->ed_hash[ED_HASH_FUNC(ed->dma)]),
ed, ed->dma);
}
static inline int
hash_add_td (struct ohci * hc, struct td * td)
{
return hash_add_ed_td (&(hc->td_hash[TD_HASH_FUNC(td->td_dma)]),
td, td->td_dma);
}
static inline void
hash_free_ed_td (struct hash_list_t * entry, void * virt)
{
struct hash_t *scan, *prev;
scan = prev = entry->head;
// Find and unlink hash entry
while (scan && scan->virt != virt) {
prev = scan;
scan = scan->next;
}
if (scan) {
if (scan == entry->head) {
if (entry->head == entry->tail)
entry->head = entry->tail = NULL;
else
entry->head = scan->next;
} else if (scan == entry->tail) {
entry->tail = prev;
prev->next = NULL;
} else
prev->next = scan->next;
kfree(scan);
}
}
static inline void
hash_free_ed (struct ohci * hc, struct ed * ed)
{
hash_free_ed_td (&(hc->ed_hash[ED_HASH_FUNC(ed->dma)]), ed);
}
static inline void
hash_free_td (struct ohci * hc, struct td * td)
{
hash_free_ed_td (&(hc->td_hash[TD_HASH_FUNC(td->td_dma)]), td);
}
static int ohci_mem_init (struct ohci *ohci)
{
#ifndef <API key>
#if defined(<API key>) && defined(CONFIG_VOYAGERGX)
ohci->td_cache = usb_pci_pool_create ("ohci_td", ohci->ohci_dev,
sizeof (struct td),
32 /* byte alignment */,
0 /* no page-crossing issues */,
GFP_KERNEL | OHCI_MEM_FLAGS);
if (!ohci->td_cache)
return -ENOMEM;
ohci->dev_cache = usb_pci_pool_create ("ohci_dev", ohci->ohci_dev,
sizeof (struct ohci_device),
16 /* byte alignment */,
0 /* no page-crossing issues */,
GFP_KERNEL | OHCI_MEM_FLAGS);
#else
ohci->td_cache = pci_pool_create ("ohci_td", ohci->ohci_dev,
sizeof (struct td),
32 /* byte alignment */,
0 /* no page-crossing issues */,
GFP_KERNEL | OHCI_MEM_FLAGS);
if (!ohci->td_cache)
return -ENOMEM;
ohci->dev_cache = pci_pool_create ("ohci_dev", ohci->ohci_dev,
sizeof (struct ohci_device),
16 /* byte alignment */,
0 /* no page-crossing issues */,
GFP_KERNEL | OHCI_MEM_FLAGS);
#endif
if (!ohci->dev_cache)
return -ENOMEM;
#endif
return 0;
}
static void ohci_mem_cleanup (struct ohci *ohci)
{
#ifndef <API key>
#if defined(<API key>) && defined(CONFIG_VOYAGERGX)
if (ohci->td_cache) {
<API key> (ohci->td_cache);
ohci->td_cache = 0;
}
if (ohci->dev_cache) {
<API key> (ohci->dev_cache);
ohci->dev_cache = 0;
}
#else
if (ohci->td_cache) {
pci_pool_destroy (ohci->td_cache);
ohci->td_cache = 0;
}
if (ohci->dev_cache) {
pci_pool_destroy (ohci->dev_cache);
ohci->dev_cache = 0;
}
#endif
#endif
}
/* TDs ... */
static inline struct td *
td_alloc (struct ohci *hc, int mem_flags)
{
dma_addr_t dma;
struct td *td;
#if defined(<API key>) && defined(CONFIG_VOYAGERGX)
td = usb_pci_pool_alloc (hc->td_cache, mem_flags, &dma);
if (td) {
td->td_dma = dma;
/* hash it for later reverse mapping */
if (!hash_add_td (hc, td)) {
usb_pci_pool_free (hc->td_cache, td, dma);
return NULL;
}
}
#else
#ifdef <API key>
td = PCI_POOL_ALLOC (sizeof(struct td), mem_flags, &dma);
#else
td = pci_pool_alloc (hc->td_cache, mem_flags, &dma);
#endif
if (td) {
td->td_dma = dma;
/* hash it for later reverse mapping */
if (!hash_add_td (hc, td)) {
pci_pool_free (hc->td_cache, td, dma);
return NULL;
}
}
#endif
return td;
}
static inline void
td_free (struct ohci *hc, struct td *td)
{
hash_free_td (hc, td);
#if defined(<API key>) && defined(CONFIG_VOYAGERGX)
usb_pci_pool_free (hc->td_cache, td, td->td_dma);
#else
pci_pool_free (hc->td_cache, td, td->td_dma);
#endif
}
/* DEV + EDs ... only the EDs need to be consistent */
static inline struct ohci_device *
dev_alloc (struct ohci *hc, int mem_flags)
{
dma_addr_t dma;
struct ohci_device *dev;
int i, offset;
#ifdef <API key>
dev = PCI_POOL_ALLOC (sizeof(struct ohci_device), mem_flags, &dma);
#else
#if defined(<API key>) && defined(CONFIG_VOYAGERGX)
dev = usb_pci_pool_alloc (hc->dev_cache, mem_flags, &dma);
#else
dev = pci_pool_alloc (hc->dev_cache, mem_flags, &dma);
#endif
#endif
if (dev) {
memset (dev, 0, sizeof (*dev));
#if defined(<API key>)
dma = (unsigned long )dev - OC_MEM_TOP; /* SH7760 */
#endif
dev->dma = dma;
offset = ((char *)&dev->ed) - ((char *)dev);
for (i = 0; i < NUM_EDS; i++, offset += sizeof dev->ed [0])
dev->ed [i].dma = dma + offset;
/* add to hashtable if used */
}
return dev;
}
static inline void
dev_free (struct ohci *hc, struct ohci_device *dev)
{
#if defined(<API key>) && defined(CONFIG_VOYAGERGX)
usb_pci_pool_free (hc->dev_cache, dev, dev->dma);
#else
pci_pool_free (hc->dev_cache, dev, dev->dma);
#endif
}
#endif |
<?php
/**
* @file
* Definition of Drupal\views\Tests\DefaultViewsTest.
*/
namespace Drupal\views\Tests;
use Drupal\simpletest\WebTestBase;
use Drupal\views\ViewExecutable;
/**
* Tests for views default views.
*/
class DefaultViewsTest extends WebTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('views', 'node', 'search', 'comment', 'taxonomy', 'block');
/**
* An array of argument arrays to use for default views.
*
* @var array
*/
protected $viewArgMap = array(
'backlinks' => array(1),
'taxonomy_term' => array(1),
'glossary' => array('all'),
);
public static function getInfo() {
return array(
'name' => 'Default views',
'description' => 'Tests the default views provided by views',
'group' => 'Views',
);
}
protected function setUp() {
parent::setUp();
$this->vocabulary = entity_create('taxonomy_vocabulary', array(
'name' => $this->randomName(),
'description' => $this->randomName(),
'machine_name' => drupal_strtolower($this->randomName()),
'langcode' => <API key>,
'help' => '',
'nodes' => array('page' => 'page'),
'weight' => mt_rand(0, 10),
));
<API key>($this->vocabulary);
// Setup a field and instance.
$this->field_name = drupal_strtolower($this->randomName());
$this->field = array(
'field_name' => $this->field_name,
'type' => '<API key>',
'settings' => array(
'allowed_values' => array(
array(
'vocabulary' => $this->vocabulary->machine_name,
'parent' => '0',
),
),
)
);
field_create_field($this->field);
$this->instance = array(
'field_name' => $this->field_name,
'entity_type' => 'node',
'bundle' => 'page',
'widget' => array(
'type' => 'options_select',
),
'display' => array(
'full' => array(
'type' => '<API key>',
),
),
);
<API key>($this->instance);
// Create a time in the past for the archive.
$time = time() - 3600;
for ($i = 0; $i <= 10; $i++) {
$user = $this->drupalCreateUser();
$term = $this->createTerm($this->vocabulary);
$values = array('created' => $time, 'type' => 'page');
$values[$this->field_name][<API key>][]['tid'] = $term->tid;
// Make every other node promoted.
if ($i % 2) {
$values['promote'] = TRUE;
}
$values['body'][<API key>][]['value'] = l('Node ' . 1, 'node/' . 1);
$node = $this->drupalCreateNode($values);
search_index($node->nid, 'node', $node->body[<API key>][0]['value'], <API key>);
$comment = array(
'uid' => $user->uid,
'nid' => $node->nid,
);
entity_create('comment', $comment)->save();
}
}
/**
* Test that all Default views work as expected.
*/
public function testDefaultViews() {
// Get all default views.
$controller = <API key>('view');
$views = $controller->load();
foreach ($views as $name => $view_storage) {
$view = new ViewExecutable($view_storage);
$view->initDisplay();
foreach ($view->storage->display as $display_id => $display) {
$view->setDisplay($display_id);
// Add any args if needed.
if (array_key_exists($name, $this->viewArgMap)) {
$view->preExecute($this->viewArgMap[$name]);
}
$this->assert(TRUE, format_string('View @view will be executed.', array('@view' => $view->storage->name)));
$view->execute();
$tokens = array('@name' => $name, '@display_id' => $display_id);
$this->assertTrue($view->executed, format_string('@name:@display_id has been executed.', $tokens));
$count = count($view->result);
$this->assertTrue($count > 0, format_string('@count results returned', array('@count' => $count)));
$view->destroy();
}
}
}
/**
* Returns a new term with random properties in vocabulary $vid.
*/
function createTerm($vocabulary) {
$term = entity_create('taxonomy_term', array(
'name' => $this->randomName(),
'description' => $this->randomName(),
// Use the first available text format.
'format' => db_query_range('SELECT format FROM {filter_format}', 0, 1)->fetchField(),
'vid' => $vocabulary->vid,
'langcode' => <API key>,
));
taxonomy_term_save($term);
return $term;
}
} |
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
namespace EzGame.Input
{
public static class Keyboard
{
private static Microsoft.Xna.Framework.Input.Keys[] LastKs, LastKsConstrains;
private static double KsTimer, KsConstraint;
private static KeyboardState K, LastK;
public static void Update(GameTime Time)
{
LastK = K;
K = Microsoft.Xna.Framework.Input.Keyboard.GetState();
var Ks = K.GetPressedKeys();
foreach (var Key in Ks)
if (Key != Microsoft.Xna.Framework.Input.Keys.None)
{
if ((LastKs != null) && LastKs.Contains(Key))
{
if (((Time.TotalGameTime.TotalMilliseconds - KsTimer) > KsConstraint) && (InputRecieved != null))
{
InputRecieved((Keys) Key);
KsTimer = Time.TotalGameTime.TotalMilliseconds;
if (LastKsConstrains == null)
{
KsConstraint = 50;
LastKsConstrains = Ks;
}
}
}
else if (InputRecieved != null)
{
InputRecieved((Keys) Key);
KsTimer = Time.TotalGameTime.TotalMilliseconds;
}
if ((LastKsConstrains != null) && !LastKsConstrains.Contains(Key))
{
KsConstraint = 425;
LastKsConstrains = null;
}
}
if (Ks.Length == 0)
{
KsConstraint = 425;
LastKsConstrains = null;
}
LastKs = Ks;
}
public static event InputRecievedEvent InputRecieved;
<summary>
Check if a key on the keyboard has been pressed
</summary>
<param name="Key">The keyboard key to check.</param>
<returns>A True/False statement.</returns>
public static bool Pressed(Keys Key)
{
return (K.IsKeyDown((Microsoft.Xna.Framework.Input.Keys) Key) &&
((LastK == null) || LastK.IsKeyUp((Microsoft.Xna.Framework.Input.Keys) Key)));
}
<summary>
Check if a key on the keyboard has been released
</summary>
<param name="Key">The keyboard key to check.</param>
<returns>A True/False statement.</returns>
public static bool Released(Keys Key)
{
return (K.IsKeyUp((Microsoft.Xna.Framework.Input.Keys) Key) &&
((LastK != null) && LastK.IsKeyDown((Microsoft.Xna.Framework.Input.Keys) Key)));
}
<summary>
Check if a key on the keyboard is being held
</summary>
<param name="Key">The keyboard key to check.</param>
<returns>A True/False statement.</returns>
public static bool Holding(Keys Key)
{
return K.IsKeyDown((Microsoft.Xna.Framework.Input.Keys) Key);
}
public delegate void InputRecievedEvent(Keys Key);
public enum Keys
{
None = 0,
Back = 8,
Tab = 9,
Enter = 13,
Pause = 19,
// Summary:
// CAPS LOCK key
CapsLock = 20,
// Summary:
// Kana key on Japanese keyboards
Kana = 21,
// Summary:
// Kanji key on Japanese keyboards
Kanji = 25,
// Summary:
// ESC key
Escape = 27,
// Summary:
// IME Convert key
ImeConvert = 28,
// Summary:
// IME NoConvert key
ImeNoConvert = 29,
// Summary:
// SPACEBAR
Space = 32,
// Summary:
// PAGE UP key
PageUp = 33,
// Summary:
// PAGE DOWN key
PageDown = 34,
// Summary:
// END key
End = 35,
// Summary:
// HOME key
Home = 36,
// Summary:
// LEFT ARROW key
Left = 37,
// Summary:
// UP ARROW key
Up = 38,
// Summary:
// RIGHT ARROW key
Right = 39,
// Summary:
// DOWN ARROW key
Down = 40,
// Summary:
// SELECT key
Select = 41,
// Summary:
// PRINT key
Print = 42,
// Summary:
// EXECUTE key
Execute = 43,
// Summary:
// PRINT SCREEN key
PrintScreen = 44,
// Summary:
// INS key
Insert = 45,
// Summary:
// DEL key
Delete = 46,
// Summary:
// HELP key
Help = 47,
// Summary:
// Used for miscellaneous characters; it can vary by keyboard.
D0 = 48,
// Summary:
// Used for miscellaneous characters; it can vary by keyboard.
D1 = 49,
// Summary:
// Used for miscellaneous characters; it can vary by keyboard.
D2 = 50,
// Summary:
// Used for miscellaneous characters; it can vary by keyboard.
D3 = 51,
// Summary:
// Used for miscellaneous characters; it can vary by keyboard.
D4 = 52,
// Summary:
// Used for miscellaneous characters; it can vary by keyboard.
D5 = 53,
// Summary:
// Used for miscellaneous characters; it can vary by keyboard.
D6 = 54,
// Summary:
// Used for miscellaneous characters; it can vary by keyboard.
D7 = 55,
// Summary:
// Used for miscellaneous characters; it can vary by keyboard.
D8 = 56,
// Summary:
// Used for miscellaneous characters; it can vary by keyboard.
D9 = 57,
// Summary:
// A key
A = 65,
// Summary:
// B key
B = 66,
// Summary:
// C key
C = 67,
// Summary:
// D key
D = 68,
// Summary:
// E key
E = 69,
// Summary:
// F key
F = 70,
// Summary:
// G key
G = 71,
// Summary:
// H key
H = 72,
// Summary:
// I key
I = 73,
// Summary:
// J key
J = 74,
// Summary:
// K key
K = 75,
// Summary:
// L key
L = 76,
// Summary:
// M key
M = 77,
// Summary:
// N key
N = 78,
// Summary:
// O key
O = 79,
// Summary:
// P key
P = 80,
// Summary:
// Q key
Q = 81,
// Summary:
// R key
R = 82,
// Summary:
// S key
S = 83,
// Summary:
// T key
T = 84,
// Summary:
// U key
U = 85,
// Summary:
// V key
V = 86,
// Summary:
// W key
W = 87,
// Summary:
// X key
X = 88,
// Summary:
// Y key
Y = 89,
// Summary:
// Z key
Z = 90,
// Summary:
// Left Windows key
LeftWindows = 91,
// Summary:
// Right Windows key
RightWindows = 92,
// Summary:
// Applications key
Apps = 93,
// Summary:
// Computer Sleep key
Sleep = 95,
// Summary:
// Numeric keypad 0 key
NumPad0 = 96,
// Summary:
// Numeric keypad 1 key
NumPad1 = 97,
// Summary:
// Numeric keypad 2 key
NumPad2 = 98,
// Summary:
// Numeric keypad 3 key
NumPad3 = 99,
// Summary:
// Numeric keypad 4 key
NumPad4 = 100,
// Summary:
// Numeric keypad 5 key
NumPad5 = 101,
// Summary:
// Numeric keypad 6 key
NumPad6 = 102,
// Summary:
// Numeric keypad 7 key
NumPad7 = 103,
// Summary:
// Numeric keypad 8 key
NumPad8 = 104,
// Summary:
// Numeric keypad 9 key
NumPad9 = 105,
// Summary:
// Multiply key
Multiply = 106,
// Summary:
// Add key
Add = 107,
// Summary:
// Separator key
Separator = 108,
// Summary:
// Subtract key
Subtract = 109,
// Summary:
// Decimal key
Decimal = 110,
// Summary:
// Divide key
Divide = 111,
// Summary:
// F1 key
F1 = 112,
// Summary:
// F2 key
F2 = 113,
// Summary:
// F3 key
F3 = 114,
// Summary:
// F4 key
F4 = 115,
// Summary:
// F5 key
F5 = 116,
// Summary:
// F6 key
F6 = 117,
// Summary:
// F7 key
F7 = 118,
// Summary:
// F8 key
F8 = 119,
// Summary:
// F9 key
F9 = 120,
// Summary:
// F10 key
F10 = 121,
// Summary:
// F11 key
F11 = 122,
// Summary:
// F12 key
F12 = 123,
// Summary:
// F13 key
F13 = 124,
// Summary:
// F14 key
F14 = 125,
// Summary:
// F15 key
F15 = 126,
// Summary:
// F16 key
F16 = 127,
// Summary:
// F17 key
F17 = 128,
// Summary:
// F18 key
F18 = 129,
// Summary:
// F19 key
F19 = 130,
// Summary:
// F20 key
F20 = 131,
// Summary:
// F21 key
F21 = 132,
// Summary:
// F22 key
F22 = 133,
// Summary:
// F23 key
F23 = 134,
// Summary:
// F24 key
F24 = 135,
// Summary:
// NUM LOCK key
NumLock = 144,
// Summary:
// SCROLL LOCK key
Scroll = 145,
// Summary:
// Left SHIFT key
LeftShift = 160,
// Summary:
// Right SHIFT key
RightShift = 161,
// Summary:
// Left CONTROL key
LeftControl = 162,
// Summary:
// Right CONTROL key
RightControl = 163,
// Summary:
// Left ALT key
LeftAlt = 164,
// Summary:
// Right ALT key
RightAlt = 165,
// Summary:
// Windows 2000/XP: Browser Back key
BrowserBack = 166,
// Summary:
// Windows 2000/XP: Browser Forward key
BrowserForward = 167,
// Summary:
// Windows 2000/XP: Browser Refresh key
BrowserRefresh = 168,
// Summary:
// Windows 2000/XP: Browser Stop key
BrowserStop = 169,
// Summary:
// Windows 2000/XP: Browser Search key
BrowserSearch = 170,
// Summary:
// Windows 2000/XP: Browser Favorites key
BrowserFavorites = 171,
// Summary:
// Windows 2000/XP: Browser Start and Home key
BrowserHome = 172,
// Summary:
// Windows 2000/XP: Volume Mute key
VolumeMute = 173,
// Summary:
// Windows 2000/XP: Volume Down key
VolumeDown = 174,
// Summary:
// Windows 2000/XP: Volume Up key
VolumeUp = 175,
// Summary:
// Windows 2000/XP: Next Track key
MediaNextTrack = 176,
// Summary:
// Windows 2000/XP: Previous Track key
MediaPreviousTrack = 177,
// Summary:
// Windows 2000/XP: Stop Media key
MediaStop = 178,
// Summary:
// Windows 2000/XP: Play/Pause Media key
MediaPlayPause = 179,
// Summary:
// Windows 2000/XP: Start Mail key
LaunchMail = 180,
// Summary:
// Windows 2000/XP: Select Media key
SelectMedia = 181,
// Summary:
// Windows 2000/XP: Start Application 1 key
LaunchApplication1 = 182,
// Summary:
// Windows 2000/XP: Start Application 2 key
LaunchApplication2 = 183,
// Summary:
// Windows 2000/XP: The OEM Semicolon key on a US standard keyboard
OemSemicolon = 186,
// Summary:
// Windows 2000/XP: For any country/region, the '+' key
OemPlus = 187,
// Summary:
// Windows 2000/XP: For any country/region, the ',' key
OemComma = 188,
// Summary:
// Windows 2000/XP: For any country/region, the '-' key
OemMinus = 189,
// Summary:
// Windows 2000/XP: For any country/region, the '.' key
OemPeriod = 190,
// Summary:
// Windows 2000/XP: The OEM question mark key on a US standard keyboard
OemQuestion = 191,
// Summary:
// Windows 2000/XP: The OEM tilde key on a US standard keyboard
OemTilde = 192,
// Summary:
// Green ChatPad key
ChatPadGreen = 202,
// Summary:
// Orange ChatPad key
ChatPadOrange = 203,
// Summary:
// Windows 2000/XP: The OEM open bracket key on a US standard keyboard
OemOpenBrackets = 219,
// Summary:
// Windows 2000/XP: The OEM pipe key on a US standard keyboard
OemPipe = 220,
// Summary:
// Windows 2000/XP: The OEM close bracket key on a US standard keyboard
OemCloseBrackets = 221,
// Summary:
// Windows 2000/XP: The OEM singled/double quote key on a US standard keyboard
OemQuotes = 222,
// Summary:
// Used for miscellaneous characters; it can vary by keyboard.
Oem8 = 223,
// Summary:
// Windows 2000/XP: The OEM angle bracket or backslash key on the RT 102 key
// keyboard
OemBackslash = 226,
// Summary:
// Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key
ProcessKey = 229,
// Summary:
// OEM Copy key
OemCopy = 242,
// Summary:
// OEM Auto key
OemAuto = 243,
// Summary:
// OEM Enlarge Window key
OemEnlW = 244,
// Summary:
// Attn key
Attn = 246,
// Summary:
// CrSel key
Crsel = 247,
// Summary:
// ExSel key
Exsel = 248,
// Summary:
// Erase EOF key
EraseEof = 249,
// Summary:
// Play key
Play = 250,
// Summary:
// Zoom key
Zoom = 251,
// Summary:
// PA1 key
Pa1 = 253,
// Summary:
// CLEAR key
OemClear = 254
}
}
} |
@charset "UTF-8";
@font-face {
font-family: 'Bebas Neue';
src: url("../fonts/bebas_neue/BebasNeue Regular.otf") format("truetype");
font-weight: normal; }
@font-face {
font-family: 'Bebas Neue';
src: url("../fonts/bebas_neue/BebasNeue Bold.otf") format("truetype");
font-weight: bold; }
body {
font-size: 16px;
line-height: 1.2;
margin-top: 0;
font-family: 'Play', sans-serif; }
@media screen and (min-width: 768px) {
body {
margin-top: -79px; } }
.success-mail-text {
color: white; }
.uk-pagination > li.uk-active > a {
background: #000000;
color: white; }
a {
color: inherit;
text-decoration: none; }
a:hover, a:focus, a:active {
color: inherit;
text-decoration: none; }
h1, h2, h3, h4, h5, h6 {
line-height: 1.2;
font-family: 'Play', sans-serif; }
h2 {
font-size: 24px;
font-weight: bold;
margin-top: 25px;
text-transform: uppercase; }
@media screen and (min-width: 768px) {
h2 {
font-size: 28px; } }
.text-dark {
color: #00a8c7; }
.text-light {
color: #ff001b; }
.more-btn {
text-transform: uppercase;
background: black;
color: white;
display: inline-block;
padding: 10px 15px;
border-radius: 5px;
float: none; }
@media screen and (min-width: 768px) {
.more-btn {
float: right; } }
.more-btn:hover {
color: white;
background: #333333; }
.<API key> {
background-color: rgba(255, 255, 255, 0.7); }
.uk-pagination {
margin-top: 0;
margin-bottom: 25px; }
.uk-pagination > .uk-active > span {
background: #ff001b; }
header {
font-family: 'Play', Arial, sans-serif;
position: relative;
z-index: 10;
font-size: 18px;
background: rgba(50, 80, 82, 0.08); }
@media screen and (min-width: 768px) {
header {
background: rgba(255, 255, 255, 0.8);
bottom: -79px; } }
header .header__logo {
margin: 0 auto;
display: flex;
align-items: center;
padding: 15px 0; }
@media (min-width: 480px) {
header .header__logo {
max-width: 330px; } }
@media (min-width: 1220px) {
header .header__logo {
float: left; } }
header .header__logo img {
display: inline-block; }
@media (min-width: 1220px) {
header .<API key> {
float: right;
padding-top: 15px; } }
header .<API key> .contacts {
text-align: center;
color: #ff001b;
margin-bottom: 3px; }
@media (min-width: 1220px) {
header .<API key> .contacts {
text-align: right; } }
header .<API key> .contacts a {
padding: 0 15px;
font-family: 'Comfortaa', cursive; }
header .<API key> .contacts span + span {
display: block;
margin-top: 10px; }
@media (min-width: 480px) {
header .<API key> .contacts span + span {
margin-top: 0;
display: inline-block; } }
@media (min-width: 960px) {
header .<API key> .contacts span + span::before {
content: "|"; } }
header .<API key> .uk-navbar {
background: transparent; }
header .<API key> .uk-navbar .uk-navbar-nav {
float: none;
text-align: center; }
@media screen and (min-width: 1220px) {
header .<API key> .uk-navbar .uk-navbar-nav {
text-align: right; } }
header .<API key> .uk-navbar .uk-navbar-nav > li {
float: none;
display: inline-block;
text-align: left; }
header .<API key> .uk-navbar .uk-navbar-nav > li > a {
font-family: 'Play', Arial, sans-serif;
letter-spacing: 1px;
text-transform: uppercase;
padding: 0 5px;
background: transparent;
font-size: 16px;
border-radius: 3px;
color: #00a8c7;
display: inline-block; }
header .<API key> .uk-navbar .uk-navbar-nav > li > a:hover {
background: rgba(0, 122, 234, 0.1); }
header .<API key> .uk-navbar .uk-navbar-nav > li + li::before {
color: #00a8c7;
content: "|"; }
header .<API key> .uk-navbar .uk-navbar-nav > li.uk-active > a {
background: rgba(0, 122, 234, 0.1); }
header .<API key> .uk-navbar.uk-active {
background: white;
border-bottom: 2px #00a8c7 solid;
left: 0;
right: 0; }
header .<API key> .uk-navbar.uk-active .uk-navbar-nav {
text-align: center; }
header .<API key> .uk-navbar.uk-active .uk-navbar-nav li > a,
header .<API key> .uk-navbar.uk-active .uk-navbar-nav li.uk-open > a {
color: black;
text-shadow: none;
text-decoration: none; }
header .<API key> .uk-navbar.uk-active .uk-navbar-nav li > a:hover,
header .<API key> .uk-navbar.uk-active .uk-navbar-nav li.uk-open > a:hover {
border-radius: 0; }
header .<API key> .uk-navbar.uk-active .uk-navbar-nav > li + li::before {
content: none; }
header .<API key> .uk-navbar.uk-active .uk-navbar-nav li.uk-active > a {
border-radius: 0;
background: #00a8c7;
color: white; }
header .uk-offcanvas .uk-nav-sub {
background: rgba(255, 255, 255, 0.2); }
header .uk-offcanvas .uk-nav-sub li a {
padding: 5px 0; }
footer {
background: 50% 50%/cover url("../img/<API key>.jpg");
color: white;
text-align: center;
padding: 50px 0; }
@media screen and (min-width: 960px) {
footer {
background: 50% 50%/cover url("../img/footer_background.jpg"); } }
@media screen and (max-width: 768px) {
footer [class*=uk-width] + [class*=uk-width] {
margin-top: 25px; } }
footer .company_name_row {
font-size: 18px; }
@media screen and (min-width: 960px) {
footer .company_name_row {
display: flex;
justify-content: space-between;
font-size: 20px; } }
footer .company_name_row p {
margin: 0;
color: #00a8c7;
text-transform: uppercase; }
footer .company_name_row p.company_name {
color: #ff001b;
font-size: 32px; }
footer .company_name_row p:first-child {
text-align: left; }
footer .company_name_row p:last-child {
text-align: right; }
footer h3 {
color: white; }
@media (min-height: 500px) and (min-width: 960px) {
.main-section .<API key> {
height: 100vh;
overflow: hidden; } }
.main-section .<API key> .uk-slidenav {
background: rgba(0, 0, 0, 0.2); }
.main-section .<API key> .uk-overlay-panel {
position: relative; }
.main-section .<API key> .uk-overlay-panel .overlay-content {
color: #00a8c7;
font-family: 'Comfortaa', cursive;
text-align: center;
font-size: 18px;
padding: 20px;
background: rgba(255, 255, 255, 0); }
@media (min-width: 960px) {
.main-section .<API key> .uk-overlay-panel .overlay-content {
position: absolute;
max-width: 600px;
right: 50%;
margin-right: -300px;
bottom: 350px;
font-size: 36px; } }
.main-section .<API key> .uk-overlay-panel .overlay-content p {
background: rgba(255, 255, 255, 0.7);
padding: 10px 10px 5px;
display: inline-block;
margin: 0; }
.main-section .<API key> .uk-overlay-panel .overlay-content p.company_name {
color: #ff001b;
font-size: 24px;
text-align: center; }
@media (min-width: 960px) {
.main-section .<API key> .uk-overlay-panel .overlay-content p.company_name {
font-size: 48px; } }
.about {
background: rgba(50, 80, 82, 0.08);
padding-top: 15px;
padding-bottom: 15px;
font-size: 18px;
text-align: justify; }
.about img {
display: block;
margin: 0 auto;
border-radius: 3px; }
@media screen and (min-width: 768px) {
.about {
text-align: left; } }
.about [data-uk-switcher] {
display: flex;
list-style: none;
padding: 0;
margin: 0 0 10px 0;
justify-content: space-around; }
.about [data-uk-switcher] li {
flex: 1;
cursor: pointer; }
.about [data-uk-switcher] li[aria-expanded=true] {
background: rgba(0, 0, 0, 0.1); }
.about h2 {
font-weight: bold;
padding: 10px 0;
text-align: center;
margin: 0;
font-size: 20px; }
@media screen and (min-width: 768px) {
.about h2 {
font-size: 28px; } }
.services {
background: 50% 50%/cover url("../img/<API key>.jpg");
padding: 25px 0;
color: white; }
.services h2 {
color: white; }
.services .uk-grid {
padding-top: 25px; }
.services .uk-grid > li {
display: flex;
align-items: center; }
.services .uk-grid > li img {
margin-right: 30px;
max-width: 100px; }
@media screen and (min-width: 768px) {
.services .uk-grid > li img {
max-width: none; } }
.services .uk-grid > li h4 {
color: white;
font-size: 18px; }
.partners .partners-map {
margin: 0;
padding: 0;
min-height: 180px; }
@media screen and (min-width: 768px) {
.partners .content-container {
border: 2px solid #d6b883; } }
.partners .profile-container {
text-align: center; }
@media screen and (min-width: 768px) {
.partners .profile-container {
padding-left: 0; } }
.partners .text-container {
padding: 15px; }
.partners .nav-container {
display: flex;
align-items: stretch; }
.partners .uk-nav {
display: flex;
flex-flow: column;
width: 100%; }
.partners .uk-nav > li {
flex: 1;
display: flex; }
.partners .uk-nav > li > a {
width: 100%;
display: flex;
align-items: center;
color: black;
border: 2px #d6b883 solid;
border-top: none;
margin: 0; }
.partners .uk-nav > li:first-child a {
border-top: 2px #d6b883 solid; }
.partners .uk-nav > li.uk-active a {
background: url("../img/partners_background.jpg"); }
.partners .contacts_and_map {
background: url("../img/partners_background.jpg");
margin: 0;
padding: 0; }
.feedback {
margin: 35px 0 0;
background: 50% 50%/cover url("../img/<API key>.jpg");
padding: 35px 0; }
@media screen and (min-width: 960px) {
.feedback {
background: 50% 50%/cover url("../img/feedback_background.jpg"); } }
.feedback form {
max-width: 330px;
margin: 0 auto; }
.feedback form input,
.feedback form textarea {
font-family: Play, Arial, sans-serif;
box-sizing: border-box;
background: transparent;
border: 1px solid white;
padding: 7px 15px;
color: white;
width: 100%;
border-radius: 3px; }
.feedback form input:not([type=submit]) {
margin-bottom: 20px; }
.feedback form input[type=submit] {
padding: 10px 20px;
float: right;
width: auto; }
.feedback form input[type=submit]:hover {
cursor: pointer;
background: white;
color: black; }
.feedback form textarea {
margin-bottom: 20px;
min-height: 180px;
resize: none; }
.feedback .text-section {
color: white;
font-size: 24px; }
.feedback .text-section h2 {
color: white; }
.reviews {
padding: 20px 0;
text-align: center; }
.reviews h2 {
margin-bottom: 25px; }
.reviews h3 {
font-family: 'Bebas Neue', Arial, sans-serif;
font-weight: bold;
font-size: 32px; }
@media (min-width: 960px) {
.reviews .data-uk-slider {
position: relative;
padding: 0 75px; }
.reviews .data-uk-slider > .uk-slidenav {
top: 10%;
display: block;
position: absolute; }
.reviews .data-uk-slider > .uk-slidenav::before {
content: ""; }
.reviews .data-uk-slider > .uk-slidenav img {
height: auto;
width: auto; }
.reviews .data-uk-slider > .uk-slidenav.<API key> {
left: 0; }
.reviews .data-uk-slider > .uk-slidenav.uk-slidenav-next {
right: 0; } }
@media (max-width: 960px) {
.reviews .data-uk-slider > .uk-slidenav img {
display: none; } }
.publications {
padding: 25px 0; }
.publications h2 {
text-align: center; }
.publications h3 {
font-size: 24px;
margin-top: 0; }
.publications article.uk-grid {
margin: 15px 0; }
@media screen and (min-width: 768px) {
.publications article.uk-grid {
margin: 50px 0 30px; } }
@media screen and (max-width: 768px) {
.publications .text-section {
margin: 25px 0; } }
.publications .more-btn.all {
float: none;
margin: 0 auto; }
/*# sourceMappingURL=styles.css.map */ |
package de.unibayreuth.bayeos.goat.panels.attributes;
import java.awt.BorderLayout;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.unibayreuth.bayceer.bayeos.objekt.Mess_Ort;
import de.unibayreuth.bayeos.goat.JMainFrame;
import de.unibayreuth.bayeos.goat.panels.UpdatePanel;
import de.unibayreuth.bayeos.utils.MsgBox;
/**
*
* @author oliver
*/
public class JOrtPanel extends UpdatePanel {
final static Logger logger = Logger.getLogger(JOrtPanel.class.getName());
private OrtForm frm;
/** Creates new form dpMessungen */
public JOrtPanel(JMainFrame app) {
super(app);
frm = new OrtForm();
add(frm,BorderLayout.CENTER);
}
public boolean loadData() {
try {
Mess_Ort ort = (Mess_Ort)helper.getObjekt(objektNode.getId(),objektNode.getObjektart());
if (ort == null) return false;
frm.setId(ort.getId());
frm.setObjektArt(ort.getObjektart());
frm.setBeschreibung(ort.getBeschreibung());
frm.setXValue(ort.getX());
frm.setYValue(ort.getY());
frm.setZValue(ort.getZ());
frm.setCRSId(ort.getCRSId());
frm.setCTime(ort.getCtime());
frm.setUTime(ort.getUtime());
frm.setCBenutzer(ort.getCbenutzer());
frm.setUBenutzer(ort.getUbenutzer());
boolean enabled = ort.getCheck_write().booleanValue();
frm.setEditable(enabled); // Fields
setEditable(enabled); // Buttons
return true;
} catch (ClassCastException c) {
logger.error(c.getMessage());
return false;
}
}
public boolean updateData() {
try {
Vector attrib = new Vector();
attrib.add(objektNode.getDe());
attrib.add(frm.getBeschreibung());
attrib.add(frm.getXValue());
attrib.add(frm.getYValue());
attrib.add(frm.getZValue());
attrib.add(frm.getCRSId());
return helper.updateObjekt(frm.getId(),frm.getObjektArt(),attrib);
} catch (<API key> n) {
logger.error(n.getMessage());
MsgBox.error(JOrtPanel.this,"Wrong number format.");
return false;
}
}
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="DC.type" http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<head>2005/559/: Decision No&nbsp;2/2005 of the EC-EFTA Joint Committee on common transit of 17 June 2005 amending the Convention of 20 May 1987 on a common transit procedure</head>
<div type="body">
<p>Decision No 2/2005 of the EC-EFTA Joint Committee on common transit</p>
<p>of 17 June 2005</p>
<p>amending the Convention of 20 May 1987 on a common transit procedure</p>
<p>(2005/559/EC)</p>
<p>THE JOINT COMMITTEE,</p>
<p>Having regard to the Convention of 20 May 1987 on a common transit procedure [1], and in particular Article 15(3)(a) thereof,</p>
<p>Whereas:</p>
<p>(1) The identity and nationality of means of transport at departure is regarded as mandatory information that has to be entered in box 18 of a transit declaration.</p>
<p>(2) At container terminals that have high levels of traffic it may occur that the details of the road means of transport to be used for the transport are unknown at the time when the transit formalities are carried out. Nevertheless, the identification of the container in which the goods subject to the transit declaration will be carried is available and is already indicated in box 31 of the transit declaration.</p>
<p>(3) Under these circumstances and considering that the goods can be controlled on this basis, an appropriate degree of flexibility should be offered by allowing the box 18 of the transit declaration not to be completed, in so far as it can be ensured that the proper details will be subsequently entered in the relevant box.</p>
<p>(4) The Convention should therefore be amended accordingly,</p>
<p>HAS DECIDED AS FOLLOWS:</p>
<p>Article 1</p>
<p>Annex A7 of Appendix III to the Convention of 20 May 1987 on a common transit procedure shall be amended in accordance with the Annex to this Decision.</p>
<p>Article 2</p>
<p>This decision shall enter into force on the day it is adopted.</p>
<p>It shall apply from 1 July 2005.</p>
</div>
<div type="signature">
<p>Done at Bern, 17 June 2005.</p>
<p>For the Joint Committee</p>
<p>The Chairman</p>
<p>Rudolf Dietrich</p>
<p>[1] OJ L 226, 13.8.1987, p. 2. Convention as last amended by Decision No 2/2002 (OJ L 4, 9.1.2003, p. 18).</p>
<p>
</div>
<div type="annex">
<p>ANNEX</p>
<p>In Annex A7 to Appendix III, Title II, Point I of the Convention of 20 May 1987 on a common transit procedure, the following shall be inserted as a second subparagraph in the explanatory note for box 18:</p>
<p>"However, where goods are carried in containers that are to be transported by road vehicles, competent authorities may authorise the principal to leave this box blank where the logistical pattern at the point of departure may prevent the identity and nationality of the means of transport to be provided at the time of establishment of the transit declaration, and where they can ensure that the proper information concerning the means of transport shall be subsequently entered in box 55."</p>
<p>
</div>
</body>
</html> |
package com.tincent.demo.fragment;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Message;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.tincent.android.http.TXResponseEvent;
import com.tincent.android.view.<API key>;
import com.tincent.demo.R;
import com.tincent.demo.activity.SettingActivity;
import com.tincent.demo.adapter.MimeFragmentAdapter;
/**
* @author hui.wang
*
*/
public class MineFragment extends BaseFragment {
private PagerAdapter pagerAdapter;
private ViewPager viewPager;
private <API key> tabStrip;
@Override
public View createView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_mine, container, false);
}
@Override
public void initView(View rootView) {
rootView.findViewById(R.id.back).setVisibility(View.GONE);
TextView title = (TextView) rootView.findViewById(R.id.title);
title.setText("");
rootView.findViewById(R.id.more).setVisibility(View.VISIBLE);
rootView.findViewById(R.id.more).setOnClickListener(this);
viewPager = (ViewPager) rootView.findViewById(R.id.view_pager);
pagerAdapter = new MimeFragmentAdapter(getActivity().<API key>());
viewPager.setAdapter(pagerAdapter);
viewPager.<API key>(2);
DisplayMetrics dm = getResources().getDisplayMetrics();
tabStrip = (<API key>) rootView.findViewById(R.id.tab_strip);
tabStrip.setTextColor(Color.parseColor("#2c8cc6"));
tabStrip.setShouldExpand(true);
tabStrip.setViewPager(viewPager);
tabStrip.setVisibility(View.VISIBLE);
tabStrip.setIndicatorColor(Color.parseColor("#2c8cc6"));
// tab
tabStrip.setUnderlineHeight((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, dm));
tabStrip.setIndicatorHeight((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2, dm));
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.more:
startActivity(new Intent(getActivity(), SettingActivity.class));
break;
}
}
@Override
public boolean handleMessage(Message msg) {
return false;
}
@Override
public void onResponseSuccess(TXResponseEvent evt) {
}
@Override
public void initData() {
}
@Override
public void updateView() {
}
} |
#include <faunus/faunus.h>
//#include "range.hpp"
using namespace Faunus;
typedef Geometry::Cuboid Tgeometry; // select simulation geometry
typedef Potential::CoulombHS Tpairpot;
int main() {
Group g(100,1);
g.resize(0);
cout << "size = " << g.size() << endl;
cout << "range = " << g.front() << " " << g.back() << endl;
cout << "empty bool = " << g.empty() << endl;
for (auto i=g.begin(); i!=g.end(); i++)
cout << *i << endl;
cout << textio::splash();
atom.includefile("atomlist.inp"); // load atom properties
InputMap mcp("bulk.inp");
MCLoop loop(mcp); // class for handling mc loops
FormatPQR pqr; // PQR structure file I/O
EnergyDrift sys; // class for tracking system energy drifts
Energy::Hamiltonian pot;
auto nonbonded = pot.create( Energy::Nonbonded<Tpairpot,Tgeometry>(mcp) );
Space spc( pot.getGeometry() );
// Handle particles
GroupAtomic salt(spc, mcp);
salt.name="Salt";
spc.load("space.state", Space::RESIZE);
Move::GrandCanonicalSalt gc(mcp,pot,spc,salt);
Move::AtomicTranslation mv(mcp, pot, spc); // Particle move class
mv.setGroup(salt);
// Widom particle insertion
Analysis::RadialDistribution<float,unsigned int> rdf(0.2);
rdf.maxdist = 50.;
particle a;
Analysis::Widom widom(spc, pot);
a = atom["Cl"];
widom.addGhost( spc);
widom.addGhost( a );
#define UTOTAL \
+ pot.g_internal(spc.p, salt) + pot.g_external(spc.p, salt)\
+ pot.external()
sys.init( UTOTAL );
cout << atom.info() << spc.info() << pot.info() << mv.info()
<< textio::header("MC Simulation Begins!");
while ( loop.macroCnt() ) { // Markov chain
while ( loop.microCnt() ) {
sys+=mv.move( salt.size() );
sys+=gc.move( salt.size()/2 );
if (slp_global.randOne()>0.9) {
widom.sample();
rdf.sample(spc,salt,atom["Na"].id, atom["Cl"].id);
}
}
sys.checkDrift( UTOTAL );
cout << loop.timing();
}
pqr.save("confout.pqr", spc.p);
spc.save("space.state");
rdf.save("rdf.dat");
cout << sys.info() << loop.info() << mv.info() << gc.info() << widom.info();
} |
#ifndef SOUNDSYSTEMFMOD_H__
#define SOUNDSYSTEMFMOD_H__
// get the interface we want to implement
#include <kerosin/soundserver/soundsystem.h>
#include <zeitgeist/class.h>
class SoundSystemFMOD : public kerosin::SoundSystem
{
public:
SoundSystemFMOD();
virtual ~SoundSystemFMOD();
bool Init(int inFreq);
void Shutdown();
float GetCPU();
kerosin::SoundEffect* CreateEffect(kerosin::SoundServer &soundServer);
kerosin::SoundStream* CreateStream(kerosin::SoundServer &soundServer);
kerosin::SoundModule* CreateModule(kerosin::SoundServer &soundServer);
};
DECLARE_CLASS(SoundSystemFMOD);
#endif //SOUNDSYSTEMFMOD_H__ |
//Purpose : Display the draws of the previous rounds in the tournament.
require("includes/display.php");
//Calculate Round Number (should have been already validated)
if(array_key_exists('action', @$_GET)) $action=@$_GET['action'];
if(array_key_exists('roundno', @$_GET)) $roundno=@$_GET['roundno'];
$validate=1;
if ( ($roundno=='')||!((intval($roundno)>0)&&(intval($roundno)<10)) )
{
$roundno=$numdraws;
if ($numdraws<=0) {
require_once("includes/http.php");
redirect("draw.php?moduletype=currentdraw");
}
}
switch($action)
{
case "showdraw": $title="Draw : Round $roundno";
break;
default:
$title="Draw : Round $roundno";
$action="showdraw";
break;
}
echo "<h2>$title</h2>\n"; //title
if(isset($msg)) displayMessagesP(@$msg);
//Display draw information
$query = "SELECT debate_id AS debate_id, T1.team_code AS ogt, T2.team_code AS oot, T3.team_code AS cgt, T4.team_code AS cot, U1.univ_code AS ogtc, U2.univ_code AS ootc, U3.univ_code AS cgtc, U4.univ_code AS cotc, venue_name, venue_location ";
$query .= "FROM draw_round_$roundno, team T1, team T2, team T3, team T4, university U1, university U2, university U3, university U4,venue ";
$query .= "WHERE og = T1.team_id AND oo = T2.team_id AND cg = T3.team_id AND co = T4.team_id AND T1.univ_id = U1.univ_id AND T2.univ_id = U2.univ_id AND T3.univ_id = U3.univ_id AND T4.univ_id = U4.univ_id AND draw_round_$roundno.venue_id=venue.venue_id ";
$query .= "ORDER BY venue_name";
$result=mysql_query($query);
echo mysql_error();
echo "<table>\n";
echo "<tr><th>Venue Name</th><th>Opening Govt</th><th>Opening Opp</th><th>Closing Govt</th><th>Closing Opp</th><th>Chair</th><th>Panelists</th><th>Trainee</th></tr>\n";
while($row=mysql_fetch_assoc($result))
{
echo "<tr>\n";
$debate_id = $row['debate_id'];
$adj_query = "SELECT AR.adjud_id as adjud_id, Ad.adjud_name as adjud_name ";
$adj_query .= "FROM adjud_round_$roundno AR, adjudicator Ad ";
$adj_query .= "WHERE debate_id = $debate_id AND AR.adjud_id = Ad.adjud_id AND AR.`status` = 'chair' ";
$adj_result=mysql_query($adj_query);
$adj_row=mysql_fetch_assoc($adj_result);
echo "<td>{$row['venue_name']}</td>\n";
echo "<td>{$row['ogtc']} {$row['ogt']}</td>\n";
echo "<td>{$row['ootc']} {$row['oot']}</td>\n";
echo "<td>{$row['cgtc']} {$row['cgt']}</td>\n";
echo "<td>{$row['cotc']} {$row['cot']}</td>\n";
echo "<td>{$adj_row['adjud_name']}</td>\n";
echo "<td>";
$pan_query = "SELECT AR.adjud_id as adjud_id, Ad.adjud_name as adjud_name ";
$pan_query .= "FROM adjud_round_$roundno AR, adjudicator Ad ";
$pan_query .= "WHERE debate_id = $debate_id AND AR.adjud_id = Ad.adjud_id AND AR.status = 'panelist' ";
$pan_result=mysql_query($pan_query);
echo mysql_error();
$num_panelists=mysql_num_rows($pan_result);
if (@$num_panelists > 0) echo "<ul>\n";
while($pan_row=mysql_fetch_assoc($pan_result))
{
echo "<li>{$pan_row['adjud_name']}</li>";
}
if (@$num_panelists > 0) echo "</ul>\n";
echo "</td>\n";
echo "<td>";
$trainee_query = "SELECT AR.adjud_id as adjud_id, Ad.adjud_name as adjud_name ";
$trainee_query .= "FROM adjud_round_$roundno AR, adjudicator Ad ";
$trainee_query .= "WHERE debate_id = $debate_id AND AR.adjud_id = Ad.adjud_id AND AR.status = 'trainee' ";
$trainee_result=mysql_query($trainee_query);
echo mysql_error();
$num_trainee=mysql_num_rows($trainee_result);
if ($num_trainee > 0) echo "<ul>\n";
while($trainee_row=mysql_fetch_assoc($trainee_result))
{
echo "<li>{$trainee_row['adjud_name']}</li>";
}
if ($num_trainee > 0) echo "</ul>\n";
echo "</td>\n";
echo "</tr>\n";
}
echo "</table>\n";
?> |
<!DOCTYPE HTML PUBLIC "-
<!-- NewPage -->
<html lang="zh">
<head>
<!-- Generated by javadoc (1.8.0_77) on Fri Apr 29 17:47:16 CST 2016 -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>cn.bmob.newim.db </title>
<meta name="date" content="2016-04-29">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="cn.bmob.newim.db \u7C7B\u5206\u5C42\u7ED3\u6784";
}
}
catch(err) {
}
</script>
<noscript>
<div> JavaScript</div>
</noscript>
<div class="topNav"><a name="navbar.top">
</a>
<div class="skipNav"><a href="#skip.navbar.top" title=""></a></div>
<a name="navbar.top.firstrow">
</a>
<ul class="navList" title="">
<li><a href="../../../../overview-summary.html"></a></li>
<li><a href="package-summary.html"></a></li>
<li></li>
<li></li>
<li class="navBarCell1Rev"></li>
<li><a href="../../../../deprecated-list.html"></a></li>
<li><a href="../../../../index-files/index-1.html"></a></li>
<li><a href="../../../../help-doc.html"></a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../cn/bmob/newim/core/package-tree.html"></a></li>
<li><a href="../../../../cn/bmob/newim/event/package-tree.html"></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?cn/bmob/newim/db/package-tree.html" target="_top"></a></li>
<li><a href="package-tree.html" target="_top"></a></li>
</ul>
<ul class="navList" id="<API key>">
<li><a href="../../../../allclasses-noframe.html"></a></li>
</ul>
<div>
<script type="text/javascript"><!
allClassesLink = document.getElementById("<API key>");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
</script>
</div>
<a name="skip.navbar.top">
</a></div>
<div class="header">
<h1 class="title">cn.bmob.newim.db</h1>
<span class="<API key>">:</span>
<ul class="horizontal">
<li><a href="../../../../overview-tree.html"></a></li>
</ul>
</div>
<div class="contentContainer">
<h2 title=""></h2>
<ul>
<li type="circle">java.lang.Object
<ul>
<li type="circle">cn.bmob.newim.db.<a href="../../../../cn/bmob/newim/db/BmobIMDBManager.html" title="cn.bmob.newim.db"><span class="typeNameLink">BmobIMDBManager</span></a></li>
</ul>
</li>
</ul>
<h2 title=""></h2>
<ul>
<li type="circle">cn.bmob.newim.db.<a href="../../../../cn/bmob/newim/db/BmobIMDBManager.DBQueryCallback.html" title="cn.bmob.newim.db"><span class="typeNameLink">BmobIMDBManager.DBQueryCallback</span></a></li>
<li type="circle">cn.bmob.newim.db.<a href="../../../../cn/bmob/newim/db/BmobIMDBManager.DBQueryListener.html" title="cn.bmob.newim.db"><span class="typeNameLink">BmobIMDBManager.DBQueryListener</span></a></li>
</ul>
</div>
<div class="bottomNav"><a name="navbar.bottom">
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title=""></a></div>
<a name="navbar.bottom.firstrow">
</a>
<ul class="navList" title="">
<li><a href="../../../../overview-summary.html"></a></li>
<li><a href="package-summary.html"></a></li>
<li></li>
<li></li>
<li class="navBarCell1Rev"></li>
<li><a href="../../../../deprecated-list.html"></a></li>
<li><a href="../../../../index-files/index-1.html"></a></li>
<li><a href="../../../../help-doc.html"></a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../cn/bmob/newim/core/package-tree.html"></a></li>
<li><a href="../../../../cn/bmob/newim/event/package-tree.html"></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?cn/bmob/newim/db/package-tree.html" target="_top"></a></li>
<li><a href="package-tree.html" target="_top"></a></li>
</ul>
<ul class="navList" id="<API key>">
<li><a href="../../../../allclasses-noframe.html"></a></li>
</ul>
<div>
<script type="text/javascript"><!
allClassesLink = document.getElementById("<API key>");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
</script>
</div>
<a name="skip.navbar.bottom">
</a></div>
</body>
</html> |
package com.openteach.openshop.server.webapp.plugin.yeepay;
import java.math.BigDecimal;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Component;
import com.openteach.openshop.server.service.entity.Payment;
import com.openteach.openshop.server.service.entity.PluginConfig;
import com.openteach.openshop.server.service.plugin.PaymentPlugin;
import com.openteach.openshop.server.service.util.WebUtils;
/**
* Plugin -
*
* @author AIGECHIBAOLE Team
* @version 0.0.1
*/
@Component("yeepayPlugin")
public class YeepayPlugin extends PaymentPlugin {
@Override
public String getName() {
return "";
}
@Override
public String getVersion() {
return "1.0";
}
@Override
public String getAuthor() {
return "aigechibaole";
}
@Override
public String getSiteUrl() {
return "http:
}
@Override
public String getInstallUrl() {
return "yeepay/install.jhtml";
}
@Override
public String getUninstallUrl() {
return "yeepay/uninstall.jhtml";
}
@Override
public String getSettingUrl() {
return "yeepay/setting.jhtml";
}
@Override
public String getRequestUrl() {
return "https:
}
@Override
public RequestMethod getRequestMethod() {
return RequestMethod.get;
}
@Override
public String getRequestCharset() {
return "GBK";
}
@Override
public Map<String, Object> getParameterMap(String sn, String description, HttpServletRequest request) {
PluginConfig pluginConfig = getPluginConfig();
Payment payment = getPayment(sn);
Map<String, Object> parameterMap = new LinkedHashMap<String, Object>();
parameterMap.put("p0_Cmd", "Buy");
parameterMap.put("p1_MerId", pluginConfig.getAttribute("partner"));
parameterMap.put("p2_Order", sn);
parameterMap.put("p3_Amt", payment.getAmount().setScale(2).toString());
parameterMap.put("p4_Cur", "CNY");
parameterMap.put("p5_Pid", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 20));
parameterMap.put("p7_Pdesc", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 20));
parameterMap.put("p8_Url", getNotifyUrl(sn, NotifyMethod.general));
parameterMap.put("p9_SAF", "0");
parameterMap.put("pa_MP", "shopxx");
parameterMap.put("pr_NeedResponse", "1");
parameterMap.put("hmac", generateSign(parameterMap));
return parameterMap;
}
@Override
public boolean verifyNotify(String sn, NotifyMethod notifyMethod, HttpServletRequest request) {
PluginConfig pluginConfig = getPluginConfig();
Payment payment = getPayment(sn);
Map<String, String[]> parameterValuesMap = WebUtils.getParameterMap(request.getQueryString(), "GBK");
Map<String, Object> parameterMap = new LinkedHashMap<String, Object>();
parameterMap.put("p1_MerId", parameterValuesMap.get("p1_MerId"));
parameterMap.put("r0_Cmd", parameterValuesMap.get("r0_Cmd"));
parameterMap.put("r1_Code", parameterValuesMap.get("r1_Code"));
parameterMap.put("r2_TrxId", parameterValuesMap.get("r2_TrxId"));
parameterMap.put("r3_Amt", parameterValuesMap.get("r3_Amt"));
parameterMap.put("r4_Cur", parameterValuesMap.get("r4_Cur"));
parameterMap.put("r5_Pid", parameterValuesMap.get("r5_Pid"));
parameterMap.put("r6_Order", parameterValuesMap.get("r6_Order"));
parameterMap.put("r7_Uid", parameterValuesMap.get("r7_Uid"));
parameterMap.put("r8_MP", parameterValuesMap.get("r8_MP"));
parameterMap.put("r9_BType", parameterValuesMap.get("r9_BType"));
if (generateSign(parameterMap).equals(parameterValuesMap.get("hmac")[0]) && pluginConfig.getAttribute("partner").equals(parameterValuesMap.get("p1_MerId")[0]) && sn.equals(parameterValuesMap.get("r6_Order")[0]) && "1".equals(parameterValuesMap.get("r1_Code")[0]) && payment.getAmount().compareTo(new BigDecimal(parameterValuesMap.get("r3_Amt")[0])) == 0) {
return true;
}
return false;
}
@Override
public String getNotifyMessage(String sn, NotifyMethod notifyMethod, HttpServletRequest request) {
if ("2".equals(WebUtils.getParameter(request.getQueryString(), "GBK", "r9_BType"))) {
return "success";
}
return null;
}
@Override
public Integer getTimeout() {
return 21600;
}
/**
*
*
* @param parameterMap
*
* @return
*/
private String generateSign(Map<String, Object> parameterMap) {
PluginConfig pluginConfig = getPluginConfig();
return hmacDigest(joinValue(parameterMap, null, null, null, false, "hmac"), pluginConfig.getAttribute("key"));
}
/**
* Hmac
*
* @param value
*
* @param key
*
* @return
*/
private String hmacDigest(String value, String key) {
try {
Mac mac = Mac.getInstance("HmacMD5");
mac.init(new SecretKeySpec(key.getBytes("UTF-8"), "HmacMD5"));
byte[] bytes = mac.doFinal(value.getBytes("UTF-8"));
StringBuffer digest = new StringBuffer();
for (int i = 0; i < bytes.length; i++) {
String hex = Integer.toHexString(0xFF & bytes[i]);
if (hex.length() == 1) {
digest.append("0");
}
digest.append(hex);
}
return digest.toString();
} catch (Exception e) {
return null;
}
}
} |
#ifndef __ASM_SMP_H
#define __ASM_SMP_H
/*
* We need the APIC definitions automatically as part of 'smp.h'
*/
#ifndef __ASSEMBLY__
#include <linux/threads.h>
#include <linux/cpumask.h>
#include <linux/bitops.h>
extern int disable_apic;
#endif
#ifdef <API key>
#ifndef __ASSEMBLY__
#include <asm/fixmap.h>
#include <asm/mpspec.h>
#ifdef CONFIG_X86_IO_APIC
#include <asm/io_apic.h>
#endif
#include <asm/apic.h>
#include <asm/thread_info.h>
#endif
#endif
#ifdef CONFIG_SMP
#ifndef ASSEMBLY
#include <asm/pda.h>
struct pt_regs;
extern cpumask_t cpu_present_mask;
extern cpumask_t cpu_possible_map;
extern cpumask_t cpu_online_map;
extern cpumask_t cpu_initialized;
/*
* Private routines/data
*/
extern void smp_alloc_memory(void);
extern volatile unsigned long <API key>;
extern int pic_mode;
extern void lock_ipi_call_lock(void);
extern void <API key>(void);
extern int smp_num_siblings;
extern void smp_send_reschedule(int cpu);
void smp_stop_cpu(void);
extern int <API key>(int cpuid, void (*func) (void *info),
void *info, int retry, int wait);
extern cpumask_t cpu_sibling_map[NR_CPUS];
extern cpumask_t cpu_core_map[NR_CPUS];
extern u8 cpu_llc_id[NR_CPUS];
#define SMP_TRAMPOLINE_BASE 0x6000
/*
* On x86 all CPUs are mapped 1:1 to the APIC space.
* This simplifies scheduling and IPI sending and
* compresses data structures.
*/
static inline int num_booting_cpus(void)
{
return cpus_weight(cpu_possible_map);
}
#define <API key>() read_pda(cpunumber)
#ifdef <API key>
static inline int <API key>(void)
{
/* we don't want to mark this access volatile - bad code generation */
return GET_APIC_ID(*(unsigned int *)(APIC_BASE+APIC_ID));
}
#endif
extern int <API key>(void);
extern int __cpu_disable(void);
extern void __cpu_die(unsigned int cpu);
extern void <API key>(void);
extern unsigned num_processors;
extern unsigned disabled_cpus;
#endif /* !ASSEMBLY */
#define NO_PROC_ID 0xFF /* No processor magic marker */
#endif
#ifndef ASSEMBLY
/*
* Some lowlevel functions might want to know about
* the real APIC ID <-> CPU # mapping.
*/
extern u8 x86_cpu_to_apicid[NR_CPUS]; /* physical ID */
extern u8 <API key>[NR_CPUS];
extern u8 bios_cpu_apicid[];
#ifdef <API key>
static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask)
{
return cpus_addr(cpumask)[0];
}
static inline int <API key>(int mps_cpu)
{
if (mps_cpu < NR_CPUS)
return (int)bios_cpu_apicid[mps_cpu];
else
return BAD_APICID;
}
#endif
#endif /* !ASSEMBLY */
#ifndef CONFIG_SMP
#define <API key>() 0
#define <API key>() 0
#define cpu_logical_map(x) (x)
#else
#include <asm/thread_info.h>
#define <API key>() \
({ \
struct thread_info *ti; \
__asm__("andq %%rsp,%0; ":"=r" (ti) : "0" (CURRENT_MASK)); \
ti->cpu; \
})
#endif
#ifndef __ASSEMBLY__
#ifdef <API key>
static __inline int <API key>(void)
{
/* we don't want to mark this access volatile - bad code generation */
return GET_APIC_LOGICAL_ID(*(unsigned long *)(APIC_BASE+APIC_LDR));
}
#endif
#endif
#ifdef CONFIG_SMP
#define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu]
#else
#define cpu_physical_id(cpu) boot_cpu_id
#endif
#endif |
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Tryit Editor v2.3</title>
<meta id="viewport" name='viewport'>
<script>
(function() {
if ( navigator.userAgent.match(/iPad/i) ) {
document.getElementById('viewport').setAttribute("content", "width=device-width, initial-scale=0.9");
}
}());
</script>
<link rel="stylesheet" href="../trycss.css">
<!--[if lt IE 8]>
<style>
.textareacontainer, .iframecontainer {width:48%;}
.textarea, .iframe {height:800px;}
#textareaCode, #iframeResult {height:700px;}
.menu img {display:none;}
</style>
<![endif]
<script>
(function(i,s,o,g,r,a,m){i['<API key>']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.<API key>(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','../../www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-3855518-1', 'auto');
ga('require', 'displayfeatures');
ga('send', 'pageview');
</script>
<script>
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
(function() {
var gads = document.createElement('script');
gads.async = true;
gads.type = 'text/javascript';
var useSSL = 'https:' == document.location.protocol;
gads.src = (useSSL ? 'https:' : 'http:') +
'
var node = document.<API key>('script')[0];
node.parentNode.insertBefore(gads, node);
})();
</script>
<script>
googletag.cmd.push(function() {
googletag.defineSlot('/16833175/TryitLeaderboard', [[728, 90], [970, 90]], '<API key>').addService(googletag.pubads());
googletag.pubads().setTargeting("content","tryjs");
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
</script>
<script type="text/javascript">
function submitTryit()
{
var t=document.getElementById("textareaCode").value;
t=t.replace(/=/gi,"w3equalsign");
var pos=t.search(/script/i)
while (pos>0)
{
t=t.substring(0,pos) + "w3" + t.substr(pos,3) + "w3" + t.substr(pos+3,3) + "tag" + t.substr(pos+6);
pos=t.search(/script/i);
}
if ( navigator.userAgent.match(/Safari/i) ) {
t=escape(t);
document.getElementById("bt").value="1";
}
document.getElementById("code").value=t;
document.getElementById("tryitform").action="tryit_view52a0.html?x=" + Math.random();
validateForm();
document.getElementById("iframeResult").contentWindow.name = "view";
document.getElementById("tryitform").submit();
}
function validateForm()
{
var code=document.getElementById("code").value;
if (code.length>8000)
{
document.getElementById("code").value="<h1>Error</h1>";
}
}
</script>
<style>
</style>
</head>
<body>
<div id="ads">
<div style="position:relative;width:100%;margin-top:0px;margin-bottom:0px;">
<div style="width:974px;height:94px;position:relative;margin:0px;margin-top:5px;margin-bottom:5px;margin-right:auto;margin-left:auto;padding:0px;overflow:hidden;">
<!-- TryitLeaderboard -->
<div id='<API key>' style='width:970px; height:90px;'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('<API key>'); });
</script>
</div>
<div style="clear:both"></div>
</div>
</div>
</div>
<div class="container">
<div class="textareacontainer">
<div class="textarea">
<div class="headerText" style="width:auto;float:left;">Edit This Code:</div>
<div class="headerBtnDiv" style="width:auto;float:right;margin-top:8px;margin-right:2.4%;"><button class="submit" type="button" onclick="submitTryit()">See Result »</button></div>
<div class="textareawrapper">
<textarea autocomplete="off" class="code_input" id="textareaCode" wrap="logical" xrows="30" xcols="50"><!DOCTYPE html>
<html>
<head>
</head>
<body>
<p id="demo"></p>
<p>With the debugger turned on, the code below should stop executing before it executes the third line.</p>
<script>
var x = 15 * 5;
debugger;
document.getElementById("demo").innerHTML = x;
</script>
</body>
</html>
</textarea>
<form autocomplete="off" style="margin:0px;display:none;" action="http:
<input type="hidden" name="code" id="code" />
<input type="hidden" id="bt" name="bt" />
</form>
</div>
</div>
</div>
<div class="iframecontainer">
<div class="iframe">
<div class="headerText resultHeader">Result:</div>
<div class="iframewrapper">
<iframe id="iframeResult" class="result_output" frameborder="0" name="view" xsrc="tryjs_debugger.html"></iframe>
</div>
<div class="footerText">Try it Yourself - © <a href="../index.html">w3schools.com</a></div>
</div>
</div>
</div>
<script>submitTryit()</script>
</body>
</html> |
import {
isBusinessPlan,
isCompletePlan,
isJetpackPlanSlug,
isPersonalPlan,
isPremiumPlan,
isSecurityDailyPlan,
<API key>,
} from '@automattic/calypso-products';
import { useTranslate } from 'i18n-calypso';
import * as React from 'react';
/*
* Show a list of Jetpack benefits that do not depend on site data
* These can vary by plan, but we do not need to get any data about the site to show these
* This is similar to the disconnection flow where some plan benefits are listed if a user is disconnecting Jetpack
*/
interface Props {
productSlug: string;
}
const <API key>: React.FC< Props > = ( props ) => {
const translate = useTranslate();
const { productSlug } = props;
const <API key> = isSecurityDailyPlan( productSlug );
const <API key> = <API key>( productSlug );
const hasCompletePlan = isCompletePlan( productSlug );
const hasPersonalPlan = isPersonalPlan( productSlug );
const hasPremiumPlan = isPremiumPlan( productSlug );
const hasBusinessPlan = isBusinessPlan( productSlug );
const hasJetpackPlanSlug = isJetpackPlanSlug( productSlug );
const benefits = [];
// Priority Support
if (
<API key> ||
<API key> ||
hasCompletePlan ||
hasPersonalPlan ||
hasPremiumPlan ||
hasBusinessPlan
) {
benefits.push(
<React.Fragment>
{ translate(
"{{strong}}Priority support{{/strong}} from Jetpack's WordPress and security experts.",
{
components: {
strong: <strong />,
},
}
) }
</React.Fragment>
);
}
// Payment Collection
// Ad Program
// Google Analytics
if (
<API key> ||
<API key> ||
hasCompletePlan ||
hasPremiumPlan ||
hasBusinessPlan
) {
benefits.push(
<React.Fragment>
{ translate( 'The ability to {{strong}}collect payments{{/strong}}.', {
components: {
strong: <strong />,
},
} ) }
</React.Fragment>
);
benefits.push(
<React.Fragment>
{ translate( 'The {{strong}}Ad program{{/strong}} for WordPress.', {
components: {
strong: <strong />,
},
} ) }
</React.Fragment>
);
benefits.push(
<React.Fragment>
{ translate( 'The {{strong}}Google Analytics{{/strong}} integration.', {
components: {
strong: <strong />,
},
} ) }
</React.Fragment>
);
}
// 13GB of video hosting
if ( hasPremiumPlan || <API key> ) {
benefits.push(
<React.Fragment>
{ translate( 'Up to 13GB of {{strong}}high-speed video hosting{{/strong}}.', {
components: {
strong: <strong />,
},
} ) }
</React.Fragment>
);
}
// Unlimited Video Hosting
if ( hasBusinessPlan || <API key> || hasCompletePlan ) {
benefits.push(
<React.Fragment>
{ translate( 'Unlimited {{strong}}high-speed video hosting{{/strong}}.', {
components: {
strong: <strong />,
},
} ) }
</React.Fragment>
);
}
// General benefits of all Jetpack Plans (brute force protection, CDN)
if ( hasJetpackPlanSlug ) {
benefits.push(
<React.Fragment>
{ translate(
'Brute force {{strong}}attack protection{{/strong}} and {{strong}}downtime monitoring{{/strong}}.',
{
components: {
strong: <strong />,
},
}
) }
</React.Fragment>
);
}
if ( benefits.length > 0 ) {
return (
<ul className="<API key>">
{ benefits.map( ( benefit, idx ) => {
return <li key={ idx }>{ benefit }</li>;
} ) }
</ul>
);
}
return null;
};
export default <API key>; |
// Name: src/mac/classic/mdi.cpp
// Purpose: MDI classes
// Created: 1998-01-01
// RCS-ID: $Id: mdi.cpp 39310 2006-05-24 07:16:32Z ABX $
// Licence: wxWindows licence
#include "wx/wxprec.h"
#include "wx/mdi.h"
#ifndef WX_PRECOMP
#include "wx/log.h"
#include "wx/menu.h"
#include "wx/settings.h"
#endif
#include "wx/mac/private.h"
#include "wx/mac/uma.h"
extern wxWindowList wxModelessWindows;
<API key>(wxMDIParentFrame, wxFrame)
<API key>(wxMDIChildFrame, wxFrame)
<API key>(wxMDIClientWindow, wxWindow)
BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame)
EVT_ACTIVATE(wxMDIParentFrame::OnActivate)
<API key>(wxMDIParentFrame::OnSysColourChanged)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxMDIClientWindow, wxWindow)
EVT_SCROLL(wxMDIClientWindow::OnScroll)
END_EVENT_TABLE()
static const int IDM_WINDOWTILE = 4001;
static const int IDM_WINDOWTILEHOR = 4001;
static const int IDM_WINDOWCASCADE = 4002;
static const int IDM_WINDOWICONS = 4003;
static const int IDM_WINDOWNEXT = 4004;
static const int IDM_WINDOWTILEVERT = 4005;
static const int IDM_WINDOWPREV = 4006;
// This range gives a maximum of 500 MDI children. Should be enough :-)
static const int wxFIRST_MDI_CHILD = 4100;
static const int wxLAST_MDI_CHILD = 4600;
// Status border dimensions
static const int wxTHICK_LINE_BORDER = 3;
// Parent frame
wxMDIParentFrame::wxMDIParentFrame()
{
m_clientWindow = NULL;
m_currentChild = NULL;
m_windowMenu = (wxMenu*) NULL;
m_parentFrameActive = true;
}
bool wxMDIParentFrame::Create(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos,
const wxSize& size,
long style,
const wxString& name)
{
m_clientWindow = NULL;
m_currentChild = NULL;
// this style can be used to prevent a window from having the standard MDI
// "Window" menu
if ( style & <API key> )
{
m_windowMenu = (wxMenu *)NULL;
style -= <API key> ;
}
else // normal case: we have the window menu, so construct it
{
m_windowMenu = new wxMenu;
m_windowMenu->Append(IDM_WINDOWCASCADE, wxT("&Cascade"));
m_windowMenu->Append(IDM_WINDOWTILEHOR, wxT("Tile &Horizontally"));
m_windowMenu->Append(IDM_WINDOWTILEVERT, wxT("Tile &Vertically"));
m_windowMenu->AppendSeparator();
m_windowMenu->Append(IDM_WINDOWICONS, wxT("&Arrange Icons"));
m_windowMenu->Append(IDM_WINDOWNEXT, wxT("&Next"));
}
wxFrame::Create( parent , id , title , pos , size , style , name ) ;
m_parentFrameActive = true;
OnCreateClient();
return true;
}
wxMDIParentFrame::~wxMDIParentFrame()
{
DestroyChildren();
// already delete by DestroyChildren()
#if wxUSE_TOOLBAR
m_frameToolBar = NULL;
#endif
#if wxUSE_STATUSBAR
m_frameStatusBar = NULL;
#endif
m_clientWindow = NULL ;
if (m_windowMenu)
{
delete m_windowMenu;
m_windowMenu = (wxMenu*) NULL;
}
if ( m_clientWindow )
{
delete m_clientWindow;
m_clientWindow = NULL ;
}
}
void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar)
{
wxFrame::SetMenuBar( menu_bar ) ;
}
void wxMDIParentFrame::MacActivate(long timestamp, bool activating)
{
wxLogDebug(wxT("MDI PARENT=%p MacActivate(0x%08lx,%s)"),this,timestamp,activating?wxT("ACTIV"):wxT("deact"));
if(activating)
{
if(<API key> && <API key>->GetParent()==this)
{
wxLogDebug(wxT("child had been scheduled for deactivation, rehighlighting"));
<API key>((WindowRef)<API key>->MacGetWindowRef(), true);
wxLogDebug(wxT("done highliting child"));
<API key> = NULL;
}
else if(<API key> == this)
{
wxLogDebug(wxT("Avoided deactivation/activation of this=%p"), this);
<API key> = NULL;
}
else // window to deactivate is NULL or is not us or one of our kids
{
// activate kid instead
if(m_currentChild)
m_currentChild->MacActivate(timestamp,activating);
else
wxFrame::MacActivate(timestamp,activating);
}
}
else
{
// We were scheduled for deactivation, and now we do it.
if(<API key>==this)
{
<API key> = NULL;
if(m_currentChild)
m_currentChild->MacActivate(timestamp,activating);
wxFrame::MacActivate(timestamp,activating);
}
else // schedule ourselves for deactivation
{
if(<API key>)
wxLogDebug(wxT("window=%p SHOULD have been deactivated, oh well!"),<API key>);
wxLogDebug(wxT("Scheduling delayed MDI Parent deactivation"));
<API key> = this;
}
}
}
void wxMDIParentFrame::OnActivate(wxActivateEvent& event)
{
event.Skip();
}
// Returns the active MDI child window
wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
{
return m_currentChild ;
}
// Create the client window class (don't Create the window,
// just return a new class)
wxMDIClientWindow *wxMDIParentFrame::OnCreateClient()
{
m_clientWindow = new wxMDIClientWindow( this );
return m_clientWindow;
}
// Responds to colour changes, and passes event on to children.
void wxMDIParentFrame::OnSysColourChanged(<API key>& event)
{
// TODO
// Propagate the event to the non-top-level children
wxFrame::OnSysColourChanged(event);
}
// MDI operations
void wxMDIParentFrame::Cascade()
{
// TODO
}
void wxMDIParentFrame::Tile(wxOrientation WXUNUSED(orient))
{
// TODO
}
void wxMDIParentFrame::ArrangeIcons()
{
// TODO
}
void wxMDIParentFrame::ActivateNext()
{
// TODO
}
void wxMDIParentFrame::ActivatePrevious()
{
// TODO
}
// Child frame
wxMDIChildFrame::wxMDIChildFrame()
{
Init() ;
}
void wxMDIChildFrame::Init()
{
}
bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos,
const wxSize& size,
long style,
const wxString& name)
{
SetName(name);
if ( id != wxID_ANY )
m_windowId = id;
else
m_windowId = (int)NewControlId();
if (parent) parent->AddChild(this);
MacCreateRealWindow( title, pos , size , <API key>(style) , name ) ;
<API key> = <API key> ;
<API key>( (WindowRef) m_macWindow , <API key> , false ) ;
wxModelessWindows.Append(this);
return false;
}
wxMDIChildFrame::~wxMDIChildFrame()
{
wxMDIParentFrame *mdiparent = wxDynamicCast(m_parent, wxMDIParentFrame);
wxASSERT(mdiparent);
if(mdiparent->m_currentChild == this)
mdiparent->m_currentChild = NULL;
DestroyChildren();
// already delete by DestroyChildren()
#if wxUSE_TOOLBAR
m_frameToolBar = NULL;
#endif
#if wxUSE_STATUSBAR
m_frameStatusBar = NULL;
#endif
}
void wxMDIChildFrame::SetMenuBar(wxMenuBar *menu_bar)
{
return wxFrame::SetMenuBar( menu_bar ) ;
}
void wxMDIChildFrame::MacActivate(long timestamp, bool activating)
{
wxLogDebug(wxT("MDI child=%p MacActivate(0x%08lx,%s)"),this,timestamp,activating?wxT("ACTIV"):wxT("deact"));
wxMDIParentFrame *mdiparent = wxDynamicCast(m_parent, wxMDIParentFrame);
wxASSERT(mdiparent);
if(activating)
{
if(<API key> == m_parent)
{
wxLogDebug(wxT("parent had been scheduled for deactivation, rehighlighting"));
<API key>((WindowRef)<API key>->MacGetWindowRef(), true);
wxLogDebug(wxT("done highliting parent"));
<API key> = NULL;
}
else if((mdiparent->m_currentChild==this) || !<API key>)
mdiparent->wxFrame::MacActivate(timestamp,activating);
if(mdiparent->m_currentChild && mdiparent->m_currentChild!=this)
mdiparent->m_currentChild->wxFrame::MacActivate(timestamp,false);
mdiparent->m_currentChild = this;
if(<API key>==this)
{
wxLogDebug(wxT("Avoided deactivation/activation of this=%p"),this);
<API key>=NULL;
}
else
wxFrame::MacActivate(timestamp, activating);
}
else
{
// We were scheduled for deactivation, and now we do it.
if(<API key>==this)
{
<API key> = NULL;
wxFrame::MacActivate(timestamp,activating);
if(mdiparent->m_currentChild==this)
mdiparent->wxFrame::MacActivate(timestamp,activating);
}
else // schedule ourselves for deactivation
{
if(<API key>)
wxLogDebug(wxT("window=%p SHOULD have been deactivated, oh well!"),<API key>);
wxLogDebug(wxT("Scheduling delayed deactivation"));
<API key> = this;
}
}
}
// MDI operations
void wxMDIChildFrame::Maximize()
{
wxFrame::Maximize() ;
}
void wxMDIChildFrame::Restore()
{
wxFrame::Restore() ;
}
void wxMDIChildFrame::Activate()
{
}
// wxMDIClientWindow
wxMDIClientWindow::wxMDIClientWindow()
{
}
wxMDIClientWindow::~wxMDIClientWindow()
{
DestroyChildren();
}
bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style)
{
m_windowId = (int)NewControlId();
if ( parent )
{
parent->AddChild(this);
}
m_backgroundColour = wxSystemSettings::GetColour(<API key>);
wxModelessWindows.Append(this);
return true;
}
// Get size *available for subwindows* i.e. excluding menu bar.
void wxMDIClientWindow::DoGetClientSize(int *x, int *y) const
{
wxDisplaySize( x , y ) ;
}
// Explicitly call default scroll behaviour
void wxMDIClientWindow::OnScroll(wxScrollEvent& event)
{
} |
<?php
/**
* @file
* Default theme implementation to display the basic html structure of a single
* Drupal page.
*
* Variables:
* - $css: An array of CSS files for the current page.
* - $language: (object) The language the site is being displayed in.
* $language->language contains its textual representation.
* $language->dir contains the language direction. It will either be 'ltr' or 'rtl'.
* - $rdf_namespaces: All the RDF namespace prefixes used in the HTML document.
* - $grddl_profile: A GRDDL profile allowing agents to extract the RDF data.
* - $head_title: A modified version of the page title, for use in the TITLE
* tag.
* - $head_title_array: (array) An associative array containing the string parts
* that were used to generate the $head_title variable, already prepared to be
* output as TITLE tag. The key/value pairs may contain one or more of the
* following, depending on conditions:
* - title: The title of the current page, if any.
* - name: The name of the site.
* - slogan: The slogan of the site, if any, and if there is no title.
* - $head: Markup for the HEAD section (including meta tags, keyword tags, and
* so on).
* - $styles: Style tags necessary to import all CSS files for the page.
* - $scripts: Script tags necessary to load the JavaScript files and settings
* for the page.
* - $page_top: Initial markup from any modules that have altered the
* page. This variable should always be output first, before all other dynamic
* content.
* - $page: The rendered page content.
* - $page_bottom: Final closing markup from any modules that have altered the
* page. This variable should always be output last, after all other dynamic
* content.
* - $classes String of classes that can be used to style contextually through
* CSS.
*
* @see template_preprocess()
* @see <API key>()
* @see template_process()
*
* @ingroup themeable
*/
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"
"http:
<html xmlns="http:
<head profile="<?php print $grddl_profile; ?>">
<?php print $head; ?>
<title><?php print $head_title; ?></title>
<?php print $styles; ?>
<?php print $scripts; ?>
</head>
<body class="<?php print $classes; ?>" <?php print $attributes;?>>
<div id="skip-link">
<a href="#main-content" class="element-invisible element-focusable"><?php print t('Skip to main content'); ?></a>
</div>
<?php print $page_top; ?>
<?php //print_r($is_mobile); ?>
<?php print $page; ?>
<?php print $page_bottom; ?>
</body>
</html> |
<?php
require 'database/config.php';
$conn = getConnection();
$query = $_GET["query"];
$sql = "SELECT * FROM Pengaduan WHERE (Judul LIKE '%".$query."%' OR Lokasi LIKE '%".$query."%' OR Nama LIKE '%".$query."%' OR Isi LIKE '%".$query."%') LIMIT 5";
//$sql = "SELECT * FROM Pengaduan WHERE Judul LIKE '%".$query."%' LIMIT 5";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "<div class=\"aduan\"><h6>";
$time = strtotime($row["Tanggal"]);
$myFormatForView = date("l jS F Y", $time);
echo $myFormatForView." | ".$row['Lokasi']."</h6>
<a style=\"text-decoration:none\"href=\"detailpengaduan.php?id=".$row['Id']."\"><h3>".$row['Judul']."</h3></a> <p>".implode(' ', array_slice(explode(' ', $row['Isi']), 0, 20))."....."."</p>
<br>
<h6>Oleh : ".$row["Nama"]."</h6>
</div>";
}
} else {
echo "<p>Tidak ada hasil yang ditemukan</p>";
}
echo "<div style=\"text-align:center;margin:1em;\"><a onclick=\"showpengaduan(10)\"><input class=\"Selanjutnya\"type=\"submit\" value=\"Selanjutnya\"></a></div>";
$conn->close();
?> |
# encoding: utf-8
# module gtk.gdk
# from /usr/lib/python2.7/dist-packages/gtk-2.0/pynotify/_pynotify.so
# by generator 1.135
# no doc
# imports
from exceptions import Warning
import gio as __gio
import gobject as __gobject
import gobject._gobject as __gobject__gobject
import pango as __pango
import pangocairo as __pangocairo
class Screen(__gobject__gobject.GObject):
"""
Object GdkScreen
Signals from GdkScreen:
size-changed ()
composited-changed ()
monitors-changed ()
Properties from GdkScreen:
font-options -> gpointer: Font options
The default font options for the screen
resolution -> gdouble: Font resolution
The resolution for fonts on the screen
Signals from GObject:
notify (GParam)
"""
def <API key>(self, *args, **kwargs): # real signature unknown
pass
def <API key>(self, *args, **kwargs): # real signature unknown
pass
@classmethod
def <API key>(cls, *args, **kwargs): # real signature unknown
pass
@classmethod
def do_size_changed(cls, *args, **kwargs): # real signature unknown
pass
def get_active_window(self, *args, **kwargs): # real signature unknown
pass
def <API key>(self, *args, **kwargs): # real signature unknown
pass
def get_display(self, *args, **kwargs): # real signature unknown
pass
def get_font_options(self, *args, **kwargs): # real signature unknown
pass
def get_height(self, *args, **kwargs): # real signature unknown
pass
def get_height_mm(self, *args, **kwargs): # real signature unknown
pass
def <API key>(self, *args, **kwargs): # real signature unknown
pass
def <API key>(self, *args, **kwargs): # real signature unknown
pass
def <API key>(self, *args, **kwargs): # real signature unknown
pass
def <API key>(self, *args, **kwargs): # real signature unknown
pass
def <API key>(self, *args, **kwargs): # real signature unknown
pass
def <API key>(self, *args, **kwargs): # real signature unknown
pass
def get_number(self, *args, **kwargs): # real signature unknown
pass
def get_n_monitors(self, *args, **kwargs): # real signature unknown
pass
def get_primary_monitor(self, *args, **kwargs): # real signature unknown
pass
def get_resolution(self, *args, **kwargs): # real signature unknown
pass
def get_rgba_colormap(self, *args, **kwargs): # real signature unknown
pass
def get_rgba_visual(self, *args, **kwargs): # real signature unknown
pass
def get_rgb_colormap(self, *args, **kwargs): # real signature unknown
pass
def get_rgb_visual(self, *args, **kwargs): # real signature unknown
pass
def get_root_window(self, *args, **kwargs): # real signature unknown
pass
def get_screen_number(self, *args, **kwargs): # real signature unknown
pass
def get_setting(self, *args, **kwargs): # real signature unknown
pass
def get_system_colormap(self, *args, **kwargs): # real signature unknown
pass
def get_system_visual(self, *args, **kwargs): # real signature unknown
pass
def <API key>(self, *args, **kwargs): # real signature unknown
pass
def get_width(self, *args, **kwargs): # real signature unknown
pass
def get_width_mm(self, *args, **kwargs): # real signature unknown
pass
def <API key>(self, *args, **kwargs): # real signature unknown
pass
def is_composited(self, *args, **kwargs): # real signature unknown
pass
def list_visuals(self, *args, **kwargs): # real signature unknown
pass
def make_display_name(self, *args, **kwargs): # real signature unknown
pass
def <API key>(self, *args, **kwargs): # real signature unknown
pass
def set_font_options(self, *args, **kwargs): # real signature unknown
pass
def set_resolution(self, *args, **kwargs): # real signature unknown
pass
def <API key>(self, *args, **kwargs): # real signature unknown
pass
def __init__(self, *args, **kwargs): # real signature unknown
pass
__gtype__ = None # (!) real value is '' |
#ifndef <API key>
#define <API key>
#include "main.h"
/**
* load settings from rcfile
*
* \returns 0 if everything is ok.
*/
int
load_config_file(struct opt *opt);
/**
* save current settings to the rcfile
*
* \returns 0 if everything is ok.
*/
int
save_config_file(const struct opt *opt);
#endif |
// This program is free software; you can redistribute it and/or
// as published by the Free Software Foundation; either version 2
// This program is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// DESCRIPTION:
// Lookup tables.
// Do not try to look them up :-).
// In the order of appearance:
// int finetangent[4096] - Tangens LUT.
// Should work with BAM fairly well (12 of 16bit,
// effectively, by shifting).
// int finesine[10240] - Sine lookup.
// Guess what, serves as cosine, too.
// Remarkable thing is, how to use BAMs with this?
// int tantoangle[2049] - ArcTan LUT,
// maps tan(angle) to angle fast. Gotta search.
#include "tables.h"
// to get a global angle from cartesian coordinates, the coordinates are
// flipped until they are in the first octant of the coordinate system, then
// the y (<=x) is scaled and divided by x to get a tangent (slope) value
// which is looked up in the tantoangle[] table. The +1 size is to handle
// the case when x==y without additional checking.
int SlopeDiv(unsigned int num, unsigned int den)
{
unsigned ans;
if (den < 512)
{
return SLOPERANGE;
}
else
{
ans = (num << 3) / (den >> 8);
if (ans <= SLOPERANGE)
{
return ans;
}
else
{
return SLOPERANGE;
}
}
}
const fixed_t finetangent[4096] =
{
-170910304,-56965752,-34178904,-24413316,-18988036,-15535599,-13145455,-11392683,
-10052327,-8994149,-8137527,-7429880,-6835455,-6329090,-5892567,-5512368,
-5178251,-4882318,-4618375,-4381502,-4167737,-3973855,-3797206,-3635590,
-3487165,-3350381,-3223918,-3106651,-2997613,-2895966,-2800983,-2712030,
-2628549,-2550052,-2476104,-2406322,-2340362,-2277919,-2218719,-2162516,
-2109087,-2058233,-2009771,-1963536,-1919378,-1877161,-1836758,-1798063,
-1760956,-1725348,-1691149,-1658278,-1626658,-1596220,-1566898,-1538632,
-1511367,-1485049,-1459630,-1435065,-1411312,-1388330,-1366084,-1344537,
-1323658,-1303416,-1283783,-1264730,-1246234,-1228269,-1210813,-1193846,
-1177345,-1161294,-1145673,-1130465,-1115654,-1101225,-1087164,-1073455,
-1060087,-1047046,-1034322,-1021901,-1009774,-997931,-986361,-975054,
-964003,-953199,-942633,-932298,-922186,-912289,-902602,-893117,
-883829,-874730,-865817,-857081,-848520,-840127,-831898,-823827,
-815910,-808143,-800521,-793041,-785699,-778490,-771411,-764460,
-757631,-750922,-744331,-737853,-731486,-725227,-719074,-713023,
-707072,-701219,-695462,-689797,-684223,-678737,-673338,-668024,
-662792,-657640,-652568,-647572,-642651,-637803,-633028,-628323,
-623686,-619117,-614613,-610174,-605798,-601483,-597229,-593033,
-588896,-584815,-580789,-576818,-572901,-569035,-565221,-561456,
-557741,-554074,-550455,-546881,-543354,-539870,-536431,-533034,
-529680,-526366,-523094,-519861,-516667,-513512,-510394,-507313,
-504269,-501261,-498287,-495348,-492443,-489571,-486732,-483925,
-481150,-478406,-475692,-473009,-470355,-467730,-465133,-462565,
-460024,-457511,-455024,-452564,-450129,-447720,-445337,-442978,
-440643,-438332,-436045,-433781,-431540,-429321,-427125,-424951,
-422798,-420666,-418555,-416465,-414395,-412344,-410314,-408303,
-406311,-404338,-402384,-400448,-398530,-396630,-394747,-392882,
-391034,-389202,-387387,-385589,-383807,-382040,-380290,-378555,
-376835,-375130,-373440,-371765,-370105,-368459,-366826,-365208,
-363604,-362013,-360436,-358872,-357321,-355783,-354257,-352744,
-351244,-349756,-348280,-346816,-345364,-343924,-342495,-341078,
-339671,-338276,-336892,-335519,-334157,-332805,-331464,-330133,
-328812,-327502,-326201,-324910,-323629,-322358,-321097,-319844,
-318601,-317368,-316143,-314928,-313721,-312524,-311335,-310154,
-308983,-307819,-306664,-305517,-304379,-303248,-302126,-301011,
-299904,-298805,-297714,-296630,-295554,-294485,-293423,-292369,
-291322,-290282,-289249,-288223,-287204,-286192,-285186,-284188,
-283195,-282210,-281231,-280258,-279292,-278332,-277378,-276430,
-275489,-274553,-273624,-272700,-271782,-270871,-269965,-269064,
-268169,-267280,-266397,-265519,-264646,-263779,-262917,-262060,
-261209,-260363,-259522,-258686,-257855,-257029,-256208,-255392,
-254581,-253774,-252973,-252176,-251384,-250596,-249813,-249035,
-248261,-247492,-246727,-245966,-245210,-244458,-243711,-242967,
-242228,-241493,-240763,-240036,-239314,-238595,-237881,-237170,
-236463,-235761,-235062,-234367,-233676,-232988,-232304,-231624,
-230948,-230275,-229606,-228941,-228279,-227621,-226966,-226314,
-225666,-225022,-224381,-223743,-223108,-222477,-221849,-221225,
-220603,-219985,-219370,-218758,-218149,-217544,-216941,-216341,
-215745,-215151,-214561,-213973,-213389,-212807,-212228,-211652,
-211079,-210509,-209941,-209376,-208815,-208255,-207699,-207145,
-206594,-206045,-205500,-204956,-204416,-203878,-203342,-202809,
-202279,-201751,-201226,-200703,-200182,-199664,-199149,-198636,
-198125,-197616,-197110,-196606,-196105,-195606,-195109,-194614,
-194122,-193631,-193143,-192658,-192174,-191693,-191213,-190736,
-190261,-189789,-189318,-188849,-188382,-187918,-187455,-186995,
-186536,-186080,-185625,-185173,-184722,-184274,-183827,-183382,
-182939,-182498,-182059,-181622,-181186,-180753,-180321,-179891,
-179463,-179037,-178612,-178190,-177769,-177349,-176932,-176516,
-176102,-175690,-175279,-174870,-174463,-174057,-173653,-173251,
-172850,-172451,-172053,-171657,-171263,-170870,-170479,-170089,
-169701,-169315,-168930,-168546,-168164,-167784,-167405,-167027,
-166651,-166277,-165904,-165532,-165162,-164793,-164426,-164060,
-163695,-163332,-162970,-162610,-162251,-161893,-161537,-161182,
-160828,-160476,-160125,-159775,-159427,-159079,-158734,-158389,
-158046,-157704,-157363,-157024,-156686,-156349,-156013,-155678,
-155345,-155013,-154682,-154352,-154024,-153697,-153370,-153045,
-152722,-152399,-152077,-151757,-151438,-151120,-150803,-150487,
-150172,-149859,-149546,-149235,-148924,-148615,-148307,-148000,
-147693,-147388,-147084,-146782,-146480,-146179,-145879,-145580,
-145282,-144986,-144690,-144395,-144101,-143808,-143517,-143226,
-142936,-142647,-142359,-142072,-141786,-141501,-141217,-140934,
-140651,-140370,-140090,-139810,-139532,-139254,-138977,-138701,
-138426,-138152,-137879,-137607,-137335,-137065,-136795,-136526,
-136258,-135991,-135725,-135459,-135195,-134931,-134668,-134406,
-134145,-133884,-133625,-133366,-133108,-132851,-132594,-132339,
-132084,-131830,-131576,-131324,-131072,-130821,-130571,-130322,
-130073,-129825,-129578,-129332,-129086,-128841,-128597,-128353,
-128111,-127869,-127627,-127387,-127147,-126908,-126669,-126432,
-126195,-125959,-125723,-125488,-125254,-125020,-124787,-124555,
-124324,-124093,-123863,-123633,-123404,-123176,-122949,-122722,
-122496,-122270,-122045,-121821,-121597,-121374,-121152,-120930,
-120709,-120489,-120269,-120050,-119831,-119613,-119396,-119179,
-118963,-118747,-118532,-118318,-118104,-117891,-117678,-117466,
-117254,-117044,-116833,-116623,-116414,-116206,-115998,-115790,
-115583,-115377,-115171,-114966,-114761,-114557,-114354,-114151,
-113948,-113746,-113545,-113344,-113143,-112944,-112744,-112546,
-112347,-112150,-111952,-111756,-111560,-111364,-111169,-110974,
-110780,-110586,-110393,-110200,-110008,-109817,-109626,-109435,
-109245,-109055,-108866,-108677,-108489,-108301,-108114,-107927,
-107741,-107555,-107369,-107184,-107000,-106816,-106632,-106449,
-106266,-106084,-105902,-105721,-105540,-105360,-105180,-105000,
-104821,-104643,-104465,-104287,-104109,-103933,-103756,-103580,
-103404,-103229,-103054,-102880,-102706,-102533,-102360,-102187,
-102015,-101843,-101671,-101500,-101330,-101159,-100990,-100820,
-100651,-100482,-100314,-100146,-99979,-99812,-99645,-99479,
-99313,-99148,-98982,-98818,-98653,-98489,-98326,-98163,
-98000,-97837,-97675,-97513,-97352,-97191,-97030,-96870,
-96710,-96551,-96391,-96233,-96074,-95916,-95758,-95601,
-95444,-95287,-95131,-94975,-94819,-94664,-94509,-94354,
-94200,-94046,-93892,-93739,-93586,-93434,-93281,-93129,
-92978,-92826,-92675,-92525,-92375,-92225,-92075,-91926,
-91777,-91628,-91480,-91332,-91184,-91036,-90889,-90742,
-90596,-90450,-90304,-90158,-90013,-89868,-89724,-89579,
-89435,-89292,-89148,-89005,-88862,-88720,-88577,-88435,
-88294,-88152,-88011,-87871,-87730,-87590,-87450,-87310,
-87171,-87032,-86893,-86755,-86616,-86479,-86341,-86204,
-86066,-85930,-85793,-85657,-85521,-85385,-85250,-85114,
-84980,-84845,-84710,-84576,-84443,-84309,-84176,-84043,
-83910,-83777,-83645,-83513,-83381,-83250,-83118,-82987,
-82857,-82726,-82596,-82466,-82336,-82207,-82078,-81949,
-81820,-81691,-81563,-81435,-81307,-81180,-81053,-80925,
-80799,-80672,-80546,-80420,-80294,-80168,-80043,-79918,
-79793,-79668,-79544,-79420,-79296,-79172,-79048,-78925,
-78802,-78679,-78557,-78434,-78312,-78190,-78068,-77947,
-77826,-77705,-77584,-77463,-77343,-77223,-77103,-76983,
-76864,-76744,-76625,-76506,-76388,-76269,-76151,-76033,
-75915,-75797,-75680,-75563,-75446,-75329,-75213,-75096,
-74980,-74864,-74748,-74633,-74517,-74402,-74287,-74172,
-74058,-73944,-73829,-73715,-73602,-73488,-73375,-73262,
-73149,-73036,-72923,-72811,-72699,-72587,-72475,-72363,
-72252,-72140,-72029,-71918,-71808,-71697,-71587,-71477,
-71367,-71257,-71147,-71038,-70929,-70820,-70711,-70602,
-70494,-70385,-70277,-70169,-70061,-69954,-69846,-69739,
-69632,-69525,-69418,-69312,-69205,-69099,-68993,-68887,
-68781,-68676,-68570,-68465,-68360,-68255,-68151,-68046,
-67942,-67837,-67733,-67629,-67526,-67422,-67319,-67216,
-67113,-67010,-66907,-66804,-66702,-66600,-66498,-66396,
-66294,-66192,-66091,-65989,-65888,-65787,-65686,-65586,
-65485,-65385,-65285,-65185,-65085,-64985,-64885,-64786,
-64687,-64587,-64488,-64389,-64291,-64192,-64094,-63996,
-63897,-63799,-63702,-63604,-63506,-63409,-63312,-63215,
-63118,-63021,-62924,-62828,-62731,-62635,-62539,-62443,
-62347,-62251,-62156,-62060,-61965,-61870,-61775,-61680,
-61585,-61491,-61396,-61302,-61208,-61114,-61020,-60926,
-60833,-60739,-60646,-60552,-60459,-60366,-60273,-60181,
-60088,-59996,-59903,-59811,-59719,-59627,-59535,-59444,
-59352,-59261,-59169,-59078,-58987,-58896,-58805,-58715,
-58624,-58534,-58443,-58353,-58263,-58173,-58083,-57994,
-57904,-57815,-57725,-57636,-57547,-57458,-57369,-57281,
-57192,-57104,-57015,-56927,-56839,-56751,-56663,-56575,
-56487,-56400,-56312,-56225,-56138,-56051,-55964,-55877,
-55790,-55704,-55617,-55531,-55444,-55358,-55272,-55186,
-55100,-55015,-54929,-54843,-54758,-54673,-54587,-54502,
-54417,-54333,-54248,-54163,-54079,-53994,-53910,-53826,
-53741,-53657,-53574,-53490,-53406,-53322,-53239,-53156,
-53072,-52989,-52906,-52823,-52740,-52657,-52575,-52492,
-52410,-52327,-52245,-52163,-52081,-51999,-51917,-51835,
-51754,-51672,-51591,-51509,-51428,-51347,-51266,-51185,
-51104,-51023,-50942,-50862,-50781,-50701,-50621,-50540,
-50460,-50380,-50300,-50221,-50141,-50061,-49982,-49902,
-49823,-49744,-49664,-49585,-49506,-49427,-49349,-49270,
-49191,-49113,-49034,-48956,-48878,-48799,-48721,-48643,
-48565,-48488,-48410,-48332,-48255,-48177,-48100,-48022,
-47945,-47868,-47791,-47714,-47637,-47560,-47484,-47407,
-47331,-47254,-47178,-47102,-47025,-46949,-46873,-46797,
-46721,-46646,-46570,-46494,-46419,-46343,-46268,-46193,
-46118,-46042,-45967,-45892,-45818,-45743,-45668,-45593,
-45519,-45444,-45370,-45296,-45221,-45147,-45073,-44999,
-44925,-44851,-44778,-44704,-44630,-44557,-44483,-44410,
-44337,-44263,-44190,-44117,-44044,-43971,-43898,-43826,
-43753,-43680,-43608,-43535,-43463,-43390,-43318,-43246,
-43174,-43102,-43030,-42958,-42886,-42814,-42743,-42671,
-42600,-42528,-42457,-42385,-42314,-42243,-42172,-42101,
-42030,-41959,-41888,-41817,-41747,-41676,-41605,-41535,
-41465,-41394,-41324,-41254,-41184,-41113,-41043,-40973,
-40904,-40834,-40764,-40694,-40625,-40555,-40486,-40416,
-40347,-40278,-40208,-40139,-40070,-40001,-39932,-39863,
-39794,-39726,-39657,-39588,-39520,-39451,-39383,-39314,
-39246,-39178,-39110,-39042,-38973,-38905,-38837,-38770,
-38702,-38634,-38566,-38499,-38431,-38364,-38296,-38229,
-38161,-38094,-38027,-37960,-37893,-37826,-37759,-37692,
-37625,-37558,-37491,-37425,-37358,-37291,-37225,-37158,
-37092,-37026,-36959,-36893,-36827,-36761,-36695,-36629,
-36563,-36497,-36431,-36365,-36300,-36234,-36168,-36103,
-36037,-35972,-35907,-35841,-35776,-35711,-35646,-35580,
-35515,-35450,-35385,-35321,-35256,-35191,-35126,-35062,
-34997,-34932,-34868,-34803,-34739,-34675,-34610,-34546,
-34482,-34418,-34354,-34289,-34225,-34162,-34098,-34034,
-33970,-33906,-33843,-33779,-33715,-33652,-33588,-33525,
-33461,-33398,-33335,-33272,-33208,-33145,-33082,-33019,
-32956,-32893,-32830,-32767,-32705,-32642,-32579,-32516,
-32454,-32391,-32329,-32266,-32204,-32141,-32079,-32017,
-31955,-31892,-31830,-31768,-31706,-31644,-31582,-31520,
-31458,-31396,-31335,-31273,-31211,-31150,-31088,-31026,
-30965,-30904,-30842,-30781,-30719,-30658,-30597,-30536,
-30474,-30413,-30352,-30291,-30230,-30169,-30108,-30048,
-29987,-29926,-29865,-29805,-29744,-29683,-29623,-29562,
-29502,-29441,-29381,-29321,-29260,-29200,-29140,-29080,
-29020,-28959,-28899,-28839,-28779,-28719,-28660,-28600,
-28540,-28480,-28420,-28361,-28301,-28241,-28182,-28122,
-28063,-28003,-27944,-27884,-27825,-27766,-27707,-27647,
-27588,-27529,-27470,-27411,-27352,-27293,-27234,-27175,
-27116,-27057,-26998,-26940,-26881,-26822,-26763,-26705,
-26646,-26588,-26529,-26471,-26412,-26354,-26295,-26237,
-26179,-26120,-26062,-26004,-25946,-25888,-25830,-25772,
-25714,-25656,-25598,-25540,-25482,-25424,-25366,-25308,
-25251,-25193,-25135,-25078,-25020,-24962,-24905,-24847,
-24790,-24732,-24675,-24618,-24560,-24503,-24446,-24389,
-24331,-24274,-24217,-24160,-24103,-24046,-23989,-23932,
-23875,-23818,-23761,-23704,-23647,-23591,-23534,-23477,
-23420,-23364,-23307,-23250,-23194,-23137,-23081,-23024,
-22968,-22911,-22855,-22799,-22742,-22686,-22630,-22573,
-22517,-22461,-22405,-22349,-22293,-22237,-22181,-22125,
-22069,-22013,-21957,-21901,-21845,-21789,-21733,-21678,
-21622,-21566,-21510,-21455,-21399,-21343,-21288,-21232,
-21177,-21121,-21066,-21010,-20955,-20900,-20844,-20789,
-20734,-20678,-20623,-20568,-20513,-20457,-20402,-20347,
-20292,-20237,-20182,-20127,-20072,-20017,-19962,-19907,
-19852,-19797,-19742,-19688,-19633,-19578,-19523,-19469,
-19414,-19359,-19305,-19250,-19195,-19141,-19086,-19032,
-18977,-18923,-18868,-18814,-18760,-18705,-18651,-18597,
-18542,-18488,-18434,-18380,-18325,-18271,-18217,-18163,
-18109,-18055,-18001,-17946,-17892,-17838,-17784,-17731,
-17677,-17623,-17569,-17515,-17461,-17407,-17353,-17300,
-17246,-17192,-17138,-17085,-17031,-16977,-16924,-16870,
-16817,-16763,-16710,-16656,-16603,-16549,-16496,-16442,
-16389,-16335,-16282,-16229,-16175,-16122,-16069,-16015,
-15962,-15909,-15856,-15802,-15749,-15696,-15643,-15590,
-15537,-15484,-15431,-15378,-15325,-15272,-15219,-15166,
-15113,-15060,-15007,-14954,-14901,-14848,-14795,-14743,
-14690,-14637,-14584,-14531,-14479,-14426,-14373,-14321,
-14268,-14215,-14163,-14110,-14057,-14005,-13952,-13900,
-13847,-13795,-13742,-13690,-13637,-13585,-13533,-13480,
-13428,-13375,-13323,-13271,-13218,-13166,-13114,-13062,
-13009,-12957,-12905,-12853,-12800,-12748,-12696,-12644,
-12592,-12540,-12488,-12436,-12383,-12331,-12279,-12227,
-12175,-12123,-12071,-12019,-11967,-11916,-11864,-11812,
-11760,-11708,-11656,-11604,-11552,-11501,-11449,-11397,
-11345,-11293,-11242,-11190,-11138,-11086,-11035,-10983,
-10931,-10880,-10828,-10777,-10725,-10673,-10622,-10570,
-10519,-10467,-10415,-10364,-10312,-10261,-10209,-10158,
-10106,-10055,-10004,-9952,-9901,-9849,-9798,-9747,
-9695,-9644,-9592,-9541,-9490,-9438,-9387,-9336,
-9285,-9233,-9182,-9131,-9080,-9028,-8977,-8926,
-8875,-8824,-8772,-8721,-8670,-8619,-8568,-8517,
-8466,-8414,-8363,-8312,-8261,-8210,-8159,-8108,
-8057,-8006,-7955,-7904,-7853,-7802,-7751,-7700,
-7649,-7598,-7547,-7496,-7445,-7395,-7344,-7293,
-7242,-7191,-7140,-7089,-7038,-6988,-6937,-6886,
-6835,-6784,-6733,-6683,-6632,-6581,-6530,-6480,
-6429,-6378,-6327,-6277,-6226,-6175,-6124,-6074,
-6023,-5972,-5922,-5871,-5820,-5770,-5719,-5668,
-5618,-5567,-5517,-5466,-5415,-5365,-5314,-5264,
-5213,-5162,-5112,-5061,-5011,-4960,-4910,-4859,
-4808,-4758,-4707,-4657,-4606,-4556,-4505,-4455,
-4404,-4354,-4303,-4253,-4202,-4152,-4101,-4051,
-4001,-3950,-3900,-3849,-3799,-3748,-3698,-3648,
-3597,-3547,-3496,-3446,-3395,-3345,-3295,-3244,
-3194,-3144,-3093,-3043,-2992,-2942,-2892,-2841,
-2791,-2741,-2690,-2640,-2590,-2539,-2489,-2439,
-2388,-2338,-2288,-2237,-2187,-2137,-2086,-2036,
-1986,-1935,-1885,-1835,-1784,-1734,-1684,-1633,
-1583,-1533,-1483,-1432,-1382,-1332,-1281,-1231,
-1181,-1131,-1080,-1030,-980,-929,-879,-829,
-779,-728,-678,-628,-578,-527,-477,-427,
-376,-326,-276,-226,-175,-125,-75,-25,
25,75,125,175,226,276,326,376,
427,477,527,578,628,678,728,779,
829,879,929,980,1030,1080,1131,1181,
1231,1281,1332,1382,1432,1483,1533,1583,
1633,1684,1734,1784,1835,1885,1935,1986,
2036,2086,2137,2187,2237,2288,2338,2388,
2439,2489,2539,2590,2640,2690,2741,2791,
2841,2892,2942,2992,3043,3093,3144,3194,
3244,3295,3345,3395,3446,3496,3547,3597,
3648,3698,3748,3799,3849,3900,3950,4001,
4051,4101,4152,4202,4253,4303,4354,4404,
4455,4505,4556,4606,4657,4707,4758,4808,
4859,4910,4960,5011,5061,5112,5162,5213,
5264,5314,5365,5415,5466,5517,5567,5618,
5668,5719,5770,5820,5871,5922,5972,6023,
6074,6124,6175,6226,6277,6327,6378,6429,
6480,6530,6581,6632,6683,6733,6784,6835,
6886,6937,6988,7038,7089,7140,7191,7242,
7293,7344,7395,7445,7496,7547,7598,7649,
7700,7751,7802,7853,7904,7955,8006,8057,
8108,8159,8210,8261,8312,8363,8414,8466,
8517,8568,8619,8670,8721,8772,8824,8875,
8926,8977,9028,9080,9131,9182,9233,9285,
9336,9387,9438,9490,9541,9592,9644,9695,
9747,9798,9849,9901,9952,10004,10055,10106,
10158,10209,10261,10312,10364,10415,10467,10519,
10570,10622,10673,10725,10777,10828,10880,10931,
10983,11035,11086,11138,11190,11242,11293,11345,
11397,11449,11501,11552,11604,11656,11708,11760,
11812,11864,11916,11967,12019,12071,12123,12175,
12227,12279,12331,12383,12436,12488,12540,12592,
12644,12696,12748,12800,12853,12905,12957,13009,
13062,13114,13166,13218,13271,13323,13375,13428,
13480,13533,13585,13637,13690,13742,13795,13847,
13900,13952,14005,14057,14110,14163,14215,14268,
14321,14373,14426,14479,14531,14584,14637,14690,
14743,14795,14848,14901,14954,15007,15060,15113,
15166,15219,15272,15325,15378,15431,15484,15537,
15590,15643,15696,15749,15802,15856,15909,15962,
16015,16069,16122,16175,16229,16282,16335,16389,
16442,16496,16549,16603,16656,16710,16763,16817,
16870,16924,16977,17031,17085,17138,17192,17246,
17300,17353,17407,17461,17515,17569,17623,17677,
17731,17784,17838,17892,17946,18001,18055,18109,
18163,18217,18271,18325,18380,18434,18488,18542,
18597,18651,18705,18760,18814,18868,18923,18977,
19032,19086,19141,19195,19250,19305,19359,19414,
19469,19523,19578,19633,19688,19742,19797,19852,
19907,19962,20017,20072,20127,20182,20237,20292,
20347,20402,20457,20513,20568,20623,20678,20734,
20789,20844,20900,20955,21010,21066,21121,21177,
21232,21288,21343,21399,21455,21510,21566,21622,
21678,21733,21789,21845,21901,21957,22013,22069,
22125,22181,22237,22293,22349,22405,22461,22517,
22573,22630,22686,22742,22799,22855,22911,22968,
23024,23081,23137,23194,23250,23307,23364,23420,
23477,23534,23591,23647,23704,23761,23818,23875,
23932,23989,24046,24103,24160,24217,24274,24331,
24389,24446,24503,24560,24618,24675,24732,24790,
24847,24905,24962,25020,25078,25135,25193,25251,
25308,25366,25424,25482,25540,25598,25656,25714,
25772,25830,25888,25946,26004,26062,26120,26179,
26237,26295,26354,26412,26471,26529,26588,26646,
26705,26763,26822,26881,26940,26998,27057,27116,
27175,27234,27293,27352,27411,27470,27529,27588,
27647,27707,27766,27825,27884,27944,28003,28063,
28122,28182,28241,28301,28361,28420,28480,28540,
28600,28660,28719,28779,28839,28899,28959,29020,
29080,29140,29200,29260,29321,29381,29441,29502,
29562,29623,29683,29744,29805,29865,29926,29987,
30048,30108,30169,30230,30291,30352,30413,30474,
30536,30597,30658,30719,30781,30842,30904,30965,
31026,31088,31150,31211,31273,31335,31396,31458,
31520,31582,31644,31706,31768,31830,31892,31955,
32017,32079,32141,32204,32266,32329,32391,32454,
32516,32579,32642,32705,32767,32830,32893,32956,
33019,33082,33145,33208,33272,33335,33398,33461,
33525,33588,33652,33715,33779,33843,33906,33970,
34034,34098,34162,34225,34289,34354,34418,34482,
34546,34610,34675,34739,34803,34868,34932,34997,
35062,35126,35191,35256,35321,35385,35450,35515,
35580,35646,35711,35776,35841,35907,35972,36037,
36103,36168,36234,36300,36365,36431,36497,36563,
36629,36695,36761,36827,36893,36959,37026,37092,
37158,37225,37291,37358,37425,37491,37558,37625,
37692,37759,37826,37893,37960,38027,38094,38161,
38229,38296,38364,38431,38499,38566,38634,38702,
38770,38837,38905,38973,39042,39110,39178,39246,
39314,39383,39451,39520,39588,39657,39726,39794,
39863,39932,40001,40070,40139,40208,40278,40347,
40416,40486,40555,40625,40694,40764,40834,40904,
40973,41043,41113,41184,41254,41324,41394,41465,
41535,41605,41676,41747,41817,41888,41959,42030,
42101,42172,42243,42314,42385,42457,42528,42600,
42671,42743,42814,42886,42958,43030,43102,43174,
43246,43318,43390,43463,43535,43608,43680,43753,
43826,43898,43971,44044,44117,44190,44263,44337,
44410,44483,44557,44630,44704,44778,44851,44925,
44999,45073,45147,45221,45296,45370,45444,45519,
45593,45668,45743,45818,45892,45967,46042,46118,
46193,46268,46343,46419,46494,46570,46646,46721,
46797,46873,46949,47025,47102,47178,47254,47331,
47407,47484,47560,47637,47714,47791,47868,47945,
48022,48100,48177,48255,48332,48410,48488,48565,
48643,48721,48799,48878,48956,49034,49113,49191,
49270,49349,49427,49506,49585,49664,49744,49823,
49902,49982,50061,50141,50221,50300,50380,50460,
50540,50621,50701,50781,50862,50942,51023,51104,
51185,51266,51347,51428,51509,51591,51672,51754,
51835,51917,51999,52081,52163,52245,52327,52410,
52492,52575,52657,52740,52823,52906,52989,53072,
53156,53239,53322,53406,53490,53574,53657,53741,
53826,53910,53994,54079,54163,54248,54333,54417,
54502,54587,54673,54758,54843,54929,55015,55100,
55186,55272,55358,55444,55531,55617,55704,55790,
55877,55964,56051,56138,56225,56312,56400,56487,
56575,56663,56751,56839,56927,57015,57104,57192,
57281,57369,57458,57547,57636,57725,57815,57904,
57994,58083,58173,58263,58353,58443,58534,58624,
58715,58805,58896,58987,59078,59169,59261,59352,
59444,59535,59627,59719,59811,59903,59996,60088,
60181,60273,60366,60459,60552,60646,60739,60833,
60926,61020,61114,61208,61302,61396,61491,61585,
61680,61775,61870,61965,62060,62156,62251,62347,
62443,62539,62635,62731,62828,62924,63021,63118,
63215,63312,63409,63506,63604,63702,63799,63897,
63996,64094,64192,64291,64389,64488,64587,64687,
64786,64885,64985,65085,65185,65285,65385,65485,
65586,65686,65787,65888,65989,66091,66192,66294,
66396,66498,66600,66702,66804,66907,67010,67113,
67216,67319,67422,67526,67629,67733,67837,67942,
68046,68151,68255,68360,68465,68570,68676,68781,
68887,68993,69099,69205,69312,69418,69525,69632,
69739,69846,69954,70061,70169,70277,70385,70494,
70602,70711,70820,70929,71038,71147,71257,71367,
71477,71587,71697,71808,71918,72029,72140,72252,
72363,72475,72587,72699,72811,72923,73036,73149,
73262,73375,73488,73602,73715,73829,73944,74058,
74172,74287,74402,74517,74633,74748,74864,74980,
75096,75213,75329,75446,75563,75680,75797,75915,
76033,76151,76269,76388,76506,76625,76744,76864,
76983,77103,77223,77343,77463,77584,77705,77826,
77947,78068,78190,78312,78434,78557,78679,78802,
78925,79048,79172,79296,79420,79544,79668,79793,
79918,80043,80168,80294,80420,80546,80672,80799,
80925,81053,81180,81307,81435,81563,81691,81820,
81949,82078,82207,82336,82466,82596,82726,82857,
82987,83118,83250,83381,83513,83645,83777,83910,
84043,84176,84309,84443,84576,84710,84845,84980,
85114,85250,85385,85521,85657,85793,85930,86066,
86204,86341,86479,86616,86755,86893,87032,87171,
87310,87450,87590,87730,87871,88011,88152,88294,
88435,88577,88720,88862,89005,89148,89292,89435,
89579,89724,89868,90013,90158,90304,90450,90596,
90742,90889,91036,91184,91332,91480,91628,91777,
91926,92075,92225,92375,92525,92675,92826,92978,
93129,93281,93434,93586,93739,93892,94046,94200,
94354,94509,94664,94819,94975,95131,95287,95444,
95601,95758,95916,96074,96233,96391,96551,96710,
96870,97030,97191,97352,97513,97675,97837,98000,
98163,98326,98489,98653,98818,98982,99148,99313,
99479,99645,99812,99979,100146,100314,100482,100651,
100820,100990,101159,101330,101500,101671,101843,102015,
102187,102360,102533,102706,102880,103054,103229,103404,
103580,103756,103933,104109,104287,104465,104643,104821,
105000,105180,105360,105540,105721,105902,106084,106266,
106449,106632,106816,107000,107184,107369,107555,107741,
107927,108114,108301,108489,108677,108866,109055,109245,
109435,109626,109817,110008,110200,110393,110586,110780,
110974,111169,111364,111560,111756,111952,112150,112347,
112546,112744,112944,113143,113344,113545,113746,113948,
114151,114354,114557,114761,114966,115171,115377,115583,
115790,115998,116206,116414,116623,116833,117044,117254,
117466,117678,117891,118104,118318,118532,118747,118963,
119179,119396,119613,119831,120050,120269,120489,120709,
120930,121152,121374,121597,121821,122045,122270,122496,
122722,122949,123176,123404,123633,123863,124093,124324,
124555,124787,125020,125254,125488,125723,125959,126195,
126432,126669,126908,127147,127387,127627,127869,128111,
128353,128597,128841,129086,129332,129578,129825,130073,
130322,130571,130821,131072,131324,131576,131830,132084,
132339,132594,132851,133108,133366,133625,133884,134145,
134406,134668,134931,135195,135459,135725,135991,136258,
136526,136795,137065,137335,137607,137879,138152,138426,
138701,138977,139254,139532,139810,140090,140370,140651,
140934,141217,141501,141786,142072,142359,142647,142936,
143226,143517,143808,144101,144395,144690,144986,145282,
145580,145879,146179,146480,146782,147084,147388,147693,
148000,148307,148615,148924,149235,149546,149859,150172,
150487,150803,151120,151438,151757,152077,152399,152722,
153045,153370,153697,154024,154352,154682,155013,155345,
155678,156013,156349,156686,157024,157363,157704,158046,
158389,158734,159079,159427,159775,160125,160476,160828,
161182,161537,161893,162251,162610,162970,163332,163695,
164060,164426,164793,165162,165532,165904,166277,166651,
167027,167405,167784,168164,168546,168930,169315,169701,
170089,170479,170870,171263,171657,172053,172451,172850,
173251,173653,174057,174463,174870,175279,175690,176102,
176516,176932,177349,177769,178190,178612,179037,179463,
179891,180321,180753,181186,181622,182059,182498,182939,
183382,183827,184274,184722,185173,185625,186080,186536,
186995,187455,187918,188382,188849,189318,189789,190261,
190736,191213,191693,192174,192658,193143,193631,194122,
194614,195109,195606,196105,196606,197110,197616,198125,
198636,199149,199664,200182,200703,201226,201751,202279,
202809,203342,203878,204416,204956,205500,206045,206594,
207145,207699,208255,208815,209376,209941,210509,211079,
211652,212228,212807,213389,213973,214561,215151,215745,
216341,216941,217544,218149,218758,219370,219985,220603,
221225,221849,222477,223108,223743,224381,225022,225666,
226314,226966,227621,228279,228941,229606,230275,230948,
231624,232304,232988,233676,234367,235062,235761,236463,
237170,237881,238595,239314,240036,240763,241493,242228,
242967,243711,244458,245210,245966,246727,247492,248261,
249035,249813,250596,251384,252176,252973,253774,254581,
255392,256208,257029,257855,258686,259522,260363,261209,
262060,262917,263779,264646,265519,266397,267280,268169,
269064,269965,270871,271782,272700,273624,274553,275489,
276430,277378,278332,279292,280258,281231,282210,283195,
284188,285186,286192,287204,288223,289249,290282,291322,
292369,293423,294485,295554,296630,297714,298805,299904,
301011,302126,303248,304379,305517,306664,307819,308983,
310154,311335,312524,313721,314928,316143,317368,318601,
319844,321097,322358,323629,324910,326201,327502,328812,
330133,331464,332805,334157,335519,336892,338276,339671,
341078,342495,343924,345364,346816,348280,349756,351244,
352744,354257,355783,357321,358872,360436,362013,363604,
365208,366826,368459,370105,371765,373440,375130,376835,
378555,380290,382040,383807,385589,387387,389202,391034,
392882,394747,396630,398530,400448,402384,404338,406311,
408303,410314,412344,414395,416465,418555,420666,422798,
424951,427125,429321,431540,433781,436045,438332,440643,
442978,445337,447720,450129,452564,455024,457511,460024,
462565,465133,467730,470355,473009,475692,478406,481150,
483925,486732,489571,492443,495348,498287,501261,504269,
507313,510394,513512,516667,519861,523094,526366,529680,
533034,536431,539870,543354,546881,550455,554074,557741,
561456,565221,569035,572901,576818,580789,584815,588896,
593033,597229,601483,605798,610174,614613,619117,623686,
628323,633028,637803,642651,647572,652568,657640,662792,
668024,673338,678737,684223,689797,695462,701219,707072,
713023,719074,725227,731486,737853,744331,750922,757631,
764460,771411,778490,785699,793041,800521,808143,815910,
823827,831898,840127,848520,857081,865817,874730,883829,
893117,902602,912289,922186,932298,942633,953199,964003,
975054,986361,997931,1009774,1021901,1034322,1047046,1060087,
1073455,1087164,1101225,1115654,1130465,1145673,1161294,1177345,
1193846,1210813,1228269,1246234,1264730,1283783,1303416,1323658,
1344537,1366084,1388330,1411312,1435065,1459630,1485049,1511367,
1538632,1566898,1596220,1626658,1658278,1691149,1725348,1760956,
1798063,1836758,1877161,1919378,1963536,2009771,2058233,2109087,
2162516,2218719,2277919,2340362,2406322,2476104,2550052,2628549,
2712030,2800983,2895966,2997613,3106651,3223918,3350381,3487165,
3635590,3797206,3973855,4167737,4381502,4618375,4882318,5178251,
5512368,5892567,6329090,6835455,7429880,8137527,8994149,10052327,
11392683,13145455,15535599,18988036,24413316,34178904,56965752,170910304
};
const fixed_t finesine[10240] =
{
25,75,125,175,226,276,326,376,
427,477,527,578,628,678,728,779,
829,879,929,980,1030,1080,1130,1181,
1231,1281,1331,1382,1432,1482,1532,1583,
1633,1683,1733,1784,1834,1884,1934,1985,
2035,2085,2135,2186,2236,2286,2336,2387,
2437,2487,2537,2587,2638,2688,2738,2788,
2839,2889,2939,2989,3039,3090,3140,3190,
3240,3291,3341,3391,3441,3491,3541,3592,
3642,3692,3742,3792,3843,3893,3943,3993,
4043,4093,4144,4194,4244,4294,4344,4394,
4445,4495,4545,4595,4645,4695,4745,4796,
4846,4896,4946,4996,5046,5096,5146,5197,
5247,5297,5347,5397,5447,5497,5547,5597,
5647,5697,5748,5798,5848,5898,5948,5998,
6048,6098,6148,6198,6248,6298,6348,6398,
6448,6498,6548,6598,6648,6698,6748,6798,
6848,6898,6948,6998,7048,7098,7148,7198,
7248,7298,7348,7398,7448,7498,7548,7598,
7648,7697,7747,7797,7847,7897,7947,7997,
8047,8097,8147,8196,8246,8296,8346,8396,
8446,8496,8545,8595,8645,8695,8745,8794,
8844,8894,8944,8994,9043,9093,9143,9193,
9243,9292,9342,9392,9442,9491,9541,9591,
9640,9690,9740,9790,9839,9889,9939,9988,
10038,10088,10137,10187,10237,10286,10336,10386,
10435,10485,10534,10584,10634,10683,10733,10782,
10832,10882,10931,10981,11030,11080,11129,11179,
11228,11278,11327,11377,11426,11476,11525,11575,
11624,11674,11723,11773,11822,11872,11921,11970,
12020,12069,12119,12168,12218,12267,12316,12366,
12415,12464,12514,12563,12612,12662,12711,12760,
12810,12859,12908,12957,13007,13056,13105,13154,
13204,13253,13302,13351,13401,13450,13499,13548,
13597,13647,13696,13745,13794,13843,13892,13941,
13990,14040,14089,14138,14187,14236,14285,14334,
14383,14432,14481,14530,14579,14628,14677,14726,
14775,14824,14873,14922,14971,15020,15069,15118,
15167,15215,15264,15313,15362,15411,15460,15509,
15557,15606,15655,15704,15753,15802,15850,15899,
15948,15997,16045,16094,16143,16191,16240,16289,
16338,16386,16435,16484,16532,16581,16629,16678,
16727,16775,16824,16872,16921,16970,17018,17067,
17115,17164,17212,17261,17309,17358,17406,17455,
17503,17551,17600,17648,17697,17745,17793,17842,
17890,17939,17987,18035,18084,18132,18180,18228,
18277,18325,18373,18421,18470,18518,18566,18614,
18663,18711,18759,18807,18855,18903,18951,19000,
19048,19096,19144,19192,19240,19288,19336,19384,
19432,19480,19528,19576,19624,19672,19720,19768,
19816,19864,19912,19959,20007,20055,20103,20151,
20199,20246,20294,20342,20390,20438,20485,20533,
20581,20629,20676,20724,20772,20819,20867,20915,
20962,21010,21057,21105,21153,21200,21248,21295,
21343,21390,21438,21485,21533,21580,21628,21675,
21723,21770,21817,21865,21912,21960,22007,22054,
22102,22149,22196,22243,22291,22338,22385,22433,
22480,22527,22574,22621,22668,22716,22763,22810,
22857,22904,22951,22998,23045,23092,23139,23186,
23233,23280,23327,23374,23421,23468,23515,23562,
23609,23656,23703,23750,23796,23843,23890,23937,
23984,24030,24077,24124,24171,24217,24264,24311,
24357,24404,24451,24497,24544,24591,24637,24684,
24730,24777,24823,24870,24916,24963,25009,25056,
25102,25149,25195,25241,25288,25334,25381,25427,
25473,25520,25566,25612,25658,25705,25751,25797,
25843,25889,25936,25982,26028,26074,26120,26166,
26212,26258,26304,26350,26396,26442,26488,26534,
26580,26626,26672,26718,26764,26810,26856,26902,
26947,26993,27039,27085,27131,27176,27222,27268,
27313,27359,27405,27450,27496,27542,27587,27633,
27678,27724,27770,27815,27861,27906,27952,27997,
28042,28088,28133,28179,28224,28269,28315,28360,
28405,28451,28496,28541,28586,28632,28677,28722,
28767,28812,28858,28903,28948,28993,29038,29083,
29128,29173,29218,29263,29308,29353,29398,29443,
29488,29533,29577,29622,29667,29712,29757,29801,
29846,29891,29936,29980,30025,30070,30114,30159,
30204,30248,30293,30337,30382,30426,30471,30515,
30560,30604,30649,30693,30738,30782,30826,30871,
30915,30959,31004,31048,31092,31136,31181,31225,
31269,31313,31357,31402,31446,31490,31534,31578,
31622,31666,31710,31754,31798,31842,31886,31930,
31974,32017,32061,32105,32149,32193,32236,32280,
32324,32368,32411,32455,32499,32542,32586,32630,
32673,32717,32760,32804,32847,32891,32934,32978,
33021,33065,33108,33151,33195,33238,33281,33325,
33368,33411,33454,33498,33541,33584,33627,33670,
33713,33756,33799,33843,33886,33929,33972,34015,
34057,34100,34143,34186,34229,34272,34315,34358,
34400,34443,34486,34529,34571,34614,34657,34699,
34742,34785,34827,34870,34912,34955,34997,35040,
35082,35125,35167,35210,35252,35294,35337,35379,
35421,35464,35506,35548,35590,35633,35675,35717,
35759,35801,35843,35885,35927,35969,36011,36053,
36095,36137,36179,36221,36263,36305,36347,36388,
36430,36472,36514,36555,36597,36639,36681,36722,
36764,36805,36847,36889,36930,36972,37013,37055,
37096,37137,37179,37220,37262,37303,37344,37386,
37427,37468,37509,37551,37592,37633,37674,37715,
37756,37797,37838,37879,37920,37961,38002,38043,
38084,38125,38166,38207,38248,38288,38329,38370,
38411,38451,38492,38533,38573,38614,38655,38695,
38736,38776,38817,38857,38898,38938,38979,39019,
39059,39100,39140,39180,39221,39261,39301,39341,
39382,39422,39462,39502,39542,39582,39622,39662,
39702,39742,39782,39822,39862,39902,39942,39982,
40021,40061,40101,40141,40180,40220,40260,40300,
40339,40379,40418,40458,40497,40537,40576,40616,
40655,40695,40734,40773,40813,40852,40891,40931,
40970,41009,41048,41087,41127,41166,41205,41244,
41283,41322,41361,41400,41439,41478,41517,41556,
41595,41633,41672,41711,41750,41788,41827,41866,
41904,41943,41982,42020,42059,42097,42136,42174,
42213,42251,42290,42328,42366,42405,42443,42481,
42520,42558,42596,42634,42672,42711,42749,42787,
42825,42863,42901,42939,42977,43015,43053,43091,
43128,43166,43204,43242,43280,43317,43355,43393,
43430,43468,43506,43543,43581,43618,43656,43693,
43731,43768,43806,43843,43880,43918,43955,43992,
44029,44067,44104,44141,44178,44215,44252,44289,
44326,44363,44400,44437,44474,44511,44548,44585,
44622,44659,44695,44732,44769,44806,44842,44879,
44915,44952,44989,45025,45062,45098,45135,45171,
45207,45244,45280,45316,45353,45389,45425,45462,
45498,45534,45570,45606,45642,45678,45714,45750,
45786,45822,45858,45894,45930,45966,46002,46037,
46073,46109,46145,46180,46216,46252,46287,46323,
46358,46394,46429,46465,46500,46536,46571,46606,
46642,46677,46712,46747,46783,46818,46853,46888,
46923,46958,46993,47028,47063,47098,47133,47168,
47203,47238,47273,47308,47342,47377,47412,47446,
47481,47516,47550,47585,47619,47654,47688,47723,
47757,47792,47826,47860,47895,47929,47963,47998,
48032,48066,48100,48134,48168,48202,48237,48271,
48305,48338,48372,48406,48440,48474,48508,48542,
48575,48609,48643,48676,48710,48744,48777,48811,
48844,48878,48911,48945,48978,49012,49045,49078,
49112,49145,49178,49211,49244,49278,49311,49344,
49377,49410,49443,49476,49509,49542,49575,49608,
49640,49673,49706,49739,49771,49804,49837,49869,
49902,49935,49967,50000,50032,50065,50097,50129,
50162,50194,50226,50259,50291,50323,50355,50387,
50420,50452,50484,50516,50548,50580,50612,50644,
50675,50707,50739,50771,50803,50834,50866,50898,
50929,50961,50993,51024,51056,51087,51119,51150,
51182,51213,51244,51276,51307,51338,51369,51401,
51432,51463,51494,51525,51556,51587,51618,51649,
51680,51711,51742,51773,51803,51834,51865,51896,
51926,51957,51988,52018,52049,52079,52110,52140,
52171,52201,52231,52262,52292,52322,52353,52383,
52413,52443,52473,52503,52534,52564,52594,52624,
52653,52683,52713,52743,52773,52803,52832,52862,
52892,52922,52951,52981,53010,53040,53069,53099,
53128,53158,53187,53216,53246,53275,53304,53334,
53363,53392,53421,53450,53479,53508,53537,53566,
53595,53624,53653,53682,53711,53739,53768,53797,
53826,53854,53883,53911,53940,53969,53997,54026,
54054,54082,54111,54139,54167,54196,54224,54252,
54280,54308,54337,54365,54393,54421,54449,54477,
54505,54533,54560,54588,54616,54644,54672,54699,
54727,54755,54782,54810,54837,54865,54892,54920,
54947,54974,55002,55029,55056,55084,55111,55138,
55165,55192,55219,55246,55274,55300,55327,55354,
55381,55408,55435,55462,55489,55515,55542,55569,
55595,55622,55648,55675,55701,55728,55754,55781,
55807,55833,55860,55886,55912,55938,55965,55991,
56017,56043,56069,56095,56121,56147,56173,56199,
56225,56250,56276,56302,56328,56353,56379,56404,
56430,56456,56481,56507,56532,56557,56583,56608,
56633,56659,56684,56709,56734,56760,56785,56810,
56835,56860,56885,56910,56935,56959,56984,57009,
57034,57059,57083,57108,57133,57157,57182,57206,
57231,57255,57280,57304,57329,57353,57377,57402,
57426,57450,57474,57498,57522,57546,57570,57594,
57618,57642,57666,57690,57714,57738,57762,57785,
57809,57833,57856,57880,57903,57927,57950,57974,
57997,58021,58044,58067,58091,58114,58137,58160,
58183,58207,58230,58253,58276,58299,58322,58345,
58367,58390,58413,58436,58459,58481,58504,58527,
58549,58572,58594,58617,58639,58662,58684,58706,
58729,58751,58773,58795,58818,58840,58862,58884,
58906,58928,58950,58972,58994,59016,59038,59059,
59081,59103,59125,59146,59168,59190,59211,59233,
59254,59276,59297,59318,59340,59361,59382,59404,
59425,59446,59467,59488,59509,59530,59551,59572,
59593,59614,59635,59656,59677,59697,59718,59739,
59759,59780,59801,59821,59842,59862,59883,59903,
59923,59944,59964,59984,60004,60025,60045,60065,
60085,60105,60125,60145,60165,60185,60205,60225,
60244,60264,60284,60304,60323,60343,60363,60382,
60402,60421,60441,60460,60479,60499,60518,60537,
60556,60576,60595,60614,60633,60652,60671,60690,
60709,60728,60747,60766,60785,60803,60822,60841,
60859,60878,60897,60915,60934,60952,60971,60989,
61007,61026,61044,61062,61081,61099,61117,61135,
61153,61171,61189,61207,61225,61243,61261,61279,
61297,61314,61332,61350,61367,61385,61403,61420,
61438,61455,61473,61490,61507,61525,61542,61559,
61577,61594,61611,61628,61645,61662,61679,61696,
61713,61730,61747,61764,61780,61797,61814,61831,
61847,61864,61880,61897,61913,61930,61946,61963,
61979,61995,62012,62028,62044,62060,62076,62092,
62108,62125,62141,62156,62172,62188,62204,62220,
62236,62251,62267,62283,62298,62314,62329,62345,
62360,62376,62391,62407,62422,62437,62453,62468,
62483,62498,62513,62528,62543,62558,62573,62588,
62603,62618,62633,62648,62662,62677,62692,62706,
62721,62735,62750,62764,62779,62793,62808,62822,
62836,62850,62865,62879,62893,62907,62921,62935,
62949,62963,62977,62991,63005,63019,63032,63046,
63060,63074,63087,63101,63114,63128,63141,63155,
63168,63182,63195,63208,63221,63235,63248,63261,
63274,63287,63300,63313,63326,63339,63352,63365,
63378,63390,63403,63416,63429,63441,63454,63466,
63479,63491,63504,63516,63528,63541,63553,63565,
63578,63590,63602,63614,63626,63638,63650,63662,
63674,63686,63698,63709,63721,63733,63745,63756,
63768,63779,63791,63803,63814,63825,63837,63848,
63859,63871,63882,63893,63904,63915,63927,63938,
63949,63960,63971,63981,63992,64003,64014,64025,
64035,64046,64057,64067,64078,64088,64099,64109,
64120,64130,64140,64151,64161,64171,64181,64192,
64202,64212,64222,64232,64242,64252,64261,64271,
64281,64291,64301,64310,64320,64330,64339,64349,
64358,64368,64377,64387,64396,64405,64414,64424,
64433,64442,64451,64460,64469,64478,64487,64496,
64505,64514,64523,64532,64540,64549,64558,64566,
64575,64584,64592,64601,64609,64617,64626,64634,
64642,64651,64659,64667,64675,64683,64691,64699,
64707,64715,64723,64731,64739,64747,64754,64762,
64770,64777,64785,64793,64800,64808,64815,64822,
64830,64837,64844,64852,64859,64866,64873,64880,
64887,64895,64902,64908,64915,64922,64929,64936,
64943,64949,64956,64963,64969,64976,64982,64989,
64995,65002,65008,65015,65021,65027,65033,65040,
65046,65052,65058,65064,65070,65076,65082,65088,
65094,65099,65105,65111,65117,65122,65128,65133,
65139,65144,65150,65155,65161,65166,65171,65177,
65182,65187,65192,65197,65202,65207,65212,65217,
65222,65227,65232,65237,65242,65246,65251,65256,
65260,65265,65270,65274,65279,65283,65287,65292,
65296,65300,65305,65309,65313,65317,65321,65325,
65329,65333,65337,65341,65345,65349,65352,65356,
65360,65363,65367,65371,65374,65378,65381,65385,
65388,65391,65395,65398,65401,65404,65408,65411,
65414,65417,65420,65423,65426,65429,65431,65434,
65437,65440,65442,65445,65448,65450,65453,65455,
65458,65460,65463,65465,65467,65470,65472,65474,
65476,65478,65480,65482,65484,65486,65488,65490,
65492,65494,65496,65497,65499,65501,65502,65504,
65505,65507,65508,65510,65511,65513,65514,65515,
65516,65518,65519,65520,65521,65522,65523,65524,
65525,65526,65527,65527,65528,65529,65530,65530,
65531,65531,65532,65532,65533,65533,65534,65534,
65534,65535,65535,65535,65535,65535,65535,65535,
65535,65535,65535,65535,65535,65535,65535,65534,
65534,65534,65533,65533,65532,65532,65531,65531,
65530,65530,65529,65528,65527,65527,65526,65525,
65524,65523,65522,65521,65520,65519,65518,65516,
65515,65514,65513,65511,65510,65508,65507,65505,
65504,65502,65501,65499,65497,65496,65494,65492,
65490,65488,65486,65484,65482,65480,65478,65476,
65474,65472,65470,65467,65465,65463,65460,65458,
65455,65453,65450,65448,65445,65442,65440,65437,
65434,65431,65429,65426,65423,65420,65417,65414,
65411,65408,65404,65401,65398,65395,65391,65388,
65385,65381,65378,65374,65371,65367,65363,65360,
65356,65352,65349,65345,65341,65337,65333,65329,
65325,65321,65317,65313,65309,65305,65300,65296,
65292,65287,65283,65279,65274,65270,65265,65260,
65256,65251,65246,65242,65237,65232,65227,65222,
65217,65212,65207,65202,65197,65192,65187,65182,
65177,65171,65166,65161,65155,65150,65144,65139,
65133,65128,65122,65117,65111,65105,65099,65094,
65088,65082,65076,65070,65064,65058,65052,65046,
65040,65033,65027,65021,65015,65008,65002,64995,
64989,64982,64976,64969,64963,64956,64949,64943,
64936,64929,64922,64915,64908,64902,64895,64887,
64880,64873,64866,64859,64852,64844,64837,64830,
64822,64815,64808,64800,64793,64785,64777,64770,
64762,64754,64747,64739,64731,64723,64715,64707,
64699,64691,64683,64675,64667,64659,64651,64642,
64634,64626,64617,64609,64600,64592,64584,64575,
64566,64558,64549,64540,64532,64523,64514,64505,
64496,64487,64478,64469,64460,64451,64442,64433,
64424,64414,64405,64396,64387,64377,64368,64358,
64349,64339,64330,64320,64310,64301,64291,64281,
64271,64261,64252,64242,64232,64222,64212,64202,
64192,64181,64171,64161,64151,64140,64130,64120,
64109,64099,64088,64078,64067,64057,64046,64035,
64025,64014,64003,63992,63981,63971,63960,63949,
63938,63927,63915,63904,63893,63882,63871,63859,
63848,63837,63825,63814,63803,63791,63779,63768,
63756,63745,63733,63721,63709,63698,63686,63674,
63662,63650,63638,63626,63614,63602,63590,63578,
63565,63553,63541,63528,63516,63504,63491,63479,
63466,63454,63441,63429,63416,63403,63390,63378,
63365,63352,63339,63326,63313,63300,63287,63274,
63261,63248,63235,63221,63208,63195,63182,63168,
63155,63141,63128,63114,63101,63087,63074,63060,
63046,63032,63019,63005,62991,62977,62963,62949,
62935,62921,62907,62893,62879,62865,62850,62836,
62822,62808,62793,62779,62764,62750,62735,62721,
62706,62692,62677,62662,62648,62633,62618,62603,
62588,62573,62558,62543,62528,62513,62498,62483,
62468,62453,62437,62422,62407,62391,62376,62360,
62345,62329,62314,62298,62283,62267,62251,62236,
62220,62204,62188,62172,62156,62141,62125,62108,
62092,62076,62060,62044,62028,62012,61995,61979,
61963,61946,61930,61913,61897,61880,61864,61847,
61831,61814,61797,61780,61764,61747,61730,61713,
61696,61679,61662,61645,61628,61611,61594,61577,
61559,61542,61525,61507,61490,61473,61455,61438,
61420,61403,61385,61367,61350,61332,61314,61297,
61279,61261,61243,61225,61207,61189,61171,61153,
61135,61117,61099,61081,61062,61044,61026,61007,
60989,60971,60952,60934,60915,60897,60878,60859,
60841,60822,60803,60785,60766,60747,60728,60709,
60690,60671,60652,60633,60614,60595,60576,60556,
60537,60518,60499,60479,60460,60441,60421,60402,
60382,60363,60343,60323,60304,60284,60264,60244,
60225,60205,60185,60165,60145,60125,60105,60085,
60065,60045,60025,60004,59984,59964,59944,59923,
59903,59883,59862,59842,59821,59801,59780,59759,
59739,59718,59697,59677,59656,59635,59614,59593,
59572,59551,59530,59509,59488,59467,59446,59425,
59404,59382,59361,59340,59318,59297,59276,59254,
59233,59211,59190,59168,59146,59125,59103,59081,
59059,59038,59016,58994,58972,58950,58928,58906,
58884,58862,58840,58818,58795,58773,58751,58729,
58706,58684,58662,58639,58617,58594,58572,58549,
58527,58504,58481,58459,58436,58413,58390,58367,
58345,58322,58299,58276,58253,58230,58207,58183,
58160,58137,58114,58091,58067,58044,58021,57997,
57974,57950,57927,57903,57880,57856,57833,57809,
57785,57762,57738,57714,57690,57666,57642,57618,
57594,57570,57546,57522,57498,57474,57450,57426,
57402,57377,57353,57329,57304,57280,57255,57231,
57206,57182,57157,57133,57108,57083,57059,57034,
57009,56984,56959,56935,56910,56885,56860,56835,
56810,56785,56760,56734,56709,56684,56659,56633,
56608,56583,56557,56532,56507,56481,56456,56430,
56404,56379,56353,56328,56302,56276,56250,56225,
56199,56173,56147,56121,56095,56069,56043,56017,
55991,55965,55938,55912,55886,55860,55833,55807,
55781,55754,55728,55701,55675,55648,55622,55595,
55569,55542,55515,55489,55462,55435,55408,55381,
55354,55327,55300,55274,55246,55219,55192,55165,
55138,55111,55084,55056,55029,55002,54974,54947,
54920,54892,54865,54837,54810,54782,54755,54727,
54699,54672,54644,54616,54588,54560,54533,54505,
54477,54449,54421,54393,54365,54337,54308,54280,
54252,54224,54196,54167,54139,54111,54082,54054,
54026,53997,53969,53940,53911,53883,53854,53826,
53797,53768,53739,53711,53682,53653,53624,53595,
53566,53537,53508,53479,53450,53421,53392,53363,
53334,53304,53275,53246,53216,53187,53158,53128,
53099,53069,53040,53010,52981,52951,52922,52892,
52862,52832,52803,52773,52743,52713,52683,52653,
52624,52594,52564,52534,52503,52473,52443,52413,
52383,52353,52322,52292,52262,52231,52201,52171,
52140,52110,52079,52049,52018,51988,51957,51926,
51896,51865,51834,51803,51773,51742,51711,51680,
51649,51618,51587,51556,51525,51494,51463,51432,
51401,51369,51338,51307,51276,51244,51213,51182,
51150,51119,51087,51056,51024,50993,50961,50929,
50898,50866,50834,50803,50771,50739,50707,50675,
50644,50612,50580,50548,50516,50484,50452,50420,
50387,50355,50323,50291,50259,50226,50194,50162,
50129,50097,50065,50032,50000,49967,49935,49902,
49869,49837,49804,49771,49739,49706,49673,49640,
49608,49575,49542,49509,49476,49443,49410,49377,
49344,49311,49278,49244,49211,49178,49145,49112,
49078,49045,49012,48978,48945,48911,48878,48844,
48811,48777,48744,48710,48676,48643,48609,48575,
48542,48508,48474,48440,48406,48372,48338,48304,
48271,48237,48202,48168,48134,48100,48066,48032,
47998,47963,47929,47895,47860,47826,47792,47757,
47723,47688,47654,47619,47585,47550,47516,47481,
47446,47412,47377,47342,47308,47273,47238,47203,
47168,47133,47098,47063,47028,46993,46958,46923,
46888,46853,46818,46783,46747,46712,46677,46642,
46606,46571,46536,46500,46465,46429,46394,46358,
46323,46287,46252,46216,46180,46145,46109,46073,
46037,46002,45966,45930,45894,45858,45822,45786,
45750,45714,45678,45642,45606,45570,45534,45498,
45462,45425,45389,45353,45316,45280,45244,45207,
45171,45135,45098,45062,45025,44989,44952,44915,
44879,44842,44806,44769,44732,44695,44659,44622,
44585,44548,44511,44474,44437,44400,44363,44326,
44289,44252,44215,44178,44141,44104,44067,44029,
43992,43955,43918,43880,43843,43806,43768,43731,
43693,43656,43618,43581,43543,43506,43468,43430,
43393,43355,43317,43280,43242,43204,43166,43128,
43091,43053,43015,42977,42939,42901,42863,42825,
42787,42749,42711,42672,42634,42596,42558,42520,
42481,42443,42405,42366,42328,42290,42251,42213,
42174,42136,42097,42059,42020,41982,41943,41904,
41866,41827,41788,41750,41711,41672,41633,41595,
41556,41517,41478,41439,41400,41361,41322,41283,
41244,41205,41166,41127,41088,41048,41009,40970,
40931,40891,40852,40813,40773,40734,40695,40655,
40616,40576,40537,40497,40458,40418,40379,40339,
40300,40260,40220,40180,40141,40101,40061,40021,
39982,39942,39902,39862,39822,39782,39742,39702,
39662,39622,39582,39542,39502,39462,39422,39382,
39341,39301,39261,39221,39180,39140,39100,39059,
39019,38979,38938,38898,38857,38817,38776,38736,
38695,38655,38614,38573,38533,38492,38451,38411,
38370,38329,38288,38248,38207,38166,38125,38084,
38043,38002,37961,37920,37879,37838,37797,37756,
37715,37674,37633,37592,37551,37509,37468,37427,
37386,37344,37303,37262,37220,37179,37137,37096,
37055,37013,36972,36930,36889,36847,36805,36764,
36722,36681,36639,36597,36556,36514,36472,36430,
36388,36347,36305,36263,36221,36179,36137,36095,
36053,36011,35969,35927,35885,35843,35801,35759,
35717,35675,35633,35590,35548,35506,35464,35421,
35379,35337,35294,35252,35210,35167,35125,35082,
35040,34997,34955,34912,34870,34827,34785,34742,
34699,34657,34614,34571,34529,34486,34443,34400,
34358,34315,34272,34229,34186,34143,34100,34057,
34015,33972,33929,33886,33843,33799,33756,33713,
33670,33627,33584,33541,33498,33454,33411,33368,
33325,33281,33238,33195,33151,33108,33065,33021,
32978,32934,32891,32847,32804,32760,32717,32673,
32630,32586,32542,32499,32455,32411,32368,32324,
32280,32236,32193,32149,32105,32061,32017,31974,
31930,31886,31842,31798,31754,31710,31666,31622,
31578,31534,31490,31446,31402,31357,31313,31269,
31225,31181,31136,31092,31048,31004,30959,30915,
30871,30826,30782,30738,30693,30649,30604,30560,
30515,30471,30426,30382,30337,30293,30248,30204,
30159,30114,30070,30025,29980,29936,29891,29846,
29801,29757,29712,29667,29622,29577,29533,29488,
29443,29398,29353,29308,29263,29218,29173,29128,
29083,29038,28993,28948,28903,28858,28812,28767,
28722,28677,28632,28586,28541,28496,28451,28405,
28360,28315,28269,28224,28179,28133,28088,28042,
27997,27952,27906,27861,27815,27770,27724,27678,
27633,27587,27542,27496,27450,27405,27359,27313,
27268,27222,27176,27131,27085,27039,26993,26947,
26902,26856,26810,26764,26718,26672,26626,26580,
26534,26488,26442,26396,26350,26304,26258,26212,
26166,26120,26074,26028,25982,25936,25889,25843,
25797,25751,25705,25658,25612,25566,25520,25473,
25427,25381,25334,25288,25241,25195,25149,25102,
25056,25009,24963,24916,24870,24823,24777,24730,
24684,24637,24591,24544,24497,24451,24404,24357,
24311,24264,24217,24171,24124,24077,24030,23984,
23937,23890,23843,23796,23750,23703,23656,23609,
23562,23515,23468,23421,23374,23327,23280,23233,
23186,23139,23092,23045,22998,22951,22904,22857,
22810,22763,22716,22668,22621,22574,22527,22480,
22433,22385,22338,22291,22243,22196,22149,22102,
22054,22007,21960,21912,21865,21817,21770,21723,
21675,21628,21580,21533,21485,21438,21390,21343,
21295,21248,21200,21153,21105,21057,21010,20962,
20915,20867,20819,20772,20724,20676,20629,20581,
20533,20485,20438,20390,20342,20294,20246,20199,
20151,20103,20055,20007,19959,19912,19864,19816,
19768,19720,19672,19624,19576,19528,19480,19432,
19384,19336,19288,19240,19192,19144,19096,19048,
19000,18951,18903,18855,18807,18759,18711,18663,
18614,18566,18518,18470,18421,18373,18325,18277,
18228,18180,18132,18084,18035,17987,17939,17890,
17842,17793,17745,17697,17648,17600,17551,17503,
17455,17406,17358,17309,17261,17212,17164,17115,
17067,17018,16970,16921,16872,16824,16775,16727,
16678,16629,16581,16532,16484,16435,16386,16338,
16289,16240,16191,16143,16094,16045,15997,15948,
15899,15850,15802,15753,15704,15655,15606,15557,
15509,15460,15411,15362,15313,15264,15215,15167,
15118,15069,15020,14971,14922,14873,14824,14775,
14726,14677,14628,14579,14530,14481,14432,14383,
14334,14285,14236,14187,14138,14089,14040,13990,
13941,13892,13843,13794,13745,13696,13646,13597,
13548,13499,13450,13401,13351,13302,13253,13204,
13154,13105,13056,13007,12957,12908,12859,12810,
12760,12711,12662,12612,12563,12514,12464,12415,
12366,12316,12267,12218,12168,12119,12069,12020,
11970,11921,11872,11822,11773,11723,11674,11624,
11575,11525,11476,11426,11377,11327,11278,11228,
11179,11129,11080,11030,10981,10931,10882,10832,
10782,10733,10683,10634,10584,10534,10485,10435,
10386,10336,10286,10237,10187,10137,10088,10038,
9988,9939,9889,9839,9790,9740,9690,9640,
9591,9541,9491,9442,9392,9342,9292,9243,
9193,9143,9093,9043,8994,8944,8894,8844,
8794,8745,8695,8645,8595,8545,8496,8446,
8396,8346,8296,8246,8196,8147,8097,8047,
7997,7947,7897,7847,7797,7747,7697,7648,
7598,7548,7498,7448,7398,7348,7298,7248,
7198,7148,7098,7048,6998,6948,6898,6848,
6798,6748,6698,6648,6598,6548,6498,6448,
6398,6348,6298,6248,6198,6148,6098,6048,
5998,5948,5898,5848,5798,5748,5697,5647,
5597,5547,5497,5447,5397,5347,5297,5247,
5197,5146,5096,5046,4996,4946,4896,4846,
4796,4745,4695,4645,4595,4545,4495,4445,
4394,4344,4294,4244,4194,4144,4093,4043,
3993,3943,3893,3843,3792,3742,3692,3642,
3592,3541,3491,3441,3391,3341,3291,3240,
3190,3140,3090,3039,2989,2939,2889,2839,
2788,2738,2688,2638,2587,2537,2487,2437,
2387,2336,2286,2236,2186,2135,2085,2035,
1985,1934,1884,1834,1784,1733,1683,1633,
1583,1532,1482,1432,1382,1331,1281,1231,
1181,1130,1080,1030,980,929,879,829,
779,728,678,628,578,527,477,427,
376,326,276,226,175,125,75,25,
-25,-75,-125,-175,-226,-276,-326,-376,
-427,-477,-527,-578,-628,-678,-728,-779,
-829,-879,-929,-980,-1030,-1080,-1130,-1181,
-1231,-1281,-1331,-1382,-1432,-1482,-1532,-1583,
-1633,-1683,-1733,-1784,-1834,-1884,-1934,-1985,
-2035,-2085,-2135,-2186,-2236,-2286,-2336,-2387,
-2437,-2487,-2537,-2588,-2638,-2688,-2738,-2788,
-2839,-2889,-2939,-2989,-3039,-3090,-3140,-3190,
-3240,-3291,-3341,-3391,-3441,-3491,-3541,-3592,
-3642,-3692,-3742,-3792,-3843,-3893,-3943,-3993,
-4043,-4093,-4144,-4194,-4244,-4294,-4344,-4394,
-4445,-4495,-4545,-4595,-4645,-4695,-4745,-4796,
-4846,-4896,-4946,-4996,-5046,-5096,-5146,-5197,
-5247,-5297,-5347,-5397,-5447,-5497,-5547,-5597,
-5647,-5697,-5748,-5798,-5848,-5898,-5948,-5998,
-6048,-6098,-6148,-6198,-6248,-6298,-6348,-6398,
-6448,-6498,-6548,-6598,-6648,-6698,-6748,-6798,
-6848,-6898,-6948,-6998,-7048,-7098,-7148,-7198,
-7248,-7298,-7348,-7398,-7448,-7498,-7548,-7598,
-7648,-7697,-7747,-7797,-7847,-7897,-7947,-7997,
-8047,-8097,-8147,-8196,-8246,-8296,-8346,-8396,
-8446,-8496,-8545,-8595,-8645,-8695,-8745,-8794,
-8844,-8894,-8944,-8994,-9043,-9093,-9143,-9193,
-9243,-9292,-9342,-9392,-9442,-9491,-9541,-9591,
-9640,-9690,-9740,-9790,-9839,-9889,-9939,-9988,
-10038,-10088,-10137,-10187,-10237,-10286,-10336,-10386,
-10435,-10485,-10534,-10584,-10634,-10683,-10733,-10782,
-10832,-10882,-10931,-10981,-11030,-11080,-11129,-11179,
-11228,-11278,-11327,-11377,-11426,-11476,-11525,-11575,
-11624,-11674,-11723,-11773,-11822,-11872,-11921,-11970,
-12020,-12069,-12119,-12168,-12218,-12267,-12316,-12366,
-12415,-12464,-12514,-12563,-12612,-12662,-12711,-12760,
-12810,-12859,-12908,-12957,-13007,-13056,-13105,-13154,
-13204,-13253,-13302,-13351,-13401,-13450,-13499,-13548,
-13597,-13647,-13696,-13745,-13794,-13843,-13892,-13941,
-13990,-14040,-14089,-14138,-14187,-14236,-14285,-14334,
-14383,-14432,-14481,-14530,-14579,-14628,-14677,-14726,
-14775,-14824,-14873,-14922,-14971,-15020,-15069,-15118,
-15167,-15215,-15264,-15313,-15362,-15411,-15460,-15509,
-15557,-15606,-15655,-15704,-15753,-15802,-15850,-15899,
-15948,-15997,-16045,-16094,-16143,-16191,-16240,-16289,
-16338,-16386,-16435,-16484,-16532,-16581,-16629,-16678,
-16727,-16775,-16824,-16872,-16921,-16970,-17018,-17067,
-17115,-17164,-17212,-17261,-17309,-17358,-17406,-17455,
-17503,-17551,-17600,-17648,-17697,-17745,-17793,-17842,
-17890,-17939,-17987,-18035,-18084,-18132,-18180,-18228,
-18277,-18325,-18373,-18421,-18470,-18518,-18566,-18614,
-18663,-18711,-18759,-18807,-18855,-18903,-18951,-19000,
-19048,-19096,-19144,-19192,-19240,-19288,-19336,-19384,
-19432,-19480,-19528,-19576,-19624,-19672,-19720,-19768,
-19816,-19864,-19912,-19959,-20007,-20055,-20103,-20151,
-20199,-20246,-20294,-20342,-20390,-20438,-20485,-20533,
-20581,-20629,-20676,-20724,-20772,-20819,-20867,-20915,
-20962,-21010,-21057,-21105,-21153,-21200,-21248,-21295,
-21343,-21390,-21438,-21485,-21533,-21580,-21628,-21675,
-21723,-21770,-21817,-21865,-21912,-21960,-22007,-22054,
-22102,-22149,-22196,-22243,-22291,-22338,-22385,-22433,
-22480,-22527,-22574,-22621,-22668,-22716,-22763,-22810,
-22857,-22904,-22951,-22998,-23045,-23092,-23139,-23186,
-23233,-23280,-23327,-23374,-23421,-23468,-23515,-23562,
-23609,-23656,-23703,-23750,-23796,-23843,-23890,-23937,
-23984,-24030,-24077,-24124,-24171,-24217,-24264,-24311,
-24357,-24404,-24451,-24497,-24544,-24591,-24637,-24684,
-24730,-24777,-24823,-24870,-24916,-24963,-25009,-25056,
-25102,-25149,-25195,-25241,-25288,-25334,-25381,-25427,
-25473,-25520,-25566,-25612,-25658,-25705,-25751,-25797,
-25843,-25889,-25936,-25982,-26028,-26074,-26120,-26166,
-26212,-26258,-26304,-26350,-26396,-26442,-26488,-26534,
-26580,-26626,-26672,-26718,-26764,-26810,-26856,-26902,
-26947,-26993,-27039,-27085,-27131,-27176,-27222,-27268,
-27313,-27359,-27405,-27450,-27496,-27542,-27587,-27633,
-27678,-27724,-27770,-27815,-27861,-27906,-27952,-27997,
-28042,-28088,-28133,-28179,-28224,-28269,-28315,-28360,
-28405,-28451,-28496,-28541,-28586,-28632,-28677,-28722,
-28767,-28812,-28858,-28903,-28948,-28993,-29038,-29083,
-29128,-29173,-29218,-29263,-29308,-29353,-29398,-29443,
-29488,-29533,-29577,-29622,-29667,-29712,-29757,-29801,
-29846,-29891,-29936,-29980,-30025,-30070,-30114,-30159,
-30204,-30248,-30293,-30337,-30382,-30426,-30471,-30515,
-30560,-30604,-30649,-30693,-30738,-30782,-30826,-30871,
-30915,-30959,-31004,-31048,-31092,-31136,-31181,-31225,
-31269,-31313,-31357,-31402,-31446,-31490,-31534,-31578,
-31622,-31666,-31710,-31754,-31798,-31842,-31886,-31930,
-31974,-32017,-32061,-32105,-32149,-32193,-32236,-32280,
-32324,-32368,-32411,-32455,-32499,-32542,-32586,-32630,
-32673,-32717,-32760,-32804,-32847,-32891,-32934,-32978,
-33021,-33065,-33108,-33151,-33195,-33238,-33281,-33325,
-33368,-33411,-33454,-33498,-33541,-33584,-33627,-33670,
-33713,-33756,-33799,-33843,-33886,-33929,-33972,-34015,
-34057,-34100,-34143,-34186,-34229,-34272,-34315,-34358,
-34400,-34443,-34486,-34529,-34571,-34614,-34657,-34699,
-34742,-34785,-34827,-34870,-34912,-34955,-34997,-35040,
-35082,-35125,-35167,-35210,-35252,-35294,-35337,-35379,
-35421,-35464,-35506,-35548,-35590,-35633,-35675,-35717,
-35759,-35801,-35843,-35885,-35927,-35969,-36011,-36053,
-36095,-36137,-36179,-36221,-36263,-36305,-36347,-36388,
-36430,-36472,-36514,-36555,-36597,-36639,-36681,-36722,
-36764,-36805,-36847,-36889,-36930,-36972,-37013,-37055,
-37096,-37137,-37179,-37220,-37262,-37303,-37344,-37386,
-37427,-37468,-37509,-37551,-37592,-37633,-37674,-37715,
-37756,-37797,-37838,-37879,-37920,-37961,-38002,-38043,
-38084,-38125,-38166,-38207,-38248,-38288,-38329,-38370,
-38411,-38451,-38492,-38533,-38573,-38614,-38655,-38695,
-38736,-38776,-38817,-38857,-38898,-38938,-38979,-39019,
-39059,-39100,-39140,-39180,-39221,-39261,-39301,-39341,
-39382,-39422,-39462,-39502,-39542,-39582,-39622,-39662,
-39702,-39742,-39782,-39822,-39862,-39902,-39942,-39982,
-40021,-40061,-40101,-40141,-40180,-40220,-40260,-40299,
-40339,-40379,-40418,-40458,-40497,-40537,-40576,-40616,
-40655,-40695,-40734,-40773,-40813,-40852,-40891,-40931,
-40970,-41009,-41048,-41087,-41127,-41166,-41205,-41244,
-41283,-41322,-41361,-41400,-41439,-41478,-41517,-41556,
-41595,-41633,-41672,-41711,-41750,-41788,-41827,-41866,
-41904,-41943,-41982,-42020,-42059,-42097,-42136,-42174,
-42213,-42251,-42290,-42328,-42366,-42405,-42443,-42481,
-42520,-42558,-42596,-42634,-42672,-42711,-42749,-42787,
-42825,-42863,-42901,-42939,-42977,-43015,-43053,-43091,
-43128,-43166,-43204,-43242,-43280,-43317,-43355,-43393,
-43430,-43468,-43506,-43543,-43581,-43618,-43656,-43693,
-43731,-43768,-43806,-43843,-43880,-43918,-43955,-43992,
-44029,-44067,-44104,-44141,-44178,-44215,-44252,-44289,
-44326,-44363,-44400,-44437,-44474,-44511,-44548,-44585,
-44622,-44659,-44695,-44732,-44769,-44806,-44842,-44879,
-44915,-44952,-44989,-45025,-45062,-45098,-45135,-45171,
-45207,-45244,-45280,-45316,-45353,-45389,-45425,-45462,
-45498,-45534,-45570,-45606,-45642,-45678,-45714,-45750,
-45786,-45822,-45858,-45894,-45930,-45966,-46002,-46037,
-46073,-46109,-46145,-46180,-46216,-46252,-46287,-46323,
-46358,-46394,-46429,-46465,-46500,-46536,-46571,-46606,
-46642,-46677,-46712,-46747,-46783,-46818,-46853,-46888,
-46923,-46958,-46993,-47028,-47063,-47098,-47133,-47168,
-47203,-47238,-47273,-47308,-47342,-47377,-47412,-47446,
-47481,-47516,-47550,-47585,-47619,-47654,-47688,-47723,
-47757,-47792,-47826,-47860,-47895,-47929,-47963,-47998,
-48032,-48066,-48100,-48134,-48168,-48202,-48236,-48271,
-48304,-48338,-48372,-48406,-48440,-48474,-48508,-48542,
-48575,-48609,-48643,-48676,-48710,-48744,-48777,-48811,
-48844,-48878,-48911,-48945,-48978,-49012,-49045,-49078,
-49112,-49145,-49178,-49211,-49244,-49278,-49311,-49344,
-49377,-49410,-49443,-49476,-49509,-49542,-49575,-49608,
-49640,-49673,-49706,-49739,-49771,-49804,-49837,-49869,
-49902,-49935,-49967,-50000,-50032,-50065,-50097,-50129,
-50162,-50194,-50226,-50259,-50291,-50323,-50355,-50387,
-50420,-50452,-50484,-50516,-50548,-50580,-50612,-50644,
-50675,-50707,-50739,-50771,-50803,-50834,-50866,-50898,
-50929,-50961,-50993,-51024,-51056,-51087,-51119,-51150,
-51182,-51213,-51244,-51276,-51307,-51338,-51369,-51401,
-51432,-51463,-51494,-51525,-51556,-51587,-51618,-51649,
-51680,-51711,-51742,-51773,-51803,-51834,-51865,-51896,
-51926,-51957,-51988,-52018,-52049,-52079,-52110,-52140,
-52171,-52201,-52231,-52262,-52292,-52322,-52353,-52383,
-52413,-52443,-52473,-52503,-52534,-52564,-52594,-52624,
-52653,-52683,-52713,-52743,-52773,-52803,-52832,-52862,
-52892,-52922,-52951,-52981,-53010,-53040,-53069,-53099,
-53128,-53158,-53187,-53216,-53246,-53275,-53304,-53334,
-53363,-53392,-53421,-53450,-53479,-53508,-53537,-53566,
-53595,-53624,-53653,-53682,-53711,-53739,-53768,-53797,
-53826,-53854,-53883,-53911,-53940,-53969,-53997,-54026,
-54054,-54082,-54111,-54139,-54167,-54196,-54224,-54252,
-54280,-54308,-54337,-54365,-54393,-54421,-54449,-54477,
-54505,-54533,-54560,-54588,-54616,-54644,-54672,-54699,
-54727,-54755,-54782,-54810,-54837,-54865,-54892,-54920,
-54947,-54974,-55002,-55029,-55056,-55084,-55111,-55138,
-55165,-55192,-55219,-55246,-55274,-55300,-55327,-55354,
-55381,-55408,-55435,-55462,-55489,-55515,-55542,-55569,
-55595,-55622,-55648,-55675,-55701,-55728,-55754,-55781,
-55807,-55833,-55860,-55886,-55912,-55938,-55965,-55991,
-56017,-56043,-56069,-56095,-56121,-56147,-56173,-56199,
-56225,-56250,-56276,-56302,-56328,-56353,-56379,-56404,
-56430,-56456,-56481,-56507,-56532,-56557,-56583,-56608,
-56633,-56659,-56684,-56709,-56734,-56760,-56785,-56810,
-56835,-56860,-56885,-56910,-56935,-56959,-56984,-57009,
-57034,-57059,-57083,-57108,-57133,-57157,-57182,-57206,
-57231,-57255,-57280,-57304,-57329,-57353,-57377,-57402,
-57426,-57450,-57474,-57498,-57522,-57546,-57570,-57594,
-57618,-57642,-57666,-57690,-57714,-57738,-57762,-57785,
-57809,-57833,-57856,-57880,-57903,-57927,-57950,-57974,
-57997,-58021,-58044,-58067,-58091,-58114,-58137,-58160,
-58183,-58207,-58230,-58253,-58276,-58299,-58322,-58345,
-58367,-58390,-58413,-58436,-58459,-58481,-58504,-58527,
-58549,-58572,-58594,-58617,-58639,-58662,-58684,-58706,
-58729,-58751,-58773,-58795,-58818,-58840,-58862,-58884,
-58906,-58928,-58950,-58972,-58994,-59016,-59038,-59059,
-59081,-59103,-59125,-59146,-59168,-59190,-59211,-59233,
-59254,-59276,-59297,-59318,-59340,-59361,-59382,-59404,
-59425,-59446,-59467,-59488,-59509,-59530,-59551,-59572,
-59593,-59614,-59635,-59656,-59677,-59697,-59718,-59739,
-59759,-59780,-59801,-59821,-59842,-59862,-59883,-59903,
-59923,-59944,-59964,-59984,-60004,-60025,-60045,-60065,
-60085,-60105,-60125,-60145,-60165,-60185,-60205,-60225,
-60244,-60264,-60284,-60304,-60323,-60343,-60363,-60382,
-60402,-60421,-60441,-60460,-60479,-60499,-60518,-60537,
-60556,-60576,-60595,-60614,-60633,-60652,-60671,-60690,
-60709,-60728,-60747,-60766,-60785,-60803,-60822,-60841,
-60859,-60878,-60897,-60915,-60934,-60952,-60971,-60989,
-61007,-61026,-61044,-61062,-61081,-61099,-61117,-61135,
-61153,-61171,-61189,-61207,-61225,-61243,-61261,-61279,
-61297,-61314,-61332,-61350,-61367,-61385,-61403,-61420,
-61438,-61455,-61473,-61490,-61507,-61525,-61542,-61559,
-61577,-61594,-61611,-61628,-61645,-61662,-61679,-61696,
-61713,-61730,-61747,-61764,-61780,-61797,-61814,-61831,
-61847,-61864,-61880,-61897,-61913,-61930,-61946,-61963,
-61979,-61995,-62012,-62028,-62044,-62060,-62076,-62092,
-62108,-62125,-62141,-62156,-62172,-62188,-62204,-62220,
-62236,-62251,-62267,-62283,-62298,-62314,-62329,-62345,
-62360,-62376,-62391,-62407,-62422,-62437,-62453,-62468,
-62483,-62498,-62513,-62528,-62543,-62558,-62573,-62588,
-62603,-62618,-62633,-62648,-62662,-62677,-62692,-62706,
-62721,-62735,-62750,-62764,-62779,-62793,-62808,-62822,
-62836,-62850,-62865,-62879,-62893,-62907,-62921,-62935,
-62949,-62963,-62977,-62991,-63005,-63019,-63032,-63046,
-63060,-63074,-63087,-63101,-63114,-63128,-63141,-63155,
-63168,-63182,-63195,-63208,-63221,-63235,-63248,-63261,
-63274,-63287,-63300,-63313,-63326,-63339,-63352,-63365,
-63378,-63390,-63403,-63416,-63429,-63441,-63454,-63466,
-63479,-63491,-63504,-63516,-63528,-63541,-63553,-63565,
-63578,-63590,-63602,-63614,-63626,-63638,-63650,-63662,
-63674,-63686,-63698,-63709,-63721,-63733,-63745,-63756,
-63768,-63779,-63791,-63803,-63814,-63825,-63837,-63848,
-63859,-63871,-63882,-63893,-63904,-63915,-63927,-63938,
-63949,-63960,-63971,-63981,-63992,-64003,-64014,-64025,
-64035,-64046,-64057,-64067,-64078,-64088,-64099,-64109,
-64120,-64130,-64140,-64151,-64161,-64171,-64181,-64192,
-64202,-64212,-64222,-64232,-64242,-64252,-64261,-64271,
-64281,-64291,-64301,-64310,-64320,-64330,-64339,-64349,
-64358,-64368,-64377,-64387,-64396,-64405,-64414,-64424,
-64433,-64442,-64451,-64460,-64469,-64478,-64487,-64496,
-64505,-64514,-64523,-64532,-64540,-64549,-64558,-64566,
-64575,-64584,-64592,-64601,-64609,-64617,-64626,-64634,
-64642,-64651,-64659,-64667,-64675,-64683,-64691,-64699,
-64707,-64715,-64723,-64731,-64739,-64747,-64754,-64762,
-64770,-64777,-64785,-64793,-64800,-64808,-64815,-64822,
-64830,-64837,-64844,-64852,-64859,-64866,-64873,-64880,
-64887,-64895,-64902,-64908,-64915,-64922,-64929,-64936,
-64943,-64949,-64956,-64963,-64969,-64976,-64982,-64989,
-64995,-65002,-65008,-65015,-65021,-65027,-65033,-65040,
-65046,-65052,-65058,-65064,-65070,-65076,-65082,-65088,
-65094,-65099,-65105,-65111,-65117,-65122,-65128,-65133,
-65139,-65144,-65150,-65155,-65161,-65166,-65171,-65177,
-65182,-65187,-65192,-65197,-65202,-65207,-65212,-65217,
-65222,-65227,-65232,-65237,-65242,-65246,-65251,-65256,
-65260,-65265,-65270,-65274,-65279,-65283,-65287,-65292,
-65296,-65300,-65305,-65309,-65313,-65317,-65321,-65325,
-65329,-65333,-65337,-65341,-65345,-65349,-65352,-65356,
-65360,-65363,-65367,-65371,-65374,-65378,-65381,-65385,
-65388,-65391,-65395,-65398,-65401,-65404,-65408,-65411,
-65414,-65417,-65420,-65423,-65426,-65429,-65431,-65434,
-65437,-65440,-65442,-65445,-65448,-65450,-65453,-65455,
-65458,-65460,-65463,-65465,-65467,-65470,-65472,-65474,
-65476,-65478,-65480,-65482,-65484,-65486,-65488,-65490,
-65492,-65494,-65496,-65497,-65499,-65501,-65502,-65504,
-65505,-65507,-65508,-65510,-65511,-65513,-65514,-65515,
-65516,-65518,-65519,-65520,-65521,-65522,-65523,-65524,
-65525,-65526,-65527,-65527,-65528,-65529,-65530,-65530,
-65531,-65531,-65532,-65532,-65533,-65533,-65534,-65534,
-65534,-65535,-65535,-65535,-65535,-65535,-65535,-65535,
-65535,-65535,-65535,-65535,-65535,-65535,-65535,-65534,
-65534,-65534,-65533,-65533,-65532,-65532,-65531,-65531,
-65530,-65530,-65529,-65528,-65527,-65527,-65526,-65525,
-65524,-65523,-65522,-65521,-65520,-65519,-65518,-65516,
-65515,-65514,-65513,-65511,-65510,-65508,-65507,-65505,
-65504,-65502,-65501,-65499,-65497,-65496,-65494,-65492,
-65490,-65488,-65486,-65484,-65482,-65480,-65478,-65476,
-65474,-65472,-65470,-65467,-65465,-65463,-65460,-65458,
-65455,-65453,-65450,-65448,-65445,-65442,-65440,-65437,
-65434,-65431,-65429,-65426,-65423,-65420,-65417,-65414,
-65411,-65408,-65404,-65401,-65398,-65395,-65391,-65388,
-65385,-65381,-65378,-65374,-65371,-65367,-65363,-65360,
-65356,-65352,-65349,-65345,-65341,-65337,-65333,-65329,
-65325,-65321,-65317,-65313,-65309,-65305,-65300,-65296,
-65292,-65287,-65283,-65279,-65274,-65270,-65265,-65260,
-65256,-65251,-65246,-65242,-65237,-65232,-65227,-65222,
-65217,-65212,-65207,-65202,-65197,-65192,-65187,-65182,
-65177,-65171,-65166,-65161,-65155,-65150,-65144,-65139,
-65133,-65128,-65122,-65117,-65111,-65105,-65099,-65094,
-65088,-65082,-65076,-65070,-65064,-65058,-65052,-65046,
-65040,-65033,-65027,-65021,-65015,-65008,-65002,-64995,
-64989,-64982,-64976,-64969,-64963,-64956,-64949,-64943,
-64936,-64929,-64922,-64915,-64908,-64902,-64895,-64887,
-64880,-64873,-64866,-64859,-64852,-64844,-64837,-64830,
-64822,-64815,-64808,-64800,-64793,-64785,-64777,-64770,
-64762,-64754,-64747,-64739,-64731,-64723,-64715,-64707,
-64699,-64691,-64683,-64675,-64667,-64659,-64651,-64642,
-64634,-64626,-64617,-64609,-64601,-64592,-64584,-64575,
-64566,-64558,-64549,-64540,-64532,-64523,-64514,-64505,
-64496,-64487,-64478,-64469,-64460,-64451,-64442,-64433,
-64424,-64414,-64405,-64396,-64387,-64377,-64368,-64358,
-64349,-64339,-64330,-64320,-64310,-64301,-64291,-64281,
-64271,-64261,-64252,-64242,-64232,-64222,-64212,-64202,
-64192,-64181,-64171,-64161,-64151,-64140,-64130,-64120,
-64109,-64099,-64088,-64078,-64067,-64057,-64046,-64035,
-64025,-64014,-64003,-63992,-63981,-63971,-63960,-63949,
-63938,-63927,-63915,-63904,-63893,-63882,-63871,-63859,
-63848,-63837,-63825,-63814,-63803,-63791,-63779,-63768,
-63756,-63745,-63733,-63721,-63709,-63698,-63686,-63674,
-63662,-63650,-63638,-63626,-63614,-63602,-63590,-63578,
-63565,-63553,-63541,-63528,-63516,-63504,-63491,-63479,
-63466,-63454,-63441,-63429,-63416,-63403,-63390,-63378,
-63365,-63352,-63339,-63326,-63313,-63300,-63287,-63274,
-63261,-63248,-63235,-63221,-63208,-63195,-63182,-63168,
-63155,-63141,-63128,-63114,-63101,-63087,-63074,-63060,
-63046,-63032,-63019,-63005,-62991,-62977,-62963,-62949,
-62935,-62921,-62907,-62893,-62879,-62865,-62850,-62836,
-62822,-62808,-62793,-62779,-62764,-62750,-62735,-62721,
-62706,-62692,-62677,-62662,-62648,-62633,-62618,-62603,
-62588,-62573,-62558,-62543,-62528,-62513,-62498,-62483,
-62468,-62453,-62437,-62422,-62407,-62391,-62376,-62360,
-62345,-62329,-62314,-62298,-62283,-62267,-62251,-62236,
-62220,-62204,-62188,-62172,-62156,-62141,-62125,-62108,
-62092,-62076,-62060,-62044,-62028,-62012,-61995,-61979,
-61963,-61946,-61930,-61913,-61897,-61880,-61864,-61847,
-61831,-61814,-61797,-61780,-61764,-61747,-61730,-61713,
-61696,-61679,-61662,-61645,-61628,-61611,-61594,-61577,
-61559,-61542,-61525,-61507,-61490,-61473,-61455,-61438,
-61420,-61403,-61385,-61367,-61350,-61332,-61314,-61297,
-61279,-61261,-61243,-61225,-61207,-61189,-61171,-61153,
-61135,-61117,-61099,-61081,-61062,-61044,-61026,-61007,
-60989,-60971,-60952,-60934,-60915,-60897,-60878,-60859,
-60841,-60822,-60803,-60785,-60766,-60747,-60728,-60709,
-60690,-60671,-60652,-60633,-60614,-60595,-60576,-60556,
-60537,-60518,-60499,-60479,-60460,-60441,-60421,-60402,
-60382,-60363,-60343,-60323,-60304,-60284,-60264,-60244,
-60225,-60205,-60185,-60165,-60145,-60125,-60105,-60085,
-60065,-60045,-60025,-60004,-59984,-59964,-59944,-59923,
-59903,-59883,-59862,-59842,-59821,-59801,-59780,-59759,
-59739,-59718,-59697,-59677,-59656,-59635,-59614,-59593,
-59572,-59551,-59530,-59509,-59488,-59467,-59446,-59425,
-59404,-59382,-59361,-59340,-59318,-59297,-59276,-59254,
-59233,-59211,-59189,-59168,-59146,-59125,-59103,-59081,
-59059,-59038,-59016,-58994,-58972,-58950,-58928,-58906,
-58884,-58862,-58840,-58818,-58795,-58773,-58751,-58729,
-58706,-58684,-58662,-58639,-58617,-58594,-58572,-58549,
-58527,-58504,-58481,-58459,-58436,-58413,-58390,-58367,
-58345,-58322,-58299,-58276,-58253,-58230,-58207,-58183,
-58160,-58137,-58114,-58091,-58067,-58044,-58021,-57997,
-57974,-57950,-57927,-57903,-57880,-57856,-57833,-57809,
-57785,-57762,-57738,-57714,-57690,-57666,-57642,-57618,
-57594,-57570,-57546,-57522,-57498,-57474,-57450,-57426,
-57402,-57377,-57353,-57329,-57304,-57280,-57255,-57231,
-57206,-57182,-57157,-57133,-57108,-57083,-57059,-57034,
-57009,-56984,-56959,-56935,-56910,-56885,-56860,-56835,
-56810,-56785,-56760,-56734,-56709,-56684,-56659,-56633,
-56608,-56583,-56557,-56532,-56507,-56481,-56456,-56430,
-56404,-56379,-56353,-56328,-56302,-56276,-56250,-56225,
-56199,-56173,-56147,-56121,-56095,-56069,-56043,-56017,
-55991,-55965,-55938,-55912,-55886,-55860,-55833,-55807,
-55781,-55754,-55728,-55701,-55675,-55648,-55622,-55595,
-55569,-55542,-55515,-55489,-55462,-55435,-55408,-55381,
-55354,-55327,-55300,-55274,-55246,-55219,-55192,-55165,
-55138,-55111,-55084,-55056,-55029,-55002,-54974,-54947,
-54920,-54892,-54865,-54837,-54810,-54782,-54755,-54727,
-54699,-54672,-54644,-54616,-54588,-54560,-54533,-54505,
-54477,-54449,-54421,-54393,-54365,-54337,-54308,-54280,
-54252,-54224,-54196,-54167,-54139,-54111,-54082,-54054,
-54026,-53997,-53969,-53940,-53911,-53883,-53854,-53826,
-53797,-53768,-53739,-53711,-53682,-53653,-53624,-53595,
-53566,-53537,-53508,-53479,-53450,-53421,-53392,-53363,
-53334,-53304,-53275,-53246,-53216,-53187,-53158,-53128,
-53099,-53069,-53040,-53010,-52981,-52951,-52922,-52892,
-52862,-52832,-52803,-52773,-52743,-52713,-52683,-52653,
-52624,-52594,-52564,-52534,-52503,-52473,-52443,-52413,
-52383,-52353,-52322,-52292,-52262,-52231,-52201,-52171,
-52140,-52110,-52079,-52049,-52018,-51988,-51957,-51926,
-51896,-51865,-51834,-51803,-51773,-51742,-51711,-51680,
-51649,-51618,-51587,-51556,-51525,-51494,-51463,-51432,
-51401,-51369,-51338,-51307,-51276,-51244,-51213,-51182,
-51150,-51119,-51087,-51056,-51024,-50993,-50961,-50929,
-50898,-50866,-50834,-50803,-50771,-50739,-50707,-50675,
-50644,-50612,-50580,-50548,-50516,-50484,-50452,-50420,
-50387,-50355,-50323,-50291,-50259,-50226,-50194,-50162,
-50129,-50097,-50065,-50032,-50000,-49967,-49935,-49902,
-49869,-49837,-49804,-49771,-49739,-49706,-49673,-49640,
-49608,-49575,-49542,-49509,-49476,-49443,-49410,-49377,
-49344,-49311,-49278,-49244,-49211,-49178,-49145,-49112,
-49078,-49045,-49012,-48978,-48945,-48911,-48878,-48844,
-48811,-48777,-48744,-48710,-48676,-48643,-48609,-48575,
-48542,-48508,-48474,-48440,-48406,-48372,-48338,-48305,
-48271,-48237,-48202,-48168,-48134,-48100,-48066,-48032,
-47998,-47963,-47929,-47895,-47860,-47826,-47792,-47757,
-47723,-47688,-47654,-47619,-47585,-47550,-47516,-47481,
-47446,-47412,-47377,-47342,-47307,-47273,-47238,-47203,
-47168,-47133,-47098,-47063,-47028,-46993,-46958,-46923,
-46888,-46853,-46818,-46783,-46747,-46712,-46677,-46642,
-46606,-46571,-46536,-46500,-46465,-46429,-46394,-46358,
-46323,-46287,-46251,-46216,-46180,-46145,-46109,-46073,
-46037,-46002,-45966,-45930,-45894,-45858,-45822,-45786,
-45750,-45714,-45678,-45642,-45606,-45570,-45534,-45498,
-45462,-45425,-45389,-45353,-45316,-45280,-45244,-45207,
-45171,-45135,-45098,-45062,-45025,-44989,-44952,-44915,
-44879,-44842,-44806,-44769,-44732,-44695,-44659,-44622,
-44585,-44548,-44511,-44474,-44437,-44400,-44363,-44326,
-44289,-44252,-44215,-44178,-44141,-44104,-44067,-44029,
-43992,-43955,-43918,-43880,-43843,-43806,-43768,-43731,
-43693,-43656,-43618,-43581,-43543,-43506,-43468,-43430,
-43393,-43355,-43317,-43280,-43242,-43204,-43166,-43128,
-43091,-43053,-43015,-42977,-42939,-42901,-42863,-42825,
-42787,-42749,-42711,-42672,-42634,-42596,-42558,-42520,
-42481,-42443,-42405,-42366,-42328,-42290,-42251,-42213,
-42174,-42136,-42097,-42059,-42020,-41982,-41943,-41904,
-41866,-41827,-41788,-41750,-41711,-41672,-41633,-41595,
-41556,-41517,-41478,-41439,-41400,-41361,-41322,-41283,
-41244,-41205,-41166,-41127,-41087,-41048,-41009,-40970,
-40931,-40891,-40852,-40813,-40773,-40734,-40695,-40655,
-40616,-40576,-40537,-40497,-40458,-40418,-40379,-40339,
-40299,-40260,-40220,-40180,-40141,-40101,-40061,-40021,
-39982,-39942,-39902,-39862,-39822,-39782,-39742,-39702,
-39662,-39622,-39582,-39542,-39502,-39462,-39422,-39382,
-39341,-39301,-39261,-39221,-39180,-39140,-39100,-39059,
-39019,-38979,-38938,-38898,-38857,-38817,-38776,-38736,
-38695,-38655,-38614,-38573,-38533,-38492,-38451,-38411,
-38370,-38329,-38288,-38248,-38207,-38166,-38125,-38084,
-38043,-38002,-37961,-37920,-37879,-37838,-37797,-37756,
-37715,-37674,-37633,-37592,-37550,-37509,-37468,-37427,
-37386,-37344,-37303,-37262,-37220,-37179,-37137,-37096,
-37055,-37013,-36972,-36930,-36889,-36847,-36805,-36764,
-36722,-36681,-36639,-36597,-36556,-36514,-36472,-36430,
-36388,-36347,-36305,-36263,-36221,-36179,-36137,-36095,
-36053,-36011,-35969,-35927,-35885,-35843,-35801,-35759,
-35717,-35675,-35633,-35590,-35548,-35506,-35464,-35421,
-35379,-35337,-35294,-35252,-35210,-35167,-35125,-35082,
-35040,-34997,-34955,-34912,-34870,-34827,-34785,-34742,
-34699,-34657,-34614,-34571,-34529,-34486,-34443,-34400,
-34358,-34315,-34272,-34229,-34186,-34143,-34100,-34057,
-34015,-33972,-33929,-33886,-33843,-33799,-33756,-33713,
-33670,-33627,-33584,-33541,-33498,-33454,-33411,-33368,
-33325,-33281,-33238,-33195,-33151,-33108,-33065,-33021,
-32978,-32934,-32891,-32847,-32804,-32760,-32717,-32673,
-32630,-32586,-32542,-32499,-32455,-32411,-32368,-32324,
-32280,-32236,-32193,-32149,-32105,-32061,-32017,-31974,
-31930,-31886,-31842,-31798,-31754,-31710,-31666,-31622,
-31578,-31534,-31490,-31446,-31402,-31357,-31313,-31269,
-31225,-31181,-31136,-31092,-31048,-31004,-30959,-30915,
-30871,-30826,-30782,-30738,-30693,-30649,-30604,-30560,
-30515,-30471,-30426,-30382,-30337,-30293,-30248,-30204,
-30159,-30114,-30070,-30025,-29980,-29936,-29891,-29846,
-29801,-29757,-29712,-29667,-29622,-29577,-29533,-29488,
-29443,-29398,-29353,-29308,-29263,-29218,-29173,-29128,
-29083,-29038,-28993,-28948,-28903,-28858,-28812,-28767,
-28722,-28677,-28632,-28586,-28541,-28496,-28451,-28405,
-28360,-28315,-28269,-28224,-28179,-28133,-28088,-28042,
-27997,-27952,-27906,-27861,-27815,-27770,-27724,-27678,
-27633,-27587,-27542,-27496,-27450,-27405,-27359,-27313,
-27268,-27222,-27176,-27131,-27085,-27039,-26993,-26947,
-26902,-26856,-26810,-26764,-26718,-26672,-26626,-26580,
-26534,-26488,-26442,-26396,-26350,-26304,-26258,-26212,
-26166,-26120,-26074,-26028,-25982,-25936,-25889,-25843,
-25797,-25751,-25705,-25658,-25612,-25566,-25520,-25473,
-25427,-25381,-25334,-25288,-25241,-25195,-25149,-25102,
-25056,-25009,-24963,-24916,-24870,-24823,-24777,-24730,
-24684,-24637,-24591,-24544,-24497,-24451,-24404,-24357,
-24311,-24264,-24217,-24171,-24124,-24077,-24030,-23984,
-23937,-23890,-23843,-23796,-23750,-23703,-23656,-23609,
-23562,-23515,-23468,-23421,-23374,-23327,-23280,-23233,
-23186,-23139,-23092,-23045,-22998,-22951,-22904,-22857,
-22810,-22763,-22716,-22668,-22621,-22574,-22527,-22480,
-22432,-22385,-22338,-22291,-22243,-22196,-22149,-22102,
-22054,-22007,-21960,-21912,-21865,-21817,-21770,-21723,
-21675,-21628,-21580,-21533,-21485,-21438,-21390,-21343,
-21295,-21248,-21200,-21153,-21105,-21057,-21010,-20962,
-20915,-20867,-20819,-20772,-20724,-20676,-20629,-20581,
-20533,-20485,-20438,-20390,-20342,-20294,-20246,-20199,
-20151,-20103,-20055,-20007,-19959,-19912,-19864,-19816,
-19768,-19720,-19672,-19624,-19576,-19528,-19480,-19432,
-19384,-19336,-19288,-19240,-19192,-19144,-19096,-19048,
-19000,-18951,-18903,-18855,-18807,-18759,-18711,-18663,
-18614,-18566,-18518,-18470,-18421,-18373,-18325,-18277,
-18228,-18180,-18132,-18084,-18035,-17987,-17939,-17890,
-17842,-17793,-17745,-17697,-17648,-17600,-17551,-17503,
-17455,-17406,-17358,-17309,-17261,-17212,-17164,-17115,
-17067,-17018,-16970,-16921,-16872,-16824,-16775,-16727,
-16678,-16629,-16581,-16532,-16484,-16435,-16386,-16338,
-16289,-16240,-16191,-16143,-16094,-16045,-15997,-15948,
-15899,-15850,-15802,-15753,-15704,-15655,-15606,-15557,
-15509,-15460,-15411,-15362,-15313,-15264,-15215,-15167,
-15118,-15069,-15020,-14971,-14922,-14873,-14824,-14775,
-14726,-14677,-14628,-14579,-14530,-14481,-14432,-14383,
-14334,-14285,-14236,-14187,-14138,-14089,-14040,-13990,
-13941,-13892,-13843,-13794,-13745,-13696,-13647,-13597,
-13548,-13499,-13450,-13401,-13351,-13302,-13253,-13204,
-13154,-13105,-13056,-13007,-12957,-12908,-12859,-12810,
-12760,-12711,-12662,-12612,-12563,-12514,-12464,-12415,
-12366,-12316,-12267,-12217,-12168,-12119,-12069,-12020,
-11970,-11921,-11872,-11822,-11773,-11723,-11674,-11624,
-11575,-11525,-11476,-11426,-11377,-11327,-11278,-11228,
-11179,-11129,-11080,-11030,-10981,-10931,-10882,-10832,
-10782,-10733,-10683,-10634,-10584,-10534,-10485,-10435,
-10386,-10336,-10286,-10237,-10187,-10137,-10088,-10038,
-9988,-9939,-9889,-9839,-9790,-9740,-9690,-9640,
-9591,-9541,-9491,-9442,-9392,-9342,-9292,-9243,
-9193,-9143,-9093,-9043,-8994,-8944,-8894,-8844,
-8794,-8745,-8695,-8645,-8595,-8545,-8496,-8446,
-8396,-8346,-8296,-8246,-8196,-8147,-8097,-8047,
-7997,-7947,-7897,-7847,-7797,-7747,-7697,-7648,
-7598,-7548,-7498,-7448,-7398,-7348,-7298,-7248,
-7198,-7148,-7098,-7048,-6998,-6948,-6898,-6848,
-6798,-6748,-6698,-6648,-6598,-6548,-6498,-6448,
-6398,-6348,-6298,-6248,-6198,-6148,-6098,-6048,
-5998,-5948,-5898,-5848,-5798,-5747,-5697,-5647,
-5597,-5547,-5497,-5447,-5397,-5347,-5297,-5247,
-5197,-5146,-5096,-5046,-4996,-4946,-4896,-4846,
-4796,-4745,-4695,-4645,-4595,-4545,-4495,-4445,
-4394,-4344,-4294,-4244,-4194,-4144,-4093,-4043,
-3993,-3943,-3893,-3843,-3792,-3742,-3692,-3642,
-3592,-3541,-3491,-3441,-3391,-3341,-3291,-3240,
-3190,-3140,-3090,-3039,-2989,-2939,-2889,-2839,
-2788,-2738,-2688,-2638,-2588,-2537,-2487,-2437,
-2387,-2336,-2286,-2236,-2186,-2135,-2085,-2035,
-1985,-1934,-1884,-1834,-1784,-1733,-1683,-1633,
-1583,-1532,-1482,-1432,-1382,-1331,-1281,-1231,
-1181,-1130,-1080,-1030,-980,-929,-879,-829,
-779,-728,-678,-628,-578,-527,-477,-427,
-376,-326,-276,-226,-175,-125,-75,-25,
25,75,125,175,226,276,326,376,
427,477,527,578,628,678,728,779,
829,879,929,980,1030,1080,1130,1181,
1231,1281,1331,1382,1432,1482,1532,1583,
1633,1683,1733,1784,1834,1884,1934,1985,
2035,2085,2135,2186,2236,2286,2336,2387,
2437,2487,2537,2587,2638,2688,2738,2788,
2839,2889,2939,2989,3039,3090,3140,3190,
3240,3291,3341,3391,3441,3491,3542,3592,
3642,3692,3742,3792,3843,3893,3943,3993,
4043,4093,4144,4194,4244,4294,4344,4394,
4445,4495,4545,4595,4645,4695,4745,4796,
4846,4896,4946,4996,5046,5096,5146,5197,
5247,5297,5347,5397,5447,5497,5547,5597,
5647,5697,5747,5798,5848,5898,5948,5998,
6048,6098,6148,6198,6248,6298,6348,6398,
6448,6498,6548,6598,6648,6698,6748,6798,
6848,6898,6948,6998,7048,7098,7148,7198,
7248,7298,7348,7398,7448,7498,7548,7598,
7648,7697,7747,7797,7847,7897,7947,7997,
8047,8097,8147,8196,8246,8296,8346,8396,
8446,8496,8545,8595,8645,8695,8745,8794,
8844,8894,8944,8994,9043,9093,9143,9193,
9243,9292,9342,9392,9442,9491,9541,9591,
9640,9690,9740,9790,9839,9889,9939,9988,
10038,10088,10137,10187,10237,10286,10336,10386,
10435,10485,10534,10584,10634,10683,10733,10782,
10832,10882,10931,10981,11030,11080,11129,11179,
11228,11278,11327,11377,11426,11476,11525,11575,
11624,11674,11723,11773,11822,11872,11921,11970,
12020,12069,12119,12168,12218,12267,12316,12366,
12415,12464,12514,12563,12612,12662,12711,12760,
12810,12859,12908,12957,13007,13056,13105,13154,
13204,13253,13302,13351,13401,13450,13499,13548,
13597,13647,13696,13745,13794,13843,13892,13941,
13990,14040,14089,14138,14187,14236,14285,14334,
14383,14432,14481,14530,14579,14628,14677,14726,
14775,14824,14873,14922,14971,15020,15069,15118,
15167,15215,15264,15313,15362,15411,15460,15509,
15557,15606,15655,15704,15753,15802,15850,15899,
15948,15997,16045,16094,16143,16191,16240,16289,
16338,16386,16435,16484,16532,16581,16629,16678,
16727,16775,16824,16872,16921,16970,17018,17067,
17115,17164,17212,17261,17309,17358,17406,17455,
17503,17551,17600,17648,17697,17745,17793,17842,
17890,17939,17987,18035,18084,18132,18180,18228,
18277,18325,18373,18421,18470,18518,18566,18614,
18663,18711,18759,18807,18855,18903,18951,19000,
19048,19096,19144,19192,19240,19288,19336,19384,
19432,19480,19528,19576,19624,19672,19720,19768,
19816,19864,19912,19959,20007,20055,20103,20151,
20199,20246,20294,20342,20390,20438,20485,20533,
20581,20629,20676,20724,20772,20819,20867,20915,
20962,21010,21057,21105,21153,21200,21248,21295,
21343,21390,21438,21485,21533,21580,21628,21675,
21723,21770,21817,21865,21912,21960,22007,22054,
22102,22149,22196,22243,22291,22338,22385,22432,
22480,22527,22574,22621,22668,22716,22763,22810,
22857,22904,22951,22998,23045,23092,23139,23186,
23233,23280,23327,23374,23421,23468,23515,23562,
23609,23656,23703,23750,23796,23843,23890,23937,
23984,24030,24077,24124,24171,24217,24264,24311,
24357,24404,24451,24497,24544,24591,24637,24684,
24730,24777,24823,24870,24916,24963,25009,25056,
25102,25149,25195,25241,25288,25334,25381,25427,
25473,25520,25566,25612,25658,25705,25751,25797,
25843,25889,25936,25982,26028,26074,26120,26166,
26212,26258,26304,26350,26396,26442,26488,26534,
26580,26626,26672,26718,26764,26810,26856,26902,
26947,26993,27039,27085,27131,27176,27222,27268,
27313,27359,27405,27450,27496,27542,27587,27633,
27678,27724,27770,27815,27861,27906,27952,27997,
28042,28088,28133,28179,28224,28269,28315,28360,
28405,28451,28496,28541,28586,28632,28677,28722,
28767,28812,28858,28903,28948,28993,29038,29083,
29128,29173,29218,29263,29308,29353,29398,29443,
29488,29533,29577,29622,29667,29712,29757,29801,
29846,29891,29936,29980,30025,30070,30114,30159,
30204,30248,30293,30337,30382,30427,30471,30516,
30560,30604,30649,30693,30738,30782,30826,30871,
30915,30959,31004,31048,31092,31136,31181,31225,
31269,31313,31357,31402,31446,31490,31534,31578,
31622,31666,31710,31754,31798,31842,31886,31930,
31974,32017,32061,32105,32149,32193,32236,32280,
32324,32368,32411,32455,32499,32542,32586,32630,
32673,32717,32760,32804,32847,32891,32934,32978,
33021,33065,33108,33151,33195,33238,33281,33325,
33368,33411,33454,33498,33541,33584,33627,33670,
33713,33756,33799,33843,33886,33929,33972,34015,
34057,34100,34143,34186,34229,34272,34315,34358,
34400,34443,34486,34529,34571,34614,34657,34699,
34742,34785,34827,34870,34912,34955,34997,35040,
35082,35125,35167,35210,35252,35294,35337,35379,
35421,35464,35506,35548,35590,35633,35675,35717,
35759,35801,35843,35885,35927,35969,36011,36053,
36095,36137,36179,36221,36263,36305,36347,36388,
36430,36472,36514,36556,36597,36639,36681,36722,
36764,36805,36847,36889,36930,36972,37013,37055,
37096,37137,37179,37220,37262,37303,37344,37386,
37427,37468,37509,37551,37592,37633,37674,37715,
37756,37797,37838,37879,37920,37961,38002,38043,
38084,38125,38166,38207,38248,38288,38329,38370,
38411,38451,38492,38533,38573,38614,38655,38695,
38736,38776,38817,38857,38898,38938,38979,39019,
39059,39100,39140,39180,39221,39261,39301,39341,
39382,39422,39462,39502,39542,39582,39622,39662,
39702,39742,39782,39822,39862,39902,39942,39982,
40021,40061,40101,40141,40180,40220,40260,40299,
40339,40379,40418,40458,40497,40537,40576,40616,
40655,40695,40734,40773,40813,40852,40891,40931,
40970,41009,41048,41087,41127,41166,41205,41244,
41283,41322,41361,41400,41439,41478,41517,41556,
41595,41633,41672,41711,41750,41788,41827,41866,
41904,41943,41982,42020,42059,42097,42136,42174,
42213,42251,42290,42328,42366,42405,42443,42481,
42520,42558,42596,42634,42672,42711,42749,42787,
42825,42863,42901,42939,42977,43015,43053,43091,
43128,43166,43204,43242,43280,43317,43355,43393,
43430,43468,43506,43543,43581,43618,43656,43693,
43731,43768,43806,43843,43880,43918,43955,43992,
44029,44067,44104,44141,44178,44215,44252,44289,
44326,44363,44400,44437,44474,44511,44548,44585,
44622,44659,44695,44732,44769,44806,44842,44879,
44915,44952,44989,45025,45062,45098,45135,45171,
45207,45244,45280,45316,45353,45389,45425,45462,
45498,45534,45570,45606,45642,45678,45714,45750,
45786,45822,45858,45894,45930,45966,46002,46037,
46073,46109,46145,46180,46216,46252,46287,46323,
46358,46394,46429,46465,46500,46536,46571,46606,
46642,46677,46712,46747,46783,46818,46853,46888,
46923,46958,46993,47028,47063,47098,47133,47168,
47203,47238,47273,47308,47342,47377,47412,47446,
47481,47516,47550,47585,47619,47654,47688,47723,
47757,47792,47826,47861,47895,47929,47963,47998,
48032,48066,48100,48134,48168,48202,48237,48271,
48305,48338,48372,48406,48440,48474,48508,48542,
48575,48609,48643,48676,48710,48744,48777,48811,
48844,48878,48911,48945,48978,49012,49045,49078,
49112,49145,49178,49211,49244,49278,49311,49344,
49377,49410,49443,49476,49509,49542,49575,49608,
49640,49673,49706,49739,49771,49804,49837,49869,
49902,49935,49967,50000,50032,50064,50097,50129,
50162,50194,50226,50259,50291,50323,50355,50387,
50420,50452,50484,50516,50548,50580,50612,50644,
50675,50707,50739,50771,50803,50834,50866,50898,
50929,50961,50993,51024,51056,51087,51119,51150,
51182,51213,51244,51276,51307,51338,51369,51401,
51432,51463,51494,51525,51556,51587,51618,51649,
51680,51711,51742,51773,51803,51834,51865,51896,
51926,51957,51988,52018,52049,52079,52110,52140,
52171,52201,52231,52262,52292,52322,52353,52383,
52413,52443,52473,52503,52534,52564,52594,52624,
52653,52683,52713,52743,52773,52803,52832,52862,
52892,52922,52951,52981,53010,53040,53069,53099,
53128,53158,53187,53216,53246,53275,53304,53334,
53363,53392,53421,53450,53479,53508,53537,53566,
53595,53624,53653,53682,53711,53739,53768,53797,
53826,53854,53883,53912,53940,53969,53997,54026,
54054,54082,54111,54139,54167,54196,54224,54252,
54280,54309,54337,54365,54393,54421,54449,54477,
54505,54533,54560,54588,54616,54644,54672,54699,
54727,54755,54782,54810,54837,54865,54892,54920,
54947,54974,55002,55029,55056,55084,55111,55138,
55165,55192,55219,55246,55274,55300,55327,55354,
55381,55408,55435,55462,55489,55515,55542,55569,
55595,55622,55648,55675,55701,55728,55754,55781,
55807,55833,55860,55886,55912,55938,55965,55991,
56017,56043,56069,56095,56121,56147,56173,56199,
56225,56250,56276,56302,56328,56353,56379,56404,
56430,56456,56481,56507,56532,56557,56583,56608,
56633,56659,56684,56709,56734,56760,56785,56810,
56835,56860,56885,56910,56935,56959,56984,57009,
57034,57059,57083,57108,57133,57157,57182,57206,
57231,57255,57280,57304,57329,57353,57377,57402,
57426,57450,57474,57498,57522,57546,57570,57594,
57618,57642,57666,57690,57714,57738,57762,57785,
57809,57833,57856,57880,57903,57927,57950,57974,
57997,58021,58044,58067,58091,58114,58137,58160,
58183,58207,58230,58253,58276,58299,58322,58345,
58367,58390,58413,58436,58459,58481,58504,58527,
58549,58572,58594,58617,58639,58662,58684,58706,
58729,58751,58773,58795,58818,58840,58862,58884,
58906,58928,58950,58972,58994,59016,59038,59059,
59081,59103,59125,59146,59168,59190,59211,59233,
59254,59276,59297,59318,59340,59361,59382,59404,
59425,59446,59467,59488,59509,59530,59551,59572,
59593,59614,59635,59656,59677,59697,59718,59739,
59759,59780,59801,59821,59842,59862,59883,59903,
59923,59944,59964,59984,60004,60025,60045,60065,
60085,60105,60125,60145,60165,60185,60205,60225,
60244,60264,60284,60304,60323,60343,60363,60382,
60402,60421,60441,60460,60479,60499,60518,60537,
60556,60576,60595,60614,60633,60652,60671,60690,
60709,60728,60747,60766,60785,60803,60822,60841,
60859,60878,60897,60915,60934,60952,60971,60989,
61007,61026,61044,61062,61081,61099,61117,61135,
61153,61171,61189,61207,61225,61243,61261,61279,
61297,61314,61332,61350,61367,61385,61403,61420,
61438,61455,61473,61490,61507,61525,61542,61559,
61577,61594,61611,61628,61645,61662,61679,61696,
61713,61730,61747,61764,61780,61797,61814,61831,
61847,61864,61880,61897,61913,61930,61946,61963,
61979,61995,62012,62028,62044,62060,62076,62092,
62108,62125,62141,62156,62172,62188,62204,62220,
62236,62251,62267,62283,62298,62314,62329,62345,
62360,62376,62391,62407,62422,62437,62453,62468,
62483,62498,62513,62528,62543,62558,62573,62588,
62603,62618,62633,62648,62662,62677,62692,62706,
62721,62735,62750,62764,62779,62793,62808,62822,
62836,62850,62865,62879,62893,62907,62921,62935,
62949,62963,62977,62991,63005,63019,63032,63046,
63060,63074,63087,63101,63114,63128,63141,63155,
63168,63182,63195,63208,63221,63235,63248,63261,
63274,63287,63300,63313,63326,63339,63352,63365,
63378,63390,63403,63416,63429,63441,63454,63466,
63479,63491,63504,63516,63528,63541,63553,63565,
63578,63590,63602,63614,63626,63638,63650,63662,
63674,63686,63698,63709,63721,63733,63745,63756,
63768,63779,63791,63803,63814,63825,63837,63848,
63859,63871,63882,63893,63904,63915,63927,63938,
63949,63960,63971,63981,63992,64003,64014,64025,
64035,64046,64057,64067,64078,64088,64099,64109,
64120,64130,64140,64151,64161,64171,64181,64192,
64202,64212,64222,64232,64242,64252,64261,64271,
64281,64291,64301,64310,64320,64330,64339,64349,
64358,64368,64377,64387,64396,64405,64414,64424,
64433,64442,64451,64460,64469,64478,64487,64496,
64505,64514,64523,64532,64540,64549,64558,64566,
64575,64584,64592,64600,64609,64617,64626,64634,
64642,64651,64659,64667,64675,64683,64691,64699,
64707,64715,64723,64731,64739,64747,64754,64762,
64770,64777,64785,64793,64800,64808,64815,64822,
64830,64837,64844,64852,64859,64866,64873,64880,
64887,64895,64902,64908,64915,64922,64929,64936,
64943,64949,64956,64963,64969,64976,64982,64989,
64995,65002,65008,65015,65021,65027,65033,65040,
65046,65052,65058,65064,65070,65076,65082,65088,
65094,65099,65105,65111,65117,65122,65128,65133,
65139,65144,65150,65155,65161,65166,65171,65177,
65182,65187,65192,65197,65202,65207,65212,65217,
65222,65227,65232,65237,65242,65246,65251,65256,
65260,65265,65270,65274,65279,65283,65287,65292,
65296,65300,65305,65309,65313,65317,65321,65325,
65329,65333,65337,65341,65345,65349,65352,65356,
65360,65363,65367,65371,65374,65378,65381,65385,
65388,65391,65395,65398,65401,65404,65408,65411,
65414,65417,65420,65423,65426,65429,65431,65434,
65437,65440,65442,65445,65448,65450,65453,65455,
65458,65460,65463,65465,65467,65470,65472,65474,
65476,65478,65480,65482,65484,65486,65488,65490,
65492,65494,65496,65497,65499,65501,65502,65504,
65505,65507,65508,65510,65511,65513,65514,65515,
65516,65518,65519,65520,65521,65522,65523,65524,
65525,65526,65527,65527,65528,65529,65530,65530,
65531,65531,65532,65532,65533,65533,65534,65534,
65534,65535,65535,65535,65535,65535,65535,65535
};
const fixed_t *finecosine = &finesine[FINEANGLES/4];
const angle_t tantoangle[2049] =
{
0,333772,667544,1001315,1335086,1668857,2002626,2336395,
2670163,3003929,3337694,3671457,4005219,4338979,4672736,5006492,
5340245,5673995,6007743,6341488,6675230,7008968,7342704,7676435,
8010164,8343888,8677609,9011325,9345037,9678744,10012447,10346145,
10679838,11013526,11347209,11680887,12014558,12348225,12681885,13015539,
13349187,13682829,14016464,14350092,14683714,15017328,15350936,15684536,
16018129,16351714,16685291,17018860,17352422,17685974,18019518,18353054,
18686582,19020100,19353610,19687110,20020600,20354080,20687552,21021014,
21354466,21687906,22021338,22354758,22688168,23021568,23354956,23688332,
24021698,24355052,24688396,25021726,25355046,25688352,26021648,26354930,
26688200,27021456,27354702,27687932,28021150,28354356,28687548,29020724,
29353888,29687038,30020174,30353296,30686404,31019496,31352574,31685636,
32018684,32351718,32684734,33017736,33350722,33683692,34016648,34349584,
34682508,35015412,35348300,35681172,36014028,36346868,36679688,37012492,
37345276,37678044,38010792,38343524,38676240,39008936,39341612,39674272,
40006912,40339532,40672132,41004716,41337276,41669820,42002344,42334848,
42667332,42999796,43332236,43664660,43997060,44329444,44661800,44994140,
45326456,45658752,45991028,46323280,46655512,46987720,47319908,47652072,
47984212,48316332,48648428,48980500,49312548,49644576,49976580,50308556,
50640512,50972444,51304352,51636236,51968096,52299928,52631740,52963524,
53295284,53627020,53958728,54290412,54622068,54953704,55285308,55616888,
55948444,56279972,56611472,56942948,57274396,57605816,57937212,58268576,
58599916,58931228,59262512,59593768,59924992,60256192,60587364,60918508,
61249620,61580704,61911760,62242788,62573788,62904756,63235692,63566604,
63897480,64228332,64559148,64889940,65220696,65551424,65882120,66212788,
66543420,66874024,67204600,67535136,67865648,68196120,68526568,68856984,
69187360,69517712,69848024,70178304,70508560,70838776,71168960,71499112,
71829224,72159312,72489360,72819376,73149360,73479304,73809216,74139096,
74468936,74798744,75128520,75458264,75787968,76117632,76447264,76776864,
77106424,77435952,77765440,78094888,78424304,78753688,79083032,79412336,
79741608,80070840,80400032,80729192,81058312,81387392,81716432,82045440,
82374408,82703336,83032224,83361080,83689896,84018664,84347400,84676096,
85004760,85333376,85661952,85990488,86318984,86647448,86975864,87304240,
87632576,87960872,88289128,88617344,88945520,89273648,89601736,89929792,
90257792,90585760,90913688,91241568,91569408,91897200,92224960,92552672,
92880336,93207968,93535552,93863088,94190584,94518040,94845448,95172816,
95500136,95827416,96154648,96481832,96808976,97136080,97463136,97790144,
98117112,98444032,98770904,99097736,99424520,99751256,100077944,100404592,
100731192,101057744,101384248,101710712,102037128,102363488,102689808,103016080,
103342312,103668488,103994616,104320696,104646736,104972720,105298656,105624552,
105950392,106276184,106601928,106927624,107253272,107578872,107904416,108229920,
108555368,108880768,109206120,109531416,109856664,110181872,110507016,110832120,
111157168,111482168,111807112,112132008,112456856,112781648,113106392,113431080,
113755720,114080312,114404848,114729328,115053760,115378136,115702464,116026744,
116350960,116675128,116999248,117323312,117647320,117971272,118295176,118619024,
118942816,119266560,119590248,119913880,120237456,120560984,120884456,121207864,
121531224,121854528,122177784,122500976,122824112,123147200,123470224,123793200,
124116120,124438976,124761784,125084528,125407224,125729856,126052432,126374960,
126697424,127019832,127342184,127664472,127986712,128308888,128631008,128953072,
129275080,129597024,129918912,130240744,130562520,130884232,131205888,131527480,
131849016,132170496,132491912,132813272,133134576,133455816,133776992,134098120,
134419184,134740176,135061120,135382000,135702816,136023584,136344272,136664912,
136985488,137306016,137626464,137946864,138267184,138587456,138907664,139227808,
139547904,139867920,140187888,140507776,140827616,141147392,141467104,141786752,
142106336,142425856,142745312,143064720,143384048,143703312,144022512,144341664,
144660736,144979744,145298704,145617584,145936400,146255168,146573856,146892480,
147211040,147529536,147847968,148166336,148484640,148802880,149121056,149439152,
149757200,150075168,150393072,150710912,151028688,151346400,151664048,151981616,
152299136,152616576,152933952,153251264,153568496,153885680,154202784,154519824,
154836784,155153696,155470528,155787296,156104000,156420624,156737200,157053696,
157370112,157686480,158002768,158318976,158635136,158951216,159267232,159583168,
159899040,160214848,160530592,160846256,161161840,161477376,161792832,162108208,
162423520,162738768,163053952,163369040,163684080,163999040,164313936,164628752,
164943504,165258176,165572784,165887312,166201776,166516160,166830480,167144736,
167458912,167773008,168087040,168400992,168714880,169028688,169342432,169656096,
169969696,170283216,170596672,170910032,171223344,171536576,171849728,172162800,
172475808,172788736,173101600,173414384,173727104,174039728,174352288,174664784,
174977200,175289536,175601792,175913984,176226096,176538144,176850096,177161984,
177473792,177785536,178097200,178408784,178720288,179031728,179343088,179654368,
179965568,180276704,180587744,180898720,181209616,181520448,181831184,182141856,
182452448,182762960,183073408,183383760,183694048,184004240,184314368,184624416,
184934400,185244288,185554096,185863840,186173504,186483072,186792576,187102000,
187411344,187720608,188029808,188338912,188647936,188956896,189265760,189574560,
189883264,190191904,190500448,190808928,191117312,191425632,191733872,192042016,
192350096,192658096,192966000,193273840,193581584,193889264,194196848,194504352,
194811792,195119136,195426400,195733584,196040688,196347712,196654656,196961520,
197268304,197574992,197881616,198188144,198494592,198800960,199107248,199413456,
199719584,200025616,200331584,200637456,200943248,201248960,201554576,201860128,
202165584,202470960,202776256,203081456,203386592,203691632,203996592,204301472,
204606256,204910976,205215600,205520144,205824592,206128960,206433248,206737456,
207041584,207345616,207649568,207953424,208257216,208560912,208864512,209168048,
209471488,209774832,210078112,210381296,210684384,210987408,211290336,211593184,
211895936,212198608,212501184,212803680,213106096,213408432,213710672,214012816,
214314880,214616864,214918768,215220576,215522288,215823920,216125472,216426928,
216728304,217029584,217330784,217631904,217932928,218233856,218534704,218835472,
219136144,219436720,219737216,220037632,220337952,220638192,220938336,221238384,
221538352,221838240,222138032,222437728,222737344,223036880,223336304,223635664,
223934912,224234096,224533168,224832160,225131072,225429872,225728608,226027232,
226325776,226624240,226922608,227220880,227519056,227817152,228115168,228413088,
228710912,229008640,229306288,229603840,229901312,230198688,230495968,230793152,
231090256,231387280,231684192,231981024,232277760,232574416,232870960,233167440,
233463808,233760096,234056288,234352384,234648384,234944304,235240128,235535872,
235831504,236127056,236422512,236717888,237013152,237308336,237603424,237898416,
238193328,238488144,238782864,239077488,239372016,239666464,239960816,240255072,
240549232,240843312,241137280,241431168,241724960,242018656,242312256,242605776,
242899200,243192512,243485744,243778896,244071936,244364880,244657744,244950496,
245243168,245535744,245828224,246120608,246412912,246705104,246997216,247289216,
247581136,247872960,248164688,248456320,248747856,249039296,249330640,249621904,
249913056,250204128,250495088,250785968,251076736,251367424,251658016,251948512,
252238912,252529200,252819408,253109520,253399536,253689456,253979280,254269008,
254558640,254848176,255137632,255426976,255716224,256005376,256294432,256583392,
256872256,257161024,257449696,257738272,258026752,258315136,258603424,258891600,
259179696,259467696,259755600,260043392,260331104,260618704,260906224,261193632,
261480960,261768176,262055296,262342320,262629248,262916080,263202816,263489456,
263776000,264062432,264348784,264635024,264921168,265207216,265493168,265779024,
266064784,266350448,266636000,266921472,267206832,267492096,267777264,268062336,
268347312,268632192,268916960,269201632,269486208,269770688,270055072,270339360,
270623552,270907616,271191616,271475488,271759296,272042976,272326560,272610048,
272893440,273176736,273459936,273743040,274026048,274308928,274591744,274874432,
275157024,275439520,275721920,276004224,276286432,276568512,276850528,277132416,
277414240,277695936,277977536,278259040,278540448,278821728,279102944,279384032,
279665056,279945952,280226752,280507456,280788064,281068544,281348960,281629248,
281909472,282189568,282469568,282749440,283029248,283308960,283588544,283868032,
284147424,284426720,284705920,284985024,285264000,285542912,285821696,286100384,
286378976,286657440,286935840,287214112,287492320,287770400,288048384,288326240,
288604032,288881696,289159264,289436768,289714112,289991392,290268576,290545632,
290822592,291099456,291376224,291652896,291929440,292205888,292482272,292758528,
293034656,293310720,293586656,293862496,294138240,294413888,294689440,294964864,
295240192,295515424,295790560,296065600,296340512,296615360,296890080,297164704,
297439200,297713632,297987936,298262144,298536256,298810240,299084160,299357952,
299631648,299905248,300178720,300452128,300725408,300998592,301271680,301544640,
301817536,302090304,302362976,302635520,302908000,303180352,303452608,303724768,
303996800,304268768,304540608,304812320,305083968,305355520,305626944,305898272,
306169472,306440608,306711616,306982528,307253344,307524064,307794656,308065152,
308335552,308605856,308876032,309146112,309416096,309685984,309955744,310225408,
310494976,310764448,311033824,311303072,311572224,311841280,312110208,312379040,
312647776,312916416,313184960,313453376,313721696,313989920,314258016,314526016,
314793920,315061728,315329408,315597024,315864512,316131872,316399168,316666336,
316933408,317200384,317467232,317733984,318000640,318267200,318533632,318799968,
319066208,319332352,319598368,319864288,320130112,320395808,320661408,320926912,
321192320,321457632,321722816,321987904,322252864,322517760,322782528,323047200,
323311744,323576192,323840544,324104800,324368928,324632992,324896928,325160736,
325424448,325688096,325951584,326215008,326478304,326741504,327004608,327267584,
327530464,327793248,328055904,328318496,328580960,328843296,329105568,329367712,
329629760,329891680,330153536,330415264,330676864,330938400,331199808,331461120,
331722304,331983392,332244384,332505280,332766048,333026752,333287296,333547776,
333808128,334068384,334328544,334588576,334848512,335108352,335368064,335627712,
335887200,336146624,336405920,336665120,336924224,337183200,337442112,337700864,
337959552,338218112,338476576,338734944,338993184,339251328,339509376,339767296,
340025120,340282848,340540480,340797984,341055392,341312704,341569888,341826976,
342083968,342340832,342597600,342854272,343110848,343367296,343623648,343879904,
344136032,344392064,344648000,344903808,345159520,345415136,345670656,345926048,
346181344,346436512,346691616,346946592,347201440,347456224,347710880,347965440,
348219872,348474208,348728448,348982592,349236608,349490528,349744320,349998048,
350251648,350505152,350758528,351011808,351264992,351518048,351771040,352023872,
352276640,352529280,352781824,353034272,353286592,353538816,353790944,354042944,
354294880,354546656,354798368,355049952,355301440,355552800,355804096,356055264,
356306304,356557280,356808128,357058848,357309504,357560032,357810464,358060768,
358311008,358561088,358811104,359060992,359310784,359560480,359810048,360059520,
360308896,360558144,360807296,361056352,361305312,361554144,361802880,362051488,
362300032,362548448,362796736,363044960,363293056,363541024,363788928,364036704,
364284384,364531936,364779392,365026752,365274016,365521152,365768192,366015136,
366261952,366508672,366755296,367001792,367248192,367494496,367740704,367986784,
368232768,368478656,368724416,368970080,369215648,369461088,369706432,369951680,
370196800,370441824,370686752,370931584,371176288,371420896,371665408,371909792,
372154080,372398272,372642336,372886304,373130176,373373952,373617600,373861152,
374104608,374347936,374591168,374834304,375077312,375320224,375563040,375805760,
376048352,376290848,376533248,376775520,377017696,377259776,377501728,377743584,
377985344,378227008,378468544,378709984,378951328,379192544,379433664,379674688,
379915584,380156416,380397088,380637696,380878176,381118560,381358848,381599040,
381839104,382079072,382318912,382558656,382798304,383037856,383277280,383516640,
383755840,383994976,384233984,384472896,384711712,384950400,385188992,385427488,
385665888,385904160,386142336,386380384,386618368,386856224,387093984,387331616,
387569152,387806592,388043936,388281152,388518272,388755296,388992224,389229024,
389465728,389702336,389938816,390175200,390411488,390647680,390883744,391119712,
391355584,391591328,391826976,392062528,392297984,392533312,392768544,393003680,
393238720,393473632,393708448,393943168,394177760,394412256,394646656,394880960,
395115136,395349216,395583200,395817088,396050848,396284512,396518080,396751520,
396984864,397218112,397451264,397684288,397917248,398150080,398382784,398615424,
398847936,399080320,399312640,399544832,399776928,400008928,400240832,400472608,
400704288,400935872,401167328,401398720,401629984,401861120,402092192,402323136,
402553984,402784736,403015360,403245888,403476320,403706656,403936896,404167008,
404397024,404626944,404856736,405086432,405316032,405545536,405774912,406004224,
406233408,406462464,406691456,406920320,407149088,407377760,407606336,407834784,
408063136,408291392,408519520,408747584,408975520,409203360,409431072,409658720,
409886240,410113664,410340992,410568192,410795296,411022304,411249216,411476032,
411702720,411929312,412155808,412382176,412608480,412834656,413060736,413286720,
413512576,413738336,413964000,414189568,414415040,414640384,414865632,415090784,
415315840,415540800,415765632,415990368,416215008,416439552,416663968,416888288,
417112512,417336640,417560672,417784576,418008384,418232096,418455712,418679200,
418902624,419125920,419349120,419572192,419795200,420018080,420240864,420463552,
420686144,420908608,421130976,421353280,421575424,421797504,422019488,422241344,
422463104,422684768,422906336,423127776,423349120,423570400,423791520,424012576,
424233536,424454368,424675104,424895744,425116288,425336736,425557056,425777280,
425997408,426217440,426437376,426657184,426876928,427096544,427316064,427535488,
427754784,427974016,428193120,428412128,428631040,428849856,429068544,429287168,
429505664,429724064,429942368,430160576,430378656,430596672,430814560,431032352,
431250048,431467616,431685120,431902496,432119808,432336992,432554080,432771040,
432987936,433204736,433421408,433637984,433854464,434070848,434287104,434503296,
434719360,434935360,435151232,435367008,435582656,435798240,436013696,436229088,
436444352,436659520,436874592,437089568,437304416,437519200,437733856,437948416,
438162880,438377248,438591520,438805696,439019744,439233728,439447584,439661344,
439875008,440088576,440302048,440515392,440728672,440941824,441154880,441367872,
441580736,441793472,442006144,442218720,442431168,442643552,442855808,443067968,
443280032,443492000,443703872,443915648,444127296,444338880,444550336,444761696,
444972992,445184160,445395232,445606176,445817056,446027840,446238496,446449088,
446659552,446869920,447080192,447290400,447500448,447710432,447920320,448130112,
448339776,448549376,448758848,448968224,449177536,449386720,449595808,449804800,
450013664,450222464,450431168,450639776,450848256,451056640,451264960,451473152,
451681248,451889248,452097152,452304960,452512672,452720288,452927808,453135232,
453342528,453549760,453756864,453963904,454170816,454377632,454584384,454791008,
454997536,455203968,455410304,455616544,455822688,456028704,456234656,456440512,
456646240,456851904,457057472,457262912,457468256,457673536,457878688,458083744,
458288736,458493600,458698368,458903040,459107616,459312096,459516480,459720768,
459924960,460129056,460333056,460536960,460740736,460944448,461148064,461351584,
461554976,461758304,461961536,462164640,462367680,462570592,462773440,462976160,
463178816,463381344,463583776,463786144,463988384,464190560,464392608,464594560,
464796448,464998208,465199872,465401472,465602944,465804320,466005600,466206816,
466407904,466608896,466809824,467010624,467211328,467411936,467612480,467812896,
468013216,468213440,468413600,468613632,468813568,469013440,469213184,469412832,
469612416,469811872,470011232,470210528,470409696,470608800,470807776,471006688,
471205472,471404192,471602784,471801312,471999712,472198048,472396288,472594400,
472792448,472990400,473188256,473385984,473583648,473781216,473978688,474176064,
474373344,474570528,474767616,474964608,475161504,475358336,475555040,475751648,
475948192,476144608,476340928,476537184,476733312,476929376,477125344,477321184,
477516960,477712640,477908224,478103712,478299104,478494400,478689600,478884704,
479079744,479274656,479469504,479664224,479858880,480053408,480247872,480442240,
480636512,480830656,481024736,481218752,481412640,481606432,481800128,481993760,
482187264,482380704,482574016,482767264,482960416,483153472,483346432,483539296,
483732064,483924768,484117344,484309856,484502240,484694560,484886784,485078912,
485270944,485462880,485654720,485846464,486038144,486229696,486421184,486612576,
486803840,486995040,487186176,487377184,487568096,487758912,487949664,488140320,
488330880,488521312,488711712,488901984,489092160,489282240,489472256,489662176,
489851968,490041696,490231328,490420896,490610336,490799712,490988960,491178144,
491367232,491556224,491745120,491933920,492122656,492311264,492499808,492688256,
492876608,493064864,493253056,493441120,493629120,493817024,494004832,494192544,
494380160,494567712,494755136,494942496,495129760,495316928,495504000,495691008,
495877888,496064704,496251424,496438048,496624608,496811040,496997408,497183680,
497369856,497555936,497741920,497927840,498113632,498299360,498484992,498670560,
498856000,499041376,499226656,499411840,499596928,499781920,499966848,500151680,
500336416,500521056,500705600,500890080,501074464,501258752,501442944,501627040,
501811072,501995008,502178848,502362592,502546240,502729824,502913312,503096704,
503280000,503463232,503646368,503829408,504012352,504195200,504377984,504560672,
504743264,504925760,505108192,505290496,505472736,505654912,505836960,506018944,
506200832,506382624,506564320,506745952,506927488,507108928,507290272,507471552,
507652736,507833824,508014816,508195744,508376576,508557312,508737952,508918528,
509099008,509279392,509459680,509639904,509820032,510000064,510180000,510359872,
510539648,510719328,510898944,511078432,511257856,511437216,511616448,511795616,
511974688,512153664,512332576,512511392,512690112,512868768,513047296,513225792,
513404160,513582432,513760640,513938784,514116800,514294752,514472608,514650368,
514828064,515005664,515183168,515360608,515537952,515715200,515892352,516069440,
516246432,516423328,516600160,516776896,516953536,517130112,517306592,517482976,
517659264,517835488,518011616,518187680,518363648,518539520,518715296,518891008,
519066624,519242144,519417600,519592960,519768256,519943424,520118528,520293568,
520468480,520643328,520818112,520992800,521167392,521341888,521516320,521690656,
521864896,522039072,522213152,522387168,522561056,522734912,522908640,523082304,
523255872,523429376,523602784,523776096,523949312,524122464,524295552,524468512,
524641440,524814240,524986976,525159616,525332192,525504640,525677056,525849344,
526021568,526193728,526365792,526537760,526709632,526881440,527053152,527224800,
527396352,527567840,527739200,527910528,528081728,528252864,528423936,528594880,
528765760,528936576,529107296,529277920,529448480,529618944,529789344,529959648,
530129856,530300000,530470048,530640000,530809888,530979712,531149440,531319072,
531488608,531658080,531827488,531996800,532166016,532335168,532504224,532673184,
532842080,533010912,533179616,533348288,533516832,533685312,533853728,534022048,
534190272,534358432,534526496,534694496,534862400,535030240,535197984,535365632,
535533216,535700704,535868128,536035456,536202720,536369888,536536992,536704000,
536870912
};
// Now where did these came from?
const byte gammatable[5][256] =
{
{
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,
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
},
{
2,4,5,7,8,10,11,12,14,15,16,18,19,20,21,23,
24,25,26,27,29,30,31,32,33,34,36,37,38,39,40,41,
42,44,45,46,47,48,49,50,51,52,54,55,56,57,58,59,
60,61,62,63,64,65,66,67,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,129,130,131,132,133,134,135,136,137,138,139,
140,141,142,143,144,145,146,147,148,148,149,150,151,152,153,154,
155,156,157,158,159,160,161,162,163,163,164,165,166,167,168,169,
170,171,172,173,174,175,175,176,177,178,179,180,181,182,183,184,
185,186,186,187,188,189,190,191,192,193,194,195,196,196,197,198,
199,200,201,202,203,204,205,205,206,207,208,209,210,211,212,213,
214,214,215,216,217,218,219,220,221,222,222,223,224,225,226,227,
228,229,230,230,231,232,233,234,235,236,237,237,238,239,240,241,
242,243,244,245,245,246,247,248,249,250,251,252,252,253,254,255
},
{
4,7,9,11,13,15,17,19,21,22,24,26,27,29,30,32,
33,35,36,38,39,40,42,43,45,46,47,48,50,51,52,54,
55,56,57,59,60,61,62,63,65,66,67,68,69,70,72,73,
74,75,76,77,78,79,80,82,83,84,85,86,87,88,89,90,
91,92,93,94,95,96,97,98,100,101,102,103,104,105,106,107,
108,109,110,111,112,113,114,114,115,116,117,118,119,120,121,122,
123,124,125,126,127,128,129,130,131,132,133,133,134,135,136,137,
138,139,140,141,142,143,144,144,145,146,147,148,149,150,151,152,
153,153,154,155,156,157,158,159,160,160,161,162,163,164,165,166,
166,167,168,169,170,171,172,172,173,174,175,176,177,178,178,179,
180,181,182,183,183,184,185,186,187,188,188,189,190,191,192,193,
193,194,195,196,197,197,198,199,200,201,201,202,203,204,205,206,
206,207,208,209,210,210,211,212,213,213,214,215,216,217,217,218,
219,220,221,221,222,223,224,224,225,226,227,228,228,229,230,231,
231,232,233,234,235,235,236,237,238,238,239,240,241,241,242,243,
244,244,245,246,247,247,248,249,250,251,251,252,253,254,254,255
},
{
8,12,16,19,22,24,27,29,31,34,36,38,40,41,43,45,
47,49,50,52,53,55,57,58,60,61,63,64,65,67,68,70,
71,72,74,75,76,77,79,80,81,82,84,85,86,87,88,90,
91,92,93,94,95,96,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,135,136,137,138,
139,140,141,142,143,143,144,145,146,147,148,149,150,150,151,152,
153,154,155,155,156,157,158,159,160,160,161,162,163,164,165,165,
166,167,168,169,169,170,171,172,173,173,174,175,176,176,177,178,
179,180,180,181,182,183,183,184,185,186,186,187,188,189,189,190,
191,192,192,193,194,195,195,196,197,197,198,199,200,200,201,202,
202,203,204,205,205,206,207,207,208,209,210,210,211,212,212,213,
214,214,215,216,216,217,218,219,219,220,221,221,222,223,223,224,
225,225,226,227,227,228,229,229,230,231,231,232,233,233,234,235,
235,236,237,237,238,238,239,240,240,241,242,242,243,244,244,245,
246,246,247,247,248,249,249,250,251,251,252,253,253,254,254,255
},
{
16,23,28,32,36,39,42,45,48,50,53,55,57,60,62,64,
66,68,69,71,73,75,76,78,80,81,83,84,86,87,89,90,
92,93,94,96,97,98,100,101,102,103,105,106,107,108,109,110,
112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,128,
128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
143,144,145,146,147,148,149,150,150,151,152,153,154,155,155,156,
157,158,159,159,160,161,162,163,163,164,165,166,166,167,168,169,
169,170,171,172,172,173,174,175,175,176,177,177,178,179,180,180,
181,182,182,183,184,184,185,186,187,187,188,189,189,190,191,191,
192,193,193,194,195,195,196,196,197,198,198,199,200,200,201,202,
202,203,203,204,205,205,206,207,207,208,208,209,210,210,211,211,
212,213,213,214,214,215,216,216,217,217,218,219,219,220,220,221,
221,222,223,223,224,224,225,225,226,227,227,228,228,229,229,230,
230,231,232,232,233,233,234,234,235,235,236,236,237,237,238,239,
239,240,240,241,241,242,242,243,243,244,244,245,245,246,246,247,
247,248,248,249,249,250,250,251,251,252,252,253,254,254,255,255
}
}; |
function <API key>() {
return [
'testVisible',
'testItemHideShow',
'<API key>',
'<API key>',
'testDatasetHideShow',
'<API key>',
'testHidePast',
'testHideFuture'
];
}
function testVisible() {
var item = tm.datasets["test"].getItems()[0];
var placemark = item.placemark;
var eventSource = tm.timeline.getBand(0).getEventSource();
assertTrue("Item thinks it's visible", item.visible);
assertNotUndefined("Placemark exists", placemark);
assertNotUndefined("Event exists", item.event);
assertEquals("One item in eventSource", 1, eventSource.getCount());
assertFalse("Placemark thinks it's visible", placemark.isHidden());
assertTrue("Item thinks its placemark is visible", item.placemarkVisible);
assertTrue("Item thinks its event is visible", item.eventVisible);
}
function testItemHideShow() {
var item = tm.datasets["test"].getItems()[0];
var placemark = item.placemark;
var eventSource = tm.timeline.getBand(0).getEventSource();
assertTrue("Item thinks it's visible", item.visible);
assertFalse("Placemark thinks it's visible", placemark.isHidden());
assertTrue("Item thinks its placemark is visible", item.placemarkVisible);
assertEquals("One item in eventSource", 1, eventSource.getCount());
assertTrue("Item thinks its event is visible", item.eventVisible);
item.hide();
assertFalse("Item thinks it's hidden", item.visible);
assertEquals("Zero items in eventSource", 0, eventSource.getCount());
assertFalse("Item thinks its event is hidden", item.eventVisible);
assertTrue("Placemark thinks it's hidden", placemark.isHidden());
assertFalse("Item thinks its placemark is hidden", item.placemarkVisible);
item.show();
assertTrue("Item thinks it's visible", item.visible);
assertEquals("One item in eventSource", 1, eventSource.getCount());
assertTrue("Item thinks its event is visible", item.eventVisible);
assertFalse("Placemark thinks it's visible", placemark.isHidden());
assertTrue("Item thinks its placemark is visible", item.placemarkVisible);
}
function <API key>() {
var item = tm.datasets["test"].getItems()[0];
var placemark = item.placemark;
assertFalse("Placemark thinks it's visible", placemark.isHidden());
assertTrue("Item thinks its placemark is visible", item.placemarkVisible);
item.hidePlacemark();
assertTrue("Placemark thinks it's hidden", placemark.isHidden());
assertFalse("Item thinks its placemark is hidden", item.placemarkVisible);
item.showPlacemark();
assertFalse("Placemark thinks it's visible", placemark.isHidden());
assertTrue("Item thinks its placemark is visible", item.placemarkVisible);
}
function <API key>() {
var item = tm.datasets["test"].getItems()[0];
var eventSource = tm.timeline.getBand(0).getEventSource();
assertEquals("One item in eventSource", 1, eventSource.getCount());
assertTrue("Item thinks its event is visible", item.eventVisible);
item.hideEvent();
// no great way to test item visibility
assertEquals("Zero items in eventSource", 0, eventSource.getCount());
assertFalse("Item thinks its event is hidden", item.eventVisible);
item.showEvent();
assertEquals("One item in eventSource", 1, eventSource.getCount());
assertTrue("Item thinks its event is visible", item.eventVisible);
}
function testDatasetHideShow() {
var ds = tm.datasets["test"];
var item = tm.datasets["test"].getItems()[0];
var placemark = item.placemark;
var eventSource = tm.timeline.getBand(0).getEventSource();
assertTrue("Dataset thinks it's visible", ds.visible);
ds.hide();
assertFalse("Dataset thinks it's hidden", ds.visible);
assertTrue("Placemark thinks it's hidden", placemark.isHidden());
assertEquals("Zero items in eventSource", 0, eventSource.getCount());
assertFalse("Item thinks its event is hidden", item.eventVisible);
assertFalse("Item thinks its placemark is hidden", item.placemarkVisible);
ds.show();
assertTrue("Dataset thinks it's visible", ds.visible);
assertFalse("Placemark thinks it's visible", placemark.isHidden());
assertEquals("One item in eventSource", 1, eventSource.getCount());
assertTrue("Item thinks its event is visible", item.eventVisible);
assertTrue("Item thinks its placemark is visible", item.placemarkVisible);
}
function <API key>() {
var ds = tm.datasets["test"];
var item = tm.datasets["test"].getItems()[0];
var placemark = item.placemark;
var eventSource = tm.timeline.getBand(0).getEventSource();
tm.hideDatasets();
assertFalse("Dataset thinks it's hidden", ds.visible);
assertTrue("Placemark thinks it's hidden", placemark.isHidden());
assertEquals("Zero items in eventSource", 0, eventSource.getCount());
assertFalse("Item thinks its event is hidden", item.eventVisible);
assertFalse("Item thinks its placemark is hidden", item.placemarkVisible);
tm.showDatasets();
assertTrue("Dataset thinks it's visible", ds.visible);
assertFalse("Placemark thinks it's visible", placemark.isHidden());
assertEquals("One item in eventSource", 1, eventSource.getCount());
assertTrue("Item thinks its event is visible", item.eventVisible);
assertTrue("Item thinks its placemark is visible", item.placemarkVisible);
tm.hideDataset("test");
assertFalse("Dataset thinks it's hidden", ds.visible);
assertTrue("Placemark thinks it's hidden", placemark.isHidden());
assertEquals("Zero items in eventSource", 0, eventSource.getCount());
assertFalse("Item thinks its event is hidden", item.eventVisible);
assertFalse("Item thinks its placemark is hidden", item.placemarkVisible);
tm.showDatasets();
tm.hideDataset("notarealid");
assertTrue("Dataset thinks it's visible", ds.visible);
assertFalse("Placemark thinks it's visible", placemark.isHidden());
assertEquals("One item in eventSource", 1, eventSource.getCount());
assertTrue("Item thinks its event is visible", item.eventVisible);
assertTrue("Item thinks its placemark is visible", item.placemarkVisible);
}
function testHidePast() {
var parser = Timeline.DateTime.<API key>;
var items = tm.datasets["test"].getItems();
var placemark = items[0].placemark;
assertFalse(placemark.isHidden());
var date = parser("1970-01-01");
tm.timeline.getBand(0).<API key>(date);
assertTrue(placemark.isHidden());
var date = parser("1980-01-01");
tm.timeline.getBand(0).<API key>(date);
assertFalse(placemark.isHidden());
}
function testHideFuture() {
var parser = Timeline.DateTime.<API key>;
var items = tm.datasets["test"].getItems();
var placemark = items[0].placemark;
assertFalse(placemark.isHidden());
var date = parser("2000-01-01");
tm.timeline.getBand(0).<API key>(date);
assertTrue(placemark.isHidden());
var date = parser("1980-01-01");
tm.timeline.getBand(0).<API key>(date);
assertFalse(placemark.isHidden());
}
// page setup script
function setUpPage() {
tm = TimeMap.init({
mapId: "map", // Id of map div element (required)
timelineId: "timeline", // Id of timeline div element (required)
datasets: [
{
title: "Test Dataset",
id: "test",
type: "basic",
options: {
items: [
{
"start" : "1980-01-02",
"end" : "1990-01-02",
"point" : {
"lat" : 23.456,
"lon" : 12.345
},
"title" : "Test Event",
"options" : {
"description": "Test Description"
}
}
]
}
}
]
});
setUpPageStatus = "complete";
}
function setUp() {
var eventSource = tm.timeline.getBand(0).getEventSource();
tm.timeline.getBand(0).<API key>(eventSource.getEarliestDate());
tm.showDatasets();
} |
<?php
require_once 'db_connect.php';
require_once 'account.common.php';
require_once 'include/astercrm.class.php';
class Customer extends astercrm
{
/**
* Obtiene todos los registros de la tabla paginados.
*
* @param $start (int) Inicio del rango de la página de datos en la consulta SQL.
* @param $limit (int) Límite del rango de la página de datos en la consultal SQL.
* @param $order (string) Campo por el cual se aplicará el orden en la consulta SQL.
* @return $res (object) Objeto que contiene el arreglo del resultado de la consulta SQL.
*/
function &getAllRecords($start, $limit, $order = null, $groupid = null){
global $db;
$sql = "SELECT astercrm_account.*, groupname FROM astercrm_account LEFT JOIN <API key> ON <API key>.groupid = astercrm_account.groupid";
if ($_SESSION['curuser']['usertype'] == 'admin'){
$sql .= " ";
}else{
$sql .= " WHERE astercrm_account.groupid = ".$_SESSION['curuser']['groupid']." ";
}
if($order == null){
$sql .= " LIMIT $start, $limit";//.$_SESSION['ordering'];
}else{
$sql .= " ORDER BY $order ".$_SESSION['ordering']." LIMIT $start, $limit";
}
Customer::events($sql);
$res =& $db->query($sql);
return $res;
}
/**
* Obtiene todos registros de la tabla paginados y aplicando un filtro
*
* @param $start (int) Es el inicio de la página de datos en la consulta SQL
* @param $limit (int) Es el limite de los datos páginados en la consultal SQL.
* @param $filter (string) Nombre del campo para aplicar el filtro en la consulta SQL
* @param $content (string) Contenido a filtrar en la conslta SQL.
* @param $order (string) Campo por el cual se aplicará el orden en la consulta SQL.
* @return $res (object) Objeto que contiene el arreglo del resultado de la consulta SQL.
*/
function &<API key>($start, $limit, $filter, $content, $order, $ordering = ""){
global $db;
$i=0;
$joinstr='';
foreach ($content as $value){
$value = preg_replace("/'/","\\'",$value);
$value=trim($value);
if (strlen($value)!=0 && strlen($filter[$i]) != 0){
$joinstr.="AND $filter[$i] like '%".$value."%' ";
}
$i++;
}
$sql = "SELECT astercrm_account.*, groupname FROM astercrm_account LEFT JOIN <API key> ON <API key>.id = astercrm_account.groupid WHERE ";
if ($_SESSION['curuser']['usertype'] == 'admin'){
$sql .= " 1 ";
}else{
$sql .= " astercrm_account.groupid = ".$_SESSION['curuser']['groupid']." ";
}
if ($joinstr!=''){
$joinstr=ltrim($joinstr,'AND'); //AND
$sql .= " AND ".$joinstr." "
." ORDER BY ".$order
." ".$_SESSION['ordering']
." LIMIT $start, $limit $ordering";
}
Customer::events($sql);
$res =& $db->query($sql);
return $res;
}
/**
* Devuelte el numero de registros de acuerdo a los parámetros del filtro
*
* @param $filter (string) Nombre del campo para aplicar el filtro en la consulta SQL
* @param $order (string) Campo por el cual se aplicará el orden en la consulta SQL.
* @return $row['numrows'] (int) Número de registros (líneas)
*/
function &getNumRows($filter = null, $content = null){
global $db;
if ($_SESSION['curuser']['usertype'] == 'admin'){
$sql = " SELECT COUNT(*) FROM astercrm_account LEFT JOIN <API key> ON <API key>.id = astercrm_account.groupid";
}else{
$sql = " SELECT COUNT(*) FROM astercrm_account LEFT JOIN <API key> ON <API key>.id = astercrm_account.groupid WHERE astercrm_account.groupid = ".$_SESSION['curuser']['groupid']." ";
}
Customer::events($sql);
$res =& $db->getOne($sql);
return $res;
}
function &getNumRowsMore($filter = null, $content = null){
global $db;
$i=0;
$joinstr='';
foreach ($content as $value){
$value = preg_replace("/'/","\\'",$value);
$value=trim($value);
if (strlen($value)!=0 && strlen($filter[$i]) != 0){
$joinstr.="AND $filter[$i] like '%".$value."%' ";
}
$i++;
}
$sql = "SELECT COUNT(*) FROM astercrm_account LEFT JOIN <API key> ON <API key>.id = astercrm_account.groupid WHERE ";
if ($_SESSION['curuser']['usertype'] == 'admin'){
$sql .= " ";
}else{
$sql .= " astercrm_account.groupid = ".$_SESSION['curuser']['groupid']." AND ";
}
if ($joinstr!=''){
$joinstr=ltrim($joinstr,'AND'); //AND
$sql .= " ".$joinstr;
}else {
$sql .= " 1";
}
Customer::events($sql);
$res =& $db->getOne($sql);
// print $sql;
// print "\n";
// print $res;
// exit;
return $res;
}
function &<API key>($filter, $content,$stype,$table){
global $db;
$joinstr = astercrm::createSqlWithStype($filter,$content,$stype,'astercrm_account');
$sql = "SELECT COUNT(*) FROM astercrm_account LEFT JOIN <API key> ON <API key>.id = astercrm_account.groupid WHERE ";
if ($_SESSION['curuser']['usertype'] == 'admin'){
$sql .= " ";
}else{
$sql .= " astercrm_account.groupid = ".$_SESSION['curuser']['groupid']." AND ";
}
if ($joinstr!=''){
$joinstr=ltrim($joinstr,'AND'); //AND
$sql .= " ".$joinstr;
}else {
$sql .= " 1";
}
Customer::events($sql);
$res =& $db->getOne($sql);
return $res;
}
function &<API key>($start, $limit, $filter, $content, $stype,$order,$table){
global $db;
$joinstr = astercrm::createSqlWithStype($filter,$content,$stype,'astercrm_account');
$sql = "SELECT astercrm_account.*, groupname FROM astercrm_account LEFT JOIN <API key> ON <API key>.id = astercrm_account.groupid WHERE ";
if ($_SESSION['curuser']['usertype'] == 'admin'){
$sql .= " 1 ";
}else{
$sql .= " astercrm_account.groupid = ".$_SESSION['curuser']['groupid']." ";
}
if ($joinstr!=''){
$joinstr=ltrim($joinstr,'AND'); //AND
$sql .= " AND ".$joinstr." "
." ORDER BY ".$order
." ".$_SESSION['ordering']
." LIMIT $start, $limit $ordering";
}
Customer::events($sql);
$res =& $db->query($sql);
return $res;
}
function <API key>($f){
global $db;
$f = astercrm::variableFiler($f);
$sql= "INSERT INTO clid SET "
."clid='".$f['extension']."', "
."pin='".$f['password']."', "
."display='".$f['username']."', "
."groupid = ".$f['groupid'].", "
."resellerid = ".$f['resellerid'].", "
."creditlimit = '".$f['creditlimit']."',"
."limittype = '".$f['limittype']."',"
."addtime = now() ";
astercrm::events($sql);
$res =& $db->query($sql);
return $res;
}
/**
* Imprime la forma para agregar un nuevo registro sobre el DIV identificado por "formDiv".
*
* @param ninguno
* @return $html (string) Devuelve una cadena de caracteres que contiene la forma para insertar
* un nuevo registro.
*/
function formAdd(){
global $locate;
if ($_SESSION['curuser']['usertype'] == 'admin'){
$res = Customer::getGroups();
$groupoptions .= '<select name="groupid" id="groupid">';
while ($row = $res->fetchRow()) {
$groupoptions .= '<option value="'.$row['groupid'].'"';
$groupoptions .='>'.$row['groupname'].'</option>';
}
$groupoptions .= '</select>';
}else{
$groupoptions .= $_SESSION['curuser']['group']['groupname'].'<input id="groupid" name="groupid" type="hidden" value="'.$_SESSION['curuser']['groupid'].'">';
}
$html = '
<!-- No edit the next line -->
<form method="post" name="f" id="f">
<table border="1" width="100%" class="adminlist">
<tr>
<td nowrap align="left">'.$locate->Translate("username").'*</td>
<td align="left"><input type="text" id="username" name="username" size="25" maxlength="30"></td>
</tr>
<tr>
<td nowrap align="left">'.$locate->Translate("password").'*</td>
<td align="left"><input type="text" id="password" name="password" size="25" maxlength="30"></td>
</tr>
<tr>
<td nowrap align="left">'.$locate->Translate("first name").'*</td>
<td align="left"><input type="text" id="firstname" name="firstname" size="25" maxlength="15"></td>
</tr>
<tr>
<td nowrap align="left">'.$locate->Translate("last name").'*</td>
<td align="left"><input type="text" id="lastname" name="lastname" size="25" maxlength="15"></td>
</tr>
<tr>
<td nowrap align="left">'.$locate->Translate("callerid").'</td>
<td align="left"><input type="text" id="callerid" name="callerid" size="25" maxlength="30"></td>
</tr>
<tr>
<td nowrap align="left">'.$locate->Translate("extension").'*</td>
<td align="left"><input type="text" id="extension" name="extension" size="25" maxlength="15"></td>
</tr>
<tr>
<td nowrap align="left">'.$locate->Translate("dynamic agent").'</td>
<td align="left"><input type="text" id="agent" name="agent" size="25" maxlength="15"></td>
</tr>
<tr>
<td nowrap align="left">'.$locate->Translate("extensions").'</td>
<td align="left"><input type="text" id="extensions" name="extensions" size="25" maxlength="100" onclick="chkExtenionClick(this.value,this)" onblur="chkExtenionBlur(this.value,this)" style="color:#BBB" value="'.$locate->translate('<API key>').'" /> <input type="radio" value="username" id="extensType" name="extensType" checked>'.$locate->Translate("username").'<input type="radio" value="extension" id="extensType" name="extensType" >'.$locate->Translate("extension").'</td>
</tr>
<tr>
<td nowrap align="left">'.$locate->Translate("channel").'</td>
<td align="left"><input type="text" id="channel" name="channel" size="25" maxlength="30"></td>
</tr>
<tr>
<td nowrap align="left">'.$locate->Translate("usertype").'*</td>
<td align="left">
<select id="usertypeSelect" onchange="usertypeChange(this)">
<option value="0"></option>
<option value="0">agent</option>
<option value="0">groupadmin</option>';
if ($_SESSION['curuser']['usertype'] == 'admin') {
$html .='<option value="0">admin</option>';
}
$userTyperesult = Customer::getAstercrmUsertype();
if(!empty($userTyperesult)) {
foreach($userTyperesult as $usertype) {
$html .='<option value="'.$usertype['id'].'">'.$usertype['usertype_name'].'</option>';
}
}
$html .='
</select><input type="hidden" id="usertype" name="usertype" value="" /><input type="hidden" id="usertype_id" name="usertype_id" value="0" /></td>
</tr>
<tr>
<td nowrap align="left">'.$locate->Translate("account_code").'</td>
<td align="left"><input type="text" id="accountcode" name="accountcode" size="20" maxlength="20"></td>
</tr>';
$html .= '
<tr>
<td align="left" width="25%">'.$locate->Translate("Group Name").'</td>
<td>'.$groupoptions.'</td>
</tr>';
$html .= '<tr>
<td nowrap align="left">'.$locate->Translate("Dial Interval").'</td>
<td align="left"><input type="text" id="dialinterval" name="dialinterval" size="20" maxlength="20"></td>
</tr>';
$html .= '
<tr>
<td colspan="2" align="center"><button id="submitButton" onClick=\'xajax_save(xajax.getFormValues("f"));return false;\'>'.$locate->Translate("continue").'</button></td>
</tr>
</table>
';
$html .='
</form>
'.$locate->Translate("obligatory_fields").'
';
return $html;
}
/**
* Imprime la forma para editar un nuevo registro sobre el DIV identificado por "formDiv".
*
* @param $id (int) Identificador del registro a ser editado.
* @return $html (string) Devuelve una cadena de caracteres que contiene la forma con los datos
* a extraidos de la base de datos para ser editados
*/
function formEdit($id){
global $locate;
$account =& Customer::getRecordByID($id,'astercrm_account');
if ($_SESSION['curuser']['usertype'] == 'admin'){
$grouphtml .= '<select name="groupid" id="groupid" >';
$res = Customer::getGroups();
while ($row = $res->fetchRow()) {
$grouphtml .= '<option value="'.$row['groupid'].'"';
if($row['groupid'] == $account['groupid']){
$grouphtml .= ' selected ';
}
$grouphtml .= '>'.$row['groupname'].'</option>';
}
$grouphtml .= '</select>';
}else{
$grouphtml .= $_SESSION['curuser']['group']['groupname'].'<input type="hidden" name="groupid" id="groupid" value="'.$_SESSION['curuser']['groupid'].'">';
}
$html = '
<!-- No edit the next line -->
<form method="post" name="f" id="f">
<table border="1" width="100%" class="adminlist">
<tr>
<td nowrap align="left">'.$locate->Translate("username").'*</td>
<td align="left"><input type="hidden" id="id" name="id" value="'. $account['id'].'"><input type="text" id="username" name="username" size="25" maxlength="30" value="'.$account['username'].'"></td>
</tr>
<tr>
<td nowrap align="left">'.$locate->Translate("password").'*</td>
<td align="left"><input type="text" id="password" name="password" size="25" maxlength="30" value="'.$account['password'].'"></td>
</tr>
<tr>
<td nowrap align="left">'.$locate->Translate("first name").'*</td>
<td align="left"><input type="text" id="firstname" name="firstname" size="25" maxlength="15" value="'.$account['firstname'].'"></td>
</tr>
<tr>
<td nowrap align="left">'.$locate->Translate("last name").'*</td>
<td align="left"><input type="text" id="lastname" name="lastname" size="25" maxlength="15" value="'.$account['lastname'].'"></td>
</tr>
<tr>
<td nowrap align="left">'.$locate->Translate("callerid").'</td>
<td align="left"><input type="text" id="callerid" name="callerid" size="25" maxlength="30" value="'.$account['callerid'].'"></td>
</tr>
<tr>
<td nowrap align="left">'.$locate->Translate("extension").'*</td>
<td align="left"><input type="text" id="extension" name="extension" size="25" maxlength="15" value="'.$account['extension'].'"></td>
</tr>
<tr>
<td nowrap align="left">'.$locate->Translate("dynamic agent").'</td>
<td align="left"><input type="text" id="agent" name="agent" size="25" maxlength="15" value="'.$account['agent'].'"></td>
</tr>
<tr><td nowrap align="left">'.$locate->Translate("extensions").'</td>
<td align="left">';
if($account['extensions'] == '') {
$html .= '<input type="text" id="extensions" name="extensions" size="25" maxlength="100" onclick="chkExtenionClick(this.value,this)" onblur="chkExtenionBlur(this.value,this)" style="color:#BBB" value="'.$locate->translate('<API key>').'">';
} else {
$html .= '<input type="text" id="extensions" name="extensions" size="25" maxlength="100" onclick="chkExtenionClick(this.value,this)" onblur="chkExtenionBlur(this.value,this)" value="'.$account['extensions'].'">';
}
$html .= '
<input type="radio" value="username" id="extensType" name="extensType" checked>'.$locate->Translate("username").'<input type="radio" value="extension" id="extensType" name="extensType" >'.$locate->Translate("extension").'</td>
</tr>
<tr>
<td nowrap align="left">'.$locate->Translate("channel").'</td>
<td align="left"><input type="text" id="channel" name="channel" size="25" maxlength="30" value="'.$account['channel'].'"></td>
</tr>
<tr>
<td nowrap align="left">'.$locate->Translate("usertype").'*</td>
<td align="left">
<select id="usertypeSelect" onchange="usertypeChange(this)">
<option value="0" ';
if($account['usertype'] == ''){
$html .= ' selected ';
}
$html .= '></option>
<option value="0"';
if($account['usertype'] == 'agent'){
$html .= ' selected ';
}
$html .=' >agent</option>
<option value="0"';
if($account['usertype'] == 'groupadmin'){
$html .= ' selected ';
}
$html .='>groupadmin</option>';
if ($_SESSION['curuser']['usertype'] == 'admin') {
$html .='<option value="0"';
if($account['usertype'] == 'admin') $html .= ' selected ';
$html .='>admin</option>';
}
$userTyperesult = Customer::getAstercrmUsertype();
if(!empty($userTyperesult)) {
foreach($userTyperesult as $usertype) {
$html .='<option value="'.$usertype['id'].'" ';
if($usertype['id'] == $account['usertype_id']) {
$html .=' selected';
}
$html .='>'.$usertype['usertype_name'].'</option>';
}
}
$html .= '</select><input type="hidden" id="usertype" name="usertype" value="'.$account['usertype'].'" /><input type="hidden" id="usertype_id" name="usertype_id" value="'.$account['usertype_id'].'" />
<!--<input type="text" id="usertype" name="usertype" size="25" maxlength="30" value="'.$account['usertype'].'">--></td>
</tr>
<tr>
<td nowrap align="left">'.$locate->Translate("account_code").'</td>
<td align="left"><input type="text" id="accountcode" name="accountcode" size="20" maxlength="20" value="'.$account['accountcode'].'"></td>
</tr>
<tr>
<td nowrap align="left">'.$locate->Translate("group_name").'</td>
<td align="left">'.$grouphtml.'
</td>
</tr>
<tr>
<td nowrap align="left">'.$locate->Translate("Dial Interval").'</td>
<td align="left"><input type="text" id="dialinterval" name="dialinterval" size="20" maxlength="20" value="'.$account['dialinterval'].'"></td>
</tr>
<tr>
<td colspan="2" align="center"><button id="submitButton" onClick=\'xajax_update(xajax.getFormValues("f"));return false;\'>'.$locate->Translate("continue").'</button></td>
</tr>
</table>
';
$html .= '
</form>
'.$locate->Translate("obligatory_fields").'
';
return $html;
}
/**
* Imprime la forma para editar un nuevo registro sobre el DIV identificado por "formDiv".
*
* @param $id (int) Identificador del registro a ser editado.
* @return $html (string) Devuelve una cadena de caracteres que contiene la forma con los datos
* a extraidos de la base de datos para ser editados
*/
function showAccountDetail($id){
global $locate;
$account =& Customer::getRecordByID($id,'astercrm_account');
$group = & Customer::getGroupByID($account['groupid']);
$html = '
<table border="1" width="100%" class="adminlist">
<tr>
<td nowrap align="left">'.$locate->Translate("username").'</td>
<td align="left">'.$account['username'].'</td>
</tr>
<tr>
<td nowrap align="left">'.$locate->Translate("password").'</td>
<td align="left">'.$account['password'].'</td>
</tr>
<tr>
<td nowrap align="left">'.$locate->Translate("first name").'</td>
<td align="left">'.$account['firstname'].'</td>
</tr>
<tr>
<td nowrap align="left">'.$locate->Translate("last name").'</td>
<td align="left">'.$account['lastname'].'</td>
</tr>
<tr>
<td nowrap align="left">'.$locate->Translate("callerid").'</td>
<td align="left">'.$account['callerid'].'</td>
</tr>
<tr>
<td nowrap align="left">'.$locate->Translate("extension").'</td>
<td align="left">'.$account['extension'].'</td>
</tr>
<tr>
<td nowrap align="left">'.$locate->Translate("dynamic agent").'</td>
<td align="left">'.$account['agent'].'</td>
</tr>
<tr>
<td nowrap align="left">'.$locate->Translate("extensions").'</td>
<td align="left">'.$account['extensions'].'</td>
</tr>
<tr>
<td nowrap align="left">'.$locate->Translate("channel").'</td>
<td align="left">"'.$account['channel'].'</td>
</tr>
<tr>
<td nowrap align="left">'.$locate->Translate("usertype").'</td>
<td align="left">'.$account['usertype'].'</td>
</tr>
<tr>
<td nowrap align="left">'.$locate->Translate("account_code").'</td>
<td align="left">'.$account['accountcode'].'</td>
</tr>
<tr>
<td nowrap align="left">'.$locate->Translate("group_name").'</td>
<td align="left">'.$group['groupname'].'</td>
</tr>
</table>
';
return $html;
}
function getAstercrmUsertype(){
global $db;
$sql = "SELECT * FROM user_types ";
astercrm::events($sql);
$result = & $db->query($sql);
$usertype = array();
while($result->fetchInto($row)) {
$usertype[] = $row;
}
return $usertype;
}
}
?> |
/* should be included inside draw-char.c */
void F1(unsigned int ry, unsigned SIZE *out, unsigned int tc[16], unsigned int mouseline[80])
{
unsigned int *bp;
unsigned int dg;
unsigned char *q;
uint8_t *itf, *bios, *bioslow, *hf;
unsigned int x, y;
int fg, bg;
q = ovl + (ry * 640);
y = ry >> 3;
bp = &vgamem_read[y * 80];
itf = font_data + (ry & 7);
bios = ((uint8_t*) <API key>) + (ry & 7);
bioslow = ((uint8_t *) font_default_lower) + (ry & 7);
hf = font_half_data + ((ry & 7) >> 1);
for (x = 0; x < 80; x++, bp++, q += 8) {
if (*bp & 0x80000000) {
*out++ = tc[ (q[0]^((mouseline[x] & 0x80)?15:0)) & 255];
*out++ = tc[ (q[1]^((mouseline[x] & 0x40)?15:0)) & 255];
*out++ = tc[ (q[2]^((mouseline[x] & 0x20)?15:0)) & 255];
*out++ = tc[ (q[3]^((mouseline[x] & 0x10)?15:0)) & 255];
*out++ = tc[ (q[4]^((mouseline[x] & 0x08)?15:0)) & 255];
*out++ = tc[ (q[5]^((mouseline[x] & 0x04)?15:0)) & 255];
*out++ = tc[ (q[6]^((mouseline[x] & 0x02)?15:0)) & 255];
*out++ = tc[ (q[7]^((mouseline[x] & 0x01)?15:0)) & 255];
} else if (*bp & 0x40000000) {
/* half-width character */
fg = (*bp >> 22) & 15;
bg = (*bp >> 18) & 15;
dg = hf[ _unpack_halfw((*bp >> 7) & 127) << 2];
if (!(ry & 1))
dg = (dg >> 4);
dg ^= mouseline[x];
*out++ = tc[(dg & 0x8) ? fg : bg];
*out++ = tc[(dg & 0x4) ? fg : bg];
*out++ = tc[(dg & 0x2) ? fg : bg];
*out++ = tc[(dg & 0x1) ? fg : bg];
fg = (*bp >> 26) & 15;
bg = (*bp >> 14) & 15;
dg = hf[ _unpack_halfw((*bp) & 127) << 2];
if (!(ry & 1))
dg = (dg >> 4);
dg ^= mouseline[x];
*out++ = tc[(dg & 0x8) ? fg : bg];
*out++ = tc[(dg & 0x4) ? fg : bg];
*out++ = tc[(dg & 0x2) ? fg : bg];
*out++ = tc[(dg & 0x1) ? fg : bg];
} else {
/* regular character */
fg = (*bp & 0x0F00) >> 8;
bg = (*bp & 0xF000) >> 12;
if (*bp & 0x10000000 && (*bp & 0x80)) {
dg = bios[(*bp & 0x7F)<< 3];
} else if (*bp & 0x10000000) {
dg = bioslow[(*bp & 0x7F)<< 3];
} else {
dg = itf[(*bp & 0xFF)<< 3];
}
dg ^= mouseline[x];
if (!(*bp & 0xFF))
fg = 3;
*out++ = tc[(dg & 0x80) ? fg : bg];
*out++ = tc[(dg & 0x40) ? fg : bg];
*out++ = tc[(dg & 0x20) ? fg : bg];
*out++ = tc[(dg & 0x10) ? fg : bg];
*out++ = tc[(dg & 0x8) ? fg : bg];
*out++ = tc[(dg & 0x4) ? fg : bg];
*out++ = tc[(dg & 0x2) ? fg : bg];
*out++ = tc[(dg & 0x1) ? fg : bg];
}
}
} |
// mcomposite/tests/_extlibs_.h
// This file is part of Bombono DVD project.
// This program is free software; you can redistribute it and/or modify
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#ifndef <API key>
#define <API key>
#include <boost/test/auto_unit_test.hpp>
#endif // <API key> |
package ntut.csie.ezScrum.web.control;
import java.awt.BasicStroke;
import java.awt.Color;
import java.io.File;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;
import ntut.csie.ezScrum.issue.core.ITSEnum;
import ntut.csie.ezScrum.iteration.core.ScrumEnum;
import ntut.csie.ezScrum.web.dataObject.ProjectObject;
import ntut.csie.ezScrum.web.dataObject.SprintObject;
import ntut.csie.ezScrum.web.dataObject.StoryObject;
import ntut.csie.ezScrum.web.dataObject.TaskObject;
import ntut.csie.ezScrum.web.logic.SprintBacklogLogic;
import ntut.csie.ezScrum.web.mapper.SprintBacklogMapper;
import ntut.csie.jcis.core.util.ChartUtil;
import ntut.csie.jcis.core.util.DateUtil;
import ntut.csie.jcis.resource.core.IProject;
public class TaskBoard {
private final String STORY_CHART_FILE = "StoryBurnDown.png";
private final String TASK_CHART_FILE = "TaskBurnDown.png";
private final String NAME = "TaskBoard";
private SprintBacklogMapper <API key>;
private SprintBacklogLogic mSprintBacklogLogic;
private ArrayList<StoryObject> mStories;
private ArrayList<StoryObject> mDroppedStories;
private LinkedHashMap<Date, Double> <API key>;
private LinkedHashMap<Date, Double> mDateToStoryPoint;
private LinkedHashMap<Date, Double> <API key>;
private LinkedHashMap<Date, Double> <API key>;
private Date mCurrentDate = new Date();
private Date mGeneratedTime = new Date();
final private long mOneDay = ScrumEnum.DAY_MILLISECOND;
public TaskBoard(SprintBacklogLogic sprintBacklogLogic, SprintBacklogMapper sprintBacklogMapper) {
mSprintBacklogLogic = sprintBacklogLogic;
<API key> = sprintBacklogMapper;
init();
}
public LinkedHashMap<Date, Double> <API key>() {
return mDateToStoryPoint;
}
public LinkedHashMap<Date, Double> getTaskRealPointMap() {
return <API key>;
}
public LinkedHashMap<Date, Double> <API key>() {
return <API key>;
}
public LinkedHashMap<Date, Double> <API key>() {
return <API key>;
}
private void init() {
// StoryTask
mStories = mSprintBacklogLogic.<API key>();
// dropStoryTask
mDroppedStories = <API key>.<API key>();
if (<API key> != null) {
// Sprint
Date sprintStartWorkDate = mSprintBacklogLogic.<API key>();
Date sprintEndWorkDate = mSprintBacklogLogic.<API key>();
Date sprintEndDate = <API key>.getSprintEndDate();
if (sprintStartWorkDate == null || sprintEndWorkDate == null || sprintEndDate == null) {
return;
}
Calendar indexDate = Calendar.getInstance();
indexDate.setTime(sprintStartWorkDate);
<API key> = new LinkedHashMap<Date, Double>(); // Story
<API key> = new LinkedHashMap<Date, Double>(); // Task
mDateToStoryPoint = new LinkedHashMap<Date, Double>(); // Story
<API key> = new LinkedHashMap<Date, Double>(); // Task
double[] initPoint = getPointByDate(sprintStartWorkDate); // StoryTask
int dayOfSprint = mSprintBacklogLogic.getSprintWorkDays(); // SprintW
long endTime = sprintEndWorkDate.getTime(); // End Time
long today = mCurrentDate.getTime(); // EndDateEndDate
int sprintDayCount = 0; // SprintCounter
if (mCurrentDate.getTime() > sprintEndDate.getTime()) {
// end date 00:00:00 OneDay 00:00:00 - 23:59:59
today = sprintEndDate.getTime() + mOneDay;
}
while (!(indexDate.getTimeInMillis() > endTime) || indexDate.getTimeInMillis() == endTime) {
Date key = indexDate.getTime();
if (!DateUtil.isHoliday(key)) {
// StoryTask
<API key>.put(key, (((-initPoint[0]) / (dayOfSprint - 1)) * sprintDayCount) + initPoint[0]);
<API key>.put(key, (((-initPoint[1]) / (dayOfSprint - 1)) * sprintDayCount) + initPoint[1]);
// StoryTask
if (indexDate.getTimeInMillis() < today) {
double point[] = getPointByDate(key);
mDateToStoryPoint.put(key, point[0]);
<API key>.put(key, point[1]);
} else {
mDateToStoryPoint.put(key, null);
<API key>.put(key, null);
}
sprintDayCount++;
}
indexDate.add(Calendar.DATE, 1);
}
}
}
private double getStoryPoint(Date date, StoryObject story) throws Exception {
double point = 0;
// Story
if (story.getSprintId() == <API key>.getSprintId()) {
point = story.getEstimate();
} else {
// StorySprint
throw new Exception("this story isn't at this sprint");
}
return point;
}
private double getTaskPoint(Date date, TaskObject task) {
double point = 0;
try {
point = task.getRemains(date);
} catch (Exception e) {
try {
// TaskREMAINSESTIMATION
point = task.getEstimate();
} catch (Exception e1) {
return 0;
}
}
return point;
}
private double[] getPointByDate(Date date) {
double[] point = {0, 0};
// 0:0:0,23:59:59
Date dueDate = new Date(date.getTime() + mOneDay);
// Story
for (StoryObject story : mStories) {
// closedStoryTask
if (story.getStatus(dueDate) == StoryObject.STATUS_DONE) {
continue;
}
try {
point[0] += getStoryPoint(dueDate, story);
// StoryTask
ArrayList<TaskObject> tasks = story.getTasks();
for (TaskObject task : tasks) {
if(task.getStatus(dueDate) == TaskObject.STATUS_DONE) {
continue;
}
point[1] += getTaskPoint(dueDate, task);
}
} catch (Exception e) {
// ExceptionStorySprintgetTagValuenullparseDoubleexception
continue;
}
}
// Droped Story
for (StoryObject story : mDroppedStories) {
// closedStoryTask
if (story.getStatus(dueDate) == StoryObject.STATUS_DONE) {
continue;
}
try {
point[0] += getStoryPoint(dueDate, story);
// StoryTask
ArrayList<TaskObject> tasks = story.getTasks();
for (TaskObject task : tasks) {
// closedtask
if (task.getStatus(dueDate) == TaskObject.STATUS_DONE) {
continue;
}
point[1] += getTaskPoint(dueDate, task);
}
} catch (Exception e) {
continue;
}
}
return point;
}
public String getSprintGoal() {
return <API key>.getSprintGoal();
}
public long getSprintId() {
return <API key>.getSprintId();
}
public String getStoryPoint() {
SprintObject sprint = <API key>.getSprint();
if(sprint == null){
return "0.0 / 0.0";
}
return sprint.<API key>() + " / " + sprint.getTotalStoryPoints();
}
public String getTaskPoint() {
SprintObject sprint = <API key>.getSprint();
if(sprint == null){
return "0.0 / 0.0";
}
return sprint.<API key>() + " / " + sprint.getTotalTaskPoints();
}
public String <API key>() {
SprintObject sprint = <API key>.getSprint();
if(sprint == null){
return "0.0 / 0.0";
}
return (getPointByDate(<API key>.getSprintStartDate())[0]) + " / " + sprint.getLimitedPoint();
}
public String getInitialTaskPoint() {
return (getPointByDate(<API key>.getSprintStartDate())[1]) + " / -";
}
public ArrayList<StoryObject> getStories() {
return mStories;
}
public void setStories(ArrayList<StoryObject> stories) {
mStories = stories;
}
public String getStoryChartLink() {
ProjectObject project = <API key>.getProject();
// workspace/project/_metadata/TaskBoard/ChartLink
String chartPath = "./Workspace/" + project.getName() + "/"
+ IProject.METADATA + "/" + NAME + File.separator + "Sprint"
+ getSprintId() + File.separator + STORY_CHART_FILE;
drawGraph(ScrumEnum.STORY_ISSUE_TYPE, chartPath, "Story Points");
String link = "./Workspace/" + project.getName() + "/"
+ IProject.METADATA + "/" + NAME + "/Sprint"
+ getSprintId() + "/" + STORY_CHART_FILE;
return link;
}
public String getTaskChartLink() {
ProjectObject project = <API key>.getProject();
// workspace/project/_metadata/TaskBoard/Sprint1/ChartLink
String chartPath = "./Workspace/" + project.getName() + "/"
+ IProject.METADATA + "/" + NAME + File.separator + "Sprint"
+ getSprintId() + File.separator + TASK_CHART_FILE;
drawGraph(ScrumEnum.TASK_ISSUE_TYPE, chartPath, "Remaining Hours");
String link = "./Workspace/" + project.getName() + "/"
+ IProject.METADATA + "/" + NAME + "/Sprint"
+ getSprintId() + "/" + TASK_CHART_FILE;
return link;
}
private synchronized void drawGraph(String type, String chartPath, String Y_axis_value) {
ChartUtil chartUtil = new ChartUtil((type
.equals(ScrumEnum.TASK_ISSUE_TYPE) ? "Tasks" : "Stories")
+ " Burndown Chart in Sprint #" + getSprintId(),
<API key>.getSprintStartDate(), new Date(<API key>.getSprintEndDate().getTime() + 24 * 3600 * 1000));
chartUtil.setChartType(ChartUtil.LINECHART);
// TODO:data set
if (type.equals(ScrumEnum.TASK_ISSUE_TYPE)) {
chartUtil.addDataSet("current", <API key>);
chartUtil.addDataSet("ideal", <API key>);
} else {
chartUtil.addDataSet("current", mDateToStoryPoint);
chartUtil.addDataSet("ideal", <API key>);
}
chartUtil.setInterval(1);
chartUtil.setValueAxisLabel(Y_axis_value);
Color[] colors = {Color.RED, Color.GRAY};
chartUtil.setColor(colors);
float[] dashes = {8f};
BasicStroke[] strokes = {
new BasicStroke(1.5f),
new BasicStroke(1.5f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 16f, dashes, 0.f)};
chartUtil.setStrokes(strokes);
chartUtil.createChart(chartPath);
}
public Map<Integer, String> getResolutionMap() {
LinkedHashMap<Integer, String> map = new LinkedHashMap<Integer, String>();
map.put(ITSEnum.FIXED_RESOLUTION, ITSEnum.S_FIXED_RESOLUTION);
map.put(ITSEnum.<API key>, ITSEnum.<API key>);
map.put(ITSEnum.<API key>, ITSEnum.<API key>);
map.put(ITSEnum.<API key>, ITSEnum.<API key>);
map.put(ITSEnum.WONT_FIX_RESOLUTION, ITSEnum.<API key>);
return map;
}
public String getGeneratedTime() {
return DateUtil.format(mGeneratedTime, DateUtil._16DIGIT_DATE_TIME);
}
} |
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 2 -*- */
#include <string.h>
#include "gst-filter.h"
typedef enum {
IP_UNK,
IP_V4,
IP_V6
} IpVersion;
/* gets the value of a numeric IP address section */
static gint
<API key> (const gchar *text, gint start, gint len)
{
gchar *c = (gchar *) &text[start];
gchar *str = g_strndup (c, len);
gint value = g_strtod (str, NULL);
gint i;
for (i = 0; i < len; i++)
{
if ((str[i] < '0') || (str [i] > '9'))
{
g_free (str);
return 256;
}
}
g_free (str);
return value;
}
/* I don't expect this function to be understood, but
* it works with IPv4, IPv6 and IPv4 embedded in IPv6
*/
GstAddressRet
<API key> (const gchar *text)
{
gint i, len, numsep, section_val, nsegments;
gboolean has_double_colon, segment_has_alpha;
IpVersion ver;
gchar c;
if (!text)
return <API key>;
ver = IP_UNK;
len = 0;
numsep = 0;
nsegments = 0;
has_double_colon = FALSE;
segment_has_alpha = FALSE;
for (i = 0; text[i]; i++)
{
c = text[i];
if ((c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'))
{
len++;
if ((ver == IP_V4) ||
((ver == IP_V6) && (i == 1) && (text[0] == ':')) ||
((ver == IP_V6) && (len > 4)))
return GST_ADDRESS_ERROR;
if (ver == IP_UNK)
ver = IP_V6;
segment_has_alpha = TRUE;
}
else if (c >='0' && c <='9')
{
len++;
section_val = <API key> (text, i - len + 1, len);
if (((ver == IP_V4) && ((len > 3) || (section_val > 255))) ||
((ver == IP_V6) && (i == 1) && (text[0] == ':')) ||
((ver == IP_V6) && (len > 4)) ||
((ver == IP_UNK) && (len > 4)))
return GST_ADDRESS_ERROR;
if ((ver == IP_UNK) && ((len == 4) || (section_val > 255)))
ver = IP_V6;
}
else if (c == '.')
{
section_val = <API key> (text, i - len, len);
numsep++;
if ((len == 0) ||
((ver == IP_V4) && (numsep > 3)) ||
((ver == IP_V6) && ((numsep > 6) || (len > 3) || (len == 0) || (section_val > 255))))
return GST_ADDRESS_ERROR;
if ((ver == IP_V6) && (len >= 1) && (len <= 3) && (!segment_has_alpha) && (section_val <= 255))
{
ver = IP_V4;
numsep = 1;
}
if ((ver == IP_UNK) && (section_val <= 255))
ver = IP_V4;
len = 0;
}
else if (c == ':')
{
numsep++;
if ((ver == IP_V4) ||
(numsep >= 8) ||
((len == 0) && (has_double_colon)))
return GST_ADDRESS_ERROR;
if ((numsep > 1) && (len == 0) && (!has_double_colon))
has_double_colon = TRUE;
if (ver == IP_UNK)
ver = IP_V6;
len = 0;
segment_has_alpha = FALSE;
}
else
return GST_ADDRESS_ERROR;
}
if ((ver == IP_V4) && (numsep == 3) && (len > 0))
return GST_ADDRESS_IPV4;
else if ((ver == IP_V6) && (len > 0) && ((numsep == 8) || has_double_colon))
return GST_ADDRESS_IPV6;
if (ver == IP_V4)
return <API key>;
else if (ver == IP_V6)
return <API key>;
return <API key>;
}
static gboolean
check_string (gint filter, const gchar *str)
{
gboolean success = FALSE;
gint ret;
if ((filter == GST_FILTER_IP) ||
(filter == GST_FILTER_IPV4) ||
(filter == GST_FILTER_IPV6))
{
ret = <API key> (str);
if (filter == GST_FILTER_IP)
success = ((ret == <API key>) ||
(ret == <API key>) ||
(ret == GST_ADDRESS_IPV4) ||
(ret == <API key>) ||
(ret == GST_ADDRESS_IPV6));
else if (filter == GST_FILTER_IPV4)
success = ((ret == <API key>) ||
(ret == <API key>) ||
(ret == GST_ADDRESS_IPV4));
else if (filter == GST_FILTER_IPV6)
success = ((ret == <API key>) ||
(ret == <API key>) ||
(ret == GST_ADDRESS_IPV6));
}
else if (filter == GST_FILTER_PHONE)
success = (strspn (str, "0123456789abcdABCD,#*") == strlen (str));
return success;
}
static void
insert_filter (GtkEditable *editable, const gchar *text, gint length, gint *pos, gpointer data)
{
gint filter;
gchar *str, *pre, *post;
filter = GPOINTER_TO_INT (data);
pre = <API key> (editable, 0, *pos);
post = <API key> (editable, *pos, -1);
str = g_strconcat (pre, text, post, NULL);
if (!check_string (filter, str))
<API key> (G_OBJECT (editable), "insert-text");
g_free (pre);
g_free (post);
g_free (str);
}
static void
delete_filter (GtkEditable *editable, gint start, gint end, gpointer data)
{
gint filter;
gchar *str, *pre, *post;
filter = GPOINTER_TO_INT (data);
pre = <API key> (editable, 0, start);
post = <API key> (editable, end, -1);
str = g_strconcat (pre, post, NULL);
if (!check_string (filter, str))
<API key> (G_OBJECT (editable), "delete-text");
g_free (pre);
g_free (post);
g_free (str);
}
void
gst_filter_init (GtkEntry *entry, gint filter)
{
g_signal_connect (G_OBJECT (entry), "insert-text",
G_CALLBACK (insert_filter), GINT_TO_POINTER (filter));
g_signal_connect (G_OBJECT (entry), "delete-text",
G_CALLBACK (delete_filter), GINT_TO_POINTER (filter));
} |
#include <yatesip.h>
#include "util.h"
#include <string.h>
#include <stdlib.h>
using namespace TelEngine;
SIPMessage::SIPMessage(const SIPMessage& original)
: version(original.version), method(original.method), uri(original.uri),
code(original.code), reason(original.reason),
body(0), m_ep(0),
m_valid(original.isValid()), m_answer(original.isAnswer()),
m_outgoing(original.isOutgoing()), m_ack(original.isACK()),
m_cseq(-1)
{
DDebug(DebugAll,"SIPMessage::SIPMessage(&%p) [%p]",
&original,this);
if (original.body)
setBody(original.body->clone());
setParty(original.getParty());
bool via1 = true;
const ObjList* l = &original.header;
for (; l; l = l->next()) {
const MimeHeaderLine* hl = static_cast<MimeHeaderLine*>(l->get());
if (!hl)
continue;
// CSeq must not be copied, a new one will be built by complete()
if (hl->name() &= "CSeq")
continue;
MimeHeaderLine* nl = hl->clone();
// this is a new transaction so let complete() add randomness
if (via1 && (nl->name() &= "Via")) {
via1 = false;
nl->delParam("branch");
}
addHeader(nl);
}
}
SIPMessage::SIPMessage(const char* _method, const char* _uri, const char* _version)
: version(_version), method(_method), uri(_uri), code(0),
body(0), m_ep(0), m_valid(true),
m_answer(false), m_outgoing(true), m_ack(false), m_cseq(-1)
{
DDebug(DebugAll,"SIPMessage::SIPMessage('%s','%s','%s') [%p]",
_method,_uri,_version,this);
}
SIPMessage::SIPMessage(SIPParty* ep, const char* buf, int len)
: code(0), body(0), m_ep(ep), m_valid(false),
m_answer(false), m_outgoing(false), m_ack(false), m_cseq(-1)
{
DDebug(DebugInfo,"SIPMessage::SIPMessage(%p,%d) [%p]\n
buf,len,this,buf);
if (m_ep)
m_ep->ref();
if (!(buf && *buf)) {
Debug(DebugWarn,"Empty message text in [%p]",this);
return;
}
if (len < 0)
len = ::strlen(buf);
m_valid = parse(buf,len);
}
SIPMessage::SIPMessage(const SIPMessage* message, int _code, const char* _reason)
: code(_code), body(0),
m_ep(0), m_valid(false),
m_answer(true), m_outgoing(true), m_ack(false), m_cseq(-1)
{
DDebug(DebugAll,"SIPMessage::SIPMessage(%p,%d,'%s') [%p]",
message,_code,_reason,this);
if (!_reason)
_reason = lookup(code,SIPResponses,"Unknown Reason Code");
reason = _reason;
if (!(message && message->isValid()))
return;
m_ep = message->getParty();
if (m_ep)
m_ep->ref();
version = message->version;
uri = message->uri;
method = message->method;
copyAllHeaders(message,"Via");
copyAllHeaders(message,"Record-Route");
copyHeader(message,"From");
copyHeader(message,"To");
copyHeader(message,"Call-ID");
copyHeader(message,"CSeq");
m_valid = true;
}
SIPMessage::SIPMessage(const SIPMessage* original, const SIPMessage* answer)
: method("ACK"), code(0),
body(0), m_ep(0), m_valid(false),
m_answer(false), m_outgoing(true), m_ack(true), m_cseq(-1)
{
DDebug(DebugAll,"SIPMessage::SIPMessage(%p,%p) [%p]",original,answer,this);
if (!(original && original->isValid()))
return;
m_ep = original->getParty();
if (m_ep)
m_ep->ref();
version = original->version;
uri = original->uri;
copyAllHeaders(original,"Via");
MimeHeaderLine* hl = const_cast<MimeHeaderLine*>(getHeader("Via"));
if (!hl) {
String tmp;
tmp << version << "/" << getParty()->getProtoName();
tmp << " " << getParty()->getLocalAddr() << ":" << getParty()->getLocalPort();
hl = new MimeHeaderLine("Via",tmp);
header.append(hl);
}
if (answer && (answer->code == 200) && (original->method &= "INVITE")) {
String tmp("z9hG4bK");
tmp << (int)::random();
hl->setParam("branch",tmp);
const MimeHeaderLine* co = answer->getHeader("Contact");
if (co) {
uri = *co;
Regexp r("^[^<]*<\\([^>]*\\)>.*$");
if (uri.matches(r))
uri = uri.matchString(1);
}
// new transaction - get/apply routeset unless INVITE already knew it
if (!original->getHeader("Route")) {
ObjList* routeset = answer->getRoutes();
addRoutes(routeset);
TelEngine::destruct(routeset);
}
}
copyAllHeaders(original,"Route");
copyHeader(original,"From");
copyHeader(original,"To");
copyHeader(original,"Call-ID");
String tmp;
tmp << original->getCSeq() << " " << method;
addHeader("CSeq",tmp);
copyHeader(original,"Max-Forwards");
copyAllHeaders(original,"Contact");
copyAllHeaders(original,"Authorization");
copyAllHeaders(original,"Proxy-Authorization");
copyHeader(original,"User-Agent");
m_valid = true;
}
SIPMessage::~SIPMessage()
{
DDebug(DebugAll,"SIPMessage::~SIPMessage() [%p]",this);
m_valid = false;
setParty();
setBody();
}
void SIPMessage::complete(SIPEngine* engine, const char* user, const char* domain, const char* dlgTag)
{
DDebug(engine,DebugAll,"SIPMessage::complete(%p,'%s','%s','%s')%s%s%s [%p]",
engine,user,domain,dlgTag,
isACK() ? " ACK" : "",
isOutgoing() ? " OUT" : "",
isAnswer() ? " ANS" : "",
this);
if (!engine)
return;
// don't complete incoming messages
if (!isOutgoing())
return;
if (!getParty()) {
engine->buildParty(this);
if (!getParty()) {
Debug(engine,DebugGoOn,"Could not complete party-less SIP message [%p]",this);
return;
}
}
// only set the dialog tag on ACK
if (isACK()) {
MimeHeaderLine* hl = const_cast<MimeHeaderLine*>(getHeader("To"));
if (dlgTag && hl && !hl->getParam("tag"))
hl->setParam("tag",dlgTag);
return;
}
if (!domain)
domain = getParty()->getLocalAddr();
MimeHeaderLine* hl = const_cast<MimeHeaderLine*>(getHeader("Via"));
if (!hl) {
String tmp;
tmp << version << "/" << getParty()->getProtoName();
tmp << " " << getParty()->getLocalAddr() << ":" << getParty()->getLocalPort();
hl = new MimeHeaderLine("Via",tmp);
if (!(isAnswer() || isACK()))
hl->setParam("rport");
header.append(hl);
}
if (!(isAnswer() || hl->getParam("branch"))) {
String tmp("z9hG4bK");
tmp << (int)::random();
hl->setParam("branch",tmp);
}
if (isAnswer()) {
hl->setParam("received",getParty()->getPartyAddr());
hl->setParam("rport",String(getParty()->getPartyPort()));
}
if (!isAnswer()) {
hl = const_cast<MimeHeaderLine*>(getHeader("From"));
if (!hl) {
String tmp = "<sip:";
if (user)
tmp << user << "@";
tmp << domain << ">";
hl = new MimeHeaderLine("From",tmp);
header.append(hl);
}
if (!hl->getParam("tag"))
hl->setParam("tag",String((int)::random()));
}
hl = const_cast<MimeHeaderLine*>(getHeader("To"));
if (!(isAnswer() || hl)) {
String tmp;
tmp << "<" << uri << ">";
hl = new MimeHeaderLine("To",tmp);
header.append(hl);
}
if (hl && dlgTag && !hl->getParam("tag"))
hl->setParam("tag",dlgTag);
if (!(isAnswer() || getHeader("Call-ID"))) {
String tmp;
tmp << (int)::random() << "@" << domain;
addHeader("Call-ID",tmp);
}
if (!(isAnswer() || getHeader("CSeq"))) {
String tmp;
m_cseq = engine->getNextCSeq();
tmp << m_cseq << " " << method;
addHeader("CSeq",tmp);
}
const char* info = isAnswer() ? "Server" : "User-Agent";
if (!(getHeader(info) || engine->getUserAgent().null()))
addHeader(info,engine->getUserAgent());
// keep 100 answers short - they are hop to hop anyway
if (isAnswer() && (code == 100))
return;
if (!(isAnswer() || getHeader("Max-Forwards"))) {
String tmp(engine->getMaxForwards());
addHeader("Max-Forwards",tmp);
}
if ((method == "INVITE") && !getHeader("Contact")) {
// automatically add a contact field to (re)INVITE and its answers
String tmp(user);
if (!tmp) {
tmp = uri;
Regexp r(":\\([^:@]*\\)@");
tmp.matches(r);
tmp = tmp.matchString(1);
}
if (tmp) {
tmp = "<sip:" + tmp;
tmp << "@" << getParty()->getLocalAddr() ;
tmp << ":" << getParty()->getLocalPort() << ">";
addHeader("Contact",tmp);
}
}
if (!getHeader("Allow"))
addHeader("Allow",engine->getAllowed());
}
bool SIPMessage::copyHeader(const SIPMessage* message, const char* name, const char* newName)
{
const MimeHeaderLine* hl = message ? message->getHeader(name) : 0;
if (hl) {
header.append(hl->clone(newName));
return true;
}
return false;
}
int SIPMessage::copyAllHeaders(const SIPMessage* message, const char* name, const char* newName)
{
if (!(message && name && *name))
return 0;
int c = 0;
const ObjList* l = &message->header;
for (; l; l = l->next()) {
const MimeHeaderLine* hl = static_cast<const MimeHeaderLine*>(l->get());
if (hl && (hl->name() &= name)) {
++c;
header.append(hl->clone(newName));
}
}
return c;
}
bool SIPMessage::parseFirst(String& line)
{
XDebug(DebugAll,"SIPMessage::parse firstline= '%s'",line.c_str());
if (line.null())
return false;
Regexp r("^\\([Ss][Ii][Pp]/[0-9]\\.[0-9]\\+\\)[[:space:]]\\+\\([0-9][0-9][0-9]\\)[[:space:]]\\+\\(.*\\)$");
if (line.matches(r)) {
// Answer: <version> <code> <reason-phrase>
m_answer = true;
version = line.matchString(1).toUpper();
code = line.matchString(2).toInteger();
reason = line.matchString(3);
DDebug(DebugAll,"got answer version='%s' code=%d reason='%s'",
version.c_str(),code,reason.c_str());
}
else {
r = "^\\([[:alpha:]]\\+\\)[[:space:]]\\+\\([^[:space:]]\\+\\)[[:space:]]\\+\\([Ss][Ii][Pp]/[0-9]\\.[0-9]\\+\\)$";
if (line.matches(r)) {
// Request: <method> <uri> <version>
m_answer = false;
method = line.matchString(1).toUpper();
uri = line.matchString(2);
version = line.matchString(3).toUpper();
DDebug(DebugAll,"got request method='%s' uri='%s' version='%s'",
method.c_str(),uri.c_str(),version.c_str());
if (method == "ACK")
m_ack = true;
}
else {
Debug(DebugAll,"Invalid SIP line '%s'",line.c_str());
return false;
}
}
return true;
}
bool SIPMessage::parse(const char* buf, int len)
{
DDebug(DebugAll,"SIPMessage::parse(%p,%d) [%p]",buf,len,this);
String* line = 0;
while (len > 0) {
line = MimeBody::getUnfoldedLine(buf,len);
if (!line->null())
break;
// Skip any initial empty lines
TelEngine::destruct(line);
}
if (!line)
return false;
if (!parseFirst(*line)) {
line->destruct();
return false;
}
line->destruct();
int clen = -1;
while (len > 0) {
line = MimeBody::getUnfoldedLine(buf,len);
if (line->null()) {
// Found end of headers
line->destruct();
break;
}
int col = line->find(':');
if (col <= 0) {
line->destruct();
return false;
}
String name = line->substr(0,col);
name.trimBlanks();
if (name.null()) {
line->destruct();
return false;
}
name = uncompactForm(name);
*line >> ":";
line->trimBlanks();
XDebug(DebugAll,"SIPMessage::parse header='%s' value='%s'",name.c_str(),line->c_str());
if ((name &= "WWW-Authenticate") ||
(name &= "Proxy-Authenticate") ||
(name &= "Authorization") ||
(name &= "Proxy-Authorization"))
header.append(new MimeAuthLine(name,*line));
else
header.append(new MimeHeaderLine(name,*line));
if ((clen < 0) && (name &= "Content-Length"))
clen = line->toInteger(-1,10);
else if ((m_cseq < 0) && (name &= "CSeq")) {
String seq = *line;
seq >> m_cseq;
if (m_answer) {
seq.trimBlanks().toUpper();
method = seq;
}
}
line->destruct();
}
if (clen >= 0) {
if (clen > len)
Debug("SIPMessage",DebugMild,"Content length is %d but only %d in buffer",clen,len);
else if (clen < len) {
DDebug("SIPMessage",DebugInfo,"Got %d garbage bytes after content",len - clen);
len = clen;
}
}
const MimeHeaderLine* cType = getHeader("Content-Type");
if (cType)
body = MimeBody::build(buf,len,*cType);
// Move extra Content- header lines to body
if (body) {
ListIterator iter(header);
for (GenObject* o = 0; (o = iter.get());) {
MimeHeaderLine* line = static_cast<MimeHeaderLine*>(o);
if (!line->startsWith("Content-",false,true) || (*line &= "Content-Length"))
continue;
// Delete Content-Type and move all other lines to body
bool delobj = (line == cType);
header.remove(o,delobj);
if (!delobj)
body->appendHdr(line);
}
}
DDebug(DebugAll,"SIPMessage::parse %d header lines, body %p",
header.count(),body);
return true;
}
SIPMessage* SIPMessage::fromParsing(SIPParty* ep, const char* buf, int len)
{
SIPMessage* msg = new SIPMessage(ep,buf,len);
if (msg->isValid())
return msg;
DDebug("SIPMessage",DebugInfo,"Invalid message");
msg->destruct();
return 0;
}
const MimeHeaderLine* SIPMessage::getHeader(const char* name) const
{
if (!(name && *name))
return 0;
const ObjList* l = &header;
for (; l; l = l->next()) {
const MimeHeaderLine* t = static_cast<const MimeHeaderLine*>(l->get());
if (t && (t->name() &= name))
return t;
}
return 0;
}
const MimeHeaderLine* SIPMessage::getLastHeader(const char* name) const
{
if (!(name && *name))
return 0;
const MimeHeaderLine* res = 0;
const ObjList* l = &header;
for (; l; l = l->next()) {
const MimeHeaderLine* t = static_cast<const MimeHeaderLine*>(l->get());
if (t && (t->name() &= name))
res = t;
}
return res;
}
void SIPMessage::clearHeaders(const char* name)
{
if (!(name && *name))
return;
ObjList* l = &header;
while (l) {
const MimeHeaderLine* t = static_cast<const MimeHeaderLine*>(l->get());
if (t && (t->name() &= name))
l->remove();
else
l = l->next();
}
}
int SIPMessage::countHeaders(const char* name) const
{
if (!(name && *name))
return 0;
int res = 0;
const ObjList* l = &header;
for (; l; l = l->next()) {
const MimeHeaderLine* t = static_cast<const MimeHeaderLine*>(l->get());
if (t && (t->name() &= name))
++res;
}
return res;
}
const NamedString* SIPMessage::getParam(const char* name, const char* param) const
{
const MimeHeaderLine* hl = getHeader(name);
return hl ? hl->getParam(param) : 0;
}
const String& SIPMessage::getHeaderValue(const char* name) const
{
const MimeHeaderLine* hl = getHeader(name);
return hl ? *static_cast<const String*>(hl) : String::empty();
}
const String& SIPMessage::getParamValue(const char* name, const char* param) const
{
const NamedString* ns = getParam(name,param);
return ns ? *static_cast<const String*>(ns) : String::empty();
}
const String& SIPMessage::getHeaders() const
{
if (isValid() && m_string.null()) {
if (isAnswer())
m_string << version << " " << code << " " << reason << "\r\n";
else
m_string << method << " " << uri << " " << version << "\r\n";
const ObjList* l = &header;
for (; l; l = l->next()) {
MimeHeaderLine* t = static_cast<MimeHeaderLine*>(l->get());
if (t) {
t->buildLine(m_string);
m_string << "\r\n";
}
}
}
return m_string;
}
const DataBlock& SIPMessage::getBuffer() const
{
if (isValid() && m_data.null()) {
m_data.assign((void*)(getHeaders().c_str()),getHeaders().length());
if (body) {
String s;
body->buildHeaders(s);
s << "Content-Length: " << body->getBody().length() << "\r\n\r\n";
m_data += s;
}
else
m_data += "Content-Length: 0\r\n\r\n";
if (body)
m_data += body->getBody();
#ifdef DEBUG
if (debugAt(DebugInfo)) {
String buf((char*)m_data.data(),m_data.length());
Debug(DebugInfo,"SIPMessage::getBuffer() [%p]\n
this,buf.c_str());
}
#endif
}
return m_data;
}
void SIPMessage::setBody(MimeBody* newbody)
{
if (newbody == body)
return;
TelEngine::destruct(body);
body = newbody;
}
void SIPMessage::setParty(SIPParty* ep)
{
if (ep == m_ep)
return;
if (m_ep)
m_ep->deref();
m_ep = ep;
if (m_ep)
m_ep->ref();
}
MimeAuthLine* SIPMessage::buildAuth(const String& username, const String& password,
const String& meth, const String& uri, bool proxy) const
{
const char* hdr = proxy ? "Proxy-Authenticate" : "WWW-Authenticate";
const ObjList* l = &header;
for (; l; l = l->next()) {
const MimeAuthLine* t = YOBJECT(MimeAuthLine,l->get());
if (t && (t->name() &= hdr) && (*t &= "Digest")) {
String nonce(t->getParam("nonce"));
MimeHeaderLine::delQuotes(nonce);
if (nonce.null())
continue;
String realm(t->getParam("realm"));
MimeHeaderLine::delQuotes(realm);
int par = uri.find(';');
String msguri = uri.substr(0,par);
String response;
SIPEngine::buildAuth(username,realm,password,nonce,meth,msguri,response);
MimeAuthLine* auth = new MimeAuthLine(proxy ? "Proxy-Authorization" : "Authorization","Digest");
auth->setParam("username",MimeHeaderLine::quote(username));
auth->setParam("realm",MimeHeaderLine::quote(realm));
auth->setParam("nonce",MimeHeaderLine::quote(nonce));
auth->setParam("uri",MimeHeaderLine::quote(msguri));
auth->setParam("response",MimeHeaderLine::quote(response));
auth->setParam("algorithm","MD5");
// copy opaque data as-is, only if present
const NamedString* opaque = t->getParam("opaque");
if (opaque)
auth->setParam(opaque->name(),*opaque);
return auth;
}
}
return 0;
}
MimeAuthLine* SIPMessage::buildAuth(const SIPMessage& original) const
{
if (original.getAuthUsername().null())
return 0;
return buildAuth(original.getAuthUsername(),original.getAuthPassword(),
original.method,original.uri,(code == 407));
}
ObjList* SIPMessage::getRoutes() const
{
ObjList* list = 0;
const ObjList* l = &header;
for (; l; l = l->next()) {
const MimeHeaderLine* h = YOBJECT(MimeHeaderLine,l->get());
if (h && (h->name() &= "Record-Route")) {
int p = 0;
while (p >= 0) {
MimeHeaderLine* line = 0;
int s = MimeHeaderLine::findSep(*h,',',p);
String tmp;
if (s < 0) {
if (p)
tmp = h->substr(p);
else
line = new MimeHeaderLine(*h,"Route");
p = -1;
}
else {
if (s > p)
tmp = h->substr(p,s-p);
p = s + 1;
}
tmp.trimBlanks();
if (tmp)
line = new MimeHeaderLine("Route",tmp);
if (!line)
continue;
if (!list)
list = new ObjList;
if (isAnswer())
// route set learned from an answer, reverse order
list->insert(line);
else
// route set learned from a request, preserve order
list->append(line);
}
}
}
return list;
}
void SIPMessage::addRoutes(const ObjList* routes)
{
if (isAnswer() || !routes)
return;
MimeHeaderLine* hl = YOBJECT(MimeHeaderLine,routes->get());
if (hl) {
// check if first route is to a RFC 2543 proxy
String tmp = *hl;
Regexp r("<\\([^>]\\+\\)>");
if (tmp.matches(r))
tmp = tmp.matchString(1);
if (tmp.find(";lr") < 0) {
// prepare a new final route
hl = new MimeHeaderLine("Route","<" + uri + ">");
// set the first route as Request-URI and then skip it
uri = tmp;
routes = routes->next();
}
else
hl = 0;
}
// add (remaining) routes
for (; routes; routes = routes->next()) {
const MimeHeaderLine* h = YOBJECT(MimeHeaderLine,routes->get());
if (h)
addHeader(h->clone());
}
// if first route was to a RFC 2543 proxy add the old Request-URI
if (hl)
addHeader(hl);
}
SIPDialog::SIPDialog()
{
}
SIPDialog::SIPDialog(const SIPDialog& original)
: String(original),
localURI(original.localURI), localTag(original.localTag),
remoteURI(original.remoteURI), remoteTag(original.remoteTag)
{
DDebug("SIPDialog",DebugAll,"callid '%s' local '%s;tag=%s' remote '%s;tag=%s' [%p]",
c_str(),localURI.c_str(),localTag.c_str(),remoteURI.c_str(),remoteTag.c_str(),this);
}
SIPDialog& SIPDialog::operator=(const SIPDialog& original)
{
String::operator=(original);
localURI = original.localURI;
localTag = original.localTag;
remoteURI = original.remoteURI;
remoteTag = original.remoteTag;
DDebug("SIPDialog",DebugAll,"callid '%s' local '%s;tag=%s' remote '%s;tag=%s' [%p]",
c_str(),localURI.c_str(),localTag.c_str(),remoteURI.c_str(),remoteTag.c_str(),this);
return *this;
}
SIPDialog& SIPDialog::operator=(const String& callid)
{
String::operator=(callid);
localURI.clear();
localTag.clear();
remoteURI.clear();
remoteTag.clear();
DDebug("SIPDialog",DebugAll,"callid '%s' local '%s;tag=%s' remote '%s;tag=%s' [%p]",
c_str(),localURI.c_str(),localTag.c_str(),remoteURI.c_str(),remoteTag.c_str(),this);
return *this;
}
SIPDialog::SIPDialog(const SIPMessage& message)
: String(message.getHeaderValue("Call-ID"))
{
Regexp r("<\\([^>]\\+\\)>");
bool local = message.isOutgoing() ^ message.isAnswer();
const MimeHeaderLine* hl = message.getHeader(local ? "From" : "To");
localURI = hl;
if (localURI.matches(r))
localURI = localURI.matchString(1);
if (hl)
localTag = hl->getParam("tag");
hl = message.getHeader(local ? "To" : "From");
remoteURI = hl;
if (remoteURI.matches(r))
remoteURI = remoteURI.matchString(1);
if (hl)
remoteTag = hl->getParam("tag");
DDebug("SIPDialog",DebugAll,"callid '%s' local '%s;tag=%s' remote '%s;tag=%s' [%p]",
c_str(),localURI.c_str(),localTag.c_str(),remoteURI.c_str(),remoteTag.c_str(),this);
}
SIPDialog& SIPDialog::operator=(const SIPMessage& message)
{
const char* cid = message.getHeaderValue("Call-ID");
if (cid)
String::operator=(cid);
Regexp r("<\\([^>]\\+\\)>");
bool local = message.isOutgoing() ^ message.isAnswer();
const MimeHeaderLine* hl = message.getHeader(local ? "From" : "To");
localURI = hl;
if (localURI.matches(r))
localURI = localURI.matchString(1);
if (hl)
localTag = hl->getParam("tag");
hl = message.getHeader(local ? "To" : "From");
remoteURI = hl;
if (remoteURI.matches(r))
remoteURI = remoteURI.matchString(1);
if (hl)
remoteTag = hl->getParam("tag");
DDebug("SIPDialog",DebugAll,"callid '%s' local '%s;tag=%s' remote '%s;tag=%s' [%p]",
c_str(),localURI.c_str(),localTag.c_str(),remoteURI.c_str(),remoteTag.c_str(),this);
return *this;
}
bool SIPDialog::operator==(const SIPDialog& other) const
{
return
String::operator==(other) &&
localURI == other.localURI &&
localTag == other.localTag &&
remoteURI == other.remoteURI &&
remoteTag == other.remoteTag;
}
bool SIPDialog::operator!=(const SIPDialog& other) const
{
return !operator==(other);
}
/* vi: set ts=8 sw=4 sts=4 noet: */ |
package wyvern.target.corewyvernIL.support;
import wyvern.target.corewyvernIL.BindingSite;
import wyvern.target.corewyvernIL.expression.Path;
import wyvern.target.corewyvernIL.expression.Variable;
import wyvern.target.corewyvernIL.type.ValueType;
import wyvern.tools.errors.FileLocation;
public class MethodGenContext extends GenContext {
private BindingSite objectSite;
private String methodName;
private FileLocation loc;
public MethodGenContext(String methodName, BindingSite objectSite, GenContext genContext, FileLocation loc) {
super(genContext);
this.objectSite = objectSite;
this.methodName = methodName;
}
@Override
public boolean isPresent(String varName, boolean isValue) {
if (isValue && this.methodName.equals(varName)) {
return true;
} else {
return super.isPresent(varName, isValue);
}
}
@Override
public String toString() {
return "GenContext[" + endToString();
}
@Override
public String endToString() {
return methodName + " = " + objectSite + '.' + methodName + ", " + getNext().endToString();
}
@Override
public ValueType lookupTypeOf(String varName) {
return getNext().lookupTypeOf(varName);
}
@Override
public ValueType lookupTypeOf(Variable v) {
return getNext().lookupTypeOf(v);
}
@Override
public Path <API key>(String typeName) {
return getNext().<API key>(typeName);
}
@Override
public <API key> getCallableExprRec(String varName, GenContext origCtx) {
if (this.methodName.equals(varName)) {
return new <API key>(new Variable(objectSite), varName, origCtx, loc);
} else {
return getNext().getCallableExprRec(varName, origCtx);
}
}
} |
#include <iostream>
#include <QPainter>
#include <QPixmap>
#include <QTextDocument>
#include <libtransmission/transmission.h>
#include <libtransmission/utils.h>
#include "favicon.h"
#include "formatter.h"
#include "torrent.h"
#include "tracker-delegate.h"
#include "tracker-model.h"
namespace
{
const int mySpacing = 6;
const QSize myMargin( 10, 6 );
}
QSize
TrackerDelegate :: margin( const QStyle& style ) const
{
Q_UNUSED( style );
return myMargin;
}
QSize
TrackerDelegate :: sizeHint( const <API key>& option, const TrackerInfo& info ) const
{
Q_UNUSED( option );
QPixmap favicon = info.st.getFavicon( );
const QString text = TrackerDelegate :: getText( info );
QTextDocument textDoc;
textDoc.setHtml( text );
const QSize textSize = textDoc.size().toSize();
return QSize( myMargin.width() + favicon.width() + mySpacing + textSize.width() + myMargin.width(),
myMargin.height() + qMax<int>( favicon.height(), textSize.height() ) + myMargin.height() );
}
QSize
TrackerDelegate :: sizeHint( const <API key> & option,
const QModelIndex & index ) const
{
const TrackerInfo trackerInfo = index.data( TrackerModel::TrackerRole ).value<TrackerInfo>();
return sizeHint( option, trackerInfo );
}
void
TrackerDelegate :: paint( QPainter * painter,
const <API key> & option,
const QModelIndex & index) const
{
const TrackerInfo trackerInfo = index.data( TrackerModel::TrackerRole ).value<TrackerInfo>();
painter->save( );
painter->setClipRect( option.rect );
drawBackground( painter, option, index );
drawTracker( painter, option, trackerInfo );
drawFocus(painter, option, option.rect );
painter->restore( );
}
void
TrackerDelegate :: drawTracker( QPainter * painter,
const <API key> & option,
const TrackerInfo & inf ) const
{
painter->save( );
QPixmap icon = inf.st.getFavicon( );
QRect iconArea( option.rect.x() + myMargin.width(),
option.rect.y() + myMargin.height(),
icon.width(),
icon.height() );
painter->drawPixmap( iconArea.x(), iconArea.y()+4, icon );
const int textWidth = option.rect.width() - myMargin.width()*2 - mySpacing - icon.width();
const int textX = myMargin.width() + icon.width() + mySpacing;
const QString text = getText( inf );
QTextDocument textDoc;
textDoc.setHtml( text );
const QRect textRect( textX, iconArea.y(), textWidth, option.rect.height() - myMargin.height()*2 );
painter->translate( textRect.topLeft( ) );
textDoc.drawContents( painter, textRect.translated( -textRect.topLeft( ) ) );
painter->restore( );
}
void
TrackerDelegate :: setShowMore( bool b )
{
myShowMore = b;
}
namespace
{
QString timeToStringRounded( int seconds )
{
if( seconds > 60 ) seconds -= ( seconds % 60 );
return Formatter::timeToString ( seconds );
}
}
QString
TrackerDelegate :: getText( const TrackerInfo& inf ) const
{
QString key;
QString str;
const time_t now( time( 0 ) );
const QString err_markup_begin = "<span style=\"color:red\">";
const QString err_markup_end = "</span>";
const QString <API key> = "<span style=\"color:#224466\">";
const QString timeout_markup_end = "</span>";
const QString <API key> = "<span style=\"color:#008B00\">";
const QString success_markup_end = "</span>";
// hostname
str += inf.st.isBackup ? "<i>" : "<b>";
char * host = NULL;
int port = 0;
tr_urlParse( inf.st.announce.toUtf8().constData(), -1, NULL, &host, &port, NULL );
if (arg( port ) != NULL && arg( port ) != 0){
str += QString( "%1:%2" ).arg( host ).arg( port );
} else str += QString( "%1" ).arg( host );
tr_free( host );
if( !key.isEmpty( ) ) str += " - " + key;
str += inf.st.isBackup ? "</i>" : "</b>";
// announce & scrape info
if( !inf.st.isBackup )
{
if( inf.st.hasAnnounced && inf.st.announceState != TR_TRACKER_INACTIVE )
{
const QString tstr( timeToStringRounded( now - inf.st.lastAnnounceTime ) );
str += "<br/>\n";
if( inf.st.<API key> )
{
str += tr( "Got a list of %1%2 peers%3 %4 ago" )
.arg( <API key> )
.arg( inf.st.<API key> )
.arg( success_markup_end )
.arg( tstr );
}
else if( inf.st.<API key> )
{
str += tr( "Peer list request %1timed out%2 %3 ago; will retry" )
.arg( <API key> )
.arg( timeout_markup_end )
.arg( tstr );
}
else
{
str += tr( "Got an error %1\"%2\"%3 %4 ago" )
.arg( err_markup_begin )
.arg( inf.st.lastAnnounceResult )
.arg( err_markup_end )
.arg( tstr );
}
}
switch( inf.st.announceState )
{
case TR_TRACKER_INACTIVE:
str += "<br/>\n";
str += tr( "No updates scheduled" );
break;
case TR_TRACKER_WAITING: {
const QString tstr( timeToStringRounded( inf.st.nextAnnounceTime - now ) );
str += "<br/>\n";
str += tr( "Asking for more peers in %1" ).arg( tstr );
break;
}
case TR_TRACKER_QUEUED:
str += "<br/>\n";
str += tr( "Queued to ask for more peers" );
break;
case TR_TRACKER_ACTIVE: {
const QString tstr( timeToStringRounded( now - inf.st.<API key> ) );
str += "<br/>\n";
str += tr( "Asking for more peers now... <small>%1</small>" ).arg( tstr );
break;
}
}
if( myShowMore )
{
if( inf.st.hasScraped )
{
str += "<br/>\n";
const QString tstr( timeToStringRounded( now - inf.st.lastScrapeTime ) );
if( inf.st.lastScrapeSucceeded )
{
str += tr( "Tracker had %1%2 seeders%3 and %4%5 leechers%6 %7 ago" )
.arg( <API key> )
.arg( inf.st.seederCount )
.arg( success_markup_end )
.arg( <API key> )
.arg( inf.st.leecherCount )
.arg( success_markup_end )
.arg( tstr );
}
else
{
str += tr( "Got a scrape error %1\"%2\"%3 %4 ago" )
.arg( err_markup_begin )
.arg( inf.st.lastScrapeResult )
.arg( err_markup_end )
.arg( tstr );
}
}
switch( inf.st.scrapeState )
{
case TR_TRACKER_INACTIVE:
break;
case TR_TRACKER_WAITING: {
str += "<br/>\n";
const QString tstr( timeToStringRounded( inf.st.nextScrapeTime - now ) );
str += tr( "Asking for peer counts in %1" ).arg( tstr );
break;
}
case TR_TRACKER_QUEUED: {
str += "<br/>\n";
str += tr( "Queued to ask for peer counts" );
break;
}
case TR_TRACKER_ACTIVE: {
str += "<br/>\n";
const QString tstr( timeToStringRounded( now - inf.st.lastScrapeStartTime ) );
str += tr( "Asking for peer counts now... <small>%1</small>" ).arg( tstr );
break;
}
}
}
}
return str;
} |
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <pwd.h>
#include <sys/capability.h>
#include "sd-id128.h"
#include "sd-messages.h"
#include "strv.h"
#include "mkdir.h"
#include "path-util.h"
#include "special.h"
#include "sleep-config.h"
#include "fileio-label.h"
#include "label.h"
#include "utf8.h"
#include "unit-name.h"
#include "virt.h"
#include "audit.h"
#include "bus-util.h"
#include "bus-error.h"
#include "logind.h"
#include "bus-errors.h"
#include "udev-util.h"
static int <API key>(
sd_bus *bus,
const char *path,
const char *interface,
const char *property,
sd_bus_message *reply,
void *userdata,
sd_bus_error *error) {
Manager *m = userdata;
assert(bus);
assert(reply);
assert(m);
return <API key>(reply, "b", <API key>(m, NULL) > 0);
}
static int <API key>(
sd_bus *bus,
const char *path,
const char *interface,
const char *property,
sd_bus_message *reply,
void *userdata,
sd_bus_error *error) {
Manager *m = userdata;
dual_timestamp t;
assert(bus);
assert(reply);
assert(m);
<API key>(m, &t);
return <API key>(reply, "t", streq(property, "IdleSinceHint") ? t.realtime : t.monotonic);
}
static int <API key>(
sd_bus *bus,
const char *path,
const char *interface,
const char *property,
sd_bus_message *reply,
void *userdata,
sd_bus_error *error) {
Manager *m = userdata;
InhibitWhat w;
assert(bus);
assert(reply);
assert(m);
w = <API key>(m, streq(property, "BlockInhibited") ? INHIBIT_BLOCK : INHIBIT_DELAY);
return <API key>(reply, "s", <API key>(w));
}
static int <API key>(
sd_bus *bus,
const char *path,
const char *interface,
const char *property,
sd_bus_message *reply,
void *userdata,
sd_bus_error *error) {
Manager *m = userdata;
bool b;
assert(bus);
assert(reply);
assert(m);
if (streq(property, "<API key>"))
b = !!(m->action_what & INHIBIT_SHUTDOWN);
else
b = !!(m->action_what & INHIBIT_SLEEP);
return <API key>(reply, "b", b);
}
static <API key>(<API key>, handle_action, HandleAction);
static int method_get_session(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_free_ char *p = NULL;
Manager *m = userdata;
const char *name;
Session *session;
int r;
assert(bus);
assert(message);
assert(m);
r = sd_bus_message_read(message, "s", &name);
if (r < 0)
return r;
session = hashmap_get(m->sessions, name);
if (!session)
return sd_bus_error_setf(error, <API key>, "No session '%s' known", name);
p = session_bus_path(session);
if (!p)
return -ENOMEM;
return <API key>(message, "o", p);
}
static int <API key>(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_free_ char *p = NULL;
Session *session = NULL;
Manager *m = userdata;
pid_t pid;
int r;
assert(bus);
assert(message);
assert(m);
assert_cc(sizeof(pid_t) == sizeof(uint32_t));
r = sd_bus_message_read(message, "u", &pid);
if (r < 0)
return r;
if (pid == 0) {
<API key> sd_bus_creds *creds = NULL;
r = <API key>(message, SD_BUS_CREDS_PID, &creds);
if (r < 0)
return r;
r = <API key>(creds, &pid);
if (r < 0)
return r;
}
r = <API key>(m, pid, &session);
if (r < 0)
return r;
if (!session)
return sd_bus_error_setf(error, <API key>, "PID "PID_FMT" does not belong to any known session", pid);
p = session_bus_path(session);
if (!p)
return -ENOMEM;
return <API key>(message, "o", p);
}
static int method_get_user(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_free_ char *p = NULL;
Manager *m = userdata;
uint32_t uid;
User *user;
int r;
assert(bus);
assert(message);
assert(m);
r = sd_bus_message_read(message, "u", &uid);
if (r < 0)
return r;
user = hashmap_get(m->users, ULONG_TO_PTR((unsigned long) uid));
if (!user)
return sd_bus_error_setf(error, <API key>, "No user "UID_FMT" known or logged in", uid);
p = user_bus_path(user);
if (!p)
return -ENOMEM;
return <API key>(message, "o", p);
}
static int <API key>(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_free_ char *p = NULL;
Manager *m = userdata;
User *user = NULL;
pid_t pid;
int r;
assert(bus);
assert(message);
assert(m);
assert_cc(sizeof(pid_t) == sizeof(uint32_t));
r = sd_bus_message_read(message, "u", &pid);
if (r < 0)
return r;
if (pid == 0) {
<API key> sd_bus_creds *creds = NULL;
r = <API key>(message, SD_BUS_CREDS_PID, &creds);
if (r < 0)
return r;
r = <API key>(creds, &pid);
if (r < 0)
return r;
}
r = <API key>(m, pid, &user);
if (r < 0)
return r;
if (!user)
return sd_bus_error_setf(error, <API key>, "PID "PID_FMT" does not belong to any known or logged in user", pid);
p = user_bus_path(user);
if (!p)
return -ENOMEM;
return <API key>(message, "o", p);
}
static int method_get_seat(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_free_ char *p = NULL;
Manager *m = userdata;
const char *name;
Seat *seat;
int r;
assert(bus);
assert(message);
assert(m);
r = sd_bus_message_read(message, "s", &name);
if (r < 0)
return r;
seat = hashmap_get(m->seats, name);
if (!seat)
return sd_bus_error_setf(error, <API key>, "No seat '%s' known", name);
p = seat_bus_path(seat);
if (!p)
return -ENOMEM;
return <API key>(message, "o", p);
}
static int <API key>(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
<API key> sd_bus_message *reply = NULL;
Manager *m = userdata;
Session *session;
Iterator i;
int r;
assert(bus);
assert(message);
assert(m);
r = <API key>(message, &reply);
if (r < 0)
return r;
r = <API key>(reply, 'a', "(susso)");
if (r < 0)
return r;
HASHMAP_FOREACH(session, m->sessions, i) {
_cleanup_free_ char *p = NULL;
p = session_bus_path(session);
if (!p)
return -ENOMEM;
r = <API key>(reply, "(susso)",
session->id,
(uint32_t) session->user->uid,
session->user->name,
session->seat ? session->seat->id : "",
p);
if (r < 0)
return r;
}
r = <API key>(reply);
if (r < 0)
return r;
return sd_bus_send(bus, reply, NULL);
}
static int method_list_users(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
<API key> sd_bus_message *reply = NULL;
Manager *m = userdata;
User *user;
Iterator i;
int r;
assert(bus);
assert(message);
assert(m);
r = <API key>(message, &reply);
if (r < 0)
return r;
r = <API key>(reply, 'a', "(uso)");
if (r < 0)
return r;
HASHMAP_FOREACH(user, m->users, i) {
_cleanup_free_ char *p = NULL;
p = user_bus_path(user);
if (!p)
return -ENOMEM;
r = <API key>(reply, "(uso)",
(uint32_t) user->uid,
user->name,
p);
if (r < 0)
return r;
}
r = <API key>(reply);
if (r < 0)
return r;
return sd_bus_send(bus, reply, NULL);
}
static int method_list_seats(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
<API key> sd_bus_message *reply = NULL;
Manager *m = userdata;
Seat *seat;
Iterator i;
int r;
assert(bus);
assert(message);
assert(m);
r = <API key>(message, &reply);
if (r < 0)
return r;
r = <API key>(reply, 'a', "(so)");
if (r < 0)
return r;
HASHMAP_FOREACH(seat, m->seats, i) {
_cleanup_free_ char *p = NULL;
p = seat_bus_path(seat);
if (!p)
return -ENOMEM;
r = <API key>(reply, "(so)", seat->id, p);
if (r < 0)
return r;
}
r = <API key>(reply);
if (r < 0)
return r;
return sd_bus_send(bus, reply, NULL);
}
static int <API key>(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
<API key> sd_bus_message *reply = NULL;
Manager *m = userdata;
Inhibitor *inhibitor;
Iterator i;
int r;
r = <API key>(message, &reply);
if (r < 0)
return r;
r = <API key>(reply, 'a', "(ssssuu)");
if (r < 0)
return r;
HASHMAP_FOREACH(inhibitor, m->inhibitors, i) {
r = <API key>(reply, "(ssssuu)",
strempty(<API key>(inhibitor->what)),
strempty(inhibitor->who),
strempty(inhibitor->why),
strempty(<API key>(inhibitor->mode)),
(uint32_t) inhibitor->uid,
(uint32_t) inhibitor->pid);
if (r < 0)
return r;
}
r = <API key>(reply);
if (r < 0)
return r;
return sd_bus_send(bus, reply, NULL);
}
static int <API key>(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
const char *service, *type, *class, *cseat, *tty, *display, *remote_user, *remote_host, *desktop;
uint32_t uid, leader, audit_id = 0;
_cleanup_free_ char *id = NULL;
Session *session = NULL;
Manager *m = userdata;
User *user = NULL;
Seat *seat = NULL;
int remote;
uint32_t vtnr = 0;
SessionType t;
SessionClass c;
int r;
assert(bus);
assert(message);
assert(m);
r = sd_bus_message_read(message, "uusssssussbss", &uid, &leader, &service, &type, &class, &desktop, &cseat, &vtnr, &tty, &display, &remote, &remote_user, &remote_host);
if (r < 0)
return r;
if (leader == 1)
return sd_bus_error_setf(error, <API key>, "Invalid leader PID");
if (isempty(type))
t = <API key>;
else {
t = <API key>(type);
if (t < 0)
return sd_bus_error_setf(error, <API key>, "Invalid session type %s", type);
}
if (isempty(class))
c = <API key>;
else {
c = <API key>(class);
if (c < 0)
return sd_bus_error_setf(error, <API key>, "Invalid session class %s", class);
}
if (isempty(desktop))
desktop = NULL;
else {
if (!string_is_safe(desktop))
return sd_bus_error_setf(error, <API key>, "Invalid desktop string %s", desktop);
}
if (isempty(cseat))
seat = NULL;
else {
seat = hashmap_get(m->seats, cseat);
if (!seat)
return sd_bus_error_setf(error, <API key>, "No seat '%s' known", cseat);
}
if (tty_is_vc(tty)) {
int v;
if (!seat)
seat = m->seat0;
else if (seat != m->seat0)
return sd_bus_error_setf(error, <API key>, "TTY %s is virtual console but seat %s is not seat0", tty, seat->id);
v = vtnr_from_tty(tty);
if (v <= 0)
return sd_bus_error_setf(error, <API key>, "Cannot determine VT number from virtual console TTY %s", tty);
if (!vtnr)
vtnr = (uint32_t) v;
else if (vtnr != (uint32_t) v)
return sd_bus_error_setf(error, <API key>, "Specified TTY and VT number do not match");
} else if (tty_is_console(tty)) {
if (!seat)
seat = m->seat0;
else if (seat != m->seat0)
return sd_bus_error_setf(error, <API key>, "Console TTY specified but seat is not seat0");
if (vtnr != 0)
return sd_bus_error_setf(error, <API key>, "Console TTY specified but VT number is not 0");
}
if (seat) {
if (seat_has_vts(seat)) {
if (!vtnr || vtnr > 63)
return sd_bus_error_setf(error, <API key>, "VT number out of range");
} else {
if (vtnr != 0)
return sd_bus_error_setf(error, <API key>, "Seat has no VTs but VT number not 0");
}
}
r = <API key>(message, 'a', "(sv)");
if (r < 0)
return r;
if (t == <API key>) {
if (!isempty(display))
t = SESSION_X11;
else if (!isempty(tty))
t = SESSION_TTY;
else
t = SESSION_UNSPECIFIED;
}
if (c == <API key>) {
if (t == SESSION_UNSPECIFIED)
c = SESSION_BACKGROUND;
else
c = SESSION_USER;
}
if (leader <= 0) {
<API key> sd_bus_creds *creds = NULL;
r = <API key>(message, SD_BUS_CREDS_PID, &creds);
if (r < 0)
return r;
assert_cc(sizeof(uint32_t) == sizeof(pid_t));
r = <API key>(creds, (pid_t*) &leader);
if (r < 0)
return r;
}
<API key>(m, leader, &session);
if (session) {
_cleanup_free_ char *path = NULL;
_cleanup_close_ int fifo_fd = -1;
/* Session already exists, client is probably
* something like "su" which changes uid but is still
* the same session */
fifo_fd = session_create_fifo(session);
if (fifo_fd < 0)
return fifo_fd;
path = session_bus_path(session);
if (!path)
return -ENOMEM;
log_debug("Sending reply about an existing session: "
"id=%s object_path=%s uid=%u runtime_path=%s "
"session_fd=%d seat=%s vtnr=%u",
session->id,
path,
(uint32_t) session->user->uid,
session->user->runtime_path,
fifo_fd,
session->seat ? session->seat->id : "",
(uint32_t) session->vtnr);
return <API key>(
message, "soshusub",
session->id,
path,
session->user->runtime_path,
fifo_fd,
(uint32_t) session->user->uid,
session->seat ? session->seat->id : "",
(uint32_t) session->vtnr,
true);
}
<API key>(leader, &audit_id);
if (audit_id > 0) {
/* Keep our session IDs and the audit session IDs in sync */
if (asprintf(&id, "%"PRIu32, audit_id) < 0)
return -ENOMEM;
/* Wut? There's already a session by this name and we
* didn't find it above? Weird, then let's not trust
* the audit data and let's better register a new
* ID */
if (hashmap_get(m->sessions, id)) {
log_warning("Existing logind session ID %s used by new audit session, ignoring", id);
audit_id = 0;
free(id);
id = NULL;
}
}
if (!id) {
do {
free(id);
id = NULL;
if (asprintf(&id, "c%lu", ++m->session_counter) < 0)
return -ENOMEM;
} while (hashmap_get(m->sessions, id));
}
r = <API key>(m, uid, &user);
if (r < 0)
goto fail;
r = manager_add_session(m, id, &session);
if (r < 0)
goto fail;
session_set_user(session, user);
session->leader = leader;
session->audit_id = audit_id;
session->type = t;
session->class = c;
session->remote = remote;
session->vtnr = vtnr;
if (!isempty(tty)) {
session->tty = strdup(tty);
if (!session->tty) {
r = -ENOMEM;
goto fail;
}
}
if (!isempty(display)) {
session->display = strdup(display);
if (!session->display) {
r = -ENOMEM;
goto fail;
}
}
if (!isempty(remote_user)) {
session->remote_user = strdup(remote_user);
if (!session->remote_user) {
r = -ENOMEM;
goto fail;
}
}
if (!isempty(remote_host)) {
session->remote_host = strdup(remote_host);
if (!session->remote_host) {
r = -ENOMEM;
goto fail;
}
}
if (!isempty(service)) {
session->service = strdup(service);
if (!session->service) {
r = -ENOMEM;
goto fail;
}
}
if (!isempty(desktop)) {
session->desktop = strdup(desktop);
if (!session->desktop) {
r = -ENOMEM;
goto fail;
}
}
if (seat) {
r = seat_attach_session(seat, session);
if (r < 0)
goto fail;
}
r = session_start(session);
if (r < 0)
goto fail;
session->create_message = sd_bus_message_ref(message);
/* Now, let's wait until the slice unit and stuff got
* created. We send the reply back from
* <API key>().*/
return 1;
fail:
if (session)
<API key>(session);
if (user)
<API key>(user);
return r;
}
static int <API key>(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
Manager *m = userdata;
Session *session;
const char *name;
int r;
assert(bus);
assert(message);
assert(m);
r = sd_bus_message_read(message, "s", &name);
if (r < 0)
return r;
session = hashmap_get(m->sessions, name);
if (!session)
return sd_bus_error_setf(error, <API key>, "No session '%s' known", name);
session_release(session);
return <API key>(message, NULL);
}
static int <API key>(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
Manager *m = userdata;
Session *session;
const char *name;
int r;
assert(bus);
assert(message);
assert(m);
r = sd_bus_message_read(message, "s", &name);
if (r < 0)
return r;
session = hashmap_get(m->sessions, name);
if (!session)
return sd_bus_error_setf(error, <API key>, "No session '%s' known", name);
r = session_activate(session);
if (r < 0)
return r;
return <API key>(message, NULL);
}
static int <API key>(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
const char *session_name, *seat_name;
Manager *m = userdata;
Session *session;
Seat *seat;
int r;
assert(bus);
assert(message);
assert(m);
/* Same as ActivateSession() but refuses to work if
* the seat doesn't match */
r = sd_bus_message_read(message, "ss", &session_name, &seat_name);
if (r < 0)
return r;
session = hashmap_get(m->sessions, session_name);
if (!session)
return sd_bus_error_setf(error, <API key>, "No session '%s' known", session_name);
seat = hashmap_get(m->seats, seat_name);
if (!seat)
return sd_bus_error_setf(error, <API key>, "No seat '%s' known", seat_name);
if (session->seat != seat)
return sd_bus_error_setf(error, <API key>, "Session %s not on seat %s", session_name, seat_name);
r = session_activate(session);
if (r < 0)
return r;
return <API key>(message, NULL);
}
static int method_lock_session(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
Manager *m = userdata;
Session *session;
const char *name;
int r;
assert(bus);
assert(message);
assert(m);
r = sd_bus_message_read(message, "s", &name);
if (r < 0)
return r;
session = hashmap_get(m->sessions, name);
if (!session)
return sd_bus_error_setf(error, <API key>, "No session '%s' known", name);
r = session_send_lock(session, streq(<API key>(message), "LockSession"));
if (r < 0)
return r;
return <API key>(message, NULL);
}
static int <API key>(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
Manager *m = userdata;
int r;
assert(bus);
assert(message);
assert(m);
r = <API key>(m, streq(<API key>(message), "LockSessions"));
if (r < 0)
return r;
return <API key>(message, NULL);
}
static int method_kill_session(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
const char *name, *swho;
Manager *m = userdata;
Session *session;
int32_t signo;
KillWho who;
int r;
assert(bus);
assert(message);
assert(m);
r = sd_bus_message_read(message, "ssi", &name, &swho, &signo);
if (r < 0)
return r;
if (isempty(swho))
who = KILL_ALL;
else {
who = <API key>(swho);
if (who < 0)
return sd_bus_error_setf(error, <API key>, "Invalid kill parameter '%s'", swho);
}
if (signo <= 0 || signo >= _NSIG)
return sd_bus_error_setf(error, <API key>, "Invalid signal %i", signo);
session = hashmap_get(m->sessions, name);
if (!session)
return sd_bus_error_setf(error, <API key>, "No session '%s' known", name);
r = session_kill(session, who, signo);
if (r < 0)
return r;
return <API key>(message, NULL);
}
static int method_kill_user(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
Manager *m = userdata;
uint32_t uid;
int32_t signo;
User *user;
int r;
assert(bus);
assert(message);
assert(m);
r = sd_bus_message_read(message, "ui", &uid, &signo);
if (r < 0)
return r;
if (signo <= 0 || signo >= _NSIG)
return sd_bus_error_setf(error, <API key>, "Invalid signal %i", signo);
user = hashmap_get(m->users, ULONG_TO_PTR((unsigned long) uid));
if (!user)
return sd_bus_error_setf(error, <API key>, "No user "UID_FMT" known or logged in", uid);
r = user_kill(user, signo);
if (r < 0)
return r;
return <API key>(message, NULL);
}
static int <API key>(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
Manager *m = userdata;
const char *name;
Session *session;
int r;
assert(bus);
assert(message);
assert(m);
r = sd_bus_message_read(message, "s", &name);
if (r < 0)
return r;
session = hashmap_get(m->sessions, name);
if (!session)
return sd_bus_error_setf(error, <API key>, "No session '%s' known", name);
r = session_stop(session, true);
if (r < 0)
return r;
return <API key>(message, NULL);
}
static int <API key>(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
Manager *m = userdata;
uint32_t uid;
User *user;
int r;
assert(bus);
assert(message);
assert(m);
r = sd_bus_message_read(message, "u", &uid);
if (r < 0)
return r;
user = hashmap_get(m->users, ULONG_TO_PTR((unsigned long) uid));
if (!user)
return sd_bus_error_setf(error, <API key>, "No user "UID_FMT" known or logged in", uid);
r = user_stop(user, true);
if (r < 0)
return r;
return <API key>(message, NULL);
}
static int <API key>(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
Manager *m = userdata;
const char *name;
Seat *seat;
int r;
assert(bus);
assert(message);
assert(m);
r = sd_bus_message_read(message, "s", &name);
if (r < 0)
return r;
seat = hashmap_get(m->seats, name);
if (!seat)
return sd_bus_error_setf(error, <API key>, "No seat '%s' known", name);
r = seat_stop_sessions(seat, true);
if (r < 0)
return r;
return <API key>(message, NULL);
}
static int <API key>(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_free_ char *cc = NULL;
Manager *m = userdata;
int b, r;
struct passwd *pw;
const char *path;
uint32_t uid;
int interactive;
assert(bus);
assert(message);
assert(m);
r = sd_bus_message_read(message, "ubb", &uid, &b, &interactive);
if (r < 0)
return r;
errno = 0;
pw = getpwuid(uid);
if (!pw)
return errno ? -errno : -ENOENT;
r = <API key>(
message,
CAP_SYS_ADMIN,
"org.freedesktop.login1.set-user-linger",
interactive,
&m->polkit_registry,
error);
if (r < 0)
return r;
if (r == 0)
return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */
mkdir_p_label("/var/lib/systemd", 0755);
r = mkdir_safe_label("/var/lib/systemd/linger", 0755, 0, 0);
if (r < 0)
return r;
cc = cescape(pw->pw_name);
if (!cc)
return -ENOMEM;
path = strappenda("/var/lib/systemd/linger/", cc);
if (b) {
User *u;
r = touch(path);
if (r < 0)
return r;
if (<API key>(m, uid, &u) >= 0)
user_start(u);
} else {
User *u;
r = unlink(path);
if (r < 0 && errno != ENOENT)
return -errno;
u = hashmap_get(m->users, ULONG_TO_PTR((unsigned long) uid));
if (u)
<API key>(u);
}
return <API key>(message, NULL);
}
static int trigger_device(Manager *m, struct udev_device *d) {
<API key> struct udev_enumerate *e = NULL;
struct udev_list_entry *first, *item;
int r;
assert(m);
e = udev_enumerate_new(m->udev);
if (!e)
return -ENOMEM;
if (d) {
r = <API key>(e, d);
if (r < 0)
return r;
}
r = <API key>(e);
if (r < 0)
return r;
first = <API key>(e);
<API key>(item, first) {
_cleanup_free_ char *t = NULL;
const char *p;
p = <API key>(item);
t = strappend(p, "/uevent");
if (!t)
return -ENOMEM;
write_string_file(t, "change");
}
return 0;
}
static int attach_device(Manager *m, const char *seat, const char *sysfs) {
<API key> struct udev_device *d = NULL;
_cleanup_free_ char *rule = NULL, *file = NULL;
const char *id_for_seat;
int r;
assert(m);
assert(seat);
assert(sysfs);
d = <API key>(m->udev, sysfs);
if (!d)
return -ENODEV;
if (!udev_device_has_tag(d, "seat"))
return -ENODEV;
id_for_seat = <API key>(d, "ID_FOR_SEAT");
if (!id_for_seat)
return -ENODEV;
if (asprintf(&file, "/etc/udev/rules.d/72-seat-%s.rules", id_for_seat) < 0)
return -ENOMEM;
if (asprintf(&rule, "TAG==\"seat\", ENV{ID_FOR_SEAT}==\"%s\", ENV{ID_SEAT}=\"%s\"", id_for_seat, seat) < 0)
return -ENOMEM;
mkdir_p_label("/etc/udev/rules.d", 0755);
mac_selinux_init("/etc");
r = <API key>(file, rule);
if (r < 0)
return r;
return trigger_device(m, d);
}
static int flush_devices(Manager *m) {
_cleanup_closedir_ DIR *d;
assert(m);
d = opendir("/etc/udev/rules.d");
if (!d) {
if (errno != ENOENT)
log_warning_errno(errno, "Failed to open /etc/udev/rules.d: %m");
} else {
struct dirent *de;
while ((de = readdir(d))) {
if (!dirent_is_file(de))
continue;
if (!startswith(de->d_name, "72-seat-"))
continue;
if (!endswith(de->d_name, ".rules"))
continue;
if (unlinkat(dirfd(d), de->d_name, 0) < 0)
log_warning_errno(errno, "Failed to unlink %s: %m", de->d_name);
}
}
return trigger_device(m, NULL);
}
static int <API key>(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
const char *sysfs, *seat;
Manager *m = userdata;
int interactive, r;
assert(bus);
assert(message);
assert(m);
r = sd_bus_message_read(message, "ssb", &seat, &sysfs, &interactive);
if (r < 0)
return r;
if (!path_startswith(sysfs, "/sys"))
return sd_bus_error_setf(error, <API key>, "Path %s is not in /sys", sysfs);
if (!seat_name_is_valid(seat))
return sd_bus_error_setf(error, <API key>, "Seat %s is not valid", seat);
r = <API key>(
message,
CAP_SYS_ADMIN,
"org.freedesktop.login1.attach-device",
interactive,
&m->polkit_registry,
error);
if (r < 0)
return r;
if (r == 0)
return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */
r = attach_device(m, seat, sysfs);
if (r < 0)
return r;
return <API key>(message, NULL);
}
static int <API key>(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
Manager *m = userdata;
int interactive, r;
assert(bus);
assert(message);
assert(m);
r = sd_bus_message_read(message, "b", &interactive);
if (r < 0)
return r;
r = <API key>(
message,
CAP_SYS_ADMIN,
"org.freedesktop.login1.flush-devices",
interactive,
&m->polkit_registry,
error);
if (r < 0)
return r;
if (r == 0)
return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */
r = flush_devices(m);
if (r < 0)
return r;
return <API key>(message, NULL);
}
static int <API key>(
Manager *m,
uid_t uid) {
Session *session;
Iterator i;
assert(m);
/* Check for other users' sessions. Greeter sessions do not
* count, and non-login sessions do not count either. */
HASHMAP_FOREACH(session, m->sessions, i)
if (session->class == SESSION_USER &&
session->user->uid != uid)
return true;
return false;
}
static int <API key>(
Manager *m,
InhibitWhat w,
const char *unit_name) {
const char *p, *q;
assert(m);
assert(unit_name);
if (w != INHIBIT_SHUTDOWN)
return 0;
if (streq(unit_name, <API key>)) {
p = "MESSAGE=System is powering down.";
q = "SHUTDOWN=power-off";
} else if (streq(unit_name, SPECIAL_HALT_TARGET)) {
p = "MESSAGE=System is halting.";
q = "SHUTDOWN=halt";
} else if (streq(unit_name, <API key>)) {
p = "MESSAGE=System is rebooting.";
q = "SHUTDOWN=reboot";
} else if (streq(unit_name, <API key>)) {
p = "MESSAGE=System is rebooting with kexec.";
q = "SHUTDOWN=kexec";
} else {
p = "MESSAGE=System is shutting down.";
q = NULL;
}
return log_struct(LOG_NOTICE,
LOG_MESSAGE_ID(SD_MESSAGE_SHUTDOWN),
p,
q,
NULL);
}
static int <API key>(sd_event_source *e, uint64_t usec, void *userdata) {
Manager *m = userdata;
assert(e);
assert(m);
m-><API key> = <API key>(m-><API key>);
return 0;
}
int <API key>(Manager *m, usec_t until) {
int r;
assert(m);
if (until <= now(CLOCK_MONOTONIC))
return 0;
/* We want to ignore the lid switch for a while after each
* suspend, and after boot-up. Hence let's install a timer for
* this. As long as the event source exists we ignore the lid
* switch. */
if (m-><API key>) {
usec_t u;
r = <API key>(m-><API key>, &u);
if (r < 0)
return r;
if (until <= u)
return 0;
r = <API key>(m-><API key>, until);
} else
r = sd_event_add_time(
m->event,
&m-><API key>,
CLOCK_MONOTONIC,
until, 0,
<API key>, m);
return r;
}
static int <API key>(
Manager *m,
InhibitWhat w,
const char *unit_name,
sd_bus_error *error) {
<API key> sd_bus_message *reply = NULL;
const char *p;
char *c;
int r;
assert(m);
assert(w >= 0);
assert(w < _INHIBIT_WHAT_MAX);
assert(unit_name);
<API key>(m, w, unit_name);
r = sd_bus_call_method(
m->bus,
"org.freedesktop.systemd1",
"/org/freedesktop/systemd1",
"org.freedesktop.systemd1.Manager",
"StartUnit",
error,
&reply,
"ss", unit_name, "<API key>");
if (r < 0)
return r;
r = sd_bus_message_read(reply, "o", &p);
if (r < 0)
return r;
c = strdup(p);
if (!c)
return -ENOMEM;
m->action_unit = unit_name;
free(m->action_job);
m->action_job = c;
m->action_what = w;
/* Make sure the lid switch is ignored for a while */
<API key>(m, now(CLOCK_MONOTONIC) + <API key>);
return 0;
}
static int <API key>(
Manager *m,
InhibitWhat w,
const char *unit_name) {
assert(m);
assert(w >= 0);
assert(w < _INHIBIT_WHAT_MAX);
assert(unit_name);
m->action_timestamp = now(CLOCK_MONOTONIC);
m->action_unit = unit_name;
m->action_what = w;
return 0;
}
static int send_prepare_for(Manager *m, InhibitWhat w, bool _active) {
static const char * const signal_name[_INHIBIT_WHAT_MAX] = {
[INHIBIT_SHUTDOWN] = "PrepareForShutdown",
[INHIBIT_SLEEP] = "PrepareForSleep"
};
int active = _active;
assert(m);
assert(w >= 0);
assert(w < _INHIBIT_WHAT_MAX);
assert(signal_name[w]);
return sd_bus_emit_signal(m->bus,
"/org/freedesktop/login1",
"org.freedesktop.login1.Manager",
signal_name[w],
"b",
active);
}
int <API key>(
Manager *m,
const char *unit_name,
InhibitWhat w,
sd_bus_error *error) {
bool delayed;
int r;
assert(m);
assert(unit_name);
assert(w >= 0);
assert(w <= _INHIBIT_WHAT_MAX);
assert(!m->action_job);
/* Tell everybody to prepare for shutdown/sleep */
send_prepare_for(m, w, true);
delayed =
m->inhibit_delay_max > 0 &&
<API key>(m, w, INHIBIT_DELAY, NULL, false, false, 0, NULL);
if (delayed)
/* Shutdown is delayed, keep in mind what we
* want to do, and start a timeout */
r = <API key>(m, w, unit_name);
else
/* Shutdown is not delayed, execute it
* immediately */
r = <API key>(m, w, unit_name, error);
return r;
}
static int <API key>(
Manager *m,
sd_bus_message *message,
const char *unit_name,
InhibitWhat w,
const char *action,
const char *<API key>,
const char *<API key>,
const char *sleep_verb,
<API key> method,
sd_bus_error *error) {
<API key> sd_bus_creds *creds = NULL;
bool multiple_sessions, blocked;
int interactive, r;
uid_t uid;
assert(m);
assert(message);
assert(unit_name);
assert(w >= 0);
assert(w <= _INHIBIT_WHAT_MAX);
assert(action);
assert(<API key>);
assert(<API key>);
assert(method);
r = sd_bus_message_read(message, "b", &interactive);
if (r < 0)
return r;
/* Don't allow multiple jobs being executed at the same time */
if (m->action_what)
return sd_bus_error_setf(error, <API key>, "There's already a shutdown or sleep operation in progress");
if (sleep_verb) {
r = can_sleep(sleep_verb);
if (r < 0)
return r;
if (r == 0)
return sd_bus_error_setf(error, <API key>, "Sleep verb not supported");
}
r = <API key>(message, SD_BUS_CREDS_UID, &creds);
if (r < 0)
return r;
r = <API key>(creds, &uid);
if (r < 0)
return r;
r = <API key>(m, uid);
if (r < 0)
return r;
multiple_sessions = r > 0;
blocked = <API key>(m, w, INHIBIT_BLOCK, NULL, false, true, uid, NULL);
if (multiple_sessions) {
r = <API key>(message, CAP_SYS_BOOT, <API key>, interactive, &m->polkit_registry, error);
if (r < 0)
return r;
if (r == 0)
return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */
}
if (blocked) {
r = <API key>(message, CAP_SYS_BOOT, <API key>, interactive, &m->polkit_registry, error);
if (r < 0)
return r;
if (r == 0)
return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */
}
if (!multiple_sessions && !blocked) {
r = <API key>(message, CAP_SYS_BOOT, action, interactive, &m->polkit_registry, error);
if (r < 0)
return r;
if (r == 0)
return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */
}
r = <API key>(m, unit_name, w, error);
if (r < 0)
return r;
return <API key>(message, NULL);
}
static int method_poweroff(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
Manager *m = userdata;
return <API key>(
m, message,
<API key>,
INHIBIT_SHUTDOWN,
"org.freedesktop.login1.power-off",
"org.freedesktop.login1.<API key>",
"org.freedesktop.login1.<API key>",
NULL,
method_poweroff,
error);
}
static int method_reboot(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
Manager *m = userdata;
return <API key>(
m, message,
<API key>,
INHIBIT_SHUTDOWN,
"org.freedesktop.login1.reboot",
"org.freedesktop.login1.<API key>",
"org.freedesktop.login1.<API key>",
NULL,
method_reboot,
error);
}
static int method_suspend(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
Manager *m = userdata;
return <API key>(
m, message,
<API key>,
INHIBIT_SLEEP,
"org.freedesktop.login1.suspend",
"org.freedesktop.login1.<API key>",
"org.freedesktop.login1.<API key>",
"suspend",
method_suspend,
error);
}
static int method_hibernate(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
Manager *m = userdata;
return <API key>(
m, message,
<API key>,
INHIBIT_SLEEP,
"org.freedesktop.login1.hibernate",
"org.freedesktop.login1.<API key>",
"org.freedesktop.login1.<API key>",
"hibernate",
method_hibernate,
error);
}
static int method_hybrid_sleep(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
Manager *m = userdata;
return <API key>(
m, message,
<API key>,
INHIBIT_SLEEP,
"org.freedesktop.login1.hibernate",
"org.freedesktop.login1.<API key>",
"org.freedesktop.login1.<API key>",
"hybrid-sleep",
method_hybrid_sleep,
error);
}
static int <API key>(
Manager *m,
sd_bus_message *message,
InhibitWhat w,
const char *action,
const char *<API key>,
const char *<API key>,
const char *sleep_verb,
sd_bus_error *error) {
<API key> sd_bus_creds *creds = NULL;
bool multiple_sessions, challenge, blocked;
const char *result = NULL;
uid_t uid;
int r;
assert(m);
assert(message);
assert(w >= 0);
assert(w <= _INHIBIT_WHAT_MAX);
assert(action);
assert(<API key>);
assert(<API key>);
if (sleep_verb) {
r = can_sleep(sleep_verb);
if (r < 0)
return r;
if (r == 0)
return <API key>(message, "s", "na");
}
r = <API key>(message, SD_BUS_CREDS_UID, &creds);
if (r < 0)
return r;
r = <API key>(creds, &uid);
if (r < 0)
return r;
r = <API key>(m, uid);
if (r < 0)
return r;
multiple_sessions = r > 0;
blocked = <API key>(m, w, INHIBIT_BLOCK, NULL, false, true, uid, NULL);
if (multiple_sessions) {
r = bus_verify_polkit(message, CAP_SYS_BOOT, <API key>, false, &challenge, error);
if (r < 0)
return r;
if (r > 0)
result = "yes";
else if (challenge)
result = "challenge";
else
result = "no";
}
if (blocked) {
r = bus_verify_polkit(message, CAP_SYS_BOOT, <API key>, false, &challenge, error);
if (r < 0)
return r;
if (r > 0 && !result)
result = "yes";
else if (challenge && (!result || streq(result, "yes")))
result = "challenge";
else
result = "no";
}
if (!multiple_sessions && !blocked) {
/* If neither inhibit nor multiple sessions
* apply then just check the normal policy */
r = bus_verify_polkit(message, CAP_SYS_BOOT, action, false, &challenge, error);
if (r < 0)
return r;
if (r > 0)
result = "yes";
else if (challenge)
result = "challenge";
else
result = "no";
}
return <API key>(message, "s", result);
}
static int method_can_poweroff(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
Manager *m = userdata;
return <API key>(
m, message,
INHIBIT_SHUTDOWN,
"org.freedesktop.login1.power-off",
"org.freedesktop.login1.<API key>",
"org.freedesktop.login1.<API key>",
NULL,
error);
}
static int method_can_reboot(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
Manager *m = userdata;
return <API key>(
m, message,
INHIBIT_SHUTDOWN,
"org.freedesktop.login1.reboot",
"org.freedesktop.login1.<API key>",
"org.freedesktop.login1.<API key>",
NULL,
error);
}
static int method_can_suspend(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
Manager *m = userdata;
return <API key>(
m, message,
INHIBIT_SLEEP,
"org.freedesktop.login1.suspend",
"org.freedesktop.login1.<API key>",
"org.freedesktop.login1.<API key>",
"suspend",
error);
}
static int <API key>(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
Manager *m = userdata;
return <API key>(
m, message,
INHIBIT_SLEEP,
"org.freedesktop.login1.hibernate",
"org.freedesktop.login1.<API key>",
"org.freedesktop.login1.<API key>",
"hibernate",
error);
}
static int <API key>(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
Manager *m = userdata;
return <API key>(
m, message,
INHIBIT_SLEEP,
"org.freedesktop.login1.hibernate",
"org.freedesktop.login1.<API key>",
"org.freedesktop.login1.<API key>",
"hybrid-sleep",
error);
}
static int method_inhibit(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
<API key> sd_bus_creds *creds = NULL;
const char *who, *why, *what, *mode;
_cleanup_free_ char *id = NULL;
_cleanup_close_ int fifo_fd = -1;
Manager *m = userdata;
Inhibitor *i = NULL;
InhibitMode mm;
InhibitWhat w;
pid_t pid;
uid_t uid;
int r;
assert(bus);
assert(message);
assert(m);
r = sd_bus_message_read(message, "ssss", &what, &who, &why, &mode);
if (r < 0)
return r;
w = <API key>(what);
if (w <= 0)
return sd_bus_error_setf(error, <API key>, "Invalid what specification %s", what);
mm = <API key>(mode);
if (mm < 0)
return sd_bus_error_setf(error, <API key>, "Invalid mode specification %s", mode);
/* Delay is only supported for shutdown/sleep */
if (mm == INHIBIT_DELAY && (w & ~(INHIBIT_SHUTDOWN|INHIBIT_SLEEP)))
return sd_bus_error_setf(error, <API key>, "Delay inhibitors only supported for shutdown and sleep");
/* Don't allow taking delay locks while we are already
* executing the operation. We shouldn't create the impression
* that the lock was successful if the machine is about to go
* down/suspend any moment. */
if (m->action_what & w)
return sd_bus_error_setf(error, <API key>, "The operation inhibition has been requested for is already running");
r = <API key>(message, CAP_SYS_BOOT,
w == INHIBIT_SHUTDOWN ? (mm == INHIBIT_BLOCK ? "org.freedesktop.login1.<API key>" : "org.freedesktop.login1.<API key>") :
w == INHIBIT_SLEEP ? (mm == INHIBIT_BLOCK ? "org.freedesktop.login1.inhibit-block-sleep" : "org.freedesktop.login1.inhibit-delay-sleep") :
w == INHIBIT_IDLE ? "org.freedesktop.login1.inhibit-block-idle" :
w == <API key> ? "org.freedesktop.login1.<API key>" :
w == <API key> ? "org.freedesktop.login1.<API key>" :
w == <API key> ? "org.freedesktop.login1.<API key>" :
"org.freedesktop.login1.<API key>",
false, &m->polkit_registry, error);
if (r < 0)
return r;
if (r == 0)
return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */
r = <API key>(message, SD_BUS_CREDS_UID|SD_BUS_CREDS_PID, &creds);
if (r < 0)
return r;
r = <API key>(creds, &uid);
if (r < 0)
return r;
r = <API key>(creds, &pid);
if (r < 0)
return r;
do {
free(id);
id = NULL;
if (asprintf(&id, "%lu", ++m->inhibit_counter) < 0)
return -ENOMEM;
} while (hashmap_get(m->inhibitors, id));
r = <API key>(m, id, &i);
if (r < 0)
return r;
i->what = w;
i->mode = mm;
i->pid = pid;
i->uid = uid;
i->why = strdup(why);
i->who = strdup(who);
if (!i->why || !i->who) {
r = -ENOMEM;
goto fail;
}
fifo_fd = <API key>(i);
if (fifo_fd < 0) {
r = fifo_fd;
goto fail;
}
inhibitor_start(i);
return <API key>(message, "h", fifo_fd);
fail:
if (i)
inhibitor_free(i);
return r;
}
const sd_bus_vtable manager_vtable[] = {
SD_BUS_VTABLE_START(0),
SD_BUS_PROPERTY("NAutoVTs", "u", NULL, offsetof(Manager, n_autovts), <API key>),
SD_BUS_PROPERTY("KillOnlyUsers", "as", NULL, offsetof(Manager, kill_only_users), <API key>),
SD_BUS_PROPERTY("KillExcludeUsers", "as", NULL, offsetof(Manager, kill_exclude_users), <API key>),
SD_BUS_PROPERTY("KillUserProcesses", "b", NULL, offsetof(Manager, kill_user_processes), <API key>),
SD_BUS_PROPERTY("IdleHint", "b", <API key>, 0, <API key>),
SD_BUS_PROPERTY("IdleSinceHint", "t", <API key>, 0, <API key>),
SD_BUS_PROPERTY("<API key>", "t", <API key>, 0, <API key>),
SD_BUS_PROPERTY("BlockInhibited", "s", <API key>, 0, <API key>),
SD_BUS_PROPERTY("DelayInhibited", "s", <API key>, 0, <API key>),
SD_BUS_PROPERTY("InhibitDelayMaxUSec", "t", NULL, offsetof(Manager, inhibit_delay_max), <API key>),
SD_BUS_PROPERTY("HandlePowerKey", "s", <API key>, offsetof(Manager, handle_power_key), <API key>),
SD_BUS_PROPERTY("HandleSuspendKey", "s", <API key>, offsetof(Manager, handle_suspend_key), <API key>),
SD_BUS_PROPERTY("HandleHibernateKey", "s", <API key>, offsetof(Manager, <API key>), <API key>),
SD_BUS_PROPERTY("HandleLidSwitch", "s", <API key>, offsetof(Manager, handle_lid_switch), <API key>),
SD_BUS_PROPERTY("<API key>", "s", <API key>, offsetof(Manager, <API key>), <API key>),
SD_BUS_PROPERTY("IdleAction", "s", <API key>, offsetof(Manager, idle_action), <API key>),
SD_BUS_PROPERTY("IdleActionUSec", "t", NULL, offsetof(Manager, idle_action_usec), <API key>),
SD_BUS_PROPERTY("<API key>", "b", <API key>, 0, 0),
SD_BUS_PROPERTY("PreparingForSleep", "b", <API key>, 0, 0),
SD_BUS_METHOD("GetSession", "s", "o", method_get_session, <API key>),
SD_BUS_METHOD("GetSessionByPID", "u", "o", <API key>, <API key>),
SD_BUS_METHOD("GetUser", "u", "o", method_get_user, <API key>),
SD_BUS_METHOD("GetUserByPID", "u", "o", <API key>, <API key>),
SD_BUS_METHOD("GetSeat", "s", "o", method_get_seat, <API key>),
SD_BUS_METHOD("ListSessions", NULL, "a(susso)", <API key>, <API key>),
SD_BUS_METHOD("ListUsers", NULL, "a(uso)", method_list_users, <API key>),
SD_BUS_METHOD("ListSeats", NULL, "a(so)", method_list_seats, <API key>),
SD_BUS_METHOD("ListInhibitors", NULL, "a(ssssuu)", <API key>, <API key>),
SD_BUS_METHOD("CreateSession", "uusssssussbssa(sv)", "soshusub", <API key>, 0),
SD_BUS_METHOD("ReleaseSession", "s", NULL, <API key>, 0),
SD_BUS_METHOD("ActivateSession", "s", NULL, <API key>, <API key>),
SD_BUS_METHOD("<API key>", "ss", NULL, <API key>, <API key>),
SD_BUS_METHOD("LockSession", "s", NULL, method_lock_session, 0),
SD_BUS_METHOD("UnlockSession", "s", NULL, method_lock_session, 0),
SD_BUS_METHOD("LockSessions", NULL, NULL, <API key>, 0),
SD_BUS_METHOD("UnlockSessions", NULL, NULL, <API key>, 0),
SD_BUS_METHOD("KillSession", "ssi", NULL, method_kill_session, <API key>(CAP_KILL)),
SD_BUS_METHOD("KillUser", "ui", NULL, method_kill_user, <API key>(CAP_KILL)),
SD_BUS_METHOD("TerminateSession", "s", NULL, <API key>, <API key>(CAP_KILL)),
SD_BUS_METHOD("TerminateUser", "u", NULL, <API key>, <API key>(CAP_KILL)),
SD_BUS_METHOD("TerminateSeat", "s", NULL, <API key>, <API key>(CAP_KILL)),
SD_BUS_METHOD("SetUserLinger", "ubb", NULL, <API key>, <API key>),
SD_BUS_METHOD("AttachDevice", "ssb", NULL, <API key>, <API key>),
SD_BUS_METHOD("FlushDevices", "b", NULL, <API key>, <API key>),
SD_BUS_METHOD("PowerOff", "b", NULL, method_poweroff, <API key>),
SD_BUS_METHOD("Reboot", "b", NULL, method_reboot, <API key>),
SD_BUS_METHOD("Suspend", "b", NULL, method_suspend, <API key>),
SD_BUS_METHOD("Hibernate", "b", NULL, method_hibernate, <API key>),
SD_BUS_METHOD("HybridSleep", "b", NULL, method_hybrid_sleep, <API key>),
SD_BUS_METHOD("CanPowerOff", NULL, "s", method_can_poweroff, <API key>),
SD_BUS_METHOD("CanReboot", NULL, "s", method_can_reboot, <API key>),
SD_BUS_METHOD("CanSuspend", NULL, "s", method_can_suspend, <API key>),
SD_BUS_METHOD("CanHibernate", NULL, "s", <API key>, <API key>),
SD_BUS_METHOD("CanHybridSleep", NULL, "s", <API key>, <API key>),
SD_BUS_METHOD("Inhibit", "ssss", "h", method_inhibit, <API key>),
SD_BUS_SIGNAL("SessionNew", "so", 0),
SD_BUS_SIGNAL("SessionRemoved", "so", 0),
SD_BUS_SIGNAL("UserNew", "uo", 0),
SD_BUS_SIGNAL("UserRemoved", "uo", 0),
SD_BUS_SIGNAL("SeatNew", "so", 0),
SD_BUS_SIGNAL("SeatRemoved", "so", 0),
SD_BUS_SIGNAL("PrepareForShutdown", "b", 0),
SD_BUS_SIGNAL("PrepareForSleep", "b", 0),
SD_BUS_VTABLE_END
};
static int session_jobs_reply(Session *s, const char *unit, const char *result) {
int r = 0;
assert(s);
assert(unit);
if (!s->started)
return r;
if (streq(result, "done"))
r = <API key>(s, NULL);
else {
<API key> sd_bus_error e = SD_BUS_ERROR_NULL;
sd_bus_error_setf(&e, <API key>, "Start job for unit %s failed with '%s'", unit, result);
r = <API key>(s, &e);
}
return r;
}
int match_job_removed(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
const char *path, *result, *unit;
Manager *m = userdata;
Session *session;
uint32_t id;
User *user;
int r;
assert(bus);
assert(message);
assert(m);
r = sd_bus_message_read(message, "uoss", &id, &path, &unit, &result);
if (r < 0) {
bus_log_parse_error(r);
return r;
}
if (m->action_job && streq(m->action_job, path)) {
log_info("Operation finished.");
/* Tell people that they now may take a lock again */
send_prepare_for(m, m->action_what, false);
free(m->action_job);
m->action_job = NULL;
m->action_unit = NULL;
m->action_what = 0;
return 0;
}
session = hashmap_get(m->session_units, unit);
if (session) {
if (streq_ptr(path, session->scope_job)) {
free(session->scope_job);
session->scope_job = NULL;
}
session_jobs_reply(session, unit, result);
session_save(session);
<API key>(session);
}
user = hashmap_get(m->user_units, unit);
if (user) {
if (streq_ptr(path, user->service_job)) {
free(user->service_job);
user->service_job = NULL;
}
if (streq_ptr(path, user->slice_job)) {
free(user->slice_job);
user->slice_job = NULL;
}
LIST_FOREACH(sessions_by_user, session, user->sessions) {
session_jobs_reply(session, unit, result);
}
user_save(user);
<API key>(user);
}
return 0;
}
int match_unit_removed(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
const char *path, *unit;
Manager *m = userdata;
Session *session;
User *user;
int r;
assert(bus);
assert(message);
assert(m);
r = sd_bus_message_read(message, "so", &unit, &path);
if (r < 0) {
bus_log_parse_error(r);
return r;
}
session = hashmap_get(m->session_units, unit);
if (session)
<API key>(session);
user = hashmap_get(m->user_units, unit);
if (user)
<API key>(user);
return 0;
}
int <API key>(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_free_ char *unit = NULL;
Manager *m = userdata;
const char *path;
Session *session;
User *user;
int r;
assert(bus);
assert(message);
assert(m);
path = <API key>(message);
if (!path)
return 0;
r = <API key>(path, &unit);
if (r < 0)
/* quietly ignore non-units paths */
return r == -EINVAL ? 0 : r;
session = hashmap_get(m->session_units, unit);
if (session)
<API key>(session);
user = hashmap_get(m->user_units, unit);
if (user)
<API key>(user);
return 0;
}
int match_reloading(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
Manager *m = userdata;
Session *session;
Iterator i;
int b, r;
assert(bus);
r = sd_bus_message_read(message, "b", &b);
if (r < 0) {
bus_log_parse_error(r);
return r;
}
if (b)
return 0;
/* systemd finished reloading, let's recheck all our sessions */
log_debug("System manager has been reloaded, rechecking sessions...");
HASHMAP_FOREACH(session, m->sessions, i)
<API key>(session);
return 0;
}
int <API key>(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
const char *name, *old, *new;
Manager *m = userdata;
Session *session;
Iterator i;
int r;
char *key;
r = sd_bus_message_read(message, "sss", &name, &old, &new);
if (r < 0) {
bus_log_parse_error(r);
return r;
}
if (isempty(old) || !isempty(new))
return 0;
key = set_remove(m->busnames, (char*) old);
if (!key)
return 0;
/* Drop all controllers owned by this name */
free(key);
HASHMAP_FOREACH(session, m->sessions, i)
if (<API key>(session, old))
<API key>(session);
return 0;
}
int <API key>(Manager *manager, const char *property, ...) {
char **l;
assert(manager);
l = <API key>(property);
return <API key>(
manager->bus,
"/org/freedesktop/login1",
"org.freedesktop.login1.Manager",
l);
}
int <API key>(Manager *manager) {
<API key> sd_bus_error error = SD_BUS_ERROR_NULL;
Inhibitor *offending = NULL;
int r;
assert(manager);
if (manager->action_what == 0 || manager->action_job)
return 0;
/* Continue delay? */
if (<API key>(manager, manager->action_what, INHIBIT_DELAY, NULL, false, false, 0, &offending)) {
_cleanup_free_ char *comm = NULL, *u = NULL;
get_process_comm(offending->pid, &comm);
u = uid_to_name(offending->uid);
if (manager->action_timestamp + manager->inhibit_delay_max > now(CLOCK_MONOTONIC))
return 0;
log_info("Delay lock is active (UID "UID_FMT"/%s, PID "PID_FMT"/%s) but inhibitor timeout is reached.",
offending->uid, strna(u),
offending->pid, strna(comm));
}
/* Actually do the operation */
r = <API key>(manager, manager->action_what, manager->action_unit, &error);
if (r < 0) {
log_warning("Failed to send delayed message: %s", bus_error_message(&error, r));
manager->action_unit = NULL;
manager->action_what = 0;
return r;
}
return 1;
}
int manager_start_scope(
Manager *manager,
const char *scope,
pid_t pid,
const char *slice,
const char *description,
const char *after, const char *after2,
sd_bus_error *error,
char **job) {
<API key> sd_bus_message *m = NULL, *reply = NULL;
int r;
assert(manager);
assert(scope);
assert(pid > 1);
r = <API key>(
manager->bus,
&m,
"org.freedesktop.systemd1",
"/org/freedesktop/systemd1",
"org.freedesktop.systemd1.Manager",
"StartTransientUnit");
if (r < 0)
return r;
r = <API key>(m, "ss", strempty(scope), "fail");
if (r < 0)
return r;
r = <API key>(m, 'a', "(sv)");
if (r < 0)
return r;
if (!isempty(slice)) {
r = <API key>(m, "(sv)", "Slice", "s", slice);
if (r < 0)
return r;
}
if (!isempty(description)) {
r = <API key>(m, "(sv)", "Description", "s", description);
if (r < 0)
return r;
}
if (!isempty(after)) {
r = <API key>(m, "(sv)", "After", "as", 1, after);
if (r < 0)
return r;
}
if (!isempty(after2)) {
r = <API key>(m, "(sv)", "After", "as", 1, after2);
if (r < 0)
return r;
}
/* cgroup empty notification is not available in containers
* currently. To make this less problematic, let's shorten the
* stop timeout for sessions, so that we don't wait
* forever. */
/* Make sure that the session shells are terminated with
* SIGHUP since bash and friends tend to ignore SIGTERM */
r = <API key>(m, "(sv)", "SendSIGHUP", "b", true);
if (r < 0)
return r;
r = <API key>(m, "(sv)", "PIDs", "au", 1, pid);
if (r < 0)
return r;
r = <API key>(m);
if (r < 0)
return r;
r = <API key>(m, "a(sa(sv))", 0);
if (r < 0)
return r;
r = sd_bus_call(manager->bus, m, 0, error, &reply);
if (r < 0)
return r;
if (job) {
const char *j;
char *copy;
r = sd_bus_message_read(reply, "o", &j);
if (r < 0)
return r;
copy = strdup(j);
if (!copy)
return -ENOMEM;
*job = copy;
}
return 1;
}
int manager_start_unit(Manager *manager, const char *unit, sd_bus_error *error, char **job) {
<API key> sd_bus_message *reply = NULL;
int r;
assert(manager);
assert(unit);
r = sd_bus_call_method(
manager->bus,
"org.freedesktop.systemd1",
"/org/freedesktop/systemd1",
"org.freedesktop.systemd1.Manager",
"StartUnit",
error,
&reply,
"ss", unit, "fail");
if (r < 0)
return r;
if (job) {
const char *j;
char *copy;
r = sd_bus_message_read(reply, "o", &j);
if (r < 0)
return r;
copy = strdup(j);
if (!copy)
return -ENOMEM;
*job = copy;
}
return 1;
}
int manager_stop_unit(Manager *manager, const char *unit, sd_bus_error *error, char **job) {
<API key> sd_bus_message *reply = NULL;
int r;
assert(manager);
assert(unit);
r = sd_bus_call_method(
manager->bus,
"org.freedesktop.systemd1",
"/org/freedesktop/systemd1",
"org.freedesktop.systemd1.Manager",
"StopUnit",
error,
&reply,
"ss", unit, "fail");
if (r < 0) {
if (<API key>(error, <API key>) ||
<API key>(error, <API key>)) {
if (job)
*job = NULL;
sd_bus_error_free(error);
return 0;
}
return r;
}
if (job) {
const char *j;
char *copy;
r = sd_bus_message_read(reply, "o", &j);
if (r < 0)
return r;
copy = strdup(j);
if (!copy)
return -ENOMEM;
*job = copy;
}
return 1;
}
int <API key>(Manager *manager, const char *scope, sd_bus_error *error) {
_cleanup_free_ char *path = NULL;
int r;
assert(manager);
assert(scope);
path = <API key>(scope);
if (!path)
return -ENOMEM;
r = sd_bus_call_method(
manager->bus,
"org.freedesktop.systemd1",
path,
"org.freedesktop.systemd1.Scope",
"Abandon",
error,
NULL,
NULL);
if (r < 0) {
if (<API key>(error, <API key>) ||
<API key>(error, <API key>) ||
<API key>(error, <API key>)) {
sd_bus_error_free(error);
return 0;
}
return r;
}
return 1;
}
int manager_kill_unit(Manager *manager, const char *unit, KillWho who, int signo, sd_bus_error *error) {
assert(manager);
assert(unit);
return sd_bus_call_method(
manager->bus,
"org.freedesktop.systemd1",
"/org/freedesktop/systemd1",
"org.freedesktop.systemd1.Manager",
"KillUnit",
error,
NULL,
"ssi", unit, who == KILL_LEADER ? "main" : "all", signo);
}
int <API key>(Manager *manager, const char *unit) {
<API key> sd_bus_error error = SD_BUS_ERROR_NULL;
<API key> sd_bus_message *reply = NULL;
_cleanup_free_ char *path = NULL;
const char *state;
int r;
assert(manager);
assert(unit);
path = <API key>(unit);
if (!path)
return -ENOMEM;
r = sd_bus_get_property(
manager->bus,
"org.freedesktop.systemd1",
path,
"org.freedesktop.systemd1.Unit",
"ActiveState",
&error,
&reply,
"s");
if (r < 0) {
/* systemd might have droppped off momentarily, let's
* not make this an error */
if (<API key>(&error, <API key>) ||
<API key>(&error, <API key>))
return true;
/* If the unit is already unloaded then it's not
* active */
if (<API key>(&error, <API key>) ||
<API key>(&error, <API key>))
return false;
return r;
}
r = sd_bus_message_read(reply, "s", &state);
if (r < 0)
return -EINVAL;
return !streq(state, "inactive") && !streq(state, "failed");
}
int <API key>(Manager *manager, const char *path) {
<API key> sd_bus_error error = SD_BUS_ERROR_NULL;
<API key> sd_bus_message *reply = NULL;
int r;
assert(manager);
assert(path);
r = sd_bus_get_property(
manager->bus,
"org.freedesktop.systemd1",
path,
"org.freedesktop.systemd1.Job",
"State",
&error,
&reply,
"s");
if (r < 0) {
if (<API key>(&error, <API key>) ||
<API key>(&error, <API key>))
return true;
if (<API key>(&error, <API key>))
return false;
return r;
}
/* We don't actually care about the state really. The fact
* that we could read the job state is enough for us */
return true;
} |
#include "CLoopBuffer.h"
#include "CMutex.h"
#include "CAutoLock.h"
#include <string.h>
CLoopBuffer::CLoopBuffer(ub_4 size, CMutex *mutex, bool_ isPadding) :
_totalSize(size) {
assert(size);
_actualSize = size;
_usedSize = 0;
_freeSize = size;
_mutex = mutex;
_isPadding = isPadding;
_padding = 0;
_writePoint = _readPoint = _buffer = new ch_1[size];
assert(_buffer);
}
CLoopBuffer::~CLoopBuffer() {
_DEL_ARR(_buffer);
}
bool_ CLoopBuffer::write(const ch_1 *buffer, ub_4 size) {
assert(buffer);
assert(size);
CAutoLock al(_mutex);
if (size > _freeSize) {
return false_v;
}
if (_writePoint >= _readPoint) {
ub_4 rightSize = _buffer + _totalSize - _writePoint;
ub_4 leftSize = _readPoint - _buffer;
assert(_padding == 0);
assert(_actualSize == _totalSize);
assert(_freeSize <= _totalSize);
assert(_writePoint - _readPoint == (b_4) _usedSize);
assert(rightSize + leftSize == _freeSize);
if (rightSize >= size) {
memcpy(_writePoint, buffer, size);
_writePoint += size;
} else if (_isPadding) {
if (size > leftSize) {
return false_v;
}
_padding = rightSize;
_actualSize -= _padding;
_freeSize -= _padding;
assert(_freeSize == leftSize);
memcpy(_buffer, buffer, size);
_writePoint = _buffer + size;
} else {
memcpy(_writePoint, buffer, rightSize);
memcpy(_buffer, buffer + rightSize, size - rightSize);
_writePoint = _buffer + size - rightSize;
}
} else {
assert(_readPoint - _writePoint == (int) _freeSize);
memcpy(_writePoint, buffer, size);
_writePoint += size;
assert(_writePoint <= _readPoint);
}
_usedSize += size;
_freeSize -= size;
return true_v;
}
bool_ CLoopBuffer::read(ch_1 *buffer, ub_4 &size) {
assert(buffer);
assert(size);
CAutoLock al(_mutex);
if (0 == _usedSize) {
size = 0;
return true_v;
}
if (_writePoint > _readPoint) {
assert(_padding == 0);
assert(_writePoint - _readPoint == (int) _usedSize);
if (size > _usedSize) {
size = _usedSize;
}
memcpy(buffer, _readPoint, size);
_readPoint += size;
} else {
assert(_readPoint - _writePoint == (int) _freeSize);
ub_4 rightSize = _buffer + _actualSize - _readPoint;
ub_4 leftSize = _writePoint - _buffer;
assert(_actualSize == _totalSize - _padding);
assert(rightSize + leftSize == _usedSize);
if (rightSize >= size) {
memcpy(buffer, _readPoint, size);
_readPoint += size;
if (rightSize == size && _padding) {
_actualSize += _padding;
_freeSize += _padding;
_padding = 0;
_readPoint = _buffer;
}
} else {
if (_usedSize < size) {
size = _usedSize;
}
memcpy(buffer, _readPoint, rightSize);
memcpy(buffer + rightSize, _buffer, size - rightSize);
_readPoint = _buffer + size - rightSize;
if (_padding) {
_actualSize += _padding;
_freeSize += _padding;
_padding = 0;
}
}
}
_usedSize -= size;
_freeSize += size;
return true_v;
}
none_ CLoopBuffer::reset() {
CAutoLock al(_mutex);
_actualSize = _totalSize;
_usedSize = 0;
_freeSize = _totalSize;
_padding = 0;
_writePoint = _readPoint = _buffer;
} |
class <API key> < <API key>
menu_item :issues
include ProjectsHelper
include QueriesHelper
helper :queries
helper :issues
before_filter :load_project, :get_query
def index
@query = get_query
@issue_count = @query.issue_count
@issues = @query.issues
@statuses = IssueStatus.find(Backlogs.setting[:<API key>])
end
private
def load_project
@project = Project.find(params[:project_id])
end
def get_query
query = IssueQuery.new(name: "refinement", filters: {"status_id"=>{:operator=>"=", :values=>Backlogs.setting[:<API key>]}}, group_by: "assigned_to")
query.project_id = @project.id
query
end
end |
package com.autentia.intra.manager.holiday;
import com.autentia.intra.util.SpringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/* Activity - generated by stajanov (do not edit/delete) */
public class <API key> {
/**
* Logger
*/
private static final Log log = LogFactory.getLog(<API key>.class);
public static <API key> getDefault() {
return (<API key>) SpringUtils.getSpringBean("<API key>");
}
/**
* Empty constructor needed by CGLIB (Spring AOP)
*/
protected <API key>() {
}
} |
// This program is free software; you can redistribute it and/or modify it
// by the Free Software Foundation. You may not use, modify or distribute
// This program is distributed in the hope that it will be useful, but
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// dce_smb_module.cc author Rashmi Pitre <rrp@cisco.com>
#include "dce_smb_module.h"
#include "dce_smb.h"
#include "dce_common.h"
#include "dce_co.h"
#include "main/snort_config.h"
using namespace std;
static const PegInfo dce2_smb_pegs[] =
{
{ "events", "total events" },
{ "aborted sessions", "total aborted sessions" },
{ "bad autodetects", "total bad autodetects" },
{ "PDUs", "total connection-oriented PDUs" },
{ "Binds", "total connection-oriented binds" },
{ "Bind acks", "total connection-oriented binds acks" },
{ "Alter contexts", "total connection-oriented alter contexts" },
{ "Alter context responses",
"total connection-oriented alter context responses" },
{ "Bind naks", "total connection-oriented bind naks" },
{ "Requests", "total connection-oriented requests" },
{ "Responses", "total connection-oriented responses" },
{ "Cancels", "total connection-oriented cancels" },
{ "Orphaned", "total connection-oriented orphaned" },
{ "Faults", "total connection-oriented faults" },
{ "Auth3s", "total connection-oriented auth3s" },
{ "Shutdowns", "total connection-oriented shutdowns" },
{ "Rejects", "total connection-oriented rejects" },
{ "MS RPC/HTTP PDUs", "total connection-oriented MS requests to send RPC over HTTP" },
{ "Other requests", "total connection-oriented other requests" },
{ "Other responses", "total connection-oriented other responses" },
{ "Request fragments", "total connection-oriented request fragments" },
{ "Response fragments", "total connection-oriented response fragments" },
{ "Client max fragment size",
"connection-oriented client maximum fragment size" },
{ "Client min fragment size",
"connection-oriented client minimum fragment size" },
{ "Client segs reassembled",
"total connection-oriented client segments reassembled" },
{ "Client frags reassembled",
"total connection-oriented client fragments reassembled" },
{ "Server max fragment size",
"connection-oriented server maximum fragment size" },
{ "Server min fragment size",
"connection-oriented server minimum fragment size" },
{ "Server segs reassembled",
"total connection-oriented server segments reassembled" },
{ "Server frags reassembled",
"total connection-oriented server fragments reassembled" },
{ "Sessions", "total smb sessions" },
{ "Packets", "total smb packets" },
{ "Client segs reassembled", "total smb client segments reassembled" },
{ "Server segs reassembled", "total smb server segments reassembled" },
{ "Max outstanding requests", "total smb maximum outstanding requests" },
{ "Files processed", "total smb files processed" },
{ nullptr, nullptr }
};
static const char* <API key>[] = { "Disabled", "Client","Server",
"Client and Server" };
static const Parameter s_params[] =
{
{ "disable_defrag", Parameter::PT_BOOL, nullptr, "false",
" Disable DCE/RPC defragmentation" },
{ "max_frag_len", Parameter::PT_INT, "1514:65535", "65535",
" Maximum fragment size for defragmentation" },
{ "<API key>", Parameter::PT_INT, "0:65535", "0",
" Minimum bytes received before performing reassembly" },
{ "<API key>", Parameter::PT_ENUM,
"none | client | server | both ", "none",
" Target based SMB policy to use" },
{ "policy", Parameter::PT_ENUM,
"Win2000 | WinXP | WinVista | Win2003 | Win2008 | Win7 | Samba | Samba-3.0.37 | Samba-3.0.22 | Samba-3.0.20",
"WinXP",
" Target based policy to use" },
{ "smb_max_chain", Parameter::PT_INT, "0:255", "3",
" SMB max chain size" },
{ "smb_max_compound", Parameter::PT_INT, "0:255", "3",
" SMB max compound size" },
{ "valid_smb_versions", Parameter::PT_MULTI,
"v1 | v2 | all", "all",
" Valid SMB versions" },
{ "smb_file_inspection", Parameter::PT_ENUM,
"off | on | only", "off",
" SMB file inspection" },
{ "smb_file_depth", Parameter::PT_INT, "-1:", "16384",
" SMB file depth for file data" },
{ "smb_invalid_shares", Parameter::PT_STRING, nullptr, nullptr,
"SMB shares to alert on " },
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
static const RuleMap dce2_smb_rules[] =
{
{ <API key>, <API key> },
{ DCE2_SMB_BAD_TYPE, <API key> },
{ DCE2_SMB_BAD_ID, DCE2_SMB_BAD_ID_STR },
{ DCE2_SMB_BAD_WCT, <API key> },
{ DCE2_SMB_BAD_BCC, <API key> },
{ DCE2_SMB_BAD_FORM, <API key> },
{ DCE2_SMB_BAD_OFF, <API key> },
{ DCE2_SMB_TDCNT_ZE, <API key> },
{ <API key>, <API key> },
{ DCE2_SMB_NB_LT_BCC, <API key> },
{ <API key>, <API key> },
{ <API key>, <API key> },
{ <API key>, <API key> },
{ <API key>, <API key> },
{ <API key>, <API key> },
{ <API key>, <API key> },
{ <API key>, <API key> },
{ <API key>, <API key> },
{ <API key>, <API key> },
{ <API key>, <API key> },
{ <API key>, <API key> },
{ <API key>, <API key> },
{ <API key>, <API key> },
{ <API key>, <API key> },
{ <API key>, <API key> },
{ <API key>, <API key> },
{ <API key>, <API key> },
{ <API key>, <API key> },
{ <API key>, <API key> },
{ <API key>, <API key> },
{ <API key>, <API key> },
{ <API key>, <API key> },
{ <API key>, <API key> },
{ <API key>, <API key> },
{ <API key>, <API key> },
{ <API key>, <API key> },
{ DCE2_SMB_V1, DCE2_SMB_V1_STR },
{ DCE2_SMB_V2, DCE2_SMB_V2_STR },
{ <API key>, <API key> },
{ <API key>, <API key> },
{ DCE2_SMB_DCNT_ZERO, <API key> },
{ <API key>, <API key> },
{ <API key>, <API key> },
{ <API key>, <API key> },
{ <API key>, <API key> },
{ <API key>, <API key> },
{ <API key>, <API key> },
{ <API key>, <API key> },
{ <API key>, <API key> },
{ 0, nullptr }
};
Dce2SmbModule::Dce2SmbModule() : Module(DCE2_SMB_NAME, DCE2_SMB_HELP, s_params)
{
memset(&config, 0, sizeof(config));
}
Dce2SmbModule::~Dce2SmbModule()
{
if (config.smb_invalid_shares)
{
DCE2_ListDestroy(config.smb_invalid_shares);
}
}
const RuleMap* Dce2SmbModule::get_rules() const
{
return dce2_smb_rules;
}
const PegInfo* Dce2SmbModule::get_pegs() const
{
return dce2_smb_pegs;
}
PegCount* Dce2SmbModule::get_counts() const
{
return (PegCount*)&dce2_smb_stats;
}
ProfileStats* Dce2SmbModule::get_profile(
unsigned index, const char*& name, const char*& parent) const
{
switch ( index )
{
case 0:
name = "dce_smb_main";
parent = nullptr;
return &dce2_smb_pstat_main;
case 1:
name = "dce_smb_session";
parent = "dce_smb_main";
return &<API key>;
case 2:
name = "dce_smb_new_session";
parent = "dce_smb_session";
return &<API key>;
case 3:
name = "dce_smb_detect";
parent = "dce_smb_main";
return &<API key>;
case 4:
name = "dce_smb_log";
parent = "dce_smb_main";
return &dce2_smb_pstat_log;
case 5:
name = "dce_smb_co_segment";
parent = "dce_smb_main";
return &<API key>;
case 6:
name = "dce_smb_co_fragment";
parent = "dce_smb_main";
return &<API key>;
case 7:
name = "<API key>";
parent = "dce_smb_main";
return &<API key>;
case 8:
name = "dce_smb_co_context";
parent = "dce_smb_main";
return &<API key>;
case 9:
name = "dce_smb_segment";
parent = "dce_smb_main";
return &<API key>;
case 10:
name = "dce_smb_request";
parent = "dce_smb_main";
return &<API key>;
case 11:
name = "dce_smb_uid";
parent = "dce_smb_main";
return &<API key>;
case 12:
name = "dce_smb_tid";
parent = "dce_smb_main";
return &<API key>;
case 13:
name = "dce_smb_fid";
parent = "dce_smb_main";
return &<API key>;
case 14:
name = "dce_smb_file";
parent = "dce_smb_main";
return &<API key>;
case 15:
name = "dce_smb_file_detect";
parent = "dce_smb_file";
return &<API key>;
case 16:
name = "dce_smb_file_api";
parent = "dce_smb_file";
return &<API key>;
case 17:
name = "dce_smb_fingerprint";
parent = "dce_smb_main";
return &<API key>;
case 18:
name = "dce_smb_negotiate";
parent = "dce_smb_main";
return &<API key>;
}
return nullptr;
}
static int <API key>(const void* a, const void* b)
{
dce2SmbShare* ashare = (dce2SmbShare*)a;
dce2SmbShare* bshare = (dce2SmbShare*)b;
if ((ashare == nullptr) || (bshare == nullptr))
return -1;
/* Just check the ascii string */
if (ashare->ascii_str_len != bshare->ascii_str_len)
return -1;
if (memcmp(ashare->ascii_str, bshare->ascii_str, ashare->ascii_str_len) == 0)
return 0;
/* Only care about equality for dups */
return -1;
}
static void <API key>(void* data)
{
dce2SmbShare* smb_share = (dce2SmbShare*)data;
if (smb_share == nullptr)
return;
free(smb_share->unicode_str);
free(smb_share->ascii_str);
free(smb_share);
}
static void <API key>(dce2SmbProtoConf& config, const char* s)
{
config.<API key> = 0;
if ( strstr(s, "v1") )
{
config.<API key> |= <API key>;
}
if ( strstr(s, "v2") )
{
config.<API key> |= <API key>;
}
if ( strstr(s, "all") )
{
config.<API key> = <API key>;
config.<API key> |= <API key>;
}
}
static bool <API key>(dce2SmbProtoConf& config, Value& v)
{
string tok;
bool error = false;
config.smb_invalid_shares =
DCE2_ListNew(<API key>, <API key>,
<API key>, <API key>,
<API key> | <API key>);
v.set_first_token();
while ( v.get_next_token(tok) )
{
dce2SmbShare* smb_share;
dce2SmbShare* smb_share_key;
int i, j;
DCE2_Ret status;
char* share = (char*)tok.c_str();
int share_len= strlen(share);
smb_share = (dce2SmbShare*)calloc(sizeof(dce2SmbShare),1);
smb_share_key = (dce2SmbShare*)calloc(sizeof(dce2SmbShare),1);
if ((smb_share == nullptr) || (smb_share_key == nullptr))
{
FatalError("DCE2 - Could not allocate memory for config\n");
}
smb_share->unicode_str_len = (share_len * 2) + 2;
smb_share->unicode_str = (char*)calloc(smb_share->unicode_str_len,1);
smb_share->ascii_str_len = share_len + 1;
smb_share->ascii_str = (char*)calloc(smb_share->ascii_str_len,1);
if ((smb_share->unicode_str == nullptr) || (smb_share->ascii_str == nullptr))
{
FatalError("DCE2 - Could not allocate memory for config\n");
}
for (i = 0, j = 0; i < share_len; i++, j += 2)
{
smb_share->unicode_str[j] = toupper(share[i]);
smb_share->ascii_str[i] = toupper(share[i]);
}
/* Just use ascii share as the key */
smb_share_key->ascii_str_len = smb_share->ascii_str_len;
smb_share_key->ascii_str = (char*)calloc(smb_share_key->ascii_str_len,1);
if (smb_share_key->ascii_str == nullptr)
{
FatalError("DCE2 - Could not allocate memory for config\n");
}
memcpy(smb_share_key->ascii_str, smb_share->ascii_str, smb_share_key->ascii_str_len);
status = DCE2_ListInsert(config.smb_invalid_shares, (void*)smb_share_key,
(void*)smb_share);
if (status == DCE2_RET__DUPLICATE)
{
/* Just free this share and move on */
<API key>((void*)smb_share);
<API key>((void*)smb_share_key);
}
else if (status != DCE2_RET__SUCCESS)
{
ErrorMessage("DCE2 - Failed to insert invalid share into list\n");
error = true;
break;
}
}
if (error)
{
DCE2_ListDestroy(config.smb_invalid_shares);
config.smb_invalid_shares = nullptr;
return error;
}
return(true);
}
bool Dce2SmbModule::set(const char*, Value& v, SnortConfig*)
{
if (<API key>(v,config.common))
return true;
else if ( v.is("<API key>") )
config.<API key> = v.get_long();
else if ( v.is("<API key>") )
config.<API key> = (<API key>)v.get_long();
else if ( v.is("smb_max_chain") )
config.smb_max_chain = v.get_long();
else if ( v.is("smb_max_compound") )
config.smb_max_compound = v.get_long();
else if ( v.is("valid_smb_versions") )
<API key>(config,v.get_string());
else if ( v.is("smb_file_inspection") )
config.smb_file_inspection = (<API key>)v.get_long();
else if ( v.is("smb_file_depth") )
config.smb_file_depth = v.get_long();
else if ( v.is("smb_invalid_shares") )
return(<API key>(config,v));
else
return false;
return true;
}
void Dce2SmbModule::get_data(dce2SmbProtoConf& dce2_smb_config)
{
dce2_smb_config = config; // includes pointer copy so set to NULL
config.smb_invalid_shares = nullptr;
}
void print_dce2_smb_conf(dce2SmbProtoConf& config)
{
LogMessage("DCE SMB config: \n");
<API key>(config.common);
LogMessage(" Reassemble Threshold : %d\n",
config.<API key>);
LogMessage(" SMB fingerprint policy : %s\n",
<API key>[config.<API key>]);
if (config.smb_max_chain == 0)
LogMessage(" Maximum SMB command chaining: Unlimited\n");
else if (config.smb_max_chain == 1)
LogMessage(" Maximum SMB command chaining: No chaining allowed\n");
else
LogMessage(" Maximum SMB command chaining: %u\n", config.smb_max_chain);
if (config.smb_max_compound == 0)
LogMessage(" Maximum SMB compounded requests: Unlimited\n");
else if (config.smb_max_chain == 1)
LogMessage(" Maximum SMB compounded requests: No compounding allowed\n");
else
LogMessage(" Maximum SMB compounded requests: %u\n", config.smb_max_compound);
if (config.smb_file_inspection == <API key>)
{
LogMessage(" SMB file inspection: Disabled\n");
}
else
{
if (config.smb_file_inspection == <API key>)
LogMessage(" SMB file inspection: Only\n");
else
LogMessage(" SMB file inspection: Enabled\n");
if (config.smb_file_depth == -1)
LogMessage(" SMB file depth: Disabled\n");
else if (config.smb_file_depth == 0)
LogMessage(" SMB file depth: Unlimited\n");
else
LogMessage(" SMB file depth: %d\n",config.smb_file_depth);
}
if (config.<API key> == <API key>)
{
LogMessage(" SMB valid versions : v1\n");
}
else if (config.<API key> == <API key>)
{
LogMessage(" SMB valid versions : v2\n");
}
else
{
LogMessage(" SMB valid versions : all\n");
}
if (config.smb_invalid_shares != nullptr)
{
dce2SmbShare* share;
LogMessage(" Invalid SMB shares:\n");
for (share = (dce2SmbShare*)DCE2_ListFirst(config.smb_invalid_shares);
share != nullptr;
share = (dce2SmbShare*)DCE2_ListNext(config.smb_invalid_shares))
{
LogMessage(" %s\n",share->ascii_str);
}
}
} |
#ifndef <API key>
#define <API key>
/* Define sound device capability */
#define SNDDEV_CAP_RX 0x1 /* RX direction */
#define SNDDEV_CAP_TX 0x2 /* TX direction */
#define SNDDEV_CAP_VOICE 0x4 /* Support voice call */
#define SNDDEV_CAP_PLAYBACK 0x8 /* Support playback */
#define SNDDEV_CAP_FM 0x10 /* Support FM radio */
#define SNDDEV_CAP_TTY 0x20 /* Support TTY */
#define SNDDEV_CAP_ANC 0x40 /* Support ANC */
#define SNDDEV_CAP_LB 0x80 /* Loopback */
#define VOC_NB_INDEX 0
#define VOC_WB_INDEX 1
#define <API key> 2
/* Device volume types . In Current deisgn only one of these are supported. */
#define <API key> 0x1 /* Codec Digital volume control */
#define <API key> 0x2 /* Codec Analog volume control */
#define Q5V2_HW_HANDSET 0
#define Q5V2_HW_HEADSET 1
#define Q5V2_HW_SPEAKER 2
#define Q5V2_HW_BT_SCO 3
#define Q5V2_HW_TTY 4
#define Q5V2_HW_HS_SPKR 5
#define Q5V2_HW_USB_HS 6
#define Q5V2_HW_HAC 7
#define Q5V2_HW_COUNT 8
struct q5v2_hw_info {
int min_gain[<API key>];
int max_gain[<API key>];
};
struct <API key> {
int max_step;
int gain[<API key>][10];
};
#endif /* <API key> */ |
<?php
defined('_JEXEC') or die;
?>
<?php include JPATH_ADMINISTRATOR.DS.'components'.DS.'com_fsj_main'.DS.'views'.DS.'cronlog'.DS.'snippet'.DS.'_setup.php'; ?>
<form class="fsj" action="<?php echo JRoute::_('index.php?option=com_fsj_main&layout=edit&id='.(int) $this->item->id); ?>" method="post" name="adminForm" id="item-form" class="form-validate">
<?php include JPATH_ADMINISTRATOR.DS.'components'.DS.'com_fsj_main'.DS.'views'.DS.'cronlog'.DS.'snippet'.DS.'_form.php'; ?>
<?php include JPATH_ADMINISTRATOR.DS.'components'.DS.'com_fsj_main'.DS.'views'.DS.'cronlog'.DS.'snippet'.DS.'_footer.php'; ?>
</form>
<?php include JPATH_ADMINISTRATOR.DS.'components'.DS.'com_fsj_main'.DS.'views'.DS.'cronlog'.DS.'snippet'.DS.'_scripts.php'; ?> |
package com.springmvc.videoteca.spring.validator;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.springframework.stereotype.Component;
/**
*
* @author nazaret
*/
@Component
public class EmailValidator {
private Pattern pattern;
private Matcher matcher;
private static final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@"
+ "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
public EmailValidator() {
pattern = Pattern.compile(EMAIL_PATTERN);
}
public boolean valid(final String email) {
matcher = pattern.matcher(email);
return matcher.matches();
}
} |
package org.ribbon.beans.session;
import org.ribbon.enteties.Permission;
import org.ribbon.enteties.Groups;
import org.ribbon.enteties.Directory;
import org.ribbon.enteties.User;
import org.ribbon.beans.ejb.<API key>;
import java.util.List;
import java.util.ListIterator;
import javax.ejb.Stateless;
/**
* Access check bean. You should use
* this bean to check user access rights
* @author Stanislav Nepochatov
*/
@Stateless
public class AccessChecker {
public Permission.ACCESS_STATE check(User initiator, <API key> dirBean, String target) {
if (initiator.getLogin().equals("root")) {
return Permission.ACCESS_STATE.MAY_ADMIN;
}
List<Directory> chain = dirBean.findChain(target);
List<Permission> perms = null;
ListIterator<Directory> chainIter = chain.listIterator(chain.size());
while (chainIter.hasPrevious()) {
Directory chainElement = chainIter.previous();
List<Permission> tempPerms = chainElement.getPermissionList();
if (tempPerms.size() > 0) {
perms = tempPerms;
break;
}
}
if (perms != null) {
Permission.ACCESS_STATE resolved = Permission.ACCESS_STATE.NO_ACCESS;
for (Permission checked: perms) {
if (!checked.getGroupPerm() && initiator.equals(checked.getUserId())) {
resolved = Permission.compare(resolved, Permission.getState(checked));
} else {
for (Groups grp: initiator.getGroupsList()) {
if (grp.equals(checked.getGroupId()) || checked.getAllPerm()) {
resolved = Permission.compare(resolved, Permission.getState(checked));
}
}
}
}
return resolved;
} else {
return Permission.ACCESS_STATE.MAY_READ;
}
}
} |
#!/bin/bash
function log_info() {
echo "[INFO]$@"
}
function log_warn() {
echo "[WARN]$@"
}
function log_error() {
echo "[ERROR]$@"
}
function usage() {
cat<<USAGEEOF
NAME
$g_shell_name - git
SYNOPSIS
source $g_shell_name [] []...
DESCRIPTION
$<API key> --git
-h
get help log_info
FAST STEP BY STEP
http:
http:
-f
force mode to override exist file of the same name
-a
force mode to append exist file of the same name,not override
-v
verbose display
-o
the path of the out files
-p
use the proxy from hongxin(not recommend, may can not cross the Great Fire Wall)
http://help.honx.in/hc/kb/article/32854/
AUTHOR
searKing Chan
DATE
2015-11-16
REPORTING BUGS
searKingChan@gmail.com
REFERENCE
https://github.com/searKing/PrivateGitHub.git
USAGEEOF
}
#shellpull
#@param func_in "func"
#@param param_in "a b c",
function <API key>()
{
func_in=$1
param_in=$2
case $
0|1)
log_error "${LINENO}:$0 expercts 2 param in at least, but receive only $#. EXIT"
return 1
;;
*)
error_num=0
for curr_param in $param_in
do
case $func_in in
"append_gitignore")
gitignore_name=$curr_param
$func_in "$gitignore_name"
if [ $? -ne 0 ]; then
error_num+=0
fi
;;
*)
log_error "${LINENO}:Invalid serializable cmd: $func_in"
return 1
;;
esac
done
return $error_num
;;
esac
}
function parse_params_in() {
if [ "$#" -lt 0 ]; then
cat << HELPEOF
use option -h to get more log_information .
HELPEOF
return 1
fi
<API key>
<API key>
unset OPTIND
while getopts "afo:vph" opt
do
case $opt in
a)
#,fwrite -a
g_cfg_append_mode=1
;;
f)
g_cfg_force_mode=1
;;
o)
<API key>=$OPTARG
;;
v)
g_cfg_visual=1
;;
p)
g_cfg_use_proxy=1
;;
h)
usage
return 1
;;
?)
log_error "${LINENO}:$opt is Invalid"
return 1
;;
*)
;;
esac
done
#options
shift $((OPTIND - 1))
if [ "$#" -lt 0 ]; then
cat << HELPEOF
use option -h to get more log_information .
HELPEOF
return 0
fi
<API key>="$<API key>/$<API key>"
g_cfg_proxy_urn="${<API key>}://${<API key>}:${<API key>}"
<API key>="http"
<API key>="hx.gy"
<API key>="1080"
}
#apt
function <API key>()
{
<API key>=1
if [ $# -ne $<API key> ]; then
log_error "${LINENO}:$FUNCNAME expercts $<API key> param_in, but receive only $#. EXIT"
return 1;
fi
app_name=$1
#app
if [ $g_cfg_visual -ne 0 ]; then
which "$app_name"
else
which "$app_name" 1>/dev/null
fi
if [ $? -ne 0 ]; then
sudo apt-get install -y "$app_name"
ret=$?
if [ $ret -ne 0 ]; then
log_error "${LINENO}: install $app_name failed<$ret>. Exit."
return 1;
fi
fi
}
function <API key>(){
g_user_name="searKing"
g_user_email="searKingChan@gmail.com"
#,fwrite -a
g_cfg_append_mode=0
g_cfg_force_mode=0
g_cfg_use_proxy=0
<API key>="http"
<API key>="hx.gy"
<API key>="1080"
g_cfg_visual=0
cd ~
<API key>="$(cd ~; pwd)/etc/git"
cd -
#gitignoreGitHubURN
<API key>="gitignore"
<API key>="https://github.com/searKing/$<API key>.git"
}
function <API key>(){
g_shell_name="$(basename "$0")"
<API key>="$(cd "$(dirname "$0")"; pwd)"
<API key>="Global.gitignore"
}
function auto_config_git()
{
git config --global user.name "$g_user_name"
git config --global user.email "$g_user_email"
git config --global core.sparseCheckout true
#git add
git config --global core.quotepath false
git config --global color.ui auto
if [[ $g_cfg_use_proxy -ne 0 ]]; then
git config --global http.proxy "${g_cfg_proxy_urn}"
fi
#git--git rebase -i vim
<API key> "vim"
if [ $? -ne 0 ]; then
return 1;
fi
git config --global core.editor vim
#mergetooldifftool
<API key> "meld" #kdiff3
if [ $? -ne 0 ]; then
return 1;
fi
git config --global merge.tool meld
git config --global mergetool.prompt false
#local merged remote BASE
#1) $LOCAL=the file on the branch where you are merging; untouched by the merge process when shown to you
#2) $REMOTE=the file on the branch from where you are merging; untouched by the merge process when shown to you
#3) $BASE=the common ancestor of $LOCAL and $REMOTE, ie. the point where the two branches started diverting the considered file; untouched by the merge process when shown to you
#4) $MERGED=the partially merged file, with conflicts; this is the only file touched by the merge process and, actually, never shown to you in meld
git config --global mergetool.meld.cmd "meld \$LOCAL \$MERGED \$REMOTE"
git config --global diff.tool meld
git config --global difftool.prompt false
git config --global difftool.meld.cmd "meld \$LOCAL \$REMOTE"
#gitk,
<API key> "gitk"
if [ $? -ne 0 ]; then
return 1;
fi
which meld #kdiff3
if [ $? -ne 0 ]; then
sudo apt-get install meld
ret=$?
if [ $ret -ne 0 ]; then
log_error "${LINENO}: install meld failed($ret). Exit."
return 1;
fi
fi
# log--all log
git config --global alias.logpretty "log --pretty=format:'%C(yellow)%h %C(blue) %C(red)%d %C(reset)%s %C(green) [%cn]' --decorate --date=short"
git config --global alias.logprettyall "log --pretty=format:'%C(yellow)%h %C(blue) %C(red)%d %C(reset)%s %C(green) [%cn]' --decorate --date=short --all"
# git config --global alias.logpretty "log --pretty=oneline --abbrev-commit --graph --decorate"
git config --global alias.loggraph "log --graph --pretty=format:'%C(yellow)%h %C(blue)%d %C(reset)%s %C(white)%an, %ar%C(reset)' --abbrev-commit"
git config --global alias.loggraphall "log --graph --pretty=format:'%C(yellow)%h %C(blue)%d %C(reset)%s %C(white)%an, %ar%C(reset)' --abbrev-commit --all"
git config --global alias.loggraphstat "log --graph --pretty=format:'%C(yellow)%h %C(blue)%d %C(reset)%s %C(white)%an, %ar%C(reset)' --stat"
git config --global alias.loggraphstatall "log --graph --pretty=format:'%C(yellow)%h %C(blue)%d %C(reset)%s %C(white)%an, %ar%C(reset)' --all --stat"
git config --global alias.loglast "log -1 HEAD"
#undoundo
git config --global alias.undo "reset --soft HEAD^"
git config --global alias.standup "log --since '1 day ago' --oneline --author searKingChan@gmail.com"
#git addgit ds
}
#GitHub
function <API key>()
{
<API key>=0
if [ $# -ne $<API key> ]; then
log_error "${LINENO}:$0 expercts $<API key> param_in, but receive only $#. EXIT"
return 1;
fi
log_info "${LINENO}:clone $<API key> from GitHub"
cd "$<API key>"
if [ -d $<API key> ]; then
if [ $g_cfg_force_mode -eq 0 ]; then
log_error "${LINENO}:$<API key> files is already exist. use -f to override? Exit."
return 1
else
rm "$<API key>" -Rf
fi
fi
git clone $<API key>
ret=$?
if [ $ret -ne 0 ]; then
log_error "${LINENO}:git clone $<API key> failed : $ret"
return 1
fi
}
#.gitignore
function append_gitignore()
{
<API key>=1
if [ $# -ne $<API key> ]; then
log_error "${LINENO}:$0 expercts $<API key> param_in, but receive only $#. EXIT"
return 1;
fi
gitignore_name=$1
cd "$<API key>"
cd $<API key>
echo "#$gitignore_name" >> "$<API key>"
cat "$gitignore_name" >> "$<API key>"
cd "$<API key>"
}
#.gitignore
function <API key>()
{
<API key>=0
if [ $# -ne $<API key> ]; then
log_error "${LINENO}:$0 expercts $<API key> param_in, but receive only $#. EXIT"
return 1;
fi
cd "$<API key>" |
article, aside, details, figcaption, figure, footer, header, hgroup, main, nav, section, summary {
display: block
}
audio, canvas, video {
display: inline-block
}
audio:not([controls]) {
display: none;
height: 0
}
[hidden], template {
display: none
}
html {
font-family: sans-serif;
-ms-text-size-adjust: 100%;
-<API key>: 100%
}
body {
margin: 0
}
a {
background: 0 0
}
a:focus {
outline: thin dotted
}
a:active, a:hover {
outline: 0
}
h1 {
font-size: 2em;
margin: .67em 0
}
abbr[title] {
border-bottom: 1px dotted
}
b, strong {
font-weight: 700
}
dfn {
font-style: italic
}
hr {
-moz-box-sizing: content-box;
box-sizing: content-box;
height: 0
}
mark {
background: #ff0;
color: #000
}
code, kbd, pre, samp {
font-family: monospace, serif;
font-size: 1em
}
pre {
white-space: pre-wrap
}
q {
quotes: "\201C" "\201D" "\2018" "\2019"
}
small {
font-size: 80%
}
sub, sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline
}
sup {
top: -.5em
}
sub {
bottom: -.25em
}
img {
border: 0
}
svg:not(:root) {
overflow: hidden
}
figure {
margin: 0
}
fieldset {
border: 1px solid silver;
margin: 0 2px;
padding: .35em .625em .75em
}
legend {
border: 0;
padding: 0
}
button, input, select, textarea {
font-family: inherit;
font-size: 100%;
margin: 0
}
button, input {
line-height: normal
}
button, select {
text-transform: none
}
button, html input[type=button], input[type=reset], input[type=submit] {
-webkit-appearance: button;
cursor: pointer
}
button[disabled], html input[disabled] {
cursor: default
}
input[type=checkbox], input[type=radio] {
box-sizing: border-box;
padding: 0
}
input[type=search] {
-webkit-appearance: textfield;
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box;
box-sizing: content-box
}
input[type=search]::-<API key>, input[type=search]::-<API key> {
-webkit-appearance: none
}
button::-moz-focus-inner, input::-moz-focus-inner {
border: 0;
padding: 0
}
textarea {
overflow: auto;
vertical-align: top
}
table {
border-collapse: collapse;
border-spacing: 0
} |
//qminmax
fred=QMAX(i,j); // qminmax
fred=QMAX(i,j); // krazy:exclude=qminmax
fred=qMin(1.0, function());
fred=qMax(qMin(function(), 1), 5.4);
fred=Foo(qMin(function(), 1), 5);
fred=qMax(qMin(function(), 1.0), 5);
fred=qMin(1, qMin(2.0, function())
fred=qMin(mFoo, 2); |
#ifndef __DAVINCI_GPIO_H
#define __DAVINCI_GPIO_H
#include <linux/io.h>
#include <linux/spinlock.h>
#include <asm-generic/gpio.h>
#include <mach/irqs.h>
#include <mach/common.h>
#define DAVINCI_GPIO_BASE 0x01C67000
enum davinci_gpio_type {
GPIO_TYPE_DAVINCI = 0,
};
#define GPIO(X) (X) /* 0 <= X <= (DAVINCI_N_GPIO - 1) */
/* Convert GPIO signal to GPIO pin number */
#define GPIO_TO_PIN(bank, gpio) (16 * (bank) + (gpio))
struct <API key> {
struct gpio_chip chip;
int irq_base;
spinlock_t lock;
void __iomem *regs;
void __iomem *set_data;
void __iomem *clr_data;
void __iomem *in_data;
};
static inline struct <API key> *
<API key>(unsigned gpio)
{
struct <API key> *ctlrs = davinci_soc_info.gpio_ctlrs;
int index = gpio / 32;
if (!ctlrs || index >= davinci_soc_info.gpio_ctlrs_num)
return NULL;
return ctlrs + index;
}
static inline u32 __gpio_mask(unsigned gpio)
{
return 1 << (gpio % 32);
}
static inline void gpio_set_value(unsigned gpio, int value)
{
if (<API key>(value) && gpio < davinci_soc_info.gpio_num) {
struct <API key> *ctlr;
u32 mask;
ctlr = <API key>(gpio);
mask = __gpio_mask(gpio);
if (value)
__raw_writel(mask, ctlr->set_data);
else
__raw_writel(mask, ctlr->clr_data);
return;
}
__gpio_set_value(gpio, value);
}
static inline int gpio_get_value(unsigned gpio)
{
struct <API key> *ctlr;
if (!<API key>(gpio) || gpio >= davinci_soc_info.gpio_num)
return __gpio_get_value(gpio);
ctlr = <API key>(gpio);
return __gpio_mask(gpio) & __raw_readl(ctlr->in_data);
}
static inline int gpio_cansleep(unsigned gpio)
{
if (<API key>(gpio) && gpio < davinci_soc_info.gpio_num)
return 0;
else
return __gpio_cansleep(gpio);
}
static inline int gpio_to_irq(unsigned gpio)
{
return __gpio_to_irq(gpio);
}
static inline int irq_to_gpio(unsigned irq)
{
/* don't support the reverse mapping */
return -ENOSYS;
}
#endif /* __DAVINCI_GPIO_H */ |
package jmemorize.core;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import javax.swing.JTextPane;
import javax.swing.text.<API key>;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;
import javax.swing.text.html.HTMLDocument;
import org.junit.Test;
public class FormattedTextTest {
@Test
public void testEmptyDocument() {
final StyledDocument styledDocument = new HTMLDocument();
final FormattedText formatted = FormattedText.formatted(styledDocument);
assertEquals("", formatted.toString());
assertEquals("", formatted.getFormatted());
assertEquals("", formatted.getUnformatted());
final StyledDocument document = formatted.getDocument();
assertEquals(1, document.getEndPosition().getOffset());
assertEquals(0, document.getStartPosition().getOffset());
assertEquals(0, document.getLength());
}
@Test
public void <API key>() throws <API key> {
final String text = "hallo";
final FormattedText formatted = getFormattedText(text);
assertEquals(text, formatted.toString());
assertEquals(text, formatted.getFormatted());
assertEquals(text, formatted.getUnformatted());
final StyledDocument document = formatted.getDocument();
assertEquals(6, document.getEndPosition().getOffset());
assertEquals(0, document.getStartPosition().getOffset());
assertEquals(5, document.getLength());
final FormattedText otherText = getFormattedText("text");
final Set<FormattedText> formattedTextSet = new HashSet<>();
assertFalse(formattedTextSet.contains(formatted));
formattedTextSet.add(formatted);
formattedTextSet.add(otherText);
assertTrue(formattedTextSet.contains(formatted));
final Map<FormattedText, Boolean> map = new HashMap<>();
assertNull(map.get(formatted));
map.put(formatted, Boolean.FALSE);
map.put(otherText, Boolean.FALSE);
assertNotNull(map.get(formatted));
}
private FormattedText getFormattedText(final String text) {
final JTextPane m_textPane = new JTextPane();
m_textPane.setText(text);
final StyledDocument styledDocument = m_textPane.getStyledDocument();
final FormattedText formatted = FormattedText.formatted(styledDocument);
return formatted;
}
@Test
public void <API key>() throws <API key> {
final JTextPane m_textPane = new JTextPane();
final String text = "hallo, M";
final String expectedText = "hallo, <i>M</i>";
m_textPane.setText(text);
final StyledDocument styledDocument = m_textPane.getStyledDocument();
final SimpleAttributeSet sas = new SimpleAttributeSet();
StyleConstants.setItalic(sas, true);
styledDocument.<API key>(7, 2, sas, false);
final FormattedText formatted = FormattedText.formatted(styledDocument, 0, 200);
assertEquals(text, formatted.toString());
assertEquals(expectedText, formatted.getFormatted());
assertEquals(text, formatted.getUnformatted());
final StyledDocument document = formatted.getDocument();
assertEquals(9, document.getEndPosition().getOffset());
assertEquals(0, document.getStartPosition().getOffset());
assertEquals(8, document.getLength());
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.