repo_name
stringlengths
4
116
path
stringlengths
3
942
size
stringlengths
1
7
content
stringlengths
3
1.05M
license
stringclasses
15 values
sunblithe/qt-everywhere-opensource-src-4.7.1
examples/declarative/tutorials/extending/chapter2-methods/piechart.cpp
2942
/**************************************************************************** ** ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor ** the names of its contributors may be used to endorse or promote ** products derived from this software without specific prior written ** permission. ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "piechart.h" #include <QPainter> #include <QDebug> PieChart::PieChart(QDeclarativeItem *parent) : QDeclarativeItem(parent) { // need to disable this flag to draw inside a QDeclarativeItem setFlag(QGraphicsItem::ItemHasNoContents, false); } QString PieChart::name() const { return m_name; } void PieChart::setName(const QString &name) { m_name = name; } QColor PieChart::color() const { return m_color; } void PieChart::setColor(const QColor &color) { m_color = color; } void PieChart::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) { QPen pen(m_color, 2); painter->setPen(pen); painter->setRenderHints(QPainter::Antialiasing, true); painter->drawPie(boundingRect(), 90 * 16, 290 * 16); } //![0] void PieChart::clearChart() { setColor(QColor(Qt::transparent)); update(); emit chartCleared(); } //![0]
lgpl-2.1
gmazzamuto/MAX1464-Arduino-library
src/MAX1464.h
1403
/* MAX1464 library for Arduino Copyright (C) 2016 Giacomo Mazzamuto <gmazzamuto@gmail.com> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library. If not, see <http://www.gnu.org/licenses/>. */ /** * \file */ #ifndef MAX1464_H #define MAX1464_H #include "lib/AbstractMAX1464.h" #include <SPI.h> /** * @brief Interface to the Maxim %MAX1464 Multichannel Sensor Signal Processor, * Arduino SPI library version. * * This class makes use of the Arduino SPI library with 4-wire data transfer * mode. */ class MAX1464 : public AbstractMAX1464 { public: MAX1464(const int chipSelect); virtual void begin(); virtual void end(); virtual void byteShiftOut( const uint8_t b, const char *debugMsg = NULL) const; virtual uint16_t wordShiftIn() const; private: SPISettings settings; }; #endif // MAX1464_H
lgpl-2.1
Chinchilla-Software-Com/CQRS
wiki/docs/4.2/coverage-report/Cqrs.EventStore/ProjectionReader.cs.gcov.html
11459
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>LCOV - doc-coverage.info - Cqrs.EventStore/ProjectionReader.cs</title> <link rel="stylesheet" type="text/css" href="../gcov.css"> </head> <body> <table width="100%" border=0 cellspacing=0 cellpadding=0> <tr><td class="title">Documentation Coverage Report</td></tr> <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr> <tr> <td width="100%"> <table cellpadding=1 border=0 width="100%"> <tr> <td width="10%" class="headerItem">Current view:</td> <td width="35%" class="headerValue"><a href="../index.html">top level</a> - <a href="index.html">Cqrs.EventStore</a> - ProjectionReader.cs</td> <td width="5%"></td> <td width="15%"></td> <td width="10%" class="headerCovTableHead">Hit</td> <td width="10%" class="headerCovTableHead">Total</td> <td width="15%" class="headerCovTableHead">Coverage</td> </tr> <tr> <td class="headerItem">Version:</td> <td class="headerValue">4.0</td> <td></td> <td class="headerItem">Artefacts:</td> <td class="headerCovTableEntry">4</td> <td class="headerCovTableEntry">4</td> <td class="headerCovTableEntryHi">100.0 %</td> </tr> <tr> <td class="headerItem">Date:</td> <td class="headerValue">2021-04-11 22:05:22</td> <td></td> </tr> <tr><td><img src="../glass.png" width=3 height=3 alt=""></td></tr> </table> </td> </tr> <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr> </table> <table cellpadding=0 cellspacing=0 border=0> <tr> <td><br></td> </tr> <tr> <td> <pre class="sourceHeading"> Line data Source code</pre> <pre class="source"> <span class="lineNum"> 1 </span> : #region Copyright <span class="lineNum"> 2 </span> : // // ----------------------------------------------------------------------- <span class="lineNum"> 3 </span> : // // &lt;copyright company=&quot;Chinchilla Software Limited&quot;&gt; <span class="lineNum"> 4 </span> : // // Copyright Chinchilla Software Limited. All rights reserved. <span class="lineNum"> 5 </span> : // // &lt;/copyright&gt; <span class="lineNum"> 6 </span> : // // ----------------------------------------------------------------------- <span class="lineNum"> 7 </span> : #endregion <span class="lineNum"> 8 </span> : <span class="lineNum"> 9 </span> : using System; <span class="lineNum"> 10 </span> : using System.Collections.Generic; <span class="lineNum"> 11 </span> : using System.Linq; <span class="lineNum"> 12 </span> : using System.Text; <span class="lineNum"> 13 </span> : using EventStore.ClientAPI; <span class="lineNum"> 14 </span> : using Newtonsoft.Json; <span class="lineNum"> 15 </span> : <span class="lineNum"> 16 </span> : namespace Cqrs.EventStore <span class="lineNum"> 17 </span> : { <span class="lineNum"> 18 </span> : /// &lt;summary&gt; <span class="lineNum"> 19 </span> : /// Reads projection streams from a Greg Young's Event sTore. <span class="lineNum"> 20 </span> : /// &lt;/summary&gt; <span class="lineNum"> 21 </span> : /// &lt;typeparam name=&quot;TAuthenticationToken&quot;&gt;The &lt;see cref=&quot;Type&quot;/&gt; of the authentication token.&lt;/typeparam&gt; <span class="lineNum"> 22 </span> : public abstract class ProjectionReader&lt;TAuthenticationToken&gt; <span class="lineNum"> 23 </span><span class="lineCov"> 1 : {</span> <span class="lineNum"> 24 </span> : /// &lt;summary&gt; <span class="lineNum"> 25 </span> : /// The &lt;see cref=&quot;IEventStoreConnection&quot;/&gt; used to read and write streams in the Greg Young Event Store. <span class="lineNum"> 26 </span> : /// &lt;/summary&gt; <span class="lineNum"> 27 </span> : protected IEventStoreConnectionHelper EventStoreConnectionHelper { get; set; } <span class="lineNum"> 28 </span> : <span class="lineNum"> 29 </span> : /// &lt;summary&gt; <span class="lineNum"> 30 </span> : /// The &lt;see cref=&quot;IEventDeserialiser{TAuthenticationToken}&quot;/&gt; used to deserialise events. <span class="lineNum"> 31 </span> : /// &lt;/summary&gt; <span class="lineNum"> 32 </span> : protected IEventDeserialiser&lt;TAuthenticationToken&gt; EventDeserialiser { get; set; } <span class="lineNum"> 33 </span> : <span class="lineNum"> 34 </span> : /// &lt;summary&gt; <span class="lineNum"> 35 </span> : /// Instantiates a new instance of &lt;see cref=&quot;ProjectionReader{TAuthenticationToken}&quot;/&gt;. <span class="lineNum"> 36 </span> : /// &lt;/summary&gt; <span class="lineNum"> 37 </span><span class="lineCov"> 1 : protected ProjectionReader(IEventStoreConnectionHelper eventStoreConnectionHelper, IEventDeserialiser&lt;TAuthenticationToken&gt; eventDeserialiser)</span> <span class="lineNum"> 38 </span> : { <span class="lineNum"> 39 </span> : EventStoreConnectionHelper = eventStoreConnectionHelper; <span class="lineNum"> 40 </span> : EventDeserialiser = eventDeserialiser; <span class="lineNum"> 41 </span> : } <span class="lineNum"> 42 </span> : <span class="lineNum"> 43 </span> : /// &lt;summary&gt; <span class="lineNum"> 44 </span> : /// Get a collection of data objects from a stream with the provided &lt;paramref name=&quot;streamName&quot;/&gt;. <span class="lineNum"> 45 </span> : /// &lt;/summary&gt; <span class="lineNum"> 46 </span> : /// &lt;param name=&quot;streamName&quot;&gt;The name of the stream to read events from.&lt;/param&gt; <span class="lineNum"> 47 </span><span class="lineCov"> 1 : protected IEnumerable&lt;dynamic&gt; GetDataByStreamName(string streamName)</span> <span class="lineNum"> 48 </span> : { <span class="lineNum"> 49 </span> : StreamEventsSlice eventCollection; <span class="lineNum"> 50 </span> : using (IEventStoreConnection connection = EventStoreConnectionHelper.GetEventStoreConnection()) <span class="lineNum"> 51 </span> : { <span class="lineNum"> 52 </span> : eventCollection = connection.ReadStreamEventsBackwardAsync(streamName, StreamPosition.End, 1, false).Result; <span class="lineNum"> 53 </span> : } <span class="lineNum"> 54 </span> : var jsonSerialiserSettings = EventDeserialiser.GetSerialisationSettings(); <span class="lineNum"> 55 </span> : var encoder = new UTF8Encoding(); <span class="lineNum"> 56 </span> : return <span class="lineNum"> 57 </span> : ( <span class="lineNum"> 58 </span> : ( <span class="lineNum"> 59 </span> : (IEnumerable&lt;dynamic&gt;)eventCollection.Events <span class="lineNum"> 60 </span> : .Select(e =&gt; JsonConvert.DeserializeObject(((dynamic)encoder.GetString(e.Event.Data)), jsonSerialiserSettings)) <span class="lineNum"> 61 </span> : .SingleOrDefault() <span class="lineNum"> 62 </span> : ) <span class="lineNum"> 63 </span> : ?? <span class="lineNum"> 64 </span> : ( <span class="lineNum"> 65 </span> : Enumerable.Empty&lt;dynamic&gt;() <span class="lineNum"> 66 </span> : ) <span class="lineNum"> 67 </span> : ) <span class="lineNum"> 68 </span> : .Select(x =&gt; x.Value); <span class="lineNum"> 69 </span> : } <span class="lineNum"> 70 </span> : <span class="lineNum"> 71 </span> : /// &lt;summary&gt; <span class="lineNum"> 72 </span> : /// Get a collection of &lt;typeparamref name=&quot;TData&quot;/&gt; from a stream with the provided &lt;paramref name=&quot;streamName&quot;/&gt;. <span class="lineNum"> 73 </span> : /// &lt;/summary&gt; <span class="lineNum"> 74 </span> : /// &lt;param name=&quot;streamName&quot;&gt;The name of the stream to read events from.&lt;/param&gt; <span class="lineNum"> 75 </span><span class="lineCov"> 1 : protected IEnumerable&lt;TData&gt; GetDataByStreamName&lt;TData&gt;(string streamName)</span> <span class="lineNum"> 76 </span> : { <span class="lineNum"> 77 </span> : IList&lt;TData&gt; data = GetDataByStreamName(streamName) <span class="lineNum"> 78 </span> : .Select(e =&gt; JsonConvert.DeserializeObject&lt;TData&gt;(e.ToString())) <span class="lineNum"> 79 </span> : .Cast&lt;TData&gt;() <span class="lineNum"> 80 </span> : .ToList(); <span class="lineNum"> 81 </span> : return data; <span class="lineNum"> 82 </span> : } <span class="lineNum"> 83 </span> : } <span class="lineNum"> 84 </span> : } </pre> </td> </tr> </table> <br> <table width="100%" border=0 cellspacing=0 cellpadding=0> <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr> <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.13</a></td></tr> </table> <br> </body> </html>
lgpl-2.1
capitalaslash/libmesh
include/geom/node.h
8273
// The libMesh Finite Element Library. // Copyright (C) 2002-2020 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #ifndef LIBMESH_NODE_H #define LIBMESH_NODE_H // Local includes #include "libmesh/point.h" #include "libmesh/dof_object.h" #include "libmesh/reference_counted_object.h" #include "libmesh/auto_ptr.h" // libmesh_make_unique // C++ includes #include <iostream> #include <vector> namespace libMesh { // forward declarations class Node; class MeshBase; class MeshRefinement; /** * A \p Node is like a \p Point, but with more information. A \p Node * is located in space and is associated with some \p (x,y,z) * coordinates. Additionally, a \p Node may be enumerated with a * global \p id. Finally, a \p Node may have an arbitrary number of * degrees of freedom associated with it. * * \author Benjamin S. Kirk * \date 2003 * \brief A geometric point in (x,y,z) space associated with a DOF. */ class Node : public Point, public DofObject, public ReferenceCountedObject<Node> { public: /** * Constructor. By default sets all entries to 0. Gives the point 0 in * \p LIBMESH_DIM dimensions with an \p id of \p Node::invalid_id. */ explicit Node (const Real x=0, const Real y=0, const Real z=0, const dof_id_type id = invalid_id); /** * Copy-constructor. * * \deprecated - anyone copying a Node would almost certainly be * better off copying the much cheaper Point or taking a reference * to the Node. */ #ifdef LIBMESH_ENABLE_DEPRECATED Node (const Node & n); #endif /** * Copy-constructor from a \p Point. Optionally assigned the \p id. */ explicit Node (const Point & p, const dof_id_type id = invalid_id); /** * Disambiguate constructing from non-Real scalars */ template <typename T, typename = typename boostcopy::enable_if_c<ScalarTraits<T>::value,void>::type> Node (const T x) : Point (x,0,0) { this->set_id() = invalid_id; } /** * Destructor. */ ~Node (); /** * Assign to a node from a point. */ Node & operator= (const Point & p); /** * \returns A \p Node copied from \p n and wrapped in a smart pointer. * * \deprecated - anyone copying a Node would almost certainly be * better off copying the much cheaper Point or taking a reference * to the Node. */ #ifdef LIBMESH_ENABLE_DEPRECATED static std::unique_ptr<Node> build (const Node & n); #endif /** * \returns A \p Node copied from \p p with id == \p id and wrapped in a smart pointer. */ static std::unique_ptr<Node> build (const Point & p, const dof_id_type id); /** * \returns A \p Node created from the specified (x,y,z) positions * with id == \p id and wrapped in a smart pointer. */ static std::unique_ptr<Node> build (const Real x, const Real y, const Real z, const dof_id_type id); /** * \returns \p true if the node is active. An active node is * defined as one for which \p id() is not \p Node::invalid_id. * Inactive nodes are nodes that are in the mesh but are not * connected to any elements. */ bool active () const; /** * \returns \p true if this node equals rhs, false otherwise. */ bool operator ==(const Node & rhs) const; /** * Prints relevant information about the node. */ void print_info (std::ostream & os=libMesh::out) const; /** * Prints relevant information about the node to a string. */ std::string get_info () const; #ifdef LIBMESH_HAVE_MPI unsigned int packed_size() const { const unsigned int header_size = 2; // use "(a+b-1)/b" trick to get a/b to round up static const unsigned int idtypes_per_Real = (sizeof(Real) + sizeof(largest_id_type) - 1) / sizeof(largest_id_type); return header_size + LIBMESH_DIM*idtypes_per_Real + this->packed_indexing_size(); } #endif // #ifdef LIBMESH_HAVE_MPI /** * \returns The number of nodes connected with this node. * Currently, this value is invalid (zero) except for * subdivision meshes. */ unsigned int valence() const { #ifdef LIBMESH_ENABLE_NODE_VALENCE return _valence; #else libmesh_not_implemented(); return libMesh::invalid_uint; #endif } /** * Sets the number of nodes connected with this node. */ void set_valence(unsigned int val); /** * Return which of pid1 and pid2 would be preferred by the current * load-balancing heuristic applied to this node. */ processor_id_type choose_processor_id(processor_id_type pid1, processor_id_type pid2) const; private: /** * This class need access to the node key information, * but no one else should be able to mess with it. */ friend class MeshRefinement; friend class Elem; #ifdef LIBMESH_ENABLE_NODE_VALENCE /** * Type used to store node valence. */ typedef unsigned char valence_idx_t; /** * The number of nodes connected with this node. * Currently, this value is invalid (zero) except for * subdivision meshes. */ valence_idx_t _valence; #endif }; // ------------------------------------------------------------ // Global Node functions inline std::ostream & operator << (std::ostream & os, const Node & n) { n.print_info(os); return os; } //------------------------------------------------------ // Inline functions inline Node::Node (const Real x, const Real y, const Real z, const dof_id_type dofid) : Point(x,y,z) #ifdef LIBMESH_ENABLE_NODE_VALENCE , _valence(0) #endif { this->set_id() = dofid; } #ifdef LIBMESH_ENABLE_DEPRECATED inline Node::Node (const Node & n) : Point(n), DofObject(n), ReferenceCountedObject<Node>() #ifdef LIBMESH_ENABLE_NODE_VALENCE , _valence(n._valence) #endif { libmesh_deprecated(); } #endif inline Node::Node (const Point & p, const dof_id_type dofid) : Point(p) #ifdef LIBMESH_ENABLE_NODE_VALENCE , _valence(0) #endif { // optionally assign the id. We have // to do it like this otherwise // Node n = Point p would erase // the id! if (dofid != invalid_id) this->set_id() = dofid; } inline Node::~Node () { } inline Node & Node::operator= (const Point & p) { (*this)(0) = p(0); #if LIBMESH_DIM > 1 (*this)(1) = p(1); #endif #if LIBMESH_DIM > 2 (*this)(2) = p(2); #endif return *this; } #ifdef LIBMESH_ENABLE_DEPRECATED inline std::unique_ptr<Node> Node::build(const Node & n) { libmesh_deprecated(); return libmesh_make_unique<Node>(n); } #endif inline std::unique_ptr<Node> Node::build(const Point & p, const dof_id_type id) { return libmesh_make_unique<Node>(p,id); } inline std::unique_ptr<Node> Node::build(const Real x, const Real y, const Real z, const dof_id_type id) { return libmesh_make_unique<Node>(x,y,z,id); } inline bool Node::active () const { return (this->id() != Node::invalid_id); } #ifdef LIBMESH_ENABLE_NODE_VALENCE inline void Node::set_valence (unsigned int val) { _valence = cast_int<valence_idx_t>(val); } #else inline void Node::set_valence (unsigned int) { libmesh_not_implemented(); } #endif // #ifdef LIBMESH_ENABLE_NODE_VALENCE } // namespace libMesh #endif // LIBMESH_NODE_H
lgpl-2.1
Groovounet/piranha
source/lib/gtl/doc/html/gtl__image__raw_8h.html
2551
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>GTL: Référence du fichier gtl_image_raw.h</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body> <!-- Généré par Doxygen 1.3.8 --> <div class="qindex"><a class="qindex" href="index.html">Page&nbsp;principale</a> | <a class="qindex" href="namespaces.html">Liste des namespaces</a> | <a class="qindex" href="hierarchy.html">Hiérarchie&nbsp;des&nbsp;classes</a> | <a class="qindex" href="annotated.html">Liste&nbsp;des&nbsp;classes</a> | <a class="qindex" href="files.html">Liste&nbsp;des&nbsp;fichiers</a> | <a class="qindex" href="namespacemembers.html">Membres&nbsp;de&nbsp;namespace</a> | <a class="qindex" href="functions.html">Membres&nbsp;de&nbsp;classe</a> | <a class="qindex" href="globals.html">Membres&nbsp;de&nbsp;fichier</a></div> <h1>Référence du fichier gtl_image_raw.h</h1>Classe CImageRAW, pour le chargement des images RAW. <a href="#_details">Plus de détails...</a> <p> <code>#include "<a class="el" href="gtl__image_8h-source.html">gtl_image.h</a>"</code><br> <code>#include &lt;string&gt;</code><br> <p> <a href="gtl__image__raw_8h-source.html">Aller au code source de ce fichier.</a><table border=0 cellpadding=0 cellspacing=0> <tr><td></td></tr> <tr><td colspan=2><br><h2>Namespaces</h2></td></tr> <tr><td class="memItemLeft" nowrap align=right valign=top>namespace &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="namespacegtl.html">gtl</a></td></tr> <tr><td colspan=2><br><h2>Classes</h2></td></tr> <tr><td class="memItemLeft" nowrap align=right valign=top>class &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classgtl_1_1_c_image_r_a_w.html">gtl::CImageRAW</a></td></tr> <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Classe pour le chargement des images RAW. <a href="classgtl_1_1_c_image_r_a_w.html#_details">Plus de détails...</a><br></td></tr> </table> <hr><a name="_details"></a><h2>Description détaillée</h2> Classe CImageRAW, pour le chargement des images RAW. <p> <dl compact><dt><b>Date:</b></dt><dd>02/10/2004</dd></dl> <p> Définition dans le fichier <a class="el" href="gtl__image__raw_8h-source.html">gtl_image_raw.h</a>.<hr size="1"><address style="align: right;"><small>Généré le Wed Jan 5 23:28:23 2005 pour GTL par <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border=0 ></a> 1.3.8 </small></address> </body> </html>
lgpl-2.1
ernanisp/Zeus.Net.NFe.NFCe
MDFe.Classes/Informacoes/tpComp.cs
350
using System.Xml.Serialization; namespace MDFe.Classes.Informacoes { public enum tpComp { [XmlEnum("01")] ValePedagio = 01, [XmlEnum("02")] ImpostosTaxasEContribuicoes = 02, [XmlEnum("03")] DespesasBancariasEmiosDePagamentoOutras = 03, [XmlEnum("99")] Outros = 99 } }
lgpl-2.1
bruceg/bglibs
iobuf/ibuf_seek.c
572
#include <errno.h> #include <sys/types.h> #include <unistd.h> #include "ibuf.h" /** Set the effective read position. */ int ibuf_seek(ibuf* in, unsigned offset) { iobuf* io; unsigned buf_start; io = &(in->io); buf_start = io->offset - io->buflen; if (offset >= buf_start && offset <= io->offset) io->bufstart = offset - buf_start; else { if (lseek(io->fd, offset, SEEK_SET) != (off_t)offset) IOBUF_SET_ERROR(io); io->offset = offset; io->buflen = 0; io->bufstart = 0; } in->count = 0; io->flags &= ~IOBUF_EOF; return 1; }
lgpl-2.1
jondo2010/OpenSG
Source/WindowSystem/GLUT/OSGGLUTWindow.h
7027
/*---------------------------------------------------------------------------*\ * OpenSG * * * * * * Copyright (C) 2000-2002 by the OpenSG Forum * * * * www.opensg.org * * * * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de * * * \*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*\ * License * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Library General Public License as published * * by the Free Software Foundation, version 2. * * * * This library is distributed in the hope that it will be useful, but * * WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * * Library General Public License for more details. * * * * You should have received a copy of the GNU Library General Public * * License along with this library; if not, write to the Free Software * * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * * \*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*\ * Changes * * * * * * * * * * * * * \*---------------------------------------------------------------------------*/ #ifndef _OSGGLUTWINDOW_H_ #define _OSGGLUTWINDOW_H_ #ifdef __sgi #pragma once #endif #if defined(OSG_WITH_GLUT) || defined(OSG_DO_DOC) #include "OSGGLUTWindowBase.h" OSG_BEGIN_NAMESPACE /*! \brief GLUT Window class. See \ref PageWindowGLUT for a description. \ingroup GrpWindowGLUTObj \ingroup GrpLibOSGWindowGLUT \includebasedoc */ class OSG_WINDOWGLUT_DLLMAPPING GLUTWindow : public GLUTWindowBase { public: typedef GLUTWindowBase Inherited; /*---------------------------------------------------------------------*/ /*! \name Sync */ /*! \{ */ virtual void changed(ConstFieldMaskArg whichField, UInt32 origin, BitVector detail); /*! \} */ /*---------------------------------------------------------------------*/ /*! \name Output */ /*! \{ */ virtual void dump( UInt32 uiIndent = 0, const BitVector bvFlags = 0) const; /*! \} */ /*---------------------------------------------------------------------*/ /*! \name Window functions */ /*! \{ */ virtual void init(GLInitFunctor oFunc = GLInitFunctor()); /*! \} */ /*---------------------------------------------------------------------*/ /*! \name Redefined */ /*! \{ */ virtual void activate (void); virtual void terminate(void); /*! \} */ /*========================= PROTECTED ===============================*/ protected: // Variables should all be in GLUTWindowBase. /*---------------------------------------------------------------------*/ /*! \name Constructors */ /*! \{ */ GLUTWindow(void); GLUTWindow(const GLUTWindow &source); /*! \} */ /*---------------------------------------------------------------------*/ /*! \name Destructors */ /*! \{ */ virtual ~GLUTWindow(void); /*! \} */ /*---------------------------------------------------------------------*/ /*! \name Init */ /*! \{ */ static void initMethod(InitPhase ePhase); /*! \} */ /*---------------------------------------------------------------------*/ /*! \name Window system implementation functions */ /*! \{ */ /*! \} */ /*========================== PRIVATE ================================*/ private: friend class FieldContainer; friend class GLUTWindowBase; // prohibit default functions (move to 'public' if you need one) void operator =(const GLUTWindow &source); }; OSG_END_NAMESPACE #include "OSGGLUTWindow.inl" #include "OSGGLUTWindowBase.inl" #endif /* OSG_WITH_GLUT */ #endif /* _OSGGLUTWINDOW_H_ */
lgpl-2.1
meg0man/languagetool
languagetool-language-modules/uk/src/main/java/org/languagetool/tokenizers/uk/UkrainianWordTokenizer.java
13891
/* LanguageTool, a natural language style checker * Copyright (C) 2005 Daniel Naber (http://www.danielnaber.de) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 * USA */ package org.languagetool.tokenizers.uk; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map.Entry; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.StringTokenizer; import org.languagetool.tokenizers.Tokenizer; /** * Tokenizes a sentence into words. * Punctuation and whitespace gets its own token. * Specific to Ukrainian: apostrophes (0x27 and U+2019) not in the list as they are part of the word * * @author Andriy Rysin */ public class UkrainianWordTokenizer implements Tokenizer { private static final String SPLIT_CHARS = "\u0020\u00A0" + "\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007" + "\u2008\u2009\u200A\u200B\u200c\u200d\u200e\u200f" + "\u2028\u2029\u202a\u202b\u202c\u202d\u202e\u202f" + "\u205F\u2060\u2061\u2062\u2063\u206A\u206b\u206c\u206d" + "\u206E\u206F\u3000\u3164\ufeff\uffa0\ufff9\ufffa\ufffb" + ",.;()[]{}<>!?:/|\\\"«»„”“…¿¡\t\n\r\uE100\uE101\uE102\uE110"; // for handling exceptions private static final char DECIMAL_COMMA_SUBST = '\uE001'; // some unused character to hide comma in decimal number temporary for tokenizer run private static final char NON_BREAKING_SPACE_SUBST = '\uE002'; private static final char NON_BREAKING_DOT_SUBST = '\uE003'; // some unused character to hide dot in date temporary for tokenizer run private static final char NON_BREAKING_COLON_SUBST = '\uE004'; // decimal comma between digits private static final Pattern DECIMAL_COMMA_PATTERN = Pattern.compile("([\\d]),([\\d])", Pattern.CASE_INSENSITIVE|Pattern.UNICODE_CASE); private static final String DECIMAL_COMMA_REPL = "$1" + DECIMAL_COMMA_SUBST + "$2"; // space between digits private static final Pattern DECIMAL_SPACE_PATTERN = Pattern.compile("(?<=^|[\\s(])\\d{1,3}( [\\d]{3})+(?=[\\s(]|$)", Pattern.CASE_INSENSITIVE|Pattern.UNICODE_CASE); // dots in numbers private static final Pattern DOTTED_NUMBERS_PATTERN = Pattern.compile("([\\d])\\.([\\d])", Pattern.CASE_INSENSITIVE|Pattern.UNICODE_CASE); private static final String DOTTED_NUMBERS_REPL = "$1" + NON_BREAKING_DOT_SUBST + "$2"; // colon in numbers private static final Pattern COLON_NUMBERS_PATTERN = Pattern.compile("([\\d]):([\\d])", Pattern.CASE_INSENSITIVE|Pattern.UNICODE_CASE); private static final String COLON_NUMBERS_REPL = "$1" + NON_BREAKING_COLON_SUBST + "$2"; // dates private static final Pattern DATE_PATTERN = Pattern.compile("([\\d]{2})\\.([\\d]{2})\\.([\\d]{4})|([\\d]{4})\\.([\\d]{2})\\.([\\d]{2})|([\\d]{4})-([\\d]{2})-([\\d]{2})", Pattern.CASE_INSENSITIVE|Pattern.UNICODE_CASE); private static final String DATE_PATTERN_REPL = "$1" + NON_BREAKING_DOT_SUBST + "$2" + NON_BREAKING_DOT_SUBST + "$3"; // braces in words private static final Pattern BRACE_IN_WORD_PATTERN = Pattern.compile("([а-яіїєґ'])\\(([а-яіїєґ']+)\\)", Pattern.CASE_INSENSITIVE|Pattern.UNICODE_CASE); private static final char LEFT_BRACE_SUBST = '\uE005'; private static final char RIGHT_BRACE_SUBST = '\uE006'; private static final String BREAKING_PLACEHOLDER = "\uE110"; // abbreviation dot //TODO: л.с., ч.л./ч. л., ст. л., р. х. private static final Pattern ABBR_DOT_TYS_PATTERN = Pattern.compile("(тис)\\.([ \u00A0]+[а-яіїєґ])"); private static final Pattern ABBR_DOT_LAT_PATTERN = Pattern.compile("([^а-яіїєґА-ЯІЇЄҐ'-]лат)\\.([ \u00A0]+[a-zA-Z])"); private static final Pattern ABBR_DOT_PROF_PATTERN = Pattern.compile("([Аа]кад|[Пп]роф|[Дд]оц|[Аа]сист|вул|о|р|ім)\\.([\\s\u00A0]+[А-ЯІЇЄҐ])"); // tokenize initials with dot, e.g. "А.", "Ковальчук" private static final Pattern INITIALS_DOT_PATTERN_SP_2 = Pattern.compile("([А-ЯІЇЄҐ])\\.([\\s\u00A0][А-ЯІЇЄҐ])\\.([\\s\u00A0][А-ЯІЇЄҐ][а-яіїєґ']+)"); private static final String INITIALS_DOT_REPL_SP_2 = "$1" + NON_BREAKING_DOT_SUBST + "$2" + NON_BREAKING_DOT_SUBST + "$3"; private static final Pattern INITIALS_DOT_PATTERN_SP_1 = Pattern.compile("([А-ЯІЇЄҐ])\\.([\\s\u00A0][А-ЯІЇЄҐ][а-яіїєґ']+)"); private static final String INITIALS_DOT_REPL_SP_1 = "$1" + NON_BREAKING_DOT_SUBST + "$2"; private static final Pattern INITIALS_DOT_PATTERN_NSP_2 = Pattern.compile("([А-ЯІЇЄҐ])\\.([А-ЯІЇЄҐ])\\.([А-ЯІЇЄҐ][а-яіїєґ']+)"); private static final String INITIALS_DOT_REPL_NSP_2 = "$1" + NON_BREAKING_DOT_SUBST + BREAKING_PLACEHOLDER + "$2" + NON_BREAKING_DOT_SUBST + BREAKING_PLACEHOLDER + "$3"; private static final Pattern INITIALS_DOT_PATTERN_NSP_1 = Pattern.compile("([А-ЯІЇЄҐ])\\.([А-ЯІЇЄҐ][а-яіїєґ']+)"); private static final String INITIALS_DOT_REPL_NSP_1 = "$1" + NON_BREAKING_DOT_SUBST + BREAKING_PLACEHOLDER + "$2"; // село, місто, річка (якщо з цифрою: секунди, метри, роки) - з роками складно private static final Pattern ABBR_DOT_KUB_SM_PATTERN = Pattern.compile("((?:[0-9]|кв\\.?|куб\\.?)[\\s\u00A0]+[см])\\."); private static final Pattern ABBR_DOT_S_G_PATTERN = Pattern.compile("(с)\\.(-г)\\."); private static final Pattern ABBR_DOT_2_SMALL_LETTERS_PATTERN = Pattern.compile("([^а-яіїєґ'-][векнпрстцч]{1,2})\\.([екмнпрстч]{1,2})\\."); private static final String ABBR_DOT_2_SMALL_LETTERS_REPL = "$1" + NON_BREAKING_DOT_SUBST + BREAKING_PLACEHOLDER + "$2" + NON_BREAKING_DOT_SUBST; // скорочення що не можуть бути в кінці речення private static final Pattern ABBR_DOT_NON_ENDING_PATTERN = Pattern.compile("([^а-яіїєґА-ЯІЇЄҐ'-](?:амер|англ|бл(?:изьк)?|буд|вірм|грец(?:ьк)|див|дол|досл|доц|ел|жін|заст|зв|ім|івр|ісп|італ|к|кв|[1-9]-кімн|кімн|кл|м|н|напр|п|пен|перекл|пл|пор|поч|прибл|пров|просп|[Рр]ед|[Рр]еж|рт|с|[Сс]в|соц|співавт|стор|табл|тел|укр|філол|фр|франц|ч|чайн|ц))\\.(?!$)"); // скорочення що можуть бути в кінці речення private static final Pattern ABBR_DOT_ENDING_PATTERN = Pattern.compile("([^а-яіїєґА-ЯІЇЄҐ'-]((та|й) ін|е|коп|обл|р|рр|руб|ст|стол|стор|чол|шт))\\."); private static final Pattern ABBR_DOT_I_T_P_PATTERN = Pattern.compile("([ій][ \u00A0]+т)\\.([ \u00A0]*(д|п|ін))\\."); // Сьогодні (у четвер. - Ред.), вранці. // private static final Pattern ABBR_DOT_PATTERN8 = Pattern.compile("([\\s\u00A0]+[–—-][\\s\u00A0]+(?:[Рр]ед|[Аа]вт))\\.([\\)\\]])"); private static final Pattern ABBR_DOT_RED_AVT_PATTERN = Pattern.compile("([\\s\u00A0]+(?:[Рр]ед|[Аа]вт))\\.([\\)\\]])"); // ellipsis private static final String ELLIPSIS = "..."; private static final String ELLIPSIS_SUBST = "\uE100"; private static final String ELLIPSIS2 = "!.."; private static final String ELLIPSIS2_SUBST = "\uE101"; private static final String ELLIPSIS3 = "?.."; private static final String ELLIPSIS3_SUBST = "\uE102"; private static final String SOFT_HYPHEN_WRAP = "\u00AD\n"; private static final String SOFT_HYPHEN_WRAP_SUBST = "\uE103"; // url private static final Pattern URL_PATTERN = Pattern.compile("^(https?|ftp)://[^\\s/$.?#].[^\\s]*$", Pattern.CASE_INSENSITIVE); private static final int URL_START_REPLACE_CHAR = 0xE300; public UkrainianWordTokenizer() { } @Override public List<String> tokenize(String text) { HashMap<String, String> urls = new HashMap<>(); text = cleanup(text); if( text.contains(",") ) { text = DECIMAL_COMMA_PATTERN.matcher(text).replaceAll(DECIMAL_COMMA_REPL); } // check for urls if( text.contains("tp") ) { // https?|ftp Matcher matcher = URL_PATTERN.matcher(text); int urlReplaceChar = URL_START_REPLACE_CHAR; while( matcher.find() ) { String urlGroup = matcher.group(); String replaceChar = String.valueOf((char)urlReplaceChar); urls.put(replaceChar, urlGroup); text = matcher.replaceAll(replaceChar); urlReplaceChar++; } } // if period is not the last character in the sentence int dotIndex = text.indexOf("."); boolean dotInsideSentence = dotIndex >= 0 && dotIndex < text.length()-1; if( dotInsideSentence ){ if( text.contains(ELLIPSIS) ) { text = text.replace(ELLIPSIS, ELLIPSIS_SUBST); } if( text.contains(ELLIPSIS2) ) { text = text.replace(ELLIPSIS2, ELLIPSIS2_SUBST); } if( text.contains(ELLIPSIS3) ) { text = text.replace(ELLIPSIS3, ELLIPSIS3_SUBST); } text = DATE_PATTERN.matcher(text).replaceAll(DATE_PATTERN_REPL); text = DOTTED_NUMBERS_PATTERN.matcher(text).replaceAll(DOTTED_NUMBERS_REPL); text = ABBR_DOT_2_SMALL_LETTERS_PATTERN.matcher(text).replaceAll(ABBR_DOT_2_SMALL_LETTERS_REPL); text = ABBR_DOT_TYS_PATTERN.matcher(text).replaceAll("$1" + NON_BREAKING_DOT_SUBST + "$2"); text = ABBR_DOT_LAT_PATTERN.matcher(text).replaceAll("$1" + NON_BREAKING_DOT_SUBST + "$2"); text = ABBR_DOT_PROF_PATTERN.matcher(text).replaceAll("$1" + NON_BREAKING_DOT_SUBST + "$2"); text = INITIALS_DOT_PATTERN_SP_2.matcher(text).replaceAll(INITIALS_DOT_REPL_SP_2); text = INITIALS_DOT_PATTERN_SP_1.matcher(text).replaceAll(INITIALS_DOT_REPL_SP_1); text = INITIALS_DOT_PATTERN_NSP_2.matcher(text).replaceAll(INITIALS_DOT_REPL_NSP_2); text = INITIALS_DOT_PATTERN_NSP_1.matcher(text).replaceAll(INITIALS_DOT_REPL_NSP_1); text = ABBR_DOT_KUB_SM_PATTERN.matcher(text).replaceAll("$1" + BREAKING_PLACEHOLDER + NON_BREAKING_DOT_SUBST); text = ABBR_DOT_S_G_PATTERN.matcher(text).replaceAll("$1" + NON_BREAKING_DOT_SUBST + "$2" + NON_BREAKING_DOT_SUBST); text = ABBR_DOT_I_T_P_PATTERN.matcher(text).replaceAll("$1" + NON_BREAKING_DOT_SUBST + "$2" + NON_BREAKING_DOT_SUBST); text = ABBR_DOT_RED_AVT_PATTERN.matcher(text).replaceAll("$1" + NON_BREAKING_DOT_SUBST + "$2"); text = ABBR_DOT_NON_ENDING_PATTERN.matcher(text).replaceAll("$1" + NON_BREAKING_DOT_SUBST); } text = ABBR_DOT_ENDING_PATTERN.matcher(text).replaceAll("$1" + NON_BREAKING_DOT_SUBST); // 2 000 000 Matcher spacedDecimalMatcher = DECIMAL_SPACE_PATTERN.matcher(text); if( spacedDecimalMatcher.find() ) { StringBuffer sb = new StringBuffer(); do { String splitNumber = spacedDecimalMatcher.group(0); String splitNumberAdjusted = splitNumber.replace(' ', NON_BREAKING_SPACE_SUBST); splitNumberAdjusted = splitNumberAdjusted.replace('\u00A0', NON_BREAKING_SPACE_SUBST); spacedDecimalMatcher.appendReplacement(sb, splitNumberAdjusted); } while( spacedDecimalMatcher.find() ); spacedDecimalMatcher.appendTail(sb); text = sb.toString(); } // 12:25 if( text.contains(":") ) { text = COLON_NUMBERS_PATTERN.matcher(text).replaceAll(COLON_NUMBERS_REPL); } // ВКПБ(о) if( text.contains("(") ) { text = BRACE_IN_WORD_PATTERN.matcher(text).replaceAll("$1" + LEFT_BRACE_SUBST + "$2" + RIGHT_BRACE_SUBST); } if( text.contains(SOFT_HYPHEN_WRAP) ) { text = text.replace(SOFT_HYPHEN_WRAP, SOFT_HYPHEN_WRAP_SUBST); } List<String> tokenList = new ArrayList<>(); StringTokenizer st = new StringTokenizer(text, SPLIT_CHARS, true); while (st.hasMoreElements()) { String token = st.nextToken(); if( token.equals(BREAKING_PLACEHOLDER) ) continue; token = token.replace(DECIMAL_COMMA_SUBST, ','); token = token.replace(NON_BREAKING_COLON_SUBST, ':'); token = token.replace(NON_BREAKING_SPACE_SUBST, ' '); token = token.replace(LEFT_BRACE_SUBST, '('); token = token.replace(RIGHT_BRACE_SUBST, ')'); // outside of if as we also replace back sentence-ending abbreviations token = token.replace(NON_BREAKING_DOT_SUBST, '.'); if( dotInsideSentence ){ token = token.replace(ELLIPSIS_SUBST, ELLIPSIS); token = token.replace(ELLIPSIS2_SUBST, ELLIPSIS2); token = token.replace(ELLIPSIS3_SUBST, ELLIPSIS3); } token = token.replace(SOFT_HYPHEN_WRAP_SUBST, SOFT_HYPHEN_WRAP); if( ! urls.isEmpty() ) { for(Entry<String, String> entry : urls.entrySet()) { token = token.replace(entry.getKey(), entry.getValue()); } } tokenList.add( token ); } return tokenList; } private static String cleanup(String text) { text = text .replace('\u2019', '\'') .replace('\u02BC', '\'') .replace('\u2018', '\'') .replace('`', '\'') .replace('´', '\'') .replace('\u2011', '-'); // we handle \u2013 in tagger so we can base our rule on it return text; } }
lgpl-2.1
evlist/orbeon-forms
src/main/java/org/orbeon/oxf/processor/serializer/FileSerializer.java
15660
/** * Copyright (C) 2012 Orbeon, Inc. * * This program is free software; you can redistribute it and/or modify it under the terms of the * GNU Lesser General Public License as published by the Free Software Foundation; either version * 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * The full text of the license is available at http://www.gnu.org/copyleft/lesser.html */ package org.orbeon.oxf.processor.serializer; import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.disk.DiskFileItem; import org.apache.log4j.Logger; import org.dom4j.Document; import org.orbeon.oxf.common.OXFException; import org.orbeon.oxf.pipeline.api.PipelineContext; import org.orbeon.oxf.pipeline.api.XMLReceiver; import org.orbeon.oxf.processor.*; import org.orbeon.oxf.processor.serializer.store.ResultStore; import org.orbeon.oxf.processor.serializer.store.ResultStoreOutputStream; import org.orbeon.oxf.util.LoggerFactory; import org.orbeon.oxf.util.NetUtils; import org.orbeon.oxf.xforms.processor.XFormsResourceServer; import org.orbeon.oxf.xml.XMLUtils; import org.orbeon.oxf.xml.XPathUtils; import org.xml.sax.SAXException; import javax.xml.parsers.DocumentBuilderFactory; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; /** * The File Serializer serializes text and binary documents to files on disk. */ public class FileSerializer extends ProcessorImpl { private static Logger logger = LoggerFactory.createLogger(FileSerializer.class); public static final String FILE_SERIALIZER_CONFIG_NAMESPACE_URI = "http://orbeon.org/oxf/xml/file-serializer-config"; public static final String DIRECTORY_PROPERTY = "directory"; // NOTE: Those are also in HttpSerializerBase private static final boolean DEFAULT_FORCE_CONTENT_TYPE = false; private static final boolean DEFAULT_IGNORE_DOCUMENT_CONTENT_TYPE = false; private static final boolean DEFAULT_FORCE_ENCODING = false; private static final boolean DEFAULT_IGNORE_DOCUMENT_ENCODING = false; private static final boolean DEFAULT_APPEND = false; private static final boolean DEFAULT_MAKE_DIRECTORIES = false; static { try { // Create factory DocumentBuilderFactory documentBuilderFactory = (DocumentBuilderFactory) Class.forName("orbeon.apache.xerces.jaxp.DocumentBuilderFactoryImpl").newInstance(); // Configure factory documentBuilderFactory.setNamespaceAware(true); } catch (Exception e) { throw new OXFException(e); } } public FileSerializer() { addInputInfo(new ProcessorInputOutputInfo(INPUT_CONFIG, FILE_SERIALIZER_CONFIG_NAMESPACE_URI)); addInputInfo(new ProcessorInputOutputInfo(INPUT_DATA)); // We don't declare the "data" output here, as this is an optional output. // If we declare it, we'll the XPL engine won't be happy when don't connect anything to that output. } private static class Config { private String directory; private String file; private String scope; private boolean proxyResult; private String url; private boolean append; private boolean makeDirectories; private boolean cacheUseLocalCache; private boolean forceContentType; private String requestedContentType; private boolean ignoreDocumentContentType; private boolean forceEncoding; private String requestedEncoding; private boolean ignoreDocumentEncoding; public Config(Document document) { // Directory and file directory = XPathUtils.selectStringValueNormalize(document, "/config/directory"); file = XPathUtils.selectStringValueNormalize(document, "/config/file"); // Scope scope = XPathUtils.selectStringValueNormalize(document, "/config/scope"); // Proxy result proxyResult = ProcessorUtils.selectBooleanValue(document, "/config/proxy-result", false); // URL url = XPathUtils.selectStringValueNormalize(document, "/config/url"); // Cache control cacheUseLocalCache = ProcessorUtils.selectBooleanValue(document, "/config/cache-control/use-local-cache", CachedSerializer.DEFAULT_CACHE_USE_LOCAL_CACHE); // Whether to append or not append = ProcessorUtils.selectBooleanValue(document, "/config/append", DEFAULT_APPEND); // Whether to append or not makeDirectories = ProcessorUtils.selectBooleanValue(document, "/config/make-directories", DEFAULT_MAKE_DIRECTORIES); // Content-type and Encoding requestedContentType = XPathUtils.selectStringValueNormalize(document, "/config/content-type"); forceContentType = ProcessorUtils.selectBooleanValue(document, "/config/force-content-type", DEFAULT_FORCE_CONTENT_TYPE); // TODO: We don't seem to be using the content type in the file serializer. // Maybe this is something that was left over from the days when the file serializer was also serializing XML. if (forceContentType) throw new OXFException("The force-content-type element requires a content-type element."); ignoreDocumentContentType = ProcessorUtils.selectBooleanValue(document, "/config/ignore-document-content-type", DEFAULT_IGNORE_DOCUMENT_CONTENT_TYPE); requestedEncoding = XPathUtils.selectStringValueNormalize(document, "/config/encoding"); forceEncoding = ProcessorUtils.selectBooleanValue(document, "/config/force-encoding", DEFAULT_FORCE_ENCODING); if (forceEncoding && (requestedEncoding == null || requestedEncoding.equals(""))) throw new OXFException("The force-encoding element requires an encoding element."); ignoreDocumentEncoding = ProcessorUtils.selectBooleanValue(document, "/config/ignore-document-encoding", DEFAULT_IGNORE_DOCUMENT_ENCODING); } public String getDirectory() { return directory; } public String getFile() { return file; } public String getScope() { return scope; } public boolean isProxyResult() { return proxyResult; } public String getUrl() { return url; } public boolean isAppend() { return append; } public boolean isMakeDirectories() { return makeDirectories; } public boolean isCacheUseLocalCache() { return cacheUseLocalCache; } public boolean isForceContentType() { return forceContentType; } public boolean isForceEncoding() { return forceEncoding; } public boolean isIgnoreDocumentContentType() { return ignoreDocumentContentType; } public boolean isIgnoreDocumentEncoding() { return ignoreDocumentEncoding; } public String getRequestedContentType() { return requestedContentType; } public String getRequestedEncoding() { return requestedEncoding; } } @Override public void start(PipelineContext context) { try { // Read config final Config config = readCacheInputAsObject(context, getInputByName(INPUT_CONFIG), new CacheableInputReader<Config>() { public Config read(PipelineContext context, ProcessorInput input) { return new Config(readInputAsDOM4J(context, input)); } }); final ProcessorInput dataInput = getInputByName(INPUT_DATA); // Get file object final String directory = config.getDirectory() != null ? config.getDirectory() : getPropertySet().getString(DIRECTORY_PROPERTY); final File file = NetUtils.getFile(directory, config.getFile(), config.getUrl(), getLocationData(), config.isMakeDirectories()); // NOTE: Caching here is broken, so we never cache. This is what we should do in case // we want caching: // o for a given file, store a hash of the content stored (or the input key?) // o then when we check whether we need to modify the file, check against the key // AND the validity // Delete file if it exists, unless we append if (!config.isAppend() && file.exists()) { final boolean deleted = file.delete(); // We test on file.exists() here again so we don't complain that the file can't be deleted if it got // deleted just between our last test and the delete operation. if (!deleted && file.exists()) throw new OXFException("Can't delete file: " + file); } // Create file if needed file.createNewFile(); FileOutputStream fileOutputStream = new FileOutputStream(file, config.isAppend()); writeToFile(context, config, dataInput, fileOutputStream); } catch (Exception e) { throw new OXFException(e); } } private void writeToFile(PipelineContext context, final Config config, ProcessorInput dataInput, final OutputStream fileOutputStream) throws IOException { try { if (config.cacheUseLocalCache) { // If caching of the data is enabled, use the caching API // We return a ResultStore final boolean[] read = new boolean[1]; ResultStore filter = (ResultStore) readCacheInputAsObject(context, dataInput, new CacheableInputReader() { public Object read(PipelineContext context, ProcessorInput input) { read[0] = true; if (logger.isDebugEnabled()) logger.debug("Output not cached"); try { ResultStoreOutputStream resultStoreOutputStream = new ResultStoreOutputStream(fileOutputStream); readInputAsSAX(context, input, new BinaryTextXMLReceiver(null, resultStoreOutputStream, true, config.forceContentType, config.requestedContentType, config.ignoreDocumentContentType, config.forceEncoding, config.requestedEncoding, config.ignoreDocumentEncoding)); resultStoreOutputStream.close(); return resultStoreOutputStream; } catch (IOException e) { throw new OXFException(e); } } }); // If the output was obtained from the cache, just write it if (!read[0]) { if (logger.isDebugEnabled()) logger.debug("Serializer output cached"); filter.replay(fileOutputStream); } } else { // Caching is not enabled readInputAsSAX(context, dataInput, new BinaryTextXMLReceiver(null, fileOutputStream, true, config.forceContentType, config.requestedContentType, config.ignoreDocumentContentType, config.forceEncoding, config.requestedEncoding, config.ignoreDocumentEncoding)); fileOutputStream.close(); } } finally { if (fileOutputStream != null) fileOutputStream.close(); } } /** * Case where a response must be generated. */ @Override public ProcessorOutput createOutput(String name) { final ProcessorOutput output = new ProcessorOutputImpl(FileSerializer.this, name) { public void readImpl(PipelineContext pipelineContext, XMLReceiver xmlReceiver) { OutputStream fileOutputStream = null; try { //Get the input and config final Config config = getConfig(pipelineContext); final ProcessorInput dataInput = getInputByName(INPUT_DATA); // Determine scope final int scope; if ("request".equals(config.getScope())) { scope = NetUtils.REQUEST_SCOPE; } else if ("session".equals(config.getScope())) { scope = NetUtils.SESSION_SCOPE; } else if ("application".equals(config.getScope())) { scope = NetUtils.APPLICATION_SCOPE; } else { throw new OXFException("Invalid context requested: " + config.getScope()); } // We use the commons fileupload utilities to write to file final FileItem fileItem = NetUtils.prepareFileItem(scope); fileOutputStream = fileItem.getOutputStream(); writeToFile(pipelineContext, config, dataInput, fileOutputStream); // Create file if it doesn't exist final File storeLocation = ((DiskFileItem) fileItem).getStoreLocation(); storeLocation.createNewFile(); // Get the url of the file final String resultURL; { final String localURL = ((DiskFileItem) fileItem).getStoreLocation().toURI().toString(); if ("session".equals(config.getScope()) && config.isProxyResult()) resultURL = XFormsResourceServer.jProxyURI(localURL, config.getRequestedContentType()); else resultURL = localURL; } xmlReceiver.startDocument(); xmlReceiver.startElement("", "url", "url", XMLUtils.EMPTY_ATTRIBUTES); xmlReceiver.characters(resultURL.toCharArray(), 0, resultURL.length()); xmlReceiver.endElement("", "url", "url"); xmlReceiver.endDocument(); } catch (SAXException e) { throw new OXFException(e); } catch (IOException e) { throw new OXFException(e); } finally { if (fileOutputStream != null) { try { fileOutputStream.close(); } catch (IOException e) { throw new OXFException(e); } } } } }; addOutput(name, output); return output; } protected Config getConfig(PipelineContext pipelineContext) { // Read config return readCacheInputAsObject(pipelineContext, getInputByName(INPUT_CONFIG), new CacheableInputReader<Config>() { public Config read(PipelineContext context, ProcessorInput input) { return new Config(readInputAsDOM4J(context, input)); } }); } }
lgpl-2.1
herculeshssj/imobiliariaweb
src/br/com/hslife/imobiliaria/logic/IUsuario.java
2132
/*** Copyright (c) 2011, 2014 Hércules S. S. José Este arquivo é parte do programa Imobiliária Web. Imobiliária Web é um software livre; você pode redistribui-lo e/ou modificá-lo dentro dos termos da Licença Pública Geral Menor GNU como publicada pela Fundação do Software Livre (FSF); na versão 2.1 da Licença. Este programa é distribuído na esperança que possa ser util, mas SEM NENHUMA GARANTIA; sem uma garantia implicita de ADEQUAÇÂO a qualquer MERCADO ou APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral Menor GNU em português para maiores detalhes. Você deve ter recebido uma cópia da Licença Pública Geral Menor GNU sob o nome de "LICENSE.TXT" junto com este programa, se não, acesse o site HSlife no endereco www.hslife.com.br ou escreva para a Fundação do Software Livre(FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. Para mais informações sobre o programa Imobiliária Web e seus autores acesso o endereço www.hslife.com.br, pelo e-mail contato@hslife.com.br ou escreva para Hércules S. S. José, Av. Ministro Lafaeyte de Andrade, 1683 - Bl. 3 Apt 404, Marco II - Nova Iguaçu, RJ, Brasil. ***/ package br.com.hslife.imobiliaria.logic; import java.util.List; import br.com.hslife.imobiliaria.exception.BusinessException; import br.com.hslife.imobiliaria.model.Usuario; public interface IUsuario { public void cadastrar(Usuario usuario) throws BusinessException; public void editar(Usuario usuario) throws BusinessException; public void habilitar(Long id) throws BusinessException; public Usuario buscar(Long id) throws BusinessException; public List<Usuario> buscar(Usuario usuario) throws BusinessException; public List<Usuario> buscarTodos() throws BusinessException; public Usuario buscarPorLogin(String login) throws BusinessException; public List<Usuario> buscarTodosPorLogin(String login) throws BusinessException; }
lgpl-2.1
openlimit-signcubes/dss
dss-pades-pdfbox/src/test/java/eu/europa/esig/dss/pades/timestamp/PDFTimestampServiceTest.java
2583
/** * DSS - Digital Signature Services * Copyright (C) 2015 European Commission, provided under the CEF programme * * This file is part of the "DSS - Digital Signature Services" project. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ package eu.europa.esig.dss.pades.timestamp; import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.IOException; import java.io.InputStream; import java.util.List; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature; import org.junit.jupiter.api.Test; import eu.europa.esig.dss.model.DSSDocument; import eu.europa.esig.dss.model.InMemoryDocument; import eu.europa.esig.dss.pades.PAdESTimestampParameters; import eu.europa.esig.dss.pades.signature.PAdESService; import eu.europa.esig.dss.test.signature.PKIFactoryAccess; public class PDFTimestampServiceTest extends PKIFactoryAccess { @Test public void timestampAlone() throws IOException { PAdESService service = new PAdESService(getCompleteCertificateVerifier()); service.setTspSource(getGoodTsa()); PAdESTimestampParameters parameters = new PAdESTimestampParameters(); DSSDocument document = new InMemoryDocument(getClass().getResourceAsStream("/sample.pdf")); DSSDocument timestamped = service.timestamp(document, parameters); try (InputStream is = timestamped.openStream(); PDDocument doc = PDDocument.load(is)) { List<PDSignature> signatureDictionaries = doc.getSignatureDictionaries(); assertEquals(1, signatureDictionaries.size()); PDSignature pdSignature = signatureDictionaries.get(0); assertNotNull(pdSignature); assertEquals("Adobe.PPKLite", pdSignature.getFilter()); assertEquals("ETSI.RFC3161", pdSignature.getSubFilter()); } } @Override protected String getSigningAlias() { return null; } }
lgpl-2.1
geotools/geotools
modules/ogc/net.opengis.wmts/src/net/opengis/gml311/AbstractParametricCurveSurfaceType.java
576
/** */ package net.opengis.gml311; /** * <!-- begin-user-doc --> * A representation of the model object '<em><b>Abstract Parametric Curve Surface Type</b></em>'. * <!-- end-user-doc --> * * <!-- begin-model-doc --> * * * <!-- end-model-doc --> * * * @see net.opengis.gml311.Gml311Package#getAbstractParametricCurveSurfaceType() * @model extendedMetaData="name='AbstractParametricCurveSurfaceType' kind='empty'" * @generated */ public interface AbstractParametricCurveSurfaceType extends AbstractSurfacePatchType { } // AbstractParametricCurveSurfaceType
lgpl-2.1
fumiyas/hyperestraier-encore
doc/javanativeapi/allclasses-noframe.html
1087
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_21) on Thu Aug 05 10:04:40 JST 2010 --> <TITLE> All Classes (estraier) </TITLE> <META NAME="date" CONTENT="2010-08-05"> <LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style"> </HEAD> <BODY BGCOLOR="white"> <FONT size="+1" CLASS="FrameHeadingFont"> <B>All Classes</B></FONT> <BR> <TABLE BORDER="0" WIDTH="100%" SUMMARY=""> <TR> <TD NOWRAP><FONT CLASS="FrameItemFont"><A HREF="estraier/Cmd.html" title="class in estraier">Cmd</A> <BR> <A HREF="estraier/Condition.html" title="class in estraier">Condition</A> <BR> <A HREF="estraier/Database.html" title="class in estraier">Database</A> <BR> <A HREF="estraier/DatabaseInformer.html" title="interface in estraier"><I>DatabaseInformer</I></A> <BR> <A HREF="estraier/Document.html" title="class in estraier">Document</A> <BR> <A HREF="estraier/Result.html" title="class in estraier">Result</A> <BR> </FONT></TD> </TR> </TABLE> </BODY> </HTML>
lgpl-2.1
capitalaslash/libmesh
src/physics/diff_physics.C
3273
// The libMesh Finite Element Library. // Copyright (C) 2002-2020 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "libmesh/diff_context.h" #include "libmesh/diff_physics.h" #include "libmesh/system.h" namespace libMesh { DifferentiablePhysics::~DifferentiablePhysics() { DifferentiablePhysics::clear_physics(); } void DifferentiablePhysics::clear_physics () { _time_evolving.resize(0); } void DifferentiablePhysics::init_physics (const System & sys) { // give us flags for every variable that might be time evolving _time_evolving.resize(sys.n_vars(), false); } void DifferentiablePhysics::time_evolving (unsigned int var, unsigned int order) { if (order != 1 && order != 2) libmesh_error_msg("Input order must be 1 or 2!"); if (_time_evolving.size() <= var) _time_evolving.resize(var+1, 0); _time_evolving[var] = order; if (order == 1) _first_order_vars.insert(var); else _second_order_vars.insert(var); } bool DifferentiablePhysics::nonlocal_mass_residual(bool request_jacobian, DiffContext & c) { FEMContext & context = cast_ref<FEMContext &>(c); for (auto var : IntRange<unsigned int>(0, context.n_vars())) { if (!this->is_time_evolving(var)) continue; if (c.get_system().variable(var).type().family != SCALAR) continue; const std::vector<dof_id_type> & dof_indices = context.get_dof_indices(var); const unsigned int n_dofs = cast_int<unsigned int> (dof_indices.size()); DenseSubVector<Number> & Fs = context.get_elem_residual(var); DenseSubMatrix<Number> & Kss = context.get_elem_jacobian( var, var ); const libMesh::DenseSubVector<libMesh::Number> & Us = context.get_elem_solution(var); for (unsigned int i=0; i != n_dofs; ++i) { Fs(i) -= Us(i); if (request_jacobian) Kss(i,i) -= context.elem_solution_rate_derivative; } } return request_jacobian; } bool DifferentiablePhysics::_eulerian_time_deriv (bool request_jacobian, DiffContext & context) { // For any problem we need time derivative terms request_jacobian = this->element_time_derivative(request_jacobian, context); // For a moving mesh problem we may need the pseudoconvection term too return this->eulerian_residual(request_jacobian, context) && request_jacobian; } } // namespace libMesh
lgpl-2.1
efiop/criu
test/zdtm/static/tty03.c
2090
#define _XOPEN_SOURCE #include <stdlib.h> #include "zdtmtst.h" #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <sys/wait.h> #include <termios.h> #include <sys/ioctl.h> const char *test_doc = "Check a controlling terminal, if a proper fd belongs to another session leader"; const char *test_author = "Andrey Vagin <avagin@openvz.org>"; int main(int argc, char ** argv) { int fdm, fds, exit_code = 1, status; task_waiter_t t; char *slavename; pid_t sid_b, sid_a, pid; int pfd[2]; test_init(argc, argv); task_waiter_init(&t); if (pipe(pfd) == -1) { pr_perror("pipe"); return 1; } fdm = open("/dev/ptmx", O_RDWR); if (fdm == -1) { pr_perror("Can't open a master pseudoterminal"); return 1; } grantpt(fdm); unlockpt(fdm); slavename = ptsname(fdm); pid = test_fork(); if (pid == 0) { if (setsid() == -1) { pr_perror("setsid"); return 1; } close(pfd[0]); /* set up a controlling terminal */ fds = open(slavename, O_RDWR | O_NOCTTY); if (fds == -1) { pr_perror("Can't open a slave pseudoterminal %s", slavename); return 1; } ioctl(fds, TIOCSCTTY, 1); pid = test_fork(); if (pid == 0) { if (setsid() == -1) { pr_perror("setsid"); return 1; } close(pfd[1]); task_waiter_complete(&t, 1); test_waitsig(); exit(0); } close(fds); close(pfd[1]); task_waiter_wait4(&t, 1); task_waiter_complete(&t, 0); test_waitsig(); kill(pid, SIGTERM); wait(&status); exit(status); } close(pfd[1]); if (read(pfd[0], &sid_a, 1) != 0) { pr_perror("read"); goto out; } if (ioctl(fdm, TIOCGSID, &sid_b) == -1) { pr_perror("The tty is not a controlling"); goto out; } task_waiter_wait4(&t, 0); test_daemon(); test_waitsig(); if (ioctl(fdm, TIOCGSID, &sid_a) == -1) { fail("The tty is not a controlling"); goto out; } if (sid_b != sid_a) { fail("The tty is controlling for someone else"); goto out; } exit_code = 0; out: kill(pid, SIGTERM); wait(&status); if (status == 0 && exit_code == 0) pass(); return exit_code; }
lgpl-2.1
dennis-sheil/commandergenius
project/java/Keycodes.java
24603
/* Simple DirectMedia Layer Java source code (C) 2009-2011 Sergii Pylypenko This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ package net.sourceforge.clonekeenplus; import java.lang.String; import java.util.ArrayList; import java.util.Arrays; import java.lang.reflect.Field; // Autogenerated by hand with a command: // grep 'SDLK_' SDL_keysym.h | sed 's/SDLK_\([a-zA-Z0-9_]\+\).*[=] \([0-9]\+\).*/public static final int SDLK_\1 = \2;/' >> Keycodes.java class SDL_1_2_Keycodes { public static final int SDLK_UNKNOWN = 0; public static final int SDLK_BACKSPACE = 8; public static final int SDLK_TAB = 9; public static final int SDLK_CLEAR = 12; public static final int SDLK_RETURN = 13; public static final int SDLK_PAUSE = 19; public static final int SDLK_ESCAPE = 27; public static final int SDLK_SPACE = 32; public static final int SDLK_EXCLAIM = 33; public static final int SDLK_QUOTEDBL = 34; public static final int SDLK_HASH = 35; public static final int SDLK_DOLLAR = 36; public static final int SDLK_AMPERSAND = 38; public static final int SDLK_QUOTE = 39; public static final int SDLK_LEFTPAREN = 40; public static final int SDLK_RIGHTPAREN = 41; public static final int SDLK_ASTERISK = 42; public static final int SDLK_PLUS = 43; public static final int SDLK_COMMA = 44; public static final int SDLK_MINUS = 45; public static final int SDLK_PERIOD = 46; public static final int SDLK_SLASH = 47; public static final int SDLK_0 = 48; public static final int SDLK_1 = 49; public static final int SDLK_2 = 50; public static final int SDLK_3 = 51; public static final int SDLK_4 = 52; public static final int SDLK_5 = 53; public static final int SDLK_6 = 54; public static final int SDLK_7 = 55; public static final int SDLK_8 = 56; public static final int SDLK_9 = 57; public static final int SDLK_COLON = 58; public static final int SDLK_SEMICOLON = 59; public static final int SDLK_LESS = 60; public static final int SDLK_EQUALS = 61; public static final int SDLK_GREATER = 62; public static final int SDLK_QUESTION = 63; public static final int SDLK_AT = 64; public static final int SDLK_LEFTBRACKET = 91; public static final int SDLK_BACKSLASH = 92; public static final int SDLK_RIGHTBRACKET = 93; public static final int SDLK_CARET = 94; public static final int SDLK_UNDERSCORE = 95; public static final int SDLK_BACKQUOTE = 96; public static final int SDLK_a = 97; public static final int SDLK_b = 98; public static final int SDLK_c = 99; public static final int SDLK_d = 100; public static final int SDLK_e = 101; public static final int SDLK_f = 102; public static final int SDLK_g = 103; public static final int SDLK_h = 104; public static final int SDLK_i = 105; public static final int SDLK_j = 106; public static final int SDLK_k = 107; public static final int SDLK_l = 108; public static final int SDLK_m = 109; public static final int SDLK_n = 110; public static final int SDLK_o = 111; public static final int SDLK_p = 112; public static final int SDLK_q = 113; public static final int SDLK_r = 114; public static final int SDLK_s = 115; public static final int SDLK_t = 116; public static final int SDLK_u = 117; public static final int SDLK_v = 118; public static final int SDLK_w = 119; public static final int SDLK_x = 120; public static final int SDLK_y = 121; public static final int SDLK_z = 122; public static final int SDLK_DELETE = 127; public static final int SDLK_WORLD_0 = 160; public static final int SDLK_WORLD_1 = 161; public static final int SDLK_WORLD_2 = 162; public static final int SDLK_WORLD_3 = 163; public static final int SDLK_WORLD_4 = 164; public static final int SDLK_WORLD_5 = 165; public static final int SDLK_WORLD_6 = 166; public static final int SDLK_WORLD_7 = 167; public static final int SDLK_WORLD_8 = 168; public static final int SDLK_WORLD_9 = 169; public static final int SDLK_WORLD_10 = 170; public static final int SDLK_WORLD_11 = 171; public static final int SDLK_WORLD_12 = 172; public static final int SDLK_WORLD_13 = 173; public static final int SDLK_WORLD_14 = 174; public static final int SDLK_WORLD_15 = 175; public static final int SDLK_WORLD_16 = 176; public static final int SDLK_WORLD_17 = 177; public static final int SDLK_WORLD_18 = 178; public static final int SDLK_WORLD_19 = 179; public static final int SDLK_WORLD_20 = 180; public static final int SDLK_WORLD_21 = 181; public static final int SDLK_WORLD_22 = 182; public static final int SDLK_WORLD_23 = 183; public static final int SDLK_WORLD_24 = 184; public static final int SDLK_WORLD_25 = 185; public static final int SDLK_WORLD_26 = 186; public static final int SDLK_WORLD_27 = 187; public static final int SDLK_WORLD_28 = 188; public static final int SDLK_WORLD_29 = 189; public static final int SDLK_WORLD_30 = 190; public static final int SDLK_WORLD_31 = 191; public static final int SDLK_WORLD_32 = 192; public static final int SDLK_WORLD_33 = 193; public static final int SDLK_WORLD_34 = 194; public static final int SDLK_WORLD_35 = 195; public static final int SDLK_WORLD_36 = 196; public static final int SDLK_WORLD_37 = 197; public static final int SDLK_WORLD_38 = 198; public static final int SDLK_WORLD_39 = 199; public static final int SDLK_WORLD_40 = 200; public static final int SDLK_WORLD_41 = 201; public static final int SDLK_WORLD_42 = 202; public static final int SDLK_WORLD_43 = 203; public static final int SDLK_WORLD_44 = 204; public static final int SDLK_WORLD_45 = 205; public static final int SDLK_WORLD_46 = 206; public static final int SDLK_WORLD_47 = 207; public static final int SDLK_WORLD_48 = 208; public static final int SDLK_WORLD_49 = 209; public static final int SDLK_WORLD_50 = 210; public static final int SDLK_WORLD_51 = 211; public static final int SDLK_WORLD_52 = 212; public static final int SDLK_WORLD_53 = 213; public static final int SDLK_WORLD_54 = 214; public static final int SDLK_WORLD_55 = 215; public static final int SDLK_WORLD_56 = 216; public static final int SDLK_WORLD_57 = 217; public static final int SDLK_WORLD_58 = 218; public static final int SDLK_WORLD_59 = 219; public static final int SDLK_WORLD_60 = 220; public static final int SDLK_WORLD_61 = 221; public static final int SDLK_WORLD_62 = 222; public static final int SDLK_WORLD_63 = 223; public static final int SDLK_WORLD_64 = 224; public static final int SDLK_WORLD_65 = 225; public static final int SDLK_WORLD_66 = 226; public static final int SDLK_WORLD_67 = 227; public static final int SDLK_WORLD_68 = 228; public static final int SDLK_WORLD_69 = 229; public static final int SDLK_WORLD_70 = 230; public static final int SDLK_WORLD_71 = 231; public static final int SDLK_WORLD_72 = 232; public static final int SDLK_WORLD_73 = 233; public static final int SDLK_WORLD_74 = 234; public static final int SDLK_WORLD_75 = 235; public static final int SDLK_WORLD_76 = 236; public static final int SDLK_WORLD_77 = 237; public static final int SDLK_WORLD_78 = 238; public static final int SDLK_WORLD_79 = 239; public static final int SDLK_WORLD_80 = 240; public static final int SDLK_WORLD_81 = 241; public static final int SDLK_WORLD_82 = 242; public static final int SDLK_WORLD_83 = 243; public static final int SDLK_WORLD_84 = 244; public static final int SDLK_WORLD_85 = 245; public static final int SDLK_WORLD_86 = 246; public static final int SDLK_WORLD_87 = 247; public static final int SDLK_WORLD_88 = 248; public static final int SDLK_WORLD_89 = 249; public static final int SDLK_WORLD_90 = 250; public static final int SDLK_WORLD_91 = 251; public static final int SDLK_WORLD_92 = 252; public static final int SDLK_WORLD_93 = 253; public static final int SDLK_WORLD_94 = 254; public static final int SDLK_WORLD_95 = 255; public static final int SDLK_KP0 = 256; public static final int SDLK_KP1 = 257; public static final int SDLK_KP2 = 258; public static final int SDLK_KP3 = 259; public static final int SDLK_KP4 = 260; public static final int SDLK_KP5 = 261; public static final int SDLK_KP6 = 262; public static final int SDLK_KP7 = 263; public static final int SDLK_KP8 = 264; public static final int SDLK_KP9 = 265; public static final int SDLK_KP_PERIOD = 266; public static final int SDLK_KP_DIVIDE = 267; public static final int SDLK_KP_MULTIPLY = 268; public static final int SDLK_KP_MINUS = 269; public static final int SDLK_KP_PLUS = 270; public static final int SDLK_KP_ENTER = 271; public static final int SDLK_KP_EQUALS = 272; public static final int SDLK_UP = 273; public static final int SDLK_DOWN = 274; public static final int SDLK_RIGHT = 275; public static final int SDLK_LEFT = 276; public static final int SDLK_INSERT = 277; public static final int SDLK_HOME = 278; public static final int SDLK_END = 279; public static final int SDLK_PAGEUP = 280; public static final int SDLK_PAGEDOWN = 281; public static final int SDLK_F1 = 282; public static final int SDLK_F2 = 283; public static final int SDLK_F3 = 284; public static final int SDLK_F4 = 285; public static final int SDLK_F5 = 286; public static final int SDLK_F6 = 287; public static final int SDLK_F7 = 288; public static final int SDLK_F8 = 289; public static final int SDLK_F9 = 290; public static final int SDLK_F10 = 291; public static final int SDLK_F11 = 292; public static final int SDLK_F12 = 293; public static final int SDLK_F13 = 294; public static final int SDLK_F14 = 295; public static final int SDLK_F15 = 296; public static final int SDLK_NUMLOCK = 300; public static final int SDLK_CAPSLOCK = 301; public static final int SDLK_SCROLLOCK = 302; public static final int SDLK_RSHIFT = 303; public static final int SDLK_LSHIFT = 304; public static final int SDLK_RCTRL = 305; public static final int SDLK_LCTRL = 306; public static final int SDLK_RALT = 307; public static final int SDLK_LALT = 308; public static final int SDLK_RMETA = 309; public static final int SDLK_LMETA = 310; public static final int SDLK_LSUPER = 311; public static final int SDLK_RSUPER = 312; public static final int SDLK_MODE = 313; public static final int SDLK_COMPOSE = 314; public static final int SDLK_HELP = 315; public static final int SDLK_PRINT = 316; public static final int SDLK_SYSREQ = 317; public static final int SDLK_BREAK = 318; public static final int SDLK_MENU = 319; public static final int SDLK_POWER = 320; public static final int SDLK_EURO = 321; public static final int SDLK_UNDO = 322; public static final int SDLK_NO_REMAP = 512; } // Autogenerated by hand with a command: // grep 'SDL_SCANCODE_' SDL_scancode.h | sed 's/SDL_SCANCODE_\([a-zA-Z0-9_]\+\).*[=] \([0-9]\+\).*/public static final int SDLK_\1 = \2;/' >> Keycodes.java class SDL_1_3_Keycodes { public static final int SDLK_UNKNOWN = 0; public static final int SDLK_A = 4; public static final int SDLK_B = 5; public static final int SDLK_C = 6; public static final int SDLK_D = 7; public static final int SDLK_E = 8; public static final int SDLK_F = 9; public static final int SDLK_G = 10; public static final int SDLK_H = 11; public static final int SDLK_I = 12; public static final int SDLK_J = 13; public static final int SDLK_K = 14; public static final int SDLK_L = 15; public static final int SDLK_M = 16; public static final int SDLK_N = 17; public static final int SDLK_O = 18; public static final int SDLK_P = 19; public static final int SDLK_Q = 20; public static final int SDLK_R = 21; public static final int SDLK_S = 22; public static final int SDLK_T = 23; public static final int SDLK_U = 24; public static final int SDLK_V = 25; public static final int SDLK_W = 26; public static final int SDLK_X = 27; public static final int SDLK_Y = 28; public static final int SDLK_Z = 29; public static final int SDLK_1 = 30; public static final int SDLK_2 = 31; public static final int SDLK_3 = 32; public static final int SDLK_4 = 33; public static final int SDLK_5 = 34; public static final int SDLK_6 = 35; public static final int SDLK_7 = 36; public static final int SDLK_8 = 37; public static final int SDLK_9 = 38; public static final int SDLK_0 = 39; public static final int SDLK_RETURN = 40; public static final int SDLK_ESCAPE = 41; public static final int SDLK_BACKSPACE = 42; public static final int SDLK_TAB = 43; public static final int SDLK_SPACE = 44; public static final int SDLK_MINUS = 45; public static final int SDLK_EQUALS = 46; public static final int SDLK_LEFTBRACKET = 47; public static final int SDLK_RIGHTBRACKET = 48; public static final int SDLK_BACKSLASH = 49; public static final int SDLK_NONUSHASH = 50; public static final int SDLK_SEMICOLON = 51; public static final int SDLK_APOSTROPHE = 52; public static final int SDLK_GRAVE = 53; public static final int SDLK_COMMA = 54; public static final int SDLK_PERIOD = 55; public static final int SDLK_SLASH = 56; public static final int SDLK_CAPSLOCK = 57; public static final int SDLK_F1 = 58; public static final int SDLK_F2 = 59; public static final int SDLK_F3 = 60; public static final int SDLK_F4 = 61; public static final int SDLK_F5 = 62; public static final int SDLK_F6 = 63; public static final int SDLK_F7 = 64; public static final int SDLK_F8 = 65; public static final int SDLK_F9 = 66; public static final int SDLK_F10 = 67; public static final int SDLK_F11 = 68; public static final int SDLK_F12 = 69; public static final int SDLK_PRINTSCREEN = 70; public static final int SDLK_SCROLLLOCK = 71; public static final int SDLK_PAUSE = 72; public static final int SDLK_INSERT = 73; public static final int SDLK_HOME = 74; public static final int SDLK_PAGEUP = 75; public static final int SDLK_DELETE = 76; public static final int SDLK_END = 77; public static final int SDLK_PAGEDOWN = 78; public static final int SDLK_RIGHT = 79; public static final int SDLK_LEFT = 80; public static final int SDLK_DOWN = 81; public static final int SDLK_UP = 82; public static final int SDLK_NUMLOCKCLEAR = 83; public static final int SDLK_KP_DIVIDE = 84; public static final int SDLK_KP_MULTIPLY = 85; public static final int SDLK_KP_MINUS = 86; public static final int SDLK_KP_PLUS = 87; public static final int SDLK_KP_ENTER = 88; public static final int SDLK_KP_1 = 89; public static final int SDLK_KP_2 = 90; public static final int SDLK_KP_3 = 91; public static final int SDLK_KP_4 = 92; public static final int SDLK_KP_5 = 93; public static final int SDLK_KP_6 = 94; public static final int SDLK_KP_7 = 95; public static final int SDLK_KP_8 = 96; public static final int SDLK_KP_9 = 97; public static final int SDLK_KP_0 = 98; public static final int SDLK_KP_PERIOD = 99; public static final int SDLK_NONUSBACKSLASH = 100; public static final int SDLK_APPLICATION = 101; public static final int SDLK_POWER = 102; public static final int SDLK_KP_EQUALS = 103; public static final int SDLK_F13 = 104; public static final int SDLK_F14 = 105; public static final int SDLK_F15 = 106; public static final int SDLK_F16 = 107; public static final int SDLK_F17 = 108; public static final int SDLK_F18 = 109; public static final int SDLK_F19 = 110; public static final int SDLK_F20 = 111; public static final int SDLK_F21 = 112; public static final int SDLK_F22 = 113; public static final int SDLK_F23 = 114; public static final int SDLK_F24 = 115; public static final int SDLK_EXECUTE = 116; public static final int SDLK_HELP = 117; public static final int SDLK_MENU = 118; public static final int SDLK_SELECT = 119; public static final int SDLK_STOP = 120; public static final int SDLK_AGAIN = 121; public static final int SDLK_UNDO = 122; public static final int SDLK_CUT = 123; public static final int SDLK_COPY = 124; public static final int SDLK_PASTE = 125; public static final int SDLK_FIND = 126; public static final int SDLK_MUTE = 127; public static final int SDLK_VOLUMEUP = 128; public static final int SDLK_VOLUMEDOWN = 129; public static final int SDLK_KP_COMMA = 133; public static final int SDLK_KP_EQUALSAS400 = 134; public static final int SDLK_INTERNATIONAL1 = 135; public static final int SDLK_INTERNATIONAL2 = 136; public static final int SDLK_INTERNATIONAL3 = 137; public static final int SDLK_INTERNATIONAL4 = 138; public static final int SDLK_INTERNATIONAL5 = 139; public static final int SDLK_INTERNATIONAL6 = 140; public static final int SDLK_INTERNATIONAL7 = 141; public static final int SDLK_INTERNATIONAL8 = 142; public static final int SDLK_INTERNATIONAL9 = 143; public static final int SDLK_LANG1 = 144; public static final int SDLK_LANG2 = 145; public static final int SDLK_LANG3 = 146; public static final int SDLK_LANG4 = 147; public static final int SDLK_LANG5 = 148; public static final int SDLK_LANG6 = 149; public static final int SDLK_LANG7 = 150; public static final int SDLK_LANG8 = 151; public static final int SDLK_LANG9 = 152; public static final int SDLK_ALTERASE = 153; public static final int SDLK_SYSREQ = 154; public static final int SDLK_CANCEL = 155; public static final int SDLK_CLEAR = 156; public static final int SDLK_PRIOR = 157; public static final int SDLK_RETURN2 = 158; public static final int SDLK_SEPARATOR = 159; public static final int SDLK_OUT = 160; public static final int SDLK_OPER = 161; public static final int SDLK_CLEARAGAIN = 162; public static final int SDLK_CRSEL = 163; public static final int SDLK_EXSEL = 164; public static final int SDLK_KP_00 = 176; public static final int SDLK_KP_000 = 177; public static final int SDLK_THOUSANDSSEPARATOR = 178; public static final int SDLK_DECIMALSEPARATOR = 179; public static final int SDLK_CURRENCYUNIT = 180; public static final int SDLK_CURRENCYSUBUNIT = 181; public static final int SDLK_KP_LEFTPAREN = 182; public static final int SDLK_KP_RIGHTPAREN = 183; public static final int SDLK_KP_LEFTBRACE = 184; public static final int SDLK_KP_RIGHTBRACE = 185; public static final int SDLK_KP_TAB = 186; public static final int SDLK_KP_BACKSPACE = 187; public static final int SDLK_KP_A = 188; public static final int SDLK_KP_B = 189; public static final int SDLK_KP_C = 190; public static final int SDLK_KP_D = 191; public static final int SDLK_KP_E = 192; public static final int SDLK_KP_F = 193; public static final int SDLK_KP_XOR = 194; public static final int SDLK_KP_POWER = 195; public static final int SDLK_KP_PERCENT = 196; public static final int SDLK_KP_LESS = 197; public static final int SDLK_KP_GREATER = 198; public static final int SDLK_KP_AMPERSAND = 199; public static final int SDLK_KP_DBLAMPERSAND = 200; public static final int SDLK_KP_VERTICALBAR = 201; public static final int SDLK_KP_DBLVERTICALBAR = 202; public static final int SDLK_KP_COLON = 203; public static final int SDLK_KP_HASH = 204; public static final int SDLK_KP_SPACE = 205; public static final int SDLK_KP_AT = 206; public static final int SDLK_KP_EXCLAM = 207; public static final int SDLK_KP_MEMSTORE = 208; public static final int SDLK_KP_MEMRECALL = 209; public static final int SDLK_KP_MEMCLEAR = 210; public static final int SDLK_KP_MEMADD = 211; public static final int SDLK_KP_MEMSUBTRACT = 212; public static final int SDLK_KP_MEMMULTIPLY = 213; public static final int SDLK_KP_MEMDIVIDE = 214; public static final int SDLK_KP_PLUSMINUS = 215; public static final int SDLK_KP_CLEAR = 216; public static final int SDLK_KP_CLEARENTRY = 217; public static final int SDLK_KP_BINARY = 218; public static final int SDLK_KP_OCTAL = 219; public static final int SDLK_KP_DECIMAL = 220; public static final int SDLK_KP_HEXADECIMAL = 221; public static final int SDLK_LCTRL = 224; public static final int SDLK_LSHIFT = 225; public static final int SDLK_LALT = 226; public static final int SDLK_LGUI = 227; public static final int SDLK_RCTRL = 228; public static final int SDLK_RSHIFT = 229; public static final int SDLK_RALT = 230; public static final int SDLK_RGUI = 231; public static final int SDLK_MODE = 257; public static final int SDLK_AUDIONEXT = 258; public static final int SDLK_AUDIOPREV = 259; public static final int SDLK_AUDIOSTOP = 260; public static final int SDLK_AUDIOPLAY = 261; public static final int SDLK_AUDIOMUTE = 262; public static final int SDLK_MEDIASELECT = 263; public static final int SDLK_WWW = 264; public static final int SDLK_MAIL = 265; public static final int SDLK_CALCULATOR = 266; public static final int SDLK_COMPUTER = 267; public static final int SDLK_AC_SEARCH = 268; public static final int SDLK_AC_HOME = 269; public static final int SDLK_AC_BACK = 270; public static final int SDLK_AC_FORWARD = 271; public static final int SDLK_AC_STOP = 272; public static final int SDLK_AC_REFRESH = 273; public static final int SDLK_AC_BOOKMARKS = 274; public static final int SDLK_BRIGHTNESSDOWN = 275; public static final int SDLK_BRIGHTNESSUP = 276; public static final int SDLK_DISPLAYSWITCH = 277; public static final int SDLK_KBDILLUMTOGGLE = 278; public static final int SDLK_KBDILLUMDOWN = 279; public static final int SDLK_KBDILLUMUP = 280; public static final int SDLK_EJECT = 281; public static final int SDLK_SLEEP = 282; public static final int SDLK_NO_REMAP = 512; } class SDL_Keys { public static String [] names = null; public static Integer [] values = null; public static String [] namesSorted = null; public static Integer [] namesSortedIdx = null; public static Integer [] namesSortedBackIdx = null; static final int JAVA_KEYCODE_LAST = 255; // Android 2.3 added several new gaming keys, Android 3.1 added even more - keep in sync with javakeycodes.h static { ArrayList<String> Names = new ArrayList<String> (); ArrayList<Integer> Values = new ArrayList<Integer> (); Field [] fields = SDL_1_2_Keycodes.class.getDeclaredFields(); if( Globals.Using_SDL_1_3 ) { fields = SDL_1_3_Keycodes.class.getDeclaredFields(); } try { for(Field f: fields) { Values.add(f.getInt(null)); Names.add(f.getName().substring(5).toUpperCase()); } } catch(IllegalAccessException e) {}; // Sort by value for( int i = 0; i < Values.size(); i++ ) { for( int j = i; j < Values.size(); j++ ) { if( Values.get(i) > Values.get(j) ) { int x = Values.get(i); Values.set(i, Values.get(j)); Values.set(j, x); String s = Names.get(i); Names.set(i, Names.get(j)); Names.set(j, s); } } } names = Names.toArray(new String[0]); values = Values.toArray(new Integer[0]); namesSorted = Names.toArray(new String[0]); namesSortedIdx = new Integer[values.length]; namesSortedBackIdx = new Integer[values.length]; Arrays.sort(namesSorted); for( int i = 0; i < namesSorted.length; i++ ) { for( int j = 0; j < namesSorted.length; j++ ) { if( namesSorted[i].equals( names[j] ) ) { namesSortedIdx[i] = j; namesSortedBackIdx[j] = i; break; } } } } }
lgpl-2.1
timmattison/rxtx
src/gnu/io/RS485.java
13919
/*------------------------------------------------------------------------- | RXTX License v 2.1 - LGPL v 2.1 + Linking Over Controlled Interface. | RXTX is a native interface to serial ports in java. | Copyright 1997-2007 by Trent Jarvi tjarvi@qbang.org and others who | actually wrote it. See individual source files for more information. | | A copy of the LGPL v 2.1 may be found at | http://www.gnu.org/licenses/lgpl.txt on March 4th 2007. A copy is | here for your convenience. | | This library is free software; you can redistribute it and/or | modify it under the terms of the GNU Lesser General Public | License as published by the Free Software Foundation; either | version 2.1 of the License, or (at your option) any later version. | | This library is distributed in the hope that it will be useful, | but WITHOUT ANY WARRANTY; without even the implied warranty of | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | Lesser General Public License for more details. | | An executable that contains no derivative of any portion of RXTX, but | is designed to work with RXTX by being dynamically linked with it, | is considered a "work that uses the Library" subject to the terms and | conditions of the GNU Lesser General Public License. | | The following has been added to the RXTX License to remove | any confusion about linking to RXTX. We want to allow in part what | section 5, paragraph 2 of the LGPL does not permit in the special | case of linking over a controlled interface. The intent is to add a | Java Specification Request or standards body defined interface in the | future as another exception but one is not currently available. | | http://www.fsf.org/licenses/gpl-faq.html#LinkingOverControlledInterface | | As a special exception, the copyright holders of RXTX give you | permission to link RXTX with independent modules that communicate with | RXTX solely through the Sun Microsytems CommAPI interface version 2, | regardless of the license terms of these independent modules, and to copy | and distribute the resulting combined work under terms of your choice, | provided that every copy of the combined work is accompanied by a complete | copy of the source code of RXTX (the version of RXTX used to produce the | combined work), being distributed under the terms of the GNU Lesser General | Public License plus this exception. An independent module is a | module which is not derived from or based on RXTX. | | Note that people who make modified versions of RXTX are not obligated | to grant this special exception for their modified versions; it is | their choice whether to do so. The GNU Lesser General Public License | gives permission to release a modified version without this exception; this | exception also makes it possible to release a modified version which | carries forward this exception. | | You should have received a copy of the GNU Lesser General Public | License along with this library; if not, write to the Free | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | All trademarks belong to their respective owners. --------------------------------------------------------------------------*/ package gnu.io; import java.io.*; import java.util.*; import java.lang.Math; /** * @author Trent Jarvi * @version %I%, %G% * @since JDK1.0 */ final class RS485 extends RS485Port { static { //System.loadLibrary( "rxtxRS485" ); Initialize(); } /** Initialize the native library */ private native static void Initialize(); /** Actual RS485Port wrapper class */ /** Open the named port */ public RS485( String name ) throws PortInUseException { fd = open( name ); } private native int open( String name ) throws PortInUseException; /** File descriptor */ private int fd; /** DSR flag **/ static boolean dsrFlag = false; /** Output stream */ private final RS485OutputStream out = new RS485OutputStream(); public OutputStream getOutputStream() { return out; } /** Input stream */ private final RS485InputStream in = new RS485InputStream(); public InputStream getInputStream() { return in; } /** Set the RS485Port parameters */ public void setRS485PortParams( int b, int d, int s, int p ) throws UnsupportedCommOperationException { nativeSetRS485PortParams( b, d, s, p ); speed = b; dataBits = d; stopBits = s; parity = p; } /** Set the native RS485 port parameters */ private native void nativeSetRS485PortParams( int speed, int dataBits, int stopBits, int parity ) throws UnsupportedCommOperationException; /** Line speed in bits-per-second */ private int speed=9600; public int getBaudRate() { return speed; } /** Data bits port parameter */ private int dataBits=DATABITS_8; public int getDataBits() { return dataBits; } /** Stop bits port parameter */ private int stopBits=RS485Port.STOPBITS_1; public int getStopBits() { return stopBits; } /** Parity port parameter */ private int parity= RS485Port.PARITY_NONE; public int getParity() { return parity; } /** Flow control */ private int flowmode = RS485Port.FLOWCONTROL_NONE; public void setFlowControlMode( int flowcontrol ) { try { setflowcontrol( flowcontrol ); } catch( IOException e ) { e.printStackTrace(); return; } flowmode=flowcontrol; } public int getFlowControlMode() { return flowmode; } native void setflowcontrol( int flowcontrol ) throws IOException; /* linux/drivers/char/n_hdlc.c? FIXME taj@www.linux.org.uk */ /** Receive framing control */ public void enableReceiveFraming( int f ) throws UnsupportedCommOperationException { throw new UnsupportedCommOperationException( "Not supported" ); } public void disableReceiveFraming() {} public boolean isReceiveFramingEnabled() { return false; } public int getReceiveFramingByte() { return 0; } /** Receive timeout control */ private int timeout = 0; public native int NativegetReceiveTimeout(); public native boolean NativeisReceiveTimeoutEnabled(); public native void NativeEnableReceiveTimeoutThreshold(int time, int threshold,int InputBuffer); public void disableReceiveTimeout(){ enableReceiveTimeout(0); } public void enableReceiveTimeout( int time ){ if( time >= 0 ) { timeout = time; NativeEnableReceiveTimeoutThreshold( time , threshold, InputBuffer ); } else { System.out.println("Invalid timeout"); } } public boolean isReceiveTimeoutEnabled(){ return(NativeisReceiveTimeoutEnabled()); } public int getReceiveTimeout(){ return(NativegetReceiveTimeout( )); } /** Receive threshold control */ private int threshold = 0; public void enableReceiveThreshold( int thresh ){ if(thresh >=0) { threshold=thresh; NativeEnableReceiveTimeoutThreshold(timeout, threshold, InputBuffer); } else /* invalid thresh */ { System.out.println("Invalid Threshold"); } } public void disableReceiveThreshold() { enableReceiveThreshold(0); } public int getReceiveThreshold(){ return threshold; } public boolean isReceiveThresholdEnabled(){ return(threshold>0); } /** Input/output buffers */ /** FIXME I think this refers to FOPEN(3)/SETBUF(3)/FREAD(3)/FCLOSE(3) taj@www.linux.org.uk These are native stubs... */ private int InputBuffer=0; private int OutputBuffer=0; public void setInputBufferSize( int size ) { InputBuffer=size; } public int getInputBufferSize() { return(InputBuffer); } public void setOutputBufferSize( int size ) { OutputBuffer=size; } public int getOutputBufferSize() { return(OutputBuffer); } /** Line status methods */ public native boolean isDTR(); public native void setDTR( boolean state ); public native void setRTS( boolean state ); private native void setDSR( boolean state ); public native boolean isCTS(); public native boolean isDSR(); public native boolean isCD(); public native boolean isRI(); public native boolean isRTS(); /** Write to the port */ public native void sendBreak( int duration ); private native void writeByte( int b ) throws IOException; private native void writeArray( byte b[], int off, int len ) throws IOException; private native void drain() throws IOException; /** RS485 read methods */ private native int nativeavailable() throws IOException; private native int readByte() throws IOException; private native int readArray( byte b[], int off, int len ) throws IOException; /** RS485 Port Event listener */ private RS485PortEventListener SPEventListener; /** Thread to monitor data */ private MonitorThread monThread; /** Process RS485PortEvents */ native void eventLoop(); private int dataAvailable=0; public void sendEvent( int event, boolean state ) { switch( event ) { case RS485PortEvent.DATA_AVAILABLE: dataAvailable=1; if( monThread.Data ) break; return; case RS485PortEvent.OUTPUT_BUFFER_EMPTY: if( monThread.Output ) break; return; /* if( monThread.DSR ) break; return; if (isDSR()) { if (!dsrFlag) { dsrFlag = true; RS485PortEvent e = new RS485PortEvent(this, RS485PortEvent.DSR, !dsrFlag, dsrFlag ); } } else if (dsrFlag) { dsrFlag = false; RS485PortEvent e = new RS485PortEvent(this, RS485PortEvent.DSR, !dsrFlag, dsrFlag ); } */ case RS485PortEvent.CTS: if( monThread.CTS ) break; return; case RS485PortEvent.DSR: if( monThread.DSR ) break; return; case RS485PortEvent.RI: if( monThread.RI ) break; return; case RS485PortEvent.CD: if( monThread.CD ) break; return; case RS485PortEvent.OE: if( monThread.OE ) break; return; case RS485PortEvent.PE: if( monThread.PE ) break; return; case RS485PortEvent.FE: if( monThread.FE ) break; return; case RS485PortEvent.BI: if( monThread.BI ) break; return; default: System.err.println("unknown event:"+event); return; } RS485PortEvent e = new RS485PortEvent(this, event, !state, state ); if( SPEventListener != null ) SPEventListener.RS485Event( e ); } /** Add an event listener */ public void addEventListener( RS485PortEventListener lsnr ) throws TooManyListenersException { if( SPEventListener != null ) throw new TooManyListenersException(); SPEventListener = lsnr; monThread = new MonitorThread(); monThread.start(); } /** Remove the RS485 port event listener */ public void removeEventListener() { SPEventListener = null; if( monThread != null ) { monThread.interrupt(); monThread = null; } } public void notifyOnDataAvailable( boolean enable ) { monThread.Data = enable; } public void notifyOnOutputEmpty( boolean enable ) { monThread.Output = enable; } public void notifyOnCTS( boolean enable ) { monThread.CTS = enable; } public void notifyOnDSR( boolean enable ) { monThread.DSR = enable; } public void notifyOnRingIndicator( boolean enable ) { monThread.RI = enable; } public void notifyOnCarrierDetect( boolean enable ) { monThread.CD = enable; } public void notifyOnOverrunError( boolean enable ) { monThread.OE = enable; } public void notifyOnParityError( boolean enable ) { monThread.PE = enable; } public void notifyOnFramingError( boolean enable ) { monThread.FE = enable; } public void notifyOnBreakInterrupt( boolean enable ) { monThread.BI = enable; } /** Close the port */ private native void nativeClose(); public void close() { setDTR(false); setDSR(false); nativeClose(); super.close(); fd = 0; } /** Finalize the port */ protected void finalize() { if( fd > 0 ) close(); } /** Inner class for RS485OutputStream */ class RS485OutputStream extends OutputStream { public void write( int b ) throws IOException { writeByte( b ); } public void write( byte b[] ) throws IOException { writeArray( b, 0, b.length ); } public void write( byte b[], int off, int len ) throws IOException { writeArray( b, off, len ); } public void flush() throws IOException { drain(); } } /** Inner class for RS485InputStream */ class RS485InputStream extends InputStream { public int read() throws IOException { dataAvailable=0; return readByte(); } public int read( byte b[] ) throws IOException { return read ( b, 0, b.length); } public int read( byte b[], int off, int len ) throws IOException { dataAvailable=0; int i=0, Minimum=0; int intArray[] = { b.length, InputBuffer, len }; /* find the lowest nonzero value timeout and threshold are handled on the native side see NativeEnableReceiveTimeoutThreshold in RS485Imp.c */ while(intArray[i]==0 && i < intArray.length) i++; Minimum=intArray[i]; while( i < intArray.length ) { if(intArray[i] > 0 ) { Minimum=Math.min(Minimum,intArray[i]); } i++; } Minimum=Math.min(Minimum,threshold); if(Minimum == 0) Minimum=1; int Available=available(); int Ret = readArray( b, off, Minimum); return Ret; } public int available() throws IOException { return nativeavailable(); } } class MonitorThread extends Thread { /** Note: these have to be separate boolean flags because the RS485PortEvent constants are NOT bit-flags, they are just defined as integers from 1 to 10 -DPL */ private boolean CTS=false; private boolean DSR=false; private boolean RI=false; private boolean CD=false; private boolean OE=false; private boolean PE=false; private boolean FE=false; private boolean BI=false; private boolean Data=false; private boolean Output=false; MonitorThread() { } public void run() { eventLoop(); } } }
lgpl-2.1
lazizgueye/TAGL
cron4j-original/examples/6-web-app-integration/src/example/ExecutionServlet.java
3206
/* * cron4j - A pure Java cron-like scheduler * * Copyright (C) 2007-2010 Carlo Pelliccia (www.sauronsoftware.it) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version * 2.1, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License 2.1 for more details. * * You should have received a copy of the GNU Lesser General Public * License version 2.1 along with this program. * If not, see <http://www.gnu.org/licenses/>. */ package example; import it.sauronsoftware.cron4j.Scheduler; import it.sauronsoftware.cron4j.TaskExecutor; import java.io.IOException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * This servlet enables the user to view and control any ongoing task execution. * The HTML layout is generated calling the /WEB-INF/ongoing.jsp page. */ public class ExecutionServlet extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // Retrieves the servlet context. ServletContext context = getServletContext(); // Retrieves the scheduler. Scheduler scheduler = (Scheduler) context .getAttribute(Constants.SCHEDULER); // Retrieves the executors. TaskExecutor[] executors = scheduler.getExecutingTasks(); // Registers the executors in the request. req.setAttribute("executors", executors); // Action requested? String action = req.getParameter("action"); if ("pause".equals(action)) { String id = req.getParameter("id"); TaskExecutor executor = find(executors, id); if (executor != null && executor.isAlive() && !executor.isStopped() && executor.canBePaused() && !executor.isPaused()) { executor.pause(); } } else if ("resume".equals(action)) { String id = req.getParameter("id"); TaskExecutor executor = find(executors, id); if (executor != null && executor.isAlive() && !executor.isStopped() && executor.canBePaused() && executor.isPaused()) { executor.resume(); } } else if ("stop".equals(action)) { String id = req.getParameter("id"); TaskExecutor executor = find(executors, id); if (executor != null && executor.isAlive() && executor.canBeStopped() && !executor.isStopped()) { executor.stop(); } } // Layout. String page = "/WEB-INF/ongoing.jsp"; RequestDispatcher dispatcher = req.getRequestDispatcher(page); dispatcher.include(req, resp); } private TaskExecutor find(TaskExecutor[] executors, String id) { if (id == null) { return null; } for (int i = 0; i < executors.length; i++) { String aux = executors[i].getGuid(); if (aux.equals(id)) { return executors[i]; } } return null; } }
lgpl-2.1
npmiller/lxqt-panel
plugin-showdesktop/translations/showdesktop_da_DK.ts
784
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> <TS version="2.1" language="da_DK"> <context> <name>ShowDesktop</name> <message> <location filename="../showdesktop.cpp" line="48"/> <source>Show desktop</source> <translation type="unfinished"></translation> </message> <message> <location filename="../showdesktop.cpp" line="58"/> <source>Show Desktop: Global shortcut &apos;%1&apos; cannot be registered</source> <translation>Vis Skrivebord: Global genvej &apos;%1&apos; kan ikke registreres</translation> </message> <message> <location filename="../showdesktop.cpp" line="63"/> <source>Show Desktop</source> <translation>Vis Skrivebord</translation> </message> </context> </TS>
lgpl-2.1
alx/reprap-host-software
src/org/reprap/comms/IncomingMessage.java
3047
package org.reprap.comms; import java.io.IOException; import org.reprap.Device; import org.reprap.ReprapException; /** * */ public abstract class IncomingMessage { /** * The actual content portion of a packet, not the frilly bits */ private byte [] payload; /** * */ IncomingContext incomingContext; /** * */ public class InvalidPayloadException extends ReprapException { private static final long serialVersionUID = -5403970405132990115L; public InvalidPayloadException() { super(); } public InvalidPayloadException(String arg) { super(arg); } } /** * Receive a message matching context criteria * @param incomingContext the context in which to receive messages * @throws IOException */ public IncomingMessage(IncomingContext incomingContext) throws IOException { this.incomingContext = incomingContext; Communicator comm = incomingContext.getCommunicator(); comm.receiveMessage(this); } /** * Send a given message and return the incoming response. Re-try * if there is a comms problem. * @param message * @throws IOException */ public IncomingMessage(Device device, OutgoingMessage message, long timeout) throws IOException { Communicator comm = device.getCommunicator(); for(int i=0;i<3;i++) { // Allow 3 retries. //System.out.println("Retry: " + i); incomingContext = comm.sendMessage(device, message); try { comm.receiveMessage(this, timeout); } catch (IOException e) { e.printStackTrace(); System.err.println("IO error/timeout, resending"); // Just to prevent any unexpected spinning try { Thread.sleep(1); } catch (InterruptedException e1) { e1.printStackTrace(); } continue; } return; } // If it's not going to respond, try to continue regardless. System.err.println("Resend limit exceeded. Failing without reported error."); } /** * Implemented by subclasses to allow them to indicate if they * understand or expect a given packetType. This is used to * decide if a received packet should be accepted or possibly discarded. * @param packetType the type of packet to receive * @return true if the packetType matches what is expected */ protected abstract boolean isExpectedPacketType(byte packetType); /** * @return payload */ public byte[] getPayload() { return payload; } /** * Called by the framework to provide data to the IncomingMessage. * This should not normally be called by a user. * @param payload The completed message to insert into the IncomingMessage * @return true is the data was accepted, otherwise false. */ public boolean receiveData(byte [] payload) { // We assume the packet was for us, etc. But we need to // know it contains the correct contents if (payload == null || payload.length == 0) return false; if (isExpectedPacketType(payload[0])) { this.payload = (byte[])payload.clone(); return true; } else { // That's not what we were after, so discard and wait for more return false; } } }
lgpl-2.1
maikelsteneker/checkstyle-throwsIndent
src/testinputs/com/puppycrawl/tools/checkstyle/coding/InputEqualsAvoidNull.java
4676
package com.puppycrawl.tools.checkstyle.coding; public class InputEqualsAvoidNull { public boolean equals(Object o) { return false; } /** * methods that should get flagged * @return */ public void flagForEquals() { Object o = new Object(); String s = "pizza"; o.equals("hot pizza"); o.equals(s = "cold pizza"); o.equals(((s = "cold pizza"))); o.equals("cheese" + "ham" + "sauce"); o.equals(("cheese" + "ham") + "sauce"); o.equals((("cheese" + "ham")) + "sauce"); } /** * methods that should get flagged */ public void flagForEqualsIgnoreCase() { String s = "pizza"; s.equalsIgnoreCase("hot pizza"); s.equalsIgnoreCase(s = "cold pizza"); s.equalsIgnoreCase(((s = "cold pizza"))); s.equalsIgnoreCase("cheese" + "ham" + "sauce"); s.equalsIgnoreCase(("cheese" + "ham") + "sauce"); s.equalsIgnoreCase((("cheese" + "ham")) + "sauce"); } /** * methods that should get flagged */ public void flagForBoth() { Object o = new Object(); String s = "pizza"; o.equals("hot pizza"); o.equals(s = "cold pizza"); o.equals(((s = "cold pizza"))); o.equals("cheese" + "ham" + "sauce"); o.equals(("cheese" + "ham") + "sauce"); o.equals((("cheese" + "ham")) + "sauce"); s.equalsIgnoreCase("hot pizza"); s.equalsIgnoreCase(s = "cold pizza"); s.equalsIgnoreCase(((s = "cold pizza"))); s.equalsIgnoreCase("cheese" + "ham" + "sauce"); s.equalsIgnoreCase(("cheese" + "ham") + "sauce"); s.equalsIgnoreCase((("cheese" + "ham")) + "sauce"); } /** * methods that should not get flagged * * @return */ public void noFlagForEquals() { Object o = new Object(); String s = "peperoni"; o.equals(s += "mushrooms"); (s = "thin crust").equals("thick crust"); (s += "garlic").equals("basil"); ("Chicago Style" + "NY Style").equals("California Style" + "Any Style"); equals("peppers"); "onions".equals(o); o.equals(new Object()); o.equals(equals(o)); equals("yummy"); new Object().equals("more cheese"); InputEqualsAvoidNullOutter outter = new InputEqualsAvoidNullOutter(); outter.new InputEqualsAvoidNullInner().equals("eat pizza and enjoy inner classes"); } /** * methods that should not get flagged */ public void noFlagForEqualsIgnoreCase() { String s = "peperoni"; String s1 = "tasty"; s.equalsIgnoreCase(s += "mushrooms"); s1.equalsIgnoreCase(s += "mushrooms"); (s = "thin crust").equalsIgnoreCase("thick crust"); (s += "garlic").equalsIgnoreCase("basil"); ("Chicago Style" + "NY Style").equalsIgnoreCase("California Style" + "Any Style"); "onions".equalsIgnoreCase(s); s.equalsIgnoreCase(new String()); s.equals(s1); new String().equalsIgnoreCase("more cheese"); } public void noFlagForBoth() { Object o = new Object(); String s = "peperoni"; String s1 = "tasty"; o.equals(s += "mushrooms"); (s = "thin crust").equals("thick crust"); (s += "garlic").equals("basil"); ("Chicago Style" + "NY Style").equals("California Style" + "Any Style"); equals("peppers"); "onions".equals(o); o.equals(new Object()); o.equals(equals(o)); equals("yummy"); new Object().equals("more cheese"); InputEqualsAvoidNullOutter outter = new InputEqualsAvoidNullOutter(); outter.new InputEqualsAvoidNullInner().equals("eat pizza and enjoy inner classes"); s.equalsIgnoreCase(s += "mushrooms"); s1.equalsIgnoreCase(s += "mushrooms"); (s = "thin crust").equalsIgnoreCase("thick crust"); (s += "garlic").equalsIgnoreCase("basil"); ("Chicago Style" + "NY Style").equalsIgnoreCase("California Style" + "Any Style"); "onions".equalsIgnoreCase(s); s.equalsIgnoreCase(new String()); s.equals(s1); new String().equalsIgnoreCase("more cheese"); } } class InputEqualsAvoidNullOutter { public class InputEqualsAvoidNullInner { public boolean equals(Object o) { return true; } } }
lgpl-2.1
arcean/qt4-messagingframework
src/libraries/qmfclient/resources/mailmessages-109-110.sqlite.sql
1205
ALTER TABLE mailmessages RENAME TO old_mailmessages; CREATE TABLE mailmessages ( id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, type INTEGER NOT NULL, parentfolderid INTEGER NOT NULL, previousparentfolderid INTEGER NOT NULL, sender VARCHAR, recipients VARCHAR, subject VARCHAR, stamp TIMESTAMP, status INTEGER, parentaccountid INTEGER, frommailbox VARCHAR, mailfile VARCHAR, serveruid VARCHAR, size INTEGER, contenttype INTEGER, responseid INTEGER, responsetype INTEGER, receivedstamp TIMESTAMP, copyserveruid VARCHAR NOT NULL DEFAULT '', restorefolderid INTEGER NOT NULL DEFAULT 0, listid VARCHAR NOT NULL DEFAULT '', rfcid VARCHAR NOT NULL DEFAULT '', FOREIGN KEY (parentfolderid) REFERENCES mailfolders(id), FOREIGN KEY (parentaccountid) REFERENCES mailaccounts(id)); INSERT INTO mailmessages SELECT * FROM old_mailmessages; DROP TABLE old_mailmessages; CREATE INDEX parentfolderid_idx ON mailmessages("parentfolderid"); CREATE INDEX parentaccountid_idx ON mailmessages("parentaccountid"); CREATE INDEX frommailbox_idx ON mailmessages("frommailbox"); CREATE INDEX stamp_idx ON mailmessages("stamp");
lgpl-2.1
IDgis/geoportaal
geoportaal-beheer/app/models/Sort.java
2859
package models; import java.util.List; /** * The model class to store the sorting information * * @author Sandro * */ public class Sort { private String text; private String supplier; private String status; private String dateCreateStart; private String dateCreateEnd; private String dateUpdateStart; private String dateUpdateEnd; private String sort; private List<String> recordsChecked; public Sort() { } /** * The constructor of the sort class * * @param text the search value of the text field * @param supplier the search value of the supplier field * @param status the search value of the status field * @param format the search value of the format field * @param dateUpdateStart the search value of the date start field * @param dateUpdateEnd the search value of the date end field * @param sort the sort type value * @param recordsChecked the UUID's of the records selected */ public Sort(String text, String supplier, String status, String dateCreateStart, String dateCreateEnd, String dateUpdateStart, String dateUpdateEnd, String sort, List<String> recordsChecked) { this.text = text; this.supplier = supplier; this.status = status; this.dateCreateStart = dateCreateStart; this.dateCreateEnd = dateCreateEnd; this.dateUpdateStart = dateUpdateStart; this.dateUpdateEnd = dateUpdateEnd; this.sort = sort; this.recordsChecked = recordsChecked; } public String getText() { return text; } public void setText(String text) { this.text = text; } public String getSupplier() { return supplier; } public void setSupplier(String supplier) { this.supplier = supplier; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getDateCreateStart() { return dateCreateStart; } public void setDateCreateStart(String dateCreateStart) { this.dateCreateStart = dateCreateStart; } public String getDateCreateEnd() { return dateCreateEnd; } public void setDateCreateEnd(String dateCreateEnd) { this.dateCreateEnd = dateCreateEnd; } public String getDateUpdateStart() { return dateUpdateStart; } public void setDateUpdateStart(String dateUpdateStart) { this.dateUpdateStart = dateUpdateStart; } public String getDateUpdateEnd() { return dateUpdateEnd; } public void setDateUpdateEnd(String dateUpdateEnd) { this.dateUpdateEnd = dateUpdateEnd; } public String getSort() { return sort; } public void setSort(String sort) { this.sort = sort; } public List<String> getRecordsChecked() { return recordsChecked; } public void setRecordsChecked(List<String> recordsChecked) { this.recordsChecked = recordsChecked; } }
lgpl-2.1
bennofs/nix
src/libstore/derivations.cc
11922
#include "derivations.hh" #include "store-api.hh" #include "globals.hh" #include "util.hh" #include "worker-protocol.hh" #include "fs-accessor.hh" #include "istringstream_nocopy.hh" namespace nix { void DerivationOutput::parseHashInfo(bool & recursive, Hash & hash) const { recursive = false; string algo = hashAlgo; if (string(algo, 0, 2) == "r:") { recursive = true; algo = string(algo, 2); } HashType hashType = parseHashType(algo); if (hashType == htUnknown) throw Error(format("unknown hash algorithm ‘%1%’") % algo); hash = parseHash(hashType, this->hash); } Path BasicDerivation::findOutput(const string & id) const { auto i = outputs.find(id); if (i == outputs.end()) throw Error(format("derivation has no output ‘%1%’") % id); return i->second.path; } bool BasicDerivation::willBuildLocally() const { return get(env, "preferLocalBuild") == "1" && canBuildLocally(); } bool BasicDerivation::substitutesAllowed() const { return get(env, "allowSubstitutes", "1") == "1"; } bool BasicDerivation::isBuiltin() const { return string(builder, 0, 8) == "builtin:"; } bool BasicDerivation::canBuildLocally() const { return platform == settings.thisSystem || isBuiltin() #if __linux__ || (platform == "i686-linux" && settings.thisSystem == "x86_64-linux") || (platform == "armv6l-linux" && settings.thisSystem == "armv7l-linux") || (platform == "armv5tel-linux" && (settings.thisSystem == "armv7l-linux" || settings.thisSystem == "armv6l-linux")) #elif __FreeBSD__ || (platform == "i686-linux" && settings.thisSystem == "x86_64-freebsd") || (platform == "i686-linux" && settings.thisSystem == "i686-freebsd") #endif ; } Path writeDerivation(ref<Store> store, const Derivation & drv, const string & name, bool repair) { PathSet references; references.insert(drv.inputSrcs.begin(), drv.inputSrcs.end()); for (auto & i : drv.inputDrvs) references.insert(i.first); /* Note that the outputs of a derivation are *not* references (that can be missing (of course) and should not necessarily be held during a garbage collection). */ string suffix = name + drvExtension; string contents = drv.unparse(); return settings.readOnlyMode ? store->computeStorePathForText(suffix, contents, references) : store->addTextToStore(suffix, contents, references, repair); } /* Read string `s' from stream `str'. */ static void expect(std::istream & str, const string & s) { char s2[s.size()]; str.read(s2, s.size()); if (string(s2, s.size()) != s) throw FormatError(format("expected string ‘%1%’") % s); } /* Read a C-style string from stream `str'. */ static string parseString(std::istream & str) { string res; expect(str, "\""); int c; while ((c = str.get()) != '"') if (c == '\\') { c = str.get(); if (c == 'n') res += '\n'; else if (c == 'r') res += '\r'; else if (c == 't') res += '\t'; else res += c; } else res += c; return res; } static Path parsePath(std::istream & str) { string s = parseString(str); if (s.size() == 0 || s[0] != '/') throw FormatError(format("bad path ‘%1%’ in derivation") % s); return s; } static bool endOfList(std::istream & str) { if (str.peek() == ',') { str.get(); return false; } if (str.peek() == ']') { str.get(); return true; } return false; } static StringSet parseStrings(std::istream & str, bool arePaths) { StringSet res; while (!endOfList(str)) res.insert(arePaths ? parsePath(str) : parseString(str)); return res; } static Derivation parseDerivation(const string & s) { Derivation drv; istringstream_nocopy str(s); expect(str, "Derive(["); /* Parse the list of outputs. */ while (!endOfList(str)) { DerivationOutput out; expect(str, "("); string id = parseString(str); expect(str, ","); out.path = parsePath(str); expect(str, ","); out.hashAlgo = parseString(str); expect(str, ","); out.hash = parseString(str); expect(str, ")"); drv.outputs[id] = out; } /* Parse the list of input derivations. */ expect(str, ",["); while (!endOfList(str)) { expect(str, "("); Path drvPath = parsePath(str); expect(str, ",["); drv.inputDrvs[drvPath] = parseStrings(str, false); expect(str, ")"); } expect(str, ",["); drv.inputSrcs = parseStrings(str, true); expect(str, ","); drv.platform = parseString(str); expect(str, ","); drv.builder = parseString(str); /* Parse the builder arguments. */ expect(str, ",["); while (!endOfList(str)) drv.args.push_back(parseString(str)); /* Parse the environment variables. */ expect(str, ",["); while (!endOfList(str)) { expect(str, "("); string name = parseString(str); expect(str, ","); string value = parseString(str); expect(str, ")"); drv.env[name] = value; } expect(str, ")"); return drv; } Derivation readDerivation(const Path & drvPath) { try { return parseDerivation(readFile(drvPath)); } catch (FormatError & e) { throw Error(format("error parsing derivation ‘%1%’: %2%") % drvPath % e.msg()); } } Derivation Store::derivationFromPath(const Path & drvPath) { assertStorePath(drvPath); ensurePath(drvPath); auto accessor = getFSAccessor(); try { return parseDerivation(accessor->readFile(drvPath)); } catch (FormatError & e) { throw Error(format("error parsing derivation ‘%1%’: %2%") % drvPath % e.msg()); } } static void printString(string & res, const string & s) { res += '"'; for (const char * i = s.c_str(); *i; i++) if (*i == '\"' || *i == '\\') { res += "\\"; res += *i; } else if (*i == '\n') res += "\\n"; else if (*i == '\r') res += "\\r"; else if (*i == '\t') res += "\\t"; else res += *i; res += '"'; } template<class ForwardIterator> static void printStrings(string & res, ForwardIterator i, ForwardIterator j) { res += '['; bool first = true; for ( ; i != j; ++i) { if (first) first = false; else res += ','; printString(res, *i); } res += ']'; } string Derivation::unparse() const { string s; s.reserve(65536); s += "Derive(["; bool first = true; for (auto & i : outputs) { if (first) first = false; else s += ','; s += '('; printString(s, i.first); s += ','; printString(s, i.second.path); s += ','; printString(s, i.second.hashAlgo); s += ','; printString(s, i.second.hash); s += ')'; } s += "],["; first = true; for (auto & i : inputDrvs) { if (first) first = false; else s += ','; s += '('; printString(s, i.first); s += ','; printStrings(s, i.second.begin(), i.second.end()); s += ')'; } s += "],"; printStrings(s, inputSrcs.begin(), inputSrcs.end()); s += ','; printString(s, platform); s += ','; printString(s, builder); s += ','; printStrings(s, args.begin(), args.end()); s += ",["; first = true; for (auto & i : env) { if (first) first = false; else s += ','; s += '('; printString(s, i.first); s += ','; printString(s, i.second); s += ')'; } s += "])"; return s; } bool isDerivation(const string & fileName) { return hasSuffix(fileName, drvExtension); } bool BasicDerivation::isFixedOutput() const { return outputs.size() == 1 && outputs.begin()->first == "out" && outputs.begin()->second.hash != ""; } DrvHashes drvHashes; /* Returns the hash of a derivation modulo fixed-output subderivations. A fixed-output derivation is a derivation with one output (`out') for which an expected hash and hash algorithm are specified (using the `outputHash' and `outputHashAlgo' attributes). We don't want changes to such derivations to propagate upwards through the dependency graph, changing output paths everywhere. For instance, if we change the url in a call to the `fetchurl' function, we do not want to rebuild everything depending on it (after all, (the hash of) the file being downloaded is unchanged). So the *output paths* should not change. On the other hand, the *derivation paths* should change to reflect the new dependency graph. That's what this function does: it returns a hash which is just the hash of the derivation ATerm, except that any input derivation paths have been replaced by the result of a recursive call to this function, and that for fixed-output derivations we return a hash of its output path. */ Hash hashDerivationModulo(Store & store, Derivation drv) { /* Return a fixed hash for fixed-output derivations. */ if (drv.isFixedOutput()) { DerivationOutputs::const_iterator i = drv.outputs.begin(); return hashString(htSHA256, "fixed:out:" + i->second.hashAlgo + ":" + i->second.hash + ":" + i->second.path); } /* For other derivations, replace the inputs paths with recursive calls to this function.*/ DerivationInputs inputs2; for (auto & i : drv.inputDrvs) { Hash h = drvHashes[i.first]; if (!h) { assert(store.isValidPath(i.first)); Derivation drv2 = readDerivation(i.first); h = hashDerivationModulo(store, drv2); drvHashes[i.first] = h; } inputs2[printHash(h)] = i.second; } drv.inputDrvs = inputs2; return hashString(htSHA256, drv.unparse()); } DrvPathWithOutputs parseDrvPathWithOutputs(const string & s) { size_t n = s.find("!"); return n == s.npos ? DrvPathWithOutputs(s, std::set<string>()) : DrvPathWithOutputs(string(s, 0, n), tokenizeString<std::set<string> >(string(s, n + 1), ",")); } Path makeDrvPathWithOutputs(const Path & drvPath, const std::set<string> & outputs) { return outputs.empty() ? drvPath : drvPath + "!" + concatStringsSep(",", outputs); } bool wantOutput(const string & output, const std::set<string> & wanted) { return wanted.empty() || wanted.find(output) != wanted.end(); } PathSet BasicDerivation::outputPaths() const { PathSet paths; for (auto & i : outputs) paths.insert(i.second.path); return paths; } Source & readDerivation(Source & in, Store & store, BasicDerivation & drv) { drv.outputs.clear(); auto nr = readNum<size_t>(in); for (size_t n = 0; n < nr; n++) { auto name = readString(in); DerivationOutput o; in >> o.path >> o.hashAlgo >> o.hash; store.assertStorePath(o.path); drv.outputs[name] = o; } drv.inputSrcs = readStorePaths<PathSet>(store, in); in >> drv.platform >> drv.builder; drv.args = readStrings<Strings>(in); nr = readNum<size_t>(in); for (size_t n = 0; n < nr; n++) { auto key = readString(in); auto value = readString(in); drv.env[key] = value; } return in; } Sink & operator << (Sink & out, const BasicDerivation & drv) { out << drv.outputs.size(); for (auto & i : drv.outputs) out << i.first << i.second.path << i.second.hashAlgo << i.second.hash; out << drv.inputSrcs << drv.platform << drv.builder << drv.args; out << drv.env.size(); for (auto & i : drv.env) out << i.first << i.second; return out; } std::string hashPlaceholder(const std::string & outputName) { // FIXME: memoize? return "/" + printHash32(hashString(htSHA256, "nix-output:" + outputName)); } }
lgpl-2.1
sunblithe/qt-everywhere-opensource-src-4.7.1
src/gui/styles/qwindowsmobilestyle.cpp
238464
/**************************************************************************** ** ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtGui module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial Usage ** Licensees holding valid Qt Commercial licenses may use this file in ** accordance with the Qt Commercial License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Nokia. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "qwindowsmobilestyle.h" #include "qwindowsmobilestyle_p.h" #if !defined(QT_NO_STYLE_WINDOWSMOBILE) || defined(QT_PLUGIN) #include "qpainterpath.h" #include "qapplication.h" #include "qdesktopwidget.h" #include "qwidget.h" #include "qdockwidget.h" #include "qframe.h" #include "qmenu.h" #include "qpaintengine.h" #include "qpainter.h" #include "qgroupbox.h" #include "qstyleoption.h" #include "qlistview.h" #include "qdrawutil.h" #include "qtoolbar.h" #include "qabstractscrollarea.h" #include "qabstractbutton.h" #include "qcombobox.h" #include "qabstractscrollarea.h" #include "qframe.h" #include "qscrollbar.h" #include "qabstractitemview.h" #include "qmenubar.h" #include "qtoolbutton.h" #include "qtextedit.h" #include "qdialog.h" #include "qdebug.h" #include "qtabwidget.h" #ifdef Q_WS_WINCE #include "qt_windows.h" #include "qguifunctions_wince.h" extern bool qt_wince_is_high_dpi(); //defined in qguifunctions_wince.cpp extern bool qt_wince_is_smartphone(); //defined in qguifunctions_wince.cpp extern bool qt_wince_is_windows_mobile_65(); //defined in qguifunctions_wince.cpp #endif // Q_WS_WINCE #include "qstylehelper_p.h" QT_BEGIN_NAMESPACE static const int windowsItemFrame = 1; // menu item frame width static const int windowsMobileitemViewCheckBoxSize = 13; static const int windowsMobileFrameGroupBoxOffset = 9; static const int windowsMobileIndicatorSize = 14; static const int windowsMobileExclusiveIndicatorSize = 14; static const int windowsMobileSliderThickness = 6; static const int windowsMobileIconSize = 16; static const int PE_IndicatorArrowUpBig = 0xf000101; static const int PE_IndicatorArrowDownBig = 0xf000102; static const int PE_IndicatorArrowLeftBig = 0xf000103; static const int PE_IndicatorArrowRightBig = 0xf000104; /* XPM */ static const char *const radiobutton_xpm[] = { "30 30 2 1", " c None", ". c #000000", " ........ ", " .............. ", " .... .... ", " .... .... ", " ... ... ", " ... ... ", " .. .. ", " .. .. ", " ... ... ", " .. .. ", " .. .. ", ".. ..", ".. ..", ".. ..", ".. ..", ".. ..", ".. ..", ".. ..", ".. ..", " .. .. ", " .. .. ", " ... ... ", " .. .. ", " .. .. ", " ... ... ", " ... ... ", " .... .... ", " .... .... ", " .............. ", " ........ "}; /* XPM */ static const char * const radiobutton_low_xpm[] = { "15 15 2 1", " c None", ". c #000000", " ..... ", " .. .. ", " . . ", " . . ", " . . ", ". .", ". .", ". .", ". .", ". .", " . . ", " . . ", " . . ", " .. .. ", " ..... "}; /* XPM */ static const char * const arrowleft_big_xpm[] = { "9 17 2 1", " c None", ". c #000000", " .", " ..", " ...", " ....", " .....", " ......", " .......", " ........", ".........", " ........", " .......", " ......", " .....", " ....", " ...", " ..", " ."}; /* XPM */ static const char * const arrowleft_xpm[] = { "8 15 2 1", " c None", ". c #000000", " .", " ..", " ...", " ....", " .....", " ......", " .......", "........", " .......", " ......", " .....", " ....", " ...", " ..", " ."}; /* XPM */ static const char *const horlines_xpm[] = { "2 2 2 1", " c None", ". c #000000", " ", ".."}; /* XPM */ static const char *const vertlines_xpm[] = { "2 2 2 1", " c None", ". c #000000", ". ", ". "}; /* XPM */ static const char *const radiochecked_xpm[] = { "18 18 2 1", " c None", ". c #000000", " ...... ", " .......... ", " .............. ", " .............. ", " ................ ", " ................ ", "..................", "..................", "..................", "..................", "..................", "..................", " ................ ", " ................ ", " .............. ", " .............. ", " .......... ", " ...... "}; /* XPM */ static const char * const radiochecked_low_xpm[] = { "9 9 2 1", " c None", ". c #000000", " ... ", " ....... ", " ....... ", ".........", ".........", ".........", " ....... ", " ....... ", " ... "}; static const char *const arrowdown_xpm[] = { "15 8 2 1", " c None", ". c #000000", "...............", " ............. ", " ........... ", " ......... ", " ....... ", " ..... ", " ... ", " . "}; static const char *const arrowdown_big_xpm[] = { "17 9 2 1", " c None", ". c #000000", ".................", " ............... ", " ............. ", " ........... ", " ......... ", " ....... ", " ..... ", " ... ", " . "}; /* XPM */ static const char *const checkedlight_xpm[] = { "24 24 2 1", " c None", ". c #000000", " ", " ", " ", " ", " ", " . ", " .. ", " ... ", " .... ", " ..... ", " ...... ", " . ...... ", " .. ...... ", " ... ...... ", " .... ...... ", " .......... ", " ......... ", " ....... ", " ..... ", " ... ", " . ", " ", " ", " "}; /* XPM */ static const char *const checkedbold_xpm[] = { "26 26 2 1", " c None", ". c #000000", " ", " ", " ", " ", " ", " ", " .. ", " ... ", " .... ", " ..... ", " .. ...... ", " ... ....... ", " .... ....... ", " ..... ....... ", " ...... ....... ", " .............. ", " ............ ", " .......... ", " ........ ", " ...... ", " .... ", " .. ", " ", " ", " ", " "}; /* XPM */ static const char * const checkedbold_low_xpm[] = { "9 8 2 1", " c None", ". c #000000", " .", " ..", ". ...", ".. ... ", "... ... ", " ..... ", " ... ", " . "}; /* XPM */ static const char * const checkedlight_low_xpm[] = { "8 8 2 1", " c None", ". c #000000", " .", " ..", " ...", ". ... ", ".. ... ", "..... ", " ... ", " . "}; /* XPM */ static const char * const highlightedradiobutton_xpm[] = { "30 30 3 1", " c None", ". c #000000", "+ c #0078CC", " ........ ", " .............. ", " ....++++++++.... ", " ....++++++++++++.... ", " ...++++ ++++... ", " ...+++ +++... ", " ..++ ++.. ", " ..++ ++.. ", " ...++ ++... ", " ..++ ++.. ", " ..++ ++.. ", "..++ ++..", "..++ ++..", "..++ ++..", "..++ ++..", "..++ ++..", "..++ ++..", "..++ ++..", "..++ ++..", " ..++ ++.. ", " ..++ ++.. ", " ...++ ++... ", " ..++ ++.. ", " ..++ ++.. ", " ...+++ +++... ", " ...++++ ++++... ", " ....++++++++++++.... ", " ....++++++++.... ", " .............. ", " ........ "}; /* XPM */ static const char * const highlightedradiobutton_low_xpm[] = { "15 15 3 1", " c None", ". c #000000", "+ c #3192D6", " ..... ", " ..+++++.. ", " .++ ++. ", " .+ +. ", " .+ +. ", ".+ +.", ".+ +.", ".+ +.", ".+ +.", ".+ +.", " .+ +. ", " .+ +. ", " .++ ++. ", " ..+++++.. ", " ..... "}; /* XPM */ static const char * const cross_big_xpm[] = { "28 28 4 1", " c #09454A", ". c #218C98", "+ c #47D8E5", "@ c #FDFFFC", " ", " ", " ++++++++++++++++++++++++ ", " ++++++++++++++++++++++++ ", " ++....................++ ", " ++....................++ ", " ++..@@@..........@@@..++ ", " ++..@@@@........@@@@..++ ", " ++..@@@@@......@@@@@..++ ", " ++...@@@@@....@@@@@...++ ", " ++....@@@@@..@@@@@....++ ", " ++.....@@@@@@@@@@.....++ ", " ++......@@@@@@@@......++ ", " ++.......@@@@@@.......++ ", " ++.......@@@@@@.......++ ", " ++......@@@@@@@@......++ ", " ++.....@@@@@@@@@@.....++ ", " ++....@@@@@..@@@@@....++ ", " ++...@@@@@....@@@@@...++ ", " ++..@@@@@......@@@@@..++ ", " ++..@@@@........@@@@..++ ", " ++..@@@..........@@@..++ ", " ++....................++ ", " ++....................++ ", " ++++++++++++++++++++++++ ", " ++++++++++++++++++++++++ ", " ", " "}; /* XPM */ static const char * const cross_small_xpm[] = { "14 14 4 1", " c #09454A", ". c #218C98", "+ c #47D8E5", "@ c #FCFFFC", " ", " ++++++++++++ ", " +..........+ ", " +.@@....@@.+ ", " +.@@@..@@@.+ ", " +..@@@@@@..+ ", " +...@@@@...+ ", " +...@@@@...+ ", " +..@@@@@@..+ ", " +.@@@..@@@.+ ", " +.@@....@@.+ ", " +..........+ ", " ++++++++++++ ", " "}; /* XPM */ static const char * const max_big_xpm[] = { "28 28 4 1", " c #09454A", ". c #218C98", "+ c #47D8E5", "@ c #FDFFFC", " ", " ", " ++++++++++++++++++++++++ ", " ++++++++++++++++++++++++ ", " ++....................++ ", " ++....................++ ", " ++....................++ ", " ++....................++ ", " ++..@@@@@@@@@@@@@@@@..++ ", " ++..@@@@@@@@@@@@@@@@..++ ", " ++..@@@@@@@@@@@@@@@@..++ ", " ++..@@@@@@@@@@@@@@@@..++ ", " ++..@@............@@..++ ", " ++..@@............@@..++ ", " ++..@@............@@..++ ", " ++..@@............@@..++ ", " ++..@@............@@..++ ", " ++..@@............@@..++ ", " ++..@@@@@@@@@@@@@@@@..++ ", " ++..@@@@@@@@@@@@@@@@..++ ", " ++....................++ ", " ++....................++ ", " ++....................++ ", " ++....................++ ", " ++++++++++++++++++++++++ ", " ++++++++++++++++++++++++ ", " ", " "}; /* XPM */ static const char * const max_small_xpm[] = { "14 14 4 1", " c #09454A", ". c #218C98", "+ c #47D8E5", "@ c #FCFFFC", " ", " ++++++++++++ ", " +..........+ ", " +..........+ ", " +.@@@@@@@@.+ ", " +.@@@@@@@@.+ ", " +.@......@.+ ", " +.@......@.+ ", " +.@......@.+ ", " +.@@@@@@@@.+ ", " +..........+ ", " +..........+ ", " ++++++++++++ ", " "}; /* XPM */ static const char * const normal_big_xpm[] = { "28 28 4 1", " c #09454A", ". c #218C98", "+ c #47D8E5", "@ c #FDFFFC", " ", " ", " ++++++++++++++++++++++++ ", " ++++++++++++++++++++++++ ", " ++....................++ ", " ++....................++ ", " ++..@@@@@@@@@@@@@@@@..++ ", " ++..@@@@@@@@@@@@@@@@..++ ", " ++..@@............@@..++ ", " ++..@@............@@..++ ", " ++..@@............@@..++ ", " ++..@@............@@..++ ", " ++..@@............@@..++ ", " ++..@@............@@..++ ", " ++..@@............@@..++ ", " ++..@@............@@..++ ", " ++..@@............@@..++ ", " ++..@@............@@..++ ", " ++..@@............@@..++ ", " ++..@@............@@..++ ", " ++..@@@@@@@@@@@@@@@@..++ ", " ++..@@@@@@@@@@@@@@@@..++ ", " ++....................++ ", " ++....................++ ", " ++++++++++++++++++++++++ ", " ++++++++++++++++++++++++ ", " ", " "}; /* XPM */ static const char * const normal_small_xpm[] = { "14 14 4 1", " c #09454A", ". c #218C98", "+ c #47D8E5", "@ c #FCFFFC", " ", " ++++++++++++ ", " +..........+ ", " +.@@@@@@@@.+ ", " +.@......@.+ ", " +.@......@.+ ", " +.@......@.+ ", " +.@......@.+ ", " +.@......@.+ ", " +.@......@.+ ", " +.@@@@@@@@.+ ", " +..........+ ", " ++++++++++++ ", " "}; /* XPM */ static const char * const min_big_xpm[] = { "28 28 4 1", " c #09454A", ". c #218C98", "+ c #47D8E5", "@ c #FDFFFC", " ", " ", " ++++++++++++++++++++++++ ", " ++++++++++++++++++++++++ ", " ++....................++ ", " ++....................++ ", " ++....................++ ", " ++....................++ ", " ++....................++ ", " ++....................++ ", " ++....................++ ", " ++....................++ ", " ++....................++ ", " ++....................++ ", " ++....................++ ", " ++....................++ ", " ++....................++ ", " ++....................++ ", " ++..@@@@@@@@@@@@@@@@..++ ", " ++..@@@@@@@@@@@@@@@@..++ ", " ++....................++ ", " ++....................++ ", " ++....................++ ", " ++....................++ ", " ++++++++++++++++++++++++ ", " ++++++++++++++++++++++++ ", " ", " "}; /* XPM */ static const char * const min_small_xpm[] = { "14 14 4 1", " c #09454A", ". c #218C98", "+ c #47D8E5", "@ c #FCFFFC", " ", " ++++++++++++ ", " +..........+ ", " +..........+ ", " +..........+ ", " +..........+ ", " +..........+ ", " +..........+ ", " +..........+ ", " +.@@@@@@@@.+ ", " +..........+ ", " +..........+ ", " ++++++++++++ ", " "}; #ifdef Q_WS_WINCE_WM static char * sbhandleup_xpm[] = { "26 41 45 1", " c None", ". c #000000", "+ c #E7E7E7", "@ c #D6D7D6", "# c #949294", "$ c #737573", "% c #636563", "& c #636163", "* c #5A5D5A", "= c #5A595A", "- c #525552", "; c #525152", "> c #4A4D4A", ", c #7B797B", "' c #CECFCE", ") c #CED3CE", "! c #6B6D6B", "~ c #6B696B", "{ c #737173", "] c #7B7D7B", "^ c #848684", "/ c #848284", "( c #8C8A8C", "_ c #8C8E8C", ": c #B5B2B5", "< c #FFFFFF", "[ c #949694", "} c #B5B6B5", "| c #9C9A9C", "1 c #ADAEAD", "2 c #9C9E9C", "3 c #BDBABD", "4 c #BDBEBD", "5 c #F7F3F7", "6 c #C6C3C6", "7 c #C6C7C6", "8 c #A5A2A5", "9 c #CECBCE", "0 c #FFFBFF", "a c #ADAAAD", "b c #A5A6A5", "c c #D6D3D6", "d c #B5BAB5", "e c #DEDFDE", "f c #DEDBDE", "..........................", "+@#$%%&&&**===---;;;;>=,'+", "+@#$%%&&&**===---;;;;>=$'+", ")$!!~~%%&&&**===---;;;;>;'", "#{$]],,$${{{!!~~%%%&&&*-;]", "#{$]],,$${{{!!~~%%%&&&*-;]", ",$^//]],,$${{{!!~~%%%&&*;*", ",,(^^//]],$${!!!!!~~%%%&-*", ",,(^^//]],$${!!!!!~~%%%&-*", "]]_((^^//]$!%%~!{{!!~~%%-*", "//#__((^^]{:<<:~!{{{!!~~=*", "//#__((^^]{:<<:~!{{{!!~~=&", "//###__(/$:<<<<:~{${{!!~*&", "^^[[##_^]:<<<<<<}!{$${{!*%", "^^[[##_^]:<<<<<<}!{$${{!*%", "((|[[#_/:<<<<<<<<}!$$${{&~", "((||[#^1<<<<1:<<<<}!$$$$&~", "((||[#^1<<<<1:<<<<}!$$$$&~", "__2|#(1<<<<}],}<<<<}{$,$%~", "##2|_1<<<<}^((]3<<<<}{$,~!", "##2|_1<<<<}^((]3<<<<}{$,~!", "##2#1<<<<3^###(/4<<<<}{,~{", "##2#1<<<<3^###(/4<<<<}{,~!", "[[2_5<<<4(#|[[#_/6<<<<,,!{", "[|2_5<<4_[||||[[_/7<<<,]{$", "[|2_5<<4_[||||[[_/7<<<,]{$", "||8_5<6#|2222|||[_/9<<,]{$", "228#06[28888222||[_/'<,/$,", "228#06[28888222||[_/'<,/$,", "22a|6[8bbbb88822||[(/c](,]", "881b8baaabbbb88222|[(^(_,]", "881b8baaabbbb88222|[(^(_,]", "88111111aaabbb88822|[###]/", "bb:::11111aaabbb8822||[[/^", "bb:::11111aaabbb8822||[[//", "bb:::::1111aaabbb8822||[/(", "3a1::::::1111aaabb8822|_^8", "da1::::::1111aaabb8822|_^8", "e1aaabbbb888822||[[##__((@", "+e4:aaabbbb88822||[[[#[b@+", "+e4:aaabbbb88822||[[[#[bf+"}; static char * sbhandledown_xpm[] = { "26 40 46 1", " c None", ". c #E7E7E7", "+ c #DEDFDE", "@ c #BDBEBD", "# c #B5B2B5", "$ c #ADAAAD", "% c #A5A6A5", "& c #A5A2A5", "* c #9C9E9C", "= c #9C9A9C", "- c #949694", "; c #949294", "> c #D6D7D6", ", c #DEDBDE", "' c #D6DBD6", ") c #ADAEAD", "! c #8C8E8C", "~ c #8C8A8C", "{ c #BDBABD", "] c #848684", "^ c #B5BAB5", "/ c #848284", "( c #848A84", "_ c #7B7D7B", ": c #7B797B", "< c #C6C3C6", "[ c #D6D3D6", "} c #FFFBFF", "| c #CECFCE", "1 c #FFFFFF", "2 c #737573", "3 c #F7F3F7", "4 c #CECBCE", "5 c #737173", "6 c #C6C7C6", "7 c #6B6D6B", "8 c #B5B6B5", "9 c #6B696B", "0 c #636563", "a c #636163", "b c #5A5D5A", "c c #5A595A", "d c #525552", "e c #525152", "f c #4A4D4A", "g c #C6CBC6", ".+@#$$$%%%%&&&**==---;-%>.", ".+@#$$$%%%%&&&**==---;-%,.", "')$$$%%%%&&&&**==--;;!!~~>", "{$)######))))$$$%%&&**=!]&", "^$)######))))$$$%%&&**=!]&", "%%#####))))$$$%%%&&**==-/(", "%%###)))))$$$%%%&&**==--/]", "%%###)))))$$$%%%&&**==--//", "&&))))))$$$%%%&&&**=-;;;_/", "&&)%&%$$$%%%%&&***=-~]~!:_", "&&)%&%$$$%%%%&&***=-~]~!:_", "**$=<-&%%%%&&&**==-~/[_~:_", "**&;}<-*&&&&***==-!/|1:/2:", "**&;}<-*&&&&***==-!/|1:/2:", "==&!31<;=****===-!/411:_5:", "-=*!311@!-====--!/6111:_52", "-=*!311@!-====--!/6111:_52", "--*!3111@~;=--;!/<1111::75", ";;*;)1111{];;;~/@111185:95", ";;*;)1111{];;;~/@111185:97", ";;*=!)11118]~~_{1111852:97", ";;*=!)11118]~~_{1111852:97", "!!*=;~)11118_:81111852:207", "~~==-;])1111)#1111872222a9", "~~==-;])1111)#1111872222a9", "~~=--;!/#111111118722255a0", "]]--;;!]_#11111187522557b0", "]]--;;!]_#11111187522557b0", "//;;;!!~/2#1111#95255779ba", "//;!!~~]]_5#11#975557799cb", "//;!!~~]]_5#11#975557799ca", "__!~~]]//_27009755779900db", "::~]]//__:2257777799000adb", "::~]]//__:2257777799000adb", ":2]//__::225557799000aabeb", ";52__::225557799000aaabde_", ";52__::225557799000aaabde_", "[2779900aaabbcccdddeeeefeg", ".>;200aaabbcccdddeeeefc:|.", ".>;200aaabbcccdddeeeefc2|."}; static char * sbgripdown_xpm[] = { "26 34 39 1", " c None", ". c #949294", "+ c #9C9E9C", "@ c #9C9A9C", "# c #949694", "$ c #8C8E8C", "% c #8C8A8C", "& c #848684", "* c #848284", "= c #7B7D7B", "- c #7B797B", "; c #6B696B", "> c #636563", ", c #737573", "' c #636163", ") c #737173", "! c #5A5D5A", "~ c #6B6D6B", "{ c #5A595A", "] c #B5B6B5", "^ c #BDBEBD", "/ c #ADAEAD", "( c #BDBABD", "_ c #525552", ": c #313031", "< c #525152", "[ c #ADAAAD", "} c #BDBAB5", "| c #4A4D4A", "1 c #4A494A", "2 c #C6C3C6", "3 c #C6CBC6", "4 c #E7E7E7", "5 c #DEDFDE", "6 c #E7E3E7", "7 c #DEE3DE", "8 c #CECBCE", "9 c #8C928C", "0 c #CECFCE", "..+++@@@###...$$%&&**==-;>", "$.++@@@@##...$$%%&**==-->>", "$$+@@@@###..$$%%&&*==--,>>", "$$@@@@###..$$%%&&**==-,,>'", "%%@@@###..$$$%&&**==--,,''", "%%@@###..$$$%&&**==--,,)''", "%%@###...$$%%&&*==--,,))'!", "&&###...$$%%&&**==--,)))!!", "&&##...$$%%&&**==--,,))~!!", "&&#...$$%%&&**==--,,))~~!{", "**...$$%%&&**==--,,))~~;!{", "**..$$%%&&**===--,)))~~;{{", "**.$$%%&]^&===//,,))~~;;{{", "==$$%%&&]^*==-((,))~~;;>{_", "==$%%&&***::--,,::~~;;;>__", "==%%&&&**=::-,,)::~~;;>>__", "--%&&&**==--,,)))~~;;>>>__", "--&&&**==--,,)))~~;;>>>'_<", ",-&&**==]^-,))[[~;;>>>''<<", ",,&**==-]^-)))}};;>>>'''<<", ",,**==--,,::)~~;::>>'''!<<", "))*==--,,)::~~;;::>'''!!<|", "))==--,,)))~~;;;>>'''!!!||", "))=--,,)))~~;;;>>'''!!!{||", "~~--,,)))~~;;;>>'''!!!{{||", "~~-,,)))~~;;>>>'''!!!{{{|1", ";;,,)))~~;;>>>'''!!!{{{_1<", "~;,)))~~;;>>>'''!!!{{{__1'", "%>~))~~;;>>>'''!!!{{{__|1$", "2>>~~~;;>>>''!!!{{{{__<113", "4%'';;;>>>''!!!{{{{__<11%4", "45-!!'>>>''!!!{{{{_<|11)64", "447+!{{___<<<||||1111|+444", "444489~__<<<||||111>$04444"}; static char * sbgripup_xpm[] = { "26 34 38 1", " c None", ". c #E7E7E7", "+ c #D6DBD6", "@ c #C6C7C6", "# c #B5B6B5", "$ c #ADAEAD", "% c #ADAAAD", "& c #A5A6A5", "* c #A5A2A5", "= c #BDBEBD", "- c #DEDFDE", "; c #C6CBC6", "> c #9C9E9C", ", c #E7E3E7", "' c #BDBABD", ") c #B5B2B5", "! c #9C9A9C", "~ c #DEE3DE", "{ c #949694", "] c #D6D7D6", "^ c #949294", "/ c #DEDBDE", "( c #8C8E8C", "_ c #8C8A8C", ": c #848684", "< c #D6D3CE", "[ c #CECBCE", "} c #D6D3D6", "| c #848284", "1 c #313031", "2 c #7B7D7B", "3 c #CECFCE", "4 c #CECBC6", "5 c #7B797B", "6 c #737573", "7 c #737173", "8 c #6B6D6B", "9 c #6B696B", "....+@#$$%%%%&&&***$=-....", "...;$$$$$%%%&&&&**>>>>@...", ".,'$$)#'#####)))$$$%*!!$~.", ".=$)#'''####))))$$$%%*!{'.", "]$$''''#####)))$$$%%%&*{^/", "=$#'''#####)))$$$$%%&&&!^#", "$$'''#####))))$$$%%%&&*>(!", "$$''#####))))$$$%%%&&&*>(^", "$$######))))$$$$%%&&&**>(_", "%$#####))))$$$$%%%&&***>__", "%$####))))$$$$%%%&&&**>>__", "%%###)))))$$$%%%&&&**>>>_:", "%%##))))<])$$%[[&&***>>!::", "%%#)))))<]$$%%}<&&**>>!!:|", "&%)))))$$$11%%&&11*>>>!!:|", "&&))))$$$$11%&&&11*>>!!{||", "&&)))$$$$$%%%&&&**>>!!!{|2", "&&))$$$$$%%%&&&**>>>!!{{|2", "*&)$$$$$3]%&&&4@*>>!!{{{22", "**$$$$$%3]%&&&<<>>!!!{{^25", "**$$$$%%%%11&**>11!!{{^^25", "**$$$%%%%&11***>11!!{{^^55", "**$$%%%%&&&***>>!!!{{^^(55", ">>$%%%%&&&***>>>!!{{^^((56", ">>%%%%&&&&***>>!!!{{^^((66", ">>%%%&&&&***>>!!!{{^^((_67", "!>%%&&&&***>>>!!{{{^^(__67", "!!%&&&&***>>>!!!{{^^((_:77", "!!&&&&***>>>!!!{{^^((__:77", "!!&&&****>>!!!{{^^^(__::78", "{!&&****>>>!!{{{^^((_::|88", "{{&****>>>!!!{{^^((__:||88", "{{****>>>!!!{{^^^(__::|289", "{{***>>>!!!{{{^^((_::||289"}; static char * sbgripmiddle_xpm[] = { "26 2 12 1", " c None", ". c #949294", "+ c #A5A2A5", "@ c #9C9E9C", "# c #9C9A9C", "$ c #949694", "% c #8C8E8C", "& c #8C8A8C", "* c #848684", "= c #848284", "- c #7B7D7B", "; c #6B696B", "..++@@@###$$$..%%&&*==--;;", "..++@@@###$$$..%%&&*==--;;"}; static char * listviewhighmiddle_xpm[] = { "8 46 197 2", " c None", ". c #66759E", "+ c #6C789D", "@ c #6A789E", "# c #6B789E", "$ c #6A779D", "% c #6C789C", "& c #6F7D9B", "* c #6F7D9A", "= c #9DB6EE", "- c #9DB6ED", "; c #9CB6ED", "> c #A1B6EF", ", c #A2B6F0", "' c #93AAE9", ") c #95ABEA", "! c #94ABEA", "~ c #94A9E8", "{ c #8BA8EA", "] c #8BA7EA", "^ c #8AA7EA", "/ c #8EAAE8", "( c #8FAAE8", "_ c #88A2E7", ": c #8CA3E8", "< c #8BA3E7", "[ c #8BA3E8", "} c #8BA2E7", "| c #8CA2E7", "1 c #8DA2E7", "2 c #87A1E8", "3 c #87A1E9", "4 c #86A0E8", "5 c #86A1E7", "6 c #87A2E7", "7 c #859EE9", "8 c #849DE9", "9 c #869EE9", "0 c #869FE9", "a c #7C9BEA", "b c #7C9CEA", "c c #7B9CEA", "d c #7C9BE9", "e c #7E9CE9", "f c #7B9AEA", "g c #7C99E9", "h c #7C9AEA", "i c #7B9AE8", "j c #7A9AEA", "k c #7996E1", "l c #7C96E4", "m c #7B96E3", "n c #7B95E3", "o c #7E95E5", "p c #7E95E6", "q c #7292E1", "r c #7490DF", "s c #7591E0", "t c #7590DF", "u c #7392E1", "v c #6D8CDE", "w c #6F8EDD", "x c #6E8DDD", "y c #6E8DDE", "z c #6F8EDE", "A c #6E8EDE", "B c #718EDD", "C c #728EDD", "D c #6B89E0", "E c #6C89DF", "F c #6D89E0", "G c #6D89DF", "H c #6C88DF", "I c #6D88DF", "J c #6D86DD", "K c #6086E0", "L c #6686E0", "M c #6586E0", "N c #6486E0", "O c #6485E0", "P c #6786DF", "Q c #5F85E0", "R c #6583DE", "S c #6683DE", "T c #6682DD", "U c #6086DF", "V c #5F86E0", "W c #567ED7", "X c #567ED8", "Y c #557DD7", "Z c #5A7FD8", "` c #6281DA", " . c #5379D9", ".. c #5278D9", "+. c #547BD8", "@. c #4C73D7", "#. c #4B72D2", "$. c #4C73D4", "%. c #4C73D3", "&. c #4B72D4", "*. c #4F75D3", "=. c #5074D2", "-. c #4971D0", ";. c #4871D0", ">. c #335ECF", ",. c #325ECB", "'. c #335ECD", "). c #335ECE", "!. c #325DCD", "~. c #2E59C9", "{. c #3059C9", "]. c #2F59C9", "^. c #2F59C8", "/. c #2B59CA", "(. c #3355C6", "_. c #3354C5", ":. c #3156C7", "<. c #3056C7", "[. c #3355C7", "}. c #3355C5", "|. c #254EBF", "1. c #1F51C1", "2. c #234FC0", "3. c #234FBF", "4. c #2350C0", "5. c #1E50BE", "6. c #1D50C0", "7. c #264DBE", "8. c #264CBD", "9. c #254DBE", "0. c #244EBF", "a. c #254DBF", "b. c #234CBF", "c. c #244CC0", "d. c #244BC0", "e. c #234BC0", "f. c #234BBF", "g. c #234CBE", "h. c #2049B7", "i. c #2A49B5", "j. c #2749B5", "k. c #2749B6", "l. c #2D49B4", "m. c #2649B6", "n. c #2946B5", "o. c #2A48B6", "p. c #2947B5", "q. c #2946B6", "r. c #2848B6", "s. c #2549B5", "t. c #2648B6", "u. c #2744B5", "v. c #2744B4", "w. c #2744AF", "x. c #2543B4", "y. c #2543B2", "z. c #2442B2", "A. c #2442B3", "B. c #2442B5", "C. c #2543B3", "D. c #1F40B1", "E. c #1E40B1", "F. c #243EAE", "G. c #273BAC", "H. c #263DAC", "I. c #253CAB", "J. c #273CAB", "K. c #273CAC", "L. c #263BAA", "M. c #253CAE", "N. c #263BA6", "O. c #253BA5", "P. c #253AA5", "Q. c #253BA6", "R. c #253CA7", "S. c #263AA6", "T. c #243CA6", "U. c #253CA5", "V. c #273BA8", "W. c #2F4DA4", "X. c #2F4DA3", "Y. c #1B2F85", "Z. c #B5B5B6", "`. c #B5B5B5", " + c #B5B6B6", ".+ c #B5B4B6", "++ c #C2C3C5", "@+ c #C0C3C3", "#+ c #C1C3C4", "$+ c #E3E3E3", "%+ c #E3E3E4", "&+ c #E4E3E4", "*+ c #E2E3E4", "=+ c #ECEEEB", "-+ c #EBEDEA", ";+ c #EEF0ED", ">+ c #EFF0EE", ". + @ @ # # $ % ", "& & * & & & & & ", "= = - = = ; > , ", "' ) ! ! ! ) ' ~ ", "{ ] { { { ^ / ( ", "_ : < [ : } | 1 ", "2 2 2 3 2 4 5 6 ", "7 7 7 7 7 8 9 0 ", "a b a a a c d e ", "f g h h h h i j ", "k l m m m n o p ", "q q q q q q q q ", "r r s s s t q u ", "v w x y z A B C ", "D E F F G F H I ", "J K L M N O P Q ", "R R S S S T U V ", "W W X X X Y Z ` ", " . . . . ...+.W ", " . . . . ..... .", "@.#.$.$.%.&.*.=.", "-.-.;.-.-.-.-.-.", ">.,.'.).).!.!.>.", "~.{.].^.].^././.", "(.(.(.(.(._.:.<.", "(.(.[.[.[.[.(.}.", "|.1.2.3.3.4.5.6.", "7.7.7.7.7.8.9.0.", "a.b.c.d.c.e.f.g.", "h.i.j.k.j.k.l.m.", "n.o.p.q.r.p.s.t.", "u.u.v.u.u.u.u.u.", "w.x.y.z.A.y.B.C.", "D.D.E.D.D.D.D.D.", "D.D.E.D.D.D.D.D.", "F.G.H.I.J.K.L.M.", "N.N.O.N.N.P.Q.R.", "N.N.S.N.N.N.N.N.", "T.N.T.T.T.U.N.V.", "W.W.X.W.W.W.W.W.", "W.W.W.W.W.W.W.W.", "Y.Y.Y.Y.Y.Y.Y.Y.", "Z.`. + +.+Z.`.`.", "++@+#+#+#+#+@+@+", "$+%+&+&+*+%+%+%+", "=+-+;+-+-+>+-+-+"}; static char * listviewhighcornerleft_xpm[] = { "100 46 1475 2", " c None", ". c #FBFBFC", "+ c #E8EAE7", "@ c #758DC3", "# c #42599E", "$ c #28418A", "% c #19418F", "& c #3F5695", "* c #415896", "= c #435A98", "- c #445C99", "; c #465E9B", "> c #48609B", ", c #49629C", "' c #4A639D", ") c #49639D", "! c #4A629D", "~ c #4B639D", "{ c #4B649D", "] c #4C659D", "^ c #4D669D", "/ c #4E689D", "( c #506A9D", "_ c #516A9D", ": c #536B9C", "< c #546C9C", "[ c #566D9B", "} c #576D9B", "| c #586E9C", "1 c #5B6F9D", "2 c #61739D", "3 c #63749E", "4 c #64749E", "5 c #68769E", "6 c #6A779E", "7 c #6B789E", "8 c #66759E", "9 c #6C789D", "0 c #EEF0ED", "a c #D0D3DC", "b c #3E51A3", "c c #28428B", "d c #29428C", "e c #425996", "f c #455C99", "g c #485F9C", "h c #49619E", "i c #4A63A0", "j c #4B64A1", "k c #4B65A1", "l c #4C66A2", "m c #4D67A2", "n c #4F69A1", "o c #516AA1", "p c #536CA0", "q c #556DA1", "r c #576EA0", "s c #586F9F", "t c #586E9F", "u c #596F9E", "v c #5A6F9E", "w c #5C709E", "x c #5E719E", "y c #5F729F", "z c #62739F", "A c #63739E", "B c #64749D", "C c #65749E", "D c #69769D", "E c #6C799E", "F c #6D799F", "G c #707D9F", "H c #717F9E", "I c #6E7AA1", "J c #6C789E", "K c #6F7C9C", "L c #6F7D9B", "M c #2A4AA0", "N c #4971D0", "O c #4C72D8", "P c #5472C0", "Q c #5573BF", "R c #5774BF", "S c #5875BF", "T c #5976C1", "U c #5A76C1", "V c #5C78C2", "W c #5E7AC2", "X c #607CC3", "Y c #627EC3", "Z c #637FC4", "` c #6581C5", " . c #6682C6", ".. c #6783C7", "+. c #6984C8", "@. c #6B85C9", "#. c #6D87CA", "$. c #6F89CB", "%. c #718CCD", "&. c #748ECF", "*. c #7690D0", "=. c #7992D2", "-. c #7A93D3", ";. c #7C95D5", ">. c #7F98D7", ",. c #8099D8", "'. c #859CDB", "). c #8AA0DD", "!. c #8DA3DF", "~. c #8FA5E0", "{. c #90A5E0", "]. c #91A6E1", "^. c #91A5E1", "/. c #90A4E0", "(. c #8EA3DE", "_. c #92A6E2", ":. c #8FA4DF", "<. c #90A5DE", "[. c #90A5DC", "}. c #90A6DB", "|. c #91A6E0", "1. c #93A7E2", "2. c #95AAE6", "3. c #99AEEA", "4. c #9AB2EA", "5. c #99B1E9", "6. c #99B1E7", "7. c #98AFE6", "8. c #93A8E2", "9. c #97ACE7", "0. c #9AB3EB", "a. c #9DB5ED", "b. c #9DB6EE", "c. c #375095", "d. c #4056AD", "e. c #506DCD", "f. c #4360CC", "g. c #345ED6", "h. c #335ECF", "i. c #355ED6", "j. c #355FD6", "k. c #365FD6", "l. c #355FD0", "m. c #3760D5", "n. c #3A63D4", "o. c #3C63D1", "p. c #3B63CD", "q. c #3B63C9", "r. c #3B62C9", "s. c #3D63C8", "t. c #4065C5", "u. c #4567C5", "v. c #496BC5", "w. c #4F70C7", "x. c #5273C8", "y. c #5475CA", "z. c #5777CB", "A. c #5879CD", "B. c #5A7BCE", "C. c #5D7DCF", "D. c #5F7ECF", "E. c #617FD0", "F. c #6381D1", "G. c #6583D2", "H. c #6785D2", "I. c #6886D3", "J. c #6A88D4", "K. c #6C89D5", "L. c #6E8BD6", "M. c #708CD7", "N. c #718DD8", "O. c #738EDA", "P. c #748FDB", "Q. c #7691DC", "R. c #7893DD", "S. c #7994DD", "T. c #7A96DE", "U. c #7B97DF", "V. c #7C98E0", "W. c #7E9AE2", "X. c #7F9BE3", "Y. c #829DE4", "Z. c #849FE5", "`. c #87A0E6", " + c #88A1E7", ".+ c #89A2E6", "++ c #8CA3E7", "@+ c #8EA5E9", "#+ c #8EA6E9", "$+ c #8FA7E9", "%+ c #8FA8E8", "&+ c #8FA9E8", "*+ c #91A9E8", "=+ c #90A7E8", "-+ c #8FA8EA", ";+ c #90AAEA", ">+ c #93ABEA", ",+ c #95ABEA", "'+ c #93ABE9", ")+ c #94ABEA", "!+ c #90A9EA", "~+ c #93AAE9", "{+ c #273E7E", "]+ c #345ED5", "^+ c #3D60CE", "/+ c #3D60CF", "(+ c #345ECF", "_+ c #335ED0", ":+ c #355FD3", "<+ c #3A60CE", "[+ c #3A5FCB", "}+ c #385FC9", "|+ c #3B60C8", "1+ c #3C63CB", "2+ c #3E64CB", "3+ c #4166CA", "4+ c #4568C9", "5+ c #4A6CC7", "6+ c #4F71C8", "7+ c #5172CA", "8+ c #5475CE", "9+ c #5678D3", "0+ c #597CD6", "a+ c #5C7ED7", "b+ c #5E7FD8", "c+ c #6181D9", "d+ c #6383DA", "e+ c #6585DA", "f+ c #6786DB", "g+ c #6988DC", "h+ c #6B8ADD", "i+ c #6D8BDE", "j+ c #6F8DDE", "k+ c #718EDF", "l+ c #728FE0", "m+ c #7390E1", "n+ c #7390E2", "o+ c #7491E3", "p+ c #7592E4", "q+ c #7693E4", "r+ c #7794E5", "s+ c #7894E5", "t+ c #7995E6", "u+ c #7B96E6", "v+ c #7C97E7", "w+ c #7D9AE8", "x+ c #7F9CE9", "y+ c #829DE9", "z+ c #849EE9", "A+ c #859EE9", "B+ c #87A0E7", "C+ c #8AA2E7", "D+ c #8BA3E8", "E+ c #89A2E7", "F+ c #8CA6EA", "G+ c #8BA6EA", "H+ c #8BA7EA", "I+ c #8CA3E8", "J+ c #8BA8EA", "K+ c #8CA7EA", "L+ c #8CA8EA", "M+ c #4659C7", "N+ c #355ECF", "O+ c #3660CF", "P+ c #3860CE", "Q+ c #3961CD", "R+ c #3B61CB", "S+ c #3B61CA", "T+ c #3D62CA", "U+ c #3D63CA", "V+ c #4165CB", "W+ c #456ACB", "X+ c #4B6FCD", "Y+ c #5174CE", "Z+ c #5275D1", "`+ c #5477D4", " @ c #5678D9", ".@ c #587ADB", "+@ c #597BDB", "@@ c #5B7DDC", "#@ c #5E7FDC", "$@ c #6081DD", "%@ c #6283DE", "&@ c #6484DF", "*@ c #6787E0", "=@ c #6989E1", "-@ c #6B8BE1", ";@ c #6D8DE2", ">@ c #6F8EE3", ",@ c #718FE4", "'@ c #7290E4", ")@ c #7491E5", "!@ c #7692E6", "~@ c #7793E5", "{@ c #7894E6", "]@ c #7895E7", "^@ c #7996E8", "/@ c #7A97E8", "(@ c #7B98E9", "_@ c #7D99E8", ":@ c #7F9AE8", "<@ c #7F9BE9", "[@ c #7F9CEA", "}@ c #859EE8", "|@ c #859FE8", "1@ c #85A0E9", "2@ c #869FE9", "3@ c #86A1E7", "4@ c #86A0E9", "5@ c #87A1E7", "6@ c #88A2E7", "7@ c #87A1E9", "8@ c #5A6FCA", "9@ c #365FCF", "0@ c #345ED0", "a@ c #385FCC", "b@ c #385FCE", "c@ c #3A61CC", "d@ c #3B62CD", "e@ c #3E64CD", "f@ c #4167CF", "g@ c #4469CF", "h@ c #486CD1", "i@ c #4D71D2", "j@ c #5175D4", "k@ c #5376D6", "l@ c #5578DA", "m@ c #5679DC", "n@ c #587BDD", "o@ c #5A7DDE", "p@ c #5D80DE", "q@ c #5F82DF", "r@ c #6284DF", "s@ c #6585E0", "t@ c #6787E1", "u@ c #6988E2", "v@ c #6B8AE2", "w@ c #6D8CE3", "x@ c #6E8DE3", "y@ c #708EE4", "z@ c #718FE3", "A@ c #7391E4", "B@ c #7592E5", "C@ c #7895E5", "D@ c #7996E6", "E@ c #7A97E6", "F@ c #7B98E7", "G@ c #7A98E8", "H@ c #7B99E9", "I@ c #7E9AE9", "J@ c #7D9AE9", "K@ c #7E9AEA", "L@ c #809CE9", "M@ c #819DE8", "N@ c #7F9BEA", "O@ c #819DE9", "P@ c #819CE9", "Q@ c #839EE9", "R@ c #839EE8", "S@ c #839DEA", "T@ c #859FE9", "U@ c #87A0E8", "V@ c #86A0E8", "W@ c #87A1E8", "X@ c #3760CF", "Y@ c #3A61CE", "Z@ c #3A62CD", "`@ c #3F66CE", " # c #4368D0", ".# c #466CD2", "+# c #496DD5", "@# c #4E72D6", "## c #5175D8", "$# c #5276DA", "%# c #5578DC", "&# c #577ADC", "*# c #597CDD", "=# c #5B7DDD", "-# c #5D7FDE", ";# c #5E81DE", "># c #6183DF", ",# c #6386DF", "'# c #6687E0", ")# c #6888E0", "!# c #6A89E1", "~# c #6C8AE1", "{# c #6E8CE2", "]# c #6F8DE2", "^# c #7390E4", "/# c #7390E3", "(# c #7491E4", "_# c #7693E5", ":# c #7895E6", "<# c #7896E6", "[# c #7997E7", "}# c #7B97E7", "|# c #7B98E8", "1# c #7C98E8", "2# c #7E9BE9", "3# c #809CEA", "4# c #819CEA", "5# c #839DE9", "6# c #365FD0", "7# c #3660D0", "8# c #3961CF", "9# c #3B63CF", "0# c #3D64D0", "a# c #4067D0", "b# c #4469D2", "c# c #466BD3", "d# c #496ED5", "e# c #4C71D6", "f# c #4E72D8", "g# c #5074D9", "h# c #5376DB", "i# c #5578DB", "j# c #587ADC", "k# c #5B7CDC", "l# c #5D7EDD", "m# c #5F80DD", "n# c #6081DE", "o# c #6383DE", "p# c #6686DF", "q# c #6887E0", "r# c #6988E0", "s# c #6B89E1", "t# c #6C8AE0", "u# c #6E8CE1", "v# c #708EE2", "w# c #718FE2", "x# c #7290E3", "y# c #7391E2", "z# c #7492E1", "A# c #7592E2", "B# c #7691E3", "C# c #7591E3", "D# c #7692E3", "E# c #7693E3", "F# c #7793E4", "G# c #7893E4", "H# c #7994E5", "I# c #7D97E8", "J# c #7E98E8", "K# c #7D98E8", "L# c #7D99E9", "M# c #7D9BEA", "N# c #7D9CEA", "O# c #7E99E8", "P# c #7D9AEA", "Q# c #7C9BEA", "R# c #7C9CEA", "S# c #355FCF", "T# c #3860D0", "U# c #3A62D0", "V# c #3C64D1", "W# c #4167D1", "X# c #4369D3", "Y# c #466BD4", "Z# c #486DD5", "`# c #4A6ED7", " $ c #4C70D8", ".$ c #5478D9", "+$ c #577BDA", "@$ c #597DDB", "#$ c #5B7EDB", "$$ c #5D7FDC", "%$ c #6182DE", "&$ c #6284DE", "*$ c #6485DF", "=$ c #6586DF", "-$ c #6787DF", ";$ c #6888DF", ">$ c #6A8ADF", ",$ c #6C8BE0", "'$ c #6D8CE0", ")$ c #6E8DE1", "!$ c #6F8DE1", "~$ c #708EE1", "{$ c #718FE0", "]$ c #728FE1", "^$ c #7390E0", "/$ c #738FE0", "($ c #7490E1", "_$ c #7590E1", ":$ c #7591E1", "<$ c #7592E1", "[$ c #7692E2", "}$ c #7794E2", "|$ c #7894E3", "1$ c #7996E3", "2$ c #7A96E5", "3$ c #7B98E6", "4$ c #7B9AE8", "5$ c #7C99E8", "6$ c #7C96E5", "7$ c #7D97E7", "8$ c #7C99E9", "9$ c #7B9AE9", "0$ c #7B9AEA", "a$ c #5B6DCF", "b$ c #305EC8", "c$ c #335ECE", "d$ c #305ECA", "e$ c #345FCF", "f$ c #3761D0", "g$ c #3A62D1", "h$ c #3C64D2", "i$ c #4066D3", "j$ c #466BD5", "k$ c #486ED6", "l$ c #4A6ED6", "m$ c #4D71D8", "n$ c #4F72D9", "o$ c #5073D9", "p$ c #4F72D8", "q$ c #5074D8", "r$ c #5276D9", "s$ c #587ADA", "t$ c #5B7CDB", "u$ c #5D7EDC", "v$ c #5F7FDD", "w$ c #6081DC", "x$ c #6182DD", "y$ c #6283DD", "z$ c #6484DE", "A$ c #6585DD", "B$ c #6787DE", "C$ c #6988DF", "D$ c #6A89DE", "E$ c #6C8ADF", "F$ c #6D8BDF", "G$ c #6E8CE0", "H$ c #6F8DE0", "I$ c #718EE0", "J$ c #728FDF", "K$ c #728FDE", "L$ c #7290E0", "M$ c #7190E0", "N$ c #7291E0", "O$ c #7191E0", "P$ c #7392E1", "Q$ c #7493E1", "R$ c #7594E1", "S$ c #7594E2", "T$ c #7694E2", "U$ c #7695E2", "V$ c #7A96E4", "W$ c #7895E2", "X$ c #7A96E2", "Y$ c #7A96E3", "Z$ c #7B96E3", "`$ c #7996E1", " % c #7C96E4", ".% c #305EC9", "+% c #315ECC", "@% c #325ECE", "#% c #3760D0", "$% c #3962D1", "%% c #3E66D3", "&% c #4268D4", "*% c #446BD5", "=% c #476CD6", "-% c #496ED7", ";% c #4B6FD7", ">% c #4C70D7", ",% c #4E71D7", "'% c #5074D7", ")% c #5276D8", "!% c #5376D8", "~% c #5779DA", "{% c #597ADA", "]% c #5A7BDB", "^% c #5B7CDA", "/% c #5D7EDB", "(% c #5E7FDB", "_% c #6182DB", ":% c #6384DC", "<% c #6586DD", "[% c #6686DC", "}% c #6887DD", "|% c #6988DD", "1% c #6A8ADE", "2% c #6B8BDE", "3% c #6C8CDE", "4% c #6E8DDF", "5% c #6E8CDF", "6% c #6D8DDF", "7% c #6C8BDF", "8% c #6F8DDF", "9% c #718FDF", "0% c #7290DF", "a% c #7391E0", "b% c #7491E0", "c% c #7292E1", "d% c #3959C5", "e% c #345BC5", "f% c #315EC8", "g% c #355BC5", "h% c #325EC8", "i% c #315ECB", "j% c #345DCC", "k% c #335ECD", "l% c #345ECD", "m% c #355FCE", "n% c #3862D0", "o% c #3E66D2", "p% c #456BD5", "q% c #476CD5", "r% c #4B6ED7", "s% c #4B6FD6", "t% c #4B6FD5", "u% c #4D71D6", "v% c #5073D7", "w% c #5174D7", "x% c #5275D8", "y% c #5577D8", "z% c #5678D8", "A% c #5779D9", "B% c #587AD8", "C% c #597CD9", "D% c #5B7DD9", "E% c #5D7FDA", "F% c #5F80DB", "G% c #6182DC", "H% c #6484DC", "I% c #6585DC", "J% c #6787DD", "K% c #6988DE", "L% c #6B8ADE", "M% c #6B8ADF", "N% c #6989DE", "O% c #6B89DE", "P% c #6E8BDF", "Q% c #708CDE", "R% c #708DDF", "S% c #708FDF", "T% c #728EDF", "U% c #6F8EDD", "V% c #728EDD", "W% c #7390DF", "X% c #7490DF", "Y% c #335DC8", "Z% c #3759C5", "`% c #3859C5", " & c #335EC8", ".& c #325DCA", "+& c #345CCB", "@& c #335DCC", "#& c #345DCD", "$& c #355FCD", "%& c #3861D0", "&& c #3B64D1", "*& c #3E65D2", "=& c #4168D3", "-& c #456AD5", ";& c #4B6ED5", ">& c #4C6FD4", ",& c #4D70D5", "'& c #4F72D6", ")& c #5173D6", "!& c #5375D7", "~& c #5476D8", "{& c #5577D7", "]& c #5477D8", "^& c #5677D8", "/& c #5879D9", "(& c #597AD9", "_& c #5C7DDA", ":& c #6080DC", "<& c #6080DB", "[& c #6181DC", "}& c #6282DC", "|& c #6383DD", "1& c #6484DD", "2& c #6686DE", "3& c #6685DE", "4& c #6786DE", "5& c #6687DE", "6& c #6887DE", "7& c #6987DE", "8& c #6788DF", "9& c #6785DF", "0& c #6B89DF", "a& c #6C89DF", "b& c #6F8DDD", "c& c #6D8CDE", "d& c #445BBB", "e& c #3759BE", "f& c #375AC6", "g& c #355CC8", "h& c #345CCA", "i& c #355ECC", "j& c #365FCD", "k& c #3761CE", "l& c #3A63D0", "m& c #3D65D1", "n& c #466AD4", "o& c #476BD4", "p& c #486CD3", "q& c #4A6ED4", "r& c #4B6ED4", "s& c #4E71D6", "t& c #4F71D5", "u& c #5072D6", "v& c #5274D7", "w& c #5273D7", "x& c #5274D6", "y& c #5476D7", "z& c #5779D8", "A& c #587AD9", "B& c #5A7CDA", "C& c #5C7DDB", "D& c #5D7EDA", "E& c #6081DA", "F& c #6181DB", "G& c #6283DC", "H& c #6483DD", "I& c #6483DE", "J& c #6585DE", "K& c #6786DF", "L& c #6886DE", "M& c #6887DF", "N& c #6987DF", "O& c #6A88DF", "P& c #6786E0", "Q& c #6A86DE", "R& c #6B89E0", "S& c #365BC8", "T& c #365CC8", "U& c #375DCA", "V& c #375FCB", "W& c #3860CD", "X& c #3C63D0", "Y& c #4167D2", "Z& c #4268D2", "`& c #4368D2", " * c #4367D2", ".* c #4568D2", "+* c #466AD2", "@* c #496CD3", "#* c #4A6DD3", "$* c #4A6DD4", "%* c #4D70D4", "&* c #4F72D5", "** c #4C70D4", "=* c #4E72D5", "-* c #5173D5", ";* c #5375D6", ">* c #597BDA", ",* c #5B7DDA", "'* c #5C7EDB", ")* c #5D7FDB", "!* c #5E80DB", "~* c #5E81DA", "{* c #5F81DB", "]* c #5F82DB", "^* c #6384DD", "/* c #6384DE", "(* c #6585DF", "_* c #6486E0", ":* c #6583DD", "<* c #6386E0", "[* c #6686E0", "}* c #6B86DD", "|* c #6D86DD", "1* c #6086E0", "2* c #5573CD", "3* c #3959C3", "4* c #3959C4", "5* c #3759C0", "6* c #375BC7", "7* c #365CC7", "8* c #395FCC", "9* c #3B62CE", "0* c #3E64D0", "a* c #4066D1", "b* c #4166D1", "c* c #4064CF", "d* c #4065CF", "e* c #4266D0", "f* c #4468D1", "g* c #4569D1", "h* c #476BD2", "i* c #466AD1", "j* c #476AD2", "k* c #456AD1", "l* c #496DD2", "m* c #4A6FD3", "n* c #496ED2", "o* c #4B70D4", "p* c #4D71D4", "q* c #4E72D4", "r* c #5073D4", "s* c #5174D5", "t* c #5175D5", "u* c #5276D6", "v* c #5377D6", "w* c #5478D7", "x* c #5579D7", "y* c #567AD8", "z* c #577BD9", "A* c #597CD8", "B* c #5A7DD9", "C* c #5A7ED9", "D* c #5B7FDA", "E* c #5C80DA", "F* c #5D80DA", "G* c #5E81DB", "H* c #5D80DB", "I* c #6082DC", "J* c #6183DD", "K* c #6183DE", "L* c #6082DB", "M* c #6282DE", "N* c #6682DE", "O* c #6583DE", "P* c #3759BF", "Q* c #375AC2", "R* c #375AC1", "S* c #375AC4", "T* c #395DCA", "U* c #3A5ECA", "V* c #3C60CC", "W* c #3D61CD", "X* c #3D61CC", "Y* c #3C61CD", "Z* c #3E62CD", "`* c #3F64CE", " = c #4266CF", ".= c #4468D0", "+= c #4267CF", "@= c #4166CE", "#= c #4065CE", "$= c #4166CD", "%= c #4267CE", "&= c #456AD0", "*= c #4368CE", "== c #4468CF", "-= c #4569D0", ";= c #486BD1", ">= c #4B6FD3", ",= c #4C70D3", "'= c #4F73D4", ")= c #5275D5", "!= c #5477D6", "~= c #577BD7", "{= c #587CD8", "]= c #577CD8", "^= c #597DD9", "/= c #5A7DDA", "(= c #597DDA", "_= c #587CDA", ":= c #5A7EDA", "<= c #567BD8", "[= c #557AD9", "}= c #567BD9", "|= c #577CD9", "1= c #587DD9", "2= c #587ED9", "3= c #577ED8", "4= c #587DD8", "5= c #587ED8", "6= c #567ED7", "7= c #526ABD", "8= c #3759C1", "9= c #385BC7", "0= c #395CC8", "a= c #3B5DC9", "b= c #3B5ECA", "c= c #3A5FCA", "d= c #3B60CC", "e= c #3C61CC", "f= c #3D62CD", "g= c #3E63CD", "h= c #3C61CB", "i= c #3C61CA", "j= c #3D62CB", "k= c #3F64CC", "l= c #4065CD", "m= c #4669D0", "n= c #476AD0", "o= c #496BD1", "p= c #4A6DD2", "q= c #4B6ED2", "r= c #4D71D3", "s= c #4E73D4", "t= c #4F74D4", "u= c #5075D5", "v= c #5276D5", "w= c #5377D7", "x= c #5278D7", "y= c #5277D6", "z= c #5378D7", "A= c #5379D8", "B= c #5379D9", "C= c #5278D8", "D= c #5178D7", "E= c #3355C0", "F= c #3556C1", "G= c #395AC6", "H= c #385AC7", "I= c #395BC7", "J= c #395EC9", "K= c #395FCA", "L= c #3B60CA", "M= c #3B60CB", "N= c #375DC7", "O= c #385EC8", "P= c #395FC9", "Q= c #3A60CA", "R= c #3D63CC", "S= c #4367CF", "T= c #476BD1", "U= c #4A6ED2", "V= c #4B6FD2", "W= c #4C6FD2", "X= c #4D70D1", "Y= c #4E71D2", "Z= c #4E72D2", "`= c #4E74D4", " - c #4E75D5", ".- c #4E75D4", "+- c #4F75D3", "@- c #5075D2", "#- c #5075D3", "$- c #5177D7", "%- c #5178D8", "&- c #4F75D5", "*- c #5076D5", "=- c #4F76D6", "-- c #5279D9", ";- c #3C52B1", ">- c #3656C3", ",- c #3757C5", "'- c #3758C6", ")- c #3759C6", "!- c #375BC6", "~- c #385CC7", "{- c #385DC8", "]- c #365CC6", "^- c #355BC6", "/- c #355CC6", "(- c #365DC7", "_- c #375EC8", ":- c #375CC6", "<- c #385EC6", "[- c #3A5FC7", "}- c #3C60C8", "|- c #3D61C9", "1- c #3E62CA", "2- c #4063CC", "3- c #4165CE", "4- c #4268D0", "5- c #4269D1", "6- c #436AD2", "7- c #446AD2", "8- c #456BD2", "9- c #496CD1", "0- c #4C6CD0", "a- c #4D6CCF", "b- c #4E6DD0", "c- c #4F6ECF", "d- c #4E6FCF", "e- c #4C70CF", "f- c #4A71D0", "g- c #4F6FCF", "h- c #4B71D0", "i- c #4A72D1", "j- c #4B73D4", "k- c #4F70D0", "l- c #4C73D3", "m- c #4C73D6", "n- c #4B72D2", "o- c #4B71D1", "p- c #4C73D7", "q- c #3354C0", "r- c #3152BE", "s- c #3052BE", "t- c #3051BF", "u- c #2E4FBF", "v- c #2E4FBE", "w- c #2E50BF", "x- c #2F50BF", "y- c #3156C4", "z- c #2F56C5", "A- c #2E57C5", "B- c #2F57C5", "C- c #3057C6", "D- c #3258C6", "E- c #3459C7", "F- c #365AC7", "G- c #385BC8", "H- c #3B5DCA", "I- c #3B5DCB", "J- c #3C5ECC", "K- c #3C60CD", "L- c #3C62CE", "M- c #3D65D0", "N- c #3D66D1", "O- c #4166D2", "P- c #4667D2", "Q- c #4A67D1", "R- c #4C68D0", "S- c #4C69CF", "T- c #4D6BCE", "U- c #4E6DCD", "V- c #4E6ECE", "W- c #4E6DCE", "X- c #4970D0", "Y- c #4770D0", "Z- c #4B6BCE", "`- c #4A6CCE", " ; c #496DCF", ".; c #476FD0", "+; c #4870D0", "@; c #486DCF", "#; c #242F79", "$; c #2F41AC", "%; c #2040B8", "&; c #2041B8", "*; c #2243B3", "=; c #2243B8", "-; c #2343B8", ";; c #2444B8", ">; c #2445B8", ",; c #2445B6", "'; c #2445B7", "); c #2444B9", "!; c #2949BE", "~; c #2649BF", "{; c #234BBF", "]; c #224CBF", "^; c #224AC0", "/; c #244CC0", "(; c #254DC0", "_; c #254DC1", ":; c #264DC2", "<; c #274EC3", "[; c #274CC3", "}; c #274DC4", "|; c #254DC5", "1; c #214EC5", "2; c #204FC6", "3; c #1F50C8", "4; c #2151C9", "5; c #2B53C8", "6; c #3154C7", "7; c #3255C6", "8; c #2F57C7", "9; c #2C58C9", "0; c #2D59CA", "a; c #2D58C9", "b; c #2E5BCC", "c; c #325ECC", "d; c #325ECB", "e; c #1F40B1", "f; c #1F40B2", "g; c #1F40B3", "h; c #2A44BD", "i; c #2845BE", "j; c #2745BE", "k; c #2646BF", "l; c #2546BE", "m; c #2347BF", "n; c #2147BF", "o; c #2048C0", "p; c #1D48C0", "q; c #1C48C0", "r; c #1B47C0", "s; c #1C48BF", "t; c #1E49BE", "u; c #214ABD", "v; c #244CBD", "w; c #264DBE", "x; c #254EC0", "y; c #214FC2", "z; c #1B51C5", "A; c #1C51C7", "B; c #2250C8", "C; c #2A52C8", "D; c #3254C6", "E; c #3355C5", "F; c #3154C8", "G; c #3355C6", "H; c #2F57C8", "I; c #2E58C9", "J; c #2E59C9", "K; c #3059C9", "L; c #2040B6", "M; c #2743BB", "N; c #2844BC", "O; c #2743BD", "P; c #2844BE", "Q; c #2844BD", "R; c #2346BE", "S; c #2047BF", "T; c #1E48C0", "U; c #1D47C0", "V; c #1D49BF", "W; c #1F49BF", "X; c #204ABE", "Y; c #254DBF", "Z; c #234EC0", "`; c #2050C1", " > c #1C51C3", ".> c #1F51C6", "+> c #2651C8", "@> c #2D53C7", "#> c #3155C6", "$> c #3155C7", "%> c #3355C7", "&> c #3254C7", "*> c #1E40B1", "=> c #2141B8", "-> c #2442B9", ";> c #2744BB", ">> c #2945BB", ",> c #2A45BB", "'> c #2944BA", ")> c #2745BB", "!> c #2545BC", "~> c #2246BD", "{> c #2047BE", "]> c #1F47BD", "^> c #1D48BE", "/> c #1E49C0", "(> c #1F4AC0", "_> c #214BBF", ":> c #244CBE", "<> c #254DBE", "[> c #244DBE", "}> c #224FBF", "|> c #2051C1", "1> c #2151C3", "2> c #2252C5", "3> c #2151C1", "4> c #2851C6", "5> c #2A50C6", "6> c #2E54C6", "7> c #1F51C2", "8> c #1D52C5", "9> c #2651C9", "0> c #2950C7", "a> c #2D40A5", "b> c #2040B0", "c> c #1F40B0", "d> c #223CAE", "e> c #233CAE", "f> c #253BAC", "g> c #253BAD", "h> c #233CB0", "i> c #213EB2", "j> c #1F3FB4", "k> c #1E40B6", "l> c #1F3FB7", "m> c #1E3EB8", "n> c #1F3FB8", "o> c #2040B7", "p> c #2141B6", "q> c #2140B7", "r> c #2241B6", "s> c #2342B5", "t> c #2442B6", "u> c #2543B5", "v> c #2643B4", "w> c #2544B6", "x> c #2346B8", "y> c #2247B9", "z> c #2048BC", "A> c #1F48BF", "B> c #2049C0", "C> c #214AC0", "D> c #224BBF", "E> c #234CBE", "F> c #244DBF", "G> c #234CBF", "H> c #264DC0", "I> c #274EBF", "J> c #264DBF", "K> c #254EBF", "L> c #2050C0", "M> c #1F51C1", "N> c #1E42A4", "O> c #263BA6", "P> c #253BA7", "Q> c #253CA7", "R> c #1E41A5", "S> c #1F40AF", "T> c #273AAC", "U> c #1E40B0", "V> c #1F40B5", "W> c #1F40B6", "X> c #1F40B8", "Y> c #1E40B8", "Z> c #1F3EB8", "`> c #203FB7", " , c #2240B6", "., c #2341B7", "+, c #2345B9", "@, c #2147BB", "#, c #2148BA", "$, c #2049BB", "%, c #2049BD", "&, c #2049BF", "*, c #224BBE", "=, c #244DBD", "-, c #244CBF", ";, c #182969", ">, c #273BAD", ",, c #2739AB", "', c #263AAC", "), c #243CAE", "!, c #233DAE", "~, c #213EAF", "{, c #1F3FB0", "], c #2040B4", "^, c #1F3FB6", "/, c #1E3EB7", "(, c #2240B7", "_, c #2341B6", ":, c #2543B4", "<, c #2644B3", "[, c #2544B5", "}, c #2545B5", "|, c #2547B6", "1, c #2548B7", "2, c #2349BA", "3, c #1F49BE", "4, c #2149BD", "5, c #2049BE", "6, c #214BBE", "7, c #2249BE", "8, c #234CBD", "9, c #2149BE", "0, c #1E49BF", "a, c #253BA9", "b, c #253BAB", "c, c #263AAB", "d, c #213DAF", "e, c #203EAF", "f, c #1D40AF", "g, c #1D40B0", "h, c #1E40B4", "i, c #2241B7", "j, c #2643B6", "k, c #2744B5", "l, c #2643B5", "m, c #2346B6", "n, c #2147B7", "o, c #2644B6", "p, c #2247B7", "q, c #2248B8", "r, c #2647B7", "s, c #2549B7", "t, c #2645B7", "u, c #2148B8", "v, c #2847B6", "w, c #2549B6", "x, c #2849B6", "y, c #2049B7", "z, c #2A49B5", "A, c #243BA4", "B, c #253BA5", "C, c #253BA6", "D, c #263AA7", "E, c #263AA8", "F, c #2739AA", "G, c #243CAD", "H, c #223DAE", "I, c #1F3EAF", "J, c #1E3FB0", "K, c #1D40B1", "L, c #1E3FB1", "M, c #1F3FB3", "N, c #1F3FB5", "O, c #2140B6", "P, c #2140B8", "Q, c #2744B4", "R, c #2746B6", "S, c #2947B6", "T, c #2946B5", "U, c #2A48B6", "V, c #3551A8", "W, c #1F399C", "X, c #143D9F", "Y, c #263BA5", "Z, c #273BA8", "`, c #273BAA", " ' c #263AAD", ".' c #233CAD", "+' c #213DAE", "@' c #203FB2", "#' c #2342B6", "$' c #2443B6", "%' c #2543B6", "&' c #2644B5", "*' c #133D9E", "=' c #263BA7", "-' c #263BA9", ";' c #273BA9", ">' c #263AAA", ",' c #2539AB", "'' c #2639AB", ")' c #253AAC", "!' c #243BAD", "~' c #223DAF", "{' c #203FB0", "]' c #2040B1", "^' c #2140B3", "/' c #2543B1", "(' c #2744AF", "_' c #1A3CA0", ":' c #1D3BA2", "<' c #233BA4", "[' c #263AA5", "}' c #253AA5", "|' c #263AA6", "1' c #263BA4", "2' c #243BA5", "3' c #263BA8", "4' c #223EAF", "5' c #3B4CA5", "6' c #1D379A", "7' c #1E389C", "8' c #1E399F", "9' c #1F3BA2", "0' c #1F3BA3", "a' c #213BA4", "b' c #233AA3", "c' c #243AA3", "d' c #2539A4", "e' c #253AA6", "f' c #243BA7", "g' c #253CAA", "h' c #253CAC", "i' c #253CAD", "j' c #253CAE", "k' c #243DAE", "l' c #213FAF", "m' c #223FAF", "n' c #2040AF", "o' c #253D93", "p' c #1D3894", "q' c #1F379A", "r' c #1E389B", "s' c #1D399C", "t' c #1C3A9D", "u' c #1B3A9D", "v' c #183B9E", "w' c #163C9E", "x' c #153C9E", "y' c #163B9D", "z' c #173B9D", "A' c #193A9D", "B' c #1C3A9E", "C' c #1F3AA1", "D' c #223AA4", "E' c #253BA8", "F' c #273BA7", "G' c #263CAB", "H' c #263CAC", "I' c #243EAE", "J' c #273BAC", "K' c #2A3795", "L' c #1F389B", "M' c #1D389B", "N' c #1C399C", "O' c #1B399C", "P' c #1A3A9D", "Q' c #1D399B", "R' c #1B399B", "S' c #1A3A9C", "T' c #1B3A9F", "U' c #1D3AA0", "V' c #203BA2", "W' c #203BA3", "X' c #2639A6", "Y' c #1B3692", "Z' c #1C3794", "`' c #1D3796", " ) c #1E3898", ".) c #1E389A", "+) c #1F399B", "@) c #1A399C", "#) c #193A9E", "$) c #1A3BA0", "%) c #1C3BA2", "&) c #1D3CA3", "*) c #203CA4", "=) c #223BA5", "-) c #3C4699", ";) c #2B4595", ">) c #1C3793", ",) c #1D3895", "') c #1E3897", ")) c #1F3998", "!) c #1F3999", "~) c #1F399A", "{) c #1E399C", "]) c #1C3B9E", "^) c #1D3BA0", "/) c #1E3CA2", "() c #223CA5", "_) c #243CA6", ":) c #596FA9", "<) c #3B4894", "[) c #314993", "}) c #29499F", "|) c #28489E", "1) c #2B4BA1", "2) c #2C4BA1", "3) c #2D4CA2", "4) c #2E4CA3", "5) c #2F4CA4", "6) c #2E4CA4", "7) c #2F4DA3", "8) c #2F4DA4", "9) c #D3D5D2", "0) c #3B4794", "a) c #314791", "b) c #304892", "c) c #304893", "d) c #2F4995", "e) c #2F4997", "f) c #2D4A9A", "g) c #2A4A9D", "h) c #294A9F", "i) c #284AA0", "j) c #294AA0", "k) c #2B4AA1", "l) c #2D4CA3", "m) c #C9CAC9", "n) c #455D9B", "o) c #242F78", "p) c #1B2F85", "q) c #C6C3C8", "r) c #B5B2B6", "s) c #B5B7B4", "t) c #B5B7B3", "u) c #B5B2B5", "v) c #B5B3B4", "w) c #B5B5B4", "x) c #B5B6B3", "y) c #B5B4B4", "z) c #B5B3B5", "A) c #B5B4B5", "B) c #B5B5B5", "C) c #B5B5B3", "D) c #B5B5B6", "E) c #BAC3BE", "F) c #B9C3BD", "G) c #C1C3C4", "H) c #BFC3C2", "I) c #B9C3BE", "J) c #BBC3BF", "K) c #BDC3C1", "L) c #C0C3C3", "M) c #BEC3C1", "N) c #C2C3C5", "O) c #E6E3E8", "P) c #E0E2DF", "Q) c #E1E1E1", "R) c #E2E1E3", "S) c #E4E1E6", "T) c #E4E2E7", "U) c #E4E2E6", "V) c #E3E3E4", "W) c #E2E3E3", "X) c #E1E3E2", "Y) c #E3E3E3", "Z) c #E3E3E2", "`) c #EBEDEA", " ! c #EAECE9", ".! c #E9EBE8", "+! c #ECEEEB", ". . + @ # $ $ $ $ $ $ $ % $ $ $ $ $ % $ $ $ $ $ $ % $ $ $ $ $ % $ $ $ $ $ $ $ $ $ % $ $ & * = - ; > , , ' ) ! ! ~ { ] ^ / ( _ : < [ } | | 1 2 3 3 4 4 4 4 4 4 4 5 6 4 4 4 5 6 7 8 9 4 5 6 7 8 9 6 7 8 9 ", "0 a b % $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ c d d d d $ $ $ $ $ c d e f g h i i i i j k l m n o p q r s t u v w x y z 4 A B C D 9 9 E 9 E F G H I F J K L L L L J K L L L L L L L L ", "@ % M N O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O P Q R S T U V W X Y Z ` ...+.@.#.$.%.&.*.=.-.;.>.,.'.).!.~.{.].^./.(._.:.<.[.}.|.1.2.3.4.5.6.7.8.9.0.a.b.b.b.b.b.b.", "c.$ d.O e.f.g.g.g.h.g.g.g.g.g.h.h.g.g.g.g.g.h.h.g.g.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.A.B.C.D.E.F.G.H.I.J.K.L.M.N.O.P.Q.R.S.T.U.V.W.X.Y.Z.`. +.+++@+#+$+@+$+%+&+*+=+$+-+;+>+,+'+)+!+;+>+,+~+,+>+,+~+,+", "$ {+N N f.f.f.f.h.h.h.g.f.f.h.h.h.h.g.f.f.h.h.h.h.]+^+/+(+h._+:+<+[+}+|+1+2+3+4+5+6+7+8+9+0+a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+r+s+t+u+v+w+x+y+z+A+B+.+C+D+E+D+F+G+H+C+I+F+G+J+K+L+H+F+G+J+K+L+H+J+H+J+H+", "{+{+N N M+M+h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.N+N+h.h.(+O+P+P+Q+R+S+T+U+V+W+X+Y+Z+`+ @.@+@@@#@$@%@&@*@=@-@;@>@,@'@)@!@~@{@]@^@/@(@_@:@<@[@[@y+}@|@1@A+1@2@3@ +2@4@2@5@C+D+6@D+7@5@C+D+6@I+C+D+6@I+", "{+{+8@N M+M+h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.9@9@0@N+a@b@c@d@e@f@g@h@i@j@k@l@m@n@o@p@q@r@s@t@u@v@w@x@y@z@A@B@q+r+C@D@E@F@G@H@_@I@J@K@<@L@M@N@O@P@Q@R@S@T@A+A+U@V@W@W@A+2@U@V@W@W@U@V@W@W@", "{+{+8@N f.M+h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.(+(+(+9@9@X@Y@Z@e@`@ #.#+#@###$#%#&#*#=#-#;#>#,#'#)#!#~#{#]#z@^#/#(#p+_#r+:#s+t+<#[#}#|#|#1#_@|#_@_@2#L@3#4#y+y+5#z+z+z+5#z+z+z+z+A+A+A+A+A+", "{+{+8@8@f.f.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.(+6#7#8#9#0#a#b#c#d#e#f#g#h#i#j#k#l#m#n#o#&@p#q#r#s#t#u#v#w#x#x#y#y#z#A#B#C#D#E#E#F#G#H#F#H#H#u+v+I#J#K#L#J@J@M#N#O#P#M#M#M#N#M#Q#Q#R#", "$ {+8@e.f.f.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.S#l.7#T#U#V#W#X#Y#Z#`# $f#g###.$+$@$#$$$$@%$&$*$=$-$;$>$,$'$)$!$~$~${$]$^$/$($($_$_$:$<$_$<$[$}$|$|$1$2$2$3$}#4$5$6$7$8$8$9$8$8$8$0$8$", "$ {+a$e.f.f.h.h.h.h.h.h.h.h.h.b$h.c$c$c$c$c$d$c$c$c$c$c$c$c$c$c$c$e$e$7#f$g$h$i$X#j$k$l$m$n$o$p$q$r$l@s$t$u$v$w$x$y$z$A$B$C$D$E$F$G$G$H$I$J$J$K$K$J$L$L$L$L$L$M$N$O$P$Q$R$S$T$U$1$V$T$W$X$Y$1$V$Y$Z$`$ %", "$ $ a$a$f.f.b$b$b$b$b$b$b$b$b$b$b$b$b$b$b$b$b$b$.%b$b$b$.%d$+%+%@%h.e$l.#%$%h$%%&%*%=%-%;%>%,%'%)%!% @ @~%{%]%^%/%(%w$_%:%<%[%}%|%D$1%2%3%4%5%4%4%6%5%5%4%4%4%5%7%5%8%9%L$0%a%a%a%P$b%P$P$z#z#z#P$c%c%c%", "$ $ 8@e.f.f.d%b$b$b$b$b$d%b$b$b$b$b$b$e%f%b$b$b$b$b$g%h%b$.%i%i%j%k%l%m%X@n%h$o%&%p%q%`#r%s%t%u%v%w%x%y% @z%A%B%C%D%E%F%G%:%H%I%[%J%}%K%|%D$K%D$D$L%M%M%M%M%M%D$N%O%i+P%j+Q%R%S%T%0%U%V%W%W%W%W%X%X%X%X%", "$ $ 8@8@f.f.d%d%b$b$b$b$d%d%b$b$b$h%Y%Z%Z%h%f%f%h%Y%`%`% &h%h%.&+&@&#&$&X@%&&&*&=&-&j$Z#+#;&>&,&'&)&)&!&~&{&]&^&/&(&^%_&(%:&<&[&}&|&1&A$A$2&3&4&4&5&B$6&7&B$7&8&9&6&7&0&a&a&i+i+i+b&a&a&j+U%c&U%j+U%c&U%", "$ $ 8@8@d&e&d%d%d%d%d%d%d%d%d%d%d%`%d%d%d%d%`%`%`%d%d%d%d%`%`%f&g&h&j%i&j&k&l&m&=&X#Y#n&o&p&q&r&>&s&t&t&u&v&w&x&y&{&z&A&B&C&D&(%(%F%F%E&F&}&}&|&G&|&H&1&I%I&A$1&}&z$z$J&K&L&M&N&O&0&P&Q&0&a&R&a&a&a&R&a&", "{+$ 8@8@e&e&d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%`%f&S&T&U&V&W&Y@X&Y&Z&`& *.*+*@*#*@*r&$*#*r&%*&***=*-*;*y&z%A%z&A&A&>*B&,*,*'*)*!*!*~*{*F&}&{*}&{*]*G%G%y$^*/*J&(*2&_*:*<*=$[*}*<*=$<*|*1*", "{+{+8@2*e&e&d%d%d%d%d%d%d%d%d%e&3*4*4*4*4*4*5*4*4*4*4*4*4*4*4*4*`%f&6*6*7*8*9*0*a*b*c*d*e*f*g*h*i*j*+*k*h*l*m*n*m*o*p*q*r*s*t*u*v*w*x*y*y*z*A*B*C*D*E*F*G*E*G*F*H*G*F*~*]*{*I*x$J*K*L*G%K*M*o#o#I&N*O*O*", "{+{+8@2*e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&P*e&e&e&e&e&e&P*P*e&e&e&P*P*5*Q*R*S*T*U*V*W*X*Y*Z*`*d* =.=+=@=#=$=%=g@&=*===-=i*;=l*>=,=q*'=s*)=k@!=x*~={=]=^=/=(=_=:=(=<=<=]=[=}=|=]=]=1=2=3=|=4=5=2=2=2=3=6=6=6=", "{+{+7=e.e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&P*P*8=9=0=a=b=U*c=d=e=f=e@#=g=h=i=i=j=k=k=l=%===m=n=o=p=q=,=r=s=t=u=v=v*w=x=x=y=z=z=A=z=A=B=C=B=D=C=B=x=B=B=B=B=B=B=B=B=B=B=B=B=B=B=", "{+{+7=7=e&e&e&e&E=E=e&e&e&e&E=E=E=e&e&e&e&E=E=E=e&e&e&e&E=E=e&e&e&e&E=E=E=F=d%G=G=H=I=J=K=L=M=R+}+N=O=P=Q=j=i=h=R=e@@=S=-=T=h@l*U=V=W=X=Y=Z=`= - - -.-+-@- -#-$-%-$-&-*-$-=-%-----C=$-%---------B=B=B=B=", "{+{+7=7=;-;-E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=>-,-'-)-!-6*~-{-{-]-^-/-/-(-_-:-N=<-[-}-|-1-2-3- =4-5-6-7-8-9-0-0-a-b-c-d-e-f-g-h-h-i-j-k-h-h-i-j-l-m-n-o-i-j-l-m-n-j-l-p-n-", "{+{+7=7=;-;-E=E=E=E=E=E=E=E=q-r-s-t-t-u-u-v-v-v-u-w-x-u-u-u-u-u-u-u-u-v-v-u-u-u-u-u-v-v-u-u-u-u-v-v-u-y-z-A-B-C-D-E-E-F-G-H-I-J-K-L-M-N-O-P-Q-R-S-T-U-U-V-W-V-e-X-Y-Z-`- ;.;Y-N N +;@;.;Y-N N N N N N N ", "#;#;d&d&$;$;%;%;%;%;%;%;%;%;&;*;=;-;-;-;;;>;,;>;>;>;;;>;>;>;>;>;>;>;>;>;';);>;>;>;>;>;';>;>;>;>;>;';);!;~;{;];^;/;(;_;_;:;<;[;};};|;1;2;3;4;5;6;7;8;9;9;0;a;0;0;b;h.a;0;0;b;h.c;h.d;0;b;h.c;h.d;h.c;h.d;", "#;#;;-;-$;$;e;e;e;e;e;e;e;e;e;e;e;f;f;f;f;e;e;e;f;f;f;f;f;f;f;f;f;f;f;f;g;%;f;f;f;f;f;g;f;f;f;f;f;g;%;h;i;j;k;l;m;n;o;p;q;r;r;s;t;u;v;w;x;y;z;A;B;C;6;D;E;F;G;G;H;I;F;G;G;H;I;J;J;K;G;H;I;J;J;K;I;J;J;K;", "#;#;;-;-$;$;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;L;e;e;e;e;e;e;e;e;e;e;e;e;L;M;N;O;P;Q;i;i;k;R;S;T;U;q;q;V;W;X;{;Y;Z;`; >.>+>@>#>+>$>6;#>#>+>%>&>G;G;G;G;G;&>G;G;G;G;G;G;G;G;G;", "#;#;d.;-$;$;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;*>e;e;e;e;e;e;e;e;e;e;e;e;*>=>->;>>>,>'>'>)>!>~>{>]>^>^>V;V;/>(>_>:><>[>}>|>1>2>3>2>4>5>6>7>8>9>0>G;G;G;G;9>0>G;G;G;G;G;G;G;G;", "#;#;d.d.a>a>e;e;e;e;e;e;e;e;e;e;b>b>c>c>c>c>c>b>e;e;e;e;e;e;e;e;e;e;e;e;e;e;d>e>f>g>h>i>j>k>l>l>m>m>n>n>o>o>p>q>r>r>s>t>u>v>v>u>w>';x>y>z>t;A>B>C>D>E>E>F>G>F>H>H>I>F>Y;J>w;K>L>K>M>J>w;K>L>K>M>K>L>K>M>", "#;#;d.d.a>a>N>e;N>O>O>O>N>e;N>O>O>P>Q>R>S>R>Q>O>O>O>N>e;N>O>O>O>N>e;N>N>O>T>e;e;e;U>U>U>U>f;V>W>o>o>o>o>X>X>Y>Y>n>n>Z>Z>`> ,.,t>t>u>u>w>+,@,#,$,%,A>&,*,=,B>[>-,w;<>C>[>-,w;w;w;w;w;-,w;w;w;w;w;w;w;w;w;", "#;;,;-;-a>a>N>N>N>O>O>O>N>N>N>O>O>O>O>N>N>N>O>O>O>O>N>N>N>O>O>O>N>N>N>N>O>>,,,,,,,',g>),!,~,{,{,*>U>e;f;],o>%;o>^,^,/,/,l>q>(,_,t>u>:,<,v>[,},|,1,2,%,%,3,4,5,6,7,8,9,5,6,0,G>G>Y;G>6,0,G>G>Y;G>G>G>Y;G>", ";,;,;-;-O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>P>a,b,',',c,c,f>),e>d,e,{,{,U>U>f,f,U>U>g,g,*>g;h,^,^,`>`>q>i,t>j,k,k,l,w>m,n,o,p,q,r,s,t,p,u,v,w,x,y,z,u,v,w,x,y,z,w,x,y,z,", ";,;,b b O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>A,A,A,B,C,D,E,F,c,',g>G,!,H,~,e,{,I,J,J,K,K,U>f,f,J,L,M,N,L;O,i,P,.,l,Q,k,k,k,k,k,k,R,v,k,k,k,R,v,S,T,U,k,R,v,S,T,U,v,S,T,U,", ";,;,b V,W,W,X,X,O>X,X,X,X,X,O>X,X,X,X,X,X,O>X,X,X,X,X,X,O>X,X,X,X,X,O>X,X,O>O>O>O>B,B,B,B,Y,O>O>Z,`,T>T> '',g>.'+'e,{,{,e,+'+'e,e,{,J,K,e;@'N,O,#'$'%'%'j,%'j,&'k,k,%'j,&'k,k,k,k,k,&'k,k,k,k,k,k,k,k,k,", ";,;,b V,W,W,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,*'O>O>O>O>O>O>O>O>B,B,A,A,B,C,='-'`,;'>'>',''')'!'!'e>e>~'~'~,~,{'{,*>*>e;]']']']']']'^'/']']']'^'/':,(':,]'^'/':,(':,/':,(':,", ";,;,V,V,W,W,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,_':'<'['}'|'|'O>O>O>O>O>O>O>Y,Y,1'1'B,B,2'2'C,3'-'>'c,)')'!'),4'{'e;]'e;*>*>e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;", ";,;,5'5'W,W,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,W,6'6'6'7'8'9'0'a'b'c'd'd'}'}'O>O>O>O>O>O>O>O>Y,1'1'['['e'e'f'g'h'i'j'k'G,),!,l'j'm'n'b>b>),m'b>e;e;e;e;e;b>e;e;e;e;e;e;e;e;e;", ";,;,b b o'o'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'W,q'q'q'r's't'u'v'w'x'y'z'A'B'C'D'2'2'B,B,O>O>O>O>O>O>O>O>O>O>O>Y,Y,C,C,='='='E'F'3'3'3'G'Z,='F'F'G'H'I'J'F'F'G'H'I'J'G'H'I'J'", ";,;,b b K'K'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'W,W,W,W,W,L'L'q'r'M'N'O'P'u'N's'Q'R'S'A'T'U'C'V'9'0'W'D'}'X'|'O>O>B,B,O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>", ";,;,b b K'K'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'Y'Y'Y'Z'`' ).)+)+)+)W,W,W,W,L'L'q'q'r'r's'M'N'P'@)A'#)$)%)&)*)=)B,|'|'O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>", "{+;,$ -);)K'p'p'o'p'p'p'p'p'o'p'p'p'p'p'p'o'p'p'p'p'p'p'o'p'p'p'p'p'o'o'p'p'p'p'p'p'p'p'p'p'>)>)Y'Y'>)Z',)')))!)~)+)W,W,W,W,W,W,W,W,W,W,W,L'L'{)s't'])^)/)])/)/)O>()])/)/)O>()O>_)O>/)O>()O>_)O>()O>_)O>", ":);,;,;)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)[)M M M M M M M M M M M M M M M M M M })})|)|)})M M 1)2)3)4)5)6)6)6)7)7)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)", "9)#;;,;,$ -)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)0)a)a)a)b)c)d)e)f)g)h)i)i)j)j)M M M M M M M M M M M })})})})M k)k)M M k)l)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)", "+ 9)m)n)$ #;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;o)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)", "+ + 9)a m)q)r)s)r)s)r)s)r)s)r)r)s)r)s)r)s)r)r)s)r)s)r)s)r)s)r)s)r)s)r)s)r)t)u)v)w)x)x)w)y)z)A)A)B)B)B)B)w)w)C)C)w)w)B)B)B)B)B)w)w)w)w)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)D)B)B)B)B)B)D)B)B)B)D)B)", ". + + 9)9)9)q)E)q)E)q)E)q)E)q)q)E)q)E)q)E)q)q)E)q)E)q)E)q)E)q)E)q)E)q)E)q)F)G)H)E)I)J)K)H)L)L)L)L)L)L)L)H)H)M)M)H)H)L)L)G)L)L)H)H)H)H)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)N)L)L)L)L)L)N)L)L)L)N)L)", ". . 0 . + O)P)O)P)O)P)O)P)O)P)P)O)P)O)P)O)P)P)O)P)O)P)O)P)O)P)O)P)O)P)O)P)O)Q)R)S)T)U)V)W)X)W)W)V)V)V)V)V)V)V)V)Y)Y)Z)Z)Y)Z)Z)Y)Y)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)Y)V)V)V)V)V)Y)V)V)V)Y)V)", ". . . 0 0 0 . 0 0 0 + 0 + 0 + 0 + 0 + 0 + 0 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 0 `) !+ + + .! !`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)+!`)`)`)`)`)+!`)`)`)+!`)"}; static char * listviewhighcornerright_xpm[] = { "100 46 780 2", " c None", ". c #6A779D", "+ c #6C789C", "@ c #6C789D", "# c #6B789D", "$ c #6A779E", "% c #66759E", "& c #64749E", "* c #63749E", "= c #61739D", "- c #576D9B", "; c #556C9C", "> c #4D679D", ", c #4A649D", "' c #49629D", ") c #465E9C", "! c #40579C", "~ c #3B5394", "{ c #2C4E97", "] c #314993", "^ c #2B4595", "/ c #1B4296", "( c #253D93", "_ c #19418F", ": c #0F3C96", "< c #42599E", "[ c #758DC3", "} c #E8EAE7", "| c #EEF0ED", "1 c #FBFBFC", "2 c #6F7D9B", "3 c #6F7D9A", "4 c #6E7B9C", "5 c #67759E", "6 c #63739E", "7 c #62739D", "8 c #596F9C", "9 c #4A639D", "0 c #47609C", "a c #445B9F", "b c #3E5697", "c c #2E509A", "d c #2D509A", "e c #2D4F99", "f c #2D4F98", "g c #28418A", "h c #3E51A3", "i c #D0D3DC", "j c #A1B6EF", "k c #A2B6F0", "l c #A1B6F0", "m c #A3B6F0", "n c #A0B6EF", "o c #9DB6EE", "p c #9CB5EF", "q c #9CB2F0", "r c #9FB5EE", "s c #9CB4EB", "t c #9AB3EC", "u c #9AB0EC", "v c #9DB3EB", "w c #9BB4EC", "x c #9BB4EE", "y c #9BB1EF", "z c #9BB0F0", "A c #90ACF0", "B c #93ABEE", "C c #91A8EB", "D c #8BA3E8", "E c #88A1E7", "F c #809DE9", "G c #7A99E8", "H c #7491E5", "I c #698AE4", "J c #6184E3", "K c #507EDC", "L c #4E7CDB", "M c #4F7DDC", "N c #5479DA", "O c #567BDC", "P c #577CDD", "Q c #5074DA", "R c #5174DB", "S c #5175DC", "T c #5276DD", "U c #4D71DE", "V c #4C72D8", "W c #3A6CE0", "X c #2B49A6", "Y c #E0E2DF", "Z c #93AAE9", "` c #94A9E8", " . c #94AAE9", ".. c #93A9E9", "+. c #92AAE9", "@. c #8DA9E8", "#. c #8CA7E9", "$. c #92ABE9", "%. c #8EAAE9", "&. c #8EA9E9", "*. c #8FAAE9", "=. c #8CA8E9", "-. c #8CA2E7", ";. c #86A1E6", ">. c #839EE9", ",. c #7F9CE9", "'. c #7A97E8", "). c #7693E7", "!. c #6E8EE8", "~. c #678AE9", "{. c #5D84E3", "]. c #577CDF", "^. c #4E77DF", "/. c #4A70DB", "(. c #4870DB", "_. c #4870DC", ":. c #4770E3", "<. c #496FDC", "[. c #486EDB", "}. c #466FE4", "|. c #466EE3", "1. c #4167D9", "2. c #4066D8", "3. c #3F66D8", "4. c #3D64D7", "5. c #3960DA", "6. c #476DD9", "7. c #446EE5", "8. c #305EC8", "9. c #8EAAE8", "0. c #8FAAE8", "a. c #91AAE9", "b. c #8FA9E8", "c. c #8BA8E8", "d. c #8AA7E9", "e. c #8BA5EA", "f. c #8AA7E8", "g. c #87A2E6", "h. c #859FE8", "i. c #7F9DE8", "j. c #7C9AE8", "k. c #7B95E7", "l. c #7090E8", "m. c #6B8BE9", "n. c #6386E6", "o. c #5881E1", "p. c #5479DE", "q. c #4D74DE", "r. c #476EDB", "s. c #446EE1", "t. c #446EE0", "u. c #446EDF", "v. c #446DE0", "w. c #426ADF", "x. c #3C64DA", "y. c #4360CC", "z. c #D3D5D2", "A. c #E6E3E8", "B. c #8DA2E7", "C. c #8CA6EA", "D. c #8DA3E9", "E. c #88A2E7", "F. c #87A1E7", "G. c #8AA1E7", "H. c #849EE9", "I. c #7D9AE9", "J. c #7B98E8", "K. c #7796E5", "L. c #7191E7", "M. c #688CE9", "N. c #6687E5", "O. c #5C83E1", "P. c #557BDE", "Q. c #4F76DE", "R. c #4C72DE", "S. c #456EDF", "T. c #426AD9", "U. c #4269D9", "V. c #4269D8", "W. c #3D64D9", "X. c #3A61DA", "Y. c #345ED6", "Z. c #335ECF", "`. c #C6C3C8", " + c #86A1E7", ".+ c #87A2E7", "++ c #87A0E7", "@+ c #859EE8", "#+ c #849DE9", "$+ c #7E9BE9", "%+ c #7A99E9", "&+ c #7A95E5", "*+ c #7593E7", "=+ c #6F8EE9", "-+ c #668AE5", ";+ c #6386E0", ">+ c #5B82DF", ",+ c #5379DE", "'+ c #5075DE", ")+ c #4B6FDC", "!+ c #446AD7", "~+ c #4269D6", "{+ c #4269D5", "]+ c #3E65D7", "^+ c #C9CAC9", "/+ c #869EE9", "(+ c #859FE9", "_+ c #849FE9", ":+ c #829DE8", "<+ c #819DE8", "[+ c #7B9AE9", "}+ c #7A96E6", "|+ c #7290E8", "1+ c #698CE6", "2+ c #6689E0", "3+ c #5D84E0", "4+ c #587FDF", "5+ c #5377DD", "6+ c #4B74DE", "7+ c #496BD8", "8+ c #7C9BE9", "9+ c #7E9CE9", "0+ c #7D9AEA", "a+ c #7D9BEA", "b+ c #7D98E8", "c+ c #7C98E8", "d+ c #7796E4", "e+ c #7592E6", "f+ c #7390E1", "g+ c #698DE0", "h+ c #6588DE", "i+ c #5E84E0", "j+ c #5880DF", "k+ c #5479DC", "l+ c #4F75DE", "m+ c #4A6FDB", "n+ c #436AD7", "o+ c #3F65D7", "p+ c #BAC3BE", "q+ c #7B9AE8", "r+ c #7B9AEA", "s+ c #7A9AEA", "t+ c #7B99E9", "u+ c #7D97E7", "v+ c #7D95E6", "w+ c #7D95E5", "x+ c #7C95E6", "y+ c #7493E3", "z+ c #7290DF", "A+ c #6C8DDE", "B+ c #6B89E1", "C+ c #6486DF", "D+ c #5D81DF", "E+ c #567DDE", "F+ c #4F73DE", "G+ c #496EDA", "H+ c #355ED6", "I+ c #345ED5", "J+ c #7E95E5", "K+ c #7C97E8", "L+ c #7C97E7", "M+ c #7B94E6", "N+ c #7A95E4", "O+ c #7695E5", "P+ c #7694E4", "Q+ c #7994E6", "R+ c #7995E4", "S+ c #7594E4", "T+ c #7391E2", "U+ c #6E8EDE", "V+ c #6B8ADE", "W+ c #6688DF", "X+ c #5F84E0", "Y+ c #5980E0", "Z+ c #4D72DD", "`+ c #456BD7", " @ c #4168D6", ".@ c #3C64D7", "+@ c #335ED0", "@@ c #4659C7", "#@ c #7292E1", "$@ c #7392E1", "%@ c #7492E1", "&@ c #718FDF", "*@ c #6F8EDE", "=@ c #6D8BDE", "-@ c #6B88DF", ";@ c #597FDF", ">@ c #557ADD", ",@ c #5176DC", "'@ c #4D74DD", ")@ c #496DDA", "!@ c #3860D8", "~@ c #7391E0", "{@ c #7290DE", "]@ c #6D8EDD", "^@ c #6D8DDD", "/@ c #7190E0", "(@ c #6C8DDD", "_@ c #6B89DF", ":@ c #6487E0", "<@ c #6085DF", "[@ c #5F81DE", "}@ c #567EDE", "|@ c #4F74D9", "1@ c #466BD7", "2@ c #4067D5", "3@ c #3C63D7", "4@ c #335ED3", "5@ c #335ED1", "6@ c #718EDD", "7@ c #728EDD", "8@ c #748EDD", "9@ c #708EDD", "0@ c #6F8DDD", "a@ c #6E8DDD", "b@ c #6C8ADE", "c@ c #6C89DF", "d@ c #6988DF", "e@ c #6387DF", "f@ c #6282DE", "g@ c #5681E0", "h@ c #577BDD", "i@ c #5277DB", "j@ c #4D73D8", "k@ c #4A70D8", "l@ c #436AD5", "m@ c #3F66D6", "n@ c #3C63D8", "o@ c #3960D8", "p@ c #3860D7", "q@ c #335ED2", "r@ c #345ED4", "s@ c #6C88DF", "t@ c #6D88DF", "u@ c #6B89DE", "v@ c #6888DF", "w@ c #6587E0", "x@ c #6989DF", "y@ c #6687E0", "z@ c #6287E0", "A@ c #6281DD", "B@ c #5881E0", "C@ c #557ADB", "D@ c #5176D9", "E@ c #4E75D7", "F@ c #4A6FD8", "G@ c #476BD6", "H@ c #4067D6", "I@ c #3C62D7", "J@ c #3C60D4", "K@ c #365ED1", "L@ c #345ED3", "M@ c #6786DF", "N@ c #5F85E0", "O@ c #5F86E0", "P@ c #6186DF", "Q@ c #6286E0", "R@ c #6284DF", "S@ c #6384DF", "T@ c #5B7FDE", "U@ c #577DDC", "V@ c #557BDA", "W@ c #5278D8", "X@ c #4E76D6", "Y@ c #4C72D7", "Z@ c #486DD8", "`@ c #4469D6", " # c #3F62D2", ".# c #3C60CF", "+# c #345ECF", "@# c #6086DF", "## c #6085E0", "$# c #6285DF", "%# c #6383DD", "&# c #6481DC", "*# c #6380DD", "=# c #6183DE", "-# c #6083DD", ";# c #6081DC", "># c #6080DD", ",# c #6083DE", "'# c #6181DC", ")# c #6280DD", "!# c #577EDB", "~# c #557CD7", "{# c #4F76D6", "]# c #4E74D7", "^# c #466CD7", "/# c #3B64D6", "(# c #4261CD", "_# c #375FCE", ":# c #5A7FD8", "<# c #6281DA", "[# c #5F81D8", "}# c #5C80D8", "|# c #557DD7", "1# c #577ED8", "2# c #567ED7", "3# c #587DD8", "4# c #577DD8", "5# c #587ED8", "6# c #567DD8", "7# c #5379D9", "8# c #5177D7", "9# c #4D74D5", "0# c #486ED9", "a# c #4068D4", "b# c #3D65D2", "c# c #4361CC", "d# c #345ECE", "e# c #325DCF", "f# c #2C5AD1", "g# c #3959C5", "h# c #547BD8", "i# c #567DD7", "j# c #557BD8", "k# c #5279D9", "l# c #5278D9", "m# c #4D74D6", "n# c #4B71D8", "o# c #496CD8", "p# c #4669D7", "q# c #3D66D3", "r# c #3F62CF", "s# c #4260CC", "t# c #5379D8", "u# c #4E75D4", "v# c #4C73D7", "w# c #476CD7", "x# c #4869D0", "y# c #4067D2", "z# c #3D64D1", "A# c #4261CC", "B# c #395FCE", "C# c #4F75D3", "D# c #5074D2", "E# c #5174D1", "F# c #5175D1", "G# c #4F74D3", "H# c #4C73D5", "I# c #4C73D4", "J# c #4A72D1", "K# c #4B70CF", "L# c #506CCC", "M# c #4D6BCE", "N# c #4167D0", "O# c #3D65D1", "P# c #3F63CF", "Q# c #3B5FCD", "R# c #3159CD", "S# c #4971D0", "T# c #4870CF", "U# c #4C6FCF", "V# c #4E6CCE", "W# c #4E6BCE", "X# c #4769CF", "Y# c #3D66D0", "Z# c #3C65D1", "`# c #4062CE", " $ c #3D5FCD", ".$ c #365FCF", "+$ c #325DCD", "@$ c #2D5AD0", "#$ c #3859C5", "$$ c #355FCF", "%$ c #355ECF", "&$ c #335ECE", "*$ c #305CCD", "=$ c #2B5ACE", "-$ c #3056C9", ";$ c #2553C6", ">$ c #2153C8", ",$ c #1F4FC7", "'$ c #274CC5", ")$ c #214AC7", "!$ c #1C48C8", "~$ c #1244C9", "{$ c #1043C9", "]$ c #1144C9", "^$ c #2A45BE", "/$ c #2744B5", "($ c #1D49C0", "_$ c #2B58DE", ":$ c #002D94", "<$ c #2B59CA", "[$ c #2A59CA", "}$ c #2E57C8", "|$ c #3255C6", "1$ c #3355C5", "2$ c #1C52C8", "3$ c #1D50C7", "4$ c #234FC6", "5$ c #264CC5", "6$ c #1D48C7", "7$ c #1245C8", "8$ c #1F44C2", "9$ c #2945BE", "0$ c #2A45BD", "a$ c #2040BF", "b$ c #3156C7", "c$ c #3056C7", "d$ c #3354C5", "e$ c #3355C6", "f$ c #3255C5", "g$ c #3254C5", "h$ c #1952C7", "i$ c #1951C8", "j$ c #2050C7", "k$ c #274CC4", "l$ c #244CC6", "m$ c #1F49C7", "n$ c #1E47C5", "o$ c #2045C3", "p$ c #1C44BF", "q$ c #2045BE", "r$ c #2040B8", "s$ c #3254C6", "t$ c #3055C6", "u$ c #2A54C6", "v$ c #2353C7", "w$ c #3054C5", "x$ c #2F55C5", "y$ c #2A54C5", "z$ c #2553C5", "A$ c #2F54C5", "B$ c #3155C6", "C$ c #2A54C7", "D$ c #1A52C8", "E$ c #204FC2", "F$ c #264DC6", "G$ c #234BC5", "H$ c #1D48C1", "I$ c #1E48BF", "J$ c #2646BE", "K$ c #2B45BD", "L$ c #1E43BE", "M$ c #2643BF", "N$ c #2243BF", "O$ c #3049BC", "P$ c #1E50BE", "Q$ c #1D50C0", "R$ c #1D50BF", "S$ c #1852C1", "T$ c #1E51C0", "U$ c #214FBF", "V$ c #2050C0", "W$ c #244EBF", "X$ c #2151C0", "Y$ c #234FBF", "Z$ c #2350C0", "`$ c #2351C0", " % c #244FBF", ".% c #2250C0", "+% c #2051C0", "@% c #1E50C0", "#% c #244DBE", "$% c #274DBF", "%% c #244CBF", "&% c #1C48C0", "*% c #2247BF", "=% c #2C44BD", "-% c #1C44BE", ";% c #1444BF", ">% c #1841BF", ",% c #1F40BF", "'% c #254DBE", ")% c #224FBE", "!% c #224FBF", "~% c #234EBF", "{% c #254CBD", "]% c #244DBD", "^% c #244CBD", "/% c #264DBE", "(% c #264DBD", "_% c #214BC0", ":% c #1D48C0", "<% c #2347BF", "[% c #2B44BD", "}% c #2444BE", "|% c #0F42BF", "1% c #0641BF", "2% c #0F41BF", "3% c #1741BE", "4% c #1F40BD", "5% c #234BBF", "6% c #234CBE", "7% c #214BBE", "8% c #244CBE", "9% c #214ABE", "0% c #214ABF", "a% c #1F48C0", "b% c #2746BE", "c% c #1F43BE", "d% c #0941BE", "e% c #0342BA", "f% c #0242BC", "g% c #1241B8", "h% c #1F40B7", "i% c #2F41AC", "j% c #2644AE", "k% c #2D49B4", "l% c #2649B6", "m% c #2949B7", "n% c #2849B5", "o% c #2149B8", "p% c #1E49B9", "q% c #1F48B8", "r% c #1F49B9", "s% c #2545B6", "t% c #2744B7", "u% c #2844B7", "v% c #2043B8", "w% c #1241B7", "x% c #1340B8", "y% c #0D41B8", "z% c #1941B8", "A% c #1F40B8", "B% c #203FB8", "C% c #2549B5", "D% c #2648B6", "E% c #2547B7", "F% c #2248B7", "G% c #2048B7", "H% c #2346B6", "I% c #2146B6", "J% c #2247B7", "K% c #2148B7", "L% c #2743B4", "M% c #2643B5", "N% c #2542B6", "O% c #1D42B7", "P% c #0E42B8", "Q% c #0C41B8", "R% c #1341B8", "S% c #1740B8", "T% c #1C41B8", "U% c #1F40B1", "V% c #2644B5", "W% c #2544B5", "X% c #2544B4", "Y% c #2444B5", "Z% c #2444B4", "`% c #2744B4", " & c #2241B7", ".& c #1D41B8", "+& c #0B42B8", "@& c #0942B8", "#& c #0C42B8", "$& c #0F41B8", "%& c #1641B8", "&& c #2442B5", "*& c #2543B3", "=& c #2342B2", "-& c #2341B4", ";& c #2141B3", ">& c #2141B5", ",& c #2140B5", "'& c #2040B5", ")& c #1C40B7", "!& c #1B41B3", "~& c #0142B6", "{& c #0E41B7", "]& c #1141B7", "^& c #1440B2", "/& c #113FB0", "(& c #1440B0", "_& c #213EAF", ":& c #233DAE", "<& c #223EAF", "[& c #1E40B1", "}& c #173EAD", "|& c #1440AF", "1& c #0D40AF", "2& c #0941B0", "3& c #0D3FAE", "4& c #1B3CAC", "5& c #233CAD", "6& c #203FB0", "7& c #273BAD", "8& c #1D40B0", "9& c #2040B1", "0& c #1E40B0", "a& c #1C40B0", "b& c #1B3DAC", "c& c #143DAC", "d& c #193DAD", "e& c #1B3DAD", "f& c #173DAD", "g& c #153DAC", "h& c #1C3CAC", "i& c #243CAD", "j& c #213FB0", "k& c #263BAA", "l& c #253CAE", "m& c #273AAC", "n& c #273AAD", "o& c #253BAD", "p& c #1D3CAC", "q& c #243BAD", "r& c #1E3CAC", "s& c #263BAD", "t& c #1A3DAC", "u& c #143DAB", "v& c #163DAC", "w& c #1A3CAC", "x& c #1F3CAD", "y& c #263BAB", "z& c #263BA6", "A& c #1E42A4", "B& c #2D40A5", "C& c #253BA6", "D& c #253CA7", "E& c #263AA5", "F& c #253BA7", "G& c #1E3BA6", "H& c #193DA6", "I& c #173DA5", "J& c #143DA6", "K& c #1A3DA7", "L& c #133DA6", "M& c #123DA5", "N& c #1A3CA7", "O& c #243BA6", "P& c #263AA7", "Q& c #273BA7", "R& c #263AA6", "S& c #223BA6", "T& c #1D3BA6", "U& c #173CA6", "V& c #133DA5", "W& c #1B3DA6", "X& c #193DA5", "Y& c #123DA4", "Z& c #163CA5", "`& c #213CA6", " * c #273BA8", ".* c #263BA7", "+* c #253BA5", "@* c #263BA5", "#* c #1C3BA6", "$* c #1B3BA9", "%* c #133BA8", "&* c #0A3BA7", "** c #083AA6", "=* c #123CA5", "-* c #0839A8", ";* c #0239A6", ">* c #123AA8", ",* c #1F49C8", "'* c #2F4DA4", ")* c #2E4DA3", "!* c #384CA4", "~* c #3C4DA7", "{* c #394EA7", "]* c #3B4CA5", "^* c #3C52B1", "/* c #3551A8", "(* c #3759BE", "_* c #4161C7", ":* c #0033A8", "<* c #596FA9", "[* c #2F4DA3", "}* c #2D4BA5", "|* c #2E4CA4", "1* c #2C4AA5", "2* c #2D4BA4", "3* c #354DA4", "4* c #3A4BA4", "5* c #394DA6", "6* c #4056AD", "7* c #445BBB", "8* c #B5B7B4", "9* c #1B2F85", "0* c #242F79", "a* c #B5B5B5", "b* c #B5B2B6", "c* c #C0C3C3", "d* c #E3E3E4", "e* c #EBEDEA", ". + @ + # $ % & # $ % & # $ % & # $ % & & * = - ; > , ' ) ! ~ { { { { { { { ] ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ / / / ( / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / _ _ / / : / < [ } | | | 1 1 ", "2 2 2 2 3 2 4 @ 3 2 4 @ 3 2 4 @ 3 2 4 @ # 5 6 7 8 ; > 9 0 a b c d e f { { { ] ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ( ( ( ( ( ( ( ( ( / / / / / / / / / / / / / / / / / _ _ _ _ _ _ _ _ _ _ _ g g _ / / : : : h i } 1 | 1 ", "j k l m n o p q n o p q r s t u v w x y z A B C D E F G H I J K L M N O P O O Q R S T T T T T T T T T T T T T T T T T T U U U U U U U U U U U U U U U U U U U U U U U U U U U U V V V U U W X : [ Y | | ", "Z ` . ...+.@.#...+.@.#.Z $.%.&.Z $.*.=.-.;.>.,.'.).!.~.{.].^./.(._.:.<.[.}.|.1.2.3.4.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.6.7.8.: h Y } 1 ", "9.0.a.b.c.c.d.e.f.c.d.e.f.c.d.e.f.c.d.e.g.h.i.j.k.l.m.n.o.p.q.r.s.s.t.u.u.v.w.x.4.4.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.y.5.7.6.: / z.A.} ", "-.B.C.D.-.E.g.F.G.E.g.F.G.E.g.F.G.E.g.F.H.I.J.K.L.M.N.O.P.Q.R.S.T.U.V.V.U.U.W.X.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Z.y.Y.7.7.: : `.z.} ", " +.+g.;.++F.@+#+++F.@+#+++F.@+#+++F.@+#+$+%+&+*+=+-+;+>+,+'+)+!+~+{+]+{+{+4.4.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.Y.Y.5.5.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Z.Z.Z.y.y.5.7.7.: : ^+z.Y ", "/+(+_+#+H.H.>.:+H.H.>.:+H.H.>.:+H.H.>.<+[+}+*+|+1+2+3+4+5+6+7+{+{+4.4.4.4.4.4.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.Y.Y.Y.Y.Y.Y.Y.5.Y.Y.Y.Y.Y.Y.Y.Y.5.Y.Y.5.5.5.5.Y.Y.Y.Y.Y.Y.Z.Z.Z.Z.y.y.y.y.y.y.7.7.: : ^+i } ", "8+9+0+0+a+0+0+b+a+0+0+b+a+0+0+b+a+0+0+c+d+e+f+g+h+i+j+k+l+m+n+o+4.4.4.4.5.5.5.5.5.5.Y.Y.5.5.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Y.Y.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.7.7.: : p+z.Y ", "q+r+r+s+t+u+v+w+t+u+v+w+t+u+v+w+t+u+x+&+y+z+A+B+C+D+E+5+F+G+~+4.4.4.4.5.5.5.5.5.H+Y.Y.Y.Y.Y.Y.Y.Y.I+Y.Z.Y.Y.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.7.7.: : `.z.A.", "J+v+K+L+M+N+O+P+Q+R+O+P+Q+R+O+P+Q+R+O+S+T+U+V+W+X+Y+P.T Z+`+ @4.4..@5.5.5.5.5.5.Y.Y.Y.I+I+I+I+I++@+@Z.Z.Y.Y.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.@@Z.7.7.: : p+z.Y ", "#@$@$@%@%@$@#@&@#@#@#@&@#@#@#@&@#@#@#@*@=@-@;+i+;@>@,@'@)@ @4.X.5.5.H+Y.Y.Y.!@Y.Y.I++@+@Z.Z.+@Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.y.Z.6.6.: : `.z.A.", "#@$@~@~@~@{@]@^@/@{@]@^@/@{@]@^@/@{@]@(@_@:@<@[@}@k+|@V 1@2@3@5.5.5.Y.Y.I+4@I+5@+@Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.y.Z.6.6.: : p+z.Y ", "6@7@8@9@0@a@b@c@a@a@b@c@a@a@b@c@a@a@b@d@e@<@f@g@h@i@j@k@l@m@n@o@o@p@Y.I+q@q@r@+@Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.y.Z.6.6.: : `.z.A.", "s@t@u@_@_@v@w@w@x@v@w@w@x@v@y@y@x@v@:@z@A@B@P C@D@E@F@G@H@I@J@K@5@+@+@+@r@I+L@Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.@@Z.W W : : p+z.Y ", "M@N@O@P@C+Q@Q@R@C+;+Q@R@C+;+;+S@C+Q@Q@R@T@U@V@W@X@Y@Z@`@4. #.#+#Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.8.Z.Z.Z.Z.8.8.Z.Z.y.@@@@W W : : `.z.A.", "@#O@O@##$#%#&#*#=#-#;#>#,#-#;#>#,#-#'#)#!#~#W@{#]#k@^#H@/#(#_#Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.8.8.Z.Z.Z.Z.Z.Z.Z.8.8.8.8.8.8.8.8.8.8.8.Z.Z.y.y.@@W W : : p+z.Y ", ":#<#[#}#|#1#2#3#4#5#1#4#4#1#1#4#4#1#1#6#7#8#9#V 0#`+a#b#c#d#e#Z.Z.Z.f#Z.Z.Z.f#f#f#f#f#f#f#f#f#f#g#g#g#g#g#8.8.8.8.8.8.8.8.8.g#g#g#g#8.g#8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.y.y.@@W W : : `.z.A.", "h#2#i#6#|#j#7#k#|#j#7#7#|#j#7#7#|#j#7#l#8#m#n#n#o#p#q#r#s#d#e#Z.Z.Z.f#f#f#f#Z.f#f#g#g#g#g#g#g#g#g#g#g#g#g#8.8.8.g#g#8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.y.y.y.y.8.8.8.y.y.@@W W : : p+z.Y ", "l#7#7#l#7#7#7#W@7#7#7#W@7#7#k#W@t#7#7#W@u#v#n#w#x#y#z#A#B#Z.e#f#f#Z.f#f#f#Z.Z.g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#8.8.8.g#g#g#g#8.8.g#g#g#g#g#g#8.8.g#8.8.y.8.8.y.y.8.y.y.y.y.@@W W : : `.z.A.", "C#D#E#F#G#H#I#J#G#H#I#J#G#H#I#J#G#H#I#J#K#L#M#N#O#P#s#Q#+#f#R#f#f#f#f#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#@@@@y.y.@@@@y.y.W W : : p+z.Y ", "S#S#S#S#S#T#S#U#S#T#S#U#S#T#S#U#S#T#S#U#V#W#X#Y#Z#`# $.$+$@$#$g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#@@@@@@@@@@@@@@@@@@y.y.W W : : `.z.A.", "+$Z..$$$%$+$&$*$%$+$&$*$%$+$&$*$%$+$&$*$=$-$;$>$,$'$)$!$~${$]$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$/$/$/$/$($($_$_$:$:$p+z.Y ", "<$<$<$<$<$[$}$|$<$[$}$|$<$[$}$|$<$[$}$|$1$2$3$4$5$)$6$7$8$9$0$a$a$a$a$a$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$/$/$/$^$^$^$/$/$/$/$/$/$/$/$/$/$/$/$/$/$($($_$_$:$:$`.z.A.", "b$c$c$c$d$e$e$f$g$|$|$1$d$e$e$1$d$e$e$1$h$i$j$k$l$m$n$o$p$9$q$a$a$a$a$a$a$a$a$^$a$a$^$^$^$^$^$^$a$r$r$r$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$($($_$_$:$:$p+z.Y ", "e$1$s$s$1$t$u$v$w$x$y$z$A$x$u$v$g$B$C$>$D$E$F$G$H$I$J$K$L$M$N$a$a$a$a$a$a$a$a$^$r$r$a$^$^$^$a$r$r$r$r$r$/$^$r$^$^$^$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$O$($_$_$:$:$`.z.A.", "P$Q$R$S$T$U$V$W$X$Y$Z$W$`$ %.%W$+%U$@%#%$%%%&%($*%=%-%;%>%>%,%r$r$r$r$r$a$a$a$/$/$/$r$r$r$r$r$r$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$O$($_$_$:$:$p+z.Y ", "'%W$)%!%~%{%'%]%~%^%'%]%~%^%'%]%~%^%/%(%_%&%:%<%[%}%|%1%2%3%4%r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$/$r$/$/$r$r$r$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$r$/$/$/$/$/$O$($_$_$:$:$`.z.A.", "5%6%'%'%6%7%8%9%6%7%8%9%6%7%8%9%6%7%8%0%&%a%<%b%[%c%d%e%f%g%h%r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$/$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$/$/$/$/$/$/$/$/$/$/$/$/$/$/$r$r$/$/$r$r$/$r$i%j%O$($_$_$:$:$p+z.Y ", "k%l%m%n%o%o%p%q%o%o%r%q%o%o%r%q%o%o%p%q%s%t%/$u%v%w%x%y%z%A%B%r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$/$/$/$/$/$/$/$r$r$i%i%i%r$r$i%i%i%i%i%i%i%i%i%i%i%i%r$/$/$j%j%j%j%j%j%j%j%j%O$($_$_$:$:$`.z.A.", "C%D%E%F%G%H%I%J%K%H%I%J%K%H%I%J%K%H%I%J%L%M%N%O%P%Q%R%S%T%A%B%r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$U%U%r$r$i%i%/$/$r$r$/$/$/$/$r$r$i%i%i%i%i%i%i%i%i%i%i%i%i%i%j%i%j%j%j%j%j%j%j%j%j%j%j%j%j%O$($_$_$:$:$p+z.Y ", "/$/$/$/$V%V%W%X%W%Y%Y%Z%W%W%Y%Z%W%W%W%`%`% &B%.&+&@&#&$&%&A%B%r$r$r$U%U%U%U%r$U%U%U%U%U%U%U%U%U%U%i%i%i%i%i%i%i%i%/$/$/$i%i%i%i%i%i%i%i%i%j%j%j%j%i%i%i%i%i%j%j%j%i%i%j%j%j%j%j%j%j%j%O$($_$_$:$:$`.z.A.", "&&*&=&-&=&;&>&,&=&;&>&,&=&;&>&,&=&;&>&'&)&!&~&{&]&^&/&(&_&:&<&U%U%U%U%U%U%U%U%U%U%U%U%U%i%i%U%U%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%O$($_$_$:$:$p+z.Y ", "U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%[&}&|&1&2&3&4&5&_&6&U%7&U%U%U%U%U%U%U%U%i%i%U%U%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%O$O$_$_$:$:$`.z.A.", "U%U%U%U%U%U%[&8&U%9&[&0&U%9&[&0&U%9&[&a&:&b&c&d&e&f&g&h&i&<&j&U%U%U%U%U%U%U%U%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%O$O$_$_$:$:$p+z.Y ", "k&l&m&7&7&n&o&p&7&n&q&r&s&s&q&r&s&n&o&p&t&u&u&g&v&w&x&q&n&m&y&7&7&U%U%7&z&7&z&U%A&B&i%i%B&B&i%i%B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&i%B&O$O$_$_$:$:$`.z.A.", "C&D&E&z&z&E&F&G&z&E&F&G&z&E&F&G&z&E&F&G&H&I&J&K&L&M&N&O&P&Q&z&z&z&z&z&z&z&z&z&z&z&z&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&O$O$_$_$:$:$p+z.Y ", "z&z&z&z&R&S&T&U&R&S&T&U&R&S&T&U&R&S&T&U&V&V&W&X&Y&Z&`&C&R&z&z&z&z&z&z&z&z&z&z&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&O$O$_$_$:$:$^+z.A.", "z& *.*+*@*#*$*%*@*#*$*%*@*#*$*%*@*#*$*%*&***=*-*;*>*k&P&+*z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&B&B&B&B&z&z&z&B&B&B&z&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&/$O$O$@@_$,*:$/ ^+z.Y ", "'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*)*'*!*~*{*]*^*^*^*/*/*/*/*/*/*/*^*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*^*/*/*/*/*/*h h ^*h h ^*^*h h ^*^*^*^*h ^*^*^*^*h ^*^*^*(*_*_*_*_*_$:*:$<*`.z.} ", "'*'*'*'*'*[*}*|*'*[*}*|*'*[*}*|*'*[*}*|*1*1*2*}*}*2*[*)*3*4*5*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*h h h h h h h h h h h h h h h h 6*7*_*_*_*_*^*:*:$: 8*z.Y } ", "9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*( <*8*^+z.Y } 1 ", "a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*8*b*8*b*8*b*8*b*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*8*8*8*b*8*`.z.A.Y | | ", "c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*p+`.p+`.p+`.p+`.`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+^+`.^+^+z.z.Y Y | | 1 ", "d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*A.Y A.Y A.Y A.Y Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y } } | | | | 1 1 ", "e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*} | } | } | } | | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | | | | 1 | | | 1 1 1 "}; static char * tabmiddle_xpm[] = { "33 42 32 1", " c None", ". c #CECFEF", "+ c #CECBE7", "@ c #C6C7E7", "# c #C6CBE7", "$ c #BDBEDE", "% c #BDC3DE", "& c #CECBEF", "* c #B5B6D6", "= c #ADAECE", "- c #ADB2CE", "; c #BDBAD6", "> c #B5BAD6", ", c #C6C3DE", "' c #ADAAC6", ") c #B5B2CE", "! c #B5B6CE", "~ c #A5A2BD", "{ c #A5A6BD", "] c #9C9EB5", "^ c #9CA2BD", "/ c #ADAEC6", "( c #C6C3E7", "_ c #9C9AB5", ": c #A5A6C6", "< c #949AAD", "[ c #A5AAC6", "} c #9496AD", "| c #BDBADE", "1 c #BDBED6", "2 c #9CA2B5", "3 c #A5AABD", "..........................+@.#.#.", "........................$@%&#.#..", "......................**$$@@&#.#.", ".....................=-;>,%+@.#..", "....................'')!$$@@&#.#.", "...................~{=)$$@@&#.#..", "..................]^'/;;(%&#.#...", "................._]:/*>,%&@.#.#..", ".................<{[)!$%+@.#.#...", "................}~{=!$%@@.#......", "................]^/-|$@@.#.......", "................]'/*;@@&#........", "...............<~[)>,%&#.#.......", "...............]~=)$%+#.#........", "...............]'/;1@@.#.........", "...............~{)*,%&#..........", "...............2/-$$@#...........", "...............~[*>(@&#..........", "...............^=)$%+#...........", "...............{'*>(@.#..........", "...............^=)$%+#...........", "...............{'*>(@.#..........", "...............^=)$%+#...........", "...............{'*>(@.#..........", "...............^=)$%+#...........", "...............{'*>(@.#..........", "...............^=)$%+#...........", "...............{'*>@@.#..........", "...............^=!$%&#...........", "...............{/*;@@.#..........", "...............{)!$%&#...........", "..............]'/;1@@.#..........", "..............23)>,%&#...........", "..............~=-$$@@.#..........", ".............]{/*;@@.#...........", "............<^[)>,%&#............", "............]{/!$%@@.#...........", "..........]^[-!$%@@.#............", ".........]^3/!>$@@.#.............", ".......<]^3/!>$@@&#..............", ".....<]2{[/!>$%@&#.#.............", "}<<_]2{3/-!>$%@&#.#.............."}; static char * tabselectedbeginn_xpm[] = { "33 39 28 1", " c None", ". c #CECFEF", "+ c #EFF3EF", "@ c #FFFBFF", "# c #F7FBF7", "$ c #FFFFFF", "% c #EFEFEF", "& c #F7F7F7", "* c #DEDFDE", "= c #E7E7E7", "- c #D6D3D6", "; c #DEE3DE", "> c #EFEBEF", ", c #F7F3F7", "' c #CECBCE", ") c #CECFCE", "! c #D6D7D6", "~ c #DEDBDE", "{ c #E7EBE7", "] c #C6C7C6", "^ c #E7E3E7", "/ c #BDC3BD", "( c #CED3CE", "_ c #BDBABD", ": c #C6C3C6", "< c #C6CBC6", "[ c #D6DBD6", "} c #BDBEBD", "..........................+@#$#$$", "........................%%&&@#$#$", "......................*==%%&&@#$$", "....................--*;>%,&@#$#$", "...................')!~={,+@#$#$$", "...................]-!^=%%&&@#$#$", "................../'(~;>%&&@#$#$$", "................._])!*={,&@#$#$$$", "................_])~*>%&&$#$$$$$$", "................:<![={&&@#$$$$$$$", "................:)!^=,+@#$$$$$$$$", "...............}'(*^%+@#$#$$$$$$$", "...............:<!*>%&&$#$$$$$$$$", ".............../)!^{,&@#$$$$$$$$$", "...............](*^%+@#$$$$$$$$$$", "...............]!~=%&&$$$$$$$$$$$", "...............'(*=,+@#$$$$$$$$$$", "...............<!*>%&&$$$$$$$$$$$", "...............'-^=,+@#$$$$$$$$$$", "...............<!*>%&#$$$$$$$$$$$", "...............'-^=,+@#$$$$$$$$$$", "...............<!*>%&#$$$$$$$$$$$", "...............'-^=,+@#$$$$$$$$$$", "...............<!*>%&#$$$$$$$$$$$", "...............'-^=,+@#$$$$$$$$$$", "...............<!*>%&#$$$$$$$$$$$", "...............'!^=,&@#$$$$$$$$$$", "...............<~*>%&#$$$$$$$$$$$", "...............)!^{,&@#$$$$$$$$$$", "..............])~;%+@#$$$$$$$$$$$", "..............]-[={&&$#$$$$$$$$$$", ".............])!^=,&@#$$$$$$$$$$$", "............:'-*^%+@#$$$$$$$$$$$$", "............])~*>%&&$#$$$$$$$$$$$", "...........:'!*={,&@#$$$$$$$$$$$$", "..........:'-~^=,+@#$$$$$$$$$$$$$", ".......}]'-~^=%,&@#$$$$$$$$$$$$$$", ".....}:])-~^=%,+@#$#$$$$$$$$$$$$$", "}}}:]')-!*^=%,&@#$#$$$$$$$$$$$$$$"}; static char * tabselectedend_xpm[] = { "33 42 33 1", " c None", ". c #FFFFFF", "+ c #CECBE7", "@ c #C6C7E7", "# c #CECFEF", "$ c #C6CBE7", "% c #BDBEDE", "& c #BDC3DE", "* c #CECBEF", "= c #B5B6D6", "- c #ADAECE", "; c #ADB2CE", "> c #BDBAD6", ", c #B5BAD6", "' c #C6C3DE", ") c #ADAAC6", "! c #B5B2CE", "~ c #B5B6CE", "{ c #A5A2BD", "] c #A5A6BD", "^ c #9C9EB5", "/ c #9CA2BD", "( c #ADAEC6", "_ c #C6C3E7", ": c #9C9AB5", "< c #A5A6C6", "[ c #949AAD", "} c #A5AAC6", "| c #9496AD", "1 c #BDBADE", "2 c #BDBED6", "3 c #9CA2B5", "4 c #A5AABD", "..........................+@#$#$#", "........................%@&*$#$##", "......................==%%@@*$#$#", ".....................-;>,'&+@#$##", "....................))!~%%@@*$#$#", "...................{]-!%%@@*$#$##", "..................^/)(>>_&*$#$###", ".................:^<(=,'&*@#$#$##", ".................[]}!~%&+@#$#$###", "................|{]-~%&@@#$######", "................^/(;1%@@#$#######", "................^)(=>@@*$########", "...............[{}!,'&*$#$#######", "...............^{-!%&+$#$########", "...............^)(>2@@#$#########", "...............{]!='&*$##########", "...............3(;%%@$###########", "...............{}=,_@*$##########", ".............../-!%&+$###########", "...............])=,_@#$##########", ".............../-!%&+$###########", "...............])=,_@#$##########", ".............../-!%&+$###########", "...............])=,_@#$##########", ".............../-!%&+$###########", "...............])=,_@#$##########", ".............../-!%&+$###########", "...............])=,@@#$##########", ".............../-~%&*$###########", "...............](=>@@#$##########", "...............]!~%&*$###########", "..............^)(>2@@#$##########", "..............34!,'&*$###########", "..............{-;%%@@#$##########", ".............^](=>@@#$###########", "............[/}!,'&*$############", "............^](~%&@@#$###########", "..........^/};~%&@@#$############", ".........^/4(~,%@@#$#############", ".......[^/4(~,%@@*$##############", ".....[^3]}(~,%&@*$#$#############", "|[[:^3]4(;~,%&@*$#$##############"}; static char * tabend_xpm[] = { "33 42 3 1", " c None", ". c #CECFEF", "+ c #FFFFFF", "..........................+++++++", "........................+++++++++", "......................+++++++++++", ".....................++++++++++++", "....................+++++++++++++", "...................++++++++++++++", "..................+++++++++++++++", ".................++++++++++++++++", ".................++++++++++++++++", "................+++++++++++++++++", "................+++++++++++++++++", "................+++++++++++++++++", "...............++++++++++++++++++", "...............++++++++++++++++++", "...............++++++++++++++++++", "...............++++++++++++++++++", "...............++++++++++++++++++", "...............++++++++++++++++++", "...............++++++++++++++++++", "...............++++++++++++++++++", "...............++++++++++++++++++", "...............++++++++++++++++++", "...............++++++++++++++++++", "...............++++++++++++++++++", "...............++++++++++++++++++", "...............++++++++++++++++++", "...............++++++++++++++++++", "...............++++++++++++++++++", "...............++++++++++++++++++", "...............++++++++++++++++++", "...............++++++++++++++++++", "..............+++++++++++++++++++", "..............+++++++++++++++++++", "..............+++++++++++++++++++", ".............++++++++++++++++++++", "............+++++++++++++++++++++", "............+++++++++++++++++++++", "..........+++++++++++++++++++++++", ".........++++++++++++++++++++++++", ".......++++++++++++++++++++++++++", ".....++++++++++++++++++++++++++++", "+++++++++++++++++++++++++++++++++"}; QColor fromHsl(QColor c) { const qreal h = c.hueF(); const qreal s = c.saturationF(); const qreal l = c.valueF(); qreal ca[3] = {0, 0, 0}; if (s == 0 || h == 1) { // achromatic case ca[0] = ca[1] = ca[2] = l; } else { // chromatic case qreal temp2; if (l < qreal(0.5)) temp2 = l * (qreal(1.0) + s); else temp2 = l + s - (l * s); const qreal temp1 = (qreal(2.0) * l) - temp2; qreal temp3[3] = { h + (qreal(1.0) / qreal(3.0)), h, h - (qreal(1.0) / qreal(3.0)) }; for (int i = 0; i != 3; ++i) { if (temp3[i] < qreal(0.0)) temp3[i] += qreal(1.0); else if (temp3[i] > qreal(1.0)) temp3[i] -= qreal(1.0); const qreal sixtemp3 = temp3[i] * qreal(6.0); if (sixtemp3 < qreal(1.0)) ca[i] = ((temp1 + (temp2 - temp1) * sixtemp3)); else if ((temp3[i] * qreal(2.0)) < qreal(1.0)) ca[i] = (temp2); else if ((temp3[i] * qreal(3.0)) < qreal(2.0)) ca[i] = temp1 + (temp2 -temp1) * (qreal(2.0) /qreal(3.0) - temp3[i]) * qreal(6.0); else ca[i] = temp1; } } return QColor::fromRgbF(ca[0], ca[1], ca[2]); } #define Q_MAX_3(a, b, c) ( ( a > b && a > c) ? a : (b > c ? b : c) ) #define Q_MIN_3(a, b, c) ( ( a < b && a < c) ? a : (b < c ? b : c) ) QColor toHsl(QColor c) { QColor color; qreal h; qreal s; qreal l; const qreal r = c.redF(); const qreal g = c.greenF(); const qreal b = c.blueF(); const qreal max = Q_MAX_3(r, g, b); const qreal min = Q_MIN_3(r, g, b); const qreal delta = max - min; const qreal delta2 = max + min; const qreal lightness = qreal(0.5) * delta2; l = (lightness); if (qFuzzyIsNull(delta)) { // achromatic case, hue is undefined h = 0; s = 0; } else { // chromatic case qreal hue = 0; if (lightness < qreal(0.5)) s = ((delta / delta2)); else s = ((delta / (qreal(2.0) - delta2))); if (qFuzzyCompare(r, max)) { hue = ((g - b) /delta); } else if (qFuzzyCompare(g, max)) { hue = (2.0 + (b - r) / delta); } else if (qFuzzyCompare(b, max)) { hue = (4.0 + (r - g) / delta); } else { Q_ASSERT_X(false, "QColor::toHsv", "internal error"); } hue *= 60.0; if (hue < 0.0) hue += 360.0; h = (hue * 100); } h = h / 36000; return QColor::fromHsvF(h, s, l); } void tintColor(QColor &color, QColor tintColor, qreal _saturation) { tintColor = toHsl(tintColor); color = toHsl(color); qreal hue = tintColor.hueF(); qreal saturation = color.saturationF(); if (_saturation) saturation = _saturation; qreal lightness = color.valueF(); color.setHsvF(hue, saturation, lightness); color = fromHsl(color); color.toRgb(); } void tintImagePal(QImage *image, QColor color, qreal saturation) { QVector<QRgb> colorTable = image->colorTable(); for (int i=2;i< colorTable.size();i++) { QColor c(toHsl(colorTable.at(i))); tintColor(c, color, saturation); colorTable[i] = c.rgb(); } image->setColorTable(colorTable); } void tintImage(QImage *image, QColor color, qreal saturation) { *image = image->convertToFormat(QImage::Format_RGB32); for (int x = 0; x < image->width(); x++) for (int y = 0; y < image->height(); y++) { QColor c(image->pixel(x,y)); tintColor(c, color, saturation); image->setPixel(x, y, c.rgb()); } } #endif //Q_WS_WINCE_WM enum QSliderDirection { SliderUp, SliderDown, SliderLeft, SliderRight }; #ifdef Q_WS_WINCE_WM void QWindowsMobileStylePrivate::tintImagesButton(QColor color) { if (currentTintButton == color) return; currentTintButton = color; imageTabEnd = QImage(tabend_xpm); imageTabSelectedEnd = QImage(tabselectedend_xpm); imageTabSelectedBegin = QImage(tabselectedbeginn_xpm); imageTabMiddle = QImage(tabmiddle_xpm); tintImage(&imageTabEnd, color, 0.0); tintImage(&imageTabSelectedEnd, color, 0.0); tintImage(&imageTabSelectedBegin, color, 0.0); tintImage(&imageTabMiddle, color, 0.0); if (!doubleControls) { int height = imageTabMiddle.height() / 2 + 1; imageTabEnd = imageTabEnd.scaledToHeight(height); imageTabMiddle = imageTabMiddle.scaledToHeight(height); imageTabSelectedEnd = imageTabSelectedEnd.scaledToHeight(height); imageTabSelectedBegin = imageTabSelectedBegin.scaledToHeight(height); } } void QWindowsMobileStylePrivate::tintImagesHigh(QColor color) { if (currentTintHigh == color) return; currentTintHigh = color; tintListViewHighlight(color); imageScrollbarHandleUpHigh = imageScrollbarHandleUp; imageScrollbarHandleDownHigh = imageScrollbarHandleDown; tintImagePal(&imageScrollbarHandleDownHigh, color, qreal(0.8)); tintImagePal(&imageScrollbarHandleUpHigh, color, qreal(0.8)); } void QWindowsMobileStylePrivate::tintListViewHighlight(QColor color) { imageListViewHighlightCornerRight = QImage(listviewhighcornerright_xpm); tintImage(&imageListViewHighlightCornerRight, color, qreal(0.0)); imageListViewHighlightCornerLeft = QImage(listviewhighcornerleft_xpm); tintImage(&imageListViewHighlightCornerLeft, color, qreal(0.0)); imageListViewHighlightMiddle = QImage(listviewhighmiddle_xpm); tintImage(&imageListViewHighlightMiddle, color, qreal(0.0)); int height = imageListViewHighlightMiddle.height(); if (!doubleControls) { height = height / 2; imageListViewHighlightCornerRight = imageListViewHighlightCornerRight.scaledToHeight(height); imageListViewHighlightCornerLeft = imageListViewHighlightCornerLeft.scaledToHeight(height); imageListViewHighlightMiddle = imageListViewHighlightMiddle.scaledToHeight(height); } } #endif //Q_WS_WINCE_WM void QWindowsMobileStylePrivate::setupWindowsMobileStyle65() { #ifdef Q_WS_WINCE_WM wm65 = qt_wince_is_windows_mobile_65(); if (wm65) { imageScrollbarHandleUp = QImage(sbhandleup_xpm); imageScrollbarHandleDown = QImage(sbhandledown_xpm); imageScrollbarGripUp = QImage(sbgripup_xpm); imageScrollbarGripDown = QImage(sbgripdown_xpm); imageScrollbarGripMiddle = QImage(sbgripmiddle_xpm); if (!doubleControls) { imageScrollbarHandleUp = imageScrollbarHandleUp.scaledToHeight(imageScrollbarHandleUp.height() / 2); imageScrollbarHandleDown = imageScrollbarHandleDown.scaledToHeight(imageScrollbarHandleDown.height() / 2); imageScrollbarGripMiddle = imageScrollbarGripMiddle.scaledToHeight(imageScrollbarGripMiddle.height() / 2); imageScrollbarGripUp = imageScrollbarGripUp.scaledToHeight(imageScrollbarGripUp.height() / 2); imageScrollbarGripDown = imageScrollbarGripDown.scaledToHeight(imageScrollbarGripDown.height() / 2); } else { } tintImagesHigh(Qt::blue); } #endif //Q_WS_WINCE_WM } void QWindowsMobileStylePrivate::drawTabBarTab(QPainter *painter, const QStyleOptionTab *tab) { #ifndef QT_NO_TABBAR #ifdef Q_WS_WINCE_WM if (wm65) { tintImagesButton(tab->palette.button().color()); QRect r; r.setTopLeft(tab->rect.topRight() - QPoint(imageTabMiddle.width(), 0)); r.setBottomRight(tab->rect.bottomRight()); if (tab->state & QStyle::State_Selected) { painter->fillRect(tab->rect, tab->palette.window()); } else { painter->fillRect(tab->rect, QColor(imageTabMiddle.pixel(0,0))); } if (tab->selectedPosition == QStyleOptionTab::NextIsSelected) { painter->drawImage(r, imageTabSelectedBegin); } else if (tab->position == QStyleOptionTab::End || tab->position == QStyleOptionTab::OnlyOneTab) { if (!(tab->state & QStyle::State_Selected)) { painter->drawImage(r, imageTabEnd); } } else if (tab->state & QStyle::State_Selected) { painter->drawImage(r, imageTabSelectedEnd); } else { painter->drawImage(r, imageTabMiddle); } if (tab->position == QStyleOptionTab::Beginning && ! (tab->state & QStyle::State_Selected)) { painter->drawImage(tab->rect.topLeft() - QPoint(imageTabMiddle.width() * 0.60, 0), imageTabSelectedEnd); } //imageTabBarBig return; } #endif //Q_WS_WINCE_WM painter->save(); painter->setPen(tab->palette.shadow().color()); if (doubleControls) { QPen pen = painter->pen(); pen.setWidth(2); pen.setCapStyle(Qt::FlatCap); painter->setPen(pen); } if(tab->shape == QTabBar::RoundedNorth) { if (tab->state & QStyle::State_Selected) { painter->fillRect(tab->rect, tab->palette.light()); painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight()); } else { painter->fillRect(tab->rect, tab->palette.button()); painter->drawLine(tab->rect.bottomLeft() , tab->rect.bottomRight()); painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight()); } } else if(tab->shape == QTabBar::RoundedSouth) { if (tab->state & QStyle::State_Selected) { painter->fillRect(tab->rect.adjusted(0,-2,0,0), tab->palette.light()); painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight()); } else { painter->fillRect(tab->rect, tab->palette.button()); if (doubleControls) painter->drawLine(tab->rect.topLeft() + QPoint(0,1), tab->rect.topRight() + QPoint(0,1)); else painter->drawLine(tab->rect.topLeft(), tab->rect.topRight()); painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight()); } } else if(tab->shape == QTabBar::RoundedEast) { if (tab->state & QStyle::State_Selected) { painter->fillRect(tab->rect, tab->palette.light()); painter->drawLine(tab->rect.topLeft(), tab->rect.topRight()); } else { painter->fillRect(tab->rect, tab->palette.button()); painter->drawLine(tab->rect.topLeft(), tab->rect.bottomLeft()); painter->drawLine(tab->rect.topLeft(), tab->rect.topRight()); } } else if(tab->shape == QTabBar::RoundedWest) { if (tab->state & QStyle::State_Selected) { painter->fillRect(tab->rect, tab->palette.light()); painter->drawLine(tab->rect.bottomLeft(), tab->rect.bottomRight()); } else { painter->fillRect(tab->rect, tab->palette.button()); painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight()); painter->drawLine(tab->rect.bottomLeft(), tab->rect.bottomRight()); } } painter->restore(); #endif //QT_NO_TABBAR } void QWindowsMobileStylePrivate::drawPanelItemViewSelected(QPainter *painter, const QStyleOptionViewItemV4 *option, QRect rect) { #ifdef Q_WS_WINCE_WM if (wm65) { QRect r; if (rect.isValid()) r = rect; else r = option->rect; tintImagesHigh(option->palette.highlight().color()); painter->setPen(QColor(Qt::lightGray)); if (option->viewItemPosition == QStyleOptionViewItemV4::Middle) { painter->drawImage(r, imageListViewHighlightMiddle); } else if (option->viewItemPosition == QStyleOptionViewItemV4::Beginning) { painter->drawImage(r.adjusted(10, 0, 0, 0), imageListViewHighlightMiddle); } else if (option->viewItemPosition == QStyleOptionViewItemV4::End) { painter->drawImage(r.adjusted(0, 0, -10, 0), imageListViewHighlightMiddle); } else { painter->drawImage(r.adjusted(10, 0, -10, 0), imageListViewHighlightMiddle); } QImage cornerLeft = imageListViewHighlightCornerLeft; QImage cornerRight = imageListViewHighlightCornerRight; int width = r.width() > cornerRight.width() ? r.width() : cornerRight.width(); if ((width * 2) > r.width()) { width = (r.width() - 5) / 2; } cornerLeft = cornerLeft.scaled(width, r.height()); cornerRight = cornerRight.scaled(width, r.height()); if ((option->viewItemPosition == QStyleOptionViewItemV4::Beginning) || (option->viewItemPosition == QStyleOptionViewItemV4::OnlyOne) || !option->viewItemPosition) { painter->drawImage(r.topLeft(), cornerLeft); } if ((option->viewItemPosition == QStyleOptionViewItemV4::End) || (option->viewItemPosition == QStyleOptionViewItemV4::OnlyOne) || !option->viewItemPosition) { painter->drawImage(r.topRight() - QPoint(cornerRight.width(),0), cornerRight); } return; } #endif //Q_WS_WINCE_WM QPalette::ColorGroup cg = option->state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled; if (rect.isValid()) painter->fillRect(rect, option->palette.brush(cg, QPalette::Highlight)); else painter->fillRect(option->rect, option->palette.brush(cg, QPalette::Highlight)); } void QWindowsMobileStylePrivate::drawScrollbarGrip(QPainter *p, QStyleOptionSlider *newScrollbar, const QStyleOptionComplex *option, bool drawCompleteFrame) { #ifdef Q_WS_WINCE_WM if (wm65) { if (newScrollbar->orientation == Qt::Horizontal) { QTransform transform; transform.rotate(-90); QRect r = newScrollbar->rect; p->drawImage(r.adjusted(10, 0, -10, 0), imageScrollbarGripMiddle.transformed(transform)); p->drawImage(r.topLeft(), imageScrollbarGripUp.transformed(transform)); p->drawImage(r.topRight() - QPoint(imageScrollbarGripDown.height() - 1, 0), imageScrollbarGripDown.transformed(transform)); } else { QRect r = newScrollbar->rect; p->drawImage(r.adjusted(0, 10, 0, -10), imageScrollbarGripMiddle); p->drawImage(r.topLeft(), imageScrollbarGripUp); p->drawImage(r.bottomLeft() - QPoint(0, imageScrollbarGripDown.height() - 1), imageScrollbarGripDown); } return ; } #endif if (newScrollbar->orientation == Qt::Horizontal) { p->fillRect(newScrollbar->rect,option->palette.button()); QRect r = newScrollbar->rect; p->drawLine(r.topLeft(), r.bottomLeft()); p->drawLine(r.topRight(), r.bottomRight()); if (smartphone) { p->drawLine(r.topLeft(), r.topRight()); p->drawLine(r.bottomLeft(), r.bottomRight()); } } else { p->fillRect(newScrollbar->rect,option->palette.button()); QRect r = newScrollbar->rect; p->drawLine(r.topLeft(), r.topRight()); p->drawLine(r.bottomLeft(), r.bottomRight()); if (smartphone) { p->drawLine(r.topLeft(), r.bottomLeft()); p->drawLine(r.topRight(), r.bottomRight()); } } if (newScrollbar->state & QStyle::State_HasFocus) { QStyleOptionFocusRect fropt; fropt.QStyleOption::operator=(*newScrollbar); fropt.rect.setRect(newScrollbar->rect.x() + 2, newScrollbar->rect.y() + 2, newScrollbar->rect.width() - 5, newScrollbar->rect.height() - 5); } int gripMargin = doubleControls ? 4 : 2; int doubleLines = doubleControls ? 2 : 1; //If there is a frame around the scrollbar (abstractScrollArea), //then the margin is different, because of the missing frame int gripMarginFrame = doubleControls ? 3 : 1; if (drawCompleteFrame) gripMarginFrame = 0; //draw grips if (!smartphone) if (newScrollbar->orientation == Qt::Horizontal) { for (int i = -3; i < 3; i += 2) { p->drawLine( QPoint(newScrollbar->rect.center().x() + i * doubleLines + 1, newScrollbar->rect.top() + gripMargin +gripMarginFrame), QPoint(newScrollbar->rect.center().x() + i * doubleLines + 1, newScrollbar->rect.bottom() - gripMargin)); } } else { for (int i = -2; i < 4 ; i += 2) { p->drawLine( QPoint(newScrollbar->rect.left() + gripMargin + gripMarginFrame , newScrollbar->rect.center().y() + 1 + i * doubleLines - 1), QPoint(newScrollbar->rect.right() - gripMargin, newScrollbar->rect.center().y() + 1 + i * doubleLines - 1)); } } if (!smartphone) { QRect r; if (doubleControls) r = option->rect.adjusted(1, 1, -1, 0); else r = option->rect.adjusted(0, 0, -1, 0); if (drawCompleteFrame && doubleControls) r.adjust(0, 0, 0, -1); //Check if the scrollbar is part of an abstractItemView and draw the frame according if (drawCompleteFrame) p->drawRect(r); else if (newScrollbar->orientation == Qt::Horizontal) p->drawLine(r.topLeft(), r.topRight()); else p->drawLine(r.topLeft(), r.bottomLeft()); } } void QWindowsMobileStylePrivate::drawScrollbarHandleUp(QPainter *p, QStyleOptionSlider *opt, bool completeFrame, bool ) { #ifdef Q_WS_WINCE_WM if (wm65) { tintImagesHigh(opt->palette.highlight().color()); QRect r = opt->rect; if (opt->orientation == Qt::Horizontal) { QTransform transform; transform.rotate(-90); if (opt->state & QStyle::State_Sunken) p->drawImage(r.topLeft(), imageScrollbarHandleUpHigh.transformed(transform)); else p->drawImage(r.topLeft(), imageScrollbarHandleUp.transformed(transform)); } else { if (opt->state & QStyle::State_Sunken) p->drawImage(r.topLeft(), imageScrollbarHandleUpHigh); else p->drawImage(r.topLeft(), imageScrollbarHandleUp); } return ; } #endif //Q_WS_WINCE_WM QBrush fill = opt->palette.button(); if (opt->state & QStyle::State_Sunken) fill = opt->palette.shadow(); QStyleOption arrowOpt = *opt; if (doubleControls) arrowOpt.rect = opt->rect.adjusted(4, 6, -5, -3); else arrowOpt.rect = opt->rect.adjusted(5, 6, -4, -3); bool horizontal = (opt->orientation == Qt::Horizontal); if (horizontal) { p->fillRect(opt->rect,fill); QRect r = opt->rect.adjusted(0,0,1,0); p->drawLine(r.topRight(), r.bottomRight()); if (doubleControls) arrowOpt.rect.adjust(0, -2 ,0, -2); q_func()->proxy()->drawPrimitive(QStyle::PE_IndicatorArrowLeft, &arrowOpt, p, 0); } else { p->fillRect(opt->rect,fill); QRect r = opt->rect.adjusted(0, 0, 0, 1); p->drawLine(r.bottomLeft(), r.bottomRight()); if (completeFrame) arrowOpt.rect.adjust(-2, 0, -2, 0); if (doubleControls) arrowOpt.rect.adjust(0, -4 , 0, -4); if (completeFrame && doubleControls) arrowOpt.rect.adjust(2, 0, 2, 0); q_func()->proxy()->drawPrimitive(QStyle::PE_IndicatorArrowUp, &arrowOpt, p, 0); } } void QWindowsMobileStylePrivate::drawScrollbarHandleDown(QPainter *p, QStyleOptionSlider *opt, bool completeFrame, bool secondScrollBar) { #ifndef QT_NO_SCROLLBAR #ifdef Q_WS_WINCE_WM if (wm65) { tintImagesHigh(opt->palette.highlight().color()); QRect r = opt->rect; if (opt->orientation == Qt::Horizontal) { QTransform transform; transform.rotate(-90); if (opt->state & QStyle::State_Sunken) p->drawImage(r.topLeft(), imageScrollbarHandleDownHigh.transformed(transform)); else p->drawImage(r.topLeft(), imageScrollbarHandleDown.transformed(transform)); } else { if (opt->state & QStyle::State_Sunken) p->drawImage(r.topLeft(), imageScrollbarHandleDownHigh); else p->drawImage(r.topLeft(), imageScrollbarHandleDown); } return ; } #endif //Q_WS_WINCE_WM QBrush fill = opt->palette.button(); if (opt->state & QStyle::State_Sunken) fill = opt->palette.shadow(); QStyleOption arrowOpt = *opt; if (doubleControls) arrowOpt.rect = opt->rect.adjusted(4, 0, -5, 3); else arrowOpt.rect = opt->rect.adjusted(5, 6, -4, -3); bool horizontal = (opt->orientation == Qt::Horizontal); if (horizontal) { p->fillRect(opt->rect,fill); QRect r = opt->rect.adjusted(0, 0, 0, 0); p->drawLine(r.topLeft(), r.bottomLeft()); if (secondScrollBar) p->drawLine(r.topRight(), r.bottomRight()); if (doubleControls) arrowOpt.rect.adjust(0, 4, 0, 4 ); q_func()->proxy()->drawPrimitive(QStyle::PE_IndicatorArrowRight, &arrowOpt, p, 0); } else { p->fillRect(opt->rect,fill); QRect r = opt->rect.adjusted(0, -1, 0, -1); p->drawLine(r.topLeft(), r.topRight()); if (secondScrollBar) p->drawLine(r.bottomLeft() + QPoint(0,1), r.bottomRight() + QPoint(0, 1)); if (completeFrame) arrowOpt.rect.adjust(-2, 0, -2, 0); if (doubleControls) arrowOpt.rect.adjust(1, 0, 1, 0 ); if (completeFrame && doubleControls) arrowOpt.rect.adjust(1, 0, 1, 0); q_func()->proxy()->drawPrimitive(QStyle::PE_IndicatorArrowDown, &arrowOpt, p, 0); } #endif //QT_NO_SCROLLBAR } void QWindowsMobileStylePrivate::drawScrollbarGroove(QPainter *p,const QStyleOptionSlider *opt) { #ifndef QT_NO_SCROLLBAR #ifdef Q_OS_WINCE_WM if (wm65) { p->fillRect(opt->rect, QColor(231, 231, 231)); return ; } #endif QBrush fill; if (smartphone) { fill = opt->palette.light(); p->fillRect(opt->rect, fill); fill = opt->palette.button(); QImage image; #ifndef QT_NO_IMAGEFORMAT_XPM if (opt->orientation == Qt::Horizontal) image = QImage(vertlines_xpm); else image = QImage(horlines_xpm); #endif image.setColor(1, opt->palette.button().color().rgb()); fill.setTextureImage(image); } else { fill = opt->palette.light(); } p->fillRect(opt->rect, fill); #endif //QT_NO_SCROLLBAR } QWindowsMobileStyle::QWindowsMobileStyle(QWindowsMobileStylePrivate &dd) : QWindowsStyle(dd) { qApp->setEffectEnabled(Qt::UI_FadeMenu, false); qApp->setEffectEnabled(Qt::UI_AnimateMenu, false); } QWindowsMobileStyle::QWindowsMobileStyle() : QWindowsStyle(*new QWindowsMobileStylePrivate) { qApp->setEffectEnabled(Qt::UI_FadeMenu, false); qApp->setEffectEnabled(Qt::UI_AnimateMenu, false); } QWindowsMobileStylePrivate::QWindowsMobileStylePrivate() :QWindowsStylePrivate() { #ifdef Q_WS_WINCE doubleControls = qt_wince_is_high_dpi(); smartphone = qt_wince_is_smartphone(); #else doubleControls = false; smartphone = false; #endif //Q_WS_WINCE #ifndef QT_NO_IMAGEFORMAT_XPM imageArrowDown = QImage(arrowdown_xpm); imageArrowUp = QImage(arrowdown_xpm).mirrored(); imageArrowLeft = QImage(arrowleft_xpm); imageArrowRight = QImage(arrowleft_xpm).mirrored(true, false); if (doubleControls) { imageRadioButton = QImage(radiobutton_xpm); imageRadioButtonChecked = QImage(radiochecked_xpm); imageChecked = QImage(checkedlight_xpm); imageCheckedBold = QImage(checkedbold_xpm); imageRadioButtonHighlighted = QImage(highlightedradiobutton_xpm); imageClose = QImage(cross_big_xpm); imageMaximize = QImage(max_big_xpm); imageMinimize = QImage(min_big_xpm); imageNormalize = QImage(normal_big_xpm); } else { imageRadioButton = QImage(radiobutton_low_xpm); imageRadioButtonChecked = QImage(radiochecked_low_xpm); imageChecked = QImage(checkedlight_low_xpm); imageCheckedBold = QImage(checkedbold_low_xpm); imageRadioButtonHighlighted = QImage(highlightedradiobutton_low_xpm); imageClose = QImage(cross_small_xpm); imageMaximize = QImage(max_small_xpm); imageMinimize = QImage(min_small_xpm); imageNormalize = QImage(normal_small_xpm); } setupWindowsMobileStyle65(); imageArrowDownBig = QImage(arrowdown_big_xpm); imageArrowUpBig = QImage(arrowdown_big_xpm).mirrored(); imageArrowLeftBig = QImage(arrowleft_big_xpm); imageArrowRightBig = QImage(arrowleft_big_xpm).mirrored(true, false); #endif } void QWindowsMobileStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const { QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func()); bool doRestore = false; QRect rect = option->rect; painter->setClipping(false); switch (element) { case PE_PanelButtonTool: { int penSize = 1; if (d->doubleControls) penSize = 2; if (widget) if (QWidget *parent = widget->parentWidget()) #ifndef QT_NO_TABWIDGET if (qobject_cast<QTabWidget *>(parent->parentWidget())) { #else if (false) { #endif //QT_NO_TABBAR rect.adjust(0,2*penSize,0,-1*penSize); qDrawPlainRect(painter, rect, option->palette.shadow().color(), penSize, &option->palette.light()); if (option->state & (State_Sunken)) qDrawPlainRect(painter, rect, option->palette.shadow().color(), penSize, &option->palette.shadow()); } else { if (!(option->state & State_AutoRaise) || (option->state & (State_Sunken | State_On))) qDrawPlainRect(painter,option->rect.adjusted(0, penSize, 0, -1 * penSize) , option->palette.button().color(), 0, &option->palette.button()); if (option->state & (State_Sunken)) { qDrawPlainRect(painter, rect, option->palette.shadow().color(), penSize, &option->palette.light()); } if (option->state & (State_On)){ QBrush fill = QBrush(option->palette.light().color()); painter->fillRect(rect.adjusted(windowsItemFrame , windowsItemFrame , -windowsItemFrame , -windowsItemFrame ), fill); qDrawPlainRect(painter, rect, option->palette.shadow().color(), penSize, &option->palette.light()); } } break; } case PE_IndicatorButtonDropDown: if (d->doubleControls) qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), 2, &option->palette.button()); else qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), 1, &option->palette.button()); break; #ifndef QT_NO_TABBAR case PE_IndicatorTabTear: if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) { bool rtl = tab->direction == Qt::RightToLeft; QRect rect = tab->rect; QPainterPath path; rect.setTop(rect.top() + ((tab->state & State_Selected) ? 1 : 3)); rect.setBottom(rect.bottom() - ((tab->state & State_Selected) ? 0 : 2)); path.moveTo(QPoint(rtl ? rect.right() : rect.left(), rect.top())); int count = 3; for(int jags = 1; jags <= count; ++jags, rtl = !rtl) path.lineTo(QPoint(rtl ? rect.left() : rect.right(), rect.top() + jags * rect.height()/count)); painter->setPen(QPen(tab->palette.light(), qreal(.8))); painter->setBrush(tab->palette.background()); painter->setRenderHint(QPainter::Antialiasing); painter->drawPath(path); } break; #endif //QT_NO_TABBAR #ifndef QT_NO_TOOLBAR case PE_IndicatorToolBarSeparator: { painter->save(); QPoint p1, p2; if (option->state & State_Horizontal) { p1 = QPoint(option->rect.width()/2, 0); p2 = QPoint(p1.x(), option->rect.height()); } else { p1 = QPoint(0, option->rect.height()/2); p2 = QPoint(option->rect.width(), p1.y()); } painter->setPen(option->palette.mid().color()); if (d->doubleControls) { QPen pen = painter->pen(); pen.setWidth(2); pen.setCapStyle(Qt::FlatCap); painter->setPen(pen); } painter->drawLine(p1, p2); painter->restore(); break; } #endif // QT_NO_TOOLBAR case PE_IndicatorToolBarHandle: painter->save(); painter->translate(option->rect.x(), option->rect.y()); if (option->state & State_Horizontal) { int x = option->rect.width() / 2 - 4; if (QApplication::layoutDirection() == Qt::RightToLeft) x -= 2; if (option->rect.height() > 4) { qDrawWinButton(painter,x-1,0,7,option->rect.height(), option->palette, false, 0); qDrawShadePanel(painter, x, 1, 3, option->rect.height() - 1, option->palette, false, 0); qDrawShadePanel(painter, x + 3, 1, 3, option->rect.height() - 1, option->palette, false, 0); painter->setPen(option->palette.button().color()); } } else { if (option->rect.width() > 4) { int y = option->rect.height() / 2 - 4; qDrawShadePanel(painter, 2, y, option->rect.width() - 2, 3, option->palette, false, 0); qDrawShadePanel(painter, 2, y + 3, option->rect.width() - 2, 3, option->palette, false, 0); } } painter->restore(); break; #ifndef QT_NO_PROGRESSBAR case PE_IndicatorProgressChunk: { bool vertical = false; if (const QStyleOptionProgressBarV2 *pb2 = qstyleoption_cast<const QStyleOptionProgressBarV2 *>(option)) vertical = (pb2->orientation == Qt::Vertical); if (!vertical) { painter->fillRect(option->rect.x(), option->rect.y()+2, option->rect.width(), option->rect.height()-4, option->palette.brush(QPalette::Highlight)); } else { painter->fillRect(option->rect.x()+2, option->rect.y(), option->rect.width()-4, option->rect.height(), option->palette.brush(QPalette::Highlight)); } } break; #endif // QT_NO_PROGRESSBAR case PE_FrameButtonTool: { #ifndef QT_NO_DOCKWIDGET if (widget && widget->inherits("QDockWidgetTitleButton")) { if (const QDockWidget *dw = qobject_cast<const QDockWidget *>(widget->parent())) if (dw->isFloating()){ qDrawPlainRect(painter,option->rect.adjusted(1, 1, 0, 0), option->palette.shadow().color(),1,&option->palette.button()); return; } } #endif // QT_NO_DOCKWIDGET QBrush fill; bool stippled; bool panel = (element == PE_PanelButtonTool); if ((!(option->state & State_Sunken )) && (!(option->state & State_Enabled) || ((option->state & State_Enabled ) && !(option->state & State_MouseOver))) && (option->state & State_On)) { fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern); stippled = true; } else { fill = option->palette.brush(QPalette::Button); stippled = false; } if (option->state & (State_Raised | State_Sunken | State_On)) { if (option->state & State_AutoRaise) { if(option->state & (State_Enabled | State_Sunken | State_On)){ if (panel) qDrawPlainRect(painter, option->rect,option->palette.shadow().color(),d->doubleControls, &fill); else qDrawPlainRect(painter, option->rect,option->palette.shadow().color(),d->doubleControls, &fill); } if (stippled) { painter->setPen(option->palette.button().color()); painter->drawRect(option->rect.adjusted(1, 1, -2, -2)); } } else { qDrawPlainRect(painter, option->rect,option->palette.shadow().color(),d->doubleControls, &fill); } } else { painter->fillRect(option->rect, fill); } break; } case PE_FrameFocusRect: if (const QStyleOptionFocusRect *fropt = qstyleoption_cast<const QStyleOptionFocusRect *>(option)) { //### check for d->alt_down int penSize; d->doubleControls ? penSize = 2 : penSize = 1; bool alternateFocusStyle = false; if (!widget) alternateFocusStyle = true; #ifndef QT_NO_COMBOBOX if (qobject_cast<const QComboBox*>(widget)) alternateFocusStyle = true; #endif if (!(fropt->state & State_KeyboardFocusChange) && !styleHint(SH_UnderlineShortcut, option)) return; QRect r = option->rect; painter->save(); painter->setBackgroundMode(Qt::TransparentMode); if (alternateFocusStyle) { QColor bg_col = fropt->backgroundColor; if (!bg_col.isValid()) bg_col = painter->background().color(); // Create an "XOR" color. QColor patternCol((bg_col.red() ^ 0xff) & 0xff, (bg_col.green() ^ 0xff) & 0xff, (bg_col.blue() ^ 0xff) & 0xff); painter->setBrush(QBrush(patternCol, Qt::Dense4Pattern)); painter->setBrushOrigin(r.topLeft()); } else { painter->setPen(option->palette.highlight().color()); painter->setBrush(option->palette.highlight()); } painter->setPen(Qt::NoPen); painter->setBrushOrigin(r.topLeft()); painter->drawRect(r.left(), r.top(), r.width(), penSize); // Top painter->drawRect(r.left(), r.bottom(), r.width() + penSize - 1, penSize); // Bottom painter->drawRect(r.left(), r.top(), penSize, r.height()); // Left painter->drawRect(r.right(), r.top(), penSize, r.height()); // Right painter->restore(); } break; case PE_PanelButtonBevel: { QBrush fill; bool panel = element != PE_FrameButtonBevel; painter->setBrushOrigin(option->rect.topLeft()); if (!(option->state & State_Sunken) && (option->state & State_On)) fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern); else fill = option->palette.brush(QPalette::Button); if (option->state & (State_Raised | State_On | State_Sunken)) { if (d->doubleControls) qDrawPlainRect(painter, option->rect,option->palette.shadow().color(),2,&fill); else qDrawPlainRect(painter, option->rect,option->palette.shadow().color(),1,&fill); } else { if (panel) painter->fillRect(option->rect, fill); else painter->drawRect(option->rect); } break; } case PE_FrameGroupBox: if (const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(option)) { const QStyleOptionFrameV2 *frame2 = qstyleoption_cast<const QStyleOptionFrameV2 *>(option); if (frame2 && !(frame2->features & QStyleOptionFrameV2::Flat)) { QPen oldPen = painter->pen(); QRect r = frame->rect; painter->setPen(frame->palette.shadow().color()); painter->fillRect(r.x(), r.y(), r.x() + r.width()-1, r.y() + r.height() - windowsMobileFrameGroupBoxOffset, frame->palette.light()); painter ->drawLine(r.topLeft() + QPoint(-2, 1), r.topRight()+ QPoint(0, 1)); if (d->doubleControls) painter ->drawLine(r.topLeft() + QPoint(-2, 2), r.topRight()+ QPoint(0, 2)); painter->setPen(oldPen); } } break; case PE_IndicatorCheckBox: { QBrush fill; QRect r = d->doubleControls ? option->rect.adjusted(0,1,0,-1) : option->rect; if (option->state & State_NoChange) fill = QBrush(option->palette.shadow().color(), Qt::Dense4Pattern); else if (option->state & State_Sunken) fill = option->palette.button(); else if (option->state & State_Enabled) fill = option->palette.base(); else fill = option->palette.background(); painter->save(); doRestore = true; if (d->doubleControls && (option->state & State_NoChange)) painter->fillRect(r, fill); else painter->fillRect(option->rect, fill); painter->setPen(option->palette.shadow().color()); painter->drawLine(r.topLeft(), r.topRight()); painter->drawLine(r.topRight(), r.bottomRight()); painter->drawLine(r.bottomLeft(), r.bottomRight()); painter->drawLine(r.bottomLeft(), r.topLeft()); if (d->doubleControls) { QRect r0 = r.adjusted(1, 1, -1, -1); painter->drawLine(r0.topLeft(), r0.topRight()); painter->drawLine(r0.topRight(), r0.bottomRight()); painter->drawLine(r0.bottomLeft(), r0.bottomRight()); painter->drawLine(r0.bottomLeft(), r0.topLeft()); } if (option->state & State_HasFocus) { painter->setPen(option->palette.highlight().color()); QRect r2 = d->doubleControls ? r.adjusted(2, 2, -2, -2) : r.adjusted(1, 1, -1, -1); painter->drawLine(r2.topLeft(), r2.topRight()); painter->drawLine(r2.topRight(), r2.bottomRight()); painter->drawLine(r2.bottomLeft(), r2.bottomRight()); painter->drawLine(r2.bottomLeft(), r2.topLeft()); if (d->doubleControls) { QRect r3 = r2.adjusted(1, 1, -1, -1); painter->drawLine(r3.topLeft(), r3.topRight()); painter->drawLine(r3.topRight(), r3.bottomRight()); painter->drawLine(r3.bottomLeft(), r3.bottomRight()); painter->drawLine(r3.bottomLeft(), r3.topLeft()); } painter->setPen(option->palette.shadow().color()); } //fall through... } case PE_IndicatorViewItemCheck: case PE_Q3CheckListIndicator: { if (!doRestore) { painter->save(); doRestore = true; } if (element == PE_Q3CheckListIndicator || element == PE_IndicatorViewItemCheck) { painter->setPen(option->palette.shadow().color()); if (option->state & State_NoChange) painter->setBrush(option->palette.brush(QPalette::Button)); if (d->doubleControls) { QRect r = QRect(option->rect.x(), option->rect.y(), windowsMobileitemViewCheckBoxSize * 2, windowsMobileitemViewCheckBoxSize * 2); qDrawPlainRect(painter, r, option->palette.shadow().color(), 2); } else { QRect r = QRect(option->rect.x(), option->rect.y(), windowsMobileitemViewCheckBoxSize, windowsMobileitemViewCheckBoxSize); qDrawPlainRect(painter, r, option->palette.shadow().color(), 1); } if (option->state & State_Enabled) d->imageChecked.setColor(1, option->palette.shadow().color().rgba()); else d->imageChecked.setColor(1, option->palette.dark().color().rgba()); if (!(option->state & State_Off)) { if (d->doubleControls) painter->drawImage(option->rect.x(), option->rect.y(), d->imageChecked); else painter->drawImage(option->rect.x() + 3, option->rect.y() + 3, d->imageChecked); } } else { if (option->state & State_NoChange) d->imageCheckedBold.setColor(1, option->palette.dark().color().rgba()); else if (option->state & State_Enabled) d->imageCheckedBold.setColor(1, option->palette.shadow().color().rgba()); else d->imageCheckedBold.setColor(1, option->palette.dark().color().rgba()); if (!(option->state & State_Off)) { if (d->doubleControls) painter->drawImage(option->rect.x() + 2, option->rect.y(), d->imageCheckedBold); else painter->drawImage(option->rect.x() + 3, option->rect.y() + 3, d->imageCheckedBold); } } if (doRestore) painter->restore(); break; } case PE_IndicatorRadioButton: { painter->save(); if (option->state & State_HasFocus) { d->imageRadioButtonHighlighted.setColor(1, option->palette.shadow().color().rgba()); d->imageRadioButtonHighlighted.setColor(2, option->palette.highlight().color().rgba()); painter->drawImage(option->rect.x(), option->rect.y(), d->imageRadioButtonHighlighted); } else { d->imageRadioButton.setColor(1, option->palette.shadow().color().rgba()); painter->drawImage(option->rect.x(), option->rect.y(), d->imageRadioButton); } if (option->state & (State_Sunken | State_On)) { if (option->state & State_Enabled) d->imageRadioButtonChecked.setColor(1, option->palette.shadow().color().rgba()); else d->imageRadioButtonChecked.setColor(1, option->palette.dark().color().rgba()); static const int offset = d->doubleControls ? 6 : 3; painter->drawImage(option->rect.x() + offset, option->rect.y() + offset, d->imageRadioButtonChecked); } painter->restore(); break; } case PE_PanelButtonCommand: if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) { QBrush fill; State flags = option->state; QPalette pal = option->palette; QRect r = option->rect; if ((flags & State_Sunken || flags & State_On) ) fill = pal.brush(QPalette::Shadow); else fill = pal.brush(QPalette::Button); int singleLine = 1; int doubleLine = 2; if (d->doubleControls) { singleLine = 2; doubleLine = 4; } if (button->features & QStyleOptionButton::DefaultButton && flags & State_Sunken) { if (d->doubleControls) { qDrawPlainRect(painter, r, pal.shadow().color(), 1, &fill); qDrawPlainRect(painter, r.adjusted(1, 1, -1, 1), pal.shadow().color(), 1, &fill); } else { qDrawPlainRect(painter, r, pal.shadow().color(), 1, &fill); } } else if (flags & (State_Raised | State_Sunken | State_On | State_Sunken)) { qDrawPlainRect(painter, r, pal.shadow().color(), singleLine, &fill); } else { painter->fillRect(r, fill); } } break; case PE_FrameDefaultButton: { painter->save(); painter->setPen(option->palette.shadow().color()); QRect rect = option->rect; if (d->doubleControls) { rect.adjust(1, 1, -2, -2); painter->drawRect(rect); painter->drawRect(rect.adjusted(1, 1, -1, -1)); } else { rect.adjust(2, 2, -3, -3); painter->drawRect(rect); } painter->restore(); break; } case PE_IndicatorSpinPlus: case PE_IndicatorSpinMinus: { QRect r = option->rect; int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, option, widget)+2; QRect br = r.adjusted(fw, fw, -fw, -fw); int offset = (option->state & State_Sunken) ? 1 : 0; int step = (br.width() + 4) / 5; painter->fillRect(br.x() + offset, br.y() + offset +br.height() / 2 - step / 2, br.width(), step, option->palette.buttonText()); if (element == PE_IndicatorSpinPlus) painter->fillRect(br.x() + br.width() / 2 - step / 2 + offset, br.y() + offset+4, step, br.height() - 7, option->palette.buttonText()); break; } case PE_IndicatorSpinUp: case PE_IndicatorSpinDown: { painter->save(); QPoint points[7]; switch (element) { case PE_IndicatorSpinUp: points[0] = QPoint(-2, -4); points[1] = QPoint(-2, 2); points[2] = QPoint(-1, -3); points[3] = QPoint(-1, 1); points[4] = QPoint(0, -2); points[5] = QPoint(0, 0); points[6] = QPoint(1, -1); break; case PE_IndicatorSpinDown: points[0] = QPoint(0, -4); points[1] = QPoint(0, 2); points[2] = QPoint(-1, -3); points[3] = QPoint(-1, 1); points[4] = QPoint(-2, -2); points[5] = QPoint(-2, 0); points[6] = QPoint(-3, -1); break; default: break; } if (option->state & State_Sunken) painter->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal), proxy()->pixelMetric(PM_ButtonShiftVertical)); if (option->state & State_Enabled) { painter->translate(option->rect.x() + option->rect.width() / 2, option->rect.y() + option->rect.height() / 2); painter->setPen(option->palette.buttonText().color()); painter->drawLine(points[0], points[1]); painter->drawLine(points[2], points[3]); painter->drawLine(points[4], points[5]); painter->drawPoint(points[6]); } else { painter->translate(option->rect.x() + option->rect.width() / 2 + 1, option->rect.y() + option->rect.height() / 2 + 1); painter->setPen(option->palette.light().color()); painter->drawLine(points[0], points[1]); painter->drawLine(points[2], points[3]); painter->drawLine(points[4], points[5]); painter->drawPoint(points[6]); painter->translate(-1, -1); painter->setPen(option->palette.mid().color()); painter->drawLine(points[0], points[1]); painter->drawLine(points[2], points[3]); painter->drawLine(points[4], points[5]); painter->drawPoint(points[6]); } painter->restore(); break; } case PE_IndicatorArrowUpBig: case PE_IndicatorArrowDownBig: case PE_IndicatorArrowLeftBig: case PE_IndicatorArrowRightBig: case PE_IndicatorArrowUp: case PE_IndicatorArrowDown: case PE_IndicatorArrowRight: case PE_IndicatorArrowLeft: { painter->save(); if (d->doubleControls) { QColor color; if (option->state & State_Sunken) color = option->palette.light().color(); else color = option->palette.buttonText().color(); QImage image; int xoffset, yoffset; bool isTabBarArrow = widget && widget->parent() && widget->inherits("QToolButton") && widget->parent()->inherits("QTabBar"); switch (element) { case PE_IndicatorArrowUp: image = d->imageArrowUp; xoffset = 1; yoffset = 12; break; case PE_IndicatorArrowDown: image = d->imageArrowDown; xoffset = 1; yoffset =12; break; case PE_IndicatorArrowLeft: image = d->imageArrowLeft; xoffset = 8; yoffset = isTabBarArrow ? 12 : 2; break; case PE_IndicatorArrowRight: image = d->imageArrowRight; xoffset = 8; yoffset = isTabBarArrow ? 12 : 2; break; case PE_IndicatorArrowUpBig: image = d->imageArrowUpBig; xoffset = 3; yoffset = 12; break; case PE_IndicatorArrowDownBig: image = d->imageArrowDownBig; xoffset = 2; yoffset =12; break; case PE_IndicatorArrowLeftBig: image = d->imageArrowLeftBig; xoffset = 8; yoffset = 2; break; case PE_IndicatorArrowRightBig: image = d->imageArrowRightBig; xoffset = 8; yoffset = 2; break; default: break; } image.setColor(1, color.rgba()); painter->drawImage(option->rect.x() + xoffset, option->rect.y() + yoffset, image); } else { QPoint points[7]; switch (element) { case PE_IndicatorArrowUp: case PE_IndicatorArrowUpBig: points[0] = QPoint(-3, 1); points[1] = QPoint(3, 1); points[2] = QPoint(-2, 0); points[3] = QPoint(2, 0); points[4] = QPoint(-1, -1); points[5] = QPoint(1, -1); points[6] = QPoint(0, -2); break; case PE_IndicatorArrowDown: case PE_IndicatorArrowDownBig: points[0] = QPoint(-3, -1); points[1] = QPoint(3, -1); points[2] = QPoint(-2, 0); points[3] = QPoint(2, 0); points[4] = QPoint(-1, 1); points[5] = QPoint(1, 1); points[6] = QPoint(0, 2); break; case PE_IndicatorArrowRight: case PE_IndicatorArrowRightBig: points[0] = QPoint(-2, -3); points[1] = QPoint(-2, 3); points[2] = QPoint(-1, -2); points[3] = QPoint(-1, 2); points[4] = QPoint(0, -1); points[5] = QPoint(0, 1); points[6] = QPoint(1, 0); break; case PE_IndicatorArrowLeft: case PE_IndicatorArrowLeftBig: points[0] = QPoint(0, -3); points[1] = QPoint(0, 3); points[2] = QPoint(-1, -2); points[3] = QPoint(-1, 2); points[4] = QPoint(-2, -1); points[5] = QPoint(-2, 1); points[6] = QPoint(-3, 0); break; default: break; } if (option->state & State_Sunken) painter->setPen(option->palette.light().color()); else painter->setPen(option->palette.buttonText().color()); if (option->state & State_Enabled) { painter->translate(option->rect.x() + option->rect.width() / 2, option->rect.y() + option->rect.height() / 2 - 1); painter->drawLine(points[0], points[1]); painter->drawLine(points[2], points[3]); painter->drawLine(points[4], points[5]); painter->drawPoint(points[6]); } else { painter->translate(option->rect.x() + option->rect.width() / 2, option->rect.y() + option->rect.height() / 2 - 1); painter->setPen(option->palette.mid().color()); painter->drawLine(points[0], points[1]); painter->drawLine(points[2], points[3]); painter->drawLine(points[4], points[5]); painter->drawPoint(points[6]); } } painter->restore(); break; } #ifndef QT_NO_TABWIDGET case PE_FrameTabWidget: if (const QStyleOptionTabWidgetFrame *tab = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(option)) { QRect rect = option->rect; QPalette pal = option->palette; painter->save(); QBrush fill = pal.light(); painter->fillRect(rect, fill); painter->setPen(pal.shadow().color()); if (d->doubleControls) { QPen pen = painter->pen(); pen.setWidth(2); pen.setCapStyle(Qt::FlatCap); painter->setPen(pen); } switch (tab->shape) { case QTabBar::RoundedNorth: #ifdef Q_WS_WINCE_WM if (!d->wm65) #endif { if (d->doubleControls) painter->drawLine(rect.topLeft() + QPoint(0, 1), rect.topRight() + QPoint(0, 1)); else painter->drawLine(rect.topLeft(), rect.topRight()); } break; case QTabBar::RoundedSouth: #ifdef Q_WS_WINCE_WM if (!d->wm65) #endif { if (d->doubleControls) painter->drawLine(rect.bottomLeft(), rect.bottomRight()); else painter->drawLine(rect.bottomLeft(), rect.bottomRight()); } break; case QTabBar::RoundedEast: #ifdef Q_WS_WINCE_WM if (!d->wm65) #endif painter->drawLine(rect.topRight(), rect.bottomRight()); break; case QTabBar::RoundedWest: #ifdef Q_WS_WINCE_WM if (!d->wm65) #endif painter->drawLine(rect.topLeft(), rect.bottomLeft()); break; case QTabBar::TriangularWest: case QTabBar::TriangularEast: case QTabBar::TriangularSouth: case QTabBar::TriangularNorth: if (d->doubleControls) qDrawPlainRect(painter, rect.adjusted(0,-2,0,0), option->palette.shadow().color(),2,&pal.light()); else qDrawPlainRect(painter, rect, option->palette.shadow().color(),1,&pal.light()); break; default: break; } painter->restore(); } break; #endif //QT_NO_TABBAR #ifndef QT_NO_ITEMVIEWS case PE_PanelItemViewRow: if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) { QPalette::ColorGroup cg = vopt->state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled; if (cg == QPalette::Normal && !(vopt->state & QStyle::State_Active)) cg = QPalette::Inactive; if ((vopt->state & QStyle::State_Selected) && proxy()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, option, widget)) d->drawPanelItemViewSelected(painter, vopt); else if (vopt->features & QStyleOptionViewItemV2::Alternate) painter->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::AlternateBase)); else if (!(vopt->state & QStyle::State_Enabled)) painter->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::Base)); } break; case PE_PanelItemViewItem: if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) { QPalette::ColorGroup cg = vopt->state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled; if (cg == QPalette::Normal && !(vopt->state & QStyle::State_Active)) cg = QPalette::Inactive; if (vopt->showDecorationSelected && (vopt->state & QStyle::State_Selected)) { d->drawPanelItemViewSelected(painter, vopt); } else { if (vopt->backgroundBrush.style() != Qt::NoBrush) { QPointF oldBO = painter->brushOrigin(); painter->setBrushOrigin(vopt->rect.topLeft()); painter->fillRect(vopt->rect, vopt->backgroundBrush); painter->setBrushOrigin(oldBO); } if (vopt->state & QStyle::State_Selected) { QRect textRect = proxy()->subElementRect(QStyle::SE_ItemViewItemText, option, widget); d->drawPanelItemViewSelected(painter, vopt, textRect); } } } break; #endif //QT_NO_ITEMVIEWS case PE_FrameWindow: { QPalette popupPal = option->palette; popupPal.setColor(QPalette::Light, option->palette.background().color()); popupPal.setColor(QPalette::Midlight, option->palette.light().color()); if (d->doubleControls) qDrawPlainRect(painter, option->rect, popupPal.shadow().color(),2,0); else qDrawPlainRect(painter, option->rect, popupPal.shadow().color(),1,0); break; } case PE_FrameTabBarBase: { break; } case PE_Widget: break; case PE_IndicatorMenuCheckMark: { int markW = option->rect.width() > 7 ? 7 : option->rect.width(); int markH = markW; if (d->doubleControls) markW*=2; markH*=2; int posX = option->rect.x() + (option->rect.width() - markW)/2 + 1; int posY = option->rect.y() + (option->rect.height() - markH)/2; QVector<QLineF> a; a.reserve(markH); int i, xx, yy; xx = posX; yy = 3 + posY; for (i = 0; i < markW/2; ++i) { a << QLineF(xx, yy, xx, yy + 2); ++xx; ++yy; } yy -= 2; for (; i < markH; ++i) { a << QLineF(xx, yy, xx, yy + 2); ++xx; --yy; } if (!(option->state & State_Enabled) && !(option->state & State_On)) { int pnt; painter->setPen(option->palette.highlightedText().color()); QPoint offset(1, 1); for (pnt = 0; pnt < a.size(); ++pnt) a[pnt].translate(offset.x(), offset.y()); painter->drawLines(a); for (pnt = 0; pnt < a.size(); ++pnt) a[pnt].translate(offset.x(), offset.y()); } painter->setPen(option->palette.text().color()); painter->drawLines(a); break; } case PE_IndicatorBranch: { // Copied from the Windows style. static const int decoration_size = d->doubleControls ? 18 : 9; static const int ofsA = d->doubleControls ? 4 : 2; static const int ofsB = d->doubleControls ? 8 : 4; static const int ofsC = d->doubleControls ? 12 : 6; static const int ofsD = d->doubleControls ? 1 : 0; int mid_h = option->rect.x() + option->rect.width() / 2; int mid_v = option->rect.y() + option->rect.height() / 2; int bef_h = mid_h; int bef_v = mid_v; int aft_h = mid_h; int aft_v = mid_v; if (option->state & State_Children) { int delta = decoration_size / 2; bef_h -= delta; bef_v -= delta; aft_h += delta; aft_v += delta; QPen oldPen = painter->pen(); QPen crossPen = oldPen; crossPen.setWidth(2); painter->setPen(crossPen); painter->drawLine(bef_h + ofsA + ofsD, bef_v + ofsB + ofsD, bef_h + ofsC + ofsD, bef_v + ofsB + ofsD); if (!(option->state & State_Open)) painter->drawLine(bef_h + ofsB + ofsD, bef_v + ofsA + ofsD, bef_h + ofsB + ofsD, bef_v + ofsC + ofsD); painter->setPen(option->palette.dark().color()); painter->drawRect(bef_h, bef_v, decoration_size - 1, decoration_size - 1); if (d->doubleControls) painter->drawRect(bef_h + 1, bef_v + 1, decoration_size - 3, decoration_size - 3); painter->setPen(oldPen); } QBrush brush(option->palette.dark().color(), Qt::Dense4Pattern); if (option->state & State_Item) { if (option->direction == Qt::RightToLeft) painter->fillRect(option->rect.left(), mid_v, bef_h - option->rect.left(), 1, brush); else painter->fillRect(aft_h, mid_v, option->rect.right() - aft_h + 1, 1, brush); } if (option->state & State_Sibling) painter->fillRect(mid_h, aft_v, 1, option->rect.bottom() - aft_v + 1, brush); if (option->state & (State_Open | State_Children | State_Item | State_Sibling)) painter->fillRect(mid_h, option->rect.y(), 1, bef_v - option->rect.y(), brush); break; } case PE_Frame: qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), d->doubleControls ? 2 : 1, &option->palette.background()); break; case PE_FrameLineEdit: case PE_FrameMenu: if (d->doubleControls) qDrawPlainRect(painter, option->rect, option->palette.shadow().color(),2); else qDrawPlainRect(painter, option->rect, option->palette.shadow().color(),1); break; case PE_FrameStatusBar: if (d->doubleControls) qDrawPlainRect(painter, option->rect, option->palette.shadow().color(),2,0); else qDrawPlainRect(painter, option->rect, option->palette.shadow().color(),1,0); break; default: QWindowsStyle::drawPrimitive(element, option, painter, widget); break; } } void QWindowsMobileStyle::drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const { QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func()); painter->setClipping(false); switch (element) { case CE_MenuBarEmptyArea: painter->setClipping(true); QWindowsStyle::drawControl(element, option, painter, widget); break; case CE_PushButtonBevel: if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) { QRect br = button->rect; int dbi = proxy()->pixelMetric(PM_ButtonDefaultIndicator, button, widget); if (button->features & QStyleOptionButton::AutoDefaultButton) br.setCoords(br.left() + dbi, br.top() + dbi, br.right() - dbi, br.bottom() - dbi); QStyleOptionButton tmpBtn = *button; tmpBtn.rect = br; proxy()->drawPrimitive(PE_PanelButtonCommand, &tmpBtn, painter, widget); if (button->features & QStyleOptionButton::HasMenu) { int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, button, widget); QRect ir = button->rect; QStyleOptionButton newButton = *button; if (d->doubleControls) newButton.rect = QRect(ir.right() - mbi, ir.height() - 30, mbi, ir.height() - 4); else newButton.rect = QRect(ir.right() - mbi, ir.height() - 20, mbi, ir.height() - 4); proxy()->drawPrimitive(PE_IndicatorArrowDown, &newButton, painter, widget); } if (button->features & QStyleOptionButton::DefaultButton) proxy()->drawPrimitive(PE_FrameDefaultButton, option, painter, widget); } break; case CE_RadioButton: case CE_CheckBox: if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) { bool isRadio = (element == CE_RadioButton); QStyleOptionButton subopt = *button; subopt.rect = proxy()->subElementRect(isRadio ? SE_RadioButtonIndicator : SE_CheckBoxIndicator, button, widget); proxy()->drawPrimitive(isRadio ? PE_IndicatorRadioButton : PE_IndicatorCheckBox, &subopt, painter, widget); subopt.rect = proxy()->subElementRect(isRadio ? SE_RadioButtonContents : SE_CheckBoxContents, button, widget); proxy()->drawControl(isRadio ? CE_RadioButtonLabel : CE_CheckBoxLabel, &subopt, painter, widget); if (button->state & State_HasFocus) { QStyleOptionFocusRect fropt; fropt.QStyleOption::operator=(*button); fropt.rect = proxy()->subElementRect(isRadio ? SE_RadioButtonFocusRect : SE_CheckBoxFocusRect, button, widget); proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); } } break; case CE_RadioButtonLabel: case CE_CheckBoxLabel: if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) { uint alignment = visualAlignment(button->direction, Qt::AlignLeft | Qt::AlignVCenter); if (!styleHint(SH_UnderlineShortcut, button, widget)) alignment |= Qt::TextHideMnemonic; QPixmap pix; QRect textRect = button->rect; if (!button->icon.isNull()) { pix = button->icon.pixmap(button->iconSize, button->state & State_Enabled ? QIcon::Normal : QIcon::Disabled); proxy()->drawItemPixmap(painter, button->rect, alignment, pix); if (button->direction == Qt::RightToLeft) textRect.setRight(textRect.right() - button->iconSize.width() - 4); else textRect.setLeft(textRect.left() + button->iconSize.width() + 4); } if (!button->text.isEmpty()){ if (button->state & State_Enabled) proxy()->drawItemText(painter, textRect, alignment | Qt::TextShowMnemonic, button->palette, false, button->text, QPalette::WindowText); else proxy()->drawItemText(painter, textRect, alignment | Qt::TextShowMnemonic, button->palette, false, button->text, QPalette::Mid); } } break; #ifndef QT_NO_PROGRESSBAR case CE_ProgressBarGroove: if (d->doubleControls) qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), 2, &option->palette.brush(QPalette::Window)); else qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), 1, &option->palette.brush(QPalette::Window)); break; #endif //QT_NO_PROGRESSBAR #ifndef QT_NO_TABBAR case CE_TabBarTab: if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) { proxy()->drawControl(CE_TabBarTabShape, tab, painter, widget); proxy()->drawControl(CE_TabBarTabLabel, tab, painter, widget); } break; case CE_TabBarTabShape: if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) { if (tab->shape == QTabBar::RoundedNorth || tab->shape == QTabBar::RoundedEast || tab->shape == QTabBar::RoundedSouth || tab->shape == QTabBar::RoundedWest) { d->drawTabBarTab(painter, tab); } else { QCommonStyle::drawControl(element, option, painter, widget); } break; } #endif // QT_NO_TABBAR #ifndef QT_NO_TOOLBAR case CE_ToolBar: if (const QStyleOptionToolBar *toolBar = qstyleoption_cast<const QStyleOptionToolBar *>(option)) { QRect rect = option->rect; painter->save(); painter->setPen(option->palette.dark().color()); painter->fillRect(rect,option->palette.button()); if (d->doubleControls) { QPen pen = painter->pen(); pen.setWidth(4); painter->setPen(pen); } if (toolBar->toolBarArea == Qt::TopToolBarArea) painter->drawLine(rect.bottomLeft(), rect.bottomRight()); else painter->drawLine(rect.topLeft(), rect.topRight()); painter->restore(); break; } #endif //QT_NO_TOOLBAR case CE_Header: if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) { QRegion clipRegion = painter->clipRegion(); painter->setClipRect(option->rect); proxy()->drawControl(CE_HeaderSection, header, painter, widget); QStyleOptionHeader subopt = *header; subopt.rect = proxy()->subElementRect(SE_HeaderLabel, header, widget); if (header->state & State_Sunken) subopt.palette.setColor(QPalette::ButtonText, header->palette.brightText().color()); subopt.state |= QStyle::State_On; if (subopt.rect.isValid()) proxy()->drawControl(CE_HeaderLabel, &subopt, painter, widget); if (header->sortIndicator != QStyleOptionHeader::None) { subopt.rect = proxy()->subElementRect(SE_HeaderArrow, option, widget); proxy()->drawPrimitive(PE_IndicatorHeaderArrow, &subopt, painter, widget); } painter->setClipRegion(clipRegion); } break; case CE_HeaderSection: if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) { QBrush fill; QColor color; QRect rect = option->rect; painter->setPen(option->palette.shadow().color()); int penSize = 1; if (d->doubleControls) { penSize = 2; QPen pen = painter->pen(); pen.setWidth(2); pen.setCapStyle(Qt::FlatCap); painter->setPen(pen); } //fix Frame if (header->position == QStyleOptionHeader::End || (header->position == QStyleOptionHeader::OnlyOneSection && !header->text.isEmpty())) if (Qt::Horizontal == header->orientation ) rect.adjust(0, 0, penSize, 0); else rect.adjust(0, 0, 0, penSize); if (option->state & State_Sunken) { fill = option->palette.brush(QPalette::Shadow); color = option->palette.light().color(); painter->drawLine(rect.bottomLeft(), rect.bottomRight()); painter->drawLine(rect.topRight(), rect.bottomRight()); rect.adjust(0, 0, -penSize, -penSize); } else { fill = option->palette.brush(QPalette::Button); color = option->palette.shadow().color(); if (Qt::Horizontal == header->orientation ) rect.adjust(-penSize, 0, 0, 0); else rect.adjust(0, -penSize, 0, 0); } if (Qt::Horizontal == header->orientation ) rect.adjust(0,-penSize,0,0); else rect.adjust(-penSize, 0, 0, 0); if (option->state & State_Sunken) { qDrawPlainRect(painter, rect, color, penSize, &fill); } else { //Corner rect.adjust(-penSize, 0, 0, 0); qDrawPlainRect(painter, rect, color, penSize, &fill); } //Hack to get rid of some double lines... StyleOptions need a clean flag for that rect = option->rect; #ifndef QT_NO_SCROLLAREA if (const QAbstractScrollArea *abstractScrollArea = qobject_cast<const QAbstractScrollArea *> (widget) ) { QRect rectScrollArea = abstractScrollArea->geometry(); if (Qt::Horizontal == header->orientation ) if ((rectScrollArea.right() - rect.right() ) > 1) painter->drawLine(rect.topRight(), rect.bottomRight()); else ; else if ((rectScrollArea.bottom() - rect.bottom() ) > 1) painter->drawLine(rect.bottomLeft(), rect.bottomRight()); } #endif // QT_NO_SCROLLAREA break; } #ifndef QT_NO_COMBOBOX case CE_ComboBoxLabel: // This is copied from qcommonstyle.cpp with the difference, that // the editRect isn't adjusted when calling drawItemText. if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { QRect editRect = proxy()->subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, widget); painter->save(); painter->setClipRect(editRect); if (!cb->currentIcon.isNull()) { QIcon::Mode mode = cb->state & State_Enabled ? QIcon::Normal : QIcon::Disabled; QPixmap pixmap = cb->currentIcon.pixmap(cb->iconSize, mode); QRect iconRect(editRect); iconRect.setWidth(cb->iconSize.width() + 4); iconRect = alignedRect(cb->direction, Qt::AlignLeft | Qt::AlignVCenter, iconRect.size(), editRect); if (cb->editable) painter->fillRect(iconRect, option->palette.brush(QPalette::Base)); proxy()->drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap); if (cb->direction == Qt::RightToLeft) editRect.translate(-4 - cb->iconSize.width(), 0); else editRect.translate(cb->iconSize.width() + 4, 0); } if (!cb->currentText.isEmpty() && !cb->editable) { proxy()->drawItemText(painter, editRect, visualAlignment(cb->direction, Qt::AlignLeft | Qt::AlignVCenter), cb->palette, cb->state & State_Enabled, cb->currentText); } painter->restore(); } break; #endif // QT_NO_COMBOBOX #ifndef QT_NO_DOCKWIDGET case CE_DockWidgetTitle: if (const QStyleOptionDockWidget *dwOpt = qstyleoption_cast<const QStyleOptionDockWidget *>(option)) { const QStyleOptionDockWidgetV2 *v2 = qstyleoption_cast<const QStyleOptionDockWidgetV2*>(option); bool verticalTitleBar = v2 == 0 ? false : v2->verticalTitleBar; QRect rect = dwOpt->rect; QRect r = rect; if (verticalTitleBar) { QSize s = r.size(); s.transpose(); r.setSize(s); painter->save(); painter->translate(r.left(), r.top() + r.width()); painter->rotate(-90); painter->translate(-r.left(), -r.top()); } bool floating = false; bool active = dwOpt->state & State_Active; int menuOffset = 0; //used to center text when floated QColor inactiveCaptionTextColor = option->palette.highlightedText().color(); if (dwOpt->movable) { QColor left, right; //Titlebar gradient if (widget && widget->isWindow()) { floating = true; if (active) { right = option->palette.highlight().color(); left = right.lighter(125); } else { left = option->palette.highlight().color().lighter(125); right = QColor(0xff, 0xff, 0xff); } menuOffset = 2; QBrush fillBrush(left); if (left != right) { QPoint p1(r.x(), r.top() + r.height()/2); QPoint p2(rect.right(), r.top() + r.height()/2); QLinearGradient lg(p1, p2); lg.setColorAt(0, left); lg.setColorAt(1, right); fillBrush = lg; } painter->fillRect(r.adjusted(0, 0, 0, -3), fillBrush); } else { painter->fillRect(r.adjusted(0, 0, 0, -3), option->palette.button().color()); } painter->setPen(dwOpt->palette.color(QPalette::Light)); if (!widget || !widget->isWindow()) { painter->drawLine(r.topLeft(), r.topRight()); painter->setPen(dwOpt->palette.color(QPalette::Dark)); painter->drawLine(r.bottomLeft(), r.bottomRight()); } } if (!dwOpt->title.isEmpty()) { QFont oldFont = painter->font(); QFont newFont = oldFont; if (newFont.pointSize() > 2) newFont.setPointSize(newFont.pointSize() - 2); if (floating) newFont.setBold(true); painter->setFont(newFont); QPalette palette = dwOpt->palette; palette.setColor(QPalette::Window, inactiveCaptionTextColor); QRect titleRect = proxy()->subElementRect(SE_DockWidgetTitleBarText, option, widget); if (verticalTitleBar) { titleRect = QRect(r.left() + rect.bottom() - titleRect.bottom(), r.top() + titleRect.left() - rect.left(), titleRect.height(), titleRect.width()); } proxy()->drawItemText(painter, titleRect, Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, palette, dwOpt->state & State_Enabled, dwOpt->title, floating ? (active ? QPalette::BrightText : QPalette::Window) : QPalette::WindowText); painter->setFont(oldFont); } if (verticalTitleBar) painter->restore(); } return; #endif // QT_NO_DOCKWIDGET case CE_PushButtonLabel: if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) { painter->save(); QRect ir = button->rect; QPalette::ColorRole colorRole; uint tf = Qt::AlignVCenter | Qt::TextShowMnemonic; if (!styleHint(SH_UnderlineShortcut, button, widget)) tf |= Qt::TextHideMnemonic; if (button->state & (State_On | State_Sunken)) colorRole = QPalette::Light; else colorRole = QPalette::ButtonText; if (!button->icon.isNull()) { QIcon::Mode mode = button->state & State_Enabled ? QIcon::Normal : QIcon::Disabled; if (mode == QIcon::Normal && button->state & State_HasFocus) mode = QIcon::Active; QIcon::State state = QIcon::Off; if (button->state & State_On) state = QIcon::On; QPixmap pixmap = button->icon.pixmap(button->iconSize, mode, state); int pixw = pixmap.width(); int pixh = pixmap.height(); //Center the icon if there is no text QPoint point; if (button->text.isEmpty()) { point = QPoint(ir.x() + ir.width() / 2 - pixw / 2, ir.y() + ir.height() / 2 - pixh / 2); } else { point = QPoint(ir.x() + 2, ir.y() + ir.height() / 2 - pixh / 2); } if (button->direction == Qt::RightToLeft) point.rx() += pixw; if ((button->state & (State_On | State_Sunken)) && button->direction == Qt::RightToLeft) point.rx() -= proxy()->pixelMetric(PM_ButtonShiftHorizontal, option, widget) * 2; painter->drawPixmap(visualPos(button->direction, button->rect, point), pixmap); if (button->direction == Qt::RightToLeft) ir.translate(-4, 0); else ir.translate(pixw + 4, 0); ir.setWidth(ir.width() - (pixw + 4)); // left-align text if there is if (!button->text.isEmpty()) tf |= Qt::AlignLeft; } else { tf |= Qt::AlignHCenter; } if (button->state & State_Enabled) proxy()->drawItemText(painter, ir, tf, button->palette, true, button->text, colorRole); else proxy()->drawItemText(painter, ir, tf, button->palette, true, button->text, QPalette::Mid); painter->restore(); } break; default: QWindowsStyle::drawControl(element, option, painter, widget); break; } } void QWindowsMobileStyle::drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const { painter->setClipping(false); QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func()); switch (control) { #ifndef QT_NO_SLIDER case CC_Slider: if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) { int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget); int len = proxy()->pixelMetric(PM_SliderLength, slider, widget); int ticks = slider->tickPosition; QRect groove = proxy()->subControlRect(CC_Slider, slider, SC_SliderGroove, widget); QRect handle = proxy()->subControlRect(CC_Slider, slider, SC_SliderHandle, widget); if ((slider->subControls & SC_SliderGroove) && groove.isValid()) { int mid = thickness / 2; if (ticks & QSlider::TicksAbove) mid += len / 8; if (ticks & QSlider::TicksBelow) mid -= len / 8; painter->setPen(slider->palette.shadow().color()); if (slider->orientation == Qt::Horizontal) { qDrawPlainRect(painter, groove.x(), groove.y() + mid - 2, groove.width(), 4, option->palette.shadow().color(),1,0); } else { qDrawPlainRect(painter, groove.x()+mid-2, groove.y(), 4, groove.height(), option->palette.shadow().color(),1,0); } } if (slider->subControls & SC_SliderTickmarks) { QStyleOptionSlider tmpSlider = *slider; tmpSlider.subControls = SC_SliderTickmarks; QCommonStyle::drawComplexControl(control, &tmpSlider, painter, widget); } if (slider->subControls & SC_SliderHandle) { const QColor c0 = slider->palette.shadow().color(); const QColor c1 = slider->palette.dark().color(); const QColor c3 = slider->palette.midlight().color(); const QColor c4 = slider->palette.dark().color(); QBrush handleBrush; if (slider->state & State_Enabled) { handleBrush = slider->palette.color(QPalette::Light); } else { handleBrush = QBrush(slider->palette.color(QPalette::Shadow), Qt::Dense4Pattern); } int x = handle.x(), y = handle.y(), wi = handle.width(), he = handle.height(); int x1 = x; int x2 = x+wi-1; int y1 = y; int y2 = y+he-1; Qt::Orientation orient = slider->orientation; bool tickAbove = slider->tickPosition == QSlider::TicksAbove; bool tickBelow = slider->tickPosition == QSlider::TicksBelow; if (slider->state & State_HasFocus) { QStyleOptionFocusRect fropt; fropt.QStyleOption::operator=(*slider); fropt.rect = proxy()->subElementRect(SE_SliderFocusRect, slider, widget); proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); } if ((tickAbove && tickBelow) || (!tickAbove && !tickBelow)) { Qt::BGMode oldMode = painter->backgroundMode(); painter->setBackgroundMode(Qt::OpaqueMode); qDrawPlainRect(painter, QRect(x, y, wi, he) ,slider->palette.shadow().color(),1,&handleBrush); painter->setBackgroundMode(oldMode); QBrush fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern); if (slider->state & State_Sunken) painter->fillRect(QRectF(x1 + 2, y1 + 2, x2 - x1 - 3, y2 - y1 - 3),fill); return; } QSliderDirection dir; if (orient == Qt::Horizontal) if (tickAbove) dir = SliderUp; else dir = SliderDown; else if (tickAbove) dir = SliderLeft; else dir = SliderRight; QPolygon polygon; int d = 0; switch (dir) { case SliderUp: x2++; y1 = y1 + wi / 2; d = (wi + 1) / 2 - 1; polygon.setPoints(5, x1, y1, x1, y2, x2, y2, x2, y1, x1 + d,y1 - d); break; case SliderDown: x2++; y2 = y2 - wi/2; d = (wi + 1) / 2 - 1; polygon.setPoints(5, x1, y1, x1, y2, x1 + d,y2 + d, x2, y2, x2, y1); break; case SliderLeft: d = (he + 1) / 2 - 1; x1 = x1 + he/2; polygon.setPoints(5, x1, y1, x1 - d, y1 + d, x1,y2, x2, y2, x2, y1); y1--; break; case SliderRight: d = (he + 1) / 2 - 1; x2 = x2 - he/2; polygon.setPoints(5, x1, y1, x1, y2, x2,y2, x2 + d, y1 + d, x2, y1); y1--; break; } QBrush oldBrush = painter->brush(); painter->setPen(Qt::NoPen); painter->setBrush(handleBrush); Qt::BGMode oldMode = painter->backgroundMode(); painter->setBackgroundMode(Qt::OpaqueMode); painter->drawRect(x1, y1, x2-x1+1, y2-y1+1); painter->drawPolygon(polygon); QBrush fill = QBrush(option->palette.button().color(), Qt::Dense4Pattern); painter->setBrush(oldBrush); painter->setBackgroundMode(oldMode); if (slider->state & State_Sunken) painter->fillRect(QRectF(x1, y1, x2 - x1 + 1, y2 - y1 + 1),fill); if (dir != SliderUp) { painter->setPen(c0); painter->drawLine(x1, y1, x2, y1); } if (dir != SliderLeft) { painter->setPen(c0); painter->drawLine(x1, y1, x1, y2); } if (dir != SliderRight) { painter->setPen(c0); painter->drawLine(x2, y1, x2, y2); } if (dir != SliderDown) { painter->setPen(c0); painter->drawLine(x1, y2, x2, y2); } switch (dir) { case SliderUp: if (slider->state & State_Sunken) painter->fillRect(QRectF(x1 + 3, y1 - d + 2, x2 - x1 - 4, y1),fill); painter->setPen(c0); painter->drawLine(x1, y1, x1 + d, y1 - d); d = wi - d - 1; painter->drawLine(x2, y1, x2 -d , y1 -d ); d--; break; case SliderDown: if (slider->state & State_Sunken) painter->fillRect(QRectF(x1+3, y2 - d, x2 - x1 -4,y2 - 8),fill); painter->setPen(c0); painter->drawLine(x1, y2, x1 + d, y2 + d); d = wi - d - 1; painter->drawLine(x2, y2, x2 - d, y2 + d); d--; break; case SliderLeft: if (slider->state & State_Sunken) painter->fillRect(QRectF(x1 - d + 2, y1 + 2, x1, y2 - y1 - 3),fill); painter->setPen(c0); painter->drawLine(x1, y1, x1 - d, y1 + d); d = he - d - 1; painter->drawLine(x1, y2, x1 - d, y2 - d); d--; break; case SliderRight: if (slider->state & State_Sunken) painter->fillRect(QRectF(x2 - d - 4, y1 + 2, x2 - 4, y2 - y1 - 3),fill); painter->setPen(c0); painter->drawLine(x2, y1, x2 + d, y1 + d); painter->setPen(c0); d = he - d - 1; painter->drawLine(x2, y2, x2 + d, y2 - d); d--; break; } } } break; #endif //QT_NO_SLIDER #ifndef QT_NO_SCROLLBAR case CC_ScrollBar: painter->save(); painter->setPen(option->palette.shadow().color()); if (d->doubleControls) { QPen pen = painter->pen(); pen.setWidth(2); pen.setCapStyle(Qt::SquareCap); painter->setPen(pen); } if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(option)) { d->drawScrollbarGroove(painter, scrollbar); // Make a copy here and reset it for each primitive. QStyleOptionSlider newScrollbar = *scrollbar; State saveFlags = scrollbar->state; //Check if the scrollbar is part of an abstractItemView and draw the frame according bool drawCompleteFrame = true; bool secondScrollBar = false; if (widget) if (QWidget *parent = widget->parentWidget()) { if (QAbstractScrollArea *abstractScrollArea = qobject_cast<QAbstractScrollArea *>(parent->parentWidget())) { drawCompleteFrame = (abstractScrollArea->frameStyle() == QFrame::NoFrame) || (abstractScrollArea->frameStyle() == QFrame::StyledPanel); secondScrollBar = (abstractScrollArea->horizontalScrollBar()->isVisible() && abstractScrollArea->verticalScrollBar()->isVisible()) ; } #ifndef QT_NO_LISTVIEW if (QListView *listView = qobject_cast<QListView *>(parent->parentWidget())) drawCompleteFrame = false; #endif } if (scrollbar->minimum == scrollbar->maximum) saveFlags |= State_Enabled; if (scrollbar->subControls & SC_ScrollBarSubLine) { newScrollbar.state = saveFlags; newScrollbar.rect = proxy()->subControlRect(control, &newScrollbar, SC_ScrollBarSubLine, widget); if (newScrollbar.rect.isValid()) { if (!(scrollbar->activeSubControls & SC_ScrollBarSubLine)) newScrollbar.state &= ~(State_Sunken | State_MouseOver); d->drawScrollbarHandleUp(painter, &newScrollbar, drawCompleteFrame, secondScrollBar); } } if (scrollbar->subControls & SC_ScrollBarAddLine) { newScrollbar.rect = scrollbar->rect; newScrollbar.state = saveFlags; newScrollbar.rect = proxy()->subControlRect(control, &newScrollbar, SC_ScrollBarAddLine, widget); if (newScrollbar.rect.isValid()) { if (!(scrollbar->activeSubControls & SC_ScrollBarAddLine)) newScrollbar.state &= ~(State_Sunken | State_MouseOver); d->drawScrollbarHandleDown(painter, &newScrollbar, drawCompleteFrame, secondScrollBar); } } if (scrollbar->subControls & SC_ScrollBarSlider) { newScrollbar.rect = scrollbar->rect; newScrollbar.state = saveFlags; newScrollbar.rect = proxy()->subControlRect(control, &newScrollbar, SC_ScrollBarSlider, widget); if (newScrollbar.rect.isValid()) { if (!(scrollbar->activeSubControls & SC_ScrollBarSlider)) newScrollbar.state &= ~(State_Sunken | State_MouseOver); d->drawScrollbarGrip(painter, &newScrollbar, option, drawCompleteFrame); } } } painter->restore(); break; #endif // QT_NO_SCROLLBAR case CC_ToolButton: if (const QStyleOptionToolButton *toolbutton = qstyleoption_cast<const QStyleOptionToolButton *>(option)) { QRect button, menuarea; bool isTabWidget = false; #ifndef QT_NO_TABWIDGET if (widget) if (QWidget *parent = widget->parentWidget()) isTabWidget = (qobject_cast<QTabWidget *>(parent->parentWidget())); #endif //QT_NO_TABWIDGET button = proxy()->subControlRect(control, toolbutton, SC_ToolButton, widget); menuarea = proxy()->subControlRect(control, toolbutton, SC_ToolButtonMenu, widget); State buttonFlags = toolbutton->state; if (buttonFlags & State_AutoRaise) { if (!(buttonFlags & State_MouseOver)) { buttonFlags &= ~State_Raised; } } State menuFlags = buttonFlags; if (toolbutton->activeSubControls & SC_ToolButton) buttonFlags |= State_Sunken; if (toolbutton->activeSubControls & SC_ToolButtonMenu) menuFlags |= State_On; QStyleOption tool(0); tool.palette = toolbutton->palette; if (toolbutton->subControls & SC_ToolButton) { tool.rect = button; tool.state = buttonFlags; proxy()->drawPrimitive(PE_PanelButtonTool, &tool, painter, widget); } if (toolbutton->subControls & SC_ToolButtonMenu) { tool.rect = menuarea; tool.state = buttonFlags & State_Enabled; QStyleOption toolMenu(0); toolMenu = *toolbutton; toolMenu.state = menuFlags; if (buttonFlags & State_Sunken) proxy()->drawPrimitive(PE_PanelButtonTool, &toolMenu, painter, widget); QStyleOption arrowOpt(0); arrowOpt.rect = tool.rect; arrowOpt.palette = tool.palette; State flags = State_None; if (menuFlags & State_Enabled) flags |= State_Enabled; if ((menuFlags & State_On) && !(buttonFlags & State_Sunken)) { flags |= State_Sunken; painter->fillRect(menuarea, option->palette.shadow()); } arrowOpt.state = flags; proxy()->drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, painter, widget); } if (toolbutton->state & State_HasFocus) { QStyleOptionFocusRect focusRect; focusRect.QStyleOption::operator=(*toolbutton); focusRect.rect.adjust(3, 3, -3, -3); if (toolbutton->features & QStyleOptionToolButton::Menu) focusRect.rect.adjust(0, 0, -proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator, toolbutton, widget), 0); proxy()->drawPrimitive(PE_FrameFocusRect, &focusRect, painter, widget); } QStyleOptionToolButton label = *toolbutton; if (isTabWidget) label.state = toolbutton->state; else label.state = toolbutton->state & State_Enabled; int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, option, widget); label.rect = button.adjusted(fw, fw, -fw, -fw); proxy()->drawControl(CE_ToolButtonLabel, &label, painter, widget); } break; #ifndef QT_NO_GROUPBOX case CC_GroupBox: if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) { // Draw frame painter->save(); QFont font = painter->font(); font.setBold(true); painter->setFont(font); QStyleOptionGroupBox groupBoxFont = *groupBox; groupBoxFont.fontMetrics = QFontMetrics(font); QRect textRect = proxy()->subControlRect(CC_GroupBox, &groupBoxFont, SC_GroupBoxLabel, widget); QRect checkBoxRect = proxy()->subControlRect(CC_GroupBox, option, SC_GroupBoxCheckBox, widget).adjusted(0,0,0,0); if (groupBox->subControls & QStyle::SC_GroupBoxFrame) { QStyleOptionFrameV2 frame; frame.QStyleOption::operator=(*groupBox); frame.features = groupBox->features; frame.lineWidth = groupBox->lineWidth; frame.midLineWidth = groupBox->midLineWidth; frame.rect = proxy()->subControlRect(CC_GroupBox, option, SC_GroupBoxFrame, widget); painter->save(); QRegion region(groupBox->rect); if (!groupBox->text.isEmpty()) { bool ltr = groupBox->direction == Qt::LeftToRight; QRect finalRect = checkBoxRect.united(textRect); if (groupBox->subControls & QStyle::SC_GroupBoxCheckBox) finalRect.adjust(ltr ? -4 : 0, 0, ltr ? 0 : 4, 0); region -= finalRect; } proxy()->drawPrimitive(PE_FrameGroupBox, &frame, painter, widget); painter->restore(); } // Draw checkbox if (groupBox->subControls & SC_GroupBoxCheckBox) { QStyleOptionButton box; box.QStyleOption::operator=(*groupBox); box.rect = checkBoxRect; proxy()->drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget); } // Draw title if ((groupBox->subControls & QStyle::SC_GroupBoxLabel) && !groupBox->text.isEmpty()) { QColor textColor = groupBox->textColor; if (textColor.isValid()) painter->setPen(textColor); else painter->setPen(groupBox->palette.link().color()); painter->setPen(groupBox->palette.link().color()); int alignment = int(groupBox->textAlignment); if (!styleHint(QStyle::SH_UnderlineShortcut, option, widget)) alignment |= Qt::TextHideMnemonic; if (groupBox->state & State_Enabled) proxy()->drawItemText(painter, textRect, Qt::TextShowMnemonic | Qt::AlignHCenter | alignment, groupBox->palette, true, groupBox->text, textColor.isValid() ? QPalette::NoRole : QPalette::Link); else proxy()->drawItemText(painter, textRect, Qt::TextShowMnemonic | Qt::AlignHCenter | alignment, groupBox->palette, true, groupBox->text, QPalette::Mid); if (groupBox->state & State_HasFocus) { QStyleOptionFocusRect fropt; fropt.QStyleOption::operator=(*groupBox); fropt.rect = textRect; proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); } } painter->restore(); } break; #endif //QT_NO_GROUPBOX #ifndef QT_NO_COMBOBOX case CC_ComboBox: if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { QBrush editBrush = cmb->palette.brush(QPalette::Base); if ((cmb->subControls & SC_ComboBoxFrame) && cmb->frame) qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_ComboBoxFrameWidth, option, widget), &editBrush); else painter->fillRect(option->rect, editBrush); State flags = State_None; QRect ar = proxy()->subControlRect(CC_ComboBox, cmb, SC_ComboBoxArrow, widget); if ((option->state & State_On)) { painter->fillRect(ar.adjusted(0, 0, 1, 1),cmb->palette.brush(QPalette::Shadow)); } if (d->doubleControls) ar.adjust(5, 0, 5, 0); else ar.adjust(2, 0, -2, 0); if (option->state & State_Enabled) flags |= State_Enabled; if (option->state & State_On) flags |= State_Sunken; QStyleOption arrowOpt(0); arrowOpt.rect = ar; arrowOpt.palette = cmb->palette; arrowOpt.state = flags; proxy()->drawPrimitive(PrimitiveElement(PE_IndicatorArrowDownBig), &arrowOpt, painter, widget); if (cmb->subControls & SC_ComboBoxEditField) { QRect re = proxy()->subControlRect(CC_ComboBox, cmb, SC_ComboBoxEditField, widget); if (cmb->state & State_HasFocus && !cmb->editable) painter->fillRect(re.x(), re.y(), re.width(), re.height(), cmb->palette.brush(QPalette::Highlight)); if (cmb->state & State_HasFocus) { painter->setPen(cmb->palette.highlightedText().color()); painter->setBackground(cmb->palette.highlight()); } else { painter->setPen(cmb->palette.text().color()); painter->setBackground(cmb->palette.background()); } if (cmb->state & State_HasFocus && !cmb->editable) { QStyleOptionFocusRect focus; focus.QStyleOption::operator=(*cmb); focus.rect = proxy()->subElementRect(SE_ComboBoxFocusRect, cmb, widget); focus.state |= State_FocusAtBorder; focus.backgroundColor = cmb->palette.highlight().color(); if ((option->state & State_On)) proxy()->drawPrimitive(PE_FrameFocusRect, &focus, painter, widget); } } } break; #endif // QT_NO_COMBOBOX #ifndef QT_NO_SPINBOX case CC_SpinBox: if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) { QStyleOptionSpinBox copy = *spinBox; //PrimitiveElement primitiveElement; int primitiveElement; if (spinBox->frame && (spinBox->subControls & SC_SpinBoxFrame)) { QRect r = proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxFrame, widget); qDrawPlainRect(painter, r, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget),0); } QPalette shadePal(option->palette); shadePal.setColor(QPalette::Button, option->palette.light().color()); shadePal.setColor(QPalette::Light, option->palette.base().color()); if (spinBox->subControls & SC_SpinBoxUp) { copy.subControls = SC_SpinBoxUp; QPalette pal2 = spinBox->palette; if (!(spinBox->stepEnabled & QAbstractSpinBox::StepUpEnabled)) { pal2.setCurrentColorGroup(QPalette::Disabled); copy.state &= ~State_Enabled; } copy.palette = pal2; if (spinBox->activeSubControls == SC_SpinBoxUp && (spinBox->state & State_Sunken)) { copy.state |= State_On; copy.state |= State_Sunken; } else { copy.state |= State_Raised; copy.state &= ~State_Sunken; } primitiveElement = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorArrowUpBig : PE_IndicatorArrowUpBig); copy.rect = proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxUp, widget); if (copy.state & (State_Sunken | State_On)) qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Shadow)); else qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Base)); copy.rect.adjust(proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), 0, -pixelMetric(PM_SpinBoxFrameWidth, option, widget), 0); proxy()->drawPrimitive(PrimitiveElement(primitiveElement), &copy, painter, widget); } if (spinBox->subControls & SC_SpinBoxDown) { copy.subControls = SC_SpinBoxDown; copy.state = spinBox->state; QPalette pal2 = spinBox->palette; if (!(spinBox->stepEnabled & QAbstractSpinBox::StepDownEnabled)) { pal2.setCurrentColorGroup(QPalette::Disabled); copy.state &= ~State_Enabled; } copy.palette = pal2; if (spinBox->activeSubControls == SC_SpinBoxDown && (spinBox->state & State_Sunken)) { copy.state |= State_On; copy.state |= State_Sunken; } else { copy.state |= State_Raised; copy.state &= ~State_Sunken; } primitiveElement = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorArrowDownBig : PE_IndicatorArrowDownBig); copy.rect = proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxDown, widget); qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Base)); if (copy.state & (State_Sunken | State_On)) qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Shadow)); else qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Base)); copy.rect.adjust(3, 0, -4, 0); if (primitiveElement == PE_IndicatorArrowUp || primitiveElement == PE_IndicatorArrowDown) { int frameWidth = proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget); copy.rect = copy.rect.adjusted(frameWidth, frameWidth, -frameWidth, -frameWidth); proxy()->drawPrimitive(PrimitiveElement(primitiveElement), &copy, painter, widget); } else { proxy()->drawPrimitive(PrimitiveElement(primitiveElement), &copy, painter, widget); } if (spinBox->frame && (spinBox->subControls & SC_SpinBoxFrame)) { QRect r = proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxEditField, widget); } } } break; #endif // QT_NO_SPINBOX default: QWindowsStyle::drawComplexControl(control, option, painter, widget); break; } } QSize QWindowsMobileStyle::sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const { QSize newSize = QWindowsStyle::sizeFromContents(type, option, size, widget); switch (type) { case CT_PushButton: if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) { newSize = QCommonStyle::sizeFromContents(type, option, size, widget); int w = newSize.width(), h = newSize.height(); int defwidth = 0; if (button->features & QStyleOptionButton::AutoDefaultButton) defwidth = 2 * proxy()->pixelMetric(PM_ButtonDefaultIndicator, button, widget); int minwidth = int(QStyleHelper::dpiScaled(55.0f)); int minheight = int(QStyleHelper::dpiScaled(19.0f)); if (w < minwidth + defwidth && button->icon.isNull()) w = minwidth + defwidth; if (h < minheight + defwidth) h = minheight + defwidth; newSize = QSize(w + 4, h + 4); } break; #ifndef QT_NO_GROUPBOX case CT_GroupBox: if (const QGroupBox *grb = static_cast<const QGroupBox *>(widget)) { newSize = size + QSize(!grb->isFlat() ? 16 : 0, !grb->isFlat() ? 16 : 0); } break; #endif // QT_NO_GROUPBOX case CT_RadioButton: case CT_CheckBox: newSize = size; if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) { bool isRadio = (type == CT_RadioButton); QRect irect = visualRect(button->direction, button->rect, proxy()->subElementRect(isRadio ? SE_RadioButtonIndicator : SE_CheckBoxIndicator, button, widget)); int h = proxy()->pixelMetric(isRadio ? PM_ExclusiveIndicatorHeight : PM_IndicatorHeight, button, widget); int margins = (!button->icon.isNull() && button->text.isEmpty()) ? 0 : 10; if (d_func()->doubleControls) margins *= 2; newSize += QSize(irect.right() + margins, 1); newSize.setHeight(qMax(newSize.height(), h)); } break; #ifndef QT_NO_COMBOBOX case CT_ComboBox: if (const QStyleOptionComboBox *comboBox = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { int fw = comboBox->frame ? proxy()->pixelMetric(PM_ComboBoxFrameWidth, option, widget) * 2 : 0; newSize = QSize(newSize.width() + fw + 9, newSize.height() + fw); //Nine is a magic Number - See CommonStyle for real magic (23) } break; #endif #ifndef QT_NO_SPINBOX case CT_SpinBox: if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) { int fw = spinBox->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget) * 2 : 0; newSize = QSize(newSize.width() + fw-5, newSize.height() + fw-6); } break; #endif #ifndef QT_NO_LINEEDIT case CT_LineEdit: newSize += QSize(0,1); break; #endif case CT_ToolButton: newSize = QSize(newSize.width() + 1, newSize.height()); break; case CT_TabBarTab: if (d_func()->doubleControls) newSize = QSize(newSize.width(), 42); else newSize = QSize(newSize.width(), 21); break; case CT_HeaderSection: newSize += QSize(4, 2); break; #ifndef QT_NO_ITEMVIEWS #ifdef Q_WS_WINCE_WM case CT_ItemViewItem: if (d_func()->wm65) if (d_func()->doubleControls) newSize.setHeight(46); else newSize.setHeight(23); break; #endif //Q_WS_WINCE_WM #endif //QT_NO_ITEMVIEWS default: break; } return newSize; } QRect QWindowsMobileStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const { QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func()); QRect rect = QWindowsStyle::subElementRect(element, option, widget); switch (element) { #ifndef QT_NO_TABWIDGET case SE_TabWidgetTabBar: if (d->doubleControls) rect.adjust(-2, 0, 2, 0); else rect.adjust(-2, 0, 2, 0); break; #endif //QT_NO_TABWIDGET case SE_CheckBoxFocusRect: rect.adjust(1,0,-2,-1); break; case SE_RadioButtonFocusRect: rect.adjust(1,1,-2,-2); break; default: break; #ifndef QT_NO_SLIDER case SE_SliderFocusRect: if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) { rect = slider->rect; } break; case SE_PushButtonFocusRect: if (d->doubleControls) rect.adjust(-1, -1, 0, 0); break; #endif // QT_NO_SLIDER #ifndef QT_NO_ITEMVIEWS case SE_ItemViewItemFocusRect: #ifdef Q_WS_WINCE_WM if (d->wm65) rect = QRect(); #endif break; #endif //QT_NO_ITEMVIEWS } return rect; } QRect QWindowsMobileStyle::subControlRect(ComplexControl control, const QStyleOptionComplex *option, SubControl subControl, const QWidget *widget) const { QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func()); QRect rect = QCommonStyle::subControlRect(control, option, subControl, widget); switch (control) { #ifndef QT_NO_SCROLLBAR case CC_ScrollBar: if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(option)) { int sliderButtonExtent = proxy()->pixelMetric(PM_ScrollBarExtent, scrollbar, widget); float stretchFactor = 1.4f; int sliderButtonExtentDir = int (sliderButtonExtent * stretchFactor); #ifdef Q_WS_WINCE_WM if (d->wm65) { sliderButtonExtent = d->imageScrollbarHandleUp.width(); sliderButtonExtentDir = d->imageScrollbarHandleUp.height(); } #endif //Q_WS_WINCE_WM int sliderlen; int maxlen = ((scrollbar->orientation == Qt::Horizontal) ? scrollbar->rect.width() : scrollbar->rect.height()) - (sliderButtonExtentDir * 2); // calculate slider length if (scrollbar->maximum != scrollbar->minimum) { uint range = scrollbar->maximum - scrollbar->minimum; sliderlen = (qint64(scrollbar->pageStep) * maxlen) / (range + scrollbar->pageStep); int slidermin = proxy()->pixelMetric(PM_ScrollBarSliderMin, scrollbar, widget); if (sliderlen < slidermin || range > INT_MAX / 2) sliderlen = slidermin; if (sliderlen > maxlen) sliderlen = maxlen; } else { sliderlen = maxlen; } int sliderstart = sliderButtonExtentDir + sliderPositionFromValue(scrollbar->minimum, scrollbar->maximum, scrollbar->sliderPosition, maxlen - sliderlen, scrollbar->upsideDown); if (d->smartphone) { sliderstart -= sliderButtonExtentDir; sliderlen += 2*sliderButtonExtent; } switch (subControl) { case SC_ScrollBarSubLine: // top/left button if (scrollbar->orientation == Qt::Horizontal) { int buttonWidth = qMin(scrollbar->rect.width() / 2, sliderButtonExtentDir ); rect.setRect(0, 0, buttonWidth, sliderButtonExtent); } else { int buttonHeight = qMin(scrollbar->rect.height() / 2, sliderButtonExtentDir); rect.setRect(0, 0, sliderButtonExtent, buttonHeight); } if (d->smartphone) rect.setRect(0, 0, 0, 0); break; case SC_ScrollBarAddLine: // bottom/right button if (scrollbar->orientation == Qt::Horizontal) { int buttonWidth = qMin(scrollbar->rect.width()/2, sliderButtonExtentDir); rect.setRect(scrollbar->rect.width() - buttonWidth, 0, buttonWidth, sliderButtonExtent); } else { int buttonHeight = qMin(scrollbar->rect.height()/2, sliderButtonExtentDir ); rect.setRect(0, scrollbar->rect.height() - buttonHeight, sliderButtonExtent, buttonHeight); } if (d->smartphone) rect.setRect(0, 0, 0, 0); break; case SC_ScrollBarSubPage: // between top/left button and slider if (scrollbar->orientation == Qt::Horizontal) if (d->smartphone) rect.setRect(0, 0, sliderstart, sliderButtonExtent); else rect.setRect(sliderButtonExtent, 0, sliderstart - sliderButtonExtent, sliderButtonExtent); else if (d->smartphone) rect.setRect(0, 0, sliderButtonExtent, sliderstart); else rect.setRect(0, sliderButtonExtent, sliderButtonExtent, sliderstart - sliderButtonExtent); break; case SC_ScrollBarAddPage: // between bottom/right button and slider if (scrollbar->orientation == Qt::Horizontal) if (d->smartphone) rect.setRect(sliderstart + sliderlen, 0, maxlen - sliderstart - sliderlen + 2*sliderButtonExtent, sliderButtonExtent); else rect.setRect(sliderstart + sliderlen, 0, maxlen - sliderstart - sliderlen + sliderButtonExtent, sliderButtonExtent); else if (d->smartphone) rect.setRect(0, sliderstart + sliderlen, sliderButtonExtent, maxlen - sliderstart - sliderlen + 2*sliderButtonExtent); else rect.setRect(0, sliderstart + sliderlen, sliderButtonExtent, maxlen - sliderstart - sliderlen + sliderButtonExtent); break; case SC_ScrollBarGroove: if (scrollbar->orientation == Qt::Horizontal) rect.setRect(sliderButtonExtent, 0, scrollbar->rect.width() - sliderButtonExtent * 2, scrollbar->rect.height()); else rect.setRect(0, sliderButtonExtent, scrollbar->rect.width(), scrollbar->rect.height() - sliderButtonExtent * 2); break; case SC_ScrollBarSlider: if (scrollbar->orientation == Qt::Horizontal) rect.setRect(sliderstart, 0, sliderlen, sliderButtonExtent); else rect.setRect(0, sliderstart, sliderButtonExtent, sliderlen); break; default: break; } rect = visualRect(scrollbar->direction, scrollbar->rect, rect); } break; #endif // QT_NO_SCROLLBAR #ifndef QT_NO_TOOLBUTTON case CC_ToolButton: if (const QStyleOptionToolButton *toolButton = qstyleoption_cast<const QStyleOptionToolButton *>(option)) { int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, toolButton, widget); rect = toolButton->rect; switch (subControl) { case SC_ToolButton: if ((toolButton->features & (QStyleOptionToolButton::Menu | QStyleOptionToolButton::PopupDelay)) == QStyleOptionToolButton::Menu) rect.adjust(0, 0, -mbi, 0); break; case SC_ToolButtonMenu: if ((toolButton->features & (QStyleOptionToolButton::Menu | QStyleOptionToolButton::PopupDelay)) == QStyleOptionToolButton::Menu) rect.adjust(rect.width() - mbi, 1, 0, 1); break; default: break; } rect = visualRect(toolButton->direction, toolButton->rect, rect); } break; #endif // QT_NO_TOOLBUTTON #ifndef QT_NO_SLIDER case CC_Slider: if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) { int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, slider, widget); int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget); switch (subControl) { case SC_SliderHandle: { int sliderPos = 0; int len = proxy()->pixelMetric(PM_SliderLength, slider, widget); bool horizontal = slider->orientation == Qt::Horizontal; sliderPos = sliderPositionFromValue(slider->minimum, slider->maximum, slider->sliderPosition, (horizontal ? slider->rect.width() : slider->rect.height()) - len, slider->upsideDown); if (horizontal) rect.setRect(slider->rect.x() + sliderPos, slider->rect.y() + tickOffset, len, thickness); else rect.setRect(slider->rect.x() + tickOffset, slider->rect.y() + sliderPos, thickness, len); break; } default: break; } rect = visualRect(slider->direction, slider->rect, rect); } break; #endif //QT_NO_SLIDER #ifndef QT_NO_COMBOBOX case CC_ComboBox: if (const QStyleOptionComboBox *comboBox = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { int x = comboBox->rect.x(), y = comboBox->rect.y(), wi = comboBox->rect.width(), he = comboBox->rect.height(); int xpos = x; int margin = comboBox->frame ? (d->doubleControls ? 2 : 1) : 0; int bmarg = comboBox->frame ? (d->doubleControls ? 2 : 1) : 0; if (subControl == SC_ComboBoxArrow) xpos += wi - int((he - 2*bmarg)*0.9) - bmarg; else xpos += wi - (he - 2*bmarg) - bmarg; switch (subControl) { case SC_ComboBoxArrow: rect.setRect(xpos, y + bmarg, he - 2*bmarg, he - 2*bmarg); break; case SC_ComboBoxEditField: rect.setRect(x + margin, y + margin, wi - 2 * margin - int((he - 2*bmarg) * 0.84f), he - 2 * margin); if (d->doubleControls) { if (comboBox->editable) rect.adjust(2, 0, 0, 0); else rect.adjust(4, 2, 0, -2); } else if (!comboBox->editable) { rect.adjust(2, 1, 0, -1); } break; case SC_ComboBoxFrame: rect = comboBox->rect; break; default: break; } } #endif //QT_NO_COMBOBOX #ifndef QT_NO_SPINBOX case CC_SpinBox: if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) { QSize bs; int fw = spinBox->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, spinBox, widget) : 0; bs.setHeight(qMax(d->doubleControls ? 28 : 14, (spinBox->rect.height()))); // 1.6 -approximate golden mean bs.setWidth(qMax(d->doubleControls ? 28 : 14, qMin((bs.height()*7/8), (spinBox->rect.width() / 8)))); bs = bs.expandedTo(QApplication::globalStrut()); int x, lx, rx; x = spinBox->rect.width() - bs.width()*2; lx = fw; rx = x - fw; switch (subControl) { case SC_SpinBoxUp: rect = QRect(x + proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), 0 , bs.width(), bs.height()); break; case SC_SpinBoxDown: rect = QRect(x + bs.width(), 0, bs.width(), bs.height()); break; case SC_SpinBoxEditField: if (spinBox->buttonSymbols == QAbstractSpinBox::NoButtons) { rect = QRect(lx, fw, spinBox->rect.width() - 2*fw - 2, spinBox->rect.height() - 2*fw); } else { rect = QRect(lx, fw, rx-2, spinBox->rect.height() - 2*fw); } break; case SC_SpinBoxFrame: rect = spinBox->rect; default: break; } rect = visualRect(spinBox->direction, spinBox->rect, rect); } break; #endif // Qt_NO_SPINBOX #ifndef QT_NO_GROUPBOX case CC_GroupBox: { if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) { switch (subControl) { case SC_GroupBoxFrame: // FALL THROUGH case SC_GroupBoxContents: { int topMargin = 0; int topHeight = 0; int bottomMargin = 0; int labelMargin = 2; QRect frameRect = groupBox->rect; int verticalAlignment = styleHint(SH_GroupBox_TextLabelVerticalAlignment, groupBox, widget); if (groupBox->text.size()) { topHeight = groupBox->fontMetrics.height(); if (verticalAlignment & Qt::AlignVCenter) topMargin = topHeight+5; else if (verticalAlignment & Qt::AlignTop) topMargin = -topHeight+5; } if (subControl == SC_GroupBoxFrame) { frameRect.setTop(topMargin); frameRect.setBottom(frameRect.height() + bottomMargin); rect = frameRect; break; } int frameWidth = 0; if (groupBox->text.size()) { frameWidth = proxy()->pixelMetric(PM_DefaultFrameWidth, groupBox, widget); rect = frameRect.adjusted(frameWidth, frameWidth + topHeight + labelMargin, -frameWidth, -frameWidth); } else { rect = groupBox->rect; } break; } case SC_GroupBoxCheckBox: // FALL THROUGH case SC_GroupBoxLabel: { QFontMetrics fontMetrics = groupBox->fontMetrics; int h = fontMetrics.height(); int textWidth = fontMetrics.size(Qt::TextShowMnemonic, groupBox->text + QLatin1Char(' ')).width(); int margX = (groupBox->features & QStyleOptionFrameV2::Flat) ? 0 : 2; int margY = (groupBox->features & QStyleOptionFrameV2::Flat) ? 0 : 2; rect = groupBox->rect.adjusted(margX, margY, -margX, 0); if (groupBox->text.size()) rect.setHeight(h); else rect.setHeight(0); int indicatorWidth = proxy()->pixelMetric(PM_IndicatorWidth, option, widget); int indicatorSpace = proxy()->pixelMetric(PM_CheckBoxLabelSpacing, option, widget) - 1; bool hasCheckBox = groupBox->subControls & QStyle::SC_GroupBoxCheckBox; int checkBoxSize = hasCheckBox ? (indicatorWidth + indicatorSpace) : 0; // Adjusted rect for label + indicatorWidth + indicatorSpace QRect totalRect = alignedRect(groupBox->direction, groupBox->textAlignment, QSize(textWidth + checkBoxSize, h), rect); // Adjust totalRect if checkbox is set if (hasCheckBox) { bool ltr = groupBox->direction == Qt::LeftToRight; int left = 2; // Adjust for check box if (subControl == SC_GroupBoxCheckBox) { int indicatorHeight = proxy()->pixelMetric(PM_IndicatorHeight, option, widget); left = ltr ? totalRect.left() : (totalRect.right() - indicatorWidth); int top = totalRect.top() + (fontMetrics.height() - indicatorHeight) / 2; totalRect.setRect(left, top, indicatorWidth, indicatorHeight); // Adjust for label } else { left = ltr ? (totalRect.left() + checkBoxSize - 2) : totalRect.left(); totalRect.setRect(left, totalRect.top(), totalRect.width() - checkBoxSize, totalRect.height()); } } if ((subControl== SC_GroupBoxLabel)) totalRect.adjust(-2,0,6,0); rect = totalRect; break; } default: break; } } break; } #endif // QT_NO_GROUPBOX default: break; } return rect; } QPalette QWindowsMobileStyle::standardPalette() const { QPalette palette (Qt::black,QColor(198, 195, 198), QColor(222, 223, 222 ), QColor(132, 130, 132), QColor(198, 195, 198), Qt::black, Qt::white, Qt::white, QColor(198, 195, 198)); palette.setColor(QPalette::Window, QColor(206, 223, 239)); palette.setColor(QPalette::Link, QColor(8,77,123)); //Alternate TextColor for labels... palette.setColor(QPalette::Base, Qt::white); palette.setColor(QPalette::Button, QColor(206, 223, 239)); palette.setColor(QPalette::Highlight, QColor(49, 146, 214)); palette.setColor(QPalette::Light, Qt::white); palette.setColor(QPalette::Text, Qt::black); palette.setColor(QPalette::ButtonText, Qt::black); palette.setColor(QPalette::Midlight, QColor(222, 223, 222 )); palette.setColor(QPalette::Dark, QColor(132, 130, 132)); palette.setColor(QPalette::Mid, QColor(189, 190, 189)); palette.setColor(QPalette::Shadow, QColor(0, 0, 0)); palette.setColor(QPalette::BrightText, QColor(33, 162, 33)); //color for ItemView checked indicator (arrow) return palette; } /*! \reimp */ void QWindowsMobileStyle::polish(QApplication *application) { QWindowsStyle::polish(application); } /*! \reimp */ void QWindowsMobileStyle::polish(QWidget *widget) { #ifndef QT_NO_TOOLBAR if (QToolBar *toolBar = qobject_cast<QToolBar*>(widget)) { QPalette pal = toolBar->palette(); pal.setColor(QPalette::Background, pal.button().color()); toolBar->setPalette(pal); } else #endif //QT_NO_TOOLBAR QWindowsStyle::polish(widget); } void QWindowsMobileStyle::unpolish(QWidget *widget) { QWindowsStyle::unpolish(widget); } void QWindowsMobileStyle::unpolish(QApplication *app) { QWindowsStyle::unpolish(app); } /*! \reimp */ void QWindowsMobileStyle::polish(QPalette &palette) { QWindowsStyle::polish(palette); } int QWindowsMobileStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QWidget *widget) const { QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func()); int ret; switch (pm) { case PM_DefaultTopLevelMargin: ret =0; break; case PM_DefaultLayoutSpacing: d->doubleControls ? ret = 8 : ret = 4; break; case PM_HeaderMargin: d->doubleControls ? ret = 2 : ret = 1; break; case PM_DefaultChildMargin: d->doubleControls ? ret = 10 : ret = 5; break; case PM_ToolBarSeparatorExtent: d->doubleControls ? ret = 6 : ret = 3; break; case PM_DefaultFrameWidth: d->doubleControls ? ret = 2 : ret = 1; break; case PM_MenuVMargin: ret = 1; break; case PM_MenuHMargin: ret = 1; break; case PM_MenuButtonIndicator: ret = d->doubleControls ? 24 : 14; break; case PM_ComboBoxFrameWidth: d->doubleControls ? ret = 2 : ret = 1; break; case PM_SpinBoxFrameWidth: d->doubleControls ? ret = 2 : ret = 1; break; case PM_ButtonDefaultIndicator: case PM_ButtonShiftHorizontal: case PM_ButtonShiftVertical: d->doubleControls ? ret = 2 : ret = 1; break; #ifndef QT_NO_TABBAR case PM_TabBarTabShiftHorizontal: ret = 0; break; case PM_TabBarTabShiftVertical: ret = 0; break; #endif case PM_MaximumDragDistance: ret = 60; break; case PM_TabBarTabVSpace: ret = d->doubleControls ? 12 : 6; break; case PM_TabBarBaseHeight: ret = 0; break; case PM_IndicatorWidth: ret = d->doubleControls ? windowsMobileIndicatorSize * 2 : windowsMobileIndicatorSize; break; case PM_IndicatorHeight: ret = d->doubleControls ? windowsMobileIndicatorSize * 2 : windowsMobileIndicatorSize; break; case PM_ExclusiveIndicatorWidth: ret = d->doubleControls ? windowsMobileExclusiveIndicatorSize * 2 + 4: windowsMobileExclusiveIndicatorSize + 2; break; case PM_ExclusiveIndicatorHeight: ret = d->doubleControls ? windowsMobileExclusiveIndicatorSize * 2 + 4: windowsMobileExclusiveIndicatorSize + 2; break; #ifndef QT_NO_SLIDER case PM_SliderLength: ret = d->doubleControls ? 16 : 8; break; case PM_FocusFrameHMargin: ret = d->doubleControls ? 1 : 2; break; case PM_SliderThickness: ret = d->doubleControls ? windowsMobileSliderThickness * 2: windowsMobileSliderThickness; break; case PM_TabBarScrollButtonWidth: ret = d->doubleControls ? 14 * 2 : 18; break; case PM_CheckBoxLabelSpacing: case PM_RadioButtonLabelSpacing: ret = d->doubleControls ? 6 * 2 : 6; break; // Returns the number of pixels to use for the business part of the // slider (i.e., the non-tickmark portion). The remaining space is shared // equally between the tickmark regions. case PM_SliderControlThickness: if (const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { int space = (sl->orientation == Qt::Horizontal) ? sl->rect.height() : sl->rect.width(); int ticks = sl->tickPosition; int n = 0; if (ticks & QSlider::TicksAbove) ++n; if (ticks & QSlider::TicksBelow) ++n; if (!n) { ret = space; break; } int thick = 8; if (ticks != QSlider::TicksBothSides && ticks != QSlider::NoTicks) thick += proxy()->pixelMetric(PM_SliderLength, sl, widget) / 4; space -= thick; if (space > 0) thick += (space * 2) / (n + 2); ret = thick; } else { ret = 0; } break; #endif // QT_NO_SLIDER #ifndef QT_NO_MENU case PM_SmallIconSize: d->doubleControls ? ret = windowsMobileIconSize * 2 : ret = windowsMobileIconSize; break; case PM_ButtonMargin: d->doubleControls ? ret = 8 : ret = 4; break; case PM_LargeIconSize: d->doubleControls ? ret = 64 : ret = 32; break; case PM_IconViewIconSize: ret = proxy()->pixelMetric(PM_LargeIconSize, opt, widget); break; case PM_ToolBarIconSize: d->doubleControls ? ret = 2 * windowsMobileIconSize : ret = windowsMobileIconSize; break; case PM_DockWidgetTitleMargin: ret = 2; break; #if defined(Q_WS_WIN) #else case PM_DockWidgetFrameWidth: ret = 4; break; #endif // Q_WS_WIN break; #endif // QT_NO_MENU case PM_TitleBarHeight: d->doubleControls ? ret = 42 : ret = 21; break; case PM_ScrollBarSliderMin: #ifdef Q_WS_WINCE_WM if (d->wm65) #else if (false) #endif { d->doubleControls ? ret = 68 : ret = 34; } else { d->doubleControls ? ret = 36 : ret = 18; } break; case PM_ScrollBarExtent: { if (d->smartphone) ret = 9; else d->doubleControls ? ret = 25 : ret = 13; #ifdef Q_WS_WINCE_WM if (d->wm65) #else if (false) #endif { d->doubleControls ? ret = 26 : ret = 13; break; } #ifndef QT_NO_SCROLLAREA //Check if the scrollbar is part of an abstractItemView and set size according if (widget) if (QWidget *parent = widget->parentWidget()) if (qobject_cast<QAbstractScrollArea *>(parent->parentWidget())) if (d->smartphone) ret = 8; else d->doubleControls ? ret = 24 : ret = 12; #endif } break; case PM_SplitterWidth: ret = qMax(4, QApplication::globalStrut().width()); break; #if defined(Q_WS_WIN) case PM_MDIFrameWidth: ret = 1; break; #endif case PM_ToolBarExtensionExtent: d->doubleControls ? ret = 32 : ret = 16; break; case PM_ToolBarItemMargin: d->doubleControls ? ret = 2 : ret = 1; break; case PM_ToolBarItemSpacing: d->doubleControls ? ret = 2 : ret = 1; break; case PM_ToolBarHandleExtent: d->doubleControls ? ret = 16 : ret = 8; break; case PM_ButtonIconSize: d->doubleControls ? ret = 32 : ret = 16; break; case PM_TextCursorWidth: ret = 2; break; case PM_TabBar_ScrollButtonOverlap: ret = 0; break; default: ret = QWindowsStyle::pixelMetric(pm, opt, widget); break; } return ret; } int QWindowsMobileStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWidget *widget, QStyleHintReturn *returnData) const { int ret; switch (hint) { case SH_Menu_MouseTracking: case SH_ComboBox_ListMouseTracking: case SH_EtchDisabledText: ret = 0; break; case SH_DitherDisabledText: ret = 0; break; case SH_ItemView_ShowDecorationSelected: ret = 0; break; #ifndef QT_NO_TABWIDGET case SH_TabWidget_DefaultTabPosition: ret = QTabWidget::South; break; #endif case SH_ToolBar_Movable: ret = false; break; case SH_ScrollBar_ContextMenu: ret = false; break; case SH_MenuBar_AltKeyNavigation: ret = false; break; case SH_RequestSoftwareInputPanel: ret = RSIP_OnMouseClick; break; default: ret = QWindowsStyle::styleHint(hint, opt, widget, returnData); break; } return ret; } QPixmap QWindowsMobileStyle::standardPixmap(StandardPixmap sp, const QStyleOption *option, const QWidget *widget) const { QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func()); switch (sp) { #ifndef QT_NO_IMAGEFORMAT_XPM case SP_ToolBarHorizontalExtensionButton: { QPixmap pixmap = QCommonStyle::standardPixmap(sp, option, widget); if (d->doubleControls) return pixmap.scaledToHeight(pixmap.height() * 2); else return pixmap; } case SP_TitleBarMaxButton: case SP_TitleBarCloseButton: case SP_TitleBarNormalButton: case SP_TitleBarMinButton: { QImage image; switch (sp) { case SP_TitleBarMaxButton: image = d->imageMaximize; break; case SP_TitleBarCloseButton: image = d->imageClose; break; case SP_TitleBarNormalButton: image = d->imageNormalize; break; case SP_TitleBarMinButton: image = d->imageMinimize; break; default: break; } if (option) { image.setColor(0, option->palette.shadow().color().rgba()); image.setColor(1, option->palette.highlight().color().rgba()); image.setColor(2, option->palette.highlight().color().lighter(150).rgba()); image.setColor(3, option->palette.highlightedText().color().rgba()); } return QPixmap::fromImage(image); } #endif default: return QWindowsStyle::standardPixmap(sp, option, widget); } } QPixmap QWindowsMobileStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *option) const { switch (iconMode) { case QIcon::Selected: { #ifdef Q_WS_WINCE_WM if (d_func()->wm65) return pixmap; #endif //Q_WS_WINCE_WM QImage img = pixmap.toImage().convertToFormat(QImage::Format_ARGB32); int imgh = img.height(); int imgw = img.width(); for (int y = 0; y < imgh; y += 2) { for (int x = 0; x < imgw; x += 2) { QColor c = option->palette.highlight().color().rgb(); c.setAlpha( qAlpha(img.pixel(x, y))); QRgb pixel = c.rgba(); img.setPixel(x, y, pixel); } } return QPixmap::fromImage(img); } default: break; } return QWindowsStyle::generatedIconPixmap(iconMode, pixmap, option); } bool QWindowsMobileStyle::doubleControls() const { QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func()); return d->doubleControls; } void QWindowsMobileStyle::setDoubleControls(bool doubleControls) { QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func()); d->doubleControls = doubleControls; } QT_END_NAMESPACE #endif // QT_NO_STYLE_WINDOWSMOBILE
lgpl-2.1
geotools/geotools
modules/ogc/net.opengis.wmts/src/org/w3/_2001/smil20/language/LanguagePackage.java
137841
/** */ package org.w3._2001.smil20.language; import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.EReference; import org.w3._2001.smil20.Smil20Package; /** * <!-- begin-user-doc --> * The <b>Package</b> for the model. * It contains accessors for the meta objects to represent * <ul> * <li>each class,</li> * <li>each feature of each class,</li> * <li>each operation of each class,</li> * <li>each enum,</li> * <li>and each data type</li> * </ul> * <!-- end-user-doc --> * <!-- begin-model-doc --> * * <div xmlns="http://www.w3.org/1999/xhtml"> * <h1>About the XML namespace</h1> * * <div class="bodytext"> * <p> * This schema document describes the XML namespace, in a form * suitable for import by other schema documents. * </p> * <p> * See <a href="http://www.w3.org/XML/1998/namespace.html"> * http://www.w3.org/XML/1998/namespace.html</a> and * <a href="http://www.w3.org/TR/REC-xml"> * http://www.w3.org/TR/REC-xml</a> for information * about this namespace. * </p> * <p> * Note that local names in this namespace are intended to be * defined only by the World Wide Web Consortium or its subgroups. * The names currently defined in this namespace are listed below. * They should not be used with conflicting semantics by any Working * Group, specification, or document instance. * </p> * <p> * See further below in this document for more information about <a href="#usage">how to refer to this schema document from your own * XSD schema documents</a> and about <a href="#nsversioning">the * namespace-versioning policy governing this schema document</a>. * </p> * </div> * </div> * * * <div xmlns="http://www.w3.org/1999/xhtml"> * * <h3>Father (in any context at all)</h3> * * <div class="bodytext"> * <p> * denotes Jon Bosak, the chair of * the original XML Working Group. This name is reserved by * the following decision of the W3C XML Plenary and * XML Coordination groups: * </p> * <blockquote> * <p> * In appreciation for his vision, leadership and * dedication the W3C XML Plenary on this 10th day of * February, 2000, reserves for Jon Bosak in perpetuity * the XML name "xml:Father". * </p> * </blockquote> * </div> * </div> * * * <div id="usage" xml:id="usage" xmlns="http://www.w3.org/1999/xhtml"> * <h2> * <a name="usage">About this schema document</a> * </h2> * * <div class="bodytext"> * <p> * This schema defines attributes and an attribute group suitable * for use by schemas wishing to allow <code>xml:base</code>, * <code>xml:lang</code>, <code>xml:space</code> or * <code>xml:id</code> attributes on elements they define. * </p> * <p> * To enable this, such a schema must import this schema for * the XML namespace, e.g. as follows: * </p> * <pre> * &lt;schema . . .&gt; * . . . * &lt;import namespace="http://www.w3.org/XML/1998/namespace" * schemaLocation="http://www.w3.org/2001/xml.xsd"/&gt; * </pre> * <p> * or * </p> * <pre> * &lt;import namespace="http://www.w3.org/XML/1998/namespace" * schemaLocation="http://www.w3.org/2009/01/xml.xsd"/&gt; * </pre> * <p> * Subsequently, qualified reference to any of the attributes or the * group defined below will have the desired effect, e.g. * </p> * <pre> * &lt;type . . .&gt; * . . . * &lt;attributeGroup ref="xml:specialAttrs"/&gt; * </pre> * <p> * will define a type which will schema-validate an instance element * with any of those attributes. * </p> * </div> * </div> * * * <div id="nsversioning" xml:id="nsversioning" xmlns="http://www.w3.org/1999/xhtml"> * <h2> * <a name="nsversioning">Versioning policy for this schema document</a> * </h2> * <div class="bodytext"> * <p> * In keeping with the XML Schema WG's standard versioning * policy, this schema document will persist at * <a href="http://www.w3.org/2009/01/xml.xsd"> * http://www.w3.org/2009/01/xml.xsd</a>. * </p> * <p> * At the date of issue it can also be found at * <a href="http://www.w3.org/2001/xml.xsd"> * http://www.w3.org/2001/xml.xsd</a>. * </p> * <p> * The schema document at that URI may however change in the future, * in order to remain compatible with the latest version of XML * Schema itself, or with the XML namespace itself. In other words, * if the XML Schema or XML namespaces change, the version of this * document at <a href="http://www.w3.org/2001/xml.xsd"> * http://www.w3.org/2001/xml.xsd * </a> * will change accordingly; the version at * <a href="http://www.w3.org/2009/01/xml.xsd"> * http://www.w3.org/2009/01/xml.xsd * </a> * will not change. * </p> * <p> * Previous dated (and unchanging) versions of this schema * document are at: * </p> * <ul> * <li> * <a href="http://www.w3.org/2009/01/xml.xsd"> * http://www.w3.org/2009/01/xml.xsd</a> * </li> * <li> * <a href="http://www.w3.org/2007/08/xml.xsd"> * http://www.w3.org/2007/08/xml.xsd</a> * </li> * <li> * <a href="http://www.w3.org/2004/10/xml.xsd"> * http://www.w3.org/2004/10/xml.xsd</a> * </li> * <li> * <a href="http://www.w3.org/2001/03/xml.xsd"> * http://www.w3.org/2001/03/xml.xsd</a> * </li> * </ul> * </div> * </div> * * <!-- end-model-doc --> * @see org.w3._2001.smil20.language.LanguageFactory * @model kind="package" * @generated */ public interface LanguagePackage extends EPackage { /** * The package name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ String eNAME = "language"; /** * The package namespace URI. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ String eNS_URI = "http://www.w3.org/2001/SMIL20/Language"; /** * The package namespace name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ String eNS_PREFIX = "language"; /** * The singleton instance of the package. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ LanguagePackage eINSTANCE = org.w3._2001.smil20.language.impl.LanguagePackageImpl.init(); /** * The meta object id for the '{@link org.w3._2001.smil20.language.impl.AnimateColorTypeImpl <em>Animate Color Type</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see org.w3._2001.smil20.language.impl.AnimateColorTypeImpl * @see org.w3._2001.smil20.language.impl.LanguagePackageImpl#getAnimateColorType() * @generated */ int ANIMATE_COLOR_TYPE = 0; /** * The feature id for the '<em><b>Accumulate</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_COLOR_TYPE__ACCUMULATE = Smil20Package.ANIMATE_COLOR_PROTOTYPE__ACCUMULATE; /** * The feature id for the '<em><b>Additive</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_COLOR_TYPE__ADDITIVE = Smil20Package.ANIMATE_COLOR_PROTOTYPE__ADDITIVE; /** * The feature id for the '<em><b>Attribute Name</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_COLOR_TYPE__ATTRIBUTE_NAME = Smil20Package.ANIMATE_COLOR_PROTOTYPE__ATTRIBUTE_NAME; /** * The feature id for the '<em><b>Attribute Type</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_COLOR_TYPE__ATTRIBUTE_TYPE = Smil20Package.ANIMATE_COLOR_PROTOTYPE__ATTRIBUTE_TYPE; /** * The feature id for the '<em><b>By</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_COLOR_TYPE__BY = Smil20Package.ANIMATE_COLOR_PROTOTYPE__BY; /** * The feature id for the '<em><b>From</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_COLOR_TYPE__FROM = Smil20Package.ANIMATE_COLOR_PROTOTYPE__FROM; /** * The feature id for the '<em><b>To</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_COLOR_TYPE__TO = Smil20Package.ANIMATE_COLOR_PROTOTYPE__TO; /** * The feature id for the '<em><b>Values</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_COLOR_TYPE__VALUES = Smil20Package.ANIMATE_COLOR_PROTOTYPE__VALUES; /** * The feature id for the '<em><b>Group</b></em>' attribute list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_COLOR_TYPE__GROUP = Smil20Package.ANIMATE_COLOR_PROTOTYPE_FEATURE_COUNT + 0; /** * The feature id for the '<em><b>Any</b></em>' attribute list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_COLOR_TYPE__ANY = Smil20Package.ANIMATE_COLOR_PROTOTYPE_FEATURE_COUNT + 1; /** * The feature id for the '<em><b>Alt</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_COLOR_TYPE__ALT = Smil20Package.ANIMATE_COLOR_PROTOTYPE_FEATURE_COUNT + 2; /** * The feature id for the '<em><b>Begin</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_COLOR_TYPE__BEGIN = Smil20Package.ANIMATE_COLOR_PROTOTYPE_FEATURE_COUNT + 3; /** * The feature id for the '<em><b>Calc Mode</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_COLOR_TYPE__CALC_MODE = Smil20Package.ANIMATE_COLOR_PROTOTYPE_FEATURE_COUNT + 4; /** * The feature id for the '<em><b>Class</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_COLOR_TYPE__CLASS = Smil20Package.ANIMATE_COLOR_PROTOTYPE_FEATURE_COUNT + 5; /** * The feature id for the '<em><b>Dur</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_COLOR_TYPE__DUR = Smil20Package.ANIMATE_COLOR_PROTOTYPE_FEATURE_COUNT + 6; /** * The feature id for the '<em><b>End</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_COLOR_TYPE__END = Smil20Package.ANIMATE_COLOR_PROTOTYPE_FEATURE_COUNT + 7; /** * The feature id for the '<em><b>Fill</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_COLOR_TYPE__FILL = Smil20Package.ANIMATE_COLOR_PROTOTYPE_FEATURE_COUNT + 8; /** * The feature id for the '<em><b>Fill Default</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_COLOR_TYPE__FILL_DEFAULT = Smil20Package.ANIMATE_COLOR_PROTOTYPE_FEATURE_COUNT + 9; /** * The feature id for the '<em><b>Id</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_COLOR_TYPE__ID = Smil20Package.ANIMATE_COLOR_PROTOTYPE_FEATURE_COUNT + 10; /** * The feature id for the '<em><b>Lang</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_COLOR_TYPE__LANG = Smil20Package.ANIMATE_COLOR_PROTOTYPE_FEATURE_COUNT + 11; /** * The feature id for the '<em><b>Longdesc</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_COLOR_TYPE__LONGDESC = Smil20Package.ANIMATE_COLOR_PROTOTYPE_FEATURE_COUNT + 12; /** * The feature id for the '<em><b>Max</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_COLOR_TYPE__MAX = Smil20Package.ANIMATE_COLOR_PROTOTYPE_FEATURE_COUNT + 13; /** * The feature id for the '<em><b>Min</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_COLOR_TYPE__MIN = Smil20Package.ANIMATE_COLOR_PROTOTYPE_FEATURE_COUNT + 14; /** * The feature id for the '<em><b>Repeat</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_COLOR_TYPE__REPEAT = Smil20Package.ANIMATE_COLOR_PROTOTYPE_FEATURE_COUNT + 15; /** * The feature id for the '<em><b>Repeat Count</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_COLOR_TYPE__REPEAT_COUNT = Smil20Package.ANIMATE_COLOR_PROTOTYPE_FEATURE_COUNT + 16; /** * The feature id for the '<em><b>Repeat Dur</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_COLOR_TYPE__REPEAT_DUR = Smil20Package.ANIMATE_COLOR_PROTOTYPE_FEATURE_COUNT + 17; /** * The feature id for the '<em><b>Restart</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_COLOR_TYPE__RESTART = Smil20Package.ANIMATE_COLOR_PROTOTYPE_FEATURE_COUNT + 18; /** * The feature id for the '<em><b>Restart Default</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_COLOR_TYPE__RESTART_DEFAULT = Smil20Package.ANIMATE_COLOR_PROTOTYPE_FEATURE_COUNT + 19; /** * The feature id for the '<em><b>Skip Content</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_COLOR_TYPE__SKIP_CONTENT = Smil20Package.ANIMATE_COLOR_PROTOTYPE_FEATURE_COUNT + 20; /** * The feature id for the '<em><b>Sync Behavior</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_COLOR_TYPE__SYNC_BEHAVIOR = Smil20Package.ANIMATE_COLOR_PROTOTYPE_FEATURE_COUNT + 21; /** * The feature id for the '<em><b>Sync Behavior Default</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_COLOR_TYPE__SYNC_BEHAVIOR_DEFAULT = Smil20Package.ANIMATE_COLOR_PROTOTYPE_FEATURE_COUNT + 22; /** * The feature id for the '<em><b>Sync Tolerance</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_COLOR_TYPE__SYNC_TOLERANCE = Smil20Package.ANIMATE_COLOR_PROTOTYPE_FEATURE_COUNT + 23; /** * The feature id for the '<em><b>Sync Tolerance Default</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_COLOR_TYPE__SYNC_TOLERANCE_DEFAULT = Smil20Package.ANIMATE_COLOR_PROTOTYPE_FEATURE_COUNT + 24; /** * The feature id for the '<em><b>Target Element</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_COLOR_TYPE__TARGET_ELEMENT = Smil20Package.ANIMATE_COLOR_PROTOTYPE_FEATURE_COUNT + 25; /** * The feature id for the '<em><b>Any Attribute</b></em>' attribute list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_COLOR_TYPE__ANY_ATTRIBUTE = Smil20Package.ANIMATE_COLOR_PROTOTYPE_FEATURE_COUNT + 26; /** * The number of structural features of the '<em>Animate Color Type</em>' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_COLOR_TYPE_FEATURE_COUNT = Smil20Package.ANIMATE_COLOR_PROTOTYPE_FEATURE_COUNT + 27; /** * The number of operations of the '<em>Animate Color Type</em>' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_COLOR_TYPE_OPERATION_COUNT = Smil20Package.ANIMATE_COLOR_PROTOTYPE_OPERATION_COUNT + 0; /** * The meta object id for the '{@link org.w3._2001.smil20.language.impl.AnimateMotionTypeImpl <em>Animate Motion Type</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see org.w3._2001.smil20.language.impl.AnimateMotionTypeImpl * @see org.w3._2001.smil20.language.impl.LanguagePackageImpl#getAnimateMotionType() * @generated */ int ANIMATE_MOTION_TYPE = 1; /** * The feature id for the '<em><b>Accumulate</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_MOTION_TYPE__ACCUMULATE = Smil20Package.ANIMATE_MOTION_PROTOTYPE__ACCUMULATE; /** * The feature id for the '<em><b>Additive</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_MOTION_TYPE__ADDITIVE = Smil20Package.ANIMATE_MOTION_PROTOTYPE__ADDITIVE; /** * The feature id for the '<em><b>By</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_MOTION_TYPE__BY = Smil20Package.ANIMATE_MOTION_PROTOTYPE__BY; /** * The feature id for the '<em><b>From</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_MOTION_TYPE__FROM = Smil20Package.ANIMATE_MOTION_PROTOTYPE__FROM; /** * The feature id for the '<em><b>Origin</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_MOTION_TYPE__ORIGIN = Smil20Package.ANIMATE_MOTION_PROTOTYPE__ORIGIN; /** * The feature id for the '<em><b>To</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_MOTION_TYPE__TO = Smil20Package.ANIMATE_MOTION_PROTOTYPE__TO; /** * The feature id for the '<em><b>Values</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_MOTION_TYPE__VALUES = Smil20Package.ANIMATE_MOTION_PROTOTYPE__VALUES; /** * The feature id for the '<em><b>Group</b></em>' attribute list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_MOTION_TYPE__GROUP = Smil20Package.ANIMATE_MOTION_PROTOTYPE_FEATURE_COUNT + 0; /** * The feature id for the '<em><b>Any</b></em>' attribute list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_MOTION_TYPE__ANY = Smil20Package.ANIMATE_MOTION_PROTOTYPE_FEATURE_COUNT + 1; /** * The feature id for the '<em><b>Alt</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_MOTION_TYPE__ALT = Smil20Package.ANIMATE_MOTION_PROTOTYPE_FEATURE_COUNT + 2; /** * The feature id for the '<em><b>Begin</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_MOTION_TYPE__BEGIN = Smil20Package.ANIMATE_MOTION_PROTOTYPE_FEATURE_COUNT + 3; /** * The feature id for the '<em><b>Calc Mode</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_MOTION_TYPE__CALC_MODE = Smil20Package.ANIMATE_MOTION_PROTOTYPE_FEATURE_COUNT + 4; /** * The feature id for the '<em><b>Class</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_MOTION_TYPE__CLASS = Smil20Package.ANIMATE_MOTION_PROTOTYPE_FEATURE_COUNT + 5; /** * The feature id for the '<em><b>Dur</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_MOTION_TYPE__DUR = Smil20Package.ANIMATE_MOTION_PROTOTYPE_FEATURE_COUNT + 6; /** * The feature id for the '<em><b>End</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_MOTION_TYPE__END = Smil20Package.ANIMATE_MOTION_PROTOTYPE_FEATURE_COUNT + 7; /** * The feature id for the '<em><b>Fill</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_MOTION_TYPE__FILL = Smil20Package.ANIMATE_MOTION_PROTOTYPE_FEATURE_COUNT + 8; /** * The feature id for the '<em><b>Fill Default</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_MOTION_TYPE__FILL_DEFAULT = Smil20Package.ANIMATE_MOTION_PROTOTYPE_FEATURE_COUNT + 9; /** * The feature id for the '<em><b>Id</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_MOTION_TYPE__ID = Smil20Package.ANIMATE_MOTION_PROTOTYPE_FEATURE_COUNT + 10; /** * The feature id for the '<em><b>Lang</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_MOTION_TYPE__LANG = Smil20Package.ANIMATE_MOTION_PROTOTYPE_FEATURE_COUNT + 11; /** * The feature id for the '<em><b>Longdesc</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_MOTION_TYPE__LONGDESC = Smil20Package.ANIMATE_MOTION_PROTOTYPE_FEATURE_COUNT + 12; /** * The feature id for the '<em><b>Max</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_MOTION_TYPE__MAX = Smil20Package.ANIMATE_MOTION_PROTOTYPE_FEATURE_COUNT + 13; /** * The feature id for the '<em><b>Min</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_MOTION_TYPE__MIN = Smil20Package.ANIMATE_MOTION_PROTOTYPE_FEATURE_COUNT + 14; /** * The feature id for the '<em><b>Repeat</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_MOTION_TYPE__REPEAT = Smil20Package.ANIMATE_MOTION_PROTOTYPE_FEATURE_COUNT + 15; /** * The feature id for the '<em><b>Repeat Count</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_MOTION_TYPE__REPEAT_COUNT = Smil20Package.ANIMATE_MOTION_PROTOTYPE_FEATURE_COUNT + 16; /** * The feature id for the '<em><b>Repeat Dur</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_MOTION_TYPE__REPEAT_DUR = Smil20Package.ANIMATE_MOTION_PROTOTYPE_FEATURE_COUNT + 17; /** * The feature id for the '<em><b>Restart</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_MOTION_TYPE__RESTART = Smil20Package.ANIMATE_MOTION_PROTOTYPE_FEATURE_COUNT + 18; /** * The feature id for the '<em><b>Restart Default</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_MOTION_TYPE__RESTART_DEFAULT = Smil20Package.ANIMATE_MOTION_PROTOTYPE_FEATURE_COUNT + 19; /** * The feature id for the '<em><b>Skip Content</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_MOTION_TYPE__SKIP_CONTENT = Smil20Package.ANIMATE_MOTION_PROTOTYPE_FEATURE_COUNT + 20; /** * The feature id for the '<em><b>Sync Behavior</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_MOTION_TYPE__SYNC_BEHAVIOR = Smil20Package.ANIMATE_MOTION_PROTOTYPE_FEATURE_COUNT + 21; /** * The feature id for the '<em><b>Sync Behavior Default</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_MOTION_TYPE__SYNC_BEHAVIOR_DEFAULT = Smil20Package.ANIMATE_MOTION_PROTOTYPE_FEATURE_COUNT + 22; /** * The feature id for the '<em><b>Sync Tolerance</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_MOTION_TYPE__SYNC_TOLERANCE = Smil20Package.ANIMATE_MOTION_PROTOTYPE_FEATURE_COUNT + 23; /** * The feature id for the '<em><b>Sync Tolerance Default</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_MOTION_TYPE__SYNC_TOLERANCE_DEFAULT = Smil20Package.ANIMATE_MOTION_PROTOTYPE_FEATURE_COUNT + 24; /** * The feature id for the '<em><b>Target Element</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_MOTION_TYPE__TARGET_ELEMENT = Smil20Package.ANIMATE_MOTION_PROTOTYPE_FEATURE_COUNT + 25; /** * The feature id for the '<em><b>Any Attribute</b></em>' attribute list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_MOTION_TYPE__ANY_ATTRIBUTE = Smil20Package.ANIMATE_MOTION_PROTOTYPE_FEATURE_COUNT + 26; /** * The number of structural features of the '<em>Animate Motion Type</em>' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_MOTION_TYPE_FEATURE_COUNT = Smil20Package.ANIMATE_MOTION_PROTOTYPE_FEATURE_COUNT + 27; /** * The number of operations of the '<em>Animate Motion Type</em>' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_MOTION_TYPE_OPERATION_COUNT = Smil20Package.ANIMATE_MOTION_PROTOTYPE_OPERATION_COUNT + 0; /** * The meta object id for the '{@link org.w3._2001.smil20.language.impl.AnimateTypeImpl <em>Animate Type</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see org.w3._2001.smil20.language.impl.AnimateTypeImpl * @see org.w3._2001.smil20.language.impl.LanguagePackageImpl#getAnimateType() * @generated */ int ANIMATE_TYPE = 2; /** * The feature id for the '<em><b>Accumulate</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_TYPE__ACCUMULATE = Smil20Package.ANIMATE_PROTOTYPE__ACCUMULATE; /** * The feature id for the '<em><b>Additive</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_TYPE__ADDITIVE = Smil20Package.ANIMATE_PROTOTYPE__ADDITIVE; /** * The feature id for the '<em><b>Attribute Name</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_TYPE__ATTRIBUTE_NAME = Smil20Package.ANIMATE_PROTOTYPE__ATTRIBUTE_NAME; /** * The feature id for the '<em><b>Attribute Type</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_TYPE__ATTRIBUTE_TYPE = Smil20Package.ANIMATE_PROTOTYPE__ATTRIBUTE_TYPE; /** * The feature id for the '<em><b>By</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_TYPE__BY = Smil20Package.ANIMATE_PROTOTYPE__BY; /** * The feature id for the '<em><b>From</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_TYPE__FROM = Smil20Package.ANIMATE_PROTOTYPE__FROM; /** * The feature id for the '<em><b>To</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_TYPE__TO = Smil20Package.ANIMATE_PROTOTYPE__TO; /** * The feature id for the '<em><b>Values</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_TYPE__VALUES = Smil20Package.ANIMATE_PROTOTYPE__VALUES; /** * The feature id for the '<em><b>Group</b></em>' attribute list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_TYPE__GROUP = Smil20Package.ANIMATE_PROTOTYPE_FEATURE_COUNT + 0; /** * The feature id for the '<em><b>Any</b></em>' attribute list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_TYPE__ANY = Smil20Package.ANIMATE_PROTOTYPE_FEATURE_COUNT + 1; /** * The feature id for the '<em><b>Alt</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_TYPE__ALT = Smil20Package.ANIMATE_PROTOTYPE_FEATURE_COUNT + 2; /** * The feature id for the '<em><b>Begin</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_TYPE__BEGIN = Smil20Package.ANIMATE_PROTOTYPE_FEATURE_COUNT + 3; /** * The feature id for the '<em><b>Calc Mode</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_TYPE__CALC_MODE = Smil20Package.ANIMATE_PROTOTYPE_FEATURE_COUNT + 4; /** * The feature id for the '<em><b>Class</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_TYPE__CLASS = Smil20Package.ANIMATE_PROTOTYPE_FEATURE_COUNT + 5; /** * The feature id for the '<em><b>Dur</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_TYPE__DUR = Smil20Package.ANIMATE_PROTOTYPE_FEATURE_COUNT + 6; /** * The feature id for the '<em><b>End</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_TYPE__END = Smil20Package.ANIMATE_PROTOTYPE_FEATURE_COUNT + 7; /** * The feature id for the '<em><b>Fill</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_TYPE__FILL = Smil20Package.ANIMATE_PROTOTYPE_FEATURE_COUNT + 8; /** * The feature id for the '<em><b>Fill Default</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_TYPE__FILL_DEFAULT = Smil20Package.ANIMATE_PROTOTYPE_FEATURE_COUNT + 9; /** * The feature id for the '<em><b>Id</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_TYPE__ID = Smil20Package.ANIMATE_PROTOTYPE_FEATURE_COUNT + 10; /** * The feature id for the '<em><b>Lang</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_TYPE__LANG = Smil20Package.ANIMATE_PROTOTYPE_FEATURE_COUNT + 11; /** * The feature id for the '<em><b>Longdesc</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_TYPE__LONGDESC = Smil20Package.ANIMATE_PROTOTYPE_FEATURE_COUNT + 12; /** * The feature id for the '<em><b>Max</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_TYPE__MAX = Smil20Package.ANIMATE_PROTOTYPE_FEATURE_COUNT + 13; /** * The feature id for the '<em><b>Min</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_TYPE__MIN = Smil20Package.ANIMATE_PROTOTYPE_FEATURE_COUNT + 14; /** * The feature id for the '<em><b>Repeat</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_TYPE__REPEAT = Smil20Package.ANIMATE_PROTOTYPE_FEATURE_COUNT + 15; /** * The feature id for the '<em><b>Repeat Count</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_TYPE__REPEAT_COUNT = Smil20Package.ANIMATE_PROTOTYPE_FEATURE_COUNT + 16; /** * The feature id for the '<em><b>Repeat Dur</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_TYPE__REPEAT_DUR = Smil20Package.ANIMATE_PROTOTYPE_FEATURE_COUNT + 17; /** * The feature id for the '<em><b>Restart</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_TYPE__RESTART = Smil20Package.ANIMATE_PROTOTYPE_FEATURE_COUNT + 18; /** * The feature id for the '<em><b>Restart Default</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_TYPE__RESTART_DEFAULT = Smil20Package.ANIMATE_PROTOTYPE_FEATURE_COUNT + 19; /** * The feature id for the '<em><b>Skip Content</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_TYPE__SKIP_CONTENT = Smil20Package.ANIMATE_PROTOTYPE_FEATURE_COUNT + 20; /** * The feature id for the '<em><b>Sync Behavior</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_TYPE__SYNC_BEHAVIOR = Smil20Package.ANIMATE_PROTOTYPE_FEATURE_COUNT + 21; /** * The feature id for the '<em><b>Sync Behavior Default</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_TYPE__SYNC_BEHAVIOR_DEFAULT = Smil20Package.ANIMATE_PROTOTYPE_FEATURE_COUNT + 22; /** * The feature id for the '<em><b>Sync Tolerance</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_TYPE__SYNC_TOLERANCE = Smil20Package.ANIMATE_PROTOTYPE_FEATURE_COUNT + 23; /** * The feature id for the '<em><b>Sync Tolerance Default</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_TYPE__SYNC_TOLERANCE_DEFAULT = Smil20Package.ANIMATE_PROTOTYPE_FEATURE_COUNT + 24; /** * The feature id for the '<em><b>Target Element</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_TYPE__TARGET_ELEMENT = Smil20Package.ANIMATE_PROTOTYPE_FEATURE_COUNT + 25; /** * The feature id for the '<em><b>Any Attribute</b></em>' attribute list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_TYPE__ANY_ATTRIBUTE = Smil20Package.ANIMATE_PROTOTYPE_FEATURE_COUNT + 26; /** * The number of structural features of the '<em>Animate Type</em>' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_TYPE_FEATURE_COUNT = Smil20Package.ANIMATE_PROTOTYPE_FEATURE_COUNT + 27; /** * The number of operations of the '<em>Animate Type</em>' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int ANIMATE_TYPE_OPERATION_COUNT = Smil20Package.ANIMATE_PROTOTYPE_OPERATION_COUNT + 0; /** * The meta object id for the '{@link org.w3._2001.smil20.language.impl.DocumentRootImpl <em>Document Root</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see org.w3._2001.smil20.language.impl.DocumentRootImpl * @see org.w3._2001.smil20.language.impl.LanguagePackageImpl#getDocumentRoot() * @generated */ int DOCUMENT_ROOT = 3; /** * The feature id for the '<em><b>Mixed</b></em>' attribute list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int DOCUMENT_ROOT__MIXED = 0; /** * The feature id for the '<em><b>XMLNS Prefix Map</b></em>' map. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int DOCUMENT_ROOT__XMLNS_PREFIX_MAP = 1; /** * The feature id for the '<em><b>XSI Schema Location</b></em>' map. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int DOCUMENT_ROOT__XSI_SCHEMA_LOCATION = 2; /** * The feature id for the '<em><b>Animate</b></em>' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int DOCUMENT_ROOT__ANIMATE = 3; /** * The feature id for the '<em><b>Animate Color</b></em>' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int DOCUMENT_ROOT__ANIMATE_COLOR = 4; /** * The feature id for the '<em><b>Animate Motion</b></em>' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int DOCUMENT_ROOT__ANIMATE_MOTION = 5; /** * The feature id for the '<em><b>Set</b></em>' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int DOCUMENT_ROOT__SET = 6; /** * The number of structural features of the '<em>Document Root</em>' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int DOCUMENT_ROOT_FEATURE_COUNT = 7; /** * The number of operations of the '<em>Document Root</em>' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int DOCUMENT_ROOT_OPERATION_COUNT = 0; /** * The meta object id for the '{@link org.w3._2001.smil20.language.impl.SetTypeImpl <em>Set Type</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see org.w3._2001.smil20.language.impl.SetTypeImpl * @see org.w3._2001.smil20.language.impl.LanguagePackageImpl#getSetType() * @generated */ int SET_TYPE = 4; /** * The feature id for the '<em><b>Attribute Name</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int SET_TYPE__ATTRIBUTE_NAME = Smil20Package.SET_PROTOTYPE__ATTRIBUTE_NAME; /** * The feature id for the '<em><b>Attribute Type</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int SET_TYPE__ATTRIBUTE_TYPE = Smil20Package.SET_PROTOTYPE__ATTRIBUTE_TYPE; /** * The feature id for the '<em><b>To</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int SET_TYPE__TO = Smil20Package.SET_PROTOTYPE__TO; /** * The feature id for the '<em><b>Group</b></em>' attribute list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int SET_TYPE__GROUP = Smil20Package.SET_PROTOTYPE_FEATURE_COUNT + 0; /** * The feature id for the '<em><b>Any</b></em>' attribute list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int SET_TYPE__ANY = Smil20Package.SET_PROTOTYPE_FEATURE_COUNT + 1; /** * The feature id for the '<em><b>Alt</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int SET_TYPE__ALT = Smil20Package.SET_PROTOTYPE_FEATURE_COUNT + 2; /** * The feature id for the '<em><b>Begin</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int SET_TYPE__BEGIN = Smil20Package.SET_PROTOTYPE_FEATURE_COUNT + 3; /** * The feature id for the '<em><b>Class</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int SET_TYPE__CLASS = Smil20Package.SET_PROTOTYPE_FEATURE_COUNT + 4; /** * The feature id for the '<em><b>Dur</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int SET_TYPE__DUR = Smil20Package.SET_PROTOTYPE_FEATURE_COUNT + 5; /** * The feature id for the '<em><b>End</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int SET_TYPE__END = Smil20Package.SET_PROTOTYPE_FEATURE_COUNT + 6; /** * The feature id for the '<em><b>Fill</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int SET_TYPE__FILL = Smil20Package.SET_PROTOTYPE_FEATURE_COUNT + 7; /** * The feature id for the '<em><b>Fill Default</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int SET_TYPE__FILL_DEFAULT = Smil20Package.SET_PROTOTYPE_FEATURE_COUNT + 8; /** * The feature id for the '<em><b>Id</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int SET_TYPE__ID = Smil20Package.SET_PROTOTYPE_FEATURE_COUNT + 9; /** * The feature id for the '<em><b>Lang</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int SET_TYPE__LANG = Smil20Package.SET_PROTOTYPE_FEATURE_COUNT + 10; /** * The feature id for the '<em><b>Longdesc</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int SET_TYPE__LONGDESC = Smil20Package.SET_PROTOTYPE_FEATURE_COUNT + 11; /** * The feature id for the '<em><b>Max</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int SET_TYPE__MAX = Smil20Package.SET_PROTOTYPE_FEATURE_COUNT + 12; /** * The feature id for the '<em><b>Min</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int SET_TYPE__MIN = Smil20Package.SET_PROTOTYPE_FEATURE_COUNT + 13; /** * The feature id for the '<em><b>Repeat</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int SET_TYPE__REPEAT = Smil20Package.SET_PROTOTYPE_FEATURE_COUNT + 14; /** * The feature id for the '<em><b>Repeat Count</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int SET_TYPE__REPEAT_COUNT = Smil20Package.SET_PROTOTYPE_FEATURE_COUNT + 15; /** * The feature id for the '<em><b>Repeat Dur</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int SET_TYPE__REPEAT_DUR = Smil20Package.SET_PROTOTYPE_FEATURE_COUNT + 16; /** * The feature id for the '<em><b>Restart</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int SET_TYPE__RESTART = Smil20Package.SET_PROTOTYPE_FEATURE_COUNT + 17; /** * The feature id for the '<em><b>Restart Default</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int SET_TYPE__RESTART_DEFAULT = Smil20Package.SET_PROTOTYPE_FEATURE_COUNT + 18; /** * The feature id for the '<em><b>Skip Content</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int SET_TYPE__SKIP_CONTENT = Smil20Package.SET_PROTOTYPE_FEATURE_COUNT + 19; /** * The feature id for the '<em><b>Sync Behavior</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int SET_TYPE__SYNC_BEHAVIOR = Smil20Package.SET_PROTOTYPE_FEATURE_COUNT + 20; /** * The feature id for the '<em><b>Sync Behavior Default</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int SET_TYPE__SYNC_BEHAVIOR_DEFAULT = Smil20Package.SET_PROTOTYPE_FEATURE_COUNT + 21; /** * The feature id for the '<em><b>Sync Tolerance</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int SET_TYPE__SYNC_TOLERANCE = Smil20Package.SET_PROTOTYPE_FEATURE_COUNT + 22; /** * The feature id for the '<em><b>Sync Tolerance Default</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int SET_TYPE__SYNC_TOLERANCE_DEFAULT = Smil20Package.SET_PROTOTYPE_FEATURE_COUNT + 23; /** * The feature id for the '<em><b>Target Element</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int SET_TYPE__TARGET_ELEMENT = Smil20Package.SET_PROTOTYPE_FEATURE_COUNT + 24; /** * The feature id for the '<em><b>Any Attribute</b></em>' attribute list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int SET_TYPE__ANY_ATTRIBUTE = Smil20Package.SET_PROTOTYPE_FEATURE_COUNT + 25; /** * The number of structural features of the '<em>Set Type</em>' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int SET_TYPE_FEATURE_COUNT = Smil20Package.SET_PROTOTYPE_FEATURE_COUNT + 26; /** * The number of operations of the '<em>Set Type</em>' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ int SET_TYPE_OPERATION_COUNT = Smil20Package.SET_PROTOTYPE_OPERATION_COUNT + 0; /** * Returns the meta object for class '{@link org.w3._2001.smil20.language.AnimateColorType <em>Animate Color Type</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for class '<em>Animate Color Type</em>'. * @see org.w3._2001.smil20.language.AnimateColorType * @generated */ EClass getAnimateColorType(); /** * Returns the meta object for the attribute list '{@link org.w3._2001.smil20.language.AnimateColorType#getGroup <em>Group</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute list '<em>Group</em>'. * @see org.w3._2001.smil20.language.AnimateColorType#getGroup() * @see #getAnimateColorType() * @generated */ EAttribute getAnimateColorType_Group(); /** * Returns the meta object for the attribute list '{@link org.w3._2001.smil20.language.AnimateColorType#getAny <em>Any</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute list '<em>Any</em>'. * @see org.w3._2001.smil20.language.AnimateColorType#getAny() * @see #getAnimateColorType() * @generated */ EAttribute getAnimateColorType_Any(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateColorType#getAlt <em>Alt</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Alt</em>'. * @see org.w3._2001.smil20.language.AnimateColorType#getAlt() * @see #getAnimateColorType() * @generated */ EAttribute getAnimateColorType_Alt(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateColorType#getBegin <em>Begin</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Begin</em>'. * @see org.w3._2001.smil20.language.AnimateColorType#getBegin() * @see #getAnimateColorType() * @generated */ EAttribute getAnimateColorType_Begin(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateColorType#getCalcMode <em>Calc Mode</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Calc Mode</em>'. * @see org.w3._2001.smil20.language.AnimateColorType#getCalcMode() * @see #getAnimateColorType() * @generated */ EAttribute getAnimateColorType_CalcMode(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateColorType#getClass_ <em>Class</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Class</em>'. * @see org.w3._2001.smil20.language.AnimateColorType#getClass_() * @see #getAnimateColorType() * @generated */ EAttribute getAnimateColorType_Class(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateColorType#getDur <em>Dur</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Dur</em>'. * @see org.w3._2001.smil20.language.AnimateColorType#getDur() * @see #getAnimateColorType() * @generated */ EAttribute getAnimateColorType_Dur(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateColorType#getEnd <em>End</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>End</em>'. * @see org.w3._2001.smil20.language.AnimateColorType#getEnd() * @see #getAnimateColorType() * @generated */ EAttribute getAnimateColorType_End(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateColorType#getFill <em>Fill</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Fill</em>'. * @see org.w3._2001.smil20.language.AnimateColorType#getFill() * @see #getAnimateColorType() * @generated */ EAttribute getAnimateColorType_Fill(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateColorType#getFillDefault <em>Fill Default</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Fill Default</em>'. * @see org.w3._2001.smil20.language.AnimateColorType#getFillDefault() * @see #getAnimateColorType() * @generated */ EAttribute getAnimateColorType_FillDefault(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateColorType#getId <em>Id</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Id</em>'. * @see org.w3._2001.smil20.language.AnimateColorType#getId() * @see #getAnimateColorType() * @generated */ EAttribute getAnimateColorType_Id(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateColorType#getLang <em>Lang</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Lang</em>'. * @see org.w3._2001.smil20.language.AnimateColorType#getLang() * @see #getAnimateColorType() * @generated */ EAttribute getAnimateColorType_Lang(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateColorType#getLongdesc <em>Longdesc</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Longdesc</em>'. * @see org.w3._2001.smil20.language.AnimateColorType#getLongdesc() * @see #getAnimateColorType() * @generated */ EAttribute getAnimateColorType_Longdesc(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateColorType#getMax <em>Max</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Max</em>'. * @see org.w3._2001.smil20.language.AnimateColorType#getMax() * @see #getAnimateColorType() * @generated */ EAttribute getAnimateColorType_Max(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateColorType#getMin <em>Min</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Min</em>'. * @see org.w3._2001.smil20.language.AnimateColorType#getMin() * @see #getAnimateColorType() * @generated */ EAttribute getAnimateColorType_Min(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateColorType#getRepeat <em>Repeat</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Repeat</em>'. * @see org.w3._2001.smil20.language.AnimateColorType#getRepeat() * @see #getAnimateColorType() * @generated */ EAttribute getAnimateColorType_Repeat(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateColorType#getRepeatCount <em>Repeat Count</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Repeat Count</em>'. * @see org.w3._2001.smil20.language.AnimateColorType#getRepeatCount() * @see #getAnimateColorType() * @generated */ EAttribute getAnimateColorType_RepeatCount(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateColorType#getRepeatDur <em>Repeat Dur</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Repeat Dur</em>'. * @see org.w3._2001.smil20.language.AnimateColorType#getRepeatDur() * @see #getAnimateColorType() * @generated */ EAttribute getAnimateColorType_RepeatDur(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateColorType#getRestart <em>Restart</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Restart</em>'. * @see org.w3._2001.smil20.language.AnimateColorType#getRestart() * @see #getAnimateColorType() * @generated */ EAttribute getAnimateColorType_Restart(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateColorType#getRestartDefault <em>Restart Default</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Restart Default</em>'. * @see org.w3._2001.smil20.language.AnimateColorType#getRestartDefault() * @see #getAnimateColorType() * @generated */ EAttribute getAnimateColorType_RestartDefault(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateColorType#isSkipContent <em>Skip Content</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Skip Content</em>'. * @see org.w3._2001.smil20.language.AnimateColorType#isSkipContent() * @see #getAnimateColorType() * @generated */ EAttribute getAnimateColorType_SkipContent(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateColorType#getSyncBehavior <em>Sync Behavior</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Sync Behavior</em>'. * @see org.w3._2001.smil20.language.AnimateColorType#getSyncBehavior() * @see #getAnimateColorType() * @generated */ EAttribute getAnimateColorType_SyncBehavior(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateColorType#getSyncBehaviorDefault <em>Sync Behavior Default</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Sync Behavior Default</em>'. * @see org.w3._2001.smil20.language.AnimateColorType#getSyncBehaviorDefault() * @see #getAnimateColorType() * @generated */ EAttribute getAnimateColorType_SyncBehaviorDefault(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateColorType#getSyncTolerance <em>Sync Tolerance</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Sync Tolerance</em>'. * @see org.w3._2001.smil20.language.AnimateColorType#getSyncTolerance() * @see #getAnimateColorType() * @generated */ EAttribute getAnimateColorType_SyncTolerance(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateColorType#getSyncToleranceDefault <em>Sync Tolerance Default</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Sync Tolerance Default</em>'. * @see org.w3._2001.smil20.language.AnimateColorType#getSyncToleranceDefault() * @see #getAnimateColorType() * @generated */ EAttribute getAnimateColorType_SyncToleranceDefault(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateColorType#getTargetElement <em>Target Element</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Target Element</em>'. * @see org.w3._2001.smil20.language.AnimateColorType#getTargetElement() * @see #getAnimateColorType() * @generated */ EAttribute getAnimateColorType_TargetElement(); /** * Returns the meta object for the attribute list '{@link org.w3._2001.smil20.language.AnimateColorType#getAnyAttribute <em>Any Attribute</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute list '<em>Any Attribute</em>'. * @see org.w3._2001.smil20.language.AnimateColorType#getAnyAttribute() * @see #getAnimateColorType() * @generated */ EAttribute getAnimateColorType_AnyAttribute(); /** * Returns the meta object for class '{@link org.w3._2001.smil20.language.AnimateMotionType <em>Animate Motion Type</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for class '<em>Animate Motion Type</em>'. * @see org.w3._2001.smil20.language.AnimateMotionType * @generated */ EClass getAnimateMotionType(); /** * Returns the meta object for the attribute list '{@link org.w3._2001.smil20.language.AnimateMotionType#getGroup <em>Group</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute list '<em>Group</em>'. * @see org.w3._2001.smil20.language.AnimateMotionType#getGroup() * @see #getAnimateMotionType() * @generated */ EAttribute getAnimateMotionType_Group(); /** * Returns the meta object for the attribute list '{@link org.w3._2001.smil20.language.AnimateMotionType#getAny <em>Any</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute list '<em>Any</em>'. * @see org.w3._2001.smil20.language.AnimateMotionType#getAny() * @see #getAnimateMotionType() * @generated */ EAttribute getAnimateMotionType_Any(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateMotionType#getAlt <em>Alt</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Alt</em>'. * @see org.w3._2001.smil20.language.AnimateMotionType#getAlt() * @see #getAnimateMotionType() * @generated */ EAttribute getAnimateMotionType_Alt(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateMotionType#getBegin <em>Begin</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Begin</em>'. * @see org.w3._2001.smil20.language.AnimateMotionType#getBegin() * @see #getAnimateMotionType() * @generated */ EAttribute getAnimateMotionType_Begin(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateMotionType#getCalcMode <em>Calc Mode</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Calc Mode</em>'. * @see org.w3._2001.smil20.language.AnimateMotionType#getCalcMode() * @see #getAnimateMotionType() * @generated */ EAttribute getAnimateMotionType_CalcMode(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateMotionType#getClass_ <em>Class</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Class</em>'. * @see org.w3._2001.smil20.language.AnimateMotionType#getClass_() * @see #getAnimateMotionType() * @generated */ EAttribute getAnimateMotionType_Class(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateMotionType#getDur <em>Dur</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Dur</em>'. * @see org.w3._2001.smil20.language.AnimateMotionType#getDur() * @see #getAnimateMotionType() * @generated */ EAttribute getAnimateMotionType_Dur(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateMotionType#getEnd <em>End</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>End</em>'. * @see org.w3._2001.smil20.language.AnimateMotionType#getEnd() * @see #getAnimateMotionType() * @generated */ EAttribute getAnimateMotionType_End(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateMotionType#getFill <em>Fill</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Fill</em>'. * @see org.w3._2001.smil20.language.AnimateMotionType#getFill() * @see #getAnimateMotionType() * @generated */ EAttribute getAnimateMotionType_Fill(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateMotionType#getFillDefault <em>Fill Default</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Fill Default</em>'. * @see org.w3._2001.smil20.language.AnimateMotionType#getFillDefault() * @see #getAnimateMotionType() * @generated */ EAttribute getAnimateMotionType_FillDefault(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateMotionType#getId <em>Id</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Id</em>'. * @see org.w3._2001.smil20.language.AnimateMotionType#getId() * @see #getAnimateMotionType() * @generated */ EAttribute getAnimateMotionType_Id(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateMotionType#getLang <em>Lang</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Lang</em>'. * @see org.w3._2001.smil20.language.AnimateMotionType#getLang() * @see #getAnimateMotionType() * @generated */ EAttribute getAnimateMotionType_Lang(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateMotionType#getLongdesc <em>Longdesc</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Longdesc</em>'. * @see org.w3._2001.smil20.language.AnimateMotionType#getLongdesc() * @see #getAnimateMotionType() * @generated */ EAttribute getAnimateMotionType_Longdesc(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateMotionType#getMax <em>Max</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Max</em>'. * @see org.w3._2001.smil20.language.AnimateMotionType#getMax() * @see #getAnimateMotionType() * @generated */ EAttribute getAnimateMotionType_Max(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateMotionType#getMin <em>Min</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Min</em>'. * @see org.w3._2001.smil20.language.AnimateMotionType#getMin() * @see #getAnimateMotionType() * @generated */ EAttribute getAnimateMotionType_Min(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateMotionType#getRepeat <em>Repeat</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Repeat</em>'. * @see org.w3._2001.smil20.language.AnimateMotionType#getRepeat() * @see #getAnimateMotionType() * @generated */ EAttribute getAnimateMotionType_Repeat(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateMotionType#getRepeatCount <em>Repeat Count</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Repeat Count</em>'. * @see org.w3._2001.smil20.language.AnimateMotionType#getRepeatCount() * @see #getAnimateMotionType() * @generated */ EAttribute getAnimateMotionType_RepeatCount(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateMotionType#getRepeatDur <em>Repeat Dur</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Repeat Dur</em>'. * @see org.w3._2001.smil20.language.AnimateMotionType#getRepeatDur() * @see #getAnimateMotionType() * @generated */ EAttribute getAnimateMotionType_RepeatDur(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateMotionType#getRestart <em>Restart</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Restart</em>'. * @see org.w3._2001.smil20.language.AnimateMotionType#getRestart() * @see #getAnimateMotionType() * @generated */ EAttribute getAnimateMotionType_Restart(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateMotionType#getRestartDefault <em>Restart Default</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Restart Default</em>'. * @see org.w3._2001.smil20.language.AnimateMotionType#getRestartDefault() * @see #getAnimateMotionType() * @generated */ EAttribute getAnimateMotionType_RestartDefault(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateMotionType#isSkipContent <em>Skip Content</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Skip Content</em>'. * @see org.w3._2001.smil20.language.AnimateMotionType#isSkipContent() * @see #getAnimateMotionType() * @generated */ EAttribute getAnimateMotionType_SkipContent(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateMotionType#getSyncBehavior <em>Sync Behavior</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Sync Behavior</em>'. * @see org.w3._2001.smil20.language.AnimateMotionType#getSyncBehavior() * @see #getAnimateMotionType() * @generated */ EAttribute getAnimateMotionType_SyncBehavior(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateMotionType#getSyncBehaviorDefault <em>Sync Behavior Default</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Sync Behavior Default</em>'. * @see org.w3._2001.smil20.language.AnimateMotionType#getSyncBehaviorDefault() * @see #getAnimateMotionType() * @generated */ EAttribute getAnimateMotionType_SyncBehaviorDefault(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateMotionType#getSyncTolerance <em>Sync Tolerance</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Sync Tolerance</em>'. * @see org.w3._2001.smil20.language.AnimateMotionType#getSyncTolerance() * @see #getAnimateMotionType() * @generated */ EAttribute getAnimateMotionType_SyncTolerance(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateMotionType#getSyncToleranceDefault <em>Sync Tolerance Default</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Sync Tolerance Default</em>'. * @see org.w3._2001.smil20.language.AnimateMotionType#getSyncToleranceDefault() * @see #getAnimateMotionType() * @generated */ EAttribute getAnimateMotionType_SyncToleranceDefault(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateMotionType#getTargetElement <em>Target Element</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Target Element</em>'. * @see org.w3._2001.smil20.language.AnimateMotionType#getTargetElement() * @see #getAnimateMotionType() * @generated */ EAttribute getAnimateMotionType_TargetElement(); /** * Returns the meta object for the attribute list '{@link org.w3._2001.smil20.language.AnimateMotionType#getAnyAttribute <em>Any Attribute</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute list '<em>Any Attribute</em>'. * @see org.w3._2001.smil20.language.AnimateMotionType#getAnyAttribute() * @see #getAnimateMotionType() * @generated */ EAttribute getAnimateMotionType_AnyAttribute(); /** * Returns the meta object for class '{@link org.w3._2001.smil20.language.AnimateType <em>Animate Type</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for class '<em>Animate Type</em>'. * @see org.w3._2001.smil20.language.AnimateType * @generated */ EClass getAnimateType(); /** * Returns the meta object for the attribute list '{@link org.w3._2001.smil20.language.AnimateType#getGroup <em>Group</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute list '<em>Group</em>'. * @see org.w3._2001.smil20.language.AnimateType#getGroup() * @see #getAnimateType() * @generated */ EAttribute getAnimateType_Group(); /** * Returns the meta object for the attribute list '{@link org.w3._2001.smil20.language.AnimateType#getAny <em>Any</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute list '<em>Any</em>'. * @see org.w3._2001.smil20.language.AnimateType#getAny() * @see #getAnimateType() * @generated */ EAttribute getAnimateType_Any(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateType#getAlt <em>Alt</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Alt</em>'. * @see org.w3._2001.smil20.language.AnimateType#getAlt() * @see #getAnimateType() * @generated */ EAttribute getAnimateType_Alt(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateType#getBegin <em>Begin</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Begin</em>'. * @see org.w3._2001.smil20.language.AnimateType#getBegin() * @see #getAnimateType() * @generated */ EAttribute getAnimateType_Begin(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateType#getCalcMode <em>Calc Mode</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Calc Mode</em>'. * @see org.w3._2001.smil20.language.AnimateType#getCalcMode() * @see #getAnimateType() * @generated */ EAttribute getAnimateType_CalcMode(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateType#getClass_ <em>Class</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Class</em>'. * @see org.w3._2001.smil20.language.AnimateType#getClass_() * @see #getAnimateType() * @generated */ EAttribute getAnimateType_Class(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateType#getDur <em>Dur</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Dur</em>'. * @see org.w3._2001.smil20.language.AnimateType#getDur() * @see #getAnimateType() * @generated */ EAttribute getAnimateType_Dur(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateType#getEnd <em>End</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>End</em>'. * @see org.w3._2001.smil20.language.AnimateType#getEnd() * @see #getAnimateType() * @generated */ EAttribute getAnimateType_End(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateType#getFill <em>Fill</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Fill</em>'. * @see org.w3._2001.smil20.language.AnimateType#getFill() * @see #getAnimateType() * @generated */ EAttribute getAnimateType_Fill(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateType#getFillDefault <em>Fill Default</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Fill Default</em>'. * @see org.w3._2001.smil20.language.AnimateType#getFillDefault() * @see #getAnimateType() * @generated */ EAttribute getAnimateType_FillDefault(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateType#getId <em>Id</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Id</em>'. * @see org.w3._2001.smil20.language.AnimateType#getId() * @see #getAnimateType() * @generated */ EAttribute getAnimateType_Id(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateType#getLang <em>Lang</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Lang</em>'. * @see org.w3._2001.smil20.language.AnimateType#getLang() * @see #getAnimateType() * @generated */ EAttribute getAnimateType_Lang(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateType#getLongdesc <em>Longdesc</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Longdesc</em>'. * @see org.w3._2001.smil20.language.AnimateType#getLongdesc() * @see #getAnimateType() * @generated */ EAttribute getAnimateType_Longdesc(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateType#getMax <em>Max</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Max</em>'. * @see org.w3._2001.smil20.language.AnimateType#getMax() * @see #getAnimateType() * @generated */ EAttribute getAnimateType_Max(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateType#getMin <em>Min</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Min</em>'. * @see org.w3._2001.smil20.language.AnimateType#getMin() * @see #getAnimateType() * @generated */ EAttribute getAnimateType_Min(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateType#getRepeat <em>Repeat</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Repeat</em>'. * @see org.w3._2001.smil20.language.AnimateType#getRepeat() * @see #getAnimateType() * @generated */ EAttribute getAnimateType_Repeat(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateType#getRepeatCount <em>Repeat Count</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Repeat Count</em>'. * @see org.w3._2001.smil20.language.AnimateType#getRepeatCount() * @see #getAnimateType() * @generated */ EAttribute getAnimateType_RepeatCount(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateType#getRepeatDur <em>Repeat Dur</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Repeat Dur</em>'. * @see org.w3._2001.smil20.language.AnimateType#getRepeatDur() * @see #getAnimateType() * @generated */ EAttribute getAnimateType_RepeatDur(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateType#getRestart <em>Restart</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Restart</em>'. * @see org.w3._2001.smil20.language.AnimateType#getRestart() * @see #getAnimateType() * @generated */ EAttribute getAnimateType_Restart(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateType#getRestartDefault <em>Restart Default</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Restart Default</em>'. * @see org.w3._2001.smil20.language.AnimateType#getRestartDefault() * @see #getAnimateType() * @generated */ EAttribute getAnimateType_RestartDefault(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateType#isSkipContent <em>Skip Content</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Skip Content</em>'. * @see org.w3._2001.smil20.language.AnimateType#isSkipContent() * @see #getAnimateType() * @generated */ EAttribute getAnimateType_SkipContent(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateType#getSyncBehavior <em>Sync Behavior</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Sync Behavior</em>'. * @see org.w3._2001.smil20.language.AnimateType#getSyncBehavior() * @see #getAnimateType() * @generated */ EAttribute getAnimateType_SyncBehavior(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateType#getSyncBehaviorDefault <em>Sync Behavior Default</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Sync Behavior Default</em>'. * @see org.w3._2001.smil20.language.AnimateType#getSyncBehaviorDefault() * @see #getAnimateType() * @generated */ EAttribute getAnimateType_SyncBehaviorDefault(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateType#getSyncTolerance <em>Sync Tolerance</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Sync Tolerance</em>'. * @see org.w3._2001.smil20.language.AnimateType#getSyncTolerance() * @see #getAnimateType() * @generated */ EAttribute getAnimateType_SyncTolerance(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateType#getSyncToleranceDefault <em>Sync Tolerance Default</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Sync Tolerance Default</em>'. * @see org.w3._2001.smil20.language.AnimateType#getSyncToleranceDefault() * @see #getAnimateType() * @generated */ EAttribute getAnimateType_SyncToleranceDefault(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.AnimateType#getTargetElement <em>Target Element</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Target Element</em>'. * @see org.w3._2001.smil20.language.AnimateType#getTargetElement() * @see #getAnimateType() * @generated */ EAttribute getAnimateType_TargetElement(); /** * Returns the meta object for the attribute list '{@link org.w3._2001.smil20.language.AnimateType#getAnyAttribute <em>Any Attribute</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute list '<em>Any Attribute</em>'. * @see org.w3._2001.smil20.language.AnimateType#getAnyAttribute() * @see #getAnimateType() * @generated */ EAttribute getAnimateType_AnyAttribute(); /** * Returns the meta object for class '{@link org.w3._2001.smil20.language.DocumentRoot <em>Document Root</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for class '<em>Document Root</em>'. * @see org.w3._2001.smil20.language.DocumentRoot * @generated */ EClass getDocumentRoot(); /** * Returns the meta object for the attribute list '{@link org.w3._2001.smil20.language.DocumentRoot#getMixed <em>Mixed</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute list '<em>Mixed</em>'. * @see org.w3._2001.smil20.language.DocumentRoot#getMixed() * @see #getDocumentRoot() * @generated */ EAttribute getDocumentRoot_Mixed(); /** * Returns the meta object for the map '{@link org.w3._2001.smil20.language.DocumentRoot#getXMLNSPrefixMap <em>XMLNS Prefix Map</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the map '<em>XMLNS Prefix Map</em>'. * @see org.w3._2001.smil20.language.DocumentRoot#getXMLNSPrefixMap() * @see #getDocumentRoot() * @generated */ EReference getDocumentRoot_XMLNSPrefixMap(); /** * Returns the meta object for the map '{@link org.w3._2001.smil20.language.DocumentRoot#getXSISchemaLocation <em>XSI Schema Location</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the map '<em>XSI Schema Location</em>'. * @see org.w3._2001.smil20.language.DocumentRoot#getXSISchemaLocation() * @see #getDocumentRoot() * @generated */ EReference getDocumentRoot_XSISchemaLocation(); /** * Returns the meta object for the containment reference '{@link org.w3._2001.smil20.language.DocumentRoot#getAnimate <em>Animate</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the containment reference '<em>Animate</em>'. * @see org.w3._2001.smil20.language.DocumentRoot#getAnimate() * @see #getDocumentRoot() * @generated */ EReference getDocumentRoot_Animate(); /** * Returns the meta object for the containment reference '{@link org.w3._2001.smil20.language.DocumentRoot#getAnimateColor <em>Animate Color</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the containment reference '<em>Animate Color</em>'. * @see org.w3._2001.smil20.language.DocumentRoot#getAnimateColor() * @see #getDocumentRoot() * @generated */ EReference getDocumentRoot_AnimateColor(); /** * Returns the meta object for the containment reference '{@link org.w3._2001.smil20.language.DocumentRoot#getAnimateMotion <em>Animate Motion</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the containment reference '<em>Animate Motion</em>'. * @see org.w3._2001.smil20.language.DocumentRoot#getAnimateMotion() * @see #getDocumentRoot() * @generated */ EReference getDocumentRoot_AnimateMotion(); /** * Returns the meta object for the containment reference '{@link org.w3._2001.smil20.language.DocumentRoot#getSet <em>Set</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the containment reference '<em>Set</em>'. * @see org.w3._2001.smil20.language.DocumentRoot#getSet() * @see #getDocumentRoot() * @generated */ EReference getDocumentRoot_Set(); /** * Returns the meta object for class '{@link org.w3._2001.smil20.language.SetType <em>Set Type</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for class '<em>Set Type</em>'. * @see org.w3._2001.smil20.language.SetType * @generated */ EClass getSetType(); /** * Returns the meta object for the attribute list '{@link org.w3._2001.smil20.language.SetType#getGroup <em>Group</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute list '<em>Group</em>'. * @see org.w3._2001.smil20.language.SetType#getGroup() * @see #getSetType() * @generated */ EAttribute getSetType_Group(); /** * Returns the meta object for the attribute list '{@link org.w3._2001.smil20.language.SetType#getAny <em>Any</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute list '<em>Any</em>'. * @see org.w3._2001.smil20.language.SetType#getAny() * @see #getSetType() * @generated */ EAttribute getSetType_Any(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.SetType#getAlt <em>Alt</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Alt</em>'. * @see org.w3._2001.smil20.language.SetType#getAlt() * @see #getSetType() * @generated */ EAttribute getSetType_Alt(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.SetType#getBegin <em>Begin</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Begin</em>'. * @see org.w3._2001.smil20.language.SetType#getBegin() * @see #getSetType() * @generated */ EAttribute getSetType_Begin(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.SetType#getClass_ <em>Class</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Class</em>'. * @see org.w3._2001.smil20.language.SetType#getClass_() * @see #getSetType() * @generated */ EAttribute getSetType_Class(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.SetType#getDur <em>Dur</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Dur</em>'. * @see org.w3._2001.smil20.language.SetType#getDur() * @see #getSetType() * @generated */ EAttribute getSetType_Dur(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.SetType#getEnd <em>End</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>End</em>'. * @see org.w3._2001.smil20.language.SetType#getEnd() * @see #getSetType() * @generated */ EAttribute getSetType_End(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.SetType#getFill <em>Fill</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Fill</em>'. * @see org.w3._2001.smil20.language.SetType#getFill() * @see #getSetType() * @generated */ EAttribute getSetType_Fill(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.SetType#getFillDefault <em>Fill Default</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Fill Default</em>'. * @see org.w3._2001.smil20.language.SetType#getFillDefault() * @see #getSetType() * @generated */ EAttribute getSetType_FillDefault(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.SetType#getId <em>Id</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Id</em>'. * @see org.w3._2001.smil20.language.SetType#getId() * @see #getSetType() * @generated */ EAttribute getSetType_Id(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.SetType#getLang <em>Lang</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Lang</em>'. * @see org.w3._2001.smil20.language.SetType#getLang() * @see #getSetType() * @generated */ EAttribute getSetType_Lang(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.SetType#getLongdesc <em>Longdesc</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Longdesc</em>'. * @see org.w3._2001.smil20.language.SetType#getLongdesc() * @see #getSetType() * @generated */ EAttribute getSetType_Longdesc(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.SetType#getMax <em>Max</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Max</em>'. * @see org.w3._2001.smil20.language.SetType#getMax() * @see #getSetType() * @generated */ EAttribute getSetType_Max(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.SetType#getMin <em>Min</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Min</em>'. * @see org.w3._2001.smil20.language.SetType#getMin() * @see #getSetType() * @generated */ EAttribute getSetType_Min(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.SetType#getRepeat <em>Repeat</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Repeat</em>'. * @see org.w3._2001.smil20.language.SetType#getRepeat() * @see #getSetType() * @generated */ EAttribute getSetType_Repeat(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.SetType#getRepeatCount <em>Repeat Count</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Repeat Count</em>'. * @see org.w3._2001.smil20.language.SetType#getRepeatCount() * @see #getSetType() * @generated */ EAttribute getSetType_RepeatCount(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.SetType#getRepeatDur <em>Repeat Dur</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Repeat Dur</em>'. * @see org.w3._2001.smil20.language.SetType#getRepeatDur() * @see #getSetType() * @generated */ EAttribute getSetType_RepeatDur(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.SetType#getRestart <em>Restart</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Restart</em>'. * @see org.w3._2001.smil20.language.SetType#getRestart() * @see #getSetType() * @generated */ EAttribute getSetType_Restart(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.SetType#getRestartDefault <em>Restart Default</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Restart Default</em>'. * @see org.w3._2001.smil20.language.SetType#getRestartDefault() * @see #getSetType() * @generated */ EAttribute getSetType_RestartDefault(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.SetType#isSkipContent <em>Skip Content</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Skip Content</em>'. * @see org.w3._2001.smil20.language.SetType#isSkipContent() * @see #getSetType() * @generated */ EAttribute getSetType_SkipContent(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.SetType#getSyncBehavior <em>Sync Behavior</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Sync Behavior</em>'. * @see org.w3._2001.smil20.language.SetType#getSyncBehavior() * @see #getSetType() * @generated */ EAttribute getSetType_SyncBehavior(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.SetType#getSyncBehaviorDefault <em>Sync Behavior Default</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Sync Behavior Default</em>'. * @see org.w3._2001.smil20.language.SetType#getSyncBehaviorDefault() * @see #getSetType() * @generated */ EAttribute getSetType_SyncBehaviorDefault(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.SetType#getSyncTolerance <em>Sync Tolerance</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Sync Tolerance</em>'. * @see org.w3._2001.smil20.language.SetType#getSyncTolerance() * @see #getSetType() * @generated */ EAttribute getSetType_SyncTolerance(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.SetType#getSyncToleranceDefault <em>Sync Tolerance Default</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Sync Tolerance Default</em>'. * @see org.w3._2001.smil20.language.SetType#getSyncToleranceDefault() * @see #getSetType() * @generated */ EAttribute getSetType_SyncToleranceDefault(); /** * Returns the meta object for the attribute '{@link org.w3._2001.smil20.language.SetType#getTargetElement <em>Target Element</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Target Element</em>'. * @see org.w3._2001.smil20.language.SetType#getTargetElement() * @see #getSetType() * @generated */ EAttribute getSetType_TargetElement(); /** * Returns the meta object for the attribute list '{@link org.w3._2001.smil20.language.SetType#getAnyAttribute <em>Any Attribute</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute list '<em>Any Attribute</em>'. * @see org.w3._2001.smil20.language.SetType#getAnyAttribute() * @see #getSetType() * @generated */ EAttribute getSetType_AnyAttribute(); /** * Returns the factory that creates the instances of the model. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the factory that creates the instances of the model. * @generated */ LanguageFactory getLanguageFactory(); /** * <!-- begin-user-doc --> * Defines literals for the meta objects that represent * <ul> * <li>each class,</li> * <li>each feature of each class,</li> * <li>each operation of each class,</li> * <li>each enum,</li> * <li>and each data type</li> * </ul> * <!-- end-user-doc --> * @generated */ interface Literals { /** * The meta object literal for the '{@link org.w3._2001.smil20.language.impl.AnimateColorTypeImpl <em>Animate Color Type</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see org.w3._2001.smil20.language.impl.AnimateColorTypeImpl * @see org.w3._2001.smil20.language.impl.LanguagePackageImpl#getAnimateColorType() * @generated */ EClass ANIMATE_COLOR_TYPE = eINSTANCE.getAnimateColorType(); /** * The meta object literal for the '<em><b>Group</b></em>' attribute list feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_COLOR_TYPE__GROUP = eINSTANCE.getAnimateColorType_Group(); /** * The meta object literal for the '<em><b>Any</b></em>' attribute list feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_COLOR_TYPE__ANY = eINSTANCE.getAnimateColorType_Any(); /** * The meta object literal for the '<em><b>Alt</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_COLOR_TYPE__ALT = eINSTANCE.getAnimateColorType_Alt(); /** * The meta object literal for the '<em><b>Begin</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_COLOR_TYPE__BEGIN = eINSTANCE.getAnimateColorType_Begin(); /** * The meta object literal for the '<em><b>Calc Mode</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_COLOR_TYPE__CALC_MODE = eINSTANCE.getAnimateColorType_CalcMode(); /** * The meta object literal for the '<em><b>Class</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_COLOR_TYPE__CLASS = eINSTANCE.getAnimateColorType_Class(); /** * The meta object literal for the '<em><b>Dur</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_COLOR_TYPE__DUR = eINSTANCE.getAnimateColorType_Dur(); /** * The meta object literal for the '<em><b>End</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_COLOR_TYPE__END = eINSTANCE.getAnimateColorType_End(); /** * The meta object literal for the '<em><b>Fill</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_COLOR_TYPE__FILL = eINSTANCE.getAnimateColorType_Fill(); /** * The meta object literal for the '<em><b>Fill Default</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_COLOR_TYPE__FILL_DEFAULT = eINSTANCE.getAnimateColorType_FillDefault(); /** * The meta object literal for the '<em><b>Id</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_COLOR_TYPE__ID = eINSTANCE.getAnimateColorType_Id(); /** * The meta object literal for the '<em><b>Lang</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_COLOR_TYPE__LANG = eINSTANCE.getAnimateColorType_Lang(); /** * The meta object literal for the '<em><b>Longdesc</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_COLOR_TYPE__LONGDESC = eINSTANCE.getAnimateColorType_Longdesc(); /** * The meta object literal for the '<em><b>Max</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_COLOR_TYPE__MAX = eINSTANCE.getAnimateColorType_Max(); /** * The meta object literal for the '<em><b>Min</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_COLOR_TYPE__MIN = eINSTANCE.getAnimateColorType_Min(); /** * The meta object literal for the '<em><b>Repeat</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_COLOR_TYPE__REPEAT = eINSTANCE.getAnimateColorType_Repeat(); /** * The meta object literal for the '<em><b>Repeat Count</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_COLOR_TYPE__REPEAT_COUNT = eINSTANCE.getAnimateColorType_RepeatCount(); /** * The meta object literal for the '<em><b>Repeat Dur</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_COLOR_TYPE__REPEAT_DUR = eINSTANCE.getAnimateColorType_RepeatDur(); /** * The meta object literal for the '<em><b>Restart</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_COLOR_TYPE__RESTART = eINSTANCE.getAnimateColorType_Restart(); /** * The meta object literal for the '<em><b>Restart Default</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_COLOR_TYPE__RESTART_DEFAULT = eINSTANCE.getAnimateColorType_RestartDefault(); /** * The meta object literal for the '<em><b>Skip Content</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_COLOR_TYPE__SKIP_CONTENT = eINSTANCE.getAnimateColorType_SkipContent(); /** * The meta object literal for the '<em><b>Sync Behavior</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_COLOR_TYPE__SYNC_BEHAVIOR = eINSTANCE.getAnimateColorType_SyncBehavior(); /** * The meta object literal for the '<em><b>Sync Behavior Default</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_COLOR_TYPE__SYNC_BEHAVIOR_DEFAULT = eINSTANCE.getAnimateColorType_SyncBehaviorDefault(); /** * The meta object literal for the '<em><b>Sync Tolerance</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_COLOR_TYPE__SYNC_TOLERANCE = eINSTANCE.getAnimateColorType_SyncTolerance(); /** * The meta object literal for the '<em><b>Sync Tolerance Default</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_COLOR_TYPE__SYNC_TOLERANCE_DEFAULT = eINSTANCE.getAnimateColorType_SyncToleranceDefault(); /** * The meta object literal for the '<em><b>Target Element</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_COLOR_TYPE__TARGET_ELEMENT = eINSTANCE.getAnimateColorType_TargetElement(); /** * The meta object literal for the '<em><b>Any Attribute</b></em>' attribute list feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_COLOR_TYPE__ANY_ATTRIBUTE = eINSTANCE.getAnimateColorType_AnyAttribute(); /** * The meta object literal for the '{@link org.w3._2001.smil20.language.impl.AnimateMotionTypeImpl <em>Animate Motion Type</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see org.w3._2001.smil20.language.impl.AnimateMotionTypeImpl * @see org.w3._2001.smil20.language.impl.LanguagePackageImpl#getAnimateMotionType() * @generated */ EClass ANIMATE_MOTION_TYPE = eINSTANCE.getAnimateMotionType(); /** * The meta object literal for the '<em><b>Group</b></em>' attribute list feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_MOTION_TYPE__GROUP = eINSTANCE.getAnimateMotionType_Group(); /** * The meta object literal for the '<em><b>Any</b></em>' attribute list feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_MOTION_TYPE__ANY = eINSTANCE.getAnimateMotionType_Any(); /** * The meta object literal for the '<em><b>Alt</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_MOTION_TYPE__ALT = eINSTANCE.getAnimateMotionType_Alt(); /** * The meta object literal for the '<em><b>Begin</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_MOTION_TYPE__BEGIN = eINSTANCE.getAnimateMotionType_Begin(); /** * The meta object literal for the '<em><b>Calc Mode</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_MOTION_TYPE__CALC_MODE = eINSTANCE.getAnimateMotionType_CalcMode(); /** * The meta object literal for the '<em><b>Class</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_MOTION_TYPE__CLASS = eINSTANCE.getAnimateMotionType_Class(); /** * The meta object literal for the '<em><b>Dur</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_MOTION_TYPE__DUR = eINSTANCE.getAnimateMotionType_Dur(); /** * The meta object literal for the '<em><b>End</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_MOTION_TYPE__END = eINSTANCE.getAnimateMotionType_End(); /** * The meta object literal for the '<em><b>Fill</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_MOTION_TYPE__FILL = eINSTANCE.getAnimateMotionType_Fill(); /** * The meta object literal for the '<em><b>Fill Default</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_MOTION_TYPE__FILL_DEFAULT = eINSTANCE.getAnimateMotionType_FillDefault(); /** * The meta object literal for the '<em><b>Id</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_MOTION_TYPE__ID = eINSTANCE.getAnimateMotionType_Id(); /** * The meta object literal for the '<em><b>Lang</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_MOTION_TYPE__LANG = eINSTANCE.getAnimateMotionType_Lang(); /** * The meta object literal for the '<em><b>Longdesc</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_MOTION_TYPE__LONGDESC = eINSTANCE.getAnimateMotionType_Longdesc(); /** * The meta object literal for the '<em><b>Max</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_MOTION_TYPE__MAX = eINSTANCE.getAnimateMotionType_Max(); /** * The meta object literal for the '<em><b>Min</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_MOTION_TYPE__MIN = eINSTANCE.getAnimateMotionType_Min(); /** * The meta object literal for the '<em><b>Repeat</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_MOTION_TYPE__REPEAT = eINSTANCE.getAnimateMotionType_Repeat(); /** * The meta object literal for the '<em><b>Repeat Count</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_MOTION_TYPE__REPEAT_COUNT = eINSTANCE.getAnimateMotionType_RepeatCount(); /** * The meta object literal for the '<em><b>Repeat Dur</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_MOTION_TYPE__REPEAT_DUR = eINSTANCE.getAnimateMotionType_RepeatDur(); /** * The meta object literal for the '<em><b>Restart</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_MOTION_TYPE__RESTART = eINSTANCE.getAnimateMotionType_Restart(); /** * The meta object literal for the '<em><b>Restart Default</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_MOTION_TYPE__RESTART_DEFAULT = eINSTANCE.getAnimateMotionType_RestartDefault(); /** * The meta object literal for the '<em><b>Skip Content</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_MOTION_TYPE__SKIP_CONTENT = eINSTANCE.getAnimateMotionType_SkipContent(); /** * The meta object literal for the '<em><b>Sync Behavior</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_MOTION_TYPE__SYNC_BEHAVIOR = eINSTANCE.getAnimateMotionType_SyncBehavior(); /** * The meta object literal for the '<em><b>Sync Behavior Default</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_MOTION_TYPE__SYNC_BEHAVIOR_DEFAULT = eINSTANCE.getAnimateMotionType_SyncBehaviorDefault(); /** * The meta object literal for the '<em><b>Sync Tolerance</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_MOTION_TYPE__SYNC_TOLERANCE = eINSTANCE.getAnimateMotionType_SyncTolerance(); /** * The meta object literal for the '<em><b>Sync Tolerance Default</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_MOTION_TYPE__SYNC_TOLERANCE_DEFAULT = eINSTANCE.getAnimateMotionType_SyncToleranceDefault(); /** * The meta object literal for the '<em><b>Target Element</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_MOTION_TYPE__TARGET_ELEMENT = eINSTANCE.getAnimateMotionType_TargetElement(); /** * The meta object literal for the '<em><b>Any Attribute</b></em>' attribute list feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_MOTION_TYPE__ANY_ATTRIBUTE = eINSTANCE.getAnimateMotionType_AnyAttribute(); /** * The meta object literal for the '{@link org.w3._2001.smil20.language.impl.AnimateTypeImpl <em>Animate Type</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see org.w3._2001.smil20.language.impl.AnimateTypeImpl * @see org.w3._2001.smil20.language.impl.LanguagePackageImpl#getAnimateType() * @generated */ EClass ANIMATE_TYPE = eINSTANCE.getAnimateType(); /** * The meta object literal for the '<em><b>Group</b></em>' attribute list feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_TYPE__GROUP = eINSTANCE.getAnimateType_Group(); /** * The meta object literal for the '<em><b>Any</b></em>' attribute list feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_TYPE__ANY = eINSTANCE.getAnimateType_Any(); /** * The meta object literal for the '<em><b>Alt</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_TYPE__ALT = eINSTANCE.getAnimateType_Alt(); /** * The meta object literal for the '<em><b>Begin</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_TYPE__BEGIN = eINSTANCE.getAnimateType_Begin(); /** * The meta object literal for the '<em><b>Calc Mode</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_TYPE__CALC_MODE = eINSTANCE.getAnimateType_CalcMode(); /** * The meta object literal for the '<em><b>Class</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_TYPE__CLASS = eINSTANCE.getAnimateType_Class(); /** * The meta object literal for the '<em><b>Dur</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_TYPE__DUR = eINSTANCE.getAnimateType_Dur(); /** * The meta object literal for the '<em><b>End</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_TYPE__END = eINSTANCE.getAnimateType_End(); /** * The meta object literal for the '<em><b>Fill</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_TYPE__FILL = eINSTANCE.getAnimateType_Fill(); /** * The meta object literal for the '<em><b>Fill Default</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_TYPE__FILL_DEFAULT = eINSTANCE.getAnimateType_FillDefault(); /** * The meta object literal for the '<em><b>Id</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_TYPE__ID = eINSTANCE.getAnimateType_Id(); /** * The meta object literal for the '<em><b>Lang</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_TYPE__LANG = eINSTANCE.getAnimateType_Lang(); /** * The meta object literal for the '<em><b>Longdesc</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_TYPE__LONGDESC = eINSTANCE.getAnimateType_Longdesc(); /** * The meta object literal for the '<em><b>Max</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_TYPE__MAX = eINSTANCE.getAnimateType_Max(); /** * The meta object literal for the '<em><b>Min</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_TYPE__MIN = eINSTANCE.getAnimateType_Min(); /** * The meta object literal for the '<em><b>Repeat</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_TYPE__REPEAT = eINSTANCE.getAnimateType_Repeat(); /** * The meta object literal for the '<em><b>Repeat Count</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_TYPE__REPEAT_COUNT = eINSTANCE.getAnimateType_RepeatCount(); /** * The meta object literal for the '<em><b>Repeat Dur</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_TYPE__REPEAT_DUR = eINSTANCE.getAnimateType_RepeatDur(); /** * The meta object literal for the '<em><b>Restart</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_TYPE__RESTART = eINSTANCE.getAnimateType_Restart(); /** * The meta object literal for the '<em><b>Restart Default</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_TYPE__RESTART_DEFAULT = eINSTANCE.getAnimateType_RestartDefault(); /** * The meta object literal for the '<em><b>Skip Content</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_TYPE__SKIP_CONTENT = eINSTANCE.getAnimateType_SkipContent(); /** * The meta object literal for the '<em><b>Sync Behavior</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_TYPE__SYNC_BEHAVIOR = eINSTANCE.getAnimateType_SyncBehavior(); /** * The meta object literal for the '<em><b>Sync Behavior Default</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_TYPE__SYNC_BEHAVIOR_DEFAULT = eINSTANCE.getAnimateType_SyncBehaviorDefault(); /** * The meta object literal for the '<em><b>Sync Tolerance</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_TYPE__SYNC_TOLERANCE = eINSTANCE.getAnimateType_SyncTolerance(); /** * The meta object literal for the '<em><b>Sync Tolerance Default</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_TYPE__SYNC_TOLERANCE_DEFAULT = eINSTANCE.getAnimateType_SyncToleranceDefault(); /** * The meta object literal for the '<em><b>Target Element</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_TYPE__TARGET_ELEMENT = eINSTANCE.getAnimateType_TargetElement(); /** * The meta object literal for the '<em><b>Any Attribute</b></em>' attribute list feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute ANIMATE_TYPE__ANY_ATTRIBUTE = eINSTANCE.getAnimateType_AnyAttribute(); /** * The meta object literal for the '{@link org.w3._2001.smil20.language.impl.DocumentRootImpl <em>Document Root</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see org.w3._2001.smil20.language.impl.DocumentRootImpl * @see org.w3._2001.smil20.language.impl.LanguagePackageImpl#getDocumentRoot() * @generated */ EClass DOCUMENT_ROOT = eINSTANCE.getDocumentRoot(); /** * The meta object literal for the '<em><b>Mixed</b></em>' attribute list feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute DOCUMENT_ROOT__MIXED = eINSTANCE.getDocumentRoot_Mixed(); /** * The meta object literal for the '<em><b>XMLNS Prefix Map</b></em>' map feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EReference DOCUMENT_ROOT__XMLNS_PREFIX_MAP = eINSTANCE.getDocumentRoot_XMLNSPrefixMap(); /** * The meta object literal for the '<em><b>XSI Schema Location</b></em>' map feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EReference DOCUMENT_ROOT__XSI_SCHEMA_LOCATION = eINSTANCE.getDocumentRoot_XSISchemaLocation(); /** * The meta object literal for the '<em><b>Animate</b></em>' containment reference feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EReference DOCUMENT_ROOT__ANIMATE = eINSTANCE.getDocumentRoot_Animate(); /** * The meta object literal for the '<em><b>Animate Color</b></em>' containment reference feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EReference DOCUMENT_ROOT__ANIMATE_COLOR = eINSTANCE.getDocumentRoot_AnimateColor(); /** * The meta object literal for the '<em><b>Animate Motion</b></em>' containment reference feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EReference DOCUMENT_ROOT__ANIMATE_MOTION = eINSTANCE.getDocumentRoot_AnimateMotion(); /** * The meta object literal for the '<em><b>Set</b></em>' containment reference feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EReference DOCUMENT_ROOT__SET = eINSTANCE.getDocumentRoot_Set(); /** * The meta object literal for the '{@link org.w3._2001.smil20.language.impl.SetTypeImpl <em>Set Type</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see org.w3._2001.smil20.language.impl.SetTypeImpl * @see org.w3._2001.smil20.language.impl.LanguagePackageImpl#getSetType() * @generated */ EClass SET_TYPE = eINSTANCE.getSetType(); /** * The meta object literal for the '<em><b>Group</b></em>' attribute list feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute SET_TYPE__GROUP = eINSTANCE.getSetType_Group(); /** * The meta object literal for the '<em><b>Any</b></em>' attribute list feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute SET_TYPE__ANY = eINSTANCE.getSetType_Any(); /** * The meta object literal for the '<em><b>Alt</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute SET_TYPE__ALT = eINSTANCE.getSetType_Alt(); /** * The meta object literal for the '<em><b>Begin</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute SET_TYPE__BEGIN = eINSTANCE.getSetType_Begin(); /** * The meta object literal for the '<em><b>Class</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute SET_TYPE__CLASS = eINSTANCE.getSetType_Class(); /** * The meta object literal for the '<em><b>Dur</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute SET_TYPE__DUR = eINSTANCE.getSetType_Dur(); /** * The meta object literal for the '<em><b>End</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute SET_TYPE__END = eINSTANCE.getSetType_End(); /** * The meta object literal for the '<em><b>Fill</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute SET_TYPE__FILL = eINSTANCE.getSetType_Fill(); /** * The meta object literal for the '<em><b>Fill Default</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute SET_TYPE__FILL_DEFAULT = eINSTANCE.getSetType_FillDefault(); /** * The meta object literal for the '<em><b>Id</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute SET_TYPE__ID = eINSTANCE.getSetType_Id(); /** * The meta object literal for the '<em><b>Lang</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute SET_TYPE__LANG = eINSTANCE.getSetType_Lang(); /** * The meta object literal for the '<em><b>Longdesc</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute SET_TYPE__LONGDESC = eINSTANCE.getSetType_Longdesc(); /** * The meta object literal for the '<em><b>Max</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute SET_TYPE__MAX = eINSTANCE.getSetType_Max(); /** * The meta object literal for the '<em><b>Min</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute SET_TYPE__MIN = eINSTANCE.getSetType_Min(); /** * The meta object literal for the '<em><b>Repeat</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute SET_TYPE__REPEAT = eINSTANCE.getSetType_Repeat(); /** * The meta object literal for the '<em><b>Repeat Count</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute SET_TYPE__REPEAT_COUNT = eINSTANCE.getSetType_RepeatCount(); /** * The meta object literal for the '<em><b>Repeat Dur</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute SET_TYPE__REPEAT_DUR = eINSTANCE.getSetType_RepeatDur(); /** * The meta object literal for the '<em><b>Restart</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute SET_TYPE__RESTART = eINSTANCE.getSetType_Restart(); /** * The meta object literal for the '<em><b>Restart Default</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute SET_TYPE__RESTART_DEFAULT = eINSTANCE.getSetType_RestartDefault(); /** * The meta object literal for the '<em><b>Skip Content</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute SET_TYPE__SKIP_CONTENT = eINSTANCE.getSetType_SkipContent(); /** * The meta object literal for the '<em><b>Sync Behavior</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute SET_TYPE__SYNC_BEHAVIOR = eINSTANCE.getSetType_SyncBehavior(); /** * The meta object literal for the '<em><b>Sync Behavior Default</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute SET_TYPE__SYNC_BEHAVIOR_DEFAULT = eINSTANCE.getSetType_SyncBehaviorDefault(); /** * The meta object literal for the '<em><b>Sync Tolerance</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute SET_TYPE__SYNC_TOLERANCE = eINSTANCE.getSetType_SyncTolerance(); /** * The meta object literal for the '<em><b>Sync Tolerance Default</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute SET_TYPE__SYNC_TOLERANCE_DEFAULT = eINSTANCE.getSetType_SyncToleranceDefault(); /** * The meta object literal for the '<em><b>Target Element</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute SET_TYPE__TARGET_ELEMENT = eINSTANCE.getSetType_TargetElement(); /** * The meta object literal for the '<em><b>Any Attribute</b></em>' attribute list feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ EAttribute SET_TYPE__ANY_ATTRIBUTE = eINSTANCE.getSetType_AnyAttribute(); } } //LanguagePackage
lgpl-2.1
MeshSr/ofs-sw
udatapath/datapath.c
22571
/* Copyright (c) 2008, 2009 The Board of Trustees of The Leland Stanford * Junior University * * We are making the OpenFlow specification and associated documentation * (Software) available for public use and benefit with the expectation * that others will use, modify and enhance the Software and contribute * those enhancements back to the community. However, since we would * like to make the Software available for broadest use, with as few * restrictions as possible permission is hereby granted, free of * charge, to any person obtaining a copy of this Software to deal in * the Software under the copyrights without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * The name and trademarks of copyright holder(s) may NOT be used in * advertising or publicity pertaining to the Software or any * derivatives without specific, written prior permission. */ /* The original Stanford code has been modified during the implementation of * the OpenFlow 1.3 userspace switch. * */ #include "datapath.h" #include <assert.h> #include <errno.h> #include <inttypes.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include "csum.h" #include "dp_buffers.h" #include "dp_control.h" #include "ofp.h" #include "ofpbuf.h" #include "group_table.h" #include "meter_table.h" #include "oflib/ofl.h" #include "oflib-exp/ofl-exp.h" #include "oflib-exp/ofl-exp-nicira.h" #include "oflib/ofl-messages.h" #include "oflib/ofl-log.h" #include "openflow/openflow.h" #include "openflow/nicira-ext.h" #include "openflow/private-ext.h" #include "openflow/openflow-ext.h" #include "pipeline.h" #include "poll-loop.h" #include "rconn.h" #include "stp.h" #include "vconn.h" #define LOG_MODULE VLM_dp static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(60, 60); static struct remote *remote_create(struct datapath *dp, struct rconn *rconn, struct rconn *rconn_aux); static void remote_run(struct datapath *, struct remote *); static void remote_rconn_run(struct datapath *, struct remote *, uint8_t); static void remote_wait(struct remote *); static void remote_destroy(struct remote *); #define MFR_DESC "Stanford University, Ericsson Research and CPqD Research" #define HW_DESC "OpenFlow 1.3 Reference Userspace Switch" #define SW_DESC __DATE__" "__TIME__ #define DP_DESC "OpenFlow 1.3 Reference Userspace Switch Datapath" #define SERIAL_NUM "1" #define MAIN_CONNECTION 0 #define PTIN_CONNECTION 1 /* Callbacks for processing experimenter messages in OFLib. */ static struct ofl_exp_msg dp_exp_msg = {.pack = ofl_exp_msg_pack, .unpack = ofl_exp_msg_unpack, .free = ofl_exp_msg_free, .to_string = ofl_exp_msg_to_string}; static struct ofl_exp dp_exp = {.act = NULL, .inst = NULL, .match = NULL, .stats = NULL, .msg = &dp_exp_msg}; /* Generates and returns a random datapath id. */ static uint64_t gen_datapath_id(void) { uint8_t ea[ETH_ADDR_LEN]; eth_addr_random(ea); return eth_addr_to_uint64(ea); } struct datapath * dp_new(void) { struct datapath *dp; dp = xmalloc(sizeof(struct datapath)); dp->mfr_desc = strncpy(xmalloc(DESC_STR_LEN), MFR_DESC, DESC_STR_LEN); dp->mfr_desc[DESC_STR_LEN-1] = 0x00; dp->hw_desc = strncpy(xmalloc(DESC_STR_LEN), HW_DESC, DESC_STR_LEN); dp->hw_desc[DESC_STR_LEN-1] = 0x00; dp->sw_desc = strncpy(xmalloc(DESC_STR_LEN), SW_DESC, DESC_STR_LEN); dp->sw_desc[DESC_STR_LEN-1] = 0x00; dp->dp_desc = strncpy(xmalloc(DESC_STR_LEN), DP_DESC, DESC_STR_LEN); dp->dp_desc[DESC_STR_LEN-1] = 0x00; dp->serial_num = strncpy(xmalloc(SERIAL_NUM_LEN), SERIAL_NUM, SERIAL_NUM_LEN); dp->serial_num[SERIAL_NUM_LEN-1] = 0x00; dp->id = gen_datapath_id(); dp->generation_id = -1; dp->last_timeout = time_now(); list_init(&dp->remotes); dp->listeners = NULL; dp->n_listeners = 0; dp->listeners_aux = NULL; dp->n_listeners_aux = 0; memset(dp->ports, 0x00, sizeof (dp->ports)); dp->local_port = NULL; dp->buffers = dp_buffers_create(dp); dp->pipeline = pipeline_create(dp); dp->groups = group_table_create(dp); dp->meters = meter_table_create(dp); list_init(&dp->port_list); dp->ports_num = 0; dp->max_queues = NETDEV_MAX_QUEUES; dp->exp = &dp_exp; dp->config.flags = OFPC_FRAG_NORMAL; dp->config.miss_send_len = OFP_DEFAULT_MISS_SEND_LEN; if(strlen(dp->dp_desc) == 0) { /* just use "$HOSTNAME pid=$$" */ char hostnametmp[DESC_STR_LEN]; gethostname(hostnametmp,sizeof hostnametmp); snprintf(dp->dp_desc, sizeof dp->dp_desc,"%s pid=%u",hostnametmp, getpid()); } /* FIXME: Should not depend on udatapath_as_lib */ #if defined(OF_HW_PLAT) && (defined(UDATAPATH_AS_LIB) || defined(USE_NETDEV)) dp_hw_drv_init(dp); #endif return dp; } void dp_add_pvconn(struct datapath *dp, struct pvconn *pvconn, struct pvconn *pvconn_aux) { dp->listeners = xrealloc(dp->listeners, sizeof *dp->listeners * (dp->n_listeners + 1)); dp->listeners[dp->n_listeners++] = pvconn; dp->listeners_aux = xrealloc(dp->listeners_aux, sizeof *dp->listeners_aux * (dp->n_listeners_aux + 1)); dp->listeners_aux[dp->n_listeners_aux++] = pvconn_aux; } void dp_run(struct datapath *dp) { time_t now = time_now(); struct remote *r, *rn; size_t i; if (now != dp->last_timeout) { dp->last_timeout = now; meter_table_add_tokens(dp->meters); pipeline_timeout(dp->pipeline); } poll_timer_wait(1000); dp_ports_run(dp); /* Talk to remotes. */ LIST_FOR_EACH_SAFE (r, rn, struct remote, node, &dp->remotes) { remote_run(dp, r); } for (i = 0; i < dp->n_listeners; ) { struct pvconn *pvconn = dp->listeners[i]; struct vconn *new_vconn; int retval = pvconn_accept(pvconn, OFP_VERSION, &new_vconn); if (!retval) { struct rconn * rconn_aux = NULL; if (dp->n_listeners_aux && dp->listeners_aux[i] != NULL) { struct pvconn *pvconn_aux = dp->listeners_aux[i]; struct vconn *new_vconn_aux; int retval_aux = pvconn_accept(pvconn_aux, OFP_VERSION, &new_vconn_aux); if (!retval_aux) rconn_aux = rconn_new_from_vconn("passive_aux", new_vconn_aux); } remote_create(dp, rconn_new_from_vconn("passive", new_vconn), rconn_aux); } else if (retval != EAGAIN) { VLOG_WARN_RL(LOG_MODULE, &rl, "accept failed (%s)", strerror(retval)); dp->listeners[i] = dp->listeners[--dp->n_listeners]; if (dp->n_listeners_aux) { dp->listeners_aux[i] = dp->listeners_aux[--dp->n_listeners_aux]; } continue; } i++; } } static void remote_run(struct datapath *dp, struct remote *r) { remote_rconn_run(dp, r, MAIN_CONNECTION); if (!rconn_is_alive(r->rconn)) { remote_destroy(r); return; } if (r->rconn_aux == NULL || !rconn_is_alive(r->rconn_aux)) return; remote_rconn_run(dp, r, PTIN_CONNECTION); } static void remote_rconn_run(struct datapath *dp, struct remote *r, uint8_t conn_id) { struct rconn *rconn; ofl_err error; size_t i; if (conn_id == MAIN_CONNECTION) rconn = r->rconn; else if (conn_id == PTIN_CONNECTION) rconn = r->rconn_aux; rconn_run(rconn); /* Do some remote processing, but cap it at a reasonable amount so that * other processing doesn't starve. */ for (i = 0; i < 50; i++) { if (!r->cb_dump) { struct ofpbuf *buffer; buffer = rconn_recv(rconn); if (buffer == NULL) { break; } else { struct ofl_msg_header *msg; struct sender sender = {.remote = r, .conn_id = conn_id}; error = ofl_msg_unpack(buffer->data, buffer->size, &msg, &(sender.xid), dp->exp); if (!error) { error = handle_control_msg(dp, msg, &sender); if (error) { ofl_msg_free(msg, dp->exp); } } if (error) { struct ofl_msg_error err = {{.type = OFPT_ERROR}, .type = ofl_error_type(error), .code = ofl_error_code(error), .data_length = buffer->size, .data = buffer->data}; dp_send_message(dp, (struct ofl_msg_header *)&err, &sender); } ofpbuf_delete(buffer); } } else { if (r->n_txq < TXQ_LIMIT) { int error = r->cb_dump(dp, r->cb_aux); if (error <= 0) { if (error) { VLOG_WARN_RL(LOG_MODULE, &rl, "Callback error: %s.", strerror(-error)); } r->cb_done(r->cb_aux); r->cb_dump = NULL; } } else { break; } } } } static void remote_wait(struct remote *r) { rconn_run_wait(r->rconn); rconn_recv_wait(r->rconn); if (r->rconn_aux) { rconn_run_wait(r->rconn_aux); rconn_recv_wait(r->rconn_aux); } } static void remote_destroy(struct remote *r) { if (r) { if (r->cb_dump && r->cb_done) { r->cb_done(r->cb_aux); } list_remove(&r->node); if (r->rconn_aux != NULL) { rconn_destroy(r->rconn_aux); } rconn_destroy(r->rconn); free(r); } } static struct remote * remote_create(struct datapath *dp, struct rconn *rconn, struct rconn *rconn_aux) { size_t i; struct remote *remote = xmalloc(sizeof *remote); list_push_back(&dp->remotes, &remote->node); remote->rconn = rconn; remote->rconn_aux = rconn_aux; remote->cb_dump = NULL; remote->n_txq = 0; remote->role = OFPCR_ROLE_EQUAL; /* Set the remote configuration to receive any asynchronous message*/ for(i = 0; i < 2; i++){ memset(&remote->config.packet_in_mask[i], 0x7, sizeof(uint32_t)); memset(&remote->config.port_status_mask[i], 0x7, sizeof(uint32_t)); memset(&remote->config.flow_removed_mask[i], 0x1f, sizeof(uint32_t)); } return remote; } void dp_wait(struct datapath *dp) { struct sw_port *p; struct remote *r; size_t i; LIST_FOR_EACH (p, struct sw_port, node, &dp->port_list) { if (IS_HW_PORT(p)) { continue; } netdev_recv_wait(p->netdev); } LIST_FOR_EACH (r, struct remote, node, &dp->remotes) { remote_wait(r); } for (i = 0; i < dp->n_listeners; i++) { pvconn_wait(dp->listeners[i]); } } void dp_set_dpid(struct datapath *dp, uint64_t dpid) { dp->id = dpid; } void dp_set_mfr_desc(struct datapath *dp, char *mfr_desc) { strncpy(dp->mfr_desc, mfr_desc, DESC_STR_LEN); dp->mfr_desc[DESC_STR_LEN-1] = 0x00; } void dp_set_hw_desc(struct datapath *dp, char *hw_desc) { strncpy(dp->hw_desc, hw_desc, DESC_STR_LEN); dp->hw_desc[DESC_STR_LEN-1] = 0x00; } void dp_set_sw_desc(struct datapath *dp, char *sw_desc) { strncpy(dp->sw_desc, sw_desc, DESC_STR_LEN); dp->sw_desc[DESC_STR_LEN-1] = 0x00; } void dp_set_dp_desc(struct datapath *dp, char *dp_desc) { strncpy(dp->dp_desc, dp_desc, DESC_STR_LEN); dp->dp_desc[DESC_STR_LEN-1] = 0x00; } void dp_set_serial_num(struct datapath *dp, char *serial_num) { strncpy(dp->serial_num, serial_num, SERIAL_NUM_LEN); dp->serial_num[SERIAL_NUM_LEN-1] = 0x00; } void dp_set_max_queues(struct datapath *dp, uint32_t max_queues) { dp->max_queues = max_queues; } static int send_openflow_buffer_to_remote(struct ofpbuf *buffer, struct remote *remote) { struct rconn* rconn = remote->rconn; int retval; if (buffer->conn_id == PTIN_CONNECTION && remote->rconn != NULL && remote->rconn_aux != NULL && rconn_is_connected(remote->rconn) && rconn_is_connected(remote->rconn_aux)) { rconn = remote->rconn_aux; } retval = rconn_send_with_limit(rconn, buffer, &remote->n_txq, TXQ_LIMIT); if (retval) { VLOG_WARN_RL(LOG_MODULE, &rl, "send to %s failed: %s", rconn_get_name(rconn), strerror(retval)); } return retval; } static int send_openflow_buffer(struct datapath *dp, struct ofpbuf *buffer, const struct sender *sender) { update_openflow_length(buffer); if (sender) { /* Send back to the sender. */ return send_openflow_buffer_to_remote(buffer, sender->remote); } else { /* Broadcast to all remotes. */ struct remote *r, *prev = NULL; uint8_t msg_type; /* Get the type of the message */ memcpy(&msg_type,((char* ) buffer->data) + 1, sizeof(uint8_t)); LIST_FOR_EACH (r, struct remote, node, &dp->remotes) { /* do not send to remotes with slave role apart from port status */ if (r->role == OFPCR_ROLE_EQUAL || r->role == OFPCR_ROLE_MASTER){ /*Check if the message is enabled in the asynchronous configuration*/ switch(msg_type){ case (OFPT_PACKET_IN):{ struct ofp_packet_in *p = (struct ofp_packet_in*)buffer->data; /* Do not send message if the reason is not enabled */ if((p->reason == OFPR_NO_MATCH) && !(r->config.packet_in_mask[0] & 0x1)) continue; if((p->reason == OFPR_ACTION) && !(r->config.packet_in_mask[0] & 0x2)) continue; if((p->reason == OFPR_INVALID_TTL) && !(r->config.packet_in_mask[0] & 0x4)) continue; break; } case (OFPT_PORT_STATUS):{ struct ofp_port_status *p = (struct ofp_port_status*)buffer->data; if((p->reason == OFPPR_ADD) && !(r->config.port_status_mask[0] & 0x1)) continue; if((p->reason == OFPPR_DELETE) && !(r->config.port_status_mask[0] & 0x2)) continue; if((p->reason == OFPPR_MODIFY) && !(r->config.packet_in_mask[0] & 0x4)) continue; } case (OFPT_FLOW_REMOVED):{ struct ofp_flow_removed *p= (struct ofp_flow_removed *)buffer->data; if((p->reason == OFPRR_IDLE_TIMEOUT) && !(r->config.port_status_mask[0] & 0x1)) continue; if((p->reason == OFPRR_HARD_TIMEOUT) && !(r->config.port_status_mask[0] & 0x2)) continue; if((p->reason == OFPRR_DELETE) && !(r->config.packet_in_mask[0] & 0x4)) continue; if((p->reason == OFPRR_GROUP_DELETE) && !(r->config.packet_in_mask[0] & 0x8)) continue; if((p->reason == OFPRR_METER_DELETE) && !(r->config.packet_in_mask[0] & 0x10)) continue; } } } else { /* In this implementation we assume that a controller with role slave can is able to receive only port stats messages */ if (r->role == OFPCR_ROLE_SLAVE && msg_type != OFPT_PORT_STATUS) { continue; } else { struct ofp_port_status *p = (struct ofp_port_status*)buffer->data; if((p->reason == OFPPR_ADD) && !(r->config.port_status_mask[1] & 0x1)) continue; if((p->reason == OFPPR_DELETE) && !(r->config.port_status_mask[1] & 0x2)) continue; if((p->reason == OFPPR_MODIFY) && !(r->config.packet_in_mask[1] & 0x4)) continue; } } if (prev) { send_openflow_buffer_to_remote(ofpbuf_clone(buffer), prev); } prev = r; } if (prev) { send_openflow_buffer_to_remote(buffer, prev); } else { ofpbuf_delete(buffer); } return 0; } } int dp_send_message(struct datapath *dp, struct ofl_msg_header *msg, const struct sender *sender) { struct ofpbuf *ofpbuf; uint8_t *buf; size_t buf_size; int error; if (VLOG_IS_DBG_ENABLED(LOG_MODULE)) { char *msg_str = ofl_msg_to_string(msg, dp->exp); VLOG_DBG_RL(LOG_MODULE, &rl, "sending: %.400s", msg_str); free(msg_str); } error = ofl_msg_pack(msg, sender == NULL ? 0 : sender->xid, &buf, &buf_size, dp->exp); if (error) { VLOG_WARN_RL(LOG_MODULE, &rl, "There was an error packing the message!"); return error; } ofpbuf = ofpbuf_new(0); ofpbuf_use(ofpbuf, buf, buf_size); ofpbuf_put_uninit(ofpbuf, buf_size); /* Choose the connection to send the packet to. 1) By default, we send it to the main connection 2) If there's an associated sender, send the response to the same connection the request came from 3) If it's a packet in, use the auxiliary connection */ ofpbuf->conn_id = MAIN_CONNECTION; if (sender != NULL) ofpbuf->conn_id = sender->conn_id; if (msg->type == OFPT_PACKET_IN) ofpbuf->conn_id = PTIN_CONNECTION; error = send_openflow_buffer(dp, ofpbuf, sender); if (error) { VLOG_WARN_RL(LOG_MODULE, &rl, "There was an error sending the message!"); /* TODO Zoltan: is delete needed? */ ofpbuf_delete(ofpbuf); return error; } return 0; } ofl_err dp_handle_set_desc(struct datapath *dp, struct ofl_exp_openflow_msg_set_dp_desc *msg, const struct sender *sender UNUSED) { dp_set_dp_desc(dp, msg->dp_desc); ofl_msg_free((struct ofl_msg_header *)msg, dp->exp); return 0; } static ofl_err dp_check_generation_id(struct datapath *dp, uint64_t new_gen_id){ if(dp->generation_id >= 0 && ((uint64_t)(new_gen_id - dp->generation_id) < 0) ) return ofl_error(OFPET_ROLE_REQUEST_FAILED, OFPRRFC_STALE); else dp->generation_id = new_gen_id; return 0; } ofl_err dp_handle_role_request(struct datapath *dp, struct ofl_msg_role_request *msg, const struct sender *sender) { uint32_t role = msg->role; uint64_t generation_id = msg->generation_id; switch (msg->role) { case OFPCR_ROLE_NOCHANGE:{ role = sender->remote->role; generation_id = dp->generation_id; break; } case OFPCR_ROLE_EQUAL: { sender->remote->role = OFPCR_ROLE_EQUAL; break; } case OFPCR_ROLE_MASTER: { struct remote *r; int error = dp_check_generation_id(dp,msg->generation_id); if (error) { VLOG_WARN_RL(LOG_MODULE, &rl, "Role message generation id is smaller than the current id!"); return error; } /* Old master(s) must be changed to slave(s) */ LIST_FOR_EACH (r, struct remote, node, &dp->remotes) { if (r->role == OFPCR_ROLE_MASTER) { r->role = OFPCR_ROLE_SLAVE; } } sender->remote->role = OFPCR_ROLE_MASTER; break; } case OFPCR_ROLE_SLAVE: { int error = dp_check_generation_id(dp,msg->generation_id); if (error) { VLOG_WARN_RL(LOG_MODULE, &rl, "Role message generation id is smaller than the current id!"); return error; } sender->remote->role = OFPCR_ROLE_SLAVE; break; } default: { VLOG_WARN_RL(LOG_MODULE, &rl, "Role request with unknown role (%u).", msg->role); return ofl_error(OFPET_ROLE_REQUEST_FAILED, OFPRRFC_BAD_ROLE); } } { struct ofl_msg_role_request reply = {{.type = OFPT_ROLE_REPLY}, .role = role, .generation_id = generation_id}; dp_send_message(dp, (struct ofl_msg_header *)&reply, sender); } return 0; } ofl_err dp_handle_async_request(struct datapath *dp, struct ofl_msg_async_config *msg, const struct sender *sender) { uint16_t async_type = msg->header.type; switch(async_type){ case (OFPT_GET_ASYNC_REQUEST):{ struct ofl_msg_async_config reply = {{.type = OFPT_GET_ASYNC_REPLY}, .config = &sender->remote->config}; dp_send_message(dp, (struct ofl_msg_header *)&reply, sender); ofl_msg_free((struct ofl_msg_header*)msg, dp->exp); break; } case (OFPT_SET_ASYNC):{ memcpy(&sender->remote->config, msg->config, sizeof(struct ofl_async_config)); break; } } return 0; }
lgpl-2.1
mbatchelor/pentaho-reporting
engine/core/src/main/java/org/pentaho/reporting/engine/classic/core/layout/output/PerformanceProgressLogger.java
4599
/*! * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2002-2017 Hitachi Vantara.. All rights reserved. */ package org.pentaho.reporting.engine.classic.core.layout.output; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.pentaho.reporting.engine.classic.core.event.ReportProgressEvent; import org.pentaho.reporting.engine.classic.core.event.ReportProgressListener; import org.pentaho.reporting.libraries.base.util.MemoryUsageMessage; import org.pentaho.reporting.libraries.formatting.FastMessageFormat; public class PerformanceProgressLogger implements ReportProgressListener { private static final Log logger = LogFactory.getLog( PerformanceProgressLogger.class ); private static final int ROW_PROGRESS = 5000; private int lastPage; private int lastRow; private int lastStage; private int lastActivity; private long startTime; private int rowCount; private boolean logPageProgress; private boolean logLevelProgress; private boolean logRowProgress; public PerformanceProgressLogger() { this( true, true, true ); } public PerformanceProgressLogger( final boolean logLevelProgress, final boolean logPageProgress, final boolean logRowProgress ) { this.logLevelProgress = logLevelProgress; this.logPageProgress = logPageProgress; this.logRowProgress = logRowProgress; } /** * Receives a notification that the report processing has started. * * @param event * the start event. */ public void reportProcessingStarted( final ReportProgressEvent event ) { if ( logger.isInfoEnabled() == false ) { return; } rowCount = -1; startTime = System.currentTimeMillis(); logger.info( new MemoryUsageMessage( "[" + Thread.currentThread().getName() + "] Report Processing started. " ) ); } /** * Receives a notification that the report processing made some progress. * * @param event * the update event. */ public void reportProcessingUpdate( final ReportProgressEvent event ) { if ( logger.isInfoEnabled() == false ) { return; } rowCount = event.getMaximumRow(); boolean print = false; if ( lastStage != event.getLevel() || lastActivity != event.getActivity() ) { lastStage = event.getLevel(); lastActivity = event.getActivity(); lastRow = 0; if ( logLevelProgress ) { print = true; } } if ( lastPage != event.getPage() ) { lastPage = event.getPage(); if ( logPageProgress ) { print = true; } } final int modRow = ( event.getRow() - lastRow ); if ( modRow > ROW_PROGRESS ) { lastRow = ( event.getRow() / ROW_PROGRESS ) * ROW_PROGRESS; if ( logRowProgress ) { print = true; } } if ( print ) { logger.info( new MemoryUsageMessage( "[" + Thread.currentThread().getName() + "] Activity: " + event.getActivity() + " Level: " + +lastStage + " Processing page: " + lastPage + " Row: " + lastRow + " Time: " + ( System.currentTimeMillis() - startTime ) + "ms " ) ); } } /** * Receives a notification that the report processing was finished. * * @param event * the finish event. */ public void reportProcessingFinished( final ReportProgressEvent event ) { if ( logger.isInfoEnabled() == false ) { return; } final FastMessageFormat messageFormat = new FastMessageFormat( "[{0}] Report Processing Finished: {1}ms - {2,number,0.000} rows/sec - " ); final long processTime = System.currentTimeMillis() - startTime; final double rowsPerSecond = rowCount * 1000.0f / ( processTime ); logger.info( new MemoryUsageMessage( messageFormat.format( new Object[] { Thread.currentThread().getName(), new Long( processTime ), new Double( rowsPerSecond ) } ) ) ); } }
lgpl-2.1
BillTian/libgeos
source/test/Stackwalker.h
2247
/********************************************************************** * $Id$ * * GEOS - Geometry Engine Open Source * http://geos.refractions.net * * Copyright (C) 2001-2002 Vivid Solutions Inc. * * This is free software; you can redistribute and/or modify it under * the terms of the GNU Lesser General Public Licence as published * by the Free Software Foundation. * See the COPYING file for more information. * ********************************************************************** * $Log$ * Revision 1.3 2004/03/17 02:00:33 ybychkov * "Algorithm" upgraded to JTS 1.4 * * Revision 1.2 2003/11/07 01:23:43 pramsey * Add standard CVS headers licence notices and copyrights to all cpp and h * files. * * **********************************************************************/ /*//////////////////////////////////////////////////////////////////////////// * Project: * Memory_and_Exception_Trace * * /////////////////////////////////////////////////////////////////////////// * File: * Stackwalker.h * * Remarks: * * * Note: * * * Author: * Jochen Kalmbach * *//////////////////////////////////////////////////////////////////////////// #ifndef __STACKWALKER_H__ #define __STACKWALKER_H__ // Only valid in the following environment: Intel platform, MS VC++ 5/6/7 #ifndef _X86_ #error Only INTEL envirnoments are supported! #endif // Only MS VC++ 5 to 7 #if (_MSC_VER < 1100) || (_MSC_VER > 1300) //#warning Only MS VC++ 5/6/7 supported. Check if the '_CrtMemBlockHeader' has not changed with this compiler! #endif typedef enum eAllocCheckOutput { ACOutput_Simple, ACOutput_Advanced, ACOutput_XML }; // Make extern "C", so it will also work with normal C-Programs #ifdef __cplusplus extern "C" { #endif extern int InitAllocCheckWN(eAllocCheckOutput eOutput, LPCTSTR pszFilename, ULONG ulShowStackAtAlloc = 0); extern int InitAllocCheck(eAllocCheckOutput eOutput = ACOutput_Simple, BOOL bSetUnhandledExeptionFilter = TRUE, ULONG ulShowStackAtAlloc = 0); // will create the filename by itself extern ULONG DeInitAllocCheck(); extern DWORD StackwalkFilter( EXCEPTION_POINTERS *ep, DWORD status, LPCTSTR pszLogFile); #ifdef __cplusplus } #endif #endif // __STACKWALKER_H__
lgpl-2.1
mbert/mulberry-lib-jx
libjcore/code/JPtrArray-JString16.h
1065
/****************************************************************************** JPtrArray-JString16.h Copyright © 1997 by John Lindal. All rights reserved. ******************************************************************************/ #ifndef _H_JPtrArray_JString16 #define _H_JPtrArray_JString16 #if !defined _J_UNIX && !defined ACE_LACKS_PRAGMA_ONCE #pragma once #endif #include <JPtrArray.h> #ifdef _TODO #include <JString16PtrMap.h> #endif #include <JString16.h> istream& operator>>(istream&, JPtrArray<JString16>&); ostream& operator<<(ostream&, const JPtrArray<JString16>&); #ifdef _TODO istream& operator>>(istream&, JString16PtrMap<JString16>&); ostream& operator<<(ostream&, const JString16PtrMap<JString16>&); #endif JBoolean JSameStrings(const JPtrArray<JString16>&, const JPtrArray<JString16>&, const JBoolean caseSensitive); JOrderedSetT::CompareResult JCompareStringsCaseSensitive(JString16* const &, JString16* const &); JOrderedSetT::CompareResult JCompareStringsCaseInsensitive(JString16* const &, JString16* const &); #endif
lgpl-2.1
kenzaburo/OpenSaf-FrameWork
osaf/services/saf/cpsv/cpd/cpd_main.c
1526
/* -*- OpenSAF -*- * * (C) Copyright 2010 The OpenSAF Foundation * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed * under the GNU Lesser General Public License Version 2.1, February 1999. * The complete license can be accessed from the following location: * http://opensource.org/licenses/lgpl-license.php * See the Copying file included with the OpenSAF distribution for full * licensing terms. * * Author(s): Wind River Systems * */ #include <ncssysf_tsk.h> #include <logtrace.h> #include <daemon.h> #include "cpd.h" static int __init_cpd(void) { NCS_LIB_REQ_INFO lib_create; /* Init LIB_CREATE request for Server */ memset(&lib_create, 0, sizeof(lib_create)); lib_create.i_op = NCS_LIB_REQ_CREATE; lib_create.info.create.argc = 0; lib_create.info.create.argv = NULL; if (ncs_agents_startup() != NCSCC_RC_SUCCESS) return m_LEAP_DBG_SINK(NCSCC_RC_FAILURE); /* Init CPD */ m_NCS_DBG_PRINTF("\nCPSV:CPD:ON"); if (cpd_lib_req(&lib_create) != NCSCC_RC_SUCCESS) { fprintf(stderr, "cpd_lib_req FAILED\n"); return m_LEAP_DBG_SINK(NCSCC_RC_FAILURE); } return (NCSCC_RC_SUCCESS); } int main(int argc, char *argv[]) { daemonize(argc, argv); if (__init_cpd() != NCSCC_RC_SUCCESS) { syslog(LOG_ERR, "__init_dts() failed"); exit(EXIT_FAILURE); } while (1) { m_NCS_TASK_SLEEP(0xfffffff0); } exit(1); }
lgpl-2.1
EqAfrica/machinekit
src/rtapi/rtapi_app.cc
39588
/* Copyright (C) 2006-2008 Jeff Epler <jepler@unpythonic.net> * Copyright (C) 2012-2014 Michael Haberler <license@mah.priv.at> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* * TODO: on setuid and capabilites(7) * * right now this program runs as setuid root * it might be possible to drop the wholesale root privs by using * capabilites(7). in particular: * * CAP_SYS_RAWIO open /dev/mem and /dev/kmem & Perform I/O port operations * CAP_SYS_NICE set real-time scheduling policies, set CPU affinity * CAP_SYS_MODULE Load and unload kernel modules * * NB: Capabilities are a per-thread attribute, * so this might need to be done on a per-thread basis * see also CAP_SETPCAP, CAP_INHERITABLE and 'inheritable set' * * see also: * http://stackoverflow.com/questions/13183327/drop-root-uid-while-retaining-cap-sys-nice * http://stackoverflow.com/questions/12141420/losing-capabilities-after-setuid */ #include "config.h" #include <sys/types.h> #include <unistd.h> #include <errno.h> #include <uuid/uuid.h> #include <dlfcn.h> #include <signal.h> #include <sys/signalfd.h> #include <string> #include <map> #include <vector> #include <algorithm> #include <sys/resource.h> #include <linux/capability.h> #include <sys/io.h> #include <stdlib.h> #include <stdio.h> #include <getopt.h> #include <errno.h> #include <malloc.h> #include <assert.h> #include <syslog_async.h> #include <limits.h> #include <sys/prctl.h> #include <inifile.h> #include <czmq.h> #include <google/protobuf/text_format.h> #include <machinetalk/generated/message.pb.h> using namespace google::protobuf; typedef ::google::protobuf::RepeatedPtrField< ::std::string> pbstringarray_t; #include "rtapi.h" #include "rtapi_global.h" #include "rtapi_compat.h" #include "hal.h" #include "hal_priv.h" #include "rtapi/shmdrv/shmdrv.h" #include "mk-backtrace.h" #include "setup_signals.h" #include "mk-zeroconf.hh" #include "select_interface.h" #define BACKGROUND_TIMER 1000 using namespace std; /* Pre-allocation size. Must be enough for the whole application life to avoid * pagefaults by new memory requested from the system. */ #define PRE_ALLOC_SIZE (30 * 1024 * 1024) template<class T> T DLSYM(void *handle, const string &name) { return (T)(dlsym(handle, name.c_str())); } template<class T> T DLSYM(void *handle, const char *name) { return (T)(dlsym(handle, name)); } static std::map<string, void*> modules; static std::vector<string> loading_order; static void remove_module(std::string name); static struct rusage rusage; static unsigned long minflt, majflt; static int instance_id; flavor_ptr flavor; static int use_drivers = 0; static int foreground; static int debug; static int signal_fd; static bool interrupted; int shmdrv_loaded; long page_size; static const char *progname; static const char *z_uri; static int z_port; static pb::Container command, reply; static uuid_t process_uuid; static char process_uuid_str[40]; static register_context_t *rtapi_publisher; static const char *service_uuid; #ifdef NOTYET static int remote = 0; // announce and bind a TCP socket static const char *ipaddr = "127.0.0.1"; static const char *z_uri_dsn; #endif static const char *interfaces; static const char *inifile; static FILE *inifp; #ifdef NOTYET static AvahiCzmqPoll *av_loop; #endif // the following two variables, despite extern, are in fact private to rtapi_app // in the sense that they are not visible in the RT space (the namespace // of dlopen'd modules); these are supposed to be 'ships in the night' // relative to any symbols exported by rtapi_app. // // global_data is set in attach_global_segment() which was already // created by rtapi_msgd // rtapi_switch is set once rtapi.so has been loaded by calling the // rtapi_get_handle() method in rtapi.so. // Once set, rtapi methods in rtapi.so can be called normally through // the rtapi_switch redirection (see rtapi.h). // NB: do _not_ call any rtapi_* methods before these variables are set // except for rtapi_msg* and friends (those do not go through the rtapi_switch). rtapi_switch_t *rtapi_switch; global_data_t *global_data; static int init_actions(int instance); static void exit_actions(int instance); static int harden_rt(void); static void rtapi_app_msg_handler(msg_level_t level, const char *fmt, va_list ap); static void stderr_rtapi_msg_handler(msg_level_t level, const char *fmt, va_list ap); static int do_one_item(char item_type_char, const string &param_name, const string &param_value, void *vitem, int idx=0) { char *endp; switch(item_type_char) { case 'l': { long *litem = *(long**) vitem; litem[idx] = strtol(param_value.c_str(), &endp, 0); if(*endp) { rtapi_print_msg(RTAPI_MSG_ERR, "`%s' invalid for parameter `%s'", param_value.c_str(), param_name.c_str()); return -1; } return 0; } case 'i': { int *iitem = *(int**) vitem; iitem[idx] = strtol(param_value.c_str(), &endp, 0); if(*endp) { rtapi_print_msg(RTAPI_MSG_ERR, "`%s' invalid for parameter `%s'", param_value.c_str(), param_name.c_str()); return -1; } return 0; } case 's': { char **sitem = *(char***) vitem; sitem[idx] = strdup(param_value.c_str()); return 0; } default: rtapi_print_msg(RTAPI_MSG_ERR, "%s: Invalid type character `%c'\n", param_name.c_str(), item_type_char); return -1; } return 0; } void remove_quotes(string &s) { s.erase(remove_copy(s.begin(), s.end(), s.begin(), '"'), s.end()); } static int do_comp_args(void *module, pbstringarray_t args) { for(int i = 0; i < args.size(); i++) { string s(args.Get(i)); remove_quotes(s); size_t idx = s.find('='); if(idx == string::npos) { rtapi_print_msg(RTAPI_MSG_ERR, "Invalid parameter `%s'\n", s.c_str()); return -1; } string param_name(s, 0, idx); string param_value(s, idx+1); void *item=DLSYM<void*>(module, "rtapi_info_address_" + param_name); if(!item) { rtapi_print_msg(RTAPI_MSG_ERR, "Unknown parameter `%s'\n", s.c_str()); return -1; } char **item_type=DLSYM<char**>(module, "rtapi_info_type_" + param_name); if(!item_type || !*item_type) { rtapi_print_msg(RTAPI_MSG_ERR, "Unknown parameter `%s' (type information missing)\n", s.c_str()); return -1; } string item_type_string = *item_type; if(item_type_string.size() > 1) { int a, b; char item_type_char; int r = sscanf(item_type_string.c_str(), "%d-%d%c", &a, &b, &item_type_char); if(r != 3) { rtapi_print_msg(RTAPI_MSG_ERR, "Unknown parameter `%s'" " (corrupt array type information): %s\n", s.c_str(), item_type_string.c_str()); return -1; } size_t idx = 0; int i = 0; while(idx != string::npos) { if(i == b) { rtapi_print_msg(RTAPI_MSG_ERR, "%s: can only take %d arguments\n", s.c_str(), b); return -1; } size_t idx1 = param_value.find(",", idx); string substr(param_value, idx, idx1 - idx); int result = do_one_item(item_type_char, s, substr, item, i); if(result != 0) return result; i++; idx = idx1 == string::npos ? idx1 : idx1 + 1; } } else { char item_type_char = item_type_string[0]; int result = do_one_item(item_type_char, s, param_value, item); if(result != 0) return result; } } return 0; } static void pbconcat(string &s, const pbstringarray_t &args) { for (int i = 0; i < args.size(); i++) { s += args.Get(i); if (i < args.size()-1) s += " "; } } static inline bool kernel_threads(flavor_ptr f) { assert(f); return (f->flags & FLAVOR_KERNEL_BUILD) != 0; } static int do_load_cmd(int instance, string name, pbstringarray_t args) { void *w = modules[name]; char module_name[PATH_MAX]; void *module; int retval; if (w == NULL) { if (kernel_threads(flavor)) { string cmdargs; pbconcat(cmdargs, args); retval = run_module_helper("insert %s %s", name.c_str(), cmdargs.c_str()); if (retval) { rtapi_print_msg(RTAPI_MSG_ERR, "couldnt insmod %s - see dmesg\n", name.c_str()); } else { modules[name] = (void *) -1; // so 'if (modules[name])' works loading_order.push_back(name); } return retval; } else { strncpy(module_name, (name + flavor->mod_ext).c_str(), PATH_MAX); module = modules[name] = dlopen(module_name, RTLD_GLOBAL |RTLD_NOW); if (!module) { rtapi_print_msg(RTAPI_MSG_ERR, "%s: dlopen: %s\n", name.c_str(), dlerror()); return -1; } // retrieve the address of rtapi_switch_struct // so rtapi functions can be called and members // accessed if (rtapi_switch == NULL) { rtapi_get_handle_t rtapi_get_handle; dlerror(); rtapi_get_handle = (rtapi_get_handle_t) dlsym(module, "rtapi_get_handle"); if (rtapi_get_handle != NULL) { rtapi_switch = rtapi_get_handle(); assert(rtapi_switch != NULL); } } /// XXX handle arguments int (*start)(void) = DLSYM<int(*)(void)>(module, "rtapi_app_main"); if(!start) { rtapi_print_msg(RTAPI_MSG_ERR, "%s: dlsym: %s\n", name.c_str(), dlerror()); return -1; } int result; result = do_comp_args(module, args); if(result < 0) { dlclose(module); return -1; } // need to call rtapi_app_main with as root // RT thread creation and hardening requires this if ((result = start()) < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "rtapi_app_main(%s): %d %s\n", name.c_str(), result, strerror(-result)); modules.erase(modules.find(name)); return result; } loading_order.push_back(name); rtapi_print_msg(RTAPI_MSG_DBG, "%s: loaded from %s\n", name.c_str(), module_name); return 0; } } else { rtapi_print_msg(RTAPI_MSG_ERR, "%s: already loaded\n", name.c_str()); return -1; } } static int do_unload_cmd(int instance, string name) { void *w = modules[name]; int retval = 0; if (w == NULL) { rtapi_print_msg(RTAPI_MSG_ERR, "unload: '%s' not loaded\n", name.c_str()); return -1; } else { if (kernel_threads(flavor)) { retval = run_module_helper("remove %s", name.c_str()); if (retval) { rtapi_print_msg(RTAPI_MSG_ERR, "couldnt rmmod %s - see dmesg\n", name.c_str()); return retval; } else { modules.erase(modules.find(name)); remove_module(name); } } else { int (*stop)(void) = DLSYM<int(*)(void)>(w, "rtapi_app_exit"); if (stop) stop(); modules.erase(modules.find(name)); remove_module(name); dlclose(w); } } rtapi_print_msg(RTAPI_MSG_DBG, " '%s' unloaded\n", name.c_str()); return retval; } // shut down the stack in reverse loading order static void exit_actions(int instance) { size_t index = loading_order.size() - 1; for(std::vector<std::string>::reverse_iterator rit = loading_order.rbegin(); rit != loading_order.rend(); ++rit, --index) { do_unload_cmd(instance, *rit); } } static int init_actions(int instance) { int retval; char modules[PATH_MAX]; get_rtapi_config(modules,"MODULES",PATH_MAX); if (kernel_threads(flavor)) { // kthreads cant possibly run without shmdrv, so bail // also, cannot load it here because rtapi_msgd already needs this // so it'd be too late here if (!is_module_loaded("shmdrv")) { rtapi_print_msg(RTAPI_MSG_ERR, "shmdrv not loaded"); return -1; } // leftovers or running session? if (is_module_loaded("rtapi")) { rtapi_print_msg(RTAPI_MSG_ERR, "rtapi already loaded"); return -1; } if (is_module_loaded("hal_lib")) { rtapi_print_msg(RTAPI_MSG_ERR, "hal_lib already loaded"); return -1; } char *m = strtok(modules, "\t "); while (m != NULL) { char cmdline[PATH_MAX]; if (!strcmp(m, "rtapi")) { snprintf(cmdline, sizeof(cmdline), "insert %s rtapi_instance=%d", m, instance_id); } else { snprintf(cmdline, sizeof(cmdline), "insert %s", m); } rtapi_print_msg(RTAPI_MSG_DBG, "running '%s'", cmdline); retval = run_module_helper(cmdline); if (retval) { rtapi_print_msg(RTAPI_MSG_ERR, "linuxcnc_module_helper '%s' failed - see dmesg\n", cmdline); return retval; } else rtapi_print_msg(RTAPI_MSG_DBG, "'%s' loaded\n", m); m = strtok(NULL, "\t "); } } retval = do_load_cmd(instance, "rtapi", pbstringarray_t()); if (retval) return retval; return do_load_cmd(instance, "hal_lib", pbstringarray_t()); } static int attach_global_segment() { int retval = 0; int globalkey = OS_KEY(GLOBAL_KEY, instance_id); int size = 0; int tries = 10; // 5 sec deadline for msgd/globaldata to come up shm_common_init(); do { retval = shm_common_new(globalkey, &size, instance_id, (void **) &global_data, 0); if (retval < 0) { tries--; if (tries == 0) { syslog_async(LOG_ERR, "rtapi_app:%d: ERROR: cannot attach global segment key=0x%x %s\n", instance_id, globalkey, strerror(-retval)); return retval; } struct timespec ts = {0, 500 * 1000 * 1000}; //ms nanosleep(&ts, NULL); } } while (retval < 0); if (size != sizeof(global_data_t)) { syslog_async(LOG_ERR, "rtapi_app:%d global segment size mismatch: expect %zu got %d\n", instance_id, sizeof(global_data_t), size); return -EINVAL; } tries = 10; while (global_data->magic != GLOBAL_READY) { tries--; if (tries == 0) { syslog_async(LOG_ERR, "rtapi_app:%d: ERROR: global segment magic not changing to ready: magic=0x%x\n", instance_id, global_data->magic); return -EINVAL; } struct timespec ts = {0, 500 * 1000 * 1000}; //ms nanosleep(&ts, NULL); } return retval; } // handle commands from zmq socket static int rtapi_request(zloop_t *loop, zmq_pollitem_t *poller, void *arg) { zmsg_t *r = zmsg_recv(poller->socket); char *origin = zmsg_popstr (r); zframe_t *request_frame = zmsg_pop (r); static bool force_exit = false; pb::Container pbreq, pbreply; if (!pbreq.ParseFromArray(zframe_data(request_frame), zframe_size(request_frame))) { rtapi_print_msg(RTAPI_MSG_ERR, "cant decode request from %s (size %zu)", origin ? origin : "NULL", zframe_size(request_frame)); zmsg_destroy(&r); return 0; } if (debug) { string buffer; if (TextFormat::PrintToString(pbreq, &buffer)) { fprintf(stderr, "request: %s\n",buffer.c_str()); } } pbreply.set_type(pb::MT_RTAPI_APP_REPLY); switch (pbreq.type()) { case pb::MT_RTAPI_APP_PING: char buffer[LINELEN]; snprintf(buffer, sizeof(buffer), "pid=%d flavor=%s gcc=%s git=%s", getpid(),flavor->name, __VERSION__, GIT_VERSION); pbreply.add_note(buffer); pbreply.set_retcode(0); break; case pb::MT_RTAPI_APP_EXIT: assert(pbreq.has_rtapicmd()); exit_actions(pbreq.rtapicmd().instance()); force_exit = true; pbreply.set_retcode(0); break; case pb::MT_RTAPI_APP_LOADRT: assert(pbreq.has_rtapicmd()); assert(pbreq.rtapicmd().has_modname()); assert(pbreq.rtapicmd().has_instance()); pbreply.set_retcode(do_load_cmd(pbreq.rtapicmd().instance(), pbreq.rtapicmd().modname(), pbreq.rtapicmd().argv())); break; case pb::MT_RTAPI_APP_UNLOADRT: assert(pbreq.rtapicmd().has_modname()); assert(pbreq.rtapicmd().has_instance()); pbreply.set_retcode(do_unload_cmd(pbreq.rtapicmd().instance(), pbreq.rtapicmd().modname())); break; case pb::MT_RTAPI_APP_LOG: assert(pbreq.has_rtapicmd()); if (pbreq.rtapicmd().has_rt_msglevel()) { global_data->rt_msg_level = pbreq.rtapicmd().rt_msglevel(); } if (pbreq.rtapicmd().has_user_msglevel()) { global_data->user_msg_level = pbreq.rtapicmd().user_msglevel(); } pbreply.set_retcode(0); break; #if DEPRECATED case pb::MT_RTAPI_APP_NEWINST: pbreply.set_retcode(0); break; #endif case pb::MT_RTAPI_APP_NEWTHREAD: assert(pbreq.has_rtapicmd()); assert(pbreq.rtapicmd().has_threadname()); assert(pbreq.rtapicmd().has_threadperiod()); assert(pbreq.rtapicmd().has_cpu()); assert(pbreq.rtapicmd().has_use_fp()); assert(pbreq.rtapicmd().has_instance()); if (kernel_threads(flavor)) { int retval = procfs_threadcmd("newthread %s %d %d %d", pbreq.rtapicmd().threadname().c_str(), pbreq.rtapicmd().threadperiod(), pbreq.rtapicmd().use_fp(), pbreq.rtapicmd().cpu()); pbreply.set_retcode(retval < 0 ? retval:0); } else { void *w = modules["hal_lib"]; if (w == NULL) { pbreply.add_note("hal_lib not loaded"); pbreply.set_retcode(-1); break; } int (*create_thread)(const char *, unsigned long,int, int) = DLSYM<int(*)(const char *, unsigned long,int, int)>(w, "hal_create_thread"); if (create_thread == NULL) { pbreply.add_note("symbol 'hal_create_thread' not found in hal_lib"); pbreply.set_retcode(-1); break; } int retval = create_thread(pbreq.rtapicmd().threadname().c_str(), pbreq.rtapicmd().threadperiod(), pbreq.rtapicmd().use_fp(), pbreq.rtapicmd().cpu()); pbreply.set_retcode(retval); } break; case pb::MT_RTAPI_APP_DELTHREAD: assert(pbreq.has_rtapicmd()); assert(pbreq.rtapicmd().has_threadname()); assert(pbreq.rtapicmd().has_instance()); if (kernel_threads(flavor)) { int retval = procfs_threadcmd("delthread %s", pbreq.rtapicmd().threadname().c_str()); pbreply.set_retcode(retval < 0 ? retval:0); } else { void *w = modules["hal_lib"]; if (w == NULL) { pbreply.add_note("hal_lib not loaded"); pbreply.set_retcode(-1); break; } int (*delete_thread)(const char *) = DLSYM<int(*)(const char *)>(w,"hal_thread_delete"); if (delete_thread == NULL) { pbreply.add_note("symbol 'hal_thread_delete' not found in hal_lib"); pbreply.set_retcode(-1); break; } int retval = delete_thread(pbreq.rtapicmd().threadname().c_str()); pbreply.set_retcode(retval); } break; default: rtapi_print_msg(RTAPI_MSG_ERR, "unkown command type %d)", (int) pbreq.type()); zmsg_destroy(&r); return 0; } // TODO: extract + attach error message size_t reply_size = pbreply.ByteSize(); zframe_t *reply = zframe_new (NULL, reply_size); if (!pbreply.SerializeWithCachedSizesToArray(zframe_data (reply))) { zframe_destroy(&reply); rtapi_print_msg(RTAPI_MSG_ERR, "cant serialize to %s (type %d size %zu)", origin ? origin : "NULL", pbreply.type(), reply_size); } else { if (debug) { string buffer; if (TextFormat::PrintToString(pbreply, &buffer)) { fprintf(stderr, "reply: %s\n",buffer.c_str()); } } assert(zstr_sendm (poller->socket, origin) == 0); if (zframe_send (&reply, poller->socket, 0)) { rtapi_print_msg(RTAPI_MSG_ERR, "cant serialize to %s (type %d size %zu)", origin ? origin : "NULL", pbreply.type(), zframe_size(reply)); } } free(origin); zmsg_destroy(&r); if (force_exit) // terminate the zloop return -1; return 0; } static void btprint(const char *prefix, const char *fmt, ...) { va_list args; va_start(args, fmt); rtapi_msg_handler_t print = rtapi_get_msg_handler(); print(RTAPI_MSG_ERR, fmt, args); va_end(args); } // handle signals delivered via sigaction - not all signals // can be dealt with through signalfd(2) // log, try to do something sane, and dump core static void sigaction_handler(int sig, siginfo_t *si, void *uctx) { switch (sig) { case SIGXCPU: // should not happen - must be handled in RTAPI if enabled rtapi_print_msg(RTAPI_MSG_ERR, "rtapi_app: BUG: SIGXCPU should be handled in RTAPI"); // NB: fall through default: rtapi_print_msg(RTAPI_MSG_ERR, "signal %d - '%s' received, dumping core (current dir=%s)", sig, strsignal(sig), get_current_dir_name()); backtrace("", "rtapi_app", btprint, 3); if (global_data) global_data->rtapi_app_pid = 0; closelog_async(); // let syslog_async drain sleep(1); // reset handler for current signal to default signal(sig, SIG_DFL); // and re-raise so we get a proper core dump and stacktrace kill(getpid(), sig); sleep(1); break; } // not reached } // handle signals delivered synchronously in the event loop // by polling signal_fd // log, start shutdown and flag end of the event loop static int s_handle_signal(zloop_t *loop, zmq_pollitem_t *poller, void *arg) { struct signalfd_siginfo fdsi; ssize_t s; s = read(signal_fd, &fdsi, sizeof(struct signalfd_siginfo)); if (s != sizeof(struct signalfd_siginfo)) { rtapi_print_msg(RTAPI_MSG_ERR, "BUG: read(signal_fd): %s", strerror(errno)); return 0; } switch (fdsi.ssi_signo) { // see machinetalk/lib/setup_signals for handled signals case SIGINT: case SIGQUIT: case SIGKILL: case SIGTERM: rtapi_print_msg(RTAPI_MSG_INFO, "signal %d - '%s' received, exiting", fdsi.ssi_signo, strsignal(fdsi.ssi_signo)); exit_actions(instance_id); interrupted = true; // make mainloop exit if (global_data) global_data->rtapi_app_pid = 0; return -1; default: // this should be handled either above or in sigaction_handler rtapi_print_msg(RTAPI_MSG_ERR, "BUG: unhandled signal %d - '%s' received\n", fdsi.ssi_signo, strsignal(fdsi.ssi_signo)); } return 0; } static int s_handle_timer(zloop_t *loop, int timer_id, void *args) { if (global_data->rtapi_msgd_pid == 0) { // cant log this via rtapi_print, since msgd is gone syslog_async(LOG_ERR,"rtapi_msgd went away, exiting\n"); exit_actions(instance_id); if (global_data) global_data->rtapi_app_pid = 0; exit(EXIT_FAILURE); } return 0; } static int mainloop(size_t argc, char **argv) { int retval; unsigned i; static char proctitle[20]; // set new process name snprintf(proctitle, sizeof(proctitle), "rtapi:%d",instance_id); size_t argv0_len = strlen(argv[0]); size_t procname_len = strlen(proctitle); size_t max_procname_len = (argv0_len > procname_len) ? (procname_len) : (argv0_len); strncpy(argv[0], proctitle, max_procname_len); memset(&argv[0][max_procname_len], '\0', argv0_len - max_procname_len); for (i = 1; i < argc; i++) memset(argv[i], '\0', strlen(argv[i])); backtrace_init(proctitle); // set this thread's name so it can be identified in ps/top as // rtapi:<instance> if (prctl(PR_SET_NAME, argv[0]) < 0) { syslog_async(LOG_ERR, "rtapi_app: prctl(PR_SETNAME,%s) failed: %s\n", argv[0], strerror(errno)); } // attach global segment which rtapi_msgd already prepared if ((retval = attach_global_segment()) != 0) { syslog_async(LOG_ERR, "%s: FATAL - failed to attach to global segment\n", argv[0]); exit(retval); } // make sure rtapi_msgd's pid is valid and msgd is running, // in case we caught a leftover shmseg // otherwise log messages would vanish if ((global_data->rtapi_msgd_pid == 0) || kill(global_data->rtapi_msgd_pid, 0) != 0) { syslog_async(LOG_ERR,"%s: rtapi_msgd pid invalid: %d, exiting\n", argv[0], global_data->rtapi_msgd_pid); exit(EXIT_FAILURE); } // from here on it is safe to use rtapi_print() and friends as // the error ring is now set up and msgd is logging it rtapi_set_logtag("rtapi_app"); rtapi_set_msg_level(global_data->rt_msg_level); // obtain handle on flavor descriptor as detected by rtapi_msgd flavor = flavor_byid(global_data->rtapi_thread_flavor); if (flavor == NULL) { rtapi_print_msg(RTAPI_MSG_ERR, "FATAL - invalid flavor id: %d\n", global_data->rtapi_thread_flavor); global_data->rtapi_app_pid = 0; exit(EXIT_FAILURE); } // make sure we're setuid root when we need to if (use_drivers || (flavor->flags & FLAVOR_DOES_IO)) { if (geteuid() != 0) { rtapi_print_msg(RTAPI_MSG_ERR, "rtapi_app:%d need to" " 'sudo make setuid' to access I/O?\n", instance_id); global_data->rtapi_app_pid = 0; exit(EXIT_FAILURE); } } // assorted RT incantations - memory locking, prefaulting etc if ((retval = harden_rt())) { rtapi_print_msg(RTAPI_MSG_ERR, "rtapi_app:%d failed to setup " "realtime environment - 'sudo make setuid' missing?\n", instance_id); global_data->rtapi_app_pid = 0; exit(retval); } // load rtapi and hal_lib if (init_actions(instance_id)) { rtapi_print_msg(RTAPI_MSG_ERR, "init_actions() failed\n"); global_data->rtapi_app_pid = 0; exit(1); } // block all signal delivery through signal handler // since we're using signalfd() // do this here so child threads inherit the sigmask signal_fd = setup_signals(sigaction_handler, SIGINT, SIGQUIT, SIGKILL, SIGTERM, -1); assert(signal_fd > -1); // suppress default handling of signals in zctx_new() // since we're using signalfd() zsys_handler_set(NULL); zctx_t *z_context = zctx_new (); void *z_command = zsocket_new (z_context, ZMQ_ROUTER); { char z_ident[30]; snprintf(z_ident, sizeof(z_ident), "rtapi_app%d", getpid()); zsocket_set_identity(z_command, z_ident); zsocket_set_linger(z_command, 1000); // wait for last reply to drain } #ifdef NOTYET // determine interface to bind to if remote option set if ((remote || z_uri) && interfaces) { char ifname[LINELEN], ip[LINELEN]; // rtapi_print_msg(RTAPI_MSG_INFO, "rtapi_app: ifpref='%s'\n",interfaces); if (parse_interface_prefs(interfaces, ifname, ip, NULL) == 0) { rtapi_print_msg(RTAPI_MSG_INFO, "rtapi_app: using preferred interface %s/%s\n", ifname, ip); ipaddr = strdup(ip); } else { rtapi_print_msg(RTAPI_MSG_ERR, "rtapi_app: INTERFACES='%s'" " - cant determine preferred interface, using %s/%s\n", interfaces, ifname, ipaddr); } if (z_uri == NULL) { // not given on command line - finalize the URI char uri[LINELEN]; snprintf(uri, sizeof(uri), "tcp://%s:*" , ipaddr); z_uri = strdup(uri); } if ((z_port = zsocket_bind(z_command, z_uri)) == -1) { rtapi_print_msg(RTAPI_MSG_ERR, "cannot bind '%s' - %s\n", z_uri, strerror(errno)); global_data->rtapi_app_pid = 0; exit(EXIT_FAILURE); } else { z_uri_dsn = zsocket_last_endpoint(z_command); rtapi_print_msg(RTAPI_MSG_DBG, "rtapi_app: command RPC socket on '%s'\n", z_uri_dsn); } } #endif { // always bind the IPC socket char uri[LINELEN]; snprintf(uri, sizeof(uri), ZMQIPC_FORMAT, RUNDIR, instance_id, "rtapi", service_uuid); mode_t prev = umask(S_IROTH | S_IWOTH | S_IXOTH); if ((z_port = zsocket_bind(z_command, uri )) < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "cannot bind IPC socket '%s' - %s\n", uri, strerror(errno)); global_data->rtapi_app_pid = 0; exit(EXIT_FAILURE); } rtapi_print_msg(RTAPI_MSG_ERR,"accepting commands at %s\n",uri); umask(prev); } zloop_t *z_loop = zloop_new(); assert(z_loop); zloop_set_verbose(z_loop, debug); zmq_pollitem_t signal_poller = { 0, signal_fd, ZMQ_POLLIN }; zloop_poller (z_loop, &signal_poller, s_handle_signal, NULL); zmq_pollitem_t command_poller = { z_command, 0, ZMQ_POLLIN }; zloop_poller(z_loop, &command_poller, rtapi_request, NULL); zloop_timer (z_loop, BACKGROUND_TIMER, 0, s_handle_timer, NULL); #ifdef NOTYET // no remote rtapi service yet if (remote) { if (!(av_loop = avahi_czmq_poll_new(z_loop))) { rtapi_print_msg(RTAPI_MSG_ERR, "rtapi_app:%d: zeroconf: Failed to create avahi event loop object.", instance_id); return -1; } else { char name[255]; snprintf(name, sizeof(name), "RTAPI service on %s pid %d", ipaddr, getpid()); rtapi_publisher = zeroconf_service_announce(name, MACHINEKIT_DNSSD_SERVICE_TYPE, RTAPI_DNSSD_SUBTYPE, z_port, (char *)z_uri_dsn, service_uuid, process_uuid_str, "rtapi", NULL, av_loop); if (rtapi_publisher == NULL) { rtapi_print_msg(RTAPI_MSG_ERR, "rtapi_app:%d: failed to start zeroconf publisher", instance_id); return -1; } } } #endif // report success rtapi_print_msg(RTAPI_MSG_INFO, "rtapi_app:%d ready flavor=%s gcc=%s git=%s", instance_id, flavor->name, __VERSION__, GIT_VERSION); // the RT stack is now set up and good for use global_data->rtapi_app_pid = getpid(); // main loop do { retval = zloop_start(z_loop); } while (!(retval || interrupted)); rtapi_print_msg(RTAPI_MSG_INFO, "exiting mainloop (%s)\n", interrupted ? "interrupted": "by remote command"); // stop the service announcement zeroconf_service_withdraw(rtapi_publisher); // shutdown zmq context zctx_destroy(&z_context); // exiting, so deregister our pid, which will make rtapi_msgd exit too global_data->rtapi_app_pid = 0; return 0; } static int configure_memory(void) { unsigned int i, pagesize; char *buf; if (global_data->rtapi_thread_flavor != RTAPI_POSIX_ID) { // Realtime tweak requires privs /* Lock all memory. This includes all current allocations (BSS/data) * and future allocations. */ if (mlockall(MCL_CURRENT | MCL_FUTURE)) { rtapi_print_msg(RTAPI_MSG_WARN, "mlockall() failed: %d '%s'\n", errno,strerror(errno)); rtapi_print_msg(RTAPI_MSG_WARN, "For more information, see " "http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?LockedMemory\n"); return 1; } } /* Turn off malloc trimming.*/ if (!mallopt(M_TRIM_THRESHOLD, -1)) { rtapi_print_msg(RTAPI_MSG_WARN, "mallopt(M_TRIM_THRESHOLD, -1) failed\n"); return 1; } /* Turn off mmap usage. */ if (!mallopt(M_MMAP_MAX, 0)) { rtapi_print_msg(RTAPI_MSG_WARN, "mallopt(M_MMAP_MAX, -1) failed\n"); return 1; } buf = static_cast<char *>(malloc(PRE_ALLOC_SIZE)); if (buf == NULL) { rtapi_print_msg(RTAPI_MSG_WARN, "malloc(PRE_ALLOC_SIZE) failed\n"); return 1; } pagesize = sysconf(_SC_PAGESIZE); /* Touch each page in this piece of memory to get it mapped into RAM */ for (i = 0; i < PRE_ALLOC_SIZE; i += pagesize) { /* Each write to this buffer will generate a pagefault. * Once the pagefault is handled a page will be locked in * memory and never given back to the system. */ buf[i] = 0; } /* buffer will now be released. As Glibc is configured such that it * never gives back memory to the kernel, the memory allocated above is * locked for this process. All malloc() and new() calls come from * the memory pool reserved and locked above. Issuing free() and * delete() does NOT make this locking undone. So, with this locking * mechanism we can build C++ applications that will never run into * a major/minor pagefault, even with swapping enabled. */ free(buf); return 0; } static void exit_handler(void) { struct rusage rusage; getrusage(RUSAGE_SELF, &rusage); if ((rusage.ru_majflt - majflt) > 0) { // RTAPI already shut down here rtapi_print_msg(RTAPI_MSG_WARN, "rtapi_app_main %d: %ld page faults, %ld page reclaims\n", getpid(), rusage.ru_majflt - majflt, rusage.ru_minflt - minflt); } } static int harden_rt() { // enable core dumps struct rlimit core_limit; core_limit.rlim_cur = RLIM_INFINITY; core_limit.rlim_max = RLIM_INFINITY; if (setrlimit(RLIMIT_CORE, &core_limit) < 0) rtapi_print_msg(RTAPI_MSG_WARN, "setrlimit: %s - core dumps may be truncated or non-existant\n", strerror(errno)); // even when setuid root // note this may not be enough // echo 1 > // might be needed to have setuid programs dump core if (prctl(PR_SET_DUMPABLE, 1) < 0) rtapi_print_msg(RTAPI_MSG_WARN, "prctl(PR_SET_DUMPABLE) failed: no core dumps will be created - %d - %s\n", errno, strerror(errno)); FILE *fd; if ((fd = fopen("/proc/sys/fs/suid_dumpable","r")) != NULL) { int flag; if ((fscanf(fd, "%d", &flag) == 1) && (flag == 0)) { rtapi_print_msg(RTAPI_MSG_WARN, "rtapi:%d: cannot create core dumps - /proc/sys/fs/suid_dumpable contains 0", instance_id); rtapi_print_msg(RTAPI_MSG_WARN, "you might have to run 'echo 1 > /proc/sys/fs/suid_dumpable'" " as root to enable rtapi_app core dumps"); } fclose(fd); } configure_memory(); if (getrusage(RUSAGE_SELF, &rusage)) { rtapi_print_msg(RTAPI_MSG_WARN, "getrusage(RUSAGE_SELF) failed: %d '%s'\n", errno,strerror(errno)); } else { minflt = rusage.ru_minflt; majflt = rusage.ru_majflt; if (atexit(exit_handler)) { rtapi_print_msg(RTAPI_MSG_WARN, "atexit() failed: %d '%s'\n", errno,strerror(errno)); } } if (flavor->id == RTAPI_XENOMAI_ID) { int retval = user_in_xenomai_group(); switch (retval) { case 1: // { // gid_t xg = xenomai_gid(); // do_setuid(); // if (setegid(xg)) // rtapi_print_msg(RTAPI_MSG_ERR, // "setegid(%d): %s", xg, strerror(errno)); // undo_setuid(); // rtapi_print_msg(RTAPI_MSG_ERR, // "xg=%d egid now %d", xg, getegid()); // } break; case 0: rtapi_print_msg(RTAPI_MSG_ERR, "this user is not member of group xenomai"); rtapi_print_msg(RTAPI_MSG_ERR, "please 'sudo adduser <username> xenomai'," " logout and login again"); return -1; default: rtapi_print_msg(RTAPI_MSG_ERR, "cannot determine if this user is a member of group xenomai: %s", strerror(-retval)); return -1; } } #if defined(__x86_64__) || defined(__i386__) // this is a bit of a shotgun approach and should be made more selective // however, due to serial invocations of rtapi_app during setup it is not // guaranteed the process executing e.g. hal_parport's rtapi_app_main is // the same process which starts the RT threads, causing hal_parport // thread functions to fail on inb/outb if (use_drivers || (flavor->flags & FLAVOR_DOES_IO)) { if (iopl(3) < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "cannot gain I/O privileges - " "forgot 'sudo make setuid'?\n"); return -EPERM; } } #endif return 0; } static void usage(int argc, char **argv) { printf("Usage: %s [options]\n", argv[0]); } static struct option long_options[] = { {"help", no_argument, 0, 'h'}, {"foreground", no_argument, 0, 'F'}, {"instance", required_argument, 0, 'I'}, {"ini", required_argument, 0, 'i'}, // default: getenv(INI_FILE_NAME) {"drivers", required_argument, 0, 'D'}, {"uri", required_argument, 0, 'U'}, {"debug", no_argument, 0, 'd'}, {"svcuuid", required_argument, 0, 'R'}, {"interfaces", required_argument, 0, 'n'}, {0, 0, 0, 0} }; int main(int argc, char **argv) { int c; progname = argv[0]; inifile = getenv("MACHINEKIT_INI"); uuid_generate_time(process_uuid); uuid_unparse(process_uuid, process_uuid_str); rtapi_set_msg_handler(rtapi_app_msg_handler); openlog_async(argv[0], LOG_NDELAY, LOG_LOCAL1); setlogmask_async(LOG_UPTO(LOG_DEBUG)); // max out async syslog buffers for slow system in debug mode tunelog_async(99,1000); while (1) { int option_index = 0; int curind = optind; c = getopt_long (argc, argv, "hH:m:I:f:r:U:NFdR:n:i:", long_options, &option_index); if (c == -1) break; switch (c) { case 'd': debug++; break; case 'D': use_drivers = 1; break; case 'F': foreground = 1; rtapi_set_msg_handler(stderr_rtapi_msg_handler); break; case 'i': inifile = strdup(optarg); break; case 'I': instance_id = atoi(optarg); break; case 'f': if ((flavor = flavor_byname(optarg)) == NULL) { fprintf(stderr, "no such flavor: '%s' -- valid flavors are:\n", optarg); flavor_ptr f = flavors; while (f->name) { fprintf(stderr, "\t%s\n", f->name); f++; } exit(1); } break; case 'U': z_uri = optarg; break; case 'n': interfaces = strdup(optarg); break; case 'R': service_uuid = strdup(optarg); break; case '?': if (optopt) fprintf(stderr, "bad short opt '%c'\n", optopt); else fprintf(stderr, "bad long opt \"%s\"\n", argv[curind]); //usage(argc, argv); exit(1); break; default: usage(argc, argv); exit(0); } } if (inifile && ((inifp = fopen(inifile,"r")) == NULL)) { fprintf(stderr,"rtapi_app: cant open inifile '%s'\n", inifile); } // must have a MKUUID one way or the other if (service_uuid == NULL) { const char *s; if ((s = iniFind(inifp, "MKUUID", "MACHINEKIT"))) { service_uuid = strdup(s); } } if (service_uuid == NULL) { fprintf(stderr, "rtapi: no service UUID (-R <uuid> or environment MKUUID) present\n"); exit(-1); } #ifdef NOTYET iniFindInt(inifp, "REMOTE", "MACHINEKIT", &remote); if (remote && (interfaces == NULL)) { const char *s; if ((s = iniFind(inifp, "INTERFACES", "MACHINEKIT"))) { interfaces = strdup(s); } } #endif // the actual checking for setuid happens in harden_rt() (if needed) if (getuid() != 0) { pid_t pid1; pid_t pid2; int status; if ((pid1 = fork())) { waitpid(pid1, &status, 0); exit(status); } else if (!pid1) { if ((pid2 = fork())) { exit(0); } else if (!pid2) { setsid(); // Detach from the parent session } else { exit(1); } } else { exit(1); } } else { // dont run as root XXX } exit(mainloop(argc, argv)); } // normally rtapi_app will log through the message ringbuffer in the // global data segment. This isnt available initially, and during shutdown, // so switch to direct syslog during these time windows so we dont // loose log messages, even if they cant go through the ringbuffer static void rtapi_app_msg_handler(msg_level_t level, const char *fmt, va_list ap) { // during startup the global segment might not be // available yet, so use stderr until then if (global_data) { vs_ring_write(level, fmt, ap); } else { vsyslog_async(rtapi2syslog(level), fmt, ap); } } // use this handler if -F/--foreground was given static void stderr_rtapi_msg_handler(msg_level_t level, const char *fmt, va_list ap) { vfprintf(stderr, fmt, ap); } static void remove_module(std::string name) { std::vector<string>::iterator invalid; invalid = remove( loading_order.begin(), loading_order.end(), name ); }
lgpl-2.1
jiangbo212/netty-init
html-docs/contents/d06fea664dd4592ab2eb97007a947c6e.html
7301
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <!-- <script src="http://use.edgefonts.net/source-sans-pro;source-code-pro.js"></script> --> <link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,300italic,400italic,700italic|Source+Code+Pro:300,400,700' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="../assets/css/bootstrap.css"> <link rel="stylesheet" href="../assets/css/jquery.bonsai.css"> <link rel="stylesheet" href="../assets/css/main.css"> <link rel="stylesheet" href="../assets/css/icons.css"> <script type="text/javascript" src="../assets/js/jquery-2.1.0.min.js"></script> <script type="text/javascript" src="../assets/js/bootstrap.js"></script> <script type="text/javascript" src="../assets/js/jquery.bonsai.js"></script> <!-- <script type="text/javascript" src="../assets/js/main.js"></script> --> </head> <body> <div> <!-- Name Title --> <h1>(unnamed)</h1> <!-- Type and Stereotype --> <section style="margin-top: .5em;"> <span class="alert alert-info"> <span class="node-icon _icon-UMLGeneralization"></span> UMLGeneralization </span> </section> <!-- Path --> <section style="margin-top: 10px"> <span class="label label-info"><a href='cf9c8b720f3815adeccaf3ef6e48c6c4.html'><span class='node-icon _icon-Project'></span>Untitled</a></span> <span>::</span> <span class="label label-info"><a href='6550300e57d7fc770bd2e9afbcdb3ecb.html'><span class='node-icon _icon-UMLModel'></span>JavaReverse</a></span> <span>::</span> <span class="label label-info"><a href='7ff2d96ca3eb7f62f48c1a30b3c7c990.html'><span class='node-icon _icon-UMLPackage'></span>net</a></span> <span>::</span> <span class="label label-info"><a href='7adc4be4f2e4859086f068fc27512d85.html'><span class='node-icon _icon-UMLPackage'></span>gleamynode</a></span> <span>::</span> <span class="label label-info"><a href='bb15307bdbbaf31bfef4f71be74150ae.html'><span class='node-icon _icon-UMLPackage'></span>netty</a></span> <span>::</span> <span class="label label-info"><a href='392fd228dddcffe2ef252f5663cf31a7.html'><span class='node-icon _icon-UMLPackage'></span>channel</a></span> <span>::</span> <span class="label label-info"><a href='6c70ca2d44dbb8586b8590225d3474f2.html'><span class='node-icon _icon-UMLClass'></span>DefaultChannelStateEvent</a></span> <span>::</span> <span class="label label-info"><a href='d06fea664dd4592ab2eb97007a947c6e.html'><span class='node-icon _icon-UMLGeneralization'></span>(DefaultChannelStateEvent→DefaultChannelEvent)</a></span> </section> <!-- Diagram --> <!-- Description --> <section> <h3>Description</h3> <div> <span class="label label-info">none</span> </div> </section> <!-- Specification --> <!-- Directed Relationship --> <section class="element-list"> <table width="100%"> <tr> <td width="50%"> <h3>Source</h3> <ul class="nav nav-list"> <li><a href='6c70ca2d44dbb8586b8590225d3474f2.html'><span class='node-icon _icon-UMLClass'></span>DefaultChannelStateEvent</a></a></li> </ul> </td> <td width="50%"> <h3>Target</h3> <ul class="nav nav-list"> <li><a href='aecb7e7ef54674250158ee8a116dc3e6.html'><span class='node-icon _icon-UMLClass'></span>DefaultChannelEvent</a></a></li> </ul> </td> </tr> </table> </section> <!-- Undirected Relationship --> <!-- Classifier --> <!-- Interface --> <!-- Component --> <!-- Node --> <!-- Actor --> <!-- Use Case --> <!-- Template Parameters --> <!-- Literals --> <!-- Attributes --> <!-- Operations --> <!-- Receptions --> <!-- Extension Points --> <!-- Parameters --> <!-- Diagrams --> <!-- Behavior --> <!-- Action --> <!-- Interaction --> <!-- CombinedFragment --> <!-- Activity --> <!-- State Machine --> <!-- State Machine --> <!-- State --> <!-- Vertex --> <!-- Transition --> <!-- Properties --> <section> <h3>Properties</h3> <table class="table table-striped table-bordered"> <tr> <th width="50%">Name</th> <th width="50%">Value</th> </tr> <tr> <td>name</td> <td></td> </tr> <tr> <td>source</td> <td><a href='6c70ca2d44dbb8586b8590225d3474f2.html'><span class='node-icon _icon-UMLClass'></span>DefaultChannelStateEvent</a></td> </tr> <tr> <td>target</td> <td><a href='aecb7e7ef54674250158ee8a116dc3e6.html'><span class='node-icon _icon-UMLClass'></span>DefaultChannelEvent</a></td> </tr> <tr> <td>stereotype</td> <td><span class='label label-info'>null</span></td> </tr> <tr> <td>visibility</td> <td>public</td> </tr> <tr> <td>discriminator</td> <td></td> </tr> </table> </section> <!-- Tags --> <!-- Constraints, Dependencies, Dependants --> <!-- Relationships --> <!-- Owned Elements --> </div> </body> </html>
lgpl-2.1
pocketbook-free/browser
pango-1.26.2/docs/html/pango-X-Fonts-and-Rendering.html
61917
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Deprecated X font backend</title> <meta name="generator" content="DocBook XSL Stylesheets V1.75.2"> <link rel="home" href="index.html" title="Pango Reference Manual"> <link rel="up" href="rendering.html" title="Rendering with Pango"> <link rel="prev" href="pango-ATSUI-Fonts.html" title="ATSUI Fonts"> <link rel="next" href="lowlevel.html" title="Low Level Functionality"> <meta name="generator" content="GTK-Doc V1.11 (XML mode)"> <link rel="stylesheet" href="style.css" type="text/css"> <link rel="chapter" href="pango.html" title="Basic Pango Interfaces"> <link rel="chapter" href="rendering.html" title="Rendering with Pango"> <link rel="chapter" href="lowlevel.html" title="Low Level Functionality"> <link rel="chapter" href="tools.html" title="Pango Tools"> <link rel="chapter" href="pango-hierarchy.html" title="Object Hierarchy"> <link rel="index" href="index-all.html" title="Index"> <link rel="index" href="index-deprecated.html" title="Index of deprecated symbols"> <link rel="index" href="index-1.2.html" title="Index of new symbols in 1.2"> <link rel="index" href="index-1.4.html" title="Index of new symbols in 1.4"> <link rel="index" href="index-1.6.html" title="Index of new symbols in 1.6"> <link rel="index" href="index-1.8.html" title="Index of new symbols in 1.8"> <link rel="index" href="index-1.10.html" title="Index of new symbols in 1.10"> <link rel="index" href="index-1.12.html" title="Index of new symbols in 1.12"> <link rel="index" href="index-1.14.html" title="Index of new symbols in 1.14"> <link rel="index" href="index-1.16.html" title="Index of new symbols in 1.16"> <link rel="index" href="index-1.18.html" title="Index of new symbols in 1.18"> <link rel="index" href="index-1.20.html" title="Index of new symbols in 1.20"> <link rel="index" href="index-1.22.html" title="Index of new symbols in 1.22"> <link rel="index" href="index-1.24.html" title="Index of new symbols in 1.24"> <link rel="index" href="index-1.26.html" title="Index of new symbols in 1.26"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"> <tr valign="middle"> <td><a accesskey="p" href="pango-ATSUI-Fonts.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td> <td><a accesskey="u" href="rendering.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td> <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td> <th width="100%" align="center">Pango Reference Manual</th> <td><a accesskey="n" href="lowlevel.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td> </tr> <tr><td colspan="5" class="shortcuts"> <a href="#pango-X-Fonts-and-Rendering.synopsis" class="shortcut">Top</a>  |  <a href="#pango-X-Fonts-and-Rendering.description" class="shortcut">Description</a> </td></tr> </table> <div class="refentry" title="Deprecated X font backend"> <a name="pango-X-Fonts-and-Rendering"></a><div class="titlepage"></div> <div class="refnamediv"><table width="100%"><tr> <td valign="top"> <h2><span class="refentrytitle"><a name="pango-X-Fonts-and-Rendering.top_of_page"></a>Deprecated X font backend</span></h2> <p>Deprecated X font backend — Font handling and rendering with the deprecated X font backend</p> </td> <td valign="top" align="right"></td> </tr></table></div> <div class="refsynopsisdiv" title="Synopsis"> <a name="pango-X-Fonts-and-Rendering.synopsis"></a><h2>Synopsis</h2> <pre class="synopsis"> #define <a class="link" href="pango-X-Fonts-and-Rendering.html#PANGO-RENDER-TYPE-X--CAPS" title="PANGO_RENDER_TYPE_X">PANGO_RENDER_TYPE_X</a> <a class="link" href="pango-Text-Processing.html#PangoContext">PangoContext</a> * <a class="link" href="pango-X-Fonts-and-Rendering.html#pango-x-get-context" title="pango_x_get_context ()">pango_x_get_context</a> (Display *display); void <a class="link" href="pango-X-Fonts-and-Rendering.html#pango-x-context-set-funcs" title="pango_x_context_set_funcs ()">pango_x_context_set_funcs</a> (<a class="link" href="pango-Text-Processing.html#PangoContext">PangoContext</a> *context, <a class="link" href="pango-X-Fonts-and-Rendering.html#PangoGetGCFunc" title="PangoGetGCFunc ()">PangoGetGCFunc</a> get_gc_func, <a class="link" href="pango-X-Fonts-and-Rendering.html#PangoFreeGCFunc" title="PangoFreeGCFunc ()">PangoFreeGCFunc</a> free_gc_func); GC (<a class="link" href="pango-X-Fonts-and-Rendering.html#PangoGetGCFunc" title="PangoGetGCFunc ()">*PangoGetGCFunc</a>) (<a class="link" href="pango-Text-Processing.html#PangoContext">PangoContext</a> *context, <a class="link" href="pango-Text-Attributes.html#PangoColor" title="PangoColor">PangoColor</a> *color, GC base_gc); void (<a class="link" href="pango-X-Fonts-and-Rendering.html#PangoFreeGCFunc" title="PangoFreeGCFunc ()">*PangoFreeGCFunc</a>) (<a class="link" href="pango-Text-Processing.html#PangoContext">PangoContext</a> *context, GC gc); void <a class="link" href="pango-X-Fonts-and-Rendering.html#pango-x-render" title="pango_x_render ()">pango_x_render</a> (Display *display, Drawable d, GC gc, <a class="link" href="pango-Fonts.html#PangoFont">PangoFont</a> *font, <a class="link" href="pango-Glyph-Storage.html#PangoGlyphString" title="PangoGlyphString">PangoGlyphString</a> *glyphs, <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint" >gint</a> x, <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint" >gint</a> y); void <a class="link" href="pango-X-Fonts-and-Rendering.html#pango-x-render-layout-line" title="pango_x_render_layout_line ()">pango_x_render_layout_line</a> (Display *display, Drawable drawable, GC gc, <a class="link" href="pango-Layout-Objects.html#PangoLayoutLine" title="PangoLayoutLine">PangoLayoutLine</a> *line, int x, int y); void <a class="link" href="pango-X-Fonts-and-Rendering.html#pango-x-render-layout" title="pango_x_render_layout ()">pango_x_render_layout</a> (Display *display, Drawable drawable, GC gc, <a class="link" href="pango-Layout-Objects.html#PangoLayout">PangoLayout</a> *layout, int x, int y); typedef <a class="link" href="pango-X-Fonts-and-Rendering.html#PangoXSubfont" title="PangoXSubfont">PangoXSubfont</a>; #define <a class="link" href="pango-X-Fonts-and-Rendering.html#PANGO-X-MAKE-GLYPH--CAPS" title="PANGO_X_MAKE_GLYPH()">PANGO_X_MAKE_GLYPH</a> (subfont,index_) #define <a class="link" href="pango-X-Fonts-and-Rendering.html#PANGO-X-GLYPH-SUBFONT--CAPS" title="PANGO_X_GLYPH_SUBFONT()">PANGO_X_GLYPH_SUBFONT</a> (glyph) #define <a class="link" href="pango-X-Fonts-and-Rendering.html#PANGO-X-GLYPH-INDEX--CAPS" title="PANGO_X_GLYPH_INDEX()">PANGO_X_GLYPH_INDEX</a> (glyph) <a class="link" href="pango-Fonts.html#PangoFont">PangoFont</a> * <a class="link" href="pango-X-Fonts-and-Rendering.html#pango-x-load-font" title="pango_x_load_font ()">pango_x_load_font</a> (Display *display, const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar" >gchar</a> *spec); <a class="link" href="pango-Glyph-Storage.html#PangoGlyph" title="PangoGlyph">PangoGlyph</a> <a class="link" href="pango-X-Fonts-and-Rendering.html#pango-x-get-unknown-glyph" title="pango_x_get_unknown_glyph ()">pango_x_get_unknown_glyph</a> (<a class="link" href="pango-Fonts.html#PangoFont">PangoFont</a> *font); <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean" >gboolean</a> <a class="link" href="pango-X-Fonts-and-Rendering.html#pango-x-has-glyph" title="pango_x_has_glyph ()">pango_x_has_glyph</a> (<a class="link" href="pango-Fonts.html#PangoFont">PangoFont</a> *font, <a class="link" href="pango-Glyph-Storage.html#PangoGlyph" title="PangoGlyph">PangoGlyph</a> glyph); int <a class="link" href="pango-X-Fonts-and-Rendering.html#pango-x-list-subfonts" title="pango_x_list_subfonts ()">pango_x_list_subfonts</a> (<a class="link" href="pango-Fonts.html#PangoFont">PangoFont</a> *font, char **charsets, int n_charsets, <a class="link" href="pango-X-Fonts-and-Rendering.html#PangoXSubfont" title="PangoXSubfont">PangoXSubfont</a> **subfont_ids, int **subfont_charsets); <a class="link" href="pango-Fonts.html#PangoFontMap">PangoFontMap</a> * <a class="link" href="pango-X-Fonts-and-Rendering.html#pango-x-font-map-for-display" title="pango_x_font_map_for_display ()">pango_x_font_map_for_display</a> (Display *display); void <a class="link" href="pango-X-Fonts-and-Rendering.html#pango-x-shutdown-display" title="pango_x_shutdown_display ()">pango_x_shutdown_display</a> (Display *display); <a class="link" href="pango-X-Fonts-and-Rendering.html#PangoXFontCache" title="PangoXFontCache">PangoXFontCache</a> * <a class="link" href="pango-X-Fonts-and-Rendering.html#pango-x-font-map-get-font-cache" title="pango_x_font_map_get_font_cache ()">pango_x_font_map_get_font_cache</a> (<a class="link" href="pango-Fonts.html#PangoFontMap">PangoFontMap</a> *font_map); char * <a class="link" href="pango-X-Fonts-and-Rendering.html#pango-x-font-subfont-xlfd" title="pango_x_font_subfont_xlfd ()">pango_x_font_subfont_xlfd</a> (<a class="link" href="pango-Fonts.html#PangoFont">PangoFont</a> *font, <a class="link" href="pango-X-Fonts-and-Rendering.html#PangoXSubfont" title="PangoXSubfont">PangoXSubfont</a> subfont_id); <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean" >gboolean</a> <a class="link" href="pango-X-Fonts-and-Rendering.html#pango-x-find-first-subfont" title="pango_x_find_first_subfont ()">pango_x_find_first_subfont</a> (<a class="link" href="pango-Fonts.html#PangoFont">PangoFont</a> *font, char **charsets, int n_charsets, <a class="link" href="pango-X-Fonts-and-Rendering.html#PangoXSubfont" title="PangoXSubfont">PangoXSubfont</a> *rfont); <a class="link" href="pango-Glyph-Storage.html#PangoGlyph" title="PangoGlyph">PangoGlyph</a> <a class="link" href="pango-X-Fonts-and-Rendering.html#pango-x-font-get-unknown-glyph" title="pango_x_font_get_unknown_glyph ()">pango_x_font_get_unknown_glyph</a> (<a class="link" href="pango-Fonts.html#PangoFont">PangoFont</a> *font, <a href="http://library.gnome.org/devel/glib/unstable/glib-Unicode-Manipulation.html#gunichar" >gunichar</a> wc); <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean" >gboolean</a> <a class="link" href="pango-X-Fonts-and-Rendering.html#pango-x-apply-ligatures" title="pango_x_apply_ligatures ()">pango_x_apply_ligatures</a> (<a class="link" href="pango-Fonts.html#PangoFont">PangoFont</a> *font, <a class="link" href="pango-X-Fonts-and-Rendering.html#PangoXSubfont" title="PangoXSubfont">PangoXSubfont</a> subfont, <a href="http://library.gnome.org/devel/glib/unstable/glib-Unicode-Manipulation.html#gunichar" >gunichar</a> **glyphs, int *n_glyphs, int **clusters); void <a class="link" href="pango-X-Fonts-and-Rendering.html#pango-x-fallback-shape" title="pango_x_fallback_shape ()">pango_x_fallback_shape</a> (<a class="link" href="pango-Fonts.html#PangoFont">PangoFont</a> *font, <a class="link" href="pango-Glyph-Storage.html#PangoGlyphString" title="PangoGlyphString">PangoGlyphString</a> *glyphs, const char *text, int n_chars); <a class="link" href="pango-X-Fonts-and-Rendering.html#PangoXFontCache" title="PangoXFontCache">PangoXFontCache</a>; <a class="link" href="pango-X-Fonts-and-Rendering.html#PangoXFontCache" title="PangoXFontCache">PangoXFontCache</a> * <a class="link" href="pango-X-Fonts-and-Rendering.html#pango-x-font-cache-new" title="pango_x_font_cache_new ()">pango_x_font_cache_new</a> (Display *display); void <a class="link" href="pango-X-Fonts-and-Rendering.html#pango-x-font-cache-free" title="pango_x_font_cache_free ()">pango_x_font_cache_free</a> (<a class="link" href="pango-X-Fonts-and-Rendering.html#PangoXFontCache" title="PangoXFontCache">PangoXFontCache</a> *cache); XFontStruct * <a class="link" href="pango-X-Fonts-and-Rendering.html#pango-x-font-cache-load" title="pango_x_font_cache_load ()">pango_x_font_cache_load</a> (<a class="link" href="pango-X-Fonts-and-Rendering.html#PangoXFontCache" title="PangoXFontCache">PangoXFontCache</a> *cache, const char *xlfd); void <a class="link" href="pango-X-Fonts-and-Rendering.html#pango-x-font-cache-unload" title="pango_x_font_cache_unload ()">pango_x_font_cache_unload</a> (<a class="link" href="pango-X-Fonts-and-Rendering.html#PangoXFontCache" title="PangoXFontCache">PangoXFontCache</a> *cache, XFontStruct *fs); </pre> </div> <div class="refsect1" title="Description"> <a name="pango-X-Fonts-and-Rendering.description"></a><h2>Description</h2> <p> The functions and macros in this section are for use with the old X font backend which used server-side bitmap fonts. This font backend is no longer supported, and attempts to use it will produce unpredictable results. Use the <a class="link" href="pango-Xft-Fonts-and-Rendering.html" title="Xft Fonts and Rendering">Xft</a> or <a class="link" href="pango-Cairo-Rendering.html" title="Cairo Rendering">Cairo</a> backend instead. </p> </div> <div class="refsect1" title="Details"> <a name="pango-X-Fonts-and-Rendering.details"></a><h2>Details</h2> <div class="refsect2" title="PANGO_RENDER_TYPE_X"> <a name="PANGO-RENDER-TYPE-X--CAPS"></a><h3>PANGO_RENDER_TYPE_X</h3> <pre class="programlisting">#define PANGO_RENDER_TYPE_X "PangoRenderX" </pre> <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"> <h3 class="title">Warning</h3> <p><code class="literal">PANGO_RENDER_TYPE_X</code> is deprecated and should not be used in newly-written code.</p> </div> <p> A string constant identifying the X renderer. The associated quark (see <a href="http://library.gnome.org/devel/glib/unstable/glib-Quarks.html#g-quark-from-string" ><code class="function">g_quark_from_string()</code></a>) is used to identify the renderer in <a class="link" href="pango-Modules.html#pango-find-map" title="pango_find_map ()"><code class="function">pango_find_map()</code></a>. </p> </div> <hr> <div class="refsect2" title="pango_x_get_context ()"> <a name="pango-x-get-context"></a><h3>pango_x_get_context ()</h3> <pre class="programlisting"><a class="link" href="pango-Text-Processing.html#PangoContext">PangoContext</a> * pango_x_get_context (Display *display);</pre> <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"> <h3 class="title">Warning</h3> <p><code class="literal">pango_x_get_context</code> has been deprecated since version 1.22 and should not be used in newly-written code. Use <a class="link" href="pango-X-Fonts-and-Rendering.html#pango-x-font-map-for-display" title="pango_x_font_map_for_display ()"><code class="function">pango_x_font_map_for_display()</code></a> followed by <a class="link" href="pango-Fonts.html#pango-font-map-create-context" title="pango_font_map_create_context ()"><code class="function">pango_font_map_create_context()</code></a> instead.</p> </div> <p> Retrieves a <a class="link" href="pango-Text-Processing.html#PangoContext"><span class="type">PangoContext</span></a> appropriate for rendering with X fonts on the given display.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><p><span class="term"><em class="parameter"><code>display</code></em> :</span></p></td> <td> an X display (As returned by <code class="function">XOpenDisplay()</code>.) </td> </tr> <tr> <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> <td> the new <a class="link" href="pango-Text-Processing.html#PangoContext"><span class="type">PangoContext</span></a>. </td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2" title="pango_x_context_set_funcs ()"> <a name="pango-x-context-set-funcs"></a><h3>pango_x_context_set_funcs ()</h3> <pre class="programlisting">void pango_x_context_set_funcs (<a class="link" href="pango-Text-Processing.html#PangoContext">PangoContext</a> *context, <a class="link" href="pango-X-Fonts-and-Rendering.html#PangoGetGCFunc" title="PangoGetGCFunc ()">PangoGetGCFunc</a> get_gc_func, <a class="link" href="pango-X-Fonts-and-Rendering.html#PangoFreeGCFunc" title="PangoFreeGCFunc ()">PangoFreeGCFunc</a> free_gc_func);</pre> <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"> <h3 class="title">Warning</h3> <p><code class="literal">pango_x_context_set_funcs</code> is deprecated and should not be used in newly-written code.</p> </div> <p> Sets the functions that will be used to get GC's in various colors when rendering layouts with this context.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td> <td> a <a class="link" href="pango-Text-Processing.html#PangoContext"><span class="type">PangoContext</span></a>. </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>get_gc_func</code></em> :</span></p></td> <td> function called to create a new GC for a given color. </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>free_gc_func</code></em> :</span></p></td> <td> function called to free a GC created with <em class="parameter"><code>get_gc_func</code></em>. </td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2" title="PangoGetGCFunc ()"> <a name="PangoGetGCFunc"></a><h3>PangoGetGCFunc ()</h3> <pre class="programlisting">GC (*PangoGetGCFunc) (<a class="link" href="pango-Text-Processing.html#PangoContext">PangoContext</a> *context, <a class="link" href="pango-Text-Attributes.html#PangoColor" title="PangoColor">PangoColor</a> *color, GC base_gc);</pre> <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"> <h3 class="title">Warning</h3> <p><code class="literal">PangoGetGCFunc</code> is deprecated and should not be used in newly-written code.</p> </div> <p> Specifies the type of the function used to create a new GC for a given color. </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td> <td>a <a class="link" href="pango-Text-Processing.html#PangoContext"><span class="type">PangoContext</span></a>. </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>color</code></em> :</span></p></td> <td>the color to create a new GC for. </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>base_gc</code></em> :</span></p></td> <td>the GC to base the new GC on. </td> </tr> <tr> <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> <td>the new GC. </td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2" title="PangoFreeGCFunc ()"> <a name="PangoFreeGCFunc"></a><h3>PangoFreeGCFunc ()</h3> <pre class="programlisting">void (*PangoFreeGCFunc) (<a class="link" href="pango-Text-Processing.html#PangoContext">PangoContext</a> *context, GC gc);</pre> <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"> <h3 class="title">Warning</h3> <p><code class="literal">PangoFreeGCFunc</code> is deprecated and should not be used in newly-written code.</p> </div> <p> Specifies the type of the function used to free a GC created with the corresponding <a class="link" href="pango-X-Fonts-and-Rendering.html#PangoGetGCFunc" title="PangoGetGCFunc ()"><span class="type">PangoGetGCFunc</span></a> function. </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td> <td>a <a class="link" href="pango-Text-Processing.html#PangoContext"><span class="type">PangoContext</span></a>. </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>gc</code></em> :</span></p></td> <td>the GC to free. </td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2" title="pango_x_render ()"> <a name="pango-x-render"></a><h3>pango_x_render ()</h3> <pre class="programlisting">void pango_x_render (Display *display, Drawable d, GC gc, <a class="link" href="pango-Fonts.html#PangoFont">PangoFont</a> *font, <a class="link" href="pango-Glyph-Storage.html#PangoGlyphString" title="PangoGlyphString">PangoGlyphString</a> *glyphs, <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint" >gint</a> x, <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint" >gint</a> y);</pre> <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"> <h3 class="title">Warning</h3> <p><code class="literal">pango_x_render</code> is deprecated and should not be used in newly-written code.</p> </div> <p> Renders a <a class="link" href="pango-Glyph-Storage.html#PangoGlyphString" title="PangoGlyphString"><span class="type">PangoGlyphString</span></a> onto an X drawable.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><p><span class="term"><em class="parameter"><code>display</code></em> :</span></p></td> <td> the X display. </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>d</code></em> :</span></p></td> <td> the drawable on which to draw string. </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>gc</code></em> :</span></p></td> <td> the graphics context. </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>font</code></em> :</span></p></td> <td> the font in which to draw the string. </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>glyphs</code></em> :</span></p></td> <td> the glyph string to draw. </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>x</code></em> :</span></p></td> <td> the x position of start of string (in pixels). </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>y</code></em> :</span></p></td> <td> the y position of baseline (in pixels). </td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2" title="pango_x_render_layout_line ()"> <a name="pango-x-render-layout-line"></a><h3>pango_x_render_layout_line ()</h3> <pre class="programlisting">void pango_x_render_layout_line (Display *display, Drawable drawable, GC gc, <a class="link" href="pango-Layout-Objects.html#PangoLayoutLine" title="PangoLayoutLine">PangoLayoutLine</a> *line, int x, int y);</pre> <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"> <h3 class="title">Warning</h3> <p><code class="literal">pango_x_render_layout_line</code> is deprecated and should not be used in newly-written code.</p> </div> <p> Renders a <a class="link" href="pango-Layout-Objects.html#PangoLayoutLine" title="PangoLayoutLine"><span class="type">PangoLayoutLine</span></a> onto an X drawable.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><p><span class="term"><em class="parameter"><code>display</code></em> :</span></p></td> <td> the X display. </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>drawable</code></em> :</span></p></td> <td> the drawable on which to draw. </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>gc</code></em> :</span></p></td> <td> GC to use for uncolored drawing. </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>line</code></em> :</span></p></td> <td> a <a class="link" href="pango-Layout-Objects.html#PangoLayoutLine" title="PangoLayoutLine"><span class="type">PangoLayoutLine</span></a>. </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>x</code></em> :</span></p></td> <td> the x position of start of string (in pixels). </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>y</code></em> :</span></p></td> <td> the y position of baseline (in pixels). </td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2" title="pango_x_render_layout ()"> <a name="pango-x-render-layout"></a><h3>pango_x_render_layout ()</h3> <pre class="programlisting">void pango_x_render_layout (Display *display, Drawable drawable, GC gc, <a class="link" href="pango-Layout-Objects.html#PangoLayout">PangoLayout</a> *layout, int x, int y);</pre> <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"> <h3 class="title">Warning</h3> <p><code class="literal">pango_x_render_layout</code> is deprecated and should not be used in newly-written code.</p> </div> <p> Renders a <a class="link" href="pango-Layout-Objects.html#PangoLayout"><span class="type">PangoLayout</span></a> onto an X drawable.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><p><span class="term"><em class="parameter"><code>display</code></em> :</span></p></td> <td> the X display. </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>drawable</code></em> :</span></p></td> <td> the drawable on which to draw. </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>gc</code></em> :</span></p></td> <td> GC to use for uncolored drawing. </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>layout</code></em> :</span></p></td> <td> a <a class="link" href="pango-Layout-Objects.html#PangoLayout"><span class="type">PangoLayout</span></a>. </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>x</code></em> :</span></p></td> <td> the x position of the left of the layout (in pixels). </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>y</code></em> :</span></p></td> <td> the y position of the top of the layout (in pixels). </td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2" title="PangoXSubfont"> <a name="PangoXSubfont"></a><h3>PangoXSubfont</h3> <pre class="programlisting">typedef guint16 PangoXSubfont; </pre> <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"> <h3 class="title">Warning</h3> <p><code class="literal">PangoXSubfont</code> is deprecated and should not be used in newly-written code.</p> </div> <p> The <span class="type">PangoXSubFont</span> type is an integer ID that identifies one particular X font within the fonts referenced in a <a class="link" href="pango-Fonts.html#PangoFont"><span class="type">PangoFont</span></a>. </p> </div> <hr> <div class="refsect2" title="PANGO_X_MAKE_GLYPH()"> <a name="PANGO-X-MAKE-GLYPH--CAPS"></a><h3>PANGO_X_MAKE_GLYPH()</h3> <pre class="programlisting">#define PANGO_X_MAKE_GLYPH(subfont,index_) ((subfont)&lt;&lt;16 | (index_)) </pre> <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"> <h3 class="title">Warning</h3> <p><code class="literal">PANGO_X_MAKE_GLYPH</code> is deprecated and should not be used in newly-written code.</p> </div> <p> Make a glyph index from a <span class="type">PangoXSubFont</span> index and a index of a character with the corresponding X font. </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><p><span class="term"><em class="parameter"><code>subfont</code></em> :</span></p></td> <td>a <a class="link" href="pango-X-Fonts-and-Rendering.html#PangoXSubfont" title="PangoXSubfont"><span class="type">PangoXSubfont</span></a> index </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>index_</code></em> :</span></p></td> <td>the index of a character within an X font. </td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2" title="PANGO_X_GLYPH_SUBFONT()"> <a name="PANGO-X-GLYPH-SUBFONT--CAPS"></a><h3>PANGO_X_GLYPH_SUBFONT()</h3> <pre class="programlisting">#define PANGO_X_GLYPH_SUBFONT(glyph) ((glyph)&gt;&gt;16) </pre> <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"> <h3 class="title">Warning</h3> <p><code class="literal">PANGO_X_GLYPH_SUBFONT</code> is deprecated and should not be used in newly-written code.</p> </div> <p> Extract the subfont index from a glyph index. </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody><tr> <td><p><span class="term"><em class="parameter"><code>glyph</code></em> :</span></p></td> <td>a <span class="type">PangoGlyphIndex</span> </td> </tr></tbody> </table></div> </div> <hr> <div class="refsect2" title="PANGO_X_GLYPH_INDEX()"> <a name="PANGO-X-GLYPH-INDEX--CAPS"></a><h3>PANGO_X_GLYPH_INDEX()</h3> <pre class="programlisting">#define PANGO_X_GLYPH_INDEX(glyph) ((glyph) &amp; 0xffff) </pre> <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"> <h3 class="title">Warning</h3> <p><code class="literal">PANGO_X_GLYPH_INDEX</code> is deprecated and should not be used in newly-written code.</p> </div> <p> Extract the character index within the X font from a glyph index. </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody><tr> <td><p><span class="term"><em class="parameter"><code>glyph</code></em> :</span></p></td> <td>a <span class="type">PangoGlyphIndex</span> </td> </tr></tbody> </table></div> </div> <hr> <div class="refsect2" title="pango_x_load_font ()"> <a name="pango-x-load-font"></a><h3>pango_x_load_font ()</h3> <pre class="programlisting"><a class="link" href="pango-Fonts.html#PangoFont">PangoFont</a> * pango_x_load_font (Display *display, const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar" >gchar</a> *spec);</pre> <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"> <h3 class="title">Warning</h3> <p><code class="literal">pango_x_load_font</code> is deprecated and should not be used in newly-written code.</p> </div> <p> Loads up a logical font based on a "fontset" style text specification. This is not remotely useful (Pango API's generally work in terms of <a class="link" href="pango-Fonts.html#PangoFontDescription" title="PangoFontDescription"><span class="type">PangoFontDescription</span></a>) and the result may not work correctly in all circumstances. Use of this function should be avoided.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><p><span class="term"><em class="parameter"><code>display</code></em> :</span></p></td> <td> the X display. </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>spec</code></em> :</span></p></td> <td> a comma-separated list of XLFD's. </td> </tr> <tr> <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> <td> a new <a class="link" href="pango-Fonts.html#PangoFont"><span class="type">PangoFont</span></a>. </td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2" title="pango_x_get_unknown_glyph ()"> <a name="pango-x-get-unknown-glyph"></a><h3>pango_x_get_unknown_glyph ()</h3> <pre class="programlisting"><a class="link" href="pango-Glyph-Storage.html#PangoGlyph" title="PangoGlyph">PangoGlyph</a> pango_x_get_unknown_glyph (<a class="link" href="pango-Fonts.html#PangoFont">PangoFont</a> *font);</pre> <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"> <h3 class="title">Warning</h3> <p><code class="literal">pango_x_get_unknown_glyph</code> is deprecated and should not be used in newly-written code.</p> </div> <p> Returns the index of a glyph suitable for drawing unknown characters; you should generally use <a class="link" href="pango-Glyph-Storage.html#PANGO-GET-UNKNOWN-GLYPH--CAPS" title="PANGO_GET_UNKNOWN_GLYPH()"><code class="function">PANGO_GET_UNKNOWN_GLYPH()</code></a> instead, since that may return a glyph that provides a better representation of a particular char. (E.g., by showing hex digits, or a glyph representative of a certain Unicode range.)</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><p><span class="term"><em class="parameter"><code>font</code></em> :</span></p></td> <td> a <a class="link" href="pango-Fonts.html#PangoFont"><span class="type">PangoFont</span></a>. </td> </tr> <tr> <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> <td> a glyph index into <em class="parameter"><code>font</code></em>. </td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2" title="pango_x_has_glyph ()"> <a name="pango-x-has-glyph"></a><h3>pango_x_has_glyph ()</h3> <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean" >gboolean</a> pango_x_has_glyph (<a class="link" href="pango-Fonts.html#PangoFont">PangoFont</a> *font, <a class="link" href="pango-Glyph-Storage.html#PangoGlyph" title="PangoGlyph">PangoGlyph</a> glyph);</pre> <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"> <h3 class="title">Warning</h3> <p><code class="literal">pango_x_has_glyph</code> is deprecated and should not be used in newly-written code.</p> </div> <p> Checks if the given glyph is present in a X font.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><p><span class="term"><em class="parameter"><code>font</code></em> :</span></p></td> <td> a <a class="link" href="pango-Fonts.html#PangoFont"><span class="type">PangoFont</span></a> which must be from the X backend. </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>glyph</code></em> :</span></p></td> <td> the index of a glyph in the font. (Formed using the <a class="link" href="pango-X-Fonts-and-Rendering.html#PANGO-X-MAKE-GLYPH--CAPS" title="PANGO_X_MAKE_GLYPH()"><span class="type">PANGO_X_MAKE_GLYPH</span></a> macro) </td> </tr> <tr> <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> <td> <code class="literal">TRUE</code> if the glyph is present. </td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2" title="pango_x_list_subfonts ()"> <a name="pango-x-list-subfonts"></a><h3>pango_x_list_subfonts ()</h3> <pre class="programlisting">int pango_x_list_subfonts (<a class="link" href="pango-Fonts.html#PangoFont">PangoFont</a> *font, char **charsets, int n_charsets, <a class="link" href="pango-X-Fonts-and-Rendering.html#PangoXSubfont" title="PangoXSubfont">PangoXSubfont</a> **subfont_ids, int **subfont_charsets);</pre> <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"> <h3 class="title">Warning</h3> <p><code class="literal">pango_x_list_subfonts</code> is deprecated and should not be used in newly-written code.</p> </div> <p> Lists the subfonts of a given font. The result is ordered first by charset, and then within each charset, by the order of fonts in the font specification.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><p><span class="term"><em class="parameter"><code>font</code></em> :</span></p></td> <td> a <a class="link" href="pango-Fonts.html#PangoFont"><span class="type">PangoFont</span></a>. </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>charsets</code></em> :</span></p></td> <td> the charsets to list subfonts for. </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>n_charsets</code></em> :</span></p></td> <td> the number of charsets in <em class="parameter"><code>charsets</code></em>. </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>subfont_ids</code></em> :</span></p></td> <td> location to store a pointer to an array of subfont IDs for each found subfont; the result must be freed using <a href="http://library.gnome.org/devel/glib/unstable/glib-Memory-Allocation.html#g-free" ><code class="function">g_free()</code></a>. </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>subfont_charsets</code></em> :</span></p></td> <td> location to store a pointer to an array of subfont IDs for each found subfont; the result must be freed using <a href="http://library.gnome.org/devel/glib/unstable/glib-Memory-Allocation.html#g-free" ><code class="function">g_free()</code></a>. </td> </tr> <tr> <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> <td> length of the arrays stored in <em class="parameter"><code>subfont_ids</code></em> and <em class="parameter"><code>subfont_charsets</code></em>. </td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2" title="pango_x_font_map_for_display ()"> <a name="pango-x-font-map-for-display"></a><h3>pango_x_font_map_for_display ()</h3> <pre class="programlisting"><a class="link" href="pango-Fonts.html#PangoFontMap">PangoFontMap</a> * pango_x_font_map_for_display (Display *display);</pre> <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"> <h3 class="title">Warning</h3> <p><code class="literal">pango_x_font_map_for_display</code> is deprecated and should not be used in newly-written code.</p> </div> <p> Returns a <span class="type">PangoXFontMap</span> for <em class="parameter"><code>display</code></em>. Font maps are cached and should not be freed. If the font map for a display is no longer needed, it can be released with <a class="link" href="pango-X-Fonts-and-Rendering.html#pango-x-shutdown-display" title="pango_x_shutdown_display ()"><code class="function">pango_x_shutdown_display()</code></a>.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><p><span class="term"><em class="parameter"><code>display</code></em> :</span></p></td> <td> an X <span class="type">Display</span>. </td> </tr> <tr> <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> <td> a <span class="type">PangoXFontMap</span> for <em class="parameter"><code>display</code></em>. </td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2" title="pango_x_shutdown_display ()"> <a name="pango-x-shutdown-display"></a><h3>pango_x_shutdown_display ()</h3> <pre class="programlisting">void pango_x_shutdown_display (Display *display);</pre> <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"> <h3 class="title">Warning</h3> <p><code class="literal">pango_x_shutdown_display</code> is deprecated and should not be used in newly-written code.</p> </div> <p> Free cached resources for the given X display structure.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody><tr> <td><p><span class="term"><em class="parameter"><code>display</code></em> :</span></p></td> <td> an X <span class="type">Display</span> </td> </tr></tbody> </table></div> </div> <hr> <div class="refsect2" title="pango_x_font_map_get_font_cache ()"> <a name="pango-x-font-map-get-font-cache"></a><h3>pango_x_font_map_get_font_cache ()</h3> <pre class="programlisting"><a class="link" href="pango-X-Fonts-and-Rendering.html#PangoXFontCache" title="PangoXFontCache">PangoXFontCache</a> * pango_x_font_map_get_font_cache (<a class="link" href="pango-Fonts.html#PangoFontMap">PangoFontMap</a> *font_map);</pre> <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"> <h3 class="title">Warning</h3> <p><code class="literal">pango_x_font_map_get_font_cache</code> is deprecated and should not be used in newly-written code.</p> </div> <p> Obtains the font cache associated with the given font map.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><p><span class="term"><em class="parameter"><code>font_map</code></em> :</span></p></td> <td> a <span class="type">PangoXFontMap</span>. </td> </tr> <tr> <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> <td> the <a class="link" href="pango-X-Fonts-and-Rendering.html#PangoXFontCache" title="PangoXFontCache"><span class="type">PangoXFontCache</span></a> of <em class="parameter"><code>font_map</code></em>. </td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2" title="pango_x_font_subfont_xlfd ()"> <a name="pango-x-font-subfont-xlfd"></a><h3>pango_x_font_subfont_xlfd ()</h3> <pre class="programlisting">char * pango_x_font_subfont_xlfd (<a class="link" href="pango-Fonts.html#PangoFont">PangoFont</a> *font, <a class="link" href="pango-X-Fonts-and-Rendering.html#PangoXSubfont" title="PangoXSubfont">PangoXSubfont</a> subfont_id);</pre> <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"> <h3 class="title">Warning</h3> <p><code class="literal">pango_x_font_subfont_xlfd</code> is deprecated and should not be used in newly-written code.</p> </div> <p> Determines the X Logical Font Description for the specified subfont.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><p><span class="term"><em class="parameter"><code>font</code></em> :</span></p></td> <td> a <a class="link" href="pango-Fonts.html#PangoFont"><span class="type">PangoFont</span></a> which must be from the X backend. </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>subfont_id</code></em> :</span></p></td> <td> the id of a subfont within the font. </td> </tr> <tr> <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> <td> A newly-allocated string containing the XLFD for the subfont. This string must be freed with <a href="http://library.gnome.org/devel/glib/unstable/glib-Memory-Allocation.html#g-free" ><code class="function">g_free()</code></a>. </td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2" title="pango_x_find_first_subfont ()"> <a name="pango-x-find-first-subfont"></a><h3>pango_x_find_first_subfont ()</h3> <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean" >gboolean</a> pango_x_find_first_subfont (<a class="link" href="pango-Fonts.html#PangoFont">PangoFont</a> *font, char **charsets, int n_charsets, <a class="link" href="pango-X-Fonts-and-Rendering.html#PangoXSubfont" title="PangoXSubfont">PangoXSubfont</a> *rfont);</pre> <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"> <h3 class="title">Warning</h3> <p><code class="literal">pango_x_find_first_subfont</code> is deprecated and should not be used in newly-written code.</p> </div> <p> Looks for subfonts with the <em class="parameter"><code>charset</code></em> charset, in <em class="parameter"><code>font</code></em>, and puts the first one in *<em class="parameter"><code>rfont</code></em>.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><p><span class="term"><em class="parameter"><code>font</code></em> :</span></p></td> <td> A <a class="link" href="pango-Fonts.html#PangoFont"><span class="type">PangoFont</span></a>. </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>charsets</code></em> :</span></p></td> <td> An array of charsets. </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>n_charsets</code></em> :</span></p></td> <td> The number of charsets in <em class="parameter"><code>charsets</code></em>. </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>rfont</code></em> :</span></p></td> <td> A pointer to a <a class="link" href="pango-X-Fonts-and-Rendering.html#PangoXSubfont" title="PangoXSubfont"><span class="type">PangoXSubfont</span></a>. </td> </tr> <tr> <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> <td> <code class="literal">TRUE</code> if *<em class="parameter"><code>rfont</code></em> now contains a font. </td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2" title="pango_x_font_get_unknown_glyph ()"> <a name="pango-x-font-get-unknown-glyph"></a><h3>pango_x_font_get_unknown_glyph ()</h3> <pre class="programlisting"><a class="link" href="pango-Glyph-Storage.html#PangoGlyph" title="PangoGlyph">PangoGlyph</a> pango_x_font_get_unknown_glyph (<a class="link" href="pango-Fonts.html#PangoFont">PangoFont</a> *font, <a href="http://library.gnome.org/devel/glib/unstable/glib-Unicode-Manipulation.html#gunichar" >gunichar</a> wc);</pre> <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"> <h3 class="title">Warning</h3> <p><code class="literal">pango_x_font_get_unknown_glyph</code> is deprecated and should not be used in newly-written code.</p> </div> <p> Returns the index of a glyph suitable for drawing <em class="parameter"><code>wc</code></em> as an unknown character. </p> <p> Use <a class="link" href="pango-Glyph-Storage.html#PANGO-GET-UNKNOWN-GLYPH--CAPS" title="PANGO_GET_UNKNOWN_GLYPH()"><code class="function">PANGO_GET_UNKNOWN_GLYPH()</code></a> instead.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><p><span class="term"><em class="parameter"><code>font</code></em> :</span></p></td> <td> a <a class="link" href="pango-Fonts.html#PangoFont"><span class="type">PangoFont</span></a>. </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>wc</code></em> :</span></p></td> <td> the Unicode character for which a glyph is needed. </td> </tr> <tr> <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> <td> a glyph index into <em class="parameter"><code>font</code></em>. </td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2" title="pango_x_apply_ligatures ()"> <a name="pango-x-apply-ligatures"></a><h3>pango_x_apply_ligatures ()</h3> <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean" >gboolean</a> pango_x_apply_ligatures (<a class="link" href="pango-Fonts.html#PangoFont">PangoFont</a> *font, <a class="link" href="pango-X-Fonts-and-Rendering.html#PangoXSubfont" title="PangoXSubfont">PangoXSubfont</a> subfont, <a href="http://library.gnome.org/devel/glib/unstable/glib-Unicode-Manipulation.html#gunichar" >gunichar</a> **glyphs, int *n_glyphs, int **clusters);</pre> <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"> <h3 class="title">Warning</h3> <p><code class="literal">pango_x_apply_ligatures</code> is deprecated and should not be used in newly-written code.</p> </div> <p> Previously did subfont-specific ligation. Now a no-op.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><p><span class="term"><em class="parameter"><code>font</code></em> :</span></p></td> <td> unused </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>subfont</code></em> :</span></p></td> <td> unused </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>glyphs</code></em> :</span></p></td> <td> unused </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>n_glyphs</code></em> :</span></p></td> <td> unused </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>clusters</code></em> :</span></p></td> <td> unused </td> </tr> <tr> <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> <td> <code class="literal">FALSE</code>, always. </td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2" title="pango_x_fallback_shape ()"> <a name="pango-x-fallback-shape"></a><h3>pango_x_fallback_shape ()</h3> <pre class="programlisting">void pango_x_fallback_shape (<a class="link" href="pango-Fonts.html#PangoFont">PangoFont</a> *font, <a class="link" href="pango-Glyph-Storage.html#PangoGlyphString" title="PangoGlyphString">PangoGlyphString</a> *glyphs, const char *text, int n_chars);</pre> <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"> <h3 class="title">Warning</h3> <p><code class="literal">pango_x_fallback_shape</code> is deprecated and should not be used in newly-written code.</p> </div> <p> This is a simple fallback shaper, that can be used if no subfont that supports a given script is found. For every character in <em class="parameter"><code>text</code></em>, it puts the unknown glyph.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><p><span class="term"><em class="parameter"><code>font</code></em> :</span></p></td> <td> A <a class="link" href="pango-Fonts.html#PangoFont"><span class="type">PangoFont</span></a>. </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>glyphs</code></em> :</span></p></td> <td> A pointer to a <a class="link" href="pango-Glyph-Storage.html#PangoGlyphString" title="PangoGlyphString"><span class="type">PangoGlyphString</span></a>. </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>text</code></em> :</span></p></td> <td> UTF-8 string. </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>n_chars</code></em> :</span></p></td> <td> Number of UTF-8 seqs in <em class="parameter"><code>text</code></em>. </td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2" title="PangoXFontCache"> <a name="PangoXFontCache"></a><h3>PangoXFontCache</h3> <pre class="programlisting">typedef struct _PangoXFontCache PangoXFontCache;</pre> <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"> <h3 class="title">Warning</h3> <p><code class="literal">PangoXFontCache</code> is deprecated and should not be used in newly-written code.</p> </div> <p> A <a class="link" href="pango-X-Fonts-and-Rendering.html#PangoXFontCache" title="PangoXFontCache"><span class="type">PangoXFontCache</span></a> caches <span class="type">XFontStructs</span> for a single display by their XLFD name. </p> </div> <hr> <div class="refsect2" title="pango_x_font_cache_new ()"> <a name="pango-x-font-cache-new"></a><h3>pango_x_font_cache_new ()</h3> <pre class="programlisting"><a class="link" href="pango-X-Fonts-and-Rendering.html#PangoXFontCache" title="PangoXFontCache">PangoXFontCache</a> * pango_x_font_cache_new (Display *display);</pre> <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"> <h3 class="title">Warning</h3> <p><code class="literal">pango_x_font_cache_new</code> is deprecated and should not be used in newly-written code.</p> </div> <p> Creates a font cache for the specified display.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><p><span class="term"><em class="parameter"><code>display</code></em> :</span></p></td> <td> an X display. </td> </tr> <tr> <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> <td> The newly allocated <a class="link" href="pango-X-Fonts-and-Rendering.html#PangoXFontCache" title="PangoXFontCache"><span class="type">PangoXFontCache</span></a>, which should be freed with <a class="link" href="pango-X-Fonts-and-Rendering.html#pango-x-font-cache-free" title="pango_x_font_cache_free ()"><code class="function">pango_x_font_cache_free()</code></a>. </td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2" title="pango_x_font_cache_free ()"> <a name="pango-x-font-cache-free"></a><h3>pango_x_font_cache_free ()</h3> <pre class="programlisting">void pango_x_font_cache_free (<a class="link" href="pango-X-Fonts-and-Rendering.html#PangoXFontCache" title="PangoXFontCache">PangoXFontCache</a> *cache);</pre> <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"> <h3 class="title">Warning</h3> <p><code class="literal">pango_x_font_cache_free</code> is deprecated and should not be used in newly-written code.</p> </div> <p> Frees a <a class="link" href="pango-X-Fonts-and-Rendering.html#PangoXFontCache" title="PangoXFontCache"><span class="type">PangoXFontCache</span></a> and all associated memory. All fonts loaded through this font cache will be freed along with the cache.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody><tr> <td><p><span class="term"><em class="parameter"><code>cache</code></em> :</span></p></td> <td> a <a class="link" href="pango-X-Fonts-and-Rendering.html#PangoXFontCache" title="PangoXFontCache"><span class="type">PangoXFontCache</span></a> </td> </tr></tbody> </table></div> </div> <hr> <div class="refsect2" title="pango_x_font_cache_load ()"> <a name="pango-x-font-cache-load"></a><h3>pango_x_font_cache_load ()</h3> <pre class="programlisting">XFontStruct * pango_x_font_cache_load (<a class="link" href="pango-X-Fonts-and-Rendering.html#PangoXFontCache" title="PangoXFontCache">PangoXFontCache</a> *cache, const char *xlfd);</pre> <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"> <h3 class="title">Warning</h3> <p><code class="literal">pango_x_font_cache_load</code> is deprecated and should not be used in newly-written code.</p> </div> <p> Loads a <span class="type">XFontStruct</span> from a X Logical Font Description. The result may be newly loaded, or it may have been previously stored.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><p><span class="term"><em class="parameter"><code>cache</code></em> :</span></p></td> <td> a <a class="link" href="pango-X-Fonts-and-Rendering.html#PangoXFontCache" title="PangoXFontCache"><span class="type">PangoXFontCache</span></a> </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>xlfd</code></em> :</span></p></td> <td> the X Logical Font Description to load. </td> </tr> <tr> <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> <td> The font structure, or <code class="literal">NULL</code> if the font could not be loaded. In order to free this structure, you must call <a class="link" href="pango-X-Fonts-and-Rendering.html#pango-x-font-cache-unload" title="pango_x_font_cache_unload ()"><code class="function">pango_x_font_cache_unload()</code></a>. </td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2" title="pango_x_font_cache_unload ()"> <a name="pango-x-font-cache-unload"></a><h3>pango_x_font_cache_unload ()</h3> <pre class="programlisting">void pango_x_font_cache_unload (<a class="link" href="pango-X-Fonts-and-Rendering.html#PangoXFontCache" title="PangoXFontCache">PangoXFontCache</a> *cache, XFontStruct *fs);</pre> <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"> <h3 class="title">Warning</h3> <p><code class="literal">pango_x_font_cache_unload</code> is deprecated and should not be used in newly-written code.</p> </div> <p> Frees a font structure previously loaded with <a class="link" href="pango-X-Fonts-and-Rendering.html#pango-x-font-cache-load" title="pango_x_font_cache_load ()"><code class="function">pango_x_font_cache_load()</code></a>.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><p><span class="term"><em class="parameter"><code>cache</code></em> :</span></p></td> <td> a <a class="link" href="pango-X-Fonts-and-Rendering.html#PangoXFontCache" title="PangoXFontCache"><span class="type">PangoXFontCache</span></a> </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>fs</code></em> :</span></p></td> <td> the font structure to unload </td> </tr> </tbody> </table></div> </div> </div> </div> <div class="footer"> <hr> Generated by GTK-Doc V1.11</div> </body> </html>
lgpl-2.1
tianyicui/nix
src/libexpr/attr-path.cc
2128
#include "attr-path.hh" #include "util.hh" namespace nix { // !!! Shouldn't we return a pointer to a Value? void findAlongAttrPath(EvalState & state, const string & attrPath, Bindings & autoArgs, Expr * e, Value & v) { Strings tokens = tokenizeString(attrPath, "."); Error attrError = Error(format("attribute selection path `%1%' does not match expression") % attrPath); string curPath; state.mkThunk_(v, e); foreach (Strings::iterator, i, tokens) { if (!curPath.empty()) curPath += "."; curPath += *i; /* Is *i an index (integer) or a normal attribute name? */ enum { apAttr, apIndex } apType = apAttr; string attr = *i; int attrIndex = -1; if (string2Int(attr, attrIndex)) apType = apIndex; /* Evaluate the expression. */ Value vTmp; state.autoCallFunction(autoArgs, v, vTmp); v = vTmp; state.forceValue(v); /* It should evaluate to either an attribute set or an expression, according to what is specified in the attrPath. */ if (apType == apAttr) { if (v.type != tAttrs) throw TypeError( format("the expression selected by the selection path `%1%' should be an attribute set but is %2%") % curPath % showType(v)); Bindings::iterator a = v.attrs->find(state.symbols.create(attr)); if (a == v.attrs->end()) throw Error(format("attribute `%1%' in selection path `%2%' not found") % attr % curPath); v = *a->value; } else if (apType == apIndex) { if (v.type != tList) throw TypeError( format("the expression selected by the selection path `%1%' should be a list but is %2%") % curPath % showType(v)); if (attrIndex >= v.list.length) throw Error(format("list index %1% in selection path `%2%' is out of range") % attrIndex % curPath); v = *v.list.elems[attrIndex]; } } } }
lgpl-2.1
rev22/svgl
src/w3c/svg/SVGMisc.cpp
1895
/* * $Id$ * Copyright (c) 2001 Stephane Conversy, Jean-Daniel Fekete and Ecole des Mines de Nantes. All rights reserved. This software is proprietary information of Stephane Conversy, Jean-Daniel Fekete and Ecole des Mines de Nantes. You shall use it only in accordance with the terms of the license agreement you accepted when downloading this software. The license is available in the file license.txt and at the following URL: http://www.emn.fr/info/image/Themes/Indigo/licence.html */ #include <w3c/svg/GetSVGDocument.hpp> #include <w3c/svg/SVGColor.hpp> #include <w3c/svg/SVGPaint.hpp> #include <w3c/svg/SVGAngle.hpp> #include <w3c/svg/SVGPoint.hpp> #include <w3c/dom/DOMException.hpp> namespace svg { SVGDocument* GetSVGDocument::getSVGDocument ( ) { throw dom::DOMException(dom::DOMException::NOT_SUPPORTED_ERR); return 0; } void SVGColor::setRGBColor ( const DOMString& rgbColor ) { throw dom::DOMException(dom::DOMException::NOT_SUPPORTED_ERR); } void SVGColor::setRGBColorICCColor ( const DOMString& rgbColor, const DOMString& iccColor ) { throw dom::DOMException(dom::DOMException::NOT_SUPPORTED_ERR); } void SVGPaint::setUri ( const DOMString& uri ) { throw dom::DOMException(dom::DOMException::NOT_SUPPORTED_ERR); } void SVGPaint::setPaint ( unsigned short paintType, const DOMString& uri, const DOMString& rgbColor, const DOMString& iccColor ) { throw dom::DOMException(dom::DOMException::NOT_SUPPORTED_ERR); } void SVGAngle::newValueSpecifiedUnits ( unsigned short unitType, float valueInSpecifiedUnits ) { throw dom::DOMException(dom::DOMException::NOT_SUPPORTED_ERR); } void SVGAngle::convertToSpecifiedUnits ( unsigned short unitType ) { throw dom::DOMException(dom::DOMException::NOT_SUPPORTED_ERR); } SVGPoint* SVGPoint::matrixTransform ( const SVGMatrix& matrix ) { throw dom::DOMException(dom::DOMException::NOT_SUPPORTED_ERR); } }
lgpl-2.1
dudochkin-victor/touch-controlpanel
lib/tests/ut_dcpwidget/ut_dcpwidget.cpp
2162
/*************************************************************************** ** ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Karoliina T. Salminen <karoliina.t.salminen@nokia.com> ** ** This file is part of duicontrolpanel. ** ** ** This library is free software; you can redistribute it and/or ** modify it under the terms of the GNU Lesser General Public ** License version 2.1 as published by the Free Software Foundation ** and appearing in the file LICENSE.LGPL included in the packaging ** of this file. ** ****************************************************************************/ #include <QObject> #include <QGraphicsSceneMouseEvent> #include <QSignalSpy> #include <dcpwidget.h> #include <dcpwidget_p.h> #include "ut_dcpwidget.h" void Ut_DcpWidget::init() { m_subject = new DcpWidget(); } void Ut_DcpWidget::cleanup() { delete m_subject; m_subject = 0; } void Ut_DcpWidget::initTestCase() { } void Ut_DcpWidget::cleanupTestCase() { } void Ut_DcpWidget::testCreation() { QVERIFY(m_subject); } void Ut_DcpWidget::testWidgetId() { QCOMPARE(m_subject->d_ptr->m_WidgetId, -1); QVERIFY(m_subject->setWidgetId(1)); QCOMPARE(m_subject->d_ptr->m_WidgetId, 1); QCOMPARE(m_subject->getWidgetId(), 1); QVERIFY(!m_subject->setWidgetId(10)); // already set } void Ut_DcpWidget::testBack() { QVERIFY(m_subject->back()); // default behaviour } void Ut_DcpWidget::testPagePans() { QVERIFY(m_subject->pagePans()); // default behaviour } void Ut_DcpWidget::testProgressIndicator() { // default value: QVERIFY(!m_subject->isProgressIndicatorVisible()); QSignalSpy spy (m_subject, SIGNAL(inProgress(bool))); // show it: m_subject->setProgressIndicatorVisible(true); QVERIFY(m_subject->isProgressIndicatorVisible()); QCOMPARE(spy.count(), 1); QVERIFY(spy.takeFirst().at(0).toBool()); // hide it: m_subject->setProgressIndicatorVisible(false); QVERIFY(!m_subject->isProgressIndicatorVisible()); QCOMPARE(spy.count(), 1); QVERIFY(!spy.takeFirst().at(0).toBool()); } QTEST_APPLESS_MAIN(Ut_DcpWidget)
lgpl-2.1
microcosmx/jade
doc/tools/sniffer/html/jdoc/deprecated-list.html
3372
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="it"> <head> <!-- Generated by javadoc (version 1.7.0_03) on Tue Dec 09 10:54:57 CET 2014 --> <title>Deprecated List (JADE 4.3.3 Sniffer Reference)</title> <meta name="date" content="2014-12-09"> <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="Deprecated List (JADE 4.3.3 Sniffer Reference)"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar_top"> <!-- --> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="jade/tools/sniffer/package-summary.html">Package</a></li> <li>Class</li> <li><a href="jade/tools/sniffer/package-tree.html">Tree</a></li> <li class="navBarCell1Rev">Deprecated</li> <li><a href="index-all.html">Index</a></li> <li><a href="help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="index.html?deprecated-list.html" target="_top">Frames</a></li> <li><a href="deprecated-list.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h1 title="Deprecated API" class="title">Deprecated API</h1> <h2 title="Contents">Contents</h2> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="jade/tools/sniffer/package-summary.html">Package</a></li> <li>Class</li> <li><a href="jade/tools/sniffer/package-tree.html">Tree</a></li> <li class="navBarCell1Rev">Deprecated</li> <li><a href="index-all.html">Index</a></li> <li><a href="help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="index.html?deprecated-list.html" target="_top">Frames</a></li> <li><a href="deprecated-list.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </body> </html>
lgpl-2.1
dudochkin-victor/libgogootouch
tests/ut_mbasicsheetheaderview/ut_mbasicsheetheaderview.cpp
3818
/*************************************************************************** ** ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (directui@nokia.com) ** ** This file is part of libmeegotouch. ** ** If you have questions regarding the use of this file, please contact ** Nokia at directui@nokia.com. ** ** This library is free software; you can redistribute it and/or ** modify it under the terms of the GNU Lesser General Public ** License version 2.1 as published by the Free Software Foundation ** and appearing in the file LICENSE.LGPL included in the packaging ** of this file. ** ****************************************************************************/ #include <QObject> #include <MApplication> #include <MButton> #include <QAction> #include <QSignalSpy> #include <mbasicsheetheader.h> #include <mbasicsheetheaderview.h> #include <mbasicsheetheaderview_p.h> #include "ut_mbasicsheetheaderview.h" Ut_MBasicSheetHeaderView::Ut_MBasicSheetHeaderView(): subject(0), controller(0), app(0) { } void Ut_MBasicSheetHeaderView::initTestCase() { static int argc = 1; static char *app_name[1] = { (char *) "./ut_mbasicsheetheaderview" }; app = new MApplication(argc, app_name); } void Ut_MBasicSheetHeaderView::cleanupTestCase() { delete app; } void Ut_MBasicSheetHeaderView::init() { controller = new MBasicSheetHeader(); subject = new MBasicSheetHeaderView(controller); controller->setView(subject); } void Ut_MBasicSheetHeaderView::cleanup() { delete controller; controller = 0; } void Ut_MBasicSheetHeaderView::testClickingPositiveButtonTriggersPositiveAction() { QAction *action = new QAction(controller); controller->setPositiveAction(action); testClickingButtonTriggersAction(subject->d_func()->positiveButton, action); } void Ut_MBasicSheetHeaderView::testClickingNegativeButtonTriggersNegativeAction() { QAction *action = new QAction(controller); controller->setNegativeAction(action); testClickingButtonTriggersAction(subject->d_func()->negativeButton, action); } void Ut_MBasicSheetHeaderView::testDisablingPositiveActionDisablesPositiveButton() { QAction *action = new QAction(controller); controller->setPositiveAction(action); testDisablingActionDisablesButton(action, subject->d_func()->positiveButton); } void Ut_MBasicSheetHeaderView::testDisablingNegativeActionDisablesNegativeButton() { QAction *action = new QAction(controller); controller->setNegativeAction(action); testDisablingActionDisablesButton(action, subject->d_func()->negativeButton); } void Ut_MBasicSheetHeaderView::testPositiveButtonTextUsesActionText() { QAction *action = new QAction("foo", controller); controller->setPositiveAction(action); QCOMPARE(subject->d_func()->positiveButton->text(), action->text()); } void Ut_MBasicSheetHeaderView::testNegativeButtonTextUsesActionText() { QAction *action = new QAction("foo", controller); controller->setNegativeAction(action); QCOMPARE(subject->d_func()->negativeButton->text(), action->text()); } ///// // Helpers void Ut_MBasicSheetHeaderView::testClickingButtonTriggersAction( MButton *button, QAction *action) { QSignalSpy spyActionTriggered(action, SIGNAL(triggered(bool))); QVERIFY(button != 0); QCOMPARE(spyActionTriggered.count(), 0); button->click(); QCOMPARE(spyActionTriggered.count(), 1); } void Ut_MBasicSheetHeaderView::testDisablingActionDisablesButton( QAction *action, MButton *button) { QVERIFY(button != 0); QCOMPARE(button->isEnabled(), action->isEnabled()); action->setEnabled(false); QCOMPARE(button->isEnabled(), action->isEnabled()); } QTEST_APPLESS_MAIN(Ut_MBasicSheetHeaderView)
lgpl-2.1
Pillar1989/Grove-for-linux
Arduino/libraries/ArduinoJson/include/ArduinoJson/Internals/Encoding.hpp
750
// Copyright Benoit Blanchon 2014-2015 // MIT License // // Arduino JSON library // https://github.com/bblanchon/ArduinoJson #pragma once #include "../Arduino/Print.hpp" namespace ArduinoJson { namespace Internals { class Encoding { public: // Optimized for code size on a 8-bit AVR static char escapeChar(char c) { const char *p = _escapeTable; while (p[0] && p[1] != c) { p += 2; } return p[0]; } // Optimized for code size on a 8-bit AVR static char unescapeChar(char c) { const char *p = _escapeTable + 4; for (;;) { if (p[0] == '\0') return c; if (p[0] == c) return p[1]; p += 2; } } private: static const char _escapeTable[]; }; } }
lgpl-2.1
ess-dmsc/h5cpp
test/node/dataset_bool_io.cpp
1708
// // (c) Copyright 2017 DESY,ESS // 2021 Eugen Wintersberger <eugen.wintersberger@gmail.com> // // This file is part of h5cpp. // // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or // (at your option) any later version. // // This library is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public // License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with this library; if not, write to the // Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor // Boston, MA 02110-1301 USA // =========================================================================== // // Author: Eugen Wintersberger <eugen.wintersberger@gmail.com> // Created on: Oct 24, 2017 // #include <catch2/catch.hpp> #include <h5cpp/hdf5.hpp> using namespace hdf5; SCENARIO("testing bool IO") { auto f = file::create("DatasetBoolIO.h5", file::AccessFlags::Truncate); auto r = f.root(); auto type = hdf5::datatype::create<bool>(); hdf5::dataspace::Scalar space; GIVEN("a dataset of type bool") { auto d = node::Dataset(r, Path("data"), type, space); THEN("we can write a boolean value to it") { bool write = true; REQUIRE_NOTHROW(d.write(write)); AND_THEN("we can read the value back") { bool read = false; REQUIRE_NOTHROW(d.read(read)); REQUIRE(read); } } } }
lgpl-2.1
community-ssu/sharing-service-facebook
src/places.c
13837
#include <hildon/hildon.h> #include <exempi/xmp.h> #include <json-glib/json-glib.h> #include <libintl.h> #include <sharing-tag.h> #include <locale.h> #include <math.h> #include <string.h> #include <gst/gst.h> #include "places.h" #define SCHEMA_IPTC "http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/" #define SCHEMA_EXIF "http://ns.adobe.com/exif/1.0/" #define SCHEMA_TIFF "http://ns.adobe.com/tiff/1.0/" struct _FacebookSelectPlace { const gchar *file; GSList *places; gboolean thread_active; gint orientation; gint selected; gboolean is_video; }; typedef struct _FacebookSelectPlace FacebookSelectPlace; struct _FacebookSearchData { gchar *location; gdouble latitude; gdouble longitude; }; typedef struct _FacebookSearchData FacebookSearchData; /* * Seems like Nokia use dd,mm.mm format to encode GPS coordinates, at least on * N900 and N950. */ static inline gdouble convert2deg_dm(const gchar *d, const gchar *m, const gchar *mm) { return (gdouble)atoi(d) + ((gdouble)atoi(m)) / 60.0 + ((gdouble)atoi(mm)) / (60.0 * pow(10, strlen(mm))); } static gdouble deg2dec(const gchar *s, gboolean *ok) { gchar **v = g_strsplit_set(s, ",.", 3); gdouble rv = 0; if(v[0] && v[1] && v[2]) { gchar *ref = &v[2][strlen(v[2]) - 1]; switch (*ref) { case 'E': case 'N': *ref = '\0'; rv = convert2deg_dm(v[0], v[1], v[2]); *ok = TRUE; break; case 'S': case 'W': *ref = '\0'; rv = 0.0 - convert2deg_dm(v[0], v[1], v[2]); *ok = TRUE; break; default: *ok = FALSE; } } else *ok = FALSE; g_strfreev(v); return rv; } static int select_place_thread(FacebookSelectPlace *select) { GtkWidget *selector, *dialog, *image = NULL, *picker, *align; GdkPixbuf *pixbuf, *newpixbuf; gint i; gchar *s; gdk_threads_enter(); selector = hildon_touch_selector_new_text(); hildon_touch_selector_set_column_selection_mode( HILDON_TOUCH_SELECTOR(selector), HILDON_TOUCH_SELECTOR_SELECTION_MODE_SINGLE); for (i = 0; i < g_slist_length(select->places); i ++) { hildon_touch_selector_append_text(HILDON_TOUCH_SELECTOR(selector), g_slist_nth_data(select->places, i)); } s = g_strdup_printf("%s Facebook %s", dgettext("osso-connectivity-ui", "conn_bd_dialog_ok"), dgettext("gtk20","Location")); dialog = gtk_dialog_new_with_buttons(s, NULL, GTK_DIALOG_NO_SEPARATOR | GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL, dgettext("hildon-libs", "wdgt_bd_done"), GTK_RESPONSE_OK, NULL); g_free(s); picker = hildon_picker_button_new(HILDON_SIZE_FINGER_HEIGHT, HILDON_BUTTON_ARRANGEMENT_VERTICAL); hildon_picker_button_set_selector(HILDON_PICKER_BUTTON(picker), HILDON_TOUCH_SELECTOR(selector)); hildon_button_set_title(HILDON_BUTTON(picker), dgettext("gtk20","Location")); hildon_picker_button_set_active(HILDON_PICKER_BUTTON(picker), 0); hildon_button_set_alignment(HILDON_BUTTON(picker), 0.0, 0.5, 1.0, 0.0); align = gtk_alignment_new(0, 0, 0, 0); gtk_alignment_set_padding(GTK_ALIGNMENT(align), 8, 8, 8, 8); if (!select->is_video) { pixbuf = gdk_pixbuf_new_from_file_at_scale(select->file, 128, 128, TRUE, NULL); if (pixbuf) { /* * FIXME - we may need to flip as well, unfortunately I have no images * to test with, so better leave it that way. */ newpixbuf = gdk_pixbuf_rotate_simple(pixbuf, 360 - (select->orientation % 4 - 1) * 90); g_object_unref(pixbuf); pixbuf = newpixbuf; } } else { pixbuf = gtk_icon_theme_load_icon(gtk_icon_theme_get_default (), "video-x-generic", 128, GTK_ICON_LOOKUP_FORCE_SIZE, NULL); } if (pixbuf) { image = gtk_image_new_from_pixbuf(pixbuf); g_object_unref(pixbuf); } if (image) gtk_container_add(GTK_CONTAINER(align), image); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), align, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), picker, TRUE, TRUE, 0); gtk_widget_show_all(dialog); if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) { select->selected = hildon_picker_button_get_active(HILDON_PICKER_BUTTON(picker)); } gtk_widget_destroy (GTK_WIDGET(dialog)); gdk_threads_leave(); select->thread_active = FALSE; return FALSE; } static gint select_place_id(const gchar *file, GSList *places, gint orientation, gboolean is_video) { FacebookSelectPlace select; DEBUG_LOG(__func__); select.thread_active = TRUE; select.file = file; select.selected = -1; select.places = places; select.orientation = orientation; select.is_video = is_video; g_thread_create_full((GThreadFunc)select_place_thread, &select, 0, FALSE, FALSE, G_THREAD_PRIORITY_NORMAL, NULL); while (select.thread_active) { while (g_main_context_pending(NULL)) g_main_context_iteration(NULL, TRUE); } return select.selected; } static gchar * get_place_id(facebook_graph_request *request, const gchar *access_token, const gchar *path, ConIcConnection *con, const FacebookSearchData *data, gboolean is_video, gint orientation) { gchar *rv = NULL; DEBUG_LOG(__func__); if (data->location && data->latitude != NAN && data->longitude != NAN) { GString *url; int http_result; GArray *response = g_array_new(1, 1, 1); facebook_graph_request_reset(request); g_hash_table_insert(request->query_params, "q", g_strdup(data->location)); g_hash_table_insert(request->query_params, "type", g_strdup("place")); { locale_t loc = newlocale(LC_NUMERIC_MASK, "C", (locale_t)0); locale_t old = uselocale(loc); g_hash_table_insert(request->query_params, "center", g_strdup_printf("%f,%f", data->latitude, data->longitude)); uselocale(old); freelocale(loc); } g_hash_table_insert(request->query_params, "distance", g_strdup("50000")); g_hash_table_insert(request->query_params, "fields", g_strdup("id,name")); g_hash_table_insert(request->query_params, "limit", g_strdup("128")); /* why not? */ g_hash_table_insert(request->query_params, "access_token", g_strdup(access_token)); url = g_string_new("https://graph.facebook.com/search"); http_result = network_utils_get(url, response, NULL, request->query_params, con, NULL); g_string_free(url, FALSE); if (http_result == 200) { JsonParser *parser = json_parser_new(); if (json_parser_load_from_data(parser, response->data, response->len, NULL)) { JsonNode *root = json_parser_get_root(parser); JsonObject *object; if (root && JSON_NODE_HOLDS_OBJECT(root) && (object = json_node_get_object(root)) && json_object_has_member(object, "data")) { JsonArray *data = json_object_get_array_member(object, "data"); guint len = json_array_get_length(data); gint i; GSList *l = NULL; for (i = 0; i < len; i ++) { object = json_array_get_object_element(data, i); if (object) l = g_slist_append( l, (gpointer)json_object_get_string_member(object, "name")); } i = select_place_id(path, l, orientation, is_video); g_slist_free(l); if (i >= 0) { rv = (gchar *)json_object_get_string_member( json_array_get_object_element(data, i), "id"); } if (rv) rv = g_strdup(rv); } g_object_unref(parser); } } g_array_free(response, TRUE); } return rv; } static gchar * get_photo_place_id(const SharingEntryMedia *entry, facebook_graph_request *request, const gchar *access_token, const gchar *path, ConIcConnection *con) { XmpPtr xmp; XmpFilePtr fp; FacebookSearchData data = {NULL, NAN, NAN}; guint orientation = 1; gchar *rv; gboolean ok; DEBUG_LOG(__func__); xmp_init(); if (!(xmp = xmp_new_empty())) return NULL; if (!(fp = xmp_files_open_new(path, (XmpOpenFileOptions)(XMP_OPEN_READ | XMP_OPEN_ONLYXMP)))) { xmp_free(xmp); return NULL; } if (xmp_files_get_xmp(fp, xmp)) { XmpStringPtr value = xmp_string_new(); if (xmp_get_property(xmp, SCHEMA_IPTC, "Iptc4xmpCore:location", value, NULL) || xmp_get_property(xmp, SCHEMA_IPTC, "Iptc4xmpCore:Location", value, NULL)) data.location = g_strdup(xmp_string_cstr(value)); if (xmp_get_property(xmp, SCHEMA_EXIF, "exif:GPSLatitude", value, NULL)) { data.latitude = deg2dec(g_strdup(xmp_string_cstr(value)), &ok); if (!ok) goto error; } if (xmp_get_property(xmp, SCHEMA_EXIF, "exif:GPSLongitude", value, NULL)) { data.longitude = deg2dec(g_strdup(xmp_string_cstr(value)), &ok); if (!ok) goto error; } if (xmp_get_property(xmp, SCHEMA_TIFF, "tiff:Orientation", value, NULL)) orientation = atoi(xmp_string_cstr(value)); error: xmp_string_free(value); } rv = get_place_id(request, access_token, path, con, &data, FALSE, orientation); g_free(data.location); xmp_free(xmp); xmp_terminate(); return rv; } static void sharing_tag_f(gpointer data, gpointer user_data) { const SharingTag *tag = (const SharingTag *)data; switch (sharing_tag_get_type(tag)) { case SHARING_TAG_GEO_SUBURB: ((FacebookSearchData *)user_data)->location = (gchar *)sharing_tag_get_word(tag); break; default: break; } } static void read_one_tag(const GstTagList *list, const gchar *tag, gpointer user_data) { FacebookSearchData *data = user_data; int n = gst_tag_list_get_tag_size(list, tag); if (!g_strcmp0(tag, "geo-location-latitude") && n == 1) data->latitude = g_value_get_double( gst_tag_list_get_value_index(list, tag, 0)); if (!g_strcmp0(tag, "geo-location-longitude") && n == 1) data->longitude = g_value_get_double( gst_tag_list_get_value_index(list, tag, 1)); } static void on_new_pad(GstElement *dec, GstPad *pad, GstElement *fakesink) { GstPad *sinkpad; sinkpad = gst_element_get_static_pad (fakesink, "sink"); if (!gst_pad_is_linked (sinkpad)) gst_pad_link(pad, sinkpad); gst_object_unref (sinkpad); } static void gst_get_gps_coord(const gchar *path, FacebookSearchData *data) { GstElement *pipe, *dec, *sink; GstMessage *msg; gchar *uri = g_strdup_printf("file://%s", path); gst_init(NULL, NULL); pipe = gst_pipeline_new("pipeline"); dec = gst_element_factory_make("uridecodebin", NULL); g_object_set(dec, "uri", uri, NULL); g_free(uri); gst_bin_add(GST_BIN (pipe), dec); sink = gst_element_factory_make("fakesink", NULL); gst_bin_add(GST_BIN (pipe), sink); g_signal_connect(dec, "pad-added", G_CALLBACK (on_new_pad), sink); gst_element_set_state(pipe, GST_STATE_PAUSED); while (TRUE) { GstTagList *tags = NULL; msg = gst_bus_timed_pop_filtered(GST_ELEMENT_BUS (pipe), GST_CLOCK_TIME_NONE, GST_MESSAGE_ASYNC_DONE | GST_MESSAGE_TAG | GST_MESSAGE_ERROR); if (GST_MESSAGE_TYPE(msg) != GST_MESSAGE_TAG) { gst_message_unref(msg); break; } gst_message_parse_tag(msg, &tags); gst_tag_list_foreach(tags, read_one_tag, data); gst_tag_list_free(tags); gst_message_unref(msg); }; gst_element_set_state(pipe, GST_STATE_NULL); gst_object_unref(pipe); } static gchar * get_video_place_id(const SharingEntryMedia *entry, facebook_graph_request *request, const gchar *access_token, const gchar *path, ConIcConnection *con) { FacebookSearchData data ={NULL, NAN, NAN}; gchar *rv = NULL; GSList *tags = (GSList *)sharing_entry_media_get_tags(entry); /* Try to get suburb */ g_slist_foreach(tags, sharing_tag_f, &data); if (!data.location) return NULL; gst_get_gps_coord(path, &data); if (!data.latitude == 0.0 || data.longitude == 0.0) return NULL; rv = get_place_id(request, access_token, path, con, &data, TRUE, 0); return rv; } gchar * fb_sharing_plugin_get_place_id(const SharingEntryMedia *media, facebook_graph_request *request, const gchar *access_token, const gchar *path, ConIcConnection *con, gboolean is_video) { if (!is_video) return get_photo_place_id(media, request, access_token, path, con); else return get_video_place_id(media, request, access_token, path, con); }
lgpl-2.1
asapnet/geos
source/io/WKBReader.cpp
10322
/********************************************************************** * $Id: WKBReader.cpp 2022 2007-09-14 15:25:29Z csavage $ * * GEOS - Geometry Engine Open Source * http://geos.refractions.net * * Copyright (C) 2005-2006 Refractions Research Inc. * * This is free software; you can redistribute and/or modify it under * the terms of the GNU Lesser General Public Licence as published * by the Free Software Foundation. * See the COPYING file for more information. * **********************************************************************/ #include <geos/io/WKBReader.h> #include <geos/io/WKBConstants.h> #include <geos/io/ByteOrderValues.h> #include <geos/io/ParseException.h> #include <geos/geom/GeometryFactory.h> #include <geos/geom/Coordinate.h> #include <geos/geom/Point.h> #include <geos/geom/LinearRing.h> #include <geos/geom/LineString.h> #include <geos/geom/Polygon.h> #include <geos/geom/MultiPoint.h> #include <geos/geom/MultiLineString.h> #include <geos/geom/MultiPolygon.h> #include <geos/geom/CoordinateSequenceFactory.h> #include <geos/geom/CoordinateSequence.h> #include <geos/geom/PrecisionModel.h> #include <iomanip> #include <ostream> #include <sstream> #include <string> //#define DEBUG_WKB_READER 1 using namespace std; using namespace geos::geom; namespace geos { namespace io { // geos.io string WKBReader::BAD_GEOM_TYPE_MSG = "bad geometry type encountered in "; WKBReader::WKBReader() : factory(*(GeometryFactory::getDefaultInstance())) {} ostream & WKBReader::printHEX(istream &is, ostream &os) { static const char hex[] = "0123456789ABCDEF"; long pos = is.tellg(); // take note of input stream get pointer is.seekg(0, ios::beg); // rewind input stream char each=0; while(is.read(&each, 1)) { const unsigned char c=each; int low = (c & 0x0F); int high = (c >> 4); os << hex[high] << hex[low]; } is.clear(); // clear input stream eof flag is.seekg(pos); // reset input stream position return os; } Geometry * WKBReader::readHEX(istream &is) { // setup input/output stream stringstream os(ios_base::binary|ios_base::in|ios_base::out); unsigned char high, low, result_high, result_low, value; while(!is.eof())//readsome(&str[0], 2)) { // get the high part of the byte is >> high; // geth the low part of the byte is >> low; switch (high) { case '0' : result_high = 0; break; case '1' : result_high = 1; break; case '2' : result_high = 2; break; case '3' : result_high = 3; break; case '4' : result_high = 4; break; case '5' : result_high = 5; break; case '6' : result_high = 6; break; case '7' : result_high = 7; break; case '8' : result_high = 8; break; case '9' : result_high = 9; break; case 'A' : result_high = 10; break; case 'B' : result_high = 11; break; case 'C' : result_high = 12; break; case 'D' : result_high = 13; break; case 'E' : result_high = 14; break; case 'F' : result_high = 15; break; default: throw ParseException("Invalid HEX char"); } switch (low) { case '0' : result_low = 0; break; case '1' : result_low = 1; break; case '2' : result_low = 2; break; case '3' : result_low = 3; break; case '4' : result_low = 4; break; case '5' : result_low = 5; break; case '6' : result_low = 6; break; case '7' : result_low = 7; break; case '8' : result_low = 8; break; case '9' : result_low = 9; break; case 'A' : result_low = 10; break; case 'B' : result_low = 11; break; case 'C' : result_low = 12; break; case 'D' : result_low = 13; break; case 'E' : result_low = 14; break; case 'F' : result_low = 15; break; default: throw ParseException("Invalid HEX char"); } value = (result_high<<4) + result_low; #if DEBUG_HEX_READER cout<<"HEX "<<high<<low<<" -> DEC "<<(int)value<<endl; #endif // write the value to the output stream os << value; } // now call read to convert the geometry return this->read(os); } Geometry * WKBReader::read(istream &is) { dis.setInStream(&is); // will default to machine endian return readGeometry(); } Geometry * WKBReader::readGeometry() { // determine byte order unsigned char byteOrder = dis.readByte(); #if DEBUG_WKB_READER cout<<"WKB byteOrder: "<<(int)byteOrder<<endl; #endif // default is machine endian if (byteOrder == WKBConstants::wkbNDR) dis.setOrder(ByteOrderValues::ENDIAN_LITTLE); else if (byteOrder == WKBConstants::wkbXDR) dis.setOrder(ByteOrderValues::ENDIAN_BIG); int typeInt = dis.readInt(); int geometryType = typeInt & 0xff; #if DEBUG_WKB_READER cout<<"WKB geometryType: "<<geometryType<<endl; #endif bool hasZ = ((typeInt & 0x80000000) != 0); if (hasZ) inputDimension = 3; else inputDimension = 2; // doesn't handle M currently #if DEBUG_WKB_READER cout<<"WKB hasZ: "<<hasZ<<endl; #endif #if DEBUG_WKB_READER cout<<"WKB dimensions: "<<inputDimension<<endl; #endif bool hasSRID = ((typeInt & 0x20000000) != 0); #if DEBUG_WKB_READER cout<<"WKB hasSRID: "<<hasZ<<endl; #endif int SRID = 0; if (hasSRID) SRID = dis.readInt(); // read SRID // allocate space for ordValues if ( ordValues.size() < inputDimension ) ordValues.resize(inputDimension); Geometry *result; switch (geometryType) { case WKBConstants::wkbPoint : result = readPoint(); break; case WKBConstants::wkbLineString : result = readLineString(); break; case WKBConstants::wkbPolygon : result = readPolygon(); break; case WKBConstants::wkbMultiPoint : result = readMultiPoint(); break; case WKBConstants::wkbMultiLineString : result = readMultiLineString(); break; case WKBConstants::wkbMultiPolygon : result = readMultiPolygon(); break; case WKBConstants::wkbGeometryCollection : result = readGeometryCollection(); break; default: stringstream err; err << "Unknown WKB type " << geometryType; throw ParseException(err.str()); } result->setSRID(SRID); return result; } Point * WKBReader::readPoint() { readCoordinate(); return factory.createPoint(Coordinate(ordValues[0], ordValues[1])); } LineString * WKBReader::readLineString() { int size = dis.readInt(); #if DEBUG_WKB_READER cout<<"WKB npoints: "<<size<<endl; #endif CoordinateSequence *pts = readCoordinateSequence(size); return factory.createLineString(pts); } LinearRing * WKBReader::readLinearRing() { int size = dis.readInt(); #if DEBUG_WKB_READER cout<<"WKB npoints: "<<size<<endl; #endif CoordinateSequence *pts = readCoordinateSequence(size); return factory.createLinearRing(pts); } Polygon * WKBReader::readPolygon() { int numRings = dis.readInt(); #if DEBUG_WKB_READER cout<<"WKB numRings: "<<numRings<<endl; #endif LinearRing *shell = NULL; if( numRings > 0 ) shell = readLinearRing(); vector<Geometry *>*holes=NULL; if ( numRings > 1 ) { try { holes = new vector<Geometry *>(numRings-1); for (int i=0; i<numRings-1; i++) (*holes)[i] = (Geometry *)readLinearRing(); } catch (...) { for (unsigned int i=0; i<holes->size(); i++) delete (*holes)[i]; delete holes; delete shell; throw; } } return factory.createPolygon(shell, holes); } MultiPoint * WKBReader::readMultiPoint() { int numGeoms = dis.readInt(); vector<Geometry *> *geoms = new vector<Geometry *>(numGeoms); try { for (int i=0; i<numGeoms; i++) { Geometry *g = readGeometry(); if (!dynamic_cast<Point *>(g)) { stringstream err; err << BAD_GEOM_TYPE_MSG << " MultiPoint"; throw ParseException(err.str()); } (*geoms)[i] = g; } } catch (...) { for (unsigned int i=0; i<geoms->size(); i++) delete (*geoms)[i]; delete geoms; throw; } return factory.createMultiPoint(geoms); } MultiLineString * WKBReader::readMultiLineString() { int numGeoms = dis.readInt(); vector<Geometry *> *geoms = new vector<Geometry *>(numGeoms); try { for (int i=0; i<numGeoms; i++) { Geometry *g = readGeometry(); if (!dynamic_cast<LineString *>(g)) { stringstream err; err << BAD_GEOM_TYPE_MSG << " LineString"; throw ParseException(err.str()); } (*geoms)[i] = g; } } catch (...) { for (unsigned int i=0; i<geoms->size(); i++) delete (*geoms)[i]; delete geoms; throw; } return factory.createMultiLineString(geoms); } MultiPolygon * WKBReader::readMultiPolygon() { int numGeoms = dis.readInt(); vector<Geometry *> *geoms = new vector<Geometry *>(numGeoms); try { for (int i=0; i<numGeoms; i++) { Geometry *g = readGeometry(); if (!dynamic_cast<Polygon *>(g)) { stringstream err; err << BAD_GEOM_TYPE_MSG << " Polygon"; throw ParseException(err.str()); } (*geoms)[i] = g; } } catch (...) { for (unsigned int i=0; i<geoms->size(); i++) delete (*geoms)[i]; delete geoms; throw; } return factory.createMultiPolygon(geoms); } GeometryCollection * WKBReader::readGeometryCollection() { int numGeoms = dis.readInt(); vector<Geometry *> *geoms = new vector<Geometry *>(numGeoms); try { for (int i=0; i<numGeoms; i++) (*geoms)[i] = (readGeometry()); } catch (...) { for (unsigned int i=0; i<geoms->size(); i++) delete (*geoms)[i]; delete geoms; throw; } return factory.createGeometryCollection(geoms); } CoordinateSequence * WKBReader::readCoordinateSequence(int size) { CoordinateSequence *seq = factory.getCoordinateSequenceFactory()->create(size, inputDimension); unsigned int targetDim = seq->getDimension(); if ( targetDim > inputDimension ) targetDim = inputDimension; for (int i=0; i<size; i++) { readCoordinate(); for (unsigned int j=0; j<targetDim; j++) { seq->setOrdinate(i, j, ordValues[j]); } } return seq; } void WKBReader::readCoordinate() { const PrecisionModel &pm = *factory.getPrecisionModel(); for (unsigned int i=0; i<inputDimension; ++i) { if ( i <= 1 ) ordValues[i] = pm.makePrecise(dis.readDouble()); else ordValues[i] = dis.readDouble(); } #if DEBUG_WKB_READER cout<<"WKB coordinate: "<<ordValues[0]<<","<<ordValues[1]<<endl; #endif } } // namespace geos.io } // namespace geos
lgpl-2.1
GhostMonk3408/MidgarCrusade
src/main/java/fr/toss/FF7Weapons/Druidmace.java
1059
package fr.toss.FF7Weapons; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.item.Item; import com.google.common.collect.Multimap; public class Druidmace extends FF7weapon { private float field_150934_a; private final Item.ToolMaterial field_150933_b; public Druidmace(Item.ToolMaterial p_i45356_1_) { super(); this.field_150933_b = p_i45356_1_; setUnlocalizedName("Druid_mace"); this.field_150934_a = 26F + p_i45356_1_.getDamageVsEntity(); } public float func_150931_i() { return this.field_150933_b.getDamageVsEntity(); } public String getToolMaterialName() { return this.field_150933_b.toString(); } public Multimap getItemAttributeModifiers() { Multimap multimap = super.getItemAttributeModifiers(); multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", (double)this.field_150934_a, 0)); return multimap; } }
lgpl-2.1
0xbb/jitsi
src/net/java/sip/communicator/impl/protocol/sip/SipLogger.java
15615
/* * Jitsi, the OpenSource Java VoIP and Instant Messaging client. * * Distributable under LGPL license. * See terms of license at gnu.org. */ package net.java.sip.communicator.impl.protocol.sip; import gov.nist.core.*; import gov.nist.javax.sip.*; import gov.nist.javax.sip.message.*; import java.io.*; import java.net.*; import java.util.*; import javax.sip.*; import net.java.sip.communicator.util.*; import org.jitsi.service.packetlogging.*; /** * This class passes log calls from JAIN-SIP to log4j, so that it is possible * to change the log level for the JAIN-SIP stack in logging.properties * * @author Sebastien Mazy */ public class SipLogger implements StackLogger, ServerLogger { /** * All messages will be passed to this logger. */ private static final Logger logger = Logger.getLogger(SipLogger.class); /** * SipStack to use. */ private SipStack sipStack; /* * Implementation of StackLogger */ /** * logs a stack trace. This helps to look at the stack frame. */ public void logStackTrace() { if (logger.isTraceEnabled()) logger.trace("JAIN-SIP stack trace", new Throwable()); } /** * logs a stack trace. This helps to look at the stack frame. * * @param traceLevel currently unused. */ public void logStackTrace(int traceLevel) { if (logger.isTraceEnabled()) logger.trace("JAIN-SIP stack trace", new Throwable()); } /** * Get the line count in the log stream. * * @return line count */ public int getLineCount() { return 0; } /** * Log an exception. * * @param ex the exception that we are to log. */ public void logException(Throwable ex) { logger.warn("Exception in the JAIN-SIP stack: " + ex.getMessage()); if (logger.isInfoEnabled()) logger.info("JAIN-SIP exception stack trace is", ex); } /** * Log a message into the log file. * * @param message * message to log into the log file. */ public void logDebug(String message) { if (logger.isDebugEnabled()) logger.debug("Debug output from the JAIN-SIP stack: " + message); } /** * Log an error message. * * @param message -- * error message to log. */ public void logFatalError(String message) { if (logger.isTraceEnabled()) logger.trace("Fatal error from the JAIN-SIP stack: " + message); } /** * Log an error message. * * @param message error message to log. */ public void logError(String message) { logger.error("Error from the JAIN-SIP stack: " + message); } /** * Determines whether logging is enabled. * * @return flag to indicate if logging is enabled. */ public boolean isLoggingEnabled() { return true; } /** * Return true/false if logging is enabled at a given level. * * @param logLevel the level that we'd like to check loggability for. * * @return always <tt>true</tt> regardless of <tt>logLevel</tt>'s value. */ public boolean isLoggingEnabled(int logLevel) { // always enable trace messages so we can receive packets // and log them to packet logging service if (logLevel == TRACE_DEBUG) return logger.isDebugEnabled(); if (logLevel == TRACE_MESSAGES) // same as TRACE_INFO return true; if (logLevel == TRACE_NONE) return false; return true; } /** * Logs an exception and an error message error message. * * @param message that message that we'd like to log. * @param ex the exception that we'd like to log. */ public void logError(String message, Exception ex) { logger.error("Error from the JAIN-SIP stack: " + message, ex); } /** * Log a warning message. * * @param string the warning that we'd like to log */ public void logWarning(String string) { logger.warn("Warning from the JAIN-SIP stack" + string); } /** * Log an info message. * * @param string the message that we'd like to log. */ public void logInfo(String string) { if (logger.isInfoEnabled()) logger.info("Info from the JAIN-SIP stack: " + string); } /** * Disable logging altogether. * */ public void disableLogging() {} /** * Enable logging (globally). */ public void enableLogging() {} /** * Logs the build time stamp of the jain-sip reference implementation. * * @param buildTimeStamp the build time stamp of the jain-sip reference * implementation. */ public void setBuildTimeStamp(String buildTimeStamp) { if (logger.isTraceEnabled()) logger.trace("JAIN-SIP RI build " + buildTimeStamp); } /** * Dummy implementation for {@link ServerLogger#setStackProperties( * Properties)} */ public void setStackProperties(Properties stackProperties) {} /** * Dummy implementation for {@link ServerLogger#closeLogFile()} */ public void closeLogFile() {} /** * Logs the specified message and details. * * @param message the message to log * @param from the message sender * @param to the message addressee * @param sender determines whether we are the origin of this message. * @param time the date this message was received at. */ public void logMessage(SIPMessage message, String from, String to, boolean sender, long time) { logMessage(message, from, to, null, sender, time); } /** * Logs the specified message and details. * * @param message the message to log * @param from the message sender * @param to the message addressee * @param status message status * @param sender determines whether we are the origin of this message. * @param time the date this message was received at. */ public void logMessage(SIPMessage message, String from, String to, String status, boolean sender, long time) { try { logPacket(message, sender); } catch(Throwable e) { logger.error("Error logging packet", e); } } /** * Logs the specified message and details to the packet logging service * if enabled. * * @param message the message to log * @param sender determines whether we are the origin of this message. */ private void logPacket(SIPMessage message, boolean sender) { try { PacketLoggingService packetLogging = SipActivator.getPacketLogging(); if( packetLogging == null || !packetLogging.isLoggingEnabled( PacketLoggingService.ProtocolName.SIP) /* Via not present in CRLF packet on TCP - causes NPE */ || message.getTopmostVia() == null ) return; String transport = message.getTopmostVia().getTransport(); boolean isTransportUDP = transport.equalsIgnoreCase("UDP"); byte[] srcAddr; int srcPort; byte[] dstAddr; int dstPort; // if addresses are not set use empty byte array with length // equals to the other address or just empty // byte array with length 4 (ipv4 0.0.0.0) if(sender) { if(!isTransportUDP) { InetSocketAddress localAddress = getLocalAddressForDestination( message.getRemoteAddress(), message.getRemotePort(), message.getLocalAddress(), transport); if (localAddress != null) { srcPort = localAddress.getPort(); srcAddr = localAddress.getAddress().getAddress(); } else { logger.warn("Could not obtain source address for " + " packet. Writing source as 0.0.0.0:0"); srcPort = 0; srcAddr = new byte[] { 0, 0, 0, 0 }; } } else { srcPort = message.getLocalPort(); if(message.getLocalAddress() != null) srcAddr = message.getLocalAddress().getAddress(); else if(message.getRemoteAddress() != null) srcAddr = new byte[ message.getRemoteAddress().getAddress().length]; else srcAddr = new byte[4]; } dstPort = message.getRemotePort(); if(message.getRemoteAddress() != null) dstAddr = message.getRemoteAddress().getAddress(); else dstAddr = new byte[srcAddr.length]; } else { if(!isTransportUDP) { InetSocketAddress dstAddress = getLocalAddressForDestination( message.getRemoteAddress(), message.getRemotePort(), message.getLocalAddress(), transport); dstPort = dstAddress.getPort(); dstAddr = dstAddress.getAddress().getAddress(); } else { dstPort = message.getLocalPort(); if(message.getLocalAddress() != null) dstAddr = message.getLocalAddress().getAddress(); else if(message.getRemoteAddress() != null) dstAddr = new byte[ message.getRemoteAddress().getAddress().length]; else dstAddr = new byte[4]; } srcPort = message.getRemotePort(); if(message.getRemoteAddress() != null) srcAddr = message.getRemoteAddress().getAddress(); else srcAddr = new byte[dstAddr.length]; } byte[] msg = null; if(message instanceof SIPRequest) { SIPRequest req = (SIPRequest)message; if(req.getMethod().equals(SIPRequest.MESSAGE) && message.getContentTypeHeader() != null && message.getContentTypeHeader() .getContentType().equalsIgnoreCase("text")) { int len = req.getContentLength().getContentLength(); if(len > 0) { SIPRequest newReq = (SIPRequest)req.clone(); byte[] newContent = new byte[len]; Arrays.fill(newContent, (byte)'.'); newReq.setMessageContent(newContent); msg = newReq.toString().getBytes("UTF-8"); } } } if(msg == null) { msg = message.toString().getBytes("UTF-8"); } packetLogging.logPacket( PacketLoggingService.ProtocolName.SIP, srcAddr, srcPort, dstAddr, dstPort, isTransportUDP ? PacketLoggingService.TransportName.UDP : PacketLoggingService.TransportName.TCP, sender, msg); } catch(Throwable e) { logger.error("Cannot obtain message body", e); } } /** * Logs the specified message and details. * * @param message the message to log * @param from the message sender * @param to the message addressee * @param status message status * @param sender determines whether we are the origin of this message. */ public void logMessage(SIPMessage message, String from, String to, String status, boolean sender) { if (!logger.isInfoEnabled()) return; String msgHeader; if(sender) msgHeader = "JAIN-SIP sent a message from=\""; else msgHeader = "JAIN-SIP received a message from=\""; if (logger.isInfoEnabled()) logger.info(msgHeader + from + "\" to=\"" + to + "\" (status: " + status + "):\n" + message); } /** * Prints the specified <tt>exception</tt> as a warning. * * @param exception the <tt>Exception</tt> we are passed from jain-sip. */ public void logException(Exception exception) { logger.warn("the following exception occured in JAIN-SIP: " + exception, exception); } /** * A dummy implementation. * * @param sipStack ignored; */ public void setSipStack(SipStack sipStack) { this.sipStack = sipStack; } /** * Returns a logger name. * * @return a logger name. */ public String getLoggerName() { return "SIP Communicator JAIN SIP logger."; } /** * Logs the specified trace with a debuf level. * * @param message the trace to log. */ public void logTrace(String message) { if (logger.isDebugEnabled()) logger.debug(message); } /** * Returns a local address to use with the specified TCP destination. * The method forces the JAIN-SIP stack to create * s and binds (if necessary) * and return a socket connected to the specified destination address and * port and then return its local address. * * @param dst the destination address that the socket would need to connect * to. * @param dstPort the port number that the connection would be established * with. * @param localAddress the address that we would like to bind on * (null for the "any" address). * @param transport the transport that will be used TCP ot TLS * * @return the SocketAddress that this handler would use when connecting to * the specified destination address and port. * * @throws IOException if we fail binding the local socket */ public java.net.InetSocketAddress getLocalAddressForDestination( java.net.InetAddress dst, int dstPort, java.net.InetAddress localAddress, String transport) throws IOException { if(ListeningPoint.TLS.equalsIgnoreCase(transport)) return (java.net.InetSocketAddress)(((SipStackImpl)this.sipStack) .getLocalAddressForTlsDst(dst, dstPort, localAddress)); else return (java.net.InetSocketAddress)(((SipStackImpl)this.sipStack) .getLocalAddressForTcpDst(dst, dstPort, localAddress, 0)); } }
lgpl-2.1
GNOME/orca
test/keystrokes/firefox/ui_role_tree.py
5957
#!/usr/bin/python """Test of tree output using Firefox.""" from macaroon.playback import * import utils sequence = MacroSequence() sequence.append(PauseAction(3000)) sequence.append(KeyComboAction("<Alt>b")) sequence.append(KeyComboAction("Return")) sequence.append(KeyComboAction("Tab")) sequence.append(KeyComboAction("Tab")) sequence.append(KeyComboAction("Up")) sequence.append(KeyComboAction("Up")) sequence.append(KeyComboAction("Up")) sequence.append(KeyComboAction("Tab")) sequence.append(PauseAction(3000)) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("<Shift>Tab")) sequence.append(utils.AssertPresentationAction( "1. Shift Tab for tree", ["BRAILLE LINE: 'Firefox application Library frame All Bookmarks expanded TREE LEVEL 1'", " VISIBLE: 'All Bookmarks expanded TREE LEVE', cursor=1", "SPEECH OUTPUT: 'All Bookmarks.'", "SPEECH OUTPUT: 'expanded.'"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Down")) sequence.append(utils.AssertPresentationAction( "2. Down Arrow in tree", ["BRAILLE LINE: 'Firefox application Library frame Bookmarks Toolbar TREE LEVEL 2'", " VISIBLE: 'Bookmarks Toolbar TREE LEVEL 2', cursor=1", "SPEECH OUTPUT: 'Bookmarks Toolbar.'", "SPEECH OUTPUT: 'tree level 2'"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Down")) sequence.append(utils.AssertPresentationAction( "3. Down Arrow in tree", ["BRAILLE LINE: 'Firefox application Library frame Bookmarks Menu collapsed TREE LEVEL 2'", " VISIBLE: 'Bookmarks Menu collapsed TREE LE', cursor=1", "SPEECH OUTPUT: 'Bookmarks Menu.'", "SPEECH OUTPUT: 'collapsed.'"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("KP_Enter")) sequence.append(utils.AssertPresentationAction( "4. Basic Where Am I", ["BRAILLE LINE: 'Firefox application Library frame Bookmarks Menu collapsed TREE LEVEL 2'", " VISIBLE: 'Bookmarks Menu collapsed TREE LE', cursor=1", "SPEECH OUTPUT: 'Bookmarks Menu tree item.'", "SPEECH OUTPUT: '2 of 3.'", "SPEECH OUTPUT: 'collapsed tree level 2'"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Right")) sequence.append(utils.AssertPresentationAction( "5. Right Arrow to expand folder", ["BRAILLE LINE: 'Firefox application Library frame Bookmarks Menu expanded TREE LEVEL 2'", " VISIBLE: 'Bookmarks Menu expanded TREE LEV', cursor=1", "SPEECH OUTPUT: 'expanded'"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("KP_Enter")) sequence.append(utils.AssertPresentationAction( "6. Basic Where Am I", ["BRAILLE LINE: 'Firefox application Library frame Bookmarks Menu expanded TREE LEVEL 2'", " VISIBLE: 'Bookmarks Menu expanded TREE LEV', cursor=1", "SPEECH OUTPUT: 'Bookmarks Menu tree item.'", "SPEECH OUTPUT: '2 of 3.'", "SPEECH OUTPUT: 'expanded tree level 2'"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Down")) sequence.append(utils.AssertPresentationAction( "7. Down Arrow in tree", ["BRAILLE LINE: 'Firefox application Library frame GNOME TREE LEVEL 3'", " VISIBLE: 'GNOME TREE LEVEL 3', cursor=1", "SPEECH OUTPUT: 'GNOME.'", "SPEECH OUTPUT: 'tree level 3'"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("KP_Enter")) sequence.append(utils.AssertPresentationAction( "8. Basic Where Am I", ["BRAILLE LINE: 'Firefox application Library frame GNOME TREE LEVEL 3'", " VISIBLE: 'GNOME TREE LEVEL 3', cursor=1", "SPEECH OUTPUT: 'GNOME tree item.'", "SPEECH OUTPUT: '1 of 2.'", "SPEECH OUTPUT: 'tree level 3'"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Up")) sequence.append(utils.AssertPresentationAction( "9. Up Arrow in tree", ["BRAILLE LINE: 'Firefox application Library frame Bookmarks Menu expanded TREE LEVEL 2'", " VISIBLE: 'Bookmarks Menu expanded TREE LEV', cursor=1", "SPEECH OUTPUT: 'Bookmarks Menu.'", "SPEECH OUTPUT: 'expanded.'", "SPEECH OUTPUT: 'tree level 2'"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Left")) sequence.append(utils.AssertPresentationAction( "10. Left Arrow to collapse folder", ["BRAILLE LINE: 'Firefox application Library frame Bookmarks Menu collapsed TREE LEVEL 2'", " VISIBLE: 'Bookmarks Menu collapsed TREE LE', cursor=1", "SPEECH OUTPUT: 'collapsed'"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Up")) sequence.append(utils.AssertPresentationAction( "11. Up Arrow in tree", ["BRAILLE LINE: 'Firefox application Library frame Bookmarks Toolbar TREE LEVEL 2'", " VISIBLE: 'Bookmarks Toolbar TREE LEVEL 2', cursor=1", "SPEECH OUTPUT: 'Bookmarks Toolbar.'"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Up")) sequence.append(utils.AssertPresentationAction( "12. Up Arrow in tree", ["BRAILLE LINE: 'Firefox application Library frame All Bookmarks expanded TREE LEVEL 1'", " VISIBLE: 'All Bookmarks expanded TREE LEVE', cursor=1", "SPEECH OUTPUT: 'All Bookmarks.'", "SPEECH OUTPUT: 'expanded.'", "SPEECH OUTPUT: 'tree level 1'"])) sequence.append(utils.StartRecordingAction()) sequence.append(KeyComboAction("Tab")) sequence.append(utils.AssertPresentationAction( "13. Tab back to tree table", ["BRAILLE LINE: 'Firefox application Library frame tree table Bookmarks Toolbar table row TREE LEVEL 1'", " VISIBLE: 'Bookmarks Toolbar table row TR', cursor=1", "SPEECH OUTPUT: 'Bookmarks Toolbar '"])) sequence.append(KeyComboAction("<Alt>F4")) sequence.append(utils.AssertionSummaryAction()) sequence.start()
lgpl-2.1
FernCreek/tinymce
modules/jax/src/main/ts/ephox/jax/core/HttpTypes.ts
1335
import { FutureResult } from '@ephox/katamari'; import { ResponseBodyDataTypes, RequestBody, ResponseBody } from './HttpData'; import { HttpError } from './HttpError'; export const enum HttpMethod { Get = 'get', Post = 'post', Delete = 'delete', Patch = 'patch', Put = 'put' } export type ProgressFunction = (loaded: number, total: number) => void; export type LoadedProgressFunction = (loaded: number) => void; export interface HttpRequest<T extends ResponseBodyDataTypes> { responseType: T; body: RequestBody; url: string; method: HttpMethod; query?: Record<string, string>; progress?: ProgressFunction; headers?: Record<string, string>; credentials?: boolean; } export interface HttpResponse<T extends ResponseBody> { headers: Record<string, string>; statusCode: number; body: T; } export type JwtToken = string; export type JwtTokenFactory = (fresh: boolean) => FutureResult<JwtToken, HttpError>; type Omit<T, K> = Pick<T, Exclude<keyof T, K>>; export type PostPutInit <T extends ResponseBodyDataTypes> = Omit<HttpRequest<T>, 'method'>; export type GetDelInit <T extends ResponseBodyDataTypes> = Omit<HttpRequest<T>, 'method' | 'body'>; export interface DownloadHttpRequest { url: string; progress?: LoadedProgressFunction; headers?: Record<string, string>; credentials?: boolean; }
lgpl-2.1
ecbtnrt/my-dfb
src/core/input.c
94789
/* (c) Copyright 2001-2010 The world wide DirectFB Open Source Community (directfb.org) (c) Copyright 2000-2004 Convergence (integrated media) GmbH All rights reserved. Written by Denis Oliver Kropp <dok@directfb.org>, Andreas Hundt <andi@fischlustig.de>, Sven Neumann <neo@directfb.org>, Ville Syrjälä <syrjala@sci.fi> and Claudio Ciccani <klan@users.sf.net>. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <config.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <directfb.h> #include <directfb_keynames.h> #include <direct/debug.h> #include <direct/list.h> #include <direct/memcpy.h> #include <direct/messages.h> #include <fusion/shmalloc.h> #include <fusion/reactor.h> #include <fusion/arena.h> #include <core/core.h> #include <core/coredefs.h> #include <core/coretypes.h> #include <core/core_parts.h> #include <core/gfxcard.h> #include <core/surface.h> #include <core/surface_buffer.h> #include <core/system.h> #include <core/layer_context.h> #include <core/layer_control.h> #include <core/layer_region.h> #include <core/layers.h> #include <core/input.h> #include <core/windows.h> #include <core/windows_internal.h> #include <direct/mem.h> #include <direct/memcpy.h> #include <direct/messages.h> #include <direct/modules.h> #include <direct/trace.h> #include <fusion/build.h> #include <misc/conf.h> #include <misc/util.h> #include <gfx/convert.h> #define CHECK_INTERVAL 20000 // Microseconds #define CHECK_NUMBER 200 D_DEBUG_DOMAIN( Core_Input, "Core/Input", "DirectFB Input Core" ); D_DEBUG_DOMAIN( Core_InputEvt, "Core/Input/Evt", "DirectFB Input Core Events & Dispatch" ); DEFINE_MODULE_DIRECTORY( dfb_input_modules, "inputdrivers", DFB_INPUT_DRIVER_ABI_VERSION ); /**********************************************************************************************************************/ typedef enum { CIDC_RELOAD_KEYMAP } CoreInputDeviceCommand; typedef struct { DirectLink link; int magic; DirectModuleEntry *module; const InputDriverFuncs *funcs; InputDriverInfo info; int nr_devices; } InputDriver; typedef struct { int min_keycode; int max_keycode; int num_entries; DFBInputDeviceKeymapEntry *entries; } InputDeviceKeymap; typedef struct { int magic; DFBInputDeviceID id; /* unique device id */ int num; InputDeviceInfo device_info; InputDeviceKeymap keymap; DFBInputDeviceModifierMask modifiers_l; DFBInputDeviceModifierMask modifiers_r; DFBInputDeviceLockState locks; DFBInputDeviceButtonMask buttons; DFBInputDeviceKeyIdentifier last_key; /* last key pressed */ DFBInputDeviceKeySymbol last_symbol; /* last symbol pressed */ bool first_press; /* first press of key */ FusionReactor *reactor; /* event dispatcher */ FusionSkirmish lock; FusionCall call; /* driver call via master */ unsigned int axis_num; DFBInputDeviceAxisInfo *axis_info; FusionRef ref; /* Ref between shared device & local device */ } InputDeviceShared; struct __DFB_CoreInputDevice { DirectLink link; int magic; InputDeviceShared *shared; InputDriver *driver; void *driver_data; CoreDFB *core; }; /**********************************************************************************************************************/ typedef struct { int magic; int num; InputDeviceShared *devices[MAX_INPUTDEVICES]; FusionReactor *reactor; /* For input hot-plug event */ } DFBInputCoreShared; struct __DFB_DFBInputCore { int magic; CoreDFB *core; DFBInputCoreShared *shared; DirectLink *drivers; DirectLink *devices; }; DFB_CORE_PART( input_core, InputCore ); /**********************************************************************************************************************/ typedef struct { DFBInputDeviceKeySymbol target; DFBInputDeviceKeySymbol result; } DeadKeyCombo; typedef struct { DFBInputDeviceKeySymbol deadkey; const DeadKeyCombo *combos; } DeadKeyMap; /* Data struct of input device hotplug event */ typedef struct { bool is_plugin; /* Hotplug in or not */ int dev_id; /* Input device ID*/ struct timeval stamp; /* Time stamp of event */ } InputDeviceHotplugEvent; /**********************************************************************************************************************/ static const DeadKeyCombo combos_grave[] = { { DIKS_SPACE, (unsigned char) '`' }, { DIKS_SMALL_A, (unsigned char) 'à' }, { DIKS_SMALL_E, (unsigned char) 'è' }, { DIKS_SMALL_I, (unsigned char) 'ì' }, { DIKS_SMALL_O, (unsigned char) 'ò' }, { DIKS_SMALL_U, (unsigned char) 'ù' }, { DIKS_CAPITAL_A, (unsigned char) 'À' }, { DIKS_CAPITAL_E, (unsigned char) 'È' }, { DIKS_CAPITAL_I, (unsigned char) 'Ì' }, { DIKS_CAPITAL_O, (unsigned char) 'Ò' }, { DIKS_CAPITAL_U, (unsigned char) 'Ù' }, { 0, 0 } }; static const DeadKeyCombo combos_acute[] = { { DIKS_SPACE, (unsigned char) '\'' }, { DIKS_SMALL_A, (unsigned char) 'á' }, { DIKS_SMALL_E, (unsigned char) 'é' }, { DIKS_SMALL_I, (unsigned char) 'í' }, { DIKS_SMALL_O, (unsigned char) 'ó' }, { DIKS_SMALL_U, (unsigned char) 'ú' }, { DIKS_SMALL_Y, (unsigned char) 'ý' }, { DIKS_CAPITAL_A, (unsigned char) 'Á' }, { DIKS_CAPITAL_E, (unsigned char) 'É' }, { DIKS_CAPITAL_I, (unsigned char) 'Í' }, { DIKS_CAPITAL_O, (unsigned char) 'Ó' }, { DIKS_CAPITAL_U, (unsigned char) 'Ú' }, { DIKS_CAPITAL_Y, (unsigned char) 'Ý' }, { 0, 0 } }; static const DeadKeyCombo combos_circumflex[] = { { DIKS_SPACE, (unsigned char) '^' }, { DIKS_SMALL_A, (unsigned char) 'â' }, { DIKS_SMALL_E, (unsigned char) 'ê' }, { DIKS_SMALL_I, (unsigned char) 'î' }, { DIKS_SMALL_O, (unsigned char) 'ô' }, { DIKS_SMALL_U, (unsigned char) 'û' }, { DIKS_CAPITAL_A, (unsigned char) 'Â' }, { DIKS_CAPITAL_E, (unsigned char) 'Ê' }, { DIKS_CAPITAL_I, (unsigned char) 'Î' }, { DIKS_CAPITAL_O, (unsigned char) 'Ô' }, { DIKS_CAPITAL_U, (unsigned char) 'Û' }, { 0, 0 } }; static const DeadKeyCombo combos_diaeresis[] = { { DIKS_SPACE, (unsigned char) '¨' }, { DIKS_SMALL_A, (unsigned char) 'ä' }, { DIKS_SMALL_E, (unsigned char) 'ë' }, { DIKS_SMALL_I, (unsigned char) 'ï' }, { DIKS_SMALL_O, (unsigned char) 'ö' }, { DIKS_SMALL_U, (unsigned char) 'ü' }, { DIKS_CAPITAL_A, (unsigned char) 'Ä' }, { DIKS_CAPITAL_E, (unsigned char) 'Ë' }, { DIKS_CAPITAL_I, (unsigned char) 'Ï' }, { DIKS_CAPITAL_O, (unsigned char) 'Ö' }, { DIKS_CAPITAL_U, (unsigned char) 'Ü' }, { 0, 0 } }; static const DeadKeyCombo combos_tilde[] = { { DIKS_SPACE, (unsigned char) '~' }, { DIKS_SMALL_A, (unsigned char) 'ã' }, { DIKS_SMALL_N, (unsigned char) 'ñ' }, { DIKS_SMALL_O, (unsigned char) 'õ' }, { DIKS_CAPITAL_A, (unsigned char) 'Ã' }, { DIKS_CAPITAL_N, (unsigned char) 'Ñ' }, { DIKS_CAPITAL_O, (unsigned char) 'Õ' }, { 0, 0 } }; static const DeadKeyMap deadkey_maps[] = { { DIKS_DEAD_GRAVE, combos_grave }, { DIKS_DEAD_ACUTE, combos_acute }, { DIKS_DEAD_CIRCUMFLEX, combos_circumflex }, { DIKS_DEAD_DIAERESIS, combos_diaeresis }, { DIKS_DEAD_TILDE, combos_tilde } }; /* define a lookup table to go from key IDs to names. * This is used to look up the names provided in a loaded key table */ /* this table is roughly 4Kb in size */ DirectFBKeySymbolNames(KeySymbolNames); DirectFBKeyIdentifierNames(KeyIdentifierNames); /**********************************************************************************************************************/ static void init_devices( CoreDFB *core ); static void allocate_device_keymap( CoreDFB *core, CoreInputDevice *device ); static DFBInputDeviceKeymapEntry *get_keymap_entry( CoreInputDevice *device, int code ); static DFBResult set_keymap_entry( CoreInputDevice *device, int code, DFBInputDeviceKeymapEntry *entry ); static DFBResult load_keymap( CoreInputDevice *device, char *filename ); static DFBInputDeviceKeySymbol lookup_keysymbol( char *symbolname ); static DFBInputDeviceKeyIdentifier lookup_keyidentifier( char *identifiername ); /**********************************************************************************************************************/ static bool lookup_from_table( CoreInputDevice *device, DFBInputEvent *event, DFBInputEventFlags lookup ); static void fixup_key_event ( CoreInputDevice *device, DFBInputEvent *event ); static void fixup_mouse_event( CoreInputDevice *device, DFBInputEvent *event ); static void flush_keys ( CoreInputDevice *device ); static bool core_input_filter( CoreInputDevice *device, DFBInputEvent *event ); /**********************************************************************************************************************/ static DFBInputDeviceKeyIdentifier symbol_to_id( DFBInputDeviceKeySymbol symbol ); static DFBInputDeviceKeySymbol id_to_symbol( DFBInputDeviceKeyIdentifier id, DFBInputDeviceModifierMask modifiers, DFBInputDeviceLockState locks ); /**********************************************************************************************************************/ static ReactionResult local_processing_hotplug( const void *msg_data, void *ctx ); /**********************************************************************************************************************/ static ReactionFunc dfb_input_globals[MAX_INPUT_GLOBALS+1] = { /* 0 */ _dfb_windowstack_inputdevice_listener, NULL }; DFBResult dfb_input_add_global( ReactionFunc func, int *ret_index ) { int i; D_DEBUG_AT( Core_Input, "%s( %p, %p )\n", __FUNCTION__, func, ret_index ); D_ASSERT( func != NULL ); D_ASSERT( ret_index != NULL ); for (i=0; i<MAX_INPUT_GLOBALS; i++) { if (!dfb_input_globals[i]) { dfb_input_globals[i] = func; D_DEBUG_AT( Core_Input, " -> index %d\n", i ); *ret_index = i; return DFB_OK; } } return DFB_LIMITEXCEEDED; } DFBResult dfb_input_set_global( ReactionFunc func, int index ) { D_DEBUG_AT( Core_Input, "%s( %p, %d )\n", __FUNCTION__, func, index ); D_ASSERT( func != NULL ); D_ASSERT( index >= 0 ); D_ASSERT( index < MAX_INPUT_GLOBALS ); D_ASSUME( dfb_input_globals[index] == NULL ); dfb_input_globals[index] = func; return DFB_OK; } /**********************************************************************************************************************/ static DFBInputCore *core_local; /* FIXME */ static DFBInputCoreShared *core_input; /* FIXME */ #if FUSION_BUILD_MULTI static Reaction local_processing_react; /* Local reaction to hot-plug event */ #endif static DFBResult dfb_input_core_initialize( CoreDFB *core, DFBInputCore *data, DFBInputCoreShared *shared ) { #if FUSION_BUILD_MULTI DFBResult result = DFB_OK; #endif D_DEBUG_AT( Core_Input, "dfb_input_core_initialize( %p, %p, %p )\n", core, data, shared ); D_ASSERT( data != NULL ); D_ASSERT( shared != NULL ); core_local = data; /* FIXME */ core_input = shared; /* FIXME */ data->core = core; data->shared = shared; direct_modules_explore_directory( &dfb_input_modules ); #if FUSION_BUILD_MULTI /* Create the reactor that responds input device hot-plug events. */ core_input->reactor = fusion_reactor_new( sizeof( InputDeviceHotplugEvent ), "Input Hotplug", dfb_core_world(core) ); if (!core_input->reactor) { D_ERROR( "DirectFB/Input: fusion_reactor_new() failed!\n" ); result = DFB_FAILURE; goto errorExit; } /* Attach local process function to the input hot-plug reactor. */ result = fusion_reactor_attach( core_input->reactor, local_processing_hotplug, (void*) core, &local_processing_react ); if (result) { D_ERROR( "DirectFB/Input: fusion_reactor_attach() failed!\n" ); goto errorExit; } #endif init_devices( core ); D_MAGIC_SET( data, DFBInputCore ); D_MAGIC_SET( shared, DFBInputCoreShared ); return DFB_OK; #if FUSION_BUILD_MULTI errorExit: /* Destroy the hot-plug reactor if it was created. */ if (core_input->reactor) fusion_reactor_destroy(core_input->reactor); return result; #endif } static DFBResult dfb_input_core_join( CoreDFB *core, DFBInputCore *data, DFBInputCoreShared *shared ) { int i; #if FUSION_BUILD_MULTI DFBResult result; #endif D_DEBUG_AT( Core_Input, "dfb_input_core_join( %p, %p, %p )\n", core, data, shared ); D_ASSERT( data != NULL ); D_MAGIC_ASSERT( shared, DFBInputCoreShared ); D_ASSERT( shared->reactor != NULL ); core_local = data; /* FIXME */ core_input = shared; /* FIXME */ data->core = core; data->shared = shared; #if FUSION_BUILD_MULTI /* Attach the local process function to the input hot-plug reactor. */ result = fusion_reactor_attach( core_input->reactor, local_processing_hotplug, (void*) core, &local_processing_react ); if (result) { D_ERROR( "DirectFB/Input: fusion_reactor_attach failed!\n" ); return result; } #endif for (i=0; i<core_input->num; i++) { CoreInputDevice *device; device = D_CALLOC( 1, sizeof(CoreInputDevice) ); if (!device) { D_OOM(); continue; } device->shared = core_input->devices[i]; #if FUSION_BUILD_MULTI /* Increase the reference counter. */ fusion_ref_up( &device->shared->ref, true ); #endif /* add it to the list */ direct_list_append( &data->devices, &device->link ); D_MAGIC_SET( device, CoreInputDevice ); } D_MAGIC_SET( data, DFBInputCore ); return DFB_OK; } static DFBResult dfb_input_core_shutdown( DFBInputCore *data, bool emergency ) { DFBInputCoreShared *shared; DirectLink *n; CoreInputDevice *device; FusionSHMPoolShared *pool = dfb_core_shmpool( data->core ); InputDriver *driver; D_DEBUG_AT( Core_Input, "dfb_input_core_shutdown( %p, %semergency )\n", data, emergency ? "" : "no " ); D_MAGIC_ASSERT( data, DFBInputCore ); D_MAGIC_ASSERT( data->shared, DFBInputCoreShared ); shared = data->shared; /* Stop each input provider's hot-plug thread that supports device hot-plugging. */ direct_list_foreach_safe (driver, n, core_local->drivers) { if (driver->funcs->GetCapability && driver->funcs->StopHotplug) { if (IDC_HOTPLUG & driver->funcs->GetCapability()) { D_DEBUG_AT( Core_Input, "Stopping hot-plug detection thread " "within %s\n ", driver->module->name ); if (driver->funcs->StopHotplug()) { D_ERROR( "DirectFB/Input: StopHotplug() failed with %s\n", driver->module->name ); } } } } #if FUSION_BUILD_MULTI fusion_reactor_detach( core_input->reactor, &local_processing_react ); fusion_reactor_destroy( core_input->reactor ); #endif direct_list_foreach_safe (device, n, data->devices) { InputDeviceShared *devshared; D_MAGIC_ASSERT( device, CoreInputDevice ); driver = device->driver; D_ASSERT( driver != NULL ); devshared = device->shared; D_ASSERT( devshared != NULL ); fusion_call_destroy( &devshared->call ); fusion_skirmish_destroy( &devshared->lock ); if (device->driver_data != NULL) { void *driver_data; D_ASSERT( driver->funcs != NULL ); D_ASSERT( driver->funcs->CloseDevice != NULL ); D_DEBUG_AT( Core_Input, " -> closing '%s' (%d) %d.%d (%s)\n", devshared->device_info.desc.name, devshared->num + 1, driver->info.version.major, driver->info.version.minor, driver->info.vendor ); driver_data = device->driver_data; device->driver_data = NULL; driver->funcs->CloseDevice( driver_data ); } if (!--driver->nr_devices) { direct_module_unref( driver->module ); D_FREE( driver ); } #if FUSION_BUILD_MULTI fusion_ref_destroy( &device->shared->ref ); #endif fusion_reactor_free( devshared->reactor ); if (devshared->keymap.entries) SHFREE( pool, devshared->keymap.entries ); if (devshared->axis_info) SHFREE( pool, devshared->axis_info ); SHFREE( pool, devshared ); D_MAGIC_CLEAR( device ); D_FREE( device ); } D_MAGIC_CLEAR( data ); D_MAGIC_CLEAR( shared ); return DFB_OK; } static DFBResult dfb_input_core_leave( DFBInputCore *data, bool emergency ) { DFBInputCoreShared *shared; DirectLink *n; CoreInputDevice *device; D_DEBUG_AT( Core_Input, "dfb_input_core_leave( %p, %semergency )\n", data, emergency ? "" : "no " ); D_MAGIC_ASSERT( data, DFBInputCore ); D_MAGIC_ASSERT( data->shared, DFBInputCoreShared ); shared = data->shared; #if FUSION_BUILD_MULTI fusion_reactor_detach( core_input->reactor, &local_processing_react ); #endif direct_list_foreach_safe (device, n, data->devices) { D_MAGIC_ASSERT( device, CoreInputDevice ); #if FUSION_BUILD_MULTI /* Decrease the ref between shared device and local device. */ fusion_ref_down( &device->shared->ref, true ); #endif D_FREE( device ); } D_MAGIC_CLEAR( data ); return DFB_OK; } static DFBResult dfb_input_core_suspend( DFBInputCore *data ) { DFBInputCoreShared *shared; CoreInputDevice *device; InputDriver *driver; D_DEBUG_AT( Core_Input, "dfb_input_core_suspend( %p )\n", data ); D_MAGIC_ASSERT( data, DFBInputCore ); D_MAGIC_ASSERT( data->shared, DFBInputCoreShared ); shared = data->shared; D_DEBUG_AT( Core_Input, " -> suspending...\n" ); /* Go through the drivers list and attempt to suspend all of the drivers that * support the Suspend function. */ direct_list_foreach (driver, core_local->drivers) { DFBResult ret; D_ASSERT( driver->funcs->Suspend != NULL ); ret = driver->funcs->Suspend(); if (ret != DFB_OK && ret != DFB_UNSUPPORTED) { D_DERROR( ret, "driver->Suspend failed during suspend (%s)\n", driver->info.name ); } } direct_list_foreach (device, data->devices) { InputDeviceShared *devshared; D_MAGIC_ASSERT( device, CoreInputDevice ); driver = device->driver; D_ASSERT( driver != NULL ); devshared = device->shared; D_ASSERT( devshared != NULL ); if (device->driver_data != NULL) { void *driver_data; D_ASSERT( driver->funcs != NULL ); D_ASSERT( driver->funcs->CloseDevice != NULL ); D_DEBUG_AT( Core_Input, " -> closing '%s' (%d) %d.%d (%s)\n", devshared->device_info.desc.name, devshared->num + 1, driver->info.version.major, driver->info.version.minor, driver->info.vendor ); driver_data = device->driver_data; device->driver_data = NULL; driver->funcs->CloseDevice( driver_data ); } flush_keys( device ); } D_DEBUG_AT( Core_Input, " -> suspended.\n" ); return DFB_OK; } static DFBResult dfb_input_core_resume( DFBInputCore *data ) { DFBInputCoreShared *shared; DFBResult ret; CoreInputDevice *device; InputDriver *driver; D_DEBUG_AT( Core_Input, "dfb_input_core_resume( %p )\n", data ); D_MAGIC_ASSERT( data, DFBInputCore ); D_MAGIC_ASSERT( data->shared, DFBInputCoreShared ); shared = data->shared; D_DEBUG_AT( Core_Input, " -> resuming...\n" ); direct_list_foreach (device, data->devices) { D_MAGIC_ASSERT( device, CoreInputDevice ); D_DEBUG_AT( Core_Input, " -> reopening '%s' (%d) %d.%d (%s)\n", device->shared->device_info.desc.name, device->shared->num + 1, device->driver->info.version.major, device->driver->info.version.minor, device->driver->info.vendor ); D_ASSERT( device->driver_data == NULL ); ret = device->driver->funcs->OpenDevice( device, device->shared->num, &device->shared->device_info, &device->driver_data ); if (ret) { D_DERROR( ret, "DirectFB/Input: Failed reopening device " "during resume (%s)!\n", device->shared->device_info.desc.name ); device->driver_data = NULL; } } /* Go through the drivers list and attempt to resume all of the drivers that * support the Resume function. */ direct_list_foreach (driver, core_local->drivers) { D_ASSERT( driver->funcs->Resume != NULL ); ret = driver->funcs->Resume(); if (ret != DFB_OK && ret != DFB_UNSUPPORTED) { D_DERROR( ret, "driver->Resume failed during resume (%s)\n", driver->info.name ); } } D_DEBUG_AT( Core_Input, " -> resumed.\n" ); return DFB_OK; } void dfb_input_enumerate_devices( InputDeviceCallback callback, void *ctx, DFBInputDeviceCapabilities caps ) { CoreInputDevice *device; D_ASSERT( core_input != NULL ); direct_list_foreach (device, core_local->devices) { DFBInputDeviceCapabilities dev_caps; D_MAGIC_ASSERT( device, CoreInputDevice ); D_ASSERT( device->shared != NULL ); dev_caps = device->shared->device_info.desc.caps; /* Always match if unclassified */ if (!dev_caps) dev_caps = DICAPS_ALL; if ((dev_caps & caps) && callback( device, ctx ) == DFENUM_CANCEL) break; } } DirectResult dfb_input_attach( CoreInputDevice *device, ReactionFunc func, void *ctx, Reaction *reaction ) { D_DEBUG_AT( Core_Input, "%s( %p, %p, %p, %p )\n", __FUNCTION__, device, func, ctx, reaction ); D_MAGIC_ASSERT( device, CoreInputDevice ); D_ASSERT( core_input != NULL ); D_ASSERT( device != NULL ); D_ASSERT( device->shared != NULL ); return fusion_reactor_attach( device->shared->reactor, func, ctx, reaction ); } DirectResult dfb_input_detach( CoreInputDevice *device, Reaction *reaction ) { D_DEBUG_AT( Core_Input, "%s( %p, %p )\n", __FUNCTION__, device, reaction ); D_MAGIC_ASSERT( device, CoreInputDevice ); D_ASSERT( core_input != NULL ); D_ASSERT( device != NULL ); D_ASSERT( device->shared != NULL ); return fusion_reactor_detach( device->shared->reactor, reaction ); } DirectResult dfb_input_attach_global( CoreInputDevice *device, int index, void *ctx, GlobalReaction *reaction ) { D_DEBUG_AT( Core_Input, "%s( %p, %d, %p, %p )\n", __FUNCTION__, device, index, ctx, reaction ); D_MAGIC_ASSERT( device, CoreInputDevice ); D_ASSERT( core_input != NULL ); D_ASSERT( device != NULL ); D_ASSERT( device->shared != NULL ); return fusion_reactor_attach_global( device->shared->reactor, index, ctx, reaction ); } DirectResult dfb_input_detach_global( CoreInputDevice *device, GlobalReaction *reaction ) { D_DEBUG_AT( Core_Input, "%s( %p, %p )\n", __FUNCTION__, device, reaction ); D_MAGIC_ASSERT( device, CoreInputDevice ); D_ASSERT( core_input != NULL ); D_ASSERT( device != NULL ); D_ASSERT( device->shared != NULL ); return fusion_reactor_detach_global( device->shared->reactor, reaction ); } const char * dfb_input_event_type_name( DFBInputEventType type ) { switch (type) { case DIET_UNKNOWN: return "UNKNOWN"; case DIET_KEYPRESS: return "KEYPRESS"; case DIET_KEYRELEASE: return "KEYRELEASE"; case DIET_BUTTONPRESS: return "BUTTONPRESS"; case DIET_BUTTONRELEASE: return "BUTTONRELEASE"; case DIET_AXISMOTION: return "AXISMOTION"; default: break; } return "<invalid>"; } void dfb_input_dispatch( CoreInputDevice *device, DFBInputEvent *event ) { D_DEBUG_AT( Core_Input, "%s( %p, %p )\n", __FUNCTION__, device, event ); D_MAGIC_ASSERT( device, CoreInputDevice ); D_ASSERT( core_input != NULL ); D_ASSERT( device != NULL ); D_ASSERT( event != NULL ); /* * When a USB device is hot-removed, it is possible that there are pending events * still being dispatched and the shared field becomes NULL. */ /* * 0. Sanity checks & debugging... */ if (!device->shared) { D_DEBUG_AT( Core_Input, " -> No shared data!\n" ); return; } D_ASSUME( device->shared->reactor != NULL ); if (!device->shared->reactor) { D_DEBUG_AT( Core_Input, " -> No reactor!\n" ); return; } D_DEBUG_AT( Core_InputEvt, " -> (%02x) %s%s%s\n", event->type, dfb_input_event_type_name( event->type ), (event->flags & DIEF_FOLLOW) ? " [FOLLOW]" : "", (event->flags & DIEF_REPEAT) ? " [REPEAT]" : "" ); #if D_DEBUG_ENABLED if (event->flags & DIEF_TIMESTAMP) D_DEBUG_AT( Core_InputEvt, " -> TIMESTAMP %lu.%06lu\n", event->timestamp.tv_sec, event->timestamp.tv_usec ); if (event->flags & DIEF_AXISABS) D_DEBUG_AT( Core_InputEvt, " -> AXISABS %d at %d\n", event->axis, event->axisabs ); if (event->flags & DIEF_AXISREL) D_DEBUG_AT( Core_InputEvt, " -> AXISREL %d by %d\n", event->axis, event->axisrel ); if (event->flags & DIEF_KEYCODE) D_DEBUG_AT( Core_InputEvt, " -> KEYCODE %d\n", event->key_code ); if (event->flags & DIEF_KEYID) D_DEBUG_AT( Core_InputEvt, " -> KEYID 0x%04x\n", event->key_id ); if (event->flags & DIEF_KEYSYMBOL) D_DEBUG_AT( Core_InputEvt, " -> KEYSYMBOL 0x%04x\n", event->key_symbol ); if (event->flags & DIEF_MODIFIERS) D_DEBUG_AT( Core_InputEvt, " -> MODIFIERS 0x%04x\n", event->modifiers ); if (event->flags & DIEF_LOCKS) D_DEBUG_AT( Core_InputEvt, " -> LOCKS 0x%04x\n", event->locks ); if (event->flags & DIEF_BUTTONS) D_DEBUG_AT( Core_InputEvt, " -> BUTTONS 0x%04x\n", event->buttons ); if (event->flags & DIEF_GLOBAL) D_DEBUG_AT( Core_InputEvt, " -> GLOBAL\n" ); #endif /* * 1. Fixup event... */ event->clazz = DFEC_INPUT; event->device_id = device->shared->id; if (!(event->flags & DIEF_TIMESTAMP)) { gettimeofday( &event->timestamp, NULL ); event->flags |= DIEF_TIMESTAMP; } switch (event->type) { case DIET_BUTTONPRESS: case DIET_BUTTONRELEASE: D_DEBUG_AT( Core_InputEvt, " -> BUTTON 0x%04x\n", event->button ); if (dfb_config->lefty) { if (event->button == DIBI_LEFT) event->button = DIBI_RIGHT; else if (event->button == DIBI_RIGHT) event->button = DIBI_LEFT; D_DEBUG_AT( Core_InputEvt, " -> lefty! => 0x%04x <=\n", event->button ); } /* fallthru */ case DIET_AXISMOTION: fixup_mouse_event( device, event ); break; case DIET_KEYPRESS: case DIET_KEYRELEASE: if (dfb_config->capslock_meta) { if (device->shared->keymap.num_entries && (event->flags & DIEF_KEYCODE)) lookup_from_table( device, event, (DIEF_KEYID | DIEF_KEYSYMBOL) & ~event->flags ); if (event->key_id == DIKI_CAPS_LOCK || event->key_symbol == DIKS_CAPS_LOCK) { event->flags |= DIEF_KEYID | DIEF_KEYSYMBOL; event->key_code = -1; event->key_id = DIKI_META_L; event->key_symbol = DIKS_META; } } fixup_key_event( device, event ); break; default: ; } #if D_DEBUG_ENABLED if (event->flags & DIEF_TIMESTAMP) D_DEBUG_AT( Core_InputEvt, " => TIMESTAMP %lu.%06lu\n", event->timestamp.tv_sec, event->timestamp.tv_usec ); if (event->flags & DIEF_AXISABS) D_DEBUG_AT( Core_InputEvt, " => AXISABS %d at %d\n", event->axis, event->axisabs ); if (event->flags & DIEF_AXISREL) D_DEBUG_AT( Core_InputEvt, " => AXISREL %d by %d\n", event->axis, event->axisrel ); if (event->flags & DIEF_KEYCODE) D_DEBUG_AT( Core_InputEvt, " => KEYCODE %d\n", event->key_code ); if (event->flags & DIEF_KEYID) D_DEBUG_AT( Core_InputEvt, " => KEYID 0x%04x\n", event->key_id ); if (event->flags & DIEF_KEYSYMBOL) D_DEBUG_AT( Core_InputEvt, " => KEYSYMBOL 0x%04x\n", event->key_symbol ); if (event->flags & DIEF_MODIFIERS) D_DEBUG_AT( Core_InputEvt, " => MODIFIERS 0x%04x\n", event->modifiers ); if (event->flags & DIEF_LOCKS) D_DEBUG_AT( Core_InputEvt, " => LOCKS 0x%04x\n", event->locks ); if (event->flags & DIEF_BUTTONS) D_DEBUG_AT( Core_InputEvt, " => BUTTONS 0x%04x\n", event->buttons ); if (event->flags & DIEF_GLOBAL) D_DEBUG_AT( Core_InputEvt, " => GLOBAL\n" ); #endif if (core_input_filter( device, event )) D_DEBUG_AT( Core_InputEvt, " ****>> FILTERED\n" ); else fusion_reactor_dispatch( device->shared->reactor, event, true, dfb_input_globals ); } DFBInputDeviceID dfb_input_device_id( const CoreInputDevice *device ) { D_MAGIC_ASSERT( device, CoreInputDevice ); D_ASSERT( core_input != NULL ); D_ASSERT( device != NULL ); D_ASSERT( device->shared != NULL ); return device->shared->id; } CoreInputDevice * dfb_input_device_at( DFBInputDeviceID id ) { CoreInputDevice *device; D_ASSERT( core_input != NULL ); direct_list_foreach (device, core_local->devices) { D_MAGIC_ASSERT( device, CoreInputDevice ); if (device->shared->id == id) return device; } return NULL; } /* Get an input device's capabilities. */ DFBInputDeviceCapabilities dfb_input_device_caps( const CoreInputDevice *device ) { D_MAGIC_ASSERT( device, CoreInputDevice ); D_ASSERT( core_input != NULL ); D_ASSERT( device != NULL ); D_ASSERT( device->shared != NULL ); return device->shared->device_info.desc.caps; } void dfb_input_device_description( const CoreInputDevice *device, DFBInputDeviceDescription *desc ) { D_MAGIC_ASSERT( device, CoreInputDevice ); D_ASSERT( core_input != NULL ); D_ASSERT( device != NULL ); D_ASSERT( device->shared != NULL ); *desc = device->shared->device_info.desc; } DFBResult dfb_input_device_get_keymap_entry( CoreInputDevice *device, int keycode, DFBInputDeviceKeymapEntry *entry ) { DFBInputDeviceKeymapEntry *keymap_entry; D_MAGIC_ASSERT( device, CoreInputDevice ); D_ASSERT( core_input != NULL ); D_ASSERT( device != NULL ); D_ASSERT( entry != NULL ); keymap_entry = get_keymap_entry( device, keycode ); if (!keymap_entry) return DFB_FAILURE; *entry = *keymap_entry; return DFB_OK; } DFBResult dfb_input_device_set_keymap_entry( CoreInputDevice *device, int keycode, DFBInputDeviceKeymapEntry *entry ) { D_MAGIC_ASSERT( device, CoreInputDevice ); D_ASSERT( core_input != NULL ); D_ASSERT( device != NULL ); D_ASSERT( entry != NULL ); return set_keymap_entry( device, keycode, entry ); } DFBResult dfb_input_device_load_keymap ( CoreInputDevice *device, char *filename ) { D_MAGIC_ASSERT( device, CoreInputDevice ); D_ASSERT( core_input != NULL ); D_ASSERT( device != NULL ); D_ASSERT( filename != NULL ); return load_keymap( device, filename ); } DFBResult dfb_input_device_reload_keymap( CoreInputDevice *device ) { int ret; InputDeviceShared *shared; D_MAGIC_ASSERT( device, CoreInputDevice ); shared = device->shared; D_ASSERT( shared != NULL ); D_INFO( "DirectFB/Input: Reloading keymap for '%s' [0x%02x]...\n", shared->device_info.desc.name, shared->id ); if (fusion_call_execute( &shared->call, FCEF_NONE, CIDC_RELOAD_KEYMAP, NULL, &ret )) return DFB_FUSION; return ret; } /** internal **/ static void input_add_device( CoreInputDevice *device ) { D_DEBUG_AT( Core_Input, "%s( %p )\n", __FUNCTION__, device ); D_MAGIC_ASSERT( device, CoreInputDevice ); D_ASSERT( core_input != NULL ); D_ASSERT( device != NULL ); D_ASSERT( device->shared != NULL ); if (core_input->num == MAX_INPUTDEVICES) { D_ERROR( "DirectFB/Input: Maximum number of devices reached!\n" ); return; } direct_list_append( &core_local->devices, &device->link ); core_input->devices[ core_input->num++ ] = device->shared; } static void allocate_device_keymap( CoreDFB *core, CoreInputDevice *device ) { int i; DFBInputDeviceKeymapEntry *entries; FusionSHMPoolShared *pool = dfb_core_shmpool( core ); InputDeviceShared *shared = device->shared; DFBInputDeviceDescription *desc = &shared->device_info.desc; int num_entries = desc->max_keycode - desc->min_keycode + 1; D_DEBUG_AT( Core_Input, "%s( %p, %p )\n", __FUNCTION__, core, device ); D_MAGIC_ASSERT( device, CoreInputDevice ); D_ASSERT( core_input != NULL ); entries = SHCALLOC( pool, num_entries, sizeof(DFBInputDeviceKeymapEntry) ); if (!entries) { D_OOSHM(); return; } /* write -1 indicating entry is not fetched yet from driver */ for (i=0; i<num_entries; i++) entries[i].code = -1; shared->keymap.min_keycode = desc->min_keycode; shared->keymap.max_keycode = desc->max_keycode; shared->keymap.num_entries = num_entries; shared->keymap.entries = entries; #if FUSION_BUILD_MULTI /* we need to fetch the whole map, otherwise a slave would try to */ for (i=desc->min_keycode; i<=desc->max_keycode; i++) get_keymap_entry( device, i ); #endif } static int make_id( DFBInputDeviceID prefered ) { CoreInputDevice *device; D_DEBUG_AT( Core_Input, "%s( 0x%02x )\n", __FUNCTION__, prefered ); D_ASSERT( core_input != NULL ); direct_list_foreach (device, core_local->devices) { D_MAGIC_ASSERT( device, CoreInputDevice ); if (device->shared->id == prefered) return make_id( (prefered < DIDID_ANY) ? DIDID_ANY : (prefered + 1) ); } return prefered; } static DFBResult reload_keymap( CoreInputDevice *device ) { int i; InputDeviceShared *shared; D_DEBUG_AT( Core_Input, "%s( %p )\n", __FUNCTION__, device ); D_MAGIC_ASSERT( device, CoreInputDevice ); shared = device->shared; D_ASSERT( shared != NULL ); if (shared->device_info.desc.min_keycode < 0 || shared->device_info.desc.max_keycode < 0) return DFB_UNSUPPORTED; /* write -1 indicating entry is not fetched yet from driver */ for (i=0; i<shared->keymap.num_entries; i++) shared->keymap.entries[i].code = -1; /* fetch the whole map */ for (i=shared->keymap.min_keycode; i<=shared->keymap.max_keycode; i++) get_keymap_entry( device, i ); D_INFO( "DirectFB/Input: Reloaded keymap for '%s' [0x%02x]\n", shared->device_info.desc.name, shared->id ); return DFB_OK; } static FusionCallHandlerResult input_device_call_handler( int caller, /* fusion id of the caller */ int call_arg, /* optional call parameter */ void *call_ptr, /* optional call parameter */ void *ctx, /* optional handler context */ unsigned int serial, int *ret_val ) { CoreInputDeviceCommand command = call_arg; CoreInputDevice *device = ctx; D_DEBUG_AT( Core_Input, "%s( %d, %d, %p, %p )\n", __FUNCTION__, caller, call_arg, call_ptr, ctx ); D_MAGIC_ASSERT( device, CoreInputDevice ); switch (command) { case CIDC_RELOAD_KEYMAP: *ret_val = reload_keymap( device ); break; default: D_BUG( "unknown Core Input Device Command '%d'", command ); *ret_val = DFB_BUG; } return FCHR_RETURN; } static DFBResult init_axes( CoreInputDevice *device ) { int i, num; DFBResult ret; InputDeviceShared *shared; const InputDriverFuncs *funcs; D_DEBUG_AT( Core_Input, "%s( %p )\n", __FUNCTION__, device ); D_MAGIC_ASSERT( device, CoreInputDevice ); D_ASSERT( device->driver != NULL ); funcs = device->driver->funcs; D_ASSERT( funcs != NULL ); shared = device->shared; D_ASSERT( shared != NULL ); if (shared->device_info.desc.max_axis < 0) return DFB_OK; num = shared->device_info.desc.max_axis + 1; shared->axis_info = SHCALLOC( dfb_core_shmpool(device->core), num, sizeof(DFBInputDeviceAxisInfo) ); if (!shared->axis_info) return D_OOSHM(); shared->axis_num = num; if (funcs->GetAxisInfo) { for (i=0; i<num; i++) { ret = funcs->GetAxisInfo( device, device->driver_data, i, &shared->axis_info[i] ); if (ret) D_DERROR( ret, "Core/Input: GetAxisInfo() failed for '%s' [%d] on axis %d!\n", shared->device_info.desc.name, shared->id, i ); } } return DFB_OK; } static void init_devices( CoreDFB *core ) { DirectLink *next; DirectModuleEntry *module; FusionSHMPoolShared *pool = dfb_core_shmpool( core ); D_DEBUG_AT( Core_Input, "%s( %p )\n", __FUNCTION__, core ); D_ASSERT( core_input != NULL ); direct_list_foreach_safe (module, next, dfb_input_modules.entries) { int n; InputDriver *driver; const InputDriverFuncs *funcs; InputDriverCapability driver_cap; DFBResult result; driver_cap = IDC_NONE; funcs = direct_module_ref( module ); if (!funcs) continue; driver = D_CALLOC( 1, sizeof(InputDriver) ); if (!driver) { D_OOM(); direct_module_unref( module ); continue; } D_ASSERT( funcs->GetDriverInfo != NULL ); funcs->GetDriverInfo( &driver->info ); D_DEBUG_AT( Core_Input, " -> probing '%s'...\n", driver->info.name ); driver->nr_devices = funcs->GetAvailable(); /* * If the input provider supports hot-plug, always load the module. */ if (!funcs->GetCapability) { D_DEBUG_AT(Core_Input, "InputDriverFuncs::GetCapability is NULL\n"); } else { driver_cap = funcs->GetCapability(); } if (!driver->nr_devices && !(driver_cap & IDC_HOTPLUG)) { direct_module_unref( module ); D_FREE( driver ); continue; } D_DEBUG_AT( Core_Input, " -> %d available device(s) provided by '%s'.\n", driver->nr_devices, driver->info.name ); driver->module = module; driver->funcs = funcs; direct_list_prepend( &core_local->drivers, &driver->link ); for (n=0; n<driver->nr_devices; n++) { char buf[128]; CoreInputDevice *device; InputDeviceInfo device_info; InputDeviceShared *shared; void *driver_data; device = D_CALLOC( 1, sizeof(CoreInputDevice) ); if (!device) { D_OOM(); continue; } shared = SHCALLOC( pool, 1, sizeof(InputDeviceShared) ); if (!shared) { D_OOSHM(); D_FREE( device ); continue; } device->core = core; memset( &device_info, 0, sizeof(InputDeviceInfo) ); device_info.desc.min_keycode = -1; device_info.desc.max_keycode = -1; D_MAGIC_SET( device, CoreInputDevice ); if (funcs->OpenDevice( device, n, &device_info, &driver_data )) { SHFREE( pool, shared ); D_MAGIC_CLEAR( device ); D_FREE( device ); continue; } D_DEBUG_AT( Core_Input, " -> opened '%s' (%d) %d.%d (%s)\n", device_info.desc.name, n + 1, driver->info.version.major, driver->info.version.minor, driver->info.vendor ); if (driver->nr_devices > 1) snprintf( buf, sizeof(buf), "%s (%d)", device_info.desc.name, n+1 ); else snprintf( buf, sizeof(buf), "%s", device_info.desc.name ); /* init skirmish */ fusion_skirmish_init( &shared->lock, buf, dfb_core_world(core) ); /* create reactor */ shared->reactor = fusion_reactor_new( sizeof(DFBInputEvent), buf, dfb_core_world(core) ); fusion_reactor_set_lock( shared->reactor, &shared->lock ); /* init call */ fusion_call_init( &shared->call, input_device_call_handler, device, dfb_core_world(core) ); /* initialize shared data */ shared->id = make_id(device_info.prefered_id); shared->num = n; shared->device_info = device_info; shared->last_key = DIKI_UNKNOWN; shared->first_press = true; /* initialize local data */ device->shared = shared; device->driver = driver; device->driver_data = driver_data; D_INFO( "DirectFB/Input: %s %d.%d (%s)\n", buf, driver->info.version.major, driver->info.version.minor, driver->info.vendor ); #if FUSION_BUILD_MULTI /* Initialize the ref between shared device and local device. */ snprintf( buf, sizeof(buf), "Ref of input device(%d)", shared->id ); fusion_ref_init( &shared->ref, buf, dfb_core_world(core) ); /* Increase reference counter. */ fusion_ref_up( &shared->ref, true ); #endif if (device_info.desc.min_keycode > device_info.desc.max_keycode) { D_BUG("min_keycode > max_keycode"); device_info.desc.min_keycode = -1; device_info.desc.max_keycode = -1; } else if (device_info.desc.min_keycode >= 0 && device_info.desc.max_keycode >= 0) allocate_device_keymap( core, device ); init_axes( device ); /* add it to the list */ input_add_device( device ); } /* * If the driver supports hot-plug, launch its hot-plug thread to respond to * hot-plug events. Failures in launching the hot-plug thread will only * result in no hot-plug feature being available. */ if (driver_cap == IDC_HOTPLUG) { result = funcs->LaunchHotplug(core, (void*) driver); /* On failure, the input provider can still be used without hot-plug. */ if (result) { D_INFO( "DirectFB/Input: Failed to enable hot-plug " "detection with %s\n ", driver->info.name); } else { D_INFO( "DirectFB/Input: Hot-plug detection enabled with %s \n", driver->info.name); } } } } /* * Create the DFB shared core input device, add the input device into the * local device list and shared dev array and broadcast the hot-plug in * message to all slaves. */ DFBResult dfb_input_create_device(int device_index, CoreDFB *core_in, void *driver_in) { char buf[128]; CoreInputDevice *device; InputDeviceInfo device_info; InputDeviceShared *shared; void *driver_data; InputDriver *driver = NULL; const InputDriverFuncs *funcs; FusionSHMPoolShared *pool; DFBResult result; D_DEBUG_AT(Core_Input, "Enter: %s()\n", __FUNCTION__); driver = (InputDriver *)driver_in; pool = dfb_core_shmpool(core_in); funcs = driver->funcs; if (!funcs) { D_ERROR("DirectFB/Input: driver->funcs is NULL\n"); goto errorExit; } device = D_CALLOC( 1, sizeof(CoreInputDevice) ); if (!device) { D_OOM(); goto errorExit; } shared = SHCALLOC( pool, 1, sizeof(InputDeviceShared) ); if (!shared) { D_OOM(); D_FREE( device ); goto errorExit; } device->core = core_in; memset( &device_info, 0, sizeof(InputDeviceInfo) ); device_info.desc.min_keycode = -1; device_info.desc.max_keycode = -1; D_MAGIC_SET( device, CoreInputDevice ); if (funcs->OpenDevice( device, device_index, &device_info, &driver_data )) { SHFREE( pool, shared ); D_MAGIC_CLEAR( device ); D_FREE( device ); D_DEBUG_AT( Core_Input, "DirectFB/Input: Cannot open device in %s, at %d in %s\n", __FUNCTION__, __LINE__, __FILE__); goto errorExit; } snprintf( buf, sizeof(buf), "%s (%d)", device_info.desc.name, device_index); /* init skirmish */ result = fusion_skirmish_init( &shared->lock, buf, dfb_core_world(device->core) ); if (result) { funcs->CloseDevice( driver_data ); SHFREE( pool, shared ); D_MAGIC_CLEAR( device ); D_FREE( device ); D_ERROR("DirectFB/Input: fusion_skirmish_init() failed! in %s, at %d in %s\n", __FUNCTION__, __LINE__, __FILE__); goto errorExit; } /* create reactor */ shared->reactor = fusion_reactor_new( sizeof(DFBInputEvent), buf, dfb_core_world(device->core) ); if (!shared->reactor) { funcs->CloseDevice( driver_data ); SHFREE( pool, shared ); D_MAGIC_CLEAR( device ); D_FREE( device ); fusion_skirmish_destroy(&shared->lock); D_ERROR("DirectFB/Input: fusion_reactor_new() failed! in %s, at %d in %s\n", __FUNCTION__, __LINE__, __FILE__); goto errorExit; } fusion_reactor_set_lock( shared->reactor, &shared->lock ); /* init call */ fusion_call_init( &shared->call, input_device_call_handler, device, dfb_core_world(device->core) ); /* initialize shared data */ shared->id = make_id(device_info.prefered_id); shared->num = device_index; shared->device_info = device_info; shared->last_key = DIKI_UNKNOWN; shared->first_press = true; /* initialize local data */ device->shared = shared; device->driver = driver; device->driver_data = driver_data; D_INFO( "DirectFB/Input: %s %d.%d (%s)\n", buf, driver->info.version.major, driver->info.version.minor, driver->info.vendor ); #if FUSION_BUILD_MULTI snprintf( buf, sizeof(buf), "Ref of input device(%d)", shared->id); fusion_ref_init( &shared->ref, buf, dfb_core_world(core_in)); fusion_ref_up( &shared->ref, true ); #endif if (device_info.desc.min_keycode > device_info.desc.max_keycode) { D_BUG("min_keycode > max_keycode"); device_info.desc.min_keycode = -1; device_info.desc.max_keycode = -1; } else if (device_info.desc.min_keycode >= 0 && device_info.desc.max_keycode >= 0) allocate_device_keymap( device->core, device ); /* add it into local device list and shared dev array */ D_DEBUG_AT(Core_Input, "In master, add a new device with dev_id=%d\n", shared->id); input_add_device( device ); driver->nr_devices++; D_DEBUG_AT(Core_Input, "Successfully added new input device with dev_id=%d in shared array\n", shared->id); InputDeviceHotplugEvent message; /* Setup the hot-plug in message. */ message.is_plugin = true; message.dev_id = shared->id; gettimeofday (&message.stamp, NULL); /* Send the hot-plug in message */ #if FUSION_BUILD_MULTI fusion_reactor_dispatch(core_input->reactor, &message, true, NULL); #else local_processing_hotplug((const void *) &message, (void*) core_in); #endif return DFB_OK; errorExit: return DFB_FAILURE; } /* * Tell whether the DFB input device handling of the system input device * indicated by device_index is already created. */ static CoreInputDevice * search_device_created(int device_index, void *driver_in) { DirectLink *n; CoreInputDevice *device; D_ASSERT(driver_in != NULL); direct_list_foreach_safe(device, n, core_local->devices) { if (device->driver != driver_in) continue; if (device->driver_data == NULL) { D_DEBUG_AT(Core_Input, "The device %d has been closed!\n", device->shared->id); return NULL; } if (device->driver->funcs->IsCreated && !device->driver->funcs->IsCreated(device_index, device->driver_data)) { return device; } } return NULL; } /* * Remove the DFB shared core input device handling of the system input device * indicated by device_index and broadcast the hot-plug out message to all slaves. */ DFBResult dfb_input_remove_device(int device_index, void *driver_in) { CoreInputDevice *device; InputDeviceShared *shared; FusionSHMPoolShared *pool; int i; int found = 0; int device_id; D_DEBUG_AT(Core_Input, "Enter: %s()\n", __FUNCTION__); D_ASSERT(driver_in !=NULL); device = search_device_created(device_index, driver_in); if (device == NULL) { D_DEBUG_AT(Core_Input, "DirectFB/input: Failed to find the device[%d] or the device is " "closed.\n", device_index); goto errorExit; } shared = device->shared; pool = dfb_core_shmpool( device->core ); device_id = shared->id; D_DEBUG_AT(Core_Input, "Find the device with dev_id=%d\n", device_id); device->driver->funcs->CloseDevice( device->driver_data ); device->driver->nr_devices--; InputDeviceHotplugEvent message; /* Setup the hot-plug out message */ message.is_plugin = false; message.dev_id = device_id; gettimeofday (&message.stamp, NULL); /* Send the hot-plug out message */ #if FUSION_BUILD_MULTI fusion_reactor_dispatch( core_input->reactor, &message, true, NULL); int loop = CHECK_NUMBER; while (--loop) { if (fusion_ref_zero_trylock( &device->shared->ref ) == DR_OK) { fusion_ref_unlock(&device->shared->ref); break; } usleep(CHECK_INTERVAL); } if (!loop) D_DEBUG_AT(Core_Input, "Shared device might be connected to by others\n"); fusion_ref_destroy(&device->shared->ref); #else local_processing_hotplug((const void*) &message, (void*) device->core); #endif /* Remove the device from shared array */ for (i = 0; i < core_input->num; i++) { if (!found && (core_input->devices[i]->id == shared->id)) found = 1; if (found) core_input->devices[i] = core_input->devices[(i + 1) % MAX_INPUTDEVICES]; } if (found) core_input->devices[core_input->num -1] = NULL; core_input->num--; fusion_call_destroy( &shared->call ); fusion_skirmish_destroy( &shared->lock ); fusion_reactor_free( shared->reactor ); if (shared->keymap.entries) SHFREE( pool, shared->keymap.entries ); SHFREE( pool, shared ); D_DEBUG_AT(Core_Input, "Successfully remove the device with dev_id=%d in shared array\n", device_id); return DFB_OK; errorExit: return DFB_FAILURE; } /* * Create local input device and add it into the local input devices list. */ static CoreInputDevice * add_device_into_local_list(int dev_id) { int i; D_DEBUG_AT(Core_Input, "Enter: %s()\n", __FUNCTION__); for (i = 0; i < core_input->num; i++) { if (core_input->devices[i]->id == dev_id) { CoreInputDevice *device; D_DEBUG_AT(Core_Input, "Find the device with dev_id=%d in shared array, and " "allocate local device\n", dev_id); device = D_CALLOC( 1, sizeof(CoreInputDevice) ); if (!device) { return NULL; } device->shared = core_input->devices[i]; #if FUSION_BUILD_MULTI /* Increase the reference counter. */ fusion_ref_up( &device->shared->ref, true ); #endif /* add it to the list */ direct_list_append( &core_local->devices, &device->link ); D_MAGIC_SET( device, CoreInputDevice ); return device; } } return NULL; } /* * Local input device function that handles hot-plug in/out messages. */ static ReactionResult local_processing_hotplug( const void *msg_data, void *ctx ) { const InputDeviceHotplugEvent *message = msg_data; CoreInputDevice *device = NULL; D_DEBUG_AT(Core_Input, "Enter: %s()\n", __FUNCTION__); D_DEBUG_AT(Core_Input, "<PID:%6d> hotplug-in:%d device_id=%d message!\n", getpid(), message->is_plugin, message->dev_id ); if (message->is_plugin) { device = dfb_input_device_at(message->dev_id); if (!device){ /* Update local device list according to shared devices array */ if (!(device = add_device_into_local_list(message->dev_id))) { D_ERROR("DirectFB/Input: update_local_devices_list() failed\n" ); goto errorExit; } } /* attach the device to event containers */ containers_attach_device( device ); /* attach the device to stack containers */ stack_containers_attach_device( device ); } else { device = dfb_input_device_at(message->dev_id); if (device) { direct_list_remove(&core_local->devices, &device->link); containers_detach_device(device); stack_containers_detach_device(device); #if FUSION_BUILD_MULTI /* Decrease reference counter. */ fusion_ref_down( &device->shared->ref, true ); #endif D_MAGIC_CLEAR( device ); D_FREE(device); } else D_ERROR("DirectFB/Input:Can't find the device to be removed!\n"); } return DFB_OK; errorExit: return DFB_FAILURE; } static DFBInputDeviceKeymapEntry * get_keymap_entry( CoreInputDevice *device, int code ) { InputDeviceKeymap *map; DFBInputDeviceKeymapEntry *entry; D_MAGIC_ASSERT( device, CoreInputDevice ); D_ASSERT( core_input != NULL ); D_ASSERT( device != NULL ); D_ASSERT( device->shared != NULL ); map = &device->shared->keymap; /* safety check */ if (code < map->min_keycode || code > map->max_keycode) return NULL; /* point to right array index */ entry = &map->entries[code - map->min_keycode]; /* need to initialize? */ if (entry->code != code) { DFBResult ret; InputDriver *driver = device->driver; if (!driver) { D_BUG("seem to be a slave with an empty keymap"); return NULL; } /* write keycode to entry */ entry->code = code; /* fetch entry from driver */ ret = driver->funcs->GetKeymapEntry( device, device->driver_data, entry ); if (ret) return NULL; /* drivers may leave this blank */ if (entry->identifier == DIKI_UNKNOWN) entry->identifier = symbol_to_id( entry->symbols[DIKSI_BASE] ); if (entry->symbols[DIKSI_BASE_SHIFT] == DIKS_NULL) entry->symbols[DIKSI_BASE_SHIFT] = entry->symbols[DIKSI_BASE]; if (entry->symbols[DIKSI_ALT] == DIKS_NULL) entry->symbols[DIKSI_ALT] = entry->symbols[DIKSI_BASE]; if (entry->symbols[DIKSI_ALT_SHIFT] == DIKS_NULL) entry->symbols[DIKSI_ALT_SHIFT] = entry->symbols[DIKSI_ALT]; } return entry; } /* replace a single keymap entry with the code-entry pair */ static DFBResult set_keymap_entry( CoreInputDevice *device, int code, DFBInputDeviceKeymapEntry *entry ) { InputDeviceKeymap *map; D_ASSERT( device->shared != NULL ); D_ASSERT( device->shared->keymap.entries != NULL ); map = &device->shared->keymap; /* sanity check */ if (code < map->min_keycode || code > map->max_keycode) return DFB_FAILURE; /* copy the entry to the map */ map->entries[code - map->min_keycode] = *entry; return DFB_OK; } /* replace the complete current keymap with a keymap from a file. * the minimum-maximum keycodes of the driver are to be respected. */ static DFBResult load_keymap( CoreInputDevice *device, char *filename ) { DFBResult ret = DFB_OK; InputDeviceKeymap *map = 0; FILE *file = 0; DFBInputDeviceLockState lockstate = 0; D_ASSERT( device->shared != NULL ); D_ASSERT( device->shared->keymap.entries != NULL ); map = &device->shared->keymap; /* open the file */ file = fopen( filename, "r" ); if( !file ) { return errno2result( errno ); } /* read the file, line by line, and consume the mentioned scancodes */ while(1) { int i; int dummy; char buffer[201]; int keycode; char diki[201]; char diks[4][201]; char *b; DFBInputDeviceKeymapEntry entry = { .code = 0 }; b = fgets( buffer, 200, file ); if( !b ) { if( feof(file) ) { fclose(file); return DFB_OK; } fclose(file); return errno2result(errno); } /* comment or empty line */ if( buffer[0]=='#' || strcmp(buffer,"\n")==0 ) continue; /* check for lock state change */ if( !strncmp(buffer,"capslock:",9) ) { lockstate |= DILS_CAPS; continue; } if( !strncmp(buffer,":capslock",9) ) { lockstate &= ~DILS_CAPS; continue; } if( !strncmp(buffer,"numlock:",8) ) { lockstate |= DILS_NUM; continue; } if( !strncmp(buffer,":numlock",8) ) { lockstate &= ~DILS_NUM; continue; } i = sscanf( buffer, " keycode %i = %s = %s %s %s %s %i\n", &keycode, diki, diks[0], diks[1], diks[2], diks[3], &dummy ); if( i < 3 || i > 6 ) { /* we want 1 to 4 key symbols */ D_INFO( "DirectFB/Input: skipped erroneous input line %s\n", buffer ); continue; } if( keycode > map->max_keycode || keycode < map->min_keycode ) { D_INFO( "DirectFB/Input: skipped keycode %d out of range\n", keycode ); continue; } entry.code = keycode; entry.locks = lockstate; entry.identifier = lookup_keyidentifier( diki ); switch( i ) { case 6: entry.symbols[3] = lookup_keysymbol( diks[3] ); case 5: entry.symbols[2] = lookup_keysymbol( diks[2] ); case 4: entry.symbols[1] = lookup_keysymbol( diks[1] ); case 3: entry.symbols[0] = lookup_keysymbol( diks[0] ); /* fall through */ } switch( i ) { case 3: entry.symbols[1] = entry.symbols[0]; case 4: entry.symbols[2] = entry.symbols[0]; case 5: entry.symbols[3] = entry.symbols[1]; /* fall through */ } ret = set_keymap_entry( device, keycode, &entry ); if( ret ) return ret; } } static DFBInputDeviceKeySymbol lookup_keysymbol( char *symbolname ) { int i; /* we want uppercase */ for( i=0; i<strlen(symbolname); i++ ) if( symbolname[i] >= 'a' && symbolname[i] <= 'z' ) symbolname[i] = symbolname[i] - 'a' + 'A'; for( i=0; i < sizeof (KeySymbolNames) / sizeof (KeySymbolNames[0]); i++ ) { if( strcmp( symbolname, KeySymbolNames[i].name ) == 0 ) return KeySymbolNames[i].symbol; } /* not found, maybe starting with 0x for raw conversion. * We are already at uppercase. */ if( symbolname[0]=='0' && symbolname[1]=='X' ) { int code=0; symbolname+=2; while(*symbolname) { if( *symbolname >= '0' && *symbolname <= '9' ) { code = code*16 + *symbolname - '0'; } else if( *symbolname >= 'A' && *symbolname <= 'F' ) { code = code*16 + *symbolname - 'A' + 10; } else { /* invalid character */ return DIKS_NULL; } symbolname++; } return code; } return DIKS_NULL; } static DFBInputDeviceKeyIdentifier lookup_keyidentifier( char *identifiername ) { int i; /* we want uppercase */ for( i=0; i<strlen(identifiername); i++ ) if( identifiername[i] >= 'a' && identifiername[i] <= 'z' ) identifiername[i] = identifiername[i] - 'a' + 'A'; for( i=0; i < sizeof (KeyIdentifierNames) / sizeof (KeyIdentifierNames[0]); i++ ) { if( strcmp( identifiername, KeyIdentifierNames[i].name ) == 0 ) return KeyIdentifierNames[i].identifier; } return DIKI_UNKNOWN; } static bool lookup_from_table( CoreInputDevice *device, DFBInputEvent *event, DFBInputEventFlags lookup ) { DFBInputDeviceKeymapEntry *entry; D_MAGIC_ASSERT( device, CoreInputDevice ); D_ASSERT( core_input != NULL ); D_ASSERT( device != NULL ); D_ASSERT( device->shared != NULL ); D_ASSERT( event != NULL ); /* fetch the entry from the keymap, possibly calling the driver */ entry = get_keymap_entry( device, event->key_code ); if (!entry) return false; /* lookup identifier */ if (lookup & DIEF_KEYID) event->key_id = entry->identifier; /* lookup symbol */ if (lookup & DIEF_KEYSYMBOL) { DFBInputDeviceKeymapSymbolIndex index = (event->modifiers & DIMM_ALTGR) ? DIKSI_ALT : DIKSI_BASE; if ((event->modifiers & DIMM_SHIFT) || (entry->locks & event->locks)) index++; /* don't modify modifiers */ if (DFB_KEY_TYPE( entry->symbols[DIKSI_BASE] ) == DIKT_MODIFIER) event->key_symbol = entry->symbols[DIKSI_BASE]; else event->key_symbol = entry->symbols[index]; } return true; } static int find_key_code_by_id( CoreInputDevice *device, DFBInputDeviceKeyIdentifier id ) { int i; InputDeviceKeymap *map; D_MAGIC_ASSERT( device, CoreInputDevice ); D_ASSERT( core_input != NULL ); D_ASSERT( device != NULL ); D_ASSERT( device->shared != NULL ); map = &device->shared->keymap; for (i=0; i<map->num_entries; i++) { DFBInputDeviceKeymapEntry *entry = &map->entries[i]; if (entry->identifier == id) return entry->code; } return -1; } static int find_key_code_by_symbol( CoreInputDevice *device, DFBInputDeviceKeySymbol symbol ) { int i; InputDeviceKeymap *map; D_MAGIC_ASSERT( device, CoreInputDevice ); D_ASSERT( core_input != NULL ); D_ASSERT( device != NULL ); D_ASSERT( device->shared != NULL ); map = &device->shared->keymap; for (i=0; i<map->num_entries; i++) { int n; DFBInputDeviceKeymapEntry *entry = &map->entries[i]; for (n=0; n<=DIKSI_LAST; n++) if (entry->symbols[n] == symbol) return entry->code; } return -1; } #define FIXUP_KEY_FIELDS (DIEF_MODIFIERS | DIEF_LOCKS | \ DIEF_KEYCODE | DIEF_KEYID | DIEF_KEYSYMBOL) /* * Fill partially missing values for key_code, key_id and key_symbol by * translating those that are set. Fix modifiers/locks before if not set. * * * There are five valid constellations that give reasonable values. * (not counting the constellation where everything is set) * * Device has no translation table * 1. key_id is set, key_symbol not * -> key_code defaults to -1, key_symbol from key_id (up-translation) * 2. key_symbol is set, key_id not * -> key_code defaults to -1, key_id from key_symbol (down-translation) * * Device has a translation table * 3. key_code is set * -> look up key_id and/or key_symbol (key_code being the index) * 4. key_id is set * -> look up key_code and possibly key_symbol (key_id being searched for) * 5. key_symbol is set * -> look up key_code and key_id (key_symbol being searched for) * * Fields remaining will be set to the default, e.g. key_code to -1. */ static void fixup_key_event( CoreInputDevice *device, DFBInputEvent *event ) { int i; DFBInputEventFlags valid = event->flags & FIXUP_KEY_FIELDS; DFBInputEventFlags missing = valid ^ FIXUP_KEY_FIELDS; InputDeviceShared *shared = device->shared; D_MAGIC_ASSERT( device, CoreInputDevice ); /* Add missing flags */ event->flags |= missing; /* * Use cached values for modifiers/locks if they are missing. */ if (missing & DIEF_MODIFIERS) event->modifiers = shared->modifiers_l | shared->modifiers_r; if (missing & DIEF_LOCKS) event->locks = shared->locks; /* * With translation table */ if (device->shared->keymap.num_entries) { if (valid & DIEF_KEYCODE) { lookup_from_table( device, event, missing ); missing &= ~(DIEF_KEYID | DIEF_KEYSYMBOL); } else if (valid & DIEF_KEYID) { event->key_code = find_key_code_by_id( device, event->key_id ); if (event->key_code != -1) { lookup_from_table( device, event, missing ); missing &= ~(DIEF_KEYCODE | DIEF_KEYSYMBOL); } else if (missing & DIEF_KEYSYMBOL) { event->key_symbol = id_to_symbol( event->key_id, event->modifiers, event->locks ); missing &= ~DIEF_KEYSYMBOL; } } else if (valid & DIEF_KEYSYMBOL) { event->key_code = find_key_code_by_symbol( device, event->key_symbol ); if (event->key_code != -1) { lookup_from_table( device, event, missing ); missing &= ~(DIEF_KEYCODE | DIEF_KEYID); } else { event->key_id = symbol_to_id( event->key_symbol ); missing &= ~DIEF_KEYSYMBOL; } } } else { /* * Without translation table */ if (valid & DIEF_KEYID) { if (missing & DIEF_KEYSYMBOL) { event->key_symbol = id_to_symbol( event->key_id, event->modifiers, event->locks ); missing &= ~DIEF_KEYSYMBOL; } } else if (valid & DIEF_KEYSYMBOL) { event->key_id = symbol_to_id( event->key_symbol ); missing &= ~DIEF_KEYID; } } /* * Clear remaining fields. */ if (missing & DIEF_KEYCODE) event->key_code = -1; if (missing & DIEF_KEYID) event->key_id = DIKI_UNKNOWN; if (missing & DIEF_KEYSYMBOL) event->key_symbol = DIKS_NULL; /* * Update cached values for modifiers. */ if (DFB_KEY_TYPE(event->key_symbol) == DIKT_MODIFIER) { if (event->type == DIET_KEYPRESS) { switch (event->key_id) { case DIKI_SHIFT_L: shared->modifiers_l |= DIMM_SHIFT; break; case DIKI_SHIFT_R: shared->modifiers_r |= DIMM_SHIFT; break; case DIKI_CONTROL_L: shared->modifiers_l |= DIMM_CONTROL; break; case DIKI_CONTROL_R: shared->modifiers_r |= DIMM_CONTROL; break; case DIKI_ALT_L: shared->modifiers_l |= DIMM_ALT; break; case DIKI_ALT_R: shared->modifiers_r |= (event->key_symbol == DIKS_ALTGR) ? DIMM_ALTGR : DIMM_ALT; break; case DIKI_META_L: shared->modifiers_l |= DIMM_META; break; case DIKI_META_R: shared->modifiers_r |= DIMM_META; break; case DIKI_SUPER_L: shared->modifiers_l |= DIMM_SUPER; break; case DIKI_SUPER_R: shared->modifiers_r |= DIMM_SUPER; break; case DIKI_HYPER_L: shared->modifiers_l |= DIMM_HYPER; break; case DIKI_HYPER_R: shared->modifiers_r |= DIMM_HYPER; break; default: ; } } else { switch (event->key_id) { case DIKI_SHIFT_L: shared->modifiers_l &= ~DIMM_SHIFT; break; case DIKI_SHIFT_R: shared->modifiers_r &= ~DIMM_SHIFT; break; case DIKI_CONTROL_L: shared->modifiers_l &= ~DIMM_CONTROL; break; case DIKI_CONTROL_R: shared->modifiers_r &= ~DIMM_CONTROL; break; case DIKI_ALT_L: shared->modifiers_l &= ~DIMM_ALT; break; case DIKI_ALT_R: shared->modifiers_r &= (event->key_symbol == DIKS_ALTGR) ? ~DIMM_ALTGR : ~DIMM_ALT; break; case DIKI_META_L: shared->modifiers_l &= ~DIMM_META; break; case DIKI_META_R: shared->modifiers_r &= ~DIMM_META; break; case DIKI_SUPER_L: shared->modifiers_l &= ~DIMM_SUPER; break; case DIKI_SUPER_R: shared->modifiers_r &= ~DIMM_SUPER; break; case DIKI_HYPER_L: shared->modifiers_l &= ~DIMM_HYPER; break; case DIKI_HYPER_R: shared->modifiers_r &= ~DIMM_HYPER; break; default: ; } } /* write back to event */ if (missing & DIEF_MODIFIERS) event->modifiers = shared->modifiers_l | shared->modifiers_r; } /* * Update cached values for locks. */ if (event->type == DIET_KEYPRESS) { /* When we receive a new key press, toggle lock flags */ if (shared->first_press || shared->last_key != event->key_id) { switch (event->key_id) { case DIKI_CAPS_LOCK: shared->locks ^= DILS_CAPS; break; case DIKI_NUM_LOCK: shared->locks ^= DILS_NUM; break; case DIKI_SCROLL_LOCK: shared->locks ^= DILS_SCROLL; break; default: ; } } /* write back to event */ if (missing & DIEF_LOCKS) event->locks = shared->locks; /* store last pressed key */ shared->last_key = event->key_id; shared->first_press = false; } else if (event->type == DIET_KEYRELEASE) { shared->first_press = true; } /* Handle dead keys. */ if (DFB_KEY_TYPE(shared->last_symbol) == DIKT_DEAD) { for (i=0; i<D_ARRAY_SIZE(deadkey_maps); i++) { const DeadKeyMap *map = &deadkey_maps[i]; if (map->deadkey == shared->last_symbol) { for (i=0; map->combos[i].target; i++) { if (map->combos[i].target == event->key_symbol) { event->key_symbol = map->combos[i].result; break; } } break; } } if (event->type == DIET_KEYRELEASE && DFB_KEY_TYPE(event->key_symbol) != DIKT_MODIFIER) shared->last_symbol = event->key_symbol; } else shared->last_symbol = event->key_symbol; } static void fixup_mouse_event( CoreInputDevice *device, DFBInputEvent *event ) { InputDeviceShared *shared = device->shared; D_MAGIC_ASSERT( device, CoreInputDevice ); if (event->flags & DIEF_BUTTONS) { shared->buttons = event->buttons; } else { switch (event->type) { case DIET_BUTTONPRESS: shared->buttons |= (1 << event->button); break; case DIET_BUTTONRELEASE: shared->buttons &= ~(1 << event->button); break; default: ; } /* Add missing flag */ event->flags |= DIEF_BUTTONS; event->buttons = shared->buttons; } switch (event->type) { case DIET_AXISMOTION: if ((event->flags & DIEF_AXISABS) && event->axis >= 0 && event->axis < shared->axis_num) { if (!(event->flags & DIEF_MIN) && (shared->axis_info[event->axis].flags & DIAIF_ABS_MIN)) { event->min = shared->axis_info[event->axis].abs_min; event->flags |= DIEF_MIN; } if (!(event->flags & DIEF_MAX) && (shared->axis_info[event->axis].flags & DIAIF_ABS_MAX)) { event->max = shared->axis_info[event->axis].abs_max; event->flags |= DIEF_MAX; } } break; default: break; } } static DFBInputDeviceKeyIdentifier symbol_to_id( DFBInputDeviceKeySymbol symbol ) { if (symbol >= 'a' && symbol <= 'z') return DIKI_A + symbol - 'a'; if (symbol >= 'A' && symbol <= 'Z') return DIKI_A + symbol - 'A'; if (symbol >= '0' && symbol <= '9') return DIKI_0 + symbol - '0'; if (symbol >= DIKS_F1 && symbol <= DIKS_F12) return DIKI_F1 + symbol - DIKS_F1; switch (symbol) { case DIKS_ESCAPE: return DIKI_ESCAPE; case DIKS_CURSOR_LEFT: return DIKI_LEFT; case DIKS_CURSOR_RIGHT: return DIKI_RIGHT; case DIKS_CURSOR_UP: return DIKI_UP; case DIKS_CURSOR_DOWN: return DIKI_DOWN; case DIKS_ALTGR: return DIKI_ALT_R; case DIKS_CONTROL: return DIKI_CONTROL_L; case DIKS_SHIFT: return DIKI_SHIFT_L; case DIKS_ALT: return DIKI_ALT_L; case DIKS_META: return DIKI_META_L; case DIKS_SUPER: return DIKI_SUPER_L; case DIKS_HYPER: return DIKI_HYPER_L; case DIKS_TAB: return DIKI_TAB; case DIKS_ENTER: return DIKI_ENTER; case DIKS_SPACE: return DIKI_SPACE; case DIKS_BACKSPACE: return DIKI_BACKSPACE; case DIKS_INSERT: return DIKI_INSERT; case DIKS_DELETE: return DIKI_DELETE; case DIKS_HOME: return DIKI_HOME; case DIKS_END: return DIKI_END; case DIKS_PAGE_UP: return DIKI_PAGE_UP; case DIKS_PAGE_DOWN: return DIKI_PAGE_DOWN; case DIKS_CAPS_LOCK: return DIKI_CAPS_LOCK; case DIKS_NUM_LOCK: return DIKI_NUM_LOCK; case DIKS_SCROLL_LOCK: return DIKI_SCROLL_LOCK; case DIKS_PRINT: return DIKI_PRINT; case DIKS_PAUSE: return DIKI_PAUSE; case DIKS_BACKSLASH: return DIKI_BACKSLASH; case DIKS_PERIOD: return DIKI_PERIOD; case DIKS_COMMA: return DIKI_COMMA; default: ; } return DIKI_UNKNOWN; } static DFBInputDeviceKeySymbol id_to_symbol( DFBInputDeviceKeyIdentifier id, DFBInputDeviceModifierMask modifiers, DFBInputDeviceLockState locks ) { bool shift = (modifiers & DIMM_SHIFT) || (locks & DILS_CAPS); if (id >= DIKI_A && id <= DIKI_Z) return (shift ? DIKS_CAPITAL_A : DIKS_SMALL_A) + id - DIKI_A; if (id >= DIKI_0 && id <= DIKI_9) return DIKS_0 + id - DIKI_0; if (id >= DIKI_KP_0 && id <= DIKI_KP_9) return DIKS_0 + id - DIKI_KP_0; if (id >= DIKI_F1 && id <= DIKI_F12) return DIKS_F1 + id - DIKI_F1; switch (id) { case DIKI_ESCAPE: return DIKS_ESCAPE; case DIKI_LEFT: return DIKS_CURSOR_LEFT; case DIKI_RIGHT: return DIKS_CURSOR_RIGHT; case DIKI_UP: return DIKS_CURSOR_UP; case DIKI_DOWN: return DIKS_CURSOR_DOWN; case DIKI_CONTROL_L: case DIKI_CONTROL_R: return DIKS_CONTROL; case DIKI_SHIFT_L: case DIKI_SHIFT_R: return DIKS_SHIFT; case DIKI_ALT_L: case DIKI_ALT_R: return DIKS_ALT; case DIKI_META_L: case DIKI_META_R: return DIKS_META; case DIKI_SUPER_L: case DIKI_SUPER_R: return DIKS_SUPER; case DIKI_HYPER_L: case DIKI_HYPER_R: return DIKS_HYPER; case DIKI_TAB: return DIKS_TAB; case DIKI_ENTER: return DIKS_ENTER; case DIKI_SPACE: return DIKS_SPACE; case DIKI_BACKSPACE: return DIKS_BACKSPACE; case DIKI_INSERT: return DIKS_INSERT; case DIKI_DELETE: return DIKS_DELETE; case DIKI_HOME: return DIKS_HOME; case DIKI_END: return DIKS_END; case DIKI_PAGE_UP: return DIKS_PAGE_UP; case DIKI_PAGE_DOWN: return DIKS_PAGE_DOWN; case DIKI_CAPS_LOCK: return DIKS_CAPS_LOCK; case DIKI_NUM_LOCK: return DIKS_NUM_LOCK; case DIKI_SCROLL_LOCK: return DIKS_SCROLL_LOCK; case DIKI_PRINT: return DIKS_PRINT; case DIKI_PAUSE: return DIKS_PAUSE; case DIKI_KP_DIV: return DIKS_SLASH; case DIKI_KP_MULT: return DIKS_ASTERISK; case DIKI_KP_MINUS: return DIKS_MINUS_SIGN; case DIKI_KP_PLUS: return DIKS_PLUS_SIGN; case DIKI_KP_ENTER: return DIKS_ENTER; case DIKI_KP_SPACE: return DIKS_SPACE; case DIKI_KP_TAB: return DIKS_TAB; case DIKI_KP_EQUAL: return DIKS_EQUALS_SIGN; case DIKI_KP_DECIMAL: return DIKS_PERIOD; case DIKI_KP_SEPARATOR: return DIKS_COMMA; case DIKI_BACKSLASH: return DIKS_BACKSLASH; case DIKI_EQUALS_SIGN: return DIKS_EQUALS_SIGN; case DIKI_LESS_SIGN: return DIKS_LESS_THAN_SIGN; case DIKI_MINUS_SIGN: return DIKS_MINUS_SIGN; case DIKI_PERIOD: return DIKS_PERIOD; case DIKI_QUOTE_LEFT: case DIKI_QUOTE_RIGHT: return DIKS_QUOTATION; case DIKI_SEMICOLON: return DIKS_SEMICOLON; case DIKI_SLASH: return DIKS_SLASH; default: ; } return DIKS_NULL; } static void release_key( CoreInputDevice *device, DFBInputDeviceKeyIdentifier id ) { DFBInputEvent evt; D_MAGIC_ASSERT( device, CoreInputDevice ); evt.type = DIET_KEYRELEASE; if (DFB_KEY_TYPE(id) == DIKT_IDENTIFIER) { evt.flags = DIEF_KEYID; evt.key_id = id; } else { evt.flags = DIEF_KEYSYMBOL; evt.key_symbol = id; } dfb_input_dispatch( device, &evt ); } static void flush_keys( CoreInputDevice *device ) { D_MAGIC_ASSERT( device, CoreInputDevice ); if (device->shared->modifiers_l) { if (device->shared->modifiers_l & DIMM_ALT) release_key( device, DIKI_ALT_L ); if (device->shared->modifiers_l & DIMM_CONTROL) release_key( device, DIKI_CONTROL_L ); if (device->shared->modifiers_l & DIMM_HYPER) release_key( device, DIKI_HYPER_L ); if (device->shared->modifiers_l & DIMM_META) release_key( device, DIKI_META_L ); if (device->shared->modifiers_l & DIMM_SHIFT) release_key( device, DIKI_SHIFT_L ); if (device->shared->modifiers_l & DIMM_SUPER) release_key( device, DIKI_SUPER_L ); } if (device->shared->modifiers_r) { if (device->shared->modifiers_r & DIMM_ALTGR) release_key( device, DIKS_ALTGR ); if (device->shared->modifiers_r & DIMM_ALT) release_key( device, DIKI_ALT_R ); if (device->shared->modifiers_r & DIMM_CONTROL) release_key( device, DIKI_CONTROL_R ); if (device->shared->modifiers_r & DIMM_HYPER) release_key( device, DIKI_HYPER_R ); if (device->shared->modifiers_r & DIMM_META) release_key( device, DIKI_META_R ); if (device->shared->modifiers_r & DIMM_SHIFT) release_key( device, DIKI_SHIFT_R ); if (device->shared->modifiers_r & DIMM_SUPER) release_key( device, DIKI_SUPER_R ); } } static void dump_primary_layer_surface( CoreDFB *core ) { CoreLayer *layer = dfb_layer_at( DLID_PRIMARY ); CoreLayerContext *context; /* Get the currently active context. */ if (dfb_layer_get_active_context( layer, &context ) == DFB_OK) { CoreLayerRegion *region; /* Get the first region. */ if (dfb_layer_context_get_primary_region( context, false, &region ) == DFB_OK) { CoreSurface *surface; /* Lock the region to avoid tearing due to concurrent updates. */ dfb_layer_region_lock( region ); /* Get the surface of the region. */ if (dfb_layer_region_get_surface( region, &surface ) == DFB_OK) { /* Dump the surface contents. */ dfb_surface_dump_buffer( surface, CSBR_FRONT, dfb_config->screenshot_dir, "dfb" ); /* Release the surface. */ dfb_surface_unref( surface ); } /* Unlock the region. */ dfb_layer_region_unlock( region ); /* Release the region. */ dfb_layer_region_unref( region ); } /* Release the context. */ dfb_layer_context_unref( context ); } } static bool core_input_filter( CoreInputDevice *device, DFBInputEvent *event ) { D_MAGIC_ASSERT( device, CoreInputDevice ); if (dfb_system_input_filter( device, event )) return true; if (event->type == DIET_KEYPRESS) { switch (event->key_symbol) { case DIKS_PRINT: if (!event->modifiers && dfb_config->screenshot_dir) { dump_primary_layer_surface( device->core ); return true; } break; case DIKS_BACKSPACE: if (event->modifiers == DIMM_META) direct_trace_print_stacks(); break; case DIKS_ESCAPE: if (event->modifiers == DIMM_META) { #if FUSION_BUILD_MULTI DFBResult ret; CoreLayer *layer = dfb_layer_at( DLID_PRIMARY ); CoreLayerContext *context; /* Get primary (shared) context. */ ret = dfb_layer_get_primary_context( layer, false, &context ); if (ret) return false; /* Activate the context. */ dfb_layer_activate_context( layer, context ); /* Release the context. */ dfb_layer_context_unref( context ); #else kill( 0, SIGINT ); #endif return true; } break; default: break; } } return false; }
lgpl-2.1
joansmith/orbeon-forms
src/main/scala/org/orbeon/oxf/xforms/analysis/model/Instance.scala
9815
/** * Copyright (C) 2010 Orbeon, Inc. * * This program is free software; you can redistribute it and/or modify it under the terms of the * GNU Lesser General Public License as published by the Free Software Foundation; either version * 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * The full text of the license is available at http://www.gnu.org/copyleft/lesser.html */ package org.orbeon.oxf.xforms.analysis.model import org.dom4j.{Document, Element, QName} import org.orbeon.oxf.common.{ValidationException, Version} import org.orbeon.oxf.http.Credentials import org.orbeon.oxf.processor.ProcessorImpl import org.orbeon.oxf.util.ScalaUtils.{CodePointsOps, stringOptionToSet} import org.orbeon.oxf.util.{Logging, NetUtils, XPath} import org.orbeon.oxf.xforms.XFormsConstants._ import org.orbeon.oxf.xforms.analysis.controls.ComponentControl import org.orbeon.oxf.xforms.analysis.{ElementAnalysis, SimpleElementAnalysis, StaticStateContext} import org.orbeon.oxf.xforms.model.InstanceDataOps import org.orbeon.oxf.xforms.xbl.Scope import org.orbeon.oxf.xml.dom4j.{Dom4jUtils, ExtendedLocationData} import org.orbeon.oxf.xml.{Dom4j, TransformerUtils} import org.orbeon.saxon.dom4j.{DocumentWrapper, TypedDocumentWrapper} import org.orbeon.saxon.om.DocumentInfo import scala.collection.JavaConverters._ /** * Static analysis of an XForms instance. */ class Instance( staticStateContext : StaticStateContext, element : Element, parent : Option[ElementAnalysis], preceding : Option[ElementAnalysis], scope : Scope ) extends SimpleElementAnalysis( staticStateContext, element, parent, preceding, scope ) with InstanceMetadata with Logging { def partExposeXPathTypes = part.isExposeXPathTypes override def extendedLocationData = new ExtendedLocationData( locationData, Some("processing XForms instance"), List("id" → staticId), Option(element) ) // Get constant inline content from AbstractBinding if possible, otherwise extract from element. // Doing so allows for sharing of constant instances globally, among uses of an AbstractBinding and among multiple // instances of a given form. This is useful in particular for component i18n resource instances. def inlineContent = { // An instance within xf:implementation has a ComponentControl grandparent def componentForConstantInstances = if (readonly && useInlineContent) parent.get.parent collect { case component: ComponentControl ⇒ component } else None componentForConstantInstances map { component ⇒ val modelIndex = ElementAnalysis.precedingSiblingIterator(parent.get) count (_.localName == "model") val instanceIndex = ElementAnalysis.precedingSiblingIterator(this) count (_.localName == "instance") debug("getting readonly inline instance from abstract binding", Seq( "model id" → parent.get.staticId, "instance id" → staticId, "scope id" → component.binding.innerScope.scopeId, "binding name" → component.binding.abstractBinding.debugBindingName, "model index" → modelIndex.toString, "instance index" → instanceIndex.toString)) // Delegate to AbstractBinding component.binding.abstractBinding.constantInstances((modelIndex, instanceIndex)) } getOrElse extractInlineContent } } // Used to gather instance metadata from AbstractBinding class ThrowawayInstance(val element: Element) extends InstanceMetadata { def extendedLocationData = ElementAnalysis.createLocationData(element) def partExposeXPathTypes = false def inlineContent = extractInlineContent } // Separate trait that can also be used by AbstractBinding to extract instance metadata trait InstanceMetadata { def element: Element def partExposeXPathTypes: Boolean def extendedLocationData: ExtendedLocationData import ElementAnalysis._ import Instance._ val readonly = element.attributeValue(XXFORMS_READONLY_ATTRIBUTE_QNAME) == "true" val cache = Version.instance.isPEFeatureEnabled(element.attributeValue(XXFORMS_CACHE_QNAME) == "true", "cached XForms instance") val timeToLive = Instance.timeToLiveOrDefault(element) val handleXInclude = false // lazy because depends on property, which depends on top-level model being set in XFormsStaticStateImpl! lazy val exposeXPathTypes = Option(element.attributeValue(XXFORMS_EXPOSE_XPATH_TYPES_QNAME)) map (_ == "true") getOrElse ! readonly && partExposeXPathTypes val (indexIds, indexClasses) = { val tokens = attSet(element, XXFORMS_INDEX_QNAME) (tokens("id"), tokens("class")) } private val validation = element.attributeValue(XXFORMS_VALIDATION_QNAME) def isLaxValidation = (validation eq null) || validation == "lax" def isStrictValidation = validation == "strict" def isSchemaValidation = isLaxValidation || isStrictValidation val credentialsOrNull = { // NOTE: AVTs not supported because XPath expressions in those could access instances that haven't been loaded def username = element.attributeValue(XXFORMS_USERNAME_QNAME) def password = element.attributeValue(XXFORMS_PASSWORD_QNAME) def preemptiveAuth = element.attributeValue(XXFORMS_PREEMPTIVE_AUTHENTICATION_QNAME) def domain = element.attributeValue(XXFORMS_DOMAIN_QNAME) Option(username) map (Credentials(_, password, preemptiveAuth, domain)) orNull } val excludeResultPrefixes = stringOptionToSet(Option(element.attributeValue(XXFORMS_EXCLUDE_RESULT_PREFIXES))) // Inline root element if any private val root = Dom4j.elements(element) headOption private def hasInlineContent = root.isDefined // Create inline instance document if any def inlineContent: DocumentInfo // Extract the inline content into a new document (mutable or not) protected def extractInlineContent = extractDocument(root.get, excludeResultPrefixes, readonly, exposeXPathTypes, removeInstanceData = false) // Don't allow more than one child element if (Dom4j.elements(element).size > 1) throw new ValidationException("xf:instance must contain at most one child element", extendedLocationData) private def getAttributeEncode(qName: QName) = Option(element.attributeValue(qName)) map (att ⇒ NetUtils.encodeHRRI(att.trimAllToEmpty, true)) private def src = getAttributeEncode(SRC_QNAME) private def resource = getAttributeEncode(RESOURCE_QNAME) // @src always wins, @resource always loses val useInlineContent = src.isEmpty && hasInlineContent val useExternalContent = src.isDefined || ! hasInlineContent && resource.isDefined val (instanceSource, dependencyURL) = (if (useInlineContent) None else src orElse resource) match { case someSource @ Some(source) if ProcessorImpl.isProcessorOutputScheme(source) ⇒ someSource → None // input:* doesn't add a URL dependency, but is handled by the pipeline engine case someSource @ Some(_) ⇒ someSource → someSource case _ ⇒ None → None } // Don't allow a blank src attribute if (useExternalContent && instanceSource.contains("")) throw new ValidationException("xf:instance must not specify a blank URL", extendedLocationData) } object Instance { def timeToLiveOrDefault(element: Element) = { val timeToLiveValue = element.attributeValue(XXFORMS_TIME_TO_LIVE_QNAME) Option(timeToLiveValue) map (_.toLong) getOrElse -1L } // Extract the document starting at the given root element // This always creates a copy of the original sub-tree // // @readonly if true, the document returned is a compact TinyTree, otherwise a DocumentWrapper // @exposeXPathTypes if true, use a TypedDocumentWrapper def extractDocument( element : Element, excludeResultPrefixes : Set[String], readonly : Boolean, exposeXPathTypes : Boolean, removeInstanceData : Boolean ): DocumentInfo = { require(! (readonly && exposeXPathTypes)) // we can't expose types on readonly instances at the moment // Extract a document and adjust namespaces if requested // NOTE: Should implement exactly as per XSLT 2.0 // NOTE: Should implement namespace fixup, the code below can break serialization def extractDocument = excludeResultPrefixes match { case prefixes if prefixes("#all") ⇒ // Special #all Dom4jUtils.createDocumentCopyElement(element) case prefixes if prefixes.nonEmpty ⇒ // List of prefixes Dom4jUtils.createDocumentCopyParentNamespaces(element, prefixes.asJava) case _ ⇒ // No exclusion Dom4jUtils.createDocumentCopyParentNamespaces(element) } if (readonly) TransformerUtils.dom4jToTinyTree(XPath.GlobalConfiguration, extractDocument, false) else wrapDocument( if (removeInstanceData) InstanceDataOps.removeRecursively(extractDocument) else extractDocument, exposeXPathTypes ) } def wrapDocument(document: Document, exposeXPathTypes: Boolean): DocumentWrapper = if (exposeXPathTypes) new TypedDocumentWrapper( Dom4jUtils.normalizeTextNodes(document).asInstanceOf[Document], null, XPath.GlobalConfiguration ) else new DocumentWrapper( Dom4jUtils.normalizeTextNodes(document).asInstanceOf[Document], null, XPath.GlobalConfiguration ) }
lgpl-2.1
kobolabs/qt-everywhere-4.8.0
src/3rdparty/webkit/Source/WebCore/epub/EPubCaseElement.h
386
#ifndef EPubCaseElement_h #define EPubCaseElement_h #include "epubElement.h" namespace WebCore { class EPubCaseElement : public epubElement { public: static PassRefPtr<EPubCaseElement> create(const QualifiedName&, Document*); void finishParsingChildren(); private: EPubCaseElement(const QualifiedName&, Document*); }; } // namespace WebCore #endif // EPubCaseElement_h
lgpl-2.1
qmlc/qtdeclarative
src/quick/items/qquickrectangle.cpp
14735
/**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtQuick module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional ** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "qquickrectangle_p.h" #include "qquickrectangle_p_p.h" #include <QtQuick/private/qsgcontext_p.h> #include <private/qsgadaptationlayer_p.h> #include <QtGui/qpixmapcache.h> #include <QtCore/qstringbuilder.h> #include <QtCore/qmath.h> #include <QtCore/qmetaobject.h> QT_BEGIN_NAMESPACE // XXX todo - should we change rectangle to draw entirely within its width/height? /*! \internal \class QQuickPen \brief For specifying a pen used for drawing rectangle borders on a QQuickView By default, the pen is invalid and nothing is drawn. You must either set a color (then the default width is 1) or a width (then the default color is black). A width of 1 indicates is a single-pixel line on the border of the item being painted. Example: \qml Rectangle { border.width: 2 border.color: "red" } \endqml */ QQuickPen::QQuickPen(QObject *parent) : QObject(parent) , m_width(1) , m_color("#000000") , m_aligned(true) , m_valid(false) { } qreal QQuickPen::width() const { return m_width; } void QQuickPen::setWidth(qreal w) { if (m_width == w && m_valid) return; m_width = w; m_valid = m_color.alpha() && (qRound(m_width) >= 1 || (!m_aligned && m_width > 0)); emit penChanged(); } QColor QQuickPen::color() const { return m_color; } void QQuickPen::setColor(const QColor &c) { m_color = c; m_valid = m_color.alpha() && (qRound(m_width) >= 1 || (!m_aligned && m_width > 0)); emit penChanged(); } bool QQuickPen::pixelAligned() const { return m_aligned; } void QQuickPen::setPixelAligned(bool aligned) { if (aligned == m_aligned) return; m_aligned = aligned; m_valid = m_color.alpha() && (qRound(m_width) >= 1 || (!m_aligned && m_width > 0)); emit penChanged(); } bool QQuickPen::isValid() const { return m_valid; } /*! \qmltype GradientStop \instantiates QQuickGradientStop \inqmlmodule QtQuick \ingroup qtquick-visual-utility \brief Defines the color at a position in a Gradient \sa Gradient */ /*! \qmlproperty real QtQuick::GradientStop::position \qmlproperty color QtQuick::GradientStop::color The position and color properties describe the color used at a given position in a gradient, as represented by a gradient stop. The default position is 0.0; the default color is black. \sa Gradient */ QQuickGradientStop::QQuickGradientStop(QObject *parent) : QObject(parent) { } qreal QQuickGradientStop::position() const { return m_position; } void QQuickGradientStop::setPosition(qreal position) { m_position = position; updateGradient(); } QColor QQuickGradientStop::color() const { return m_color; } void QQuickGradientStop::setColor(const QColor &color) { m_color = color; updateGradient(); } void QQuickGradientStop::updateGradient() { if (QQuickGradient *grad = qobject_cast<QQuickGradient*>(parent())) grad->doUpdate(); } /*! \qmltype Gradient \instantiates QQuickGradient \inqmlmodule QtQuick \ingroup qtquick-visual-utility \brief Defines a gradient fill A gradient is defined by two or more colors, which will be blended seamlessly. The colors are specified as a set of GradientStop child items, each of which defines a position on the gradient from 0.0 to 1.0 and a color. The position of each GradientStop is defined by setting its \l{GradientStop::}{position} property; its color is defined using its \l{GradientStop::}{color} property. A gradient without any gradient stops is rendered as a solid white fill. Note that this item is not a visual representation of a gradient. To display a gradient, use a visual item (like \l Rectangle) which supports the use of gradients. \section1 Example Usage \div {class="float-right"} \inlineimage qml-gradient.png \enddiv The following example declares a \l Rectangle item with a gradient starting with red, blending to yellow at one third of the height of the rectangle, and ending with green: \snippet qml/gradient.qml code \clearfloat \section1 Performance and Limitations Calculating gradients can be computationally expensive compared to the use of solid color fills or images. Consider using gradients for static items in a user interface. In Qt 5.0, only vertical, linear gradients can be applied to items. If you need to apply different orientations of gradients, a combination of rotation and clipping will need to be applied to the relevant items. This can introduce additional performance requirements for your application. The use of animations involving gradient stops may not give the desired result. An alternative way to animate gradients is to use pre-generated images or SVG drawings containing gradients. \sa GradientStop */ /*! \qmlproperty list<GradientStop> QtQuick::Gradient::stops \default This property holds the gradient stops describing the gradient. By default, this property contains an empty list. To set the gradient stops, define them as children of the Gradient. */ QQuickGradient::QQuickGradient(QObject *parent) : QObject(parent) { } QQuickGradient::~QQuickGradient() { } QQmlListProperty<QQuickGradientStop> QQuickGradient::stops() { return QQmlListProperty<QQuickGradientStop>(this, m_stops); } QGradientStops QQuickGradient::gradientStops() const { QGradientStops stops; for (int i = 0; i < m_stops.size(); ++i){ int j = 0; while (j < stops.size() && stops.at(j).first < m_stops[i]->position()) j++; stops.insert(j, QGradientStop(m_stops.at(i)->position(), m_stops.at(i)->color())); } return stops; } void QQuickGradient::doUpdate() { emit updated(); } int QQuickRectanglePrivate::doUpdateSlotIdx = -1; /*! \qmltype Rectangle \instantiates QQuickRectangle \inqmlmodule QtQuick \inherits Item \ingroup qtquick-visual \brief Paints a filled rectangle with an optional border Rectangle items are used to fill areas with solid color or gradients, and/or to provide a rectangular border. \section1 Appearance Each Rectangle item is painted using either a solid fill color, specified using the \l color property, or a gradient, defined using a Gradient type and set using the \l gradient property. If both a color and a gradient are specified, the gradient is used. You can add an optional border to a rectangle with its own color and thickness by setting the \l border.color and \l border.width properties. Set the color to "transparent" to paint a border without a fill color. You can also create rounded rectangles using the \l radius property. Since this introduces curved edges to the corners of a rectangle, it may be appropriate to set the \l Item::antialiasing property to improve its appearance. \section1 Example Usage \div {class="float-right"} \inlineimage declarative-rect.png \enddiv The following example shows the effects of some of the common properties on a Rectangle item, which in this case is used to create a square: \snippet qml/rectangle/rectangle.qml document \clearfloat \section1 Performance Using the \l Item::antialiasing property improves the appearance of a rounded rectangle at the cost of rendering performance. You should consider unsetting this property for rectangles in motion, and only set it when they are stationary. \sa Image */ QQuickRectangle::QQuickRectangle(QQuickItem *parent) : QQuickItem(*(new QQuickRectanglePrivate), parent) { setFlag(ItemHasContents); } void QQuickRectangle::doUpdate() { update(); } /*! \qmlproperty bool QtQuick::Rectangle::antialiasing Used to decide if the Rectangle should use antialiasing or not. \l {Antialiasing} provides information on the performance implications of this property. The default is true for Rectangles with a radius, and false otherwise. */ /*! \qmlpropertygroup QtQuick::Rectangle::border \qmlproperty int QtQuick::Rectangle::border.width \qmlproperty color QtQuick::Rectangle::border.color The width and color used to draw the border of the rectangle. A width of 1 creates a thin line. For no line, use a width of 0 or a transparent color. \note The width of the rectangle's border does not affect the geometry of the rectangle itself or its position relative to other items if anchors are used. The border is rendered within the rectangle's boundaries. */ QQuickPen *QQuickRectangle::border() { Q_D(QQuickRectangle); return d->getPen(); } /*! \qmlproperty Gradient QtQuick::Rectangle::gradient The gradient to use to fill the rectangle. This property allows for the construction of simple vertical gradients. Other gradients may by formed by adding rotation to the rectangle. \div {class="float-left"} \inlineimage declarative-rect_gradient.png \enddiv \snippet qml/rectangle/rectangle-gradient.qml rectangles \clearfloat If both a gradient and a color are specified, the gradient will be used. \sa Gradient, color */ QQuickGradient *QQuickRectangle::gradient() const { Q_D(const QQuickRectangle); return d->gradient; } void QQuickRectangle::setGradient(QQuickGradient *gradient) { Q_D(QQuickRectangle); if (d->gradient == gradient) return; static int updatedSignalIdx = -1; if (updatedSignalIdx < 0) updatedSignalIdx = QMetaMethod::fromSignal(&QQuickGradient::updated).methodIndex(); if (d->doUpdateSlotIdx < 0) d->doUpdateSlotIdx = QQuickRectangle::staticMetaObject.indexOfSlot("doUpdate()"); if (d->gradient) QMetaObject::disconnect(d->gradient, updatedSignalIdx, this, d->doUpdateSlotIdx); d->gradient = gradient; if (d->gradient) QMetaObject::connect(d->gradient, updatedSignalIdx, this, d->doUpdateSlotIdx); update(); } void QQuickRectangle::resetGradient() { setGradient(0); } /*! \qmlproperty real QtQuick::Rectangle::radius This property holds the corner radius used to draw a rounded rectangle. If radius is non-zero, the rectangle will be painted as a rounded rectangle, otherwise it will be painted as a normal rectangle. The same radius is used by all 4 corners; there is currently no way to specify different radii for different corners. */ qreal QQuickRectangle::radius() const { Q_D(const QQuickRectangle); return d->radius; } void QQuickRectangle::setRadius(qreal radius) { Q_D(QQuickRectangle); if (d->radius == radius) return; d->radius = radius; d->setImplicitAntialiasing(radius != 0.0); update(); emit radiusChanged(); } /*! \qmlproperty color QtQuick::Rectangle::color This property holds the color used to fill the rectangle. The default color is white. \div {class="float-right"} \inlineimage rect-color.png \enddiv The following example shows rectangles with colors specified using hexadecimal and named color notation: \snippet qml/rectangle/rectangle-colors.qml rectangles \clearfloat If both a gradient and a color are specified, the gradient will be used. \sa gradient */ QColor QQuickRectangle::color() const { Q_D(const QQuickRectangle); return d->color; } void QQuickRectangle::setColor(const QColor &c) { Q_D(QQuickRectangle); if (d->color == c) return; d->color = c; update(); emit colorChanged(); } QSGNode *QQuickRectangle::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data) { Q_UNUSED(data); Q_D(QQuickRectangle); if (width() <= 0 || height() <= 0 || (d->color.alpha() == 0 && (!d->pen || d->pen->width() == 0 || d->pen->color().alpha() == 0))) { delete oldNode; return 0; } QSGRectangleNode *rectangle = static_cast<QSGRectangleNode *>(oldNode); if (!rectangle) rectangle = d->sceneGraphContext()->createRectangleNode(); rectangle->setRect(QRectF(0, 0, width(), height())); rectangle->setColor(d->color); if (d->pen && d->pen->isValid()) { rectangle->setPenColor(d->pen->color()); rectangle->setPenWidth(d->pen->width()); rectangle->setAligned(d->pen->pixelAligned()); } else { rectangle->setPenWidth(0); } rectangle->setRadius(d->radius); rectangle->setAntialiasing(antialiasing()); QGradientStops stops; if (d->gradient) { stops = d->gradient->gradientStops(); } rectangle->setGradientStops(stops); rectangle->update(); return rectangle; } QT_END_NAMESPACE
lgpl-2.1
aloubyansky/wildfly-core
testsuite/standalone/src/test/java/org/jboss/as/test/integration/management/cli/JBossCliXmlValidationTestCase.java
4132
/* * JBoss, Home of Professional Open Source. * Copyright 2014, Red Hat, Inc., and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.as.test.integration.management.cli; import java.io.File; import java.net.URL; import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import javax.xml.validation.Validator; import org.jboss.as.test.shared.TestSuiteEnvironment; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; import org.junit.Test; import org.w3c.dom.Document; import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; /** * * @author Dominik Pospisil <dpospisi@redhat.com> */ public class JBossCliXmlValidationTestCase { @Test public void validateJBossCliXmlTestCase() throws Exception { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); DocumentBuilder parser = factory.newDocumentBuilder(); final String jbossDist = TestSuiteEnvironment.getSystemProperty("jboss.dist"); Document document = parser.parse(new File(jbossDist, "bin/jboss-cli.xml")); SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); schemaFactory.setErrorHandler(new ErrorHandlerImpl()); //schemaFactory.setResourceResolver(new XMLResourceResolver()); Schema schema = schemaFactory.newSchema(resourceToURL("schema/wildfly-cli_3_4.xsd")); Validator validator = schema.newValidator(); validator.validate(new DOMSource(document)); } protected static final class ErrorHandlerImpl implements ErrorHandler { @Override public void error(SAXParseException e) throws SAXException { fail(formatMessage(e)); } @Override public void fatalError(SAXParseException e) throws SAXException { fail(formatMessage(e)); } @Override public void warning(SAXParseException e) throws SAXException { System.out.println(formatMessage(e)); } private String formatMessage(SAXParseException e) { StringBuffer sb = new StringBuffer(); sb.append(e.getLineNumber()).append(':').append(e.getColumnNumber()); if (e.getPublicId() != null) sb.append(" publicId='").append(e.getPublicId()).append('\''); if (e.getSystemId() != null) sb.append(" systemId='").append(e.getSystemId()).append('\''); sb.append(' ').append(e.getLocalizedMessage()); sb.append(" a possible cause may be that a subsystem is not using the most up to date schema."); return sb.toString(); } } private URL resourceToURL(final String name) { final ClassLoader classLoader = getClass().getClassLoader(); final URL resource = classLoader.getResource(name); assertNotNull("Can't locate resource " + name + " on " + classLoader, resource); return resource; } }
lgpl-2.1
umjinsun12/dngshin
m.layouts/flatLayout/css_color/gVtoPink.css
4976
/* baskcground color */ .member-menu-top .profile-image, .member-menu-logged ul, .flatBoard .login-wrap, .m-element .notice-list li .notice-text, .m-imagenews .info span.category, .swiper-active-switch, .m-ranking .rank-num {background-color: #7371b4;} /* @mCol */ .btDark, .flatMember .btSubmit, .flatBoard .btSubmit, .login-body .btLogin, .lang-list {background-color: #32323f} /* @sCol */ header.main, .main-logo, .login-wrap, .member-header-wrap, .main-image-wrap, .main-normal-image {background: -webkit-gradient(linear, left top, right top, from(#d17ca6), to(#7371b4)); background: -webkit-linear-gradient(left, #7371b4, #d17ca6);} .sc header.main{ background-image: url('../images/bgScan_top.png'), -webkit-gradient(linear, left top, right top, from(#d17ca6), to(#7371b4)); background-image: url('../images/bgScan_top.png'), -webkit-linear-gradient(left, #7371b4, #d17ca6); background-size: auto; } .sc .login-wrap, .sc .member-header-wrap, .sc .main-normal-image, .sc .main-logo{ background-image: url('../images/bgScan.png'), -webkit-gradient(linear, left top, right top, from(#d17ca6), to(#7371b4)); background-image: url('../images/bgScan.png'), -webkit-linear-gradient(left, #7371b4, #d17ca6); background-size: auto; } .sc2 header.main{ background-image: url('../images/bgScan2_top.png'), -webkit-gradient(linear, left top, right top, from(#d17ca6), to(#7371b4)); background-image: url('../images/bgScan2_top.png'), -webkit-linear-gradient(left, #7371b4, #d17ca6); background-size: auto; } .sc2 .login-wrap, .sc2 .member-header-wrap, .sc2 .main-normal-image, .sc2 .main-logo{ background-image: url('../images/bgScan2.png'), -webkit-gradient(linear, left top, right top, from(#d17ca6), to(#7371b4)); background-image: url('../images/bgScan2.png'), -webkit-linear-gradient(left, #7371b4, #d17ca6); background-size: auto; } .m-element nav ul, .m-element section h3, .member-header ul {background: -webkit-gradient(linear, left top, right top, from(#a76385), to(#5e5890)); background: -webkit-linear-gradient(left, #5e5890, #a76385);} .read-control li:not(.comment-num) a, .read-control li:not(.comment-num) button {background-color: #d17ca6;}/* g right */ .global-search .btClose, .read-control .num2 span {background-color: #a76385}/* g right d */ .member-menu-top, .m-imagenews .info span.name {background-color: #6a63a2}/* g left */ .main-search button {background-color: #000; opacity: 0.4;} /* border color */ .member-menu-top a.btLogin {border-right: 1px solid #5f5990;} /* @mCol_line */ .member-menu-logged li {border-bottom: 1px solid #6a68a5;} /* @mCol_line */ input[type="text"]:focus, input[type="email"]:focus, input[type="url"]:focus, input[type="file"]:focus, input[type="password"]:focus, textarea:focus {border: 1px solid #7371b4;} /* @mCol */ .lang-list:after {border-color: #32323f transparent} /* @sCol */ .member-header .profile-image {box-shadow: 0px 0px 0px 1px rgba(0,0,0,0.2);} .searchinput2 {box-shadow: 0px 0px 0px 8px rgba(0,0,0,0.4);} .gnb li ul li a.selected {border-left: 5px solid #7371b4;} /* font color */ .flatMember em, .read-control li.comment-num .num, .write-form em, .gnb li ul li ul li.selected {color: #7371b4 !important;} /* @mCol */ .category-list em {color: #d17ca6;}/* g right */ header.main h1, .global-search .btClose, .member-menu-top a, .member-menu-top .name, .flatMember .btSubmit, .flatBoard .btSubmit, .read-control .num2 span, .m-element .notice-list li .notice-text, .member-top-title, .top-title {color: #FFF;} /* @mCol_l */ .member-menu-logged li a, .social-login h2, .main-search button {color: #FFF;} /* @mCol_l2 */ .m-list-reply {color: #344d62;} /* @sCol_l3 */ .login-body .btLogin, .btDark, .lang-list li button {color: #c7d0dd;} /* @sCol_l */ .m-element nav a, .member-header .member-menu li a {color: #FFF; opacity: 0.4;} /* @sCol_l2 */ .m-element nav li.active a, .m-element section h3 span, .member-header .member-menu li a.active {color: #FFF; opacity: 0.8;} /* etc */ .login-body, .signup-body, .find-body, .flatBoard .origin-body, .flatBoard .message-body {box-shadow: 0 0 10px rgba(0,0,0,0.2); -moz-box-shadow: 0 0 10px rgba(0,0,0,0.2); -webkit-box-shadow: 0 0 10px rgba(0,0,0,0.2);} /* pad color */ @media screen and (min-width: 768px){ .leftCol .m-element nav ul, .leftCol .m-element section h3 {background: -webkit-gradient(linear, left top, right top, from(#825f8a), to(#5e5890)); background: -webkit-linear-gradient(left, #5e5890, #825f8a);} .rightCol .m-element nav ul, .rightCol .m-element section h3 {background: -webkit-gradient(linear, left top, right top, from(#a76385), to(#825f8a)); background: -webkit-linear-gradient(left, #825f8a, #a76385);} } /* phone color */ @media screen and (max-width: 767px){ /* board comment */ .comment-control li span {background-color: #8e8cc0; border-bottom: 1px solid #7371b4;} /* mCol_l2 */ .comment-control li span.im {background-color: #7371b4; border-bottom: 1px solid #6a68a5;} /* @mCol_line */ }
lgpl-2.1
certik/libmesh
src/quadrature/quadrature_clough_2D.C
2537
// The libMesh Finite Element Library. // Copyright (C) 2002-2012 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Local includes #include "quadrature_clough.h" #include "quadrature_gauss.h" namespace libMesh { void QClough::init_2D(const ElemType _type, unsigned int p) { #if LIBMESH_DIM > 1 QGauss gauss_rule(2, _order); gauss_rule.init(TRI6, p); //----------------------------------------------------------------------- // 2D quadrature rules switch (_type) { //--------------------------------------------- // Triangle quadrature rules case TRI3: case TRI6: { std::vector<Point> &gausspoints = gauss_rule.get_points(); std::vector<Real> &gaussweights = gauss_rule.get_weights(); unsigned int numgausspts = gausspoints.size(); _points.resize(numgausspts*3); _weights.resize(numgausspts*3); for (unsigned int i = 0; i != numgausspts; ++i) { _points[3*i](0) = gausspoints[i](0) + gausspoints[i](1) / 3.; _points[3*i](1) = gausspoints[i](1) / 3.; _points[3*i+1](0) = gausspoints[i](1) / 3.; _points[3*i+1](1) = gausspoints[i](0) + gausspoints[i](1) / 3.; _points[3*i+2](0) = 1./3. + gausspoints[i](0) * 2./3. - gausspoints[i](1) / 3.; _points[3*i+2](1) = 1./3. - gausspoints[i](0) / 3. + gausspoints[i](1) * 2./3.; _weights[3*i] = gaussweights[i] / 3.; _weights[3*i+1] = _weights[3*i]; _weights[3*i+2] = _weights[3*i]; } return; } //--------------------------------------------- // Unsupported type default: { libMesh::err << "Element type not supported!:" << _type << std::endl; libmesh_error(); } } libmesh_error(); return; #endif } } // namespace libMesh
lgpl-2.1
1fechner/FeatureExtractor
sources/FeatureExtractor/lib/hibernate-release-5.1.0.Final/project/hibernate-spatial/src/test/java/org/hibernate/spatial/testing/dialects/h2geodb/GeoDBNoSRIDExpectationsFactory.java
8367
/* * Hibernate, Relational Persistence for Idiomatic Java * * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. */ /** * */ package org.hibernate.spatial.testing.dialects.h2geodb; import org.hibernate.spatial.testing.AbstractExpectationsFactory; import org.hibernate.spatial.testing.NativeSQLStatement; import com.vividsolutions.jts.geom.Geometry; import com.vividsolutions.jts.geom.Point; import org.geolatte.geom.ByteBuffer; import org.geolatte.geom.codec.Wkb; import org.geolatte.geom.jts.JTS; /** * A Factory class that generates expected {@link org.hibernate.spatial.testing.NativeSQLStatement}s for GeoDB * version < 0.4. These versions don't support storage of the SRID value with * the geometry. * * @author Jan Boonen, Geodan IT b.v. */ @Deprecated //Class no longer used. Remove. public class GeoDBNoSRIDExpectationsFactory extends AbstractExpectationsFactory { public GeoDBNoSRIDExpectationsFactory(GeoDBDataSourceUtils dataSourceUtils) { super( dataSourceUtils ); } @Override protected NativeSQLStatement createNativeAsBinaryStatement() { return createNativeSQLStatement( "select id, ST_AsEWKB(geom) from GEOMTEST" ); } @Override protected NativeSQLStatement createNativeAsTextStatement() { return createNativeSQLStatement( "select id, ST_AsText(geom) from GEOMTEST" ); } @Override protected NativeSQLStatement createNativeBoundaryStatement() { throw new UnsupportedOperationException( "Method ST_Bounday() is not implemented in the current version of GeoDB." ); } @Override protected NativeSQLStatement createNativeBufferStatement(Double distance) { return createNativeSQLStatement( "select t.id, ST_Buffer(t.geom,?) from GEOMTEST t where ST_SRID(t.geom) = 4326", new Object[] { distance } ); } @Override protected NativeSQLStatement createNativeContainsStatement(Geometry geom) { return createNativeSQLStatementAllWKTParams( "select t.id, ST_Contains(t.geom, ST_GeomFromText(?, 4326)) from GEOMTEST t where ST_Contains(t.geom, ST_GeomFromText(?, 4326)) = 1", geom.toText() ); } @Override protected NativeSQLStatement createNativeConvexHullStatement(Geometry geom) { throw new UnsupportedOperationException( "Method ST_ConvexHull() is not implemented in the current version of GeoDB." ); } @Override protected NativeSQLStatement createNativeCrossesStatement(Geometry geom) { return createNativeSQLStatementAllWKTParams( "select t.id, ST_Crosses(t.geom, ST_GeomFromText(?, 4326)) from GEOMTEST t where ST_Crosses(t.geom, ST_GeomFromText(?, 4326)) = 1", geom.toText() ); } @Override protected NativeSQLStatement createNativeDifferenceStatement(Geometry geom) { throw new UnsupportedOperationException( "Method ST_Difference() is not implemented in the current version of GeoDB." ); } @Override protected NativeSQLStatement createNativeDimensionSQL() { throw new UnsupportedOperationException( "Method ST_Dimension() is not implemented in the current version of GeoDB." ); } @Override protected NativeSQLStatement createNativeDisjointStatement(Geometry geom) { return createNativeSQLStatementAllWKTParams( "select t.id, ST_Disjoint(t.geom, ST_GeomFromText(?, 4326)) from GEOMTEST t where ST_Disjoint(t.geom, ST_GeomFromText(?, 4326)) = 1", geom.toText() ); } @Override protected NativeSQLStatement createNativeTransformStatement(int epsg) { throw new UnsupportedOperationException(); } @Override protected NativeSQLStatement createNativeHavingSRIDStatement(int srid) { return createNativeSQLStatement( "select t.id, (st_srid(t.geom) = " + srid + ") from GeomTest t where ST_SRID(t.geom) = " + srid ); } @Override protected NativeSQLStatement createNativeDistanceStatement(Geometry geom) { return createNativeSQLStatementAllWKTParams( "select t.id, st_distance(t.geom, ST_GeomFromText(?, 4326)) from GeomTest t where ST_SRID(t.geom) = 4326", geom.toText() ); } @Override protected NativeSQLStatement createNativeEnvelopeStatement() { return createNativeSQLStatement( "select id, ST_Envelope(geom) from GEOMTEST" ); } @Override protected NativeSQLStatement createNativeEqualsStatement(Geometry geom) { return createNativeSQLStatementAllWKTParams( "select t.id, ST_Equals(t.geom, ST_GeomFromText(?, 4326)) from GEOMTEST t where ST_Equals(t.geom, ST_GeomFromText(?, 4326)) = 1", geom.toText() ); } @Override protected NativeSQLStatement createNativeFilterStatement(Geometry geom) { throw new UnsupportedOperationException( "Method ST_MBRIntersects() is not implemented in the current version of GeoDB." ); } @Override protected NativeSQLStatement createNativeGeomUnionStatement(Geometry geom) { throw new UnsupportedOperationException( "Method ST_GeomUnion() is not implemented in the current version of GeoDB." ); } @Override protected NativeSQLStatement createNativeGeometryTypeStatement() { return createNativeSQLStatement( "select id, GeometryType(geom) from GEOMTEST" ); } @Override protected NativeSQLStatement createNativeIntersectionStatement(Geometry geom) { throw new UnsupportedOperationException( "Method ST_Intersection() is not implemented in the current version of GeoDB." ); } @Override protected NativeSQLStatement createNativeIntersectsStatement(Geometry geom) { return createNativeSQLStatementAllWKTParams( "select t.id, ST_Intersects(t.geom, ST_GeomFromText(?, 4326)) from GEOMTEST t where ST_Intersects(t.geom, ST_GeomFromText(?, 4326)) = 1", geom.toText() ); } @Override protected NativeSQLStatement createNativeIsEmptyStatement() { return createNativeSQLStatement( "select id, ST_IsEmpty(geom) from GEOMTEST" ); } @Override protected NativeSQLStatement createNativeIsNotEmptyStatement() { return createNativeSQLStatement( "select id, not ST_IsEmpty(geom) from GEOMTEST" ); } @Override protected NativeSQLStatement createNativeIsSimpleStatement() { return createNativeSQLStatement( "select id, ST_IsSimple(geom) from GEOMTEST" ); } @Override protected NativeSQLStatement createNativeOverlapsStatement(Geometry geom) { return createNativeSQLStatementAllWKTParams( "select t.id, ST_Overlaps(t.geom, ST_GeomFromText(?, 4326)) from GEOMTEST t where ST_Overlaps(t.geom, ST_GeomFromText(?, 4326)) = 1", geom.toText() ); } @Override protected NativeSQLStatement createNativeRelateStatement(Geometry geom, String matrix) { throw new UnsupportedOperationException( "Method ST_Relate() is not implemented in the current version of GeoDB." ); } @Override protected NativeSQLStatement createNativeDwithinStatement(Point geom, double distance) { String sql = "select t.id, st_dwithin(t.geom, ST_GeomFromText(?, 4326), " + distance + " ) from GeomTest t where st_dwithin(t.geom, ST_GeomFromText(?, 4326), " + distance + ") = 'true' and ST_SRID(t.geom) = 4326"; return createNativeSQLStatementAllWKTParams( sql, geom.toText() ); } /* * (non-Javadoc) * * @seeorg.hibernatespatial.test.AbstractExpectationsFactory# * createNativeSridStatement() */ @Override protected NativeSQLStatement createNativeSridStatement() { return createNativeSQLStatement( "select id, ST_SRID(geom) from GEOMTEST" ); } @Override protected NativeSQLStatement createNativeSymDifferenceStatement( Geometry geom) { throw new UnsupportedOperationException( "Method ST_SymDifference() is not implemented in the current version of GeoDB." ); } @Override protected NativeSQLStatement createNativeTouchesStatement(Geometry geom) { return createNativeSQLStatementAllWKTParams( "select t.id, ST_Touches(t.geom, ST_GeomFromText(?, 4326)) from GEOMTEST t where ST_Touches(t.geom, ST_GeomFromText(?, 4326)) = 1", geom.toText() ); } @Override protected NativeSQLStatement createNativeWithinStatement( Geometry testPolygon) { return createNativeSQLStatementAllWKTParams( "select t.id, ST_Within(t.geom, ST_GeomFromText(?, 4326)) from GEOMTEST t where ST_Within(t.geom, ST_GeomFromText(?, 4326)) = 1 and ST_SRID(t.geom) = 4326", testPolygon.toText() ); } @Override protected Geometry decode(Object o) { return JTS.to( Wkb.fromWkb( ByteBuffer.from( (byte[]) o ) ) ); } }
lgpl-2.1
drahnr/gtkdatabox-radioactive
ui/glade-databox.c
1875
/* $Id: glade-databox.c 4 2008-06-22 09:19:11Z rbock $ */ /* -*- Mode: C; c-basic-offset: 4 -*- * libglade - a library for building interfaces from XML files at runtime * Copyright (C) 1998-2001 James Henstridge <james@daa.com.au> * Copyright 2001 Ximian, Inc. * * glade-databox.c: support for canvas widgets in libglade. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * * Authors: * Jacob Berkman <jacob@ximian.com> * James Henstridge <james@daa.com.au> * * Modified for gtkdatabox by (based on gnome-canvas glade interface): * H. Nieuwenhuis <vzzbx@xs4all.nl> */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include <stdlib.h> #include <string.h> #include <glade/glade-init.h> #include <glade/glade-build.h> #include <gtkdatabox.h> #include <gtkdatabox_ruler.h> /* this macro puts a version check function into the module */ GLADE_MODULE_CHECK_INIT void glade_module_register_widgets (void) { glade_require ("gtk"); glade_register_widget (GTK_TYPE_DATABOX, glade_standard_build_widget, NULL, NULL); glade_register_widget (GTK_DATABOX_TYPE_RULER, glade_standard_build_widget, NULL, NULL); glade_provide ("databox"); }
lgpl-2.1
cdolivet/EditArea
_devel/old_autocompletion/autocompletion_files/php.js
1656
// in all regexp "\" must be replaced by "\\" var datas= { "default": { // the name of this definition group. It's posisble to have different rules inside the same definition file "REGEXP": { "before_word": "[^a-zA-Z0-9_]|^" // \\s|\\.| ,"possible_words_letters": "[a-zA-Z0-9_]+" ,"letter_after_word_must_match": "[^a-zA-Z0-9_]|$" ,"prefix_separator": "\\.|->" } ,"CASE_SENSITIVE": true ,"MAX_TEXT_LENGTH": 100 // the length of the text being analyzed before the cursor position ,"KEYWORDS": [ // [ // 0 : the keyword the user is typing // 1 : the string inserted in code ("{_@_}" being the new position of the cursor) // 2 : the needed prefix // 3 : the text the appear in the suggestion box (if empty, the string to insert will be displayed ['Array', 'Array()', '', 'alert( String message )'] ,['alert', 'alert({_@_})', '', 'alert(message)'] ,['ascrollTo', 'scrollTo({_@_})', '', 'scrollTo(x,y)'] ,['alert', 'alert({_@_},bouh);', '', 'alert(message, message2)'] ,['aclose', 'close({_@_})', '', 'alert(message)'] ,['aconfirm', 'confirm({_@_})', '', 'alert(message)'] ,['aonfocus', 'onfocus', '', ''] ,['aonerror', 'onerror', '', 'blabla'] ,['aonerror', 'onerror', '', ''] ,['window', '', '', ''] ,['location', 'location', 'window', ''] ,['document', 'document', 'window', ''] ,['href', 'href', 'location', ''] ] } }; // the second identifier must be the same as the one of the syntax coloring definition file EditArea_autocompletion._load_auto_complete_file( datas, "php" );
lgpl-2.1
pexip/os-libthai
tests/test_thbrk.c
2400
/* Test driver for thbrk */ #define MAXLINELENGTH 1000 #include <stdio.h> #include <stdlib.h> #include <string.h> #include <thai/thbrk.h> /* run with "-i" argument to get the interactive version otherwise it will run the self test and exit */ int main (int argc, char* argv[]) { thchar_t str[MAXLINELENGTH]; thchar_t out[MAXLINELENGTH*6+1]; int pos[MAXLINELENGTH]; int outputLength; int numCut, i; int interactive = 0; ThBrk *brk; if (argc >= 2) { if (0 == strcmp (argv[1], "-i")) interactive = 1; } brk = th_brk_new (NULL); if (!brk) { printf ("Unable to create word breaker!\n"); exit (-1); } if (interactive) { while (!feof (stdin)) { printf ("Please enter thai words/sentences: "); if (!fgets ((char *)str, MAXLINELENGTH-1, stdin)) { numCut = th_brk_find_breaks (brk, str, pos, MAXLINELENGTH); printf ("Total %d cut points.", numCut); if (numCut > 0) { printf ("Cut points list: %d", pos[0]); for (i = 1; i < numCut; i++) { printf(", %d", pos[i]); } } printf("\n"); outputLength = th_brk_insert_breaks (brk, str, out, sizeof out, "<WBR>"); printf ("Output string length is %d\n", outputLength-1); /* the penultimate is \n */ printf ("Output string is %s", out); printf("***********************************************************************\n"); } } } else { strcpy ((char *)str, "ÊÇÑÊ´Õ¤ÃѺ ¡Í.ÃÁ¹. ¹Õèà»ç¹¡Ò÷´ÊͺµÑÇàͧ"); printf ("Testing with string: %s\n", str); numCut = th_brk_find_breaks (brk, str, pos, MAXLINELENGTH); printf ("Total %d cut points.", numCut); if (numCut != 7) { printf("Error! should be 7.. test th_brk_find_breaks() failed...\n"); exit (-1); } printf("Cut points list: %d", pos[0]); for (i = 1; i < numCut; i++) { printf(", %d", pos[i]); } printf("\n"); outputLength = th_brk_insert_breaks (brk, str, out, sizeof out, "<WBR>"); printf ("Output string is %s\n", out); printf ("Output string length is %d\n", outputLength); if (outputLength != 75) { printf ("Error! should be 75.. test th_brk_insert_breaks() failed...\n"); exit (-1); } printf ("*** End of thbrk self test ******\n"); } th_brk_delete (brk); return 0; }
lgpl-2.1
gonicus/gosa
backend/src/gosa/backend/objects/backend/registry.py
2337
# This file is part of the GOsa framework. # # http://gosa-project.org # # Copyright: # (C) 2016 GONICUS GmbH, Germany, http://www.gonicus.de # # See the LICENSE file in the project's top-level directory for details. import pkg_resources from gosa.common.components import PluginRegistry from gosa.common.utils import N_ from gosa.common.error import GosaErrorHandler as C # Register the errors handled by us C.register_codes(dict( BACKEND_NOT_FOUND=N_("Backend '%(topic)s' not found"), )) class ObjectBackendRegistry(object): instance = None backends = {} uuidAttr = "entryUUID" __index = None def __init__(self): # Load available backends for entry in pkg_resources.iter_entry_points("gosa.object.backend"): clazz = entry.load() ObjectBackendRegistry.backends[clazz.__name__] = clazz() def dn2uuid(self, backend, dn, from_db_only=False): uuid = ObjectBackendRegistry.backends[backend].dn2uuid(dn) if uuid is None and from_db_only is True: # fallback to db if self.__index is None: self.__index = PluginRegistry.getInstance("ObjectIndex") res = self.__index.search({'dn': dn}, {'uuid': 1}) if len(res) == 1: uuid = res[0]['_uuid'] return uuid def uuid2dn(self, backend, uuid, from_db_only=False): dn = ObjectBackendRegistry.backends[backend].uuid2dn(uuid) if dn is None and from_db_only is True: # fallback to db if self.__index is None: self.__index = PluginRegistry.getInstance("ObjectIndex") res = self.__index.search({'uuid': uuid}, {'dn': 1}) if len(res) == 1: dn = res[0]['dn'] return dn def get_timestamps(self, backend, dn): return ObjectBackendRegistry.backends[backend].get_timestamps(dn) @staticmethod def getInstance(): if not ObjectBackendRegistry.instance: ObjectBackendRegistry.instance = ObjectBackendRegistry() return ObjectBackendRegistry.instance @staticmethod def getBackend(name): if not name in ObjectBackendRegistry.backends: raise ValueError(C.make_error("BACKEND_NOT_FOUND", name)) return ObjectBackendRegistry.backends[name]
lgpl-2.1
jfinkels/tuxguitar
src/main/java/org/herac/tuxguitar/gui/actions/transport/TransportStopAction.java
857
/* * Created on 17-dic-2005 * * TODO To change the template for this generated file go to Window - * Preferences - Java - Code Style - Code Templates */ package org.herac.tuxguitar.gui.actions.transport; import org.eclipse.swt.events.TypedEvent; import org.herac.tuxguitar.gui.TuxGuitar; import org.herac.tuxguitar.gui.actions.Action; /** * @author julian * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class TransportStopAction extends Action { public static final String NAME = "action.transport.stop"; public TransportStopAction() { super(NAME, AUTO_LOCK | AUTO_UNLOCK | AUTO_UPDATE | KEY_BINDING_AVAILABLE); } protected int execute(TypedEvent e) { TuxGuitar.instance().getTransport().stop(); return 0; } }
lgpl-2.1
revinate/php-amqplib
demo/amqp_consumer_exclusive.php
2836
<?php // Only one consumer per queue is allowed. // Set $queue name to test exclusiveness include(__DIR__ . '/config.php'); use PhpAmqpLib\Connection\AMQPStreamConnection; $exchange = 'fanout_exclusive_example_exchange'; $queue = ''; // if empty let RabbitMQ create a queue name // set a queue name and run multiple instances // to test exclusiveness $consumerTag = 'consumer' . getmypid(); $connection = new AMQPStreamConnection(HOST, PORT, USER, PASS, VHOST); $channel = $connection->channel(); /* name: $queue // should be unique in fanout exchange. Let RabbitMQ create // a queue name for us passive: false // don't check if a queue with the same name exists durable: false // the queue will not survive server restarts exclusive: true // the queue can not be accessed by other channels auto_delete: true //the queue will be deleted once the channel is closed. */ list($queueName, ,) = $channel->queue_declare($queue, false, false, true, true); /* name: $exchange type: direct passive: false // don't check if a exchange with the same name exists durable: false // the exchange will not survive server restarts auto_delete: true //the exchange will be deleted once the channel is closed. */ $channel->exchange_declare($exchange, 'fanout', false, false, true); $channel->queue_bind($queueName, $exchange); /** * @param \PhpAmqpLib\Message\AMQPMessage $message */ function process_message($message) { echo "\n--------\n"; echo $message->body; echo "\n--------\n"; $message->delivery_info['channel']->basic_ack($message->delivery_info['delivery_tag']); // Send a message with the string "quit" to cancel the consumer. if ($message->body === 'quit') { $message->delivery_info['channel']->basic_cancel($message->delivery_info['consumer_tag']); } } /* queue: Queue from where to get the messages consumer_tag: Consumer identifier no_local: Don't receive messages published by this consumer. no_ack: Tells the server if the consumer will acknowledge the messages. exclusive: Request exclusive consumer access, meaning only this consumer can access the queue nowait: don't wait for a server response. In case of error the server will raise a channel exception callback: A PHP Callback */ $channel->basic_consume($queueName, $consumerTag, false, false, true, false, 'process_message'); /** * @param \PhpAmqpLib\Channel\AMQPChannel $channel * @param \PhpAmqpLib\Connection\AbstractConnection $connection */ function shutdown($channel, $connection) { $channel->close(); $connection->close(); } register_shutdown_function('shutdown', $channel, $connection); // Loop as long as the channel has callbacks registered while (count($channel->callbacks)) { $channel->wait(); }
lgpl-2.1
Amichai/PhysicsPad
mathnetnumerics_b382b1690235/src/Numerics/Algorithms/LinearAlgebra/Acml/AcmlLinearAlgebraProvider.float.cs
43092
// <copyright file="AcmlLinearAlgebraProvider.float.cs" company="Math.NET"> // Math.NET Numerics, part of the Math.NET Project // http://numerics.mathdotnet.com // http://github.com/mathnet/mathnet-numerics // http://mathnetnumerics.codeplex.com // // Copyright (c) 2009-2011 Math.NET // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation // files (the "Software"), to deal in the Software without // restriction, including without limitation the rights to use, // copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following // conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // OTHER DEALINGS IN THE SOFTWARE. // </copyright> namespace MathNet.Numerics.Algorithms.LinearAlgebra.Acml { using System; using System.Security; using Properties; /// <summary> /// AMD Core Math Library (ACML) linear algebra provider. /// </summary> public partial class AcmlLinearAlgebraProvider { /// <summary> /// Computes the dot product of x and y. /// </summary> /// <param name="x">The vector x.</param> /// <param name="y">The vector y.</param> /// <returns>The dot product of x and y.</returns> /// <remarks>This is equivalent to the DOT BLAS routine.</remarks> [SecuritySafeCritical] public override float DotProduct(float[] x, float[] y) { if (y == null) { throw new ArgumentNullException("y"); } if (x == null) { throw new ArgumentNullException("x"); } if (x.Length != y.Length) { throw new ArgumentException(Resources.ArgumentArraysSameLength); } return SafeNativeMethods.s_dot_product(x.Length, x, y); } /// <summary> /// Adds a scaled vector to another: <c>result = y + alpha*x</c>. /// </summary> /// <param name="y">The vector to update.</param> /// <param name="alpha">The value to scale <paramref name="x"/> by.</param> /// <param name="x">The vector to add to <paramref name="y"/>.</param> /// <param name="result">The result of the addition.</param> /// <remarks>This is similar to the AXPY BLAS routine.</remarks> [SecuritySafeCritical] public override void AddVectorToScaledVector(float[] y, float alpha, float[] x, float[] result) { if (y == null) { throw new ArgumentNullException("y"); } if (x == null) { throw new ArgumentNullException("x"); } if (y.Length != x.Length) { throw new ArgumentException(Resources.ArgumentVectorsSameLength); } if (!ReferenceEquals(y, result)) { Array.Copy(y, 0, result, 0, y.Length); } if (alpha == 0.0f) { return; } SafeNativeMethods.s_axpy(y.Length, alpha, x, result); } /// <summary> /// Scales an array. Can be used to scale a vector and a matrix. /// </summary> /// <param name="alpha">The scalar.</param> /// <param name="x">The values to scale.</param> /// <param name="result">This result of the scaling.</param> /// <remarks>This is similar to the SCAL BLAS routine.</remarks> [SecuritySafeCritical] public override void ScaleArray(float alpha, float[] x, float[] result) { if (x == null) { throw new ArgumentNullException("x"); } if (!ReferenceEquals(x, result)) { Array.Copy(x, 0, result, 0, x.Length); } if (alpha == 1.0f) { return; } SafeNativeMethods.s_scale(x.Length, alpha, result); } /// <summary> /// Multiples two matrices. <c>result = x * y</c> /// </summary> /// <param name="x">The x matrix.</param> /// <param name="rowsX">The number of rows in the x matrix.</param> /// <param name="columnsX">The number of columns in the x matrix.</param> /// <param name="y">The y matrix.</param> /// <param name="rowsY">The number of rows in the y matrix.</param> /// <param name="columnsY">The number of columns in the y matrix.</param> /// <param name="result">Where to store the result of the multiplication.</param> /// <remarks>This is a simplified version of the BLAS GEMM routine with alpha /// set to 1.0f and beta set to 0.0f, and x and y are not transposed.</remarks> public override void MatrixMultiply(float[] x, int rowsX, int columnsX, float[] y, int rowsY, int columnsY, float[] result) { MatrixMultiplyWithUpdate(Transpose.DontTranspose, Transpose.DontTranspose, 1.0f, x, rowsX, columnsX, y, rowsY, columnsY, 0.0f, result); } /// <summary> /// Multiplies two matrices and updates another with the result. <c>c = alpha*op(a)*op(b) + beta*c</c> /// </summary> /// <param name="transposeA">How to transpose the <paramref name="a"/> matrix.</param> /// <param name="transposeB">How to transpose the <paramref name="b"/> matrix.</param> /// <param name="alpha">The value to scale <paramref name="a"/> matrix.</param> /// <param name="a">The a matrix.</param> /// <param name="rowsA">The number of rows in the <paramref name="a"/> matrix.</param> /// <param name="columnsA">The number of columns in the <paramref name="a"/> matrix.</param> /// <param name="b">The b matrix</param> /// <param name="rowsB">The number of rows in the <paramref name="b"/> matrix.</param> /// <param name="columnsB">The number of columns in the <paramref name="b"/> matrix.</param> /// <param name="beta">The value to scale the <paramref name="c"/> matrix.</param> /// <param name="c">The c matrix.</param> [SecuritySafeCritical] public override void MatrixMultiplyWithUpdate(Transpose transposeA, Transpose transposeB, float alpha, float[] a, int rowsA, int columnsA, float[] b, int rowsB, int columnsB, float beta, float[] c) { if (a == null) { throw new ArgumentNullException("a"); } if (b == null) { throw new ArgumentNullException("b"); } if (c == null) { throw new ArgumentNullException("c"); } var m = transposeA == Transpose.DontTranspose ? rowsA : columnsA; var n = transposeB == Transpose.DontTranspose ? columnsB : rowsB; var k = transposeA == Transpose.DontTranspose ? columnsA : rowsA; var l = transposeB == Transpose.DontTranspose ? rowsB : columnsB; if (c.Length != m * n) { throw new ArgumentException(Resources.ArgumentMatrixDimensions); } if (k != l) { throw new ArgumentException(Resources.ArgumentMatrixDimensions); } SafeNativeMethods.s_matrix_multiply(transposeA, transposeB, m, n, k, alpha, a, b, beta, c); } /// <summary> /// Computes the LUP factorization of A. P*A = L*U. /// </summary> /// <param name="data">An <paramref name="order"/> by <paramref name="order"/> matrix. The matrix is overwritten with the /// the LU factorization on exit. The lower triangular factor L is stored in under the diagonal of <paramref name="data"/> (the diagonal is always 1.0f /// for the L factor). The upper triangular factor U is stored on and above the diagonal of <paramref name="data"/>.</param> /// <param name="order">The order of the square matrix <paramref name="data"/>.</param> /// <param name="ipiv">On exit, it contains the pivot indices. The size of the array must be <paramref name="order"/>.</param> /// <remarks>This is equivalent to the GETRF LAPACK routine.</remarks> [SecuritySafeCritical] public override void LUFactor(float[] data, int order, int[] ipiv) { if (data == null) { throw new ArgumentNullException("data"); } if (ipiv == null) { throw new ArgumentNullException("ipiv"); } if (data.Length != order * order) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "data"); } if (ipiv.Length != order) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "ipiv"); } SafeNativeMethods.s_lu_factor(order, data, ipiv); } /// <summary> /// Computes the inverse of matrix using LU factorization. /// </summary> /// <param name="a">The N by N matrix to invert. Contains the inverse On exit.</param> /// <param name="order">The order of the square matrix <paramref name="a"/>.</param> /// <remarks>This is equivalent to the GETRF and GETRI LAPACK routines.</remarks> [SecuritySafeCritical] public override void LUInverse(float[] a, int order) { if (a == null) { throw new ArgumentNullException("a"); } if (a.Length != order * order) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "a"); } var work = new float[order]; SafeNativeMethods.s_lu_inverse(order, a, work, work.Length); } /// <summary> /// Computes the inverse of a previously factored matrix. /// </summary> /// <param name="a">The LU factored N by N matrix. Contains the inverse On exit.</param> /// <param name="order">The order of the square matrix <paramref name="a"/>.</param> /// <param name="ipiv">The pivot indices of <paramref name="a"/>.</param> /// <remarks>This is equivalent to the GETRI LAPACK routine.</remarks> [SecuritySafeCritical] public override void LUInverseFactored(float[] a, int order, int[] ipiv) { if (a == null) { throw new ArgumentNullException("a"); } if (ipiv == null) { throw new ArgumentNullException("ipiv"); } if (a.Length != order * order) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "a"); } if (ipiv.Length != order) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "ipiv"); } var work = new float[order]; SafeNativeMethods.s_lu_inverse_factored(order, a, ipiv, work, order); } /// <summary> /// Computes the inverse of matrix using LU factorization. /// </summary> /// <param name="a">The N by N matrix to invert. Contains the inverse On exit.</param> /// <param name="order">The order of the square matrix <paramref name="a"/>.</param> /// <param name="work">The work array. The array must have a length of at least N, /// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal /// work size value.</param> /// <remarks>This is equivalent to the GETRF and GETRI LAPACK routines.</remarks> [SecuritySafeCritical] public override void LUInverse(float[] a, int order, float[] work) { if (a == null) { throw new ArgumentNullException("a"); } if (a.Length != order * order) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "a"); } if (work == null) { throw new ArgumentNullException("work"); } if (work.Length < order) { throw new ArgumentException(Resources.WorkArrayTooSmall, "work"); } SafeNativeMethods.s_lu_inverse(order, a, work, work.Length); } /// <summary> /// Computes the inverse of a previously factored matrix. /// </summary> /// <param name="a">The LU factored N by N matrix. Contains the inverse On exit.</param> /// <param name="order">The order of the square matrix <paramref name="a"/>.</param> /// <param name="ipiv">The pivot indices of <paramref name="a"/>.</param> /// <param name="work">The work array. The array must have a length of at least N, /// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal /// work size value.</param> /// <remarks>This is equivalent to the GETRI LAPACK routine.</remarks> [SecuritySafeCritical] public override void LUInverseFactored(float[] a, int order, int[] ipiv, float[] work) { if (a == null) { throw new ArgumentNullException("a"); } if (ipiv == null) { throw new ArgumentNullException("ipiv"); } if (a.Length != order * order) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "a"); } if (ipiv.Length != order) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "ipiv"); } if (work == null) { throw new ArgumentNullException("work"); } if (work.Length < order) { throw new ArgumentException(Resources.WorkArrayTooSmall, "work"); } SafeNativeMethods.s_lu_inverse_factored(order, a, ipiv, work, order); } /// <summary> /// Solves A*X=B for X using LU factorization. /// </summary> /// <param name="columnsOfB">The number of columns of B.</param> /// <param name="a">The square matrix A.</param> /// <param name="order">The order of the square matrix <paramref name="a"/>.</param> /// <param name="b">On entry the B matrix; on exit the X matrix.</param> /// <remarks>This is equivalent to the GETRF and GETRS LAPACK routines.</remarks> [SecuritySafeCritical] public override void LUSolve(int columnsOfB, float[] a, int order, float[] b) { if (a == null) { throw new ArgumentNullException("a"); } if (a.Length != order * order) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "a"); } if (b.Length != columnsOfB * order) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "b"); } if (ReferenceEquals(a, b)) { throw new ArgumentException(Resources.ArgumentReferenceDifferent); } SafeNativeMethods.s_lu_solve(order, columnsOfB, a, b); } /// <summary> /// Solves A*X=B for X using a previously factored A matrix. /// </summary> /// <param name="columnsOfB">The number of columns of B.</param> /// <param name="a">The factored A matrix.</param> /// <param name="order">The order of the square matrix <paramref name="a"/>.</param> /// <param name="ipiv">The pivot indices of <paramref name="a"/>.</param> /// <param name="b">On entry the B matrix; on exit the X matrix.</param> /// <remarks>This is equivalent to the GETRS LAPACK routine.</remarks> [SecuritySafeCritical] public override void LUSolveFactored(int columnsOfB, float[] a, int order, int[] ipiv, float[] b) { if (a == null) { throw new ArgumentNullException("a"); } if (ipiv == null) { throw new ArgumentNullException("ipiv"); } if (a.Length != order * order) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "a"); } if (ipiv.Length != order) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "ipiv"); } if (b.Length != columnsOfB * order) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "b"); } if (ReferenceEquals(a, b)) { throw new ArgumentException(Resources.ArgumentReferenceDifferent); } SafeNativeMethods.s_lu_solve_factored(order, columnsOfB, a, ipiv, b); } /// <summary> /// Computes the Cholesky factorization of A. /// </summary> /// <param name="a">On entry, a square, positive definite matrix. On exit, the matrix is overwritten with the /// the Cholesky factorization.</param> /// <param name="order">The number of rows or columns in the matrix.</param> /// <remarks>This is equivalent to the POTRF LAPACK routine.</remarks> [SecuritySafeCritical] public override void CholeskyFactor(float[] a, int order) { if (a == null) { throw new ArgumentNullException("a"); } if (order < 1) { throw new ArgumentException(Resources.ArgumentMustBePositive, "order"); } if (a.Length != order * order) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "a"); } var info = SafeNativeMethods.s_cholesky_factor(order, a); if (info > 0) { throw new ArgumentException(Resources.ArgumentMatrixPositiveDefinite); } } /// <summary> /// Solves A*X=B for X using Cholesky factorization. /// </summary> /// <param name="a">The square, positive definite matrix A.</param> /// <param name="orderA">The number of rows and columns in A.</param> /// <param name="b">On entry the B matrix; on exit the X matrix.</param> /// <param name="columnsB">The number of columns in the B matrix.</param> /// <remarks>This is equivalent to the POTRF add POTRS LAPACK routines. /// </remarks> [SecuritySafeCritical] public override void CholeskySolve(float[] a, int orderA, float[] b, int columnsB) { if (a == null) { throw new ArgumentNullException("a"); } if (b == null) { throw new ArgumentNullException("b"); } if (b.Length != orderA * columnsB) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "b"); } if (ReferenceEquals(a, b)) { throw new ArgumentException(Resources.ArgumentReferenceDifferent); } SafeNativeMethods.s_cholesky_solve(orderA, columnsB, a, b); } /// <summary> /// Solves A*X=B for X using a previously factored A matrix. /// </summary> /// <param name="a">The square, positive definite matrix A.</param> /// <param name="orderA">The number of rows and columns in A.</param> /// <param name="b">On entry the B matrix; on exit the X matrix.</param> /// <param name="columnsB">The number of columns in the B matrix.</param> /// <remarks>This is equivalent to the POTRS LAPACK routine.</remarks> [SecuritySafeCritical] public override void CholeskySolveFactored(float[] a, int orderA, float[] b, int columnsB) { if (a == null) { throw new ArgumentNullException("a"); } if (b == null) { throw new ArgumentNullException("b"); } if (b.Length != orderA * columnsB) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "b"); } if (ReferenceEquals(a, b)) { throw new ArgumentException(Resources.ArgumentReferenceDifferent); } SafeNativeMethods.s_cholesky_solve_factored(orderA, columnsB, a, b); } /// <summary> /// Computes the QR factorization of A. /// </summary> /// <param name="r">On entry, it is the M by N A matrix to factor. On exit, /// it is overwritten with the R matrix of the QR factorization. </param> /// <param name="rowsR">The number of rows in the A matrix.</param> /// <param name="columnsR">The number of columns in the A matrix.</param> /// <param name="q">On exit, A M by M matrix that holds the Q matrix of the /// QR factorization.</param> /// <param name="tau">A min(m,n) vector. On exit, contains additional information /// to be used by the QR solve routine.</param> /// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks> [SecuritySafeCritical] public override void QRFactor(float[] r, int rowsR, int columnsR, float[] q, float[] tau) { if (r == null) { throw new ArgumentNullException("r"); } if (q == null) { throw new ArgumentNullException("q"); } if (r.Length != rowsR * columnsR) { throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "rowsR * columnsR"), "r"); } if (tau.Length < Math.Min(rowsR, columnsR)) { throw new ArgumentException(string.Format(Resources.ArrayTooSmall, "min(m,n)"), "tau"); } if (q.Length != rowsR * rowsR) { throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "rowsR * rowsR"), "q"); } var work = new float[columnsR * Control.BlockSize]; SafeNativeMethods.s_qr_factor(rowsR, columnsR, r, tau, q, work, work.Length); } /// <summary> /// Computes the QR factorization of A. /// </summary> /// <param name="r">On entry, it is the M by N A matrix to factor. On exit, /// it is overwritten with the R matrix of the QR factorization. </param> /// <param name="rowsR">The number of rows in the A matrix.</param> /// <param name="columnsR">The number of columns in the A matrix.</param> /// <param name="q">On exit, A M by M matrix that holds the Q matrix of the /// QR factorization.</param> /// <param name="tau">A min(m,n) vector. On exit, contains additional information /// to be used by the QR solve routine.</param> /// <param name="work">The work array. The array must have a length of at least N, /// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal /// work size value.</param> /// <remarks>This is similar to the GEQRF and ORGQR LAPACK routines.</remarks> [SecuritySafeCritical] public override void QRFactor(float[] r, int rowsR, int columnsR, float[] q, float[] tau, float[] work) { if (r == null) { throw new ArgumentNullException("r"); } if (q == null) { throw new ArgumentNullException("q"); } if (work == null) { throw new ArgumentNullException("work"); } if (r.Length != rowsR * columnsR) { throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "rowsR * columnsR"), "r"); } if (tau.Length < Math.Min(rowsR, columnsR)) { throw new ArgumentException(string.Format(Resources.ArrayTooSmall, "min(m,n)"), "tau"); } if (q.Length != rowsR * rowsR) { throw new ArgumentException(string.Format(Resources.ArgumentArrayWrongLength, "rowsR * rowsR"), "q"); } if (work.Length < columnsR * Control.BlockSize) { work[0] = columnsR * Control.BlockSize; throw new ArgumentException(Resources.WorkArrayTooSmall, "work"); } SafeNativeMethods.s_qr_factor(rowsR, columnsR, r, tau, q, work, work.Length); } /// <summary> /// Solves A*X=B for X using QR factorization of A. /// </summary> /// <param name="a">The A matrix.</param> /// <param name="rows">The number of rows in the A matrix.</param> /// <param name="columns">The number of columns in the A matrix.</param> /// <param name="b">The B matrix.</param> /// <param name="columnsB">The number of columns of B.</param> /// <param name="x">On exit, the solution matrix.</param> /// <remarks>Rows must be greater or equal to columns.</remarks> public override void QRSolve(float[] a, int rows, int columns, float[] b, int columnsB, float[] x) { if (a == null) { throw new ArgumentNullException("a"); } if (b == null) { throw new ArgumentNullException("b"); } if (x == null) { throw new ArgumentNullException("x"); } if (a.Length != rows * columns) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "a"); } if (b.Length != rows * columnsB) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "b"); } if (x.Length != columns * columnsB) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "x"); } if (rows < columns) { throw new ArgumentException(Resources.RowsLessThanColumns); } var work = new float[columns * Control.BlockSize]; QRSolve(a, rows, columns, b, columnsB, x, work); } /// <summary> /// Solves A*X=B for X using QR factorization of A. /// </summary> /// <param name="a">The A matrix.</param> /// <param name="rows">The number of rows in the A matrix.</param> /// <param name="columns">The number of columns in the A matrix.</param> /// <param name="b">The B matrix.</param> /// <param name="columnsB">The number of columns of B.</param> /// <param name="x">On exit, the solution matrix.</param> /// <param name="work">The work array. The array must have a length of at least N, /// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal /// work size value.</param> /// <remarks>Rows must be greater or equal to columns.</remarks> public override void QRSolve(float[] a, int rows, int columns, float[] b, int columnsB, float[] x, float[] work) { if (a == null) { throw new ArgumentNullException("a"); } if (b == null) { throw new ArgumentNullException("b"); } if (x == null) { throw new ArgumentNullException("x"); } if (work == null) { throw new ArgumentNullException("work"); } if (a.Length != rows * columns) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "a"); } if (b.Length != rows * columnsB) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "b"); } if (x.Length != columns * columnsB) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "x"); } if (rows < columns) { throw new ArgumentException(Resources.RowsLessThanColumns); } if (work.Length < 1) { work[0] = rows * Control.BlockSize; throw new ArgumentException(Resources.WorkArrayTooSmall, "work"); } SafeNativeMethods.s_qr_solve(rows, columns, columnsB, a, b, x, work, work.Length); } /// <summary> /// Solves A*X=B for X using a previously QR factored matrix. /// </summary> /// <param name="q">The Q matrix obtained by calling <see cref="QRFactor(float[],int,int,float[],float[])"/>.</param> /// <param name="r">The R matrix obtained by calling <see cref="QRFactor(float[],int,int,float[],float[])"/>. </param> /// <param name="rowsR">The number of rows in the A matrix.</param> /// <param name="columnsR">The number of columns in the A matrix.</param> /// <param name="tau">Contains additional information on Q. Only used for the native solver /// and can be <c>null</c> for the managed provider.</param> /// <param name="b">The B matrix.</param> /// <param name="columnsB">The number of columns of B.</param> /// <param name="x">On exit, the solution matrix.</param> /// <remarks>Rows must be greater or equal to columns.</remarks> [SecuritySafeCritical] public override void QRSolveFactored(float[] q, float[] r, int rowsR, int columnsR, float[] tau, float[] b, int columnsB, float[] x) { if (r == null) { throw new ArgumentNullException("r"); } if (q == null) { throw new ArgumentNullException("q"); } if (b == null) { throw new ArgumentNullException("q"); } if (x == null) { throw new ArgumentNullException("q"); } if (r.Length != rowsR * columnsR) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "r"); } if (q.Length != rowsR * rowsR) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "q"); } if (b.Length != rowsR * columnsB) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "b"); } if (x.Length != columnsR * columnsB) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "x"); } if (rowsR < columnsR) { throw new ArgumentException(Resources.RowsLessThanColumns); } var work = new float[columnsR * Control.BlockSize]; QRSolveFactored(q, r, rowsR, columnsR, tau, b, columnsB, x, work); } /// <summary> /// Solves A*X=B for X using a previously QR factored matrix. /// </summary> /// <param name="q">The Q matrix obtained by QR factor. This is only used for the managed provider and can be /// <c>null</c> for the native provider. The native provider uses the Q portion stored in the R matrix.</param> /// <param name="r">The R matrix obtained by calling <see cref="QRFactor(float[],int,int,float[],float[])"/>. </param> /// <param name="rowsR">The number of rows in the A matrix.</param> /// <param name="columnsR">The number of columns in the A matrix.</param> /// <param name="tau">Contains additional information on Q. Only used for the native solver /// and can be <c>null</c> for the managed provider.</param> /// <param name="b">On entry the B matrix; on exit the X matrix.</param> /// <param name="columnsB">The number of columns of B.</param> /// <param name="x">On exit, the solution matrix.</param> /// <param name="work">The work array - only used in the native provider. The array must have a length of at least N, /// but should be N*blocksize. The blocksize is machine dependent. On exit, work[0] contains the optimal /// work size value.</param> /// <remarks>Rows must be greater or equal to columns.</remarks> public override void QRSolveFactored(float[] q, float[] r, int rowsR, int columnsR, float[] tau, float[] b, int columnsB, float[] x, float[] work) { if (r == null) { throw new ArgumentNullException("r"); } if (q == null) { throw new ArgumentNullException("q"); } if (b == null) { throw new ArgumentNullException("q"); } if (x == null) { throw new ArgumentNullException("q"); } if (work == null) { throw new ArgumentNullException("work"); } if (r.Length != rowsR * columnsR) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "r"); } if (q.Length != rowsR * rowsR) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "q"); } if (b.Length != rowsR * columnsB) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "b"); } if (x.Length != columnsR * columnsB) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "x"); } if (rowsR < columnsR) { throw new ArgumentException(Resources.RowsLessThanColumns); } if (work.Length < 1) { work[0] = rowsR * Control.BlockSize; throw new ArgumentException(Resources.WorkArrayTooSmall, "work"); } SafeNativeMethods.s_qr_solve_factored(rowsR, columnsR, columnsB, r, b, tau, x, work, work.Length); } /// <summary> /// Computes the singular value decomposition of A. /// </summary> /// <param name="computeVectors">Compute the singular U and VT vectors or not.</param> /// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param> /// <param name="rowsA">The number of rows in the A matrix.</param> /// <param name="columnsA">The number of columns in the A matrix.</param> /// <param name="s">The singular values of A in ascending value.</param> /// <param name="u">If <paramref name="computeVectors"/> is <c>true</c>, on exit U contains the left /// singular vectors.</param> /// <param name="vt">If <paramref name="computeVectors"/> is <c>true</c>, on exit VT contains the transposed /// right singular vectors.</param> /// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks> [SecuritySafeCritical] public override void SingularValueDecomposition(bool computeVectors, float[] a, int rowsA, int columnsA, float[] s, float[] u, float[] vt) { if (a == null) { throw new ArgumentNullException("a"); } if (s == null) { throw new ArgumentNullException("s"); } if (u == null) { throw new ArgumentNullException("u"); } if (vt == null) { throw new ArgumentNullException("vt"); } if (u.Length != rowsA * rowsA) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "u"); } if (vt.Length != columnsA * columnsA) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "vt"); } if (s.Length != Math.Min(rowsA, columnsA)) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "s"); } var work = new float[Math.Max(((3 * Math.Min(rowsA, columnsA)) + Math.Max(rowsA, columnsA)), 5 * Math.Min(rowsA, columnsA))]; SingularValueDecomposition(computeVectors, a, rowsA, columnsA, s, u, vt, work); } /// <summary> /// Solves A*X=B for X using the singular value decomposition of A. /// </summary> /// <param name="a">On entry, the M by N matrix to decompose.</param> /// <param name="rowsA">The number of rows in the A matrix.</param> /// <param name="columnsA">The number of columns in the A matrix.</param> /// <param name="b">The B matrix.</param> /// <param name="columnsB">The number of columns of B.</param> /// <param name="x">On exit, the solution matrix.</param> public override void SvdSolve(float[] a, int rowsA, int columnsA, float[] b, int columnsB, float[] x) { if (a == null) { throw new ArgumentNullException("a"); } if (b == null) { throw new ArgumentNullException("b"); } if (x == null) { throw new ArgumentNullException("x"); } if (b.Length != rowsA * columnsB) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "b"); } if (x.Length != columnsA * columnsB) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "b"); } var work = new float[Math.Max(((3 * Math.Min(rowsA, columnsA)) + Math.Max(rowsA, columnsA)), 5 * Math.Min(rowsA, columnsA))]; var s = new float[Math.Min(rowsA, columnsA)]; var u = new float[rowsA * rowsA]; var vt = new float[columnsA * columnsA]; var clone = new float[a.Length]; a.Copy(clone); SingularValueDecomposition(true, clone, rowsA, columnsA, s, u, vt, work); SvdSolveFactored(rowsA, columnsA, s, u, vt, b, columnsB, x); } /// <summary> /// Computes the singular value decomposition of A. /// </summary> /// <param name="computeVectors">Compute the singular U and VT vectors or not.</param> /// <param name="a">On entry, the M by N matrix to decompose. On exit, A may be overwritten.</param> /// <param name="rowsA">The number of rows in the A matrix.</param> /// <param name="columnsA">The number of columns in the A matrix.</param> /// <param name="s">The singular values of A in ascending value.</param> /// <param name="u">If <paramref name="computeVectors"/> is <c>true</c>, on exit U contains the left /// singular vectors.</param> /// <param name="vt">If <paramref name="computeVectors"/> is <c>true</c>, on exit VT contains the transposed /// right singular vectors.</param> /// <param name="work">The work array. For real matrices, the work array should be at least /// Max(3*Min(M, N) + Max(M, N), 5*Min(M,N)). For complex matrices, 2*Min(M, N) + Max(M, N). /// On exit, work[0] contains the optimal work size value.</param> /// <remarks>This is equivalent to the GESVD LAPACK routine.</remarks> [SecuritySafeCritical] public override void SingularValueDecomposition(bool computeVectors, float[] a, int rowsA, int columnsA, float[] s, float[] u, float[] vt, float[] work) { if (a == null) { throw new ArgumentNullException("a"); } if (s == null) { throw new ArgumentNullException("s"); } if (u == null) { throw new ArgumentNullException("u"); } if (vt == null) { throw new ArgumentNullException("vt"); } if (work == null) { throw new ArgumentNullException("work"); } if (u.Length != rowsA * rowsA) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "u"); } if (vt.Length != columnsA * columnsA) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "vt"); } if (s.Length != Math.Min(rowsA, columnsA)) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "s"); } if (work.Length == 0) { throw new ArgumentException(Resources.ArgumentSingleDimensionArray, "work"); } if (work.Length < Math.Max(((3 * Math.Min(rowsA, columnsA)) + Math.Max(rowsA, columnsA)), 5 * Math.Min(rowsA, columnsA))) { work[0] = Math.Max((3 * Math.Min(rowsA, columnsA)) + Math.Max(rowsA, columnsA), 5 * Math.Min(rowsA, columnsA)); throw new ArgumentException(Resources.WorkArrayTooSmall, "work"); } SafeNativeMethods.s_svd_factor(computeVectors, rowsA, columnsA, a, s, u, vt, work, work.Length); } } }
lgpl-2.1
joaofloressantos/Dutch_Auction
Dutch_Auction/src/DutchModel.java
1221
import java.io.IOException; import jade.core.AID; import java.util.ArrayList; import java.util.Scanner; import jade.core.Agent; public class DutchModel { public static void main(String[] args) throws IOException { String option=""; ArrayList<BiderAgent> bidders= new ArrayList<BiderAgent>(); System.out.println("Welcome to Fish Dutch Auction!"); System.out.println("Press 1 to sell a product."); System.out.println("Press 2 to Bid for a product."); Scanner scan= new Scanner(System.in); option= scan.nextLine(); System.out.println(option); if(option.equals("1")) { } else if(option.equals("2")) { Loader bidderxml = new Loader("Bidders.xml"); bidders=bidderxml.loadXmlBidders(); Product p1= new Product("gg",1,"g1",null); AuctioneerAgent Ag = new AuctioneerAgent(10,1,1200); SellerAgent s1= new SellerAgent (p1); AID sel = s1.getSellerAid(); Ag.setSellerAid(sel); Ag.setup(); s1.setup(); } else { System.out.println("Wrong input... Time Out!"); } } }
lgpl-2.1
katyhuff/moose
docs/content/framework/systems/XFEM/VolumePostprocessor.md
363
<!-- MOOSE Object Documentation Stub: Remove this when content is added. --> #VolumePostprocessor !devel /XFEM/VolumePostprocessor float=right width=auto margin=20px padding=20px background-color=#F8F8F8 !description /XFEM/VolumePostprocessor !parameters /XFEM/VolumePostprocessor !inputfiles /XFEM/VolumePostprocessor !childobjects /XFEM/VolumePostprocessor
lgpl-2.1
1fechner/FeatureExtractor
sources/FeatureExtractor/lib/hibernate-release-5.1.0.Final/documentation/javadocs/org/hibernate/engine/class-use/FetchStrategy.html
57885
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_40) on Wed Feb 10 11:30:58 CST 2016 --> <title>Uses of Class org.hibernate.engine.FetchStrategy (Hibernate JavaDocs)</title> <meta name="date" content="2016-02-10"> <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class org.hibernate.engine.FetchStrategy (Hibernate JavaDocs)"; } } catch(err) { } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <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/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../../../../overview-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../index.html?org/hibernate/engine/class-use/FetchStrategy.html" target="_top">Frames</a></li> <li><a href="FetchStrategy.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Class org.hibernate.engine.FetchStrategy" class="title">Uses of Class<br>org.hibernate.engine.FetchStrategy</h2> </div> <div class="classUseContainer"> <ul class="blockList"> <li class="blockList"> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation"> <caption><span>Packages that use <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Package</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="#org.hibernate.loader.plan.build.internal">org.hibernate.loader.plan.build.internal</a></td> <td class="colLast"> <div class="block">Contains the internal implementations used for building a metamodel-driven LoadPlan.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="#org.hibernate.loader.plan.build.internal.returns">org.hibernate.loader.plan.build.internal.returns</a></td> <td class="colLast"> <div class="block">Contains the internal implementations of the building blocks that make up a metamodel-driven LoadPlan.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><a href="#org.hibernate.loader.plan.build.internal.spaces">org.hibernate.loader.plan.build.internal.spaces</a></td> <td class="colLast"> <div class="block">Contains the internal implementations of query spaces in a metamodel-driven LoadPlan.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="#org.hibernate.loader.plan.build.spi">org.hibernate.loader.plan.build.spi</a></td> <td class="colLast"> <div class="block">Defines the SPI for building a metamodel-driven LoadPlan</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><a href="#org.hibernate.loader.plan.spi">org.hibernate.loader.plan.spi</a></td> <td class="colLast"> <div class="block">Defines the SPI for the building blocks that make up a LoadPlan.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="#org.hibernate.persister.walking.internal">org.hibernate.persister.walking.internal</a></td> <td class="colLast">&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><a href="#org.hibernate.persister.walking.spi">org.hibernate.persister.walking.spi</a></td> <td class="colLast">&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="#org.hibernate.tuple.component">org.hibernate.tuple.component</a></td> <td class="colLast">&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><a href="#org.hibernate.tuple.entity">org.hibernate.tuple.entity</a></td> <td class="colLast">&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="org.hibernate.loader.plan.build.internal"> <!-- --> </a> <h3>Uses of <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a> in <a href="../../../../org/hibernate/loader/plan/build/internal/package-summary.html">org.hibernate.loader.plan.build.internal</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing fields, and an explanation"> <caption><span>Fields in <a href="../../../../org/hibernate/loader/plan/build/internal/package-summary.html">org.hibernate.loader.plan.build.internal</a> declared as <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Field and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>protected static <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a></code></td> <td class="colLast"><span class="typeNameLabel">AbstractEntityGraphVisitationStrategy.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/internal/AbstractEntityGraphVisitationStrategy.html#DEFAULT_EAGER">DEFAULT_EAGER</a></span></code> <div class="block">The JPA 2.1 SPEC's Entity Graph only defines _WHEN_ to load an attribute, it doesn't define _HOW_ to load it So I'm here just making an assumption that when it is EAGER, then we use JOIN, and when it is LAZY, then we use SELECT.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>protected static <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a></code></td> <td class="colLast"><span class="typeNameLabel">AbstractEntityGraphVisitationStrategy.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/internal/AbstractEntityGraphVisitationStrategy.html#DEFAULT_LAZY">DEFAULT_LAZY</a></span></code>&nbsp;</td> </tr> </tbody> </table> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../org/hibernate/loader/plan/build/internal/package-summary.html">org.hibernate.loader.plan.build.internal</a> that return <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>protected <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a></code></td> <td class="colLast"><span class="typeNameLabel">FetchStyleLoadPlanBuildingAssociationVisitationStrategy.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/internal/FetchStyleLoadPlanBuildingAssociationVisitationStrategy.html#adjustJoinFetchIfNeeded-org.hibernate.persister.walking.spi.AssociationAttributeDefinition-org.hibernate.engine.FetchStrategy-">adjustJoinFetchIfNeeded</a></span>(<a href="../../../../org/hibernate/persister/walking/spi/AssociationAttributeDefinition.html" title="interface in org.hibernate.persister.walking.spi">AssociationAttributeDefinition</a>&nbsp;attributeDefinition, <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a>&nbsp;fetchStrategy)</code> <div class="block">If required by this strategy, returns a different <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine"><code>FetchStrategy</code></a> from what is specified for the given association attribute.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>protected <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a></code></td> <td class="colLast"><span class="typeNameLabel">AbstractEntityGraphVisitationStrategy.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/internal/AbstractEntityGraphVisitationStrategy.html#adjustJoinFetchIfNeeded-org.hibernate.persister.walking.spi.AssociationAttributeDefinition-org.hibernate.engine.FetchStrategy-">adjustJoinFetchIfNeeded</a></span>(<a href="../../../../org/hibernate/persister/walking/spi/AssociationAttributeDefinition.html" title="interface in org.hibernate.persister.walking.spi">AssociationAttributeDefinition</a>&nbsp;attributeDefinition, <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a>&nbsp;fetchStrategy)</code>&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><code>protected <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a></code></td> <td class="colLast"><span class="typeNameLabel">FetchStyleLoadPlanBuildingAssociationVisitationStrategy.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/internal/FetchStyleLoadPlanBuildingAssociationVisitationStrategy.html#determineFetchStrategy-org.hibernate.persister.walking.spi.AssociationAttributeDefinition-">determineFetchStrategy</a></span>(<a href="../../../../org/hibernate/persister/walking/spi/AssociationAttributeDefinition.html" title="interface in org.hibernate.persister.walking.spi">AssociationAttributeDefinition</a>&nbsp;attributeDefinition)</code>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><code>protected <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a></code></td> <td class="colLast"><span class="typeNameLabel">AbstractEntityGraphVisitationStrategy.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/internal/AbstractEntityGraphVisitationStrategy.html#determineFetchStrategy-org.hibernate.persister.walking.spi.AssociationAttributeDefinition-">determineFetchStrategy</a></span>(<a href="../../../../org/hibernate/persister/walking/spi/AssociationAttributeDefinition.html" title="interface in org.hibernate.persister.walking.spi">AssociationAttributeDefinition</a>&nbsp;attributeDefinition)</code>&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><code>protected <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a></code></td> <td class="colLast"><span class="typeNameLabel">CascadeStyleLoadPlanBuildingAssociationVisitationStrategy.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/internal/CascadeStyleLoadPlanBuildingAssociationVisitationStrategy.html#determineFetchStrategy-org.hibernate.persister.walking.spi.AssociationAttributeDefinition-">determineFetchStrategy</a></span>(<a href="../../../../org/hibernate/persister/walking/spi/AssociationAttributeDefinition.html" title="interface in org.hibernate.persister.walking.spi">AssociationAttributeDefinition</a>&nbsp;attributeDefinition)</code>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><code>protected abstract <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a></code></td> <td class="colLast"><span class="typeNameLabel">AbstractLoadPlanBuildingAssociationVisitationStrategy.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/internal/AbstractLoadPlanBuildingAssociationVisitationStrategy.html#determineFetchStrategy-org.hibernate.persister.walking.spi.AssociationAttributeDefinition-">determineFetchStrategy</a></span>(<a href="../../../../org/hibernate/persister/walking/spi/AssociationAttributeDefinition.html" title="interface in org.hibernate.persister.walking.spi">AssociationAttributeDefinition</a>&nbsp;attributeDefinition)</code>&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><code>protected <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a></code></td> <td class="colLast"><span class="typeNameLabel">FetchGraphLoadPlanBuildingStrategy.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/internal/FetchGraphLoadPlanBuildingStrategy.html#resolveImplicitFetchStrategyFromEntityGraph-org.hibernate.persister.walking.spi.AssociationAttributeDefinition-">resolveImplicitFetchStrategyFromEntityGraph</a></span>(<a href="../../../../org/hibernate/persister/walking/spi/AssociationAttributeDefinition.html" title="interface in org.hibernate.persister.walking.spi">AssociationAttributeDefinition</a>&nbsp;attributeDefinition)</code>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><code>protected abstract <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a></code></td> <td class="colLast"><span class="typeNameLabel">AbstractEntityGraphVisitationStrategy.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/internal/AbstractEntityGraphVisitationStrategy.html#resolveImplicitFetchStrategyFromEntityGraph-org.hibernate.persister.walking.spi.AssociationAttributeDefinition-">resolveImplicitFetchStrategyFromEntityGraph</a></span>(<a href="../../../../org/hibernate/persister/walking/spi/AssociationAttributeDefinition.html" title="interface in org.hibernate.persister.walking.spi">AssociationAttributeDefinition</a>&nbsp;attributeDefinition)</code>&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><code>protected <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a></code></td> <td class="colLast"><span class="typeNameLabel">LoadGraphLoadPlanBuildingStrategy.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/internal/LoadGraphLoadPlanBuildingStrategy.html#resolveImplicitFetchStrategyFromEntityGraph-org.hibernate.persister.walking.spi.AssociationAttributeDefinition-">resolveImplicitFetchStrategyFromEntityGraph</a></span>(<a href="../../../../org/hibernate/persister/walking/spi/AssociationAttributeDefinition.html" title="interface in org.hibernate.persister.walking.spi">AssociationAttributeDefinition</a>&nbsp;attributeDefinition)</code>&nbsp;</td> </tr> </tbody> </table> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../org/hibernate/loader/plan/build/internal/package-summary.html">org.hibernate.loader.plan.build.internal</a> with parameters of type <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>protected <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a></code></td> <td class="colLast"><span class="typeNameLabel">FetchStyleLoadPlanBuildingAssociationVisitationStrategy.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/internal/FetchStyleLoadPlanBuildingAssociationVisitationStrategy.html#adjustJoinFetchIfNeeded-org.hibernate.persister.walking.spi.AssociationAttributeDefinition-org.hibernate.engine.FetchStrategy-">adjustJoinFetchIfNeeded</a></span>(<a href="../../../../org/hibernate/persister/walking/spi/AssociationAttributeDefinition.html" title="interface in org.hibernate.persister.walking.spi">AssociationAttributeDefinition</a>&nbsp;attributeDefinition, <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a>&nbsp;fetchStrategy)</code> <div class="block">If required by this strategy, returns a different <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine"><code>FetchStrategy</code></a> from what is specified for the given association attribute.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>protected <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a></code></td> <td class="colLast"><span class="typeNameLabel">AbstractEntityGraphVisitationStrategy.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/internal/AbstractEntityGraphVisitationStrategy.html#adjustJoinFetchIfNeeded-org.hibernate.persister.walking.spi.AssociationAttributeDefinition-org.hibernate.engine.FetchStrategy-">adjustJoinFetchIfNeeded</a></span>(<a href="../../../../org/hibernate/persister/walking/spi/AssociationAttributeDefinition.html" title="interface in org.hibernate.persister.walking.spi">AssociationAttributeDefinition</a>&nbsp;attributeDefinition, <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a>&nbsp;fetchStrategy)</code>&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"><a name="org.hibernate.loader.plan.build.internal.returns"> <!-- --> </a> <h3>Uses of <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a> in <a href="../../../../org/hibernate/loader/plan/build/internal/returns/package-summary.html">org.hibernate.loader.plan.build.internal.returns</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing fields, and an explanation"> <caption><span>Fields in <a href="../../../../org/hibernate/loader/plan/build/internal/returns/package-summary.html">org.hibernate.loader.plan.build.internal.returns</a> declared as <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Field and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>protected static <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a></code></td> <td class="colLast"><span class="typeNameLabel">AbstractCompositeFetch.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/internal/returns/AbstractCompositeFetch.html#FETCH_STRATEGY">FETCH_STRATEGY</a></span></code>&nbsp;</td> </tr> </tbody> </table> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../org/hibernate/loader/plan/build/internal/returns/package-summary.html">org.hibernate.loader.plan.build.internal.returns</a> that return <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a></code></td> <td class="colLast"><span class="typeNameLabel">AbstractCompositeFetch.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/internal/returns/AbstractCompositeFetch.html#getFetchStrategy--">getFetchStrategy</a></span>()</code>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a></code></td> <td class="colLast"><span class="typeNameLabel">CollectionAttributeFetchImpl.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/internal/returns/CollectionAttributeFetchImpl.html#getFetchStrategy--">getFetchStrategy</a></span>()</code>&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a></code></td> <td class="colLast"><span class="typeNameLabel">AnyAttributeFetchImpl.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/internal/returns/AnyAttributeFetchImpl.html#getFetchStrategy--">getFetchStrategy</a></span>()</code>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a></code></td> <td class="colLast"><span class="typeNameLabel">EntityAttributeFetchImpl.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/internal/returns/EntityAttributeFetchImpl.html#getFetchStrategy--">getFetchStrategy</a></span>()</code>&nbsp;</td> </tr> </tbody> </table> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../org/hibernate/loader/plan/build/internal/returns/package-summary.html">org.hibernate.loader.plan.build.internal.returns</a> with parameters of type <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../org/hibernate/loader/plan/spi/AnyAttributeFetch.html" title="interface in org.hibernate.loader.plan.spi">AnyAttributeFetch</a></code></td> <td class="colLast"><span class="typeNameLabel">AbstractExpandingFetchSource.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/internal/returns/AbstractExpandingFetchSource.html#buildAnyAttributeFetch-org.hibernate.persister.walking.spi.AssociationAttributeDefinition-org.hibernate.engine.FetchStrategy-">buildAnyAttributeFetch</a></span>(<a href="../../../../org/hibernate/persister/walking/spi/AssociationAttributeDefinition.html" title="interface in org.hibernate.persister.walking.spi">AssociationAttributeDefinition</a>&nbsp;attributeDefinition, <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a>&nbsp;fetchStrategy)</code>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../org/hibernate/loader/plan/spi/BidirectionalEntityReference.html" title="interface in org.hibernate.loader.plan.spi">BidirectionalEntityReference</a></code></td> <td class="colLast"><span class="typeNameLabel">AbstractExpandingFetchSource.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/internal/returns/AbstractExpandingFetchSource.html#buildBidirectionalEntityReference-org.hibernate.persister.walking.spi.AssociationAttributeDefinition-org.hibernate.engine.FetchStrategy-org.hibernate.loader.plan.spi.EntityReference-">buildBidirectionalEntityReference</a></span>(<a href="../../../../org/hibernate/persister/walking/spi/AssociationAttributeDefinition.html" title="interface in org.hibernate.persister.walking.spi">AssociationAttributeDefinition</a>&nbsp;attributeDefinition, <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a>&nbsp;fetchStrategy, <a href="../../../../org/hibernate/loader/plan/spi/EntityReference.html" title="interface in org.hibernate.loader.plan.spi">EntityReference</a>&nbsp;targetEntityReference)</code>&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../org/hibernate/loader/plan/spi/CollectionAttributeFetch.html" title="interface in org.hibernate.loader.plan.spi">CollectionAttributeFetch</a></code></td> <td class="colLast"><span class="typeNameLabel">AbstractCompositeReference.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/internal/returns/AbstractCompositeReference.html#buildCollectionAttributeFetch-org.hibernate.persister.walking.spi.AssociationAttributeDefinition-org.hibernate.engine.FetchStrategy-">buildCollectionAttributeFetch</a></span>(<a href="../../../../org/hibernate/persister/walking/spi/AssociationAttributeDefinition.html" title="interface in org.hibernate.persister.walking.spi">AssociationAttributeDefinition</a>&nbsp;attributeDefinition, <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a>&nbsp;fetchStrategy)</code>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../org/hibernate/loader/plan/spi/CollectionAttributeFetch.html" title="interface in org.hibernate.loader.plan.spi">CollectionAttributeFetch</a></code></td> <td class="colLast"><span class="typeNameLabel">AbstractExpandingFetchSource.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/internal/returns/AbstractExpandingFetchSource.html#buildCollectionAttributeFetch-org.hibernate.persister.walking.spi.AssociationAttributeDefinition-org.hibernate.engine.FetchStrategy-">buildCollectionAttributeFetch</a></span>(<a href="../../../../org/hibernate/persister/walking/spi/AssociationAttributeDefinition.html" title="interface in org.hibernate.persister.walking.spi">AssociationAttributeDefinition</a>&nbsp;attributeDefinition, <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a>&nbsp;fetchStrategy)</code>&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../org/hibernate/loader/plan/spi/EntityFetch.html" title="interface in org.hibernate.loader.plan.spi">EntityFetch</a></code></td> <td class="colLast"><span class="typeNameLabel">AbstractExpandingFetchSource.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/internal/returns/AbstractExpandingFetchSource.html#buildEntityAttributeFetch-org.hibernate.persister.walking.spi.AssociationAttributeDefinition-org.hibernate.engine.FetchStrategy-">buildEntityAttributeFetch</a></span>(<a href="../../../../org/hibernate/persister/walking/spi/AssociationAttributeDefinition.html" title="interface in org.hibernate.persister.walking.spi">AssociationAttributeDefinition</a>&nbsp;attributeDefinition, <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a>&nbsp;fetchStrategy)</code>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><span class="typeNameLabel">EntityReturnImpl.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/internal/returns/EntityReturnImpl.html#validateFetchPlan-org.hibernate.engine.FetchStrategy-org.hibernate.persister.walking.spi.AttributeDefinition-">validateFetchPlan</a></span>(<a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a>&nbsp;fetchStrategy, <a href="../../../../org/hibernate/persister/walking/spi/AttributeDefinition.html" title="interface in org.hibernate.persister.walking.spi">AttributeDefinition</a>&nbsp;attributeDefinition)</code>&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><span class="typeNameLabel">AbstractCompositeReference.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/internal/returns/AbstractCompositeReference.html#validateFetchPlan-org.hibernate.engine.FetchStrategy-org.hibernate.persister.walking.spi.AttributeDefinition-">validateFetchPlan</a></span>(<a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a>&nbsp;fetchStrategy, <a href="../../../../org/hibernate/persister/walking/spi/AttributeDefinition.html" title="interface in org.hibernate.persister.walking.spi">AttributeDefinition</a>&nbsp;attributeDefinition)</code>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><span class="typeNameLabel">CollectionFetchableElementEntityGraph.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/internal/returns/CollectionFetchableElementEntityGraph.html#validateFetchPlan-org.hibernate.engine.FetchStrategy-org.hibernate.persister.walking.spi.AttributeDefinition-">validateFetchPlan</a></span>(<a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a>&nbsp;fetchStrategy, <a href="../../../../org/hibernate/persister/walking/spi/AttributeDefinition.html" title="interface in org.hibernate.persister.walking.spi">AttributeDefinition</a>&nbsp;attributeDefinition)</code>&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><span class="typeNameLabel">CollectionFetchableIndexEntityGraph.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/internal/returns/CollectionFetchableIndexEntityGraph.html#validateFetchPlan-org.hibernate.engine.FetchStrategy-org.hibernate.persister.walking.spi.AttributeDefinition-">validateFetchPlan</a></span>(<a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a>&nbsp;fetchStrategy, <a href="../../../../org/hibernate/persister/walking/spi/AttributeDefinition.html" title="interface in org.hibernate.persister.walking.spi">AttributeDefinition</a>&nbsp;attributeDefinition)</code>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><span class="typeNameLabel">EntityAttributeFetchImpl.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/internal/returns/EntityAttributeFetchImpl.html#validateFetchPlan-org.hibernate.engine.FetchStrategy-org.hibernate.persister.walking.spi.AttributeDefinition-">validateFetchPlan</a></span>(<a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a>&nbsp;fetchStrategy, <a href="../../../../org/hibernate/persister/walking/spi/AttributeDefinition.html" title="interface in org.hibernate.persister.walking.spi">AttributeDefinition</a>&nbsp;attributeDefinition)</code>&nbsp;</td> </tr> </tbody> </table> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing constructors, and an explanation"> <caption><span>Constructors in <a href="../../../../org/hibernate/loader/plan/build/internal/returns/package-summary.html">org.hibernate.loader.plan.build.internal.returns</a> with parameters of type <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colOne" scope="col">Constructor and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/internal/returns/AnyAttributeFetchImpl.html#AnyAttributeFetchImpl-org.hibernate.loader.plan.spi.FetchSource-org.hibernate.persister.walking.spi.AssociationAttributeDefinition-org.hibernate.engine.FetchStrategy-">AnyAttributeFetchImpl</a></span>(<a href="../../../../org/hibernate/loader/plan/spi/FetchSource.html" title="interface in org.hibernate.loader.plan.spi">FetchSource</a>&nbsp;fetchSource, <a href="../../../../org/hibernate/persister/walking/spi/AssociationAttributeDefinition.html" title="interface in org.hibernate.persister.walking.spi">AssociationAttributeDefinition</a>&nbsp;fetchedAttribute, <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a>&nbsp;fetchStrategy)</code>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/internal/returns/CollectionAttributeFetchImpl.html#CollectionAttributeFetchImpl-org.hibernate.loader.plan.build.spi.ExpandingFetchSource-org.hibernate.persister.walking.spi.AssociationAttributeDefinition-org.hibernate.engine.FetchStrategy-org.hibernate.loader.plan.build.spi.ExpandingCollectionQuerySpace-">CollectionAttributeFetchImpl</a></span>(<a href="../../../../org/hibernate/loader/plan/build/spi/ExpandingFetchSource.html" title="interface in org.hibernate.loader.plan.build.spi">ExpandingFetchSource</a>&nbsp;fetchSource, <a href="../../../../org/hibernate/persister/walking/spi/AssociationAttributeDefinition.html" title="interface in org.hibernate.persister.walking.spi">AssociationAttributeDefinition</a>&nbsp;fetchedAttribute, <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a>&nbsp;fetchStrategy, <a href="../../../../org/hibernate/loader/plan/build/spi/ExpandingCollectionQuerySpace.html" title="interface in org.hibernate.loader.plan.build.spi">ExpandingCollectionQuerySpace</a>&nbsp;collectionQuerySpace)</code>&nbsp;</td> </tr> <tr class="altColor"> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/internal/returns/EntityAttributeFetchImpl.html#EntityAttributeFetchImpl-org.hibernate.loader.plan.build.spi.ExpandingFetchSource-org.hibernate.persister.walking.spi.AssociationAttributeDefinition-org.hibernate.engine.FetchStrategy-org.hibernate.loader.plan.build.spi.ExpandingEntityQuerySpace-">EntityAttributeFetchImpl</a></span>(<a href="../../../../org/hibernate/loader/plan/build/spi/ExpandingFetchSource.html" title="interface in org.hibernate.loader.plan.build.spi">ExpandingFetchSource</a>&nbsp;fetchSource, <a href="../../../../org/hibernate/persister/walking/spi/AssociationAttributeDefinition.html" title="interface in org.hibernate.persister.walking.spi">AssociationAttributeDefinition</a>&nbsp;fetchedAttribute, <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a>&nbsp;fetchStrategy, <a href="../../../../org/hibernate/loader/plan/build/spi/ExpandingEntityQuerySpace.html" title="interface in org.hibernate.loader.plan.build.spi">ExpandingEntityQuerySpace</a>&nbsp;entityQuerySpace)</code>&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"><a name="org.hibernate.loader.plan.build.internal.spaces"> <!-- --> </a> <h3>Uses of <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a> in <a href="../../../../org/hibernate/loader/plan/build/internal/spaces/package-summary.html">org.hibernate.loader.plan.build.internal.spaces</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../org/hibernate/loader/plan/build/internal/spaces/package-summary.html">org.hibernate.loader.plan.build.internal.spaces</a> with parameters of type <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../org/hibernate/loader/plan/build/spi/ExpandingCollectionQuerySpace.html" title="interface in org.hibernate.loader.plan.build.spi">ExpandingCollectionQuerySpace</a></code></td> <td class="colLast"><span class="typeNameLabel">QuerySpaceHelper.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/internal/spaces/QuerySpaceHelper.html#makeCollectionQuerySpace-org.hibernate.loader.plan.build.spi.ExpandingQuerySpace-org.hibernate.persister.walking.spi.AssociationAttributeDefinition-java.lang.String-org.hibernate.engine.FetchStrategy-">makeCollectionQuerySpace</a></span>(<a href="../../../../org/hibernate/loader/plan/build/spi/ExpandingQuerySpace.html" title="interface in org.hibernate.loader.plan.build.spi">ExpandingQuerySpace</a>&nbsp;lhsQuerySpace, <a href="../../../../org/hibernate/persister/walking/spi/AssociationAttributeDefinition.html" title="interface in org.hibernate.persister.walking.spi">AssociationAttributeDefinition</a>&nbsp;attributeDefinition, <a href="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;querySpaceUid, <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a>&nbsp;fetchStrategy)</code>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../org/hibernate/loader/plan/build/spi/ExpandingEntityQuerySpace.html" title="interface in org.hibernate.loader.plan.build.spi">ExpandingEntityQuerySpace</a></code></td> <td class="colLast"><span class="typeNameLabel">QuerySpaceHelper.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/internal/spaces/QuerySpaceHelper.html#makeEntityQuerySpace-org.hibernate.loader.plan.build.spi.ExpandingQuerySpace-org.hibernate.persister.walking.spi.AssociationAttributeDefinition-java.lang.String-org.hibernate.engine.FetchStrategy-">makeEntityQuerySpace</a></span>(<a href="../../../../org/hibernate/loader/plan/build/spi/ExpandingQuerySpace.html" title="interface in org.hibernate.loader.plan.build.spi">ExpandingQuerySpace</a>&nbsp;lhsQuerySpace, <a href="../../../../org/hibernate/persister/walking/spi/AssociationAttributeDefinition.html" title="interface in org.hibernate.persister.walking.spi">AssociationAttributeDefinition</a>&nbsp;attribute, <a href="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;querySpaceUid, <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a>&nbsp;fetchStrategy)</code>&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><code>boolean</code></td> <td class="colLast"><span class="typeNameLabel">QuerySpaceHelper.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/internal/spaces/QuerySpaceHelper.html#shouldIncludeJoin-org.hibernate.engine.FetchStrategy-">shouldIncludeJoin</a></span>(<a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a>&nbsp;fetchStrategy)</code>&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"><a name="org.hibernate.loader.plan.build.spi"> <!-- --> </a> <h3>Uses of <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a> in <a href="../../../../org/hibernate/loader/plan/build/spi/package-summary.html">org.hibernate.loader.plan.build.spi</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../org/hibernate/loader/plan/build/spi/package-summary.html">org.hibernate.loader.plan.build.spi</a> with parameters of type <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../org/hibernate/loader/plan/spi/AnyAttributeFetch.html" title="interface in org.hibernate.loader.plan.spi">AnyAttributeFetch</a></code></td> <td class="colLast"><span class="typeNameLabel">ExpandingFetchSource.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/spi/ExpandingFetchSource.html#buildAnyAttributeFetch-org.hibernate.persister.walking.spi.AssociationAttributeDefinition-org.hibernate.engine.FetchStrategy-">buildAnyAttributeFetch</a></span>(<a href="../../../../org/hibernate/persister/walking/spi/AssociationAttributeDefinition.html" title="interface in org.hibernate.persister.walking.spi">AssociationAttributeDefinition</a>&nbsp;attributeDefinition, <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a>&nbsp;fetchStrategy)</code> <div class="block">Builds a fetch for an "any" attribute.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../org/hibernate/loader/plan/spi/BidirectionalEntityReference.html" title="interface in org.hibernate.loader.plan.spi">BidirectionalEntityReference</a></code></td> <td class="colLast"><span class="typeNameLabel">ExpandingFetchSource.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/spi/ExpandingFetchSource.html#buildBidirectionalEntityReference-org.hibernate.persister.walking.spi.AssociationAttributeDefinition-org.hibernate.engine.FetchStrategy-org.hibernate.loader.plan.spi.EntityReference-">buildBidirectionalEntityReference</a></span>(<a href="../../../../org/hibernate/persister/walking/spi/AssociationAttributeDefinition.html" title="interface in org.hibernate.persister.walking.spi">AssociationAttributeDefinition</a>&nbsp;attributeDefinition, <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a>&nbsp;fetchStrategy, <a href="../../../../org/hibernate/loader/plan/spi/EntityReference.html" title="interface in org.hibernate.loader.plan.spi">EntityReference</a>&nbsp;targetEntityReference)</code> <div class="block">Builds a bidirectional entity reference for an entity attribute.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../org/hibernate/loader/plan/spi/CollectionAttributeFetch.html" title="interface in org.hibernate.loader.plan.spi">CollectionAttributeFetch</a></code></td> <td class="colLast"><span class="typeNameLabel">ExpandingFetchSource.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/spi/ExpandingFetchSource.html#buildCollectionAttributeFetch-org.hibernate.persister.walking.spi.AssociationAttributeDefinition-org.hibernate.engine.FetchStrategy-">buildCollectionAttributeFetch</a></span>(<a href="../../../../org/hibernate/persister/walking/spi/AssociationAttributeDefinition.html" title="interface in org.hibernate.persister.walking.spi">AssociationAttributeDefinition</a>&nbsp;attributeDefinition, <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a>&nbsp;fetchStrategy)</code> <div class="block">Builds a fetch for a collection attribute.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../org/hibernate/loader/plan/spi/EntityFetch.html" title="interface in org.hibernate.loader.plan.spi">EntityFetch</a></code></td> <td class="colLast"><span class="typeNameLabel">ExpandingFetchSource.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/spi/ExpandingFetchSource.html#buildEntityAttributeFetch-org.hibernate.persister.walking.spi.AssociationAttributeDefinition-org.hibernate.engine.FetchStrategy-">buildEntityAttributeFetch</a></span>(<a href="../../../../org/hibernate/persister/walking/spi/AssociationAttributeDefinition.html" title="interface in org.hibernate.persister.walking.spi">AssociationAttributeDefinition</a>&nbsp;attributeDefinition, <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a>&nbsp;fetchStrategy)</code> <div class="block">Builds a fetch for an entity attribute.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><span class="typeNameLabel">ExpandingFetchSource.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/build/spi/ExpandingFetchSource.html#validateFetchPlan-org.hibernate.engine.FetchStrategy-org.hibernate.persister.walking.spi.AttributeDefinition-">validateFetchPlan</a></span>(<a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a>&nbsp;fetchStrategy, <a href="../../../../org/hibernate/persister/walking/spi/AttributeDefinition.html" title="interface in org.hibernate.persister.walking.spi">AttributeDefinition</a>&nbsp;attributeDefinition)</code> <div class="block">Is the asserted plan valid from this owner to a fetch?</div> </td> </tr> </tbody> </table> </li> <li class="blockList"><a name="org.hibernate.loader.plan.spi"> <!-- --> </a> <h3>Uses of <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a> in <a href="../../../../org/hibernate/loader/plan/spi/package-summary.html">org.hibernate.loader.plan.spi</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../org/hibernate/loader/plan/spi/package-summary.html">org.hibernate.loader.plan.spi</a> that return <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a></code></td> <td class="colLast"><span class="typeNameLabel">Fetch.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/loader/plan/spi/Fetch.html#getFetchStrategy--">getFetchStrategy</a></span>()</code> <div class="block">Gets the fetch strategy for this fetch.</div> </td> </tr> </tbody> </table> </li> <li class="blockList"><a name="org.hibernate.persister.walking.internal"> <!-- --> </a> <h3>Uses of <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a> in <a href="../../../../org/hibernate/persister/walking/internal/package-summary.html">org.hibernate.persister.walking.internal</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../org/hibernate/persister/walking/internal/package-summary.html">org.hibernate.persister.walking.internal</a> with parameters of type <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>static boolean</code></td> <td class="colLast"><span class="typeNameLabel">FetchStrategyHelper.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/persister/walking/internal/FetchStrategyHelper.html#isJoinFetched-org.hibernate.engine.FetchStrategy-">isJoinFetched</a></span>(<a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a>&nbsp;fetchStrategy)</code>&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"><a name="org.hibernate.persister.walking.spi"> <!-- --> </a> <h3>Uses of <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a> in <a href="../../../../org/hibernate/persister/walking/spi/package-summary.html">org.hibernate.persister.walking.spi</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../org/hibernate/persister/walking/spi/package-summary.html">org.hibernate.persister.walking.spi</a> that return <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a></code></td> <td class="colLast"><span class="typeNameLabel">AssociationAttributeDefinition.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/persister/walking/spi/AssociationAttributeDefinition.html#determineFetchPlan-org.hibernate.engine.spi.LoadQueryInfluencers-org.hibernate.loader.PropertyPath-">determineFetchPlan</a></span>(<a href="../../../../org/hibernate/engine/spi/LoadQueryInfluencers.html" title="class in org.hibernate.engine.spi">LoadQueryInfluencers</a>&nbsp;loadQueryInfluencers, <a href="../../../../org/hibernate/loader/PropertyPath.html" title="class in org.hibernate.loader">PropertyPath</a>&nbsp;propertyPath)</code>&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"><a name="org.hibernate.tuple.component"> <!-- --> </a> <h3>Uses of <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a> in <a href="../../../../org/hibernate/tuple/component/package-summary.html">org.hibernate.tuple.component</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../org/hibernate/tuple/component/package-summary.html">org.hibernate.tuple.component</a> that return <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a></code></td> <td class="colLast"><span class="typeNameLabel">CompositeBasedAssociationAttribute.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/tuple/component/CompositeBasedAssociationAttribute.html#determineFetchPlan-org.hibernate.engine.spi.LoadQueryInfluencers-org.hibernate.loader.PropertyPath-">determineFetchPlan</a></span>(<a href="../../../../org/hibernate/engine/spi/LoadQueryInfluencers.html" title="class in org.hibernate.engine.spi">LoadQueryInfluencers</a>&nbsp;loadQueryInfluencers, <a href="../../../../org/hibernate/loader/PropertyPath.html" title="class in org.hibernate.loader">PropertyPath</a>&nbsp;propertyPath)</code>&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"><a name="org.hibernate.tuple.entity"> <!-- --> </a> <h3>Uses of <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a> in <a href="../../../../org/hibernate/tuple/entity/package-summary.html">org.hibernate.tuple.entity</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../org/hibernate/tuple/entity/package-summary.html">org.hibernate.tuple.entity</a> that return <a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">FetchStrategy</a></code></td> <td class="colLast"><span class="typeNameLabel">EntityBasedAssociationAttribute.</span><code><span class="memberNameLink"><a href="../../../../org/hibernate/tuple/entity/EntityBasedAssociationAttribute.html#determineFetchPlan-org.hibernate.engine.spi.LoadQueryInfluencers-org.hibernate.loader.PropertyPath-">determineFetchPlan</a></span>(<a href="../../../../org/hibernate/engine/spi/LoadQueryInfluencers.html" title="class in org.hibernate.engine.spi">LoadQueryInfluencers</a>&nbsp;loadQueryInfluencers, <a href="../../../../org/hibernate/loader/PropertyPath.html" title="class in org.hibernate.loader">PropertyPath</a>&nbsp;propertyPath)</code>&nbsp;</td> </tr> </tbody> </table> </li> </ul> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../org/hibernate/engine/FetchStrategy.html" title="class in org.hibernate.engine">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../../../../overview-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../index.html?org/hibernate/engine/class-use/FetchStrategy.html" target="_top">Frames</a></li> <li><a href="FetchStrategy.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small>Copyright &copy; 2001-2016 <a href="http://redhat.com">Red Hat, Inc.</a> All Rights Reserved.</small></p> </body> </html>
lgpl-2.1
jjulien/augeas-gitolite
Makefile
327
DESTDIR = "/" LENS_DEST = "$(DESTDIR)/usr/share/augeas/lenses" LENS_TEST_DEST = "$(LENS_DEST)/tests" install: install -d -m0755 $(LENS_DEST) install -d -m0755 $(LENS_TEST_DEST) install -m0644 gitolite.aug $(LENS_DEST) install -m0644 tests/test_gitolite.aug $(LENS_TEST_DEST) test: augparse -I . tests/test_gitolite.aug
lgpl-2.1
kobolabs/qt-everywhere-4.8.0
doc/html/qstyleoptioncombobox.html
12013
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qstyleoption.cpp --> <title>Qt 4.8: QStyleOptionComboBox Class Reference</title> <link rel="stylesheet" type="text/css" href="style/offline.css" /> </head> <body> <div class="header" id="qtdocheader"> <div class="content"> <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a> </div> <div class="breadcrumb toolblock"> <ul> <li class="first"><a href="index.html">Home</a></li> <!-- Breadcrumbs go here --> <li><a href="modules.html">Modules</a></li> <li><a href="qtgui.html">QtGui</a></li> <li>QStyleOptionComboBox</li> </ul> </div> </div> <div class="content mainContent"> <div class="toc"> <h3><a name="toc">Contents</a></h3> <ul> <li class="level1"><a href="#public-types">Public Types</a></li> <li class="level1"><a href="#public-functions">Public Functions</a></li> <li class="level1"><a href="#public-variables">Public Variables</a></li> <li class="level1"><a href="#details">Detailed Description</a></li> </ul> </div> <h1 class="title">QStyleOptionComboBox Class Reference</h1> <!-- $$$QStyleOptionComboBox-brief --> <p>The QStyleOptionComboBox class is used to describe the parameter for drawing a combobox. <a href="#details">More...</a></p> <!-- @@@QStyleOptionComboBox --> <pre class="cpp"> <span class="preprocessor">#include &lt;QStyleOptionComboBox&gt;</span></pre><p><b>Inherits: </b><a href="qstyleoptioncomplex.html">QStyleOptionComplex</a>.</p> <p><b>Inherited by: </b></p> <ul> <li><a href="qstyleoptioncombobox-members.html">List of all members, including inherited members</a></li> </ul> <a name="public-types"></a> <h2>Public Types</h2> <table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qstyleoptioncombobox.html#StyleOptionType-enum">StyleOptionType</a></b> { Type }</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qstyleoptioncombobox.html#StyleOptionVersion-enum">StyleOptionVersion</a></b> { Version }</td></tr> </table> <a name="public-functions"></a> <h2>Public Functions</h2> <table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qstyleoptioncombobox.html#QStyleOptionComboBox">QStyleOptionComboBox</a></b> ()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qstyleoptioncombobox.html#QStyleOptionComboBox-2">QStyleOptionComboBox</a></b> ( const QStyleOptionComboBox &amp; <i>other</i> )</td></tr> </table> <ul> <li class="fn">2 public functions inherited from <a href="qstyleoption.html#public-functions">QStyleOption</a></li> </ul> <a name="public-variables"></a> <h2>Public Variables</h2> <table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> QIcon </td><td class="memItemRight bottomAlign"><b><a href="qstyleoptioncombobox.html#currentIcon-var">currentIcon</a></b></td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstyleoptioncombobox.html#currentText-var">currentText</a></b></td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstyleoptioncombobox.html#editable-var">editable</a></b></td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstyleoptioncombobox.html#frame-var">frame</a></b></td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QSize </td><td class="memItemRight bottomAlign"><b><a href="qstyleoptioncombobox.html#iconSize-var">iconSize</a></b></td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QRect </td><td class="memItemRight bottomAlign"><b><a href="qstyleoptioncombobox.html#popupRect-var">popupRect</a></b></td></tr> </table> <ul> <li class="fn">2 public variables inherited from <a href="qstyleoptioncomplex.html#public-variables">QStyleOptionComplex</a></li> <li class="fn">7 public variables inherited from <a href="qstyleoption.html#public-variables">QStyleOption</a></li> </ul> <a name="details"></a> <!-- $$$QStyleOptionComboBox-description --> <div class="descr"> <h2>Detailed Description</h2> <p>The QStyleOptionComboBox class is used to describe the parameter for drawing a combobox.</p> <p><a href="qstyleoptionbutton.html">QStyleOptionButton</a> contains all the information that <a href="qstyle.html">QStyle</a> functions need to draw <a href="qcombobox.html">QComboBox</a>.</p> <p>For performance reasons, the access to the member variables is direct (i.e&#x2e;, using the <tt>.</tt> or <tt>-&gt;</tt> operator). This low-level feel makes the structures straightforward to use and emphasizes that these are simply parameters used by the style functions.</p> <p>For an example demonstrating how style options can be used, see the <a href="widgets-styles.html">Styles</a> example.</p> </div> <p><b>See also </b><a href="qstyleoption.html">QStyleOption</a>, <a href="qstyleoptioncomplex.html">QStyleOptionComplex</a>, and <a href="qcombobox.html">QComboBox</a>.</p> <!-- @@@QStyleOptionComboBox --> <div class="types"> <h2>Member Type Documentation</h2> <!-- $$$StyleOptionType$$$Type --> <h3 class="fn"><a name="StyleOptionType-enum"></a>enum QStyleOptionComboBox::<span class="name">StyleOptionType</span></h3> <p>This enum is used to hold information about the type of the style option, and is defined for each <a href="qstyleoption.html">QStyleOption</a> subclass.</p> <table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr> <tr><td class="topAlign"><tt>QStyleOptionComboBox::Type</tt></td><td class="topAlign"><tt>SO_ComboBox</tt></td><td class="topAlign">The type of style option provided (<a href="qstyleoption.html#OptionType-enum">SO_ComboBox</a> for this class).</td></tr> </table> <p>The type is used internally by <a href="qstyleoption.html">QStyleOption</a>, its subclasses, and <a href="qstyleoption.html#qstyleoption_cast">qstyleoption_cast</a>() to determine the type of style option. In general you do not need to worry about this unless you want to create your own <a href="qstyleoption.html">QStyleOption</a> subclass and your own styles.</p> <p><b>See also </b><a href="qstyleoptioncombobox.html#StyleOptionVersion-enum">StyleOptionVersion</a>.</p> <!-- @@@StyleOptionType --> <!-- $$$StyleOptionVersion$$$Version --> <h3 class="fn"><a name="StyleOptionVersion-enum"></a>enum QStyleOptionComboBox::<span class="name">StyleOptionVersion</span></h3> <p>This enum is used to hold information about the version of the style option, and is defined for each <a href="qstyleoption.html">QStyleOption</a> subclass.</p> <table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr> <tr><td class="topAlign"><tt>QStyleOptionComboBox::Version</tt></td><td class="topAlign"><tt>1</tt></td><td class="topAlign">1</td></tr> </table> <p>The version is used by <a href="qstyleoption.html">QStyleOption</a> subclasses to implement extensions without breaking compatibility. If you use <a href="qstyleoption.html#qstyleoption_cast">qstyleoption_cast</a>(), you normally do not need to check it.</p> <p><b>See also </b><a href="qstyleoptioncombobox.html#StyleOptionType-enum">StyleOptionType</a>.</p> <!-- @@@StyleOptionVersion --> </div> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$QStyleOptionComboBox[overload1]$$$QStyleOptionComboBox --> <h3 class="fn"><a name="QStyleOptionComboBox"></a>QStyleOptionComboBox::<span class="name">QStyleOptionComboBox</span> ()</h3> <p>Creates a <a href="qstyleoptioncombobox.html">QStyleOptionComboBox</a>, initializing the members variables to their default values.</p> <!-- @@@QStyleOptionComboBox --> <!-- $$$QStyleOptionComboBox$$$QStyleOptionComboBoxconstQStyleOptionComboBox& --> <h3 class="fn"><a name="QStyleOptionComboBox-2"></a>QStyleOptionComboBox::<span class="name">QStyleOptionComboBox</span> ( const <span class="type">QStyleOptionComboBox</span> &amp; <i>other</i> )</h3> <p>Constructs a copy of the <i>other</i> style option.</p> <!-- @@@QStyleOptionComboBox --> </div> <div class="vars"> <h2>Member Variable Documentation</h2> <!-- $$$currentIcon --> <h3 class="fn"><a name="currentIcon-var"></a><span class="type"><a href="qicon.html">QIcon</a></span> QStyleOptionComboBox::<span class="name">currentIcon</span></h3> <p>This variable holds the icon for the current item of the combo box.</p> <p>The default value is an empty icon, i.e&#x2e; an icon with neither a pixmap nor a filename.</p> <!-- @@@currentIcon --> <!-- $$$currentText --> <h3 class="fn"><a name="currentText-var"></a><span class="type"><a href="qstring.html">QString</a></span> QStyleOptionComboBox::<span class="name">currentText</span></h3> <p>This variable holds the text for the current item of the combo box.</p> <p>The default value is an empty string.</p> <!-- @@@currentText --> <!-- $$$editable --> <h3 class="fn"><a name="editable-var"></a><span class="type">bool</span> QStyleOptionComboBox::<span class="name">editable</span></h3> <p>This variable holds whether or not the combobox is editable or not.</p> <p>the default value is false</p> <p><b>See also </b><a href="qcombobox.html#editable-prop">QComboBox::isEditable</a>().</p> <!-- @@@editable --> <!-- $$$frame --> <h3 class="fn"><a name="frame-var"></a><span class="type">bool</span> QStyleOptionComboBox::<span class="name">frame</span></h3> <p>This variable holds whether the combo box has a frame.</p> <p>The default value is true.</p> <!-- @@@frame --> <!-- $$$iconSize --> <h3 class="fn"><a name="iconSize-var"></a><span class="type"><a href="qsize.html">QSize</a></span> QStyleOptionComboBox::<span class="name">iconSize</span></h3> <p>This variable holds the icon size for the current item of the combo box.</p> <p>The default value is <a href="qsize.html">QSize</a>(-1, -1), i.e&#x2e; an invalid size.</p> <!-- @@@iconSize --> <!-- $$$popupRect --> <h3 class="fn"><a name="popupRect-var"></a><span class="type"><a href="qrect.html">QRect</a></span> QStyleOptionComboBox::<span class="name">popupRect</span></h3> <p>This variable holds the popup rectangle for the combobox.</p> <p>The default value is a null rectangle, i.e&#x2e; a rectangle with both the width and the height set to 0.</p> <p>This variable is currently unused. You can safely ignore it.</p> <p><b>See also </b><a href="qstyle.html#SubControl-enum">QStyle::SC_ComboBoxListBoxPopup</a>.</p> <!-- @@@popupRect --> </div> <div class="ft"> <span></span> </div> </div> <div class="footer"> <p> <acronym title="Copyright">&copy;</acronym> 2008-2011 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide.</p> <p> All other trademarks are property of their respective owners. <a title="Privacy Policy" href="http://qt.nokia.com/about/privacy-policy">Privacy Policy</a></p> <br /> <p> Licensees holding valid Qt Commercial licenses may use this document in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia.</p> <p> Alternatively, this document may be used under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.</p> </div> </body> </html>
lgpl-2.1
herve-quiroz/tc-common
src/main/java/org/trancecode/collection/TcSets.java
2646
/* * Copyright (C) 2010 Herve Quiroz * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package org.trancecode.collection; import com.google.common.base.Preconditions; import com.google.common.base.Predicates; import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet.Builder; import com.google.common.collect.Iterables; import java.util.Set; /** * Utility methods related to {@link Set}. * * @author Herve Quiroz */ public final class TcSets { public static <T> ImmutableSet<T> immutableSet(final Iterable<T> set, final T element) { Preconditions.checkNotNull(set); Preconditions.checkNotNull(element); if (set instanceof Set && ((Set<?>) set).contains(element)) { return ImmutableSet.copyOf(set); } final Builder<T> builder = ImmutableSet.builder(); return builder.addAll(set).add(element).build(); } public static <T> ImmutableSet<T> immutableSet(final Set<T> set1, final Set<T> set2) { Preconditions.checkNotNull(set1); Preconditions.checkNotNull(set2); if (set1.isEmpty()) { return ImmutableSet.copyOf(set2); } if (set2.isEmpty()) { return ImmutableSet.copyOf(set1); } final Builder<T> builder = ImmutableSet.builder(); return builder.addAll(set1).addAll(set2).build(); } public static <T> ImmutableSet<T> immutableSetWithout(final Iterable<T> elements, final T element) { Preconditions.checkNotNull(elements); Preconditions.checkNotNull(element); if (elements instanceof Set && !((Set<?>) elements).contains(element)) { return ImmutableSet.copyOf(elements); } return ImmutableSet.copyOf(Iterables.filter(elements, Predicates.not(Predicates.equalTo(element)))); } private TcSets() { // No instantiation } }
lgpl-2.1
dknez/libmesh
include/systems/system.h
73584
// The libMesh Finite Element Library. // Copyright (C) 2002-2016 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #ifndef LIBMESH_SYSTEM_H #define LIBMESH_SYSTEM_H // Local Includes #include "libmesh/auto_ptr.h" #include "libmesh/elem_range.h" #include "libmesh/enum_norm_type.h" #include "libmesh/enum_xdr_mode.h" #include "libmesh/enum_subset_solve_mode.h" #include "libmesh/enum_parallel_type.h" #include "libmesh/fem_function_base.h" #include "libmesh/libmesh_common.h" #include "libmesh/parallel_object.h" #include "libmesh/qoi_set.h" #include "libmesh/reference_counted_object.h" #include "libmesh/tensor_value.h" // For point_hessian #include "libmesh/variable.h" // C++ includes #include <cstddef> #include <set> #include <vector> namespace libMesh { // Forward Declarations class System; class EquationSystems; class MeshBase; class Xdr; class DofMap; template <typename Output> class FunctionBase; class Parameters; class ParameterVector; class Point; class SensitivityData; template <typename T> class NumericVector; template <typename T> class VectorValue; typedef VectorValue<Number> NumberVectorValue; typedef NumberVectorValue Gradient; class SystemSubset; class FEType; class SystemNorm; /** * This is the base class for classes which contain * information related to any physical process that might be simulated. * Such information may range from the actual solution values to * algorithmic flags that may be used to control the numerical methods * employed. In general, use an \p EqnSystems<T_sys> object to handle * one or more of the children of this class. * Note that templating \p EqnSystems relaxes the use of virtual members. * * \author Benjamin S. Kirk * \date 2003-2004 */ class System : public ReferenceCountedObject<System>, public ParallelObject { public: /** * Constructor. Optionally initializes required * data structures. */ System (EquationSystems & es, const std::string & name, const unsigned int number); /** * Abstract base class to be used for sysem initialization. * A user class derived from this class may be used to * intialize the system values by attaching an object * with the method \p attach_init_object. */ class Initialization { public: /** * Destructor. Virtual because we will have virtual functions. */ virtual ~Initialization () {} /** * Initialization function. This function will be called * to initialize the system values upon creation and must * be provided by the user in a derived class. */ virtual void initialize () = 0; }; /** * Abstract base class to be used for sysem assembly. * A user class derived from this class may be used to * assemble the system by attaching an object * with the method \p attach_assemble_object. */ class Assembly { public: /** * Destructor. Virtual because we will have virtual functions. */ virtual ~Assembly () {} /** * Assembly function. This function will be called * to assemble the system prior to a solve and must * be provided by the user in a derived class. */ virtual void assemble () = 0; }; /** * Abstract base class to be used for sysem constraints. * A user class derived from this class may be used to * constrain the system by attaching an object * with the method \p attach_constraint_object. */ class Constraint { public: /** * Destructor. Virtual because we will have virtual functions. */ virtual ~Constraint () {} /** * Constraint function. This function will be called * to constrain the system prior to a solve and must * be provided by the user in a derived class. */ virtual void constrain () = 0; }; /** * Abstract base class to be used for quantities of interest. * A user class derived from this class may be used to * compute quantities of interest by attaching an object * with the method \p attach_QOI_object. */ class QOI { public: /** * Destructor. Virtual because we will have virtual functions. */ virtual ~QOI () {} /** * Quantitiy of interest function. This function will be called * to compute quantities of interest and must be provided by the * user in a derived class. */ virtual void qoi (const QoISet & qoi_indices) = 0; }; /** * Abstract base class to be used for derivatives of quantities * of interest. A user class derived from this class may be used * to compute quantities of interest by attaching an object * with the method \p attach_QOI_derivative_object. */ class QOIDerivative { public: /** * Destructor. Virtual because we will have virtual functions. */ virtual ~QOIDerivative () {} /** * Quantitiy of interest derivative function. This function will * be called to compute derivatived of quantities of interest and * must be provided by the user in a derived class. */ virtual void qoi_derivative (const QoISet & qoi_indices, bool include_liftfunc, bool apply_constraints) = 0; }; /** * Destructor. */ virtual ~System (); /** * The type of system. */ typedef System sys_type; /** * @returns a clever pointer to the system. */ sys_type & system () { return *this; } /** * Clear all the data structures associated with * the system. */ virtual void clear (); /** * Initializes degrees of freedom on the current mesh. * Sets the */ void init (); /** * Reinitializes degrees of freedom and other * required data on the current mesh. Note that the matrix * is not initialized at this time since it may not be required * for all applications. @e Should be overloaded in derived classes. */ virtual void reinit (); /** * Reinitializes the constraints for this system. */ virtual void reinit_constraints (); /** * Returns true iff this system has been initialized. */ bool is_initialized(); /** * Update the local values to reflect the solution * on neighboring processors. */ virtual void update (); /** * Prepares \p matrix and \p _dof_map for matrix assembly. * Does not actually assemble anything. For matrix assembly, * use the \p assemble() in derived classes. * @e Should be overloaded in derived classes. */ virtual void assemble (); /** * Calls user qoi function. * @e Can be overloaded in derived classes. */ virtual void assemble_qoi (const QoISet & qoi_indices = QoISet()); /** * Calls user qoi derivative function. * @e Can be overloaded in derived classes. */ virtual void assemble_qoi_derivative (const QoISet & qoi_indices = QoISet(), bool include_liftfunc = true, bool apply_constraints = true); /** * Calls residual parameter derivative function. * * Library subclasses use finite differences by default. * * This should assemble the sensitivity rhs vectors to hold * -(partial R / partial p_i), making them ready to solve * the forward sensitivity equation. * * This method is only implemented in some derived classes. */ virtual void assemble_residual_derivatives (const ParameterVector & parameters); /** * After calling this method, any solve will be restricted to the * given subdomain. To disable this mode, call this method with \p * subset being a \p NULL pointer. */ virtual void restrict_solve_to (const SystemSubset * subset, const SubsetSolveMode subset_solve_mode=SUBSET_ZERO); /** * Solves the system. Should be overloaded in derived systems. */ virtual void solve () {} /** * Solves the sensitivity system, for the provided parameters. * Must be overloaded in derived systems. * * Returns a pair with the total number of linear iterations * performed and the (sum of the) final residual norms * * This method is only implemented in some derived classes. */ virtual std::pair<unsigned int, Real> sensitivity_solve (const ParameterVector & parameters); /** * Assembles & solves the linear system(s) (dR/du)*u_w = sum(w_p*-dR/dp), for * those parameters p contained within \p parameters weighted by the * values w_p found within \p weights. * * Returns a pair with the total number of linear iterations * performed and the (sum of the) final residual norms * * This method is only implemented in some derived classes. */ virtual std::pair<unsigned int, Real> weighted_sensitivity_solve (const ParameterVector & parameters, const ParameterVector & weights); /** * Solves the adjoint system, for the specified qoi indices, or for * every qoi if \p qoi_indices is NULL. Must be overloaded in * derived systems. * * Returns a pair with the total number of linear iterations * performed and the (sum of the) final residual norms * * This method is only implemented in some derived classes. */ virtual std::pair<unsigned int, Real> adjoint_solve (const QoISet & qoi_indices = QoISet()); /** * Assembles & solves the linear system(s) * (dR/du)^T*z_w = sum(w_p*(d^2q/dudp - d^2R/dudp*z)), for those * parameters p contained within \p parameters, weighted by the * values w_p found within \p weights. * * Assumes that adjoint_solve has already calculated z for each qoi * in \p qoi_indices. * * Returns a pair with the total number of linear iterations * performed and the (sum of the) final residual norms * * This method is only implemented in some derived classes. */ virtual std::pair<unsigned int, Real> weighted_sensitivity_adjoint_solve (const ParameterVector & parameters, const ParameterVector & weights, const QoISet & qoi_indices = QoISet()); /** * Accessor for the adjoint_already_solved boolean */ bool is_adjoint_already_solved() const { return adjoint_already_solved;} /** * Setter for the adjoint_already_solved boolean */ void set_adjoint_already_solved(bool setting) { adjoint_already_solved = setting;} /** * Solves for the derivative of each of the system's quantities of * interest q in \p qoi[qoi_indices] with respect to each parameter * in \p parameters, placing the result for qoi \p i and parameter * \p j into \p sensitivities[i][j]. * * Note that parameters is a const vector, not a vector-of-const; * parameter values in this vector need to be mutable for finite * differencing to work. * * Automatically chooses the forward method for problems with more * quantities of interest than parameters, or the adjoint method * otherwise. * * This method is only usable in derived classes which overload * an implementation. */ virtual void qoi_parameter_sensitivity (const QoISet & qoi_indices, const ParameterVector & parameters, SensitivityData & sensitivities); /** * Solves for parameter sensitivities using the adjoint method. * * This method is only implemented in some derived classes. */ virtual void adjoint_qoi_parameter_sensitivity (const QoISet & qoi_indices, const ParameterVector & parameters, SensitivityData & sensitivities); /** * Solves for parameter sensitivities using the forward method. * * This method is only implemented in some derived classes. */ virtual void forward_qoi_parameter_sensitivity (const QoISet & qoi_indices, const ParameterVector & parameters, SensitivityData & sensitivities); /** * For each of the system's quantities of interest q in * \p qoi[qoi_indices], and for a vector of parameters p, the * parameter sensitivity Hessian H_ij is defined as * H_ij = (d^2 q)/(d p_i d p_j) * This Hessian is the output of this method, where for each q_i, * H_jk is stored in \p hessian.second_derivative(i,j,k). * * This method is only implemented in some derived classes. */ virtual void qoi_parameter_hessian(const QoISet & qoi_indices, const ParameterVector & parameters, SensitivityData & hessian); /** * For each of the system's quantities of interest q in * \p qoi[qoi_indices], and for a vector of parameters p, the * parameter sensitivity Hessian H_ij is defined as * H_ij = (d^2 q)/(d p_i d p_j) * The Hessian-vector product, for a vector v_k in parameter space, is * S_j = H_jk v_k * This product is the output of this method, where for each q_i, * S_j is stored in \p sensitivities[i][j]. * * This method is only implemented in some derived classes. */ virtual void qoi_parameter_hessian_vector_product(const QoISet & qoi_indices, const ParameterVector & parameters, const ParameterVector & vector, SensitivityData & product); /** * @returns \p true when the other system contains * identical data, up to the given threshold. Outputs * some diagnostic info when \p verbose is set. */ virtual bool compare (const System & other_system, const Real threshold, const bool verbose) const; /** * @returns the system name. */ const std::string & name () const; /** * @returns the type of system, helpful in identifying * which system type to use when reading equation system * data from file. Should be overloaded in derived classes. */ virtual std::string system_type () const { return "Basic"; } /** * Projects arbitrary functions onto the current solution. * The function value \p f and its gradient \p g are * user-provided cloneable functors. * A gradient \p g is only required/used for projecting onto finite * element spaces with continuous derivatives. * If non-default \p Parameters are to be used, they can be provided * in the \p parameters argument. */ void project_solution (FunctionBase<Number> * f, FunctionBase<Gradient> * g = NULL) const; /** * Projects arbitrary functions onto the current solution. * The function value \p f and its gradient \p g are * user-provided cloneable functors. * A gradient \p g is only required/used for projecting onto finite * element spaces with continuous derivatives. * If non-default \p Parameters are to be used, they can be provided * in the \p parameters argument. */ void project_solution (FEMFunctionBase<Number> * f, FEMFunctionBase<Gradient> * g = NULL) const; /** * Projects arbitrary functions onto the current solution. * The function value \p fptr and its gradient \p gptr are * represented by function pointers. * A gradient \p gptr is only required/used for projecting onto * finite element spaces with continuous derivatives. */ void project_solution (Number fptr(const Point & p, const Parameters & parameters, const std::string & sys_name, const std::string & unknown_name), Gradient gptr(const Point & p, const Parameters & parameters, const std::string & sys_name, const std::string & unknown_name), const Parameters & parameters) const; /** * Projects arbitrary functions onto a vector of degree of freedom * values for the current system. * The function value \p f and its gradient \p g are * user-provided cloneable functors. * A gradient \p g is only required/used for projecting onto finite * element spaces with continuous derivatives. * If non-default \p Parameters are to be used, they can be provided * in the \p parameters argument. * * Constrain the new vector using the requested adjoint rather than * primal constraints if is_adjoint is non-negative. */ void project_vector (NumericVector<Number> & new_vector, FunctionBase<Number> * f, FunctionBase<Gradient> * g = NULL, int is_adjoint = -1) const; /** * Projects arbitrary functions onto a vector of degree of freedom * values for the current system. * The function value \p f and its gradient \p g are * user-provided cloneable functors. * A gradient \p g is only required/used for projecting onto finite * element spaces with continuous derivatives. * If non-default \p Parameters are to be used, they can be provided * in the \p parameters argument. * * Constrain the new vector using the requested adjoint rather than * primal constraints if is_adjoint is non-negative. */ void project_vector (NumericVector<Number> & new_vector, FEMFunctionBase<Number> * f, FEMFunctionBase<Gradient> * g = NULL, int is_adjoint = -1) const; /** * Projects arbitrary functions onto a vector of degree of freedom * values for the current system. * The function value \p fptr and its gradient \p gptr are * represented by function pointers. * A gradient \p gptr is only required/used for projecting onto * finite element spaces with continuous derivatives. * * Constrain the new vector using the requested adjoint rather than * primal constraints if is_adjoint is non-negative. */ void project_vector (Number fptr(const Point & p, const Parameters & parameters, const std::string & sys_name, const std::string & unknown_name), Gradient gptr(const Point & p, const Parameters & parameters, const std::string & sys_name, const std::string & unknown_name), const Parameters & parameters, NumericVector<Number> & new_vector, int is_adjoint = -1) const; /** * Projects arbitrary boundary functions onto a vector of degree of * freedom values for the current system. * Only degrees of freedom which affect the function's trace on a * boundary in the set \p b are affected. * Only degrees of freedom associated with the variables listed in * the vector \p variables are projected. * The function value \p f and its gradient \p g are * user-provided cloneable functors. * A gradient \p g is only required/used for projecting onto finite * element spaces with continuous derivatives. * If non-default \p Parameters are to be used, they can be provided * in the \p parameters argument. */ void boundary_project_solution (const std::set<boundary_id_type> & b, const std::vector<unsigned int> & variables, FunctionBase<Number> * f, FunctionBase<Gradient> * g = NULL); /** * Projects arbitrary boundary functions onto a vector of degree of * freedom values for the current system. * Only degrees of freedom which affect the function's trace on a * boundary in the set \p b are affected. * Only degrees of freedom associated with the variables listed in * the vector \p variables are projected. * The function value \p fptr and its gradient \p gptr are * represented by function pointers. * A gradient \p gptr is only required/used for projecting onto * finite element spaces with continuous derivatives. */ void boundary_project_solution (const std::set<boundary_id_type> & b, const std::vector<unsigned int> & variables, Number fptr(const Point & p, const Parameters & parameters, const std::string & sys_name, const std::string & unknown_name), Gradient gptr(const Point & p, const Parameters & parameters, const std::string & sys_name, const std::string & unknown_name), const Parameters & parameters); /** * Projects arbitrary boundary functions onto a vector of degree of * freedom values for the current system. * Only degrees of freedom which affect the function's trace on a * boundary in the set \p b are affected. * Only degrees of freedom associated with the variables listed in * the vector \p variables are projected. * The function value \p f and its gradient \p g are * user-provided cloneable functors. * A gradient \p g is only required/used for projecting onto finite * element spaces with continuous derivatives. * If non-default \p Parameters are to be used, they can be provided * in the \p parameters argument. * * Constrain the new vector using the requested adjoint rather than * primal constraints if is_adjoint is non-negative. */ void boundary_project_vector (const std::set<boundary_id_type> & b, const std::vector<unsigned int> & variables, NumericVector<Number> & new_vector, FunctionBase<Number> * f, FunctionBase<Gradient> * g = NULL, int is_adjoint = -1) const; /** * Projects arbitrary boundary functions onto a vector of degree of * freedom values for the current system. * Only degrees of freedom which affect the function's trace on a * boundary in the set \p b are affected. * Only degrees of freedom associated with the variables listed in * the vector \p variables are projected. * The function value \p fptr and its gradient \p gptr are * represented by function pointers. * A gradient \p gptr is only required/used for projecting onto * finite element spaces with continuous derivatives. * * Constrain the new vector using the requested adjoint rather than * primal constraints if is_adjoint is non-negative. */ void boundary_project_vector (const std::set<boundary_id_type> & b, const std::vector<unsigned int> & variables, Number fptr(const Point & p, const Parameters & parameters, const std::string & sys_name, const std::string & unknown_name), Gradient gptr(const Point & p, const Parameters & parameters, const std::string & sys_name, const std::string & unknown_name), const Parameters & parameters, NumericVector<Number> & new_vector, int is_adjoint = -1) const; /** * @returns the system number. */ unsigned int number () const; /** * Fill the input vector \p global_soln so that it contains * the global solution on all processors. * Requires communication with all other processors. */ void update_global_solution (std::vector<Number> & global_soln) const; /** * Fill the input vector \p global_soln so that it contains * the global solution on processor \p dest_proc. * Requires communication with all other processors. */ void update_global_solution (std::vector<Number> & global_soln, const processor_id_type dest_proc) const; /** * @returns a constant reference to this systems's \p _mesh. */ const MeshBase & get_mesh() const; /** * @returns a reference to this systems's \p _mesh. */ MeshBase & get_mesh(); /** * @returns a constant reference to this system's \p _dof_map. */ const DofMap & get_dof_map() const; /** * @returns a writeable reference to this system's \p _dof_map. */ DofMap & get_dof_map(); /** * @returns a constant reference to this system's parent EquationSystems object. */ const EquationSystems & get_equation_systems() const { return _equation_systems; } /** * @returns a reference to this system's parent EquationSystems object. */ EquationSystems & get_equation_systems() { return _equation_systems; } /** * @returns \p true if the system is active, \p false otherwise. * An active system will be solved. */ bool active () const; /** * Activates the system. Only active systems are solved. */ void activate (); /** * Deactivates the system. Only active systems are solved. */ void deactivate (); /** * Sets the system to be "basic only": i.e. advanced system * components such as ImplicitSystem matrices may not be * initialized. This is useful for efficiency in certain utility * programs that never use System::solve(). This method must be * called after the System or derived class is created but before it * is initialized; e.g. from within EquationSystems::read() */ void set_basic_system_only (); /** * Vector iterator typedefs. */ typedef std::map<std::string, NumericVector<Number> *>::iterator vectors_iterator; typedef std::map<std::string, NumericVector<Number> *>::const_iterator const_vectors_iterator; /** * Beginning of vectors container */ vectors_iterator vectors_begin (); /** * Beginning of vectors container */ const_vectors_iterator vectors_begin () const; /** * End of vectors container */ vectors_iterator vectors_end (); /** * End of vectors container */ const_vectors_iterator vectors_end () const; /** * Adds the additional vector \p vec_name to this system. All the * additional vectors are similarly distributed, like the \p * solution, and inititialized to zero. * * By default vectors added by add_vector are projected to changed grids by * reinit(). To zero them instead (more efficient), pass "false" as the * second argument */ NumericVector<Number> & add_vector (const std::string & vec_name, const bool projections=true, const ParallelType type = PARALLEL); /** * Removes the additional vector \p vec_name from this system */ void remove_vector(const std::string & vec_name); /** * Tells the System whether or not to project the solution vector onto new * grids when the system is reinitialized. The solution will be projected * unless project_solution_on_reinit() = false is called. */ bool & project_solution_on_reinit (void) { return _solution_projection; } /** * @returns \p true if this \p System has a vector associated with the * given name, \p false otherwise. */ bool have_vector (const std::string & vec_name) const; /** * @returns a const pointer to the vector if this \p System has a * vector associated with the given name, \p NULL otherwise. */ const NumericVector<Number> * request_vector (const std::string & vec_name) const; /** * @returns a pointer to the vector if this \p System has a * vector associated with the given name, \p NULL otherwise. */ NumericVector<Number> * request_vector (const std::string & vec_name); /** * @returns a const pointer to this system's @e additional vector * number \p vec_num (where the vectors are counted starting with * 0), or returns \p NULL if the system has no such vector. */ const NumericVector<Number> * request_vector (const unsigned int vec_num) const; /** * @returns a writeable pointer to this system's @e additional * vector number \p vec_num (where the vectors are counted starting * with 0), or returns \p NULL if the system has no such vector. */ NumericVector<Number> * request_vector (const unsigned int vec_num); /** * @returns a const reference to this system's @e additional vector * named \p vec_name. Access is only granted when the vector is already * properly initialized. */ const NumericVector<Number> & get_vector (const std::string & vec_name) const; /** * @returns a writeable reference to this system's @e additional vector * named \p vec_name. Access is only granted when the vector is already * properly initialized. */ NumericVector<Number> & get_vector (const std::string & vec_name); /** * @returns a const reference to this system's @e additional vector * number \p vec_num (where the vectors are counted starting with * 0). */ const NumericVector<Number> & get_vector (const unsigned int vec_num) const; /** * @returns a writeable reference to this system's @e additional * vector number \p vec_num (where the vectors are counted starting * with 0). */ NumericVector<Number> & get_vector (const unsigned int vec_num); /** * @returns the name of this system's @e additional vector number \p * vec_num (where the vectors are counted starting with 0). */ const std::string & vector_name (const unsigned int vec_num) const; /** * @returns the name of a system vector, given a reference to that vector */ const std::string & vector_name (const NumericVector<Number> & vec_reference) const; /** * Allows one to set the QoI index controlling whether the vector * identified by vec_name represents a solution from the adjoint * (qoi_num >= 0) or primal (qoi_num == -1) space. This becomes * significant if those spaces have differing heterogeneous * Dirichlet constraints. * * qoi_num == -2 can be used to indicate a vector which should not * be affected by constraints during projection operations. */ void set_vector_as_adjoint (const std::string & vec_name, int qoi_num); /** * @returns the int describing whether the vector identified by * vec_name represents a solution from an adjoint (non-negative) or * the primal (-1) space. */ int vector_is_adjoint (const std::string & vec_name) const; /** * Allows one to set the boolean controlling whether the vector * identified by vec_name should be "preserved": projected to new * meshes, saved, etc. */ void set_vector_preservation (const std::string & vec_name, bool preserve); /** * @returns the boolean describing whether the vector identified by * vec_name should be "preserved": projected to new meshes, saved, * etc. */ bool vector_preservation (const std::string & vec_name) const; /** * @returns a reference to one of the system's adjoint solution * vectors, by default the one corresponding to the first qoi. * Creates the vector if it doesn't already exist. */ NumericVector<Number> & add_adjoint_solution(unsigned int i=0); /** * @returns a reference to one of the system's adjoint solution * vectors, by default the one corresponding to the first qoi. */ NumericVector<Number> & get_adjoint_solution(unsigned int i=0); /** * @returns a reference to one of the system's adjoint solution * vectors, by default the one corresponding to the first qoi. */ const NumericVector<Number> & get_adjoint_solution(unsigned int i=0) const; /** * @returns a reference to one of the system's solution sensitivity * vectors, by default the one corresponding to the first parameter. * Creates the vector if it doesn't already exist. */ NumericVector<Number> & add_sensitivity_solution(unsigned int i=0); /** * @returns a reference to one of the system's solution sensitivity * vectors, by default the one corresponding to the first parameter. */ NumericVector<Number> & get_sensitivity_solution(unsigned int i=0); /** * @returns a reference to one of the system's solution sensitivity * vectors, by default the one corresponding to the first parameter. */ const NumericVector<Number> & get_sensitivity_solution(unsigned int i=0) const; /** * @returns a reference to one of the system's weighted sensitivity * adjoint solution vectors, by default the one corresponding to the * first qoi. * Creates the vector if it doesn't already exist. */ NumericVector<Number> & add_weighted_sensitivity_adjoint_solution(unsigned int i=0); /** * @returns a reference to one of the system's weighted sensitivity * adjoint solution vectors, by default the one corresponding to the * first qoi. */ NumericVector<Number> & get_weighted_sensitivity_adjoint_solution(unsigned int i=0); /** * @returns a reference to one of the system's weighted sensitivity * adjoint solution vectors, by default the one corresponding to the * first qoi. */ const NumericVector<Number> & get_weighted_sensitivity_adjoint_solution(unsigned int i=0) const; /** * @returns a reference to the solution of the last weighted * sensitivity solve * Creates the vector if it doesn't already exist. */ NumericVector<Number> & add_weighted_sensitivity_solution(); /** * @returns a reference to the solution of the last weighted * sensitivity solve */ NumericVector<Number> & get_weighted_sensitivity_solution(); /** * @returns a reference to the solution of the last weighted * sensitivity solve */ const NumericVector<Number> & get_weighted_sensitivity_solution() const; /** * @returns a reference to one of the system's adjoint rhs * vectors, by default the one corresponding to the first qoi. * Creates the vector if it doesn't already exist. */ NumericVector<Number> & add_adjoint_rhs(unsigned int i=0); /** * @returns a reference to one of the system's adjoint rhs * vectors, by default the one corresponding to the first qoi. * This what the user's QoI derivative code should assemble * when setting up an adjoint problem */ NumericVector<Number> & get_adjoint_rhs(unsigned int i=0); /** * @returns a reference to one of the system's adjoint rhs * vectors, by default the one corresponding to the first qoi. */ const NumericVector<Number> & get_adjoint_rhs(unsigned int i=0) const; /** * @returns a reference to one of the system's sensitivity rhs * vectors, by default the one corresponding to the first parameter. * Creates the vector if it doesn't already exist. */ NumericVector<Number> & add_sensitivity_rhs(unsigned int i=0); /** * @returns a reference to one of the system's sensitivity rhs * vectors, by default the one corresponding to the first parameter. * By default these vectors are built by the library, using finite * differences, when \p assemble_residual_derivatives() is called. * * When assembled, this vector should hold * -(partial R / partial p_i) */ NumericVector<Number> & get_sensitivity_rhs(unsigned int i=0); /** * @returns a reference to one of the system's sensitivity rhs * vectors, by default the one corresponding to the first parameter. */ const NumericVector<Number> & get_sensitivity_rhs(unsigned int i=0) const; /** * @returns the number of vectors (in addition to the solution) * handled by this system * This is the size of the \p _vectors map */ unsigned int n_vectors () const; /** * @returns the number of matrices * handled by this system. * * This will return 0 by default but can be overriden. */ virtual unsigned int n_matrices () const; /** * @returns the number of variables in the system */ unsigned int n_vars() const; /** * @returns the number of \p VariableGroup variable groups in the system */ unsigned int n_variable_groups() const; /** * @returns the total number of scalar components in the system's * variables. This will equal \p n_vars() in the case of all * scalar-valued variables. */ unsigned int n_components() const; /** * @returns the number of degrees of freedom in the system */ dof_id_type n_dofs() const; /** * Returns the number of active degrees of freedom * for this System. */ dof_id_type n_active_dofs() const; /** * @returns the total number of constrained degrees of freedom * in the system. */ dof_id_type n_constrained_dofs() const; /** * @returns the number of constrained degrees of freedom * on this processor. */ dof_id_type n_local_constrained_dofs() const; /** * @returns the number of degrees of freedom local * to this processor */ dof_id_type n_local_dofs() const; /** * Adds the variable \p var to the list of variables * for this system. Returns the index number for the new variable. */ unsigned int add_variable (const std::string & var, const FEType & type, const std::set<subdomain_id_type> * const active_subdomains = NULL); /** * Adds the variable \p var to the list of variables * for this system. Same as before, but assumes \p LAGRANGE * as default value for \p FEType.family. */ unsigned int add_variable (const std::string & var, const Order order = FIRST, const FEFamily = LAGRANGE, const std::set<subdomain_id_type> * const active_subdomains = NULL); /** * Adds the variable \p var to the list of variables * for this system. Returns the index number for the new variable. */ unsigned int add_variables (const std::vector<std::string> & vars, const FEType & type, const std::set<subdomain_id_type> * const active_subdomains = NULL); /** * Adds the variable \p var to the list of variables * for this system. Same as before, but assumes \p LAGRANGE * as default value for \p FEType.family. */ unsigned int add_variables (const std::vector<std::string> & vars, const Order order = FIRST, const FEFamily = LAGRANGE, const std::set<subdomain_id_type> * const active_subdomains = NULL); /** * Return a constant reference to \p Variable \p var. */ const Variable & variable (unsigned int var) const; /** * Return a constant reference to \p VariableGroup \p vg. */ const VariableGroup & variable_group (unsigned int vg) const; /** * @returns true if a variable named \p var exists in this System */ bool has_variable(const std::string & var) const; /** * @returns the name of variable \p i. */ const std::string & variable_name(const unsigned int i) const; /** * @returns the variable number assoicated with * the user-specified variable named \p var. */ unsigned short int variable_number (const std::string & var) const; /** * Fills \p all_variable_numbers with all the variable numbers for the * variables that have been added to this system. */ void get_all_variable_numbers(std::vector<unsigned int> & all_variable_numbers) const; /** * @returns an index, starting from 0 for the first component of the * first variable, and incrementing for each component of each * (potentially vector-valued) variable in the system in order. * For systems with only scalar-valued variables, this will be the * same as \p variable_number(var) * * Irony: currently our only non-scalar-valued variable type is * SCALAR. */ unsigned int variable_scalar_number (const std::string & var, unsigned int component) const; /** * @returns an index, starting from 0 for the first component of the * first variable, and incrementing for each component of each * (potentially vector-valued) variable in the system in order. * For systems with only scalar-valued variables, this will be the * same as \p var_num * * Irony: currently our only non-scalar-valued variable type is * SCALAR. */ unsigned int variable_scalar_number (unsigned int var_num, unsigned int component) const; /** * @returns the finite element type variable number \p i. */ const FEType & variable_type (const unsigned int i) const; /** * @returns the finite element type for variable \p var. */ const FEType & variable_type (const std::string & var) const; /** * @returns \p true when \p VariableGroup structures should be * automatically identified, \p false otherwise. */ bool identify_variable_groups () const; /** * Toggle automatic \p VariableGroup identification. */ void identify_variable_groups (const bool); /** * @returns a norm of variable \p var in the vector \p v, in the specified * norm (e.g. L2, L_INF, H1) */ Real calculate_norm(const NumericVector<Number> & v, unsigned int var, FEMNormType norm_type, std::set<unsigned int> * skip_dimensions=NULL) const; /** * @returns a norm of the vector \p v, using \p component_norm and \p * component_scale to choose and weight the norms of each variable. */ Real calculate_norm(const NumericVector<Number> & v, const SystemNorm & norm, std::set<unsigned int> * skip_dimensions=NULL) const; /** * Reads the basic data header for this System. */ void read_header (Xdr & io, const std::string & version, const bool read_header=true, const bool read_additional_data=true, const bool read_legacy_format=false); /** * Reads additional data, namely vectors, for this System. */ void read_legacy_data (Xdr & io, const bool read_additional_data=true); /** * Reads additional data, namely vectors, for this System. * This method may safely be called on a distributed-memory mesh. */ template <typename ValType> void read_serialized_data (Xdr & io, const bool read_additional_data=true); /** * Non-templated version for backward compatibility. * * Reads additional data, namely vectors, for this System. * This method may safely be called on a distributed-memory mesh. */ void read_serialized_data (Xdr & io, const bool read_additional_data=true) { read_serialized_data<Number>(io, read_additional_data); } /** * Read a number of identically distributed vectors. This method * allows for optimization for the multiple vector case by only communicating * the metadata once. */ template <typename InValType> std::size_t read_serialized_vectors (Xdr & io, const std::vector<NumericVector<Number> *> & vectors) const; /** * Non-templated version for backward compatibility. * * Read a number of identically distributed vectors. This method * allows for optimization for the multiple vector case by only communicating * the metadata once. */ std::size_t read_serialized_vectors (Xdr & io, const std::vector<NumericVector<Number> *> & vectors) const { return read_serialized_vectors<Number>(io, vectors); } /** * Reads additional data, namely vectors, for this System. * This method may safely be called on a distributed-memory mesh. * This method will read an individual file for each processor in the simulation * where the local solution components for that processor are stored. */ template <typename InValType> void read_parallel_data (Xdr & io, const bool read_additional_data); /** * Non-templated version for backward compatibility. * * Reads additional data, namely vectors, for this System. * This method may safely be called on a distributed-memory mesh. * This method will read an individual file for each processor in the simulation * where the local solution components for that processor are stored. */ void read_parallel_data (Xdr & io, const bool read_additional_data) { read_parallel_data<Number>(io, read_additional_data); } /** * Writes the basic data header for this System. */ void write_header (Xdr & io, const std::string & version, const bool write_additional_data) const; /** * Writes additional data, namely vectors, for this System. * This method may safely be called on a distributed-memory mesh. */ void write_serialized_data (Xdr & io, const bool write_additional_data = true) const; /** * Serialize & write a number of identically distributed vectors. This method * allows for optimization for the multiple vector case by only communicating * the metadata once. */ std::size_t write_serialized_vectors (Xdr & io, const std::vector<const NumericVector<Number> *> & vectors) const; /** * Writes additional data, namely vectors, for this System. * This method may safely be called on a distributed-memory mesh. * This method will create an individual file for each processor in the simulation * where the local solution components for that processor will be stored. */ void write_parallel_data (Xdr & io, const bool write_additional_data) const; /** * @returns a string containing information about the * system. */ std::string get_info () const; /** * Register a user function to use in initializing the system. */ void attach_init_function (void fptr(EquationSystems & es, const std::string & name)); /** * Register a user class to use to initialize the system. * Note this is exclusive with the \p attach_init_function. */ void attach_init_object (Initialization & init); /** * Register a user function to use in assembling the system * matrix and RHS. */ void attach_assemble_function (void fptr(EquationSystems & es, const std::string & name)); /** * Register a user object to use in assembling the system * matrix and RHS. */ void attach_assemble_object (Assembly & assemble); /** * Register a user function for imposing constraints. */ void attach_constraint_function (void fptr(EquationSystems & es, const std::string & name)); /** * Register a user object for imposing constraints. */ void attach_constraint_object (Constraint & constrain); /** * Register a user function for evaluating the quantities of interest, * whose values should be placed in \p System::qoi */ void attach_QOI_function (void fptr(EquationSystems & es, const std::string & name, const QoISet & qoi_indices)); /** * Register a user object for evaluating the quantities of interest, * whose values should be placed in \p System::qoi */ void attach_QOI_object (QOI & qoi); /** * Register a user function for evaluating derivatives of a quantity * of interest with respect to test functions, whose values should * be placed in \p System::rhs */ void attach_QOI_derivative (void fptr(EquationSystems & es, const std::string & name, const QoISet & qoi_indices, bool include_liftfunc, bool apply_constraints)); /** * Register a user object for evaluating derivatives of a quantity * of interest with respect to test functions, whose values should * be placed in \p System::rhs */ void attach_QOI_derivative_object (QOIDerivative & qoi_derivative); /** * Calls user's attached initialization function, or is overloaded by * the user in derived classes. */ virtual void user_initialization (); /** * Calls user's attached assembly function, or is overloaded by * the user in derived classes. */ virtual void user_assembly (); /** * Calls user's attached constraint function, or is overloaded by * the user in derived classes. */ virtual void user_constrain (); /** * Calls user's attached quantity of interest function, or is * overloaded by the user in derived classes. */ virtual void user_QOI (const QoISet & qoi_indices); /** * Calls user's attached quantity of interest derivative function, * or is overloaded by the user in derived classes. */ virtual void user_QOI_derivative (const QoISet & qoi_indices = QoISet(), bool include_liftfunc = true, bool apply_constraints = true); /** * Re-update the local values when the mesh has changed. * This method takes the data updated by \p update() and * makes it up-to-date on the current mesh. */ virtual void re_update (); /** * Restrict vectors after the mesh has coarsened */ virtual void restrict_vectors (); /** * Prolong vectors after the mesh has refined */ virtual void prolong_vectors (); /** * Flag which tells the system to whether or not to * call the user assembly function during each call to solve(). * By default, every call to solve() begins with a call to the * user assemble, so this flag is true. (For explicit systems, * "solving" the system occurs during the assembly step, so this * flag is always true for explicit systems.) * * You will only want to set this to false if you need direct * control over when the system is assembled, and are willing to * track the state of its assembly yourself. An example of such a * case is an implicit system with multiple right hand sides. In * this instance, a single assembly would likely be followed with * multiple calls to solve. * * The frequency system and Newmark system have their own versions * of this flag, called _finished_assemble, which might be able to * be replaced with this more general concept. */ bool assemble_before_solve; /** * Avoids use of any cached data that might affect any solve result. Should * be overloaded in derived systems. */ virtual void disable_cache (); /** * A boolean to be set to true by systems using elem_fixed_solution, * for optional use by e.g. stabilized methods. * False by default. * * Note for FEMSystem users: * Warning: if this variable is set to true, it must be before init_data() is * called. */ bool use_fixed_solution; /** * A member int that can be employed to indicate increased or * reduced quadrature order. * * Note for FEMSystem users: * By default, when calling the user-defined residual functions, the * FEMSystem will first set up an appropriate * FEType::default_quadrature_rule() object for performing the integration. * This rule will integrate elements of order up to 2*p+1 exactly (where p is * the sum of the base FEType and local p refinement levels), but if * additional (or reduced) quadrature accuracy is desired then this * extra_quadrature_order (default 0) will be added. */ int extra_quadrature_order; //-------------------------------------------------- // The solution and solution access members /** * @returns the current solution for the specified global * DOF. */ Number current_solution (const dof_id_type global_dof_number) const; /** * Data structure to hold solution values. */ UniquePtr<NumericVector<Number> > solution; /** * All the values I need to compute my contribution * to the simulation at hand. Think of this as the * current solution with any ghost values needed from * other processors. This vector is necessarily larger * than the \p solution vector in the case of a parallel * simulation. The \p update() member is used to synchronize * the contents of the \p solution and \p current_local_solution * vectors. */ UniquePtr<NumericVector<Number> > current_local_solution; /** * For time-dependent problems, this is the time t at the beginning of * the current timestep. * * Note for DifferentiableSystem users: * do *not* access this time during an assembly! * Use the DiffContext::time value instead to get correct * results. */ Real time; /** * Values of the quantities of interest. This vector needs * to be both resized and filled by the user before any quantity of * interest assembly is done and before any sensitivities are * calculated. */ std::vector<Number> qoi; /** * Returns the value of the solution variable \p var at the physical * point \p p in the mesh, without knowing a priori which element * contains \p p. * * Note that this function uses \p MeshBase::sub_point_locator(); users * may or may not want to call \p MeshBase::clear_point_locator() * afterward. Also, point_locator() is expensive (N log N for * initial construction, log N for evaluations). Avoid using this * function in any context where you are already looping over * elements. * * Because the element containing \p p may lie on any processor, * this function is parallel-only. * * By default this method expects the point to reside inside the domain * and will abort if no element can be found which contains \p p. The * optional parameter \p insist_on_success can be set to false to allow * the method to return 0 when the point is not located. */ Number point_value(unsigned int var, const Point & p, const bool insist_on_success = true) const; /** * Returns the value of the solution variable \p var at the physical * point \p p contained in local Elem \p e * * This version of point_value can be run in serial, but assumes \p e is in * the local mesh partition. */ Number point_value(unsigned int var, const Point & p, const Elem & e) const; /** * Returns the gradient of the solution variable \p var at the physical * point \p p in the mesh, similarly to point_value. */ Gradient point_gradient(unsigned int var, const Point & p, const bool insist_on_success = true) const; /** * Returns the gradient of the solution variable \p var at the physical * point \p p in local Elem \p e in the mesh, similarly to point_value. */ Gradient point_gradient(unsigned int var, const Point & p, const Elem & e) const; /** * Returns the second derivative tensor of the solution variable \p var * at the physical point \p p in the mesh, similarly to point_value. */ Tensor point_hessian(unsigned int var, const Point & p, const bool insist_on_success = true) const; /** * Returns the second derivative tensor of the solution variable \p var * at the physical point \p p in local Elem \p e in the mesh, similarly to * point_value. */ Tensor point_hessian(unsigned int var, const Point & p, const Elem & e) const; /** * Fills the std::set with the degrees of freedom on the local * processor corresponding the the variable number passed in. */ void local_dof_indices (const unsigned int var, std::set<dof_id_type> & var_indices) const; /** * Zeroes all dofs in \p v that correspond to variable number \p * var_num. */ void zero_variable (NumericVector<Number> & v, unsigned int var_num) const; /** * Returns a writeable reference to a boolean that determines if this system * can be written to file or not. If set to \p true, then * \p EquationSystems::write will ignore this system. */ bool & hide_output() { return _hide_output; } protected: /** * Initializes the data for the system. Note that this is called * before any user-supplied intitialization function so that all * required storage will be available. */ virtual void init_data (); /** * Projects the vector defined on the old mesh onto the * new mesh. * * Constrain the new vector using the requested adjoint rather than * primal constraints if is_adjoint is non-negative. */ void project_vector (NumericVector<Number> &, int is_adjoint = -1) const; /** * Projects the vector defined on the old mesh onto the * new mesh. The original vector is unchanged and the new vector * is passed through the second argument. * * Constrain the new vector using the requested adjoint rather than * primal constraints if is_adjoint is non-negative. */ void project_vector (const NumericVector<Number> &, NumericVector<Number> &, int is_adjoint = -1) const; private: /** * This isn't a copyable object, so let's make sure nobody tries. * * We won't even bother implementing this; we'll just make sure that * the compiler doesn't implement a default. */ System (const System &); /** * This isn't a copyable object, so let's make sure nobody tries. * * We won't even bother implementing this; we'll just make sure that * the compiler doesn't implement a default. */ System & operator=(const System &); /** * Finds the discrete norm for the entries in the vector * corresponding to Dofs associated with var. */ Real discrete_var_norm (const NumericVector<Number> & v, unsigned int var, FEMNormType norm_type) const; /** * Reads an input vector from the stream \p io and assigns * the values to a set of \p DofObjects. This method uses * blocked input and is safe to call on a distributed memory-mesh. * Unless otherwise specified, all variables are read. */ template <typename iterator_type, typename InValType> std::size_t read_serialized_blocked_dof_objects (const dof_id_type n_objects, const iterator_type begin, const iterator_type end, const InValType dummy, Xdr & io, const std::vector<NumericVector<Number> *> & vecs, const unsigned int var_to_read=libMesh::invalid_uint) const; /** * Reads the SCALAR dofs from the stream \p io and assigns the values * to the appropriate entries of \p vec. * * Returns the number of dofs read. */ unsigned int read_SCALAR_dofs (const unsigned int var, Xdr & io, NumericVector<Number> & vec) const; /** * Reads a vector for this System. * This method may safely be called on a distributed-memory mesh. * * Returns the length of the vector read. */ template <typename InValType> numeric_index_type read_serialized_vector (Xdr & io, NumericVector<Number> & vec); /** * Non-templated version for backward compatibility. * * Reads a vector for this System. * This method may safely be called on a distributed-memory mesh. * * Returns the length of the vector read. */ numeric_index_type read_serialized_vector (Xdr & io, NumericVector<Number> & vec) { return read_serialized_vector<Number>(io, vec); } /** * Writes an output vector to the stream \p io for a set of \p DofObjects. * This method uses blocked output and is safe to call on a distributed memory-mesh. * * Returns the number of values written */ template <typename iterator_type> std::size_t write_serialized_blocked_dof_objects (const std::vector<const NumericVector<Number> *> & vecs, const dof_id_type n_objects, const iterator_type begin, const iterator_type end, Xdr & io, const unsigned int var_to_write=libMesh::invalid_uint) const; /** * Writes the SCALAR dofs associated with var to the stream \p io. * * Returns the number of values written. */ unsigned int write_SCALAR_dofs (const NumericVector<Number> & vec, const unsigned int var, Xdr & io) const; /** * Writes a vector for this System. * This method may safely be called on a distributed-memory mesh. * * Returns the number of values written. */ dof_id_type write_serialized_vector (Xdr & io, const NumericVector<Number> & vec) const; /** * Function that initializes the system. */ void (* _init_system_function) (EquationSystems & es, const std::string & name); /** * Object that initializes the system. */ Initialization * _init_system_object; /** * Function that assembles the system. */ void (* _assemble_system_function) (EquationSystems & es, const std::string & name); /** * Object that assembles the system. */ Assembly * _assemble_system_object; /** * Function to impose constraints. */ void (* _constrain_system_function) (EquationSystems & es, const std::string & name); /** * Object that constrains the system. */ Constraint * _constrain_system_object; /** * Function to evaluate quantity of interest */ void (* _qoi_evaluate_function) (EquationSystems & es, const std::string & name, const QoISet & qoi_indices); /** * Object to compute quantities of interest. */ QOI * _qoi_evaluate_object; /** * Function to evaluate quantity of interest derivative */ void (* _qoi_evaluate_derivative_function) (EquationSystems & es, const std::string & name, const QoISet & qoi_indices, bool include_liftfunc, bool apply_constraints); /** * Object to compute derivatives of quantities of interest. */ QOIDerivative * _qoi_evaluate_derivative_object; /** * Data structure describing the relationship between * nodes, variables, etc... and degrees of freedom. */ UniquePtr<DofMap> _dof_map; /** * Constant reference to the \p EquationSystems object * used for the simulation. */ EquationSystems & _equation_systems; /** * Constant reference to the \p mesh data structure used * for the simulation. */ MeshBase & _mesh; /** * A name associated with this system. */ const std::string _sys_name; /** * The number associated with this system */ const unsigned int _sys_number; /** * The \p Variable in this \p System. */ std::vector<Variable> _variables; /** * The \p VariableGroup in this \p System. */ std::vector<VariableGroup> _variable_groups; /** * The variable numbers corresponding to user-specified * names, useful for name-based lookups. */ std::map<std::string, unsigned short int> _variable_numbers; /** * Flag stating if the system is active or not. */ bool _active; /** * Some systems need an arbitrary number of vectors. * This map allows names to be associated with arbitrary * vectors. All the vectors in this map will be distributed * in the same way as the solution vector. */ std::map<std::string, NumericVector<Number> * > _vectors; /** * Holds true if a vector by that name should be projected * onto a changed grid, false if it should be zeroed. */ std::map<std::string, bool> _vector_projections; /** * Holds non-negative if a vector by that name should be projected * using adjoint constraints/BCs, -1 if primal */ std::map<std::string, int> _vector_is_adjoint; /** * Holds the type of a vector */ std::map<std::string, ParallelType> _vector_types; /** * Holds true if the solution vector should be projected * onto a changed grid, false if it should be zeroed. * This is true by default. */ bool _solution_projection; /** * Holds true if the components of more advanced system types (e.g. * system matrices) should not be initialized. */ bool _basic_system_only; /** * \p true when additional vectors and variables do not require * immediate initialization, \p false otherwise. */ bool _is_initialized; /** * \p true when \p VariableGroup structures should be automatically * identified, \p false otherwise. Defaults to \p true. */ bool _identify_variable_groups; /** * This flag is used only when *reading* in a system from file. * Based on the system header, it keeps track of whether or not * additional vectors were actually written for this file. */ bool _additional_data_written; /** * This vector is used only when *reading* in a system from file. * Based on the system header, it keeps track of any index remapping * between variable names in the data file and variable names in the * already-constructed system. I.e. if we have a system with * variables "A1", "A2", "B1", and "B2", but we read in a data file with * only "A1" and "B1" defined, then we don't want to try and read in * A2 or B2, and we don't want to assign A1 and B1 values to * different dof indices. */ std::vector<unsigned int> _written_var_indices; /** * Has the adjoint problem already been solved? If the user sets * \p adjoint_already_solved to \p true, we won't waste time solving * it again. */ bool adjoint_already_solved; /** * Are we allowed to write this system to file? If \p _hide_output is * \p true, then \p EquationSystems::write will ignore this system. */ bool _hide_output; }; // ------------------------------------------------------------ // System inline methods inline const std::string & System::name() const { return _sys_name; } inline unsigned int System::number() const { return _sys_number; } inline const MeshBase & System::get_mesh() const { return _mesh; } inline MeshBase & System::get_mesh() { return _mesh; } inline const DofMap & System::get_dof_map() const { return *_dof_map; } inline DofMap & System::get_dof_map() { return *_dof_map; } inline bool System::active() const { return _active; } inline void System::activate () { _active = true; } inline void System::deactivate () { _active = false; } inline bool System::is_initialized () { return _is_initialized; } inline void System::set_basic_system_only () { _basic_system_only = true; } inline unsigned int System::n_vars() const { return cast_int<unsigned int>(_variables.size()); } inline unsigned int System::n_variable_groups() const { return cast_int<unsigned int>(_variable_groups.size()); } inline unsigned int System::n_components() const { if (_variables.empty()) return 0; const Variable & last = _variables.back(); return last.first_scalar_number() + last.n_components(); } inline const Variable & System::variable (const unsigned int i) const { libmesh_assert_less (i, _variables.size()); return _variables[i]; } inline const VariableGroup & System::variable_group (const unsigned int vg) const { libmesh_assert_less (vg, _variable_groups.size()); return _variable_groups[vg]; } inline const std::string & System::variable_name (const unsigned int i) const { libmesh_assert_less (i, _variables.size()); return _variables[i].name(); } inline unsigned int System::variable_scalar_number (const std::string & var, unsigned int component) const { return variable_scalar_number(this->variable_number(var), component); } inline unsigned int System::variable_scalar_number (unsigned int var_num, unsigned int component) const { return _variables[var_num].first_scalar_number() + component; } inline const FEType & System::variable_type (const unsigned int i) const { libmesh_assert_less (i, _variables.size()); return _variables[i].type(); } inline const FEType & System::variable_type (const std::string & var) const { return _variables[this->variable_number(var)].type(); } inline bool System::identify_variable_groups () const { return _identify_variable_groups; } inline void System::identify_variable_groups (const bool ivg) { _identify_variable_groups = ivg; } inline dof_id_type System::n_active_dofs() const { return this->n_dofs() - this->n_constrained_dofs(); } inline bool System::have_vector (const std::string & vec_name) const { return (_vectors.count(vec_name)); } inline unsigned int System::n_vectors () const { return cast_int<unsigned int>(_vectors.size()); } inline unsigned int System::n_matrices () const { return 0; } inline System::vectors_iterator System::vectors_begin () { return _vectors.begin(); } inline System::const_vectors_iterator System::vectors_begin () const { return _vectors.begin(); } inline System::vectors_iterator System::vectors_end () { return _vectors.end(); } inline System::const_vectors_iterator System::vectors_end () const { return _vectors.end(); } inline void System::assemble_residual_derivatives (const ParameterVector &) { libmesh_not_implemented(); } inline void System::disable_cache () { assemble_before_solve = true; } inline std::pair<unsigned int, Real> System::sensitivity_solve (const ParameterVector &) { libmesh_not_implemented(); } inline std::pair<unsigned int, Real> System::weighted_sensitivity_solve (const ParameterVector &, const ParameterVector &) { libmesh_not_implemented(); } inline std::pair<unsigned int, Real> System::adjoint_solve (const QoISet &) { libmesh_not_implemented(); } inline std::pair<unsigned int, Real> System::weighted_sensitivity_adjoint_solve (const ParameterVector &, const ParameterVector &, const QoISet &) { libmesh_not_implemented(); } inline void System::adjoint_qoi_parameter_sensitivity (const QoISet &, const ParameterVector &, SensitivityData &) { libmesh_not_implemented(); } inline void System::forward_qoi_parameter_sensitivity (const QoISet &, const ParameterVector &, SensitivityData &) { libmesh_not_implemented(); } inline void System::qoi_parameter_hessian(const QoISet &, const ParameterVector &, SensitivityData &) { libmesh_not_implemented(); } inline void System::qoi_parameter_hessian_vector_product(const QoISet &, const ParameterVector &, const ParameterVector &, SensitivityData &) { libmesh_not_implemented(); } } // namespace libMesh #endif // LIBMESH_SYSTEM_H
lgpl-2.1
gabeharms/firestorm
indra/newview/llviewerdisplayname.cpp
7372
/** * @file llviewerdisplayname.cpp * @brief Wrapper for display name functionality * * $LicenseInfo:firstyear=2010&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2010, Linden Research, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ #include "llviewerprecompiledheaders.h" #include "llviewerdisplayname.h" // viewer includes #include "llagent.h" #include "llviewerregion.h" #include "llvoavatar.h" // library includes #include "llavatarnamecache.h" #include "llhttpclient.h" #include "llhttpnode.h" #include "llnotificationsutil.h" #include "llui.h" // getLanguage() #include "fsradar.h" #include "lggcontactsets.h" #include "llviewercontrol.h" namespace LLViewerDisplayName { // Fired when viewer receives server response to display name change set_name_signal_t sSetDisplayNameSignal; // Fired when there is a change in the agent's name name_changed_signal_t sNameChangedSignal; void addNameChangedCallback(const name_changed_signal_t::slot_type& cb) { sNameChangedSignal.connect(cb); } void doNothing() { } } class LLSetDisplayNameResponder : public LLHTTPClient::Responder { public: // only care about errors /*virtual*/ void errorWithContent(U32 status, const std::string& reason, const LLSD& content) { LL_WARNS() << "LLSetDisplayNameResponder error [status:" << status << "]: " << content << LL_ENDL; LLViewerDisplayName::sSetDisplayNameSignal(false, "", LLSD()); LLViewerDisplayName::sSetDisplayNameSignal.disconnect_all_slots(); } }; void LLViewerDisplayName::set(const std::string& display_name, const set_name_slot_t& slot) { // TODO: simple validation here LLViewerRegion* region = gAgent.getRegion(); llassert(region); std::string cap_url = region->getCapability("SetDisplayName"); if (cap_url.empty()) { // this server does not support display names, report error slot(false, "unsupported", LLSD()); return; } // People API can return localized error messages. Indicate our // language preference via header. LLSD headers; headers["Accept-Language"] = LLUI::getLanguage(); // People API requires both the old and new value to change a variable. // Our display name will be in cache before the viewer's UI is available // to request a change, so we can use direct lookup without callback. LLAvatarName av_name; if (!LLAvatarNameCache::get( gAgent.getID(), &av_name)) { slot(false, "name unavailable", LLSD()); return; } // People API expects array of [ "old value", "new value" ] LLSD change_array = LLSD::emptyArray(); change_array.append(av_name.getDisplayName()); change_array.append(display_name); LL_INFOS() << "Set name POST to " << cap_url << LL_ENDL; // Record our caller for when the server sends back a reply sSetDisplayNameSignal.connect(slot); // POST the requested change. The sim will not send a response back to // this request directly, rather it will send a separate message after it // communicates with the back-end. LLSD body; body["display_name"] = change_array; LLHTTPClient::post(cap_url, body, new LLSetDisplayNameResponder, headers); } class LLSetDisplayNameReply : public LLHTTPNode { LOG_CLASS(LLSetDisplayNameReply); public: /*virtual*/ void post( LLHTTPNode::ResponsePtr response, const LLSD& context, const LLSD& input) const { LLSD body = input["body"]; S32 status = body["status"].asInteger(); bool success = (status == 200); std::string reason = body["reason"].asString(); LLSD content = body["content"]; LL_INFOS() << "status " << status << " reason " << reason << LL_ENDL; // If viewer's concept of display name is out-of-date, the set request // will fail with 409 Conflict. If that happens, fetch up-to-date // name information. if (status == 409) { LLUUID agent_id = gAgent.getID(); // Flush stale data LLAvatarNameCache::erase( agent_id ); // Queue request for new data: nothing to do on callback though... // Note: no need to disconnect the callback as it never gets out of scope LLAvatarNameCache::get(agent_id, boost::bind(&LLViewerDisplayName::doNothing)); // Kill name tag, as it is wrong LLVOAvatar::invalidateNameTag( agent_id ); } // inform caller of result LLViewerDisplayName::sSetDisplayNameSignal(success, reason, content); LLViewerDisplayName::sSetDisplayNameSignal.disconnect_all_slots(); } }; class LLDisplayNameUpdate : public LLHTTPNode { /*virtual*/ void post( LLHTTPNode::ResponsePtr response, const LLSD& context, const LLSD& input) const { LLSD body = input["body"]; LLUUID agent_id = body["agent_id"]; std::string old_display_name = body["old_display_name"]; // By convention this record is called "agent" in the People API LLSD name_data = body["agent"]; // Inject the new name data into cache LLAvatarName av_name; av_name.fromLLSD( name_data ); LL_INFOS() << "name-update now " << LLDate::now() << " next_update " << LLDate(av_name.mNextUpdate) << LL_ENDL; // Name expiration time may be provided in headers, or we may use a // default value // *TODO: get actual headers out of ResponsePtr //LLSD headers = response->mHeaders; LLSD headers; av_name.mExpires = LLAvatarNameCache::nameExpirationFromHeaders(headers); LLAvatarNameCache::insert(agent_id, av_name); // force name tag to update LLVOAvatar::invalidateNameTag(agent_id); LLSD args; args["OLD_NAME"] = old_display_name; args["SLID"] = av_name.getUserName(); args["NEW_NAME"] = av_name.getDisplayName(); if (LGGContactSets::getInstance()->hasPseudonym(agent_id)) { LLSD payload; payload["agent_id"] = agent_id; LLNotificationsUtil::add("DisplayNameUpdateRemoveAlias", args, payload, boost::bind(&LGGContactSets::callbackAliasReset, LGGContactSets::getInstance(), _1, _2)); } else { // <FS:Ansariel> Optional hiding of display name update notification if (gSavedSettings.getBOOL("FSShowDisplayNameUpdateNotification")) { LLNotificationsUtil::add("DisplayNameUpdate", args); } // </FS:Ansariel> Optional hiding of display name update notification } if (agent_id == gAgent.getID()) { LLViewerDisplayName::sNameChangedSignal(); } // <FS:Ansariel> Update name in radar else { FSRadar* radar = FSRadar::getInstance(); if (radar) { radar->updateName(agent_id); } } // </FS:Ansariel> } }; LLHTTPRegistration<LLSetDisplayNameReply> gHTTPRegistrationMessageSetDisplayNameReply( "/message/SetDisplayNameReply"); LLHTTPRegistration<LLDisplayNameUpdate> gHTTPRegistrationMessageDisplayNameUpdate( "/message/DisplayNameUpdate");
lgpl-2.1
pbaranchikov/checkstyle
src/tests/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryParenthesesCheckTest.java
5343
//////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code for adherence to a set of rules. // Copyright (C) 2001-2013 Oliver Burn // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //////////////////////////////////////////////////////////////////////////////// package com.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import java.io.File; import org.junit.Test; /** * Test fixture for the UnnecessaryParenthesesCheck. * * @author Eric K. Roe */ public class UnnecessaryParenthesesCheckTest extends BaseCheckTestSupport { private static final String TEST_FILE = "coding" + File.separator + "InputUnnecessaryParentheses.java"; @Test public void testDefault() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(UnnecessaryParenthesesCheck.class); final String[] expected = { "4:22: Unnecessary parentheses around assignment right-hand side.", "4:29: Unnecessary parentheses around expression.", "4:31: Unnecessary parentheses around identifier 'i'.", "4:46: Unnecessary parentheses around assignment right-hand side.", "5:15: Unnecessary parentheses around assignment right-hand side.", "6:14: Unnecessary parentheses around identifier 'x'.", "6:17: Unnecessary parentheses around assignment right-hand side.", "7:15: Unnecessary parentheses around assignment right-hand side.", "8:14: Unnecessary parentheses around identifier 'x'.", "8:17: Unnecessary parentheses around assignment right-hand side.", "11:22: Unnecessary parentheses around assignment right-hand side.", "11:30: Unnecessary parentheses around identifier 'i'.", "11:46: Unnecessary parentheses around assignment right-hand side.", "15:17: Unnecessary parentheses around literal '0'.", "25:11: Unnecessary parentheses around assignment right-hand side.", "29:11: Unnecessary parentheses around assignment right-hand side.", "31:11: Unnecessary parentheses around assignment right-hand side.", "33:11: Unnecessary parentheses around assignment right-hand side.", "34:16: Unnecessary parentheses around identifier 'a'.", "35:14: Unnecessary parentheses around identifier 'a'.", "35:20: Unnecessary parentheses around identifier 'b'.", "35:26: Unnecessary parentheses around literal '600'.", "35:40: Unnecessary parentheses around literal '12.5f'.", "35:56: Unnecessary parentheses around identifier 'arg2'.", "36:14: Unnecessary parentheses around string \"this\".", "36:25: Unnecessary parentheses around string \"that\".", "37:11: Unnecessary parentheses around assignment right-hand side.", "37:14: Unnecessary parentheses around string \"this is a really, really...\".", "39:16: Unnecessary parentheses around return value.", "43:21: Unnecessary parentheses around literal '1'.", "43:26: Unnecessary parentheses around literal '13.5'.", "44:22: Unnecessary parentheses around literal 'true'.", "45:17: Unnecessary parentheses around identifier 'b'.", "49:17: Unnecessary parentheses around assignment right-hand side.", "51:11: Unnecessary parentheses around assignment right-hand side.", "53:16: Unnecessary parentheses around return value.", "63:13: Unnecessary parentheses around expression.", "67:16: Unnecessary parentheses around expression.", "72:19: Unnecessary parentheses around expression.", "73:23: Unnecessary parentheses around literal '4000'.", "78:19: Unnecessary parentheses around assignment right-hand side.", "80:11: Unnecessary parentheses around assignment right-hand side.", "80:16: Unnecessary parentheses around literal '3'.", "81:27: Unnecessary parentheses around assignment right-hand side.", }; verify(checkConfig, getPath(TEST_FILE), expected); } @Test public void test15Extensions() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(UnnecessaryParenthesesCheck.class); final String[] expected = {}; verify(checkConfig, getPath("Input15Extensions.java"), expected); } }
lgpl-2.1
mccdo/osghaptics
src/osgHaptics/HapticRenderLeaf.cpp
3952
/* -*-c++-*- $Id: Version,v 1.2 2004/04/20 12:26:04 andersb Exp $ */ /** * OsgHaptics - OpenSceneGraph Haptic Library * Copyright (C) 2006 VRlab, Umeå University * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #include <osgHaptics/HapticRenderLeaf.h> #include <osgHaptics/RenderTriangleOperator.h> #include <osgHaptics/HapticRenderBin.h> #include <osgHaptics/Shape.h> #include <osgUtil/StateGraph> #include <osg/Geometry> #include <osg/TriangleFunctor> using namespace osgHaptics; void HapticRenderLeaf::render(osg::RenderInfo& renderInfo,osgUtil::RenderLeaf* previous) { // don't draw this leaf if the abort rendering flag has been set. if (renderInfo.getState()->getAbortRendering()) { //cout << "early abort"<<endl; return; } if (previous) { // apply matrices if required. renderInfo.getState()->applyProjectionMatrix(_projection.get()); renderInfo.getState()->applyModelViewMatrix(_modelview.get()); // apply state if required. osgUtil::StateGraph* prev_rg = previous->_parent; osgUtil::StateGraph* prev_rg_parent = prev_rg->_parent; osgUtil::StateGraph* rg = _parent; if (prev_rg_parent!=rg->_parent) { osgUtil::StateGraph::moveStateGraph(*renderInfo.getState(),prev_rg_parent,rg->_parent); // send state changes and matrix changes to OpenGL. renderInfo.getState()->apply(rg->_stateset.get()); } else if (rg!=prev_rg) { // send state changes and matrix changes to OpenGL. renderInfo.getState()->apply(rg->_stateset.get()); } const osgHaptics::Shape *shape = m_renderbin->getShape(renderInfo); //--by SophiaSoo/CUHK: for two arms // Does this shape contain the device currently rendered? if (!shape || !shape->containCurrentDevice()) { return; } bool render_shape=false; render_shape = !m_renderbin->hasBeenDrawn(renderInfo); // If we have a shape, // and the device is reporting, Dont render haptic shape, // then bail out and skip the rendering of this HapticRenderLeaf if (shape && !shape->getHapticDevice()->getEnableShapeRender()) return; if (shape && render_shape) { //shape = static_cast<const osgHaptics::Shape*> (sa); shape->preDraw(); } #ifdef OSGUTIL_RENDERBACKEND_USE_REF_PTR osg::Geometry* geom = dynamic_cast<osg::Geometry *>(_drawable.get()); #else osg::Geometry* geom = dynamic_cast<osg::Geometry *>(_drawable); #endif if (geom) { RenderTriangleOperator op; geom->accept(op); } else // draw the drawable { _drawable->draw(renderInfo); } if (shape && render_shape) { shape->postDraw(); } } else { std::cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl; // apply matrices if required. renderInfo.getState()->applyProjectionMatrix(_projection.get()); renderInfo.getState()->applyModelViewMatrix(_modelview.get()); // apply state if required. osgUtil::StateGraph::moveStateGraph(*renderInfo.getState(),NULL,_parent->_parent); #ifdef OSGUTIL_RENDERBACKEND_USE_REF_PTR renderInfo.getState()->apply(_parent->_stateset.get()); #else renderInfo.getState()->apply(_parent->_stateset); #endif // draw the drawable _drawable->draw(renderInfo); } }
lgpl-2.1
automenta/jadehell
src/main/java/jade/core/NodeDescriptor.java
5958
/***************************************************************** JADE - Java Agent DEvelopment Framework is a framework to develop multi-agent systems in compliance with the FIPA specifications. Copyright (C) 2000 CSELT S.p.A. GNU Lesser General Public License This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, version 2.1 of the License. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *****************************************************************/ package jade.core; //#APIDOC_EXCLUDE_FILE import jade.util.leap.Serializable; import jade.security.JADEPrincipal; import jade.security.Credentials; /** The <code>NodeDescriptor</code> class serves as a meta-level description of a kernel-level service. Instances of this class contain a <code>Node</code> object, along with its name and properties, and are used in service management operations, as well as in agent-level introspection of platform-level entities. @author Giovanni Rimassa - FRAMeTech s.r.l. @see Node */ public class NodeDescriptor implements Serializable { /** Builds a new node descriptor, describing the given node with the given name and properties. @param nn The name of the described node. @param node The described <code>Node</code> object. */ public NodeDescriptor(Node node) { myName = node.getName(); myNode = node; } /** Builds a node descriptor for a node hosting an agent container. @param cid The container ID for the hosted container. @param node The described <code>Node</code> object. @param principal The principal of the node owner. @param credentials The credentials of the node owner. */ public NodeDescriptor(ContainerID cid, Node node) { myName = cid.getName(); myNode = node; myContainer = cid; } /** Builds an uninitialized node descriptor. @see NodeDescriptor#setName(String sn) @see NodeDescriptor#setNode(Node node) */ public NodeDescriptor() { } /** Change the name (if any) of the described node. @param nn The name to assign to the described node. */ public void setName(String nn) { myName = nn; } /** Retrieve the name (if any) of the described node. @return The name of the described node, or <code>null</code> if no name was set. */ public String getName() { return myName; } /** Change the described node (if any). @param node The <code>Node</code> object that is to be described by this node descriptor. */ public void setNode(Node node) { myNode = node; } /** Retrieve the described node. @return The <code>Node</code> object described by this node descriptor, or <code>null</code> if no node was set. */ public Node getNode() { return myNode; } /** Retrieve the ID of the container (if any) hosted by the described node. @return The <code>ContainerID</code> of the hosted container, or <code>null</code> if no such container was set. */ public ContainerID getContainer() { return myContainer; } public void setParentNode(Node n) { parentNode = n; } public Node getParentNode() { return parentNode; } /** Set the username of the owner of the described node */ public void setUsername(String username) { this.username = username; } /** Retrieve the username of the owner of the described node */ public String getUsername() { return username; } /** Set the password of the owner of the described node */ public void setPassword(byte[] password) { this.password = password; } /** Retrieve the password of the owner of the described node */ public byte[] getPassword() { return password; } /** Set the principal of the described node */ public void setPrincipal(JADEPrincipal principal) { myPrincipal = principal; } /** Retrieve the principal of the described node */ public JADEPrincipal getPrincipal() { return myPrincipal; } /** Set the principal of the owner of this node */ public void setOwnerPrincipal(JADEPrincipal principal) { ownerPrincipal = principal; } /** Retrieve the principal of the owner of this node (if any) @return The principal of the owner of this node, or <code>null</code> if no principal was set. */ public JADEPrincipal getOwnerPrincipal() { return ownerPrincipal; } /** Set the credentials of the owner of this node */ public void setOwnerCredentials(Credentials credentials) { ownerCredentials = credentials; } /** Retrieve the credentials of the owner of this node (if any) @return The credentials of the owner of this node, or <code>null</code> if no credentials were set. */ public Credentials getOwnerCredentials() { return ownerCredentials; } private String myName; private Node myNode; private Node parentNode; private ContainerID myContainer; private String username; private byte[] password; private JADEPrincipal myPrincipal; private JADEPrincipal ownerPrincipal; private Credentials ownerCredentials; }
lgpl-2.1
rpavlik/vrjuggler-2.2-debs
modules/gadgeteer/gadget/Type/Command.cpp
6203
/*************** <auto-copyright.pl BEGIN do not edit this line> ************** * * VR Juggler is (C) Copyright 1998-2007 by Iowa State University * * Original Authors: * Allen Bierbaum, Christopher Just, * Patrick Hartling, Kevin Meinert, * Carolina Cruz-Neira, Albert Baker * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * *************** <auto-copyright.pl END do not edit this line> ***************/ #include <gadget/gadgetConfig.h> #include <boost/concept_check.hpp> #include <vpr/Util/Debug.h> #include <vpr/IO/ObjectWriter.h> #include <vpr/IO/ObjectReader.h> #include <gadget/Type/Command.h> namespace gadget { const CommandData Command::getCommandData(int devNum) { SampleBuffer_t::buffer_t& stable_buffer = mCommandSamples.stableBuffer(); if ( (!stable_buffer.empty()) && (stable_buffer.back().size() > (unsigned)devNum) ) // If Have entry && devNum in range { return stable_buffer.back()[devNum]; } else // No data or request out of range, return default value { if ( stable_buffer.empty() ) { vprDEBUG(vprDBG_ALL, vprDBG_WARNING_LVL) << "WARNING: [gadget::Command::getCommandData()] " << "Stable buffer is empty. If this is not the first " << "read, then this is a problem.\n" << vprDEBUG_FLUSH; } else { vprDEBUG(vprDBG_ALL, vprDBG_CONFIG_LVL) << "WARNING: [gadget::Command::getCommandData()] " << "Requested devNum (" << devNum << ") is not in the range available. " << "This is probably a configuration error.\n" << vprDEBUG_FLUSH; } return mDefaultValue; } } void Command::writeObject(vpr::ObjectWriter* writer) { writer->beginTag(Command::getInputTypeName()); SampleBuffer_t::buffer_t& stable_buffer = mCommandSamples.stableBuffer(); writer->beginAttribute(gadget::tokens::DataTypeAttrib); // Write out the data type so that we can assert if reading in wrong // place. writer->writeUint16(MSG_DATA_COMMAND); writer->endAttribute(); writer->beginAttribute(gadget::tokens::SampleBufferLenAttrib); // Write the # of vectors in the stable buffer. writer->writeUint16(stable_buffer.size()); writer->endAttribute(); if ( !stable_buffer.empty() ) { mCommandSamples.lock(); for ( unsigned j = 0; j < stable_buffer.size(); ++j ) // For each vector in the stable buffer { writer->beginTag(gadget::tokens::BufferSampleTag); writer->beginAttribute(gadget::tokens::BufferSampleLenAttrib); writer->writeUint16(stable_buffer[j].size()); // Write the # of CommandDatas in the vector writer->endAttribute(); for ( unsigned i = 0; i < stable_buffer[j].size(); ++i ) // For each CommandData in the vector { writer->beginTag(gadget::tokens::DigitalValue); writer->beginAttribute(gadget::tokens::TimeStamp); writer->writeUint64(stable_buffer[j][i].getTime().usec()); // Write Time Stamp vpr::Uint64 writer->endAttribute(); writer->writeUint32((vpr::Uint32)stable_buffer[j][i].getDigital()); // Write Command Data(int) writer->endTag(); } writer->endTag(); } mCommandSamples.unlock(); } writer->endTag(); } void Command::readObject(vpr::ObjectReader* reader) { vprASSERT(reader->attribExists("rim.timestamp.delta")); vpr::Uint64 delta = reader->getAttrib<vpr::Uint64>("rim.timestamp.delta"); // ASSERT if this data is really not Command Data reader->beginTag(Command::getInputTypeName()); reader->beginAttribute(gadget::tokens::DataTypeAttrib); vpr::Uint16 temp = reader->readUint16(); reader->endAttribute(); // XXX: Should there be error checking for the case when vprASSERT() // is compiled out? -PH 8/21/2003 vprASSERT(temp==MSG_DATA_COMMAND && "[Remote Input Manager]Not Command Data"); boost::ignore_unused_variable_warning(temp); std::vector<CommandData> dataSample; unsigned numCommandDatas; vpr::Uint32 value; vpr::Uint64 timeStamp; CommandData temp_command_data; reader->beginAttribute(gadget::tokens::SampleBufferLenAttrib); unsigned numVectors = reader->readUint16(); reader->endAttribute(); mCommandSamples.lock(); for ( unsigned i = 0; i < numVectors; ++i ) { reader->beginTag(gadget::tokens::BufferSampleTag); reader->beginAttribute(gadget::tokens::BufferSampleLenAttrib); numCommandDatas = reader->readUint16(); reader->endAttribute(); dataSample.clear(); for ( unsigned j = 0; j < numCommandDatas; ++j ) { reader->beginTag(gadget::tokens::DigitalValue); reader->beginAttribute(gadget::tokens::TimeStamp); timeStamp = reader->readUint64(); // read Time Stamp vpr::Uint64 reader->endAttribute(); value = reader->readUint32(); // read Command Data(int) reader->endTag(); temp_command_data.setDigital(value); temp_command_data.setTime(vpr::Interval(timeStamp + delta,vpr::Interval::Usec)); dataSample.push_back(temp_command_data); } mCommandSamples.addSample(dataSample); reader->endTag(); } mCommandSamples.unlock(); mCommandSamples.swapBuffers(); reader->endTag(); } } // End of gadget namespace
lgpl-2.1
jims/openal-soft
Alc/ALc.c
89222
/** * OpenAL cross platform audio library * Copyright (C) 1999-2007 by authors. * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * Or go to http://www.gnu.org/copyleft/lgpl.html */ #include "config.h" #include <math.h> #include <stdlib.h> #include <stdio.h> #include <memory.h> #include <ctype.h> #include <signal.h> #include "alMain.h" #include "alSource.h" #include "AL/al.h" #include "AL/alc.h" #include "alThunk.h" #include "alSource.h" #include "alBuffer.h" #include "alAuxEffectSlot.h" #include "alError.h" #include "bs2b.h" #include "alu.h" /************************************************ * Backends ************************************************/ #define EmptyFuncs { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } static struct BackendInfo BackendList[] = { #ifdef HAVE_PULSEAUDIO { "pulse", alc_pulse_init, alc_pulse_deinit, alc_pulse_probe, EmptyFuncs }, #endif #ifdef HAVE_ALSA { "alsa", alc_alsa_init, alc_alsa_deinit, alc_alsa_probe, EmptyFuncs }, #endif #ifdef HAVE_COREAUDIO { "core", alc_ca_init, alc_ca_deinit, alc_ca_probe, EmptyFuncs }, #endif #ifdef HAVE_OSS { "oss", alc_oss_init, alc_oss_deinit, alc_oss_probe, EmptyFuncs }, #endif #ifdef HAVE_SOLARIS { "solaris", alc_solaris_init, alc_solaris_deinit, alc_solaris_probe, EmptyFuncs }, #endif #ifdef HAVE_SNDIO { "sndio", alc_sndio_init, alc_sndio_deinit, alc_sndio_probe, EmptyFuncs }, #endif #ifdef HAVE_MMDEVAPI { "mmdevapi", alcMMDevApiInit, alcMMDevApiDeinit, alcMMDevApiProbe, EmptyFuncs }, #endif #ifdef HAVE_DSOUND { "dsound", alcDSoundInit, alcDSoundDeinit, alcDSoundProbe, EmptyFuncs }, #endif #ifdef HAVE_WINMM { "winmm", alcWinMMInit, alcWinMMDeinit, alcWinMMProbe, EmptyFuncs }, #endif #ifdef HAVE_PORTAUDIO { "port", alc_pa_init, alc_pa_deinit, alc_pa_probe, EmptyFuncs }, #endif #ifdef HAVE_OPENSL { "opensl", alc_opensl_init, alc_opensl_deinit, alc_opensl_probe, EmptyFuncs }, #endif { "null", alc_null_init, alc_null_deinit, alc_null_probe, EmptyFuncs }, #ifdef HAVE_WAVE { "wave", alc_wave_init, alc_wave_deinit, alc_wave_probe, EmptyFuncs }, #endif { NULL, NULL, NULL, NULL, EmptyFuncs } }; static struct BackendInfo BackendLoopback = { "loopback", alc_loopback_init, alc_loopback_deinit, alc_loopback_probe, EmptyFuncs }; #undef EmptyFuncs static struct BackendInfo PlaybackBackend; static struct BackendInfo CaptureBackend; /************************************************ * Functions, enums, and errors ************************************************/ typedef struct ALCfunction { const ALCchar *funcName; ALCvoid *address; } ALCfunction; typedef struct ALCenums { const ALCchar *enumName; ALCenum value; } ALCenums; #define DECL(x) { #x, (ALCvoid*)(x) } static const ALCfunction alcFunctions[] = { DECL(alcCreateContext), DECL(alcMakeContextCurrent), DECL(alcProcessContext), DECL(alcSuspendContext), DECL(alcDestroyContext), DECL(alcGetCurrentContext), DECL(alcGetContextsDevice), DECL(alcOpenDevice), DECL(alcCloseDevice), DECL(alcGetError), DECL(alcIsExtensionPresent), DECL(alcGetProcAddress), DECL(alcGetEnumValue), DECL(alcGetString), DECL(alcGetIntegerv), DECL(alcCaptureOpenDevice), DECL(alcCaptureCloseDevice), DECL(alcCaptureStart), DECL(alcCaptureStop), DECL(alcCaptureSamples), DECL(alcSetThreadContext), DECL(alcGetThreadContext), DECL(alcLoopbackOpenDeviceSOFT), DECL(alcIsRenderFormatSupportedSOFT), DECL(alcRenderSamplesSOFT), DECL(alEnable), DECL(alDisable), DECL(alIsEnabled), DECL(alGetString), DECL(alGetBooleanv), DECL(alGetIntegerv), DECL(alGetFloatv), DECL(alGetDoublev), DECL(alGetBoolean), DECL(alGetInteger), DECL(alGetFloat), DECL(alGetDouble), DECL(alGetError), DECL(alIsExtensionPresent), DECL(alGetProcAddress), DECL(alGetEnumValue), DECL(alListenerf), DECL(alListener3f), DECL(alListenerfv), DECL(alListeneri), DECL(alListener3i), DECL(alListeneriv), DECL(alGetListenerf), DECL(alGetListener3f), DECL(alGetListenerfv), DECL(alGetListeneri), DECL(alGetListener3i), DECL(alGetListeneriv), DECL(alGenSources), DECL(alDeleteSources), DECL(alIsSource), DECL(alSourcef), DECL(alSource3f), DECL(alSourcefv), DECL(alSourcei), DECL(alSource3i), DECL(alSourceiv), DECL(alGetSourcef), DECL(alGetSource3f), DECL(alGetSourcefv), DECL(alGetSourcei), DECL(alGetSource3i), DECL(alGetSourceiv), DECL(alSourcePlayv), DECL(alSourceStopv), DECL(alSourceRewindv), DECL(alSourcePausev), DECL(alSourcePlay), DECL(alSourceStop), DECL(alSourceRewind), DECL(alSourcePause), DECL(alSourceQueueBuffers), DECL(alSourceUnqueueBuffers), DECL(alGenBuffers), DECL(alDeleteBuffers), DECL(alIsBuffer), DECL(alBufferData), DECL(alBufferf), DECL(alBuffer3f), DECL(alBufferfv), DECL(alBufferi), DECL(alBuffer3i), DECL(alBufferiv), DECL(alGetBufferf), DECL(alGetBuffer3f), DECL(alGetBufferfv), DECL(alGetBufferi), DECL(alGetBuffer3i), DECL(alGetBufferiv), DECL(alDopplerFactor), DECL(alDopplerVelocity), DECL(alSpeedOfSound), DECL(alDistanceModel), DECL(alGenFilters), DECL(alDeleteFilters), DECL(alIsFilter), DECL(alFilteri), DECL(alFilteriv), DECL(alFilterf), DECL(alFilterfv), DECL(alGetFilteri), DECL(alGetFilteriv), DECL(alGetFilterf), DECL(alGetFilterfv), DECL(alGenEffects), DECL(alDeleteEffects), DECL(alIsEffect), DECL(alEffecti), DECL(alEffectiv), DECL(alEffectf), DECL(alEffectfv), DECL(alGetEffecti), DECL(alGetEffectiv), DECL(alGetEffectf), DECL(alGetEffectfv), DECL(alGenAuxiliaryEffectSlots), DECL(alDeleteAuxiliaryEffectSlots), DECL(alIsAuxiliaryEffectSlot), DECL(alAuxiliaryEffectSloti), DECL(alAuxiliaryEffectSlotiv), DECL(alAuxiliaryEffectSlotf), DECL(alAuxiliaryEffectSlotfv), DECL(alGetAuxiliaryEffectSloti), DECL(alGetAuxiliaryEffectSlotiv), DECL(alGetAuxiliaryEffectSlotf), DECL(alGetAuxiliaryEffectSlotfv), DECL(alBufferSubDataSOFT), DECL(alBufferSamplesSOFT), DECL(alBufferSubSamplesSOFT), DECL(alGetBufferSamplesSOFT), DECL(alIsBufferFormatSupportedSOFT), DECL(alDeferUpdatesSOFT), DECL(alProcessUpdatesSOFT), DECL(alGetSourcedSOFT), DECL(alGetSource3dSOFT), DECL(alGetSourcedvSOFT), DECL(alGetSourcei64SOFT), DECL(alGetSource3i64SOFT), DECL(alGetSourcei64vSOFT), { NULL, NULL } }; #undef DECL #define DECL(x) { #x, (x) } static const ALCenums enumeration[] = { DECL(ALC_INVALID), DECL(ALC_FALSE), DECL(ALC_TRUE), DECL(ALC_MAJOR_VERSION), DECL(ALC_MINOR_VERSION), DECL(ALC_ATTRIBUTES_SIZE), DECL(ALC_ALL_ATTRIBUTES), DECL(ALC_DEFAULT_DEVICE_SPECIFIER), DECL(ALC_DEVICE_SPECIFIER), DECL(ALC_ALL_DEVICES_SPECIFIER), DECL(ALC_DEFAULT_ALL_DEVICES_SPECIFIER), DECL(ALC_EXTENSIONS), DECL(ALC_FREQUENCY), DECL(ALC_REFRESH), DECL(ALC_SYNC), DECL(ALC_MONO_SOURCES), DECL(ALC_STEREO_SOURCES), DECL(ALC_CAPTURE_DEVICE_SPECIFIER), DECL(ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER), DECL(ALC_CAPTURE_SAMPLES), DECL(ALC_CONNECTED), DECL(ALC_EFX_MAJOR_VERSION), DECL(ALC_EFX_MINOR_VERSION), DECL(ALC_MAX_AUXILIARY_SENDS), DECL(ALC_FORMAT_CHANNELS_SOFT), DECL(ALC_FORMAT_TYPE_SOFT), DECL(ALC_MONO_SOFT), DECL(ALC_STEREO_SOFT), DECL(ALC_QUAD_SOFT), DECL(ALC_5POINT1_SOFT), DECL(ALC_6POINT1_SOFT), DECL(ALC_7POINT1_SOFT), DECL(ALC_BYTE_SOFT), DECL(ALC_UNSIGNED_BYTE_SOFT), DECL(ALC_SHORT_SOFT), DECL(ALC_UNSIGNED_SHORT_SOFT), DECL(ALC_INT_SOFT), DECL(ALC_UNSIGNED_INT_SOFT), DECL(ALC_FLOAT_SOFT), DECL(ALC_NO_ERROR), DECL(ALC_INVALID_DEVICE), DECL(ALC_INVALID_CONTEXT), DECL(ALC_INVALID_ENUM), DECL(ALC_INVALID_VALUE), DECL(ALC_OUT_OF_MEMORY), DECL(AL_INVALID), DECL(AL_NONE), DECL(AL_FALSE), DECL(AL_TRUE), DECL(AL_SOURCE_RELATIVE), DECL(AL_CONE_INNER_ANGLE), DECL(AL_CONE_OUTER_ANGLE), DECL(AL_PITCH), DECL(AL_POSITION), DECL(AL_DIRECTION), DECL(AL_VELOCITY), DECL(AL_LOOPING), DECL(AL_BUFFER), DECL(AL_GAIN), DECL(AL_MIN_GAIN), DECL(AL_MAX_GAIN), DECL(AL_ORIENTATION), DECL(AL_REFERENCE_DISTANCE), DECL(AL_ROLLOFF_FACTOR), DECL(AL_CONE_OUTER_GAIN), DECL(AL_MAX_DISTANCE), DECL(AL_SEC_OFFSET), DECL(AL_SAMPLE_OFFSET), DECL(AL_SAMPLE_RW_OFFSETS_SOFT), DECL(AL_BYTE_OFFSET), DECL(AL_BYTE_RW_OFFSETS_SOFT), DECL(AL_SOURCE_TYPE), DECL(AL_STATIC), DECL(AL_STREAMING), DECL(AL_UNDETERMINED), DECL(AL_METERS_PER_UNIT), DECL(AL_DIRECT_CHANNELS_SOFT), DECL(AL_DIRECT_FILTER), DECL(AL_AUXILIARY_SEND_FILTER), DECL(AL_AIR_ABSORPTION_FACTOR), DECL(AL_ROOM_ROLLOFF_FACTOR), DECL(AL_CONE_OUTER_GAINHF), DECL(AL_DIRECT_FILTER_GAINHF_AUTO), DECL(AL_AUXILIARY_SEND_FILTER_GAIN_AUTO), DECL(AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO), DECL(AL_SOURCE_STATE), DECL(AL_INITIAL), DECL(AL_PLAYING), DECL(AL_PAUSED), DECL(AL_STOPPED), DECL(AL_BUFFERS_QUEUED), DECL(AL_BUFFERS_PROCESSED), DECL(AL_FORMAT_MONO8), DECL(AL_FORMAT_MONO16), DECL(AL_FORMAT_MONO_FLOAT32), DECL(AL_FORMAT_MONO_DOUBLE_EXT), DECL(AL_FORMAT_STEREO8), DECL(AL_FORMAT_STEREO16), DECL(AL_FORMAT_STEREO_FLOAT32), DECL(AL_FORMAT_STEREO_DOUBLE_EXT), DECL(AL_FORMAT_MONO_IMA4), DECL(AL_FORMAT_STEREO_IMA4), DECL(AL_FORMAT_QUAD8_LOKI), DECL(AL_FORMAT_QUAD16_LOKI), DECL(AL_FORMAT_QUAD8), DECL(AL_FORMAT_QUAD16), DECL(AL_FORMAT_QUAD32), DECL(AL_FORMAT_51CHN8), DECL(AL_FORMAT_51CHN16), DECL(AL_FORMAT_51CHN32), DECL(AL_FORMAT_61CHN8), DECL(AL_FORMAT_61CHN16), DECL(AL_FORMAT_61CHN32), DECL(AL_FORMAT_71CHN8), DECL(AL_FORMAT_71CHN16), DECL(AL_FORMAT_71CHN32), DECL(AL_FORMAT_REAR8), DECL(AL_FORMAT_REAR16), DECL(AL_FORMAT_REAR32), DECL(AL_FORMAT_MONO_MULAW), DECL(AL_FORMAT_MONO_MULAW_EXT), DECL(AL_FORMAT_STEREO_MULAW), DECL(AL_FORMAT_STEREO_MULAW_EXT), DECL(AL_FORMAT_QUAD_MULAW), DECL(AL_FORMAT_51CHN_MULAW), DECL(AL_FORMAT_61CHN_MULAW), DECL(AL_FORMAT_71CHN_MULAW), DECL(AL_FORMAT_REAR_MULAW), DECL(AL_FORMAT_MONO_ALAW_EXT), DECL(AL_FORMAT_STEREO_ALAW_EXT), DECL(AL_MONO8_SOFT), DECL(AL_MONO16_SOFT), DECL(AL_MONO32F_SOFT), DECL(AL_STEREO8_SOFT), DECL(AL_STEREO16_SOFT), DECL(AL_STEREO32F_SOFT), DECL(AL_QUAD8_SOFT), DECL(AL_QUAD16_SOFT), DECL(AL_QUAD32F_SOFT), DECL(AL_REAR8_SOFT), DECL(AL_REAR16_SOFT), DECL(AL_REAR32F_SOFT), DECL(AL_5POINT1_8_SOFT), DECL(AL_5POINT1_16_SOFT), DECL(AL_5POINT1_32F_SOFT), DECL(AL_6POINT1_8_SOFT), DECL(AL_6POINT1_16_SOFT), DECL(AL_6POINT1_32F_SOFT), DECL(AL_7POINT1_8_SOFT), DECL(AL_7POINT1_16_SOFT), DECL(AL_7POINT1_32F_SOFT), DECL(AL_MONO_SOFT), DECL(AL_STEREO_SOFT), DECL(AL_QUAD_SOFT), DECL(AL_REAR_SOFT), DECL(AL_5POINT1_SOFT), DECL(AL_6POINT1_SOFT), DECL(AL_7POINT1_SOFT), DECL(AL_BYTE_SOFT), DECL(AL_UNSIGNED_BYTE_SOFT), DECL(AL_SHORT_SOFT), DECL(AL_UNSIGNED_SHORT_SOFT), DECL(AL_INT_SOFT), DECL(AL_UNSIGNED_INT_SOFT), DECL(AL_FLOAT_SOFT), DECL(AL_DOUBLE_SOFT), DECL(AL_BYTE3_SOFT), DECL(AL_UNSIGNED_BYTE3_SOFT), DECL(AL_FREQUENCY), DECL(AL_BITS), DECL(AL_CHANNELS), DECL(AL_SIZE), DECL(AL_INTERNAL_FORMAT_SOFT), DECL(AL_BYTE_LENGTH_SOFT), DECL(AL_SAMPLE_LENGTH_SOFT), DECL(AL_SEC_LENGTH_SOFT), DECL(AL_UNUSED), DECL(AL_PENDING), DECL(AL_PROCESSED), DECL(AL_NO_ERROR), DECL(AL_INVALID_NAME), DECL(AL_INVALID_ENUM), DECL(AL_INVALID_VALUE), DECL(AL_INVALID_OPERATION), DECL(AL_OUT_OF_MEMORY), DECL(AL_VENDOR), DECL(AL_VERSION), DECL(AL_RENDERER), DECL(AL_EXTENSIONS), DECL(AL_DOPPLER_FACTOR), DECL(AL_DOPPLER_VELOCITY), DECL(AL_DISTANCE_MODEL), DECL(AL_SPEED_OF_SOUND), DECL(AL_SOURCE_DISTANCE_MODEL), DECL(AL_DEFERRED_UPDATES_SOFT), DECL(AL_INVERSE_DISTANCE), DECL(AL_INVERSE_DISTANCE_CLAMPED), DECL(AL_LINEAR_DISTANCE), DECL(AL_LINEAR_DISTANCE_CLAMPED), DECL(AL_EXPONENT_DISTANCE), DECL(AL_EXPONENT_DISTANCE_CLAMPED), DECL(AL_FILTER_TYPE), DECL(AL_FILTER_NULL), DECL(AL_FILTER_LOWPASS), #if 0 DECL(AL_FILTER_HIGHPASS), DECL(AL_FILTER_BANDPASS), #endif DECL(AL_LOWPASS_GAIN), DECL(AL_LOWPASS_GAINHF), DECL(AL_EFFECT_TYPE), DECL(AL_EFFECT_NULL), DECL(AL_EFFECT_REVERB), DECL(AL_EFFECT_EAXREVERB), #if 0 DECL(AL_EFFECT_CHORUS), DECL(AL_EFFECT_DISTORTION), #endif DECL(AL_EFFECT_ECHO), #if 0 DECL(AL_EFFECT_FLANGER), DECL(AL_EFFECT_FREQUENCY_SHIFTER), DECL(AL_EFFECT_VOCAL_MORPHER), DECL(AL_EFFECT_PITCH_SHIFTER), #endif DECL(AL_EFFECT_RING_MODULATOR), #if 0 DECL(AL_EFFECT_AUTOWAH), DECL(AL_EFFECT_COMPRESSOR), DECL(AL_EFFECT_EQUALIZER), #endif DECL(AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT), DECL(AL_EFFECT_DEDICATED_DIALOGUE), DECL(AL_EAXREVERB_DENSITY), DECL(AL_EAXREVERB_DIFFUSION), DECL(AL_EAXREVERB_GAIN), DECL(AL_EAXREVERB_GAINHF), DECL(AL_EAXREVERB_GAINLF), DECL(AL_EAXREVERB_DECAY_TIME), DECL(AL_EAXREVERB_DECAY_HFRATIO), DECL(AL_EAXREVERB_DECAY_LFRATIO), DECL(AL_EAXREVERB_REFLECTIONS_GAIN), DECL(AL_EAXREVERB_REFLECTIONS_DELAY), DECL(AL_EAXREVERB_REFLECTIONS_PAN), DECL(AL_EAXREVERB_LATE_REVERB_GAIN), DECL(AL_EAXREVERB_LATE_REVERB_DELAY), DECL(AL_EAXREVERB_LATE_REVERB_PAN), DECL(AL_EAXREVERB_ECHO_TIME), DECL(AL_EAXREVERB_ECHO_DEPTH), DECL(AL_EAXREVERB_MODULATION_TIME), DECL(AL_EAXREVERB_MODULATION_DEPTH), DECL(AL_EAXREVERB_AIR_ABSORPTION_GAINHF), DECL(AL_EAXREVERB_HFREFERENCE), DECL(AL_EAXREVERB_LFREFERENCE), DECL(AL_EAXREVERB_ROOM_ROLLOFF_FACTOR), DECL(AL_EAXREVERB_DECAY_HFLIMIT), DECL(AL_REVERB_DENSITY), DECL(AL_REVERB_DIFFUSION), DECL(AL_REVERB_GAIN), DECL(AL_REVERB_GAINHF), DECL(AL_REVERB_DECAY_TIME), DECL(AL_REVERB_DECAY_HFRATIO), DECL(AL_REVERB_REFLECTIONS_GAIN), DECL(AL_REVERB_REFLECTIONS_DELAY), DECL(AL_REVERB_LATE_REVERB_GAIN), DECL(AL_REVERB_LATE_REVERB_DELAY), DECL(AL_REVERB_AIR_ABSORPTION_GAINHF), DECL(AL_REVERB_ROOM_ROLLOFF_FACTOR), DECL(AL_REVERB_DECAY_HFLIMIT), DECL(AL_ECHO_DELAY), DECL(AL_ECHO_LRDELAY), DECL(AL_ECHO_DAMPING), DECL(AL_ECHO_FEEDBACK), DECL(AL_ECHO_SPREAD), DECL(AL_RING_MODULATOR_FREQUENCY), DECL(AL_RING_MODULATOR_HIGHPASS_CUTOFF), DECL(AL_RING_MODULATOR_WAVEFORM), DECL(AL_DEDICATED_GAIN), { NULL, (ALCenum)0 } }; #undef DECL static const ALCchar alcNoError[] = "No Error"; static const ALCchar alcErrInvalidDevice[] = "Invalid Device"; static const ALCchar alcErrInvalidContext[] = "Invalid Context"; static const ALCchar alcErrInvalidEnum[] = "Invalid Enum"; static const ALCchar alcErrInvalidValue[] = "Invalid Value"; static const ALCchar alcErrOutOfMemory[] = "Out of Memory"; /************************************************ * Global variables ************************************************/ /* Enumerated device names */ static const ALCchar alcDefaultName[] = "OpenAL Soft\0"; static ALCchar *alcAllDevicesList; static ALCchar *alcCaptureDeviceList; /* Sizes only include the first ending null character, not the second */ static size_t alcAllDevicesListSize; static size_t alcCaptureDeviceListSize; /* Default is always the first in the list */ static ALCchar *alcDefaultAllDevicesSpecifier; static ALCchar *alcCaptureDefaultDeviceSpecifier; /* Default context extensions */ static const ALchar alExtList[] = "AL_EXT_ALAW AL_EXT_DOUBLE AL_EXT_EXPONENT_DISTANCE AL_EXT_FLOAT32 " "AL_EXT_IMA4 AL_EXT_LINEAR_DISTANCE AL_EXT_MCFORMATS AL_EXT_MULAW " "AL_EXT_MULAW_MCFORMATS AL_EXT_OFFSET AL_EXT_source_distance_model " "AL_LOKI_quadriphonic AL_SOFT_buffer_samples AL_SOFT_buffer_sub_data " "AL_SOFTX_deferred_updates AL_SOFT_direct_channels AL_SOFT_loop_points"; static volatile ALCenum LastNullDeviceError = ALC_NO_ERROR; /* Thread-local current context */ static pthread_key_t LocalContext; /* Process-wide current context */ static ALCcontext *volatile GlobalContext = NULL; /* Mixing thread piority level */ ALint RTPrioLevel; FILE *LogFile; #ifdef _DEBUG enum LogLevel LogLevel = LogWarning; #else enum LogLevel LogLevel = LogError; #endif /* Flag to trap ALC device errors */ static ALCboolean TrapALCError = ALC_FALSE; /* One-time configuration init control */ static pthread_once_t alc_config_once = PTHREAD_ONCE_INIT; /* Default effect that applies to sources that don't have an effect on send 0 */ static ALeffect DefaultEffect; /************************************************ * ALC information ************************************************/ static const ALCchar alcNoDeviceExtList[] = "ALC_ENUMERATE_ALL_EXT ALC_ENUMERATION_EXT ALC_EXT_CAPTURE " "ALC_EXT_thread_local_context ALC_SOFT_loopback"; static const ALCchar alcExtensionList[] = "ALC_ENUMERATE_ALL_EXT ALC_ENUMERATION_EXT ALC_EXT_CAPTURE " "ALC_EXT_DEDICATED ALC_EXT_disconnect ALC_EXT_EFX " "ALC_EXT_thread_local_context ALC_SOFT_loopback"; static const ALCint alcMajorVersion = 1; static const ALCint alcMinorVersion = 1; static const ALCint alcEFXMajorVersion = 1; static const ALCint alcEFXMinorVersion = 0; /************************************************ * Device lists ************************************************/ static ALCdevice *volatile DeviceList = NULL; static CRITICAL_SECTION ListLock; static void LockLists(void) { EnterCriticalSection(&ListLock); } static void UnlockLists(void) { LeaveCriticalSection(&ListLock); } /************************************************ * Library initialization ************************************************/ #if defined(_WIN32) static void alc_init(void); static void alc_deinit(void); static void alc_deinit_safe(void); UIntMap TlsDestructor; #ifndef AL_LIBTYPE_STATIC BOOL APIENTRY DllMain(HINSTANCE hModule,DWORD ul_reason_for_call,LPVOID lpReserved) { ALsizei i; // Perform actions based on the reason for calling. switch(ul_reason_for_call) { case DLL_PROCESS_ATTACH: /* Pin the DLL so we won't get unloaded until the process terminates */ GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_PIN | GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (WCHAR*)hModule, &hModule); InitUIntMap(&TlsDestructor, ~0); alc_init(); break; case DLL_THREAD_DETACH: LockUIntMapRead(&TlsDestructor); for(i = 0;i < TlsDestructor.size;i++) { void *ptr = pthread_getspecific(TlsDestructor.array[i].key); void (*callback)(void*) = (void(*)(void*))TlsDestructor.array[i].value; if(ptr && callback) callback(ptr); } UnlockUIntMapRead(&TlsDestructor); break; case DLL_PROCESS_DETACH: if(!lpReserved) alc_deinit(); else alc_deinit_safe(); ResetUIntMap(&TlsDestructor); break; } return TRUE; } #elif defined(_MSC_VER) #pragma section(".CRT$XCU",read) static void alc_constructor(void); static void alc_destructor(void); __declspec(allocate(".CRT$XCU")) void (__cdecl* alc_constructor_)(void) = alc_constructor; static void alc_constructor(void) { atexit(alc_destructor); alc_init(); } static void alc_destructor(void) { alc_deinit(); } #elif defined(HAVE_GCC_DESTRUCTOR) static void alc_init(void) __attribute__((constructor)); static void alc_deinit(void) __attribute__((destructor)); #else #error "No static initialization available on this platform!" #endif #elif defined(HAVE_GCC_DESTRUCTOR) static void alc_init(void) __attribute__((constructor)); static void alc_deinit(void) __attribute__((destructor)); #else #error "No global initialization available on this platform!" #endif static void ReleaseThreadCtx(void *ptr); static void alc_init(void) { const char *str; LogFile = stderr; str = getenv("__ALSOFT_HALF_ANGLE_CONES"); if(str && (strcasecmp(str, "true") == 0 || strtol(str, NULL, 0) == 1)) ConeScale *= 0.5f; str = getenv("__ALSOFT_REVERSE_Z"); if(str && (strcasecmp(str, "true") == 0 || strtol(str, NULL, 0) == 1)) ZScale *= -1.0f; pthread_key_create(&LocalContext, ReleaseThreadCtx); InitializeCriticalSection(&ListLock); ThunkInit(); } static void alc_initconfig(void) { const char *devs, *str; ALuint capfilter; float valf; int i, n; str = getenv("ALSOFT_LOGLEVEL"); if(str) { long lvl = strtol(str, NULL, 0); if(lvl >= NoLog && lvl <= LogRef) LogLevel = lvl; } str = getenv("ALSOFT_LOGFILE"); if(str && str[0]) { FILE *logfile = fopen(str, "wat"); if(logfile) LogFile = logfile; else ERR("Failed to open log file '%s'\n", str); } ReadALConfig(); capfilter = 0; #ifdef HAVE_SSE capfilter |= CPU_CAP_SSE; #endif #ifdef HAVE_NEON capfilter |= CPU_CAP_NEON; #endif if(ConfigValueStr(NULL, "disable-cpu-exts", &str)) { if(strcasecmp(str, "all") == 0) capfilter = 0; else { size_t len; const char *next = str; i = 0; do { str = next; next = strchr(str, ','); while(isspace(str[0])) str++; if(!str[0] || str[0] == ',') continue; len = (next ? ((size_t)(next-str)) : strlen(str)); if(strncasecmp(str, "sse", len) == 0) capfilter &= ~CPU_CAP_SSE; else if(strncasecmp(str, "neon", len) == 0) capfilter &= ~CPU_CAP_NEON; else WARN("Invalid CPU extension \"%s\"\n", str); } while(next++); } } FillCPUCaps(capfilter); #ifdef _WIN32 RTPrioLevel = 1; #else RTPrioLevel = 0; #endif ConfigValueInt(NULL, "rt-prio", &RTPrioLevel); if(ConfigValueStr(NULL, "resampler", &str)) { if(strcasecmp(str, "point") == 0 || strcasecmp(str, "none") == 0) DefaultResampler = PointResampler; else if(strcasecmp(str, "linear") == 0) DefaultResampler = LinearResampler; else if(strcasecmp(str, "cubic") == 0) DefaultResampler = CubicResampler; else { char *end; n = strtol(str, &end, 0); if(*end == '\0' && (n == PointResampler || n == LinearResampler || n == CubicResampler)) DefaultResampler = n; else WARN("Invalid resampler: %s\n", str); } } str = getenv("ALSOFT_TRAP_ERROR"); if(str && (strcasecmp(str, "true") == 0 || strtol(str, NULL, 0) == 1)) { TrapALError = AL_TRUE; TrapALCError = AL_TRUE; } else { str = getenv("ALSOFT_TRAP_AL_ERROR"); if(str && (strcasecmp(str, "true") == 0 || strtol(str, NULL, 0) == 1)) TrapALError = AL_TRUE; TrapALError = GetConfigValueBool(NULL, "trap-al-error", TrapALError); str = getenv("ALSOFT_TRAP_ALC_ERROR"); if(str && (strcasecmp(str, "true") == 0 || strtol(str, NULL, 0) == 1)) TrapALCError = ALC_TRUE; TrapALCError = GetConfigValueBool(NULL, "trap-alc-error", TrapALCError); } if(ConfigValueFloat("reverb", "boost", &valf)) ReverbBoost *= powf(10.0f, valf / 20.0f); EmulateEAXReverb = GetConfigValueBool("reverb", "emulate-eax", AL_FALSE); if(((devs=getenv("ALSOFT_DRIVERS")) && devs[0]) || ConfigValueStr(NULL, "drivers", &devs)) { int n; size_t len; const char *next = devs; int endlist, delitem; i = 0; do { devs = next; next = strchr(devs, ','); delitem = (devs[0] == '-'); if(devs[0] == '-') devs++; if(!devs[0] || devs[0] == ',') { endlist = 0; continue; } endlist = 1; len = (next ? ((size_t)(next-devs)) : strlen(devs)); for(n = i;BackendList[n].Init;n++) { if(len == strlen(BackendList[n].name) && strncmp(BackendList[n].name, devs, len) == 0) { if(delitem) { do { BackendList[n] = BackendList[n+1]; ++n; } while(BackendList[n].Init); } else { struct BackendInfo Bkp = BackendList[n]; while(n > i) { BackendList[n] = BackendList[n-1]; --n; } BackendList[n] = Bkp; i++; } break; } } } while(next++); if(endlist) { BackendList[i].name = NULL; BackendList[i].Init = NULL; BackendList[i].Deinit = NULL; BackendList[i].Probe = NULL; } } for(i = 0;BackendList[i].Init && (!PlaybackBackend.name || !CaptureBackend.name);i++) { if(!BackendList[i].Init(&BackendList[i].Funcs)) { WARN("Failed to initialize backend \"%s\"\n", BackendList[i].name); continue; } TRACE("Initialized backend \"%s\"\n", BackendList[i].name); if(BackendList[i].Funcs.OpenPlayback && !PlaybackBackend.name) { PlaybackBackend = BackendList[i]; TRACE("Added \"%s\" for playback\n", PlaybackBackend.name); } if(BackendList[i].Funcs.OpenCapture && !CaptureBackend.name) { CaptureBackend = BackendList[i]; TRACE("Added \"%s\" for capture\n", CaptureBackend.name); } } BackendLoopback.Init(&BackendLoopback.Funcs); if(ConfigValueStr(NULL, "excludefx", &str)) { size_t len; const char *next = str; do { str = next; next = strchr(str, ','); if(!str[0] || next == str) continue; len = (next ? ((size_t)(next-str)) : strlen(str)); for(n = 0;EffectList[n].name;n++) { if(len == strlen(EffectList[n].name) && strncmp(EffectList[n].name, str, len) == 0) DisabledEffects[EffectList[n].type] = AL_TRUE; } } while(next++); } InitEffect(&DefaultEffect); str = getenv("ALSOFT_DEFAULT_REVERB"); if((str && str[0]) || ConfigValueStr(NULL, "default-reverb", &str)) LoadReverbPreset(str, &DefaultEffect); } #define DO_INITCONFIG() pthread_once(&alc_config_once, alc_initconfig) /************************************************ * Library deinitialization ************************************************/ static void alc_cleanup(void) { ALCdevice *dev; free(alcAllDevicesList); alcAllDevicesList = NULL; alcAllDevicesListSize = 0; free(alcCaptureDeviceList); alcCaptureDeviceList = NULL; alcCaptureDeviceListSize = 0; free(alcDefaultAllDevicesSpecifier); alcDefaultAllDevicesSpecifier = NULL; free(alcCaptureDefaultDeviceSpecifier); alcCaptureDefaultDeviceSpecifier = NULL; if((dev=ExchangePtr((XchgPtr*)&DeviceList, NULL)) != NULL) { ALCuint num = 0; do { num++; } while((dev=dev->next) != NULL); ERR("%u device%s not closed\n", num, (num>1)?"s":""); } } static void alc_deinit_safe(void) { alc_cleanup(); FreeHrtfs(); FreeALConfig(); ThunkExit(); DeleteCriticalSection(&ListLock); pthread_key_delete(LocalContext); if(LogFile != stderr) fclose(LogFile); LogFile = NULL; } static void alc_deinit(void) { int i; alc_cleanup(); memset(&PlaybackBackend, 0, sizeof(PlaybackBackend)); memset(&CaptureBackend, 0, sizeof(CaptureBackend)); for(i = 0;BackendList[i].Deinit;i++) BackendList[i].Deinit(); BackendLoopback.Deinit(); alc_deinit_safe(); } /************************************************ * Device enumeration ************************************************/ static void ProbeList(ALCchar **list, size_t *listsize, enum DevProbe type) { DO_INITCONFIG(); LockLists(); free(*list); *list = NULL; *listsize = 0; if(type == ALL_DEVICE_PROBE && PlaybackBackend.Probe) PlaybackBackend.Probe(type); else if(type == CAPTURE_DEVICE_PROBE && CaptureBackend.Probe) CaptureBackend.Probe(type); UnlockLists(); } static void ProbeAllDevicesList(void) { ProbeList(&alcAllDevicesList, &alcAllDevicesListSize, ALL_DEVICE_PROBE); } static void ProbeCaptureDeviceList(void) { ProbeList(&alcCaptureDeviceList, &alcCaptureDeviceListSize, CAPTURE_DEVICE_PROBE); } static void AppendList(const ALCchar *name, ALCchar **List, size_t *ListSize) { size_t len = strlen(name); void *temp; if(len == 0) return; temp = realloc(*List, (*ListSize) + len + 2); if(!temp) { ERR("Realloc failed to add %s!\n", name); return; } *List = temp; memcpy((*List)+(*ListSize), name, len+1); *ListSize += len+1; (*List)[*ListSize] = 0; } #define DECL_APPEND_LIST_FUNC(type) \ void Append##type##List(const ALCchar *name) \ { AppendList(name, &alc##type##List, &alc##type##ListSize); } DECL_APPEND_LIST_FUNC(AllDevices) DECL_APPEND_LIST_FUNC(CaptureDevice) #undef DECL_APPEND_LIST_FUNC /************************************************ * Device format information ************************************************/ const ALCchar *DevFmtTypeString(enum DevFmtType type) { switch(type) { case DevFmtByte: return "Signed Byte"; case DevFmtUByte: return "Unsigned Byte"; case DevFmtShort: return "Signed Short"; case DevFmtUShort: return "Unsigned Short"; case DevFmtInt: return "Signed Int"; case DevFmtUInt: return "Unsigned Int"; case DevFmtFloat: return "Float"; } return "(unknown type)"; } const ALCchar *DevFmtChannelsString(enum DevFmtChannels chans) { switch(chans) { case DevFmtMono: return "Mono"; case DevFmtStereo: return "Stereo"; case DevFmtQuad: return "Quadraphonic"; case DevFmtX51: return "5.1 Surround"; case DevFmtX51Side: return "5.1 Side"; case DevFmtX61: return "6.1 Surround"; case DevFmtX71: return "7.1 Surround"; } return "(unknown channels)"; } ALuint BytesFromDevFmt(enum DevFmtType type) { switch(type) { case DevFmtByte: return sizeof(ALbyte); case DevFmtUByte: return sizeof(ALubyte); case DevFmtShort: return sizeof(ALshort); case DevFmtUShort: return sizeof(ALushort); case DevFmtInt: return sizeof(ALint); case DevFmtUInt: return sizeof(ALuint); case DevFmtFloat: return sizeof(ALfloat); } return 0; } ALuint ChannelsFromDevFmt(enum DevFmtChannels chans) { switch(chans) { case DevFmtMono: return 1; case DevFmtStereo: return 2; case DevFmtQuad: return 4; case DevFmtX51: return 6; case DevFmtX51Side: return 6; case DevFmtX61: return 7; case DevFmtX71: return 8; } return 0; } static ALboolean DecomposeDevFormat(ALenum format, enum DevFmtChannels *chans, enum DevFmtType *type) { static const struct { ALenum format; enum DevFmtChannels channels; enum DevFmtType type; } list[] = { { AL_FORMAT_MONO8, DevFmtMono, DevFmtUByte }, { AL_FORMAT_MONO16, DevFmtMono, DevFmtShort }, { AL_FORMAT_MONO_FLOAT32, DevFmtMono, DevFmtFloat }, { AL_FORMAT_STEREO8, DevFmtStereo, DevFmtUByte }, { AL_FORMAT_STEREO16, DevFmtStereo, DevFmtShort }, { AL_FORMAT_STEREO_FLOAT32, DevFmtStereo, DevFmtFloat }, { AL_FORMAT_QUAD8, DevFmtQuad, DevFmtUByte }, { AL_FORMAT_QUAD16, DevFmtQuad, DevFmtShort }, { AL_FORMAT_QUAD32, DevFmtQuad, DevFmtFloat }, { AL_FORMAT_51CHN8, DevFmtX51, DevFmtUByte }, { AL_FORMAT_51CHN16, DevFmtX51, DevFmtShort }, { AL_FORMAT_51CHN32, DevFmtX51, DevFmtFloat }, { AL_FORMAT_61CHN8, DevFmtX61, DevFmtUByte }, { AL_FORMAT_61CHN16, DevFmtX61, DevFmtShort }, { AL_FORMAT_61CHN32, DevFmtX61, DevFmtFloat }, { AL_FORMAT_71CHN8, DevFmtX71, DevFmtUByte }, { AL_FORMAT_71CHN16, DevFmtX71, DevFmtShort }, { AL_FORMAT_71CHN32, DevFmtX71, DevFmtFloat }, }; ALuint i; for(i = 0;i < COUNTOF(list);i++) { if(list[i].format == format) { *chans = list[i].channels; *type = list[i].type; return AL_TRUE; } } return AL_FALSE; } static ALCboolean IsValidALCType(ALCenum type) { switch(type) { case ALC_BYTE_SOFT: case ALC_UNSIGNED_BYTE_SOFT: case ALC_SHORT_SOFT: case ALC_UNSIGNED_SHORT_SOFT: case ALC_INT_SOFT: case ALC_UNSIGNED_INT_SOFT: case ALC_FLOAT_SOFT: return ALC_TRUE; } return ALC_FALSE; } static ALCboolean IsValidALCChannels(ALCenum channels) { switch(channels) { case ALC_MONO_SOFT: case ALC_STEREO_SOFT: case ALC_QUAD_SOFT: case ALC_5POINT1_SOFT: case ALC_6POINT1_SOFT: case ALC_7POINT1_SOFT: return ALC_TRUE; } return ALC_FALSE; } /************************************************ * Miscellaneous ALC helpers ************************************************/ void ALCdevice_LockDefault(ALCdevice *device) { EnterCriticalSection(&device->Mutex); } void ALCdevice_UnlockDefault(ALCdevice *device) { LeaveCriticalSection(&device->Mutex); } ALint64 ALCdevice_GetLatencyDefault(ALCdevice *device) { (void)device; return 0; } /* SetDefaultWFXChannelOrder * * Sets the default channel order used by WaveFormatEx. */ void SetDefaultWFXChannelOrder(ALCdevice *device) { switch(device->FmtChans) { case DevFmtMono: device->DevChannels[0] = FrontCenter; break; case DevFmtStereo: device->DevChannels[0] = FrontLeft; device->DevChannels[1] = FrontRight; break; case DevFmtQuad: device->DevChannels[0] = FrontLeft; device->DevChannels[1] = FrontRight; device->DevChannels[2] = BackLeft; device->DevChannels[3] = BackRight; break; case DevFmtX51: device->DevChannels[0] = FrontLeft; device->DevChannels[1] = FrontRight; device->DevChannels[2] = FrontCenter; device->DevChannels[3] = LFE; device->DevChannels[4] = BackLeft; device->DevChannels[5] = BackRight; break; case DevFmtX51Side: device->DevChannels[0] = FrontLeft; device->DevChannels[1] = FrontRight; device->DevChannels[2] = FrontCenter; device->DevChannels[3] = LFE; device->DevChannels[4] = SideLeft; device->DevChannels[5] = SideRight; break; case DevFmtX61: device->DevChannels[0] = FrontLeft; device->DevChannels[1] = FrontRight; device->DevChannels[2] = FrontCenter; device->DevChannels[3] = LFE; device->DevChannels[4] = BackCenter; device->DevChannels[5] = SideLeft; device->DevChannels[6] = SideRight; break; case DevFmtX71: device->DevChannels[0] = FrontLeft; device->DevChannels[1] = FrontRight; device->DevChannels[2] = FrontCenter; device->DevChannels[3] = LFE; device->DevChannels[4] = BackLeft; device->DevChannels[5] = BackRight; device->DevChannels[6] = SideLeft; device->DevChannels[7] = SideRight; break; } } /* SetDefaultChannelOrder * * Sets the default channel order used by most non-WaveFormatEx-based APIs. */ void SetDefaultChannelOrder(ALCdevice *device) { switch(device->FmtChans) { case DevFmtX51: device->DevChannels[0] = FrontLeft; device->DevChannels[1] = FrontRight; device->DevChannels[2] = BackLeft; device->DevChannels[3] = BackRight; device->DevChannels[4] = FrontCenter; device->DevChannels[5] = LFE; return; case DevFmtX71: device->DevChannels[0] = FrontLeft; device->DevChannels[1] = FrontRight; device->DevChannels[2] = BackLeft; device->DevChannels[3] = BackRight; device->DevChannels[4] = FrontCenter; device->DevChannels[5] = LFE; device->DevChannels[6] = SideLeft; device->DevChannels[7] = SideRight; return; /* Same as WFX order */ case DevFmtMono: case DevFmtStereo: case DevFmtQuad: case DevFmtX51Side: case DevFmtX61: break; } SetDefaultWFXChannelOrder(device); } /* alcSetError * * Stores the latest ALC device error */ static void alcSetError(ALCdevice *device, ALCenum errorCode) { if(TrapALCError) { #ifdef _WIN32 /* DebugBreak() will cause an exception if there is no debugger */ if(IsDebuggerPresent()) DebugBreak(); #elif defined(SIGTRAP) raise(SIGTRAP); #endif } if(device) device->LastError = errorCode; else LastNullDeviceError = errorCode; } /* UpdateDeviceParams * * Updates device parameters according to the attribute list (caller is * responsible for holding the list lock). */ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) { ALCcontext *context; enum DevFmtChannels oldChans; enum DevFmtType oldType; ALCuint oldFreq; FPUCtl oldMode; ALuint i; // Check for attributes if(device->Type == Loopback) { enum { GotFreq = 1<<0, GotChans = 1<<1, GotType = 1<<2, GotAll = GotFreq|GotChans|GotType }; ALCuint freq, numMono, numStereo, numSends; enum DevFmtChannels schans; enum DevFmtType stype; ALCuint attrIdx = 0; ALCint gotFmt = 0; if(!attrList) { WARN("Missing attributes for loopback device\n"); return ALC_INVALID_VALUE; } numMono = device->NumMonoSources; numStereo = device->NumStereoSources; numSends = device->NumAuxSends; schans = device->FmtChans; stype = device->FmtType; freq = device->Frequency; while(attrList[attrIdx]) { if(attrList[attrIdx] == ALC_FORMAT_CHANNELS_SOFT) { ALCint val = attrList[attrIdx + 1]; if(!IsValidALCChannels(val) || !ChannelsFromDevFmt(val)) return ALC_INVALID_VALUE; schans = val; gotFmt |= GotChans; } if(attrList[attrIdx] == ALC_FORMAT_TYPE_SOFT) { ALCint val = attrList[attrIdx + 1]; if(!IsValidALCType(val) || !BytesFromDevFmt(val)) return ALC_INVALID_VALUE; stype = val; gotFmt |= GotType; } if(attrList[attrIdx] == ALC_FREQUENCY) { freq = attrList[attrIdx + 1]; if(freq < MIN_OUTPUT_RATE) return ALC_INVALID_VALUE; gotFmt |= GotFreq; } if(attrList[attrIdx] == ALC_STEREO_SOURCES) { numStereo = attrList[attrIdx + 1]; if(numStereo > device->MaxNoOfSources) numStereo = device->MaxNoOfSources; numMono = device->MaxNoOfSources - numStereo; } if(attrList[attrIdx] == ALC_MAX_AUXILIARY_SENDS) numSends = attrList[attrIdx + 1]; attrIdx += 2; } if(gotFmt != GotAll) { WARN("Missing format for loopback device\n"); return ALC_INVALID_VALUE; } ConfigValueUInt(NULL, "sends", &numSends); numSends = minu(MAX_SENDS, numSends); if((device->Flags&DEVICE_RUNNING)) ALCdevice_StopPlayback(device); device->Flags &= ~DEVICE_RUNNING; device->Frequency = freq; device->FmtChans = schans; device->FmtType = stype; device->NumMonoSources = numMono; device->NumStereoSources = numStereo; device->NumAuxSends = numSends; } else if(attrList && attrList[0]) { ALCuint freq, numMono, numStereo, numSends; ALCuint attrIdx = 0; /* If a context is already running on the device, stop playback so the * device attributes can be updated. */ if((device->Flags&DEVICE_RUNNING)) ALCdevice_StopPlayback(device); device->Flags &= ~DEVICE_RUNNING; freq = device->Frequency; numMono = device->NumMonoSources; numStereo = device->NumStereoSources; numSends = device->NumAuxSends; while(attrList[attrIdx]) { if(attrList[attrIdx] == ALC_FREQUENCY) { freq = attrList[attrIdx + 1]; device->Flags |= DEVICE_FREQUENCY_REQUEST; } if(attrList[attrIdx] == ALC_STEREO_SOURCES) { numStereo = attrList[attrIdx + 1]; if(numStereo > device->MaxNoOfSources) numStereo = device->MaxNoOfSources; numMono = device->MaxNoOfSources - numStereo; } if(attrList[attrIdx] == ALC_MAX_AUXILIARY_SENDS) numSends = attrList[attrIdx + 1]; attrIdx += 2; } ConfigValueUInt(NULL, "frequency", &freq); freq = maxu(freq, MIN_OUTPUT_RATE); ConfigValueUInt(NULL, "sends", &numSends); numSends = minu(MAX_SENDS, numSends); device->UpdateSize = (ALuint64)device->UpdateSize * freq / device->Frequency; /* SSE does best with the update size being a multiple of 4 */ if((CPUCapFlags&CPU_CAP_SSE)) device->UpdateSize = (device->UpdateSize+3)&~3; device->Frequency = freq; device->NumMonoSources = numMono; device->NumStereoSources = numStereo; device->NumAuxSends = numSends; } if((device->Flags&DEVICE_RUNNING)) return ALC_NO_ERROR; oldFreq = device->Frequency; oldChans = device->FmtChans; oldType = device->FmtType; TRACE("Format pre-setup: %s%s, %s%s, %uhz%s, %u update size x%d\n", DevFmtChannelsString(device->FmtChans), (device->Flags&DEVICE_CHANNELS_REQUEST)?" (requested)":"", DevFmtTypeString(device->FmtType), (device->Flags&DEVICE_SAMPLE_TYPE_REQUEST)?" (requested)":"", device->Frequency, (device->Flags&DEVICE_FREQUENCY_REQUEST)?" (requested)":"", device->UpdateSize, device->NumUpdates); if(ALCdevice_ResetPlayback(device) == ALC_FALSE) return ALC_INVALID_DEVICE; if(device->FmtChans != oldChans && (device->Flags&DEVICE_CHANNELS_REQUEST)) { ERR("Failed to set %s, got %s instead\n", DevFmtChannelsString(oldChans), DevFmtChannelsString(device->FmtChans)); device->Flags &= ~DEVICE_CHANNELS_REQUEST; } if(device->FmtType != oldType && (device->Flags&DEVICE_SAMPLE_TYPE_REQUEST)) { ERR("Failed to set %s, got %s instead\n", DevFmtTypeString(oldType), DevFmtTypeString(device->FmtType)); device->Flags &= ~DEVICE_SAMPLE_TYPE_REQUEST; } if(device->Frequency != oldFreq && (device->Flags&DEVICE_FREQUENCY_REQUEST)) { ERR("Failed to set %uhz, got %uhz instead\n", oldFreq, device->Frequency); device->Flags &= ~DEVICE_FREQUENCY_REQUEST; } TRACE("Format post-setup: %s, %s, %uhz, %u update size x%d\n", DevFmtChannelsString(device->FmtChans), DevFmtTypeString(device->FmtType), device->Frequency, device->UpdateSize, device->NumUpdates); aluInitPanning(device); for(i = 0;i < MaxChannels;i++) { device->ClickRemoval[i] = 0.0f; device->PendingClicks[i] = 0.0f; } device->Hrtf = NULL; if(device->Type != Loopback && GetConfigValueBool(NULL, "hrtf", AL_FALSE)) device->Hrtf = GetHrtf(device); TRACE("HRTF %s\n", device->Hrtf?"enabled":"disabled"); if(!device->Hrtf && device->Bs2bLevel > 0 && device->Bs2bLevel <= 6) { if(!device->Bs2b) { device->Bs2b = calloc(1, sizeof(*device->Bs2b)); bs2b_clear(device->Bs2b); } bs2b_set_srate(device->Bs2b, device->Frequency); bs2b_set_level(device->Bs2b, device->Bs2bLevel); TRACE("BS2B level %d\n", device->Bs2bLevel); } else { free(device->Bs2b); device->Bs2b = NULL; TRACE("BS2B disabled\n"); } device->Flags &= ~DEVICE_WIDE_STEREO; if(device->Type != Loopback && !device->Hrtf && GetConfigValueBool(NULL, "wide-stereo", AL_FALSE)) device->Flags |= DEVICE_WIDE_STEREO; if(!device->Hrtf && (device->UpdateSize&3)) { if((CPUCapFlags&CPU_CAP_SSE)) WARN("SSE performs best with multiple of 4 update sizes (%u)\n", device->UpdateSize); } SetMixerFPUMode(&oldMode); ALCdevice_Lock(device); context = device->ContextList; while(context) { ALsizei pos; context->UpdateSources = AL_FALSE; LockUIntMapRead(&context->EffectSlotMap); for(pos = 0;pos < context->EffectSlotMap.size;pos++) { ALeffectslot *slot = context->EffectSlotMap.array[pos].value; if(ALeffectState_DeviceUpdate(slot->EffectState, device) == AL_FALSE) { UnlockUIntMapRead(&context->EffectSlotMap); ALCdevice_Unlock(device); RestoreFPUMode(&oldMode); return ALC_INVALID_DEVICE; } slot->NeedsUpdate = AL_FALSE; ALeffectState_Update(slot->EffectState, device, slot); } UnlockUIntMapRead(&context->EffectSlotMap); LockUIntMapRead(&context->SourceMap); for(pos = 0;pos < context->SourceMap.size;pos++) { ALsource *source = context->SourceMap.array[pos].value; ALuint s = device->NumAuxSends; while(s < MAX_SENDS) { if(source->Send[s].Slot) DecrementRef(&source->Send[s].Slot->ref); source->Send[s].Slot = NULL; source->Send[s].Gain = 1.0f; source->Send[s].GainHF = 1.0f; s++; } source->NeedsUpdate = AL_FALSE; ALsource_Update(source, context); } UnlockUIntMapRead(&context->SourceMap); context = context->next; } if(device->DefaultSlot) { ALeffectslot *slot = device->DefaultSlot; if(ALeffectState_DeviceUpdate(slot->EffectState, device) == AL_FALSE) { ALCdevice_Unlock(device); RestoreFPUMode(&oldMode); return ALC_INVALID_DEVICE; } slot->NeedsUpdate = AL_FALSE; ALeffectState_Update(slot->EffectState, device, slot); } ALCdevice_Unlock(device); RestoreFPUMode(&oldMode); if(ALCdevice_StartPlayback(device) == ALC_FALSE) return ALC_INVALID_DEVICE; device->Flags |= DEVICE_RUNNING; return ALC_NO_ERROR; } /* FreeDevice * * Frees the device structure, and destroys any objects the app failed to * delete. Called once there's no more references on the device. */ static ALCvoid FreeDevice(ALCdevice *device) { TRACE("%p\n", device); if(device->Type != Capture) ALCdevice_ClosePlayback(device); else ALCdevice_CloseCapture(device); if(device->DefaultSlot) { ALeffectState_Destroy(device->DefaultSlot->EffectState); device->DefaultSlot->EffectState = NULL; } if(device->BufferMap.size > 0) { WARN("(%p) Deleting %d Buffer(s)\n", device, device->BufferMap.size); ReleaseALBuffers(device); } ResetUIntMap(&device->BufferMap); if(device->EffectMap.size > 0) { WARN("(%p) Deleting %d Effect(s)\n", device, device->EffectMap.size); ReleaseALEffects(device); } ResetUIntMap(&device->EffectMap); if(device->FilterMap.size > 0) { WARN("(%p) Deleting %d Filter(s)\n", device, device->FilterMap.size); ReleaseALFilters(device); } ResetUIntMap(&device->FilterMap); free(device->Bs2b); device->Bs2b = NULL; free(device->DeviceName); device->DeviceName = NULL; DeleteCriticalSection(&device->Mutex); al_free(device); } void ALCdevice_IncRef(ALCdevice *device) { RefCount ref; ref = IncrementRef(&device->ref); TRACEREF("%p increasing refcount to %u\n", device, ref); } void ALCdevice_DecRef(ALCdevice *device) { RefCount ref; ref = DecrementRef(&device->ref); TRACEREF("%p decreasing refcount to %u\n", device, ref); if(ref == 0) FreeDevice(device); } /* VerifyDevice * * Checks if the device handle is valid, and increments its ref count if so. */ static ALCdevice *VerifyDevice(ALCdevice *device) { ALCdevice *tmpDevice; if(!device) return NULL; LockLists(); tmpDevice = DeviceList; while(tmpDevice && tmpDevice != device) tmpDevice = tmpDevice->next; if(tmpDevice) ALCdevice_IncRef(tmpDevice); UnlockLists(); return tmpDevice; } /* InitContext * * Initializes context fields */ static ALvoid InitContext(ALCcontext *Context) { ALint i, j; //Initialise listener Context->Listener.Gain = 1.0f; Context->Listener.MetersPerUnit = 1.0f; Context->Listener.Position[0] = 0.0f; Context->Listener.Position[1] = 0.0f; Context->Listener.Position[2] = 0.0f; Context->Listener.Velocity[0] = 0.0f; Context->Listener.Velocity[1] = 0.0f; Context->Listener.Velocity[2] = 0.0f; Context->Listener.Forward[0] = 0.0f; Context->Listener.Forward[1] = 0.0f; Context->Listener.Forward[2] = -1.0f; Context->Listener.Up[0] = 0.0f; Context->Listener.Up[1] = 1.0f; Context->Listener.Up[2] = 0.0f; for(i = 0;i < 4;i++) { for(j = 0;j < 4;j++) Context->Listener.Matrix[i][j] = ((i==j) ? 1.0f : 0.0f); } //Validate Context Context->LastError = AL_NO_ERROR; Context->UpdateSources = AL_FALSE; Context->ActiveSourceCount = 0; InitUIntMap(&Context->SourceMap, Context->Device->MaxNoOfSources); InitUIntMap(&Context->EffectSlotMap, Context->Device->AuxiliaryEffectSlotMax); //Set globals Context->DistanceModel = AL_INVERSE_DISTANCE_CLAMPED; Context->SourceDistanceModel = AL_FALSE; Context->DopplerFactor = 1.0f; Context->DopplerVelocity = 1.0f; Context->SpeedOfSound = SPEEDOFSOUNDMETRESPERSEC; Context->DeferUpdates = AL_FALSE; Context->ExtensionList = alExtList; } /* FreeContext * * Cleans up the context, and destroys any remaining objects the app failed to * delete. Called once there's no more references on the context. */ static ALCvoid FreeContext(ALCcontext *context) { TRACE("%p\n", context); if(context->SourceMap.size > 0) { ERR("(%p) Deleting %d Source(s)\n", context, context->SourceMap.size); ReleaseALSources(context); } ResetUIntMap(&context->SourceMap); if(context->EffectSlotMap.size > 0) { ERR("(%p) Deleting %d AuxiliaryEffectSlot(s)\n", context, context->EffectSlotMap.size); ReleaseALAuxiliaryEffectSlots(context); } ResetUIntMap(&context->EffectSlotMap); context->ActiveSourceCount = 0; free(context->ActiveSources); context->ActiveSources = NULL; context->MaxActiveSources = 0; context->ActiveEffectSlotCount = 0; free(context->ActiveEffectSlots); context->ActiveEffectSlots = NULL; context->MaxActiveEffectSlots = 0; ALCdevice_DecRef(context->Device); context->Device = NULL; //Invalidate context memset(context, 0, sizeof(ALCcontext)); free(context); } /* ReleaseContext * * Removes the context reference from the given device and removes it from * being current on the running thread or globally. */ static void ReleaseContext(ALCcontext *context, ALCdevice *device) { ALCcontext *volatile*tmp_ctx; if(pthread_getspecific(LocalContext) == context) { WARN("%p released while current on thread\n", context); pthread_setspecific(LocalContext, NULL); ALCcontext_DecRef(context); } if(CompExchangePtr((XchgPtr*)&GlobalContext, context, NULL)) ALCcontext_DecRef(context); ALCdevice_Lock(device); tmp_ctx = &device->ContextList; while(*tmp_ctx) { if(CompExchangePtr((XchgPtr*)tmp_ctx, context, context->next)) break; tmp_ctx = &(*tmp_ctx)->next; } ALCdevice_Unlock(device); ALCcontext_DecRef(context); } void ALCcontext_IncRef(ALCcontext *context) { RefCount ref; ref = IncrementRef(&context->ref); TRACEREF("%p increasing refcount to %u\n", context, ref); } void ALCcontext_DecRef(ALCcontext *context) { RefCount ref; ref = DecrementRef(&context->ref); TRACEREF("%p decreasing refcount to %u\n", context, ref); if(ref == 0) FreeContext(context); } static void ReleaseThreadCtx(void *ptr) { WARN("%p current for thread being destroyed\n", ptr); ALCcontext_DecRef(ptr); } /* VerifyContext * * Checks that the given context is valid, and increments its reference count. */ static ALCcontext *VerifyContext(ALCcontext *context) { ALCdevice *dev; LockLists(); dev = DeviceList; while(dev) { ALCcontext *tmp_ctx = dev->ContextList; while(tmp_ctx) { if(tmp_ctx == context) { ALCcontext_IncRef(tmp_ctx); UnlockLists(); return tmp_ctx; } tmp_ctx = tmp_ctx->next; } dev = dev->next; } UnlockLists(); return NULL; } /* GetContextRef * * Returns the currently active context for this thread, and adds a reference * without locking it. */ ALCcontext *GetContextRef(void) { ALCcontext *context; context = pthread_getspecific(LocalContext); if(context) ALCcontext_IncRef(context); else { LockLists(); context = GlobalContext; if(context) ALCcontext_IncRef(context); UnlockLists(); } return context; } /************************************************ * Standard ALC functions ************************************************/ /* alcGetError * * Return last ALC generated error code for the given device */ ALC_API ALCenum ALC_APIENTRY alcGetError(ALCdevice *device) { ALCenum errorCode; if(VerifyDevice(device)) { errorCode = ExchangeInt(&device->LastError, ALC_NO_ERROR); ALCdevice_DecRef(device); } else errorCode = ExchangeInt(&LastNullDeviceError, ALC_NO_ERROR); return errorCode; } /* alcSuspendContext * * Not functional */ ALC_API ALCvoid ALC_APIENTRY alcSuspendContext(ALCcontext *Context) { (void)Context; } /* alcProcessContext * * Not functional */ ALC_API ALCvoid ALC_APIENTRY alcProcessContext(ALCcontext *Context) { (void)Context; } /* alcGetString * * Returns information about the device, and error strings */ ALC_API const ALCchar* ALC_APIENTRY alcGetString(ALCdevice *Device, ALCenum param) { const ALCchar *value = NULL; switch(param) { case ALC_NO_ERROR: value = alcNoError; break; case ALC_INVALID_ENUM: value = alcErrInvalidEnum; break; case ALC_INVALID_VALUE: value = alcErrInvalidValue; break; case ALC_INVALID_DEVICE: value = alcErrInvalidDevice; break; case ALC_INVALID_CONTEXT: value = alcErrInvalidContext; break; case ALC_OUT_OF_MEMORY: value = alcErrOutOfMemory; break; case ALC_DEVICE_SPECIFIER: value = alcDefaultName; break; case ALC_ALL_DEVICES_SPECIFIER: if(VerifyDevice(Device)) { value = Device->DeviceName; ALCdevice_DecRef(Device); } else { ProbeAllDevicesList(); value = alcAllDevicesList; } break; case ALC_CAPTURE_DEVICE_SPECIFIER: if(VerifyDevice(Device)) { value = Device->DeviceName; ALCdevice_DecRef(Device); } else { ProbeCaptureDeviceList(); value = alcCaptureDeviceList; } break; /* Default devices are always first in the list */ case ALC_DEFAULT_DEVICE_SPECIFIER: value = alcDefaultName; break; case ALC_DEFAULT_ALL_DEVICES_SPECIFIER: if(!alcAllDevicesList) ProbeAllDevicesList(); Device = VerifyDevice(Device); free(alcDefaultAllDevicesSpecifier); alcDefaultAllDevicesSpecifier = strdup(alcAllDevicesList ? alcAllDevicesList : ""); if(!alcDefaultAllDevicesSpecifier) alcSetError(Device, ALC_OUT_OF_MEMORY); value = alcDefaultAllDevicesSpecifier; if(Device) ALCdevice_DecRef(Device); break; case ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER: if(!alcCaptureDeviceList) ProbeCaptureDeviceList(); Device = VerifyDevice(Device); free(alcCaptureDefaultDeviceSpecifier); alcCaptureDefaultDeviceSpecifier = strdup(alcCaptureDeviceList ? alcCaptureDeviceList : ""); if(!alcCaptureDefaultDeviceSpecifier) alcSetError(Device, ALC_OUT_OF_MEMORY); value = alcCaptureDefaultDeviceSpecifier; if(Device) ALCdevice_DecRef(Device); break; case ALC_EXTENSIONS: if(!VerifyDevice(Device)) value = alcNoDeviceExtList; else { value = alcExtensionList; ALCdevice_DecRef(Device); } break; default: Device = VerifyDevice(Device); alcSetError(Device, ALC_INVALID_ENUM); if(Device) ALCdevice_DecRef(Device); break; } return value; } /* alcGetIntegerv * * Returns information about the device and the version of OpenAL */ ALC_API ALCvoid ALC_APIENTRY alcGetIntegerv(ALCdevice *device,ALCenum param,ALsizei size,ALCint *data) { device = VerifyDevice(device); if(size == 0 || data == NULL) { alcSetError(device, ALC_INVALID_VALUE); if(device) ALCdevice_DecRef(device); return; } if(!device) { switch(param) { case ALC_MAJOR_VERSION: *data = alcMajorVersion; break; case ALC_MINOR_VERSION: *data = alcMinorVersion; break; case ALC_ATTRIBUTES_SIZE: case ALC_ALL_ATTRIBUTES: case ALC_FREQUENCY: case ALC_REFRESH: case ALC_SYNC: case ALC_MONO_SOURCES: case ALC_STEREO_SOURCES: case ALC_CAPTURE_SAMPLES: case ALC_FORMAT_CHANNELS_SOFT: case ALC_FORMAT_TYPE_SOFT: alcSetError(NULL, ALC_INVALID_DEVICE); break; default: alcSetError(NULL, ALC_INVALID_ENUM); break; } } else if(device->Type == Capture) { switch(param) { case ALC_CAPTURE_SAMPLES: LockLists(); /* Re-validate the device since it may have been closed */ ALCdevice_DecRef(device); if((device=VerifyDevice(device)) != NULL) *data = ALCdevice_AvailableSamples(device); else alcSetError(NULL, ALC_INVALID_DEVICE); UnlockLists(); break; case ALC_CONNECTED: *data = device->Connected; break; default: alcSetError(device, ALC_INVALID_ENUM); break; } } else /* render device */ { switch(param) { case ALC_MAJOR_VERSION: *data = alcMajorVersion; break; case ALC_MINOR_VERSION: *data = alcMinorVersion; break; case ALC_EFX_MAJOR_VERSION: *data = alcEFXMajorVersion; break; case ALC_EFX_MINOR_VERSION: *data = alcEFXMinorVersion; break; case ALC_ATTRIBUTES_SIZE: *data = 13; break; case ALC_ALL_ATTRIBUTES: if(size < 13) alcSetError(device, ALC_INVALID_VALUE); else { int i = 0; data[i++] = ALC_FREQUENCY; data[i++] = device->Frequency; if(device->Type != Loopback) { data[i++] = ALC_REFRESH; data[i++] = device->Frequency / device->UpdateSize; data[i++] = ALC_SYNC; data[i++] = ALC_FALSE; } else { data[i++] = ALC_FORMAT_CHANNELS_SOFT; data[i++] = device->FmtChans; data[i++] = ALC_FORMAT_TYPE_SOFT; data[i++] = device->FmtType; } data[i++] = ALC_MONO_SOURCES; data[i++] = device->NumMonoSources; data[i++] = ALC_STEREO_SOURCES; data[i++] = device->NumStereoSources; data[i++] = ALC_MAX_AUXILIARY_SENDS; data[i++] = device->NumAuxSends; data[i++] = 0; } break; case ALC_FREQUENCY: *data = device->Frequency; break; case ALC_REFRESH: if(device->Type == Loopback) alcSetError(device, ALC_INVALID_DEVICE); else *data = device->Frequency / device->UpdateSize; break; case ALC_SYNC: if(device->Type == Loopback) alcSetError(device, ALC_INVALID_DEVICE); else *data = ALC_FALSE; break; case ALC_FORMAT_CHANNELS_SOFT: if(device->Type != Loopback) alcSetError(device, ALC_INVALID_DEVICE); else *data = device->FmtChans; break; case ALC_FORMAT_TYPE_SOFT: if(device->Type != Loopback) alcSetError(device, ALC_INVALID_DEVICE); else *data = device->FmtType; break; case ALC_MONO_SOURCES: *data = device->NumMonoSources; break; case ALC_STEREO_SOURCES: *data = device->NumStereoSources; break; case ALC_MAX_AUXILIARY_SENDS: *data = device->NumAuxSends; break; case ALC_CONNECTED: *data = device->Connected; break; default: alcSetError(device, ALC_INVALID_ENUM); break; } } if(device) ALCdevice_DecRef(device); } /* alcIsExtensionPresent * * Determines if there is support for a particular extension */ ALC_API ALCboolean ALC_APIENTRY alcIsExtensionPresent(ALCdevice *device, const ALCchar *extName) { ALCboolean bResult = ALC_FALSE; device = VerifyDevice(device); if(!extName) alcSetError(device, ALC_INVALID_VALUE); else { size_t len = strlen(extName); const char *ptr = (device ? alcExtensionList : alcNoDeviceExtList); while(ptr && *ptr) { if(strncasecmp(ptr, extName, len) == 0 && (ptr[len] == '\0' || isspace(ptr[len]))) { bResult = ALC_TRUE; break; } if((ptr=strchr(ptr, ' ')) != NULL) { do { ++ptr; } while(isspace(*ptr)); } } } if(device) ALCdevice_DecRef(device); return bResult; } /* alcGetProcAddress * * Retrieves the function address for a particular extension function */ ALC_API ALCvoid* ALC_APIENTRY alcGetProcAddress(ALCdevice *device, const ALCchar *funcName) { ALCvoid *ptr = NULL; if(!funcName) { device = VerifyDevice(device); alcSetError(device, ALC_INVALID_VALUE); if(device) ALCdevice_DecRef(device); } else { ALsizei i = 0; while(alcFunctions[i].funcName && strcmp(alcFunctions[i].funcName, funcName) != 0) i++; ptr = alcFunctions[i].address; } return ptr; } /* alcGetEnumValue * * Get the value for a particular ALC enumeration name */ ALC_API ALCenum ALC_APIENTRY alcGetEnumValue(ALCdevice *device, const ALCchar *enumName) { ALCenum val = 0; if(!enumName) { device = VerifyDevice(device); alcSetError(device, ALC_INVALID_VALUE); if(device) ALCdevice_DecRef(device); } else { ALsizei i = 0; while(enumeration[i].enumName && strcmp(enumeration[i].enumName, enumName) != 0) i++; val = enumeration[i].value; } return val; } /* alcCreateContext * * Create and attach a context to the given device. */ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCint *attrList) { ALCcontext *ALContext; ALCenum err; LockLists(); if(!(device=VerifyDevice(device)) || device->Type == Capture || !device->Connected) { UnlockLists(); alcSetError(device, ALC_INVALID_DEVICE); if(device) ALCdevice_DecRef(device); return NULL; } device->LastError = ALC_NO_ERROR; if((err=UpdateDeviceParams(device, attrList)) != ALC_NO_ERROR) { UnlockLists(); alcSetError(device, err); if(err == ALC_INVALID_DEVICE) aluHandleDisconnect(device); ALCdevice_DecRef(device); return NULL; } ALContext = calloc(1, sizeof(ALCcontext)); if(ALContext) { ALContext->ref = 1; ALContext->MaxActiveSources = 256; ALContext->ActiveSources = malloc(sizeof(ALContext->ActiveSources[0]) * ALContext->MaxActiveSources); } if(!ALContext || !ALContext->ActiveSources) { if(!device->ContextList) { ALCdevice_StopPlayback(device); device->Flags &= ~DEVICE_RUNNING; } UnlockLists(); free(ALContext); ALContext = NULL; alcSetError(device, ALC_OUT_OF_MEMORY); ALCdevice_DecRef(device); return NULL; } ALContext->Device = device; ALCdevice_IncRef(device); InitContext(ALContext); do { ALContext->next = device->ContextList; } while(!CompExchangePtr((XchgPtr*)&device->ContextList, ALContext->next, ALContext)); UnlockLists(); ALCdevice_DecRef(device); TRACE("Created context %p\n", ALContext); return ALContext; } /* alcDestroyContext * * Remove a context from its device */ ALC_API ALCvoid ALC_APIENTRY alcDestroyContext(ALCcontext *context) { ALCdevice *Device; LockLists(); /* alcGetContextsDevice sets an error for invalid contexts */ Device = alcGetContextsDevice(context); if(Device) { ReleaseContext(context, Device); if(!Device->ContextList) { ALCdevice_StopPlayback(Device); Device->Flags &= ~DEVICE_RUNNING; } } UnlockLists(); } /* alcGetCurrentContext * * Returns the currently active context on the calling thread */ ALC_API ALCcontext* ALC_APIENTRY alcGetCurrentContext(void) { ALCcontext *Context; Context = pthread_getspecific(LocalContext); if(!Context) Context = GlobalContext; return Context; } /* alcGetThreadContext * * Returns the currently active thread-local context */ ALC_API ALCcontext* ALC_APIENTRY alcGetThreadContext(void) { ALCcontext *Context; Context = pthread_getspecific(LocalContext); return Context; } /* alcMakeContextCurrent * * Makes the given context the active process-wide context, and removes the * thread-local context for the calling thread. */ ALC_API ALCboolean ALC_APIENTRY alcMakeContextCurrent(ALCcontext *context) { /* context must be valid or NULL */ if(context && !(context=VerifyContext(context))) { alcSetError(NULL, ALC_INVALID_CONTEXT); return ALC_FALSE; } /* context's reference count is already incremented */ context = ExchangePtr((XchgPtr*)&GlobalContext, context); if(context) ALCcontext_DecRef(context); if((context=pthread_getspecific(LocalContext)) != NULL) { pthread_setspecific(LocalContext, NULL); ALCcontext_DecRef(context); } return ALC_TRUE; } /* alcSetThreadContext * * Makes the given context the active context for the current thread */ ALC_API ALCboolean ALC_APIENTRY alcSetThreadContext(ALCcontext *context) { ALCcontext *old; /* context must be valid or NULL */ if(context && !(context=VerifyContext(context))) { alcSetError(NULL, ALC_INVALID_CONTEXT); return ALC_FALSE; } /* context's reference count is already incremented */ old = pthread_getspecific(LocalContext); pthread_setspecific(LocalContext, context); if(old) ALCcontext_DecRef(old); return ALC_TRUE; } /* alcGetContextsDevice * * Returns the device that a particular context is attached to */ ALC_API ALCdevice* ALC_APIENTRY alcGetContextsDevice(ALCcontext *Context) { ALCdevice *Device; if(!(Context=VerifyContext(Context))) { alcSetError(NULL, ALC_INVALID_CONTEXT); return NULL; } Device = Context->Device; ALCcontext_DecRef(Context); return Device; } /* alcOpenDevice * * Opens the named device. */ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName) { const ALCchar *fmt; ALCdevice *device; ALCenum err; DO_INITCONFIG(); if(!PlaybackBackend.name) { alcSetError(NULL, ALC_INVALID_VALUE); return NULL; } if(deviceName && (!deviceName[0] || strcasecmp(deviceName, alcDefaultName) == 0 || strcasecmp(deviceName, "openal-soft") == 0)) deviceName = NULL; device = al_calloc(16, sizeof(ALCdevice)+15+sizeof(ALeffectslot)); if(!device) { alcSetError(NULL, ALC_OUT_OF_MEMORY); return NULL; } //Validate device device->Funcs = &PlaybackBackend.Funcs; device->ref = 1; device->Connected = ALC_TRUE; device->Type = Playback; InitializeCriticalSection(&device->Mutex); device->LastError = ALC_NO_ERROR; device->Flags = 0; device->Bs2b = NULL; device->Bs2bLevel = 0; device->DeviceName = NULL; device->ContextList = NULL; device->MaxNoOfSources = 256; device->AuxiliaryEffectSlotMax = 4; device->NumAuxSends = MAX_SENDS; InitUIntMap(&device->BufferMap, ~0); InitUIntMap(&device->EffectMap, ~0); InitUIntMap(&device->FilterMap, ~0); //Set output format device->FmtChans = DevFmtChannelsDefault; device->FmtType = DevFmtTypeDefault; device->Frequency = DEFAULT_OUTPUT_RATE; device->NumUpdates = 4; device->UpdateSize = 1024; if(ConfigValueStr(NULL, "channels", &fmt)) { static const struct { const char name[16]; enum DevFmtChannels chans; } chanlist[] = { { "mono", DevFmtMono }, { "stereo", DevFmtStereo }, { "quad", DevFmtQuad }, { "surround51", DevFmtX51 }, { "surround61", DevFmtX61 }, { "surround71", DevFmtX71 }, }; size_t i; for(i = 0;i < COUNTOF(chanlist);i++) { if(strcasecmp(chanlist[i].name, fmt) == 0) { device->FmtChans = chanlist[i].chans; device->Flags |= DEVICE_CHANNELS_REQUEST; break; } } if(i == COUNTOF(chanlist)) ERR("Unsupported channels: %s\n", fmt); } if(ConfigValueStr(NULL, "sample-type", &fmt)) { static const struct { const char name[16]; enum DevFmtType type; } typelist[] = { { "int8", DevFmtByte }, { "uint8", DevFmtUByte }, { "int16", DevFmtShort }, { "uint16", DevFmtUShort }, { "int32", DevFmtInt }, { "uint32", DevFmtUInt }, { "float32", DevFmtFloat }, }; size_t i; for(i = 0;i < COUNTOF(typelist);i++) { if(strcasecmp(typelist[i].name, fmt) == 0) { device->FmtType = typelist[i].type; device->Flags |= DEVICE_SAMPLE_TYPE_REQUEST; break; } } if(i == COUNTOF(typelist)) ERR("Unsupported sample-type: %s\n", fmt); } #define DEVICE_FORMAT_REQUEST (DEVICE_CHANNELS_REQUEST|DEVICE_SAMPLE_TYPE_REQUEST) if((device->Flags&DEVICE_FORMAT_REQUEST) != DEVICE_FORMAT_REQUEST && ConfigValueStr(NULL, "format", &fmt)) { static const struct { const char name[32]; enum DevFmtChannels channels; enum DevFmtType type; } formats[] = { { "AL_FORMAT_MONO32", DevFmtMono, DevFmtFloat }, { "AL_FORMAT_STEREO32", DevFmtStereo, DevFmtFloat }, { "AL_FORMAT_QUAD32", DevFmtQuad, DevFmtFloat }, { "AL_FORMAT_51CHN32", DevFmtX51, DevFmtFloat }, { "AL_FORMAT_61CHN32", DevFmtX61, DevFmtFloat }, { "AL_FORMAT_71CHN32", DevFmtX71, DevFmtFloat }, { "AL_FORMAT_MONO16", DevFmtMono, DevFmtShort }, { "AL_FORMAT_STEREO16", DevFmtStereo, DevFmtShort }, { "AL_FORMAT_QUAD16", DevFmtQuad, DevFmtShort }, { "AL_FORMAT_51CHN16", DevFmtX51, DevFmtShort }, { "AL_FORMAT_61CHN16", DevFmtX61, DevFmtShort }, { "AL_FORMAT_71CHN16", DevFmtX71, DevFmtShort }, { "AL_FORMAT_MONO8", DevFmtMono, DevFmtByte }, { "AL_FORMAT_STEREO8", DevFmtStereo, DevFmtByte }, { "AL_FORMAT_QUAD8", DevFmtQuad, DevFmtByte }, { "AL_FORMAT_51CHN8", DevFmtX51, DevFmtByte }, { "AL_FORMAT_61CHN8", DevFmtX61, DevFmtByte }, { "AL_FORMAT_71CHN8", DevFmtX71, DevFmtByte } }; size_t i; ERR("Option 'format' is deprecated, please use 'channels' and 'sample-type'\n"); for(i = 0;i < COUNTOF(formats);i++) { if(strcasecmp(fmt, formats[i].name) == 0) { if(!(device->Flags&DEVICE_CHANNELS_REQUEST)) device->FmtChans = formats[i].channels; if(!(device->Flags&DEVICE_SAMPLE_TYPE_REQUEST)) device->FmtType = formats[i].type; device->Flags |= DEVICE_FORMAT_REQUEST; break; } } if(i == COUNTOF(formats)) ERR("Unsupported format: %s\n", fmt); } #undef DEVICE_FORMAT_REQUEST if(ConfigValueUInt(NULL, "frequency", &device->Frequency)) { device->Flags |= DEVICE_FREQUENCY_REQUEST; if(device->Frequency < MIN_OUTPUT_RATE) ERR("%uhz request clamped to %uhz minimum\n", device->Frequency, MIN_OUTPUT_RATE); device->Frequency = maxu(device->Frequency, MIN_OUTPUT_RATE); } ConfigValueUInt(NULL, "periods", &device->NumUpdates); device->NumUpdates = clampu(device->NumUpdates, 2, 16); ConfigValueUInt(NULL, "period_size", &device->UpdateSize); device->UpdateSize = clampu(device->UpdateSize, 64, 8192); if((CPUCapFlags&CPU_CAP_SSE)) device->UpdateSize = (device->UpdateSize+3)&~3; ConfigValueUInt(NULL, "sources", &device->MaxNoOfSources); if(device->MaxNoOfSources == 0) device->MaxNoOfSources = 256; ConfigValueUInt(NULL, "slots", &device->AuxiliaryEffectSlotMax); if(device->AuxiliaryEffectSlotMax == 0) device->AuxiliaryEffectSlotMax = 4; ConfigValueUInt(NULL, "sends", &device->NumAuxSends); if(device->NumAuxSends > MAX_SENDS) device->NumAuxSends = MAX_SENDS; ConfigValueInt(NULL, "cf_level", &device->Bs2bLevel); device->NumStereoSources = 1; device->NumMonoSources = device->MaxNoOfSources - device->NumStereoSources; // Find a playback device to open LockLists(); if((err=ALCdevice_OpenPlayback(device, deviceName)) != ALC_NO_ERROR) { UnlockLists(); DeleteCriticalSection(&device->Mutex); al_free(device); alcSetError(NULL, err); return NULL; } UnlockLists(); if(DefaultEffect.type != AL_EFFECT_NULL) { device->DefaultSlot = (ALeffectslot*)((ALintptrEXT)(device+1)&~15); if(InitEffectSlot(device->DefaultSlot) != AL_NO_ERROR) { device->DefaultSlot = NULL; ERR("Failed to initialize the default effect slot\n"); } else if(InitializeEffect(device, device->DefaultSlot, &DefaultEffect) != AL_NO_ERROR) { ALeffectState_Destroy(device->DefaultSlot->EffectState); device->DefaultSlot = NULL; ERR("Failed to initialize the default effect\n"); } } do { device->next = DeviceList; } while(!CompExchangePtr((XchgPtr*)&DeviceList, device->next, device)); TRACE("Created device %p, \"%s\"\n", device, device->DeviceName); return device; } /* alcCloseDevice * * Closes the given device. */ ALC_API ALCboolean ALC_APIENTRY alcCloseDevice(ALCdevice *Device) { ALCdevice *volatile*list; ALCcontext *ctx; LockLists(); list = &DeviceList; while(*list && *list != Device) list = &(*list)->next; if(!*list || (*list)->Type == Capture) { alcSetError(*list, ALC_INVALID_DEVICE); UnlockLists(); return ALC_FALSE; } *list = (*list)->next; UnlockLists(); while((ctx=Device->ContextList) != NULL) { WARN("Releasing context %p\n", ctx); ReleaseContext(ctx, Device); } if((Device->Flags&DEVICE_RUNNING)) ALCdevice_StopPlayback(Device); Device->Flags &= ~DEVICE_RUNNING; ALCdevice_DecRef(Device); return ALC_TRUE; } /************************************************ * ALC capture functions ************************************************/ ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice(const ALCchar *deviceName, ALCuint frequency, ALCenum format, ALCsizei samples) { ALCdevice *device = NULL; ALCenum err; DO_INITCONFIG(); if(!CaptureBackend.name) { alcSetError(NULL, ALC_INVALID_VALUE); return NULL; } if(samples <= 0) { alcSetError(NULL, ALC_INVALID_VALUE); return NULL; } if(deviceName && (!deviceName[0] || strcasecmp(deviceName, alcDefaultName) == 0 || strcasecmp(deviceName, "openal-soft") == 0)) deviceName = NULL; device = al_calloc(16, sizeof(ALCdevice)); if(!device) { alcSetError(NULL, ALC_OUT_OF_MEMORY); return NULL; } //Validate device device->Funcs = &CaptureBackend.Funcs; device->ref = 1; device->Connected = ALC_TRUE; device->Type = Capture; InitializeCriticalSection(&device->Mutex); InitUIntMap(&device->BufferMap, ~0); InitUIntMap(&device->EffectMap, ~0); InitUIntMap(&device->FilterMap, ~0); device->DeviceName = NULL; device->Flags |= DEVICE_FREQUENCY_REQUEST; device->Frequency = frequency; device->Flags |= DEVICE_CHANNELS_REQUEST | DEVICE_SAMPLE_TYPE_REQUEST; if(DecomposeDevFormat(format, &device->FmtChans, &device->FmtType) == AL_FALSE) { DeleteCriticalSection(&device->Mutex); al_free(device); alcSetError(NULL, ALC_INVALID_ENUM); return NULL; } device->UpdateSize = samples; device->NumUpdates = 1; LockLists(); if((err=ALCdevice_OpenCapture(device, deviceName)) != ALC_NO_ERROR) { UnlockLists(); DeleteCriticalSection(&device->Mutex); al_free(device); alcSetError(NULL, err); return NULL; } UnlockLists(); do { device->next = DeviceList; } while(!CompExchangePtr((XchgPtr*)&DeviceList, device->next, device)); TRACE("Created device %p\n", device); return device; } ALC_API ALCboolean ALC_APIENTRY alcCaptureCloseDevice(ALCdevice *Device) { ALCdevice *volatile*list; LockLists(); list = &DeviceList; while(*list && *list != Device) list = &(*list)->next; if(!*list || (*list)->Type != Capture) { alcSetError(*list, ALC_INVALID_DEVICE); UnlockLists(); return ALC_FALSE; } *list = (*list)->next; UnlockLists(); ALCdevice_DecRef(Device); return ALC_TRUE; } ALC_API void ALC_APIENTRY alcCaptureStart(ALCdevice *device) { LockLists(); if(!(device=VerifyDevice(device)) || device->Type != Capture) { UnlockLists(); alcSetError(device, ALC_INVALID_DEVICE); if(device) ALCdevice_DecRef(device); return; } if(device->Connected) { if(!(device->Flags&DEVICE_RUNNING)) ALCdevice_StartCapture(device); device->Flags |= DEVICE_RUNNING; } UnlockLists(); ALCdevice_DecRef(device); } ALC_API void ALC_APIENTRY alcCaptureStop(ALCdevice *device) { LockLists(); if(!(device=VerifyDevice(device)) || device->Type != Capture) { UnlockLists(); alcSetError(device, ALC_INVALID_DEVICE); if(device) ALCdevice_DecRef(device); return; } if((device->Flags&DEVICE_RUNNING)) ALCdevice_StopCapture(device); device->Flags &= ~DEVICE_RUNNING; UnlockLists(); ALCdevice_DecRef(device); } ALC_API void ALC_APIENTRY alcCaptureSamples(ALCdevice *device, ALCvoid *buffer, ALCsizei samples) { ALCenum err = ALC_INVALID_DEVICE; LockLists(); if((device=VerifyDevice(device)) != NULL && device->Type == Capture) { err = ALC_INVALID_VALUE; if(samples >= 0 && ALCdevice_AvailableSamples(device) >= (ALCuint)samples) err = ALCdevice_CaptureSamples(device, buffer, samples); } UnlockLists(); if(err != ALC_NO_ERROR) alcSetError(device, err); if(device) ALCdevice_DecRef(device); } /************************************************ * ALC loopback functions ************************************************/ /* alcLoopbackOpenDeviceSOFT * * Open a loopback device, for manual rendering. */ ALC_API ALCdevice* ALC_APIENTRY alcLoopbackOpenDeviceSOFT(const ALCchar *deviceName) { ALCdevice *device; DO_INITCONFIG(); /* Make sure the device name, if specified, is us. */ if(deviceName && strcmp(deviceName, alcDefaultName) != 0) { alcSetError(NULL, ALC_INVALID_VALUE); return NULL; } device = al_calloc(16, sizeof(ALCdevice)); if(!device) { alcSetError(NULL, ALC_OUT_OF_MEMORY); return NULL; } //Validate device device->Funcs = &BackendLoopback.Funcs; device->ref = 1; device->Connected = ALC_TRUE; device->Type = Loopback; InitializeCriticalSection(&device->Mutex); device->LastError = ALC_NO_ERROR; device->Flags = 0; device->Bs2b = NULL; device->Bs2bLevel = 0; device->DeviceName = NULL; device->ContextList = NULL; device->MaxNoOfSources = 256; device->AuxiliaryEffectSlotMax = 4; device->NumAuxSends = MAX_SENDS; InitUIntMap(&device->BufferMap, ~0); InitUIntMap(&device->EffectMap, ~0); InitUIntMap(&device->FilterMap, ~0); //Set output format device->NumUpdates = 0; device->UpdateSize = 0; device->Frequency = DEFAULT_OUTPUT_RATE; device->FmtChans = DevFmtChannelsDefault; device->FmtType = DevFmtTypeDefault; ConfigValueUInt(NULL, "sources", &device->MaxNoOfSources); if(device->MaxNoOfSources == 0) device->MaxNoOfSources = 256; ConfigValueUInt(NULL, "slots", &device->AuxiliaryEffectSlotMax); if(device->AuxiliaryEffectSlotMax == 0) device->AuxiliaryEffectSlotMax = 4; ConfigValueUInt(NULL, "sends", &device->NumAuxSends); if(device->NumAuxSends > MAX_SENDS) device->NumAuxSends = MAX_SENDS; device->NumStereoSources = 1; device->NumMonoSources = device->MaxNoOfSources - device->NumStereoSources; // Open the "backend" ALCdevice_OpenPlayback(device, "Loopback"); do { device->next = DeviceList; } while(!CompExchangePtr((XchgPtr*)&DeviceList, device->next, device)); TRACE("Created device %p\n", device); return device; } /* alcIsRenderFormatSupportedSOFT * * Determines if the loopback device supports the given format for rendering. */ ALC_API ALCboolean ALC_APIENTRY alcIsRenderFormatSupportedSOFT(ALCdevice *device, ALCsizei freq, ALCenum channels, ALCenum type) { ALCboolean ret = ALC_FALSE; if(!(device=VerifyDevice(device)) || device->Type != Loopback) alcSetError(device, ALC_INVALID_DEVICE); else if(freq <= 0) alcSetError(device, ALC_INVALID_VALUE); else { if(IsValidALCType(type) && BytesFromDevFmt(type) > 0 && IsValidALCChannels(channels) && ChannelsFromDevFmt(channels) > 0 && freq >= MIN_OUTPUT_RATE) ret = ALC_TRUE; } if(device) ALCdevice_DecRef(device); return ret; } /* alcRenderSamplesSOFT * * Renders some samples into a buffer, using the format last set by the * attributes given to alcCreateContext. */ ALC_API void ALC_APIENTRY alcRenderSamplesSOFT(ALCdevice *device, ALCvoid *buffer, ALCsizei samples) { if(!(device=VerifyDevice(device)) || device->Type != Loopback) alcSetError(device, ALC_INVALID_DEVICE); else if(samples < 0 || (samples > 0 && buffer == NULL)) alcSetError(device, ALC_INVALID_VALUE); else aluMixData(device, buffer, samples); if(device) ALCdevice_DecRef(device); }
lgpl-2.1
BCI-AR/NeuroServer
src/neuro/neuro.h
266
#ifndef __NEURO_H #define __NEURO_H #define OK 0 #define rassert(x) if (!(x)) { void exit(int); fprintf(stderr, "FAIL: %s:%d:%s\n", __FILE__, __LINE__, #x); exit(1); } #include <neuro/stringtable.h> #include <neuro/cmdhandler.h> #include <neuro/ns2net.h> #endif
lgpl-2.1
tebben/Mapsui
Tests/Mapsui.Tests/Layers/RasterizingLayerTests.cs
1856
using System; using System.Linq; using System.Threading; using BruTile; using Mapsui.Layers; using Mapsui.Providers; using NUnit.Framework; using BruTile.Predefined; using Mapsui.Rendering; using Mapsui.Rendering.Xaml; namespace Mapsui.Tests.Layers { [TestFixture] public class RasterizingLayerTests { [Test] public void TestTimer() { // arrange var layer = new RasterizingLayer(CreatePointLayer()); var schema = new GlobalSphericalMercator(); var box = schema.Extent.ToBoundingBox(); var resolution = schema.Resolutions.First().Value.UnitsPerPixel; var waitHandle = new AutoResetEvent(false); DefaultRendererFactory.Create = () => new MapRenderer(); // Using xaml renderer here to test rasterizer. Suboptimal. Assert.AreEqual(0, layer.GetFeaturesInView(box, resolution).Count()); layer.DataChanged += (sender, args) => { // assert waitHandle.Set(); }; // act layer.RefreshData(box, resolution, true); waitHandle.WaitOne(); Assert.AreEqual(layer.GetFeaturesInView(box, resolution).Count(), 1); } private static MemoryLayer CreatePointLayer() { var random = new Random(); var features = new Features(); for (var i = 0; i < 100; i++) { var feature = new Feature { Geometry = new Geometries.Point(random.Next(100000, 5000000), random.Next(100000, 5000000)) }; features.Add(feature); } var provider = new MemoryProvider(features); return new MemoryLayer { DataSource = provider }; } } }
lgpl-2.1
QuickServerLab/QuickServer-Main
src/main/org/quickserver/security/SecureStoreManager.java
10503
/* * This file is part of the QuickServer library * Copyright (C) QuickServer.org * * Use, modification, copying and distribution of this software is subject to * the terms and conditions of the GNU Lesser General Public License. * You should have received a copy of the GNU LGP License along with this * library; if not, you can download a copy from <http://www.quickserver.org/>. * * For questions, suggestions, bug-reports, enhancement-requests etc. * visit http://www.quickserver.org * */ package org.quickserver.security; import java.io.*; import java.util.logging.*; import org.quickserver.util.xmlreader.*; import org.quickserver.util.io.*; import javax.net.ssl.*; import java.security.*; import org.quickserver.swing.*; /** * Class that loads Key Managers, Trust Managers, SSLContext and other secure * objects from QuickServer configuration passed. See &lt;secure-store-manager&gt; * in &lt;secure-store&gt; to set new manger to load your SecureStore. This * class can be overridden to change the way QuickServer configures the * secure mode. * @see org.quickserver.util.xmlreader.SecureStore * @author Akshathkumar Shetty * @since 1.4 */ public class SecureStoreManager { private static Logger logger = Logger.getLogger( SecureStoreManager.class.getName()); private SensitiveInput sensitiveInput = null; /** * Loads KeyManagers. KeyManagers are responsible for managing * the key material which is used to authenticate the local * SSLSocket to its peer. Can return null. */ public KeyManager[] loadKeyManagers(QuickServerConfig config) throws GeneralSecurityException, IOException { Secure secure = config.getSecure(); SecureStore secureStore = secure.getSecureStore(); if(secureStore==null) { logger.fine("SecureStore configuration not set! "+ "So returning null for KeyManager"); return null; } KeyStoreInfo keyStoreInfo = secureStore.getKeyStoreInfo(); if(keyStoreInfo==null) { logger.fine("KeyStoreInfo configuration not set! "+ "So returning null for KeyManager"); return null; } logger.finest("Loading KeyManagers"); KeyStore ks = getKeyStoreForKey(secureStore.getType(), secureStore.getProvider()); logger.info("KeyManager Provider: "+ks.getProvider()); char storepass[] = null; if(keyStoreInfo.getStorePassword()!=null) { logger.finest("KeyStore: Store password was present!"); storepass = keyStoreInfo.getStorePassword().toCharArray(); } else { logger.finest("KeyStore: Store password was not set.. so asking!"); if(sensitiveInput==null) { sensitiveInput = new SensitiveInput(config.getName()+" - Input Prompt"); } storepass = sensitiveInput.getInput("Store password for KeyStore"); if(storepass==null) { logger.finest("No password entered.. will pass null"); } } InputStream keyStoreStream = null; try { if(keyStoreInfo.getStoreFile().equalsIgnoreCase("none")==false) { logger.finest("KeyStore location: "+ ConfigReader.makeAbsoluteToConfig(keyStoreInfo.getStoreFile(), config)); keyStoreStream = new FileInputStream( ConfigReader.makeAbsoluteToConfig(keyStoreInfo.getStoreFile(), config)); } ks.load(keyStoreStream, storepass); logger.finest("KeyStore loaded"); } finally { if(keyStoreStream != null) { keyStoreStream.close(); keyStoreStream = null; } } char keypass[] = null; if(keyStoreInfo.getKeyPassword()!=null) { logger.finest("KeyStore: key password was present!"); keypass = keyStoreInfo.getKeyPassword().toCharArray(); } else { logger.finest("KeyStore: Key password was not set.. so asking!"); if(sensitiveInput==null) { sensitiveInput = new SensitiveInput(config.getName()+" - Input Prompt"); } keypass = sensitiveInput.getInput("Key password for KeyStore"); if(keypass==null) { logger.finest("No password entered.. will pass blank"); keypass = "".toCharArray(); } } KeyManagerFactory kmf = KeyManagerFactory.getInstance( secureStore.getAlgorithm()); kmf.init(ks, keypass); storepass = " ".toCharArray(); storepass = null; keypass = " ".toCharArray(); keypass = null; return kmf.getKeyManagers(); } /** * Loads TrustManagers. TrustManagers are responsible for managing the * trust material that is used when making trust decisions, and for * deciding whether credentials presented by a peer should be accepted. * Can return null. */ public TrustManager[] loadTrustManagers(QuickServerConfig config) throws GeneralSecurityException, IOException { Secure secure = config.getSecure(); SecureStore secureStore = secure.getSecureStore(); TrustStoreInfo trustStoreInfo = secureStore.getTrustStoreInfo(); if(trustStoreInfo==null) { return null; } logger.finest("Loading TrustManagers"); String type = null; if(trustStoreInfo.getType()!=null && trustStoreInfo.getType().trim().length()!=0) type = trustStoreInfo.getType(); else type = secureStore.getType(); String provider = null; if(trustStoreInfo.getProvider()!=null && trustStoreInfo.getProvider().trim().length()!=0) provider = trustStoreInfo.getProvider(); else provider = secureStore.getProvider(); KeyStore ts = getKeyStoreForTrust(type, provider); char trustpass[] = null; if(trustStoreInfo.getStorePassword()!=null) { logger.finest("TrustStore: Store password was present!"); trustpass = trustStoreInfo.getStorePassword().toCharArray(); } else { logger.finest("TrustStore: Store password was not set.. so asking!"); if(sensitiveInput==null) { sensitiveInput = new SensitiveInput(config.getName()+" - Input Prompt"); } trustpass = sensitiveInput.getInput("Store password for TrustStore"); if(trustpass==null) { logger.finest("No password entered.. will pass null"); } } InputStream trustStoreStream = null; try { if(trustStoreInfo.getStoreFile().equalsIgnoreCase("none")==false) { logger.finest("TrustStore location: "+ ConfigReader.makeAbsoluteToConfig( trustStoreInfo.getStoreFile(), config)); trustStoreStream = new FileInputStream( ConfigReader.makeAbsoluteToConfig( trustStoreInfo.getStoreFile(), config)); } ts.load(trustStoreStream, trustpass); logger.finest("TrustStore loaded"); } finally { if(trustStoreStream!=null) { trustStoreStream.close(); trustStoreStream = null; } } TrustManagerFactory tmf = TrustManagerFactory.getInstance( secureStore.getAlgorithm()); tmf.init(ts); return tmf.getTrustManagers(); } /** * Generates a SSLContext object that implements the specified secure * socket protocol. */ public SSLContext getSSLContext(String protocol) throws NoSuchAlgorithmException { return SSLContext.getInstance(protocol); } public SSLContext getSSLContext(QuickServerConfig config) throws NoSuchAlgorithmException, NoSuchProviderException { if(config.getSecure().getSecureStore().getProvider()!=null) { return SSLContext.getInstance( config.getSecure().getProtocol(), config.getSecure().getSecureStore().getProvider()); } else { return SSLContext.getInstance(config.getSecure().getProtocol()); } } /** * Generates a keystore object for the specified keystore type from * the specified provider to be used for loading/storeing keys. * @param type the type of keystore * @param provider the name of the provider if <code>null</code> any * provider package that implements this type of key may be given based * on the priority. */ protected KeyStore getKeyStoreForKey(String type, String provider) throws KeyStoreException, NoSuchProviderException { if(provider==null) return KeyStore.getInstance(type); return KeyStore.getInstance(type, provider); } /** * Generates a keystore object for the specified keystore type from * the specified provider to be used for loading/storing trusted * keys/certificates. * @param type the type of keystore * @param provider the name of the provider if <code>null</code> any * provider package that implements this type of key may be given based * on the priority. */ protected KeyStore getKeyStoreForTrust(String type, String provider) throws KeyStoreException, NoSuchProviderException { if(provider==null) return KeyStore.getInstance(type); return KeyStore.getInstance(type, provider); } /** * Returns a SSLSocketFactory object to be used for creating SSLSockets. */ public SSLSocketFactory getSocketFactory(SSLContext context) { return context.getSocketFactory(); } /** * Can be used to log details about the SSLServerSocket used to * create a secure server [SSL/TLS]. This method can also be * overridden to change the enabled cipher suites and/or enabled protocols. */ public void logSSLServerSocketInfo(SSLServerSocket sslServerSocket) { if(logger.isLoggable(Level.FINEST)==false) { return; } logger.finest("SecureServer Info: ClientAuth: "+ sslServerSocket.getNeedClientAuth()); logger.finest("SecureServer Info: ClientMode: "+ sslServerSocket.getUseClientMode()); String supportedSuites[] = sslServerSocket.getSupportedCipherSuites(); logger.finest("SecureServer Info: Supported Cipher Suites --------"); for(int i=0;i<supportedSuites.length;i++) logger.finest(supportedSuites[i]); logger.finest("---------------------------------------------------"); String enabledSuites[] = sslServerSocket.getEnabledCipherSuites(); logger.finest("SecureServer Info: Enabled Cipher Suites ----------"); for(int i=0;i<enabledSuites.length;i++) logger.finest(enabledSuites[i]); logger.finest("---------------------------------------------------"); String supportedProtocols[] = sslServerSocket.getSupportedProtocols(); logger.finest("SecureServer Info: Supported Protocols ------------"); for(int i=0;i<supportedProtocols.length;i++) logger.finest(supportedProtocols[i]); logger.finest("---------------------------------------------------"); String enabledProtocols[] = sslServerSocket.getEnabledProtocols(); logger.finest("SecureServer Info: Enabled Protocols --------------"); for(int i=0;i<enabledProtocols.length;i++) logger.finest(enabledProtocols[i]); logger.finest("---------------------------------------------------"); } }
lgpl-2.1
looooo/netgen
libsrc/meshing/ruler3.cpp
28420
#include <mystdlib.h> #include "meshing.hpp" namespace netgen { extern double minother; extern double minwithoutother; static double CalcElementBadness (const Array<Point3d, PointIndex::BASE> & points, const Element & elem) { double vol, l, l4, l5, l6; if (elem.GetNP() != 4) { if (elem.GetNP() == 5) { double z = points[elem.PNum(5)].Z(); if (z > -1e-8) return 1e8; return (-1 / z) - z; // - 2; } return 0; } Vec3d v1 = points[elem.PNum(2)] - points[elem.PNum(1)]; Vec3d v2 = points[elem.PNum(3)] - points[elem.PNum(1)]; Vec3d v3 = points[elem.PNum(4)] - points[elem.PNum(1)]; vol = - (Cross (v1, v2) * v3); l4 = Dist (points[elem.PNum(2)], points[elem.PNum(3)]); l5 = Dist (points[elem.PNum(2)], points[elem.PNum(4)]); l6 = Dist (points[elem.PNum(3)], points[elem.PNum(4)]); l = v1.Length() + v2.Length() + v3.Length() + l4 + l5 + l6; // testout << "vol = " << vol << " l = " << l << endl; if (vol < 1e-8) return 1e10; // (*testout) << "l^3/vol = " << (l*l*l / vol) << endl; double err = pow (l*l*l/vol, 1.0/3.0) / 12; return err; } int Meshing3 :: ApplyRules ( Array<Point3d, PointIndex::BASE> & lpoints, // in: local points, out: old+new local points Array<int, PointIndex::BASE> & allowpoint, // in: 2 .. it is allowed to use pointi, 1..will be allowed later, 0..no means Array<MiniElement2d> & lfaces, // in: local faces, out: old+new local faces INDEX lfacesplit, // for local faces in outer radius INDEX_2_HASHTABLE<int> & connectedpairs, // connected pairs for prism-meshing Array<Element> & elements, // out: new elements Array<INDEX> & delfaces, // out: face indices of faces to delete int tolerance, // quality class: 1 best double sloppy, // quality strength int rotind1, // how to rotate base element float & retminerr // element error ) { NgProfiler::RegionTimer regtot(97); float err, minerr, teterr, minteterr; char ok, found, hc; // vnetrule * rule; Vector oldu, newu, newu1, newu2, allp; Vec3d ui; Point3d np; const MiniElement2d * locface = NULL; int loktestmode; Array<int, PointIndex::BASE> pused; // point is already mapped, number of uses Array<char> fused; // face is already mapped Array<PointIndex> pmap; // map of reference point to local point Array<bool> pfixed; // point mapped by face-map Array<int> fmapi; // face in reference is mapped to face nr ... Array<int> fmapr; // face in reference is rotated to map Array<Point3d> transfreezone; // transformed free-zone INDEX_2_CLOSED_HASHTABLE<int> ledges(100); // edges in local environment Array<Point3d> tempnewpoints; Array<MiniElement2d> tempnewfaces; Array<int> tempdelfaces; Array<Element> tempelements; Array<Box3d> triboxes; // bounding boxes of local faces Array<int, PointIndex::BASE> pnearness; Array<int> fnearness; static int cnt = 0; cnt++; delfaces.SetSize (0); elements.SetSize (0); // determine topological distance of faces and points to // base element pnearness.SetSize (lpoints.Size()); fnearness.SetSize (lfacesplit); pnearness = INT_MAX/10; for (PointIndex pi : lfaces[0].PNums()) pnearness[pi] = 0; NgProfiler::RegionTimer reg2(98); NgProfiler::StartTimer (90); for (int loop = 0; loop < 2; loop++) { for (int i = 0; i < lfacesplit; i++) { const MiniElement2d & hface = lfaces[i]; int minn = INT_MAX-1; for (PointIndex pi : hface.PNums()) { int hi = pnearness[pi]; if (hi < minn) minn = hi; } if (minn < INT_MAX/10) for (PointIndex pi : hface.PNums()) if (pnearness[pi] > minn+1) pnearness[pi] = minn+1; } for (int i = 1; i <= connectedpairs.GetNBags(); i++) for (int j = 1; j <= connectedpairs.GetBagSize(i); j++) { INDEX_2 edge; int val; connectedpairs.GetData (i, j, edge, val); if (pnearness[edge.I1()] > pnearness[edge.I2()] + 1) pnearness[edge.I1()] = pnearness[edge.I2()] + 1; if (pnearness[edge.I2()] > pnearness[edge.I1()] + 1) pnearness[edge.I2()] = pnearness[edge.I1()] + 1; } } for (int i : fnearness.Range()) { int sum = 0; for (PointIndex pi : lfaces[i].PNums()) sum += pnearness[pi]; fnearness[i] = sum; } NgProfiler::StopTimer (90); NgProfiler::StartTimer (91); // find bounding boxes of faces triboxes.SetSize (lfaces.Size()); // for (int i = 0; i < lfaces.Size(); i++) for (auto i : lfaces.Range()) { const MiniElement2d & face = lfaces[i]; triboxes[i].SetPoint (lpoints[face[0]]); for (int j = 1; j < face.GetNP(); j++) triboxes[i].AddPoint (lpoints[face[j]]); } NgProfiler::StopTimer (91); NgProfiler::StartTimer (92); bool useedges = false; for (int ri = 0; ri < rules.Size(); ri++) if (rules[ri]->GetNEd()) useedges = true; if (useedges) { ledges.SetSize (5 * lfacesplit); for (int j = 0; j < lfacesplit; j++) // if (fnearness[j] <= 5) { const MiniElement2d & face = lfaces[j]; int newp, oldp; newp = face[face.GetNP()-1]; for (int k = 0; k < face.GetNP(); k++) { oldp = newp; newp = face[k]; ledges.Set (INDEX_2::Sort(oldp, newp), 1); } } } NgProfiler::StopTimer (92); NgProfiler::RegionTimer reg3(99); pused.SetSize (lpoints.Size()); fused.SetSize (lfaces.Size()); found = 0; minerr = tolfak * tolerance * tolerance; minteterr = sloppy * tolerance; if (testmode) (*testout) << "cnt = " << cnt << " class = " << tolerance << endl; // impossible, if no rule can be applied at any tolerance class bool impossible = 1; // check each rule: for (int ri = 1; ri <= rules.Size(); ri++) { int base = (lfaces[0].GetNP() == 3) ? 100 : 200; NgProfiler::RegionTimer regx1(base); NgProfiler::RegionTimer regx(base+ri); // sprintf (problems.Elem(ri), ""); *problems.Elem(ri) = '\0'; vnetrule * rule = rules.Get(ri); if (rule->GetNP(1) != lfaces[0].GetNP()) continue; if (rule->GetQuality() > tolerance) { if (rule->GetQuality() < 100) impossible = 0; if (testmode) sprintf (problems.Elem(ri), "Quality not ok"); continue; } if (testmode) sprintf (problems.Elem(ri), "no mapping found"); loktestmode = testmode || rule->TestFlag ('t') || tolerance > 5; if (loktestmode) (*testout) << "Rule " << ri << " = " << rule->Name() << endl; pmap.SetSize (rule->GetNP()); fmapi.SetSize (rule->GetNF()); fmapr.SetSize (rule->GetNF()); fused = 0; pused = 0; for (auto & p : pmap) p.Invalidate(); fmapi = 0; for (int i : fmapr.Range()) fmapr[i] = rule->GetNP(i+1); fused[0] = 1; fmapi[0] = 1; fmapr[0] = rotind1; for (int j = 1; j <= lfaces[0].GetNP(); j++) { PointIndex locpi = lfaces[0].PNumMod (j+rotind1); pmap.Set (rule->GetPointNr (1, j), locpi); pused[locpi]++; } /* map all faces nfok .. first nfok-1 faces are mapped properly */ int nfok = 2; NgProfiler::RegionTimer regfa(300); NgProfiler::RegionTimer regx2(base+50+ri); while (nfok >= 2) { if (nfok <= rule->GetNOldF()) { // not all faces mapped ok = 0; int locfi = fmapi.Get(nfok); int locfr = fmapr.Get(nfok); int actfnp = rule->GetNP(nfok); while (!ok) { locfr++; if (locfr == actfnp + 1) { locfr = 1; locfi++; if (locfi > lfacesplit) break; } if (fnearness.Get(locfi) > rule->GetFNearness (nfok) || fused.Get(locfi) || actfnp != lfaces.Get(locfi).GetNP() ) { // face not feasible in any rotation locfr = actfnp; } else { ok = 1; locface = &lfaces.Get(locfi); // reference point already mapped differently ? for (int j = 1; j <= actfnp && ok; j++) { PointIndex locpi = pmap.Get(rule->GetPointNr (nfok, j)); if (locpi.IsValid() && locpi != locface->PNumMod(j+locfr)) ok = 0; } // local point already used or point outside tolerance ? for (int j = 1; j <= actfnp && ok; j++) { int refpi = rule->GetPointNr (nfok, j); if (!pmap.Get(refpi).IsValid()) { PointIndex locpi = locface->PNumMod (j + locfr); if (pused[locpi]) ok = 0; else { const Point3d & lp = lpoints[locpi]; const Point3d & rp = rule->GetPoint(refpi); if ( Dist2 (lp, rp) * rule->PointDistFactor(refpi) > minerr) { impossible = 0; ok = 0; } } } } } } if (ok) { // map face nfok fmapi.Set (nfok, locfi); fmapr.Set (nfok, locfr); fused.Set (locfi, 1); for (int j = 1; j <= rule->GetNP (nfok); j++) { PointIndex locpi = locface->PNumMod(j+locfr); if (rule->GetPointNr (nfok, j) <= 3 && pmap.Get(rule->GetPointNr(nfok, j)) != locpi) (*testout) << "change face1 point, mark1" << endl; pmap.Set(rule->GetPointNr (nfok, j), locpi); pused[locpi]++; } nfok++; } else { // backtrack one face fmapi.Set (nfok, 0); fmapr.Set (nfok, rule->GetNP(nfok)); nfok--; fused.Set (fmapi.Get(nfok), 0); for (int j = 1; j <= rule->GetNP (nfok); j++) { int refpi = rule->GetPointNr (nfok, j); pused[pmap.Get(refpi)]--; if (pused[pmap.Get(refpi)] == 0) { // pmap.Set(refpi, 0); pmap.Elem(refpi).Invalidate(); } } } } else { NgProfiler::RegionTimer regfb(301); // all faces are mapped // now map all isolated points: if (loktestmode) { (*testout) << "Faces Ok" << endl; sprintf (problems.Elem(ri), "Faces Ok"); } int npok = 1; int incnpok = 1; pfixed.SetSize (pmap.Size()); /* for (int i = 1; i <= pmap.Size(); i++) pfixed.Set(i, (pmap.Get(i) != 0) ); */ for (int i : pmap.Range()) pfixed[i] = pmap[i].IsValid(); while (npok >= 1) { if (npok <= rule->GetNOldP()) { if (pfixed.Get(npok)) { if (incnpok) npok++; else npok--; } else { PointIndex locpi = pmap.Elem(npok); ok = 0; if (locpi.IsValid()) pused[locpi]--; while (!ok && locpi < lpoints.Size()-1+PointIndex::BASE) { ok = 1; locpi++; if (pused[locpi] || pnearness[locpi] > rule->GetPNearness(npok)) { ok = 0; } else if (allowpoint[locpi] != 2) { ok = 0; if (allowpoint[locpi] == 1) impossible = 0; } else { const Point3d & lp = lpoints[locpi]; const Point3d & rp = rule->GetPoint(npok); if ( Dist2 (lp, rp) * rule->PointDistFactor(npok) > minerr) { ok = 0; impossible = 0; } } } if (ok) { pmap.Set (npok, locpi); if (npok <= 3) (*testout) << "set face1 point, mark3" << endl; pused[locpi]++; npok++; incnpok = 1; } else { // pmap.Set (npok, 0); pmap.Elem(npok).Invalidate(); if (npok <= 3) (*testout) << "set face1 point, mark4" << endl; npok--; incnpok = 0; } } } else { NgProfiler::RegionTimer regfa2(302); // all points are mapped if (loktestmode) { (*testout) << "Mapping found!!: Rule " << rule->Name() << endl; for (auto pi : pmap) (*testout) << pi << " "; (*testout) << endl; sprintf (problems.Elem(ri), "mapping found"); (*testout) << rule->GetNP(1) << " = " << lfaces.Get(1).GetNP() << endl; } ok = 1; // check mapedges: for (int i = 1; i <= rule->GetNEd(); i++) { INDEX_2 in2(pmap.Get(rule->GetEdge(i).i1), pmap.Get(rule->GetEdge(i).i2)); in2.Sort(); if (!ledges.Used (in2)) ok = 0; } // check prism edges: for (int i = 1; i <= rule->GetNE(); i++) { const Element & el = rule->GetElement (i); if (el.GetType() == PRISM) { for (int j = 1; j <= 3; j++) { INDEX_2 in2(pmap.Get(el.PNum(j)), pmap.Get(el.PNum(j+3))); in2.Sort(); if (!connectedpairs.Used (in2)) ok = 0; } } if (el.GetType() == PYRAMID) { if (loktestmode) (*testout) << "map pyramid, rule = " << rule->Name() << endl; for (int j = 1; j <= 2; j++) { INDEX_2 in2; if (j == 1) { in2.I1() = pmap.Get(el.PNum(2)); in2.I2() = pmap.Get(el.PNum(3)); } else { in2.I1() = pmap.Get(el.PNum(1)); in2.I2() = pmap.Get(el.PNum(4)); } in2.Sort(); if (!connectedpairs.Used (in2)) { ok = 0; if (loktestmode) (*testout) << "no pair" << endl; } } } } for (int i = rule->GetNOldF() + 1; i <= rule->GetNF(); i++) fmapi.Set(i, 0); if (ok) { foundmap.Elem(ri)++; } // deviation of existing points oldu.SetSize (3 * rule->GetNOldP()); newu.SetSize (3 * (rule->GetNP() - rule->GetNOldP())); allp.SetSize (3 * rule->GetNP()); for (int i = 1; i <= rule->GetNOldP(); i++) { const Point3d & lp = lpoints[pmap.Get(i)]; const Point3d & rp = rule->GetPoint(i); oldu (3*i-3) = lp.X()-rp.X(); oldu (3*i-2) = lp.Y()-rp.Y(); oldu (3*i-1) = lp.Z()-rp.Z(); allp (3*i-3) = lp.X(); allp (3*i-2) = lp.Y(); allp (3*i-1) = lp.Z(); } if (rule->GetNP() > rule->GetNOldP()) { newu.SetSize (rule->GetOldUToNewU().Height()); rule->GetOldUToNewU().Mult (oldu, newu); } // int idiff = 3 * (rule->GetNP()-rule->GetNOldP()); int idiff = 3 * rule->GetNOldP(); for (int i = rule->GetNOldP()+1; i <= rule->GetNP(); i++) { const Point3d & rp = rule->GetPoint(i); allp (3*i-3) = rp.X() + newu(3*i-3 - idiff); allp (3*i-2) = rp.Y() + newu(3*i-2 - idiff); allp (3*i-1) = rp.Z() + newu(3*i-1 - idiff); } rule->SetFreeZoneTransformation (allp, tolerance + int(sloppy)); if (!rule->ConvexFreeZone()) { ok = 0; sprintf (problems.Elem(ri), "Freezone not convex"); if (loktestmode) (*testout) << "Freezone not convex" << endl; } if (loktestmode) { const Array<Point3d> & fz = rule->GetTransFreeZone(); (*testout) << "Freezone: " << endl; for (int i = 1; i <= fz.Size(); i++) (*testout) << fz.Get(i) << endl; } // check freezone: for (int i = 1; i <= lpoints.Size(); i++) { if ( !pused.Get(i) ) { const Point3d & lp = lpoints.Get(i); if (rule->fzbox.IsIn (lp)) { if (rule->IsInFreeZone(lp)) { if (loktestmode) { (*testout) << "Point " << i << " in Freezone" << endl; sprintf (problems.Elem(ri), "locpoint %d in Freezone", i); } ok = 0; break; } } } } for (int i = 1; i <= lfaces.Size() && ok; i++) { static Array<int> lpi(4); if (!fused.Get(i)) { int triin; const MiniElement2d & lfacei = lfaces.Get(i); if (!triboxes.Elem(i).Intersect (rule->fzbox)) triin = 0; else { int li, lj; for (li = 1; li <= lfacei.GetNP(); li++) { int lpii = 0; PointIndex pi = lfacei.PNum(li); for (lj = 1; lj <= rule->GetNOldP(); lj++) if (pmap.Get(lj) == pi) lpii = lj; lpi.Elem(li) = lpii; } if (lfacei.GetNP() == 3) { triin = rule->IsTriangleInFreeZone ( lpoints[lfacei.PNum(1)], lpoints[lfacei.PNum(2)], lpoints[lfacei.PNum(3)], lpi, 1 ); } else { triin = rule->IsQuadInFreeZone ( lpoints[lfacei.PNum(1)], lpoints[lfacei.PNum(2)], lpoints[lfacei.PNum(3)], lpoints[lfacei.PNum(4)], lpi, 1 ); } } if (triin == -1) { ok = 0; } if (triin == 1) { #ifdef TEST_JS ok = 0; if (loktestmode) { (*testout) << "El with " << lfaces.Get(i).GetNP() << " points in freezone: " << lfaces.Get(i).PNum(1) << " - " << lfaces.Get(i).PNum(2) << " - " << lfaces.Get(i).PNum(3) << " - " << lfaces.Get(i).PNum(4) << endl; for (int lj = 1; lj <= lfaces.Get(i).GetNP(); lj++) (*testout) << lpoints[lfaces.Get(i).PNum(lj)] << " "; (*testout) << endl; sprintf (problems.Elem(ri), "triangle (%d, %d, %d) in Freezone", lfaces.Get(i).PNum(1), lfaces.Get(i).PNum(2), lfaces.Get(i).PNum(3)); } #else if (loktestmode) { if (lfacei.GetNP() == 3) { (*testout) << "Triangle in freezone: " << lfacei.PNum(1) << " - " << lfacei.PNum(2) << " - " << lfacei.PNum(3) << ", or " << lpoints[lfacei.PNum(1)] << " - " << lpoints[lfacei.PNum(2)] << " - " << lpoints[lfacei.PNum(3)] << endl; (*testout) << "lpi = " << lpi.Get(1) << ", " << lpi.Get(2) << ", " << lpi.Get(3) << endl; } else (*testout) << "Quad in freezone: " << lfacei.PNum(1) << " - " << lfacei.PNum(2) << " - " << lfacei.PNum(3) << " - " << lfacei.PNum(4) << ", or " << lpoints[lfacei.PNum(1)] << " - " << lpoints[lfacei.PNum(2)] << " - " << lpoints[lfacei.PNum(3)] << " - " << lpoints[lfacei.PNum(4)] << endl; sprintf (problems.Elem(ri), "triangle (%d, %d, %d) in Freezone", int(lfaces.Get(i).PNum(1)), int(lfaces.Get(i).PNum(2)), int(lfaces.Get(i).PNum(3))); } hc = 0; for (int k = rule->GetNOldF() + 1; k <= rule->GetNF(); k++) { if (rule->GetPointNr(k, 1) <= rule->GetNOldP() && rule->GetPointNr(k, 2) <= rule->GetNOldP() && rule->GetPointNr(k, 3) <= rule->GetNOldP()) { for (int j = 1; j <= 3; j++) if (lfaces.Get(i).PNumMod(j ) == pmap.Get(rule->GetPointNr(k, 1)) && lfaces.Get(i).PNumMod(j+1) == pmap.Get(rule->GetPointNr(k, 3)) && lfaces.Get(i).PNumMod(j+2) == pmap.Get(rule->GetPointNr(k, 2))) { fmapi.Elem(k) = i; hc = 1; // (*testout) << "found from other side: " // << rule->Name() // << " ( " << pmap.Get (rule->GetPointNr(k, 1)) // << " - " << pmap.Get (rule->GetPointNr(k, 2)) // << " - " << pmap.Get (rule->GetPointNr(k, 3)) << " ) " // << endl; strcpy (problems.Elem(ri), "other"); } } } if (!hc) { if (loktestmode) { (*testout) << "Triangle in freezone: " << lfaces.Get(i).PNum(1) << " - " << lfaces.Get(i).PNum(2) << " - " << lfaces.Get(i).PNum(3) << endl; sprintf (problems.Elem(ri), "triangle (%d, %d, %d) in Freezone", int (lfaces.Get(i).PNum(1)), int (lfaces.Get(i).PNum(2)), int (lfaces.Get(i).PNum(3))); } ok = 0; } #endif } } } if (ok) { err = 0; for (int i = 1; i <= rule->GetNOldP(); i++) { double hf = rule->CalcPointDist (i, lpoints[pmap.Get(i)]); if (hf > err) err = hf; } if (loktestmode) { (*testout) << "Rule ok" << endl; sprintf (problems.Elem(ri), "Rule ok, err = %f", err); } // newu = rule->GetOldUToNewU() * oldu; // set new points: int oldnp = rule->GetNOldP(); int noldlp = lpoints.Size(); int noldlf = lfaces.Size(); for (int i = oldnp + 1; i <= rule->GetNP(); i++) { np = rule->GetPoint(i); np.X() += newu (3 * (i-oldnp) - 3); np.Y() += newu (3 * (i-oldnp) - 2); np.Z() += newu (3 * (i-oldnp) - 1); lpoints.Append (np); pmap.Elem(i) = lpoints.Size()-1+PointIndex::BASE; } // Set new Faces: for (int i = rule->GetNOldF() + 1; i <= rule->GetNF(); i++) if (!fmapi.Get(i)) { MiniElement2d nface(rule->GetNP(i)); for (int j = 1; j <= nface.GetNP(); j++) nface.PNum(j) = pmap.Get(rule->GetPointNr (i, j)); lfaces.Append (nface); } // Delete old Faces: for (int i = 1; i <= rule->GetNDelF(); i++) delfaces.Append (fmapi.Get(rule->GetDelFace(i))); for (int i = rule->GetNOldF()+1; i <= rule->GetNF(); i++) if (fmapi.Get(i)) { delfaces.Append (fmapi.Get(i)); fmapi.Elem(i) = 0; } // check orientation for (int i = 1; i <= rule->GetNO() && ok; i++) { const fourint * fouri; fouri = &rule->GetOrientation(i); Vec3d v1 (lpoints[pmap.Get(fouri->i1)], lpoints[pmap.Get(fouri->i2)]); Vec3d v2 (lpoints[pmap.Get(fouri->i1)], lpoints[pmap.Get(fouri->i3)]); Vec3d v3 (lpoints[pmap.Get(fouri->i1)], lpoints[pmap.Get(fouri->i4)]); Vec3d n; Cross (v1, v2, n); //if (n * v3 >= -1e-7*n.Length()*v3.Length()) // OR -1e-7??? if (n * v3 >= -1e-9) { if (loktestmode) { sprintf (problems.Elem(ri), "Orientation wrong"); (*testout) << "Orientation wrong ("<< n*v3 << ")" << endl; } ok = 0; } } // new points in free-zone ? for (int i = rule->GetNOldP() + 1; i <= rule->GetNP() && ok; i++) if (!rule->IsInFreeZone (lpoints.Get(pmap.Get(i)))) { if (loktestmode) { (*testout) << "Newpoint " << lpoints.Get(pmap.Get(i)) << " outside convex hull" << endl; sprintf (problems.Elem(ri), "newpoint outside convex hull"); } ok = 0; } // insert new elements for (int i = 1; i <= rule->GetNE(); i++) { elements.Append (rule->GetElement(i)); for (int j = 1; j <= elements.Get(i).NP(); j++) elements.Elem(i).PNum(j) = pmap.Get(elements.Get(i).PNum(j)); } // Calculate Element badness teterr = 0; for (int i = 1; i <= elements.Size(); i++) { double hf = CalcElementBadness (lpoints, elements.Get(i)); if (hf > teterr) teterr = hf; } /* // keine gute Erfahrung am 25.1.2000, js if (ok && teterr < 100 && (rule->TestFlag('b') || tolerance > 10) ) { (*mycout) << "Reset teterr " << rule->Name() << " err = " << teterr << endl; teterr = 1; } */ // compare edgelength if (rule->TestFlag('l')) { double oldlen = 0; double newlen = 0; for (int i = 1; i <= rule->GetNDelF(); i++) { const Element2d & face = rule->GetFace (rule->GetDelFace(i)); for (int j = 1; j <= 3; j++) { const Point3d & p1 = lpoints[pmap.Get(face.PNumMod(j))]; const Point3d & p2 = lpoints[pmap.Get(face.PNumMod(j+1))]; oldlen += Dist(p1, p2); } } for (int i = rule->GetNOldF()+1; i <= rule->GetNF(); i++) { const Element2d & face = rule->GetFace (i); for (int j = 1; j <= 3; j++) { const Point3d & p1 = lpoints[pmap.Get(face.PNumMod(j))]; const Point3d & p2 = lpoints[pmap.Get(face.PNumMod(j+1))]; newlen += Dist(p1, p2); } } if (oldlen < newlen) { ok = 0; if (loktestmode) sprintf (problems.Elem(ri), "oldlen < newlen"); } } if (loktestmode) (*testout) << "ok = " << int(ok) << "teterr = " << teterr << "minteterr = " << minteterr << endl; if (ok && teterr < tolerance) { canuse.Elem(ri) ++; /* (*testout) << "can use rule " << rule->Name() << ", err = " << teterr << endl; for (i = 1; i <= pmap.Size(); i++) (*testout) << pmap.Get(i) << " "; (*testout) << endl; */ if (strcmp (problems.Elem(ri), "other") == 0) { if (teterr < minother) minother = teterr; } else { if (teterr < minwithoutother) minwithoutother = teterr; } } if (teterr > minteterr) impossible = 0; if (ok && teterr < minteterr) { if (loktestmode) (*testout) << "use rule" << endl; found = ri; minteterr = teterr; if (testmode) { for (int i = 1; i <= rule->GetNOldP(); i++) { (*testout) << "P" << i << ": Ref: " << rule->GetPoint (i) << " is: " << lpoints.Get(pmap.Get(i)) << endl; } } tempnewpoints.SetSize (0); for (int i = noldlp+1; i <= lpoints.Size(); i++) tempnewpoints.Append (lpoints.Get(i)); tempnewfaces.SetSize (0); for (int i = noldlf+1; i <= lfaces.Size(); i++) tempnewfaces.Append (lfaces.Get(i)); tempdelfaces.SetSize (0); for (int i = 1; i <= delfaces.Size(); i++) tempdelfaces.Append (delfaces.Get(i)); tempelements.SetSize (0); for (int i = 1; i <= elements.Size(); i++) tempelements.Append (elements.Get(i)); } lpoints.SetSize (noldlp); lfaces.SetSize (noldlf); delfaces.SetSize (0); elements.SetSize (0); } npok = rule->GetNOldP(); incnpok = 0; } } nfok = rule->GetNOldF(); for (int j = 1; j <= rule->GetNP (nfok); j++) { int refpi = rule->GetPointNr (nfok, j); pused[pmap.Get(refpi)]--; if (pused[pmap.Get(refpi)] == 0) pmap.Elem(refpi).Invalidate(); } } } if (loktestmode) (*testout) << "end rule" << endl; } if (found) { /* for (i = 1; i <= tempnewpoints.Size(); i++) lpoints.Append (tempnewpoints.Get(i)); */ for (Point3d p : tempnewpoints) lpoints.Append(p); /* for (i = 1; i <= tempnewfaces.Size(); i++) if (tempnewfaces.Get(i).PNum(1)) lfaces.Append (tempnewfaces.Get(i)); */ for (int i : tempnewfaces.Range()) if (tempnewfaces[i].PNum(1).IsValid()) lfaces.Append (tempnewfaces[i]); /* for (i = 1; i <= tempdelfaces.Size(); i++) delfaces.Append (tempdelfaces.Get(i)); */ for (int i : tempdelfaces.Range()) delfaces.Append (tempdelfaces[i]); /* for (i = 1; i <= tempelements.Size(); i++) elements.Append (tempelements.Get(i)); */ for (int i : tempelements.Range()) elements.Append (tempelements[i]); } retminerr = minerr; if (impossible && found == 0) return -1; return found; } }
lgpl-2.1
stefanseefeld/fresco
Berlin/include/Berlin/Console/GGIDrawableFactory.hh
1841
/*$Id$ * * This source file is a part of the Fresco Project. * Copyright (C) 2000 Stefan Seefeld <stefan@fresco.org> * http://www.fresco.org * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, * MA 02139, USA. */ #ifndef _Berlin_Console_GGIDrawableFactory_hh #define _Berlin_Console_GGIDrawableFactory_hh #include <Berlin/config.hh> #include <Berlin/Console.hh> #include <string> extern "C" { #include <ggi/ggi-unix.h> } namespace Berlin { namespace Console_Extension { class GGIDrawable : public virtual Berlin::Console::Drawable { public: virtual const std::string &name() const = 0; virtual ggi_mode mode() const = 0; virtual ggi_visual_t visual() const = 0; }; class GGIDrawableFactory : virtual public Berlin::Console::Extension { public: //. Creates a new Drawable of the given size (x, y) and depth. //. It is accessable under the given shm-id. virtual GGIDrawable *create_drawable(int shmid, Fresco::PixelCoord, Fresco::PixelCoord, Fresco::PixelCoord) = 0; }; } // namespace } // namespace #endif
lgpl-2.1
radekp/qt
src/gui/painting/qrgb.h
2914
/**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtGui module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage ** This file contains pre-release code and may not be distributed. ** You may use this file in accordance with the terms and conditions ** contained in the Technology Preview License Agreement accompanying ** this package. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. ** ** ** ** ** ** ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QRGB_H #define QRGB_H #include <QtCore/qglobal.h> QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Gui) typedef unsigned int QRgb; // RGB triplet const QRgb RGB_MASK = 0x00ffffff; // masks RGB values Q_GUI_EXPORT_INLINE int qRed(QRgb rgb) // get red part of RGB { return ((rgb >> 16) & 0xff); } Q_GUI_EXPORT_INLINE int qGreen(QRgb rgb) // get green part of RGB { return ((rgb >> 8) & 0xff); } Q_GUI_EXPORT_INLINE int qBlue(QRgb rgb) // get blue part of RGB { return (rgb & 0xff); } Q_GUI_EXPORT_INLINE int qAlpha(QRgb rgb) // get alpha part of RGBA { return ((rgb >> 24) & 0xff); } Q_GUI_EXPORT_INLINE QRgb qRgb(int r, int g, int b)// set RGB value { return (0xffu << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff); } Q_GUI_EXPORT_INLINE QRgb qRgba(int r, int g, int b, int a)// set RGBA value { return ((a & 0xff) << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff); } Q_GUI_EXPORT_INLINE int qGray(int r, int g, int b)// convert R,G,B to gray 0..255 { return (r*11+g*16+b*5)/32; } Q_GUI_EXPORT_INLINE int qGray(QRgb rgb) // convert RGB to gray 0..255 { return qGray(qRed(rgb), qGreen(rgb), qBlue(rgb)); } Q_GUI_EXPORT_INLINE bool qIsGray(QRgb rgb) { return qRed(rgb) == qGreen(rgb) && qRed(rgb) == qBlue(rgb); } QT_END_NAMESPACE QT_END_HEADER #endif // QRGB_H
lgpl-2.1
Mikeware/minueto
api/org/minueto/class-use/MinuetoInvalidColorValueException.html
4178
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (version 1.7.0_25) on Mon Sep 29 10:45:19 PDT 2014 --> <title>Uses of Class org.minueto.MinuetoInvalidColorValueException (MinuetoAPI API)</title> <meta name="date" content="2014-09-29"> <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.minueto.MinuetoInvalidColorValueException (MinuetoAPI API)"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar_top"> <!-- --> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../org/minueto/MinuetoInvalidColorValueException.html" title="class in org.minueto">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../../../overview-tree.html">Tree</a></li> <li><a href="../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../index-all.html">Index</a></li> <li><a href="../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../index.html?org/minueto/class-use/MinuetoInvalidColorValueException.html" target="_top">Frames</a></li> <li><a href="MinuetoInvalidColorValueException.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Class org.minueto.MinuetoInvalidColorValueException" class="title">Uses of Class<br>org.minueto.MinuetoInvalidColorValueException</h2> </div> <div class="classUseContainer">No usage of org.minueto.MinuetoInvalidColorValueException</div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../org/minueto/MinuetoInvalidColorValueException.html" title="class in org.minueto">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../../../overview-tree.html">Tree</a></li> <li><a href="../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../index-all.html">Index</a></li> <li><a href="../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../index.html?org/minueto/class-use/MinuetoInvalidColorValueException.html" target="_top">Frames</a></li> <li><a href="MinuetoInvalidColorValueException.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </body> </html>
lgpl-2.1
FlorentRevest/Elementary
src/lib/elm_win.h
5518
/** * @defgroup Win Win * @ingroup Elementary * * @image html win_inheritance_tree.png * @image latex win_inheritance_tree.eps * * @image html img/widget/win/preview-00.png * @image latex img/widget/win/preview-00.eps * * The window class of Elementary. Contains functions to manipulate * windows. The Evas engine used to render the window contents is specified * in the system or user elementary config files (whichever is found last), * and can be overridden with the ELM_ENGINE environment variable for * testing. Engines that may be supported (depending on Evas and Ecore-Evas * compilation setup and modules actually installed at runtime) are (listed * in order of best supported and most likely to be complete and work to * lowest quality). Note that ELM_ENGINE is really only needed for special * cases and debugging. you should normally use ELM_DISPLAY and ELM_ACCEL * environment variables, or core elementary config. ELM_DISPLAY can be set to * "x11" or "wl" to indicate the target display system (as on Linux systems * you may have both display systems available, so this selects which to use). * ELM_ACCEL may also be set to indicate if you want accelerations and which * kind to use. see elm_config_accel_preference_set(0 for details on this * environment variable values. * * @li "x11", "x", "software-x11", "software_x11" (Software rendering in X11) * @li "gl", "opengl", "opengl-x11", "opengl_x11" (OpenGL or OpenGL-ES2 * rendering in X11) * @li "shot:..." (Virtual screenshot renderer - renders to output file and * exits) * @li "fb", "software-fb", "software_fb" (Linux framebuffer direct software * rendering) * @li "fb", "software-fb", "software_fb" (Linux framebuffer accelerated * rendering) * @li "sdl", "software-sdl", "software_sdl" (SDL software rendering to SDL * buffer) * @li "gl-sdl", "gl_sdl", "opengl-sdl", "opengl_sdl" (OpenGL or OpenGL-ES2 * rendering using SDL as the buffer) * @li "gdi", "software-gdi", "software_gdi" (Windows WIN32 rendering via * GDI with software) * @li "ews" (rendering to EWS - Ecore + Evas Single Process Windowing System) * @li "gl-cocoa", "gl_cocoa", "opengl-cocoa", "opengl_cocoa" (OpenGL rendering in Cocoa) * @li "wayland_shm" (Wayland client SHM rendering) * @li "wayland_egl" (Wayland client OpenGL/EGL rendering) * @li "drm" (Linux drm/kms etc. direct display) * * All engines use a simple string to select the engine to render, EXCEPT * the "shot" engine. This actually encodes the output of the virtual * screenshot and how long to delay in the engine string. The engine string * is encoded in the following way: * * "shot:[delay=XX][:][repeat=DDD][:][file=XX]" * * Where options are separated by a ":" char if more than one option is * given, with delay, if provided being the first option and file the last * (order is important). The delay specifies how long to wait after the * window is shown before doing the virtual "in memory" rendering and then * save the output to the file specified by the file option (and then exit). * If no delay is given, the default is 0.5 seconds. If no file is given the * default output file is "out.png". Repeat option is for continuous * capturing screenshots. Repeat range is from 1 to 999 and filename is * fixed to "out001.png" Some examples of using the shot engine: * * ELM_ENGINE="shot:delay=1.0:repeat=5:file=elm_test.png" elementary_test * ELM_ENGINE="shot:delay=1.0:file=elm_test.png" elementary_test * ELM_ENGINE="shot:file=elm_test2.png" elementary_test * ELM_ENGINE="shot:delay=2.0" elementary_test * ELM_ENGINE="shot:" elementary_test * * Signals that you can add callbacks for are: * * @li "delete,request": the user requested to close the window. See * elm_win_autodel_set() and elm_win_autohide_set(). * @li "focus,in": window got focus (deprecated. use "focused" instead.) * @li "focus,out": window lost focus (deprecated. use "unfocused" instead.) * @li "moved": window that holds the canvas was moved * @li "withdrawn": window is still managed normally but removed from view * @li "iconified": window is minimized (perhaps into an icon or taskbar) * @li "normal": window is in a normal state (not withdrawn or iconified) * @li "stick": window has become sticky (shows on all desktops) * @li "unstick": window has stopped being sticky * @li "fullscreen": window has become fullscreen * @li "unfullscreen": window has stopped being fullscreen * @li "maximized": window has been maximized * @li "unmaximized": window has stopped being maximized * @li "ioerr": there has been a low-level I/O error with the display system * @li "indicator,prop,changed": an indicator's property has been changed * @li "rotation,changed": window rotation has been changed * @li "profile,changed": profile of the window has been changed * @li "focused" : When the win has received focus. (since 1.8) * @li "unfocused" : When the win has lost focus. (since 1.8) * @li "theme,changed" - The theme was changed. (since 1.13) * * Note that calling evas_object_show() after window contents creation is * recommended. It will trigger evas_smart_objects_calculate() and some backend * calls directly. For example, XMapWindow is called directly during * evas_object_show() in X11 engine. * * Examples: * @li @ref win_example_01 * * @{ */ #include <elm_win_common.h> #ifdef EFL_EO_API_SUPPORT #include <elm_win_eo.h> #endif #ifndef EFL_NOLEGACY_API_SUPPORT #include <elm_win_legacy.h> #endif /** * @} */
lgpl-2.1
tikiorg/tiki
tiki-survey_stats.php
2518
<?php /** * @package tikiwiki */ // (c) Copyright 2002-2016 by authors of the Tiki Wiki CMS Groupware Project // // All Rights Reserved. See copyright.txt for details and a complete list of authors. // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. // $Id$ $section = 'surveys'; require_once('tiki-setup.php'); include_once('lib/surveys/surveylib.php'); $auto_query_args = ['sort_mode', 'offset', 'find']; $access->check_feature('feature_surveys'); $access->check_permission('tiki_p_view_survey_stats'); if (! isset($_REQUEST["sort_mode"])) { $sort_mode = 'created_desc'; } else { $sort_mode = $_REQUEST["sort_mode"]; } if (! isset($_REQUEST["offset"])) { $offset = 0; } else { $offset = $_REQUEST["offset"]; } $smarty->assign_by_ref('offset', $offset); if (isset($_REQUEST["find"])) { $find = $_REQUEST["find"]; } else { $find = ''; } $smarty->assign('find', $find); $smarty->assign_by_ref('sort_mode', $sort_mode); $channels = $srvlib->list_surveys($offset, $maxRecords, $sort_mode, $find); $temp_max = count($channels["data"]); for ($i = 0; $i < $temp_max; $i++) { if ($userlib->object_has_one_permission($channels["data"][$i]["surveyId"], 'survey')) { $channels["data"][$i]["individual"] = 'y'; if ($userlib->object_has_permission($user, $channels["data"][$i]["surveyId"], 'survey', 'tiki_p_take_survey')) { $channels["data"][$i]["individual_tiki_p_take_survey"] = 'y'; } else { $channels["data"][$i]["individual_tiki_p_take_survey"] = 'n'; } if ($userlib->object_has_permission($user, $channels["data"][$i]["surveyId"], 'survey', 'tiki_p_view_survey_stats')) { $channels["data"][$i]["individual_tiki_p_view_survey_stats"] = 'y'; } else { $channels["data"][$i]["individual_tiki_p_view_survey_stats"] = 'n'; } if ($tiki_p_admin == 'y' || $userlib->object_has_permission($user, $channels["data"][$i]["surveyId"], 'survey', 'tiki_p_admin_surveys')) { $channels["data"][$i]["individual_tiki_p_take_survey"] = 'y'; $channels["data"][$i]["individual_tiki_p_view_survey_stats"] = 'y'; $channels["data"][$i]["individual_tiki_p_admin_surveys"] = 'y'; } } else { $channels["data"][$i]["individual"] = 'n'; } } $smarty->assign_by_ref('cant_pages', $channels["cant"]); $smarty->assign_by_ref('channels', $channels["data"]); $smarty->assign('section', $section); include_once('tiki-section_options.php'); ask_ticket('survey-stats'); // Display the template $smarty->assign('mid', 'tiki-survey_stats.tpl'); $smarty->display("tiki.tpl");
lgpl-2.1
stanxii/wr1004sjl
apps/snmp/net-snmp-5.4.4/agent/mibgroup/mibII/interfaces.h
4114
/* * Interfaces MIB group interface - interfaces.h * */ #ifndef _MIBGROUP_INTERFACES_H #define _MIBGROUP_INTERFACES_H /*********************************************************************** * configure macros */ config_require(util_funcs) /* * conflicts with the new MFD rewrite */ config_exclude(if-mib/ifTable/ifTable) #if !defined(WIN32) && !defined(cygwin) config_require(if-mib/data_access/interface) #endif config_arch_require(solaris2, kernel_sunos5) /* * need get_address in var_route for some platforms (USE_SYSCTL_IFLIST). * Not sure if that can be translated into a config_arch_require, so be * indiscriminate for now. */ config_require(mibII/var_route) /*********************************************************************** */ #ifndef USING_IF_MIB_IFTABLE_MODULE #ifdef hpux11 #include <sys/mib.h> #else struct in_ifaddr; struct ifnet; #endif int Interface_Scan_Get_Count(void); int Interface_Index_By_Name(char *, int); void Interface_Scan_Init(void); #if defined(linux) || defined(sunV3) struct in_ifaddr { int dummy; }; #endif #if defined(hpux11) int Interface_Scan_Next(short *, char *, nmapi_phystat *); #else int Interface_Scan_Next(short *, char *, struct ifnet *, struct in_ifaddr *); #endif void init_interfaces(void); extern FindVarMethod var_interfaces; extern FindVarMethod var_ifEntry; #endif /* USING_IF_MIB_IFTABLE_MODULE */ #define IFNUMBER 0 #define IFINDEX 1 #define IFDESCR 2 #define NETSNMP_IFTYPE 3 #define IFMTU 4 #define IFSPEED 5 #define IFPHYSADDRESS 6 #define IFADMINSTATUS 7 #define IFOPERSTATUS 8 #define IFLASTCHANGE 9 #define IFINOCTETS 10 #define IFINUCASTPKTS 11 #define IFINNUCASTPKTS 12 #define IFINDISCARDS 13 #define IFINERRORS 14 #define IFINUNKNOWNPROTOS 15 #define IFOUTOCTETS 16 #define IFOUTUCASTPKTS 17 #define IFOUTNUCASTPKTS 18 #define IFOUTDISCARDS 19 #define IFOUTERRORS 20 #define IFOUTQLEN 21 #define IFSPECIFIC 22 #ifdef linux /* * this struct ifnet is cloned from the generic type and somewhat modified. * it will not work for other un*x'es... */ struct ifnet { char *if_name; /* name, e.g. ``en'' or ``lo'' */ char *if_unit; /* sub-unit for lower level driver */ short if_mtu; /* maximum transmission unit */ short if_flags; /* up/down, broadcast, etc. */ int if_metric; /* routing metric (external only) */ char if_hwaddr[6]; /* ethernet address */ int if_type; /* interface type: 1=generic, * 28=slip, ether=6, loopback=24 */ u_long if_speed; /* interface speed: in bits/sec */ struct sockaddr if_addr; /* interface's address */ struct sockaddr ifu_broadaddr; /* broadcast address */ struct sockaddr ia_subnetmask; /* interface's mask */ struct ifqueue { int ifq_len; int ifq_drops; } if_snd; /* output queue */ u_long if_ibytes; /* octets received on interface */ u_long if_ipackets; /* packets received on interface */ u_long if_ierrors; /* input errors on interface */ u_long if_iqdrops; /* input queue overruns */ u_long if_obytes; /* octets sent on interface */ u_long if_opackets; /* packets sent on interface */ u_long if_oerrors; /* output errors on interface */ u_long if_collisions; /* collisions on csma interfaces */ /* * end statistics */ struct ifnet *if_next; }; #endif /* linux */ #endif /* _MIBGROUP_INTERFACES_H */
lgpl-2.1
JasonILTG/Minecraft-Modding
javadoc/com/JasonILTG/ScienceMod/item/armor/package-use.html
7656
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_60) on Sun Mar 20 22:06:58 PDT 2016 --> <title>Uses of Package com.JasonILTG.ScienceMod.item.armor</title> <meta name="date" content="2016-03-20"> <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Package com.JasonILTG.ScienceMod.item.armor"; } } catch(err) { } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li>Class</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="../../../../../index-files/index-1.html">Index</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?com/JasonILTG/ScienceMod/item/armor/package-use.html" target="_top">Frames</a></li> <li><a href="package-use.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h1 title="Uses of Package com.JasonILTG.ScienceMod.item.armor" class="title">Uses of Package<br>com.JasonILTG.ScienceMod.item.armor</h1> </div> <div class="contentContainer"> <ul class="blockList"> <li class="blockList"> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation"> <caption><span>Packages that use <a href="../../../../../com/JasonILTG/ScienceMod/item/armor/package-summary.html">com.JasonILTG.ScienceMod.item.armor</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Package</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="#com.JasonILTG.ScienceMod.init">com.JasonILTG.ScienceMod.init</a></td> <td class="colLast">&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="#com.JasonILTG.ScienceMod.item.armor">com.JasonILTG.ScienceMod.item.armor</a></td> <td class="colLast">&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"><a name="com.JasonILTG.ScienceMod.init"> <!-- --> </a> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing classes, and an explanation"> <caption><span>Classes in <a href="../../../../../com/JasonILTG/ScienceMod/item/armor/package-summary.html">com.JasonILTG.ScienceMod.item.armor</a> used by <a href="../../../../../com/JasonILTG/ScienceMod/init/package-summary.html">com.JasonILTG.ScienceMod.init</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colOne" scope="col">Class and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colOne"><a href="../../../../../com/JasonILTG/ScienceMod/item/armor/class-use/ArmorScience.html#com.JasonILTG.ScienceMod.init">ArmorScience</a> <div class="block">Wrapper class for all armor items in the mod.</div> </td> </tr> </tbody> </table> </li> <li class="blockList"><a name="com.JasonILTG.ScienceMod.item.armor"> <!-- --> </a> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing classes, and an explanation"> <caption><span>Classes in <a href="../../../../../com/JasonILTG/ScienceMod/item/armor/package-summary.html">com.JasonILTG.ScienceMod.item.armor</a> used by <a href="../../../../../com/JasonILTG/ScienceMod/item/armor/package-summary.html">com.JasonILTG.ScienceMod.item.armor</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colOne" scope="col">Class and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colOne"><a href="../../../../../com/JasonILTG/ScienceMod/item/armor/class-use/ArmorScience.html#com.JasonILTG.ScienceMod.item.armor">ArmorScience</a> <div class="block">Wrapper class for all armor items in the mod.</div> </td> </tr> <tr class="rowColor"> <td class="colOne"><a href="../../../../../com/JasonILTG/ScienceMod/item/armor/class-use/ArmorScienceSpecial.html#com.JasonILTG.ScienceMod.item.armor">ArmorScienceSpecial</a> <div class="block">Wrapper class for all armor items with special properties in the mod.</div> </td> </tr> <tr class="altColor"> <td class="colOne"><a href="../../../../../com/JasonILTG/ScienceMod/item/armor/class-use/Exoskeleton.html#com.JasonILTG.ScienceMod.item.armor">Exoskeleton</a>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colOne"><a href="../../../../../com/JasonILTG/ScienceMod/item/armor/class-use/IShieldProvider.html#com.JasonILTG.ScienceMod.item.armor">IShieldProvider</a>&nbsp;</td> </tr> <tr class="altColor"> <td class="colOne"><a href="../../../../../com/JasonILTG/ScienceMod/item/armor/class-use/ScienceShield.html#com.JasonILTG.ScienceMod.item.armor">ScienceShield</a>&nbsp;</td> </tr> </tbody> </table> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li>Class</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="../../../../../index-files/index-1.html">Index</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?com/JasonILTG/ScienceMod/item/armor/package-use.html" target="_top">Frames</a></li> <li><a href="package-use.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </body> </html>
lgpl-2.1
KDE/ktp-accounts-kcm
src/avatar-button.cpp
6326
/* * Button representing user's Avatar * * Copyright (C) 2011 Martin Klapetek <martin.klapetek@gmail.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avatar-button.h" #include <QtGui/QWidgetAction> #include <QDataStream> #include <KFileDialog> #include <KMenu> #include <KLocalizedString> #include <KMessageBox> #include <KImageFilePreview> #include <TelepathyQt/Account> #include <KDE/KDebug> #include <KGlobalSettings> #include <KPixmapRegionSelectorDialog> #include <KPixmapRegionSelectorWidget> // It has been decided by a fair dice roll that 128px is a reasonable avatar // size limit in case the server (or Telepathy backend) does not provide // such information #define AVATAR_MIN_SIZE 64 #define AVATAR_MAX_SIZE 128 AvatarButton::AvatarButton(QWidget *parent) : QToolButton(parent) { KMenu *menu = new KMenu(this); setPopupMode(QToolButton::InstantPopup); setIconSize(QSize(64,64)); menu->addAction(KIcon(QLatin1String("document-open-folder")), i18n("Load from file..."), this, SLOT(onLoadAvatarFromFile())); menu->addAction(KIcon(QLatin1String("edit-clear")), i18n("Clear Avatar"), this, SLOT(onClearAvatar())); setMenu(menu); } AvatarButton::~AvatarButton() { } void AvatarButton::setAvatar(const Tp::Avatar &avatar) { m_avatar = avatar; if (! avatar.avatarData.isNull()) { KIcon avatarIcon; QPixmap avatarPixmap = QPixmap::fromImage(QImage::fromData(avatar.avatarData)); //scale oversized avatars to fit, but don't stretch smaller avatars avatarIcon.addPixmap(avatarPixmap.scaled(iconSize().boundedTo(avatarPixmap.size()), Qt::KeepAspectRatio, Qt::SmoothTransformation)); setIcon(avatarIcon); } else { setIcon(KIcon(QLatin1String("im-user"))); } } Tp::Avatar AvatarButton::avatar() const { return m_avatar; } void AvatarButton::setAccount(const Tp::AccountPtr& account) { m_account = account; } void AvatarButton::onLoadAvatarFromFile() { QStringList mimeTypes; if (m_account) { mimeTypes = m_account->avatarRequirements().supportedMimeTypes(); } if (mimeTypes.isEmpty()) { mimeTypes << QLatin1String("image/jpeg") << QLatin1String("image/png") << QLatin1String("imgae/gif"); } QPointer<KFileDialog> dialog = new KFileDialog(KUrl::fromPath(KGlobalSettings::picturesPath()), mimeTypes.join(QLatin1String(" ")), this); dialog->setOperationMode(KFileDialog::Opening); dialog->setPreviewWidget(new KImageFilePreview(dialog)); dialog->setCaption(i18n("Please choose your avatar")); KUrl fileUrl; if (dialog->exec()) { if (!dialog) { return; } fileUrl = dialog->selectedUrl(); } delete dialog; if (fileUrl.isEmpty()) { return; } const QPixmap pixmap(fileUrl.toLocalFile()); const Tp::AvatarSpec spec = m_account->avatarRequirements(); const int maxWidth = spec.maximumWidth() > 0 ? spec.maximumWidth() : AVATAR_MAX_SIZE; const int maxHeight = spec.maximumHeight() > 0 ? spec.maximumHeight() : AVATAR_MAX_SIZE; const int minWidth = spec.minimumWidth() > 0 ? spec.minimumWidth() : AVATAR_MIN_SIZE; const int minHeight = spec.minimumHeight() > 0 ? spec.minimumHeight() : AVATAR_MIN_SIZE; QPixmap finalPixmap; if (pixmap.width() > spec.maximumWidth() || pixmap.height() > spec.maximumHeight()) { finalPixmap = cropPixmap(pixmap, maxWidth, maxHeight, minWidth, minHeight); } else { finalPixmap = pixmap; if (pixmap.width() < minWidth) { finalPixmap = finalPixmap.scaledToWidth(minWidth, Qt::SmoothTransformation); } if (pixmap.height() < minHeight) { finalPixmap = finalPixmap.scaledToHeight(minHeight, Qt::SmoothTransformation); } } if (finalPixmap.isNull()) { return; } Tp::Avatar avatar; avatar.MIMEType = QLatin1String("image/png"); QDataStream stream(&avatar.avatarData, QIODevice::WriteOnly); if (!finalPixmap.save(stream.device(), "PNG")) { KMessageBox::error(this, i18n("Failed to load avatar.")); return; } setAvatar(avatar); Q_EMIT avatarChanged(); } QPixmap AvatarButton::cropPixmap(const QPixmap &pixmap, int maxWidth, int maxHeight, int minWidth, int minHeight) const { //if there's no image we don't need to select a region if (pixmap.isNull()) { return pixmap; } QPointer<KPixmapRegionSelectorDialog> regionDlg = new KPixmapRegionSelectorDialog(); KPixmapRegionSelectorWidget *widget = regionDlg->pixmapRegionSelectorWidget(); widget->setPixmap(pixmap); widget->setSelectionAspectRatio(maxWidth, maxHeight); if (regionDlg->exec()) { if (!regionDlg) { return QPixmap(); } delete regionDlg; QImage selectedImage = widget->selectedImage(); if (selectedImage.width() > maxWidth || selectedImage.height() > maxHeight) { return QPixmap::fromImage(selectedImage.scaled(maxWidth, maxHeight, Qt::KeepAspectRatio)); } else if (selectedImage.width() < minWidth || selectedImage.height() < minHeight) { return QPixmap::fromImage(selectedImage.scaled(minWidth, minHeight, Qt::KeepAspectRatio)); } else { return QPixmap::fromImage(widget->selectedImage()); } } delete regionDlg; return QPixmap(); } void AvatarButton::onClearAvatar() { setAvatar(Tp::Avatar()); Q_EMIT avatarChanged(); }
lgpl-2.1
hyyh619/OpenSceneGraph-3.4.0
3rdparty_windows/x86/include/ogr_core.h
18422
/****************************************************************************** * $Id: ogr_core.h 23947 2012-02-11 17:37:02Z rouault $ * * Project: OpenGIS Simple Features Reference Implementation * Purpose: Define some core portability services for cross-platform OGR code. * Author: Frank Warmerdam, warmerdam@pobox.com * ****************************************************************************** * Copyright (c) 1999, Frank Warmerdam * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. ****************************************************************************/ #ifndef OGR_CORE_H_INCLUDED #define OGR_CORE_H_INCLUDED #include "cpl_port.h" #include "gdal_version.h" /** * \file * * Core portability services for cross-platform OGR code. */ /** * Simple container for a bounding region. */ #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS) class CPL_DLL OGREnvelope { public: OGREnvelope() : MinX(0.0), MaxX(0.0), MinY(0.0), MaxY(0.0) {} OGREnvelope(const OGREnvelope &oOther) : MinX(oOther.MinX), MaxX(oOther.MaxX), MinY(oOther.MinY), MaxY(oOther.MaxY) {} double MinX; double MaxX; double MinY; double MaxY; int IsInit() const { return MinX != 0 || MinY != 0 || MaxX != 0 || MaxY != 0; } void Merge(OGREnvelope const &sOther) { if (IsInit()) { MinX = MIN(MinX, sOther.MinX); MaxX = MAX(MaxX, sOther.MaxX); MinY = MIN(MinY, sOther.MinY); MaxY = MAX(MaxY, sOther.MaxY); } else { MinX = sOther.MinX; MaxX = sOther.MaxX; MinY = sOther.MinY; MaxY = sOther.MaxY; } } void Merge(double dfX, double dfY) { if (IsInit()) { MinX = MIN(MinX, dfX); MaxX = MAX(MaxX, dfX); MinY = MIN(MinY, dfY); MaxY = MAX(MaxY, dfY); } else { MinX = MaxX = dfX; MinY = MaxY = dfY; } } void Intersect(OGREnvelope const &sOther) { if (Intersects(sOther)) { if (IsInit()) { MinX = MAX(MinX, sOther.MinX); MaxX = MIN(MaxX, sOther.MaxX); MinY = MAX(MinY, sOther.MinY); MaxY = MIN(MaxY, sOther.MaxY); } else { MinX = sOther.MinX; MaxX = sOther.MaxX; MinY = sOther.MinY; MaxY = sOther.MaxY; } } else { MinX = 0; MaxX = 0; MinY = 0; MaxY = 0; } } int Intersects(OGREnvelope const &other) const { return MinX <= other.MaxX && MaxX >= other.MinX && MinY <= other.MaxY && MaxY >= other.MinY; } int Contains(OGREnvelope const &other) const { return MinX <= other.MinX && MinY <= other.MinY && MaxX >= other.MaxX && MaxY >= other.MaxY; } }; #else typedef struct { double MinX; double MaxX; double MinY; double MaxY; } OGREnvelope; #endif /** * Simple container for a bounding region in 3D. */ #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS) class CPL_DLL OGREnvelope3D : public OGREnvelope { public: OGREnvelope3D() : OGREnvelope(), MinZ(0.0), MaxZ(0.0) {} OGREnvelope3D(const OGREnvelope3D &oOther) : OGREnvelope(oOther), MinZ(oOther.MinZ), MaxZ(oOther.MaxZ) {} double MinZ; double MaxZ; int IsInit() const { return MinX != 0 || MinY != 0 || MaxX != 0 || MaxY != 0 || MinZ != 0 || MaxZ != 0; } void Merge(OGREnvelope3D const &sOther) { if (IsInit()) { MinX = MIN(MinX, sOther.MinX); MaxX = MAX(MaxX, sOther.MaxX); MinY = MIN(MinY, sOther.MinY); MaxY = MAX(MaxY, sOther.MaxY); MinZ = MIN(MinZ, sOther.MinZ); MaxZ = MAX(MaxZ, sOther.MaxZ); } else { MinX = sOther.MinX; MaxX = sOther.MaxX; MinY = sOther.MinY; MaxY = sOther.MaxY; MinZ = sOther.MinZ; MaxZ = sOther.MaxZ; } } void Merge(double dfX, double dfY, double dfZ) { if (IsInit()) { MinX = MIN(MinX, dfX); MaxX = MAX(MaxX, dfX); MinY = MIN(MinY, dfY); MaxY = MAX(MaxY, dfY); MinZ = MIN(MinZ, dfZ); MaxZ = MAX(MaxZ, dfZ); } else { MinX = MaxX = dfX; MinY = MaxY = dfY; MinZ = MaxZ = dfZ; } } void Intersect(OGREnvelope3D const &sOther) { if (Intersects(sOther)) { if (IsInit()) { MinX = MAX(MinX, sOther.MinX); MaxX = MIN(MaxX, sOther.MaxX); MinY = MAX(MinY, sOther.MinY); MaxY = MIN(MaxY, sOther.MaxY); MinZ = MAX(MinZ, sOther.MinZ); MaxZ = MIN(MaxZ, sOther.MaxZ); } else { MinX = sOther.MinX; MaxX = sOther.MaxX; MinY = sOther.MinY; MaxY = sOther.MaxY; MinZ = sOther.MinZ; MaxZ = sOther.MaxZ; } } else { MinX = 0; MaxX = 0; MinY = 0; MaxY = 0; MinZ = 0; MaxZ = 0; } } int Intersects(OGREnvelope3D const &other) const { return MinX <= other.MaxX && MaxX >= other.MinX && MinY <= other.MaxY && MaxY >= other.MinY && MinZ <= other.MaxZ && MaxZ >= other.MinZ; } int Contains(OGREnvelope3D const &other) const { return MinX <= other.MinX && MinY <= other.MinY && MaxX >= other.MaxX && MaxY >= other.MaxY && MaxZ >= other.MaxZ && MaxZ >= other.MaxZ; } }; #else typedef struct { double MinX; double MaxX; double MinY; double MaxY; double MinZ; double MaxZ; } OGREnvelope3D; #endif CPL_C_START void CPL_DLL*OGRMalloc(size_t); void CPL_DLL*OGRCalloc(size_t, size_t); void CPL_DLL*OGRRealloc(void*, size_t); char CPL_DLL* OGRStrdup(const char*); void CPL_DLL OGRFree(void*); typedef int OGRErr; #define OGRERR_NONE 0 #define OGRERR_NOT_ENOUGH_DATA 1 /* not enough data to deserialize */ #define OGRERR_NOT_ENOUGH_MEMORY 2 #define OGRERR_UNSUPPORTED_GEOMETRY_TYPE 3 #define OGRERR_UNSUPPORTED_OPERATION 4 #define OGRERR_CORRUPT_DATA 5 #define OGRERR_FAILURE 6 #define OGRERR_UNSUPPORTED_SRS 7 #define OGRERR_INVALID_HANDLE 8 typedef int OGRBoolean; /* -------------------------------------------------------------------- */ /* ogr_geometry.h related definitions. */ /* -------------------------------------------------------------------- */ /** * List of well known binary geometry types. These are used within the BLOBs * but are also returned from OGRGeometry::getGeometryType() to identify the * type of a geometry object. */ typedef enum { wkbUnknown = 0, /**< unknown type, non-standard */ wkbPoint = 1, /**< 0-dimensional geometric object, standard WKB */ wkbLineString = 2, /**< 1-dimensional geometric object with linear * interpolation between Points, standard WKB */ wkbPolygon = 3, /**< planar 2-dimensional geometric object defined * by 1 exterior boundary and 0 or more interior * boundaries, standard WKB */ wkbMultiPoint = 4, /**< GeometryCollection of Points, standard WKB */ wkbMultiLineString = 5, /**< GeometryCollection of LineStrings, standard WKB */ wkbMultiPolygon = 6, /**< GeometryCollection of Polygons, standard WKB */ wkbGeometryCollection = 7, /**< geometric object that is a collection of 1 or more geometric objects, standard WKB */ wkbNone = 100, /**< non-standard, for pure attribute records */ wkbLinearRing = 101, /**< non-standard, just for createGeometry() */ wkbPoint25D = 0x80000001, /**< 2.5D extension as per 99-402 */ wkbLineString25D = 0x80000002, /**< 2.5D extension as per 99-402 */ wkbPolygon25D = 0x80000003, /**< 2.5D extension as per 99-402 */ wkbMultiPoint25D = 0x80000004, /**< 2.5D extension as per 99-402 */ wkbMultiLineString25D = 0x80000005, /**< 2.5D extension as per 99-402 */ wkbMultiPolygon25D = 0x80000006, /**< 2.5D extension as per 99-402 */ wkbGeometryCollection25D = 0x80000007 /**< 2.5D extension as per 99-402 */ } OGRwkbGeometryType; #define wkb25DBit 0x80000000 #define wkbFlatten(x) ((OGRwkbGeometryType) ((x)& (~wkb25DBit))) #define ogrZMarker 0x21125711 const char CPL_DLL* OGRGeometryTypeToName(OGRwkbGeometryType eType); OGRwkbGeometryType CPL_DLL OGRMergeGeometryTypes(OGRwkbGeometryType eMain, OGRwkbGeometryType eExtra); typedef enum { wkbXDR = 0, /* MSB/Sun/Motoroloa: Most Significant Byte First */ wkbNDR = 1 /* LSB/Intel/Vax: Least Significant Byte First */ } OGRwkbByteOrder; #ifndef NO_HACK_FOR_IBM_DB2_V72 # define HACK_FOR_IBM_DB2_V72 #endif #ifdef HACK_FOR_IBM_DB2_V72 # define DB2_V72_FIX_BYTE_ORDER(x) ((((x) & 0x31) == (x)) ? (OGRwkbByteOrder) ((x) & 0x1) : (x)) # define DB2_V72_UNFIX_BYTE_ORDER(x) ((unsigned char) (OGRGeometry::bGenerate_DB2_V72_BYTE_ORDER ? ((x) | 0x30) : (x))) #else # define DB2_V72_FIX_BYTE_ORDER(x) (x) # define DB2_V72_UNFIX_BYTE_ORDER(x) (x) #endif #define ALTER_NAME_FLAG 0x1 #define ALTER_TYPE_FLAG 0x2 #define ALTER_WIDTH_PRECISION_FLAG 0x4 #define ALTER_ALL_FLAG (ALTER_NAME_FLAG | ALTER_TYPE_FLAG | ALTER_WIDTH_PRECISION_FLAG) /************************************************************************/ /* ogr_feature.h related definitions. */ /************************************************************************/ /** * List of feature field types. This list is likely to be extended in the * future ... avoid coding applications based on the assumption that all * field types can be known. */ typedef enum { /** Simple 32bit integer */ OFTInteger = 0, /** List of 32bit integers */ OFTIntegerList = 1, /** Double Precision floating point */ OFTReal = 2, /** List of doubles */ OFTRealList = 3, /** String of ASCII chars */ OFTString = 4, /** Array of strings */ OFTStringList = 5, /** deprecated */ OFTWideString = 6, /** deprecated */ OFTWideStringList = 7, /** Raw Binary data */ OFTBinary = 8, /** Date */ OFTDate = 9, /** Time */ OFTTime = 10, /** Date and Time */ OFTDateTime = 11, OFTMaxType = 11 } OGRFieldType; /** * Display justification for field values. */ typedef enum { OJUndefined = 0, OJLeft = 1, OJRight = 2 } OGRJustification; #define OGRNullFID -1 #define OGRUnsetMarker -21121 /************************************************************************/ /* OGRField */ /************************************************************************/ /** * OGRFeature field attribute value union. */ typedef union { int Integer; double Real; char *String; struct { int nCount; int *paList; } IntegerList; struct { int nCount; double *paList; } RealList; struct { int nCount; char **paList; } StringList; struct { int nCount; GByte *paData; } Binary; struct { int nMarker1; int nMarker2; } Set; struct { GInt16 Year; GByte Month; GByte Day; GByte Hour; GByte Minute; GByte Second; GByte TZFlag; /* 0=unknown, 1=localtime(ambiguous), 100=GMT, 104=GMT+1, 80=GMT-5, etc */ } Date; } OGRField; int CPL_DLL OGRParseDate(const char *pszInput, OGRField *psOutput, int nOptions); /* -------------------------------------------------------------------- */ /* Constants from ogrsf_frmts.h for capabilities. */ /* -------------------------------------------------------------------- */ #define OLCRandomRead "RandomRead" #define OLCSequentialWrite "SequentialWrite" #define OLCRandomWrite "RandomWrite" #define OLCFastSpatialFilter "FastSpatialFilter" #define OLCFastFeatureCount "FastFeatureCount" #define OLCFastGetExtent "FastGetExtent" #define OLCCreateField "CreateField" #define OLCDeleteField "DeleteField" #define OLCReorderFields "ReorderFields" #define OLCAlterFieldDefn "AlterFieldDefn" #define OLCTransactions "Transactions" #define OLCDeleteFeature "DeleteFeature" #define OLCFastSetNextByIndex "FastSetNextByIndex" #define OLCStringsAsUTF8 "StringsAsUTF8" #define OLCIgnoreFields "IgnoreFields" #define ODsCCreateLayer "CreateLayer" #define ODsCDeleteLayer "DeleteLayer" #define ODrCCreateDataSource "CreateDataSource" #define ODrCDeleteDataSource "DeleteDataSource" /************************************************************************/ /* ogr_featurestyle.h related definitions. */ /************************************************************************/ /** * OGRStyleTool derived class types (returned by GetType()). */ typedef enum ogr_style_tool_class_id { OGRSTCNone = 0, OGRSTCPen = 1, OGRSTCBrush = 2, OGRSTCSymbol = 3, OGRSTCLabel = 4, OGRSTCVector = 5 } OGRSTClassId; /** * List of units supported by OGRStyleTools. */ typedef enum ogr_style_tool_units_id { OGRSTUGround = 0, OGRSTUPixel = 1, OGRSTUPoints = 2, OGRSTUMM = 3, OGRSTUCM = 4, OGRSTUInches = 5 } OGRSTUnitId; /** * List of parameters for use with OGRStylePen. */ typedef enum ogr_style_tool_param_pen_id { OGRSTPenColor = 0, OGRSTPenWidth = 1, OGRSTPenPattern = 2, OGRSTPenId = 3, OGRSTPenPerOffset = 4, OGRSTPenCap = 5, OGRSTPenJoin = 6, OGRSTPenPriority = 7, OGRSTPenLast = 8 } OGRSTPenParam; /** * List of parameters for use with OGRStyleBrush. */ typedef enum ogr_style_tool_param_brush_id { OGRSTBrushFColor = 0, OGRSTBrushBColor = 1, OGRSTBrushId = 2, OGRSTBrushAngle = 3, OGRSTBrushSize = 4, OGRSTBrushDx = 5, OGRSTBrushDy = 6, OGRSTBrushPriority = 7, OGRSTBrushLast = 8 } OGRSTBrushParam; /** * List of parameters for use with OGRStyleSymbol. */ typedef enum ogr_style_tool_param_symbol_id { OGRSTSymbolId = 0, OGRSTSymbolAngle = 1, OGRSTSymbolColor = 2, OGRSTSymbolSize = 3, OGRSTSymbolDx = 4, OGRSTSymbolDy = 5, OGRSTSymbolStep = 6, OGRSTSymbolPerp = 7, OGRSTSymbolOffset = 8, OGRSTSymbolPriority = 9, OGRSTSymbolFontName = 10, OGRSTSymbolOColor = 11, OGRSTSymbolLast = 12 } OGRSTSymbolParam; /** * List of parameters for use with OGRStyleLabel. */ typedef enum ogr_style_tool_param_label_id { OGRSTLabelFontName = 0, OGRSTLabelSize = 1, OGRSTLabelTextString = 2, OGRSTLabelAngle = 3, OGRSTLabelFColor = 4, OGRSTLabelBColor = 5, OGRSTLabelPlacement = 6, OGRSTLabelAnchor = 7, OGRSTLabelDx = 8, OGRSTLabelDy = 9, OGRSTLabelPerp = 10, OGRSTLabelBold = 11, OGRSTLabelItalic = 12, OGRSTLabelUnderline = 13, OGRSTLabelPriority = 14, OGRSTLabelStrikeout = 15, OGRSTLabelStretch = 16, OGRSTLabelAdjHor = 17, OGRSTLabelAdjVert = 18, OGRSTLabelHColor = 19, OGRSTLabelOColor = 20, OGRSTLabelLast = 21 } OGRSTLabelParam; /* ------------------------------------------------------------------- */ /* Version checking */ /* -------------------------------------------------------------------- */ /* Note to developers : please keep this section in sync with gdal.h */ #ifndef GDAL_VERSION_INFO_DEFINED #define GDAL_VERSION_INFO_DEFINED const char CPL_DLL * CPL_STDCALL GDALVersionInfo(const char*); #endif #ifndef GDAL_CHECK_VERSION /** Return TRUE if GDAL library version at runtime matches nVersionMajor.nVersionMinor. The purpose of this method is to ensure that calling code will run with the GDAL version it is compiled for. It is primarly intented for external plugins. @param nVersionMajor Major version to be tested against @param nVersionMinor Minor version to be tested against @param pszCallingComponentName If not NULL, in case of version mismatch, the method will issue a failure mentionning the name of the calling component. */ int CPL_DLL CPL_STDCALL GDALCheckVersion(int nVersionMajor, int nVersionMinor, const char *pszCallingComponentName); /** Helper macro for GDALCheckVersion */ #define GDAL_CHECK_VERSION(pszCallingComponentName) \ GDALCheckVersion(GDAL_VERSION_MAJOR, GDAL_VERSION_MINOR, pszCallingComponentName) #endif CPL_C_END #endif /* ndef OGR_CORE_H_INCLUDED */
lgpl-2.1
eaulisa/MyFEMuS
src/algebra/GmresPetscLinearEquationSolver.hpp
4753
/*========================================================================= Program: FEMUS Module: PetscLinearEquationSolver Authors: Eugenio Aulisa, Simone Bnà Copyright (c) FEMTTU All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ #ifndef __femus_algebra_GmresPetscLinearEquationSolver_hpp__ #define __femus_algebra_GmresPetscLinearEquationSolver_hpp__ #include "FemusConfig.hpp" #ifdef HAVE_PETSC #ifdef HAVE_MPI #include <mpi.h> #endif //---------------------------------------------------------------------------- // includes : //---------------------------------------------------------------------------- #include "LinearEquationSolver.hpp" namespace femus { /** * This class inherits the abstract class LinearEquationSolver. In this class the solver is implemented using the PETSc package */ class GmresPetscLinearEquationSolver : public LinearEquationSolver { public: /** Constructor. Initializes Petsc data structures */ GmresPetscLinearEquationSolver(const unsigned &igrid, Solution *other_solution); /// Destructor. ~GmresPetscLinearEquationSolver(); protected: /// Release all memory and clear data structures. void Clear(); void SetTolerances(const double &rtol, const double &atol, const double &divtol, const unsigned &maxits, const unsigned &restart); void Init(Mat& Amat, Mat &Pmat); void Solve(const vector <unsigned>& variable_to_be_solved, const bool &ksp_clean); void MGInit(const MgSmootherType & mg_smoother_type, const unsigned &levelMax, const char* outer_ksp_solver = KSPGMRES); void MGSetLevel(LinearEquationSolver *LinSolver, const unsigned &maxlevel, const vector <unsigned> &variable_to_be_solved, SparseMatrix* PP, SparseMatrix* RR, const unsigned &npre, const unsigned &npost); void RemoveNullSpace(); void GetNullSpaceBase( std::vector < Vec > &nullspBase); void ZerosBoundaryResiduals(); void SetPenalty(); void SetRichardsonScaleFactor(const double & richardsonScaleFactor){ _richardsonScaleFactor = richardsonScaleFactor; } virtual void BuildBdcIndex(const vector <unsigned> &variable_to_be_solved); virtual void SetPreconditioner(KSP& subksp, PC& subpc); void MGSolve(const bool ksp_clean); inline void MGClear() { KSPDestroy(&_ksp); } inline KSP* GetKSP() { return &_ksp; }; /// Set the user-specified solver stored in \p _solver_type void SetPetscSolverType(KSP &ksp); /** @deprecated, remove soon */ std::pair<unsigned int, double> solve(SparseMatrix& matrix_in, SparseMatrix& precond_in, NumericVector& solution_in, NumericVector& rhs_in, const double tol, const unsigned int m_its); /** @deprecated, remove soon */ void init(SparseMatrix* matrix); protected: // member data KSP _ksp; ///< Krylov subspace context PC _pc; ///< Preconditioner context PetscReal _rtol; PetscReal _abstol; PetscReal _dtol; PetscInt _maxits; PetscInt _restart; vector <PetscInt> _bdcIndex; bool _bdcIndexIsInitialized; double _richardsonScaleFactor; }; // ============================================= inline GmresPetscLinearEquationSolver::GmresPetscLinearEquationSolver(const unsigned &igrid, Solution *other_solution) : LinearEquationSolver(igrid, other_solution) { if(igrid == 0) { this->_preconditioner_type = MLU_PRECOND; this->_solver_type = PREONLY; } else { this->_preconditioner_type = ILU_PRECOND; this->_solver_type = GMRES; } _rtol = 1.e-5; _abstol = 1.e-50; _dtol = 1.e+5; _maxits = 1000; _restart = 30; _richardsonScaleFactor = 0.5; _bdcIndexIsInitialized = 0; _printSolverInfo = false; } // ============================================= inline GmresPetscLinearEquationSolver::~GmresPetscLinearEquationSolver() { this->Clear(); } // ================================================ inline void GmresPetscLinearEquationSolver::Clear() { // if(this->initialized()) { this->_is_initialized = false; KSPDestroy(&_ksp); } } } //end namespace femus #endif #endif
lgpl-2.1
mfvalin/rmnlib
compresseur/armn_compress_32.c
32194
#include <math.h> #include <stdlib.h> #include <stdio.h> #include <rpnmacros.h> #include <unistd.h> #include <zfstlib.h> #include <malloc.h> #include <string.h> int c_armn_compress32(unsigned char *, float *, int, int, int, int); int c_armn_uncompress32(float *fld, unsigned char *zstream, int ni, int nj, int nk, int nchiffres_sign); int c_fstzip32(unsigned int *zfld, unsigned int *fld, int ni, int nj, int nk, int step, int nbits, int remaining_space); int c_fstzip_parallelogram32(unsigned int *zfld, int *zlng, unsigned int *fld, int ni, int nj, int step, int nbits, word *header); int f77name(armn_compress32)(unsigned char *, float *, int *, int *, int *, int *); int f77name(armn_uncompress32)(float *fld, unsigned char *zstream, int *ni, int *nj, int *nk, int *nchiffres_sign); void c_fstunzip(unsigned int *fld, unsigned int *zfld, int ni, int nj, int nbits); void pack1bitRLE(unsigned int z[], unsigned int *zlng, unsigned char ufld[], int npts); void packTokensParallelogram(unsigned int z[], unsigned int *zlng, unsigned short ufld[], int ni, int nj, int nbits, int istep, word *header); void packTokensParallelogram32(unsigned int z[], int *zlng, unsigned int ufld[], int ni, int nj, int nbits, int istep, int remaining_space); void packTokensParallelogram_8(unsigned int z[], unsigned int *zlng, unsigned char ufld[], int ni, int nj, int nbits, int istep); void pack_stream_nbits_32(unsigned int z[], unsigned int *zlng, unsigned int ufld[], int npts, int nbits); void unpackTokensParallelogram(unsigned short ufld[], unsigned int z[], int ni, int nj, int nbits, int istep, word *header); void unpackTokensParallelogram32(unsigned int ufld[], unsigned int z[], int ni, int nj, int nbits, int istep); void unpackTokensParallelogram_8(unsigned char ufld[], unsigned int z[], int ni, int nj, int nbits, int istep); int compact_mask_char(unsigned int *dest, unsigned char *src, int npts); int uncompact_mask_char(int *dest, unsigned int *src, int npts); void pack1bitRLE(unsigned int z[], unsigned int *zlng, unsigned char ufld[], int npts); void pack_stream_nbits_16(unsigned int z[], unsigned int *zlng, unsigned short ufld[], int npts, int nbits); void pack_stream_nbits_32(unsigned int z[], unsigned int *zlng, unsigned int ufld[], int npts, int nbits); void pack_stream_nbits_8(unsigned int z[], unsigned int *zlng, unsigned char ufld[], int npts, int nbits); void unpack1bitRLE(unsigned char ufld[], unsigned int z[], unsigned int *zlng, int npts); void unpack_stream_nbits_16(unsigned short ufld[], unsigned int z[], int npts, int nbits); void unpack_stream_nbits_32(unsigned int ufld[], unsigned int z[], int npts, int nbits); void unpack_stream_nbits_8(unsigned char ufld[], unsigned int z[], int npts, int nbits); #define MEME_SIGNE_POSITIF 0x00 #define MEME_SIGNE_NEGATIF 0x10 #define DIFF_SIGNE_PACKED 0x20 #define DIFF_SIGNE_STREAM 0x30 #define MEME_EXPOSANT 0x00 #define DIFF_EXPOSANT_PACKED 0x08 #define DIFF_EXPOSANT_STREAM 0x0C #define MANTISSE_PACKED 0x00 #define MANTISSE_STREAM 0x01 #define SEQUENCE 0 #define COUNT 1 #define ZERO 0 #define UN 1 static unsigned char fastlog[256]; static int once = 0; extern int zfst_msglevel; int f77name(armn_compress32)(unsigned char *zstream, float *fld, int *ni, int *nj, int *nk, int *nbits) { return c_armn_compress32(zstream, fld, *ni, *nj, *nk, *nbits); } int c_armn_compress32(unsigned char *zstream, float *fld, int ni, int nj, int nk, int znbits) { float *p_fld; int i, meme_signe, remaining_space; int nbits; unsigned char *exposant, *exposant2; unsigned char *le_pointeur, *pos_lng_signe, *pos_lng_exposant, *pos_lng_mantisse; unsigned char *signe, *zsigne, code_signe, code_exposant, code_mantisse; unsigned char codes; unsigned int *mantisse, *mantisse_stream, *la_mantisse,*zmantisse, exp_base; unsigned int *temp; unsigned int exp_min, exp_max, *zexposant; unsigned int le_signe_or, le_signe_and; unsigned int npts, zlng, lng_signe, lng_exposant,lng_mantisse,nbits_needed; unsigned int zieee_info; _fstzip zfstzip; _floatint r_exp_max; if (ni < 16 || nj < 16) { zlng = -1; fprintf(stderr, "*** <armn_compress32> : The dimensions of NI and NJ have to be > 16\n"); return zlng; } nbits = znbits - 9; memset(&zfstzip, (int)NULL, sizeof(_fstzip)); zfstzip.predictor_type = PARALLELOGRAM32; zfstzip.step = 3; zfstzip.degree = 1; zfstzip.nbits = nbits; zfstzip.levels = 1; zfstzip.version = 2; mantisse_stream = NULL; pos_lng_signe = NULL; npts = ni * nj; signe = (unsigned char *) malloc(2*npts * sizeof(unsigned char)); zsigne = (unsigned char *) malloc(2*npts * sizeof(unsigned char)); exposant = (unsigned char *) malloc(2*npts * sizeof(unsigned char)); exposant2 = (unsigned char *) malloc(2*npts * sizeof(unsigned char)); zexposant = (unsigned int *) malloc(npts*sizeof(unsigned int)); mantisse = (unsigned int *) malloc(2*npts * sizeof(unsigned int)); zmantisse = (unsigned int *) malloc(2*npts * sizeof(unsigned int)); le_signe_or = 0; le_signe_and = 0xFFFFFFFF; p_fld = fld; for (i=0; i < npts; i++) { temp = (unsigned int *) p_fld; signe[i] = *temp >> 31; le_signe_or |= *temp; le_signe_and &= *temp; exposant[i] = (*temp >> 23) & 0xff; exposant2[i] = exposant[i]; mantisse[i] = (*temp & 0x07fffff); p_fld++; } if (nbits < 23) { for (i=0; i < npts; i++) { mantisse[i] = (mantisse[i] >> (23-nbits)); } } meme_signe=0; if ((le_signe_or>>31) == (le_signe_and>>31)) { meme_signe=1; } exp_min = exposant2[0]; exp_max = exp_min; for (i=0; i < npts; i++) { if (exposant2[i] < exp_min) exp_min = exposant2[i]; if (exposant2[i] > exp_max) exp_max = exposant2[i]; } exp_base = exp_min; exp_max = exp_max - exp_min; exp_min = 0; for (i=0; i < npts; i++) { exposant2[i] = exposant2[i]- exp_base; } if (exp_max == exp_min) { nbits_needed =0; } else { nbits_needed =(int)(1+log(exp_max+0.5)/log(2.0)); r_exp_max.f = (float)(exp_max); nbits_needed = (r_exp_max.i >> 23) - 126; } /* ------------------- Encodage du stream de signe ------------------------- */ le_pointeur = &(zstream[8]); if (meme_signe == 1) { lng_signe = 0; if ((le_signe_or >> 31) == 1) { code_signe = MEME_SIGNE_NEGATIF; } else { code_signe = MEME_SIGNE_POSITIF; } } else { pos_lng_signe = le_pointeur; le_pointeur += sizeof(unsigned int); pack1bitRLE((unsigned int *)le_pointeur, &lng_signe, signe, npts); code_signe = DIFF_SIGNE_PACKED; } if (lng_signe > (npts/4)) { compact_mask_char((unsigned int *) le_pointeur, signe, npts); lng_signe = 1 + (npts >> 5); code_signe = DIFF_SIGNE_STREAM; } if (0 != (lng_signe%4)) { lng_signe += (4 - (lng_signe%4)); } le_pointeur+= lng_signe; if (code_signe == DIFF_SIGNE_PACKED || code_signe == DIFF_SIGNE_STREAM ) { memcpy(pos_lng_signe, &lng_signe, sizeof(unsigned int)); } /* ------------------- Encodage du stream d'exposants ------------------------- */ pos_lng_exposant = le_pointeur; if (nbits_needed == 0) { lng_exposant = 0; code_exposant = MEME_EXPOSANT; } else { code_exposant = DIFF_EXPOSANT_PACKED; le_pointeur += sizeof(unsigned int); packTokensParallelogram_8((unsigned int *)le_pointeur, &lng_exposant, exposant2, ni, nj, nbits_needed, 3); if (lng_exposant > ni*nj) { zlng = -1; fprintf(stderr, "*** <armn_compress32> : Exponent range too large\n"); fprintf(stderr, "*** <armn_compress32> : Original field left uncompressed\n"); return zlng; /*pack_stream_nbits_8((unsigned int *)le_pointeur, &lng_exposant, exposant2, npts, nbits_needed); code_exposant = DIFF_EXPOSANT_STREAM;*/ } if (0 != (lng_exposant%4)) { lng_exposant += 4 - (lng_exposant%4); } memcpy(pos_lng_exposant, &lng_exposant, sizeof(unsigned int)); le_pointeur += lng_exposant; } /* ------------------- Encodage du stream de mantisse ------------------------- */ pos_lng_mantisse = le_pointeur; le_pointeur += sizeof(unsigned int); code_mantisse = MANTISSE_PACKED; remaining_space = (ni*nj*znbits)/32; remaining_space = remaining_space - (le_pointeur - zstream)/sizeof(unsigned int); lng_mantisse = c_fstzip32((unsigned int *)le_pointeur, mantisse, ni, nj, nk, zfstzip.step, nbits, remaining_space); la_mantisse = zmantisse; if (lng_mantisse == 0) { free(signe); free(zsigne); free(exposant); free(exposant2); free(zexposant); if (la_mantisse != mantisse) { free(mantisse_stream); } free(mantisse); free(zmantisse); return -1; } if (0 != (lng_mantisse%4)) { lng_mantisse += 4 - (lng_mantisse%4); } memcpy(pos_lng_mantisse, &lng_signe, sizeof(unsigned int)); /* ------------------- ------------------------------- ------------------------- */ /* ------------------- ----------- Assemblage final ------------------- */ /* ------------------- Entete et codes ------------------- */ zstream[0] = (unsigned char)'\0'; i = 0; memcpy(&zstream[0], &zfstzip, sizeof(unsigned int)); zieee_info = 0; i+= sizeof(unsigned int); codes = (unsigned char)(code_signe | code_exposant | code_mantisse); zieee_info = ((unsigned char) exp_base) << 16; zieee_info = zieee_info | ((unsigned char)nbits_needed) << 8; zieee_info = zieee_info | (unsigned char) codes; memcpy(&zstream[i], &zieee_info, sizeof(unsigned int)); i+=sizeof(unsigned int); le_pointeur += lng_mantisse; zlng = le_pointeur - zstream; /* ---------------- Menage avant de s'en aller ------------------- */ free(signe); free(zsigne); free(exposant); free(exposant2); free(zexposant); if (la_mantisse != mantisse) { free(mantisse_stream); } free(mantisse); free(zmantisse); return zlng; } int f77name(armn_uncompress32)(float *fld, unsigned char *zstream, int *ni, int *nj, int *nk, int *nbits) { return c_armn_uncompress32(fld, zstream, *ni, *nj, *nk, *nbits); } int c_armn_uncompress32(float *fld, unsigned char *zstream, int ni, int nj, int nk, int znbits) { _fstzip zfstzip; int bitPackInWord, saut, zlng; int i, nbits_mantisse, nbits; unsigned char *exposant, *exposant2; unsigned char *signe, *zsigne, code_signe, code_exposant, code_mantisse; unsigned char codes; unsigned int *cur, curword, nbits_needed_exposant; unsigned int *mantisse; unsigned int *temp; unsigned int exp_min; unsigned int npts, lng_signe, lng_exposant,lng_mantisse, zieee_info; npts = ni * nj; signe = (unsigned char *) malloc(2*npts * sizeof(unsigned char)); zsigne = (unsigned char *) malloc(2*npts * sizeof(unsigned char)); exposant = (unsigned char *) malloc(2*npts * sizeof(unsigned char)); exposant2 = (unsigned char *) malloc(2*npts * sizeof(unsigned char)); mantisse = (unsigned int *) malloc(2*npts * sizeof(unsigned int)); bitPackInWord = 32; cur = (unsigned int *)zstream; curword = *cur; memcpy(&zfstzip, cur, sizeof(unsigned int)); cur++; memcpy(&zieee_info, cur, sizeof(unsigned int)); cur++; exp_min = zieee_info >> 16; nbits_needed_exposant = (zieee_info >> 8) & 0xFF; nbits_mantisse = zfstzip.nbits; nbits = nbits_mantisse; codes = zieee_info& 0xFF; code_signe = (codes & 0x30); code_exposant = (codes & 0xC); code_mantisse = (codes & 0x3); if (code_signe == DIFF_SIGNE_PACKED || code_signe == DIFF_SIGNE_STREAM) { memcpy(&lng_signe, cur, sizeof(unsigned int)); cur++; unpack1bitRLE(signe, cur, (unsigned int *)&zlng,npts); saut = (lng_signe >> 2); cur += saut; } else { if (code_signe == MEME_SIGNE_POSITIF) { for (i=0; i < npts; i++) { signe[i] = 0; } } else { for (i=0; i < npts; i++) { signe[i] = 1; } } } if (code_exposant == DIFF_EXPOSANT_PACKED || code_exposant == DIFF_EXPOSANT_STREAM) { memcpy(&lng_exposant, cur, sizeof(unsigned int)); cur++; unpackTokensParallelogram_8(exposant2, cur, ni, nj, nbits_needed_exposant, 3); /* lng_exposant = armn_compress(exposant2, *ni, *nj, *nk, nbits_needed_exposant, 2);*/ saut = (lng_exposant >> 2); cur += saut; for (i=0; i < npts; i++) { exposant2[i] = exposant2[i] + exp_min; } } else { for (i=0; i < npts; i++) { exposant2[i] = exp_min; } } memcpy(&lng_mantisse, cur, sizeof(unsigned int)); cur++; if (code_mantisse == MANTISSE_PACKED) { unpackTokensParallelogram32(mantisse, cur, ni, nj, nbits_mantisse, 3); } else { unpack_stream_nbits_32(mantisse, cur, npts, nbits_mantisse); } switch(code_signe) { case MEME_SIGNE_POSITIF: for (i=0; i < npts; i++) { temp = (unsigned int *)&fld[i]; *temp = 0; *temp |= (exposant2[i] << 23); *temp |= (mantisse[i] << (23-nbits)); } break; case MEME_SIGNE_NEGATIF: for (i=0; i < npts; i++) { temp = (unsigned int *)&fld[i]; *temp = 0x80000000; *temp = *temp | (exposant2[i] << 23); *temp = *temp | (mantisse[i] << (23-nbits)); } break; default: for (i=0; i < npts; i++) { temp = (unsigned int *)&fld[i]; *temp = signe[i] << 31; *temp |= (exposant2[i] << 23); *temp |= (mantisse[i] << (23-nbits)); } break; } free(signe); free(zsigne); free(exposant); free(exposant2); free(mantisse); return ni*nj; } int c_fstzip32(unsigned int *zfld, unsigned int *fld, int ni, int nj, int nk, int step, int nbits, int remaining_space) { int zlng, lng_origin; lng_origin = (1+(ni*nj*nk*1.0*nbits)/8); if (ni == 1 || nj == 1) { return lng_origin; } packTokensParallelogram32(zfld, &zlng, fld, ni, nj, step, nbits, remaining_space); if (zlng == 0 && zfst_msglevel <= 2) { fprintf(stdout, "IEEE compressed field is larger than original... Returning original\n\n"); return 0; } return zlng; } void packTokensParallelogram32(unsigned int z[], int *zlng, unsigned int ufld[], int ni, int nj, int istep, int nbits, int remaining_space) { _floatint r_lmax; int *ufld_dst; int k22, nbits2; int lcl_m, lcl_n; int local_max; unsigned int *cur; unsigned int i, j, k, m, n; unsigned int lastWordShifted, spaceInLastWord, lastSlot; unsigned int lcl, nbits_needed; unsigned int nbits_req_container, token; lastSlot = 0; cur = z; ufld_dst=(int *) malloc(ni*nj*sizeof(int)); for (j=1; j <= nj; j++) { k = FTN2C(1,j,ni); ufld_dst[k] = 0; } for (i=1; i <= ni; i++) { k = FTN2C(i,1,ni); ufld_dst[k] = 0; } for (j=2; j<=nj; j++) { for (i=2; i <=ni; i++) { k22 = FTN2C(i, j, ni); ufld_dst[k22] = ufld[k22] - (ufld[k22-ni]+ufld[k22-1]-ufld[k22-1-ni]); } } nbits_req_container = 5; lastWordShifted = 0; spaceInLastWord = 32; *cur = 0; stuff(nbits_req_container, cur, 32, istep, lastWordShifted, spaceInLastWord); for (i=1; i <= ni; i++) { k = FTN2C(i,1,ni); stuff(ufld[k], cur, 32, nbits, lastWordShifted, spaceInLastWord); } for (j=2; j <= nj; j++) { k = FTN2C(1,j,ni); stuff(ufld[k], cur, 32, nbits, lastWordShifted, spaceInLastWord); } for (j=2; j <= nj; j+=istep) { lcl_n = ((j + istep - 1) >= nj ? nj - j : istep - 1); for (i=2; i <= ni; i+=istep) { k = FTN2C(i,j,ni); local_max = ufld_dst[k]; lcl_m = ((i + istep - 1) >= ni ? ni - i : istep - 1); for (n=0; n <= lcl_n; n++) { for (m=0; m <= lcl_m; m++) { k = FTN2C(i+m,j+n,ni); if (local_max < abs(ufld_dst[k])) local_max = abs(ufld_dst[k]); } } if (local_max == 0) { nbits_needed = 0; } else { r_lmax.f = (float)local_max; nbits_needed = (r_lmax.i >> 23) - 126; } stuff(nbits_needed, cur, 32, nbits_req_container, lastWordShifted, spaceInLastWord); switch (nbits_needed) { case 0: break; default: nbits2 = nbits_needed + 1; for (n=0; n <= lcl_n; n++) { for (m=0; m <= lcl_m; m++) { k = FTN2C(i+m,j+n,ni); token = (unsigned int) (ufld_dst[k] & ~((-1)<<nbits2)); stuff(token, cur, 32, nbits2, lastWordShifted, spaceInLastWord); } } if (remaining_space < ((cur - z)+(1+((nbits_needed+9*nbits)>>5)))) { *zlng = 0; return; } break; } } } lcl = 0; stuff(lcl, cur, 32, 16, lastWordShifted, spaceInLastWord); stuff(lcl, cur, 32, 16, lastWordShifted, spaceInLastWord); *zlng = 1 + (int) (cur-z) * 4; free(ufld_dst); } void unpackTokensParallelogram32(unsigned int ufld[], unsigned int z[], int ni, int nj, int nbits, int istep) { int *ufld_tmp; int bitPackInWord; int i, j, k, m, n; int k11, k12, k21, k22; int lcl_m, lcl_n; unsigned int nbits_needed, curword; unsigned int *cur; unsigned int nbits_req_container, token, nbits2; bitPackInWord = 32; cur = z; curword = *cur; ufld_tmp = (int *) malloc(ni*nj*sizeof(int)); extract(nbits_req_container, cur, 32, istep, curword, bitPackInWord); for (i=1; i <= ni; i++) { k = FTN2C(i,1,ni); extract(token, cur, 32, nbits, curword, bitPackInWord); ufld[k] = token; } for (j=2; j <= nj; j++) { k = FTN2C(1,j,ni); extract(token, cur, 32, nbits, curword, bitPackInWord); ufld[k] = token; } for (j=2; j <= nj; j+=istep) { lcl_n = ((j + istep - 1) >= nj ? nj - j : istep - 1); for (i=2; i <= ni; i+=istep) { lcl_m = ((i + istep - 1) >= ni ? ni - i : istep - 1); extract(nbits_needed, cur, 32, nbits_req_container, curword, bitPackInWord); switch (nbits_needed) { case 0: for (n=0; n <= lcl_n; n++) { for (m=0; m <= lcl_m; m++) { k = FTN2C(i+m,j+n,ni); ufld_tmp[k] = 0; } } break; default: nbits2 = nbits_needed + 1; for (n=0; n <= lcl_n; n++) { for (m=0; m <= lcl_m; m++) { k = FTN2C(i+m,j+n,ni); extract(token, cur, 32, nbits2, curword, bitPackInWord); ufld_tmp[k] = token; ufld_tmp[k] = (ufld_tmp[k] << (32-nbits2)) >> (32-nbits2); } } } } } for (j=2; j<=nj; j++) { for (i=2; i <=ni; i++) { k11 = FTN2C(i-1,j-1,ni); k12 = FTN2C(i-1,j ,ni); k21 = FTN2C(i, j-1,ni); k22 = FTN2C(i, j, ni); ufld[k22] = ufld_tmp[k22] + (ufld[k21]+ufld[k12]-ufld[k11]); } } free(ufld_tmp); } void packTokensParallelogram_8(unsigned int z[], unsigned int *zlng, unsigned char ufld[], int ni, int nj, int nbits, int istep) { float rlog2; int *ufld_dst; int k22, nbits2; int lcl_m, lcl_n; int local_max; unsigned int *cur; unsigned int i, j, k, m, n; unsigned int lastWordShifted, spaceInLastWord, lastSlot; unsigned int lcl, nbits_needed; unsigned int nbits_req_container, token; lastSlot = 0; cur = z; if (once == 0) { rlog2 = 1.0/log(2.0); for (i=0; i < 256; i++) { fastlog[i] = (int)(1+log(i+0.5)*rlog2); } once = 1; } ufld_dst=(int *) malloc(ni*nj*sizeof(int)); for (j=1; j <= nj; j++) { k = FTN2C(1,j,ni); ufld_dst[k] = 0; } for (i=1; i <= ni; i++) { k = FTN2C(i,1,ni); ufld_dst[k] = 0; } for (j=2; j<=nj; j++) { for (i=2; i <=ni; i++) { k22 = FTN2C(i, j, ni); ufld_dst[k22] = ufld[k22] - (ufld[k22-ni]+ufld[k22-1]-ufld[k22-1-ni]); } } nbits_req_container = 4; lastWordShifted = 0; spaceInLastWord = 32; *cur = 0; stuff(nbits_req_container, cur, 32, istep, lastWordShifted, spaceInLastWord); for (i=1; i <= ni; i++) { k = FTN2C(i,1,ni); stuff(ufld[k], cur, 32, nbits, lastWordShifted, spaceInLastWord); } for (j=2; j <= nj; j++) { k = FTN2C(1,j,ni); stuff(ufld[k], cur, 32, nbits, lastWordShifted, spaceInLastWord); } for (j=2; j <= nj; j+=istep) { lcl_n = ((j + istep - 1) >= nj ? nj - j : istep - 1); for (i=2; i <= ni; i+=istep) { k = FTN2C(i,j,ni); local_max = ufld_dst[k]; lcl_m = ((i + istep - 1) >= ni ? ni - i : istep - 1); for (n=0; n <= lcl_n; n++) { for (m=0; m <= lcl_m; m++) { k = FTN2C(i+m,j+n,ni); if (local_max < abs(ufld_dst[k])) local_max = abs(ufld_dst[k]); } } if (local_max == 0) { nbits_needed = 0; } else { if (local_max < 256) { nbits_needed = fastlog[local_max]; } else { nbits_needed = 8 + fastlog[local_max>>8]; } } stuff(nbits_needed, cur, 32, nbits_req_container, lastWordShifted, spaceInLastWord); switch (nbits_needed) { case 0: break; default: nbits2 = nbits_needed + 1; for (n=0; n <= lcl_n; n++) { for (m=0; m <= lcl_m; m++) { k = FTN2C(i+m,j+n,ni); token = (unsigned int) (ufld_dst[k] & ~((-1)<<nbits2)); stuff(token, cur, 32, nbits2, lastWordShifted, spaceInLastWord); } } break; } } } lcl = 0; stuff(lcl, cur, 32, 16, lastWordShifted, spaceInLastWord); stuff(lcl, cur, 32, 16, lastWordShifted, spaceInLastWord); *zlng = 1 + (int) (cur-z) * 4; free(ufld_dst); } void unpackTokensParallelogram_8(unsigned char ufld[], unsigned int z[], int ni, int nj, int nbits, int istep) { int *ufld_tmp; int bitPackInWord; int i, j, k, m, n; int k11, k12, k21, k22; int lcl_m, lcl_n; unsigned int nbits_needed, curword; unsigned int *cur; unsigned int nbits_req_container, token, nbits2; bitPackInWord = 32; cur = z; curword = *cur; ufld_tmp = (int *) malloc(ni*nj*sizeof(int)); extract(nbits_req_container, cur, 32, istep, curword, bitPackInWord); for (i=1; i <= ni; i++) { k = FTN2C(i,1,ni); extract(token, cur, 32, nbits, curword, bitPackInWord); ufld[k] = token; } for (j=2; j <= nj; j++) { k = FTN2C(1,j,ni); extract(token, cur, 32, nbits, curword, bitPackInWord); ufld[k] = token; } for (j=2; j <= nj; j+=istep) { lcl_n = ((j + istep - 1) >= nj ? nj - j : istep - 1); for (i=2; i <= ni; i+=istep) { lcl_m = ((i + istep - 1) >= ni ? ni - i : istep - 1); extract(nbits_needed, cur, 32, nbits_req_container, curword, bitPackInWord); switch (nbits_needed) { case 0: for (n=0; n <= lcl_n; n++) { for (m=0; m <= lcl_m; m++) { k = FTN2C(i+m,j+n,ni); ufld_tmp[k] = 0; } } break; default: nbits2 = nbits_needed + 1; for (n=0; n <= lcl_n; n++) { for (m=0; m <= lcl_m; m++) { k = FTN2C(i+m,j+n,ni); extract(token, cur, 32, nbits2, curword, bitPackInWord); ufld_tmp[k] = token; ufld_tmp[k] = (ufld_tmp[k] << (32-nbits2)) >> (32-nbits2); } } } } } for (j=2; j<=nj; j++) { for (i=2; i <=ni; i++) { k11 = FTN2C(i-1,j-1,ni); k12 = FTN2C(i-1,j ,ni); k21 = FTN2C(i, j-1,ni); k22 = FTN2C(i, j, ni); ufld[k22] = ufld_tmp[k22] + (ufld[k21]+ufld[k12]-ufld[k11]); } } free(ufld_tmp); } void pack1bitRLE(unsigned int z[], unsigned int *zlng, unsigned char ufld[], int npts) { unsigned int i, j; unsigned int lastWordShifted, spaceInLastWord, lastSlot; unsigned int *cur; unsigned int lcl, indx, last_indx; unsigned char lcl_count; int count, limite, repeat; lastSlot = 0; cur = z; lastWordShifted = 0; spaceInLastWord = 32; *cur = 0; last_indx=0; indx=1; while (indx <= npts) { while (ufld[indx] == ufld[last_indx] && indx < npts) { indx++; } count = indx - last_indx; if (count < 8) { stuff(SEQUENCE, cur, 32, 1, lastWordShifted, spaceInLastWord); limite = (last_indx + 7) > npts ? (npts - last_indx) : 7; for (i=0; i < limite; i++) { stuff(ufld[last_indx+i], cur, 32, 1, lastWordShifted, spaceInLastWord); } last_indx +=7; indx = last_indx + 1; } else { i = 0; repeat = 0; while (i < count) { lcl_count = (count-i) >= 63 ? 62 : (count - i); if (lcl_count < 8) { stuff(SEQUENCE, cur, 32, 1, lastWordShifted, spaceInLastWord); limite = (last_indx + 7) > npts ? (npts - last_indx) : 7; for (j=0; j < limite; j++) { stuff(ufld[last_indx+j], cur, 32, 1, lastWordShifted, spaceInLastWord); } last_indx +=7; indx = last_indx + 1; } else { if (lcl_count == 62) { if ((count - i) > 256 && (repeat == 1)) { lcl_count = 0xFF; stuff(lcl_count, cur, 32, 8,lastWordShifted, spaceInLastWord); last_indx+=lcl_count; indx = last_indx + 1; } else { stuff(COUNT, cur, 32, 1, lastWordShifted, spaceInLastWord); stuff(ufld[last_indx], cur, 32, 1,lastWordShifted, spaceInLastWord); stuff(lcl_count, cur, 32, 6,lastWordShifted, spaceInLastWord); last_indx+=lcl_count; indx = last_indx + 1; repeat = 1; } } else { stuff(COUNT, cur, 32, 1, lastWordShifted, spaceInLastWord); stuff(ufld[last_indx], cur, 32, 1,lastWordShifted, spaceInLastWord); stuff(lcl_count, cur, 32, 6,lastWordShifted, spaceInLastWord); last_indx+=lcl_count; indx = last_indx + 1; } } i += lcl_count; } } } lcl = 0; stuff(lcl, cur, 32, 16, lastWordShifted, spaceInLastWord); stuff(lcl, cur, 32, 16, lastWordShifted, spaceInLastWord); *zlng = 1 + (int) (cur-z) * 4; } void unpack1bitRLE(unsigned char ufld[], unsigned int z[], unsigned int *zlng, int npts) { unsigned int i, j; unsigned int *cur, seq_type, val, last_val; int count, limite; int bitPackInWord; unsigned int curword; unsigned int token; bitPackInWord = 32; cur = z; curword = *cur; last_val = 0xFFFFFFFF; i = 0; while (i < npts) { extract(seq_type, cur, 32, 1, curword, bitPackInWord); switch(seq_type) { case SEQUENCE: limite = (i + 7) > npts ? (npts - i) : 7; for (j=0; j < limite; j++) { extract(token, cur, 32, 1, curword, bitPackInWord); ufld[i+j] = (unsigned char) token; } i+=limite; break; case COUNT: extract(val, cur, 32, 1, curword, bitPackInWord); extract(count, cur, 32, 6, curword, bitPackInWord); switch (count) { case 63: for (j=0; j < 255; j++) { ufld[i+j] = (unsigned char) last_val; } i+=255; break; default: for (j=0; j < count; j++) { ufld[i+j] = (unsigned char) val; } i+=count; last_val = val; break; } break; } } } int compact_mask_char(unsigned int *dest, unsigned char *src, int npts) { int i,entier, fraction,npts32; npts32 = 1 + (npts >> 5); for (i=0; i < npts32; i++) { dest[i] = 0; } for (i=0; i < npts; i++) { entier = i >> 5; fraction = i - (entier << 5); dest[entier] |= (src[i] << fraction); } return 0; } int uncompact_mask_char(int *dest, unsigned int *src, int npts) { int i,entier, fraction; for (i=0; i < npts; i++) { entier = i >> 5; fraction = i - (entier << 5); dest[i] = (src[entier] & (1 << fraction)) >> fraction; } return 0; } void pack_stream_nbits_32(unsigned int z[], unsigned int *zlng, unsigned int ufld[], int npts, int nbits) { unsigned int i; unsigned int lastWordShifted, spaceInLastWord, lastSlot; unsigned int *cur; unsigned int lcl; lastSlot = 0; cur = z; lastWordShifted = 0; spaceInLastWord = 32; *cur = 0; for (i=0; i < npts; i++) { stuff(ufld[i], cur, 32, nbits, lastWordShifted, spaceInLastWord); } lcl = 0; stuff(lcl, cur, 32, 16, lastWordShifted, spaceInLastWord); stuff(lcl, cur, 32, 16, lastWordShifted, spaceInLastWord); *zlng = 1 + (int) (cur-z) * 4; } void unpack_stream_nbits_32(unsigned int ufld[], unsigned int z[], int npts, int nbits) { unsigned int i; unsigned int lastSlot; unsigned int *cur; int bitPackInWord; unsigned int curword; lastSlot = 0; cur = z; bitPackInWord = 32; curword = *cur; for (i=0; i < npts; i++) { extract(ufld[i], cur, 32, nbits, curword, bitPackInWord); } } void pack_stream_nbits_16(unsigned int z[], unsigned int *zlng, unsigned short ufld[], int npts, int nbits) { unsigned int i; unsigned int lastWordShifted, spaceInLastWord, lastSlot; unsigned int *cur; unsigned int lcl; lastSlot = 0; cur = z; lastWordShifted = 0; spaceInLastWord = 32; *cur = 0; for (i=0; i < npts; i++) { stuff(ufld[i], cur, 32, nbits, lastWordShifted, spaceInLastWord); } lcl = 0; stuff(lcl, cur, 32, 16, lastWordShifted, spaceInLastWord); stuff(lcl, cur, 32, 16, lastWordShifted, spaceInLastWord); *zlng = 1 + (int) (cur-z) * 4; } void unpack_stream_nbits_16(unsigned short ufld[], unsigned int z[], int npts, int nbits) { unsigned int i; unsigned int lastSlot; unsigned int *cur; int bitPackInWord; unsigned int curword; lastSlot = 0; cur = z; bitPackInWord = 32; curword = *cur; for (i=0; i < npts; i++) { extract(ufld[i], cur, 32, nbits, curword, bitPackInWord); } } void pack_stream_nbits_8(unsigned int z[], unsigned int *zlng, unsigned char ufld[], int npts, int nbits) { unsigned int i; unsigned int lastWordShifted, spaceInLastWord, lastSlot; unsigned int *cur; unsigned int lcl; lastSlot = 0; cur = z; lastWordShifted = 0; spaceInLastWord = 32; *cur = 0; for (i=0; i < npts; i++) { stuff(ufld[i], cur, 32, nbits, lastWordShifted, spaceInLastWord); } lcl = 0; stuff(lcl, cur, 32, 16, lastWordShifted, spaceInLastWord); stuff(lcl, cur, 32, 16, lastWordShifted, spaceInLastWord); *zlng = 1 + (int) (cur-z) * 4; } void unpack_stream_nbits_8(unsigned char ufld[], unsigned int z[], int npts, int nbits) { unsigned int i; unsigned int lastSlot; unsigned int *cur; int bitPackInWord; unsigned int curword; lastSlot = 0; cur = z; bitPackInWord = 32; curword = *cur; for (i=0; i < npts; i++) { extract(ufld[i], cur, 32, nbits, curword, bitPackInWord); } }
lgpl-2.1
QuickServerLab/QuickCached
src/main/com/quickserverlab/quickcached/TextCommandProcessor.java
15156
package com.quickserverlab.quickcached; import java.io.IOException; import java.net.SocketTimeoutException; import java.util.logging.Level; import java.util.logging.Logger; import com.quickserverlab.quickcached.cache.CacheException; import com.quickserverlab.quickcached.cache.CacheInterface; import org.quickserver.net.server.ClientHandler; import java.util.Iterator; import java.util.Map; import java.util.Set; /** * * @author Akshathkumar Shetty */ public class TextCommandProcessor { private static final Logger logger = Logger.getLogger(TextCommandProcessor.class.getName()); private static String versionOutput = null; static { versionOutput = "VERSION " + QuickCached.version + "\r\n"; } private CacheInterface cache; public void setCache(CacheInterface cache) { this.cache = cache; } public void handleTextCommand(ClientHandler handler, String command) throws SocketTimeoutException, IOException, CacheException { if (QuickCached.DEBUG) { logger.log(Level.FINE, "command: {0}", command); } if (command.startsWith("get ") || command.startsWith("gets ")) { handleGetCommands(handler, command); } else if (command.equals("version")) { sendResponse(handler, versionOutput); } else if (command.startsWith("set ") || command.startsWith("add ") || command.startsWith("replace ") || command.startsWith("append ") || command.startsWith("prepend ") || command.startsWith("cas ")) { handleStorageCommands(handler, command); Data data = (Data) handler.getClientData(); if (data.isAllDataIn()) { processStorageCommands(handler); return; } else { return; } } else if (command.startsWith("delete ")) { handleDeleteCommands(handler, command); } else if (command.startsWith("flush_all")) { handleFlushAll(handler, command); } else if (command.equals("stats")) { Map stats = CommandHandler.getStats(handler.getServer()); Set keySet = stats.keySet(); Iterator iterator = keySet.iterator(); String key = null; String value = null; while (iterator.hasNext()) { key = (String) iterator.next(); value = (String) stats.get(key); sendResponse(handler, "STAT " + key + " " + value + "\r\n"); } sendResponse(handler, "END\r\n"); } else if (command.startsWith("stats ")) { //TODO sendResponse(handler, "ERROR\r\n"); } else if (command.equals("quit")) { handler.closeConnection(); } else if (command.startsWith("incr ") || command.startsWith("decr ")) { handleIncrDecrCommands(handler, command); } else if (command.startsWith("touch ")) { handleTouchCommands(handler, command); } else { logger.log(Level.WARNING, "unknown command! {0}", command); sendResponse(handler, "ERROR\r\n"); } } private void handleFlushAll(ClientHandler handler, String command) throws SocketTimeoutException, IOException, CacheException { /* flush_all [exptime] [noreply]\r\n */ String cmdData[] = command.split(" "); String cmd = cmdData[0]; String exptime = null; if(QuickCached.DEBUG==false) { logger.log(Level.FINE, "cmd: {0}", new Object[]{cmd}); } boolean noreplay = false; if(cmdData[cmdData.length-1].equals("noreply")) { noreplay = true; } if (noreplay==false && cmdData.length >= 2) { exptime = cmdData[1]; } else if (noreplay==true && cmdData.length >= 3) { exptime = cmdData[1]; } if (exptime == null) { cache.flush(); } else { final int sleeptime = Integer.parseInt(exptime); Thread t = new Thread() { public void run() { try { sleep(1000 * sleeptime); } catch (InterruptedException ex) { logger.log(Level.WARNING, "Error: "+ex, ex); } try { cache.flush(); } catch (CacheException ex) { logger.log(Level.SEVERE, "Error: "+ex, ex); } } }; t.start(); } if (noreplay) { return; } sendResponse(handler, "OK\r\n"); } private void handleDeleteCommands(ClientHandler handler, String command) throws SocketTimeoutException, IOException, CacheException { /* delete <key> [noreply]\r\n */ String cmdData[] = command.split(" "); String cmd = cmdData[0]; String key = cmdData[1]; if(QuickCached.DEBUG==false) { logger.log(Level.FINE, "cmd: {0}, key: {1}", new Object[]{cmd, key}); } boolean noreplay = false; if (cmdData.length == 3) { if ("noreply".equals(cmdData[2])) { noreplay = true; } } boolean flag = cache.delete(key); if (noreplay) { return; } if (flag == true) { sendResponse(handler, "DELETED\r\n"); } else { sendResponse(handler, "NOT_FOUND\r\n"); } } private void handleTouchCommands(ClientHandler handler, String command) throws SocketTimeoutException, IOException, CacheException { /* touch <key> <exptime> [noreply]\r\n */ String cmdData[] = command.split(" "); String cmd = cmdData[0]; String key = cmdData[1]; int exptime = Integer.parseInt(cmdData[2]); boolean noreplay = false; if (cmdData.length >= 4) { if ("noreply".equals(cmdData[3])) { noreplay = true; } } if(QuickCached.DEBUG==false) { logger.log(Level.FINE, "cmd: {0}, key: {1}", new Object[]{cmd, key}); } boolean flag = cache.touch(key, exptime); if(noreplay) return; if(flag==false) { sendResponse(handler, "NOT_FOUND\r\n"); } else { sendResponse(handler, "TOUCHED\r\n"); } } private void handleGetCommands(ClientHandler handler, String command) throws SocketTimeoutException, IOException, CacheException { /* get <key>*\r\n gets <key>*\r\n */ String cmdData[] = command.split(" "); String cmd = cmdData[0]; String key = null; for (int i = 1; i < cmdData.length; i++) { key = cmdData[i]; if(QuickCached.DEBUG==false) { logger.log(Level.FINE, "cmd: {0}, key: {1}", new Object[]{cmd, key}); } DataCarrier dc = (DataCarrier) cache.get(key); if (dc != null) { StringBuilder sb = new StringBuilder(); sb.append("VALUE "); sb.append(key); sb.append(" "); sb.append(dc.getFlags()); sb.append(" "); sb.append(dc.getData().length); sb.append(" "); sb.append(dc.getCas()); sb.append("\r\n"); sendResponse(handler, sb.toString()); sendResponse(handler, dc.getData()); sendResponse(handler, "\r\n"); } } sendResponse(handler, "END\r\n"); /* VALUE <key> <flags> <bytes> [<cas unique>]\r\n <data block>\r\n */ } private void handleIncrDecrCommands(ClientHandler handler, String command) throws SocketTimeoutException, IOException, CacheException { /* incr <key> <value> [noreply]\r\n decr <key> <value> [noreply]\r\n */ String cmdData[] = command.split(" "); if (cmdData.length < 3) { sendResponse(handler, "CLIENT_ERROR Bad number of args passed\r\n"); if (cmdData[0].equals("incr")) { CommandHandler.incrMisses++; } else if (cmdData[0].equals("decr")) { CommandHandler.decrMisses++; } return; } String cmd = cmdData[0]; String key = cmdData[1]; String _value = cmdData[2]; long value = 0; try { value = Long.parseLong(_value); } catch (Exception e) { sendResponse(handler, "CLIENT_ERROR parse of client value failed\r\n"); if (cmd.equals("incr")) { CommandHandler.incrMisses++; } else if (cmd.equals("decr")) { CommandHandler.decrMisses++; } return; } if(QuickCached.DEBUG==false) { logger.log(Level.FINE, "cmd: {0}, key: {1}", new Object[]{cmd, key}); } boolean noreplay = false; if (cmdData.length >= 4) { if ("noreply".equals(cmdData[3])) { noreplay = true; } } DataCarrier dc = (DataCarrier) cache.get(key, false); if (dc == null) { if (noreplay == false) { sendResponse(handler, "NOT_FOUND\r\n"); } if (cmd.equals("incr")) { CommandHandler.incrMisses++; } else if (cmd.equals("decr")) { CommandHandler.decrMisses++; } return; } StringBuilder sb = new StringBuilder(); dc.writeLock.lock(); try { long oldvalue = Long.parseLong(new String(dc.getData(), HexUtil.getCharset())); if (cmd.equals("incr")) { value = oldvalue + value; } else if (cmd.equals("decr")) { value = oldvalue - value; if (value < 0) { value = 0; } } else { throw new IllegalArgumentException("Unknown command "+cmd); } sb.append(value); dc.setData(sb.toString().getBytes(HexUtil.getCharset())); cache.update(key, dc, dc.getSize()); } catch(Exception e) { if(noreplay == false) { sendResponse(handler, "CLIENT_ERROR parse of server value failed\r\n"); } if (cmd.equals("incr")) { CommandHandler.incrMisses++; } else if (cmd.equals("decr")) { CommandHandler.decrMisses++; } return; } finally { dc.writeLock.unlock(); } if (cmd.equals("incr")) { CommandHandler.incrHits++; } else if (cmd.equals("decr")) { CommandHandler.decrHits++; } if (noreplay) { return; } sb.append("\r\n"); sendResponse(handler, sb.toString()); } private void handleStorageCommands(ClientHandler handler, String command) throws SocketTimeoutException, IOException { Data data = (Data) handler.getClientData(); /* <command name> <key> <flags> <exptime> <bytes> [noreply]\r\n cas <key> <flags> <exptime> <bytes> <cas unique> [noreply]\r\n */ String cmdData[] = command.split(" "); String cmd = cmdData[0]; String key = cmdData[1]; String flags = cmdData[2]; int exptime = Integer.parseInt(cmdData[3]); long bytes = Integer.parseInt(cmdData[4]); String casunique = null; boolean noreplay = false; if (cmdData.length >= 6) { if ("noreply".equals(cmdData[5])) { noreplay = true; } else { casunique = cmdData[5]; } if (cmdData.length >= 7) { if ("noreply".equals(cmdData[6])) { noreplay = true; } } } if(key.length()>Data.getMaxSizeAllowedForKey()) { throw new IllegalArgumentException( "key passed to big to store "+key); } if(Data.getMaxSizeAllowedForValue()>0) { if(bytes > Data.getMaxSizeAllowedForValue()) { throw new IllegalArgumentException( "value passed to big to store "+bytes+" for key "+key); } } data.setCmd(cmd); data.setKey(key); data.setFlags(flags); data.setExptime(exptime); data.setDataRequiredLength(bytes); data.setCasUnique(casunique); data.setNoreplay(noreplay); } public void processStorageCommands(ClientHandler handler) throws SocketTimeoutException, IOException, CacheException { Data data = (Data) handler.getClientData(); if(QuickCached.DEBUG==false) { logger.log(Level.FINE, "cmd: {0}, key: {1}", new Object[]{data.getCmd(), data.getKey()}); } byte dataToStore[] = data.getDataByte(); DataCarrier dc = new DataCarrier(dataToStore); dc.setFlags(data.getFlags()); if (data.getCmd().equals("set")) { DataCarrier olddata = (DataCarrier) cache.get(data.getKey(), false); if(olddata==null) { cache.set(data.getKey(), dc, dc.getSize(), data.getExptime()); } else { olddata.writeLock.lock(); try { olddata.setData(dc.getData()); olddata.setFlags(dc.getFlags()); cache.update(data.getKey(), olddata, olddata.getSize(), data.getExptime()); } finally { olddata.writeLock.unlock(); } } if (data.isNoreplay() == false) { sendResponse(handler, "STORED\r\n"); } } else if (data.getCmd().equals("add")) { Object olddata = cache.get(data.getKey(), false); if (olddata == null) { cache.set(data.getKey(), dc, dc.getSize(), data.getExptime()); if (data.isNoreplay() == false) { sendResponse(handler, "STORED\r\n"); } } else { if (data.isNoreplay() == false) { sendResponse(handler, "NOT_STORED\r\n"); } } } else if (data.getCmd().equals("replace")) { DataCarrier olddata = (DataCarrier) cache.get(data.getKey(), false); if (olddata != null) { olddata.writeLock.lock(); try { olddata.setData(dc.getData()); cache.update(data.getKey(), olddata, olddata.getSize()); } finally { olddata.writeLock.unlock(); } dc.setData(null); dc = null; if (data.isNoreplay() == false) { if (data.isNoreplay() == false) { sendResponse(handler, "STORED\r\n"); } } } else { if (data.isNoreplay() == false) { sendResponse(handler, "NOT_STORED\r\n"); } } } else if (data.getCmd().equals("append")) { DataCarrier olddata = (DataCarrier) cache.get(data.getKey(), false); if (olddata != null) { olddata.writeLock.lock(); try { olddata.append(dc.getData()); cache.update(data.getKey(), olddata, olddata.getSize()); } finally { olddata.writeLock.unlock(); } dc.setData(null); dc = null; if (data.isNoreplay() == false) { if (data.isNoreplay() == false) { sendResponse(handler, "STORED\r\n"); } } } else { if (data.isNoreplay() == false) { sendResponse(handler, "NOT_STORED\r\n"); } } } else if (data.getCmd().equals("prepend")) { DataCarrier olddata = (DataCarrier) cache.get(data.getKey(), false); if (olddata != null) { olddata.writeLock.lock(); try { olddata.prepend(dc.getData()); cache.update(data.getKey(), olddata, olddata.getSize()); } finally { olddata.writeLock.unlock(); } dc.setData(null); dc = null; if (data.isNoreplay() == false) { if (data.isNoreplay() == false) { sendResponse(handler, "STORED\r\n"); } } } else { if (data.isNoreplay() == false) { sendResponse(handler, "NOT_STORED\r\n"); } } } else if (data.getCmd().equals("cas")) { String reply = null; DataCarrier olddata = (DataCarrier) cache.get(data.getKey(), false); if(olddata != null) { olddata.writeLock.lock(); try { int oldcas = olddata.getCas(); int passedcas = Integer.parseInt(data.getCasUnique()); if (oldcas == passedcas) { olddata.setData(dc.getData()); cache.update(data.getKey(), olddata, olddata.getSize()); dc.setData(null); dc = null; CommandHandler.casHits++; if (data.isNoreplay() == false) { reply = "STORED\r\n"; } } else { CommandHandler.casBadval++; if (data.isNoreplay() == false) { reply = "EXISTS\r\n"; } } } finally { olddata.writeLock.unlock(); } } else { CommandHandler.casMisses++; if (data.isNoreplay() == false) { reply = "NOT_FOUND\r\n"; } } if(reply!=null) { sendResponse(handler, reply); } } data.clear(); } public void sendResponse(ClientHandler handler, String data) throws SocketTimeoutException, IOException { sendResponse(handler, data.getBytes(HexUtil.getCharset())); } public void sendResponse(ClientHandler handler, byte data[]) throws SocketTimeoutException, IOException { if(handler.getCommunicationLogging() || QuickCached.DEBUG) { logger.log(Level.FINE, "S: {0}", new String(data, HexUtil.getCharset())); } else { logger.log(Level.FINE, "S: {0} bytes", data.length); } handler.sendClientBinary(data); } }
lgpl-2.1
sunblithe/qt-everywhere-opensource-src-4.7.1
examples/painting/svgviewer/mainwindow.cpp
6065
/**************************************************************************** ** ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor ** the names of its contributors may be used to endorse or promote ** products derived from this software without specific prior written ** permission. ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "mainwindow.h" #include <QtGui> #include "svgview.h" MainWindow::MainWindow() : QMainWindow() , m_view(new SvgView) { QMenu *fileMenu = new QMenu(tr("&File"), this); QAction *openAction = fileMenu->addAction(tr("&Open...")); openAction->setShortcut(QKeySequence(tr("Ctrl+O"))); QAction *quitAction = fileMenu->addAction(tr("E&xit")); quitAction->setShortcuts(QKeySequence::Quit); menuBar()->addMenu(fileMenu); QMenu *viewMenu = new QMenu(tr("&View"), this); m_backgroundAction = viewMenu->addAction(tr("&Background")); m_backgroundAction->setEnabled(false); m_backgroundAction->setCheckable(true); m_backgroundAction->setChecked(false); connect(m_backgroundAction, SIGNAL(toggled(bool)), m_view, SLOT(setViewBackground(bool))); m_outlineAction = viewMenu->addAction(tr("&Outline")); m_outlineAction->setEnabled(false); m_outlineAction->setCheckable(true); m_outlineAction->setChecked(true); connect(m_outlineAction, SIGNAL(toggled(bool)), m_view, SLOT(setViewOutline(bool))); menuBar()->addMenu(viewMenu); QMenu *rendererMenu = new QMenu(tr("&Renderer"), this); m_nativeAction = rendererMenu->addAction(tr("&Native")); m_nativeAction->setCheckable(true); m_nativeAction->setChecked(true); #ifndef QT_NO_OPENGL m_glAction = rendererMenu->addAction(tr("&OpenGL")); m_glAction->setCheckable(true); #endif m_imageAction = rendererMenu->addAction(tr("&Image")); m_imageAction->setCheckable(true); #ifndef QT_NO_OPENGL rendererMenu->addSeparator(); m_highQualityAntialiasingAction = rendererMenu->addAction(tr("&High Quality Antialiasing")); m_highQualityAntialiasingAction->setEnabled(false); m_highQualityAntialiasingAction->setCheckable(true); m_highQualityAntialiasingAction->setChecked(false); connect(m_highQualityAntialiasingAction, SIGNAL(toggled(bool)), m_view, SLOT(setHighQualityAntialiasing(bool))); #endif QActionGroup *rendererGroup = new QActionGroup(this); rendererGroup->addAction(m_nativeAction); #ifndef QT_NO_OPENGL rendererGroup->addAction(m_glAction); #endif rendererGroup->addAction(m_imageAction); menuBar()->addMenu(rendererMenu); connect(openAction, SIGNAL(triggered()), this, SLOT(openFile())); connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); connect(rendererGroup, SIGNAL(triggered(QAction*)), this, SLOT(setRenderer(QAction*))); setCentralWidget(m_view); setWindowTitle(tr("SVG Viewer")); } void MainWindow::openFile(const QString &path) { QString fileName; if (path.isNull()) fileName = QFileDialog::getOpenFileName(this, tr("Open SVG File"), m_currentPath, "SVG files (*.svg *.svgz *.svg.gz)"); else fileName = path; if (!fileName.isEmpty()) { QFile file(fileName); if (!file.exists()) { QMessageBox::critical(this, tr("Open SVG File"), QString("Could not open file '%1'.").arg(fileName)); m_outlineAction->setEnabled(false); m_backgroundAction->setEnabled(false); return; } m_view->openFile(file); if (!fileName.startsWith(":/")) { m_currentPath = fileName; setWindowTitle(tr("%1 - SVGViewer").arg(m_currentPath)); } m_outlineAction->setEnabled(true); m_backgroundAction->setEnabled(true); resize(m_view->sizeHint() + QSize(80, 80 + menuBar()->height())); } } void MainWindow::setRenderer(QAction *action) { #ifndef QT_NO_OPENGL m_highQualityAntialiasingAction->setEnabled(false); #endif if (action == m_nativeAction) m_view->setRenderer(SvgView::Native); #ifndef QT_NO_OPENGL else if (action == m_glAction) { m_highQualityAntialiasingAction->setEnabled(true); m_view->setRenderer(SvgView::OpenGL); } #endif else if (action == m_imageAction) { m_view->setRenderer(SvgView::Image); } }
lgpl-2.1
gorinje/gpac-svn
modules/x11_out/x11_out.h
3426
/* * GPAC Multimedia Framework * * Authors: Jean Le Feuvre * Copyright (c) Telecom ParisTech 2005-2012 * All rights reserved * * This file is part of GPAC / X11 video output module * * GPAC is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * GPAC is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #ifndef _X11_OUT_H #define _X11_OUT_H #ifdef __cplusplus extern "C" { #endif #include <gpac/modules/video_out.h> #include <gpac/thread.h> #include <gpac/list.h> #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/keysym.h> #if !defined(GPAC_DISABLE_3D) && !defined(GPAC_USE_OGL_ES) && !defined(GPAC_USE_TINYGL) #define GPAC_HAS_OPENGL #endif #ifdef GPAC_HAS_OPENGL #include <GL/glx.h> #endif #ifdef GPAC_HAS_X11_SHM #include <X11/extensions/XShm.h> #include <sys/ipc.h> #include <sys/shm.h> #endif #ifdef GPAC_HAS_X11_XV #include <X11/extensions/Xv.h> #include <X11/extensions/Xvlib.h> #endif #if defined(ENABLE_JOYSTICK) || defined(ENABLE_JOYSTICK_NO_CURSOR) #include <linux/joystick.h> #include <unistd.h> #include <fcntl.h> #endif #define X11VID() XWindow *xWindow = (XWindow *)vout->opaque; #define RGB555(r,g,b) (((r&248)<<7) + ((g&248)<<2) + (b>>3)) #define RGB565(r,g,b) (((r&248)<<8) + ((g&252)<<3) + (b>>3)) typedef struct { Window par_wnd; //main window handler passed to module, NULL otherwise Bool setup_done, no_select_input; //setup is done Display *display; //required by all X11 method, provide by XOpenDisplay, Mozilla wnd ... Window wnd; //window handler created by module Window full_wnd; //full screen Screen *screenptr; //X11 stuff int screennum; //... Visual *visual; //... GC the_gc; //graphics context XImage *surface; //main drawing image: software mode Pixmap pixmap; u32 pwidth, pheight; u32 init_flags; Atom WM_DELETE_WINDOW; //window deletion Bool use_shared_memory; // /*screensaver state*/ int ss_t, ss_b, ss_i, ss_e; #ifdef GPAC_HAS_X11_SHM XShmSegmentInfo *shmseginfo; #endif /*YUV overlay*/ #ifdef GPAC_HAS_X11_XV int xvport; u32 xv_pf_format; XvImage *overlay; #endif Bool is_init, fullscreen, has_focus; /*backbuffer size before entering fullscreen mode (used for restore) */ u32 store_width, store_height; u32 w_width, w_height; u32 depth, bpp, pixel_format; u32 output_3d_mode; #ifdef GPAC_HAS_OPENGL XVisualInfo *glx_visualinfo; GLXContext glx_context; Pixmap gl_pixmap; GLXPixmap gl_offscreen; Window gl_wnd; u32 offscreen_type; #endif #if defined(ENABLE_JOYSTICK) || defined(ENABLE_JOYSTICK_NO_CURSOR) /*joystick device file descriptor*/ s32 prev_x, prev_y, fd; #endif } XWindow; void StretchBits (void *dst, u32 dst_bpp, u32 dst_w, u32 dst_h, u32 dst_pitch, void *src, u32 src_bpp, u32 src_w, u32 src_h, u32 src_pitch, Bool FlipIt); #endif /* _X11_OUT_H */
lgpl-2.1
zakandrewking/cobrapy
cobra/util/solver.py
15435
# -*- coding: utf-8 -*- """Additional helper functions for the optlang solvers. All functions integrate well with the context manager, meaning that all operations defined here are automatically reverted when used in a `with model:` block. The functions defined here together with the existing model functions should allow you to implement custom flux analysis methods with ease. """ from __future__ import absolute_import import re from functools import partial from collections import namedtuple from types import ModuleType from warnings import warn import optlang from optlang.symbolics import Basic, Zero from cobra.exceptions import OptimizationError, OPTLANG_TO_EXCEPTIONS_DICT from cobra.util.context import get_context class SolverNotFound(Exception): """A simple Exception when a solver can not be found.""" pass # Define all the solvers that are found in optlang. solvers = {match.split("_")[0]: getattr(optlang, match) for match in dir(optlang) if "_interface" in match} # Defines all the QP solvers implemented in optlang. qp_solvers = ["cplex"] # QP in gurobi not implemented yet def linear_reaction_coefficients(model, reactions=None): """Coefficient for the reactions in a linear objective. Parameters ---------- model : cobra model the model object that defined the objective reactions : list an optional list for the reactions to get the coefficients for. All reactions if left missing. Returns ------- dict A dictionary where the key is the reaction object and the value is the corresponding coefficient. Empty dictionary if there are no linear terms in the objective. """ linear_coefficients = {} reactions = model.reactions if not reactions else reactions try: objective_expression = model.solver.objective.expression coefficients = objective_expression.as_coefficients_dict() except AttributeError: return linear_coefficients for rxn in reactions: forward_coefficient = coefficients.get(rxn.forward_variable, 0) reverse_coefficient = coefficients.get(rxn.reverse_variable, 0) if forward_coefficient != 0: if forward_coefficient == -reverse_coefficient: linear_coefficients[rxn] = float(forward_coefficient) return linear_coefficients def _valid_atoms(model, expression): """Check whether a sympy expression references the correct variables. Parameters ---------- model : cobra.Model The model in which to check for variables. expression : sympy.Basic A sympy expression. Returns ------- boolean True if all referenced variables are contained in model, False otherwise. """ atoms = expression.atoms(optlang.interface.Variable) return all(a.problem is model.solver for a in atoms) def set_objective(model, value, additive=False): """Set the model objective. Parameters ---------- model : cobra model The model to set the objective for value : model.problem.Objective, e.g. optlang.glpk_interface.Objective, sympy.Basic or dict If the model objective is linear, the value can be a new Objective object or a dictionary with linear coefficients where each key is a reaction and the element the new coefficient (float). If the objective is not linear and `additive` is true, only values of class Objective. additive : bool If true, add the terms to the current objective, otherwise start with an empty objective. """ interface = model.problem reverse_value = model.solver.objective.expression reverse_value = interface.Objective( reverse_value, direction=model.solver.objective.direction, sloppy=True) if isinstance(value, dict): if not model.objective.is_Linear: raise ValueError('can only update non-linear objectives ' 'additively using object of class ' 'model.problem.Objective, not %s' % type(value)) if not additive: model.solver.objective = interface.Objective( Zero, direction=model.solver.objective.direction) for reaction, coef in value.items(): model.solver.objective.set_linear_coefficients( {reaction.forward_variable: coef, reaction.reverse_variable: -coef}) elif isinstance(value, (Basic, optlang.interface.Objective)): if isinstance(value, Basic): value = interface.Objective( value, direction=model.solver.objective.direction, sloppy=False) # Check whether expression only uses variables from current model # clone the objective if not, faster than cloning without checking if not _valid_atoms(model, value.expression): value = interface.Objective.clone(value, model=model.solver) if not additive: model.solver.objective = value else: model.solver.objective += value.expression else: raise TypeError( '%r is not a valid objective for %r.' % (value, model.solver)) context = get_context(model) if context: def reset(): model.solver.objective = reverse_value model.solver.objective.direction = reverse_value.direction context(reset) def interface_to_str(interface): """Give a string representation for an optlang interface. Parameters ---------- interface : string, ModuleType Full name of the interface in optlang or cobra representation. For instance 'optlang.glpk_interface' or 'optlang-glpk'. Returns ------- string The name of the interface as a string """ if isinstance(interface, ModuleType): interface = interface.__name__ return re.sub(r"optlang.|.interface", "", interface) def get_solver_name(mip=False, qp=False): """Select a solver for a given optimization problem. Parameters ---------- mip : bool Does the solver require mixed integer linear programming capabilities? qp : bool Does the solver require quadratic programming capabilities? Returns ------- string The name of feasible solver. Raises ------ SolverNotFound If no suitable solver could be found. """ if len(solvers) == 0: raise SolverNotFound("no solvers installed") # Those lists need to be updated as optlang implements more solvers mip_order = ["gurobi", "cplex", "glpk"] lp_order = ["glpk", "cplex", "gurobi"] qp_order = ["cplex"] if mip is False and qp is False: for solver_name in lp_order: if solver_name in solvers: return solver_name # none of them are in the list order - so return the first one return list(solvers)[0] elif qp: # mip does not yet matter for this determination for solver_name in qp_order: if solver_name in solvers: return solver_name raise SolverNotFound("no qp-capable solver found") else: for solver_name in mip_order: if solver_name in solvers: return solver_name raise SolverNotFound("no mip-capable solver found") def choose_solver(model, solver=None, qp=False): """Choose a solver given a solver name and model. This will choose a solver compatible with the model and required capabilities. Also respects model.solver where it can. Parameters ---------- model : a cobra model The model for which to choose the solver. solver : str, optional The name of the solver to be used. Optlang solvers should be prefixed by "optlang-", for instance "optlang-glpk". qp : boolean, optional Whether the solver needs Quadratic Programming capabilities. Returns ------- legacy : boolean Whether the returned solver is a legacy (old cobra solvers) version or an optlang solver (legacy = False). solver : a cobra or optlang solver interface Returns a valid solver for the problem. May be a cobra solver or an optlang interface. Raises ------ SolverNotFound If no suitable solver could be found. """ legacy = False if solver is None: solver = model.problem elif "optlang-" in solver: solver = interface_to_str(solver) solver = solvers[solver] else: legacy = True solver = legacy_solvers.solver_dict[solver] # Check for QP, raise error if no QP solver found # optlang only since old interface interprets None differently if qp and interface_to_str(solver) not in qp_solvers: solver = solvers[get_solver_name(qp=True)] return legacy, solver def add_cons_vars_to_problem(model, what, **kwargs): """Add variables and constraints to a Model's solver object. Useful for variables and constraints that can not be expressed with reactions and lower/upper bounds. Will integrate with the Model's context manager in order to revert changes upon leaving the context. Parameters ---------- model : a cobra model The model to which to add the variables and constraints. what : list or tuple of optlang variables or constraints. The variables or constraints to add to the model. Must be of class `model.problem.Variable` or `model.problem.Constraint`. **kwargs : keyword arguments passed to solver.add() """ context = get_context(model) model.solver.add(what, **kwargs) if context: context(partial(model.solver.remove, what)) def remove_cons_vars_from_problem(model, what): """Remove variables and constraints from a Model's solver object. Useful to temporarily remove variables and constraints from a Models's solver object. Parameters ---------- model : a cobra model The model from which to remove the variables and constraints. what : list or tuple of optlang variables or constraints. The variables or constraints to remove from the model. Must be of class `model.problem.Variable` or `model.problem.Constraint`. """ context = get_context(model) model.solver.remove(what) if context: context(partial(model.solver.add, what)) def add_absolute_expression(model, expression, name="abs_var", ub=None, difference=0, add=True): """Add the absolute value of an expression to the model. Also defines a variable for the absolute value that can be used in other objectives or constraints. Parameters ---------- model : a cobra model The model to which to add the absolute expression. expression : A sympy expression Must be a valid expression within the Model's solver object. The absolute value is applied automatically on the expression. name : string The name of the newly created variable. ub : positive float The upper bound for the variable. difference : positive float The difference between the expression and the variable. add : bool Whether to add the variable to the model at once. Returns ------- namedtuple A named tuple with variable and two constraints (upper_constraint, lower_constraint) describing the new variable and the constraints that assign the absolute value of the expression to it. """ Components = namedtuple('Components', ['variable', 'upper_constraint', 'lower_constraint']) variable = model.problem.Variable(name, lb=0, ub=ub) # The following constraints enforce variable > expression and # variable > -expression upper_constraint = model.problem.Constraint(expression - variable, ub=difference, name="abs_pos_" + name), lower_constraint = model.problem.Constraint(expression + variable, lb=difference, name="abs_neg_" + name) to_add = Components(variable, upper_constraint, lower_constraint) if add: add_cons_vars_to_problem(model, to_add) return to_add def fix_objective_as_constraint(model, fraction=1, bound=None, name='fixed_objective_{}'): """Fix current objective as an additional constraint. When adding constraints to a model, such as done in pFBA which minimizes total flux, these constraints can become too powerful, resulting in solutions that satisfy optimality but sacrifices too much for the original objective function. To avoid that, we can fix the current objective value as a constraint to ignore solutions that give a lower (or higher depending on the optimization direction) objective value than the original model. When done with the model as a context, the modification to the objective will be reverted when exiting that context. Parameters ---------- model : cobra.Model The model to operate on fraction : float The fraction of the optimum the objective is allowed to reach. bound : float, None The bound to use instead of fraction of maximum optimal value. If not None, fraction is ignored. name : str Name of the objective. May contain one `{}` placeholder which is filled with the name of the old objective. """ fix_objective_name = name.format(model.objective.name) if fix_objective_name in model.constraints: model.solver.remove(fix_objective_name) if bound is None: bound = model.slim_optimize(error_value=None) * fraction if model.objective.direction == 'max': ub, lb = None, bound else: ub, lb = bound, None constraint = model.problem.Constraint( model.objective.expression, name=fix_objective_name, ub=ub, lb=lb) add_cons_vars_to_problem(model, constraint, sloppy=True) def check_solver_status(status, raise_error=False): """Perform standard checks on a solver's status.""" if status == optlang.interface.OPTIMAL: return elif status == optlang.interface.INFEASIBLE and not raise_error: warn("solver status is '{}'".format(status), UserWarning) elif status is None: raise RuntimeError( "model was not optimized yet or solver context switched") else: raise OptimizationError("solver status is '{}'".format(status)) def assert_optimal(model, message='optimization failed'): """Assert model solver status is optimal. Do nothing if model solver status is optimal, otherwise throw appropriate exception depending on the status. Parameters ---------- model : cobra.Model The model to check the solver status for. message : str (optional) Message to for the exception if solver status was not optimal. """ if model.solver.status != optlang.interface.OPTIMAL: raise OPTLANG_TO_EXCEPTIONS_DICT[model.solver.status](message) import cobra.solvers as legacy_solvers # noqa
lgpl-2.1
cran/Boom
src/Models/Mixtures/DirichletProcessMixture.cpp
17226
// Copyright 2018 Google LLC. All Rights Reserved. /* Copyright (C) 2005-2017 Steven L. Scott This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #include "Models/Mixtures/DirichletProcessMixture.hpp" #include "Models/Mixtures/PosteriorSamplers/SplitMerge.hpp" #include "cpputil/report_error.hpp" #include "cpputil/shift_element.hpp" #include "distributions.hpp" namespace BOOM { namespace { typedef DirichletProcessMixtureModel DPMM; typedef ConjugateDirichletProcessMixtureModel CDPMM; typedef DirichletProcessMixtureComponent DpMixtureComponent; typedef ConjugateDirichletProcessMixtureComponent ConjugateDpMixtureComponent; } // namespace DPMM::DirichletProcessMixtureModel( const Ptr<DirichletProcessMixtureComponent> &mixture_component_prototype, const Ptr<HierarchicalPosteriorSampler> &base_distribution, const Ptr<UnivParams> &concentration_parameter) : mixture_component_prototype_(mixture_component_prototype), base_distribution_(base_distribution), concentration_parameter_(concentration_parameter), mixing_weights_(1, 1.0), spare_mixture_component_target_buffer_size_(10) { observe_concentration_parameter(); } void DPMM::set_stick_fractions(const Vector &stick_fractions) { if (stick_fractions.size() != number_of_components()) { report_error("Stick fractions have the wrong dimension."); } stick_fractions_ = stick_fractions; compute_mixing_weights(); } int DPMM::cluster_indicator(int observation) const { const Ptr<Data> &data_point(dat()[observation]); auto it = cluster_indicators_.find(data_point); if (it != cluster_indicators_.end()) { // If the observation is currently unassigned then its cluster indicator // is the nullptr. Return -1 in that case. return !!it->second ? it->second->mixture_component_index() : -1; } else { report_error("Cluster indicator could not be found"); return -2; // Will never get here } } void DPMM::cluster_indicators(std::vector<int> &indicators) const { int sample_size = number_of_observations(); indicators.resize(sample_size); for (int i = 0; i < sample_size; ++i) { indicators[i] = cluster_indicator(i); } } void DPMM::add_data(const Ptr<Data> &dp) { data_.push_back(dp); cluster_indicators_[dp] = nullptr; } void DPMM::clear_data() { data_.clear(); for (int i = 0; i < mixture_components_.size(); ++i) { mixture_components_[i]->clear_data(); } cluster_indicators_.clear(); } void DPMM::combine_data(const Model &other_model, bool just_suf) { const DPMM &other(dynamic_cast<const DPMM &>(other_model)); const std::vector<Ptr<Data>> &other_data(other.dat()); for (int i = 0; i < other_data.size(); ++i) { add_data(other_data[i]); } } void DPMM::accept_split_merge_proposal(const SplitMerge::Proposal &proposal) { if (proposal.is_merge()) { replace_cluster( mixture_components_[proposal.split1()->mixture_component_index()], proposal.merged()); int component_index_2 = proposal.split2()->mixture_component_index(); mixture_components_[component_index_2]->clear_data(); remove_empty_cluster(mixture_components_[component_index_2], false); // The last element of proposal.merged_mixing_weights() is the mixing // weight for an empty cluster. Get rid of that and put in the collective // weight for all unpopulated components. mixing_weights_ = proposal.merged_mixing_weights(); mixing_weights_.back() = 0; mixing_weights_.back() = 1.0 - mixing_weights_.sum(); } else { // Accept a split move. replace_cluster( mixture_components_[proposal.merged()->mixture_component_index()], proposal.split1()); insert_cluster(proposal.split2(), proposal.split2()->mixture_component_index()); mixing_weights_ = proposal.split_mixing_weights(); mixing_weights_.push_back(1.0 - mixing_weights_.sum()); } compute_stick_fractions_from_mixing_weights(); } void DPMM::assign_data_to_cluster(const Ptr<Data> &dp, int cluster, RNG &rng) { if (cluster == number_of_components()) { add_empty_cluster(rng); } if (cluster < number_of_components()) { mixture_components_[cluster]->add_data(dp); cluster_indicators_[dp] = mixture_components_[cluster]; } else { report_error("Invalid cluster index."); } } void DPMM::remove_data_from_cluster(const Ptr<Data> &dp, bool remove_empty_cluster) { Ptr<DirichletProcessMixtureComponent> component = cluster_indicators_[dp]; if (!!component) { component->remove_data(dp); if (component->number_of_observations() == 0 && remove_empty_cluster) { this->remove_empty_cluster(component, true); } } cluster_indicators_[dp] = nullptr; } void DPMM::add_empty_cluster(RNG &rng) { repopulate_spare_mixture_components(); Ptr<DirichletProcessMixtureComponent> component = spare_mixture_components_.back(); assign_and_add_mixture_component(component, rng); pop_spare_component_stack(); } void DPMM::remove_empty_cluster(const Ptr<DpMixtureComponent> &component, bool adjust_mixing_weights) { if (component->number_of_observations() != 0) { report_error("Cluster to be removed is not empty."); } int which_cluster = component->mixture_component_index(); if (which_cluster < 0) { // The component is not currently assigned. return; } else if (which_cluster > number_of_components()) { report_error("Mixture component index too large."); } if (mixture_components_[which_cluster] != component) { report_error("Mixture components have become misaligned."); } component->set_mixture_component_index(-1); spare_mixture_components_.push_back(component); for (int i = which_cluster; i < mixture_components_.size(); ++i) { mixture_components_[i]->decrement_mixture_component_index(); } mixture_components_.erase(mixture_components_.begin() + which_cluster); if (adjust_mixing_weights) { stick_fractions_.erase(stick_fractions_.begin() + which_cluster); mixing_weights_.pop_back(); compute_mixing_weights(); } } void DPMM::remove_all_empty_clusters() { for (int i = 0; i < mixture_components_.size(); ++i) { if (cluster_count(i) == 0) { remove_empty_cluster(mixture_components_[i], true); --i; } } } void DPMM::shift_cluster(int from, int to) { shift_element(mixture_components_, from, to); for (int i = 0; i < number_of_components(); ++i) { mixture_components_[i]->set_mixture_component_index(i); } mixing_weights_.shift_element(from, to); compute_stick_fractions_from_mixing_weights(); } void DPMM::compute_mixing_weights() { mixing_weights_.resize(stick_fractions_.size() + 1); double fraction_remaining = 1.0; for (int i = 0; i < stick_fractions_.size(); ++i) { mixing_weights_[i] = stick_fractions_[i] * fraction_remaining; fraction_remaining *= (1 - stick_fractions_[i]); } mixing_weights_.back() = fraction_remaining; } void DPMM::compute_stick_fractions_from_mixing_weights() { stick_fractions_.resize(mixing_weights_.size() - 1); stick_fractions_[0] = mixing_weights_[0]; double probability_remaining = 1.0 - stick_fractions_[0]; for (int i = 1; i < stick_fractions_.size(); ++i) { stick_fractions_[i] = mixing_weights_[i] / probability_remaining; probability_remaining -= mixing_weights_[i]; } } // Here is the math for the stick breaking distribution. Let w = w1, w2, ..., // wn. The density factors as p(w) = p(w1) p(w2 | w1) ... p(wn | w1..wn). // Each wi is defined as vi * (1 - sum of previous weights), where vi ~ // Beta(1, alpha). // // That means p(wi | w1, ..., wi-1) = Beta(wi / previous) / previous, where // the extra factor is a Jacobian. // // There is some nice cancellation that falls out of the beta distribution. // Beta(v, 1, alpha) = Gamma(1 + alpha) // ------------------- * v^(1-1) * (1-v)^(alpha - 1). // Gamma(1) Gamma(alpha) // // Now, Gamma(1 + alpha) = alpha * Gamma(alpha), so the normalizing constant // here is just alpha, and the density is just (1-v)^(alpha-1). // // The Jacobian term is 1/previous, where we can write previous_i = // (1-v1)...(1-vi-1). Thus 1-v1 appears in the denominator of n-1 terms, 1-v2 // in n-2 terms etc. // // Putting all this together gives // p(w) = alpha^n \prod_{i=1}^n (1-v_i)^{\alpha + i - 1 - n)} // // In C's zero-based counting scheme we just replace i-1 with i. double DPMM::dstick(const Vector &weights, double alpha, bool logscale) { // The amount of probability remaining after subtracting off all previous // mixing weights. double log_alpha = log(alpha); int dim = weights.size(); double ans = dim * log_alpha; double previous_probability = 1.0; for (int i = 0; i < dim; ++i) { if (previous_probability > 0) { double stick_fraction = weights[i] / previous_probability; previous_probability -= weights[i]; ans += (alpha + i - dim) * log(1 - stick_fraction); } else { // Do some error checking to make sure previous_probability isn't so // more negative than can plausibly be attributed to numerical issues. if (fabs(previous_probability) > 1e-10) { report_error("Vector of weights sums to more than 1."); } else { // Assume all future weights (and thus all future stick fractions) are // zero. Each zero stick fraction increments ans by zero, so we're // done. break; } } } return logscale ? ans : exp(ans); } void DPMM::repopulate_spare_mixture_components() { if (spare_mixture_components_.empty()) { for (int i = 0; i < spare_mixture_component_target_buffer_size(); ++i) { Ptr<DirichletProcessMixtureComponent> component = mixture_component_prototype_->clone(); component->clear_data(); unassign_component_and_add_to_spares(component); } } } void DPMM::pop_spare_component_stack() { spare_mixture_components_.pop_back(); } void DPMM::unassign_component_and_add_to_spares( const Ptr<DirichletProcessMixtureComponent> &component) { spare_mixture_components_.push_back(component); spare_mixture_components_.back()->set_mixture_component_index(-1); } void DPMM::assign_and_add_mixture_component( const Ptr<DpMixtureComponent> &component, RNG &rng) { mixture_components_.push_back(component); base_distribution_->draw_model_parameters(*mixture_components_.back()); mixture_components_.back()->set_mixture_component_index( mixture_components_.size() - 1); stick_fractions_.push_back(rbeta_mt(rng, 1, concentration_parameter())); double remainder = mixing_weights_.back(); mixing_weights_.back() = remainder * stick_fractions_.back(); mixing_weights_.push_back(remainder * (1 - stick_fractions_.back())); } void DPMM::replace_cluster( const Ptr<DpMixtureComponent> &component_to_replace, const Ptr<DpMixtureComponent> &new_component) { int index = component_to_replace->mixture_component_index(); component_to_replace->set_mixture_component_index(-1); component_to_replace->clear_data(); spare_mixture_components_.push_back(component_to_replace); int buffer_size = spare_mixture_component_target_buffer_size_; if (spare_mixture_components_.size() > 2 * buffer_size) { spare_mixture_components_.erase( spare_mixture_components_.begin() + buffer_size, spare_mixture_components_.end()); } new_component->set_mixture_component_index(index); mixture_components_[index] = new_component; std::set<Ptr<Data>> data_set = new_component->abstract_data_set(); for (const auto &el : data_set) { cluster_indicators_[el] = new_component; } } void DPMM::insert_cluster(const Ptr<DpMixtureComponent> &component, int index) { mixture_components_.insert(mixture_components_.begin() + index, component); std::set<Ptr<Data>> data_set = component->abstract_data_set(); for (const auto &data_point : data_set) { cluster_indicators_[data_point] = component; } for (int i = index; i < mixture_components_.size(); ++i) { mixture_components_[i]->set_mixture_component_index(i); } } void DPMM::observe_concentration_parameter() { concentration_parameter_->add_observer([this]() { this->log_concentration_parameter_ = log(this->concentration_parameter()); }); concentration_parameter_->set(concentration_parameter()); } //====================================================================== CDPMM::ConjugateDirichletProcessMixtureModel( const Ptr<ConjugateDpMixtureComponent> &mixture_component_prototype, const Ptr<ConjugateHierarchicalPosteriorSampler> &base_distribution, const Ptr<UnivParams> &concentration_parameter) : DPMM(mixture_component_prototype, base_distribution, concentration_parameter), conjugate_mixture_component_prototype_(mixture_component_prototype), conjugate_base_distribution_(base_distribution) {} double ConjugateDirichletProcessMixtureModel::log_marginal_density( const Ptr<Data> &data_point, int which_component) const { if (which_component > 0) { return conjugate_base_distribution_->log_marginal_density( data_point, component(which_component)); } else { return conjugate_base_distribution_->log_marginal_density( data_point, conjugate_mixture_component_prototype_.get()); } } void CDPMM::add_empty_cluster(RNG &rng) { repopulate_spare_mixture_components(); Ptr<ConjugateDpMixtureComponent> component = spare_conjugate_components_.back(); conjugate_mixture_components_.push_back(component); DPMM::assign_and_add_mixture_component(component, rng); pop_spare_component_stack(); } void CDPMM::remove_empty_cluster(const Ptr<DpMixtureComponent> &component, bool adjust_mixing_weights) { int which_cluster = component->mixture_component_index(); if (conjugate_mixture_components_[which_cluster] != component) { report_error("Conjugate mixture components have become misaligned"); } spare_conjugate_components_.push_back( conjugate_mixture_components_[which_cluster]); conjugate_mixture_components_.erase(conjugate_mixture_components_.begin() + which_cluster); DPMM::remove_empty_cluster(component, adjust_mixing_weights); } void CDPMM::replace_cluster( const Ptr<DpMixtureComponent> &component_to_replace, const Ptr<DpMixtureComponent> &new_component) { int index = component_to_replace->mixture_component_index(); conjugate_mixture_components_[index] = new_component.dcast<ConjugateDirichletProcessMixtureComponent>(); DPMM::replace_cluster(component_to_replace, new_component); } void CDPMM::insert_cluster(const Ptr<DpMixtureComponent> &component, int index) { conjugate_mixture_components_.insert( conjugate_mixture_components_.begin() + index, component.dcast<ConjugateDpMixtureComponent>()); DPMM::insert_cluster(component, index); } void CDPMM::shift_cluster(int from, int to) { shift_element(conjugate_mixture_components_, from, to); DPMM::shift_cluster(from, to); } void CDPMM::repopulate_spare_mixture_components() { if (spare_conjugate_components_.empty()) { for (int i = 0; i < spare_mixture_component_target_buffer_size(); ++i) { Ptr<ConjugateDirichletProcessMixtureComponent> component = conjugate_mixture_component_prototype_->clone(); component->clear_data(); unassign_component_and_add_to_spares(component); spare_conjugate_components_.push_back(component); } } } void CDPMM::pop_spare_component_stack() { spare_conjugate_components_.pop_back(); DPMM::pop_spare_component_stack(); } } // namespace BOOM
lgpl-2.1
dasantonym/node-wdt-native
src/wMotion.cc
4224
// // Created by anton on 21.03.15. // #include "wMotion.h" #include "Matrix.h" #include <nan.h> v8::Persistent<FunctionTemplate> wMotion::constructor; int buffersSize; unsigned char *cur; float *recent; float *bg; int motionThreshold, presenceThreshold; float motionWeight, presenceWeight; void wMotion::Init(Handle<Object> target) { NanScope(); //Class Local<FunctionTemplate> ctor = NanNew<FunctionTemplate>(wMotion::New); NanAssignPersistent(constructor, ctor); ctor->InstanceTemplate()->SetInternalFieldCount(1); ctor->SetClassName(NanNew("wMotion")); // Prototype NODE_SET_PROTOTYPE_METHOD(ctor, "process", Process); target->Set(NanNew("wMotion"), ctor->GetFunction()); } NAN_METHOD(wMotion::New) { NanScope(); NanReturnValue(args.Holder()); } wMotion::wMotion(): ObjectWrap() { if( cur ) delete[] cur; if( bg ) delete[] bg; if( recent ) delete[] recent; buffersSize = 0; cur = NULL; bg = recent = NULL; motionThreshold = 8; // min 0 max 255 presenceThreshold = 8; // min 0 max 255 motionWeight = 0.1; // min 0 max 2 presenceWeight = 0.0001; // min 0 max 2 } void quarterScale( unsigned char *to, unsigned char *from, int w, int h ) { for( int y=0; y<h-1; y+=2 ) { int yw = (y*w); for( int x=0; x<w-1; x+=2 ) { to[ (yw/4) + (x/2) ] = ( from[ yw + x ] +from[ yw + x + 1 ] +from[ yw + w + x ] +from[ yw + w + x + 1 ] ) / 4; } } } NAN_METHOD(wMotion::Reset) { NanScope(); buffersSize = -1; NanReturnNull(); } NAN_METHOD(wMotion::Process) { NanScope(); Matrix *src = ObjectWrap::Unwrap<Matrix>(args[0]->ToObject()); cv::Mat yuv; cv::cvtColor(src->mat, yuv, CV_RGB2YCrCb); motionThreshold = args[1]->IntegerValue(); presenceThreshold = args[2]->IntegerValue(); motionWeight = (float)args[3]->NumberValue(); presenceWeight = (float)args[4]->NumberValue(); int sz = yuv.cols*yuv.rows; int sz4 = ( (yuv.cols/2)*(yuv.rows/2)); unsigned char *Y = yuv.data; unsigned char *U = Y + sz; unsigned char *V = U + sz4; if( buffersSize != sz4 ) { if( cur ) delete[] cur; if( recent ) delete[] recent; if( bg ) delete[] bg; buffersSize = sz4; cur = new unsigned char[sz4]; recent = new float[sz4]; bg = new float[sz4]; quarterScale( cur, Y, yuv.cols, yuv.rows ); for( int i=0; i<sz4; i++ ) recent[i]=bg[i]=cur[i]; } else { quarterScale( cur, Y, yuv.cols, yuv.rows ); } unsigned char mthresh = motionThreshold; unsigned char pthresh = presenceThreshold; unsigned char *P = U; unsigned char *M = V; float pw = presenceWeight; float pwn = 1.-pw; float mw = motionWeight; float mwn = 1.-mw; for( int i=0; i<sz4; i++ ) { // 0-255, threshold //M[i] = abs( late[i]-cur[i] )>mthresh?255:0; //P[i] = abs( bg[i]-cur[i] )>pthresh?255:0; // good looking M[i] = abs( recent[i]-cur[i] )>mthresh?64:128; P[i] = abs( bg[i]-cur[i] )>pthresh?64:128; // "real" //M[i] = 128+(late[i]-cur[i]); //P[i] = 128+(bg[i]-cur[i]); bg[i] *= pwn; bg[i] += cur[i]*pw; recent[i] *= mwn; recent[i] += cur[i]*mw; } v8::Local<v8::Array> arr = NanNew<Array>(2); v8::Handle<v8::Object> currentArray = NanNew<v8::Object>(); currentArray->SetIndexedPropertiesToExternalArrayData(&cur, v8::kExternalUnsignedByteArray, sz4); v8::Handle<v8::Object> recentArray = NanNew<v8::Object>(); recentArray->SetIndexedPropertiesToExternalArrayData(&cur, v8::kExternalUnsignedByteArray, sz4); arr->Set(0, currentArray); arr->Set(1, recentArray); NanReturnValue(arr); }
lgpl-2.1
mhl787156/MinecraftAI
libraries/neat-preview/neuroph-core-2.3/javadoc/org/neuroph/nnet/comp/package-summary.html
7846
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_02-ea) on Thu Dec 24 00:39:33 CET 2009 --> <TITLE> org.neuroph.nnet.comp </TITLE> <META NAME="date" CONTENT="2009-12-24"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="org.neuroph.nnet.comp"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <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>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Package</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../../org/neuroph/nnet/package-summary.html"><B>PREV PACKAGE</B></A>&nbsp; &nbsp;<A HREF="../../../../org/neuroph/nnet/learning/package-summary.html"><B>NEXT PACKAGE</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html?org/neuroph/nnet/comp/package-summary.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="package-summary.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<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> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <H2> Package org.neuroph.nnet.comp </H2> Provides components for the specific neural network models. <P> <B>See:</B> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF="#package_description"><B>Description</B></A> <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Class Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD WIDTH="15%"><B><A HREF="../../../../org/neuroph/nnet/comp/CompetitiveLayer.html" title="class in org.neuroph.nnet.comp">CompetitiveLayer</A></B></TD> <TD>Represents layer of competitive neurons, and provides methods for competition.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD WIDTH="15%"><B><A HREF="../../../../org/neuroph/nnet/comp/CompetitiveNeuron.html" title="class in org.neuroph.nnet.comp">CompetitiveNeuron</A></B></TD> <TD>Provides neuron behaviour specific for competitive neurons which are used in competitive layers, and networks with competitive learning.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD WIDTH="15%"><B><A HREF="../../../../org/neuroph/nnet/comp/DelayedConnection.html" title="class in org.neuroph.nnet.comp">DelayedConnection</A></B></TD> <TD>Represents the connection between neurons which can delay signal.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD WIDTH="15%"><B><A HREF="../../../../org/neuroph/nnet/comp/DelayedNeuron.html" title="class in org.neuroph.nnet.comp">DelayedNeuron</A></B></TD> <TD>Provides behaviour for neurons with delayed output.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD WIDTH="15%"><B><A HREF="../../../../org/neuroph/nnet/comp/InputOutputNeuron.html" title="class in org.neuroph.nnet.comp">InputOutputNeuron</A></B></TD> <TD>Provides behaviour specific for neurons which act as input and the output neurons within the same layer.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD WIDTH="15%"><B><A HREF="../../../../org/neuroph/nnet/comp/ThresholdNeuron.html" title="class in org.neuroph.nnet.comp">ThresholdNeuron</A></B></TD> <TD>Provides behaviour for neurons with threshold.</TD> </TR> </TABLE> &nbsp; <P> <A NAME="package_description"><!-- --></A><H2> Package org.neuroph.nnet.comp Description </H2> <P> Provides components for the specific neural network models. <P> <P> <DL> </DL> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <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="navbar_bottom_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>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Package</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../../org/neuroph/nnet/package-summary.html"><B>PREV PACKAGE</B></A>&nbsp; &nbsp;<A HREF="../../../../org/neuroph/nnet/learning/package-summary.html"><B>NEXT PACKAGE</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html?org/neuroph/nnet/comp/package-summary.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="package-summary.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<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> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> </BODY> </HTML>
lgpl-2.1
hyyh619/OpenSceneGraph-3.4.0
src/OpenThreads/pthreads/PThreadMutex.cpp
4679
/* -*-c++-*- OpenThreads library, Copyright (C) 2002 - 2007 The Open Thread Group * * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ // // PThreadMutex.c++ - C++ Mutex class built on top of posix threads. // ~~~~~~~~~~~~~~~~ // #include <unistd.h> #include <pthread.h> #include <OpenThreads/Mutex> #include "PThreadMutexPrivateData.h" using namespace OpenThreads; // ---------------------------------------------------------------------------- // // Decription: Constructor // // Use: public. // Mutex::Mutex(MutexType type) : _mutexType(type) { pthread_mutexattr_t mutex_attr; pthread_mutexattr_init(&mutex_attr); PThreadMutexPrivateData *pd = new PThreadMutexPrivateData(); if (type == MUTEX_RECURSIVE) { pthread_mutexattr_settype(&mutex_attr, PTHREAD_MUTEX_RECURSIVE); } else { #ifndef __linux__ // (not available until NPTL) [ pthread_mutexattr_settype(&mutex_attr, PTHREAD_MUTEX_ERRORCHECK); #endif // ] __linux__ } #ifdef ALLOW_PRIORITY_SCHEDULING // [ #ifdef __sun // [ pthread_mutexattr_setprotocol(&mutex_attr, PTHREAD_PRIO_NONE); #endif // ] __sun // ------------------------------------------------------------------------- // Initialization is a bit tricky, since we have to be able to be aware // that on many-to-many execution vehicle systems, we may run into // priority inversion deadlocks if a mutex is shared between threads // of differing priorities. Systems that do this should provide the // following protocol attributes to prevent deadlocks. Check at runtime. // // PRIO_INHERIT causes any thread locking the mutex to temporarily become // the same priority as the highest thread also blocked on the mutex. // Although more expensive, this is the preferred method. // // PRIO_PROTECT causes any thread locking the mutex to assume the priority // specified by setprioceiling. pthread_mutex_lock will fail if // the priority ceiling is lower than the thread's priority. Therefore, // the priority ceiling must be set to the max priority in order to // guarantee no deadlocks will occur. // #if defined (_POSIX_THREAD_PRIO_INHERIT) || defined (_POSIX_THREAD_PRIO_PROTECT) // [ if (sysconf(_POSIX_THREAD_PRIO_INHERIT)) { pthread_mutexattr_setprotocol(&mutex_attr, PTHREAD_PRIO_INHERIT); } else if (sysconf(_POSIX_THREAD_PRIO_PROTECT)) { int th_policy; struct sched_param th_param; pthread_getschedparam(pthread_self(), &th_policy, &th_param); pthread_mutexattr_setprotocol(&mutex_attr, PTHREAD_PRIO_PROTECT); pthread_mutexattr_setprioceiling(&mutex_attr, sched_get_priority_max(th_policy)); } #endif // ] Priority Scheduling. #endif // ] ALLOW_PRIORITY_SCHEDULING pthread_mutex_init(&pd->mutex, &mutex_attr); _prvData = static_cast<void*>(pd); } // ---------------------------------------------------------------------------- // // Decription: Destructor // // Use: public. // Mutex::~Mutex() { PThreadMutexPrivateData *pd = static_cast<PThreadMutexPrivateData*>(_prvData); pthread_mutex_destroy(&pd->mutex); delete pd; } // ---------------------------------------------------------------------------- // // Decription: lock the mutex // // Use: public. // int Mutex::lock() { PThreadMutexPrivateData *pd = static_cast<PThreadMutexPrivateData*>(_prvData); return pthread_mutex_lock(&pd->mutex); } // ---------------------------------------------------------------------------- // // Decription: unlock the mutex // // Use: public. // int Mutex::unlock() { PThreadMutexPrivateData *pd = static_cast<PThreadMutexPrivateData*>(_prvData); return pthread_mutex_unlock(&pd->mutex); } // ---------------------------------------------------------------------------- // // Decription: test if the mutex may be locked // // Use: public. // int Mutex::trylock() { PThreadMutexPrivateData *pd = static_cast<PThreadMutexPrivateData*>(_prvData); return pthread_mutex_trylock(&pd->mutex); }
lgpl-2.1
maui-packages/qt-creator
src/plugins/projectexplorer/buildprogress.cpp
4964
/**************************************************************************** ** ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of Qt Creator. ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional ** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "buildprogress.h" #include "projectexplorerconstants.h" #include <coreplugin/coreconstants.h> #include <utils/stylehelper.h> #include <QVBoxLayout> #include <QHBoxLayout> #include <QLabel> #include <QFont> #include <QPixmap> #include <QDebug> using namespace ProjectExplorer; using namespace ProjectExplorer::Internal; BuildProgress::BuildProgress(TaskWindow *taskWindow, Qt::Orientation orientation) : m_contentWidget(new QWidget), m_errorIcon(new QLabel), m_warningIcon(new QLabel), m_errorLabel(new QLabel), m_warningLabel(new QLabel), m_taskWindow(taskWindow) { QHBoxLayout *contentLayout = new QHBoxLayout; contentLayout->setContentsMargins(0, 0, 0, 0); contentLayout->setSpacing(0); setLayout(contentLayout); contentLayout->addWidget(m_contentWidget); QBoxLayout *layout; if (orientation == Qt::Horizontal) layout = new QHBoxLayout; else layout = new QVBoxLayout; layout->setContentsMargins(8, 2, 0, 2); layout->setSpacing(2); m_contentWidget->setLayout(layout); QHBoxLayout *errorLayout = new QHBoxLayout; errorLayout->setSpacing(2); layout->addLayout(errorLayout); errorLayout->addWidget(m_errorIcon); errorLayout->addWidget(m_errorLabel); QHBoxLayout *warningLayout = new QHBoxLayout; warningLayout->setSpacing(2); layout->addLayout(warningLayout); warningLayout->addWidget(m_warningIcon); warningLayout->addWidget(m_warningLabel); // ### TODO this setup should be done by style QFont f = this->font(); f.setPointSizeF(Utils::StyleHelper::sidebarFontSize()); f.setBold(true); m_errorLabel->setFont(f); m_warningLabel->setFont(f); m_errorLabel->setPalette(Utils::StyleHelper::sidebarFontPalette(m_errorLabel->palette())); m_warningLabel->setPalette(Utils::StyleHelper::sidebarFontPalette(m_warningLabel->palette())); m_errorIcon->setAlignment(Qt::AlignRight); m_warningIcon->setAlignment(Qt::AlignRight); m_errorIcon->setPixmap(QPixmap(QLatin1String(Core::Constants::ICON_ERROR))); m_warningIcon->setPixmap(QPixmap(QLatin1String(Core::Constants::ICON_WARNING))); m_contentWidget->hide(); connect(m_taskWindow, SIGNAL(tasksChanged()), this, SLOT(updateState())); } void BuildProgress::updateState() { if (!m_taskWindow) return; int errors = m_taskWindow->errorTaskCount(Constants::TASK_CATEGORY_BUILDSYSTEM) + m_taskWindow->errorTaskCount(Constants::TASK_CATEGORY_COMPILE) + m_taskWindow->errorTaskCount(Constants::TASK_CATEGORY_DEPLOYMENT); bool haveErrors = (errors > 0); m_errorIcon->setEnabled(haveErrors); m_errorLabel->setEnabled(haveErrors); m_errorLabel->setText(QString::number(errors)); int warnings = m_taskWindow->warningTaskCount(Constants::TASK_CATEGORY_BUILDSYSTEM) + m_taskWindow->warningTaskCount(Constants::TASK_CATEGORY_COMPILE) + m_taskWindow->warningTaskCount(Constants::TASK_CATEGORY_DEPLOYMENT); bool haveWarnings = (warnings > 0); m_warningIcon->setEnabled(haveWarnings); m_warningLabel->setEnabled(haveWarnings); m_warningLabel->setText(QString::number(warnings)); // Hide warnings and errors unless you need them m_warningIcon->setVisible(haveWarnings); m_warningLabel->setVisible(haveWarnings); m_errorIcon->setVisible(haveErrors); m_errorLabel->setVisible(haveErrors); m_contentWidget->setVisible(haveWarnings || haveErrors); }
lgpl-2.1