answer
stringlengths
15
1.25M
#include "<API key>.hpp" #include <east/qt_dbtabletools.hpp> #include <east/common.hpp> #include <east/dbset.hpp> #include <east/xpath.hpp> #include <east/log.h> using east_db::db; using east_db::dbset; using east_db::dbtuple; using east_xml::xmldoc; using east_xml::xpath_object; using std::string; using std::vector; using std::nothrow; namespace qt_dbtools { static string _empty; <API key>::<API key>( qt_dbtablemodel *parent, east_db::db *dbconn, const std::string &filename, const std::string &prefix ) : _parent ( parent ) , _db ( dbconn ) , _root ( NULL ) , _tablemodel( new( nothrow ) TableModel( filename, prefix ) ) , _qorder ( " ORDER BY 1 ASC " ) , _cc ( _tablemodel ? _tablemodel->columnsNumber() : 0 ) { _init(); } <API key>::<API key>( qt_dbtablemodel *parent, east_db::db *dbconn ) : _parent ( parent ) , _db ( dbconn ) , _root ( NULL ) , _tablemodel( NULL ) , _qorder ( " ORDER BY 1 ASC" ) , _cc ( 0 ) { _init(); } <API key>::~<API key> () { delete _tablemodel; delete _root; } void <API key>::select( const std::string& query ) { _wrap_query( query ); if( !_root ) { _root = new( nothrow ) dbset( _db, query ); } if( _root ) { _update_dbset( *_root, _qwrap + _qwhere + _qorder ); } } void <API key>::where( const std::string& text ) { if( text.empty() ) { _qwhere = ""; } else { _qwhere = " WHERE %s"; _qwhere.replace( _qwhere.find( "%s" ), 2, text ); } if( _root ) { _update_dbset( *_root, _qwrap + _qwhere + _qorder ); } } void <API key>::order( int col, bool asc ) { if( asc ) { _qorder = " ORDER BY %d ASC"; } else { _qorder = " ORDER BY %d DESC"; } _qorder.replace( _qorder.find( "%d" ), 2, int_to_str( col + 1 ) ); if( _root ) { _update_dbset( *_root, _qwrap + " LIMIT 0" ); _update_dbset( *_root, _qwrap + _qwhere + _qorder ); } } QModelIndex <API key>::index( int row, int col, const QModelIndex &parent ) const { Q_UNUSED( parent ); if( ! _root ) { return QModelIndex(); } size_t nrow = ( size_t ) row; size_t ncol = ( size_t ) col; size_t ncc = ( size_t ) _cc; if( ncol >= ncc ) { return QModelIndex(); } if( nrow > _root->size() ) { return QModelIndex(); } return _parent->createIndex ( row, col, ( void* ) & _root->tuple( nrow ) ); } int <API key>::rowCount( const QModelIndex &parent ) const { Q_UNUSED( parent ); return _root ? ( int )_root->size() : 0; } int <API key>::columnCount( const QModelIndex &parent ) const { Q_UNUSED( parent ); return _cc; } QVariant <API key>::data( const QModelIndex &index, int role ) const { if( index.internalPointer() == 0 ) return QVariant(); switch( role ) { case Qt::DisplayRole: return _DisplayRole ( index ); case Qt::DecorationRole: return _DecorationRole ( index ); case Qt::ToolTipRole: return _ToolTipRole ( index ); case Qt::BackgroundRole: return _BackgroundRole ( index ); case Qt::FontRole: return _FontRole ( index ); case Qt::TextColorRole: return _TextColorRole ( index ); case Qt::TextAlignmentRole: return _TextAlignmentRole ( index ); } return QVariant(); } QVariant <API key>::headerData( int section, Qt::Orientation orientation, int role ) const { if ( ( section < 0 ) || ( section >= _cc ) || ( orientation != Qt::Horizontal ) ) { return _parent ? _parent->headerDataDefault( section, orientation, role ) : QVariant(); } switch( role ) { case Qt::DisplayRole: return _DisplayRole ( section ); case Qt::DecorationRole: return _DecorationRole ( section ); case Qt::ToolTipRole: return _ToolTipRole ( section ); case Qt::BackgroundRole: return _BackgroundRole ( section ); case Qt::FontRole: return _FontRole ( section ); case Qt::TextColorRole: return _TextColorRole ( section ); case Qt::TextAlignmentRole: return _TextAlignmentRole ( section ); } return _parent ? _parent->headerDataDefault( section, orientation, role ) : QVariant(); } void <API key>::_init() { _horizontal_flags[ "left" ] = Qt::AlignLeft; _horizontal_flags[ "right" ] = Qt::AlignRight; _horizontal_flags[ "center" ] = Qt::AlignHCenter; _horizontal_flags[ "justify"] = Qt::AlignJustify; _vertical_flags[ "top" ] = Qt::AlignTop; _vertical_flags[ "bottom" ] = Qt::AlignBottom; _vertical_flags[ "center" ] = Qt::AlignVCenter; if ( _tablemodel ) { _wrap_query( _tablemodel->sql() ); } } const TableModel::Content* <API key>::_content( int col ) const { if( !_tablemodel ) { return NULL; } const TableModel::Column *column = _tablemodel->column( col ); if( ! column ) { return NULL; } const TableModel::Content *content = column->content(); if( ! content ) { return NULL; } return content; } const TableModel::Canvas* <API key>::_canvas( const TableModel::Content *content, const dbtuple &tuple ) const { if( ! content ) return NULL; const TableModel::Canvas *canvas = NULL; if( content->calc() ) { string value = _value( tuple, content->format(), content->columns() ); canvas = content->canvas( value ); } else { canvas = content->canvas(); } return canvas; } string <API key>::_value( const dbtuple &tuple, const string &format, const string &columns ) const { string result( format ); vector<string> dest; split_str( columns, ",", dest ); for( size_t i = 0; i < dest.size(); ++i ) { size_t n = result.find( "%s" ); if( n != string::npos ) { result.replace( n, 2, tuple.value( str_to_size_t( dest[i] ) ) ); } } return result; } // CONTENT FUNCTIONS QString <API key>::_DisplayRole( const QModelIndex& index ) const { const dbtuple *tuple = ( const dbtuple* ) index.internalPointer(); if( ! tuple ) return _empty.c_str(); if( !_tablemodel ) { size_t col = ( size_t ) ( index.column() >= 0 ) ? index.column() : 0; return tuple->value( col ).c_str(); } const TableModel::Content *content = _content( index.column() ); if( !content ) return _empty.c_str(); if( ! content->calc() ) { return qt_dbtablemodel::tr( _value( *tuple, content->format(), content->columns() ).c_str() ); } const TableModel::Canvas *canvas = _canvas( content, *tuple ); if( canvas ) { if( canvas->data().size() ) return qt_dbtablemodel::tr( canvas->data().c_str() ); if( canvas->text().size() ) return qt_dbtablemodel::tr( canvas->text().c_str() ); } return qt_dbtablemodel::tr( _value( *tuple, content->format(), content->columns() ).c_str() ); } QIcon <API key>::_DecorationRole( const QModelIndex& index ) const { QIcon icon; const dbtuple *tuple = ( const dbtuple* ) index.internalPointer(); if( !tuple ) return icon; const TableModel::Canvas *canvas = _canvas( _content ( index.column() ), *tuple ); if( canvas ) { icon.addFile( canvas->icon().c_str() ); } return icon; } QString <API key>::_ToolTipRole( const QModelIndex& index ) const { const dbtuple *tuple = ( const dbtuple* ) index.internalPointer(); if( !tuple ) return _empty.c_str(); const TableModel::Canvas *canvas = _canvas( _content( index.column() ), *tuple ); if( canvas ) { return qt_dbtablemodel::tr( canvas->toolTip().c_str() ); } return _empty.c_str(); } QVariant <API key>::_BackgroundRole( const QModelIndex& index ) const { QVariant color; const dbtuple *tuple = ( const dbtuple* ) index.internalPointer(); if( !tuple ) return color; const TableModel::Canvas *canvas = _canvas( _content ( index.column() ), *tuple ); if( canvas ) { const TableModel::Color* ptr = canvas->backgroundColor(); if( ptr ) { return QColor( ptr->red(), ptr->green(), ptr->blue(), ptr->alpha() ); } } return color; } QFont <API key>::_FontRole( const QModelIndex& index ) const { QFont font; const dbtuple *tuple = ( const dbtuple* ) index.internalPointer(); if( !tuple ) return font; const TableModel::Canvas *canvas = _canvas( _content ( index.column() ), *tuple ); if( canvas ) { const TableModel::Font* ptr = canvas->font(); if( ptr ) { font.setFamily ( ptr->family().c_str() ); font.setPointSize( ptr->pointSize() ); font.setItalic ( ptr->italic() ); font.setUnderline( ptr->underline() ); font.setBold ( ptr->bold() ); } } return font; } QVariant <API key>::_TextColorRole( const QModelIndex& index ) const { QVariant color; const dbtuple *tuple = ( const dbtuple* ) index.internalPointer(); if( !tuple ) return color; const TableModel::Canvas *canvas = _canvas( _content ( index.column() ), *tuple ); if( canvas ) { const TableModel::Color* ptr = canvas->font() ? canvas->font()->color() : NULL; if( ptr ) { return QColor( ptr->red(), ptr->green(), ptr->blue(), ptr->alpha() ); } } return color; } int <API key>::_TextAlignmentRole( const QModelIndex& index ) const { Qt::AlignmentFlag horz = Qt::AlignLeft; Qt::AlignmentFlag vert = Qt::AlignVCenter; const dbtuple *tuple = ( const dbtuple* ) index.internalPointer(); if( !tuple ) return ( int ) horz | vert; const TableModel::Canvas *canvas = _canvas( _content ( index.column() ), *tuple ); if( canvas ) { AlignmentFlags::const_iterator it = _horizontal_flags.find( canvas->alignH() ); if( it != _horizontal_flags.end() ) { horz = it->second; } it = _vertical_flags.find( canvas->alignV() ); if( it != _vertical_flags.end() ) { vert = it->second; } } return ( int ) horz | vert; } // HEADER FUNCTIONS const TableModel::Header* <API key>::_header( int section ) const { if( !_tablemodel ) { return NULL; } const TableModel::Column *column = _tablemodel->column( section ); if( ! column ) { _lprintf( LOG_INFO, "Column %d not found\n", section ); return NULL; } const TableModel::Header *header = column->header(); if( ! header ) { _lprintf( LOG_INFO, "Header %d not exist\n", section ); return NULL; } return header; } QString <API key>::_DisplayRole( int section ) const { const TableModel::Header *header = _header( section ); if( ! header ) return _empty.c_str(); const TableModel::Canvas *canvas = header->canvas(); if( canvas ) { if( canvas->data().size() ) return qt_dbtablemodel::tr( canvas->data().c_str() ); return qt_dbtablemodel::tr( canvas->text().c_str() ); } return _empty.c_str(); } QIcon <API key>::_DecorationRole( int section ) const { QIcon icon; const TableModel::Header *header = _header( section ); if( ! header ) return icon; const TableModel::Canvas *canvas = header->canvas(); if( canvas ) { icon.addFile( canvas->icon().c_str() ); } return icon; } QString <API key>::_ToolTipRole( int section ) const { const TableModel::Header *header = _header( section ); if( ! header ) return _empty.c_str(); const TableModel::Canvas *canvas = header->canvas(); if( canvas ) { return qt_dbtablemodel::tr( canvas->toolTip().c_str() ); } return _empty.c_str(); } QVariant <API key>::_BackgroundRole( int section ) const { QVariant color = _parent ? _parent->headerDataDefault( section, Qt::Horizontal, Qt::BackgroundRole ) : QVariant(); const TableModel::Header *header = _header( section ); if( ! header ) return color; const TableModel::Canvas *canvas = header->canvas(); if( canvas ) { const TableModel::Color* ptr = canvas->backgroundColor(); if( ptr ) { return QColor( ptr->red(), ptr->green(), ptr->blue(), ptr->alpha() ); } } return color; } QFont <API key>::_FontRole( int section ) const { QFont font; const TableModel::Header *header = _header( section ); if( ! header ) return font; const TableModel::Canvas *canvas = header->canvas(); if( canvas ) { const TableModel::Font* ptr = canvas->font(); if( ptr ) { font.setFamily ( ptr->family().c_str() ); font.setPointSize( ptr->pointSize() ); font.setItalic ( ptr->italic() ); font.setUnderline( ptr->underline() ); font.setBold ( ptr->bold() ); } } return font; } QVariant <API key>::_TextColorRole( int section ) const { QVariant color = _parent ? _parent->headerDataDefault( section, Qt::Horizontal, Qt::TextColorRole ) : QVariant(); const TableModel::Header *header = _header( section ); if( ! header ) return color; const TableModel::Canvas *canvas = header->canvas(); if( canvas ) { const TableModel::Color* ptr = canvas->font() ? canvas->font()->color() : NULL; if( ptr ) { return QColor( ptr->red(), ptr->green(), ptr->blue(), ptr->alpha() ); } } return color; } int <API key>::_TextAlignmentRole( int section ) const { Qt::AlignmentFlag horz = Qt::AlignLeft;; Qt::AlignmentFlag vert = Qt::AlignVCenter; const TableModel::Header *header = _header( section ); if( ! header ) return ( int ) horz | vert; const TableModel::Canvas *canvas = header->canvas(); if( canvas ) { AlignmentFlags::const_iterator it = _horizontal_flags.find( canvas->alignH() ); if( it != _horizontal_flags.end() ) { horz = it->second; } it = _vertical_flags.find( canvas->alignV() ); if( it != _vertical_flags.end() ) { vert = it->second; } } return ( int ) horz | vert; } void <API key>::_wrap_query( const std::string& query ) { if( query.empty() ) { return; } _qsource = query; while( _qsource.size() && _qsource[_qsource.size()-1] == ';' ) { _qsource.erase( _qsource.size()-1, 1 ); } _qwrap = "SELECT * FROM ( %s ) AS _tmp_"; _qwrap.replace( _qwrap.find("%s"), 2, _qsource ); } void <API key>::_update_dbset( dbset& updated, const string& sql ) { if( !( _db && _db->valid() ) ) { return; } dbset source( _db, sql, updated.nkey(), updated.level() ); if( !_tablemodel ) { if( updated.size() ) { _cc = updated.tuple(0).size(); } else if( source.size() ) { _cc = source.tuple(0).size(); } } for( size_t n = 0; n < updated.size(); ++n ) { dbtuple &tuple = updated.tuple( n ); try { size_t num = source.find ( tuple ); dbtuple &obj = source.tuple( num ); if ( ! tuple.identic( obj ) ) { tuple.replace( obj ); if( _parent ) { _parent->dataChanged( index( n, 0, QModelIndex() ), index( n, _cc, QModelIndex() ) ); } } } catch( east_db::no_tuple_matched& ) { if( _parent ) { _parent->beginRemoveRows( QModelIndex(), n, n ); updated.erase( n ); --n; _parent->endRemoveRows(); } else { updated.erase( n ); --n; } } } for( size_t n = 0; n < source.size(); ++n ) { dbtuple &tuple = source.tuple( n ); try { updated.find( tuple ); } catch( east_db::no_tuple_matched& ) { if( _parent ) { _parent->beginInsertRows( QModelIndex(), n, n ); updated.insert( tuple, n ); _parent->endInsertRows(); } else { updated.insert( tuple, n ); } } } } } // qt_dbtools
package proguard.classfile.visitor; import proguard.classfile.*; /** * This class visits ProgramMember objects referring to methods, identified by * a name and descriptor pair. * * @author Eric Lafortune */ public class NamedMethodVisitor implements ClassVisitor { private final String name; private final String descriptor; private final MemberVisitor memberVisitor; public NamedMethodVisitor(String name, String descriptor, MemberVisitor memberVisitor) { this.name = name; this.descriptor = descriptor; this.memberVisitor = memberVisitor; } // Implementations for ClassVisitor. public void visitProgramClass(ProgramClass programClass) { programClass.methodAccept(name, descriptor, memberVisitor); } public void visitLibraryClass(LibraryClass libraryClass) { libraryClass.methodAccept(name, descriptor, memberVisitor); } }
#pragma once #include <sys/types.h> #include "internal.h" #include "virbitmap.h" #include "virutil.h" #include "virenum.h" typedef enum { <API key> = 0, <API key>, <API key>, <API key>, VIR_PROC_POLICY_RR, <API key> } <API key>; VIR_ENUM_DECL(<API key>); char * <API key>(int status); void virProcessAbort(pid_t pid); void <API key>(int status) G_GNUC_NORETURN; int virProcessWait(pid_t pid, int *exitstatus, bool raw) <API key>; int virProcessKill(pid_t pid, int sig); int <API key>(pid_t pid, bool force); int <API key>(pid_t pid, bool force, unsigned int extradelay); int <API key>(pid_t pid, virBitmapPtr map); virBitmapPtr <API key>(pid_t pid); int virProcessGetPids(pid_t pid, size_t *npids, pid_t **pids); int <API key>(pid_t pid, unsigned long long *timestamp); int <API key>(pid_t pid, size_t *nfdlist, int **fdlist); int <API key>(size_t nfdlist, int *fdlist); int <API key>(pid_t pid, unsigned long long bytes) G_GNUC_NO_INLINE; int <API key>(pid_t pid, unsigned int procs); int <API key>(pid_t pid, unsigned int files); int <API key>(pid_t pid, unsigned long long bytes); int <API key>(pid_t pid, unsigned long long *bytes); /* Callback to run code within the mount namespace tied to the given * pid. This function must use only async-signal-safe functions, as * it gets run after a fork of a multi-threaded process. The return * value of this function is passed to _exit(), except that a * negative value is treated as EXIT_CANCELED. */ typedef int (*<API key>)(pid_t pid, void *opaque); int <API key>(pid_t pid, <API key> cb, void *opaque); /** * <API key>: * @ppid: parent's pid * @opaque: opaque data * * Callback to run in fork()-ed process. * * Returns: 0 on success, * -1 on error (treated as EXIT_CANCELED) */ typedef int (*<API key>)(pid_t ppid, void *opaque); int virProcessRunInFork(<API key> cb, void *opaque) G_GNUC_NO_INLINE; int <API key>(void); int <API key>(pid_t pid, <API key> policy, int priority); typedef enum { <API key> = (1 << 1), <API key> = (1 << 2), <API key> = (1 << 3), <API key> = (1 << 4), <API key> = (1 << 5), <API key> = (1 << 6), } <API key>; int <API key>(unsigned int ns);
#include <QtTest/QtTest> #include <MApplication> #include "ut_mkutclassname.h" mkutclassinclude mkutclassinclude_p void Ut_MkUtClassName::initTestCase() { static int argc = 1; static char *app_name[1] = { (char *) "./ut_mkutclassname" }; app = new MApplication(argc, app_name); } void Ut_MkUtClassName::cleanupTestCase() { delete app; } void Ut_MkUtClassName::init() { m_subject = new MkUtClassName(); } void Ut_MkUtClassName::cleanup() { delete m_subject; } QTEST_APPLESS_MAIN(Ut_MkUtClassName)
// wall tile-related code #include <utility> #include "tiledef-walls.h" #include "tile.h" using std::pair; const TileGraphic get_wall_graphic(TileWallTypes type) { switch (type) { case kTileWallDim: return TileGraphic("wall", 9, 3); break; case kTileWallDark: return TileGraphic("wall", 12, 3); break; case kTileWallWood: return TileGraphic("wall", 6, 10); break; case kTileWallBase: default: return TileGraphic("wall", 6, 3); } }
package org.pentaho.reporting.libraries.css.parser.stylehandler.line; import org.pentaho.reporting.libraries.css.keys.line.DominantBaseline; import org.pentaho.reporting.libraries.css.parser.stylehandler.<API key>; public class <API key> extends <API key> { public <API key>() { super( true ); addValue( DominantBaseline.ALPHABETIC ); addValue( DominantBaseline.CENTRAL ); addValue( DominantBaseline.HANGING ); addValue( DominantBaseline.IDEOGRAPHIC ); addValue( DominantBaseline.MATHEMATICAL ); addValue( DominantBaseline.MIDDLE ); addValue( DominantBaseline.NO_CHANGE ); addValue( DominantBaseline.RESET_SIZE ); addValue( DominantBaseline.TEXT_AFTER_EDGE ); addValue( DominantBaseline.TEXT_BEFORE_EDGE ); addValue( DominantBaseline.USE_SCRIPT ); } }
package net.sf.jaer.stereopsis; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Label; import java.util.logging.Logger; import java.util.prefs.Preferences; import net.sf.jaer.chip.AEChip; /** * Frame for visualizing matching matrix and disparites. * * @author Peter Hess */ public class StereoMatchingFrame extends javax.swing.JFrame { static Preferences prefs = Preferences.userNodeForPackage(StereoMatchingFrame.class); static Logger log=Logger.getLogger("filter"); AEChip chip; int maxDisp; private Label labelDisp, labelSmc, labelScd; private <API key> smc; private <API key> sdc; /** Creates new form <API key> */ public StereoMatchingFrame(AEChip chip, int maxDisp) { this.chip = chip; this.maxDisp = maxDisp; initComponents(); GridBagLayout layout = new GridBagLayout(); GridBagConstraints layoutConstraints = new GridBagConstraints(); layoutConstraints.anchor = GridBagConstraints.NORTHWEST; layoutConstraints.gridwidth = GridBagConstraints.REMAINDER; setLayout(layout); labelDisp = new Label("Disparity: " + 0); layout.setConstraints(labelDisp, layoutConstraints); add(labelDisp); labelSmc = new Label("Matching matrix"); layout.setConstraints(labelSmc, layoutConstraints); add(labelSmc); smc = new <API key>(chip); layout.setConstraints(smc, layoutConstraints); add(smc); labelScd = new Label("Accumulated disparity values"); layout.setConstraints(labelScd, layoutConstraints); add(labelScd); sdc = new <API key>(maxDisp); layout.setConstraints(sdc, layoutConstraints); add(sdc); setPreferredSize(null); pack(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents private void initComponents() { getContentPane().setLayout(null); <API key>(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("Disparity Matching Viewer"); pack(); }// </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables // End of variables declaration//GEN-END:variables public void visualize(int bestDisp, float[][] matchings, float[] disparities) { smc.setBestDisp(bestDisp); smc.setMatchings(matchings); sdc.setBestDisp(bestDisp); sdc.setDisparities(disparities); labelDisp.setText("Disparity: " + bestDisp); smc.repaint(); sdc.repaint(); } }
package com.smartdevicelink.proxy.rpc; import java.util.Hashtable; import java.util.Vector; import com.smartdevicelink.proxy.RPCStruct; import com.smartdevicelink.proxy.constants.Names; /** * String containing hexadecimal identifier as well as other common names. * <p><b>Parameter List * <table border="1" rules="all"> * <tr> * <th>Name</th> * <th>Type</th> * <th>Description</th> * <th>SmartDeviceLink Ver. Available</th> * </tr> * <tr> * <td>statusByte</td> * <td>String</td> * <td>Hexadecimal byte string * <ul> * <li>Maxlength = 500</li> * </ul> * </td> * <td>SmartDeviceLink 2.0</td> * </tr> * </table> * @since SmartDeviceLink 2.0 */ public class DTC extends RPCStruct { /** * Constructs a newly allocated DTC object */ public DTC() { } /** * Constructs a newly allocated DTC object indicated by the Hashtable parameter * @param hash The Hashtable to use */ public DTC(Hashtable hash) { super(hash); } /** * set identifier * @param identifier */ public void setIdentifier(String identifier) { if (identifier != null) { store.put(Names.identifier, identifier); } else { store.remove(Names.identifier); } } /** * get identifier * @return identifier */ public String getIdentifier() { return (String) store.get(Names.identifier); } /** * set Hexadecimal byte string * @param statusByte Hexadecimal byte string */ public void setStatusByte(String statusByte) { if (statusByte != null) { store.put(Names.statusByte, statusByte); } else { store.remove(Names.statusByte); } } /** * get Hexadecimal byte string * @return Hexadecimal byte string */ public String getStatusByte() { return (String) store.get(Names.statusByte); } }
// This file is part of the deal.II library. // The deal.II library is free software; you can use it, redistribute // it, and/or modify it under the terms of the GNU Lesser General // the top level of the deal.II distribution. // this tests the correctness of matrix free matrix-vector products for two // vectors on the same DoFHandler. Otherwise the same as matrix_vector_10.cc #include "../tests.h" #include <deal.II/matrix_free/matrix_free.h> #include <deal.II/matrix_free/fe_evaluation.h> #include <deal.II/base/utilities.h> #include <deal.II/base/function.h> #include <deal.II/lac/la_parallel_vector.h> #include <deal.II/distributed/tria.h> #include <deal.II/grid/grid_generator.h> #include <deal.II/grid/tria_boundary_lib.h> #include <deal.II/dofs/dof_tools.h> #include <deal.II/dofs/dof_handler.h> #include <deal.II/lac/constraint_matrix.h> #include <deal.II/lac/<API key>.h> #include <deal.II/lac/<API key>.h> #include <deal.II/fe/fe_q.h> #include <deal.II/fe/fe_values.h> #include <deal.II/numerics/vector_tools.h> #include <iostream> template <int dim, int fe_degree, typename Number> void helmholtz_operator (const MatrixFree<dim,Number> &data, std::vector<LinearAlgebra::distributed::Vector<Number> > &dst, const std::vector<LinearAlgebra::distributed::Vector<Number> > &src, const std::pair<unsigned int,unsigned int> &cell_range) { FEEvaluation<dim,fe_degree,fe_degree+1,2,Number> fe_eval (data); const unsigned int n_q_points = fe_eval.n_q_points; for (unsigned int cell=cell_range.first; cell<cell_range.second; ++cell) { fe_eval.reinit (cell); fe_eval.read_dof_values (src); fe_eval.evaluate (true, true, false); for (unsigned int q=0; q<n_q_points; ++q) { fe_eval.submit_value (<API key>(Number(10))* fe_eval.get_value(q), q); fe_eval.submit_gradient (fe_eval.get_gradient(q),q); } fe_eval.integrate (true,true); fe_eval.<API key> (dst); } } template <int dim, int fe_degree, typename Number> class MatrixFreeTest { public: typedef VectorizedArray<Number> vector_t; static const std::size_t n_vectors = VectorizedArray<Number>::n_array_elements; MatrixFreeTest(const MatrixFree<dim,Number> &data_in): data (data_in) {}; void vmult (std::vector<LinearAlgebra::distributed::Vector<Number> > &dst, const std::vector<LinearAlgebra::distributed::Vector<Number> > &src) const { for (unsigned int i=0; i<dst.size(); ++i) dst[i] = 0; const std::function<void(const MatrixFree<dim,Number> &, std::vector<LinearAlgebra::distributed::Vector<Number> > &, const std::vector<LinearAlgebra::distributed::Vector<Number> > &, const std::pair<unsigned int,unsigned int> &)> wrap = helmholtz_operator<dim,fe_degree,Number>; data.cell_loop (wrap, dst, src); }; private: const MatrixFree<dim,Number> &data; }; template <int dim, int fe_degree> void test () { typedef double number; parallel::distributed::Triangulation<dim> tria (MPI_COMM_WORLD); GridGenerator::hyper_cube (tria); tria.refine_global(1); typename Triangulation<dim>::<API key> cell = tria.begin_active (), endc = tria.end(); cell = tria.begin_active (); for (; cell!=endc; ++cell) if (cell->is_locally_owned()) if (cell->center().norm()<0.2) cell->set_refine_flag(); tria.<API key>(); if (dim < 3 && fe_degree < 2) tria.refine_global(2); else tria.refine_global(1); if (tria.begin(tria.n_levels()-1)->is_locally_owned()) tria.begin(tria.n_levels()-1)->set_refine_flag(); if (tria.last()->is_locally_owned()) tria.last()->set_refine_flag(); tria.<API key>(); cell = tria.begin_active (); for (unsigned int i=0; i<10-3*dim; ++i) { cell = tria.begin_active (); unsigned int counter = 0; for (; cell!=endc; ++cell, ++counter) if (cell->is_locally_owned()) if (counter % (7-i) == 0) cell->set_refine_flag(); tria.<API key>(); } FE_Q<dim> fe (fe_degree); DoFHandler<dim> dof (tria); dof.distribute_dofs(fe); IndexSet owned_set = dof.locally_owned_dofs(); IndexSet relevant_set; DoFTools::<API key> (dof, relevant_set); ConstraintMatrix constraints (relevant_set); DoFTools::<API key>(dof, constraints); VectorTools::<API key> (dof, 0, ZeroFunction<dim>(), constraints); constraints.close(); deallog << "Testing " << dof.get_fe().get_name() << std::endl; //std::cout << "Number of cells: " << tria.<API key>() << std::endl; //std::cout << "Number of degrees of freedom: " << dof.n_dofs() << std::endl; //std::cout << "Number of constraints: " << constraints.n_constraints() << std::endl; MatrixFree<dim,number> mf_data; { const QGauss<1> quad (fe_degree+1); typename MatrixFree<dim,number>::AdditionalData data; data.<API key> = MatrixFree<dim,number>::AdditionalData::none; data.tasks_block_size = 7; mf_data.reinit (dof, constraints, quad, data); } MatrixFreeTest<dim,fe_degree,number> mf (mf_data); LinearAlgebra::distributed::Vector<number> ref; std::vector<LinearAlgebra::distributed::Vector<number> > in(2), out(2); for (unsigned int i=0; i<2; ++i) { mf_data.<API key> (in[i]); mf_data.<API key> (out[i]); } mf_data.<API key> (ref); for (unsigned int i=0; i<in[0].local_size(); ++i) { const unsigned int glob_index = owned_set.nth_index_in_set (i); if (constraints.is_constrained(glob_index)) continue; in[0].local_element(i) = (double)Testing::rand()/RAND_MAX; in[1].local_element(i) = (double)Testing::rand()/RAND_MAX; } mf.vmult (out, in); // assemble trilinos sparse matrix with // (\nabla v, \nabla u) + (v, 10 * u) for // reference TrilinosWrappers::SparseMatrix sparse_matrix; { TrilinosWrappers::SparsityPattern csp (owned_set, MPI_COMM_WORLD); DoFTools::<API key> (dof, csp, constraints, true, Utilities::MPI::this_mpi_process(MPI_COMM_WORLD)); csp.compress(); sparse_matrix.reinit (csp); } { QGauss<dim> quadrature_formula(fe_degree+1); FEValues<dim> fe_values (dof.get_fe(), quadrature_formula, update_values | update_gradients | update_JxW_values); const unsigned int dofs_per_cell = dof.get_fe().dofs_per_cell; const unsigned int n_q_points = quadrature_formula.size(); FullMatrix<double> cell_matrix (dofs_per_cell, dofs_per_cell); std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); typename DoFHandler<dim>::<API key> cell = dof.begin_active(), endc = dof.end(); for (; cell!=endc; ++cell) if (cell->is_locally_owned()) { cell_matrix = 0; fe_values.reinit (cell); for (unsigned int q_point=0; q_point<n_q_points; ++q_point) for (unsigned int i=0; i<dofs_per_cell; ++i) { for (unsigned int j=0; j<dofs_per_cell; ++j) cell_matrix(i,j) += ((fe_values.shape_grad(i,q_point) * fe_values.shape_grad(j,q_point) + 10. * fe_values.shape_value(i,q_point) * fe_values.shape_value(j,q_point)) * fe_values.JxW(q_point)); } cell->get_dof_indices(local_dof_indices); constraints.<API key> (cell_matrix, local_dof_indices, sparse_matrix); } } sparse_matrix.compress(VectorOperation::add); deallog << "Norm of difference (component 1/2): "; for (unsigned int i=0; i<2; ++i) { sparse_matrix.vmult (ref, in[i]); out[i] -= ref; const double diff_norm = out[i].linfty_norm(); deallog << diff_norm << " "; } deallog << std::endl << std::endl; } int main (int argc, char **argv) { Utilities::MPI::MPI_InitFinalize mpi_initialization (argc, argv, <API key>()); unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); deallog.push(Utilities::int_to_string(myid)); if (myid == 0) { initlog(); deallog << std::setprecision(4); deallog.push("2d"); test<2,1>(); test<2,2>(); deallog.pop(); deallog.push("3d"); test<3,1>(); test<3,2>(); deallog.pop(); } else { test<2,1>(); test<2,2>(); test<3,1>(); test<3,2>(); } }
package com.Mod_Ores.Items.Entity; import javax.swing.Icon; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.entity.Entity; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.entity.projectile.EntityPotion; import net.minecraft.item.Item; import net.minecraft.item.ItemPotion; import net.minecraft.potion.PotionHelper; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class RenderFrostShard extends Render { //private static final ResourceLocation field_110780_a = new ResourceLocation("soulforest:textures/gui/Frost_shard.png"); private static final ResourceLocation texture = new ResourceLocation("soulforest", "textures/gui/Frost_shard.png"); private Item item; private int itemDamage; private static final String __OBFID = "CL_00001008"; public RenderFrostShard(Item p_i1259_1_, int p_i1259_2_) { this.item = p_i1259_1_; this.itemDamage = p_i1259_2_; } public RenderFrostShard(Item p_i1260_1_) { this(p_i1260_1_, 0); } /** * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1, * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. */ public void renderFrostShard(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) { IIcon icon = this.item.getIconFromDamage(this.itemDamage); if (icon != null) { GL11.glPushMatrix(); GL11.glTranslatef((float)par2, (float)par4, (float)par6); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glScalef(0.5F, 0.5F, 0.5F); this.bindEntityTexture(par1Entity); Tessellator tessellator = Tessellator.instance; if (icon == ItemPotion.func_94589_d("bottle_splash")){ int i = PotionHelper.func_77915_a(((EntityPotion)par1Entity).getPotionDamage(), false); float f2 = (float)(i >> 16 & 255) / 255.0F; float f3 = (float)(i >> 8 & 255) / 255.0F; float f4 = (float)(i & 255) / 255.0F; GL11.glColor3f(f2, f3, f4); GL11.glPushMatrix(); this.func_77026_a(tessellator, ItemPotion.func_94589_d("overlay")); GL11.glPopMatrix(); GL11.glColor3f(1.0F, 1.0F, 1.0F); } this.func_77026_a(tessellator, icon); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); } } /** * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1, * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. */ @Override public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9){ this.renderFrostShard((EntityFrostShard)par1Entity, par2, par4, par6, par8, par9); } @Override protected ResourceLocation getEntityTexture(Entity entity) { return getCustomTexture((EntityFrostShard) entity); } private ResourceLocation getCustomTexture(EntityFrostShard entity) { return this.texture; } private void func_77026_a(Tessellator par1Tessellator, IIcon par2Icon) { float f = par2Icon.getMinU(); float f1 = par2Icon.getMaxU(); float f2 = par2Icon.getMinV(); float f3 = par2Icon.getMaxV(); float f4 = 1.0F; float f5 = 0.5F; float f6 = 0.25F; GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); par1Tessellator.startDrawingQuads(); par1Tessellator.setNormal(0.0F, 1.0F, 0.0F); par1Tessellator.addVertexWithUV((double)(0.0F - f5), (double)(0.0F - f6), 0.0D, (double)f, (double)f3); par1Tessellator.addVertexWithUV((double)(f4 - f5), (double)(0.0F - f6), 0.0D, (double)f1, (double)f3); par1Tessellator.addVertexWithUV((double)(f4 - f5), (double)(f4 - f6), 0.0D, (double)f1, (double)f2); par1Tessellator.addVertexWithUV((double)(0.0F - f5), (double)(f4 - f6), 0.0D, (double)f, (double)f2); par1Tessellator.draw(); } }
<?php namespace wcf\system\cronjob; use wcf\data\cronjob\Cronjob; use wcf\data\user\UserAction; use wcf\system\WCF; class UserQuitCronjob extends AbstractCronjob { /** * @inheritDoc */ public function execute(Cronjob $cronjob) { parent::execute($cronjob); $sql = "SELECT userID FROM wcf".WCF_N."_user WHERE quitStarted > ? AND quitStarted < ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute([ 0, TIME_NOW - 7 * 24 * 3600 ]); $userIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); if (!empty($userIDs)) { $action = new UserAction($userIDs, 'delete'); $action->executeAction(); } } }
#ifndef <API key> #define <API key> #include "pfring.h" #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include <anic_api.h> #include <anic_api_private.h> #include <anic_api_block.h> #include <limits.h> #include <sys/shm.h> #include <signal.h> #include <setjmp.h> #define MFL_SUPPORT #define <API key> (2*1024*1024) #define ACCOLADE_RING_SIZE (RING_HUGEPAGE_COUNT * HUGEPAGE_SIZE) #define <API key> (256) #define ACCOLADE_MAX_RINGS (64) #define ACCOLADE_MAX_BLKS (2048) #define <API key> (16*1024) #define <API key> (64) struct block_ref { u_int8_t *buf_p; u_int64_t dma_address; }; #ifdef MFL_SUPPORT struct block_header_s /* bufheader_s */ { u_int32_t block_size; u_int32_t packet_count; u_int32_t byte_count; u_int32_t reserved;; u_int64_t first_timestamp; u_int64_t last_timestamp; u_int32_t first_offset; u_int32_t last_offset; }; #else struct block_header_s { u_int32_t block_size; u_int32_t packet_count; u_int32_t byte_count; u_int32_t reserved; u_int64_t first_timestamp; u_int64_t last_timestamp; }; #endif struct block_status { struct anic_blkstatus_s blkStatus; int refcount; }; struct ring_stats { u_int64_t packets; u_int64_t bytes; u_int64_t packet_errors; u_int64_t timestamp_errors; #ifdef MFL_SUPPORT u_int64_t last_drops_counter; u_int64_t cumulative_drops; #endif }; struct workqueue { int head; int tail; int entryA[<API key>+1]; // bounded queue (can never have more entries than there are blks) }; struct block_processing { int processing; u_int8_t *buf_p; struct anic_blkstatus_s *blkstatus_p; int blk; #ifdef MFL_SUPPORT u_int8_t *last_buf_p; #endif }; typedef struct { anic_handle_t anic_handle; u_int32_t device_id, ring_id; u_int32_t blocksize, pages, pageblocks, portCount; struct block_ref l_blkA[ACCOLADE_MAX_BLKS /* <API key> */]; struct block_status l_blkStatusA[ACCOLADE_MAX_BLKS /* <API key> */]; struct ring_stats rstats; anic_blocksize_e blocksize_e; struct workqueue wq; u_int64_t lastTs; struct block_processing currentblock; struct anic_dma_info dmaInfo; #ifdef MFL_SUPPORT int mfl_mode; #endif } pfring_anic; int pfring_anic_open(pfring *ring); void pfring_anic_close(pfring *ring); int pfring_anic_stats(pfring *ring, pfring_stat *stats); int pfring_anic_recv(pfring *ring, u_char** buffer, u_int buffer_len, struct pfring_pkthdr *hdr, u_int8_t <API key>); int pfring_anic_send(pfring *ring, char *pkt, u_int pkt_len, u_int8_t flush_packet); int <API key>(pfring *ring, u_int16_t watermark); int <API key>(pfring *ring, u_int duration); int pfring_anic_poll(pfring *ring, u_int wait_duration); int <API key>(pfring *ring, packet_direction direction); int <API key>(pfring *ring); int <API key>(pfring *ring, socket_mode mode); int <API key>(pfring *ring, int *if_index); #endif /* <API key> */
// The LLVM Compiler Infrastructure // This file is distributed under the University of Illinois Open Source // This file implements the MipsAsmBackend and MipsELFObjectWriter classes. #include "MipsFixupKinds.h" #include "MCTargetDesc/MipsMCTargetDesc.h" #include "llvm/MC/MCAsmBackend.h" #include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCDirectives.h" #include "llvm/MC/MCELFObjectWriter.h" #include "llvm/MC/MCFixupKindInfo.h" #include "llvm/MC/MCObjectWriter.h" #include "llvm/MC/MCSubtargetInfo.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/raw_ostream.h" using namespace llvm; // Prepare value for the target space for it static unsigned adjustFixupValue(unsigned Kind, uint64_t Value) { // Add/subtract and shift switch (Kind) { default: return 0; case FK_GPRel_4: case FK_Data_4: case Mips::fixup_Mips_LO16: case Mips::fixup_Mips_GPOFF_HI: case Mips::fixup_Mips_GPOFF_LO: case Mips::fixup_Mips_GOT_PAGE: case Mips::fixup_Mips_GOT_OFST: case Mips::fixup_Mips_GOT_DISP: break; case Mips::fixup_Mips_PC16: // So far we are only using this type for branches. // For branches we start 1 instruction after the branch // so the displacement will be one instruction size less. Value -= 4; // The displacement is then divided by 4 to give us an 18 bit // address range. Value >>= 2; break; case Mips::fixup_Mips_26: // So far we are only using this type for jumps. // The displacement is then divided by 4 to give us an 28 bit // address range. Value >>= 2; break; case Mips::fixup_Mips_HI16: case Mips::<API key>: // Get the higher 16-bits. Also add 1 if bit 15 is 1. Value = ((Value + 0x8000) >> 16) & 0xffff; break; } return Value; } namespace { class MipsAsmBackend : public MCAsmBackend { Triple::OSType OSType; bool IsLittle; // Big or little endian bool Is64Bit; // 32 or 64 bit words public: MipsAsmBackend(const Target &T, Triple::OSType _OSType, bool _isLittle, bool _is64Bit) :MCAsmBackend(), OSType(_OSType), IsLittle(_isLittle), Is64Bit(_is64Bit) {} MCObjectWriter *createObjectWriter(raw_ostream &OS) const { return <API key>(OS, <API key>::getOSABI(OSType), IsLittle, Is64Bit); } ApplyFixup - Apply the \arg Value for given \arg Fixup into the provided data fragment, at the offset specified by the fixup and following the fixup kind as appropriate. void applyFixup(const MCFixup &Fixup, char *Data, unsigned DataSize, uint64_t Value) const { MCFixupKind Kind = Fixup.getKind(); Value = adjustFixupValue((unsigned)Kind, Value); if (!Value) return; // Doesn't change encoding. // Where do we start in the object unsigned Offset = Fixup.getOffset(); // Number of bytes we need to fixup unsigned NumBytes = (getFixupKindInfo(Kind).TargetSize + 7) / 8; // Used to point to big endian bytes unsigned FullSize; switch ((unsigned)Kind) { case Mips::fixup_Mips_16: FullSize = 2; break; case Mips::fixup_Mips_64: FullSize = 8; break; default: FullSize = 4; break; } // Grab current value, if any, from bits. uint64_t CurVal = 0; for (unsigned i = 0; i != NumBytes; ++i) { unsigned Idx = IsLittle ? i : (FullSize - 1 - i); CurVal |= (uint64_t)((uint8_t)Data[Offset + Idx]) << (i*8); } uint64_t Mask = ((uint64_t)(-1) >> (64 - getFixupKindInfo(Kind).TargetSize)); CurVal |= Value & Mask; // Write out the fixed up bytes back to the code/data bits. for (unsigned i = 0; i != NumBytes; ++i) { unsigned Idx = IsLittle ? i : (FullSize - 1 - i); Data[Offset + Idx] = (uint8_t)((CurVal >> (i*8)) & 0xff); } } unsigned getNumFixupKinds() const { return Mips::NumTargetFixupKinds; } const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const { const static MCFixupKindInfo Infos[Mips::NumTargetFixupKinds] = { // This table *must* be in same the order of fixup_* kinds in // MipsFixupKinds.h. // name offset bits flags { "fixup_Mips_16", 0, 16, 0 }, { "fixup_Mips_32", 0, 32, 0 }, { "fixup_Mips_REL32", 0, 32, 0 }, { "fixup_Mips_26", 0, 26, 0 }, { "fixup_Mips_HI16", 0, 16, 0 }, { "fixup_Mips_LO16", 0, 16, 0 }, { "fixup_Mips_GPREL16", 0, 16, 0 }, { "fixup_Mips_LITERAL", 0, 16, 0 }, { "<API key>", 0, 16, 0 }, { "<API key>", 0, 16, 0 }, { "fixup_Mips_PC16", 0, 16, MCFixupKindInfo::FKF_IsPCRel }, { "fixup_Mips_CALL16", 0, 16, 0 }, { "fixup_Mips_GPREL32", 0, 32, 0 }, { "fixup_Mips_SHIFT5", 6, 5, 0 }, { "fixup_Mips_SHIFT6", 6, 5, 0 }, { "fixup_Mips_64", 0, 64, 0 }, { "fixup_Mips_TLSGD", 0, 16, 0 }, { "fixup_Mips_GOTTPREL", 0, 16, 0 }, { "fixup_Mips_TPREL_HI", 0, 16, 0 }, { "fixup_Mips_TPREL_LO", 0, 16, 0 }, { "fixup_Mips_TLSLDM", 0, 16, 0 }, { "<API key>", 0, 16, 0 }, { "<API key>", 0, 16, 0 }, { "<API key>", 0, 16, MCFixupKindInfo::FKF_IsPCRel }, { "fixup_Mips_GPOFF_HI", 0, 16, 0 }, { "fixup_Mips_GPOFF_LO", 0, 16, 0 }, { "fixup_Mips_GOT_PAGE", 0, 16, 0 }, { "fixup_Mips_GOT_OFST", 0, 16, 0 }, { "fixup_Mips_GOT_DISP", 0, 16, 0 } }; if (Kind < <API key>) return MCAsmBackend::getFixupKindInfo(Kind); assert(unsigned(Kind - <API key>) < getNumFixupKinds() && "Invalid kind!"); return Infos[Kind - <API key>]; } @name Target Relaxation Interfaces @{ MayNeedRelaxation - Check whether the given instruction may need relaxation. \param Inst - The instruction to test. bool mayNeedRelaxation(const MCInst &Inst) const { return false; } <API key> - Target specific predicate for whether a given fixup requires the associated instruction to be relaxed. bool <API key>(const MCFixup &Fixup, uint64_t Value, const MCInstFragment *DF, const MCAsmLayout &Layout) const { // FIXME. assert(0 && "RelaxInstruction() unimplemented"); return false; } RelaxInstruction - Relax the instruction in the given fragment to the next wider instruction. \param Inst - The instruction to relax, which may be the same as the output. \parm Res [output] - On return, the relaxed instruction. void relaxInstruction(const MCInst &Inst, MCInst &Res) const { } @} WriteNopData - Write an (optimal) nop sequence of Count bytes to the given output. If the target cannot generate such a sequence, it should return an error. \return - True on success. bool writeNopData(uint64_t Count, MCObjectWriter *OW) const { // Check for a less than instruction size number of bytes // FIXME: 16 bit instructions are not handled yet here. // We shouldn't be using a hard coded number for instruction size. if (Count % 4) return false; uint64_t NumNops = Count / 4; for (uint64_t i = 0; i != NumNops; ++i) OW->Write32(0); return true; } }; // class MipsAsmBackend } // namespace // MCAsmBackend MCAsmBackend *llvm::<API key>(const Target &T, StringRef TT) { return new MipsAsmBackend(T, Triple(TT).getOS(), /*IsLittle*/true, /*Is64Bit*/false); } MCAsmBackend *llvm::<API key>(const Target &T, StringRef TT) { return new MipsAsmBackend(T, Triple(TT).getOS(), /*IsLittle*/false, /*Is64Bit*/false); } MCAsmBackend *llvm::<API key>(const Target &T, StringRef TT) { return new MipsAsmBackend(T, Triple(TT).getOS(), /*IsLittle*/true, /*Is64Bit*/true); } MCAsmBackend *llvm::<API key>(const Target &T, StringRef TT) { return new MipsAsmBackend(T, Triple(TT).getOS(), /*IsLittle*/false, /*Is64Bit*/true); }
#ifndef <API key> #define <API key> #include <QPixmap> #include <QObject> #include <<API key>> #include <QGraphicsView> #include <QGraphicsPixmapItem> #include <QTimer> /*! \internal * \brief Custom QObject'ified PixmapItem that's placed on the scene, * one instance for the origin snapshot, one for the target * of the rotation (crossfading). * Inherits from QObject so that it can have animatable properties. */ class SnapshotPixmapItem : public QObject, public QGraphicsPixmapItem { Q_OBJECT Q_PROPERTY(QPointF pos READ pos WRITE setPos) Q_PROPERTY(double opacity READ opacity WRITE setOpacity) Q_PROPERTY(double rotation READ rotation WRITE setRotation) public: SnapshotPixmapItem(QPixmap pixmap, QGraphicsItem* parent = 0); SnapshotPixmapItem(QGraphicsItem *parent = 0); virtual ~SnapshotPixmapItem(); private: Q_DISABLE_COPY(SnapshotPixmapItem) }; class MImRemoteWindow; class MImDamageMonitor : public QObject { Q_OBJECT public: explicit MImDamageMonitor(MImRemoteWindow* remoteWin, QObject* parent = 0); void activate(); void waitForDamage(); void cancel(); void remoteWindowChanged(MImRemoteWindow* newRemoteWindow); signals: void <API key>(); private slots: void contentUpdated(QRegion region); void timeoutExpired(); private: Q_DISABLE_COPY(MImDamageMonitor); MImRemoteWindow* remoteWindow; QTimer timeoutTimer; bool damageDetected; }; /*! \internal * \brief Top-level graphics view to superimpose the rotation animation * on top of application and keyboard widgets. * * This class derives from QGraphicsView for showing the rotation * animation. The widget that is used for capturing the start snapshots * is specified in the constructor. * * First, when <API key> is * triggered, a snapshot of the application is recorded by having the * snapshot widget draw its contents into a pixmap. This snapshot is * displayed on screen immediately. When the applicatin has rotated to the * new orientation, the rotation animation is started. * Then during the rotation two additional items become visible. * The live X11 pixmap from the redirected application window * as well as a see-through pixmap containing the keyboard * in the final orientation overlaid on top. * */ class <API key> : public QGraphicsView { Q_OBJECT public: <API key>(QWidget* snapshotWidget); virtual ~<API key>(); public slots: /*! Slot for receiving information about the underlying * application's orientation status. This triggers preparations * for starting the rotation animation, e.g. capturing the starting * snapshot. */ void <API key>(int toAngle); /*! Slot for receiving information about the underlying * application's orientation status. This triggers playback of the * animation after the end snapshot has been taken. */ void <API key>(int toAngle); /*! Used for receiving an update when the underlying application * window has changed. <API key> needs to be aware * of the change in order to take snapshots of the correct window. */ void remoteWindowChanged(MImRemoteWindow* newRemoteWindow); protected: virtual void resizeEvent(QResizeEvent *event); virtual void showEvent(QShowEvent *event); private slots: void clearScene(); void startAnimation(); private: void setupAnimation(int fromAngle, int toAngle); QPixmap grabComposited(); QPixmap grabVkbOnly(); void setupScene(); void showInitial(); private: Q_DISABLE_COPY(<API key>) void cancelAnimation(); QWidget* snapshotWidget; MImRemoteWindow* remoteWindow; QPixmap <API key>; <API key> <API key>; SnapshotPixmapItem *<API key>; SnapshotPixmapItem *<API key>; SnapshotPixmapItem *<API key>; int <API key>; int <API key>; bool <API key>; MImDamageMonitor* damageMonitor; }; #endif // <API key>
using System; using System.Collections; using Cassowary.Utils; namespace Cassowary { public class ClTableau : Cl { <summary> Constructor is protected, since this only supports an ADT for the ClSimplexSolver class. </summary> protected ClTableau() { _columns = new Hashtable(); _rows = new Hashtable(); _infeasibleRows = new Set(); _externalRows = new Set(); <API key> = new Set(); } <summary> Variable v has been removed from an expression. If the expression is in a tableau the corresponding basic variable is subject (or if subject is nil then it's in the objective function). Update the column cross-indices. </summary> public /*sealed*/ void NoteRemovedVariable(ClAbstractVariable v, ClAbstractVariable subject) { if (Trace) FnEnterPrint(string.Format("NoteRemovedVariable: {0}, {1}", v, subject)); if (subject != null) { ((Set) _columns[v]).Remove(subject); } } <summary> v has been added to the linear expression for subject update column cross indices. </summary> public /*sealed*/ void NoteAddedVariable(ClAbstractVariable v, ClAbstractVariable subject) { if (Trace) FnEnterPrint(string.Format("NoteAddedVariable: {0}, {1}", v, subject)); if (subject != null) { InsertColVar(v, subject); } } <summary> Returns information about the tableau's internals. </summary> <remarks> Originally from Michael Noth <noth@cs.washington.edu> </remarks> <returns> String containing the information. </returns> public virtual string GetInternalInfo() { string s = "Tableau Information:\n"; s += string.Format("Rows: {0} (= {1} constraints)", _rows.Count, _rows.Count - 1); s += string.Format("\nColumns: {0}", _columns.Count); s += string.Format("\nInfeasible Rows: {0}", _infeasibleRows.Count); s += string.Format("\nExternal basic variables: {0}", _externalRows.Count); s += string.Format("\nExternal parametric variables: {0}", <API key>.Count); return s; } public override string ToString() { string s = "Tableau:\n"; foreach (ClAbstractVariable clv in _rows.Keys) { ClLinearExpression expr = (ClLinearExpression) _rows[clv]; s += string.Format("{0} <==> {1}\n", clv.ToString(), expr.ToString()); } s += string.Format("\nColumns:\n{0}", _columns.ToString()); s += string.Format("\nInfeasible rows: {0}", _infeasibleRows.ToString()); s += string.Format("\nExternal basic variables: {0}", _externalRows.ToString()); s += string.Format("\nExternal parametric variables: {0}", <API key>.ToString()); return s; } <summary> Convenience function to insert a variable into the set of rows stored at _columns[param_var], creating a new set if needed. </summary> private /*sealed*/ void InsertColVar(ClAbstractVariable param_var, ClAbstractVariable rowvar) { Set rowset = (Set) _columns[param_var]; if (rowset == null) _columns.Add(param_var, rowset = new Set()); rowset.Add(rowvar); } // Add v=expr to the tableau, update column cross indices // v becomes a basic variable // expr is now owned by ClTableau class, // and ClTableau is responsible for deleting it // (also, expr better be allocated on the heap!). protected /*sealed*/ void AddRow(ClAbstractVariable var, ClLinearExpression expr) { if (Trace) FnEnterPrint("AddRow: " + var + ", " + expr); // for each variable in expr, add var to the set of rows which // have that variable in their expression _rows.Add(var, expr); // FIXME: check correctness! foreach (ClAbstractVariable clv in expr.Terms.Keys) { InsertColVar(clv, var); if (clv.IsExternal) { <API key>.Add(clv); } } if (var.IsExternal) { _externalRows.Add(var); } if (Trace) TracePrint(this.ToString()); } <summary> Remove v from the tableau -- remove the column cross indices for v and remove v from every expression in rows in which v occurs </summary> protected /*sealed*/ void RemoveColumn(ClAbstractVariable var) { if (Trace) FnEnterPrint(string.Format("RemoveColumn: {0}", var)); // remove the rows with the variables in varset Set rows = (Set) _columns[var]; _columns.Remove(var); if (rows != null) { foreach(ClAbstractVariable clv in rows) { ClLinearExpression expr = (ClLinearExpression) _rows[clv]; expr.Terms.Remove(var); } } else { if (Trace) DebugPrint(string.Format("Could not find var {0} in _columns", var)); } if (var.IsExternal) { _externalRows.Remove(var); <API key>.Remove(var); } } <summary> Remove the basic variable v from the tableau row v=expr Then update column cross indices. </summary> protected /*sealed*/ ClLinearExpression RemoveRow(ClAbstractVariable var) /*throws ExCLInternalError*/ { if (Trace) FnEnterPrint(string.Format("RemoveRow: {0}", var)); ClLinearExpression expr = (ClLinearExpression) _rows[var]; Assert(expr != null); // For each variable in this expression, update // the column mapping and remove the variable from the list // of rows it is known to be in. foreach (ClAbstractVariable clv in expr.Terms.Keys) { Set varset = (Set) _columns[clv]; if (varset != null) { if (Trace) DebugPrint(string.Format("removing from varset {0}", var)); varset.Remove(var); } } _infeasibleRows.Remove(var); if (var.IsExternal) { _externalRows.Remove(var); } _rows.Remove(var); if (Trace) FnExitPrint(string.Format("returning {0}", expr)); return expr; } <summary> Replace all occurrences of oldVar with expr, and update column cross indices oldVar should now be a basic variable. </summary> protected /*sealed*/ void SubstituteOut(ClAbstractVariable oldVar, ClLinearExpression expr) { if (Trace) FnEnterPrint(string.Format("SubstituteOut: {0}", oldVar, expr)); if (Trace) TracePrint(this.ToString()); Set varset = (Set) _columns[oldVar]; foreach(ClAbstractVariable v in varset) { ClLinearExpression row = (ClLinearExpression) _rows[v]; row.SubstituteOut(oldVar, expr, v, this); if (v.IsRestricted && row.Constant < 0.0) { _infeasibleRows.Add(v); } } if (oldVar.IsExternal) { _externalRows.Add(oldVar); <API key>.Remove(oldVar); } _columns.Remove(oldVar); } protected Hashtable Columns { get { return _columns; } } protected Hashtable Rows { get { return _rows; } } <summary> Return true if and only if the variable subject is in the columns keys </summary> protected /*sealed*/ bool ColumnsHasKey(ClAbstractVariable subject) { return _columns.ContainsKey(subject); } protected /*sealed*/ ClLinearExpression RowExpression(ClAbstractVariable v) { // if (Trace) FnEnterPrint(string.Format("rowExpression: {0}", v)); return (ClLinearExpression) _rows[v]; } <summary> _columns is a mapping from variables which occur in expressions to the set of basic variables whose expressions contain them i.e., it's a mapping from variables in expressions (a column) to the set of rows that contain them. </summary> protected Hashtable _columns; // From ClAbstractVariable to Set of variables <summary> _rows maps basic variables to the expressions for that row in the tableau. </summary> protected Hashtable _rows; // From ClAbstractVariable to ClLinearExpression <summary> Collection of basic variables that have infeasible rows (used when reoptimizing). </summary> protected Set _infeasibleRows; // Set of <API key> <summary> Set of rows where the basic variable is external this was added to the Java/C++/C# versions to reduce time in <API key>(). </summary> protected Set _externalRows; // Set of ClVariable-s <summary> Set of external variables which are parametric this was added to the Java/C++/C# versions to reduce time in <API key>(). </summary> protected Set <API key>; // Set of ClVariable-s } }
/** * SECTION:gstbasetransform * @short_description: Base class for simple transform filters * @see_also: #GstBaseSrc, #GstBaseSink * * This base class is for filter elements that process data. * * It provides for: * <itemizedlist> * <listitem><para>one sinkpad and one srcpad</para></listitem> * <listitem><para> * Possible formats on sink and source pad implemented * with custom transform_caps function. By default uses * same format on sink and source. * </para></listitem> * <listitem><para>Handles state changes</para></listitem> * <listitem><para>Does flushing</para></listitem> * <listitem><para>Push mode</para></listitem> * <listitem><para> * Pull mode if the sub-class transform can operate on arbitrary data * </para></listitem> * </itemizedlist> * * <refsect2> * <title>Use Cases</title> * <para> * <orderedlist> * <listitem> * <itemizedlist><title>Passthrough mode</title> * <listitem><para> * Element has no interest in modifying the buffer. It may want to inspect it, * in which case the element should have a transform_ip function. If there * is no transform_ip function in passthrough mode, the buffer is pushed * intact. * </para></listitem> * <listitem><para> * On the <API key> is the <API key> variable * which will automatically set/unset passthrough based on whether the * element negotiates the same caps on both pads. * </para></listitem> * <listitem><para> * <API key> on an element that doesn't implement a * transform_caps function is useful for elements that only inspect data * (such as level) * </para></listitem> * </itemizedlist> * <itemizedlist> * <title>Example elements</title> * <listitem>Level</listitem> * <listitem>Videoscale, audioconvert, ffmpegcolorspace, audioresample in * certain modes.</listitem> * </itemizedlist> * </listitem> * <listitem> * <itemizedlist> * <title>Modifications in-place - input buffer and output buffer are the * same thing.</title> * <listitem><para> * The element must implement a transform_ip function. * </para></listitem> * <listitem><para> * Output buffer size must <= input buffer size * </para></listitem> * <listitem><para> * If the always_in_place flag is set, non-writable buffers will be copied * and passed to the transform_ip function, otherwise a new buffer will be * created and the transform function called. * </para></listitem> * <listitem><para> * Incoming writable buffers will be passed to the transform_ip function * immediately. </para></listitem> * <listitem><para> * only implementing transform_ip and not transform implies always_in_place * = TRUE * </para></listitem> * </itemizedlist> * <itemizedlist> * <title>Example elements</title> * <listitem>Volume</listitem> * <listitem>Audioconvert in certain modes (signed/unsigned * conversion)</listitem> * <listitem>ffmpegcolorspace in certain modes (endianness * swapping)</listitem> * </itemizedlist> * </listitem> * <listitem> * <itemizedlist> * <title>Modifications only to the caps/metadata of a buffer</title> * <listitem><para> * The element does not require writable data, but non-writable buffers * should be subbuffered so that the meta-information can be replaced. * </para></listitem> * <listitem><para> * Elements wishing to operate in this mode should replace the * <API key> method to create subbuffers of the input buffer * and set always_in_place to TRUE * </para></listitem> * </itemizedlist> * <itemizedlist> * <title>Example elements</title> * <listitem>Capsfilter when setting caps on outgoing buffers that have * none.</listitem> * <listitem>identity when it is going to re-timestamp buffers by * datarate.</listitem> * </itemizedlist> * </listitem> * <listitem> * <itemizedlist><title>Normal mode</title> * <listitem><para> * always_in_place flag is not set, or there is no transform_ip function * </para></listitem> * <listitem><para> * Element will receive an input buffer and output buffer to operate on. * </para></listitem> * <listitem><para> * Output buffer is allocated by calling the <API key> function. * </para></listitem> * </itemizedlist> * <itemizedlist> * <title>Example elements</title> * <listitem>Videoscale, ffmpegcolorspace, audioconvert when doing * scaling/conversions</listitem> * </itemizedlist> * </listitem> * <listitem> * <itemizedlist><title>Special output buffer allocations</title> * <listitem><para> * Elements which need to do special allocation of their output buffers * other than what <API key> allows should implement a * <API key> method, which calls the parent implementation and * passes the newly allocated buffer. * </para></listitem> * </itemizedlist> * <itemizedlist> * <title>Example elements</title> * <listitem>efence</listitem> * </itemizedlist> * </listitem> * </orderedlist> * </para> * </refsect2> * <refsect2> * <title>Sub-class settable flags on GstBaseTransform</title> * <para> * <itemizedlist> * <listitem><para> * <itemizedlist><title>passthrough</title> * <listitem><para> * Implies that in the current configuration, the sub-class is not * interested in modifying the buffers. * </para></listitem> * <listitem><para> * Elements which are always in passthrough mode whenever the same caps * has been negotiated on both pads can set the class variable * <API key> to have this behaviour automatically. * </para></listitem> * </itemizedlist> * </para></listitem> * <listitem><para> * <itemizedlist><title>always_in_place</title> * <listitem><para> * Determines whether a non-writable buffer will be copied before passing * to the transform_ip function. * </para></listitem> * <listitem><para> * Implied TRUE if no transform function is implemented. * </para></listitem> * <listitem><para> * Implied FALSE if ONLY transform function is implemented. * </para></listitem> * </itemizedlist> * </para></listitem> * </itemizedlist> * </para> * </refsect2> */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include <stdlib.h> #include <string.h> #include "../../../gst/gst_private.h" #include "../../../gst/gst-i18n-lib.h" #include "gstbasetransform.h" #include <gst/gstmarshal.h> <API key> (<API key>); #define GST_CAT_DEFAULT <API key> /* BaseTransform signals and args */ enum { /* FILL ME */ LAST_SIGNAL }; #define DEFAULT_PROP_QOS FALSE enum { PROP_0, PROP_QOS }; #define <API key>(obj) \ (<API key> ((obj), <API key>, <API key>)) struct <API key> { /* QoS *//* with LOCK */ gboolean qos_enabled; gdouble proportion; GstClockTime earliest_time; /* previous buffer had a discont */ gboolean discont; GstActivateMode pad_mode; gboolean gap_aware; /* caps used for allocating buffers */ gboolean proxy_alloc; GstCaps *sink_alloc; GstCaps *src_alloc; /* upstream caps and size suggestions */ GstCaps *sink_suggest; guint size_suggest; gboolean suggest_pending; gboolean reconfigure; /* QoS stats */ guint64 processed; guint64 dropped; GstClockTime last_stop_out; }; static GstElementClass *parent_class = NULL; static void <API key> (<API key> * klass); static void <API key> (GstBaseTransform * trans, <API key> * klass); static GstFlowReturn <API key> (GstBaseTransform * trans, GstBuffer * input, GstBuffer ** buf); GType <API key> (void) { static volatile gsize base_transform_type = 0; if (g_once_init_enter (&base_transform_type)) { GType _type; static const GTypeInfo base_transform_info = { sizeof (<API key>), NULL, NULL, (GClassInitFunc) <API key>, NULL, NULL, sizeof (GstBaseTransform), 0, (GInstanceInitFunc) <API key>, }; _type = <API key> (GST_TYPE_ELEMENT, "GstBaseTransform", &base_transform_info, <API key>); g_once_init_leave (&base_transform_type, _type); } return base_transform_type; } static void <API key> (GObject * object); static void <API key> (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); static void <API key> (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); static gboolean <API key> (GstPad * pad, gboolean active); static gboolean <API key> (GstPad * pad, gboolean active); static gboolean <API key> (GstBaseTransform * trans, gboolean active); static gboolean <API key> (GstBaseTransform * trans, GstCaps * caps, guint * size); static gboolean <API key> (GstPad * pad, GstEvent * event); static gboolean <API key> (GstBaseTransform * trans, GstEvent * event); static gboolean <API key> (GstPad * pad, GstEvent * event); static gboolean <API key> (GstBaseTransform * trans, GstEvent * event); static gboolean <API key> (GstPad * pad); static GstFlowReturn <API key> (GstPad * pad, guint64 offset, guint length, GstBuffer ** buffer); static GstFlowReturn <API key> (GstPad * pad, GstBuffer * buffer); static GstCaps *<API key> (GstPad * pad); static gboolean <API key> (GstPad * pad, GstCaps * caps); static gboolean <API key> (GstBaseTransform * trans, GstPadDirection direction, GstCaps * caps); static gboolean <API key> (GstPad * pad, GstCaps * caps); static GstFlowReturn <API key> (GstPad * pad, guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf); static gboolean <API key> (GstPad * pad, GstQuery * query); static const GstQueryType *<API key> (GstPad * pad); /* static guint <API key>[LAST_SIGNAL] = { 0 }; */ static void <API key> (GObject * object) { GstBaseTransform *trans; trans = GST_BASE_TRANSFORM (object); gst_caps_replace (&trans->priv->sink_suggest, NULL); g_mutex_free (trans->transform_lock); G_OBJECT_CLASS (parent_class)->finalize (object); } static void <API key> (<API key> * klass) { GObjectClass *gobject_class; gobject_class = G_OBJECT_CLASS (klass); <API key> (<API key>, "basetransform", 0, "basetransform element"); GST_DEBUG ("<API key>"); <API key> (klass, sizeof (<API key>)); parent_class = <API key> (klass); gobject_class->set_property = <API key>; gobject_class->get_property = <API key>; <API key> (gobject_class, PROP_QOS, <API key> ("qos", "QoS", "Handle Quality-of-Service events", DEFAULT_PROP_QOS, G_PARAM_READWRITE | <API key>)); gobject_class->finalize = <API key>; klass-><API key> = FALSE; klass->event = GST_DEBUG_FUNCPTR (<API key>); klass->src_event = GST_DEBUG_FUNCPTR (<API key>); klass->accept_caps = GST_DEBUG_FUNCPTR (<API key>); } static void <API key> (GstBaseTransform * trans, <API key> * bclass) { GstPadTemplate *pad_template; GST_DEBUG ("<API key>"); trans->priv = <API key> (trans); pad_template = <API key> (GST_ELEMENT_CLASS (bclass), "sink"); g_return_if_fail (pad_template != NULL); trans->sinkpad = <API key> (pad_template, "sink"); <API key> (trans->sinkpad, GST_DEBUG_FUNCPTR (<API key>)); <API key> (trans->sinkpad, GST_DEBUG_FUNCPTR (<API key>)); <API key> (trans->sinkpad, GST_DEBUG_FUNCPTR (<API key>)); <API key> (trans->sinkpad, GST_DEBUG_FUNCPTR (<API key>)); <API key> (trans->sinkpad, GST_DEBUG_FUNCPTR (<API key>)); <API key> (trans->sinkpad, GST_DEBUG_FUNCPTR (<API key>)); <API key> (trans->sinkpad, GST_DEBUG_FUNCPTR (<API key>)); <API key> (trans->sinkpad, GST_DEBUG_FUNCPTR (<API key>)); <API key> (trans->sinkpad, GST_DEBUG_FUNCPTR (<API key>)); gst_element_add_pad (GST_ELEMENT (trans), trans->sinkpad); pad_template = <API key> (GST_ELEMENT_CLASS (bclass), "src"); g_return_if_fail (pad_template != NULL); trans->srcpad = <API key> (pad_template, "src"); <API key> (trans->srcpad, GST_DEBUG_FUNCPTR (<API key>)); <API key> (trans->srcpad, GST_DEBUG_FUNCPTR (<API key>)); <API key> (trans->srcpad, GST_DEBUG_FUNCPTR (<API key>)); <API key> (trans->srcpad, GST_DEBUG_FUNCPTR (<API key>)); <API key> (trans->srcpad, GST_DEBUG_FUNCPTR (<API key>)); <API key> (trans->srcpad, GST_DEBUG_FUNCPTR (<API key>)); <API key> (trans->srcpad, GST_DEBUG_FUNCPTR (<API key>)); <API key> (trans->srcpad, GST_DEBUG_FUNCPTR (<API key>)); gst_element_add_pad (GST_ELEMENT (trans), trans->srcpad); trans->transform_lock = g_mutex_new (); trans->pending_configure = FALSE; trans->priv->qos_enabled = DEFAULT_PROP_QOS; trans->cache_caps1 = NULL; trans->cache_caps2 = NULL; trans->priv->pad_mode = GST_ACTIVATE_NONE; trans->priv->gap_aware = FALSE; trans->passthrough = FALSE; if (bclass->transform == NULL) { /* If no transform function, always_in_place is TRUE */ GST_DEBUG_OBJECT (trans, "setting in_place TRUE"); trans->always_in_place = TRUE; if (bclass->transform_ip == NULL) { GST_DEBUG_OBJECT (trans, "setting passthrough TRUE"); trans->passthrough = TRUE; } } trans->priv->processed = 0; trans->priv->dropped = 0; } /* given @caps on the src or sink pad (given by @direction) * calculate the possible caps on the other pad. * * Returns new caps, unref after usage. */ static GstCaps * <API key> (GstBaseTransform * trans, GstPadDirection direction, GstCaps * caps) { GstCaps *ret; <API key> *klass; if (caps == NULL) return NULL; klass = <API key> (trans); /* if there is a custom transform function, use this */ if (klass->transform_caps) { GstCaps *temp; gint i; /* start with empty caps */ ret = gst_caps_new_empty (); GST_DEBUG_OBJECT (trans, "transform caps (direction = %d)", direction); if (gst_caps_is_any (caps)) { /* for any caps we still have to call the transform function */ GST_DEBUG_OBJECT (trans, "from: ANY"); temp = klass->transform_caps (trans, direction, caps); GST_DEBUG_OBJECT (trans, " to: %" GST_PTR_FORMAT, temp); temp = <API key> (temp); gst_caps_append (ret, temp); } else { gint n = gst_caps_get_size (caps); /* we send caps with just one structure to the transform * function as this is easier for the element */ for (i = 0; i < n; i++) { GstCaps *nth; nth = gst_caps_copy_nth (caps, i); GST_LOG_OBJECT (trans, "from[%d]: %" GST_PTR_FORMAT, i, nth); temp = klass->transform_caps (trans, direction, nth); gst_caps_unref (nth); GST_LOG_OBJECT (trans, " to[%d]: %" GST_PTR_FORMAT, i, temp); temp = <API key> (temp); /* here we need to only append those structures, that are not yet * in there, we use the merge function for this */ gst_caps_merge (ret, temp); GST_LOG_OBJECT (trans, " merged[%d]: %" GST_PTR_FORMAT, i, ret); } GST_LOG_OBJECT (trans, "merged: (%d)", gst_caps_get_size (ret)); /* FIXME: we can't do much simplification here because we don't really want to * change the caps order <API key> (ret); GST_DEBUG_OBJECT (trans, "simplified: (%d)", gst_caps_get_size (ret)); */ } } else { GST_DEBUG_OBJECT (trans, "identity from: %" GST_PTR_FORMAT, caps); /* no transform function, use the identity transform */ ret = gst_caps_ref (caps); } GST_DEBUG_OBJECT (trans, "to: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (ret), ret); return ret; } /* transform a buffer of @size with @caps on the pad with @direction to * the size of a buffer with @othercaps and store the result in @othersize * * We have two ways of doing this: * 1) use a custom transform size function, this is for complicated custom * cases with no fixed unit_size. * 2) use the unit_size functions where there is a relationship between the * caps and the size of a buffer. */ static gboolean <API key> (GstBaseTransform * trans, GstPadDirection direction, GstCaps * caps, guint size, GstCaps * othercaps, guint * othersize) { guint inunitsize, outunitsize, units; <API key> *klass; gboolean ret; klass = <API key> (trans); GST_DEBUG_OBJECT (trans, "asked to transform size %d for caps %" GST_PTR_FORMAT " to size for caps %" GST_PTR_FORMAT " in direction %s", size, caps, othercaps, direction == GST_PAD_SRC ? "SRC" : "SINK"); if (klass->transform_size) { /* if there is a custom transform function, use this */ ret = klass->transform_size (trans, direction, caps, size, othercaps, othersize); } else if (klass->get_unit_size == NULL) { /* if there is no transform_size and no unit_size, it means the * element does not modify the size of a buffer */ *othersize = size; ret = TRUE; } else { /* there is no transform_size function, we have to use the unit_size * functions. This method assumes there is a fixed unit_size associated with * each caps. We provide the same amount of units on both sides. */ if (!<API key> (trans, caps, &inunitsize)) goto no_in_size; GST_DEBUG_OBJECT (trans, "input size %d, input unit size %d", size, inunitsize); /* input size must be a multiple of the unit_size of the input caps */ if (inunitsize == 0 || (size % inunitsize != 0)) goto no_multiple; /* get the amount of units */ units = size / inunitsize; /* now get the unit size of the output */ if (!<API key> (trans, othercaps, &outunitsize)) goto no_out_size; /* the output size is the unit_size times the amount of units on the * input */ *othersize = units * outunitsize; GST_DEBUG_OBJECT (trans, "transformed size to %d", *othersize); ret = TRUE; } return ret; /* ERRORS */ no_in_size: { GST_DEBUG_OBJECT (trans, "could not get in_size"); g_warning ("%s: could not get in_size", GST_ELEMENT_NAME (trans)); return FALSE; } no_multiple: { GST_DEBUG_OBJECT (trans, "Size %u is not a multiple of unit size %u", size, inunitsize); g_warning ("%s: size %u is not a multiple of unit size %u", GST_ELEMENT_NAME (trans), size, inunitsize); return FALSE; } no_out_size: { GST_DEBUG_OBJECT (trans, "could not get out_size"); g_warning ("%s: could not get out_size", GST_ELEMENT_NAME (trans)); return FALSE; } } /* get the caps that can be handled by @pad. We perform: * * - take the caps of peer of otherpad, * - filter against the padtemplate of otherpad, * - calculate all transforms of remaining caps * - filter against template of @pad * * If there is no peer, we simply return the caps of the padtemplate of pad. */ static GstCaps * <API key> (GstPad * pad) { GstBaseTransform *trans; GstPad *otherpad; GstCaps *caps; trans = GST_BASE_TRANSFORM (gst_pad_get_parent (pad)); otherpad = (pad == trans->srcpad) ? trans->sinkpad : trans->srcpad; /* we can do what the peer can */ caps = <API key> (otherpad); if (caps) { GstCaps *temp; const GstCaps *templ; GST_DEBUG_OBJECT (pad, "peer caps %" GST_PTR_FORMAT, caps); /* filtered against our padtemplate on the other side */ templ = <API key> (otherpad); GST_DEBUG_OBJECT (pad, "our template %" GST_PTR_FORMAT, templ); temp = gst_caps_intersect (caps, templ); GST_DEBUG_OBJECT (pad, "intersected %" GST_PTR_FORMAT, temp); gst_caps_unref (caps); /* then see what we can transform this to */ caps = <API key> (trans, GST_PAD_DIRECTION (otherpad), temp); GST_DEBUG_OBJECT (pad, "transformed %" GST_PTR_FORMAT, caps); gst_caps_unref (temp); if (caps == NULL) goto done; /* and filter against the template of this pad */ templ = <API key> (pad); GST_DEBUG_OBJECT (pad, "our template %" GST_PTR_FORMAT, templ); temp = gst_caps_intersect (caps, templ); GST_DEBUG_OBJECT (pad, "intersected %" GST_PTR_FORMAT, temp); gst_caps_unref (caps); /* this is what we can do */ caps = temp; } else { /* no peer or the peer can do anything, our padtemplate is enough then */ caps = gst_caps_copy (<API key> (pad)); } done: GST_DEBUG_OBJECT (trans, "returning %" GST_PTR_FORMAT, caps); gst_object_unref (trans); return caps; } /* function triggered when the in and out caps are negotiated and need * to be configured in the subclass. */ static gboolean <API key> (GstBaseTransform * trans, GstCaps * in, GstCaps * out) { gboolean ret = TRUE; <API key> *klass; klass = <API key> (trans); GST_DEBUG_OBJECT (trans, "in caps: %" GST_PTR_FORMAT, in); GST_DEBUG_OBJECT (trans, "out caps: %" GST_PTR_FORMAT, out); /* clear the cache */ gst_caps_replace (&trans->cache_caps1, NULL); gst_caps_replace (&trans->cache_caps2, NULL); /* figure out same caps state */ trans->have_same_caps = gst_caps_is_equal (in, out); GST_DEBUG_OBJECT (trans, "have_same_caps: %d", trans->have_same_caps); /* If we've a transform_ip method and same input/output caps, set in_place * by default. If for some reason the sub-class prefers using a transform * function, it can clear the in place flag in the set_caps */ <API key> (trans, klass->transform_ip && trans->have_same_caps); /* Set the passthrough if the class wants <API key> * and we have the same caps on each pad */ if (klass-><API key>) <API key> (trans, trans->have_same_caps); /* now configure the element with the caps */ if (klass->set_caps) { GST_DEBUG_OBJECT (trans, "Calling set_caps method to setup caps"); ret = klass->set_caps (trans, in, out); } GST_OBJECT_LOCK (trans); /* make sure we reevaluate how the buffer_alloc works wrt to proxy allocating * the buffer. FIXME, this triggers some quite heavy codepaths that don't need * to be taken.. */ trans->priv->suggest_pending = TRUE; GST_OBJECT_UNLOCK (trans); trans->negotiated = ret; return ret; } /* check if caps @in on @pad can be transformed to @out on the other pad. * We don't have a vmethod to test this yet so we have to do a somewhat less * efficient check for this. */ static gboolean <API key> (GstBaseTransform * trans, GstPad * pad, GstCaps * in, GstCaps * out) { GstCaps *othercaps; /* convert the in caps to all possible out caps */ othercaps = <API key> (trans, GST_PAD_DIRECTION (pad), in); /* check if transform is empty */ if (!othercaps || gst_caps_is_empty (othercaps)) goto no_transform; /* check if the out caps is a subset of the othercaps */ if (!<API key> (out, othercaps)) goto no_subset; if (othercaps) gst_caps_unref (othercaps); GST_DEBUG_OBJECT (trans, "from %" GST_PTR_FORMAT, in); GST_DEBUG_OBJECT (trans, "to %" GST_PTR_FORMAT, out); return TRUE; /* ERRORS */ no_transform: { GST_DEBUG_OBJECT (trans, "transform returned useless %" GST_PTR_FORMAT, othercaps); if (othercaps) gst_caps_unref (othercaps); return FALSE; } no_subset: { GST_DEBUG_OBJECT (trans, "no subset"); if (othercaps) gst_caps_unref (othercaps); return FALSE; } } /* given a fixed @caps on @pad, create the best possible caps for the * other pad. * @caps must be fixed when calling this function. * * This function calls the transform caps vmethod of the basetransform to figure * out the possible target formats. It then tries to select the best format from * this list by: * * - attempt passthrough if the target caps is a superset of the input caps * - fixating by using peer caps * - fixating with transform fixate function * - fixating with pad fixate functions. * * this function returns a caps that can be transformed into and is accepted by * the peer element. */ static GstCaps * <API key> (GstBaseTransform * trans, GstPad * pad, GstCaps * caps) { <API key> *klass; GstPad *otherpad, *otherpeer; GstCaps *othercaps; gboolean peer_checked = FALSE; gboolean is_fixed; /* caps must be fixed here, this is a programming error if it's not */ <API key> (gst_caps_is_fixed (caps), NULL); klass = <API key> (trans); otherpad = (pad == trans->srcpad) ? trans->sinkpad : trans->srcpad; otherpeer = gst_pad_get_peer (otherpad); /* see how we can transform the input caps. We need to do this even for * passthrough because it might be possible that this element cannot support * passthrough at all. */ othercaps = <API key> (trans, GST_PAD_DIRECTION (pad), caps); /* The caps we can actually output is the intersection of the transformed * caps with the pad template for the pad */ if (othercaps) { GstCaps *intersect; const GstCaps *templ_caps; templ_caps = <API key> (otherpad); GST_DEBUG_OBJECT (trans, "intersecting against padtemplate %" GST_PTR_FORMAT, templ_caps); intersect = gst_caps_intersect (othercaps, templ_caps); gst_caps_unref (othercaps); othercaps = intersect; } /* check if transform is empty */ if (!othercaps || gst_caps_is_empty (othercaps)) goto no_transform; /* if the othercaps are not fixed, we need to fixate them, first attempt * is by attempting passthrough if the othercaps are a superset of caps. */ /* FIXME. maybe the caps is not fixed because it has multiple structures of * fixed caps */ is_fixed = gst_caps_is_fixed (othercaps); if (!is_fixed) { GST_DEBUG_OBJECT (trans, "transform returned non fixed %" GST_PTR_FORMAT, othercaps); /* see if the target caps are a superset of the source caps, in this * case we can try to perform passthrough */ if (<API key> (othercaps, caps)) { GST_DEBUG_OBJECT (trans, "try passthrough with %" GST_PTR_FORMAT, caps); if (otherpeer) { /* try passthrough. we know it's fixed, because caps is fixed */ if (gst_pad_accept_caps (otherpeer, caps)) { GST_DEBUG_OBJECT (trans, "peer accepted %" GST_PTR_FORMAT, caps); /* peer accepted unmodified caps, we free the original non-fixed * caps and work with the passthrough caps */ gst_caps_unref (othercaps); othercaps = gst_caps_ref (caps); is_fixed = TRUE; /* mark that we checked othercaps with the peer, this * makes sure we don't call accept_caps again with these same * caps */ peer_checked = TRUE; } else { GST_DEBUG_OBJECT (trans, "peer did not accept %" GST_PTR_FORMAT, caps); } } else { GST_DEBUG_OBJECT (trans, "no peer, doing passthrough"); gst_caps_unref (othercaps); othercaps = gst_caps_ref (caps); is_fixed = TRUE; } } } /* second attempt at fixation is done by intersecting with * the peer caps */ if (!is_fixed && otherpeer) { /* intersect against what the peer can do */ GstCaps *peercaps; GstCaps *intersect; GST_DEBUG_OBJECT (trans, "othercaps now %" GST_PTR_FORMAT, othercaps); peercaps = <API key> (otherpeer); intersect = gst_caps_intersect (peercaps, othercaps); gst_caps_unref (peercaps); gst_caps_unref (othercaps); othercaps = intersect; peer_checked = FALSE; is_fixed = gst_caps_is_fixed (othercaps); GST_DEBUG_OBJECT (trans, "filtering against peer yields %" GST_PTR_FORMAT, othercaps); } if (gst_caps_is_empty (othercaps)) goto <API key>; /* third attempt at fixation, call the fixate vmethod and * ultimately call the pad fixate function. */ if (!is_fixed) { GST_DEBUG_OBJECT (trans, "trying to fixate %" GST_PTR_FORMAT " on pad %s:%s", othercaps, GST_DEBUG_PAD_NAME (otherpad)); /* since we have no other way to fixate left, we might as well just take * the first of the caps list and fixate that */ /* FIXME: when fixating using the vmethod, it might make sense to fixate * each of the caps; but Wim doesn't see a use case for that yet */ gst_caps_truncate (othercaps); peer_checked = FALSE; if (klass->fixate_caps) { GST_DEBUG_OBJECT (trans, "trying to fixate %" GST_PTR_FORMAT " using caps %" GST_PTR_FORMAT " on pad %s:%s using fixate_caps vmethod", othercaps, caps, GST_DEBUG_PAD_NAME (otherpad)); klass->fixate_caps (trans, GST_PAD_DIRECTION (pad), caps, othercaps); is_fixed = gst_caps_is_fixed (othercaps); } /* if still not fixed, no other option but to let the default pad fixate * function do its job */ if (!is_fixed) { GST_DEBUG_OBJECT (trans, "trying to fixate %" GST_PTR_FORMAT " on pad %s:%s using gst_pad_fixate_caps", othercaps, GST_DEBUG_PAD_NAME (otherpad)); gst_pad_fixate_caps (otherpad, othercaps); is_fixed = gst_caps_is_fixed (othercaps); } GST_DEBUG_OBJECT (trans, "after fixating %" GST_PTR_FORMAT, othercaps); } else { GST_DEBUG ("caps are fixed"); /* else caps are fixed but the subclass may want to add fields */ if (klass->fixate_caps) { othercaps = <API key> (othercaps); GST_DEBUG_OBJECT (trans, "doing fixate %" GST_PTR_FORMAT " using caps %" GST_PTR_FORMAT " on pad %s:%s using fixate_caps vmethod", othercaps, caps, GST_DEBUG_PAD_NAME (otherpad)); klass->fixate_caps (trans, GST_PAD_DIRECTION (pad), caps, othercaps); is_fixed = gst_caps_is_fixed (othercaps); } } /* caps should be fixed now, if not we have to fail. */ if (!is_fixed) goto could_not_fixate; /* and peer should accept, don't check again if we already checked the * othercaps against the peer. */ if (!peer_checked && otherpeer && !gst_pad_accept_caps (otherpeer, othercaps)) goto peer_no_accept; GST_DEBUG_OBJECT (trans, "Input caps were %" GST_PTR_FORMAT ", and got final caps %" GST_PTR_FORMAT, caps, othercaps); if (otherpeer) gst_object_unref (otherpeer); return othercaps; /* ERRORS */ no_transform: { GST_DEBUG_OBJECT (trans, "transform returned useless %" GST_PTR_FORMAT, othercaps); goto error_cleanup; } <API key>: { GST_DEBUG_OBJECT (trans, "transform could not transform %" GST_PTR_FORMAT " in anything we support", caps); goto error_cleanup; } could_not_fixate: { GST_DEBUG_OBJECT (trans, "FAILED to fixate %" GST_PTR_FORMAT, othercaps); goto error_cleanup; } peer_no_accept: { GST_DEBUG_OBJECT (trans, "FAILED to get peer of %" GST_PTR_FORMAT " to accept %" GST_PTR_FORMAT, otherpad, othercaps); goto error_cleanup; } error_cleanup: { if (otherpeer) gst_object_unref (otherpeer); if (othercaps) gst_caps_unref (othercaps); return NULL; } } static gboolean <API key> (GstBaseTransform * trans, GstPadDirection direction, GstCaps * caps) { #if 0 GstPad *otherpad; GstCaps *othercaps = NULL; #endif gboolean ret = TRUE; #if 0 otherpad = (pad == trans->srcpad) ? trans->sinkpad : trans->srcpad; /* we need fixed caps for the check, fall back to the default implementation * if we don't */ if (!gst_caps_is_fixed (caps)) #endif { GstCaps *allowed; GST_DEBUG_OBJECT (trans, "non fixed accept caps %" GST_PTR_FORMAT, caps); /* get all the formats we can handle on this pad */ if (direction == GST_PAD_SRC) allowed = <API key> (trans->srcpad); else allowed = <API key> (trans->sinkpad); if (!allowed) { GST_DEBUG_OBJECT (trans, "gst_pad_get_caps() failed"); goto <API key>; } GST_DEBUG_OBJECT (trans, "allowed caps %" GST_PTR_FORMAT, allowed); /* intersect with the requested format */ ret = <API key> (allowed, caps); gst_caps_unref (allowed); if (!ret) goto <API key>; } #if 0 else { GST_DEBUG_OBJECT (pad, "accept caps %" GST_PTR_FORMAT, caps); /* find best possible caps for the other pad as a way to see if we can * transform this caps. */ othercaps = <API key> (trans, pad, caps); if (!othercaps || gst_caps_is_empty (othercaps)) goto <API key>; GST_DEBUG_OBJECT (pad, "we can transform to %" GST_PTR_FORMAT, othercaps); } #endif done: #if 0 /* We know it's always NULL since we never use it */ if (othercaps) gst_caps_unref (othercaps); #endif return ret; /* ERRORS */ <API key>: { GST_DEBUG_OBJECT (trans, "transform could not transform %" GST_PTR_FORMAT " in anything we support", caps); ret = FALSE; goto done; } } static gboolean <API key> (GstPad * pad, GstCaps * caps) { gboolean ret = TRUE; GstBaseTransform *trans; <API key> *bclass; trans = GST_BASE_TRANSFORM (gst_pad_get_parent (pad)); bclass = <API key> (trans); if (bclass->accept_caps) ret = bclass->accept_caps (trans, GST_PAD_DIRECTION (pad), caps); gst_object_unref (trans); return ret; } /* called when new caps arrive on the sink or source pad, * We try to find the best caps for the other side using our _find_transform() * function. If there are caps, we configure the transform for this new * transformation. * * FIXME, this function is currently commutative but this should not really be * because we never set caps starting from the srcpad. */ static gboolean <API key> (GstPad * pad, GstCaps * caps) { GstBaseTransform *trans; GstPad *otherpad, *otherpeer; GstCaps *othercaps = NULL; gboolean ret = TRUE; GstCaps *incaps, *outcaps; trans = GST_BASE_TRANSFORM (gst_pad_get_parent (pad)); otherpad = (pad == trans->srcpad) ? trans->sinkpad : trans->srcpad; otherpeer = gst_pad_get_peer (otherpad); /* if we get called recursively, we bail out now to avoid an * infinite loop. */ if (<API key> (otherpad)) goto done; GST_DEBUG_OBJECT (pad, "have new caps %p %" GST_PTR_FORMAT, caps, caps); /* find best possible caps for the other pad */ othercaps = <API key> (trans, pad, caps); if (!othercaps || gst_caps_is_empty (othercaps)) goto <API key>; /* configure the element now */ /* make sure in and out caps are correct */ if (pad == trans->sinkpad) { incaps = caps; outcaps = othercaps; } else { incaps = othercaps; outcaps = caps; } /* if we have the same caps, we can optimize and reuse the input caps */ if (gst_caps_is_equal (incaps, outcaps)) { GST_INFO_OBJECT (trans, "reuse caps"); gst_caps_unref (othercaps); outcaps = othercaps = gst_caps_ref (incaps); } /* call configure now */ if (!(ret = <API key> (trans, incaps, outcaps))) goto failed_configure; /* we know this will work, we implement the setcaps */ gst_pad_set_caps (otherpad, othercaps); if (pad == trans->srcpad && trans->priv->pad_mode == GST_ACTIVATE_PULL) { /* FIXME hm? */ ret &= gst_pad_set_caps (otherpeer, othercaps); if (!ret) { GST_INFO_OBJECT (trans, "otherpeer setcaps(%" GST_PTR_FORMAT ") failed", othercaps); } } done: if (otherpeer) gst_object_unref (otherpeer); if (othercaps) gst_caps_unref (othercaps); trans->negotiated = ret; gst_object_unref (trans); return ret; /* ERRORS */ <API key>: { GST_WARNING_OBJECT (trans, "transform could not transform %" GST_PTR_FORMAT " in anything we support", caps); ret = FALSE; goto done; } failed_configure: { GST_WARNING_OBJECT (trans, "FAILED to configure caps %" GST_PTR_FORMAT " to accept %" GST_PTR_FORMAT, otherpad, othercaps); ret = FALSE; goto done; } } static gboolean <API key> (GstPad * pad, GstQuery * query) { gboolean ret = FALSE; GstBaseTransform *trans = GST_BASE_TRANSFORM (gst_pad_get_parent (pad)); GstPad *otherpad = (pad == trans->srcpad) ? trans->sinkpad : trans->srcpad; switch (GST_QUERY_TYPE (query)) { case GST_QUERY_POSITION:{ GstFormat format; <API key> (query, &format, NULL); if (format == GST_FORMAT_TIME && trans->segment.format == GST_FORMAT_TIME) { gint64 pos; ret = TRUE; if ((pad == trans->sinkpad) || (trans->priv->last_stop_out == GST_CLOCK_TIME_NONE)) { pos = <API key> (&trans->segment, GST_FORMAT_TIME, trans->segment.last_stop); } else { pos = <API key> (&trans->segment, GST_FORMAT_TIME, trans->priv->last_stop_out); } <API key> (query, format, pos); } else { ret = gst_pad_peer_query (otherpad, query); } break; } default: ret = gst_pad_peer_query (otherpad, query); break; } gst_object_unref (trans); return ret; } static const GstQueryType * <API key> (GstPad * pad) { static const GstQueryType types[] = { GST_QUERY_POSITION, GST_QUERY_NONE }; return types; } static void <API key> (GstBaseTransform * trans, guint expsize, GstCaps * caps) { GstCaps *othercaps; <API key> *priv = trans->priv; GST_DEBUG_OBJECT (trans, "trying to find upstream suggestion"); /* we cannot convert the current buffer but we might be able to suggest a * new format upstream, try to find what the best format is. */ othercaps = <API key> (trans, trans->srcpad, caps); if (!othercaps) { GST_DEBUG_OBJECT (trans, "incompatible caps, ignoring"); /* we received caps that we cannot transform. Upstream is behaving badly * because it should have checked if we could handle these caps. We can * simply ignore these caps and produce a buffer with our original caps. */ } else { guint size_suggest; GST_DEBUG_OBJECT (trans, "getting size of suggestion"); /* not a subset, we have a new upstream suggestion, remember it and * allocate a default buffer. First we try to convert the size */ if (<API key> (trans, GST_PAD_SRC, caps, expsize, othercaps, &size_suggest)) { /* ok, remember the suggestions now */ GST_DEBUG_OBJECT (trans, "storing new caps and size suggestion of %u and %" GST_PTR_FORMAT, size_suggest, othercaps); GST_OBJECT_LOCK (trans->sinkpad); if (priv->sink_suggest) gst_caps_unref (priv->sink_suggest); priv->sink_suggest = gst_caps_ref (othercaps); priv->size_suggest = size_suggest; trans->priv->suggest_pending = TRUE; GST_OBJECT_UNLOCK (trans->sinkpad); } gst_caps_unref (othercaps); } } /* Allocate a buffer using <API key> * * This function can do renegotiation on the source pad * * The output buffer is always writable. outbuf can be equal to * inbuf, the caller should be prepared for this and perform * appropriate refcounting. */ static GstFlowReturn <API key> (GstBaseTransform * trans, GstBuffer * in_buf, GstBuffer ** out_buf) { <API key> *bclass; <API key> *priv; GstFlowReturn ret = GST_FLOW_OK; guint outsize, newsize, expsize; gboolean discard, setcaps, copymeta; GstCaps *incaps, *oldcaps, *newcaps, *outcaps; bclass = <API key> (trans); priv = trans->priv; *out_buf = NULL; /* figure out how to allocate a buffer based on the current configuration */ if (trans->passthrough) { GST_DEBUG_OBJECT (trans, "doing passthrough alloc"); /* passthrough, we don't really need to call pad alloc but we still need to * in order to get upstream negotiation. The output size is the same as the * input size. */ outsize = GST_BUFFER_SIZE (in_buf); /* we always alloc and discard here */ discard = TRUE; } else { gboolean want_in_place = (bclass->transform_ip != NULL) && trans->always_in_place; if (want_in_place) { GST_DEBUG_OBJECT (trans, "doing inplace alloc"); /* we alloc a buffer of the same size as the input */ outsize = GST_BUFFER_SIZE (in_buf); /* only discard it when the input was not writable, otherwise, we reuse * the input buffer. */ discard = <API key> (in_buf); GST_DEBUG_OBJECT (trans, "discard: %d", discard); } else { GST_DEBUG_OBJECT (trans, "getting output size for copy transform"); /* copy transform, figure out the output size */ if (!<API key> (trans, GST_PAD_SINK, GST_PAD_CAPS (trans->sinkpad), GST_BUFFER_SIZE (in_buf), GST_PAD_CAPS (trans->srcpad), &outsize)) { goto unknown_size; } /* never discard this buffer, we need it for storing the output */ discard = FALSE; } } oldcaps = GST_PAD_CAPS (trans->srcpad); if (bclass-><API key>) { GST_DEBUG_OBJECT (trans, "calling prepare buffer with caps %p %" GST_PTR_FORMAT, oldcaps, oldcaps); ret = bclass-><API key> (trans, in_buf, outsize, oldcaps, out_buf); /* get a new ref to the srcpad caps, the <API key> function can * update the pad caps if it wants */ oldcaps = GST_PAD_CAPS (trans->srcpad); /* FIXME 0.11: * decrease refcount again if vmethod returned refcounted in_buf. This * is because we need to make sure that the buffer is writable for the * in_place transform. The docs of the vmethod say that you should return * a reffed inbuf, which is exactly what we don't want :), oh well.. */ if (in_buf == *out_buf) gst_buffer_unref (in_buf); /* never discard the buffer from the prepare_buffer method */ if (*out_buf != NULL) discard = FALSE; } if (ret != GST_FLOW_OK) goto alloc_failed; if (*out_buf == NULL) { GST_DEBUG_OBJECT (trans, "doing alloc with caps %" GST_PTR_FORMAT, oldcaps); ret = <API key> (trans->srcpad, GST_BUFFER_OFFSET (in_buf), outsize, oldcaps, out_buf); if (ret != GST_FLOW_OK) goto alloc_failed; } /* must always have a buffer by now */ if (*out_buf == NULL) goto no_buffer; /* check if we got different caps on this new output buffer */ newcaps = GST_BUFFER_CAPS (*out_buf); newsize = GST_BUFFER_SIZE (*out_buf); if (newcaps && !gst_caps_is_equal (newcaps, oldcaps)) { GstCaps *othercaps; gboolean can_convert; GST_DEBUG_OBJECT (trans, "received new caps %" GST_PTR_FORMAT, newcaps); incaps = GST_PAD_CAPS (trans->sinkpad); /* check if we can convert the current incaps to the new target caps */ can_convert = <API key> (trans, trans->sinkpad, incaps, newcaps); if (!can_convert) { GST_DEBUG_OBJECT (trans, "cannot perform transform on current buffer"); <API key> (trans, GST_PAD_SINK, incaps, GST_BUFFER_SIZE (in_buf), newcaps, &expsize); <API key> (trans, expsize, newcaps); /* we got a suggested caps but we can't transform to it. See if there is * another downstream format that we can transform to */ othercaps = <API key> (trans, trans->sinkpad, incaps); if (othercaps && !gst_caps_is_empty (othercaps)) { GST_DEBUG_OBJECT (trans, "we found target caps %" GST_PTR_FORMAT, othercaps); *out_buf = <API key> (*out_buf); gst_buffer_set_caps (*out_buf, othercaps); gst_caps_unref (othercaps); newcaps = GST_BUFFER_CAPS (*out_buf); can_convert = TRUE; } else if (othercaps) gst_caps_unref (othercaps); } /* it's possible that the buffer we got is of the wrong size, get the * expected size here, we will check the size if we are going to use the * buffer later on. */ <API key> (trans, GST_PAD_SINK, incaps, GST_BUFFER_SIZE (in_buf), newcaps, &expsize); if (can_convert) { GST_DEBUG_OBJECT (trans, "reconfigure transform for current buffer"); /* subclass might want to add fields to the caps */ if (bclass->fixate_caps != NULL) { newcaps = gst_caps_copy (newcaps); GST_DEBUG_OBJECT (trans, "doing fixate %" GST_PTR_FORMAT " using caps %" GST_PTR_FORMAT " on pad %s:%s using fixate_caps vmethod", newcaps, incaps, GST_DEBUG_PAD_NAME (trans->srcpad)); bclass->fixate_caps (trans, GST_PAD_SINK, incaps, newcaps); *out_buf = <API key> (*out_buf); gst_buffer_set_caps (*out_buf, newcaps); gst_caps_unref (newcaps); newcaps = GST_BUFFER_CAPS (*out_buf); } /* caps not empty, try to renegotiate to the new format */ if (!<API key> (trans, incaps, newcaps)) { /* not sure we need to fail hard here, we can simply continue our * conversion with what we negotiated before */ goto failed_configure; } /* new format configure, and use the new output buffer */ gst_pad_set_caps (trans->srcpad, newcaps); discard = FALSE; /* clear previous cached sink-pad caps, so buffer_alloc knows that * it needs to revisit the decision about whether to proxy or not: */ gst_caps_replace (&priv->sink_alloc, NULL); /* if we got a buffer of the wrong size, discard it now and make sure we * allocate a propertly sized buffer later. */ if (newsize != expsize) { if (in_buf != *out_buf) gst_buffer_unref (*out_buf); *out_buf = NULL; } outsize = expsize; } else { <API key> (trans, expsize, newcaps); if (in_buf != *out_buf) gst_buffer_unref (*out_buf); *out_buf = NULL; } } else if (outsize != newsize) { GST_WARNING_OBJECT (trans, "Caps did not change but allocated size does " "not match expected size (%d != %d)", newsize, outsize); if (in_buf != *out_buf) gst_buffer_unref (*out_buf); *out_buf = NULL; } /* these are the final output caps */ outcaps = GST_PAD_CAPS (trans->srcpad); copymeta = FALSE; if (*out_buf == NULL) { if (!discard) { GST_DEBUG_OBJECT (trans, "make default output buffer of size %d", outsize); /* no valid buffer yet, make one, metadata is writable */ *out_buf = <API key> (outsize); <API key> (*out_buf, in_buf, <API key> | <API key>); } else { GST_DEBUG_OBJECT (trans, "reuse input buffer"); *out_buf = in_buf; } } else { if (trans->passthrough && in_buf != *out_buf) { /* we are asked to perform a passthrough transform but the input and * output buffers are different. We have to discard the output buffer and * reuse the input buffer. */ GST_DEBUG_OBJECT (trans, "passthrough but different buffers"); discard = TRUE; } if (discard) { GST_DEBUG_OBJECT (trans, "discard buffer, reuse input buffer"); gst_buffer_unref (*out_buf); *out_buf = in_buf; } else { GST_DEBUG_OBJECT (trans, "using allocated buffer in %p, out %p", in_buf, *out_buf); /* if we have different buffers, check if the metadata is ok */ if (*out_buf != in_buf) { guint mask; mask = <API key> | <API key> | <API key> | <API key> | GST_BUFFER_FLAG_GAP | <API key> | <API key> | <API key>; /* see if the flags and timestamps match */ copymeta = (<API key> (*out_buf) & mask) == (<API key> (in_buf) & mask); copymeta |= <API key> (*out_buf) != <API key> (in_buf) || GST_BUFFER_DURATION (*out_buf) != GST_BUFFER_DURATION (in_buf) || GST_BUFFER_OFFSET (*out_buf) != GST_BUFFER_OFFSET (in_buf) || <API key> (*out_buf) != <API key> (in_buf); } } } /* check if we need to make things writable. We need this when we need to * update the caps or the metadata on the output buffer. */ newcaps = GST_BUFFER_CAPS (*out_buf); /* we check the pointers as a quick check and then go to the more involved * check. This is needed when we receive different pointers on the sinkpad * that mean the same caps. What we then want to do is prefer those caps over * the ones on the srcpad and set the srcpad caps to the buffer caps */ setcaps = !newcaps || ((newcaps != outcaps) && (!gst_caps_is_equal (newcaps, outcaps))); /* we need to modify the metadata when the element is not gap aware, * passthrough is not used and the gap flag is set */ copymeta |= !trans->priv->gap_aware && !trans->passthrough && (<API key> (*out_buf) & GST_BUFFER_FLAG_GAP); if (setcaps || copymeta) { GST_DEBUG_OBJECT (trans, "setcaps %d, copymeta %d", setcaps, copymeta); if (!<API key> (*out_buf)) { GST_DEBUG_OBJECT (trans, "buffer metadata %p not writable", *out_buf); if (in_buf == *out_buf) *out_buf = <API key> (in_buf, 0, GST_BUFFER_SIZE (in_buf)); else *out_buf = <API key> (*out_buf); } /* when we get here, the metadata should be writable */ if (setcaps) gst_buffer_set_caps (*out_buf, outcaps); if (copymeta) <API key> (*out_buf, in_buf, <API key> | <API key>); /* clear the GAP flag when the subclass does not understand it */ if (!trans->priv->gap_aware) <API key> (*out_buf, GST_BUFFER_FLAG_GAP); } return ret; /* ERRORS */ alloc_failed: { GST_WARNING_OBJECT (trans, "pad-alloc failed: %s", gst_flow_get_name (ret)); return ret; } no_buffer: { GST_ELEMENT_ERROR (trans, STREAM, NOT_IMPLEMENTED, ("Sub-class failed to provide an output buffer"), (NULL)); return GST_FLOW_ERROR; } unknown_size: { GST_ERROR_OBJECT (trans, "unknown output size"); return GST_FLOW_ERROR; } failed_configure: { GST_WARNING_OBJECT (trans, "failed to configure caps"); return <API key>; } } /* Given @caps calcultate the size of one unit. * * For video caps, this is the size of one frame (and thus one buffer). * For audio caps, this is the size of one sample. * * These values are cached since they do not change and the calculation * potentially involves parsing caps and other expensive stuff. * * We have two cache locations to store the size, one for the source caps * and one for the sink caps. * * this function returns FALSE if no size could be calculated. */ static gboolean <API key> (GstBaseTransform * trans, GstCaps * caps, guint * size) { gboolean res = FALSE; <API key> *bclass; /* see if we have the result cached */ if (trans->cache_caps1 == caps) { *size = trans->cache_caps1_size; GST_DEBUG_OBJECT (trans, "returned %d from first cache", *size); return TRUE; } if (trans->cache_caps2 == caps) { *size = trans->cache_caps2_size; GST_DEBUG_OBJECT (trans, "returned %d from second cached", *size); return TRUE; } bclass = <API key> (trans); if (bclass->get_unit_size) { res = bclass->get_unit_size (trans, caps, size); GST_DEBUG_OBJECT (trans, "caps %" GST_PTR_FORMAT ") has unit size %d, result %s", caps, *size, res ? "TRUE" : "FALSE"); if (res) { /* and cache the values */ if (trans->cache_caps1 == NULL) { gst_caps_replace (&trans->cache_caps1, caps); trans->cache_caps1_size = *size; GST_DEBUG_OBJECT (trans, "caching %d in first cache", *size); } else if (trans->cache_caps2 == NULL) { gst_caps_replace (&trans->cache_caps2, caps); trans->cache_caps2_size = *size; GST_DEBUG_OBJECT (trans, "caching %d in second cache", *size); } else { GST_DEBUG_OBJECT (trans, "no free spot to cache unit_size"); } } } else { GST_DEBUG_OBJECT (trans, "Sub-class does not implement get_unit_size"); } return res; } /* your upstream peer wants to send you a buffer * that buffer has the given offset, size and caps * you're requested to allocate a buffer */ static GstFlowReturn <API key> (GstPad * pad, guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf) { GstBaseTransform *trans; <API key> *klass; <API key> *priv; GstFlowReturn res; gboolean proxy, suggest, same_caps; GstCaps *sink_suggest = NULL; guint size_suggest; trans = GST_BASE_TRANSFORM (gst_pad_get_parent (pad)); klass = <API key> (trans); priv = trans->priv; GST_DEBUG_OBJECT (pad, "alloc with caps %p %" GST_PTR_FORMAT ", size %u", caps, caps, size); /* if the code below does not come up with a better buffer, we will return _OK * and an empty buffer. This will trigger the core to allocate a buffer with * given input size and caps. */ *buf = NULL; res = GST_FLOW_OK; /* we remember our previous alloc request to quickly see if we can proxy or * not. We skip this check if we have a pending suggestion. */ GST_OBJECT_LOCK (pad); same_caps = !priv->suggest_pending && caps && gst_caps_is_equal (priv->sink_alloc, caps); GST_OBJECT_UNLOCK (pad); if (same_caps) { /* we have seen this before, see below if we need to proxy */ GST_DEBUG_OBJECT (trans, "have old caps %p, size %u", caps, size); gst_caps_replace (&sink_suggest, caps); size_suggest = size; suggest = FALSE; } else { GST_DEBUG_OBJECT (trans, "new format %p %" GST_PTR_FORMAT, caps, caps); /* if we have a suggestion, pretend we got these as input */ GST_OBJECT_LOCK (pad); if ((priv->sink_suggest && !gst_caps_is_equal (caps, priv->sink_suggest))) { sink_suggest = gst_caps_ref (priv->sink_suggest); size_suggest = priv->size_suggest; GST_DEBUG_OBJECT (trans, "have suggestion %p %" GST_PTR_FORMAT " size %u", sink_suggest, sink_suggest, priv->size_suggest); /* suggest is TRUE when we have a custom suggestion pending that we need * to unref later. */ suggest = TRUE; } else { GST_DEBUG_OBJECT (trans, "using caps %p %" GST_PTR_FORMAT " size %u", caps, caps, size); gst_caps_replace (&sink_suggest, caps); size_suggest = size; suggest = FALSE; } priv->suggest_pending = FALSE; GST_OBJECT_UNLOCK (pad); /* check if we actually handle this format on the sinkpad */ if (sink_suggest) { const GstCaps *templ; if (!gst_caps_is_fixed (sink_suggest)) { GstCaps *peercaps; GST_DEBUG_OBJECT (trans, "Suggested caps is not fixed: %" GST_PTR_FORMAT, sink_suggest); peercaps = <API key> (<API key> (trans)); /* try fixating by intersecting with peer caps */ if (peercaps) { GstCaps *intersect; intersect = gst_caps_intersect (peercaps, sink_suggest); gst_caps_unref (peercaps); gst_caps_unref (sink_suggest); sink_suggest = intersect; } if (gst_caps_is_empty (sink_suggest)) goto not_supported; /* be safe and call default fixate */ sink_suggest = <API key> (sink_suggest); gst_pad_fixate_caps (<API key> (trans), sink_suggest); if (!gst_caps_is_fixed (sink_suggest)) { gst_caps_unref (sink_suggest); sink_suggest = NULL; } GST_DEBUG_OBJECT (trans, "Caps fixed to: %" GST_PTR_FORMAT, sink_suggest); } if (sink_suggest) { templ = <API key> (pad); if (!<API key> (sink_suggest, templ)) { GstCaps *allowed; GstCaps *peercaps; GST_DEBUG_OBJECT (trans, "Requested pad alloc caps are not supported: %" GST_PTR_FORMAT, sink_suggest); /* the requested pad alloc caps are not supported, so let's try * picking something allowed between the pads (they are linked, * there must be something) */ allowed = <API key> (pad); if (allowed && !gst_caps_is_empty (allowed)) { GST_DEBUG_OBJECT (trans, "pads could agree on one of the following caps: " "%" GST_PTR_FORMAT, allowed); allowed = <API key> (allowed); if (klass->fixate_caps) { peercaps = <API key> (<API key> (trans)); klass->fixate_caps (trans, GST_PAD_SRC, peercaps, allowed); gst_caps_unref (peercaps); } /* Fixate them to be safe if the subclass didn't do it */ gst_caps_truncate (allowed); gst_pad_fixate_caps (pad, allowed); gst_caps_replace (&sink_suggest, allowed); gst_caps_unref (allowed); suggest = TRUE; GST_DEBUG_OBJECT (trans, "Fixated suggestion caps to %" GST_PTR_FORMAT, sink_suggest); } else { if (allowed) gst_caps_unref (allowed); goto not_supported; } } } } /* find the best format for the other side here we decide if we will proxy * the caps or not. */ if (sink_suggest == NULL) { /* always proxy when the caps are NULL. When this is a new format, see if * we can proxy it downstream */ GST_DEBUG_OBJECT (trans, "null caps, marking for proxy"); priv->proxy_alloc = TRUE; } else { GstCaps *othercaps; /* we have a new format, see what we need to proxy to */ othercaps = <API key> (trans, pad, sink_suggest); if (!othercaps || gst_caps_is_empty (othercaps)) { /* no transform possible, we certainly can't proxy */ GST_DEBUG_OBJECT (trans, "can't find transform, disable proxy"); priv->proxy_alloc = FALSE; } else { /* we transformed into something */ if (gst_caps_is_equal (sink_suggest, othercaps)) { GST_DEBUG_OBJECT (trans, "best caps same as input, marking for proxy"); priv->proxy_alloc = TRUE; } else { GST_DEBUG_OBJECT (trans, "best caps different from input, disable proxy"); priv->proxy_alloc = FALSE; } } if (othercaps) gst_caps_unref (othercaps); } } /* remember the new caps */ GST_OBJECT_LOCK (pad); gst_caps_replace (&priv->sink_alloc, sink_suggest); GST_OBJECT_UNLOCK (pad); proxy = priv->proxy_alloc; GST_DEBUG_OBJECT (trans, "doing default alloc, proxy %d, suggest %d", proxy, suggest); /* we only want to proxy if we have no suggestion pending, FIXME */ if (proxy && !suggest) { GstCaps *newcaps; GST_DEBUG_OBJECT (trans, "proxy buffer-alloc with caps %p %" GST_PTR_FORMAT ", size %u", caps, caps, size); /* we always proxy the input caps, never the suggestion. The reason is that * We don't yet handle the caps of renegotiation in here. FIXME */ res = <API key> (trans->srcpad, offset, size, caps, buf); if (res != GST_FLOW_OK) goto alloc_failed; /* check if the caps changed */ newcaps = GST_BUFFER_CAPS (*buf); GST_DEBUG_OBJECT (trans, "got caps %" GST_PTR_FORMAT, newcaps); if (!gst_caps_is_equal (newcaps, caps)) { GST_DEBUG_OBJECT (trans, "caps are new"); /* we have new caps, see if we can proxy downstream */ if (<API key> (pad, newcaps)) { /* peer accepts the caps, return a buffer in this format */ GST_DEBUG_OBJECT (trans, "peer accepted new caps"); /* remember the format */ GST_OBJECT_LOCK (pad); gst_caps_replace (&priv->sink_alloc, newcaps); GST_OBJECT_UNLOCK (pad); } else { GST_DEBUG_OBJECT (trans, "peer did not accept new caps"); /* peer does not accept the caps, disable proxy_alloc, free the * buffer we received and create a buffer of the requested format * by the default handler. */ GST_DEBUG_OBJECT (trans, "disabling proxy"); priv->proxy_alloc = FALSE; gst_buffer_unref (*buf); *buf = NULL; } } else { GST_DEBUG_OBJECT (trans, "received required caps from peer"); } } if (suggest) { /* there was a custom suggestion, create a buffer of this format and return * it. Note that this format */ *buf = <API key> (size_suggest); GST_DEBUG_OBJECT (trans, "doing suggestion of size %u, caps %p %" GST_PTR_FORMAT, size_suggest, sink_suggest, sink_suggest); GST_BUFFER_CAPS (*buf) = sink_suggest; sink_suggest = NULL; } gst_object_unref (trans); if (sink_suggest) gst_caps_unref (sink_suggest); return res; /* ERRORS */ alloc_failed: { GST_DEBUG_OBJECT (trans, "pad alloc failed: %s", gst_flow_get_name (res)); if (sink_suggest) gst_caps_unref (sink_suggest); gst_object_unref (trans); return res; } not_supported: { GST_DEBUG_OBJECT (trans, "pad alloc with unsupported caps"); if (sink_suggest) gst_caps_unref (sink_suggest); gst_object_unref (trans); return <API key>; } } static gboolean <API key> (GstPad * pad, GstEvent * event) { GstBaseTransform *trans; <API key> *bclass; gboolean ret = TRUE; gboolean forward = TRUE; trans = GST_BASE_TRANSFORM (gst_pad_get_parent (pad)); bclass = <API key> (trans); if (bclass->event) forward = bclass->event (trans, event); /* FIXME, do this in the default event handler so the subclass can do * something different. */ if (forward) ret = gst_pad_push_event (trans->srcpad, event); else gst_event_unref (event); gst_object_unref (trans); return ret; } static gboolean <API key> (GstBaseTransform * trans, GstEvent * event) { switch (GST_EVENT_TYPE (event)) { case <API key>: break; case <API key>: GST_OBJECT_LOCK (trans); /* reset QoS parameters */ trans->priv->proportion = 1.0; trans->priv->earliest_time = -1; trans->priv->discont = FALSE; trans->priv->processed = 0; trans->priv->dropped = 0; GST_OBJECT_UNLOCK (trans); /* we need new segment info after the flush. */ trans->have_newsegment = FALSE; gst_segment_init (&trans->segment, <API key>); trans->priv->last_stop_out = GST_CLOCK_TIME_NONE; break; case GST_EVENT_EOS: break; case GST_EVENT_TAG: break; case <API key>: { GstFormat format; gdouble rate, arate; gint64 start, stop, time; gboolean update; <API key> (event, &update, &rate, &arate, &format, &start, &stop, &time); trans->have_newsegment = TRUE; <API key> (&trans->segment, update, rate, arate, format, start, stop, time); if (format == GST_FORMAT_TIME) { GST_DEBUG_OBJECT (trans, "received TIME NEW_SEGMENT %" GST_TIME_FORMAT " -- %" GST_TIME_FORMAT ", time %" GST_TIME_FORMAT ", accum %" GST_TIME_FORMAT, GST_TIME_ARGS (trans->segment.start), GST_TIME_ARGS (trans->segment.stop), GST_TIME_ARGS (trans->segment.time), GST_TIME_ARGS (trans->segment.accum)); } else { GST_DEBUG_OBJECT (trans, "received NEW_SEGMENT %" G_GINT64_FORMAT " -- %" G_GINT64_FORMAT ", time %" G_GINT64_FORMAT ", accum %" G_GINT64_FORMAT, trans->segment.start, trans->segment.stop, trans->segment.time, trans->segment.accum); } break; } default: break; } return TRUE; } static gboolean <API key> (GstPad * pad, GstEvent * event) { GstBaseTransform *trans; <API key> *bclass; gboolean ret = TRUE; trans = GST_BASE_TRANSFORM (gst_pad_get_parent (pad)); bclass = <API key> (trans); if (bclass->src_event) ret = bclass->src_event (trans, event); gst_object_unref (trans); return ret; } static gboolean <API key> (GstBaseTransform * trans, GstEvent * event) { gboolean ret; GST_DEBUG_OBJECT (trans, "handling event %p %" GST_PTR_FORMAT, event, event); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_SEEK: break; case <API key>: break; case GST_EVENT_QOS: { gdouble proportion; GstClockTimeDiff diff; GstClockTime timestamp; gst_event_parse_qos (event, &proportion, &diff, &timestamp); <API key> (trans, proportion, diff, timestamp); break; } default: break; } ret = gst_pad_push_event (trans->sinkpad, event); return ret; } /* perform a transform on @inbuf and put the result in @outbuf. * * This function is common to the push and pull-based operations. * * This function takes ownership of @inbuf */ static GstFlowReturn <API key> (GstBaseTransform * trans, GstBuffer * inbuf, GstBuffer ** outbuf) { <API key> *bclass; GstFlowReturn ret = GST_FLOW_OK; gboolean want_in_place, reconfigure; GstClockTime running_time; GstClockTime timestamp; GstCaps *incaps; bclass = <API key> (trans); if (G_LIKELY ((incaps = GST_BUFFER_CAPS (inbuf)))) { GST_OBJECT_LOCK (trans); reconfigure = trans->priv->reconfigure; trans->priv->reconfigure = FALSE; GST_OBJECT_UNLOCK (trans); if (G_UNLIKELY (reconfigure)) { GST_DEBUG_OBJECT (trans, "we had a pending reconfigure"); /* if we need to reconfigure we pretend a buffer with new caps arrived. This * will reconfigure the transform with the new output format. We can only * do this if the buffer actually has caps. */ if (!<API key> (trans->sinkpad, incaps)) goto not_negotiated; } } if (<API key> (inbuf)) GST_DEBUG_OBJECT (trans, "handling buffer %p of size %d and offset %" G_GUINT64_FORMAT, inbuf, GST_BUFFER_SIZE (inbuf), GST_BUFFER_OFFSET (inbuf)); else GST_DEBUG_OBJECT (trans, "handling buffer %p of size %d and offset NONE", inbuf, GST_BUFFER_SIZE (inbuf)); /* Don't allow buffer handling before negotiation, except in passthrough mode * or if the class doesn't implement a set_caps function (in which case it doesn't * care about caps) */ if (!trans->negotiated && !trans->passthrough && (bclass->set_caps != NULL)) goto not_negotiated; /* Set discont flag so we can mark the outgoing buffer */ if (<API key> (inbuf)) { GST_DEBUG_OBJECT (trans, "got DISCONT buffer %p", inbuf); trans->priv->discont = TRUE; } /* can only do QoS if the segment is in TIME */ if (trans->segment.format != GST_FORMAT_TIME) goto no_qos; /* QOS is done on the running time of the buffer, get it now */ timestamp = <API key> (inbuf); running_time = <API key> (&trans->segment, GST_FORMAT_TIME, timestamp); if (running_time != -1) { gboolean need_skip; GstClockTime earliest_time; gdouble proportion; /* lock for getting the QoS parameters that are set (in a different thread) * with the QOS events */ GST_OBJECT_LOCK (trans); earliest_time = trans->priv->earliest_time; proportion = trans->priv->proportion; /* check for QoS, don't perform conversion for buffers * that are known to be late. */ need_skip = trans->priv->qos_enabled && earliest_time != -1 && running_time <= earliest_time; GST_OBJECT_UNLOCK (trans); if (need_skip) { GstMessage *qos_msg; GstClockTime duration; guint64 stream_time; gint64 jitter; <API key> (GST_CAT_QOS, trans, "skipping transform: qostime %" GST_TIME_FORMAT " <= %" GST_TIME_FORMAT, GST_TIME_ARGS (running_time), GST_TIME_ARGS (earliest_time)); trans->priv->dropped++; duration = GST_BUFFER_DURATION (inbuf); stream_time = <API key> (&trans->segment, GST_FORMAT_TIME, timestamp); jitter = GST_CLOCK_DIFF (running_time, earliest_time); qos_msg = gst_message_new_qos (GST_OBJECT_CAST (trans), FALSE, running_time, stream_time, timestamp, duration); <API key> (qos_msg, jitter, proportion, 1000000); <API key> (qos_msg, GST_FORMAT_BUFFERS, trans->priv->processed, trans->priv->dropped); <API key> (GST_ELEMENT_CAST (trans), qos_msg); /* mark discont for next buffer */ trans->priv->discont = TRUE; goto skip; } } no_qos: /* first try to allocate an output buffer based on the currently negotiated * format. While we call pad-alloc we could renegotiate the srcpad format or * have a new suggestion for upstream buffer-alloc. * In any case, outbuf will contain a buffer suitable for doing the configured * transform after this function. */ ret = <API key> (trans, inbuf, outbuf); if (G_UNLIKELY (ret != GST_FLOW_OK)) goto no_buffer; /* now perform the needed transform */ if (trans->passthrough) { /* In passthrough mode, give transform_ip a look at the * buffer, without making it writable, or just push the * data through */ if (bclass->transform_ip) { GST_DEBUG_OBJECT (trans, "doing passthrough transform"); ret = bclass->transform_ip (trans, *outbuf); } else { GST_DEBUG_OBJECT (trans, "element is in passthrough"); } } else { want_in_place = (bclass->transform_ip != NULL) && trans->always_in_place; if (want_in_place) { GST_DEBUG_OBJECT (trans, "doing inplace transform"); if (inbuf != *outbuf) { guint8 *indata, *outdata; /* Different buffer. The data can still be the same when we are dealing * with subbuffers of the same buffer. Note that because of the FIXME in * <API key>() we have decreased the refcounts of inbuf and * outbuf to keep them writable */ indata = GST_BUFFER_DATA (inbuf); outdata = GST_BUFFER_DATA (*outbuf); if (indata != outdata) memcpy (outdata, indata, GST_BUFFER_SIZE (inbuf)); } ret = bclass->transform_ip (trans, *outbuf); } else { GST_DEBUG_OBJECT (trans, "doing non-inplace transform"); if (bclass->transform) ret = bclass->transform (trans, inbuf, *outbuf); else ret = <API key>; } } skip: /* only unref input buffer if we allocated a new outbuf buffer */ if (*outbuf != inbuf) gst_buffer_unref (inbuf); return ret; /* ERRORS */ not_negotiated: { gst_buffer_unref (inbuf); GST_ELEMENT_ERROR (trans, STREAM, NOT_IMPLEMENTED, ("not negotiated"), ("not negotiated")); return <API key>; } no_buffer: { gst_buffer_unref (inbuf); GST_WARNING_OBJECT (trans, "could not get buffer from pool: %s", gst_flow_get_name (ret)); return ret; } } static gboolean <API key> (GstPad * pad) { GstBaseTransform *trans; gboolean ret; trans = GST_BASE_TRANSFORM (gst_pad_get_parent (pad)); ret = <API key> (trans->sinkpad); gst_object_unref (trans); return ret; } /* FIXME, getrange is broken, need to pull range from the other * end based on the transform_size result. */ static GstFlowReturn <API key> (GstPad * pad, guint64 offset, guint length, GstBuffer ** buffer) { GstBaseTransform *trans; <API key> *klass; GstFlowReturn ret; GstBuffer *inbuf; trans = GST_BASE_TRANSFORM (gst_pad_get_parent (pad)); ret = gst_pad_pull_range (trans->sinkpad, offset, length, &inbuf); if (G_UNLIKELY (ret != GST_FLOW_OK)) goto pull_error; klass = <API key> (trans); if (klass->before_transform) klass->before_transform (trans, inbuf); <API key> (trans); ret = <API key> (trans, inbuf, buffer); <API key> (trans); done: gst_object_unref (trans); return ret; /* ERRORS */ pull_error: { GST_DEBUG_OBJECT (trans, "failed to pull a buffer: %s", gst_flow_get_name (ret)); goto done; } } static GstFlowReturn <API key> (GstPad * pad, GstBuffer * buffer) { GstBaseTransform *trans; <API key> *klass; GstFlowReturn ret; GstClockTime last_stop = GST_CLOCK_TIME_NONE; GstClockTime timestamp, duration; GstBuffer *outbuf = NULL; trans = GST_BASE_TRANSFORM (GST_OBJECT_PARENT (pad)); timestamp = <API key> (buffer); duration = GST_BUFFER_DURATION (buffer); /* calculate end position of the incoming buffer */ if (timestamp != GST_CLOCK_TIME_NONE) { if (duration != GST_CLOCK_TIME_NONE) last_stop = timestamp + duration; else last_stop = timestamp; } klass = <API key> (trans); if (klass->before_transform) klass->before_transform (trans, buffer); /* protect transform method and concurrent buffer alloc */ <API key> (trans); ret = <API key> (trans, buffer, &outbuf); <API key> (trans); /* outbuf can be NULL, this means a dropped buffer, if we have a buffer but * <API key> we will not push either. */ if (outbuf != NULL) { if ((ret == GST_FLOW_OK)) { GstClockTime last_stop_out = GST_CLOCK_TIME_NONE; /* Remember last stop position */ if (last_stop != GST_CLOCK_TIME_NONE && trans->segment.format == GST_FORMAT_TIME) <API key> (&trans->segment, GST_FORMAT_TIME, last_stop); if (<API key> (outbuf)) { last_stop_out = <API key> (outbuf); if (<API key> (outbuf)) last_stop_out += GST_BUFFER_DURATION (outbuf); } else if (last_stop != GST_CLOCK_TIME_NONE) { last_stop_out = last_stop; } if (last_stop_out != GST_CLOCK_TIME_NONE && trans->segment.format == GST_FORMAT_TIME) trans->priv->last_stop_out = last_stop_out; /* apply DISCONT flag if the buffer is not yet marked as such */ if (trans->priv->discont) { if (!<API key> (outbuf)) { outbuf = <API key> (outbuf); GST_BUFFER_FLAG_SET (outbuf, <API key>); } trans->priv->discont = FALSE; } trans->priv->processed++; ret = gst_pad_push (trans->srcpad, outbuf); } else { gst_buffer_unref (outbuf); } } /* convert internal flow to OK and mark discont for the next buffer. */ if (ret == <API key>) { trans->priv->discont = TRUE; ret = GST_FLOW_OK; } return ret; } static void <API key> (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { GstBaseTransform *trans; trans = GST_BASE_TRANSFORM (object); switch (prop_id) { case PROP_QOS: <API key> (trans, g_value_get_boolean (value)); break; default: <API key> (object, prop_id, pspec); break; } } static void <API key> (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { GstBaseTransform *trans; trans = GST_BASE_TRANSFORM (object); switch (prop_id) { case PROP_QOS: g_value_set_boolean (value, <API key> (trans)); break; default: <API key> (object, prop_id, pspec); break; } } /* not a vmethod of anything, just an internal method */ static gboolean <API key> (GstBaseTransform * trans, gboolean active) { <API key> *bclass; gboolean result = TRUE; bclass = <API key> (trans); if (active) { if (trans->priv->pad_mode == GST_ACTIVATE_NONE && bclass->start) result &= bclass->start (trans); GST_OBJECT_LOCK (trans); if (GST_PAD_CAPS (trans->sinkpad) && GST_PAD_CAPS (trans->srcpad)) trans->have_same_caps = gst_caps_is_equal (GST_PAD_CAPS (trans->sinkpad), GST_PAD_CAPS (trans->srcpad)) || trans->passthrough; else trans->have_same_caps = trans->passthrough; GST_DEBUG_OBJECT (trans, "have_same_caps %d", trans->have_same_caps); trans->negotiated = FALSE; trans->have_newsegment = FALSE; gst_segment_init (&trans->segment, <API key>); trans->priv->last_stop_out = GST_CLOCK_TIME_NONE; trans->priv->proportion = 1.0; trans->priv->earliest_time = -1; trans->priv->discont = FALSE; gst_caps_replace (&trans->priv->sink_suggest, NULL); trans->priv->processed = 0; trans->priv->dropped = 0; GST_OBJECT_UNLOCK (trans); } else { /* We must make sure streaming has finished before resetting things * and calling the ::stop vfunc */ GST_PAD_STREAM_LOCK (trans->sinkpad); <API key> (trans->sinkpad); trans->have_same_caps = FALSE; /* We can only reset the passthrough mode if the instance told us to handle it in configure_caps */ if (bclass-><API key>) { <API key> (trans, FALSE); } gst_caps_replace (&trans->cache_caps1, NULL); gst_caps_replace (&trans->cache_caps2, NULL); gst_caps_replace (&trans->priv->sink_alloc, NULL); gst_caps_replace (&trans->priv->sink_suggest, NULL); if (trans->priv->pad_mode != GST_ACTIVATE_NONE && bclass->stop) result &= bclass->stop (trans); } return result; } static gboolean <API key> (GstPad * pad, gboolean active) { gboolean result = TRUE; GstBaseTransform *trans; trans = GST_BASE_TRANSFORM (gst_pad_get_parent (pad)); result = <API key> (trans, active); if (result) trans->priv->pad_mode = active ? GST_ACTIVATE_PUSH : GST_ACTIVATE_NONE; gst_object_unref (trans); return result; } static gboolean <API key> (GstPad * pad, gboolean active) { gboolean result = FALSE; GstBaseTransform *trans; trans = GST_BASE_TRANSFORM (gst_pad_get_parent (pad)); result = <API key> (trans->sinkpad, active); if (result) result &= <API key> (trans, active); if (result) trans->priv->pad_mode = active ? GST_ACTIVATE_PULL : GST_ACTIVATE_NONE; gst_object_unref (trans); return result; } /** * <API key>: * @trans: the #GstBaseTransform to set * @passthrough: boolean indicating passthrough mode. * * Set passthrough mode for this filter by default. This is mostly * useful for filters that do not care about negotiation. * * Always TRUE for filters which don't implement either a transform * or transform_ip method. * * MT safe. */ void <API key> (GstBaseTransform * trans, gboolean passthrough) { <API key> *bclass; g_return_if_fail (<API key> (trans)); bclass = <API key> (trans); GST_OBJECT_LOCK (trans); if (passthrough == FALSE) { if (bclass->transform_ip || bclass->transform) trans->passthrough = FALSE; } else { trans->passthrough = TRUE; } GST_DEBUG_OBJECT (trans, "set passthrough %d", trans->passthrough); GST_OBJECT_UNLOCK (trans); } /** * <API key>: * @trans: the #GstBaseTransform to query * * See if @trans is configured as a passthrough transform. * * Returns: TRUE is the transform is configured in passthrough mode. * * MT safe. */ gboolean <API key> (GstBaseTransform * trans) { gboolean result; <API key> (<API key> (trans), FALSE); GST_OBJECT_LOCK (trans); result = trans->passthrough; GST_OBJECT_UNLOCK (trans); return result; } /** * <API key>: * @trans: the #GstBaseTransform to modify * @in_place: Boolean value indicating that we would like to operate * on in_place buffers. * * Determines whether a non-writable buffer will be copied before passing * to the transform_ip function. * <itemizedlist> * <listitem>Always TRUE if no transform function is implemented.</listitem> * <listitem>Always FALSE if ONLY transform function is implemented.</listitem> * </itemizedlist> * * MT safe. */ void <API key> (GstBaseTransform * trans, gboolean in_place) { <API key> *bclass; g_return_if_fail (<API key> (trans)); bclass = <API key> (trans); GST_OBJECT_LOCK (trans); if (in_place) { if (bclass->transform_ip) { GST_DEBUG_OBJECT (trans, "setting in_place TRUE"); trans->always_in_place = TRUE; } } else { if (bclass->transform) { GST_DEBUG_OBJECT (trans, "setting in_place FALSE"); trans->always_in_place = FALSE; } } GST_OBJECT_UNLOCK (trans); } /** * <API key>: * @trans: the #GstBaseTransform to query * * See if @trans is configured as a in_place transform. * * Returns: TRUE is the transform is configured in in_place mode. * * MT safe. */ gboolean <API key> (GstBaseTransform * trans) { gboolean result; <API key> (<API key> (trans), FALSE); GST_OBJECT_LOCK (trans); result = trans->always_in_place; GST_OBJECT_UNLOCK (trans); return result; } /** * <API key>: * @trans: a #GstBaseTransform * @proportion: the proportion * @diff: the diff against the clock * @timestamp: the timestamp of the buffer generating the QoS expressed in * running_time. * * Set the QoS parameters in the transform. This function is called internally * when a QOS event is received but subclasses can provide custom information * when needed. * * MT safe. * * Since: 0.10.5 */ void <API key> (GstBaseTransform * trans, gdouble proportion, GstClockTimeDiff diff, GstClockTime timestamp) { g_return_if_fail (<API key> (trans)); <API key> (GST_CAT_QOS, trans, "qos: proportion: %lf, diff %" G_GINT64_FORMAT ", timestamp %" GST_TIME_FORMAT, proportion, diff, GST_TIME_ARGS (timestamp)); GST_OBJECT_LOCK (trans); trans->priv->proportion = proportion; trans->priv->earliest_time = timestamp + diff; GST_OBJECT_UNLOCK (trans); } /** * <API key>: * @trans: a #GstBaseTransform * @enabled: new state * * Enable or disable QoS handling in the transform. * * MT safe. * * Since: 0.10.5 */ void <API key> (GstBaseTransform * trans, gboolean enabled) { g_return_if_fail (<API key> (trans)); <API key> (GST_CAT_QOS, trans, "enabled: %d", enabled); GST_OBJECT_LOCK (trans); trans->priv->qos_enabled = enabled; GST_OBJECT_UNLOCK (trans); } /** * <API key>: * @trans: a #GstBaseTransform * * Queries if the transform will handle QoS. * * Returns: TRUE if QoS is enabled. * * MT safe. * * Since: 0.10.5 */ gboolean <API key> (GstBaseTransform * trans) { gboolean result; <API key> (<API key> (trans), FALSE); GST_OBJECT_LOCK (trans); result = trans->priv->qos_enabled; GST_OBJECT_UNLOCK (trans); return result; } /** * <API key>: * @trans: a #GstBaseTransform * @gap_aware: New state * * If @gap_aware is %FALSE (the default), output buffers will have the * %GST_BUFFER_FLAG_GAP flag unset. * * If set to %TRUE, the element must handle output buffers with this flag set * correctly, i.e. it can assume that the buffer contains neutral data but must * unset the flag if the output is no neutral data. * * MT safe. * * Since: 0.10.16 */ void <API key> (GstBaseTransform * trans, gboolean gap_aware) { g_return_if_fail (<API key> (trans)); GST_OBJECT_LOCK (trans); trans->priv->gap_aware = gap_aware; GST_DEBUG_OBJECT (trans, "set gap aware %d", trans->priv->gap_aware); GST_OBJECT_UNLOCK (trans); } /** * <API key>: * @trans: a #GstBaseTransform * @caps: (transfer none): caps to suggest * @size: buffer size to suggest * * Instructs @trans to suggest new @caps upstream. A copy of @caps will be * taken. * * Since: 0.10.21 */ void <API key> (GstBaseTransform * trans, GstCaps * caps, guint size) { g_return_if_fail (<API key> (trans)); GST_OBJECT_LOCK (trans->sinkpad); if (trans->priv->sink_suggest) gst_caps_unref (trans->priv->sink_suggest); if (caps) caps = gst_caps_copy (caps); trans->priv->sink_suggest = caps; trans->priv->size_suggest = size; trans->priv->suggest_pending = TRUE; GST_DEBUG_OBJECT (trans, "new suggest %" GST_PTR_FORMAT, caps); GST_OBJECT_UNLOCK (trans->sinkpad); } /** * <API key>: * @trans: a #GstBaseTransform * * Instructs @trans to renegotiate a new downstream transform on the next * buffer. This function is typically called after properties on the transform * were set that influence the output format. * * Since: 0.10.21 */ void <API key> (GstBaseTransform * trans) { g_return_if_fail (<API key> (trans)); GST_OBJECT_LOCK (trans); GST_DEBUG_OBJECT (trans, "marking reconfigure"); trans->priv->reconfigure = TRUE; gst_caps_replace (&trans->priv->sink_alloc, NULL); GST_OBJECT_UNLOCK (trans); }
package org.jboss.test.ws.jaxws.samples.wsse.policy.basic; import javax.ejb.Stateless; import javax.jws.WebService; import org.jboss.ws.api.annotation.EndpointConfig; @Stateless @WebService ( portName = "SecurityServicePort", serviceName = "SecurityService", wsdlLocation = "META-INF/wsdl/SecurityService.wsdl", targetNamespace = "http: endpointInterface = "org.jboss.test.ws.jaxws.samples.wsse.policy.basic.ServiceIface" ) @EndpointConfig(configFile = "META-INF/<API key>.xml", configName = "Custom WS-Security Endpoint") public class EJBServiceImpl implements ServiceIface { public String sayHello() { return "EJB Secure Hello World!"; } }
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>close</title> <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>close</h1> <!-- Type and Stereotype --> <section style="margin-top: .5em;"> <span class="alert alert-info"> <span class="node-icon _icon-UMLOperation"></span> UMLOperation </span> </section> <!-- Path --> <section style="margin-top: 10px"> <span class="label label-info"><a href='<API key>.html'><span class='node-icon _icon-Project'></span>Untitled</a></span> <span>::</span> <span class="label label-info"><a href='<API key>.html'><span class='node-icon _icon-UMLModel'></span>JavaReverse</a></span> <span>::</span> <span class="label label-info"><a href='<API key>.html'><span class='node-icon _icon-UMLPackage'></span>net</a></span> <span>::</span> <span class="label label-info"><a href='<API key>.html'><span class='node-icon _icon-UMLPackage'></span>gleamynode</a></span> <span>::</span> <span class="label label-info"><a href='<API key>.html'><span class='node-icon _icon-UMLPackage'></span>netty</a></span> <span>::</span> <span class="label label-info"><a href='<API key>.html'><span class='node-icon _icon-UMLPackage'></span>handler</a></span> <span>::</span> <span class="label label-info"><a href='<API key>.html'><span class='node-icon _icon-UMLPackage'></span>ssl</a></span> <span>::</span> <span class="label label-info"><a href='<API key>.html'><span class='node-icon _icon-UMLClass'></span>SslHandler</a></span> <span>::</span> <span class="label label-info"><a href='<API key>.html'><span class='node-icon _icon-UMLOperation'></span>close</a></span> </section> <!-- Diagram --> <!-- Description --> <section> <h3>Description</h3> <div> <span class="label label-info">none</span> </div> </section> <!-- Specification --> <!-- Directed Relationship --> <!-- Undirected Relationship --> <!-- Classifier --> <!-- Interface --> <!-- Component --> <!-- Node --> <!-- Actor --> <!-- Use Case --> <!-- Template Parameters --> <!-- Literals --> <!-- Attributes --> <!-- Operations --> <!-- Receptions --> <!-- Extension Points --> <!-- Parameters --> <section> <h3>Parameters</h3> <table class="table table-striped table-bordered"> <tr> <th>Direction</th> <th>Name</th> <th>Type</th> <th>Description</th> </tr> <tr> <td>in</td> <td><a href="<API key>.html">channel</a></td> <td><a href='<API key>.html'><span class='node-icon _icon-UMLClass'></span>Channel</a></td> <td></td> </tr> <tr> <td>return</td> <td><a href="<API key>.html">(unnamed)</a></td> <td><a href='<API key>.html'><span class='node-icon _icon-UMLClass'></span>ChannelFuture</a></td> <td></td> </tr> </table> </section> <!-- 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>close</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>isStatic</td> <td><span class='label label-info'>false</span></td> </tr> <tr> <td>isLeaf</td> <td><span class='label label-info'>false</span></td> </tr> <tr> <td>parameters</td> <td> <a href='<API key>.html'><span class='node-icon _icon-UMLParameter'></span>channel</a> <span>, </span> <a href='<API key>.html'><span class='node-icon _icon-UMLParameter'></span>(Parameter)</a> </td> </tr> <tr> <td>raisedExceptions</td> <td> <a href='<API key>.html'><span class='node-icon _icon-UMLClass'></span>SSLException</a> </td> </tr> <tr> <td>concurrency</td> <td>sequential</td> </tr> <tr> <td>isQuery</td> <td><span class='label label-info'>false</span></td> </tr> <tr> <td>isAbstract</td> <td><span class='label label-info'>false</span></td> </tr> <tr> <td>specification</td> <td></td> </tr> </table> </section> <!-- Tags --> <!-- Constraints, Dependencies, Dependants --> <!-- Relationships --> <!-- Owned Elements --> </div> </body> </html>
<!DOCTYPE HTML PUBLIC "- <!--NewPage <HTML> <HEAD> <!-- Generated by javadoc (build 1.5.0_06) on Sun Nov 04 12:36:50 GMT 2007 --> <TITLE> N-Index </TITLE> <LINK REL ="stylesheet" TYPE="text/css" HREF="../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { parent.document.title="N-Index"; } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <A NAME="navbar_top"></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Package</FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../overview-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="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Index</B></FONT>&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="index-11.html"><B>PREV LETTER</B></A>&nbsp; &nbsp;<A HREF="index-13.html"><B>NEXT LETTER</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../index.html?index-filesindex-12.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="index-12.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> <A HREF="index-1.html">A</A> <A HREF="index-2.html">B</A> <A HREF="index-3.html">C</A> <A HREF="index-4.html">D</A> <A HREF="index-5.html">E</A> <A HREF="index-6.html">F</A> <A HREF="index-7.html">G</A> <A HREF="index-8.html">H</A> <A HREF="index-9.html">I</A> <A HREF="index-10.html">L</A> <A HREF="index-11.html">M</A> <A HREF="index-12.html">N</A> <A HREF="index-13.html">O</A> <A HREF="index-14.html">P</A> <A HREF="index-15.html">Q</A> <A HREF="index-16.html">R</A> <A HREF="index-17.html">S</A> <A HREF="index-18.html">T</A> <A HREF="index-19.html">U</A> <A HREF="index-20.html">V</A> <A HREF="index-21.html">W</A> <A HREF="index-22.html">X</A> <A HREF="index-23.html">Y</A> <A HREF="index-24.html">Z</A> <HR> <A NAME="_N_"></A><H2> <B>N</B></H2> <DL> <DT><A HREF="../flightsim/simconnect/<API key>.html" title="enum in flightsim.simconnect"><B><API key></B></A> - Enum in <A HREF="../flightsim/simconnect/package-summary.html">flightsim.simconnect</A><DD>Notification priorities.</DL> <HR> <A NAME="navbar_bottom"></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="<API key>"></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Package</FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../overview-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="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Index</B></FONT>&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="index-11.html"><B>PREV LETTER</B></A>&nbsp; &nbsp;<A HREF="index-13.html"><B>NEXT LETTER</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../index.html?index-filesindex-12.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="index-12.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> <A HREF="index-1.html">A</A> <A HREF="index-2.html">B</A> <A HREF="index-3.html">C</A> <A HREF="index-4.html">D</A> <A HREF="index-5.html">E</A> <A HREF="index-6.html">F</A> <A HREF="index-7.html">G</A> <A HREF="index-8.html">H</A> <A HREF="index-9.html">I</A> <A HREF="index-10.html">L</A> <A HREF="index-11.html">M</A> <A HREF="index-12.html">N</A> <A HREF="index-13.html">O</A> <A HREF="index-14.html">P</A> <A HREF="index-15.html">Q</A> <A HREF="index-16.html">R</A> <A HREF="index-17.html">S</A> <A HREF="index-18.html">T</A> <A HREF="index-19.html">U</A> <A HREF="index-20.html">V</A> <A HREF="index-21.html">W</A> <A HREF="index-22.html">X</A> <A HREF="index-23.html">Y</A> <A HREF="index-24.html">Z</A> <HR> </BODY> </HTML>
/* * Creative Technology and ZiiLABS * Initially the Creative devices was all we supported so these are * the most thoroughly tested devices. Presumably only the devices * with older firmware (the ones that have 32bit object size) will * need the <API key> flag. This bug * manifest itself when you have a lot of folders on the device, * some of the folders will start to disappear when getting all objects * and properties. */ { "Creative", 0x041e, "ZEN Vision", 0x411f, <API key> | <API key> }, { "Creative", 0x041e, "Portable Media Center", 0x4123, <API key> | <API key> }, { "Creative", 0x041e, "ZEN Xtra (MTP mode)", 0x4128, <API key> | <API key> }, { "Dell", 0x041e, "DJ (2nd generation)", 0x412f, <API key> | <API key> }, { "Creative", 0x041e, "ZEN Micro (MTP mode)", 0x4130, <API key> | <API key> }, { "Creative", 0x041e, "ZEN Touch (MTP mode)", 0x4131, <API key> | <API key> }, { "Dell", 0x041e, "Dell Pocket DJ (MTP mode)", 0x4132, <API key> | <API key> }, { "Creative", 0x041e, "ZEN MicroPhoto (alternate version)", 0x4133, <API key> | <API key> }, { "Creative", 0x041e, "ZEN Sleek (MTP mode)", 0x4137, <API key> | <API key> }, { "Creative", 0x041e, "ZEN MicroPhoto", 0x413c, <API key> | <API key> }, { "Creative", 0x041e, "ZEN Sleek Photo", 0x413d, <API key> | <API key> }, { "Creative", 0x041e, "ZEN Vision:M", 0x413e, <API key> | <API key> }, // Reported by marazm@o2.pl { "Creative", 0x041e, "ZEN V", 0x4150, <API key> | <API key> }, // Reported by danielw@iinet.net.au // This version of the Vision:M needs the no release interface flag, // unclear whether the other version above need it too or not. { "Creative", 0x041e, "ZEN Vision:M (DVP-HD0004)", 0x4151, <API key> | <API key> | <API key> }, // Reported by Darel on the XNJB forums { "Creative", 0x041e, "ZEN V Plus", 0x4152, <API key> | <API key> }, { "Creative", 0x041e, "ZEN Vision W", 0x4153, <API key> | <API key> }, // Don't add 0x4155: this is a Zen Stone device which is not MTP // Reported by Paul Kurczaba <paul@kurczaba.com> { "Creative", 0x041e, "ZEN", 0x4157, <API key> | <API key> | <API key> | <API key> }, // Reported by Ringofan <mcroman@users.sourceforge.net> { "Creative", 0x041e, "ZEN V 2GB", 0x4158, <API key> | <API key> }, // Reported by j norment <stormzen@gmail.com> { "Creative", 0x041e, "ZEN Mozaic", 0x4161, <API key> | <API key> }, // Reported by Aaron F. Gonzalez <sub_tex@users.sourceforge.net> { "Creative", 0x041e, "ZEN X-Fi", 0x4162, <API key> | <API key> }, // Reported by farmerstimuli <farmerstimuli@users.sourceforge.net> { "Creative", 0x041e, "ZEN X-Fi 3", 0x4169, <API key> | <API key> }, // Reported by Todor Gyumyushev <yodor1@users.sourceforge.net> { "ZiiLABS", 0x041e, "Zii EGG", 0x6000, <API key> | <API key> | <API key> | <API key> | <API key> }, // From anonymous SourceForge user, not verified { "Samsung", 0x04e8, "YP-900", 0x0409, DEVICE_FLAG_NONE }, // From MItch <dbaker@users.sourceforge.net> { "Samsung", 0x04e8, "I550W Phone", 0x04a4, DEVICE_FLAG_NONE }, // From Manfred Enning <menning@users.sourceforge.net> { "Samsung", 0x04e8, "Jet S8000", 0x4f1f, DEVICE_FLAG_NONE }, // From Gabriel Nunes <gabrielkm1@yahoo.com.br> { "Samsung", 0x04e8, "YH-920 (501d)", 0x501d, <API key> }, // From Soren O'Neill { "Samsung", 0x04e8, "YH-920 (5022)", 0x5022, <API key> }, // Contributed by aronvanammers on SourceForge { "Samsung", 0x04e8, "YH-925GS", 0x5024, DEVICE_FLAG_NONE }, // From libgphoto2, according to tests by Stephan Fabel it cannot // get all objects with the getobjectproplist command.. { "Samsung", 0x04e8, "YH-820", 0x502e, <API key> }, // Contributed by polux2001@users.sourceforge.net { "Samsung", 0x04e8, "YH-925(-GS)", 0x502f, <API key> | <API key> }, // Contributed by anonymous person on SourceForge { "Samsung", 0x04e8, "YH-J70J", 0x5033, <API key> }, // From XNJB user // Guessing on .spl flag { "Samsung", 0x04e8, "YP-Z5", 0x503c, <API key> | <API key> | <API key> }, // Don't add 0x5041 as this is YP-Z5 in USB mode // Contributed by anonymous person on SourceForge { "Samsung", 0x04e8, "YP-T7J", 0x5047, <API key> | <API key> }, // Reported by cstrickler@gmail.com { "Samsung", 0x04e8, "YP-U2J (YP-U2JXB/XAA)", 0x5054, <API key> | <API key> }, // Reported by Andrew Benson { "Samsung", 0x04e8, "YP-F2J", 0x5057, <API key> }, // Reported by Patrick <skibler@gmail.com> { "Samsung", 0x04e8, "YP-K5", 0x505a, <API key> | <API key> | <API key> }, // From dev.local@gmail.com - 0x4e8/0x507c is the UMS mode, apparently // do not add that device. // From m.eik michalke // This device does NOT use the special SPL playlist according to sypqgjxu@gmx.de. { "Samsung", 0x04e8, "YP-U3", 0x507d, <API key> | <API key> }, // Reported by Matthew Wilcox <matthew@wil.cx> // Sergio <sfrdll@tiscali.it> reports this device need the BROKEN ALL flag. // Guessing on .spl flag { "Samsung", 0x04e8, "YP-T9", 0x507f, <API key> | <API key> | <API key> | <API key> }, // From Paul Clinch // Some versions of the firmware reportedly support OGG, reportedly only the // UMS versions, so MTP+OGG is not possible on this device. { "Samsung", 0x04e8, "YP-K3", 0x5081, <API key> | <API key> }, // From XNJB user // From Alistair Boyle, .spl v2 required for playlists // According to the device log it properly supports OGG { "Samsung", 0x04e8, "YP-P2", 0x5083, <API key> | <API key> | <API key> | <API key> }, // From Paul Clinch // Guessing on .spl flag { "Samsung", 0x04e8, "YP-T10", 0x508a, <API key> | <API key> | <API key> | <API key> | <API key> }, // From Wim Verwimp <wimverwimp@gmail.com> // Not sure about the Ogg and broken proplist flags here. Just guessing. // Guessing on .spl flag { "Samsung", 0x04e8, "YP-S5", 0x508b, <API key> | <API key> | <API key> | <API key> }, // From Ludovic Danigo // Guessing on .spl flag { "Samsung", 0x04e8, "YP-S3", 0x5091, <API key> | <API key> | <API key> | <API key> }, // From Adrian Levi <adrian.levi@gmail.com> // Guessing on .spl flag // This one supports OGG properly through the correct MTP type. { "Samsung", 0x04e8, "YP-U4", 0x5093, <API key> }, // From Chris Le Sueur <thefishface@gmail.com> // Guessing on .spl flag // This one supports OGG properly through the correct MTP type. { "Samsung", 0x04e8, "YP-R1", 0x510f, <API key> | <API key> | <API key> }, // From Anonymous SourceForge user // Guessing on .spl flag { "Samsung", 0x04e8, "YP-Q1", 0x5115, <API key> | <API key> | <API key> | <API key> }, // From Holger { "Samsung", 0x04e8, "YP-M1", 0x5118, <API key> | <API key> | <API key> }, // From Anonymous SourceForge user // Guessing on .spl flag { "Samsung", 0x04e8, "YP-P3", 0x511a, <API key> | <API key> | <API key> | <API key> }, // From Anonymous SourceForge user // Guessing on .spl flag { "Samsung", 0x04e8, "YP-Q2", 0x511d, <API key> | <API key> | <API key> | <API key> }, // From Marco Pizzocaro <mpizzocaro@users.sourceforge.net> // Guessing on .spl flag { "Samsung", 0x04e8, "YP-U5", 0x5121, <API key> | <API key> | <API key> | <API key> }, // From Leonardo Accorsi <laccorsi@users.sourceforge.net> // Guessing on .spl flag { "Samsung", 0x04e8, "YP-R0", 0x5125, <API key> | <API key> | <API key> | <API key> }, // The "YP-R2" (0x04e8/0x512d) is NOT MTP, it is UMS only. // Guessing on device flags for the MTP mode... { "Samsung", 0x04e8, "YP-R2", 0x512e, <API key> | <API key> | <API key> | <API key> | <API key> }, // From Manuel Carro // Copied from Q2 { "Samsung", 0x04e8, "YP-Q3", 0x5130, <API key> | <API key> | <API key> | <API key> }, // Reported by: traaf <traaf@users.sourceforge.net> // Guessing on the playlist type! // Appears to present itself properly as a PTP device with MTP extensions! { "Samsung", 0x04e8, "YP-Z3", 0x5137, <API key> | <API key> | <API key> | <API key> }, // YP-F3 is NOT MTP - USB mass storage // From a rouge .INF file // this device ID seems to have been recycled for: // the Samsung SGH-A707 Cingular cellphone // the Samsung L760-V cellphone // the Samsung SGH-U900 cellphone // the Samsung Fascinate player { "Samsung", 0x04e8, "YH-999 Portable Media Center/SGH-A707/SGH-L760V/SGH-U900/Verizon Intensity/Fascinate", 0x5a0f, <API key> }, // { "Samsung", 0x04e8, "Z170 Mobile Phone", 0x6601, <API key> }, // { "Samsung", 0x04e8, "E250 Mobile Phone", 0x663e, <API key> }, // From an anonymous SF user { "Samsung", 0x04e8, "M7600 Beat/GT-S8300T/SGH-F490/S8300", 0x6642, <API key> | <API key> }, // From Lionel Bouton { "Samsung", 0x04e8, "X830 Mobile Phone", 0x6702, <API key> }, // From James <jamestech@gmail.com> { "Samsung", 0x04e8, "U600 Mobile Phone", 0x6709, <API key> }, // From Cesar Cardoso <cesar@cesarcardoso.tk> // No confirmation that this is really MTP. { "Samsung", 0x04e8, "F250 Mobile Phone", 0x6727, <API key> }, // From Charlie Todd 2007-10-31 { "Samsung", 0x04e8, "Juke (SCH-U470)", 0x6734, <API key>}, // Reported by Tenn { "Samsung", 0x04e8, "GT-B2700", 0x6752, <API key> }, // Added by Greg Fitzgerald <netzdamon@gmail.com> { "Samsung", 0x04e8, "SAMSUNG Trance", 0x6763, <API key> | <API key> | <API key> }, // From anonymous sourceforge user // Guessing on .spl flag, maybe needs NO_ZERO_READS, whatdoIknow { "Samsung", 0x04e8, "GT-S8500", 0x6819, <API key> | <API key> }, { "Samsung", 0x04e8, "Galaxy models (MTP+ADB)", 0x685c, <API key> | <API key> | <API key> | <API key> | <API key> | <API key> | <API key> }, // Reported by David Goodenough <dfgdga@users.sourceforge.net> // Guessing on flags. { "Samsung", 0x04e8, "Galaxy Y", 0x685e, <API key> | <API key> | <API key> | <API key> | <API key> | <API key> | <API key> }, { "Samsung", 0x04e8, "Galaxy models (MTP)", 0x6860, <API key> | <API key> | <API key> | <API key> | <API key> | <API key> | <API key> }, // From: Erik Berglund <erikjber@users.sourceforge.net> // Logs indicate this needs <API key> // No Samsung platlists on this device. // i5800 duplicate reported by igel <igel-kun@users.sourceforge.net> // Guessing this has the same problematic MTP stack as the device // above. { "Samsung", 0x04e8, "Galaxy models Kies mode", 0x6877, <API key> | <API key> | <API key> | <API key> | <API key> }, // From: John Gorkos <ab0oo@users.sourceforge.net> and // Akos Maroy <darkeye@users.sourceforge.net> { "Samsung", 0x04e8, "Vibrant SGH-T959/Captivate/Media player mode", 0x68a9, <API key> | <API key> }, // Reported by Sleep.Walker <froser@users.sourceforge.net> { "Samsung", 0x04e8, "GT-B2710/Xcover 271", 0x68af, <API key> | <API key> }, // From anonymous Sourceforge user { "Samsung", 0x04e8, "GT-S5230", 0xe20c, DEVICE_FLAG_NONE }, /* * Microsoft * All except the first probably need MTPZ to work */ { "Microsoft/Intel", 0x045e, "Bandon Portable Media Center", 0x00c9, DEVICE_FLAG_NONE }, // HTC Mozart is using the PID, as is Nokia Lumia 800 // May need MTPZ to work { "Microsoft", 0x045e, "Windows Phone", 0x04ec, DEVICE_FLAG_NONE }, // Reported by Tadimarri Sarath <sarath.tadi@gmail.com> // No idea why this use an Intel PID, perhaps a leftover from // the early PMC development days when Intel and Microsoft were // partnering. { "Microsoft", 0x045e, "Windows MTP Simulator", 0x0622, DEVICE_FLAG_NONE }, // Reported by Edward Hutchins (used for Zune HDs) { "Microsoft", 0x045e, "Zune HD", 0x063e, DEVICE_FLAG_NONE }, { "Microsoft", 0x045e, "Kin 1", 0x0640, DEVICE_FLAG_NONE }, { "Microsoft/Sharp/nVidia", 0x045e, "Kin TwoM", 0x0641, DEVICE_FLAG_NONE }, // Reported by Farooq Zaman (used for all Zunes) { "Microsoft", 0x045e, "Zune", 0x0710, DEVICE_FLAG_NONE }, // Reported by Olegs Jeremejevs { "Microsoft/HTC", 0x045e, "HTC 8S", 0xf0ca, DEVICE_FLAG_NONE }, /* * JVC */ // From Mark Veinot { "JVC", 0x04f1, "Alneo XA-HD500", 0x6105, DEVICE_FLAG_NONE }, /* * Philips */ { "Philips", 0x0471, "HDD6320/00 or HDD6330/17", 0x014b, <API key> }, // Anonymous SourceForge user { "Philips", 0x0471, "HDD14XX,HDD1620 or HDD1630/17", 0x014c, DEVICE_FLAG_NONE }, // from discussion forum { "Philips", 0x0471, "HDD085/00 or HDD082/17", 0x014d, DEVICE_FLAG_NONE }, // from XNJB forum { "Philips", 0x0471, "GoGear SA9200", 0x014f, <API key> }, // From John Coppens <jcoppens@users.sourceforge.net> { "Philips", 0x0471, "SA1115/55", 0x0164, DEVICE_FLAG_NONE }, // From Gerhard Mekenkamp { "Philips", 0x0471, "GoGear Audio", 0x0165, DEVICE_FLAG_NONE }, // from David Holm <wormie@alberg.dk> { "Philips", 0x0471, "Shoqbox", 0x0172, <API key> }, // from npedrosa { "Philips", 0x0471, "PSA610", 0x0181, DEVICE_FLAG_NONE }, // From libgphoto2 source { "Philips", 0x0471, "HDD6320", 0x01eb, DEVICE_FLAG_NONE }, // From Detlef Meier <dm@emlix.com> { "Philips", 0x0471, "GoGear SA6014/SA6015/SA6024/SA6025/SA6044/SA6045", 0x084e, <API key> }, // From anonymous Sourceforge user SA5145/02 { "Philips", 0x0471, "GoGear SA5145", 0x0857, <API key> }, // From a { "Philips", 0x0471, "GoGear SA6125/SA6145/SA6185", 0x2002, <API key> }, // From anonymous Sourceforge user, not verified to be MTP! { "Philips", 0x0471, "GoGear SA3345", 0x2004, <API key> }, // From Roberto Vidmar <rvidmar@libero.it> { "Philips", 0x0471, "SA5285", 0x2022, <API key> }, // From Elie De Brauwer <elie@de-brauwer.be> { "Philips", 0x0471, "GoGear ViBE SA1VBE04", 0x2075, <API key> }, // From Anonymous SourceForge user { "Philips", 0x0471, "GoGear Muse", 0x2077, <API key> }, // From Elie De Brauwer <elie@de-brauwer.be> { "Philips", 0x0471, "GoGear ViBE SA1VBE04/08", 0x207b, <API key> }, // From josmtx <josmtx@users.sourceforge.net> { "Philips", 0x0471, "GoGear Aria", 0x207c, <API key> }, // From epklein { "Philips", 0x0471, "GoGear SA1VBE08KX/78", 0x208e, <API key> }, // From Anonymous SourceForge User { "Philips", 0x0471, "GoGear VIBE SA2VBE[08|16]K/02", 0x20b7, <API key> }, // From Anonymous SourceForge User { "Philips", 0x0471, "GoGear Ariaz", 0x20b9, <API key> }, // From Anonymous SourceForge User { "Philips", 0x0471, "GoGear Vibe/02", 0x20e5, <API key> }, // Reported by Philip Rhoades { "Philips", 0x0471, "GoGear Ariaz/97", 0x2138, <API key> }, // from XNJB user { "Philips", 0x0471, "PSA235", 0x7e01, DEVICE_FLAG_NONE }, /* * Acer * Reporters: * Franck VDL <franckv@users.sourceforge.net> * Matthias Arndt <simonsunnyboy@users.sourceforge.net> * Arvin Schnell <arvins@users.sourceforge.net> * Philippe Marzouk <philm@users.sourceforge.net> * nE0sIghT <ne0sight@users.sourceforge.net> * Maxime de Roucy <maxime1986@users.sourceforge.net> */ { "Acer", 0x0502, "Iconia TAB A500 (ID1)", 0x3325, <API key> }, { "Acer", 0x0502, "Iconia TAB A500 (ID2)", 0x3341, <API key> }, { "Acer", 0x0502, "Iconia TAB A501 (ID1)", 0x3344, <API key> }, { "Acer", 0x0502, "Iconia TAB A501 (ID2)", 0x3345, <API key> }, { "Acer", 0x0502, "Iconia TAB A100 (ID1)", 0x3348, <API key> }, { "Acer", 0x0502, "Iconia TAB A100 (ID2)", 0x3349, <API key> }, { "Acer", 0x0502, "Iconia TAB A700", 0x3378, <API key> }, { "Acer", 0x0502, "Iconia TAB A200 (ID1)", 0x337c, <API key> }, { "Acer", 0x0502, "Iconia TAB A200 (ID2)", 0x337d, <API key> }, { "Acer", 0x0502, "Iconia TAB A510 (ID1)", 0x3389, <API key> }, { "Acer", 0x0502, "Iconia TAB A510 (ID2)", 0x338a, <API key> }, { "Acer", 0x0502, "E350 Liquid Gallant Duo", 0x33c3, <API key> }, { "Acer", 0x0502, "Iconia TAB A210", 0x33cb, <API key> }, { "Acer", 0x0502, "Iconia TAB A110", 0x33d8, <API key> }, // Reported by Brian Robison { "SanDisk", 0x0781, "Sansa m230/m240", 0x7400, <API key> | <API key> | <API key> | <API key> }, // From Rockbox device listing { "SanDisk", 0x0781, "Sansa m200-tcc (MTP mode)", 0x7401, <API key> | <API key> | <API key> | <API key> }, // Reported by tangent_@users.sourceforge.net { "SanDisk", 0x0781, "Sansa c150", 0x7410, <API key> | <API key> | <API key> | <API key> }, // From libgphoto2 source // Reported by <gonkflea@users.sourceforge.net> // Reported by Mike Owen <mikeowen@computerbaseusa.com> { "SanDisk", 0x0781, "Sansa e200/e250/e260/e270/e280", 0x7420, <API key> | <API key> | <API key> | <API key> }, // Don't add 0x7421 as this is e280 in MSC mode // Reported by XNJB user { "SanDisk", 0x0781, "Sansa e260/e280 v2", 0x7422, <API key> | <API key> | <API key> | <API key> | <API key> }, // Reported by XNJB user { "SanDisk", 0x0781, "Sansa m240/m250", 0x7430, <API key> | <API key> | <API key> | <API key> }, // Reported by Eugene Brevdo <ebrevdo@princeton.edu> { "SanDisk", 0x0781, "Sansa Clip", 0x7432, <API key> | <API key> | <API key> | <API key> | <API key>}, // Reported by HackAR <hackar@users.sourceforge.net> { "SanDisk", 0x0781, "Sansa Clip v2", 0x7434, <API key> | <API key> | <API key> | <API key> | <API key>}, // Reported by anonymous user at sourceforge.net { "SanDisk", 0x0781, "Sansa c240/c250", 0x7450, <API key> | <API key> | <API key> | <API key> }, // Reported by anonymous SourceForge user { "SanDisk", 0x0781, "Sansa c250 v2", 0x7452, <API key> | <API key> | <API key> | <API key> }, // Reported by Troy Curtis Jr. { "SanDisk", 0x0781, "Sansa Express", 0x7460, <API key> | <API key> | <API key> | <API key> }, // Reported by XNJB user, and Miguel de Icaza <miguel@gnome.org> // This has no dual-mode so no need to unload any driver. // This is a Linux based device! { "SanDisk", 0x0781, "Sansa Connect", 0x7480, DEVICE_FLAG_NONE }, // Reported by anonymous SourceForge user { "SanDisk", 0x0781, "Sansa View", 0x74b0, <API key> | <API key> | <API key> | <API key> }, // Reported by Patrick <skibler@gmail.com> // There are apparently problems with this device. { "SanDisk", 0x0781, "Sansa Fuze", 0x74c0, <API key> | <API key> | <API key> | <API key> | <API key> | <API key> }, // Harry Phillips <tuxcomputers@users.sourceforge.net> { "SanDisk", 0x0781, "Sansa Fuze v2", 0x74c2, <API key> | <API key> | <API key> | <API key> | <API key> | <API key> }, // Reported by anonymous SourceForge user // Need <API key> accordning to // Michael <mpapet@users.sourceforge.net> { "SanDisk", 0x0781, "Sansa Clip+", 0x74d0, <API key> | <API key> | <API key> | <API key> | <API key> | <API key>}, // Reported by anonymous SourceForge user { "SanDisk", 0x0781, "Sansa Fuze+", 0x74e0, <API key> | <API key> | <API key> | <API key> | <API key> | <API key>}, // Reported by mattyj2001@users.sourceforge.net { "SanDisk", 0x0781, "Sansa Clip Zip", 0x74e4, <API key> | <API key> | <API key> | <API key> | <API key> | <API key>}, /* * iRiver * we assume that <API key> is essentially * broken on all iRiver devices, meaning it simply won't return * all properties for a file when asking for metadata 0xffffffff. * Please test on your device if you believe it isn't broken! */ { "iRiver", 0x1006, "H300 Series MTP", 0x3004, <API key> | <API key> | <API key> }, { "iRiver", 0x1006, "Portable Media Center", 0x4002, <API key> | <API key> | <API key> }, { "iRiver", 0x1006, "Portable Media Center", 0x4003, <API key> | <API key> | <API key> }, // From [st]anislav <iamstanislav@gmail.com> { "iRiver", 0x1042, "T7 Volcano", 0x1143, <API key> }, // From an anonymous person at SourceForge, uncertain about this one { "iRiver", 0x4102, "iFP-880", 0x1008, <API key> | <API key> | <API key> }, // 0x4102, 0x1042 is a USB mass storage mode for E100 v2/Lplayer // From libgphoto2 source { "iRiver", 0x4102, "T10", 0x1113, <API key> | <API key> | <API key> }, { "iRiver", 0x4102, "T20 FM", 0x1114, <API key> | <API key> | <API key> }, // This appears at the MTP-UMS site { "iRiver", 0x4102, "T20", 0x1115, <API key> | <API key> | <API key> }, { "iRiver", 0x4102, "U10", 0x1116, <API key> | <API key> | <API key> }, { "iRiver", 0x4102, "T10a", 0x1117, <API key> | <API key> | <API key> }, { "iRiver", 0x4102, "T20", 0x1118, <API key> | <API key> | <API key> }, { "iRiver", 0x4102, "T30", 0x1119, <API key> | <API key> | <API key> }, // Reported by David Wolpoff { "iRiver", 0x4102, "T10 2GB", 0x1120, <API key> | <API key> | <API key> }, // Rough guess this is the MTP device ID... { "iRiver", 0x4102, "N12", 0x1122, <API key> | <API key> | <API key> }, // Reported by Philip Antoniades <philip@mysql.com> // Newer iriver devices seem to have shaped-up firmware without any // of the annoying bugs. { "iRiver", 0x4102, "Clix2", 0x1126, DEVICE_FLAG_NONE }, // Reported by Adam Torgerson { "iRiver", 0x4102, "Clix", 0x112a, <API key> | <API key> }, // Reported by Douglas Roth <dougaus@gmail.com> { "iRiver", 0x4102, "X20", 0x1132, <API key> | <API key> | <API key> }, // Reported by Robert Ugo <robert_ugo@users.sourceforge.net> { "iRiver", 0x4102, "T60", 0x1134, <API key> | <API key> | <API key> }, // Reported by two anonymous SourceForge users // Needs the stronger OGG_IS_UNKNOWN flag to support OGG properly, // be aware of newer players that may be needing this too. { "iRiver", 0x4102, "E100", 0x1141, <API key> | <API key> | <API key> }, // Reported by anonymous SourceForge user // Need verification of whether this firmware really need all these flags { "iRiver", 0x4102, "E100 v2/Lplayer", 0x1142, <API key> | <API key> | <API key> }, // Reported by Richard Vennemann <vennemann@users.sourceforge.net> // In USB Mass Storage mode it is 0x4102/0x1047 // Seems to use the new shaped-up firmware. { "iRiver", 0x4102, "Spinn", 0x1147, DEVICE_FLAG_NONE }, // Reported by Tony Janssen <tonyjanssen@users.sourceforge.net> { "iRiver", 0x4102, "E50", 0x1151, <API key> | <API key> | <API key> }, // Reported by anonymous SourceForge user, guessing on flags { "iRiver", 0x4102, "E150", 0x1152, <API key> | <API key> | <API key> }, // Reported by Jakub Matraszek <jakub.matraszek@gmail.com> { "iRiver", 0x4102, "T5", 0x1153, <API key> | <API key> | <API key> | <API key> }, // Reported by pyalex@users.sourceforge.net // Guessing that this needs the FLAG_NO_ZERO_READS... { "iRiver", 0x4102, "E30", 0x1167, <API key> | <API key> | <API key> }, // Reported by Scott Call // Assume this actually supports OGG though it reports it doesn't. { "iRiver", 0x4102, "H10 20GB", 0x2101, <API key> | <API key> | <API key> }, { "iRiver", 0x4102, "H10 5GB", 0x2102, <API key> | <API key> | <API key> }, // From Rockbox device listing { "iRiver", 0x4102, "H10 5.6GB", 0x2105, <API key> | <API key> | <API key> }, /* * Dell */ { "Dell, Inc", 0x413c, "DJ Itty", 0x4500, DEVICE_FLAG_NONE }, /* Reported by: JR */ { "Dell, Inc", 0x413c, "Dell Streak 7", 0xb10b, <API key> }, /* * Toshiba * Tentatively flagged all Toshiba devices with * <API key> after one of them * showed erroneous behaviour. */ { "Toshiba", 0x0930, "Gigabeat MEGF-40", 0x0009, <API key> | <API key> }, { "Toshiba", 0x0930, "Gigabeat", 0x000c, <API key> | <API key> }, // Reported by Nicholas Tripp { "Toshiba", 0x0930, "Gigabeat P20", 0x000f, <API key> | <API key> }, // From libgphoto2 { "Toshiba", 0x0930, "Gigabeat S", 0x0010, <API key> | <API key> | <API key> }, // Reported by Rob Brown { "Toshiba", 0x0930, "Gigabeat P10", 0x0011, <API key> | <API key> }, // Reported by solanum@users.sourceforge.net { "Toshiba", 0x0930, "Gigabeat V30", 0x0014, <API key> | <API key> }, // Reported by Michael Davis <slithy@yahoo.com> { "Toshiba", 0x0930, "Gigabeat U", 0x0016, <API key> | <API key> }, // Reported by Devon Jacobs <devo@godevo.com> { "Toshiba", 0x0930, "Gigabeat MEU202", 0x0018, <API key> | <API key> }, // Reported by Rolf <japan (at) dl3lar.de> { "Toshiba", 0x0930, "Gigabeat T", 0x0019, <API key> | <API key> }, // Reported by Phil Ingram <ukpbert@users.sourceforge.net> // Tentatively added - no real reports of this device ID being MTP, // reports as USB Mass Storage currently. { "Toshiba", 0x0930, "Gigabeat MEU201", 0x001a, <API key> | <API key> }, // Reported by anonymous SourceForge user { "Toshiba", 0x0930, "Gigabeat MET401", 0x001d, <API key> | <API key> }, // Reported by Andree Jacobson <nmcandree@users.sourceforge.net> { "Toshiba", 0x0930, "Excite AT300", 0x0963, <API key> }, // Reported by Nigel Cunningham <nigel@tuxonice.net> // Guessing on Android bugs { "Toshiba", 0x0930, "Thrive AT100/AT105", 0x7100, <API key> }, /* * Archos * These devices have some dual-mode interfaces which will really * respect the driver unloading, so <API key> * really work on these devices! */ // Reported by Alexander Haertig <AlexanderHaertig@gmx.de> { "Archos", 0x0e79, "Gmini XS100", 0x1207, <API key> }, // Added by Jan Binder { "Archos", 0x0e79, "XS202 (MTP mode)", 0x1208, DEVICE_FLAG_NONE }, // Reported by gudul1@users.sourceforge.net { "Archos", 0x0e79, "104 (MTP mode)", 0x120a, DEVICE_FLAG_NONE }, // Reported by Archos { "Archos", 0x0e79, "204 (MTP mode)", 0x120c, <API key> }, // Reported by anonymous Sourceforge user. { "Archos", 0x0e79, "404 (MTP mode)", 0x1301, <API key> }, // Reported by Archos { "Archos", 0x0e79, "404CAM (MTP mode)", 0x1303, <API key> }, // Reported by Etienne Chauchot <chauchot.etienne@free.fr> { "Archos", 0x0e79, "504 (MTP mode)", 0x1307, <API key> }, // Reported by Archos { "Archos", 0x0e79, "604 (MTP mode)", 0x1309, <API key> }, { "Archos", 0x0e79, "604WIFI (MTP mode)", 0x130b, <API key> }, // Reported by Kay McCormick <kaym@modsystems.com> { "Archos", 0x0e79, "704 mobile dvr", 0x130d, <API key> }, // Reported by Archos { "Archos", 0x0e79, "704TV (MTP mode)", 0x130f, <API key> }, { "Archos", 0x0e79, "405 (MTP mode)", 0x1311, <API key> }, // Reported by Joe Rabinoff { "Archos", 0x0e79, "605 (MTP mode)", 0x1313, <API key> }, // Reported by Archos { "Archos", 0x0e79, "605F (MTP mode)", 0x1315, <API key> }, { "Archos", 0x0e79, "705 (MTP mode)", 0x1319, <API key> }, { "Archos", 0x0e79, "TV+ (MTP mode)", 0x131b, <API key> }, { "Archos", 0x0e79, "105 (MTP mode)", 0x131d, <API key> }, { "Archos", 0x0e79, "405HDD (MTP mode)", 0x1321, <API key> }, // Reported by Jim Krehl <jimmuhk@users.sourceforge.net> { "Archos", 0x0e79, "5 (MTP mode)", 0x1331, <API key> }, // Reported by Adrien Guichard <tmor@users.sourceforge.net> { "Archos", 0x0e79, "5 (MTP mode)", 0x1333, <API key> }, // Reported by Archos { "Archos", 0x0e79, "7 (MTP mode)", 0x1335, <API key> }, { "Archos", 0x0e79, "SPOD (MTP mode)", 0x1341, <API key> }, { "Archos", 0x0e79, "5S IT (MTP mode)", 0x1351, <API key> }, { "Archos", 0x0e79, "5H IT (MTP mode)", 0x1357, <API key> }, { "Archos", 0x0e79, "Arnova Childpad", 0x1458, <API key> }, { "Archos", 0x0e79, "Arnova 8c G3", 0x145e, <API key> }, { "Archos", 0x0e79, "Arnova 10bG3 Tablet", 0x146b, <API key> }, { "Archos", 0x0e79, "97 Xenon", 0x149a, <API key> }, { "Archos", 0x0e79, "8o G9 (MTP mode)", 0x1508, <API key> }, { "Archos", 0x0e79, "8o G9 Turbo (MTP mode)", 0x1509, <API key> }, // Reported by Thackert <hackertenator@users.sourceforge.net> { "Archos", 0x0e79, "80G9", 0x1518, <API key> }, // Reported by Till <Till@users.sourceforge.net> { "Archos", 0x0e79, "101 G9", 0x1528, <API key> }, { "Archos", 0x0e79, "101 G9 (v2)", 0x1529, <API key> }, { "Archos", 0x0e79, "101 G9 Turbo 250 HD", 0x1538, <API key> }, { "Archos", 0x0e79, "101 G9 Turbo", 0x1539, <API key> }, { "Archos", 0x0e79, "70it2 (mode 1)", 0x1568, <API key> }, // Reported by Sebastien ROHAUT { "Archos", 0x0e79, "70it2 (mode 2)", 0x1569, <API key> }, /* * Dunlop (OEM of EGOMAN ltd?) reported by Nanomad * This unit is falsely detected as USB mass storage in Linux * prior to kernel 2.6.19 (fixed by patch from Alan Stern) * so on older kernels special care is needed to remove the * USB mass storage driver that erroneously binds to the device * interface. * * More problematic, this manufacturer+device ID seems to be * reused in a USB Mass Storage device named "Zipy Fox 8GB", * which means libmtp may mistreat it. */ { "Dunlop", 0x10d6, "MP3 player 1GB / EGOMAN MD223AFD", 0x2200, <API key>}, // Reported by Steven Black <stevenblack1956@users.sourceforge.net> // Obviously this company goes by many names. // This device is USB 2.0 only. Broken pipe on closing. // A later report indicates that this is also used by the iRiver E200 { "Memorex or iRiver", 0x10d6, "MMP 8585/8586 or iRiver E200", 0x2300, <API key> | <API key>}, /* * Sirius */ { "Sirius", 0x18f6, "Stiletto", 0x0102, DEVICE_FLAG_NONE }, // Reported by Chris Bagwell <chris@cnpbagwell.com> { "Sirius", 0x18f6, "Stiletto 2", 0x0110, DEVICE_FLAG_NONE }, // From: DoomHammer <gaczek@users.sourceforge.net> { "Nokia", 0x0421, "N81 Mobile Phone", 0x000a, DEVICE_FLAG_NONE }, // From an anonymous SourceForge user { "Nokia", 0x0421, "6120c Classic Mobile Phone", 0x002e, DEVICE_FLAG_NONE }, // From Stefano { "Nokia", 0x0421, "N96 Mobile Phone", 0x0039, DEVICE_FLAG_NONE }, // From Martijn van de Streek <martijn@vandestreek.net> { "Nokia", 0x0421, "6500c Classic Mobile Phone", 0x003c, DEVICE_FLAG_NONE }, // From: DoomHammer <gaczek@users.sourceforge.net> { "Nokia", 0x0421, "3110c Mobile Phone", 0x005f, DEVICE_FLAG_NONE }, // From: Vasily <spc-@users.sourceforge.net> { "Nokia", 0x0421, "3109c Mobile Phone", 0x0065, DEVICE_FLAG_NONE }, // From: <rawc@users.sourceforge.net> { "Nokia", 0x0421, "5310 XpressMusic", 0x006c, DEVICE_FLAG_NONE }, // From: robin (AT) headbank D0Tco DOTuk { "Nokia", 0x0421, "N95 Mobile Phone 8GB", 0x006e, DEVICE_FLAG_NONE }, // From Bastien Nocera <hadess@hadess.net> { "Nokia", 0x0421, "N82 Mobile Phone", 0x0074, <API key> }, // From Martijn van de Streek <martijn@vandestreek.net> { "Nokia", 0x0421, "N78 Mobile Phone", 0x0079, DEVICE_FLAG_NONE }, // From William Pettersson <the_enigma@users.sourceforge.net> { "Nokia", 0x0421, "6220 Classic", 0x008d, DEVICE_FLAG_NONE }, // From kellerkev@gmail.com { "Nokia", 0x0421, "N85 Mobile Phone", 0x0092, DEVICE_FLAG_NONE }, // From Alexandre LISSY <lissyx@users.sourceforge.net> { "Nokia", 0x0421, "6210 Navigator", 0x0098, DEVICE_FLAG_NONE }, // From: danielw { "Nokia", 0x0421, "E71", 0x00e4, DEVICE_FLAG_NONE }, // From: Laurent Bigonville <bigon@users.sourceforge.net> { "Nokia", 0x0421, "E66", 0x00e5, DEVICE_FLAG_NONE }, // From: Pier <pierlucalino@users.sourceforge.net> { "Nokia", 0x0421, "5320 XpressMusic", 0x00ea, DEVICE_FLAG_NONE }, // From: Gausie <innerdreams@users.sourceforge.net> { "Nokia", 0x0421, "5800 XpressMusic", 0x0154, <API key> }, // From: Willy Gardiol (web) <willy@gardiol.org> // Spurious errors for getting all objects, lead me to believe // this flag atleast is needed { "Nokia", 0x0421, "5800 XpressMusic v2", 0x0155, <API key> }, // Yet another version... I think { "Nokia", 0x0421, "5800 XpressMusic v3", 0x0159, <API key> }, // From an anonymous SourceForge user // Not verified to be MTP { "Nokia", 0x0421, "E63", 0x0179, DEVICE_FLAG_NONE }, // Reported by: max g <exactt@users.sourceforge.net> // Reported by: oswillios <loswillios@users.sourceforge.net> { "Nokia", 0x0421, "N79", 0x0186, DEVICE_FLAG_NONE }, // From an anonymous SourceForge user { "Nokia", 0x0421, "E71x", 0x01a1, DEVICE_FLAG_NONE }, // From Ser <ser@users.sourceforge.net> { "Nokia", 0x0421, "E52", 0x01cf, DEVICE_FLAG_NONE }, // From Marcus Meissner { "Nokia", 0x0421, "3710", 0x01ee, DEVICE_FLAG_NONE }, // From: AxeL <axel__17@users.sourceforge.net> { "Nokia", 0x0421, "N97-1", 0x01f4, DEVICE_FLAG_NONE }, // From: FunkyPenguin <awafaa@users.sourceforge.net> { "Nokia", 0x0421, "N97", 0x01f5, DEVICE_FLAG_NONE }, // From: Anonymous SourceForge user { "Nokia", 0x0421, "5130 XpressMusic", 0x0209, DEVICE_FLAG_NONE }, // From: Anonymous SourceForge user { "Nokia", 0x0421, "E72", 0x0221, DEVICE_FLAG_NONE }, // From: Anonymous SourceForge user { "Nokia", 0x0421, "5530", 0x0229, DEVICE_FLAG_NONE }, // From: Anonymous SourceForge user { "Nokia", 0x0421, "N97 mini", 0x026b, DEVICE_FLAG_NONE }, // From: Anonymous SourceForge user { "Nokia", 0x0421, "X6", 0x0274, <API key> }, // From: Alexander Kojevnikov <alex-kay@users.sourceforge.net> { "Nokia", 0x0421, "6600i", 0x0297, DEVICE_FLAG_NONE }, // From: Karthik Paithankar <whyagain2005@users.sourceforge.net> { "Nokia", 0x0421, "2710", 0x02c1, DEVICE_FLAG_NONE }, // From: Mick Stephenson <MickStep@users.sourceforge.net> { "Nokia", 0x0421, "5230", 0x02e2, DEVICE_FLAG_NONE }, // From: Lan Liu at Nokia <lan.liu@nokia.com> { "Nokia", 0x0421, "N8", 0x02fe, DEVICE_FLAG_NONE }, // From: Lan Liu at Nokia <lan.liu@nokia.com> { "Nokia", 0x0421, "N8 (Ovi mode)", 0x0302, DEVICE_FLAG_NONE }, // From: Martijn Hoogendoorn <m.hoogendoorn@gmail.com> { "Nokia", 0x0421, "E7", 0x0334, DEVICE_FLAG_NONE }, // From: Raul Metsma <raul@innovaatik.ee> { "Nokia", 0x0421, "E7 (Ovi mode)", 0x0335, DEVICE_FLAG_NONE }, // Reported by Serg <rd77@users.sourceforge.net> // Symbian phone { "Nokia", 0x0421, "C7", 0x03c1, DEVICE_FLAG_NONE }, // Reported by Anonymous SourceForge user { "Nokia", 0x0421, "C7 (ID2)", 0x03cd, DEVICE_FLAG_NONE }, // Reported by Anonymous SourceForge user { "Nokia", 0x0421, "N950", 0x03d2, DEVICE_FLAG_NONE }, { "Nokia", 0x0421, "3250 Mobile Phone", 0x0462, DEVICE_FLAG_NONE }, { "Nokia", 0x0421, "N93 Mobile Phone", 0x0478, DEVICE_FLAG_NONE }, { "Nokia", 0x0421, "5500 Sport Mobile Phone", 0x047e, DEVICE_FLAG_NONE }, { "Nokia", 0x0421, "N91 Mobile Phone", 0x0485, DEVICE_FLAG_NONE }, // From: Christian Rusa <kristous@users.sourceforge.net> { "Nokia", 0x0421, "5700 XpressMusic Mobile Phone", 0x04b4, DEVICE_FLAG_NONE }, // From: Mitchell Hicks <mitchix@yahoo.com> { "Nokia", 0x0421, "5300 Mobile Phone", 0x04ba, DEVICE_FLAG_NONE }, // From: Tiburce <tiburce@users.sourceforge.net> { "Nokia", 0x0421, "5200 Mobile Phone", 0x04be, <API key> }, // From Christian Arnold <webmaster@arctic-media.de> { "Nokia", 0x0421, "N73 Mobile Phone", 0x04d1, <API key> }, // From Swapan <swapan@yahoo.com> { "Nokia", 0x0421, "N75 Mobile Phone", 0x04e1, DEVICE_FLAG_NONE }, { "Nokia", 0x0421, "N93i Mobile Phone", 0x04e5, DEVICE_FLAG_NONE }, // From Anonymous Sourceforge User { "Nokia", 0x0421, "N95 Mobile Phone", 0x04ef, DEVICE_FLAG_NONE }, // From: Pat Nicholls <pat@patandannie.co.uk> { "Nokia", 0x0421, "N80 Internet Edition (Media Player)", 0x04f1, <API key> }, // From: Maxin B. John <maxin.john@gmail.com> { "Nokia", 0x0421, "N9", 0x051a, DEVICE_FLAG_NONE }, { "Nokia", 0x0421, "C5-00", 0x0592, DEVICE_FLAG_NONE }, // Reported by Sampo Savola // Covers Lumia 920, 820 and probably any WP8 device. { "Nokia", 0x0421, "Nokia Lumia WP8", 0x0661, DEVICE_FLAG_NONE }, // Reported by Richard Wall <richard@the-moon.net> { "Nokia", 0x05c6, "5530 Xpressmusic", 0x0229, DEVICE_FLAG_NONE }, // Reported by anonymous SourceForge user // One thing stated by reporter (Nokia model) another by the detect log... { "Nokia/Verizon", 0x05c6, "6205 Balboa/Verizon Music Phone", 0x3196, DEVICE_FLAG_NONE }, /* * Vendor ID 0x13d1 is some offshoring company in China, * in one source named "A-Max Technology Macao Commercial * Offshore Co. Ltd." sometime "CCTech". */ // Logik brand { "Logik", 0x13d1, "LOG DAX MP3 and DAB Player", 0x7002, <API key> }, // Technika brand // Reported by <Ooblick@users.sourceforge.net> { "Technika", 0x13d1, "MP-709", 0x7017, <API key> }, /* * RCA / Thomson */ // From kiki <omkiki@users.sourceforge.net> { "Thomson", 0x069b, "EM28 Series", 0x0774, DEVICE_FLAG_NONE }, { "Thomson / RCA", 0x069b, "Opal / Lyra MC4002", 0x0777, DEVICE_FLAG_NONE }, { "Thomson", 0x069b, "Lyra MC5104B (M51 Series)", 0x077c, DEVICE_FLAG_NONE }, { "Thomson", 0x069b, "RCA H106", 0x301a, <API key> }, // From Svenna <svenna@svenna.de> // Not confirmed to be MTP. { "Thomson", 0x069b, "scenium E308", 0x3028, DEVICE_FLAG_NONE }, // From XNJB user { "Thomson / RCA", 0x069b, "Lyra HC308A", 0x3035, DEVICE_FLAG_NONE }, /* * Fujitsu devices */ { "Fujitsu, Ltd", 0x04c5, "F903iX HIGH-SPEED", 0x1140, DEVICE_FLAG_NONE }, // Reported by Thomas Bretthauer { "Fujitsu, Ltd", 0x04c5, "STYLISTIC M532", 0x133b, <API key> }, /* * Palm device userland program named Pocket Tunes * Reported by Peter Gyongyosi <gyp@impulzus.com> */ { "NormSoft, Inc.", 0x1703, "Pocket Tunes", 0x0001, DEVICE_FLAG_NONE }, // Reported by anonymous submission { "NormSoft, Inc.", 0x1703, "Pocket Tunes 4", 0x0002, DEVICE_FLAG_NONE }, /* * TrekStor, Medion and Maxfield devices * Their datasheet claims their devices are dualmode so probably needs to * unload the attached drivers here. */ // Reported by Stefan Voss <svoss@web.de> // This is a Sigmatel SoC with a hard disk. { "TrekStor", 0x066f, "Vibez 8/12GB", 0x842a, <API key> | <API key> }, // Reported by anonymous SourceForge user. // This one done for Medion, whatever that is. Error reported so assume // the same bug flag as its ancestor above. { "Medion", 0x066f, "MD8333", 0x8550, <API key> | <API key> }, // Reported by anonymous SourceForge user { "Medion", 0x066f, "MD8333", 0x8588, <API key> | <API key> }, // The vendor ID is "Quanta Computer, Inc." // same as Olivetti Olipad 110 // Guessing on device flags { "Medion", 0x0408, "MD99000 (P9514)/Olivetti Olipad 110", 0xb009, <API key> | <API key> }, // Reported by Richard Eigenmann <richieigenmann@users.sourceforge.net> { "Medion", 0x0408, "Lifetab P9514", 0xb00a, <API key> | <API key> }, // Reported by anonymous SourceForge user { "Maxfield", 0x066f, "G-Flash NG 1GB", 0x846c, <API key> | <API key> }, // Reported by PaoloC <efmpsc@users.sourceforge.net> // Apparently SigmaTel has an SDK for MTP players with this ID { "SigmaTel Inc.", 0x066f, "MTPMSCN Audio Player", 0xa010, <API key> | <API key> }, // Reported by Cristi Magherusan <majeru@gentoo.ro> { "TrekStor", 0x0402, "i.Beat Sweez FM", 0x0611, <API key> }, // Reported by Fox-ino <fox-ino@users.sourceforge.net> // No confirmation that this is really MTP so commented it out. // { "ALi Corp.", 0x0402, "MPMAN 2GB", 0x5668, // <API key> }, // Reported by Anonymous SourceForge user {"TrekStor", 0x1e68, "i.Beat Organix 2.0", 0x0002, <API key> }, /* * Disney/Tevion/MyMusix */ // Reported by XNJB user { "Disney", 0x0aa6, "MixMax", 0x6021, DEVICE_FLAG_NONE }, // Reported by anonymous Sourceforge user { "Tevion", 0x0aa6, "MD 81488", 0x3011, DEVICE_FLAG_NONE }, // Reported by Peter Hedlund <peter@peterandlinda.com> { "MyMusix", 0x0aa6, "PD-6070", 0x9601, <API key> | <API key> | <API key> | <API key> }, // Reported by Patrik Johansson <Patrik.Johansson@qivalue.com> { "Cowon", 0x0e21, "iAudio U3 (MTP mode)", 0x0701, <API key> | <API key> | <API key> | <API key> }, // Reported by Kevin Michael Smith <hai-etlik@users.sourceforge.net> { "Cowon", 0x0e21, "iAudio 6 (MTP mode)", 0x0711, <API key> | <API key> }, // Reported by Roberth Karman { "Cowon", 0x0e21, "iAudio 7 (MTP mode)", 0x0751, <API key> | <API key> | <API key> | <API key> }, // Reported by an anonymous SourceForge user { "Cowon", 0x0e21, "iAudio U5 (MTP mode)", 0x0761, <API key> | <API key> | <API key> | <API key> }, // Reported by TJ Something <tjbk_tjb@users.sourceforge.net> { "Cowon", 0x0e21, "iAudio D2 (MTP mode)", 0x0801, <API key> | <API key> | <API key> | <API key> }, // Reported by anonymous Sourceforge user { "Cowon", 0x0e21, "iAudio D2+ FW 2.x (MTP mode)", 0x0861, <API key> | <API key> | <API key> | <API key> }, // From Rockbox device listing { "Cowon", 0x0e21, "iAudio D2+ DAB FW 4.x (MTP mode)", 0x0871, <API key> | <API key> | <API key> | <API key> }, // From Rockbox device listing { "Cowon", 0x0e21, "iAudio D2+ FW 3.x (MTP mode)", 0x0881, <API key> | <API key> | <API key> | <API key> }, // From Rockbox device listing { "Cowon", 0x0e21, "iAudio D2+ DMB FW 1.x (MTP mode)", 0x0891, <API key> | <API key> | <API key> | <API key> }, // Reported by <twkonefal@users.sourceforge.net> { "Cowon", 0x0e21, "iAudio S9 (MTP mode)", 0x0901, <API key> | <API key> | <API key> | <API key> }, // Reported by Dan Nicholson <dbn.lists@gmail.com> { "Cowon", 0x0e21, "iAudio 9 (MTP mode)", 0x0911, <API key> | <API key> | <API key> | <API key> }, // Reported by Franck VDL <franckv@users.sourceforge.net> { "Cowon", 0x0e21, "iAudio J3 (MTP mode)", 0x0921, <API key> | <API key> | <API key> | <API key> }, // Reported by anonymous SourceForge user { "Cowon", 0x0e21, "iAudio X7 (MTP mode)", 0x0931, <API key> | <API key> | <API key> | <API key> }, // Reported by anonymous SourceForge user { "Cowon", 0x0e21, "iAudio C2 (MTP mode)", 0x0941, <API key> | <API key> | <API key> | <API key> }, { "Cowon", 0x0e21, "iAudio 10 (MTP mode)", 0x0952, <API key> | <API key> | <API key> | <API key> }, /* * Insignia, dual-mode. */ { "Insignia", 0x19ff, "NS-DV45", 0x0303, <API key> }, // Reported by Rajan Bella <rajanbella@yahoo.com> { "Insignia", 0x19ff, "Sport Player", 0x0307, <API key> }, // Reported by "brad" (anonymous, sourceforge) { "Insignia", 0x19ff, "Pilot 4GB", 0x0309, <API key> }, /* * LG Electronics */ // Uncertain if this is really the MTP mode device ID... { "LG Electronics Inc.", 0x043e, "T54", 0x7040, <API key> }, // Not verified - anonymous submission { "LG Electronics Inc.", 0x043e, "UP3", 0x70b1, DEVICE_FLAG_NONE }, // Reported by Joseph Nahmias <joe@nahimas.net> { "LG Electronics Inc.", 0x1004, "VX8550 V CAST Mobile Phone", 0x6010, <API key> | <API key> }, // Reported by Cyrille Potereau <cyrille.potereau@wanadoo.fr> { "LG Electronics Inc.", 0x1004, "KC910 Renoir Mobile Phone", 0x608f, <API key> }, // Reported by Aaron Slunt <tongle@users.sourceforge.net> { "LG Electronics Inc.", 0x1004, "GR-500 Music Player", 0x611b, <API key> | <API key> }, { "LG Electronics Inc.", 0x1004, "KM900", 0x6132, <API key> | <API key> }, { "LG Electronics Inc.", 0x1004, "LG8575", 0x619a, <API key> | <API key> }, { "LG Electronics Inc.", 0x1004, "V909 G-Slate", 0x61f9, <API key> | <API key> }, { "LG Electronics Inc.", 0x1004, "LG2 Optimus", 0x6225, <API key> | <API key> }, // Reported by Brian J. Murrell { "LG Electronics Inc.", 0x1004, "LG-E610/E612/E617G/E970/P700", 0x631c, <API key> }, /* * Sony * It could be that these PIDs are one-per hundred series, so * NWZ-A8xx is 0325, NWZ-S5xx is 0x326 etc. We need more devices * reported to see a pattern here. */ // Reported by Alessandro Radaelli <alessandro.radaelli@aruba.it> { "Sony", 0x054c, "NWZ-A815/NWZ-A818", 0x0325, <API key> }, // Reported by anonymous Sourceforge user. { "Sony", 0x054c, "NWZ-S516", 0x0326, <API key> }, // Reported by Endre Oma <endre.88.oma@gmail.com> { "Sony", 0x054c, "NWZ-S615F/NWZ-S616F/NWZ-S618F", 0x0327, <API key> }, // Reported by Jean-Marc Bourguet <jm@bourguet.org> { "Sony", 0x054c, "NWZ-S716F", 0x035a, <API key> }, // Reported by Anon SF User / Anthon van der Neut <avanderneut@avid.com> { "Sony", 0x054c, "NWZ-A826/NWZ-A828/NWZ-A829", 0x035b, <API key> }, // Reported by Niek Klaverstijn <niekez@users.sourceforge.net> { "Sony", 0x054c, "NWZ-A726/NWZ-A728/NWZ-A768", 0x035c, <API key> }, // Reported by Mehdi AMINI <mehdi.amini - at - ulp.u-strasbg.fr> { "Sony", 0x054c, "NWZ-B135", 0x036e, <API key> }, // Reported by <tiagoboldt@users.sourceforge.net> { "Sony", 0x054c, "NWZ-E436F", 0x0385, <API key> }, // Reported by Michael Wilkinson { "Sony", 0x054c, "NWZ-W202", 0x0388, <API key> }, // Reported by Ondrej Sury <ondrej@sury.org> { "Sony", 0x054c, "NWZ-S739F", 0x038c, <API key> }, // Reported by Marco Filipe Nunes Soares Abrantes Pereira <marcopereira@ua.pt> { "Sony", 0x054c, "NWZ-S638F", 0x038e, <API key> }, // Reported by Elliot <orwells@users.sourceforge.net> { "Sony", 0x054c, "NWZ-X1050B/NWZ-X1060B", 0x0397, <API key> }, // Reported by Silvio J. Gutierrez <silviogutierrez@users.sourceforge.net> { "Sony", 0x054c, "NWZ-X1051/NWZ-X1061", 0x0398, <API key> }, // Reported by Gregory Boddin <gregory@siwhine.net> { "Sony", 0x054c, "NWZ-B142F", 0x03d8, <API key> }, // Reported by Rick Warner <rick@reptileroom.net> { "Sony", 0x054c, "NWZ-E344/E345", 0x03fc, <API key> }, // Reported by Jonathan Stowe <gellyfish@users.sourceforge.net> { "Sony", 0x054c, "NWZ-E445", 0x03fd, <API key> }, // Reported by Anonymous SourceForge user { "Sony", 0x054c, "NWZ-S545", 0x03fe, <API key> }, { "Sony", 0x054c, "NWZ-A845", 0x0404, <API key> }, // Reported by anonymous SourceForge user { "Sony", 0x054c, "NWZ-W252B", 0x04bb, <API key> }, // Suspect this device has strong DRM features { "Sony", 0x054c, "NWZ-B153F", 0x04be, <API key> }, { "Sony", 0x054c, "NWZ-E354", 0x04cb, <API key> }, // Reported by Toni Burgarello { "Sony", 0x054c, "NWZ-S754", 0x04cc, <API key> }, // Reported by Hideki Yamane <henrich@debian.org> { "Sony", 0x054c, "Sony Tablet P1", 0x04d1, <API key> }, // Reported by dmiceman { "Sony", 0x054c, "NWZ-B163F", 0x059a, <API key> }, { "Sony", 0x054c, "NWZ-E464", 0x05a6, <API key> }, // Reported by Jan Rheinlaender <jrheinlaender@users.sourceforge.net> { "Sony", 0x054c, "NWZ-S765", 0x05a8, <API key> }, // Olivier Keshavjee <olivierkes@users.sourceforge.net> { "Sony", 0x054c, "Sony Tablet S", 0x05b3, <API key> }, // Reported by ghalambaz <ghalambaz@users.sourceforge.net> { "Sony", 0x054c, "Sony Tablet S1", 0x05b4, <API key> }, { "Sony", 0x054c, "NWZ-B173F", 0x0689, <API key> }, { "Sony", 0x054c, "DCR-SR75", 0x1294, <API key> }, /* * SonyEricsson * These initially seemed to support GetObjPropList but later revisions * of the firmware seem to have broken it, so all are flagged as broken * for now. */ { "SonyEricsson", 0x0fce, "K850i", 0x0075, <API key> }, // Reported by Michael Eriksson { "SonyEricsson", 0x0fce, "W910", 0x0076, <API key> }, // Reported by Zack <zackdvd@users.sourceforge.net> { "SonyEricsson", 0x0fce, "W890i", 0x00b3, <API key> }, // Reported by robert dot ahlskog at gmail { "SonyEricsson", 0x0fce, "W760i", 0x00c6, <API key> }, { "SonyEricsson", 0x0fce, "C902", 0x00d4, <API key> }, // Reported by an anonymous SourceForge user { "SonyEricsson", 0x0fce, "C702", 0x00d9, <API key> }, // Reported by Christian Zuckschwerdt <christian@zuckschwerdt.org> { "SonyEricsson", 0x0fce, "W980", 0x00da, <API key> }, // Reported by David Taylor <davidt-libmtp@yadt.co.uk> { "SonyEricsson", 0x0fce, "C905", 0x00ef, <API key> }, // Reported by David House <dmhouse@users.sourceforge.net> { "SonyEricsson", 0x0fce, "W595", 0x00f3, <API key> | <API key> }, // Reported by Mattias Evensson <mevensson@users.sourceforge.net> { "SonyEricsson", 0x0fce, "W902", 0x00f5, <API key> }, // Reported by Sarunas <sarunas@users.sourceforge.net> // Doesn't need any flags according to reporter { "SonyEricsson", 0x0fce, "T700", 0x00fb, <API key> }, { "SonyEricsson", 0x0fce, "W705/W715", 0x0105, <API key> }, { "SonyEricsson", 0x0fce, "W995", 0x0112, <API key> }, // Reported by anonymous SourceForge user { "SonyEricsson", 0x0fce, "U5", 0x0133, <API key> }, // Reported by Flo <lhugsereg@users.sourceforge.net> { "SonyEricsson", 0x0fce, "U8i", 0x013a, <API key> }, // Reported by xirotyu <xirotyu@users.sourceforge.net> { "SonyEricsson", 0x0fce, "j10i2 (Elm)", 0x0144, <API key> }, // Reported by Serge Chirik <schirik@users.sourceforge.net> { "SonyEricsson", 0x0fce, "j108i (Cedar)", 0x014e, <API key> }, { "SonyEricsson", 0x0fce, "W302", 0x10c8, <API key> }, // Reported by Anonymous Sourceforge user { "SonyEricsson", 0x0fce, "j10i (Elm)", 0xd144, <API key> }, // Reported by Thomas Schweitzer <thomas_-_s@users.sourceforge.net> { "SonyEricsson", 0x0fce, "K550i", 0xe000, <API key> }, { "SonyEricsson", 0x0fce, "LT15i Xperia arc S MTP", 0x014f, DEVICE_FLAG_NONE }, { "SonyEricsson", 0x0fce, "MT11i Xperia Neo MTP", 0x0156, DEVICE_FLAG_NONE }, { "SonyEricsson", 0x0fce, "IS12S Xperia Acro MTP", 0x0157, DEVICE_FLAG_NONE }, { "SonyEricsson", 0x0fce, "MK16i Xperia MTP", 0x015a, DEVICE_FLAG_NONE }, { "SonyEricsson", 0x0fce, "R800/R88i Xperia Play MTP", 0x015d, DEVICE_FLAG_NONE }, { "SonyEricsson", 0x0fce, "ST18a Xperia Ray MTP", 0x0161, DEVICE_FLAG_NONE }, { "SonyEricsson", 0x0fce, "SK17i Xperia Mini Pro MTP", 0x0166, DEVICE_FLAG_NONE }, { "SonyEricsson", 0x0fce, "ST15i Xperia Mini MTP", 0x0167, DEVICE_FLAG_NONE }, { "SonyEricsson", 0x0fce, "ST17i Xperia Active MTP", 0x0168, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT26i Xperia S MTP", 0x0169, <API key> }, { "SONY", 0x0fce, "WT19i Live Walkman MTP", 0x016d, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "ST21i Xperia Tipo MTP", 0x0170, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "ST15i Xperia U MTP", 0x0171, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT22i Xperia P MTP", 0x0172, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "MT27i Xperia Sola MTP", 0x0173, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT26w Xperia Acro HD IS12S MTP", 0x0175, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT26w Xperia Acro HD SO-03D MTP", 0x0176, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT28at Xperia Ion MTP", 0x0177, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT29i Xperia GX MTP", 0x0178, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "ST27i/ST27a Xperia go MTP", 0x017e, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "ST23i Xperia Miro MTP", 0x0180, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "SO-05D Xperia SX MTP", 0x0181, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT30p Xperia T MTP", 0x0182, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT25i Xperia V MTP", 0x0186, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia J MTP", 0x0188, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia ZL MTP", 0x0189, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia E MTP", 0x018c, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Tablet Z MTP", 0x018d, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Z MTP", 0x0193, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Tablet Z MTP", 0x0194, DEVICE_FLAG_NONE }, /* * MTP+UMS personalities of MTP devices (see above) */ { "SonyEricsson", 0x0fce, "IS12S Xperia Acro MTP+CDROM", 0x4157, DEVICE_FLAG_NONE }, { "SonyEricsson", 0x0fce, "ST17i Xperia Active MTP+CDROM", 0x4168, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT26i Xperia S MTP+CDROM", 0x4169, <API key> }, { "SONY", 0x0fce, "ST21i Xperia Tipo MTP+CDROM", 0x4170, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "ST25i Xperia U MTP+CDROM", 0x4171, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT22i Xperia P MTP+CDROM", 0x4172, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "MT27i Xperia Sola MTP+CDROM", 0x4173, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT26w Xperia Acro HD IS12S MTP+CDROM", 0x4175, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT26w Xperia Acro HD SO-03D MTP+CDROM", 0x4176, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT28at Xperia Ion MTP+CDROM", 0x4177, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT29i Xperia GX MTP+CDROM", 0x4178, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "ST27i/ST27a Xperia go MTP+CDROM", 0x417e, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "ST23i Xperia Miro MTP+CDROM", 0x4180, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "SO-05D Xperia SX MTP+CDROM", 0x4181, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT30p Xperia T MTP+CDROM", 0x4182, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT25i Xperia V MTP+CDROM", 0x4186, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia J MTP+CDROM", 0x4188, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia ZL MTP", 0x4189, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia E MTP+CDROM", 0x418c, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Tablet Z MTP", 0x418d, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Z MTP", 0x4193, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Tablet Z MTP", 0x4194, DEVICE_FLAG_NONE }, /* * MTP+ADB personalities of MTP devices (see above) */ { "SonyEricsson", 0x0fce, "LT15i Xperia Arc MTP+ADB", 0x514f, DEVICE_FLAG_NONE }, { "SonyEricsson", 0x0fce, "MT11i Xperia Neo MTP+ADB", 0x5156, DEVICE_FLAG_NONE }, { "SonyEricsson", 0x0fce, "IS12S Xperia Acro MTP+ADB", 0x5157, DEVICE_FLAG_NONE }, { "SonyEricsson", 0x0fce, "MK16i Xperia MTP+ADB", 0x515a, DEVICE_FLAG_NONE }, { "SonyEricsson", 0x0fce, "R800/R88i Xperia Play MTP+ADB", 0x515d, DEVICE_FLAG_NONE }, { "SonyEricsson", 0x0fce, "ST18i Xperia Ray MTP+ADB", 0x5161, DEVICE_FLAG_NONE }, { "SonyEricsson", 0x0fce, "SK17i Xperia Mini Pro MTP+ADB", 0x5166, DEVICE_FLAG_NONE }, { "SonyEricsson", 0x0fce, "ST15i Xperia Mini MTP+ADB", 0x5167, DEVICE_FLAG_NONE }, { "SonyEricsson", 0x0fce, "ST17i Xperia Active MTP+ADB", 0x5168, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT26i Xperia S MTP+ADB", 0x5169, <API key> }, { "SonyEricsson", 0x0fce, "SK17i Xperia Mini Pro MTP+ADB", 0x516d, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "ST21i Xperia Tipo MTP+ADB", 0x5170, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "ST25i Xperia U MTP+ADB", 0x5171, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT22i Xperia P MTP+ADB", 0x5172, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "MT27i Xperia Sola MTP+ADB", 0x5173, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "IS12S Xperia Acro HD MTP+ADB", 0x5175, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "SO-03D Xperia Acro HD MTP+ADB", 0x5176, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT28at Xperia Ion MTP+ADB", 0x5177, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT29i Xperia GX MTP+ADB", 0x5178, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "ST27i/ST27a Xperia go MTP+ADB", 0x517e, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "ST23i Xperia Miro MTP+ADB", 0x5180, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "SO-05D Xperia SX MTP+ADB", 0x5181, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT30p Xperia T MTP+ADB", 0x5182, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT25i Xperia V MTP+ADB", 0x5186, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia J MTP+ADB", 0x5188, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia ZL MTP", 0x5189, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia E MTP+ADB", 0x518c, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Tablet Z MTP", 0x518d, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Z MTP", 0x5193, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Tablet Z MTP", 0x5194, DEVICE_FLAG_NONE }, /* * MTP+UMS modes * This mode is for using MTP on the internal storage (eMMC) * and using UMS (Mass Storage Device Class) on the external * SD card */ { "SONY", 0x0fce, "MT27i Xperia Sola MTP+UMS", 0xa173, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "IS12S Xperia Acro HD MTP+UMS", 0xa175, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "SO-03D Xperia Acro HD MTP+UMS", 0xa176, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT28at Xperia Ion MTP+UMS", 0xa177, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "ST27i/ST27a Xperia go MTP+UMS", 0xa17e, DEVICE_FLAG_NONE }, /* * MTP+UMS+ADB modes * Like the above, but also ADB */ { "SONY", 0x0fce, "MT27i Xperia Sola MTP+UMS+ADB", 0xb173, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "IS12S Xperia Acro MTP+UMS+ADB", 0xb175, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "SO-03D Xperia Acro MTP+UMS+ADB", 0xb176, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT28at Xperia Ion MTP+UMS+ADB", 0xb177, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "ST27i/ST27a Xperia go MTP+UMS+ADB", 0xb17e, DEVICE_FLAG_NONE }, /* * Motorola * Assume <API key> on all of these. */ // Reported by David Boyd <tiggrdave@users.sourceforge.net> { "Motorola", 0x22b8, "V3m/V750 verizon", 0x2a65, <API key> | <API key> }, { "Motorola", 0x22b8, "Atrix/Razr HD (MTP)", 0x2e32, <API key> }, { "Motorola", 0x22b8, "Atrix/Razr HD (MTP+ADB)", 0x2e33, <API key> }, { "Motorola", 0x22b8, "RAZR M (XT907)", 0x2e51, <API key> }, // Reported by Jader Rodrigues Simoes <jadersimoes@users.sourceforge.net> { "Motorola", 0x22b8, "Xoom 2 Media Edition (ID2)", 0x41cf, <API key> }, // Reported by Steven Roemen <sdroemen@users.sourceforge.net> { "Motorola", 0x22b8, "Droid X/MB525 (Defy)", 0x41d6, DEVICE_FLAG_NONE }, { "Motorola", 0x22b8, "DROID2 (ID1)", 0x41da, DEVICE_FLAG_NONE }, { "Motorola", 0x22b8, "Milestone / Verizon Droid", 0x41dc, <API key> }, { "Motorola", 0x22b8, "DROID2 (ID2)", 0x42a7, <API key> }, { "Motorola", 0x22b8, "Xoom 2 Media Edition", 0x4311, <API key> }, // Reported by B,H,Kissinger <mrkissinger@users.sourceforge.net> { "Motorola", 0x22b8, "XT912/XT928", 0x4362, <API key> }, // Reported by Lundgren <alundgren@users.sourceforge.net> { "Motorola", 0x22b8, "DROID4", 0x437f, <API key> }, // Reported by Marcus Meissner to libptp2 { "Motorola", 0x22b8, "IdeaPad K1", 0x4811, <API key> }, // Reported by Hans-Joachim Baader <hjb@pro-linux.de> to libptp2 { "Motorola", 0x22b8, "A1200", 0x60ca, <API key> }, { "Motorola", 0x22b8, "MTP Test Command Interface", 0x6413, <API key> }, // Reported by anonymous user { "Motorola", 0x22b8, "RAZR2 V8/U9/Z6", 0x6415, <API key> }, // Reported by Brian Dolbec <dol-sen@users.sourceforge.net> { "Motorola", 0x22b8, "Atrix MB860 (MTP)", 0x7088, <API key> }, { "Motorola", 0x22b8, "Xoom (Factory test)", 0x70a3, <API key> }, { "Motorola", 0x22b8, "Xoom (MTP)", 0x70a8, <API key> }, { "Motorola", 0x22b8, "Xoom (MTP+ADB)", 0x70a9, <API key> }, // "carried by C Spire and other CDMA US carriers" { "Motorola", 0x22b8, "Milestone X2", 0x70ca, <API key> }, { "Motorola", 0x22b8, "XT890/907 (MTP)", 0x710d, <API key> }, { "Motorola", 0x22b8, "XT890/907 (MTP+ADB)", 0x710e, <API key> }, { "Motorola", 0x22b8, "XT890/907 (MTP+?)", 0x710f, <API key> }, /* * Google * These guys lend their Vendor ID to anyone who comes down the * road to produce an Android tablet it seems... The Vendor ID * was originally used for Nexus phones */ { "Google Inc (for Ainol Novo)", 0x18d1, "Fire/Flame", 0x0007, <API key> }, { "Google Inc (for Sony)", 0x18d1, "S1", 0x05b3, <API key> }, // Reported by anonymous Sourceforge user { "Google Inc (for Barnes & Noble)", 0x18d1, "Nook Color", 0x2d02, <API key> }, // Reported by anonymous Sourceforge user { "Google Inc (for Asus)", 0x18d1, "TF201 Transformer", 0x4d00, <API key> }, // Reported by anonymous Sourceforge user { "Google Inc (for Asus)", 0x18d1, "TF101 Transformer", 0x4e0f, <API key> }, // 0x4e21 (Nexus S) is a USB Mass Storage device. // Reported by Chris Smith <tcgsmythe@users.sourceforge.net> { "Google Inc (for Asus)", 0x18d1, "Nexus 7 (MTP)", 0x4e41, <API key> }, // Reported by Michael Hess <mhess126@gmail.com> { "Google Inc (for Asus)", 0x18d1, "Nexus 7 (MTP+ADB)", 0x4e42, <API key> }, { "Google Inc (for LG Electronics/Samsung)", 0x18d1, "Nexus 4/10 (MTP)", 0x4ee1, <API key> }, { "Google Inc (for LG Electronics/Samsung)", 0x18d1, "Nexus 4/10 (MTP+ADB)", 0x4ee2, <API key> }, // WiFi-only version of Xoom { "Google Inc (for Motorola)", 0x18d1, "Xoom (MZ604)", 0x70a8, <API key> }, { "Google Inc (for Toshiba)", 0x18d1, "Thrive 7/AT105", 0x7102, <API key> }, { "Google Inc (for Lenovo)", 0x18d1, "Ideapad K1", 0x740a, <API key> }, // Another OEM for Medion { "Google Inc (for Medion)", 0x18d1, "MD99000 (P9514)", 0xb00a, <API key> }, // Reported by Frederik Himpe <fhimpe@telenet.be> { "Google Inc (for LG Electronics)", 0x18d1, "P990/Optimus (Cyanogen)", 0xd109, <API key> }, { "Google Inc (for LG Electronics)", 0x18d1, "P990/Optimus", 0xd10a, <API key> }, /* * Media Keg */ // Reported by Rajan Bella <rajanbella@yahoo.com> { "Kenwood", 0x0b28, "Media Keg HD10GB7 Sport Player", 0x100c, <API key>}, /* * Micro-Star International (MSI) */ // Reported by anonymous sourceforge user. { "Micro-Star International", 0x0db0, "P610/Model MS-5557", 0x5572, DEVICE_FLAG_NONE }, /* * FOMA */ { "FOMA", 0x06d3, "D905i", 0x21ba, DEVICE_FLAG_NONE }, /* * Haier */ // Both reported by an anonymous SourceForge user // This is the 30 GiB model { "Haier", 0x1302, "Ibiza Rhapsody", 0x1016, DEVICE_FLAG_NONE }, // This is the 4/8 GiB model { "Haier", 0x1302, "Ibiza Rhapsody", 0x1017, DEVICE_FLAG_NONE }, /* * Panasonic */ // Reported by dmizer { "Panasonic", 0x04da, "P905i", 0x2145, DEVICE_FLAG_NONE }, // Reported by Taku { "Panasonic", 0x04da, "P906i", 0x2158, DEVICE_FLAG_NONE }, /* * Polaroid */ { "Polaroid", 0x0546, "Freescape/MPU-433158", 0x2035, DEVICE_FLAG_NONE }, /* * Pioneer */ // Reported by Dan Allen <dan.j.allen@gmail.com> { "Pioneer", 0x08e4, "XMP3", 0x0148, DEVICE_FLAG_NONE }, /* * Slacker Inc. * Put in all evilness flags because it looks fragile. */ // Reported by Pug Fantus <pugfantus@users.sourceforge.net> { "Slacker Inc.", 0x1bdc, "Slacker Portable Media Player", 0xfabf, <API key> | <API key> | <API key> | <API key> }, // Reported by anonymous user { "Conceptronic", 0x1e53, "CMTD2", 0x0005, <API key> }, // Reported by Demadridsur <demadridsur@gmail.com> { "O2 Sistemas", 0x1e53, "ZoltarTV", 0x0006, <API key> }, // Reported by da-beat <dabeat@gmail.com> { "Wyplay", 0x1e53, "Wyplayer", 0x0007, <API key> }, // Reported by Sense Hofstede <qense@users.sourceforge.net> { "Perception Digital, Ltd", 0x0aa6, "Gigaware GX400", 0x9702, DEVICE_FLAG_NONE }, /* * RIM's BlackBerry */ // Reported by Nicolas VIVIEN <nicolas@vivien.fr> { "RIM", 0x0fca, "BlackBerry Storm/9650", 0x8007, <API key> | <API key> | <API key> }, /* * Nextar */ { "Nextar", 0x0402, "MA715A-8R", 0x5668, DEVICE_FLAG_NONE }, /* * Coby */ { "Coby", 0x1e74, "COBY MP705", 0x6512, DEVICE_FLAG_NONE }, #if 0 { "Apple", 0x05ac, "iPhone", 0x1290, DEVICE_FLAG_NONE }, { "Apple", 0x05ac, "iPod Touch 1st Gen", 0x1291, DEVICE_FLAG_NONE }, { "Apple", 0x05ac, "iPhone 3G", 0x1292, DEVICE_FLAG_NONE }, { "Apple", 0x05ac, "iPod Touch 2nd Gen", 0x1293, DEVICE_FLAG_NONE }, { "Apple", 0x05ac, "iPhone 3GS", 0x1294, DEVICE_FLAG_NONE }, { "Apple", 0x05ac, "0x1296", 0x1296, DEVICE_FLAG_NONE }, { "Apple", 0x05ac, "0x1297", 0x1297, DEVICE_FLAG_NONE }, { "Apple", 0x05ac, "0x1298", 0x1298, DEVICE_FLAG_NONE }, { "Apple", 0x05ac, "iPod Touch 3rd Gen", 0x1299, DEVICE_FLAG_NONE }, { "Apple", 0x05ac, "iPad", 0x129a, DEVICE_FLAG_NONE }, #endif // Reported by anonymous SourceForge user, also reported as // Pantech Crux, claming to be: // Manufacturer: Qualcomm // Model: Windows Simulator { "Curitel Communications, Inc.", 0x106c, "Verizon Wireless Device", 0x3215, DEVICE_FLAG_NONE }, // Reported by: Jim Hanrahan <goshawkjim@users.sourceforge.net> { "Pantech", 0x106c, "Crux", 0xf003, DEVICE_FLAG_NONE }, /* * Asus * Pattern of PIDs on Android devices seem to be: * n+0 = MTP * n+1 = MTP+ADB * n+2 = ? * n+3 = ? * n+4 = PTP */ // Reported by Glen Overby { "Asus", 0x0b05, "TF300 Transformer (MTP)", 0x4c80, <API key> }, // Reported by jaile <jaile@users.sourceforge.net> { "Asus", 0x0b05, "TF300 Transformer (MTP+ADB)", 0x4c81, <API key> }, // Repored by Florian Apolloner <f-apolloner@users.sourceforge.net> { "Asus", 0x0b05, "TF700 Transformer (MTP)", 0x4c90, <API key> }, { "Asus", 0x0b05, "TF700 Transformer (MTP+ADB)", 0x4c91, <API key> }, { "Asus", 0x0b05, "MeMo Pad Smart 10", 0x4cd0, <API key> }, { "Asus", 0x0b05, "TF201 Transformer Prime (keyboard dock)", 0x4d00, <API key> }, { "Asus", 0x0b05, "TF201 Transformer Prime (tablet only)", 0x4d01, <API key> }, // 4d04 is the PTP mode, don't add it { "Asus", 0x0b05, "SL101 (MTP)", 0x4e00, <API key> }, { "Asus", 0x0b05, "SL101 (MTP+ADB)", 0x4e01, <API key> }, { "Asus", 0x0b05, "TF101 Eeepad Transformer (MTP)", 0x4e0f, <API key> }, { "Asus", 0x0b05, "TF101 Eeepad Transformer (MTP+ADB)", 0x4e1f, <API key> }, { "Asus", 0x0b05, "PadFone (MTP)", 0x5200, <API key> }, { "Asus", 0x0b05, "PadFone (MTP+ADB)", 0x5201, <API key> }, { "Asus", 0x0b05, "PadFone 2 (MTP+?)", 0x5210, <API key> }, { "Asus", 0x0b05, "PadFone 2 (MTP)", 0x5211, <API key> }, /* * Lenovo */ { "Lenovo", 0x17ef, "K1", 0x740a, <API key> }, // Reported by anonymous sourceforge user // Adding Android default bug flags since it appears to be an Android { "Lenovo", 0x17ef, "ThinkPad Tablet", 0x741c, <API key> }, // Reported by: XChesser <XChesser@users.sourceforge.net> { "Lenovo", 0x17ef, "P700", 0x7497, <API key> }, // Reported by: anonymous sourceforge user { "Lenovo", 0x17ef, "Lifetab S9512", 0x74cc, <API key> }, // Reported by Brian J. Murrell { "Lenovo", 0x17ef, "IdeaTab A2109A", 0x7542, <API key> }, /* * Huawei */ // Reported by anonymous SourceForge user { "Huawei", 0x12d1, "Honor U8860", 0x1051, <API key> }, // Reported by anonymous SourceForge user { "Huawei", 0x12d1, "U8815/U9200", 0x1052, <API key> }, // Reported by anonymous SourceForge user { "Huawei", 0x12d1, "Mediapad (mode 0)", 0x360f, <API key> }, // Reported by Bearsh <bearsh@users.sourceforge.net> { "Huawei", 0x12d1, "Mediapad (mode 1)", 0x361f, <API key> }, /* * ZTE * Android devices reported by junwang <lovewjlove@users.sourceforge.net> */ { "ZTE", 0x19d2, "V55 ID 1", 0x0244, <API key> }, { "ZTE", 0x19d2, "V55 ID 2", 0x0245, <API key> }, { "ZTE", 0x19d2, "v790/Blade 3", 0x0306, <API key> }, /* * HTC (High Tech Computer Corp) * Reporters: * Steven Eastland <grassmonk@users.sourceforge.net> * Kevin Cheng <kache@users.sf.net> */ #if 0 /* * This had to be commented out - the same VID+PID is used also for * other modes than MTP, so we need to let mtp-probe do its job on this * device instead of adding it to the database. */ { "HTC", 0x0bb4, "Android Device ID1 (Zopo, HD2, Bird...)", 0x0c02, <API key> }, #endif { "HTC", 0x0bb4, "EVO 4G LTE/One V (ID1)", 0x0c93, <API key> }, { "HTC", 0x0bb4, "EVO 4G LTE/One V (ID2)", 0x0ca8, <API key> }, { "HTC", 0x0bb4, "HTC One S (ID1)", 0x0cec, <API key> }, { "HTC", 0x0bb4, "HTC Evo 4G LTE (ID1)", 0x0df5, <API key> }, { "HTC", 0x0bb4, "HTC One S (ID2)", 0x0df9, <API key> }, { "HTC", 0x0bb4, "HTC One X (ID1)", 0x0dfb, <API key> }, { "HTC", 0x0bb4, "HTC One X (ID2)", 0x0dfc, <API key> }, { "HTC", 0x0bb4, "HTC One X (ID3)", 0x0dfd, <API key> }, { "HTC", 0x0bb4, "HTC Butterfly (ID1)", 0x0dfe, <API key> }, { "HTC", 0x0bb4, "Droid DNA (MTP+UMS+ADB)", 0x0dff, <API key> }, { "HTC", 0x0bb4, "HTC Droid Incredible 4G LTE (MTP)", 0x0e31, <API key> }, { "HTC", 0x0bb4, "HTC Droid Incredible 4G LTE (MTP+ADB)", 0x0e32, <API key> }, { "HTC", 0x0bb4, "Droid DNA (MTP+UMS)", 0x0ebd, <API key> }, { "HTC", 0x0bb4, "HTC One X (ID2)", 0x0f91, <API key> }, // These identify themselves as "cm_tenderloin", fun... // Done by HTC for HP I guess. { "Hewlett-Packard", 0x0bb4, "HP Touchpad (MTP)", 0x685c, <API key> }, { "Hewlett-Packard", 0x0bb4, "HP Touchpad (MTP+ADB)", 0x6860, <API key> }, #if 0 { "HTC", 0x0bb4, "Android Device ID2 (Zopo, HD2...)", 0x2008, <API key> }, #endif /* * NEC */ { "NEC", 0x0409, "FOMA N01A", 0x0242, DEVICE_FLAG_NONE }, /* * nVidia */ // Found on Internet forum { "nVidia", 0x0955, "CM9-Adam", 0x70a9, <API key> }, { "nVidia", 0x0955, "Nabi2 Tablet (ID1)", 0x7100, <API key> }, { "nVidia", 0x0955, "Nabi2 Tablet (ID2)", 0x7102, <API key> }, /* * Vizio */ // Reported by Michael Gurski <gurski@users.sourceforge.net> { "Vizio", 0x0489, "VTAB1008", 0xe040, <API key> }, /* * Amazon */ { "Amazon", 0x1949, "Kindle Fire 2G (ID1)", 0x0005, <API key> }, { "Amazon", 0x1949, "Kindle Fire (ID1)", 0x0007, <API key> }, { "Amazon", 0x1949, "Kindle Fire (ID2)", 0x0008, <API key> }, { "Amazon", 0x1949, "Kindle Fire (ID3)", 0x000a, <API key> }, /* * Barnes&Noble */ { "Barnes&Noble", 0x2080, "Nook HD+", 0x0005, <API key> }, /* * Viewpia, bq, YiFang * Seems like some multi-branded OEM product line. */ { "Various", 0x2207, "Viewpia DR/bq Kepler", 0x0001, <API key> }, { "YiFang", 0x2207, "BQ Tesla", 0x0006, <API key> }, /* * Kobo */ // Reported by George Talusan { "Kobo", 0x2237, "Arc (ID1)", 0xd108, <API key> }, { "Kobo", 0x2237, "Arc (ID2)", 0xd109, <API key> }, /* * Hisense */ // Reported by Anonymous SourceForge user { "Hisense", 0x109b, "E860", 0x9109, <API key> }, /* * Intel * Also sold rebranded as Orange products */ { "Intel", 0x8087, "Xolo 900/AZ210A", 0x09fb, <API key> }, /* * Xiaomi */ { "Xiaomi", 0x2717, "Mi-2 (MTP+ADB)", 0x9039, <API key> }, { "Xiaomi", 0x2717, "Mi-2 (MTP)", 0xf003, <API key> }, /* * XO Learning Tablet */ { "Acromag Inc.", 0x16d5, "XO Learning Tablet (MTP+ADB)", 0x8005, <API key> }, { "Acromag Inc.", 0x16d5, "XO Learning Tablet (MTP)", 0x8006, <API key> }, /* * Other strange stuff. */ { "Isabella", 0x0b20, "Her Prototype", 0xddee, DEVICE_FLAG_NONE }
# Makefile.in generated by automake 1.14.1 from Makefile.am. # gio/tests/<API key>/Makefile. Generated from Makefile.in by configure. # This Makefile.in is free software; the Free Software Foundation # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # PARTICULAR PURPOSE. # GLIB - Library of useful C routines am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' <API key> = \ case $${target_option-} in \ ?) ;; \ *) echo "<API key>: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]* esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(<API key>)) am__make_keepgoing = (target_option=k; $(<API key>)) pkgdatadir = $(datadir)/glib pkgincludedir = $(includedir)/glib pkglibdir = $(libdir)/glib pkglibexecdir = $(libexecdir)/glib am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(<API key>) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = <API key> host_triplet = <API key> DIST_COMMON = $(top_srcdir)/glib.mk $(srcdir)/Makefile.in \ $(srcdir)/Makefile.am $(top_srcdir)/depcomp \ $(top_srcdir)/test-driver <API key> = $(am__EXEEXT_1) noinst_PROGRAMS = $(am__EXEEXT_3) check_PROGRAMS = $(am__EXEEXT_2) TESTS = $(am__EXEEXT_1) #am__append_1 = $(test_programs) $(test_scripts) $(<API key>) $(<API key>) \ # $(dist_test_scripts) $(<API key>) #am__append_2 = $(all_test_ltlibs) #am__append_3 = $(all_test_programs) #am__append_4 = $(all_test_scripts) #am__append_5 = $(all_test_data) am__append_6 = $(all_test_ltlibs) am__append_7 = $(all_test_programs) am__append_8 = $(all_test_scripts) am__append_9 = $(all_test_data) am__append_10 = $(test_programs) $(<API key>) \ $(test_extra_programs) $(<API key>) am__append_11 = $(test_scripts) \ $(<API key>) \ $(test_extra_scripts) \ $(<API key>) \ $(dist_test_scripts) \ $(<API key>) \ $(<API key>) \ $(<API key>) am__append_12 = $(test_data) \ $(installed_test_data) \ $(dist_test_data) \ $(<API key>) am__append_13 = $(test_ltlibraries) $(<API key>) am__append_14 = $(<API key>) # The docs pull these in, so we need them even if not doing 'make check' #am__append_15 = $(GDBUS_GENERATED) #am__append_16 = <API key>.la subdir = gio/tests/<API key> ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4macros/attributes.m4 \ $(top_srcdir)/m4macros/glibtests.m4 \ $(top_srcdir)/m4macros/gtk-doc.m4 \ $(top_srcdir)/m4macros/libtool.m4 \ $(top_srcdir)/m4macros/ltoptions.m4 \ $(top_srcdir)/m4macros/ltsugar.m4 \ $(top_srcdir)/m4macros/ltversion.m4 \ $(top_srcdir)/m4macros/lt~obsolete.m4 \ $(top_srcdir)/acinclude.m4 $(top_srcdir)/acglib.m4 \ $(top_srcdir)/glib/libcharset/codeset.m4 \ $(top_srcdir)/glib/libcharset/glibc21.m4 \ $(top_srcdir)/m4macros/glib-gettext.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(<API key>) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = <API key> = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 <API key> = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(<API key>); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' <API key> = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(installed_testdir)" \ "$(DESTDIR)$(installed_testdir)" \ "$(DESTDIR)$(installed_testdir)" \ "$(DESTDIR)$(<API key>)" \ "$(DESTDIR)$(installed_testdir)" LTLIBRARIES = $(<API key>) $(noinst_LTLIBRARIES) am__DEPENDENCIES_1 = <API key> = \ $(top_builddir)/glib/libglib-2.0.la \ $(top_builddir)/gobject/libgobject-2.0.la \ $(top_builddir)/gmodule/libgmodule-2.0.la \ $(top_builddir)/gio/libgio-2.0.la $(am__DEPENDENCIES_1) <API key> = \ <API key>.lo <API key> = \ $(<API key>) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(<API key>)) am__v_lt_0 = --silent am__v_lt_1 = <API key> = #<API key> = #<API key> = <API key> = \ -rpath $(installed_testdir) am__EXEEXT_1 = am__EXEEXT_2 = $(am__EXEEXT_1) #am__EXEEXT_3 = $(am__EXEEXT_1) PROGRAMS = $(<API key>) $(noinst_PROGRAMS) SCRIPTS = $(<API key>) $(noinst_SCRIPTS) AM_V_P = $(am__v_P_$(V)) am__v_P_ = $(am__v_P_$(<API key>)) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(<API key>)) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(<API key>)) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I. -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(<API key>)) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(<API key>)) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(<API key>) DIST_SOURCES = <API key> = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac DATA = $(<API key>) $(<API key>) \ $(noinst_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. <API key> = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags <API key> = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no am__tty_colors = { \ $(<API key>); \ if test "X$(AM_COLOR_TESTS)" = Xno; then \ am__color_tests=no; \ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ am__color_tests=yes; \ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ am__color_tests=yes; \ fi; \ if test $$am__color_tests = yes; then \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ mgn=''; \ brg=''; \ std=''; \ fi; \ } am__recheck_rx = ^[ ]*:recheck:[ ]* <API key> = ^[ ]*:global-test-result:[ ]* <API key> = ^[ ]*:copy-in-global-log:[ ]* # A command that, given a newline-separated list of test names on the # standard input, print the name of the tests that are to be re-run # upon "make recheck". <API key> = $(AWK) '{ \ recheck = 1; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ { \ if ((getline line2 < ($$0 ".log")) < 0) \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ { \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ { \ break; \ } \ }; \ if (recheck) \ print $$0; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # A command that, given a newline-separated list of test names on the # standard input, create the global log from their .trs and .log files. <API key> = $(AWK) ' \ function fatal(msg) \ { \ print "fatal: making $@: " msg | "cat >&2"; \ exit 1; \ } \ function rst_section(header) \ { \ print header; \ len = length(header); \ for (i = 1; i <= len; i = i + 1) \ printf "="; \ printf "\n\n"; \ } \ { \ copy_in_global_log = 1; \ global_test_result = "RUN"; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".trs"); \ if (line ~ /$(<API key>)/) \ { \ sub("$(<API key>)", "", line); \ sub("[ ]*$$", "", line); \ global_test_result = line; \ } \ else if (line ~ /$(<API key>)[nN][oO]/) \ copy_in_global_log = 0; \ }; \ if (copy_in_global_log) \ { \ rst_section(global_test_result ": " $$0); \ while ((rc = (getline line < ($$0 ".log"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".log"); \ print line; \ }; \ printf "\n"; \ }; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # Restructured Text title. am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } # Solaris 10 'make', and several other traditional 'make' implementations, # pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it # by disabling -e (using the XSI extension "set +e") if it's set. am__sh_e_setup = case $$- in *e*) set +e;; esac # Default flags passed to test drivers. <API key> = \ --color-tests "$$am__color_tests" \ --enable-hard-errors "$$<API key>" \ --expect-failure "$$am__expect_failure" # To be inserted before the command running the test. Creates the # directory for the log if needed. Stores in $dir the directory # containing $f, in $tst the test, in $log the log. Executes the # developer- defined test setup <API key> (if any), and # passes TESTS_ENVIRONMENT. Set up options for the wrapper that # will run the test scripts (or their associated LOG_COMPILER, if # thy have one). am__check_pre = \ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ $(am__tty_colors); \ srcdir=$(srcdir); export srcdir; \ case "$@" in \ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ *) am__odir=.;; \ esac; \ test "x$$am__odir" = x"." || test -d "$$am__odir" \ || $(MKDIR_P) "$$am__odir" || exit $$?; \ if test -f "./$$f"; then dir=./; \ elif test -f "$$f"; then dir=; \ else dir="$(srcdir)/"; fi; \ tst=$$dir$$f; log='$@'; \ if test -n '$(DISABLE_HARD_ERRORS)'; then \ <API key>=no; \ else \ <API key>=yes; \ fi; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ am__expect_failure=yes;; \ *) \ am__expect_failure=no;; \ esac; \ $(<API key>) $(TESTS_ENVIRONMENT) # A shell command to get the names of the tests scripts with any registered # extension removed (i.e., equivalently, the names of the test logs, with # the '.log' extension removed). The result is saved in the shell variable # '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, # we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", # since that might cause problem with VPATH rewrites for suffix-less tests. # See also '<API key>.sh' and 'test-trs-basic.sh'. am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$ bases=`echo $$bases` RECHECK_LOGS = $(TEST_LOGS) <API key> = check recheck TEST_SUITE_LOG = test-suite.log TEST_EXTENSIONS = .test am__test_logs1 = $(TESTS:=.log) am__test_logs2 = $(am__test_logs1:.log=.log) TEST_LOGS = $(am__test_logs2:.test.log=.log) TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ $(TEST_LOG_FLAGS) am__set_b = \ case '$@' in \ */*) \ case '$*' in \ */*) b='$*';; \ *) b=`echo '$@' | sed 's/\.log$$ esac;; \ *) \ b='$*';; \ esac DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) <API key> = ABS_TAPSET_DIR = $(datadir)/systemtap/tapset ACLOCAL = ${SHELL} /home/saikat/jhbuild/checkout/glib/missing aclocal-1.14 ALLOCA = AMTAR = $${TAR-tar} <API key> = 0 AR = ar AS = as AUTOCONF = ${SHELL} /home/saikat/jhbuild/checkout/glib/missing autoconf AUTOHEADER = ${SHELL} /home/saikat/jhbuild/checkout/glib/missing autoheader AUTOMAKE = ${SHELL} /home/saikat/jhbuild/checkout/glib/missing automake-1.14 AWK = mawk CARBON_LIBS = CATALOGS = af.gmo am.gmo an.gmo ar.gmo as.gmo ast.gmo az.gmo be.gmo be@latin.gmo bg.gmo bn.gmo bn_IN.gmo bs.gmo ca.gmo ca@valencia.gmo cs.gmo cy.gmo da.gmo de.gmo dz.gmo el.gmo en_CA.gmo en_GB.gmo en@shaw.gmo eo.gmo es.gmo et.gmo eu.gmo fa.gmo fi.gmo fr.gmo ga.gmo gd.gmo gl.gmo gu.gmo he.gmo hi.gmo hr.gmo hu.gmo hy.gmo id.gmo is.gmo it.gmo ja.gmo ka.gmo kk.gmo kn.gmo ko.gmo ku.gmo lt.gmo lv.gmo mai.gmo mg.gmo mk.gmo ml.gmo mn.gmo mr.gmo ms.gmo nb.gmo nds.gmo ne.gmo nl.gmo nn.gmo oc.gmo or.gmo pa.gmo pl.gmo ps.gmo pt.gmo pt_BR.gmo ro.gmo ru.gmo rw.gmo si.gmo sk.gmo sl.gmo sq.gmo sr.gmo sr@latin.gmo sr@ije.gmo sv.gmo ta.gmo te.gmo tg.gmo th.gmo tl.gmo tr.gmo ug.gmo tt.gmo uk.gmo vi.gmo wa.gmo xh.gmo yi.gmo zh_CN.gmo zh_HK.gmo zh_TW.gmo CATOBJEXT = .gmo CC = gcc CCDEPMODE = depmode=gcc3 CFLAGS = -g -O2 COCOA_LIBS = <API key> = $(top_srcdir)/po/LINGUAS CPP = gcc -E CPPFLAGS = -pthread CXX = c++ CXXCPP = c++ -E CXXDEPMODE = depmode=gcc3 CXXFLAGS = -g -O2 CYGPATH_W = echo DATADIRNAME = share DBUS1_CFLAGS = -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include DBUS1_LIBS = -ldbus-1 DBUS_DAEMON = dbus-daemon DEFS = -DHAVE_CONFIG_H DEPDIR = .deps DLLTOOL = false DSYMUTIL = DTRACE = DUMPBIN = ECHO_C = ECHO_N = -n ECHO_T = EGREP = /bin/grep -E EXEEXT = FAM_LIBS = FGREP = /bin/grep -F GETTEXT_PACKAGE = glib20 GIO = giounix.lo GIO_MODULE_DIR = ${libdir}/gio/modules GLIBC21 = yes GLIB_BINARY_AGE = 4704 GLIB_DEBUG_FLAGS = -DG_ENABLE_DEBUG GLIB_EXTRA_CFLAGS = <API key> = -fvisibility=hidden GLIB_INTERFACE_AGE = 0 GLIB_LINK_FLAGS = -Wl,-Bsymbolic-functions -Wl,-z,nodelete GLIB_MAJOR_VERSION = 2 GLIB_MICRO_VERSION = 4 GLIB_MINOR_VERSION = 47 GLIB_RUNTIME_LIBDIR = GLIB_VERSION = 2.47.4 GLIB_WARN_CFLAGS = -Wall -Wstrict-prototypes -Werror=<API key> -Werror=missing-prototypes -Werror=<API key> -Werror=pointer-arith -Werror=init-self -Werror=format-security -Werror=format=2 -Werror=<API key> <API key> = GMOFILES = af.gmo am.gmo an.gmo ar.gmo as.gmo ast.gmo az.gmo be.gmo be@latin.gmo bg.gmo bn.gmo bn_IN.gmo bs.gmo ca.gmo ca@valencia.gmo cs.gmo cy.gmo da.gmo de.gmo dz.gmo el.gmo en_CA.gmo en_GB.gmo en@shaw.gmo eo.gmo es.gmo et.gmo eu.gmo fa.gmo fi.gmo fr.gmo ga.gmo gd.gmo gl.gmo gu.gmo he.gmo hi.gmo hr.gmo hu.gmo hy.gmo id.gmo is.gmo it.gmo ja.gmo ka.gmo kk.gmo kn.gmo ko.gmo ku.gmo lt.gmo lv.gmo mai.gmo mg.gmo mk.gmo ml.gmo mn.gmo mr.gmo ms.gmo nb.gmo nds.gmo ne.gmo nl.gmo nn.gmo oc.gmo or.gmo pa.gmo pl.gmo ps.gmo pt.gmo pt_BR.gmo ro.gmo ru.gmo rw.gmo si.gmo sk.gmo sl.gmo sq.gmo sr.gmo sr@latin.gmo sr@ije.gmo sv.gmo ta.gmo te.gmo tg.gmo th.gmo tl.gmo tr.gmo ug.gmo tt.gmo uk.gmo vi.gmo wa.gmo xh.gmo yi.gmo zh_CN.gmo zh_HK.gmo zh_TW.gmo GMSGFMT = /usr/bin/msgfmt GREP = /bin/grep GSPAWN = gspawn.lo <API key> = GTKDOC_CHECK = gtkdoc-check.test GTKDOC_CHECK_PATH = /home/saikat/jhbuild/install/bin/gtkdoc-check GTKDOC_DEPS_CFLAGS = GTKDOC_DEPS_LIBS = GTKDOC_MKPDF = /home/saikat/jhbuild/install/bin/gtkdoc-mkpdf GTKDOC_REBASE = /home/saikat/jhbuild/install/bin/gtkdoc-rebase G_LIBS_EXTRA = <API key> = 0 <API key> = 1 G_MODULE_IMPL = G_MODULE_IMPL_DL G_MODULE_LDFLAGS = -Wl,--export-dynamic G_MODULE_LIBS = -ldl G_MODULE_LIBS_EXTRA = <API key> = 0 <API key> = G_MODULE_SUPPORTED = true G_THREAD_CFLAGS = -pthread G_THREAD_LIBS = -pthread G_THREAD_LIBS_EXTRA = <API key> = -lpthread HTML_DIR = ${datadir}/gtk-doc/html ICONV_LIBS = INDENT = INSTALL = /usr/bin/install -c INSTALL_DATA = ${INSTALL} -m 644 INSTALL_PROGRAM = ${INSTALL} INSTALL_SCRIPT = ${INSTALL} <API key> = $(install_sh) -c -s INSTOBJEXT = .mo INTLLIBS = LD = /usr/bin/ld -m elf_x86_64 LDFLAGS = -L/home/saikat/jhbuild/install/lib LIBELF_CFLAGS = LIBELF_LIBS = LIBFFI_CFLAGS = LIBFFI_LIBS = -lffi LIBOBJS = LIBS = LIBTOOL = $(SHELL) $(top_builddir)/libtool <API key> = X86 LIPO = LN_S = ln -s LTLIBOBJS = LTP = LTP_GENHTML = LT_AGE = 4704 LT_CURRENT = 4704 <API key> = 0 LT_RELEASE = 2.47 LT_REVISION = 0 MAINT = MAKEINFO = ${SHELL} /home/saikat/jhbuild/checkout/glib/missing makeinfo MANIFEST_TOOL = : MKDIR_P = /bin/mkdir -p MKINSTALLDIRS = ./mkinstalldirs MSGFMT = /usr/bin/msgfmt MSGFMT_OPTS = -c <API key> = NETWORK_LIBS = -lresolv NM = /usr/bin/nm -B NMEDIT = OBJDUMP = objdump OBJEXT = o OTOOL = OTOOL64 = PACKAGE = glib PACKAGE_BUGREPORT = http://bugzilla.gnome.org/enter_bug.cgi?product=glib PACKAGE_NAME = glib PACKAGE_STRING = glib 2.47.4 PACKAGE_TARNAME = glib PACKAGE_URL = PACKAGE_VERSION = 2.47.4 PATH_SEPARATOR = : PCRE_CFLAGS = PCRE_LIBS = PCRE_REQUIRES = PCRE_WARN_CFLAGS = -Wno-pointer-sign PERL = perl PERL_PATH = /usr/bin/perl PKG_CONFIG = /usr/bin/pkg-config PKG_CONFIG_LIBDIR = PKG_CONFIG_PATH = /home/saikat/jhbuild/install/lib/pkgconfig:/home/saikat/jhbuild/install/share/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig PLATFORMDEP = POFILES = af.po am.po an.po ar.po as.po ast.po az.po be.po be@latin.po bg.po bn.po bn_IN.po bs.po ca.po ca@valencia.po cs.po cy.po da.po de.po dz.po el.po en_CA.po en_GB.po en@shaw.po eo.po es.po et.po eu.po fa.po fi.po fr.po ga.po gd.po gl.po gu.po he.po hi.po hr.po hu.po hy.po id.po is.po it.po ja.po ka.po kk.po kn.po ko.po ku.po lt.po lv.po mai.po mg.po mk.po ml.po mn.po mr.po ms.po nb.po nds.po ne.po nl.po nn.po oc.po or.po pa.po pl.po ps.po pt.po pt_BR.po ro.po ru.po rw.po si.po sk.po sl.po sq.po sr.po sr@latin.po sr@ije.po sv.po ta.po te.po tg.po th.po tl.po tr.po ug.po tt.po uk.po vi.po wa.po xh.po yi.po zh_CN.po zh_HK.po zh_TW.po POSUB = po PO_IN_DATADIR_FALSE = PO_IN_DATADIR_TRUE = PYTHON = /usr/bin/python PYTHON_EXEC_PREFIX = ${exec_prefix} PYTHON_PLATFORM = linux2 PYTHON_PREFIX = ${prefix} PYTHON_VERSION = 2.7 RANLIB = ranlib REBUILD = SED = /bin/sed SELINUX_LIBS = SET_MAKE = SHELL = /bin/bash SHTOOL = STRIP = strip USE_NLS = yes VERSION = 2.47.4 WINDRES = WSPIAPI_INCLUDE = XATTR_LIBS = XGETTEXT = /usr/bin/xgettext XMLCATALOG = /usr/bin/xmlcatalog XML_CATALOG_FILE = /etc/xml/catalog XSLTPROC = /usr/bin/xsltproc ZLIB_CFLAGS = ZLIB_LIBS = -lz abs_builddir = /home/saikat/jhbuild/checkout/glib/gio/tests/<API key> abs_srcdir = /home/saikat/jhbuild/checkout/glib/gio/tests/<API key> abs_top_builddir = /home/saikat/jhbuild/checkout/glib abs_top_srcdir = /home/saikat/jhbuild/checkout/glib ac_ct_AR = ar ac_ct_CC = gcc ac_ct_CXX = c++ ac_ct_DUMPBIN = am__include = include am__leading_dot = . am__quote = am__tar = tar --format=ustar -chf - "$$tardir" am__untar = tar -xf - bindir = ${exec_prefix}/bin build = <API key> build_alias = build_cpu = x86_64 build_os = linux-gnu build_vendor = unknown builddir = . config_h_INCLUDES = -I$(top_builddir) datadir = ${datarootdir} datarootdir = ${prefix}/share docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} dvidir = ${docdir} exec_prefix = ${prefix} gio_INCLUDES = $(gmodule_INCLUDES) glib_INCLUDES = $(config_h_INCLUDES) -I$(top_builddir)/glib -I$(top_srcdir)/glib -I$(top_srcdir) gmodule_INCLUDES = $(glib_INCLUDES) -I$(top_srcdir)/gmodule gobject_INCLUDES = $(glib_INCLUDES) host = <API key> host_alias = host_cpu = x86_64 host_os = linux-gnu host_vendor = unknown htmldir = ${docdir} includedir = ${prefix}/include infodir = ${datarootdir}/info install_sh = ${SHELL} /home/saikat/jhbuild/checkout/glib/install-sh <API key> = ${datarootdir}/installed-tests/glib installed_testdir = ${exec_prefix}/libexec/installed-tests/glib libdir = ${exec_prefix}/lib libexecdir = ${exec_prefix}/libexec localedir = /home/saikat/jhbuild/install/share/locale localstatedir = ${prefix}/var mandir = ${datarootdir}/man mkdir_p = $(MKDIR_P) ms_librarian = oldincludedir = /usr/include pdfdir = ${docdir} pkgpyexecdir = ${pyexecdir}/glib pkgpythondir = ${pythondir}/glib prefix = /home/saikat/jhbuild/install <API key> = s,x,x, psdir = ${docdir} pyexecdir = ${exec_prefix}/lib/python2.7/site-packages pythondir = ${prefix}/lib/python2.7/site-packages sbindir = ${exec_prefix}/sbin sharedstatedir = ${prefix}/com srcdir = . sysconfdir = ${prefix}/etc target_alias = top_build_prefix = ../../../ top_builddir = ../../.. top_srcdir = ../../.. #GTESTER = gtester # for non-GLIB packages #GTESTER_REPORT = gtester-report # for non-GLIB packages GTESTER = $(top_builddir)/glib/gtester # for the GLIB package GTESTER_REPORT = $(top_builddir)/glib/gtester-report # for the GLIB package NULL = # initialize variables for unconditional += appending BUILT_SOURCES = $(am__append_15) BUILT_EXTRA_DIST = CLEANFILES = *.log *.trs $(am__append_14) $(GDBUS_GENERATED) DISTCLEANFILES = <API key> = EXTRA_DIST = $(<API key>) $(all_dist_test_data) \ <API key>.xml # We support a fairly large range of possible variables. It is expected that all types of files in a test suite # will belong in exactly one of the following variables. # First, we support the usual automake suffixes, but in lowercase, with the customary meaning: # test_programs, test_scripts, test_data, test_ltlibraries # The above are used to list files that are involved in both uninstalled and installed testing. The # test_programs and test_scripts are taken to be actual testcases and will be run as part of the test suite. # Note that _data is always used with the nobase_ automake variable name to ensure that installed test data is # installed in the same way as it appears in the package layout. # In order to mark a particular file as being only for one type of testing, use 'installed' or 'uninstalled', # like so: # <API key>, <API key> # <API key>, <API key> # installed_test_data, <API key> # <API key>, <API key> # Additionally, we support 'extra' infixes for programs and scripts. This is used for support programs/scripts # that should not themselves be run as testcases (but exist to be used from other testcases): # test_extra_programs, <API key>, <API key> # test_extra_scripts, <API key>, <API key> # Additionally, for _scripts and _data, we support the customary dist_ prefix so that the named script or data # file automatically end up in the tarball. # dist_test_scripts, dist_test_data, <API key> # <API key>, <API key>, <API key> # <API key>, <API key>, <API key> # Note that no file is automatically disted unless it appears in one of the dist_ variables. This follows the # standard automake convention of not disting programs scripts or data by default. # test_programs, test_scripts, <API key> and <API key> (as well as their disted # variants) will be run as part of the in-tree 'make check'. These are all assumed to be runnable under # gtester. That's a bit strange for scripts, but it's possible. # we use test -z "$(TEST_PROGS)" above, so make sure we have no extra whitespace... TEST_PROGS = $(strip $(test_programs) $(test_scripts) \ $(<API key>) $(<API key>) \ $(dist_test_scripts) $(<API key>)) <API key> = $(am__append_13) <API key> = $(am__append_11) <API key> = $(am__append_12) noinst_LTLIBRARIES = $(am__append_2) $(am__append_16) noinst_SCRIPTS = $(am__append_4) noinst_DATA = $(am__append_5) check_LTLIBRARIES = $(am__append_6) check_SCRIPTS = $(am__append_8) check_DATA = $(am__append_9) # Note: build even the installed-only targets during 'make check' to ensure that they still work. # We need to do a bit of trickery here and manage disting via EXTRA_DIST instead of using dist_ prefixes to # prevent automake from mistreating gmake functions like $(wildcard ...) and $(addprefix ...) as if they were # filenames, including removing duplicate instances of the opening part before the space, eg. '$(addprefix'. all_test_programs = $(test_programs) $(<API key>) $(<API key>) \ $(test_extra_programs) $(<API key>) $(<API key>) all_test_scripts = $(test_scripts) $(<API key>) \ $(<API key>) $(test_extra_scripts) \ $(<API key>) \ $(<API key>) $(<API key>) <API key> = $(dist_test_scripts) $(<API key>) $(<API key>) \ $(<API key>) $(<API key>) $(<API key>) all_test_data = $(test_data) $(<API key>) \ $(installed_test_data) $(all_dist_test_data) all_dist_test_data = $(dist_test_data) $(<API key>) $(<API key>) all_test_ltlibs = $(test_ltlibraries) $(<API key>) $(<API key>) installed_testcases = $(test_programs) $(<API key>) \ $(test_scripts) $(<API key>) \ $(dist_test_scripts) $(<API key>) <API key> = $(installed_testcases:=.test) AM_CPPFLAGS = -g $(gio_INCLUDES) $(GLIB_DEBUG_FLAGS) -I$(top_builddir)/gio -I$(top_srcdir)/gio GDBUS_GENERATED = \ <API key>.h \ <API key>.c \ <API key>.gtk.GDBus.Example.ObjectManager.Animal.xml \ <API key>.gtk.GDBus.Example.ObjectManager.Cat.xml \ $(NULL) test_ltlibraries = <API key>.la <API key> = \ <API key>.h \ <API key>.c <API key> = \ $(top_builddir)/glib/libglib-2.0.la \ $(top_builddir)/gobject/libgobject-2.0.la \ $(top_builddir)/gmodule/libgmodule-2.0.la \ $(top_builddir)/gio/libgio-2.0.la \ $(NULL) all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/glib.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu gio/tests/<API key>/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gio/tests/<API key>/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/glib.mk: $(top_builddir)/config.status: $(top_srcdir)/configure $(<API key>) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): <API key>: -test -z "$(check_LTLIBRARIES)" || rm -f $(check_LTLIBRARIES) @list='$(check_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } <API key>: $(<API key>) @$(NORMAL_INSTALL) @list='$(<API key>)'; test -n "$(installed_testdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(installed_testdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(installed_testdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(installed_testdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(installed_testdir)"; \ } <API key>: @$(NORMAL_UNINSTALL) @list='$(<API key>)'; test -n "$(installed_testdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(installed_testdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(installed_testdir)/$$f"; \ done <API key>: -test -z "$(<API key>)" || rm -f $(<API key>) @list='$(<API key>)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } <API key>: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } <API key>.la: $(<API key>) $(<API key>) $(<API key>) $(AM_V_CCLD)$(LINK) $(<API key>) $(<API key>) $(<API key>) $(LIBS) clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$ echo " rm -f" $$list; \ rm -f $$list <API key>: $(<API key>) @$(NORMAL_INSTALL) @list='$(<API key>)'; test -n "$(installed_testdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(installed_testdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(installed_testdir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$ while read p p1; do if test -f $$p \ || test -f $$p1 \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(installed_testdir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(installed_testdir)$$dir" || exit $$?; \ } \ ; done <API key>: @$(NORMAL_UNINSTALL) @list='$(<API key>)'; test -n "$(installed_testdir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(installed_testdir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(installed_testdir)" && rm -f $$files <API key>: @list='$(<API key>)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$ echo " rm -f" $$list; \ rm -f $$list <API key>: @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$ echo " rm -f" $$list; \ rm -f $$list <API key>: $(<API key>) @$(NORMAL_INSTALL) @list='$(<API key>)'; test -n "$(installed_testdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(installed_testdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(installed_testdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n' \ -e 'h;s|.*|.|' \ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) { files[d] = files[d] " " $$1; \ if (++n[d] == $(am__install_max)) { \ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ else { print "f", d "/" $$4, $$1 } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(installed_testdir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(installed_testdir)$$dir" || exit $$?; \ } \ ; done <API key>: @$(NORMAL_UNINSTALL) @list='$(<API key>)'; test -n "$(installed_testdir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(installed_testdir)'; $(<API key>) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c include ./$(DEPDIR)/<API key>.Plo .c.o: $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po # $(AM_V_CC)source='$<' object='$@' libtool=no \ # DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ # $(AM_V_CC_no)$(COMPILE) -c -o $@ $< .c.obj: $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po # $(AM_V_CC)source='$<' object='$@' libtool=no \ # DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ # $(AM_V_CC_no)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo # $(AM_V_CC)source='$<' object='$@' libtool=yes \ # DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ # $(AM_V_CC_no)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs <API key>: $(<API key>) @$(NORMAL_INSTALL) @list='$(<API key>)'; test -n "$(<API key>)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(<API key>)'"; \ $(MKDIR_P) "$(DESTDIR)$(<API key>)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(<API key>)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(<API key>)" || exit $$?; \ done <API key>: @$(NORMAL_UNINSTALL) @list='$(<API key>)'; test -n "$(<API key>)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(<API key>)'; $(<API key>) <API key>: $(<API key>) @$(NORMAL_INSTALL) @list='$(<API key>)'; test -n "$(installed_testdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(installed_testdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(installed_testdir)" || exit 1; \ fi; \ $(am__nobase_list) | while read dir files; do \ xfiles=; for file in $$files; do \ if test -f "$$file"; then xfiles="$$xfiles $$file"; \ else xfiles="$$xfiles $(srcdir)/$$file"; fi; done; \ test -z "$$xfiles" || { \ test "x$$dir" = x. || { \ echo " $(MKDIR_P) '$(DESTDIR)$(installed_testdir)/$$dir'"; \ $(MKDIR_P) "$(DESTDIR)$(installed_testdir)/$$dir"; }; \ echo " $(INSTALL_DATA) $$xfiles '$(DESTDIR)$(installed_testdir)/$$dir'"; \ $(INSTALL_DATA) $$xfiles "$(DESTDIR)$(installed_testdir)/$$dir" || exit $$?; }; \ done <API key>: @$(NORMAL_UNINSTALL) @list='$(<API key>)'; test -n "$(installed_testdir)" || list=; \ $(<API key>); files=`$(am__nobase_strip)`; \ dir='$(DESTDIR)$(installed_testdir)'; $(<API key>) ID: $(am__tagged_files) $(<API key>); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(<API key>); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(<API key>); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags # Recover from deleted '.trs' file; this should ensure that # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create # both 'foo.log' and 'foo.trs'. Break the recipe in two subshells # to avoid problems with "make -n". .log.trs: rm -f $< $@ $(MAKE) $(AM_MAKEFLAGS) $< # Leading 'am--fnord' is there to ensure the list of targets does not # expand to empty, as could happen e.g. with make check TESTS=''. am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) am--force-recheck: @: $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ redo_bases=`for i in $$bases; do \ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ done`; \ if test -n "$$redo_bases"; then \ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ if $(am__make_dryrun); then :; else \ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ fi; \ if test -n "$$am__remaking_logs"; then \ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ "recursion detected" >&2; \ else \ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ fi; \ if $(am__make_dryrun); then :; else \ st=0; \ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ for i in $$redo_bases; do \ test -f $$i.trs && test -r $$i.trs \ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ test -f $$i.log && test -r $$i.log \ || { echo "$$errmsg $$i.log" >&2; st=1; }; \ done; \ test $$st -eq 0 || exit 1; \ fi @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ ws='[ ]'; \ results=`for b in $$bases; do echo $$b.trs; done`; \ test -n "$$results" || results=/dev/null; \ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ if test `expr $$fail + $$xpass + $$error` -eq 0; then \ success=true; \ else \ success=false; \ fi; \ br='==================='; br=$$br$$br$$br$$br; \ result_count () \ { \ if test x"$$1" = x"--maybe-color"; then \ maybe_colorize=yes; \ elif test x"$$1" = x"--no-color"; then \ maybe_colorize=no; \ else \ echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ shift; \ desc=$$1 count=$$2; \ if test $$maybe_colorize = yes && test $$count -gt 0; then \ color_start=$$3 color_end=$$std; \ else \ color_start= color_end=; \ fi; \ echo "$${color_start}# $$desc $$count$${color_end}"; \ }; \ <API key> () \ { \ result_count $$1 "TOTAL:" $$all "$$brg"; \ result_count $$1 "PASS: " $$pass "$$grn"; \ result_count $$1 "SKIP: " $$skip "$$blu"; \ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ result_count $$1 "FAIL: " $$fail "$$red"; \ result_count $$1 "XPASS:" $$xpass "$$red"; \ result_count $$1 "ERROR:" $$error "$$mgn"; \ }; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ <API key> --no-color; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ for b in $$bases; do echo $$b; done \ | $(<API key>); \ } >$(TEST_SUITE_LOG).tmp || exit 1; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ if $$success; then \ col="$$grn"; \ else \ col="$$red"; \ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ echo "$${col}$$br$${std}"; \ <API key> --maybe-color; \ echo "$$col$$br$$std"; \ if $$success; then :; else \ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ if test -n "$(PACKAGE_BUGREPORT)"; then \ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ fi; \ echo "$$col$$br$$std"; \ fi; \ $$success || exit 1 check-TESTS: @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ log_list=`for i in $$bases; do echo $$i.log; done`; \ trs_list=`for i in $$bases; do echo $$i.trs; done`; \ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ exit $$?; recheck: all $(check_LTLIBRARIES) $(check_PROGRAMS) $(check_SCRIPTS) $(check_DATA) @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ bases=`for i in $$bases; do echo $$i; done \ | $(<API key>)` || exit 1; \ log_list=`for i in $$bases; do echo $$i.log; done`; \ log_list=`echo $$log_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ am__force_recheck=am--force-recheck \ TEST_LOGS="$$log_list"; \ exit $$? .test.log: @p='$<'; \ $(am__set_b); \ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(<API key>) $(<API key>) $(<API key>) -- $(TEST_LOG_COMPILE) \ "$$tst" $(<API key>) #.test$(EXEEXT).log: # $(am__set_b); \ # $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ # --log-file $$b.log --trs-file $$b.trs \ # $(<API key>) $(<API key>) $(<API key>) -- $(TEST_LOG_COMPILE) \ # "$$tst" $(<API key>) distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_LTLIBRARIES) $(check_PROGRAMS) \ $(check_SCRIPTS) $(check_DATA) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check-local check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) $(DATA) installdirs: for dir in "$(DESTDIR)$(installed_testdir)" "$(DESTDIR)$(installed_testdir)" "$(DESTDIR)$(installed_testdir)" "$(DESTDIR)$(<API key>)" "$(DESTDIR)$(installed_testdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(<API key>)" \ install_sh_PROGRAM="$(<API key>)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(<API key>)" \ install_sh_PROGRAM="$(<API key>)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(<API key>)" || rm -f $(<API key>) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) <API key>: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -test -z "$(<API key>)" || rm -f $(<API key>) clean: clean-am clean-am: <API key> clean-checkPROGRAMS clean-generic \ <API key> <API key> \ clean-libtool <API key> <API key> \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: <API key> \ <API key> <API key> \ <API key> \ <API key> install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am <API key> mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: <API key> \ <API key> \ <API key> \ <API key> \ <API key> .MAKE: all check check-am install install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am \ check-local clean <API key> clean-checkPROGRAMS \ clean-generic <API key> \ <API key> clean-libtool \ <API key> <API key> cscopelist-am \ ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am <API key> \ <API key> <API key> \ <API key> install-man \ <API key> install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ <API key> mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ recheck tags tags-am uninstall uninstall-am \ <API key> \ <API key> \ <API key> \ <API key> \ <API key> # test-nonrecursive: run tests only in cwd test-nonrecursive: ${TEST_PROGS} @test -z "${TEST_PROGS}" || G_TEST_SRCDIR="$(abs_srcdir)" G_TEST_BUILDDIR="$(abs_builddir)" G_DEBUG=gc-friendly MALLOC_CHECK_=2 MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256)) ${GTESTER} --verbose ${TEST_PROGS} #test-nonrecursive: .PHONY: test-nonrecursive .PHONY: lcov genlcov lcov-clean # use recursive makes in order to ignore errors during check lcov: -$(MAKE) $(AM_MAKEFLAGS) -k check $(MAKE) $(AM_MAKEFLAGS) genlcov # we have to massage the lcov.info file slightly to hide the effect of libtool # placing the objects files in the .libs/ directory separate from the *.c # we also have to delete tests/.libs/<API key>*.gcda genlcov: $(AM_V_GEN) rm -f $(top_builddir)/tests/.libs/<API key>*.gcda; \ $(LTP) --quiet --directory $(top_builddir) --capture --output-file glib-lcov.info --test-name GLIB_PERF --no-checksum --compat-libtool --ignore-errors source; \ $(LTP) --quiet --output-file glib-lcov.info --remove glib-lcov.info docs/reference/\* /tmp/\* gio/tests/<API key>/\* ; \ LANG=C $(LTP_GENHTML) --quiet --prefix $(top_builddir) --output-directory glib-lcov --title "GLib Code Coverage" --legend --frames --show-details glib-lcov.info --ignore-errors source @echo "file://$(abs_top_builddir)/glib-lcov/index.html" lcov-clean: if test -n "$(LTP)"; then \ $(LTP) --quiet --directory $(top_builddir) -z; \ fi # run tests in cwd as part of make check check-local: test-nonrecursive %.test: %$(EXEEXT) Makefile $(AM_V_GEN) (echo '[Test]' > $@.tmp; \ echo 'Type=session' >> $@.tmp; \ echo 'Exec=$(installed_testdir)/$(notdir $<)' >> $@.tmp; \ mv $@.tmp $@) $(GDBUS_GENERATED) : <API key>.xml Makefile $(top_builddir)/gio/gdbus-2.0/codegen/gdbus-codegen $(AM_V_GEN) <API key>=$(top_srcdir) \ <API key>=$(top_builddir) \ $(PYTHON) $(top_builddir)/gio/gdbus-2.0/codegen/gdbus-codegen \ --interface-prefix org.gtk.GDBus.Example.ObjectManager. \ --c-namespace Example \ --<API key> \ --generate-c-code <API key> \ --generate-docbook <API key> \ $< \ $(NULL) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT:
#include "io/json.hpp" #include <cstring> #include <fplll.h> #include <test_utils.h> using json = nlohmann::json; #ifndef TESTDATADIR #define TESTDATADIR ".." #endif using namespace std; using namespace fplll; /** @brief Test BKZ reduction. @param A test matrix @param block_size block size @param float_type floating point type to test @param flags flags to use @param prec precision if mpfr is used @return zero on success. */ template <class ZT> int test_bkz(ZZ_mat<ZT> &A, const int block_size, FloatType float_type, int flags = BKZ_DEFAULT, int prec = 0) { int status = 0; // zero on success status = bkz_reduction(A, block_size, flags, float_type, prec); if (status != RED_SUCCESS) { cerr << "BKZ reduction failed with error '" << get_red_status_str(status); cerr << " for float type " << FLOAT_TYPE_STR[float_type] << endl; } return status; } /** @brief Test BKZ strategy interface. @param A test matrix @param block_size block size @return zero on success. */ template <class ZT> int test_bkz_param(ZZ_mat<ZT> &A, const int block_size, int flags = BKZ_DEFAULT, string dump_gso_filename = string()) { int status = 0; vector<Strategy> strategies; for (long b = 0; b <= block_size; b++) { Strategy strategy = Strategy::EmptyStrategy(b); if (b == 10) { strategy.<API key>.emplace_back(5); } else if (b == 20) { strategy.<API key>.emplace_back(10); } else if (b == 30) { strategy.<API key>.emplace_back(15); } strategies.emplace_back(std::move(strategy)); } BKZParam params(block_size, strategies); params.flags = flags; params.dump_gso_filename = dump_gso_filename; // zero on success status = bkz_reduction(&A, NULL, params, FT_DEFAULT, 53); if (status != RED_SUCCESS) { cerr << "BKZ parameter test failed with error '" << get_red_status_str(status) << "'" << endl; } return status; } /** @brief Test BKZ with pruning. @param A test matrix @param block_size block size @return zero on success. */ template <class ZT> int <API key>(ZZ_mat<ZT> &A, const int block_size, int flags = BKZ_DEFAULT) { int status = 0; vector<Strategy> strategies; for (long b = 0; b < block_size; b++) { Strategy strategy = Strategy::EmptyStrategy(b); if (b == 10) { strategy.<API key>.emplace_back(5); } else if (b == 20) { strategy.<API key>.emplace_back(10); } else if (b == 30) { strategy.<API key>.emplace_back(15); } strategies.emplace_back(std::move(strategy)); } Strategy strategy; strategy.pruning_parameters.emplace_back( PruningParams::LinearPruningParams(block_size, block_size / 2)); strategies.emplace_back(std::move(strategy)); BKZParam params(block_size, strategies); params.flags = flags; // zero on success status = bkz_reduction(&A, NULL, params, FT_DEFAULT, 53); if (status != RED_SUCCESS) { cerr << "BKZ parameter test failed with error '" << get_red_status_str(status) << "'" << endl; } return status; } template <class ZT> int <API key>(ZZ_mat<ZT> &A, const int block_size, int flags = BKZ_DEFAULT) { int status = 0; vector<Strategy> strategies = <API key>(TESTDATADIR "/strategies/default.json"); BKZParam params(block_size, strategies); params.flags = flags; // zero on success status = bkz_reduction(&A, NULL, params, FT_DEFAULT, 53); if (status != RED_SUCCESS) { cerr << "BKZ parameter test failed with error '" << get_red_status_str(status) << "'" << endl; } return status; } template <class ZT> int <API key>(int d, int b, const int block_size, int flags = BKZ_DEFAULT | BKZ_DUMP_GSO) { ZZ_mat<ZT> A, B; A.resize(d, d + 1); A.gen_intrel(b); B = A; int status = 0; // TODO: maybe not safe. string file_bkz_dump_gso = tmpnam(nullptr); status |= test_bkz_param<ZT>(B, block_size, flags, file_bkz_dump_gso); if (status != 0) { cerr << "Error in test_bkz_param." << endl; return status; } json js; std::ifstream fs(file_bkz_dump_gso); if (fs.fail()) { cerr << "File " << file_bkz_dump_gso << " cannot be loaded." << endl; return 1; } fs >> js; int loop = -1; double time = 0.0; for (auto i : js) { // Verify if there are as much norms as there are rows in A if (A.get_rows() != (int)i["norms"].size()) { cerr << "The array \"norms\" does not contain enough values (" << A.get_rows() << " expected but " << i["norms"].size() << " found)." << endl; return 1; } // Extract data from json file const string step_js = i["step"]; const int loop_js = i["loop"]; const double time_js = i["time"]; // Verify if loop of Input and Output have loop = -1 if (step_js.compare("Input") == 0 || step_js.compare("Output") == 0) { if (loop_js != -1) { cerr << "Steps Input or Output are not with \"loop\" = -1." << endl; return 1; } } else { // Verify that loop increases loop++; if (loop_js != loop) { cerr << "Loop does not increase." << endl; return 1; } // Verify that time increases if (time > time_js) { cerr << "Time does not increase." << endl; return 1; } time = time_js; } } return 0; } /** @brief Test BKZ for matrix stored in file pointed to by `input_filename`. @param input_filename a path @param block_size block size @param float_type floating point type to test @param flags flags to use @param prec precision if mpfr is used @return zero on success */ template <class ZT> int test_filename(const char *input_filename, const int block_size, FloatType float_type = FT_DEFAULT, int flags = BKZ_DEFAULT, int prec = 0) { ZZ_mat<ZT> A, B; int status = 0; status |= read_matrix(A, input_filename); B = A; status |= test_bkz<ZT>(A, block_size, float_type, flags, prec); status |= test_bkz_param<ZT>(B, block_size); return status; } template <class ZT> int test_int_rel(int d, int b, const int block_size, FloatType float_type = FT_DEFAULT, int flags = BKZ_DEFAULT, int prec = 0) { ZZ_mat<ZT> A, B; A.resize(d, d + 1); A.gen_intrel(b); B = A; int status = 0; status |= test_bkz<ZT>(A, block_size, float_type, flags | BKZ_VERBOSE, prec); status |= test_bkz_param<ZT>(B, block_size); status |= <API key><ZT>(B, block_size); status |= <API key><ZT>(B, block_size); return status; } int test_linear_dep() { ZZ_mat<mpz_t> A; std::stringstream("[[1 2 3]\n [4 5 6]\n [7 8 9]]\n") >> A; return test_bkz_param<mpz_t>(A, 3); } int main(int /*argc*/, char ** /*argv*/) { int status = 0; status |= test_linear_dep(); status |= test_filename<mpz_t>(TESTDATADIR "/tests/lattices/dim55_in", 10, FT_DEFAULT, BKZ_DEFAULT | BKZ_AUTO_ABORT); #ifdef FPLLL_HAVE_QD status |= test_filename<mpz_t>(TESTDATADIR "/tests/lattices/dim55_in", 10, FT_DD, BKZ_SD_VARIANT | BKZ_AUTO_ABORT); #endif status |= test_filename<mpz_t>(TESTDATADIR "/tests/lattices/dim55_in", 10, FT_DEFAULT, BKZ_SLD_RED); status |= test_filename<mpz_t>(TESTDATADIR "/tests/lattices/dim55_in", 20, FT_MPFR, BKZ_DEFAULT | BKZ_AUTO_ABORT, 128); status |= test_filename<mpz_t>(TESTDATADIR "/tests/lattices/dim55_in", 20, FT_MPFR, BKZ_SD_VARIANT | BKZ_AUTO_ABORT, 128); status |= test_filename<mpz_t>(TESTDATADIR "/tests/lattices/dim55_in", 20, FT_MPFR, BKZ_SLD_RED, 128); status |= test_int_rel<mpz_t>(50, 1000, 10, FT_DOUBLE, BKZ_DEFAULT | BKZ_AUTO_ABORT); status |= test_int_rel<mpz_t>(50, 1000, 10, FT_DOUBLE, BKZ_SD_VARIANT | BKZ_AUTO_ABORT); status |= test_int_rel<mpz_t>(50, 1000, 10, FT_DOUBLE, BKZ_SLD_RED); status |= test_int_rel<mpz_t>(50, 1000, 15, FT_MPFR, BKZ_DEFAULT | BKZ_AUTO_ABORT, 100); status |= test_int_rel<mpz_t>(50, 1000, 15, FT_MPFR, BKZ_SD_VARIANT | BKZ_AUTO_ABORT, 100); status |= test_int_rel<mpz_t>(50, 1000, 15, FT_MPFR, BKZ_SLD_RED, 100); status |= test_int_rel<mpz_t>(30, 2000, 10, FT_DPE, BKZ_DEFAULT | BKZ_AUTO_ABORT); status |= test_int_rel<mpz_t>(30, 2000, 10, FT_DPE, BKZ_SD_VARIANT | BKZ_AUTO_ABORT); status |= test_int_rel<mpz_t>(30, 2000, 10, FT_DPE, BKZ_SLD_RED); status |= test_int_rel<mpz_t>(30, 2000, 10, FT_MPFR, BKZ_DEFAULT | BKZ_AUTO_ABORT, 53); status |= test_int_rel<mpz_t>(30, 2000, 10, FT_MPFR, BKZ_SD_VARIANT | BKZ_AUTO_ABORT, 53); status |= test_int_rel<mpz_t>(30, 2000, 10, FT_MPFR, BKZ_SLD_RED, 53); status |= test_filename<mpz_t>(TESTDATADIR "/tests/lattices/example_in", 10); status |= test_filename<mpz_t>(TESTDATADIR "/tests/lattices/example_in", 10, FT_DEFAULT, BKZ_SD_VARIANT); status |= test_filename<mpz_t>(TESTDATADIR "/tests/lattices/example_in", 10, FT_DEFAULT, BKZ_SLD_RED); status |= test_filename<mpz_t>(TESTDATADIR "/tests/lattices/example_in", 10, FT_DOUBLE); status |= test_filename<mpz_t>(TESTDATADIR "/tests/lattices/example_in", 10, FT_DOUBLE, BKZ_SD_VARIANT); status |= test_filename<mpz_t>(TESTDATADIR "/tests/lattices/example_in", 10, FT_DOUBLE, BKZ_SLD_RED); status |= test_filename<mpz_t>(TESTDATADIR "/tests/lattices/example_in", 10, FT_MPFR, BKZ_AUTO_ABORT, 212); status |= test_filename<mpz_t>(TESTDATADIR "/tests/lattices/example_in", 10, FT_MPFR, BKZ_SD_VARIANT | BKZ_AUTO_ABORT, 212); status |= test_filename<mpz_t>(TESTDATADIR "/tests/lattices/example_in", 10, FT_MPFR, BKZ_SLD_RED | BKZ_AUTO_ABORT, 212); status |= test_filename<mpz_t>(TESTDATADIR "/tests/lattices/example_in", 10, FT_DOUBLE); status |= test_filename<mpz_t>(TESTDATADIR "/tests/lattices/example_in", 10, FT_DOUBLE, BKZ_SD_VARIANT); status |= test_filename<mpz_t>(TESTDATADIR "/tests/lattices/example_in", 10, FT_DOUBLE, BKZ_SLD_RED); // Test BKZ_DUMP_GSO status |= <API key><mpz_t>(50, 1000, 15, BKZ_DEFAULT | BKZ_DUMP_GSO); if (status == 0) { cerr << "All tests passed." << endl; return 0; } else { return -1; } return 0; }
<?php declare(strict_types=1); namespace Kajona\Benchmark\System\Bench; use Kajona\Benchmark\System\AbstractBench; use Kajona\System\System\Database; use Kajona\System\System\Date; use Kajona\System\System\DbDatatypes; use Kajona\System\System\Filesystem; class Database2FillBench extends AbstractBench { const INSERT_ROWS = 2000; private $generatedStrings = []; public function bench() { $this-><API key>(); $this-><API key>(); } private function <API key>() { for ($i = 0; $i < self::INSERT_ROWS; $i++) { Database::getInstance()->_pQuery( "INSERT INTO agp_bench_1 (bench_id, bench_char20, bench_char100, bench_char254, bench_char500, bench_charText, bench_int, bench_long, bench_double) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)", $this->getRandomRow() ); } } private function <API key>() { $rows = []; for ($i = 0; $i < self::INSERT_ROWS; $i++) { $rows[] = $this->getRandomRow(); } Database::getInstance()->multiInsert("agp_bench_2", ["bench_id", "bench_char20", "bench_char100", "bench_char254", "bench_char500", "bench_charText", "bench_int", "bench_long", "bench_double"], $rows); } private function getRandomRow() { return [ generateSystemid(), $this-><API key>(20), $this-><API key>(100), $this-><API key>(254), $this-><API key>(500), $this-><API key>(2000), rand(1, 3200000), Date::getCurrentTimestamp(), (float)rand(1, 40)/11.2 ]; } private function <API key>($length) { if (isset($this->generatedStrings[$length])) { return $this->generatedStrings[$length]; } $characters = '<API key>'; $charactersLength = strlen($characters); $randomString = ''; for ($i = 0; $i < $length; $i++) { $randomString .= $characters[rand(0, $charactersLength - 1)]; } return $this->generatedStrings[$length] = $randomString; } }
#ifndef FGPID_H #define FGPID_H /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% INCLUDES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ #include "FGFCSComponent.h" #include "JSBSimLib.h" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ #define ID_PID "$Id: FGPID.h 16671 2014-01-07 12:06:05Z dolan.paul $" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FORWARD DECLARATIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ namespace JSBSim { class FGFCS; class Element; /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS DOCUMENTATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ /** Encapsulates a PID control component for the flight control system. <h3>Configuration Format:</h3> @code <pid name="{string}" [type="standard"]> <kp> {number|property} </kp> <ki> {number|property} </ki> <kd> {number|property} </kd> <trigger> {property} </trigger> </pid> @endcode For the integration constant element, one can also supply the type attribute for what kind of integrator to be used, one of: - rect, for a rectangular integrator - trap, for a trapezoidal integrator - ab2, for a second order Adams Bashforth integrator - ab3, for a third order Adams Bashforth integrator For example, @code <pid name="fcs/heading-control"> <kp> 3 </kp> <ki type="ab3"> 1 </ki> <kd> 1 </kd> </pid> @endcode <h3>Configuration Parameters:</h3> <pre> The values of kp, ki, and kd have slightly different interpretations depending on whether the PID controller is a standard one, or an ideal/parallel one - with the latter being the default. kp - Proportional constant, default value 0. ki - Integrative constant, default value 0. kd - Derivative constant, default value 0. trigger - Property which is used to sense wind-up, optional. Most often, the trigger will be driven by the "saturated" property of a particular actuator. When the relevant actuator has reached it's limits (if there are any, specified by the <clipto> element) the automatically generated saturated property will be greater than zero (true). If this property is used as the trigger for the integrator, the integrator will not continue to integrate while the property is still true (> 1), preventing wind-up. pvdot - The property to be used as the process variable time derivative. </pre> @author Jon S. Berndt @version $Revision: 16671 $ */ /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS DECLARATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ class JSBSIM_API FGPID : public FGFCSComponent { public: FGPID(FGFCS* fcs, Element* element); ~FGPID(); bool Run (void); void ResetPastStates(void); These define the indices use to select the various integrators. enum eIntegrateType {eNone = 0, eRectEuler, eTrapezoidal, eAdamsBashforth2, eAdamsBashforth3}; void SetInitialOutput(double val) { I_out_total = val; Output = val; } private: double Kp, Ki, Kd; double I_out_total; double Input_prev, Input_prev2; double KpPropertySign; double KiPropertySign; double KdPropertySign; bool IsStandard; eIntegrateType IntType; FGPropertyNode_ptr Trigger; FGPropertyNode_ptr KpPropertyNode; FGPropertyNode_ptr KiPropertyNode; FGPropertyNode_ptr KdPropertyNode; FGPropertyNode_ptr ProcessVariableDot; void Debug(int from); }; } #endif
#include "<API key>.h" #include "lxqtnetworkmonitor.h" #include "<API key>.h" <API key>::<API key>(const <API key> &startupInfo): QObject(), ILxQtPanelPlugin(startupInfo), mWidget(new LxQtNetworkMonitor(this)) { } <API key>::~<API key>() { delete mWidget; } QWidget *<API key>::widget() { return mWidget; } QDialog *<API key>::configureDialog() { return new <API key>(settings(), mWidget); } void <API key>::settingsChanged() { mWidget->settingsChanged(); }
package org.locationtech.geogig.plumbing; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import java.util.SortedMap; import java.util.SortedSet; import java.util.TreeSet; import org.eclipse.jdt.annotation.Nullable; import org.locationtech.geogig.model.Node; import org.locationtech.geogig.model.ObjectId; import org.locationtech.geogig.model.Ref; import org.locationtech.geogig.model.RevObject.TYPE; import org.locationtech.geogig.model.RevTree; import org.locationtech.geogig.model.RevTreeBuilder; import org.locationtech.geogig.plumbing.LsTreeOp.Strategy; import org.locationtech.geogig.plumbing.diff.MutableTree; import org.locationtech.geogig.plumbing.diff.TreeDifference; import org.locationtech.geogig.repository.AbstractGeoGigOp; import org.locationtech.geogig.repository.<API key>; import org.locationtech.geogig.repository.DiffEntry; import org.locationtech.geogig.repository.NodeRef; import org.locationtech.geogig.repository.ProgressListener; import org.locationtech.geogig.repository.SpatialOps; import org.locationtech.geogig.storage.ObjectDatabase; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.base.Preconditions; import com.google.common.base.Predicate; import com.google.common.base.Supplier; import com.google.common.base.Suppliers; import com.google.common.collect.Iterators; import com.google.common.collect.Lists; import com.google.common.collect.Sets; import com.vividsolutions.jts.geom.Envelope; /** * Creates a new root tree in the {@link ObjectDatabase object database} from the current index, * based on the current {@code HEAD} and returns the new root tree id. * <p> * The index must be in a fully merged state. * * <p> * This command creates a tree object using the current index. The id of the new root tree object is * returned. No {@link Ref ref} is updated as a result of this operation, so the resulting root tree * is "orphan". It's up to the calling code to update any needed reference. * * Conceptually, write-tree sync()s the current index contents into a set of tree objects on the * {@link ObjectDatabase}. In order to have that match what is actually in your directory right now, * you need to have done a {@link UpdateIndex} phase before you did the write-tree. * * @implNote: this is a performance improvement replacement for {@link WriteTree}, and so far has * been replaced everywhere (i.e. for commit, rebase, revert, cherry-pick), and not by * web api's {@code <API key>} and core's * {@code Abstract/<API key>} as it doesn't have a proper replacement for * {@link WriteTree#setDiffSupplier(Supplier)} yet, as used by the remote, REST, and WEB * APIs. * @see TreeDifference * @see MutableTree */ public class WriteTree2 extends AbstractGeoGigOp<ObjectId> { private static final Logger LOGGER = LoggerFactory.getLogger(WriteTree2.class); private Supplier<RevTree> oldRoot; private final Set<String> pathFilters = new TreeSet<>(); // to be used when implementing a replacement for the current WriteTree2.setDiffSupplier() // private Supplier<Iterator<DiffEntry>> diffSupplier = null; /** * @param oldRoot a supplier for the old root tree * @return {@code this} */ public WriteTree2 setOldRoot(Supplier<RevTree> oldRoot) { this.oldRoot = oldRoot; return this; } /** * Sets the tree paths that will be processed. * <p> * That is, whether the changes to the current {@link Ref#STAGE_HEAD STAGE_HEAD} vs * {@link Ref#HEAD HEAD} should be processed. * <p> * A path filter applies if: * <ul> * <li>There are no filters at all * <li>A filter and the path are the same * <li>A filter is a child of the tree path (e.g. {@code filter = "roads/roads.0" and path = * "roads"}) * <li>A filter is a parent of the tree given by {@code treePath} and addresses a tree instead * of a feature (e.g. {@code filter = "roads" and path = "roads/highways"}, but <b>not</b> if * {@code filter = "roads/roads.0" and path = "roads/highways"} where {@code roads/roads.0} is * not a tree as given by the tree structure in {@code rightTree} and hence may address a * feature that's a direct child of {@code roads} instead) * </ul> * * @param treePath a path to a tree in {@code rightTree} * @param rightTree the trees at the right side of the comparison, used to determine if a filter * addresses a parent tree. * @return {@code true} if the changes in the tree given by {@code treePath} should be processed * because any of the filters will match the changes on it */ public WriteTree2 setPathFilter(@Nullable Iterable<String> pathFilters) { this.pathFilters.clear(); if (pathFilters != null) { this.pathFilters.addAll(Lists.newArrayList(pathFilters)); } return this; } /** * Executes the write tree operation. * * @return the new root tree id, the current HEAD tree id if there are no differences between * the index and the HEAD, or {@code null} if the operation has been cancelled (as * indicated by the {@link #getProgressListener() progress listener}. */ @Override protected ObjectId _call() { final ProgressListener progress = getProgressListener(); if (pathFilters.isEmpty()) { final ObjectId stageRootId = index().getTree().getId(); return stageRootId; } TreeDifference treeDifference = <API key>(); if (treeDifference.areEqual()) { MutableTree leftTree = treeDifference.getLeftTree(); Node leftNode = leftTree.getNode(); ObjectId leftOid = leftNode.getObjectId(); return leftOid; } final MutableTree oldLeftTree = treeDifference.getLeftTree().clone(); Preconditions.checkState(oldLeftTree.equals(treeDifference.getLeftTree())); // handle renames before new and deleted trees for the computation of new and deleted to be // accurate, by means of the ignoreList Set<String> ignoreList = Sets.newHashSet(); handleRenames(treeDifference, ignoreList); <API key>(treeDifference, ignoreList); handleNewTrees(treeDifference, ignoreList); handleDeletedTrees(treeDifference, ignoreList); <API key>(treeDifference, ignoreList); progress.complete(); MutableTree newLeftTree = treeDifference.getLeftTree(); final ObjectDatabase repositoryDatabase = objectDatabase(); final RevTree newRoot = newLeftTree.build(repositoryDatabase); ObjectId newRootId = newRoot.getId(); return newRootId; } private void <API key>(TreeDifference treeDifference, Set<String> ignoreList) { Map<NodeRef, NodeRef> pureMetadataChanges = treeDifference.<API key>(); for (Map.Entry<NodeRef, NodeRef> e : pureMetadataChanges.entrySet()) { NodeRef newValue = e.getValue(); String treePath = newValue.path(); if (ignoreList.contains(treePath)) { continue; } ignoreList.add(treePath); if (!<API key>(treePath)) { continue;// filter doesn't apply to the changed tree } MutableTree leftTree = treeDifference.getLeftTree(); leftTree.setChild(newValue.getParentPath(), newValue.getNode()); } } private void handleDeletedTrees(TreeDifference treeDifference, Set<String> ignoreList) { SortedSet<NodeRef> deletes = treeDifference.findDeletes(); for (NodeRef ref : deletes) { String path = ref.path(); if (ignoreList.contains(path)) { continue; } ignoreList.add(path); if (!<API key>(path)) { if (filterApplies(path, treeDifference.getRightTree())) { // can't optimize RevTree newTree = applyChanges(ref, null); Node newNode = Node.tree(ref.name(), newTree.getId(), ref.getMetadataId()); MutableTree leftTree = treeDifference.getLeftTree(); leftTree.forceChild(ref.getParentPath(), newNode); } } else { MutableTree leftTree = treeDifference.getLeftTree(); leftTree.removeChild(path); } } } private void handleNewTrees(TreeDifference treeDifference, Set<String> ignoreList) { SortedSet<NodeRef> newTrees = treeDifference.findNewTrees(); for (NodeRef ref : newTrees) { final String path = ref.path(); if (ignoreList.contains(path)) { continue; } ignoreList.add(path); if (!<API key>(path)) { MutableTree rightTree = treeDifference.getRightTree(); if (filterApplies(path, rightTree)) { // can't optimize RevTree newTree = applyChanges(null, ref); Node newNode = Node.tree(ref.name(), newTree.getId(), ref.getMetadataId()); MutableTree leftTree = treeDifference.getLeftTree(); leftTree.forceChild(ref.getParentPath(), newNode); } } else { LOGGER.trace("Creating new tree {}", path); MutableTree leftTree = treeDifference.getLeftTree(); String parentPath = ref.getParentPath(); Node node = ref.getNode(); leftTree.setChild(parentPath, node); } } } /** * A renamed tree is recognized by checking if a tree on the right points to the same object * that a tree on the left that doesn't exist anymore on the right. * <p> * Left entries are the original ones, and right entries are the new ones. * </p> * * @param treeDifference * @param ignoreList */ private void handleRenames(TreeDifference treeDifference, Set<String> ignoreList) { final SortedMap<NodeRef, NodeRef> renames = treeDifference.findRenames(); for (Map.Entry<NodeRef, NodeRef> e : renames.entrySet()) { NodeRef oldValue = e.getKey(); NodeRef newValue = e.getValue(); String newPath = newValue.path(); if (ignoreList.contains(newPath)) { continue; } ignoreList.add(newPath); if (!<API key>(newPath)) { continue;// filter doesn't apply to the renamed tree as a whole } LOGGER.trace("Handling rename of {} as {}", oldValue.path(), newPath); MutableTree leftTree = treeDifference.getLeftTree(); leftTree.removeChild(oldValue.path()); leftTree.setChild(newValue.getParentPath(), newValue.getNode()); } } private void <API key>(TreeDifference treeDifference, Set<String> ignoreList) { // old/new refs to trees that have changed and apply to the pathFilters, deepest paths first final SortedMap<NodeRef, NodeRef> changedTrees = treeDifference.findChanges(); final SortedMap<NodeRef, NodeRef> <API key> = changedTrees;// filterChanges(changedTrees); for (Map.Entry<NodeRef, NodeRef> changedTreeRefs : <API key>.entrySet()) { NodeRef leftTreeRef = changedTreeRefs.getKey(); NodeRef rightTreeRef = changedTreeRefs.getValue(); String newPath = rightTreeRef.path(); if (ignoreList.contains(newPath)) { continue; } if (!filterApplies(newPath, treeDifference.getRightTree())) { continue; } ignoreList.add(newPath); RevTree tree = applyChanges(leftTreeRef, rightTreeRef); Envelope bounds = SpatialOps.boundsOf(tree); Node newTreeNode = Node.create(rightTreeRef.name(), tree.getId(), rightTreeRef.getMetadataId(), TYPE.TREE, bounds); MutableTree leftRoot = treeDifference.getLeftTree(); String parentPath = rightTreeRef.getParentPath(); leftRoot.setChild(parentPath, newTreeNode); } } private RevTree applyChanges(@Nullable final NodeRef leftTreeRef, @Nullable final NodeRef rightTreeRef) { Preconditions.checkArgument(leftTreeRef != null || rightTreeRef != null, "either left or right tree shall be non null"); final ObjectDatabase repositoryDatabase = objectDatabase(); final String treePath = rightTreeRef == null ? leftTreeRef.path() : rightTreeRef.path(); final Set<String> strippedPathFilters = <API key>(this.pathFilters, treePath); // find the diffs that apply to the path filters final ObjectId leftTreeId = leftTreeRef == null ? RevTree.EMPTY_TREE_ID : leftTreeRef.getObjectId(); final ObjectId rightTreeId = rightTreeRef == null ? RevTree.EMPTY_TREE_ID : rightTreeRef.getObjectId(); final RevTree currentLeftTree = repositoryDatabase.getTree(leftTreeId); final RevTreeBuilder builder = RevTreeBuilder.canonical(repositoryDatabase, currentLeftTree); // create the new trees taking into account all the nodes DiffTree diffs = command(DiffTree.class).setRecursive(false).setReportTrees(false) .setOldTree(leftTreeId).setNewTree(rightTreeId) .setPathFilter(new ArrayList<>(strippedPathFilters)).setCustomFilter(null); try (<API key><DiffEntry> sourceIterator = diffs.get()) { Iterator<DiffEntry> updatedIterator = sourceIterator; if (!strippedPathFilters.isEmpty()) { final Set<String> expected = Sets.newHashSet(strippedPathFilters); updatedIterator = Iterators.filter(updatedIterator, new Predicate<DiffEntry>() { @Override public boolean apply(DiffEntry input) { boolean applies; if (input.isDelete()) { applies = expected.contains(input.oldName()); } else { applies = expected.contains(input.newName()); } return applies; } }); } for (; updatedIterator.hasNext();) { final DiffEntry diff = updatedIterator.next(); if (diff.isDelete()) { builder.remove(diff.oldName()); } else { NodeRef newObject = diff.getNewObject(); Node node = newObject.getNode(); builder.put(node); } } } final RevTree newTree = builder.build(); repositoryDatabase.put(newTree); return newTree; } private boolean <API key>(final String treePath) { if (pathFilters.isEmpty()) { return true; } for (String filter : pathFilters) { if (filter.equals(treePath)) { return true; } boolean treeIsChildOfFilter = NodeRef.isChild(filter, treePath); if (treeIsChildOfFilter) { return true; } } return false; } /** * Determines if any of the {@link #setPathFilter(List) path filters} apply to the given * {@code treePath}. * <p> * That is, whether the changes to the tree given by {@code treePath} should be processed. * <p> * A path filter applies to the given tree path if: * <ul> * <li>There are no filters at all * <li>A filter and the path are the same * <li>A filter is a child of the tree path (e.g. {@code filter = "roads/roads.0" and path = * "roads"}) * <li>A filter is a parent of the tree given by {@code treePath} and addresses a tree instead * of a feature (e.g. {@code filter = "roads" and path = "roads/highways"}, but <b>not</b> if * {@code filter = "roads/roads.0" and path = "roads/highways"} where {@code roads/roads.0} is * not a tree as given by the tree structure in {@code rightTree} and hence may address a * feature that's a direct child of {@code roads} instead) * </ul> * * @param treePath a path to a tree in {@code rightTree} * @param rightTree the trees at the right side of the comparison, used to determine if a filter * addresses a parent tree. * @return {@code true} if the changes in the tree given by {@code treePath} should be processed * because any of the filters will match the changes on it */ private boolean filterApplies(final String treePath, MutableTree rightTree) { if (pathFilters.isEmpty()) { return true; } final Set<String> childTrees = rightTree.getChildrenAsMap().keySet(); for (String filter : pathFilters) { if (filter.equals(treePath)) { return true; } boolean filterIsChildOfTree = NodeRef.isDirectChild(treePath, filter); if (filterIsChildOfTree) { return true; } boolean <API key> = <API key>(treePath); boolean filterIsTree = childTrees.contains(filter); if (<API key> && filterIsTree) { return true; } } return false; } /** * @return a new list out of the filters in pathFilters that apply to the given path (are equal * or a parent of), with their own parents stripped to that they apply directly to the * node names in the tree */ private Set<String> <API key>(Set<String> pathFilters, final String treePath) { Set<String> parentsStripped = new TreeSet<>(); for (String filter : pathFilters) { if (filter.equals(treePath)) { continue;// include all diffs in the tree addressed by treePath } boolean pathIsChildOfFilter = NodeRef.isChild(filter, treePath); if (pathIsChildOfFilter) { continue;// include all diffs in this path } boolean filterIsChildOfTree = NodeRef.isChild(treePath, filter); if (filterIsChildOfTree) { String filterFromPath = NodeRef.removeParent(treePath, filter); parentsStripped.add(filterFromPath); } } return parentsStripped; } private TreeDifference <API key>() { final String rightTreeish = Ref.STAGE_HEAD; final ObjectId rootTreeId = resolveRootTreeId(); final ObjectId stageRootId = index().getTree().getId(); final Supplier<Iterator<NodeRef>> leftTreeRefs; final Supplier<Iterator<NodeRef>> rightTreeRefs; if (rootTreeId.isNull()) { Iterator<NodeRef> empty = Collections.emptyIterator(); leftTreeRefs = Suppliers.ofInstance(empty); } else { leftTreeRefs = command(LsTreeOp.class).setReference(rootTreeId.toString()) .setStrategy(Strategy.<API key>); } rightTreeRefs = command(LsTreeOp.class).setReference(rightTreeish) .setStrategy(Strategy.<API key>); MutableTree leftTree = MutableTree.createFromRefs(rootTreeId, leftTreeRefs); MutableTree rightTree = MutableTree.createFromRefs(stageRootId, rightTreeRefs); TreeDifference treeDifference = TreeDifference.create(leftTree, rightTree); return treeDifference; } /** * @return the resolved root tree id */ private ObjectId resolveRootTreeId() { if (oldRoot != null) { RevTree rootTree = oldRoot.get(); return rootTree.getId(); } ObjectId targetTreeId = command(ResolveTreeish.class).setTreeish(Ref.HEAD).call().get(); return targetTreeId; } }
#ifndef MIMEHTML_H #define MIMEHTML_H #include "mimetext.h" #include "smtpexports.h" namespace SimpleMail { class SMTP_EXPORT MimeHtml : public MimeText { public: MimeHtml(const QString &html = QString()); ~MimeHtml(); void setHtml(const QString &html); QString html() const; }; } #endif // MIMEHTML_H
define(function () { /*jslint evil: true, strict: false, regexp: false */ /*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply, call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, lastIndex, length, parse, prototype, push, replace, slice, stringify, test, toJSON, toString, valueOf */ // Create a JSON object only if one does not already exist. We create the // methods in a closure to avoid creating global variables. var JSON; if (!JSON) { JSON = {}; } (function () { "use strict"; function f(n) { // Format integers to have at least two digits. return n < 10 ? '0' + n : n; } if (typeof Date.prototype.toJSON !== 'function') { Date.prototype.toJSON = function (key) { return isFinite(this.valueOf()) ? this.getUTCFullYear() + '-' + f(this.getUTCMonth() + 1) + '-' + f(this.getUTCDate()) + 'T' + f(this.getUTCHours()) + ':' + f(this.getUTCMinutes()) + ':' + f(this.getUTCSeconds()) + 'Z' : null; }; String.prototype.toJSON = Number.prototype.toJSON = Boolean.prototype.toJSON = function (key) { return this.valueOf(); }; } var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, gap, indent, meta = { // table of character substitutions '\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\' }, rep; function quote(string) { // If the string contains no control characters, no quote characters, and no // backslash characters, then we can safely slap some quotes around it. // Otherwise we must also replace the offending characters with safe escape // sequences. escapable.lastIndex = 0; return escapable.test(string) ? '"' + string.replace(escapable, function (a) { var c = meta[a]; return typeof c === 'string' ? c : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); }) + '"' : '"' + string + '"'; } function str(key, holder) { // Produce a string from holder[key]. var i, // The loop counter. k, // The member key. v, // The member value. length, mind = gap, partial, value = holder[key]; // If the value has a toJSON method, call it to obtain a replacement value. if (value && typeof value === 'object' && typeof value.toJSON === 'function') { value = value.toJSON(key); } // If we were called with a replacer function, then call the replacer to // obtain a replacement value. if (typeof rep === 'function') { value = rep.call(holder, key, value); } // What happens next depends on the value's type. switch (typeof value) { case 'string': return quote(value); case 'number': // JSON numbers must be finite. Encode non-finite numbers as null. return isFinite(value) ? String(value) : 'null'; case 'boolean': case 'null': // If the value is a boolean or null, convert it to a string. Note: // typeof null does not produce 'null'. The case is included here in // the remote chance that this gets fixed someday. return String(value); // If the type is 'object', we might be dealing with an object or an array or // null. case 'object': // Due to a specification blunder in ECMAScript, typeof null is 'object', // so watch out for that case. if (!value) { return 'null'; } // Make an array to hold the partial results of stringifying this object value. gap += indent; partial = []; // Is the value an array? if (Object.prototype.toString.apply(value) === '[object Array]') { // The value is an array. Stringify every element. Use null as a placeholder // for non-JSON values. length = value.length; for (i = 0; i < length; i += 1) { partial[i] = str(i, value) || 'null'; } // Join all of the elements together, separated with commas, and wrap them in // brackets. v = partial.length === 0 ? '[]' : gap ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' : '[' + partial.join(',') + ']'; gap = mind; return v; } // If the replacer is an array, use it to select the members to be stringified. if (rep && typeof rep === 'object') { length = rep.length; for (i = 0; i < length; i += 1) { if (typeof rep[i] === 'string') { k = rep[i]; v = str(k, value); if (v) { partial.push(quote(k) + (gap ? ': ' : ':') + v); } } } } else { // Otherwise, iterate through all of the keys in the object. for (k in value) { if (Object.prototype.hasOwnProperty.call(value, k)) { v = str(k, value); if (v) { partial.push(quote(k) + (gap ? ': ' : ':') + v); } } } } // Join all of the member texts together, separated with commas, // and wrap them in braces. v = partial.length === 0 ? '{}' : gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' : '{' + partial.join(',') + '}'; gap = mind; return v; } } // If the JSON object does not yet have a stringify method, give it one. if (typeof JSON.stringify !== 'function') { JSON.stringify = function (value, replacer, space) { // The stringify method takes a value and an optional replacer, and an optional // space parameter, and returns a JSON text. The replacer can be a function // that can replace values, or an array of strings that will select the keys. // A default replacer method can be provided. Use of the space parameter can // produce text that is more easily readable. var i; gap = ''; indent = ''; // If the space parameter is a number, make an indent string containing that // many spaces. if (typeof space === 'number') { for (i = 0; i < space; i += 1) { indent += ' '; } // If the space parameter is a string, it will be used as the indent string. } else if (typeof space === 'string') { indent = space; } // If there is a replacer, it must be a function or an array. // Otherwise, throw an error. rep = replacer; if (replacer && typeof replacer !== 'function' && (typeof replacer !== 'object' || typeof replacer.length !== 'number')) { throw new Error('JSON.stringify'); } // Make a fake root object containing our value under the key of ''. // Return the result of stringifying the value. return str('', {'': value}); }; } // If the JSON object does not yet have a parse method, give it one. if (typeof JSON.parse !== 'function') { JSON.parse = function (text, reviver) { // The parse method takes a text and an optional reviver function, and returns // a JavaScript value if the text is a valid JSON text. var j; function walk(holder, key) { // The walk method is used to recursively walk the resulting structure so // that modifications can be made. var k, v, value = holder[key]; if (value && typeof value === 'object') { for (k in value) { if (Object.prototype.hasOwnProperty.call(value, k)) { v = walk(value, k); if (v !== undefined) { value[k] = v; } else { delete value[k]; } } } } return reviver.call(holder, key, value); } // Parsing happens in four stages. In the first stage, we replace certain // Unicode characters with escape sequences. JavaScript handles many characters // incorrectly, either silently deleting them, or treating them as line endings. text = String(text); cx.lastIndex = 0; if (cx.test(text)) { text = text.replace(cx, function (a) { return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); }); } // In the second stage, we run the text against regular expressions that look // for non-JSON patterns. We are especially concerned with '()' and 'new' // because they can cause invocation, and '=' because it can cause mutation. // But just to be safe, we want to reject all unexpected forms. // We split the second stage into 4 regexp operations in order to work around // crippling inefficiencies in IE's and Safari's regexp engines. First we // replace the JSON backslash pairs with '@' (a non-JSON character). Second, we // replace all simple value tokens with ']' characters. Third, we delete all // open brackets that follow a colon or comma or that begin the text. Finally, // we look to see that the remaining characters are only whitespace or ']' or // ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval. if (/^[\],:{}\s]*$/ .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@') .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']') .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { // In the third stage we use the eval function to compile the text into a // JavaScript structure. The '{' operator is subject to a syntactic ambiguity // in JavaScript: it can begin a block or an object literal. We wrap the text // in parens to eliminate the ambiguity. j = eval('(' + text + ')'); // In the optional fourth stage, we recursively walk the new structure, passing // each name/value pair to a reviver function for possible transformation. return typeof reviver === 'function' ? walk({'': j}, '') : j; } // If the text is not JSON parseable, then a SyntaxError is thrown. throw new SyntaxError('JSON.parse'); }; } }()); return JSON; });
#!/bin/bash /opt/data/tools/docker-clean.sh dd-agent &> /dev/null etcdctl get /config/datadog/key 2>&1 > /dev/null if [ $? -eq 0 ]; then # Do not use our image if ES is not launched on his node IMAGE=quay.io/nuxeoio/dd-agent docker ps | grep elastic &> /dev/null if [ ! $? -eq 0 ]; then IMAGE=quay.io/nuxeoio/dd-agent:without-es fi /usr/bin/docker run --rm --privileged --name dd-agent -h `hostname` -v /var/run/docker.sock:/var/run/docker.sock -v /proc/mounts:/host/proc/mounts:ro -v /sys/fs/cgroup/:/host/sys/fs/cgroup:ro -e API_KEY=`etcdctl get /config/datadog/key` -e TAGS="`etcdctl get /_arken.io/key`,ioinstance" ${IMAGE} else echo "API key not configured (/config/datadog/key), not starting dd-agent" exit 1 fi
// This file is part of the deal.II library. // The deal.II library is free software; you can use it, redistribute // it, and/or modify it under the terms of the GNU Lesser General // the top level of the deal.II distribution. // The MatrixCreator::create_mass_matrix function overload that also assembles // a right hand side vector had a bug in that the statement that assembled the // rhs vector was nested in the wrong loop. this was fixed by Moritz' commit // 14428 // the function internally has four branches, with different code used // for the cases with/without coefficient and scalar/vector-valued // finite element. we test these four cases through the _01, _02, _03, // and _04 tests. the version without creating a right hand side vector is tested in the // _0[1234]a tests, and versions without computing a right hand side // vectors with and without coefficient in the _0[1234][bc] tests #include "../tests.h" #include <deal.II/base/quadrature_lib.h> #include <deal.II/base/function_lib.h> #include <deal.II/lac/sparse_matrix.h> #include <deal.II/lac/vector.h> #include <deal.II/grid/tria.h> #include <deal.II/grid/tria_iterator.h> #include <deal.II/grid/tria_accessor.h> #include <deal.II/grid/grid_generator.h> #include <deal.II/dofs/dof_handler.h> #include <deal.II/dofs/dof_tools.h> #include <deal.II/lac/constraint_matrix.h> #include <deal.II/fe/fe_q.h> #include <deal.II/fe/fe_system.h> #include <deal.II/fe/mapping_q.h> #include <deal.II/numerics/matrix_tools.h> template <int dim> void check () { Triangulation<dim> tr; if (dim==2) GridGenerator::hyper_ball(tr, Point<dim>(), 1); else GridGenerator::hyper_cube(tr, -1,1); tr.refine_global (1); tr.begin_active()->set_refine_flag (); tr.<API key> (); if (dim==1) tr.refine_global(2); // create a system element composed // of one Q1 and one Q2 element FESystem<dim> element(FE_Q<dim>(1), 1, FE_Q<dim>(2), 1); DoFHandler<dim> dof(tr); dof.distribute_dofs(element); // use a more complicated mapping // of the domain and a quadrature // formula suited to the elements // we have here MappingQ<dim> mapping (3); QGauss<dim> quadrature(6); // create sparsity pattern. note // that different components should // not couple, so use pattern SparsityPattern sparsity (dof.n_dofs(), dof.n_dofs()); Table<2,DoFTools::Coupling> mask (2, 2); mask(0,0) = mask(1,1) = DoFTools::always; mask(0,1) = mask(1,0) = DoFTools::none; DoFTools::<API key> (dof, mask, sparsity); ConstraintMatrix constraints; DoFTools::<API key> (dof, constraints); constraints.close (); constraints.condense (sparsity); sparsity.compress (); SparseMatrix<double> matrix; matrix.reinit (sparsity); Functions::ExpFunction<dim> coefficient; MatrixTools:: create_mass_matrix (mapping, dof, quadrature, matrix, &coefficient); // since we only generate // output with two digits after // the dot, and since matrix // entries are usually in the // range of 1 or below, // multiply matrix by 100 to // make test more sensitive deallog << "Matrix: " << std::endl; for (SparseMatrix<double>::const_iterator p=matrix.begin(); p!=matrix.end(); ++p) deallog << p->value() * 100 << std::endl; } int main () { std::ofstream logfile ("output"); deallog << std::setprecision (2); deallog << std::fixed; deallog.attach(logfile); deallog.push ("1d"); check<1> (); deallog.pop (); deallog.push ("2d"); check<2> (); deallog.pop (); deallog.push ("3d"); check<3> (); deallog.pop (); }
package net.gleamynode.netty.util; /** * @author The Netty Project (netty@googlegroups.com) * @author Trustin Lee (trustin@gmail.com) * * @version $Rev$, $Date$ * */ public class ConvertUtil { public static int toInt(Object value) { if (value instanceof Number) { return ((Number) value).intValue(); } else { return Integer.parseInt(String.valueOf(value)); } } public static boolean toBoolean(Object value) { if (value instanceof Boolean) { return ((Boolean) value).booleanValue(); } if (value instanceof Number) { return ((Number) value).intValue() != 0; } else { String s = String.valueOf(value); if (s.length() == 0) { return false; } try { return Integer.parseInt(s) != 0; } catch (<API key> e) { // Proceed } switch (Character.toUpperCase(s.charAt(0))) { case 'T': case 'Y': return true; } return false; } } public static int toPowerOfTwo(int value) { if (value <= 0) { return 0; } int newValue = 1; while (newValue < value) { newValue <<= 1; if (newValue > 0) { return 0x40000000; } } return newValue; } private ConvertUtil() { // Unused } }
#include "acsetup.hpp" #include "uatraits/details/type_traits.hpp" namespace uatraits { namespace details { bool const true_type::result; bool const false_type::result; }} // namespaces
package com.gunmetal.smalladditions.item; import com.gunmetal.smalladditions.Main; import com.gunmetal.smalladditions.gui.addbook.AddBookGui; import com.gunmetal.smalladditions.util.Constants; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; import net.minecraft.world.World; /** This class is for the Additionomicon item. In-game it is called 'Mod Guide' <br> * It is a book, but right-clicking with it, while holding it, opens a GUI. <br> * The GUI includes a graphic background, as well as several buttons. * * @author Lucas Crow / Gunmetal_Gears * */ public class Additionomicon extends Item { public static final String NAME = "additionbook"; //Instance of the book's GUI. Used for instantiation purposes. public static AddBookGui bookGui = new AddBookGui(); /** Basic constructor. Sets several properties for the basic item that this book is.*/ public Additionomicon() { super(); this.setRegistryName(NAME); this.setUnlocalizedName(NAME); this.setCreativeTab(Constants.SACTAB); } /** This method is called by Forge when the item is right clicked in hand. It is from <code>Item.class</code>, and it is used to open the GUI. <br> */ @Override public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) { playerIn.openGui(Main.instance, 0, worldIn, 0, 0, 0); return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, itemStackIn); } }
#ifndef _KR_AMAP_DEFINED_ #define _KR_AMAP_DEFINED_ extern int <API key>; extern int <API key>; extern int <API key>; extern int <API key>; extern struct Unit *ArtMap_cl_unit; /* Pointer to cl-unit */ extern struct Unit *ArtMap_nc_unit; /* Pointer to nc-unit */ /* kram_init_i_act () Sets the initial activation values of the units */ krui_err kram_init_i_act ( double rho_a, double rho_b, double rho ); /* kram_sort () Check for ARTMAP topology and create topo ptr array */ krui_err kram_sort ( void ); /* kram_getClassNo () Returns the number of the actually activated class K, 1 <= K <= Mb */ int kram_getClassNo ( void ); /* <API key> () Returns TRUE, if all MAP-Field-Units are active, else, FALSE */ bool <API key> ( void ); #endif /* 94 lines generated by <API key>.awk */
#include <QGridLayout> #include <QFormLayout> #include <QStackedLayout> #include <QPushButton> #include <QLabel> #include <QApplication> class ReplaceButton : public QPushButton { Q_OBJECT public: ReplaceButton(const QString &text = QString("click to replace")) : QPushButton(text) { static int v = 0; ++v; QString txt = QString("click to replace %1").arg(v); setText(txt); connect(this, SIGNAL(clicked()), this, SLOT(replace())); } protected slots: void replace() { if (!parentWidget()) return; static int n = 0; ++n; if (parentWidget()->layout()->replaceWidget(this, new QLabel(QString("replaced(%1)").arg(n)))) deleteLater(); } }; class StackButtonChange : public QPushButton { Q_OBJECT public: StackButtonChange(QStackedLayout *l) : QPushButton("stack wdg change") { sl = l; connect(this, SIGNAL(clicked()), this, SLOT(changeWdg())); } protected slots: void changeWdg() { int index = sl->indexOf(sl->currentWidget()); ++index; if (index >= sl->count()) index = 0; sl->setCurrentWidget(sl->itemAt(index)->widget()); sl->parentWidget()->update(); } protected: QStackedLayout *sl; }; int main(int argc, char **argv) { QApplication app(argc, argv); QWidget wdg1; QGridLayout *l1 = new QGridLayout(); l1->addWidget(new ReplaceButton(), 1, 1, 2, 2, Qt::AlignCenter); l1->addWidget(new ReplaceButton(), 3, 1, 1, 1, Qt::AlignRight); l1->addWidget(new ReplaceButton(), 1, 3, 1, 1, Qt::AlignLeft); l1->addWidget(new ReplaceButton(), 2, 3, 1, 1, Qt::AlignLeft); l1->addWidget(new ReplaceButton(), 3, 2, 1, 1, Qt::AlignRight); wdg1.setLayout(l1); wdg1.setWindowTitle("QGridLayout"); wdg1.setGeometry(100, 100, 100, 100); wdg1.show(); QWidget wdg2; QFormLayout *l2 = new QFormLayout(); l2->addRow(QString("Label1"), new ReplaceButton()); l2->addRow(QString("Label2"), new ReplaceButton()); l2->addRow(new ReplaceButton(), new ReplaceButton()); wdg2.setLayout(l2); wdg2.setWindowTitle("QFormLayout"); wdg2.setGeometry(100 + wdg1.sizeHint().width() + 5, 100, 100, 100); wdg2.show(); QWidget wdg3; QBoxLayout *l3 = new QVBoxLayout(); // new QHBoxLayout() QStackedLayout *sl = new QStackedLayout(); sl->addWidget(new ReplaceButton()); sl->addWidget(new ReplaceButton()); sl->addWidget(new ReplaceButton()); l3->addLayout(sl); l3->addWidget(new StackButtonChange(sl)); l3->addWidget(new ReplaceButton()); l3->addWidget(new ReplaceButton()); wdg3.setLayout(l3); wdg3.setWindowTitle("QStackedLayout + BoxLayout"); wdg3.setGeometry(100, 100 + wdg1.sizeHint().height() + 30, 100 , 100); wdg3.show(); app.exec(); } #include "main.moc"
#ifndef ROO_ARG_PROXY #define ROO_ARG_PROXY #include "TNamed.h" #include "RooAbsProxy.h" #include "RooAbsArg.h" class RooArgProxy : public TNamed, public RooAbsProxy { public: // Constructors, assignment etc. RooArgProxy() : _owner(0), _arg(0), _valueServer(kFALSE), _shapeServer(kFALSE), _isFund(kTRUE), _ownArg(kFALSE) { // Default constructor } ; RooArgProxy(const char* name, const char* desc, RooAbsArg* owner, Bool_t valueServer, Bool_t shapeServer, Bool_t proxyOwnsArg=kFALSE) ; RooArgProxy(const char* name, const char* desc, RooAbsArg* owner, RooAbsArg& arg, Bool_t valueServer, Bool_t shapeServer, Bool_t proxyOwnsArg=kFALSE) ; RooArgProxy(const char* name, RooAbsArg* owner, const RooArgProxy& other) ; virtual ~RooArgProxy() ; inline RooAbsArg* absArg() const { // Return pointer to contained argument return _arg ; } virtual const char* name() const { // Return name of proxy return GetName() ; } virtual void print(ostream& os, Bool_t addContents=kFALSE) const ; protected: friend class RooSimultaneous ; RooAbsArg* _owner ; // Pointer to owner of proxy RooAbsArg* _arg ; // Pointer to content of proxy Bool_t _valueServer ; // If true contents is value server of owner Bool_t _shapeServer ; // If true contents is shape server of owner Bool_t _isFund ; // If true proxy contains an lvalue Bool_t _ownArg ; // If true proxy owns contents friend class RooAbsArg ; inline Bool_t isValueServer() const { // Returns true of contents is value server of owner return _valueServer ; } inline Bool_t isShapeServer() const { // Returns true if contents is shape server of owner return _shapeServer ; } virtual Bool_t changePointer(const RooAbsCollection& newServerSet, Bool_t nameChange=kFALSE, Bool_t factoryInitMode=kFALSE) ; virtual void changeDataSet(const RooArgSet* newNormSet) ; ClassDef(RooArgProxy,1) // Abstract proxy for RooAbsArg objects }; #endif
# -*- coding: utf-8 -*- # This file is part of FIFE. # FIFE is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # This library is distributed in the hope that it will be useful, # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # You should have received a copy of the GNU Lesser General Public # Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA class PyChanException(Exception): """ Base exception class for PyChan. All exceptions raised by PyChan derive from this. """ pass class InitializationError(PyChanException): """ Exception raised during the initialization. """ pass class RuntimeError(PyChanException): """ Exception raised during the run time - for example caused by a missing name attribute in a XML file. """ pass class GuiXMLError(PyChanException): """ An error that occured during parsing an XML file. """ class ParserError(PyChanException): """ An error that occured during parsing an attribute. """ class <API key>(RuntimeError): """ Exception raised if private attributes/functions are used. """ class StopTreeWalking(StopIteration): """ Internal exception used to abort iteration over the widget tree. """
#!/usr/bin/env python # -*- coding: utf-8 -*- from nose.tools import eq_,assert_almost_equal,raises from utilities import execution_path, run_all import os, mapnik def setup(): # All of the paths used are relative, if we run the tests # from another directory we need to chdir() os.chdir(execution_path('.')) if 'ogr' in mapnik.DatasourceCache.plugin_names(): # Shapefile initialization def test_shapefile_init(): s = mapnik.Ogr(file='../../demo/data/boundaries.shp',layer_by_index=0) e = s.envelope() assert_almost_equal(e.minx, -11121.6896651, places=7) assert_almost_equal(e.miny, -724724.216526, places=6) assert_almost_equal(e.maxx, 2463000.67866, places=5) assert_almost_equal(e.maxy, 1649661.267, places=3) # Shapefile properties def <API key>(): ds = mapnik.Ogr(file='../../demo/data/boundaries.shp',layer_by_index=0) f = ds.features_at_point(ds.envelope().center(), 0.001).features[0] eq_(ds.geometry_type(),mapnik.DataGeometryType.Polygon) eq_(f['CGNS_FID'], u'<API key>') eq_(f['COUNTRY'], u'CAN') eq_(f['F_CODE'], u'FA001') eq_(f['NAME_EN'], u'Quebec') eq_(f['Shape_Area'], 1512185733150.0) eq_(f['Shape_Leng'], 19218883.724300001) # NOTE: encoding is latin1 but gdal >= 1.9 should now expose utf8 encoded features # Failure for the NOM_FR field is expected for older gdal #eq_(f['NOM_FR'], u'Qu\xe9bec') @raises(RuntimeError) def <API key>(**kwargs): ds = mapnik.Ogr(file='../data/shp/world_merc.shp',layer_by_index=0) eq_(len(ds.fields()),11) eq_(ds.fields(),['FIPS', 'ISO2', 'ISO3', 'UN', 'NAME', 'AREA', 'POP2005', 'REGION', 'SUBREGION', 'LON', 'LAT']) eq_(ds.field_types(),['str', 'str', 'str', 'int', 'str', 'int', 'int', 'int', 'int', 'float', 'float']) query = mapnik.Query(ds.envelope()) for fld in ds.fields(): query.add_property_name(fld) # also add an invalid one, triggering throw query.add_property_name('bogus') ds.features(query) # disabled because OGR prints an annoying error: ERROR 1: Invalid Point object. Missing 'coordinates' member. #def <API key>(): # ds = mapnik.Ogr(file='../data/json/null_feature.geojson',layer_by_index=0) # fs = ds.all_features() # eq_(len(fs),1) # OGR plugin extent parameter def <API key>(): ds = mapnik.Ogr(file='../data/shp/world_merc.shp',layer_by_index=0,extent='-1,-1,1,1') e = ds.envelope() eq_(e.minx,-1) eq_(e.miny,-1) eq_(e.maxx,1) eq_(e.maxy,1) def <API key>(): ds = mapnik.Ogr(file='../data/gpx/empty.gpx',layer='waypoints') e = ds.envelope() eq_(e.minx,-122) eq_(e.miny,48) eq_(e.maxx,-122) eq_(e.maxy,48) def <API key>(): <API key> = mapnik.logger.get_severity() mapnik.logger.set_severity(mapnik.severity_type.None) # use logger to silence expected warnings for layer in ['routes', 'tracks', 'route_points', 'track_points']: ds = mapnik.Ogr(file='../data/gpx/empty.gpx',layer=layer) e = ds.envelope() eq_(e.minx,0) eq_(e.miny,0) eq_(e.maxx,0) eq_(e.maxy,0) mapnik.logger.set_severity(<API key>) # disabled because OGR prints an annoying error: ERROR 1: Invalid Point object. Missing 'coordinates' member. #def <API key>(): # ds = mapnik.Ogr(file='../data/json/null_feature.geojson',layer_by_index=0) # fs = ds.all_features() # eq_(len(fs),1) if __name__ == "__main__": setup() exit(run_all(eval(x) for x in dir() if x.startswith("test_")))
#!/usr/bin/env perl use utf8; use strict; use warnings; use Encode 'decode_utf8'; use lib 'lib'; use Postcodify; die "Usage: $0 <query>" unless @ARGV; binmode STDOUT, ':utf8'; binmode STDERR, ':utf8'; my $p = Postcodify->new; my $result = $p->search( decode_utf8( join( ' ', @ARGV ) ) ); my $json = decode_utf8( $result->json ); print length $json > 200 ? substr( $json, 0, 200 ) . '...' : $json, "\n";
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> <TS version="2.0" language="el" sourcelanguage="en"> <context> <name>CmdCreateImagePlane</name> <message> <location filename="../../Command.cpp" line="+93"/> <source>Image</source> <translation>Εικόνα</translation> </message> <message> <location line="+1"/> <source>Create image plane...</source> <translation>Δημιουργία επιπέδου εικόνας...</translation> </message> <message> <location line="+1"/> <source>Create a planar image in the 3D space</source> <translation type="unfinished">Create a planar image in the 3D space</translation> </message> <message> <source>create a planar image in the 3D space</source> <translation type="obsolete">create a planar image in the 3D space</translation> </message> </context> <context> <name>CmdImageOpen</name> <message> <location line="-44"/> <source>Image</source> <translation>Εικόνα</translation> </message> <message> <location line="+1"/> <source>Open...</source> <translation>Άνοιγμα...</translation> </message> <message> <location line="+1"/> <source>Open image view</source> <translation type="unfinished">Open image view</translation> </message> </context> <context> <name>ImageGui::GLImageBox</name> <message> <location filename="../../GLImageBox.cpp" line="+327"/> <source>Undefined type of colour space for image viewing</source> <translation>Μη ορισμός χρωματικού περιβάλλοντος για την προβολή της εικόνας</translation> </message> <message> <location line="-1"/> <source>Image pixel format</source> <translation type="unfinished">Image pixel format</translation> </message> </context> <context> <name>ImageGui::<API key></name> <message> <location filename="../../<API key>.ui" line="+14"/> <source>Choose orientation</source> <translation type="unfinished">Choose orientation</translation> </message> <message> <location line="+6"/> <source>Image plane</source> <translation type="unfinished">Image plane</translation> </message> <message> <location line="+6"/> <source>XY-Plane</source> <translation type="unfinished">XY-Plane</translation> </message> <message> <location line="+10"/> <source>XZ-Plane</source> <translation type="unfinished">XZ-Plane</translation> </message> <message> <location line="+7"/> <source>YZ-Plane</source> <translation type="unfinished">YZ-Plane</translation> </message> <message> <location line="+29"/> <source>Reverse direction</source> <translation type="unfinished">Reverse direction</translation> </message> <message> <location line="+9"/> <source>Offset:</source> <translation type="unfinished">Offset:</translation> </message> </context> <context> <name>ImageGui::ImageView</name> <message> <location filename="../../ImageView.cpp" line="+77"/> <source>&amp;Fit image</source> <translation type="unfinished">&amp;Fit image</translation> </message> <message> <location line="+2"/> <source>Stretch the image to fit the view</source> <translation type="unfinished">Stretch the image to fit the view</translation> </message> <message> <location line="+4"/> <source>&amp;1:1 scale</source> <translation type="unfinished">&amp;1:1 scale</translation> </message> <message> <location line="+2"/> <source>Display the image at a 1:1 scale</source> <translation type="unfinished">Display the image at a 1:1 scale</translation> </message> <message> <source>&amp;Original color</source> <translation type="obsolete">&amp;Original color</translation> </message> <message> <source>Display the image with its original color(s)</source> <translation type="obsolete">Display the image with its original color(s)</translation> </message> <message> <source>&amp;Brightened color</source> <translation type="obsolete">&amp;Brightened color</translation> </message> <message> <source>Display the image with brightened color(s)</source> <translation type="obsolete">Display the image with brightened color(s)</translation> </message> <message> <location line="+9"/> <source>Standard</source> <translation>Κανονικό</translation> </message> <message> <location line="+18"/> <source>Ready...</source> <translation>Έτοιμο...</translation> </message> <message> <location line="+390"/> <source>grey</source> <translation>γκρι</translation> </message> <message> <location line="+1"/> <location line="+3"/> <location line="+10"/> <location line="+5"/> <location line="+10"/> <location line="+5"/> <location line="+11"/> <location line="+5"/> <location line="+11"/> <location line="+5"/> <source>zoom</source> <translation type="unfinished">zoom</translation> </message> <message> <location line="-62"/> <location line="+10"/> <location line="+15"/> <location line="+16"/> <location line="+16"/> <source>outside image</source> <translation type="unfinished">outside image</translation> </message> </context> <context> <name>QObject</name> <message> <source>Image viewer</source> <translation type="obsolete">Image viewer</translation> </message> <message> <source>Images (*.png *.xpm *.jpg *.bmp)</source> <translation type="obsolete">Images (*.png *.xpm *.jpg *.bmp)</translation> </message> <message> <location filename="../../Command.cpp" line="+18"/> <location line="+41"/> <source>Choose an image file to open</source> <translation>Επιλέξτε ένα αρχείο εικόνας για άνοιγμα</translation> </message> <message> <location line="-48"/> <location line="+41"/> <source>Images</source> <translation>Εικόνες</translation> </message> <message> <location line="-36"/> <location line="+41"/> <source>All files</source> <translation>Όλα τα αρχεία</translation> </message> <message> <location line="+8"/> <source>Error open image</source> <translation>Σφάλμα ανοίγματος εικόνας</translation> </message> <message> <location line="+1"/> <source>Could not load the choosen image</source> <translation>Δεν ήταν δυνατή η φόρτωση της επιλεγμένης εικόνας</translation> </message> </context> <context> <name>Workbench</name> <message> <location filename="../../Workbench.cpp" line="+36"/> <source>Image</source> <translation>Εικόνα</translation> </message> </context> </TS>
#include "l2d2_roxml-internal.h" /* #define DEBUG_PARSING */ roxml_parser_item_t *<API key>(roxml_parser_item_t *head, char * key, roxml_parse_func func) { roxml_parser_item_t *item = head; if(head == NULL) { item = (roxml_parser_item_t*)calloc(1, sizeof(roxml_parser_item_t)); head = item; } else { item = head; while(item->next) item = item->next; item->next = (roxml_parser_item_t*)calloc(1, sizeof(roxml_parser_item_t)); item = item->next; } item->chunk = key?key[0]:0; item->func = func; return head; } void roxml_parser_free(roxml_parser_item_t *head) { free(head); } void roxml_parser_clear(roxml_parser_item_t *head) { roxml_parser_item_t *item = head; while(item) { roxml_parser_item_t * to_delete = item; item = item->next; free(to_delete); } return; } roxml_parser_item_t * <API key>(roxml_parser_item_t *head) { roxml_parser_item_t *item = head; roxml_parser_item_t *table = NULL; int count = 0; head->count = 0; head->def_count = 0; while(item) { if(item->chunk != 0) { head->count++; } head->def_count++; item = item->next; } table = (roxml_parser_item_t*)malloc(sizeof(roxml_parser_item_t)*(head->def_count)); item = head; while(item) { memcpy(&table[count], item, sizeof(roxml_parser_item_t)); item = item->next; count++; } roxml_parser_clear(head); return table; } int roxml_parse_line(roxml_parser_item_t * head, char *line, int len, void * ctx) { int count = head->count; int def_count = head->def_count; char * line_end = line; char * chunk = line; if(len > 0) { line_end = line + len; } else { line_end = line + strlen(line); } while(chunk < line_end) { int i = 0; for(; i < count; i++) { if(chunk[0] == head[i].chunk) { int ret = head[i].func(chunk, ctx); if(ret > 0) { chunk += ret; break; } else if(ret < 0) { return -1; } } } for(; i >= count && i < def_count; i++) { int ret = head[i].func(chunk, ctx); if(ret > 0) { chunk += ret; break; } else if(ret < 0) { return -1; } } } return (chunk-line); } int _func_xpath_ignore(char * chunk, void * data) { #ifdef DEBUG_PARSING fprintf(stderr, "calling func %s chunk %c\n",__func__,chunk[0]); #endif /* DEBUG_PARSING */ return 1; } int <API key>(char * chunk, void * data) { int cur = 0; roxml_xpath_ctx_t *ctx = (roxml_xpath_ctx_t*)data; #ifdef DEBUG_PARSING fprintf(stderr, "calling func %s chunk %c\n",__func__,chunk[0]); #endif /* DEBUG_PARSING */ if(!ctx->quoted && !ctx->dquoted && !ctx->parenthesys && !ctx->bracket) { int offset = 0; xpath_node_t * tmp_node = (xpath_node_t*)calloc(1, sizeof(xpath_node_t)); if((chunk[cur] == '/')&&(ctx->is_first_node)) { free(tmp_node); ctx->new_node = ctx->first_node; ctx->first_node->abs = 1; } else if((chunk[cur] == '/')&&(ctx->wait_first_node)) { free(tmp_node); ctx->first_node->abs = 1; } else if((ctx->is_first_node)||(ctx->wait_first_node)) { free(tmp_node); } else { if(ctx->new_node) { ctx->new_node->next = tmp_node; } ctx->new_node = tmp_node; } ctx->is_first_node = 0; ctx->wait_first_node = 0; ctx->new_node = roxml_set_axes(ctx->new_node, chunk+cur, &offset); cur = offset + 1; } ctx->shorten_cond = 0; return cur; } int _func_xpath_quote(char * chunk, void * data) { roxml_xpath_ctx_t *ctx = (roxml_xpath_ctx_t*)data; #ifdef DEBUG_PARSING fprintf(stderr, "calling func %s chunk %c\n",__func__,chunk[0]); #endif /* DEBUG_PARSING */ if(!ctx->dquoted) { if(ctx->quoted && ctx->content_quoted == MODE_COMMENT_QUOTE) { ctx->content_quoted = MODE_COMMENT_NONE; chunk[0] = '\0'; } ctx->quoted = (ctx->quoted+1)%2; } ctx->shorten_cond = 0; return 1; } int _func_xpath_dquote(char * chunk, void * data) { roxml_xpath_ctx_t *ctx = (roxml_xpath_ctx_t*)data; #ifdef DEBUG_PARSING fprintf(stderr, "calling func %s chunk %c\n",__func__,chunk[0]); #endif /* DEBUG_PARSING */ if(!ctx->quoted) { if(ctx->dquoted && ctx->content_quoted == MODE_COMMENT_DQUOTE) { ctx->content_quoted = MODE_COMMENT_NONE; chunk[0] = '\0'; } ctx->dquoted = (ctx->dquoted+1)%2; } ctx->shorten_cond = 0; return 1; } int <API key>(char * chunk, void * data) { roxml_xpath_ctx_t *ctx = (roxml_xpath_ctx_t*)data; #ifdef DEBUG_PARSING fprintf(stderr, "calling func %s chunk %c\n",__func__,chunk[0]); #endif /* DEBUG_PARSING */ if(!ctx->quoted && !ctx->dquoted) { ctx->parenthesys = (ctx->parenthesys+1)%2; } ctx->shorten_cond = 0; return 1; } int <API key>(char * chunk, void * data) { roxml_xpath_ctx_t *ctx = (roxml_xpath_ctx_t*)data; #ifdef DEBUG_PARSING fprintf(stderr, "calling func %s chunk %c\n",__func__,chunk[0]); #endif /* DEBUG_PARSING */ if(!ctx->quoted && !ctx->dquoted) { ctx->parenthesys = (ctx->parenthesys+1)%2; } ctx->shorten_cond = 0; return 1; } int <API key>(char * chunk, void * data) { xpath_cond_t * tmp_cond; int cur = 0; #ifdef DEBUG_PARSING fprintf(stderr, "calling func %s chunk %c\n",__func__,chunk[0]); #endif /* DEBUG_PARSING */ roxml_xpath_ctx_t *ctx = (roxml_xpath_ctx_t*)data; if(!ctx->quoted && !ctx->dquoted) { ctx->bracket = (ctx->bracket+1)%2; chunk[0] = '\0'; ctx->shorten_cond = 1; tmp_cond = (xpath_cond_t*)calloc(1, sizeof(xpath_cond_t)); ctx->new_node->cond = tmp_cond; ctx->new_cond = tmp_cond; ctx->new_cond->arg1 = chunk+cur+1; } else { ctx->shorten_cond = 0; } cur++; return 1; } int <API key>(char * chunk, void * data) { int cur = 0; roxml_xpath_ctx_t *ctx = (roxml_xpath_ctx_t*)data; #ifdef DEBUG_PARSING fprintf(stderr, "calling func %s chunk %c\n",__func__,chunk[0]); #endif /* DEBUG_PARSING */ if(!ctx->quoted && !ctx->dquoted) { ctx->bracket = (ctx->bracket+1)%2; chunk[0] = '\0'; if(ctx->new_cond) { if(ctx->new_cond->func == ROXML_FUNC_XPATH) { xpath_node_t *xp; ctx->new_cond->func2 = roxml_parse_xpath(ctx->new_cond->arg1, &xp, 1); ctx->new_cond->xp = xp; } } else { return -1; } } cur++; ctx->shorten_cond = 0; return 1; } int <API key>(char * chunk, void * data) { xpath_node_t * tmp_node; roxml_xpath_ctx_t *ctx = (roxml_xpath_ctx_t*)data; int cur = 0; int len = 0; xpath_cond_t * tmp_cond; #ifdef DEBUG_PARSING fprintf(stderr, "calling func %s chunk %c\n",__func__,chunk[0]); #endif /* DEBUG_PARSING */ len = strlen(ROXML_COND_OR); if(strncmp(chunk, ROXML_COND_OR, len) == 0) { if(roxml_is_separator(*(chunk-1)) && roxml_is_separator(*(chunk+len))) { if(!ctx->bracket && !ctx->quoted && !ctx->dquoted) { if(ctx->context != 1) { return 0; } chunk[-1] = '\0'; cur += strlen(ROXML_COND_OR); tmp_node = (xpath_node_t*)calloc(ctx->nbpath+1, sizeof(xpath_node_t)); memcpy(tmp_node, ctx->first_node, ctx->nbpath*sizeof(xpath_node_t)); free(ctx->first_node); ctx->first_node = tmp_node; ctx->wait_first_node = 1; ctx->new_node = tmp_node+ctx->nbpath; ctx->new_node->rel = ROXML_OPERATOR_OR; ctx->nbpath++; } else if(ctx->bracket && !ctx->quoted && !ctx->dquoted) { if(ctx->new_cond->func != ROXML_FUNC_XPATH) { chunk[-1] = '\0'; cur += strlen(ROXML_COND_OR); tmp_cond = (xpath_cond_t*)calloc(1, sizeof(xpath_cond_t)); if(ctx->new_cond) { ctx->new_cond->next = tmp_cond; } ctx->new_cond = tmp_cond; ctx->new_cond->rel = ROXML_OPERATOR_OR; ctx->new_cond->arg1 = chunk+cur+1; } } } } if (cur) ctx->shorten_cond = 0; return cur; } int <API key>(char * chunk, void * data) { roxml_xpath_ctx_t *ctx = (roxml_xpath_ctx_t*)data; int cur = 0; int len = 0; xpath_node_t * tmp_node; xpath_cond_t * tmp_cond; #ifdef DEBUG_PARSING fprintf(stderr, "calling func %s chunk %c\n",__func__,chunk[0]); #endif /* DEBUG_PARSING */ len = strlen(ROXML_COND_AND); if(strncmp(chunk, ROXML_COND_AND, len) == 0) { if(roxml_is_separator(*(chunk-1)) && roxml_is_separator(*(chunk+len))) { if(!ctx->bracket && !ctx->quoted && !ctx->dquoted) { if(ctx->context != 1) { return 0; } chunk[-1] = '\0'; cur += strlen(ROXML_COND_AND); tmp_node = (xpath_node_t*)calloc(ctx->nbpath+1, sizeof(xpath_node_t)); memcpy(tmp_node, ctx->first_node, ctx->nbpath*sizeof(xpath_node_t)); free(ctx->first_node); ctx->first_node = tmp_node; ctx->wait_first_node = 1; ctx->new_node = tmp_node+ctx->nbpath; ctx->new_node->rel = ROXML_OPERATOR_AND; ctx->nbpath++; } else if(ctx->bracket && !ctx->quoted && !ctx->dquoted) { if(ctx->new_cond->func != ROXML_FUNC_XPATH) { chunk[-1] = '\0'; cur += strlen(ROXML_COND_AND); tmp_cond = (xpath_cond_t*)calloc(1, sizeof(xpath_cond_t)); if(ctx->new_cond) { ctx->new_cond->next = tmp_cond; } ctx->new_cond = tmp_cond; ctx->new_cond->rel = ROXML_OPERATOR_AND; ctx->new_cond->arg1 = chunk+cur+1; } } } } if (cur) ctx->shorten_cond = 0; return cur; } int _func_xpath_path_or(char * chunk, void * data) { roxml_xpath_ctx_t *ctx = (roxml_xpath_ctx_t*)data; int cur = 0; xpath_node_t * tmp_node; #ifdef DEBUG_PARSING fprintf(stderr, "calling func %s chunk %c\n",__func__,chunk[0]); #endif /* DEBUG_PARSING */ if(!ctx->bracket && !ctx->quoted && !ctx->dquoted) { chunk[-1] = '\0'; cur += strlen(ROXML_PATH_OR); tmp_node = (xpath_node_t*)calloc(ctx->nbpath+1, sizeof(xpath_node_t)); memcpy(tmp_node, ctx->first_node, ctx->nbpath*sizeof(xpath_node_t)); free(ctx->first_node); ctx->first_node = tmp_node; ctx->wait_first_node = 1; ctx->new_node = tmp_node+ctx->nbpath; ctx->new_node->rel = ROXML_OPERATOR_OR; ctx->nbpath++; } ctx->shorten_cond = 0; return cur; } static int <API key>(char * chunk, void * data, int operator, int operator_bis) { roxml_xpath_ctx_t *ctx = (roxml_xpath_ctx_t*)data; int cur = 0; if(!ctx->bracket && !ctx->quoted && !ctx->dquoted) { xpath_node_t *xp_root = ctx->new_node; xpath_cond_t * xp_cond = (xpath_cond_t*)calloc(1, sizeof(xpath_cond_t)); xp_root->xp_cond = xp_cond; chunk[cur] = '\0'; xp_cond->op = operator; if(ROXML_WHITE(chunk[cur-1])) { chunk[cur-1] = '\0'; } if(chunk[cur+1] == '=') { cur++; chunk[cur] = '\0'; xp_cond->op = operator_bis; } if(ROXML_WHITE(chunk[cur+1])) { cur++; chunk[cur] = '\0'; } xp_cond->arg2 = chunk+cur+1; if(xp_cond->arg2[0] == '"') { ctx->content_quoted = MODE_COMMENT_DQUOTE; xp_cond->arg2++; } else if(xp_cond->arg2[0] == '\'') { ctx->content_quoted = MODE_COMMENT_QUOTE; xp_cond->arg2++; } if(!xp_cond->func) { xp_cond->func = ROXML_FUNC_INTCOMP; if(!roxml_is_number(xp_cond->arg2)) { xp_cond->func = ROXML_FUNC_STRCOMP; } } cur++; } else if(ctx->bracket && !ctx->quoted && !ctx->dquoted) { if(ctx->new_cond->func != ROXML_FUNC_XPATH) { chunk[cur] = '\0'; ctx->new_cond->op = operator; if(ROXML_WHITE(chunk[cur-1])) { chunk[cur-1] = '\0'; } if(chunk[cur+1] == '=') { cur++; chunk[cur] = '\0'; ctx->new_cond->op = operator_bis; } if(ROXML_WHITE(chunk[cur+1])) { cur++; chunk[cur] = '\0'; } ctx->new_cond->arg2 = chunk+cur+1; if(ctx->new_cond->arg2[0] == '"') { ctx->content_quoted = MODE_COMMENT_DQUOTE; ctx->new_cond->arg2++; } else if(ctx->new_cond->arg2[0] == '\'') { ctx->content_quoted = MODE_COMMENT_QUOTE; ctx->new_cond->arg2++; } if(ctx->new_cond->func == 0) { ctx->new_cond->func = ROXML_FUNC_INTCOMP; if(!roxml_is_number(ctx->new_cond->arg2)) { ctx->new_cond->func = ROXML_FUNC_STRCOMP; } } cur++; } } return cur; ctx->shorten_cond = 0; } int <API key>(char * chunk, void * data) { #ifdef DEBUG_PARSING fprintf(stderr, "calling func %s chunk %c\n",__func__,chunk[0]); #endif /* DEBUG_PARSING */ return <API key>(chunk, data, ROXML_OPERATOR_EQU, ROXML_OPERATOR_EQU); } int <API key>(char * chunk, void * data) { #ifdef DEBUG_PARSING fprintf(stderr, "calling func %s chunk %c\n",__func__,chunk[0]); #endif /* DEBUG_PARSING */ return <API key>(chunk, data, ROXML_OPERATOR_SUP, ROXML_OPERATOR_ESUP); } int <API key>(char * chunk, void * data) { #ifdef DEBUG_PARSING fprintf(stderr, "calling func %s chunk %c\n",__func__,chunk[0]); #endif /* DEBUG_PARSING */ return <API key>(chunk, data, ROXML_OPERATOR_INF, ROXML_OPERATOR_EINF); } int <API key>(char * chunk, void * data) { #ifdef DEBUG_PARSING fprintf(stderr, "calling func %s chunk %c\n",__func__,chunk[0]); #endif /* DEBUG_PARSING */ return <API key>(chunk, data, ROXML_OPERATOR_DIFF, ROXML_OPERATOR_DIFF); } int _func_xpath_number(char * chunk, void * data) { #ifdef DEBUG_PARSING fprintf(stderr, "calling func %s chunk %c\n",__func__,chunk[0]); #endif /* DEBUG_PARSING */ roxml_xpath_ctx_t *ctx = (roxml_xpath_ctx_t*)data; int cur = 0; if(ctx->bracket && !ctx->quoted && !ctx->dquoted) { if((ctx->new_cond->func != ROXML_FUNC_XPATH) && (ctx->shorten_cond)){ cur = 1; ctx->new_cond->func = ROXML_FUNC_POS; ctx->new_cond->op = ROXML_OPERATOR_EQU; ctx->new_cond->arg2 = chunk; while((chunk[cur+1] >= '0') && (chunk[cur+1] <= '9')) { cur++; } } } ctx->shorten_cond = 0; return cur; } static int _func_xpath_funcs(char * chunk, void * data, int func, char * name) { #ifdef DEBUG_PARSING fprintf(stderr, "calling func %s chunk %c\n",__func__,chunk[0]); #endif /* DEBUG_PARSING */ roxml_xpath_ctx_t *ctx = (roxml_xpath_ctx_t*)data; int cur = 0; if(strncmp(chunk, name, strlen(name)) == 0) { if(ctx->new_cond->func != func) { cur += strlen(name); ctx->new_cond->func = func; } } if (cur) ctx->shorten_cond = 0; return cur; } int <API key>(char * chunk, void * data) { #ifdef DEBUG_PARSING fprintf(stderr, "calling func %s chunk %c\n",__func__,chunk[0]); #endif /* DEBUG_PARSING */ return _func_xpath_funcs(chunk, data, ROXML_FUNC_POS, ROXML_FUNC_POS_STR); } int _func_xpath_first(char * chunk, void * data) { #ifdef DEBUG_PARSING fprintf(stderr, "calling func %s chunk %c\n",__func__,chunk[0]); #endif /* DEBUG_PARSING */ return _func_xpath_funcs(chunk, data, ROXML_FUNC_FIRST, <API key>); } int _func_xpath_last(char * chunk, void * data) { #ifdef DEBUG_PARSING fprintf(stderr, "calling func %s chunk %c\n",__func__,chunk[0]); #endif /* DEBUG_PARSING */ return _func_xpath_funcs(chunk, data, ROXML_FUNC_LAST, ROXML_FUNC_LAST_STR); } int _func_xpath_nsuri(char * chunk, void * data) { #ifdef DEBUG_PARSING fprintf(stderr, "calling func %s chunk %c\n",__func__,chunk[0]); #endif /* DEBUG_PARSING */ return _func_xpath_funcs(chunk, data, ROXML_FUNC_NSURI, <API key>); } int <API key>(char * chunk, void * data) { #ifdef DEBUG_PARSING fprintf(stderr, "calling func %s chunk %c\n",__func__,chunk[0]); #endif /* DEBUG_PARSING */ roxml_xpath_ctx_t *ctx = (roxml_xpath_ctx_t*)data; int cur = 0; if(ctx->bracket && !ctx->quoted && !ctx->dquoted) { if(ctx->new_cond->func != ROXML_FUNC_XPATH) { if((ctx->new_cond->func == ROXML_FUNC_LAST)||(ctx->new_cond->func == ROXML_FUNC_FIRST)) { ctx->new_cond->op = ROXML_OPERATOR_ADD; } chunk[cur] = '\0'; if(ROXML_WHITE(chunk[cur+1])) { cur++; chunk[cur] = '\0'; } ctx->new_cond->arg2 = chunk+cur+1; } } ctx->shorten_cond = 0; return cur; } int <API key>(char * chunk, void * data) { #ifdef DEBUG_PARSING fprintf(stderr, "calling func %s chunk %c\n",__func__,chunk[0]); #endif /* DEBUG_PARSING */ roxml_xpath_ctx_t *ctx = (roxml_xpath_ctx_t*)data; int cur = 0; if(ctx->bracket && !ctx->quoted && !ctx->dquoted) { if(ctx->new_cond->func != ROXML_FUNC_XPATH) { if((ctx->new_cond->func == ROXML_FUNC_LAST)||(ctx->new_cond->func == ROXML_FUNC_FIRST)) { ctx->new_cond->op = ROXML_OPERATOR_SUB; } chunk[cur] = '\0'; if(ROXML_WHITE(chunk[cur+1])) { cur++; chunk[cur] = '\0'; } ctx->new_cond->arg2 = chunk+cur+1; } } ctx->shorten_cond = 0; return cur; } int _func_xpath_default(char * chunk, void * data) { #ifdef DEBUG_PARSING fprintf(stderr, "calling func %s chunk %c\n",__func__,chunk[0]); #endif /* DEBUG_PARSING */ int cur = 0; roxml_xpath_ctx_t *ctx = (roxml_xpath_ctx_t*)data; if((ctx->is_first_node)||(ctx->wait_first_node)) { if(!ctx->quoted && !ctx->dquoted && !ctx->parenthesys && !ctx->bracket) { int offset = 0; xpath_node_t * tmp_node = (xpath_node_t*)calloc(1, sizeof(xpath_node_t)); if((chunk[cur] == '/')&&(ctx->is_first_node)) { free(tmp_node); ctx->new_node = ctx->first_node; ctx->first_node->abs = 1; } else if((chunk[cur] == '/')&&(ctx->wait_first_node)) { free(tmp_node); ctx->first_node->abs = 1; } else if((ctx->is_first_node)||(ctx->wait_first_node)) { free(tmp_node); } else { if(ctx->new_node) { ctx->new_node->next = tmp_node; } ctx->new_node = tmp_node; } ctx->is_first_node = 0; ctx->wait_first_node = 0; ctx->new_node = roxml_set_axes(ctx->new_node, chunk+cur, &offset); cur += offset; } } else if(ctx->bracket && !ctx->quoted && !ctx->dquoted) { if(ctx->new_cond->func != ROXML_FUNC_XPATH) { if(ctx->shorten_cond) { int bracket_lvl = 1; ctx->new_cond->func = ROXML_FUNC_XPATH; ctx->new_cond->arg1 = chunk+cur; while(bracket_lvl > 0) { if(chunk[cur] == '[') { bracket_lvl++; } else if(chunk[cur] == ']') { bracket_lvl cur++; } cur } } } ctx->shorten_cond = 0; return cur>0?cur:1; } int _func_load_quoted(char * chunk, void * data) { #ifdef DEBUG_PARSING fprintf(stderr, "calling func %s chunk %c\n",__func__,chunk[0]); #endif /* DEBUG_PARSING */ roxml_load_ctx_t *context = (roxml_load_ctx_t*)data; if(context->state != STATE_NODE_CONTENT && context->state != STATE_NODE_COMMENT) { if(context->mode == MODE_COMMENT_NONE) { context->mode = MODE_COMMENT_QUOTE; } else if(context->mode == MODE_COMMENT_QUOTE) { context->mode = MODE_COMMENT_NONE; } } return 0; } int _func_load_dquoted(char * chunk, void * data) { #ifdef DEBUG_PARSING fprintf(stderr, "calling func %s chunk %c\n",__func__,chunk[0]); #endif /* DEBUG_PARSING */ roxml_load_ctx_t *context = (roxml_load_ctx_t*)data; if(context->state != STATE_NODE_CONTENT && context->state != STATE_NODE_COMMENT) { if(context->mode == MODE_COMMENT_NONE) { context->mode = MODE_COMMENT_DQUOTE; } else if(context->mode == MODE_COMMENT_DQUOTE) { context->mode = MODE_COMMENT_NONE; } } return 0; } int <API key>(char * chunk, void * data) { #ifdef DEBUG_PARSING fprintf(stderr, "calling func %s chunk %c\n",__func__,chunk[0]); #endif /* DEBUG_PARSING */ int cur = 1; roxml_load_ctx_t *context = (roxml_load_ctx_t*)data; switch(context->state) { case STATE_NODE_CDATA: case STATE_NODE_COMMENT: break; default: context->state = STATE_NODE_BEG; context->previous_state = STATE_NODE_BEG; break; } context->pos += cur; return cur; } int <API key>(char * chunk, void * data) { #ifdef DEBUG_PARSING fprintf(stderr, "calling func %s chunk %c\n",__func__,chunk[0]); #endif /* DEBUG_PARSING */ int cur = 1; roxml_load_ctx_t *context = (roxml_load_ctx_t*)data; switch(context->state) { case STATE_NODE_NAME: context->empty_text_node = 1; context->current_node = roxml_append_node(context->current_node, context->candidat_node); break; case STATE_NODE_ATTR: if((context->mode != MODE_COMMENT_DQUOTE)||(context->mode != MODE_COMMENT_QUOTE)) { if(context->inside_node_state == STATE_INSIDE_VAL) { node_t * to_be_closed = NULL; if(context->content_quoted) { context->content_quoted = 0; to_be_closed = roxml_create_node(context->pos-1, context->src, ROXML_ATTR_NODE | context->type); } else { to_be_closed = roxml_create_node(context->pos, context->src, ROXML_ATTR_NODE | context->type); } roxml_close_node(context->candidat_val, to_be_closed); } context->current_node = roxml_append_node(context->current_node, context->candidat_node); context->inside_node_state = <API key>; <API key>(context); } else { context->pos++; return 1; } break; case STATE_NODE_SINGLE: if(context->doctype) { context->doctype if(context->doctype > 0) { context->pos++; return 1; } context->candidat_node->end = context->pos; } context->empty_text_node = 1; context->current_node = roxml_append_node(context->current_node, context->candidat_node); if(context->current_node->prnt != NULL) { context->current_node = context->current_node->prnt; } <API key>(context); break; case STATE_NODE_END: context->empty_text_node = 1; roxml_close_node(context->current_node, context->candidat_node); context->candidat_node = NULL; if(context->current_node->prnt != NULL) { context->current_node = context->current_node->prnt; } break; case STATE_NODE_CDATA: case STATE_NODE_CONTENT: default: context->pos++; return 1; break; } if(context->candidat_node && context->candidat_node->ns && ((context->candidat_node->ns->type & ROXML_INVALID) == ROXML_INVALID)) { roxml_free_node(context->candidat_node->ns); } context->state = STATE_NODE_CONTENT; context->previous_state = STATE_NODE_CONTENT; context->candidat_txt = roxml_create_node(context->pos+1, context->src, ROXML_TXT_NODE | context->type); #ifdef <API key> while(chunk[cur] != '\0') { if(chunk[cur] == '<') { break; } else if(!ROXML_WHITE(chunk[cur])) { context->empty_text_node = 0; break; } cur++; } #endif /* <API key> */ while((chunk[cur] != '<')&&(chunk[cur] != '\0')) { cur++; } context->pos += cur; return cur; } int <API key>(char * chunk, void * data) { #ifdef DEBUG_PARSING fprintf(stderr, "calling func %s chunk %c\n",__func__,chunk[0]); #endif /* DEBUG_PARSING */ int cur = 1; roxml_load_ctx_t *context = (roxml_load_ctx_t*)data; if(context->state == STATE_NODE_BEG) { if(strncmp(chunk, "! cur = 3; <API key>(context, context->pos-1); roxml_set_type(context->candidat_node, ROXML_CMT_NODE); context->state = STATE_NODE_COMMENT; while((chunk[cur] != '-')&&(chunk[cur] != '\0')) { cur++; } } else if(strncmp(chunk, "![CDATA[", 8)==0) { <API key>(context, context->pos-1); roxml_set_type(context->candidat_node, ROXML_CDATA_NODE); context->state = STATE_NODE_CDATA; while((chunk[cur] != '[')&&(chunk[cur] != '\0')) { cur++; } } else { if(context->doctype == 0) { <API key>(context, context->pos-1); roxml_set_type(context->candidat_node, ROXML_DOCTYPE_NODE); } context->state = STATE_NODE_SINGLE; context->previous_state = STATE_NODE_SINGLE; context->doctype++; } } context->pos += cur; return cur; } int <API key>(char * chunk, void * data) { #ifdef DEBUG_PARSING fprintf(stderr, "calling func %s chunk %c\n",__func__,chunk[0]); #endif /* DEBUG_PARSING */ int cur = 1; roxml_load_ctx_t *context = (roxml_load_ctx_t*)data; if(context->state == STATE_NODE_COMMENT) { if(chunk[1] == '-') { cur = 2; context->state = STATE_NODE_SINGLE; context->candidat_node->end = context->pos; } } context->pos += cur; return cur; } int <API key>(char * chunk, void * data) { #ifdef DEBUG_PARSING fprintf(stderr, "calling func %s chunk %c\n",__func__,chunk[0]); #endif /* DEBUG_PARSING */ int cur = 1; roxml_load_ctx_t *context = (roxml_load_ctx_t*)data; if(context->state == STATE_NODE_CDATA) { if(chunk[1] == ']') { cur = 2; context->state = STATE_NODE_SINGLE; context->candidat_node->pos += 9; context->candidat_node->end = context->pos; } } context->pos += cur; return cur; } int _func_load_close_pi(char * chunk, void * data) { #ifdef DEBUG_PARSING fprintf(stderr, "calling func %s chunk %c\n",__func__,chunk[0]); #endif /* DEBUG_PARSING */ int cur = 1; roxml_load_ctx_t *context = (roxml_load_ctx_t*)data; if(context->state == STATE_NODE_BEG) { cur = 1; context->state = STATE_NODE_PI; context->previous_state = STATE_NODE_PI; <API key>(context, context->pos-1); roxml_set_type(context->candidat_node, ROXML_PI_NODE); /* while((chunk[cur] != '?')&&(chunk[cur] != '\0')) { cur++; } */ } else if(context->state == STATE_NODE_PI) { if(context->mode == MODE_COMMENT_NONE) { cur = 1; context->candidat_node->end = context->pos; context->previous_state = STATE_NODE_PI; context->state = STATE_NODE_SINGLE; } } context->pos += cur; return cur; } int _func_load_end_node(char * chunk, void * data) { #ifdef DEBUG_PARSING fprintf(stderr, "calling func %s chunk %c\n",__func__,chunk[0]); #endif /* DEBUG_PARSING */ int cur = 1; roxml_load_ctx_t *context = (roxml_load_ctx_t*)data; switch(context->state) { case STATE_NODE_BEG: <API key>(context, context->pos-1); context->state = STATE_NODE_END; break; case STATE_NODE_NAME: context->state = STATE_NODE_SINGLE; break; case STATE_NODE_ATTR: if((context->mode != MODE_COMMENT_DQUOTE)&&(context->mode != MODE_COMMENT_QUOTE)) { if(context->inside_node_state == STATE_INSIDE_VAL) { node_t * to_be_closed = NULL; if(context->content_quoted) { context->content_quoted = 0; to_be_closed = roxml_create_node(context->pos-1, context->src, ROXML_ATTR_NODE | context->type); } else { to_be_closed = roxml_create_node(context->pos, context->src, ROXML_ATTR_NODE | context->type); } roxml_close_node(context->candidat_val, to_be_closed); } context->inside_node_state = <API key>; context->state = STATE_NODE_SINGLE; } break; } context->pos += cur; return cur; } int _func_load_white(char * chunk, void * data) { #ifdef DEBUG_PARSING fprintf(stderr, "calling func %s chunk %c\n",__func__,chunk[0]); #endif /* DEBUG_PARSING */ int cur = 1; roxml_load_ctx_t *context = (roxml_load_ctx_t*)data; switch(context->state) { case STATE_NODE_SINGLE: context->state = context->previous_state; break; case STATE_NODE_NAME: context->state = STATE_NODE_ATTR; context->inside_node_state = <API key>; break; case STATE_NODE_ATTR: if(context->mode == MODE_COMMENT_NONE) { if(context->inside_node_state == STATE_INSIDE_VAL) { node_t * to_be_closed = NULL; if(context->content_quoted) { context->content_quoted = 0; to_be_closed = roxml_create_node(context->pos-1, context->src, ROXML_ATTR_NODE | context->type); } else { to_be_closed = roxml_create_node(context->pos, context->src, ROXML_ATTR_NODE | context->type); } roxml_close_node(context->candidat_val, to_be_closed); context->inside_node_state = <API key>; <API key>(context); } } break; } context->pos += cur; return cur; } int _func_load_colon(char * chunk, void * data) { int cur = 1; roxml_load_ctx_t *context = (roxml_load_ctx_t*)data; #ifdef DEBUG_PARSING fprintf(stderr, "calling func %s chunk %c\n",__func__,chunk[0]); #endif /* DEBUG_PARSING */ if(context->state == STATE_NODE_NAME) { context->state = STATE_NODE_BEG; context->candidat_node->ns = roxml_lookup_nsdef(context->namespaces, context->curr_name); if(!context->candidat_node->ns) { char *nsname = malloc(context->curr_name_len+1); memcpy(nsname, context->curr_name, context->curr_name_len); nsname[context->curr_name_len] = '\0'; context->candidat_node->ns = roxml_create_node(0, nsname, ROXML_NSDEF_NODE | ROXML_PENDING | ROXML_INVALID); } context->candidat_node->pos += context->curr_name_len+2; context->ns = 1; } else if(context->state == STATE_NODE_ATTR) { if(context->inside_node_state == STATE_INSIDE_ARG) { context->inside_node_state = <API key>; if((context->curr_name_len==5)&&(strncmp(context->curr_name, "xmlns", 5) == 0)) { context->candidat_arg->type |= ROXML_NS_NODE; context->nsdef = 1; } else { context->candidat_arg->ns = roxml_lookup_nsdef(context->namespaces, context->curr_name); context->candidat_arg->pos += context->curr_name_len+2; context->ns = 1; } } } context->pos += cur; return cur; } int _func_load_default(char * chunk, void * data) { node_t * to_be_closed; int cur = 1; roxml_load_ctx_t *context = (roxml_load_ctx_t*)data; #ifdef DEBUG_PARSING fprintf(stderr, "calling func %s chunk %c\n",__func__,chunk[0]); #endif /* DEBUG_PARSING */ switch(context->state) { case STATE_NODE_SINGLE: context->state = context->previous_state; break; case STATE_NODE_BEG: if(context->ns == 0) { <API key>(context, context->pos-1); } context->ns = 0; context->state = STATE_NODE_NAME; context->curr_name = chunk; while(!ROXML_WHITE(chunk[cur])&&(chunk[cur] != '>')&&(chunk[cur] != '/')&&(chunk[cur] != ':')&&(chunk[cur] != '\0')) { cur++; } context->curr_name_len = cur; break; case STATE_NODE_ATTR: if(context->inside_node_state == <API key>) { if(context->nsdef) { if(context->namespaces == NULL) { context->namespaces = context->candidat_arg; context->last_ns = context->candidat_arg; } else { context->last_ns->next = context->candidat_arg; context->last_ns = context->candidat_arg; } } else if(context->ns == 0) { context->candidat_arg = roxml_create_node(context->pos-1, context->src, ROXML_ATTR_NODE | context->type); context->candidat_arg = roxml_append_node(context->candidat_node, context->candidat_arg); } context->ns = 0; context->inside_node_state = STATE_INSIDE_ARG; context->curr_name = chunk; while((chunk[cur] != '=')&&(chunk[cur] != '>')&&(chunk[cur] != ':')&&(chunk[cur] != '\0')) { cur++; } context->curr_name_len = cur; if(context->nsdef) { roxml_ns_t * ns = calloc(1, sizeof(roxml_ns_t)+(1+context->curr_name_len)); ns->id = ROXML_NS_ID; ns->alias = (char*)ns + sizeof(roxml_ns_t); memcpy(ns->alias, context->curr_name, context->curr_name_len); context->candidat_arg->priv = ns; context->nsdef = 0; if(context->candidat_node->ns) { if((context->candidat_node->ns->type & ROXML_INVALID) == ROXML_INVALID) { if(strcmp(context->candidat_arg->prnt->ns->src.buf, ns->alias) == 0) { roxml_free_node(context->candidat_node->ns); context->candidat_node->ns = context->candidat_arg; } } } } } else if(context->inside_node_state == <API key>) { if(context->mode != MODE_COMMENT_NONE) { context->content_quoted = 1; context->candidat_val = roxml_create_node(context->pos+1, context->src, ROXML_TXT_NODE | context->type); } else { context->candidat_val = roxml_create_node(context->pos, context->src, ROXML_TXT_NODE | context->type); } context->candidat_val = roxml_append_node(context->candidat_arg, context->candidat_val); context->inside_node_state = STATE_INSIDE_VAL; } else if((context->inside_node_state == STATE_INSIDE_ARG)&&(chunk[0] == '=')) { context->inside_node_state = <API key>; to_be_closed = roxml_create_node(context->pos, context->src, ROXML_ATTR_NODE | context->type); roxml_close_node(context->candidat_arg, to_be_closed); if((context->curr_name_len==5)&&(strncmp(context->curr_name, "xmlns", 5) == 0)) { context->nsdef = 1; } } break; } context->pos += cur; return cur; }
/** * @ingroup examples * @{ * * @file * @brief UDP RPL example application * * @author Oliver Hahm <oliver.hahm@inria.fr> * * @} */ #include <stdio.h> #include <string.h> #include "vtimer.h" #include "thread.h" #include "net_if.h" #include "sixlowpan.h" #include "udp.h" #include "rpl.h" #include "rpl/rpl_dodag.h" #include "rpl_udp.h" #include "transceiver.h" #define ENABLE_DEBUG (0) #include "debug.h" #ifndef UNASSIGNED_CHANNEL #define UNASSIGNED_CHANNEL INT_MIN #endif #define TRANSCEIVER TRANSCEIVER_DEFAULT static char <API key>[MONITOR_STACK_SIZE]; radio_address_t id; static uint8_t is_root = 0; int rpl_udp_init(int argc, char **argv) { <API key> tcmd; msg_t m; int32_t chan = UNASSIGNED_CHANNEL; if (argc != 2) { printf("Usage: %s (r|n|h)\n", argv[0]); printf("\tr\tinitialize as root\n"); printf("\tn\tinitialize as node router\n"); printf("\th\tinitialize as non-routing node (host-mode)\n"); return 1; } char command = argv[1][0]; if ((command == 'n') || (command == 'r') || (command == 'h')) { printf("INFO: Initialize as %srouting %s on address %d\n", ((command == 'h') ? "non-" : ""), (((command == 'n') || (command == 'h')) ? "node" : "root"), id); #if (defined(MODULE_CC110X) || defined(<API key>) || defined(<API key>)) if (!id || (id > 255)) { printf("ERROR: address not a valid 8 bit integer\n"); return 1; } #endif DEBUGF("Setting HW address to %u\n", id); <API key>(0, id); tcmd.transceivers = TRANSCEIVER; tcmd.data = &chan; m.type = GET_CHANNEL; m.content.ptr = (void *) &tcmd; msg_send_receive(&m, &m, transceiver_pid); if( chan == UNASSIGNED_CHANNEL ) { DEBUGF("The channel has not been set yet."); /* try to set the channel to 10 (RADIO_CHANNEL) */ chan = RADIO_CHANNEL; } m.type = SET_CHANNEL; msg_send_receive(&m, &m, transceiver_pid); if( chan == UNASSIGNED_CHANNEL ) { puts("ERROR: channel NOT set! Aborting initialization."); return 1; } printf("Channel set to %" PRIi32 "\n", chan); /* global address */ ipv6_addr_t global_addr, global_prefix; ipv6_addr_init(&global_prefix, 0xabcd, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0); <API key>(&global_addr, 0, &global_prefix); if (command != 'h') { DEBUGF("Initializing RPL for interface 0\n"); uint8_t state = SIXLOWERROR_VALUE; if (command == 'n') { /* * no global address specified, we'll use auto address config * initiated by the root node */ state = rpl_init(0, NULL); } else if (command == 'r') { rpl_options_t rpl_opts = { .instance_id = 0, .prefix = global_prefix, .prefix_len = 64, .prefix_flags = <API key>, /* autonomous <API key> */ }; /* use specific global address */ state = rpl_init(0, &global_addr); rpl_init_root(&rpl_opts); is_root = 1; } if (state != SIXLOWERROR_SUCCESS) { puts("Error initializing RPL"); } else { puts("6LoWPAN and RPL initialized."); } <API key>(rpl_get_next_hop); } else { puts("6LoWPAN initialized."); } DEBUGF("Start monitor\n"); kernel_pid_t monitor_pid = thread_create(<API key>, sizeof(<API key>), PRIORITY_MAIN - 2, CREATE_STACKTEST, rpl_udp_monitor, NULL, "monitor"); DEBUGF("Register at transceiver %02X\n", TRANSCEIVER); <API key>(TRANSCEIVER, monitor_pid); <API key>(monitor_pid); //<API key>(monitor_pid); } else { printf("ERROR: Unknown command '%c'\n", command); return 1; } if (command != 'h') { ipv6_init_as_router(); } puts("Transport layer initialized"); /* start transceiver watchdog */ return 0; } int rpl_udp_dodag(int argc, char **argv) { (void) argc; (void) argv; printf(" rpl_dodag_t *mydodag = rpl_get_my_dodag(); if (mydodag == NULL) { printf("Not part of a dodag\n"); printf(" return 1; } printf("Part of Dodag:\n"); printf("%s\n", ipv6_addr_to_str(addr_str, <API key>, (&mydodag->dodag_id))); printf("my rank: %d\n", mydodag->my_rank); if (!is_root) { printf("my preferred parent:\n"); printf("%s\n", ipv6_addr_to_str(addr_str, <API key>, (&mydodag->my_preferred_parent->addr))); } printf(" return 0; }
package dk.netarkivet.viewerproxy; import java.net.URI; import java.net.URISyntaxException; import java.util.Map; import junit.framework.TestCase; import dk.netarkivet.common.exceptions.<API key>; /** * Unit-tests for the CommandResolver class. */ public class <API key> extends TestCase { public <API key>(String s) { super(s); } public void setUp() { } public void tearDown() { } public void <API key>() throws Exception { assertFalse("Null request should have no host", CommandResolver.<API key>(null)); assertFalse("Request with null uri should have no host", CommandResolver.<API key>(new Request() { public URI getURI() { return null; } public Map<String, String[]> getParameterMap() { throw new <API key>("Not implemented"); } })); assertFalse("Request with other uri should not be command host", CommandResolver.<API key>(makeRequest("http: assertTrue("Request with actual localhost name should be command host", CommandResolver.<API key>(makeRequest("http: + "netarchivesuite.viewerproxy.invalid" + "/stop?foo=bar"))); } private Request makeRequest(final String uri) { return new Request(){ public URI getURI() { try { return new URI(uri); } catch (URISyntaxException e) { throw new <API key>("Illegal URI " + uri, e); } } public Map<String, String[]> getParameterMap() { //TODO: implement method throw new <API key>("Not implemented"); } }; } }
/****************************************************************************** * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN */ #include "directory.h" #include <QtCore/QStringBuilder> using namespace Quotient; SetRoomAliasJob::SetRoomAliasJob(const QString& roomAlias, const QString& roomId) : BaseJob(HttpVerb::Put, QStringLiteral("SetRoomAliasJob"), QStringLiteral("/_matrix/client/r0") % "/directory/room/" % roomAlias) { QJsonObject _data; addParam<>(_data, QStringLiteral("room_id"), roomId); setRequestData(std::move(_data)); } QUrl GetRoomIdByAliasJob::makeRequestUrl(QUrl baseUrl, const QString& roomAlias) { return BaseJob::makeRequestUrl(std::move(baseUrl), QStringLiteral("/_matrix/client/r0") % "/directory/room/" % roomAlias); } GetRoomIdByAliasJob::GetRoomIdByAliasJob(const QString& roomAlias) : BaseJob(HttpVerb::Get, QStringLiteral("GetRoomIdByAliasJob"), QStringLiteral("/_matrix/client/r0") % "/directory/room/" % roomAlias, false) {} QUrl DeleteRoomAliasJob::makeRequestUrl(QUrl baseUrl, const QString& roomAlias) { return BaseJob::makeRequestUrl(std::move(baseUrl), QStringLiteral("/_matrix/client/r0") % "/directory/room/" % roomAlias); } DeleteRoomAliasJob::DeleteRoomAliasJob(const QString& roomAlias) : BaseJob(HttpVerb::Delete, QStringLiteral("DeleteRoomAliasJob"), QStringLiteral("/_matrix/client/r0") % "/directory/room/" % roomAlias) {} QUrl GetLocalAliasesJob::makeRequestUrl(QUrl baseUrl, const QString& roomId) { return BaseJob::makeRequestUrl(std::move(baseUrl), QStringLiteral("/_matrix/client/r0") % "/rooms/" % roomId % "/aliases"); } GetLocalAliasesJob::GetLocalAliasesJob(const QString& roomId) : BaseJob(HttpVerb::Get, QStringLiteral("GetLocalAliasesJob"), QStringLiteral("/_matrix/client/r0") % "/rooms/" % roomId % "/aliases") { addExpectedKey("aliases"); }
/* File: optmem.cpp */ /* Abstract data type Array */ #include <mystdlib.h> #include <myadt.hpp> namespace netgen { BlockAllocator :: BlockAllocator (unsigned asize, unsigned ablocks) : bablocks (0) { if (asize < sizeof(void*)) asize = sizeof(void*); size = asize; blocks = ablocks; freelist = NULL; } BlockAllocator :: ~BlockAllocator () { for (int i = 0; i < bablocks.Size(); i++) delete [] bablocks[i]; } void * BlockAllocator :: Alloc () { // return new char[size]; if (!freelist) { // cout << "freelist = " << freelist << endl; // cout << "BlockAlloc: " << size*blocks << endl; char * hcp = new char [size * blocks]; bablocks.Append (hcp); bablocks.Last() = hcp; for (unsigned i = 0; i < blocks-1; i++) *(void**)&(hcp[i * size]) = &(hcp[ (i+1) * size]); *(void**)&(hcp[(blocks-1)*size]) = NULL; freelist = hcp; } void * p = freelist; freelist = *(void**)freelist; return p; } /* void BlockAllocator :: Free (void * p) { *(void**)p = freelist; freelist = p; } */ }
<?php if(!defined("__XE__")) exit(); $info = new stdClass; $info->default_index_act = '<API key>'; $info->setup_index_act=''; $info-><API key>=''; $info->admin_index_act = '<API key>'; $info->action = new stdClass; $info->action-><API key> = new stdClass; $info->action-><API key>->type='view'; $info->action-><API key>->grant='guest'; $info->action-><API key>->standalone='true'; $info->action-><API key>->ruleset=''; $info->action-><API key>->method=''; $info->action-><API key> = new stdClass; $info->action-><API key>->type='view'; $info->action-><API key>->grant='guest'; $info->action-><API key>->standalone='true'; $info->action-><API key>->ruleset=''; $info->action-><API key>->method=''; $info->action-><API key> = new stdClass; $info->action-><API key>->type='view'; $info->action-><API key>->grant='guest'; $info->action-><API key>->standalone='true'; $info->action-><API key>->ruleset=''; $info->action-><API key>->method=''; $info->action-><API key> = new stdClass; $info->action-><API key>->type='view'; $info->action-><API key>->grant='guest'; $info->action-><API key>->standalone='true'; $info->action-><API key>->ruleset=''; $info->action-><API key>->method=''; $info->action-><API key> = new stdClass; $info->action-><API key>->type='view'; $info->action-><API key>->grant='guest'; $info->action-><API key>->standalone='true'; $info->action-><API key>->ruleset=''; $info->action-><API key>->method=''; $info->action-><API key> = new stdClass; $info->action-><API key>->type='view'; $info->action-><API key>->grant='guest'; $info->action-><API key>->standalone='true'; $info->action-><API key>->ruleset=''; $info->action-><API key>->method=''; $info->action-><API key> = new stdClass; $info->action-><API key>->type='view'; $info->action-><API key>->grant='guest'; $info->action-><API key>->standalone='true'; $info->action-><API key>->ruleset=''; $info->action-><API key>->method=''; $info->action-><API key> = new stdClass; $info->action-><API key>->type='view'; $info->action-><API key>->grant='guest'; $info->action-><API key>->standalone='true'; $info->action-><API key>->ruleset=''; $info->action-><API key>->method=''; $info->action-><API key> = new stdClass; $info->action-><API key>->type='view'; $info->action-><API key>->grant='guest'; $info->action-><API key>->standalone='true'; $info->action-><API key>->ruleset=''; $info->action-><API key>->method=''; $info->action-><API key> = new stdClass; $info->action-><API key>->type='controller'; $info->action-><API key>->grant='guest'; $info->action-><API key>->standalone='true'; $info->action-><API key>->ruleset=''; $info->action-><API key>->method=''; $info->action-><API key> = new stdClass; $info->action-><API key>->type='controller'; $info->action-><API key>->grant='guest'; $info->action-><API key>->standalone='true'; $info->action-><API key>->ruleset=''; $info->action-><API key>->method=''; $info->action-><API key> = new stdClass; $info->action-><API key>->type='controller'; $info->action-><API key>->grant='guest'; $info->action-><API key>->standalone='true'; $info->action-><API key>->ruleset=''; $info->action-><API key>->method=''; $info->action-><API key> = new stdClass; $info->action-><API key>->type='controller'; $info->action-><API key>->grant='guest'; $info->action-><API key>->standalone='true'; $info->action-><API key>->ruleset='insertMileage'; $info->action-><API key>->method=''; $info->action-><API key> = new stdClass; $info->action-><API key>->type='controller'; $info->action-><API key>->grant='guest'; $info->action-><API key>->standalone='true'; $info->action-><API key>->ruleset=''; $info->action-><API key>->method=''; $info->action-><API key> = new stdClass; $info->action-><API key>->type='model'; $info->action-><API key>->grant='guest'; $info->action-><API key>->standalone='true'; $info->action-><API key>->ruleset=''; $info->action-><API key>->method=''; $info->action-><API key> = new stdClass; $info->action-><API key>->type='model'; $info->action-><API key>->grant='guest'; $info->action-><API key>->standalone='true'; $info->action-><API key>->ruleset=''; $info->action-><API key>->method=''; $info->action-><API key> = new stdClass; $info->action-><API key>->type='model'; $info->action-><API key>->grant='guest'; $info->action-><API key>->standalone='true'; $info->action-><API key>->ruleset=''; $info->action-><API key>->method=''; $info->action-><API key> = new stdClass; $info->action-><API key>->type='model'; $info->action-><API key>->grant='guest'; $info->action-><API key>->standalone='true'; $info->action-><API key>->ruleset=''; $info->action-><API key>->method=''; $info->action->getMileage = new stdClass; $info->action->getMileage->type='model'; $info->action->getMileage->grant='guest'; $info->action->getMileage->standalone='true'; $info->action->getMileage->ruleset=''; $info->action->getMileage->method=''; $info->action-><API key> = new stdClass; $info->action-><API key>->type='view'; $info->action-><API key>->grant='guest'; $info->action-><API key>->standalone='true'; $info->action-><API key>->ruleset=''; $info->action-><API key>->method=''; $info->action-><API key> = new stdClass; $info->action-><API key>->type='view'; $info->action-><API key>->grant='guest'; $info->action-><API key>->standalone='true'; $info->action-><API key>->ruleset=''; $info->action-><API key>->method=''; return $info;
#include "Hash.h" using namespace SLib; Hash::Hash() : m_bReadyToHash (false), m_md (NULL), m_md_len (0) { // Initialize the message digest memset(m_md_value,0,EVP_MAX_MD_SIZE); m_FinalHash.erase(); <API key>(); m_md = <API key>("SHA"); if(m_md!=NULL) { EVP_DigestInit(&m_mdctx, m_md); m_bReadyToHash=true; } else throw AnException(0, FL, "Unable to initialize %s digest","SHA"); } Hash::Hash(twine& t): m_bReadyToHash (false), m_md (NULL), m_md_len (0) { // Initialize the message digest memset(m_md_value,0,EVP_MAX_MD_SIZE); m_FinalHash.erase(); <API key>(); m_md = <API key>(t.c_str()); if(m_md!=NULL) { EVP_DigestInit(&m_mdctx, m_md); m_bReadyToHash=true; } else throw AnException(0, FL, "Unable to initialize %s digest",t.c_str()); } Hash::Hash(twine* t): m_bReadyToHash (false), m_md (NULL), m_md_len (0) { // Initialize the message digest memset(m_md_value,0,EVP_MAX_MD_SIZE); m_FinalHash.erase(); <API key>(); m_md = <API key>(t->c_str()); if(m_md!=NULL) { EVP_DigestInit(&m_mdctx, m_md); m_bReadyToHash=true; } else throw AnException(0, FL, "Unable to initialize %s digest",t->c_str()); } Hash::~Hash() { // not much to do. free((void *)m_md); m_md=NULL; m_bReadyToHash=false; m_FinalHash.erase(); memset(m_md_value,0,EVP_MAX_MD_SIZE); } void Hash::operator+=(const char* c) { if(m_bReadyToHash!=false) { twine t(c); EVP_DigestUpdate(&m_mdctx, t.c_str(), t.length()); } else throw AnException(0, FL, "Digest not initialized or reinitialized"); } void Hash::operator+=(const twine& t) { if(m_bReadyToHash!=false) { EVP_DigestUpdate(&m_mdctx, t.c_str(), t.length()); } else throw AnException(0, FL, "Digest not initialized or reinitialized"); } void Hash::operator+=(const twine* t) { if(m_bReadyToHash!=false) { EVP_DigestUpdate(&m_mdctx, t->c_str(), t->length()); } else throw AnException(0, FL, "Digest not initialized or reinitialized"); } twine& Hash::GetFinalHash(void) { if(m_bReadyToHash!=false) { unsigned int i=0; char tmp[100]="\0"; m_FinalHash.erase(); EVP_DigestFinal(&m_mdctx, m_md_value, &m_md_len); for(i = 0; i < m_md_len; i++) { sprintf(tmp,"%02x\0", m_md_value[i]); m_FinalHash.append(tmp); memset(tmp,0,100); } //m_FinalHash = (const char *)m_md_value; free((void *)m_md); m_md=NULL; m_bReadyToHash=false; return m_FinalHash; } else throw AnException(0, FL, "Digest not initialized or reinitialized"); } void Hash::ReInitialize(void) { // Initialize the message digest free((void *)m_md); m_md=NULL; m_bReadyToHash=false; memset(m_md_value,0,EVP_MAX_MD_SIZE); m_md_len=0; m_FinalHash.erase(); <API key>(); m_md = <API key>("SHA"); if(m_md!=NULL) { EVP_DigestInit(&m_mdctx, m_md); m_bReadyToHash=true; } else throw AnException(0, FL, "Unable to reinitialize %s digest","SHA"); } void Hash::ReInitialize(twine& t) { // Initialize the message digest free((void *)m_md); m_md=NULL; m_bReadyToHash=false; memset(m_md_value,0,EVP_MAX_MD_SIZE); m_md_len=0; m_FinalHash.erase(); <API key>(); m_md = <API key>(t.c_str()); if(m_md!=NULL) { EVP_DigestInit(&m_mdctx, m_md); m_bReadyToHash=true; } else throw AnException(0, FL, "Unable to reinitialize %s digest",t.c_str()); } void Hash::ReInitialize(twine* t) { // Initialize the message digest free((void *)m_md); m_md=NULL; m_bReadyToHash=false; memset(m_md_value,0,EVP_MAX_MD_SIZE); m_md_len=0; m_FinalHash.erase(); <API key>(); m_md = <API key>(t->c_str()); if(m_md!=NULL) { EVP_DigestInit(&m_mdctx, m_md); m_bReadyToHash=true; } else throw AnException(0, FL, "Unable to reinitialize %s digest",t->c_str()); }
#pragma once #include "cntrlr_abstract.h" class CntrlrSingle: public ICntrlr { Q_OBJECT public: CntrlrSingle (IData *data, NV::ErrCode &err): ICntrlr(data) { err=NV::Success; } virtual void GetInfo (QString&) const; virtual void GetMatrixRaster (const int mes_len, MatrixRaster* &res1, MatrixRaster* &res2); virtual void GetRowRaster (const int row, MatrixRaster* &res1, MatrixRaster* &res2) const; virtual void GetColRaster (const int col, MatrixRaster* &res1, MatrixRaster* &res2) const; virtual void GetPairRaster (const int row, const int col, double*&, double*&, double*&, unsigned int&) const; virtual char GetType () const { return 0; } // type of controller: 'single' (0) virtual QwtColorMap* AllocMainCMap (const double from, const double to) const; // don't forget to call FreeMainCMap() virtual QwtColorMap* AllocAuxCMap () const { return NULL; } virtual void FreeAuxCMap (QwtColorMap*) const {} // loads a set of matrices corresponding to message lengths from 'len_from' to 'len_to' (including 'len_to') virtual NV::ErrCode SetWindow (const int len_from, const int len_to); };
// checkstyle: Checks Java source code for adherence to a set of rules. // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // This library is distributed in the hope that it will be useful, // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // You should have received a copy of the GNU Lesser General Public // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA package com.puppycrawl.tools.checkstyle.checks.imports; import java.util.Set; import com.google.common.collect.Sets; import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.FullIdent; import com.puppycrawl.tools.checkstyle.api.TokenTypes; /** * <p> * Checks for imports that are redundant. An import statement is * considered redundant if: * </p> *<ul> * <li>It is a duplicate of another import. This is, when a class is imported * more than once.</li> * <li>The class non-statically imported is from the {@code java.lang} * package. For example importing {@code java.lang.String}.</li> * <li>The class non-statically imported is from the same package as the * current package.</li> *</ul> * <p> * An example of how to configure the check is: * </p> * <pre> * &lt;module name="RedundantImport"/&gt; * </pre> * Compatible with Java 1.5 source. * * @author Oliver Burn */ public class <API key> extends AbstractCheck { /** * A key is pointing to the warning message text in "messages.properties" * file. */ public static final String MSG_LANG = "import.lang"; /** * A key is pointing to the warning message text in "messages.properties" * file. */ public static final String MSG_SAME = "import.same"; /** * A key is pointing to the warning message text in "messages.properties" * file. */ public static final String MSG_DUPLICATE = "import.duplicate"; /** Set of the imports. */ private final Set<FullIdent> imports = Sets.newHashSet(); /** Set of static imports. */ private final Set<FullIdent> staticImports = Sets.newHashSet(); /** Name of package in file. */ private String pkgName; @Override public void beginTree(DetailAST aRootAST) { pkgName = null; imports.clear(); staticImports.clear(); } @Override public int[] getDefaultTokens() { return getAcceptableTokens(); } @Override public int[] getAcceptableTokens() { return new int[] {TokenTypes.IMPORT, TokenTypes.STATIC_IMPORT, TokenTypes.PACKAGE_DEF, }; } @Override public int[] getRequiredTokens() { return getAcceptableTokens(); } @Override public void visitToken(DetailAST ast) { if (ast.getType() == TokenTypes.PACKAGE_DEF) { pkgName = FullIdent.createFullIdent( ast.getLastChild().getPreviousSibling()).getText(); } else if (ast.getType() == TokenTypes.IMPORT) { final FullIdent imp = FullIdent.<API key>(ast); if (isFromPackage(imp.getText(), "java.lang")) { log(ast.getLineNo(), ast.getColumnNo(), MSG_LANG, imp.getText()); } // imports from unnamed package are not allowed, // so we are checking SAME rule only for named packages else if (pkgName != null && isFromPackage(imp.getText(), pkgName)) { log(ast.getLineNo(), ast.getColumnNo(), MSG_SAME, imp.getText()); } // Check for a duplicate import for (FullIdent full : imports) { if (imp.getText().equals(full.getText())) { log(ast.getLineNo(), ast.getColumnNo(), MSG_DUPLICATE, full.getLineNo(), imp.getText()); } } imports.add(imp); } else { // Check for a duplicate static import final FullIdent imp = FullIdent.createFullIdent( ast.getLastChild().getPreviousSibling()); for (FullIdent full : staticImports) { if (imp.getText().equals(full.getText())) { log(ast.getLineNo(), ast.getColumnNo(), MSG_DUPLICATE, full.getLineNo(), imp.getText()); } } staticImports.add(imp); } } /** * Determines if an import statement is for types from a specified package. * @param importName the import name * @param pkg the package name * @return whether from the package */ private static boolean isFromPackage(String importName, String pkg) { // imports from unnamed package are not allowed: // http://docs.oracle.com/javase/specs/jls/se7/html/jls-7.html#jls-7.5 // So '.' must be present in member name and we are not checking for it final int index = importName.lastIndexOf('.'); final String front = importName.substring(0, index); return front.equals(pkg); } }
#include "arb_poly.h" void <API key>(arb_ptr Qinv, arb_srcptr Q, slong Qlen, slong n, slong prec) { slong i; arb_ptr R, S, T, tmp; if (n <= 2) { if (n >= 1) arb_zero(Qinv); if (n == 2) arb_inv(Qinv + 1, Q + 1, prec); return; } R = _arb_vec_init(n - 1); S = _arb_vec_init(n - 1); T = _arb_vec_init(n - 1); arb_zero(Qinv); arb_inv(Qinv + 1, Q + 1, prec); <API key>(R, Q + 1, FLINT_MIN(Qlen, n) - 1, n - 1, prec); _arb_vec_set(S, R, n - 1); for (i = 2; i < n; i++) { _arb_poly_mullow(T, S, n - 1, R, n - 1, n - 1, prec); arb_div_ui(Qinv + i, T + i - 1, i, prec); tmp = S; S = T; T = tmp; } _arb_vec_clear(R, n - 1); _arb_vec_clear(S, n - 1); _arb_vec_clear(T, n - 1); } void <API key>(arb_poly_t Qinv, const arb_poly_t Q, slong n, slong prec) { slong Qlen = Q->length; if (Qlen < 2 || !arb_is_zero(Q->coeffs) || arb_contains_zero(Q->coeffs + 1)) { flint_printf("Exception (<API key>). Input must \n" "have zero constant term and nonzero coefficient of x^1.\n"); abort(); } if (Qinv != Q) { arb_poly_fit_length(Qinv, n); <API key>(Qinv->coeffs, Q->coeffs, Qlen, n, prec); } else { arb_poly_t t; arb_poly_init2(t, n); <API key>(t->coeffs, Q->coeffs, Qlen, n, prec); arb_poly_swap(Qinv, t); arb_poly_clear(t); } <API key>(Qinv, n); _arb_poly_normalise(Qinv); }
package org.gridgain.grid.resources; import java.lang.annotation.*; import org.gridgain.apache.*; @Documented @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD, ElementType.FIELD}) @<API key> @Deprecated public @interface GridJobIdResource { // No-op. }
package org.digidoc4j.signers; import org.digidoc4j.SignatureToken; import org.digidoc4j.exceptions.<API key>; import java.security.PrivateKey; import java.security.cert.X509Certificate; /** * Signer for external services for example in web */ public abstract class ExternalSigner implements SignatureToken { private X509Certificate signingCertificate; /** * Creates new external signer * * @param signingCertificate certificate used for signing */ public ExternalSigner(X509Certificate signingCertificate) { this.signingCertificate = signingCertificate; } @Override public X509Certificate getCertificate() { return this.signingCertificate; } @Override public PrivateKey getPrivateKey() { throw new <API key>("External signer does not have private key"); } }
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <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-UMLParameter"></span> UMLParameter </span> </section> <!-- Path --> <section style="margin-top: 10px"> <span class="label label-info"><a href='<API key>.html'><span class='node-icon _icon-Project'></span>Untitled</a></span> <span>::</span> <span class="label label-info"><a href='<API key>.html'><span class='node-icon _icon-UMLModel'></span>JavaReverse</a></span> <span>::</span> <span class="label label-info"><a href='<API key>.html'><span class='node-icon _icon-UMLPackage'></span>net</a></span> <span>::</span> <span class="label label-info"><a href='<API key>.html'><span class='node-icon _icon-UMLPackage'></span>gleamynode</a></span> <span>::</span> <span class="label label-info"><a href='<API key>.html'><span class='node-icon _icon-UMLPackage'></span>netty</a></span> <span>::</span> <span class="label label-info"><a href='<API key>.html'><span class='node-icon _icon-UMLPackage'></span>channel</a></span> <span>::</span> <span class="label label-info"><a href='<API key>.html'><span class='node-icon _icon-UMLClass'></span><API key></a></span> <span>::</span> <span class="label label-info"><a href='<API key>.html'><span class='node-icon _icon-UMLOperation'></span>getCause</a></span> <span>::</span> <span class="label label-info"><a href='<API key>.html'><span class='node-icon _icon-UMLParameter'></span>(Parameter)</a></span> </section> <!-- Diagram --> <!-- Description --> <section> <h3>Description</h3> <div> <span class="label label-info">none</span> </div> </section> <!-- Specification --> <!-- Directed Relationship --> <!-- 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>stereotype</td> <td><span class='label label-info'>null</span></td> </tr> <tr> <td>visibility</td> <td>public</td> </tr> <tr> <td>isStatic</td> <td><span class='label label-info'>false</span></td> </tr> <tr> <td>isLeaf</td> <td><span class='label label-info'>false</span></td> </tr> <tr> <td>type</td> <td><a href='<API key>.html'><span class='node-icon _icon-UMLClass'></span>Throwable</a></td> </tr> <tr> <td>multiplicity</td> <td></td> </tr> <tr> <td>isReadOnly</td> <td><span class='label label-info'>false</span></td> </tr> <tr> <td>isOrdered</td> <td><span class='label label-info'>false</span></td> </tr> <tr> <td>isUnique</td> <td><span class='label label-info'>false</span></td> </tr> <tr> <td>defaultValue</td> <td></td> </tr> <tr> <td>direction</td> <td>return</td> </tr> </table> </section> <!-- Tags --> <!-- Constraints, Dependencies, Dependants --> <!-- Relationships --> <!-- Owned Elements --> </div> </body> </html>
package org.lightmare.criteria.query.providers.jpa; import org.lightmare.criteria.functions.FunctionConsumer; import org.lightmare.criteria.query.QueryStream; import org.lightmare.criteria.query.orm.SubQueryOperator; import org.lightmare.criteria.query.orm.links.Operators; import org.lightmare.criteria.query.orm.links.SubQuery.SubQueryType; /** * Sub query processor for ALL, ANY, SOME clause and functional expressions * * @author Levan Tsinadze * * @param <T> * entity type parameter * @param <Q> * {@link org.lightmare.criteria.query.QueryStream} implementation * parameter */ interface <API key><T, Q extends QueryStream<T, ? super Q>> extends SubQueryOperator<T, Q> { /** * Provides method to process sub queries with ALL clause * * @param consumer * @param operator * @param stream * @return {@link org.lightmare.criteria.query.QueryStream} implementation */ default <F, S> Q <API key>(FunctionConsumer<T> consumer, String operator, SubQueryType<S, JpaQueryStream<S>> stream) { String composed = stream.getOperator(operator); return <API key>(consumer, composed, stream.getType(), stream.getConsumer()); } default <F, S> Q equalSubQuery(FunctionConsumer<T> consumer, SubQueryType<S, JpaQueryStream<S>> stream) { return <API key>(consumer, Operators.EQ, stream); } default <F, S> Q notEqualSubQuery(FunctionConsumer<T> consumer, SubQueryType<S, JpaQueryStream<S>> stream) { return <API key>(consumer, Operators.NOT_EQ, stream); } default <F extends Comparable<? super F>, S> Q gtSubQuery(FunctionConsumer<T> consumer, SubQueryType<S, JpaQueryStream<S>> stream) { return <API key>(consumer, Operators.GREATER, stream); } default <F extends Comparable<? super F>, S> Q greaterThanSubQuery(FunctionConsumer<T> consumer, SubQueryType<S, JpaQueryStream<S>> stream) { return <API key>(consumer, Operators.GREATER, stream); } default <F extends Comparable<? super F>, S> Q ltSubQuery(FunctionConsumer<T> consumer, SubQueryType<S, JpaQueryStream<S>> stream) { return <API key>(consumer, Operators.LESS, stream); } default <F extends Comparable<? super F>, S> Q lessThanSubQuery(FunctionConsumer<T> consumer, SubQueryType<S, JpaQueryStream<S>> stream) { return <API key>(consumer, Operators.LESS, stream); } default <F extends Comparable<? super F>, S> Q geSubQuery(FunctionConsumer<T> consumer, SubQueryType<S, JpaQueryStream<S>> stream) { return <API key>(consumer, Operators.GREATER_OR_EQ, stream); } default <F extends Comparable<? super F>, S> Q <API key>(FunctionConsumer<T> consumer, SubQueryType<S, JpaQueryStream<S>> stream) { return <API key>(consumer, Operators.GREATER_OR_EQ, stream); } default <F extends Comparable<? super F>, S> Q leSubQuery(FunctionConsumer<T> consumer, SubQueryType<S, JpaQueryStream<S>> stream) { return <API key>(consumer, Operators.LESS_OR_EQ, stream); } default <F extends Comparable<? super F>, S> Q <API key>(FunctionConsumer<T> consumer, SubQueryType<S, JpaQueryStream<S>> stream) { return <API key>(consumer, Operators.LESS_OR_EQ, stream); } }
#include "config.h" #include "rtapi.h" #include "hal.h" #include "hal_priv.h" #include "halcmd.h" #include "halcmd_commands.h" #include "halcmd_completion.h" #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <string.h> #include <sys/stat.h> #include <sys/wait.h> #include <unistd.h> #include <fcntl.h> #include <signal.h> #include <errno.h> #include <time.h> #include <fnmatch.h> #include <search.h> #include <inifile.h> static int get_input(FILE *srcfile, char *buf, size_t bufsize); static void print_help_general(int showR); static int release_HAL_mutex(void); static int propose_completion(char *all, char *fragment, int start); static const char *inifile; static FILE *inifp; int main(int argc, char **argv) { int c, fd; int keep_going, retval, errorcount; int filemode = 0; char *filename = NULL; FILE *srcfile = NULL; char raw_buf[MAX_CMD_LEN+1]; int linenumber = 1; char *cf=NULL, *cw=NULL, *cl=NULL; char *uri = NULL; // NULL - use service discovery char *service_uuid = NULL; // must have a global uuid inifile = getenv("MACHINEKIT_INI"); /* use default if not specified by user */ if (inifile == NULL) { inifile = MACHINEKIT_INI; } if (argc < 2) { /* no args specified, print help */ print_help_general(0); exit(0); } /* set default level of output - 'quiet' */ rtapi_set_msg_level(RTAPI_MSG_ERR); /* set default for other options */ keep_going = 0; /* start parsing the command line, options first */ while(1) { c = getopt(argc, argv, "+RCfi:kqQsvVhu:U:"); if(c == -1) break; switch(c) { case 'R': /* force an unlock of the HAL mutex - to be used after a segfault in a hal program */ if (release_HAL_mutex() < 0) { printf("HALCMD: Release Mutex failed!\n"); return 1; } return 0; break; case 'h': /* -h = help */ if (argc > optind) { /* there are more arguments */ do_help_cmd(argv[optind]); } else { print_help_general(1); } return 0; break; case 'k': /* -k = keep going */ keep_going = 1; break; case 'q': /* -q = quiet (default) */ rtapi_set_msg_level(RTAPI_MSG_ERR); break; case 'Q': /* -Q = very quiet */ rtapi_set_msg_level(RTAPI_MSG_NONE); break; case 's': /* script friendly mode */ scriptmode = 1; break; case 'v': /* -v = verbose */ rtapi_set_msg_level(RTAPI_MSG_INFO); break; case 'V': /* -V = very verbose */ rtapi_set_msg_level(RTAPI_MSG_ALL); break; case 'e': echo_mode = 1; break; case 'f': filemode = 1; break; case 'C': cl = getenv("COMP_LINE"); cw = getenv("COMP_POINT"); if (!cl || !cw) exit(0); c = atoi(cw)-strlen(argv[0])-1; if (c<0) c=0; cl += strlen(argv[0])+1; if (c>0 && cl[c]=='\0') c--; // if at end of line, back up one char cf=&cl[c]; { int n; for (n=c; n>0; n if (isspace(*cf) || *cf == '=' || *cf == '<' || *cf == '>') { cf++; break; } } halcmd_startup(1, uri, service_uuid); propose_completion(cl, cf, n); } if (comp_id >= 0) halcmd_shutdown(); exit(0); break; #ifndef NO_INI case 'i': /* -i = allow reading 'setp' values from an ini file */ if (halcmd_inifile == NULL) { /* it's the first -i (ignore repeats) */ /* there is a following arg, and it's not an option */ filename = optarg; halcmd_inifile = fopen(filename, "r"); if (halcmd_inifile == NULL) { fprintf(stderr, "Could not open ini file '%s'\n", filename); exit(-1); } /* make sure file is closed on exec() */ fd = fileno(halcmd_inifile); fcntl(fd, F_SETFD, FD_CLOEXEC); } break; #endif /* NO_INI */ case 'u': uri = optarg; break; case 'U': service_uuid = optarg; break; case '?': /* option not in getopt() list getopt already printed an error message */ exit(-1); break; default: /* option in getopt list but not in switch statement - bug */ printf("Unimplemented option '-%c'\n", c); exit(-1); break; } } if (inifile && ((inifp = fopen(inifile,"r")) == NULL)) { fprintf(stderr,"halcmd: cant open inifile '%s'\n", inifile); } // must have a MKUUID - commandline may override if (service_uuid == NULL) { const char *s; if ((s = iniFind(inifp, "MKUUID", "MACHINEKIT"))) { service_uuid = strdup(s); } } if (service_uuid == NULL) { fprintf(stderr, "halcmd: no service UUID (-R <uuid> or MACHINEKIT_INI [GLOBAL]MKUUID) present\n"); exit(-1); } if(filemode) { /* it's the first -f (ignore repeats) */ if (argc > optind) { /* there is a following arg, and it's not an option */ filename = argv[optind++]; srcfile = fopen(filename, "r"); halcmd_set_filename(filename); if (srcfile == NULL) { fprintf(stderr, "Could not open command file '%s'\n", filename); exit(-1); } /* make sure file is closed on exec() */ fd = fileno(srcfile); fcntl(fd, F_SETFD, FD_CLOEXEC); } else { halcmd_set_filename("<stdin>"); /* no filename followed -f option, use stdin */ srcfile = stdin; prompt_mode = 1; } } if ( halcmd_startup(0, uri, service_uuid) != 0 ) return 1; errorcount = 0; /* HAL init is OK, let's process the command(s) */ if (srcfile == NULL) { #ifndef NO_INI if(halcmd_inifile) { fprintf(stderr, "-i may only be used together with -f\n"); errorcount++; } #endif if(errorcount == 0 && argc > optind) { halcmd_set_filename("<commandline>"); <API key>(0); retval = halcmd_parse_cmd(&argv[optind]); if (retval != 0) { errorcount++; } } } else { /* read command line(s) from 'srcfile' */ while (get_input(srcfile, raw_buf, MAX_CMD_LEN)) { char *tokens[MAX_TOK+1]; <API key>(linenumber++); /* remove comments, do var substitution, and tokenise */ retval = <API key>(raw_buf, tokens); if(echo_mode) { halcmd_echo("%s\n", raw_buf); } if (retval == 0) { /* the "quit" command is not handled by parse_line() */ if ( ( strcasecmp(tokens[0],"quit") == 0 ) || ( strcasecmp(tokens[0],"exit") == 0 ) ) { break; } /* process command */ retval = halcmd_parse_cmd(tokens); } /* did a signal happen while we were busy? */ if ( halcmd_done ) { /* treat it as an error */ errorcount++; /* exit from loop */ break; } if ( retval != 0 ) { errorcount++; } if (( errorcount > 0 ) && ( keep_going == 0 )) { /* exit from loop */ break; } } } /* all done */ halcmd_shutdown(); if ( errorcount > 0 ) { return 1; } else { return 0; } } /* release_HAL_mutex() unconditionally releases the hal_mutex very useful after a program segfaults while holding the mutex */ static int release_HAL_mutex(void) { int comp_id, mem_id, retval; void *mem; hal_data_t *hal_data; /* do RTAPI init */ comp_id = rtapi_init("hal_unlocker"); if (comp_id < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "ERROR: rtapi init failed\n"); return -EINVAL; } /* get HAL shared memory block from RTAPI */ mem_id = rtapi_shmem_new(HAL_KEY, comp_id, global_data->hal_size); if (mem_id < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "ERROR: could not open shared memory\n"); rtapi_exit(comp_id); return -EINVAL; } /* get address of shared memory area */ retval = rtapi_shmem_getptr(mem_id, &mem, 0); if (retval < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "ERROR: could not access shared memory\n"); rtapi_exit(comp_id); return -EINVAL; } /* set up internal pointers to shared mem and data structure */ hal_data = (hal_data_t *) mem; /* release mutex */ rtapi_mutex_give(&(hal_data->mutex)); /* release RTAPI resources */ rtapi_shmem_delete(mem_id, comp_id); rtapi_exit(comp_id); /* done */ return 0; } static char **completion_callback(const char *text, hal_generator_func cb) { int state = 0; char *s = 0; do { s = cb(text, state); if(s) printf("%s\n", s); state = 1; } while(s); return NULL; } /* completion text starts with "halcmd", so remove that from the string */ static int propose_completion(char *all, char *fragment, int start) { int sp=0, len=strlen(all), i=0; for(; i<len; i++) if(all[i] == ' ') sp = i; if(sp) sp++; len = strlen(all); halcmd_completer(fragment, sp, len, completion_callback, all); return 0; } static void print_help_general(int showR) { printf("\nUsage: halcmd [options] [cmd [args]]\n\n"); printf("\n halcmd [options] -f [filename]\n\n"); printf("options:\n\n"); printf(" -e echo the commands from stdin to stderr\n"); printf(" -f [filename] Read commands from 'filename', not command\n"); printf(" line. If no filename, read from stdin.\n"); #ifndef NO_INI printf(" -i filename Open .ini file 'filename', allow commands\n"); printf(" to get their values from ini file.\n"); #endif printf(" -k Keep going after failed command. Default\n"); printf(" is to exit if any command fails. (Useful with -f)\n"); printf(" -q Quiet - print errors only (default).\n"); printf(" -Q Very quiet - print nothing.\n"); if (showR != 0) { printf(" -R Release mutex (for crash recovery only).\n"); } printf(" -s Script friendly - don't print headers on output.\n"); printf(" -v Verbose - print result of every command.\n"); printf(" -V Very verbose - print lots of junk.\n"); printf(" -h Help - print this help screen and exit.\n\n"); printf("commands:\n\n"); printf(" loadrt, loadusr, waitusr, unload, lock, unlock, net, linkps, linksp,\n"); printf(" unlinkp, newsig, delsig, setp, getp, ptype, sets, gets, stype,\n"); printf(" addf, delf, show, list, save, status, start, stop, source, echo, unecho, quit, exit\n"); printf(" help Lists all commands with short descriptions\n"); printf(" help command Prints detailed help for 'command'\n\n"); } #ifdef HAVE_READLINE #include "halcmd_completion.h" static int get_input(FILE *srcfile, char *buf, size_t bufsize) { static int first_time = 1; char *rlbuf; if(!scriptmode && srcfile == stdin && isatty(0)) { if(first_time) { <API key>(); first_time = 0; } rlbuf = readline("halcmd: "); if(!rlbuf) return 0; strncpy(buf, rlbuf, bufsize); buf[bufsize-1] = 0; free(rlbuf); if(*buf) add_history(buf); return 1; } if(prompt_mode) { fprintf(stdout, scriptmode ? "%%\n" : "halcmd: "); fflush(stdout); } return fgets(buf, bufsize, srcfile) != NULL; } #else static int get_input(FILE *srcfile, char *buf, size_t bufsize) { if(prompt_mode) { fprintf(stdout, scriptmode ? "%%\n" : "halcmd: "); fflush(stdout); } return fgets(buf, bufsize, srcfile) != NULL; } #endif void halcmd_output(const char *format, ...) { va_list ap; va_start(ap, format); vfprintf(stdout, format, ap); va_end(ap); } void halcmd_warning(const char *format, ...) { va_list ap; fprintf(stderr, "%s:%d: Warning: ", halcmd_get_filename(), <API key>()); va_start(ap, format); vfprintf(stderr, format, ap); va_end(ap); } void halcmd_error(const char *format, ...) { va_list ap; fprintf(stderr, "%s:%d: ", halcmd_get_filename(), <API key>()); va_start(ap, format); vfprintf(stderr, format, ap); va_end(ap); } void halcmd_info(const char *format, ...) { va_list ap; if(rtapi_get_msg_level() < RTAPI_MSG_INFO) return; fprintf(stderr, "%s:%d: ", halcmd_get_filename(), <API key>()); va_start(ap, format); vfprintf(stderr, format, ap); va_end(ap); } void halcmd_echo(const char *format, ...) { va_list ap; fprintf(stderr, "(%d)<echo>: ", <API key>()); va_start(ap, format); vfprintf(stderr, format, ap); va_end(ap); }
<!DOCTYPE HTML PUBLIC "- <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_40) on Wed Feb 10 11:30:59 CST 2016 --> <title>Uses of Class org.hibernate.type.descriptor.sql.<API key> (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.type.descriptor.sql.<API key> (Hibernate JavaDocs)"; } } catch(err) { } </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <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/type/descriptor/sql/<API key>.html" title="class in org.hibernate.type.descriptor.sql">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/type/descriptor/sql/class-use/<API key>.html" target="_top">Frames</a></li> <li><a href="<API key>.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="<API key>"> <li><a href="../../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><! allClassesLink = document.getElementById("<API key>"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } </script> </div> <a name="skip.navbar.top"> </a></div> <div class="header"> <h2 title="Uses of Class org.hibernate.type.descriptor.sql.<API key>" class="title">Uses of Class<br>org.hibernate.type.descriptor.sql.<API key></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/type/descriptor/sql/<API key>.html" title="class in org.hibernate.type.descriptor.sql"><API key></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.type.descriptor.sql">org.hibernate.type.descriptor.sql</a></td> <td class="colLast"> <div class="block">Defines handling of the standard JDBC-defined types.</div> </td> </tr> </tbody> </table> </li> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="org.hibernate.type.descriptor.sql"> </a> <h3>Uses of <a href="../../../../../../org/hibernate/type/descriptor/sql/<API key>.html" title="class in org.hibernate.type.descriptor.sql"><API key></a> in <a href="../../../../../../org/hibernate/type/descriptor/sql/package-summary.html">org.hibernate.type.descriptor.sql</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/type/descriptor/sql/package-summary.html">org.hibernate.type.descriptor.sql</a> declared as <a href="../../../../../../org/hibernate/type/descriptor/sql/<API key>.html" title="class in org.hibernate.type.descriptor.sql"><API key></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>static <a href="../../../../../../org/hibernate/type/descriptor/sql/<API key>.html" title="class in org.hibernate.type.descriptor.sql"><API key></a></code></td> <td class="colLast"><span class="typeNameLabel"><API key>.</span><code><span class="memberNameLink"><a href="../../../../../../org/hibernate/type/descriptor/sql/<API key>.html#INSTANCE">INSTANCE</a></span></code>&nbsp;</td> </tr> </tbody> </table> </li> </ul> </li> </ul> </div> <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/type/descriptor/sql/<API key>.html" title="class in org.hibernate.type.descriptor.sql">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/type/descriptor/sql/class-use/<API key>.html" target="_top">Frames</a></li> <li><a href="<API key>.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="<API key>"> <li><a href="../../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><! allClassesLink = document.getElementById("<API key>"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } </script> </div> <a name="skip.navbar.bottom"> </a></div> <p class="legalCopy"><small>Copyright &copy; 2001-2016 <a href="http: </body> </html>
#include "config.h" #include <assert.h> #include <ctype.h> #include <stdlib.h> #include <string.h> #include "internal.h" #include "asn1.h" #include "iso7816.h" #include "sm/sm-iso.h" static void <API key>(const struct sc_card *card, struct sc_apdu *apdu) { if (card == NULL || apdu == NULL) { return; } if (apdu->lc > <API key>(card)) { /* The lower layers will automatically do chaining */ apdu->flags |= <API key>; } if (apdu->le > <API key>(card)) { /* The lower layers will automatically do a GET RESPONSE, if possible. * All other workarounds must be carried out by the upper layers. */ apdu->le = <API key>(card); } } static const struct sc_card_error iso7816_errors[] = { { 0x6200, <API key>, "Warning: no information given, non-volatile memory is unchanged" }, { 0x6281, <API key>, "Part of returned data may be corrupted" }, { 0x6282, <API key>, "End of file/record reached before reading Le bytes" }, { 0x6283, <API key>, "Selected file invalidated" }, { 0x6284, <API key>, "FCI not formatted according to ISO 7816-4" }, { 0x6285, <API key>, "Selected file in termination state" }, { 0x6286, <API key>, "No input data available from a sensor on the card" }, { 0x6300, <API key>, "Warning: no information given, non-volatile memory has changed" }, { 0x6381, <API key>, "Warning: file filled up by last write" }, { 0x6400, <API key>, "Execution error" }, { 0x6401, <API key>, "Immediate response required by the card" }, { 0x6581, <API key>, "Memory failure" }, { 0x6700, <API key>, "Wrong length" }, { 0x6800, <API key>, "Functions in CLA not supported" }, { 0x6881, <API key>, "Logical channel not supported" }, { 0x6882, <API key>, "Secure messaging not supported" }, { 0x6883, <API key>, "Last command of the chain expected" }, { 0x6884, <API key>, "Command chaining not supported" }, { 0x6900, <API key>, "Command not allowed" }, { 0x6981, <API key>, "Command incompatible with file structure" }, { 0x6982, <API key>,"Security status not satisfied" }, { 0x6983, <API key>, "Authentication method blocked" }, { 0x6984, <API key>, "Referenced data not usable" }, { 0x6985, <API key>, "Conditions of use not satisfied" }, { 0x6986, <API key>, "Command not allowed (no current EF)" }, { 0x6987, <API key>,"Expected SM data objects missing" }, { 0x6988, <API key>,"Incorrect SM data objects" }, { 0x6A00, <API key>,"Wrong parameter(s) P1-P2" }, { 0x6A80, <API key>,"Incorrect parameters in the data field" }, { 0x6A81, <API key>, "Function not supported" }, { 0x6A82, <API key>, "File or application not found" }, { 0x6A83, <API key>, "Record not found" }, { 0x6A84, <API key>, "Not enough memory space in the file" }, { 0x6A85, <API key>,"Lc inconsistent with TLV structure" }, { 0x6A86, <API key>,"Incorrect parameters P1-P2" }, { 0x6A87, <API key>,"Lc inconsistent with P1-P2" }, { 0x6A88, <API key>,"Referenced data not found" }, { 0x6A89, <API key>, "File already exists"}, { 0x6A8A, <API key>, "DF name already exists"}, { 0x6B00, <API key>,"Wrong parameter(s) P1-P2" }, { 0x6D00, <API key>, "Instruction code not supported or invalid" }, { 0x6E00, <API key>, "Class not supported" }, { 0x6F00, <API key>, "No precise diagnosis" }, }; static int iso7816_check_sw(struct sc_card *card, unsigned int sw1, unsigned int sw2) { const int err_count = sizeof(iso7816_errors)/sizeof(iso7816_errors[0]); int i; /* Handle special cases here */ if (sw1 == 0x6C) { sc_log(card->ctx, "Wrong length; correct length is %d", sw2); return <API key>; } if (sw1 == 0x90) return SC_SUCCESS; if (sw1 == 0x63U && (sw2 & ~0x0fU) == 0xc0U ) { sc_log(card->ctx, "PIN not verified (remaining tries: %d)", (sw2 & 0x0f)); return <API key>; } for (i = 0; i < err_count; i++) { if (iso7816_errors[i].SWs == ((sw1 << 8) | sw2)) { sc_log(card->ctx, "%s", iso7816_errors[i].errorstr); return iso7816_errors[i].errorno; } } sc_log(card->ctx, "Unknown SWs; SW1=%02X, SW2=%02X", sw1, sw2); return <API key>; } static int iso7816_read_binary(struct sc_card *card, unsigned int idx, u8 *buf, size_t count, unsigned long flags) { struct sc_context *ctx = card->ctx; struct sc_apdu apdu; int r; if (idx > 0x7fff) { sc_log(ctx, "invalid EF offset: 0x%X > 0x7FFF", idx); return <API key>; } sc_format_apdu_ex(card, &apdu, 0xB0, (idx >> 8) & 0x7F, idx & 0xFF, NULL, 0, buf, count); <API key>(card, &apdu); r = sc_transmit_apdu(card, &apdu); LOG_TEST_RET(ctx, r, "APDU transmit failed"); r = sc_check_sw(card, apdu.sw1, apdu.sw2); if (r == <API key>) LOG_FUNC_RETURN(ctx, apdu.resplen); LOG_TEST_RET(ctx, r, "Check SW error"); if (apdu.resplen < count) { r = iso7816_read_binary(card, idx + apdu.resplen, buf + apdu.resplen, count - apdu.resplen, flags); /* Ignore all but 'corrupted data' errors */ if (r == <API key>) LOG_FUNC_RETURN(ctx, <API key>); else if (r > 0) apdu.resplen += r; } LOG_FUNC_RETURN(ctx, apdu.resplen); } static int iso7816_read_record(struct sc_card *card, unsigned int rec_nr, u8 *buf, size_t count, unsigned long flags) { struct sc_apdu apdu; int r; sc_format_apdu(card, &apdu, SC_APDU_CASE_2, 0xB2, rec_nr, 0); apdu.p2 = (flags & <API key>) << 3; if (flags & SC_RECORD_BY_REC_NR) apdu.p2 |= 0x04; apdu.le = count; apdu.resplen = count; apdu.resp = buf; <API key>(card, &apdu); r = sc_transmit_apdu(card, &apdu); LOG_TEST_RET(card->ctx, r, "APDU transmit failed"); if (apdu.resplen == 0) LOG_FUNC_RETURN(card->ctx, sc_check_sw(card, apdu.sw1, apdu.sw2)); LOG_FUNC_RETURN(card->ctx, apdu.resplen); } static int <API key>(struct sc_card *card, unsigned int rec_nr, const u8 *buf, size_t count, unsigned long flags) { struct sc_apdu apdu; int r; sc_format_apdu(card, &apdu, SC_APDU_CASE_3, 0xD2, rec_nr, 0); apdu.p2 = (flags & <API key>) << 3; if (flags & SC_RECORD_BY_REC_NR) apdu.p2 |= 0x04; apdu.lc = count; apdu.datalen = count; apdu.data = buf; <API key>(card, &apdu); r = sc_transmit_apdu(card, &apdu); LOG_TEST_RET(card->ctx, r, "APDU transmit failed"); r = sc_check_sw(card, apdu.sw1, apdu.sw2); LOG_TEST_RET(card->ctx, r, "Card returned error"); LOG_FUNC_RETURN(card->ctx, count); } static int <API key>(struct sc_card *card, const u8 *buf, size_t count, unsigned long flags) { struct sc_apdu apdu; int r; sc_format_apdu(card, &apdu, SC_APDU_CASE_3, 0xE2, 0, 0); apdu.p2 = (flags & <API key>) << 3; apdu.lc = count; apdu.datalen = count; apdu.data = buf; <API key>(card, &apdu); r = sc_transmit_apdu(card, &apdu); LOG_TEST_RET(card->ctx, r, "APDU transmit failed"); r = sc_check_sw(card, apdu.sw1, apdu.sw2); LOG_TEST_RET(card->ctx, r, "Card returned error"); LOG_FUNC_RETURN(card->ctx, count); } static int <API key>(struct sc_card *card, unsigned int rec_nr, const u8 *buf, size_t count, unsigned long flags) { struct sc_apdu apdu; int r; sc_format_apdu(card, &apdu, SC_APDU_CASE_3, 0xDC, rec_nr, 0); apdu.p2 = (flags & <API key>) << 3; if (flags & SC_RECORD_BY_REC_NR) apdu.p2 |= 0x04; apdu.lc = count; apdu.datalen = count; apdu.data = buf; <API key>(card, &apdu); r = sc_transmit_apdu(card, &apdu); LOG_TEST_RET(card->ctx, r, "APDU transmit failed"); r = sc_check_sw(card, apdu.sw1, apdu.sw2); LOG_TEST_RET(card->ctx, r, "Card returned error"); LOG_FUNC_RETURN(card->ctx, count); } static int <API key>(struct sc_card *card, unsigned int idx, const u8 *buf, size_t count, unsigned long flags) { struct sc_apdu apdu; int r; if (idx > 0x7fff) { sc_log(card->ctx, "invalid EF offset: 0x%X > 0x7FFF", idx); return <API key>; } sc_format_apdu(card, &apdu, SC_APDU_CASE_3, 0xD0, (idx >> 8) & 0x7F, idx & 0xFF); apdu.lc = count; apdu.datalen = count; apdu.data = buf; <API key>(card, &apdu); r = sc_transmit_apdu(card, &apdu); LOG_TEST_RET(card->ctx, r, "APDU transmit failed"); r = sc_check_sw(card, apdu.sw1, apdu.sw2); LOG_TEST_RET(card->ctx, r, "Card returned error"); LOG_FUNC_RETURN(card->ctx, count); } static int <API key>(struct sc_card *card, unsigned int idx, const u8 *buf, size_t count, unsigned long flags) { struct sc_apdu apdu; int r; if (idx > 0x7fff) { sc_log(card->ctx, "invalid EF offset: 0x%X > 0x7FFF", idx); return <API key>; } sc_format_apdu(card, &apdu, SC_APDU_CASE_3, 0xD6, (idx >> 8) & 0x7F, idx & 0xFF); apdu.lc = count; apdu.datalen = count; apdu.data = buf; <API key>(card, &apdu); r = sc_transmit_apdu(card, &apdu); LOG_TEST_RET(card->ctx, r, "APDU transmit failed"); r = sc_check_sw(card, apdu.sw1, apdu.sw2); LOG_TEST_RET(card->ctx, r, "Card returned error"); LOG_FUNC_RETURN(card->ctx, count); } static int iso7816_process_fci(struct sc_card *card, struct sc_file *file, const unsigned char *buf, size_t buflen) { struct sc_context *ctx = card->ctx; const unsigned char *p, *end; unsigned int cla = 0, tag = 0; size_t length; int size; for (p = buf, length = buflen, end = buf + buflen; p < end; p += length, length = end - p) { if (SC_SUCCESS != sc_asn1_read_tag(&p, length, &cla, &tag, &length) || p == NULL) { break; } switch (cla | tag) { case 0x81: if (file->size != 0) { /* don't overwrite existing file size excluding structural information */ break; } /* fall through */ case 0x80: /* determine the file size */ if (<API key>(p, length, &size) == 0 && size >= 0) { file->size = size; sc_log(ctx, " bytes in file: %"<API key>"u", file->size); } break; case 0x82: if (length > 0) { unsigned char byte = p[0]; const char *type; file->shareable = byte & 0x40 ? 1 : 0; sc_log(ctx, " shareable: %s", (byte & 0x40) ? "yes" : "no"); file->ef_structure = byte & 0x07; switch ((byte >> 3) & 7) { case 0: type = "working EF"; file->type = <API key>; break; case 1: type = "internal EF"; file->type = <API key>; break; case 7: type = "DF"; file->type = SC_FILE_TYPE_DF; break; default: type = "unknown"; break; } sc_log(ctx, " type: %s", type); sc_log(ctx, " EF structure: %d", byte & 0x07); sc_log(ctx, " tag 0x82: 0x%02x", byte); if (SC_SUCCESS != <API key>(file, &byte, 1)) sc_log(ctx, "Warning: Could not set file attributes"); } break; case 0x83: if (length == 2) { file->id = (p[0] << 8) | p[1]; sc_log(ctx, " file identifier: 0x%02X%02X", p[0], p[1]); } break; case 0x84: if (length > 0 && length <= 16) { memcpy(file->name, p, length); file->namelen = length; sc_log_hex(ctx, " File name:", file->name, file->namelen); if (!file->type) file->type = SC_FILE_TYPE_DF; } break; case 0x85: case 0xA5: if (SC_SUCCESS != <API key>(file, p, length)) { sc_log(ctx, "Warning: Could not set proprietary file properties"); } break; case 0x86: if (SC_SUCCESS != <API key>(file, p, length)) { sc_log(ctx, "Warning: Could not set file security properties"); } break; case 0x88: if (length == 1) { file->sid = *p; sc_log(ctx, " short file identifier: 0x%02X", *p); } break; case 0x8A: if (length == 1) { if (p[0] == 0x01) file->status = <API key>; else if (p[0] == 0x07 || p[0] == 0x05) file->status = <API key>; else if (p[0] == 0x06 || p[0] == 0x04) file->status = <API key>; } break; case 0x62: case 0x64: case 0x6F: /* allow nested FCP/FMD/FCI templates */ iso7816_process_fci(card, file, p, length); } } file->magic = SC_FILE_MAGIC; return SC_SUCCESS; } static int iso7816_select_file(struct sc_card *card, const struct sc_path *in_path, struct sc_file **file_out) { struct sc_context *ctx; struct sc_apdu apdu; unsigned char buf[<API key>]; unsigned char pathbuf[SC_MAX_PATH_SIZE], *path = pathbuf; int r, pathlen, pathtype; int select_mf = 0; struct sc_file *file = NULL; const u8 *buffer; size_t buffer_len; unsigned int cla, tag; if (card == NULL || in_path == NULL) { return <API key>; } ctx = card->ctx; memcpy(path, in_path->value, in_path->len); pathlen = in_path->len; pathtype = in_path->type; if (in_path->aid.len) { if (!pathlen) { memcpy(path, in_path->aid.value, in_path->aid.len); pathlen = in_path->aid.len; pathtype = <API key>; } else { /* First, select the application */ sc_format_apdu(card, &apdu, <API key>, 0xA4, 4, 0); apdu.data = in_path->aid.value; apdu.datalen = in_path->aid.len; apdu.lc = in_path->aid.len; r = sc_transmit_apdu(card, &apdu); LOG_TEST_RET(ctx, r, "APDU transmit failed"); r = sc_check_sw(card, apdu.sw1, apdu.sw2); if (r) LOG_FUNC_RETURN(ctx, r); if (pathtype == SC_PATH_TYPE_PATH || pathtype == <API key>) pathtype = <API key>; } } sc_format_apdu(card, &apdu, <API key>, 0xA4, 0, 0); switch (pathtype) { case <API key>: apdu.p1 = 0; if (pathlen != 2) return <API key>; break; case <API key>: apdu.p1 = 4; break; case SC_PATH_TYPE_PATH: apdu.p1 = 8; if (pathlen >= 2 && memcmp(path, "\x3F\x00", 2) == 0) { if (pathlen == 2) { /* only 3F00 supplied */ select_mf = 1; apdu.p1 = 0; break; } path += 2; pathlen -= 2; } break; case <API key>: apdu.p1 = 9; break; case SC_PATH_TYPE_PARENT: apdu.p1 = 3; pathlen = 0; apdu.cse = <API key>; break; default: LOG_FUNC_RETURN(ctx, <API key>); } apdu.lc = pathlen; apdu.data = path; apdu.datalen = pathlen; if (file_out != NULL) { apdu.p2 = 0; /* first record, return FCI */ apdu.resp = buf; apdu.resplen = sizeof(buf); apdu.le = <API key>(card) < 256 ? <API key>(card) : 256; } else { apdu.p2 = 0x0C; /* first record, return nothing */ apdu.cse = (apdu.lc == 0) ? SC_APDU_CASE_1 : <API key>; } r = sc_transmit_apdu(card, &apdu); LOG_TEST_RET(ctx, r, "APDU transmit failed"); if (file_out == NULL) { /* For some cards 'SELECT' can be only with request to return FCI/FCP. */ r = sc_check_sw(card, apdu.sw1, apdu.sw2); if (apdu.sw1 == 0x6A && apdu.sw2 == 0x86) { apdu.p2 = 0x00; if (sc_transmit_apdu(card, &apdu) == SC_SUCCESS) r = sc_check_sw(card, apdu.sw1, apdu.sw2); } if (apdu.sw1 == 0x61) LOG_FUNC_RETURN(ctx, SC_SUCCESS); LOG_FUNC_RETURN(ctx, r); } r = sc_check_sw(card, apdu.sw1, apdu.sw2); if (r) LOG_FUNC_RETURN(ctx, r); if (file_out && (apdu.resplen == 0)) { /* For some cards 'SELECT' MF or DF_NAME do not return FCI. */ if (select_mf || pathtype == <API key>) { file = sc_file_new(); if (file == NULL) LOG_FUNC_RETURN(ctx, <API key>); file->path = *in_path; *file_out = file; LOG_FUNC_RETURN(ctx, SC_SUCCESS); } } if (apdu.resplen < 2) LOG_FUNC_RETURN(ctx, <API key>); switch (apdu.resp[0]) { case ISO7816_TAG_FCI: case ISO7816_TAG_FCP: file = sc_file_new(); if (file == NULL) LOG_FUNC_RETURN(ctx, <API key>); file->path = *in_path; if (card->ops->process_fci == NULL) { sc_file_free(file); LOG_FUNC_RETURN(ctx, <API key>); } buffer = apdu.resp; r = sc_asn1_read_tag(&buffer, apdu.resplen, &cla, &tag, &buffer_len); if (r == SC_SUCCESS) card->ops->process_fci(card, file, buffer, buffer_len); *file_out = file; break; case 0x00: LOG_FUNC_RETURN(ctx, <API key>); default: LOG_FUNC_RETURN(ctx, <API key>); } return SC_SUCCESS; } static int <API key>(struct sc_card *card, u8 *rnd, size_t len) { int r; struct sc_apdu apdu; sc_format_apdu(card, &apdu, SC_APDU_CASE_2, 0x84, 0x00, 0x00); apdu.le = len; apdu.resp = rnd; apdu.resplen = len; r = sc_transmit_apdu(card, &apdu); LOG_TEST_RET(card->ctx, r, "APDU transmit failed"); r = sc_check_sw(card, apdu.sw1, apdu.sw2); LOG_TEST_RET(card->ctx, r, "GET CHALLENGE failed"); if (len < apdu.resplen) { return (int) len; } return (int) apdu.resplen; } static int <API key>(struct sc_card *card, const sc_file_t *file, u8 *out, size_t *outlen) { u8 *p = out; u8 buf[64]; if (*outlen < 2) return <API key>; *p++ = 0x6F; p++; buf[0] = (file->size >> 8) & 0xFF; buf[1] = file->size & 0xFF; sc_asn1_put_tag(0x81, buf, 2, p, *outlen - (p - out), &p); if (file->type_attr_len) { assert(sizeof(buf) >= file->type_attr_len); memcpy(buf, file->type_attr, file->type_attr_len); sc_asn1_put_tag(0x82, buf, file->type_attr_len, p, *outlen - (p - out), &p); } else { buf[0] = file->shareable ? 0x40 : 0; switch (file->type) { case <API key>: buf[0] |= 0x08; /* fall through */ case <API key>: buf[0] |= file->ef_structure & 7; break; case SC_FILE_TYPE_DF: buf[0] |= 0x38; break; default: return <API key>; } sc_asn1_put_tag(0x82, buf, 1, p, *outlen - (p - out), &p); } buf[0] = (file->id >> 8) & 0xFF; buf[1] = file->id & 0xFF; sc_asn1_put_tag(0x83, buf, 2, p, *outlen - (p - out), &p); /* 0x84 = DF name */ if (file->prop_attr_len) { assert(sizeof(buf) >= file->prop_attr_len); memcpy(buf, file->prop_attr, file->prop_attr_len); sc_asn1_put_tag(0x85, buf, file->prop_attr_len, p, *outlen - (p - out), &p); } if (file->sec_attr_len) { assert(sizeof(buf) >= file->sec_attr_len); memcpy(buf, file->sec_attr, file->sec_attr_len); sc_asn1_put_tag(0x86, buf, file->sec_attr_len, p, *outlen - (p - out), &p); } out[1] = p - out - 2; *outlen = p - out; return 0; } static int iso7816_create_file(struct sc_card *card, sc_file_t *file) { int r; size_t len; u8 sbuf[<API key>]; struct sc_apdu apdu; len = <API key>; if (card->ops->construct_fci == NULL) LOG_FUNC_RETURN(card->ctx, <API key>); r = card->ops->construct_fci(card, file, sbuf, &len); LOG_TEST_RET(card->ctx, r, "construct_fci() failed"); sc_format_apdu(card, &apdu, <API key>, 0xE0, 0x00, 0x00); apdu.lc = len; apdu.datalen = len; apdu.data = sbuf; r = sc_transmit_apdu(card, &apdu); LOG_TEST_RET(card->ctx, r, "APDU transmit failed"); r = sc_check_sw(card, apdu.sw1, apdu.sw2); LOG_TEST_RET(card->ctx, r, "Card returned error"); return r; } static int <API key>(struct sc_card *card, size_t *count, u8 *buf) { struct sc_apdu apdu; int r; size_t rlen; /* request at most max_recv_size bytes */ if (*count > <API key>(card)) rlen = <API key>(card); else rlen = *count; sc_format_apdu(card, &apdu, SC_APDU_CASE_2, 0xC0, 0x00, 0x00); apdu.le = rlen; apdu.resplen = rlen; apdu.resp = buf; /* don't call GET RESPONSE recursively */ apdu.flags |= <API key>; r = sc_transmit_apdu(card, &apdu); LOG_TEST_RET(card->ctx, r, "APDU transmit failed"); if (apdu.resplen == 0) LOG_FUNC_RETURN(card->ctx, sc_check_sw(card, apdu.sw1, apdu.sw2)); *count = apdu.resplen; if (apdu.sw1 == 0x90 && apdu.sw2 == 0x00) r = 0; /* no more data to read */ else if (apdu.sw1 == 0x61) r = apdu.sw2 == 0 ? 256 : apdu.sw2; /* more data to read */ else if (apdu.sw1 == 0x62 && apdu.sw2 == 0x82) r = 0; /* Le not reached but file/record ended */ else r = sc_check_sw(card, apdu.sw1, apdu.sw2); return r; } static int iso7816_delete_file(struct sc_card *card, const sc_path_t *path) { int r; u8 sbuf[2]; struct sc_apdu apdu; SC_FUNC_CALLED(card->ctx, <API key>); if (path->type != <API key> || (path->len != 0 && path->len != 2)) { sc_log(card->ctx, "File type has to be <API key>"); LOG_FUNC_RETURN(card->ctx, <API key>); } if (path->len == 2) { sbuf[0] = path->value[0]; sbuf[1] = path->value[1]; sc_format_apdu(card, &apdu, <API key>, 0xE4, 0x00, 0x00); apdu.lc = 2; apdu.datalen = 2; apdu.data = sbuf; } else { /* No file ID given: means currently selected file */ sc_format_apdu(card, &apdu, SC_APDU_CASE_1, 0xE4, 0x00, 0x00); } r = sc_transmit_apdu(card, &apdu); LOG_TEST_RET(card->ctx, r, "APDU transmit failed"); r = sc_check_sw(card, apdu.sw1, apdu.sw2); LOG_TEST_RET(card->ctx, r, "Card returned error"); return r; } static int <API key>(struct sc_card *card, const struct sc_security_env *env, int se_num) { struct sc_apdu apdu; u8 sbuf[<API key>]; u8 *p; int r, locked = 0; if (card == NULL || env == NULL) { return <API key>; } sc_format_apdu(card, &apdu, <API key>, 0x22, 0x41, 0); switch (env->operation) { case <API key>: apdu.p2 = 0xB8; break; case <API key>: apdu.p2 = 0xB6; break; default: return <API key>; } p = sbuf; if (env->flags & <API key>) { *p++ = 0x80; /* algorithm reference */ *p++ = 0x01; *p++ = env->algorithm_ref & 0xFF; } if (env->flags & <API key>) { if (env->file_ref.len > 0xFF) return <API key>; if (sizeof(sbuf) - (p - sbuf) < env->file_ref.len + 2) return <API key>; *p++ = 0x81; *p++ = (u8) env->file_ref.len; memcpy(p, env->file_ref.value, env->file_ref.len); p += env->file_ref.len; } if (env->flags & <API key>) { if (sizeof(sbuf) - (p - sbuf) < env->key_ref_len + 2) return <API key>; if (env->flags & <API key>) *p++ = 0x83; else *p++ = 0x84; if (env->key_ref_len > 0xFF) return <API key>; *p++ = env->key_ref_len & 0xFF; memcpy(p, env->key_ref, env->key_ref_len); p += env->key_ref_len; } r = p - sbuf; apdu.lc = r; apdu.datalen = r; apdu.data = sbuf; if (se_num > 0) { r = sc_lock(card); LOG_TEST_RET(card->ctx, r, "sc_lock() failed"); locked = 1; } if (apdu.datalen != 0) { r = sc_transmit_apdu(card, &apdu); if (r) { sc_log(card->ctx, "%s: APDU transmit failed", sc_strerror(r)); goto err; } r = sc_check_sw(card, apdu.sw1, apdu.sw2); if (r) { sc_log(card->ctx, "%s: Card returned error", sc_strerror(r)); goto err; } } if (se_num <= 0) return 0; sc_format_apdu(card, &apdu, <API key>, 0x22, 0xF2, se_num); r = sc_transmit_apdu(card, &apdu); sc_unlock(card); LOG_TEST_RET(card->ctx, r, "APDU transmit failed"); return sc_check_sw(card, apdu.sw1, apdu.sw2); err: if (locked) sc_unlock(card); return r; } static int <API key>(struct sc_card *card, int se_num) { struct sc_apdu apdu; int r; if (card == NULL) { return <API key>; } sc_format_apdu(card, &apdu, SC_APDU_CASE_1, 0x22, 0xF3, se_num); r = sc_transmit_apdu(card, &apdu); LOG_TEST_RET(card->ctx, r, "APDU transmit failed"); r = sc_check_sw(card, apdu.sw1, apdu.sw2); LOG_TEST_RET(card->ctx, r, "Card returned error"); return r; } static int <API key>(struct sc_card *card, const u8 * data, size_t datalen, u8 * out, size_t outlen) { int r; struct sc_apdu apdu; if (card == NULL || data == NULL || out == NULL) { return <API key>; } LOG_FUNC_CALLED(card->ctx); sc_log(card->ctx, "ISO7816 compute signature: in-len %"<API key>"u, out-len %"<API key>"u", datalen, outlen); /* INS: 0x2A PERFORM SECURITY OPERATION * P1: 0x9E Resp: Digital Signature * P2: 0x9A Cmd: Input for Digital Signature */ sc_format_apdu(card, &apdu, SC_APDU_CASE_4, 0x2A, 0x9E, 0x9A); apdu.resp = out; apdu.resplen = outlen; apdu.le = outlen; apdu.data = data; apdu.lc = datalen; apdu.datalen = datalen; <API key>(card, &apdu); r = sc_transmit_apdu(card, &apdu); LOG_TEST_RET(card->ctx, r, "APDU transmit failed"); if (apdu.sw1 == 0x90 && apdu.sw2 == 0x00) LOG_FUNC_RETURN(card->ctx, apdu.resplen); r = sc_check_sw(card, apdu.sw1, apdu.sw2); LOG_TEST_RET(card->ctx, r, "Card returned error"); LOG_FUNC_RETURN(card->ctx, r); } static int iso7816_decipher(struct sc_card *card, const u8 * crgram, size_t crgram_len, u8 * out, size_t outlen) { int r; struct sc_apdu apdu; u8 *sbuf = NULL; if (card == NULL || crgram == NULL || out == NULL) { return <API key>; } LOG_FUNC_CALLED(card->ctx); sc_log(card->ctx, "ISO7816 decipher: in-len %"<API key>"u, out-len %"<API key>"u", crgram_len, outlen); sbuf = malloc(crgram_len + 1); if (sbuf == NULL) return <API key>; /* INS: 0x2A PERFORM SECURITY OPERATION * P1: 0x80 Resp: Plain value * P2: 0x86 Cmd: Padding indicator byte followed by cryptogram */ sc_format_apdu(card, &apdu, SC_APDU_CASE_4, 0x2A, 0x80, 0x86); apdu.resp = out; apdu.resplen = outlen; apdu.le = outlen; sbuf[0] = 0; /* padding indicator byte, 0x00 = No further indication */ memcpy(sbuf + 1, crgram, crgram_len); apdu.data = sbuf; apdu.lc = crgram_len + 1; apdu.datalen = crgram_len + 1; <API key>(card, &apdu); r = sc_transmit_apdu(card, &apdu); sc_mem_clear(sbuf, crgram_len + 1); free(sbuf); LOG_TEST_RET(card->ctx, r, "APDU transmit failed"); if (apdu.sw1 == 0x90 && apdu.sw2 == 0x00) LOG_FUNC_RETURN(card->ctx, apdu.resplen); else LOG_FUNC_RETURN(card->ctx, sc_check_sw(card, apdu.sw1, apdu.sw2)); } static int <API key>(struct sc_card *card, struct sc_apdu *apdu, struct sc_pin_cmd_data *data, u8 *buf, size_t buf_len) { int r, len = 0, pad = 0, use_pin_pad = 0, ins, p1 = 0; int cse = <API key>; switch (data->pin_type) { case SC_AC_CHV: /* fall through */ case SC_AC_SESSION: case <API key>: break; default: return <API key>; } if (data->flags & <API key>) pad = 1; if (data->flags & <API key>) use_pin_pad = 1; data->pin1.offset = 5; switch (data->cmd) { case SC_PIN_CMD_VERIFY: ins = 0x20; if ((r = sc_build_pin(buf, buf_len, &data->pin1, pad)) < 0) return r; len = r; break; case SC_PIN_CMD_CHANGE: ins = 0x24; if (data->pin1.len != 0 || (use_pin_pad && !( data->flags & <API key>))) { if ((r = sc_build_pin(buf, buf_len, &data->pin1, pad)) < 0) return r; len += r; } else { /* implicit test */ p1 = 1; } data->pin2.offset = data->pin1.offset + len; if ((r = sc_build_pin(buf+len, buf_len-len, &data->pin2, pad)) < 0) return r; /* Special case - where provided the old PIN on the command line * but expect the new one to be entered on the keypad. */ if (data->pin1.len && data->pin2.len == 0) { sc_log(card->ctx, "Special case - initial pin provided - but new pin asked on keypad"); data->flags |= <API key>; }; len += r; break; case SC_PIN_CMD_UNBLOCK: ins = 0x2C; if (data->pin1.len != 0 || (use_pin_pad && !( data->flags & <API key>))) { if ((r = sc_build_pin(buf, buf_len, &data->pin1, pad)) < 0) return r; len += r; } else { p1 |= 0x02; } if (data->pin2.len != 0 || use_pin_pad) { data->pin2.offset = data->pin1.offset + len; if ((r = sc_build_pin(buf+len, buf_len-len, &data->pin2, pad)) < 0) return r; len += r; } else { p1 |= 0x01; } break; case SC_PIN_CMD_GET_INFO: ins = 0x20; /* No data to send or to receive */ cse = SC_APDU_CASE_1; break; default: return <API key>; } sc_format_apdu(card, apdu, cse, ins, p1, data->pin_reference); apdu->lc = len; apdu->datalen = len; apdu->data = buf; apdu->resplen = 0; return 0; } static int iso7816_pin_cmd(struct sc_card *card, struct sc_pin_cmd_data *data, int *tries_left) { struct sc_apdu local_apdu, *apdu; int r; u8 sbuf[<API key>]; data->pin1.tries_left = -1; if (tries_left != NULL) { *tries_left = data->pin1.tries_left; } /* Many cards do support PIN status queries, but some cards don't and * mistakenly count the command as a failed PIN attempt, so for now we * whitelist cards with this flag. In future this may be reduced to a * blacklist, subject to testing more cards. */ if (data->cmd == SC_PIN_CMD_GET_INFO && !(card->caps & <API key>)) { sc_log(card->ctx, "Card does not support PIN status queries"); return <API key>; } /* See if we've been called from another card driver, which is * passing an APDU to us (this allows to write card drivers * whose PIN functions behave "mostly like ISO" except in some * special circumstances. */ if (data->apdu == NULL) { r = <API key>(card, &local_apdu, data, sbuf, sizeof(sbuf)); if (r < 0) return r; data->apdu = &local_apdu; } apdu = data->apdu; if (!(data->flags & <API key>) || data->cmd == SC_PIN_CMD_GET_INFO) { /* Transmit the APDU to the card */ r = sc_transmit_apdu(card, apdu); /* Clear the buffer - it may contain pins */ sc_mem_clear(sbuf, sizeof(sbuf)); } else { /* Call the reader driver to collect * the PIN and pass on the APDU to the card */ if (data->pin1.offset == 0) { sc_log(card->ctx, "Card driver didn't set PIN offset"); return <API key>; } if (card->reader && card->reader->ops && card->reader->ops->perform_verify) { r = card->reader->ops->perform_verify(card->reader, data); /* sw1/sw2 filled in by reader driver */ } else { sc_log(card->ctx, "Card reader driver does not support " "PIN entry through reader key pad"); r = <API key>; } } /* Don't pass references to local variables up to the caller. */ if (data->apdu == &local_apdu) data->apdu = NULL; LOG_TEST_RET(card->ctx, r, "APDU transmit failed"); r = sc_check_sw(card, apdu->sw1, apdu->sw2); if (r == SC_SUCCESS) { data->pin1.logged_in = <API key>; } else if (r == <API key>) { data->pin1.tries_left = apdu->sw2 & 0xF; data->pin1.logged_in = <API key>; if (data->cmd == SC_PIN_CMD_GET_INFO) r = SC_SUCCESS; } else if (r == <API key>) { data->pin1.tries_left = 0; data->pin1.logged_in = <API key>; if (data->cmd == SC_PIN_CMD_GET_INFO) r = SC_SUCCESS; } if (tries_left != NULL) { *tries_left = data->pin1.tries_left; } return r; } static int iso7816_get_data(struct sc_card *card, unsigned int tag, u8 *buf, size_t len) { int r, cse; struct sc_apdu apdu; SC_FUNC_CALLED(card->ctx, <API key>); if (buf && len) cse = SC_APDU_CASE_2; else cse = SC_APDU_CASE_1; sc_format_apdu(card, &apdu, cse, 0xCA, (tag >> 8) & 0xff, tag & 0xff); apdu.le = len; apdu.resp = buf; apdu.resplen = len; r = sc_transmit_apdu(card, &apdu); LOG_TEST_RET(card->ctx, r, "APDU transmit failed"); r = sc_check_sw(card, apdu.sw1, apdu.sw2); LOG_TEST_RET(card->ctx, r, "GET_DATA returned error"); if (apdu.resplen > len) r = <API key>; else r = apdu.resplen; LOG_FUNC_RETURN(card->ctx, r); } static int iso7816_init(struct sc_card *card) { #if ENABLE_SM memset(&card->sm_ctx, 0, sizeof card->sm_ctx); #endif return SC_SUCCESS; } static int no_match(struct sc_card *card) { return 0; } static struct sc_card_operations iso_ops = { no_match, iso7816_init, /* init */ NULL, /* finish */ iso7816_read_binary, <API key>, <API key>, NULL, /* erase_binary */ iso7816_read_record, <API key>, <API key>, <API key>, iso7816_select_file, <API key>, <API key>, NULL, /* verify */ NULL, /* logout */ <API key>, <API key>, iso7816_decipher, <API key>, NULL, /* <API key> */ NULL, /* reset_retry_counter */ iso7816_create_file, iso7816_delete_file, NULL, /* list_files */ iso7816_check_sw, NULL, /* card_ctl */ iso7816_process_fci, <API key>, iso7816_pin_cmd, iso7816_get_data, NULL, /* put_data */ NULL, /* delete_record */ NULL, /* read_public_key */ NULL, /* <API key> */ NULL, /* wrap */ NULL /* unwrap */ }; static struct sc_card_driver iso_driver = { "ISO 7816 reference driver", "iso7816", &iso_ops, NULL, 0, NULL }; struct sc_card_driver * <API key>(void) { return &iso_driver; } #define ISO_READ_BINARY 0xB0 #define ISO_P1_FLAG_SFID 0x80 int <API key>(sc_card_t *card, unsigned char sfid, u8 **ef, size_t *ef_len) { int r; size_t read = <API key>; sc_apdu_t apdu; u8 *p; if (!card || !ef || !ef_len) { r = <API key>; goto err; } *ef_len = 0; #if <API key> > (0xff+1) sc_format_apdu(card, &apdu, SC_APDU_CASE_2_EXT, ISO_READ_BINARY, ISO_P1_FLAG_SFID|sfid, 0); #else sc_format_apdu(card, &apdu, <API key>, ISO_READ_BINARY, ISO_P1_FLAG_SFID|sfid, 0); #endif p = realloc(*ef, read); if (!p) { r = <API key>; goto err; } *ef = p; apdu.resp = *ef; apdu.resplen = read; apdu.le = read; r = sc_transmit_apdu(card, &apdu); if (r < 0) goto err; r = sc_check_sw(card, apdu.sw1, apdu.sw2); if (r < 0 && r != <API key>) goto err; /* emulate the behaviour of sc_read_binary */ r = apdu.resplen; while(1) { if (r >= 0 && ((size_t) r) != read) { *ef_len += r; break; } if (r < 0) { sc_debug(card->ctx, <API key>, "Could not read EF."); goto err; } *ef_len += r; p = realloc(*ef, *ef_len + read); if (!p) { r = <API key>; goto err; } *ef = p; r = sc_read_binary(card, *ef_len, *ef + *ef_len, read, 0); } r = SC_SUCCESS; err: return r; } #define ISO_WRITE_BINARY 0xD0 int <API key>(sc_card_t *card, unsigned char sfid, u8 *ef, size_t ef_len) { int r; size_t write = <API key>, wrote = 0; sc_apdu_t apdu; #ifdef ENABLE_SM struct iso_sm_ctx *iso_sm_ctx; #endif if (!card) { r = <API key>; goto err; } #ifdef ENABLE_SM iso_sm_ctx = card->sm_ctx.info.cmd_data; if (write > <API key> || (card->sm_ctx.sm_mode == SM_MODE_TRANSMIT && write > (((<API key> /* for encrypted APDUs we usually get authenticated status * bytes (4B), a MAC (11B) and a cryptogram with padding * indicator (3B without data). The cryptogram is always * padded to the block size. */ -18) / iso_sm_ctx->block_length) * iso_sm_ctx->block_length - 1))) sc_format_apdu(card, &apdu, SC_APDU_CASE_3_EXT, ISO_WRITE_BINARY, ISO_P1_FLAG_SFID|sfid, 0); else #endif sc_format_apdu(card, &apdu, <API key>, ISO_WRITE_BINARY, ISO_P1_FLAG_SFID|sfid, 0); if (write > ef_len) { apdu.datalen = ef_len; apdu.lc = ef_len; } else { apdu.datalen = write; apdu.lc = write; } apdu.data = ef; r = sc_transmit_apdu(card, &apdu); /* emulate the behaviour of sc_write_binary */ if (r >= 0) r = apdu.datalen; while (1) { if (r < 0 || ((size_t) r) > ef_len) { sc_debug(card->ctx, <API key>, "Could not write EF."); goto err; } wrote += r; apdu.data += r; if (wrote >= ef_len) break; r = sc_write_binary(card, wrote, ef, write, 0); } r = SC_SUCCESS; err: return r; } #define ISO_UPDATE_BINARY 0xD6 int <API key>(sc_card_t *card, unsigned char sfid, u8 *ef, size_t ef_len) { int r; size_t write = <API key>, wrote = 0; sc_apdu_t apdu; #ifdef ENABLE_SM struct iso_sm_ctx *iso_sm_ctx; #endif if (!card) { r = <API key>; goto err; } #ifdef ENABLE_SM iso_sm_ctx = card->sm_ctx.info.cmd_data; if (write > <API key> || (card->sm_ctx.sm_mode == SM_MODE_TRANSMIT && write > (((<API key> /* for encrypted APDUs we usually get authenticated status * bytes (4B), a MAC (11B) and a cryptogram with padding * indicator (3B without data). The cryptogram is always * padded to the block size. */ -18) / iso_sm_ctx->block_length) * iso_sm_ctx->block_length - 1))) sc_format_apdu(card, &apdu, SC_APDU_CASE_3_EXT, ISO_UPDATE_BINARY, ISO_P1_FLAG_SFID|sfid, 0); else #endif sc_format_apdu(card, &apdu, <API key>, ISO_UPDATE_BINARY, ISO_P1_FLAG_SFID|sfid, 0); if (write > ef_len) { apdu.datalen = ef_len; apdu.lc = ef_len; } else { apdu.datalen = write; apdu.lc = write; } apdu.data = ef; r = sc_transmit_apdu(card, &apdu); /* emulate the behaviour of sc_write_binary */ if (r >= 0) r = apdu.datalen; while (1) { if (r < 0 || ((size_t) r) > ef_len) { sc_debug(card->ctx, <API key>, "Could not update EF."); goto err; } wrote += r; apdu.data += r; if (wrote >= ef_len) break; r = sc_update_binary(card, wrote, ef, write, 0); } r = SC_SUCCESS; err: return r; } int iso7816_logout(sc_card_t *card, unsigned char pin_reference) { int r; sc_apdu_t apdu; sc_format_apdu_ex(card, &apdu, 0x20, 0xFF, pin_reference, NULL, 0, NULL, 0); r = sc_transmit_apdu(card, &apdu); if (r < 0) return r; r = sc_check_sw(card, apdu.sw1, apdu.sw2); return r; }
// from project #include "doofit/builder/bobthebuilder/Pdfs/Common/AbsDimensionReal.h" #include "doocore/io/MsgStream.h" // from STL #include <iostream> #include <string> // from RooFit #include "RooRealVar.h" #include "RooWorkspace.h" namespace doofit { using namespace std; using namespace boost::property_tree; using namespace RooFit; using namespace doocore::io; namespace builder{ namespace bobthebuilder{ AbsDimensionReal::AbsDimensionReal() : AbsDimension() , val_min_(0) , val_max_(0) , unit_("DummyUnit") { } AbsDimensionReal::~AbsDimensionReal(){} void AbsDimensionReal::Initialize( const boost::property_tree::ptree::value_type &pt_head ){ dim_id_ = pt_head.second.get_value<string>(); sinfo << pt_head.first << " \"" << dim_id_ << "\"" << endmsg; sinfo << "{" << endmsg; sinfo.increment_indent(+2); ptree pt = pt_head.second; name_ = pt.get<string>("name",string("var")+dim_id_); desc_ = pt.get<string>("desc"); val_min_ = pt.get<double>("val_min"); val_max_ = pt.get<double>("val_max"); unit_ = pt.get<string>("unit"); sinfo << "name \"" << name_ << "\"" << endmsg; sinfo << "desc \"" << desc_ << "\"" << endmsg; sinfo << "val_min \"" << val_min_ << "\"" << endmsg; sinfo << "val_max \"" << val_max_ << "\"" << endmsg; sinfo << "unit \"" << unit_ << "\"" << endmsg; sinfo.increment_indent(-2); sinfo << "}" << endmsg; } bool AbsDimensionReal::AddToWorkspace( RooWorkspace& ws ){ RooRealVar dim_temp(name_.c_str(), desc_.c_str(), val_min_, val_max_, unit_.c_str()); // Check if object with this name exists on workspace, else create one. if (ws.obj(name_.c_str()) != NULL){ cout << "AbsDimensionReal tried to add already existing dimension variable with name '" << name_ << "' to the workspace! FAILED." << endl; throw; } else{ ws.import(dim_temp); } return true; } }} }
@import url("bootstrap.css"); @import url("application.css"); @import url("<API key>.css"); @import url("prettify.css"); @import url("editor.css"); @import url("prettyPhoto.css"); @import url("improptmu.css"); @import url("inline.css");
/** * @file * H.264 / AVC / MPEG4 part10 loop filter. * @author Michael Niedermayer <michaelni@gmx.at> */ #include "libavutil/internal.h" #include "libavutil/intreadwrite.h" #include "internal.h" #include "avcodec.h" #include "mpegvideo.h" #include "h264.h" #include "mathops.h" #include "rectangle.h" /* Deblocking filter (p153) */ static const uint8_t alpha_table[52*3] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 5, 6, 7, 8, 9, 10, 12, 13, 15, 17, 20, 22, 25, 28, 32, 36, 40, 45, 50, 56, 63, 71, 80, 90,101,113,127,144,162,182,203,226, 255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,255,255,255,255, }; static const uint8_t beta_table[52*3] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, }; static const uint8_t tc0_table[52*3][4] = { {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 1 }, {-1, 0, 0, 1 }, {-1, 0, 0, 1 }, {-1, 0, 0, 1 }, {-1, 0, 1, 1 }, {-1, 0, 1, 1 }, {-1, 1, 1, 1 }, {-1, 1, 1, 1 }, {-1, 1, 1, 1 }, {-1, 1, 1, 1 }, {-1, 1, 1, 2 }, {-1, 1, 1, 2 }, {-1, 1, 1, 2 }, {-1, 1, 1, 2 }, {-1, 1, 2, 3 }, {-1, 1, 2, 3 }, {-1, 2, 2, 3 }, {-1, 2, 2, 4 }, {-1, 2, 3, 4 }, {-1, 2, 3, 4 }, {-1, 3, 3, 5 }, {-1, 3, 4, 6 }, {-1, 3, 4, 6 }, {-1, 4, 5, 7 }, {-1, 4, 5, 8 }, {-1, 4, 6, 9 }, {-1, 5, 7,10 }, {-1, 6, 8,11 }, {-1, 6, 8,13 }, {-1, 7,10,14 }, {-1, 8,11,16 }, {-1, 9,12,18 }, {-1,10,13,20 }, {-1,11,15,23 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, }; /* intra: 0 if this loopfilter call is guaranteed to be inter (bS < 4), 1 if it might be intra (bS == 4) */ static av_always_inline void filter_mb_edgev(uint8_t *pix, int stride, const int16_t bS[4], unsigned int qp, int a, int b, H264Context *h, int intra) { const unsigned int index_a = qp + a; const int alpha = alpha_table[index_a]; const int beta = beta_table[qp + b]; if (alpha ==0 || beta == 0) return; if( bS[0] < 4 || !intra ) { int8_t tc[4]; tc[0] = tc0_table[index_a][bS[0]]; tc[1] = tc0_table[index_a][bS[1]]; tc[2] = tc0_table[index_a][bS[2]]; tc[3] = tc0_table[index_a][bS[3]]; h->h264dsp.<API key>(pix, stride, alpha, beta, tc); } else { h->h264dsp.<API key>(pix, stride, alpha, beta); } } static av_always_inline void filter_mb_edgecv(uint8_t *pix, int stride, const int16_t bS[4], unsigned int qp, int a, int b, H264Context *h, int intra) { const unsigned int index_a = qp + a; const int alpha = alpha_table[index_a]; const int beta = beta_table[qp + b]; if (alpha ==0 || beta == 0) return; if( bS[0] < 4 || !intra ) { int8_t tc[4]; tc[0] = tc0_table[index_a][bS[0]]+1; tc[1] = tc0_table[index_a][bS[1]]+1; tc[2] = tc0_table[index_a][bS[2]]+1; tc[3] = tc0_table[index_a][bS[3]]+1; h->h264dsp.<API key>(pix, stride, alpha, beta, tc); } else { h->h264dsp.<API key>(pix, stride, alpha, beta); } } static av_always_inline void <API key>(H264Context *h, uint8_t *pix, int stride, const int16_t bS[7], int bsi, int qp, int a, int b, int intra) { const unsigned int index_a = qp + a; const int alpha = alpha_table[index_a]; const int beta = beta_table[qp + b]; if (alpha ==0 || beta == 0) return; if( bS[0] < 4 || !intra ) { int8_t tc[4]; tc[0] = tc0_table[index_a][bS[0*bsi]]; tc[1] = tc0_table[index_a][bS[1*bsi]]; tc[2] = tc0_table[index_a][bS[2*bsi]]; tc[3] = tc0_table[index_a][bS[3*bsi]]; h->h264dsp.<API key>(pix, stride, alpha, beta, tc); } else { h->h264dsp.<API key>(pix, stride, alpha, beta); } } static av_always_inline void <API key>(H264Context *h, uint8_t *pix, int stride, const int16_t bS[7], int bsi, int qp, int a, int b, int intra) { const unsigned int index_a = qp + a; const int alpha = alpha_table[index_a]; const int beta = beta_table[qp + b]; if (alpha ==0 || beta == 0) return; if( bS[0] < 4 || !intra ) { int8_t tc[4]; tc[0] = tc0_table[index_a][bS[0*bsi]] + 1; tc[1] = tc0_table[index_a][bS[1*bsi]] + 1; tc[2] = tc0_table[index_a][bS[2*bsi]] + 1; tc[3] = tc0_table[index_a][bS[3*bsi]] + 1; h->h264dsp.<API key>(pix, stride, alpha, beta, tc); } else { h->h264dsp.<API key>(pix, stride, alpha, beta); } } static av_always_inline void filter_mb_edgeh(uint8_t *pix, int stride, const int16_t bS[4], unsigned int qp, int a, int b, H264Context *h, int intra) { const unsigned int index_a = qp + a; const int alpha = alpha_table[index_a]; const int beta = beta_table[qp + b]; if (alpha ==0 || beta == 0) return; if( bS[0] < 4 || !intra ) { int8_t tc[4]; tc[0] = tc0_table[index_a][bS[0]]; tc[1] = tc0_table[index_a][bS[1]]; tc[2] = tc0_table[index_a][bS[2]]; tc[3] = tc0_table[index_a][bS[3]]; h->h264dsp.<API key>(pix, stride, alpha, beta, tc); } else { h->h264dsp.<API key>(pix, stride, alpha, beta); } } static av_always_inline void filter_mb_edgech(uint8_t *pix, int stride, const int16_t bS[4], unsigned int qp, int a, int b, H264Context *h, int intra) { const unsigned int index_a = qp + a; const int alpha = alpha_table[index_a]; const int beta = beta_table[qp + b]; if (alpha ==0 || beta == 0) return; if( bS[0] < 4 || !intra ) { int8_t tc[4]; tc[0] = tc0_table[index_a][bS[0]]+1; tc[1] = tc0_table[index_a][bS[1]]+1; tc[2] = tc0_table[index_a][bS[2]]+1; tc[3] = tc0_table[index_a][bS[3]]+1; h->h264dsp.<API key>(pix, stride, alpha, beta, tc); } else { h->h264dsp.<API key>(pix, stride, alpha, beta); } } static av_always_inline void <API key>(H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize, int pixel_shift) { MpegEncContext * const s = &h->s; int chroma = CHROMA && !(CONFIG_GRAY && (s->flags&CODEC_FLAG_GRAY)); int chroma444 = CHROMA444; int chroma422 = CHROMA422; int mb_xy = h->mb_xy; int left_type= h->left_type[LTOP]; int top_type= h->top_type; int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8); int a = h-><API key> - qp_bd_offset; int b = h->slice_beta_offset - qp_bd_offset; int mb_type = s->current_picture.f.mb_type[mb_xy]; int qp = s->current_picture.f.qscale_table[mb_xy]; int qp0 = s->current_picture.f.qscale_table[mb_xy - 1]; int qp1 = s->current_picture.f.qscale_table[h->top_mb_xy]; int qpc = get_chroma_qp( h, 0, qp ); int qpc0 = get_chroma_qp( h, 0, qp0 ); int qpc1 = get_chroma_qp( h, 0, qp1 ); qp0 = (qp + qp0 + 1) >> 1; qp1 = (qp + qp1 + 1) >> 1; qpc0 = (qpc + qpc0 + 1) >> 1; qpc1 = (qpc + qpc1 + 1) >> 1; if( IS_INTRA(mb_type) ) { static const int16_t bS4[4] = {4,4,4,4}; static const int16_t bS3[4] = {3,3,3,3}; const int16_t *bSH = FIELD_PICTURE ? bS3 : bS4; if(left_type) filter_mb_edgev( &img_y[4*0<<pixel_shift], linesize, bS4, qp0, a, b, h, 1); if( IS_8x8DCT(mb_type) ) { filter_mb_edgev( &img_y[4*2<<pixel_shift], linesize, bS3, qp, a, b, h, 0); if(top_type){ filter_mb_edgeh( &img_y[4*0*linesize], linesize, bSH, qp1, a, b, h, 1); } filter_mb_edgeh( &img_y[4*2*linesize], linesize, bS3, qp, a, b, h, 0); } else { filter_mb_edgev( &img_y[4*1<<pixel_shift], linesize, bS3, qp, a, b, h, 0); filter_mb_edgev( &img_y[4*2<<pixel_shift], linesize, bS3, qp, a, b, h, 0); filter_mb_edgev( &img_y[4*3<<pixel_shift], linesize, bS3, qp, a, b, h, 0); if(top_type){ filter_mb_edgeh( &img_y[4*0*linesize], linesize, bSH, qp1, a, b, h, 1); } filter_mb_edgeh( &img_y[4*1*linesize], linesize, bS3, qp, a, b, h, 0); filter_mb_edgeh( &img_y[4*2*linesize], linesize, bS3, qp, a, b, h, 0); filter_mb_edgeh( &img_y[4*3*linesize], linesize, bS3, qp, a, b, h, 0); } if(chroma){ if(chroma444){ if(left_type){ filter_mb_edgev( &img_cb[4*0<<pixel_shift], linesize, bS4, qpc0, a, b, h, 1); filter_mb_edgev( &img_cr[4*0<<pixel_shift], linesize, bS4, qpc0, a, b, h, 1); } if( IS_8x8DCT(mb_type) ) { filter_mb_edgev( &img_cb[4*2<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgev( &img_cr[4*2<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); if(top_type){ filter_mb_edgeh( &img_cb[4*0*linesize], linesize, bSH, qpc1, a, b, h, 1 ); filter_mb_edgeh( &img_cr[4*0*linesize], linesize, bSH, qpc1, a, b, h, 1 ); } filter_mb_edgeh( &img_cb[4*2*linesize], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgeh( &img_cr[4*2*linesize], linesize, bS3, qpc, a, b, h, 0); } else { filter_mb_edgev( &img_cb[4*1<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgev( &img_cr[4*1<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgev( &img_cb[4*2<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgev( &img_cr[4*2<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgev( &img_cb[4*3<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgev( &img_cr[4*3<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); if(top_type){ filter_mb_edgeh( &img_cb[4*0*linesize], linesize, bSH, qpc1, a, b, h, 1); filter_mb_edgeh( &img_cr[4*0*linesize], linesize, bSH, qpc1, a, b, h, 1); } filter_mb_edgeh( &img_cb[4*1*linesize], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgeh( &img_cr[4*1*linesize], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgeh( &img_cb[4*2*linesize], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgeh( &img_cr[4*2*linesize], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgeh( &img_cb[4*3*linesize], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgeh( &img_cr[4*3*linesize], linesize, bS3, qpc, a, b, h, 0); } }else if(chroma422){ if(left_type){ filter_mb_edgecv(&img_cb[2*0<<pixel_shift], uvlinesize, bS4, qpc0, a, b, h, 1); filter_mb_edgecv(&img_cr[2*0<<pixel_shift], uvlinesize, bS4, qpc0, a, b, h, 1); } filter_mb_edgecv(&img_cb[2*2<<pixel_shift], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgecv(&img_cr[2*2<<pixel_shift], uvlinesize, bS3, qpc, a, b, h, 0); if(top_type){ filter_mb_edgech(&img_cb[4*0*uvlinesize], uvlinesize, bSH, qpc1, a, b, h, 1); filter_mb_edgech(&img_cr[4*0*uvlinesize], uvlinesize, bSH, qpc1, a, b, h, 1); } filter_mb_edgech(&img_cb[4*1*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgech(&img_cr[4*1*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgech(&img_cb[4*2*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgech(&img_cr[4*2*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgech(&img_cb[4*3*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgech(&img_cr[4*3*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); }else{ if(left_type){ filter_mb_edgecv( &img_cb[2*0<<pixel_shift], uvlinesize, bS4, qpc0, a, b, h, 1); filter_mb_edgecv( &img_cr[2*0<<pixel_shift], uvlinesize, bS4, qpc0, a, b, h, 1); } filter_mb_edgecv( &img_cb[2*2<<pixel_shift], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgecv( &img_cr[2*2<<pixel_shift], uvlinesize, bS3, qpc, a, b, h, 0); if(top_type){ filter_mb_edgech( &img_cb[2*0*uvlinesize], uvlinesize, bSH, qpc1, a, b, h, 1); filter_mb_edgech( &img_cr[2*0*uvlinesize], uvlinesize, bSH, qpc1, a, b, h, 1); } filter_mb_edgech( &img_cb[2*2*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgech( &img_cr[2*2*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); } } return; } else { LOCAL_ALIGNED_8(int16_t, bS, [2], [4][4]); int edges; if( IS_8x8DCT(mb_type) && (h->cbp&7) == 7 && !chroma444 ) { edges = 4; AV_WN64A(bS[0][0], <API key>); AV_WN64A(bS[0][2], <API key>); AV_WN64A(bS[1][0], <API key>); AV_WN64A(bS[1][2], <API key>); } else { int mask_edge1 = (3*(((5*mb_type)>>5)&1)) | (mb_type>>4); //(mb_type & (MB_TYPE_16x16 | MB_TYPE_8x16)) ? 3 : (mb_type & MB_TYPE_16x8) ? 1 : 0; int mask_edge0 = 3*((mask_edge1>>1) & ((5*left_type)>>5)&1); // (mb_type & (MB_TYPE_16x16 | MB_TYPE_8x16)) && (h->left_type[LTOP] & (MB_TYPE_16x16 | MB_TYPE_8x16)) ? 3 : 0; int step = 1+(mb_type>>24); //IS_8x8DCT(mb_type) ? 2 : 1; edges = 4 - 3*((mb_type>>3) & !(h->cbp & 15)); //(mb_type & MB_TYPE_16x16) && !(h->cbp & 15) ? 1 : 4; h->h264dsp.<API key>( bS, h-><API key>, h->ref_cache, h->mv_cache, h->list_count==2, edges, step, mask_edge0, mask_edge1, FIELD_PICTURE); } if( IS_INTRA(left_type) ) AV_WN64A(bS[0][0], <API key>); if( IS_INTRA(top_type) ) AV_WN64A(bS[1][0], FIELD_PICTURE ? <API key> : <API key>); #define FILTER(hv,dir,edge,intra)\ if(AV_RN64A(bS[dir][edge])) { \ filter_mb_edge##hv( &img_y[4*edge*(dir?linesize:1<<pixel_shift)], linesize, bS[dir][edge], edge ? qp : qp##dir, a, b, h, intra );\ if(chroma){\ if(chroma444){\ filter_mb_edge##hv( &img_cb[4*edge*(dir?linesize:1<<pixel_shift)], linesize, bS[dir][edge], edge ? qpc : qpc##dir, a, b, h, intra );\ filter_mb_edge##hv( &img_cr[4*edge*(dir?linesize:1<<pixel_shift)], linesize, bS[dir][edge], edge ? qpc : qpc##dir, a, b, h, intra );\ } else if(!(edge&1)) {\ filter_mb_edgec##hv( &img_cb[2*edge*(dir?uvlinesize:1<<pixel_shift)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir, a, b, h, intra );\ filter_mb_edgec##hv( &img_cr[2*edge*(dir?uvlinesize:1<<pixel_shift)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir, a, b, h, intra );\ }\ }\ } if(left_type) FILTER(v,0,0,1); if( edges == 1 ) { if(top_type) FILTER(h,1,0,1); } else if( IS_8x8DCT(mb_type) ) { FILTER(v,0,2,0); if(top_type) FILTER(h,1,0,1); FILTER(h,1,2,0); } else { FILTER(v,0,1,0); FILTER(v,0,2,0); FILTER(v,0,3,0); if(top_type) FILTER(h,1,0,1); FILTER(h,1,1,0); FILTER(h,1,2,0); FILTER(h,1,3,0); } #undef FILTER } } void <API key>( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize) { av_assert2(!FRAME_MBAFF); if(!h->h264dsp.<API key> || h->pps.chroma_qp_diff) { ff_h264_filter_mb(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize); return; } #if CONFIG_SMALL <API key>(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize, h->pixel_shift); #else if(h->pixel_shift){ <API key>(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize, 1); }else{ <API key>(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize, 0); } #endif } static int check_mv(H264Context *h, long b_idx, long bn_idx, int mvy_limit){ int v; v= h->ref_cache[0][b_idx] != h->ref_cache[0][bn_idx]; if(!v && h->ref_cache[0][b_idx]!=-1) v= h->mv_cache[0][b_idx][0] - h->mv_cache[0][bn_idx][0] + 3 >= 7U | FFABS( h->mv_cache[0][b_idx][1] - h->mv_cache[0][bn_idx][1] ) >= mvy_limit; if(h->list_count==2){ if(!v) v = h->ref_cache[1][b_idx] != h->ref_cache[1][bn_idx] | h->mv_cache[1][b_idx][0] - h->mv_cache[1][bn_idx][0] + 3 >= 7U | FFABS( h->mv_cache[1][b_idx][1] - h->mv_cache[1][bn_idx][1] ) >= mvy_limit; if(v){ if(h->ref_cache[0][b_idx] != h->ref_cache[1][bn_idx] | h->ref_cache[1][b_idx] != h->ref_cache[0][bn_idx]) return 1; return h->mv_cache[0][b_idx][0] - h->mv_cache[1][bn_idx][0] + 3 >= 7U | FFABS( h->mv_cache[0][b_idx][1] - h->mv_cache[1][bn_idx][1] ) >= mvy_limit | h->mv_cache[1][b_idx][0] - h->mv_cache[0][bn_idx][0] + 3 >= 7U | FFABS( h->mv_cache[1][b_idx][1] - h->mv_cache[0][bn_idx][1] ) >= mvy_limit; } } return v; } static av_always_inline void filter_mb_dir(H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize, int mb_xy, int mb_type, int mvy_limit, int <API key>, int a, int b, int chroma, int dir) { MpegEncContext * const s = &h->s; int edge; int chroma_qp_avg[2]; int chroma444 = CHROMA444; int chroma422 = CHROMA422; const int mbm_xy = dir == 0 ? mb_xy -1 : h->top_mb_xy; const int mbm_type = dir == 0 ? h->left_type[LTOP] : h->top_type; // how often to recheck mv-based bS when iterating between edges static const uint8_t mask_edge_tab[2][8]={{0,3,3,3,1,1,1,1}, {0,3,1,1,3,3,3,3}}; const int mask_edge = mask_edge_tab[dir][(mb_type>>3)&7]; const int edges = mask_edge== 3 && !(h->cbp&15) ? 1 : 4; // how often to recheck mv-based bS when iterating along each edge const int mask_par0 = mb_type & (MB_TYPE_16x16 | (MB_TYPE_8x16 >> dir)); if(mbm_type && !<API key>){ if (FRAME_MBAFF && (dir == 1) && ((mb_y&1) == 0) && IS_INTERLACED(mbm_type&~mb_type) ) { // This is a special case in the norm where the filtering must // be done twice (one each of the field) even if we are in a // frame macroblock. unsigned int tmp_linesize = 2 * linesize; unsigned int tmp_uvlinesize = 2 * uvlinesize; int mbn_xy = mb_xy - 2 * s->mb_stride; int j; for(j=0; j<2; j++, mbn_xy += s->mb_stride){ DECLARE_ALIGNED(8, int16_t, bS)[4]; int qp; if (IS_INTRA(mb_type | s->current_picture.f.mb_type[mbn_xy])) { AV_WN64A(bS, <API key>); } else { if (!CABAC && IS_8x8DCT(s->current_picture.f.mb_type[mbn_xy])) { bS[0]= 1+((h->cbp_table[mbn_xy] & 0x4000)||h-><API key>[scan8[0]+0]); bS[1]= 1+((h->cbp_table[mbn_xy] & 0x4000)||h-><API key>[scan8[0]+1]); bS[2]= 1+((h->cbp_table[mbn_xy] & 0x8000)||h-><API key>[scan8[0]+2]); bS[3]= 1+((h->cbp_table[mbn_xy] & 0x8000)||h-><API key>[scan8[0]+3]); }else{ const uint8_t *mbn_nnz = h->non_zero_count[mbn_xy] + 3*4; int i; for( i = 0; i < 4; i++ ) { bS[i] = 1 + !!(h-><API key>[scan8[0]+i] | mbn_nnz[i]); } } } // Do not use s->qscale as luma quantizer because it has not the same // value in IPCM macroblocks. qp = (s->current_picture.f.qscale_table[mb_xy] + s->current_picture.f.qscale_table[mbn_xy] + 1) >> 1; tprintf(s->avctx, "filter mb:%d/%d dir:%d edge:%d, QPy:%d ls:%d uvls:%d", mb_x, mb_y, dir, edge, qp, tmp_linesize, tmp_uvlinesize); { int i; for (i = 0; i < 4; i++) tprintf(s->avctx, " bS[%d]:%d", i, bS[i]); tprintf(s->avctx, "\n"); } filter_mb_edgeh( &img_y[j*linesize], tmp_linesize, bS, qp, a, b, h, 0 ); chroma_qp_avg[0] = (h->chroma_qp[0] + get_chroma_qp(h, 0, s->current_picture.f.qscale_table[mbn_xy]) + 1) >> 1; chroma_qp_avg[1] = (h->chroma_qp[1] + get_chroma_qp(h, 1, s->current_picture.f.qscale_table[mbn_xy]) + 1) >> 1; if (chroma) { if (chroma444) { filter_mb_edgeh (&img_cb[j*uvlinesize], tmp_uvlinesize, bS, chroma_qp_avg[0], a, b, h, 0); filter_mb_edgeh (&img_cr[j*uvlinesize], tmp_uvlinesize, bS, chroma_qp_avg[1], a, b, h, 0); } else { filter_mb_edgech(&img_cb[j*uvlinesize], tmp_uvlinesize, bS, chroma_qp_avg[0], a, b, h, 0); filter_mb_edgech(&img_cr[j*uvlinesize], tmp_uvlinesize, bS, chroma_qp_avg[1], a, b, h, 0); } } } }else{ DECLARE_ALIGNED(8, int16_t, bS)[4]; int qp; if( IS_INTRA(mb_type|mbm_type)) { AV_WN64A(bS, <API key>); if ( (!IS_INTERLACED(mb_type|mbm_type)) || ((FRAME_MBAFF || (s->picture_structure != PICT_FRAME)) && (dir == 0)) ) AV_WN64A(bS, <API key>); } else { int i; int mv_done; if( dir && FRAME_MBAFF && IS_INTERLACED(mb_type ^ mbm_type)) { AV_WN64A(bS, <API key>); mv_done = 1; } else if( mask_par0 && ((mbm_type & (MB_TYPE_16x16 | (MB_TYPE_8x16 >> dir)))) ) { int b_idx= 8 + 4; int bn_idx= b_idx - (dir ? 8:1); bS[0] = bS[1] = bS[2] = bS[3] = check_mv(h, 8 + 4, bn_idx, mvy_limit); mv_done = 1; } else mv_done = 0; for( i = 0; i < 4; i++ ) { int x = dir == 0 ? 0 : i; int y = dir == 0 ? i : 0; int b_idx= 8 + 4 + x + 8*y; int bn_idx= b_idx - (dir ? 8:1); if( h-><API key>[b_idx] | h-><API key>[bn_idx] ) { bS[i] = 2; } else if(!mv_done) { bS[i] = check_mv(h, b_idx, bn_idx, mvy_limit); } } } /* Filter edge */ // Do not use s->qscale as luma quantizer because it has not the same // value in IPCM macroblocks. if(bS[0]+bS[1]+bS[2]+bS[3]){ qp = (s->current_picture.f.qscale_table[mb_xy] + s->current_picture.f.qscale_table[mbm_xy] + 1) >> 1; //tprintf(s->avctx, "filter mb:%d/%d dir:%d edge:%d, QPy:%d, QPc:%d, QPcn:%d\n", mb_x, mb_y, dir, edge, qp, h->chroma_qp[0], s->current_picture.qscale_table[mbn_xy]); tprintf(s->avctx, "filter mb:%d/%d dir:%d edge:%d, QPy:%d ls:%d uvls:%d", mb_x, mb_y, dir, edge, qp, linesize, uvlinesize); //{ int i; for (i = 0; i < 4; i++) tprintf(s->avctx, " bS[%d]:%d", i, bS[i]); tprintf(s->avctx, "\n"); } chroma_qp_avg[0] = (h->chroma_qp[0] + get_chroma_qp(h, 0, s->current_picture.f.qscale_table[mbm_xy]) + 1) >> 1; chroma_qp_avg[1] = (h->chroma_qp[1] + get_chroma_qp(h, 1, s->current_picture.f.qscale_table[mbm_xy]) + 1) >> 1; if( dir == 0 ) { filter_mb_edgev( &img_y[0], linesize, bS, qp, a, b, h, 1 ); if (chroma) { if (chroma444) { filter_mb_edgev ( &img_cb[0], uvlinesize, bS, chroma_qp_avg[0], a, b, h, 1); filter_mb_edgev ( &img_cr[0], uvlinesize, bS, chroma_qp_avg[1], a, b, h, 1); } else { filter_mb_edgecv( &img_cb[0], uvlinesize, bS, chroma_qp_avg[0], a, b, h, 1); filter_mb_edgecv( &img_cr[0], uvlinesize, bS, chroma_qp_avg[1], a, b, h, 1); } } } else { filter_mb_edgeh( &img_y[0], linesize, bS, qp, a, b, h, 1 ); if (chroma) { if (chroma444) { filter_mb_edgeh ( &img_cb[0], uvlinesize, bS, chroma_qp_avg[0], a, b, h, 1); filter_mb_edgeh ( &img_cr[0], uvlinesize, bS, chroma_qp_avg[1], a, b, h, 1); } else { filter_mb_edgech( &img_cb[0], uvlinesize, bS, chroma_qp_avg[0], a, b, h, 1); filter_mb_edgech( &img_cr[0], uvlinesize, bS, chroma_qp_avg[1], a, b, h, 1); } } } } } } /* Calculate bS */ for( edge = 1; edge < edges; edge++ ) { DECLARE_ALIGNED(8, int16_t, bS)[4]; int qp; const int deblock_edge = !IS_8x8DCT(mb_type & (edge<<24)); // (edge&1) && IS_8x8DCT(mb_type) if (!deblock_edge && (!chroma422 || dir == 0)) continue; if( IS_INTRA(mb_type)) { AV_WN64A(bS, <API key>); } else { int i; int mv_done; if( edge & mask_edge ) { AV_ZERO64(bS); mv_done = 1; } else if( mask_par0 ) { int b_idx= 8 + 4 + edge * (dir ? 8:1); int bn_idx= b_idx - (dir ? 8:1); bS[0] = bS[1] = bS[2] = bS[3] = check_mv(h, b_idx, bn_idx, mvy_limit); mv_done = 1; } else mv_done = 0; for( i = 0; i < 4; i++ ) { int x = dir == 0 ? edge : i; int y = dir == 0 ? i : edge; int b_idx= 8 + 4 + x + 8*y; int bn_idx= b_idx - (dir ? 8:1); if( h-><API key>[b_idx] | h-><API key>[bn_idx] ) { bS[i] = 2; } else if(!mv_done) { bS[i] = check_mv(h, b_idx, bn_idx, mvy_limit); } } if(bS[0]+bS[1]+bS[2]+bS[3] == 0) continue; } /* Filter edge */ // Do not use s->qscale as luma quantizer because it has not the same // value in IPCM macroblocks. qp = s->current_picture.f.qscale_table[mb_xy]; //tprintf(s->avctx, "filter mb:%d/%d dir:%d edge:%d, QPy:%d, QPc:%d, QPcn:%d\n", mb_x, mb_y, dir, edge, qp, h->chroma_qp[0], s->current_picture.qscale_table[mbn_xy]); tprintf(s->avctx, "filter mb:%d/%d dir:%d edge:%d, QPy:%d ls:%d uvls:%d", mb_x, mb_y, dir, edge, qp, linesize, uvlinesize); //{ int i; for (i = 0; i < 4; i++) tprintf(s->avctx, " bS[%d]:%d", i, bS[i]); tprintf(s->avctx, "\n"); } if( dir == 0 ) { filter_mb_edgev( &img_y[4*edge << h->pixel_shift], linesize, bS, qp, a, b, h, 0 ); if (chroma) { if (chroma444) { filter_mb_edgev ( &img_cb[4*edge << h->pixel_shift], uvlinesize, bS, h->chroma_qp[0], a, b, h, 0); filter_mb_edgev ( &img_cr[4*edge << h->pixel_shift], uvlinesize, bS, h->chroma_qp[1], a, b, h, 0); } else if( (edge&1) == 0 ) { filter_mb_edgecv( &img_cb[2*edge << h->pixel_shift], uvlinesize, bS, h->chroma_qp[0], a, b, h, 0); filter_mb_edgecv( &img_cr[2*edge << h->pixel_shift], uvlinesize, bS, h->chroma_qp[1], a, b, h, 0); } } } else { if (chroma422) { if (deblock_edge) filter_mb_edgeh(&img_y[4*edge*linesize], linesize, bS, qp, a, b, h, 0); if (chroma) { filter_mb_edgech(&img_cb[4*edge*uvlinesize], uvlinesize, bS, h->chroma_qp[0], a, b, h, 0); filter_mb_edgech(&img_cr[4*edge*uvlinesize], uvlinesize, bS, h->chroma_qp[1], a, b, h, 0); } } else { filter_mb_edgeh(&img_y[4*edge*linesize], linesize, bS, qp, a, b, h, 0); if (chroma) { if (chroma444) { filter_mb_edgeh (&img_cb[4*edge*uvlinesize], uvlinesize, bS, h->chroma_qp[0], a, b, h, 0); filter_mb_edgeh (&img_cr[4*edge*uvlinesize], uvlinesize, bS, h->chroma_qp[1], a, b, h, 0); } else if ((edge&1) == 0) { filter_mb_edgech(&img_cb[2*edge*uvlinesize], uvlinesize, bS, h->chroma_qp[0], a, b, h, 0); filter_mb_edgech(&img_cr[2*edge*uvlinesize], uvlinesize, bS, h->chroma_qp[1], a, b, h, 0); } } } } } } void ff_h264_filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize) { MpegEncContext * const s = &h->s; const int mb_xy= mb_x + mb_y*s->mb_stride; const int mb_type = s->current_picture.f.mb_type[mb_xy]; const int mvy_limit = IS_INTERLACED(mb_type) ? 2 : 4; int <API key> = 0; av_unused int dir; int chroma = CHROMA && !(CONFIG_GRAY && (s->flags&CODEC_FLAG_GRAY)); int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8); int a = h-><API key> - qp_bd_offset; int b = h->slice_beta_offset - qp_bd_offset; if (FRAME_MBAFF // and current and left pair do not have the same interlaced type && IS_INTERLACED(mb_type^h->left_type[LTOP]) // and left mb is in available to us && h->left_type[LTOP]) { /* First vertical edge is different in MBAFF frames * There are 8 different bS to compute and 2 different Qp */ DECLARE_ALIGNED(8, int16_t, bS)[8]; int qp[2]; int bqp[2]; int rqp[2]; int mb_qp, mbn0_qp, mbn1_qp; int i; <API key> = 1; if( IS_INTRA(mb_type) ) { AV_WN64A(&bS[0], <API key>); AV_WN64A(&bS[4], <API key>); } else { static const uint8_t offset[2][2][8]={ { {3+4*0, 3+4*0, 3+4*0, 3+4*0, 3+4*1, 3+4*1, 3+4*1, 3+4*1}, {3+4*2, 3+4*2, 3+4*2, 3+4*2, 3+4*3, 3+4*3, 3+4*3, 3+4*3}, },{ {3+4*0, 3+4*1, 3+4*2, 3+4*3, 3+4*0, 3+4*1, 3+4*2, 3+4*3}, {3+4*0, 3+4*1, 3+4*2, 3+4*3, 3+4*0, 3+4*1, 3+4*2, 3+4*3}, } }; const uint8_t *off= offset[MB_FIELD][mb_y&1]; for( i = 0; i < 8; i++ ) { int j= MB_FIELD ? i>>2 : i&1; int mbn_xy = h->left_mb_xy[LEFT(j)]; int mbn_type= h->left_type[LEFT(j)]; if( IS_INTRA( mbn_type ) ) bS[i] = 4; else{ bS[i] = 1 + !!(h-><API key>[12+8*(i>>1)] | ((!h->pps.cabac && IS_8x8DCT(mbn_type)) ? (h->cbp_table[mbn_xy] & (((MB_FIELD ? (i&2) : (mb_y&1)) ? 8 : 2) << 12)) : h->non_zero_count[mbn_xy][ off[i] ])); } } } mb_qp = s->current_picture.f.qscale_table[mb_xy]; mbn0_qp = s->current_picture.f.qscale_table[h->left_mb_xy[0]]; mbn1_qp = s->current_picture.f.qscale_table[h->left_mb_xy[1]]; qp[0] = ( mb_qp + mbn0_qp + 1 ) >> 1; bqp[0] = ( get_chroma_qp( h, 0, mb_qp ) + get_chroma_qp( h, 0, mbn0_qp ) + 1 ) >> 1; rqp[0] = ( get_chroma_qp( h, 1, mb_qp ) + get_chroma_qp( h, 1, mbn0_qp ) + 1 ) >> 1; qp[1] = ( mb_qp + mbn1_qp + 1 ) >> 1; bqp[1] = ( get_chroma_qp( h, 0, mb_qp ) + get_chroma_qp( h, 0, mbn1_qp ) + 1 ) >> 1; rqp[1] = ( get_chroma_qp( h, 1, mb_qp ) + get_chroma_qp( h, 1, mbn1_qp ) + 1 ) >> 1; /* Filter edge */ tprintf(s->avctx, "filter mb:%d/%d MBAFF, QPy:%d/%d, QPb:%d/%d QPr:%d/%d ls:%d uvls:%d", mb_x, mb_y, qp[0], qp[1], bqp[0], bqp[1], rqp[0], rqp[1], linesize, uvlinesize); { int i; for (i = 0; i < 8; i++) tprintf(s->avctx, " bS[%d]:%d", i, bS[i]); tprintf(s->avctx, "\n"); } if(MB_FIELD){ <API key> ( h, img_y , linesize, bS , 1, qp [0], a, b, 1 ); <API key> ( h, img_y + 8* linesize, linesize, bS+4, 1, qp [1], a, b, 1 ); if (chroma){ if (CHROMA444) { <API key> ( h, img_cb, uvlinesize, bS , 1, bqp[0], a, b, 1 ); <API key> ( h, img_cb + 8*uvlinesize, uvlinesize, bS+4, 1, bqp[1], a, b, 1 ); <API key> ( h, img_cr, uvlinesize, bS , 1, rqp[0], a, b, 1 ); <API key> ( h, img_cr + 8*uvlinesize, uvlinesize, bS+4, 1, rqp[1], a, b, 1 ); } else if (CHROMA422) { <API key>(h, img_cb, uvlinesize, bS , 1, bqp[0], a, b, 1); <API key>(h, img_cb + 8*uvlinesize, uvlinesize, bS+4, 1, bqp[1], a, b, 1); <API key>(h, img_cr, uvlinesize, bS , 1, rqp[0], a, b, 1); <API key>(h, img_cr + 8*uvlinesize, uvlinesize, bS+4, 1, rqp[1], a, b, 1); }else{ <API key>( h, img_cb, uvlinesize, bS , 1, bqp[0], a, b, 1 ); <API key>( h, img_cb + 4*uvlinesize, uvlinesize, bS+4, 1, bqp[1], a, b, 1 ); <API key>( h, img_cr, uvlinesize, bS , 1, rqp[0], a, b, 1 ); <API key>( h, img_cr + 4*uvlinesize, uvlinesize, bS+4, 1, rqp[1], a, b, 1 ); } } }else{ <API key> ( h, img_y , 2* linesize, bS , 2, qp [0], a, b, 1 ); <API key> ( h, img_y + linesize, 2* linesize, bS+1, 2, qp [1], a, b, 1 ); if (chroma){ if (CHROMA444) { <API key> ( h, img_cb, 2*uvlinesize, bS , 2, bqp[0], a, b, 1 ); <API key> ( h, img_cb + uvlinesize, 2*uvlinesize, bS+1, 2, bqp[1], a, b, 1 ); <API key> ( h, img_cr, 2*uvlinesize, bS , 2, rqp[0], a, b, 1 ); <API key> ( h, img_cr + uvlinesize, 2*uvlinesize, bS+1, 2, rqp[1], a, b, 1 ); }else{ <API key>( h, img_cb, 2*uvlinesize, bS , 2, bqp[0], a, b, 1 ); <API key>( h, img_cb + uvlinesize, 2*uvlinesize, bS+1, 2, bqp[1], a, b, 1 ); <API key>( h, img_cr, 2*uvlinesize, bS , 2, rqp[0], a, b, 1 ); <API key>( h, img_cr + uvlinesize, 2*uvlinesize, bS+1, 2, rqp[1], a, b, 1 ); } } } } #if CONFIG_SMALL for( dir = 0; dir < 2; dir++ ) filter_mb_dir(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize, mb_xy, mb_type, mvy_limit, dir ? 0 : <API key>, a, b, chroma, dir); #else filter_mb_dir(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize, mb_xy, mb_type, mvy_limit, <API key>, a, b, chroma, 0); filter_mb_dir(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize, mb_xy, mb_type, mvy_limit, 0, a, b, chroma, 1); #endif }
from img_list import Img_List from image_control import Image_Control from browser import * class Wnd(gtk.Window): def __init__(self): super(Wnd, self).__init__(gtk.WINDOW_TOPLEVEL) self.set_size_request(width=1200, height=768) self.set_title('IMGeotagger revived') self.realize() self.current_pos = gtk.Label() self.current_pos.set_use_markup(gtk.TRUE) self.img_list = Img_List('/home/laptus/Fotos/00to_tag/Gato/') self.img_list.get_selection().connect('changed', self.on_image_selection) self.img_ctrl = Image_Control(self.<API key>, self.<API key>) img_select_layout = gtk.VBox(False, 0) img_select_layout.set_size_request(width=self.get_pane_width(), height=0) img_select_layout.pack_start(self.current_pos, False, False, 2) img_select_layout.pack_start(self.img_ctrl, False, False, 2) img_select_layout.pack_start(self.img_list.get_ui_element(), True, True, 0) self.layout = gtk.HBox(False, 5) self.layout.pack_start(img_select_layout, False, False, 0) self.add(self.layout) self.show() def show(self): self.layout.get_window().focus() self.get_window().focus() self.show_all() def get_pane_width(self): return 250 def register_browser(self, browser): self.browser = browser def <API key>(self, path): self.img_list.set_path(path) def <API key>(self): coords = Wnd.<API key>(self.browser.get_url()) if coords is None: print "Fatal error: the URL format for Google maps has changed and " + \ "this program can't understand it. Unknown URL: {0}".format(map_path) exit(1) print "Setting selection to " + str(coords) for img in self.img_list.<API key>(): img.set_position(coords) self.img_list.<API key>() def maybe_update_coords(self, url): if url: coords = Wnd.<API key>(url) if coords: self.current_pos.set_markup('Position: ' + str(coords)) return self.current_pos.set_markup('Position: ???') def on_image_selection(self, widget, data=None): self.img_ctrl.on_images_selected(self.img_list.<API key>()) @staticmethod def <API key>(map_path): """ Tries to get the map coords from the url of a Google maps page """ start_tok = 'maps/@' lat_pos = map_path.find(start_tok) + len(start_tok) lat_end = map_path.find(',', lat_pos) lon_pos = lat_end + 1 lon_end = map_path.find(',', lon_pos) if (lat_pos < 0) or (lat_end < 0) or (lon_pos < 0) or (lon_end < 0): return None return (float(map_path[lat_pos:lat_end]), float(map_path[lon_pos:lon_end])) if __name__ == '__main__': wnd = Wnd() cefgtk_main(wnd, "https:
// This file was generated by the Gtk# code generator. // Any changes made will be lost if regenerated. namespace Gst { using System; using System.Runtime.InteropServices; #region Autogenerated code [GLib.GType (typeof (Gst.PadProbeReturnGType))] public enum PadProbeReturn { Drop = 0, Ok = 1, Remove = 2, Pass = 3, Handled = 4, } internal class PadProbeReturnGType { [DllImport ("libgstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)] static extern IntPtr <API key> (); public static GLib.GType GType { get { return new GLib.GType (<API key> ()); } } } #endregion }
package org.helios.jboss7.spring.context; import java.io.IOException; import java.lang.annotation.Annotation; import java.util.Locale; import java.util.Map; import org.apache.log4j.Logger; import org.helios.jboss7.util.JMXHelper; import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.<API key>; import org.springframework.beans.factory.config.<API key>; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationEvent; import org.springframework.context.ApplicationListener; import org.springframework.context.<API key>; import org.springframework.context.<API key>; import org.springframework.context.event.ContextClosedEvent; import org.springframework.core.env.Environment; import org.springframework.core.io.Resource; /** * @author nwhitehe * */ public class <API key> implements <API key>, ApplicationListener<ContextClosedEvent> { /** The delegate app context */ protected final ApplicationContext appCtx; protected final Logger log = Logger.getLogger(getClass()); /** * Creates a new <API key> * @param appCtx The delegate app context */ public <API key>(ApplicationContext appCtx) { super(); this.appCtx = appCtx; if(JMXHelper.getICEMBeanServer().isRegistered(OBJECT_NAME)) { try { JMXHelper.getICEMBeanServer().unregisterMBean(OBJECT_NAME); } catch (Exception ex) {} } try { JMXHelper.getICEMBeanServer().registerMBean(this, OBJECT_NAME); log.info("\n\t=============================================\n\tPublished AppCtx Service [" + OBJECT_NAME + "]\n\t=============================================\t"); } catch (Exception ex) {} } /** * {@inheritDoc} * @see org.springframework.context.ApplicationListener#onApplicationEvent(org.springframework.context.ApplicationEvent) */ @Override public void onApplicationEvent(ContextClosedEvent event) { if(event.<API key>()==appCtx) { try { JMXHelper.getICEMBeanServer().unregisterMBean(OBJECT_NAME); } catch (Exception ex) {} } } public ApplicationContext getInstance() { return appCtx; } /** * @param event * @see org.springframework.context.<API key>#publishEvent(org.springframework.context.ApplicationEvent) */ public void publishEvent(ApplicationEvent event) { appCtx.publishEvent(event); } /** * @return * @see org.springframework.beans.factory.<API key>#<API key>() */ public BeanFactory <API key>() { return appCtx.<API key>(); } /** * @param name * @return * @see org.springframework.beans.factory.<API key>#containsLocalBean(java.lang.String) */ public boolean containsLocalBean(String name) { return appCtx.containsLocalBean(name); } /** * @param code * @param args * @param defaultMessage * @param locale * @return * @see org.springframework.context.MessageSource#getMessage(java.lang.String, java.lang.Object[], java.lang.String, java.util.Locale) */ public String getMessage(String code, Object[] args, String defaultMessage, Locale locale) { return appCtx.getMessage(code, args, defaultMessage, locale); } /** * @param location * @return * @see org.springframework.core.io.ResourceLoader#getResource(java.lang.String) */ public Resource getResource(String location) { return appCtx.getResource(location); } /** * @return * @see org.springframework.core.env.EnvironmentCapable#getEnvironment() */ public Environment getEnvironment() { return appCtx.getEnvironment(); } /** * @param code * @param args * @param locale * @return * @throws <API key> * @see org.springframework.context.MessageSource#getMessage(java.lang.String, java.lang.Object[], java.util.Locale) */ public String getMessage(String code, Object[] args, Locale locale) throws <API key> { return appCtx.getMessage(code, args, locale); } /** * @param beanName * @return * @see org.springframework.beans.factory.ListableBeanFactory#<API key>(java.lang.String) */ public boolean <API key>(String beanName) { return appCtx.<API key>(beanName); } /** * @return * @see org.springframework.core.io.ResourceLoader#getClassLoader() */ public ClassLoader getClassLoader() { return appCtx.getClassLoader(); } /** * @return * @see org.springframework.context.ApplicationContext#getId() */ public String getId() { return appCtx.getId(); } /** * @param locationPattern * @return * @throws IOException * @see org.springframework.core.io.support.<API key>#getResources(java.lang.String) */ public Resource[] getResources(String locationPattern) throws IOException { return appCtx.getResources(locationPattern); } /** * @return * @see org.springframework.context.ApplicationContext#getApplicationName() */ public String getApplicationName() { return appCtx.getApplicationName(); } /** * @param resolvable * @param locale * @return * @throws <API key> * @see org.springframework.context.MessageSource#getMessage(org.springframework.context.<API key>, java.util.Locale) */ public String getMessage(<API key> resolvable, Locale locale) throws <API key> { return appCtx.getMessage(resolvable, locale); } /** * @return * @see org.springframework.beans.factory.ListableBeanFactory#<API key>() */ public int <API key>() { return appCtx.<API key>(); } /** * @return * @see org.springframework.context.ApplicationContext#getDisplayName() */ public String getDisplayName() { return appCtx.getDisplayName(); } /** * @return * @see org.springframework.context.ApplicationContext#getStartupDate() */ public long getStartupDate() { return appCtx.getStartupDate(); } /** * @return * @see org.springframework.beans.factory.ListableBeanFactory#<API key>() */ public String[] <API key>() { return appCtx.<API key>(); } /** * @return * @see org.springframework.context.ApplicationContext#getParent() */ public ApplicationContext getParent() { return appCtx.getParent(); } /** * @return * @throws <API key> * @see org.springframework.context.ApplicationContext#<API key>() */ public <API key> <API key>() throws <API key> { return appCtx.<API key>(); } /** * @param type * @return * @see org.springframework.beans.factory.ListableBeanFactory#getBeanNamesForType(java.lang.Class) */ public String[] getBeanNamesForType(Class<?> type) { return appCtx.getBeanNamesForType(type); } /** * @param type * @param <API key> * @param allowEagerInit * @return * @see org.springframework.beans.factory.ListableBeanFactory#getBeanNamesForType(java.lang.Class, boolean, boolean) */ public String[] getBeanNamesForType(Class<?> type, boolean <API key>, boolean allowEagerInit) { return appCtx.getBeanNamesForType(type, <API key>, allowEagerInit); } /** * @param name * @return * @throws BeansException * @see org.springframework.beans.factory.BeanFactory#getBean(java.lang.String) */ public Object getBean(String name) throws BeansException { return appCtx.getBean(name); } /** * @param name * @param requiredType * @return * @throws BeansException * @see org.springframework.beans.factory.BeanFactory#getBean(java.lang.String, java.lang.Class) */ public <T> T getBean(String name, Class<T> requiredType) throws BeansException { return appCtx.getBean(name, requiredType); } /** * @param type * @return * @throws BeansException * @see org.springframework.beans.factory.ListableBeanFactory#getBeansOfType(java.lang.Class) */ public <T> Map<String, T> getBeansOfType(Class<T> type) throws BeansException { return appCtx.getBeansOfType(type); } /** * @param requiredType * @return * @throws BeansException * @see org.springframework.beans.factory.BeanFactory#getBean(java.lang.Class) */ public <T> T getBean(Class<T> requiredType) throws BeansException { return appCtx.getBean(requiredType); } /** * @param name * @param args * @return * @throws BeansException * @see org.springframework.beans.factory.BeanFactory#getBean(java.lang.String, java.lang.Object[]) */ public Object getBean(String name, Object... args) throws BeansException { return appCtx.getBean(name, args); } /** * @param type * @param <API key> * @param allowEagerInit * @return * @throws BeansException * @see org.springframework.beans.factory.ListableBeanFactory#getBeansOfType(java.lang.Class, boolean, boolean) */ public <T> Map<String, T> getBeansOfType(Class<T> type, boolean <API key>, boolean allowEagerInit) throws BeansException { return appCtx .getBeansOfType(type, <API key>, allowEagerInit); } /** * @param name * @return * @see org.springframework.beans.factory.BeanFactory#containsBean(java.lang.String) */ public boolean containsBean(String name) { return appCtx.containsBean(name); } /** * @param name * @return * @throws <API key> * @see org.springframework.beans.factory.BeanFactory#isSingleton(java.lang.String) */ public boolean isSingleton(String name) throws <API key> { return appCtx.isSingleton(name); } /** * @param name * @return * @throws <API key> * @see org.springframework.beans.factory.BeanFactory#isPrototype(java.lang.String) */ public boolean isPrototype(String name) throws <API key> { return appCtx.isPrototype(name); } /** * @param annotationType * @return * @throws BeansException * @see org.springframework.beans.factory.ListableBeanFactory#<API key>(java.lang.Class) */ public Map<String, Object> <API key>( Class<? extends Annotation> annotationType) throws BeansException { return appCtx.<API key>(annotationType); } /** * @param beanName * @param annotationType * @return * @see org.springframework.beans.factory.ListableBeanFactory#<API key>(java.lang.String, java.lang.Class) */ public <A extends Annotation> A <API key>(String beanName, Class<A> annotationType) { return appCtx.<API key>(beanName, annotationType); } /** * @param name * @param targetType * @return * @throws <API key> * @see org.springframework.beans.factory.BeanFactory#isTypeMatch(java.lang.String, java.lang.Class) */ public boolean isTypeMatch(String name, Class<?> targetType) throws <API key> { return appCtx.isTypeMatch(name, targetType); } /** * @param name * @return * @throws <API key> * @see org.springframework.beans.factory.BeanFactory#getType(java.lang.String) */ public Class<?> getType(String name) throws <API key> { return appCtx.getType(name); } /** * @param name * @return * @see org.springframework.beans.factory.BeanFactory#getAliases(java.lang.String) */ public String[] getAliases(String name) { return appCtx.getAliases(name); } }
#include <config.h> /* Specification. */ #include "unictype.h" #include "bitmap.h" /* Define u_is_blank table. */ #include "ctype_blank.h" bool uc_is_blank (ucs4_t uc) { return bitmap_lookup (&u_is_blank, uc); }
package fr.toss.common.player.classes; import fr.toss.common.command.ChatColor; public class ClasseFarmer extends Classe { @Override public String getName() { return "Farmer"; } @Override public ChatColor getColor() { return ChatColor.WHITE; } @Override /** definis tous les sorts de la classe */ public void defineClasseSpells() { } @Override public EnumType getType() { return EnumType.DPS; } @Override public int getBaseEnergyRegen() { return 1; } }
/* * HISTORY */ #ifdef REV_INFO #ifndef lint static char rcsid[] = "$TOG: UilSarVal.c /main/13 1997/12/06 16:14:16 cshi $" #endif #endif #ifdef HAVE_CONFIG_H #include <config.h> #endif /* **++ ** FACILITY: ** ** User Interface Language Compiler (UIL) ** ** ABSTRACT: ** ** This module supports values in UIL. UIL values are ** quite primitive in terms of operators, however, there is a ** concept of a private value that is local to this module ** and a imported or exported value which needs to be ** resolved via a lookup at runtime. The runtime resolved values ** cannot be modified with operators. ** **-- **/ /* ** ** INCLUDE FILES ** **/ #include <Xm/Xm.h> #include "UilDefI.h" #include "UilSymGen.h" /* For sym_k_[TRUE|FALSE]_enumval */ /* ** ** TABLE OF CONTENTS ** **/ /* ** FORWARD DECLARATIONS */ static <API key> *<API key> _ARGUMENTS(( void )); /* ** ** DEFINE and MACRO DEFINITIONS ** **/ #define clear_class_mask \ (~(sym_m_private | sym_m_imported | sym_m_exported | sym_m_builtin)) /* ** ** EXTERNAL VARIABLE DECLARATIONS ** **/ extern yystype yylval; /* ** ** GLOBAL VARIABLE DECLARATIONS ** **/ /* ** ** OWN VARIABLE DECLARATIONS ** **/ /* **++ ** FUNCTIONAL DESCRIPTION: ** ** This function takes a non-reserved keyword and makes a name ** entry for it. In the context in which the keyword is used, ** it is not being used as a keyword. ** ** FORMAL PARAMETERS: ** ** target_frame pointer to resultant token stack frame ** keyword_frame pointer to token stack frame holding the keyword ** ** IMPLICIT INPUTS: ** ** none ** ** IMPLICIT OUTPUTS: ** ** none ** ** FUNCTION VALUE: ** ** void ** ** SIDE EFFECTS: ** ** a name entry is generated ** **-- **/ void <API key>( target_frame, keyword_frame ) yystype *target_frame; yystype *keyword_frame; { sym_name_entry_type *name_entry; _assert( keyword_frame->b_tag == sar_k_token_frame, "keyword frame missing from stack" ); /* ** make the target frame a token frame for a name token */ <API key>( target_frame, keyword_frame ); target_frame->b_tag = sar_k_token_frame; target_frame->b_type = NAME; /* ** insert the keyword name into the symbol table */ name_entry = sym_insert_name ( keyword_frame->value.az_keyword_entry->b_length, keyword_frame->value.az_keyword_entry->at_name ); target_frame->value.az_symbol_entry = (sym_entry_type *) name_entry; } /* **++ ** FUNCTIONAL DESCRIPTION: ** ** This function processes an id that is being used as an operand ** in a value. It can be either a value or an identifier. ** ** FORMAL PARAMETERS: ** ** target_frame pointer to resultant value stack frame ** id_frame pointer to token stack frame holding the id ** ** IMPLICIT INPUTS: ** ** none ** ** IMPLICIT OUTPUTS: ** ** none ** ** FUNCTION VALUE: ** ** void ** ** SIDE EFFECTS: ** ** error may be issued for undefined name ** **-- **/ void sar_process_id( target_frame, id_frame ) yystype *target_frame; yystype *id_frame; { sym_name_entry_type *name_entry; <API key> *value_entry; int enum_code; _assert( id_frame->b_tag == sar_k_token_frame, "id frame missing from stack" ); /* ** make the target frame an expression frame */ <API key>( target_frame, id_frame ); target_frame->b_tag = sar_k_value_frame; /* id frame may be a: ** font_name, color_name, reason_name, argument_name... ** name ** if the font_name, color_name, etc... has a name been defined by ** the user, we use that name, otherwise these special names are ** treated as private values. */ if (id_frame->b_type != NAME) { name_entry = sym_find_name ( id_frame->value.az_keyword_entry->b_length, id_frame->value.az_keyword_entry->at_name ); if (name_entry == NULL) { int source_type; unsigned short int arg_code; unsigned short int rel_code; switch (id_frame->b_type) { case FONT_NAME: source_type = sym_k_font_value; break; case CHILD_NAME: source_type = sym_k_child_value; break; case ARGUMENT_NAME: source_type = <API key>; /* ** Indicate that this argument is used so we can later ** generate appropriate compression code for it. ** If this argument has a related argument, also mark it as ** being used so we can later generate its comprssion code. */ arg_code = id_frame->value.az_keyword_entry->b_subclass; uil_arg_compr[arg_code] = 1; rel_code = <API key>[arg_code]; if (rel_code != 0) uil_arg_compr[rel_code] = 1; break; case COLOR_NAME: source_type = sym_k_color_value; break; case REASON_NAME: source_type = sym_k_reason_value; uil_reas_compr[id_frame->value.az_keyword_entry->b_subclass] = 1; break; case ENUMVAL_NAME: source_type = sym_k_integer_value; enum_code = id_frame->value.az_keyword_entry->b_subclass; break; default: _assert( FALSE, "unexpected token" ); } value_entry = <API key> ( (char*)&(id_frame->value.az_keyword_entry), sizeof(long), source_type ); if ( id_frame->b_type == ENUMVAL_NAME ) { value_entry-><API key> = enum_code; _assert (( (enum_code > 0) && (enum_code <= uil_max_enumval) ), "Enumeration code out of range"); value_entry->value.l_integer = <API key>[enum_code]; } target_frame->b_flags = value_entry->obj_header.b_flags; target_frame->b_type = value_entry->b_type; target_frame->value.az_symbol_entry = (sym_entry_type *) value_entry; return; } id_frame->value.az_symbol_entry = (sym_entry_type *) name_entry; } /* ** first check if the name entry points to a value. ** If the value_entry is NULL, this is a forward reference. */ name_entry = (sym_name_entry_type *) id_frame->value.az_symbol_entry; value_entry = (<API key> *) name_entry->az_object; if (value_entry == NULL) { value_entry = <API key> ("0", 0, sym_k_any_value); value_entry->obj_header.b_flags = sym_m_forward_ref; value_entry->obj_header.az_name = name_entry; target_frame->b_flags = value_entry->obj_header.b_flags; target_frame->b_type = value_entry->b_type; target_frame->value.az_symbol_entry = (sym_entry_type *) value_entry; return; } if (value_entry->header.b_tag != sym_k_value_entry && value_entry->header.b_tag != sym_k_widget_entry) { <API key> ( d_ctx_req, <API key>( id_frame ), diag_tag_text( sym_k_value_entry ), diag_tag_text( value_entry->header.b_tag ) ); goto error_path; } /* ** set up the target frame */ target_frame->b_flags = value_entry->obj_header.b_flags; target_frame->b_type = value_entry->b_type; target_frame->value.az_symbol_entry = (sym_entry_type *) value_entry; return; error_path: target_frame->b_flags = sym_m_private; target_frame->b_type = sym_k_error_value; target_frame->value.az_symbol_entry = (sym_entry_type *) <API key>; } /* **++ ** FUNCTIONAL DESCRIPTION: ** ** This function checks an identifier and makes a name ** entry for it if it is not already a name. ** ** FORMAL PARAMETERS: ** ** id_frame pointer to token stack frame holding the identifier ** ** IMPLICIT INPUTS: ** ** none ** ** IMPLICIT OUTPUTS: ** ** none ** ** FUNCTION VALUE: ** ** void ** ** SIDE EFFECTS: ** ** a name entry may be generated ** **-- **/ void sar_process_id_ref ( id_frame ) yystype * id_frame; { _assert( id_frame->b_tag == sar_k_token_frame, "id frame missing from stack" ); switch (id_frame->b_type) { /* ** if already a name, then do nothing. */ case NAME: return; /* ** make the keyword into a name and insert it into the symbol table */ case FONT_NAME: case ARGUMENT_NAME: case COLOR_NAME: case REASON_NAME: case CHILD_NAME: id_frame->b_type = NAME; id_frame->value.az_symbol_entry = (sym_entry_type *) sym_insert_name ( id_frame->value.az_keyword_entry->b_length, id_frame->value.az_keyword_entry->at_name ); break; default: _assert( FALSE, "unexpected token" ); break; } } /* **++ ** FUNCTIONAL DESCRIPTION: ** ** This function takes a parse frame, extracts the string for the token ** out of it and converts the string into a units type. ** ** FORMAL PARAMETERS: ** ** parse_frame pointer to parse stack frame holding the value ** ** IMPLICIT INPUTS: ** ** none ** ** IMPLICIT OUTPUTS: ** ** none ** ** FUNCTION VALUE: ** ** void ** ** SIDE EFFECTS: ** ** ** **-- **/ int sar_get_units_type ( parse_frame ) yystype *parse_frame; { char *units_name; int units_type; XmParseResult result; units_name = parse_frame->value.az_keyword_entry->at_name; result = XmeParseUnits(units_name, &units_type); switch(result) { case XmPARSE_ERROR: /* I don't expect a parse error since the UIL compiler knows what the valid unit strings are. */ units_type = XmPIXELS; break; case XmPARSE_NO_UNITS: /* For now, just set the units to XmPIXELS when none specified. What we really need is to be able to specify that there were no units and therefore no conversion should be done. We can sort of do that by specifying XmPIXELS here. */ units_type = XmPIXELS; break; case XmPARSE_UNITS_OK: /* Everything is groovy */ break; } return(units_type); } /* **++ ** FUNCTIONAL DESCRIPTION: ** ** This function takes a token frame for a value and converts it ** into a value frame. ** ** FORMAL PARAMETERS: ** ** value_frame pointer to resultant value stack frame ** token_frame pointer to token stack frame holding the value ** value_type type of value being created ** keyword_frame frame to use as locator for the value ** arg_type type of argument value being created - for args only ** ** IMPLICIT INPUTS: ** ** none ** ** IMPLICIT OUTPUTS: ** ** none ** ** FUNCTION VALUE: ** ** void ** ** SIDE EFFECTS: ** ** ** **-- **/ void <API key> ( value_frame, token_frame, value_type, keyword_frame, arg_type ) yystype *value_frame; yystype *token_frame; int value_type; yystype *keyword_frame; int arg_type; { <API key> *value_entry; /* ** This should be a long because the call to <API key> passes the sizeof(long). This also ** maps on top of value.l_integer which is a long and is used in <API key>. */ long boolean_value; /* Empty string tables and translation tables can have a null token frame. */ _assert( (token_frame->b_tag == sar_k_token_frame) || (token_frame->b_tag == sar_k_value_frame) || (token_frame->b_tag == sar_k_null_frame), "token or value frame missing from stack" ); /* ** The goal of the routine is to create a value entry in the ** symbol table for each constant and then place a pointer to ** that value entry in a value frame on the parse stack. ** Based on the type of constant, it may or may not already be ** in the symbol table. */ switch (value_type) { case sym_k_char_8_value: case <API key>: case sym_k_integer_value: case sym_k_float_value: case <API key>: case <API key>: value_entry = (<API key> *) token_frame->value.az_symbol_entry; /* Save the arg_type. This value should be zero for all cases above, except when the integer or float has units specified. In that case, the arg_type is used to store the type of units specified. */ value_entry->b_arg_type = arg_type; value_entry->b_type = value_type; break; case sym_k_font_value: case sym_k_fontset_value: case sym_k_reason_value: case <API key>: case <API key>: case sym_k_keysym_value: case <API key>: /* ** transform the char 8 value entry into one for this ** special type. Before doing this, we need to insure ** that the char 8 value is not in error or non private. */ value_entry = (<API key> *) token_frame->value.az_symbol_entry; if (token_frame->b_type == sym_k_error_value) { value_type = sym_k_error_value; } else { <API key> *value_save; value_save = value_entry; if ((value_entry->obj_header.az_name != NULL) || (token_frame->b_type == sym_k_any_value)) { value_entry = <API key> ("",0,sym_k_any_value); value_entry->b_expr_opr = sym_k_coerce_op; if ((token_frame -> b_flags & sym_m_forward_ref) != 0) <API key> (token_frame, (char*)&(value_entry->az_exp_op1), sym_k_patch_add); else value_entry->az_exp_op1 = value_save; } value_entry->b_type = value_type; value_entry->obj_header.b_flags = sym_m_private; /* save the arg type for arguments */ if (value_type == <API key>) value_entry->b_arg_type = arg_type; } break; case sym_k_bool_value: boolean_value = 0; if ((token_frame->b_type == UILTRUE) || (token_frame->b_type == ON )) boolean_value = 1; value_entry = <API key> ( (char*)&boolean_value, sizeof(long), sym_k_bool_value ); break; case <API key>: case <API key>: case <API key>: case <API key>: case sym_k_rgb_value: { int count; <API key> * table_entry; /* Save the pointer to the table elements */ table_entry = (<API key> *) token_frame->value.az_symbol_entry; value_entry = <API key> (0, 0, value_type ); value_entry-><API key> = table_entry; /* Get the count of elements in the table. Resets table_entry */ for (table_entry=value_entry-><API key>, count = 0; table_entry != NULL; table_entry = table_entry->az_next_table_value, count++) { } value_entry->b_table_count = count; break; } default: _assert( FALSE, "unexpected value type" ); break; } /* ** make the target frame a value frame */ <API key>( value_frame, keyword_frame ); value_frame->b_tag = sar_k_value_frame; value_frame->b_type = value_type; value_frame->b_flags = value_entry->obj_header.b_flags; value_frame->value.az_symbol_entry = (sym_entry_type *) value_entry; } void <API key> ( value_frame, token_frame, value_type, keyword_frame, arg_type ) yystype *value_frame; yystype *token_frame; int value_type; yystype *keyword_frame; int arg_type; { /* placeholder RAP for RGB data type */ } /* **++ ** FUNCTIONAL DESCRIPTION: ** ** This function takes a value frame which is the contents ** of a table of strings and appends it to a value entry which is ** the next entry in that table. It is used by string_table, icon, ** and translation_table value types. ** ** FORMAL PARAMETERS: ** ** value_frame pointer to current table entry stack frame ** table_frame pointer to stack frame holding the table ** table_type dictates the type of table being generated ** ** IMPLICIT INPUTS: ** ** none ** ** IMPLICIT OUTPUTS: ** ** none ** ** FUNCTION VALUE: ** ** void ** ** SIDE EFFECTS: ** ** ** **-- **/ void <API key>( value_frame, table_frame, table_type, comma_frame ) yystype *value_frame; yystype *table_frame; int table_type; yystype *comma_frame; { <API key> *value_entry, *table_entry; int value_type; _assert( (value_frame->b_tag == sar_k_value_frame), "value frame missing from stack" ); value_entry = (<API key> *) value_frame->value.az_symbol_entry; value_type = value_entry->b_type; if (value_type == sym_k_error_value) return; table_entry = (<API key> *) table_frame->value.az_symbol_entry; /* ** Some entries require checking for a forward reference. If the ** table entry is named, than a valref entry linked to it is placed ** in the table. If the new entry is a forward reference, than a ** valref is always required, but we can use the value node which ** is supplied as it is a parser artifact, and has no other use. */ switch (table_type) { case sym_k_icon_value: if ((value_frame->b_flags & sym_m_forward_ref) != 0) { <API key> (d_undefined, <API key>(value_frame), "icon row", value_entry->obj_header.az_name->c_text); } if (value_entry->obj_header.az_name != NULL) { <API key> *value_save; value_save = value_entry; value_entry = <API key> (0, 0, value_type); value_entry->b_type = value_type; value_entry->obj_header.b_flags = sym_m_private; value_entry->b_expr_opr = sym_k_valref_op; value_entry->az_exp_op1 = value_save; } break; case <API key>: case <API key>: case <API key>: case sym_k_rgb_value: if (value_entry->obj_header.az_name != NULL) { <API key> *value_save; if ( (value_frame->b_flags & sym_m_forward_ref) != 0) { value_entry->obj_header.b_flags = sym_m_private; value_entry->b_expr_opr = sym_k_valref_op; <API key> (value_frame, (char*)&(value_entry->az_exp_op1), sym_k_patch_add); } else { value_save = value_entry; value_entry = <API key> (0, 0, value_type); value_entry->b_type = value_type; value_entry->obj_header.b_flags = sym_m_private; value_entry->b_expr_opr = sym_k_valref_op; value_entry->az_exp_op1 = value_save; } } break; case <API key>: /* ** value needs to be a compound string, so a coerce operator is ** inserted as required. We don't need both a coerce and a ** valref entry; if coerce is applied to a name, it also ** functions as the valref. */ if (value_entry->obj_header.az_name != NULL) { <API key> *value_save; if ( (value_frame->b_flags & sym_m_forward_ref) != 0) { value_entry->obj_header.b_flags = sym_m_private; value_entry->b_type = <API key>; value_entry->b_expr_opr = sym_k_coerce_op; <API key> (value_frame, (char*)&(value_entry->az_exp_op1), sym_k_patch_add); } else { value_save = value_entry; value_entry = <API key> (0, 0, value_type); value_entry->obj_header.b_flags = sym_m_private; value_entry->b_type = <API key>; value_entry->az_exp_op1 = value_save; if ( value_type == <API key> ) value_entry->b_expr_opr = sym_k_valref_op; else value_entry->b_expr_opr = sym_k_coerce_op; } } break; default: _assert ( FALSE, "unknown table type found"); } /* ** Prepend the value to the table. The table elements will be ** in reverse order. */ value_entry->b_aux_flags |= sym_m_table_entry; value_entry->az_next_table_value = table_entry; /* ** Save source information */ <API key> ( &value_entry->header, comma_frame, value_frame); value_entry->header.b_type = value_frame->b_source_pos; /* ** make the target frame a value frame */ value_frame->b_tag = sar_k_value_frame; value_frame->b_type = value_type; value_frame->b_flags = value_entry->obj_header.b_flags; value_frame->value.az_symbol_entry = (sym_entry_type *) value_entry; } /* **++ ** FUNCTIONAL DESCRIPTION: ** ** This function issues an error message saying that a feature is ** not implemented yet. ** ** FORMAL PARAMETERS: ** ** value_frame pointer to resultant value stack frame ** token_frame pointer to source token frame (error position info) ** error_text pointer to text to be substituted in message ** ** IMPLICIT INPUTS: ** ** none ** ** IMPLICIT OUTPUTS: ** ** none ** ** FUNCTION VALUE: ** ** void ** ** SIDE EFFECTS: ** ** error message is issued ** **-- **/ void <API key>( value_frame, token_frame, error_text ) yystype *value_frame; yystype *token_frame; char *error_text; { /* ** make the target frame an error value frame */ <API key>( value_frame, token_frame ); value_frame->b_tag = sar_k_value_frame; value_frame->b_type = sym_k_error_value; value_frame->b_flags = sym_m_private; value_frame->value.az_symbol_entry = (sym_entry_type *) <API key>; <API key> ( d_not_impl, <API key>( value_frame ), error_text ); } /* **++ ** FUNCTIONAL DESCRIPTION: ** ** This function processes the concatenation of 2 strings. ** ** FORMAL PARAMETERS: ** ** operator_frame [in/out] pointer to resultant value stack frame ** op1_frame [in] pointer to operand 1 value frame ** op2_frame [in] pointer to operand 2 value frame ** ** IMPLICIT INPUTS: ** ** none ** ** IMPLICIT OUTPUTS: ** ** none ** ** FUNCTION VALUE: ** ** void ** ** SIDE EFFECTS: ** ** error message is issued if value is out of range ** **-- **/ void sar_cat_value( operator_frame, op1_frame, op2_frame ) yystype *operator_frame; yystype *op1_frame; yystype *op2_frame; { /* ** For pcc conversion, use defines instead of this enum. ** ** enum op_state ** { ** error=0, simple, compound, localized ** }; */ #define k_op_state_error 0 #define k_op_state_simple 1 #define k_op_state_compound 2 #define <API key> 4 int target_type; <API key> *value1_entry; <API key> *value2_entry; <API key> *target_entry; unsigned int op1_state; unsigned int op2_state; _assert( (op1_frame->b_tag == sar_k_value_frame) && (op2_frame->b_tag == sar_k_value_frame), "value frame missing" ); /* ** The target type is dependent on the type of the sources. If both ** operands are primitive and have the same writing direction and ** charset, the result is still of that type. If not, the result ** is a compound string. */ switch (op1_frame->b_type) { case sym_k_char_8_value: op1_state = k_op_state_simple; break; case <API key>: op1_state = k_op_state_compound; break; case <API key>: op1_state = <API key>; break; case sym_k_error_value: op1_state = k_op_state_error; break; default: <API key> (d_wrong_type, <API key>( op1_frame ), diag_value_text( op1_frame->b_type), "string or compound string"); op1_state = k_op_state_error; } switch (op2_frame->b_type) { case sym_k_char_8_value: op2_state = k_op_state_simple; break; case <API key>: op2_state = k_op_state_compound; break; case <API key>: op2_state = <API key>; break; case sym_k_error_value: op2_state = k_op_state_error; break; default: <API key> (d_wrong_type, <API key>( op2_frame ), diag_value_text( op2_frame->b_type), "string or compound string"); op2_state = k_op_state_error; } value1_entry = (<API key> *) op1_frame->value.az_symbol_entry; value2_entry = (<API key> *) op2_frame->value.az_symbol_entry; /* ** Verify that both operands are private values */ if ((op1_frame->b_flags & sym_m_private) == 0) { op1_state = k_op_state_error; <API key> (d_nonpvt, <API key> (op1_frame), value1_entry->obj_header.az_name->c_text ); } if ((op2_frame->b_flags & sym_m_private) == 0) { op2_state = k_op_state_error; <API key> (d_nonpvt, <API key> (op2_frame), value2_entry->obj_header.az_name->c_text ); } switch (op1_state + (op2_state<<2)) { /* ** This is the case of appending to simple strings. Just append them ** unless they have different directions or the first one has the separate ** attribute. */ case k_op_state_simple + (k_op_state_simple<<2): if ((value1_entry->b_charset == value2_entry->b_charset) && ((value1_entry->b_direction) == (value2_entry->b_direction)) && ((value1_entry->b_aux_flags & sym_m_separate) == 0)) { target_entry = (<API key> *) sem_cat_str_to_str (value1_entry, (value1_entry->obj_header.az_name==NULL), value2_entry, (value2_entry->obj_header.az_name==NULL)); target_type = sym_k_char_8_value; } else { target_entry = (<API key> *) sem_create_cstr( ); <API key> (target_entry, value1_entry, (value1_entry->obj_header.az_name==NULL)); <API key> (target_entry, value2_entry, (value2_entry->obj_header.az_name==NULL)); target_type = <API key>; } break; /* ** This is the case of one simple and one compound string. Change the ** simple to a compound and append them together. Depend on the append ** routine to do the right thing. */ case k_op_state_simple + (k_op_state_compound<<2): target_entry = (<API key> *) sem_create_cstr( ); <API key> (target_entry, value1_entry, (value1_entry->obj_header.az_name==NULL)); <API key> (target_entry, value2_entry, (value2_entry->obj_header.az_name==NULL)); target_type = <API key>; break; /* ** This is the case of one simple and one compound string. Append the ** simple to the compound. Depend on the append routine to do the right ** thing. */ case k_op_state_compound + (k_op_state_simple<<2): target_entry = (<API key> *) sem_create_cstr( ); <API key> (target_entry, value1_entry, (value1_entry->obj_header.az_name==NULL)); <API key> (target_entry, value2_entry, (value2_entry->obj_header.az_name==NULL)); target_type = <API key>; break; /* ** This is the case of two compound strings. Just let the append routine ** do the right thing. */ case k_op_state_compound + (k_op_state_compound<<2): target_entry = (<API key> *) sem_create_cstr( ); <API key> (target_entry, value1_entry, (value1_entry->obj_header.az_name==NULL)); <API key> (target_entry, value2_entry, (value2_entry->obj_header.az_name==NULL)); target_type = <API key>; break; default: /* some form of error */ target_type = sym_k_error_value; target_entry = (<API key> *) <API key>; break; } /* ** initialize the target frame */ <API key> ( &target_entry->header, op2_frame); /* target_entry->az_source_rec = op2_frame->az_source_record; */ operator_frame->b_tag = sar_k_value_frame; operator_frame->b_type = target_type; operator_frame->b_flags = sym_m_private; operator_frame->value.az_symbol_entry = (sym_entry_type *) target_entry; } /* **++ ** FUNCTIONAL DESCRIPTION: ** ** This function checks the attributes of COMPOUND_STRING function. ** ** FORMAL PARAMETERS: ** ** target_frame pointer to resultant token stack frame ** value_frame pointer to frame holding keyword and value ** prior_value_frame pointer to previous properties ** ** IMPLICIT INPUTS: ** ** none ** ** IMPLICIT OUTPUTS: ** ** none ** ** FUNCTION VALUE: ** ** void ** ** SIDE EFFECTS: ** ** attribute information is stuffed in target frame ** **-- **/ void <API key>( target_frame, value_frame, prior_value_frame ) yystype *target_frame; yystype *value_frame; yystype *prior_value_frame; { <API key> *value_entry; /* ** Set up not specified values in the target frame. ** b_type will hold the writing direction and separate propertied ** az_symbol_entry will hold the pointer to the character set. */ switch (prior_value_frame->b_tag) { case sar_k_null_frame: /* ** no prior values */ target_frame->b_tag = sar_k_token_frame; target_frame->b_direction = NOSTRING_DIRECTION; /* Fix for CN 16149 (DTS 10023) part 3 -- flag b_charset as non-existent */ target_frame->b_charset = sym_k_error_charset; target_frame->b_type = 0; target_frame->value.az_symbol_entry = NULL; break; case sar_k_token_frame: case sar_k_value_frame: /* ** prior values - transfer them */ target_frame->b_tag = sar_k_token_frame; target_frame->b_direction = prior_value_frame->b_direction; target_frame->b_charset = prior_value_frame->b_charset; target_frame->b_type = prior_value_frame->b_type; target_frame->value.az_symbol_entry = target_frame->value.az_symbol_entry; break; default: _assert( FALSE, "prior value frame missing from stack" ); } /* ** Case on the keyword for the attribute given */ value_entry = (<API key> *) value_frame->value.az_symbol_entry; if ((value_entry != NULL) && (value_frame->b_type != CHARACTER_SET) && (value_entry->obj_header.b_flags & sym_m_forward_ref) != 0) { <API key> (d_undefined, <API key>(value_frame), "compound string attribute", value_entry->obj_header.az_name->c_text); } switch (value_frame->b_type) { case RIGHT_TO_LEFT: { /* ** If the value is a boolean, then set the b_direction field. */ if (value_entry->b_type == sym_k_bool_value) if (value_entry->value.l_integer == TRUE) target_frame->b_direction = <API key>; else target_frame->b_direction = <API key>; break; } case SEPARATE: { /* ** If the value is a boolean, then just set the corresponding mask ** accordingly. */ if (value_entry->b_type == sym_k_bool_value) if (value_entry->value.l_integer == TRUE) target_frame->b_type |= sym_m_separate; else target_frame->b_type &= ~sym_m_separate; break; } case CHARACTER_SET: { /* ** There are two different kinds of character sets. One is a ** token frame, the other is a value frame which points to a ** char8 string value in the symbol table that represents the charset. */ switch (value_frame->b_tag) { /* ** For token frames, acquire the charset from the keytable entry ** and set frame type so sar_make_comp_str knows how to interpret ** the frame. */ case sar_k_token_frame: { <API key> *keyword_entry; keyword_entry = (<API key> *) value_frame->value.az_keyword_entry; target_frame->b_tag = sar_k_token_frame; target_frame->b_charset = <API key>( keyword_entry->b_subclass ); break; } /* ** For value frames, save the value pointer and mark the ** frame again for correct use by sar_make_comp_str. */ case sar_k_value_frame: target_frame->b_tag = sar_k_value_frame; target_frame->value.az_symbol_entry = value_frame->value.az_symbol_entry; break; } break; } default: _assert( FALSE, "keyword missing from stack" ); } } /* **++ ** FUNCTIONAL DESCRIPTION: ** ** This function makes a COMPOUND_STRING and sets the properties ** of the string. ** ** FORMAL PARAMETERS: ** ** target_frame pointer to resultant token stack frame ** value_frame pointer to string value ** attr_frame pointer to strings attributes ** keyword_frame frame to use as locator for result ** ** IMPLICIT INPUTS: ** ** none ** ** IMPLICIT OUTPUTS: ** ** none ** ** FUNCTION VALUE: ** ** void ** ** SIDE EFFECTS: ** ** none ** **-- **/ void sar_make_comp_str ( target_frame, value_frame, attr_frame, keyword_frame ) yystype *target_frame; yystype *value_frame; yystype *attr_frame; yystype *keyword_frame; { <API key> *value_entry; <API key> *cstr_entry; _assert( value_frame->b_tag == sar_k_value_frame, "value frame missing from stack" ); /* ** Make a compound string operation. The compound string will be created ** during expression evaluation in UilSemVal.c. */ cstr_entry = (<API key> *) sem_create_cstr(); cstr_entry->b_expr_opr = sym_k_comp_str_op; if ((value_frame->b_flags & sym_m_forward_ref) != 0) <API key> (value_frame, (char*)&(cstr_entry->az_exp_op1), sym_k_patch_add); else { value_entry = (<API key> *) value_frame->value.az_symbol_entry; cstr_entry->az_exp_op1 = value_entry; } /* ** If the attr_frame is not null, it must be a value frame with contains ** a pointer to the value entry for the userdefined charset, or a token frame ** which contains the charset token subclass. */ switch (attr_frame->b_tag) { case sar_k_value_frame: /* ** Set the attributes of the string, as specified by the options ** to the COMPOUND_STRING function, without disturbing any ** existing bits. */ cstr_entry->b_direction = attr_frame->b_direction; cstr_entry->b_aux_flags |= (attr_frame->b_type & sym_m_separate); /* ** If the symbol_entry pointer is not null then a charset was ** specified for this CS, just copy the b_charset and ** az_charset_value pointers into the value entry for this CS. */ if ((attr_frame->value.az_symbol_entry) != 0) { <API key> * az_value_entry; az_value_entry = (<API key> *) attr_frame->value.az_symbol_entry; cstr_entry->b_charset = az_value_entry->b_charset; cstr_entry->b_direction = az_value_entry->b_direction; cstr_entry->az_charset_value = az_value_entry; } break; case sar_k_token_frame: if ((attr_frame->b_charset) != 0) cstr_entry->b_charset = <API key> (attr_frame->b_charset); cstr_entry->b_direction = attr_frame->b_direction; cstr_entry->b_aux_flags |= (attr_frame->b_type & sym_m_separate); break; } /* ** initialize the target frame */ <API key>( target_frame, keyword_frame ); <API key> ( &cstr_entry->header, value_frame ); /* cstr_entry->az_source_rec = value_frame->az_source_record; */ target_frame->b_tag = sar_k_value_frame; target_frame->b_type = <API key>; target_frame->b_flags = sym_m_private; target_frame->value.az_symbol_entry = (sym_entry_type *) cstr_entry; } /* **++ ** FUNCTIONAL DESCRIPTION: ** ** This function makes a <API key> and sets the properties ** of the string. ** ** FORMAL PARAMETERS: ** ** target_frame pointer to resultant token stack frame ** type_frame pointer to type value ** value_frame pointer to component value ** keyword_frame frame to use as locator for result ** ** IMPLICIT INPUTS: ** ** none ** ** IMPLICIT OUTPUTS: ** ** none ** ** FUNCTION VALUE: ** ** void ** ** SIDE EFFECTS: ** ** none ** **-- **/ void <API key> ( target_frame, type_frame, value_frame, keyword_frame ) yystype *target_frame; yystype *type_frame; yystype *value_frame; yystype *keyword_frame; { <API key> *type_entry; <API key> *value_entry; <API key> *cstr_entry; unsigned short int enumval_code; unsigned short int enumset_code; unsigned short int type; char *cset_name; int i; Boolean found; String str; XmStringDirection dir; XmDirection lay_dir; XmString cstr_r = NULL; _assert(type_frame->b_tag == sar_k_token_frame, "value frame missing from stack" ); /* ** Make a compound string component. */ cstr_entry = (<API key> *) sem_create_cstr(); /* Evaluate type. */ type_entry = (<API key> *)type_frame->value.az_keyword_entry; enumval_code = type_entry->b_subclass; enumset_code = <API key>[<API key>]; found = FALSE; for (i = 0; i < enum_set_table[enumset_code].values_cnt; i++) if (enum_set_table[enumset_code].values[i] == enumval_code) { found = TRUE; break; } if (found) type = <API key>[enumval_code]; else { <API key>(d_arg_type, <API key>(type_frame), uil_enumval_names[enumval_code], "<API key>", "<API key>"); type = <API key>; } switch (type) { case <API key>: case <API key>: case <API key>: case <API key>: /* If value_frame is not null, issue diagnostic. */ if (value_frame->b_tag != sar_k_null_frame) <API key>(d_arg_type, <API key>(value_frame), "non-NULL", "<API key>", "NULL"); cstr_r = <API key>(type, 0, NULL); break; case <API key>: if ((value_frame->b_tag != sar_k_null_frame) && (value_frame->b_type != CHARSET_NAME)) <API key>(d_arg_type, <API key>(value_frame), "non-NULL", "<API key>", "NULL or <API key>"); else if (value_frame->b_type == CHARSET_NAME) { cset_name = sem_charset_name((value_frame->value.az_keyword_entry)->b_subclass, (<API key> *) (value_frame->value.az_keyword_entry)); if (strcmp(cset_name, "<API key>") != 0) <API key>(d_arg_type, <API key>(value_frame), cset_name, "<API key>", "<API key>"); } cstr_r = <API key>(type, strlen(<API key>), <API key>); break; case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: str = ""; if (value_frame->b_tag == sar_k_null_frame) <API key>(d_arg_type, type_frame->az_source_record, type_frame->b_source_end, "NULL", "<API key>", diag_value_text(sym_k_char_8_value)); else if ((value_frame->b_type != CHAR_8_LITERAL) && (value_frame->b_type != LOC_STRING) && ((value_frame->b_type != CHARSET_NAME) || (type != <API key>))) <API key>(d_arg_type, <API key>(value_frame), <API key>[value_frame->b_type], "<API key>", diag_value_text(sym_k_char_8_value)); else { if (value_frame->b_type == CHARSET_NAME) { cset_name = sem_charset_name((value_frame->value.az_keyword_entry)->b_subclass, (<API key> *) (value_frame->value.az_keyword_entry)); if (strcmp(cset_name, "<API key>") == 0) str = <API key>; else str = cset_name; } else /* Extract string */ str = ((<API key> *) (value_frame->value.az_symbol_entry))->value.c_value; } cstr_r = <API key>(type, strlen(str), (XtPointer)str); break; case <API key>: if (value_frame->b_tag == sar_k_null_frame) <API key>(d_arg_type, type_frame->az_source_record, type_frame->b_source_end, "NULL", "<API key>", "XmStringDirection"); else if (value_frame->b_type != ENUMVAL_NAME) <API key>(d_arg_type, <API key>(value_frame), diag_value_text(value_frame->b_type), "<API key>", "XmStringDirection"); else { /* Extract and validate enumval */ value_entry = (<API key> *)value_frame->value.az_keyword_entry; enumval_code = value_entry->b_subclass; enumset_code = <API key>[<API key>]; found = FALSE; for (i = 0; i < enum_set_table[enumset_code].values_cnt; i++) if (enum_set_table[enumset_code].values[i] == enumval_code) { found = TRUE; break; } if (found) dir = <API key>[enumval_code]; else { <API key>(d_arg_type, <API key>(value_frame), uil_enumval_names[enumval_code], "<API key>", "XmStringDirection"); dir = <API key>; } } cstr_r = <API key>(type, sizeof(XmStringDirection), &dir); break; case <API key>: if (value_frame->b_tag == sar_k_null_frame) <API key>(d_arg_type, type_frame->az_source_record, type_frame->b_source_end, "NULL", "<API key>", "XmDirection"); else if (value_frame->b_type != ENUMVAL_NAME) <API key>(d_arg_type, <API key>(value_frame), diag_value_text(value_frame->b_type), "<API key>", "XmDirection"); else { /* Extract and validate enumval */ value_entry = (<API key> *)value_frame->value.az_keyword_entry; enumval_code = value_entry->b_subclass; enumset_code = <API key>[<API key>]; found = FALSE; for (i = 0; i < enum_set_table[enumset_code].values_cnt; i++) if (enum_set_table[enumset_code].values[i] == enumval_code) { found = TRUE; break; } if (found) lay_dir = <API key>[enumval_code]; else { <API key>(d_arg_type, <API key>(value_frame), uil_enumval_names[enumval_code], "<API key>", "XmDirection"); lay_dir = XmLEFT_TO_RIGHT; } } cstr_r = <API key>(type, sizeof(XmDirection), &lay_dir); break; } cstr_entry->value.xms_value = cstr_r; cstr_entry->w_length = XmStringLength(cstr_r); cstr_entry-><API key> = NULL; _assert(cstr_entry->w_length <= MrmMaxResourceSize, "compound string too long" ); /* ** initialize the target frame */ <API key>( target_frame, keyword_frame ); <API key> ( &cstr_entry->header, type_frame ); target_frame->b_tag = sar_k_value_frame; target_frame->b_type = <API key>; target_frame->b_flags = sym_m_private; target_frame->value.az_symbol_entry = (sym_entry_type *)cstr_entry; } /* **++ ** FUNCTIONAL DESCRIPTION: ** ** This function makes a WIDE_CHARACTER and sets the properties ** of the string. ** ** FORMAL PARAMETERS: ** ** target_frame pointer to resultant token stack frame ** value_frame pointer to string value ** attr_frame pointer to strings attributes ** keyword_frame frame to use as locator for result ** ** IMPLICIT INPUTS: ** ** none ** ** IMPLICIT OUTPUTS: ** ** none ** ** FUNCTION VALUE: ** ** void ** ** SIDE EFFECTS: ** ** none ** **-- **/ void sar_make_wchar_str ( target_frame, value_frame, attr_frame, keyword_frame ) yystype *target_frame; yystype *value_frame; yystype *attr_frame; yystype *keyword_frame; { <API key> *value_entry; <API key> *wchar_str_entry; _assert( value_frame->b_tag == sar_k_value_frame, "value frame missing from stack" ); /* ** Make a wide_character string operation. The wide_character string will ** be created during retrieval from the UID file. */ wchar_str_entry = (<API key> *) <API key>(); wchar_str_entry->b_expr_opr = sym_k_wchar_str_op; if ((value_frame->b_flags & sym_m_forward_ref) != 0) <API key> (value_frame, (char*)&(wchar_str_entry->az_exp_op1), sym_k_patch_add); else { value_entry = (<API key> *) value_frame->value.az_symbol_entry; value_entry->b_type = value_frame->b_type; wchar_str_entry->az_exp_op1 = value_entry; } /* ** initialize the target frame */ <API key>( target_frame, keyword_frame ); <API key> ( &wchar_str_entry->header, value_frame ); target_frame->b_tag = sar_k_value_frame; target_frame->b_type = <API key>; target_frame->b_flags = sym_m_private; target_frame->value.az_symbol_entry = (sym_entry_type *)wchar_str_entry; } /* **++ ** FUNCTIONAL DESCRIPTION: ** ** This function issues an error message saying that the value is ** the wrong type for this context. ** ** FORMAL PARAMETERS: ** ** value_frame pointer to resultant value stack frame ** expected_type type of constant required by this context ** ** IMPLICIT INPUTS: ** ** none ** ** IMPLICIT OUTPUTS: ** ** none ** ** FUNCTION VALUE: ** ** void ** ** SIDE EFFECTS: ** ** error message is issued ** **-- **/ void <API key>( value_frame, expected_type ) yystype *value_frame; int expected_type; { _assert( value_frame->b_tag == sar_k_value_frame, "value frame missing" ); /* ** make the target frame an error value frame */ if (value_frame->b_type != sym_k_error_value) <API key> ( d_wrong_type, <API key>( value_frame ), diag_value_text( value_frame->b_type ), diag_value_text( expected_type ) ); value_frame->b_type = sym_k_error_value; value_frame->b_flags = sym_m_private; value_frame->value.az_symbol_entry = (sym_entry_type *) <API key>; } /* **++ ** FUNCTIONAL DESCRIPTION: ** ** This function issues an error message saying that the value ** must be private. Expect for arguments and argument values, ** values used by UIL need to be private rather than public. ** To make them public would mean that URM would need to perform ** the function at runtime. ** ** FORMAL PARAMETERS: ** ** value_frame pointer to resultant value stack frame ** ** IMPLICIT INPUTS: ** ** none ** ** IMPLICIT OUTPUTS: ** ** none ** ** FUNCTION VALUE: ** ** void ** ** SIDE EFFECTS: ** ** error message is issued ** **-- **/ void sar_private_error( value_frame ) yystype *value_frame; { _assert( value_frame->b_tag == sar_k_value_frame, "value frame missing" ); /* ** make the target frame an error value frame */ if (value_frame->b_type != sym_k_error_value) { <API key> *value_entry; value_entry = (<API key> *) value_frame->value.az_symbol_entry; <API key> ( d_nonpvt, <API key>( value_frame ), value_entry->obj_header.az_name->c_text ); } value_frame->b_type = sym_k_error_value; value_frame->b_flags = sym_m_private; value_frame->value.az_symbol_entry = (sym_entry_type *) <API key>; } /* **++ ** FUNCTIONAL DESCRIPTION: ** ** This function creates a value entry for an imported value. ** ** FORMAL PARAMETERS: ** ** target_frame ptr to target value frame on parse stack ** token_frame ptr to token frame giving the data type ** ** IMPLICIT INPUTS: ** ** none ** ** IMPLICIT OUTPUTS: ** ** none ** ** FUNCTION VALUE: ** ** void ** ** SIDE EFFECTS: ** ** none ** **-- **/ void <API key>(target_frame, token_frame) yystype *target_frame; yystype *token_frame; { <API key> *value_entry; _assert( token_frame->b_tag == sar_k_token_frame, "token frame missing" ); /* ** Need to create a value entry and mark it as imported. ** The b_type field of the token has been set to the type of value ** by a prior grammar reduction */ value_entry = (<API key> *) sem_allocate_node (sym_k_value_entry, <API key>); <API key> ( &value_entry->header, &yylval ); /* value_entry->az_source_rec = yylval.az_source_record; */ value_entry->b_type = token_frame->b_type; value_entry->obj_header.b_flags = sym_m_imported; /* ** set up the target frame */ target_frame->b_tag = sar_k_value_frame; target_frame->b_flags = sym_m_imported; target_frame->b_type = value_entry->b_type; target_frame->value.az_symbol_entry = (sym_entry_type *) value_entry; } /* **++ ** FUNCTIONAL DESCRIPTION: ** ** This function binds the name of a value with its value. ** ** FORMAL PARAMETERS: ** ** id_frame ptr to token frame holding the name for the value ** value_frame ptr to value frame ** ** IMPLICIT INPUTS: ** ** <API key> global pointer to the "current" section list ** ** IMPLICIT OUTPUTS: ** ** none ** ** FUNCTION VALUE: ** ** void ** ** SIDE EFFECTS: ** ** errors if name has previously been used to declare another object ** may be a new value entry ** **-- **/ void sar_bind_value_name(id_frame, value_frame, semi_frame) yystype *id_frame; yystype *value_frame; yystype *semi_frame; { sym_name_entry_type *name_entry; <API key> *value_entry; <API key> *section_entry; int flags; boolean error; _assert( id_frame->b_tag == sar_k_token_frame, "id frame missing" ); _assert( value_frame->b_tag == sar_k_value_frame, "value frame missing" ); /* ** First we check on the name to see if it has been previously used. ** This function returns NULL if name cannot be used, in which case ** processing is over. */ name_entry = sem_dcl_name( id_frame ); if (name_entry == NULL) return; /* ** Processing is now based on where the value is private, imported, or ** exported. */ value_entry = (<API key> *) value_frame->value.az_symbol_entry; flags = value_frame->b_flags; error = (value_frame->b_type == sym_k_error_value); if ((flags & sym_m_imported) == 0) { if ((value_entry->obj_header.az_name != NULL) || error) { /* ** Create a new value node for the unary value reference operator. ** az_exp_op1 will point to the node being referenced. */ <API key> *<API key>; <API key> = value_entry; value_entry = <API key> ("",0,sym_k_any_value); value_entry->b_expr_opr = sym_k_valref_op; /* ** If the value is a forward reference, we'll patch in the ** address of the the referenced value between passes. Otherwise, ** just point to the referenced value node. */ if ((value_frame->b_flags & sym_m_forward_ref) != 0) <API key> (value_frame, (char*)&(value_entry->az_exp_op1), sym_k_patch_add); else value_entry->az_exp_op1 = <API key>; } if ((flags & sym_m_exported) != 0) <API key>( name_entry ); } /* ** Place the name and flags in the value entry. */ value_entry->obj_header.az_name = name_entry; value_entry->obj_header.b_flags = (value_entry->obj_header.b_flags & clear_class_mask) | flags; name_entry->az_object = (sym_entry_type *) value_entry; /* ** save the source file info for this value entry */ <API key> (&value_entry->header, id_frame, semi_frame ); /* ** allocate a section entry to link the value entry into the structure */ section_entry = (<API key> *) sem_allocate_node (sym_k_section_entry, <API key>); /* ** Link this entry off of the current section list */ section_entry->next = (sym_entry_type *) <API key>->entries; <API key>->entries = (sym_entry_type *) section_entry; section_entry->entries = (sym_entry_type *)value_entry; } /* **++ ** FUNCTIONAL DESCRIPTION: ** ** This function checks to see if a name is available for naming a ** construct. ** ** FORMAL PARAMETERS: ** ** id_frame ptr to a token frame on the parse stack holding the name ** ** IMPLICIT INPUTS: ** ** none ** ** IMPLICIT OUTPUTS: ** ** none ** ** FUNCTION VALUE: ** ** ptr to name entry or NULL ** ** SIDE EFFECTS: ** ** name entry may be created ** error message for duplicate declaration may be issued ** **-- **/ sym_name_entry_type *sem_dcl_name(id_frame) XmConst yystype *id_frame; { sym_name_entry_type *name_entry; char * ptr; _assert( id_frame->b_tag == sar_k_token_frame, "arg1 not id frame" ); /* ** The id frame may hold a name or the keyword for a font name, color ** name, reason name etc. If it is one of these special name, then ** we insert the special name in the symbol table as a name. This has ** the effect of creating a name entry if one doesn't existing or finding ** the name entry if one does. */ if (id_frame->b_type != NAME) { <API key> ( d_override_builtin, <API key>( id_frame ), id_frame->value.az_keyword_entry->at_name); name_entry = sym_insert_name ( id_frame->value.az_keyword_entry->b_length, id_frame->value.az_keyword_entry->at_name ); } else name_entry = (sym_name_entry_type *) id_frame->value.az_symbol_entry; /* ** If the name entry already has an object linked from it, we have an ** duplicate definition of the same name. Otherwise, everything is fine. */ if (name_entry->az_object == NULL ) return name_entry; if (name_entry->az_object->header.b_tag == sym_k_value_entry) { ptr = diag_value_text ( ((<API key> *) (name_entry->az_object))->b_type); } else if (name_entry->az_object->header.b_tag == sym_k_widget_entry) { ptr = diag_object_text ( ((<API key> *) (name_entry->az_object)) -> header.b_type); } else { ptr = diag_tag_text( name_entry->az_object->header.b_tag ); } <API key> ( d_previous_def, <API key>( id_frame ), name_entry->c_text, ptr ); return NULL; } /* **++ ** FUNCTIONAL DESCRIPTION: ** ** This function creates a value entry for a token that represents ** a value. ** ** FORMAL PARAMETERS: ** ** value pointer to value ** length length of the value in bytes ** value_type type of value to create ** ** IMPLICIT INPUTS: ** ** none ** ** IMPLICIT OUTPUTS: ** ** none ** ** FUNCTION VALUE: ** ** a value_entry ** ** SIDE EFFECTS: ** ** value entry is created in the symbol table ** **-- **/ <API key> *<API key>( value, length, value_type ) char *value; int length; int value_type; { <API key> *value_entry; /* ** the value can be a string, integer, float, boolean, or ** a font_name, argument_name, color_name, or reason_name */ /* ** the strategy of the function is to determine the contents ** of the value entry, then centrally allocate and initialize it. ** ** Allocate the entry and save the source position. Initialize ** all fields to either default values or call parameters. */ value_entry = (<API key> *) sem_allocate_node (sym_k_value_entry, <API key>); <API key> ( &value_entry->header, &yylval ); sar_assoc_comment ((sym_obj_entry_type *)value_entry); /* preserve comments */ value_entry->b_type = value_type; value_entry->obj_header.b_flags = (sym_m_private | sym_m_builtin); value_entry->w_length = length; value_entry->output_state = 0; value_entry->b_table_count = 0; value_entry->b_aux_flags = 0; value_entry->b_arg_type = 0; value_entry->b_data_offset = 0; value_entry->b_pixel_type = <API key>; value_entry->b_charset = 0; value_entry->b_direction = NOSTRING_DIRECTION; value_entry->b_max_index = 0; value_entry->b_expr_opr = <API key>; value_entry-><API key> = 0; value_entry->resource_id = 0; value_entry->obj_header.az_name = NULL; value_entry->az_charset_value = NULL; value_entry->az_next_table_value = NULL; value_entry->value.l_integer = 0; if ((value_type == sym_k_char_8_value || value_type == sym_k_font_value || value_type == sym_k_fontset_value || value_type == sym_k_keysym_value || value_type == <API key> || value_type == <API key> || value_type == <API key>) && (length > 0)) { value_entry->value.c_value = (char *) XtCalloc(1,length); _move( value_entry->value.c_value, value, length ); } else if (value_type == <API key> && (length > 0)) { value_entry->value.xms_value = (XmString) XtCalloc(1,length); _move( value_entry->value.xms_value, value, length ); } else if ( length > 0 ) _move( &(value_entry->value.c_value), value, length ); /* For enumerations which accept boolean values */ if (value_type == sym_k_bool_value) value_entry-><API key> = (*value) ? sym_k_TRUE_enumval : sym_k_FALSE_enumval; return value_entry; } /* **++ ** FUNCTIONAL DESCRIPTION: ** ** This function creates the value symbol node for an ** identifier declaration. ** ** FORMAL PARAMETERS: ** ** id_frame ptr to token frame for the identifier name ** ** IMPLICIT INPUTS: ** ** <API key> global that points to the "current" section list ** ** IMPLICIT OUTPUTS: ** ** none ** ** FUNCTION VALUE: ** ** void ** ** SIDE EFFECTS: ** ** errors may be issued for previously defined name ** **-- **/ void <API key> (id_frame, semi_frame) XmConst yystype *id_frame; XmConst yystype *semi_frame; { sym_name_entry_type *name_entry; <API key> *value_entry; <API key> *section_entry; int len; char * ptr; /* ** Call standard routine to check name entry for id_frame. ** This routine handles font name, color names, etc used as ids */ name_entry = sem_dcl_name( id_frame ); if (name_entry == NULL) return; /* ** Allocate the value entry and fill it in. The b_type field ** in name entries holds the length of the name. Add one for null. */ len = name_entry->header.b_type + 1; ptr = name_entry->c_text; value_entry = <API key> ( ptr, len, <API key> ); _move (value_entry->value.c_value, ptr, len); value_entry->obj_header.b_flags |= sym_m_private; value_entry->obj_header.az_name = name_entry; name_entry->az_object = (sym_entry_type *) value_entry; /* ** save the source file info for this identifier entry */ <API key> (&name_entry->header, id_frame, semi_frame ); /* ** allocate a section entry to link the identifier entry into the structure */ section_entry = (<API key> *) sem_allocate_node (sym_k_section_entry, <API key>); /* ** Link this entry off of the current section list */ section_entry->next = (sym_entry_type *) <API key>->entries; <API key>->entries = (sym_entry_type *) section_entry; section_entry->entries = (sym_entry_type *)name_entry; } /* **++ ** FUNCTIONAL DESCRIPTION: ** ** This function builds a font table. This font table ** is a list of symbol table entries of font items. ** ** FORMAL PARAMETERS: ** ** target_frame frame holding the font table generated ** font_frame value frame specifying the font value ** prior_target_frame frame holding the font table generated so far ** keyword_frame frame holding the font_table keyword ** ** IMPLICIT INPUTS: ** ** none ** ** IMPLICIT OUTPUTS: ** ** target_frame ** ** FUNCTION VALUE: ** ** void ** ** SIDE EFFECTS: ** ** font table symbol entry is generated if prior target is null ** **-- **/ void sar_make_font_table (target_frame, font_frame, prior_target_frame, keyword_frame) yystype *target_frame; yystype *font_frame; yystype *prior_target_frame; yystype *keyword_frame; { <API key> *font_table_entry; <API key> *font_item; _assert( font_frame->b_tag == sar_k_value_frame, "font item missing" ); font_item = (<API key> *) font_frame->value.az_symbol_entry; /* ** If the prior frame is null, this is the first item in the ** table. We need to generate the font table symbol entry. */ switch (prior_target_frame->b_tag) { case sar_k_null_frame: font_table_entry = <API key> ((char*)&font_item, sizeof(long), <API key>); font_table_entry->b_table_count = 1; /* * If we are dealing with an indirect reference in the table, * make it a valref node so we reference it correctly. */ if (font_item->obj_header.az_name != NULL) { <API key> *font_save; font_save = font_item; font_item = <API key> (0, 0, font_save->b_type); font_item->b_type = font_save->b_type; font_item->obj_header.b_flags = sym_m_private; font_item->b_expr_opr = sym_k_valref_op; font_item->az_exp_op1 = font_save; } font_table_entry-><API key> = font_item; break; case sar_k_value_frame: { int count; <API key> *last_font_item; font_table_entry = (<API key> *) prior_target_frame->value.az_symbol_entry; for (count = 0, last_font_item = font_table_entry-><API key>; last_font_item->az_next_table_value != NULL; last_font_item = last_font_item->az_next_table_value) count++; if (count >= <API key>) <API key> (d_too_many, <API key>( font_frame ), diag_value_text( sym_k_font_value ), diag_value_text( <API key> ), <API key> ); else { /* * If we are dealing with an indirect reference in the table, * make it a valref node so we reference it correctly. */ if (font_item->obj_header.az_name != NULL) { <API key> *font_save; font_save = font_item; font_item = <API key> (0, 0, font_save->b_type); font_item->b_type = font_save->b_type; font_item->obj_header.b_flags = sym_m_private; font_item->b_expr_opr = sym_k_valref_op; font_item->az_exp_op1 = font_save; } last_font_item->az_next_table_value = font_item; font_table_entry->b_table_count = count + 1; } break; } default: _assert( FALSE, "prior frame in error" ); } /* ** font item needs to be marked as a table entry */ font_item->b_aux_flags |= sym_m_table_entry; font_item->az_next_table_value = NULL; /* ** initialize the target frame */ <API key> (target_frame, keyword_frame); target_frame->b_tag = sar_k_value_frame; target_frame->b_type = <API key>; target_frame->b_flags = sym_m_private; target_frame->value.az_symbol_entry = (sym_entry_type *) font_table_entry; } /* **++ ** FUNCTIONAL DESCRIPTION: ** ** This function builds a item for a font table. This font table ** is a list of symbol table entries of font items. ** ** FORMAL PARAMETERS: ** ** target_frame frame holding the font item generated ** charset_frame token or null frame holding charset token ** font_frame value frame specifying the font value ** ** IMPLICIT INPUTS: ** ** none ** ** IMPLICIT OUTPUTS: ** ** target_frame ** ** FUNCTION VALUE: ** ** void ** ** SIDE EFFECTS: ** ** copy the font value unless it is unnamed ** **-- **/ void sar_make_font_item(target_frame, charset_frame, font_frame) yystype *target_frame; yystype *charset_frame; yystype *font_frame; { <API key> *font_value_entry; int item_type; _assert( font_frame->b_tag == sar_k_value_frame, "font exp is missing" ); font_value_entry = (<API key> *) font_frame->value.az_symbol_entry; if ((font_frame->b_flags & sym_m_forward_ref) != 0) { <API key> (d_undefined, <API key>(font_frame), "font entry", font_value_entry->obj_header.az_name->c_text); } item_type = font_value_entry->b_type; switch (item_type) { case sym_k_font_value: case sym_k_fontset_value: { int charset; charset = font_value_entry->b_charset; /* ** If the attr_frame is not null, it must be a value frame with contains ** a pointer to the value entry for the userdefined charset, or a token frame ** which contains the charset token subclass. */ switch (charset_frame->b_tag) { case sar_k_value_frame: { <API key> * az_value_entry; az_value_entry = (<API key> *)charset_frame->value.az_symbol_entry; font_value_entry->b_charset = az_value_entry->b_charset; font_value_entry->az_charset_value = az_value_entry->az_charset_value; break; } case sar_k_token_frame: { <API key> *keyword_entry; keyword_entry = (<API key> *) charset_frame->value.az_keyword_entry; font_value_entry->b_charset = <API key>( keyword_entry->b_subclass ); break; } } break; } case sym_k_error_value: break; default: <API key> ( d_wrong_type, <API key>( font_frame ), diag_value_text( item_type ), diag_value_text( sym_k_font_value ) ); item_type = sym_k_error_value; font_value_entry = (<API key> *) <API key>; } /* ** initialize the target frame */ <API key>( target_frame, font_frame ); target_frame->b_tag = sar_k_value_frame; target_frame->b_type = item_type; target_frame->b_flags = sym_m_private; target_frame->value.az_symbol_entry = (sym_entry_type *) font_value_entry; } /* **++ ** FUNCTIONAL DESCRIPTION: ** ** This function builds a font value. ** ** FORMAL PARAMETERS: ** ** target_frame frame holding the font item generated ** charset_frame token or null frame holding charset token ** value_frame value frame specifying the font value ** keyword_frame frame to use as locator for result ** ** IMPLICIT INPUTS: ** ** none ** ** IMPLICIT OUTPUTS: ** ** target_frame ** ** FUNCTION VALUE: ** ** void ** ** SIDE EFFECTS: ** ** create a font symbol table entry ** **-- **/ void sar_make_font(target_frame, charset_frame, value_frame, keyword_frame) yystype *target_frame; yystype *charset_frame; yystype *value_frame; yystype *keyword_frame; { <API key> *font_value_entry; <API key> *value_entry; _assert( value_frame->b_tag == sar_k_value_frame, "font name is missing" ); font_value_entry = <API key> ("", 0, sym_k_font_value ); font_value_entry->b_type = sym_k_font_value; font_value_entry->obj_header.b_flags = sym_m_private; font_value_entry->b_expr_opr = sym_k_coerce_op; if ((value_frame->b_flags & sym_m_forward_ref) != 0) <API key> (value_frame, (char*)&(font_value_entry->az_exp_op1), sym_k_patch_add); else { value_entry = (<API key> *) value_frame->value.az_symbol_entry; font_value_entry->az_exp_op1 = value_entry; } /* ** If the attr_frame is not null, it must be a value frame with contains ** a pointer to the value entry for the userdefined charset, or a token frame ** which contains the charset token subclass. */ switch (charset_frame->b_tag) { case sar_k_value_frame: { <API key> * az_value_entry; az_value_entry = (<API key> *) charset_frame->value.az_symbol_entry; font_value_entry->b_charset = az_value_entry->b_charset; /* BEGIN HAL Fix CR 5266 */ font_value_entry->az_charset_value = az_value_entry; /* END HAL Fix CR 5266 */ break; } case sar_k_token_frame: { <API key> *keyword_entry; keyword_entry = (<API key> *) charset_frame->value.az_keyword_entry; font_value_entry->b_charset = <API key>( keyword_entry->b_subclass ); break; } default: /* BEGIN OSF Fix CR 5443 */ font_value_entry->b_charset = <API key>; /* END OSF Fix CR 5443 */ break; } /* ** initialize the target frame */ <API key>( target_frame, keyword_frame ); target_frame->b_tag = sar_k_value_frame; target_frame->b_type = sym_k_font_value; target_frame->b_flags = sym_m_private; target_frame->value.az_symbol_entry = (sym_entry_type *) font_value_entry; } /* **++ ** FUNCTIONAL DESCRIPTION: ** ** This function builds a fontset value. ** ** FORMAL PARAMETERS: ** ** target_frame frame holding the font item generated ** charset_frame token or null frame holding charset token ** value_frame value frame specifying the font value ** keyword_frame frame to use as locator for result ** ** IMPLICIT INPUTS: ** ** none ** ** IMPLICIT OUTPUTS: ** ** target_frame ** ** FUNCTION VALUE: ** ** void ** ** SIDE EFFECTS: ** ** create a font symbol table entry ** **-- **/ void sar_make_fontset(target_frame, charset_frame, value_frame, keyword_frame) yystype *target_frame; yystype *charset_frame; yystype *value_frame; yystype *keyword_frame; { <API key> *font_value_entry; <API key> *value_entry; _assert( value_frame->b_tag == sar_k_value_frame, "font name is missing" ); font_value_entry = <API key> ("", 0, sym_k_fontset_value ); font_value_entry->b_type = sym_k_fontset_value; font_value_entry->obj_header.b_flags = sym_m_private; font_value_entry->b_expr_opr = sym_k_coerce_op; if ((value_frame->b_flags & sym_m_forward_ref) != 0) <API key> (value_frame, (char*)&(font_value_entry->az_exp_op1), sym_k_patch_add); else { value_entry = (<API key> *) value_frame->value.az_symbol_entry; font_value_entry->az_exp_op1 = value_entry; } /* ** If the attr_frame is not null, it must be a value frame with contains ** a pointer to the value entry for the userdefined charset, or a token frame ** which contains the charset token subclass. */ switch (charset_frame->b_tag) { case sar_k_value_frame: { <API key> * az_value_entry; az_value_entry = (<API key> *) charset_frame->value.az_symbol_entry; font_value_entry->b_charset = az_value_entry->b_charset; /* BEGIN HAL Fix CR 5266 */ font_value_entry->az_charset_value = az_value_entry; /* END HAL Fix CR 5266 */ break; } case sar_k_token_frame: { <API key> *keyword_entry; keyword_entry = (<API key> *) charset_frame->value.az_keyword_entry; font_value_entry->b_charset = <API key>( keyword_entry->b_subclass ); break; } default: /* BEGIN OSF Fix CR 5443 */ font_value_entry->b_charset = <API key>; /* END OSF Fix CR 5443 */ break; } /* ** initialize the target frame */ <API key>( target_frame, keyword_frame ); target_frame->b_tag = sar_k_value_frame; target_frame->b_type = sym_k_fontset_value; target_frame->b_flags = sym_m_private; target_frame->value.az_symbol_entry = (sym_entry_type *) font_value_entry; } /* **++ ** FUNCTIONAL DESCRIPTION: ** ** This function builds a color item which is a temporary respository ** to hold data for a single color to be placed in a color table. The ** color item is deleted when the color table is built by ** <API key>. ** ** FORMAL PARAMETERS: ** ** target_frame frame holding the color item generated ** color_frame token or value frame giving the color ** letter_frame value frame specifying the letter to use for color ** keyword_frame frame to use as locator for result ** ** IMPLICIT INPUTS: ** ** none ** ** IMPLICIT OUTPUTS: ** ** target_frame ** ** FUNCTION VALUE: ** ** void ** ** SIDE EFFECTS: ** ** create a color item symbol table entry ** **-- **/ void sar_make_color_item (target_frame, color_frame, letter_frame ) yystype *target_frame; yystype *color_frame; yystype *letter_frame; { <API key> *item_entry; <API key> *letter_entry; _assert( letter_frame->b_tag == sar_k_value_frame, "letter frame missing" ); /* ** initialize the target frame */ <API key>( target_frame, color_frame ); target_frame->b_tag = sar_k_value_frame; target_frame->b_type = 0; target_frame->b_flags = 0; target_frame->value.az_symbol_entry = 0; /* ** The color can be either a color value or the keyword background or ** foreground. Want to step up: ** target_frame->b_tag: with either sar_k_value_frame for no error ** or sar_k_null_frame for an error ** color_entry: color value if there is one ** 0 for background ** 1 for foreground */ /* ** Allocate the color item and fill it in */ item_entry = (<API key> *) sem_allocate_node(<API key>, <API key> ); <API key> (&item_entry->header, color_frame); item_entry->b_index = 0; item_entry->az_next = NULL; switch (color_frame->b_tag) { case sar_k_token_frame: { <API key> *keyword_entry; /* ** This is the foreground or background case */ keyword_entry = color_frame->value.az_keyword_entry; switch (keyword_entry->b_token) { case BACKGROUND: item_entry->az_color = (<API key> *) URMColorTableBG; break; case FOREGROUND: item_entry->az_color = (<API key> *) URMColorTableFG; break; default: _assert( FALSE, "missing keyword frame" ); } break; } case sar_k_value_frame: if ((color_frame->b_flags & sym_m_forward_ref) != 0) { <API key> *diag_value; diag_value = (<API key> *) color_frame->value.az_symbol_entry; <API key> (d_undefined, <API key>(color_frame), "color entry", diag_value->obj_header.az_name->c_text); } else { item_entry->az_color = (<API key> *) color_frame->value.az_symbol_entry; } break; default: _assert( FALSE, "color frame missing" ); } /* ** Letter frame has already been checked in the grammar to be a character ** string. Need to further check that it has a length of 1. */ letter_entry = (<API key> *) letter_frame->value.az_symbol_entry; if (letter_entry->w_length != 1) { <API key> ( d_single_letter, <API key>( letter_frame ) ); target_frame->b_tag = sar_k_null_frame; return; } item_entry->b_letter = letter_entry->value.c_value[0]; /* ** If the tag is in error - return */ if (target_frame->b_tag == sar_k_null_frame) return; /* ** Save source information */ <API key> ( &item_entry->header, color_frame, letter_frame); target_frame->value.az_symbol_entry = (sym_entry_type *) item_entry; } /* **++ ** FUNCTIONAL DESCRIPTION: ** ** This function builds a list of the color items that are used to ** produce the color table. Each color is checked to see that ** its letter is unique. The new color item is placed on the ** front of the list. ** ** FORMAL PARAMETERS: ** ** target_frame frame holding the color item list ** item_frame color item to be added to list ** prior_target_frame existing color list ** ** IMPLICIT INPUTS: ** ** none ** ** IMPLICIT OUTPUTS: ** ** target_frame ** ** FUNCTION VALUE: ** ** void ** ** SIDE EFFECTS: ** ** none ** **-- **/ void <API key>(target_frame, item_frame, prior_target_frame) yystype *target_frame; yystype *item_frame; yystype *prior_target_frame; { <API key> *item_entry; <API key> *prior_item_entry; /* ** Tag for the prior_target frame indicates if this is the first ** or a subsequent color item on the list. */ switch (prior_target_frame->b_tag) { case sar_k_null_frame: prior_item_entry = NULL; break; case sar_k_value_frame: prior_item_entry = (<API key> *) prior_target_frame->value.az_symbol_entry; break; default: _assert( FALSE, "prior frame missing" ); } /* ** initialize the target frame */ <API key>( target_frame, item_frame ); target_frame->b_tag = sar_k_value_frame; target_frame->b_type = 0; target_frame->b_flags = 0; target_frame->value.az_symbol_entry = (sym_entry_type *) prior_item_entry; /* ** Need to verify that the letter associated with the current color ** item is unique. */ switch (item_frame->b_tag) { case sar_k_value_frame: { <API key> *next_item_entry; item_entry = (<API key> *) item_frame->value.az_symbol_entry; for (next_item_entry = prior_item_entry; next_item_entry != NULL; next_item_entry = next_item_entry->az_next) if (next_item_entry->b_letter == item_entry->b_letter) { <API key> ( d_dup_letter, <API key>( item_frame ) ); return; } item_entry->az_next = prior_item_entry; target_frame->value.az_symbol_entry = (sym_entry_type *) item_entry; return; } case sar_k_null_frame: return; default: _assert( FALSE, "list frame missing" ); } } /* **++ ** FUNCTIONAL DESCRIPTION: ** ** This function builds a color table. It takes a series of ** color items and repackages them within the color table. ** ** FORMAL PARAMETERS: ** ** target_frame frame for holding the color table ** list_frame frame holding first of color item lists ** keyword_frame frame for COLOR_TABLE keyword ** ** IMPLICIT INPUTS: ** ** none ** ** IMPLICIT OUTPUTS: ** ** target_frame ** ** FUNCTION VALUE: ** ** void ** ** SIDE EFFECTS: ** ** none ** **-- **/ void <API key>(target_frame, list_frame, keyword_frame) yystype *target_frame; yystype *list_frame; yystype *keyword_frame; { <API key> *next_item_entry; <API key> *color_table_entry; int target_type; /* ** Tag for the list frame indicates if there are any color items. */ switch (list_frame->b_tag) { case sar_k_null_frame: target_type = sym_k_error_value; color_table_entry = <API key>; break; case sar_k_value_frame: { int count; int index; count = 0; index = 1; for (next_item_entry = (<API key> *) list_frame->value.az_symbol_entry; next_item_entry != NULL; next_item_entry = next_item_entry->az_next) { count++; switch ((long)next_item_entry->az_color) { case 0: next_item_entry->b_index = URMColorTableBG; break; case 1: next_item_entry->b_index = URMColorTableFG; break; default: next_item_entry->b_index = (unsigned char) ++index; break; } } if (index >= <API key>) { <API key> (d_too_many, <API key>( keyword_frame ), diag_value_text( sym_k_color_value ), diag_value_text( <API key> ), <API key> ); target_type = sym_k_error_value; color_table_entry = <API key>; break; } color_table_entry = (<API key> *) sem_allocate_node (sym_k_value_entry, <API key>); color_table_entry->value.z_color = (sym_color_element *) XtCalloc(1,sizeof(sym_color_element)*count); color_table_entry->b_type = <API key>; color_table_entry->b_table_count = (unsigned char) count; color_table_entry->b_max_index = (unsigned char) index; color_table_entry->obj_header.b_flags = sym_m_private; <API key> ( &color_table_entry->header, list_frame); for (index = 0, next_item_entry = (<API key> *) list_frame->value.az_symbol_entry; next_item_entry != NULL; index++ ) { <API key> *temp; color_table_entry->value.z_color[index].b_index = next_item_entry->b_index; color_table_entry->value.z_color[index].b_letter = next_item_entry->b_letter; color_table_entry->value.z_color[index].az_color = next_item_entry->az_color; temp = next_item_entry; next_item_entry = next_item_entry->az_next; sem_free_node(( sym_entry_type *) temp ); } target_type = <API key>; break; } default: _assert( FALSE, "list frame missing" ); } /* ** initialize the target frame */ <API key>( target_frame, keyword_frame ); target_frame->b_tag = sar_k_value_frame; target_frame->b_type = target_type; target_frame->b_flags = sym_m_private; target_frame->value.az_symbol_entry = (sym_entry_type *) color_table_entry; } /* **++ ** FUNCTIONAL DESCRIPTION: ** ** This function builds a color value. Input to the function is a ** character string give the color name and an option keyword specifying ** display of the color on a monochrome device. ** ** FORMAL PARAMETERS: ** ** target_frame frame to hold the created color value ** color_frame frame giving the character string specifying the color ** mono_frame frame describing monochrome attribute ** keyword_frame frame pointing to COLOR keyword ** ** IMPLICIT INPUTS: ** ** none ** ** IMPLICIT OUTPUTS: ** ** target_frame ** ** FUNCTION VALUE: ** ** void ** ** SIDE EFFECTS: ** ** icon value is created ** **-- **/ void sar_make_color(target_frame, color_frame, mono_frame, keyword_frame) yystype *target_frame; yystype *color_frame; yystype *mono_frame; yystype *keyword_frame; { <API key> *color_entry; <API key> *value_entry; int state; /* ** Mono frame can point to the keyword FOREGROUND or BACKGROUND ** or be null meaning unspecified. */ switch (mono_frame->b_tag) { case sar_k_null_frame: state = <API key>; break; case sar_k_token_frame: switch (mono_frame->value.az_keyword_entry->b_token) { case BACKGROUND: state = <API key>; break; case FOREGROUND: state = <API key>; break; default: _assert( FALSE, "monochrome info missing" ); } break; default: _assert( FALSE, "monochrome info missing" ); } /* ** Transform the char 8 value entry into a color value. ** Before doing this, we need to insure that the string ** is not in error or named. */ _assert( color_frame->b_tag == sar_k_value_frame, "value missing" ); color_entry = <API key> ( "", 0, sym_k_color_value ); color_entry->b_type = sym_k_color_value; color_entry->obj_header.b_flags = sym_m_private; color_entry->b_arg_type = state; color_entry->b_expr_opr = sym_k_coerce_op; if ((color_frame->b_flags & sym_m_forward_ref) != 0) <API key> (color_frame, (char*)&(color_entry->az_exp_op1), sym_k_patch_add); else { value_entry = (<API key> *) color_frame->value.az_symbol_entry; color_entry->az_exp_op1 = value_entry; } /* ** initialize the target frame */ <API key>( target_frame, keyword_frame ); target_frame->b_tag = sar_k_value_frame; target_frame->b_type = sym_k_color_value; target_frame->b_flags = sym_m_private; target_frame->value.az_symbol_entry = (sym_entry_type *) color_entry; } /* **++ ** FUNCTIONAL DESCRIPTION: ** ** This function builds a icon value. Input to the function is a ** color table and a list of string that represent the rows of the ** icon. ** ** FORMAL PARAMETERS: ** ** target_frame frame to hold the created icon value ** table_frame frame describing the color table ** list_frame frame pointing to the list of row strings ** keyword_frame frame pointing to the icon keyword ** ** IMPLICIT INPUTS: ** ** none ** ** IMPLICIT OUTPUTS: ** ** target_frame ** ** FUNCTION VALUE: ** ** void ** ** SIDE EFFECTS: ** ** icon value is created ** **-- **/ void sar_make_icon(target_frame, list_frame, table_frame, keyword_frame) yystype *target_frame; yystype *table_frame; yystype *list_frame; yystype *keyword_frame; { <API key> *table_entry; <API key> *icon_entry; <API key> *head_row_entry; int target_type; int width; int height; /* ** Table_frame specifies the color table for the icon. If this ** argument is null, use the standard color table. */ target_type = sym_k_icon_value; height = 0; width = 0; switch (table_frame->b_tag) { case sar_k_null_frame: table_entry = <API key>(); break; case sar_k_value_frame: table_entry = (<API key> *) table_frame->value.az_symbol_entry; /* ** Check that the table is indeed a color table ** Forward references are set up once the icon entry is created */ if ((table_frame->b_flags & sym_m_forward_ref) != 0) table_entry = NULL; else switch (table_entry->b_type) { case <API key>: break; case sym_k_error_value: default: /* BEGIN OSF Fix CR 5421 */ /* * If the value_frame is not a color_table_value, print * a diagnostic to flag it as an error further down the * road. Otherwise, if it is exported, will cause problems. */ <API key> ( d_wrong_type, <API key>(table_frame), diag_value_text(table_entry->b_type), diag_value_text(<API key>) ); /* END OSF Fix CR 5421 */ target_type = sym_k_error_value; table_entry = <API key>(); break; } break; default: _assert( FALSE, "color table missing" ); } /* ** Now start checking the rows of the table. If the tag on list ** frame is null, there are no rows (this is due to prior errors). ** Rows are linked in reverse order. We reorder them at this ** point since it simplifies .uid generation. */ switch (list_frame->b_tag) { case sar_k_null_frame: target_type = sym_k_error_value; break; case sar_k_value_frame: { <API key> *row_entry; <API key> *temp_row_entry; /* ** Reorder the rows */ for (row_entry = (<API key> *) list_frame->value.az_symbol_entry, head_row_entry = NULL; row_entry != NULL; temp_row_entry = row_entry, row_entry = row_entry->az_next_table_value, temp_row_entry->az_next_table_value = head_row_entry, head_row_entry = temp_row_entry) ; for (row_entry = head_row_entry, width = row_entry->w_length; row_entry != NULL; row_entry = row_entry->az_next_table_value) { /* BEGIN OSF Fix CR 5420 */ /* * Check to make sure each row_entry is a character string. * If it isn't, print a diagnostic message indicating an error. */ if ((row_entry->b_type != sym_k_char_8_value) && (row_entry->b_type != <API key>)) { <API key> ( d_wrong_type, _sar_source_pos2(row_entry), diag_value_text(row_entry->b_type), diag_value_text(sym_k_char_8_value) ); target_type = sym_k_error_value; } /* END OSF Fix CR 5420 */ height++; if (width != row_entry->w_length) { <API key> ( d_icon_width, row_entry->header.az_src_rec, /* line info */ row_entry->header.b_type, /* column infor */ height ); target_type = sym_k_error_value; } } break; } default: _assert( FALSE, "row list missing" ); } if (width > <API key>) { <API key> ( d_too_many, <API key>( keyword_frame ), "column", diag_value_text( sym_k_icon_value ), <API key> ); target_type = sym_k_error_value; } if (height > <API key>) { <API key> ( d_too_many, <API key>( keyword_frame ), "row", diag_value_text( sym_k_icon_value ), <API key> ); target_type = sym_k_error_value; } /* ** If we have no errors, allocate the icon */ if (target_type == sym_k_error_value) icon_entry = <API key>; else { icon_entry = (<API key> *) sem_allocate_node (sym_k_value_entry, <API key>); icon_entry->value.z_icon = (sym_icon_element *) XtCalloc(1,sizeof(sym_icon_element)); icon_entry->b_type = sym_k_icon_value; icon_entry->value.z_icon->w_height = height; icon_entry->value.z_icon->w_width = width; icon_entry->value.z_icon->az_color_table = table_entry; icon_entry->value.z_icon->az_rows = head_row_entry; icon_entry->obj_header.b_flags = sym_m_private; <API key> (&icon_entry->header, list_frame ); if ((table_frame->b_flags & sym_m_forward_ref) != 0) <API key> (table_frame, (char*)&icon_entry->value.z_icon->az_color_table, sym_k_patch_add); } /* ** initialize the target frame */ <API key>( target_frame, keyword_frame ); target_frame->b_tag = sar_k_value_frame; target_frame->b_type = target_type; target_frame->b_flags = sym_m_private; target_frame->value.az_symbol_entry = (sym_entry_type *) icon_entry; } /* **++ ** FUNCTIONAL DESCRIPTION: ** ** This function defines the standard color table. ** ** FORMAL PARAMETERS: ** ** none ** ** IMPLICIT INPUTS: ** ** color_table local static storage ** ** IMPLICIT OUTPUTS: ** ** none ** ** FUNCTION VALUE: ** ** address of standard color table entry ** ** SIDE EFFECTS: ** ** may allocate the standard color table ** **-- **/ static <API key> *<API key>() { static <API key> *color_table = NULL; if (color_table == NULL) { color_table = (<API key> *) sem_allocate_node (sym_k_value_entry, <API key>); color_table->value.z_color = (sym_color_element *) XtCalloc(1,sizeof(sym_color_element)*2); color_table->b_type = <API key>; color_table->b_table_count = 2; color_table->b_max_index = 1; color_table->obj_header.b_flags = sym_m_private; color_table->header.az_src_rec = <API key>; color_table->value.z_color[0].b_index = URMColorTableBG; color_table->value.z_color[0].b_letter = ' '; color_table->value.z_color[0].az_color = (<API key> *) URMColorTableBG; color_table->value.z_color[1].b_index = URMColorTableFG; color_table->value.z_color[1].b_letter = '*'; color_table->value.z_color[1].az_color = (<API key> *) URMColorTableFG; } return color_table; }
#ifndef SIEVE_ECM_PM1_H_ #define SIEVE_ECM_PM1_H_ #include "modredc_ul.h" #include "modredc_15ul.h" #include "modredc_2ul2.h" #include "mod_mpz.h" #include "stage2.h" typedef struct { unsigned long *E; /* The exponent for stage 1 */ unsigned long E_mask; /* Mask (one bit set) of MSB in E[E_nrwords-1] */ unsigned int E_nrwords; /* Number of words in exponent */ unsigned int exp2; /* Exponent of 2 in stage 1 primes */ unsigned int B1; stage2_plan_t stage2; } pm1_plan_t; /* Notes: If s_1 * s_2 = eulerphi(d), we need s_1 precomputed values, s_2 passes and ~(B2-B1)/d steps in each pass. Assuming we can compute V_{k_1}(x+1/x) and V_{k_2}(x+1/x) with about 1 multiply per value by using a common addition chain for S_1 \cup S_2, we can reduce the precomputation cost to only s_1 + s_2 instead of eulerphi(P) if we do only 1 pass. This allows for a larger d: with only 1 pass, sqrt(B2-B1) is optimal, with a flexible number of passes, (B2-B1)^{2/3} is optimal. In one pass we process one k_2 \in S_2 and thus primes p = i*d +- j with j = k_1 + k_2, k_1 \in S_1. We'd like to be able to bound these j by d/2 so that we get compact "block" with no overlap between consecutive blocks. This prevents having to start at lower i/continue to larger i than necessary, to be able to write all p, B_1 < p <= B_2, as p = i*d +- (k_1 + k_2). However, there seems to be no way to write the smallest positive representatives <d/2 of units mod d as a sum of two sets: e.g. for d=30, we'd like {1,7,11,13}. */ #ifdef __cplusplus extern "C" { #endif void pm1_stage1_ul (residueredcul_t, const unsigned long *, const int, const modulusredcul_t); int pm1_ul (modintredcul_t, const modulusredcul_t, const pm1_plan_t *); void pm1_stage1_15ul (residueredc15ul_t, const unsigned long *, const int, const modulusredc15ul_t); int pm1_15ul (modintredc15ul_t, const modulusredc15ul_t, const pm1_plan_t *); void pm1_stage1_2ul2 (residueredc2ul2_t, const unsigned long *, const int, const modulusredc2ul2_t); int pm1_2ul2 (modintredc2ul2_t, const modulusredc2ul2_t, const pm1_plan_t *); void pm1_stage1_mpz (residuempz_t, const unsigned long *, const int, const modulusmpz_t); int pm1_mpz (modintmpz_t, const modulusmpz_t, const pm1_plan_t *); void pm1_make_plan (pm1_plan_t *, const unsigned int, const unsigned int, int); void pm1_clear_plan (pm1_plan_t *); #ifdef __cplusplus } #endif #endif /* SIEVE_ECM_PM1_H_ */
using System; namespace Stronk.Tests.<API key> { public class UrlConversion : TypeConversionTest<Uri> { public UrlConversion() : base( inputSingle: "https://example.com/some/path?option=very_yes", inputMultiple: "https: expected: new Uri("https://example.com/some/path?option=very_yes"), expectedCollection: new[] { new Uri("https://example.com/some/path?option=very_yes"), new Uri("http: } ) { } } }
<include target="_header.html" /> <form ruleset="insertConfig" action="./" method="post" class="x_form-horizontal" id="fo_ncenterlite"> <input type="hidden" name="module" value="schedule" /> <input type="hidden" name="act" value="<API key>" /> <section class="section"> <h1></h1> <div class="x_control-group"> <label class="x_control-label"></label> <div class="x_controls"> <select name="viewconfig"> <option value="Y" selected="selected"|cond="$config->viewconfig=='Y'"></option> <option value="N" selected="selected"|cond="$config->viewconfig=='N'"></option> </select> <p> .</p> </div> </div> </section> <div class="x_clearfix btnArea"> <div class="x_pull-right"> <button class="x_btn x_btn-primary" type="submit">{$lang->cmd_registration}</button> </div> </div> </form>
#pragma once #ifdef HAVE_CONFIG_H #include "config.h" #endif #include <stdint.h> #include <stdbool.h> #include "buxtondata.h" /** * A dynamic array * Represents daemon's reply to client */ typedef struct BuxtonArray { void **data; /**<Dynamic array contents */ uint len; /**<Length of the array */ } BuxtonArray; /** * Valid function prototype for 'free' method * @param p Pointer to free */ typedef void (*buxton_free_func) (void* p); /** * Create a new BuxtonArray * @returns BuxtonArray a newly allocated BuxtonArray */ BuxtonArray *buxton_array_new(void) __attribute__((warn_unused_result)); /** * Append data to BuxtonArray * @param array Valid BuxtonArray * @param data Pointer to add to this array * @returns bool true if the data was added to the array */ bool buxton_array_add(BuxtonArray *array, void *data) __attribute__((warn_unused_result)); /** * Free an array, and optionally its members * @param array valid BuxtonArray reference * @param free_func Function to call to free all members, or NULL to leave allocated */ void buxton_array_free(BuxtonArray **array, buxton_free_func free_method); /** * Retrieve a BuxtonData from the array by index * @param array valid BuxtonArray reference * @param index index of the element in the array * @return a data pointer refered to by index, or NULL */ void *buxton_array_get(BuxtonArray *array, uint16_t index) __attribute__((warn_unused_result));
using System; using System.Collections.Generic; namespace AppveyorClient.POCOs { public class Build { public string AuthorName; public string AuthorUsername; public string Branch; public int BuildId; public int BuildNumber; public DateTime? Created; public DateTime? Started; public DateTime? Updated; public DateTime? Finished; public List<Job> Jobs; public string Message; public string <API key>; public string <API key>; public string <API key>; public int PullRequestId; public string PullRequestName; public string Status; public string Version; } }
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ #ifndef __SPRUCE_SASL_H__ #define __SPRUCE_SASL_H__ #include <glib.h> #include <spruce/spruce-service.h> G_BEGIN_DECLS #define SPRUCE_TYPE_SASL (<API key> ()) #define SPRUCE_SASL(obj) (<API key> ((obj), SPRUCE_TYPE_SASL, SpruceSASL)) #define SPRUCE_SASL_CLASS(klass) (<API key> ((klass), SPRUCE_TYPE_SASL, SpruceSASLClass)) #define SPRUCE_IS_SASL(obj) (<API key> ((obj), SPRUCE_TYPE_SASL)) #define <API key>(klass) (<API key> ((klass), SPRUCE_TYPE_SASL)) #define <API key>(obj) (<API key> ((obj), SPRUCE_TYPE_SASL, SpruceSASLClass)) typedef struct _SpruceSASL SpruceSASL; typedef struct _SpruceSASLClass SpruceSASLClass; struct _SpruceSASL { GObject parent_object; char *service_name; char *mech; /* mechanism */ SpruceService *service; gboolean authenticated; }; struct _SpruceSASLClass { GObjectClass parent_class; GByteArray * (* challenge) (SpruceSASL *sasl, GByteArray *token, GError **err); }; GType <API key> (void); GByteArray *<API key> (SpruceSASL *sasl, GByteArray *token, GError **err); char *<API key> (SpruceSASL *sasl, const char *token, GError **err); gboolean <API key> (SpruceSASL *sasl); /* utility functions */ SpruceSASL *spruce_sasl_new (const char *service_name, const char *mechanism, SpruceService *service); GList *<API key> (void); <API key> *<API key> (const char *mechanism); G_END_DECLS #endif /* __SPRUCE_SASL_H__ */
// <API key>.cs // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // all copies or substantial portions of the Software. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // 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. using System; using Microsoft.CodeAnalysis; using System.Linq; using System.IO; using MonoDevelop.Core; using System.Collections.Generic; using System.Threading; using Microsoft.CodeAnalysis.Text; using System.Threading.Tasks; using MonoDevelop.Ide.Editor; using Microsoft.CodeAnalysis.Host; using MonoDevelop.Core.Text; using System.Collections.Concurrent; using MonoDevelop.Ide.CodeFormatting; using Gtk; using MonoDevelop.Ide.Editor.Projection; using System.Reflection; using Microsoft.CodeAnalysis.Host.Mef; using System.Text; using System.Collections.Immutable; using System.ComponentModel; using Mono.Addins; using MonoDevelop.Core.AddIns; using Microsoft.CodeAnalysis.Extensions; using Microsoft.CodeAnalysis.Internal.Log; using Microsoft.CodeAnalysis.Shared.Options; using Microsoft.CodeAnalysis.Shared.Utilities; using Microsoft.CodeAnalysis.SolutionCrawler; using MonoDevelop.Ide.Composition; using MonoDevelop.Ide.RoslynServices; using MonoDevelop.Core.Assemblies; namespace MonoDevelop.Ide.TypeSystem { public partial class <API key> : Workspace { public const string ServiceLayer = nameof(<API key>); // Background compiler is used to trigger compilations in the background for the solution and hold onto them // so in case nothing references the solution in current stacks, they're not collected. // We previously used to experience pathological GC times on large solutions, and this was caused // by the compilations being freed out of memory due to only being weakly referenced, and recomputing them on // a case by case basis. BackgroundCompiler backgroundCompiler; internal readonly WorkspaceId Id; <API key> src = new <API key> (); bool disposed; internal readonly SemaphoreSlim LoadLock = new SemaphoreSlim (1, 1); Lazy<<API key>> manager; Lazy<<API key>> metadataHandler; ProjectionData Projections { get; } OpenDocumentsData OpenDocuments { get; } ProjectDataMap ProjectMap { get; } <API key> ProjectHandler { get; } public MonoDevelop.Projects.Solution MonoDevelopSolution { get; } internal <API key> <API key> => manager.Value; internal static HostServices HostServices => CompositionManager.Instance.HostServices; static <API key> () { Tasks.<API key>.Initialize (); } <summary> This bypasses the type system service. Use with care. </summary> [EditorBrowsable(<API key>.Never)] internal void OpenSolutionInfo (SolutionInfo sInfo) { OnSolutionAdded (sInfo); } internal <API key> (MonoDevelop.Projects.Solution solution) : base (HostServices, WorkspaceKind.Host) { this.MonoDevelopSolution = solution; this.Id = WorkspaceId.Next (); Projections = new ProjectionData (); OpenDocuments = new OpenDocumentsData (); ProjectMap = new ProjectDataMap (this); ProjectHandler = new <API key> (this, ProjectMap, Projections); manager = new Lazy<<API key>> (() => Services.GetService<<API key>> ()); metadataHandler = new Lazy<<API key>> (() => new <API key> (<API key>, ProjectMap)); if (IdeApp.Workspace != null && solution != null) { IdeApp.Workspace.<API key> += <API key>; } backgroundCompiler = new BackgroundCompiler (this); var cacheService = Services.GetService<<API key>> (); if (cacheService != null) cacheService.CacheFlushRequested += <API key>; // Trigger running compiler syntax and semantic errors via the diagnostic analyzer engine IdeApp.Preferences.Roslyn.<API key> = true; Options = Options.WithChangedOption (Microsoft.CodeAnalysis.Diagnostics.<API key>.Syntax, true) .WithChangedOption (Microsoft.CodeAnalysis.Diagnostics.<API key>.Semantic, true) // Turn on FSA on a new workspace addition .WithChangedOption (RuntimeOptions.<API key>, true) .WithChangedOption (RuntimeOptions.<API key>, false) // Always use persistent storage regardless of solution size, at least until a consensus is reached .WithChangedOption (Microsoft.CodeAnalysis.Storage.StorageOptions.<API key>, MonoDevelop.Core.Platform.IsLinux ? int.MaxValue : 0); if (IdeApp.Preferences.<API key>) { var solutionCrawler = Services.GetService<<API key>> (); solutionCrawler.Register (this); } IdeApp.Preferences.<API key>.Changed += <API key>; // TODO: Unhack C# here when monodevelop workspace supports more than C# IdeApp.Preferences.Roslyn.<API key> += <API key>; foreach (var factory in AddinManager.GetExtensionObjects<Microsoft.CodeAnalysis.Options.<API key>>("/MonoDevelop/Ide/TypeService/OptionProviders")) Services.GetRequiredService<Microsoft.CodeAnalysis.Options.IOptionService> ().<API key> (factory.Create (this)); if (solution != null) DesktopService.MemoryMonitor.StatusChanged += <API key>; } bool lowMemoryLogged; void <API key> (object sender, <API key> args) { // Disable full solution analysis when the OS triggers a warning about memory pressure. if (args.MemoryStatus == <API key>.Normal) return; // record that we had hit critical memory barrier if (!lowMemoryLogged) { lowMemoryLogged = true; Logger.Log (FunctionId.<API key>, KeyValueLogMessage.Create (m => { // which message we are logging and memory left in bytes when this is called. m ["MSG"] = args.MemoryStatus; //m ["MemoryLeft"] = (long)wParam; })); } var cacheService = Services.GetService<<API key>> () as <API key>; cacheService?.FlushCaches (); if (!<API key> ()) return; Options = Options.WithChangedOption (RuntimeOptions.<API key>, false); IdeApp.Preferences.Roslyn.<API key> = false; if (IsUserOptionOn ()) { // let user know full analysis is turned off due to memory concern. // make sure we show info bar only once for the same solution. Options = Options.WithChangedOption (RuntimeOptions.<API key>, true); const string LowVMMoreInfoLink = "https://go.microsoft.com/fwlink/?linkid=2003417&clcid=0x409"; Services.GetService<<API key>> ().ShowGlobalErrorInfo ( GettextCatalog.GetString ("{0} has suspended some advanced features to improve performance", BrandingService.ApplicationName), new InfoBarUI ("Learn more", InfoBarUI.UIKind.HyperLink, () => DesktopService.ShowUrl (LowVMMoreInfoLink), closeAfterAction: false), new InfoBarUI ("Restore", InfoBarUI.UIKind.Button, () => Options = Options.WithChangedOption (RuntimeOptions.<API key>, true)) ); } } void <API key> (object sender, EventArgs args) { if (backgroundCompiler != null) { backgroundCompiler.Dispose (); backgroundCompiler = null; // <API key> will now return false } // No longer need cache notifications var cacheService = Services.GetService<<API key>> (); if (cacheService != null) cacheService.CacheFlushRequested -= <API key>; } bool <API key> () { // conditions // 1. if our full solution analysis option is on (not user full solution analysis option, but our internal one) and // 2. if infobar is never shown to users for this solution return Options.GetOption (RuntimeOptions.<API key>) && !Options.GetOption (RuntimeOptions.<API key>); } bool IsUserOptionOn () { // check languages currently on solution. since we only show info bar once, we don't need to track solution changes. var languages = CurrentSolution.Projects.Select (p => p.Language).Distinct (); foreach (var language in languages) { if (IdeApp.Preferences.Roslyn.For (language).<API key>) { return true; } } return false; } void <API key>(object sender, EventArgs args) { var solutionCrawler = Services.GetService<<API key>> (); if (IdeApp.Preferences.<API key>) solutionCrawler.Register (this); else solutionCrawler.Unregister (this); var diagnosticAnalyzer = CompositionManager.GetExportedValue<Microsoft.CodeAnalysis.Diagnostics.<API key>> (); diagnosticAnalyzer.Reanalyze (this); } void <API key> (object sender, EventArgs args) { // we only want to turn on FSA if the option is explicitly enabled, // we don't want to turn it off here. if (IdeApp.Preferences.Roslyn.<API key>) { Options = Options.WithChangedOption (RuntimeOptions.<API key>, true); } } protected internal override bool <API key> => backgroundCompiler != null; protected override void Dispose (bool finalize) { base.Dispose (finalize); if (disposed) return; disposed = true; <API key>.ClearCache (); IdeApp.Preferences.<API key>.Changed -= <API key>; IdeApp.Preferences.Roslyn.<API key> -= <API key>; DesktopService.MemoryMonitor.StatusChanged -= <API key>; CancelLoad (); if (IdeApp.Workspace != null) { IdeApp.Workspace.<API key> -= <API key>; } if (MonoDevelopSolution != null) { foreach (var prj in MonoDevelopSolution.GetAllProjects ()) { UnloadMonoProject (prj); } } var solutionCrawler = Services.GetService<<API key>> (); solutionCrawler.Unregister (this); if (backgroundCompiler != null) { backgroundCompiler.Dispose (); backgroundCompiler = null; // <API key> will now return false } } internal void <API key> (DocumentId id, SourceText text) { base.<API key> (id, text); } void CancelLoad () { src.Cancel (); src = new <API key> (); } internal static event EventHandler LoadingFinished; internal void HideStatusIcon () { TypeSystemService.<API key> (() => { LoadingFinished?.Invoke (this, EventArgs.Empty); WorkspaceLoaded?.Invoke (this, EventArgs.Empty); }); } public event EventHandler WorkspaceLoaded; internal void ShowStatusIcon () { TypeSystemService.<API key> (); } async void <API key> (object sender, EventArgs e) { ShowStatusIcon (); CancelLoad (); var token = src.Token; try { var si = await ProjectHandler.CreateSolutionInfo (MonoDevelopSolution, token).ConfigureAwait (false); if (si != null) OnSolutionReloaded (si); } catch (<API key>) { } catch (AggregateException ae) { ae.Flatten ().Handle (x => x is <API key>); } catch (Exception ex) { LoggingService.LogError ("Error while reloading solution.", ex); } finally { HideStatusIcon (); } } internal void <API key> (MonoDevelop.Projects.Project project) { ProjectHandler.<API key> (project); } internal Task<SolutionInfo> TryLoadSolution (Cancellation<API key> = default(CancellationToken)) { return ProjectHandler.CreateSolutionInfo (MonoDevelopSolution, <API key>.<API key> (cancellationToken, src.Token).Token); } internal void UnloadSolution () { OnSolutionRemoved (); } void UnloadMonoProject (MonoDevelop.Projects.Project project) { if (project == null) throw new <API key> (nameof (project)); project.Modified -= OnProjectModified; } #region Open documents public override bool CanOpenDocuments => true; public override void OpenDocument (DocumentId documentId, bool activate = true) { var doc = GetDocument (documentId); if (doc != null) { var mdProject = GetMonoProject (doc.Project); if (doc != null) { IdeApp.Workbench.OpenDocument (doc.FilePath, mdProject, activate); } } } readonly Dictionary<DocumentInfo, SourceTextContainer> generatedFiles = new Dictionary<DocumentInfo, SourceTextContainer> (); internal void <API key> (DocumentInfo documentInfo, SourceTextContainer textContainer) { lock (generatedFiles) { generatedFiles[documentInfo] = textContainer; OnDocumentAdded (documentInfo); OnDocumentOpened (documentInfo.Id, textContainer); } } internal void <API key> (DocumentId documentId, TextLoader reloader) { lock (generatedFiles) { var documentInfo = generatedFiles.FirstOrDefault (kvp => kvp.Key.Id == documentId).Key; if (documentInfo != null && generatedFiles.Remove(documentInfo) && CurrentSolution.ContainsDocument(documentId)) { OnDocumentClosed (documentId, reloader); OnDocumentRemoved (documentId); } } } internal void InformDocumentOpen (DocumentId documentId, TextEditor editor, DocumentContext context) { var document = <API key> (documentId, editor, context); if (document as Document != null) { foreach (var linkedDoc in ((Document)document).<API key> ()) { <API key> (linkedDoc, editor, context); } } <API key> (documentId); } TextDocument <API key> (DocumentId documentId, TextEditor editor, DocumentContext context) { var project = this.CurrentSolution.GetProject (documentId.ProjectId); if (project == null) return null; TextDocument document = project.GetDocument (documentId) ?? project.<API key> (documentId); if (document == null || OpenDocuments.Contains (documentId)) { return document; } var textContainer = editor.TextView.TextBuffer.AsTextContainer (); OpenDocuments.Add (documentId, textContainer, editor, context); if (document is Document) { OnDocumentOpened (documentId, textContainer); } else { <API key> (documentId, textContainer); } return document; } ProjectChanges projectChanges; protected override void OnDocumentClosing (DocumentId documentId) { base.OnDocumentClosing (documentId); OpenDocuments.Remove (documentId); } // internal override bool <API key> { // get { // return true; internal void InformDocumentClose (DocumentId analysisDocument, string filePath) { try { if (!OpenDocuments.Remove (analysisDocument)) { //Apparently something else opened this file via <API key>(e.g. .cshtml) //it's job of whatever opened to also call <API key> return; } if (!CurrentSolution.ContainsDocument (analysisDocument)) return; var loader = new <API key> (filePath); var document = this.GetDocument (analysisDocument); // FIXME: Is this really needed? OpenDocuments.Remove (analysisDocument); if (document == null) { var ad = this.<API key> (analysisDocument); if (ad != null) <API key> (analysisDocument, loader); return; } OnDocumentClosed (analysisDocument, loader); foreach (var linkedDoc in document.<API key> ()) { OnDocumentClosed (linkedDoc, loader); } } catch (Exception e) { LoggingService.LogError ("Exception while closing document.", e); } } public override void CloseDocument (DocumentId documentId) { } //FIXME: this should NOT be async. our implementation is doing some very expensive things like formatting that it shouldn't need to do. protected override void <API key> (DocumentId id, SourceText text) { lock (projectModifyLock) <API key>.Add (<API key> (id, text)); } async Task <API key> (DocumentId id, SourceText text) { var document = GetDocument (id); if (document == null) return; var hostDocument = <API key>.FromDocument (document); if (hostDocument != null) { hostDocument.UpdateText (text); return; } var (projection, filePath) = Projections.Get (document.FilePath); var data = TextFileProvider.Instance.GetTextEditorData (filePath, out bool isOpen); // Guard against already done changes in linked files. // This shouldn't happen but the roslyn merging seems not to be working correctly in all cases :/ if (document.<API key> ().Length > 0 && isOpen && !(text.GetType ().FullName == "Microsoft.CodeAnalysis.Text.ChangedText")) { return; } lock (<API key>) { if (<API key>.TryGetValue (filePath, out SourceText formerText)) { if (formerText.Length == text.Length && formerText.ToString () == text.ToString ()) return; } <API key>[filePath] = text; } if (!isOpen || !document.TryGetText (out SourceText oldFile)) { oldFile = await document.GetTextAsync (); } var changes = text.GetTextChanges (oldFile).OrderByDescending (c => c.Span.Start).ToList (); int delta = 0; if (!isOpen) { delta = ApplyChanges (projection, data, changes); var formatter = <API key>.GetFormatter (data.MimeType); if (formatter != null && formatter.<API key>) { var mp = GetMonoProject (CurrentSolution.GetProject (id.ProjectId)); string currentText = data.Text; foreach (var change in changes) { delta -= change.Span.Length - change.NewText.Length; var startOffset = change.Span.Start - delta; if (projection != null) { if (projection.<API key> (startOffset, out int originalOffset)) startOffset = originalOffset; } string str; if (change.NewText.Length == 0) { str = formatter.FormatText (mp.Policies, currentText, TextSegment.FromBounds (Math.Max (0, startOffset - 1), Math.Min (data.Length, startOffset + 1))); } else { str = formatter.FormatText (mp.Policies, currentText, new TextSegment (startOffset, change.NewText.Length)); } data.ReplaceText (startOffset, change.NewText.Length, str); } } data.Save (); if (projection != null) { await <API key> (document, data); } else { <API key> (id, new <API key> (data), PreservationMode.PreserveValue); } } else { var formatter = <API key>.GetFormatter (data.MimeType); var documentContext = IdeApp.Workbench.Documents.FirstOrDefault (d => FilePath.PathComparer.Compare (d.FileName, filePath) == 0); var root = await projectChanges.NewProject.GetDocument (id).GetSyntaxRootAsync (); var annotatedNode = root.<API key> ().FirstOrDefault (n => n.HasAnnotation (TypeSystemService.<API key>)); SyntaxToken? renameTokenOpt = root.<API key> (Microsoft.CodeAnalysis.CodeActions.RenameAnnotation.Kind) .Where (s => s.IsToken) .Select (s => s.AsToken ()) .Cast<SyntaxToken?> () .FirstOrDefault (); if (documentContext != null) { var editor = (TextEditor)data; await Runtime.RunInMainThread (async () => { using (var undo = editor.OpenUndoGroup ()) { var oldVersion = editor.Version; delta = ApplyChanges (projection, data, changes); var versionBeforeFormat = editor.Version; if (formatter != null && formatter.<API key>) { foreach (var change in changes) { delta -= change.Span.Length - change.NewText.Length; var startOffset = change.Span.Start - delta; if (projection != null) { if (projection.<API key> (startOffset, out int originalOffset)) startOffset = originalOffset; } if (change.NewText.Length == 0) { formatter.OnTheFlyFormat (editor, documentContext, TextSegment.FromBounds (Math.Max (0, startOffset - 1), Math.Min (data.Length, startOffset + 1))); } else { formatter.OnTheFlyFormat (editor, documentContext, new TextSegment (startOffset, change.NewText.Length)); } } } if (annotatedNode != null && GetInsertionPoints != null) { IdeApp.Workbench.Documents.First (d => d.FileName == editor.FileName).Select (); var formattedVersion = editor.Version; int startOffset = versionBeforeFormat.MoveOffsetTo (editor.Version, annotatedNode.Span.Start); int endOffset = versionBeforeFormat.MoveOffsetTo (editor.Version, annotatedNode.Span.End); // alway whole line start & delimiter var startLine = editor.GetLineByOffset (startOffset); startOffset = startLine.Offset; var endLine = editor.GetLineByOffset (endOffset); endOffset = endLine.<API key> + 1; var <API key> = TextSegment.FromBounds (startOffset, endOffset); string textToInsert = editor.GetTextAt (<API key>).TrimEnd (); editor.RemoveText (<API key>); var insertionPoints = await GetInsertionPoints (editor, editor.CaretOffset); if (insertionPoints.Count == 0) { // Just to get sure if no insertion points -> go back to the formatted version. var textChanges = editor.Version.GetChangesTo (formattedVersion).ToList (); using (var undo2 = editor.OpenUndoGroup ()) { foreach (var textChange in textChanges) { foreach (var v in textChange.TextChanges.Reverse ()) { editor.ReplaceText (v.Offset, v.RemovalLength, v.InsertedText); } } } return; } string <API key>; const int CSharpMethodKind = 8875; bool isMethod = annotatedNode.RawKind == CSharpMethodKind; if (!isMethod) { // atm only for generate field/property : remove all new lines generated & just insert the plain node. // for methods it's not so easy because of "extract code" changes. foreach (var textChange in editor.Version.GetChangesTo (oldVersion).ToList ()) { foreach (var v in textChange.TextChanges.Reverse ()) { editor.ReplaceText (v.Offset, v.RemovalLength, v.InsertedText); } } } switch (annotatedNode.RawKind) { case 8873: // C# field <API key> = GettextCatalog.GetString ("Insert Field"); break; case CSharpMethodKind: <API key> = GettextCatalog.GetString ("Insert Method"); break; case 8892: // C# property <API key> = GettextCatalog.GetString ("Insert Property"); break; default: <API key> = GettextCatalog.GetString ("Insert Code"); break; } var options = new <API key> ( <API key>, insertionPoints, point => { if (!point.Success) return; point.InsertionPoint.Insert (editor, textToInsert); } ); options.ModeExitedAction += delegate (<API key> args) { if (!args.Success) { var textChanges = editor.Version.GetChangesTo (oldVersion).ToList (); using (var undo2 = editor.OpenUndoGroup ()) { foreach (var textChange in textChanges) { foreach (var v in textChange.TextChanges.Reverse ()) editor.ReplaceText (v.Offset, v.RemovalLength, v.InsertedText); } } } }; for (int i = 0; i < insertionPoints.Count; i++) { if (insertionPoints [i].Location.Line < editor.CaretLine) { options.<API key> = Math.Min (isMethod ? i + 1 : i, insertionPoints.Count - 1); } else { break; } } options.ModeExitedAction += delegate { if (renameTokenOpt.HasValue) StartRenameSession (editor, documentContext, versionBeforeFormat, renameTokenOpt.Value); }; editor.StartInsertionMode (options); } } }); } if (projection != null) { await <API key> (document, data); } else { <API key> (id, new <API key> (data), PreservationMode.PreserveValue); } } } internal static Func<TextEditor, int, Task<List<InsertionPoint>>> GetInsertionPoints; internal static Action<TextEditor, DocumentContext, ITextSourceVersion, SyntaxToken?> StartRenameSession; async Task <API key> (Document document, ITextDocument data) { var project = TypeSystemService.GetMonoProject (document.Project); var file = project.Files.GetFile (data.FileName); var node = TypeSystemService.<API key> (data.MimeType, file.BuildAction); if (node != null && node.Parser.<API key> (data.MimeType, file.BuildAction, project.SupportedLanguages)) { var options = new ParseOptions { FileName = file.FilePath, Project = project, Content = TextFileProvider.Instance.<API key> (file.FilePath), }; var projections = await node.Parser.GenerateProjections (options); <API key> (file, projections); var projectId = GetProjectId (project); var projectdata = ProjectMap.GetData (projectId); foreach (var projected in projections) { <API key> (projectdata.DocumentData.Get (projected.Document.FileName), new <API key> (projected.Document), PreservationMode.PreserveValue); } } } static int ApplyChanges (Projection projection, ITextDocument data, List<Microsoft.CodeAnalysis.Text.TextChange> changes) { int delta = 0; foreach (var change in changes) { var offset = change.Span.Start; if (projection != null) { //If change is outside projection segments don't apply it... if (projection.<API key> (offset, out int originalOffset)) { offset = originalOffset; data.ReplaceText (offset, change.Span.Length, change.NewText); delta += change.Span.Length - change.NewText.Length; } } else { data.ReplaceText (offset, change.Span.Length, change.NewText); delta += change.Span.Length - change.NewText.Length; } } return delta; } // used to pass additional state from Apply* to TryApplyChanges so it can batch certain operations such as saving projects HashSet<MonoDevelop.Projects.Project> <API key> = new HashSet<MonoDevelop.Projects.Project> (); List<Task> <API key> = new List<Task> (); Dictionary<string, SourceText> <API key> = new Dictionary<string, SourceText> (); <summary> Used by tests to validate that project has been saved. </summary> <value>The task that can be awaited to validate saving has finished.</value> internal Task ProjectSaveTask { get; private set; } = Task.FromResult<object> (null); internal override bool TryApplyChanges (Solution newSolution, IProgressTracker progressTracker) { // this is supported on the main thread only // as a result, we can assume that the things it calls are _also_ main thread only Runtime.CheckMainThread (); lock (projectModifyLock) { freezeProjectModify = true; try { var ret = base.TryApplyChanges (newSolution, progressTracker); if (<API key>.Count > 0) { Task.WhenAll (<API key>).ContinueWith (t => { try { t.Wait (); } catch (Exception ex) { LoggingService.LogError ("Error applying changes to documents", ex); } if (IdeApp.Workbench != null) { var changedFiles = new HashSet<string> (<API key>.Keys, FilePath.PathComparer); foreach (var w in IdeApp.Workbench.Documents) { if (w.IsFile && changedFiles.Contains (w.FileName)) { w.StartReparseThread (); } } } }, CancellationToken.None, <API key>.None, Runtime.MainTaskScheduler); } if (<API key>.Count > 0) { ProjectSaveTask = IdeApp.ProjectOperations.SaveAsync (<API key>); } return ret; } finally { <API key>.Clear (); <API key>.Clear (); <API key>.Clear (); freezeProjectModify = false; } } } public override bool CanApplyChange (ApplyChangesKind feature) { switch (feature) { case ApplyChangesKind.AddDocument: case ApplyChangesKind.RemoveDocument: case ApplyChangesKind.ChangeDocument: //HACK: we don't actually support adding and removing metadata references from project //however, our <API key> currently depends on (incorrectly) using TryApplyChanges case ApplyChangesKind.<API key>: case ApplyChangesKind.<API key>: case ApplyChangesKind.AddProjectReference: case ApplyChangesKind.<API key>: return true; default: return false; } } protected override void ApplyProjectChanges (ProjectChanges projectChanges) { this.projectChanges = projectChanges; base.ApplyProjectChanges (projectChanges); } protected override void ApplyDocumentAdded (DocumentInfo info, SourceText text) { var id = info.Id; MonoDevelop.Projects.Project mdProject = null; if (id.ProjectId != null) { var project = CurrentSolution.GetProject (id.ProjectId); mdProject = GetMonoProject (project); if (mdProject == null) LoggingService.LogWarning ("Couldn't find project for newly generated file {0} (Project {1}).", info.Name, info.Id.ProjectId); } var path = DetermineFilePath (info.Id, info.Name, info.FilePath, info.Folders, mdProject?.FileName.ParentDirectory, true); // If file is already part of project don't re-add it, example of this is .cshtml if (mdProject?.IsFileInProject (path) == true) { this.OnDocumentAdded (info); return; } info = info.WithFilePath (path).WithTextLoader (new <API key> (path)); string formattedText; var formatter = <API key>.GetFormatter (DesktopService.GetMimeTypeForUri (path)); if (formatter != null && mdProject != null) { formattedText = formatter.FormatText (mdProject.Policies, text.ToString ()); } else { formattedText = text.ToString (); } var textSource = new StringTextSource (formattedText, text.Encoding ?? System.Text.Encoding.UTF8); try { textSource.WriteTextTo (path); } catch (Exception e) { LoggingService.LogError ("Exception while saving file to " + path, e); } if (mdProject != null) { var data = ProjectMap.GetData (id.ProjectId); data.DocumentData.Add (info.Id, path); var file = new MonoDevelop.Projects.ProjectFile (path); mdProject.Files.Add (file); <API key>.Add (mdProject); } this.OnDocumentAdded (info); } protected override void <API key> (DocumentId documentId) { var document = GetDocument (documentId); var mdProject = GetMonoProject (documentId.ProjectId); if (document == null || mdProject == null) { return; } FilePath filePath = document.FilePath; var projectFile = mdProject.Files.GetFile (filePath); if (projectFile == null) { return; } //force-close the old doc even if it's dirty var openDoc = IdeApp.Workbench.Documents.FirstOrDefault (d => d.IsFile && filePath.Equals (d.FileName)); if (openDoc != null && openDoc.IsDirty) { openDoc.Save (); ((Gui.SdiWorkspaceWindow)openDoc.Window).CloseWindow (true, true).Wait (); } //this will fire a OnDocumentRemoved event via OnFileRemoved mdProject.Files.Remove (projectFile); FileService.DeleteFile (filePath); <API key>.Add (mdProject); } string DetermineFilePath (DocumentId id, string name, string filePath, IReadOnlyList<string> docFolders, string defaultFolder, bool createDirectory = false) { var path = filePath; if (string.IsNullOrEmpty (path)) { var monoProject = GetMonoProject (id.ProjectId); // If the first namespace name matches the name of the project, then we don't want to // generate a folder for that. The project is implicitly a folder with that name. IEnumerable<string> folders; if (docFolders != null && monoProject != null && docFolders.FirstOrDefault () == monoProject.Name) { folders = docFolders.Skip (1); } else { folders = docFolders; } if (folders.Any ()) { string baseDirectory = Path.Combine (monoProject?.BaseDirectory ?? MonoDevelopSolution.BaseDirectory, Path.Combine (folders.ToArray ())); try { if (createDirectory && !Directory.Exists (baseDirectory)) Directory.CreateDirectory (baseDirectory); } catch (Exception e) { LoggingService.LogError ("Error while creating directory for a new file : " + baseDirectory, e); } path = Path.Combine (baseDirectory, name); } else { path = Path.Combine (defaultFolder, name); } } return path; } bool <API key> (ProjectId projectId, MetadataReference metadataReference, out MonoDevelop.Projects.DotNetProject mdProject, out string path, out SystemAssembly systemAssemblyOpt) { mdProject = GetMonoProject (projectId) as MonoDevelop.Projects.DotNetProject; path = GetMetadataPath (metadataReference); systemAssemblyOpt = null; if (mdProject == null || path == null) return false; // PERF: Maybe break IAssemblyContext API and add GetAssemblyFromPath. // GetPackageFromPath could be implemented by querying the SystemAssembly's package. var package = mdProject.AssemblyContext.GetPackageFromPath (path); if (package != null) { foreach (var asm in package.Assemblies) { if (asm.Location == path) systemAssemblyOpt = asm; } } // This code would handle assemblies like glib-sharp. // Enabling this causes a NRE, as there's no package associated with the SystemAssembly. //if (systemAssemblyOpt == null) { // try { // var aName = AssemblyName.GetAssemblyName (path).FullName; // var isGac = mdProject.AssemblyContext.AssemblyIsInGac (aName); // if (isGac) { // systemAssemblyOpt = new SystemAssembly (path, aName); // } catch { return true; } protected override void <API key> (ProjectId projectId, MetadataReference metadataReference) { if (!<API key> (projectId, metadataReference, out var mdProject, out string path, out var systemAssemblyOpt)) return; foreach (var r in mdProject.References) { if (systemAssemblyOpt != null) { if (r.ReferenceType == MonoDevelop.Projects.ReferenceType.Package) { var nameToCheck = r.SpecificVersion ? systemAssemblyOpt.FullName : systemAssemblyOpt.Name; if (r.Reference == nameToCheck) { LoggingService.LogWarning ("Warning duplicate reference is added " + path); return; } } } if (r.ReferenceType == MonoDevelop.Projects.ReferenceType.Assembly && r.Reference == path) { LoggingService.LogWarning ("Warning duplicate reference is added " + path); return; } if (r.ReferenceType == MonoDevelop.Projects.ReferenceType.Project) { foreach (var fn in r.<API key> (MonoDevelop.Projects.<API key>.Default)) { if (fn == path) { LoggingService.LogWarning ("Warning duplicate reference is added " + path + " for project " + r.Reference); return; } } } } if (systemAssemblyOpt != null) { mdProject.References.Add (MonoDevelop.Projects.ProjectReference.<API key> (systemAssemblyOpt)); } else { mdProject.AddReference (path); } <API key>.Add (mdProject); this.<API key> (projectId, metadataReference); } protected override void <API key> (ProjectId projectId, MetadataReference metadataReference) { if (!<API key> (projectId, metadataReference, out var mdProject, out string path, out var systemAssemblyOpt)) return; MonoDevelop.Projects.ProjectReference item; // if we're trying to remove a system package, try removing a system package first if (systemAssemblyOpt != null) { item = mdProject.References.FirstOrDefault (r => { if (r.ReferenceType != MonoDevelop.Projects.ReferenceType.Package) return false; var nameToCheck = r.SpecificVersion ? systemAssemblyOpt.FullName : systemAssemblyOpt.Name; return r.ReferenceType == MonoDevelop.Projects.ReferenceType.Package && r.Reference == nameToCheck; }); } else { // Remove a normal assembly reference. item = mdProject.References.FirstOrDefault (r => r.ReferenceType == MonoDevelop.Projects.ReferenceType.Assembly && r.Reference == path); } if (item == null) return; mdProject.References.Remove (item); <API key>.Add (mdProject); this.<API key> (projectId, metadataReference); } string GetMetadataPath (MetadataReference metadataReference) { if (metadataReference is <API key> fileMetadata) { return fileMetadata.FilePath; } return null; } protected override void <API key> (ProjectId projectId, ProjectReference projectReference) { var mdProject = GetMonoProject (projectId) as MonoDevelop.Projects.DotNetProject; var projectToReference = GetMonoProject (projectReference.ProjectId); if (mdProject == null || projectToReference == null) return; var mdRef = MonoDevelop.Projects.ProjectReference.<API key> (projectToReference); mdProject.References.Add (mdRef); <API key>.Add (mdProject); this.<API key> (projectId, projectReference); } protected override void <API key> (ProjectId projectId, ProjectReference projectReference) { var mdProject = GetMonoProject (projectId) as MonoDevelop.Projects.DotNetProject; var projectToReference = GetMonoProject (projectReference.ProjectId); if (mdProject == null || projectToReference == null) return; foreach (var pr in mdProject.References.OfType<MonoDevelop.Projects.ProjectReference>()) { if (pr.ProjectGuid == projectToReference.ItemId) { mdProject.References.Remove (pr); <API key>.Add (mdProject); this.<API key> (projectId, projectReference); break; } } } #endregion internal Document GetDocument (DocumentId documentId, Cancellation<API key> = default (CancellationToken)) { var project = CurrentSolution.GetProject (documentId.ProjectId); if (project == null) return null; return project.GetDocument (documentId); } internal TextDocument <API key> (DocumentId documentId, Cancellation<API key> = default(CancellationToken)) { var project = CurrentSolution.GetProject (documentId.ProjectId); if (project == null) return null; return project.<API key> (documentId); } internal async Task UpdateFileContent (string fileName, string text) { SourceText newText = SourceText.From (text); var tasks = new List<Task> (); try { await LoadLock.WaitAsync (); foreach (var projectId in ProjectMap.GetProjectIds ()) { var docId = this.GetDocumentId (projectId, fileName); if (docId != null) { try { if (this.GetDocument (docId) != null) { base.<API key> (docId, newText, PreservationMode.PreserveIdentity); } else if (this.<API key> (docId) != null) { base.<API key> (docId, newText, PreservationMode.PreserveIdentity); } } catch (Exception e) { LoggingService.LogWarning ("Roslyn error on text change", e); } } var monoProject = GetMonoProject (projectId); if (monoProject != null) { var pf = monoProject.GetProjectFile (fileName); if (pf != null) { var mimeType = DesktopService.GetMimeTypeForUri (fileName); if (TypeSystemService.CanParseProjections (monoProject, mimeType, fileName)) { var parseOptions = new ParseOptions { Project = monoProject, FileName = fileName, Content = new StringTextSource (text), BuildAction = pf.BuildAction }; var task = TypeSystemService.ParseProjection (parseOptions, mimeType); tasks.Add (task); } } } } } finally { LoadLock.Release (); } await Task.WhenAll (tasks); } internal void RemoveProject (MonoDevelop.Projects.Project project) { var id = GetProjectId (project); if (id != null) { foreach (var docId in GetOpenDocumentIds (id).ToList ()) { ClearOpenDocument (docId); } ProjectMap.RemoveProject (project, id); UnloadMonoProject (project); OnProjectRemoved (id); } } #region Project modification handlers List<MonoDevelop.Projects.DotNetProject> modifiedProjects = new List<MonoDevelop.Projects.DotNetProject> (); readonly object projectModifyLock = new object (); bool freezeProjectModify; Dictionary<MonoDevelop.Projects.DotNetProject, <API key>> projectModifiedCts = new Dictionary<MonoDevelop.Projects.DotNetProject, <API key>> (); void OnProjectModified (object sender, MonoDevelop.Projects.<API key> args) { lock (projectModifyLock) { if (freezeProjectModify) return; try { if (!args.Any (x => x.Hint == "TargetFramework" || x.Hint == "References" || x.Hint == "CompilerParameters" || x.Hint == "Files")) return; var project = sender as MonoDevelop.Projects.DotNetProject; if (project == null) return; var projectId = GetProjectId (project); if (projectModifiedCts.TryGetValue (project, out var cts)) cts.Cancel (); cts = new <API key> (); projectModifiedCts [project] = cts; if (CurrentSolution.ContainsProject (projectId)) { var projectInfo = ProjectHandler.LoadProject (project, cts.Token, null).ContinueWith (t => { if (t.IsCanceled) return; if (t.IsFaulted) { LoggingService.LogError ("Failed to reload project", t.Exception); return; } try { lock (projectModifyLock) { // correct openDocument ids - they may change due to project reload. OpenDocuments.CorrectDocumentIds (project, t.Result); OnProjectReloaded (t.Result); } } catch (Exception e) { LoggingService.LogError ("Error while reloading project " + project.Name, e); } }, cts.Token); } else { modifiedProjects.Add (project); } } catch (Exception ex) { LoggingService.LogInternalError (ex); } } } #endregion } // static class <API key> // static FeaturePack pack; // public static FeaturePack Features { // get { // if (pack == null) // Interlocked.CompareExchange (ref pack, ComputePack (), null); // return pack; // static FeaturePack ComputePack () // var assemblies = new List<Assembly> (); // var <API key> = typeof(Workspace).Assembly; // assemblies.Add (<API key>); // LoadAssembly (assemblies, "Microsoft.CodeAnalysis.CSharp.Workspaces"); // //LoadAssembly (assemblies, "Microsoft.CodeAnalysis.VisualBasic.Workspaces"); // var catalogs = assemblies.Select (a => new System.ComponentModel.Composition.Hosting.AssemblyCatalog (a)); // return new MefExportPack (catalogs); // static void LoadAssembly (List<Assembly> assemblies, string assemblyName) // try { // var loadedAssembly = Assembly.Load (assemblyName); // assemblies.Add (loadedAssembly); // } catch (Exception e) { // LoggingService.LogWarning ("Couldn't load assembly:" + assemblyName, e); public class <API key> : EventArgs { public ProjectId ProjectId { get; private set; } public <API key> (ProjectId projectId) { ProjectId = projectId; } } }
using System; using JSCompiler.CompileChars; namespace JSCompiler.Script.Compile { <summary> <API key> für <API key>. </summary> public class <API key> : CommentCodeItem { protected override string EndString { get { return CompileChar.<API key>; } } public <API key>() { } public override bool IsBegin(int position, string toCheck) { return (CodeItemContainer.Instance.GetFigureFromString(position, toCheck) + CodeItemContainer.Instance.GetFigureFromString(position + 1, toCheck) == CompileChar.<API key>); } } }
// This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // This library is distributed in the hope that it will be useful, // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // You should have received a copy of the GNU Lesser General Public // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA B 02110-1301 USA #define <API key> 1 #include "bochs.h" #include "cpu.h" #define LOG_THIS BX_CPU_THIS_PTR #if BX_CPU_LEVEL >= 3 void BX_CPP_AttrRegparmN(1) BX_CPU_C::SETO_EbM(bxInstruction_c *i) { bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i)); Bit8u result_8 = getB_OF(); write_virtual_byte(i->seg(), eaddr, result_8); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::SETO_EbR(bxInstruction_c *i) { BX_WRITE_8BIT_REGx(i->rm(), i->extend8bitL(), getB_OF()); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::SETNO_EbM(bxInstruction_c *i) { bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i)); Bit8u result_8 = !getB_OF(); write_virtual_byte(i->seg(), eaddr, result_8); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::SETNO_EbR(bxInstruction_c *i) { BX_WRITE_8BIT_REGx(i->rm(), i->extend8bitL(), !getB_OF()); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::SETB_EbM(bxInstruction_c *i) { bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i)); Bit8u result_8 = getB_CF(); write_virtual_byte(i->seg(), eaddr, result_8); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::SETB_EbR(bxInstruction_c *i) { BX_WRITE_8BIT_REGx(i->rm(), i->extend8bitL(), getB_CF()); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::SETNB_EbM(bxInstruction_c *i) { bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i)); Bit8u result_8 = !getB_CF(); write_virtual_byte(i->seg(), eaddr, result_8); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::SETNB_EbR(bxInstruction_c *i) { BX_WRITE_8BIT_REGx(i->rm(), i->extend8bitL(), !getB_CF()); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::SETZ_EbM(bxInstruction_c *i) { bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i)); Bit8u result_8 = getB_ZF(); write_virtual_byte(i->seg(), eaddr, result_8); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::SETZ_EbR(bxInstruction_c *i) { BX_WRITE_8BIT_REGx(i->rm(), i->extend8bitL(), getB_ZF()); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::SETNZ_EbM(bxInstruction_c *i) { bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i)); Bit8u result_8 = !getB_ZF(); write_virtual_byte(i->seg(), eaddr, result_8); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::SETNZ_EbR(bxInstruction_c *i) { BX_WRITE_8BIT_REGx(i->rm(), i->extend8bitL(), !getB_ZF()); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::SETBE_EbM(bxInstruction_c *i) { bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i)); Bit8u result_8 = (getB_CF() | getB_ZF()); write_virtual_byte(i->seg(), eaddr, result_8); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::SETBE_EbR(bxInstruction_c *i) { BX_WRITE_8BIT_REGx(i->rm(), i->extend8bitL(), (getB_CF() | getB_ZF())); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::SETNBE_EbM(bxInstruction_c *i) { bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i)); Bit8u result_8 = !(getB_CF() | getB_ZF()); write_virtual_byte(i->seg(), eaddr, result_8); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::SETNBE_EbR(bxInstruction_c *i) { BX_WRITE_8BIT_REGx(i->rm(), i->extend8bitL(), !(getB_CF() | getB_ZF())); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::SETS_EbM(bxInstruction_c *i) { bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i)); Bit8u result_8 = getB_SF(); write_virtual_byte(i->seg(), eaddr, result_8); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::SETS_EbR(bxInstruction_c *i) { BX_WRITE_8BIT_REGx(i->rm(), i->extend8bitL(), getB_SF()); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::SETNS_EbM(bxInstruction_c *i) { bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i)); Bit8u result_8 = !getB_SF(); write_virtual_byte(i->seg(), eaddr, result_8); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::SETNS_EbR(bxInstruction_c *i) { BX_WRITE_8BIT_REGx(i->rm(), i->extend8bitL(), !getB_SF()); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::SETP_EbM(bxInstruction_c *i) { bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i)); Bit8u result_8 = getB_PF(); write_virtual_byte(i->seg(), eaddr, result_8); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::SETP_EbR(bxInstruction_c *i) { BX_WRITE_8BIT_REGx(i->rm(), i->extend8bitL(), getB_PF()); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::SETNP_EbM(bxInstruction_c *i) { bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i)); Bit8u result_8 = !getB_PF(); write_virtual_byte(i->seg(), eaddr, result_8); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::SETNP_EbR(bxInstruction_c *i) { BX_WRITE_8BIT_REGx(i->rm(), i->extend8bitL(), !getB_PF()); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::SETL_EbM(bxInstruction_c *i) { bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i)); Bit8u result_8 = (getB_SF() ^ getB_OF()); write_virtual_byte(i->seg(), eaddr, result_8); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::SETL_EbR(bxInstruction_c *i) { BX_WRITE_8BIT_REGx(i->rm(), i->extend8bitL(), (getB_SF() ^ getB_OF())); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::SETNL_EbM(bxInstruction_c *i) { bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i)); Bit8u result_8 = !(getB_SF() ^ getB_OF()); write_virtual_byte(i->seg(), eaddr, result_8); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::SETNL_EbR(bxInstruction_c *i) { BX_WRITE_8BIT_REGx(i->rm(), i->extend8bitL(), !(getB_SF() ^ getB_OF())); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::SETLE_EbM(bxInstruction_c *i) { bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i)); Bit8u result_8 = getB_ZF() | (getB_SF() ^ getB_OF()); write_virtual_byte(i->seg(), eaddr, result_8); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::SETLE_EbR(bxInstruction_c *i) { Bit8u result_8 = getB_ZF() | (getB_SF() ^ getB_OF()); BX_WRITE_8BIT_REGx(i->rm(), i->extend8bitL(), result_8); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::SETNLE_EbM(bxInstruction_c *i) { bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i)); Bit8u result_8 = !(getB_ZF() | (getB_SF() ^ getB_OF())); write_virtual_byte(i->seg(), eaddr, result_8); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::SETNLE_EbR(bxInstruction_c *i) { Bit8u result_8 = !(getB_ZF() | (getB_SF() ^ getB_OF())); BX_WRITE_8BIT_REGx(i->rm(), i->extend8bitL(), result_8); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::BSWAP_RX(bxInstruction_c *i) { BX_ERROR(("BSWAP with 16-bit opsize: undefined behavior !")); BX_WRITE_16BIT_REG(i->opcodeReg(), 0); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::BSWAP_ERX(bxInstruction_c *i) { Bit32u val32 = BX_READ_32BIT_REG(i->opcodeReg()); BX_WRITE_32BIT_REGZ(i->opcodeReg(), bx_bswap32(val32)); } #if BX_SUPPORT_X86_64 void BX_CPP_AttrRegparmN(1) BX_CPU_C::BSWAP_RRX(bxInstruction_c *i) { Bit64u val64 = BX_READ_64BIT_REG(i->opcodeReg()); BX_WRITE_64BIT_REG(i->opcodeReg(), bx_bswap64(val64)); } #endif void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOVBE_GwEw(bxInstruction_c *i) { Bit16u val16, b0, b1; if (i->modC0()) { val16 = BX_READ_16BIT_REG(i->rm()); } else { bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i)); val16 = read_virtual_word(i->seg(), eaddr); } b0 = val16 & 0xff; val16 >>= 8; b1 = val16; val16 = (b0<<8) | b1; BX_WRITE_16BIT_REG(i->nnn(), val16); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOVBE_EwGw(bxInstruction_c *i) { Bit16u val16 = BX_READ_16BIT_REG(i->nnn()), b0, b1; b0 = val16 & 0xff; val16 >>= 8; b1 = val16; val16 = (b0<<8) | b1; if (i->modC0()) { BX_WRITE_16BIT_REG(i->rm(), val16); } else { bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i)); write_virtual_word(i->seg(), eaddr, val16); } } void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOVBE_GdEd(bxInstruction_c *i) { Bit32u val32; if (i->modC0()) { val32 = BX_READ_32BIT_REG(i->rm()); } else { bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i)); val32 = read_virtual_dword(i->seg(), eaddr); } BX_WRITE_32BIT_REGZ(i->nnn(), bx_bswap32(val32)); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOVBE_EdGd(bxInstruction_c *i) { Bit32u val32 = BX_READ_32BIT_REG(i->nnn()); val32 = bx_bswap32(val32); if (i->modC0()) { BX_WRITE_32BIT_REGZ(i->rm(), val32); } else { bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i)); write_virtual_dword(i->seg(), eaddr, val32); } } #if BX_SUPPORT_X86_64 void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOVBE_GqEq(bxInstruction_c *i) { Bit64u val64; if (i->modC0()) { val64 = BX_READ_64BIT_REG(i->rm()); } else { bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i)); val64 = read_virtual_qword(i->seg(), eaddr); } BX_WRITE_64BIT_REG(i->nnn(), bx_bswap64(val64)); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOVBE_EqGq(bxInstruction_c *i) { Bit64u val64 = BX_READ_64BIT_REG(i->nnn()); val64 = bx_bswap64(val64); if (i->modC0()) { BX_WRITE_64BIT_REG(i->rm(), val64); } else { bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i)); <API key>(i->seg(), eaddr, val64); } } #endif // BX_SUPPORT_X86_64 #endif // BX_CPU_LEVEL >= 3
package org.gljava.opengl.ftgl; public class SWIGTYPE_p_float { private long swigCPtr; protected SWIGTYPE_p_float(long cPtr, boolean bFutureUse) { swigCPtr = cPtr; } protected SWIGTYPE_p_float() { swigCPtr = 0; } protected static long getCPtr(SWIGTYPE_p_float obj) { return (obj == null) ? 0 : obj.swigCPtr; } }
package fuku.webbook; import java.util.Map; import org.springframework.validation.Validator; import org.springframework.validation.Errors; /** * Bean * * @author Hisaya FUKUMOTO */ public class <API key> implements Validator { public <API key>() { super(); } /** * * * @param clazz * @return truefalse */ @Override public boolean supports(Class clazz) { return PreferenceForm.class.isAssignableFrom(clazz); } /** * * * @param target * @param errors */ @Override public void validate(Object target, Errors errors) { PreferenceForm form = (PreferenceForm)target; WebBookBean webbook = form.getWebBookBean(); int method = form.getMethod(); Map<Integer,String> map = webbook.getSearchMethodMap(); if (!map.containsKey(method)) { errors.rejectValue("method", "error.invalid", "Invalid"); } if (form.getMaximum() <= 0) { errors.rejectValue("maximum", "error.invalid", "Invalid"); } } } // end of <API key>.java
#include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <stdarg.h> #include <string.h> typedef struct func_t { char *name; int private; char *desc; char *version; int num_args; char **args; char *returns; } func_t; func_t *functions = NULL; void bail_error(const char *fmt, ...) { va_list ap; char tmp[64] = { 0 }; va_start(ap, fmt); vsnprintf(tmp, sizeof(tmp), fmt, ap); va_end(ap); fprintf(stderr, "Error: %s\n", tmp); exit(1); } char *ltrim_string(char *str) { while (*str++ == ' ') ; if (*str == '\t') while (*str++ == '\t') if (*str != '\t') break; return str; } void parse_comment(char *line, int func_num, int *arg_num) { char *ltrimmed = ltrim_string(line); if (strncmp(ltrimmed, "Function name:", 14) == 0) { functions[func_num].name = strdup( ltrim_string( ltrimmed + 14) ); functions[func_num].private = 0; } else if (strncmp(ltrimmed, "Private function name:", 22) == 0) { functions[func_num].name = strdup( ltrim_string( ltrimmed + 22) ); functions[func_num].private = 1; } else if (strncmp(ltrimmed, "Since version:", 14) == 0) { functions[func_num].version = strdup( ltrim_string( ltrimmed + 14) ); } else if (strncmp(ltrimmed, "Description:", 12) == 0) { functions[func_num].desc = strdup( ltrim_string( ltrimmed + 12) ); } else if (strncmp(ltrimmed, "Arguments:", 10) == 0) { char *str = ltrim_string(ltrimmed + 11); if (arg_num == NULL) return; functions[func_num].num_args = 1; functions[func_num].args = malloc( sizeof(char *) ); functions[func_num].args[0] = malloc( (strlen(str) + 1) * sizeof(char) ); strcpy(functions[func_num].args[0], str); *arg_num = 1; } else if (strncmp(ltrimmed, "Returns:", 8) == 0) { char *str = ltrim_string(ltrimmed + 7); functions[func_num].returns = malloc( (strlen(str) + 1) * sizeof(char)); strcpy(functions[func_num].returns, str); } else if ((arg_num != NULL) && (*arg_num > 0)) { functions[func_num].num_args++; functions[func_num].args = realloc( functions[func_num].args, functions[func_num].num_args * sizeof(char *)); functions[func_num].args[functions[func_num].num_args-1] = malloc( (strlen(ltrimmed) + 1) * sizeof(char) ); strcpy(functions[func_num].args[functions[func_num].num_args-1], ltrimmed); *arg_num = *arg_num + 1; } } char *get_lpart(char *str) { if (!str || strcmp(str, "None") == 0) return str; char *new = strdup(str); char *tmp = strchr(str, ':'); if (!tmp) return str; new[ strlen(new) - strlen(tmp) ] = 0; return new; } char *get_rpart(char *str) { if (!str || strcmp(str, "None") == 0) return str; char *tmp = strchr(str, ':'); if (!tmp) return str; return (++tmp); } void free_functions(int function_number) { int i, j; for (i = 0; i <= function_number; i++) { for (j = 0; j < functions[i].num_args; j++) free(functions[i].args[j]); free(functions[i].name); free(functions[i].desc); free(functions[i].returns); } free(functions); } int count_functions(int num_funcs, int private) { int i, num = 0; for (i = 0; i < num_funcs; i++) if ((functions[i].name != NULL) && (functions[i].private == private)) num++; return num; } int main(int argc, char *argv[]) { char line[1024] = { 0 }; short in_comment = 0; int function_number = -1; int arg_number = 0; int private = 0; int idx = 1; FILE *fp; if (argc < 3) { fprintf(stderr, "Syntax: %s [-p|--private] source-file output-in-file\n", argv[0]); return 1; } if ((strcmp(argv[1], "-p") == 0) || (strcmp(argv[1], "--private") == 0)) { if (argc < 4) { fprintf(stderr, "Syntax: %s [-p|--private] source-file output-in-file\n", argv[0]); return 1; } private = 1; idx++; } if (access(argv[idx], R_OK) != 0) bail_error("Cannot open file %s", argv[1]); fp = fopen(argv[idx], "r"); if (fp == NULL) bail_error("Error while opening %s", argv[1]); functions = (func_t *)malloc( sizeof(func_t) ); while (!feof(fp)) { fgets(line, sizeof(line), fp); /* Strip new line characters */ if (line[strlen(line) - 1] == '\n') line[strlen(line) - 1] = 0; if (strcmp(line, "/*") == 0) { function_number++; in_comment = 1; functions = (func_t *) realloc( functions, sizeof(func_t) * (function_number + 1) ); functions[function_number].name = NULL; } else if (strcmp(line, "*/") == 0) in_comment = 0; else if (in_comment) parse_comment( line, function_number, &arg_number ); memset(line, 0, sizeof(line)); } fclose(fp); int i, j; fp = fopen(argv[idx+1], "w"); if (!fp) { free_functions(function_number); bail_error("Cannot write %s", argv[2]); } fprintf(fp, "<?xml version=\"1.0\"?>\n<html>\n <body>\n"); fprintf(fp,"<h1>%s API Reference guide</h1>\n\n <h3>Functions</h3>\n\n <!-- Links -->\n", (private == 0) ? "PHP" : "Developer's"); fprintf(fp, "<pre>Total number of functions: %d. Functions supported are:<br /><br />\n", count_functions(function_number, private)); for (i = 0; i <= function_number; i++) { if ((functions[i].name != NULL) && (functions[i].private == private)) { fprintf(fp, "\t<code class=\"docref\">%s</code>(", functions[i].name); for (j = 0; j < functions[i].num_args; j++) { if (strcmp(functions[i].args[j], "None") != 0) { char *new = get_lpart(functions[i].args[j]); char *part; int decrement; if (new[0] == '@') new++; part = strchr(new, ' '); decrement = (part != NULL) ? strlen( part ) : 0; if (j > 0) fprintf(fp, ", "); new[ strlen(new) - decrement ] = 0; fprintf(fp, "$%s", new); } } fprintf(fp, ")<br />\n"); } } fprintf(fp, "</pre>\n"); for (i = 0; i <= function_number; i++) { if ((functions[i].name != NULL) && (functions[i].private == private)) { fprintf(fp, "<h3><a name=\"%s\"><code>%s</code></a></h3>\n", functions[i].name, functions[i].name); fprintf(fp, "<pre class=\"programlisting\">%s(", functions[i].name); for (j = 0; j < functions[i].num_args; j++) { if (strcmp(functions[i].args[j], "None") != 0) { char *new = get_lpart(functions[i].args[j]); char *part; int decrement; if (new[0] == '@') new++; part = strchr(new, ' '); decrement = (part != NULL) ? strlen( part ) : 0; if (j > 0) fprintf(fp, ", "); new[ strlen(new) - decrement ] = 0; fprintf(fp, "$%s", new); } } fprintf(fp, ")</pre>\n"); fprintf(fp, "<p>[Since version %s]</p>\n", functions[i].version); fprintf(fp, "<p>%s.</p>", functions[i].desc); fprintf(fp, "<div class=\"variablelist\">\n"); fprintf(fp, "\t<table border=\"0\">\n"); fprintf(fp, "\t\t<col align=\"left\" />\n"); fprintf(fp, "\t\t<tbody>\n"); for (j = 0; j < functions[i].num_args; j++) { if (strcmp(functions[i].args[j], "None") != 0) { fprintf(fp, "\t\t <tr>\n"); fprintf(fp, "\t\t <td>\n"); fprintf(fp, "\t\t\t<span class=\"term\"><i><tt>%s</tt></i>:</span>\n", get_lpart(functions[i].args[j]) ); fprintf(fp, "\t\t </td>\n"); fprintf(fp, "\t\t <td>\n"); fprintf(fp, "\t\t\t%s\n", get_rpart(functions[i].args[j])); fprintf(fp, "\t\t </td>\n"); fprintf(fp, "\t\t </tr>\n"); } } fprintf(fp, "\t\t <tr>\n"); fprintf(fp, "\t\t <td>\n"); fprintf(fp, "\t\t\t<span class=\"term\"><i><tt>Returns</tt></i>:</span>\n"); fprintf(fp, "\t\t </td>\n"); fprintf(fp, "\t\t <td>\n"); fprintf(fp, "\t\t\t%s\n", functions[i].returns); fprintf(fp, "\t\t </td>\n"); fprintf(fp, "\t\t </tr>\n"); fprintf(fp, "\t\t</tbody>\n"); fprintf(fp, "\t</table>\n"); fprintf(fp, "</div>\n"); } } fclose(fp); free_functions(function_number); printf("Documentation has been generated successfully\n"); return 0; }
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ #include "config.h" #include "flow-packet.h" #include <string.h> /* memcpy */ #define DATA_ALIGN_TO (sizeof (gpointer)) #define PACKET_HEADER_SIZE (((sizeof (FlowPacket) + DATA_ALIGN_TO - 1) / DATA_ALIGN_TO) * DATA_ALIGN_TO) #if GLIB_MAJOR_VERSION >= 2 && GLIB_MINOR_VERSION >= 10 # define packet_alloc(size) g_slice_alloc (size) # define packet_free(packet, size) g_slice_free1 (size, packet) #else # define packet_alloc(size) g_malloc (size) # define packet_free(packet, size) g_free (packet) #endif /** * flow_packet_new: * @format: Format of this packet's contents, e.g. #<API key> or * #<API key>. * @data: For packets of type #<API key>, a pointer to the data * that will be copied into the packet. For #<API key>, * a pointer to the object that will be referenced. * @size: For #<API key>, the size of @data to copy, in bytes. * For #<API key>, an approximate measure of the memory * consumed by the object. * * Creates a new packet that can be queued and handled by Flow elements and * pipelines. * * Return value: A new #FlowPacket. **/ FlowPacket * flow_packet_new (FlowPacketFormat format, gpointer data, guint size) { FlowPacket *packet; guint body_size; switch (format) { case <API key>: body_size = size; break; case <API key>: body_size = sizeof (gpointer); break; default: <API key> (); body_size = 0; break; } packet = packet_alloc (PACKET_HEADER_SIZE + body_size); packet->format = format; packet->size = size; packet->ref_count = 1; switch (format) { case <API key>: if (size > 0) { g_assert (data != NULL); memcpy ((guint8 *) packet + PACKET_HEADER_SIZE, data, size); } break; case <API key>: g_assert (data != NULL); g_object_ref (data); *((gpointer *) ((guint8 *) packet + PACKET_HEADER_SIZE)) = data; break; default: <API key> (); break; } return packet; } FlowPacket * <API key> (guint size, gpointer *data_ptr_out) { FlowPacket *packet; <API key> (size > 0, NULL); packet = packet_alloc (PACKET_HEADER_SIZE + size); packet->format = <API key>; packet->size = size; packet->ref_count = 1; *data_ptr_out = (gpointer *) ((guint8 *) packet + PACKET_HEADER_SIZE); return packet; } /** * <API key>: * @object: A pointer to the object that will be referenced. * @size: An approximate measure of the memory consumed by the object. * * Creates a new packet that can be queued and handled by Flow elements and * pipelines. This function does not increment @object's reference count; * it takes the reference the caller was holding. It's faster than the * more generic flow_packet_new (). * * Return value: A new #FlowPacket. **/ FlowPacket * <API key> (gpointer object, guint size) { FlowPacket *packet; packet = packet_alloc (PACKET_HEADER_SIZE + sizeof (gpointer)); packet->format = <API key>; packet->size = size; packet->ref_count = 1; g_assert (object != NULL); *((gpointer *) ((guint8 *) packet + PACKET_HEADER_SIZE)) = object; return packet; } FlowPacket * flow_packet_copy (FlowPacket *packet) { FlowPacket *packet_copy; <API key> (packet != NULL, NULL); switch (packet->format) { case <API key>: packet_copy = packet_alloc (PACKET_HEADER_SIZE + packet->size); memcpy (packet_copy, packet, PACKET_HEADER_SIZE + packet->size); break; case <API key>: { GObject *object; object = *((gpointer *) ((guint8 *) packet + PACKET_HEADER_SIZE)); g_object_ref (object); packet_copy = packet_alloc (PACKET_HEADER_SIZE + sizeof (gpointer)); memcpy (packet_copy, packet, PACKET_HEADER_SIZE + sizeof (gpointer)); } break; default: <API key> (); packet_copy = NULL; break; } packet_copy->ref_count = 1; return packet_copy; } static void free_packet (FlowPacket *packet) { switch (packet->format) { case <API key>: packet_free (packet, PACKET_HEADER_SIZE + packet->size); break; case <API key>: { GObject *object; object = *((gpointer *) ((guint8 *) packet + PACKET_HEADER_SIZE)); g_object_unref (object); packet_free (packet, PACKET_HEADER_SIZE + sizeof (gpointer)); } break; default: <API key> (); break; } } /** * flow_packet_ref: * @packet: The packet to add a reference to. * * Adds a reference to the packet. The packet is freed when its reference count * drops to zero. * * As a convenience, the passed-in pointer is returned, so you can use it in statements * like the following: flow_pad_push (pad, flow_packet_ref (packet)); * * Return value: The passed-in #FlowPacket. **/ FlowPacket * flow_packet_ref (FlowPacket *packet) { <API key> (packet != NULL, NULL); g_atomic_int_inc (&packet->ref_count); return packet; } /** * flow_packet_unref: * @packet: The packet to subtract a reference from. * * Removes a reference from the packet. The packet is freed when its reference count * drops to zero. If the packet contains data, it will be freed with the packet. If a * freed packet references an object, the object will be unreferenced. **/ void flow_packet_unref (FlowPacket *packet) { gboolean is_zero; g_return_if_fail (packet != NULL); is_zero = <API key> (&packet->ref_count); if (is_zero) free_packet (packet); } /** * <API key>: * @packet: A packet. * * Gets the format of the packet's contents. * * Return value: The format of the packet's contents. **/ FlowPacketFormat <API key> (FlowPacket *packet) { <API key> (packet != NULL, <API key>); return packet->format; } /** * <API key>: * @packet: A packet. * * Gets the size of a packet specified upon its creation. * * Return value: The packet's size. **/ guint <API key> (FlowPacket *packet) { <API key> (packet != NULL, 0); return packet->size; } /** * <API key>: * @packet: A packet. * * Gets the data assigned to a packet. For buffers, this is a pointer to * an array of bytes owned by the packet. For objects, it is a pointer to * the object. * * Return value: The packet's data pointer. **/ gpointer <API key> (FlowPacket *packet) { gpointer data; <API key> (packet != NULL, NULL); switch (packet->format) { case <API key>: data = (guint8 *) packet + PACKET_HEADER_SIZE; break; case <API key>: data = *((gpointer *) ((guint8 *) packet + PACKET_HEADER_SIZE)); break; default: <API key> (); data = NULL; break; } return data; }
// This file is part of the deal.II library. // The deal.II library is free software; you can use it, redistribute // it, and/or modify it under the terms of the GNU Lesser General // the top level of the deal.II distribution. // Tests matrix-vector product for larger polynomial degrees in 2D, otherwise // similar to matrix_vector_07.cc #include "../tests.h" #include "matrix_vector_mf.h" #include <deal.II/base/utilities.h> #include <deal.II/base/function.h> #include <deal.II/distributed/tria.h> #include <deal.II/grid/grid_generator.h> #include <deal.II/grid/manifold_lib.h> #include <deal.II/dofs/dof_tools.h> #include <deal.II/dofs/dof_handler.h> #include <deal.II/lac/constraint_matrix.h> #include <deal.II/lac/sparse_matrix.h> #include <deal.II/lac/sparsity_pattern.h> #include <deal.II/fe/fe_q.h> #include <deal.II/fe/fe_values.h> #include <deal.II/numerics/vector_tools.h> #include <iostream> template <int dim, int fe_degree> void test () { typedef double number; Triangulation<dim> tria; GridGenerator::hyper_cube (tria); tria.refine_global(1); typename Triangulation<dim>::<API key> cell = tria.begin_active (), endc = tria.end(); cell = tria.begin_active (); for (; cell!=endc; ++cell) if (cell->is_locally_owned()) if (cell->center().norm()<0.2) cell->set_refine_flag(); tria.<API key>(); tria.refine_global(1); tria.begin(tria.n_levels()-1)->set_refine_flag(); tria.last()->set_refine_flag(); tria.<API key>(); FE_Q<dim> fe (fe_degree); DoFHandler<dim> dof (tria); dof.distribute_dofs(fe); IndexSet owned_set = dof.locally_owned_dofs(); IndexSet relevant_set; DoFTools::<API key> (dof, relevant_set); ConstraintMatrix constraints (relevant_set); DoFTools::<API key>(dof, constraints); VectorTools::<API key> (dof, 0, Functions::ZeroFunction<dim>(), constraints); constraints.close(); deallog << "Testing " << dof.get_fe().get_name() << std::endl; //std::cout << "Number of cells: " << tria.<API key>() << std::endl; //std::cout << "Number of degrees of freedom: " << dof.n_dofs() << std::endl; //std::cout << "Number of constraints: " << constraints.n_constraints() << std::endl; MatrixFree<dim,number> mf_data; { const QGauss<1> quad (fe_degree+1); typename MatrixFree<dim,number>::AdditionalData data; data.<API key> = MatrixFree<dim,number>::AdditionalData::none; mf_data.reinit (dof, constraints, quad, data); } MatrixFreeTest<dim,fe_degree,number,Vector<number> > mf (mf_data); Vector<number> in(dof.n_dofs()), out(dof.n_dofs()), ref(dof.n_dofs()); for (unsigned int i=0; i<in.size(); ++i) { if (constraints.is_constrained(i)) continue; in(i) = random_value<double>(); } mf.vmult (out, in); // assemble trilinos sparse matrix with // (\nabla v, \nabla u) + (v, 10 * u) for // reference SparsityPattern sparsity; SparseMatrix<number> sparse_matrix; { <API key> csp (dof.n_dofs(), dof.n_dofs()); DoFTools::<API key> (dof, csp, constraints, true); sparsity.copy_from(csp); sparse_matrix.reinit (sparsity); } { QGauss<dim> quadrature_formula(fe_degree+1); FEValues<dim> fe_values (dof.get_fe(), quadrature_formula, update_values | update_gradients | update_JxW_values); const unsigned int dofs_per_cell = dof.get_fe().dofs_per_cell; const unsigned int n_q_points = quadrature_formula.size(); FullMatrix<double> cell_matrix (dofs_per_cell, dofs_per_cell); std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); typename DoFHandler<dim>::<API key> cell = dof.begin_active(), endc = dof.end(); for (; cell!=endc; ++cell) { cell_matrix = 0; fe_values.reinit (cell); for (unsigned int q_point=0; q_point<n_q_points; ++q_point) for (unsigned int i=0; i<dofs_per_cell; ++i) { for (unsigned int j=0; j<dofs_per_cell; ++j) cell_matrix(i,j) += ((fe_values.shape_grad(i,q_point) * fe_values.shape_grad(j,q_point) + 10. * fe_values.shape_value(i,q_point) * fe_values.shape_value(j,q_point)) * fe_values.JxW(q_point)); } cell->get_dof_indices(local_dof_indices); constraints.<API key> (cell_matrix, local_dof_indices, sparse_matrix); } } sparse_matrix.vmult (ref, in); out -= ref; const double diff_norm = out.linfty_norm(); deallog << "Norm of difference: " << diff_norm << std::endl << std::endl; } int main (int argc, char **argv) { initlog(); test<2,9>(); }
#include <geos/platform.h> // for FINITE #include <geos/geom/Geometry.h> #include <geos/geom/prep/PreparedGeometry.h> #include <geos/geom/prep/<API key>.h> #include <geos/geom/GeometryCollection.h> #include <geos/geom/Polygon.h> #include <geos/geom/Point.h> #include <geos/geom/MultiPoint.h> #include <geos/geom/MultiLineString.h> #include <geos/geom/MultiPolygon.h> #include <geos/geom/LinearRing.h> #include <geos/geom/LineString.h> #include <geos/geom/PrecisionModel.h> #include <geos/geom/GeometryFactory.h> #include <geos/geom/<API key>.h> #include <geos/geom/Coordinate.h> #include <geos/geom/IntersectionMatrix.h> #include <geos/geom/Envelope.h> #include <geos/index/strtree/STRtree.h> #include <geos/index/ItemVisitor.h> #include <geos/io/WKTReader.h> #include <geos/io/WKBReader.h> #include <geos/io/WKTWriter.h> #include <geos/io/WKBWriter.h> #include <geos/algorithm/distance/<API key>.h> #include <geos/algorithm/CGAlgorithms.h> #include <geos/algorithm/BoundaryNodeRule.h> #include <geos/simplify/<API key>.h> #include <geos/simplify/<API key>.h> #include <geos/noding/GeometryNoder.h> #include <geos/noding/Noder.h> #include <geos/operation/buffer/BufferBuilder.h> #include <geos/operation/buffer/BufferOp.h> #include <geos/operation/buffer/BufferParameters.h> #include <geos/operation/distance/DistanceOp.h> #include <geos/operation/linemerge/LineMerger.h> #include <geos/operation/overlay/OverlayOp.h> #include <geos/operation/overlay/snap/GeometrySnapper.h> #include <geos/operation/polygonize/Polygonizer.h> #include <geos/operation/relate/RelateOp.h> #include <geos/operation/sharedpaths/SharedPathsOp.h> #include <geos/operation/union/<API key>.h> #include <geos/operation/valid/IsValidOp.h> #include <geos/linearref/LengthIndexedLine.h> #include <geos/triangulate/<API key>.h> #include <geos/triangulate/<API key>.h> #include <geos/util/<API key>.h> #include <geos/util/Interrupt.h> #include <geos/util/<API key>.h> #include <geos/util/Machine.h> #include <geos/version.h> // This should go away #include <cmath> // finite #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <iostream> #include <sstream> #include <string> #include <memory> #ifdef _MSC_VER #pragma warning(disable : 4099) #endif // Some extra magic to make type declarations in geos_c.h work - // for cross-checking of types in header. #define GEOSGeometry geos::geom::Geometry #define <API key> geos::geom::prep::PreparedGeometry #define GEOSCoordSequence geos::geom::CoordinateSequence #define GEOSBufferParams geos::operation::buffer::BufferParameters #define GEOSSTRtree geos::index::strtree::STRtree #define GEOSWKTReader_t geos::io::WKTReader #define GEOSWKTWriter_t geos::io::WKTWriter #define GEOSWKBReader_t geos::io::WKBReader #define GEOSWKBWriter_t geos::io::WKBWriter #include "geos_c.h" #include "../geos_svn_revision.h" // Intentional, to allow non-standard C elements like C99 functions to be // imported through C++ headers of C library, like <cmath>. using namespace std; Define this if you want operations triggering Exceptions to be printed. (will use the NOTIFY channel - only implemented for GEOSUnion so far) #undef VERBOSE_EXCEPTIONS #include <geos/export.h> // import the most frequently used definitions globally using geos::geom::Geometry; using geos::geom::LineString; using geos::geom::Polygon; using geos::geom::CoordinateSequence; using geos::geom::GeometryFactory; using geos::io::WKTReader; using geos::io::WKTWriter; using geos::io::WKBReader; using geos::io::WKBWriter; using geos::operation::overlay::OverlayOp; using geos::operation::overlay::overlayOp; using geos::operation::geounion::<API key>; using geos::operation::buffer::BufferParameters; using geos::operation::buffer::BufferBuilder; using geos::util::<API key>; using geos::algorithm::distance::<API key>; typedef std::auto_ptr<Geometry> GeomAutoPtr; typedef struct <API key> { const GeometryFactory *geomFactory; GEOSMessageHandler NOTICE_MESSAGE; GEOSMessageHandler ERROR_MESSAGE; int WKBOutputDims; int WKBByteOrder; int initialized; } <API key>; // CAPI_ItemVisitor is used internally by the CAPI STRtree // wrappers. It's defined here just to keep it out of the // extern "C" block. class CAPI_ItemVisitor : public geos::index::ItemVisitor { GEOSQueryCallback callback; void *userdata; public: CAPI_ItemVisitor (GEOSQueryCallback cb, void *ud) : ItemVisitor(), callback(cb), userdata(ud) {} void visitItem (void *item) { callback(item, userdata); } }; // extern "C" const char GEOS_DLL *GEOSjtsport(); extern "C" char GEOS_DLL *GEOSasText(Geometry *g1); namespace { // anonymous char* gstrdup_s(const char* str, const std::size_t size) { char* out = static_cast<char*>(malloc(size + 1)); if (0 != out) { // as no strlen call necessary, memcpy may be faster than strcpy std::memcpy(out, str, size + 1); } assert(0 != out); // we haven't been checking allocation before ticket #371 if (0 == out) { throw(std::runtime_error("Failed to allocate memory for duplicate string")); } return out; } char* gstrdup(std::string const& str) { return gstrdup_s(str.c_str(), str.size()); } } // namespace anonymous extern "C" { GEOSContextHandle_t initGEOS_r(GEOSMessageHandler nf, GEOSMessageHandler ef) { <API key> *handle = 0; void *extHandle = 0; extHandle = malloc(sizeof(<API key>)); if (0 != extHandle) { handle = static_cast<<API key>*>(extHandle); handle->NOTICE_MESSAGE = nf; handle->ERROR_MESSAGE = ef; handle->geomFactory = GeometryFactory::getDefaultInstance(); handle->WKBOutputDims = 2; handle->WKBByteOrder = getMachineByteOrder(); handle->initialized = 1; } geos::util::Interrupt::cancel(); return static_cast<GEOSContextHandle_t>(extHandle); } GEOSMessageHandler <API key>(GEOSContextHandle_t extHandle, GEOSMessageHandler nf) { GEOSMessageHandler f; <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } f = handle->NOTICE_MESSAGE; handle->NOTICE_MESSAGE = nf; return f; } GEOSMessageHandler <API key>(GEOSContextHandle_t extHandle, GEOSMessageHandler nf) { GEOSMessageHandler f; <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } f = handle->ERROR_MESSAGE; handle->ERROR_MESSAGE = nf; return f; } void finishGEOS_r(GEOSContextHandle_t extHandle) { // Fix up freeing handle w.r.t. malloc above free(extHandle); extHandle = NULL; } void GEOSFree_r (GEOSContextHandle_t extHandle, void* buffer) { assert(0 != extHandle); free(buffer); } // relate()-related functions // return 0 = false, 1 = true, 2 = error occured char GEOSDisjoint_r(GEOSContextHandle_t extHandle, const Geometry *g1, const Geometry *g2) { if ( 0 == extHandle ) { return 2; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( handle->initialized == 0 ) { return 2; } try { bool result = g1->disjoint(g2); return result; } // TODO: mloskot is going to replace these double-catch block // with a macro to remove redundant code in this and // following functions. catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 2; } char GEOSTouches_r(GEOSContextHandle_t extHandle, const Geometry *g1, const Geometry *g2) { if ( 0 == extHandle ) { return 2; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 2; } try { bool result = g1->touches(g2); return result; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 2; } char GEOSIntersects_r(GEOSContextHandle_t extHandle, const Geometry *g1, const Geometry *g2) { if ( 0 == extHandle ) { return 2; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 2; } try { bool result = g1->intersects(g2); return result; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 2; } char GEOSCrosses_r(GEOSContextHandle_t extHandle, const Geometry *g1, const Geometry *g2) { if ( 0 == extHandle ) { return 2; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 2; } try { bool result = g1->crosses(g2); return result; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 2; } char GEOSWithin_r(GEOSContextHandle_t extHandle, const Geometry *g1, const Geometry *g2) { if ( 0 == extHandle ) { return 2; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 2; } try { bool result = g1->within(g2); return result; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 2; } // call g1->contains(g2) // returns 0 = false // 1 = true // 2 = error was trapped char GEOSContains_r(GEOSContextHandle_t extHandle, const Geometry *g1, const Geometry *g2) { if ( 0 == extHandle ) { return 2; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 2; } try { bool result = g1->contains(g2); return result; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 2; } char GEOSOverlaps_r(GEOSContextHandle_t extHandle, const Geometry *g1, const Geometry *g2) { if ( 0 == extHandle ) { return 2; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 2; } try { bool result = g1->overlaps(g2); return result; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 2; } char GEOSCovers_r(GEOSContextHandle_t extHandle, const Geometry *g1, const Geometry *g2) { if ( 0 == extHandle ) { return 2; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 2; } try { bool result = g1->covers(g2); return result; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 2; } char GEOSCoveredBy_r(GEOSContextHandle_t extHandle, const Geometry *g1, const Geometry *g2) { if ( 0 == extHandle ) { return 2; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 2; } try { bool result = g1->coveredBy(g2); return result; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 2; } // low-level relate functions char GEOSRelatePattern_r(GEOSContextHandle_t extHandle, const Geometry *g1, const Geometry *g2, const char *pat) { if ( 0 == extHandle ) { return 2; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 2; } try { std::string s(pat); bool result = g1->relate(g2, s); return result; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 2; } char <API key>(GEOSContextHandle_t extHandle, const char *mat, const char *pat) { if ( 0 == extHandle ) { return 2; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 2; } try { using geos::geom::IntersectionMatrix; std::string m(mat); std::string p(pat); IntersectionMatrix im(m); bool result = im.matches(p); return result; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 2; } char * GEOSRelate_r(GEOSContextHandle_t extHandle, const Geometry *g1, const Geometry *g2) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { using geos::geom::IntersectionMatrix; IntersectionMatrix* im = g1->relate(g2); if (0 == im) { return 0; } char *result = gstrdup(im->toString()); delete im; im = 0; return result; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } char * <API key>(GEOSContextHandle_t extHandle, const Geometry *g1, const Geometry *g2, int bnr) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { using geos::operation::relate::RelateOp; using geos::geom::IntersectionMatrix; using geos::algorithm::BoundaryNodeRule; IntersectionMatrix* im; switch (bnr) { case GEOSRELATE_BNR_MOD2: /* same as OGC */ im = RelateOp::relate(g1, g2, BoundaryNodeRule::getBoundaryRuleMod2()); break; case <API key>: im = RelateOp::relate(g1, g2, BoundaryNodeRule::getBoundaryEndPoint()); break; case <API key>: im = RelateOp::relate(g1, g2, BoundaryNodeRule::<API key>()); break; case <API key>: im = RelateOp::relate(g1, g2, BoundaryNodeRule::<API key>()); break; default: handle->ERROR_MESSAGE("Invalid boundary node rule %d", bnr); return 0; break; } if (0 == im) return 0; char *result = gstrdup(im->toString()); delete im; im = 0; return result; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } // isValid char GEOSisValid_r(GEOSContextHandle_t extHandle, const Geometry *g1) { if ( 0 == extHandle ) { return 2; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 2; } try { using geos::operation::valid::IsValidOp; using geos::operation::valid::<API key>; IsValidOp ivo(g1); <API key> *err = ivo.getValidationError(); if ( err ) { handle->NOTICE_MESSAGE("%s", err->toString().c_str()); return 0; } else { return 1; } } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 2; } char * GEOSisValidReason_r(GEOSContextHandle_t extHandle, const Geometry *g1) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { using geos::operation::valid::IsValidOp; using geos::operation::valid::<API key>; char* result = 0; char const* const validstr = "Valid Geometry"; IsValidOp ivo(g1); <API key> *err = ivo.getValidationError(); if (0 != err) { std::ostringstream ss; ss.precision(15); ss << err->getCoordinate(); const std::string errloc = ss.str(); std::string errmsg(err->getMessage()); errmsg += "[" + errloc + "]"; result = gstrdup(errmsg); } else { result = gstrdup(std::string(validstr)); } return result; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 0; } char GEOSisValidDetail_r(GEOSContextHandle_t extHandle, const Geometry *g, int flags, char** reason, Geometry ** location) { if ( 0 == extHandle ) { return 0; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 0; } try { using geos::operation::valid::IsValidOp; using geos::operation::valid::<API key>; IsValidOp ivo(g); if ( flags & <API key> ) { ivo.<API key>(true); } <API key> *err = ivo.getValidationError(); if (0 != err) { if ( location ) { *location = handle->geomFactory->createPoint(err->getCoordinate()); } if ( reason ) { std::string errmsg(err->getMessage()); *reason = gstrdup(errmsg); } return 0; } if ( location ) *location = 0; if ( reason ) *reason = 0; return 1; /* valid */ } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 2; /* exception */ } // general purpose char GEOSEquals_r(GEOSContextHandle_t extHandle, const Geometry *g1, const Geometry *g2) { if ( 0 == extHandle ) { return 2; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 2; } try { bool result = g1->equals(g2); return result; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 2; } char GEOSEqualsExact_r(GEOSContextHandle_t extHandle, const Geometry *g1, const Geometry *g2, double tolerance) { if ( 0 == extHandle ) { return 2; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 2; } try { bool result = g1->equalsExact(g2, tolerance); return result; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 2; } int GEOSDistance_r(GEOSContextHandle_t extHandle, const Geometry *g1, const Geometry *g2, double *dist) { assert(0 != dist); if ( 0 == extHandle ) { return 0; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 0; } try { *dist = g1->distance(g2); return 1; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 0; } int <API key>(GEOSContextHandle_t extHandle, const Geometry *g1, const Geometry *g2, double *dist) { assert(0 != dist); if ( 0 == extHandle ) { return 0; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 0; } try { *dist = <API key>::distance(*g1, *g2); return 1; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 0; } int <API key>(GEOSContextHandle_t extHandle, const Geometry *g1, const Geometry *g2, double densifyFrac, double *dist) { assert(0 != dist); if ( 0 == extHandle ) { return 0; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 0; } try { *dist = <API key>::distance(*g1, *g2, densifyFrac); return 1; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 0; } int GEOSArea_r(GEOSContextHandle_t extHandle, const Geometry *g, double *area) { assert(0 != area); if ( 0 == extHandle ) { return 0; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 0; } try { *area = g->getArea(); return 1; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 0; } int GEOSLength_r(GEOSContextHandle_t extHandle, const Geometry *g, double *length) { assert(0 != length); if ( 0 == extHandle ) { return 2; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 0; } try { *length = g->getLength(); return 1; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 0; } CoordinateSequence * GEOSNearestPoints_r(GEOSContextHandle_t extHandle, const Geometry *g1, const Geometry *g2) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { if (g1->isEmpty() || g2->isEmpty()) return 0; return geos::operation::distance::DistanceOp::nearestPoints(g1, g2); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } Geometry * GEOSGeomFromWKT_r(GEOSContextHandle_t extHandle, const char *wkt) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { const std::string wktstring(wkt); WKTReader r(static_cast<GeometryFactory const*>(handle->geomFactory)); Geometry *g = r.read(wktstring); return g; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } char * GEOSGeomToWKT_r(GEOSContextHandle_t extHandle, const Geometry *g1) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { char *result = gstrdup(g1->toString()); return result; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } // Remember to free the result! unsigned char * GEOSGeomToWKB_buf_r(GEOSContextHandle_t extHandle, const Geometry *g, size_t *size) { assert(0 != size); if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } using geos::io::WKBWriter; try { int byteOrder = handle->WKBByteOrder; WKBWriter w(handle->WKBOutputDims, byteOrder); std::ostringstream os(std::ios_base::binary); w.write(*g, os); std::string wkbstring(os.str()); const std::size_t len = wkbstring.length(); unsigned char* result = 0; result = static_cast<unsigned char*>(malloc(len)); if (0 != result) { std::memcpy(result, wkbstring.c_str(), len); *size = len; } return result; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } Geometry * <API key>(GEOSContextHandle_t extHandle, const unsigned char *wkb, size_t size) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } using geos::io::WKBReader; try { std::string wkbstring(reinterpret_cast<const char*>(wkb), size); // make it binary ! WKBReader r(*(static_cast<GeometryFactory const*>(handle->geomFactory))); std::istringstream is(std::ios_base::binary); is.str(wkbstring); is.seekg(0, std::ios::beg); // rewind reader pointer Geometry *g = r.read(is); return g; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } /* Read/write wkb hex values. Returned geometries are owned by the caller.*/ unsigned char * GEOSGeomToHEX_buf_r(GEOSContextHandle_t extHandle, const Geometry *g, size_t *size) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } using geos::io::WKBWriter; try { int byteOrder = handle->WKBByteOrder; WKBWriter w(handle->WKBOutputDims, byteOrder); std::ostringstream os(std::ios_base::binary); w.writeHEX(*g, os); std::string hexstring(os.str()); char *result = gstrdup(hexstring); if (0 != result) { *size = hexstring.length(); } return reinterpret_cast<unsigned char*>(result); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } Geometry * <API key>(GEOSContextHandle_t extHandle, const unsigned char *hex, size_t size) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } using geos::io::WKBReader; try { std::string hexstring(reinterpret_cast<const char*>(hex), size); WKBReader r(*(static_cast<GeometryFactory const*>(handle->geomFactory))); std::istringstream is(std::ios_base::binary); is.str(hexstring); is.seekg(0, std::ios::beg); // rewind reader pointer Geometry *g = r.readHEX(is); return g; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } char GEOSisEmpty_r(GEOSContextHandle_t extHandle, const Geometry *g1) { if ( 0 == extHandle ) { return 2; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 2; } try { return g1->isEmpty(); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 2; } char GEOSisSimple_r(GEOSContextHandle_t extHandle, const Geometry *g1) { if ( 0 == extHandle ) { return 2; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 2; } try { return g1->isSimple(); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); return 2; } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); return 2; } } char GEOSisRing_r(GEOSContextHandle_t extHandle, const Geometry *g) { if ( 0 == extHandle ) { return 2; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 2; } try { const LineString *ls = dynamic_cast<const LineString *>(g); if ( ls ) { return (ls->isRing()); } else { return 0; } } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); return 2; } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); return 2; } } //free the result of this char * GEOSGeomType_r(GEOSContextHandle_t extHandle, const Geometry *g1) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { std::string s = g1->getGeometryType(); char *result = gstrdup(s); return result; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } // Return postgis geometry type index int GEOSGeomTypeId_r(GEOSContextHandle_t extHandle, const Geometry *g1) { if ( 0 == extHandle ) { return -1; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return -1; } try { return g1->getGeometryTypeId(); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return -1; } // GEOS functions that return geometries Geometry * GEOSEnvelope_r(GEOSContextHandle_t extHandle, const Geometry *g1) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { Geometry *g3 = g1->getEnvelope(); return g3; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } Geometry * GEOSIntersection_r(GEOSContextHandle_t extHandle, const Geometry *g1, const Geometry *g2) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { return g1->intersection(g2); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } Geometry * GEOSBuffer_r(GEOSContextHandle_t extHandle, const Geometry *g1, double width, int quadrantsegments) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { Geometry *g3 = g1->buffer(width, quadrantsegments); return g3; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } Geometry * <API key>(GEOSContextHandle_t extHandle, const Geometry *g1, double width, int quadsegs, int endCapStyle, int joinStyle, double mitreLimit) { using geos::operation::buffer::BufferParameters; using geos::operation::buffer::BufferOp; using geos::util::<API key>; if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { BufferParameters bp; bp.setQuadrantSegments(quadsegs); if ( endCapStyle > BufferParameters::CAP_SQUARE ) { throw <API key>("Invalid buffer endCap style"); } bp.setEndCapStyle( static_cast<BufferParameters::EndCapStyle>(endCapStyle) ); if ( joinStyle > BufferParameters::JOIN_BEVEL ) { throw <API key>("Invalid buffer join style"); } bp.setJoinStyle( static_cast<BufferParameters::JoinStyle>(joinStyle) ); bp.setMitreLimit(mitreLimit); BufferOp op(g1, bp); Geometry *g3 = op.getResultGeometry(width); return g3; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } Geometry * GEOSOffsetCurve_r(GEOSContextHandle_t extHandle, const Geometry *g1, double width, int quadsegs, int joinStyle, double mitreLimit) { if ( 0 == extHandle ) return NULL; <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) return NULL; try { BufferParameters bp; bp.setEndCapStyle( BufferParameters::CAP_FLAT ); bp.setQuadrantSegments(quadsegs); if ( joinStyle > BufferParameters::JOIN_BEVEL ) { throw <API key>("Invalid buffer join style"); } bp.setJoinStyle( static_cast<BufferParameters::JoinStyle>(joinStyle) ); bp.setMitreLimit(mitreLimit); bool isLeftSide = true; if ( width < 0 ) { isLeftSide = false; width = -width; } BufferBuilder bufBuilder (bp); Geometry *g3 = bufBuilder.<API key>(g1, width, isLeftSide); return g3; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } /* @deprecated in 3.3.0 */ Geometry * <API key>(GEOSContextHandle_t extHandle, const Geometry *g1, double width, int quadsegs, int joinStyle, double mitreLimit, int leftSide) { if ( 0 == extHandle ) return NULL; <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) return NULL; try { BufferParameters bp; bp.setEndCapStyle( BufferParameters::CAP_FLAT ); bp.setQuadrantSegments(quadsegs); if ( joinStyle > BufferParameters::JOIN_BEVEL ) { throw <API key>("Invalid buffer join style"); } bp.setJoinStyle( static_cast<BufferParameters::JoinStyle>(joinStyle) ); bp.setMitreLimit(mitreLimit); bool isLeftSide = leftSide == 0 ? false : true; BufferBuilder bufBuilder (bp); Geometry *g3 = bufBuilder.<API key>(g1, width, isLeftSide); return g3; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } Geometry * GEOSConvexHull_r(GEOSContextHandle_t extHandle, const Geometry *g1) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { Geometry *g3 = g1->convexHull(); return g3; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } Geometry * GEOSDifference_r(GEOSContextHandle_t extHandle, const Geometry *g1, const Geometry *g2) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { return g1->difference(g2); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } Geometry * GEOSBoundary_r(GEOSContextHandle_t extHandle, const Geometry *g1) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { Geometry *g3 = g1->getBoundary(); return g3; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } Geometry * GEOSSymDifference_r(GEOSContextHandle_t extHandle, const Geometry *g1, const Geometry *g2) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { return g1->symDifference(g2); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); return NULL; } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); return NULL; } } Geometry * GEOSUnion_r(GEOSContextHandle_t extHandle, const Geometry *g1, const Geometry *g2) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { return g1->Union(g2); } catch (const std::exception &e) { #if VERBOSE_EXCEPTIONS std::ostringstream s; s << "Exception on GEOSUnion with following inputs:" << std::endl; s << "A: "<<g1->toString() << std::endl; s << "B: "<<g2->toString() << std::endl; handle->NOTICE_MESSAGE("%s", s.str().c_str()); #endif // VERBOSE_EXCEPTIONS handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } Geometry * GEOSUnaryUnion_r(GEOSContextHandle_t extHandle, const Geometry *g) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { GeomAutoPtr g3 ( g->Union() ); return g3.release(); } catch (const std::exception &e) { #if VERBOSE_EXCEPTIONS std::ostringstream s; s << "Exception on GEOSUnaryUnion with following inputs:" << std::endl; s << "A: "<<g1->toString() << std::endl; s << "B: "<<g2->toString() << std::endl; handle->NOTICE_MESSAGE("%s", s.str().c_str()); #endif // VERBOSE_EXCEPTIONS handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } Geometry * GEOSNode_r(GEOSContextHandle_t extHandle, const Geometry *g) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { std::auto_ptr<Geometry> g3 = geos::noding::GeometryNoder::node(*g); return g3.release(); } catch (const std::exception &e) { #if VERBOSE_EXCEPTIONS std::ostringstream s; s << "Exception on GEOSUnaryUnion with following inputs:" << std::endl; s << "A: "<<g1->toString() << std::endl; s << "B: "<<g2->toString() << std::endl; handle->NOTICE_MESSAGE("%s", s.str().c_str()); #endif // VERBOSE_EXCEPTIONS handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } Geometry * GEOSUnionCascaded_r(GEOSContextHandle_t extHandle, const Geometry *g1) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { const geos::geom::MultiPolygon *p = dynamic_cast<const geos::geom::MultiPolygon *>(g1); if ( ! p ) { handle->ERROR_MESSAGE("Invalid argument (must be a MultiPolygon)"); return NULL; } using geos::operation::geounion::<API key>; return <API key>::Union(p); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } Geometry * <API key>(GEOSContextHandle_t extHandle, const Geometry *g1) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { Geometry *ret = g1->getInteriorPoint(); if ( ! ret ) { const GeometryFactory* gf = handle->geomFactory; // return an empty point return gf->createPoint(); } return ret; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } // memory management functions void GEOSGeom_destroy_r(GEOSContextHandle_t extHandle, Geometry *a) { <API key> *handle = 0; // FIXME: mloskot: Does this try-catch around delete means that // destructors in GEOS may throw? If it does, this is a serious // violation of "never throw an exception from a destructor" principle try { delete a; } catch (const std::exception &e) { if ( 0 == extHandle ) { return; } handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return; } handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { if ( 0 == extHandle ) { return; } handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return; } handle->ERROR_MESSAGE("Unknown exception thrown"); } } void GEOSSetSRID_r(GEOSContextHandle_t extHandle, Geometry *g, int srid) { assert(0 != g); if ( 0 == extHandle ) { return; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return; } g->setSRID(srid); } int <API key>(GEOSContextHandle_t extHandle, const Geometry *g) { assert(0 != g); if ( 0 == extHandle ) { return -1; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return -1; } try { return static_cast<int>(g->getNumPoints()); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return -1; } /* * Return -1 on exception, 0 otherwise. * Converts Geometry to normal form (or canonical form). */ int GEOSNormalize_r(GEOSContextHandle_t extHandle, Geometry *g) { assert(0 != g); if ( 0 == extHandle ) { return -1; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return -1; } try { g->normalize(); return 0; // SUCCESS } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return -1; } int <API key>(GEOSContextHandle_t extHandle, const Geometry *g1) { if ( 0 == extHandle ) { return -1; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return -1; } try { const Polygon *p = dynamic_cast<const Polygon *>(g1); if ( ! p ) { handle->ERROR_MESSAGE("Argument is not a Polygon"); return -1; } return static_cast<int>(p->getNumInteriorRing()); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return -1; } // returns -1 on error and 1 for non-multi geometries int <API key>(GEOSContextHandle_t extHandle, const Geometry *g1) { if ( 0 == extHandle ) { return -1; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return -1; } try { return static_cast<int>(g1->getNumGeometries()); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return -1; } /* * Call only on GEOMETRYCOLLECTION or MULTI*. * Return a pointer to the internal Geometry. */ const Geometry * GEOSGetGeometryN_r(GEOSContextHandle_t extHandle, const Geometry *g1, int n) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { return g1->getGeometryN(n); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } /* * Call only on LINESTRING * Returns NULL on exception */ Geometry * GEOSGeomGetPointN_r(GEOSContextHandle_t extHandle, const Geometry *g1, int n) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { using geos::geom::LineString; const LineString *ls = dynamic_cast<const LineString *>(g1); if ( ! ls ) { handle->ERROR_MESSAGE("Argument is not a LineString"); return NULL; } return ls->getPointN(n); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } /* * Call only on LINESTRING */ Geometry * <API key>(GEOSContextHandle_t extHandle, const Geometry *g1) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { using geos::geom::LineString; const LineString *ls = dynamic_cast<const LineString *>(g1); if ( ! ls ) { handle->ERROR_MESSAGE("Argument is not a LineString"); return NULL; } return ls->getStartPoint(); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } /* * Call only on LINESTRING */ Geometry * <API key>(GEOSContextHandle_t extHandle, const Geometry *g1) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { using geos::geom::LineString; const LineString *ls = dynamic_cast<const LineString *>(g1); if ( ! ls ) { handle->ERROR_MESSAGE("Argument is not a LineString"); return NULL; } return ls->getEndPoint(); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } /* * Call only on LINESTRING * return 2 on exception, 1 on true, 0 on false */ char GEOSisClosed_r(GEOSContextHandle_t extHandle, const Geometry *g1) { if ( 0 == extHandle ) { return 2; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 2; } try { using geos::geom::LineString; const LineString *ls = dynamic_cast<const LineString *>(g1); if ( ! ls ) { handle->ERROR_MESSAGE("Argument is not a LineString"); return 2; } return ls->isClosed(); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 2; } /* * Call only on LINESTRING * return 0 on exception, otherwise 1 */ int GEOSGeomGetLength_r(GEOSContextHandle_t extHandle, const Geometry *g1, double *length) { if ( 0 == extHandle ) { return 0; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 0; } try { using geos::geom::LineString; const LineString *ls = dynamic_cast<const LineString *>(g1); if ( ! ls ) { handle->ERROR_MESSAGE("Argument is not a LineString"); return 0; } *length = ls->getLength(); return 1; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 0; } /* * Call only on LINESTRING */ int <API key>(GEOSContextHandle_t extHandle, const Geometry *g1) { if ( 0 == extHandle ) { return -1; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return -1; } try { using geos::geom::LineString; const LineString *ls = dynamic_cast<const LineString *>(g1); if ( ! ls ) { handle->ERROR_MESSAGE("Argument is not a LineString"); return -1; } return static_cast<int>(ls->getNumPoints()); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return -1; } /* * For POINT * returns 0 on exception, otherwise 1 */ int GEOSGeomGetX_r(GEOSContextHandle_t extHandle, const Geometry *g1, double *x) { if ( 0 == extHandle ) { return 0; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 0; } try { using geos::geom::Point; const Point *po = dynamic_cast<const Point *>(g1); if ( ! po ) { handle->ERROR_MESSAGE("Argument is not a Point"); return 0; } *x = po->getX(); return 1; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 0; } /* * For POINT * returns 0 on exception, otherwise 1 */ int GEOSGeomGetY_r(GEOSContextHandle_t extHandle, const Geometry *g1, double *y) { if ( 0 == extHandle ) { return 0; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 0; } try { using geos::geom::Point; const Point *po = dynamic_cast<const Point *>(g1); if ( ! po ) { handle->ERROR_MESSAGE("Argument is not a Point"); return 0; } *y = po->getY(); return 1; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 0; } /* * Call only on polygon * Return a copy of the internal Geometry. */ const Geometry * <API key>(GEOSContextHandle_t extHandle, const Geometry *g1) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { const Polygon *p = dynamic_cast<const Polygon *>(g1); if ( ! p ) { handle->ERROR_MESSAGE("Invalid argument (must be a Polygon)"); return NULL; } return p->getExteriorRing(); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } /* * Call only on polygon * Return a pointer to internal storage, do not destroy it. */ const Geometry * <API key>(GEOSContextHandle_t extHandle, const Geometry *g1, int n) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { const Polygon *p = dynamic_cast<const Polygon *>(g1); if ( ! p ) { handle->ERROR_MESSAGE("Invalid argument (must be a Polygon)"); return NULL; } return p->getInteriorRingN(n); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } Geometry * GEOSGetCentroid_r(GEOSContextHandle_t extHandle, const Geometry *g) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { Geometry *ret = g->getCentroid(); if (0 == ret) { const GeometryFactory *gf = handle->geomFactory; return gf->createPoint(); } return ret; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } Geometry * <API key>(GEOSContextHandle_t extHandle, int type) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } #ifdef GEOS_DEBUG char buf[256]; sprintf(buf, "createCollection: requested type %d, ngeoms: %d", type, ngeoms); handle->NOTICE_MESSAGE("%s", buf);// TODO: Can handle->NOTICE_MESSAGE format that directly? #endif try { const GeometryFactory* gf = handle->geomFactory; Geometry *g = 0; switch (type) { case <API key>: g = gf-><API key>(); break; case GEOS_MULTIPOINT: g = gf->createMultiPoint(); break; case <API key>: g = gf-><API key>(); break; case GEOS_MULTIPOLYGON: g = gf->createMultiPolygon(); break; default: handle->ERROR_MESSAGE("Unsupported type request for <API key>"); g = 0; } return g; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 0; } Geometry * <API key>(GEOSContextHandle_t extHandle, int type, Geometry **geoms, unsigned int ngeoms) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } #ifdef GEOS_DEBUG char buf[256]; sprintf(buf, "<API key>: requested type %d, ngeoms: %d", type, ngeoms); handle->NOTICE_MESSAGE("%s", buf);// TODO: Can handle->NOTICE_MESSAGE format that directly? #endif try { const GeometryFactory* gf = handle->geomFactory; std::vector<Geometry*>* vgeoms = new std::vector<Geometry*>(geoms, geoms + ngeoms); Geometry *g = 0; switch (type) { case <API key>: g = gf-><API key>(vgeoms); break; case GEOS_MULTIPOINT: g = gf->createMultiPoint(vgeoms); break; case <API key>: g = gf-><API key>(vgeoms); break; case GEOS_MULTIPOLYGON: g = gf->createMultiPolygon(vgeoms); break; default: handle->ERROR_MESSAGE("Unsupported type request for <API key>"); g = 0; } return g; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 0; } Geometry * GEOSPolygonize_r(GEOSContextHandle_t extHandle, const Geometry * const * g, unsigned int ngeoms) { if ( 0 == extHandle ) { return 0; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 0; } Geometry *out = 0; try { // Polygonize using geos::operation::polygonize::Polygonizer; Polygonizer plgnzr; for (std::size_t i = 0; i < ngeoms; ++i) { plgnzr.add(g[i]); } #if GEOS_DEBUG handle->NOTICE_MESSAGE("geometry vector added to polygonizer"); #endif std::vector<Polygon*> *polys = plgnzr.getPolygons(); assert(0 != polys); #if GEOS_DEBUG handle->NOTICE_MESSAGE("output polygons got"); #endif // We need a vector of Geometry pointers, not Polygon pointers. // STL vector doesn't allow transparent upcast of this // nature, so we explicitly convert. // (it's just a waste of processor and memory, btw) // XXX mloskot: Why not to extent GeometryFactory to accept // vector of polygons or extend Polygonizer to return list of Geometry* // or add a wrapper which semantic is similar to: // std::vector<as_polygon<Geometry*> > std::vector<Geometry*> *polyvec = new std::vector<Geometry *>(polys->size()); for (std::size_t i = 0; i < polys->size(); ++i) { (*polyvec)[i] = (*polys)[i]; } delete polys; polys = 0; const GeometryFactory *gf = handle->geomFactory; // The below takes ownership of the passed vector, // so we must *not* delete it out = gf-><API key>(polyvec); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return out; } Geometry * <API key>(GEOSContextHandle_t extHandle, const Geometry * const * g, unsigned int ngeoms) { if ( 0 == extHandle ) { return 0; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 0; } Geometry *out = 0; try { // Polygonize using geos::operation::polygonize::Polygonizer; Polygonizer plgnzr; for (std::size_t i = 0; i < ngeoms; ++i) { plgnzr.add(g[i]); } #if GEOS_DEBUG handle->NOTICE_MESSAGE("geometry vector added to polygonizer"); #endif const std::vector<const LineString *>& lines = plgnzr.getCutEdges(); #if GEOS_DEBUG handle->NOTICE_MESSAGE("output polygons got"); #endif // We need a vector of Geometry pointers, not Polygon pointers. // STL vector doesn't allow transparent upcast of this // nature, so we explicitly convert. // (it's just a waste of processor and memory, btw) // XXX mloskot: See comment for GEOSPolygonize_r std::vector<Geometry*> *linevec = new std::vector<Geometry *>(lines.size()); for (std::size_t i = 0, n=lines.size(); i < n; ++i) { (*linevec)[i] = lines[i]->clone(); } const GeometryFactory *gf = handle->geomFactory; // The below takes ownership of the passed vector, // so we must *not* delete it out = gf-><API key>(linevec); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return out; } Geometry * <API key>(GEOSContextHandle_t extHandle, const Geometry* g, Geometry** cuts, Geometry** dangles, Geometry** invalid) { if ( 0 == extHandle ) { return 0; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 0; } try { // Polygonize using geos::operation::polygonize::Polygonizer; Polygonizer plgnzr; for (std::size_t i = 0; i <g->getNumGeometries(); ++i) { plgnzr.add(g->getGeometryN(i)); } #if GEOS_DEBUG handle->NOTICE_MESSAGE("geometry vector added to polygonizer"); #endif const GeometryFactory *gf = handle->geomFactory; if ( cuts ) { const std::vector<const LineString *>& lines = plgnzr.getCutEdges(); std::vector<Geometry*> *linevec = new std::vector<Geometry *>(lines.size()); for (std::size_t i = 0, n=lines.size(); i < n; ++i) { (*linevec)[i] = lines[i]->clone(); } // The below takes ownership of the passed vector, // so we must *not* delete it *cuts = gf-><API key>(linevec); } if ( dangles ) { const std::vector<const LineString *>& lines = plgnzr.getDangles(); std::vector<Geometry*> *linevec = new std::vector<Geometry *>(lines.size()); for (std::size_t i = 0, n=lines.size(); i < n; ++i) { (*linevec)[i] = lines[i]->clone(); } // The below takes ownership of the passed vector, // so we must *not* delete it *dangles = gf-><API key>(linevec); } if ( invalid ) { const std::vector<LineString *>& lines = plgnzr.getInvalidRingLines(); std::vector<Geometry*> *linevec = new std::vector<Geometry *>(lines.size()); for (std::size_t i = 0, n=lines.size(); i < n; ++i) { (*linevec)[i] = lines[i]->clone(); } // The below takes ownership of the passed vector, // so we must *not* delete it *invalid = gf-><API key>(linevec); } std::vector<Polygon*> *polys = plgnzr.getPolygons(); std::vector<Geometry*> *polyvec = new std::vector<Geometry *>(polys->size()); for (std::size_t i = 0; i < polys->size(); ++i) { (*polyvec)[i] = (*polys)[i]; } delete polys; return gf-><API key>(polyvec); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); return 0; } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); return 0; } } Geometry * GEOSLineMerge_r(GEOSContextHandle_t extHandle, const Geometry *g) { if ( 0 == extHandle ) { return 0; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 0; } Geometry *out = 0; try { using geos::operation::linemerge::LineMerger; LineMerger lmrgr; lmrgr.add(g); std::vector<LineString *>* lines = lmrgr.<API key>(); assert(0 != lines); #if GEOS_DEBUG handle->NOTICE_MESSAGE("output lines got"); #endif std::vector<Geometry *>*geoms = new std::vector<Geometry *>(lines->size()); for (std::vector<Geometry *>::size_type i = 0; i < lines->size(); ++i) { (*geoms)[i] = (*lines)[i]; } delete lines; lines = 0; const GeometryFactory *gf = handle->geomFactory; out = gf->buildGeometry(geoms); // XXX: old version //out = gf-><API key>(geoms); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return out; } int GEOSGetSRID_r(GEOSContextHandle_t extHandle, const Geometry *g) { assert(0 != g); if ( 0 == extHandle ) { return 0; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 0; } try { return g->getSRID(); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 0; } const char* GEOSversion() { static char version[256]; sprintf(version, "%s r%d", GEOS_CAPI_VERSION, GEOS_SVN_REVISION); return version; } const char* GEOSjtsport() { return GEOS_JTS_PORT; } char GEOSHasZ_r(GEOSContextHandle_t extHandle, const Geometry *g) { assert(0 != g); if ( 0 == extHandle ) { return -1; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return -1; } if (g->isEmpty()) { return false; } assert(0 != g->getCoordinate()); double az = g->getCoordinate()->z; //handle->ERROR_MESSAGE("ZCoord: %g", az); return static_cast<char>(FINITE(az)); } int <API key>(GEOSContextHandle_t extHandle) { if ( 0 == extHandle ) { return -1; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return -1; } return handle->WKBOutputDims; } int <API key>(GEOSContextHandle_t extHandle, int newdims) { if ( 0 == extHandle ) { return -1; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return -1; } if ( newdims < 2 || newdims > 3 ) { handle->ERROR_MESSAGE("WKB output dimensions out of range 2..3"); } const int olddims = handle->WKBOutputDims; handle->WKBOutputDims = newdims; return olddims; } int <API key>(GEOSContextHandle_t extHandle) { if ( 0 == extHandle ) { return -1; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return -1; } return handle->WKBByteOrder; } int <API key>(GEOSContextHandle_t extHandle, int byteOrder) { if ( 0 == extHandle ) { return -1; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return -1; } const int oldByteOrder = handle->WKBByteOrder; handle->WKBByteOrder = byteOrder; return oldByteOrder; } CoordinateSequence * <API key>(GEOSContextHandle_t extHandle, unsigned int size, unsigned int dims) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { const GeometryFactory *gf = handle->geomFactory; return gf-><API key>()->create(size, dims); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } int <API key>(GEOSContextHandle_t extHandle, CoordinateSequence *cs, unsigned int idx, unsigned int dim, double val) { assert(0 != cs); if ( 0 == extHandle ) { return 0; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 0; } try { cs->setOrdinate(idx, dim, val); return 1; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 0; } int GEOSCoordSeq_setX_r(GEOSContextHandle_t extHandle, CoordinateSequence *s, unsigned int idx, double val) { return <API key>(extHandle, s, idx, 0, val); } int GEOSCoordSeq_setY_r(GEOSContextHandle_t extHandle, CoordinateSequence *s, unsigned int idx, double val) { return <API key>(extHandle, s, idx, 1, val); } int GEOSCoordSeq_setZ_r(GEOSContextHandle_t extHandle, CoordinateSequence *s, unsigned int idx, double val) { return <API key>(extHandle, s, idx, 2, val); } CoordinateSequence * <API key>(GEOSContextHandle_t extHandle, const CoordinateSequence *cs) { assert(0 != cs); if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { return cs->clone(); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } int <API key>(GEOSContextHandle_t extHandle, const CoordinateSequence *cs, unsigned int idx, unsigned int dim, double *val) { assert(0 != cs); assert(0 != val); if ( 0 == extHandle ) { return 0; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 0; } try { double d = cs->getOrdinate(idx, dim); *val = d; return 1; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 0; } int GEOSCoordSeq_getX_r(GEOSContextHandle_t extHandle, const CoordinateSequence *s, unsigned int idx, double *val) { return <API key>(extHandle, s, idx, 0, val); } int GEOSCoordSeq_getY_r(GEOSContextHandle_t extHandle, const CoordinateSequence *s, unsigned int idx, double *val) { return <API key>(extHandle, s, idx, 1, val); } int GEOSCoordSeq_getZ_r(GEOSContextHandle_t extHandle, const CoordinateSequence *s, unsigned int idx, double *val) { return <API key>(extHandle, s, idx, 2, val); } int <API key>(GEOSContextHandle_t extHandle, const CoordinateSequence *cs, unsigned int *size) { assert(0 != cs); assert(0 != size); if ( 0 == extHandle ) { return 0; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 0; } try { const std::size_t sz = cs->getSize(); *size = static_cast<unsigned int>(sz); return 1; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 0; } int <API key>(GEOSContextHandle_t extHandle, const CoordinateSequence *cs, unsigned int *dims) { assert(0 != cs); assert(0 != dims); if ( 0 == extHandle ) { return 0; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 0; } try { const std::size_t dim = cs->getDimension(); *dims = static_cast<unsigned int>(dim); return 1; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 0; } void <API key>(GEOSContextHandle_t extHandle, CoordinateSequence *s) { <API key> *handle = 0; try { delete s; } catch (const std::exception &e) { if ( 0 == extHandle ) { return; } handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return; } handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { if ( 0 == extHandle ) { return; } handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return; } handle->ERROR_MESSAGE("Unknown exception thrown"); } } const CoordinateSequence * <API key>(GEOSContextHandle_t extHandle, const Geometry *g) { if ( 0 == extHandle ) { return 0; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 0; } try { using geos::geom::Point; const LineString *ls = dynamic_cast<const LineString *>(g); if ( ls ) { return ls->getCoordinatesRO(); } const Point *p = dynamic_cast<const Point *>(g); if ( p ) { return p->getCoordinatesRO(); } handle->ERROR_MESSAGE("Geometry must be a Point or LineString"); return 0; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 0; } Geometry * <API key>(GEOSContextHandle_t extHandle) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { const GeometryFactory *gf = handle->geomFactory; return gf->createPoint(); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } Geometry * <API key>(GEOSContextHandle_t extHandle, CoordinateSequence *cs) { if ( 0 == extHandle ) { return 0; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 0; } try { const GeometryFactory *gf = handle->geomFactory; return gf->createPoint(cs); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 0; } Geometry * <API key>(GEOSContextHandle_t extHandle, CoordinateSequence *cs) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { const GeometryFactory *gf = handle->geomFactory; return gf->createLinearRing(cs); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } Geometry * <API key>(GEOSContextHandle_t extHandle) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { const GeometryFactory *gf = handle->geomFactory; return gf->createLineString(); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } Geometry * <API key>(GEOSContextHandle_t extHandle, CoordinateSequence *cs) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { const GeometryFactory *gf = handle->geomFactory; return gf->createLineString(cs); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } Geometry * <API key>(GEOSContextHandle_t extHandle) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { const GeometryFactory *gf = handle->geomFactory; return gf->createPolygon(); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } Geometry * <API key>(GEOSContextHandle_t extHandle, Geometry *shell, Geometry **holes, unsigned int nholes) { // FIXME: holes must be non-nullptr or may be nullptr? //assert(0 != holes); if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { using geos::geom::LinearRing; std::vector<Geometry *> *vholes = new std::vector<Geometry *>(holes, holes + nholes); LinearRing *nshell = dynamic_cast<LinearRing *>(shell); if ( ! nshell ) { handle->ERROR_MESSAGE("Shell is not a LinearRing"); return NULL; } const GeometryFactory *gf = handle->geomFactory; return gf->createPolygon(nshell, vholes); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } Geometry * GEOSGeom_clone_r(GEOSContextHandle_t extHandle, const Geometry *g) { assert(0 != g); if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { return g->clone(); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } int <API key>(GEOSContextHandle_t extHandle, const Geometry *g) { if ( 0 == extHandle ) { return 0; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 0; } try { return (int) g->getDimension(); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 0; } int <API key>(GEOSContextHandle_t extHandle, const Geometry *g) { if ( 0 == extHandle ) { return 0; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 0; } try { return g-><API key>(); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 0; } Geometry * GEOSSimplify_r(GEOSContextHandle_t extHandle, const Geometry *g1, double tolerance) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { using namespace geos::simplify; Geometry::AutoPtr g(<API key>::simplify(g1, tolerance)); return g.release(); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } Geometry * <API key>(GEOSContextHandle_t extHandle, const Geometry *g1, double tolerance) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { using namespace geos::simplify; Geometry::AutoPtr g(<API key>::simplify(g1, tolerance)); return g.release(); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } /* WKT Reader */ WKTReader * <API key>(GEOSContextHandle_t extHandle) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { using geos::io::WKTReader; return new WKTReader((GeometryFactory*)handle->geomFactory); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } void <API key>(GEOSContextHandle_t extHandle, WKTReader *reader) { <API key> *handle = 0; try { delete reader; } catch (const std::exception &e) { if ( 0 == extHandle ) { return; } handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return; } handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { if ( 0 == extHandle ) { return; } handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return; } handle->ERROR_MESSAGE("Unknown exception thrown"); } } Geometry* <API key>(GEOSContextHandle_t extHandle, WKTReader *reader, const char *wkt) { assert(0 != reader); if ( 0 == extHandle ) { return 0; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 0; } try { const std::string wktstring(wkt); Geometry *g = reader->read(wktstring); return g; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 0; } /* WKT Writer */ WKTWriter * <API key>(GEOSContextHandle_t extHandle) { if ( 0 == extHandle ) { return 0; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 0; } try { using geos::io::WKTWriter; return new WKTWriter(); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 0; } void <API key>(GEOSContextHandle_t extHandle, WKTWriter *Writer) { <API key> *handle = 0; try { delete Writer; } catch (const std::exception &e) { if ( 0 == extHandle ) { return; } handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return; } handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { if ( 0 == extHandle ) { return; } handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return; } handle->ERROR_MESSAGE("Unknown exception thrown"); } } char* <API key>(GEOSContextHandle_t extHandle, WKTWriter *writer, const Geometry *geom) { assert(0 != writer); if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { std::string sgeom(writer->write(geom)); char *result = gstrdup(sgeom); return result; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } void <API key>(GEOSContextHandle_t extHandle, WKTWriter *writer, char trim) { assert(0 != writer); if ( 0 == extHandle ) { return; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return; } writer->setTrim(0 != trim); } void <API key>(GEOSContextHandle_t extHandle, WKTWriter *writer, int precision) { assert(0 != writer); if ( 0 == extHandle ) { return; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return; } writer-><API key>(precision); } void <API key>(GEOSContextHandle_t extHandle, WKTWriter *writer, int dim) { assert(0 != writer); if ( 0 == extHandle ) { return; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return; } try { writer->setOutputDimension(dim); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } } int <API key>(GEOSContextHandle_t extHandle, WKTWriter *writer) { assert(0 != writer); if ( 0 == extHandle ) { return -1; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return -1; } int dim = -1; try { dim = writer->getOutputDimension(); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return dim; } void <API key>(GEOSContextHandle_t extHandle, WKTWriter *writer, int useOld3D) { assert(0 != writer); if ( 0 == extHandle ) { return; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return; } writer->setOld3D(0 != useOld3D); } /* WKB Reader */ WKBReader * <API key>(GEOSContextHandle_t extHandle) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } using geos::io::WKBReader; try { return new WKBReader(*(GeometryFactory*)handle->geomFactory); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } void <API key>(GEOSContextHandle_t extHandle, WKBReader *reader) { <API key> *handle = 0; try { delete reader; } catch (const std::exception &e) { if ( 0 == extHandle ) { return; } handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return; } handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { if ( 0 == extHandle ) { return; } handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return; } handle->ERROR_MESSAGE("Unknown exception thrown"); } } struct membuf : public std::streambuf { membuf(char* s, std::size_t n) { setg(s, s, s + n); } }; Geometry* <API key>(GEOSContextHandle_t extHandle, WKBReader *reader, const unsigned char *wkb, size_t size) { assert(0 != reader); assert(0 != wkb); if ( 0 == extHandle ) { return 0; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 0; } try { //std::string wkbstring(reinterpret_cast<const char*>(wkb), size); // make it binary ! //std::istringstream is(std::ios_base::binary); //is.str(wkbstring); //is.seekg(0, std::ios::beg); // rewind reader pointer membuf mb((char*)wkb, size); istream is(&mb); Geometry *g = reader->read(is); return g; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 0; } Geometry* <API key>(GEOSContextHandle_t extHandle, WKBReader *reader, const unsigned char *hex, size_t size) { assert(0 != reader); assert(0 != hex); if ( 0 == extHandle ) { return 0; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 0; } try { std::string hexstring(reinterpret_cast<const char*>(hex), size); std::istringstream is(std::ios_base::binary); is.str(hexstring); is.seekg(0, std::ios::beg); // rewind reader pointer Geometry *g = reader->readHEX(is); return g; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 0; } /* WKB Writer */ WKBWriter * <API key>(GEOSContextHandle_t extHandle) { if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { using geos::io::WKBWriter; return new WKBWriter(); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } void <API key>(GEOSContextHandle_t extHandle, WKBWriter *Writer) { <API key> *handle = 0; try { delete Writer; } catch (const std::exception &e) { if ( 0 == extHandle ) { return; } handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return; } handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { if ( 0 == extHandle ) { return; } handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return; } handle->ERROR_MESSAGE("Unknown exception thrown"); } } /* The caller owns the result */ unsigned char* <API key>(GEOSContextHandle_t extHandle, WKBWriter *writer, const Geometry *geom, size_t *size) { assert(0 != writer); assert(0 != geom); assert(0 != size); if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { std::ostringstream os(std::ios_base::binary); writer->write(*geom, os); const std::string& wkbstring = os.str(); const std::size_t len = wkbstring.length(); unsigned char *result = NULL; result = (unsigned char*) malloc(len); std::memcpy(result, wkbstring.c_str(), len); *size = len; return result; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } /* The caller owns the result */ unsigned char* <API key>(GEOSContextHandle_t extHandle, WKBWriter *writer, const Geometry *geom, size_t *size) { assert(0 != writer); assert(0 != geom); assert(0 != size); if ( 0 == extHandle ) { return NULL; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return NULL; } try { std::ostringstream os(std::ios_base::binary); writer->writeHEX(*geom, os); std::string wkbstring(os.str()); const std::size_t len = wkbstring.length(); unsigned char *result = NULL; result = (unsigned char*) malloc(len); std::memcpy(result, wkbstring.c_str(), len); *size = len; return result; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } int <API key>(GEOSContextHandle_t extHandle, const GEOSWKBWriter* writer) { assert(0 != writer); if ( 0 == extHandle ) { return 0; } int ret = 0; <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 != handle->initialized ) { try { ret = writer->getOutputDimension(); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } } return ret; } void <API key>(GEOSContextHandle_t extHandle, GEOSWKBWriter* writer, int newDimension) { assert(0 != writer); if ( 0 == extHandle ) { return; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 != handle->initialized ) { try { writer->setOutputDimension(newDimension); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } } } int <API key>(GEOSContextHandle_t extHandle, const GEOSWKBWriter* writer) { assert(0 != writer); if ( 0 == extHandle ) { return 0; } int ret = 0; <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 != handle->initialized ) { try { ret = writer->getByteOrder(); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } } return ret; } void <API key>(GEOSContextHandle_t extHandle, GEOSWKBWriter* writer, int newByteOrder) { assert(0 != writer); if ( 0 == extHandle ) { return; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 != handle->initialized ) { try { writer->setByteOrder(newByteOrder); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } } } char <API key>(GEOSContextHandle_t extHandle, const GEOSWKBWriter* writer) { assert(0 != writer); if ( 0 == extHandle ) { return -1; } int ret = -1; <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 != handle->initialized ) { try { int srid = writer->getIncludeSRID(); ret = srid; } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } } return static_cast<char>(ret); } void <API key>(GEOSContextHandle_t extHandle, GEOSWKBWriter* writer, const char newIncludeSRID) { assert(0 != writer); if ( 0 == extHandle ) { return; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 != handle->initialized ) { try { writer->setIncludeSRID(newIncludeSRID); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } } } // Prepared Geometry const geos::geom::prep::PreparedGeometry* GEOSPrepare_r(GEOSContextHandle_t extHandle, const Geometry *g) { if ( 0 == extHandle ) { return 0; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 0; } const geos::geom::prep::PreparedGeometry* prep = 0; try { prep = geos::geom::prep::<API key>::prepare(g); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return prep; } void <API key>(GEOSContextHandle_t extHandle, const geos::geom::prep::PreparedGeometry *a) { <API key> *handle = 0; try { delete a; } catch (const std::exception &e) { if ( 0 == extHandle ) { return; } handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return; } handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { if ( 0 == extHandle ) { return; } handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return; } handle->ERROR_MESSAGE("Unknown exception thrown"); } } char <API key>(GEOSContextHandle_t extHandle, const geos::geom::prep::PreparedGeometry *pg, const Geometry *g) { assert(0 != pg); assert(0 != g); if ( 0 == extHandle ) { return 2; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 2; } try { bool result = pg->contains(g); return result; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 2; } char <API key>(GEOSContextHandle_t extHandle, const geos::geom::prep::PreparedGeometry *pg, const Geometry *g) { assert(0 != pg); assert(0 != g); if ( 0 == extHandle ) { return 2; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 2; } try { bool result = pg->containsProperly(g); return result; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 2; } char <API key>(GEOSContextHandle_t extHandle, const geos::geom::prep::PreparedGeometry *pg, const Geometry *g) { assert(0 != pg); assert(0 != g); if ( 0 == extHandle ) { return 2; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 2; } try { bool result = pg->coveredBy(g); return result; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 2; } char <API key>(GEOSContextHandle_t extHandle, const geos::geom::prep::PreparedGeometry *pg, const Geometry *g) { assert(0 != pg); assert(0 != g); if ( 0 == extHandle ) { return 2; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 2; } try { bool result = pg->covers(g); return result; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 2; } char <API key>(GEOSContextHandle_t extHandle, const geos::geom::prep::PreparedGeometry *pg, const Geometry *g) { assert(0 != pg); assert(0 != g); if ( 0 == extHandle ) { return 2; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 2; } try { bool result = pg->crosses(g); return result; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 2; } char <API key>(GEOSContextHandle_t extHandle, const geos::geom::prep::PreparedGeometry *pg, const Geometry *g) { assert(0 != pg); assert(0 != g); if ( 0 == extHandle ) { return 2; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 2; } try { bool result = pg->disjoint(g); return result; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 2; } char <API key>(GEOSContextHandle_t extHandle, const geos::geom::prep::PreparedGeometry *pg, const Geometry *g) { assert(0 != pg); assert(0 != g); if ( 0 == extHandle ) { return 2; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 2; } try { bool result = pg->intersects(g); return result; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 2; } char <API key>(GEOSContextHandle_t extHandle, const geos::geom::prep::PreparedGeometry *pg, const Geometry *g) { assert(0 != pg); assert(0 != g); if ( 0 == extHandle ) { return 2; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 2; } try { bool result = pg->overlaps(g); return result; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 2; } char <API key>(GEOSContextHandle_t extHandle, const geos::geom::prep::PreparedGeometry *pg, const Geometry *g) { assert(0 != pg); assert(0 != g); if ( 0 == extHandle ) { return 2; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 2; } try { bool result = pg->touches(g); return result; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 2; } char <API key>(GEOSContextHandle_t extHandle, const geos::geom::prep::PreparedGeometry *pg, const Geometry *g) { assert(0 != pg); assert(0 != g); if ( 0 == extHandle ) { return 2; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 2; } try { bool result = pg->within(g); return result; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 2; } // STRtree geos::index::strtree::STRtree * <API key>(GEOSContextHandle_t extHandle, size_t nodeCapacity) { if ( 0 == extHandle ) { return 0; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 0; } geos::index::strtree::STRtree *tree = 0; try { tree = new geos::index::strtree::STRtree(nodeCapacity); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return tree; } void <API key>(GEOSContextHandle_t extHandle, geos::index::strtree::STRtree *tree, const geos::geom::Geometry *g, void *item) { <API key> *handle = 0; assert(tree != 0); assert(g != 0); try { tree->insert(g->getEnvelopeInternal(), item); } catch (const std::exception &e) { if ( 0 == extHandle ) { return; } handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return; } handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { if ( 0 == extHandle ) { return; } handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return; } handle->ERROR_MESSAGE("Unknown exception thrown"); } } void GEOSSTRtree_query_r(GEOSContextHandle_t extHandle, geos::index::strtree::STRtree *tree, const geos::geom::Geometry *g, GEOSQueryCallback callback, void *userdata) { <API key> *handle = 0; assert(tree != 0); assert(g != 0); assert(callback != 0); try { CAPI_ItemVisitor visitor(callback, userdata); tree->query(g->getEnvelopeInternal(), visitor); } catch (const std::exception &e) { if ( 0 == extHandle ) { return; } handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return; } handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { if ( 0 == extHandle ) { return; } handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return; } handle->ERROR_MESSAGE("Unknown exception thrown"); } } void <API key>(GEOSContextHandle_t extHandle, geos::index::strtree::STRtree *tree, GEOSQueryCallback callback, void *userdata) { <API key> *handle = 0; assert(tree != 0); assert(callback != 0); try { CAPI_ItemVisitor visitor(callback, userdata); tree->iterate(visitor); } catch (const std::exception &e) { if ( 0 == extHandle ) { return; } handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return; } handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { if ( 0 == extHandle ) { return; } handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return; } handle->ERROR_MESSAGE("Unknown exception thrown"); } } char <API key>(GEOSContextHandle_t extHandle, geos::index::strtree::STRtree *tree, const geos::geom::Geometry *g, void *item) { assert(0 != tree); assert(0 != g); if ( 0 == extHandle ) { return 2; } <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 2; } try { bool result = tree->remove(g->getEnvelopeInternal(), item); return result; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 2; } void <API key>(GEOSContextHandle_t extHandle, geos::index::strtree::STRtree *tree) { <API key> *handle = 0; try { delete tree; } catch (const std::exception &e) { if ( 0 == extHandle ) { return; } handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return; } handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { if ( 0 == extHandle ) { return; } handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return; } handle->ERROR_MESSAGE("Unknown exception thrown"); } } double GEOSProject_r(GEOSContextHandle_t extHandle, const Geometry *g, const Geometry *p) { if ( 0 == extHandle ) return -1.0; <API key> *handle = reinterpret_cast<<API key>*>(extHandle); if ( handle->initialized == 0 ) return -1.0; const geos::geom::Point* point = dynamic_cast<const geos::geom::Point*>(p); if (!point) { handle->ERROR_MESSAGE("third argument of GEOSProject_r must be Point*"); return -1.0; } const geos::geom::Coordinate* inputPt = p->getCoordinate(); try { return geos::linearref::LengthIndexedLine(g).project(*inputPt); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); return -1.0; } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); return -1.0; } } Geometry* GEOSInterpolate_r(GEOSContextHandle_t extHandle, const Geometry *g, double d) { if ( 0 == extHandle ) return 0; <API key> *handle = reinterpret_cast<<API key>*>(extHandle); if ( handle->initialized == 0 ) return 0; try { geos::linearref::LengthIndexedLine lil(g); geos::geom::Coordinate coord = lil.extractPoint(d); const GeometryFactory *gf = handle->geomFactory; Geometry* point = gf->createPoint(coord); return point; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); return 0; } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); return 0; } } double <API key>(GEOSContextHandle_t extHandle, const Geometry *g, const Geometry *p) { double length; GEOSLength_r(extHandle, g, &length); return GEOSProject_r(extHandle, g, p) / length; } Geometry* <API key>(GEOSContextHandle_t extHandle, const Geometry *g, double d) { double length; GEOSLength_r(extHandle, g, &length); return GEOSInterpolate_r(extHandle, g, d * length); } GEOSGeometry* <API key>(GEOSContextHandle_t extHandle, const GEOSGeometry* g) { if ( 0 == extHandle ) return 0; <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( handle->initialized == 0 ) return 0; using namespace geos::geom; using namespace geos::util; try { /* 1: extract points */ std::vector<const Coordinate*> coords; <API key> filter(coords); g->apply_ro(&filter); /* 2: for each point, create a geometry and put into a vector */ std::vector<Geometry*>* points = new std::vector<Geometry*>(); points->reserve(coords.size()); const GeometryFactory* factory = g->getFactory(); for (std::vector<const Coordinate*>::iterator it=coords.begin(), itE=coords.end(); it != itE; ++it) { Geometry* point = factory->createPoint(*(*it)); points->push_back(point); } /* 3: create a multipoint */ return factory->createMultiPoint(points); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); return 0; } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); return 0; } } int <API key>(GEOSContextHandle_t extHandle, double Ax, double Ay, double Bx, double By, double Px, double Py) { <API key> *handle = 0; using geos::geom::Coordinate; using geos::algorithm::CGAlgorithms; if ( 0 == extHandle ) { return 2; } handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) { return 2; } try { Coordinate A(Ax, Ay); Coordinate B(Bx, By); Coordinate P(Px, Py); return CGAlgorithms::orientationIndex(A, B, P); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); return 2; } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); return 2; } } GEOSGeometry * GEOSSharedPaths_r(GEOSContextHandle_t extHandle, const GEOSGeometry* g1, const GEOSGeometry* g2) { using namespace geos::operation::sharedpaths; if ( 0 == extHandle ) return 0; <API key> *handle = reinterpret_cast<<API key>*>(extHandle); if ( handle->initialized == 0 ) return 0; SharedPathsOp::PathList forw, back; try { SharedPathsOp::sharedPathsOp(*g1, *g2, forw, back); } catch (const std::exception &e) { SharedPathsOp::clearEdges(forw); SharedPathsOp::clearEdges(back); handle->ERROR_MESSAGE("%s", e.what()); return 0; } catch (...) { SharedPathsOp::clearEdges(forw); SharedPathsOp::clearEdges(back); handle->ERROR_MESSAGE("Unknown exception thrown"); return 0; } // Now forw and back have the geoms we want to use to construct // our output GeometryCollections... const GeometryFactory* factory = g1->getFactory(); size_t count; std::auto_ptr< std::vector<Geometry*> > out1( new std::vector<Geometry*>() ); count = forw.size(); out1->reserve(count); for (size_t i=0; i<count; ++i) { out1->push_back(forw[i]); } std::auto_ptr<Geometry> out1g ( factory-><API key>(out1.release()) ); std::auto_ptr< std::vector<Geometry*> > out2( new std::vector<Geometry*>() ); count = back.size(); out2->reserve(count); for (size_t i=0; i<count; ++i) { out2->push_back(back[i]); } std::auto_ptr<Geometry> out2g ( factory-><API key>(out2.release()) ); std::auto_ptr< std::vector<Geometry*> > out( new std::vector<Geometry*>() ); out->reserve(2); out->push_back(out1g.release()); out->push_back(out2g.release()); std::auto_ptr<Geometry> outg ( factory-><API key>(out.release()) ); return outg.release(); } GEOSGeometry * GEOSSnap_r(GEOSContextHandle_t extHandle, const GEOSGeometry* g1, const GEOSGeometry* g2, double tolerance) { using namespace geos::operation::overlay::snap; if ( 0 == extHandle ) return 0; <API key> *handle = reinterpret_cast<<API key>*>(extHandle); if ( handle->initialized == 0 ) return 0; try{ GeometrySnapper snapper( *g1 ); std::auto_ptr<Geometry> ret = snapper.snapTo(*g2, tolerance); return ret.release(); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); return 0; } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); return 0; } } BufferParameters * <API key>(GEOSContextHandle_t extHandle) { if ( 0 == extHandle ) return NULL; <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) return NULL; try { BufferParameters *p = new BufferParameters(); return p; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 0; } void <API key>(GEOSContextHandle_t extHandle, BufferParameters* p) { (void)extHandle; delete p; } int <API key>(GEOSContextHandle_t extHandle, GEOSBufferParams* p, int style) { if ( 0 == extHandle ) return 0; <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) return 0; try { if ( style > BufferParameters::CAP_SQUARE ) { throw <API key>("Invalid buffer endCap style"); } p->setEndCapStyle(static_cast<BufferParameters::EndCapStyle>(style)); return 1; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 0; } int <API key>(GEOSContextHandle_t extHandle, GEOSBufferParams* p, int style) { if ( 0 == extHandle ) return 0; <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) return 0; try { if ( style > BufferParameters::JOIN_BEVEL ) { throw <API key>("Invalid buffer join style"); } p->setJoinStyle(static_cast<BufferParameters::JoinStyle>(style)); return 1; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 0; } int <API key>(GEOSContextHandle_t extHandle, GEOSBufferParams* p, double limit) { if ( 0 == extHandle ) return 0; <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) return 0; try { p->setMitreLimit(limit); return 1; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 0; } int <API key>(GEOSContextHandle_t extHandle, GEOSBufferParams* p, int segs) { if ( 0 == extHandle ) return 0; <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) return 0; try { p->setQuadrantSegments(segs); return 1; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 0; } int <API key>(GEOSContextHandle_t extHandle, GEOSBufferParams* p, int ss) { if ( 0 == extHandle ) return 0; <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) return 0; try { p->setSingleSided( (ss != 0) ); return 1; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return 0; } Geometry * <API key>(GEOSContextHandle_t extHandle, const Geometry *g1, const BufferParameters* bp, double width) { using geos::operation::buffer::BufferOp; if ( 0 == extHandle ) return NULL; <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) return NULL; try { BufferOp op(g1, *bp); Geometry *g3 = op.getResultGeometry(width); return g3; } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } Geometry * <API key>(GEOSContextHandle_t extHandle, const Geometry *g1, double tolerance, int onlyEdges) { if ( 0 == extHandle ) return NULL; <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) return NULL; using geos::triangulate::<API key>; try { <API key> builder; builder.setTolerance(tolerance); builder.setSites(*g1); if ( onlyEdges ) return builder.getEdges( *g1->getFactory() ).release(); else return builder.getTriangles( *g1->getFactory() ).release(); } catch (const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch (...) { handle->ERROR_MESSAGE("Unknown exception thrown"); } return NULL; } Geometry* <API key>(GEOSContextHandle_t extHandle, const Geometry *g1,double tolerance ,int onlyEdges) { if ( 0 == extHandle ) return NULL; <API key> *handle = 0; handle = reinterpret_cast<<API key>*>(extHandle); if ( 0 == handle->initialized ) return NULL; using geos::triangulate::<API key>; try { <API key> builder; builder.setSites(*g1); builder.setTolerance(tolerance); if(onlyEdges) return builder.getSubdivision()->getEdges(*g1->getFactory()).release(); else return builder.getDiagram(*(g1->getFactory())).release(); } catch(const std::exception &e) { handle->ERROR_MESSAGE("%s", e.what()); } catch(...) { handle->ERROR_MESSAGE("Unknow exception thrown"); } return NULL; } } /* extern "C" */
#include "frpcerror.h" namespace FRPC { Error_t::~Error_t() throw () {} } ;
#ifndef _SYSCALL_H #define _SYSCALL_H 1 #include <stdint.h> #if ((defined LINUX_I386) || (defined LINUX_AMD64)) #if defined LINUX_AMD64 #include "linux-amd64/syscalls.h" #elif defined LINUX_I386 #include "linux-i386/syscalls.h" #endif void *ehnlc_syscall0(size_t number); void *ehnlc_syscall1(size_t number, void *arg1); void *ehnlc_syscall2(size_t number, void *arg1, void *arg2); void *ehnlc_syscall3(size_t number, void *arg1, void *arg2, void *arg3); void *ehnlc_syscall4(size_t number, void *arg1, void *arg2, void *arg3, void *arg4); void *ehnlc_syscall5(size_t number, void *arg1, void *arg2, void *arg3, void *arg4, void *arg5); void *ehnlc_syscall6(size_t number, void *arg1, void *arg2, void *arg3, void *arg4, void *arg5, void *arg6); void *ehnlc_syscall7(size_t number, void *arg1, void *arg2, void *arg3, void *arg4, void *arg5, void *arg6, void *arg7); void ehnlc_crash(const char *msg, size_t len); #endif /* if ((defined LINUX_I386) || (defined LINUX_AMD64)) */ #endif /* _SYSCALL_H */
#ifndef _corpus_h_included_ #define _corpus_h_included_ #include <stdio.h> struct corpus; #define ELM_NONE 0 #define ELM_BOS 0x10000000 #define ELM_WORD_BORDER 0x20000000 #define ELM_INVALID 0x40000000 /* hash28bit */ #define CORPUS_KEY_MASK 0x0fffffff struct corpus *corpus_new(void); void corpus_push_back(struct corpus *c, int *val, int nr, int flags); void corpus_build(struct corpus *c); void corpus_dump(struct corpus *c); void corpus_write_bucket(FILE *fp, struct corpus *c); void corpus_write_array(FILE *fp, struct corpus *c); #endif
// Math.NET Numerics, part of the Math.NET Project // 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, // copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following // conditions: // included in all copies or substantial portions of the Software. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // 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. namespace MathNet.Numerics.UnitTests.DistributionTests.Continuous { using System; using System.Linq; using Distributions; using NUnit.Framework; <summary> Stable distribution tests. </summary> [TestFixture] public class StableTests { <summary> Set-up parameters. </summary> [SetUp] public void SetUp() { Control.<API key> = true; } <summary> Can create stable. </summary> <param name="alpha">Alpha value.</param> <param name="beta">Beta value.</param> <param name="scale">Scale value.</param> <param name="location">Location value.</param> [Test, Combinatorial] public void CanCreateStable([Values(0.1, 2.0)] double alpha, [Values(-1.0, 1.0)] double beta, [Values(0.1, Double.PositiveInfinity)] double scale, [Values(Double.NegativeInfinity, -1.0, 0.0, 1.0, Double.PositiveInfinity)] double location) { var n = new Stable(alpha, beta, scale, location); Assert.AreEqual(alpha, n.Alpha); Assert.AreEqual(beta, n.Beta); Assert.AreEqual(scale, n.Scale); Assert.AreEqual(location, n.Location); } <summary> Stable create fails with bad parameters. </summary> <param name="alpha">Alpha value.</param> <param name="beta">Beta value.</param> <param name="location">Location value.</param> <param name="scale">Scale value.</param> [Test, Sequential] public void <API key>( [Values(Double.NaN, 1.0, Double.NaN, Double.NaN, Double.NaN, 1.0, 1.0, 1.0, Double.NaN, 1.0, 1.0, 1.0, Double.NaN, 1.0, 1.0, 1.0, 0.0, 2.1)] double alpha, [Values(Double.NaN, Double.NaN, 1.0, Double.NaN, Double.NaN, 1.0, Double.NaN, Double.NaN, 1.0, 1.0, 1.0, Double.NaN, 1.0, 1.0, -1.1, 1.1, 1.0, 1.0)] double beta, [Values(Double.NaN, Double.NaN, Double.NaN, 1.0, Double.NaN, Double.NaN, 1.0, Double.NaN, 1.0, 1.0, Double.NaN, 1.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0)] double location, [Values(Double.NaN, Double.NaN, Double.NaN, Double.NaN, 1.0, Double.NaN, Double.NaN, 1.0, Double.NaN, Double.NaN, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)] double scale) { Assert.Throws<<API key>>(() => new Stable(alpha, beta, location, scale)); } <summary> Validate ToString. </summary> [Test] public void ValidateToString() { var n = new Stable(1.2, 0.3, 1.0, 2.0); Assert.AreEqual(String.Format("Stable(Stability = {0}, Skewness = {1}, Scale = {2}, Location = {3})", n.Alpha, n.Beta, n.Scale, n.Location), n.ToString()); } <summary> Can set alpha. </summary> <param name="alpha">Alpha value.</param> [Test] public void CanSetAlpha([Values(0.1, 1.0, 2.0)] double alpha) { new Stable(1.0, 1.0, 1.0, 1.0) { Alpha = alpha }; } <summary> Set alpha fails with bad values. </summary> <param name="alpha">Alpha value.</param> [Test] public void SetAlphaFail([Values(Double.NaN, -0.0, 0.0, 2.1, Double.NegativeInfinity, Double.PositiveInfinity)] double alpha) { var n = new Stable(1.0, 1.0, 1.0, 1.0); Assert.Throws<<API key>>(() => n.Alpha = alpha); } <summary> Can set beta. </summary> <param name="beta">Beta value.</param> [Test] public void CanSetBeta([Values(-1.0, -0.1, -0.0, 0.0, 0.1, 1.0)] double beta) { new Stable(1.0, 1.0, 1.0, 1.0) { Beta = beta }; } <summary> Set beta fails with bad values. </summary> <param name="beta">Beta value.</param> [Test] public void SetBetaFail([Values(Double.NaN, -1.1, 1.1, Double.NegativeInfinity, Double.PositiveInfinity)] double beta) { var n = new Stable(1.0, 1.0, 1.0, 1.0); Assert.Throws<<API key>>(() => n.Beta = beta); } <summary> Can set scale. </summary> <param name="scale">Scale value.</param> [Test] public void CanSetScale([Values(0.1, 1.0, 10.0, Double.PositiveInfinity)] double scale) { new Stable(1.0, 1.0, 1.0, 1.0) { Scale = scale }; } <summary> Set scale fails with bad values. </summary> <param name="scale">Scale value.</param> [Test] public void SetScaleFail([Values(Double.NaN, 0.0)] double scale) { var n = new Stable(1.0, 1.0, 1.0, 1.0); Assert.Throws<<API key>>(() => n.Scale = scale); } <summary> Can set location. </summary> <param name="location">Location value.</param> [Test] public void CanSetLocation([Values(Double.NegativeInfinity, -10.0, -1.0, -0.1, 0.1, 1.0, 10.0, Double.PositiveInfinity)] double location) { new Stable(1.0, 1.0, 1.0, 1.0) { Location = location }; } <summary> Set location fails with bad values. </summary> [Test] public void SetLocationFail() { var n = new Stable(1.0, 1.0, 1.0, 1.0); Assert.Throws<<API key>>(() => n.Location = Double.NaN); } <summary> Validate entropy throws <c><API key></c>. </summary> [Test] public void <API key>() { var n = new Stable(1.0, 1.0, 1.0, 1.0); Assert.Throws<<API key>>(() => { var e = n.Entropy; }); } <summary> Validate skewness. </summary> [Test] public void ValidateSkewness() { var n = new Stable(2.0, 1.0, 1.0, 1.0); if (n.Alpha == 2) { Assert.AreEqual(0.0, n.Skewness); } } <summary> Validate mode. </summary> <param name="location">Location value.</param> [Test] public void ValidateMode([Values(Double.NegativeInfinity, -10.0, -1.0, -0.1, 0.1, 1.0, 10.0, Double.PositiveInfinity)] double location) { var n = new Stable(1.0, 0.0, 1.0, location); if (n.Beta == 0) { Assert.AreEqual(location, n.Mode); } } <summary> Validate mean. </summary> <param name="location">Location value.</param> [Test] public void ValidateMedian([Values(Double.NegativeInfinity, -10.0, -1.0, -0.1, 0.1, 1.0, 10.0, Double.PositiveInfinity)] double location) { var n = new Stable(1.0, 0.0, 1.0, location); if (n.Beta == 0) { Assert.AreEqual(location, n.Mode); } } <summary> Validate minimum. </summary> <param name="beta">Beta value.</param> [Test] public void ValidateMinimum([Values(-1.0, -0.1, -0.0, 0.0, 0.1, 1.0)] double beta) { var n = new Stable(1.0, beta, 1.0, 1.0); Assert.AreEqual(Math.Abs(beta) != 1 ? Double.NegativeInfinity : 0.0, n.Minimum); } <summary> Validate maximum. </summary> [Test] public void ValidateMaximum() { var n = new Stable(1.0, 1.0, 1.0, 1.0); Assert.AreEqual(Double.PositiveInfinity, n.Maximum); } <summary> Validate density. </summary> <param name="alpha">Alpha value.</param> <param name="beta">Beta value.</param> <param name="scale">Scale value.</param> <param name="location">Location value.</param> <param name="x">Input X value.</param> <param name="d">Expected value.</param> [Test, Sequential] public void ValidateDensity( [Values(2.0, 2.0, 2.0, 1.0, 1.0, 1.0, 0.5, 0.5, 0.5)] double alpha, [Values(-1.0, -1.0, -1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0)] double beta, [Values(1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)] double scale, [Values(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)] double location, [Values(1.5, 3.0, 5.0, 1.5, 3.0, 5.0, 1.5, 3.0, 5.0)] double x, [Values(0.16073276729880184, 0.029732572305907354, 0.<API key>, 0.097941503441166353, 0.031830988618379068, 0.012242687930145794, 0.15559955475708653, 0.064989885240913717, 0.032286845174307237)] double d) { var n = new Stable(alpha, beta, scale, location); AssertHelpers.AlmostEqual(d, n.Density(x), 15); } <summary> Validate density log. </summary> <param name="alpha">Alpha value.</param> <param name="beta">Beta value.</param> <param name="scale">Scale value.</param> <param name="location">Location value.</param> <param name="x">Input X value.</param> <param name="dln">Expected value.</param> [Test, Sequential] public void ValidateDensityLn( [Values(2.0, 2.0, 2.0, 1.0, 1.0, 1.0, 0.5, 0.5, 0.5)] double alpha, [Values(-1.0, -1.0, -1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0)] double beta, [Values(1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)] double scale, [Values(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)] double location, [Values(1.5, 3.0, 5.0, 1.5, 3.0, 5.0, 1.5, 3.0, 5.0)] double x, [Values(-1.8280121234846454, -3.5155121234846449, -7.5155121234846449, -2.3233848821910463, -3.4473149788434458, -4.4028264238708825, -1.8604695287002526, -2.7335236328735038, -3.4330954018558235)] double dln) { var n = new Stable(alpha, beta, scale, location); AssertHelpers.AlmostEqual(dln, n.DensityLn(x), 15); } <summary> Can sample. </summary> [Test] public void CanSample() { var n = new Stable(1.0, 1.0, 1.0, 1.0); n.Sample(); } <summary> Can sample sequence. </summary> [Test] public void CanSampleSequence() { var n = new Stable(1.0, 1.0, 1.0, 1.0); var ied = n.Samples(); ied.Take(5).ToArray(); } <summary> Validate cumulative distribution. </summary> <param name="alpha">Alpha value.</param> <param name="beta">Beta value.</param> <param name="scale">Scale value.</param> <param name="location">Location value.</param> <param name="x">Input X value.</param> <param name="cdf">Expected value.</param> [Test, Sequential] public void <API key>( [Values(2.0, 2.0, 2.0, 1.0, 1.0, 1.0, 0.5, 0.5, 0.5)] double alpha, [Values(-1.0, -1.0, -1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0)] double beta, [Values(1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)] double scale, [Values(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)] double location, [Values(1.5, 3.0, 5.0, 1.5, 3.0, 5.0, 1.5, 3.0, 5.0)] double x, [Values(0.8555778168267576, 0.98305257323765538, 0.9997965239912775, 0.81283295818900125, 0.89758361765043326, 0.93716704181099886, 0.41421617824252516, 0.563702861650773, 0.65472084601857694)] double cdf) { var n = new Stable(alpha, beta, scale, location); AssertHelpers.AlmostEqual(cdf, n.<API key>(x), 15); } } }
package br.gov.camara.edemocracia.portlets.graficos.service.base; import br.gov.camara.edemocracia.portlets.graficos.service.<API key>; import br.gov.camara.edemocracia.portlets.graficos.service.<API key>; import br.gov.camara.edemocracia.portlets.graficos.service.<API key>; import br.gov.camara.edemocracia.portlets.graficos.service.persistence.<API key>; import com.liferay.counter.service.CounterLocalService; import com.liferay.portal.kernel.bean.BeanReference; import com.liferay.portal.kernel.bean.IdentifiableBean; import com.liferay.portal.kernel.dao.jdbc.SqlUpdate; import com.liferay.portal.kernel.dao.jdbc.<API key>; import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.util.InfrastructureUtil; import com.liferay.portal.service.<API key>; import com.liferay.portal.service.<API key>; import com.liferay.portal.service.ResourceService; import com.liferay.portal.service.UserLocalService; import com.liferay.portal.service.UserService; import com.liferay.portal.service.persistence.ResourcePersistence; import com.liferay.portal.service.persistence.UserPersistence; import javax.sql.DataSource; /** * The base implementation of the graficos local service. * * <p> * This implementation exists only as a container for the default service methods generated by ServiceBuilder. All custom service methods should be put in {@link br.gov.camara.edemocracia.portlets.graficos.service.impl.<API key>}. * </p> * * @author Robson Miranda * @see br.gov.camara.edemocracia.portlets.graficos.service.impl.<API key> * @see br.gov.camara.edemocracia.portlets.graficos.service.<API key> * @generated */ public abstract class <API key> extends <API key> implements <API key>, IdentifiableBean { @BeanReference(type = <API key>.class) protected <API key> <API key>; @BeanReference(type = <API key>.class) protected <API key> <API key>; @BeanReference(type = <API key>.class) protected <API key> <API key>; @BeanReference(type = <API key>.class) protected <API key> <API key>; @BeanReference(type = CounterLocalService.class) protected CounterLocalService counterLocalService; @BeanReference(type = <API key>.class) protected <API key> <API key>; @BeanReference(type = ResourceService.class) protected ResourceService resourceService; @BeanReference(type = ResourcePersistence.class) protected ResourcePersistence resourcePersistence; @BeanReference(type = UserLocalService.class) protected UserLocalService userLocalService; @BeanReference(type = UserService.class) protected UserService userService; @BeanReference(type = UserPersistence.class) protected UserPersistence userPersistence; private String _beanIdentifier; private <API key> _clpInvoker = new <API key>(); /* * NOTE FOR DEVELOPERS: * * Never modify or reference this class directly. Always use {@link br.gov.camara.edemocracia.portlets.graficos.service.<API key>} to access the graficos local service. */ /** * Returns the contador acesso local service. * * @return the contador acesso local service */ public <API key> <API key>() { return <API key>; } /** * Sets the contador acesso local service. * * @param <API key> the contador acesso local service */ public void <API key>( <API key> <API key>) { this.<API key> = <API key>; } /** * Returns the contador acesso persistence. * * @return the contador acesso persistence */ public <API key> <API key>() { return <API key>; } /** * Sets the contador acesso persistence. * * @param <API key> the contador acesso persistence */ public void <API key>( <API key> <API key>) { this.<API key> = <API key>; } /** * Returns the graficos local service. * * @return the graficos local service */ public <API key> <API key>() { return <API key>; } /** * Sets the graficos local service. * * @param <API key> the graficos local service */ public void <API key>( <API key> <API key>) { this.<API key> = <API key>; } /** * Returns the participacao local service. * * @return the participacao local service */ public <API key> <API key>() { return <API key>; } /** * Sets the participacao local service. * * @param <API key> the participacao local service */ public void <API key>( <API key> <API key>) { this.<API key> = <API key>; } /** * Returns the counter local service. * * @return the counter local service */ public CounterLocalService <API key>() { return counterLocalService; } /** * Sets the counter local service. * * @param counterLocalService the counter local service */ public void <API key>(CounterLocalService counterLocalService) { this.counterLocalService = counterLocalService; } /** * Returns the resource local service. * * @return the resource local service */ public <API key> <API key>() { return <API key>; } /** * Sets the resource local service. * * @param <API key> the resource local service */ public void <API key>( <API key> <API key>) { this.<API key> = <API key>; } /** * Returns the resource remote service. * * @return the resource remote service */ public ResourceService getResourceService() { return resourceService; } /** * Sets the resource remote service. * * @param resourceService the resource remote service */ public void setResourceService(ResourceService resourceService) { this.resourceService = resourceService; } /** * Returns the resource persistence. * * @return the resource persistence */ public ResourcePersistence <API key>() { return resourcePersistence; } /** * Sets the resource persistence. * * @param resourcePersistence the resource persistence */ public void <API key>(ResourcePersistence resourcePersistence) { this.resourcePersistence = resourcePersistence; } /** * Returns the user local service. * * @return the user local service */ public UserLocalService getUserLocalService() { return userLocalService; } /** * Sets the user local service. * * @param userLocalService the user local service */ public void setUserLocalService(UserLocalService userLocalService) { this.userLocalService = userLocalService; } /** * Returns the user remote service. * * @return the user remote service */ public UserService getUserService() { return userService; } /** * Sets the user remote service. * * @param userService the user remote service */ public void setUserService(UserService userService) { this.userService = userService; } /** * Returns the user persistence. * * @return the user persistence */ public UserPersistence getUserPersistence() { return userPersistence; } /** * Sets the user persistence. * * @param userPersistence the user persistence */ public void setUserPersistence(UserPersistence userPersistence) { this.userPersistence = userPersistence; } public void afterPropertiesSet() { } public void destroy() { } /** * Returns the Spring bean ID for this bean. * * @return the Spring bean ID for this bean */ public String getBeanIdentifier() { return _beanIdentifier; } /** * Sets the Spring bean ID for this bean. * * @param beanIdentifier the Spring bean ID for this bean */ public void setBeanIdentifier(String beanIdentifier) { _beanIdentifier = beanIdentifier; } public Object invokeMethod(String name, String[] parameterTypes, Object[] arguments) throws Throwable { return _clpInvoker.invokeMethod(name, parameterTypes, arguments); } /** * Performs an SQL query. * * @param sql the sql query */ protected void runSQL(String sql) throws SystemException { try { DataSource dataSource = InfrastructureUtil.getDataSource(); SqlUpdate sqlUpdate = <API key>.getSqlUpdate(dataSource, sql, new int[0]); sqlUpdate.update(); } catch (Exception e) { throw new SystemException(e); } } }
<?php // common.php einbinden require_once "../../../inc/common.php"; require_once SYSTEM_DOC_ROOT . "/inc/checkBackendAccess.inc.php"; require_once(PROJECT_DOC_ROOT . "/inc/classes/Media/class.Files.php"); require_once(PROJECT_DOC_ROOT . "/extLibs/jquery/plupload/PluploadHandler.php"); /** * Klasse Plupload * */ class Plupload extends \Concise\Files { public function upload() { PluploadHandler::no_cache_headers(); PluploadHandler::cors_headers(); if (!PluploadHandler::handle(array( 'target_dir' => self::getTargetDir(), 'allow_extensions' => self::getAllowedFileTypes(), '<API key>' => array('Concise\Files', 'getValidFileName') )) ) { die(json_encode(array( 'OK' => 0, 'error' => array( 'code' => PluploadHandler::get_error_code(), 'message' => PluploadHandler::get_error_message() ) ))); } else { die(json_encode(array( 'OK' => 1, 'originalname' => PluploadHandler::<API key>(), 'truename' => PluploadHandler::get_last_file_name(), 'duplicate' => PluploadHandler::is_duplicate_file(), 'folder' => self::getTargetDir(), 'fileTypes' => self::getAllowedFileTypes() ) )); } } private function getTargetDir() { $path = PROJECT_DOC_ROOT . DIRECTORY_SEPARATOR; // Falls files folder if(!empty($_REQUEST['useFilesFolder']) && isset($_REQUEST['filesFolder']) && $_REQUEST['filesFolder'] != "" && is_dir($path . CC_FILES_FOLDER . DIRECTORY_SEPARATOR . $_REQUEST['filesFolder']) ) return $path . CC_FILES_FOLDER . DIRECTORY_SEPARATOR . $_REQUEST['filesFolder']; // Falls galleries folder if(!empty($_REQUEST['gallName']) && $_REQUEST['gallName'] != "" ) { self::$allowedFileTypes = Concise\Files::$galleryFileExts; return $path . CC_GALLERY_FOLDER . DIRECTORY_SEPARATOR . $_REQUEST['gallName']; } // Falls bekannter Dateityp, Standardordner bestimmen if(isset($_REQUEST['name']) && $_REQUEST['name'] != "" ) { if($defFolder = Concise\Files::getDefaultFolder($_REQUEST['name'])) return $path . $defFolder; } return $path . CC_FILES_FOLDER . DIRECTORY_SEPARATOR . 'unknown'; } private function getAllowedFileTypes() { if(count(self::$allowedFileTypes) == 0) self::$allowedFileTypes = Concise\Files::$allowedFileTypes; return implode(",", self::$allowedFileTypes); } } $o_plupload = new Plupload; $o_plupload->upload();
package labyrinth.derpcoin.base; import net.minecraft.client.resources.model.<API key>; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.DamageSource; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class MagicSword extends ItemSword { private int counter = 0; private double damageLow = 8; private double damageHigh = 50; public MagicSword(ToolMaterial p_i45356_1_) { super(p_i45356_1_); this.setUnlocalizedName("magicSword"); this.setMaxStackSize(1); } @Override public void onCreated(ItemStack par1Item, World par2World, EntityPlayer par3Player) { par1Item.setTagCompound(new NBTTagCompound()); par1Item.getTagCompound().setBoolean("Active", false); } @Override public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3Player) { NBTTagCompound tag = par1ItemStack.getTagCompound(); if(par3Player.isSneaking()) { if(tag != null) { tag.setBoolean("Active", !tag.getBoolean("Active")); } else { tag = new NBTTagCompound(); par1ItemStack.setTagCompound(tag); } } else { par3Player.setItemInUse(par1ItemStack, this.<API key>(par1ItemStack)); } return par1ItemStack; } @Override public void onUpdate(ItemStack par1stack, World par2world, Entity par3entity, int par4slot, boolean isSelected) { counter = counter + 1; if(counter == 20) { counter = 0; if(par3entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) par3entity; if(par1stack.getTagCompound() != null) { if(par1stack.getTagCompound().getBoolean("Active")) { if(DCConsumer.subDerpsack(player.inventory) || player.inventory.<API key>(Main.derpCoin)) { } else { par1stack.getTagCompound().setBoolean("Active", false); } } } else { par1stack.setTagCompound(new NBTTagCompound()); } } } } @Override @SideOnly(Side.CLIENT) public <API key> getModel(ItemStack stack, EntityPlayer player, int useRemaining) { NBTTagCompound tag = stack.getTagCompound(); <API key> out = new <API key>("derpcoin:magicSword", "inventory"); if(tag != null) { if(stack.getTagCompound().getBoolean("Active")) { out = new <API key>("derpcoin:magicSwordA", "inventory"); } } return out; } /*@Override public Multimap <API key>() { Multimap multimap = super.<API key>(); multimap.put(<API key>.attackDamage.<API key>(), new AttributeModifier(itemModifierUUID, "Weapon modifier", (double)this.material.getDamageVsEntity(), 0)); return multimap; }*/ @Override public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase <API key>, EntityLivingBase <API key>) { if (this.getDamage(par1ItemStack) >= 998) return false; float damage = (float) damageLow; if(par1ItemStack.hasTagCompound()) { System.out.println("works"); if(par1ItemStack.getTagCompound().getBoolean("Active")) { System.out.println("works1"); damage = (float) damageHigh; } } DamageSource damagesource = DamageSource.causePlayerDamage((EntityPlayer)<API key>); <API key>.attackEntityFrom(damagesource, damage); par1ItemStack.damageItem(1, <API key>); return true; } }
// Torque Shader Engine function ServerPlay2D(%profile) { // Play the given sound profile on every client. // The sounds will be transmitted as an event, not attached to any object. for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) ClientGroup.getObject(%idx).play2D(%profile); } function ServerPlay3D(%profile,%transform) { // Play the given sound profile at the given position on every client // The sound will be transmitted as an event, not attached to any object. for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) ClientGroup.getObject(%idx).play3D(%profile,%transform); }
#ifndef <API key> #define <API key> #include "musicremotewidget.h" /*! @brief The class of the desktop square remote widget. * @author Greedysky <greedysky@163.com> */ class MUSIC_REMOTE_EXPORT <API key> : public MusicRemoteWidget { Q_OBJECT TTK_DECLARE_MODULE(<API key>) public: /*! * Object contsructor. */ explicit <API key>(QWidget *parent = nullptr); virtual ~<API key>(); public Q_SLOTS: /*! * Mouse enter the geometry time out. */ void enterTimeout(); /*! * Mouse leave the geometry time out. */ void leaveTimeout(); protected: /*! * Override the widget event. */ virtual void enterEvent(QEvent *event) override; virtual void leaveEvent(QEvent *event) override; <API key> *m_effect[4]; QTimer m_enterTimer; QTimer m_leaveTimer; float m_interval; }; #endif // <API key>
#ifndef MPANGESTURE_P_H #define MPANGESTURE_P_H #include <QPanGesture> class MPanRecognizer; /*! This class provides Pan gesture state. It's objects are delivered to registered handlers when a gesture is initiated. */ class MPanGesture : public QPanGesture { Q_OBJECT public: /*! Default constructor. */ MPanGesture(QObject *parent = 0); /*! Default destructor. */ virtual ~MPanGesture(); private: /*! The start position of the pan gesture in scene coordinates. */ QPointF startPos; Qt::Orientations panDirection; bool pressed; friend class MPanRecognizer; friend class <API key>; #ifdef UNIT_TEST friend class Ut_MPanRecognizer; #endif }; #endif
class BannerMessage < ActiveRecord::Base set_table_name "banner_message" has_many :<API key>, :dependent => :destroy belongs_to :slms_banner_message end #Table name: banner_message #| Field | Type | Null | Key | Default | Extra | #| id | int(11) | NO | PRI | NULL | auto_increment | #| message_name | varchar(255) | YES | | NULL | | #| created_at | datetime | NO | | NULL | | #| updated_at | datetime | NO | | NULL | | #| last_posted | datetime | YES | | NULL | | #| start_datetime | datetime | YES | | NULL | | #| end_datetime | datetime | YES | | NULL | | #| message | varchar(5000) | NO | | NULL | | #| post_to_sam_client | tinyint(1) | NO | | NULL | | #| post_to_dashboard | tinyint(1) | NO | | NULL | | #| <API key> | tinyint(1) | NO | | NULL | | #| <API key> | tinyint(1) | NO | | NULL | | #| distribution_scope | varchar(255) | NO | | NULL | | #| server_scope | varchar(255) | YES | | NULL | | #| creator | varchar(255) | YES | | NULL | | #| is_historical | tinyint(1) | NO | | NULL | | #| <API key> | int(10) | NO | | NULL | |
package com.motekew.vse.enums; /** * Defines an interface that returns values given * <code>DX3D</code> indices. * * @author Kurt Motekew * @since 20131116 */ public interface IGetDX3D { /** * @param ndx Index indicating what value should be returned. * * @return Value associated with ndx. */ public double get(DX3D ndx); }
import cockpit from 'cockpit'; import React from 'react'; import { Modal } from 'patternfly-react'; import { show_modal_dialog } from "<API key>.jsx"; import 'form-layout.scss'; const _ = cockpit.gettext; export function Validated({ errors, error_key, children }) { var error = errors && errors[error_key]; // We need to always render the <div> for the has-error // class so that the input field keeps the focus when // errors are cleared. Otherwise the DOM changes enough // for the Browser to remove focus. return ( <div className={error ? "<API key> has-error" : "<API key>"}> { children } { error ? <span className="help-block dialog-error">{error}</span> : null } </div> ); } export function has_errors(errors) { for (const field in errors) { if (errors[field]) return true; } return false; } function show_error_dialog(title, message) { const props = { id: "error-popup", title: title, body: <Modal.Body><p>{message}</p></Modal.Body> }; const footer = { actions: [], cancel_caption: _("Close") }; show_modal_dialog(props, footer); } export function <API key>(error) { show_error_dialog(_("Unexpected error"), error.message || error); }
package org.openswing.swing.table.filter.client; import java.math.*; import java.util.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; import org.openswing.swing.client.*; import org.openswing.swing.domains.java.*; import org.openswing.swing.logger.client.*; import org.openswing.swing.table.columns.client.*; import org.openswing.swing.util.client.*; import org.openswing.swing.table.client.<API key>; import org.openswing.swing.message.receive.java.*; import org.openswing.swing.message.send.java.FilterWhereClause; import javax.swing.text.<API key>; import java.text.*; import javax.swing.event.AncestorListener; import javax.swing.event.AncestorEvent; import com.toedter.calendar.JDateChooser; import com.toedter.calendar.JCalendar; import javax.swing.event.PopupMenuListener; import javax.swing.event.PopupMenuEvent; import java.beans.<API key>; import java.beans.PropertyChangeEvent; public class QuickFilterPanel extends JPanel implements MenuElement, MenuContainer, KeyListener { private JLabel label1 = new JLabel(); private JLabel label2 = new JLabel(); private JComponent value1 = null; private JComponent value2 = null; private JToggleButton rangeButton = null; private JButton filterButton = null; private JPopupMenu parentPopup=null; private Icon filterIcon = null; public static final int FILTER_TYPE_VALUE=0; public static final int FILTER_TYPE_RANGE=1; private String attributeName=null; private int filterType=FILTER_TYPE_VALUE; private Object initValue=null; private Column colProperties=null; private Domain domain=null; private String EQUALS = ClientSettings.getInstance().getResources().getResource("equals"); private String CONTAINS = ClientSettings.getInstance().getResources().getResource("contains"); private String STARTS_WITH = ClientSettings.getInstance().getResources().getResource("starts with"); private String ENDS_WITH = ClientSettings.getInstance().getResources().getResource("ends with"); /** list of filter criteria */ private JList opType = new JList(new String[] { EQUALS, CONTAINS, STARTS_WITH, ENDS_WITH }); private JScrollPane opTypeScrollPane = new JScrollPane(); private QuickFilterListener filterListener=null; /** default value that could be set in the quick filter criteria; values allowed: Consts.EQUALS,Consts.CONTAINS,Consts.STARTS_WITH,Consts.ENDS_WITH */ private int <API key>; /** combo-box filter to apply to column headers (optional) */ private <API key> <API key> = null; /** filtering button icon */ private Icon listIcon = new ImageIcon(ClientUtils.getImage(ClientSettings.LIST_FILTER_BUTTON)); /** list button */ private JButton listButton = null; /** domain to bind to checkbox list control to show when pressing combo button (optional) */ private Domain listControlDomain = null; /** used to show/hide checkbox list control (optional) */ private boolean showListControl = false; /** checkbox list control (optional) */ private CheckBoxListControl checkBoxListControl = new CheckBoxListControl(); /** current applied filter */ private FilterWhereClause[] filter = null; /** * Costructor called by Grid object. * @param <API key> default value that could be set in the quick filter criteria; values allowed: Consts.EQUALS,Consts.CONTAINS,Consts.STARTS_WITH,Consts.ENDS_WITH * @param filterListener listener that manages filter events (the grid) * @param filterType type of filter: FILTER_TYPE_VALUE or FILTER_TYPE_RANGE (for date, number, ...) * @param colProperties column properties * @param initValue initial value to set into the filter */ public QuickFilterPanel( <API key> <API key>, int <API key>, QuickFilterListener filterListener, int filterType, Column colProperties, FilterWhereClause[] filter, Object initValue) { this.<API key> = <API key>; this.filterListener=filterListener; this.filterType=filterType; this.<API key> = <API key>; this.filter = filter; this.<API key>(new ComponentListener() { /** * componentHidden * * @param e ComponentEvent */ public void componentHidden(ComponentEvent e) { new Thread().dumpStack(); } /** * componentMoved * * @param e ComponentEvent */ public void componentMoved(ComponentEvent e) { } /** * componentResized * * @param e ComponentEvent */ public void componentResized(ComponentEvent e) { } /** * componentShown * * @param e ComponentEvent */ public void componentShown(ComponentEvent e) { } }); this.addAncestorListener(new AncestorListener() { /** * ancestorAdded * * @param event AncestorEvent */ public void ancestorAdded(AncestorEvent event) { } /** * ancestorMoved * * @param event AncestorEvent */ public void ancestorMoved(AncestorEvent event) { } /** * ancestorRemoved * * @param event AncestorEvent */ public void ancestorRemoved(AncestorEvent event) { new Thread().dumpStack(); } }); <API key>.getInstance().addKeyListener(this); filterIcon = new ImageIcon(ClientUtils.getImage("filter.gif")); rangeButton= new JToggleButton(new ImageIcon(ClientUtils.getImage("chiuso.gif")),false) { /** * Method available in java 1.5 */ protected void processMouseEvent(MouseEvent e) { if (e.getID()==e.MOUSE_CLICKED) { if (QuickFilterPanel.this.filterType==FILTER_TYPE_VALUE) { QuickFilterPanel.this.filterType=FILTER_TYPE_RANGE; rangeButton.setIcon(new ImageIcon(ClientUtils.getImage("aperto.gif"))); } else { QuickFilterPanel.this.filterType=FILTER_TYPE_VALUE; rangeButton.setIcon(new ImageIcon(ClientUtils.getImage("chiuso.gif"))); } updateComponents(); // update filter panel... if (parentPopup!=null) { parentPopup.setVisible(false); parentPopup.setVisible(true); parentPopup.setSelected(value1); } if (!value1.hasFocus()) value1.requestFocus(); } } }; rangeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (QuickFilterPanel.this.filterType==FILTER_TYPE_VALUE) { QuickFilterPanel.this.filterType=FILTER_TYPE_RANGE; rangeButton.setIcon(new ImageIcon(ClientUtils.getImage("aperto.gif"))); } else { QuickFilterPanel.this.filterType=FILTER_TYPE_VALUE; rangeButton.setIcon(new ImageIcon(ClientUtils.getImage("chiuso.gif"))); } updateComponents(); // update filter panel... if (parentPopup!=null) { parentPopup.setVisible(false); parentPopup.setVisible(true); parentPopup.setSelected(value1); } if (!value1.hasFocus()) value1.requestFocus(); } }); filterButton=new JButton(filterIcon) { /** * Method available in java 1.5 */ protected void processMouseEvent(MouseEvent e) { if (e.getID()==e.MOUSE_CLICKED) filter(); } }; filterButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { filter(); } }); listButton=new JButton(listIcon) { /** * Method available in java 1.5 */ protected void processMouseEvent(MouseEvent e) { if (e.getID()==e.MOUSE_CLICKED) showComboBoxFilter(); } }; listButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { showComboBoxFilter(); } }); setFilterConfig(filterType,colProperties,initValue); if (<API key>!=null && filter!=null && filter[1]==null && filter[0].getValue()!=null && filter[0].getValue() instanceof java.util.List) { java.util.List values = (java.util.List)filter[0].getValue(); showComboBoxFilter(); checkBoxListControl.setValue(values); } } /** * Show list filter for the specified column. */ private void showComboBoxFilter() { if (listControlDomain==null) { if (colProperties.getColumnType()==Column.TYPE_COMBO) { listControlDomain = ((ComboColumn)colProperties).getDomain(); } else { // load data to fill in list domain... Response res = <API key>.<API key>(attributeName); if (res.isError()) { OptionPane.showMessageDialog( ClientUtils.getParentWindow(this), ClientSettings.getInstance().getResources().getResource("Error while loading data")+":\n"+res.getErrorMessage(), ClientSettings.getInstance().getResources().getResource("Loading Data Error"), JOptionPane.ERROR_MESSAGE ); return; } else { java.util.List rows = ((VOListResponse)res).getRows(); listControlDomain = new Domain("DOMAIN_LIST_FILTER_"+attributeName); for(int i=0;i<rows.size();i++) listControlDomain.addDomainPair(rows.get(i),rows.get(i).toString()); } checkBoxListControl.<API key>(false); } checkBoxListControl.setDomain(listControlDomain); } if (!showListControl) { showListControl = true; this.add(checkBoxListControl, new GridBagConstraints(0, 0, 4, 1, 1.0, 1.0 ,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(2, 0, 0, 0), 0, 0)); this.remove(label1); this.remove(label2); this.remove(rangeButton); this.remove(value1); this.remove(value2); this.remove(opTypeScrollPane); if (parentPopup!=null) { parentPopup.setVisible(false); parentPopup.setVisible(true); } } else { showListControl = false; layoutComponents(); if (parentPopup!=null) { parentPopup.setVisible(false); parentPopup.setVisible(true); } if (!value1.hasFocus()) value1.requestFocus(); } } public final void setVisible(boolean v) { super.setVisible(v); if (!v) <API key>.getInstance().removeKeyListener(this); } public void keyPressed(KeyEvent e) { if (e.getKeyCode()==e.VK_ESCAPE) { parentPopup.getParent(); parentPopup.setVisible(false); } } public void keyTyped(KeyEvent e) { } public void keyReleased(KeyEvent e) { } /** * Listener linked to the JList object. */ class <API key> implements AdjustmentListener { JList theList=null; public <API key>(JList theList) { this.theList=theList; } public void <API key>(AdjustmentEvent e) { if (e.getValueIsAdjusting()) return; if (theList.getHeight()>0 && e.getValue()>0) { theList.setSelectedIndex((e.getValue()+20)/20); } else theList.setSelectedIndex(0); } } /** * Create an input control used to set the filter value, according to the column type. */ private JComponent <API key>() { JComponent result=null; if (domain!=null) { Vector couple = null; DomainPair[] pairs = domain.getDomainPairList(); Object[] items = new Object[pairs.length]; int selIndex = -1; for(int i=0;i<items.length;i++) { items[i] = ClientSettings.getInstance().getResources().getResource(pairs[i].getDescription()); if (initValue!=null && pairs[i].getCode().equals(initValue)) selIndex = i; } final JList list=new JList(items); final int selectedIndex = selIndex; SwingUtilities.invokeLater(new Runnable() { public void run() { list.setSelectedIndex(selectedIndex); list.<API key>(selectedIndex); } }); list.setToolTipText(""); list.setVisibleRowCount(1); JScrollPane scrollPane=new JScrollPane(); scrollPane.getViewport().add(list, null); scrollPane.<API key>().<API key>(new <API key>(list)); list.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { if (e.getKeyCode()==e.VK_ENTER) valueKeyPressed(e); } } ); scrollPane.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { if (e.getKeyCode()==e.VK_ENTER) valueKeyPressed(e); } } ); list.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { if (e.getKeyCode()==e.VK_ENTER) valueKeyPressed(e); } }); return scrollPane; } switch (colProperties.getColumnType()) { case Column.TYPE_DATE : case Column.TYPE_DATE_TIME : case Column.TYPE_TIME : { result=new DateControl(); ((DateControl)result).setDateType(colProperties.getColumnType()); final DateControl res = ((DateControl)result); final JDateChooser dc = (JDateChooser)result.getComponents()[0]; dc.getCalendarButton().addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { /* System.out.println("parentPopup.getLocationOnScreen().x="+parentPopup.getLocationOnScreen().x); System.out.println("parentPopup.getLocationOnScreen().y="+parentPopup.getLocationOnScreen().y); System.out.println("dc.getCalendarButton().getX()="+dc.getCalendarButton().getX()); System.out.println("dc.getCalendarButton().getY()="+dc.getCalendarButton().getY()); System.out.println("res.getLocationOnScreen().x="+res.getLocationOnScreen().x); System.out.println("res.getLocationOnScreen().y="+res.getLocationOnScreen().y); */ int x = res.getLocationOnScreen().x; int y = res.getLocationOnScreen().y+res.getHeight(); Calendar calendar = Calendar.getInstance(); Date date = dc.getDate(); if (date != null) { calendar.setTime(date); } dc.getJCalendar().setCalendar(calendar); final JWindow w = new JWindow(parentPopup.<API key>()); w.getContentPane().add(dc.getJCalendar(),BorderLayout.CENTER); w.setLocation(x,y); w.setSize(dc.getJCalendar().getPreferredSize()); parentPopup.<API key>(new PopupMenuListener() { public void <API key>(PopupMenuEvent e) {} public void <API key>(PopupMenuEvent e) { w.setVisible(false); w.dispose(); } public void popupMenuCanceled(PopupMenuEvent e) { w.setVisible(false); w.dispose(); } }); w.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { if (e.getKeyCode()==e.VK_ESCAPE) { w.setVisible(false); w.dispose(); } } }); dc.getJCalendar().getDayChooser().<API key>(new <API key>() { public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("day")) { if (w.isVisible()) { w.setVisible(false); res.setDate(dc.getJCalendar().getCalendar().getTime()); } } else if (evt.getPropertyName().equals("date")) { /* if (evt.getSource() == dateEditor) { firePropertyChange("date", evt.getOldValue(), evt.getNewValue()); } else */ { res.setDate((Date) evt.getNewValue()); } } } }); w.setVisible(true); throw new RuntimeException(); } }); if (initValue!=null) { Date c = (java.util.Date)initValue; ((DateControl)result).setDate(c); } else { Date c = new Date(); ((DateControl)result).setDate(c); } result.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { if (e.getKeyCode()==e.VK_ENTER) valueKeyPressed(e); } } ); } ;break; case Column.TYPE_CHECK : { result=new CheckBoxControl(); if (initValue!=null) { ((CheckBoxControl)result).setValue(initValue); } else { ((CheckBoxControl)result).setValue(Boolean.TRUE); } result.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { if (e.getKeyCode()==e.VK_ENTER || e.getKeyCode()==e.VK_SPACE) valueKeyPressed(e); } } ); } ;break; case Column.TYPE_INT: { NumericControl num = new NumericControl(); num.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { valueKeyPressed(e); } } ); if (colProperties!=null) { // if there exists some column properties, then use it... try { num.setDecimals(0); num.setMaxValue(((IntegerColumn)colProperties).getMaxValue()); num.setMinValue(((IntegerColumn)colProperties).getMinValue()); } catch (ClassCastException ex) { Logger.error(this.getClass().getName(),"QuickFilterPanel","Error while creating input field of type integer",ex); } } num.setText(initValue==null?null:initValue.toString()); result=num; } ;break; case Column.TYPE_DEC : case Column.TYPE_PERC: { NumericControl num = new NumericControl(); num.setPreferredSize(new Dimension(100, 20)); num.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { valueKeyPressed(e); } } ); if (colProperties!=null) { // if there exists some column properties, then use it... try { num.setDecimals(((DecimalColumn)colProperties).getDecimals()); num.setMaxValue(((DecimalColumn)colProperties).getMaxValue()); num.setMinValue(((DecimalColumn)colProperties).getMinValue()); } catch (ClassCastException ex) { Logger.error(this.getClass().getName(),"QuickFilterPanel","Error while creating input field of type decimal",ex); } } num.setText(initValue==null?null:initValue.toString()); result=num; } ;break; case Column.TYPE_PROGRESS_BAR: { NumericControl num = new NumericControl(); num.setPreferredSize(new Dimension(100, 20)); num.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { valueKeyPressed(e); } } ); if (colProperties!=null) { // if there exists some column properties, then use it... try { num.setMaxValue(((ProgressBarColumn)colProperties).getMaxValue()); num.setMinValue(((ProgressBarColumn)colProperties).getMinValue()); } catch (ClassCastException ex) { Logger.error(this.getClass().getName(),"QuickFilterPanel","Error while creating input field of type decimal",ex); } } num.setText(initValue==null?null:initValue.toString()); result=num; } ;break; case Column.TYPE_CURRENCY: { CurrencyControl num = new CurrencyControl(); num.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { valueKeyPressed(e); } } ); if (colProperties!=null) { // if there exists some column properties, then use it... try { num.setDecimals(((CurrencyColumn)colProperties).getDecimals()); num.setMaxValue(((CurrencyColumn)colProperties).getMaxValue()); num.setMinValue(((CurrencyColumn)colProperties).getMinValue()); } catch (ClassCastException ex) { Logger.error(this.getClass().getName(),"QuickFilterPanel","Error while creating input field of type currency",ex); } } num.setText(initValue==null?null:initValue.toString()); result=num; } ;break; case Column.TYPE_TEXT: { TextControl edit = new TextControl(); edit.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { if (e.getKeyCode()==e.VK_ENTER) valueKeyPressed(e); } } ); try { edit.setMaxCharacters(((TextColumn)colProperties).getMaxCharacters()); } catch (ClassCastException ex) { Logger.error(this.getClass().getName(),"<API key>","Column property not supported",ex); } edit.setText(initValue==null?"":initValue.toString()); result=edit; } ;break; case Column.TYPE_LINK: { TextControl edit = new TextControl(); edit.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { if (e.getKeyCode()==e.VK_ENTER) valueKeyPressed(e); } } ); edit.setText(initValue==null?"":initValue.toString()); result=edit; } ;break; case Column.TYPE_FORMATTED_TEXT: { FormattedTextBox edit = new FormattedTextBox( ((FormattedTextColumn)colProperties).getController() ); edit.setFormatterFactory( ((FormattedTextColumn)colProperties).getFormatterFactory() ); edit.setFormatter( ((FormattedTextColumn)colProperties).getFormatter() ); edit.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { if (e.getKeyCode()==e.VK_ENTER) valueKeyPressed(e); } } ); edit.setValue(initValue==null?"":initValue); result=edit; } ;break; case Column.TYPE_LOOKUP: { TextControl edit = new TextControl(); edit.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { if (e.getKeyCode()==e.VK_ENTER) valueKeyPressed(e); } } ); try { edit.setMaxCharacters(((CodLookupColumn)colProperties).getMaxCharacters()); } catch (ClassCastException ex) { Logger.error(this.getClass().getName(),"<API key>","Column property not supported",ex); } edit.setText(initValue==null?"":initValue.toString()); result=edit; } ;break; default: { Logger.error(this.getClass().getName(),"<API key>","Column property not supported",null); } } result.setPreferredSize(new Dimension(120, 20)); result.setMinimumSize(new Dimension(120, 20)); return result; } /** * Add components to the panel. */ private void layoutComponents() { this.removeAll(); this.add(label1, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 2, 0, 0), 0, 0)); this.add(label2, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 2, 0, 0), 0, 0)); opType.setVisibleRowCount(1); opTypeScrollPane.getViewport().removeAll(); opTypeScrollPane.getViewport().add(opType); if (colProperties.getColumnType()==Column.TYPE_LOOKUP || colProperties.getColumnType()==Column.TYPE_TEXT) this.add(opTypeScrollPane, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 0, 0), 0, 0)); this.add(value1, new GridBagConstraints(2, 0, 1, 1, 1.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 0, 0), 0, 0)); this.add(value2, new GridBagConstraints(2, 1, 1, 1, 1.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 0, 0), 0, 0)); this.add(rangeButton, new GridBagConstraints(3, 0, 1, 1, 10.0, 0.0 ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(2, 0, 0, 0), 0, 0)); if (<API key>!=null) { this.add(listButton, new GridBagConstraints(4, 0, 1, 1, 0.0, 0.0 ,GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(2, 0, 0, 0), 0, 0)); } this.add(filterButton, new GridBagConstraints(5, 0, 1, 1, 1.0, 0.0 ,GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(2, 0, 0, 0), 0, 0)); opTypeScrollPane.<API key>().<API key>(new <API key>(opType)); } private void jbInit() throws Exception { label1.setPreferredSize(new Dimension(70, 20)); label1.setMinimumSize(new Dimension(70, 20)); this.setLayout(new GridBagLayout()); label2.setText(ClientSettings.getInstance().getResources().getResource("To value")); value1=<API key>(); value2=<API key>(); rangeButton.setSelectedIcon(new ImageIcon(ClientUtils.getImage("aperto.gif"))); rangeButton.<API key>(false); rangeButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); rangeButton.setPreferredSize(new Dimension(20, 20)); rangeButton.setMaximumSize(new Dimension(20, 20)); rangeButton.setMinimumSize(new Dimension(20, 20)); rangeButton.setBorderPainted(false); rangeButton.setSelected(filterType==FILTER_TYPE_RANGE); filterButton.<API key>(false); filterButton.setPreferredSize(new Dimension(20, 20)); filterButton.setMinimumSize(new Dimension(20, 20)); filterButton.setMaximumSize(new Dimension(20, 20)); filterButton.setBorderPainted(false); filterButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); listButton.<API key>(false); listButton.setPreferredSize(new Dimension(20, 20)); listButton.setMinimumSize(new Dimension(20, 20)); listButton.setMaximumSize(new Dimension(20, 20)); listButton.setBorderPainted(false); listButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); layoutComponents(); updateComponents(); if (!value1.hasFocus()) value1.requestFocus(); } /** * Update filter icons. */ private void updateComponents() { switch (filterType) { case FILTER_TYPE_VALUE: label1.setText(ClientSettings.getInstance().getResources().getResource("Filter by")); label2.setVisible(false); value2.setVisible(false); ;break; case FILTER_TYPE_RANGE: label1.setText(ClientSettings.getInstance().getResources().getResource("From value")); label2.setVisible(true); value2.setVisible(true); ;break; } } public JPopupMenu getParentPopup() { return parentPopup; } public void setParentPopup(JPopupMenu parentPopup) { this.parentPopup = parentPopup; } /** * Set the content of the filter panel, according to the filter type, column type and the initial value. */ private void setFilterConfig(int filterType,Column colProperties,Object initValue) { this.attributeName=colProperties.getColumnName(); this.filterType = filterType; this.initValue = initValue; this.colProperties = colProperties; if (colProperties.getColumnType()==Column.TYPE_COMBO) { if (((ComboColumn)colProperties).getDomainId()!=null) domain = ClientSettings.getInstance().getDomain(((ComboColumn)colProperties).getDomainId()); else domain = ((ComboColumn)colProperties).getDomain(); } else domain=null; try { jbInit(); SwingUtilities.invokeLater(new Runnable() { public void run() { opType.<API key>(<API key>); opType.setSelectedIndex(<API key>); } }); } catch (Exception ex) { ex.printStackTrace(); } } /** * @return filter type; possible values: FILTER_TYPE_VALUE or FILTER_TYPE_RANGE (for date, number, ...) */ public final int getFilterType() { return filterType; } /** * Dispatch focus to the input field. */ public final void requestFocus() { SwingUtilities.invokeLater(new Runnable() { public void run() { if (!value1.hasFocus()) { // patch introduced to allow focus setting on the input control when popup menu is a child of a JFrame (no MDI frame)... java.awt.Component window = value1; while (window!=null && !(window instanceof Window)) { window = window.getParent(); } if (window != null || !((Window)window).isFocusableWindow()) { ((Window)window).<API key>(true); } value1.requestFocus(); } } }); } /** * @param value input field * @return value of the input field */ private Object getValue(JComponent value) { if (showListControl) { return checkBoxListControl.getValue(); } Object result=null; if (domain!=null) { int idx= ((JList)((JScrollPane)value).getViewport().getComponent(0)).getSelectedIndex(); DomainPair[] pairs = domain.getDomainPairList(); return pairs[idx].getCode(); } switch (colProperties.getColumnType()) { case Column.TYPE_DATE : case Column.TYPE_DATE_TIME : case Column.TYPE_TIME : { if (((DateControl)value).getDate()==null) result = null; else if (colProperties.getColumnType()==Column.TYPE_DATE) result=new java.sql.Date(((DateControl)value).getDate().getTime()); else result=new java.sql.Timestamp(((DateControl)value).getDate().getTime()); } ;break; case Column.TYPE_CHECK: { result = ((CheckBoxControl)value).getValue(); if (result==null || result instanceof Boolean && !((Boolean)result).booleanValue()) result = ((CheckBoxColumn)colProperties).getNegativeValue(); else result = ((CheckBoxColumn)colProperties).getPositiveValue(); } ;break; case Column.TYPE_INT: { result = (BigDecimal) ((NumericControl)value).getValue(); } ;break; case Column.TYPE_DEC : case Column.TYPE_PERC: { result = (BigDecimal) ((NumericControl)value).getValue(); } ;break; case Column.TYPE_PROGRESS_BAR: { result = (BigDecimal) ((NumericControl)value).getValue(); } ;break; case Column.TYPE_CURRENCY: { result = (BigDecimal) ((CurrencyControl)value).getValue(); } ;break; case Column.TYPE_TEXT: case Column.TYPE_LINK: case Column.TYPE_LOOKUP: { result=((TextControl)value).getText(); } ;break; case Column.TYPE_FORMATTED_TEXT: { try { ( (JFormattedTextField) value).commitEdit(); result = ( (JFormattedTextField) value).getValue(); } catch (ParseException ex) { result = null; } } ;break; default: result=null; } return result; } public Object getValue1() { return getValue(value1); } public Object getValue2() { if (showListControl) { return null; } Object result=getValue(value2); if (result instanceof Date) { Calendar c=GregorianCalendar.getInstance(); c.setTime((Date)result); // c.set(c.HOUR,23); // c.set(c.MINUTE,59); // c.set(c.SECOND,59); // c.set(c.MILLISECOND,999); c.set(c.DAY_OF_MONTH,c.get(c.DAY_OF_MONTH)+1); c.set(c.HOUR,0); c.set(c.MINUTE,0); c.set(c.SECOND,0); c.set(c.MILLISECOND,0); if (colProperties.getColumnType()==Column.TYPE_DATE) result=new java.sql.Date(c.getTime().getTime()); else result=new java.sql.Timestamp(c.getTime().getTime()); } return result; } private void valueKeyPressed(KeyEvent e) { if (e.getKeyCode()==e.VK_ENTER) { filter(); if (parentPopup!=null) { parentPopup.setVisible(false); } } } /** * Method called when user click the filter buttons. */ private void filter() { int type = colProperties.getColumnType(); if (filterType==FILTER_TYPE_VALUE) { Object value = getValue1(); if (value!=null && value.toString().indexOf("%")==-1 && opType.getSelectedIndex()>0 && domain==null && !(type==Column.TYPE_DATE || type==Column.TYPE_DATE_TIME || type==Column.TYPE_TIME || type==Column.TYPE_INT || type==Column.TYPE_DEC || type==Column.TYPE_PERC || type==Column.TYPE_CURRENCY) ) { if (opType.getSelectedValue().equals(CONTAINS)) value = "%"+value+"%"; else if (opType.getSelectedValue().equals(STARTS_WITH)) value = value+"%"; else if (opType.getSelectedValue().equals(ENDS_WITH)) value = "%"+value; } QuickFilterPanel.this.filterListener.filter(colProperties,value,null); } else QuickFilterPanel.this.filterListener.filter(colProperties,getValue1(),getValue2()); } public void processMouseEvent(MouseEvent event, MenuElement[] path, <API key> manager) { return; } public void processKeyEvent(KeyEvent event, MenuElement[] path, <API key> manager) { return; } public void <API key>(boolean isIncluded) { if (!isIncluded) transferFocus(); else requestFocus(); } public MenuElement[] getSubElements() { return null; } public Component getComponent() { return this; } class FormattedTextBox extends JFormattedTextField implements FormatterController{ /** formatter controller */ private FormatterController controller; public FormattedTextBox(FormatterController controller) { this.controller = controller; } // public FormattedTextBox() { // super(); // try { // setFormatter(new javax.swing.text.MaskFormatter(" // catch (ParseException ex) { public void processKeyEvent(KeyEvent e) { try { super.processKeyEvent(e); } catch (Exception ex) { } } /** * Invoked when the user inputs an invalid value. */ public void invalidEdit() { try { if (controller == null) { super.invalidEdit(); } else { controller.invalidEdit(); } } catch (Exception ex) { } } /** * Sets the current AbstractFormatter. * @param format formatter to set */ public void setFormatter(JFormattedTextField.AbstractFormatter format) { try { if (controller == null) { if (getFormatterFactory()==null) super.setFormatterFactory(new <API key>(format)); else super.setFormatter(format); } else { controller.setFormatter(format); } } catch (Exception ex) { } } } }
package net.opengis.wps10.impl; import net.opengis.wps10.CRSsType; import net.opengis.wps10.DefaultType; import net.opengis.wps10.SupportedCRSsType; import net.opengis.wps10.Wps10Package; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.impl.EObjectImpl; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Supported CR Ss Type</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link net.opengis.wps10.impl.<API key>#getDefault <em>Default</em>}</li> * <li>{@link net.opengis.wps10.impl.<API key>#getSupported <em>Supported</em>}</li> * </ul> * * @generated */ public class <API key> extends EObjectImpl implements SupportedCRSsType { /** * The cached value of the '{@link #getDefault() <em>Default</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getDefault() * @generated * @ordered */ protected DefaultType default_; /** * The cached value of the '{@link #getSupported() <em>Supported</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getSupported() * @generated * @ordered */ protected CRSsType supported; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected <API key>() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return Wps10Package.Literals.<API key>; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public DefaultType getDefault() { return default_; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetDefault(DefaultType newDefault, NotificationChain msgs) { DefaultType oldDefault = default_; default_ = newDefault; if (<API key>()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, Wps10Package.<API key>, oldDefault, newDefault); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void setDefault(DefaultType newDefault) { if (newDefault != default_) { NotificationChain msgs = null; if (default_ != null) msgs = ((InternalEObject)default_).eInverseRemove(this, <API key> - Wps10Package.<API key>, null, msgs); if (newDefault != null) msgs = ((InternalEObject)newDefault).eInverseAdd(this, <API key> - Wps10Package.<API key>, null, msgs); msgs = basicSetDefault(newDefault, msgs); if (msgs != null) msgs.dispatch(); } else if (<API key>()) eNotify(new ENotificationImpl(this, Notification.SET, Wps10Package.<API key>, newDefault, newDefault)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public CRSsType getSupported() { return supported; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetSupported(CRSsType newSupported, NotificationChain msgs) { CRSsType oldSupported = supported; supported = newSupported; if (<API key>()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, Wps10Package.<API key>, oldSupported, newSupported); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void setSupported(CRSsType newSupported) { if (newSupported != supported) { NotificationChain msgs = null; if (supported != null) msgs = ((InternalEObject)supported).eInverseRemove(this, <API key> - Wps10Package.<API key>, null, msgs); if (newSupported != null) msgs = ((InternalEObject)newSupported).eInverseAdd(this, <API key> - Wps10Package.<API key>, null, msgs); msgs = basicSetSupported(newSupported, msgs); if (msgs != null) msgs.dispatch(); } else if (<API key>()) eNotify(new ENotificationImpl(this, Notification.SET, Wps10Package.<API key>, newSupported, newSupported)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case Wps10Package.<API key>: return basicSetDefault(null, msgs); case Wps10Package.<API key>: return basicSetSupported(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case Wps10Package.<API key>: return getDefault(); case Wps10Package.<API key>: return getSupported(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case Wps10Package.<API key>: setDefault((DefaultType)newValue); return; case Wps10Package.<API key>: setSupported((CRSsType)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case Wps10Package.<API key>: setDefault((DefaultType)null); return; case Wps10Package.<API key>: setSupported((CRSsType)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case Wps10Package.<API key>: return default_ != null; case Wps10Package.<API key>: return supported != null; } return super.eIsSet(featureID); } } //<API key>
// <API key>.h,v 4.1 2005/01/23 01:30:31 mbrudka Exp // Definition for Win32 Export directives. // This file is generated automatically by <API key>.pl -s ACE_TkReactor #ifndef <API key> #define <API key> #include "ace/config-all.h" #if defined (ACE_AS_STATIC_LIBS) && !defined (<API key>) # define <API key> 0 #endif /* ACE_AS_STATIC_LIBS && <API key> */ #if !defined (<API key>) # define <API key> 1 #endif /* ! <API key> */ #if defined (<API key>) && (<API key> == 1) # if defined (<API key>) # define <API key> <API key> # define <API key>(T) <API key> (T) # define <API key>(SINGLETON_TYPE, CLASS, LOCK) <API key>(SINGLETON_TYPE, CLASS, LOCK) # else /* <API key> */ # define <API key> <API key> # define <API key>(T) <API key> (T) # define <API key>(SINGLETON_TYPE, CLASS, LOCK) <API key>(SINGLETON_TYPE, CLASS, LOCK) # endif /* <API key> */ #else /* <API key> == 1 */ # define <API key> # define <API key>(T) # define <API key>(SINGLETON_TYPE, CLASS, LOCK) #endif /* <API key> == 1 */ // Set <API key> = 0 to turn on library specific tracing even if // tracing is turned off for ACE. #if !defined (<API key>) # if (ACE_NTRACE == 1) # define <API key> 1 # else /* (ACE_NTRACE == 1) */ # define <API key> 0 # endif /* (ACE_NTRACE == 1) */ #endif /* !<API key> */ #if (<API key> == 1) # define ACE_TKREACTOR_TRACE(X) #else /* (<API key> == 1) */ # if !defined (ACE_HAS_TRACE) # define ACE_HAS_TRACE # endif /* ACE_HAS_TRACE */ # define ACE_TKREACTOR_TRACE(X) ACE_TRACE_IMPL(X) # include "ace/Trace.h" #endif /* (<API key> == 1) */ #endif /* <API key> */ // End of auto generated file.
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>setInt</title> <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>setInt</h1> <!-- Type and Stereotype --> <section style="margin-top: .5em;"> <span class="alert alert-info"> <span class="node-icon _icon-UMLOperation"></span> UMLOperation </span> </section> <!-- Path --> <section style="margin-top: 10px"> <span class="label label-info"><a href='<API key>.html'><span class='node-icon _icon-Project'></span>Untitled</a></span> <span>::</span> <span class="label label-info"><a href='<API key>.html'><span class='node-icon _icon-UMLModel'></span>JavaReverse</a></span> <span>::</span> <span class="label label-info"><a href='<API key>.html'><span class='node-icon _icon-UMLPackage'></span>net</a></span> <span>::</span> <span class="label label-info"><a href='<API key>.html'><span class='node-icon _icon-UMLPackage'></span>gleamynode</a></span> <span>::</span> <span class="label label-info"><a href='<API key>.html'><span class='node-icon _icon-UMLPackage'></span>netty</a></span> <span>::</span> <span class="label label-info"><a href='<API key>.html'><span class='node-icon _icon-UMLPackage'></span>buffer</a></span> <span>::</span> <span class="label label-info"><a href='<API key>.html'><span class='node-icon _icon-UMLClass'></span><API key></a></span> <span>::</span> <span class="label label-info"><a href='<API key>.html'><span class='node-icon _icon-UMLOperation'></span>setInt</a></span> </section> <!-- Diagram --> <!-- Description --> <section> <h3>Description</h3> <div> <span class="label label-info">none</span> </div> </section> <!-- Specification --> <!-- Directed Relationship --> <!-- Undirected Relationship --> <!-- Classifier --> <!-- Interface --> <!-- Component --> <!-- Node --> <!-- Actor --> <!-- Use Case --> <!-- Template Parameters --> <!-- Literals --> <!-- Attributes --> <!-- Operations --> <!-- Receptions --> <!-- Extension Points --> <!-- Parameters --> <section> <h3>Parameters</h3> <table class="table table-striped table-bordered"> <tr> <th>Direction</th> <th>Name</th> <th>Type</th> <th>Description</th> </tr> <tr> <td>in</td> <td><a href="<API key>.html">index</a></td> <td>int</td> <td></td> </tr> <tr> <td>in</td> <td><a href="<API key>.html">value</a></td> <td>int</td> <td></td> </tr> <tr> <td>return</td> <td><a href="<API key>.html">(unnamed)</a></td> <td>void</td> <td></td> </tr> </table> </section> <!-- 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>setInt</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>isStatic</td> <td><span class='label label-info'>false</span></td> </tr> <tr> <td>isLeaf</td> <td><span class='label label-info'>false</span></td> </tr> <tr> <td>parameters</td> <td> <a href='<API key>.html'><span class='node-icon _icon-UMLParameter'></span>index</a> <span>, </span> <a href='<API key>.html'><span class='node-icon _icon-UMLParameter'></span>value</a> <span>, </span> <a href='<API key>.html'><span class='node-icon _icon-UMLParameter'></span>(Parameter)</a> </td> </tr> <tr> <td>raisedExceptions</td> <td> </td> </tr> <tr> <td>concurrency</td> <td>sequential</td> </tr> <tr> <td>isQuery</td> <td><span class='label label-info'>false</span></td> </tr> <tr> <td>isAbstract</td> <td><span class='label label-info'>false</span></td> </tr> <tr> <td>specification</td> <td></td> </tr> </table> </section> <!-- Tags --> <!-- Constraints, Dependencies, Dependants --> <!-- Relationships --> <!-- Owned Elements --> </div> </body> </html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <html> <head> <! $HeadURL$ </head> <body bgcolor="white"> A Transformation can be defined as an mathematical operation which transforms some values into other values using a specified function. In geographic terms this means, that some incoming coordinate in a specified crs, must be transformed into a coordinate valid for some other crs. <p>A polynomial transformations use a polynomial to approximate a function which directly transforms coordinates from one crs into another.</p> <h2>Automatic loading of transformation classes</h2> It is possible to create your own transformation classes, which the default provider {@link org.deegree.crs.configuration.deegree.DeegreeCRSProvider} will load automatically. <p>You can achieve this loading by supplying the <b><code>class</code></b> attribute to a <code>crs:CoordinateSystem/crs:transformation</code> element in the '<API key>.xml'. This attribute must contain the full class name (with package), e.g. <code>&lt;crs:transformation class='my.package.and.transformation.Implementation'&gt;</code></p> Because the loading is done with reflections your classes must sustain following criteria: <ol> <li>It must be a sub class of {@link org.deegree.crs.transformations.polynomial.<API key>}</li> <li>A constructor with following signature must be supplied: <br /> <code> public MyTransformation( <br /> &emsp;&emsp;&emsp;&emsp;java.util.list&lt;Double&gt; aValues,<br /> &emsp;&emsp;&emsp;&emsp;java.util.list&lt;Double&gt; bValues,<br /> &emsp;&emsp;&emsp;&emsp;{@link org.deegree.crs.coordinatesystems.CoordinateSystem} targetCRS,<br /> &emsp;&emsp;&emsp;&emsp;java.util.List&lt;org.w3c.dom.Element&gt; <API key><br /> );<br /> </code> <p>The first three parameters are common to all polynomial values (for an explanation of their meaning take a look at {@link org.deegree.crs.transformations.polynomial.<API key>}). Again, the last list, will contain all xml-dom elements you supplied in the deegree configuration (child elements of the crs:transformation/crs:MyTransformation), thus relieving you of the parsing of the <API key>.xml document.</p> </li> </ol> @author <a href="mailto:bezema@lat-lon.de">Rutger Bezema</a> @author last edited by: $Author$ @version $Revision$, $Date: 2007-03-20 10:15:15 +0100 (Di, 20 Mrz 2007)$ </body> </html>
package org.jboss.remoting3; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import javax.security.sasl.Sasl; import org.wildfly.common.Assert; import org.wildfly.security.auth.client.<API key>; import org.xnio.Option; import org.xnio.OptionMap; import org.xnio.Options; import org.xnio.Property; import org.xnio.Sequence; import org.xnio.sasl.SaslQop; import org.xnio.sasl.SaslStrength; /** * Common options for Remoting configuration. */ public final class RemotingOptions { private static final String[] NO_STRINGS = new String[0]; private RemotingOptions() { } /** * Merge the given option map into the given authentication configuration, and return the result. * * @param optionMap the option map (must not be {@code null}) * @param <API key> the authentication configuration (must not be {@code null}) * @return the merged authentication configuration (not {@code null}) */ public static <API key> mergeOptionsInto<API key>(OptionMap optionMap, <API key> <API key>) { Assert.checkNotNullParam("optionMap", optionMap); Assert.checkNotNullParam("<API key>, <API key>); final String protocol = optionMap.get(SASL_PROTOCOL); if (protocol != null) { <API key> = <API key>.useProtocol(protocol); } final String realm = optionMap.get(AUTH_REALM); if (realm != null) { <API key> = <API key>.useRealm(realm); } final String authzId = optionMap.get(AUTHORIZE_ID); if (authzId != null) { <API key> = <API key>.<API key>(authzId); } final Sequence<String> disallowedMechs = optionMap.get(Options.<API key>); if (disallowedMechs != null) { <API key> = <API key>.<API key>(disallowedMechs.toArray(NO_STRINGS)); } final Sequence<String> mechanisms = optionMap.get(Options.SASL_MECHANISMS); if (mechanisms != null) { <API key> = <API key>.allowSaslMechanisms(mechanisms.toArray(NO_STRINGS)); } final Map<String, String> saslPropertiesMap = new HashMap<>(); final Sequence<Property> properties = optionMap.get(Options.SASL_PROPERTIES); if (properties != null) { for (Property property : properties) { // ELY-894 //noinspection rawtypes,unchecked ((Map)saslPropertiesMap).put(property.getKey(), property.getValue()); } } final Boolean forwardSecrecy = optionMap.get(Options.<API key>); if (forwardSecrecy != null) { saslPropertiesMap.put(Sasl.<API key>, forwardSecrecy.toString()); } final Boolean noActive = optionMap.get(Options.<API key>); if (noActive != null) { saslPropertiesMap.put(Sasl.POLICY_NOACTIVE, noActive.toString()); } final Boolean noAnonymous = optionMap.get(Options.<API key>); if (noAnonymous != null) { saslPropertiesMap.put(Sasl.POLICY_NOANONYMOUS, noAnonymous.toString()); } final Boolean noDictionary = optionMap.get(Options.<API key>); if (noDictionary != null) { saslPropertiesMap.put(Sasl.POLICY_NODICTIONARY, noDictionary.toString()); } final Boolean noPlainText = optionMap.get(Options.<API key>); if (noPlainText != null) { saslPropertiesMap.put(Sasl.POLICY_NOPLAINTEXT, noPlainText.toString()); } final Boolean passCredentials = optionMap.get(Options.<API key>); if (passCredentials != null) { saslPropertiesMap.put(Sasl.<API key>, passCredentials.toString()); } final Sequence<SaslQop> qop = optionMap.get(Options.SASL_QOP); if (qop != null) { final Iterator<SaslQop> iterator = qop.iterator(); if (iterator.hasNext()) { StringBuilder b = new StringBuilder().append(iterator.next().getString()); while (iterator.hasNext()) { b.append(',').append(iterator.next().getString()); } saslPropertiesMap.put(Sasl.QOP, b.toString()); } } final Boolean reuse = optionMap.get(Options.SASL_REUSE); if (reuse != null) { saslPropertiesMap.put(Sasl.REUSE, reuse.toString()); } final SaslStrength strength = optionMap.get(Options.SASL_STRENGTH); if (strength != null) { switch (strength) { case LOW: saslPropertiesMap.put(Sasl.STRENGTH, "low"); break; case MEDIUM: saslPropertiesMap.put(Sasl.STRENGTH, "medium"); break; case HIGH: saslPropertiesMap.put(Sasl.STRENGTH, "high"); break; default: throw Assert.<API key>(strength); } } final Boolean serverAuth = optionMap.get(Options.SASL_SERVER_AUTH); if (serverAuth != null) { saslPropertiesMap.put(Sasl.SERVER_AUTH, serverAuth.toString()); } if (! saslPropertiesMap.isEmpty()) { <API key> = <API key>.<API key>(saslPropertiesMap); } return <API key>; } /** * The size of the largest buffer that this endpoint will transmit over a connection. */ public static final Option<Integer> SEND_BUFFER_SIZE = Option.simple(RemotingOptions.class, "SEND_BUFFER_SIZE", Integer.class); /** * The default send buffer size. */ public static final int <API key> = 8192; /** * The size of the largest buffer that this endpoint will accept over a connection. */ public static final Option<Integer> RECEIVE_BUFFER_SIZE = Option.simple(RemotingOptions.class, "RECEIVE_BUFFER_SIZE", Integer.class); /** * The default receive buffer size. */ public static final int <API key> = 8192; /** * The size of allocated buffer regions. */ public static final Option<Integer> BUFFER_REGION_SIZE = Option.simple(RemotingOptions.class, "BUFFER_REGION_SIZE", Integer.class); /** * The maximum window size of the transmit direction for connection channels, in bytes. */ public static final Option<Integer> <API key> = Option.simple(RemotingOptions.class, "<API key>", Integer.class); /** * The default requested window size of the transmit direction for incoming channel open attempts. */ public static final int <API key> = 0x20000; /** * The default requested window size of the transmit direction for outgoing channel open attempts. */ public static final int <API key> = Integer.MAX_VALUE; /** * The maximum window size of the receive direction for connection channels, in bytes. */ public static final Option<Integer> RECEIVE_WINDOW_SIZE = Option.simple(RemotingOptions.class, "RECEIVE_WINDOW_SIZE", Integer.class); /** * The default requested window size of the receive direction for incoming channel open attempts. */ public static final int <API key> = 0x20000; /** * The default requested window size of the receive direction for outgoing channel open attempts. */ public static final int <API key> = 0x20000; /** * The maximum number of outbound channels to support for a connection. */ public static final Option<Integer> <API key> = Option.simple(RemotingOptions.class, "<API key>", Integer.class); /** * The default maximum number of outbound channels. */ public static final int <API key> = 40; /** * The maximum number of inbound channels to support for a connection. */ public static final Option<Integer> <API key> = Option.simple(RemotingOptions.class, "<API key>", Integer.class); /** * The default maximum number of inbound channels. */ public static final int <API key> = 40; /** * The SASL authorization ID. Used as authentication user name to use if no authentication {@code CallbackHandler} is specified * and the selected SASL mechanism demands a user name. */ public static final Option<String> AUTHORIZE_ID = Option.simple(RemotingOptions.class, "AUTHORIZE_ID", String.class); /** * Deprecated alias for {@link #AUTHORIZE_ID}. */ @Deprecated public static final Option<String> AUTH_USER_NAME = AUTHORIZE_ID; /** * The authentication realm to use if no authentication {@code CallbackHandler} is specified. */ public static final Option<String> AUTH_REALM = Option.simple(RemotingOptions.class, "AUTH_REALM", String.class); /** * Specify the number of times a client is allowed to retry authentication before closing the connection. */ public static final Option<Integer> <API key> = Option.simple(RemotingOptions.class, "<API key>, Integer.class); /** * The default number of authentication retries. */ public static final int DEFAULT_<API key> = 3; /** * The maximum number of concurrent outbound messages on a channel. */ public static final Option<Integer> <API key> = Option.simple(RemotingOptions.class, "<API key>", Integer.class); /** * The default maximum number of concurrent outbound messages on an incoming channel. */ public static final int <API key> = 80; /** * The default maximum number of concurrent outbound messages on an outgoing channel. */ public static final int <API key> = 0xffff; /** * The maximum number of concurrent inbound messages on a channel. */ public static final Option<Integer> <API key> = Option.simple(RemotingOptions.class, "<API key>", Integer.class); /** * The default maximum number of concurrent inbound messages on a channel. */ public static final int <API key> = 80; /** * The interval to use for connection heartbeat, in milliseconds. If the connection is idle in the outbound direction * for this amount of time, a ping message will be sent, which will trigger a corresponding reply message. */ public static final Option<Integer> HEARTBEAT_INTERVAL = Option.simple(RemotingOptions.class, "HEARTBEAT_INTERVAL", Integer.class); /** * The default heartbeat interval. */ public static final int <API key> = Integer.MAX_VALUE; /** * The maximum inbound message size to be allowed. Messages exceeding this size will cause an exception to be thrown * on the reading side as well as the writing side. */ public static final Option<Long> <API key> = Option.simple(RemotingOptions.class, "<API key>", Long.class); /** * The default maximum inbound message size. */ public static final long <API key> = Long.MAX_VALUE; /** * The maximum outbound message size to send. No messages larger than this well be transmitted; attempting to do * so will cause an exception on the writing side. */ public static final Option<Long> <API key> = Option.simple(RemotingOptions.class, "<API key>", Long.class); /** * The default maximum outbound message size. */ public static final long <API key> = Long.MAX_VALUE; /** * The server side of the connection passes it's name to the client in the initial greeting, by default the name is * automatically discovered from the local address of the connection or it can be overridden using this {@code Option}. */ public static final Option<String> SERVER_NAME = Option.simple(RemotingOptions.class, "SERVER_NAME", String.class); public static final Option<String> SASL_PROTOCOL = Option.simple(RemotingOptions.class, "SASL_PROTOCOL", String.class); /** * The default SASL protocol name. */ public static final String <API key> = "remote"; }