answer
stringlengths 15
1.25M
|
|---|
package com.mx.fic.inventory.business.builder;
import com.mx.fic.inventory.business.builder.config.AbstractDTOBuilder;
import com.mx.fic.inventory.business.builder.config.<API key>;
import com.mx.fic.inventory.dto.BaseDTO;
import com.mx.fic.inventory.dto.UserDetailDTO;
import com.mx.fic.inventory.persistent.BaseEntity;
import com.mx.fic.inventory.persistent.UserDetail;
@<API key> (dtoClass = UserDetailDTO.class, entityClass= UserDetail.class)
public class UserDetailBuilder extends AbstractDTOBuilder {
public BaseDTO createDTO(BaseEntity entity) {
UserDetailDTO userDetailDTO = new UserDetailDTO();
UserDetail userDetail = (UserDetail) entity;
userDetailDTO.setAddress(userDetail.getAddress());
userDetailDTO.setCurp(userDetail.getCurp());
userDetailDTO.setEmail(userDetail.getEmail());
userDetailDTO.setId(userDetail.getId());
userDetailDTO.setLastAccess(userDetail.getLastAccess());
userDetailDTO.setLastName(userDetail.getLastName());
userDetailDTO.setName(userDetail.getName());
userDetailDTO.setRfc(userDetail.getRfc());
userDetailDTO.setShortName(userDetail.getShortName());
userDetailDTO.setSurName(userDetail.getSurName());
return userDetailDTO;
}
}
|
export function Bounds(width, height) {
this.width = width;
this.height = height;
}
Bounds.prototype.equals = function(o) {
return ((o != null) && (this.width == o.width) && (this.height == o.height));
};
|
import {
<API key>,
<API key>,
<API key>,
} from "./attendance-status";
import { DatabaseField } from "../../../core/entity/database-field.decorator";
/**
* Simple relationship object to represent an individual child's status at an event including context information.
*/
export class EventAttendance {
private _status: <API key>;
@DatabaseField({
dataType: "configurable-enum",
innerDataType: <API key>,
})
get status(): <API key> {
return this._status;
}
set status(value) {
if (typeof value === "object") {
this._status = value;
} else {
this._status = <API key>;
}
}
@DatabaseField() remarks: string;
constructor(
status: <API key> = <API key>,
remarks: string = ""
) {
this.status = status;
this.remarks = remarks;
}
}
|
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue';
import BootstrapVue from 'bootstrap-vue';
import 'bootstrap-vue/dist/bootstrap-vue.css';
import 'bootstrap/dist/css/bootstrap.css';
import { mapActions } from 'vuex';
import App from './App';
import websock from './websock';
import * as mtype from './store/mutation-types';
import store from './store';
Vue.config.productionTip = false;
Vue.use(BootstrapVue);
/* eslint-disable no-new */
new Vue({
el: '#app',
template: '<App/>',
store,
components: { App },
created() {
websock.connect(message => this.newMessage(message));
setInterval(() => { store.commit(mtype.UPDATE_CALLS_DUR); }, 1000);
},
methods: mapActions(['newMessage']),
});
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
<meta charset="utf-8"/>
<title> » Deprecated elements
</title>
<meta name="author" content=""/>
<meta name="description" content=""/>
<link href="../css/bootstrap-combined.no-icons.min.css" rel="stylesheet">
<link href="../css/font-awesome.min.css" rel="stylesheet">
<link href="../css/prism.css" rel="stylesheet" media="all"/>
<link href="../css/template.css" rel="stylesheet" media="all"/>
<!--[if lt IE 9]>
<script src="../js/html5.js"></script>
<![endif]
<script src="../js/jquery-1.11.0.min.js"></script>
<script src="../js/ui/1.10.4/jquery-ui.min.js"></script>
<script src="../js/bootstrap.min.js"></script>
<script src="../js/jquery.smooth-scroll.js"></script>
<script src="../js/prism.min.js"></script>
<link rel="shortcut icon" href="../images/favicon.ico"/>
<link rel="apple-touch-icon" href="../images/apple-touch-icon.png"/>
<link rel="apple-touch-icon" sizes="72x72" href="../images/<API key>.png"/>
<link rel="apple-touch-icon" sizes="114x114" href="../images/<API key>.png"/>
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<i class="<API key>"></i>
</a>
<a class="brand" href="../index.html">DataUtilities</a>
<div class="nav-collapse">
<ul class="nav pull-right">
<li class="dropdown">
<a href="../index.html" class="dropdown-toggle" data-toggle="dropdown">
API Documentation <b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li><a href="../namespaces/Battis.html">\Battis</a></li>
</ul>
</li>
<li class="dropdown" id="charts-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Charts <b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li>
<a href="../graphs/class.html">
<i class="icon-list-alt"></i> Class hierarchy diagram
</a>
</li>
</ul>
</li>
<li class="dropdown" id="reports-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Reports <b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li>
<a href="../reports/errors.html">
<i class="icon-list-alt"></i> Errors <span class="label label-info pull-right">0</span>
</a>
</li>
<li>
<a href="../reports/markers.html">
<i class="icon-list-alt"></i> Markers <span class="label label-info pull-right">2</span>
</a>
</li>
<li>
<a href="../reports/deprecated.html">
<i class="icon-list-alt"></i> Deprecated <span class="label label-info pull-right">0</span>
</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
</div>
<!--<div class="go_to_top">-->
<!--</div>-->
</div>
<div id="___" class="container-fluid">
<div class="row-fluid">
<div class="span2 sidebar">
<ul class="side-nav nav nav-list">
<li class="nav-header">Navigation</li>
</ul>
</div>
<div class="span10 offset2">
<ul class="breadcrumb">
<li><a href="../"><i class="icon-remove-sign"></i></a><span class="divider">\</span></li>
<li>Deprecated elements</li>
</ul>
<div id="marker-accordion">
<div class="alert alert-info">No deprecated elements have been found in this project.</div>
</table>
</div>
</div>
</div>
</div>
<footer class="row-fluid">
<section class="span10 offset2">
<section class="row-fluid">
<section class="span10 offset1">
<section class="row-fluid footer-sections">
<section class="span4">
<h1><i class="icon-code"></i></h1>
<div>
<ul>
<li><a href="../namespaces/Battis.html">\Battis</a></li>
</ul>
</div>
</section>
<section class="span4">
<h1><i class="icon-bar-chart"></i></h1>
<div>
<ul>
<li><a href="../graphs/class.html">Class Hierarchy Diagram</a></li>
</ul>
</div>
</section>
<section class="span4">
<h1><i class="icon-pushpin"></i></h1>
<div>
<ul>
<li><a href="../reports/errors.html">Errors</a></li>
<li><a href="../reports/markers.html">Markers</a></li>
</ul>
</div>
</section>
</section>
</section>
</section>
<section class="row-fluid">
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http:
on May 29th, 2017 at 14:17.
</section>
</section>
</section>
</footer>
</div>
</body>
</html>
|
#include "hal/time/time.hpp"
namespace hal
{
namespace time
{
static u64 currentTime = 0;
u64 milliseconds()
{
return currentTime;
}
} // namespace time
} // namespace hal
namespace stub
{
namespace time
{
void setCurrentTime(u64 milliseconds)
{
hal::time::currentTime = milliseconds;
}
void forwardTime(u64 milliseconds)
{
hal::time::currentTime += milliseconds;
}
} // namespace time
} // namespace stub
|
<?php
// Moodle is free software: you can redistribute it and/or modify
// (at your option) any later version.
// Moodle is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
require_once 'cc_utils.php';
require_once 'cc_version_base.php';
require_once 'cc_organization.php';
/**
* Version 1 class of Common Cartridge
*
*/
class cc_version1 extends cc_version_base {
const webcontent = 'webcontent';
const questionbank = 'imsqti_xmlv1p2/imscc_xmlv1p0/question-bank';
const assessment = 'imsqti_xmlv1p2/imscc_xmlv1p0/assessment';
const associatedcontent = 'associatedcontent/imscc_xmlv1p0/<API key>';
const discussiontopic = 'imsdt_xmlv1p0';
const weblink = 'imswl_xmlv1p0';
public static $checker = array(self::webcontent,
self::assessment,
self::associatedcontent,
self::discussiontopic,
self::questionbank,
self::weblink);
/**
* Validate if the type are valid or not
*
* @param string $type
* @return bool
*/
public function valid($type) {
return in_array($type, self::$checker);
}
public function __construct() {
$this->ccnamespaces = array('imscc' => 'http:
'lomimscc' => 'http://ltsc.ieee.org/xsd/imscc/LOM',
'lom' => 'http://ltsc.ieee.org/xsd/LOM',
'voc' => 'http://ltsc.ieee.org/xsd/LOM/vocab',
'xsi' => 'http:
);
$this->ccnsnames = array('imscc' => 'http:
'lom' => 'http:
'lomimscc' => 'http:
'voc' => 'http:
);
$this->ccversion = '1.0.0';
$this->camversion = '1.0.0';
$this->_generator = 'Moodle 2 Common Cartridge generator';
}
protected function on_create(DOMDocument &$doc, $rootmanifestnode=null,$nmanifestID=null) {
$doc->formatOutput = true;
$doc->preserveWhiteSpace = true;
$this->manifestID = is_null($nmanifestID) ? cc_helpers::uuidgen('M_') : $nmanifestID;
$mUUID = $doc->createAttribute('identifier');
$mUUID->nodeValue = $this->manifestID;
if (is_null($rootmanifestnode)) {
if (!empty($this->_generator)) {
$comment = $doc->createComment($this->_generator);
$doc->appendChild($comment);
}
$rootel = $doc->createElementNS($this->ccnamespaces['imscc'],'manifest');
$rootel->appendChild($mUUID);
$doc->appendChild($rootel);
//add all namespaces
foreach ($this->ccnamespaces as $key => $value) {
if ($key != 'lom' ){
$dummy_attr = $key.":dummy";
$doc->createAttributeNS($value,$dummy_attr);
}
}
// add location of schemas
$schemaLocation='';
foreach ($this->ccnsnames as $key => $value) {
$vt = empty($schemaLocation) ? '' : ' ';
$schemaLocation .= $vt.$this->ccnamespaces[$key].' '.$value;
}
$aSchemaLoc = $doc->createAttributeNS($this->ccnamespaces['xsi'],'xsi:schemaLocation');
$aSchemaLoc->nodeValue=$schemaLocation;
$rootel->appendChild($aSchemaLoc);
} else {
$rootel = $doc->createElementNS($this->ccnamespaces['imscc'],'imscc:manifest');
$rootel->appendChild($mUUID);
}
$metadata = $doc->createElementNS($this->ccnamespaces['imscc'],'metadata');
$schema = $doc->createElementNS($this->ccnamespaces['imscc'],'schema','IMS Common Cartridge');
$schemaversion = $doc->createElementNS($this->ccnamespaces['imscc'],'schemaversion',$this->ccversion);
$metadata->appendChild($schema);
$metadata->appendChild($schemaversion);
$rootel->appendChild($metadata);
if (!is_null($rootmanifestnode)) {
$rootmanifestnode->appendChild($rootel);
}
$organizations = $doc->createElementNS($this->ccnamespaces['imscc'],'organizations');
$rootel->appendChild($organizations);
$resources = $doc->createElementNS($this->ccnamespaces['imscc'],'resources');
$rootel->appendChild($resources);
return true;
}
protected function update_attribute(DOMDocument &$doc, $attrname, $attrvalue, DOMElement &$node) {
$busenew = (is_object($node) && $node->hasAttribute($attrname));
$nResult = null;
if (!$busenew && is_null($attrvalue)) {
$node->removeAttribute($attrname);
} else {
$nResult = $busenew ? $node->getAttributeNode($attrname) : $doc->createAttribute($attrname);
$nResult->nodeValue = $attrvalue;
if (!$busenew) {
$node->appendChild($nResult);
}
}
return $nResult;
}
protected function update_attribute_ns(DOMDocument &$doc, $attrname, $attrnamespace,$attrvalue, DOMElement &$node) {
$busenew = (is_object($node) && $node->hasAttributeNS($attrnamespace, $attrname));
$nResult = null;
if (!$busenew && is_null($attrvalue)) {
$node->removeAttributeNS($attrnamespace, $attrname);
} else {
$nResult = $busenew ? $node->getAttributeNodeNS($attrnamespace, $attrname) : $doc->createAttributeNS($attrnamespace, $attrname);
$nResult->nodeValue = $attrvalue;
if (!$busenew) {
$node->appendChild($nResult);
}
}
return $nResult;
}
protected function get_child_node(DOMDocument &$doc, $itemname, DOMElement &$node) {
$nlist = $node-><API key>($itemname);
$item = is_object($nlist) && ($nlist->length > 0) ? $nlist->item(0) : null;
return $item;
}
protected function update_child_item(DOMDocument &$doc, $itemname, $itemvalue, DOMElement &$node, $attrtostore=null) {
$tnode = $this->get_child_node($doc,'title',$node);
$usenew = is_null($tnode);
$tnode = $usenew ? $doc->createElementNS($this->ccnamespaces['imscc'], $itemname) : $tnode;
if (!is_null($attrtostore)) {
foreach ($attrtostore as $key => $value) {
$this->update_attribute($doc,$key,$value,$tnode);
}
}
$tnode->nodeValue = $itemvalue;
if ($usenew) {
$node->appendChild($tnode);
}
}
protected function update_items($items, DOMDocument &$doc, DOMElement &$xmlnode) {
foreach ($items as $key => $item) {
$itemnode = $doc->createElementNS($this->ccnamespaces['imscc'], 'item');
$this->update_attribute($doc, 'identifier' , $key , $itemnode);
$this->update_attribute($doc, 'identifierref', $item->identifierref, $itemnode);
$this->update_attribute($doc, 'parameters' , $item->parameters , $itemnode);
if (!empty($item->title)) {
$titlenode = $doc->createElementNS($this->ccnamespaces['imscc'],
'title',
$item->title);
$itemnode->appendChild($titlenode);
}
if ($item->has_child_items()) {
$this->update_items($item->childitems, $doc, $itemnode);
}
$xmlnode->appendChild($itemnode);
}
}
/**
* Create a Resource (How to)
*
* @param cc_i_resource $res
* @param DOMDocument $doc
* @param object $xmlnode
* @return DOMNode
*/
protected function create_resource(cc_i_resource &$res, DOMDocument &$doc, $xmlnode=null) {
$usenew = is_object($xmlnode);
$dnode = $usenew ? $xmlnode : $doc->createElementNS($this->ccnamespaces['imscc'], "resource");
$this->update_attribute($doc,'identifier',$res->identifier,$dnode);
$this->update_attribute($doc,'type' ,$res->type ,$dnode);
!is_null($res->href) ? $this->update_attribute($doc,'href',$res->href,$dnode): null;
$this->update_attribute($doc,'base' ,$res->base ,$dnode);
foreach ($res->files as $file) {
$nd = $doc->createElementNS($this->ccnamespaces['imscc'],'file');
$ndatt = $doc->createAttribute('href');
$ndatt->nodeValue = $file;
$nd->appendChild($ndatt);
$dnode->appendChild($nd);
}
$this->resources[$res->identifier] = $res;
foreach ($res->dependency as $dependency){
$nd = $doc->createElementNS($this->ccnamespaces['imscc'],'dependency');
$ndatt = $doc->createAttribute('identifierref');
$ndatt->nodeValue = $dependency;
$nd->appendChild($ndatt);
$dnode->appendChild($nd);
}
return $dnode;
}
/**
* Create an Item Folder (How To)
*
* @param cc_i_organization $org
* @param DOMDocument $doc
* @param DOMElement $xmlnode
*/
protected function create_item_folder (cc_i_organization &$org, DOMDocument &$doc, DOMElement &$xmlnode=null){
$itemfoldernode = $doc->createElementNS($this->ccnamespaces['imscc'],'item');
$this->update_attribute($doc,'identifier', "root", $itemfoldernode);
if ($org->has_items()) {
$this->update_items($org->itemlist, $doc, $itemfoldernode);
}
if (is_null($this->organizations)) {
$this->organizations = array();
}
$this->organizations[$org->identifier] = $org;
$xmlnode->appendChild($itemfoldernode);
}
/**
* Create an Organization (How To)
*
* @param cc_i_organization $org
* @param DOMDocument $doc
* @param object $xmlnode
* @return DOMNode
*/
protected function create_organization (cc_i_organization &$org, DOMDocument &$doc, $xmlnode=null){
$usenew = is_object($xmlnode);
$dnode = $usenew ? $xmlnode : $doc->createElementNS($this->ccnamespaces['imscc'], "organization");
$this->update_attribute($doc,'identifier' ,$org->identifier,$dnode);
$this->update_attribute($doc,'structure' ,$org->structure ,$dnode);
$this->create_item_folder($org,$doc,$dnode);
return $dnode;
}
/**
* Create Metadata For Manifest (How To)
*
* @param <API key> $met
* @param DOMDocument $doc
* @param object $xmlnode
* @return DOMNode
*/
protected function <API key> (<API key> $met,DOMDocument &$doc,$xmlnode=null) {
$dnode = $doc->createElementNS($this->ccnamespaces['lomimscc'], "lom");
if (!empty($xmlnode)) {
$xmlnode->appendChild($dnode);
}
$dnodegeneral = empty($met->arraygeneral ) ? null : $this-><API key> ($met, $doc, $xmlnode);
$dnodetechnical = empty($met->arraytech ) ? null : $this-><API key>($met, $doc, $xmlnode);
$dnoderights = empty($met->arrayrights ) ? null : $this-><API key> ($met, $doc, $xmlnode);
$dnodelifecycle = empty($met->arraylifecycle) ? null : $this-><API key>($met, $doc, $xmlnode);
!is_null($dnodegeneral)?$dnode->appendChild($dnodegeneral):null;
!is_null($dnodetechnical)?$dnode->appendChild($dnodetechnical):null;
!is_null($dnoderights)?$dnode->appendChild($dnoderights):null;
!is_null($dnodelifecycle)?$dnode->appendChild($dnodelifecycle):null;
return $dnode;
}
/**
* Create Metadata For Resource (How To)
*
* @param <API key> $met
* @param DOMDocument $doc
* @param object $xmlnode
* @return DOMNode
*/
protected function <API key> (<API key> $met,DOMDocument &$doc,$xmlnode=null) {
$dnode = $doc->createElementNS($this->ccnamespaces['lom'], "lom");
!empty($xmlnode)? $xmlnode->appendChild($dnode):null;
!empty($met->arrayeducational) ? $this-><API key>($met,$doc,$dnode):null;
return $dnode;
}
/**
* Create Metadata For File (How To)
*
* @param cc_i_metadata_file $met
* @param DOMDocument $doc
* @param Object $xmlnode
* @return DOMNode
*/
protected function <API key> (cc_i_metadata_file $met,DOMDocument &$doc,$xmlnode=null) {
$dnode = $doc->createElementNS($this->ccnamespaces['lom'], "lom");
!empty($xmlnode)? $xmlnode->appendChild($dnode):null;
!empty($met->arrayeducational) ? $this-><API key>($met,$doc,$dnode):null;
return $dnode;
}
/**
* Create General Metadata (How To)
*
* @param object $met
* @param DOMDocument $doc
* @param object $xmlnode
* @return DOMNode
*/
protected function <API key>($met,DOMDocument &$doc,$xmlnode){
($xmlnode);
$nd = $doc->createElementNS($this->ccnamespaces['lomimscc'],'general');
foreach ($met->arraygeneral as $name => $value) {
!is_array($value)?$value =array($value):null;
foreach ($value as $k => $v){
($k);
if ($name != 'language' && $name != 'catalog' && $name != 'entry'){
$nd2 = $doc->createElementNS($this->ccnamespaces['lomimscc'],$name);
$nd3 = $doc->createElementNS($this->ccnamespaces['lomimscc'],'string',$v[1]);
$ndatt = $doc->createAttribute('language');
$ndatt->nodeValue = $v[0];
$nd3->appendChild($ndatt);
$nd2->appendChild($nd3);
$nd->appendChild($nd2);
}else{
if ($name == 'language'){
$nd2 = $doc->createElementNS($this->ccnamespaces['lomimscc'],$name,$v[0]);
$nd->appendChild($nd2);
}
}
}
}
if (!empty($met->arraygeneral['catalog']) || !empty($met->arraygeneral['entry'])){
$nd2 = $doc->createElementNS($this->ccnamespaces['lomimscc'],'identifier');
$nd->appendChild($nd2);
if (!empty($met->arraygeneral['catalog'])){
$nd3 = $doc->createElementNS($this->ccnamespaces['lomimscc'],'catalog',$met->arraygeneral['catalog'][0][0]);
$nd2->appendChild($nd3);
}
if (!empty($met->arraygeneral['entry'])){
$nd4 = $doc->createElementNS($this->ccnamespaces['lomimscc'],'entry',$met->arraygeneral['entry'][0][0]);
$nd2->appendChild($nd4);
}
}
return $nd;
}
/**
* Create Technical Metadata (How To)
*
* @param object $met
* @param DOMDocument $doc
* @param object $xmlnode
* @return DOMNode
*/
protected function <API key>($met,DOMDocument &$doc,$xmlnode){
($xmlnode);
$nd = $doc->createElementNS($this->ccnamespaces['lomimscc'],'technical');
$xmlnode->appendChild($nd);
foreach ($met->arraytech as $name => $value) {
($name);
!is_array($value)?$value =array($value):null;
foreach ($value as $k => $v){
($k);
$nd2 = $doc->createElementNS($this->ccnamespaces['lomimscc'],$name,$v[0]);
$nd->appendChild($nd2);
}
}
return $nd;
}
/**
* Create Rights Metadata (How To)
*
* @param object $met
* @param DOMDocument $doc
* @param object $xmlnode
* @return DOMNode
*/
protected function <API key>($met,DOMDocument &$doc,$xmlnode){
($xmlnode);
$nd = $doc->createElementNS($this->ccnamespaces['lomimscc'],'rights');
foreach ($met->arrayrights as $name => $value) {
!is_array($value)?$value =array($value):null;
foreach ($value as $k => $v){
($k);
if ($name == 'description'){
$nd2 = $doc->createElementNS($this->ccnamespaces['lomimscc'],$name);
$nd3 = $doc->createElementNS($this->ccnamespaces['lomimscc'],'string',$v[1]);
$ndatt = $doc->createAttribute('language');
$ndatt->nodeValue = $v[0];
$nd3->appendChild($ndatt);
$nd2->appendChild($nd3);
$nd->appendChild($nd2);
}elseif ($name == '<API key>' || $name == 'cost'){
$nd2 = $doc->createElementNS($this->ccnamespaces['lomimscc'],$name);
$nd3 = $doc->createElementNS($this->ccnamespaces['lomimscc'],'value',$v[0]);
$nd2->appendChild($nd3);
$nd->appendChild($nd2);
}
}
}
return $nd;
}
/**
* Create LifeCyle Metadata (How To)
*
* @param object $met
* @param DOMDocument $doc
* @param object $xmlnode
* @return DOMNode
*/
protected function <API key>($met,DOMDocument &$doc,$xmlnode){
($xmlnode);
$nd = $doc->createElementNS($this->ccnamespaces['lomimscc'],'lifeCycle');
$nd2= $doc->createElementNS($this->ccnamespaces['lomimscc'],'contribute');
$nd->appendChild ($nd2);
$xmlnode->appendChild ($nd);
foreach ($met->arraylifecycle as $name => $value) {
!is_array($value)?$value =array($value):null;
foreach ($value as $k => $v){
($k);
if ($name == 'role'){
$nd3 = $doc->createElementNS($this->ccnamespaces['lomimscc'],$name);
$nd2->appendChild($nd3);
$nd4 = $doc->createElementNS($this->ccnamespaces['lomimscc'],'value',$v[0]);
$nd3->appendChild($nd4);
}else{
if ($name == 'date'){
$nd3 = $doc->createElementNS($this->ccnamespaces['lomimscc'],$name);
$nd2->appendChild($nd3);
$nd4 = $doc->createElementNS($this->ccnamespaces['lomimscc'],'dateTime',$v[0]);
$nd3->appendChild($nd4);
}else{
$nd3 = $doc->createElementNS($this->ccnamespaces['lomimscc'],$name,$v[0]);
$nd2->appendChild($nd3);
}
}
}
}
return $nd;
}
/**
* Create Education Metadata (How To)
*
* @param object $met
* @param DOMDocument $doc
* @param object $xmlnode
* @return DOMNode
*/
protected function <API key> ($met,DOMDocument &$doc, $xmlnode){
$nd = $doc->createElementNS($this->ccnamespaces['lom'],'educational');
$nd2 = $doc->createElementNS($this->ccnamespaces['lom'],'intendedEndUserRole');
$nd3 = $doc->createElementNS($this->ccnamespaces['voc'],'vocabulary');
$xmlnode->appendChild($nd);
$nd->appendChild($nd2);
$nd2->appendChild($nd3);
foreach ($met->arrayeducational as $name => $value) {
!is_array($value)?$value =array($value):null;
foreach ($value as $k => $v){
($k);
$nd4 = $doc->createElementNS($this->ccnamespaces['voc'],$name,$v[0]);
$nd3->appendChild($nd4);
}
}
return $nd;
}
}
|
package com.programandoapasitos.facturador.gui;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JLabel;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import com.programandoapasitos.facturador.gui.superclases.FramePadre;
import com.programandoapasitos.facturador.utiles.ManejadorProperties;
@SuppressWarnings("serial")
public class MenuPrincipal extends FramePadre {
// Propiedades
private JLabel lblIcono;
private JMenuBar menuBar;
private JMenu mnClientes;
private JMenu mnFacturas;
private JMenuItem mntmNuevaFactura;
private JMenuItem mntmNuevoCliente;
private JMenuItem mntmBuscarFactura;
private JMenuItem mntmBuscarCliente;
// Constructor
public MenuPrincipal(int ancho, int alto, String titulo) {
super(ancho, alto, titulo);
this.inicializar();
}
public void inicializar() {
this.inicializarMenuBar();
this.iniciarLabels();
<API key>(JFrame.EXIT_ON_CLOSE); // Sobrescribe <API key> de FramePadre
setVisible(true);
}
public void inicializarMenuBar() {
menuBar = new JMenuBar();
menuBar.setBounds(0, 0, 900, 21);
this.panel.add(menuBar);
this.<API key>();
this.<API key>();
}
/**
* Initialize submenu Bills
*/
public void <API key>() {
mnFacturas = new JMenu(ManejadorProperties.verLiteral("MENU_FACTURAS"));
menuBar.add(mnFacturas);
mntmNuevaFactura = new JMenuItem(ManejadorProperties.verLiteral("MENU_ITEM_NEW_BILL"));
mntmNuevaFactura.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
new FrameNuevaFactura(ManejadorProperties.verGui("SUBFRAMES_WIDTH"), ManejadorProperties.verGui("SUBFRAMES_HEIGHT"), ManejadorProperties.verLiteral("MENU_ITEM_NEW_BILL"));
}
});
mnFacturas.add(mntmNuevaFactura);
mntmBuscarFactura = new JMenuItem(ManejadorProperties.verLiteral("<API key>"));
mntmBuscarFactura.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new FrameBuscarFacturas(ManejadorProperties.verGui("SUBFRAMES_WIDTH"), ManejadorProperties.verGui("SUBFRAMES_HEIGHT"), ManejadorProperties.verLiteral("<API key>"));
}
});
mnFacturas.add(mntmBuscarFactura);
}
public void <API key>() {
mnClientes = new JMenu(ManejadorProperties.verLiteral("MENU_CLIENTES"));
menuBar.add(mnClientes);
mntmNuevoCliente = new JMenuItem(ManejadorProperties.verLiteral("<API key>"));
mntmNuevoCliente.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new FrameNuevoCliente(ManejadorProperties.verGui("SUBFRAMES_WIDTH"), ManejadorProperties.verGui("SUBFRAMES_HEIGHT"), ManejadorProperties.verLiteral("<API key>"));
}
});
mnClientes.add(mntmNuevoCliente);
mntmBuscarCliente = new JMenuItem(ManejadorProperties.verLiteral("<API key>"));
mntmBuscarCliente.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
new FrameBuscarClientes(ManejadorProperties.verGui("SUBFRAMES_WIDTH"), ManejadorProperties.verGui("SUBFRAMES_HEIGHT"), ManejadorProperties.verLiteral("<API key>"));
}
});
mnClientes.add(mntmBuscarCliente);
}
/**
* Initialize icon label
*/
public void iniciarLabels() {
lblIcono = new JLabel("");
lblIcono.setIcon(new ImageIcon(ManejadorProperties.verRuta("<API key>")));
lblIcono.setBounds(342, 240, 210, 124);
this.panel.add(lblIcono);
}
}
|
# Sweep with the pawns
This rule will have all pawns sweep the board, trying to defeat as many pieces as possible. We will assume we have all pawns in the front row.
The idea is to have them all stay in a row: first, they will all advance to row 2, then to row 3, and so on, without breaking formation.
(defrule EQUIPO-A::advance_pawns_f2
(declare (salience 60))
(tiempo ?t)
(ficha (equipo "A") (num ?n) (pos-y 2) (puntos 2))
=>
(assert (mueve (num ?n) (mov 3) (tiempo ?t)))
)
(defrule EQUIPO-A::advance_pawns_f3
(declare (salience 59))
(tiempo ?t)
(ficha (equipo "A") (num ?n) (pos-y 3) (puntos 2))
=>
(assert (mueve (num ?n) (mov 3) (tiempo ?t)))
)
(defrule EQUIPO-A::advance_pawns_f4
(declare (salience 58))
(tiempo ?t)
(ficha (equipo "A") (num ?n) (pos-y 4) (puntos 2))
=>
(assert (mueve (num ?n) (mov 3) (tiempo ?t)))
)
(defrule EQUIPO-A::advance_pawns_f5
(declare (salience 57))
(tiempo ?t)
(ficha (equipo "A") (num ?n) (pos-y 5) (puntos 2))
=>
(assert (mueve (num ?n) (mov 3) (tiempo ?t)))
)
(defrule EQUIPO-A::advance_pawns_f6
(declare (salience 56))
(tiempo ?t)
(ficha (equipo "A") (num ?n) (pos-y 6) (puntos 2))
=>
(assert (mueve (num ?n) (mov 3) (tiempo ?t)))
)
(defrule EQUIPO-A::advance_pawns_f7
(declare (salience 55))
(tiempo ?t)
(ficha (equipo "A") (num ?n) (pos-y 7) (puntos 2))
=>
(assert (mueve (num ?n) (mov 3) (tiempo ?t)))
)
There is a rule for each piece, since doing it in a more parametric form would increase the complexity significantly. This also allows for tweaking the priority, changing the order in which pawns advance to the next row.
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#include "common.h"
#include "seafile-session.h"
#include "bloom-filter.h"
#include "gc-core.h"
#include "utils.h"
#define DEBUG_FLAG SEAFILE_DEBUG_OTHER
#include "log.h"
#define MAX_BF_SIZE (((size_t)1) << 29) /* 64 MB */
/* Total number of blocks to be scanned. */
static guint64 total_blocks;
static guint64 removed_blocks;
static guint64 reachable_blocks;
static Bloom *
alloc_gc_index ()
{
size_t size;
size = (size_t) MAX(total_blocks << 2, 1 << 13);
size = MIN (size, MAX_BF_SIZE);
seaf_message ("GC index size is %u Byte.\n", (int)size >> 3);
return bloom_create (size, 3, 0);
}
typedef struct {
SeafRepo *repo;
Bloom *index;
GHashTable *visited;
/* > 0: keep a period of history;
* == 0: only keep data in head commit;
* < 0: keep all history data.
*/
gint64 truncate_time;
gboolean traversed_head;
int traversed_commits;
gint64 traversed_blocks;
gboolean ignore_errors;
} GCData;
static int
add_blocks_to_index (SeafFSManager *mgr, GCData *data, const char *file_id)
{
SeafRepo *repo = data->repo;
Bloom *index = data->index;
Seafile *seafile;
int i;
seafile = <API key> (mgr, repo->store_id, repo->version, file_id);
if (!seafile) {
seaf_warning ("Failed to find file %s.\n", file_id);
return -1;
}
for (i = 0; i < seafile->n_blocks; ++i) {
bloom_add (index, seafile->blk_sha1s[i]);
++data->traversed_blocks;
}
seafile_unref (seafile);
return 0;
}
static gboolean
fs_callback (SeafFSManager *mgr,
const char *store_id,
int version,
const char *obj_id,
int type,
void *user_data,
gboolean *stop)
{
GCData *data = user_data;
if (data->visited != NULL) {
if (g_hash_table_lookup (data->visited, obj_id) != NULL) {
*stop = TRUE;
return TRUE;
}
char *key = g_strdup(obj_id);
g_hash_table_insert (data->visited, key, key);
}
if (type == <API key> &&
add_blocks_to_index (mgr, data, obj_id) < 0)
return FALSE;
return TRUE;
}
static gboolean
traverse_commit (SeafCommit *commit, void *vdata, gboolean *stop)
{
GCData *data = vdata;
int ret;
if (data->truncate_time == 0)
{
*stop = TRUE;
/* Stop after traversing the head commit. */
}
else if (data->truncate_time > 0 &&
(gint64)(commit->ctime) < data->truncate_time &&
data->traversed_head)
{
/* Still traverse the first commit older than truncate_time.
* If a file in the child commit of this commit is deleted,
* we need to access this commit in order to restore it
* from trash.
*/
*stop = TRUE;
}
if (!data->traversed_head)
data->traversed_head = TRUE;
seaf_debug ("Traversed commit %.8s.\n", commit->commit_id);
++data->traversed_commits;
ret = <API key> (seaf->fs_mgr,
data->repo->store_id, data->repo->version,
commit->root_id,
fs_callback,
data, data->ignore_errors);
if (ret < 0 && !data->ignore_errors)
return FALSE;
return TRUE;
}
static int
<API key> (SeafRepo *repo, Bloom *index, gboolean ignore_errors)
{
GList *branches, *ptr;
SeafBranch *branch;
GCData *data;
int ret = 0;
seaf_message ("Populating index for repo %.8s.\n", repo->id);
branches = <API key> (seaf->branch_mgr, repo->id);
if (branches == NULL) {
seaf_warning ("[GC] Failed to get branch list of repo %s.\n", repo->id);
return -1;
}
data = g_new0(GCData, 1);
data->repo = repo;
data->index = index;
data->visited = <API key> (g_str_hash, g_str_equal, g_free, NULL);
gint64 truncate_time = <API key> (repo->manager,
repo->id);
if (truncate_time > 0) {
<API key> (repo->manager,
repo->id,
truncate_time);
} else if (truncate_time == 0) {
/* Only the head commit is valid after GC if no history is kept. */
SeafCommit *head = <API key> (seaf->commit_mgr,
repo->id, repo->version,
repo->head->commit_id);
if (head)
<API key> (repo->manager,
repo->id,
head->ctime);
seaf_commit_unref (head);
}
data->truncate_time = truncate_time;
data->ignore_errors = ignore_errors;
for (ptr = branches; ptr != NULL; ptr = ptr->next) {
branch = ptr->data;
gboolean res = <API key> (seaf->commit_mgr,
repo->id,
repo->version,
branch->commit_id,
traverse_commit,
data,
ignore_errors);
seaf_branch_unref (branch);
if (!res && !ignore_errors) {
ret = -1;
break;
}
}
seaf_message ("Traversed %d commits, %"G_GINT64_FORMAT" blocks.\n",
data->traversed_commits, data->traversed_blocks);
reachable_blocks += data->traversed_blocks;
g_list_free (branches);
<API key> (data->visited);
g_free (data);
return ret;
}
typedef struct {
Bloom *index;
int dry_run;
} CheckBlocksData;
static gboolean
<API key> (const char *store_id, int version,
const char *block_id, void *vdata)
{
CheckBlocksData *data = vdata;
Bloom *index = data->index;
if (!bloom_test (index, block_id)) {
++removed_blocks;
if (!data->dry_run)
<API key> (seaf->block_mgr,
store_id, version,
block_id);
}
return TRUE;
}
static int
<API key> (SeafRepo *repo, Bloom *index, int ignore_errors)
{
GList *vrepo_ids = NULL, *ptr;
char *repo_id;
SeafRepo *vrepo;
int ret = 0;
vrepo_ids = <API key> (seaf->repo_mgr,
repo->id);
for (ptr = vrepo_ids; ptr; ptr = ptr->next) {
repo_id = ptr->data;
vrepo = <API key> (seaf->repo_mgr, repo_id);
if (!vrepo) {
seaf_warning ("Failed to get repo %s.\n", repo_id);
if (!ignore_errors) {
ret = -1;
goto out;
} else
continue;
}
ret = <API key> (vrepo, index, ignore_errors);
seaf_repo_unref (vrepo);
if (ret < 0 && !ignore_errors)
goto out;
}
out:
string_list_free (vrepo_ids);
return ret;
}
int
gc_v1_repo (SeafRepo *repo, int dry_run, int ignore_errors)
{
Bloom *index;
int ret;
total_blocks = <API key> (seaf->block_mgr,
repo->store_id, repo->version);
removed_blocks = 0;
reachable_blocks = 0;
if (total_blocks == 0) {
seaf_message ("No blocks. Skip GC.\n");
return 0;
}
seaf_message ("GC started. Total block number is %"G_GUINT64_FORMAT".\n", total_blocks);
/*
* Store the index of live blocks in bloom filter to save memory.
* Since bloom filters only have false-positive, we
* may skip some garbage blocks, but we won't delete
* blocks that are still alive.
*/
index = alloc_gc_index ();
if (!index) {
seaf_warning ("GC: Failed to allocate index.\n");
return -1;
}
seaf_message ("Populating index.\n");
ret = <API key> (repo, index, ignore_errors);
if (ret < 0 && !ignore_errors)
goto out;
/* Since virtual repos share fs and block store with the origin repo,
* it's necessary to do GC for them together.
*/
ret = <API key> (repo, index, ignore_errors);
if (ret < 0 && !ignore_errors)
goto out;
if (!dry_run)
seaf_message ("Scanning and deleting unused blocks.\n");
else
seaf_message ("Scanning unused blocks.\n");
CheckBlocksData data;
data.index = index;
data.dry_run = dry_run;
ret = <API key> (seaf->block_mgr,
repo->store_id, repo->version,
<API key>,
&data);
if (ret < 0) {
seaf_warning ("GC: Failed to clean dead blocks.\n");
goto out;
}
if (!dry_run)
seaf_message ("GC finished. %"G_GUINT64_FORMAT" blocks total, "
"about %"G_GUINT64_FORMAT" reachable blocks, "
"%"G_GUINT64_FORMAT" blocks are removed.\n",
total_blocks, reachable_blocks, removed_blocks);
else
seaf_message ("GC finished. %"G_GUINT64_FORMAT" blocks total, "
"about %"G_GUINT64_FORMAT" reachable blocks, "
"%"G_GUINT64_FORMAT" blocks can be removed.\n",
total_blocks, reachable_blocks, removed_blocks);
out:
bloom_destroy (index);
return ret;
}
int
gc_core_run (int dry_run)
{
GList *repos = NULL, *del_repos = NULL, *ptr;
SeafRepo *repo;
GList *corrupt_repos = NULL;
gboolean error = FALSE;
repos = <API key> (seaf->repo_mgr, -1, -1, &error);
if (error) {
seaf_warning ("Failed to load repo list.\n");
return -1;
}
for (ptr = repos; ptr; ptr = ptr->next) {
repo = ptr->data;
if (repo->is_corrupted) {
corrupt_repos = g_list_prepend (corrupt_repos, g_strdup(repo->id));
continue;
}
if (!repo->is_virtual) {
seaf_message ("GC version %d repo %s(%.8s)\n",
repo->version, repo->name, repo->id);
if (gc_v1_repo (repo, dry_run, FALSE) < 0)
corrupt_repos = g_list_prepend (corrupt_repos, g_strdup(repo->id));
}
seaf_repo_unref (repo);
}
g_list_free (repos);
seaf_message ("=== GC deleted repos ===\n");
del_repos = <API key> (seaf->repo_mgr);
for (ptr = del_repos; ptr; ptr = ptr->next) {
char *repo_id = ptr->data;
/* Confirm repo doesn't exist before removing blocks. */
if (!<API key> (seaf->repo_mgr, repo_id)) {
if (!dry_run) {
seaf_message ("GC deleted repo %.8s.\n", repo_id);
<API key> (seaf->block_mgr, repo_id);
} else {
seaf_message ("Repo %.8s can be GC'ed.\n", repo_id);
}
}
if (!dry_run)
<API key> (seaf->repo_mgr, repo_id);
g_free (repo_id);
}
g_list_free (del_repos);
seaf_message ("=== GC is finished ===\n");
if (corrupt_repos) {
seaf_message ("The following repos are corrupted. "
"You can run seaf-fsck to fix them.\n");
for (ptr = corrupt_repos; ptr; ptr = ptr->next) {
char *repo_id = ptr->data;
seaf_message ("%s\n", repo_id);
g_free (repo_id);
}
g_list_free (corrupt_repos);
}
return 0;
}
|
\hypertarget{<API key>}{\section{src/interfaces/\+Factory\+Controller.cpp File Reference}
\label{<API key>}\index{src/interfaces/\+Factory\+Controller.\+cpp@{src/interfaces/\+Factory\+Controller.\+cpp}}
}
{\ttfamily \#include \char`\"{}I\+Controller.\+h\char`\"{}}\\*
{\ttfamily \#include $<$src/logic/controller/\+Controller.\+h$>$}\\*
Include dependency graph for Factory\+Controller.\+cpp\+:
|
// TODO: implement a more inteligent way to store cached memory
// TODO: define limit of max mem to cache
#include "r_io.h"
static void cache_item_free(RIOCache *cache) {
if (!cache)
return;
if (cache->data)
free (cache->data);
free (cache);
}
R_API void r_io_cache_init(RIO *io) {
io->cache = r_list_new ();
io->cache->free = (RListFree)cache_item_free;
io->cached = R_FALSE; // cache write ops
io->cached_read = R_FALSE; // cached read ops
}
R_API void r_io_cache_enable(RIO *io, int read, int write) {
io->cached = read | write;
io->cached_read = read;
}
R_API void r_io_cache_commit(RIO *io) {
RListIter *iter;
RIOCache *c;
if (io->cached) {
io->cached = R_FALSE;
r_list_foreach (io->cache, iter, c) {
if (!r_io_write_at (io, c->from, c->data, c->size))
eprintf ("Error writing change at 0x%08"PFMT64x"\n", c->from);
}
io->cached = R_TRUE;
r_io_cache_reset (io, io->cached);
}
}
R_API void r_io_cache_reset(RIO *io, int set) {
io->cached = set;
r_list_purge (io->cache);
}
R_API int <API key>(RIO *io, ut64 from, ut64 to) {
RListIter *iter, *iter_tmp;
RIOCache *c;
if (from>=to) return R_FALSE;
r_list_foreach_safe (io->cache, iter, iter_tmp, c) {
if (c->from >= from && c->to <= to) {
r_list_delete (io->cache, iter);
}
}
return R_FALSE;
}
R_API int r_io_cache_list(RIO *io, int rad) {
int i, j = 0;
RListIter *iter;
RIOCache *c;
r_list_foreach (io->cache, iter, c) {
if (rad) {
io->printf ("wx ");
for (i=0; i<c->size; i++)
io->printf ("%02x", c->data[i]);
io->printf (" @ 0x%08"PFMT64x"\n", c->from);
} else {
io->printf ("idx=%d addr=0x%08"PFMT64x" size=%d ",
j, c->from, c->size);
for (i=0; i<c->size; i++)
io->printf ("%02x", c->data[i]);
io->printf ("\n");
}
j++;
}
return R_FALSE;
}
R_API int r_io_cache_write(RIO *io, ut64 addr, const ut8 *buf, int len) {
RIOCache *ch = R_NEW (RIOCache);
ch->from = addr;
ch->to = addr + len;
ch->size = len;
ch->data = (ut8*)malloc (len);
memcpy (ch->data, buf, len);
r_list_append (io->cache, ch);
return len;
}
R_API int r_io_cache_read(RIO *io, ut64 addr, ut8 *buf, int len) {
int l, ret, da, db;
RListIter *iter;
RIOCache *c;
r_list_foreach (io->cache, iter, c) {
if (r_range_overlap (addr, addr+len-1, c->from, c->to, &ret)) {
if (ret>0) {
da = ret;
db = 0;
l = c->size-da;
} else if (ret<0) {
da = 0;
db = -ret;
l = c->size-db;
} else {
da = 0;
db = 0;
l = c->size;
}
if (l>len) l = len;
if (l<1) l = 1; // XXX: fail
else memcpy (buf+da, c->data+db, l);
}
}
return len;
}
|
import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {SharedModule} from '../../../../shared/shared.module';
import {SearchAllComponent} from './search-all.component';
import {<API key>} from '../search-collections/search-collections.module';
import {SearchViewsModule} from '../search-views/search-views.module';
import {SearchTasksModule} from '../search-tasks/search-tasks.module';
@NgModule({
imports: [CommonModule, SharedModule, <API key>, SearchViewsModule, SearchTasksModule],
declarations: [SearchAllComponent],
exports: [SearchAllComponent],
})
export class SearchAllModule {}
|
// you can call this function to create a window to tweak a float value
// if it is called multiple times, it will add more tweakable bars to that window
void tweak(float *var);
|
#ifndef ASN_TYPE_NULL_H
#define ASN_TYPE_NULL_H
#include <asn_application.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* The value of the NULL type is meaningless.
* Use the BOOLEAN type if you need to carry true/false semantics.
*/
typedef int NULL_t;
extern <API key> asn_DEF_NULL;
extern <API key> asn_OP_NULL;
asn_struct_free_f NULL_free;
asn_struct_print_f NULL_print;
<API key> NULL_compare;
ber_type_decoder_f NULL_decode_ber;
der_type_encoder_f NULL_encode_der;
xer_type_decoder_f NULL_decode_xer;
xer_type_encoder_f NULL_encode_xer;
oer_type_decoder_f NULL_decode_oer;
oer_type_encoder_f NULL_encode_oer;
per_type_decoder_f NULL_decode_uper;
per_type_encoder_f NULL_encode_uper;
per_type_decoder_f NULL_decode_aper;
per_type_encoder_f NULL_encode_aper;
asn_random_fill_f NULL_random_fill;
#define NULL_constraint <API key>
#ifdef __cplusplus
}
#endif
#endif /* NULL_H */
|
package com.diggime.modules.email.model.impl;
import com.diggime.modules.email.model.EMail;
import com.diggime.modules.email.model.MailContact;
import org.json.JSONObject;
import java.time.LocalDateTime;
import java.util.List;
import static org.foilage.utils.checkers.NullChecker.notNull;
public class PostmarkEMail implements EMail {
private final int id;
private final String messageId;
private final LocalDateTime sentDate;
private final MailContact sender;
private final List<MailContact> receivers;
private final List<MailContact> carbonCopies;
private final List<MailContact> blindCarbonCopies;
private final String subject;
private final String tag;
private final String htmlBody;
private final String textBody;
public PostmarkEMail(LocalDateTime sentDate, MailContact sender, List<MailContact> receivers, List<MailContact> carbonCopies, List<MailContact> blindCarbonCopies, String subject, String tag, String htmlBody, String textBody) {
this.id = 0;
this.messageId = "";
this.sentDate = notNull(sentDate);
this.sender = notNull(sender);
this.receivers = notNull(receivers);
this.carbonCopies = notNull(carbonCopies);
this.blindCarbonCopies = notNull(blindCarbonCopies);
this.subject = notNull(subject);
this.tag = notNull(tag);
this.htmlBody = notNull(htmlBody);
this.textBody = notNull(textBody);
}
public PostmarkEMail(String messageId, LocalDateTime sentDate, MailContact sender, List<MailContact> receivers, List<MailContact> carbonCopies, List<MailContact> blindCarbonCopies, String subject, String tag, String htmlBody, String textBody) {
this.id = 0;
this.messageId = notNull(messageId);
this.sentDate = notNull(sentDate);
this.sender = notNull(sender);
this.receivers = notNull(receivers);
this.carbonCopies = notNull(carbonCopies);
this.blindCarbonCopies = notNull(blindCarbonCopies);
this.subject = notNull(subject);
this.tag = notNull(tag);
this.htmlBody = notNull(htmlBody);
this.textBody = notNull(textBody);
}
public PostmarkEMail(EMail mail, String messageId) {
this.id = mail.getId();
this.messageId = notNull(messageId);
this.sentDate = mail.getSentDate();
this.sender = mail.getSender();
this.receivers = mail.getReceivers();
this.carbonCopies = mail.getCarbonCopies();
this.blindCarbonCopies = mail.<API key>();
this.subject = mail.getSubject();
this.tag = mail.getTag();
this.htmlBody = mail.getHtmlBody();
this.textBody = mail.getTextBody();
}
public PostmarkEMail(int id, String messageId, LocalDateTime sentDate, MailContact sender, List<MailContact> receivers, List<MailContact> carbonCopies, List<MailContact> blindCarbonCopies, String subject, String tag, String htmlBody, String textBody) {
this.id = id;
this.messageId = notNull(messageId);
this.sentDate = notNull(sentDate);
this.sender = notNull(sender);
this.receivers = notNull(receivers);
this.carbonCopies = notNull(carbonCopies);
this.blindCarbonCopies = notNull(blindCarbonCopies);
this.subject = notNull(subject);
this.tag = notNull(tag);
this.htmlBody = notNull(htmlBody);
this.textBody = notNull(textBody);
}
@Override
public int getId() {
return id;
}
@Override
public String getMessageId() {
return messageId;
}
@Override
public LocalDateTime getSentDate() {
return sentDate;
}
@Override
public MailContact getSender() {
return sender;
}
@Override
public List<MailContact> getReceivers() {
return receivers;
}
@Override
public List<MailContact> getCarbonCopies() {
return carbonCopies;
}
@Override
public List<MailContact> <API key>() {
return blindCarbonCopies;
}
@Override
public String getSubject() {
return subject;
}
@Override
public String getTag() {
return tag;
}
@Override
public String getHtmlBody() {
return htmlBody;
}
@Override
public String getTextBody() {
return textBody;
}
@Override
public JSONObject getJSONObject() {
JSONObject obj = new JSONObject();
obj.put("From", sender.getName()+" <"+sender.getAddress()+">");
addReceivers(obj, receivers, "To");
addReceivers(obj, carbonCopies, "Cc");
addReceivers(obj, blindCarbonCopies, "Bcc");
obj.put("Subject", subject);
if(tag.length()>0) {
obj.put("Tag", tag);
}
if(htmlBody.length()>0) {
obj.put("HtmlBody", htmlBody);
} else {
obj.put("HtmlBody", textBody);
}
if(textBody.length()>0) {
obj.put("TextBody", textBody);
}
return obj;
}
private void addReceivers(JSONObject obj, List<MailContact> sendList, String jsonType) {
boolean first = true;
StringBuilder sb = new StringBuilder();
for(MailContact contact: sendList) {
if(first) {
first = false;
} else {
sb.append(", ");
}
sb.append(contact.getName());
sb.append(" <");
sb.append(contact.getAddress());
sb.append(">");
}
if(sendList.size()>0) {
obj.put(jsonType, sb.toString());
}
}
}
|
package es.blackleg.libdam.geometry;
import es.blackleg.libdam.utilities.Calculadora;
/**
*
* @author Hector Espert Pardo
*/
public class Circulo extends Figura {
private double radio;
public Circulo() {
}
public Circulo(double radio) {
this.radio = radio;
}
public void setRadio(double radio) {
this.radio = radio;
}
public double getRadio() {
return radio;
}
public double getDiametro() {
return 2 * radio;
}
@Override
public double calculaArea() {
return Calculadora.areaCirculo(radio);
}
@Override
public double calculaPerimetro() {
return Calculadora.perimetroCirculo(radio);
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Circulo other = (Circulo) obj;
return Double.doubleToLongBits(this.radio) == Double.doubleToLongBits(other.radio);
}
@Override
public int hashCode() {
int hash = 5;
hash = 67 * hash + (int) (Double.doubleToLongBits(this.radio) ^ (Double.doubleToLongBits(this.radio) >>> 32));
return hash;
}
@Override
public String toString() {
return String.format("Circulo: x=%d, y=%d, R=%.2f.", super.getCentro().getX(), super.getCentro().getY(), radio);
}
}
|
<?php
return [
'facebook' => [
'appId' => '', //application api id for facebook
'appSecret' => '', //application api secret for facebook
'scope' => 'email, user_birthday, publish_actions' //facebook scopes
],
'twitter' => [
'appId' => '', //<TwitterConsumerkey> consumer key
'appSecret' => '' //<TwitterConsumerkey> consumer secret
//Twitter scopes must be defined in dev.twitter.com
]
];
|
package org.cerberus.service.groovy.impl;
import groovy.lang.GroovyShell;
import java.util.Collections;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import org.cerberus.service.groovy.IGroovyService;
import org.codehaus.groovy.control.<API key>;
import org.kohsuke.groovy.sandbox.SandboxTransformer;
import org.springframework.stereotype.Service;
/**
* {@link IGroovyService} default implementation
*
* @author Aurelien Bourdon
*/
@Service
public class GroovyService implements IGroovyService {
/**
* Groovy specific compilation customizer in order to avoid code injection
*/
private static final <API key> <API key> = new <API key>().<API key>(new SandboxTransformer());
/**
* Each Groovy execution is ran inside a dedicated {@link Thread},
* especially to register our Groovy interceptor
*/
private ExecutorService executorService;
@PostConstruct
private void init() {
executorService = Executors.newCachedThreadPool();
}
@PreDestroy
private void shutdown() {
if (executorService != null && !executorService.isShutdown()) {
executorService.shutdownNow();
}
}
@Override
public String eval(final String script) throws <API key> {
try {
Future<String> expression = executorService.submit(() -> {
<API key> interceptor = new <API key>(
Collections.<Class<?>>emptySet(),
Collections.<Class<?>>emptySet(),
Collections.<<API key>.AllowedPrefix>emptyList()
);
try {
interceptor.register();
GroovyShell shell = new GroovyShell(<API key>);
return shell.evaluate(script).toString();
} finally {
interceptor.unregister();
}
});
String eval = expression.get();
if (eval == null) {
throw new <API key>("Groovy evaluation returns null result");
}
return eval;
} catch (Exception e) {
throw new <API key>(e);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Engine;
using Micropolis.Common;
using Microsoft.ApplicationInsights;
namespace Micropolis.ViewModels
{
public class <API key> : BindableBase, Engine.IListener
{
private Engine.Micropolis _engine;
private <API key> _mainPageViewModel;
<summary>
Sets the engine.
</summary>
<param name="newEngine">The new engine.</param>
public void SetEngine(Engine.Micropolis newEngine)
{
if (_engine != null)
{
//old engine
_engine.RemoveListener(this);
}
_engine = newEngine;
if (_engine != null)
{
//new engine
_engine.AddListener(this);
LoadEvaluation();
}
}
public <API key>()
{
DismissCommand = new DelegateCommand(OnDismissClicked);
try
{
_telemetry = new TelemetryClient();
}
catch (Exception)
{
}
}
<summary>
Called when user clicked the dismiss button to close the window.
</summary>
private void OnDismissClicked()
{
try {
_telemetry.TrackEvent("<API key>");
}
catch (Exception) { }
_mainPageViewModel.HideEvaluationPane();
}
private string <API key>;
public string <API key>
{
get
{
return this.<API key>;
}
set
{
this.SetProperty(ref this.<API key>, value);
}
}
private string _pubOpTextBlockText;
public string PubOpTextBlockText
{
get
{
return this._pubOpTextBlockText;
}
set
{
this.SetProperty(ref this._pubOpTextBlockText, value);
}
}
private string <API key>;
public string PubOp2TextBlockText
{
get
{
return this.<API key>;
}
set
{
this.SetProperty(ref this.<API key>, value);
}
}
private string <API key>;
public string PubOp3TextBlockText
{
get
{
return this.<API key>;
}
set
{
this.SetProperty(ref this.<API key>, value);
}
}
private string <API key>;
public string PubOp4TextBlockText
{
get
{
return this.<API key>;
}
set
{
this.SetProperty(ref this.<API key>, value);
}
}
<summary>
Makes the public opinion pane.
</summary>
<returns></returns>
private void <API key>()
{
<API key> = Strings.GetString("public-opinion");
PubOpTextBlockText = Strings.GetString("public-opinion-1");
PubOp2TextBlockText = Strings.GetString("public-opinion-2");
PubOp3TextBlockText = Strings.GetString("public-opinion-yes");
PubOp4TextBlockText = Strings.GetString("public-opinion-no");
<API key> = "";
<API key> = "";
<API key> = "";
<API key> = "";
<API key> = "";
<API key> = "";
<API key> = "";
<API key> = "";
}
private string <API key>;
public string <API key>
{
get
{
return this.<API key>;
}
set
{
this.SetProperty(ref this.<API key>, value);
}
}
private string <API key>;
public string <API key>
{
get
{
return this.<API key>;
}
set
{
this.SetProperty(ref this.<API key>, value);
}
}
private string <API key>;
public string <API key>
{
get
{
return this.<API key>;
}
set
{
this.SetProperty(ref this.<API key>, value);
}
}
private string <API key>;
public string <API key>
{
get
{
return this.<API key>;
}
set
{
this.SetProperty(ref this.<API key>, value);
}
}
private string <API key>;
public string <API key>
{
get
{
return this.<API key>;
}
set
{
this.SetProperty(ref this.<API key>, value);
}
}
private string <API key>;
public string <API key>
{
get
{
return this.<API key>;
}
set
{
this.SetProperty(ref this.<API key>, value);
}
}
private string <API key>;
public string <API key>
{
get
{
return this.<API key>;
}
set
{
this.SetProperty(ref this.<API key>, value);
}
}
private string <API key>;
public string <API key>
{
get
{
return this.<API key>;
}
set
{
this.SetProperty(ref this.<API key>, value);
}
}
<summary>
Makes the statistics pane.
</summary>
<returns></returns>
private void MakeStatisticsPane()
{
<API key> = Strings.GetString("statistics-head");
<API key> = Strings.GetString("city-score-head");
<API key> = Strings.GetString("stats-population");
<API key> = Strings.GetString("stats-net-migration");
<API key> = Strings.GetString("stats-last-year");
<API key> = Strings.GetString("<API key>");
<API key> = Strings.GetString("stats-category");
<API key> = Strings.GetString("stats-game-level");
<API key> = Strings.GetString("city-score-current");
<API key> = Strings.GetString("city-score-change");
}
private string <API key>;
public string <API key>
{
get
{
return this.<API key>;
}
set
{
this.SetProperty(ref this.<API key>, value);
}
}
private string <API key>;
public string <API key>
{
get
{
return this.<API key>;
}
set
{
this.SetProperty(ref this.<API key>, value);
}
}
private string <API key>;
public string <API key>
{
get
{
return this.<API key>;
}
set
{
this.SetProperty(ref this.<API key>, value);
}
}
private string <API key>;
public string <API key>
{
get
{
return this.<API key>;
}
set
{
this.SetProperty(ref this.<API key>, value);
}
}
private string <API key>;
public string <API key>
{
get
{
return this.<API key>;
}
set
{
this.SetProperty(ref this.<API key>, value);
}
}
private string <API key>;
public string <API key>
{
get
{
return this.<API key>;
}
set
{
this.SetProperty(ref this.<API key>, value);
}
}
private string <API key>;
public string <API key>
{
get
{
return this.<API key>;
}
set
{
this.SetProperty(ref this.<API key>, value);
}
}
private string <API key>;
public string <API key>
{
get
{
return this.<API key>;
}
set
{
this.SetProperty(ref this.<API key>, value);
}
}
private string <API key>;
public string <API key>
{
get
{
return this.<API key>;
}
set
{
this.SetProperty(ref this.<API key>, value);
}
}
private string <API key>;
public string <API key>
{
get
{
return this.<API key>;
}
set
{
this.SetProperty(ref this.<API key>, value);
}
}
private string _yesTextBlockText;
public string YesTextBlockText
{
get
{
return this._yesTextBlockText;
}
set
{
this.SetProperty(ref this._yesTextBlockText, value);
}
}
private string _noTextBlockText;
public string NoTextBlockText
{
get
{
return this._noTextBlockText;
}
set
{
this.SetProperty(ref this._noTextBlockText, value);
}
}
<summary>
Loads the evaluation.
</summary>
private void LoadEvaluation()
{
YesTextBlockText = ((_engine.Evaluation.CityYes).ToString()+"%");
NoTextBlockText = ((_engine.Evaluation.CityNo).ToString()+"%");
CityProblem p;
int numVotes;
p = 0 < _engine.Evaluation.ProblemOrder.Length
? _engine.Evaluation.ProblemOrder[0]
: default(CityProblem);
numVotes = p != default(CityProblem) ? _engine.Evaluation.ProblemVotes[p] : 0;
if (numVotes != 0)
{
<API key> = ("problem." + p); //name
<API key> = (0.01*numVotes).ToString();
<API key> = true;
<API key> = true;
}
else
{
<API key> = false;
<API key> = false;
}
p = 1 < _engine.Evaluation.ProblemOrder.Length
? _engine.Evaluation.ProblemOrder[1]
: default(CityProblem);
numVotes = p != default(CityProblem) ? _engine.Evaluation.ProblemVotes[p] : 0;
if (numVotes != 0)
{
<API key> = ("problem." + p); //name
<API key> = (0.01 * numVotes).ToString();
<API key> = true;
<API key> = true;
}
else
{
<API key> = false;
<API key> = false;
}
p = 2 < _engine.Evaluation.ProblemOrder.Length
? _engine.Evaluation.ProblemOrder[2]
: default(CityProblem);
numVotes = p != default(CityProblem) ? _engine.Evaluation.ProblemVotes[p] : 0;
if (numVotes != 0)
{
<API key> = ("problem." + p); //name
<API key> = (0.01 * numVotes).ToString();
<API key> = true;
<API key> = true;
}
else
{
<API key> = false;
<API key> = false;
}
p = 3 < _engine.Evaluation.ProblemOrder.Length
? _engine.Evaluation.ProblemOrder[3]
: default(CityProblem);
numVotes = p != default(CityProblem) ? _engine.Evaluation.ProblemVotes[p] : 0;
if (numVotes != 0)
{
<API key> = ("problem." + p); //name
<API key> = (0.01 * numVotes).ToString();
<API key> = true;
<API key> = true;
}
else
{
<API key> = false;
<API key> = false;
}
PopTextBlockText = (_engine.Evaluation.CityPop).ToString();
DeltaTextBlockText = (_engine.Evaluation.DeltaCityPop).ToString();
AssessTextBlockText = (_engine.Evaluation.CityAssValue).ToString();
<API key> = (GetCityClassName(_engine.Evaluation.CityClass));
<API key> = (GetGameLevelName(_engine.GameLevel));
ScoreTextBlockText = (_engine.Evaluation.CityScore).ToString();
<API key> = (_engine.Evaluation.DeltaCityScore).ToString();
}
private bool <API key>;
public bool <API key>
{
get
{
return this.<API key>;
}
set
{
this.SetProperty(ref this.<API key>, value);
}
}
private bool <API key>;
public bool <API key>
{
get
{
return this.<API key>;
}
set
{
this.SetProperty(ref this.<API key>, value);
}
}
private bool <API key>;
public bool <API key>
{
get
{
return this.<API key>;
}
set
{
this.SetProperty(ref this.<API key>, value);
}
}
private bool <API key>;
public bool <API key>
{
get
{
return this.<API key>;
}
set
{
this.SetProperty(ref this.<API key>, value);
}
}
private bool <API key>;
public bool <API key>
{
get
{
return this.<API key>;
}
set
{
this.SetProperty(ref this.<API key>, value);
}
}
private bool <API key>;
public bool <API key>
{
get
{
return this.<API key>;
}
set
{
this.SetProperty(ref this.<API key>, value);
}
}
private bool <API key>;
public bool <API key>
{
get
{
return this.<API key>;
}
set
{
this.SetProperty(ref this.<API key>, value);
}
}
private bool <API key>;
public bool <API key>
{
get
{
return this.<API key>;
}
set
{
this.SetProperty(ref this.<API key>, value);
}
}
private string <API key>;
public string <API key>
{
get
{
return this.<API key>;
}
set
{
this.SetProperty(ref this.<API key>, value);
}
}
private string _scoreTextBlockText;
public string ScoreTextBlockText
{
get
{
return this._scoreTextBlockText;
}
set
{
this.SetProperty(ref this._scoreTextBlockText, value);
}
}
private string <API key>;
public string <API key>
{
get
{
return this.<API key>;
}
set
{
this.SetProperty(ref this.<API key>, value);
}
}
private string <API key>;
public string <API key>
{
get
{
return this.<API key>;
}
set
{
this.SetProperty(ref this.<API key>, value);
}
}
private string <API key>;
public string AssessTextBlockText
{
get
{
return this.<API key>;
}
set
{
this.SetProperty(ref this.<API key>, value);
}
}
private string _deltaTextBlockText;
public string DeltaTextBlockText
{
get
{
return this._deltaTextBlockText;
}
set
{
this.SetProperty(ref this._deltaTextBlockText, value);
}
}
private string _popTextBlockText;
public string PopTextBlockText
{
get
{
return this._popTextBlockText;
}
set
{
this.SetProperty(ref this._popTextBlockText, value);
}
}
<summary>
Gets the name of the city class.
</summary>
<param name="cityClass">The city class.</param>
<returns></returns>
private static String GetCityClassName(int cityClass)
{
return Strings.GetString("class." + cityClass);
}
<summary>
Gets the name of the game level.
</summary>
<param name="gameLevel">The game level.</param>
<returns></returns>
private static String GetGameLevelName(int gameLevel)
{
return Strings.GetString("level." + gameLevel);
}
public DelegateCommand DismissCommand { get; private set; }
private string _dismissButtonText;
private TelemetryClient _telemetry;
public string DismissButtonText
{
get
{
return this._dismissButtonText;
}
set
{
this.SetProperty(ref this._dismissButtonText, value);
}
}
internal void SetupAfterBasicInit(<API key> mainPageViewModel, Engine.Micropolis engine)
{
_mainPageViewModel = mainPageViewModel;
DismissButtonText = Strings.GetString("dismiss-evaluation");
<API key>();
MakeStatisticsPane();
SetEngine(engine);
LoadEvaluation();
}
#region implements Micropolis.IListener
<summary>
Cities the message.
</summary>
<param name="message">The message.</param>
<param name="loc">The loc.</param>
public void CityMessage(MicropolisMessage message, CityLocation loc)
{
}
<summary>
Cities the sound.
</summary>
<param name="sound">The sound.</param>
<param name="loc">The loc.</param>
public void CitySound(Sound sound, CityLocation loc)
{
}
<summary>
Fired whenever the "census" is taken, and the various historical counters have been updated. (Once a month in
game.)
</summary>
public void CensusChanged()
{
}
<summary>
Fired whenever resValve, comValve, or indValve changes. (Twice a month in game.)
</summary>
public void DemandChanged()
{
}
<summary>
Fired whenever the mayor's money changes.
</summary>
public void FundsChanged()
{
}
<summary>
Fired whenever autoBulldoze, autoBudget, noDisasters, or simSpeed change.
</summary>
public void OptionsChanged()
{
}
#endregion
#region implements Engine.IListener
<summary>
Fired whenever the city evaluation is recalculated. (Once a year.)
</summary>
public void EvaluationChanged()
{
LoadEvaluation();
}
#endregion
}
}
|
<?php
/**
* KR_Custom_Posts
*/
class KR_Custom_Posts extends Odin_Post_Type {
private $_labels = array();
private $_arguments = array();
private $_dashicon = 'dashicons-';
private $_supports = array( 'title', 'editor', 'thumbnail' );
private $_slug;
private $_singular;
private $_plural;
private $_rewrite;
private $_exclude_search;
public function __construct( $post_slug = null, $singular = null, $plural = null, $supports = array(), $dashicon = 'admin-post', $rewrite = null, $exclude_search = false ) {
if(empty($post_slug)) {
echo '<pre>' . print_r( __('The Parameter <code>$post_slug</code> is required!!'), true ) . '</pre>';
die();
}
$this->_slug = $post_slug;
$this->_dashicon = $this->_dashicon . $dashicon;
$this->_singular = (!empty($singular)) ? $singular : $this->_slug;
$this->_plural = (!empty($plural)) ? $plural : $this->_slug;
$this->_supports = (count($supports) > 0) ? $supports : $this->_supports;
$this->_rewrite = (!empty($rewrite)) ? array('slug' => $rewrite) : array('slug' => $this->_slug);
$this->_exclude_search = $exclude_search;
$this->kr_init();
}
private function kr_init() {
parent::__construct( $this->_slug, $this->_slug );
$this->kr_set_labels();
$this->kr_set_arguments();
$this->set_labels($this->_labels); # odin method set_labels
$this->set_arguments($this->_arguments); # odin method set_arguments
$this->kr_cleaner();
}
private function kr_set_labels() {
$this->_labels = array(
'name' => $this->_plural,
'singular_name' => $this->_singular,
'menu_name' => $this->_plural,
'all_items' => $this->_plural,
'add_new' => 'Adicionar Novo',
'add_new_item' => 'Adicionar Novo',
'search_items' => 'Buscar',
'not_found' => 'Nada encontrado',
'not_found_in_trash' => 'Nada encontrado na lixeira',
);
}
private function kr_set_arguments() {
$this->_arguments = array(
'supports' => $this->_supports,
'menu_icon' => $this->_dashicon,
'rewrite' => $this->_rewrite,
'exclude_from_search' => $this->_exclude_search,
// 'menu_position' => '1.36',
'capability_type' => 'page',
);
}
private function kr_cleaner() {
unset($this->_slug);
unset($this->_dashicon);
unset($this->_singular);
unset($this->_plural);
unset($this->_supports);
unset($this->_exclude_search);
unset($this->_rewrite);
unset($this->_labels);
unset($this->_arguments);
}
} # End Class KR_Custom_Posts
|
<?php
/* core/modules/system/templates/<API key>.html.twig */
class <API key> extends Twig_Template
{
public function __construct(Twig_Environment $env)
{
parent::__construct($env);
// line 1
$this->parent = $this->loadTemplate("block.html.twig", "core/modules/system/templates/<API key>.html.twig", 1);
$this->blocks = array(
'content' => array($this, 'block_content'),
);
}
protected function doGetParent(array $context)
{
return "block.html.twig";
}
protected function doDisplay(array $context, array $blocks = array())
{
$tags = array("if" => 19);
$filters = array("t" => 20);
$functions = array("path" => 20);
try {
$this->env->getExtension('sandbox')->checkSecurity(
array('if'),
array('t'),
array('path')
);
} catch (<API key> $e) {
$e->setTemplateFile($this->getTemplateName());
if ($e instanceof <API key> && isset($tags[$e->getTagName()])) {
$e->setTemplateLine($tags[$e->getTagName()]);
} elseif ($e instanceof <API key> && isset($filters[$e->getFilterName()])) {
$e->setTemplateLine($filters[$e->getFilterName()]);
} elseif ($e instanceof <API key> && isset($functions[$e->getFunctionName()])) {
$e->setTemplateLine($functions[$e->getFunctionName()]);
}
throw $e;
}
$this->parent->display($context, array_merge($this->blocks, $blocks));
}
// line 18
public function block_content($context, array $blocks = array())
{
// line 19
echo " ";
if ((isset($context["site_logo"]) ? $context["site_logo"] : null)) {
// line 20
echo " <a href=\"";
echo $this->env->getExtension('sandbox')-><API key>($this->env->getExtension('drupal_core')->renderVar($this->env->getExtension('drupal_core')->getPath("<front>")));
echo "\" title=\"";
echo $this->env->getExtension('sandbox')-><API key>($this->env->getExtension('drupal_core')->renderVar(t("Home")));
echo "\" rel=\"home\">
<img src=\"";
// line 21
echo $this->env->getExtension('sandbox')-><API key>($this->env->getExtension('drupal_core')->escapeFilter($this->env, (isset($context["site_logo"]) ? $context["site_logo"] : null), "html", null, true));
echo "\" alt=\"";
echo $this->env->getExtension('sandbox')-><API key>($this->env->getExtension('drupal_core')->renderVar(t("Home")));
echo "\" />
</a>
";
}
// line 24
echo " ";
if ((isset($context["site_name"]) ? $context["site_name"] : null)) {
// line 25
echo " <a href=\"";
echo $this->env->getExtension('sandbox')-><API key>($this->env->getExtension('drupal_core')->renderVar($this->env->getExtension('drupal_core')->getPath("<front>")));
echo "\" title=\"";
echo $this->env->getExtension('sandbox')-><API key>($this->env->getExtension('drupal_core')->renderVar(t("Home")));
echo "\" rel=\"home\">";
echo $this->env->getExtension('sandbox')-><API key>($this->env->getExtension('drupal_core')->escapeFilter($this->env, (isset($context["site_name"]) ? $context["site_name"] : null), "html", null, true));
echo "</a>
";
}
// line 27
echo " ";
echo $this->env->getExtension('sandbox')-><API key>($this->env->getExtension('drupal_core')->escapeFilter($this->env, (isset($context["site_slogan"]) ? $context["site_slogan"] : null), "html", null, true));
echo "
";
}
public function getTemplateName()
{
return "core/modules/system/templates/<API key>.html.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 86 => 27, 76 => 25, 73 => 24, 65 => 21, 58 => 20, 55 => 19, 52 => 18, 11 => 1,);
}
}
/* {% extends "block.html.twig" %}*/
/* * @file*/
/* * Default theme implementation for a branding block.*/
/* * Each branding element variable (logo, name, slogan) is only available if*/
/* * enabled in the block configuration.*/
/* * Available variables:*/
/* * - site_logo: Logo for site as defined in Appearance or theme settings.*/
/* * - site_name: Name for site as defined in Site information settings.*/
/* * - site_slogan: Slogan for site as defined in Site information settings.*/
/* * @ingroup themeable*/
/* {% block content %}*/
/* {% if site_logo %}*/
/* <a href="{{ path('<front>') }}" title="{{ 'Home'|t }}" rel="home">*/
/* <img src="{{ site_logo }}" alt="{{ 'Home'|t }}" />*/
/* {% endif %}*/
/* {% if site_name %}*/
/* <a href="{{ path('<front>') }}" title="{{ 'Home'|t }}" rel="home">{{ site_name }}</a>*/
/* {% endif %}*/
/* {{ site_slogan }}*/
/* {% endblock %}*/
|
#region using directives
using System;
using PoGo.PokeMobBot.Logic.Event;
using PoGo.PokeMobBot.Logic.Event.Egg;
using PoGo.PokeMobBot.Logic.Event.Fort;
using PoGo.PokeMobBot.Logic.Event.Global;
using PoGo.PokeMobBot.Logic.Event.GUI;
using PoGo.PokeMobBot.Logic.Event.Item;
using PoGo.PokeMobBot.Logic.Event.Logic;
using PoGo.PokeMobBot.Logic.Event.Obsolete;
using PoGo.PokeMobBot.Logic.Event.Player;
using PoGo.PokeMobBot.Logic.Event.Pokemon;
using PoGo.PokeMobBot.Logic.State;
using PoGo.PokeMobBot.Logic.Utils;
using POGOProtos.Networking.Responses;
#endregion
namespace PoGo.PokeMobBot.Logic
{
public class <API key>
{
public void HandleEvent(ProfileEvent evt, ISession session)
{
session.Stats.SetUsername(evt.Profile);
session.Stats.<API key>(session);
}
public void HandleEvent(ErrorEvent evt, ISession session)
{
}
public void HandleEvent(NoticeEvent evt, ISession session)
{
}
public void HandleEvent(<API key> evt, ISession session)
{
}
public void HandleEvent(ItemUsedEvent evt, ISession session)
{
}
public void HandleEvent(WarnEvent evt, ISession session)
{
}
public void HandleEvent(UseLuckyEggEvent evt, ISession session)
{
}
public void HandleEvent(PokemonEvolveEvent evt, ISession session)
{
session.Stats.TotalExperience += evt.Exp;
session.Stats.<API key>(session);
}
public void HandleEvent(<API key> evt, ISession session)
{
session.Stats.<API key>++;
session.Stats.<API key>(session);
}
public void HandleEvent(EggHatchedEvent evt, ISession session)
{
session.Stats.TotalPokemons++;
session.Stats.HatchedNow++;
session.Stats.<API key>(session);
session.Stats.RefreshPokeDex(session);
}
public void HandleEvent(<API key> evt, ISession session)
{
}
public void HandleEvent(CheckChallengeEvent evt, ISession session)
{
}
public void HandleEvent(BuddySetEvent evt, ISession session)
{
}
public void HandleEvent(BuddyWalkedEvent evt, ISession session)
{
}
public void HandleEvent(ItemRecycledEvent evt, ISession session)
{
session.Stats.TotalItemsRemoved += evt.Count;
session.Stats.<API key>(session);
}
public void HandleEvent(FortUsedEvent evt, ISession session)
{
session.Stats.TotalExperience += evt.Exp;
session.Stats.TotalPokestops++;
session.Stats.<API key>(session);
}
public void HandleEvent(FortTargetEvent evt, ISession session)
{
}
public void HandleEvent(<API key> evt, ISession session)
{
}
public void HandleEvent(PokemonCaptureEvent evt, ISession session)
{
if (evt.Status == <API key>.Types.CatchStatus.CatchSuccess)
{
session.Stats.TotalExperience += evt.Exp;
session.Stats.TotalPokemons++;
session.Stats.TotalStardust = evt.Stardust;
session.Stats.<API key>(session);
session.Stats.RefreshPokeDex(session);
}
session.Stats.PokeBalls++;
}
public void HandleEvent(NoPokeballEvent evt, ISession session)
{
}
public void HandleEvent(UseBerryEvent evt, ISession session)
{
}
public void HandleEvent(<API key> evt, ISession session)
{
}
public void HandleEvent(UpdatePositionEvent evt, ISession session)
{
}
public void HandleEvent(NewVersionEvent evt, ISession session)
{
}
public void HandleEvent(UpdateEvent evt, ISession session)
{
}
public void HandleEvent(<API key> evt, ISession session)
{
}
public void HandleEvent(DebugEvent evt, ISession session)
{
}
public void HandleEvent(<API key> evt, ISession session)
{
}
public void HandleEvent(EggsListEvent evt, ISession session)
{
}
public void HandleEvent(ForceMoveDoneEvent evt, ISession session)
{
}
public void HandleEvent(FortFailedEvent evt, ISession session)
{
}
public void HandleEvent(<API key> evt, ISession session)
{
}
public void HandleEvent(InventoryListEvent evt, ISession session)
{
}
public void HandleEvent(<API key> evt, ISession session)
{
}
public void HandleEvent(EggFoundEvent evt, ISession session)
{
}
public void HandleEvent(NextRouteEvent evt, ISession session)
{
}
public void HandleEvent(PlayerLevelUpEvent evt, ISession session)
{
}
public void HandleEvent(PlayerStatsEvent evt, ISession session)
{
}
public void HandleEvent(<API key> evt, ISession session)
{
session.Stats.EncountersNow++;
}
public void HandleEvent(<API key> evt, ISession session)
{
session.Stats.TotalEvolves++;
session.Stats.RefreshPokeDex(session);
}
public void HandleEvent(<API key> evt, ISession session)
{
}
public void HandleEvent(<API key> evt, ISession session)
{
}
public void HandleEvent(PokemonsFoundEvent evt, ISession session)
{
}
public void HandleEvent(<API key> evt, ISession session)
{
}
public void HandleEvent(<API key> evt, ISession session)
{
}
public void HandleEvent(PokeStopListEvent evt, ISession session)
{
}
public void HandleEvent(SnipeEvent evt, ISession session)
{
}
public void HandleEvent(SnipeModeEvent evt, ISession session)
{
}
public void HandleEvent(<API key> evt, ISession session)
{
}
public void HandleEvent(PokemonListEvent evt, ISession session)
{
}
public void HandleEvent(GymPokeEvent evt, ISession session)
{
}
public void HandleEvent(<API key> evt, ISession session)
{
}
public void HandleEvent(TeamSetEvent evt, ISession session)
{
}
public void HandleEvent(ItemLostEvent evt, ISession session)
{
}
public void Listen(IEvent evt, ISession session)
{
try
{
dynamic eve = evt;
HandleEvent(eve, session);
}
// ReSharper disable once <API key>
catch (Exception)
{
}
}
}
}
|
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member (no intention to document this file)
namespace RobinHood70.WallE.Base
{
public class AllCategoriesItem
{
#region Constructors
internal AllCategoriesItem(string category, int files, bool hidden, int pages, int size, int subcats)
{
this.Category = category;
this.Files = files;
this.Hidden = hidden;
this.Pages = pages;
this.Size = size;
this.Subcategories = subcats;
}
#endregion
#region Public Properties
public string Category { get; }
public int Files { get; }
public bool Hidden { get; }
public int Pages { get; }
public int Size { get; }
public int Subcategories { get; }
#endregion
#region Public Override Methods
public override string ToString() => this.Category;
#endregion
}
}
|
module libxc_funcs_m
implicit none
public
integer, parameter :: XC_LDA_X = 1 ! Exchange
integer, parameter :: XC_LDA_C_WIGNER = 2 ! Wigner parametrization
integer, parameter :: XC_LDA_C_RPA = 3 ! Random Phase Approximation
integer, parameter :: XC_LDA_C_HL = 4 ! Hedin & Lundqvist
integer, parameter :: XC_LDA_C_GL = 5 ! Gunnarson & Lundqvist
integer, parameter :: XC_LDA_C_XALPHA = 6 ! Slater's Xalpha
integer, parameter :: XC_LDA_C_VWN = 7 ! Vosko, Wilk, & Nussair
integer, parameter :: XC_LDA_C_VWN_RPA = 8 ! Vosko, Wilk, & Nussair (RPA)
integer, parameter :: XC_LDA_C_PZ = 9 ! Perdew & Zunger
integer, parameter :: XC_LDA_C_PZ_MOD = 10 ! Perdew & Zunger (Modified)
integer, parameter :: XC_LDA_C_OB_PZ = 11 ! Ortiz & Ballone (PZ)
integer, parameter :: XC_LDA_C_PW = 12 ! Perdew & Wang
integer, parameter :: XC_LDA_C_PW_MOD = 13 ! Perdew & Wang (Modified)
integer, parameter :: XC_LDA_C_OB_PW = 14 ! Ortiz & Ballone (PW)
integer, parameter :: XC_LDA_C_AMGB = 15 ! Attacalite et al
integer, parameter :: XC_LDA_XC_TETER93 = 20 ! Teter 93 parametrization
integer, parameter :: XC_GGA_X_PBE = 101 ! Perdew, Burke & Ernzerhof exchange
integer, parameter :: XC_GGA_X_PBE_R = 102 ! Perdew, Burke & Ernzerhof exchange (revised)
integer, parameter :: XC_GGA_X_B86 = 103 ! Becke 86 Xalfa,beta,gamma
integer, parameter :: XC_GGA_X_B86_R = 104 ! Becke 86 Xalfa,beta,gamma (reoptimized)
integer, parameter :: XC_GGA_X_B86_MGC = 105 ! Becke 86 Xalfa,beta,gamma (with mod. grad. correction)
integer, parameter :: XC_GGA_X_B88 = 106 ! Becke 88
integer, parameter :: XC_GGA_X_G96 = 107 ! Gill 96
integer, parameter :: XC_GGA_X_PW86 = 108 ! Perdew & Wang 86
integer, parameter :: XC_GGA_X_PW91 = 109 ! Perdew & Wang 91
integer, parameter :: XC_GGA_X_OPTX = 110 ! Handy & Cohen OPTX 01
integer, parameter :: XC_GGA_X_DK87_R1 = 111 ! dePristo & Kress 87 (version R1)
integer, parameter :: XC_GGA_X_DK87_R2 = 112 ! dePristo & Kress 87 (version R2)
integer, parameter :: XC_GGA_X_LG93 = 113 ! Lacks & Gordon 93
integer, parameter :: XC_GGA_X_FT97_A = 114 ! Filatov & Thiel 97 (version A)
integer, parameter :: XC_GGA_X_FT97_B = 115 ! Filatov & Thiel 97 (version B)
integer, parameter :: XC_GGA_X_PBE_SOL = 116 ! Perdew, Burke & Ernzerhof exchange (solids)
integer, parameter :: XC_GGA_X_RPBE = 117 ! Hammer, Hansen & Norskov (PBE-like)
integer, parameter :: XC_GGA_X_WC = 118 ! Wu & Cohen
integer, parameter :: XC_GGA_X_mPW91 = 119 ! Modified form of PW91 by Adamo & Barone
integer, parameter :: XC_GGA_X_AM05 = 120 ! Armiento & Mattsson 05 exchange
integer, parameter :: XC_GGA_X_PBEA = 121 ! Madsen (PBE-like)
integer, parameter :: XC_GGA_X_MPBE = 122 ! Adamo & Barone modification to PBE
integer, parameter :: XC_GGA_X_XPBE = 123 ! xPBE reparametrization by Xu & Goddard
integer, parameter :: XC_GGA_X_OPTPBE = 124 ! optPBE reparametrization for optPBE-vdW
integer, parameter :: XC_GGA_X_OPTB88 = 125 ! optB88 reparametrization for optB88-vdW
integer, parameter :: XC_GGA_X_C09 = 126 ! Cooper exchange for C09-vdW
integer, parameter :: XC_GGA_C_PBE = 130 ! Perdew, Burke & Ernzerhof correlation
integer, parameter :: XC_GGA_C_LYP = 131 ! Lee, Yang & Parr
integer, parameter :: XC_GGA_C_P86 = 132 ! Perdew 86
integer, parameter :: XC_GGA_C_PBE_SOL = 133 ! Perdew, Burke & Ernzerhof correlation SOL
integer, parameter :: XC_GGA_C_PW91 = 134 ! Perdew & Wang 91
integer, parameter :: XC_GGA_C_AM05 = 135 ! Armiento & Mattsson 05 correlation
integer, parameter :: XC_GGA_C_XPBE = 136 ! xPBE reparametrization by Xu & Goddard
integer, parameter :: <API key> = 137 ! PBE correlation for TPSS
integer, parameter :: XC_GGA_XC_LB = 160 ! van Leeuwen & Baerends
integer, parameter :: XC_GGA_XC_HCTH_93 = 161 ! HCTH functional fitted to 93 molecules
integer, parameter :: XC_GGA_XC_HCTH_120 = 162 ! HCTH functional fitted to 120 molecules
integer, parameter :: XC_GGA_XC_HCTH_147 = 163 ! HCTH functional fitted to 147 molecules
integer, parameter :: XC_GGA_XC_HCTH_407 = 164 ! HCTH functional fitted to 147 molecules
integer, parameter :: XC_GGA_XC_EDF1 = 165 ! Empirical functionals from Adamson, Gill, and Pople
integer, parameter :: XC_GGA_XC_XLYP = 166 ! XLYP functional
integer, parameter :: <API key> = 401 ! The original hybrid proposed by Becke
integer, parameter :: XC_HYB_GGA_XC_B3LYP = 402 ! The (in)famous B3LYP
integer, parameter :: XC_HYB_GGA_XC_B3P86 = 403 ! Perdew 86 hybrid similar to B3PW91
integer, parameter :: XC_HYB_GGA_XC_O3LYP = 404 ! hybrid using the optx functional
integer, parameter :: XC_HYB_GGA_XC_PBEH = 406 ! aka PBE0 or PBE1PBE
integer, parameter :: XC_HYB_GGA_XC_X3LYP = 411 ! maybe the best hybrid
integer, parameter :: XC_HYB_GGA_XC_B1WC = 412 ! Becke 1-parameter mixture of WC and EXX
integer, parameter :: XC_MGGA_X_TPSS = 201 ! Perdew, Tao, Staroverov & Scuseria exchange
integer, parameter :: XC_MGGA_C_TPSS = 202 ! Perdew, Tao, Staroverov & Scuseria correlation
integer, parameter :: XC_MGGA_X_M06L = 203 ! Zhao, Truhlar exchange
integer, parameter :: XC_MGGA_C_M06L = 204 ! Zhao, Truhlar correlation
integer, parameter :: XC_MGGA_X_REVTPSS = 205 ! Perdew, Ruzsinszky, Csonka, Constantin and Sun Exchange
integer, parameter :: XC_MGGA_C_REVTPSS = 206 ! Perdew, Ruzsinszky, Csonka, Constantin and Sun Correlation
integer, parameter :: XC_LCA_OMC = 301 ! Orestes, Marcasso & Capelle
integer, parameter :: XC_LCA_LCH = 302 ! Lee, Colwell & Handy
end module libxc_funcs_m
|
'''WARCAT: Web ARChive (WARC) Archiving Tool
Tool and library for handling Web ARChive (WARC) files.
'''
from .version import *
|
#ifndef <API key>
#define <API key>
/* This header will be used by application too */
#include <linux/types.h>
#include <linux/uio.h>
#define TCMU_VERSION "2.0"
#define <API key> 2
#define ALIGN_SIZE 64 /* Should be enough for most CPUs */
#define <API key> (1 << 0) /* Out-of-order completions */
struct tcmu_mailbox
{
__u16 version;
__u16 flags;
__u32 cmdr_off;
__u32 cmdr_size;
__u32 cmd_head;
/* Updated by user. On its own cacheline */
__u32 cmd_tail __attribute__((__aligned__(ALIGN_SIZE)));
} __packed;
enum tcmu_opcode
{
TCMU_OP_PAD = 0,
TCMU_OP_CMD,
};
/*
* Only a few opcodes, and length is 8-byte aligned, so use low bits for opcode.
*/
struct tcmu_cmd_entry_hdr
{
__u32 len_op;
__u16 cmd_id;
__u8 kflags;
#define <API key> 0x1
__u8 uflags;
} __packed;
#define TCMU_OP_MASK 0x7
static inline enum tcmu_opcode tcmu_hdr_get_op(__u32 len_op)
{
return len_op & TCMU_OP_MASK;
}
static inline void tcmu_hdr_set_op(__u32 *len_op, enum tcmu_opcode op)
{
*len_op &= ~TCMU_OP_MASK;
*len_op |= (op & TCMU_OP_MASK);
}
static inline __u32 tcmu_hdr_get_len(__u32 len_op)
{
return len_op & ~TCMU_OP_MASK;
}
static inline void tcmu_hdr_set_len(__u32 *len_op, __u32 len)
{
*len_op &= TCMU_OP_MASK;
*len_op |= len;
}
/* Currently the same as <API key> */
#define <API key> 96
struct tcmu_cmd_entry
{
struct tcmu_cmd_entry_hdr hdr;
union
{
struct
{
uint32_t iov_cnt;
uint32_t iov_bidi_cnt;
uint32_t iov_dif_cnt;
uint64_t cdb_off;
uint64_t __pad1;
uint64_t __pad2;
struct iovec iov[0];
} req;
struct
{
uint8_t scsi_status;
uint8_t __pad1;
uint16_t __pad2;
uint32_t __pad3;
char sense_buffer[<API key>];
} rsp;
};
} __packed;
#define TCMU_OP_ALIGN_SIZE sizeof(uint64_t)
enum tcmu_genl_cmd
{
TCMU_CMD_UNSPEC,
<API key>,
<API key>,
__TCMU_CMD_MAX,
};
#define TCMU_CMD_MAX (__TCMU_CMD_MAX - 1)
enum tcmu_genl_attr
{
TCMU_ATTR_UNSPEC,
TCMU_ATTR_DEVICE,
TCMU_ATTR_MINOR,
__TCMU_ATTR_MAX,
};
#define TCMU_ATTR_MAX (__TCMU_ATTR_MAX - 1)
#endif
|
package org.b3log.symphony.processor;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.ioc.inject.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.model.Pagination;
import org.b3log.latke.service.LangPropsService;
import org.b3log.latke.servlet.HTTPRequestContext;
import org.b3log.latke.servlet.HTTPRequestMethod;
import org.b3log.latke.servlet.annotation.After;
import org.b3log.latke.servlet.annotation.Before;
import org.b3log.latke.servlet.annotation.RequestProcessing;
import org.b3log.latke.servlet.annotation.RequestProcessor;
import org.b3log.latke.servlet.renderer.freemarker.<API key>;
import org.b3log.latke.util.Locales;
import org.b3log.latke.util.Stopwatchs;
import org.b3log.latke.util.Strings;
import org.b3log.symphony.model.Article;
import org.b3log.symphony.model.Common;
import org.b3log.symphony.model.UserExt;
import org.b3log.symphony.processor.advice.AnonymousViewCheck;
import org.b3log.symphony.processor.advice.PermissionGrant;
import org.b3log.symphony.processor.advice.stopwatch.StopwatchEndAdvice;
import org.b3log.symphony.processor.advice.stopwatch.<API key>;
import org.b3log.symphony.service.*;
import org.b3log.symphony.util.Emotions;
import org.b3log.symphony.util.Markdowns;
import org.b3log.symphony.util.Symphonys;
import org.json.JSONObject;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.util.*;
@RequestProcessor
public class IndexProcessor {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(IndexProcessor.class.getName());
/**
* Article query service.
*/
@Inject
private ArticleQueryService articleQueryService;
/**
* User query service.
*/
@Inject
private UserQueryService userQueryService;
/**
* User management service.
*/
@Inject
private UserMgmtService userMgmtService;
/**
* Data model service.
*/
@Inject
private DataModelService dataModelService;
/**
* Language service.
*/
@Inject
private LangPropsService langPropsService;
/**
* Timeline management service.
*/
@Inject
private TimelineMgmtService timelineMgmtService;
/**
* Shows md guide.
*
* @param response the specified response
* @throws Exception exception
*/
@RequestProcessing(value = "/guide/markdown", method = HTTPRequestMethod.GET)
@Before(adviceClass = {<API key>.class})
@After(adviceClass = {PermissionGrant.class, StopwatchEndAdvice.class})
public void showMDGuide(final HTTPRequestContext context, final HttpServletRequest request, final HttpServletResponse response)
throws Exception {
final <API key> renderer = new SkinRenderer(request);
context.setRenderer(renderer);
renderer.setTemplateName("other/md-guide.ftl");
final Map<String, Object> dataModel = renderer.getDataModel();
InputStream inputStream = null;
try {
inputStream = IndexProcessor.class.getResourceAsStream("/md_guide.md");
final String md = IOUtils.toString(inputStream, "UTF-8");
String html = Emotions.convert(md);
html = Markdowns.toHTML(html);
dataModel.put("md", md);
dataModel.put("html", html);
} catch (final Exception e) {
LOGGER.log(Level.ERROR, "Loads markdown guide failed", e);
} finally {
IOUtils.closeQuietly(inputStream);
}
dataModelService.fillHeaderAndFooter(request, response, dataModel);
}
/**
* Shows index.
*
* @param context the specified context
* @param request the specified request
* @param response the specified response
* @throws Exception exception
*/
@RequestProcessing(value = {"", "/"}, method = HTTPRequestMethod.GET)
@Before(adviceClass = {<API key>.class})
@After(adviceClass = {PermissionGrant.class, StopwatchEndAdvice.class})
public void showIndex(final HTTPRequestContext context, final HttpServletRequest request, final HttpServletResponse response)
throws Exception {
final <API key> renderer = new SkinRenderer(request);
context.setRenderer(renderer);
renderer.setTemplateName("index.ftl");
final Map<String, Object> dataModel = renderer.getDataModel();
final int avatarViewMode = (int) request.getAttribute(UserExt.<API key>);
final List<JSONObject> recentArticles = articleQueryService.<API key>(avatarViewMode);
dataModel.put(Common.RECENT_ARTICLES, recentArticles);
JSONObject currentUser = userQueryService.getCurrentUser(request);
if (null == currentUser) {
userMgmtService.tryLogInWithCookie(request, context.getResponse());
}
currentUser = userQueryService.getCurrentUser(request);
if (null != currentUser) {
if (!UserExt.finshedGuide(currentUser)) {
response.sendRedirect(Latkes.getServePath() + "/guide");
return;
}
final String userId = currentUser.optString(Keys.OBJECT_ID);
final int pageSize = Symphonys.getInt("indexArticlesCnt");
final List<JSONObject> <API key> = articleQueryService.<API key>(
avatarViewMode, userId, 1, pageSize);
dataModel.put(Common.<API key>, <API key>);
final List<JSONObject> <API key> = articleQueryService.<API key>(
avatarViewMode, userId, 1, pageSize);
dataModel.put(Common.<API key>, <API key>);
} else {
dataModel.put(Common.<API key>, Collections.emptyList());
dataModel.put(Common.<API key>, Collections.emptyList());
}
final List<JSONObject> perfectArticles = articleQueryService.<API key>(avatarViewMode);
dataModel.put(Common.PERFECT_ARTICLES, perfectArticles);
final List<JSONObject> timelines = timelineMgmtService.getTimelines();
dataModel.put(Common.TIMELINES, timelines);
dataModel.put(Common.SELECTED, Common.INDEX);
dataModelService.fillHeaderAndFooter(request, response, dataModel);
dataModelService.fillIndexTags(dataModel);
}
/**
* Shows recent articles.
*
* @param context the specified context
* @param request the specified request
* @param response the specified response
* @throws Exception exception
*/
@RequestProcessing(value = {"/recent", "/recent/hot", "/recent/good", "/recent/reply"}, method = HTTPRequestMethod.GET)
@Before(adviceClass = {<API key>.class, AnonymousViewCheck.class})
@After(adviceClass = {PermissionGrant.class, StopwatchEndAdvice.class})
public void showRecent(final HTTPRequestContext context, final HttpServletRequest request, final HttpServletResponse response)
throws Exception {
final <API key> renderer = new SkinRenderer(request);
context.setRenderer(renderer);
renderer.setTemplateName("recent.ftl");
final Map<String, Object> dataModel = renderer.getDataModel();
String pageNumStr = request.getParameter("p");
if (Strings.isEmptyOrNull(pageNumStr) || !Strings.isNumeric(pageNumStr)) {
pageNumStr = "1";
}
final int pageNum = Integer.valueOf(pageNumStr);
int pageSize = Symphonys.getInt("indexArticlesCnt");
final JSONObject user = userQueryService.getCurrentUser(request);
if (null != user) {
pageSize = user.optInt(UserExt.USER_LIST_PAGE_SIZE);
if (!UserExt.finshedGuide(user)) {
response.sendRedirect(Latkes.getServePath() + "/guide");
return;
}
}
final int avatarViewMode = (int) request.getAttribute(UserExt.<API key>);
String sortModeStr = StringUtils.substringAfter(request.getRequestURI(), "/recent");
int sortMode;
switch (sortModeStr) {
case "":
sortMode = 0;
break;
case "/hot":
sortMode = 1;
break;
case "/good":
sortMode = 2;
break;
case "/reply":
sortMode = 3;
break;
default:
sortMode = 0;
}
final JSONObject result = articleQueryService.getRecentArticles(avatarViewMode, sortMode, pageNum, pageSize);
final List<JSONObject> allArticles = (List<JSONObject>) result.get(Article.ARTICLES);
dataModel.put(Common.SELECTED, Common.RECENT);
final List<JSONObject> stickArticles = new ArrayList<>();
final Iterator<JSONObject> iterator = allArticles.iterator();
while (iterator.hasNext()) {
final JSONObject article = iterator.next();
final boolean stick = article.optInt(Article.<API key>) > 0;
article.put(Article.ARTICLE_T_IS_STICK, stick);
if (stick) {
stickArticles.add(article);
iterator.remove();
}
}
dataModel.put(Common.STICK_ARTICLES, stickArticles);
dataModel.put(Common.LATEST_ARTICLES, allArticles);
final JSONObject pagination = result.getJSONObject(Pagination.PAGINATION);
final int pageCount = pagination.optInt(Pagination.<API key>);
final List<Integer> pageNums = (List<Integer>) pagination.get(Pagination.<API key>);
if (!pageNums.isEmpty()) {
dataModel.put(Pagination.<API key>, pageNums.get(0));
dataModel.put(Pagination.<API key>, pageNums.get(pageNums.size() - 1));
}
dataModel.put(Pagination.<API key>, pageNum);
dataModel.put(Pagination.<API key>, pageCount);
dataModel.put(Pagination.<API key>, pageNums);
dataModelService.fillHeaderAndFooter(request, response, dataModel);
dataModelService.fillRandomArticles(avatarViewMode, dataModel);
dataModelService.fillSideHotArticles(avatarViewMode, dataModel);
dataModelService.fillSideTags(dataModel);
dataModelService.fillLatestCmts(dataModel);
dataModel.put(Common.CURRENT, StringUtils.substringAfter(request.getRequestURI(), "/recent"));
}
/**
* Shows hot articles.
*
* @param context the specified context
* @param request the specified request
* @param response the specified response
* @throws Exception exception
*/
@RequestProcessing(value = "/hot", method = HTTPRequestMethod.GET)
@Before(adviceClass = {<API key>.class, AnonymousViewCheck.class})
@After(adviceClass = {PermissionGrant.class, StopwatchEndAdvice.class})
public void showHotArticles(final HTTPRequestContext context,
final HttpServletRequest request, final HttpServletResponse response) throws Exception {
final <API key> renderer = new SkinRenderer(request);
context.setRenderer(renderer);
renderer.setTemplateName("hot.ftl");
final Map<String, Object> dataModel = renderer.getDataModel();
int pageSize = Symphonys.getInt("indexArticlesCnt");
final JSONObject user = userQueryService.getCurrentUser(request);
if (null != user) {
pageSize = user.optInt(UserExt.USER_LIST_PAGE_SIZE);
}
final int avatarViewMode = (int) request.getAttribute(UserExt.<API key>);
final List<JSONObject> indexArticles = articleQueryService.getHotArticles(avatarViewMode, pageSize);
dataModel.put(Common.INDEX_ARTICLES, indexArticles);
dataModel.put(Common.SELECTED, Common.HOT);
Stopwatchs.start("Fills");
try {
dataModelService.fillHeaderAndFooter(request, response, dataModel);
if (!(Boolean) dataModel.get(Common.IS_MOBILE)) {
dataModelService.fillRandomArticles(avatarViewMode, dataModel);
}
dataModelService.fillSideHotArticles(avatarViewMode, dataModel);
dataModelService.fillSideTags(dataModel);
dataModelService.fillLatestCmts(dataModel);
} finally {
Stopwatchs.end();
}
}
/**
* Shows SymHub page.
*
* @param context the specified context
* @param request the specified request
* @param response the specified response
* @throws Exception exception
*/
@RequestProcessing(value = "/symhub", method = HTTPRequestMethod.GET)
@Before(adviceClass = {<API key>.class, AnonymousViewCheck.class})
@After(adviceClass = {PermissionGrant.class, StopwatchEndAdvice.class})
public void showSymHub(final HTTPRequestContext context,
final HttpServletRequest request, final HttpServletResponse response) throws Exception {
final <API key> renderer = new SkinRenderer(request);
context.setRenderer(renderer);
renderer.setTemplateName("other/symhub.ftl");
final Map<String, Object> dataModel = renderer.getDataModel();
final List<JSONObject> syms = Symphonys.getSyms();
dataModel.put("syms", (Object) syms);
Stopwatchs.start("Fills");
try {
final int avatarViewMode = (int) request.getAttribute(UserExt.<API key>);
dataModelService.fillHeaderAndFooter(request, response, dataModel);
if (!(Boolean) dataModel.get(Common.IS_MOBILE)) {
dataModelService.fillRandomArticles(avatarViewMode, dataModel);
}
dataModelService.fillSideHotArticles(avatarViewMode, dataModel);
dataModelService.fillSideTags(dataModel);
dataModelService.fillLatestCmts(dataModel);
} finally {
Stopwatchs.end();
}
}
/**
* Shows perfect articles.
*
* @param context the specified context
* @param request the specified request
* @param response the specified response
* @throws Exception exception
*/
@RequestProcessing(value = "/perfect", method = HTTPRequestMethod.GET)
@Before(adviceClass = {<API key>.class, AnonymousViewCheck.class})
@After(adviceClass = {PermissionGrant.class, StopwatchEndAdvice.class})
public void showPerfectArticles(final HTTPRequestContext context,
final HttpServletRequest request, final HttpServletResponse response) throws Exception {
final <API key> renderer = new SkinRenderer(request);
context.setRenderer(renderer);
renderer.setTemplateName("perfect.ftl");
final Map<String, Object> dataModel = renderer.getDataModel();
String pageNumStr = request.getParameter("p");
if (Strings.isEmptyOrNull(pageNumStr) || !Strings.isNumeric(pageNumStr)) {
pageNumStr = "1";
}
final int pageNum = Integer.valueOf(pageNumStr);
int pageSize = Symphonys.getInt("indexArticlesCnt");
final JSONObject user = userQueryService.getCurrentUser(request);
if (null != user) {
pageSize = user.optInt(UserExt.USER_LIST_PAGE_SIZE);
if (!UserExt.finshedGuide(user)) {
response.sendRedirect(Latkes.getServePath() + "/guide");
return;
}
}
final int avatarViewMode = (int) request.getAttribute(UserExt.<API key>);
final JSONObject result = articleQueryService.getPerfectArticles(avatarViewMode, pageNum, pageSize);
final List<JSONObject> perfectArticles = (List<JSONObject>) result.get(Article.ARTICLES);
dataModel.put(Common.PERFECT_ARTICLES, perfectArticles);
dataModel.put(Common.SELECTED, Common.PERFECT);
final JSONObject pagination = result.getJSONObject(Pagination.PAGINATION);
final int pageCount = pagination.optInt(Pagination.<API key>);
final List<Integer> pageNums = (List<Integer>) pagination.get(Pagination.<API key>);
if (!pageNums.isEmpty()) {
dataModel.put(Pagination.<API key>, pageNums.get(0));
dataModel.put(Pagination.<API key>, pageNums.get(pageNums.size() - 1));
}
dataModel.put(Pagination.<API key>, pageNum);
dataModel.put(Pagination.<API key>, pageCount);
dataModel.put(Pagination.<API key>, pageNums);
dataModelService.fillHeaderAndFooter(request, response, dataModel);
dataModelService.fillRandomArticles(avatarViewMode, dataModel);
dataModelService.fillSideHotArticles(avatarViewMode, dataModel);
dataModelService.fillSideTags(dataModel);
dataModelService.fillLatestCmts(dataModel);
}
/**
* Shows about.
*
* @param response the specified response
* @throws Exception exception
*/
@RequestProcessing(value = "/about", method = HTTPRequestMethod.GET)
@Before(adviceClass = <API key>.class)
@After(adviceClass = StopwatchEndAdvice.class)
public void showAbout(final HttpServletResponse response) throws Exception {
response.setStatus(HttpServletResponse.<API key>);
response.setHeader("Location", "https://hacpai.com/article/1440573175609");
response.flushBuffer();
}
/**
* Shows b3log.
*
* @param context the specified context
* @param request the specified request
* @param response the specified response
* @throws Exception exception
*/
@RequestProcessing(value = "/b3log", method = HTTPRequestMethod.GET)
@Before(adviceClass = <API key>.class)
@After(adviceClass = {PermissionGrant.class, StopwatchEndAdvice.class})
public void showB3log(final HTTPRequestContext context,
final HttpServletRequest request, final HttpServletResponse response) throws Exception {
final <API key> renderer = new SkinRenderer(request);
context.setRenderer(renderer);
renderer.setTemplateName("other/b3log.ftl");
final Map<String, Object> dataModel = renderer.getDataModel();
dataModelService.fillHeaderAndFooter(request, response, dataModel);
final int avatarViewMode = (int) request.getAttribute(UserExt.<API key>);
dataModelService.fillRandomArticles(avatarViewMode, dataModel);
dataModelService.fillSideHotArticles(avatarViewMode, dataModel);
dataModelService.fillSideTags(dataModel);
dataModelService.fillLatestCmts(dataModel);
}
/**
* Shows kill browser page with the specified context.
*
* @param context the specified context
* @param request the specified HTTP servlet request
* @param response the specified HTTP servlet response
*/
@RequestProcessing(value = "/kill-browser", method = HTTPRequestMethod.GET)
@Before(adviceClass = <API key>.class)
@After(adviceClass = StopwatchEndAdvice.class)
public void showKillBrowser(final HTTPRequestContext context, final HttpServletRequest request, final HttpServletResponse response) {
final <API key> renderer = new SkinRenderer(request);
renderer.setTemplateName("other/kill-browser.ftl");
context.setRenderer(renderer);
final Map<String, Object> dataModel = renderer.getDataModel();
final Map<String, String> langs = langPropsService.getAll(Locales.getLocale());
dataModel.putAll(langs);
Keys.fillRuntime(dataModel);
dataModelService.fillMinified(dataModel);
}
}
|
require 'test/unit'
class FizzbuzzTest < Test::Unit::TestCase
# Called before every test method runs. Can be used
# to set up fixture information.
def setup
# Do nothing
end
# Called after every test method runs. Can be used to tear
# down fixture information.
def teardown
# Do nothing
end
# Fake test
def test_fail
expected = 1
actual =1
assert_same expected, actual
# fail('Not implemented')
end
def test_fizzbuzz
require './fizzbuzz.d/rb-fizzbuzz'
res=[]
1.upto(100).each {|e|
next if fizbuz e, res
next if fiz e, res
next if buz e, res
res << e
}
assert_same 100, res.length
end
end
|
#define BOOST_TEST_MODULE <API key>
#include <boost/test/unit_test.hpp>
#include <boost/test/test_tools.hpp>
#include <boost/filesystem.hpp>
#include <ostream>
#include <fstream>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/Parser/ParserRecord.hpp>
#include <opm/parser/eclipse/Parser/ParserEnums.hpp>
using namespace Opm;
using namespace boost::filesystem;
static void
<API key>(path& datafile, std::string addEndKeyword)
{
path tmpdir = temp_directory_path();
path root = tmpdir / unique_path("%%%%-%%%%");
path absoluteInclude = root / "absolute.include";
path includePath1 = root / "include";
path includePath2 = root / "include2";
path pathIncludeFile = "path.file";
create_directories(root);
create_directories(includePath1);
create_directories(includePath2);
{
datafile = root / "TEST.DATA";
std::ofstream of(datafile.string().c_str());
of << "PATHS" << std::endl;
of << "PATH1 '" << includePath1.string() << "' /" << std::endl;
of << "PATH2 '" << includePath2.string() << "' /" << std::endl;
of << "/" << std::endl;
of << "INCLUDE" << std::endl;
of << " \'relative.include\' /" << std::endl;
of << std::endl;
of << "INCLUDE" << std::endl;
of << " \'" << absoluteInclude.string() << "\' /" << std::endl;
of << std::endl;
of << "INCLUDE" << std::endl;
of << " \'include/nested.include\' /" << std::endl;
of << std::endl;
of << std::endl;
of << "INCLUDE" << std::endl;
of << " \'$PATH1/" << pathIncludeFile.string() << "\' /" << std::endl;
of << std::endl;
of << "INCLUDE" << std::endl;
of << " \'$PATH2/" << pathIncludeFile.string() << "\' /" << std::endl;
of.close();
}
{
path relativeInclude = root / "relative.include";
std::ofstream of(relativeInclude.string().c_str());
of << "START" << std::endl;
of << " 10 'FEB' 2012 /" << std::endl;
of.close();
}
{
std::ofstream of(absoluteInclude.string().c_str());
if (addEndKeyword.length() > 0) {
of << addEndKeyword << std::endl;
}
of << "DIMENS" << std::endl;
of << " 10 20 30 /" << std::endl;
of.close();
}
{
path nestedInclude = includePath1 / "nested.include";
path gridInclude = includePath1 / "grid.include";
std::ofstream of(nestedInclude.string().c_str());
of << "INCLUDE" << std::endl;
of << " \'$PATH1/grid.include\' /" << std::endl;
of.close();
std::ofstream of2(gridInclude.string().c_str());
of2 << "GRIDUNIT" << std::endl;
of2 << "/" << std::endl;
of2.close();
}
{
path <API key> = includePath1 / pathIncludeFile;
std::ofstream of1(<API key>.string().c_str());
of1 << "TITLE" << std::endl;
of1 << "This is the title /" << std::endl;
of1.close();
path <API key> = includePath2 / pathIncludeFile;
std::ofstream of2(<API key>.string().c_str());
of2 << "BOX" << std::endl;
of2 << " 1 2 3 4 5 6 /" << std::endl;
of2.close();
}
std::cout << datafile << std::endl;
}
<API key>(<API key>) {
path datafile;
Parser parser;
<API key> (datafile, "");
auto deck = parser.parseFile(datafile.string());
BOOST_CHECK( deck.hasKeyword("START"));
BOOST_CHECK( deck.hasKeyword("DIMENS"));
BOOST_CHECK( deck.hasKeyword("GRIDUNIT"));
}
<API key>(<API key>) {
path datafile;
Parser parser;
<API key> (datafile, "ENDINC");
auto deck = parser.parseFile(datafile.string());
BOOST_CHECK( deck.hasKeyword("START"));
BOOST_CHECK( !deck.hasKeyword("DIMENS"));
BOOST_CHECK( deck.hasKeyword("GRIDUNIT"));
}
<API key>(<API key>) {
path datafile;
Parser parser;
<API key> (datafile, "END");
auto deck = parser.parseFile(datafile.string());
BOOST_CHECK( deck.hasKeyword("START"));
BOOST_CHECK( !deck.hasKeyword("DIMENS"));
BOOST_CHECK( !deck.hasKeyword("GRIDUNIT"));
}
<API key>(<API key>) {
path datafile;
Parser parser;
<API key> (datafile, "");
auto deck = parser.parseFile(datafile.string());
BOOST_CHECK( deck.hasKeyword("TITLE"));
BOOST_CHECK( deck.hasKeyword("BOX"));
}
|
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Newegg.Oversea.Silverlight.ControlPanel.Core.Base;
using ECCentral.BizEntity.Enum;
using ECCentral.BizEntity.MKT;
using Newegg.Oversea.Silverlight.Utilities.Validation;
using ECCentral.BizEntity;
namespace ECCentral.Portal.UI.MKT.Models
{
public class AmbassadorNewsVM : ModelBase
{
public string CompanyCode { get; set; }
public int? SysNo { get; set; }
private int? _ReferenceSysNo;
public int? ReferenceSysNo
{
get { return _ReferenceSysNo; }
set { base.SetValue("ReferenceSysNo", ref _ReferenceSysNo, value); }
}
private string _Title;
[Validate(ValidateType.Required)]
[Validate(ValidateType.MaxLength,100)]
public string Title
{
get { return _Title; }
set { base.SetValue("Title", ref _Title, value); }
}
private string _Content;
[Validate(ValidateType.Required)]
public string Content
{
get { return _Content; }
set { base.SetValue("Content", ref _Content, value); }
}
private <API key>? status;
[Validate(ValidateType.Required)]
public <API key>? Status
{
get { return status; }
set { base.SetValue("Status", ref status, value); }
}
}
}
|
using ServiceStack.OrmLite;
using System;
using System.Configuration;
using System.Data;
namespace Bm2s.Data.Utils
{
<summary>
Data access point
</summary>
public class Datas
{
<summary>
Database provider
</summary>
private <API key> _dbProvider;
<summary>
Gets the database provider
</summary>
public <API key> DbProvider
{
get
{
if (this._dbProvider == null)
{
switch (<API key>.AppSettings["DbProvider"].ToLower())
{
case "oracle":
this._dbProvider = OracleDialect.Provider;
break;
case "mysql" :
this._dbProvider = MySqlDialect.Provider;
break;
case "postgresql":
this._dbProvider = PostgreSqlDialect.Provider;
break;
case "mssqlserver":
this._dbProvider = SqlServerDialect.Provider;
break;
default:
this._dbProvider = null;
break;
}
}
return this._dbProvider;
}
}
<summary>
Database connection
</summary>
private IDbConnection _dbConnection;
<summary>
Gets the database connection
</summary>
public IDbConnection DbConnection
{
get
{
if (this._dbConnection == null)
{
this._dbConnection = this.DbConnectionFactory.OpenDbConnection();
}
return this._dbConnection;
}
}
<summary>
Database connection factory
</summary>
private <API key> <API key>;
<summary>
Gets the database connection factory
</summary>
public <API key> DbConnectionFactory
{
get
{
if (this.<API key> == null)
{
this.<API key> = new <API key>(<API key>.ConnectionStrings["bm2s"].ConnectionString, this.DbProvider);
}
return this.<API key>;
}
}
<summary>
Constructor for the singleton
</summary>
protected Datas()
{
this.CheckDatabaseSchema();
}
<summary>
Creation of the schemas
</summary>
public virtual void CheckDatabaseSchema()
{
}
<summary>
Create datas for the first use
</summary>
public virtual void CheckFirstUseDatas()
{
}
}
}
|
define(function(require, exports, module) {
exports.hello= function (echo) {
alert(echo);
};
})
|
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* SciClubPadova Model
*
* @since 0.0.1
*/
class <API key> extends JModelItem
{
/**
* @var object item
*/
protected $item;
/**
* Method to auto-populate the model state.
*
* This method should only be called once per instantiation and is designed
* to be called on the first call to the getState() method unless the model
* configuration flag to ignore the request is set.
*
* Note. Calling getState in this method will result in recursion.
*
* @return void
* @since 2.5
*/
protected function populateState()
{
// Get the message id
$jinput = JFactory::getApplication()->input;
$id = $jinput->get('id', 1, 'INT');
$this->setState('message.id', $id);
// Load the parameters.
$this->setState('params', JFactory::getApplication()->getParams());
parent::populateState();
}
/**
* Method to get a table object, load it if necessary.
*
* @param string $type The table name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JTable A JTable object
*
* @since 1.6
*/
public function getTable($type = 'SciClubPadova', $prefix = 'SciClubPadovaTable', $config = array())
{
return JTable::getInstance($type, $prefix, $config);
}
/**
* Get the message
* @return object The message to be displayed to the user
*/
public function getItem()
{
if (!isset($this->item))
{
$id = $this->getState('message.id');
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('h.greeting, h.params, c.title as category')
->from('#__sciclubpadova as h')
->leftJoin('#__categories as c ON h.catid=c.id')
->where('h.id=' . (int)$id);
$db->setQuery((string)$query);
if ($this->item = $db->loadObject())
{
// Load the JSON string
$params = new JRegistry;
$params->loadString($this->item->params, 'JSON');
$this->item->params = $params;
// Merge global params with item params
$params = clone $this->getState('params');
$params->merge($this->item->params);
$this->item->params = $params;
}
}
return $this->item;
}
}
|
body {
word-wrap: break-word;
word-break: break-all;
padding: 2px 5px;
background-color: #FFFFFF;
color: #000000;
max-width: 1024px;
margin: 0px auto;
box-shadow: 0 0 15px #ccc;
tab-size: 4; -moz-tab-size: 4; -o-tab-size: 4; -webkit-tab-size: 4;
}
p, div {
overflow: hidden;
}
p {
margin: 0px;
padding: 2px 1px 2px 1px;
}
.tp {
margin: 0px;
background-color: #E6F3FF;
}
a {
text-decoration: none;
color: #08C;
}
form {
margin: 0px;
padding: 0px;
}
img, input, textarea {
max-width: 100%;
vertical-align: middle;
}
hr {
height: 1px;
border: 1px solid #BED8EA;
border-left: none;
border-right: none;
}
textarea {
width: 270px;
height: 55px;
overflow-y: visible;
}
pre, textarea {
white-space: pre-wrap;
word-wrap: break-word;
word-break: break-all;
}
ol, ul {
margin: 0px;
}
.success {
color: green;
}
.failure {
color: red;
}
.notice {
color: red;
}
img {
max-width: 100%;
}
.info-box {
text-align: center;
border: solid red 1px;
}
.video {
width: 600px;
height: 400px;
border: none;
max-width: 100%;
}
.audio {
width: 600px;
border: none;
max-width: 100%;
}
#content_title {
width: 270px;
max-width: 100%;
}
@media screen and (min-width: 800px) {
img {
max-width: 800px;
max-height: 600px;
}
}
.topic-ul {
list-style-type: none;
padding: 0;
}
.topic-ul > li {
padding: 5px 10px 2px 10px;
border-bottom: 1px solid #EEE;
display: flex;
align-items: center;
justify-content: space-between;
}
.topic-ul > li .topic-meta {
margin: 0px;
}
.topic-ul > li .topic-reply-count {
width: 5%;
display: flex;
font-weight: 300;
font-size: 30px;
color: gray;
}
.topic-ul > li .topic-reply-count a {
color: gray;
}
.topic-ul > li .topic-forum-name {
width: 15%;
display: flex;
}
.topic-ul > li .topic-forum-name a {
color: gray;
}
.topic-ul > li .topic-anchor {
width: 20%;
display: flex;
flex-direction: column;
align-items: center;
word-break: break-all;
}
.topic-ul > li .topic-anchor > a {
color: gray;
}
.topic-ul > li .topic-title {
width: 60%;
display: flex;
flex-direction: column;
justify-content: center;
}
.topic-ul > li .topic-title > a {
font-size: 18px;
display: block;
}
.page-jumper {
overflow: hidden;
display: inline-flex;
flex-wrap: wrap;
align-content: center;
padding-left: 2px;
margin: 10px 0 0 20px;
}
.page-jumper > li {
display: inline-block;
}
.page-jumper > li > input {
height: 22px;
width: 38px;
position: relative;
margin-left: -1px;
display: block;
padding: 5px 10px;
border: 1px solid #ddd;
border-radius: 5px;
color: #337ab7;
}
.pagination {
overflow: hidden;
display: inline-flex;
flex-wrap: wrap;
align-content: center;
padding-left: 2px;
margin: 10px 0 0 20px;
}
.pagination > li {
display: inline-block;
}
.pagination > li:first-child > a {
border-radius: 5px 0 0 5px;
}
.pagination > li:last-child > a {
border-radius: 0 5px 5px 0;
}
.pagination > li > a {
position: relative;
margin-left: -1px;
display: block;
padding: 5px 10px;
border: 1px solid #ddd;
color: #337ab7;
}
.pagination > .disabled > a {
color: #777;
cursor: not-allowed;
background-color: #fff;
}
.pagination > .disabled > a:focus {
color: #777;
cursor: not-allowed;
background-color: #fff;
}
.pagination > .disabled > a:hover {
color: #777;
cursor: not-allowed;
background-color: #fff;
}
.pagination > .active > a {
color: #fff;
cursor: default;
background-color: #337ab7;
border-color: #337ab7;
}
.pagination > .active > a:focus {
color: #fff;
cursor: default;
background-color: #337ab7;
border-color: #337ab7;
}
.pagination > .active > a:hover {
color: #fff;
cursor: default;
background-color: #337ab7;
border-color: #337ab7;
}
@media screen and (max-width: 600px) {
.topic-ul > li .topic-reply-count {
display: block;
}
.topic-ul > li .topic-reply-count .number {
display: block;
font-size: 14px;
}
.topic-ul > li .topic-reply-count .spliter {
display: none;
}
.topic-ul > li .topic-reply-count .forum {
display: block;
font-size: 14px;
}
.topic-ul > li .topic-anchor > a {
font-size: 14px;
}
.topic-ul > li .topic-title > a {
font-size: 16px;
}
.topic-ul > li .topic-reply-count {
display: none;
}
.topic-ul > li .topic-forum-name {
display: none;
}
.topic-ul > li .topic-title {
width: 80%;
}
}
.<API key> .empty {
width: 100%;
text-align: center;
color: #999fa5;
font-size: 14px;
}
.<API key> .user-item {
height: 60px;
color: #333333;
display: block;
border-bottom: 1px solid #f5f5f5;
}
.<API key> .user-item a {
text-decoration: none;
}
.<API key> .user-item a:nth-child(1) {
display: inline-block;
width: calc(100% - 60px);
}
.<API key> .user-item .avatar {
float: left;
height: 50px;
width: 50px;
margin-left: 20px;
margin-top: 5px;
display: inline-block;
border-radius: 50px;
}
.<API key> .user-item .info {
margin-left: 15px;
margin-top: 10px;
display: inline-block;
width: calc(100% - 100px);
}
.<API key> .user-item .info .name {
font-size: 18px;
}
.<API key> .user-item .info .signature {
color: #999fa5;
font-size: 12px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.<API key> .user-item .remove {
float: right;
height: 100%;
width: 60px;
display: inline-block;
padding-top: 20px;
color: #ff0000;
text-align: center;
}
.reply-box blockquote {
background: #f9f9f9;
border-left: 10px solid #ccc;
margin: 1.5em 10px;
padding: 0.5em 10px;
max-height: 500px;
overflow: hidden;
text-overflow: ellipsis;
}
.reply-box blockquote:before {
color: #ccc;
font-size: 4em;
line-height: 0.1em;
margin-right: 0.25em;
vertical-align: -0.4em;
}
#searchType-label {
display: inline-block;
}
.hu60_face, #face img {
width: 32px;
max-width: 32px;
}
.hu60_code code, .markdown-body pre code {
white-space: pre-wrap !important;
word-wrap: break-word !important;
word-break: break-all !important;
}
.hu60_code code {
background-color: #f7f7f7;
}
|
<?php
/** PHPExcel root directory */
if (!defined('PHPEXCEL_ROOT')) {
/**
* @ignore
*/
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}
class <API key> extends <API key> implements <API key>
{
/**
* Input encoding
*
* @var string
*/
private $inputEncoding = 'ANSI';
/**
* Sheet index to read
*
* @var int
*/
private $sheetIndex = 0;
/**
* Formats
*
* @var array
*/
private $formats = array();
/**
* Format Count
*
* @var int
*/
private $format = 0;
/**
* Create a new <API key>
*/
public function __construct()
{
$this->readFilter = new <API key>();
}
/**
* Validate that the current file is a SYLK file
*
* @return boolean
*/
protected function isValidFormat()
{
// Read sample data (first 2 KB will do)
$data = fread($this->fileHandle, 2048);
// Count delimiters in file
$delimiterCount = substr_count($data, ';');
if ($delimiterCount < 1) {
return false;
}
// Analyze first line looking for ID; signature
$lines = explode("\n", $data);
if (substr($lines[0], 0, 4) != 'ID;P') {
return false;
}
return true;
}
/**
* Set input encoding
*
* @param string $pValue Input encoding
*/
public function setInputEncoding($pValue = 'ANSI')
{
$this->inputEncoding = $pValue;
return $this;
}
/**
* Get input encoding
*
* @return string
*/
public function getInputEncoding()
{
return $this->inputEncoding;
}
/**
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
*
* @param string $pFilename
* @throws <API key>
*/
public function listWorksheetInfo($pFilename)
{
// Open file
$this->openFile($pFilename);
if (!$this->isValidFormat()) {
fclose($this->fileHandle);
throw new <API key>($pFilename . " is an Invalid Spreadsheet file.");
}
$fileHandle = $this->fileHandle;
rewind($fileHandle);
$worksheetInfo = array();
$worksheetInfo[0]['worksheetName'] = 'Worksheet';
$worksheetInfo[0]['lastColumnLetter'] = 'A';
$worksheetInfo[0]['lastColumnIndex'] = 0;
$worksheetInfo[0]['totalRows'] = 0;
$worksheetInfo[0]['totalColumns'] = 0;
// Loop through file
$rowData = array();
// loop through one row (line) at a time in the file
$rowIndex = 0;
while (($rowData = fgets($fileHandle)) !== false) {
$columnIndex = 0;
// convert SYLK encoded $rowData to UTF-8
$rowData = <API key>::SYLKtoUTF8($rowData);
// explode each row at semicolons while taking into account that literal semicolon (;)
// is escaped like this (;;)
$rowData = explode("\t", str_replace('¤', ';', str_replace(';', "\t", str_replace(';;', '¤', rtrim($rowData)))));
$dataType = array_shift($rowData);
if ($dataType == 'C') {
// Read cell value data
foreach ($rowData as $rowDatum) {
switch ($rowDatum{0}) {
case 'C':
case 'X':
$columnIndex = substr($rowDatum, 1) - 1;
break;
case 'R':
case 'Y':
$rowIndex = substr($rowDatum, 1);
break;
}
$worksheetInfo[0]['totalRows'] = max($worksheetInfo[0]['totalRows'], $rowIndex);
$worksheetInfo[0]['lastColumnIndex'] = max($worksheetInfo[0]['lastColumnIndex'], $columnIndex);
}
}
}
$worksheetInfo[0]['lastColumnLetter'] = PHPExcel_Cell::<API key>($worksheetInfo[0]['lastColumnIndex']);
$worksheetInfo[0]['totalColumns'] = $worksheetInfo[0]['lastColumnIndex'] + 1;
// Close file
fclose($fileHandle);
return $worksheetInfo;
}
/**
* Loads PHPExcel from file
*
* @param string $pFilename
* @return PHPExcel
* @throws <API key>
*/
public function load($pFilename)
{
// Create new PHPExcel
$objPHPExcel = new PHPExcel();
// Load into this instance
return $this->loadIntoExisting($pFilename, $objPHPExcel);
}
/**
* Loads PHPExcel from file into PHPExcel instance
*
* @param string $pFilename
* @param PHPExcel $objPHPExcel
* @return PHPExcel
* @throws <API key>
*/
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
{
// Open file
$this->openFile($pFilename);
if (!$this->isValidFormat()) {
fclose($this->fileHandle);
throw new <API key>($pFilename . " is an Invalid Spreadsheet file.");
}
$fileHandle = $this->fileHandle;
rewind($fileHandle);
// Create new PHPExcel
while ($objPHPExcel->getSheetCount() <= $this->sheetIndex) {
$objPHPExcel->createSheet();
}
$objPHPExcel->setActiveSheetIndex($this->sheetIndex);
$fromFormats = array('\-', '\ ');
$toFormats = array('-', ' ');
// Loop through file
$rowData = array();
$column = $row = '';
// loop through one row (line) at a time in the file
while (($rowData = fgets($fileHandle)) !== false) {
// convert SYLK encoded $rowData to UTF-8
$rowData = <API key>::SYLKtoUTF8($rowData);
// explode each row at semicolons while taking into account that literal semicolon (;)
// is escaped like this (;;)
$rowData = explode("\t", str_replace('¤', ';', str_replace(';', "\t", str_replace(';;', '¤', rtrim($rowData)))));
$dataType = array_shift($rowData);
// Read shared styles
if ($dataType == 'P') {
$formatArray = array();
foreach ($rowData as $rowDatum) {
switch ($rowDatum{0}) {
case 'P':
$formatArray['numberformat']['code'] = str_replace($fromFormats, $toFormats, substr($rowDatum, 1));
break;
case 'E':
case 'F':
$formatArray['font']['name'] = substr($rowDatum, 1);
break;
case 'L':
$formatArray['font']['size'] = substr($rowDatum, 1);
break;
case 'S':
$styleSettings = substr($rowDatum, 1);
for ($i=0; $i<strlen($styleSettings); ++$i) {
switch ($styleSettings{$i}) {
case 'I':
$formatArray['font']['italic'] = true;
break;
case 'D':
$formatArray['font']['bold'] = true;
break;
case 'T':
$formatArray['borders']['top']['style'] = <API key>::BORDER_THIN;
break;
case 'B':
$formatArray['borders']['bottom']['style'] = <API key>::BORDER_THIN;
break;
case 'L':
$formatArray['borders']['left']['style'] = <API key>::BORDER_THIN;
break;
case 'R':
$formatArray['borders']['right']['style'] = <API key>::BORDER_THIN;
break;
}
}
break;
}
}
$this->formats['P'.$this->format++] = $formatArray;
// Read cell value data
} elseif ($dataType == 'C') {
$hasCalculatedValue = false;
$cellData = $cellDataFormula = '';
foreach ($rowData as $rowDatum) {
switch ($rowDatum{0}) {
case 'C':
case 'X':
$column = substr($rowDatum, 1);
break;
case 'R':
case 'Y':
$row = substr($rowDatum, 1);
break;
case 'K':
$cellData = substr($rowDatum, 1);
break;
case 'E':
$cellDataFormula = '='.substr($rowDatum, 1);
// Convert R1C1 style references to A1 style references (but only when not quoted)
$temp = explode('"', $cellDataFormula);
$key = false;
foreach ($temp as &$value) {
// Only count/replace in alternate array entries
if ($key = !$key) {
preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/', $value, $cellReferences, PREG_SET_ORDER+PREG_OFFSET_CAPTURE);
// Reverse the matches array, otherwise all our offsets will become incorrect if we modify our way
// through the formula from left to right. Reversing means that we work right to left.through
// the formula
$cellReferences = array_reverse($cellReferences);
// Loop through each R1C1 style reference in turn, converting it to its A1 style equivalent,
// then modify the formula to use that new reference
foreach ($cellReferences as $cellReference) {
$rowReference = $cellReference[2][0];
// Empty R reference is the current row
if ($rowReference == '') {
$rowReference = $row;
}
// Bracketed R references are relative to the current row
if ($rowReference{0} == '[') {
$rowReference = $row + trim($rowReference, '[]');
}
$columnReference = $cellReference[4][0];
// Empty C reference is the current column
if ($columnReference == '') {
$columnReference = $column;
}
// Bracketed C references are relative to the current column
if ($columnReference{0} == '[') {
$columnReference = $column + trim($columnReference, '[]');
}
$A1CellReference = PHPExcel_Cell::<API key>($columnReference-1).$rowReference;
$value = substr_replace($value, $A1CellReference, $cellReference[0][1], strlen($cellReference[0][0]));
}
}
}
unset($value);
// Then rebuild the formula string
$cellDataFormula = implode('"', $temp);
$hasCalculatedValue = true;
break;
}
}
$columnLetter = PHPExcel_Cell::<API key>($column-1);
$cellData = <API key>::unwrapResult($cellData);
// Set cell value
$objPHPExcel->getActiveSheet()->getCell($columnLetter.$row)->setValue(($hasCalculatedValue) ? $cellDataFormula : $cellData);
if ($hasCalculatedValue) {
$cellData = <API key>::unwrapResult($cellData);
$objPHPExcel->getActiveSheet()->getCell($columnLetter.$row)->setCalculatedValue($cellData);
}
// Read cell formatting
} elseif ($dataType == 'F') {
$formatStyle = $columnWidth = $styleSettings = '';
$styleData = array();
foreach ($rowData as $rowDatum) {
switch ($rowDatum{0}) {
case 'C':
case 'X':
$column = substr($rowDatum, 1);
break;
case 'R':
case 'Y':
$row = substr($rowDatum, 1);
break;
case 'P':
$formatStyle = $rowDatum;
break;
case 'W':
list($startCol, $endCol, $columnWidth) = explode(' ', substr($rowDatum, 1));
break;
case 'S':
$styleSettings = substr($rowDatum, 1);
for ($i=0; $i<strlen($styleSettings); ++$i) {
switch ($styleSettings{$i}) {
case 'I':
$styleData['font']['italic'] = true;
break;
case 'D':
$styleData['font']['bold'] = true;
break;
case 'T':
$styleData['borders']['top']['style'] = <API key>::BORDER_THIN;
break;
case 'B':
$styleData['borders']['bottom']['style'] = <API key>::BORDER_THIN;
break;
case 'L':
$styleData['borders']['left']['style'] = <API key>::BORDER_THIN;
break;
case 'R':
$styleData['borders']['right']['style'] = <API key>::BORDER_THIN;
break;
}
}
break;
}
}
if (($formatStyle > '') && ($column > '') && ($row > '')) {
$columnLetter = PHPExcel_Cell::<API key>($column-1);
if (isset($this->formats[$formatStyle])) {
$objPHPExcel->getActiveSheet()->getStyle($columnLetter.$row)->applyFromArray($this->formats[$formatStyle]);
}
}
if ((!empty($styleData)) && ($column > '') && ($row > '')) {
$columnLetter = PHPExcel_Cell::<API key>($column-1);
$objPHPExcel->getActiveSheet()->getStyle($columnLetter.$row)->applyFromArray($styleData);
}
if ($columnWidth > '') {
if ($startCol == $endCol) {
$startCol = PHPExcel_Cell::<API key>($startCol-1);
$objPHPExcel->getActiveSheet()->getColumnDimension($startCol)->setWidth($columnWidth);
} else {
$startCol = PHPExcel_Cell::<API key>($startCol-1);
$endCol = PHPExcel_Cell::<API key>($endCol-1);
$objPHPExcel->getActiveSheet()->getColumnDimension($startCol)->setWidth($columnWidth);
do {
$objPHPExcel->getActiveSheet()->getColumnDimension(++$startCol)->setWidth($columnWidth);
} while ($startCol != $endCol);
}
}
} else {
foreach ($rowData as $rowDatum) {
switch ($rowDatum{0}) {
case 'C':
case 'X':
$column = substr($rowDatum, 1);
break;
case 'R':
case 'Y':
$row = substr($rowDatum, 1);
break;
}
}
}
}
// Close file
fclose($fileHandle);
// Return
return $objPHPExcel;
}
/**
* Get sheet index
*
* @return int
*/
public function getSheetIndex()
{
return $this->sheetIndex;
}
/**
* Set sheet index
*
* @param int $pValue Sheet index
* @return <API key>
*/
public function setSheetIndex($pValue = 0)
{
$this->sheetIndex = $pValue;
return $this;
}
}
|
import math
from PyQt5.QtCore import Qt, pyqtSlot
from PyQt5.QtGui import QCloseEvent
from PyQt5.QtWidgets import QDialog, QInputDialog
from urh import settings
from urh.models.FuzzingTableModel import FuzzingTableModel
from urh.signalprocessing.ProtocoLabel import ProtocolLabel
from urh.signalprocessing.<API key> import <API key>
from urh.ui.ui_fuzzing import Ui_FuzzingDialog
class FuzzingDialog(QDialog):
def __init__(self, protocol: <API key>, label_index: int, msg_index: int, proto_view: int,
parent=None):
super().__init__(parent)
self.ui = Ui_FuzzingDialog()
self.ui.setupUi(self)
self.setAttribute(Qt.WA_DeleteOnClose)
self.setWindowFlags(Qt.Window)
self.protocol = protocol
msg_index = msg_index if msg_index != -1 else 0
self.ui.spinBoxFuzzMessage.setValue(msg_index + 1)
self.ui.spinBoxFuzzMessage.setMinimum(1)
self.ui.spinBoxFuzzMessage.setMaximum(self.protocol.num_messages)
self.ui.<API key>.addItems([l.name for l in self.message.message_type])
self.ui.<API key>.setCurrentIndex(label_index)
self.proto_view = proto_view
self.fuzz_table_model = FuzzingTableModel(self.current_label, proto_view)
self.fuzz_table_model.remove_duplicates = self.ui.<API key>.isChecked()
self.ui.tblFuzzingValues.setModel(self.fuzz_table_model)
self.fuzz_table_model.update()
self.ui.spinBoxFuzzingStart.setValue(self.current_label_start + 1)
self.ui.spinBoxFuzzingEnd.setValue(self.current_label_end)
self.ui.spinBoxFuzzingStart.setMaximum(len(self.message_data))
self.ui.spinBoxFuzzingEnd.setMaximum(len(self.message_data))
self.<API key>()
self.ui.tblFuzzingValues.resize_me()
self.create_connects()
self.restoreGeometry(settings.read("{}/geometry".format(self.__class__.__name__), type=bytes))
@property
def message(self):
return self.protocol.messages[int(self.ui.spinBoxFuzzMessage.value() - 1)]
@property
def current_label_index(self):
return self.ui.<API key>.currentIndex()
@property
def current_label(self) -> ProtocolLabel:
if len(self.message.message_type) == 0:
return None
cur_label = self.message.message_type[self.current_label_index].get_copy()
self.message.message_type[self.current_label_index] = cur_label
cur_label.fuzz_values = [fv for fv in cur_label.fuzz_values if fv] # Remove empty strings
if len(cur_label.fuzz_values) == 0:
cur_label.fuzz_values.append(self.message.plain_bits_str[cur_label.start:cur_label.end])
return cur_label
@property
def current_label_start(self):
if self.current_label and self.message:
return self.message.get_label_range(self.current_label, self.proto_view, False)[0]
else:
return -1
@property
def current_label_end(self):
if self.current_label and self.message:
return self.message.get_label_range(self.current_label, self.proto_view, False)[1]
else:
return -1
@property
def message_data(self):
if self.proto_view == 0:
return self.message.plain_bits_str
elif self.proto_view == 1:
return self.message.plain_hex_str
elif self.proto_view == 2:
return self.message.plain_ascii_str
else:
return None
def create_connects(self):
self.ui.spinBoxFuzzingStart.valueChanged.connect(self.<API key>)
self.ui.spinBoxFuzzingEnd.valueChanged.connect(self.<API key>)
self.ui.<API key>.currentIndexChanged.connect(self.<API key>)
self.ui.btnRepeatValues.clicked.connect(self.<API key>)
self.ui.btnAddRow.clicked.connect(self.<API key>)
self.ui.btnDelRow.clicked.connect(self.<API key>)
self.ui.tblFuzzingValues.deletion_wanted.connect(self.delete_lines)
self.ui.<API key>.stateChanged.connect(self.<API key>)
self.ui.sBAddRangeStart.valueChanged.connect(self.<API key>)
self.ui.sBAddRangeEnd.valueChanged.connect(self.<API key>)
self.ui.checkBoxLowerBound.stateChanged.connect(self.<API key>)
self.ui.checkBoxUpperBound.stateChanged.connect(self.<API key>)
self.ui.spinBoxLowerBound.valueChanged.connect(self.<API key>)
self.ui.spinBoxUpperBound.valueChanged.connect(self.<API key>)
self.ui.<API key>.valueChanged.connect(self.<API key>)
self.ui.<API key>.valueChanged.connect(self.<API key>)
self.ui.spinBoxFuzzMessage.valueChanged.connect(self.on_fuzz_msg_changed)
self.ui.btnAddFuzzingValues.clicked.connect(self.<API key>)
self.ui.<API key>.editTextChanged.connect(self.<API key>)
def <API key>(self):
fuz_start = self.current_label_start
fuz_end = self.current_label_end
num_proto_bits = 10
num_fuz_bits = 16
proto_start = fuz_start - num_proto_bits
preambel = "... "
if proto_start <= 0:
proto_start = 0
preambel = ""
proto_end = fuz_end + num_proto_bits
postambel = " ..."
if proto_end >= len(self.message_data) - 1:
proto_end = len(self.message_data) - 1
postambel = ""
fuzamble = ""
if fuz_end - fuz_start > num_fuz_bits:
fuz_end = fuz_start + num_fuz_bits
fuzamble = "..."
self.ui.lPreBits.setText(preambel + self.message_data[proto_start:self.current_label_start])
self.ui.lFuzzedBits.setText(self.message_data[fuz_start:fuz_end] + fuzamble)
self.ui.lPostBits.setText(self.message_data[self.current_label_end:proto_end] + postambel)
self.<API key>()
def closeEvent(self, event: QCloseEvent):
settings.write("{}/geometry".format(self.__class__.__name__), self.saveGeometry())
super().closeEvent(event)
@pyqtSlot(int)
def <API key>(self, value: int):
self.ui.spinBoxFuzzingEnd.setMinimum(self.ui.spinBoxFuzzingStart.value())
new_start = self.message.convert_index(value - 1, self.proto_view, 0, False)[0]
self.current_label.start = new_start
self.current_label.fuzz_values[:] = []
self.<API key>()
self.fuzz_table_model.update()
self.ui.tblFuzzingValues.resize_me()
@pyqtSlot(int)
def <API key>(self, value: int):
self.ui.spinBoxFuzzingStart.setMaximum(self.ui.spinBoxFuzzingEnd.value())
new_end = self.message.convert_index(value - 1, self.proto_view, 0, False)[1] + 1
self.current_label.end = new_end
self.current_label.fuzz_values[:] = []
self.<API key>()
self.fuzz_table_model.update()
self.ui.tblFuzzingValues.resize_me()
@pyqtSlot(int)
def <API key>(self, index: int):
self.fuzz_table_model.fuzzing_label = self.current_label
self.fuzz_table_model.update()
self.<API key>()
self.ui.tblFuzzingValues.resize_me()
self.ui.spinBoxFuzzingStart.blockSignals(True)
self.ui.spinBoxFuzzingStart.setValue(self.current_label_start + 1)
self.ui.spinBoxFuzzingStart.blockSignals(False)
self.ui.spinBoxFuzzingEnd.blockSignals(True)
self.ui.spinBoxFuzzingEnd.setValue(self.current_label_end)
self.ui.spinBoxFuzzingEnd.blockSignals(False)
@pyqtSlot()
def <API key>(self):
self.current_label.add_fuzz_value()
self.fuzz_table_model.update()
@pyqtSlot()
def <API key>(self):
min_row, max_row, _, _ = self.ui.tblFuzzingValues.selection_range()
self.delete_lines(min_row, max_row)
@pyqtSlot(int, int)
def delete_lines(self, min_row, max_row):
if min_row == -1:
self.current_label.fuzz_values = self.current_label.fuzz_values[:-1]
else:
self.current_label.fuzz_values = self.current_label.fuzz_values[:min_row] + self.current_label.fuzz_values[
max_row + 1:]
_ = self.current_label # if user deleted all, this will restore a fuzz value
self.fuzz_table_model.update()
@pyqtSlot()
def <API key>(self):
self.fuzz_table_model.remove_duplicates = self.ui.<API key>.isChecked()
self.fuzz_table_model.update()
self.remove_duplicates()
@pyqtSlot()
def <API key>(self):
nbits = self.current_label.end - self.current_label.start # Use Bit Start/End for maximum calc.
if nbits >= 32:
nbits = 31
max_val = 2 ** nbits - 1
self.ui.sBAddRangeStart.setMaximum(max_val - 1)
self.ui.sBAddRangeEnd.setMaximum(max_val)
self.ui.sBAddRangeEnd.setValue(max_val)
self.ui.sBAddRangeStep.setMaximum(max_val)
self.ui.spinBoxLowerBound.setMaximum(max_val - 1)
self.ui.spinBoxUpperBound.setMaximum(max_val)
self.ui.spinBoxUpperBound.setValue(max_val)
self.ui.<API key>.setMaximum(int(max_val / 2) + 1)
self.ui.<API key>.setMaximum(max_val - 1)
self.ui.<API key>.setMaximum(max_val)
self.ui.<API key>.setValue(max_val)
@pyqtSlot(int)
def <API key>(self, value: int):
self.ui.sBAddRangeEnd.setMinimum(value)
self.ui.sBAddRangeStep.setMaximum(self.ui.sBAddRangeEnd.value() - value)
@pyqtSlot(int)
def <API key>(self, value: int):
self.ui.sBAddRangeStart.setMaximum(value - 1)
self.ui.sBAddRangeStep.setMaximum(value - self.ui.sBAddRangeStart.value())
@pyqtSlot()
def <API key>(self):
if self.ui.checkBoxLowerBound.isChecked():
self.ui.spinBoxLowerBound.setEnabled(True)
self.ui.<API key>.setEnabled(True)
elif not self.ui.checkBoxUpperBound.isChecked():
self.ui.spinBoxLowerBound.setEnabled(False)
self.ui.<API key>.setEnabled(False)
else:
self.ui.spinBoxLowerBound.setEnabled(False)
@pyqtSlot()
def <API key>(self):
if self.ui.checkBoxUpperBound.isChecked():
self.ui.spinBoxUpperBound.setEnabled(True)
self.ui.<API key>.setEnabled(True)
elif not self.ui.checkBoxLowerBound.isChecked():
self.ui.spinBoxUpperBound.setEnabled(False)
self.ui.<API key>.setEnabled(False)
else:
self.ui.spinBoxUpperBound.setEnabled(False)
@pyqtSlot()
def <API key>(self):
self.ui.spinBoxUpperBound.setMinimum(self.ui.spinBoxLowerBound.value())
self.ui.<API key>.setMaximum(math.ceil((self.ui.spinBoxUpperBound.value()
- self.ui.spinBoxLowerBound.value()) / 2))
@pyqtSlot()
def <API key>(self):
self.ui.spinBoxLowerBound.setMaximum(self.ui.spinBoxUpperBound.value() - 1)
self.ui.<API key>.setMaximum(math.ceil((self.ui.spinBoxUpperBound.value()
- self.ui.spinBoxLowerBound.value()) / 2))
@pyqtSlot()
def <API key>(self):
self.ui.<API key>.setMinimum(self.ui.<API key>.value())
@pyqtSlot()
def <API key>(self):
self.ui.<API key>.setMaximum(self.ui.<API key>.value() - 1)
@pyqtSlot()
def <API key>(self):
if self.ui.comboBoxStrategy.currentIndex() == 0:
self.__add_fuzzing_range()
elif self.ui.comboBoxStrategy.currentIndex() == 1:
self.<API key>()
elif self.ui.comboBoxStrategy.currentIndex() == 2:
self.<API key>()
def __add_fuzzing_range(self):
start = self.ui.sBAddRangeStart.value()
end = self.ui.sBAddRangeEnd.value()
step = self.ui.sBAddRangeStep.value()
self.fuzz_table_model.add_range(start, end + 1, step)
def <API key>(self):
lower_bound = -1
if self.ui.spinBoxLowerBound.isEnabled():
lower_bound = self.ui.spinBoxLowerBound.value()
upper_bound = -1
if self.ui.spinBoxUpperBound.isEnabled():
upper_bound = self.ui.spinBoxUpperBound.value()
num_vals = self.ui.<API key>.value()
self.fuzz_table_model.add_boundaries(lower_bound, upper_bound, num_vals)
def <API key>(self):
n = self.ui.spinBoxNumberRandom.value()
minimum = self.ui.<API key>.value()
maximum = self.ui.<API key>.value()
self.fuzz_table_model.add_random(n, minimum, maximum)
def remove_duplicates(self):
if self.ui.<API key>.isChecked():
for lbl in self.message.message_type:
seq = lbl.fuzz_values[:]
seen = set()
add_seen = seen.add
lbl.fuzz_values = [l for l in seq if not (l in seen or add_seen(l))]
@pyqtSlot()
def <API key>(self):
self.current_label.name = self.ui.<API key>.currentText()
self.ui.<API key>.setItemText(self.ui.<API key>.currentIndex(), self.current_label.name)
@pyqtSlot(int)
def on_fuzz_msg_changed(self, index: int):
self.ui.<API key>.setDisabled(False)
sel_label_ind = self.ui.<API key>.currentIndex()
self.ui.<API key>.blockSignals(True)
self.ui.<API key>.clear()
if len(self.message.message_type) == 0:
self.ui.<API key>.setDisabled(True)
return
self.ui.<API key>.addItems([lbl.name for lbl in self.message.message_type])
self.ui.<API key>.blockSignals(False)
if sel_label_ind < self.ui.<API key>.count():
self.ui.<API key>.setCurrentIndex(sel_label_ind)
else:
self.ui.<API key>.setCurrentIndex(0)
self.fuzz_table_model.fuzzing_label = self.current_label
self.fuzz_table_model.update()
self.<API key>()
@pyqtSlot()
def <API key>(self):
num_repeats, ok = QInputDialog.getInt(self, self.tr("How many times shall values be repeated?"),
self.tr("Number of repeats:"), 1, 1)
if ok:
self.ui.<API key>.setChecked(False)
min_row, max_row, _, _ = self.ui.tblFuzzingValues.selection_range()
if min_row == -1:
start, end = 0, len(self.current_label.fuzz_values)
else:
start, end = min_row, max_row + 1
self.fuzz_table_model.<API key>(start, end, num_repeats)
|
import os
import unittest
from vsg.rules import iteration_scheme
from vsg import vhdlFile
from vsg.tests import utils
sTestDir = os.path.dirname(__file__)
lFile, eError =vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir,'rule_300_test_input.vhd'))
dIndentMap = utils.read_indent_file()
lExpected = []
lExpected.append('')
utils.read_file(os.path.join(sTestDir, 'rule_300_test_input.fixed.vhd'), lExpected)
class <API key>(unittest.TestCase):
def setUp(self):
self.oFile = vhdlFile.vhdlFile(lFile)
self.assertIsNone(eError)
self.oFile.set_indent_map(dIndentMap)
def test_rule_300(self):
oRule = iteration_scheme.rule_300()
self.assertTrue(oRule)
self.assertEqual(oRule.name, 'iteration_scheme')
self.assertEqual(oRule.identifier, '300')
lExpected = [13, 17]
oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.<API key>(oRule.violations))
def test_fix_rule_300(self):
oRule = iteration_scheme.rule_300()
oRule.fix(self.oFile)
lActual = self.oFile.get_lines()
self.assertEqual(lExpected, lActual)
oRule.analyze(self.oFile)
self.assertEqual(oRule.violations, [])
|
<?php
class <API key> extends Controller {
public function index() {
$this->language->load('checkout/checkout');
$this->data['<API key>'] = __('<API key>');
$this->data['text_your_details'] = __('text_your_details');
$this->data['text_your_address'] = __('text_your_address');
$this->data['text_your_password'] = __('text_your_password');
$this->data['text_select'] = __('text_select');
$this->data['text_none'] = __('text_none');
$this->data['text_modify'] = __('text_modify');
$this->data['entry_firstname'] = __('entry_firstname');
$this->data['entry_lastname'] = __('entry_lastname');
$this->data['entry_email'] = __('entry_email');
$this->data['entry_telephone'] = __('entry_telephone');
$this->data['entry_fax'] = __('entry_fax');
$this->data['entry_company'] = __('entry_company');
$this->data['<API key>'] = __('<API key>');
$this->data['entry_address_1'] = __('entry_address_1');
$this->data['entry_address_2'] = __('entry_address_2');
$this->data['entry_postcode'] = __('entry_postcode');
$this->data['entry_city'] = __('entry_city');
$this->data['entry_country'] = __('entry_country');
$this->data['entry_zone'] = __('entry_zone');
$this->data['entry_newsletter'] = sprintf(__('entry_newsletter'), $this->config->get('config_name'));
$this->data['entry_password'] = __('entry_password');
$this->data['entry_confirm'] = __('entry_confirm');
$this->data['entry_shipping'] = __('entry_shipping');
$this->data['button_continue'] = __('button_continue');
$this->data['customer_groups'] = array();
if (is_array($this->config->get('<API key>'))) {
$this->load->model('account/customer_group');
$customer_groups = $this-><API key>->getCustomerGroups();
foreach ($customer_groups as $customer_group) {
if (in_array($customer_group['customer_group_id'], $this->config->get('<API key>'))) {
$this->data['customer_groups'][] = $customer_group;
}
}
}
$this->data['customer_group_id'] = $this->config->get('<API key>');
if (isset($this->session->data['shipping_addess']['postcode'])) {
$this->data['postcode'] = $this->session->data['shipping_addess']['postcode'];
} else {
$this->data['postcode'] = '';
}
if (isset($this->session->data['shipping_addess']['country_id'])) {
$this->data['country_id'] = $this->session->data['shipping_addess']['country_id'];
} else {
$this->data['country_id'] = $this->config->get('config_country_id');
}
if (isset($this->session->data['shipping_addess']['zone_id'])) {
$this->data['zone_id'] = $this->session->data['shipping_addess']['zone_id'];
} else {
$this->data['zone_id'] = '';
}
$this->load->model('localisation/country');
$this->data['countries'] = $this-><API key>->getCountries();
if ($this->config->get('config_account_id')) {
$this->load->model('catalog/information');
$information_info = $this-><API key>->getInformation($this->config->get('config_account_id'));
if ($information_info) {
$this->data['text_agree'] = sprintf(__('text_agree'), $this->url->link('information/information/info', 'information_id=' . $this->config->get('config_account_id'), 'SSL'), $information_info['title'], $information_info['title']);
} else {
$this->data['text_agree'] = '';
}
} else {
$this->data['text_agree'] = '';
}
$this->data['shipping_required'] = $this->cart->hasShipping();
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/checkout/register.tpl')) {
$this->template = $this->config->get('config_template') . '/template/checkout/register.tpl';
} else {
$this->template = 'default/template/checkout/register.tpl';
}
$this->response->setOutput($this->render());
}
public function save() {
$this->language->load('checkout/checkout');
$json = array();
// Validate if customer is already logged out.
if ($this->customer->isLogged()) {
$json['redirect'] = $this->url->link('checkout/checkout', '', 'SSL');
}
// Validate cart has products and has stock.
if ((!$this->cart->hasProducts() && empty($this->session->data['vouchers'])) || (!$this->cart->hasStock() && !$this->config->get('<API key>'))) {
$json['redirect'] = $this->url->link('checkout/cart');
}
// Validate minimum quantity requirments.
$products = $this->cart->getProducts();
foreach ($products as $product) {
$product_total = 0;
foreach ($products as $product_2) {
if ($product_2['product_id'] == $product['product_id']) {
$product_total += $product_2['quantity'];
}
}
if ($product['minimum'] > $product_total) {
$json['redirect'] = $this->url->link('checkout/cart');
break;
}
}
if (!$json) {
$this->load->model('account/customer');
if ((utf8_strlen($this->request->post['firstname']) < 1) || (utf8_strlen($this->request->post['firstname']) > 32)) {
$json['error']['firstname'] = __('error_firstname');
}
if ((utf8_strlen($this->request->post['lastname']) < 1) || (utf8_strlen($this->request->post['lastname']) > 32)) {
$json['error']['lastname'] = __('error_lastname');
}
if ((utf8_strlen($this->request->post['email']) > 96) || !preg_match('/^[^\@]+@.*\.[a-z]{2,6}$/i', $this->request->post['email'])) {
$json['error']['email'] = __('error_email');
}
if ($this-><API key>-><API key>($this->request->post['email'])) {
$json['error']['warning'] = __('error_exists');
}
if ((utf8_strlen($this->request->post['telephone']) < 3) || (utf8_strlen($this->request->post['telephone']) > 32)) {
$json['error']['telephone'] = __('error_telephone');
}
// Customer Group
$this->load->model('account/customer_group');
if (isset($this->request->post['customer_group_id']) && is_array($this->config->get('<API key>')) && in_array($this->request->post['customer_group_id'], $this->config->get('<API key>'))) {
$customer_group_id = $this->request->post['customer_group_id'];
} else {
$customer_group_id = $this->config->get('<API key>');
}
$customer_group = $this-><API key>->getCustomerGroup($customer_group_id);
if ($customer_group) {
}
if ((utf8_strlen($this->request->post['address_1']) < 3) || (utf8_strlen($this->request->post['address_1']) > 128)) {
$json['error']['address_1'] = __('error_address_1');
}
if ((utf8_strlen($this->request->post['city']) < 2) || (utf8_strlen($this->request->post['city']) > 128)) {
$json['error']['city'] = __('error_city');
}
$this->load->model('localisation/country');
$country_info = $this-><API key>->getCountry($this->request->post['country_id']);
if ($country_info && $country_info['postcode_required'] && (utf8_strlen($this->request->post['postcode']) < 2) || (utf8_strlen($this->request->post['postcode']) > 10)) {
$json['error']['postcode'] = __('error_postcode');
}
if ($this->request->post['country_id'] == '') {
$json['error']['country'] = __('error_country');
}
if (!isset($this->request->post['zone_id']) || $this->request->post['zone_id'] == '') {
$json['error']['zone'] = __('error_zone');
}
if ((utf8_strlen($this->request->post['password']) < 4) || (utf8_strlen($this->request->post['password']) > 20)) {
$json['error']['password'] = __('error_password');
}
if ($this->request->post['confirm'] != $this->request->post['password']) {
$json['error']['confirm'] = __('error_confirm');
}
if ($this->config->get('config_account_id')) {
$this->load->model('catalog/information');
$information_info = $this-><API key>->getInformation($this->config->get('config_account_id'));
if ($information_info && !isset($this->request->post['agree'])) {
$json['error']['warning'] = sprintf(__('error_agree'), $information_info['title']);
}
}
}
if (!$json) {
$this-><API key>->addCustomer($this->request->post);
$this->session->data['account'] = 'register';
if ($customer_group && !$customer_group['approval']) {
$this->customer->login($this->request->post['email'], $this->request->post['password']);
// Default Payment Address
$this->load->model('account/address');
$this->session->data['payment_address'] = $this-><API key>->getAddress($this->customer->getAddressId());
if (!empty($this->request->post['shipping_address'])) {
$this->session->data['shipping_address'] = $this-><API key>->getAddress($this->customer->getAddressId());
}
} else {
$json['redirect'] = $this->url->link('account/success');
}
unset($this->session->data['guest']);
unset($this->session->data['shipping_method']);
unset($this->session->data['shipping_methods']);
unset($this->session->data['payment_method']);
unset($this->session->data['payment_methods']);
}
$this->response->setOutput(json_encode($json));
}
}
?>
|
#ifdef HAVE_CONFIG_H
# include "config.h"
#include "claws-features.h"
#endif
#include <glib.h>
#include <glib/gi18n.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <sys/stat.h>
#ifdef G_OS_WIN32
# include <w32lib.h>
#endif
#include "procheader.h"
#include "procmsg.h"
#include "codeconv.h"
#include "prefs_common.h"
#include "hooks.h"
#include "utils.h"
#include "defs.h"
#define BUFFSIZE 8192
static gchar monthstr[] = "<API key>";
typedef char *(*getlinefunc) (char *, size_t, void *);
typedef int (*peekcharfunc) (void *);
typedef int (*getcharfunc) (void *);
typedef gint (*get_one_field_func) (gchar *, size_t, void *, HeaderEntry[]);
static gint <API key>(gchar *buf, size_t len, char **str,
HeaderEntry hentry[]);
static char *string_getline(char *buf, size_t len, char **str);
static int string_peekchar(char **str);
static int file_peekchar(FILE *fp);
static gint <API key>(gchar *buf, size_t len, void *data,
HeaderEntry hentry[],
getlinefunc getline,
peekcharfunc peekchar,
gboolean unfold);
static MsgInfo *parse_stream(void *data, gboolean isstring, MsgFlags flags,
gboolean full, gboolean decrypted);
gint <API key>(gchar *buf, size_t len, FILE *fp,
HeaderEntry hentry[])
{
return <API key>(buf, len, fp, hentry,
(getlinefunc)fgets_crlf, (peekcharfunc)file_peekchar,
TRUE);
}
static gint <API key>(gchar *buf, size_t len, char **str,
HeaderEntry hentry[])
{
return <API key>(buf, len, str, hentry,
(getlinefunc)string_getline,
(peekcharfunc)string_peekchar,
TRUE);
}
static char *string_getline(char *buf, size_t len, char **str)
{
gboolean is_cr = FALSE;
gboolean last_was_cr = FALSE;
if (!*str || !**str)
return NULL;
for (; **str && len > 1; --len) {
is_cr = (**str == '\r');
if ((*buf++ = *(*str)++) == '\n') {
break;
}
if (last_was_cr) {
*(--buf) = '\n';
buf++;
break;
}
last_was_cr = is_cr;
}
*buf = '\0';
return buf;
}
static int string_peekchar(char **str)
{
return **str;
}
static int file_peekchar(FILE *fp)
{
return ungetc(getc(fp), fp);
}
static gint <API key>(gchar *buf, size_t len, void *data,
HeaderEntry *hentry,
getlinefunc getline, peekcharfunc peekchar,
gboolean unfold)
{
gint nexthead;
gint hnum = 0;
HeaderEntry *hp = NULL;
if (hentry != NULL) {
/* skip non-required headers */
do {
do {
if (getline(buf, len, data) == NULL)
return -1;
if (buf[0] == '\r' || buf[0] == '\n')
return -1;
} while (buf[0] == ' ' || buf[0] == '\t');
for (hp = hentry, hnum = 0; hp->name != NULL;
hp++, hnum++) {
if (!g_ascii_strncasecmp(hp->name, buf,
strlen(hp->name)))
break;
}
} while (hp->name == NULL);
} else {
if (getline(buf, len, data) == NULL) return -1;
if (buf[0] == '\r' || buf[0] == '\n') return -1;
}
/* unfold line */
while (1) {
nexthead = peekchar(data);
/* ([*WSP CRLF] 1*WSP) */
if (nexthead == ' ' || nexthead == '\t') {
size_t buflen;
gboolean skiptab = (nexthead == '\t');
/* trim previous trailing \n if requesting one header or
* unfolding was requested */
if ((!hentry && unfold) || (hp && hp->unfold))
strretchomp(buf);
buflen = strlen(buf);
/* concatenate next line */
if ((len - buflen) > 2) {
if (getline(buf + buflen, len - buflen, data) == NULL)
break;
if (skiptab) { /* replace tab with space */
*(buf + buflen) = ' ';
}
} else
break;
} else {
/* remove trailing new line */
strretchomp(buf);
break;
}
}
return hnum;
}
gint <API key>(gchar *buf, size_t len, FILE *fp)
{
return <API key>(buf, len, fp, NULL,
(getlinefunc)fgets_crlf,
(peekcharfunc)file_peekchar,
FALSE);
}
GPtrArray *<API key>(FILE *fp)
{
gchar buf[BUFFSIZE];
GPtrArray *headers;
Header *header;
<API key>(fp != NULL, NULL);
headers = g_ptr_array_new();
while (<API key>(buf, sizeof(buf), fp) != -1) {
if ((header = <API key>(buf)) != NULL)
g_ptr_array_add(headers, header);
}
return headers;
}
void <API key>(GPtrArray *harray)
{
gint i;
Header *header;
for (i = 0; i < harray->len; i++) {
header = g_ptr_array_index(harray, i);
<API key>(header);
}
g_ptr_array_free(harray, TRUE);
}
void <API key>(Header *header)
{
if (!header) return;
g_free(header->name);
g_free(header->body);
g_free(header);
}
/*
tests whether two headers' names are equal
remove the trailing ':' or ' ' before comparing
*/
gboolean <API key>(char * hdr1, char * hdr2)
{
int len1;
int len2;
len1 = strlen(hdr1);
len2 = strlen(hdr2);
if (hdr1[len1 - 1] == ':')
len1
if (hdr2[len2 - 1] == ':')
len2
if (len1 != len2)
return 0;
return (g_ascii_strncasecmp(hdr1, hdr2, len1) == 0);
}
/*
parse headers, for example :
From: dinh@enseirb.fr becomes :
header->name = "From:"
header->body = "dinh@enseirb.fr"
*/
static gboolean <API key>(const gchar *hdr)
{
static char *addr_headers[] = {
"To:",
"Cc:",
"Bcc:",
"From:",
"Reply-To:",
"Followup-To:",
"<API key>:",
"<API key>:",
"Return-Receipt-To:",
NULL};
int i;
if (!hdr)
return FALSE;
for (i = 0; addr_headers[i] != NULL; i++)
if (!strcasecmp(hdr, addr_headers[i]))
return FALSE;
return FALSE;
}
Header * <API key>(gchar * buf)
{
gchar *p;
Header * header;
gboolean addr_field = FALSE;
if ((*buf == ':') || (*buf == ' '))
return NULL;
for (p = buf; *p ; p++) {
if ((*p == ':') || (*p == ' ')) {
header = g_new(Header, 1);
header->name = g_strndup(buf, p - buf + 1);
addr_field = <API key>(header->name);
p++;
while (*p == ' ' || *p == '\t') p++;
header->body = conv_unmime_header(p, NULL, addr_field);
return header;
}
}
return NULL;
}
void <API key>(FILE *fp, HeaderEntry hentry[])
{
gchar buf[BUFFSIZE];
HeaderEntry *hp;
gint hnum;
gchar *p;
if (hentry == NULL) return;
while ((hnum = <API key>(buf, sizeof(buf), fp, hentry))
!= -1) {
hp = hentry + hnum;
p = buf + strlen(hp->name);
while (*p == ' ' || *p == '\t') p++;
if (hp->body == NULL)
hp->body = g_strdup(p);
else if (<API key>(hp->name, "To") ||
<API key>(hp->name, "Cc")) {
gchar *tp = hp->body;
hp->body = g_strconcat(tp, ", ", p, NULL);
g_free(tp);
}
}
}
MsgInfo *<API key>(const gchar *file, MsgFlags flags,
gboolean full, gboolean decrypted)
{
GStatBuf s;
FILE *fp;
MsgInfo *msginfo;
if (g_stat(file, &s) < 0) {
FILE_OP_ERROR(file, "stat");
return NULL;
}
if (!S_ISREG(s.st_mode))
return NULL;
if ((fp = g_fopen(file, "rb")) == NULL) {
FILE_OP_ERROR(file, "fopen");
return NULL;
}
msginfo = <API key>(fp, flags, full, decrypted);
fclose(fp);
if (msginfo) {
msginfo->size = s.st_size;
msginfo->mtime = s.st_mtime;
}
return msginfo;
}
MsgInfo *<API key>(const gchar *str, MsgFlags flags, gboolean full,
gboolean decrypted)
{
return parse_stream(&str, TRUE, flags, full, decrypted);
}
enum
{
H_DATE = 0,
H_FROM,
H_TO,
H_CC,
H_NEWSGROUPS,
H_SUBJECT,
H_MSG_ID,
H_REFERENCES,
H_IN_REPLY_TO,
H_CONTENT_TYPE,
H_SEEN,
H_STATUS,
H_FROM_SPACE,
<API key>,
H_SC_MESSAGE_SIZE,
H_FACE,
H_X_FACE,
<API key>,
H_RETURN_RECEIPT_TO,
<API key>,
H_SC_ACCOUNT_SERVER,
H_SC_ACCOUNT_LOGIN,
H_LIST_POST,
H_LIST_SUBSCRIBE,
H_LIST_UNSUBSCRIBE,
H_LIST_HELP,
H_LIST_ARCHIVE,
H_LIST_OWNER,
H_RESENT_FROM,
};
static HeaderEntry hentry_full[] = {
{"Date:", NULL, FALSE},
{"From:", NULL, TRUE},
{"To:", NULL, TRUE},
{"Cc:", NULL, TRUE},
{"Newsgroups:", NULL, TRUE},
{"Subject:", NULL, TRUE},
{"Message-ID:", NULL, FALSE},
{"References:", NULL, FALSE},
{"In-Reply-To:", NULL, FALSE},
{"Content-Type:", NULL, FALSE},
{"Seen:", NULL, FALSE},
{"Status:", NULL, FALSE},
{"From ", NULL, FALSE},
{"<API key>:", NULL, FALSE},
{"SC-Message-Size:", NULL, FALSE},
{"Face:", NULL, FALSE},
{"X-Face:", NULL, FALSE},
{"<API key>:", NULL, FALSE},
{"Return-Receipt-To:", NULL, FALSE},
{"<API key>:", NULL, FALSE},
{"SC-Account-Server:", NULL, FALSE},
{"SC-Account-Login:",NULL, FALSE},
{"List-Post:", NULL, TRUE},
{"List-Subscribe:", NULL, TRUE},
{"List-Unsubscribe:",NULL, TRUE},
{"List-Help:", NULL, TRUE},
{"List-Archive:", NULL, TRUE},
{"List-Owner:", NULL, TRUE},
{"Resent-From:", NULL, TRUE},
{NULL, NULL, FALSE}};
static HeaderEntry hentry_short[] = {
{"Date:", NULL, FALSE},
{"From:", NULL, TRUE},
{"To:", NULL, TRUE},
{"Cc:", NULL, TRUE},
{"Newsgroups:", NULL, TRUE},
{"Subject:", NULL, TRUE},
{"Message-ID:", NULL, FALSE},
{"References:", NULL, FALSE},
{"In-Reply-To:", NULL, FALSE},
{"Content-Type:", NULL, FALSE},
{"Seen:", NULL, FALSE},
{"Status:", NULL, FALSE},
{"From ", NULL, FALSE},
{"<API key>:", NULL, FALSE},
{"SC-Message-Size:",NULL, FALSE},
{NULL, NULL, FALSE}};
static HeaderEntry* <API key>(gboolean full)
{
return full ? hentry_full : hentry_short;
}
MsgInfo *<API key>(FILE *fp, MsgFlags flags, gboolean full,
gboolean decrypted)
{
return parse_stream(fp, FALSE, flags, full, decrypted);
}
static gboolean <API key>(gpointer source, gpointer userdata)
{
AvatarCaptureData *acd = (AvatarCaptureData *)source;
if (*(acd->content) == '\0') /* won't be null, but may be empty */
return FALSE;
if (!strcmp(acd->header, hentry_full[H_FACE].name)) {
debug_print("<API key>: found 'Face' header\n");
<API key>(acd->msginfo, AVATAR_FACE, acd->content);
}
#if HAVE_LIBCOMPFACE
else if (!strcmp(acd->header, hentry_full[H_X_FACE].name)) {
debug_print("<API key>: found 'X-Face' header\n");
<API key>(acd->msginfo, AVATAR_XFACE, acd->content);
}
#endif
return FALSE;
}
static guint avatar_hook_id = 0;
static MsgInfo *parse_stream(void *data, gboolean isstring, MsgFlags flags,
gboolean full, gboolean decrypted)
{
MsgInfo *msginfo;
gchar buf[BUFFSIZE];
gchar *p, *tmp;
gchar *hp;
HeaderEntry *hentry;
gint hnum;
void *orig_data = data;
get_one_field_func get_one_field =
isstring ? (get_one_field_func)<API key>
: (get_one_field_func)<API key>;
hentry = <API key>(full);
if (MSG_IS_QUEUED(flags) || MSG_IS_DRAFT(flags)) {
while (get_one_field(buf, sizeof(buf), data, NULL) != -1) {
if ((!strncmp(buf, "<API key>: 1",
strlen("<API key>:"))) ||
(!strncmp(buf, "<API key>: 1",
strlen("<API key>:"))))
break;
/* from other mailers */
if (!strncmp(buf, "Date: ", 6)
|| !strncmp(buf, "To: ", 4)
|| !strncmp(buf, "From: ", 6)
|| !strncmp(buf, "Subject: ", 9)) {
if (isstring)
data = orig_data;
else
rewind((FILE *)data);
break;
}
}
}
msginfo = procmsg_msginfo_new();
if (flags.tmp_flags || flags.perm_flags)
msginfo->flags = flags;
else
MSG_SET_PERM_FLAGS(msginfo->flags, MSG_NEW | MSG_UNREAD);
msginfo->inreplyto = NULL;
if (avatar_hook_id == 0 && (prefs_common.enable_avatars & <API key>)) {
avatar_hook_id = hooks_register_hook(<API key>, <API key>, NULL);
} else if (avatar_hook_id != 0 && !(prefs_common.enable_avatars & <API key>)) {
<API key>(<API key>, avatar_hook_id);
avatar_hook_id = 0;
}
while ((hnum = get_one_field(buf, sizeof(buf), data, hentry))
!= -1) {
hp = buf + strlen(hentry[hnum].name);
while (*hp == ' ' || *hp == '\t') hp++;
switch (hnum) {
case H_DATE:
if (msginfo->date) break;
msginfo->date_t =
<API key>(NULL, hp, 0);
if (g_utf8_validate(hp, -1, NULL)) {
msginfo->date = g_strdup(hp);
} else {
gchar *utf = conv_codeset_strdup(
hp,
<API key>(),
CS_INTERNAL);
if (utf == NULL ||
!g_utf8_validate(utf, -1, NULL)) {
g_free(utf);
utf = g_malloc(strlen(buf)*2+1);
conv_localetodisp(utf,
strlen(hp)*2+1, hp);
}
msginfo->date = utf;
}
break;
case H_FROM:
if (msginfo->from) break;
msginfo->from = conv_unmime_header(hp, NULL, TRUE);
msginfo->fromname = <API key>(msginfo->from);
remove_return(msginfo->from);
remove_return(msginfo->fromname);
break;
case H_TO:
tmp = conv_unmime_header(hp, NULL, TRUE);
remove_return(tmp);
if (msginfo->to) {
p = msginfo->to;
msginfo->to =
g_strconcat(p, ", ", tmp, NULL);
g_free(p);
} else
msginfo->to = g_strdup(tmp);
g_free(tmp);
break;
case H_CC:
tmp = conv_unmime_header(hp, NULL, TRUE);
remove_return(tmp);
if (msginfo->cc) {
p = msginfo->cc;
msginfo->cc =
g_strconcat(p, ", ", tmp, NULL);
g_free(p);
} else
msginfo->cc = g_strdup(tmp);
g_free(tmp);
break;
case H_NEWSGROUPS:
if (msginfo->newsgroups) {
p = msginfo->newsgroups;
msginfo->newsgroups =
g_strconcat(p, ",", hp, NULL);
g_free(p);
} else
msginfo->newsgroups = g_strdup(hp);
break;
case H_SUBJECT:
if (msginfo->subject) break;
msginfo->subject = conv_unmime_header(hp, NULL, FALSE);
unfold_line(msginfo->subject);
break;
case H_MSG_ID:
if (msginfo->msgid) break;
extract_parenthesis(hp, '<', '>');
remove_space(hp);
msginfo->msgid = g_strdup(hp);
break;
case H_REFERENCES:
msginfo->references =
<API key>(msginfo->references,
hp);
break;
case H_IN_REPLY_TO:
if (msginfo->inreplyto) break;
<API key>(hp, '(', ')');
if ((p = strrchr(hp, '<')) != NULL &&
strchr(p + 1, '>') != NULL) {
extract_parenthesis(p, '<', '>');
remove_space(p);
if (*p != '\0')
msginfo->inreplyto = g_strdup(p);
}
break;
case H_CONTENT_TYPE:
if (!g_ascii_strncasecmp(hp, "multipart/", 10))
MSG_SET_TMP_FLAGS(msginfo->flags, MSG_MULTIPART);
break;
case <API key>:
if (!msginfo->extradata)
msginfo->extradata = g_new0(MsgInfoExtraData, 1);
if (msginfo->extradata-><API key>) break;
msginfo->extradata-><API key> = g_strdup(hp);
break;
case H_RETURN_RECEIPT_TO:
if (!msginfo->extradata)
msginfo->extradata = g_new0(MsgInfoExtraData, 1);
if (msginfo->extradata->returnreceiptto) break;
msginfo->extradata->returnreceiptto = g_strdup(hp);
break;
/* partial download infos */
case <API key>:
if (!msginfo->extradata)
msginfo->extradata = g_new0(MsgInfoExtraData, 1);
if (msginfo->extradata->partial_recv) break;
msginfo->extradata->partial_recv = g_strdup(hp);
break;
case H_SC_ACCOUNT_SERVER:
if (!msginfo->extradata)
msginfo->extradata = g_new0(MsgInfoExtraData, 1);
if (msginfo->extradata->account_server) break;
msginfo->extradata->account_server = g_strdup(hp);
break;
case H_SC_ACCOUNT_LOGIN:
if (!msginfo->extradata)
msginfo->extradata = g_new0(MsgInfoExtraData, 1);
if (msginfo->extradata->account_login) break;
msginfo->extradata->account_login = g_strdup(hp);
break;
case H_SC_MESSAGE_SIZE:
if (msginfo->total_size) break;
msginfo->total_size = atoi(hp);
break;
case <API key>:
msginfo->planned_download = atoi(hp);
break;
/* end partial download infos */
case H_FROM_SPACE:
if (msginfo->fromspace) break;
msginfo->fromspace = g_strdup(hp);
remove_return(msginfo->fromspace);
break;
/* list infos */
case H_LIST_POST:
if (!msginfo->extradata)
msginfo->extradata = g_new0(MsgInfoExtraData, 1);
if (msginfo->extradata->list_post) break;
msginfo->extradata->list_post = g_strdup(hp);
break;
case H_LIST_SUBSCRIBE:
if (!msginfo->extradata)
msginfo->extradata = g_new0(MsgInfoExtraData, 1);
if (msginfo->extradata->list_subscribe) break;
msginfo->extradata->list_subscribe = g_strdup(hp);
break;
case H_LIST_UNSUBSCRIBE:
if (!msginfo->extradata)
msginfo->extradata = g_new0(MsgInfoExtraData, 1);
if (msginfo->extradata->list_unsubscribe) break;
msginfo->extradata->list_unsubscribe = g_strdup(hp);
break;
case H_LIST_HELP:
if (!msginfo->extradata)
msginfo->extradata = g_new0(MsgInfoExtraData, 1);
if (msginfo->extradata->list_help) break;
msginfo->extradata->list_help = g_strdup(hp);
break;
case H_LIST_ARCHIVE:
if (!msginfo->extradata)
msginfo->extradata = g_new0(MsgInfoExtraData, 1);
if (msginfo->extradata->list_archive) break;
msginfo->extradata->list_archive = g_strdup(hp);
break;
case H_LIST_OWNER:
if (!msginfo->extradata)
msginfo->extradata = g_new0(MsgInfoExtraData, 1);
if (msginfo->extradata->list_owner) break;
msginfo->extradata->list_owner = g_strdup(hp);
break;
case H_RESENT_FROM:
if (!msginfo->extradata)
msginfo->extradata = g_new0(MsgInfoExtraData, 1);
if (msginfo->extradata->resent_from) break;
msginfo->extradata->resent_from = g_strdup(hp);
break;
/* end list infos */
default:
break;
}
/* to avoid performance penalty hooklist is invoked only for
headers known to be able to generate avatars */
if (hnum == H_FROM || hnum == H_X_FACE || hnum == H_FACE) {
AvatarCaptureData *acd = g_new0(AvatarCaptureData, 1);
/* no extra memory is wasted, hooks are expected to
take care of copying members when needed */
acd->msginfo = msginfo;
acd->header = hentry_full[hnum].name;
acd->content = hp;
hooks_invoke(<API key>, (gpointer)acd);
g_free(acd);
}
}
if (!msginfo->inreplyto && msginfo->references)
msginfo->inreplyto =
g_strdup((gchar *)msginfo->references->data);
return msginfo;
}
gchar *<API key>(const gchar *str)
{
gchar *tmp, *name;
Xstrdup_a(tmp, str, return NULL);
if (*tmp == '\"') {
extract_quote(tmp, '\"');
g_strstrip(tmp);
} else if (strchr(tmp, '<')) {
<API key>(tmp, '<', '>');
g_strstrip(tmp);
if (*tmp == '\0') {
strcpy(tmp, str);
extract_parenthesis(tmp, '<', '>');
g_strstrip(tmp);
}
} else if (strchr(tmp, '(')) {
extract_parenthesis(tmp, '(', ')');
g_strstrip(tmp);
}
if (*tmp == '\0')
name = g_strdup(str);
else
name = g_strdup(tmp);
return name;
}
static gint <API key>(const gchar *str,
gchar *weekday, gint *day,
gchar *month, gint *year,
gint *hh, gint *mm, gint *ss,
gchar *zone)
{
gint result;
gint month_n;
gint secfract;
gint zone1 = 0, zone2 = 0;
gchar offset_sign, zonestr[7];
gchar sep1;
if (str == NULL)
return -1;
result = sscanf(str, "%10s %d %9s %d %2d:%2d:%2d %6s",
weekday, day, month, year, hh, mm, ss, zone);
if (result == 8) return 0;
/* RFC2822 */
result = sscanf(str, "%3s,%d %9s %d %2d:%2d:%2d %6s",
weekday, day, month, year, hh, mm, ss, zone);
if (result == 8) return 0;
result = sscanf(str, "%d %9s %d %2d:%2d:%2d %6s",
day, month, year, hh, mm, ss, zone);
if (result == 7) return 0;
*zone = '\0';
result = sscanf(str, "%10s %d %9s %d %2d:%2d:%2d",
weekday, day, month, year, hh, mm, ss);
if (result == 7) return 0;
result = sscanf(str, "%d %9s %d %2d:%2d:%2d",
day, month, year, hh, mm, ss);
if (result == 6) return 0;
*ss = 0;
result = sscanf(str, "%10s %d %9s %d %2d:%2d %6s",
weekday, day, month, year, hh, mm, zone);
if (result == 7) return 0;
result = sscanf(str, "%d %9s %d %2d:%2d %5s",
day, month, year, hh, mm, zone);
if (result == 6) return 0;
*zone = '\0';
result = sscanf(str, "%10s %d %9s %d %2d:%2d",
weekday, day, month, year, hh, mm);
if (result == 6) return 0;
result = sscanf(str, "%d %9s %d %2d:%2d",
day, month, year, hh, mm);
if (result == 5) return 0;
*weekday = '\0';
/* RFC3339 subset, with fraction of second */
result = sscanf(str, "%4d-%2d-%2d%c%2d:%2d:%2d.%d%6s",
year, &month_n, day, &sep1, hh, mm, ss, &secfract, zonestr);
if (result == 9
&& (sep1 == 'T' || sep1 == 't' || sep1 == ' ')) {
if (month_n >= 1 && month_n <= 12) {
strncpy2(month, monthstr+((month_n-1)*3), 4);
if (zonestr[0] == 'z' || zonestr[0] == 'Z') {
strcat(zone, "+00:00");
} else if (sscanf(zonestr, "%c%2d:%2d",
&offset_sign, &zone1, &zone2) == 3) {
strcat(zone, zonestr);
}
return 0;
}
}
/* RFC3339 subset, no fraction of second */
result = sscanf(str, "%4d-%2d-%2d%c%2d:%2d:%2d%6s",
year, &month_n, day, &sep1, hh, mm, ss, zonestr);
if (result == 8
&& (sep1 == 'T' || sep1 == 't' || sep1 == ' ')) {
if (month_n >= 1 && month_n <= 12) {
strncpy2(month, monthstr+((month_n-1)*3), 4);
if (zonestr[0] == 'z' || zonestr[0] == 'Z') {
strcat(zone, "+00:00");
} else if (sscanf(zonestr, "%c%2d:%2d",
&offset_sign, &zone1, &zone2) == 3) {
strcat(zone, zonestr);
}
return 0;
}
}
*zone = '\0';
/* RFC3339 subset */
/* This particular "subset" is invalid, RFC requires the time offset */
result = sscanf(str, "%4d-%2d-%2d %2d:%2d:%2d",
year, &month_n, day, hh, mm, ss);
if (result == 6) {
if (1 <= month_n && month_n <= 12) {
strncpy2(month, monthstr+((month_n-1)*3), 4);
return 0;
}
}
return -1;
}
gboolean <API key>(const gchar *src, struct tm *t, char *zone)
{
gchar weekday[11];
gint day;
gchar month[10];
gint year;
gint hh, mm, ss;
GDateMonth dmonth;
gchar *p;
if (!t)
return FALSE;
memset(t, 0, sizeof *t);
if (<API key>(src, weekday, &day, month, &year,
&hh, &mm, &ss, zone) < 0) {
g_warning("Invalid date: %s", src);
return FALSE;
}
/* Y2K compliant :) */
if (year < 100) {
if (year < 70)
year += 2000;
else
year += 1900;
}
month[3] = '\0';
if ((p = strstr(monthstr, month)) != NULL)
dmonth = (gint)(p - monthstr) / 3 + 1;
else {
g_warning("Invalid month: %s", month);
dmonth = G_DATE_BAD_MONTH;
}
t->tm_sec = ss;
t->tm_min = mm;
t->tm_hour = hh;
t->tm_mday = day;
t->tm_mon = dmonth - 1;
t->tm_year = year - 1900;
t->tm_wday = 0;
t->tm_yday = 0;
t->tm_isdst = -1;
mktime(t);
return TRUE;
}
time_t <API key>(gchar *dest, const gchar *src, gint len)
{
gchar weekday[11];
gint day;
gchar month[10];
gint year;
gint hh, mm, ss;
gchar zone[7];
GDateMonth dmonth = G_DATE_BAD_MONTH;
struct tm t;
gchar *p;
time_t timer;
time_t tz_offset;
if (<API key>(src, weekday, &day, month, &year,
&hh, &mm, &ss, zone) < 0) {
if (dest && len > 0)
strncpy2(dest, src, len);
return 0;
}
/* Y2K compliant :) */
if (year < 1000) {
if (year < 50)
year += 2000;
else
year += 1900;
}
month[3] = '\0';
for (p = monthstr; *p != '\0'; p += 3) {
if (!g_ascii_strncasecmp(p, month, 3)) {
dmonth = (gint)(p - monthstr) / 3 + 1;
break;
}
}
t.tm_sec = ss;
t.tm_min = mm;
t.tm_hour = hh;
t.tm_mday = day;
t.tm_mon = dmonth - 1;
t.tm_year = year - 1900;
t.tm_wday = 0;
t.tm_yday = 0;
t.tm_isdst = -1;
timer = mktime(&t);
tz_offset = remote_tzoffset_sec(zone);
if (tz_offset != -1)
timer += tzoffset_sec(&timer) - tz_offset;
if (dest)
<API key>(dest, len, timer);
return timer;
}
void <API key>(gchar *dest, gint len, const time_t timer)
{
struct tm *lt;
gchar *default_format = "%y/%m/%d(%a) %H:%M";
gchar *str;
const gchar *src_codeset, *dest_codeset;
struct tm buf;
if (timer > 0)
lt = localtime_r(&timer, &buf);
else {
time_t dummy = 1;
lt = localtime_r(&dummy, &buf);
}
if (prefs_common.date_format)
fast_strftime(dest, len, prefs_common.date_format, lt);
else
fast_strftime(dest, len, default_format, lt);
if (!g_utf8_validate(dest, -1, NULL)) {
src_codeset = <API key>();
dest_codeset = CS_UTF_8;
str = conv_codeset_strdup(dest, src_codeset, dest_codeset);
if (str) {
strncpy2(dest, str, len);
g_free(str);
}
}
}
/* Added by Mel Hadasht on 27 Aug 2001 */
/* Get a header from msginfo */
gint <API key>(MsgInfo *msginfo, gchar *buf, gint len, gchar *header)
{
gchar *file;
FILE *fp;
HeaderEntry hentry[]={ { NULL, NULL, TRUE },
{ NULL, NULL, FALSE } };
gint val;
hentry[0].name = header;
<API key>(msginfo != NULL, -1);
file = <API key>(msginfo);
if ((fp = g_fopen(file, "rb")) == NULL) {
FILE_OP_ERROR(file, "fopen");
g_free(file);
return -1;
}
val = <API key>(buf,len, fp, hentry);
if (fclose(fp) == EOF) {
FILE_OP_ERROR(file, "fclose");
claws_unlink(file);
g_free(file);
return -1;
}
g_free(file);
if (val == -1)
return -1;
return 0;
}
HeaderEntry *<API key>(const gchar *str)
{
HeaderEntry *entries = NULL, *he;
int numh = 0, i = 0;
gchar **names = NULL;
const gchar *s = str;
if (s == NULL) {
return NULL;
}
while (*s != '\0') {
if (*s == ' ') ++numh;
++s;
}
if (numh == 0) {
return NULL;
}
entries = g_new0(HeaderEntry, numh + 1); /* room for last NULL */
s = str;
++s; /* skip first space */
names = g_strsplit(s, " ", numh);
he = entries;
while (names[i]) {
he->name = g_strdup_printf("%s:", names[i]);
he->body = NULL;
he->unfold = FALSE;
++i, ++he;
}
he->name = NULL;
g_strfreev(names);
return entries;
}
void <API key> (HeaderEntry *entries)
{
if (entries != NULL) {
HeaderEntry *he = entries;
while (he->name != NULL) {
g_free(he->name);
if (he->body != NULL)
g_free(he->body);
++he;
}
g_free(entries);
}
}
gboolean <API key>(const gchar *hdr_name)
{
const gchar *internal_hdrs[] = {
"AF:", "NF:", "PS:", "SRH:", "SFN:", "DSR:", "MID:", "CFG:",
"PT:", "S:", "RQ:", "SSV:", "NSV:", "SSH:", "R:", "MAID:",
"SCF:", "RMID:", "FMID:", "NAID:",
"X-Claws-Account-Id:",
"X-Claws-Sign:",
"X-Claws-Encrypt:",
"<API key>:",
"<API key>:",
"X-Claws-Auto-Indent:",
"<API key>:",
"<API key>:",
"X-Sylpheed-Sign:",
"X-Sylpheed-Encrypt:",
"<API key>:",
"<API key>:",
NULL
};
int i;
for (i = 0; internal_hdrs[i]; i++) {
if (!strcmp(hdr_name, internal_hdrs[i]))
return TRUE;
}
return FALSE;
}
|
package telinc.telicraft.util;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.<API key>;
import net.minecraft.util.StatCollector;
public class PetrifyDamageSource extends <API key> {
protected EntityLivingBase entity;
protected PetrifyDamageSource(EntityLivingBase <API key>) {
super("petrify");
this.<API key>();
this.<API key>();
this.entity = <API key>;
}
@Override
public Entity getEntity() {
return this.entity;
}
@Override
public <API key> getDeathMessage(EntityLivingBase <API key>) {
EntityLivingBase attacker = <API key>.func_94060_bK();
String deathSelf = this.getRawDeathMessage();
String deathPlayer = deathSelf + ".player";
return attacker != null && StatCollector.func_94522_b(deathPlayer) ? <API key>.func_111082_b(deathPlayer, new Object[]{<API key>.<API key>(), attacker.<API key>()}) : <API key>.func_111082_b(deathSelf, new Object[]{<API key>.<API key>()});
}
}
|
<!DOCTYPE HTML PUBLIC "-
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_45) on Fri Dec 04 23:17:14 GMT 2015 -->
<meta http-equiv="Content-Type" content="text/html" charset="utf-8">
<title>Uses of Class org.apache.solr.update.processor.<API key> (Solr 5.4.0 API)</title>
<meta name="date" content="2015-12-04">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.apache.solr.update.processor.<API key> (Solr 5.4.0 API)";
}
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="topNav"><a name="navbar_top">
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../org/apache/solr/update/processor/<API key>.html" title="class in org.apache.solr.update.processor">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/apache/solr/update/processor/class-use/<API key>.html" target="_top">Frames</a></li>
<li><a href="<API key>.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="<API key>">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</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">
<h2 title="Uses of Class org.apache.solr.update.processor.<API key>" class="title">Uses of Class<br>org.apache.solr.update.processor.<API key></h2>
</div>
<div class="classUseContainer">No usage of org.apache.solr.update.processor.<API key></div>
<div class="bottomNav"><a name="navbar_bottom">
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="<API key>">
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../org/apache/solr/update/processor/<API key>.html" title="class in org.apache.solr.update.processor">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/apache/solr/update/processor/class-use/<API key>.html" target="_top">Frames</a></li>
<li><a href="<API key>.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="<API key>">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</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>
<p class="legalCopy"><small>
<i>Copyright © 2000-2015 Apache Software Foundation. All Rights Reserved.</i>
<script src='../../../../../../prettify.js' type='text/javascript'></script>
<script type='text/javascript'>
(function(){
var oldonload = window.onload;
if (typeof oldonload != 'function') {
window.onload = prettyPrint;
} else {
window.onload = function() {
oldonload();
prettyPrint();
}
}
})();
</script>
</small></p>
</body>
</html>
|
<?php namespace Darryldecode\Cart;
use Illuminate\Support\Collection;
class <API key> extends Collection {
}
|
<!DOCTYPE html PUBLIC "-
<html xmlns="http:
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>GNU Radio 7f75d35b C++ API: <API key>.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</script>
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">GNU Radio 7f75d35b C++ API
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.7.6.1 -->
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
initNavTree('<API key>.html','');
</script>
<div id="doc-content">
<div class="header">
<div class="headertitle">
<div class="title"><API key>.h</div> </div>
</div><!--header
<div class="contents">
<a href="<API key>.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef <API key></span>
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define <API key></span>
<a name="l00003"></a>00003 <span class="preprocessor"></span>
<a name="l00004"></a>00004 <span class="preprocessor">#include<<a class="code" href="inttypes_8h.html">inttypes.h</a>></span>
<a name="l00005"></a>00005 <span class="preprocessor">#include<stdio.h></span>
<a name="l00006"></a>00006 <span class="preprocessor">#include<<a class="code" href="volk__complex_8h.html">volk/volk_complex.h</a>></span>
<a name="l00007"></a>00007
<a name="l00008"></a>00008 <span class="preprocessor">#ifdef LV_HAVE_SSE3</span>
<a name="l00009"></a>00009 <span class="preprocessor"></span><span class="preprocessor">#include<xmmintrin.h></span>
<a name="l00010"></a>00010 <span class="preprocessor">#include<pmmintrin.h></span>
<a name="l00011"></a>00011
<a name="l00012"></a>00012 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <API key>(<span class="keywordtype">float</span>* target, <a class="code" href="volk__complex_8h.html#<API key>">lv_32fc_t</a>* src0, <a class="code" href="volk__complex_8h.html#<API key>">lv_32fc_t</a>* points, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> num_bytes) {
<a name="l00013"></a>00013
<a name="l00014"></a>00014
<a name="l00015"></a>00015 __m128 xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7;
<a name="l00016"></a>00016
<a name="l00017"></a>00017 <a class="code" href="volk__complex_8h.html#<API key>">lv_32fc_t</a> diff;
<a name="l00018"></a>00018 <span class="keywordtype">float</span> sq_dist;
<a name="l00019"></a>00019 <span class="keywordtype">int</span> bound = num_bytes >> 5;
<a name="l00020"></a>00020 <span class="keywordtype">int</span> leftovers0 = (num_bytes >> 4) & 1;
<a name="l00021"></a>00021 <span class="keywordtype">int</span> leftovers1 = (num_bytes >> 3) & 1;
<a name="l00022"></a>00022 <span class="keywordtype">int</span> i = 0;
<a name="l00023"></a>00023
<a name="l00024"></a>00024 xmm1 = _mm_setzero_ps();
<a name="l00025"></a>00025 xmm1 = _mm_loadl_pi(xmm1, (__m64*)src0);
<a name="l00026"></a>00026 xmm2 = _mm_load_ps((<span class="keywordtype">float</span>*)&points[0]);
<a name="l00027"></a>00027 xmm1 = _mm_movelh_ps(xmm1, xmm1);
<a name="l00028"></a>00028 xmm3 = _mm_load_ps((<span class="keywordtype">float</span>*)&points[2]);
<a name="l00029"></a>00029
<a name="l00030"></a>00030
<a name="l00031"></a>00031 <span class="keywordflow">for</span>(; i < bound - 1; ++i) {
<a name="l00032"></a>00032 xmm4 = _mm_sub_ps(xmm1, xmm2);
<a name="l00033"></a>00033 xmm5 = _mm_sub_ps(xmm1, xmm3);
<a name="l00034"></a>00034 points += 4;
<a name="l00035"></a>00035 xmm6 = _mm_mul_ps(xmm4, xmm4);
<a name="l00036"></a>00036 xmm7 = _mm_mul_ps(xmm5, xmm5);
<a name="l00037"></a>00037
<a name="l00038"></a>00038 xmm2 = _mm_load_ps((<span class="keywordtype">float</span>*)&points[0]);
<a name="l00039"></a>00039
<a name="l00040"></a>00040 xmm4 = _mm_hadd_ps(xmm6, xmm7);
<a name="l00041"></a>00041
<a name="l00042"></a>00042 xmm3 = _mm_load_ps((<span class="keywordtype">float</span>*)&points[2]);
<a name="l00043"></a>00043
<a name="l00044"></a>00044 _mm_store_ps(target, xmm4);
<a name="l00045"></a>00045
<a name="l00046"></a>00046 target += 4;
<a name="l00047"></a>00047
<a name="l00048"></a>00048 }
<a name="l00049"></a>00049
<a name="l00050"></a>00050 xmm4 = _mm_sub_ps(xmm1, xmm2);
<a name="l00051"></a>00051 xmm5 = _mm_sub_ps(xmm1, xmm3);
<a name="l00052"></a>00052
<a name="l00053"></a>00053
<a name="l00054"></a>00054
<a name="l00055"></a>00055 points += 4;
<a name="l00056"></a>00056 xmm6 = _mm_mul_ps(xmm4, xmm4);
<a name="l00057"></a>00057 xmm7 = _mm_mul_ps(xmm5, xmm5);
<a name="l00058"></a>00058
<a name="l00059"></a>00059 xmm4 = _mm_hadd_ps(xmm6, xmm7);
<a name="l00060"></a>00060
<a name="l00061"></a>00061 _mm_store_ps(target, xmm4);
<a name="l00062"></a>00062
<a name="l00063"></a>00063 target += 4;
<a name="l00064"></a>00064
<a name="l00065"></a>00065 <span class="keywordflow">for</span>(i = 0; i < leftovers0; ++i) {
<a name="l00066"></a>00066
<a name="l00067"></a>00067 xmm2 = _mm_load_ps((<span class="keywordtype">float</span>*)&points[0]);
<a name="l00068"></a>00068
<a name="l00069"></a>00069 xmm4 = _mm_sub_ps(xmm1, xmm2);
<a name="l00070"></a>00070
<a name="l00071"></a>00071 points += 2;
<a name="l00072"></a>00072
<a name="l00073"></a>00073 xmm6 = _mm_mul_ps(xmm4, xmm4);
<a name="l00074"></a>00074
<a name="l00075"></a>00075 xmm4 = _mm_hadd_ps(xmm6, xmm6);
<a name="l00076"></a>00076
<a name="l00077"></a>00077 _mm_storeh_pi((__m64*)target, xmm4);
<a name="l00078"></a>00078
<a name="l00079"></a>00079 target += 2;
<a name="l00080"></a>00080 }
<a name="l00081"></a>00081
<a name="l00082"></a>00082 <span class="keywordflow">for</span>(i = 0; i < leftovers1; ++i) {
<a name="l00083"></a>00083
<a name="l00084"></a>00084 diff = src0[0] - points[0];
<a name="l00085"></a>00085
<a name="l00086"></a>00086 sq_dist = <a class="code" href="volk__complex_8h.html#<API key>">lv_creal</a>(diff) * <a class="code" href="volk__complex_8h.html#<API key>">lv_creal</a>(diff) + <a class="code" href="volk__complex_8h.html#<API key>">lv_cimag</a>(diff) * <a class="code" href="volk__complex_8h.html#<API key>">lv_cimag</a>(diff);
<a name="l00087"></a>00087
<a name="l00088"></a>00088 target[0] = sq_dist;
<a name="l00089"></a>00089 }
<a name="l00090"></a>00090 }
<a name="l00091"></a>00091
<a name="l00092"></a>00092 <span class="preprocessor">#endif </span><span class="comment">/*LV_HAVE_SSE3*/</span>
<a name="l00093"></a>00093
<a name="l00094"></a>00094 <span class="preprocessor">#ifdef LV_HAVE_GENERIC</span>
<a name="l00095"></a>00095 <span class="preprocessor"></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <API key>(<span class="keywordtype">float</span>* target, <a class="code" href="volk__complex_8h.html#<API key>">lv_32fc_t</a>* src0, <a class="code" href="volk__complex_8h.html#<API key>">lv_32fc_t</a>* points, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> num_bytes) {
<a name="l00096"></a>00096 <a class="code" href="volk__complex_8h.html#<API key>">lv_32fc_t</a> diff;
<a name="l00097"></a>00097 <span class="keywordtype">float</span> sq_dist;
<a name="l00098"></a>00098 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0;
<a name="l00099"></a>00099
<a name="l00100"></a>00100 <span class="keywordflow">for</span>(; i < num_bytes >> 3; ++i) {
<a name="l00101"></a>00101 diff = src0[0] - points[i];
<a name="l00102"></a>00102
<a name="l00103"></a>00103 sq_dist = <a class="code" href="volk__complex_8h.html#<API key>">lv_creal</a>(diff) * <a class="code" href="volk__complex_8h.html#<API key>">lv_creal</a>(diff) + <a class="code" href="volk__complex_8h.html#<API key>">lv_cimag</a>(diff) * <a class="code" href="volk__complex_8h.html#<API key>">lv_cimag</a>(diff);
<a name="l00104"></a>00104
<a name="l00105"></a>00105 target[i] = sq_dist;
<a name="l00106"></a>00106 }
<a name="l00107"></a>00107 }
<a name="l00108"></a>00108
<a name="l00109"></a>00109 <span class="preprocessor">#endif </span><span class="comment">/*LV_HAVE_GENERIC*/</span>
<a name="l00110"></a>00110
<a name="l00111"></a>00111
<a name="l00112"></a>00112 <span class="preprocessor">#endif </span><span class="comment">/*<API key>*/</span>
</pre></div></div><!-- contents -->
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="<API key>.html"><API key>.h</a> </li>
<li class="footer">Generated on Thu Sep 27 2012 10:49:26 for GNU Radio 7f75d35b C++ API by
<a href="http:
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.6.1 </li>
</ul>
</div>
</body>
</html>
|
package com.github.dozzatq.phoenix.advertising;
interface Reflector {
FactoryAd reflection();
int state();
}
|
package net.sf.jasperreports.web.commands;
import net.sf.jasperreports.engine.JRConstants;
import net.sf.jasperreports.web.<API key>;
/**
* @author Narcis Marcu (narcism@users.sourceforge.net)
*/
public class CommandException extends <API key>
{
private static final long serialVersionUID = JRConstants.SERIAL_VERSION_UID;
public CommandException(String message) {
super(message);
}
public CommandException(Throwable t) {
super(t);
}
public CommandException(String message, Throwable t) {
super(message, t);
}
public CommandException(String messageKey, Object[] args, Throwable t)
{
super(messageKey, args, t);
}
public CommandException(String messageKey, Object[] args)
{
super(messageKey, args);
}
}
|
# LMirror is free software: you can redistribute it and/or modify it under the
# version.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# In the LMirror source tree the file COPYING.txt contains the GNU General Public
"""Tests for logging support code."""
from StringIO import StringIO
import logging
import os.path
import time
from l_mirror import logging_support
from l_mirror.tests import ResourcedTestCase
from l_mirror.tests.logging_resource import <API key>
from l_mirror.tests.stubpackage import TempDirResource
class TestLoggingSetup(ResourcedTestCase):
resources = [('logging', <API key>())]
def <API key>(self):
out = StringIO()
c_log, f_log, formatter = logging_support.configure_logging(out)
self.assertEqual(c_log, logging.root.handlers[0])
self.assertEqual(f_log, logging.root.handlers[1])
self.assertEqual(None, c_log.formatter)
self.assertEqual(formatter, f_log.formatter)
self.assertEqual(time.gmtime, formatter.converter)
self.assertEqual("%Y-%m-%d %H:%M:%SZ", formatter.datefmt)
self.assertEqual(logging.StreamHandler, c_log.__class__)
self.assertEqual(out, c_log.stream)
self.assertEqual(logging.FileHandler, f_log.__class__)
self.assertEqual(os.path.expanduser("~/.cache/lmirror/log"), f_log.baseFilename)
def <API key>(self):
out = StringIO()
c_log, f_log, formatter = logging_support.configure_logging(out, None)
self.assertEqual(None, f_log)
|
namespace _03BarracksWars.Contracts
{
public interface IRunnable
{
void Run();
}
}
|
using Microsoft.Owin;
using Microsoft.Owin.Security.OAuth;
using Owin;
using System;
using System.Web.Http;
using TodoList.Api.Infrastructure.Authentication;
[assembly: OwinStartup(typeof(TodoList.Api.Startup))]
namespace TodoList.Api
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
HttpConfiguration config = new HttpConfiguration();
ConfigureOAuth(app);
WebApiConfig.Register(config);
//SwaggerConfig.Register();
app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);
app.UseWebApi(config);
//Rest of code is here;
}
public void ConfigureOAuth(IAppBuilder app)
{
O<API key> OAuthServerOptions = new O<API key>()
{
AllowInsecureHttp = true,
TokenEndpointPath = new PathString("/token"),
<API key> = TimeSpan.FromDays(1),
Provider = new Simple<API key>()
};
// Token Generation
app.UseO<API key>(OAuthServerOptions);
app.UseO<API key>(new O<API key>());
}
}
}
|
/* alfons - all folder item specific settings should migrate into
* folderlist.xml!!! the old folderitemrc file will only serve for a few
* versions (for compatibility) */
#ifdef HAVE_CONFIG_H
# include "config.h"
#include "claws-features.h"
#endif
#include "defs.h"
#include <glib.h>
#include <glib/gi18n.h>
#include "folder.h"
#include "alertpanel.h"
#include "prefs_folder_item.h"
#include "folderview.h"
#include "folder.h"
#include "summaryview.h"
#include "menu.h"
#include "account.h"
#include "prefs_gtk.h"
#include "manage_window.h"
#include "utils.h"
#include "addr_compl.h"
#include "prefs_common.h"
#include "gtkutils.h"
#include "filtering.h"
#include "folder_item_prefs.h"
#include "gtk/colorsel.h"
#include "string_match.h"
#include "quote_fmt.h"
#include "combobox.h"
#if USE_ENCHANT
#include "gtkaspell.h"
#endif
#define ASSIGN_STRING(string, value) \
{ \
g_free(string); \
string = (value); \
}
typedef struct <API key> <API key>;
typedef struct <API key> <API key>;
typedef struct <API key> <API key>;
static gboolean can_save = TRUE;
struct <API key>
{
PrefsPage page;
FolderItem *item;
GtkWidget *table;
GtkWidget *no_save_warning;
GtkWidget *folder_type;
#ifndef G_OS_WIN32
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *<API key>;
#endif
GtkWidget *<API key>;
GtkWidget *entry_folder_chmod;
GtkWidget *folder_color_btn;
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *label_offlinesync;
GtkWidget *entry_offlinesync;
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *promote_html_part;
/* apply to sub folders */
#ifndef G_OS_WIN32
GtkWidget *<API key>;
#endif
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *<API key>;
gint folder_color;
};
struct <API key>
{
PrefsPage page;
FolderItem *item;
GtkWidget *window;
GtkWidget *table;
GtkWidget *no_save_warning;
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *checkbtn_default_to;
GtkWidget *entry_default_to;
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *checkbtn_default_cc;
GtkWidget *entry_default_cc;
GtkWidget *<API key>;
GtkWidget *entry_default_bcc;
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *<API key>;
#if USE_ENCHANT
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *<API key>;
#endif
/* apply to sub folders */
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *<API key>;
#if USE_ENCHANT
GtkWidget *<API key>;
GtkWidget *<API key>;
#endif
};
struct <API key>
{
PrefsPage page;
FolderItem *item;
GtkWidget *window;
GtkWidget *table;
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *compose_body_format;
GtkWidget *<API key>;
GtkWidget *reply_quotemark;
GtkWidget *<API key>;
GtkWidget *reply_body_format;
GtkWidget *<API key>;
GtkWidget *forward_quotemark;
GtkWidget *<API key>;
GtkWidget *forward_body_format;
/* apply to sub folders */
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *<API key>;
};
static void <API key>(FolderItem *folder, <API key> *page);
static void <API key>(FolderItem *folder, <API key> *page);
static void <API key>(FolderItem *folder, <API key> *page);
static gboolean <API key>(GNode *node, gpointer data);
static gboolean <API key>(GNode *node, gpointer data);
static gboolean <API key>(GNode *node, gpointer data);
static gint <API key> (gchar *folder_chmod);
static void <API key>(GtkWidget *widget, gpointer data);
static void clean_cache_cb(GtkWidget *widget, gpointer data);
#ifndef G_OS_WIN32
static void <API key>(GtkWidget *widget, gpointer data);
static void <API key>(GtkWidget *widget, gpointer data);
#endif
#define SAFE_STRING(str) \
(str) ? (str) : ""
static void <API key>(PrefsPage * page_,
GtkWindow * window,
gpointer data)
{
<API key> *page = (<API key> *) page_;
FolderItem *item = (FolderItem *) data;
guint rowcount;
GtkWidget *table;
GtkWidget *hbox, *hbox2, *hbox_spc;
GtkWidget *label;
GtkListStore *folder_type_menu;
GtkWidget *folder_type;
GtkTreeIter iter;
GtkWidget *dummy_checkbtn, *clean_cache_btn;
<API key> type;
GtkWidget *no_save_warning = NULL;
#ifndef G_OS_WIN32
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *label_regexp_test;
GtkWidget *<API key>;
GtkWidget *label_regexp_result;
GtkWidget *<API key>;
#endif
GtkWidget *<API key>;
GtkWidget *entry_folder_chmod;
GtkWidget *folder_color;
GtkWidget *folder_color_btn;
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *label_offlinesync;
GtkWidget *entry_offlinesync;
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *promote_html_part;
GtkListStore *<API key>;
#ifndef G_OS_WIN32
GtkWidget *<API key>;
#endif
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *<API key>;
page->item = item;
/* Table */
table = gtk_table_new(12, 3, FALSE);
<API key> (GTK_CONTAINER (table), VBOX_BORDER);
<API key>(GTK_TABLE(table), 4);
<API key>(GTK_TABLE(table), 4);
rowcount = 0;
if (!can_save) {
no_save_warning = gtk_label_new(
_("<i>These preferences will not be saved as this folder "
"is a top-level folder. However, you can set them for the "
"whole mailbox tree by using \"Apply to subfolders\".</i>"));
<API key>(GTK_LABEL(no_save_warning), TRUE);
<API key>(GTK_LABEL(no_save_warning), TRUE);
<API key>(GTK_MISC(no_save_warning), 0.0, 0.5);
gtk_table_attach(GTK_TABLE(table), no_save_warning, 0, 3,
rowcount, rowcount + 1, GTK_FILL, 0, 0, 0);
rowcount++;
}
/* Apply to subfolders */
label = gtk_label_new(_("Apply to\nsubfolders"));
<API key>(GTK_MISC(label), 0.5, 0.5);
gtk_table_attach(GTK_TABLE(table), label, 2, 3,
rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
rowcount++;
/* folder_type */
folder_type = <API key>(NULL, FALSE);
gtk_widget_show (folder_type);
type = F_NORMAL;
if (item->stype == F_INBOX)
type = F_INBOX;
else if (<API key>(item, F_OUTBOX))
type = F_OUTBOX;
else if (<API key>(item, F_DRAFT))
type = F_DRAFT;
else if (<API key>(item, F_QUEUE))
type = F_QUEUE;
else if (<API key>(item, F_TRASH))
type = F_TRASH;
folder_type_menu = GTK_LIST_STORE(<API key>(
GTK_COMBO_BOX(folder_type)));
COMBOBOX_ADD (folder_type_menu, _("Normal"), F_NORMAL);
COMBOBOX_ADD (folder_type_menu, _("Inbox"), F_INBOX);
COMBOBOX_ADD (folder_type_menu, _("Outbox"), F_OUTBOX);
COMBOBOX_ADD (folder_type_menu, _("Drafts"), F_DRAFT);
COMBOBOX_ADD (folder_type_menu, _("Queue"), F_QUEUE);
COMBOBOX_ADD (folder_type_menu, _("Trash"), F_TRASH);
<API key>(GTK_COMBO_BOX(folder_type), type);
dummy_checkbtn = <API key>();
<API key>(GTK_TOGGLE_BUTTON(dummy_checkbtn), type != F_INBOX);
<API key>(dummy_checkbtn, FALSE);
if (type == item->stype && type == F_NORMAL)
<API key>(folder_type, TRUE);
else
<API key>(folder_type, FALSE);
label = gtk_label_new(_("Folder type"));
<API key>(GTK_MISC(label), 0, 0.5);
gtk_table_attach(GTK_TABLE(table), label, 0, 1,
rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
gtk_table_attach(GTK_TABLE(table), folder_type, 1, 2,
rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
gtk_table_attach(GTK_TABLE(table), dummy_checkbtn, 2, 3,
rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
rowcount++;
#ifndef G_OS_WIN32
/* Simplify Subject */
<API key> = <API key>(_("Simplify Subject RegExp"));
gtk_table_attach(GTK_TABLE(table), <API key>, 0, 1,
rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
<API key>(GTK_TOGGLE_BUTTON(<API key>),
item->prefs-><API key>);
g_signal_connect(G_OBJECT(<API key>), "toggled",
G_CALLBACK(<API key>), page);
<API key> = gtk_entry_new();
gtk_table_attach(GTK_TABLE(table), <API key>, 1, 2,
rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
<API key>(<API key>, <API key>);
gtk_entry_set_text(GTK_ENTRY(<API key>),
SAFE_STRING(item->prefs-><API key>));
g_signal_connect(G_OBJECT(<API key>), "changed",
G_CALLBACK(<API key>), page);
<API key> = <API key>();
gtk_table_attach(GTK_TABLE(table), <API key>, 2, 3,
rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
rowcount++;
/* Test string */
label_regexp_test = gtk_label_new(_("Test string:"));
<API key>(GTK_MISC(label_regexp_test), 1, 0.5);
gtk_table_attach(GTK_TABLE(table), label_regexp_test, 0, 1,
rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
<API key>(<API key>, label_regexp_test);
<API key> = gtk_entry_new();
gtk_table_attach(GTK_TABLE(table), <API key>, 1, 2,
rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
<API key>(<API key>, <API key>);
g_signal_connect(G_OBJECT(<API key>), "changed",
G_CALLBACK(<API key>), page);
rowcount++;
/* Test result */
label_regexp_result = gtk_label_new(_("Result:"));
<API key>(GTK_MISC(label_regexp_result), 1, 0.5);
gtk_table_attach(GTK_TABLE(table), label_regexp_result, 0, 1,
rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
<API key>(<API key>, label_regexp_result);
<API key> = gtk_entry_new();
gtk_table_attach(GTK_TABLE(table), <API key>, 1, 2,
rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
<API key>(<API key>, <API key>);
<API key>(GTK_EDITABLE(<API key>), FALSE);
rowcount++;
#endif
/* Folder chmod */
<API key> = <API key>(_("Folder chmod"));
gtk_table_attach(GTK_TABLE(table), <API key>, 0, 1,
rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
<API key>(GTK_TOGGLE_BUTTON(<API key>),
item->prefs->enable_folder_chmod);
entry_folder_chmod = gtk_entry_new();
gtk_table_attach(GTK_TABLE(table), entry_folder_chmod, 1, 2,
rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
<API key>(<API key>, entry_folder_chmod);
if (item->prefs->folder_chmod) {
gchar *buf;
buf = g_strdup_printf("%o", item->prefs->folder_chmod);
gtk_entry_set_text(GTK_ENTRY(entry_folder_chmod), buf);
g_free(buf);
}
<API key> = <API key>();
gtk_table_attach(GTK_TABLE(table), <API key>, 2, 3,
rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
rowcount++;
/* Folder color */
folder_color = gtk_label_new(_("Folder color"));
<API key>(GTK_MISC(folder_color), 0, 0.5);
gtk_table_attach(GTK_TABLE(table), folder_color, 0, 1,
rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
hbox = gtk_hbox_new(FALSE, 0);
gtk_table_attach(GTK_TABLE(table), hbox, 1, 2,
rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
folder_color_btn = <API key>("");
<API key>(folder_color_btn, 36, 26);
gtk_box_pack_start (GTK_BOX(hbox), folder_color_btn, FALSE, FALSE, 0);
CLAWS_SET_TIP(folder_color_btn,
_("Pick color for folder"));
page->folder_color = item->prefs->color;
g_signal_connect(G_OBJECT(folder_color_btn), "clicked",
G_CALLBACK(<API key>),
page);
<API key>(folder_color_btn, item->prefs->color);
<API key> = <API key>();
gtk_table_attach(GTK_TABLE(table), <API key>, 2, 3,
rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
rowcount++;
/* Enable processing at startup */
<API key> =
<API key>(_("Run Processing rules at start-up"));
gtk_table_attach(GTK_TABLE(table), <API key>, 0, 2,
rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
<API key>(GTK_TOGGLE_BUTTON(<API key>),
item->prefs->enable_processing);
<API key> = <API key>();
gtk_table_attach(GTK_TABLE(table), <API key>, 2, 3,
rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
rowcount++;
/* Enable processing rules when opening folder */
<API key> =
<API key>(_("Run Processing rules when opening"));
gtk_table_attach(GTK_TABLE(table), <API key>, 0, 2,
rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
<API key>(GTK_TOGGLE_BUTTON(<API key>),
item->prefs-><API key>);
<API key> = <API key>();
gtk_table_attach(GTK_TABLE(table), <API key>, 2, 3,
rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
rowcount++;
/* Check folder for new mail */
<API key> = <API key>(_("Scan for new mail"));
CLAWS_SET_TIP(<API key>,
_("Turn this option on if mail is delivered directly "
"to this folder by server side filtering on IMAP or "
"by an external application"));
gtk_table_attach(GTK_TABLE(table), <API key>, 0, 2,
rowcount, rowcount+1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
<API key>(GTK_TOGGLE_BUTTON(<API key>),
item->prefs->newmailcheck);
<API key> = <API key>();
gtk_table_attach(GTK_TABLE(table), <API key>, 2, 3,
rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
rowcount++;
/* Select HTML part by default? */
hbox = gtk_hbox_new (FALSE, 2);
gtk_widget_show (hbox);
gtk_table_attach (GTK_TABLE(table), hbox, 0, 2,
rowcount, rowcount+1, GTK_FILL, GTK_FILL, 0, 0);
label = gtk_label_new(_("Select the HTML part of multipart messages"));
gtk_widget_show (label);
gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 0);
promote_html_part = <API key> (NULL, FALSE);
gtk_widget_show (promote_html_part);
gtk_box_pack_start (GTK_BOX(hbox), promote_html_part, FALSE, FALSE, 0);
<API key> = GTK_LIST_STORE(<API key>(
GTK_COMBO_BOX(promote_html_part)));
COMBOBOX_ADD (<API key>, _("Default"), <API key>);
COMBOBOX_ADD (<API key>, _("No"), HTML_PROMOTE_NEVER);
COMBOBOX_ADD (<API key>, _("Yes"), HTML_PROMOTE_ALWAYS);
<API key>(GTK_COMBO_BOX(promote_html_part),
item->prefs->promote_html_part);
CLAWS_SET_TIP(hbox, _("\"Default\" will follow global preference (found in /Preferences/"
"Message View/Text Options)"));
<API key> = <API key>();
gtk_widget_show (<API key>);
gtk_table_attach(GTK_TABLE(table), <API key>, 2, 3,
rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
rowcount++;
/* Synchronise folder for offline use */
<API key> = <API key>(_("Synchronise for offline use"));
gtk_table_attach(GTK_TABLE(table), <API key>, 0, 2,
rowcount, rowcount+1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
<API key> = <API key>();
gtk_table_attach(GTK_TABLE(table), <API key>, 2, 3,
rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
rowcount++;
hbox = gtk_hbox_new (FALSE, 8);
gtk_widget_show (hbox);
gtk_table_attach(GTK_TABLE(table), hbox, 0, 3,
rowcount, rowcount+1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
rowcount++;
hbox_spc = gtk_hbox_new (FALSE, 0);
gtk_widget_show (hbox_spc);
gtk_box_pack_start (GTK_BOX (hbox), hbox_spc, FALSE, FALSE, 0);
<API key> (hbox_spc, 12, -1);
label_offlinesync = gtk_label_new(_("Fetch message bodies from the last"));
gtk_widget_show (label_offlinesync);
gtk_box_pack_start (GTK_BOX (hbox), label_offlinesync, FALSE, FALSE, 0);
entry_offlinesync = gtk_entry_new();
<API key> (entry_offlinesync, 64, -1);
gtk_widget_show (entry_offlinesync);
CLAWS_SET_TIP(entry_offlinesync, _("0: all bodies"));
gtk_box_pack_start (GTK_BOX (hbox), entry_offlinesync, FALSE, FALSE, 0);
<API key> = gtk_label_new(_("days"));
gtk_widget_show (<API key>);
gtk_box_pack_start (GTK_BOX (hbox), <API key>, FALSE, FALSE, 0);
<API key> = <API key>(
_("Remove older messages bodies"));
hbox2 = gtk_hbox_new (FALSE, 8);
gtk_widget_show (hbox2);
gtk_table_attach(GTK_TABLE(table), hbox2, 0, 3,
rowcount, rowcount+1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
rowcount++;
hbox_spc = gtk_hbox_new (FALSE, 0);
gtk_widget_show (hbox_spc);
gtk_box_pack_start (GTK_BOX (hbox2), hbox_spc, FALSE, FALSE, 0);
<API key> (hbox_spc, 12, -1);
gtk_box_pack_start (GTK_BOX (hbox2), <API key>, FALSE, FALSE, 0);
<API key> (<API key>, hbox);
<API key> (<API key>, hbox2);
clean_cache_btn = <API key>(_("Discard folder cache"));
gtk_widget_show (clean_cache_btn);
gtk_table_attach(GTK_TABLE(table), clean_cache_btn, 0, 1,
rowcount, rowcount+1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
g_signal_connect(G_OBJECT(clean_cache_btn), "clicked",
G_CALLBACK(clean_cache_cb),
page);
gtk_widget_show_all(table);
if (item->folder && (item->folder->klass->type != F_IMAP &&
item->folder->klass->type != F_NEWS)) {
item->prefs->offlinesync = TRUE;
item->prefs->offlinesync_days = 0;
item->prefs->remove_old_bodies = FALSE;
<API key>(GTK_WIDGET(<API key>),
FALSE);
<API key>(GTK_WIDGET(<API key>),
FALSE);
gtk_widget_hide(GTK_WIDGET(<API key>));
gtk_widget_hide(GTK_WIDGET(hbox));
gtk_widget_hide(GTK_WIDGET(hbox2));
gtk_widget_hide(GTK_WIDGET(<API key>));
gtk_widget_hide(GTK_WIDGET(clean_cache_btn));
}
<API key>(GTK_TOGGLE_BUTTON(<API key>),
item->prefs->offlinesync);
<API key>(GTK_TOGGLE_BUTTON(<API key>),
item->prefs->remove_old_bodies);
gtk_entry_set_text(GTK_ENTRY(entry_offlinesync), itos(item->prefs->offlinesync_days));
page->table = table;
page->folder_type = folder_type;
page->no_save_warning = no_save_warning;
#ifndef G_OS_WIN32
page-><API key> = <API key>;
page-><API key> = <API key>;
page-><API key> = <API key>;
page-><API key> = <API key>;
#endif
page-><API key> = <API key>;
page->entry_folder_chmod = entry_folder_chmod;
page->folder_color_btn = folder_color_btn;
page-><API key> = <API key>;
page-><API key> = <API key>;
page-><API key> = <API key>;
page-><API key> = <API key>;
page->label_offlinesync = label_offlinesync;
page->entry_offlinesync = entry_offlinesync;
page-><API key> = <API key>;
page-><API key> = <API key>;
page->promote_html_part = promote_html_part;
#ifndef G_OS_WIN32
page-><API key> = <API key>;
#endif
page-><API key> = <API key>;
page-><API key> = <API key>;
page-><API key> = <API key>;
page-><API key> = <API key>;
page-><API key> = <API key>;
page-><API key> = <API key>;
page-><API key> = <API key>;
page->page.widget = table;
#ifndef G_OS_WIN32
<API key>(NULL, page);
#endif
}
static void <API key>(PrefsPage *page_)
{
/* <API key> *page = (<API key> *) page_; */
}
/** \brief Save the prefs in page to folder.
*
* If the folder is not the one specified in page->item, then only those properties
* that have the relevant 'apply to sub folders' button checked are saved
*/
static void <API key>(FolderItem *folder, <API key> *page)
{
FolderItemPrefs *prefs = folder->prefs;
gchar *buf;
gboolean all = FALSE, <API key> = FALSE;
<API key> type = F_NORMAL;
FolderView *folderview = <API key>()->folderview;
HTMLPromoteType promote_html_part = <API key>;
if (folder->path == NULL)
return;
cm_return_if_fail(prefs != NULL);
if (page->item == folder)
all = TRUE;
type = <API key>(GTK_COMBO_BOX(page->folder_type));
if (all && folder->stype != type && page->item->parent_stype == F_NORMAL) {
<API key>(folder, type);
<API key> = TRUE;
}
promote_html_part =
<API key>(GTK_COMBO_BOX(page->promote_html_part));
if (all || <API key>(GTK_TOGGLE_BUTTON(page-><API key>)))
prefs->promote_html_part = promote_html_part;
#ifndef G_OS_WIN32
if (all || <API key>(GTK_TOGGLE_BUTTON(page-><API key>))) {
gboolean <API key> = prefs-><API key>;
int regexp_diffs = strcmp2(prefs-><API key>, <API key>(
GTK_EDITABLE(page-><API key>), 0, -1));
prefs-><API key> =
<API key>(GTK_TOGGLE_BUTTON(page-><API key>));
ASSIGN_STRING(prefs-><API key>,
<API key>(GTK_EDITABLE(page-><API key>), 0, -1));
if (<API key> != prefs-><API key> || regexp_diffs != 0)
<API key> = TRUE;
}
#endif
if (all || <API key>(GTK_TOGGLE_BUTTON(page-><API key>))) {
prefs->enable_folder_chmod =
<API key>(GTK_TOGGLE_BUTTON(page-><API key>));
buf = <API key>(GTK_EDITABLE(page->entry_folder_chmod), 0, -1);
prefs->folder_chmod = <API key>(buf);
g_free(buf);
}
if (all || <API key>(GTK_TOGGLE_BUTTON(page-><API key>))) {
int old_color = prefs->color;
prefs->color = page->folder_color;
/* update folder view */
if (prefs->color != old_color)
folder_item_update(folder, <API key>);
}
if (all || <API key>(GTK_TOGGLE_BUTTON(page-><API key>))) {
prefs->enable_processing =
<API key>(GTK_TOGGLE_BUTTON(page-><API key>));
}
if (all || <API key>(GTK_TOGGLE_BUTTON(page-><API key>))) {
prefs-><API key> =
<API key>(GTK_TOGGLE_BUTTON(page-><API key>));
}
if (all || <API key>(GTK_TOGGLE_BUTTON(page-><API key>))) {
prefs->newmailcheck =
<API key>(GTK_TOGGLE_BUTTON(page-><API key>));
}
if (all || <API key>(GTK_TOGGLE_BUTTON(page-><API key>))) {
prefs->offlinesync =
<API key>(GTK_TOGGLE_BUTTON(page-><API key>));
prefs->offlinesync_days =
atoi(gtk_entry_get_text(GTK_ENTRY(page->entry_offlinesync)));
prefs->remove_old_bodies =
<API key>(GTK_TOGGLE_BUTTON(page-><API key>));
}
<API key>(folder);
if (folder->opened && <API key>) {
<API key>(folderview->summaryview, folder);
summary_show(folderview->summaryview, folder);
}
}
static gboolean <API key>(GNode *node, gpointer data)
{
FolderItem *item = (FolderItem *) node->data;
<API key> *page = (<API key> *) data;
<API key>(item != NULL, TRUE);
<API key>(page != NULL, TRUE);
<API key>(item, page);
/* optimise by not continuing if none of the 'apply to sub folders'
check boxes are selected - and optimise the checking by only doing
it once */
if ((node == page->item->node) &&
!(
#ifndef G_OS_WIN32
<API key>(GTK_TOGGLE_BUTTON(page-><API key>)) ||
#endif
<API key>(GTK_TOGGLE_BUTTON(page-><API key>)) ||
<API key>(GTK_TOGGLE_BUTTON(page-><API key>)) ||
<API key>(GTK_TOGGLE_BUTTON(page-><API key>)) ||
<API key>(GTK_TOGGLE_BUTTON(page-><API key>)) ||
<API key>(GTK_TOGGLE_BUTTON(page-><API key>)) ||
<API key>(GTK_TOGGLE_BUTTON(page-><API key>)) ||
<API key>(GTK_TOGGLE_BUTTON(page-><API key>))
))
return TRUE;
else
return FALSE;
}
static void <API key>(PrefsPage *page_)
{
<API key> *page = (<API key> *) page_;
g_node_traverse(page->item->node, G_PRE_ORDER, G_TRAVERSE_ALL,
-1, <API key>, page);
<API key>(<API key>());
}
static RecvProtocol item_protocol(FolderItem *item)
{
if (!item)
return A_NONE;
if (!item->folder)
return A_NONE;
if (!item->folder->account)
return A_NONE;
return item->folder->account->protocol;
}
static void <API key>(PrefsPage * page_,
GtkWindow * window,
gpointer data)
{
<API key> *page = (<API key> *) page_;
FolderItem *item = (FolderItem *) data;
guint rowcount;
gchar *text = NULL;
GtkWidget *table;
GtkWidget *label;
GtkWidget *no_save_warning = NULL;
GtkWidget *<API key> = NULL;
GtkWidget *<API key> = NULL;
GtkWidget *checkbtn_default_to = NULL;
GtkWidget *entry_default_to = NULL;
GtkWidget *<API key> = NULL;
GtkWidget *<API key> = NULL;
GtkWidget *checkbtn_default_cc = NULL;
GtkWidget *entry_default_cc = NULL;
GtkWidget *<API key> = NULL;
GtkWidget *entry_default_bcc = NULL;
GtkWidget *<API key> = NULL;
GtkWidget *<API key> = NULL;
GtkWidget *<API key> = NULL;
GtkWidget *<API key> = NULL;
GtkListStore *<API key> = NULL;
GtkTreeIter iter;
#if USE_ENCHANT
GtkWidget *<API key> = NULL;
GtkWidget *<API key> = NULL;
GtkWidget *<API key> = NULL;
GtkWidget *<API key> = NULL;
GtkWidget *<API key> = NULL;
GtkWidget *<API key> = NULL;
gchar *dictionary;
#endif
GtkWidget *<API key> = NULL;
GtkWidget *<API key> = NULL;
GtkWidget *<API key> = NULL;
GtkWidget *<API key> = NULL;
GtkWidget *<API key> = NULL;
GtkWidget *<API key> = NULL;
GtkWidget *<API key> = NULL;
GtkWidget *<API key> = NULL;
GList *cur_ac;
GList *account_list;
PrefsAccount *ac_prefs;
gboolean default_account_set = FALSE;
page->item = item;
/* Table */
#if USE_ENCHANT
# define TABLEHEIGHT 7
#else
# define TABLEHEIGHT 6
#endif
table = gtk_table_new(TABLEHEIGHT, 3, FALSE);
<API key> (GTK_CONTAINER (table), VBOX_BORDER);
<API key>(GTK_TABLE(table), 4);
<API key>(GTK_TABLE(table), 4);
rowcount = 0;
if (!can_save) {
no_save_warning = gtk_label_new(
_("<i>These preferences will not be saved as this folder "
"is a top-level folder. However, you can set them for the "
"whole mailbox tree by using \"Apply to subfolders\".</i>"));
<API key>(GTK_LABEL(no_save_warning), TRUE);
<API key>(GTK_LABEL(no_save_warning), TRUE);
<API key>(GTK_MISC(no_save_warning), 0.0, 0.5);
gtk_table_attach(GTK_TABLE(table), no_save_warning, 0, 3,
rowcount, rowcount + 1, GTK_FILL, 0, 0, 0);
rowcount++;
}
/* Apply to subfolders */
label = gtk_label_new(_("Apply to\nsubfolders"));
<API key>(GTK_MISC(label), 0.5, 0.5);
gtk_table_attach(GTK_TABLE(table), label, 2, 3,
rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
rowcount++;
if (item_protocol(item) != A_NNTP) {
/* Request Return Receipt */
<API key> = <API key>
(_("Request Return Receipt"));
gtk_table_attach(GTK_TABLE(table), <API key>,
0, 2, rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL,
GTK_FILL, 0, 0);
<API key>(GTK_TOGGLE_BUTTON(<API key>),
item->ret_rcpt ? TRUE : FALSE);
<API key> = <API key>();
gtk_table_attach(GTK_TABLE(table), <API key>, 2, 3,
rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
rowcount++;
/* Save Copy to Folder */
<API key> = <API key>
(_("Save copy of outgoing messages to this folder instead of Sent"));
gtk_table_attach(GTK_TABLE(table), <API key>, 0, 2,
rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
<API key>(GTK_TOGGLE_BUTTON(<API key>),
item->prefs->save_copy_to_folder ? TRUE : FALSE);
<API key> = <API key>();
gtk_table_attach(GTK_TABLE(table), <API key>, 2, 3,
rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
rowcount++;
/* Default To */
text = g_strconcat(_("Default "), <API key>("To:"), NULL);
checkbtn_default_to = <API key>(text);
gtk_table_attach(GTK_TABLE(table), checkbtn_default_to, 0, 1,
rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
<API key>(GTK_TOGGLE_BUTTON(checkbtn_default_to),
item->prefs->enable_default_to);
g_free(text);
entry_default_to = gtk_entry_new();
gtk_table_attach(GTK_TABLE(table), entry_default_to, 1, 2,
rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
<API key>(checkbtn_default_to, entry_default_to);
gtk_entry_set_text(GTK_ENTRY(entry_default_to), SAFE_STRING(item->prefs->default_to));
<API key>(GTK_ENTRY(entry_default_to),
TRUE);
<API key> = <API key>();
gtk_table_attach(GTK_TABLE(table), <API key>, 2, 3,
rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
rowcount++;
/* Default address to reply to */
text = g_strconcat(_("Default "), <API key>("To:"),
_(" for replies"), NULL);
<API key> = <API key>(text);
gtk_table_attach(GTK_TABLE(table), <API key>, 0, 1,
rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
<API key>(GTK_TOGGLE_BUTTON(<API key>),
item->prefs-><API key>);
g_free(text);
<API key> = gtk_entry_new();
gtk_table_attach(GTK_TABLE(table), <API key>, 1, 2,
rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
<API key>(<API key>, <API key>);
gtk_entry_set_text(GTK_ENTRY(<API key>), SAFE_STRING(item->prefs->default_reply_to));
<API key>(
GTK_ENTRY(<API key>), TRUE);
<API key> = <API key>();
gtk_table_attach(GTK_TABLE(table), <API key>, 2, 3,
rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
rowcount++;
/* Default Cc */
text = g_strconcat(_("Default "), <API key>("Cc:"), NULL);
checkbtn_default_cc = <API key>(text);
gtk_table_attach(GTK_TABLE(table), checkbtn_default_cc, 0, 1,
rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
<API key>(GTK_TOGGLE_BUTTON(checkbtn_default_cc),
item->prefs->enable_default_cc);
g_free(text);
entry_default_cc = gtk_entry_new();
gtk_table_attach(GTK_TABLE(table), entry_default_cc, 1, 2,
rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
<API key>(checkbtn_default_cc, entry_default_cc);
gtk_entry_set_text(GTK_ENTRY(entry_default_cc), SAFE_STRING(item->prefs->default_cc));
<API key>(GTK_ENTRY(entry_default_cc),
TRUE);
<API key> = <API key>();
gtk_table_attach(GTK_TABLE(table), <API key>, 2, 3,
rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
rowcount++;
/* Default Bcc */
text = g_strconcat(_("Default "), <API key>("Bcc:"), NULL);
<API key> = <API key>(text);
gtk_table_attach(GTK_TABLE(table), <API key>, 0, 1,
rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
<API key>(GTK_TOGGLE_BUTTON(<API key>),
item->prefs->enable_default_bcc);
g_free(text);
entry_default_bcc = gtk_entry_new();
gtk_table_attach(GTK_TABLE(table), entry_default_bcc, 1, 2,
rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
<API key>(<API key>, entry_default_bcc);
gtk_entry_set_text(GTK_ENTRY(entry_default_bcc), SAFE_STRING(item->prefs->default_bcc));
<API key>(GTK_ENTRY(entry_default_bcc),
TRUE);
<API key> = <API key>();
gtk_table_attach(GTK_TABLE(table), <API key>, 2, 3,
rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
rowcount++;
/* Default Reply-to */
text = g_strconcat(_("Default "), <API key>("Reply-To:"), NULL);
<API key> = <API key>(text);
gtk_table_attach(GTK_TABLE(table), <API key>, 0, 1,
rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
<API key>(GTK_TOGGLE_BUTTON(<API key>),
item->prefs-><API key>);
g_free(text);
<API key> = gtk_entry_new();
gtk_table_attach(GTK_TABLE(table), <API key>, 1, 2,
rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
<API key>(<API key>, <API key>);
gtk_entry_set_text(GTK_ENTRY(<API key>), SAFE_STRING(item->prefs->default_replyto));
<API key>(GTK_ENTRY(<API key>),
TRUE);
<API key> = <API key>();
gtk_table_attach(GTK_TABLE(table), <API key>, 2, 3,
rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
rowcount++;
}
/* Default account */
<API key> = <API key>(_("Default account"));
gtk_table_attach(GTK_TABLE(table), <API key>, 0, 1,
rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
<API key>(GTK_TOGGLE_BUTTON(<API key>),
item->prefs-><API key>);
<API key> = <API key>(NULL, FALSE);
gtk_table_attach(GTK_TABLE(table), <API key>, 1, 2,
rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
<API key> = GTK_LIST_STORE(
<API key>(GTK_COMBO_BOX(<API key>)));
account_list = account_get_list();
for (cur_ac = account_list; cur_ac != NULL; cur_ac = cur_ac->next) {
ac_prefs = (PrefsAccount *)cur_ac->data;
if (item->folder->account &&
( (item_protocol(item) == A_NNTP && ac_prefs->protocol != A_NNTP)
||(item_protocol(item) != A_NNTP && ac_prefs->protocol == A_NNTP)))
continue;
if (item->folder->klass->type != F_NEWS && ac_prefs->protocol == A_NNTP)
continue;
<API key> (<API key>,
ac_prefs->account_name?ac_prefs->account_name : _("Untitled"),
ac_prefs->account_id);
/* Set combobox to current default account id */
if (ac_prefs->account_id == item->prefs->default_account) {
<API key>(GTK_COMBO_BOX(<API key>),
ac_prefs->account_id);
default_account_set = TRUE;
}
}
/* If nothing has been set (folder doesn't have a default account set),
* pre-select global default account, since that's what actually used
* anyway. We don't want nothing selected in combobox. */
if( !default_account_set )
<API key>(GTK_COMBO_BOX(<API key>),
account_get_default()->account_id);
<API key>(<API key>, <API key>);
<API key> = <API key>();
gtk_table_attach(GTK_TABLE(table), <API key>, 2, 3,
rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
rowcount++;
#if USE_ENCHANT
/* Default dictionary */
<API key> = <API key>(_("Default dictionary"));
gtk_table_attach(GTK_TABLE(table), <API key>, 0, 1,
rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
<API key>(GTK_TOGGLE_BUTTON(<API key>),
item->prefs-><API key>);
<API key> = <API key>(TRUE);
gtk_table_attach(GTK_TABLE(table), <API key>, 1, 2,
rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
dictionary = item->prefs->default_dictionary;
if (dictionary && strrchr(dictionary, '/')) {
gchar *tmp = g_strdup(strrchr(dictionary, '/')+1);
g_free(item->prefs->default_dictionary);
item->prefs->default_dictionary = tmp;
dictionary = item->prefs->default_dictionary;
}
if (item->prefs->default_dictionary &&
strchr(item->prefs->default_dictionary, '-')) {
*(strchr(item->prefs->default_dictionary, '-')) = '\0';
}
if (dictionary)
<API key>(
GTK_COMBO_BOX(<API key>), dictionary);
<API key>(<API key>, <API key>);
<API key> = <API key>();
gtk_table_attach(GTK_TABLE(table), <API key>, 2, 3,
rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
rowcount++;
/* Default dictionary */
<API key> = <API key>(_("Default alternate dictionary"));
gtk_table_attach(GTK_TABLE(table), <API key>, 0, 1,
rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
<API key>(GTK_TOGGLE_BUTTON(<API key>),
item->prefs-><API key>);
<API key> = <API key>(FALSE);
gtk_table_attach(GTK_TABLE(table), <API key>, 1, 2,
rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
dictionary = item->prefs-><API key>;
if (dictionary && strrchr(dictionary, '/')) {
gchar *tmp = g_strdup(strrchr(dictionary, '/')+1);
g_free(item->prefs-><API key>);
item->prefs-><API key> = tmp;
dictionary = item->prefs-><API key>;
}
if (item->prefs-><API key> &&
strchr(item->prefs-><API key>, '-')) {
*(strchr(item->prefs-><API key>, '-')) = '\0';
}
if (dictionary)
<API key>(
GTK_COMBO_BOX(<API key>), dictionary);
<API key>(<API key>, <API key>);
<API key> = <API key>();
gtk_table_attach(GTK_TABLE(table), <API key>, 2, 3,
rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
rowcount++;
#endif
gtk_widget_show_all(table);
page->window = GTK_WIDGET(window);
page->table = table;
page->no_save_warning = no_save_warning;
page-><API key> = <API key>;
page-><API key> = <API key>;
page->checkbtn_default_to = checkbtn_default_to;
page->entry_default_to = entry_default_to;
page-><API key> = <API key>;
page-><API key> = <API key>;
page->checkbtn_default_cc = checkbtn_default_cc;
page->entry_default_cc = entry_default_cc;
page-><API key> = <API key>;
page->entry_default_bcc = entry_default_bcc;
page-><API key> = <API key>;
page-><API key> = <API key>;
page-><API key> = <API key>;
page-><API key> = <API key>;
#ifdef USE_ENCHANT
page-><API key> = <API key>;
page-><API key> = <API key>;
page-><API key> = <API key>;
page-><API key> = <API key>;
#endif
page-><API key> = <API key>;
page-><API key> = <API key>;
page-><API key> = <API key>;
page-><API key> = <API key>;
page-><API key> = <API key>;
page-><API key> = <API key>;
page-><API key> = <API key>;
page-><API key> = <API key>;
#if USE_ENCHANT
page-><API key> = <API key>;
page-><API key> = <API key>;
#endif
page->page.widget = table;
}
static void <API key>(PrefsPage *page_)
{
<API key> *page = (<API key> *) page_;
if (page->entry_default_to)
<API key>(GTK_ENTRY(page->entry_default_to));
if (page-><API key>)
<API key>(GTK_ENTRY(page-><API key>));
if (page->entry_default_cc)
<API key>(GTK_ENTRY(page->entry_default_cc));
if (page->entry_default_bcc)
<API key>(GTK_ENTRY(page->entry_default_bcc));
if (page-><API key>)
<API key>(GTK_ENTRY(page-><API key>));
}
/** \brief Save the prefs in page to folder.
*
* If the folder is not the one specified in page->item, then only those properties
* that have the relevant 'apply to sub folders' button checked are saved
*/
static void <API key>(FolderItem *folder, <API key> *page)
{
FolderItemPrefs *prefs = folder->prefs;
gboolean all = FALSE;
if (folder->path == NULL)
return;
if (page->item == folder)
all = TRUE;
cm_return_if_fail(prefs != NULL);
if (item_protocol(folder) != A_NNTP) {
if (all || <API key>(GTK_TOGGLE_BUTTON(page-><API key>))) {
prefs-><API key> =
<API key>(GTK_TOGGLE_BUTTON(page-><API key>));
/* MIGRATION */
folder->ret_rcpt = prefs-><API key>;
}
if (all || <API key>(GTK_TOGGLE_BUTTON(page-><API key>))) {
prefs->save_copy_to_folder =
<API key>(GTK_TOGGLE_BUTTON(page-><API key>));
}
if (all || <API key>(GTK_TOGGLE_BUTTON(page-><API key>))) {
prefs->enable_default_to =
<API key>(GTK_TOGGLE_BUTTON(page->checkbtn_default_to));
ASSIGN_STRING(prefs->default_to,
<API key>(GTK_EDITABLE(page->entry_default_to), 0, -1));
}
if (all || <API key>(GTK_TOGGLE_BUTTON(page-><API key>))) {
prefs-><API key> =
<API key>(GTK_TOGGLE_BUTTON(page-><API key>));
ASSIGN_STRING(prefs->default_reply_to,
<API key>(GTK_EDITABLE(page-><API key>), 0, -1));
}
if (all || <API key>(GTK_TOGGLE_BUTTON(page-><API key>))) {
prefs->enable_default_cc =
<API key>(GTK_TOGGLE_BUTTON(page->checkbtn_default_cc));
ASSIGN_STRING(prefs->default_cc,
<API key>(GTK_EDITABLE(page->entry_default_cc), 0, -1));
}
if (all || <API key>(GTK_TOGGLE_BUTTON(page-><API key>))) {
prefs->enable_default_bcc =
<API key>(GTK_TOGGLE_BUTTON(page-><API key>));
ASSIGN_STRING(prefs->default_bcc,
<API key>(GTK_EDITABLE(page->entry_default_bcc), 0, -1));
}
if (all || <API key>(GTK_TOGGLE_BUTTON(page-><API key>))) {
prefs-><API key> =
<API key>(GTK_TOGGLE_BUTTON(page-><API key>));
ASSIGN_STRING(prefs->default_replyto,
<API key>(GTK_EDITABLE(page-><API key>), 0, -1));
}
} else {
prefs-><API key> = FALSE;
prefs->save_copy_to_folder = FALSE;
prefs->enable_default_to = FALSE;
prefs-><API key> = FALSE;
prefs->enable_default_cc = FALSE;
prefs->enable_default_bcc = FALSE;
prefs-><API key> = FALSE;
}
if (all || <API key>(
GTK_TOGGLE_BUTTON(page-><API key>))) {
prefs-><API key> =
<API key>(
GTK_TOGGLE_BUTTON(page-><API key>));
prefs->default_account = <API key>(
GTK_COMBO_BOX(page-><API key>));
}
#if USE_ENCHANT
if (all || <API key>(GTK_TOGGLE_BUTTON(page-><API key>))) {
prefs-><API key> =
<API key>(GTK_TOGGLE_BUTTON(page-><API key>));
ASSIGN_STRING(prefs->default_dictionary,
<API key>(
GTK_COMBO_BOX(page-><API key>)));
}
if (all || <API key>(GTK_TOGGLE_BUTTON(page-><API key>))) {
prefs-><API key> =
<API key>(GTK_TOGGLE_BUTTON(page-><API key>));
ASSIGN_STRING(prefs-><API key>,
<API key>(
GTK_COMBO_BOX(page-><API key>)));
}
#endif
<API key>(folder);
}
static gboolean <API key>(GNode *node, gpointer data)
{
FolderItem *item = (FolderItem *) node->data;
<API key> *page = (<API key> *) data;
<API key>(item != NULL, TRUE);
<API key>(page != NULL, TRUE);
<API key>(item, page);
/* optimise by not continuing if none of the 'apply to sub folders'
check boxes are selected - and optimise the checking by only doing
it once */
if ((node == page->item->node) && item_protocol(item) != A_NNTP &&
!(<API key>(GTK_TOGGLE_BUTTON(page-><API key>)) ||
<API key>(GTK_TOGGLE_BUTTON(page-><API key>)) ||
<API key>(GTK_TOGGLE_BUTTON(page-><API key>)) ||
<API key>(GTK_TOGGLE_BUTTON(page-><API key>)) ||
<API key>(GTK_TOGGLE_BUTTON(page-><API key>)) ||
<API key>(GTK_TOGGLE_BUTTON(page-><API key>)) ||
<API key>(GTK_TOGGLE_BUTTON(page-><API key>)) ||
#if USE_ENCHANT
<API key>(GTK_TOGGLE_BUTTON(page-><API key>)) ||
<API key>(GTK_TOGGLE_BUTTON(page-><API key>)) ||
#endif
<API key>(GTK_TOGGLE_BUTTON(page-><API key>))
))
return TRUE;
else if ((node == page->item->node) && item_protocol(item) == A_NNTP &&
!(<API key>(GTK_TOGGLE_BUTTON(page-><API key>))
#if USE_ENCHANT
|| <API key>(GTK_TOGGLE_BUTTON(page-><API key>))
|| <API key>(GTK_TOGGLE_BUTTON(page-><API key>))
#endif
))
return TRUE;
else
return FALSE;
}
static void <API key>(PrefsPage *page_)
{
<API key> *page = (<API key> *) page_;
g_node_traverse(page->item->node, G_PRE_ORDER, G_TRAVERSE_ALL,
-1, <API key>, page);
}
static void <API key>(PrefsPage * page_,
GtkWindow * window,
gpointer data)
{
<API key> *page = (<API key> *) page_;
FolderItem *item = (FolderItem *) data;
GtkWidget *notebook;
GtkWidget *vbox;
GtkWidget *page_vbox;
GtkWidget *no_save_warning;
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *<API key>;
GtkWidget *hbox;
GtkWidget *vbox_format;
page->item = item;
page_vbox = gtk_vbox_new (FALSE, 0);
<API key> (GTK_CONTAINER (page_vbox), VBOX_BORDER);
gtk_widget_show (page_vbox);
if (!can_save) {
no_save_warning = gtk_label_new(
_("<i>These preferences will not be saved as this folder "
"is a top-level folder. However, you can set them for the "
"whole mailbox tree by using \"Apply to subfolders\".</i>"));
<API key>(GTK_LABEL(no_save_warning), TRUE);
<API key>(GTK_LABEL(no_save_warning), TRUE);
<API key>(GTK_MISC(no_save_warning), 0.0, 0.5);
gtk_box_pack_start(GTK_BOX(page_vbox), no_save_warning, FALSE, FALSE, 0);
}
/* Notebook */
notebook = gtk_notebook_new();
gtk_widget_show(notebook);
gtk_box_pack_start(GTK_BOX(page_vbox), notebook, TRUE, TRUE, 4);
/* compose format */
vbox = gtk_vbox_new (FALSE, VSPACING);
gtk_widget_show (vbox);
<API key> (GTK_CONTAINER (vbox), VBOX_BORDER);
<API key>(
window,
vbox,
&page-><API key>,
&page-><API key>,
&page-><API key>,
&page->compose_body_format,
FALSE, FALSE);
<API key>(GTK_ENTRY(page-><API key>),
TRUE);
vbox_format = <API key>(
<API key>(page->compose_body_format));
hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_end (GTK_BOX(vbox_format), hbox, FALSE, FALSE, 0);
<API key>(window, hbox);
<API key> = <API key>(
_("Apply to subfolders"));
gtk_box_pack_end (GTK_BOX(hbox), <API key>, FALSE, FALSE, 0);
<API key>(GTK_NOTEBOOK(notebook), vbox, gtk_label_new(_("Compose")));
/* reply format */
vbox = gtk_vbox_new (FALSE, VSPACING);
gtk_widget_show (vbox);
<API key> (GTK_CONTAINER (vbox), VBOX_BORDER);
<API key>(
window,
vbox,
&page-><API key>,
&page-><API key>,
&page->reply_quotemark,
&page->reply_body_format,
FALSE, FALSE);
<API key>(GTK_ENTRY(page-><API key>),
TRUE);
vbox_format = <API key>(
<API key>(page->reply_body_format));
hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_end (GTK_BOX(vbox_format), hbox, FALSE, FALSE, 0);
<API key>(window, hbox);
<API key> = <API key>(
_("Apply to subfolders"));
gtk_box_pack_end (GTK_BOX(hbox), <API key>, FALSE, FALSE, 0);
<API key>(GTK_NOTEBOOK(notebook), vbox, gtk_label_new(_("Reply")));
/* forward format */
vbox = gtk_vbox_new (FALSE, VSPACING);
gtk_widget_show (vbox);
<API key> (GTK_CONTAINER (vbox), VBOX_BORDER);
<API key>(
window,
vbox,
&page-><API key>,
&page-><API key>,
&page->forward_quotemark,
&page->forward_body_format,
FALSE, FALSE);
<API key>(GTK_ENTRY(page-><API key>),
TRUE);
vbox_format = <API key>(
<API key>(page->forward_body_format));
hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_end (GTK_BOX(vbox_format), hbox, FALSE, FALSE, 0);
<API key>(window, hbox);
<API key> = <API key>(
_("Apply to subfolders"));
gtk_box_pack_end (GTK_BOX(hbox), <API key>, FALSE, FALSE, 0);
<API key>(GTK_NOTEBOOK(notebook), vbox, gtk_label_new(_("Forward")));
<API key>(GTK_TOGGLE_BUTTON(page-><API key>),
item->prefs->compose_with_format);
<API key>(GTK_ENTRY(page-><API key>),
item->prefs-><API key>);
<API key>(GTK_ENTRY(page-><API key>),
item->prefs-><API key>);
<API key>(GTK_TEXT_VIEW(page->compose_body_format),
item->prefs->compose_body_format);
<API key>(GTK_TOGGLE_BUTTON(page-><API key>),
item->prefs->reply_with_format);
<API key>(GTK_ENTRY(page->reply_quotemark),
item->prefs->reply_quotemark);
<API key>(GTK_ENTRY(page-><API key>),
item->prefs-><API key>);
<API key>(GTK_TEXT_VIEW(page->reply_body_format),
item->prefs->reply_body_format);
<API key>(GTK_TOGGLE_BUTTON(page-><API key>),
item->prefs->forward_with_format);
<API key>(GTK_ENTRY(page->forward_quotemark),
item->prefs->forward_quotemark);
<API key>(GTK_ENTRY(page-><API key>),
item->prefs-><API key>);
<API key>(GTK_TEXT_VIEW(page->forward_body_format),
item->prefs->forward_body_format);
gtk_widget_show_all(page_vbox);
page->window = GTK_WIDGET(window);
page-><API key> = <API key>;
page-><API key> = <API key>;
page-><API key> = <API key>;
page->page.widget = page_vbox;
}
static void <API key>(PrefsPage *page_)
{
<API key> *page = (<API key> *) page_;
if (page-><API key>)
<API key>(GTK_ENTRY(page-><API key>));
if (page-><API key>)
<API key>(GTK_ENTRY(page-><API key>));
if (page-><API key>)
<API key>(GTK_ENTRY(page-><API key>));
}
/** \brief Save the prefs in page to folder.
*
* If the folder is not the one specified in page->item, then only those properties
* that have the relevant 'apply to sub folders' button checked are saved
*/
static void <API key>(FolderItem *folder, <API key> *page)
{
FolderItemPrefs *prefs = folder->prefs;
gboolean all = FALSE;
if (folder->path == NULL)
return;
if (page->item == folder)
all = TRUE;
cm_return_if_fail(prefs != NULL);
/* save and check formats */
if (all || <API key>(GTK_TOGGLE_BUTTON(page-><API key>))) {
prefs->compose_with_format =
<API key>(GTK_TOGGLE_BUTTON(page-><API key>));
prefs-><API key> = <API key>(
GTK_ENTRY(page-><API key>));
prefs-><API key> = <API key>(
GTK_ENTRY(page-><API key>));
prefs->compose_body_format = <API key>(
GTK_TEXT_VIEW(page->compose_body_format));
<API key>(prefs->compose_with_format,
prefs-><API key>,
prefs-><API key>,
prefs->compose_body_format);
}
if (all || <API key>(GTK_TOGGLE_BUTTON(page-><API key>))) {
prefs->reply_with_format =
<API key>(GTK_TOGGLE_BUTTON(page-><API key>));
prefs->reply_quotemark = <API key>(
GTK_EDITABLE(page->reply_quotemark), 0, -1);
prefs-><API key> = <API key>(
GTK_ENTRY(page-><API key>));
prefs->reply_body_format = <API key>(
GTK_TEXT_VIEW(page->reply_body_format));
<API key>(prefs->reply_with_format,
prefs-><API key>,
prefs->reply_quotemark,
prefs->reply_body_format);
}
if (all || <API key>(GTK_TOGGLE_BUTTON(page-><API key>))) {
prefs->forward_with_format =
<API key>(GTK_TOGGLE_BUTTON(page-><API key>));
prefs->forward_quotemark = <API key>(
GTK_EDITABLE(page->forward_quotemark), 0, -1);
prefs-><API key> = <API key>(
GTK_ENTRY(page-><API key>));
prefs->forward_body_format = <API key>(
GTK_TEXT_VIEW(page->forward_body_format));
<API key>(prefs->forward_with_format,
prefs-><API key>,
prefs->forward_quotemark,
prefs->forward_body_format);
}
<API key>(folder);
}
static gboolean <API key>(GNode *node, gpointer data)
{
FolderItem *item = (FolderItem *) node->data;
<API key> *page = (<API key> *) data;
<API key>(item != NULL, TRUE);
<API key>(page != NULL, TRUE);
<API key>(item, page);
/* optimise by not continuing if none of the 'apply to sub folders'
check boxes are selected - and optimise the checking by only doing
it once */
if ((node == page->item->node) &&
!(<API key>(GTK_TOGGLE_BUTTON(page-><API key>)) ||
<API key>(GTK_TOGGLE_BUTTON(page-><API key>)) ||
<API key>(GTK_TOGGLE_BUTTON(page-><API key>))))
return TRUE;
else
return FALSE;
return FALSE;
}
static void <API key>(PrefsPage *page_)
{
<API key> *page = (<API key> *) page_;
g_node_traverse(page->item->node, G_PRE_ORDER, G_TRAVERSE_ALL,
-1, <API key>, page);
}
static gint <API key>(gchar *folder_chmod)
{
gint newmode = 0;
gchar *tmp;
if (folder_chmod) {
newmode = strtol(folder_chmod, &tmp, 8);
if (!(*(folder_chmod) && !(*tmp)))
newmode = 0;
}
return newmode;
}
static void <API key>(GtkWidget *widget, gpointer data)
{
<API key> *page = (<API key> *) data;
gint rgbcolor;
rgbcolor = <API key>(_("Pick color for folder"),
page->folder_color);
<API key>(page->folder_color_btn, rgbcolor);
page->folder_color = rgbcolor;
}
static void clean_cache_cb(GtkWidget *widget, gpointer data)
{
<API key> *page = (<API key> *) data;
FolderItem *item = page->item;
gboolean was_open = FALSE;
FolderView *folderview = NULL;
if (alertpanel_full(_("Discard cache"),
_("Do you really want to discard the local cached "
"data for this folder?"),
GTK_STOCK_CANCEL, _("+Discard"), NULL, FALSE,
NULL, ALERT_WARNING, G_ALERTDEFAULT)
!= G_ALERTALTERNATE)
return;
if (<API key>())
folderview = <API key>()->folderview;
if (folderview && item->opened) {
<API key>(folderview);
was_open = TRUE;
}
<API key>(item);
if (was_open)
folderview_select(folderview,item);
}
#ifndef G_OS_WIN32
static regex_t *<API key>(gchar *<API key>)
{
int err;
gchar buf[BUFFSIZE];
regex_t *preg = NULL;
preg = g_new0(regex_t, 1);
err = <API key>(<API key>,
preg, REG_EXTENDED);
if (err) {
regerror(err, preg, buf, BUFFSIZE);
g_free(preg);
preg = NULL;
}
return preg;
}
static void <API key>(GtkWidget *widget, gpointer data)
{
#if !GTK_CHECK_VERSION(3, 0, 0)
static GdkColor red;
static gboolean colors_initialised = FALSE;
#else
static GdkColor red = { (guint32)0, (guint16)0xff, (guint16)0x70, (guint16)0x70 };
#endif
static gchar buf[BUFFSIZE];
<API key> *page = (<API key> *)data;
gchar *test_string, *regexp;
regex_t *preg;
regexp = g_strdup(gtk_entry_get_text(GTK_ENTRY(page-><API key>)));
test_string = g_strdup(gtk_entry_get_text(GTK_ENTRY(page-><API key>)));
if (!regexp || !regexp[0]) {
<API key>(page-><API key>,
GTK_STATE_NORMAL, NULL);
if (test_string)
gtk_entry_set_text(GTK_ENTRY(page-><API key>), test_string);
g_free(test_string);
g_free(regexp);
return;
}
if (!test_string || !test_string[0]) {
g_free(test_string);
g_free(regexp);
return;
}
#if !GTK_CHECK_VERSION(3, 0, 0)
if (!colors_initialised) {
gdk_color_parse("#ff7070", &red);
colors_initialised = <API key>(
<API key>(), &red, FALSE, TRUE);
}
#endif
preg = <API key>(regexp);
#if !GTK_CHECK_VERSION(3, 0, 0)
if (colors_initialised)
<API key>(page-><API key>,
GTK_STATE_NORMAL, preg ? NULL : &red);
#endif
if (preg != NULL) {
string_remove_match(buf, BUFFSIZE, test_string, preg);
gtk_entry_set_text(GTK_ENTRY(page-><API key>), buf);
regfree(preg);
g_free(preg);
}
g_free(test_string);
g_free(regexp);
}
static gchar *<API key>(void)
{
MsgInfo *msginfo_selected;
SummaryView *summaryview = NULL;
if (!<API key>())
return NULL;
summaryview = <API key>()->summaryview;
msginfo_selected = <API key>(summaryview);
return msginfo_selected ? g_strdup(msginfo_selected->subject) : NULL;
}
static void <API key>(GtkWidget *widget, gpointer data)
{
<API key> *page = (<API key> *)data;
if (<API key>(GTK_TOGGLE_BUTTON(page-><API key>))) {
gchar *subject = <API key>();
if (subject) {
gtk_entry_set_text(GTK_ENTRY(page-><API key>), subject);
g_free(subject);
}
}
}
#endif
static void <API key>()
{
static gchar *pfi_general_path[2];
static <API key> <API key>;
pfi_general_path[0] = _("General");
pfi_general_path[1] = NULL;
<API key>.page.path = pfi_general_path;
<API key>.page.create_widget = <API key>;
<API key>.page.destroy_widget = <API key>;
<API key>.page.save_page = <API key>;
<API key>((PrefsPage *) &<API key>, NULL);
}
static void <API key>(void)
{
static gchar *pfi_compose_path[2];
static <API key> <API key>;
pfi_compose_path[0] = _("Compose");
pfi_compose_path[1] = NULL;
<API key>.page.path = pfi_compose_path;
<API key>.page.create_widget = <API key>;
<API key>.page.destroy_widget = <API key>;
<API key>.page.save_page = <API key>;
<API key>((PrefsPage *) &<API key>, NULL);
}
static void <API key>(void)
{
static gchar *pfi_templates_path[2];
static <API key> <API key>;
pfi_templates_path[0] = _("Templates");
pfi_templates_path[1] = NULL;
<API key>.page.path = pfi_templates_path;
<API key>.page.create_widget = <API key>;
<API key>.page.destroy_widget = <API key>;
<API key>.page.save_page = <API key>;
<API key>((PrefsPage *) &<API key>, NULL);
}
static GSList *prefs_pages = NULL;
static void <API key>(PrefsWindow *window)
{
<API key>(window->window);
}
static void <API key>(PrefsWindow *window)
{
<API key>(window->window);
}
void <API key>(FolderItem *item)
{
gchar *id, *title;
GSList *pages;
if (prefs_pages == NULL) {
<API key>();
<API key>();
<API key>();
}
if (item->path) {
id = <API key> (item);
can_save = TRUE;
} else {
id = g_strdup(item->name);
can_save = FALSE;
}
pages = g_slist_concat(
g_slist_copy(prefs_pages),
g_slist_copy(item->folder->klass->prefs_pages));
title = g_strdup_printf (_("Properties for folder %s"), id);
g_free (id);
prefswindow_open(title, pages, item,
&prefs_common.folderitemwin_width, &prefs_common.<API key>,
<API key>,
NULL,
<API key>);
g_slist_free(pages);
g_free (title);
}
void <API key>(PrefsPage *page, FolderClass *klass)
{
if (klass != NULL)
klass->prefs_pages = g_slist_append(klass->prefs_pages, page);
else
prefs_pages = g_slist_append(prefs_pages, page);
}
void <API key>(PrefsPage *page, FolderClass *klass)
{
if (klass != NULL)
klass->prefs_pages = g_slist_remove(klass->prefs_pages, page);
else
prefs_pages = g_slist_remove(prefs_pages, page);
}
|
<!DOCTYPE HTML PUBLIC "-
<HTML
><HEAD
><TITLE
>FcAtomicCreate</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
HREF="index.html"><LINK
REL="UP"
TITLE="FcAtomic"
HREF="x102.html#AEN3766"><LINK
REL="PREVIOUS"
TITLE="FUNCTIONS"
HREF="x102.html"><LINK
REL="NEXT"
TITLE="FcAtomicLock"
HREF="fcatomiclock.html"></HEAD
><BODY
CLASS="REFENTRY"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
></TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="x102.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="fcatomiclock.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="FCATOMICCREATE"
></A
>FcAtomicCreate</H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN3774"
></A
><H2
>Name</H2
>FcAtomicCreate -- create an FcAtomic object</DIV
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN3777"
></A
><H2
>Synopsis</H2
><DIV
CLASS="FUNCSYNOPSIS"
><P
></P
><A
NAME="AEN3778"
></A
><PRE
CLASS="FUNCSYNOPSISINFO"
>#include <fontconfig/fontconfig.h>
</PRE
><P
><CODE
><CODE
CLASS="FUNCDEF"
>FcAtomic * FcAtomicCreate</CODE
>(const FcChar8 *file);</CODE
></P
><P
></P
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN3785"
></A
><H2
>Description</H2
><P
>Creates a data structure containing data needed to control access to <CODE
CLASS="PARAMETER"
>file</CODE
>.
Writing is done to a separate file. Once that file is complete, the original
configuration file is atomically replaced so that reading process always see
a consistent and complete file without the need to lock for reading.
</P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="x102.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="fcatomiclock.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>FUNCTIONS</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="x102.html#AEN3766"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>FcAtomicLock</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>
|
# -*- coding: utf8 -*-
# This is the package latexparser
# 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
# email: laurent@claessens-donadello.eu
import codecs
from latexparser.InputPaths import InputPaths
class Occurrence(object):
"""
self.as_written : the code as it appears in the file, including \MyMacro, including the backslash.
self.position : the position at which this occurrence appears.
Example, if we look at the LatexCode
Hello word, \MyMacro{first}
and then \MyMacro{second}
the first occurrence of \MyMacro has position=12
"""
def __init__(self,name,arguments,as_written="",position=0):
self.arguments = arguments
self.number_of_arguments = len(arguments)
self.name = name
self.as_written = as_written
self.arguments_list = arguments
self.position = position
def configuration(self):
r"""
Return the way the arguments are separated in as_written.
Example, if we have
\MyMacro<space>{A}<tab>{B}
{C},
we return the list
["<space>","tab","\n"]
The following has to be true:
self.as_written == self.name+self.configuration()[0]+self.arguments_list[0]+etc.
"""
l=[]
a = self.as_written.split(self.name)[1]
for arg in self.arguments_list:
split = a.split("{"+arg+"}")
separator=split[0]
try:
a=split[1]
except IndexError:
print(self.as_written)
raise
l.append(separator)
return l
def change_argument(self,num,func):
r"""
Apply the function <func> to the <n>th argument of self. Then return a new object.
"""
n=num-1 # Internally, the arguments are numbered from 0.
arguments=self.arguments_list
configuration=self.configuration()
arguments[n]=func(arguments[n])
new_text=self.name
if len(arguments) != len(configuration):
print("Error : length of the configuration list has to be the same as the number of arguments")
raise ValueError
for i in range(len(arguments)):
new_text=new_text+configuration[i]+"{"+arguments[i]+"}"
return Occurrence(self.name,arguments,new_text,self.position)
def analyse(self):
return globals()["Occurrence_"+self.name[1:]](self) # We have to remove the initial "\" in the name of the macro.
def __getitem__(self,a):
return self.arguments[a]
def __str__(self):
return self.as_written
class Occurrence_newlabel(object):
r"""
takes an occurrence of \newlabel and creates an object which contains the information.
In the self.section_name we remove "\relax" from the string.
"""
def __init__(self,occurrence):
self.occurrence = occurrence
self.arguments = self.occurrence.arguments
if len(self.arguments) == 0 :
self.name = "Non interesting; probably the definition"
self.listoche = [None,None,None,None,None]
self.value,self.page,self.section_name,self.fourth,self.fifth=(None,None,None,None,None)
else :
self.name = self.arguments[0][0]
self.listoche = [a[0] for a in SearchArguments(self.arguments[1][0],5)[0]]
self.value = self.listoche[0]
self.page = self.listoche[1]
self.section_name = self.listoche[2].replace(r"\relax","")
self.fourth = self.listoche[3] # I don't know the role of the fourth argument of \newlabel
self.fifth = self.listoche[4] # I don't know the role of the fifth argument of \newlabel
class <API key>(object):
def __init__(self,Occurrence):
self.directory=Occurrence[0]
class Occurrence_cite(object):
def __init__(self,occurrence):
self.label = occurrence[0]
def entry(self,codeBibtex):
return codeBibtex[self.label]
class <API key>(object):
def __init__(self,occurrence):
self.occurrence = occurrence
self.number_of_arguments = 0
if self.occurrence[1][1] == "[]":
self.number_of_arguments = self.occurrence[1][0]
self.name = self.occurrence[0][0]
self.definition = self.occurrence[-1][0]
class Occurrence_label(object):
def __init__(self,occurrence):
self.occurrence=occurrence
self.label=self.occurrence.arguments[0]
class Occurrence_ref(object):
def __init__(self,occurrence):
self.occurrence=occurrence
self.label=self.occurrence.arguments[0]
class Occurrence_eqref(object):
def __init__(self,occurrence):
self.occurrence=occurrence
self.label=self.occurrence.arguments[0]
class Occurrence_input(Occurrence):
def __init__(self,occurrence):
Occurrence.__init__(self,occurrence.name,occurrence.arguments,as_written=occurrence.as_written,position=occurrence.position)
self.occurrence = occurrence
self.filename = self.occurrence[0]
self.input_paths=InputPaths()
self._file_content=None # Make file_content "lazy"
def file_content(self,input_paths=None):
import os.path
# Memoize
if self._file_content is not None :
return self._file_content
# At least, we are searching in the current directory :
if input_paths is None :
raise # Just to know who should do something like that
# Creating the filename
filename=self.filename
strict_filename = filename
if "." not in filename:
strict_filename=filename+".tex"
# Searching for the correct file in the subdirectories
fn=input_paths.get_file(strict_filename)
try:
# Without [:-1] I got an artificial empty line at the end.
text = "".join( codecs.open(fn,"r",encoding="utf8") )[:-1]
except IOError :
print("Warning : file %s not found."%strict_filename)
raise
self._file_content=text
return self._file_content
|
<div>
<nav>
<ul id="menu">
{% for m in menu %}
<li>
{% if m.subsistemas %}
{{ m.nombreDireccion }}
<ul>
{% for submenu in m.subsistemas %}
<li>
<a href="{{submenu.target}}">{{ submenu.nombreSistema }}</a>
</li>
{% endfor %}
</ul>
{% else %}
<a href="{{m.target}}"> {{ m.nombreDireccion }}</a>
{% endif%}
</li>
{% endfor %}
<li>
{% firstof user.get_short_name user.get_username %}
<a href="{% url 'logout_view' %}" id="logout">Cerrar sesion</a>
</li>
</ul>
</nav>
</br> </br> </br>
</div>
|
% acronyms for text or math mode
\newcommand {\ccast} {\mbox{\small CCAST}}
\newcommand {\cris} {\mbox{\small CrIS}}
\newcommand {\airs} {\mbox{\small AIRS}}
\newcommand {\iasi} {\mbox{\small IASI}}
\newcommand {\idps} {\mbox{\small IDPS}}
\newcommand {\nasa} {\mbox{\small NASA}}
\newcommand {\noaa} {\mbox{\small NOAA}}
\newcommand {\umbc} {\mbox{\small UMBC}}
\newcommand {\uw} {\mbox{\small UW}}
\newcommand {\fft} {\mbox{\small FFT}}
\newcommand {\ifft} {\mbox{\small IFFT}}
\newcommand {\fir} {\mbox{\small FIR}}
\newcommand {\fov} {\mbox{\small FOV}}
\newcommand {\for} {\mbox{\small FOR}}
\newcommand {\ict} {\mbox{\small ICT}}
\newcommand {\ils} {\mbox{\small ILS}}
\newcommand {\igm} {\mbox{\small IGM}}
\newcommand {\opd} {\mbox{\small OPD}}
\newcommand {\rms} {\mbox{\small RMS}}
\newcommand {\zpd} {\mbox{\small ZPD}}
\newcommand {\ppm} {\mbox{\small PPM}}
\newcommand {\srf} {\mbox{\small SRF}}
\newcommand {\ES} {\mbox{\small ES}}
\newcommand {\SP} {\mbox{\small SP}}
\newcommand {\IT} {\mbox{\small IT}}
\newcommand {\SA} {\mbox{\small SA}}
\newcommand {\ET} {\mbox{\small ET}}
\newcommand {\FT} {\mbox{\small FT}}
% abbreviations, mainly for math mode
\newcommand {\real} {\mbox{real}}
\newcommand {\imag} {\mbox{imag}}
\newcommand {\atan} {\mbox{atan}}
\newcommand {\obs} {\mbox{obs}}
\newcommand {\calc} {\mbox{calc}}
\newcommand {\sinc} {\mbox{sinc}}
\newcommand {\psinc} {\mbox{psinc}}
% symbols, for math mode only
\newcommand {\wnum} {\mbox{cm$^{-1}$}}
\newcommand {\lmax} {L_{\mbox{\tiny max}}}
\newcommand {\vmax} {V_{\mbox{\tiny max}}}
\newcommand {\rIT} {R_{\mbox{\tiny IT}}}
\newcommand {\tauobs} {\tau_{\mbox{\tiny obs}}}
\newcommand {\taucal} {\tau_{\mbox{\tiny calc}}}
\newcommand {\Vdc} {V_{\mbox{\tiny DC}}}
|
#!/bin/bash
APP_DIR=`pwd`/books/
LOCALE_DIR=$APP_DIR/locale/
echo $APP_DIR
pushd $APP_DIR
echo `pwd`
for lang in `ls $LOCALE_DIR`; do
echo "Setting up locale for $lang"
django-admin.py makemessages -l $lang
done
echo "*************************"
django-admin.py compilemessages
popd
|
using MixERP.Net.Common.Helpers;
using MixERP.Net.Common.Models.Core;
using MixERP.Net.Common.Models.Transactions;
using System;
using System.Collections.ObjectModel;
namespace MixERP.Net.Core.Modules.Sales.Data.Transactions
{
public static class Delivery
{
public static long Add(DateTime valueDate, int storeId, string partyCode, int priceTypeId, int paymentTermId, Collection<<API key>> details, int shipperId, string shippingAddressCode, decimal shippingCharge, int costCenterId, string referenceNumber, int agentId, string statementReference, Collection<int> <API key>, Collection<AttachmentModel> attachments, bool nonTaxable)
{
StockMasterModel stockMaster = new StockMasterModel();
stockMaster.PartyCode = partyCode;
stockMaster.IsCredit = true;//Credit
stockMaster.PaymentTermId = paymentTermId;
stockMaster.PriceTypeId = priceTypeId;
stockMaster.ShipperId = shipperId;
stockMaster.ShippingAddressCode = shippingAddressCode;
stockMaster.ShippingCharge = shippingCharge;
stockMaster.SalespersonId = agentId;
stockMaster.CashRepositoryId = 0;//Credit
stockMaster.StoreId = storeId;
long transactionMasterId = GlTransaction.Add("Sales.Delivery", valueDate, SessionHelper.GetOfficeId(), SessionHelper.GetUserId(), SessionHelper.GetLogOnId(), costCenterId, referenceNumber, statementReference, stockMaster, details, attachments, nonTaxable);
TransactionGovernor.Autoverification.Autoverify.<API key>(transactionMasterId);
return transactionMasterId;
}
}
}
|
import java.util.*;
public class Pali {
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
String str=sc.next();
StringBuffer buff=new StringBuffer(str).reverse();
String str1=buff.toString();
if(str.isequals(str1))
{
System.out.println("Palindrome");
}
else
{
System.out.println("Not a Palindrome");
}
}
|
#include "ntru_crypto.h"
#include "ntru_crypto_hash.h"
typedef uint32_t (*<API key>)(
void *c);
typedef uint32_t (*<API key>)(
void *c,
void const *data,
uint32_t len);
typedef uint32_t (*<API key>)(
void *c,
void *md);
typedef uint32_t (*<API key>)(
void const *data,
uint32_t len,
void *md);
typedef struct <API key> {
uint8_t algid;
uint16_t block_length;
uint16_t digest_length;
<API key> init;
<API key> update;
<API key> final;
<API key> digest;
} <API key>;
static <API key> const algs_params[] = {
{
<API key>,
SHA_1_BLK_LEN,
SHA_1_MD_LEN,
(<API key>) SHA_1_INIT_FN,
(<API key>) SHA_1_UPDATE_FN,
(<API key>) SHA_1_FINAL_FN,
(<API key>) SHA_1_DIGEST_FN,
},
{
<API key>,
SHA_256_BLK_LEN,
SHA_256_MD_LEN,
(<API key>) SHA_256_INIT_FN,
(<API key>) SHA_256_UPDATE_FN,
(<API key>) SHA_256_FINAL_FN,
(<API key>) SHA_256_DIGEST_FN,
},
};
static int const numalgs = (sizeof(algs_params)/sizeof(algs_params[0]));
/* get_alg_params
*
* Return a pointer to the hash algorithm parameters for the hash algorithm
* specified, by looking for algid in the global algs_params table.
* If not found, return NULL.
*/
static <API key> const *
get_alg_params(
<API key> algid) /* in - the hash algorithm to find */
{
int i;
for (i = 0; i < numalgs; i++)
{
if (algs_params[i].algid == algid)
{
return &algs_params[i];
}
}
return NULL;
}
/* <API key>
*
* Sets the hash algorithm for the hash context. This must be called before
* any calls to <API key>(),
* <API key>(), or <API key>() are made.
*
* Returns NTRU_CRYPTO_HASH_OK on success.
* Returns <API key> if the specified algorithm is not supported.
*/
uint32_t
<API key>(
<API key> algid, /* in - hash algorithm to be used */
<API key> *c) /* in/out - pointer to the hash context */
{
if (!c)
{
HASH_RET(<API key>);
}
c->alg_params = get_alg_params(algid);
if (!c->alg_params)
{
HASH_RET(<API key>);
}
HASH_RET(NTRU_CRYPTO_HASH_OK);
}
/* <API key>
*
* Gets the number of bytes in an input block for the hash algorithm
* specified in the hash context. The hash algorithm must have been set
* in the hash context with a call to <API key>() prior to
* calling this function.
*
* Returns NTRU_CRYPTO_HASH_OK on success.
* Returns <API key> if inappropriate NULL pointers are
* passed.
* Returns <API key> if the algorithm has not been set.
*/
uint32_t
<API key>(
<API key> *c, /* in - pointer to the hash context */
uint16_t *blk_len) /* out - address for block length in bytes */
{
if (!c || !blk_len)
{
HASH_RET(<API key>);
}
if (!c->alg_params)
{
HASH_RET(<API key>);
}
*blk_len = c->alg_params->block_length;
HASH_RET(NTRU_CRYPTO_HASH_OK);
}
/* <API key>
*
* Gets the number of bytes needed to hold the message digest for the
* hash algorithm specified in the hash context. The algorithm must have
* been set in the hash context with a call to <API key>() prior
* to calling this function.
*
* Returns NTRU_CRYPTO_HASH_OK on success.
* Returns <API key> if inappropriate NULL pointers are
* passed.
* Returns <API key> if the algorithm has not been set.
*/
uint32_t
<API key>(
<API key> const *c, /* in - pointer to the hash context */
uint16_t *md_len) /* out - addr for digest length in bytes */
{
if (!c || !md_len)
{
HASH_RET(<API key>);
}
if (!c->alg_params)
{
HASH_RET(<API key>);
}
*md_len = c->alg_params->digest_length;
HASH_RET(NTRU_CRYPTO_HASH_OK);
}
/* <API key>
*
* This routine performs standard initialization of the hash state.
*
* Returns NTRU_CRYPTO_HASH_OK on success.
* Returns <API key> with corrupted context.
* Returns <API key> if inappropriate NULL pointers are
* passed.
* Returns <API key> if the algorithm has not been set.
*/
uint32_t
<API key>(
<API key> *c) /* in/out - pointer to hash context */
{
if (!c)
{
HASH_RET(<API key>);
}
if (!c->alg_params)
{
HASH_RET(<API key>);
}
return c->alg_params->init(&c->alg_ctx);
}
/* <API key>
*
* This routine processes input data and updates the hash calculation.
*
* Returns NTRU_CRYPTO_HASH_OK on success.
* Returns <API key> with corrupted context.
* Returns <API key> if inappropriate NULL pointers are
* passed.
* Returns <API key> if too much text has been fed to the
* hash algorithm. The size limit is dependent on the hash algorithm,
* and not all algorithms have this limit.
* Returns <API key> if the algorithm has not been set.
*/
uint32_t
<API key>(
<API key> *c, /* in/out - pointer to hash context */
uint8_t const *data, /* in - pointer to input data */
uint32_t data_len) /* in - number of bytes of input data */
{
if (!c || (data_len && !data))
{
HASH_RET(<API key>);
}
if (!c->alg_params)
{
HASH_RET(<API key>);
}
return c->alg_params->update(&c->alg_ctx, data, data_len);
}
/* <API key>
*
* This routine completes the hash calculation and returns the message digest.
*
* Returns NTRU_CRYPTO_HASH_OK on success.
* Returns <API key> with corrupted context.
* Returns <API key> if inappropriate NULL pointers are
* passed.
* Returns <API key> if the algorithm has not been set.
*/
uint32_t
<API key>(
<API key> *c, /* in/out - pointer to hash context */
uint8_t *md) /* out - address for message digest */
{
if (!c || !md)
{
HASH_RET(<API key>);
}
if (!c->alg_params)
{
HASH_RET(<API key>);
}
return c->alg_params->final(&c->alg_ctx, md);
}
/* <API key>
*
* This routine computes a message digest. It is assumed that the
* output buffer md is large enough to hold the output (see
* <API key>)
*
* Returns NTRU_CRYPTO_HASH_OK on success.
* Returns <API key> with corrupted context.
* Returns <API key> if inappropriate NULL pointers are
* passed.
* Returns <API key> if too much text has been fed to the
* hash algorithm. The size limit is dependent on the hash algorithm,
* and not all algorithms have this limit.
* Returns <API key> if the specified algorithm is not supported.
*/
uint32_t
<API key>(
<API key> algid, /* in - the hash algorithm to use */
uint8_t const *data, /* in - pointer to input data */
uint32_t data_len, /* in - number of bytes of input data */
uint8_t *md) /* out - address for message digest */
{
<API key> const *alg_params = get_alg_params(algid);
if (!alg_params)
{
HASH_RET(<API key>);
}
if ((data_len && !data) || !md)
{
HASH_RET(<API key>);
}
return alg_params->digest(data, data_len, md);
}
|
#!/usr/bin/env python
# MCP320x
# This module interfaces with the MCP300x or MCP320x family of chips. These
# are 10-bit and 12-bit ADCs respectively. The x number indicates the number
# of multiplexed analog inputs: 2 (MCP3202), 4 (MCP3204) or 8 (MCP3208)
# Communications with this chip are over the SPI protocol.
# The version of the code has two SPI interfaces: the builtin hardware
# SPI interface on the RPI, or a "bit-banged" GPIO version.
# Bit-Bang GPIO:
# We emulate a SPI port in software using the GPIO lines.
# This is a bit slower than the hardware interface, but it is far more
# clear what is going on, plus the RPi has only one SPI device.
# Connections: RPi GPIO to MCP320x
# CS_bar_pin = CS/SHDN
# CLK_pin = CLK
# MOSI_pin = D_in
# MISO_pin = D_out
# Hardware SPI:
# This uses the builtin hardware on the RPi. You need to enable this with the
# raspi-config program first. The data rate can be up to 1MHz.
# Connections: RPi pins to MCP320x
# CE0 or CE1 = CS/SHDN (chip select) set CS_bar = 0 or 1
# SCK = CLK set CLK_pin = 1000000 (transfer speed)
# MOSI = D_in set MOSI_pin = 0
# MISO = D_out set MISO_pin = 0
# The SPI protocol simulated here is MODE=0, CPHA=0, which has a positive polarity clock,
# (the clock is 0 at rest, active at 1) and a positive phase (0 to 1 transition) for reading
# or writing the data. Thus corresponds to the specifications of the MCP320x chips.
# From MCP3208 datasheet:
# Outging data : MCU latches data to A/D converter on rising edges of SCLK
# Incoming data: Data is clocked out of A/D converter on falling edges, so should be read on rising edge.
try:
import RPi.GPIO as GPIO
except ImportError as error:
pass
try:
import Adafruit_BBIO as GPIO
except ImportError as error:
pass
try:
import spidev
except ImportError as error:
pass
from DevLib.MyValues import MyValues
class MCP320x:
"""This is an class that implements an interface to the MCP320x ADC chips.
Standard is the MCP3208, but is will also work wiht the MCP3202, MCP3204, MCP3002, MCP3004 and MCP3008."""
def __init__(self, cs_bar_pin, clk_pin=1000000, mosi_pin=0, miso_pin=0, chip='MCP3208',
channel_max=None, bit_length=None, single_ended=True):
"""Initialize the code and set the GPIO pins.
The last argument, ch_max, is 2 for the MCP3202, 4 for the
MCP3204 or 8 for the MCS3208."""
self._CLK = clk_pin
self._MOSI = mosi_pin
self._MISO = miso_pin
self._CS_bar = cs_bar_pin
chip_dictionary = {
"MCP3202": (2, 12),
"MCP3204": (4, 12),
"MCP3208": (8, 12),
"MCP3002": (2, 10),
"MCP3004": (4, 10),
"MCP3008": (8, 10)
}
if chip in chip_dictionary:
self._ChannelMax = chip_dictionary[chip][0]
self._BitLength = chip_dictionary[chip][1]
elif chip is None and (channel_max is not None) and (bit_length is not None):
self._ChannelMax = channel_max
self._BitLength = bit_length
else:
print("Unknown chip: {} - Please re-initialize.")
self._ChannelMax = 0
self._BitLength = 0
return
self._SingleEnded = single_ended
self._Vref = 3.3
self._values = MyValues(self.read_adc, self._ChannelMax)
self._volts = MyValues(self.read_volts, self._ChannelMax)
# This is used to speed up the SPIDEV communication. Send out MSB first.
# control[0] - bit7-3: upper 5 bits 0, because we can only send 8 bit sequences.
# - bit2 : Start bit - starts conversion in ADCs
# - bit1 : Select single_ended=1 or differential=0
# - bit0 : D2 high bit of channel select.
# control[1] - bit7 : D1 middle bit of channel select.
# - bit6 : D0 low bit of channel select.
# - bit5-0 : Don't care.
if self._SingleEnded:
self._control0 = [0b00000110, 0b00100000, 0] # Pre-compute part of the control word.
else:
self._control0 = [0b00000100, 0b00100000, 0] # Pre-compute part of the control word.
if self._MOSI > 0: # Bing Bang mode
assert self._MISO != 0 and self._CLK < 32
if GPIO.getmode() != 11:
GPIO.setmode(GPIO.BCM) # Use the BCM numbering scheme
GPIO.setup(self._CLK, GPIO.OUT) # Setup the ports for in and output
GPIO.setup(self._MOSI, GPIO.OUT)
GPIO.setup(self._MISO, GPIO.IN)
GPIO.setup(self._CS_bar, GPIO.OUT)
GPIO.output(self._CLK, 0) # Set the clock low.
GPIO.output(self._MOSI, 0) # Set the Master Out low
GPIO.output(self._CS_bar, 1) # Set the CS_bar high
else:
self._dev = spidev.SpiDev(0, self._CS_bar) # Start a SpiDev device
self._dev.mode = 0 # Set SPI mode (phase)
self._dev.max_speed_hz = self._CLK # Set the data rate
self._dev.bits_per_word = 8 # Number of bit per word. ALWAYS 8
def __del__(self):
""" Cleanup the GPIO before being destroyed """
if self._MOSI > 0:
GPIO.cleanup(self._CS_bar)
GPIO.cleanup(self._CLK)
GPIO.cleanup(self._MOSI)
GPIO.cleanup(self._MISO)
def get_channel_max(self):
"""Return the maximum number of channels"""
return self._ChannelMax
def get_bit_length(self):
"""Return the number of bits that will be read"""
return self._BitLength
def get_value_max(self):
"""Return the maximum value possible for an ADC read"""
return 2 ** self._BitLength - 1
def send_bit(self, bit):
""" Send out a single bit, and pulse clock."""
if self._MOSI == 0:
return
# The input is read on the rising edge of the clock.
GPIO.output(self._MOSI, bit) # Set the bit.
GPIO.output(self._CLK, 1) # Rising edge sends data
GPIO.output(self._CLK, 0) # Return clock to zero.
def read_bit(self):
""" Read a single bit from the ADC and pulse clock."""
if self._MOSI == 0:
return 0
# The output is going out on the falling edge of the clock,
# and is to be read on the rising edge of the clock.
# Clock should be already low, and data should already be set.
GPIO.output(self._CLK, 1) # Set the clock high. Ready to read.
bit = GPIO.input(self._MISO) # Read the bit.
GPIO.output(self._CLK, 0) # Return clock low, next bit will be set.
return bit
def read_adc(self, channel):
"""This reads the actual ADC value, after connecting the analog multiplexer to
the desired channel.
ADC value is returned at a n-bit integer value, with n=10 or 12 depending on the chip.
The value can be converted to a voltage with:
volts = data*Vref/(2**n-1)"""
if channel < 0 or channel >= self._ChannelMax:
print("Error - chip does not have channel = {}".format(channel))
if self._MOSI == 0:
# SPIdev Code
# This builds up the control word, which selects the channel
# and sets single/differential more.
control = [self._control0[0] + ((channel & 0b100) >> 2), self._control0[1]+((channel & 0b011) << 6), 0]
dat = self._dev.xfer(control)
value = (dat[1] << 8)+dat[2] # Unpack the two 8-bit words to a single integer.
return value
else:
# Bit Bang code.
# To read out this chip you need to send:
# 1 - start bit
# 2 - Single ended (1) or differential (0) mode
# 3 - Channel select: 1 bit for x=2 or 3 bits for x=4,8
# 4 - MSB first (1) or LSB first (0)
# Start of sequence sets CS_bar low, and sends sequence
GPIO.output(self._CLK, 0) # Make sure clock starts low.
GPIO.output(self._MOSI, 0)
GPIO.output(self._CS_bar, 0) # Select the chip.
self.send_bit(1) # Start bit = 1
self.send_bit(self._SingleEnded) # Select single or differential
if self._ChannelMax > 2:
self.send_bit(int((channel & 0b100) > 0)) # Send high bit of channel = DS2
self.send_bit(int((channel & 0b010) > 0)) # Send mid bit of channel = DS1
self.send_bit(int((channel & 0b001) > 0)) # Send low bit of channel = DS0
else:
self.send_bit(channel)
self.send_bit(0) # MSB First (for MCP3x02) or don't care.
# The clock is currently low, and the dummy bit = 0 is on the output of the ADC
self.read_bit() # Read the bit.
data = 0
for i in range(self._BitLength):
# Note you need to shift left first, or else you shift the last bit (bit 0)
# to the 1 position.
data <<= 1
bit = self.read_bit()
data += bit
GPIO.output(self._CS_bar, 1) # Unselect the chip.
return data
def read_volts(self, channel):
"""Read the ADC value from channel and convert to volts, assuming that Vref is set correctly. """
return self._Vref * self.read_adc(channel) / self.get_value_max()
def fast_read_adc0(self):
"""This reads the actual ADC value of channel 0, with as little overhead as possible.
Use with SPIDEV ONLY!!!!
returns: The ADC value as an n-bit integer value, with n=10 or 12 depending on the chip."""
dat = self._dev.xfer(self._control0)
value = (dat[1] << 8) + dat[2]
return value
@property
def values(self):
"""ADC values presented as a list."""
return self._values
@property
def volts(self):
"""ADC voltages presented as a list"""
return self._volts
@property
def accuracy(self):
"""The fractional voltage of the least significant bit. """
return self._Vref / float(self.get_value_max())
@property
def vref(self):
"""Reference voltage used by the chip. You need to set this. It defaults to 3.3V"""
return self._Vref
@vref.setter
def vref(self, vr):
self._Vref = vr
def main(argv):
"""Test code for the MCP320x driver. This assumes you are using a MCP3208
If no arguments are supplied, then use SPIdev for CE0 and read channel 0"""
if len(argv) < 3:
print("Args : ", argv)
cs_bar = 0
clk_pin = 1000000
mosi_pin = 0
miso_pin = 0
if len(argv) < 2:
channel = 0
else:
channel = int(argv[1])
elif len(argv) < 6:
print("Please supply: cs_bar_pin clk_pin mosi_pin miso_pin channel")
sys.exit(1)
else:
cs_bar = int(argv[1])
clk_pin = int(argv[2])
mosi_pin = int(argv[3])
miso_pin = int(argv[4])
channel = int(argv[5])
adc_chip = MCP320x(cs_bar, clk_pin, mosi_pin, miso_pin)
try:
while True:
value = adc_chip.read_adc(channel)
print("{:4d}".format(value))
time.sleep(0.1)
except KeyboardInterrupt:
sys.exit(0)
if __name__ == '__main__':
import sys
import time
main(sys.argv)
|
package org.laatusys.nobabylon.support;
import java.util.regex.Pattern;
public class ExcludeRegexpFilter implements Filter {
private final Pattern pattern;
public ExcludeRegexpFilter(String regexp, boolean caseSensitive) {
pattern = caseSensitive ? Pattern.compile(regexp) : Pattern.compile(regexp, Pattern.CASE_INSENSITIVE);
}
public ExcludeRegexpFilter(String regexp) {
this(regexp, false);
}
@Override
public boolean accept(String description) {
return !pattern.matcher(description).find();
}
}
|
#!/usr/bin/python
import sys
print "divsum_analysis.py DivsumFile NumberOfNucleotides"
try:
file = sys.argv[1]
except:
file = raw_input("Introduce RepeatMasker's Divsum file: ")
try:
nucs = sys.argv[2]
except:
nucs = raw_input("Introduce number of analysed nucleotides: ")
nucs = int(nucs)
data = open(file).readlines()
s_matrix = data.index("Coverage for each repeat class and divergence (Kimura)\n")
matrix = []
elements = data[s_matrix+1]
elements = elements.split()
for element in elements[1:]:
matrix.append([element,[]])
n_el = len(matrix)
for line in data[s_matrix+2:]:
# print line
info = line.split()
info = info[1:]
for n in range(0,n_el):
matrix[n][1].append(int(info[n]))
abs = open(file+".abs", "w")
rel = open(file+".rel", "w")
for n in range(0,n_el):
abs.write("%s\t%s\n" % (matrix[n][0], sum(matrix[n][1])))
rel.write("%s\t%s\n" % (matrix[n][0], round(1.0*sum(matrix[n][1])/nucs,100)))
|
package com.sk89q.craftbook.cart;
import java.util.ArrayList;
import java.util.Arrays;
import org.bukkit.block.Chest;
import org.bukkit.block.Sign;
import org.bukkit.entity.Minecart;
import org.bukkit.entity.StorageMinecart;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import com.sk89q.craftbook.util.RailUtil;
import com.sk89q.craftbook.util.RedstoneUtil.Power;
import com.sk89q.craftbook.util.RegexUtil;
public class CartDeposit extends CartMechanism {
@Override
public void impact(Minecart cart, CartMechanismBlocks blocks, boolean minor) {
// validate
if (cart == null) return;
// care?
if (minor) return;
if (!(cart instanceof StorageMinecart)) return;
Inventory cartinventory = ((StorageMinecart) cart).getInventory();
// enabled?
if (Power.OFF == isActive(blocks.rail, blocks.base, blocks.sign)) return;
// collect/deposit set?
if (blocks.sign == null) return;
if (!blocks.matches("collect") && !blocks.matches("deposit")) return;
boolean collecting = blocks.matches("collect");
// search for containers
ArrayList<Chest> containers = RailUtil.getNearbyChests(blocks.base);
// are there any containers?
if (containers.isEmpty()) return;
ArrayList<ItemStack> leftovers = new ArrayList<ItemStack>();
int itemID = -1;
byte itemData = -1;
try {
String[] splitLine = RegexUtil.COLON_PATTERN.split(((Sign) blocks.sign.getState()).getLine(2));
itemID = Integer.parseInt(splitLine[0]);
itemData = Byte.parseByte(splitLine[1]);
} catch (Exception ignored) {
}
if (collecting) {
// collecting
ArrayList<ItemStack> transferItems = new ArrayList<ItemStack>();
if (!((Sign) blocks.sign.getState()).getLine(2).isEmpty()) {
for (ItemStack item : cartinventory.getContents()) {
if (item == null) {
continue;
}
if (itemID < 0 || itemID == item.getTypeId()) {
if (itemData < 0 || itemData == item.getDurability()) {
transferItems.add(new ItemStack(item.getTypeId(), item.getAmount(), item.getDurability()));
cartinventory.remove(item);
}
}
}
} else {
transferItems.addAll(Arrays.asList(cartinventory.getContents()));
cartinventory.clear();
}
while (transferItems.remove(null)) {
}
// is cart non-empty?
if (transferItems.isEmpty()) return;
// System.out.println("collecting " + transferItems.size() + " item stacks");
// for (ItemStack stack: transferItems) System.out.println("collecting " + stack.getAmount() + " items of
// type " + stack.getType().toString());
for (Chest container : containers) {
if (transferItems.isEmpty()) {
break;
}
Inventory containerinventory = container.getInventory();
leftovers.addAll(containerinventory.addItem(transferItems.toArray(new ItemStack[transferItems.size()
])).values());
transferItems.clear();
transferItems.addAll(leftovers);
leftovers.clear();
container.update();
}
// System.out.println("collected items. " + transferItems.size() + " stacks left over.");
leftovers.addAll(cartinventory.addItem(transferItems.toArray(new ItemStack[transferItems.size()])).values
());
transferItems.clear();
transferItems.addAll(leftovers);
leftovers.clear();
// System.out.println("collection done. " + transferItems.size() + " stacks wouldn't fit back.");
} else {
// depositing
ArrayList<ItemStack> transferitems = new ArrayList<ItemStack>();
for (Chest container : containers) {
Inventory containerinventory = container.getInventory();
if (!((Sign) blocks.sign.getState()).getLine(2).isEmpty()) {
for (ItemStack item : containerinventory.getContents()) {
if (item == null) {
continue;
}
if (itemID < 0 || itemID == item.getTypeId())
if (itemData < 0 || itemData == item.getDurability()) {
transferitems.add(new ItemStack(item.getTypeId(), item.getAmount(),
item.getDurability()));
containerinventory.remove(item);
}
}
} else {
transferitems.addAll(Arrays.asList(containerinventory.getContents()));
containerinventory.clear();
}
container.update();
}
while (transferitems.remove(null)) {
}
// are chests empty?
if (transferitems.isEmpty()) return;
// System.out.println("depositing " + transferitems.size() + " stacks");
// for (ItemStack stack: transferitems) System.out.println("depositing " + stack.getAmount() + " items of
// type " + stack.getType().toString());
leftovers.addAll(cartinventory.addItem(transferitems.toArray(new ItemStack[transferitems.size()])).values
());
transferitems.clear();
transferitems.addAll(leftovers);
leftovers.clear();
// System.out.println("deposited, " + transferitems.size() + " items left over.");
for (Chest container : containers) {
if (transferitems.isEmpty()) {
break;
}
Inventory containerinventory = container.getInventory();
leftovers.addAll(containerinventory.addItem(transferitems.toArray(new ItemStack[transferitems.size()
])).values());
transferitems.clear();
transferitems.addAll(leftovers);
leftovers.clear();
}
// System.out.println("deposit done. " + transferitems.size() + " items wouldn't fit back.");
}
}
@Override
public String getName() {
return "Deposit";
}
@Override
public String[] getApplicableSigns() {
return new String[] {"Collect", "Deposit"};
}
}
|
<?php
// Moodle is free software: you can redistribute it and/or modify
// (at your option) any later version.
// Moodle is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$string['activityoverview'] = 'You have {$a}s that need attention';
$string['alwaysshowall'] = 'Always show all';
$string['collapseall'] = 'Collapse all course lists';
$string['configotherexpanded'] = 'If enabled, other courses will be expanded by default unless overriden by user preferences.';
$string['<API key>'] = 'If enabled, the collapsed/expanded states set by the user are stored and used on each load.';
$string['course_overview:addinstance'] = 'Add a new course overview block';
$string['course_overview:myaddinstance'] = 'Add a new course overview block to My home';
$string['defaultmaxcourses'] = 'Default maximum courses';
$string['<API key>'] = 'Maximum courses which should be displayed on course overview block, 0 will show all courses';
$string['expandall'] = 'Expand all course lists';
$string['<API key>'] = 'Force maximum courses';
$string['<API key>'] = 'If set then user will not be able to change his/her personal setting';
$string['hiddencoursecount'] = 'You have {$a} hidden course';
$string['<API key>'] = 'You have {$a} hidden courses';
$string['<API key>'] = 'You have {$a->coursecount} hidden course ({$a->showalllink})';
$string['<API key>'] = 'You have {$a->coursecount} hidden courses ({$a->showalllink})';
$string['message'] = 'message';
$string['messages'] = 'messages';
$string['movecourse'] = 'Move course: {$a}';
$string['movecoursehere'] = 'Move course here';
$string['movetofirst'] = 'Move {$a} course to top';
$string['moveafterhere'] = 'Move {$a->movingcoursename} course after {$a->currentcoursename}';
$string['movingcourse'] = 'You are moving: {$a->fullname} ({$a->cancellink})';
$string['numtodisplay'] = 'Number of courses to display: ';
$string['otherexpanded'] = 'Other courses expanded';
$string['pluginname'] = 'Assigned Courses';
$string['preservestates'] = 'Preserve expanded states';
$string['shortnameprefix'] = 'Includes {$a}';
$string['<API key>'] = ' (and {$a} other)';
$string['<API key>'] = ' (and {$a} others)';
$string['showchildren'] = 'Show children';
$string['showchildrendesc'] = 'Should child courses be listed underneath the main course title?';
$string['showwelcomearea'] = 'Show welcome area';
$string['showwelcomeareadesc'] = 'Show the welcome area above the course list?';
$string['view_edit_profile'] = '(View and edit your profile.)';
$string['welcome'] = 'Welcome {$a}';
$string['youhavemessages'] = 'You have {$a} unread ';
$string['youhavenomessages'] = 'You have no unread ';
|
// <API key>.h
// Auther:
// ned rihine <ned.rihine@gmail.com>
// 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
#ifndef <API key>
#define <API key>
#include "coreHezelnut/classes/<API key>.h"
CHN_EXTERN_C_BEGIN
CHN_EXTERN_C_END
#endif /* <API key> */
// Local Variables:
// coding: utf-8
// End:
|
<?php
session_start();
include("../connect.php");
include("../function.php");
//session_start();
if($_REQUEST['cat_id'])
{
$data="";
$count=0;
$select_list_data="select * from users_data where int_fid in(".$_REQUEST['cat_id'].") and int_del_status='0'";
$result_list_data=mysql_query($select_list_data) or die(mysql_error());
$data.="<br>";
$data.="<table style='width: 270px;' id='alternatecolor' class='altrowstable1' >";
while($fetch_list_data=mysql_fetch_array($result_list_data))
{ $count++;
$imgsrc="../".$fetch_list_data['txt_real_path'];
$data.="<tr >";
$data.="<td style='padding-left:5px;'>";
$data.="<div style='width:240px;overflow:hidden;'>".$fetch_list_data['txt_file_name']."</div>";
$data.="</td>";
$data.="<td >";
$data.="<img src='images/play-icon.png' style='cursor:pointer;' title='Play Item' onclick='go(\"$imgsrc\");'>";
$data.="</td>";
$data.="</tr>";
//$main_data="<a href='javascript:load_data(\"".$fetch_list_data['txt_file_name']."\");'>".$fetch_list_data['txt_file_name']."</a>";
//$data=$data.$main_data;
//$data.="</br></br>";
}
$data.="</table>";
echo $data;
}
?>
|
package eu.crisis_economics.abm.markets.nonclearing;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.<API key>;
import java.util.Set;
import eu.crisis_economics.abm.markets.Party;
import eu.crisis_economics.abm.markets.nonclearing.DefaultFilters.Filter;
/**
* Represents relationships between banks in the interbank market
*
* @author Victor Spirin
*/
public class InterbankNetwork {
private final Map<Party, Set<Party>> adj = new HashMap<Party, Set<Party>>();
/**
* Adds a new node to the graph. If the node already exists, this
* function is a no-op.
*
* @param node The node to add.
* @return Whether or not the node was added.
*/
private boolean addNode(Party node) {
/* If the node already exists, don't do anything. */
if (adj.containsKey(node))
return false;
/* Otherwise, add the node with an empty set of outgoing edges. */
adj.put(node, new HashSet<Party>());
return true;
}
// protected
/**
* Generates a filter from the network. This allows the network class to be used
* with a Limit Order Book.
*
* @param a Bank, for which we want to generate a filter
* @return Returns a Limit Order Book filter for the given bank. If the bank is not in the network, returns an empty filter.
*/
protected Filter generateFilter(Party party) {
if (!adj.containsKey(party))
return DefaultFilters.only(party);
return DefaultFilters.only((Party[]) adj.get(party).toArray());
}
// public interface
/**
* Adds a bilateral relationship between banks 'a' and 'b'.
* If the banks are not already in the network, also adds them to the network.
*
* @param a Bank a
* @param b Bank b
*/
public void addRelationship(Party a, Party b) {
/* Confirm both endpoints exist. */
if (!adj.containsKey(a))
addNode(a);
if (!adj.containsKey(b))
addNode(b);
/* Add the edge in both directions. */
adj.get(a).add(b);
adj.get(b).add(a);
}
/**
* Removes a bilateral relationship between banks 'a' and 'b'.
* If the banks are not already in the network, throws a <API key>
*
* @param a Bank a
* @param b Bank b
*/
public void removeRelationship(Party a, Party b) {
/* Confirm both endpoints exist. */
if (!adj.containsKey(a) || !adj.containsKey(b))
throw new <API key>("Both banks must be in the network.");
/* Remove the edges from both adjacency lists. */
adj.get(a).remove(b);
adj.get(b).remove(a);
}
/**
* Returns true if there is a bilateral relationship between banks 'a' and 'b'.
* If the banks are not already in the network, throws a <API key>
*
* @param a Bank a
* @param b Bank b
* @return Returns true if there is a relationship between banks 'a' and 'b'
*/
public boolean isRelated(Party a, Party b) {
/* Confirm both endpoints exist. */
if (!adj.containsKey(a) || !adj.containsKey(b))
throw new <API key>("Both banks must be in the network.");
/* Network is symmetric, so we can just check either endpoint. */
return adj.get(a).contains(b);
}
}
|
{-# LANGUAGE OverloadedStrings #-}
module Response.Export
(pdfResponse) where
import Happstack.Server
import qualified Data.ByteString.Lazy as BS
import Control.Monad.IO.Class (liftIO)
import qualified Data.ByteString.Base64.Lazy as BEnc
import ImageConversion
import <API key> (renderTable)
import System.Random
import Latex
-- | Returns a PDF containing the image of the timetable
-- requested by the user.
pdfResponse :: String -> String -> ServerPart Response
pdfResponse courses session =
liftIO $ getPdf courses session
getPdf :: String -> String -> IO Response
getPdf courses session = do
gen <- newStdGen
let (rand, _) = next gen
svgFilename = (show rand ++ ".svg")
imageFilename = (show rand ++ ".png")
texFilename = (show rand ++ ".tex")
pdfFilename = (drop 4 texFilename) ++ ".pdf"
renderTable svgFilename courses session
returnPdfData svgFilename imageFilename pdfFilename texFilename
returnPdfData :: String -> String -> String -> String -> IO Response
returnPdfData svgFilename imageFilename pdfFilename texFilename = do
createImageFile svgFilename imageFilename
compileTex texFilename imageFilename
_ <- compileTexToPdf texFilename
pdfData <- BS.readFile texFilename
_ <- removeImage svgFilename
_ <- removeImage imageFilename
_ <- removeImage pdfFilename
_ <- removeImage texFilename
let encodedData = BEnc.encode pdfData
return $ toResponse encodedData
|
<?php
# server running the wolframe daemon
$WOLFRAME_SERVER = "localhost";
# wolframe daemon port
$WOLFRAME_PORT = 7962;
# for SSL secured communication, a file with combined client certificate
# and client key
$<API key> = "certs/combinedcert.pem";
# which user agents should use client XSLT
$<API key> = array(
# "op12", "ie8", "ie9", "ie10", "moz23", "webkit27", "webkit28", "moz11"
);
|
package main
import (
"fmt"
"math/rand"
)
func main() {
fmt.Println(rand.Int())
fmt.Println(rand.Float64())
}
|
package mcid.anubisset.letsmodreboot.block;
import mcid.anubisset.letsmodreboot.creativetab.CreativeTabLMRB;
public class BlockFlag extends BlockLMRB
{
public BlockFlag()
{
super();
this.setBlockName("flag");
this.setBlockTextureName("flag");
}
}
|
require 'package'
class Libxau < Package
description 'xau library for libX11'
homepage 'https://x.org'
version '1.0.8'
source_url 'https:
source_sha256 '<SHA256-like>'
depends_on 'xproto'
def self.build
system "./configure"
system "make"
end
def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
end
end
|
#include "config.h"
#include "syshead.h"
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <setjmp.h>
#include <cmocka.h>
#include <assert.h>
#include "argv.h"
#include "buffer.h"
/* Defines for use in the tests and the mock parse_line() */
#define PATH1 "/s p a c e"
#define PATH2 "/foo bar/baz"
#define PARAM1 "param1"
#define PARAM2 "param two"
#define SCRIPT_CMD "\"" PATH1 PATH2 "\"" PARAM1 "\"" PARAM2 "\""
int
__wrap_parse_line(const char *line, char **p, const int n, const char *file,
const int line_num, int msglevel, struct gc_arena *gc)
{
p[0] = PATH1 PATH2;
p[1] = PARAM1;
p[2] = PARAM2;
return 3;
}
static void
<API key>(void **state)
{
struct argv a = argv_new();
argv_printf(&a, " %s %s %d ", PATH1, PATH2, 42);
assert_int_equal(a.argc, 3);
argv_reset(&a);
}
static void
<API key>(void **state)
{
struct argv a = argv_new();
argv_printf(&a, "%s ", PATH1);
argv_printf_cat(&a, " %s %s", PATH2, PARAM1);
assert_int_equal(a.argc, 3);
argv_reset(&a);
}
static void
<API key>(void **state)
{
struct argv a = argv_new();
argv_printf(&a, "%s%sc", PATH1, PATH2);
assert_int_equal(a.argc, 1);
argv_printf(&a, "%s%sc %d", PATH1, PATH2, 42);
assert_int_equal(a.argc, 2);
argv_printf(&a, "foo %s%sc %s x y", PATH2, PATH1, "foo");
assert_int_equal(a.argc, 5);
argv_reset(&a);
}
static void
<API key>(void **state)
{
struct argv a = argv_new();
argv_parse_cmd(&a, SCRIPT_CMD);
assert_int_equal(a.argc, 3);
argv_reset(&a);
}
static void
<API key>(void **state)
{
struct argv a = argv_new();
argv_parse_cmd(&a, SCRIPT_CMD);
argv_printf_cat(&a, "bar baz %d %s", 42, PATH1);
assert_int_equal(a.argc, 7);
argv_reset(&a);
}
static void
<API key>(void **state)
{
struct argv a = argv_new();
argv_printf(&a, "%s %s %s", PATH1, PATH2, PARAM1);
argv_printf_cat(&a, "%s", PARAM2);
argv_printf_cat(&a, "foo");
assert_int_equal(a.argc, 5);
argv_reset(&a);
}
static void
<API key>(void **state)
{
struct argv a = argv_new();
struct gc_arena gc = gc_new();
const char *output;
argv_printf(&a, "%s%sc", PATH1, PATH2);
argv_printf_cat(&a, "%s", PARAM1);
argv_printf_cat(&a, "%s", PARAM2);
output = argv_str(&a, &gc, PA_BRACKET);
assert_string_equal(output, "[" PATH1 PATH2 "] [" PARAM1 "] [" PARAM2 "]");
argv_reset(&a);
gc_free(&gc);
}
static void
<API key>(void **state)
{
struct argv a = argv_new();
struct argv b;
b = argv_insert_head(&a, PATH1);
assert_int_equal(b.argc, 1);
assert_string_equal(b.argv[0], PATH1);
argv_reset(&b);
argv_reset(&a);
}
static void
<API key>(void **state)
{
struct argv a = argv_new();
struct argv b;
int i;
argv_printf(&a, "%s", PATH2);
b = argv_insert_head(&a, PATH1);
assert_int_equal(b.argc, a.argc + 1);
for (i = 0; i < b.argc; i++) {
if (i == 0)
{
assert_string_equal(b.argv[i], PATH1);
}
else
{
assert_string_equal(b.argv[i], a.argv[i - 1]);
}
}
argv_reset(&b);
argv_reset(&a);
}
int
main(void)
{
const struct CMUnitTest tests[] = {
cmocka_unit_test(<API key>),
cmocka_unit_test(<API key>),
cmocka_unit_test(<API key>),
cmocka_unit_test(<API key>),
cmocka_unit_test(<API key>),
cmocka_unit_test(<API key>),
cmocka_unit_test(<API key>),
cmocka_unit_test(<API key>),
};
return <API key>("argv", tests, NULL, NULL);
}
|
#!/bin/sh -xe
if [ "$1" = "ci" ]; then
armloc=$(brew fetch --bottle-tag=arm64_big_sur libomp | grep -i downloaded | grep tar.gz | cut -f2 -d:)
x64loc=$(brew fetch --bottle-tag=big_sur libomp | grep -i downloaded | grep tar.gz | cut -f2 -d:)
cp $armloc /tmp/libomp-arm64.tar.gz
mkdir /tmp/libomp-arm64 || true
tar -xzvf /tmp/libomp-arm64.tar.gz -C /tmp/libomp-arm64
cp $x64loc /tmp/libomp-x86_64.tar.gz
mkdir /tmp/libomp-x86_64 || true
tar -xzvf /tmp/libomp-x86_64.tar.gz -C /tmp/libomp-x86_64
else
brew install libomp
fi
git submodule update --init extlib/cairo extlib/freetype extlib/libdxfrw extlib/libpng extlib/mimalloc extlib/pixman extlib/zlib extlib/eigen
|
#include "includes.h"
#include "librpc/gen_ndr/libnetapi.h"
#include "lib/netapi/netapi.h"
#include "lib/netapi/netapi_private.h"
#include "lib/netapi/libnetapi.h"
#include "rpc_client/rpc_client.h"
#include "../librpc/gen_ndr/ndr_samr_c.h"
#include "../librpc/gen_ndr/ndr_lsa_c.h"
#include "rpc_client/cli_lsarpc.h"
#include "rpc_client/init_lsa.h"
#include "../libcli/security/security.h"
static NTSTATUS <API key>(TALLOC_CTX *mem_ctx,
struct rpc_pipe_client *pipe_cli,
struct policy_handle *domain_handle,
const char *group_name,
uint32_t access_rights,
struct policy_handle *alias_handle)
{
NTSTATUS status, result;
struct lsa_String lsa_account_name;
struct samr_Ids user_rids, name_types;
struct <API key> *b = pipe_cli->binding_handle;
init_lsa_String(&lsa_account_name, group_name);
status = <API key>(b, mem_ctx,
domain_handle,
1,
&lsa_account_name,
&user_rids,
&name_types,
&result);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
if (!NT_STATUS_IS_OK(result)) {
return result;
}
if (user_rids.count != 1) {
return <API key>;
}
if (name_types.count != 1) {
return <API key>;
}
switch (name_types.ids[0]) {
case SID_NAME_ALIAS:
case SID_NAME_WKN_GRP:
break;
default:
return <API key>;
}
status = <API key>(b, mem_ctx,
domain_handle,
access_rights,
user_rids.ids[0],
alias_handle,
&result);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
return result;
}
static NTSTATUS <API key>(TALLOC_CTX *mem_ctx,
struct rpc_pipe_client *pipe_cli,
struct policy_handle *handle,
uint32_t rid,
uint32_t access_rights,
enum samr_AliasInfoEnum level,
union samr_AliasInfo **alias_info)
{
NTSTATUS status, result;
struct policy_handle alias_handle;
union samr_AliasInfo *_alias_info = NULL;
struct <API key> *b = pipe_cli->binding_handle;
ZERO_STRUCT(alias_handle);
status = <API key>(b, mem_ctx,
handle,
access_rights,
rid,
&alias_handle,
&result);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
if (!NT_STATUS_IS_OK(result)) {
status = result;
goto done;
}
status = <API key>(b, mem_ctx,
&alias_handle,
level,
&_alias_info,
&result);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
if (!NT_STATUS_IS_OK(result)) {
status = result;
goto done;
}
*alias_info = _alias_info;
done:
if (is_valid_policy_hnd(&alias_handle)) {
dcerpc_samr_Close(b, mem_ctx, &alias_handle, &result);
}
return status;
}
WERROR NetLocalGroupAdd_r(struct libnetapi_ctx *ctx,
struct NetLocalGroupAdd *r)
{
struct rpc_pipe_client *pipe_cli = NULL;
NTSTATUS status, result;
WERROR werr;
struct lsa_String lsa_account_name;
struct policy_handle connect_handle, domain_handle, builtin_handle, alias_handle;
struct dom_sid2 *domain_sid = NULL;
uint32_t rid;
struct <API key> *b = NULL;
struct LOCALGROUP_INFO_0 *info0 = NULL;
struct LOCALGROUP_INFO_1 *info1 = NULL;
const char *alias_name = NULL;
if (!r->in.buffer) {
return WERR_INVALID_PARAM;
}
ZERO_STRUCT(connect_handle);
ZERO_STRUCT(builtin_handle);
ZERO_STRUCT(domain_handle);
ZERO_STRUCT(alias_handle);
switch (r->in.level) {
case 0:
info0 = (struct LOCALGROUP_INFO_0 *)r->in.buffer;
alias_name = info0->lgrpi0_name;
break;
case 1:
info1 = (struct LOCALGROUP_INFO_1 *)r->in.buffer;
alias_name = info1->lgrpi1_name;
break;
default:
werr = WERR_UNKNOWN_LEVEL;
goto done;
}
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_samr.syntax_id,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
}
b = pipe_cli->binding_handle;
werr = <API key>(ctx, pipe_cli,
<API key> |
<API key>,
<API key>,
&connect_handle,
&builtin_handle);
if (!W_ERROR_IS_OK(werr)) {
goto done;
}
status = <API key>(ctx, pipe_cli,
&builtin_handle,
alias_name,
<API key>,
&alias_handle);
if (ctx-><API key>) {
<API key>(ctx, &builtin_handle);
}
if (NT_STATUS_IS_OK(status)) {
werr = WERR_ALIAS_EXISTS;
goto done;
}
werr = <API key>(ctx, pipe_cli,
<API key> |
<API key>,
<API key> |
<API key>,
&connect_handle,
&domain_handle,
&domain_sid);
if (!W_ERROR_IS_OK(werr)) {
goto done;
}
init_lsa_String(&lsa_account_name, alias_name);
status = <API key>(b, talloc_tos(),
&domain_handle,
&lsa_account_name,
SEC_STD_DELETE |
<API key>,
&alias_handle,
&rid,
&result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
if (!NT_STATUS_IS_OK(result)) {
werr = ntstatus_to_werror(result);
goto done;
}
if (r->in.level == 1 && info1->lgrpi1_comment) {
union samr_AliasInfo alias_info;
init_lsa_String(&alias_info.description, info1->lgrpi1_comment);
status = <API key>(b, talloc_tos(),
&alias_handle,
<API key>,
&alias_info,
&result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
if (!NT_STATUS_IS_OK(result)) {
werr = ntstatus_to_werror(result);
goto done;
}
}
werr = WERR_OK;
done:
if (is_valid_policy_hnd(&alias_handle)) {
dcerpc_samr_Close(b, talloc_tos(), &alias_handle, &result);
}
if (ctx-><API key>) {
<API key>(ctx, &domain_handle);
<API key>(ctx, &builtin_handle);
<API key>(ctx, &connect_handle);
}
return werr;
}
WERROR NetLocalGroupAdd_l(struct libnetapi_ctx *ctx,
struct NetLocalGroupAdd *r)
{
<API key>(ctx, r, NetLocalGroupAdd);
}
WERROR NetLocalGroupDel_r(struct libnetapi_ctx *ctx,
struct NetLocalGroupDel *r)
{
struct rpc_pipe_client *pipe_cli = NULL;
NTSTATUS status, result;
WERROR werr;
struct policy_handle connect_handle, domain_handle, builtin_handle, alias_handle;
struct dom_sid2 *domain_sid = NULL;
struct <API key> *b = NULL;
if (!r->in.group_name) {
return WERR_INVALID_PARAM;
}
ZERO_STRUCT(connect_handle);
ZERO_STRUCT(builtin_handle);
ZERO_STRUCT(domain_handle);
ZERO_STRUCT(alias_handle);
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_samr.syntax_id,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
}
b = pipe_cli->binding_handle;
werr = <API key>(ctx, pipe_cli,
<API key> |
<API key>,
<API key>,
&connect_handle,
&builtin_handle);
if (!W_ERROR_IS_OK(werr)) {
goto done;
}
status = <API key>(ctx, pipe_cli,
&builtin_handle,
r->in.group_name,
SEC_STD_DELETE,
&alias_handle);
if (ctx-><API key>) {
<API key>(ctx, &builtin_handle);
}
if (NT_STATUS_IS_OK(status)) {
goto delete_alias;
}
werr = <API key>(ctx, pipe_cli,
<API key> |
<API key>,
<API key> |
<API key>,
&connect_handle,
&domain_handle,
&domain_sid);
if (!W_ERROR_IS_OK(werr)) {
goto done;
}
status = <API key>(ctx, pipe_cli,
&domain_handle,
r->in.group_name,
SEC_STD_DELETE,
&alias_handle);
if (ctx-><API key>) {
<API key>(ctx, &domain_handle);
}
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
delete_alias:
status = <API key>(b, talloc_tos(),
&alias_handle,
&result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
if (!NT_STATUS_IS_OK(result)) {
werr = ntstatus_to_werror(result);
goto done;
}
ZERO_STRUCT(alias_handle);
werr = WERR_OK;
done:
if (is_valid_policy_hnd(&alias_handle)) {
dcerpc_samr_Close(b, talloc_tos(), &alias_handle, &result);
}
if (ctx-><API key>) {
<API key>(ctx, &domain_handle);
<API key>(ctx, &builtin_handle);
<API key>(ctx, &connect_handle);
}
return werr;
}
WERROR NetLocalGroupDel_l(struct libnetapi_ctx *ctx,
struct NetLocalGroupDel *r)
{
<API key>(ctx, r, NetLocalGroupDel);
}
static WERROR <API key>(TALLOC_CTX *mem_ctx,
const char *alias_name,
struct samr_AliasInfoAll *info,
uint32_t level,
uint32_t *entries_read,
uint8_t **buffer)
{
struct LOCALGROUP_INFO_0 g0;
struct LOCALGROUP_INFO_1 g1;
struct <API key> g1002;
switch (level) {
case 0:
g0.lgrpi0_name = talloc_strdup(mem_ctx, alias_name);
<API key>(g0.lgrpi0_name);
ADD_TO_ARRAY(mem_ctx, struct LOCALGROUP_INFO_0, g0,
(struct LOCALGROUP_INFO_0 **)buffer, entries_read);
break;
case 1:
g1.lgrpi1_name = talloc_strdup(mem_ctx, alias_name);
g1.lgrpi1_comment = talloc_strdup(mem_ctx, info->description.string);
<API key>(g1.lgrpi1_name);
ADD_TO_ARRAY(mem_ctx, struct LOCALGROUP_INFO_1, g1,
(struct LOCALGROUP_INFO_1 **)buffer, entries_read);
break;
case 1002:
g1002.lgrpi1002_comment = talloc_strdup(mem_ctx, info->description.string);
ADD_TO_ARRAY(mem_ctx, struct <API key>, g1002,
(struct <API key> **)buffer, entries_read);
break;
default:
return WERR_UNKNOWN_LEVEL;
}
return WERR_OK;
}
WERROR <API key>(struct libnetapi_ctx *ctx,
struct <API key> *r)
{
struct rpc_pipe_client *pipe_cli = NULL;
NTSTATUS status, result;
WERROR werr;
struct policy_handle connect_handle, domain_handle, builtin_handle, alias_handle;
struct dom_sid2 *domain_sid = NULL;
union samr_AliasInfo *alias_info = NULL;
uint32_t entries_read = 0;
struct <API key> *b = NULL;
if (!r->in.group_name) {
return WERR_INVALID_PARAM;
}
switch (r->in.level) {
case 0:
case 1:
case 1002:
break;
default:
return WERR_UNKNOWN_LEVEL;
}
ZERO_STRUCT(connect_handle);
ZERO_STRUCT(builtin_handle);
ZERO_STRUCT(domain_handle);
ZERO_STRUCT(alias_handle);
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_samr.syntax_id,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
}
b = pipe_cli->binding_handle;
werr = <API key>(ctx, pipe_cli,
<API key> |
<API key>,
<API key>,
&connect_handle,
&builtin_handle);
if (!W_ERROR_IS_OK(werr)) {
goto done;
}
status = <API key>(ctx, pipe_cli,
&builtin_handle,
r->in.group_name,
<API key>,
&alias_handle);
if (ctx-><API key>) {
<API key>(ctx, &builtin_handle);
}
if (NT_STATUS_IS_OK(status)) {
goto query_alias;
}
werr = <API key>(ctx, pipe_cli,
<API key> |
<API key>,
<API key> |
<API key>,
&connect_handle,
&domain_handle,
&domain_sid);
if (!W_ERROR_IS_OK(werr)) {
goto done;
}
status = <API key>(ctx, pipe_cli,
&domain_handle,
r->in.group_name,
<API key>,
&alias_handle);
if (ctx-><API key>) {
<API key>(ctx, &domain_handle);
}
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
query_alias:
status = <API key>(b, talloc_tos(),
&alias_handle,
ALIASINFOALL,
&alias_info,
&result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
if (!NT_STATUS_IS_OK(result)) {
werr = ntstatus_to_werror(result);
goto done;
}
werr = <API key>(ctx,
r->in.group_name,
&alias_info->all,
r->in.level, &entries_read,
r->out.buffer);
done:
if (is_valid_policy_hnd(&alias_handle)) {
dcerpc_samr_Close(b, talloc_tos(), &alias_handle, &result);
}
if (ctx-><API key>) {
<API key>(ctx, &domain_handle);
<API key>(ctx, &builtin_handle);
<API key>(ctx, &connect_handle);
}
return werr;
}
WERROR <API key>(struct libnetapi_ctx *ctx,
struct <API key> *r)
{
<API key>(ctx, r, <API key>);
}
static WERROR <API key>(TALLOC_CTX *mem_ctx,
uint32_t level,
uint8_t *buffer,
enum samr_AliasInfoEnum *alias_level,
union samr_AliasInfo **alias_info)
{
struct LOCALGROUP_INFO_0 *info0;
struct LOCALGROUP_INFO_1 *info1;
struct <API key> *info1002;
union samr_AliasInfo *info = NULL;
info = talloc_zero(mem_ctx, union samr_AliasInfo);
<API key>(info);
switch (level) {
case 0:
info0 = (struct LOCALGROUP_INFO_0 *)buffer;
init_lsa_String(&info->name, info0->lgrpi0_name);
*alias_level = ALIASINFONAME;
break;
case 1:
info1 = (struct LOCALGROUP_INFO_1 *)buffer;
/* group name will be ignored */
init_lsa_String(&info->description, info1->lgrpi1_comment);
*alias_level = <API key>;
break;
case 1002:
info1002 = (struct <API key> *)buffer;
init_lsa_String(&info->description, info1002->lgrpi1002_comment);
*alias_level = <API key>;
break;
}
*alias_info = info;
return WERR_OK;
}
WERROR <API key>(struct libnetapi_ctx *ctx,
struct <API key> *r)
{
struct rpc_pipe_client *pipe_cli = NULL;
NTSTATUS status, result;
WERROR werr;
struct lsa_String lsa_account_name;
struct policy_handle connect_handle, domain_handle, builtin_handle, alias_handle;
struct dom_sid2 *domain_sid = NULL;
enum samr_AliasInfoEnum alias_level = 0;
union samr_AliasInfo *alias_info = NULL;
struct <API key> *b = NULL;
if (!r->in.group_name) {
return WERR_INVALID_PARAM;
}
switch (r->in.level) {
case 0:
case 1:
case 1002:
break;
default:
return WERR_UNKNOWN_LEVEL;
}
ZERO_STRUCT(connect_handle);
ZERO_STRUCT(builtin_handle);
ZERO_STRUCT(domain_handle);
ZERO_STRUCT(alias_handle);
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_samr.syntax_id,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
}
b = pipe_cli->binding_handle;
werr = <API key>(ctx, pipe_cli,
<API key> |
<API key>,
<API key>,
&connect_handle,
&builtin_handle);
if (!W_ERROR_IS_OK(werr)) {
goto done;
}
init_lsa_String(&lsa_account_name, r->in.group_name);
status = <API key>(ctx, pipe_cli,
&builtin_handle,
r->in.group_name,
<API key>,
&alias_handle);
if (ctx-><API key>) {
<API key>(ctx, &builtin_handle);
}
if (NT_STATUS_IS_OK(status)) {
goto set_alias;
}
werr = <API key>(ctx, pipe_cli,
<API key> |
<API key>,
<API key>,
&connect_handle,
&domain_handle,
&domain_sid);
if (!W_ERROR_IS_OK(werr)) {
goto done;
}
status = <API key>(ctx, pipe_cli,
&domain_handle,
r->in.group_name,
<API key>,
&alias_handle);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
if (ctx-><API key>) {
<API key>(ctx, &domain_handle);
}
set_alias:
werr = <API key>(ctx, r->in.level, r->in.buffer,
&alias_level, &alias_info);
if (!W_ERROR_IS_OK(werr)) {
goto done;
}
status = <API key>(b, talloc_tos(),
&alias_handle,
alias_level,
alias_info,
&result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
if (!NT_STATUS_IS_OK(result)) {
werr = ntstatus_to_werror(result);
goto done;
}
werr = WERR_OK;
done:
if (is_valid_policy_hnd(&alias_handle)) {
dcerpc_samr_Close(b, talloc_tos(), &alias_handle, &result);
}
if (ctx-><API key>) {
<API key>(ctx, &domain_handle);
<API key>(ctx, &builtin_handle);
<API key>(ctx, &connect_handle);
}
return werr;
}
WERROR <API key>(struct libnetapi_ctx *ctx,
struct <API key> *r)
{
<API key>(ctx, r, <API key>);
}
WERROR NetLocalGroupEnum_r(struct libnetapi_ctx *ctx,
struct NetLocalGroupEnum *r)
{
struct rpc_pipe_client *pipe_cli = NULL;
NTSTATUS status, result;
WERROR werr;
struct policy_handle connect_handle, domain_handle, builtin_handle, alias_handle;
struct dom_sid2 *domain_sid = NULL;
uint32_t entries_read = 0;
union samr_DomainInfo *domain_info = NULL;
union samr_DomainInfo *builtin_info = NULL;
struct samr_SamArray *domain_sam_array = NULL;
struct samr_SamArray *builtin_sam_array = NULL;
int i;
struct <API key> *b = NULL;
if (!r->out.buffer) {
return WERR_INVALID_PARAM;
}
switch (r->in.level) {
case 0:
case 1:
break;
default:
return WERR_UNKNOWN_LEVEL;
}
if (r->out.total_entries) {
*r->out.total_entries = 0;
}
if (r->out.entries_read) {
*r->out.entries_read = 0;
}
ZERO_STRUCT(connect_handle);
ZERO_STRUCT(builtin_handle);
ZERO_STRUCT(domain_handle);
ZERO_STRUCT(alias_handle);
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_samr.syntax_id,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
}
b = pipe_cli->binding_handle;
werr = <API key>(ctx, pipe_cli,
<API key> |
<API key>,
<API key> |
<API key> |
<API key>,
&connect_handle,
&builtin_handle);
if (!W_ERROR_IS_OK(werr)) {
goto done;
}
werr = <API key>(ctx, pipe_cli,
<API key> |
<API key>,
<API key> |
<API key> |
<API key>,
&connect_handle,
&domain_handle,
&domain_sid);
if (!W_ERROR_IS_OK(werr)) {
goto done;
}
status = <API key>(b, talloc_tos(),
&builtin_handle,
2,
&builtin_info,
&result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
if (!NT_STATUS_IS_OK(result)) {
werr = ntstatus_to_werror(result);
goto done;
}
if (r->out.total_entries) {
*r->out.total_entries += builtin_info->general.num_aliases;
}
status = <API key>(b, talloc_tos(),
&domain_handle,
2,
&domain_info,
&result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
if (!NT_STATUS_IS_OK(result)) {
werr = ntstatus_to_werror(result);
goto done;
}
if (r->out.total_entries) {
*r->out.total_entries += domain_info->general.num_aliases;
}
status = <API key>(b, talloc_tos(),
&builtin_handle,
r->in.resume_handle,
&builtin_sam_array,
r->in.prefmaxlen,
&entries_read,
&result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
if (!NT_STATUS_IS_OK(result)) {
werr = ntstatus_to_werror(result);
goto done;
}
for (i=0; i<builtin_sam_array->count; i++) {
union samr_AliasInfo *alias_info = NULL;
if (r->in.level == 1) {
status = <API key>(ctx, pipe_cli,
&builtin_handle,
builtin_sam_array->entries[i].idx,
<API key>,
ALIASINFOALL,
&alias_info);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
}
werr = <API key>(ctx,
builtin_sam_array->entries[i].name.string,
alias_info ? &alias_info->all : NULL,
r->in.level,
r->out.entries_read,
r->out.buffer);
}
status = <API key>(b, talloc_tos(),
&domain_handle,
r->in.resume_handle,
&domain_sam_array,
r->in.prefmaxlen,
&entries_read,
&result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
if (!NT_STATUS_IS_OK(result)) {
werr = ntstatus_to_werror(result);
goto done;
}
for (i=0; i<domain_sam_array->count; i++) {
union samr_AliasInfo *alias_info = NULL;
if (r->in.level == 1) {
status = <API key>(ctx, pipe_cli,
&domain_handle,
domain_sam_array->entries[i].idx,
<API key>,
ALIASINFOALL,
&alias_info);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
}
werr = <API key>(ctx,
domain_sam_array->entries[i].name.string,
alias_info ? &alias_info->all : NULL,
r->in.level,
r->out.entries_read,
r->out.buffer);
}
done:
if (ctx-><API key>) {
<API key>(ctx, &domain_handle);
<API key>(ctx, &builtin_handle);
<API key>(ctx, &connect_handle);
}
return werr;
}
WERROR NetLocalGroupEnum_l(struct libnetapi_ctx *ctx,
struct NetLocalGroupEnum *r)
{
<API key>(ctx, r, NetLocalGroupEnum);
}
static NTSTATUS <API key>(TALLOC_CTX *mem_ctx,
struct rpc_pipe_client *lsa_pipe,
const char *name,
struct dom_sid *sid)
{
NTSTATUS status, result;
struct policy_handle lsa_handle;
struct <API key> *b = lsa_pipe->binding_handle;
struct lsa_RefDomainList *domains = NULL;
struct lsa_TransSidArray3 sids;
uint32_t count = 0;
struct lsa_String names;
uint32_t num_names = 1;
if (!sid || !name) {
return <API key>;
}
ZERO_STRUCT(sids);
init_lsa_String(&names, name);
status = <API key>(lsa_pipe, mem_ctx,
false,
<API key> |
<API key> |
<API key>,
&lsa_handle);
<API key>(status);
status = <API key>(b, mem_ctx,
&lsa_handle,
num_names,
&names,
&domains,
&sids,
<API key>, /* sure ? */
&count,
0, 0,
&result);
<API key>(status);
<API key>(result);
if (count != 1 || sids.count != 1) {
return <API key>;
}
sid_copy(sid, sids.sids[0].sid);
return NT_STATUS_OK;
}
static WERROR <API key>(struct libnetapi_ctx *ctx,
struct <API key> *add,
struct <API key> *del,
struct <API key> *set)
{
struct <API key> *r = NULL;
struct rpc_pipe_client *pipe_cli = NULL;
struct rpc_pipe_client *lsa_pipe = NULL;
NTSTATUS status, result;
WERROR werr;
struct lsa_String lsa_account_name;
struct policy_handle connect_handle, domain_handle, builtin_handle, alias_handle;
struct dom_sid2 *domain_sid = NULL;
struct dom_sid *member_sids = NULL;
int i = 0, k = 0;
struct <API key> *info0 = NULL;
struct <API key> *info3 = NULL;
struct dom_sid *add_sids = NULL;
struct dom_sid *del_sids = NULL;
uint32_t num_add_sids = 0;
uint32_t num_del_sids = 0;
struct <API key> *b = NULL;
if ((!add && !del && !set) || (add && del && set)) {
return WERR_INVALID_PARAM;
}
if (add) {
r = add;
}
if (del) {
r = (struct <API key> *)del;
}
if (set) {
r = (struct <API key> *)set;
}
if (!r->in.group_name) {
return WERR_INVALID_PARAM;
}
switch (r->in.level) {
case 0:
case 3:
break;
default:
return WERR_UNKNOWN_LEVEL;
}
if (r->in.total_entries == 0 || !r->in.buffer) {
return WERR_INVALID_PARAM;
}
ZERO_STRUCT(connect_handle);
ZERO_STRUCT(builtin_handle);
ZERO_STRUCT(domain_handle);
ZERO_STRUCT(alias_handle);
member_sids = talloc_zero_array(ctx, struct dom_sid,
r->in.total_entries);
<API key>(member_sids);
switch (r->in.level) {
case 0:
info0 = (struct <API key> *)r->in.buffer;
for (i=0; i < r->in.total_entries; i++) {
sid_copy(&member_sids[i], (struct dom_sid *)info0[i].lgrmi0_sid);
}
break;
case 3:
info3 = (struct <API key> *)r->in.buffer;
break;
default:
break;
}
if (r->in.level == 3) {
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_lsarpc.syntax_id,
&lsa_pipe);
if (!W_ERROR_IS_OK(werr)) {
goto done;
}
for (i=0; i < r->in.total_entries; i++) {
status = <API key>(ctx, lsa_pipe,
info3[i].<API key>,
&member_sids[i]);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
}
TALLOC_FREE(lsa_pipe);
}
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_samr.syntax_id,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
}
b = pipe_cli->binding_handle;
werr = <API key>(ctx, pipe_cli,
<API key> |
<API key>,
<API key>,
&connect_handle,
&builtin_handle);
if (!W_ERROR_IS_OK(werr)) {
goto done;
}
init_lsa_String(&lsa_account_name, r->in.group_name);
status = <API key>(ctx, pipe_cli,
&builtin_handle,
r->in.group_name,
<API key> |
<API key> |
<API key> |
<API key>,
&alias_handle);
if (ctx-><API key>) {
<API key>(ctx, &builtin_handle);
}
if (NT_STATUS_IS_OK(status)) {
goto modify_membership;
}
werr = <API key>(ctx, pipe_cli,
<API key> |
<API key>,
<API key>,
&connect_handle,
&domain_handle,
&domain_sid);
if (!W_ERROR_IS_OK(werr)) {
goto done;
}
status = <API key>(ctx, pipe_cli,
&domain_handle,
r->in.group_name,
<API key> |
<API key> |
<API key> |
<API key>,
&alias_handle);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
if (ctx-><API key>) {
<API key>(ctx, &domain_handle);
}
modify_membership:
if (add) {
for (i=0; i < r->in.total_entries; i++) {
status = <API key>(ctx, &member_sids[i],
&add_sids,
&num_add_sids);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
}
}
if (del) {
for (i=0; i < r->in.total_entries; i++) {
status = <API key>(ctx, &member_sids[i],
&del_sids,
&num_del_sids);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
}
}
if (set) {
struct lsa_SidArray current_sids;
status = <API key>(b, talloc_tos(),
&alias_handle,
¤t_sids,
&result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
if (!NT_STATUS_IS_OK(result)) {
werr = ntstatus_to_werror(result);
goto done;
}
/* add list */
for (i=0; i < r->in.total_entries; i++) {
bool already_member = false;
for (k=0; k < current_sids.num_sids; k++) {
if (dom_sid_equal(&member_sids[i],
current_sids.sids[k].sid)) {
already_member = true;
break;
}
}
if (!already_member) {
status = <API key>(ctx,
&member_sids[i],
&add_sids, &num_add_sids);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
}
}
/* del list */
for (k=0; k < current_sids.num_sids; k++) {
bool keep_member = false;
for (i=0; i < r->in.total_entries; i++) {
if (dom_sid_equal(&member_sids[i],
current_sids.sids[k].sid)) {
keep_member = true;
break;
}
}
if (!keep_member) {
status = <API key>(ctx,
current_sids.sids[k].sid,
&del_sids, &num_del_sids);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
}
}
}
/* add list */
for (i=0; i < num_add_sids; i++) {
status = <API key>(b, talloc_tos(),
&alias_handle,
&add_sids[i],
&result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
if (!NT_STATUS_IS_OK(result)) {
werr = ntstatus_to_werror(result);
goto done;
}
}
/* del list */
for (i=0; i < num_del_sids; i++) {
status = <API key>(b, talloc_tos(),
&alias_handle,
&del_sids[i],
&result);
if (!NT_STATUS_IS_OK(status)) {
werr = ntstatus_to_werror(status);
goto done;
}
if (!NT_STATUS_IS_OK(result)) {
werr = ntstatus_to_werror(result);
goto done;
}
}
werr = WERR_OK;
done:
if (b && is_valid_policy_hnd(&alias_handle)) {
dcerpc_samr_Close(b, talloc_tos(), &alias_handle, &result);
}
if (ctx-><API key>) {
<API key>(ctx, &domain_handle);
<API key>(ctx, &builtin_handle);
<API key>(ctx, &connect_handle);
}
return werr;
}
WERROR <API key>(struct libnetapi_ctx *ctx,
struct <API key> *r)
{
return <API key>(ctx, r, NULL, NULL);
}
WERROR <API key>(struct libnetapi_ctx *ctx,
struct <API key> *r)
{
<API key>(ctx, r, <API key>);
}
WERROR <API key>(struct libnetapi_ctx *ctx,
struct <API key> *r)
{
return <API key>(ctx, NULL, r, NULL);
}
WERROR <API key>(struct libnetapi_ctx *ctx,
struct <API key> *r)
{
<API key>(ctx, r, <API key>);
}
WERROR <API key>(struct libnetapi_ctx *ctx,
struct <API key> *r)
{
return WERR_NOT_SUPPORTED;
}
WERROR <API key>(struct libnetapi_ctx *ctx,
struct <API key> *r)
{
<API key>(ctx, r, <API key>);
}
WERROR <API key>(struct libnetapi_ctx *ctx,
struct <API key> *r)
{
return <API key>(ctx, NULL, NULL, r);
}
WERROR <API key>(struct libnetapi_ctx *ctx,
struct <API key> *r)
{
<API key>(ctx, r, <API key>);
}
|
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "pluginmanagedlg.h"
#include "desktop.h"
#include <glib/gi18n.h>
#include "stardict.h"
PluginManageDlg::PluginManageDlg()
:
window(NULL),
treeview(NULL),
detail_label(NULL),
pref_button(NULL),
plugin_tree_model(NULL),
dict_changed_(false),
order_changed_(false)
{
}
PluginManageDlg::~PluginManageDlg()
{
g_assert(!window);
g_assert(!treeview);
g_assert(!detail_label);
g_assert(!pref_button);
g_assert(!plugin_tree_model);
}
void PluginManageDlg::response_handler (GtkDialog *dialog, gint res_id, PluginManageDlg *oPluginManageDlg)
{
if (res_id == GTK_RESPONSE_HELP) {
show_help("stardict-plugins");
} else if (res_id == <API key>) {
GtkTreeSelection *selection = <API key>(GTK_TREE_VIEW(oPluginManageDlg->treeview));
GtkTreeModel *model;
GtkTreeIter iter;
if (! <API key> (selection, &model, &iter))
return;
if (!<API key>(model, &iter)) {
gchar *filename;
StarDictPlugInType plugin_type;
gtk_tree_model_get (model, &iter, 4, &filename, 5, &plugin_type, -1);
gpAppFrame->oStarDictPlugins->configure_plugin(filename, plugin_type);
g_free(filename);
}
}
}
static gboolean get_disable_list(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
{
if (!<API key>(model, iter)) {
gboolean enable;
gtk_tree_model_get (model, iter, 1, &enable, -1);
if (!enable) {
gchar *filename;
gtk_tree_model_get (model, iter, 4, &filename, -1);
std::list<std::string> *disable_list = (std::list<std::string> *)data;
disable_list->push_back(filename);
g_free(filename);
}
}
return FALSE;
}
void PluginManageDlg::<API key> (<API key> *cell, gchar *path_str, PluginManageDlg *oPluginManageDlg)
{
GtkTreeModel *model = GTK_TREE_MODEL(oPluginManageDlg->plugin_tree_model);
GtkTreePath *path = <API key> (path_str);
GtkTreeIter iter;
<API key> (model, &iter, path);
gtk_tree_path_free (path);
gboolean enable;
gchar *filename;
StarDictPlugInType plugin_type;
gboolean can_configure;
gtk_tree_model_get (model, &iter, 1, &enable, 4, &filename, 5, &plugin_type, 6, &can_configure, -1);
enable = !enable;
gtk_tree_store_set (GTK_TREE_STORE (model), &iter, 1, enable, -1);
if (enable) {
gpAppFrame->oStarDictPlugins->load_plugin(filename);
} else {
gpAppFrame->oStarDictPlugins->unload_plugin(filename, plugin_type);
}
g_free(filename);
if (enable)
<API key>(oPluginManageDlg->pref_button, can_configure);
else
<API key>(oPluginManageDlg->pref_button, FALSE);
if (plugin_type == <API key>
|| plugin_type == <API key>) {
oPluginManageDlg->dict_changed_ = true;
} else if (plugin_type == <API key>) {
gpAppFrame->oMidWin.oToolWin.UpdatePronounceMenu();
}
std::list<std::string> disable_list;
<API key>(model, get_disable_list, &disable_list);
#ifdef _WIN32
{
std::list<std::string> disable_list_rel;
<API key>(disable_list, disable_list_rel);
std::swap(disable_list, disable_list_rel);
}
#endif
conf->set_strlist("/apps/stardict/manage_plugins/plugin_disable_list", disable_list);
}
struct <API key> {
gchar *info_str;
gchar *detail_str;
std::string filename;
std::string name;
std::string version;
std::string short_desc;
std::string long_desc;
std::string author;
std::string website;
};
static void <API key>(GMarkupParseContext *context, const gchar *element_name, const gchar **attribute_names, const gchar **attribute_values, gpointer user_data, GError **error)
{
if (strcmp(element_name, "plugin_info")==0) {
<API key> *Data = (<API key> *)user_data;
Data->name.clear();
Data->version.clear();
Data->short_desc.clear();
Data->long_desc.clear();
Data->author.clear();
Data->website.clear();
}
}
static void <API key>(GMarkupParseContext *context, const gchar *element_name, gpointer user_data, GError **error)
{
if (strcmp(element_name, "plugin_info")==0) {
<API key> *Data = (<API key> *)user_data;
Data->info_str = <API key>("<b>%s</b> %s\n%s", Data->name.c_str(), Data->version.c_str(), Data->short_desc.c_str());
Data->detail_str = <API key>(_("%s\n\n<b>Author:</b>\t%s\n<b>Website:</b>\t%s\n<b>Filename:</b>\t%s"), Data->long_desc.c_str(), Data->author.c_str(), Data->website.c_str(), Data->filename.c_str());
}
}
static void <API key>(GMarkupParseContext *context, const gchar *text, gsize text_len, gpointer user_data, GError **error)
{
const gchar *element = <API key>(context);
if (!element)
return;
<API key> *Data = (<API key> *)user_data;
if (strcmp(element, "name")==0) {
Data->name.assign(text, text_len);
} else if (strcmp(element, "version")==0) {
Data->version.assign(text, text_len);
} else if (strcmp(element, "short_desc")==0) {
Data->short_desc.assign(text, text_len);
} else if (strcmp(element, "long_desc")==0) {
Data->long_desc.assign(text, text_len);
} else if (strcmp(element, "author")==0) {
Data->author.assign(text, text_len);
} else if (strcmp(element, "website")==0) {
Data->website.assign(text, text_len);
}
}
static void add_tree_model(GtkTreeStore *tree_model, GtkTreeIter*parent, const std::list<StarDictPluginInfo> &infolist)
{
<API key> Data;
GMarkupParser parser;
parser.start_element = <API key>;
parser.end_element = <API key>;
parser.text = <API key>;
parser.passthrough = NULL;
parser.error = NULL;
GtkTreeIter iter;
for (std::list<StarDictPluginInfo>::const_iterator i = infolist.begin(); i != infolist.end(); ++i) {
Data.info_str = NULL;
Data.detail_str = NULL;
Data.filename = i->filename;
GMarkupParseContext* context = <API key>(&parser, (GMarkupParseFlags)0, &Data, NULL);
<API key>(context, i->info_xml.c_str(), -1, NULL);
<API key>(context, NULL);
<API key>(context);
<API key>(tree_model, &iter, parent);
bool loaded = gpAppFrame->oStarDictPlugins->get_loaded(i->filename.c_str());
gtk_tree_store_set(tree_model, &iter, 0, true, 1, loaded, 2, Data.info_str, 3, Data.detail_str, 4, i->filename.c_str(), 5, i->plugin_type, 6, i->can_configure, -1);
g_free(Data.info_str);
g_free(Data.detail_str);
}
}
static void init_tree_model(GtkTreeStore *tree_model)
{
std::list<std::pair<StarDictPlugInType, std::list<StarDictPluginInfo> > > plugin_list;
{
#ifdef _WIN32
std::list<std::string> plugin_order_list;
const std::list<std::string>& <API key>
= conf->get_strlist("/apps/stardict/manage_plugins/plugin_order_list");
<API key>(<API key>, plugin_order_list);
#else
const std::list<std::string>& plugin_order_list
= conf->get_strlist("/apps/stardict/manage_plugins/plugin_order_list");
#endif
gpAppFrame->oStarDictPlugins->get_plugin_list(plugin_order_list, plugin_list);
}
GtkTreeIter iter;
for (std::list<std::pair<StarDictPlugInType, std::list<StarDictPluginInfo> > >::iterator i = plugin_list.begin(); i != plugin_list.end(); ++i) {
switch (i->first) {
case <API key>:
<API key>(tree_model, &iter, NULL);
gtk_tree_store_set(tree_model, &iter, 0, false, 2, _("<b>Virtual Dictionary</b>"), -1);
add_tree_model(tree_model, &iter, i->second);
break;
case <API key>:
<API key>(tree_model, &iter, NULL);
gtk_tree_store_set(tree_model, &iter, 0, false, 2, _("<b>Network Dictionary</b>"), -1);
add_tree_model(tree_model, &iter, i->second);
break;
case <API key>:
<API key>(tree_model, &iter, NULL);
gtk_tree_store_set(tree_model, &iter, 0, false, 2, _("<b>Special Dictionary</b>"), -1);
add_tree_model(tree_model, &iter, i->second);
break;
case <API key>:
<API key>(tree_model, &iter, NULL);
gtk_tree_store_set(tree_model, &iter, 0, false, 2, _("<b>TTS Engine</b>"), -1);
add_tree_model(tree_model, &iter, i->second);
break;
case <API key>:
<API key>(tree_model, &iter, NULL);
gtk_tree_store_set(tree_model, &iter, 0, false, 2, _("<b>Data Parsing Engine</b>"), -1);
add_tree_model(tree_model, &iter, i->second);
break;
case <API key>:
<API key>(tree_model, &iter, NULL);
gtk_tree_store_set(tree_model, &iter, 0, false, 2, _("<b>Misc</b>"), -1);
add_tree_model(tree_model, &iter, i->second);
break;
default:
break;
}
}
}
void PluginManageDlg::<API key>(GtkTreeSelection *selection, PluginManageDlg *oPluginManageDlg)
{
GtkTreeModel *model;
GtkTreeIter iter;
if (! <API key> (selection, &model, &iter))
return;
if (<API key>(model, &iter)) {
<API key>(oPluginManageDlg->pref_button, FALSE);
} else {
gboolean loaded;
gchar *detail;
gboolean can_configure;
gtk_tree_model_get (model, &iter, 1, &loaded, 3, &detail, 6, &can_configure, -1);
<API key>(GTK_LABEL(oPluginManageDlg->detail_label), detail);
g_free(detail);
if (loaded)
<API key>(oPluginManageDlg->pref_button, can_configure);
else
<API key>(oPluginManageDlg->pref_button, FALSE);
}
}
gboolean PluginManageDlg::<API key>(GtkWidget * widget, GdkEventButton * event, PluginManageDlg *oPluginManageDlg)
{
if (event->type==GDK_2BUTTON_PRESS) {
if (<API key>(GTK_WIDGET(oPluginManageDlg->pref_button)))
gtk_dialog_response(GTK_DIALOG(oPluginManageDlg->window), <API key>);
return true;
} else {
return false;
}
}
static void add_order_list(std::list<std::string> &order_list, GtkTreeModel *now_tree_model, GtkTreeIter *parent)
{
gboolean have_iter;
GtkTreeIter iter;
have_iter = <API key>(now_tree_model, &iter, parent);
gchar *filename;
while (have_iter) {
gtk_tree_model_get (now_tree_model, &iter, 4, &filename, -1);
order_list.push_back(filename);
g_free(filename);
have_iter = <API key>(now_tree_model, &iter);
}
}
void PluginManageDlg::write_order_list()
{
std::list<std::string> order_list;
GtkTreeModel *now_tree_model = GTK_TREE_MODEL(plugin_tree_model);
gboolean have_iter;
GtkTreeIter iter;
have_iter = <API key>(now_tree_model, &iter);
while (have_iter) {
if (<API key>(now_tree_model, &iter)) {
add_order_list(order_list, now_tree_model, &iter);
}
have_iter = <API key>(now_tree_model, &iter);
}
#ifdef _WIN32
{
std::list<std::string> order_list_rel;
<API key>(order_list, order_list_rel);
std::swap(order_list, order_list_rel);
}
#endif
conf->set_strlist("/apps/stardict/manage_plugins/plugin_order_list", order_list);
}
void PluginManageDlg::drag_data_get_cb(GtkWidget *widget, GdkDragContext *ctx, GtkSelectionData *data, guint info, guint time, PluginManageDlg *oPluginManageDlg)
{
if (<API key>(data) == gdk_atom_intern("<API key>", FALSE)) {
GtkTreeRowReference *ref;
GtkTreePath *source_row;
ref = (GtkTreeRowReference *)g_object_get_data(G_OBJECT(ctx), "<API key>");
source_row = <API key>(ref);
if (source_row == NULL)
return;
GtkTreeIter iter;
<API key>(GTK_TREE_MODEL(oPluginManageDlg->plugin_tree_model), &iter, source_row);
<API key>(data, gdk_atom_intern("<API key>", FALSE), 8, (const guchar *)&iter, sizeof(iter));
gtk_tree_path_free(source_row);
}
}
void PluginManageDlg::<API key>(GtkWidget *widget, GdkDragContext *ctx, guint x, guint y, GtkSelectionData *sd, guint info, guint t, PluginManageDlg *oPluginManageDlg)
{
if (<API key>(sd) == gdk_atom_intern("<API key>", FALSE) && <API key>(sd)) {
GtkTreePath *path = NULL;
<API key> position;
GtkTreeIter drag_iter;
memcpy(&drag_iter, <API key>(sd), sizeof(drag_iter));
if (<API key>(GTK_TREE_VIEW(widget), x, y, &path, &position)) {
GtkTreeIter iter;
GtkTreeModel *model = GTK_TREE_MODEL(oPluginManageDlg->plugin_tree_model);
<API key>(model, &iter, path);
if (<API key>(model, &iter)) {
gtk_drag_finish (ctx, FALSE, FALSE, t);
return;
}
if (<API key>(model, &drag_iter)) {
gtk_drag_finish (ctx, FALSE, FALSE, t);
return;
}
GtkTreeIter parent_iter;
if (!<API key>(model, &parent_iter, &iter)) {
gtk_drag_finish (ctx, FALSE, FALSE, t);
return;
}
GtkTreeIter drag_parent_iter;
if (!<API key>(model, &drag_parent_iter, &drag_iter)) {
gtk_drag_finish (ctx, FALSE, FALSE, t);
return;
}
char *iter_str, *drag_iter_str;
iter_str = <API key>(model, &parent_iter);
drag_iter_str = <API key>(model, &drag_parent_iter);
if (strcmp(iter_str, drag_iter_str) != 0) {
g_free(iter_str);
g_free(drag_iter_str);
gtk_drag_finish (ctx, FALSE, FALSE, t);
return;
}
g_free(iter_str);
g_free(drag_iter_str);
switch (position) {
case <API key>:
case <API key>:
<API key>(GTK_TREE_STORE(model), &drag_iter, &iter);
break;
case <API key>:
case <API key>:
<API key>(GTK_TREE_STORE(model), &drag_iter, &iter);
break;
default: {
gtk_drag_finish (ctx, FALSE, FALSE, t);
return;
}
}
oPluginManageDlg->write_order_list();
oPluginManageDlg->order_changed_ = true;
gtk_drag_finish (ctx, TRUE, FALSE, t);
}
}
}
GtkWidget *PluginManageDlg::create_plugin_list()
{
GtkWidget *sw;
sw = <API key> (NULL, NULL);
<API key> (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN);
<API key> (GTK_SCROLLED_WINDOW (sw), <API key>, <API key>);
plugin_tree_model = gtk_tree_store_new(7, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_BOOLEAN);
init_tree_model(plugin_tree_model);
treeview = <API key> (GTK_TREE_MODEL(plugin_tree_model));
g_object_unref (G_OBJECT (plugin_tree_model));
#if GTK_MAJOR_VERSION >= 3
#else
<API key> (GTK_TREE_VIEW (treeview), TRUE);
#endif
g_signal_connect (G_OBJECT (treeview), "button_press_event", G_CALLBACK (<API key>), this);
GtkTreeSelection *selection;
selection = <API key> (GTK_TREE_VIEW (treeview));
<API key> (selection, <API key>);
g_signal_connect (selection, "changed", G_CALLBACK (<API key>), this);
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
renderer = <API key> ();
g_signal_connect (renderer, "toggled", G_CALLBACK (<API key>), this);
column = <API key> (_("Enable"), renderer, "visible", 0, "active", 1, NULL);
<API key> (GTK_TREE_VIEW(treeview), column);
<API key>(<API key> (column), FALSE);
<API key> (<API key> (column), FALSE);
renderer = <API key> ();
g_object_set (G_OBJECT (renderer), "xalign", 0.0, NULL);
column = <API key> (_("Plug-in Name"), renderer, "markup", 2, NULL);
<API key> (GTK_TREE_VIEW(treeview), column);
<API key>(<API key> (column), TRUE);
<API key> (<API key> (column), FALSE);
GtkTargetEntry gte[] = {{(gchar *)"<API key>", GTK_TARGET_SAME_APP, 0}};
<API key>(GTK_TREE_VIEW(treeview), GDK_BUTTON1_MASK, gte, 1, GDK_ACTION_COPY);
<API key>(GTK_TREE_VIEW(treeview), gte, 1, (GdkDragAction)(GDK_ACTION_COPY | GDK_ACTION_MOVE));
g_signal_connect(G_OBJECT(treeview), "drag-data-received", G_CALLBACK(<API key>), this);
g_signal_connect(G_OBJECT(treeview), "drag-data-get", G_CALLBACK(drag_data_get_cb), this);
<API key>(GTK_TREE_VIEW (treeview));
gtk_container_add (GTK_CONTAINER (sw), treeview);
return sw;
}
bool PluginManageDlg::ShowModal(GtkWindow *parent_win, bool &dict_changed, bool &order_changed)
{
window = gtk_dialog_new();
<API key>.pluginwin = window;
<API key>(GTK_WINDOW(window), parent_win);
//<API key>(GTK_DIALOG(window), false);
<API key>(GTK_DIALOG(window), GTK_STOCK_HELP, GTK_RESPONSE_HELP);
pref_button = <API key>(GTK_DIALOG(window), _("Configure Pl_ug-in"), <API key>);
<API key>(pref_button, FALSE);
<API key>(GTK_DIALOG(window), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
<API key>(GTK_DIALOG(window), GTK_RESPONSE_CLOSE);
g_signal_connect(G_OBJECT(window), "response", G_CALLBACK(response_handler), this);
GtkWidget *vbox;
#if GTK_MAJOR_VERSION >= 3
vbox = gtk_box_new (<API key>, 5);
#else
vbox = gtk_vbox_new (FALSE, 5);
#endif
<API key> (GTK_CONTAINER (vbox), 2);
GtkWidget *pluginlist = create_plugin_list();
gtk_box_pack_start (GTK_BOX (vbox), pluginlist, true, true, 0);
GtkWidget *expander = gtk_expander_new (_("<b>Plug-in Details</b>"));
<API key>(GTK_EXPANDER(expander), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), expander, false, false, 0);
detail_label = gtk_label_new (NULL);
<API key>(GTK_LABEL(detail_label), TRUE);
<API key>(GTK_LABEL (detail_label), TRUE);
gtk_container_add (GTK_CONTAINER (expander), detail_label);
gtk_box_pack_start (GTK_BOX(<API key>(GTK_DIALOG (window))), vbox, true, true, 0);
gtk_widget_show_all (<API key>(GTK_DIALOG (window)));
<API key> (GTK_WINDOW (window), _("Manage Plugins"));
<API key>(GTK_WINDOW(window), 250, 350);
dict_changed_ = false;
order_changed_ = false;
gint result;
while (true) {
result = gtk_dialog_run(GTK_DIALOG(window));
if (result ==GTK_RESPONSE_HELP || result == <API key>) {
} else {
break;
}
}
/* When do we get GTK_RESPONSE_NONE response? Unable to reproduce. */
if (result != GTK_RESPONSE_NONE) {
dict_changed = dict_changed_;
order_changed = order_changed_;
gtk_widget_destroy(GTK_WIDGET(window));
}
window = NULL;
treeview = NULL;
detail_label = NULL;
pref_button = NULL;
plugin_tree_model = NULL;
<API key>.pluginwin = NULL;
return result == GTK_RESPONSE_NONE;
}
|
// or (at your option) any later version.
// $URL$
// <API key>: LGPL-3.0+
// Author : Andreas Fabri
#ifndef <API key>
#define <API key>
//#define <API key> 1 // in order to get a warning during compilation
// if no such define exists, the package is used under the GPL or LGPL
// Otherwise the number encodes the date year/month/day
// Any release made b......
//#define <API key> 20140101
#endif // <API key>
|
#ifndef FONTDIALOG_H
#define FONTDIALOG_H
#include "DialogBox.h"
class FontSelector;
// Font selection widget
class FXAPI FontSelector : public FXPacker
{
FXDECLARE(FontSelector)
protected:
FXTextField *family;
FXList *familylist;
FXTextField *weight;
FXList *weightlist;
FXTextField *style;
FXList *stylelist;
FXTextField *size;
FXList *sizelist;
FXComboBox *charset;
FXComboBox *setwidth;
FXComboBox *pitch;
FXCheckButton *scalable;
FXCheckButton *allfonts;
FXButton *accept;
FXButton *cancel;
FXLabel *preview;
FXFont *previewfont;
FXFontDesc selected;
protected:
FontSelector()
{}
void listFontFaces();
void listWeights();
void listSlants();
void listFontSizes();
void previewFont();
private:
FontSelector(const FontSelector&);
FontSelector &operator=(const FontSelector&);
public:
long onCmdFamily(FXObject*,FXSelector,void*);
long onCmdWeight(FXObject*,FXSelector,void*);
long onCmdStyle(FXObject*,FXSelector,void*);
long onCmdStyleText(FXObject*,FXSelector,void*);
long onCmdSize(FXObject*,FXSelector,void*);
long onCmdSizeText(FXObject*,FXSelector,void*);
long onCmdCharset(FXObject*,FXSelector,void*);
long onUpdCharset(FXObject*,FXSelector,void*);
long onCmdSetWidth(FXObject*,FXSelector,void*);
long onUpdSetWidth(FXObject*,FXSelector,void*);
long onCmdPitch(FXObject*,FXSelector,void*);
long onUpdPitch(FXObject*,FXSelector,void*);
long onCmdScalable(FXObject*,FXSelector,void*);
long onUpdScalable(FXObject*,FXSelector,void*);
long onCmdAllFonts(FXObject*,FXSelector,void*);
long onUpdAllFonts(FXObject*,FXSelector,void*);
public:
enum{
ID_FAMILY=FXPacker::ID_LAST,
ID_WEIGHT,
ID_STYLE,
ID_STYLE_TEXT,
ID_SIZE,
ID_SIZE_TEXT,
ID_CHARSET,
ID_SETWIDTH,
ID_PITCH,
ID_SCALABLE,
ID_ALLFONTS,
ID_LAST
};
public:
// Constructor
FontSelector(FXComposite *p,FXObject* tgt=NULL,FXSelector sel=0,unsigned int opts=0,int x=0,int y=0,int w=0,int h=0);
// Create server-side resources
virtual void create();
// Return a pointer to the "Accept" button
FXButton *acceptButton() const
{
return accept;
}
// Return a pointer to the "Cancel" button
FXButton *cancelButton() const
{
return cancel;
}
// Set font selection
void setFontSelection(const FXFontDesc& fontdesc);
// Get font selection
void getFontSelection(FXFontDesc& fontdesc) const;
// Save to a stream
virtual void save(FXStream& store) const;
// Load from a stream
virtual void load(FXStream& store);
// Destructor
virtual ~FontSelector();
};
// Font selection dialog
class FXAPI FontDialog : public DialogBox
{
FXDECLARE(FontDialog)
protected:
FontSelector *fontbox;
protected:
FontDialog()
{}
private:
FontDialog(const FontDialog&);
FontDialog &operator=(const FontDialog&);
public:
// Constructor
FontDialog(FXWindow* owner,const FXString& name,unsigned int opts=0,int x=0,int y=0,int w=750,int h=480);
// Save dialog to a stream
virtual void save(FXStream& store) const;
// Load dialog from a stream
virtual void load(FXStream& store);
// Set the current font selection
void setFontSelection(const FXFontDesc& fontdesc);
// Get the current font selection
void getFontSelection(FXFontDesc& fontdesc) const;
// Destructor
virtual ~FontDialog();
};
#endif
|
title: Reporting Bugs & Getting Help
weight: 10
BRAT is under constant development and we are eager to resolve all known issues. However, please search [existing posts](https://github.com/Riverscapes/pyBRAT/issues) first and our help pages before [posting an issue](#Posting an Issue).
# Questions or Help
You can explore or search [other user questions here](https://github.com/Riverscapes/pyBRAT/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22help+wanted%22+).
<a class="button" href="https://github.com/Riverscapes/pyBRAT/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22help+wanted%22+"><i class="fa fa-github"/> BRAT Help Wanted</a>
# Bugs
Before logging a suspected bug, please search [known open bugs](https://github.com/Riverscapes/pyBRAT/labels/bug). If you have more information to report about this bug, please post a comment to the appropriate issue. Otherwise, you can post a new bug, using the 'Bug' label.
<a class="button" href="https://github.com/Riverscapes/pyBRAT/labels/bug"><i class="fa fa-github"/> BRAT Bugs</a>
# Posting an Issue
If you find a bug, or simply want to report an issue with the software, please log a GitHub Issue. <a class="button" href="https://github.com/Riverscapes/pyBRAT/issues"><i class="fa fa-github"/> Github Issues</a>
Anyone in the BRAT community and a member of GitHub can respond, and the development team will recieve a notification. Please be patient for a response. We do not have any budget for supporting users, but we do try and respond to issues when we can.
This video shows you how to post an issue (for [GCD](http://gcd.riverscapes.xyz), but process is similar) and some helpful things to include:
<iframe width="560" height="315" src="https:
Please always include following information:
> ## The Problem
>
> What went wrong?
>
> ## Reproduction steps
>
> 1. I did this
> 2. Then I did that...
> Include screenshots if you have them (you can drag and drop these in)
> ## Error messages (if applicable)
>
> ```text
>
> Paste the exception message you are getting from the app here. It really helps us.
>
> ```
> ## Datasets
>
> You can provide links to datasets.>
> ## BRAT & ARC Version Info
> - Version of BRAT you were using (e.g. `BRAT 3.0.19`)
> - Version of ArcGIS (e.g. `ArcGIS 10.5.1`)
The issue posting in GitHub uses [markdown syntax](https://guides.github.com/features/mastering-markdown/).
Optional Information:
- If you do not want to provide a link to the complete copy of the BRAT project, just sharing a copy of the `*project.rs.xml` project file and changing the file extension to text and uploading it to your post can help a lot
- Record a video of what is going wrong (we recommend [FastStone Capture](http://etal.joewheaton.org/faststone-capture.html), post it to YouTube or Vimeo, and share the link (DO NOT SEND VIDEOS as attachments! just stream it). Videos can be really helpful for understanding what you are doing and what is going wrong.
<div align="center">
<a class="hollow button" href="{{ site.baseurl }}/Documentation"><i class="fa fa-info-circle"></i> Back to Help </a>
<a class="hollow button" href="{{ site.baseurl }}/"><img src="{{ site.baseurl }}/assets/images/favicons/favicon-16x16.png"> Back to BRAT Home </a>
</div>
|
package tmp.generated_people;
import cide.gast.*;
import cide.gparser.*;
import cide.greferences.*;
import java.util.*;
public abstract class Element_ol extends GenASTNode {
protected Element_ol(Property[] p, Token firstToken, Token lastToken) { super(p, firstToken, lastToken); }
protected Element_ol(Property[] p, IToken firstToken, IToken lastToken) { super(p, firstToken, lastToken); }
}
|
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
import { HttpResponse, HttpErrorResponse } from '@angular/common/http';
import { of, throwError } from 'rxjs';
import { BookstoreTestModule } from '../../../test.module';
import { <API key> } from 'app/admin/metrics/metrics.component';
import { JhiMetricsService } from 'app/admin/metrics/metrics.service';
describe('Component Tests', () => {
describe('<API key>', () => {
let comp: <API key>;
let fixture: ComponentFixture<<API key>>;
let service: JhiMetricsService;
beforeEach(async(() => {
TestBed.<API key>({
imports: [BookstoreTestModule],
declarations: [<API key>]
})
.overrideTemplate(<API key>, '')
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(<API key>);
comp = fixture.componentInstance;
service = fixture.debugElement.injector.get(JhiMetricsService);
});
describe('refresh', () => {
it('should call refresh on init', () => {
// GIVEN
const response = {
timers: {
service: 'test',
unrelatedKey: 'test'
},
gauges: {
'jcache.statistics': {
value: 2
},
unrelatedKey: 'test'
}
};
spyOn(service, 'getMetrics').and.returnValue(of(response));
// WHEN
comp.ngOnInit();
// THEN
expect(service.getMetrics).toHaveBeenCalled();
});
});
});
});
|
before words
\begin{myenv}body of myenv
\end{myenv}
after words
|
//# BaselineSelection.cc: Class to handle the baseline selection
//
//# ASTRON (Netherlands Institute for Radio Astronomy)
//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
//
//# This file is part of the LOFAR software suite.
//# The LOFAR software suite is free software: you can redistribute it and/or
//
//
//# (at your option) any later version.
//
//# The LOFAR software suite is distributed in the hope that it will be useful,
//
//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//
//
//
//
//
//
//
//# @author Ger van Diepen
#include <lofar_config.h>
#include <DPPP/BaselineSelection.h>
#include <DPPP/DPLogger.h>
#include <MS/BaselineSelect.h>
#include <Common/ParameterSet.h>
#include <Common/ParameterValue.h>
#include <Common/LofarLogger.h>
#include <Common/StreamUtil.h>
using namespace casa;
using namespace std;
namespace LOFAR {
namespace DPPP {
BaselineSelection::BaselineSelection()
{}
BaselineSelection::BaselineSelection (const ParameterSet& parset,
const string& prefix,
bool minmax,
const string& defaultCorrType,
const string& defaultBaseline)
: itsStrBL (parset.getString (prefix + "baseline", defaultBaseline)),
itsCorrType (parset.getString (prefix + "corrtype", defaultCorrType)),
itsRangeBL (parset.getDoubleVector (prefix + "blrange",
vector<double>()))
{
if (minmax) {
double minbl = parset.getDouble (prefix + "blmin", -1);
double maxbl = parset.getDouble (prefix + "blmax", -1);
if (minbl > 0) {
itsRangeBL.push_back (0.);
itsRangeBL.push_back (minbl);
}
if (maxbl > 0) {
itsRangeBL.push_back (maxbl);
itsRangeBL.push_back (1e30);
}
}
ASSERTSTR (itsRangeBL.size()%2 == 0,
"NDPPP error: uneven number of lengths in baseline range");
}
bool BaselineSelection::hasSelection() const
{
return !((itsStrBL.empty() || itsStrBL == "[]") &&
itsCorrType.empty() && itsRangeBL.empty());
}
void BaselineSelection::show (ostream& os, const string& blanks) const
{
os << " Baseline selection:" << std::endl;
os << " baseline: " << blanks << itsStrBL << std::endl;
os << " corrtype: " << blanks << itsCorrType << std::endl;
os << " blrange: " << blanks << itsRangeBL << std::endl;
}
Matrix<bool> BaselineSelection::apply (const DPInfo& info) const
{
// Size and initialize the selection matrix.
int nant = info.antennaNames().size();
Matrix<bool> selectBL(nant, nant, true);
// Apply the various parts if given.
if (! itsStrBL.empty() && itsStrBL != "[]") {
handleBL (selectBL, info);
}
if (! itsCorrType.empty()) {
handleCorrType (selectBL);
}
if (! itsRangeBL.empty()) {
handleLength (selectBL, info);
}
return selectBL;
}
Vector<bool> BaselineSelection::applyVec (const DPInfo& info) const
{
Matrix<bool> sel = apply(info);
Vector<bool> vec;
vec.resize (info.nbaselines());
for (uint i=0; i<info.nbaselines(); ++i) {
vec[i] = sel(info.getAnt1()[i], info.getAnt2()[i]);
}
return vec;
}
void BaselineSelection::handleBL (Matrix<bool>& selectBL,
const DPInfo& info) const
{
// Handle the value(s) in the baseline selection string.
ParameterValue pvBL(itsStrBL);
// The value can be a vector or an MSSelection string.
// Alas the ParameterValue vector test cannot be used, because
// the first character of a MSSelection string can also be [.
// So if the first is [ and a ] is found before the end and before
// another [, it must be a MSSelection string.
bool mssel = true;
if (itsStrBL[0] == '[') {
String::size_type rb = itsStrBL.find (']');
ASSERTSTR (rb != string::npos,
"Baseline selection " + itsStrBL +
" has no ending ]");
if (rb == itsStrBL.size()-1) {
mssel = false;
} else {
String::size_type lb = itsStrBL.find ('[', 1);
mssel = (lb == string::npos || lb > rb);
}
}
if (!mssel) {
// Specified as a vector of antenna name patterns.
selectBL = selectBL && handleBLVector (pvBL, info.antennaNames());
} else {
// Specified in casacore's MSSelection format.
string msName = info.msName();
ASSERT (! msName.empty());
Matrix<bool> sel(BaselineSelect::convert (msName, itsStrBL));
// The resulting matrix can be smaller because new stations might have
// been added that are not present in the MS's ANTENNA table.
if (sel.nrow() == selectBL.nrow()) {
selectBL = selectBL && sel;
} else {
// Only and the subset.
Matrix<bool> selBL = selectBL(IPosition(2,0),
IPosition(2,sel.nrow()-1));
selBL = selBL && sel;
}
}
}
Matrix<bool> BaselineSelection::handleBLVector (const ParameterValue& pvBL,
const Vector<String>& antNames) const
{
Matrix<Bool> sel(antNames.size(), antNames.size());
sel = false;
vector<ParameterValue> pairs = pvBL.getVector();
// Each ParameterValue can be a single value (antenna) or a pair of
// values (a baseline).
// Note that [ant1,ant2] is somewhat ambiguous; it means two antennae,
// but one might think it means a baseline [[ant1,ant2]].
if (pairs.size() == 2 &&
!(pairs[0].isVector() || pairs[1].isVector())) {
LOG_WARN_STR ("PreFlagger baseline " << pvBL.get()
<< " means two antennae, but is somewhat ambigious; "
<< "it's more clear to use [[ant1],[ant2]]");
}
for (uint i=0; i<pairs.size(); ++i) {
vector<string> bl = pairs[i].getStringVector();
if (bl.size() == 1) {
// Turn the given antenna name pattern into a regex.
Regex regex(Regex::fromPattern (bl[0]));
int nmatch = 0;
// Loop through all antenna names and set matrix for matching ones.
for (uint i2=0; i2<antNames.size(); ++i2) {
if (antNames[i2].matches (regex)) {
nmatch++;
// Antenna matches, so set all corresponding flags.
for (uint j=0; j<antNames.size(); ++j) {
sel(i2,j) = true;
sel(j,i2) = true;
}
}
}
if (nmatch == 0) {
DPLOG_WARN_STR ("PreFlagger: no matches for antenna name pattern ["
<< bl[0] << "]");
}
} else {
ASSERTSTR (bl.size() == 2, "PreFlagger baseline " << bl <<
" should contain 1 or 2 antenna name patterns");
// Turn the given antenna name pattern into a regex.
Regex regex1(Regex::fromPattern (bl[0]));
Regex regex2(Regex::fromPattern (bl[1]));
int nmatch = 0;
// Loop through all antenna names and set matrix for matching ones.
for (uint i2=0; i2<antNames.size(); ++i2) {
if (antNames[i2].matches (regex2)) {
// Antenna2 matches, now try Antenna1.
for (uint i1=0; i1<antNames.size(); ++i1) {
if (antNames[i1].matches (regex1)) {
nmatch++;
sel(i1,i2) = true;
sel(i2,i1) = true;
}
}
}
}
if (nmatch == 0) {
DPLOG_WARN_STR ("PreFlagger: no matches for baseline name pattern ["
<< bl[0] << ',' << bl[1] << "]");
}
}
}
return sel;
}
void BaselineSelection::handleCorrType (Matrix<bool>& selectBL) const
{
// Process corrtype if given.
string corrType = toLower(itsCorrType);
ASSERTSTR (corrType == "auto" || corrType == "cross",
"NDPPP corrType " << corrType
<< " is invalid; must be auto, cross, or empty string");
if (corrType == "auto") {
Vector<bool> diag = selectBL.diagonal().copy();
selectBL = false;
selectBL.diagonal() = diag;
} else {
selectBL.diagonal() = false;
}
}
void BaselineSelection::handleLength (Matrix<bool>& selectBL,
const DPInfo& info) const
{
// Get baseline lengths.
const vector<double>& blength = info.getBaselineLengths();
const Vector<Int>& ant1 = info.getAnt1();
const Vector<Int>& ant2 = info.getAnt2();
for (uint i=0; i<ant1.size(); ++i) {
// Clear selection if no range matches.
bool match = false;
for (uint j=0; j<itsRangeBL.size(); j+=2) {
if (blength[i] >= itsRangeBL[j] && blength[i] <= itsRangeBL[j+1]) {
match = true;
break;
}
}
if (!match) {
int a1 = ant1[i];
int a2 = ant2[i];
selectBL(a1,a2) = false;
selectBL(a2,a1) = false;
}
}
}
} //# end namespace
}
|
// 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
/*
** r_opengl.cpp
**
** OpenGL system interface
**
*/
#include "gl/system/gl_system.h"
#include "tarray.h"
#include "doomtype.h"
#include "m_argv.h"
#include "zstring.h"
#include "version.h"
#include "i_system.h"
#include "v_text.h"
#include "r_data/r_translate.h"
#include "gl/system/gl_interface.h"
#include "gl/system/gl_cvars.h"
void gl_PatchMenu();
static TArray<FString> m_Extensions;
RenderContext gl;
static void CollectExtensions()
{
const char *extension;
int max = 0;
glGetIntegerv(GL_NUM_EXTENSIONS, &max);
if (0 == max)
{
// Try old method to collect extensions
const char *supported = (char *)glGetString(GL_EXTENSIONS);
if (nullptr != supported)
{
char *extensions = new char[strlen(supported) + 1];
strcpy(extensions, supported);
char *extension = strtok(extensions, " ");
while (extension)
{
m_Extensions.Push(FString(extension));
extension = strtok(nullptr, " ");
}
delete [] extensions;
}
}
else
{
// Use modern method to collect extensions
for (int i = 0; i < max; i++)
{
extension = (const char*)glGetStringi(GL_EXTENSIONS, i);
m_Extensions.Push(FString(extension));
}
}
}
static bool CheckExtension(const char *ext)
{
for (unsigned int i = 0; i < m_Extensions.Size(); ++i)
{
if (m_Extensions[i].CompareNoCase(ext) == 0) return true;
}
return false;
}
static void InitContext()
{
gl.flags=0;
}
#define FUDGE_FUNC(name, ext) if (_ptrc_##name == NULL) _ptrc_##name = _ptrc_##name##ext;
void gl_LoadExtensions()
{
InitContext();
CollectExtensions();
const char *version = Args->CheckValue("-glversion");
const char *glversion = (const char*)glGetString(GL_VERSION);
if (version == NULL)
{
version = glversion;
}
else
{
double v1 = strtod(version, NULL);
double v2 = strtod(glversion, NULL);
if (v2 < v1) version = glversion;
else Printf("Emulating OpenGL v %s\n", version);
}
float gl_version = (float)strtod(version, NULL) + 0.01f;
// Don't even start if it's lower than 2.0 or no framebuffers are available (The framebuffer extension is needed for <API key>!)
if ((gl_version < 2.0f || !CheckExtension("<API key>")) && gl_version < 3.0f)
{
I_FatalError("Unsupported OpenGL version.\nAt least OpenGL 2.0 with framebuffer support is required to run " GAMENAME ".\n");
}
// add 0.01 to account for roundoff errors making the number a tad smaller than the actual version
gl.glslversion = strtod((char*)glGetString(<API key>), NULL) + 0.01f;
gl.vendorstring = (char*)glGetString(GL_VENDOR);
// first test for optional features
if (CheckExtension("<API key>")) gl.flags |= <API key>;
if (CheckExtension("<API key>")) gl.flags |= <API key>;
if ((gl_version >= 3.3f || CheckExtension("<API key>")) && !Args->CheckParm("-nosampler"))
{
gl.flags |= RFL_SAMPLER_OBJECTS;
}
// The minimum requirement for the modern render path are GL 3.0 + uniform buffers. Also exclude the Linux Mesa driver at GL 3.0 because it errors out on shader compilation.
if (gl_version < 3.0f || (gl_version < 3.1f && (!CheckExtension("<API key>") || strstr(gl.vendorstring, "X.Org") != nullptr)))
{
gl.legacyMode = true;
gl.lightmethod = LM_LEGACY;
gl.buffermethod = BM_LEGACY;
gl.glslversion = 0;
gl.flags |= RFL_NO_CLIP_PLANES;
}
else
{
gl.legacyMode = false;
gl.lightmethod = LM_DEFERRED;
gl.buffermethod = BM_DEFERRED;
if (gl_version < 4.f)
{
#ifdef _WIN32
if (strstr(gl.vendorstring, "ATI Tech"))
{
gl.flags |= RFL_NO_CLIP_PLANES; // gl_ClipDistance is horribly broken on ATI GL3 drivers for Windows.
}
#endif
}
else if (gl_version < 4.5f)
{
// don't use GL 4.x features when running a GL 3.x context.
if (CheckExtension("<API key>"))
{
// work around a problem with older AMD drivers: Their implementation of shader storage buffer objects is piss-poor and does not match uniform buffers even closely.
// Recent drivers, GL 4.4 don't have this problem, these can easily be recognized by also supporting the <API key> extension.
if (CheckExtension("<API key>"))
{
// Shader storage buffer objects are broken on current Intel drivers.
if (strstr(gl.vendorstring, "Intel") == NULL)
{
gl.flags |= <API key>;
}
}
gl.flags |= RFL_BUFFER_STORAGE;
gl.lightmethod = LM_DIRECT;
gl.buffermethod = BM_PERSISTENT;
}
}
else
{
// Assume that everything works without problems on GL 4.5 drivers where these things are core features.
gl.flags |= <API key> | RFL_BUFFER_STORAGE;
gl.lightmethod = LM_DIRECT;
gl.buffermethod = BM_PERSISTENT;
}
if (gl_version >= 4.3f || CheckExtension("<API key>")) gl.flags |= <API key>;
if (gl_version >= 4.3f || CheckExtension("GL_KHR_debug")) gl.flags |= RFL_DEBUG;
const char *lm = Args->CheckValue("-lightmethod");
if (lm != NULL)
{
if (!stricmp(lm, "deferred") && gl.lightmethod == LM_DIRECT) gl.lightmethod = LM_DEFERRED;
}
lm = Args->CheckValue("-buffermethod");
if (lm != NULL)
{
if (!stricmp(lm, "deferred") && gl.buffermethod == BM_PERSISTENT) gl.buffermethod = BM_DEFERRED;
}
}
int v;
if (!gl.legacyMode && !(gl.flags & <API key>))
{
glGetIntegerv(<API key>, &v);
gl.maxuniforms = v;
glGetIntegerv(<API key>, &v);
gl.maxuniformblock = v;
glGetIntegerv(<API key>, &v);
gl.<API key> = v;
}
else
{
gl.maxuniforms = 0;
gl.maxuniformblock = 0;
gl.<API key> = 0;
}
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &gl.max_texturesize);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
if (gl.legacyMode)
{
// fudge a bit with the framebuffer stuff to avoid redundancies in the main code. Some of the older cards do not have the ARB stuff but the calls are nearly identical.
FUDGE_FUNC(glGenerateMipmap, EXT);
FUDGE_FUNC(glGenFramebuffers, EXT);
FUDGE_FUNC(glBindFramebuffer, EXT);
FUDGE_FUNC(<API key>, EXT);
FUDGE_FUNC(<API key>, EXT);
FUDGE_FUNC(glGenerateMipmap, EXT);
FUDGE_FUNC(glGenFramebuffers, EXT);
FUDGE_FUNC(glBindFramebuffer, EXT);
FUDGE_FUNC(<API key>, EXT);
FUDGE_FUNC(<API key>, EXT);
FUDGE_FUNC(<API key>, EXT);
FUDGE_FUNC(glGenRenderbuffers, EXT);
FUDGE_FUNC(<API key>, EXT);
FUDGE_FUNC(<API key>, EXT);
FUDGE_FUNC(glBindRenderbuffer, EXT);
FUDGE_FUNC(<API key>, EXT);
gl_PatchMenu();
}
}
void gl_PrintStartupLog()
{
int v = 0;
if (!gl.legacyMode) glGetIntegerv(<API key>, &v);
Printf ("GL_VENDOR: %s\n", glGetString(GL_VENDOR));
Printf ("GL_RENDERER: %s\n", glGetString(GL_RENDERER));
Printf ("GL_VERSION: %s (%s profile)\n", glGetString(GL_VERSION), (v & <API key>)? "Core" : "Compatibility");
Printf ("<API key>: %s\n", glGetString(<API key>));
Printf (PRINT_LOG, "GL_EXTENSIONS:");
for (unsigned i = 0; i < m_Extensions.Size(); i++)
{
Printf(PRINT_LOG, " %s", m_Extensions[i].GetChars());
}
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &v);
Printf("\nMax. texture size: %d\n", v);
glGetIntegerv(<API key>, &v);
Printf ("Max. texture units: %d\n", v);
glGetIntegerv(<API key>, &v);
Printf ("Max. varying: %d\n", v);
if (!gl.legacyMode && !(gl.flags & <API key>))
{
glGetIntegerv(<API key>, &v);
Printf ("Max. uniform block size: %d\n", v);
glGetIntegerv(<API key>, &v);
Printf ("Uniform block alignment: %d\n", v);
}
if (gl.flags & <API key>)
{
glGetIntegerv(<API key>, &v);
Printf("Max. combined shader storage blocks: %d\n", v);
glGetIntegerv(<API key>, &v);
Printf("Max. vertex shader storage blocks: %d\n", v);
}
// For shader-less, the special alphatexture translation must be changed to actually set the alpha, because it won't get translated by a shader.
if (gl.legacyMode)
{
FRemapTable *remap = translationtables[<API key>][8];
for (int i = 0; i < 256; i++)
{
remap->Remap[i] = i;
remap->Palette[i] = PalEntry(i, 255, 255, 255);
}
}
}
|
/**
* Provides convenience methods for registering, and
* special implementations of,
* {@link com.xuggle.utils.event.IEventHandler}.
* <p>
* There are certain types of {@link com.xuggle.utils.event.IEventHandler}
* implementations that are very common. For example, sometimes
* you want to forward an event from one
* {@link com.xuggle.utils.event.IEventDispatcher}
* to another.
* Sometimes you only want
* a {@link com.xuggle.utils.event.IEventHandler} to execute if the
* {@link com.xuggle.utils.event.IEvent#getSource()} is equal to
* a given source.
* Sometimes you only
* want to handler to execute a maximum number of times.
* </p>
* <p>
* This class tries to provide some of those implementations for you.
* </p>
* <p>
* Use the {@link com.xuggle.utils.event.handler.Handler} class to find
* Factory methods for the special handlers you want.
* </p>
* @see com.xuggle.utils.event.handler.Handler
*
*/
package com.xuggle.utils.event.handler;
|
class CreatePasswords < ActiveRecord::Migration
def change
create_table :passwords do |p|
p.string :url
p.string :user
p.string :password
#p.timestamps null: false
end
end
end
|
module Hazel.StringWriter where
import Control.Monad.State
type StringState = State String (Maybe Bool)
eval :: StringState -> String
eval s = execState s ""
newLine :: StringState
append :: String -> StringState
apply :: (String -> String) -> StringState
newLine = append "\n"
append s = apply (++s)
apply f = get >>= put.(f$) >> return (Just True)
--newLine :: StringState
--newLine = do
-- t <- get
-- put $ t++"\n"
-- return True
-- get >>= put.(++"\n") >>= return True
--append :: String -> StringState
--append s = do
-- t <- get
-- put $ t++s
-- return True
-- get >>= put.(++s) >>= return True
--modify :: (String -> String) -> StringState
--modify f = do
-- t <- get
-- put $ f t
-- return True
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta property="og:type" content="website">
<meta property="og:title" content="">
<meta property="og:url" content="http://wangdongustc.com/index.html">
<meta property="og:site_name" content="">
<meta property="og:locale" content="zh_CN">
<meta property="article:author" content="Darren Wang">
<meta name="twitter:card" content="summary">
<link rel="alternate" href="/atom.xml" title="" type="application/atom+xml">
<link rel="shortcut icon" href="/favicon.png">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/<API key>@0.0.71/index.min.css">
<link rel="stylesheet" href="/css/style.css">
<link rel="stylesheet" href="/fancybox/jquery.fancybox.min.css">
<meta name="generator" content="Hexo 5.4.0"></head>
<body>
<div id="container">
<div id="wrap">
<header id="header">
<div id="banner"></div>
<div id="header-outer" class="outer">
<div id="header-title" class="inner">
<h1 id="logo-wrap">
<a href="/" id="logo"></a>
</h1>
<h2 id="subtitle-wrap">
<a href="/" id="subtitle"></a>
</h2>
</div>
<div id="header-inner" class="inner">
<nav id="main-nav">
<a id="main-nav-toggle" class="nav-icon"></a>
<a class="main-nav-link" href="/">Home</a>
<a class="main-nav-link" href="/archives">Archives</a>
</nav>
<nav id="sub-nav">
<a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
<a id="nav-search-btn" class="nav-icon" title="Suche"></a>
</nav>
<div id="search-form-wrap">
<form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="Suche"><button type="submit" class="search-form-submit">&
</div>
</div>
</div>
</header>
<div class="outer">
<section id="main">
<article id="post-hello-world" class="h-entry article article-type-post" itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting">
<div class="article-meta">
<a href="/2021/04/24/15/46/04" class="article-date">
<time class="dt-published" datetime="2021-04-24T15:46:04.791Z" itemprop="datePublished">2021-04-24</time>
</a>
</div>
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="p-name article-title" href="/2021/04/24/15/46/04">Hello World</a>
</h1>
</header>
<div class="e-content article-entry" itemprop="articleBody">
<p>Welcome to <a target="_blank" rel="noopener" href="https:
<h2 id="Quick-Start"><a href="#Quick-Start" class="headerlink" title="Quick Start"></a>Quick Start</h2><h3 id="Create-a-new-post"><a href="#Create-a-new-post" class="headerlink" title="Create a new post"></a>Create a new post</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo new <span class="string">"My New Post"</span></span><br></pre></td></tr></table></figure>
<p>More info: <a target="_blank" rel="noopener" href="https://hexo.io/docs/writing.html">Writing</a></p>
<h3 id="Run-server"><a href="#Run-server" class="headerlink" title="Run server"></a>Run server</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo server</span><br></pre></td></tr></table></figure>
<p>More info: <a target="_blank" rel="noopener" href="https://hexo.io/docs/server.html">Server</a></p>
<h3 id="<API key>"><a href="#<API key>" class="headerlink" title="Generate static files"></a>Generate static files</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo generate</span><br></pre></td></tr></table></figure>
<p>More info: <a target="_blank" rel="noopener" href="https://hexo.io/docs/generating.html">Generating</a></p>
<h3 id="<API key>"><a href="#<API key>" class="headerlink" title="Deploy to remote sites"></a>Deploy to remote sites</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo deploy</span><br></pre></td></tr></table></figure>
<p>More info: <a target="_blank" rel="noopener" href="https://hexo.io/docs/<API key>.html">Deployment</a></p>
</div>
<footer class="article-footer">
<a data-url="http://wangdongustc.com/2021/04/24/15/46/04" data-id="<API key>" data-title="Hello World" class="article-share-link">Teilen</a>
</footer>
</div>
</article>
</section>
<aside id="sidebar">
<div class="widget-wrap">
<h3 class="widget-title">Archiv</h3>
<div class="widget">
<ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2021/04/"> 2021</a></li></ul>
</div>
</div>
<div class="widget-wrap">
<h3 class="widget-title">letzter Beitrag</h3>
<div class="widget">
<ul>
<li>
<a href="/2021/04/24/15/46/04">Hello World</a>
</li>
</ul>
</div>
</div>
</aside>
</div>
<footer id="footer">
<div class="outer">
<div id="footer-info" class="inner">
© 2021 Darren Wang<br>
Powered by <a href="https://hexo.io/" target="_blank">Hexo</a>
</div>
</div>
</footer>
</div>
<nav id="mobile-nav">
<a href="/" class="mobile-nav-link">Home</a>
<a href="/archives" class="mobile-nav-link">Archives</a>
</nav>
<script src="/js/jquery-3.4.1.min.js"></script>
<script src="/fancybox/jquery.fancybox.min.js"></script>
<script src="/js/script.js"></script>
</div>
</body>
</html>
|
{% extends 'bs3/base_wo_cms_toolbar.html' %}
{% load cms_tags sekizai_tags i18n l10n repanier_tags %}
{% block base_content %}
<div class="container-repanier">
<div class="container">
{# {% debug %} #}
<h4>{{ producer.long_profile_name }}</h4>
{% if object %}
<h4><span class="glyphicon glyphicon-log-out" aria-hidden="true"></span> {% translate "Previous balance" %} : {{ object.<API key> }}
<small>({{ object.<API key> | date:"DATE_FORMAT" }})</small><br></h4>
{% endif %}
{% if offer_item_set %}
<span class="glyphicon glyphicon-minus" aria-hidden="true"></span> {% translate "Purchases" %} {{ object.permanence }} : {{ object.<API key> }}
{% if object.get_total_vat != 0 or object.get_total_deposit != 0 or object.delta_transport != 0 %}
<small>
. {% translate "This price include" %} <span class="glyphicon <API key>"></span>
{% if object.get_total_vat != 0 %}{% translate "VAT" %} : {{ object.get_total_vat }}{% endif %}
{% if object.get_total_deposit != 0 %}
{% if object.get_total_vat != 0 %}; {% endif %}
{% translate "Deposit" %} : {{ object.get_total_deposit }}
{% endif %}
{% if object.delta_transport != 0 %}
{% if object.get_total_vat != 0 or object.get_total_deposit != 0 %}; {% endif %}
{% translate "Shipping cost" %} : {{ object.delta_transport }}
{% endif %}
</small>
<br>
{% if object.<API key> != 0 %}
{% if object.<API key> < 0 %}{% translate "Reduction granted" %}{% else %}{% translate "Surcharge" %}{% endif %} : {{ object.<API key> }}<br>
{% endif %}
{% endif %}
{% endif %}
{% for bank_account in bank_account_set %}
{% if bank_account.bank_amount_in != 0 %}
<span class="glyphicon glyphicon-minus" aria-hidden="true"></span> {% translate "Provision" %} :
{% if bank_account.operation_comment %}
{{ bank_account.operation_comment }}
{% else %}
{% translate "Refund" %}
{% endif %} : {{ bank_account.bank_amount_in }}
<small>({{ bank_account.operation_date | date:"DATE_FORMAT" }})</small><br>
{% endif %}
{% if bank_account.bank_amount_out != 0 %}
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> {% translate "Refund" %} :
{% if bank_account.operation_comment %}
{{ bank_account.operation_comment }}
{% else %}
{% translate "Payment" %}
{% endif %} : {{ bank_account.bank_amount_out }}
<small>({{ bank_account.operation_date | date:"DATE_FORMAT" }})</small><br>
{% endif %}
{% endfor %}
<div class="panel">
{% if object %}
<h4><span class="glyphicon glyphicon-log-in" aria-hidden="true"></span> {% translate "New balance" %} : {{ object.<API key> }}
<small>({{ object.date_balance | date:"DATE_FORMAT" }}{% if not <API key> and object.invoice_sort_order %} - {% translate "last sale" %}{% endif %})</small>
</h4>
{% else %}
<h4><span class="glyphicon glyphicon-log-in" aria-hidden="true"></span> {% translate "New balance" %} : {{ producer.<API key> }}
<small>({{ producer.date_balance | date:"DATE_FORMAT" }}{% if not <API key> %} - {% translate "last sale" %}{% endif %})</small>
</h4>
{% endif %}
<span id="basket_message">{{ basket_message }}</span>
</div>
<center>
<div class="btn-group">
{% if <API key> %}
<a href="{% if uuid %}{% url 'repanier:<API key>' <API key> uuid %}{% else %}{% url 'repanier:<API key>' <API key> %}?producer={{ object.producer.id }}{% endif %}"
class="btn btn-info btn-disabled"> <span class="glyphicon <API key>"></span> </a>
{% endif %}
{% if <API key> %}
<a href="{% if uuid %}{% url 'repanier:<API key>' 0 uuid %}{% else %}{% url 'repanier:<API key>' 0 %}?producer={{ object.producer.id }}{% endif %}"
class="btn btn-disabled"> {% translate "Invoice" %} </a>
{% else %}
<span class="btn btn-disabled">{% translate "Invoice" %}</span>
{% endif %}
{% if <API key> %}
<a href="
{% if uuid %}{% url 'repanier:<API key>' <API key> uuid %}{% else %}{% url 'repanier:<API key>' <API key> %}?producer={{ object.producer.id }}{% endif %}"
class="btn btn-info btn-disabled"> <span class="glyphicon <API key>"></span> </a>
{% endif %}
</div>
</center>
{% if offer_item_set %}
<br>
<table class="table table-hover table-bordered">
<thead>
<tr>
<th>
{% translate "Reference" %}
</th>
<th>
{% translate "Product" %}
</th>
<th>
{% translate "Qty" %}
</th>
<th>
{% translate "Unit price" %}
</th>
<th>
{% translate "Total price" %}
</th>
<tr>
</thead>
<tbody>
{% for offer_item in offer_item_set %}
<tr>
<td>
{% if offer_item.reference|length < 36 %}
{{ offer_item.reference }}
{% endif %}
</td>
<td>
{{ offer_item.<API key> }}
</td>
<td align="right">
{{ offer_item.quantity_invoiced }}
</td>
<td align="right">
{{ offer_item.<API key> }}{% if offer_item.unit_deposit != 0 %}, {{ offer_item.unit_deposit }}{% endif %}
</td>
<td align="right">
{{ offer_item.<API key> }}
</td>
<tr>
{% endfor %}
</tbody>
</table>
{% else %}
<h4>{% translate "No purchase found" %}</h4>
{% endif %}
</div>
</div>
<div class="hidden-xs">
<br>
</div>
{% addtoblock "lastjs" %}
<script>
$(document).ready(function () {
lien = '{% url 'repanier:order_name' %}';
$.ajax({
url: lien,
cache: false,
async: false,
success: function (result) {
$.each(result, function (key, val) {
$(key).html(val);
});
}
{# success: function (result) {#}
{# $("#my_name").html(result);#}
{
{# error: function (result) {#}
{# $("#my_name").html("{% translate "Retry5" %}");#}
{
});
});
</script>
{% endaddtoblock %}
{% addtoblock "lastjs" %}
{% if not <API key> %}
<script>
$(document).ready(function () {
var lien = '{% url 'repanier:<API key>' producer.id producer.uuid %}';
$.ajax({
url: lien,
cache: false,
dataType: 'json',
async: true,
success: function (result) {
$.each(result, function (key, val) {
$(key).html(val);
});
}
{# success: function (result) {#}
{# $.each(result, function (key, val) {#}
{# $(val.id).html(val.html);#}
{
{
{# error: function (result) {#}
{# $("#basket_message").html("{% translate "Retry" %}");#}
{
});
});
</script>
{% endif %}
{% endaddtoblock %}
{% endblock %}
|
#include <stdio.h>
/* interface my */
#include "gystogra.h"
/* interface our util */
#include "skew1024.h"
using namespace cf;
Bool MakeTopBotGysts(Rect16 *pRc, int nRc, int32_t Skew, int MaxSize,
Un_GYST *pBegGt, Un_GYST *pEndGt) {
int MinBeg, MaxBeg, MinEnd, MaxEnd, i, End;
long dy, ddy;
int32_t x, yBeg, yEnd;
int32_t SkewSquar;
int *pBegSig, *pEndSig;
SkewSquar = Skew * Skew;
pBegGt->nElem = nRc;
pEndGt->nElem = nRc;
pBegSig = pBegGt->Signal;
pEndSig = pEndGt->Signal;
x = (pRc[0].left + pRc[0].right + 1) / 2;
dy = ((-Skew * x + 0x200) >> 10);
yBeg = pRc[0].top;
yEnd = pRc[0].bottom;
ddy = ((SkewSquar * yBeg + 0x100000) >> 21);
yBeg += dy;
yBeg -= ddy;
ddy = ((SkewSquar * yEnd + 0x100000) >> 21);
yEnd += dy;
yEnd -= ddy;
MinBeg = yBeg;
MaxBeg = yBeg;
MinEnd = yEnd;
MaxEnd = yEnd;
for (i = 1; i < nRc; i++) {
x = (pRc[i].left + pRc[i].right + 1) / 2;
dy = ((-Skew * x + 0x200) >> 10);
yBeg = pRc[i].top;
yEnd = pRc[i].bottom;
ddy = ((SkewSquar * yBeg + 0x100000) >> 21);
yBeg += dy;
yBeg -= ddy;
ddy = ((SkewSquar * yEnd + 0x100000) >> 21);
yEnd += dy;
yEnd -= ddy;
if (MinBeg > yBeg)
MinBeg = yBeg;
if (MaxBeg < yBeg)
MaxBeg = yBeg;
if (MinEnd > yEnd)
MinEnd = yEnd;
if (MaxEnd < yEnd)
MaxEnd = yEnd;
}
if (MaxBeg - MinBeg >= MaxSize)
return FALSE;
if (MaxEnd - MinEnd >= MaxSize)
return FALSE;
pBegGt->Shift = MinBeg;
pBegGt->End = MaxBeg - MinBeg;
pEndGt->Shift = MinEnd;
pEndGt->End = MaxEnd - MinEnd;
End = pBegGt->End;
if (End < pEndGt->End)
End = pEndGt->End;
for (i = 0; i <= End; i++) {
pBegSig[i] = 0;
pEndSig[i] = 0;
}
for (i = 0; i < nRc; i++) {
x = (pRc[i].left + pRc[i].right + 1) / 2;
dy = ((-Skew * x + 0x200) >> 10);
yBeg = pRc[i].top;
yEnd = pRc[i].bottom;
ddy = ((SkewSquar * yBeg + 0x100000) >> 21);
yBeg += dy;
yBeg -= ddy;
ddy = ((SkewSquar * yEnd + 0x100000) >> 21);
yEnd += dy;
yEnd -= ddy;
pBegSig[yBeg - MinBeg]++;
pEndSig[yEnd - MinEnd]++;
}
return TRUE;
}
Bool MakeLefRigGysts(Rect16 *pRc, int nRc, int32_t Skew, int MaxSize,
Un_GYST *pBegGt, Un_GYST *pEndGt) {
int MinBeg, MaxBeg, MinEnd, MaxEnd, i, End;
long dx, ddx;
int32_t y, xBeg, xEnd;
int32_t SkewSquar;
int *pBegSig, *pEndSig;
SkewSquar = Skew * Skew;
pBegGt->nElem = nRc;
pEndGt->nElem = nRc;
pBegSig = pBegGt->Signal;
pEndSig = pEndGt->Signal;
y = (pRc[0].top + pRc[0].bottom + 1) / 2;
dx = ((-Skew * y + 0x200) >> 10);
xBeg = pRc[0].left;
xEnd = pRc[0].right;
ddx = ((SkewSquar * xBeg + 0x100000) >> 21);
xBeg -= dx;
xBeg -= ddx;
ddx = ((SkewSquar * xEnd + 0x100000) >> 21);
xEnd -= dx;
xEnd -= ddx;
MinBeg = xBeg;
MaxBeg = xBeg;
MinEnd = xEnd;
MaxEnd = xEnd;
for (i = 1; i < nRc; i++) {
y = (pRc[i].top + pRc[i].bottom + 1) / 2;
dx = ((-Skew * y + 0x200) >> 10);
xBeg = pRc[i].left;
xEnd = pRc[i].right;
ddx = ((SkewSquar * xBeg + 0x100000) >> 21);
xBeg -= dx;
xBeg -= ddx;
ddx = ((SkewSquar * xEnd + 0x100000) >> 21);
xEnd -= dx;
xEnd -= ddx;
if (MinBeg > xBeg)
MinBeg = xBeg;
if (MaxBeg < xBeg)
MaxBeg = xBeg;
if (MinEnd > xEnd)
MinEnd = xEnd;
if (MaxEnd < xEnd)
MaxEnd = xEnd;
}
if (MaxBeg - MinBeg >= MaxSize)
return FALSE;
if (MaxEnd - MinEnd >= MaxSize)
return FALSE;
pBegGt->Shift = MinBeg;
pBegGt->End = MaxBeg - MinBeg;
pEndGt->Shift = MinEnd;
pEndGt->End = MaxEnd - MinEnd;
End = pBegGt->End;
if (End < pEndGt->End)
End = pEndGt->End;
for (i = 0; i <= End; i++) {
pBegSig[i] = 0;
pEndSig[i] = 0;
}
for (i = 0; i < nRc; i++) {
y = (pRc[i].top + pRc[i].bottom + 1) / 2;
dx = ((-Skew * y + 0x200) >> 10);
xBeg = pRc[i].left;
xEnd = pRc[i].right;
ddx = ((SkewSquar * xBeg + 0x100000) >> 21);
xBeg -= dx;
xBeg -= ddx;
ddx = ((SkewSquar * xEnd + 0x100000) >> 21);
xEnd -= dx;
xEnd -= ddx;
pBegSig[xBeg - MinBeg]++;
pEndSig[xEnd - MinEnd]++;
}
return TRUE;
}
Bool MakeTopMidBotGysts(Rect16 *pRc, int nRc, int32_t Skew, int MaxSize,
Un_GYST *pBegGt, Un_GYST *pMidGt, Un_GYST *pEndGt) {
int MinBeg, MaxBeg, MinMid, MaxMid, MinEnd, MaxEnd, i, End;
long dy, ddy;
int32_t x, yBeg, yMid, yEnd;
int32_t SkewSquar;
int *pBegSig, *pMidSig, *pEndSig;
SkewSquar = Skew * Skew;
pBegGt->nElem = nRc;
pMidGt->nElem = nRc;
pEndGt->nElem = nRc;
pBegSig = pBegGt->Signal;
pMidSig = pMidGt->Signal;
pEndSig = pEndGt->Signal;
x = (pRc[0].left + pRc[0].right + 1) / 2;
dy = ((-Skew * x + 0x200) >> 10);
yBeg = pRc[0].top;
yMid = (pRc[0].top + pRc[0].bottom + 1) / 2;
yEnd = pRc[0].bottom;
ddy = ((SkewSquar * yBeg + 0x100000) >> 21);
yBeg += dy;
yBeg -= ddy;
ddy = ((SkewSquar * yMid + 0x100000) >> 21);
yMid += dy;
yMid -= ddy;
ddy = ((SkewSquar * yEnd + 0x100000) >> 21);
yEnd += dy;
yEnd -= ddy;
MinBeg = yBeg;
MaxBeg = yBeg;
MinMid = yMid;
MaxMid = yMid;
MinEnd = yEnd;
MaxEnd = yEnd;
for (i = 1; i < nRc; i++) {
x = (pRc[i].left + pRc[i].right + 1) / 2;
dy = ((-Skew * x + 0x200) >> 10);
yBeg = pRc[i].top;
yMid = (pRc[i].top + pRc[i].bottom + 1) / 2;
yEnd = pRc[i].bottom;
ddy = ((SkewSquar * yBeg + 0x100000) >> 21);
yBeg += dy;
yBeg -= ddy;
ddy = ((SkewSquar * yMid + 0x100000) >> 21);
yMid += dy;
yMid -= ddy;
ddy = ((SkewSquar * yEnd + 0x100000) >> 21);
yEnd += dy;
yEnd -= ddy;
if (MinBeg > yBeg)
MinBeg = yBeg;
if (MaxBeg < yBeg)
MaxBeg = yBeg;
if (MinMid > yMid)
MinMid = yMid;
if (MaxMid < yMid)
MaxMid = yMid;
if (MinEnd > yEnd)
MinEnd = yEnd;
if (MaxEnd < yEnd)
MaxEnd = yEnd;
}
if (MaxBeg - MinBeg >= MaxSize)
return FALSE;
if (MaxMid - MinMid >= MaxSize)
return FALSE;
if (MaxEnd - MinEnd >= MaxSize)
return FALSE;
pBegGt->Shift = MinBeg;
pBegGt->End = MaxBeg - MinBeg;
pMidGt->Shift = MinMid;
pMidGt->End = MaxMid - MinMid;
pEndGt->Shift = MinEnd;
pEndGt->End = MaxEnd - MinEnd;
End = pBegGt->End;
if (End < pMidGt->End)
End = pMidGt->End;
if (End < pEndGt->End)
End = pEndGt->End;
for (i = 0; i <= End; i++) {
pBegSig[i] = 0;
pMidSig[i] = 0;
pEndSig[i] = 0;
}
for (i = 0; i < nRc; i++) {
x = (pRc[i].left + pRc[i].right + 1) / 2;
dy = ((-Skew * x + 0x200) >> 10);
yBeg = pRc[i].top;
yMid = (pRc[i].top + pRc[i].bottom + 1) / 2;
yEnd = pRc[i].bottom;
ddy = ((SkewSquar * yBeg + 0x100000) >> 21);
yBeg += dy;
yBeg -= ddy;
ddy = ((SkewSquar * yMid + 0x100000) >> 21);
yMid += dy;
yMid -= ddy;
ddy = ((SkewSquar * yEnd + 0x100000) >> 21);
yEnd += dy;
yEnd -= ddy;
pBegSig[yBeg - MinBeg]++;
pMidSig[yMid - MinMid]++;
pEndSig[yEnd - MinEnd]++;
}
return TRUE;
}
Bool MakeLefMidRigGysts(Rect16 *pRc, int nRc, int32_t Skew, int MaxSize,
Un_GYST *pBegGt, Un_GYST *pMidGt, Un_GYST *pEndGt) {
int MinBeg, MaxBeg, MinMid, MaxMid, MinEnd, MaxEnd, i, End;
long dx, ddx;
int32_t y, xBeg, xMid, xEnd;
int32_t SkewSquar;
int *pBegSig, *pMidSig, *pEndSig;
SkewSquar = Skew * Skew;
pBegGt->nElem = nRc;
pMidGt->nElem = nRc;
pEndGt->nElem = nRc;
pBegSig = pBegGt->Signal;
pMidSig = pMidGt->Signal;
pEndSig = pEndGt->Signal;
y = (pRc[0].top + pRc[0].bottom + 1) / 2;
dx = ((-Skew * y + 0x200) >> 10);
xBeg = pRc[0].left;
xMid = (pRc[0].left + pRc[0].right + 1) / 2;
xEnd = pRc[0].right;
ddx = ((SkewSquar * xBeg + 0x100000) >> 21);
xBeg -= dx;
xBeg -= ddx;
ddx = ((SkewSquar * xMid + 0x100000) >> 21);
xMid -= dx;
xMid -= ddx;
ddx = ((SkewSquar * xEnd + 0x100000) >> 21);
xEnd -= dx;
xEnd -= ddx;
MinBeg = xBeg;
MaxBeg = xBeg;
MinMid = xMid;
MaxMid = xMid;
MinEnd = xEnd;
MaxEnd = xEnd;
for (i = 1; i < nRc; i++) {
y = (pRc[i].top + pRc[i].bottom + 1) / 2;
dx = ((-Skew * y + 0x200) >> 10);
xBeg = pRc[i].left;
xMid = (pRc[i].left + pRc[i].right + 1) / 2;
xEnd = pRc[i].right;
ddx = ((SkewSquar * xBeg + 0x100000) >> 21);
xBeg -= dx;
xBeg -= ddx;
ddx = ((SkewSquar * xMid + 0x100000) >> 21);
xMid -= dx;
xMid -= ddx;
ddx = ((SkewSquar * xEnd + 0x100000) >> 21);
xEnd -= dx;
xEnd -= ddx;
if (MinBeg > xBeg)
MinBeg = xBeg;
if (MaxBeg < xBeg)
MaxBeg = xBeg;
if (MinMid > xMid)
MinMid = xMid;
if (MaxMid < xMid)
MaxMid = xMid;
if (MinEnd > xEnd)
MinEnd = xEnd;
if (MaxEnd < xEnd)
MaxEnd = xEnd;
}
if (MaxBeg - MinBeg >= MaxSize)
return FALSE;
if (MaxMid - MinMid >= MaxSize)
return FALSE;
if (MaxEnd - MinEnd >= MaxSize)
return FALSE;
pBegGt->Shift = MinBeg;
pBegGt->End = MaxBeg - MinBeg;
pMidGt->Shift = MinMid;
pMidGt->End = MaxMid - MinMid;
pEndGt->Shift = MinEnd;
pEndGt->End = MaxEnd - MinEnd;
End = pBegGt->End;
if (End < pMidGt->End)
End = pMidGt->End;
if (End < pEndGt->End)
End = pEndGt->End;
for (i = 0; i <= End; i++) {
pBegSig[i] = 0;
pMidSig[i] = 0;
pEndSig[i] = 0;
}
for (i = 0; i < nRc; i++) {
y = (pRc[i].top + pRc[i].bottom + 1) / 2;
dx = ((-Skew * y + 0x200) >> 10);
xBeg = pRc[i].left;
xMid = (pRc[i].left + pRc[i].right + 1) / 2;
xEnd = pRc[i].right;
ddx = ((SkewSquar * xBeg + 0x100000) >> 21);
xBeg -= dx;
xBeg -= ddx;
ddx = ((SkewSquar * xMid + 0x100000) >> 21);
xMid -= dx;
xMid -= ddx;
ddx = ((SkewSquar * xEnd + 0x100000) >> 21);
xEnd -= dx;
xEnd -= ddx;
pBegSig[xBeg - MinBeg]++;
pMidSig[xMid - MinMid]++;
pEndSig[xEnd - MinEnd]++;
}
return TRUE;
}
int ScoreComp(const Rect16 *pRcReg, const int32_t Skew, const Rect16 *pRc,
const int nRc) {
int i, k;
Point PosIdeal;
k = 0;
for (i = 0; i < nRc; i++) {
if (pRc[i].right - pRc[i].left < 2)
continue;
if (pRc[i].right - pRc[i].left > 100)
continue;
if (pRc[i].bottom - pRc[i].top < 2)
continue;
if (pRc[i].bottom - pRc[i].top > 100)
continue;
PosIdeal.rx() = (int) (.5 * (pRc[i].left + pRc[i].right + 1));
PosIdeal.ry() = (int) (.5 * (pRc[i].top + pRc[i].bottom + 1));
PosIdeal.deskew(-Skew);
if (PosIdeal.x() > pRcReg->right)
continue;
if (PosIdeal.x() < pRcReg->left)
continue;
if (PosIdeal.y() > pRcReg->bottom)
continue;
if (PosIdeal.y() < pRcReg->top)
continue;
k++;
}
return k;
}
void MakeNormVertGyst(const Rect16 *pRcReg, const int32_t Skew,
const Rect16 *pRc, const int nRc, int *Sig) {
int i, k;
Point BegDirIdeal;
Point EndDirIdeal;
for (i = 0; i < nRc; i++) {
if (pRc[i].right - pRc[i].left < 2)
continue;
if (pRc[i].right - pRc[i].left > 100)
continue;
if (pRc[i].bottom - pRc[i].top < 2)
continue;
if (pRc[i].bottom - pRc[i].top > 100)
continue;
BegDirIdeal.rx() = (int) (.5 * (pRc[i].left + pRc[i].right + 1));
BegDirIdeal.ry() = pRc[i].top;
BegDirIdeal.deskew(-Skew);
if (BegDirIdeal.x() > pRcReg->right)
continue;
if (BegDirIdeal.x() < pRcReg->left)
continue;
if (BegDirIdeal.y() >= pRcReg->bottom)
continue;
if (BegDirIdeal.y() < pRcReg->top)
BegDirIdeal.ry() = pRcReg->top;
EndDirIdeal.rx() = (int) (.5 * (pRc[i].left + pRc[i].right + 1));
EndDirIdeal.ry() = pRc[i].bottom;
EndDirIdeal.deskew(-Skew);
if (EndDirIdeal.y() <= pRcReg->top)
continue;
if (EndDirIdeal.y() > pRcReg->bottom)
EndDirIdeal.ry() = pRcReg->bottom;
for (k = BegDirIdeal.y(); k <= EndDirIdeal.y(); k++)
Sig[k - pRcReg->top]++;
}
}
Bool MakeVertGysts(Rect16 *pRc, int nRc, int32_t Skew, int Amnist, int MaxSize,
Un_GYST *pVerGt, int *pWhatDo) {
int MinBeg, MaxBeg, MinEnd, MaxEnd, CurBeg, CurEnd, i, End, k, iFirst;
Point BegDirIdeal;
Point EndDirIdeal;
iFirst = -1;
for (i = 0; i < nRc; i++) {
if (pWhatDo[i] != 1)
continue;
iFirst = i;
break;
}
if (iFirst == -1)
return FALSE;
BegDirIdeal.rx() = (int) (.5 * (pRc[iFirst].left + pRc[iFirst].right + 1));
BegDirIdeal.ry() = pRc[iFirst].top;
BegDirIdeal.deskew(-Skew);
MinBeg = BegDirIdeal.y();
MaxBeg = BegDirIdeal.y();
EndDirIdeal.rx() = (int) (.5 * (pRc[iFirst].left + pRc[iFirst].right + 1));
EndDirIdeal.ry() = pRc[iFirst].bottom;
EndDirIdeal.deskew(-Skew);
MinEnd = EndDirIdeal.y();
MaxEnd = EndDirIdeal.y();
for (i = iFirst + 1; i < nRc; i++) {
if (pWhatDo[i] != 1)
continue;
BegDirIdeal.rx() = (int) (.5 * (pRc[i].left + pRc[i].right + 1));
BegDirIdeal.ry() = pRc[i].top;
BegDirIdeal.deskew(-Skew);
CurBeg = BegDirIdeal.y();
EndDirIdeal.rx() = (int) (.5 * (pRc[i].left + pRc[i].right + 1));
EndDirIdeal.ry() = pRc[i].bottom;
EndDirIdeal.deskew(-Skew);
CurEnd = EndDirIdeal.y();
if (MinBeg > CurBeg)
MinBeg = CurBeg;
if (MaxBeg < CurBeg)
MaxBeg = CurBeg;
if (MinEnd > CurEnd)
MinEnd = CurEnd;
if (MaxEnd < CurEnd)
MaxEnd = CurEnd;
}
if (MaxBeg - MinBeg >= MaxSize)
return FALSE;
if (MaxEnd - MinEnd >= MaxSize)
return FALSE;
if (MinBeg > MinEnd)
return FALSE;
if (MaxBeg > MaxEnd)
return FALSE;
pVerGt->Shift = MinBeg;
pVerGt->End = MaxEnd - MinBeg;
pVerGt->nElem = nRc;
End = pVerGt->End;
for (i = 0; i <= End; i++) {
pVerGt->Signal[i] = 0;
}
for (i = 0; i < nRc; i++) {
if (pWhatDo[i] != 1)
continue;
BegDirIdeal.rx() = (int) (.5 * (pRc[i].left + pRc[i].right + 1));
BegDirIdeal.ry() = pRc[i].top;
BegDirIdeal.deskew(-Skew);
CurBeg = BegDirIdeal.y();
EndDirIdeal.rx() = (int) (.5 * (pRc[i].left + pRc[i].right + 1));
EndDirIdeal.ry() = pRc[i].bottom;
EndDirIdeal.deskew(-Skew);
CurEnd = EndDirIdeal.y();
for (k = CurBeg + Amnist; k <= CurEnd - Amnist; k++)
pVerGt->Signal[k - MinBeg]++;
}
return TRUE;
}
void MakeNormHoriGyst(const Rect16 *pRcReg, const int32_t Skew,
const Rect16 *pRc, const int nRc, int *Sig) {
int i, k;
Point BegDirIdeal;
Point EndDirIdeal;
for (i = 0; i < nRc; i++) {
if (pRc[i].right - pRc[i].left < 2)
continue;
if (pRc[i].right - pRc[i].left > 100)
continue;
if (pRc[i].bottom - pRc[i].top < 2)
continue;
if (pRc[i].bottom - pRc[i].top > 100)
continue;
BegDirIdeal.rx() = pRc[i].left;
BegDirIdeal.ry() = (int) (.5 * (pRc[i].top + pRc[i].bottom + 1));
BegDirIdeal.deskew(-Skew);
if (BegDirIdeal.y() > pRcReg->bottom)
continue;
if (BegDirIdeal.y() < pRcReg->top)
continue;
if (BegDirIdeal.x() >= pRcReg->right)
continue;
if (BegDirIdeal.x() < pRcReg->left)
BegDirIdeal.rx() = pRcReg->left;
EndDirIdeal.rx() = pRc[i].right;
EndDirIdeal.ry() = (int) (.5 * (pRc[i].top + pRc[i].bottom + 1));
EndDirIdeal.deskew(-Skew);
if (EndDirIdeal.x() <= pRcReg->left)
continue;
if (EndDirIdeal.x() > pRcReg->right)
EndDirIdeal.rx() = pRcReg->right;
for (k = BegDirIdeal.x(); k <= EndDirIdeal.x(); k++)
Sig[k - pRcReg->left]++;
}
}
Bool MakeHoriGysts(Rect16 *pRc, int nRc, int32_t Skew, int MaxSize,
Un_GYST *pHorGt, int *pWhatDo) {
int MinBeg, MaxBeg, MinEnd, MaxEnd, CurBeg, CurEnd, i, End, k, iFirst;
Point BegDirIdeal;
Point EndDirIdeal;
iFirst = -1;
for (i = 0; i < nRc; i++) {
if (pWhatDo[i] != 1)
continue;
iFirst = i;
break;
}
if (iFirst == -1)
return FALSE;
BegDirIdeal.rx() = pRc[iFirst].left;
BegDirIdeal.ry() = (int) (.5 * (pRc[iFirst].top + pRc[iFirst].bottom + 1));
BegDirIdeal.deskew(-Skew);
MinBeg = BegDirIdeal.x();
MaxBeg = BegDirIdeal.x();
EndDirIdeal.rx() = pRc[iFirst].right;
EndDirIdeal.ry() = (int) (.5 * (pRc[iFirst].top + pRc[iFirst].bottom + 1));
EndDirIdeal.deskew(-Skew);
MinEnd = EndDirIdeal.x();
MaxEnd = EndDirIdeal.x();
for (i = iFirst + 1; i < nRc; i++) {
if (pWhatDo[i] != 1)
continue;
BegDirIdeal.rx() = pRc[i].left;
BegDirIdeal.ry() = (int) (.5 * (pRc[i].top + pRc[i].bottom + 1));
BegDirIdeal.deskew(-Skew);
CurBeg = BegDirIdeal.x();
EndDirIdeal.rx() = pRc[i].right;
EndDirIdeal.ry() = (int) (.5 * (pRc[i].top + pRc[i].bottom + 1));
EndDirIdeal.deskew(-Skew);
CurEnd = EndDirIdeal.x();
if (MinBeg > CurBeg)
MinBeg = CurBeg;
if (MaxBeg < CurBeg)
MaxBeg = CurBeg;
if (MinEnd > CurEnd)
MinEnd = CurEnd;
if (MaxEnd < CurEnd)
MaxEnd = CurEnd;
}
if (MaxBeg - MinBeg >= MaxSize)
return FALSE;
if (MaxEnd - MinEnd >= MaxSize)
return FALSE;
if (MinBeg > MinEnd)
return FALSE;
if (MaxBeg > MaxEnd)
return FALSE;
pHorGt->Shift = MinBeg;
pHorGt->End = MaxEnd - MinBeg;
pHorGt->nElem = nRc;
End = pHorGt->End;
for (i = 0; i <= End; i++) {
pHorGt->Signal[i] = 0;
}
for (i = 0; i < nRc; i++) {
if (pWhatDo[i] != 1)
continue;
BegDirIdeal.rx() = pRc[i].left;
BegDirIdeal.ry() = (int) (.5 * (pRc[i].top + pRc[i].bottom + 1));
BegDirIdeal.deskew(-Skew);
CurBeg = BegDirIdeal.x();
EndDirIdeal.rx() = pRc[i].right;
EndDirIdeal.ry() = (int) (.5 * (pRc[i].top + pRc[i].bottom + 1));
EndDirIdeal.deskew(-Skew);
CurEnd = EndDirIdeal.x();
for (k = CurBeg; k <= CurEnd; k++)
pHorGt->Signal[k - MinBeg]++;
}
return TRUE;
}
Bool MakeHoriSrez(Rect16 *pRcId, int nRc, int BegSrez, int EndSrez,
int MaxSize, Un_GYST *pHorGt, int *pWhatDo) {
int MinBeg, MaxBeg, MinEnd, MaxEnd, CurBeg, CurEnd, i, End, k, iFirst;
iFirst = -1;
for (i = 0; i < nRc; i++) {
if (pWhatDo[i] != 1)
continue;
iFirst = i;
break;
}
if (iFirst == -1)
return FALSE;
MinBeg = pRcId[iFirst].left;
MaxBeg = MinBeg;
MinEnd = pRcId[iFirst].right;
MaxEnd = MinEnd;
for (i = iFirst + 1; i < nRc; i++) {
if (pWhatDo[i] != 1)
continue;
CurBeg = pRcId[i].left;
CurEnd = pRcId[i].right;
if (MinBeg > CurBeg)
MinBeg = CurBeg;
if (MaxBeg < CurBeg)
MaxBeg = CurBeg;
if (MinEnd > CurEnd)
MinEnd = CurEnd;
if (MaxEnd < CurEnd)
MaxEnd = CurEnd;
}
if (MaxBeg - MinBeg >= MaxSize)
return FALSE;
if (MaxEnd - MinEnd >= MaxSize)
return FALSE;
if (MinBeg > MinEnd)
return FALSE;
if (MaxBeg > MaxEnd)
return FALSE;
pHorGt->Shift = MinBeg;
pHorGt->End = MaxEnd - MinBeg;
pHorGt->nElem = nRc;
End = pHorGt->End;
for (i = 0; i <= End; i++) {
pHorGt->Signal[i] = 0;
}
for (i = 0; i < nRc; i++) {
if (pWhatDo[i] != 1)
continue;
if (pRcId[i].top >= EndSrez)
continue;
if (pRcId[i].bottom <= BegSrez)
continue;
CurBeg = pRcId[i].left;
CurEnd = pRcId[i].right;
for (k = CurBeg; k <= CurEnd; k++)
pHorGt->Signal[k - MinBeg]++;
}
return TRUE;
}
Bool MakeVertSrez(Rect16 *pRcId, int nRc, int BegSrez, int EndSrez,
int MaxSize, Un_GYST *pVerGt, int *pWhatDo) {
int MinBeg, MaxBeg, MinEnd, MaxEnd, CurBeg, CurEnd, i, End, k, iFirst;
iFirst = -1;
for (i = 0; i < nRc; i++) {
if (pWhatDo[i] != 1)
continue;
iFirst = i;
break;
}
if (iFirst == -1)
return FALSE;
MinBeg = pRcId[iFirst].top;
MaxBeg = MinBeg;
MinEnd = pRcId[iFirst].bottom;
MaxEnd = MinEnd;
for (i = iFirst + 1; i < nRc; i++) {
if (pWhatDo[i] != 1)
continue;
CurBeg = pRcId[i].top;
CurEnd = pRcId[i].bottom;
if (MinBeg > CurBeg)
MinBeg = CurBeg;
if (MaxBeg < CurBeg)
MaxBeg = CurBeg;
if (MinEnd > CurEnd)
MinEnd = CurEnd;
if (MaxEnd < CurEnd)
MaxEnd = CurEnd;
}
if (MaxBeg - MinBeg >= MaxSize)
return FALSE;
if (MaxEnd - MinEnd >= MaxSize)
return FALSE;
if (MinBeg > MinEnd)
return FALSE;
if (MaxBeg > MaxEnd)
return FALSE;
pVerGt->Shift = MinBeg;
pVerGt->End = MaxEnd - MinBeg;
pVerGt->nElem = nRc;
End = pVerGt->End;
for (i = 0; i <= End; i++) {
pVerGt->Signal[i] = 0;
}
for (i = 0; i < nRc; i++) {
if (pWhatDo[i] != 1)
continue;
if (pRcId[i].left >= EndSrez)
continue;
if (pRcId[i].right <= BegSrez)
continue;
CurBeg = pRcId[i].top;
CurEnd = pRcId[i].bottom;
for (k = CurBeg; k <= CurEnd; k++)
pVerGt->Signal[k - MinBeg]++;
}
return TRUE;
}
Bool FindNextHole(Un_GYST *pDarkGt, int Beg, int End, int *NewBeg, int *NewEnd) {
int i;
Bool ret;
if (Beg > End)
return FALSE;
ret = FALSE;
for (i = Beg; i <= End; i++) {
if (i < pDarkGt->Shift)
continue;
if (i > pDarkGt->Shift + pDarkGt->End)
break;
if (pDarkGt->Signal[i - pDarkGt->Shift] > 0)
continue;
*NewBeg = i;
ret = TRUE;
break;
}
if (!ret)
return FALSE;
for (i = *NewBeg; i <= End; i++) {
if (i > pDarkGt->Shift + pDarkGt->End)
break;
if (pDarkGt->Signal[i - pDarkGt->Shift] > 0)
break;
*NewEnd = i;
continue;
}
return TRUE;
}
Bool <API key>(int MaxSig, Un_GYST *pDarkGt, int Beg, int End,
int *NewBeg, int *NewEnd, int MinLent) {
int i, Beg_C, End_C;
Bool ret;
if (Beg > End)
return FALSE;
Beg_C = Beg;
if (Beg_C < pDarkGt->Shift)
Beg_C = pDarkGt->Shift;
End_C = End;
if (End_C > pDarkGt->Shift + pDarkGt->End)
End_C = pDarkGt->Shift + pDarkGt->End;
if (Beg_C > End_C)
return FALSE;
while (Beg_C <= End_C) {
ret = FALSE;
for (i = Beg_C; i <= End_C; i++) {
if (pDarkGt->Signal[i - pDarkGt->Shift] > MaxSig)
continue;
*NewBeg = i;
ret = TRUE;
break;
}
if (!ret)
return FALSE;
*NewEnd = *NewBeg;
for (i = *NewBeg; i <= End_C; i++) {
if (pDarkGt->Signal[i - pDarkGt->Shift] > MaxSig)
break;
*NewEnd = i;
continue;
}
if (*NewEnd - *NewBeg >= MinLent)
return TRUE;
Beg_C = *NewEnd + 1;
}
return FALSE;
}
Bool <API key>(int *pSig, int LenSig, int Beg, int End,
int *NewBeg, int *NewEnd, int MaxSig, int MinLent) {
int i, Beg_C, End_C;
Bool ret;
if (Beg > End)
return FALSE;
Beg_C = Beg;
if (Beg_C < 0)
Beg_C = 0;
End_C = End;
if (End_C > LenSig - 1)
End_C = LenSig - 1;
if (Beg_C > End_C)
return FALSE;
while (Beg_C <= End_C) {
ret = FALSE;
for (i = Beg_C; i <= End_C; i++) {
if (pSig[i] > MaxSig)
continue;
*NewBeg = i;
ret = TRUE;
break;
}
if (!ret)
return FALSE;
*NewEnd = *NewBeg;
for (i = *NewBeg; i <= End_C; i++) {
if (pSig[i] > MaxSig)
break;
*NewEnd = i;
continue;
}
if (*NewEnd - *NewBeg >= MinLent)
return TRUE;
Beg_C = *NewEnd + 1;
}
return FALSE;
}
Bool FindMainHole(int Beg, int End, int MaxSig, Un_GYST *pOrtGt, int *NewBeg,
int *NewEnd, int *NewMax) {
int CurBeg, CurEnd, i, BegPos;
Bool ret;
ret = <API key>(MaxSig, pOrtGt, Beg, End, &CurBeg, &CurEnd, 0);
if (!ret)
return FALSE;
*NewBeg = CurBeg;
*NewEnd = CurEnd;
BegPos = *NewEnd + 1;
while (1) {
ret = <API key>(MaxSig, pOrtGt, BegPos, End, &CurBeg,
&CurEnd, 0);
if (!ret)
break;
BegPos = CurEnd + 1;
if (*NewEnd - *NewBeg > CurEnd - CurBeg)
continue;
*NewBeg = CurBeg;
*NewEnd = CurEnd;
}
*NewMax = pOrtGt->Signal[*NewBeg - pOrtGt->Shift];
for (i = *NewBeg; i <= *NewEnd; i++)
if (*NewMax < pOrtGt->Signal[i - pOrtGt->Shift])
*NewMax = pOrtGt->Signal[i - pOrtGt->Shift];
return TRUE;
}
|
package com.plotsquared.core.command;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import java.util.concurrent.CompletableFuture;
/**
* SubCommand class
*
* @see Command#Command(Command, boolean)
* @deprecated In favor of normal Command class
*/
public abstract class SubCommand extends Command {
public SubCommand() {
super(MainCommand.getInstance(), true);
}
public SubCommand(Argument<?>... arguments) {
this();
<API key>(arguments);
}
@Override
public CompletableFuture<Boolean> execute(
PlotPlayer<?> player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone
) {
return CompletableFuture.completedFuture(onCommand(player, args));
}
public abstract boolean onCommand(PlotPlayer<?> player, String[] args);
}
|
package com.cloudera.cmf.service.yarn;
import com.cloudera.cmf.command.flow.CmdWorkCtx;
import com.cloudera.cmf.command.flow.WorkOutput;
import com.cloudera.cmf.command.flow.work.<API key>;
import com.cloudera.cmf.model.DbProcess;
import com.cloudera.cmf.model.DbRole;
import com.cloudera.cmf.model.RoleState;
import com.cloudera.cmf.service.ServiceDataProvider;
import com.cloudera.cmf.service.components.ProcessHelper;
import com.cloudera.enterprise.MessageWithArgs;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import java.util.List;
public class <API key> extends <API key>
{
private <API key>(@JsonProperty("roleId") Long roleId)
{
super(roleId);
}
public MessageWithArgs getDescription(CmdWorkCtx ctx)
{
return MessageWithArgs.of("message.command.<API key>.desc", new String[0]);
}
public String getProcessName()
{
return "<API key>";
}
protected void <API key>(CmdWorkCtx ctx, DbProcess proc, DbRole role)
{
ctx.<API key>().getProcessHelper().runAsRole(proc, role);
List args = ImmutableList.of("resourcemanager", "-format-state-store");
proc.setProgram("yarn/yarn.sh");
proc.setArguments(args);
}
protected RoleState <API key>(WorkOutput output, CmdWorkCtx ctx)
{
return RoleState.STOPPED;
}
public static <API key> of(DbRole r) {
Preconditions.checkNotNull(r);
Preconditions.checkNotNull(r.getId());
Preconditions.checkArgument(YarnServiceHandler.RoleNames.RESOURCEMANAGER.name().equals(r.getRoleType()));
return new <API key>(r.getId());
}
}
|
<!DOCTYPE HTML PUBLIC "-
<!--NewPage
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.5.0_01) on Sun Jul 03 11:32:25 ICT 2005 -->
<TITLE>
com.golden.gamedev.engine.graphics Class Hierarchy (GTGE Add-Ons)
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="com.golden.gamedev.engine.graphics Class Hierarchy (GTGE Add-Ons)";
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<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"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Tree</B></FONT> </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">
<A HREF="../../../../../com/golden/gamedev/engine/audio/package-tree.html"><B>PREV</B></A>
<A HREF="../../../../../com/golden/gamedev/engine/jogl/package-tree.html"><B>NEXT</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?com/golden/gamedev/engine/graphics/package-tree.html" target="_top"><B>FRAMES</B></A>
<A HREF="package-tree.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>
Hierarchy For Package com.golden.gamedev.engine.graphics
</H2>
</CENTER>
<DL>
<DT><B>Package Hierarchies:</B><DD><A HREF="../../../../../overview-tree.html">All Packages</A></DL>
<HR>
<H2>
Class Hierarchy
</H2>
<UL>
<LI TYPE="circle">java.lang.<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang"><B>Object</B></A><UL>
<LI TYPE="circle">java.awt.<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/awt/Graphics.html" title="class or interface in java.awt"><B>Graphics</B></A><UL>
<LI TYPE="circle">java.awt.<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/awt/Graphics2D.html" title="class or interface in java.awt"><B>Graphics2D</B></A><UL>
<LI TYPE="circle">com.golden.gamedev.engine.graphics.<A HREF="../../../../../com/golden/gamedev/engine/graphics/NullGraphics.html" title="class in com.golden.gamedev.engine.graphics"><B>NullGraphics</B></A></UL>
</UL>
</UL>
</UL>
<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"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Tree</B></FONT> </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">
<A HREF="../../../../../com/golden/gamedev/engine/audio/package-tree.html"><B>PREV</B></A>
<A HREF="../../../../../com/golden/gamedev/engine/jogl/package-tree.html"><B>NEXT</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?com/golden/gamedev/engine/graphics/package-tree.html" target="_top"><B>FRAMES</B></A>
<A HREF="package-tree.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>
<i>Copyright © 2003-2005 Golden T Studios. All rights reserved. Use is subject to <a href=http:
</BODY>
</HTML>
|
package com.github.sandokandias.payments.interfaces.rest.model;
import com.github.sandokandias.payments.infrastructure.util.i18n.I18nMessage;
import lombok.Data;
import java.util.Set;
@Data
public class ErrorResponse {
private Set<I18nMessage> errors;
}
|
package pt.uminho.sysbio.biosynthframework.integration.model;
import pt.uminho.sysbio.biosynth.integration.io.dao.neo4j.<API key>;
public interface IntegrationEngine {
public IntegrationMap<String, <API key>> integrate(IntegrationMap<String, <API key>> imap);
}
|
// This file is part of the go-ethereum library.
// The go-ethereum library is free software: you can redistribute it and/or modify
// (at your option) any later version.
// The go-ethereum library is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
package api
import (
"math/big"
"github.com/ghostnetwrk/ghostnet/eth"
"github.com/ghostnetwrk/ghostnet/rpc/codec"
"github.com/ghostnetwrk/ghostnet/rpc/shared"
"github.com/ghostnetwrk/ghostnet/xeth"
)
const (
ShhApiVersion = "1.0"
)
var (
// mapping between methods and handlers
shhMapping = map[string]shhhandler{
"shh_version": (*shhApi).Version,
"shh_post": (*shhApi).Post,
"shh_hasIdentity": (*shhApi).HasIdentity,
"shh_newIdentity": (*shhApi).NewIdentity,
"shh_newFilter": (*shhApi).NewFilter,
"shh_uninstallFilter": (*shhApi).UninstallFilter,
"shh_getMessages": (*shhApi).GetMessages,
"<API key>": (*shhApi).GetFilterChanges,
}
)
func <API key>(method string) error {
return shared.<API key>(method, "whisper offline")
}
// net callback handler
type shhhandler func(*shhApi, *shared.Request) (interface{}, error)
// shh api provider
type shhApi struct {
xeth *xeth.XEth
ethereum *eth.Ethereum
methods map[string]shhhandler
codec codec.ApiCoder
}
// create a new whisper api instance
func NewShhApi(xeth *xeth.XEth, eth *eth.Ethereum, coder codec.Codec) *shhApi {
return &shhApi{
xeth: xeth,
ethereum: eth,
methods: shhMapping,
codec: coder.New(nil),
}
}
// collection with supported methods
func (self *shhApi) Methods() []string {
methods := make([]string, len(self.methods))
i := 0
for k := range self.methods {
methods[i] = k
i++
}
return methods
}
// Execute given request
func (self *shhApi) Execute(req *shared.Request) (interface{}, error) {
if callback, ok := self.methods[req.Method]; ok {
return callback(self, req)
}
return nil, shared.<API key>(req.Method)
}
func (self *shhApi) Name() string {
return shared.ShhApiName
}
func (self *shhApi) ApiVersion() string {
return ShhApiVersion
}
func (self *shhApi) Version(req *shared.Request) (interface{}, error) {
w := self.xeth.Whisper()
if w == nil {
return nil, <API key>(req.Method)
}
return w.Version(), nil
}
func (self *shhApi) Post(req *shared.Request) (interface{}, error) {
w := self.xeth.Whisper()
if w == nil {
return nil, <API key>(req.Method)
}
args := new(WhisperMessageArgs)
if err := self.codec.Decode(req.Params, &args); err != nil {
return nil, err
}
err := w.Post(args.Payload, args.To, args.From, args.Topics, args.Priority, args.Ttl)
if err != nil {
return false, err
}
return true, nil
}
func (self *shhApi) HasIdentity(req *shared.Request) (interface{}, error) {
w := self.xeth.Whisper()
if w == nil {
return nil, <API key>(req.Method)
}
args := new(WhisperIdentityArgs)
if err := self.codec.Decode(req.Params, &args); err != nil {
return nil, err
}
return w.HasIdentity(args.Identity), nil
}
func (self *shhApi) NewIdentity(req *shared.Request) (interface{}, error) {
w := self.xeth.Whisper()
if w == nil {
return nil, <API key>(req.Method)
}
return w.NewIdentity(), nil
}
func (self *shhApi) NewFilter(req *shared.Request) (interface{}, error) {
args := new(WhisperFilterArgs)
if err := self.codec.Decode(req.Params, &args); err != nil {
return nil, err
}
id := self.xeth.NewWhisperFilter(args.To, args.From, args.Topics)
return newHexNum(big.NewInt(int64(id)).Bytes()), nil
}
func (self *shhApi) UninstallFilter(req *shared.Request) (interface{}, error) {
args := new(FilterIdArgs)
if err := self.codec.Decode(req.Params, &args); err != nil {
return nil, err
}
return self.xeth.<API key>(args.Id), nil
}
func (self *shhApi) GetFilterChanges(req *shared.Request) (interface{}, error) {
w := self.xeth.Whisper()
if w == nil {
return nil, <API key>(req.Method)
}
// Retrieve all the new messages arrived since the last request
args := new(FilterIdArgs)
if err := self.codec.Decode(req.Params, &args); err != nil {
return nil, err
}
return self.xeth.<API key>(args.Id), nil
}
func (self *shhApi) GetMessages(req *shared.Request) (interface{}, error) {
w := self.xeth.Whisper()
if w == nil {
return nil, <API key>(req.Method)
}
// Retrieve all the cached messages matching a specific, existing filter
args := new(FilterIdArgs)
if err := self.codec.Decode(req.Params, &args); err != nil {
return nil, err
}
return self.xeth.WhisperMessages(args.Id), nil
}
|
package vrml.external.field;
import vrml.external.field.FieldTypes;
import vrml.external.Browser;
import java.awt.*;
import java.math.BigInteger;
public class EventInSFImage extends EventIn {
public EventInSFImage() { EventType = FieldTypes.SFIMAGE; }
public void setValue(int width, int height, int components, byte[] pixels) throws <API key> {
int count;
int pixcount;
String val;
BigInteger newval;
byte xx[];
if (pixels.length != (width*height*components)) {
throw new <API key>();
}
if ((components < 1) || (components > 4)) {
throw new <API key>();
}
// use BigInt to ensure sign bit does not frick us up.
xx = new byte[components+1];
xx[0] = (byte) 0; // no sign bit here!
val = new String("" + width + " " + height + " " + components);
if (pixels== null) { pixcount = 0;} else {pixcount=pixels.length;}
if (components == 1) {
for (count = 0; count < pixcount; count++) {
xx[1] = pixels[count];
newval = new BigInteger(xx);
//System.out.println ("Big int " + newval.toString(16));
val = val.concat(" 0x" + newval.toString(16));
}
}
if (components == 2) {
for (count = 0; count < pixcount; count+=2) {
xx[1] = pixels[count]; xx[2] = pixels[count+1];
newval = new BigInteger(xx);
//System.out.println ("Big int " + newval.toString(16));
val = val.concat(" 0x" + newval.toString(16));
}
}
if (components == 3) {
for (count = 0; count < pixcount; count+=3) {
xx[1] = pixels[count]; xx[2] = pixels[count+1]; xx[3]=pixels[count+2];
newval = new BigInteger(xx);
//System.out.println ("Big int " + newval.toString(16));
val = val.concat(" 0x" + newval.toString(16));
}
}
if (components == 4) {
for (count = 0; count < pixcount; count+=4) {
xx[1] = pixels[count]; xx[2] = pixels[count+1]; xx[3]=pixels[count+2]; xx[4]=pixels[count+3];
newval = new BigInteger(xx);
//System.out.println ("Big int " + newval.toString(16));
val = val.concat(" 0x" + newval.toString(16));
}
}
//System.out.println ("sending " + val);
Browser.newSendEvent (this, val.length() + ":" + val + " ");
return;
}
}
|
#include <cstdio>
template<typename T>
auto kitten(T x) __attribute__((noinline));
template<class T>
auto kitten(T t)
{
static T x = 0;
return (x += 1) + t;
}
int main()
{
printf("%d\n", kitten(1));
printf("%g\n", kitten(3.14));
}
|
#ifndef __BUF_H
#define __BUF_H
#include <const.h>
struct buf {
uint flag;
struct buf *prev;
struct buf *next;
struct buf *io_prev;
struct buf *io_next;
uint dev;
uint sector;
uchar data[BLK_SIZE];
};
struct dev {
uint active;
struct buf *prev;
struct buf *next;
struct buf *io_prev;
struct buf *io_next;
};
#define B_BUSY 0b1
#define B_VALID 0b10
#define B_DIRTY 0b100
#define B_ERROR 0b1000
extern struct buf buffer[NBUF];
extern struct buf bfreelist;
extern struct dev hd_dev;
void buf_init();
struct buf* buf_get(uint dev, uint sector);
int buf_relse(struct buf* bp);
struct buf* buf_read(uint dev, uint sector);
int buf_write(struct buf* b);
void dump_buf(struct buf* buf);
void hexdump_buf(struct buf* buf);
void <API key>();
#endif
|
import subprocess
import time
import sys
import re
class checkIfUp:
__shellPings = []
__shell2Nbst = []
__ipsToCheck = []
checkedIps = 0
onlineIps = 0
unreachable = 0
timedOut = 0
upIpsAddress = []
computerName = []
completeMacAddress = []
executionTime = 0
def __init__(self,fromIp,toIp):
startTime = time.time()
self.fromIp = fromIp # from 192.168.1.x
self.toIp = toIp # to 192.168.x.x
self.__checkIfIpIsValid(fromIp)
self.__checkIfIpIsValid(toIp)
self.__getRange(fromIp,toIp)
self.__shellToQueue()
#self.__checkIfUp() # run by the shellToQueue queue organizer
self.<API key>()
endTime = time.time()
self.executionTime = round(endTime - startTime,3)
def __checkIfIpIsValid(self,ip):
def validateRange(val):
# valid range => 1 <-> 255
try:
val = int(val)
if val < 0 or val > 255:
print "Invalid IP Range ("+str(val)+")"
sys.exit(0)
except:
print "Invalid IP"
sys.exit(0)
ip = ip.split(".")
firstVal = validateRange(ip[0])
secondVal = validateRange(ip[1])
thirdVal = validateRange(ip[2])
fourthVal = validateRange(ip[3])
return True
def __getRange(self,fromIp,toIp):
fromIp = fromIp.split(".")
toIp = toIp.split(".")
# toIp must be > fromIp
def ip3chars(ipBlock):
# input 1; output 001
ipBlock = str(ipBlock)
while len(ipBlock) != 3:
ipBlock = "0"+ipBlock
return ipBlock
fromIpRaw = ip3chars(fromIp[0])+ip3chars(fromIp[1])+ip3chars(fromIp[2])+ip3chars(fromIp[3])
toIpRaw = ip3chars(toIp[0])+ip3chars(toIp[1])+ip3chars(toIp[2])+ip3chars(toIp[3])
if fromIpRaw > toIpRaw:
# if from is bigger switch the order
temp = fromIp
fromIp = toIp
toIp = temp
currentIp = [0,0,0,0]
# all to integers
currentIp0 = int(fromIp[0])
currentIp1 = int(fromIp[1])
currentIp2 = int(fromIp[2])
currentIp3 = int(fromIp[3])
toIp0 = int(toIp[0])
toIp1 = int(toIp[1])
toIp2 = int(toIp[2])
toIp3 = int(toIp[3])
firstIp = str(currentIp0)+"."+str(currentIp1)+"."+str(currentIp2)+"."+str(currentIp3)
self.__ipsToCheck = [firstIp]
while currentIp3 != toIp3 or currentIp2 != toIp2 or currentIp1 != toIp1 or currentIp0 != toIp0:
currentIp3 += 1
if currentIp3 > 255:
currentIp3 = 0
currentIp2 += 1
if currentIp2 > 255:
currentIp2 = 0
currentIp1 += 1
if currentIp1 > 255:
currentIp1 = 0
currentIp0 += 1
addIp = str(currentIp0)+"."+str(currentIp1)+"."+str(currentIp2)+"."+str(currentIp3)
self.__ipsToCheck.append(addIp)
def __shellToQueue(self):
# write them in the shell queue
maxPingsAtOnce = 200
currentQueuedPings = 0
for pingIp in self.__ipsToCheck:
proc = subprocess.Popen(['ping','-n','1',pingIp],stdout=subprocess.PIPE,shell=True)
self.__shellPings.append(proc)
currentQueuedPings += 1
if currentQueuedPings >= maxPingsAtOnce:
#execute shells
self.__checkIfUp()
currentQueuedPings = 0
self.__shellPings = []
self.__checkIfUp() # execute last queue
def __checkIfUp(self):
# execute the shells & determine whether the host is up or not
for shellInQueue in self.__shellPings:
pingResult = ""
shellInQueue.wait()
while True:
line = shellInQueue.stdout.readline()
if line != "":
pingResult += line
else:
break;
self.checkedIps += 1
if 'unreachable' in pingResult:
self.unreachable += 1
elif 'timed out' in pingResult:
self.timedOut += 1
else:
self.onlineIps += 1
currentIp = self.__ipsToCheck[self.checkedIps-1]
self.upIpsAddress.append(currentIp)
def <API key>(self):
# shell queue for online hosts
maxShellsAtOnce = 255
currentQueuedNbst = 0
for onlineIp in self.upIpsAddress:
proc = subprocess.Popen(['\\Windows\\sysnative\\nbtstat.exe','-a',onlineIp],stdout=subprocess.PIPE,shell=True)
self.__shell2Nbst.append(proc)
currentQueuedNbst += 1
if currentQueuedNbst >= maxShellsAtOnce:
# execute shells
self.<API key>()
currentQueuedNbst = 0
self.__shell2Nbst = []
self.<API key>() # execute last queue
def <API key>(self):
# execute the shells and find host Name and MAC
for shellInQueue in self.__shell2Nbst:
nbstResult = ""
shellInQueue.wait()
computerNameLine = ""
macAddressLine = ""
computerName = ""
macAddress = ""
while True:
line = shellInQueue.stdout.readline()
if line != "":
if '<00>' in line and 'UNIQUE' in line:
computerNameLine = line
if 'MAC Address' in line:
macAddressLine = line
else:
break;
computerName = re.findall('([ ]+)(.*?)([ ]+)<00>', computerNameLine)
macAddress = re.findall('([A-Z0-9]+)-([A-Z0-9]+)-([A-Z0-9]+)-([A-Z0-9]+)-([A-Z0-9]+)-([A-Z0-9]+)',macAddressLine)
try:
self.computerName.append(computerName[0][1])
except:
self.computerName.append("")
completeMacAddress = ""
firstMacElement = 0
try:
for macEach in macAddress[0]:
if firstMacElement == 0:
firstMacElement += 1
else:
completeMacAddress += ":"
completeMacAddress += macEach
firstMacElement = 0
except:
completeMacAddress = ""
self.completeMacAddress.append(completeMacAddress)
def readValue(self):
# debugging use only
ips = []
for ip in self.completeMacAddress:
ips.append(ip)
return ips
print "\t\t
# brief tutorial
print "Sample input data:"
print "FromIP: 192.168.1.50"
print "ToIP: 192.168.1.20"
print "
# input
fromIp = raw_input("From: ")
toIp = raw_input("To: ")
# enter values to class
userRange = checkIfUp(fromIp,toIp)
# read class values
print ""
#print userRange.readValue() # debugging use only
print "Checked",userRange.checkedIps,"IPs"
print ""
print "Online:",str(userRange.onlineIps)+"/"+str(userRange.checkedIps)
print "Unreachable:",userRange.unreachable,"Timed out:",userRange.timedOut
print "" # newline
print "Online IPs:"
print "IP\t\tNAME\t\tMAC"
counter = 0
for onlineIp in userRange.upIpsAddress:
print onlineIp+"\t"+userRange.computerName[counter]+"\t"+userRange.completeMacAddress[counter]
counter += 1
print ""
print "Took",userRange.executionTime,"seconds"
|
package org.tritonus.debug;
import org.aspectj.lang.JoinPoint;
import javax.sound.midi.MidiSystem;
import javax.sound.midi.Synthesizer;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.SourceDataLine;
import org.tritonus.core.TMidiConfig;
import org.tritonus.core.TInit;
import org.tritonus.share.TDebug;
import org.tritonus.share.midi.TSequencer;
import org.tritonus.midi.device.alsa.AlsaSequencer;
import org.tritonus.midi.device.alsa.AlsaSequencer.<API key>;
import org.tritonus.midi.device.alsa.AlsaSequencer.<API key>;
import org.tritonus.midi.device.alsa.AlsaSequencer.<API key>;
import org.tritonus.midi.device.alsa.AlsaSequencer.<API key>;
import org.tritonus.midi.device.alsa.AlsaSequencer.LoaderThread;
import org.tritonus.midi.device.alsa.AlsaSequencer.MasterSynchronizer;
import org.tritonus.share.sampled.convert.<API key>;
/** Debugging output aspect.
*/
public aspect AJDebug
extends Utils
{
pointcut allExceptions(): handler(Throwable+);
// TAudioConfig, TMidiConfig, TInit
pointcut TMidiConfigCalls(): execution(* TMidiConfig.*(..));
pointcut TInitCalls(): execution(* TInit.*(..));
// share
// midi
pointcut MidiSystemCalls(): execution(* MidiSystem.*(..));
pointcut Sequencer(): execution(TSequencer+.new(..)) ||
execution(* TSequencer+.*(..)) ||
execution(* <API key>.*(..)) ||
execution(* <API key>.*(..)) ||
execution(* <API key>.*(..)) ||
execution(* <API key>.*(..)) ||
execution(LoaderThread.new(..)) ||
execution(* LoaderThread.*(..)) ||
execution(MasterSynchronizer.new(..)) ||
execution(* MasterSynchronizer.*(..));
// audio
pointcut AudioSystemCalls(): execution(* AudioSystem.*(..));
pointcut sourceDataLine():
call(* SourceDataLine+.*(..));
// OLD
// pointcut playerStates():
// execution(private void TPlayer.setState(int));
// currently not used
pointcut printVelocity(): execution(* <API key>.playTone(..)) && call(<API key>.ToneThread.new(..));
// pointcut tracedCall(): execution(protected void <API key>.doRealize() throws Exception);
// ACTIONS
before(): MidiSystemCalls()
{
if (TDebug.TraceMidiSystem) <API key>(thisJoinPoint);
}
after(): MidiSystemCalls()
{
if (TDebug.TraceSequencer) outLeavingJoinPoint(thisJoinPoint);
}
before(): Sequencer()
{
if (TDebug.TraceSequencer) <API key>(thisJoinPoint);
}
after(): Sequencer()
{
if (TDebug.TraceSequencer) outLeavingJoinPoint(thisJoinPoint);
}
before(): TInitCalls()
{
if (TDebug.TraceInit) <API key>(thisJoinPoint);
}
after(): TInitCalls()
{
if (TDebug.TraceInit) outLeavingJoinPoint(thisJoinPoint);
}
before(): TMidiConfigCalls()
{
if (TDebug.TraceMidiConfig) <API key>(thisJoinPoint);
}
after(): TMidiConfigCalls()
{
if (TDebug.TraceMidiConfig) outLeavingJoinPoint(thisJoinPoint);
}
// execution(* <API key>.read(..))
before(): execution(* <API key>.read())
{
if (TDebug.TraceAudioConverter) <API key>(thisJoinPoint);
}
after(): execution(* <API key>.read())
{
if (TDebug.TraceAudioConverter) outLeavingJoinPoint(thisJoinPoint);
}
before(): execution(* <API key>.read(byte[]))
{
if (TDebug.TraceAudioConverter) <API key>(thisJoinPoint);
}
after(): execution(* <API key>.read(byte[]))
{
if (TDebug.TraceAudioConverter) outLeavingJoinPoint(thisJoinPoint);
}
before(): execution(* <API key>.read(byte[], int, int))
{
if (TDebug.TraceAudioConverter) <API key>(thisJoinPoint);
}
after(): execution(* <API key>.read(byte[], int, int))
{
if (TDebug.TraceAudioConverter) outLeavingJoinPoint(thisJoinPoint);
}
after() returning(int nBytes): call(* <API key>.read(byte[], int, int))
{
if (TDebug.TraceAudioConverter) TDebug.out("returning bytes: " + nBytes);
}
// before(int nState): playerStates() && args(nState)
// // if (TDebug.TracePlayerStates)
// // TDebug.out("TPlayer.setState(): " + nState);
// before(): <API key>()
// // if (TDebug.<API key>)
// // TDebug.out("Entering: " + thisJoinPoint);
// Synthesizer around(): call(* MidiSystem.getSynthesizer())
// // Synthesizer s = proceed();
// // if (TDebug.TraceToneGenerator)
// // TDebug.out("MidiSystem.getSynthesizer() gives: " + s);
// // return s;
// // only to get no compilation errors
// return null;
// TODO: v gives an error; find out what to do
// before(int v): printVelocity() && args(nVelocity)
// if (TDebug.TraceToneGenerator)
// TDebug.out("velocity: " + v);
before(Throwable t): allExceptions() && args(t)
{
if (TDebug.TraceAllExceptions) TDebug.out(t);
}
}
/*** AJDebug.java ***/
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.